@aws-amplify/graphql-auth-transformer 1.2.1 → 1.2.3-alpha.18

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 (3) hide show
  1. package/API.md +329 -0
  2. package/CHANGELOG.md +4 -0
  3. package/package.json +12 -11
package/API.md ADDED
@@ -0,0 +1,329 @@
1
+ ## API Report File for "@aws-amplify/graphql-auth-transformer"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { AppSyncAuthConfiguration } from '@aws-amplify/graphql-transformer-interfaces';
8
+ import { DirectiveNode } from 'graphql';
9
+ import { DirectiveWrapper } from '@aws-amplify/graphql-transformer-core';
10
+ import { FieldDefinitionNode } from 'graphql';
11
+ import { GetArgumentsOptions } from '@aws-amplify/graphql-transformer-core';
12
+ import { InterfaceTypeDefinitionNode } from 'graphql';
13
+ import { ObjectTypeDefinitionNode } from 'graphql';
14
+ import { TransformerAuthBase } from '@aws-amplify/graphql-transformer-core';
15
+ import { TransformerAuthProvider } from '@aws-amplify/graphql-transformer-interfaces';
16
+ import { TransformerBeforeStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
17
+ import { TransformerContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
18
+ import { TransformerSchemaVisitStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
19
+ import { TransformerTransformSchemaStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
20
+
21
+ // @public (undocumented)
22
+ export class AccessControlMatrix {
23
+ // Warning: (ae-forgotten-export) The symbol "ACMConfig" needs to be exported by the entry point index.d.ts
24
+ constructor(config: ACMConfig);
25
+ // (undocumented)
26
+ getAcmPerRole(): Map<string, unknown>;
27
+ // (undocumented)
28
+ getName(): string;
29
+ // (undocumented)
30
+ getResources(): Readonly<Array<string>>;
31
+ // (undocumented)
32
+ getRoles(): Array<string>;
33
+ // (undocumented)
34
+ getRolesPerOperation(operation: ModelOperation, fullAccess?: boolean): Array<string>;
35
+ // (undocumented)
36
+ hasResource(resource: string): boolean;
37
+ // (undocumented)
38
+ hasRole(role: string): boolean;
39
+ // (undocumented)
40
+ isAllowed(role: string, resource: string, operation: ModelOperation): boolean;
41
+ // (undocumented)
42
+ resetAccessForResource(resource: string): void;
43
+ // Warning: (ae-forgotten-export) The symbol "SetRoleInput" needs to be exported by the entry point index.d.ts
44
+ //
45
+ // (undocumented)
46
+ setRole(input: SetRoleInput): void;
47
+ }
48
+
49
+ // @public (undocumented)
50
+ export const ALLOWED_FIELDS = "allowedFields";
51
+
52
+ // @public (undocumented)
53
+ export const API_KEY_AUTH_TYPE = "API Key Authorization";
54
+
55
+ // @public (undocumented)
56
+ export const AUTH_NON_MODEL_TYPES = "authNonModelTypes";
57
+
58
+ // @public (undocumented)
59
+ export const AUTH_PROVIDER_DIRECTIVE_MAP: Map<AuthProvider, string>;
60
+
61
+ // @public (undocumented)
62
+ export interface AuthDirective {
63
+ // (undocumented)
64
+ rules: AuthRule[];
65
+ }
66
+
67
+ // @public (undocumented)
68
+ export const authDirectiveDefinition = "\n directive @auth(rules: [AuthRule!]!) on OBJECT | FIELD_DEFINITION\n input AuthRule {\n allow: AuthStrategy!\n provider: AuthProvider\n identityClaim: String\n groupClaim: String\n ownerField: String\n groupsField: String\n groups: [String]\n operations: [ModelOperation]\n }\n enum AuthStrategy {\n owner\n groups\n private\n public\n custom\n }\n enum AuthProvider {\n apiKey\n iam\n oidc\n userPools\n function\n }\n enum ModelOperation {\n create\n update\n delete\n read\n list\n get\n sync\n listen\n search\n }\n";
69
+
70
+ // @public (undocumented)
71
+ export type AuthProvider = 'apiKey' | 'iam' | 'oidc' | 'userPools' | 'function';
72
+
73
+ // @public (undocumented)
74
+ export interface AuthRule {
75
+ // (undocumented)
76
+ allow: AuthStrategy;
77
+ // (undocumented)
78
+ generateIAMPolicy?: boolean;
79
+ // (undocumented)
80
+ groupClaim?: string;
81
+ // (undocumented)
82
+ groups?: string[];
83
+ // (undocumented)
84
+ groupsField?: string;
85
+ // (undocumented)
86
+ identityClaim?: string;
87
+ // (undocumented)
88
+ operations?: ModelOperation[];
89
+ // (undocumented)
90
+ ownerField?: string;
91
+ // (undocumented)
92
+ provider?: AuthProvider;
93
+ }
94
+
95
+ // @public (undocumented)
96
+ export type AuthStrategy = 'owner' | 'groups' | 'public' | 'private' | 'custom';
97
+
98
+ // @public (undocumented)
99
+ export class AuthTransformer extends TransformerAuthBase implements TransformerAuthProvider {
100
+ constructor(config?: AuthTransformerConfig);
101
+ // (undocumented)
102
+ addAutoGeneratedDataStoreFields: (ctx: TransformerContextProvider, allowedFields: Set<string>) => void;
103
+ // (undocumented)
104
+ addAutoGeneratedFields: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, allowedFields: string[], fields: readonly string[]) => string[];
105
+ // (undocumented)
106
+ addAutoGeneratedHasManyFields: (ctx: TransformerContextProvider, typeDefinitions: ObjectTypeDefinitionNode[], def: ObjectTypeDefinitionNode, allowedFields: Set<string>) => void;
107
+ // (undocumented)
108
+ addAutoGeneratedHasOneFields: (ctx: TransformerContextProvider, typeDefinitions: ObjectTypeDefinitionNode[], fields: readonly string[], def: ObjectTypeDefinitionNode, allowedFields: Set<string>) => void;
109
+ // (undocumented)
110
+ addAutoGeneratedIndexFields: (definition: ObjectTypeDefinitionNode, allowedFields: Set<string>) => void;
111
+ // (undocumented)
112
+ addAutoGeneratedRelationalFields: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, allowedFields: Set<string>, fields: readonly string[]) => void;
113
+ // (undocumented)
114
+ addFieldResolverForDynamicAuth: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string) => void;
115
+ // (undocumented)
116
+ addFieldsToObject: (ctx: TransformerTransformSchemaStepContextProvider, modelName: string, ownerFields: Array<string>) => void;
117
+ // (undocumented)
118
+ after: (context: TransformerContextProvider) => void;
119
+ // (undocumented)
120
+ before: (context: TransformerBeforeStepContextProvider) => void;
121
+ // (undocumented)
122
+ field: (parent: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, field: FieldDefinitionNode, directive: DirectiveNode, context: TransformerSchemaVisitStepContextProvider) => void;
123
+ // (undocumented)
124
+ generateResolvers: (context: TransformerContextProvider) => void;
125
+ // (undocumented)
126
+ getRelatedModelObject: (ctx: TransformerContextProvider, typeName: string) => ObjectTypeDefinitionNode;
127
+ // (undocumented)
128
+ object: (def: ObjectTypeDefinitionNode, directive: DirectiveNode, context: TransformerSchemaVisitStepContextProvider) => void;
129
+ // (undocumented)
130
+ protectCreateResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
131
+ // (undocumented)
132
+ protectDeleteResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
133
+ // (undocumented)
134
+ protectFieldResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, roles: Array<string>) => void;
135
+ // (undocumented)
136
+ protectGetResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
137
+ // (undocumented)
138
+ protectListResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix, indexName?: string) => void;
139
+ // (undocumented)
140
+ protectRelationalResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, field: FieldDefinitionNode, fieldRoles: Array<string> | null) => void;
141
+ // (undocumented)
142
+ protectSchemaOperations: (ctx: TransformerTransformSchemaStepContextProvider, def: ObjectTypeDefinitionNode, acm: AccessControlMatrix) => void;
143
+ // (undocumented)
144
+ protectSearchResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
145
+ // (undocumented)
146
+ protectSubscriptionResolver: (ctx: TransformerContextProvider, typeName: string, fieldName: string, subscriptionRoles: Array<RoleDefinition>) => void;
147
+ // (undocumented)
148
+ protectSyncResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
149
+ // (undocumented)
150
+ protectUpdateResolver: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, typeName: string, fieldName: string, acm: AccessControlMatrix) => void;
151
+ // (undocumented)
152
+ removeAuthFieldsFromSubscriptionFilter: (context: TransformerTransformSchemaStepContextProvider) => void;
153
+ // (undocumented)
154
+ transformSchema: (context: TransformerTransformSchemaStepContextProvider) => void;
155
+ }
156
+
157
+ // @public (undocumented)
158
+ export interface AuthTransformerConfig {
159
+ // (undocumented)
160
+ adminRoles?: Array<string>;
161
+ // (undocumented)
162
+ authConfig?: AppSyncAuthConfiguration;
163
+ // (undocumented)
164
+ identityPoolId?: string;
165
+ }
166
+
167
+ // @public (undocumented)
168
+ export const COGNITO_AUTH_TYPE = "User Pool Authorization";
169
+
170
+ // @public (undocumented)
171
+ export interface ConfiguredAuthProviders {
172
+ // (undocumented)
173
+ adminRoles: Array<string>;
174
+ // (undocumented)
175
+ default: AuthProvider;
176
+ // (undocumented)
177
+ hasAdminRolesEnabled: boolean;
178
+ // (undocumented)
179
+ hasApiKey: boolean;
180
+ // (undocumented)
181
+ hasIAM: boolean;
182
+ // (undocumented)
183
+ hasLambda: boolean;
184
+ // (undocumented)
185
+ hasOIDC: boolean;
186
+ // (undocumented)
187
+ hasUserPools: boolean;
188
+ // (undocumented)
189
+ identityPoolId?: string;
190
+ // (undocumented)
191
+ onlyDefaultAuthProviderConfigured: boolean;
192
+ }
193
+
194
+ // @public (undocumented)
195
+ export const DEFAULT_COGNITO_IDENTITY_CLAIM = "cognito:username";
196
+
197
+ // @public (undocumented)
198
+ export const DEFAULT_GROUP_CLAIM = "cognito:groups";
199
+
200
+ // @public (undocumented)
201
+ export const DEFAULT_GROUPS_FIELD = "groups";
202
+
203
+ // @public (undocumented)
204
+ export const DEFAULT_IDENTITY_CLAIM = "username";
205
+
206
+ // @public (undocumented)
207
+ export const DEFAULT_OWNER_FIELD = "owner";
208
+
209
+ // @public (undocumented)
210
+ export const DEFAULT_UNIQUE_IDENTITY_CLAIM = "sub::username";
211
+
212
+ // @public (undocumented)
213
+ export const DENIED_FIELDS = "deniedFields";
214
+
215
+ // @public (undocumented)
216
+ export const getAuthDirectiveRules: (authDir: DirectiveWrapper, options?: GetAuthRulesOptions) => AuthRule[];
217
+
218
+ // @public (undocumented)
219
+ export type GetAuthRulesOptions = GetArgumentsOptions & {
220
+ isField?: boolean;
221
+ };
222
+
223
+ // @public (undocumented)
224
+ export const IAM_AUTH_TYPE = "IAM Authorization";
225
+
226
+ // @public (undocumented)
227
+ export const IDENTITY_CLAIM_DELIMITER = "::";
228
+
229
+ // @public (undocumented)
230
+ export const IS_AUTHORIZED_FLAG = "isAuthorized";
231
+
232
+ // @public (undocumented)
233
+ export const LAMBDA_AUTH_TYPE = "Lambda Authorization";
234
+
235
+ // @public (undocumented)
236
+ export const MODEL_OPERATIONS: ModelOperation[];
237
+
238
+ // @public (undocumented)
239
+ export type ModelMutation = 'create' | 'update' | 'delete';
240
+
241
+ // @public (undocumented)
242
+ export type ModelOperation = 'create' | 'update' | 'delete' | 'get' | 'list' | 'sync' | 'search' | 'listen';
243
+
244
+ // @public (undocumented)
245
+ export const NONE_DS = "NONE_DS";
246
+
247
+ // @public (undocumented)
248
+ export const NULL_ALLOWED_FIELDS = "nullAllowedFields";
249
+
250
+ // @public (undocumented)
251
+ export const OIDC_AUTH_TYPE = "Open ID Connect Authorization";
252
+
253
+ // @public (undocumented)
254
+ export const ON_CREATE_FIELD = "onCreate";
255
+
256
+ // @public (undocumented)
257
+ export const ON_DELETE_FIELD = "onDelete";
258
+
259
+ // @public (undocumented)
260
+ export const ON_UPDATE_FIELD = "onUpdate";
261
+
262
+ // @public (undocumented)
263
+ export const READ_MODEL_OPERATIONS: ModelOperation[];
264
+
265
+ // @public (undocumented)
266
+ export const RELATIONAL_DIRECTIVES: string[];
267
+
268
+ // @public (undocumented)
269
+ export type RelationalPrimaryMapConfig = Map<string, {
270
+ claim: string;
271
+ field: string;
272
+ }>;
273
+
274
+ // @public (undocumented)
275
+ export interface RoleDefinition {
276
+ // (undocumented)
277
+ allowedFields?: Array<string>;
278
+ // (undocumented)
279
+ areAllFieldsAllowed?: boolean;
280
+ // (undocumented)
281
+ areAllFieldsNullAllowed?: boolean;
282
+ // (undocumented)
283
+ claim?: string;
284
+ // (undocumented)
285
+ entity?: string;
286
+ // (undocumented)
287
+ isEntityList?: boolean;
288
+ // (undocumented)
289
+ nullAllowedFields?: Array<string>;
290
+ // (undocumented)
291
+ provider: AuthProvider;
292
+ // (undocumented)
293
+ static: boolean;
294
+ // (undocumented)
295
+ strategy: AuthStrategy;
296
+ }
297
+
298
+ // @public (undocumented)
299
+ export interface RolesByProvider {
300
+ // (undocumented)
301
+ apiKeyRoles: Array<RoleDefinition>;
302
+ // (undocumented)
303
+ cognitoDynamicRoles: Array<RoleDefinition>;
304
+ // (undocumented)
305
+ cognitoStaticRoles: Array<RoleDefinition>;
306
+ // (undocumented)
307
+ iamRoles: Array<RoleDefinition>;
308
+ // (undocumented)
309
+ lambdaRoles: Array<RoleDefinition>;
310
+ // (undocumented)
311
+ oidcDynamicRoles: Array<RoleDefinition>;
312
+ // (undocumented)
313
+ oidcStaticRoles: Array<RoleDefinition>;
314
+ }
315
+
316
+ // @public (undocumented)
317
+ export const SEARCHABLE_AGGREGATE_TYPES: string[];
318
+
319
+ // @public (undocumented)
320
+ export interface SearchableConfig {
321
+ // (undocumented)
322
+ queries: {
323
+ search: string;
324
+ };
325
+ }
326
+
327
+ // (No @packageDocumentation comment for this package)
328
+
329
+ ```
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.2.2](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-auth-transformer@1.2.1...@aws-amplify/graphql-auth-transformer@1.2.2) (2022-12-13)
7
+
8
+ **Note:** Version bump only for package @aws-amplify/graphql-auth-transformer
9
+
6
10
  ## [1.2.1](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-auth-transformer@1.2.0...@aws-amplify/graphql-auth-transformer@1.2.1) (2022-12-09)
7
11
 
8
12
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/graphql-auth-transformer",
3
- "version": "1.2.1",
3
+ "version": "1.2.3-alpha.18+3b729cb24",
4
4
  "description": "Amplify GraphQL @auth transformer",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,19 +25,20 @@
25
25
  "test": "jest",
26
26
  "build": "tsc",
27
27
  "clean": "rimraf ./lib",
28
- "watch": "tsc -w"
28
+ "watch": "tsc -w",
29
+ "extract-api": "ts-node ../../scripts/extract-api.ts"
29
30
  },
30
31
  "dependencies": {
31
- "@aws-amplify/graphql-model-transformer": "0.16.4",
32
- "@aws-amplify/graphql-relational-transformer": "0.12.5",
33
- "@aws-amplify/graphql-transformer-core": "0.18.0",
34
- "@aws-amplify/graphql-transformer-interfaces": "1.14.9",
32
+ "@aws-amplify/graphql-model-transformer": "0.16.5-alpha.38+3b729cb24",
33
+ "@aws-amplify/graphql-relational-transformer": "0.12.7-alpha.18+3b729cb24",
34
+ "@aws-amplify/graphql-transformer-core": "0.18.1-alpha.38+3b729cb24",
35
+ "@aws-amplify/graphql-transformer-interfaces": "1.14.10-alpha.77+3b729cb24",
35
36
  "@aws-cdk/aws-iam": "~1.172.0",
36
37
  "@aws-cdk/core": "~1.172.0",
37
38
  "constructs": "^3.3.125",
38
39
  "graphql": "^14.5.8",
39
- "graphql-mapping-template": "4.20.5",
40
- "graphql-transformer-common": "4.24.1",
40
+ "graphql-mapping-template": "4.20.6-alpha.284+3b729cb24",
41
+ "graphql-transformer-common": "4.24.2-alpha.38+3b729cb24",
41
42
  "lodash": "^4.17.21",
42
43
  "md5": "^2.3.0"
43
44
  },
@@ -45,8 +46,8 @@
45
46
  "amplify-prompts": "^2.0.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@aws-amplify/graphql-index-transformer": "0.14.4",
49
- "@aws-amplify/graphql-searchable-transformer": "0.16.5",
49
+ "@aws-amplify/graphql-index-transformer": "0.14.6-alpha.18+3b729cb24",
50
+ "@aws-amplify/graphql-searchable-transformer": "0.16.6-alpha.21+3b729cb24",
50
51
  "@types/node": "^12.12.6"
51
52
  },
52
53
  "jest": {
@@ -65,5 +66,5 @@
65
66
  ],
66
67
  "collectCoverage": true
67
68
  },
68
- "gitHead": "f8213f67cc612b39c4020e28fa21668595a17ff0"
69
+ "gitHead": "3b729cb2466d5e7c44e05be3256508db66330280"
69
70
  }