@gradientedge/cdk-utils 8.12.0 → 8.13.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,8 +52,9 @@ export declare class ApiManager {
52
52
  * @param {string[]?} allowedOrigins
53
53
  * @param {string[]?} allowedMethods
54
54
  * @param {string[]?} allowedHeaders
55
+ * @param {{}?} requestParameters
55
56
  */
56
- 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[]): apig.Resource;
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;
57
58
  /**
58
59
  * @summary Method to create an api deployment
59
60
  * @param {string} id
@@ -77,6 +77,7 @@ class ApiManager {
77
77
  methodOptions: props.deployOptions?.methodOptions,
78
78
  loggingLevel: props.deployOptions?.loggingLevel,
79
79
  dataTraceEnabled: props.deployOptions?.dataTraceEnabled,
80
+ cachingEnabled: props.deployOptions?.cachingEnabled,
80
81
  },
81
82
  retainDeployments: props.retainDeployments,
82
83
  parameters: props.parameters,
@@ -127,8 +128,9 @@ class ApiManager {
127
128
  * @param {string[]?} allowedOrigins
128
129
  * @param {string[]?} allowedMethods
129
130
  * @param {string[]?} allowedHeaders
131
+ * @param {{}?} requestParameters
130
132
  */
131
- createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders) {
133
+ createApiResource(id, scope, parent, path, integration, addProxy, authorizer, allowedOrigins, allowedMethods, allowedHeaders, methodRequestParameters) {
132
134
  const methods = allowedMethods ?? apig.Cors.ALL_METHODS;
133
135
  const resource = parent.addResource(path, {
134
136
  defaultCorsPreflightOptions: {
@@ -138,7 +140,7 @@ class ApiManager {
138
140
  allowCredentials: true,
139
141
  },
140
142
  });
141
- methods.forEach(method => resource.addMethod(method, integration, { authorizer }));
143
+ methods.forEach(method => resource.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters }));
142
144
  utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId);
143
145
  if (addProxy) {
144
146
  const resourceProxy = resource.addResource(`{${path}+}`, {
@@ -149,7 +151,7 @@ class ApiManager {
149
151
  allowCredentials: true,
150
152
  },
151
153
  });
152
- methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer }));
154
+ methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters }));
153
155
  utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId);
154
156
  }
155
157
  return resource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.12.0",
3
+ "version": "8.13.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -59,6 +59,7 @@ export class ApiManager {
59
59
  methodOptions: props.deployOptions?.methodOptions,
60
60
  loggingLevel: props.deployOptions?.loggingLevel,
61
61
  dataTraceEnabled: props.deployOptions?.dataTraceEnabled,
62
+ cachingEnabled: props.deployOptions?.cachingEnabled,
62
63
  },
63
64
  retainDeployments: props.retainDeployments,
64
65
  parameters: props.parameters,
@@ -115,6 +116,7 @@ export class ApiManager {
115
116
  * @param {string[]?} allowedOrigins
116
117
  * @param {string[]?} allowedMethods
117
118
  * @param {string[]?} allowedHeaders
119
+ * @param {{}?} requestParameters
118
120
  */
119
121
  public createApiResource(
120
122
  id: string,
@@ -126,7 +128,8 @@ export class ApiManager {
126
128
  authorizer?: apig.IAuthorizer,
127
129
  allowedOrigins?: string[],
128
130
  allowedMethods?: string[],
129
- allowedHeaders?: string[]
131
+ allowedHeaders?: string[],
132
+ methodRequestParameters?: {}
130
133
  ) {
131
134
  const methods = allowedMethods ?? apig.Cors.ALL_METHODS
132
135
  const resource = parent.addResource(path, {
@@ -137,7 +140,9 @@ export class ApiManager {
137
140
  allowCredentials: true,
138
141
  },
139
142
  })
140
- methods.forEach(method => resource.addMethod(method, integration, { authorizer }))
143
+ methods.forEach(method =>
144
+ resource.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters })
145
+ )
141
146
  utils.createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId)
142
147
 
143
148
  if (addProxy) {
@@ -149,7 +154,9 @@ export class ApiManager {
149
154
  allowCredentials: true,
150
155
  },
151
156
  })
152
- methods.forEach(method => resourceProxy.addMethod(method, integration, { authorizer }))
157
+ methods.forEach(method =>
158
+ resourceProxy.addMethod(method, integration, { authorizer, requestParameters: methodRequestParameters })
159
+ )
153
160
  utils.createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId)
154
161
  }
155
162