@gradientedge/cdk-utils 8.13.0 → 8.15.0

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.
@@ -52,9 +52,10 @@ export declare class ApiManager {
52
52
  * @param {string[]?} allowedOrigins
53
53
  * @param {string[]?} allowedMethods
54
54
  * @param {string[]?} allowedHeaders
55
- * @param {{}?} requestParameters
55
+ * @param {{}?} methodRequestParameters
56
+ * @param {apig.Integration} proxyIntegration
56
57
  */
57
- createApiResource(id: string, scope: common.CommonConstruct, parent: apig.IResource, path: string, integration: apig.Integration, addProxy: boolean, authorizer?: apig.IAuthorizer, allowedOrigins?: string[], allowedMethods?: string[], allowedHeaders?: string[], methodRequestParameters?: {}): apig.Resource;
58
+ createApiResource(id: string, scope: common.CommonConstruct, parent: apig.IResource, path: string, integration: apig.Integration, addProxy: boolean, authorizer?: apig.IAuthorizer, allowedOrigins?: string[], allowedMethods?: string[], allowedHeaders?: string[], methodRequestParameters?: {}, proxyIntegration?: apig.Integration): apig.Resource;
58
59
  /**
59
60
  * @summary Method to create an api deployment
60
61
  * @param {string} id
@@ -128,9 +128,10 @@ class ApiManager {
128
128
  * @param {string[]?} allowedOrigins
129
129
  * @param {string[]?} allowedMethods
130
130
  * @param {string[]?} allowedHeaders
131
- * @param {{}?} requestParameters
131
+ * @param {{}?} methodRequestParameters
132
+ * @param {apig.Integration} proxyIntegration
132
133
  */
133
- createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders, methodRequestParameters) {
134
+ createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders, methodRequestParameters, proxyIntegration) {
134
135
  const methods = allowedMethods ?? apig.Cors.ALL_METHODS;
135
136
  const resource = parent.addResource(path, {
136
137
  defaultCorsPreflightOptions: {
@@ -151,7 +152,10 @@ class ApiManager {
151
152
  allowCredentials: true,
152
153
  },
153
154
  });
154
- methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters }));
155
+ methods.forEach(method => resourceProxy.addMethod(method, proxyIntegration ?? integration, {
156
+ authorizer,
157
+ requestParameters: methodRequestParameters,
158
+ }));
155
159
  utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId);
156
160
  }
157
161
  return resource;
@@ -180,8 +180,10 @@ class LambdaManager {
180
180
  architecture: props.architecture ?? lambda.Architecture.ARM_64,
181
181
  environment: {
182
182
  REGION: scope.props.region,
183
- LAST_MODIFIED_TS: new Date().toISOString(),
184
183
  STAGE: scope.props.stage,
184
+ LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
185
+ ? ''
186
+ : scope.ssmManager.readStringParameter(`${id}-sm-ts`, scope, `${ssm_manager_1.SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`),
185
187
  ...environment,
186
188
  },
187
189
  filesystem: accessPoint
@@ -172,8 +172,8 @@ class SfnManager {
172
172
  outputPath: props.outputPath,
173
173
  resultPath: props.resultPath,
174
174
  resultSelector: props.resultSelector,
175
- timeout: props.timeout,
176
- heartbeat: props.heartbeat,
175
+ taskTimeout: props.taskTimeout,
176
+ heartbeatTimeout: props.heartbeatTimeout,
177
177
  integrationPattern: props.integrationPattern,
178
178
  expressionAttributeNames: props.expressionAttributeNames,
179
179
  projectionExpression: props.projectionExpression,
@@ -209,8 +209,8 @@ class SfnManager {
209
209
  outputPath: props.outputPath,
210
210
  resultPath: props.resultPath,
211
211
  resultSelector: props.resultSelector,
212
- timeout: props.timeout,
213
- heartbeat: props.heartbeat,
212
+ taskTimeout: props.taskTimeout,
213
+ heartbeatTimeout: props.heartbeatTimeout,
214
214
  integrationPattern: props.integrationPattern,
215
215
  conditionExpression: props.conditionExpression,
216
216
  expressionAttributeNames: props.expressionAttributeNames,
@@ -248,12 +248,12 @@ class SfnManager {
248
248
  conditionExpression: props.conditionExpression,
249
249
  expressionAttributeNames: props.expressionAttributeNames,
250
250
  expressionAttributeValues: props.expressionAttributeValues,
251
- heartbeat: props.heartbeat,
251
+ taskTimeout: props.taskTimeout,
252
+ heartbeatTimeout: props.heartbeatTimeout,
252
253
  inputPath: props.inputPath,
253
254
  outputPath: props.outputPath,
254
255
  resultPath: props.resultPath,
255
256
  resultSelector: props.resultSelector,
256
- timeout: props.timeout,
257
257
  integrationPattern: props.integrationPattern,
258
258
  returnConsumedCapacity: props.returnConsumedCapacity,
259
259
  returnItemCollectionMetrics: props.returnItemCollectionMetrics,
@@ -293,8 +293,8 @@ class SfnManager {
293
293
  outputPath: props.outputPath,
294
294
  resultPath: props.resultPath,
295
295
  resultSelector: props.resultSelector,
296
- timeout: props.timeout,
297
- heartbeat: props.heartbeat,
296
+ taskTimeout: props.taskTimeout,
297
+ heartbeatTimeout: props.heartbeatTimeout,
298
298
  integrationPattern: props.integrationPattern,
299
299
  comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
300
300
  },
@@ -225,10 +225,10 @@ export interface SfnStateMachineProps extends sfn.StateMachineProps {
225
225
  * @subcategory Types
226
226
  */
227
227
  export interface LambdaEnvironment {
228
- CACHE_REDIS_HOST?: string;
229
- CACHE_REDIS_PORT?: string;
230
228
  NODE_ENV: string;
231
229
  LOG_LEVEL: string;
230
+ REGION?: string;
231
+ STAGE?: string;
232
232
  TZ: string;
233
233
  }
234
234
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.13.0",
3
+ "version": "8.15.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -50,9 +50,9 @@
50
50
  "@types/lodash": "^4.14.191",
51
51
  "@types/node": "^18.11.18",
52
52
  "app-root-path": "^3.1.0",
53
- "aws-cdk-lib": "^2.63.0",
54
- "aws-sdk": "^2.1307.0",
55
- "constructs": "^10.1.237",
53
+ "aws-cdk-lib": "^2.63.1",
54
+ "aws-sdk": "^2.1309.0",
55
+ "constructs": "^10.1.240",
56
56
  "lodash": "^4.17.21",
57
57
  "moment": "^2.29.4",
58
58
  "nconf": "^0.12.0",
@@ -116,7 +116,8 @@ export class ApiManager {
116
116
  * @param {string[]?} allowedOrigins
117
117
  * @param {string[]?} allowedMethods
118
118
  * @param {string[]?} allowedHeaders
119
- * @param {{}?} requestParameters
119
+ * @param {{}?} methodRequestParameters
120
+ * @param {apig.Integration} proxyIntegration
120
121
  */
121
122
  public createApiResource(
122
123
  id: string,
@@ -129,7 +130,8 @@ export class ApiManager {
129
130
  allowedOrigins?: string[],
130
131
  allowedMethods?: string[],
131
132
  allowedHeaders?: string[],
132
- methodRequestParameters?: {}
133
+ methodRequestParameters?: {},
134
+ proxyIntegration?: apig.Integration
133
135
  ) {
134
136
  const methods = allowedMethods ?? apig.Cors.ALL_METHODS
135
137
  const resource = parent.addResource(path, {
@@ -155,7 +157,10 @@ export class ApiManager {
155
157
  },
156
158
  })
157
159
  methods.forEach(method =>
158
- resourceProxy.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters })
160
+ resourceProxy.addMethod(method, proxyIntegration ?? integration, {
161
+ authorizer,
162
+ requestParameters: methodRequestParameters,
163
+ })
159
164
  )
160
165
  utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId)
161
166
  }
@@ -223,8 +223,14 @@ export class LambdaManager {
223
223
  architecture: props.architecture ?? lambda.Architecture.ARM_64,
224
224
  environment: {
225
225
  REGION: scope.props.region,
226
- LAST_MODIFIED_TS: new Date().toISOString(),
227
226
  STAGE: scope.props.stage,
227
+ LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
228
+ ? ''
229
+ : scope.ssmManager.readStringParameter(
230
+ `${id}-sm-ts`,
231
+ scope,
232
+ `${SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`
233
+ ),
228
234
  ...environment,
229
235
  },
230
236
  filesystem: accessPoint
@@ -165,8 +165,8 @@ export class SfnManager {
165
165
  outputPath: props.outputPath,
166
166
  resultPath: props.resultPath,
167
167
  resultSelector: props.resultSelector,
168
- timeout: props.timeout,
169
- heartbeat: props.heartbeat,
168
+ taskTimeout: props.taskTimeout,
169
+ heartbeatTimeout: props.heartbeatTimeout,
170
170
  integrationPattern: props.integrationPattern,
171
171
  expressionAttributeNames: props.expressionAttributeNames,
172
172
  projectionExpression: props.projectionExpression,
@@ -212,8 +212,8 @@ export class SfnManager {
212
212
  outputPath: props.outputPath,
213
213
  resultPath: props.resultPath,
214
214
  resultSelector: props.resultSelector,
215
- timeout: props.timeout,
216
- heartbeat: props.heartbeat,
215
+ taskTimeout: props.taskTimeout,
216
+ heartbeatTimeout: props.heartbeatTimeout,
217
217
  integrationPattern: props.integrationPattern,
218
218
  conditionExpression: props.conditionExpression,
219
219
  expressionAttributeNames: props.expressionAttributeNames,
@@ -261,12 +261,12 @@ export class SfnManager {
261
261
  conditionExpression: props.conditionExpression,
262
262
  expressionAttributeNames: props.expressionAttributeNames,
263
263
  expressionAttributeValues: props.expressionAttributeValues,
264
- heartbeat: props.heartbeat,
264
+ taskTimeout: props.taskTimeout,
265
+ heartbeatTimeout: props.heartbeatTimeout,
265
266
  inputPath: props.inputPath,
266
267
  outputPath: props.outputPath,
267
268
  resultPath: props.resultPath,
268
269
  resultSelector: props.resultSelector,
269
- timeout: props.timeout,
270
270
  integrationPattern: props.integrationPattern,
271
271
  returnConsumedCapacity: props.returnConsumedCapacity,
272
272
  returnItemCollectionMetrics: props.returnItemCollectionMetrics,
@@ -314,8 +314,8 @@ export class SfnManager {
314
314
  outputPath: props.outputPath,
315
315
  resultPath: props.resultPath,
316
316
  resultSelector: props.resultSelector,
317
- timeout: props.timeout,
318
- heartbeat: props.heartbeat,
317
+ taskTimeout: props.taskTimeout,
318
+ heartbeatTimeout: props.heartbeatTimeout,
319
319
  integrationPattern: props.integrationPattern,
320
320
  comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
321
321
  },
@@ -244,10 +244,10 @@ export interface SfnStateMachineProps extends sfn.StateMachineProps {}
244
244
  * @subcategory Types
245
245
  */
246
246
  export interface LambdaEnvironment {
247
- CACHE_REDIS_HOST?: string
248
- CACHE_REDIS_PORT?: string
249
247
  NODE_ENV: string
250
248
  LOG_LEVEL: string
249
+ REGION?: string
250
+ STAGE?: string
251
251
  TZ: string
252
252
  }
253
253