@aws-amplify/graphql-api-construct 1.4.2 → 1.5.0

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 (251) hide show
  1. package/.jsii +367 -278
  2. package/API.md +14 -3
  3. package/CHANGELOG.md +18 -0
  4. package/README.md +210 -20
  5. package/lib/amplify-dynamodb-table-wrapper.js +1 -1
  6. package/lib/amplify-graphql-api.d.ts +0 -7
  7. package/lib/amplify-graphql-api.js +18 -65
  8. package/lib/amplify-graphql-definition.d.ts +4 -15
  9. package/lib/amplify-graphql-definition.js +33 -30
  10. package/lib/index.d.ts +2 -1
  11. package/lib/index.js +16 -1
  12. package/lib/internal/data-source-config.d.ts +22 -9
  13. package/lib/internal/data-source-config.js +150 -39
  14. package/lib/internal/model-type-name.d.ts +3 -3
  15. package/lib/internal/model-type-name.js +7 -7
  16. package/lib/model-datasource-strategy-types.d.ts +122 -0
  17. package/lib/model-datasource-strategy-types.js +10 -0
  18. package/lib/sql-model-datasource-strategy.d.ts +1 -1
  19. package/lib/sql-model-datasource-strategy.js +4 -4
  20. package/lib/types.d.ts +12 -119
  21. package/lib/types.js +1 -1
  22. package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +10 -0
  23. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts.map +1 -1
  24. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js +6 -10
  25. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js.map +1 -1
  26. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js +1 -1
  27. package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +16 -12
  28. package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +10 -0
  29. package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.d.ts.map +1 -1
  30. package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.js +2 -7
  31. package/node_modules/@aws-amplify/graphql-default-value-transformer/lib/graphql-default-value-transformer.js.map +1 -1
  32. package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +13 -9
  33. package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +10 -0
  34. package/node_modules/@aws-amplify/graphql-function-transformer/lib/graphql-function-transformer.d.ts.map +1 -1
  35. package/node_modules/@aws-amplify/graphql-function-transformer/lib/graphql-function-transformer.js +7 -0
  36. package/node_modules/@aws-amplify/graphql-function-transformer/lib/graphql-function-transformer.js.map +1 -1
  37. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +11 -7
  38. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +8 -0
  39. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +11 -7
  40. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +10 -0
  41. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.d.ts.map +1 -1
  42. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.js +4 -4
  43. package/node_modules/@aws-amplify/graphql-index-transformer/lib/graphql-primary-key-transformer.js.map +1 -1
  44. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts +3 -5
  45. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts.map +1 -1
  46. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js +12 -34
  47. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js.map +1 -1
  48. package/node_modules/@aws-amplify/graphql-index-transformer/package.json +13 -9
  49. package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +10 -0
  50. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
  51. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-maps-to-transformer.d.ts.map +1 -1
  52. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-maps-to-transformer.js +3 -4
  53. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-maps-to-transformer.js.map +1 -1
  54. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-refers-to-transformer.d.ts.map +1 -1
  55. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-refers-to-transformer.js +3 -3
  56. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/graphql-refers-to-transformer.js.map +1 -1
  57. package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +16 -12
  58. package/node_modules/@aws-amplify/graphql-model-transformer/API.md +16 -0
  59. package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +13 -0
  60. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts +1 -3
  61. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts.map +1 -1
  62. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js +61 -68
  63. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js.map +1 -1
  64. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.d.ts +1 -0
  65. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.d.ts.map +1 -1
  66. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.js +3 -1
  67. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.js.map +1 -1
  68. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
  69. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
  70. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
  71. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts +8 -8
  72. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts.map +1 -1
  73. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js +32 -36
  74. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js.map +1 -1
  75. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts +3 -2
  76. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts.map +1 -1
  77. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js +70 -34
  78. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js.map +1 -1
  79. package/node_modules/@aws-amplify/graphql-model-transformer/package.json +15 -10
  80. package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +8 -0
  81. package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
  82. package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +11 -7
  83. package/node_modules/@aws-amplify/graphql-relational-transformer/API.md +2 -2
  84. package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +12 -0
  85. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.d.ts.map +1 -1
  86. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js +14 -7
  87. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js.map +1 -1
  88. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.d.ts.map +1 -1
  89. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js +6 -6
  90. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js.map +1 -1
  91. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js +6 -6
  92. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js.map +1 -1
  93. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.d.ts.map +1 -1
  94. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js +8 -1
  95. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js.map +1 -1
  96. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.d.ts.map +1 -1
  97. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js +5 -3
  98. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js.map +1 -1
  99. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator-factory.d.ts +2 -2
  100. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator-factory.d.ts.map +1 -1
  101. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator-factory.js.map +1 -1
  102. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.d.ts.map +1 -1
  103. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.js +18 -6
  104. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.js.map +1 -1
  105. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts +18 -18
  106. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts.map +1 -1
  107. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js +54 -54
  108. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js.map +1 -1
  109. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +14 -10
  110. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +10 -0
  111. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js +1 -1
  112. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  113. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +12 -8
  114. package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +12 -0
  115. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.d.ts.map +1 -1
  116. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js +32 -12
  117. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js.map +1 -1
  118. package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +12 -8
  119. package/node_modules/@aws-amplify/graphql-transformer/API.md +4 -16
  120. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +10 -0
  121. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts +4 -13
  122. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts.map +1 -1
  123. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js +8 -14
  124. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js.map +1 -1
  125. package/node_modules/@aws-amplify/graphql-transformer/package.json +20 -16
  126. package/node_modules/@aws-amplify/graphql-transformer/src/graphql-transformer.ts +30 -54
  127. package/node_modules/@aws-amplify/graphql-transformer-core/API.md +128 -31
  128. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +13 -0
  129. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +3 -3
  130. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts.map +1 -1
  131. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js +34 -16
  132. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
  133. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.d.ts +1 -1
  134. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.d.ts.map +1 -1
  135. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.js +4 -2
  136. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/index.js.map +1 -1
  137. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.d.ts +6 -12
  138. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.d.ts.map +1 -1
  139. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js +16 -5
  140. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js.map +1 -1
  141. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts +0 -8
  142. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts.map +1 -1
  143. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.d.ts +12 -10
  144. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.d.ts.map +1 -1
  145. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.js +94 -39
  146. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/utils.js.map +1 -1
  147. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts +18 -12
  148. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts.map +1 -1
  149. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.js +13 -15
  150. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.js.map +1 -1
  151. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.d.ts +1 -4
  152. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.d.ts.map +1 -1
  153. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.js +1 -4
  154. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/import-appsync-api-types.js.map +1 -1
  155. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.d.ts +2 -1
  156. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.d.ts.map +1 -1
  157. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.js +16 -4
  158. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/index.js.map +1 -1
  159. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/model-datasource-strategies.d.ts +7 -0
  160. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/model-datasource-strategies.d.ts.map +1 -0
  161. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/model-datasource-strategies.js +15 -0
  162. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/model-datasource-strategies.js.map +1 -0
  163. package/node_modules/@aws-amplify/graphql-transformer-core/lib/types/types.d.ts.map +1 -1
  164. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.d.ts +28 -0
  165. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.d.ts.map +1 -0
  166. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.js +39 -0
  167. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.js.map +1 -0
  168. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts +5 -4
  169. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts.map +1 -1
  170. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js +21 -12
  171. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js.map +1 -1
  172. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.d.ts +14 -0
  173. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.d.ts.map +1 -0
  174. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.js +96 -0
  175. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.js.map +1 -0
  176. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.d.ts +0 -10
  177. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.d.ts.map +1 -1
  178. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.js +1 -58
  179. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/rds-util.js.map +1 -1
  180. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/resource-name.d.ts +22 -0
  181. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/resource-name.d.ts.map +1 -1
  182. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/resource-name.js +28 -1
  183. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/resource-name.js.map +1 -1
  184. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.d.ts +2 -2
  185. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.d.ts.map +1 -1
  186. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.js +7 -6
  187. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/schema-utils.js.map +1 -1
  188. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +9 -5
  189. package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +88 -40
  190. package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +10 -0
  191. package/node_modules/@aws-amplify/graphql-transformer-interfaces/LICENSE +201 -0
  192. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts +0 -17
  193. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts.map +1 -1
  194. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.js.map +1 -1
  195. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts +2 -1
  196. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts.map +1 -1
  197. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.js +1 -0
  198. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.js.map +1 -1
  199. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.d.ts +2 -0
  200. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.d.ts.map +1 -0
  201. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.js +18 -0
  202. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.js.map +1 -0
  203. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts +59 -0
  204. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts.map +1 -0
  205. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js +3 -0
  206. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js.map +1 -0
  207. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transform-host-provider.d.ts +2 -1
  208. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transform-host-provider.d.ts.map +1 -1
  209. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts +2 -2
  210. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts.map +1 -1
  211. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.js +1 -3
  212. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.js.map +1 -1
  213. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts +12 -17
  214. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts.map +1 -1
  215. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.d.ts +0 -15
  216. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.d.ts.map +1 -1
  217. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.js +1 -10
  218. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-datasource-provider.js.map +1 -1
  219. package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +8 -3
  220. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/graphql-api-provider.ts +1 -41
  221. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/index.ts +1 -4
  222. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/model-datasource/index.ts +1 -0
  223. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/model-datasource/types.ts +195 -0
  224. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transform-host-provider.ts +1 -1
  225. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/index.ts +4 -9
  226. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-provider.ts +15 -23
  227. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-datasource-provider.ts +0 -43
  228. package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
  229. package/node_modules/graphql-mapping-template/CHANGELOG.md +4 -0
  230. package/node_modules/graphql-mapping-template/LICENSE +201 -0
  231. package/node_modules/graphql-mapping-template/package.json +8 -3
  232. package/node_modules/graphql-transformer-common/API.md +0 -15
  233. package/node_modules/graphql-transformer-common/CHANGELOG.md +6 -0
  234. package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts +0 -15
  235. package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts.map +1 -1
  236. package/node_modules/graphql-transformer-common/lib/ResourceConstants.js +0 -15
  237. package/node_modules/graphql-transformer-common/lib/ResourceConstants.js.map +1 -1
  238. package/node_modules/graphql-transformer-common/package.json +7 -3
  239. package/package.json +24 -19
  240. package/src/amplify-graphql-api.ts +19 -76
  241. package/src/amplify-graphql-definition.ts +47 -30
  242. package/src/index.ts +2 -10
  243. package/src/internal/data-source-config.ts +195 -47
  244. package/src/internal/model-type-name.ts +5 -4
  245. package/src/model-datasource-strategy-types.ts +157 -0
  246. package/src/sql-model-datasource-strategy.ts +3 -3
  247. package/src/types.ts +13 -144
  248. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.d.ts +0 -3
  249. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.d.ts.map +0 -1
  250. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.js +0 -15
  251. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/provision-strategy-utils.js.map +0 -1
package/src/types.ts CHANGED
@@ -18,6 +18,7 @@ import { IUserPool } from 'aws-cdk-lib/aws-cognito';
18
18
  import { IFunction, CfnFunction } from 'aws-cdk-lib/aws-lambda';
19
19
  import { IBucket } from 'aws-cdk-lib/aws-s3';
20
20
  import { AmplifyDynamoDbTableWrapper } from './amplify-dynamodb-table-wrapper';
21
+ import { CustomSqlDataSourceStrategy, ModelDataSourceStrategy } from './model-datasource-strategy-types';
21
22
 
22
23
  /**
23
24
  * Configuration for IAM Authorization on the Graphql Api.
@@ -425,8 +426,9 @@ export interface TranslationBehavior {
425
426
 
426
427
  /**
427
428
  * This behavior will only come into effect when both "allowDestructiveGraphqlSchemaUpdates" and this value are set to true
428
- * When enabled, any GSI update operation will replace the table instead of iterative deployment, which will WIPE ALL EXISTING DATA but cost much less time for deployment
429
- * This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
429
+ *
430
+ * When enabled, any GSI update operation will replace the table instead of iterative deployment, which will WIPE ALL EXISTING DATA but
431
+ * cost much less time for deployment This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
430
432
  * @default false
431
433
  * @experimental
432
434
  */
@@ -526,8 +528,9 @@ export interface PartialTranslationBehavior {
526
528
 
527
529
  /**
528
530
  * This behavior will only come into effect when both "allowDestructiveGraphqlSchemaUpdates" and this value are set to true
529
- * When enabled, any global secondary index update operation will replace the table instead of iterative deployment, which will WIPE ALL EXISTING DATA but cost much less time for deployment
530
- * This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
531
+ *
532
+ * When enabled, any global secondary index update operation will replace the table instead of iterative deployment, which will WIPE ALL
533
+ * EXISTING DATA but cost much less time for deployment This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
531
534
  * @default false
532
535
  * @experimental
533
536
  */
@@ -560,13 +563,15 @@ export interface IAmplifyGraphqlDefinition {
560
563
 
561
564
  /**
562
565
  * Retrieve the datasource strategy mapping. The default strategy is to use DynamoDB from CloudFormation.
563
- *
564
- * **NOTE** Explicitly specifying the 'dataSourceStrategies' configuration option is in preview and is not recommended to use with
565
- * production systems. For production, use the static factory methods `fromString` or `fromFiles`.
566
- * @experimental
567
566
  * @returns datasource strategy mapping
568
567
  */
569
568
  readonly dataSourceStrategies: Record<string, ModelDataSourceStrategy>;
569
+
570
+ /**
571
+ * An array of custom Query or Mutation SQL commands to the data sources that resolves them.
572
+ * @returns a list of mappings from custom SQL commands to data sources
573
+ */
574
+ readonly customSqlDataSourceStrategies?: CustomSqlDataSourceStrategy[];
570
575
  }
571
576
 
572
577
  /**
@@ -820,139 +825,3 @@ export interface AddFunctionProps {
820
825
  */
821
826
  readonly code?: Code;
822
827
  }
823
-
824
- /**
825
- * All known ModelDataSourceStrategies. Concrete strategies vary widely in their requirements and implementations.
826
- * @experimental
827
- */
828
- export type ModelDataSourceStrategy =
829
- | DefaultDynamoDbModelDataSourceStrategy
830
- | AmplifyDynamoDbModelDataSourceStrategy
831
- | SQLLambdaModelDataSourceStrategy;
832
-
833
- // TODO: Make this the source of truth for database type definitions used throughout the construct & transformer
834
- export type ModelDataSourceStrategyDbType = 'DYNAMODB';
835
-
836
- /**
837
- * Use default CloudFormation type 'AWS::DynamoDB::Table' to provision table.
838
- * @experimental
839
- */
840
- export interface DefaultDynamoDbModelDataSourceStrategy {
841
- readonly dbType: 'DYNAMODB';
842
- readonly provisionStrategy: 'DEFAULT';
843
- }
844
-
845
- /**
846
- * Use custom resource type 'Custom::AmplifyDynamoDBTable' to provision table.
847
- * @experimental
848
- */
849
- export interface AmplifyDynamoDbModelDataSourceStrategy {
850
- readonly dbType: 'DYNAMODB';
851
- readonly provisionStrategy: 'AMPLIFY_TABLE';
852
- }
853
-
854
- /**
855
- * A strategy that creates a Lambda to connect to a pre-existing SQL table to resolve model data.
856
- *
857
- * @experimental
858
- */
859
- export interface SQLLambdaModelDataSourceStrategy {
860
- /**
861
- * The name of the strategy. This will be used to name the AppSync DataSource itself, plus any associated resources like resolver Lambdas.
862
- * This name must be unique across all schema definitions in a GraphQL API.
863
- */
864
- readonly name: string;
865
-
866
- /**
867
- * The type of the SQL database used to process model operations for this definition.
868
- */
869
- readonly dbType: 'MYSQL' | 'POSTGRES';
870
-
871
- /**
872
- * The parameters the Lambda data source will use to connect to the database.
873
- */
874
- readonly dbConnectionConfig: SqlModelDataSourceDbConnectionConfig;
875
-
876
- /**
877
- * The configuration of the VPC into which to install the Lambda.
878
- */
879
- readonly vpcConfiguration?: VpcConfig;
880
-
881
- /**
882
- * Custom SQL statements. The key is the value of the `references` attribute of the `@sql` directive in the `schema`; the value is the SQL
883
- * to be executed.
884
- */
885
- readonly customSqlStatements?: Record<string, string>;
886
-
887
- /**
888
- * The configuration for the provisioned concurrency of the Lambda.
889
- */
890
- readonly sqlLambdaProvisionedConcurrencyConfig?: ProvisionedConcurrencyConfig;
891
- }
892
-
893
- /**
894
- * Configuration of the VPC in which to install a Lambda to resolve queries against a SQL-based data source. The SQL Lambda will be deployed
895
- * into the specified VPC, subnets, and security groups. The specified subnets and security groups must be in the same VPC. The VPC must
896
- * have at least one subnet. The construct will also create VPC service endpoints in the specified subnets, as well as inbound security
897
- * rules, to allow traffic on port 443 within each security group. This allows the Lambda to read database connection information from
898
- * Secure Systems Manager.
899
- * @experimental
900
- */
901
- export interface VpcConfig {
902
- /** The VPC to install the Lambda data source in. */
903
- readonly vpcId: string;
904
-
905
- /** The security groups to install the Lambda data source in. */
906
- readonly securityGroupIds: string[];
907
-
908
- /** The subnets to install the Lambda data source in, one per availability zone. */
909
- readonly subnetAvailabilityZoneConfig: SubnetAvailabilityZone[];
910
- }
911
-
912
- /**
913
- * The configuration for the provisioned concurrency of the Lambda.
914
- * @experimental
915
- */
916
- export interface ProvisionedConcurrencyConfig {
917
- /** The amount of provisioned concurrency to allocate. **/
918
- readonly provisionedConcurrentExecutions: number;
919
- }
920
-
921
- /**
922
- * Subnet configuration for VPC endpoints used by a Lambda resolver for a SQL-based data source. Although it is possible to create multiple
923
- * subnets in a single availability zone, VPC service endpoints may only be deployed to a single subnet in a given availability zone. This
924
- * structure ensures that the Lambda function and VPC service endpoints are mutually consistent.
925
- * @experimental
926
- */
927
- export interface SubnetAvailabilityZone {
928
- /** The subnet ID to install the Lambda data source in. */
929
- readonly subnetId: string;
930
-
931
- /** The availability zone of the subnet. */
932
- readonly availabilityZone: string;
933
- }
934
-
935
- /**
936
- * The Secure Systems Manager parameter paths the Lambda data source will use to connect to the database.
937
- *
938
- * These parameters are retrieved from Secure Systems Manager in the same region as the Lambda.
939
- * @experimental
940
- */
941
- export interface SqlModelDataSourceDbConnectionConfig {
942
- /** The Secure Systems Manager parameter containing the hostname of the database. For RDS-based SQL data sources, this can be the hostname
943
- * of a database proxy, cluster, or instance.
944
- */
945
- readonly hostnameSsmPath: string;
946
-
947
- /** The Secure Systems Manager parameter containing the port number of the database proxy, cluster, or instance. */
948
- readonly portSsmPath: string;
949
-
950
- /** The Secure Systems Manager parameter containing the username to use when connecting to the database. */
951
- readonly usernameSsmPath: string;
952
-
953
- /** The Secure Systems Manager parameter containing the password to use when connecting to the database. */
954
- readonly passwordSsmPath: string;
955
-
956
- /** The Secure Systems Manager parameter containing the database name. */
957
- readonly databaseNameSsmPath: string;
958
- }
@@ -1,3 +0,0 @@
1
- import { DataSourceProvisionStrategy, TransformerBeforeStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
2
- export declare function getDatasourceProvisionStrategy(ctx: TransformerBeforeStepContextProvider, typeName?: string): DataSourceProvisionStrategy;
3
- //# sourceMappingURL=provision-strategy-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provision-strategy-utils.d.ts","sourceRoot":"","sources":["../../src/utils/provision-strategy-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAE3B,oCAAoC,EACrC,MAAM,6CAA6C,CAAC;AAQrD,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,oCAAoC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,2BAA2B,CAUxI"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDatasourceProvisionStrategy = void 0;
4
- function getDatasourceProvisionStrategy(ctx, typeName) {
5
- let config = "DEFAULT";
6
- if (typeName) {
7
- const typeConfig = ctx.modelToDatasourceMap.get(typeName);
8
- if (typeConfig && typeConfig.dbType && typeConfig.provisionStrategy) {
9
- config = typeConfig.provisionStrategy;
10
- }
11
- }
12
- return config;
13
- }
14
- exports.getDatasourceProvisionStrategy = getDatasourceProvisionStrategy;
15
- //# sourceMappingURL=provision-strategy-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provision-strategy-utils.js","sourceRoot":"","sources":["../../src/utils/provision-strategy-utils.ts"],"names":[],"mappings":";;;AAYA,SAAgB,8BAA8B,CAAC,GAAyC,EAAE,QAAiB;IACzG,IAAI,MAAM,YAAiE,CAAC;IAE5E,IAAI,QAAQ,EAAE;QACZ,MAAM,UAAU,GAAG,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1D,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,iBAAiB,EAAE;YACnE,MAAM,GAAG,UAAU,CAAC,iBAAiB,CAAC;SACvC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,wEAUC"}