@aws-amplify/graphql-api-construct 1.8.0 → 1.9.0-0411-gen2.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 (268) hide show
  1. package/.jsii +313 -200
  2. package/API.md +16 -3
  3. package/CHANGELOG.md +7 -0
  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 +7 -0
  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 +34 -22
  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 +4 -0
  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 +4 -0
  102. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +7 -7
  103. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +4 -0
  104. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +7 -7
  105. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +6 -0
  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 +4 -0
  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 +6 -0
  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 +4 -0
  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 +11 -0
  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 +35 -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 +2 -2
  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 +19 -4
  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.d.ts +1 -1
  162. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.d.ts.map +1 -1
  163. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js +6 -7
  164. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-belongs-to-transformer.js.map +1 -1
  165. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.d.ts +1 -1
  166. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.d.ts.map +1 -1
  167. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js +6 -9
  168. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-many-transformer.js.map +1 -1
  169. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js +5 -6
  170. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-has-one-transformer.js.map +1 -1
  171. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/graphql-many-to-many-transformer.js.map +1 -1
  172. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.d.ts +2 -3
  173. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.d.ts.map +1 -1
  174. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.js +6 -2
  175. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-fields-transformer.js.map +1 -1
  176. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.d.ts +11 -0
  177. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.d.ts.map +1 -0
  178. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.js +44 -0
  179. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-ddb-references-transformer.js.map +1 -0
  180. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.d.ts +4 -5
  181. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.d.ts.map +1 -1
  182. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.js +7 -4
  183. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-sql-transformer.js.map +1 -1
  184. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.d.ts +1 -1
  185. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.d.ts.map +1 -1
  186. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.js +18 -3
  187. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-many/has-many-directive-transformer-factory.js.map +1 -1
  188. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.d.ts +3 -4
  189. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.d.ts.map +1 -1
  190. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.js +7 -4
  191. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-fields-transformer.js.map +1 -1
  192. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.d.ts +11 -0
  193. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.d.ts.map +1 -0
  194. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.js +44 -0
  195. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-ddb-references-transformer.js.map +1 -0
  196. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.d.ts +4 -5
  197. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.d.ts.map +1 -1
  198. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.js +7 -4
  199. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-sql-transformer.js.map +1 -1
  200. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.d.ts +1 -1
  201. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.d.ts.map +1 -1
  202. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.js +18 -3
  203. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/has-one/has-one-directive-transformer-factory.js.map +1 -1
  204. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.d.ts +3 -2
  205. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.d.ts.map +1 -1
  206. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js +7 -4
  207. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-generator.js.map +1 -1
  208. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.d.ts +11 -0
  209. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.d.ts.map +1 -0
  210. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.js +213 -0
  211. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/ddb-references-generator.js.map +1 -0
  212. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.d.ts +2 -2
  213. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.d.ts.map +1 -1
  214. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/generator.js.map +1 -1
  215. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.d.ts.map +1 -1
  216. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.js +1 -1
  217. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolver/rds-generator.js.map +1 -1
  218. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.d.ts +3 -1
  219. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.d.ts.map +1 -1
  220. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js +142 -17
  221. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/resolvers.js.map +1 -1
  222. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.d.ts +1 -1
  223. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.d.ts.map +1 -1
  224. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/schema.js.map +1 -1
  225. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts +5 -0
  226. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/types.d.ts.map +1 -1
  227. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts +2 -1
  228. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.d.ts.map +1 -1
  229. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js +7 -1
  230. package/node_modules/@aws-amplify/graphql-relational-transformer/lib/utils.js.map +1 -1
  231. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +9 -9
  232. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +6 -0
  233. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.d.ts +1 -1
  234. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.d.ts.map +1 -1
  235. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.js +20 -9
  236. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/generate-resolver-vtl.js.map +1 -1
  237. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.d.ts.map +1 -1
  238. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js +14 -3
  239. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/graphql-searchable-transformer.js.map +1 -1
  240. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  241. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +8 -8
  242. package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +6 -0
  243. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.d.ts.map +1 -1
  244. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js +17 -8
  245. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js.map +1 -1
  246. package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +8 -8
  247. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +4 -0
  248. package/node_modules/@aws-amplify/graphql-transformer/package.json +15 -15
  249. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +4 -0
  250. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +5 -5
  251. package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +2 -1
  252. package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +7 -0
  253. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts +1 -0
  254. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/synth-parameters.d.ts.map +1 -1
  255. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts +1 -1
  256. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts.map +1 -1
  257. package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +2 -2
  258. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/synth-parameters.ts +1 -0
  259. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-provider.ts +1 -0
  260. package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
  261. package/node_modules/graphql-transformer-common/CHANGELOG.md +4 -0
  262. package/node_modules/graphql-transformer-common/package.json +2 -2
  263. package/package.json +19 -19
  264. package/src/amplify-graphql-api.ts +2 -0
  265. package/src/index.ts +1 -0
  266. package/src/internal/authorization-modes.ts +57 -8
  267. package/src/internal/codegen-assets.ts +11 -2
  268. 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.30.1-0411-gen2.0](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.30.0...graphql-transformer-common@4.30.1-0411-gen2.0) (2024-04-11)
7
+
8
+ **Note:** Version bump only for package graphql-transformer-common
9
+
6
10
  # [4.30.0](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.29.0...graphql-transformer-common@4.30.0) (2024-04-11)
7
11
 
8
12
  ### Bug Fixes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql-transformer-common",
3
- "version": "4.30.0",
3
+ "version": "4.30.1-0411-gen2.0",
4
4
  "description": "Common code and constants for AppSync Transformers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,5 +66,5 @@
66
66
  "/__tests__/"
67
67
  ]
68
68
  },
69
- "gitHead": "1f63fca870b3485093cbb62ef3b5e4923455b0c1"
69
+ "gitHead": "b0c2902888a00f94d789a3b42619f5f9f4bb5a39"
70
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/graphql-api-construct",
3
- "version": "1.8.0",
3
+ "version": "1.9.0-0411-gen2.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",
80
- "@aws-amplify/graphql-default-value-transformer": "2.3.3",
81
- "@aws-amplify/graphql-directives": "1.0.1",
82
- "@aws-amplify/graphql-function-transformer": "2.1.20",
83
- "@aws-amplify/graphql-http-transformer": "2.1.20",
84
- "@aws-amplify/graphql-index-transformer": "2.3.9",
85
- "@aws-amplify/graphql-maps-to-transformer": "3.4.10",
86
- "@aws-amplify/graphql-model-transformer": "2.8.0",
87
- "@aws-amplify/graphql-predictions-transformer": "2.1.20",
88
- "@aws-amplify/graphql-relational-transformer": "2.4.3",
89
- "@aws-amplify/graphql-searchable-transformer": "2.6.3",
90
- "@aws-amplify/graphql-sql-transformer": "0.2.9",
91
- "@aws-amplify/graphql-transformer": "1.5.0",
92
- "@aws-amplify/graphql-transformer-core": "2.6.0",
93
- "@aws-amplify/graphql-transformer-interfaces": "3.6.0",
79
+ "@aws-amplify/graphql-auth-transformer": "3.5.0-0411-gen2.0",
80
+ "@aws-amplify/graphql-default-value-transformer": "2.3.4-0411-gen2.0",
81
+ "@aws-amplify/graphql-directives": "1.1.0-0411-gen2.0",
82
+ "@aws-amplify/graphql-function-transformer": "2.1.21-0411-gen2.0",
83
+ "@aws-amplify/graphql-http-transformer": "2.1.21-0411-gen2.0",
84
+ "@aws-amplify/graphql-index-transformer": "2.4.0-0411-gen2.0",
85
+ "@aws-amplify/graphql-maps-to-transformer": "3.4.11-0411-gen2.0",
86
+ "@aws-amplify/graphql-model-transformer": "2.9.0-0411-gen2.0",
87
+ "@aws-amplify/graphql-predictions-transformer": "2.1.21-0411-gen2.0",
88
+ "@aws-amplify/graphql-relational-transformer": "2.5.0-0411-gen2.0",
89
+ "@aws-amplify/graphql-searchable-transformer": "2.7.0-0411-gen2.0",
90
+ "@aws-amplify/graphql-sql-transformer": "0.3.0-0411-gen2.0",
91
+ "@aws-amplify/graphql-transformer": "1.5.1-0411-gen2.0",
92
+ "@aws-amplify/graphql-transformer-core": "2.6.1-0411-gen2.0",
93
+ "@aws-amplify/graphql-transformer-interfaces": "3.7.0-0411-gen2.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.30.0",
102
+ "graphql-transformer-common": "4.30.1-0411-gen2.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.5.0",
117
+ "@aws-amplify/graphql-transformer-test-utils": "0.5.1-0411-gen2.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": "1f63fca870b3485093cbb62ef3b5e4923455b0c1"
182
+ "gitHead": "b0c2902888a00f94d789a3b42619f5f9f4bb5a39"
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.