@aws-amplify/graphql-auth-transformer 0.2.0-graphql-vnext-dev-preview.1 → 0.2.0-graphql-vnext-dev-preview.7

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 (64) hide show
  1. package/CHANGELOG.md +212 -5
  2. package/lib/accesscontrol/acm.d.ts +5 -0
  3. package/lib/accesscontrol/acm.d.ts.map +1 -1
  4. package/lib/accesscontrol/acm.js +16 -5
  5. package/lib/accesscontrol/acm.js.map +1 -1
  6. package/lib/graphql-auth-transformer.d.ts +4 -2
  7. package/lib/graphql-auth-transformer.d.ts.map +1 -1
  8. package/lib/graphql-auth-transformer.js +145 -49
  9. package/lib/graphql-auth-transformer.js.map +1 -1
  10. package/lib/resolvers/field.d.ts +3 -1
  11. package/lib/resolvers/field.d.ts.map +1 -1
  12. package/lib/resolvers/field.js +36 -15
  13. package/lib/resolvers/field.js.map +1 -1
  14. package/lib/resolvers/helpers.d.ts +4 -2
  15. package/lib/resolvers/helpers.d.ts.map +1 -1
  16. package/lib/resolvers/helpers.js +37 -10
  17. package/lib/resolvers/helpers.js.map +1 -1
  18. package/lib/resolvers/index.d.ts +3 -2
  19. package/lib/resolvers/index.d.ts.map +1 -1
  20. package/lib/resolvers/index.js +5 -1
  21. package/lib/resolvers/index.js.map +1 -1
  22. package/lib/resolvers/mutation.create.d.ts.map +1 -1
  23. package/lib/resolvers/mutation.create.js +27 -20
  24. package/lib/resolvers/mutation.create.js.map +1 -1
  25. package/lib/resolvers/mutation.delete.d.ts.map +1 -1
  26. package/lib/resolvers/mutation.delete.js +21 -11
  27. package/lib/resolvers/mutation.delete.js.map +1 -1
  28. package/lib/resolvers/mutation.update.d.ts.map +1 -1
  29. package/lib/resolvers/mutation.update.js +25 -12
  30. package/lib/resolvers/mutation.update.js.map +1 -1
  31. package/lib/resolvers/query.d.ts +3 -2
  32. package/lib/resolvers/query.d.ts.map +1 -1
  33. package/lib/resolvers/query.js +145 -67
  34. package/lib/resolvers/query.js.map +1 -1
  35. package/lib/resolvers/search.d.ts +4 -0
  36. package/lib/resolvers/search.d.ts.map +1 -0
  37. package/lib/resolvers/search.js +173 -0
  38. package/lib/resolvers/search.js.map +1 -0
  39. package/lib/resolvers/subscriptions.d.ts.map +1 -1
  40. package/lib/resolvers/subscriptions.js +7 -4
  41. package/lib/resolvers/subscriptions.js.map +1 -1
  42. package/lib/utils/constants.d.ts +3 -2
  43. package/lib/utils/constants.d.ts.map +1 -1
  44. package/lib/utils/constants.js +10 -3
  45. package/lib/utils/constants.js.map +1 -1
  46. package/lib/utils/definitions.d.ts +18 -12
  47. package/lib/utils/definitions.d.ts.map +1 -1
  48. package/lib/utils/definitions.js +2 -0
  49. package/lib/utils/definitions.js.map +1 -1
  50. package/lib/utils/iam.js +1 -1
  51. package/lib/utils/iam.js.map +1 -1
  52. package/lib/utils/index.d.ts +2 -5
  53. package/lib/utils/index.d.ts.map +1 -1
  54. package/lib/utils/index.js +13 -44
  55. package/lib/utils/index.js.map +1 -1
  56. package/lib/utils/schema.d.ts +7 -2
  57. package/lib/utils/schema.d.ts.map +1 -1
  58. package/lib/utils/schema.js +107 -1
  59. package/lib/utils/schema.js.map +1 -1
  60. package/lib/utils/validations.d.ts +2 -2
  61. package/lib/utils/validations.d.ts.map +1 -1
  62. package/lib/utils/validations.js +21 -3
  63. package/lib/utils/validations.js.map +1 -1
  64. package/package.json +9 -10
package/CHANGELOG.md CHANGED
@@ -3,22 +3,229 @@
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
- # [0.2.0-graphql-vnext-dev-preview.1](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-auth-transformer@0.2.0-graphql-vnext-dev-preview.0...@aws-amplify/graphql-auth-transformer@0.2.0-graphql-vnext-dev-preview.1) (2021-09-29)
6
+ # 0.2.0-graphql-vnext-dev-preview.7 (2021-11-07)
7
7
 
8
- **Note:** Version bump only for package @aws-amplify/graphql-auth-transformer
8
+
9
+ ### Bug Fixes
10
+
11
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
12
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
13
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
14
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
15
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
16
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
17
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
18
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
19
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
20
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
21
+ * **graphql-model-transformer:** subscription resolver logical id fix ([#8712](https://github.com/aws-amplify/amplify-cli/issues/8712)) ([a380e12](https://github.com/aws-amplify/amplify-cli/commit/a380e12f674fec7cda616bdae54b49a153bbecf2))
22
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
23
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
24
+
25
+
26
+ ### Features
27
+
28
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
29
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
30
+
31
+
32
+
33
+
34
+
35
+ # 0.2.0-graphql-vnext-dev-preview.6 (2021-11-07)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
41
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
42
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
43
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
44
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
45
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
46
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
47
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
48
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
49
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
50
+ * **graphql-model-transformer:** subscription resolver logical id fix ([#8712](https://github.com/aws-amplify/amplify-cli/issues/8712)) ([4d0c7d5](https://github.com/aws-amplify/amplify-cli/commit/4d0c7d5b9b9c42749858c75f1265a75efad473e4))
51
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
52
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
53
+
54
+
55
+ ### Features
56
+
57
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
58
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
59
+
60
+
61
+
62
+
63
+
64
+ # 0.2.0-graphql-vnext-dev-preview.5 (2021-11-07)
65
+
66
+
67
+ ### Bug Fixes
68
+
69
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
70
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
71
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
72
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
73
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
74
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
75
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
76
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
77
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
78
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
79
+ * **graphql-model-transformer:** subscription resolver logical id fix ([#8712](https://github.com/aws-amplify/amplify-cli/issues/8712)) ([4dcdc95](https://github.com/aws-amplify/amplify-cli/commit/4dcdc9524bb46bda5cdcfc0e835d43c64dc216a6))
80
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
81
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
82
+
83
+
84
+ ### Features
85
+
86
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
87
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
88
+
89
+
90
+
91
+
92
+
93
+ # 0.2.0-graphql-vnext-dev-preview.4 (2021-11-07)
94
+
95
+
96
+ ### Bug Fixes
97
+
98
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
99
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
100
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
101
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
102
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
103
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
104
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
105
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
106
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
107
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
108
+ * **graphql-model-transformer:** subscription resolver logical id fix ([#8712](https://github.com/aws-amplify/amplify-cli/issues/8712)) ([ff7c202](https://github.com/aws-amplify/amplify-cli/commit/ff7c202252983938c3a32c31fc4b3bd09a73734e))
109
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
110
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
111
+
112
+
113
+ ### Features
114
+
115
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
116
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
117
+
118
+
119
+
120
+
121
+
122
+ # 0.2.0-graphql-vnext-dev-preview.3 (2021-11-07)
123
+
124
+
125
+ ### Bug Fixes
126
+
127
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
128
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
129
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
130
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
131
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
132
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
133
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
134
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
135
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
136
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
137
+ * **graphql-model-transformer:** subscription resolver logical id fix ([#8712](https://github.com/aws-amplify/amplify-cli/issues/8712)) ([249a0a7](https://github.com/aws-amplify/amplify-cli/commit/249a0a75b0e918f49c1059274d9252a430ce34c6))
138
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
139
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
140
+
141
+
142
+ ### Features
143
+
144
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
145
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
146
+
147
+
148
+
149
+
150
+
151
+ # 0.2.0-graphql-vnext-dev-preview.2 (2021-11-07)
152
+
153
+
154
+ ### Bug Fixes
155
+
156
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
157
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
158
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
159
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
160
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
161
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
162
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
163
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
164
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
165
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
166
+ * **graphql-model-transformer:** subscription resolver logical id fix ([#8712](https://github.com/aws-amplify/amplify-cli/issues/8712)) ([3641fe3](https://github.com/aws-amplify/amplify-cli/commit/3641fe344396206fbc829b17916cc71df02347ce))
167
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
168
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
169
+
170
+
171
+ ### Features
172
+
173
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
174
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
175
+
176
+
177
+
178
+
179
+
180
+ # 0.2.0-graphql-vnext-dev-preview.1 (2021-11-07)
181
+
182
+
183
+ ### Bug Fixes
184
+
185
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
186
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
187
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
188
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
189
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
190
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
191
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
192
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
193
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
194
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
195
+ * **graphql-model-transformer:** subscription resolver logical id fix ([#8712](https://github.com/aws-amplify/amplify-cli/issues/8712)) ([0e1a014](https://github.com/aws-amplify/amplify-cli/commit/0e1a014286c466cb858be6f8be1fdf1778abd4af))
196
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
197
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
198
+
199
+
200
+ ### Features
201
+
202
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
203
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
9
204
 
10
205
 
11
206
 
12
207
 
13
208
 
14
- # 0.2.0-graphql-vnext-dev-preview.0 (2021-09-27)
209
+ # 0.2.0-graphql-vnext-dev-preview.0 (2021-11-07)
15
210
 
16
211
 
17
212
  ### Bug Fixes
18
213
 
19
- * update dependency versions ([b4cbe97](https://github.com/aws-amplify/amplify-cli/commit/b4cbe97ea09f392469b4b84727db297228daf129))
214
+ * [@auth](https://github.com/auth) fix relational auth, authv2 e2e with utils and fixes ([#8450](https://github.com/aws-amplify/amplify-cli/issues/8450)) ([aa320cd](https://github.com/aws-amplify/amplify-cli/commit/aa320cd2414665a484438f0764cf68fd78caa26a))
215
+ * [@function](https://github.com/function) vNext payload, remove unused code, and update common mapping tempalte function ([#8462](https://github.com/aws-amplify/amplify-cli/issues/8462)) ([24d0de9](https://github.com/aws-amplify/amplify-cli/commit/24d0de97a1bfacc3983e5b11a7582c9500759adc))
216
+ * add [@manytomany](https://github.com/manytomany) join table auth ([#8460](https://github.com/aws-amplify/amplify-cli/issues/8460)) ([424bbda](https://github.com/aws-amplify/amplify-cli/commit/424bbda410fbab100d475d37fa9ab291bfd05317))
217
+ * add field auth on aggregation queries ([#8508](https://github.com/aws-amplify/amplify-cli/issues/8508)) ([c0fa85a](https://github.com/aws-amplify/amplify-cli/commit/c0fa85a87230d631ffaf376f18f4fc3c4ec9a1f9))
218
+ * add schema directives for sync operation when conflict resolution is enabled ([#8521](https://github.com/aws-amplify/amplify-cli/issues/8521)) ([e3299e5](https://github.com/aws-amplify/amplify-cli/commit/e3299e5c09884218d486d4a488f343972674a417))
219
+ * allow duplicate auth rules when creating the join type ([#8680](https://github.com/aws-amplify/amplify-cli/issues/8680)) ([1a0636d](https://github.com/aws-amplify/amplify-cli/commit/1a0636d72d010b9d0ed18d511f853bcbffa9d421))
220
+ * auth on getting related model name and searchablevNext e2e ([#8455](https://github.com/aws-amplify/amplify-cli/issues/8455)) ([8536dd3](https://github.com/aws-amplify/amplify-cli/commit/8536dd3eb4cffc14602d80eea82b8b62b8227485))
221
+ * auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
222
+ * fix null check for implied owner check ([#8586](https://github.com/aws-amplify/amplify-cli/issues/8586)) ([4a0fda8](https://github.com/aws-amplify/amplify-cli/commit/4a0fda81472ec82d6731502bbe83a9ffd0b27198))
223
+ * **graphql-model-transformer:** override resource logical id to fix v1 to v2 transformer migration ([#8597](https://github.com/aws-amplify/amplify-cli/issues/8597)) ([e3a2afb](https://github.com/aws-amplify/amplify-cli/commit/e3a2afbbed6e97f143fc7c83064e2193f4c91bdd))
224
+ * searchable fix and migration e2e tests ([#8666](https://github.com/aws-amplify/amplify-cli/issues/8666)) ([d5f9397](https://github.com/aws-amplify/amplify-cli/commit/d5f9397fa860f32e748f6f880929b1e5856a68e2))
225
+ * update auth vnext validation to use private for oidc ([#8606](https://github.com/aws-amplify/amplify-cli/issues/8606)) ([8e659a1](https://github.com/aws-amplify/amplify-cli/commit/8e659a1357df63d5cae92b67f719ffeea9acacf0))
20
226
 
21
227
 
22
228
  ### Features
23
229
 
24
- * add [@auth](https://github.com/auth) ([#1](https://github.com/aws-amplify/amplify-cli/issues/1)) ([7c13d99](https://github.com/aws-amplify/amplify-cli/commit/7c13d99a15e811efeff32ed061573d63ee9093ba)), closes [#8074](https://github.com/aws-amplify/amplify-cli/issues/8074) [#8078](https://github.com/aws-amplify/amplify-cli/issues/8078) [#8124](https://github.com/aws-amplify/amplify-cli/issues/8124) [#8146](https://github.com/aws-amplify/amplify-cli/issues/8146) [#8168](https://github.com/aws-amplify/amplify-cli/issues/8168) [#8138](https://github.com/aws-amplify/amplify-cli/issues/8138) [#8174](https://github.com/aws-amplify/amplify-cli/issues/8174) [#8175](https://github.com/aws-amplify/amplify-cli/issues/8175) [#8180](https://github.com/aws-amplify/amplify-cli/issues/8180) [#8179](https://github.com/aws-amplify/amplify-cli/issues/8179) [#8234](https://github.com/aws-amplify/amplify-cli/issues/8234) [#8246](https://github.com/aws-amplify/amplify-cli/issues/8246) [#8248](https://github.com/aws-amplify/amplify-cli/issues/8248) [#8259](https://github.com/aws-amplify/amplify-cli/issues/8259)
230
+ * add admin roles which have admin control over a graphql api ([#8601](https://github.com/aws-amplify/amplify-cli/issues/8601)) ([4d50df0](https://github.com/aws-amplify/amplify-cli/commit/4d50df000c6e11165d2da766c0eaa0097d88a0c2))
231
+ * allow optional idp arg into auth to allow provided auth role or authenticated identity ([#8609](https://github.com/aws-amplify/amplify-cli/issues/8609)) ([bf843b9](https://github.com/aws-amplify/amplify-cli/commit/bf843b90330d8ceb2ea90bc2761edd57e5d5123b))
@@ -1,13 +1,16 @@
1
1
  declare type ACMConfig = {
2
2
  resources: string[];
3
3
  operations: string[];
4
+ name: string;
4
5
  };
5
6
  declare type SetRoleInput = {
6
7
  role: string;
7
8
  operations: Array<string>;
8
9
  resource?: string;
10
+ allowRoleOverwrite?: boolean;
9
11
  };
10
12
  export declare class AccessControlMatrix {
13
+ private name;
11
14
  private roles;
12
15
  private operations;
13
16
  private resources;
@@ -15,8 +18,10 @@ export declare class AccessControlMatrix {
15
18
  constructor(config: ACMConfig);
16
19
  setRole(input: SetRoleInput): void;
17
20
  hasRole(role: string): boolean;
21
+ getName(): string;
18
22
  getRoles(): Array<string>;
19
23
  getResources(): Readonly<Array<string>>;
24
+ hasResource(resource: string): boolean;
20
25
  isAllowed(role: string, resource: string, operation: string): boolean;
21
26
  resetAccessForResource(resource: string): void;
22
27
  getRolesPerOperation(operation: string, fullAccess?: boolean): Array<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"acm.d.ts","sourceRoot":"","sources":["../../src/accesscontrol/acm.ts"],"names":[],"mappings":"AAEA,aAAK,SAAS,GAAG;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,aAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAqBF,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,UAAU,CAAgB;IAClC,O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CAAgB;IACjC,OAAO,CAAC,MAAM,CAA+B;gBAEjC,MAAM,EAAE,SAAS;IAQtB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAkBlC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B,OAAO,IAAI,MAAM;IAIjB,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC;IAIzB,YAAY,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAIvC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAItC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAQrE,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAe9C,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,GAAG,KAAK,CAAC,MAAM,CAAC;IAwBnF,aAAa,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAkB3C,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,0BAA0B;IAyBlC,OAAO,CAAC,gBAAgB;CAOzB"}
@@ -5,15 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AccessControlMatrix = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
+ const graphql_transformer_core_1 = require("@aws-amplify/graphql-transformer-core");
8
9
  class AccessControlMatrix {
9
10
  constructor(config) {
11
+ this.name = config.name;
10
12
  this.operations = config.operations;
11
13
  this.resources = config.resources;
12
14
  this.matrix = new Array();
13
15
  this.roles = new Array();
14
16
  }
15
17
  setRole(input) {
16
- const { role, resource, operations } = input;
18
+ const { role, resource, operations, allowRoleOverwrite = false } = input;
17
19
  this.validate({ resource, operations });
18
20
  let allowedVector;
19
21
  if (!this.roles.includes(role)) {
@@ -22,21 +24,30 @@ class AccessControlMatrix {
22
24
  this.matrix.push(allowedVector);
23
25
  assert_1.default(this.roles.length === this.matrix.length, 'Roles are not aligned with Roles added in Matrix');
24
26
  }
25
- else {
27
+ else if (this.roles.includes(role) && (resource || allowRoleOverwrite)) {
26
28
  allowedVector = this.getResourceOperationMatrix({ operations, resource, role });
27
29
  const roleIndex = this.roles.indexOf(role);
28
30
  this.matrix[roleIndex] = allowedVector;
29
31
  }
32
+ else {
33
+ throw new graphql_transformer_core_1.InvalidDirectiveError(`@auth ${role} already exists for ${this.name}`);
34
+ }
30
35
  }
31
36
  hasRole(role) {
32
37
  return this.roles.includes(role);
33
38
  }
39
+ getName() {
40
+ return this.name;
41
+ }
34
42
  getRoles() {
35
43
  return this.roles;
36
44
  }
37
45
  getResources() {
38
46
  return this.resources;
39
47
  }
48
+ hasResource(resource) {
49
+ return this.resources.includes(resource);
50
+ }
40
51
  isAllowed(role, resource, operation) {
41
52
  this.validate({ role, resource, operations: [operation] });
42
53
  const roleIndex = this.roles.indexOf(role);
@@ -88,15 +99,15 @@ class AccessControlMatrix {
88
99
  }
89
100
  validate(input) {
90
101
  if (input.resource && !this.resources.includes(input.resource)) {
91
- throw Error(`Resource: ${input.resource} is not configued in the ACM`);
102
+ throw new graphql_transformer_core_1.TransformerContractError(`Resource: ${input.resource} is not configued in the ACM`);
92
103
  }
93
104
  if (input.role && !this.roles.includes(input.role)) {
94
- throw Error(`Role: ${input.role} does not exist in ACM.`);
105
+ throw new graphql_transformer_core_1.TransformerContractError(`Role: ${input.role} does not exist in ACM.`);
95
106
  }
96
107
  if (input.operations) {
97
108
  input.operations.forEach(operation => {
98
109
  if (this.operations.indexOf(operation) === -1)
99
- throw Error(`Operation: ${operation} does not exist in the ACM.`);
110
+ throw new graphql_transformer_core_1.TransformerContractError(`Operation: ${operation} does not exist in the ACM.`);
100
111
  });
101
112
  }
102
113
  }
@@ -1 +1 @@
1
- {"version":3,"file":"acm.js","sourceRoot":"","sources":["../../src/accesscontrol/acm.ts"],"names":[],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SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;oBAC1C,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;iBACtC;qBAAM;oBACL,gBAAgB,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;iBACtE;aACF;iBAAM;gBACL,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACtC;SACF;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAEO,gBAAgB,CAAC,UAAyB;QAChD,IAAI,aAAa,GAAmB,IAAI,KAAK,EAAE,CAAC;QAChD,KAAK,IAAI,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE;YACrC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;SACpD;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA7KD,kDA6KC"}
@@ -15,7 +15,7 @@ export declare class AuthTransformer extends TransformerAuthBase implements Tran
15
15
  private generateIAMPolicyforAuthRole;
16
16
  private authPolicyResources;
17
17
  private unauthPolicyResources;
18
- constructor(config: AuthTransformerConfig);
18
+ constructor(config?: AuthTransformerConfig);
19
19
  before: (context: TransformerBeforeStepContextProvider) => void;
20
20
  object: (def: ObjectTypeDefinitionNode, directive: DirectiveNode, context: TransformerSchemaVisitStepContextProvider) => void;
21
21
  field: (parent: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, field: FieldDefinitionNode, directive: DirectiveNode, context: TransformerSchemaVisitStepContextProvider) => void;
@@ -23,7 +23,8 @@ export declare class AuthTransformer extends TransformerAuthBase implements Tran
23
23
  generateResolvers: (context: TransformerContextProvider) => void;
24
24
  protectSchemaOperations: (ctx: TransformerTransformSchemaStepContextProvider, def: ObjectTypeDefinitionNode, acm: AccessControlMatrix) => void;
25
25
  protectGetResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
26
- protectListResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
26
+ protectListResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix, indexName?: string) => void;
27
+ protectRelationalResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, field: FieldDefinitionNode, fieldRoles: Array<string> | null) => void;
27
28
  protectSyncResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
28
29
  protectSearchResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
29
30
  protectFieldResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, roles: Array<string>) => void;
@@ -34,6 +35,7 @@ export declare class AuthTransformer extends TransformerAuthBase implements Tran
34
35
  private convertRulesToRoles;
35
36
  private doesTypeHaveRulesForOperation;
36
37
  private getAuthProviders;
38
+ private getRelatedModelObject;
37
39
  private addFieldsToObject;
38
40
  private propagateAuthDirectivesToNestedTypes;
39
41
  private getServiceDirectives;
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-auth-transformer.d.ts","sourceRoot":"","sources":["../src/graphql-auth-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAMpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAIL,6CAA6C,EAC7C,0BAA0B,EAE1B,yCAAyC,EACzC,uBAAuB,EACvB,oCAAoC,EACrC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAKL,qBAAqB,EAerB,cAAc,EAYf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAG5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0BAA0B,OAC1B,wBAAwB,YACnB,MAAM,aACL,MAAM,OACZ,mBAAmB,KACvB,IAAI,CAQL;IAYF,oBAAoB,QACb,0BAA0B,OAC1B,wBAAwB,YACnB,MAAM,aACL,MAAM,SACV,MAAM,MAAM,CAAC,KACnB,IAAI,CA6CL;IACF,qBAAqB,QACd,0BAA0B,OAC1B,wBAAwB,YACnB,MAAM,aACL,MAAM,OACZ,mBAAmB,KACvB,IAAI,CAcL;IACF,qBAAqB,QACd,0BAA0B,OAC1B,wBAAwB,YACnB,MAAM,aACL,MAAM,OACZ,mBAAmB,KACvB,IAAI,CAsBL;IAEF,qBAAqB,QACd,0BAA0B,OAC1B,wBAAwB,YACnB,MAAM,aACL,MAAM,OACZ,mBAAmB,KACvB,IAAI,CAaL;IAEF,2BAA2B,QACpB,0BAA0B,YACrB,MAAM,aACL,MAAM,qBACE,MAAM,cAAc,CAAC,KACvC,IAAI,CAOL;IAKF,OAAO,CAAC,mBAAmB;IAiF3B,OAAO,CAAC,6BAA6B;IAOrC,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,oCAAoC;IA2C5C,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,gCAAgC;IAMxC,OAAO,CAAC,mBAAmB;IAsD3B,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,gCAAgC;IAgBxC,OAAO,CAAC,2BAA2B;IAanC,OAAO,CAAC,4BAA4B;CAYrC"}
1
+ {"version":3,"file":"graphql-auth-transformer.d.ts","sourceRoot":"","sources":["../src/graphql-auth-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAMpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAIL,6CAA6C,EAC7C,0BAA0B,EAE1B,yCAAyC,EACzC,uBAAuB,EACvB,oCAAoC,EACrC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAYL,qBAAqB,EASr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