@aws-amplify/graphql-model-transformer 2.2.2 → 2.3.0-amplify-table-preview.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 (24) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/graphql-model-transformer.d.ts.map +1 -1
  3. package/lib/graphql-model-transformer.js +4 -0
  4. package/lib/graphql-model-transformer.js.map +1 -1
  5. package/lib/rds-lambda.zip +0 -0
  6. package/lib/rds-notification-lambda.zip +0 -0
  7. package/lib/rds-patching-lambda.zip +0 -0
  8. package/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts +13 -0
  9. package/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -0
  10. package/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +167 -0
  11. package/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -0
  12. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts +40 -0
  13. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.d.ts.map +1 -0
  14. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js +242 -0
  15. package/lib/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.js.map +1 -0
  16. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts +13 -0
  17. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.d.ts.map +1 -0
  18. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js +665 -0
  19. package/lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.js.map +1 -0
  20. package/lib/resources/dynamo-model-resource-generator.d.ts +5 -2
  21. package/lib/resources/dynamo-model-resource-generator.d.ts.map +1 -1
  22. package/lib/resources/dynamo-model-resource-generator.js +46 -60
  23. package/lib/resources/dynamo-model-resource-generator.js.map +1 -1
  24. package/package.json +7 -6
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AmplifyDynamoDBTable = exports.CUSTOM_DDB_CFN_TYPE = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb");
6
+ const HASH_KEY_TYPE = 'HASH';
7
+ const RANGE_KEY_TYPE = 'RANGE';
8
+ const MAX_LOCAL_SECONDARY_INDEX_COUNT = 5;
9
+ exports.CUSTOM_DDB_CFN_TYPE = 'Custom::AmplifyDynamoDBTable';
10
+ class AmplifyDynamoDBTable extends aws_cdk_lib_1.Resource {
11
+ constructor(scope, id, props) {
12
+ var _a;
13
+ super(scope, id, {
14
+ physicalName: props.tableName,
15
+ });
16
+ this.keySchema = new Array();
17
+ this.attributeDefinitions = new Array();
18
+ this.globalSecondaryIndexes = new Array();
19
+ this.localSecondaryIndexes = new Array();
20
+ this.secondaryIndexSchemas = new Map();
21
+ this.nonKeyAttributes = new Set();
22
+ this.customResourceServiceToken = props.customResourceServiceToken;
23
+ this.tableName = this.physicalName;
24
+ const { sseSpecification, encryptionKey } = this.parseEncryption(props);
25
+ let streamSpecification;
26
+ this.billingMode = (_a = props.billingMode) !== null && _a !== void 0 ? _a : aws_dynamodb_1.BillingMode.PROVISIONED;
27
+ if (props.stream) {
28
+ streamSpecification = { streamViewType: props.stream };
29
+ }
30
+ this.validateProvisioning(props);
31
+ this.table = new aws_cdk_lib_1.CustomResource(this, 'Default', {
32
+ serviceToken: this.customResourceServiceToken,
33
+ resourceType: exports.CUSTOM_DDB_CFN_TYPE,
34
+ properties: {
35
+ tableName: this.tableName,
36
+ attributeDefinitions: this.attributeDefinitions,
37
+ keySchema: this.keySchema,
38
+ globalSecondaryIndexes: aws_cdk_lib_1.Lazy.any({ produce: () => this.globalSecondaryIndexes }, { omitEmptyArray: true }),
39
+ localSecondaryIndexes: aws_cdk_lib_1.Lazy.any({ produce: () => this.localSecondaryIndexes }, { omitEmptyArray: true }),
40
+ pointInTimeRecoverySpecification: props.pointInTimeRecovery != null ? { pointInTimeRecoveryEnabled: props.pointInTimeRecovery } : undefined,
41
+ billingMode: this.billingMode === aws_dynamodb_1.BillingMode.PAY_PER_REQUEST ? this.billingMode : undefined,
42
+ provisionedThroughput: this.billingMode === aws_dynamodb_1.BillingMode.PAY_PER_REQUEST
43
+ ? undefined
44
+ : {
45
+ readCapacityUnits: props.readCapacity || 5,
46
+ writeCapacityUnits: props.writeCapacity || 5,
47
+ },
48
+ sseSpecification: sseSpecification,
49
+ streamSpecification: streamSpecification,
50
+ tableClass: props.tableClass,
51
+ timeToLiveSpecification: props.timeToLiveAttribute ? { attributeName: props.timeToLiveAttribute, enabled: true } : undefined,
52
+ deletionProtectionEnabled: props.deletionProtection,
53
+ },
54
+ removalPolicy: props.removalPolicy,
55
+ });
56
+ this.encryptionKey = encryptionKey;
57
+ this.tableArn = this.table.getAttString('TableArn');
58
+ this.tableStreamArn = streamSpecification ? this.table.getAttString('TableStreamArn') : undefined;
59
+ this.tableFromAttr = aws_dynamodb_1.Table.fromTableAttributes(scope, `CustomTable${id}`, {
60
+ tableArn: this.tableArn,
61
+ tableStreamArn: this.tableStreamArn,
62
+ });
63
+ this.addKey(props.partitionKey, HASH_KEY_TYPE);
64
+ this.tablePartitionKey = props.partitionKey;
65
+ if (props.sortKey) {
66
+ this.addKey(props.sortKey, RANGE_KEY_TYPE);
67
+ this.tableSortKey = props.sortKey;
68
+ }
69
+ this.node.addValidation({ validate: () => this.validateTable() });
70
+ }
71
+ addGlobalSecondaryIndex(props) {
72
+ this.validateProvisioning(props);
73
+ this.validateIndexName(props.indexName);
74
+ const gsiKeySchema = this.buildIndexKeySchema(props.partitionKey, props.sortKey);
75
+ const gsiProjection = this.buildIndexProjection(props);
76
+ this.globalSecondaryIndexes.push({
77
+ indexName: props.indexName,
78
+ keySchema: gsiKeySchema,
79
+ projection: gsiProjection,
80
+ provisionedThroughput: this.billingMode === aws_dynamodb_1.BillingMode.PAY_PER_REQUEST
81
+ ? undefined
82
+ : {
83
+ readCapacityUnits: props.readCapacity || 5,
84
+ writeCapacityUnits: props.writeCapacity || 5,
85
+ },
86
+ });
87
+ this.secondaryIndexSchemas.set(props.indexName, {
88
+ partitionKey: props.partitionKey,
89
+ sortKey: props.sortKey,
90
+ });
91
+ }
92
+ addLocalSecondaryIndex(props) {
93
+ if (this.localSecondaryIndexes.length >= MAX_LOCAL_SECONDARY_INDEX_COUNT) {
94
+ throw new RangeError(`a maximum number of local secondary index per table is ${MAX_LOCAL_SECONDARY_INDEX_COUNT}`);
95
+ }
96
+ this.validateIndexName(props.indexName);
97
+ const lsiKeySchema = this.buildIndexKeySchema(this.tablePartitionKey, props.sortKey);
98
+ const lsiProjection = this.buildIndexProjection(props);
99
+ this.localSecondaryIndexes.push({
100
+ indexName: props.indexName,
101
+ keySchema: lsiKeySchema,
102
+ projection: lsiProjection,
103
+ });
104
+ this.secondaryIndexSchemas.set(props.indexName, {
105
+ partitionKey: this.tablePartitionKey,
106
+ sortKey: props.sortKey,
107
+ });
108
+ }
109
+ schema(indexName) {
110
+ if (!indexName) {
111
+ return {
112
+ partitionKey: this.tablePartitionKey,
113
+ sortKey: this.tableSortKey,
114
+ };
115
+ }
116
+ let schema = this.secondaryIndexSchemas.get(indexName);
117
+ if (!schema) {
118
+ throw new Error(`Cannot find schema for index: ${indexName}. Use 'addGlobalSecondaryIndex' or 'addLocalSecondaryIndex' to add index`);
119
+ }
120
+ return schema;
121
+ }
122
+ addKey(attribute, keyType) {
123
+ const existingProp = this.findKey(keyType);
124
+ if (existingProp) {
125
+ throw new Error(`Unable to set ${attribute.name} as a ${keyType} key, because ${existingProp.attributeName} is a ${keyType} key`);
126
+ }
127
+ this.registerAttribute(attribute);
128
+ this.keySchema.push({
129
+ attributeName: attribute.name,
130
+ keyType,
131
+ });
132
+ return this;
133
+ }
134
+ findKey(keyType) {
135
+ return this.keySchema.find((prop) => prop.keyType === keyType);
136
+ }
137
+ registerAttribute(attribute) {
138
+ const { name, type } = attribute;
139
+ const existingDef = this.attributeDefinitions.find((def) => def.attributeName === name);
140
+ if (existingDef && existingDef.attributeType !== type) {
141
+ throw new Error(`Unable to specify ${name} as ${type} because it was already defined as ${existingDef.attributeType}`);
142
+ }
143
+ if (!existingDef) {
144
+ this.attributeDefinitions.push({
145
+ attributeName: name,
146
+ attributeType: type,
147
+ });
148
+ }
149
+ }
150
+ validateTable() {
151
+ const errors = new Array();
152
+ if (!this.tablePartitionKey) {
153
+ errors.push('a partition key must be specified');
154
+ }
155
+ if (this.localSecondaryIndexes.length > 0 && !this.tableSortKey) {
156
+ errors.push('a sort key of the table must be specified to add local secondary indexes');
157
+ }
158
+ return errors;
159
+ }
160
+ parseEncryption(props) {
161
+ var _a;
162
+ let encryptionType = props.encryption;
163
+ if (encryptionType === undefined) {
164
+ encryptionType =
165
+ props.encryptionKey != null
166
+ ?
167
+ aws_dynamodb_1.TableEncryption.CUSTOMER_MANAGED
168
+ :
169
+ aws_dynamodb_1.TableEncryption.AWS_MANAGED;
170
+ }
171
+ if (encryptionType !== aws_dynamodb_1.TableEncryption.CUSTOMER_MANAGED && props.encryptionKey) {
172
+ throw new Error('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`');
173
+ }
174
+ if (encryptionType === aws_dynamodb_1.TableEncryption.CUSTOMER_MANAGED && props.replicationRegions) {
175
+ throw new Error('TableEncryption.CUSTOMER_MANAGED is not supported by DynamoDB Global Tables (where replicationRegions was set)');
176
+ }
177
+ switch (encryptionType) {
178
+ case aws_dynamodb_1.TableEncryption.CUSTOMER_MANAGED:
179
+ const encryptionKey = (_a = props.encryptionKey) !== null && _a !== void 0 ? _a : new aws_cdk_lib_1.aws_kms.Key(this, 'Key', {
180
+ description: `Customer-managed key auto-created for encrypting DynamoDB table at ${this.node.path}`,
181
+ enableKeyRotation: true,
182
+ });
183
+ return {
184
+ sseSpecification: { sseEnabled: true, kmsMasterKeyId: encryptionKey.keyArn, sseType: 'KMS' },
185
+ encryptionKey,
186
+ };
187
+ case aws_dynamodb_1.TableEncryption.AWS_MANAGED:
188
+ return { sseSpecification: { sseEnabled: true } };
189
+ case aws_dynamodb_1.TableEncryption.DEFAULT:
190
+ return { sseSpecification: { sseEnabled: false } };
191
+ case undefined:
192
+ return { sseSpecification: undefined };
193
+ default:
194
+ throw new Error(`Unexpected 'encryptionType': ${encryptionType}`);
195
+ }
196
+ }
197
+ validateProvisioning(props) {
198
+ if (this.billingMode === aws_dynamodb_1.BillingMode.PAY_PER_REQUEST) {
199
+ if (props.readCapacity !== undefined || props.writeCapacity !== undefined) {
200
+ throw new Error('you cannot provision read and write capacity for a table with PAY_PER_REQUEST billing mode');
201
+ }
202
+ }
203
+ }
204
+ validateIndexName(indexName) {
205
+ if (this.secondaryIndexSchemas.has(indexName)) {
206
+ throw new Error(`a duplicate index name, ${indexName}, is not allowed`);
207
+ }
208
+ }
209
+ validateNonKeyAttributes(nonKeyAttributes) {
210
+ if (this.nonKeyAttributes.size + nonKeyAttributes.length > 100) {
211
+ throw new RangeError('a maximum number of nonKeyAttributes across all of secondary indexes is 100');
212
+ }
213
+ nonKeyAttributes.forEach((att) => this.nonKeyAttributes.add(att));
214
+ }
215
+ buildIndexKeySchema(partitionKey, sortKey) {
216
+ this.registerAttribute(partitionKey);
217
+ const indexKeySchema = [{ attributeName: partitionKey.name, keyType: HASH_KEY_TYPE }];
218
+ if (sortKey) {
219
+ this.registerAttribute(sortKey);
220
+ indexKeySchema.push({ attributeName: sortKey.name, keyType: RANGE_KEY_TYPE });
221
+ }
222
+ return indexKeySchema;
223
+ }
224
+ buildIndexProjection(props) {
225
+ var _a, _b;
226
+ if (props.projectionType === aws_dynamodb_1.ProjectionType.INCLUDE && !props.nonKeyAttributes) {
227
+ throw new Error(`non-key attributes should be specified when using ${aws_dynamodb_1.ProjectionType.INCLUDE} projection type`);
228
+ }
229
+ if (props.projectionType !== aws_dynamodb_1.ProjectionType.INCLUDE && props.nonKeyAttributes) {
230
+ throw new Error(`non-key attributes should not be specified when not using ${aws_dynamodb_1.ProjectionType.INCLUDE} projection type`);
231
+ }
232
+ if (props.nonKeyAttributes) {
233
+ this.validateNonKeyAttributes(props.nonKeyAttributes);
234
+ }
235
+ return {
236
+ projectionType: (_a = props.projectionType) !== null && _a !== void 0 ? _a : aws_dynamodb_1.ProjectionType.ALL,
237
+ nonKeyAttributes: (_b = props.nonKeyAttributes) !== null && _b !== void 0 ? _b : undefined,
238
+ };
239
+ }
240
+ }
241
+ exports.AmplifyDynamoDBTable = AmplifyDynamoDBTable;
242
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/resources/amplify-dynamodb-table/amplify-dynamodb-table-construct/index.ts"],"names":[],"mappings":";;;AAAA,6CAA6E;AAC7E,2DAckC;AAGlC,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,cAAc,GAAG,OAAO,CAAC;AAG/B,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAE7B,QAAA,mBAAmB,GAAG,8BAA8B,CAAC;AAKlE,MAAa,oBAAqB,SAAQ,sBAAQ;IAsBhD,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAgC;;QACxE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE;YACf,YAAY,EAAE,KAAK,CAAC,SAAS;SAC9B,CAAC,CAAC;QAhBY,cAAS,GAAG,IAAI,KAAK,EAA8B,CAAC;QACpD,yBAAoB,GAAG,IAAI,KAAK,EAAwC,CAAC;QACzE,2BAAsB,GAAG,IAAI,KAAK,EAAyC,CAAC;QAC5E,0BAAqB,GAAG,IAAI,KAAK,EAAwC,CAAC;QAE1E,0BAAqB,GAAG,IAAI,GAAG,EAAyB,CAAC;QACzD,qBAAgB,GAAG,IAAI,GAAG,EAA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AI,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;SAC/E;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAEO,oBAAoB,CAAC,KAA0B;;QACrD,IAAI,KAAK,CAAC,cAAc,KAAK,6BAAc,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;YAE9E,MAAM,IAAI,KAAK,CAAC,qDAAqD,6BAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;SAChH;QAED,IAAI,KAAK,CAAC,cAAc,KAAK,6BAAc,CAAC,OAAO,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAE7E,MAAM,IAAI,KAAK,CAAC,6DAA6D,6BAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;SACxH;QAED,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC1B,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;SACvD;QAED,OAAO;YACL,cAAc,EAAE,MAAA,KAAK,CAAC,cAAc,mCAAI,6BAAc,CAAC,GAAG;YAC1D,gBAAgB,EAAE,MAAA,KAAK,CAAC,gBAAgB,mCAAI,SAAS;SACtD,CAAC;IACJ,CAAC;CACF;AA7VD,oDA6VC"}
@@ -0,0 +1,13 @@
1
+ import { DynamoDB } from 'aws-sdk';
2
+ import type { CreateTableInput, TableDescription, UpdateTableInput, UpdateTimeToLiveInput, UpdateContinuousBackupsInput } from 'aws-sdk/clients/dynamodb';
3
+ export declare const onEvent: (event: AWSCDKAsyncCustomResource.OnEventRequest) => Promise<AWSCDKAsyncCustomResource.OnEventResponse>;
4
+ export declare const isComplete: (event: AWSCDKAsyncCustomResource.IsCompleteRequest) => Promise<AWSCDKAsyncCustomResource.IsCompleteResponse>;
5
+ export declare const getNextGSIUpdate: (currentState: TableDescription, endState: CustomDDB.Input) => UpdateTableInput | undefined;
6
+ export declare const getStreamUpdate: (currentState: TableDescription, endState: CustomDDB.Input) => Promise<UpdateTableInput | undefined>;
7
+ export declare const getSseUpdate: (currentState: TableDescription, endState: CustomDDB.Input) => UpdateTableInput | undefined;
8
+ export declare const getDeletionProtectionUpdate: (currentState: TableDescription, endState: CustomDDB.Input) => UpdateTableInput | undefined;
9
+ export declare const getTtlUpdate: (currentTTL: DynamoDB.TimeToLiveDescription | undefined, endState: CustomDDB.Input) => UpdateTimeToLiveInput | undefined;
10
+ export declare const getPointInTimeRecoveryUpdate: (currentPointInTime: DynamoDB.ContinuousBackupsDescription | undefined, endState: CustomDDB.Input) => UpdateContinuousBackupsInput | undefined;
11
+ export declare const extractTableInputFromEvent: (event: AWSCDKAsyncCustomResource.OnEventRequest | AWSCDKAsyncCustomResource.IsCompleteRequest) => CustomDDB.Input;
12
+ export declare const toCreateTableInput: (props: CustomDDB.Input) => CreateTableInput;
13
+ //# sourceMappingURL=amplify-table-manager-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amplify-table-manager-handler.d.ts","sourceRoot":"","sources":["../../../../src/resources/amplify-dynamodb-table/amplify-table-manager-lambda/amplify-table-manager-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EACV,gBAAgB,EAGhB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AA4BlC,eAAO,MAAM,OAAO,UAAiB,0BAA0B,cAAc,KAAG,QAAQ,0BAA0B,eAAe,CAmLhI,CAAC;AAQF,eAAO,MAAM,UAAU,UACd,0BAA0B,iBAAiB,KACjD,QAAQ,0BAA0B,kBAAkB,CA8DtD,CAAC;AAQF,eAAO,MAAM,gBAAgB,iBAAkB,gBAAgB,YAAY,UAAU,KAAK,KAAG,gBAAgB,GAAG,SAsJ/G,CAAC;AASF,eAAO,MAAM,eAAe,iBAAwB,gBAAgB,YAAY,UAAU,KAAK,KAAG,QAAQ,gBAAgB,GAAG,SAAS,CAmCrI,CAAC;AAQF,eAAO,MAAM,YAAY,iBAAkB,gBAAgB,YAAY,UAAU,KAAK,KAAG,gBAAgB,GAAG,SAqC3G,CAAC;AAQF,eAAO,MAAM,2BAA2B,iBAAkB,gBAAgB,YAAY,UAAU,KAAK,KAAG,gBAAgB,GAAG,SAe1H,CAAC;AAQF,eAAO,MAAM,YAAY,eACX,SAAS,qBAAqB,GAAG,SAAS,YAC5C,UAAU,KAAK,KACxB,qBAAqB,GAAG,SAqC1B,CAAC;AAQF,eAAO,MAAM,4BAA4B,uBACnB,SAAS,4BAA4B,GAAG,SAAS,YAC3D,UAAU,KAAK,KACxB,4BAA4B,GAAG,SA0BjC,CAAC;AAiBF,eAAO,MAAM,0BAA0B,UAC9B,0BAA0B,cAAc,GAAG,0BAA0B,iBAAiB,KAC5F,UAAU,KAQZ,CAAC;AAwFF,eAAO,MAAM,kBAAkB,UAAW,UAAU,KAAK,KAAG,gBAiB3D,CAAC"}