@aws-amplify/data-schema 0.18.1 → 0.18.2
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/dist/cjs/Authorization.js +17 -17
- package/dist/cjs/Authorization.js.map +1 -1
- package/dist/cjs/SchemaProcessor.js +3 -1
- package/dist/cjs/SchemaProcessor.js.map +1 -1
- package/dist/esm/Authorization.d.ts +16 -16
- package/dist/esm/Authorization.mjs +17 -17
- package/dist/esm/Authorization.mjs.map +1 -1
- package/dist/esm/SchemaProcessor.mjs +3 -1
- package/dist/esm/SchemaProcessor.mjs.map +1 -1
- package/dist/esm/runtime/bridge-types.d.ts +1 -1
- package/dist/esm/runtime/client/index.d.ts +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/Authorization.ts +17 -17
- package/src/SchemaProcessor.ts +3 -1
- package/src/runtime/bridge-types.ts +1 -0
- package/src/runtime/client/index.ts +1 -0
|
@@ -5,19 +5,19 @@ declare const __data: unique symbol;
|
|
|
5
5
|
*
|
|
6
6
|
* This list should not be used if you need to restrict available providers
|
|
7
7
|
* according to an auth strategcy. E.g., `public` auth can only be facilitated
|
|
8
|
-
* by `apiKey` and `
|
|
8
|
+
* by `apiKey` and `identityPool` providers.
|
|
9
9
|
*/
|
|
10
|
-
export declare const Providers: readonly ["apiKey", "
|
|
10
|
+
export declare const Providers: readonly ["apiKey", "identityPool", "userPools", "oidc", "function"];
|
|
11
11
|
export type Provider = (typeof Providers)[number];
|
|
12
12
|
/**
|
|
13
13
|
* The subset of auth providers that can facilitate `public` auth.
|
|
14
14
|
*/
|
|
15
|
-
export declare const PublicProviders: readonly ["apiKey", "
|
|
15
|
+
export declare const PublicProviders: readonly ["apiKey", "identityPool"];
|
|
16
16
|
export type PublicProvider = (typeof PublicProviders)[number];
|
|
17
17
|
/**
|
|
18
18
|
* The subset of auth providers that can facilitate `private` auth.
|
|
19
19
|
*/
|
|
20
|
-
export declare const PrivateProviders: readonly ["userPools", "oidc", "
|
|
20
|
+
export declare const PrivateProviders: readonly ["userPools", "oidc", "identityPool"];
|
|
21
21
|
export type PrivateProvider = (typeof PrivateProviders)[number];
|
|
22
22
|
/**
|
|
23
23
|
* The subset of auth providers that can facilitate `owner` auth.
|
|
@@ -84,7 +84,7 @@ declare function identityClaim<SELF extends Authorization<any, any, any>>(this:
|
|
|
84
84
|
declare function withClaimIn<SELF extends Authorization<any, any, any>>(this: SELF, property: string): Omit<SELF, "withClaimIn">;
|
|
85
85
|
/**
|
|
86
86
|
* Defines an authorization rule for your data models and fields. First choose an authorization strategy (`public`,
|
|
87
|
-
* `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `
|
|
87
|
+
* `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `identitypool`, `userPools`, `oidc`, or `function`)
|
|
88
88
|
* and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.
|
|
89
89
|
*/
|
|
90
90
|
export declare const allow: {
|
|
@@ -96,16 +96,16 @@ export declare const allow: {
|
|
|
96
96
|
to: typeof to;
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
|
-
* Authorize unauthenticated users by using
|
|
99
|
+
* Authorize unauthenticated users by using IDENTITYPOOL based authorization.
|
|
100
100
|
* @returns an authorization rule for unauthenticated users
|
|
101
101
|
*/
|
|
102
102
|
readonly guest: () => Authorization<"public", undefined, false> & {
|
|
103
103
|
to: typeof to;
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
106
|
-
* Authorize authenticated users. By default, `.
|
|
107
|
-
* use `.authenticated("
|
|
108
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
106
|
+
* Authorize authenticated users. By default, `.authenticated()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
107
|
+
* use `.authenticated("identityPool")` or `.authenticated("oidc")` to use identityPool or OIDC based authorization for authenticated users.
|
|
108
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
109
109
|
* @returns an authorization rule for authenticated users
|
|
110
110
|
*/
|
|
111
111
|
readonly authenticated: (provider?: PrivateProvider) => Authorization<"private", undefined, false> & {
|
|
@@ -123,7 +123,7 @@ export declare const allow: {
|
|
|
123
123
|
* To change the specific claim that should be used as the user identifier within the owner field, chain the
|
|
124
124
|
* `.identityClaim(...)` method.
|
|
125
125
|
*
|
|
126
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
126
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
127
127
|
* @returns an authorization rule for authenticated users
|
|
128
128
|
*/
|
|
129
129
|
readonly owner: (provider?: OwnerProviders) => Authorization<"owner", "owner", false> & {
|
|
@@ -140,7 +140,7 @@ export declare const allow: {
|
|
|
140
140
|
* `.identityClaim(...)` method.
|
|
141
141
|
*
|
|
142
142
|
* @param ownerField the field that contains the owner information
|
|
143
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
143
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
144
144
|
* @returns an authorization rule for authenticated users
|
|
145
145
|
*/
|
|
146
146
|
readonly ownerDefinedIn: <T extends string>(ownerField: T, provider?: OwnerProviders) => Authorization<"owner", T, false> & {
|
|
@@ -161,7 +161,7 @@ export declare const allow: {
|
|
|
161
161
|
* `.identityClaim(...)` method.
|
|
162
162
|
*
|
|
163
163
|
* @param ownersField the field that contains the owners information
|
|
164
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
164
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
165
165
|
* @returns an authorization rule for authenticated users
|
|
166
166
|
*/
|
|
167
167
|
readonly ownersDefinedIn: <T_1 extends string>(ownersField: T_1, provider?: OwnerProviders) => Authorization<"owner", T_1, true> & {
|
|
@@ -259,14 +259,14 @@ export declare const allowForCustomOperations: {
|
|
|
259
259
|
*/
|
|
260
260
|
readonly publicApiKey: () => Authorization<"public", undefined, false>;
|
|
261
261
|
/**
|
|
262
|
-
* Authorize unauthenticated users by using
|
|
262
|
+
* Authorize unauthenticated users by using identityPool based authorization.
|
|
263
263
|
* @returns an authorization rule for unauthenticated users
|
|
264
264
|
*/
|
|
265
265
|
readonly guest: () => Authorization<"public", undefined, false>;
|
|
266
266
|
/**
|
|
267
267
|
* Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
268
|
-
* use `.authenticated("
|
|
269
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
268
|
+
* use `.authenticated("identityPool")` or `.authenticated("oidc")` to use Identity Pool or OIDC based authorization for authenticated users.
|
|
269
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
270
270
|
* @returns an authorization rule for authenticated users
|
|
271
271
|
*/
|
|
272
272
|
readonly authenticated: (provider?: PrivateProvider) => Authorization<"private", undefined, false>;
|
|
@@ -347,7 +347,7 @@ export type ImpliedAuthField<T extends Authorization<any, any, any>> = T extends
|
|
|
347
347
|
export type ImpliedAuthFields<T extends Authorization<any, any, any>> = ImpliedAuthField<T> extends never ? never : UnionToIntersection<ImpliedAuthField<T>>;
|
|
348
348
|
export declare const accessData: <T extends Authorization<any, any, any>>(authorization: T) => {
|
|
349
349
|
strategy?: any;
|
|
350
|
-
provider?: "function" | "apiKey" | "
|
|
350
|
+
provider?: "function" | "apiKey" | "identityPool" | "oidc" | "userPools" | undefined;
|
|
351
351
|
operations?: ("create" | "get" | "update" | "delete" | "list" | "search" | "read" | "sync" | "listen")[] | undefined;
|
|
352
352
|
groupOrOwnerField?: any;
|
|
353
353
|
groups?: string[] | undefined;
|
|
@@ -4,11 +4,11 @@ const __data = Symbol('data');
|
|
|
4
4
|
*
|
|
5
5
|
* This list should not be used if you need to restrict available providers
|
|
6
6
|
* according to an auth strategcy. E.g., `public` auth can only be facilitated
|
|
7
|
-
* by `apiKey` and `
|
|
7
|
+
* by `apiKey` and `identityPool` providers.
|
|
8
8
|
*/
|
|
9
9
|
const Providers = [
|
|
10
10
|
'apiKey',
|
|
11
|
-
'
|
|
11
|
+
'identityPool',
|
|
12
12
|
'userPools',
|
|
13
13
|
'oidc',
|
|
14
14
|
'function',
|
|
@@ -16,11 +16,11 @@ const Providers = [
|
|
|
16
16
|
/**
|
|
17
17
|
* The subset of auth providers that can facilitate `public` auth.
|
|
18
18
|
*/
|
|
19
|
-
const PublicProviders = ['apiKey', '
|
|
19
|
+
const PublicProviders = ['apiKey', 'identityPool'];
|
|
20
20
|
/**
|
|
21
21
|
* The subset of auth providers that can facilitate `private` auth.
|
|
22
22
|
*/
|
|
23
|
-
const PrivateProviders = ['userPools', 'oidc', '
|
|
23
|
+
const PrivateProviders = ['userPools', 'oidc', 'identityPool'];
|
|
24
24
|
/**
|
|
25
25
|
* The subset of auth providers that can facilitate `owner` auth.
|
|
26
26
|
*/
|
|
@@ -112,7 +112,7 @@ function authData(defaults, builderMethods) {
|
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* Defines an authorization rule for your data models and fields. First choose an authorization strategy (`public`,
|
|
115
|
-
* `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `
|
|
115
|
+
* `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `identitypool`, `userPools`, `oidc`, or `function`)
|
|
116
116
|
* and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.
|
|
117
117
|
*/
|
|
118
118
|
const allow = {
|
|
@@ -129,21 +129,21 @@ const allow = {
|
|
|
129
129
|
});
|
|
130
130
|
},
|
|
131
131
|
/**
|
|
132
|
-
* Authorize unauthenticated users by using
|
|
132
|
+
* Authorize unauthenticated users by using IDENTITYPOOL based authorization.
|
|
133
133
|
* @returns an authorization rule for unauthenticated users
|
|
134
134
|
*/
|
|
135
135
|
guest() {
|
|
136
136
|
return authData({
|
|
137
137
|
strategy: 'public',
|
|
138
|
-
provider: '
|
|
138
|
+
provider: 'identityPool',
|
|
139
139
|
}, {
|
|
140
140
|
to,
|
|
141
141
|
});
|
|
142
142
|
},
|
|
143
143
|
/**
|
|
144
|
-
* Authorize authenticated users. By default, `.
|
|
145
|
-
* use `.authenticated("
|
|
146
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
144
|
+
* Authorize authenticated users. By default, `.authenticated()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
145
|
+
* use `.authenticated("identityPool")` or `.authenticated("oidc")` to use identityPool or OIDC based authorization for authenticated users.
|
|
146
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
147
147
|
* @returns an authorization rule for authenticated users
|
|
148
148
|
*/
|
|
149
149
|
authenticated(provider) {
|
|
@@ -167,7 +167,7 @@ const allow = {
|
|
|
167
167
|
* To change the specific claim that should be used as the user identifier within the owner field, chain the
|
|
168
168
|
* `.identityClaim(...)` method.
|
|
169
169
|
*
|
|
170
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
170
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
171
171
|
* @returns an authorization rule for authenticated users
|
|
172
172
|
*/
|
|
173
173
|
owner(provider) {
|
|
@@ -191,7 +191,7 @@ const allow = {
|
|
|
191
191
|
* `.identityClaim(...)` method.
|
|
192
192
|
*
|
|
193
193
|
* @param ownerField the field that contains the owner information
|
|
194
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
194
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
195
195
|
* @returns an authorization rule for authenticated users
|
|
196
196
|
*/
|
|
197
197
|
ownerDefinedIn(ownerField, provider) {
|
|
@@ -219,7 +219,7 @@ const allow = {
|
|
|
219
219
|
* `.identityClaim(...)` method.
|
|
220
220
|
*
|
|
221
221
|
* @param ownersField the field that contains the owners information
|
|
222
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
222
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
223
223
|
* @returns an authorization rule for authenticated users
|
|
224
224
|
*/
|
|
225
225
|
ownersDefinedIn(ownersField, provider) {
|
|
@@ -362,19 +362,19 @@ const allowForCustomOperations = {
|
|
|
362
362
|
}, {});
|
|
363
363
|
},
|
|
364
364
|
/**
|
|
365
|
-
* Authorize unauthenticated users by using
|
|
365
|
+
* Authorize unauthenticated users by using identityPool based authorization.
|
|
366
366
|
* @returns an authorization rule for unauthenticated users
|
|
367
367
|
*/
|
|
368
368
|
guest() {
|
|
369
369
|
return authData({
|
|
370
370
|
strategy: 'public',
|
|
371
|
-
provider: '
|
|
371
|
+
provider: 'identityPool',
|
|
372
372
|
}, {});
|
|
373
373
|
},
|
|
374
374
|
/**
|
|
375
375
|
* Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
376
|
-
* use `.authenticated("
|
|
377
|
-
* @param provider the authentication provider - supports "userPools", "
|
|
376
|
+
* use `.authenticated("identityPool")` or `.authenticated("oidc")` to use Identity Pool or OIDC based authorization for authenticated users.
|
|
377
|
+
* @param provider the authentication provider - supports "userPools", "identityPool", or "oidc"
|
|
378
378
|
* @returns an authorization rule for authenticated users
|
|
379
379
|
*/
|
|
380
380
|
authenticated(provider) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authorization.mjs","sources":["../../src/Authorization.ts"],"sourcesContent":["const __data = Symbol('data');\n/**\n * All possible providers.\n *\n * This list should not be used if you need to restrict available providers\n * according to an auth strategcy. E.g., `public` auth can only be facilitated\n * by `apiKey` and `iam` providers.\n */\nexport const Providers = [\n 'apiKey',\n 'iam',\n 'userPools',\n 'oidc',\n 'function',\n];\n/**\n * The subset of auth providers that can facilitate `public` auth.\n */\nexport const PublicProviders = ['apiKey', 'iam'];\n/**\n * The subset of auth providers that can facilitate `private` auth.\n */\nexport const PrivateProviders = ['userPools', 'oidc', 'iam'];\n/**\n * The subset of auth providers that can facilitate `owner` auth.\n */\nexport const OwnerProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `group` auth.\n */\nexport const GroupProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `custom` auth.\n */\nexport const CustomProviders = ['function'];\nexport const Strategies = [\n 'public',\n 'private',\n 'owner',\n 'groups',\n 'custom',\n];\n/**\n * The operations that can be performed against an API.\n */\nexport const Operations = [\n 'create',\n 'update',\n 'delete',\n 'read',\n 'get',\n 'list',\n 'sync',\n 'listen',\n 'search',\n];\n/**\n * The operations that can be performed against an API by a Lambda function.\n */\nexport const ResourceOperations = ['query', 'mutate', 'listen'];\n/**\n * Creates a shallow copy of an object with an individual field pruned away.\n *\n * @param original The original object to prune.\n * @param without The field to prune.\n * @returns The pruned object.\n */\nfunction omit(original, without) {\n const pruned = { ...original };\n delete pruned[without];\n return pruned;\n}\nfunction to(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\n/**\n * Specifies a property of the identity JWT to use in place of `sub::username`\n * as the value to match against the owner field for authorization.\n *\n * @param this Authorization object to operate against.\n * @param property A property of identity JWT.\n * @returns A copy of the Authorization object with the claim attached.\n */\nfunction identityClaim(property) {\n this[__data].identityClaim = property;\n return omit(this, 'identityClaim');\n}\nfunction withClaimIn(property) {\n this[__data].groupClaim = property;\n return omit(this, 'withClaimIn');\n}\nfunction validateProvider(needle, haystack) {\n if (needle && !haystack.includes(needle)) {\n throw new Error(`Invalid provider (${needle}) given!`);\n }\n}\nfunction authData(defaults, builderMethods) {\n return {\n [__data]: {\n strategy: 'public',\n provider: undefined,\n operations: undefined,\n groupOrOwnerField: undefined,\n multiOwner: false,\n identityClaim: undefined,\n groups: undefined,\n ...defaults,\n },\n ...builderMethods,\n };\n}\n/**\n * Defines an authorization rule for your data models and fields. First choose an authorization strategy (`public`,\n * `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `iam`, `userPools`, `oidc`, or `function`)\n * and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.\n */\nexport const allow = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {\n to,\n });\n },\n /**\n * Authorize unauthenticated users by using IAM based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'iam',\n }, {\n to,\n });\n },\n /**\n * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"iam\")` or `.authenticated(\"oidc\")` to use IAM or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {\n to,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis. By setting owner-based authorization, a new `owner: a.string()`\n * field will be added to the model to store which user \"owns\" the item. Upon item creation, the \"owner field\" is\n * auto-populated with the authenticated user's information. If you want to specify which field should be used as\n * the owner field, you can use the `ownerDefinedIn` builder function instead.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.owner(\"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param provider the authentication provider - supports \"userPools\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n owner(provider) {\n validateProvider(provider, OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: 'owner',\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis with specifying which field should be used as the owner field.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownerDefinedIn(\"owner\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownerField the field that contains the owner information\n * @param provider the authentication provider - supports \"userPools\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownerDefinedIn(ownerField, provider) {\n validateProvider(provider, OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownerField,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access for multi-user / multi-owner access. By setting multi-owner-based authorization, a new `owners: a.string().array()`\n * field will be added to the model to store which users \"own\" the item. Upon item creation, the \"owners field\" is\n * auto-populated with the authenticated user's information. To grant other users access to the item, append their user identifier into the `owners` array.\n *\n * You can specify which field should be used as the owners field by passing the `ownersField` parameter.\n *\n * By default, `.ownersDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownersDefinedIn(\"owners\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owners field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownersField the field that contains the owners information\n * @param provider the authentication provider - supports \"userPools\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownersDefinedIn(ownersField, provider) {\n validateProvider(provider, OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownersField,\n multiOwner: true,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a group defined in a data model field.\n *\n * By default, `.groupDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the authorized user group information\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a one of the groups defined in a data model field.\n *\n * By default, `.groupsDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupsDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the list of authorized user groups\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupsDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n multiOwner: true,\n }, {\n to,\n withClaimIn,\n });\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {\n to,\n });\n },\n resource(fn) {\n return resourceAuthData(fn, {\n to: resourceTo,\n });\n },\n};\n/**\n * This is a copy of the {@link allow} defined above, with modifications for custom operations.\n *\n * Removed builder methods:\n *\n * * `owner`\n * * `ownerDefinedIn`\n * * `ownersDefinedIn`\n * * `groupDefinedIn`\n * * `groupsDefinedIn`\n * * `resource`\n * * `.to()` builder method from each available rule builder\n */\nexport const allowForCustomOperations = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {});\n },\n /**\n * Authorize unauthenticated users by using IAM based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'iam',\n }, {});\n },\n /**\n * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"iam\")` or `.authenticated(\"oidc\")` to use IAM or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {});\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {});\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {});\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {});\n },\n};\nfunction resourceTo(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\nfunction resourceAuthData(resource, builderMethods) {\n return {\n [__data]: {\n strategy: 'resource',\n resource,\n },\n ...builderMethods,\n };\n}\nexport const accessData = (authorization) => authorization[__data];\n// TODO: delete when we make resource auth available at each level in the schema (model, field)\nexport const accessSchemaData = (authorization) => authorization[__data];\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG;AACzB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAI,UAAU;AACd,EAAE;AACF;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE;AACjD;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE;AAC7D;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,UAAU,EAAE;AAChC,MAAC,UAAU,GAAG;AAC1B,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,EAAE;AACF;AACA;AACA;AACY,MAAC,UAAU,GAAG;AAC1B,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,EAAE;AACF;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SA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AAM;AAClB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,IAAI,MAAM,CAAC,QAAQ,EAAE;AACrB,QAAQ,OAAO,QAAQ,CAAC;AACxB,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,QAAQ;AACpB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,EAAE;AACF,SAAS,UAAU,CAAC,UAAU,EAAE;AAChC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;AACzC,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AACD,SAAS,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE;AACpD,IAAI,OAAO;AACX,QAAQ,CAAC,MAAM,GAAG;AAClB,YAAY,QAAQ,EAAE,UAAU;AAChC,YAAY,QAAQ;AACpB,SAAS;AACT,QAAQ,GAAG,cAAc;AACzB,KAAK,CAAC;AACN,CAAC;AACW,MAAC,UAAU,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM,EAAE;AACnE;AACY,MAAC,gBAAgB,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"Authorization.mjs","sources":["../../src/Authorization.ts"],"sourcesContent":["const __data = Symbol('data');\n/**\n * All possible providers.\n *\n * This list should not be used if you need to restrict available providers\n * according to an auth strategcy. E.g., `public` auth can only be facilitated\n * by `apiKey` and `identityPool` providers.\n */\nexport const Providers = [\n 'apiKey',\n 'identityPool',\n 'userPools',\n 'oidc',\n 'function',\n];\n/**\n * The subset of auth providers that can facilitate `public` auth.\n */\nexport const PublicProviders = ['apiKey', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `private` auth.\n */\nexport const PrivateProviders = ['userPools', 'oidc', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `owner` auth.\n */\nexport const OwnerProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `group` auth.\n */\nexport const GroupProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `custom` auth.\n */\nexport const CustomProviders = ['function'];\nexport const Strategies = [\n 'public',\n 'private',\n 'owner',\n 'groups',\n 'custom',\n];\n/**\n * The operations that can be performed against an API.\n */\nexport const Operations = [\n 'create',\n 'update',\n 'delete',\n 'read',\n 'get',\n 'list',\n 'sync',\n 'listen',\n 'search',\n];\n/**\n * The operations that can be performed against an API by a Lambda function.\n */\nexport const ResourceOperations = ['query', 'mutate', 'listen'];\n/**\n * Creates a shallow copy of an object with an individual field pruned away.\n *\n * @param original The original object to prune.\n * @param without The field to prune.\n * @returns The pruned object.\n */\nfunction omit(original, without) {\n const pruned = { ...original };\n delete pruned[without];\n return pruned;\n}\nfunction to(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\n/**\n * Specifies a property of the identity JWT to use in place of `sub::username`\n * as the value to match against the owner field for authorization.\n *\n * @param this Authorization object to operate against.\n * @param property A property of identity JWT.\n * @returns A copy of the Authorization object with the claim attached.\n */\nfunction identityClaim(property) {\n this[__data].identityClaim = property;\n return omit(this, 'identityClaim');\n}\nfunction withClaimIn(property) {\n this[__data].groupClaim = property;\n return omit(this, 'withClaimIn');\n}\nfunction validateProvider(needle, haystack) {\n if (needle && !haystack.includes(needle)) {\n throw new Error(`Invalid provider (${needle}) given!`);\n }\n}\nfunction authData(defaults, builderMethods) {\n return {\n [__data]: {\n strategy: 'public',\n provider: undefined,\n operations: undefined,\n groupOrOwnerField: undefined,\n multiOwner: false,\n identityClaim: undefined,\n groups: undefined,\n ...defaults,\n },\n ...builderMethods,\n };\n}\n/**\n * Defines an authorization rule for your data models and fields. First choose an authorization strategy (`public`,\n * `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `identitypool`, `userPools`, `oidc`, or `function`)\n * and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.\n */\nexport const allow = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {\n to,\n });\n },\n /**\n * Authorize unauthenticated users by using IDENTITYPOOL based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'identityPool',\n }, {\n to,\n });\n },\n /**\n * Authorize authenticated users. By default, `.authenticated()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"identityPool\")` or `.authenticated(\"oidc\")` to use identityPool or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {\n to,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis. By setting owner-based authorization, a new `owner: a.string()`\n * field will be added to the model to store which user \"owns\" the item. Upon item creation, the \"owner field\" is\n * auto-populated with the authenticated user's information. If you want to specify which field should be used as\n * the owner field, you can use the `ownerDefinedIn` builder function instead.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.owner(\"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n owner(provider) {\n validateProvider(provider, OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: 'owner',\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis with specifying which field should be used as the owner field.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownerDefinedIn(\"owner\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownerField the field that contains the owner information\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownerDefinedIn(ownerField, provider) {\n validateProvider(provider, OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownerField,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access for multi-user / multi-owner access. By setting multi-owner-based authorization, a new `owners: a.string().array()`\n * field will be added to the model to store which users \"own\" the item. Upon item creation, the \"owners field\" is\n * auto-populated with the authenticated user's information. To grant other users access to the item, append their user identifier into the `owners` array.\n *\n * You can specify which field should be used as the owners field by passing the `ownersField` parameter.\n *\n * By default, `.ownersDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownersDefinedIn(\"owners\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owners field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownersField the field that contains the owners information\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownersDefinedIn(ownersField, provider) {\n validateProvider(provider, OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownersField,\n multiOwner: true,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a group defined in a data model field.\n *\n * By default, `.groupDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the authorized user group information\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a one of the groups defined in a data model field.\n *\n * By default, `.groupsDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupsDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the list of authorized user groups\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupsDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n multiOwner: true,\n }, {\n to,\n withClaimIn,\n });\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {\n to,\n });\n },\n resource(fn) {\n return resourceAuthData(fn, {\n to: resourceTo,\n });\n },\n};\n/**\n * This is a copy of the {@link allow} defined above, with modifications for custom operations.\n *\n * Removed builder methods:\n *\n * * `owner`\n * * `ownerDefinedIn`\n * * `ownersDefinedIn`\n * * `groupDefinedIn`\n * * `groupsDefinedIn`\n * * `resource`\n * * `.to()` builder method from each available rule builder\n */\nexport const allowForCustomOperations = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {});\n },\n /**\n * Authorize unauthenticated users by using identityPool based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'identityPool',\n }, {});\n },\n /**\n * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"identityPool\")` or `.authenticated(\"oidc\")` to use Identity Pool or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {});\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {});\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {});\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {});\n },\n};\nfunction resourceTo(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\nfunction resourceAuthData(resource, builderMethods) {\n return {\n [__data]: {\n strategy: 'resource',\n resource,\n },\n ...builderMethods,\n };\n}\nexport const accessData = (authorization) => authorization[__data];\n// TODO: delete when we make resource auth available at each level in the schema (model, field)\nexport const accessSchemaData = (authorization) => authorization[__data];\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG;AACzB,IAAI,QAAQ;AACZ,IAAI,cAAc;AAClB,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAI,UAAU;AACd,EAAE;AACF;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE;AAC1D;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE;AACtE;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,UAAU,EAAE;AAChC,MAAC,UAAU,GAAG;AAC1B,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,EAAE;AACF;AACA;AACA;AACY,MAAC,UAAU,GAAG;AAC1B,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,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AAC,MAAM,EAAE,QAAQ,EAAE;AAC7B,QAAQ,OAAO,QAAQ,CAAC;AACxB,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,QAAQ;AACpB,YAAY,MAAM;AAClB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,IAAI,MAAM,CAAC,QAAQ,EAAE;AACrB,QAAQ,OAAO,QAAQ,CAAC;AACxB,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,QAAQ;AACpB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,EAAE;AACF,SAAS,UAAU,CAAC,UAAU,EAAE;AAChC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;AACzC,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AACD,SAAS,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE;AACpD,IAAI,OAAO;AACX,QAAQ,CAAC,MAAM,GAAG;AAClB,YAAY,QAAQ,EAAE,UAAU;AAChC,YAAY,QAAQ;AACpB,SAAS;AACT,QAAQ,GAAG,cAAc;AACzB,KAAK,CAAC;AACN,CAAC;AACW,MAAC,UAAU,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM,EAAE;AACnE;AACY,MAAC,gBAAgB,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM;;;;"}
|
|
@@ -374,7 +374,9 @@ function calculateAuth(authorization) {
|
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
376
|
if (rule.provider) {
|
|
377
|
-
|
|
377
|
+
// identityPool maps to iam in the transform
|
|
378
|
+
const provider = rule.provider === 'identityPool' ? 'iam' : rule.provider;
|
|
379
|
+
ruleParts.push(`provider: ${provider}`);
|
|
378
380
|
}
|
|
379
381
|
if (rule.operations) {
|
|
380
382
|
ruleParts.push(`operations: [${rule.operations.join(', ')}]`);
|