@aws-amplify/graphql-api-construct 1.3.0-rds-5.0 → 1.4.0-construct-publish-test.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (520) hide show
  1. package/.jsii +774 -465
  2. package/API.md +67 -28
  3. package/CHANGELOG.md +19 -3
  4. package/README.md +1039 -401
  5. package/lib/amplify-dynamodb-table-wrapper.d.ts +128 -0
  6. package/lib/amplify-dynamodb-table-wrapper.js +102 -0
  7. package/lib/amplify-graphql-api.d.ts +4 -6
  8. package/lib/amplify-graphql-api.js +12 -61
  9. package/lib/amplify-graphql-definition.d.ts +19 -13
  10. package/lib/amplify-graphql-definition.js +58 -21
  11. package/lib/index.d.ts +2 -1
  12. package/lib/index.js +5 -2
  13. package/lib/internal/authorization-modes.js +20 -2
  14. package/lib/internal/construct-exports.js +8 -1
  15. package/lib/internal/data-source-config.d.ts +7 -0
  16. package/lib/internal/data-source-config.js +37 -0
  17. package/lib/internal/index.d.ts +1 -1
  18. package/lib/internal/index.js +2 -2
  19. package/lib/internal/model-type-name.d.ts +8 -0
  20. package/lib/internal/model-type-name.js +27 -0
  21. package/lib/types.d.ts +52 -102
  22. package/lib/types.js +1 -1
  23. package/node_modules/@aws-amplify/backend-output-schemas/lib/auth/index.js +8 -9
  24. package/node_modules/@aws-amplify/backend-output-schemas/lib/auth/v1.js +16 -18
  25. package/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/index.js +11 -16
  26. package/node_modules/@aws-amplify/backend-output-schemas/lib/graphql/v1.js +23 -19
  27. package/node_modules/@aws-amplify/backend-output-schemas/lib/index.d.ts +12 -1
  28. package/node_modules/@aws-amplify/backend-output-schemas/lib/index.js +38 -60
  29. package/node_modules/@aws-amplify/backend-output-schemas/lib/platform/index.js +16 -14
  30. package/node_modules/@aws-amplify/backend-output-schemas/lib/platform/stack_metadata_schemas.js +7 -9
  31. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.d.ts +5 -0
  32. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/index.js +8 -9
  33. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.d.ts +5 -0
  34. package/node_modules/@aws-amplify/backend-output-schemas/lib/stack/v1.js +10 -11
  35. package/node_modules/@aws-amplify/backend-output-schemas/lib/storage/index.js +8 -9
  36. package/node_modules/@aws-amplify/backend-output-schemas/lib/storage/v1.js +10 -12
  37. package/node_modules/@aws-amplify/backend-output-schemas/package.json +4 -23
  38. package/node_modules/@aws-amplify/backend-output-storage/lib/index.d.ts +1 -0
  39. package/node_modules/@aws-amplify/backend-output-storage/lib/index.js +17 -14
  40. package/node_modules/@aws-amplify/backend-output-storage/lib/stack_metadata_output_storage_strategy.js +28 -32
  41. package/node_modules/@aws-amplify/backend-output-storage/lib/store_attribution_metadata.d.ts +50 -0
  42. package/node_modules/@aws-amplify/backend-output-storage/lib/store_attribution_metadata.js +104 -0
  43. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.d.ts +5 -0
  44. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.js +9 -0
  45. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.d.ts +9 -0
  46. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.js +13 -0
  47. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/index.d.ts +4 -0
  48. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/index.js +22 -0
  49. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.d.ts +53 -0
  50. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.js +74 -0
  51. package/node_modules/@aws-amplify/backend-output-storage/node_modules/@aws-amplify/platform-core/package.json +23 -0
  52. package/node_modules/@aws-amplify/backend-output-storage/package.json +6 -4
  53. package/node_modules/@aws-amplify/graphql-auth-transformer/API.md +1 -5
  54. package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +4 -12
  55. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts +1 -3
  56. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts.map +1 -1
  57. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js +50 -64
  58. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js.map +1 -1
  59. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/field.d.ts +1 -1
  60. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/field.d.ts.map +1 -0
  61. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/field.js +1 -1
  62. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/field.js.map +1 -0
  63. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/helpers.d.ts +1 -1
  64. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/helpers.d.ts.map +1 -0
  65. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/helpers.js +1 -1
  66. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/helpers.js.map +1 -0
  67. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/index.d.ts.map +1 -0
  68. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/index.js.map +1 -0
  69. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/mutation.create.d.ts +1 -1
  70. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.create.d.ts.map +1 -0
  71. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/mutation.create.js +1 -1
  72. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.create.js.map +1 -0
  73. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/mutation.delete.d.ts +1 -1
  74. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.delete.d.ts.map +1 -0
  75. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/mutation.delete.js +1 -1
  76. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.delete.js.map +1 -0
  77. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/mutation.update.d.ts +1 -1
  78. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.update.d.ts.map +1 -0
  79. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/mutation.update.js +1 -1
  80. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/mutation.update.js.map +1 -0
  81. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/query.d.ts +6 -0
  82. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/query.d.ts.map +1 -0
  83. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/query.js +3 -28
  84. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/query.js.map +1 -0
  85. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/search.d.ts +1 -1
  86. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/search.d.ts.map +1 -0
  87. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/search.js +1 -1
  88. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/search.js.map +1 -0
  89. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/rds/resolvers/subscription.d.ts → resolvers/subscriptions.d.ts} +2 -2
  90. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/subscriptions.d.ts.map +1 -0
  91. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/subscriptions.js +1 -1
  92. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/resolvers/subscriptions.js.map +1 -0
  93. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.d.ts.map +1 -1
  94. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js +0 -3
  95. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js.map +1 -1
  96. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/schema.d.ts.map +1 -1
  97. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/schema.js.map +1 -1
  98. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.d.ts +2 -3
  99. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.d.ts.map +1 -1
  100. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js +1 -4
  101. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js.map +1 -1
  102. package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +11 -11
  103. package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +5 -3
  104. package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.d.ts.map +1 -1
  105. package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.js +1 -13
  106. package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.js.map +1 -1
  107. package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +8 -8
  108. package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +5 -1
  109. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +7 -7
  110. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +5 -1
  111. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +7 -7
  112. package/node_modules/@aws-amplify/graphql-index-transformer/API.md +3 -0
  113. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +6 -4
  114. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-index-transformer.js +4 -0
  115. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-index-transformer.js.map +1 -1
  116. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.d.ts.map +1 -1
  117. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.js +2 -2
  118. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.js.map +1 -1
  119. package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.d.ts +1 -1
  120. package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.d.ts.map +1 -1
  121. package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.js +2 -1
  122. package/node_modules/@aws-amplify/graphql-index-transformer/lib/index.js.map +1 -1
  123. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/generators/rds-vtl-generator.d.ts.map +1 -1
  124. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/generators/rds-vtl-generator.js +1 -4
  125. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/generators/rds-vtl-generator.js.map +1 -1
  126. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts +5 -6
  127. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts.map +1 -1
  128. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js +43 -26
  129. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js.map +1 -1
  130. package/node_modules/@aws-amplify/graphql-index-transformer/package.json +8 -8
  131. package/node_modules/@aws-amplify/graphql-maps-to-transformer/API.md +0 -15
  132. package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +4 -8
  133. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
  134. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/field-mapping-resolvers.d.ts +0 -1
  135. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/field-mapping-resolvers.d.ts.map +1 -1
  136. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/field-mapping-resolvers.js +1 -13
  137. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/field-mapping-resolvers.js.map +1 -1
  138. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-maps-to-transformer.d.ts +1 -2
  139. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-maps-to-transformer.d.ts.map +1 -1
  140. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-maps-to-transformer.js +33 -16
  141. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-maps-to-transformer.js.map +1 -1
  142. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/index.d.ts +0 -1
  143. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/index.d.ts.map +1 -1
  144. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/index.js +1 -3
  145. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/index.js.map +1 -1
  146. package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +13 -13
  147. package/node_modules/@aws-amplify/graphql-model-transformer/API.md +15 -15
  148. package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +5 -13
  149. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts +2 -1
  150. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts.map +1 -1
  151. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js +58 -66
  152. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js.map +1 -1
  153. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.d.ts.map +1 -1
  154. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.js +2 -9
  155. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/mutation.js.map +1 -1
  156. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
  157. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
  158. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
  159. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/dynamodb-vtl-generator.d.ts +5 -6
  160. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/dynamodb-vtl-generator.d.ts.map +1 -1
  161. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/dynamodb-vtl-generator.js +5 -5
  162. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/dynamodb-vtl-generator.js.map +1 -1
  163. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/rds-vtl-generator.d.ts +5 -6
  164. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/rds-vtl-generator.d.ts.map +1 -1
  165. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/rds-vtl-generator.js +11 -11
  166. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/rds-vtl-generator.js.map +1 -1
  167. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/vtl-generator.d.ts +5 -6
  168. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/generators/vtl-generator.d.ts.map +1 -1
  169. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/mutation.d.ts +3 -4
  170. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/mutation.d.ts.map +1 -1
  171. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/mutation.js +55 -74
  172. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/mutation.js.map +1 -1
  173. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/query.d.ts +1 -2
  174. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/query.d.ts.map +1 -1
  175. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/query.js +2 -8
  176. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/query.js.map +1 -1
  177. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts +3 -10
  178. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts.map +1 -1
  179. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js +42 -127
  180. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js.map +1 -1
  181. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts +15 -0
  182. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -0
  183. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +169 -0
  184. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -0
  185. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts +40 -0
  186. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts.map +1 -0
  187. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js +242 -0
  188. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js.map +1 -0
  189. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts +12 -0
  190. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts.map +1 -0
  191. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js +663 -0
  192. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js.map +1 -0
  193. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.d.ts +5 -2
  194. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.d.ts.map +1 -1
  195. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.js +47 -60
  196. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/dynamo-model-resource-generator.js.map +1 -1
  197. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js +5 -5
  198. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js.map +1 -1
  199. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts +0 -1
  200. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts.map +1 -1
  201. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js +1 -28
  202. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js.map +1 -1
  203. package/node_modules/@aws-amplify/graphql-model-transformer/package.json +11 -9
  204. package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +5 -1
  205. package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
  206. package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +7 -7
  207. package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +6 -5
  208. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.d.ts.map +1 -1
  209. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js +9 -41
  210. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js.map +1 -1
  211. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.d.ts.map +1 -1
  212. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js +8 -35
  213. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js.map +1 -1
  214. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.d.ts.map +1 -1
  215. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js +8 -30
  216. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js.map +1 -1
  217. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.d.ts.map +1 -1
  218. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js +2 -3
  219. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js.map +1 -1
  220. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.d.ts +4 -4
  221. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.d.ts.map +1 -1
  222. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js +164 -24
  223. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js.map +1 -1
  224. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.d.ts.map +1 -1
  225. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js +8 -14
  226. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js.map +1 -1
  227. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts +0 -4
  228. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts.map +1 -1
  229. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts +0 -5
  230. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts.map +1 -1
  231. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js +1 -85
  232. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js.map +1 -1
  233. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +10 -10
  234. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +5 -3
  235. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.d.ts.map +1 -1
  236. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js +0 -3
  237. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js.map +1 -1
  238. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  239. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +8 -8
  240. package/node_modules/@aws-amplify/graphql-transformer/API.md +2 -3
  241. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +5 -8
  242. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts +3 -4
  243. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts.map +1 -1
  244. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js +1 -5
  245. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js.map +1 -1
  246. package/node_modules/@aws-amplify/graphql-transformer/package.json +14 -15
  247. package/node_modules/@aws-amplify/graphql-transformer/src/graphql-transformer.ts +5 -15
  248. package/node_modules/@aws-amplify/graphql-transformer-core/API.md +7 -39
  249. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +7 -12
  250. package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/index.d.ts +0 -1
  251. package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/index.d.ts.map +1 -1
  252. package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/index.js.map +1 -1
  253. package/node_modules/@aws-amplify/graphql-transformer-core/lib/graphql-api.js +2 -1
  254. package/node_modules/@aws-amplify/graphql-transformer-core/lib/graphql-api.js.map +1 -1
  255. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +4 -4
  256. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts.map +1 -1
  257. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js +3 -10
  258. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
  259. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.d.ts.map +1 -1
  260. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.js +1 -2
  261. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transform-host.js.map +1 -1
  262. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.d.ts +1 -0
  263. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.d.ts.map +1 -1
  264. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.js +3 -1
  265. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.js.map +1 -1
  266. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.d.ts +3 -2
  267. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.d.ts.map +1 -1
  268. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js +3 -2
  269. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js.map +1 -1
  270. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts +2 -4
  271. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts.map +1 -1
  272. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.d.ts +2 -1
  273. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.d.ts.map +1 -1
  274. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.js +12 -1
  275. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.js.map +1 -1
  276. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts +4 -6
  277. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts.map +1 -1
  278. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.js +1 -2
  279. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.js.map +1 -1
  280. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.d.ts +1 -4
  281. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.d.ts.map +1 -1
  282. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.js +2 -3
  283. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.js.map +1 -1
  284. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.d.ts +1 -1
  285. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.d.ts.map +1 -1
  286. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.js +1 -2
  287. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.js.map +1 -1
  288. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/authType.d.ts.map +1 -1
  289. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/authType.js +1 -0
  290. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/authType.js.map +1 -1
  291. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts +3 -3
  292. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts.map +1 -1
  293. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js +5 -14
  294. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js.map +1 -1
  295. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.d.ts +3 -0
  296. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.d.ts.map +1 -0
  297. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.js +15 -0
  298. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.js.map +1 -0
  299. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-secret-utils.d.ts +2 -0
  300. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-secret-utils.d.ts.map +1 -0
  301. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-secret-utils.js +25 -0
  302. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-secret-utils.js.map +1 -0
  303. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.d.ts +1 -3
  304. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.d.ts.map +1 -1
  305. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.js +1 -7
  306. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.js.map +1 -1
  307. package/node_modules/@aws-amplify/graphql-transformer-core/lib/wrappers/object-definition-wrapper.d.ts +1 -1
  308. package/node_modules/@aws-amplify/graphql-transformer-core/lib/wrappers/object-definition-wrapper.d.ts.map +1 -1
  309. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +4 -4
  310. package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +17 -12
  311. package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +8 -5
  312. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts +2 -5
  313. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts.map +1 -1
  314. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.js.map +1 -1
  315. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts +1 -1
  316. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts.map +1 -1
  317. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.js.map +1 -1
  318. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts +1 -1
  319. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts.map +1 -1
  320. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.js +2 -1
  321. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.js.map +1 -1
  322. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts +2 -3
  323. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts.map +1 -1
  324. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.d.ts +8 -2
  325. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.d.ts.map +1 -1
  326. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.js +6 -1
  327. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.js.map +1 -1
  328. package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +2 -2
  329. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/graphql-api-provider.ts +16 -17
  330. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/index.ts +0 -1
  331. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/index.ts +3 -1
  332. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-provider.ts +2 -3
  333. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-datasource-provider.ts +18 -10
  334. package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
  335. package/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.d.ts +5 -0
  336. package/node_modules/@aws-amplify/platform-core/lib/backend_deployment_type.js +9 -0
  337. package/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.d.ts +9 -0
  338. package/node_modules/@aws-amplify/platform-core/lib/cdk_context_key.js +13 -0
  339. package/node_modules/@aws-amplify/platform-core/lib/index.d.ts +4 -0
  340. package/node_modules/@aws-amplify/platform-core/lib/index.js +22 -0
  341. package/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.d.ts +53 -0
  342. package/node_modules/@aws-amplify/platform-core/lib/unique_backend_identifier.js +74 -0
  343. package/node_modules/@aws-amplify/platform-core/package.json +24 -0
  344. package/node_modules/@aws-amplify/plugin-types/lib/amplify_function.d.ts +4 -0
  345. package/node_modules/@aws-amplify/plugin-types/lib/amplify_function.js +3 -0
  346. package/node_modules/@aws-amplify/plugin-types/lib/amplify_output_writer.d.ts +9 -0
  347. package/node_modules/@aws-amplify/plugin-types/lib/amplify_output_writer.js +3 -0
  348. package/node_modules/@aws-amplify/plugin-types/lib/auth_resources.d.ts +42 -0
  349. package/node_modules/@aws-amplify/plugin-types/lib/auth_resources.js +3 -0
  350. package/node_modules/@aws-amplify/plugin-types/lib/backend_output.d.ts +6 -0
  351. package/node_modules/@aws-amplify/plugin-types/lib/backend_output.js +3 -0
  352. package/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.d.ts +13 -0
  353. package/node_modules/@aws-amplify/plugin-types/lib/backend_secret_resolver.js +3 -0
  354. package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.d.ts +8 -0
  355. package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_creator.js +3 -0
  356. package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.d.ts +7 -0
  357. package/node_modules/@aws-amplify/plugin-types/lib/backend_stack_resolver.js +3 -0
  358. package/node_modules/@aws-amplify/plugin-types/lib/construct_container.d.ts +26 -0
  359. package/node_modules/@aws-amplify/plugin-types/lib/construct_container.js +3 -0
  360. package/node_modules/@aws-amplify/plugin-types/lib/construct_factory.d.ts +21 -0
  361. package/node_modules/@aws-amplify/plugin-types/lib/construct_factory.js +3 -0
  362. package/node_modules/@aws-amplify/plugin-types/lib/function_resources.d.ts +5 -0
  363. package/node_modules/@aws-amplify/plugin-types/lib/function_resources.js +3 -0
  364. package/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.d.ts +14 -0
  365. package/node_modules/@aws-amplify/plugin-types/lib/import_path_verifier.js +3 -0
  366. package/node_modules/@aws-amplify/plugin-types/lib/index.d.ts +16 -0
  367. package/node_modules/@aws-amplify/plugin-types/lib/index.js +32 -0
  368. package/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.d.ts +11 -0
  369. package/node_modules/@aws-amplify/plugin-types/lib/output_retrieval_strategy.js +3 -0
  370. package/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.d.ts +8 -0
  371. package/node_modules/@aws-amplify/plugin-types/lib/output_storage_strategy.js +3 -0
  372. package/node_modules/@aws-amplify/plugin-types/lib/resource_provider.d.ts +7 -0
  373. package/node_modules/@aws-amplify/plugin-types/lib/resource_provider.js +3 -0
  374. package/node_modules/@aws-amplify/plugin-types/lib/unique_backend_identifier.d.ts +25 -0
  375. package/node_modules/@aws-amplify/plugin-types/lib/unique_backend_identifier.js +3 -0
  376. package/node_modules/@aws-amplify/plugin-types/package.json +20 -0
  377. package/node_modules/graphql-mapping-template/CHANGELOG.md +0 -4
  378. package/node_modules/graphql-mapping-template/package.json +2 -3
  379. package/node_modules/graphql-transformer-common/API.md +3 -21
  380. package/node_modules/graphql-transformer-common/CHANGELOG.md +2 -7
  381. package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts +3 -0
  382. package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts.map +1 -1
  383. package/node_modules/graphql-transformer-common/lib/ResourceConstants.js +3 -0
  384. package/node_modules/graphql-transformer-common/lib/ResourceConstants.js.map +1 -1
  385. package/node_modules/graphql-transformer-common/lib/definition.d.ts +2 -9
  386. package/node_modules/graphql-transformer-common/lib/definition.d.ts.map +1 -1
  387. package/node_modules/graphql-transformer-common/lib/definition.js +1 -52
  388. package/node_modules/graphql-transformer-common/lib/definition.js.map +1 -1
  389. package/node_modules/graphql-transformer-common/lib/util.d.ts.map +1 -1
  390. package/node_modules/graphql-transformer-common/lib/util.js +1 -3
  391. package/node_modules/graphql-transformer-common/lib/util.js.map +1 -1
  392. package/node_modules/graphql-transformer-common/package.json +6 -6
  393. package/package.json +25 -27
  394. package/src/amplify-dynamodb-table-wrapper.ts +177 -0
  395. package/src/amplify-graphql-api.ts +14 -76
  396. package/src/amplify-graphql-definition.ts +60 -20
  397. package/src/index.ts +13 -6
  398. package/src/internal/authorization-modes.ts +22 -1
  399. package/src/internal/construct-exports.ts +7 -0
  400. package/src/internal/data-source-config.ts +39 -0
  401. package/src/internal/index.ts +1 -1
  402. package/src/internal/model-type-name.ts +30 -0
  403. package/src/types.ts +59 -118
  404. package/babel.config.js +0 -13
  405. package/lib/internal/amplify-metadata.d.ts +0 -6
  406. package/lib/internal/amplify-metadata.js +0 -58
  407. package/lib/sql-model-datasource-binding.d.ts +0 -20
  408. package/lib/sql-model-datasource-binding.js +0 -42
  409. package/node_modules/@aws-amplify/backend-output-schemas/lib/index.internal.d.ts +0 -3
  410. package/node_modules/@aws-amplify/backend-output-schemas/lib/index.internal.js +0 -27
  411. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.d.ts +0 -20
  412. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.d.ts.map +0 -1
  413. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.js +0 -24
  414. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.js.map +0 -1
  415. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.d.ts.map +0 -1
  416. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.js.map +0 -1
  417. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.d.ts.map +0 -1
  418. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.js.map +0 -1
  419. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/index.d.ts.map +0 -1
  420. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/index.js.map +0 -1
  421. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.d.ts.map +0 -1
  422. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.js.map +0 -1
  423. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.d.ts.map +0 -1
  424. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.js.map +0 -1
  425. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.d.ts.map +0 -1
  426. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.js.map +0 -1
  427. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.d.ts +0 -6
  428. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.d.ts.map +0 -1
  429. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.js.map +0 -1
  430. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.d.ts.map +0 -1
  431. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.js.map +0 -1
  432. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.d.ts +0 -3
  433. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.d.ts.map +0 -1
  434. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.js.map +0 -1
  435. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.d.ts +0 -20
  436. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.d.ts.map +0 -1
  437. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.js +0 -24
  438. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.js.map +0 -1
  439. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.d.ts +0 -13
  440. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.d.ts.map +0 -1
  441. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.js +0 -157
  442. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.js.map +0 -1
  443. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/index.d.ts +0 -5
  444. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/index.d.ts.map +0 -1
  445. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/index.js +0 -21
  446. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/index.js.map +0 -1
  447. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.d.ts +0 -8
  448. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.d.ts.map +0 -1
  449. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.js +0 -56
  450. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.js.map +0 -1
  451. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.d.ts +0 -8
  452. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.d.ts.map +0 -1
  453. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js +0 -41
  454. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js.map +0 -1
  455. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/subscription.d.ts.map +0 -1
  456. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/subscription.js +0 -18
  457. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/subscription.js.map +0 -1
  458. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.d.ts +0 -19
  459. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.d.ts.map +0 -1
  460. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.js +0 -3
  461. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.js.map +0 -1
  462. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-name-mapping.d.ts +0 -10
  463. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-name-mapping.d.ts.map +0 -1
  464. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-name-mapping.js +0 -102
  465. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-name-mapping.js.map +0 -1
  466. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-refers-to-transformer.d.ts +0 -13
  467. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-refers-to-transformer.d.ts.map +0 -1
  468. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-refers-to-transformer.js +0 -81
  469. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-refers-to-transformer.js.map +0 -1
  470. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.d.ts +0 -13
  471. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.d.ts.map +0 -1
  472. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js +0 -171
  473. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js.map +0 -1
  474. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator-factory.d.ts +0 -4
  475. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator-factory.d.ts.map +0 -1
  476. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator-factory.js +0 -18
  477. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator-factory.js.map +0 -1
  478. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.d.ts +0 -8
  479. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.d.ts.map +0 -1
  480. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.js +0 -7
  481. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.js.map +0 -1
  482. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.d.ts +0 -14
  483. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.d.ts.map +0 -1
  484. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.js +0 -115
  485. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.js.map +0 -1
  486. package/node_modules/@aws-amplify/graphql-sql-transformer/API.md +0 -26
  487. package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +0 -10
  488. package/node_modules/@aws-amplify/graphql-sql-transformer/LICENSE +0 -201
  489. package/node_modules/@aws-amplify/graphql-sql-transformer/README.md +0 -13
  490. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.d.ts +0 -12
  491. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.d.ts.map +0 -1
  492. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js +0 -132
  493. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js.map +0 -1
  494. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/index.d.ts +0 -2
  495. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/index.d.ts.map +0 -1
  496. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/index.js +0 -6
  497. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/index.js.map +0 -1
  498. package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +0 -71
  499. package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.d.ts +0 -6
  500. package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.d.ts.map +0 -1
  501. package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.js +0 -3
  502. package/node_modules/@aws-amplify/graphql-transformer-core/lib/config/project-config.js.map +0 -1
  503. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/api-category.d.ts +0 -2
  504. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/api-category.d.ts.map +0 -1
  505. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/api-category.js +0 -5
  506. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/api-category.js.map +0 -1
  507. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.d.ts +0 -3
  508. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.d.ts.map +0 -1
  509. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.js +0 -19
  510. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-util.js.map +0 -1
  511. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.d.ts +0 -14
  512. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.d.ts.map +0 -1
  513. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.js +0 -82
  514. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.js.map +0 -1
  515. package/node_modules/graphql-mapping-template/LICENSE +0 -201
  516. package/remove-module-type-from-package-json.ts +0 -19
  517. package/src/internal/amplify-metadata.ts +0 -58
  518. package/src/sql-model-datasource-binding.ts +0 -45
  519. /package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/index.d.ts +0 -0
  520. /package/node_modules/@aws-amplify/graphql-auth-transformer/lib/{vtl-generator/ddb/resolvers → resolvers}/index.js +0 -0
@@ -0,0 +1,663 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toCreateTableInput = exports.extractTableInputFromEvent = exports.getPointInTimeRecoveryUpdate = exports.getTtlUpdate = exports.getDeletionProtectionUpdate = exports.getSseUpdate = exports.getStreamUpdate = exports.getNextGSIUpdate = exports.isComplete = exports.onEvent = void 0;
4
+ const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
5
+ const ddbClient = new client_dynamodb_1.DynamoDB();
6
+ const finished = {
7
+ IsComplete: true,
8
+ };
9
+ const notFinished = {
10
+ IsComplete: false,
11
+ };
12
+ const log = (msg, ...other) => {
13
+ console.log(msg, other.map((o) => (typeof o === 'object' ? JSON.stringify(o, undefined, 2) : o)));
14
+ };
15
+ const onEvent = async (event) => {
16
+ var _a;
17
+ console.log({ ...event, ResponseURL: '[redacted]' });
18
+ const tableDef = (0, exports.extractTableInputFromEvent)(event);
19
+ console.log('Input table state: ', tableDef);
20
+ let result;
21
+ switch (event.RequestType) {
22
+ case 'Create':
23
+ console.log('Initiating CREATE event');
24
+ const createTableInput = (0, exports.toCreateTableInput)(tableDef);
25
+ console.log('Create Table Params: ', createTableInput);
26
+ const response = await createNewTable(createTableInput);
27
+ result = {
28
+ PhysicalResourceId: response.tableName,
29
+ Data: {
30
+ TableArn: response.tableArn,
31
+ TableStreamArn: response.streamArn,
32
+ TableName: response.tableName,
33
+ },
34
+ };
35
+ console.log('Returning result: ', result);
36
+ return result;
37
+ case 'Update':
38
+ if (!event.PhysicalResourceId) {
39
+ throw new Error(`Could not find the physical ID for the updated resource`);
40
+ }
41
+ console.log('Fetching current table state');
42
+ const describeTableResult = await ddbClient.describeTable({ TableName: event.PhysicalResourceId });
43
+ if (!describeTableResult.Table) {
44
+ throw new Error(`Could not find ${event.PhysicalResourceId} to update`);
45
+ }
46
+ log('Current table state: ', describeTableResult);
47
+ if (isKeySchemaModified(describeTableResult.Table.KeySchema, tableDef.keySchema)) {
48
+ console.log('Update requires replacement');
49
+ console.log('Deleting the old table');
50
+ await ddbClient.deleteTable({ TableName: event.PhysicalResourceId });
51
+ await retry(async () => await doesTableExist(event.PhysicalResourceId), (res) => res === false);
52
+ console.log(`Table '${event.PhysicalResourceId}' does not exist. Deletion is finished.`);
53
+ const createTableInput = (0, exports.toCreateTableInput)(tableDef);
54
+ const response = await createNewTable(createTableInput);
55
+ result = {
56
+ PhysicalResourceId: response.tableName,
57
+ Data: {
58
+ TableArn: response.tableArn,
59
+ TableStreamArn: response.streamArn,
60
+ TableName: response.tableName,
61
+ IsTableReplaced: true,
62
+ },
63
+ };
64
+ log('Returning result', result);
65
+ return result;
66
+ }
67
+ const describePointInTimeRecoveryResult = await ddbClient.describeContinuousBackups({ TableName: event.PhysicalResourceId });
68
+ console.log('Current point in time recovery: ', describePointInTimeRecoveryResult);
69
+ const pointInTimeUpdate = (0, exports.getPointInTimeRecoveryUpdate)(describePointInTimeRecoveryResult.ContinuousBackupsDescription, tableDef);
70
+ if (pointInTimeUpdate) {
71
+ log('Computed point in time recovery update', pointInTimeUpdate);
72
+ await ddbClient.updateContinuousBackups(pointInTimeUpdate);
73
+ await retry(async () => await isTableReady(event.PhysicalResourceId), (res) => res === true);
74
+ console.log(`Table '${event.PhysicalResourceId}' is ready after the update of PointInTimeRecovery.`);
75
+ }
76
+ const deletionProtectionUpdate = (0, exports.getDeletionProtectionUpdate)(describeTableResult.Table, tableDef);
77
+ if (deletionProtectionUpdate) {
78
+ log('Computed deletion protection update', deletionProtectionUpdate);
79
+ await ddbClient.updateTable(deletionProtectionUpdate);
80
+ await retry(async () => await isTableReady(event.PhysicalResourceId), (res) => res === true);
81
+ console.log(`Table '${event.PhysicalResourceId}' is ready after the update of deletion protection.`);
82
+ }
83
+ const sseUpdate = (0, exports.getSseUpdate)(describeTableResult.Table, tableDef);
84
+ if (sseUpdate) {
85
+ log('Computed server side encryption update', sseUpdate);
86
+ await ddbClient.updateTable(sseUpdate);
87
+ await retry(async () => await isTableReady(event.PhysicalResourceId), (res) => res === true);
88
+ console.log(`Table '${event.PhysicalResourceId}' is ready after the update of sever side encryption.`);
89
+ }
90
+ const streamUpdate = await (0, exports.getStreamUpdate)(describeTableResult.Table, tableDef);
91
+ if (streamUpdate) {
92
+ log('Computed stream specification update', streamUpdate);
93
+ await ddbClient.updateTable(streamUpdate);
94
+ await retry(async () => await isTableReady(event.PhysicalResourceId), (res) => res === true);
95
+ console.log(`Table '${event.PhysicalResourceId}' is ready after the update of stream specificaion.`);
96
+ }
97
+ const describeTimeToLiveResult = await ddbClient.describeTimeToLive({ TableName: event.PhysicalResourceId });
98
+ console.log('Current TTL: ', describeTimeToLiveResult);
99
+ const ttlUpdate = (0, exports.getTtlUpdate)(describeTimeToLiveResult.TimeToLiveDescription, tableDef);
100
+ if (ttlUpdate) {
101
+ log('Computed time to live update', ttlUpdate);
102
+ console.log('Initiating TTL update');
103
+ await ddbClient.updateTimeToLive(ttlUpdate);
104
+ result = {
105
+ PhysicalResourceId: event.PhysicalResourceId,
106
+ Data: {
107
+ TableArn: describeTableResult.Table.TableArn,
108
+ TableStreamArn: describeTableResult.Table.LatestStreamArn,
109
+ TableName: describeTableResult.Table.TableName,
110
+ },
111
+ };
112
+ return result;
113
+ }
114
+ const nextGsiUpdate = (0, exports.getNextGSIUpdate)(describeTableResult.Table, tableDef);
115
+ if (nextGsiUpdate) {
116
+ log('Computed next update', nextGsiUpdate);
117
+ console.log('Initiating table GSI update');
118
+ await ddbClient.updateTable(nextGsiUpdate);
119
+ }
120
+ result = {
121
+ PhysicalResourceId: event.PhysicalResourceId,
122
+ Data: {
123
+ TableArn: describeTableResult.Table.TableArn,
124
+ TableStreamArn: describeTableResult.Table.LatestStreamArn,
125
+ TableName: describeTableResult.Table.TableName,
126
+ },
127
+ };
128
+ return result;
129
+ case 'Delete':
130
+ if (!event.PhysicalResourceId) {
131
+ throw new Error(`Could not find the physical ID for the resource`);
132
+ }
133
+ result = {
134
+ PhysicalResourceId: event.PhysicalResourceId,
135
+ };
136
+ console.log('Fetching current table state');
137
+ const describeTableResultBeforeDeletion = await ddbClient.describeTable({ TableName: event.PhysicalResourceId });
138
+ if ((_a = describeTableResultBeforeDeletion.Table) === null || _a === void 0 ? void 0 : _a.DeletionProtectionEnabled) {
139
+ return result;
140
+ }
141
+ try {
142
+ console.log('Initiating table deletion');
143
+ await ddbClient.deleteTable({ TableName: event.PhysicalResourceId });
144
+ return result;
145
+ }
146
+ catch (err) {
147
+ if (err.code === 'ResourceNotFoundException') {
148
+ return result;
149
+ }
150
+ throw err;
151
+ }
152
+ default:
153
+ throw new Error(`Event type ${event.RequestType} is not supported`);
154
+ }
155
+ };
156
+ exports.onEvent = onEvent;
157
+ const isComplete = async (event) => {
158
+ var _a, _b, _c;
159
+ log('got event', { ...event, ResponseURL: '[redacted]' });
160
+ if (event.RequestType === 'Delete') {
161
+ console.log('Delete is finished');
162
+ return finished;
163
+ }
164
+ if (!event.PhysicalResourceId) {
165
+ throw new Error('PhysicalResourceId not set in call to isComplete');
166
+ }
167
+ console.log('Fetching current table state');
168
+ const describeTableResult = await retry(async () => await ddbClient.describeTable({ TableName: event.PhysicalResourceId }), (result) => !!(result === null || result === void 0 ? void 0 : result.Table));
169
+ if (((_a = describeTableResult.Table) === null || _a === void 0 ? void 0 : _a.TableStatus) !== 'ACTIVE') {
170
+ console.log('Table not active yet');
171
+ return notFinished;
172
+ }
173
+ if ((_b = describeTableResult.Table.GlobalSecondaryIndexes) === null || _b === void 0 ? void 0 : _b.some((gsi) => gsi.IndexStatus !== 'ACTIVE' || gsi.Backfilling)) {
174
+ console.log('Some GSI is not active yet');
175
+ return notFinished;
176
+ }
177
+ const endState = (0, exports.extractTableInputFromEvent)(event);
178
+ if (event.RequestType === 'Create' || ((_c = event.Data) === null || _c === void 0 ? void 0 : _c.IsTableReplaced) === true) {
179
+ const describePointInTimeRecoveryResult = await ddbClient.describeContinuousBackups({ TableName: event.PhysicalResourceId });
180
+ const pointInTimeUpdate = (0, exports.getPointInTimeRecoveryUpdate)(describePointInTimeRecoveryResult.ContinuousBackupsDescription, endState);
181
+ if (pointInTimeUpdate) {
182
+ console.log('Updating table with point in time recovery enabled');
183
+ await ddbClient.updateContinuousBackups(pointInTimeUpdate);
184
+ return notFinished;
185
+ }
186
+ const describeTimeToLiveResult = await ddbClient.describeTimeToLive({ TableName: event.PhysicalResourceId });
187
+ const ttlUpdate = (0, exports.getTtlUpdate)(describeTimeToLiveResult.TimeToLiveDescription, endState);
188
+ if (ttlUpdate) {
189
+ console.log('Updating table with TTL enabled');
190
+ await ddbClient.updateTimeToLive(ttlUpdate);
191
+ return notFinished;
192
+ }
193
+ console.log('Create is finished');
194
+ return finished;
195
+ }
196
+ const nextUpdate = (0, exports.getNextGSIUpdate)(describeTableResult.Table, endState);
197
+ log('Computed next update', nextUpdate);
198
+ if (!nextUpdate) {
199
+ console.log('No additional updates needed. Update finished');
200
+ return finished;
201
+ }
202
+ console.log('Initiating table update');
203
+ await ddbClient.updateTable(nextUpdate);
204
+ return notFinished;
205
+ };
206
+ exports.isComplete = isComplete;
207
+ const getNextGSIUpdate = (currentState, endState) => {
208
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
209
+ const endStateGSIs = endState.globalSecondaryIndexes || [];
210
+ const endStateGSINames = endStateGSIs.map((gsi) => gsi.indexName);
211
+ const currentStateGSIs = currentState.GlobalSecondaryIndexes || [];
212
+ const currentStateGSINames = currentStateGSIs.map((gsi) => gsi.IndexName);
213
+ const isTableBillingModeModified = (((_a = currentState.BillingModeSummary) === null || _a === void 0 ? void 0 : _a.BillingMode) !== undefined && ((_b = currentState.BillingModeSummary) === null || _b === void 0 ? void 0 : _b.BillingMode) !== endState.billingMode) ||
214
+ (((_c = currentState.BillingModeSummary) === null || _c === void 0 ? void 0 : _c.BillingMode) == undefined && endState.billingMode === 'PAY_PER_REQUEST');
215
+ const isTableProvisionThroughputModified = (((_d = endState.provisionedThroughput) === null || _d === void 0 ? void 0 : _d.readCapacityUnits) !== undefined &&
216
+ ((_e = currentState.ProvisionedThroughput) === null || _e === void 0 ? void 0 : _e.ReadCapacityUnits) !== ((_f = endState.provisionedThroughput) === null || _f === void 0 ? void 0 : _f.readCapacityUnits)) ||
217
+ (((_g = endState.provisionedThroughput) === null || _g === void 0 ? void 0 : _g.writeCapacityUnits) !== undefined &&
218
+ ((_h = currentState.ProvisionedThroughput) === null || _h === void 0 ? void 0 : _h.WriteCapacityUnits) !== ((_j = endState.provisionedThroughput) === null || _j === void 0 ? void 0 : _j.writeCapacityUnits));
219
+ if (isTableBillingModeModified || isTableProvisionThroughputModified) {
220
+ let updateInput = {
221
+ TableName: currentState.TableName,
222
+ BillingMode: isTableBillingModeModified ? endState.billingMode : undefined,
223
+ ProvisionedThroughput: isTableProvisionThroughputModified && endState.billingMode === 'PROVISIONED'
224
+ ? {
225
+ ReadCapacityUnits: (_k = endState.provisionedThroughput) === null || _k === void 0 ? void 0 : _k.readCapacityUnits,
226
+ WriteCapacityUnits: (_l = endState.provisionedThroughput) === null || _l === void 0 ? void 0 : _l.writeCapacityUnits,
227
+ }
228
+ : undefined,
229
+ };
230
+ if (isTableBillingModeModified && endState.billingMode === 'PROVISIONED') {
231
+ const indexToBeUpdated = currentStateGSIs.map((gsiToUpdate) => {
232
+ var _a, _b;
233
+ return {
234
+ Update: {
235
+ IndexName: gsiToUpdate.IndexName,
236
+ ProvisionedThroughput: {
237
+ ReadCapacityUnits: (_a = endState.provisionedThroughput) === null || _a === void 0 ? void 0 : _a.readCapacityUnits,
238
+ WriteCapacityUnits: (_b = endState.provisionedThroughput) === null || _b === void 0 ? void 0 : _b.writeCapacityUnits,
239
+ },
240
+ },
241
+ };
242
+ });
243
+ updateInput = {
244
+ ...updateInput,
245
+ GlobalSecondaryIndexUpdates: indexToBeUpdated.length > 0 ? indexToBeUpdated : undefined,
246
+ };
247
+ }
248
+ return parsePropertiesToDynamoDBInput(updateInput);
249
+ }
250
+ const gsiRequiresReplacementPredicate = (currentGSI) => {
251
+ if (!endStateGSINames.includes(currentGSI.IndexName))
252
+ return true;
253
+ const respectiveEndStateGSI = endStateGSIs.find((endStateGSI) => endStateGSI.indexName === currentGSI.IndexName);
254
+ if (isProjectionModified(currentGSI.Projection, respectiveEndStateGSI.projection))
255
+ return true;
256
+ if (isKeySchemaModified(currentGSI.KeySchema, respectiveEndStateGSI.keySchema))
257
+ return true;
258
+ return false;
259
+ };
260
+ const gsiToRemove = currentStateGSIs.find(gsiRequiresReplacementPredicate);
261
+ if (gsiToRemove) {
262
+ return {
263
+ TableName: currentState.TableName,
264
+ GlobalSecondaryIndexUpdates: [
265
+ {
266
+ Delete: {
267
+ IndexName: gsiToRemove.IndexName,
268
+ },
269
+ },
270
+ ],
271
+ };
272
+ }
273
+ const gsiRequiresCreationPredicate = (endStateGSI) => !currentStateGSINames.includes(endStateGSI.indexName);
274
+ const gsiToAdd = endStateGSIs.find(gsiRequiresCreationPredicate);
275
+ if (gsiToAdd) {
276
+ const attributeNamesToInclude = gsiToAdd.keySchema.map((schema) => schema.attributeName);
277
+ const gsiToAddAction = {
278
+ IndexName: gsiToAdd.indexName,
279
+ KeySchema: gsiToAdd.keySchema,
280
+ Projection: gsiToAdd.projection,
281
+ ProvisionedThroughput: gsiToAdd.provisionedThroughput,
282
+ };
283
+ return {
284
+ TableName: currentState.TableName,
285
+ AttributeDefinitions: (_m = endState.attributeDefinitions) === null || _m === void 0 ? void 0 : _m.filter((def) => attributeNamesToInclude.includes(def.attributeName)).map((def) => usePascalCaseForObjectKeys(def)),
286
+ GlobalSecondaryIndexUpdates: [
287
+ {
288
+ Create: parsePropertiesToDynamoDBInput(gsiToAddAction),
289
+ },
290
+ ],
291
+ };
292
+ }
293
+ const gsiRequiresUpdatePredicate = (endStateGSI) => {
294
+ var _a, _b, _c, _d;
295
+ if (endState.provisionedThroughput &&
296
+ endState.provisionedThroughput.readCapacityUnits &&
297
+ endState.provisionedThroughput.writeCapacityUnits &&
298
+ currentStateGSINames.includes(endStateGSI.indexName)) {
299
+ const currentStateGSI = currentStateGSIs.find((gsi) => gsi.IndexName === endStateGSI.indexName);
300
+ if (currentStateGSI) {
301
+ if (((_a = currentStateGSI.ProvisionedThroughput) === null || _a === void 0 ? void 0 : _a.ReadCapacityUnits) !== ((_b = endStateGSI.provisionedThroughput) === null || _b === void 0 ? void 0 : _b.readCapacityUnits) ||
302
+ ((_c = currentStateGSI.ProvisionedThroughput) === null || _c === void 0 ? void 0 : _c.WriteCapacityUnits) !== ((_d = endStateGSI.provisionedThroughput) === null || _d === void 0 ? void 0 : _d.writeCapacityUnits)) {
303
+ return true;
304
+ }
305
+ }
306
+ }
307
+ return false;
308
+ };
309
+ const gsiToUpdate = endStateGSIs.find(gsiRequiresUpdatePredicate);
310
+ if (gsiToUpdate) {
311
+ return {
312
+ TableName: currentState.TableName,
313
+ GlobalSecondaryIndexUpdates: [
314
+ {
315
+ Update: {
316
+ IndexName: gsiToUpdate.indexName,
317
+ ProvisionedThroughput: {
318
+ ReadCapacityUnits: (_o = gsiToUpdate.provisionedThroughput) === null || _o === void 0 ? void 0 : _o.readCapacityUnits,
319
+ WriteCapacityUnits: (_p = gsiToUpdate.provisionedThroughput) === null || _p === void 0 ? void 0 : _p.writeCapacityUnits,
320
+ },
321
+ },
322
+ },
323
+ ],
324
+ };
325
+ }
326
+ return undefined;
327
+ };
328
+ exports.getNextGSIUpdate = getNextGSIUpdate;
329
+ const getStreamUpdate = async (currentState, endState) => {
330
+ var _a, _b, _c, _d, _e, _f;
331
+ let streamUpdate;
332
+ if (((_a = endState.streamSpecification) === null || _a === void 0 ? void 0 : _a.streamViewType) !== undefined &&
333
+ (currentState.StreamSpecification === undefined || currentState.StreamSpecification.StreamEnabled === false)) {
334
+ streamUpdate = { StreamEnabled: true, StreamViewType: endState.streamSpecification.streamViewType };
335
+ }
336
+ else if (((_b = endState.streamSpecification) === null || _b === void 0 ? void 0 : _b.streamViewType) === undefined && ((_c = currentState.StreamSpecification) === null || _c === void 0 ? void 0 : _c.StreamEnabled) === true) {
337
+ streamUpdate = { StreamEnabled: false };
338
+ }
339
+ else if (((_d = currentState.StreamSpecification) === null || _d === void 0 ? void 0 : _d.StreamEnabled) === true &&
340
+ ((_e = endState.streamSpecification) === null || _e === void 0 ? void 0 : _e.streamViewType) !== undefined &&
341
+ currentState.StreamSpecification.StreamViewType !== ((_f = endState.streamSpecification) === null || _f === void 0 ? void 0 : _f.streamViewType)) {
342
+ console.log('Detect stream view type is changed. Disabling stream before the type change.');
343
+ await ddbClient.updateTable({
344
+ TableName: currentState.TableName,
345
+ StreamSpecification: { StreamEnabled: false },
346
+ });
347
+ await retry(async () => await isTableReady(currentState.TableName), (res) => res === true);
348
+ streamUpdate = { StreamEnabled: true, StreamViewType: endState.streamSpecification.streamViewType };
349
+ }
350
+ if (streamUpdate) {
351
+ return {
352
+ TableName: currentState.TableName,
353
+ StreamSpecification: streamUpdate,
354
+ };
355
+ }
356
+ return undefined;
357
+ };
358
+ exports.getStreamUpdate = getStreamUpdate;
359
+ const getSseUpdate = (currentState, endState) => {
360
+ var _a, _b, _c;
361
+ let sseUpdate;
362
+ if (currentState.SSEDescription) {
363
+ if (!((_a = endState.sseSpecification) === null || _a === void 0 ? void 0 : _a.sseEnabled)) {
364
+ sseUpdate = {
365
+ Enabled: false,
366
+ };
367
+ }
368
+ else if (((_b = endState.sseSpecification) === null || _b === void 0 ? void 0 : _b.sseEnabled) === true &&
369
+ endState.sseSpecification.sseType !== undefined &&
370
+ endState.sseSpecification.sseType !== currentState.SSEDescription.SSEType) {
371
+ sseUpdate = {
372
+ Enabled: true,
373
+ SSEType: endState.sseSpecification.sseType,
374
+ KMSMasterKeyId: endState.sseSpecification.kmsMasterKeyId,
375
+ };
376
+ }
377
+ }
378
+ else {
379
+ if ((_c = endState.sseSpecification) === null || _c === void 0 ? void 0 : _c.sseEnabled) {
380
+ sseUpdate = {
381
+ Enabled: true,
382
+ SSEType: endState.sseSpecification.sseType,
383
+ KMSMasterKeyId: endState.sseSpecification.kmsMasterKeyId,
384
+ };
385
+ }
386
+ }
387
+ if (sseUpdate) {
388
+ return parsePropertiesToDynamoDBInput({
389
+ TableName: currentState.TableName,
390
+ SSESpecification: sseUpdate,
391
+ });
392
+ }
393
+ return undefined;
394
+ };
395
+ exports.getSseUpdate = getSseUpdate;
396
+ const getDeletionProtectionUpdate = (currentState, endState) => {
397
+ if (endState.deletionProtectionEnabled !== undefined && currentState.DeletionProtectionEnabled !== endState.deletionProtectionEnabled) {
398
+ return {
399
+ TableName: currentState.TableName,
400
+ DeletionProtectionEnabled: endState.deletionProtectionEnabled,
401
+ };
402
+ }
403
+ else if (endState.deletionProtectionEnabled === undefined && currentState.DeletionProtectionEnabled === true) {
404
+ return {
405
+ TableName: currentState.TableName,
406
+ DeletionProtectionEnabled: false,
407
+ };
408
+ }
409
+ return undefined;
410
+ };
411
+ exports.getDeletionProtectionUpdate = getDeletionProtectionUpdate;
412
+ const getTtlUpdate = (currentTTL, endState) => {
413
+ const endTTL = endState.timeToLiveSpecification;
414
+ if (currentTTL && currentTTL.TimeToLiveStatus) {
415
+ if (currentTTL.TimeToLiveStatus === 'ENABLED' && currentTTL.AttributeName) {
416
+ if (!endTTL || !endTTL.enabled) {
417
+ return {
418
+ TableName: endState.tableName,
419
+ TimeToLiveSpecification: {
420
+ Enabled: false,
421
+ AttributeName: currentTTL.AttributeName,
422
+ },
423
+ };
424
+ }
425
+ else if (currentTTL.AttributeName !== endTTL.attributeName) {
426
+ return {
427
+ TableName: endState.tableName,
428
+ TimeToLiveSpecification: {
429
+ Enabled: true,
430
+ AttributeName: endTTL.attributeName,
431
+ },
432
+ };
433
+ }
434
+ }
435
+ else if (currentTTL.TimeToLiveStatus === 'DISABLED' && endTTL && endTTL.enabled) {
436
+ return {
437
+ TableName: endState.tableName,
438
+ TimeToLiveSpecification: {
439
+ Enabled: true,
440
+ AttributeName: endTTL.attributeName,
441
+ },
442
+ };
443
+ }
444
+ }
445
+ return undefined;
446
+ };
447
+ exports.getTtlUpdate = getTtlUpdate;
448
+ const getPointInTimeRecoveryUpdate = (currentPointInTime, endState) => {
449
+ var _a, _b;
450
+ if (!currentPointInTime) {
451
+ return undefined;
452
+ }
453
+ const currentStatus = (_a = currentPointInTime.PointInTimeRecoveryDescription) === null || _a === void 0 ? void 0 : _a.PointInTimeRecoveryStatus;
454
+ const endStatus = (_b = endState.pointInTimeRecoverySpecification) === null || _b === void 0 ? void 0 : _b.pointInTimeRecoveryEnabled;
455
+ if (endStatus === undefined || endStatus === false) {
456
+ if (currentStatus === 'ENABLED') {
457
+ return {
458
+ TableName: endState.tableName,
459
+ PointInTimeRecoverySpecification: {
460
+ PointInTimeRecoveryEnabled: false,
461
+ },
462
+ };
463
+ }
464
+ }
465
+ else {
466
+ if (currentStatus === 'DISABLED') {
467
+ return {
468
+ TableName: endState.tableName,
469
+ PointInTimeRecoverySpecification: {
470
+ PointInTimeRecoveryEnabled: true,
471
+ },
472
+ };
473
+ }
474
+ }
475
+ return undefined;
476
+ };
477
+ exports.getPointInTimeRecoveryUpdate = getPointInTimeRecoveryUpdate;
478
+ const extractTableInputFromEvent = (event) => {
479
+ const resourceProperties = { ...event.ResourceProperties };
480
+ delete resourceProperties.ServiceToken;
481
+ const tableDef = convertStringToBooleanOrNumber(resourceProperties);
482
+ return tableDef;
483
+ };
484
+ exports.extractTableInputFromEvent = extractTableInputFromEvent;
485
+ const parsePropertiesToDynamoDBInput = (obj) => {
486
+ return usePascalCaseForObjectKeys(removeUndefinedAttributes(obj));
487
+ };
488
+ const usePascalCaseForObjectKeys = (obj) => {
489
+ const result = {};
490
+ for (const key in obj) {
491
+ if (obj.hasOwnProperty(key) && key !== '') {
492
+ const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
493
+ const value = obj[key];
494
+ if (Array.isArray(value)) {
495
+ result[capitalizedKey] = value.map((v) => usePascalCaseForObjectKeys(v));
496
+ }
497
+ else if (typeof value === 'object' && value !== null) {
498
+ result[capitalizedKey] = usePascalCaseForObjectKeys(value);
499
+ }
500
+ else {
501
+ result[capitalizedKey] = value;
502
+ }
503
+ }
504
+ }
505
+ return result;
506
+ };
507
+ const convertStringToBooleanOrNumber = (obj) => {
508
+ const fieldsToBeConvertedToBoolean = ['deletionProtectionEnabled', 'enabled', 'sseEnabled', 'pointInTimeRecoveryEnabled'];
509
+ const fieldsToBeConvertedToNumber = ['readCapacityUnits', 'writeCapacityUnits'];
510
+ for (const key in obj) {
511
+ if (Array.isArray(obj[key])) {
512
+ obj[key] = obj[key].map((o) => convertStringToBooleanOrNumber(o));
513
+ }
514
+ else if (typeof obj[key] === 'object') {
515
+ obj[key] = convertStringToBooleanOrNumber(obj[key]);
516
+ }
517
+ else if (typeof obj[key] === 'string') {
518
+ if ((obj[key] === 'true' || obj[key] === 'false') && fieldsToBeConvertedToBoolean.includes(key)) {
519
+ obj[key] = obj[key] === 'true';
520
+ }
521
+ else if (!isNaN(Number(obj[key])) && fieldsToBeConvertedToNumber.includes(key)) {
522
+ obj[key] = Number(obj[key]);
523
+ }
524
+ }
525
+ }
526
+ return obj;
527
+ };
528
+ const removeUndefinedAttributes = (obj) => {
529
+ for (const key in obj) {
530
+ if (Array.isArray(obj[key])) {
531
+ obj[key].map((o) => removeUndefinedAttributes(o));
532
+ }
533
+ else if (typeof obj[key] === 'object') {
534
+ removeUndefinedAttributes(obj[key]);
535
+ }
536
+ else if (obj[key] === undefined) {
537
+ delete obj[key];
538
+ }
539
+ }
540
+ return obj;
541
+ };
542
+ const toCreateTableInput = (props) => {
543
+ const createTableInput = {
544
+ TableName: props.tableName,
545
+ AttributeDefinitions: props.attributeDefinitions,
546
+ KeySchema: props.keySchema,
547
+ GlobalSecondaryIndexes: props.globalSecondaryIndexes,
548
+ BillingMode: props.billingMode,
549
+ StreamSpecification: props.streamSpecification
550
+ ? {
551
+ StreamEnabled: true,
552
+ StreamViewType: props.streamSpecification.streamViewType,
553
+ }
554
+ : undefined,
555
+ ProvisionedThroughput: props.provisionedThroughput,
556
+ SSESpecification: props.sseSpecification ? { Enabled: props.sseSpecification.sseEnabled } : undefined,
557
+ };
558
+ return parsePropertiesToDynamoDBInput(createTableInput);
559
+ };
560
+ exports.toCreateTableInput = toCreateTableInput;
561
+ const createNewTable = async (input) => {
562
+ var _a;
563
+ const tableName = input.TableName;
564
+ const createTableInput = input;
565
+ const result = await ddbClient.createTable(createTableInput);
566
+ return { tableName: tableName, tableArn: result.TableDescription.TableArn, streamArn: (_a = result.TableDescription) === null || _a === void 0 ? void 0 : _a.LatestStreamArn };
567
+ };
568
+ const doesTableExist = async (tableName) => {
569
+ try {
570
+ await ddbClient.describeTable({ TableName: tableName });
571
+ return true;
572
+ }
573
+ catch (error) {
574
+ if (error.code === 'ResourceNotFoundException') {
575
+ return false;
576
+ }
577
+ throw error;
578
+ }
579
+ };
580
+ const isTableReady = async (tableName) => {
581
+ var _a, _b;
582
+ const result = await ddbClient.describeTable({ TableName: tableName });
583
+ if (((_a = result.Table) === null || _a === void 0 ? void 0 : _a.TableStatus) !== 'ACTIVE') {
584
+ console.log('Table not active yet');
585
+ return false;
586
+ }
587
+ if ((_b = result.Table.GlobalSecondaryIndexes) === null || _b === void 0 ? void 0 : _b.some((gsi) => gsi.IndexStatus !== 'ACTIVE' || gsi.Backfilling)) {
588
+ console.log('Some GSI is not active yet');
589
+ return false;
590
+ }
591
+ return true;
592
+ };
593
+ const isProjectionModified = (currentProjection, endProjection) => {
594
+ if (currentProjection.ProjectionType !== endProjection.projectionType)
595
+ return true;
596
+ if (currentProjection.ProjectionType === 'ALL')
597
+ return false;
598
+ const currentNonKeyAttributes = currentProjection.NonKeyAttributes || [];
599
+ const endNonKeyAttributes = endProjection.nonKeyAttributes || [];
600
+ if (currentNonKeyAttributes.length !== endNonKeyAttributes.length)
601
+ return true;
602
+ if (currentNonKeyAttributes.some((currentNonKeyAttribute) => !endNonKeyAttributes.includes(currentNonKeyAttribute)))
603
+ return true;
604
+ return false;
605
+ };
606
+ const isKeySchemaModified = (currentSchema, endSchema) => {
607
+ const currentHashKey = currentSchema.find((schema) => schema.KeyType === 'HASH');
608
+ const endHashKey = endSchema.find((schema) => schema.keyType === 'HASH');
609
+ if ((currentHashKey === null || currentHashKey === void 0 ? void 0 : currentHashKey.AttributeName) !== (endHashKey === null || endHashKey === void 0 ? void 0 : endHashKey.attributeName))
610
+ return true;
611
+ const currentSortKey = currentSchema.find((schema) => schema.KeyType === 'RANGE');
612
+ const endSortKey = endSchema.find((schema) => schema.keyType === 'RANGE');
613
+ if (currentSortKey === undefined && endSortKey === undefined)
614
+ return false;
615
+ if ((currentSortKey === undefined && endSortKey !== undefined) || (currentSortKey !== undefined && endSortKey === undefined))
616
+ return true;
617
+ if ((currentSortKey === null || currentSortKey === void 0 ? void 0 : currentSortKey.AttributeName) !== (endSortKey === null || endSortKey === void 0 ? void 0 : endSortKey.attributeName))
618
+ return true;
619
+ return false;
620
+ };
621
+ const defaultSettings = {
622
+ times: Infinity,
623
+ delayMS: 1000 * 15,
624
+ timeoutMS: 1000 * 60 * 14,
625
+ stopOnError: false,
626
+ };
627
+ const retry = async (func, successPredicate, settings, failurePredicate) => {
628
+ const { times, delayMS, timeoutMS, stopOnError } = {
629
+ ...defaultSettings,
630
+ ...settings,
631
+ };
632
+ let count = 0;
633
+ let result;
634
+ let terminate = false;
635
+ const startTime = Date.now();
636
+ do {
637
+ try {
638
+ result = await func();
639
+ if (successPredicate(result)) {
640
+ return result;
641
+ }
642
+ if (typeof failurePredicate === 'function' && failurePredicate(result)) {
643
+ throw new Error('Retry-able function execution result matched failure predicate. Stopping retries.');
644
+ }
645
+ console.warn(`Retry-able function execution did not match success predicate. Result was [${JSON.stringify(result)}]. Retrying...`);
646
+ }
647
+ catch (err) {
648
+ console.warn(`Retry-able function execution failed with [${err.message || err}]`);
649
+ if (stopOnError) {
650
+ console.log('Stopping retries on error.');
651
+ }
652
+ else {
653
+ console.log('Retrying...');
654
+ }
655
+ terminate = stopOnError;
656
+ }
657
+ count++;
658
+ await sleep(delayMS);
659
+ } while (!terminate && count <= times && Date.now() - startTime < timeoutMS);
660
+ throw new Error('Retry-able function did not match predicate within the given retry constraints');
661
+ };
662
+ const sleep = async (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
663
+ //# sourceMappingURL=amplify-table-manager-handler.js.map