From a2ed0ae14014f9e6d34638a32bb26d60c0b15ab9 Mon Sep 17 00:00:00 2001 From: Al Harris <91494052+alharris-at@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:25:28 -0800 Subject: [PATCH] fix: update tests for new validation (#701) * fix: update tests for new validation * chore: bump deps, update snapshots * Update .changeset/rich-pumas-know.md Co-authored-by: Kamil Sobol --------- Co-authored-by: Kamil Sobol --- .changeset/rich-pumas-know.md | 5 +++ package-lock.json | 40 +++++++++---------- packages/backend-data/package.json | 4 +- .../backend-data/src/convert_schema.test.ts | 32 ++++++++------- packages/backend/package.json | 2 +- ...BranchName-branch-7d6f6c854a.template.json | 2 +- ...d6f6c854adataE67321C2.nested.template.json | 2 +- packages/integration-tests/package.json | 2 +- ...BranchName-branch-7d6f6c854a.template.json | 2 +- ...d6f6c854adataE67321C2.nested.template.json | 2 +- ...BranchName-branch-7d6f6c854a.template.json | 2 +- ...d6f6c854adataE67321C2.nested.template.json | 2 +- ...BranchName-branch-7d6f6c854a.template.json | 2 +- ...d6f6c854adataE67321C2.nested.template.json | 2 +- 14 files changed, 55 insertions(+), 46 deletions(-) create mode 100644 .changeset/rich-pumas-know.md diff --git a/.changeset/rich-pumas-know.md b/.changeset/rich-pumas-know.md new file mode 100644 index 0000000000..cdb177b16d --- /dev/null +++ b/.changeset/rich-pumas-know.md @@ -0,0 +1,5 @@ +--- +'@aws-amplify/backend-data': patch +--- + +Update data-schema version diff --git a/package-lock.json b/package-lock.json index d23bc8b1a0..6585e4f0f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1061,17 +1061,17 @@ } }, "node_modules/@aws-amplify/data-schema": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/@aws-amplify/data-schema/-/data-schema-0.12.5.tgz", - "integrity": "sha512-cpUHG4kCmpfToTe2iARXdDOePIPoTlPWqbhYsEewtDKGiCyhBmDu3nwWaEgj3uoHn8Xfk3Qyq4WaaykHYGM1WQ==", + "version": "0.12.9", + "resolved": "https://registry.npmjs.org/@aws-amplify/data-schema/-/data-schema-0.12.9.tgz", + "integrity": "sha512-S0uN3ZncODzMpDijWfT5uHoytY65KTob/m9N6ltsGsk7h+1+alNkA/PAEya9JWhzIU8gFemW9F/8s9X9S/Nweg==", "dependencies": { "@aws-amplify/data-schema-types": "*" } }, "node_modules/@aws-amplify/data-schema-types": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/@aws-amplify/data-schema-types/-/data-schema-types-0.6.3.tgz", - "integrity": "sha512-Zxal0UGNK4BEE6YeDg48FQ0obtKq1KCxr09pyFZR/ml0SLF5zJA5c2d+EWATpifWIFCB0QfpoDmXZFaYuEjmcA==", + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/@aws-amplify/data-schema-types/-/data-schema-types-0.6.6.tgz", + "integrity": "sha512-kMGeOHztllmwbeb4qa0hDSAjDyu/C2frfpk326Z7S5Q2YWgEPA2Mp04ojOP5WI1efKqBmUz9e4tAZixmCzJLFw==", "dependencies": { "rxjs": "^7.8.1" } @@ -20024,7 +20024,7 @@ "@aws-amplify/backend-output-storage": "^0.2.3", "@aws-amplify/backend-secret": "^0.3.0", "@aws-amplify/backend-storage": "^0.3.0", - "@aws-amplify/data-schema": "^0.12.5", + "@aws-amplify/data-schema": "^0.12.9", "@aws-amplify/platform-core": "^0.2.1", "@aws-amplify/plugin-types": "^0.4.1", "@aws-sdk/client-amplify": "^3.440.0" @@ -20064,12 +20064,12 @@ "@aws-amplify/backend-output-schemas": "^0.4.0", "@aws-amplify/backend-output-storage": "0.2.4", "@aws-amplify/data-construct": "^1.4.1", - "@aws-amplify/data-schema-types": "^0.6.3", + "@aws-amplify/data-schema-types": "^0.6.6", "@aws-amplify/plugin-types": "^0.4.1" }, "devDependencies": { "@aws-amplify/backend-platform-test-stubs": "^0.3.0", - "@aws-amplify/data-schema": "^0.12.5", + "@aws-amplify/data-schema": "^0.12.9", "@aws-amplify/platform-core": "^0.2.2" }, "peerDependencies": { @@ -20176,18 +20176,18 @@ }, "packages/cli": { "name": "@aws-amplify/backend-cli", - "version": "0.8.0", + "version": "0.8.1", "license": "Apache-2.0", "dependencies": { "@aws-amplify/backend-output-schemas": "^0.4.0", "@aws-amplify/backend-secret": "^0.3.0", "@aws-amplify/cli-core": "^0.2.0", - "@aws-amplify/client-config": "^0.4.1", + "@aws-amplify/client-config": "^0.4.2", "@aws-amplify/deployed-backend-client": "^0.3.2", - "@aws-amplify/form-generator": "^0.4.0", + "@aws-amplify/form-generator": "^0.5.0", "@aws-amplify/model-generator": "^0.2.2", "@aws-amplify/platform-core": "^0.2.2", - "@aws-amplify/sandbox": "^0.3.3", + "@aws-amplify/sandbox": "^0.3.4", "@aws-sdk/credential-provider-ini": "^3.360.0", "@aws-sdk/credential-providers": "^3.360.0", "@aws-sdk/region-config-resolver": "^3.433.0", @@ -20360,7 +20360,7 @@ }, "packages/client-config": { "name": "@aws-amplify/client-config", - "version": "0.4.1", + "version": "0.4.2", "license": "Apache-2.0", "dependencies": { "@aws-amplify/backend-output-schemas": "^0.4.0", @@ -20378,7 +20378,7 @@ } }, "packages/create-amplify": { - "version": "0.3.4", + "version": "0.3.5", "license": "Apache-2.0", "dependencies": { "@aws-amplify/cli-core": "^0.2.0", @@ -20509,7 +20509,7 @@ }, "packages/form-generator": { "name": "@aws-amplify/form-generator", - "version": "0.4.0", + "version": "0.5.0", "license": "Apache-2.0", "dependencies": { "@aws-amplify/appsync-modelgen-plugin": "^2.6.0", @@ -20540,14 +20540,14 @@ }, "packages/integration-tests": { "name": "@aws-amplify/integration-tests", - "version": "0.3.4", + "version": "0.3.5", "license": "Apache-2.0", "devDependencies": { "@aws-amplify/backend": "0.5.2", "@aws-amplify/backend-auth": "0.3.3", "@aws-amplify/backend-secret": "^0.3.0", "@aws-amplify/backend-storage": "0.3.0", - "@aws-amplify/data-schema": "^0.12.5", + "@aws-amplify/data-schema": "^0.12.9", "@aws-amplify/platform-core": "^0.2.2", "@aws-sdk/client-amplify": "^3.440.0", "@aws-sdk/client-cloudformation": "^3.421.0", @@ -21049,13 +21049,13 @@ }, "packages/sandbox": { "name": "@aws-amplify/sandbox", - "version": "0.3.3", + "version": "0.3.4", "license": "Apache-2.0", "dependencies": { "@aws-amplify/backend-deployer": "0.3.2", "@aws-amplify/backend-secret": "^0.3.0", "@aws-amplify/cli-core": "^0.2.0", - "@aws-amplify/client-config": "0.4.1", + "@aws-amplify/client-config": "0.4.2", "@aws-amplify/deployed-backend-client": "^0.3.2", "@aws-amplify/platform-core": "^0.2.2", "@aws-sdk/client-cloudformation": "^3.421.0", diff --git a/packages/backend-data/package.json b/packages/backend-data/package.json index c1203249f5..0bcd3218aa 100644 --- a/packages/backend-data/package.json +++ b/packages/backend-data/package.json @@ -18,7 +18,7 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-amplify/data-schema": "^0.12.5", + "@aws-amplify/data-schema": "^0.12.9", "@aws-amplify/backend-platform-test-stubs": "^0.3.0", "@aws-amplify/platform-core": "^0.2.2" }, @@ -31,6 +31,6 @@ "@aws-amplify/backend-output-schemas": "^0.4.0", "@aws-amplify/data-construct": "^1.4.1", "@aws-amplify/plugin-types": "^0.4.1", - "@aws-amplify/data-schema-types": "^0.6.3" + "@aws-amplify/data-schema-types": "^0.6.6" } } diff --git a/packages/backend-data/src/convert_schema.test.ts b/packages/backend-data/src/convert_schema.test.ts index 5c98ccccf7..698f713f20 100644 --- a/packages/backend-data/src/convert_schema.test.ts +++ b/packages/backend-data/src/convert_schema.test.ts @@ -28,18 +28,20 @@ void describe('convertSchemaToCDK', () => { void it('generates for a typed schema', () => { const expectedGraphqlSchema = /* GraphQL */ ` - type Todo @model { + type Todo @model @auth(rules: [{ allow: public }]) { id: ID! @primaryKey content: String! createdAt: AWSDateTime! updatedAt: AWSDateTime! } `; - const typedSchema = a.schema({ - Todo: a.model({ - content: a.string().required(), - }), - }); + const typedSchema = a + .schema({ + Todo: a.model({ + content: a.string().required(), + }), + }) + .authorization([a.allow.public()]); const convertedDefinition = convertSchemaToCDK(typedSchema); assert.deepEqual( removeWhiteSpaceForComparison(convertedDefinition.schema), @@ -54,14 +56,16 @@ void describe('convertSchemaToCDK', () => { }); void it('produces appropriate dataSourceStrategies for a typed schema with multiple models', () => { - const typedSchema = a.schema({ - Todo: a.model({ - content: a.string().required(), - }), - Blog: a.model({ - title: a.string(), - }), - }); + const typedSchema = a + .schema({ + Todo: a.model({ + content: a.string().required(), + }), + Blog: a.model({ + title: a.string(), + }), + }) + .authorization([a.allow.public()]); const convertedDefinition = convertSchemaToCDK(typedSchema); assert.deepEqual(convertedDefinition.dataSourceStrategies, { Todo: { diff --git a/packages/backend/package.json b/packages/backend/package.json index 78a1b1b84c..d916aca887 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -21,7 +21,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@aws-amplify/data-schema": "^0.12.5", + "@aws-amplify/data-schema": "^0.12.9", "@aws-amplify/backend-auth": "^0.3.2", "@aws-amplify/backend-function": "^0.2.2", "@aws-amplify/backend-data": "^0.8.0", diff --git a/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json b/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json index c7a8ff774d..fbad971f8b 100644 --- a/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json +++ b/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json @@ -421,7 +421,7 @@ { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "/30437774f1c71227196609658884b062fb7cc1a490f4a99234540e8a51b2c60b.json" + "/49db5c096a6e16028208ca156161ed85e1c77d49d3073bdb7957432865a50618.json" ] ] } diff --git a/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json b/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json index c3ec6dc201..ea89a1670c 100644 --- a/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json +++ b/packages/create-amplify/templates/basic-auth-data/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json @@ -47,7 +47,7 @@ "ApiId" ] }, - "Expires": 1702847164 + "Expires": 1702857469 } }, "amplifyDataGraphQLAPINONEDS684BF699": { diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 37d81cc84a..e5dbb80f47 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -8,7 +8,7 @@ "@aws-amplify/backend-auth": "0.3.3", "@aws-amplify/backend-secret": "^0.3.0", "@aws-amplify/backend-storage": "0.3.0", - "@aws-amplify/data-schema": "^0.12.5", + "@aws-amplify/data-schema": "^0.12.9", "@aws-sdk/client-amplify": "^3.440.0", "@aws-sdk/client-cloudformation": "^3.421.0", "@aws-amplify/platform-core": "^0.2.2", diff --git a/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json b/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json index f3be03c747..d47d6b22ed 100644 --- a/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json +++ b/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json @@ -306,7 +306,7 @@ { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "/d6e0314b1ac09ff28a99badfe9e99092404a3ec665a87b7790a3a7d354d39f88.json" + "/1f9170d47be7a5554c0c68803291a57060ec87ed69a3225c34a56eb1a53d5831.json" ] ] } diff --git a/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json b/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json index ded1dfbf3b..7ab5894fd8 100644 --- a/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json +++ b/packages/integration-tests/test-projects/data-iterative-deploy/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json @@ -31,7 +31,7 @@ "ApiId" ] }, - "Expires": 1700859954 + "Expires": 1700870257 } }, "amplifyDataGraphQLAPINONEDS684BF699": { diff --git a/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json b/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json index 6e5a6807f2..224d8d8c94 100644 --- a/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json +++ b/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json @@ -318,7 +318,7 @@ { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "/a1ae1b3815e3a2aa0075b529cf24f525b5274c558ef80670435864e040d30d05.json" + "/c29dc8507624b0ff3eb73073f8de1d4e8998ddf5fb5f8e674b16f5f372b912ab.json" ] ] } diff --git a/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json b/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json index bea429a1e3..1fc652fd66 100644 --- a/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json +++ b/packages/integration-tests/test-projects/standalone-data-auth-modes/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json @@ -51,7 +51,7 @@ "ApiId" ] }, - "Expires": 1702847162 + "Expires": 1702857466 } }, "amplifyDataGraphQLAPINONEDS684BF699": { diff --git a/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json b/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json index 748adcf5fd..3b924d056c 100644 --- a/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json +++ b/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplify-testAppId-testBranchName-branch-7d6f6c854a.template.json @@ -306,7 +306,7 @@ { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "/56ff54712934bfae19cc63d8f507aa3814a24d00c53b20fff17034fd3002185a.json" + "/2575b6782317dd85e53f20cf5cb843d0e82f91a3bf6664b9f097790fd5056b43.json" ] ] } diff --git a/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json b/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json index 519ac6491e..48d733b80a 100644 --- a/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json +++ b/packages/integration-tests/test-projects/standalone-data-sandbox-mode/expected-cdk-out/amplifytestAppIdtestBranchNamebranch7d6f6c854adataE67321C2.nested.template.json @@ -31,7 +31,7 @@ "ApiId" ] }, - "Expires": 1700859963 + "Expires": 1700870267 } }, "amplifyDataGraphQLAPINONEDS684BF699": {