diff --git a/.circleci/config.yml b/.circleci/config.yml index 2dd2842f6e0..2b7f84648b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1077,37 +1077,37 @@ jobs: environment: TEST_SUITE: src/__tests__/plugin.test.ts CLI_REGION: ap-northeast-1 - schema-iterative-update-locking-amplify_e2e_tests: + migration-node-function-amplify_e2e_tests: working_directory: ~/repo docker: *ref_1 resource_class: large steps: *ref_4 environment: - TEST_SUITE: src/__tests__/schema-iterative-update-locking.test.ts + TEST_SUITE: src/__tests__/migration/node.function.test.ts CLI_REGION: ap-southeast-1 - migration-node-function-amplify_e2e_tests: + api_4-amplify_e2e_tests: working_directory: ~/repo docker: *ref_1 resource_class: large steps: *ref_4 environment: - TEST_SUITE: src/__tests__/migration/node.function.test.ts + TEST_SUITE: src/__tests__/api_4.test.ts CLI_REGION: ap-southeast-2 - function_5-amplify_e2e_tests: + schema-iterative-update-locking-amplify_e2e_tests: working_directory: ~/repo docker: *ref_1 resource_class: large steps: *ref_4 environment: - TEST_SUITE: src/__tests__/function_5.test.ts + TEST_SUITE: src/__tests__/schema-iterative-update-locking.test.ts CLI_REGION: us-east-2 - api_4-amplify_e2e_tests: + function_5-amplify_e2e_tests: working_directory: ~/repo docker: *ref_1 resource_class: large steps: *ref_4 environment: - TEST_SUITE: src/__tests__/api_4.test.ts + TEST_SUITE: src/__tests__/function_5.test.ts CLI_REGION: us-west-2 schema-iterative-update-4-amplify_e2e_tests_pkg_linux: working_directory: ~/repo @@ -1719,44 +1719,44 @@ jobs: TEST_SUITE: src/__tests__/plugin.test.ts CLI_REGION: ap-northeast-1 steps: *ref_5 - schema-iterative-update-locking-amplify_e2e_tests_pkg_linux: + migration-node-function-amplify_e2e_tests_pkg_linux: working_directory: ~/repo docker: *ref_1 resource_class: large environment: AMPLIFY_DIR: /home/circleci/repo/out AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux - TEST_SUITE: src/__tests__/schema-iterative-update-locking.test.ts + TEST_SUITE: src/__tests__/migration/node.function.test.ts CLI_REGION: ap-southeast-1 steps: *ref_5 - migration-node-function-amplify_e2e_tests_pkg_linux: + api_4-amplify_e2e_tests_pkg_linux: working_directory: ~/repo docker: *ref_1 resource_class: large environment: AMPLIFY_DIR: /home/circleci/repo/out AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux - TEST_SUITE: src/__tests__/migration/node.function.test.ts + TEST_SUITE: src/__tests__/api_4.test.ts CLI_REGION: ap-southeast-2 steps: *ref_5 - function_5-amplify_e2e_tests_pkg_linux: + schema-iterative-update-locking-amplify_e2e_tests_pkg_linux: working_directory: ~/repo docker: *ref_1 resource_class: large environment: AMPLIFY_DIR: /home/circleci/repo/out AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux - TEST_SUITE: src/__tests__/function_5.test.ts + TEST_SUITE: src/__tests__/schema-iterative-update-locking.test.ts CLI_REGION: us-east-2 steps: *ref_5 - api_4-amplify_e2e_tests_pkg_linux: + function_5-amplify_e2e_tests_pkg_linux: working_directory: ~/repo docker: *ref_1 resource_class: large environment: AMPLIFY_DIR: /home/circleci/repo/out AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux - TEST_SUITE: src/__tests__/api_4.test.ts + TEST_SUITE: src/__tests__/function_5.test.ts CLI_REGION: us-west-2 steps: *ref_5 workflows: @@ -1854,11 +1854,11 @@ workflows: - hostingPROD-amplify_e2e_tests - amplify-app-amplify_e2e_tests - init-amplify_e2e_tests - - function_5-amplify_e2e_tests + - schema-iterative-update-locking-amplify_e2e_tests - predictions-amplify_e2e_tests - schema-predictions-amplify_e2e_tests - amplify-configure-amplify_e2e_tests - - api_4-amplify_e2e_tests + - function_5-amplify_e2e_tests - function_3-amplify_e2e_tests - containers-api-amplify_e2e_tests - interactions-amplify_e2e_tests @@ -1874,22 +1874,22 @@ workflows: - schema-key-amplify_e2e_tests - analytics-amplify_e2e_tests - notifications-amplify_e2e_tests - - schema-iterative-update-locking-amplify_e2e_tests + - migration-node-function-amplify_e2e_tests - schema-auth-10-amplify_e2e_tests - hosting-amplify_e2e_tests - tags-amplify_e2e_tests - - migration-node-function-amplify_e2e_tests + - api_4-amplify_e2e_tests - done_with_pkg_linux_e2e_tests: context: amplify-cli-ecr requires: - hostingPROD-amplify_e2e_tests_pkg_linux - amplify-app-amplify_e2e_tests_pkg_linux - init-amplify_e2e_tests_pkg_linux - - function_5-amplify_e2e_tests_pkg_linux + - schema-iterative-update-locking-amplify_e2e_tests_pkg_linux - predictions-amplify_e2e_tests_pkg_linux - schema-predictions-amplify_e2e_tests_pkg_linux - amplify-configure-amplify_e2e_tests_pkg_linux - - api_4-amplify_e2e_tests_pkg_linux + - function_5-amplify_e2e_tests_pkg_linux - function_3-amplify_e2e_tests_pkg_linux - containers-api-amplify_e2e_tests_pkg_linux - interactions-amplify_e2e_tests_pkg_linux @@ -1905,11 +1905,11 @@ workflows: - schema-key-amplify_e2e_tests_pkg_linux - analytics-amplify_e2e_tests_pkg_linux - notifications-amplify_e2e_tests_pkg_linux - - schema-iterative-update-locking-amplify_e2e_tests_pkg_linux + - migration-node-function-amplify_e2e_tests_pkg_linux - schema-auth-10-amplify_e2e_tests_pkg_linux - hosting-amplify_e2e_tests_pkg_linux - tags-amplify_e2e_tests_pkg_linux - - migration-node-function-amplify_e2e_tests_pkg_linux + - api_4-amplify_e2e_tests_pkg_linux - amplify_migration_tests_latest: context: amplify-cli-ecr filters: @@ -2059,7 +2059,7 @@ workflows: filters: *ref_8 requires: - schema-auth-7-amplify_e2e_tests - - function_5-amplify_e2e_tests: + - schema-iterative-update-locking-amplify_e2e_tests: context: amplify-cli-ecr post-steps: *ref_7 filters: *ref_8 @@ -2119,7 +2119,7 @@ workflows: filters: *ref_8 requires: - auth_4-amplify_e2e_tests - - api_4-amplify_e2e_tests: + - function_5-amplify_e2e_tests: context: amplify-cli-ecr post-steps: *ref_7 filters: *ref_8 @@ -2335,7 +2335,7 @@ workflows: filters: *ref_8 requires: - schema-searchable-amplify_e2e_tests - - schema-iterative-update-locking-amplify_e2e_tests: + - migration-node-function-amplify_e2e_tests: context: amplify-cli-ecr post-steps: *ref_7 filters: *ref_8 @@ -2389,7 +2389,7 @@ workflows: filters: *ref_8 requires: - schema-auth-8-amplify_e2e_tests - - migration-node-function-amplify_e2e_tests: + - api_4-amplify_e2e_tests: context: amplify-cli-ecr post-steps: *ref_7 filters: *ref_8 @@ -2457,7 +2457,7 @@ workflows: filters: *ref_10 requires: - schema-auth-7-amplify_e2e_tests_pkg_linux - - function_5-amplify_e2e_tests_pkg_linux: + - schema-iterative-update-locking-amplify_e2e_tests_pkg_linux: context: amplify-cli-ecr post-steps: *ref_9 filters: *ref_10 @@ -2521,7 +2521,7 @@ workflows: filters: *ref_10 requires: - auth_4-amplify_e2e_tests_pkg_linux - - api_4-amplify_e2e_tests_pkg_linux: + - function_5-amplify_e2e_tests_pkg_linux: context: amplify-cli-ecr post-steps: *ref_9 filters: *ref_10 @@ -2753,7 +2753,7 @@ workflows: filters: *ref_10 requires: - schema-searchable-amplify_e2e_tests_pkg_linux - - schema-iterative-update-locking-amplify_e2e_tests_pkg_linux: + - migration-node-function-amplify_e2e_tests_pkg_linux: context: amplify-cli-ecr post-steps: *ref_9 filters: *ref_10 @@ -2811,7 +2811,7 @@ workflows: filters: *ref_10 requires: - schema-auth-8-amplify_e2e_tests_pkg_linux - - migration-node-function-amplify_e2e_tests_pkg_linux: + - api_4-amplify_e2e_tests_pkg_linux: context: amplify-cli-ecr post-steps: *ref_9 filters: *ref_10 diff --git a/packages/graphql-relational-schema-transformer/src/__tests__/__snapshots__/RelationalDBResolverGenerator.test.ts.snap b/packages/graphql-relational-schema-transformer/src/__tests__/__snapshots__/RelationalDBResolverGenerator.test.ts.snap index 83c0937907e..fa6dcbe6fc6 100644 --- a/packages/graphql-relational-schema-transformer/src/__tests__/__snapshots__/RelationalDBResolverGenerator.test.ts.snap +++ b/packages/graphql-relational-schema-transformer/src/__tests__/__snapshots__/RelationalDBResolverGenerator.test.ts.snap @@ -95,7 +95,7 @@ exports[`verify generated templates 16`] = ` $utils.toJson($output[0])" `; -exports[`verify generated templates 17`] = `"testFilePath/Query.listTomatoess.req.vtl"`; +exports[`verify generated templates 17`] = `"testFilePath/Query.listTomatoes.req.vtl"`; exports[`verify generated templates 18`] = ` "{ @@ -104,7 +104,7 @@ exports[`verify generated templates 18`] = ` }" `; -exports[`verify generated templates 19`] = `"testFilePath/Query.listTomatoess.res.vtl"`; +exports[`verify generated templates 19`] = `"testFilePath/Query.listTomatoes.res.vtl"`; exports[`verify generated templates 20`] = `"$utils.toJson($utils.rds.toJsonObject($ctx.result)[0])"`; @@ -203,7 +203,7 @@ exports[`verify generated templates using a Int primary key 16`] = ` $utils.toJson($output[0])" `; -exports[`verify generated templates using a Int primary key 17`] = `"testFilePath/Query.listAppless.req.vtl"`; +exports[`verify generated templates using a Int primary key 17`] = `"testFilePath/Query.listApples.req.vtl"`; exports[`verify generated templates using a Int primary key 18`] = ` "{ @@ -212,6 +212,6 @@ exports[`verify generated templates using a Int primary key 18`] = ` }" `; -exports[`verify generated templates using a Int primary key 19`] = `"testFilePath/Query.listAppless.res.vtl"`; +exports[`verify generated templates using a Int primary key 19`] = `"testFilePath/Query.listApples.res.vtl"`; exports[`verify generated templates using a Int primary key 20`] = `"$utils.toJson($utils.rds.toJsonObject($ctx.result)[0])"`; diff --git a/packages/graphql-transformer-common/package.json b/packages/graphql-transformer-common/package.json index 49d71274cc7..0d5256341af 100644 --- a/packages/graphql-transformer-common/package.json +++ b/packages/graphql-transformer-common/package.json @@ -25,11 +25,13 @@ "dependencies": { "graphql": "^14.5.8", "graphql-mapping-template": "4.18.1", - "md5": "^2.2.1" + "md5": "^2.2.1", + "pluralize": "^8.0.0" }, "devDependencies": { "@types/md5": "^2.1.33", - "@types/node": "^10.17.13" + "@types/node": "^10.17.13", + "@types/pluralize": "^0.0.29" }, "jest": { "transform": { diff --git a/packages/graphql-transformer-common/src/util.ts b/packages/graphql-transformer-common/src/util.ts index cca2086ee79..97d8f3f25fe 100644 --- a/packages/graphql-transformer-common/src/util.ts +++ b/packages/graphql-transformer-common/src/util.ts @@ -1,9 +1,13 @@ import md5 from 'md5'; +import pluralize from 'pluralize'; export function plurality(val: string): string { if (!val.trim()) { return ''; } + if (pluralize.isPlural(val.trim())) { + return val; + } return val.concat('s'); }