@aws-amplify/graphql-api-construct 1.8.0-sql-gen2.0 → 1.8.0-sql-gen2-1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. package/.jsii +313 -200
  2. package/API.md +16 -3
  3. package/CHANGELOG.md +4 -2
  4. package/lib/amplify-dynamodb-table-wrapper.js +1 -1
  5. package/lib/amplify-graphql-api.js +3 -2
  6. package/lib/amplify-graphql-definition.js +1 -1
  7. package/lib/index.d.ts +1 -1
  8. package/lib/index.js +1 -1
  9. package/lib/internal/authorization-modes.d.ts +12 -1
  10. package/lib/internal/authorization-modes.js +47 -7
  11. package/lib/internal/codegen-assets.js +10 -1
  12. package/lib/sql-model-datasource-strategy.js +1 -1
  13. package/lib/types.d.ts +51 -5
  14. package/lib/types.js +1 -1
  15. package/node_modules/@aws-amplify/graphql-auth-transformer/API.md +3 -1
  16. package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +5 -2
  17. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.d.ts.map +1 -1
  18. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js +30 -19
  19. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/graphql-auth-transformer.js.map +1 -1
  20. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/constants.d.ts.map +1 -1
  21. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/constants.js +1 -0
  22. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/constants.js.map +1 -1
  23. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.d.ts +2 -1
  24. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.d.ts.map +1 -1
  25. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/definitions.js.map +1 -1
  26. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.d.ts +2 -1
  27. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.d.ts.map +1 -1
  28. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js +22 -11
  29. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/index.js.map +1 -1
  30. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.d.ts.map +1 -1
  31. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js +11 -4
  32. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js.map +1 -1
  33. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/warnings.d.ts +1 -0
  34. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/warnings.d.ts.map +1 -1
  35. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/warnings.js +10 -1
  36. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/warnings.js.map +1 -1
  37. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/common.d.ts +4 -0
  38. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/common.d.ts.map +1 -0
  39. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/common.js +12 -0
  40. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/common.js.map +1 -0
  41. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.d.ts +1 -1
  42. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.d.ts.map +1 -1
  43. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.js +1 -1
  44. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/ddb-vtl-generator.js.map +1 -1
  45. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.d.ts +1 -1
  46. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.d.ts.map +1 -1
  47. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.js +20 -10
  48. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/field.js.map +1 -1
  49. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.d.ts +9 -2
  50. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.d.ts.map +1 -1
  51. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.js +16 -9
  52. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/helpers.js.map +1 -1
  53. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/index.d.ts +1 -1
  54. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/index.d.ts.map +1 -1
  55. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/index.js +2 -2
  56. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/index.js.map +1 -1
  57. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.d.ts.map +1 -1
  58. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.js +5 -4
  59. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.create.js.map +1 -1
  60. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.d.ts.map +1 -1
  61. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.js +5 -4
  62. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.delete.js.map +1 -1
  63. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.d.ts.map +1 -1
  64. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.js +5 -4
  65. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/mutation.update.js.map +1 -1
  66. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.d.ts.map +1 -1
  67. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.js +15 -4
  68. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/query.js.map +1 -1
  69. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.d.ts.map +1 -1
  70. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.js +5 -4
  71. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/search.js.map +1 -1
  72. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.d.ts.map +1 -1
  73. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.js +8 -2
  74. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/ddb/resolvers/subscriptions.js.map +1 -1
  75. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.d.ts +1 -1
  76. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.d.ts.map +1 -1
  77. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.js +2 -2
  78. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/rds-vtl-generator.js.map +1 -1
  79. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.d.ts +3 -2
  80. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.d.ts.map +1 -1
  81. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.js +27 -16
  82. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/common.js.map +1 -1
  83. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.d.ts.map +1 -1
  84. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.js +5 -5
  85. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/mutation.js.map +1 -1
  86. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js +3 -3
  87. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js.map +1 -1
  88. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/subscription.js +1 -1
  89. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/subscription.js.map +1 -1
  90. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.d.ts +1 -1
  91. package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/vtl-generator.d.ts.map +1 -1
  92. package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +13 -13
  93. package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +1 -1
  94. package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +8 -8
  95. package/node_modules/@aws-amplify/graphql-directives/CHANGELOG.md +6 -0
  96. package/node_modules/@aws-amplify/graphql-directives/LICENSE +201 -0
  97. package/node_modules/@aws-amplify/graphql-directives/lib/directives/auth.d.ts.map +1 -1
  98. package/node_modules/@aws-amplify/graphql-directives/lib/directives/auth.js +1 -0
  99. package/node_modules/@aws-amplify/graphql-directives/lib/directives/auth.js.map +1 -1
  100. package/node_modules/@aws-amplify/graphql-directives/package.json +3 -2
  101. package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +1 -1
  102. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +7 -7
  103. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +1 -1
  104. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +7 -7
  105. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +4 -2
  106. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts +1 -1
  107. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.d.ts.map +1 -1
  108. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js +19 -10
  109. package/node_modules/@aws-amplify/graphql-index-transformer/lib/resolvers/resolvers.js.map +1 -1
  110. package/node_modules/@aws-amplify/graphql-index-transformer/lib/schema.d.ts.map +1 -1
  111. package/node_modules/@aws-amplify/graphql-index-transformer/lib/schema.js +13 -2
  112. package/node_modules/@aws-amplify/graphql-index-transformer/lib/schema.js.map +1 -1
  113. package/node_modules/@aws-amplify/graphql-index-transformer/package.json +8 -8
  114. package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +1 -1
  115. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
  116. package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +11 -11
  117. package/node_modules/@aws-amplify/graphql-model-transformer/API.md +3 -3
  118. package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +3 -6
  119. package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.d.ts +1 -0
  120. package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.d.ts.map +1 -1
  121. package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.js +2 -1
  122. package/node_modules/@aws-amplify/graphql-model-transformer/lib/definitions.js.map +1 -1
  123. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.d.ts.map +1 -1
  124. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js +29 -16
  125. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-model-transformer.js.map +1 -1
  126. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.d.ts +1 -1
  127. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.d.ts.map +1 -1
  128. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.js +11 -7
  129. package/node_modules/@aws-amplify/graphql-model-transformer/lib/graphql-types/common.js.map +1 -1
  130. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
  131. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
  132. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
  133. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/common.d.ts +1 -1
  134. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/common.d.ts.map +1 -1
  135. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/common.js +18 -9
  136. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/common.js.map +1 -1
  137. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.d.ts.map +1 -1
  138. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js +3 -3
  139. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/model-resource-generator.js.map +1 -1
  140. package/node_modules/@aws-amplify/graphql-model-transformer/package.json +7 -7
  141. package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +1 -1
  142. package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
  143. package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +7 -7
  144. package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +4 -2
  145. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-fields-transformer.d.ts +3 -4
  146. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-fields-transformer.d.ts.map +1 -1
  147. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-fields-transformer.js +7 -4
  148. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-fields-transformer.js.map +1 -1
  149. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-references-transformer.d.ts +11 -0
  150. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-references-transformer.d.ts.map +1 -0
  151. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-references-transformer.js +36 -0
  152. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-ddb-references-transformer.js.map +1 -0
  153. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-sql-transformer.d.ts +4 -5
  154. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-sql-transformer.d.ts.map +1 -1
  155. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-sql-transformer.js +8 -5
  156. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-sql-transformer.js.map +1 -1
  157. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-transformer-factory.d.ts +1 -1
  158. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-transformer-factory.d.ts.map +1 -1
  159. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-transformer-factory.js +18 -3
  160. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/belongs-to/belongs-to-directive-transformer-factory.js.map +1 -1
  161. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js +5 -6
  162. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js.map +1 -1
  163. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.d.ts.map +1 -1
  164. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js +4 -7
  165. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js.map +1 -1
  166. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js +5 -6
  167. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js.map +1 -1
  168. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js.map +1 -1
  169. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.d.ts +2 -3
  170. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.d.ts.map +1 -1
  171. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.js +6 -2
  172. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.js.map +1 -1
  173. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.d.ts +11 -0
  174. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.d.ts.map +1 -0
  175. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.js +37 -0
  176. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.js.map +1 -0
  177. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.d.ts +4 -5
  178. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.d.ts.map +1 -1
  179. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.js +7 -4
  180. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.js.map +1 -1
  181. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.d.ts +1 -1
  182. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.d.ts.map +1 -1
  183. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.js +18 -3
  184. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.js.map +1 -1
  185. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.d.ts +3 -4
  186. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.d.ts.map +1 -1
  187. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.js +7 -4
  188. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.js.map +1 -1
  189. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.d.ts +11 -0
  190. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.d.ts.map +1 -0
  191. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.js +37 -0
  192. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.js.map +1 -0
  193. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.d.ts +4 -5
  194. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.d.ts.map +1 -1
  195. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.js +7 -4
  196. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.js.map +1 -1
  197. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.d.ts +1 -1
  198. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.d.ts.map +1 -1
  199. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.js +18 -3
  200. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.js.map +1 -1
  201. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.d.ts +3 -2
  202. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.d.ts.map +1 -1
  203. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js +6 -3
  204. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js.map +1 -1
  205. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.d.ts +9 -0
  206. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.d.ts.map +1 -0
  207. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.js +172 -0
  208. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.js.map +1 -0
  209. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.d.ts +2 -2
  210. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.d.ts.map +1 -1
  211. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.js.map +1 -1
  212. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.d.ts +2 -1
  213. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.d.ts.map +1 -1
  214. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js +72 -17
  215. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js.map +1 -1
  216. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.d.ts +1 -1
  217. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.d.ts.map +1 -1
  218. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js.map +1 -1
  219. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts +5 -0
  220. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts.map +1 -1
  221. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts +2 -1
  222. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts.map +1 -1
  223. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js +7 -1
  224. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js.map +1 -1
  225. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +9 -9
  226. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +4 -2
  227. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.d.ts +1 -1
  228. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.d.ts.map +1 -1
  229. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.js +20 -9
  230. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.js.map +1 -1
  231. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.d.ts.map +1 -1
  232. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js +14 -3
  233. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js.map +1 -1
  234. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  235. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +8 -8
  236. package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +4 -2
  237. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.d.ts.map +1 -1
  238. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js +17 -8
  239. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js.map +1 -1
  240. package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +8 -8
  241. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +1 -1
  242. package/node_modules/@aws-amplify/graphql-transformer/package.json +15 -15
  243. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +1 -1
  244. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +5 -5
  245. package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +2 -1
  246. package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +4 -2
  247. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts +1 -0
  248. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts.map +1 -1
  249. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts +1 -1
  250. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts.map +1 -1
  251. package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +2 -2
  252. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/synth-parameters.ts +1 -0
  253. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-provider.ts +1 -0
  254. package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
  255. package/node_modules/graphql-transformer-common/CHANGELOG.md +4 -0
  256. package/node_modules/graphql-transformer-common/LICENSE +201 -0
  257. package/node_modules/graphql-transformer-common/package.json +3 -2
  258. package/package.json +19 -19
  259. package/src/amplify-graphql-api.ts +2 -0
  260. package/src/index.ts +1 -0
  261. package/src/internal/authorization-modes.ts +57 -8
  262. package/src/internal/codegen-assets.ts +11 -2
  263. package/src/types.ts +56 -5
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.29.1-sql-gen2-1.0](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.29.0...graphql-transformer-common@4.29.1-sql-gen2-1.0) (2024-04-02)
7
+
8
+ **Note:** Version bump only for package graphql-transformer-common
9
+
6
10
  # [4.29.0](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.28.1...graphql-transformer-common@4.29.0) (2024-03-28)
7
11
 
8
12
  ### Features
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2017 - 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql-transformer-common",
3
- "version": "4.29.0",
3
+ "version": "4.29.1-sql-gen2-1.0",
4
4
  "description": "Common code and constants for AppSync Transformers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -65,5 +65,6 @@
65
65
  "coveragePathIgnorePatterns": [
66
66
  "/__tests__/"
67
67
  ]
68
- }
68
+ },
69
+ "gitHead": "6b20fe9d8698030b08f97f0ac49cd1cba3aa63c9"
69
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/graphql-api-construct",
3
- "version": "1.8.0-sql-gen2.0",
3
+ "version": "1.8.0-sql-gen2-1.0",
4
4
  "description": "AppSync GraphQL Api Construct using Amplify GraphQL Transformer.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -76,21 +76,21 @@
76
76
  "dependencies": {
77
77
  "@aws-amplify/backend-output-schemas": "^0.4.0",
78
78
  "@aws-amplify/backend-output-storage": "^0.2.2",
79
- "@aws-amplify/graphql-auth-transformer": "3.4.3-sql-gen2.0",
80
- "@aws-amplify/graphql-default-value-transformer": "2.3.3-sql-gen2.0",
81
- "@aws-amplify/graphql-directives": "1.0.1",
82
- "@aws-amplify/graphql-function-transformer": "2.1.20-sql-gen2.0",
83
- "@aws-amplify/graphql-http-transformer": "2.1.20-sql-gen2.0",
84
- "@aws-amplify/graphql-index-transformer": "2.3.9-sql-gen2.0",
85
- "@aws-amplify/graphql-maps-to-transformer": "3.4.10-sql-gen2.0",
86
- "@aws-amplify/graphql-model-transformer": "2.8.0-sql-gen2.0",
87
- "@aws-amplify/graphql-predictions-transformer": "2.1.20-sql-gen2.0",
88
- "@aws-amplify/graphql-relational-transformer": "2.4.3-sql-gen2.0",
89
- "@aws-amplify/graphql-searchable-transformer": "2.6.3-sql-gen2.0",
90
- "@aws-amplify/graphql-sql-transformer": "0.2.9-sql-gen2.0",
91
- "@aws-amplify/graphql-transformer": "1.4.1-sql-gen2.0",
92
- "@aws-amplify/graphql-transformer-core": "2.5.2-sql-gen2.0",
93
- "@aws-amplify/graphql-transformer-interfaces": "3.6.0-sql-gen2.0",
79
+ "@aws-amplify/graphql-auth-transformer": "3.5.0-sql-gen2-1.0",
80
+ "@aws-amplify/graphql-default-value-transformer": "2.3.3-sql-gen2-1.0",
81
+ "@aws-amplify/graphql-directives": "1.1.0-sql-gen2-1.0",
82
+ "@aws-amplify/graphql-function-transformer": "2.1.20-sql-gen2-1.0",
83
+ "@aws-amplify/graphql-http-transformer": "2.1.20-sql-gen2-1.0",
84
+ "@aws-amplify/graphql-index-transformer": "2.4.0-sql-gen2-1.0",
85
+ "@aws-amplify/graphql-maps-to-transformer": "3.4.10-sql-gen2-1.0",
86
+ "@aws-amplify/graphql-model-transformer": "2.8.0-sql-gen2-1.0",
87
+ "@aws-amplify/graphql-predictions-transformer": "2.1.20-sql-gen2-1.0",
88
+ "@aws-amplify/graphql-relational-transformer": "2.5.0-sql-gen2-1.0",
89
+ "@aws-amplify/graphql-searchable-transformer": "2.7.0-sql-gen2-1.0",
90
+ "@aws-amplify/graphql-sql-transformer": "0.3.0-sql-gen2-1.0",
91
+ "@aws-amplify/graphql-transformer": "1.4.1-sql-gen2-1.0",
92
+ "@aws-amplify/graphql-transformer-core": "2.5.2-sql-gen2-1.0",
93
+ "@aws-amplify/graphql-transformer-interfaces": "3.6.0-sql-gen2-1.0",
94
94
  "@aws-amplify/platform-core": "^0.2.0",
95
95
  "@aws-amplify/plugin-types": "^0.4.1",
96
96
  "charenc": "^0.0.2",
@@ -99,7 +99,7 @@
99
99
  "graceful-fs": "^4.2.11",
100
100
  "graphql": "^15.5.0",
101
101
  "graphql-mapping-template": "4.20.15",
102
- "graphql-transformer-common": "4.29.0",
102
+ "graphql-transformer-common": "4.29.1-sql-gen2-1.0",
103
103
  "hjson": "^3.2.2",
104
104
  "immer": "^9.0.12",
105
105
  "is-buffer": "^2.0.5",
@@ -114,7 +114,7 @@
114
114
  "zod": "^3.22.3"
115
115
  },
116
116
  "devDependencies": {
117
- "@aws-amplify/graphql-transformer-test-utils": "0.4.8-sql-gen2.0",
117
+ "@aws-amplify/graphql-transformer-test-utils": "0.4.8-sql-gen2-1.0",
118
118
  "@types/fs-extra": "^8.0.1",
119
119
  "@types/node": "^12.12.6",
120
120
  "aws-cdk-lib": "2.80.0",
@@ -179,5 +179,5 @@
179
179
  "/__tests__/"
180
180
  ]
181
181
  },
182
- "gitHead": "b28d05f89e8a528dbf1f03836044594b40566b3d"
182
+ "gitHead": "6b20fe9d8698030b08f97f0ac49cd1cba3aa63c9"
183
183
  }
@@ -48,6 +48,7 @@ import {
48
48
  getGeneratedFunctionSlots,
49
49
  CodegenAssets,
50
50
  getAdditionalAuthenticationTypes,
51
+ validateAuthorizationModes,
51
52
  } from './internal';
52
53
  import { getStackForScope, walkAndProcessNodes } from './internal/construct-tree';
53
54
  import { getDataSourceStrategiesProvider } from './internal/data-source-config';
@@ -169,6 +170,7 @@ export class AmplifyGraphqlApi extends Construct {
169
170
  dataSources,
170
171
  });
171
172
 
173
+ validateAuthorizationModes(authorizationModes);
172
174
  const { authConfig, authSynthParameters } = convertAuthorizationModesToTransformerAuthConfig(authorizationModes);
173
175
 
174
176
  validateFunctionSlots(functionSlots ?? []);
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export type {
6
6
  IAMAuthorizationConfig,
7
+ IdentityPoolAuthorizationConfig,
7
8
  UserPoolAuthorizationConfig,
8
9
  OIDCAuthorizationConfig,
9
10
  ApiKeyAuthorizationConfig,
@@ -5,19 +5,61 @@ import { IRole, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
5
5
  import {
6
6
  AuthorizationModes,
7
7
  ApiKeyAuthorizationConfig,
8
- IAMAuthorizationConfig,
9
8
  LambdaAuthorizationConfig,
10
9
  OIDCAuthorizationConfig,
11
10
  UserPoolAuthorizationConfig,
12
11
  } from '../types';
13
12
 
14
13
  type AuthorizationConfigMode =
15
- | (IAMAuthorizationConfig & { type: 'AWS_IAM' })
14
+ | { type: 'AWS_IAM' }
16
15
  | (UserPoolAuthorizationConfig & { type: 'AMAZON_COGNITO_USER_POOLS' })
17
16
  | (OIDCAuthorizationConfig & { type: 'OPENID_CONNECT' })
18
17
  | (ApiKeyAuthorizationConfig & { type: 'API_KEY' })
19
18
  | (LambdaAuthorizationConfig & { type: 'AWS_LAMBDA' });
20
19
 
20
+ /**
21
+ * Validates authorization modes.
22
+ *
23
+ * Rules:
24
+ * 1. Validates that deprecated settings ('iamConfig.authenticatedUserRole', 'iamConfig.unauthenticatedUserRole',
25
+ * 'iamConfig.identityPoolId', 'iamConfig.allowListedRoles' and 'adminRoles') are mutually exclusive with new settings that
26
+ * replaced them ('iamConfig.enableIamAuthorizationMode' and any of 'authorizationModes.identityPoolConfig')
27
+ * 2. If deprecated identity pool settings are used ('iamConfig.authenticatedUserRole', 'iamConfig.unauthenticatedUserRole',
28
+ * and 'iamConfig.identityPoolId') validate that all are provided.
29
+ */
30
+ export const validateAuthorizationModes = (authorizationModes: AuthorizationModes): void => {
31
+ const hasAnyDeprecatedIdentityPoolSetting =
32
+ authorizationModes.iamConfig?.authenticatedUserRole ||
33
+ authorizationModes.iamConfig?.unauthenticatedUserRole ||
34
+ authorizationModes.iamConfig?.identityPoolId;
35
+ const hasAllDeprecatedIdentityPoolSettings =
36
+ authorizationModes.iamConfig?.authenticatedUserRole &&
37
+ authorizationModes.iamConfig?.unauthenticatedUserRole &&
38
+ authorizationModes.iamConfig?.identityPoolId;
39
+ const hasDeprecatedIamSettings =
40
+ authorizationModes.iamConfig?.authenticatedUserRole ||
41
+ authorizationModes.iamConfig?.unauthenticatedUserRole ||
42
+ authorizationModes.iamConfig?.identityPoolId ||
43
+ authorizationModes.iamConfig?.allowListedRoles ||
44
+ authorizationModes.adminRoles;
45
+ const hasUnDeprecatedIamSettings =
46
+ typeof authorizationModes.iamConfig?.enableIamAuthorizationMode !== 'undefined' || authorizationModes.identityPoolConfig;
47
+
48
+ if (hasDeprecatedIamSettings && hasUnDeprecatedIamSettings) {
49
+ throw new Error(
50
+ 'Invalid authorization modes configuration provided. ' +
51
+ "Deprecated IAM configuration cannot be used with identity pool configuration or when 'enableIamAuthorizationMode' is specified.",
52
+ );
53
+ }
54
+
55
+ if (hasAnyDeprecatedIdentityPoolSetting && !hasAllDeprecatedIdentityPoolSettings) {
56
+ throw new Error(
57
+ "'authorizationModes.iamConfig.authenticatedUserRole', 'authorizationModes.iamConfig.unauthenticatedUserRole' and" +
58
+ " 'authorizationModes.iamConfig.identityPoolId' must be provided.",
59
+ );
60
+ }
61
+ };
62
+
21
63
  /**
22
64
  * Converts a single auth mode config into the amplify-internal representation.
23
65
  * @param authMode the auth mode to convert into the Appsync CDK representation.
@@ -79,7 +121,7 @@ const convertAuthConfigToAppSyncAuth = (authModes: AuthorizationModes): AppSyncA
79
121
  authModes.lambdaConfig ? { type: 'AWS_LAMBDA', ...authModes.lambdaConfig } : null,
80
122
  authModes.oidcConfig ? { type: 'OPENID_CONNECT', ...authModes.oidcConfig } : null,
81
123
  authModes.userPoolConfig ? { type: 'AMAZON_COGNITO_USER_POOLS', ...authModes.userPoolConfig } : null,
82
- authModes.iamConfig ? { type: 'AWS_IAM', ...authModes.iamConfig } : null,
124
+ authModes.iamConfig || authModes.identityPoolConfig ? { type: 'AWS_IAM' } : null,
83
125
  ].filter((mode) => mode) as AuthorizationConfigMode[];
84
126
  const authProviders = authConfig.map(convertAuthModeToAuthProvider);
85
127
 
@@ -116,7 +158,7 @@ const convertAuthConfigToAppSyncAuth = (authModes: AuthorizationModes): AppSyncA
116
158
 
117
159
  type AuthSynthParameters = Pick<
118
160
  SynthParameters,
119
- 'userPoolId' | 'authenticatedUserRoleName' | 'unauthenticatedUserRoleName' | 'identityPoolId' | 'adminRoles'
161
+ 'userPoolId' | 'authenticatedUserRoleName' | 'unauthenticatedUserRoleName' | 'identityPoolId' | 'adminRoles' | 'enableIamAccess'
120
162
  >;
121
163
 
122
164
  interface AuthConfig {
@@ -177,12 +219,19 @@ const getAllowListedRoles = (authModes: AuthorizationModes): string[] =>
177
219
  */
178
220
  const getSynthParameters = (authModes: AuthorizationModes): AuthSynthParameters => ({
179
221
  adminRoles: getAllowListedRoles(authModes),
180
- identityPoolId: authModes.iamConfig?.identityPoolId,
222
+ identityPoolId: authModes.identityPoolConfig?.identityPoolId ?? authModes.iamConfig?.identityPoolId,
223
+ enableIamAccess: authModes.iamConfig?.enableIamAuthorizationMode,
181
224
  ...(authModes.userPoolConfig ? { userPoolId: authModes.userPoolConfig.userPool.userPoolId } : {}),
182
- ...(authModes?.iamConfig
225
+ ...(authModes?.identityPoolConfig
226
+ ? {
227
+ authenticatedUserRoleName: authModes.identityPoolConfig.authenticatedUserRole.roleName,
228
+ unauthenticatedUserRoleName: authModes.identityPoolConfig.unauthenticatedUserRole.roleName,
229
+ }
230
+ : {}),
231
+ ...(authModes?.iamConfig && authModes?.iamConfig.authenticatedUserRole && authModes?.iamConfig.unauthenticatedUserRole
183
232
  ? {
184
- authenticatedUserRoleName: authModes.iamConfig.authenticatedUserRole.roleName,
185
- unauthenticatedUserRoleName: authModes.iamConfig.unauthenticatedUserRole.roleName,
233
+ authenticatedUserRoleName: authModes.iamConfig.authenticatedUserRole?.roleName,
234
+ unauthenticatedUserRoleName: authModes.iamConfig.unauthenticatedUserRole?.roleName,
186
235
  }
187
236
  : {}),
188
237
  });
@@ -1,5 +1,5 @@
1
- import { RemovalPolicy } from 'aws-cdk-lib';
2
- import { Bucket, IBucket } from 'aws-cdk-lib/aws-s3';
1
+ import { RemovalPolicy, Fn } from 'aws-cdk-lib';
2
+ import { Bucket, HttpMethods, IBucket } from 'aws-cdk-lib/aws-s3';
3
3
  import { BucketDeployment, Source } from 'aws-cdk-lib/aws-s3-deployment';
4
4
  import { Construct } from 'constructs';
5
5
 
@@ -8,6 +8,7 @@ export type CodegenAssetsProps = {
8
8
  };
9
9
 
10
10
  const MODEL_SCHEMA_KEY = 'model-schema.graphql';
11
+ const CONSOLE_SERVICE_ENDPOINT = Fn.join('', ['https://', Fn.ref('AWS::Region'), '.console.aws.amazon.com/amplify']);
11
12
 
12
13
  /**
13
14
  * Construct an S3 URI string for a given bucket and key.
@@ -30,6 +31,14 @@ export class CodegenAssets extends Construct {
30
31
  const bucket = new Bucket(this, `${id}Bucket`, {
31
32
  removalPolicy: RemovalPolicy.DESTROY,
32
33
  autoDeleteObjects: true,
34
+ // Enabling CORS to allow console to access the codegen assets.
35
+ cors: [
36
+ {
37
+ allowedMethods: [HttpMethods.GET, HttpMethods.HEAD],
38
+ allowedHeaders: ['*'],
39
+ allowedOrigins: [CONSOLE_SERVICE_ENDPOINT],
40
+ },
41
+ ],
33
42
  });
34
43
 
35
44
  const deployment = new BucketDeployment(this, `${id}Deployment`, {
package/src/types.ts CHANGED
@@ -28,25 +28,68 @@ export interface IAMAuthorizationConfig {
28
28
  /**
29
29
  * ID for the Cognito Identity Pool vending auth and unauth roles.
30
30
  * Format: `<region>:<id string>`
31
+ *
32
+ * @deprecated Use 'IdentityPoolAuthorizationConfig.identityPoolId' instead.
33
+ * See https://docs.amplify.aws/cli/react/tools/cli/migration/iam-auth-updates-for-cdk-construct for details.
31
34
  */
32
- readonly identityPoolId: string;
35
+ readonly identityPoolId?: string;
33
36
 
34
37
  /**
35
38
  * Authenticated user role, applies to { provider: iam, allow: private } access.
39
+ *
40
+ * @deprecated Use 'IdentityPoolAuthorizationConfig.authenticatedUserRole' instead.
41
+ * See https://docs.amplify.aws/cli/react/tools/cli/migration/iam-auth-updates-for-cdk-construct for details.
36
42
  */
37
- readonly authenticatedUserRole: IRole;
43
+ readonly authenticatedUserRole?: IRole;
38
44
 
39
45
  /**
40
46
  * Unauthenticated user role, applies to { provider: iam, allow: public } access.
47
+ *
48
+ * @deprecated Use 'IdentityPoolAuthorizationConfig.unauthenticatedUserRole' instead.
49
+ * See https://docs.amplify.aws/cli/react/tools/cli/migration/iam-auth-updates-for-cdk-construct for details.
41
50
  */
42
- readonly unauthenticatedUserRole: IRole;
51
+ readonly unauthenticatedUserRole?: IRole;
43
52
 
44
53
  /**
45
54
  * A list of IAM roles which will be granted full read/write access to the generated model if IAM auth is enabled.
46
55
  * If an IRole is provided, the role `name` will be used for matching.
47
56
  * If a string is provided, the raw value will be used for matching.
57
+ *
58
+ * @deprecated Use 'enableIamAuthorizationMode' and IAM Policy to control access for IAM principals.
59
+ * See https://docs.amplify.aws/cli/react/tools/cli/migration/iam-auth-updates-for-cdk-construct for details.
48
60
  */
49
61
  readonly allowListedRoles?: (IRole | string)[];
62
+
63
+ /**
64
+ * Enables access for IAM principals. If enabled @auth directive rules are not applied.
65
+ * Instead, access should be defined by IAM Policy, see https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsappsync.html.
66
+ *
67
+ * Does not apply to authenticated and unauthenticated IAM Roles attached to Cognito Identity Pool.
68
+ * Use IdentityPoolAuthorizationConfig to configure their access.
69
+ */
70
+ readonly enableIamAuthorizationMode?: boolean;
71
+ }
72
+
73
+ /**
74
+ * Configuration for Cognito Identity Pool Authorization on the Graphql Api.
75
+ * @struct - required since this interface begins with an 'I'
76
+ */
77
+ export interface IdentityPoolAuthorizationConfig {
78
+ /**
79
+ * ID for the Cognito Identity Pool vending auth and unauth roles.
80
+ * Format: `<region>:<id string>`
81
+ */
82
+ readonly identityPoolId: string;
83
+
84
+ /**
85
+ * Authenticated user role, applies to { provider: iam, allow: private } access.
86
+ */
87
+ readonly authenticatedUserRole: IRole;
88
+
89
+ /**
90
+ * Unauthenticated user role, applies to { provider: iam, allow: public } access.
91
+ */
92
+ readonly unauthenticatedUserRole: IRole;
50
93
  }
51
94
 
52
95
  /**
@@ -134,11 +177,19 @@ export interface AuthorizationModes {
134
177
  readonly defaultAuthorizationMode?: 'AWS_IAM' | 'AMAZON_COGNITO_USER_POOLS' | 'OPENID_CONNECT' | 'API_KEY' | 'AWS_LAMBDA';
135
178
 
136
179
  /**
137
- * IAM Auth config, required if an 'iam' auth provider is specified in the Api.
138
- * Applies to 'public' and 'private' auth strategies.
180
+ * IAM Auth config, required to allow IAM-based access to this API.
181
+ * This applies to any IAM principal except Amazon Cognito identity pool's authenticated and unauthenticated roles.
182
+ * This behavior was has recently been improved.
183
+ * See https://docs.amplify.aws/cli/react/tools/cli/migration/iam-auth-updates-for-cdk-construct for details.
139
184
  */
140
185
  readonly iamConfig?: IAMAuthorizationConfig;
141
186
 
187
+ /**
188
+ * Cognito Identity Pool config, required if an 'identityPool' auth provider is specified in the Api.
189
+ * Applies to 'public' and 'private' auth strategies.
190
+ */
191
+ readonly identityPoolConfig?: IdentityPoolAuthorizationConfig;
192
+
142
193
  /**
143
194
  * Cognito UserPool config, required if a 'userPools' auth provider is specified in the Api.
144
195
  * Applies to 'owner', 'private', and 'group' auth strategies.