@infoxchange/make-it-so 2.11.0-internal-testing-vdt-199-add-auth-token-verify-function-2.2 → 2.11.0-internal-testing-vdt-199-add-auth-token-verify-function-2.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cdk-constructs/SiteOidcAuth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AAOtC,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,MAAM,KAAK,GAAG;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAIjD,qBAAa,YAAa,SAAQ,SAAS;IACzC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;gBAER,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK;IAQhE,oBAAoB,CAAC,SAAS,SAAS,uBAAuB,EAC5D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AAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAIjD,qBAAa,YAAa,SAAQ,SAAS;IACzC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;gBAER,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK;IAQhE,oBAAoB,CAAC,SAAS,SAAS,uBAAuB,EAC5D,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,SAAS,EACpB,EAAE,MAA+B,EAAE,GAAE,cAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4C1D,iBAAiB,CAAC,SAAS,SAAS,uBAAuB,EACzD,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,SAAS,EACpB,EAAE,MAA+B,EAAE,GAAE,cAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqC1D,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,sBAAsB;IA+B9B,OAAO,CAAC,2BAA2B;IAgBnC,OAAO,CAAC,yCAAyC;IAmBjD,OAAO,CAAC,sBAAsB;CAiF/B"}
@@ -94,6 +94,7 @@ export class SiteOidcAuth extends Construct {
94
94
  // Get the CloudFront Function Association for auth checking
95
95
  // Roughly based off https://github.com/sst/v2/blob/4283d706f251724308b397996ff307929bf3a976/packages/sst/src/constructs/SsrSite.ts#L941
96
96
  getFunctionAssociation(scope, jwtSecret, authRoutePrefix) {
97
+ console.log("---- 1");
97
98
  const authCheckFunction = new CloudFront.Function(scope, `${this.id}AuthCheckFunction`, {
98
99
  code: CloudFront.FunctionCode.fromInline(this.convertToCloudFrontFunctionCompatibleCode(`function handler(event) {
99
100
  var request = event.request;
@@ -103,6 +104,7 @@ export class SiteOidcAuth extends Construct {
103
104
  // We could specify the JS v2.0 runtime here but for SSR sites SST does the function creation and that currently
104
105
  // uses JS v1.0 so no point using v2.0 here as the code has to be compatible with v1.0 anyway.
105
106
  });
107
+ console.log("---- 2");
106
108
  return {
107
109
  function: authCheckFunction,
108
110
  eventType: CloudFront.FunctionEventType.VIEWER_REQUEST,
@@ -119,7 +121,11 @@ export class SiteOidcAuth extends Construct {
119
121
  // JS runtime 1.0.
120
122
  sourceCode = sourceCode
121
123
  .replaceAll(/const /g, "var ")
122
- .replaceAll(/let /g, "var ");
124
+ .replaceAll(/let /g, "var ")
125
+ // When typescript builds the make-it-so code including it may add an "export {}" at the end to make it a module.
126
+ // This will cause a syntax error in CloudFront Functions so remove it here.
127
+ .replace(/export {};\s*$/g, "");
128
+ console.log("---- 3", sourceCode);
123
129
  return transformSync(sourceCode, {
124
130
  minify: true,
125
131
  target: "es5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infoxchange/make-it-so",
3
- "version": "2.11.0-internal-testing-vdt-199-add-auth-token-verify-function-2.2",
3
+ "version": "2.11.0-internal-testing-vdt-199-add-auth-token-verify-function-2.4",
4
4
  "description": "Makes deploying services to IX infra easy",
5
5
  "repository": "github:infoxchange/make-it-so",
6
6
  "type": "module",
@@ -149,6 +149,7 @@ export class SiteOidcAuth extends Construct {
149
149
  jwtSecret: SecretsManager.Secret,
150
150
  authRoutePrefix: string,
151
151
  ): CloudFront.FunctionAssociation {
152
+ console.log("---- 1")
152
153
  const authCheckFunction = new CloudFront.Function(
153
154
  scope,
154
155
  `${this.id}AuthCheckFunction`,
@@ -166,6 +167,7 @@ export class SiteOidcAuth extends Construct {
166
167
  // uses JS v1.0 so no point using v2.0 here as the code has to be compatible with v1.0 anyway.
167
168
  },
168
169
  );
170
+ console.log("---- 2")
169
171
 
170
172
  return {
171
173
  function: authCheckFunction,
@@ -196,7 +198,11 @@ export class SiteOidcAuth extends Construct {
196
198
  // JS runtime 1.0.
197
199
  sourceCode = sourceCode
198
200
  .replaceAll(/const /g, "var ")
199
- .replaceAll(/let /g, "var ");
201
+ .replaceAll(/let /g, "var ")
202
+ // When typescript builds the make-it-so code including it may add an "export {}" at the end to make it a module.
203
+ // This will cause a syntax error in CloudFront Functions so remove it here.
204
+ .replace(/export {};\s*$/g, "");
205
+ console.log("---- 3", sourceCode)
200
206
  return transformSync(sourceCode, {
201
207
  minify: true,
202
208
  target: "es5",