@aws-amplify/amplify-util-uibuilder 1.2.20 → 1.2.21-alpha.19
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/lib/commands/cloneComponentsFromEnv.d.ts.map +1 -1
- package/lib/commands/cloneComponentsFromEnv.js +2 -16
- package/lib/commands/cloneComponentsFromEnv.js.map +1 -1
- package/lib/commands/utils/amplifyUiBuilderService.d.ts +5 -0
- package/lib/commands/utils/amplifyUiBuilderService.d.ts.map +1 -0
- package/lib/commands/utils/amplifyUiBuilderService.js +20 -0
- package/lib/commands/utils/amplifyUiBuilderService.js.map +1 -0
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts +7 -4
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts.map +1 -1
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.js +31 -36
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/syncAmplifyUiComponents.test.ts +1 -1
- package/src/commands/cloneComponentsFromEnv.ts +3 -17
- package/src/commands/utils/amplifyUiBuilderService.ts +22 -0
- package/src/commands/utils/syncAmplifyUiBuilderComponents.ts +22 -27
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloneComponentsFromEnv.d.ts","sourceRoot":"","sources":["../../src/commands/cloneComponentsFromEnv.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloneComponentsFromEnv.d.ts","sourceRoot":"","sources":["../../src/commands/cloneComponentsFromEnv.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,iBAmD5C"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.run = void 0;
|
|
7
|
-
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
|
8
4
|
const extractArgs_1 = require("./utils/extractArgs");
|
|
9
5
|
const syncAmplifyUiBuilderComponents_1 = require("./utils/syncAmplifyUiBuilderComponents");
|
|
10
6
|
const amplify_prompts_1 = require("amplify-prompts");
|
|
7
|
+
const amplifyUiBuilderService_1 = require("./utils/amplifyUiBuilderService");
|
|
11
8
|
async function run(context) {
|
|
12
9
|
var _a, _b;
|
|
13
10
|
amplify_prompts_1.printer.debug('Running create components command in amplify-util-uibuilder');
|
|
@@ -26,18 +23,7 @@ async function run(context) {
|
|
|
26
23
|
}
|
|
27
24
|
const environmentName = (_a = args.environmentName) !== null && _a !== void 0 ? _a : context.exeInfo.localEnvInfo.envName;
|
|
28
25
|
const appId = (_b = args.appId) !== null && _b !== void 0 ? _b : context.exeInfo.teamProviderInfo[environmentName].awscloudformation.AmplifyAppId;
|
|
29
|
-
const
|
|
30
|
-
context,
|
|
31
|
-
newEnvName,
|
|
32
|
-
appId,
|
|
33
|
-
]));
|
|
34
|
-
if (process.env.UI_BUILDER_ENDPOINT) {
|
|
35
|
-
awsConfigInfo.endpoint = process.env.UI_BUILDER_ENDPOINT;
|
|
36
|
-
}
|
|
37
|
-
if (process.env.UI_BUILDER_REGION) {
|
|
38
|
-
awsConfigInfo.region = process.env.UI_BUILDER_REGION;
|
|
39
|
-
}
|
|
40
|
-
const amplifyUIBuilder = new aws_sdk_1.default.AmplifyUIBuilder(awsConfigInfo);
|
|
26
|
+
const amplifyUIBuilder = await (0, amplifyUiBuilderService_1.getAmplifyUIBuilderService)(context, environmentName, appId);
|
|
41
27
|
const components = existingComponents.entities;
|
|
42
28
|
if (!components.length) {
|
|
43
29
|
amplify_prompts_1.printer.debug(`No UIBuilder components found in app ${appId} from env ${sourceEnvName}. Skipping component clone process.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloneComponentsFromEnv.js","sourceRoot":"","sources":["../../src/commands/cloneComponentsFromEnv.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloneComponentsFromEnv.js","sourceRoot":"","sources":["../../src/commands/cloneComponentsFromEnv.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,2FAAiF;AACjF,qDAA0C;AAE1C,6EAA6E;AAEtE,KAAK,UAAU,GAAG,CAAC,OAAmB;;IAC3C,yBAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;IAC9F,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;IAE5F,MAAM,kBAAkB,GAAG,MAAM,IAAA,wDAAuB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACjF,IAAI,kBAAkB,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5C,yBAAO,CAAC,KAAK,CAAC,GAAG,kBAAkB,CAAC,QAAQ,CAAC,MAAM,yEAAyE,CAAC,CAAC;QAC9H,OAAO;KACR;IACD,MAAM,wBAAwB,GAAG,MAAM,IAAA,wDAAuB,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAEpF,IAAI,wBAAwB,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QAChD,yBAAO,CAAC,KAAK,CACX,GAAG,wBAAwB,CAAC,QAAQ,CAAC,MAAM,8EAA8E,CAC1H,CAAC;QACF,OAA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AAG,CAChI,CAAC;AACJ,CAAC;AAnDD,kBAmDC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AmplifyUIBuilder } from 'aws-sdk';
|
|
2
|
+
import { $TSContext } from 'amplify-cli-core';
|
|
3
|
+
export { Component, Theme } from 'aws-sdk/clients/amplifyuibuilder';
|
|
4
|
+
export declare const getAmplifyUIBuilderService: (context: $TSContext, environmentName: string, appId: string) => Promise<AmplifyUIBuilder>;
|
|
5
|
+
//# sourceMappingURL=amplifyUiBuilderService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amplifyUiBuilderService.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/amplifyUiBuilderService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAEpE,eAAO,MAAM,0BAA0B,YAAmB,UAAU,mBAAmB,MAAM,SAAS,MAAM,KAAG,QAAQ,gBAAgB,CAgBtI,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAmplifyUIBuilderService = void 0;
|
|
4
|
+
const aws_sdk_1 = require("aws-sdk");
|
|
5
|
+
const getAmplifyUIBuilderService = async (context, environmentName, appId) => {
|
|
6
|
+
const awsConfigInfo = (await context.amplify.invokePluginMethod(context, 'awscloudformation', undefined, 'loadConfigurationForEnv', [
|
|
7
|
+
context,
|
|
8
|
+
environmentName,
|
|
9
|
+
appId,
|
|
10
|
+
]));
|
|
11
|
+
if (process.env.UI_BUILDER_ENDPOINT) {
|
|
12
|
+
awsConfigInfo.endpoint = process.env.UI_BUILDER_ENDPOINT;
|
|
13
|
+
}
|
|
14
|
+
if (process.env.UI_BUILDER_REGION) {
|
|
15
|
+
awsConfigInfo.region = process.env.UI_BUILDER_REGION;
|
|
16
|
+
}
|
|
17
|
+
return new aws_sdk_1.AmplifyUIBuilder(awsConfigInfo);
|
|
18
|
+
};
|
|
19
|
+
exports.getAmplifyUIBuilderService = getAmplifyUIBuilderService;
|
|
20
|
+
//# sourceMappingURL=amplifyUiBuilderService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amplifyUiBuilderService.js","sourceRoot":"","sources":["../../../src/commands/utils/amplifyUiBuilderService.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAKpC,MAAM,0BAA0B,GAAG,KAAK,EAAE,OAAmB,EAAE,eAAuB,EAAE,KAAa,EAA6B,EAAE;IACzI,MAAM,aAAa,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,yBAAyB,EAAE;QAClI,OAAO;QACP,eAAe;QACf,KAAK;KACN,CAAC,CAAW,CAAC;IAEd,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;QACnC,aAAa,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;KAC1D;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACjC,aAAa,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;KACtD;IAED,OAAO,IAAI,0BAAgB,CAAC,aAAa,CAAC,CAAC;AAC7C,CAAC,CAAC;AAhBW,QAAA,0BAA0B,8BAgBrC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component, Theme } from './amplifyUiBuilderService';
|
|
2
2
|
import { $TSContext } from 'amplify-cli-core';
|
|
3
3
|
export declare const getEnvName: (context: $TSContext, envName?: string | undefined) => any;
|
|
4
4
|
export declare const resolveAppId: (context: $TSContext) => Promise<unknown>;
|
|
5
5
|
export declare const getAppId: (context: $TSContext) => Promise<any>;
|
|
6
|
-
export declare function listUiBuilderComponents(context: $TSContext, envName?: string): Promise<
|
|
7
|
-
|
|
6
|
+
export declare function listUiBuilderComponents(context: $TSContext, envName?: string): Promise<{
|
|
7
|
+
entities: Component[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare function listUiBuilderThemes(context: $TSContext, envName?: string): Promise<{
|
|
10
|
+
entities: Theme[];
|
|
11
|
+
}>;
|
|
8
12
|
export declare function generateUiBuilderComponents(context: $TSContext, componentSchemas: any[]): ({
|
|
9
13
|
resultType: string;
|
|
10
14
|
component: import("@aws-amplify/codegen-ui").StudioComponent;
|
|
@@ -27,5 +31,4 @@ export declare function generateUiBuilderThemes(context: $TSContext, themeSchema
|
|
|
27
31
|
error: any;
|
|
28
32
|
theme?: undefined;
|
|
29
33
|
})[];
|
|
30
|
-
export declare const getAmplifyUIBuilderService: (context: $TSContext, environmentName: string, appId: string) => Promise<aws.AmplifyUIBuilder>;
|
|
31
34
|
//# sourceMappingURL=syncAmplifyUiBuilderComponents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncAmplifyUiBuilderComponents.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/syncAmplifyUiBuilderComponents.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"syncAmplifyUiBuilderComponents.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/syncAmplifyUiBuilderComponents.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,SAAS,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAKzF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,eAAO,MAAM,UAAU,YAAa,UAAU,sCAG7C,CAAC;AAEF,eAAO,MAAM,YAAY,YAAmB,UAAU,qBAErD,CAAC;AAEF,eAAO,MAAM,QAAQ,YAAmB,UAAU,iBASjD,CAAC;AAEF,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC,CAyBvH;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;CAAE,CAAC,CAwB/G;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,EAAE;;;;;;;;;;KAkBvF;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE;;;;;;;;;;KAgB/E"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const
|
|
3
|
+
exports.generateUiBuilderThemes = exports.generateUiBuilderComponents = exports.listUiBuilderThemes = exports.listUiBuilderComponents = exports.getAppId = exports.resolveAppId = exports.getEnvName = void 0;
|
|
4
|
+
const amplifyUiBuilderService_1 = require("./amplifyUiBuilderService");
|
|
8
5
|
const amplify_prompts_1 = require("amplify-prompts");
|
|
9
6
|
const createUiBuilderComponent_1 = require("./createUiBuilderComponent");
|
|
10
7
|
const getUiBuilderComponentsPath_1 = require("./getUiBuilderComponentsPath");
|
|
@@ -30,15 +27,22 @@ async function listUiBuilderComponents(context, envName) {
|
|
|
30
27
|
const environmentName = (0, exports.getEnvName)(context, envName);
|
|
31
28
|
const appId = await (0, exports.getAppId)(context);
|
|
32
29
|
try {
|
|
33
|
-
const amplifyUIBuilder = await (0,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
const amplifyUIBuilder = await (0, amplifyUiBuilderService_1.getAmplifyUIBuilderService)(context, environmentName, appId);
|
|
31
|
+
let nextToken;
|
|
32
|
+
const uiBuilderComponents = [];
|
|
33
|
+
do {
|
|
34
|
+
const response = await amplifyUIBuilder
|
|
35
|
+
.exportComponents({
|
|
36
|
+
appId,
|
|
37
|
+
environmentName,
|
|
38
|
+
nextToken
|
|
39
|
+
})
|
|
40
|
+
.promise();
|
|
41
|
+
uiBuilderComponents.push(...response.entities);
|
|
42
|
+
nextToken = response.nextToken;
|
|
43
|
+
} while (nextToken);
|
|
40
44
|
amplify_prompts_1.printer.debug(JSON.stringify(uiBuilderComponents, null, 2));
|
|
41
|
-
return uiBuilderComponents;
|
|
45
|
+
return { entities: uiBuilderComponents };
|
|
42
46
|
}
|
|
43
47
|
catch (e) {
|
|
44
48
|
amplify_prompts_1.printer.debug(e);
|
|
@@ -50,15 +54,21 @@ async function listUiBuilderThemes(context, envName) {
|
|
|
50
54
|
const environmentName = (0, exports.getEnvName)(context, envName);
|
|
51
55
|
const appId = await (0, exports.getAppId)(context);
|
|
52
56
|
try {
|
|
53
|
-
const amplifyUIBuilder = await (0,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const amplifyUIBuilder = await (0, amplifyUiBuilderService_1.getAmplifyUIBuilderService)(context, environmentName, appId);
|
|
58
|
+
let nextToken;
|
|
59
|
+
const uiBuilderThemes = [];
|
|
60
|
+
do {
|
|
61
|
+
const response = await amplifyUIBuilder
|
|
62
|
+
.exportThemes({
|
|
63
|
+
appId,
|
|
64
|
+
environmentName,
|
|
65
|
+
})
|
|
66
|
+
.promise();
|
|
67
|
+
uiBuilderThemes.push(...response.entities);
|
|
68
|
+
nextToken = response.nextToken;
|
|
69
|
+
} while (nextToken);
|
|
60
70
|
amplify_prompts_1.printer.debug(JSON.stringify(uiBuilderThemes, null, 2));
|
|
61
|
-
return uiBuilderThemes;
|
|
71
|
+
return { entities: uiBuilderThemes };
|
|
62
72
|
}
|
|
63
73
|
catch (e) {
|
|
64
74
|
amplify_prompts_1.printer.debug(e);
|
|
@@ -98,19 +108,4 @@ function generateUiBuilderThemes(context, themeSchemas) {
|
|
|
98
108
|
return themeResults;
|
|
99
109
|
}
|
|
100
110
|
exports.generateUiBuilderThemes = generateUiBuilderThemes;
|
|
101
|
-
const getAmplifyUIBuilderService = async (context, environmentName, appId) => {
|
|
102
|
-
const awsConfigInfo = (await context.amplify.invokePluginMethod(context, 'awscloudformation', undefined, 'loadConfigurationForEnv', [
|
|
103
|
-
context,
|
|
104
|
-
environmentName,
|
|
105
|
-
appId,
|
|
106
|
-
]));
|
|
107
|
-
if (process.env.UI_BUILDER_ENDPOINT) {
|
|
108
|
-
awsConfigInfo.endpoint = process.env.UI_BUILDER_ENDPOINT;
|
|
109
|
-
}
|
|
110
|
-
if (process.env.UI_BUILDER_REGION) {
|
|
111
|
-
awsConfigInfo.region = process.env.UI_BUILDER_REGION;
|
|
112
|
-
}
|
|
113
|
-
return new aws_sdk_1.default.AmplifyUIBuilder(awsConfigInfo);
|
|
114
|
-
};
|
|
115
|
-
exports.getAmplifyUIBuilderService = getAmplifyUIBuilderService;
|
|
116
111
|
//# sourceMappingURL=syncAmplifyUiBuilderComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncAmplifyUiBuilderComponents.js","sourceRoot":"","sources":["../../../src/commands/utils/syncAmplifyUiBuilderComponents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"syncAmplifyUiBuilderComponents.js","sourceRoot":"","sources":["../../../src/commands/utils/syncAmplifyUiBuilderComponents.ts"],"names":[],"mappings":";;;AAAA,uEAAyF;AACzF,qDAA0C;AAC1C,yEAA4F;AAC5F,6EAA0E;AAC1E,+CAA4C;AAErC,MAAM,UAAU,GAAG,CAAC,OAAmB,EAAE,OAAgB,E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,+CAAoB,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;SACzC;QAAC,OAAO,CAAC,EAAE;YACV,yBAAO,CAAC,KAAK,CAAC,6BAA6B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1D,yBAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;SACrE;IACH,CAAC,CAAC,CAAC;IAEH,yBAAO,CAAC,KAAK,CACX,aAAa,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,MAAM,cAAc,IAAA,uDAA0B,EAAC,OAAO,CAAC,EAAE,CACtI,CAAC;IACF,OAAO,YAAY,CAAC;AACtB,CAAC;AAhBD,0DAgBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/amplify-util-uibuilder",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.21-alpha.19+9f13064d5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@aws-amplify/codegen-ui": "2.
|
|
17
|
-
"@aws-amplify/codegen-ui-react": "2.
|
|
18
|
-
"amplify-cli-core": "2.5.
|
|
19
|
-
"amplify-prompts": "2.0.
|
|
20
|
-
"amplify-provider-awscloudformation": "6.1.
|
|
21
|
-
"aws-sdk": "2.
|
|
16
|
+
"@aws-amplify/codegen-ui": "^2.2.0",
|
|
17
|
+
"@aws-amplify/codegen-ui-react": "^2.2.0",
|
|
18
|
+
"amplify-cli-core": "2.5.3-alpha.19+9f13064d5",
|
|
19
|
+
"amplify-prompts": "2.0.1-alpha.35+9f13064d5",
|
|
20
|
+
"amplify-provider-awscloudformation": "6.1.1-alpha.19+9f13064d5",
|
|
21
|
+
"aws-sdk": "2.1113.0",
|
|
22
22
|
"ora": "^4.0.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"usePathForSuiteName": "true",
|
|
61
61
|
"addFileAttribute": "true"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "9f13064d592937c82e534c32469053d7e96a169b"
|
|
64
64
|
}
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
getAppId,
|
|
6
6
|
listUiBuilderComponents,
|
|
7
7
|
listUiBuilderThemes,
|
|
8
|
-
getAmplifyUIBuilderService,
|
|
9
8
|
resolveAppId,
|
|
10
9
|
generateUiBuilderThemes,
|
|
11
10
|
} from '../commands/utils/syncAmplifyUiBuilderComponents';
|
|
11
|
+
import { getAmplifyUIBuilderService } from '../commands/utils/amplifyUiBuilderService'
|
|
12
12
|
import aws from 'aws-sdk';
|
|
13
13
|
import * as CLICore from 'amplify-cli-core';
|
|
14
14
|
import * as createUiBuilderComponentDependency from '../commands/utils/createUiBuilderComponent';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import aws from 'aws-sdk';
|
|
2
1
|
import { extractArgs } from './utils/extractArgs';
|
|
3
2
|
import { listUiBuilderComponents } from './utils/syncAmplifyUiBuilderComponents';
|
|
4
3
|
import { printer } from 'amplify-prompts';
|
|
5
|
-
import { $
|
|
4
|
+
import { $TSContext } from 'amplify-cli-core';
|
|
5
|
+
import { getAmplifyUIBuilderService } from './utils/amplifyUiBuilderService';
|
|
6
6
|
|
|
7
7
|
export async function run(context: $TSContext) {
|
|
8
8
|
printer.debug('Running create components command in amplify-util-uibuilder');
|
|
@@ -26,21 +26,7 @@ export async function run(context: $TSContext) {
|
|
|
26
26
|
|
|
27
27
|
const environmentName = args.environmentName ?? context.exeInfo.localEnvInfo.envName;
|
|
28
28
|
const appId = args.appId ?? context.exeInfo.teamProviderInfo[environmentName].awscloudformation.AmplifyAppId;
|
|
29
|
-
const
|
|
30
|
-
context,
|
|
31
|
-
newEnvName,
|
|
32
|
-
appId,
|
|
33
|
-
])) as $TSAny;
|
|
34
|
-
|
|
35
|
-
if (process.env.UI_BUILDER_ENDPOINT) {
|
|
36
|
-
awsConfigInfo.endpoint = process.env.UI_BUILDER_ENDPOINT;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (process.env.UI_BUILDER_REGION) {
|
|
40
|
-
awsConfigInfo.region = process.env.UI_BUILDER_REGION;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const amplifyUIBuilder = new aws.AmplifyUIBuilder(awsConfigInfo);
|
|
29
|
+
const amplifyUIBuilder = await getAmplifyUIBuilderService(context, environmentName, appId);
|
|
44
30
|
const components = existingComponents.entities;
|
|
45
31
|
if (!components.length) {
|
|
46
32
|
printer.debug(`No UIBuilder components found in app ${appId} from env ${sourceEnvName}. Skipping component clone process.`);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AmplifyUIBuilder } from 'aws-sdk';
|
|
2
|
+
import { $TSContext, $TSAny } from 'amplify-cli-core';
|
|
3
|
+
|
|
4
|
+
export { Component, Theme } from 'aws-sdk/clients/amplifyuibuilder';
|
|
5
|
+
|
|
6
|
+
export const getAmplifyUIBuilderService = async (context: $TSContext, environmentName: string, appId: string): Promise<AmplifyUIBuilder> => {
|
|
7
|
+
const awsConfigInfo = (await context.amplify.invokePluginMethod(context, 'awscloudformation', undefined, 'loadConfigurationForEnv', [
|
|
8
|
+
context,
|
|
9
|
+
environmentName,
|
|
10
|
+
appId,
|
|
11
|
+
])) as $TSAny;
|
|
12
|
+
|
|
13
|
+
if (process.env.UI_BUILDER_ENDPOINT) {
|
|
14
|
+
awsConfigInfo.endpoint = process.env.UI_BUILDER_ENDPOINT;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (process.env.UI_BUILDER_REGION) {
|
|
18
|
+
awsConfigInfo.region = process.env.UI_BUILDER_REGION;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return new AmplifyUIBuilder(awsConfigInfo);
|
|
22
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { getAmplifyUIBuilderService, Component, Theme } from './amplifyUiBuilderService';
|
|
2
2
|
import { printer } from 'amplify-prompts';
|
|
3
3
|
import { createUiBuilderComponent, createUiBuilderTheme } from './createUiBuilderComponent';
|
|
4
4
|
import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
|
|
5
5
|
import { extractArgs } from './extractArgs';
|
|
6
|
-
import { $
|
|
6
|
+
import { $TSContext } from 'amplify-cli-core';
|
|
7
7
|
export const getEnvName = (context: $TSContext, envName?: string) => {
|
|
8
8
|
const args = extractArgs(context);
|
|
9
9
|
return envName ? envName : args.environmentName ? args.environmentName : context.exeInfo.localEnvInfo.envName;
|
|
@@ -24,40 +24,53 @@ export const getAppId = async (context: $TSContext) => {
|
|
|
24
24
|
return appId;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export async function listUiBuilderComponents(context: $TSContext, envName?: string) {
|
|
27
|
+
export async function listUiBuilderComponents(context: $TSContext, envName?: string): Promise<{ entities: Component[] }> {
|
|
28
28
|
const environmentName = getEnvName(context, envName);
|
|
29
29
|
const appId = await getAppId(context);
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
32
|
const amplifyUIBuilder = await getAmplifyUIBuilderService(context, environmentName, appId);
|
|
33
|
-
|
|
33
|
+
let nextToken: string | undefined;
|
|
34
|
+
const uiBuilderComponents: Component[] = [];
|
|
35
|
+
do {
|
|
36
|
+
const response = await amplifyUIBuilder
|
|
34
37
|
.exportComponents({
|
|
35
38
|
appId,
|
|
36
39
|
environmentName,
|
|
40
|
+
nextToken
|
|
37
41
|
})
|
|
38
42
|
.promise();
|
|
43
|
+
uiBuilderComponents.push(...response.entities);
|
|
44
|
+
nextToken = response.nextToken;
|
|
45
|
+
} while (nextToken);
|
|
39
46
|
printer.debug(JSON.stringify(uiBuilderComponents, null, 2));
|
|
40
|
-
return uiBuilderComponents;
|
|
47
|
+
return { entities: uiBuilderComponents };
|
|
41
48
|
} catch (e) {
|
|
42
49
|
printer.debug(e);
|
|
43
50
|
throw e;
|
|
44
51
|
}
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
export async function listUiBuilderThemes(context: $TSContext, envName?: string) {
|
|
54
|
+
export async function listUiBuilderThemes(context: $TSContext, envName?: string): Promise<{ entities: Theme[] }> {
|
|
48
55
|
const environmentName = getEnvName(context, envName);
|
|
49
56
|
const appId = await getAppId(context);
|
|
50
57
|
|
|
51
58
|
try {
|
|
52
59
|
const amplifyUIBuilder = await getAmplifyUIBuilderService(context, environmentName, appId);
|
|
53
|
-
|
|
60
|
+
let nextToken: string | undefined;
|
|
61
|
+
const uiBuilderThemes: Theme[] = [];
|
|
62
|
+
do {
|
|
63
|
+
const response = await amplifyUIBuilder
|
|
54
64
|
.exportThemes({
|
|
55
65
|
appId,
|
|
56
66
|
environmentName,
|
|
57
67
|
})
|
|
58
68
|
.promise();
|
|
69
|
+
uiBuilderThemes.push(...response.entities);
|
|
70
|
+
nextToken = response.nextToken;
|
|
71
|
+
} while (nextToken);
|
|
59
72
|
printer.debug(JSON.stringify(uiBuilderThemes, null, 2));
|
|
60
|
-
return uiBuilderThemes;
|
|
73
|
+
return { entities: uiBuilderThemes };
|
|
61
74
|
} catch (e) {
|
|
62
75
|
printer.debug(e);
|
|
63
76
|
throw e;
|
|
@@ -100,22 +113,4 @@ export function generateUiBuilderThemes(context: $TSContext, themeSchemas: any[]
|
|
|
100
113
|
`Generated ${themeResults.filter(result => result.resultType === 'SUCCESS').length} themes in ${getUiBuilderComponentsPath(context)}`,
|
|
101
114
|
);
|
|
102
115
|
return themeResults;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export const getAmplifyUIBuilderService = async (context: $TSContext, environmentName: string, appId: string) => {
|
|
106
|
-
const awsConfigInfo = (await context.amplify.invokePluginMethod(context, 'awscloudformation', undefined, 'loadConfigurationForEnv', [
|
|
107
|
-
context,
|
|
108
|
-
environmentName,
|
|
109
|
-
appId,
|
|
110
|
-
])) as $TSAny;
|
|
111
|
-
|
|
112
|
-
if (process.env.UI_BUILDER_ENDPOINT) {
|
|
113
|
-
awsConfigInfo.endpoint = process.env.UI_BUILDER_ENDPOINT;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (process.env.UI_BUILDER_REGION) {
|
|
117
|
-
awsConfigInfo.region = process.env.UI_BUILDER_REGION;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return new aws.AmplifyUIBuilder(awsConfigInfo);
|
|
121
|
-
};
|
|
116
|
+
}
|