agent-claw: automated task changes
This commit is contained in:
55
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/alarm-options.d.ts
generated
vendored
Normal file
55
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/alarm-options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import type * as cdk from '../../../core';
|
||||
import type { TreatMissingData } from '../alarm';
|
||||
/**
|
||||
* Base options for creating CloudWatch alarms
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface CreateAlarmOptionsBase {
|
||||
/**
|
||||
* Name of the alarm
|
||||
*
|
||||
* @default Automatically generated name
|
||||
*/
|
||||
readonly alarmName?: string;
|
||||
/**
|
||||
* Description for the alarm
|
||||
*
|
||||
* @default No description
|
||||
*/
|
||||
readonly alarmDescription?: string;
|
||||
/**
|
||||
* The number of periods over which data is compared to the specified threshold.
|
||||
*/
|
||||
readonly evaluationPeriods: number;
|
||||
/**
|
||||
* Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant.
|
||||
*
|
||||
* Used only for alarms that are based on percentiles.
|
||||
*
|
||||
* @default - Not configured.
|
||||
*/
|
||||
readonly evaluateLowSampleCountPercentile?: string;
|
||||
/**
|
||||
* Sets how this alarm is to handle missing data points.
|
||||
*
|
||||
* @default TreatMissingData.Missing
|
||||
*/
|
||||
readonly treatMissingData?: TreatMissingData;
|
||||
/**
|
||||
* Whether the actions for this alarm are enabled
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
readonly actionsEnabled?: boolean;
|
||||
/**
|
||||
* The number of datapoints that must be breaching to trigger the alarm. This is used only if you are setting an "M
|
||||
* out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon
|
||||
* CloudWatch User Guide.
|
||||
*
|
||||
* @default ``evaluationPeriods``
|
||||
*
|
||||
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation
|
||||
*/
|
||||
readonly datapointsToAlarm?: number;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/alarm-options.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/alarm-options.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
||||
8
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/anomaly-detection.d.ts
generated
vendored
Normal file
8
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/anomaly-detection.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { ComparisonOperator } from '../alarm';
|
||||
/**
|
||||
* Determine whether this operator is an anomaly detection operator.
|
||||
*
|
||||
* @param operator the comparison operator for the alarm.
|
||||
* @returns true if the operator is an anomaly detection operator, false otherwise.
|
||||
*/
|
||||
export declare function isAnomalyDetectionOperator(operator?: ComparisonOperator): boolean;
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/anomaly-detection.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/anomaly-detection.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isAnomalyDetectionOperator=isAnomalyDetectionOperator;var alarm_1=()=>{var tmp=require("../alarm");return alarm_1=()=>tmp,tmp};function isAnomalyDetectionOperator(operator){const anomalyDetectionOperators=[alarm_1().ComparisonOperator.LESS_THAN_LOWER_OR_GREATER_THAN_UPPER_THRESHOLD,alarm_1().ComparisonOperator.GREATER_THAN_UPPER_THRESHOLD,alarm_1().ComparisonOperator.LESS_THAN_LOWER_THRESHOLD];return operator!==void 0&&anomalyDetectionOperators.includes(operator)}
|
||||
14
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.d.ts
generated
vendored
Normal file
14
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type * as cdk from '../../../core';
|
||||
/**
|
||||
* A Token object that will drop the last element of an array if it is an empty object
|
||||
*
|
||||
* Necessary to prevent options objects that only contain "region" and "account" keys
|
||||
* that evaluate to "undefined" from showing up in the rendered JSON.
|
||||
*/
|
||||
export declare class DropEmptyObjectAtTheEndOfAnArray implements cdk.IResolvable, cdk.IPostProcessor {
|
||||
private readonly value;
|
||||
readonly creationStack: string[];
|
||||
constructor(value: any);
|
||||
resolve(context: cdk.IResolveContext): any;
|
||||
postProcess(o: any, _context: cdk.IResolveContext): any;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DropEmptyObjectAtTheEndOfAnArray=void 0;var object_1=()=>{var tmp=require("./object");return object_1=()=>tmp,tmp};class DropEmptyObjectAtTheEndOfAnArray{value;creationStack=["Token stack traces are no longer captured"];constructor(value){this.value=value}resolve(context){return context.registerPostProcessor(this),context.resolve(this.value)}postProcess(o,_context){if(!Array.isArray(o))return o;const lastEl=o[o.length-1];return typeof lastEl=="object"&&lastEl!==null&&Object.keys((0,object_1().dropUndefined)(lastEl)).length===0?o.slice(0,o.length-1):o}}exports.DropEmptyObjectAtTheEndOfAnArray=DropEmptyObjectAtTheEndOfAnArray;
|
||||
8
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/env-tokens.d.ts
generated
vendored
Normal file
8
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/env-tokens.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Make a Token that renders to given region if used in a different stack, otherwise undefined
|
||||
*/
|
||||
export declare function regionIfDifferentFromStack(region: string): string;
|
||||
/**
|
||||
* Make a Token that renders to given account if used in a different stack, otherwise undefined
|
||||
*/
|
||||
export declare function accountIfDifferentFromStack(account: string): string;
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/env-tokens.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/env-tokens.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.regionIfDifferentFromStack=regionIfDifferentFromStack,exports.accountIfDifferentFromStack=accountIfDifferentFromStack;var cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp};function regionIfDifferentFromStack(region){return cdk().Token.asString(new StackDependentToken(region,stack=>stack.region))}function accountIfDifferentFromStack(account){return cdk().Token.asString(new StackDependentToken(account,stack=>stack.account))}class StackDependentToken{originalValue;fn;creationStack=["Token stack traces are no longer captured"];constructor(originalValue,fn){this.originalValue=originalValue,this.fn=fn}resolve(context){const stackValue=this.fn(cdk().Stack.of(context.scope));if(!(!cdk().Token.isUnresolved(stackValue)&&stackValue===this.originalValue))return this.originalValue}toString(){return cdk().Token.asString(this)}toJSON(){return this.originalValue}}
|
||||
4
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/make-enumerable.d.ts
generated
vendored
Normal file
4
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/make-enumerable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Make a property from the specified prototype enumerable on the specific instance.
|
||||
*/
|
||||
export declare function makeEnumerable(prototype: object, instance: object, propertyKey: string): void;
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/make-enumerable.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/make-enumerable.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.makeEnumerable=makeEnumerable;function makeEnumerable(prototype,instance,propertyKey){Object.defineProperty(instance,propertyKey,{...Object.getOwnPropertyDescriptor(prototype,propertyKey),enumerable:!0})}
|
||||
72
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/metric-util.d.ts
generated
vendored
Normal file
72
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/metric-util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Duration } from '../../../core';
|
||||
import type { IMetric, MetricConfig, MetricExpressionConfig, MetricStatConfig } from '../metric-types';
|
||||
/**
|
||||
* Return a unique string representation for this metric.
|
||||
*
|
||||
* Can be used to determine as a hash key to determine if 2 Metric objects
|
||||
* represent the same metric. Excludes rendering properties.
|
||||
*/
|
||||
export declare function metricKey(metric: IMetric): string;
|
||||
/**
|
||||
* Return the period of a metric
|
||||
*
|
||||
* For a stat metric, return the immediate period.
|
||||
*
|
||||
* For a math expression metric, all metrics used in it have been made to have the
|
||||
* same period, so we return the period of the first inner metric.
|
||||
*
|
||||
* For a search expression metric, return the period of the search expression.
|
||||
*/
|
||||
export declare function metricPeriod(metric: IMetric): Duration;
|
||||
/**
|
||||
* Given a metric object, inspect it and call the correct function for the type of output
|
||||
*
|
||||
* In addition to the metric object itself, takes a callback object with three
|
||||
* methods, to be invoked for the particular type of metric.
|
||||
*
|
||||
* If the metric represent a metric query (nominally generated through an
|
||||
* instantiation of `Metric` but can be generated by any class that implements
|
||||
* `IMetric`) a particular field in its `toMetricConfig()` output will be set
|
||||
* (to wit, `metricStat`) and the `withStat()` callback will be called with
|
||||
* that object.
|
||||
*
|
||||
* If the metric represents a math expression (usually by instantiating `MathExpression`
|
||||
* but users can implement `IMetric` arbitrarily) the `mathExpression` field
|
||||
* will be set in the object returned from `toMetricConfig` and the callback
|
||||
* called `withMathExpression` will be applied to that object.
|
||||
*
|
||||
* If the metric represents a search expression (usually by instantiating `SearchExpression`
|
||||
* but users can implement `IMetric` arbitrarily) the `searchExpression` field
|
||||
* will be set in the object returned from `toMetricConfig` and the callback
|
||||
* called `withSearchExpression` will be applied to that object.
|
||||
*
|
||||
* Will return the values returned by the callbacks.
|
||||
*
|
||||
* To be used as such:
|
||||
*
|
||||
* ```ts
|
||||
* const ret = dispatchMetric(someMetric, {
|
||||
* withStat(stat) {
|
||||
* // do something with stat
|
||||
* return 1;
|
||||
* },
|
||||
* withMathExpression(mathExpr) {
|
||||
* // do something with math expression
|
||||
* return 2;
|
||||
* },
|
||||
* withSearchExpression(searchExpr) {
|
||||
* // do something with search expression
|
||||
* return 3;
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* This function encapsulates some type analysis that would otherwise have to be
|
||||
* repeated in all places where code needs to make a distinction on the type
|
||||
* of metric object that is being passed.
|
||||
*/
|
||||
export declare function dispatchMetric<A, B, C>(metric: IMetric, fns: {
|
||||
withStat: (x: MetricStatConfig, c: MetricConfig) => A;
|
||||
withMathExpression: (x: MetricExpressionConfig, c: MetricConfig) => B;
|
||||
withSearchExpression: (x: MetricExpressionConfig, c: MetricConfig) => C;
|
||||
}): A | B | C;
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/metric-util.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/metric-util.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.metricKey=metricKey,exports.metricPeriod=metricPeriod,exports.dispatchMetric=dispatchMetric;var core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};const METRICKEY_SYMBOL=Symbol("@aws-cdk/aws-cloudwatch.MetricKey");function metricKey(metric){if(metric.hasOwnProperty(METRICKEY_SYMBOL))return metric[METRICKEY_SYMBOL];const parts=new Array,conf=metric.toMetricConfig();if(conf.mathExpression){parts.push(conf.mathExpression.expression);for(const id of Object.keys(conf.mathExpression.usingMetrics).sort())parts.push(id),parts.push(metricKey(conf.mathExpression.usingMetrics[id]));conf.mathExpression.searchRegion&&parts.push(conf.mathExpression.searchRegion),conf.mathExpression.searchAccount&&parts.push(conf.mathExpression.searchAccount)}if(conf.searchExpression&&(parts.push(conf.searchExpression.expression),conf.searchExpression.searchRegion&&parts.push(conf.searchExpression.searchRegion),conf.searchExpression.searchAccount&&parts.push(conf.searchExpression.searchAccount)),conf.metricStat){parts.push(conf.metricStat.namespace),parts.push(conf.metricStat.metricName);for(const dim of conf.metricStat.dimensions||[])parts.push(dim.name),parts.push(dim.value);conf.metricStat.statistic&&parts.push(conf.metricStat.statistic),conf.metricStat.period&&parts.push(`${conf.metricStat.period.toSeconds()}`),conf.metricStat.region&&parts.push(conf.metricStat.region),conf.metricStat.account&&parts.push(conf.metricStat.account)}const ret=parts.join("|");return Object.defineProperty(metric,METRICKEY_SYMBOL,{value:ret}),ret}function metricPeriod(metric){return dispatchMetric(metric,{withStat(stat){return stat.period},withMathExpression(){return metric.period||core_1().Duration.minutes(5)},withSearchExpression(){return metric.period||core_1().Duration.minutes(5)}})}function dispatchMetric(metric,fns){const conf=metric.toMetricConfig();if([conf.metricStat,conf.mathExpression,conf.searchExpression].map(Boolean).filter(Boolean).length>1)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`MetricObjectCannotProduceMultipleTypes`,"Metric object must not produce more than one of 'metricStat', 'mathExpression', or 'searchExpression'");if(conf.metricStat)return fns.withStat(conf.metricStat,conf);if(conf.mathExpression)return fns.withMathExpression(conf.mathExpression,conf);if(conf.searchExpression)return fns.withSearchExpression(conf.searchExpression,conf);throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`MetricObjectMustHaveOneType`,"Metric object must have either 'metricStat', 'mathExpression', or 'searchExpression'")}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/object.d.ts
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/object.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function dropUndefined<T extends object>(x: T): T;
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/object.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/object.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.dropUndefined=dropUndefined;function dropUndefined(x){if(x===null)return x;const ret={};for(const[key,value]of Object.entries(x))value!==void 0&&(ret[key]=value);return ret}
|
||||
67
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/rendering.d.ts
generated
vendored
Normal file
67
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/rendering.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { IMetric } from '../metric-types';
|
||||
/**
|
||||
* Return the JSON structure which represents these metrics in a graph.
|
||||
*
|
||||
* Depending on the metric type (stat or expression), one `Metric` object
|
||||
* can render to multiple time series.
|
||||
*
|
||||
* - Top-level metrics will be rendered visibly, additionally added metrics will
|
||||
* be rendered invisibly.
|
||||
* - IDs used in math expressions need to be either globally unique, or refer to the same
|
||||
* metric object.
|
||||
*
|
||||
* This will be called by GraphWidget, no need for clients to call this.
|
||||
*/
|
||||
export declare function allMetricsGraphJson(left: IMetric[], right: IMetric[]): any[];
|
||||
/**
|
||||
* A single metric in a MetricSet
|
||||
*/
|
||||
export interface MetricEntry<A> {
|
||||
/**
|
||||
* The metric object
|
||||
*/
|
||||
readonly metric: IMetric;
|
||||
/**
|
||||
* The tag, added if the object is a primary metric
|
||||
*/
|
||||
tag?: A;
|
||||
/**
|
||||
* ID for this metric object
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The level we discovered this metric at.
|
||||
*
|
||||
* Top-level has 1, metrics used by a math expression at level N will have
|
||||
* N+1.
|
||||
*/
|
||||
level: number;
|
||||
}
|
||||
/**
|
||||
* Contain a set of metrics, expanding math expressions
|
||||
*
|
||||
* "Primary" metrics (added via a top-level call) can be tagged with an additional value.
|
||||
*/
|
||||
export declare class MetricSet<A> {
|
||||
private readonly metrics;
|
||||
private readonly metricById;
|
||||
private readonly metricByKey;
|
||||
/**
|
||||
* Add the given set of metrics to this set
|
||||
*/
|
||||
addTopLevel(tag: A, ...metrics: IMetric[]): void;
|
||||
/**
|
||||
* Access all the accumulated timeseries entries
|
||||
*/
|
||||
get entries(): ReadonlyArray<MetricEntry<A>>;
|
||||
/**
|
||||
* Add a metric into the set
|
||||
*
|
||||
* The id may not be the same as a previous metric added, unless it's the same metric.
|
||||
*
|
||||
* It can be made visible, in which case the new "metric" object replaces the old
|
||||
* one (and the new ones "renderingPropertieS" will be honored instead of the old
|
||||
* one's).
|
||||
*/
|
||||
private addOne;
|
||||
}
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/rendering.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/rendering.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetricSet=void 0,exports.allMetricsGraphJson=allMetricsGraphJson;var drop_empty_object_at_the_end_of_an_array_token_1=()=>{var tmp=require("./drop-empty-object-at-the-end-of-an-array-token");return drop_empty_object_at_the_end_of_an_array_token_1=()=>tmp,tmp},env_tokens_1=()=>{var tmp=require("./env-tokens");return env_tokens_1=()=>tmp,tmp},metric_util_1=()=>{var tmp=require("./metric-util");return metric_util_1=()=>tmp,tmp},object_1=()=>{var tmp=require("./object");return object_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};function allMetricsGraphJson(left,right){const mset=new MetricSet;return mset.addTopLevel("left",...left),mset.addTopLevel("right",...right),mset.entries.map(entry=>new(drop_empty_object_at_the_end_of_an_array_token_1()).DropEmptyObjectAtTheEndOfAnArray(metricGraphJson(entry.metric,entry.tag,entry.id)))}const applyExpressionOptions=(options,exprConfig)=>{options.expression=exprConfig.expression,exprConfig.searchAccount&&(options.accountId=(0,env_tokens_1().accountIfDifferentFromStack)(exprConfig.searchAccount)),exprConfig.searchRegion&&(options.region=(0,env_tokens_1().regionIfDifferentFromStack)(exprConfig.searchRegion)),exprConfig.period&&exprConfig.period!==300&&(options.period=exprConfig.period)};function metricGraphJson(metric,yAxis,id){const config=metric.toMetricConfig(),ret=[],options={...config.renderingProperties};(0,metric_util_1().dispatchMetric)(metric,{withStat(stat){ret.push(stat.namespace,stat.metricName);for(const dim of stat.dimensions||[])ret.push(dim.name,dim.value);stat.accountOverride?options.accountId=stat.accountOverride:stat.account&&(options.accountId=(0,env_tokens_1().accountIfDifferentFromStack)(stat.account)),stat.regionOverride?options.region=stat.regionOverride:stat.region&&(options.region=(0,env_tokens_1().regionIfDifferentFromStack)(stat.region)),stat.period&&stat.period.toSeconds()!==300&&(options.period=stat.period.toSeconds()),stat.statistic&&stat.statistic!=="Average"&&(options.stat=stat.statistic)},withMathExpression(mathExpr){applyExpressionOptions(options,mathExpr)},withSearchExpression(searchExpr){applyExpressionOptions(options,searchExpr)}}),yAxis||(options.visible=!1),yAxis!=="left"&&(options.yAxis=yAxis),id&&(options.id=id),options.visible!==!1&&options.expression&&!options.label&&(options.label=options.label===""?void 0:metric.toString());const renderedOpts=(0,object_1().dropUndefined)(options);return Object.keys(renderedOpts).length!==0&&ret.push(renderedOpts),ret}class MetricSet{metrics=new Array;metricById=new Map;metricByKey=new Map;addTopLevel(tag,...metrics){for(const metric of metrics)this.addOne(metric,1,tag)}get entries(){return this.metrics}addOne(metric,level,tag,id){const key=(0,metric_util_1().metricKey)(metric);let existingEntry;if(id&&(existingEntry=this.metricById.get(id),existingEntry&&(0,metric_util_1().metricKey)(existingEntry.metric)!==key))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`CannotShareSameIdForDifferentMetrics`,`Cannot have two different metrics share the same id ('${id}') in one Alarm or Graph. Rename one of them.`);existingEntry||(existingEntry=this.metricByKey.get(key),existingEntry?.id&&id&&(existingEntry=void 0));let entry;existingEntry?entry=existingEntry:(entry={metric,level},this.metrics.push(entry),this.metricByKey.set(key,entry)),!entry.id&&id&&(entry.id=id,this.metricById.set(id,entry)),!entry.tag&&tag&&(entry.tag=tag);const conf=metric.toMetricConfig();if(conf.mathExpression)for(const[subId,subMetric]of Object.entries(conf.mathExpression.usingMetrics))this.addOne(subMetric,level+1,void 0,subId)}}exports.MetricSet=MetricSet;
|
||||
51
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/statistic.d.ts
generated
vendored
Normal file
51
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/statistic.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
export interface SimpleStatistic {
|
||||
type: 'simple';
|
||||
statistic: string;
|
||||
}
|
||||
export interface GenericStatistic {
|
||||
type: 'generic';
|
||||
statistic: string;
|
||||
}
|
||||
export interface ParseableStatistic {
|
||||
statPrefix: string;
|
||||
statName: string;
|
||||
rawStatistic: string;
|
||||
}
|
||||
export interface SingleStatistic extends ParseableStatistic {
|
||||
type: 'single';
|
||||
value: number;
|
||||
}
|
||||
export interface PairStatistic extends ParseableStatistic {
|
||||
type: 'pair';
|
||||
isPercent: boolean;
|
||||
lower?: number;
|
||||
upper?: number;
|
||||
canBeSingleStat: boolean;
|
||||
asSingleStatStr?: string;
|
||||
}
|
||||
export interface PercentileStatistic extends SingleStatistic {
|
||||
statName: 'percentile';
|
||||
}
|
||||
export interface PercentileRankStatistic extends PairStatistic {
|
||||
statName: 'percentileRank';
|
||||
}
|
||||
export interface TrimmedMeanStatistic extends PairStatistic {
|
||||
statName: 'trimmedMean';
|
||||
}
|
||||
export interface WinsorizedMeanStatistic extends PairStatistic {
|
||||
statName: 'winsorizedMean';
|
||||
}
|
||||
export interface TrimmedCountStatistic extends PairStatistic {
|
||||
statName: 'trimmedCount';
|
||||
}
|
||||
export interface TrimmedSumStatistic extends PairStatistic {
|
||||
statName: 'trimmedSum';
|
||||
}
|
||||
export declare function singleStatisticToString(parsed: SingleStatistic): string;
|
||||
export declare function pairStatisticToString(parsed: PairStatistic): string;
|
||||
/**
|
||||
* Parse a statistic, returning the type of metric that was used
|
||||
*/
|
||||
export declare function parseStatistic(stat: string): SimpleStatistic | PercentileStatistic | PercentileRankStatistic | TrimmedMeanStatistic | WinsorizedMeanStatistic | TrimmedCountStatistic | TrimmedSumStatistic | GenericStatistic;
|
||||
export declare function normalizeStatistic(parsed: ReturnType<typeof parseStatistic>): string;
|
||||
export declare function normalizeRawStringStatistic(stat: string): string;
|
||||
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/statistic.js
generated
vendored
Normal file
1
cdk/node_modules/aws-cdk-lib/aws-cloudwatch/lib/private/statistic.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.singleStatisticToString=singleStatisticToString,exports.pairStatisticToString=pairStatisticToString,exports.parseStatistic=parseStatistic,exports.normalizeStatistic=normalizeStatistic,exports.normalizeRawStringStatistic=normalizeRawStringStatistic;var stats_1=()=>{var tmp=require("../stats");return stats_1=()=>tmp,tmp};function parseSingleStatistic(statistic,prefix){const prefixLower=prefix.toLowerCase();if(statistic=statistic.toLowerCase(),!statistic.startsWith(prefixLower))return;const reDecimal="\\d+(?:\\.\\d+)?",r=new RegExp(`^${prefixLower}(${reDecimal})$`).exec(statistic);if(!r)return;const value=parseFloat(r[1]);if(!(value<0||value>100))return{type:"single",rawStatistic:statistic,statPrefix:prefixLower,value}}function parsePairStatistic(statistic,prefix){const r=new RegExp(`^${prefix}\\(([^)]+)\\)$`,"i").exec(statistic);if(!r)return;const common={type:"pair",canBeSingleStat:!1,rawStatistic:statistic,statPrefix:prefix.toUpperCase()},[lhs,rhs]=r[1].split(":");if(rhs===void 0)return;const parseNumberAndPercent=x=>{if(x=x.trim(),!x)return[void 0,!1];const value=parseFloat(x.replace(/%$/,"")),percent=x.endsWith("%");return isNaN(value)||value<0||percent&&value>100?["fail",!1]:[value,percent]},[lower,lhsPercent]=parseNumberAndPercent(lhs),[upper,rhsPercent]=parseNumberAndPercent(rhs);if(lower==="fail"||upper==="fail"||lower===void 0&&upper===void 0||lower!==void 0&&upper!==void 0&&lhsPercent!==rhsPercent)return;const isPercent=lhsPercent||rhsPercent,canBeSingleStat=lower===void 0&&isPercent,asSingleStatStr=canBeSingleStat?`${prefix.toLowerCase()}${upper}`:void 0;return{...common,lower,upper,isPercent,canBeSingleStat,asSingleStatStr}}function singleStatisticToString(parsed){return`${parsed.statPrefix}${parsed.value}`}function pairStatisticToString(parsed){const percent=parsed.isPercent?"%":"",lower=parsed.lower?`${parsed.lower}${percent}`:"",upper=parsed.upper?`${parsed.upper}${percent}`:"";return`${parsed.statPrefix}(${lower}:${upper})`}function parseStatistic(stat){const lowerStat=stat.toLowerCase(),statMap={average:stats_1().Stats.AVERAGE,avg:stats_1().Stats.AVERAGE,minimum:stats_1().Stats.MINIMUM,min:stats_1().Stats.MINIMUM,maximum:stats_1().Stats.MAXIMUM,max:stats_1().Stats.MAXIMUM,samplecount:stats_1().Stats.SAMPLE_COUNT,n:stats_1().Stats.SAMPLE_COUNT,sum:stats_1().Stats.SUM,iqm:stats_1().Stats.IQM};if(lowerStat in statMap)return{type:"simple",statistic:statMap[lowerStat]};let m;return m=parseSingleStatistic(stat,"p"),m?{...m,statName:"percentile"}:(m=parsePairStatistic(stat,"pr"),m?{...m,statName:"percentileRank"}:(m=parseSingleStatistic(stat,"tm")||parsePairStatistic(stat,"tm"),m?{...m,statName:"trimmedMean"}:(m=parseSingleStatistic(stat,"wm")||parsePairStatistic(stat,"wm"),m?{...m,statName:"winsorizedMean"}:(m=parseSingleStatistic(stat,"tc")||parsePairStatistic(stat,"tc"),m?{...m,statName:"trimmedCount"}:(m=parseSingleStatistic(stat,"ts")||parsePairStatistic(stat,"ts"),m?{...m,statName:"trimmedSum"}:{type:"generic",statistic:stat})))))}function normalizeStatistic(parsed){return parsed.type==="simple"||parsed.type==="generic"?parsed.statistic:parsed.type==="single"?parsed.rawStatistic.toLowerCase():parsed.type==="pair"?parsed.rawStatistic.toUpperCase():""}function normalizeRawStringStatistic(stat){const parsed=parseStatistic(stat);return normalizeStatistic(parsed)}
|
||||
Reference in New Issue
Block a user