@gradientedge/cdk-utils 8.13.0 → 8.14.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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.13.0",
3
+ "version": "8.14.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -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
  }