@aws-amplify/graphql-model-transformer
Advanced tools
Comparing version 2.12.0-gen2-migration-0809.0 to 3.0.0
@@ -6,14 +6,14 @@ # Change Log | ||
# [2.12.0-gen2-migration-0809.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@2.11.3...@aws-amplify/graphql-model-transformer@2.12.0-gen2-migration-0809.0) (2024-08-09) | ||
# [3.0.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@2.11.4...@aws-amplify/graphql-model-transformer@3.0.0) (2024-08-20) | ||
### Bug Fixes | ||
- feat!: bump version for v2 transformer packages ([7dac35c](https://github.com/aws-amplify/amplify-category-api/commit/7dac35cceb971b256b5688b0745ef82afc78b641)) | ||
- adjust default table properties ([#2726](https://github.com/aws-amplify/amplify-category-api/issues/2726)) ([df3a50b](https://github.com/aws-amplify/amplify-category-api/commit/df3a50b2effb88bc56525c628045c84e9d259a4c)) | ||
### BREAKING CHANGES | ||
### Features | ||
- distinguish from LTS version | ||
- get datasource map for migration ([#2668](https://github.com/aws-amplify/amplify-category-api/issues/2668)) ([02c7da0](https://github.com/aws-amplify/amplify-category-api/commit/02c7da0da0d5837ca05a8e4ff1b1536cc20ae15b)) | ||
- import existing table to amplify managed table ([#2634](https://github.com/aws-amplify/amplify-category-api/issues/2634)) ([b3fb28f](https://github.com/aws-amplify/amplify-category-api/commit/b3fb28f6a253cae523625c0b2e93ec9ce2c37bab)) | ||
- validate imported tables ([#2696](https://github.com/aws-amplify/amplify-category-api/issues/2696)) ([8c684a9](https://github.com/aws-amplify/amplify-category-api/commit/8c684a9cfe140bc9c45e1ec1212d9bc423acf170)) | ||
## [2.11.4](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@2.11.3...@aws-amplify/graphql-model-transformer@2.11.4) (2024-08-12) | ||
**Note:** Version bump only for package @aws-amplify/graphql-model-transformer | ||
## [2.11.3](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@2.11.2...@aws-amplify/graphql-model-transformer@2.11.3) (2024-07-25) | ||
@@ -20,0 +20,0 @@ |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -30,3 +7,2 @@ exports.ModelTransformer = void 0; | ||
const graphql_directives_1 = require("@aws-amplify/graphql-directives"); | ||
const cdk = __importStar(require("aws-cdk-lib")); | ||
const graphql_transformer_common_1 = require("graphql-transformer-common"); | ||
@@ -39,3 +15,2 @@ const graphql_types_1 = require("./graphql-types"); | ||
const amplify_dynamo_model_resource_generator_1 = require("./resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator"); | ||
const graphql_transformer_core_2 = require("@aws-amplify/graphql-transformer-core"); | ||
const ITERATIVE_TABLE_GENERATOR = 'AmplifyDDB'; | ||
@@ -65,3 +40,3 @@ const SQL_LAMBDA_GENERATOR = 'SQL'; | ||
} | ||
if (strategies.some(graphql_transformer_core_1.isAmplifyDynamoDbModelDataSourceStrategy) || strategies.some(graphql_transformer_core_2.isImportedAmplifyDynamoDbModelDataSourceStrategy)) { | ||
if (strategies.some(graphql_transformer_core_1.isAmplifyDynamoDbModelDataSourceStrategy)) { | ||
(_f = this.resourceGeneratorMap.get(ITERATIVE_TABLE_GENERATOR)) === null || _f === void 0 ? void 0 : _f.enableGenerator(); | ||
@@ -219,21 +194,5 @@ (_g = this.resourceGeneratorMap.get(ITERATIVE_TABLE_GENERATOR)) === null || _g === void 0 ? void 0 : _g.enableProvisioned(); | ||
this.generateResolvers = (context) => { | ||
const dataSourceMapping = {}; | ||
this.resourceGeneratorMap.forEach((generator) => { | ||
generator.generateResources(context); | ||
const ddbDatasources = Object.entries(generator.getDatasourceMap()).filter(([, datasource]) => datasource.ds.type === 'AMAZON_DYNAMODB'); | ||
ddbDatasources.forEach(([modelName, datasource]) => { | ||
if (datasource.ds.dynamoDbConfig && !cdk.isResolvableObject(datasource.ds.dynamoDbConfig)) { | ||
dataSourceMapping[modelName] = datasource.ds.dynamoDbConfig.tableName; | ||
} | ||
console.warn(`Could not resolve table name for ${modelName}. DataSourceMappingOutput is incomplete. Please manually add ${modelName} to the mapping for your migration.`); | ||
}); | ||
}); | ||
if (context.transformParameters.enableGen2Migration && context.transformParameters.enableTransformerCfnOutputs) { | ||
const { scope } = context.stackManager; | ||
new cdk.CfnOutput(cdk.Stack.of(scope), 'DataSourceMappingOutput', { | ||
value: cdk.Stack.of(scope).toJsonString(dataSourceMapping), | ||
description: 'Mapping of model name to data source table name.', | ||
exportName: cdk.Fn.join(':', [cdk.Aws.STACK_NAME, 'DataSourceMappingOutput']), | ||
}); | ||
} | ||
}; | ||
@@ -610,5 +569,2 @@ this.generateGetResolver = (ctx, type, typeName, fieldName, resolverLogicalId) => { | ||
} | ||
else if ((0, graphql_transformer_core_2.isImportedAmplifyDynamoDbModelDataSourceStrategy)(strategy)) { | ||
generator = this.resourceGeneratorMap.get(ITERATIVE_TABLE_GENERATOR); | ||
} | ||
if (!generator) { | ||
@@ -622,4 +578,3 @@ throw new Error(`No resource generator assigned for ${typeName} with dbType ${strategy.dbType}`); | ||
this.resourceGeneratorMap.set(SQL_LAMBDA_GENERATOR, new rds_model_resource_generator_1.RdsModelResourceGenerator()); | ||
const amplifyTableDynamoModelResourceGenerator = new amplify_dynamo_model_resource_generator_1.AmplifyDynamoModelResourceGenerator(); | ||
this.resourceGeneratorMap.set(ITERATIVE_TABLE_GENERATOR, amplifyTableDynamoModelResourceGenerator); | ||
this.resourceGeneratorMap.set(ITERATIVE_TABLE_GENERATOR, new amplify_dynamo_model_resource_generator_1.AmplifyDynamoModelResourceGenerator()); | ||
} | ||
@@ -626,0 +581,0 @@ } |
@@ -19,4 +19,4 @@ import { CfnMapping } from 'aws-cdk-lib'; | ||
} | undefined, sqlLambdaVpcConfig?: VpcConfig, sqlLambdaProvisionedConcurrencyConfig?: ProvisionedConcurrencyConfig) => IFunction; | ||
export declare const createLayerVersionCustomResource: (scope: Construct, resourceNames: SQLLambdaResourceNames) => AwsCustomResource; | ||
export declare const createSNSTopicARNCustomResource: (scope: Construct, resourceNames: SQLLambdaResourceNames) => AwsCustomResource; | ||
export declare const createLayerVersionCustomResource: (scope: Construct, resourceNames: SQLLambdaResourceNames, context: TransformerContextProvider) => AwsCustomResource; | ||
export declare const createSNSTopicARNCustomResource: (scope: Construct, resourceNames: SQLLambdaResourceNames, context: TransformerContextProvider) => AwsCustomResource; | ||
export declare const createRdsPatchingLambda: (scope: Construct, apiGraphql: GraphQLAPIProvider, lambdaRole: IRole, resourceNames: SQLLambdaResourceNames, environment?: { | ||
@@ -23,0 +23,0 @@ [key: string]: string; |
@@ -87,3 +87,3 @@ "use strict"; | ||
exports.createRdsLambda = createRdsLambda; | ||
const createLayerVersionCustomResource = (scope, resourceNames) => { | ||
const createLayerVersionCustomResource = (scope, resourceNames, context) => { | ||
const { SQLLayerManifestBucket, SQLLayerManifestBucketRegion, SQLLayerVersionManifestKeyPrefix } = graphql_transformer_common_1.ResourceConstants.RESOURCES; | ||
@@ -93,2 +93,9 @@ const key = aws_cdk_lib_1.Fn.join('', [SQLLayerVersionManifestKeyPrefix, aws_cdk_lib_1.Fn.ref('AWS::Region')]); | ||
const resourceName = resourceNames.sqlLayerVersionResolverCustomResource; | ||
let physicalResourceId; | ||
if (shouldProvisionHotswapFriendlyResources(context)) { | ||
physicalResourceId = custom_resources_1.PhysicalResourceId.of(resourceName); | ||
} | ||
else { | ||
physicalResourceId = custom_resources_1.PhysicalResourceId.of(`${resourceName}-${Date.now().toString()}`); | ||
} | ||
const customResource = new custom_resources_1.AwsCustomResource(scope, resourceName, { | ||
@@ -104,3 +111,3 @@ resourceType: 'Custom::SQLLayerVersionCustomResource', | ||
}, | ||
physicalResourceId: custom_resources_1.PhysicalResourceId.of(`${resourceName}-${Date.now().toString()}`), | ||
physicalResourceId, | ||
}, | ||
@@ -115,3 +122,3 @@ policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({ | ||
exports.createLayerVersionCustomResource = createLayerVersionCustomResource; | ||
const createSNSTopicARNCustomResource = (scope, resourceNames) => { | ||
const createSNSTopicARNCustomResource = (scope, resourceNames, context) => { | ||
const { SQLLayerManifestBucket, SQLLayerManifestBucketRegion, SQLSNSTopicARNManifestKeyPrefix } = graphql_transformer_common_1.ResourceConstants.RESOURCES; | ||
@@ -121,2 +128,9 @@ const key = aws_cdk_lib_1.Fn.join('', [SQLSNSTopicARNManifestKeyPrefix, aws_cdk_lib_1.Fn.ref('AWS::Region')]); | ||
const resourceName = resourceNames.sqlSNSTopicARNResolverCustomResource; | ||
let physicalResourceId; | ||
if (shouldProvisionHotswapFriendlyResources(context)) { | ||
physicalResourceId = custom_resources_1.PhysicalResourceId.of(resourceName); | ||
} | ||
else { | ||
physicalResourceId = custom_resources_1.PhysicalResourceId.of(`${resourceName}-${Date.now().toString()}`); | ||
} | ||
const customResource = new custom_resources_1.AwsCustomResource(scope, resourceName, { | ||
@@ -132,3 +146,3 @@ resourceType: 'Custom::SQLSNSTopicARNCustomResource', | ||
}, | ||
physicalResourceId: custom_resources_1.PhysicalResourceId.of(`${resourceName}-${Date.now().toString()}`), | ||
physicalResourceId, | ||
}, | ||
@@ -143,2 +157,6 @@ policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({ | ||
exports.createSNSTopicARNCustomResource = createSNSTopicARNCustomResource; | ||
const shouldProvisionHotswapFriendlyResources = (context) => { | ||
var _a; | ||
return ((_a = context === null || context === void 0 ? void 0 : context.synthParameters) === null || _a === void 0 ? void 0 : _a.provisionHotswapFriendlyResources) === true; | ||
}; | ||
const addVpcEndpoint = (scope, sqlLambdaVpcConfig, serviceSuffix, resourceNames) => { | ||
@@ -145,0 +163,0 @@ const serviceEndpointPrefix = 'com.amazonaws'; |
@@ -62,6 +62,3 @@ "use strict"; | ||
createCustomProviderResource(scope, context) { | ||
const lambdaCode = aws_cdk_lib_1.aws_lambda.Code.fromAsset(path.join(__dirname, '..', '..', '..', 'lib', 'resources', 'amplify-dynamodb-table', 'amplify-table-manager-lambda'), { exclude: ['*.ts', '*.json', 'LICENSE', 'README.md'] }); | ||
const importedTableNames = Object.values(context.dataSourceStrategies) | ||
.filter(graphql_transformer_core_1.isImportedAmplifyDynamoDbModelDataSourceStrategy) | ||
.map((strategy) => strategy.tableName); | ||
const lambdaCode = aws_cdk_lib_1.aws_lambda.Code.fromAsset(path.join(__dirname, '..', '..', '..', 'lib', 'resources', 'amplify-dynamodb-table', 'amplify-table-manager-lambda'), { exclude: ['*.ts'] }); | ||
const lambdaPolicyDocument = new aws_cdk_lib_1.aws_iam.PolicyDocument({ | ||
@@ -88,5 +85,2 @@ statements: [ | ||
}), | ||
...importedTableNames.map((tableName) => cdk.Fn.sub('arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tableName}', { | ||
tableName, | ||
})), | ||
], | ||
@@ -142,5 +136,3 @@ }), | ||
const tableLogicalName = graphql_transformer_common_1.ModelResourceIDs.ModelTableResourceID(modelName); | ||
const strategy = context.dataSourceStrategies[modelName]; | ||
const isTableImported = (0, graphql_transformer_core_1.isImportedAmplifyDynamoDbModelDataSourceStrategy)(strategy); | ||
const tableName = isTableImported ? strategy.tableName : context.resourceHelper.generateTableName(modelName); | ||
const tableName = context.resourceHelper.generateTableName(modelName); | ||
const { readIops, writeIops, billingMode, pointInTimeRecovery, enableSSE } = this.createDynamoDBParameters(scope, true); | ||
@@ -159,3 +151,3 @@ new cdk.CfnCondition(scope, graphql_transformer_common_1.ResourceConstants.CONDITIONS.HasEnvironmentParameter, { | ||
}); | ||
const removalPolicy = isTableImported || this.options.EnableDeletionProtection ? cdk.RemovalPolicy.RETAIN : cdk.RemovalPolicy.DESTROY; | ||
const removalPolicy = this.options.EnableDeletionProtection ? cdk.RemovalPolicy.RETAIN : cdk.RemovalPolicy.DESTROY; | ||
const table = new amplify_dynamodb_table_construct_1.AmplifyDynamoDBTable(scope, `${tableLogicalName}`, { | ||
@@ -174,3 +166,2 @@ customResourceServiceToken: this.customResourceServiceToken, | ||
...(context.isProjectUsingDataStore() ? { timeToLiveAttribute: '_ttl' } : undefined), | ||
...(isTableImported ? { isImported: true } : undefined), | ||
}); | ||
@@ -177,0 +168,0 @@ (0, graphql_transformer_core_1.setResourceName)(table, { name: modelName, setOnDefaultChild: false }); |
@@ -5,3 +5,2 @@ import { aws_kms as kms, Resource } from 'aws-cdk-lib'; | ||
export declare const CUSTOM_DDB_CFN_TYPE = "Custom::AmplifyDynamoDBTable"; | ||
export declare const CUSTOM_IMPORTED_DDB_CFN_TYPE = "Custom::ImportedAmplifyDynamoDBTable"; | ||
export interface AmplifyDynamoDBTableProps extends TableProps { | ||
@@ -11,3 +10,2 @@ customResourceServiceToken: string; | ||
replaceTableUponGsiUpdate?: boolean; | ||
isImported?: boolean; | ||
} | ||
@@ -14,0 +12,0 @@ export declare class AmplifyDynamoDBTable extends Resource { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AmplifyDynamoDBTable = exports.CUSTOM_IMPORTED_DDB_CFN_TYPE = exports.CUSTOM_DDB_CFN_TYPE = void 0; | ||
exports.AmplifyDynamoDBTable = exports.CUSTOM_DDB_CFN_TYPE = void 0; | ||
const aws_cdk_lib_1 = require("aws-cdk-lib"); | ||
@@ -10,3 +10,2 @@ const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); | ||
exports.CUSTOM_DDB_CFN_TYPE = 'Custom::AmplifyDynamoDBTable'; | ||
exports.CUSTOM_IMPORTED_DDB_CFN_TYPE = 'Custom::ImportedAmplifyDynamoDBTable'; | ||
class AmplifyDynamoDBTable extends aws_cdk_lib_1.Resource { | ||
@@ -35,3 +34,3 @@ constructor(scope, id, props) { | ||
serviceToken: this.customResourceServiceToken, | ||
resourceType: props.isImported ? exports.CUSTOM_IMPORTED_DDB_CFN_TYPE : exports.CUSTOM_DDB_CFN_TYPE, | ||
resourceType: exports.CUSTOM_DDB_CFN_TYPE, | ||
properties: { | ||
@@ -58,3 +57,2 @@ tableName: this.tableName, | ||
replaceTableUponGsiUpdate: (_c = props.replaceTableUponGsiUpdate) !== null && _c !== void 0 ? _c : false, | ||
isImported: props.isImported, | ||
}, | ||
@@ -61,0 +59,0 @@ removalPolicy: props.removalPolicy, |
@@ -18,7 +18,4 @@ import { ContinuousBackupsDescription, CreateTableCommandInput, TableDescription, TimeToLiveDescription, UpdateContinuousBackupsCommandInput, UpdateTableCommandInput, UpdateTimeToLiveCommandInput, Tag as DynamoDBTag } from '@aws-sdk/client-dynamodb'; | ||
export declare const toCreateTableInput: (props: CustomDDB.Input) => CreateTableCommandInput; | ||
export type ExpectedTableProperties = Partial<Pick<TableDescription, 'AttributeDefinitions' | 'KeySchema' | 'GlobalSecondaryIndexes' | 'BillingModeSummary' | 'ProvisionedThroughput' | 'StreamSpecification' | 'SSEDescription' | 'DeletionProtectionEnabled'>>; | ||
export declare const getExpectedTableProperties: (createTableInput: CreateTableCommandInput) => ExpectedTableProperties; | ||
export declare const validateImportedTableProperties: (importedTable: TableDescription, expectedTableProperties: ExpectedTableProperties) => void; | ||
export declare const isTtlModified: (oldTtl: CustomDDB.TimeToLiveSpecificationProperty | undefined, endTtl: CustomDDB.TimeToLiveSpecificationProperty | undefined) => boolean; | ||
export {}; | ||
//# sourceMappingURL=amplify-table-manager-handler.d.ts.map |
@@ -25,9 +25,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isTtlModified = exports.validateImportedTableProperties = exports.getExpectedTableProperties = exports.toCreateTableInput = exports.extractOldTableInputFromEvent = exports.extractTableInputFromEvent = exports.getPointInTimeRecoveryUpdate = exports.getTtlUpdate = exports.getDeletionProtectionUpdate = exports.requiresTagsUpdate = exports.getSseUpdate = exports.getStreamUpdate = exports.getNextAtomicUpdate = exports.getLambdaTags = exports.isComplete = exports.onEvent = void 0; | ||
exports.isTtlModified = exports.toCreateTableInput = exports.extractOldTableInputFromEvent = exports.extractTableInputFromEvent = exports.getPointInTimeRecoveryUpdate = exports.getTtlUpdate = exports.getDeletionProtectionUpdate = exports.requiresTagsUpdate = exports.getSseUpdate = exports.getStreamUpdate = exports.getNextAtomicUpdate = exports.getLambdaTags = exports.isComplete = exports.onEvent = void 0; | ||
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb"); | ||
const lodash_isequal_1 = __importDefault(require("lodash.isequal")); | ||
const client_lambda_1 = require("@aws-sdk/client-lambda"); | ||
@@ -122,5 +118,2 @@ const cfnResponse = __importStar(require("./cfn-response")); | ||
case 'Create': | ||
if (tableDef.isImported) { | ||
return importTable(tableDef); | ||
} | ||
console.log('Initiating CREATE event'); | ||
@@ -743,3 +736,2 @@ const createTableInput = (0, exports.toCreateTableInput)(tableDef); | ||
'replaceTableUponGsiUpdate', | ||
'isImported', | ||
]; | ||
@@ -800,82 +792,2 @@ const fieldsToBeConvertedToNumber = ['readCapacityUnits', 'writeCapacityUnits']; | ||
exports.toCreateTableInput = toCreateTableInput; | ||
const getExpectedTableProperties = (createTableInput) => { | ||
return { | ||
AttributeDefinitions: createTableInput.AttributeDefinitions, | ||
KeySchema: createTableInput.KeySchema, | ||
GlobalSecondaryIndexes: createTableInput.GlobalSecondaryIndexes, | ||
BillingModeSummary: { | ||
BillingMode: createTableInput.BillingMode, | ||
}, | ||
StreamSpecification: createTableInput.StreamSpecification, | ||
ProvisionedThroughput: createTableInput.ProvisionedThroughput || { ReadCapacityUnits: 0, WriteCapacityUnits: 0 }, | ||
SSEDescription: createTableInput.SSESpecification && createTableInput.SSESpecification.Enabled | ||
? { | ||
SSEType: createTableInput.SSESpecification.SSEType || 'KMS', | ||
Status: 'ENABLED', | ||
} | ||
: undefined, | ||
DeletionProtectionEnabled: createTableInput.DeletionProtectionEnabled || false, | ||
}; | ||
}; | ||
exports.getExpectedTableProperties = getExpectedTableProperties; | ||
const validateImportedTableProperties = (importedTable, expectedTableProperties) => { | ||
const errors = []; | ||
const addError = (propertyName, actual, expected) => { | ||
errors.push(`${propertyName} does not match the expected value.\nActual: ${JSON.stringify(actual)}\nExpected: ${JSON.stringify(expected)}`); | ||
}; | ||
if (!(0, lodash_isequal_1.default)(importedTable.AttributeDefinitions, expectedTableProperties.AttributeDefinitions)) { | ||
addError('AttributeDefintions', importedTable.AttributeDefinitions, expectedTableProperties.AttributeDefinitions); | ||
} | ||
if (!(0, lodash_isequal_1.default)(importedTable.KeySchema, expectedTableProperties.KeySchema)) { | ||
addError('KeySchema', importedTable.KeySchema, expectedTableProperties.KeySchema); | ||
} | ||
if (!(0, lodash_isequal_1.default)(importedTable.GlobalSecondaryIndexes, expectedTableProperties.GlobalSecondaryIndexes)) { | ||
addError('GlobalSecondaryIndexes', importedTable.GlobalSecondaryIndexes, expectedTableProperties.GlobalSecondaryIndexes); | ||
} | ||
const billingMode = importedTable.BillingModeSummary | ||
? { | ||
...importedTable.BillingModeSummary, | ||
} | ||
: undefined; | ||
if (billingMode) { | ||
delete billingMode.LastUpdateToPayPerRequestDateTime; | ||
} | ||
if (!(0, lodash_isequal_1.default)(billingMode, expectedTableProperties.BillingModeSummary)) { | ||
addError('BillingModeSummary', billingMode, expectedTableProperties.BillingModeSummary); | ||
} | ||
const provisionedThroughput = importedTable.ProvisionedThroughput | ||
? { | ||
...importedTable.ProvisionedThroughput, | ||
} | ||
: undefined; | ||
if (provisionedThroughput) { | ||
delete provisionedThroughput.LastDecreaseDateTime; | ||
delete provisionedThroughput.LastIncreaseDateTime; | ||
delete provisionedThroughput.NumberOfDecreasesToday; | ||
} | ||
if (!(0, lodash_isequal_1.default)(provisionedThroughput, expectedTableProperties.ProvisionedThroughput)) { | ||
addError('ProvisionedThroughput', provisionedThroughput, expectedTableProperties.ProvisionedThroughput); | ||
} | ||
if (!(0, lodash_isequal_1.default)(importedTable.StreamSpecification, expectedTableProperties.StreamSpecification)) { | ||
addError('StreamSpecification', importedTable.StreamSpecification, expectedTableProperties.StreamSpecification); | ||
} | ||
const sseDescription = importedTable.SSEDescription | ||
? { | ||
...importedTable.SSEDescription, | ||
} | ||
: undefined; | ||
if (sseDescription) { | ||
delete sseDescription.Status; | ||
} | ||
if (!(0, lodash_isequal_1.default)(sseDescription, expectedTableProperties.SSEDescription)) { | ||
addError('SSEDescription', sseDescription, expectedTableProperties.SSEDescription); | ||
} | ||
if (!(0, lodash_isequal_1.default)(importedTable.DeletionProtectionEnabled, expectedTableProperties.DeletionProtectionEnabled)) { | ||
addError('DeletionProtectionEnabled', importedTable.DeletionProtectionEnabled, expectedTableProperties.DeletionProtectionEnabled); | ||
} | ||
if (errors.length > 0) { | ||
throw new Error(`Imported table properties did not match the expected table properties.\n${errors.join('\n')}`); | ||
} | ||
}; | ||
exports.validateImportedTableProperties = validateImportedTableProperties; | ||
const createNewTable = async (input) => { | ||
@@ -1029,24 +941,2 @@ var _a; | ||
const sleep = async (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)); | ||
const importTable = async (tableDef) => { | ||
console.log('Initiating table import process'); | ||
console.log(`Fetching current state of table ${tableDef.tableName}`); | ||
const describeTableResult = await ddbClient.describeTable({ TableName: tableDef.tableName }); | ||
if (!describeTableResult.Table) { | ||
throw new Error(`Could not find ${tableDef.tableName} to update`); | ||
} | ||
(0, util_1.log)('Current table state: ', describeTableResult); | ||
const createTableInput = (0, exports.toCreateTableInput)(tableDef); | ||
const expectedTableProperties = (0, exports.getExpectedTableProperties)(createTableInput); | ||
(0, exports.validateImportedTableProperties)(describeTableResult.Table, expectedTableProperties); | ||
const result = { | ||
PhysicalResourceId: describeTableResult.Table.TableName, | ||
Data: { | ||
TableArn: describeTableResult.Table.TableArn, | ||
TableStreamArn: describeTableResult.Table.LatestStreamArn, | ||
TableName: describeTableResult.Table.TableName, | ||
}, | ||
}; | ||
console.log('Returning result: ', result); | ||
return result; | ||
}; | ||
//# sourceMappingURL=amplify-table-manager-handler.js.map |
@@ -130,5 +130,3 @@ "use strict"; | ||
}); | ||
const removalPolicy = this.options.EnableDeletionProtection || context.transformParameters.enableGen2Migration | ||
? cdk.RemovalPolicy.RETAIN | ||
: cdk.RemovalPolicy.DESTROY; | ||
const removalPolicy = this.options.EnableDeletionProtection ? cdk.RemovalPolicy.RETAIN : cdk.RemovalPolicy.DESTROY; | ||
const table = new aws_dynamodb_1.Table(scope, tableLogicalName, { | ||
@@ -135,0 +133,0 @@ tableName, |
@@ -55,4 +55,3 @@ import { DataSourceProvider, MutationFieldType, QueryFieldType, SubscriptionFieldType, TransformerContextProvider, TransformerResolverProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
}>; | ||
getDatasourceMap(): Record<string, DataSourceProvider>; | ||
} | ||
//# sourceMappingURL=model-resource-generator.d.ts.map |
@@ -414,7 +414,4 @@ "use strict"; | ||
} | ||
getDatasourceMap() { | ||
return this.datasourceMap; | ||
} | ||
} | ||
exports.ModelResourceGenerator = ModelResourceGenerator; | ||
//# sourceMappingURL=model-resource-generator.js.map |
@@ -158,3 +158,3 @@ "use strict"; | ||
else { | ||
const layerVersionCustomResource = (0, rds_1.createLayerVersionCustomResource)(scope, resourceNames); | ||
const layerVersionCustomResource = (0, rds_1.createLayerVersionCustomResource)(scope, resourceNames, context); | ||
layerVersionArn = layerVersionCustomResource.getResponseField('Body'); | ||
@@ -169,5 +169,5 @@ } | ||
} | ||
const layerVersionCustomResource = (0, rds_1.createSNSTopicARNCustomResource)(scope, resourceNames); | ||
const layerVersionCustomResource = (0, rds_1.createSNSTopicARNCustomResource)(scope, resourceNames, context); | ||
return layerVersionCustomResource.getResponseField('Body'); | ||
}; | ||
//# sourceMappingURL=rds-model-resource-generator.js.map |
{ | ||
"name": "@aws-amplify/graphql-model-transformer", | ||
"version": "2.12.0-gen2-migration-0809.0", | ||
"version": "3.0.0", | ||
"description": "Amplify graphql @model transformer", | ||
@@ -18,3 +18,4 @@ "repository": { | ||
"aws", | ||
"amplify" | ||
"amplify", | ||
"transformer" | ||
], | ||
@@ -28,4 +29,3 @@ "publishConfig": { | ||
"build-notification-lambda": "cd publish-notification-lambda && mkdir -p node_modules && rm -rf node_modules && npm install && tsc && cp -r node_modules lib && cd lib && bestzip --force node ../../lib/rds-notification-lambda.zip ./* && cd ../..", | ||
"build-table-manager-lambda": "cp src/resources/amplify-dynamodb-table/amplify-table-manager-lambda/package.json lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/package.json && (cd lib/resources/amplify-dynamodb-table/amplify-table-manager-lambda/ && mkdir -p node_modules && rm -rf node_modules && npm install)", | ||
"build": "tsc && yarn build-rds-lambda && yarn build-rds-patching-lambda && yarn build-notification-lambda && yarn build-table-manager-lambda", | ||
"build": "tsc && yarn build-rds-lambda && yarn build-rds-patching-lambda && yarn build-notification-lambda", | ||
"watch": "tsc -w", | ||
@@ -38,8 +38,8 @@ "clean": "rimraf ./lib && rimraf ./rds-lambda/lib && rimraf ./rds-patching-lambda/lib && rimraf ./publish-notification-lambda/lib", | ||
"dependencies": { | ||
"@aws-amplify/graphql-directives": "1.2.0-gen2-migration-0809.0", | ||
"@aws-amplify/graphql-transformer-core": "2.10.0-gen2-migration-0809.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "3.11.0-gen2-migration-0809.0", | ||
"@aws-amplify/graphql-directives": "2.0.0", | ||
"@aws-amplify/graphql-transformer-core": "3.0.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "4.0.0", | ||
"graphql": "^15.5.0", | ||
"graphql-mapping-template": "4.20.16", | ||
"graphql-transformer-common": "4.32.0-gen2-migration-0809.0" | ||
"graphql-mapping-template": "5.0.0", | ||
"graphql-transformer-common": "5.0.0" | ||
}, | ||
@@ -51,3 +51,3 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@aws-amplify/graphql-transformer-test-utils": "0.5.7-gen2-migration-0809.0", | ||
"@aws-amplify/graphql-transformer-test-utils": "0.6.0", | ||
"@aws-sdk/client-dynamodb": "^3.624.0", | ||
@@ -57,3 +57,2 @@ "@aws-sdk/client-lambda": "^3.624.0", | ||
"@types/aws-lambda": "8.10.119", | ||
"@types/lodash.isequal": "^4.5.8", | ||
"@types/node": "^12.12.6" | ||
@@ -99,3 +98,3 @@ }, | ||
}, | ||
"gitHead": "005a7b9dcb09f8c3b73574ab51b29762d1f71e00" | ||
"gitHead": "041c6d1c401f6c4648cf327c068bb7b0d91384d4" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
50512169
6
0
1
148
5387
+ Added@aws-amplify/graphql-directives@2.0.0(transitive)
+ Added@aws-amplify/graphql-transformer-core@3.0.0(transitive)
+ Added@aws-amplify/graphql-transformer-interfaces@4.0.0(transitive)
+ Addedgraphql-mapping-template@5.0.0(transitive)
+ Addedgraphql-transformer-common@5.0.0(transitive)
- Removed@aws-amplify/graphql-directives@1.2.0-gen2-migration-0809.0(transitive)
- Removed@aws-amplify/graphql-transformer-core@2.10.0-gen2-migration-0809.0(transitive)
- Removed@aws-amplify/graphql-transformer-interfaces@3.11.0-gen2-migration-0809.0(transitive)
- Removedgraphql-mapping-template@4.20.16(transitive)
- Removedgraphql-transformer-common@4.32.0-gen2-migration-0809.0(transitive)