Skip to content

Commit bff2de7

Browse files
author
Dane Pilcher
committed
refactor: change property name to migratedAmplifyGen1DynamoDbTableMap
1 parent 2eccaa8 commit bff2de7

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

packages/backend-data/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type DataProps = {
4646
authorizationModes?: AuthorizationModes;
4747
functions?: Record<string, ConstructFactory<AmplifyFunction>>;
4848
logging?: DataLoggingOptions;
49-
importedAmplifyDynamoDBTableMap?: Record<string, Record<string, string> | undefined>;
49+
migratedAmplifyGen1DynamoDbTableMap?: Record<string, Record<string, string> | undefined>;
5050
};
5151

5252
// @public

packages/backend-data/src/convert_schema.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,17 @@ const customSqlStatementsFromStrategies = (
249249
/**
250250
* Extracts the imported models from non-imported models in a single string schema.
251251
* @param schema String GraphQL schema
252-
* @param importedAmplifyDynamoDBTableMap Table names for the models that should be extracted.
252+
* @param migratedAmplifyGen1DynamoDbTableMap Table names for the models that should be extracted.
253253
* @returns a schema split into imported models and non-imported models
254254
*/
255255
export const extractImportedModels = (
256256
schema: string,
257-
importedAmplifyDynamoDBTableMap: Record<string, string> | undefined
257+
migratedAmplifyGen1DynamoDbTableMap: Record<string, string> | undefined
258258
): {
259259
importedSchemas: { schema: string; importedTableName: string }[];
260260
nonImportedSchema: string | undefined;
261261
} => {
262-
const importedModels = Object.keys(importedAmplifyDynamoDBTableMap ?? {});
262+
const importedModels = Object.keys(migratedAmplifyGen1DynamoDbTableMap ?? {});
263263
if (importedModels?.length) {
264264
const parsedSchema = parse(schema);
265265
const [importedDefinitionNodes, nonImportedDefinitionNodes] = partition(
@@ -287,7 +287,7 @@ export const extractImportedModels = (
287287

288288
const importedSchemas = importedObjectTypeDefinitionNodes.map(
289289
(definitionNode) => {
290-
const importedTableName = (importedAmplifyDynamoDBTableMap ?? {})[
290+
const importedTableName = (migratedAmplifyGen1DynamoDbTableMap ?? {})[
291291
definitionNode.name.value
292292
];
293293
if (!importedTableName) {

packages/backend-data/src/factory.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ void describe('Table Import', () => {
970970
`;
971971
const dataFactory = defineData({
972972
schema,
973-
importedAmplifyDynamoDBTableMap: {
973+
migratedAmplifyGen1DynamoDbTableMap: {
974974
dev: {
975975
ImportedModel: 'ImportedModel-1234-dev',
976976
},
@@ -1002,7 +1002,7 @@ void describe('Table Import', () => {
10021002
`;
10031003
const dataFactory = defineData({
10041004
schema,
1005-
importedAmplifyDynamoDBTableMap: {
1005+
migratedAmplifyGen1DynamoDbTableMap: {
10061006
dev: {
10071007
ImportedModel: 'ImportedModel-1234-dev',
10081008
},
@@ -1032,7 +1032,7 @@ void describe('Table Import', () => {
10321032
`;
10331033
const dataFactory = defineData({
10341034
schema,
1035-
importedAmplifyDynamoDBTableMap: {
1035+
migratedAmplifyGen1DynamoDbTableMap: {
10361036
dev: {
10371037
ImportedModel: 'ImportedModel-1234-dev',
10381038
},
@@ -1055,7 +1055,7 @@ void describe('Table Import', () => {
10551055
`;
10561056
const dataFactory = defineData({
10571057
schema,
1058-
importedAmplifyDynamoDBTableMap: {
1058+
migratedAmplifyGen1DynamoDbTableMap: {
10591059
dev: {
10601060
ImportedModel: 'ImportedModel-1234-dev',
10611061
},
@@ -1089,7 +1089,7 @@ void describe('Table Import', () => {
10891089
`;
10901090
const dataFactory = defineData({
10911091
schema,
1092-
importedAmplifyDynamoDBTableMap: {
1092+
migratedAmplifyGen1DynamoDbTableMap: {
10931093
dev: {
10941094
ImportedModel: 'ImportedModel-1234-dev',
10951095
},
@@ -1122,7 +1122,7 @@ void describe('Table Import', () => {
11221122
`;
11231123
const dataFactory = defineData({
11241124
schema,
1125-
importedAmplifyDynamoDBTableMap: {
1125+
migratedAmplifyGen1DynamoDbTableMap: {
11261126
dev: {
11271127
ImportedModel: 'ImportedModel-1234-dev',
11281128
},

packages/backend-data/src/factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ class DataGenerator implements ConstructContainerEntryGenerator {
155155
// use the sandbox key when the branch name is not available (e.g. in the sandbox deployment)
156156
const amplifyBranchName =
157157
scope.node.tryGetContext('amplifyEnvironmentName') ?? 'sandbox';
158-
const importedTableMap = (this.props.importedAmplifyDynamoDBTableMap ??
159-
{})[amplifyBranchName];
158+
const importedTableMap = (this.props
159+
.migratedAmplifyGen1DynamoDbTableMap ?? {})[amplifyBranchName];
160160
const splitSchemas: {
161161
schema: string | DerivedModelSchema;
162162
importedTableName?: string;

packages/backend-data/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export type DataProps = {
153153
/**
154154
* Mapping of model name to existing DynamoDB table that should be used as the data source.
155155
*/
156-
importedAmplifyDynamoDBTableMap?: Record<
156+
migratedAmplifyGen1DynamoDbTableMap?: Record<
157157
string,
158158
Record<string, string> | undefined
159159
>;

0 commit comments

Comments
 (0)