@aws-amplify/data-schema 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +175 -0
  2. package/NOTICE +1 -0
  3. package/lib-esm/index.d.ts +4 -0
  4. package/lib-esm/index.js +28 -0
  5. package/lib-esm/src/Authorization.d.ts +262 -0
  6. package/lib-esm/src/Authorization.js +309 -0
  7. package/lib-esm/src/ClientSchema.d.ts +27 -0
  8. package/lib-esm/src/ClientSchema.js +3 -0
  9. package/lib-esm/src/CustomType.d.ts +33 -0
  10. package/lib-esm/src/CustomType.js +14 -0
  11. package/lib-esm/src/EnumType.d.ts +15 -0
  12. package/lib-esm/src/EnumType.js +17 -0
  13. package/lib-esm/src/MappedTypes/ExtractNonModelTypes.d.ts +32 -0
  14. package/lib-esm/src/MappedTypes/ExtractNonModelTypes.js +2 -0
  15. package/lib-esm/src/MappedTypes/ForeignKeys.d.ts +83 -0
  16. package/lib-esm/src/MappedTypes/ForeignKeys.js +2 -0
  17. package/lib-esm/src/MappedTypes/ImplicitFieldInjector.d.ts +37 -0
  18. package/lib-esm/src/MappedTypes/ImplicitFieldInjector.js +2 -0
  19. package/lib-esm/src/MappedTypes/ModelMetadata.d.ts +20 -0
  20. package/lib-esm/src/MappedTypes/ModelMetadata.js +2 -0
  21. package/lib-esm/src/MappedTypes/ResolveFieldProperties.d.ts +58 -0
  22. package/lib-esm/src/MappedTypes/ResolveFieldProperties.js +2 -0
  23. package/lib-esm/src/MappedTypes/ResolveSchema.d.ts +35 -0
  24. package/lib-esm/src/MappedTypes/ResolveSchema.js +2 -0
  25. package/lib-esm/src/ModelField.d.ts +158 -0
  26. package/lib-esm/src/ModelField.js +206 -0
  27. package/lib-esm/src/ModelRelationalField.d.ts +106 -0
  28. package/lib-esm/src/ModelRelationalField.js +113 -0
  29. package/lib-esm/src/ModelSchema.d.ts +39 -0
  30. package/lib-esm/src/ModelSchema.js +34 -0
  31. package/lib-esm/src/ModelType.d.ts +107 -0
  32. package/lib-esm/src/ModelType.js +32 -0
  33. package/lib-esm/src/RefType.d.ts +45 -0
  34. package/lib-esm/src/RefType.js +29 -0
  35. package/lib-esm/src/SchemaProcessor.d.ts +10 -0
  36. package/lib-esm/src/SchemaProcessor.js +408 -0
  37. package/lib-esm/src/index.d.ts +9 -0
  38. package/lib-esm/src/index.js +35 -0
  39. package/lib-esm/src/types.d.ts +18 -0
  40. package/lib-esm/src/types.js +8 -0
  41. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  42. package/package.json +39 -0
package/LICENSE ADDED
@@ -0,0 +1,175 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,4 @@
1
+ import * as a from './src';
2
+ import { ClientSchema } from './src/ClientSchema';
3
+ export { a };
4
+ export type { ClientSchema };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.a = void 0;
27
+ const a = __importStar(require("./src"));
28
+ exports.a = a;
@@ -0,0 +1,262 @@
1
+ import type { UnionToIntersection } from '@aws-amplify/data-schema-types';
2
+ declare const __data: unique symbol;
3
+ /**
4
+ * All possible providers.
5
+ *
6
+ * This list should not be used if you need to restrict available providers
7
+ * according to an auth strategcy. E.g., `public` auth can only be facilitated
8
+ * by `apiKey` and `iam` providers.
9
+ */
10
+ export declare const Providers: readonly ["apiKey", "iam", "userPools", "oidc", "function"];
11
+ export type Provider = (typeof Providers)[number];
12
+ /**
13
+ * The subset of auth providers that can facilitate `public` auth.
14
+ */
15
+ export declare const PublicProviders: readonly ["apiKey", "iam"];
16
+ export type PublicProvider = (typeof PublicProviders)[number];
17
+ /**
18
+ * The subset of auth providers that can facilitate `private` auth.
19
+ */
20
+ export declare const PrivateProviders: readonly ["userPools", "oidc", "iam"];
21
+ export type PrivateProvider = (typeof PrivateProviders)[number];
22
+ /**
23
+ * The subset of auth providers that can facilitate `owner` auth.
24
+ */
25
+ export declare const OwnerProviders: readonly ["userPools", "oidc"];
26
+ export type OwnerProviders = (typeof OwnerProviders)[number];
27
+ /**
28
+ * The subset of auth providers that can facilitate `group` auth.
29
+ */
30
+ export declare const GroupProviders: readonly ["userPools", "oidc"];
31
+ export type GroupProvider = (typeof GroupProviders)[number];
32
+ /**
33
+ * The subset of auth providers that can facilitate `custom` auth.
34
+ */
35
+ export declare const CustomProviders: readonly ["function"];
36
+ export type CustomProvider = (typeof CustomProviders)[number];
37
+ export declare const Strategies: readonly ["public", "private", "owner", "groups", "custom"];
38
+ export type Strategy = (typeof Strategies)[number];
39
+ /**
40
+ * The operations that can be performed against an API.
41
+ */
42
+ export declare const Operations: readonly ["create", "update", "delete", "read", "get", "list", "sync", "listen", "search"];
43
+ export type Operation = (typeof Operations)[number];
44
+ export type Authorization<AuthField extends string | undefined, AuthFieldPlurality extends boolean> = {
45
+ [__data]: {
46
+ strategy?: Strategy;
47
+ provider?: Provider;
48
+ operations?: Operation[];
49
+ groupOrOwnerField?: AuthField;
50
+ groups?: string[];
51
+ multiOwner: AuthFieldPlurality;
52
+ identityClaim?: string;
53
+ groupClaim?: string;
54
+ };
55
+ };
56
+ export type OwnerField = object;
57
+ type BuilderMethods<T extends object> = {
58
+ [K in keyof T as T[K] extends (...args: any) => any ? K : never]: T[K];
59
+ };
60
+ declare function to<SELF extends Authorization<any, any>>(this: SELF, operations: Operation[]): Omit<SELF, "to">;
61
+ declare function inField<SELF extends Authorization<any, any>, Field extends string>(this: SELF, field: Field): BuilderMethods<Omit<SELF, "inField">> & Authorization<Field, SELF[typeof __data]["multiOwner"]>;
62
+ /**
63
+ * Specifies a property of the identity JWT to use in place of `sub::username`
64
+ * as the value to match against the owner field for authorization.
65
+ *
66
+ * @param this Authorization object to operate against.
67
+ * @param property A property of identity JWT.
68
+ * @returns A copy of the Authorization object with the claim attached.
69
+ */
70
+ declare function identityClaim<SELF extends Authorization<any, any>>(this: SELF, property: string): Omit<SELF, "identityClaim">;
71
+ declare function withClaimIn<SELF extends Authorization<any, any>>(this: SELF, property: string): Omit<SELF, "withClaimIn">;
72
+ /**
73
+ * Defines an authorization rule for your data models and fields. First choose an authorization strategy (`public`,
74
+ * `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `iam`, `userPools`, `oidc`, or `function`)
75
+ * and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.
76
+ */
77
+ export declare const allow: {
78
+ /**
79
+ * Authorize unauthenticated users. By default, `.public()` uses an API key based authorization. You can additionally
80
+ * use `.public('iam')` to use IAM based authorization for unauthenticated users.
81
+ * @param provider the authentication provider - supports "apiKey" or "iam" as valid providers
82
+ * @returns an authorization rule for unauthenticated users
83
+ */
84
+ readonly public: (provider?: PublicProvider) => Authorization<"owner", false> & {
85
+ to: typeof to;
86
+ };
87
+ /**
88
+ * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally
89
+ * use `.private("iam")` or `.private("oidc")` to use IAM or OIDC based authorization for authenticated users.
90
+ * @param provider the authentication provider - supports "userPools", "iam", or "oidc"
91
+ * @returns an authorization rule for authenticated users
92
+ */
93
+ readonly private: (provider?: PrivateProvider) => Authorization<"owner", false> & {
94
+ to: typeof to;
95
+ };
96
+ /**
97
+ * Authorize access on a per-user (owner) basis. By setting owner-based authorization, a new `owner: a.string()`
98
+ * field will be added to the model to store which user "owns" the item. Upon item creation, the "owner field" is
99
+ * auto-populated with the authenticated user's information. You can which field should be used as the owner field
100
+ * by chaining the * `.inField(...)` method.
101
+ *
102
+ * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally
103
+ * use `.owner("oidc")` to use OIDC based authentication to designate the owner.
104
+ *
105
+ * To change the specific claim that should be used as the user identifier within the owner field, chain the
106
+ * `.identityClaim(...)` method.
107
+ *
108
+ * @param provider the authentication provider - supports "userPools", "iam", or "oidc"
109
+ * @returns an authorization rule for authenticated users
110
+ */
111
+ readonly owner: (provider?: OwnerProviders) => Authorization<"owner", false> & {
112
+ to: typeof to;
113
+ inField: typeof inField;
114
+ identityClaim: typeof identityClaim;
115
+ };
116
+ /**
117
+ * Authorize access for multi-user / multi-owner access. By setting multi-owner-based authorization, a new `owners: a.string().array()`
118
+ * field will be added to the model to store which users "own" the item. Upon item creation, the "owners field" is
119
+ * auto-populated with the authenticated user's information. To grant other users access to the item, append their user identifier into the `owners` array.
120
+ * You can which field should be used as the owners field by chaining the * `.inField(...)` method.
121
+ *
122
+ * By default, `.multipleOwners()` uses an Amazon Cognito user pool based authorization. You can additionally
123
+ * use `.multipleOwners("oidc")` to use OIDC based authentication to designate the owner.
124
+ *
125
+ * To change the specific claim that should be used as the user identifier within the owners field, chain the
126
+ * `.identityClaim(...)` method.
127
+ *
128
+ * @param provider the authentication provider - supports "userPools", "iam", or "oidc"
129
+ * @returns an authorization rule for authenticated users
130
+ */
131
+ readonly multipleOwners: (provider?: OwnerProviders) => Authorization<"owner", true> & {
132
+ to: typeof to;
133
+ inField: typeof inField;
134
+ identityClaim: typeof identityClaim;
135
+ };
136
+ /**
137
+ * Authorize a specific user group. Provide the name of the specific user group to have access.
138
+ *
139
+ * By default, `.specificGroup()` uses an Amazon Cognito user pool based authorization. You can additionally
140
+ * use `.specificGroup("oidc")` to use OIDC based authentication to designate the user group.
141
+ *
142
+ * To change the specific claim that should be used as the user group identifier, chain the
143
+ * `.groupClaim(...)` method.
144
+ * @param group the name of the group to authorize
145
+ * @param provider the authentication provider - supports "userPools" or "oidc"
146
+ * @returns an authorization rule to grant access by a specific group
147
+ */
148
+ readonly specificGroup: (group: string, provider?: GroupProvider) => Authorization<"owner", false> & {
149
+ to: typeof to;
150
+ withClaimIn: typeof withClaimIn;
151
+ };
152
+ /**
153
+ * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.
154
+ *
155
+ * By default, `.specificGroups()` uses an Amazon Cognito user pool based authorization. You can additionally
156
+ * use `.specificGroups("oidc")` to use OIDC based authentication to designate the user group.
157
+ *
158
+ * To change the specific claim that should be used as the user group identifier, chain the
159
+ * `.groupClaim(...)` method.
160
+ * @param groups the names of the group to authorize defined as an array
161
+ * @param provider the authentication provider - supports "userPools" or "oidc"
162
+ * @returns an authorization rule to grant access by a specific group
163
+ */
164
+ readonly specificGroups: (groups: string[], provider?: GroupProvider) => Authorization<"owner", false> & {
165
+ to: typeof to;
166
+ withClaimIn: typeof withClaimIn;
167
+ };
168
+ /**
169
+ * Authorize if a user is part of a group defined in a data model field.
170
+ *
171
+ * By default, `.groupDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally
172
+ * use `.groupDefinedIn("oidc")` to use OIDC based authentication to designate the user group.
173
+ *
174
+ * To change the specific claim that should be used as the user group identifier within the groups field, chain the
175
+ * `.groupClaim(...)` method.
176
+ * @param groupsField the field that should store the authorized user group information
177
+ * @param provider the authentication provider - supports "userPools" or "oidc"
178
+ * @returns an authorization rule to grant access by a specific group
179
+ */
180
+ readonly groupDefinedIn: <T extends string>(groupsField: T, provider?: GroupProvider) => Authorization<T, false> & {
181
+ to: typeof to;
182
+ };
183
+ /**
184
+ * Authorize if a user is part of a one of the groups defined in a data model field.
185
+ *
186
+ * By default, `.groupsDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally
187
+ * use `.groupsDefinedIn("oidc")` to use OIDC based authentication to designate the user group.
188
+ *
189
+ * To change the specific claim that should be used as the user group identifier within the groups field, chain the
190
+ * `.groupClaim(...)` method.
191
+ * @param groupsField the field that should store the list of authorized user groups
192
+ * @param provider the authentication provider - supports "userPools" or "oidc"
193
+ * @returns an authorization rule to grant access by a specific group
194
+ */
195
+ readonly groupsDefinedIn: <T_1 extends string>(groupsField: T_1, provider?: GroupProvider) => Authorization<T_1, true> & {
196
+ to: typeof to;
197
+ };
198
+ readonly custom: (provider?: CustomProvider) => Authorization<"owner", false> & {
199
+ to: typeof to;
200
+ };
201
+ };
202
+ /**
203
+ * Turns the type from a list of `Authorization` rules like this:
204
+ *
205
+ * ```typescript
206
+ * [
207
+ * allow.public(),
208
+ * allow.owner().inField('otherfield'),
209
+ * allow.multipleOwners().inField('editors')
210
+ * ]
211
+ * ```
212
+ *
213
+ * Into a union of the possible `fieldname: type` auth objects like this:
214
+ *
215
+ * ```typescript
216
+ * {
217
+ * owner?: string | undefined;
218
+ * } | {
219
+ * otherfield?: string | undefined;
220
+ * } | {
221
+ * editors?: string[] | undefined;
222
+ * }
223
+ * ```
224
+ */
225
+ export type ImpliedAuthField<T extends Authorization<any, any>> = T extends Authorization<infer Field, infer isMulti> ? Field extends string ? isMulti extends true ? {
226
+ [K in Field]?: string[];
227
+ } : {
228
+ [K in Field]?: string;
229
+ } : object : object;
230
+ /**
231
+ * Turns the type from a list of `Authorization` rules like this:
232
+ *
233
+ * ```typescript
234
+ * [
235
+ * allow.public(),
236
+ * allow.owner().inField('otherfield'),
237
+ * allow.multipleOwners().inField('editors')
238
+ * ]
239
+ * ```
240
+ *
241
+ * Into an object type that includes all auth fields like this:
242
+ *
243
+ * ```typescript
244
+ * {
245
+ * owner?: string | undefined;
246
+ * otherfield?: string | undefined;
247
+ * editors?: string[] | undefined;
248
+ * }
249
+ * ```
250
+ */
251
+ export type ImpliedAuthFields<T extends Authorization<any, any>> = UnionToIntersection<ImpliedAuthField<T>>;
252
+ export declare const accessData: <T extends Authorization<any, any>>(authorization: T) => {
253
+ strategy?: "public" | "private" | "owner" | "groups" | "custom" | undefined;
254
+ provider?: "function" | "apiKey" | "iam" | "userPools" | "oidc" | undefined;
255
+ operations?: ("create" | "update" | "delete" | "read" | "get" | "list" | "sync" | "listen" | "search")[] | undefined;
256
+ groupOrOwnerField?: any;
257
+ groups?: string[] | undefined;
258
+ multiOwner: any;
259
+ identityClaim?: string | undefined;
260
+ groupClaim?: string | undefined;
261
+ };
262
+ export {};