@aws-amplify/graphql-auth-transformer 0.2.0-graphql-vnext-dev-preview.3 → 0.2.0-graphql-vnext-dev-preview.5
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.
- package/CHANGELOG.md +122 -9
- package/lib/accesscontrol/acm.d.ts +2 -0
- package/lib/accesscontrol/acm.d.ts.map +1 -1
- package/lib/accesscontrol/acm.js +9 -4
- package/lib/accesscontrol/acm.js.map +1 -1
- package/lib/graphql-auth-transformer.d.ts +1 -1
- package/lib/graphql-auth-transformer.d.ts.map +1 -1
- package/lib/graphql-auth-transformer.js +54 -18
- package/lib/graphql-auth-transformer.js.map +1 -1
- package/lib/resolvers/field.d.ts +1 -1
- package/lib/resolvers/field.d.ts.map +1 -1
- package/lib/resolvers/field.js +17 -14
- package/lib/resolvers/field.js.map +1 -1
- package/lib/resolvers/helpers.d.ts +4 -2
- package/lib/resolvers/helpers.d.ts.map +1 -1
- package/lib/resolvers/helpers.js +37 -10
- package/lib/resolvers/helpers.js.map +1 -1
- package/lib/resolvers/index.d.ts +2 -1
- package/lib/resolvers/index.d.ts.map +1 -1
- package/lib/resolvers/index.js +3 -2
- package/lib/resolvers/index.js.map +1 -1
- package/lib/resolvers/mutation.create.d.ts.map +1 -1
- package/lib/resolvers/mutation.create.js +27 -20
- package/lib/resolvers/mutation.create.js.map +1 -1
- package/lib/resolvers/mutation.delete.d.ts.map +1 -1
- package/lib/resolvers/mutation.delete.js +21 -11
- package/lib/resolvers/mutation.delete.js.map +1 -1
- package/lib/resolvers/mutation.update.d.ts.map +1 -1
- package/lib/resolvers/mutation.update.js +23 -10
- package/lib/resolvers/mutation.update.js.map +1 -1
- package/lib/resolvers/query.d.ts +0 -1
- package/lib/resolvers/query.d.ts.map +1 -1
- package/lib/resolvers/query.js +41 -90
- package/lib/resolvers/query.js.map +1 -1
- package/lib/resolvers/search.d.ts +4 -0
- package/lib/resolvers/search.d.ts.map +1 -0
- package/lib/resolvers/search.js +173 -0
- package/lib/resolvers/search.js.map +1 -0
- package/lib/resolvers/subscriptions.d.ts.map +1 -1
- package/lib/resolvers/subscriptions.js +6 -3
- package/lib/resolvers/subscriptions.js.map +1 -1
- package/lib/utils/constants.d.ts +2 -2
- package/lib/utils/constants.d.ts.map +1 -1
- package/lib/utils/constants.js +9 -3
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/definitions.d.ts +14 -12
- package/lib/utils/definitions.d.ts.map +1 -1
- package/lib/utils/definitions.js +2 -0
- package/lib/utils/definitions.js.map +1 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +12 -3
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/schema.d.ts +0 -1
- package/lib/utils/schema.d.ts.map +1 -1
- package/lib/utils/schema.js +14 -17
- package/lib/utils/schema.js.map +1 -1
- package/lib/utils/validations.d.ts +2 -2
- package/lib/utils/validations.d.ts.map +1 -1
- package/lib/utils/validations.js +21 -3
- package/lib/utils/validations.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,41 +3,154 @@
|
|
|
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
|
-
#
|
|
6
|
+
# 0.2.0-graphql-vnext-dev-preview.5 (2021-11-03)
|
|
7
|
+
|
|
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
|
+
* 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))
|
|
17
|
+
* auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
|
|
18
|
+
* 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))
|
|
19
|
+
* **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))
|
|
20
|
+
* 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))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* 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))
|
|
26
|
+
* 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))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# 0.2.0-graphql-vnext-dev-preview.4 (2021-11-03)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* [@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))
|
|
38
|
+
* [@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))
|
|
39
|
+
* 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))
|
|
40
|
+
* 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))
|
|
41
|
+
* 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))
|
|
42
|
+
* 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))
|
|
43
|
+
* auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
|
|
44
|
+
* 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))
|
|
45
|
+
* **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))
|
|
46
|
+
* 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))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
|
|
51
|
+
* 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))
|
|
52
|
+
* 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))
|
|
53
|
+
|
|
7
54
|
|
|
8
|
-
**Note:** Version bump only for package @aws-amplify/graphql-auth-transformer
|
|
9
55
|
|
|
10
56
|
|
|
11
57
|
|
|
58
|
+
# 0.2.0-graphql-vnext-dev-preview.3 (2021-11-03)
|
|
12
59
|
|
|
13
60
|
|
|
14
|
-
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* [@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))
|
|
64
|
+
* [@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))
|
|
65
|
+
* 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))
|
|
66
|
+
* 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))
|
|
67
|
+
* 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))
|
|
68
|
+
* 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))
|
|
69
|
+
* auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
|
|
70
|
+
* 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))
|
|
71
|
+
* **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))
|
|
72
|
+
* 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))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Features
|
|
76
|
+
|
|
77
|
+
* 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))
|
|
78
|
+
* 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))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# 0.2.0-graphql-vnext-dev-preview.2 (2021-11-03)
|
|
15
85
|
|
|
16
86
|
|
|
17
87
|
### Bug Fixes
|
|
18
88
|
|
|
19
|
-
*
|
|
89
|
+
* [@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))
|
|
90
|
+
* [@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))
|
|
91
|
+
* 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))
|
|
92
|
+
* 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))
|
|
93
|
+
* 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))
|
|
94
|
+
* 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))
|
|
95
|
+
* auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
|
|
96
|
+
* 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))
|
|
97
|
+
* **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))
|
|
98
|
+
* 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))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* 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))
|
|
104
|
+
* 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))
|
|
105
|
+
|
|
106
|
+
|
|
20
107
|
|
|
21
108
|
|
|
22
109
|
|
|
110
|
+
# 0.2.0-graphql-vnext-dev-preview.1 (2021-11-03)
|
|
23
111
|
|
|
24
112
|
|
|
25
|
-
|
|
113
|
+
### Bug Fixes
|
|
114
|
+
|
|
115
|
+
* [@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))
|
|
116
|
+
* [@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))
|
|
117
|
+
* 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))
|
|
118
|
+
* 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))
|
|
119
|
+
* 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))
|
|
120
|
+
* 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))
|
|
121
|
+
* auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
|
|
122
|
+
* 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))
|
|
123
|
+
* **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))
|
|
124
|
+
* 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))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Features
|
|
26
128
|
|
|
27
|
-
|
|
129
|
+
* 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))
|
|
130
|
+
* 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))
|
|
28
131
|
|
|
29
132
|
|
|
30
133
|
|
|
31
134
|
|
|
32
135
|
|
|
33
|
-
# 0.2.0-graphql-vnext-dev-preview.0 (2021-
|
|
136
|
+
# 0.2.0-graphql-vnext-dev-preview.0 (2021-11-03)
|
|
34
137
|
|
|
35
138
|
|
|
36
139
|
### Bug Fixes
|
|
37
140
|
|
|
38
|
-
*
|
|
141
|
+
* [@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))
|
|
142
|
+
* [@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))
|
|
143
|
+
* 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))
|
|
144
|
+
* 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))
|
|
145
|
+
* 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))
|
|
146
|
+
* 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))
|
|
147
|
+
* auth vnext validation fixes ([#8551](https://github.com/aws-amplify/amplify-cli/issues/8551)) ([2cfe6ce](https://github.com/aws-amplify/amplify-cli/commit/2cfe6ce15e9adb1e5824e3d011deb9e4d5cf5d4d))
|
|
148
|
+
* 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))
|
|
149
|
+
* **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))
|
|
150
|
+
* 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))
|
|
39
151
|
|
|
40
152
|
|
|
41
153
|
### Features
|
|
42
154
|
|
|
43
|
-
* add
|
|
155
|
+
* 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))
|
|
156
|
+
* 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,6 +1,7 @@
|
|
|
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;
|
|
@@ -8,6 +9,7 @@ declare type SetRoleInput = {
|
|
|
8
9
|
resource?: string;
|
|
9
10
|
};
|
|
10
11
|
export declare class AccessControlMatrix {
|
|
12
|
+
private name;
|
|
11
13
|
private roles;
|
|
12
14
|
private operations;
|
|
13
15
|
private resources;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acm.d.ts","sourceRoot":"","sources":["../../src/accesscontrol/acm.ts"],"names":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;CAOzB"}
|
package/lib/accesscontrol/acm.js
CHANGED
|
@@ -5,8 +5,10 @@ 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();
|
|
@@ -22,11 +24,14 @@ 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) {
|
|
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);
|
|
@@ -91,15 +96,15 @@ class AccessControlMatrix {
|
|
|
91
96
|
}
|
|
92
97
|
validate(input) {
|
|
93
98
|
if (input.resource && !this.resources.includes(input.resource)) {
|
|
94
|
-
throw
|
|
99
|
+
throw new graphql_transformer_core_1.TransformerContractError(`Resource: ${input.resource} is not configued in the ACM`);
|
|
95
100
|
}
|
|
96
101
|
if (input.role && !this.roles.includes(input.role)) {
|
|
97
|
-
throw
|
|
102
|
+
throw new graphql_transformer_core_1.TransformerContractError(`Role: ${input.role} does not exist in ACM.`);
|
|
98
103
|
}
|
|
99
104
|
if (input.operations) {
|
|
100
105
|
input.operations.forEach(operation => {
|
|
101
106
|
if (this.operations.indexOf(operation) === -1)
|
|
102
|
-
throw
|
|
107
|
+
throw new graphql_transformer_core_1.TransformerContractError(`Operation: ${operation} does not exist in the ACM.`);
|
|
103
108
|
});
|
|
104
109
|
}
|
|
105
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acm.js","sourceRoot":"","sources":["../../src/accesscontrol/acm.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;
|
|
1
|
+
{"version":3,"file":"acm.js","sourceRoot":"","sources":["../../src/accesscontrol/acm.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,oFAAwG;AAiCxG,MAAa,mBAAmB;IAO9B,YAAY,MAAiB;QAC3B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAC3B,CAAC;IAEM,OAAO,CAAC,KAAmB;QAChC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;QACxC,IAAI,aAAoC,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC9B,aAAa,GAAG,IAAI,CAAC,0BAA0B,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC1E,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,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AAC,GAAG,aAAa,CAAC;YAChD,OAAO,gBAAgB,CAAC;SACzB;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC9C,IAAI,QAAQ,EAAE;gBACZ,IAAI,IAAI,CAAC,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;AAzKD,kDAyKC"}
|
|
@@ -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
|
|
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;
|
|
@@ -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,
|
|
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,EASrB,cAAc,EAef,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAG5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAuCtD,qBAAa,eAAgB,SAAQ,mBAAoB,YAAW,uBAAuB;IACzF,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,uBAAuB,CAA0B;IAEzD,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,eAAe,CAAmC;IAC1D,OAAO,CAAC,kBAAkB,CAAmC;IAE7D,OAAO,CAAC,oBAAoB,CAA2C;IAEvE,OAAO,CAAC,iBAAiB,CAA2B;IAEpD,OAAO,CAAC,8BAA8B,CAAU;IAChD,OAAO,CAAC,4BAA4B,CAAU;IAC9C,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAA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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;IAqF3B,OAAO,CAAC,6BAA6B;IAOrC,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,oCAAoC;IA2C5C,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,gCAAgC;IAQxC,OAAO,CAAC,mBAAmB;IAoD3B,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,gCAAgC;IAgBxC,OAAO,CAAC,2BAA2B;IAanC,OAAO,CAAC,4BAA4B;CAYrC"}
|
|
@@ -33,12 +33,13 @@ const resolvers_1 = require("./resolvers");
|
|
|
33
33
|
const graphql_transformer_common_2 = require("graphql-transformer-common");
|
|
34
34
|
const field_1 = require("./resolvers/field");
|
|
35
35
|
class AuthTransformer extends graphql_transformer_core_1.TransformerAuthBase {
|
|
36
|
-
constructor(config) {
|
|
36
|
+
constructor(config = {}) {
|
|
37
37
|
super('amplify-auth-transformer', utils_1.authDirectiveDefinition);
|
|
38
38
|
this.authPolicyResources = new Set();
|
|
39
39
|
this.unauthPolicyResources = new Set();
|
|
40
40
|
this.before = (context) => {
|
|
41
|
-
|
|
41
|
+
var _a;
|
|
42
|
+
this.config.authConfig = (_a = this.config.authConfig) !== null && _a !== void 0 ? _a : context.authConfig;
|
|
42
43
|
this.configuredAuthProviders = utils_1.getConfiguredAuthProviders(this.config);
|
|
43
44
|
};
|
|
44
45
|
this.object = (def, directive, context) => {
|
|
@@ -51,8 +52,9 @@ class AuthTransformer extends graphql_transformer_core_1.TransformerAuthBase {
|
|
|
51
52
|
const authDir = new graphql_transformer_core_1.DirectiveWrapper(directive);
|
|
52
53
|
const rules = authDir.getArguments({ rules: [] }).rules;
|
|
53
54
|
utils_1.ensureAuthRuleDefaults(rules);
|
|
54
|
-
utils_1.validateRules(rules, this.configuredAuthProviders);
|
|
55
|
+
utils_1.validateRules(rules, this.configuredAuthProviders, def.name.value);
|
|
55
56
|
const acm = new accesscontrol_1.AccessControlMatrix({
|
|
57
|
+
name: def.name.value,
|
|
56
58
|
operations: utils_1.MODEL_OPERATIONS,
|
|
57
59
|
resources: utils_1.collectFieldNames(def),
|
|
58
60
|
});
|
|
@@ -82,7 +84,7 @@ Static group authorization should perform as expected.`);
|
|
|
82
84
|
const authDir = new graphql_transformer_core_1.DirectiveWrapper(directive);
|
|
83
85
|
const rules = authDir.getArguments({ rules: [] }).rules;
|
|
84
86
|
utils_1.ensureAuthRuleDefaults(rules);
|
|
85
|
-
utils_1.validateFieldRules(rules, isParentTypeBuiltinType, modelDirective !== undefined, this.configuredAuthProviders);
|
|
87
|
+
utils_1.validateFieldRules(rules, isParentTypeBuiltinType, modelDirective !== undefined, this.configuredAuthProviders, field.name.value);
|
|
86
88
|
this.setAuthPolicyFlag(rules);
|
|
87
89
|
this.setUnauthPolicyFlag(rules);
|
|
88
90
|
this.addFieldToResourceReferences(parent.name.value, field.name.value, rules);
|
|
@@ -91,6 +93,7 @@ Static group authorization should perform as expected.`);
|
|
|
91
93
|
if (!this.modelDirectiveConfig.has(typeName)) {
|
|
92
94
|
this.modelDirectiveConfig.set(typeName, utils_1.getModelConfig(modelDirective, typeName, context.isProjectUsingDataStore()));
|
|
93
95
|
acm = new accesscontrol_1.AccessControlMatrix({
|
|
96
|
+
name: parent.name.value,
|
|
94
97
|
operations: utils_1.MODEL_OPERATIONS,
|
|
95
98
|
resources: utils_1.collectFieldNames(parent),
|
|
96
99
|
});
|
|
@@ -106,6 +109,7 @@ Static group authorization should perform as expected.`);
|
|
|
106
109
|
const staticRules = rules.filter((rule) => rule.allow !== 'owner' && !rule.groupsField);
|
|
107
110
|
const typeFieldName = `${typeName}:${fieldName}`;
|
|
108
111
|
const acm = new accesscontrol_1.AccessControlMatrix({
|
|
112
|
+
name: typeFieldName,
|
|
109
113
|
operations: ['read'],
|
|
110
114
|
resources: [typeFieldName],
|
|
111
115
|
});
|
|
@@ -114,6 +118,7 @@ Static group authorization should perform as expected.`);
|
|
|
114
118
|
}
|
|
115
119
|
};
|
|
116
120
|
this.transformSchema = (context) => {
|
|
121
|
+
const searchableAggregateServiceDirectives = new Set();
|
|
117
122
|
const getOwnerFields = (acm) => {
|
|
118
123
|
return acm.getRoles().reduce((prev, role) => {
|
|
119
124
|
if (this.roleMap.get(role).strategy === 'owner')
|
|
@@ -123,9 +128,13 @@ Static group authorization should perform as expected.`);
|
|
|
123
128
|
};
|
|
124
129
|
for (let [modelName, acm] of this.authModelConfig) {
|
|
125
130
|
const def = context.output.getObject(modelName);
|
|
131
|
+
const modelHasSearchable = def.directives.some(dir => dir.name.value === 'searchable');
|
|
126
132
|
this.addFieldsToObject(context, modelName, getOwnerFields(acm));
|
|
127
133
|
const providers = this.getAuthProviders(acm.getRoles());
|
|
128
134
|
const directives = this.getServiceDirectives(providers, providers.length === 0 ? this.shouldAddDefaultServiceDirective() : false);
|
|
135
|
+
if (modelHasSearchable) {
|
|
136
|
+
providers.forEach(p => searchableAggregateServiceDirectives.add(p));
|
|
137
|
+
}
|
|
129
138
|
if (directives.length > 0) {
|
|
130
139
|
utils_1.extendTypeWithDirectives(context, modelName, directives);
|
|
131
140
|
}
|
|
@@ -140,6 +149,12 @@ Static group authorization should perform as expected.`);
|
|
|
140
149
|
utils_1.addDirectivesToField(context, typeName, fieldName, directives);
|
|
141
150
|
}
|
|
142
151
|
}
|
|
152
|
+
if (searchableAggregateServiceDirectives.size > 0) {
|
|
153
|
+
const serviceDirectives = this.getServiceDirectives(Array.from(searchableAggregateServiceDirectives), false);
|
|
154
|
+
for (let aggType of utils_1.SEARCHABLE_AGGREGATE_TYPES) {
|
|
155
|
+
utils_1.extendTypeWithDirectives(context, aggType, serviceDirectives);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
143
158
|
};
|
|
144
159
|
this.generateResolvers = (context) => {
|
|
145
160
|
var _a, _b;
|
|
@@ -222,7 +237,7 @@ Static group authorization should perform as expected.`);
|
|
|
222
237
|
}
|
|
223
238
|
};
|
|
224
239
|
this.protectSchemaOperations = (ctx, def, acm) => {
|
|
225
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
240
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
226
241
|
const modelConfig = this.modelDirectiveConfig.get(def.name.value);
|
|
227
242
|
const indexKeyName = `${def.name.value}:indicies`;
|
|
228
243
|
const searchableDirective = def.directives.find(dir => dir.name.value === 'searchable');
|
|
@@ -239,9 +254,10 @@ Static group authorization should perform as expected.`);
|
|
|
239
254
|
};
|
|
240
255
|
addServiceDirective(ctx.output.getQueryTypeName(), 'read', (_a = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.queries) === null || _a === void 0 ? void 0 : _a.get);
|
|
241
256
|
addServiceDirective(ctx.output.getQueryTypeName(), 'read', (_b = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.queries) === null || _b === void 0 ? void 0 : _b.list);
|
|
242
|
-
addServiceDirective(ctx.output.
|
|
243
|
-
addServiceDirective(ctx.output.getMutationTypeName(), '
|
|
244
|
-
addServiceDirective(ctx.output.getMutationTypeName(), '
|
|
257
|
+
addServiceDirective(ctx.output.getQueryTypeName(), 'read', (_c = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.queries) === null || _c === void 0 ? void 0 : _c.sync);
|
|
258
|
+
addServiceDirective(ctx.output.getMutationTypeName(), 'create', (_d = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.mutations) === null || _d === void 0 ? void 0 : _d.create);
|
|
259
|
+
addServiceDirective(ctx.output.getMutationTypeName(), 'update', (_e = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.mutations) === null || _e === void 0 ? void 0 : _e.update);
|
|
260
|
+
addServiceDirective(ctx.output.getMutationTypeName(), 'delete', (_f = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.mutations) === null || _f === void 0 ? void 0 : _f.delete);
|
|
245
261
|
if (ctx.metadata.has(indexKeyName)) {
|
|
246
262
|
for (let index of ctx.metadata.get(indexKeyName).values()) {
|
|
247
263
|
addServiceDirective(ctx.output.getQueryTypeName(), 'read', index.split(':')[1]);
|
|
@@ -252,24 +268,24 @@ Static group authorization should perform as expected.`);
|
|
|
252
268
|
addServiceDirective(ctx.output.getQueryTypeName(), 'read', config.queries.search);
|
|
253
269
|
}
|
|
254
270
|
const subscriptions = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.subscriptions;
|
|
255
|
-
if (subscriptions
|
|
271
|
+
if ((subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.level) === graphql_model_transformer_1.SubscriptionLevel.on) {
|
|
256
272
|
const subscriptionArguments = acm
|
|
257
273
|
.getRolesPerOperation('read')
|
|
258
274
|
.map(role => this.roleMap.get(role))
|
|
259
275
|
.filter(roleDef => { var _a; return roleDef.strategy === 'owner' && !utils_1.fieldIsList((_a = def.fields) !== null && _a !== void 0 ? _a : [], roleDef.entity); });
|
|
260
|
-
if (subscriptions.onCreate && ((
|
|
276
|
+
if (subscriptions.onCreate && ((_g = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.mutations) === null || _g === void 0 ? void 0 : _g.create)) {
|
|
261
277
|
for (let onCreateSub of subscriptions.onCreate) {
|
|
262
278
|
addServiceDirective(ctx.output.getSubscriptionTypeName(), 'read', onCreateSub);
|
|
263
279
|
utils_1.addSubscriptionArguments(ctx, onCreateSub, subscriptionArguments);
|
|
264
280
|
}
|
|
265
281
|
}
|
|
266
|
-
if (subscriptions.onUpdate && ((
|
|
282
|
+
if (subscriptions.onUpdate && ((_h = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.mutations) === null || _h === void 0 ? void 0 : _h.update)) {
|
|
267
283
|
for (let onUpdateSub of subscriptions.onUpdate) {
|
|
268
284
|
addServiceDirective(ctx.output.getSubscriptionTypeName(), 'read', onUpdateSub);
|
|
269
285
|
utils_1.addSubscriptionArguments(ctx, onUpdateSub, subscriptionArguments);
|
|
270
286
|
}
|
|
271
287
|
}
|
|
272
|
-
if (subscriptions.onDelete && ((
|
|
288
|
+
if (subscriptions.onDelete && ((_j = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.mutations) === null || _j === void 0 ? void 0 : _j.delete)) {
|
|
273
289
|
for (let onDeleteSub of subscriptions.onDelete) {
|
|
274
290
|
addServiceDirective(ctx.output.getSubscriptionTypeName(), 'read', onDeleteSub);
|
|
275
291
|
utils_1.addSubscriptionArguments(ctx, onDeleteSub, subscriptionArguments);
|
|
@@ -347,9 +363,25 @@ Static group authorization should perform as expected.`);
|
|
|
347
363
|
};
|
|
348
364
|
this.protectSearchResolver = (ctx, def, typeName, fieldName, acm) => {
|
|
349
365
|
var _a;
|
|
366
|
+
const acmFields = acm.getResources();
|
|
367
|
+
const modelFields = (_a = def.fields) !== null && _a !== void 0 ? _a : [];
|
|
368
|
+
const allowedAggFields = modelFields.map(f => f.name.value).filter(f => !acmFields.includes(f));
|
|
369
|
+
let leastAllowedFields = acmFields;
|
|
350
370
|
const resolver = ctx.resolvers.getResolver(typeName, fieldName);
|
|
351
|
-
const
|
|
352
|
-
|
|
371
|
+
const readRoleDefinitions = acm.getRolesPerOperation('read').map(role => {
|
|
372
|
+
const allowedFields = acmFields.filter(resource => acm.isAllowed(role, resource, 'read'));
|
|
373
|
+
const roleDefinition = this.roleMap.get(role);
|
|
374
|
+
if (allowedFields.length !== acmFields.length || !roleDefinition.static) {
|
|
375
|
+
roleDefinition.allowedFields = allowedFields;
|
|
376
|
+
leastAllowedFields = leastAllowedFields.filter(f => allowedFields.includes(f));
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
roleDefinition.allowedFields = null;
|
|
380
|
+
}
|
|
381
|
+
return roleDefinition;
|
|
382
|
+
});
|
|
383
|
+
allowedAggFields.push(...leastAllowedFields);
|
|
384
|
+
const authExpression = resolvers_1.generateAuthExpressionForSearchQueries(this.configuredAuthProviders, readRoleDefinitions, modelFields, allowedAggFields);
|
|
353
385
|
resolver.addToSlot('auth', graphql_transformer_core_1.MappingTemplate.s3MappingTemplateFromString(authExpression, `${typeName}.${fieldName}.{slotName}.{slotIndex}.req.vtl`));
|
|
354
386
|
};
|
|
355
387
|
this.protectFieldResolver = (ctx, def, typeName, fieldName, roles) => {
|
|
@@ -370,7 +402,7 @@ Static group authorization should perform as expected.`);
|
|
|
370
402
|
const fieldAuthExpression = resolvers_1.generateAuthExpressionForField(this.configuredAuthProviders, roleDefinitions, (_a = def.fields) !== null && _a !== void 0 ? _a : []);
|
|
371
403
|
const subsEnabled = hasModelDirective ? this.modelDirectiveConfig.get(typeName).subscriptions.level === 'on' : false;
|
|
372
404
|
const fieldResponse = resolvers_1.generateFieldAuthResponse('Mutation', fieldName, subsEnabled);
|
|
373
|
-
const resolver = ctx.resolvers.addResolver(typeName, fieldName, new graphql_transformer_core_1.TransformerResolver(typeName, fieldName, graphql_transformer_core_1.MappingTemplate.s3MappingTemplateFromString(fieldAuthExpression, `${typeName}.${fieldName}.req.vtl`), graphql_transformer_core_1.MappingTemplate.s3MappingTemplateFromString(fieldResponse, `${typeName}.${fieldName}.res.vtl`), ['init'], ['finish']));
|
|
405
|
+
const resolver = ctx.resolvers.addResolver(typeName, fieldName, new graphql_transformer_core_1.TransformerResolver(typeName, fieldName, graphql_transformer_common_1.ResolverResourceIDs.ResolverResourceID(typeName, fieldName), graphql_transformer_core_1.MappingTemplate.s3MappingTemplateFromString(fieldAuthExpression, `${typeName}.${fieldName}.req.vtl`), graphql_transformer_core_1.MappingTemplate.s3MappingTemplateFromString(fieldResponse, `${typeName}.${fieldName}.res.vtl`), ['init'], ['finish']));
|
|
374
406
|
resolver.mapToStack(stack);
|
|
375
407
|
}
|
|
376
408
|
};
|
|
@@ -455,6 +487,10 @@ Static group authorization should perform as expected.`);
|
|
|
455
487
|
roleName = 'apiKey:public';
|
|
456
488
|
roleDefinition = { provider: rule.provider, strategy: rule.allow, static: true };
|
|
457
489
|
break;
|
|
490
|
+
case 'function':
|
|
491
|
+
roleName = 'function:custom';
|
|
492
|
+
roleDefinition = { provider: rule.provider, strategy: rule.allow, static: true };
|
|
493
|
+
break;
|
|
458
494
|
case 'iam':
|
|
459
495
|
roleName = `iam:${rule.allow}`;
|
|
460
496
|
roleDefinition = {
|
|
@@ -524,7 +560,7 @@ Static group authorization should perform as expected.`);
|
|
|
524
560
|
for (let role of roles) {
|
|
525
561
|
providers.add(this.roleMap.get(role).provider);
|
|
526
562
|
}
|
|
527
|
-
if (this.configuredAuthProviders.
|
|
563
|
+
if (this.configuredAuthProviders.hasAdminRolesEnabled) {
|
|
528
564
|
providers.add('iam');
|
|
529
565
|
}
|
|
530
566
|
return Array.from(providers);
|
|
@@ -608,12 +644,12 @@ Static group authorization should perform as expected.`);
|
|
|
608
644
|
return directives;
|
|
609
645
|
}
|
|
610
646
|
shouldAddDefaultServiceDirective() {
|
|
611
|
-
return this.configuredAuthProviders.
|
|
647
|
+
return (this.configuredAuthProviders.hasAdminRolesEnabled && this.config.authConfig.defaultAuthentication.authenticationType !== 'AWS_IAM');
|
|
612
648
|
}
|
|
613
649
|
generateIAMPolicies(ctx) {
|
|
614
650
|
if (this.generateIAMPolicyforAuthRole) {
|
|
615
651
|
if (this.authPolicyResources.size === 0) {
|
|
616
|
-
if (!this.configuredAuthProviders.
|
|
652
|
+
if (!this.configuredAuthProviders.hasAdminRolesEnabled) {
|
|
617
653
|
throw new graphql_transformer_core_1.TransformerContractError('AuthRole policies should be generated, but no resources were added.');
|
|
618
654
|
}
|
|
619
655
|
}
|