@aws-amplify/amplify-util-uibuilder 1.2.12-codegen-ui-q1-release.0 → 1.2.12

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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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.2.12-codegen-ui-q1-release.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.11...@aws-amplify/amplify-util-uibuilder@1.2.12-codegen-ui-q1-release.0) (2022-02-12)
6
+ ## [1.2.12](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.2.11...@aws-amplify/amplify-util-uibuilder@1.2.12) (2022-02-15)
7
7
 
8
8
  **Note:** Version bump only for package @aws-amplify/amplify-util-uibuilder
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"cloneComponentsFromEnv.d.ts","sourceRoot":"","sources":["../../src/commands/cloneComponentsFromEnv.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,iBAiD5C"}
1
+ {"version":3,"file":"cloneComponentsFromEnv.d.ts","sourceRoot":"","sources":["../../src/commands/cloneComponentsFromEnv.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEtD,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,iBAiE5C"}
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.run = void 0;
7
+ const aws_sdk_1 = __importDefault(require("aws-sdk"));
4
8
  const extractArgs_1 = require("./utils/extractArgs");
5
- const uibuilder_client_1 = require("./utils/uibuilder-client");
6
9
  const syncAmplifyUiBuilderComponents_1 = require("./utils/syncAmplifyUiBuilderComponents");
7
10
  const amplify_prompts_1 = require("amplify-prompts");
8
11
  async function run(context) {
@@ -23,14 +26,26 @@ async function run(context) {
23
26
  }
24
27
  const environmentName = (_a = args.environmentName) !== null && _a !== void 0 ? _a : context.exeInfo.localEnvInfo.envName;
25
28
  const appId = (_b = args.appId) !== null && _b !== void 0 ? _b : context.exeInfo.teamProviderInfo[environmentName].awscloudformation.AmplifyAppId;
26
- const amplifyUIBuilder = await (0, uibuilder_client_1.getAmplifyUIBuilderService)(context, newEnvName, appId);
29
+ const awsConfigInfo = (await context.amplify.invokePluginMethod(context, 'awscloudformation', undefined, 'loadConfigurationForEnv', [
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);
27
41
  const components = existingComponents.entities;
28
42
  if (!components.length) {
29
43
  amplify_prompts_1.printer.debug(`No UIBuilder components found in app ${appId} from env ${sourceEnvName}. Skipping component clone process.`);
30
44
  return;
31
45
  }
32
46
  const promises = components.map(async (component) => {
33
- return await amplifyUIBuilder.createComponent({
47
+ return await amplifyUIBuilder
48
+ .createComponent({
34
49
  appId,
35
50
  environmentName,
36
51
  componentToCreate: {
@@ -43,7 +58,8 @@ async function run(context) {
43
58
  sourceId: component.sourceId,
44
59
  variants: component.variants,
45
60
  },
46
- });
61
+ })
62
+ .promise();
47
63
  });
48
64
  await Promise.all(promises);
49
65
  amplify_prompts_1.printer.info(`Successfully cloned ${components.length} UIBuilder components in app ${appId} from env ${sourceEnvName} to env ${newEnvName}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,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5B,yBAAO,CAAC,IAAI,CACV,uBAAuB,UAAU,CAAC,MAAM,gCAAgC,KAAK,aAAa,aAAa,WAAW,UAAU,GAAG,CAChI,CAAC;AACJ,CAAC;AAjED,kBAiEC"}
@@ -1,14 +1,10 @@
1
- import { Component, Theme } from './uibuilder-client';
1
+ import aws from 'aws-sdk';
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
- entities: Component[];
8
- }>;
9
- export declare function listUiBuilderThemes(context: $TSContext, envName?: string): Promise<{
10
- entities: Theme[];
11
- }>;
6
+ export declare function listUiBuilderComponents(context: $TSContext, envName?: string): Promise<import("aws-sdk/lib/request").PromiseResult<aws.AmplifyUIBuilder.ExportComponentsResponse, aws.AWSError>>;
7
+ export declare function listUiBuilderThemes(context: $TSContext, envName?: string): Promise<import("aws-sdk/lib/request").PromiseResult<aws.AmplifyUIBuilder.ExportThemesResponse, aws.AWSError>>;
12
8
  export declare function generateUiBuilderComponents(context: $TSContext, componentSchemas: any[]): ({
13
9
  resultType: string;
14
10
  component: any;
@@ -31,4 +27,5 @@ export declare function generateUiBuilderThemes(context: $TSContext, themeSchema
31
27
  error: any;
32
28
  theme?: undefined;
33
29
  })[];
30
+ export declare const getAmplifyUIBuilderService: (context: $TSContext, environmentName: string, appId: string) => Promise<aws.AmplifyUIBuilder>;
34
31
  //# sourceMappingURL=syncAmplifyUiBuilderComponents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"syncAmplifyUiBuilderComponents.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/syncAmplifyUiBuilderComponents.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,SAAS,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIlF,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,CAgBvH;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;CAAE,CAAC,CAgB/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
+ {"version":3,"file":"syncAmplifyUiBuilderComponents.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/syncAmplifyUiBuilderComponents.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,SAAS,CAAC;AAK1B,OAAO,EAAU,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACtD,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,qHAkBlF;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,iHAkB9E;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;AAED,eAAO,MAAM,0BAA0B,YAAmB,UAAU,mBAAmB,MAAM,SAAS,MAAM,kCAgB3G,CAAC"}
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateUiBuilderThemes = exports.generateUiBuilderComponents = exports.listUiBuilderThemes = exports.listUiBuilderComponents = exports.getAppId = exports.resolveAppId = exports.getEnvName = void 0;
6
+ exports.getAmplifyUIBuilderService = exports.generateUiBuilderThemes = exports.generateUiBuilderComponents = exports.listUiBuilderThemes = exports.listUiBuilderComponents = exports.getAppId = exports.resolveAppId = exports.getEnvName = void 0;
7
+ const aws_sdk_1 = __importDefault(require("aws-sdk"));
4
8
  const amplify_prompts_1 = require("amplify-prompts");
5
- const uibuilder_client_1 = require("./uibuilder-client");
6
9
  const createUiBuilderComponent_1 = require("./createUiBuilderComponent");
7
10
  const getUiBuilderComponentsPath_1 = require("./getUiBuilderComponentsPath");
8
11
  const extractArgs_1 = require("./extractArgs");
@@ -24,17 +27,18 @@ const getAppId = async (context) => {
24
27
  };
25
28
  exports.getAppId = getAppId;
26
29
  async function listUiBuilderComponents(context, envName) {
27
- var _a;
28
30
  const environmentName = (0, exports.getEnvName)(context, envName);
29
31
  const appId = await (0, exports.getAppId)(context);
30
32
  try {
31
- const amplifyUIBuilder = await (0, uibuilder_client_1.getAmplifyUIBuilderService)(context, environmentName, appId);
32
- const uiBuilderComponents = await amplifyUIBuilder.exportComponents({
33
+ const amplifyUIBuilder = await (0, exports.getAmplifyUIBuilderService)(context, environmentName, appId);
34
+ const uiBuilderComponents = await amplifyUIBuilder
35
+ .exportComponents({
33
36
  appId,
34
37
  environmentName,
35
- });
38
+ })
39
+ .promise();
36
40
  amplify_prompts_1.printer.debug(JSON.stringify(uiBuilderComponents, null, 2));
37
- return { entities: (_a = uiBuilderComponents.entities) !== null && _a !== void 0 ? _a : [] };
41
+ return uiBuilderComponents;
38
42
  }
39
43
  catch (e) {
40
44
  amplify_prompts_1.printer.debug(e);
@@ -43,17 +47,18 @@ async function listUiBuilderComponents(context, envName) {
43
47
  }
44
48
  exports.listUiBuilderComponents = listUiBuilderComponents;
45
49
  async function listUiBuilderThemes(context, envName) {
46
- var _a;
47
50
  const environmentName = (0, exports.getEnvName)(context, envName);
48
51
  const appId = await (0, exports.getAppId)(context);
49
52
  try {
50
- const amplifyUIBuilder = await (0, uibuilder_client_1.getAmplifyUIBuilderService)(context, environmentName, appId);
51
- const uiBuilderThemes = await amplifyUIBuilder.exportThemes({
53
+ const amplifyUIBuilder = await (0, exports.getAmplifyUIBuilderService)(context, environmentName, appId);
54
+ const uiBuilderThemes = await amplifyUIBuilder
55
+ .exportThemes({
52
56
  appId,
53
57
  environmentName,
54
- });
58
+ })
59
+ .promise();
55
60
  amplify_prompts_1.printer.debug(JSON.stringify(uiBuilderThemes, null, 2));
56
- return { entities: (_a = uiBuilderThemes.entities) !== null && _a !== void 0 ? _a : [] };
61
+ return uiBuilderThemes;
57
62
  }
58
63
  catch (e) {
59
64
  amplify_prompts_1.printer.debug(e);
@@ -93,4 +98,19 @@ function generateUiBuilderThemes(context, themeSchemas) {
93
98
  return themeResults;
94
99
  }
95
100
  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;
96
116
  //# sourceMappingURL=syncAmplifyUiBuilderComponents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"syncAmplifyUiBuilderComponents.js","sourceRoot":"","sources":["../../../src/commands/utils/syncAmplifyUiBuilderComponents.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,yDAAkF;AAClF,yEAA4F;AAC5F,6EAA0E;AAC1E,+CAA4C;AAErC,MAAM,UAAU,GAAG,CAAC,OAAmB,EAAE,OAAgB,EAAE,EAAE;IAClE,MAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAC;IAClC,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;AAChH,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB;AAEK,MAAM,YAAY,GAAG,KAAK,EAAE,OAAmB,EAAE,EAAE;IACxD,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AACtH,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAmB,EAAE,EAAE;IACpD,MAAM,KAAK,GAAG,IAAA,yBAAW,EAAC,OA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AAK,EAAE,OAAmB,EAAE,eAAuB,EAAE,KAAa,EAAE,EAAE;IAC9G,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,iBAAG,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACjD,CAAC,CAAC;AAhBW,QAAA,0BAA0B,8BAgBrC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/amplify-util-uibuilder",
3
- "version": "1.2.12-codegen-ui-q1-release.0",
3
+ "version": "1.2.12",
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": "q1-release",
17
- "@aws-amplify/codegen-ui-react": "q1-release",
18
- "@aws-sdk/client-amplifyuibuilder": "^3.51.0",
19
- "amplify-cli-core": "2.4.15-codegen-ui-q1-release.0",
16
+ "@aws-amplify/codegen-ui": "1.2.0",
17
+ "@aws-amplify/codegen-ui-react": "1.2.0",
18
+ "amplify-cli-core": "2.4.15",
20
19
  "amplify-prompts": "1.6.3",
21
- "amplify-provider-awscloudformation": "5.9.6-codegen-ui-q1-release.0"
20
+ "amplify-provider-awscloudformation": "5.9.6",
21
+ "aws-sdk": "^2.1042.0"
22
22
  },
23
23
  "jest": {
24
24
  "testRunner": "jest-circus/runner",
@@ -55,5 +55,5 @@
55
55
  "usePathForSuiteName": "true",
56
56
  "addFileAttribute": "true"
57
57
  },
58
- "gitHead": "2b133fd2c6a840f6189449562adecf31fa1c5668"
58
+ "gitHead": "4cf6274d03a8f53e53c9a3119f08d390783c92fa"
59
59
  }
@@ -3,11 +3,13 @@ import * as listUiBuilderComponentsDependency from '../commands/utils/syncAmplif
3
3
  import { run } from '../commands/cloneComponentsFromEnv';
4
4
  const extractArgsDependency_mock = extractArgsDependency as any;
5
5
  const listUiBuilderComponentsDependency_mock = listUiBuilderComponentsDependency as any;
6
- jest.mock('@aws-sdk/client-amplifyuibuilder', () => {
6
+ jest.mock('aws-sdk', () => {
7
7
  return {
8
8
  AmplifyUIBuilder: jest.fn(() => {
9
9
  return {
10
- createComponent: () => true,
10
+ createComponent: () => ({
11
+ promise: () => true,
12
+ }),
11
13
  };
12
14
  }),
13
15
  };
@@ -5,39 +5,14 @@ import {
5
5
  getAppId,
6
6
  listUiBuilderComponents,
7
7
  listUiBuilderThemes,
8
+ getAmplifyUIBuilderService,
8
9
  resolveAppId,
9
10
  generateUiBuilderThemes,
10
11
  } from '../commands/utils/syncAmplifyUiBuilderComponents';
11
- import { getAmplifyUIBuilderService } from '../commands/utils/uibuilder-client';
12
+ import aws from 'aws-sdk';
12
13
  import * as CLICore from 'amplify-cli-core';
13
14
  import * as createUiBuilderComponentDependency from '../commands/utils/createUiBuilderComponent';
14
- jest.mock('@aws-sdk/client-amplifyuibuilder', () => {
15
- return {
16
- AmplifyUIBuilder: jest.fn(() => {
17
- return {
18
- exportComponents: jest.fn(() => ({
19
- entities: [
20
- {
21
- appId: 'd37nrm8rzt3oek',
22
- bindingProperties: {},
23
- componentType: 'Box',
24
- environmentName: 'staging',
25
- id: 's-s4mU579Ycf6JGHwhqT',
26
- name: 'aawwdd',
27
- overrides: {},
28
- properties: {},
29
- variants: [],
30
- },
31
- ],
32
- })),
33
- exportThemes: jest.fn(() => ({
34
- entities: [{}],
35
- })),
36
- };
37
- }),
38
- };
39
- });
40
-
15
+ const aws_mock = aws as any;
41
16
  const createUiBuilderComponentDependency_mock = createUiBuilderComponentDependency as any;
42
17
  describe('should sync amplify ui builder components', () => {
43
18
  let context: $TSContext | any;
@@ -67,6 +42,32 @@ describe('should sync amplify ui builder components', () => {
67
42
  },
68
43
  },
69
44
  };
45
+
46
+ aws_mock.AmplifyUIBuilder = jest.fn(() => ({
47
+ exportComponents: jest.fn(() => ({
48
+ promise: jest.fn(() => ({
49
+ entities: [
50
+ {
51
+ appId: 'd37nrm8rzt3oek',
52
+ bindingProperties: {},
53
+ componentType: 'Box',
54
+ environmentName: 'staging',
55
+ id: 's-s4mU579Ycf6JGHwhqT',
56
+ name: 'aawwdd',
57
+ overrides: {},
58
+ properties: {},
59
+ variants: [],
60
+ },
61
+ ],
62
+ })),
63
+ })),
64
+ exportThemes: jest.fn(() => ({
65
+ promise: jest.fn(() => ({
66
+ entities: [{}],
67
+ })),
68
+ })),
69
+ }));
70
+
70
71
  createUiBuilderComponentDependency_mock.createUiBuilderComponent = jest.fn();
71
72
  createUiBuilderComponentDependency_mock.createUiBuilderTheme = jest.fn();
72
73
  });
@@ -1,8 +1,8 @@
1
+ import aws from 'aws-sdk';
1
2
  import { extractArgs } from './utils/extractArgs';
2
- import { getAmplifyUIBuilderService } from './utils/uibuilder-client';
3
3
  import { listUiBuilderComponents } from './utils/syncAmplifyUiBuilderComponents';
4
4
  import { printer } from 'amplify-prompts';
5
- import { $TSContext } from 'amplify-cli-core';
5
+ import { $TSAny, $TSContext } from 'amplify-cli-core';
6
6
 
7
7
  export async function run(context: $TSContext) {
8
8
  printer.debug('Running create components command in amplify-util-uibuilder');
@@ -26,27 +26,43 @@ 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 amplifyUIBuilder = await getAmplifyUIBuilderService(context, newEnvName, appId);
29
+ const awsConfigInfo = (await context.amplify.invokePluginMethod(context, 'awscloudformation', undefined, 'loadConfigurationForEnv', [
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);
30
44
  const components = existingComponents.entities;
31
45
  if (!components.length) {
32
46
  printer.debug(`No UIBuilder components found in app ${appId} from env ${sourceEnvName}. Skipping component clone process.`);
33
47
  return;
34
48
  }
35
49
  const promises = components.map(async (component: any) => {
36
- return await amplifyUIBuilder.createComponent({
37
- appId,
38
- environmentName,
39
- componentToCreate: {
40
- bindingProperties: component.bindingProperties,
41
- children: component.children,
42
- componentType: component.componentType,
43
- name: component.name,
44
- overrides: component.overrides,
45
- properties: component.properties,
46
- sourceId: component.sourceId,
47
- variants: component.variants,
48
- },
49
- });
50
+ return await amplifyUIBuilder
51
+ .createComponent({
52
+ appId,
53
+ environmentName,
54
+ componentToCreate: {
55
+ bindingProperties: component.bindingProperties,
56
+ children: component.children,
57
+ componentType: component.componentType,
58
+ name: component.name,
59
+ overrides: component.overrides,
60
+ properties: component.properties,
61
+ sourceId: component.sourceId,
62
+ variants: component.variants,
63
+ },
64
+ })
65
+ .promise();
50
66
  });
51
67
  await Promise.all(promises);
52
68
 
@@ -1,9 +1,9 @@
1
+ import aws from 'aws-sdk';
1
2
  import { printer } from 'amplify-prompts';
2
- import { getAmplifyUIBuilderService, Component, Theme } from './uibuilder-client';
3
3
  import { createUiBuilderComponent, createUiBuilderTheme } from './createUiBuilderComponent';
4
4
  import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
5
5
  import { extractArgs } from './extractArgs';
6
- import { $TSContext } from 'amplify-cli-core';
6
+ import { $TSAny, $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,36 +24,40 @@ export const getAppId = async (context: $TSContext) => {
24
24
  return appId;
25
25
  };
26
26
 
27
- export async function listUiBuilderComponents(context: $TSContext, envName?: string): Promise<{ entities: Component[] }> {
27
+ export async function listUiBuilderComponents(context: $TSContext, envName?: string) {
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
- const uiBuilderComponents = await amplifyUIBuilder.exportComponents({
34
- appId,
35
- environmentName,
36
- });
33
+ const uiBuilderComponents = await amplifyUIBuilder
34
+ .exportComponents({
35
+ appId,
36
+ environmentName,
37
+ })
38
+ .promise();
37
39
  printer.debug(JSON.stringify(uiBuilderComponents, null, 2));
38
- return { entities: uiBuilderComponents.entities ?? [] };
40
+ return uiBuilderComponents;
39
41
  } catch (e) {
40
42
  printer.debug(e);
41
43
  throw e;
42
44
  }
43
45
  }
44
46
 
45
- export async function listUiBuilderThemes(context: $TSContext, envName?: string): Promise<{ entities: Theme[] }> {
47
+ export async function listUiBuilderThemes(context: $TSContext, envName?: string) {
46
48
  const environmentName = getEnvName(context, envName);
47
49
  const appId = await getAppId(context);
48
50
 
49
51
  try {
50
52
  const amplifyUIBuilder = await getAmplifyUIBuilderService(context, environmentName, appId);
51
- const uiBuilderThemes = await amplifyUIBuilder.exportThemes({
52
- appId,
53
- environmentName,
54
- });
53
+ const uiBuilderThemes = await amplifyUIBuilder
54
+ .exportThemes({
55
+ appId,
56
+ environmentName,
57
+ })
58
+ .promise();
55
59
  printer.debug(JSON.stringify(uiBuilderThemes, null, 2));
56
- return { entities: uiBuilderThemes.entities ?? [] };
60
+ return uiBuilderThemes;
57
61
  } catch (e) {
58
62
  printer.debug(e);
59
63
  throw e;
@@ -97,3 +101,21 @@ export function generateUiBuilderThemes(context: $TSContext, themeSchemas: any[]
97
101
  );
98
102
  return themeResults;
99
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
+ };