From bfebe490348ebe1b661c47ec87a766079ca78502 Mon Sep 17 00:00:00 2001 From: eacet Date: Tue, 3 Sep 2024 11:20:01 +0300 Subject: [PATCH 1/9] Fix validation issue This commit allows to use intrinsic function for waf and xray --- src/validation.ts | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/validation.ts b/src/validation.ts index 4cc292e0..435ba6f5 100644 --- a/src/validation.ts +++ b/src/validation.ts @@ -128,7 +128,7 @@ export const appSyncSchema = { oidcAuth: { type: 'object', properties: { - issuer: { type: 'string' }, + issuer: { $ref: '#/definitions/stringOrIntrinsicFunction' }, clientId: { type: 'string' }, iatTTL: { type: 'number' }, authTTL: { type: 'number' }, @@ -630,6 +630,9 @@ export const appSyncSchema = { }, required: ['eventBusArn'], }, + xrayEnabledConfig: { + $ref: '#/definitions/lambdaFunctionConfig', + }, }, properties: { name: { type: 'string' }, @@ -685,7 +688,13 @@ export const appSyncSchema = { 'when using CloudFormation, you must provide either certificateArn or hostedZoneId.', }, }, - xrayEnabled: { type: 'boolean' }, + xrayEnabled: { + oneOf: [ + { type: 'boolean' }, + { $ref: '#/definitions/stringOrIntrinsicFunction' }, + ], + errorMessage: 'must be a boolean or a CloudFormation intrinsic function', + }, visibility: { type: 'string', enum: ['GLOBAL', 'PRIVATE'], @@ -699,7 +708,12 @@ export const appSyncSchema = { waf: { type: 'object', properties: { - enabled: { type: 'boolean' }, + enabled: { + oneOf: [ + { type: 'boolean' }, + { $ref: '#/definitions/stringOrIntrinsicFunction' }, + ], + }, }, if: { required: ['arn'], @@ -805,7 +819,12 @@ export const appSyncSchema = { errorMessage: "must be one of 'ALL', 'ERROR' or 'NONE'", }, retentionInDays: { type: 'integer' }, - excludeVerboseContent: { type: 'boolean' }, + excludeVerboseContent: { + oneOf: [ + { type: 'boolean' }, + { $ref: '#/definitions/stringOrIntrinsicFunction' }, + ], + }, enabled: { type: 'boolean' }, }, required: ['level'], From 52d009e6c51c5dab712c09a1ce073e8bf6476c61 Mon Sep 17 00:00:00 2001 From: eacet Date: Tue, 3 Sep 2024 11:24:16 +0300 Subject: [PATCH 2/9] 0.0.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 06656a6f..7be14ca1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "serverless-appsync-plugin", - "version": "0.0.0-development", + "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "serverless-appsync-plugin", - "version": "0.0.0-development", + "version": "0.0.0", "license": "MIT", "dependencies": { "@graphql-tools/merge": "^8.3.12", diff --git a/package.json b/package.json index 3b3f0e4b..29a138f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless-appsync-plugin", - "version": "0.0.0-development", + "version": "0.0.0", "description": "AWS AppSync support for the Serverless Framework", "main": "lib/index.js", "types": "lib/types/index.d.ts", From a1e06520661842e67db54f5d57c8af80c7a23b38 Mon Sep 17 00:00:00 2001 From: eacet Date: Tue, 3 Sep 2024 11:24:59 +0300 Subject: [PATCH 3/9] Update package name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 29a138f5..ff437703 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "serverless-appsync-plugin", + "name": "@collaborne/serverless-appsync-plugin", "version": "0.0.0", "description": "AWS AppSync support for the Serverless Framework", "main": "lib/index.js", From 09c879b489ce9c1dd19bef231a728e1277c444e3 Mon Sep 17 00:00:00 2001 From: eacet Date: Tue, 10 Sep 2024 07:46:53 +0300 Subject: [PATCH 4/9] Fix package --- package-lock.json | 2 -- package.json | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7be14ca1..ce46a6b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,10 @@ { "name": "serverless-appsync-plugin", - "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "serverless-appsync-plugin", - "version": "0.0.0", "license": "MIT", "dependencies": { "@graphql-tools/merge": "^8.3.12", diff --git a/package.json b/package.json index ff437703..3bf0f1b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { - "name": "@collaborne/serverless-appsync-plugin", - "version": "0.0.0", + "name": "serverless-appsync-plugin", "description": "AWS AppSync support for the Serverless Framework", "main": "lib/index.js", "types": "lib/types/index.d.ts", From 0a74814c3ec801283ac3f6da8d7b946dc9a2e99a Mon Sep 17 00:00:00 2001 From: eacet Date: Tue, 10 Sep 2024 07:48:14 +0300 Subject: [PATCH 5/9] Fix version --- package-lock.json | 2 ++ package.json | 1 + 2 files changed, 3 insertions(+) diff --git a/package-lock.json b/package-lock.json index ce46a6b4..06656a6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,12 @@ { "name": "serverless-appsync-plugin", + "version": "0.0.0-development", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "serverless-appsync-plugin", + "version": "0.0.0-development", "license": "MIT", "dependencies": { "@graphql-tools/merge": "^8.3.12", diff --git a/package.json b/package.json index 3bf0f1b3..3b3f0e4b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "serverless-appsync-plugin", + "version": "0.0.0-development", "description": "AWS AppSync support for the Serverless Framework", "main": "lib/index.js", "types": "lib/types/index.d.ts", From 8b556e7eccf3e573f0330b20a2607b32e815d1a9 Mon Sep 17 00:00:00 2001 From: Ronny Roeller Date: Tue, 22 Oct 2024 15:28:59 +0200 Subject: [PATCH 6/9] Fix tests --- src/__tests__/validation/__snapshots__/auth.test.ts.snap | 2 +- src/__tests__/validation/__snapshots__/base.test.ts.snap | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/__tests__/validation/__snapshots__/auth.test.ts.snap b/src/__tests__/validation/__snapshots__/auth.test.ts.snap index 520b0ea0..7cf93c01 100644 --- a/src/__tests__/validation/__snapshots__/auth.test.ts.snap +++ b/src/__tests__/validation/__snapshots__/auth.test.ts.snap @@ -35,7 +35,7 @@ exports[`Valdiation Invalid should validate a Lambda with missing config 1`] = ` exports[`Valdiation Invalid should validate a OIDC with empty config 1`] = `"/authentication/config: must have required property 'issuer'"`; exports[`Valdiation Invalid should validate a OIDC with invalid config 1`] = ` -"/authentication/config/issuer: must be string +"/authentication/config/issuer: must be a string or a CloudFormation intrinsic function /authentication/config/clientId: must be string /authentication/config/iatTTL: must be number /authentication/config/authTTL: must be number" diff --git a/src/__tests__/validation/__snapshots__/base.test.ts.snap b/src/__tests__/validation/__snapshots__/base.test.ts.snap index b2b9d274..a69223bd 100644 --- a/src/__tests__/validation/__snapshots__/base.test.ts.snap +++ b/src/__tests__/validation/__snapshots__/base.test.ts.snap @@ -31,8 +31,7 @@ exports[`Valdiation Domain Invalid should validate a useCloudFormation: true, ce exports[`Valdiation Log Invalid should validate a Invalid 1`] = ` "/logging/level: must be one of 'ALL', 'ERROR' or 'NONE' -/logging/retentionInDays: must be integer -/logging/excludeVerboseContent: must be boolean" +/logging/retentionInDays: must be integer" `; exports[`Valdiation Waf Invalid should validate a Invalid 1`] = ` @@ -40,8 +39,7 @@ exports[`Valdiation Waf Invalid should validate a Invalid 1`] = ` /waf/defaultAction: must be 'Allow' or 'Block' /waf/rules/0: must be a valid WAF rule /waf/rules/1: must be a valid WAF rule -/waf/rules/2: must be a valid WAF rule -/waf/enabled: must be boolean" +/waf/rules/2: must be a valid WAF rule" `; exports[`Valdiation Waf Invalid should validate a Invalid arn 1`] = `"/waf/arn: must be a string or a CloudFormation intrinsic function"`; @@ -55,7 +53,6 @@ exports[`Valdiation should validate 1`] = ` ": must have required property 'name' : must have required property 'authentication' /unknownPorp: invalid (unknown) property -/xrayEnabled: must be boolean /visibility: must be \\"GLOBAL\\" or \\"PRIVATE\\" /introspection: must be boolean /queryDepthLimit: must be integer From 85a072266302dffbfa951ac89b732b600e2e47c3 Mon Sep 17 00:00:00 2001 From: Ronny Roeller Date: Tue, 22 Oct 2024 15:29:44 +0200 Subject: [PATCH 7/9] Allow CF intrinsic functions for lambdaAuth config --- src/__tests__/validation/__snapshots__/auth.test.ts.snap | 2 +- src/validation.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/validation/__snapshots__/auth.test.ts.snap b/src/__tests__/validation/__snapshots__/auth.test.ts.snap index 7cf93c01..7d576d8e 100644 --- a/src/__tests__/validation/__snapshots__/auth.test.ts.snap +++ b/src/__tests__/validation/__snapshots__/auth.test.ts.snap @@ -16,7 +16,7 @@ exports[`Valdiation Invalid should validate a Lambda with empty config 1`] = `"/ exports[`Valdiation Invalid should validate a Lambda with invalid config functionnArn 1`] = ` "/authentication/config/functionArn: must be a string or a CloudFormation intrinsic function /authentication/config: must specify functionName, functionArn or function (all exclusives) -/authentication/config/functionArn: must be string +/authentication/config/functionArn: must be a string or a CloudFormation intrinsic function /authentication/config/identityValidationExpression: must be string /authentication/config/authorizerResultTtlInSeconds: must be number" `; diff --git a/src/validation.ts b/src/validation.ts index 435ba6f5..30a7e818 100644 --- a/src/validation.ts +++ b/src/validation.ts @@ -119,7 +119,7 @@ export const appSyncSchema = { // Note: functionName and functionArn are already defined in #/definitions/lambdaFunctionConfig // But if not also defined here, TypeScript shows an error. functionName: { type: 'string' }, - functionArn: { type: 'string' }, + functionArn: { $ref: '#/definitions/stringOrIntrinsicFunction' }, identityValidationExpression: { type: 'string' }, authorizerResultTtlInSeconds: { type: 'number' }, }, From dbb5c095e5e3cb81f67abe29576934e1892e6de7 Mon Sep 17 00:00:00 2001 From: Ronny Roeller Date: Tue, 22 Oct 2024 16:33:12 +0200 Subject: [PATCH 8/9] 0.0.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 06656a6f..7be14ca1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "serverless-appsync-plugin", - "version": "0.0.0-development", + "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "serverless-appsync-plugin", - "version": "0.0.0-development", + "version": "0.0.0", "license": "MIT", "dependencies": { "@graphql-tools/merge": "^8.3.12", diff --git a/package.json b/package.json index 3b3f0e4b..29a138f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless-appsync-plugin", - "version": "0.0.0-development", + "version": "0.0.0", "description": "AWS AppSync support for the Serverless Framework", "main": "lib/index.js", "types": "lib/types/index.d.ts", From 1326fd4a5e9380ae3c0c25bfbbfe7ebd442ead04 Mon Sep 17 00:00:00 2001 From: Ronny Roeller Date: Tue, 22 Oct 2024 16:40:28 +0200 Subject: [PATCH 9/9] 0.0.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7be14ca1..ceea3b88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "serverless-appsync-plugin", - "version": "0.0.0", + "version": "0.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "serverless-appsync-plugin", - "version": "0.0.0", + "version": "0.0.1", "license": "MIT", "dependencies": { "@graphql-tools/merge": "^8.3.12", diff --git a/package.json b/package.json index 29a138f5..d1984d2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless-appsync-plugin", - "version": "0.0.0", + "version": "0.0.1", "description": "AWS AppSync support for the Serverless Framework", "main": "lib/index.js", "types": "lib/types/index.d.ts",