@aws-amplify/graphql-model-transformer 1.1.0-beta.2 → 1.1.0-beta.4

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/API.md ADDED
@@ -0,0 +1,265 @@
1
+ ## API Report File for "@aws-amplify/graphql-model-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 { AppSyncDataSourceType } from '@aws-amplify/graphql-transformer-interfaces';
8
+ import * as cdk from 'aws-cdk-lib';
9
+ import { CompoundExpressionNode } from 'graphql-mapping-template';
10
+ import { DataSourceInstance } from '@aws-amplify/graphql-transformer-interfaces';
11
+ import { DirectiveNode } from 'graphql';
12
+ import { DocumentNode } from 'graphql';
13
+ import { EnumTypeDefinitionNode } from 'graphql';
14
+ import { Expression } from 'graphql-mapping-template';
15
+ import { FieldDefinitionNode } from 'graphql';
16
+ import { FieldWrapper } from '@aws-amplify/graphql-transformer-core';
17
+ import * as iam from 'aws-cdk-lib/aws-iam';
18
+ import { InputObjectDefinitionWrapper } from '@aws-amplify/graphql-transformer-core';
19
+ import { InputObjectTypeDefinitionNode } from 'graphql';
20
+ import { InputValueDefinitionNode } from 'graphql';
21
+ import { MutationFieldType } from '@aws-amplify/graphql-transformer-interfaces';
22
+ import { ObjectTypeDefinitionNode } from 'graphql';
23
+ import { QueryFieldType } from '@aws-amplify/graphql-transformer-interfaces';
24
+ import { SubscriptionFieldType } from '@aws-amplify/graphql-transformer-interfaces';
25
+ import { SyncConfig } from '@aws-amplify/graphql-transformer-core';
26
+ import { TransformerBeforeStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
27
+ import { TransformerContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
28
+ import { TransformerModelBase } from '@aws-amplify/graphql-transformer-core';
29
+ import { TransformerModelProvider } from '@aws-amplify/graphql-transformer-interfaces';
30
+ import { TransformerPrepareStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
31
+ import { TransformerResolverProvider } from '@aws-amplify/graphql-transformer-interfaces';
32
+ import { TransformerSchemaVisitStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
33
+ import { TransformerTransformSchemaStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
34
+ import { TransformerValidationStepContextProvider } from '@aws-amplify/graphql-transformer-interfaces';
35
+
36
+ // @public (undocumented)
37
+ export const addDirectivesToField: (ctx: TransformerTransformSchemaStepContextProvider, typeName: string, fieldName: string, directives: Array<DirectiveNode>) => void;
38
+
39
+ // @public (undocumented)
40
+ export const addDirectivesToOperation: (ctx: TransformerTransformSchemaStepContextProvider, typeName: string, operationName: string, directives: Array<DirectiveNode>) => void;
41
+
42
+ // @public (undocumented)
43
+ export const addModelConditionInputs: (ctx: TransformerTransformSchemaStepContextProvider) => void;
44
+
45
+ // @public (undocumented)
46
+ export const createEnumModelFilters: (ctx: TransformerTransformSchemaStepContextProvider, type: ObjectTypeDefinitionNode) => InputObjectTypeDefinitionNode[];
47
+
48
+ // @public (undocumented)
49
+ export const extendTypeWithDirectives: (ctx: TransformerTransformSchemaStepContextProvider, typeName: string, directives: Array<DirectiveNode>) => void;
50
+
51
+ // @public (undocumented)
52
+ export const generateApplyDefaultsToInputTemplate: (target: string) => Expression;
53
+
54
+ // @public (undocumented)
55
+ export const generateAuthExpressionForSandboxMode: (enabled: boolean) => string;
56
+
57
+ // @public (undocumented)
58
+ export const generateConditionSlot: (inputConditionObjectName: string, conditionOutputVariableName: string) => CompoundExpressionNode;
59
+
60
+ // @public (undocumented)
61
+ export const generateCreateInitSlotTemplate: (modelConfig: ModelDirectiveConfiguration) => string;
62
+
63
+ // @public (undocumented)
64
+ export const generateCreateRequestTemplate: (modelName: string, modelIndexFields: string[]) => string;
65
+
66
+ // @public (undocumented)
67
+ export const generateDefaultResponseMappingTemplate: (isSyncEnabled: boolean, mutation?: boolean) => string;
68
+
69
+ // @public (undocumented)
70
+ export const generateDeleteRequestTemplate: (isSyncEnabled: boolean) => string;
71
+
72
+ // @public (undocumented)
73
+ export function generateModelScalarFilterInputName(typeName: string, includeFilter: boolean, isSubscriptionFilter?: boolean): string;
74
+
75
+ // @public (undocumented)
76
+ export const generateResolverKey: (typeName: string, fieldName: string) => string;
77
+
78
+ // @public (undocumented)
79
+ export const generateSubscriptionRequestTemplate: () => string;
80
+
81
+ // @public (undocumented)
82
+ export const generateSubscriptionResponseTemplate: () => string;
83
+
84
+ // @public (undocumented)
85
+ export const generateUpdateInitSlotTemplate: (modelConfig: ModelDirectiveConfiguration) => string;
86
+
87
+ // @public (undocumented)
88
+ export const generateUpdateRequestTemplate: (modelName: string, isSyncEnabled: boolean) => string;
89
+
90
+ // @public (undocumented)
91
+ export const getSubscriptionFilterInputName: (name: string) => string;
92
+
93
+ // @public (undocumented)
94
+ export function makeAttributeTypeEnum(): EnumTypeDefinitionNode;
95
+
96
+ // @public (undocumented)
97
+ export const makeConditionFilterInput: (ctx: TransformerTransformSchemaStepContextProvider, name: string, object: ObjectTypeDefinitionNode) => InputObjectDefinitionWrapper;
98
+
99
+ // @public (undocumented)
100
+ export const makeCreateInputField: (obj: ObjectTypeDefinitionNode, modelDirectiveConfig: ModelDirectiveConfiguration, knownModelTypes: Set<string>, document: DocumentNode, isSyncEnabled: boolean) => InputObjectTypeDefinitionNode;
101
+
102
+ // @public (undocumented)
103
+ export const makeDeleteInputField: (type: ObjectTypeDefinitionNode, isSyncEnabled: boolean) => InputObjectTypeDefinitionNode;
104
+
105
+ // @public (undocumented)
106
+ export function makeEnumFilterInput(fieldWrapper: FieldWrapper): InputObjectTypeDefinitionNode;
107
+
108
+ // @public (undocumented)
109
+ export const makeListQueryFilterInput: (ctx: TransformerTransformSchemaStepContextProvider, name: string, object: ObjectTypeDefinitionNode) => InputObjectTypeDefinitionNode;
110
+
111
+ // @public (undocumented)
112
+ export const makeListQueryModel: (type: ObjectTypeDefinitionNode, modelName: string, isSyncEnabled: boolean) => ObjectTypeDefinitionNode;
113
+
114
+ // @public (undocumented)
115
+ export function makeModelScalarFilterInputObject(type: string, supportsConditions: boolean, isSubscriptionFilter?: boolean): InputObjectTypeDefinitionNode;
116
+
117
+ // @public (undocumented)
118
+ export const makeModelSortDirectionEnumObject: () => EnumTypeDefinitionNode;
119
+
120
+ // @public (undocumented)
121
+ export const makeMutationConditionInput: (ctx: TransformerTransformSchemaStepContextProvider, name: string, object: ObjectTypeDefinitionNode) => InputObjectTypeDefinitionNode;
122
+
123
+ // @public (undocumented)
124
+ export function makeSizeInputType(): InputObjectTypeDefinitionNode;
125
+
126
+ // @public (undocumented)
127
+ export function makeSubscriptionField(fieldName: string, returnTypeName: string, mutations: string[]): FieldDefinitionNode;
128
+
129
+ // @public (undocumented)
130
+ export const makeSubscriptionFilterInput: (ctx: TransformerTransformSchemaStepContextProvider, name: string, object: ObjectTypeDefinitionNode) => InputObjectDefinitionWrapper;
131
+
132
+ // @public (undocumented)
133
+ export const makeSubscriptionQueryFilterInput: (ctx: TransformerTransformSchemaStepContextProvider, name: string, object: ObjectTypeDefinitionNode) => InputObjectTypeDefinitionNode;
134
+
135
+ // @public (undocumented)
136
+ export const makeUpdateInputField: (obj: ObjectTypeDefinitionNode, modelDirectiveConfig: ModelDirectiveConfiguration, knownModelTypes: Set<string>, document: DocumentNode, isSyncEnabled: boolean) => InputObjectTypeDefinitionNode;
137
+
138
+ // @public (undocumented)
139
+ export type ModelDirectiveConfiguration = {
140
+ queries?: Partial<{
141
+ get: Partial<string>;
142
+ list: Partial<string>;
143
+ sync: Partial<string>;
144
+ }>;
145
+ mutations: Partial<{
146
+ create: Partial<string>;
147
+ update: Partial<string>;
148
+ delete: Partial<string>;
149
+ }>;
150
+ subscriptions: Partial<{
151
+ onCreate: Partial<string>[];
152
+ onUpdate: Partial<string>[];
153
+ onDelete: Partial<string>[];
154
+ level: SubscriptionLevel;
155
+ }>;
156
+ timestamps: Partial<{
157
+ createdAt: Partial<string>;
158
+ updatedAt: Partial<string>;
159
+ }>;
160
+ };
161
+
162
+ // @public (undocumented)
163
+ export class ModelTransformer extends TransformerModelBase implements TransformerModelProvider {
164
+ // Warning: (ae-forgotten-export) The symbol "ModelTransformerOptions" needs to be exported by the entry point index.d.ts
165
+ constructor(options?: ModelTransformerOptions);
166
+ // (undocumented)
167
+ before: (ctx: TransformerBeforeStepContextProvider) => void;
168
+ // (undocumented)
169
+ createIAMRole: (context: TransformerContextProvider, def: ObjectTypeDefinitionNode, stack: cdk.Stack, tableName: string) => iam.Role;
170
+ // (undocumented)
171
+ ensureModelSortDirectionEnum: (ctx: TransformerValidationStepContextProvider) => void;
172
+ // (undocumented)
173
+ generateCreateResolver: (ctx: TransformerContextProvider, type: ObjectTypeDefinitionNode, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
174
+ // (undocumented)
175
+ generateDeleteResolver: (ctx: TransformerContextProvider, type: ObjectTypeDefinitionNode, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
176
+ // (undocumented)
177
+ generateGetResolver: (ctx: TransformerContextProvider, type: ObjectTypeDefinitionNode, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
178
+ // (undocumented)
179
+ generateListResolver: (ctx: TransformerContextProvider, type: ObjectTypeDefinitionNode, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
180
+ // (undocumented)
181
+ generateOnCreateResolver: (ctx: TransformerContextProvider, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
182
+ // (undocumented)
183
+ generateOnDeleteResolver: (ctx: TransformerContextProvider, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
184
+ // (undocumented)
185
+ generateOnUpdateResolver: (ctx: TransformerContextProvider, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
186
+ // (undocumented)
187
+ generateResolvers: (context: TransformerContextProvider) => void;
188
+ // (undocumented)
189
+ generateSyncResolver: (ctx: TransformerContextProvider, type: ObjectTypeDefinitionNode, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
190
+ // (undocumented)
191
+ generateUpdateResolver: (ctx: TransformerContextProvider, type: ObjectTypeDefinitionNode, typeName: string, fieldName: string, resolverLogicalId: string) => TransformerResolverProvider;
192
+ // (undocumented)
193
+ getDataSourceResource: (type: ObjectTypeDefinitionNode) => DataSourceInstance;
194
+ // (undocumented)
195
+ getDataSourceType: () => AppSyncDataSourceType;
196
+ // (undocumented)
197
+ getInputs: (ctx: TransformerTransformSchemaStepContextProvider, type: ObjectTypeDefinitionNode, operation: {
198
+ fieldName: string;
199
+ typeName: string;
200
+ type: QueryFieldType | MutationFieldType | SubscriptionFieldType;
201
+ }) => InputValueDefinitionNode[];
202
+ // (undocumented)
203
+ getMutationFieldNames: (type: ObjectTypeDefinitionNode) => Set<{
204
+ fieldName: string;
205
+ typeName: string;
206
+ type: MutationFieldType;
207
+ resolverLogicalId: string;
208
+ }>;
209
+ // (undocumented)
210
+ getMutationName: (subscriptionType: SubscriptionFieldType, mutationMap: Set<{
211
+ fieldName: string;
212
+ typeName: string;
213
+ type: MutationFieldType;
214
+ resolverLogicalId: string;
215
+ }>) => string;
216
+ // (undocumented)
217
+ getOutputType: (ctx: TransformerTransformSchemaStepContextProvider, type: ObjectTypeDefinitionNode, operation: {
218
+ fieldName: string;
219
+ typeName: string;
220
+ type: QueryFieldType | MutationFieldType | SubscriptionFieldType;
221
+ }) => ObjectTypeDefinitionNode;
222
+ // (undocumented)
223
+ getQueryFieldNames: (type: ObjectTypeDefinitionNode) => Set<{
224
+ fieldName: string;
225
+ typeName: string;
226
+ type: QueryFieldType;
227
+ resolverLogicalId: string;
228
+ }>;
229
+ // (undocumented)
230
+ getSubscriptionFieldNames: (type: ObjectTypeDefinitionNode) => Set<{
231
+ fieldName: string;
232
+ typeName: string;
233
+ type: SubscriptionFieldType;
234
+ resolverLogicalId: string;
235
+ }>;
236
+ // (undocumented)
237
+ object: (definition: ObjectTypeDefinitionNode, directive: DirectiveNode, ctx: TransformerSchemaVisitStepContextProvider) => void;
238
+ // (undocumented)
239
+ prepare: (context: TransformerPrepareStepContextProvider) => void;
240
+ // (undocumented)
241
+ transformSchema: (ctx: TransformerTransformSchemaStepContextProvider) => void;
242
+ }
243
+
244
+ // @public (undocumented)
245
+ export const OPERATION_KEY = "__operation";
246
+
247
+ // @public (undocumented)
248
+ export const propagateApiKeyToNestedTypes: (ctx: TransformerContextProvider, def: ObjectTypeDefinitionNode, seenNonModelTypes: Set<string>) => void;
249
+
250
+ // @public (undocumented)
251
+ export const removeSubscriptionFilterInputAttribute: (ctx: TransformerTransformSchemaStepContextProvider, typeName: string, fieldName: string) => void;
252
+
253
+ // @public (undocumented)
254
+ export enum SubscriptionLevel {
255
+ // (undocumented)
256
+ off = "off",
257
+ // (undocumented)
258
+ on = "on",
259
+ // (undocumented)
260
+ public = "public"
261
+ }
262
+
263
+ // (No @packageDocumentation comment for this package)
264
+
265
+ ```
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
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.1.0-beta.4](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.7...@aws-amplify/graphql-model-transformer@1.1.0-beta.4) (2023-02-03)
7
+
8
+ ### Bug Fixes
9
+
10
+ - lock CDK v2 version ([#923](https://github.com/aws-amplify/amplify-category-api/issues/923)) ([2afe40c](https://github.com/aws-amplify/amplify-category-api/commit/2afe40cf13e7d1ee7db37988b9b3297768c7bd0a))
11
+ - preserve logical id patterns for dynamodb tables and search domain ([#894](https://github.com/aws-amplify/amplify-category-api/issues/894)) ([7530fc2](https://github.com/aws-amplify/amplify-category-api/commit/7530fc2e9254b621dc3782271318dd3f5c97d2b8))
12
+
13
+ ### Features
14
+
15
+ - migrate index and model transformers to CDK v2 ([#860](https://github.com/aws-amplify/amplify-category-api/issues/860)) ([886ab6c](https://github.com/aws-amplify/amplify-category-api/commit/886ab6c1eb699f9a09f273c76b3c419c73004f9b))
16
+
17
+ # [1.1.0-beta.3](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.4...@aws-amplify/graphql-model-transformer@1.1.0-beta.3) (2022-12-27)
18
+
19
+ ### Bug Fixes
20
+
21
+ - lock CDK v2 version ([#923](https://github.com/aws-amplify/amplify-category-api/issues/923)) ([2afe40c](https://github.com/aws-amplify/amplify-category-api/commit/2afe40cf13e7d1ee7db37988b9b3297768c7bd0a))
22
+ - preserve logical id patterns for dynamodb tables and search domain ([#894](https://github.com/aws-amplify/amplify-category-api/issues/894)) ([7530fc2](https://github.com/aws-amplify/amplify-category-api/commit/7530fc2e9254b621dc3782271318dd3f5c97d2b8))
23
+
24
+ ### Features
25
+
26
+ - migrate index and model transformers to CDK v2 ([#860](https://github.com/aws-amplify/amplify-category-api/issues/860)) ([886ab6c](https://github.com/aws-amplify/amplify-category-api/commit/886ab6c1eb699f9a09f273c76b3c419c73004f9b))
27
+
6
28
  # [1.1.0-beta.2](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@1.1.0-beta.0...@aws-amplify/graphql-model-transformer@1.1.0-beta.2) (2022-12-12)
7
29
 
8
30
  **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
@@ -42,6 +64,22 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
42
64
 
43
65
  - migrate index and model transformers to CDK v2 ([#860](https://github.com/aws-amplify/amplify-category-api/issues/860)) ([886ab6c](https://github.com/aws-amplify/amplify-category-api/commit/886ab6c1eb699f9a09f273c76b3c419c73004f9b))
44
66
 
67
+ ## [0.16.7](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.6...@aws-amplify/graphql-model-transformer@0.16.7) (2023-01-26)
68
+
69
+ **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
70
+
71
+ ## [0.16.6](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.5...@aws-amplify/graphql-model-transformer@0.16.6) (2023-01-12)
72
+
73
+ **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
74
+
75
+ ## [0.16.5](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.4...@aws-amplify/graphql-model-transformer@0.16.5) (2023-01-12)
76
+
77
+ **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
78
+
79
+ ## [0.16.4](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.3...@aws-amplify/graphql-model-transformer@0.16.4) (2022-12-03)
80
+
81
+ **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
82
+
45
83
  ## [0.16.3](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.2...@aws-amplify/graphql-model-transformer@0.16.3) (2022-11-08)
46
84
 
47
85
  **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/graphql-model-transformer",
3
- "version": "1.1.0-beta.2",
3
+ "version": "1.1.0-beta.4",
4
4
  "description": "Amplify graphql @model transformer",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,17 +25,18 @@
25
25
  "watch": "tsc -w",
26
26
  "clean": "rimraf ./lib",
27
27
  "test": "jest",
28
- "test-watch": "jest --watch"
28
+ "test-watch": "jest --watch",
29
+ "extract-api": "ts-node ../../scripts/extract-api.ts"
29
30
  },
30
31
  "dependencies": {
31
- "@aws-amplify/graphql-transformer-core": "1.1.0-beta.2",
32
- "@aws-amplify/graphql-transformer-interfaces": "2.1.0-beta.2",
32
+ "@aws-amplify/graphql-transformer-core": "1.1.0-beta.4",
33
+ "@aws-amplify/graphql-transformer-interfaces": "2.1.0-beta.4",
33
34
  "@aws-cdk/aws-appsync-alpha": "~2.53.0-alpha.0",
34
35
  "aws-cdk-lib": "~2.53.0",
35
36
  "constructs": "^10.0.5",
36
- "graphql": "^14.5.8",
37
- "graphql-mapping-template": "4.20.5",
38
- "graphql-transformer-common": "4.24.1-beta.1"
37
+ "graphql": "^15.5.0",
38
+ "graphql-mapping-template": "4.20.8-beta.0",
39
+ "graphql-transformer-common": "4.24.5-beta.0"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@types/node": "^12.12.6"
@@ -58,5 +59,5 @@
58
59
  "overrides"
59
60
  ]
60
61
  },
61
- "gitHead": "6d8f80e73080a3e01b91a052b71096e458785c33"
62
+ "gitHead": "eef8ea86c0a38391195853d705acce4d49aa2e0e"
62
63
  }
package/src/directive.ts CHANGED
@@ -11,7 +11,7 @@ export enum SubscriptionLevel {
11
11
  }
12
12
 
13
13
  /**
14
- * ModelDirectiveConfiguration
14
+ * ModelDirectiveConfiguration.
15
15
  */
16
16
  export type ModelDirectiveConfiguration = {
17
17
  queries?: Partial<{