stacktape 3.1.2 → 3.2.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. package/index.d.ts +27 -1
  2. package/index.js +444 -458
  3. package/package.json +1 -1
  4. package/sdk.d.ts +47 -7
  5. package/sdk.js +11262 -12325
  6. package/types.d.ts +277 -4
package/types.d.ts CHANGED
@@ -84,6 +84,21 @@ import type {
84
84
  LambdaEfsMountProps,
85
85
  CognitoAuthorizerProperties,
86
86
  LambdaAuthorizerProperties,
87
+ ApplicationLoadBalancerCustomTriggerProps,
88
+ ApplicationLoadBalancerErrorRateTriggerProps,
89
+ ApplicationLoadBalancerUnhealthyTargetsTriggerProps,
90
+ HttpApiGatewayErrorRateTriggerProps,
91
+ HttpApiGatewayLatencyTriggerProps,
92
+ RelationalDatabaseReadLatencyTriggerProps,
93
+ RelationalDatabaseWriteLatencyTriggerProps,
94
+ RelationalDatabaseCPUUtilizationTriggerProps,
95
+ RelationalDatabaseFreeStorageTriggerProps,
96
+ RelationalDatabaseFreeMemoryTriggerProps,
97
+ RelationalDatabaseConnectionCountTriggerProps,
98
+ SqsQueueReceivedMessagesCountTriggerProps,
99
+ SqsQueueNotEmptyTrigger,
100
+ LambdaErrorRateTriggerProps,
101
+ LambdaDurationTriggerProps,
87
102
  CustomResourceDefinitionProps,
88
103
  CustomResourceInstanceProps,
89
104
  DeploymentScriptProps,
@@ -98,6 +113,7 @@ declare const getTransformsSymbol: unique symbol;
98
113
  declare const setResourceNameSymbol: unique symbol;
99
114
  declare const resourceParamRefSymbol: unique symbol;
100
115
  declare const baseTypePropertiesSymbol: unique symbol;
116
+ declare const alarmSymbol: unique symbol;
101
117
  /**
102
118
  * A reference to a resource parameter that will be resolved at runtime.
103
119
  * Stores a reference to the resource for lazy name resolution.
@@ -105,6 +121,25 @@ declare const baseTypePropertiesSymbol: unique symbol;
105
121
  /**
106
122
  * Base class for type/properties structures (engines, packaging, events, etc.)
107
123
  */
124
+ /**
125
+ * Base class for type-only structures (no properties field, just type discriminator)
126
+ */
127
+ /**
128
+ * Defines a CloudWatch alarm that monitors a metric and triggers notifications when thresholds are breached.
129
+ *
130
+ * Alarms can be attached to resources like Lambda functions, databases, load balancers, SQS queues, and HTTP API Gateways.
131
+ * When the alarm condition is met (e.g., error rate exceeds 5%), notifications are sent to configured targets (Slack, email, MS Teams).
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * new Alarm({
136
+ * trigger: new LambdaErrorRateTrigger({ thresholdPercent: 5 }),
137
+ * evaluation: { period: 60, evaluationPeriods: 3, breachedPeriods: 2 },
138
+ * notificationTargets: [{ slack: { url: $Secret('slack-webhook-url') } }],
139
+ * description: 'Lambda error rate exceeded 5%'
140
+ * })
141
+ * ```
142
+ */
108
143
  /**
109
144
  * Base resource class that provides common functionality
110
145
  */
@@ -131,6 +166,10 @@ declare const getPropertiesSymbol: unique symbol;
131
166
 
132
167
  declare const getOverridesSymbol: unique symbol;
133
168
 
169
+ /**
170
+ * A reference to a resource parameter that will be resolved at runtime.
171
+ * Stores a reference to the resource for lazy name resolution.
172
+ */
134
173
  export declare class ResourceParamReference {
135
174
  private __resource;
136
175
  private __param;
@@ -141,13 +180,101 @@ export declare class ResourceParamReference {
141
180
  valueOf(): string;
142
181
  }
143
182
 
183
+ /**
184
+ * A reference to a resource parameter that will be resolved at runtime.
185
+ * Stores a reference to the resource for lazy name resolution.
186
+ */
187
+ export declare class ResourceParamReference {
188
+ private __resource;
189
+ private __param;
190
+ readonly [resourceParamRefSymbol] = true;
191
+ constructor(resource: BaseResource, param: string);
192
+ toString(): string;
193
+ toJSON(): string;
194
+ valueOf(): string;
195
+ }
196
+ /**
197
+ * Base class for type/properties structures (engines, packaging, events, etc.)
198
+ */
199
+ export declare class BaseTypeProperties {
200
+ readonly type: string;
201
+ readonly properties: any;
202
+ readonly [baseTypePropertiesSymbol] = true;
203
+ constructor(type: string, properties: any);
204
+ }
205
+
206
+ /**
207
+ * A reference to a resource parameter that will be resolved at runtime.
208
+ * Stores a reference to the resource for lazy name resolution.
209
+ */
210
+ export declare class ResourceParamReference {
211
+ private __resource;
212
+ private __param;
213
+ readonly [resourceParamRefSymbol] = true;
214
+ constructor(resource: BaseResource, param: string);
215
+ toString(): string;
216
+ toJSON(): string;
217
+ valueOf(): string;
218
+ }
219
+ /**
220
+ * Base class for type/properties structures (engines, packaging, events, etc.)
221
+ */
144
222
  export declare class BaseTypeProperties {
145
223
  readonly type: string;
146
224
  readonly properties: any;
147
225
  readonly [baseTypePropertiesSymbol] = true;
148
226
  constructor(type: string, properties: any);
149
227
  }
228
+ /**
229
+ * Base class for type-only structures (no properties field, just type discriminator)
230
+ */
231
+ export declare class BaseTypeOnly {
232
+ readonly type: string;
233
+ readonly [baseTypePropertiesSymbol] = true;
234
+ constructor(type: string);
235
+ }
150
236
 
237
+ /**
238
+ * Base class for type-only structures (no properties field, just type discriminator)
239
+ */
240
+ export declare class BaseTypeOnly {
241
+ readonly type: string;
242
+ readonly [baseTypePropertiesSymbol] = true;
243
+ constructor(type: string);
244
+ }
245
+ /**
246
+ * Defines a CloudWatch alarm that monitors a metric and triggers notifications when thresholds are breached.
247
+ *
248
+ * Alarms can be attached to resources like Lambda functions, databases, load balancers, SQS queues, and HTTP API Gateways.
249
+ * When the alarm condition is met (e.g., error rate exceeds 5%), notifications are sent to configured targets (Slack, email, MS Teams).
250
+ *
251
+ * @example
252
+ * ```ts
253
+ * new Alarm({
254
+ * trigger: new LambdaErrorRateTrigger({ thresholdPercent: 5 }),
255
+ * evaluation: { period: 60, evaluationPeriods: 3, breachedPeriods: 2 },
256
+ * notificationTargets: [{ slack: { url: $Secret('slack-webhook-url') } }],
257
+ * description: 'Lambda error rate exceeded 5%'
258
+ * })
259
+ * ```
260
+ */
261
+ export declare class Alarm {
262
+ readonly [alarmSymbol] = true;
263
+ readonly trigger: any;
264
+ readonly evaluation?: any;
265
+ readonly notificationTargets?: any[];
266
+ readonly description?: string;
267
+ constructor(props: {
268
+ trigger: any;
269
+ evaluation?: any;
270
+ notificationTargets?: any[];
271
+ description?: string;
272
+ });
273
+ }
274
+
275
+ /**
276
+ * Base resource class that provides common functionality
277
+ */
151
278
  export declare class BaseResource {
152
279
  private readonly _type;
153
280
  private _properties;
@@ -219,7 +346,7 @@ export type GetConfigParams = {
219
346
  type WebServiceConnectTo = RelationalDatabase | Bucket | HostingBucket | DynamoDbTable | EventBus | RedisCluster | MongoDbAtlasCluster | UpstashRedis | SqsQueue | SnsTopic | OpenSearchDomain | EfsFilesystem | PrivateService | GlobalAwsServiceConstant;
220
347
  type PrivateServiceConnectTo = RelationalDatabase | Bucket | HostingBucket | DynamoDbTable | EventBus | RedisCluster | MongoDbAtlasCluster | UpstashRedis | SqsQueue | SnsTopic | OpenSearchDomain | EfsFilesystem | GlobalAwsServiceConstant;
221
348
  type WorkerServiceConnectTo = RelationalDatabase | Bucket | HostingBucket | DynamoDbTable | EventBus | RedisCluster | MongoDbAtlasCluster | UpstashRedis | SqsQueue | SnsTopic | OpenSearchDomain | EfsFilesystem | GlobalAwsServiceConstant;
222
- type MultiContainerWorkloadConnectTo = RelationalDatabase | Bucket | HostingBucket | DynamoDbTable | EventBus | RedisCluster | MongoDbAtlasCluster | UpstashRedis | SqsQueue | SnsTopic | OpenSearchDomain | EfsFilesystem | GlobalAwsServiceConstant;
349
+ type MultiContainerWorkloadConnectTo = RelationalDatabase | Bucket | HostingBucket | DynamoDbTable | EventBus | RedisCluster | MongoDbAtlasCluster | UpstashRedis | SqsQueue | SnsTopic | OpenSearchDomain | EfsFilesystem | LambdaFunction | GlobalAwsServiceConstant;
223
350
  type LambdaFunctionConnectTo = RelationalDatabase | Bucket | HostingBucket | DynamoDbTable | EventBus | RedisCluster | MongoDbAtlasCluster | UpstashRedis | SqsQueue | SnsTopic | OpenSearchDomain | EfsFilesystem | PrivateService | WebService | GlobalAwsServiceConstant;
224
351
  type BatchJobConnectTo = RelationalDatabase | Bucket | HostingBucket | DynamoDbTable | EventBus | RedisCluster | MongoDbAtlasCluster | UpstashRedis | SqsQueue | SnsTopic | OpenSearchDomain | EfsFilesystem | GlobalAwsServiceConstant;
225
352
  type StateMachineConnectTo = Function | BatchJob | GlobalAwsServiceConstant;
@@ -239,6 +366,18 @@ export type ContainerWithObjectEnv = Omit<import('./sdk').ContainerWorkloadConta
239
366
  environment?: { [envVarName: string]: string | number | boolean };
240
367
  };
241
368
 
369
+ /**
370
+ * Batch job container configuration with object-style environment variables.
371
+ * Environment is specified as { KEY: 'value' } for better developer experience.
372
+ */
373
+ export type BatchJobContainerWithObjectEnv = Omit<import('./sdk').BatchJobContainer, 'environment'> & {
374
+ /**
375
+ * Environment variables to inject into the batch job container.
376
+ * Specified as key-value pairs: { PORT: '3000', NODE_ENV: 'production' }
377
+ */
378
+ environment?: { [envVarName: string]: string | number | boolean };
379
+ };
380
+
242
381
  // Augmented props types with connectTo, environment, overrides, and transforms
243
382
 
244
383
  export type WebServiceProps = Omit<SdkWebServiceProps, 'connectTo' | 'environment'> & {
@@ -366,7 +505,7 @@ export type LambdaFunctionProps = Omit<SdkLambdaFunctionProps, 'connectTo' | 'en
366
505
  transforms?: LambdaFunctionTransforms;
367
506
  };
368
507
 
369
- export type BatchJobProps = Omit<SdkBatchJobProps, 'connectTo' | 'environment'> & {
508
+ export type BatchJobProps = Omit<SdkBatchJobProps, 'connectTo' | 'environment' | 'container'> & {
370
509
  /**
371
510
  * List of resources or AWS services to which this resource receives permissions.
372
511
  * Automatically grants necessary IAM permissions for accessing the connected resources.
@@ -377,6 +516,10 @@ export type BatchJobProps = Omit<SdkBatchJobProps, 'connectTo' | 'environment'>
377
516
  * You can reference resource parameters using directive syntax: $ResourceParam('resourceName', 'paramName')
378
517
  */
379
518
  environment?: { [envVarName: string]: string | number | boolean };
519
+ /**
520
+ * Container configuration for the batch job.
521
+ */
522
+ container: BatchJobContainerWithObjectEnv;
380
523
  /**
381
524
  * Override properties of underlying CloudFormation resources.
382
525
  * Allows fine-grained control over the generated infrastructure.
@@ -1806,6 +1949,12 @@ export declare class SqsQueue extends BaseResource {
1806
1949
  */
1807
1950
  constructor(properties: SqsQueuePropsWithOverrides);
1808
1951
  constructor(name: string, properties: SqsQueuePropsWithOverrides);
1952
+ /** Queue ARN */
1953
+ readonly arn: string;
1954
+ /** Queue URL */
1955
+ readonly url: string;
1956
+ /** Queue name */
1957
+ readonly name: string;
1809
1958
  }
1810
1959
  export declare class SnsTopic extends BaseResource {
1811
1960
  /**
@@ -1817,6 +1966,10 @@ export declare class SnsTopic extends BaseResource {
1817
1966
  */
1818
1967
  constructor(properties: SnsTopicPropsWithOverrides);
1819
1968
  constructor(name: string, properties: SnsTopicPropsWithOverrides);
1969
+ /** Topic ARN */
1970
+ readonly arn: string;
1971
+ /** Topic name */
1972
+ readonly name: string;
1820
1973
  }
1821
1974
  export declare class WebAppFirewall extends BaseResource {
1822
1975
  /**
@@ -2145,7 +2298,7 @@ export declare class StacktapeLambdaBuildpackPackaging extends BaseTypePropertie
2145
2298
  *
2146
2299
  * **Supported languages:** JavaScript, TypeScript, Python, Java, and Go.
2147
2300
  *
2148
- * For JS/TS, your code is bundled into a single file using esbuild. Source maps are automatically generated.
2301
+ * For JS/TS, your code is bundled into a single file. Source maps are automatically generated.
2149
2302
  * Packages are cached based on a checksum, so unchanged code is not re-packaged.
2150
2303
  */
2151
2304
  constructor(properties: StpBuildpackLambdaPackagingProps);
@@ -2238,7 +2391,7 @@ export declare class StacktapeImageBuildpackPackaging extends BaseTypeProperties
2238
2391
  *
2239
2392
  * **Supported languages:** JavaScript, TypeScript, Python, Java, and Go.
2240
2393
  *
2241
- * For JS/TS, your code is bundled into a single file using esbuild with source maps.
2394
+ * For JS/TS, your code is bundled into a single file with source maps.
2242
2395
  * The resulting image is uploaded to a managed ECR repository.
2243
2396
  */
2244
2397
  constructor(properties: StpBuildpackCwImagePackagingProps);
@@ -2642,6 +2795,126 @@ export declare class LambdaAuthorizer extends BaseTypeProperties {
2642
2795
  readonly type: 'lambda';
2643
2796
  }
2644
2797
 
2798
+ export declare class ApplicationLoadBalancerCustomTrigger extends BaseTypeProperties {
2799
+ /**
2800
+ * Triggers an alarm based on any Application Load Balancer CloudWatch metric (e.g., connection counts, request counts, target response times).
2801
+ */
2802
+ constructor(properties: ApplicationLoadBalancerCustomTriggerProps);
2803
+ readonly type: 'application-load-balancer-custom';
2804
+ }
2805
+
2806
+ export declare class ApplicationLoadBalancerErrorRateTrigger extends BaseTypeProperties {
2807
+ /**
2808
+ * Triggers an alarm when the Application Load Balancer error rate (percentage of 4xx/5xx responses) exceeds the threshold.
2809
+ */
2810
+ constructor(properties: ApplicationLoadBalancerErrorRateTriggerProps);
2811
+ readonly type: 'application-load-balancer-error-rate';
2812
+ }
2813
+
2814
+ export declare class ApplicationLoadBalancerUnhealthyTargetsTrigger extends BaseTypeProperties {
2815
+ /**
2816
+ * Triggers an alarm when the percentage of unhealthy targets behind the Application Load Balancer exceeds the threshold.
2817
+ */
2818
+ constructor(properties: ApplicationLoadBalancerUnhealthyTargetsTriggerProps);
2819
+ readonly type: 'application-load-balancer-unhealthy-targets';
2820
+ }
2821
+
2822
+ export declare class HttpApiGatewayErrorRateTrigger extends BaseTypeProperties {
2823
+ /**
2824
+ * Triggers an alarm when the HTTP API Gateway error rate (percentage of 4xx/5xx responses) exceeds the threshold.
2825
+ */
2826
+ constructor(properties: HttpApiGatewayErrorRateTriggerProps);
2827
+ readonly type: 'http-api-gateway-error-rate';
2828
+ }
2829
+
2830
+ export declare class HttpApiGatewayLatencyTrigger extends BaseTypeProperties {
2831
+ /**
2832
+ * Triggers an alarm when HTTP API Gateway latency exceeds the threshold. Latency is measured from request receipt to response sent.
2833
+ */
2834
+ constructor(properties: HttpApiGatewayLatencyTriggerProps);
2835
+ readonly type: 'http-api-gateway-latency';
2836
+ }
2837
+
2838
+ export declare class RelationalDatabaseReadLatencyTrigger extends BaseTypeProperties {
2839
+ /**
2840
+ * Triggers an alarm when database read latency (average time for read I/O operations) exceeds the threshold.
2841
+ */
2842
+ constructor(properties: RelationalDatabaseReadLatencyTriggerProps);
2843
+ readonly type: 'database-read-latency';
2844
+ }
2845
+
2846
+ export declare class RelationalDatabaseWriteLatencyTrigger extends BaseTypeProperties {
2847
+ /**
2848
+ * Triggers an alarm when database write latency (average time for write I/O operations) exceeds the threshold.
2849
+ */
2850
+ constructor(properties: RelationalDatabaseWriteLatencyTriggerProps);
2851
+ readonly type: 'database-write-latency';
2852
+ }
2853
+
2854
+ export declare class RelationalDatabaseCPUUtilizationTrigger extends BaseTypeProperties {
2855
+ /**
2856
+ * Triggers an alarm when database CPU utilization exceeds the threshold percentage.
2857
+ */
2858
+ constructor(properties: RelationalDatabaseCPUUtilizationTriggerProps);
2859
+ readonly type: 'database-cpu-utilization';
2860
+ }
2861
+
2862
+ export declare class RelationalDatabaseFreeStorageTrigger extends BaseTypeProperties {
2863
+ /**
2864
+ * Triggers an alarm when available database storage falls below the threshold (in MB).
2865
+ */
2866
+ constructor(properties: RelationalDatabaseFreeStorageTriggerProps);
2867
+ readonly type: 'database-free-storage';
2868
+ }
2869
+
2870
+ export declare class RelationalDatabaseFreeMemoryTrigger extends BaseTypeProperties {
2871
+ /**
2872
+ * Triggers an alarm when available database memory falls below the threshold (in MB).
2873
+ */
2874
+ constructor(properties: RelationalDatabaseFreeMemoryTriggerProps);
2875
+ readonly type: 'database-free-memory';
2876
+ }
2877
+
2878
+ export declare class RelationalDatabaseConnectionCountTrigger extends BaseTypeProperties {
2879
+ /**
2880
+ * Triggers an alarm when the number of database connections exceeds the threshold.
2881
+ */
2882
+ constructor(properties: RelationalDatabaseConnectionCountTriggerProps);
2883
+ readonly type: 'database-connection-count';
2884
+ }
2885
+
2886
+ export declare class SqsQueueReceivedMessagesCountTrigger extends BaseTypeProperties {
2887
+ /**
2888
+ * Triggers an alarm when the number of messages received from an SQS queue crosses the threshold.
2889
+ */
2890
+ constructor(properties: SqsQueueReceivedMessagesCountTriggerProps);
2891
+ readonly type: 'sqs-queue-received-messages-count';
2892
+ }
2893
+
2894
+ export declare class SqsQueueNotEmptyTrigger extends BaseTypeOnly {
2895
+ /**
2896
+ * Triggers an alarm if the SQS queue is not empty. Useful for monitoring dead-letter queues.
2897
+ */
2898
+ constructor();
2899
+ readonly type: 'sqs-queue-not-empty';
2900
+ }
2901
+
2902
+ export declare class LambdaErrorRateTrigger extends BaseTypeProperties {
2903
+ /**
2904
+ * Triggers an alarm when the Lambda function error rate (percentage of failed invocations) exceeds the threshold.
2905
+ */
2906
+ constructor(properties: LambdaErrorRateTriggerProps);
2907
+ readonly type: 'lambda-error-rate';
2908
+ }
2909
+
2910
+ export declare class LambdaDurationTrigger extends BaseTypeProperties {
2911
+ /**
2912
+ * Triggers an alarm when Lambda function execution duration exceeds the threshold (in milliseconds).
2913
+ */
2914
+ constructor(properties: LambdaDurationTriggerProps);
2915
+ readonly type: 'lambda-duration';
2916
+ }
2917
+
2645
2918
  export declare class CustomResourceDefinition extends BaseTypeProperties {
2646
2919
  /**
2647
2920
  * #### Custom resource definition