@aws-amplify/graphql-api-construct 1.1.2 → 1.1.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.
Files changed (129) hide show
  1. package/.jsii +37 -37
  2. package/CHANGELOG.md +12 -0
  3. package/README.md +9 -3
  4. package/lib/amplify-graphql-api.d.ts +13 -3
  5. package/lib/amplify-graphql-api.js +19 -5
  6. package/lib/amplify-graphql-definition.js +1 -1
  7. package/lib/internal/authorization-modes.d.ts +5 -0
  8. package/lib/internal/authorization-modes.js +15 -2
  9. package/lib/internal/codegen-assets.js +6 -1
  10. package/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.d.ts +10 -0
  11. package/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.d.ts +10 -0
  12. package/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.js +2 -0
  13. package/node_modules/@aws-amplify/backend-output-schemas/lib/index.d.ts +50 -0
  14. package/node_modules/@aws-amplify/backend-output-schemas/lib/index.js +6 -2
  15. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.d.ts +23 -0
  16. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.js +12 -0
  17. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.d.ts +22 -0
  18. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.js +14 -0
  19. package/node_modules/@aws-amplify/backend-output-schemas/package.json +3 -2
  20. package/node_modules/@aws-amplify/backend-output-storage/lib/stack_metadata_output_storage_strategy.d.ts +0 -4
  21. package/node_modules/@aws-amplify/backend-output-storage/lib/stack_metadata_output_storage_strategy.js +1 -13
  22. package/node_modules/@aws-amplify/backend-output-storage/package.json +3 -2
  23. package/node_modules/@aws-amplify/graphql-auth-transformer/API.md +2 -4
  24. package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +10 -0
  25. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/field.d.ts.map +1 -1
  26. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/field.js +1 -1
  27. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/field.js.map +1 -1
  28. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/helpers.d.ts +3 -3
  29. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/helpers.d.ts.map +1 -1
  30. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/helpers.js +8 -9
  31. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/helpers.js.map +1 -1
  32. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.create.d.ts.map +1 -1
  33. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.create.js +5 -5
  34. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.create.js.map +1 -1
  35. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.delete.d.ts.map +1 -1
  36. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.delete.js +4 -4
  37. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.delete.js.map +1 -1
  38. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.update.d.ts.map +1 -1
  39. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.update.js +5 -5
  40. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.update.js.map +1 -1
  41. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/query.d.ts.map +1 -1
  42. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/query.js +2 -2
  43. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/query.js.map +1 -1
  44. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/search.d.ts.map +1 -1
  45. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/search.js +4 -4
  46. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/search.js.map +1 -1
  47. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/subscriptions.js +1 -1
  48. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/subscriptions.js.map +1 -1
  49. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.d.ts +1 -2
  50. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.d.ts.map +1 -1
  51. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.js.map +1 -1
  52. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.d.ts.map +1 -1
  53. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js +1 -2
  54. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js.map +1 -1
  55. package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +9 -9
  56. package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +8 -0
  57. package/node_modules/@aws-amplify/graphql-default-value-transformer/LICENSE +201 -0
  58. package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +7 -6
  59. package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +8 -0
  60. package/node_modules/@aws-amplify/graphql-function-transformer/LICENSE +201 -0
  61. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +6 -5
  62. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +8 -0
  63. package/node_modules/@aws-amplify/graphql-http-transformer/LICENSE +201 -0
  64. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +6 -5
  65. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +8 -0
  66. package/node_modules/@aws-amplify/graphql-index-transformer/LICENSE +201 -0
  67. package/node_modules/@aws-amplify/graphql-index-transformer/package.json +7 -6
  68. package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +8 -0
  69. package/node_modules/@aws-amplify/graphql-maps-to-transformer/LICENSE +201 -0
  70. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
  71. package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +10 -9
  72. package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +8 -0
  73. package/node_modules/@aws-amplify/graphql-model-transformer/LICENSE +201 -0
  74. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
  75. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
  76. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
  77. package/node_modules/@aws-amplify/graphql-model-transformer/package.json +6 -5
  78. package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +8 -0
  79. package/node_modules/@aws-amplify/graphql-predictions-transformer/LICENSE +201 -0
  80. package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
  81. package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +6 -5
  82. package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +8 -0
  83. package/node_modules/@aws-amplify/graphql-relational-transformer/LICENSE +201 -0
  84. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +8 -7
  85. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +10 -0
  86. package/node_modules/@aws-amplify/graphql-searchable-transformer/LICENSE +201 -0
  87. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  88. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +7 -6
  89. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +10 -0
  90. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts.map +1 -1
  91. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js +10 -5
  92. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js.map +1 -1
  93. package/node_modules/@aws-amplify/graphql-transformer/package.json +14 -14
  94. package/node_modules/@aws-amplify/graphql-transformer/src/graphql-transformer.ts +9 -2
  95. package/node_modules/@aws-amplify/graphql-transformer-core/API.md +1 -0
  96. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +12 -0
  97. package/node_modules/@aws-amplify/graphql-transformer-core/LICENSE +201 -0
  98. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.d.ts +8 -1
  99. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.d.ts.map +1 -1
  100. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.js +60 -23
  101. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/output.js.map +1 -1
  102. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.d.ts.map +1 -1
  103. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.js +19 -7
  104. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/resolver.js.map +1 -1
  105. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/defaultSchema.d.ts +4 -1
  106. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/defaultSchema.d.ts.map +1 -1
  107. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/defaultSchema.js +35 -36
  108. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/defaultSchema.js.map +1 -1
  109. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +4 -3
  110. package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +2 -0
  111. package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +6 -0
  112. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts +2 -0
  113. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts.map +1 -1
  114. package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +1 -1
  115. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/synth-parameters.ts +2 -0
  116. package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
  117. package/node_modules/zod/README.md +215 -120
  118. package/node_modules/zod/lib/ZodError.js +8 -0
  119. package/node_modules/zod/lib/helpers/parseUtil.js +3 -2
  120. package/node_modules/zod/lib/helpers/util.js +4 -4
  121. package/node_modules/zod/lib/index.mjs +121 -57
  122. package/node_modules/zod/lib/index.umd.js +121 -56
  123. package/node_modules/zod/lib/types.d.ts +55 -10
  124. package/node_modules/zod/lib/types.js +301 -58
  125. package/node_modules/zod/package.json +29 -15
  126. package/package.json +18 -18
  127. package/src/amplify-graphql-api.ts +26 -3
  128. package/src/internal/authorization-modes.ts +18 -0
  129. package/src/internal/codegen-assets.ts +5 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.21.4",
3
+ "version": "3.22.4",
4
4
  "author": "Colin McDonnell <colin@colinhacks.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,12 +9,18 @@
9
9
  "main": "./lib/index.js",
10
10
  "module": "./lib/index.mjs",
11
11
  "devDependencies": {
12
+ "@babel/core": "^7.22.5",
13
+ "@babel/preset-env": "^7.22.5",
14
+ "@babel/preset-typescript": "^7.22.5",
12
15
  "@rollup/plugin-typescript": "^8.2.0",
16
+ "@swc/core": "^1.3.66",
17
+ "@swc/jest": "^0.2.26",
13
18
  "@types/benchmark": "^2.1.0",
14
19
  "@types/jest": "^29.2.2",
15
20
  "@types/node": "14",
16
21
  "@typescript-eslint/eslint-plugin": "^5.15.0",
17
22
  "@typescript-eslint/parser": "^5.15.0",
23
+ "babel-jest": "^29.5.0",
18
24
  "benchmark": "^2.1.4",
19
25
  "dependency-cruiser": "^9.19.0",
20
26
  "eslint": "^8.11.0",
@@ -30,18 +36,19 @@
30
36
  "prettier": "^2.6.0",
31
37
  "pretty-quick": "^3.1.3",
32
38
  "rollup": "^2.70.1",
33
- "ts-jest": "^29.0.3",
39
+ "ts-jest": "^29.1.0",
34
40
  "ts-morph": "^14.0.0",
35
41
  "ts-node": "^10.9.1",
36
42
  "tslib": "^2.3.1",
37
43
  "tsx": "^3.8.0",
38
- "typescript": "~4.5.0"
44
+ "typescript": "~4.5.0",
45
+ "vitest": "^0.32.2"
39
46
  },
40
47
  "exports": {
41
48
  ".": {
49
+ "types": "./index.d.ts",
42
50
  "require": "./lib/index.js",
43
- "import": "./lib/index.mjs",
44
- "types": "./index.d.ts"
51
+ "import": "./lib/index.mjs"
45
52
  },
46
53
  "./package.json": "./package.json",
47
54
  "./locales/*": "./lib/locales/*"
@@ -68,25 +75,32 @@
68
75
  "src/*.ts": [
69
76
  "eslint --cache --fix",
70
77
  "prettier --ignore-unknown --write"
78
+ ],
79
+ "*.md": [
80
+ "prettier --ignore-unknown --write"
71
81
  ]
72
82
  },
73
83
  "scripts": {
74
- "prettier:check": "prettier --check src/**/*.ts deno/lib/**/*.ts --no-error-on-unmatched-pattern",
75
- "prettier:fix": "prettier --write src/**/*.ts deno/lib/**/*.ts --ignore-unknown --no-error-on-unmatched-pattern",
84
+ "prettier:check": "prettier --check src/**/*.ts deno/lib/**/*.ts *.md --no-error-on-unmatched-pattern",
85
+ "prettier:fix": "prettier --write src/**/*.ts deno/lib/**/*.ts *.md --ignore-unknown --no-error-on-unmatched-pattern",
76
86
  "lint:check": "eslint --cache --ext .ts ./src",
77
87
  "lint:fix": "eslint --cache --fix --ext .ts ./src",
78
88
  "check": "yarn lint:check && yarn prettier:check",
79
89
  "fix": "yarn lint:fix && yarn prettier:fix",
80
90
  "clean": "rm -rf lib/* deno/lib/*",
81
91
  "build": "yarn run clean && npm run build:cjs && npm run build:esm && npm run build:deno",
82
- "build:deno": "node ./deno/build.mjs && cp ./README.md ./deno/lib",
83
- "build:esm": "rollup --config rollup.config.js",
84
- "build:cjs": "tsc -p tsconfig.cjs.json",
85
- "build:types": "tsc -p tsconfig.types.json",
86
- "build:test": "tsc -p tsconfig.test.json",
87
- "rollup": "rollup --config rollup.config.js",
88
- "test:watch": "jest --watch",
89
- "test": "jest --coverage",
92
+ "build:deno": "node ./deno-build.mjs && cp ./README.md ./deno/lib",
93
+ "build:esm": "rollup --config ./configs/rollup.config.js",
94
+ "build:cjs": "tsc -p ./configs/tsconfig.cjs.json",
95
+ "build:types": "tsc -p ./configs/tsconfig.types.json",
96
+ "build:test": "tsc -p ./configs/tsconfig.test.json",
97
+ "test:watch": "yarn test:ts-jest --watch",
98
+ "test": "yarn test:ts-jest",
99
+ "test:babel": "jest --coverage --config ./configs/babel-jest.config.json",
100
+ "test:bun": "bun test",
101
+ "test:vitest": "npx vitest --config ./configs/vitest.config.ts",
102
+ "test:ts-jest": "npx jest --config ./configs/ts-jest.config.json",
103
+ "test:swc": "npx jest --config ./configs/swc-jest.config.json",
90
104
  "test:deno": "cd deno && deno test",
91
105
  "prepublishOnly": "npm run test && npm run build && npm run build:deno",
92
106
  "play": "nodemon -e ts -w . -x tsx playground.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/graphql-api-construct",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "AppSync GraphQL Api Construct using Amplify GraphQL Transformer.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -74,21 +74,21 @@
74
74
  "universalify"
75
75
  ],
76
76
  "dependencies": {
77
- "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.3",
78
- "@aws-amplify/backend-output-storage": "^0.1.1-alpha.0",
79
- "@aws-amplify/graphql-auth-transformer": "3.1.6",
80
- "@aws-amplify/graphql-default-value-transformer": "2.1.5",
81
- "@aws-amplify/graphql-function-transformer": "2.1.4",
82
- "@aws-amplify/graphql-http-transformer": "2.1.4",
83
- "@aws-amplify/graphql-index-transformer": "2.1.5",
84
- "@aws-amplify/graphql-maps-to-transformer": "3.2.2",
85
- "@aws-amplify/graphql-model-transformer": "2.2.1",
86
- "@aws-amplify/graphql-predictions-transformer": "2.1.4",
87
- "@aws-amplify/graphql-relational-transformer": "2.1.5",
88
- "@aws-amplify/graphql-searchable-transformer": "2.2.1",
89
- "@aws-amplify/graphql-transformer": "1.2.2",
90
- "@aws-amplify/graphql-transformer-core": "2.2.1",
91
- "@aws-amplify/graphql-transformer-interfaces": "3.2.0",
77
+ "@aws-amplify/backend-output-schemas": "^0.2.0-alpha.6",
78
+ "@aws-amplify/backend-output-storage": "^0.1.1-alpha.2",
79
+ "@aws-amplify/graphql-auth-transformer": "3.1.8",
80
+ "@aws-amplify/graphql-default-value-transformer": "2.1.7",
81
+ "@aws-amplify/graphql-function-transformer": "2.1.6",
82
+ "@aws-amplify/graphql-http-transformer": "2.1.6",
83
+ "@aws-amplify/graphql-index-transformer": "2.1.7",
84
+ "@aws-amplify/graphql-maps-to-transformer": "3.2.4",
85
+ "@aws-amplify/graphql-model-transformer": "2.2.3",
86
+ "@aws-amplify/graphql-predictions-transformer": "2.1.6",
87
+ "@aws-amplify/graphql-relational-transformer": "2.1.7",
88
+ "@aws-amplify/graphql-searchable-transformer": "2.2.3",
89
+ "@aws-amplify/graphql-transformer": "1.2.4",
90
+ "@aws-amplify/graphql-transformer-core": "2.2.3",
91
+ "@aws-amplify/graphql-transformer-interfaces": "3.2.1",
92
92
  "charenc": "^0.0.2",
93
93
  "crypt": "^0.0.2",
94
94
  "fs-extra": "^8.1.0",
@@ -107,7 +107,7 @@
107
107
  "pluralize": "^8.0.0",
108
108
  "ts-dedent": "^2.0.0",
109
109
  "universalify": "^2.0.0",
110
- "zod": "^3.21.4"
110
+ "zod": "^3.22.3"
111
111
  },
112
112
  "devDependencies": {
113
113
  "@types/fs-extra": "^8.0.1",
@@ -162,5 +162,5 @@
162
162
  }
163
163
  }
164
164
  },
165
- "gitHead": "185090987e9c49db5e59aa4476dad7e17e9d2067"
165
+ "gitHead": "10b8deff41ca497f67ae061c3860340f3cab724c"
166
166
  }
@@ -35,6 +35,7 @@ import type {
35
35
  FunctionSlot,
36
36
  IBackendOutputStorageStrategy,
37
37
  AddFunctionProps,
38
+ ConflictResolution,
38
39
  } from './types';
39
40
  import {
40
41
  convertAuthorizationModesToTransformerAuthConfig,
@@ -45,6 +46,7 @@ import {
45
46
  getGeneratedFunctionSlots,
46
47
  CodegenAssets,
47
48
  addAmplifyMetadataToStackDescription,
49
+ getAdditionalAuthenticationTypes,
48
50
  } from './internal';
49
51
 
50
52
  /**
@@ -62,12 +64,18 @@ import {
62
64
  *
63
65
  * For a full reference of the supported custom graphql directives - https://docs.amplify.aws/cli/graphql/directives-reference/
64
66
  *
65
- * The output of this construct is a mapping of L1 resources generated by the transformer, which generally follow the access pattern
67
+ * The output of this construct is a mapping of L2 or L1 resources generated by the transformer, which generally follow the access pattern
66
68
  *
67
69
  * ```typescript
68
70
  * const api = new AmplifyGraphQlApi(this, 'api', { <params> });
69
- * api.resources.api.xrayEnabled = true;
70
- * Object.values(api.resources.tables).forEach(table => table.pointInTimeRecoverySpecification = { pointInTimeRecoveryEnabled: false });
71
+ * // Access L2 resources under `.resources`
72
+ * api.resources.tables["Todo"].tableArn;
73
+ *
74
+ * // Access L1 resources under `.resources.cfnResources`
75
+ * api.resources.cfnResources.cfnGraphqlApi.xrayEnabled = true;
76
+ * Object.values(api.resources.cfnResources.cfnTables).forEach(table => {
77
+ * table.pointInTimeRecoverySpecification = { pointInTimeRecoveryEnabled: false };
78
+ * });
71
79
  * ```
72
80
  * `resources.<ResourceType>.<ResourceName>` - you can then perform any CDK action on these resulting resoureces.
73
81
  */
@@ -103,6 +111,11 @@ export class AmplifyGraphqlApi extends Construct {
103
111
  */
104
112
  public readonly apiKey: string | undefined;
105
113
 
114
+ /**
115
+ * Conflict resolution setting
116
+ */
117
+ private readonly conflictResolution: ConflictResolution | undefined;
118
+
106
119
  /**
107
120
  * New AmplifyGraphqlApi construct, this will create an appsync api with authorization, a schema, and all necessary resolvers, functions,
108
121
  * and datasources.
@@ -180,6 +193,7 @@ export class AmplifyGraphqlApi extends Construct {
180
193
  this.codegenAssets = new CodegenAssets(this, 'AmplifyCodegenAssets', { modelSchema: definition.schema });
181
194
 
182
195
  this.resources = getGeneratedResources(this);
196
+ this.conflictResolution = conflictResolution;
183
197
  this.generatedFunctionSlots = getGeneratedFunctionSlots(assetManager.resolverAssets);
184
198
  this.storeOutput(outputStorageStrategy);
185
199
 
@@ -211,6 +225,15 @@ export class AmplifyGraphqlApi extends Construct {
211
225
  output.payload.awsAppsyncApiKey = this.resources.cfnResources.cfnApiKey.attrApiKey;
212
226
  }
213
227
 
228
+ const additionalAuthTypes = getAdditionalAuthenticationTypes(this.resources.cfnResources.cfnGraphqlApi);
229
+ if (additionalAuthTypes) {
230
+ output.payload.awsAppsyncAdditionalAuthenticationTypes = additionalAuthTypes;
231
+ }
232
+
233
+ if (this.conflictResolution?.project?.handlerType) {
234
+ output.payload.awsAppsyncConflictResolutionMode = this.conflictResolution?.project?.handlerType;
235
+ }
236
+
214
237
  outputStorageStrategy.addBackendOutputEntry(graphqlOutputKey, output);
215
238
  }
216
239
 
@@ -7,6 +7,8 @@ import {
7
7
  OIDCAuthorizationConfig,
8
8
  UserPoolAuthorizationConfig,
9
9
  } from '../types';
10
+ import { CfnGraphQLApi } from 'aws-cdk-lib/aws-appsync';
11
+ import { isArray } from 'lodash';
10
12
 
11
13
  type AuthorizationConfigMode =
12
14
  | (IAMAuthorizationConfig & { type: 'AWS_IAM' })
@@ -128,6 +130,22 @@ interface AuthConfig {
128
130
  authSynthParameters: AuthSynthParameters;
129
131
  }
130
132
 
133
+ /**
134
+ * Transforms additionalAuthenticationTypes for storage in CFN output
135
+ */
136
+ export const getAdditionalAuthenticationTypes = (cfnGraphqlApi: CfnGraphQLApi): string | undefined => {
137
+ if (!isArray(cfnGraphqlApi.additionalAuthenticationProviders)) {
138
+ return;
139
+ }
140
+
141
+ return (cfnGraphqlApi.additionalAuthenticationProviders as CfnGraphQLApi.AdditionalAuthenticationProviderProperty[])
142
+ .map(
143
+ (additionalAuthenticationProvider: CfnGraphQLApi.AdditionalAuthenticationProviderProperty) =>
144
+ additionalAuthenticationProvider.authenticationType,
145
+ )
146
+ .join(',');
147
+ };
148
+
131
149
  /**
132
150
  * Convert the list of auth modes into the necessary flags and params (effectively a reducer on the rule list)
133
151
  * @param authModes the list of auth modes configured on the API.
@@ -35,6 +35,11 @@ export class CodegenAssets extends Construct {
35
35
  new BucketDeployment(this, `${id}Deployment`, {
36
36
  destinationBucket: bucket,
37
37
  sources: [Source.data(MODEL_SCHEMA_KEY, props.modelSchema)],
38
+ // Bucket deployment uses a Lambda that runs AWS S3 CLI to transfer assets to destination bucket.
39
+ // That Lambda requires higher memory setting to run fast even when processing small assets (less than 1kB).
40
+ // This setting has been established experimentally. Benchmark can be found in pull request description that established it.
41
+ // The value has been chosen to prefer the lowest cost (run time * memory demand) while providing reasonable performance.
42
+ memoryLimit: 1536,
38
43
  });
39
44
 
40
45
  this.modelSchemaS3Uri = getS3UriForBucketAndKey(bucket, MODEL_SCHEMA_KEY);