@aws-amplify/amplify-util-uibuilder 1.7.0-replace-lambda-callouts-tests.0 → 1.8.0-rc.0d6bca41ff.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.
- package/CHANGELOG.md +23 -1
- package/lib/commands/generateComponents.d.ts.map +1 -1
- package/lib/commands/generateComponents.js +5 -1
- package/lib/commands/generateComponents.js.map +1 -1
- package/lib/commands/utils/index.d.ts +1 -0
- package/lib/commands/utils/index.d.ts.map +1 -1
- package/lib/commands/utils/index.js +1 -0
- package/lib/commands/utils/index.js.map +1 -1
- package/lib/commands/utils/notifyMissingPackages.d.ts +1 -1
- package/lib/commands/utils/notifyMissingPackages.d.ts.map +1 -1
- package/lib/commands/utils/notifyMissingPackages.js +3 -3
- package/lib/commands/utils/notifyMissingPackages.js.map +1 -1
- package/lib/commands/utils/storageManager.d.ts +5 -0
- package/lib/commands/utils/storageManager.d.ts.map +1 -0
- package/lib/commands/utils/storageManager.js +20 -0
- package/lib/commands/utils/storageManager.js.map +1 -0
- package/package.json +7 -7
- package/src/__tests__/notifyMissingPackages.test.ts +15 -3
- package/src/__tests__/storageManager.test.ts +42 -0
- package/src/commands/generateComponents.ts +8 -1
- package/src/commands/utils/index.ts +1 -0
- package/src/commands/utils/notifyMissingPackages.ts +4 -3
- package/src/commands/utils/storageManager.ts +17 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,19 +3,41 @@
|
|
|
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.
|
|
6
|
+
# [1.8.0-rc.0d6bca41ff.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.7.0...@aws-amplify/amplify-util-uibuilder@1.8.0-rc.0d6bca41ff.0) (2023-05-02)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
11
|
* **amplify-util-uibuilder:** update codegen-ui to 2.11.0 ([#12265](https://github.com/aws-amplify/amplify-cli/issues/12265)) ([f5cebf5](https://github.com/aws-amplify/amplify-cli/commit/f5cebf532894bf4a22d9f938933c38fc4f8e4b1a))
|
|
12
12
|
* **amplify-util-uibuilder:** update codegen-ui to 2.11.1 ([#12352](https://github.com/aws-amplify/amplify-cli/issues/12352)) ([78590b8](https://github.com/aws-amplify/amplify-cli/commit/78590b8d4face7bbc0b174337b77b118affc525b))
|
|
13
|
+
* exclude smoketests on windows; remove extraneous dependency ([#12572](https://github.com/aws-amplify/amplify-cli/issues/12572)) ([0d6bca4](https://github.com/aws-amplify/amplify-cli/commit/0d6bca41ff7ef4a8a203b3044123b328b77b2b0e))
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
### Features
|
|
16
17
|
|
|
17
18
|
* **amplify-util-uibuilder:** formFeatureFlags metadata ([#12369](https://github.com/aws-amplify/amplify-cli/issues/12369)) ([e520c6c](https://github.com/aws-amplify/amplify-cli/commit/e520c6c686fa5e7112993745626f737612fa9145))
|
|
18
19
|
* **amplify-util-uibuilder:** support StorageField ([#12386](https://github.com/aws-amplify/amplify-cli/issues/12386)) ([f158f10](https://github.com/aws-amplify/amplify-cli/commit/f158f102059ae90cced25560b04887b7df2eb246))
|
|
20
|
+
* **amplify-util-uibuilder:** update codegen-ui to 2.13.1 ([#12565](https://github.com/aws-amplify/amplify-cli/issues/12565)) ([687dcc2](https://github.com/aws-amplify/amplify-cli/commit/687dcc276adf72502c87116f6c632b97f4eb649e))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# [1.7.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-util-uibuilder@1.6.14...@aws-amplify/amplify-util-uibuilder@1.7.0) (2023-04-24)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **amplify-util-uibuilder:** fix icon regression ([#12498](https://github.com/aws-amplify/amplify-cli/issues/12498)) ([9c56c9e](https://github.com/aws-amplify/amplify-cli/commit/9c56c9eecafa0febf9c79fcc785744bca8ff8a16))
|
|
32
|
+
* fixes merge conflicts ([7e2490f](https://github.com/aws-amplify/amplify-cli/commit/7e2490f3bbeee3aa57c31636c0e3e027ef3bb405))
|
|
33
|
+
* modelgen regression ([a87fc75](https://github.com/aws-amplify/amplify-cli/commit/a87fc7549440ee362fdf40b06c1b1e9f61bdc287))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **amplify-util-uibuilder:** formFeatureFlags metadata ([#12369](https://github.com/aws-amplify/amplify-cli/issues/12369)) ([b5f34d5](https://github.com/aws-amplify/amplify-cli/commit/b5f34d55040759d3200e145646cb89999cef6078))
|
|
39
|
+
* **amplify-util-uibuilder:** support StorageField ([#12386](https://github.com/aws-amplify/amplify-cli/issues/12386)) ([90fe1e4](https://github.com/aws-amplify/amplify-cli/commit/90fe1e4574c52eb4cacd110d50310f55bf913214))
|
|
40
|
+
* minor version bump ([f7af76d](https://github.com/aws-amplify/amplify-cli/commit/f7af76d5c97908b4ff06b89a019bc8ac9129fb71))
|
|
19
41
|
|
|
20
42
|
|
|
21
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponents.d.ts","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"generateComponents.d.ts","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAqB3D,eAAO,MAAM,GAAG,YAAmB,UAAU,aAAa,UAAU,GAAG,UAAU,KAAG,QAAQ,IAAI,CAuG/F,CAAC"}
|
|
@@ -37,12 +37,16 @@ const run = async (context, eventType) => {
|
|
|
37
37
|
let hasSuccessfulForm = false;
|
|
38
38
|
const failedResponseNames = [];
|
|
39
39
|
const modelNames = (dataSchema === null || dataSchema === void 0 ? void 0 : dataSchema.models) ? new Set(Object.keys(dataSchema.models)) : new Set();
|
|
40
|
+
let hasStorageManagerField = false;
|
|
40
41
|
Object.entries(generatedResults).forEach(([key, results]) => {
|
|
41
42
|
results.forEach((result) => {
|
|
42
43
|
if (result.resultType === 'SUCCESS') {
|
|
43
44
|
successfulSchemas.push(result.schema);
|
|
44
45
|
if (key === 'form') {
|
|
45
46
|
hasSuccessfulForm = true;
|
|
47
|
+
if (!hasStorageManagerField && (0, utils_1.isFormSchema)(result.schema) && (0, utils_1.hasStorageField)(result.schema)) {
|
|
48
|
+
hasStorageManagerField = true;
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
else {
|
|
@@ -74,7 +78,7 @@ const run = async (context, eventType) => {
|
|
|
74
78
|
if (invalidComponentNames.length) {
|
|
75
79
|
amplify_prompts_1.printer.warn(`The components ${invalidComponentNames.join(', ')} were synced with an older version of Amplify Studio. Please re-sync your components with Figma to get latest features and changes.`);
|
|
76
80
|
}
|
|
77
|
-
(0, utils_1.notifyMissingPackages)(context);
|
|
81
|
+
(0, utils_1.notifyMissingPackages)(context, hasStorageManagerField);
|
|
78
82
|
await (0, utils_1.deleteDetachedForms)(detachedForms, studioClient);
|
|
79
83
|
}
|
|
80
84
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponents.js","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":";;;;;;AAEA,8CAAsB;AACtB,kEAAuD;AAEvD,wCAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"generateComponents.js","sourceRoot":"","sources":["../../src/commands/generateComponents.ts"],"names":[],"mappings":";;;;;;AAEA,8CAAsB;AACtB,kEAAuD;AAEvD,wCAAiD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I,qBAAqB,CAAC,MAAM,EAAE;YAChC,yBAAO,CAAC,IAAI,CACV,kBAAkB,qBAAqB,CAAC,IAAI,CAC1C,IAAI,CACL,qIAAqI,CACvI,CAAC;SACH;QAED,IAAA,6BAAqB,EAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;QAEvD,MAAM,IAAA,2BAAmB,EAAC,aAAa,EAAE,YAAY,CAAC,CAAC;KACxD;IAAC,OAAO,CAAC,EAAE;QACV,yBAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;KAC9C;AACH,CAAC,CAAC;AAvGW,QAAA,GAAG,OAuGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
|
@@ -22,4 +22,5 @@ __exportStar(require("./notifyMissingPackages"), exports);
|
|
|
22
22
|
__exportStar(require("./shouldRenderComponents"), exports);
|
|
23
23
|
__exportStar(require("./syncAmplifyUiBuilderComponents"), exports);
|
|
24
24
|
__exportStar(require("./detachedFormCleanup"), exports);
|
|
25
|
+
__exportStar(require("./storageManager"), exports);
|
|
25
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,uDAAqC;AACrC,gDAA8B;AAC9B,+DAA6C;AAC7C,0DAAwC;AACxC,2DAAyC;AACzC,mEAAiD;AACjD,wDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,uDAAqC;AACrC,gDAA8B;AAC9B,+DAA6C;AAC7C,0DAAwC;AACxC,2DAAyC;AACzC,mEAAiD;AACjD,wDAAsC;AACtC,mDAAiC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { $TSContext } from '@aws-amplify/amplify-cli-core';
|
|
2
|
-
export declare const notifyMissingPackages: (context: $TSContext) => void;
|
|
2
|
+
export declare const notifyMissingPackages: (context: $TSContext, hasStorageManagerField?: boolean) => void;
|
|
3
3
|
//# sourceMappingURL=notifyMissingPackages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyMissingPackages.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,UAAU,EAAU,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"notifyMissingPackages.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,UAAU,EAAU,MAAM,+BAA+B,CAAC;AAgB/F,eAAO,MAAM,qBAAqB,YAAa,UAAU,2BAA2B,OAAO,KAAG,IA8B7F,CAAC"}
|
|
@@ -11,8 +11,8 @@ const path_1 = __importDefault(require("path"));
|
|
|
11
11
|
const subset_1 = __importDefault(require("semver/ranges/subset"));
|
|
12
12
|
const codegen_ui_react_1 = require("@aws-amplify/codegen-ui-react");
|
|
13
13
|
const extractArgs_1 = require("./extractArgs");
|
|
14
|
-
const getRequiredDependencies = () => new codegen_ui_react_1.ReactRequiredDependencyProvider().getRequiredDependencies();
|
|
15
|
-
const notifyMissingPackages = (context) => {
|
|
14
|
+
const getRequiredDependencies = (hasStorageManagerField) => new codegen_ui_react_1.ReactRequiredDependencyProvider().getRequiredDependencies(hasStorageManagerField);
|
|
15
|
+
const notifyMissingPackages = (context, hasStorageManagerField) => {
|
|
16
16
|
var _a;
|
|
17
17
|
const args = (0, extractArgs_1.extractArgs)(context);
|
|
18
18
|
const localEnvFilePath = (_a = args.localEnvFilePath) !== null && _a !== void 0 ? _a : amplify_cli_core_1.pathManager.getLocalEnvFilePath();
|
|
@@ -27,7 +27,7 @@ const notifyMissingPackages = (context) => {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
const packageJson = amplify_cli_core_1.JSONUtilities.readJson(packageJsonPath);
|
|
30
|
-
getRequiredDependencies().forEach((dependency) => {
|
|
30
|
+
getRequiredDependencies(hasStorageManagerField).forEach((dependency) => {
|
|
31
31
|
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(dependency.dependencyName);
|
|
32
32
|
if (!packageIsInstalled) {
|
|
33
33
|
amplify_prompts_1.printer.warn(`UIBuilder components require "${dependency.dependencyName}" that is not in your package.json. Run \`npm install "${dependency.dependencyName}@${dependency.supportedSemVerPattern}"\`. ${dependency.reason}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyMissingPackages.js","sourceRoot":"","sources":["../../../src/commands/utils/notifyMissingPackages.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA+F;AAC/F,kEAAuD;AACvD,wDAA0B;AAC1B,gDAAwB;AACxB,kEAA+C;AAE/C,oEAAgF;AAChF,+CAA4C;AAE5C,MAA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AQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QACrG,IAAI,CAAC,kBAAkB,EAAE;YACvB,yBAAO,CAAC,IAAI,CACV,iCAAiC,UAAU,CAAC,cAAc,0DAA0D,UAAU,CAAC,cAAc,IAAI,UAAU,CAAC,sBAAsB,QAAQ,UAAU,CAAC,MAAM,EAAE,CAC9M,CAAC;SACH;aAAM,IAAI,CAAC,IAAA,gBAAW,EAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,sBAAsB,CAAC,EAAE;YAC/G,yBAAO,CAAC,IAAI,CACV,yCAAyC,UAAU,CAAC,sBAAsB,SACxE,UAAU,CAAC,cACb,oCAAoC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,yBACrF,UAAU,CAAC,cACb,IAAI,UAAU,CAAC,sBAAsB,QAAQ,UAAU,CAAC,MAAM,EAAE,CACjE,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA9BW,QAAA,qBAAqB,yBA8BhC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { StudioForm, StudioFormFieldConfig, StudioGenericFieldConfig, StudioSchema } from '@aws-amplify/codegen-ui';
|
|
2
|
+
export declare const hasStorageField: (form: StudioForm) => boolean;
|
|
3
|
+
export declare const isFormSchema: (schema: StudioSchema) => schema is StudioForm;
|
|
4
|
+
export declare const isGenericFieldConfig: (config: StudioFormFieldConfig) => config is StudioGenericFieldConfig;
|
|
5
|
+
//# sourceMappingURL=storageManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageManager.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/storageManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEpH,eAAO,MAAM,eAAe,SAAU,UAAU,KAAG,OAMlD,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY,YAAY,yBAEhD,CAAC;AAEF,eAAO,MAAM,oBAAoB,WAAY,qBAAqB,uCAEjE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isGenericFieldConfig = exports.isFormSchema = exports.hasStorageField = void 0;
|
|
4
|
+
const hasStorageField = (form) => {
|
|
5
|
+
const result = Object.values(form.fields).some((field) => {
|
|
6
|
+
var _a;
|
|
7
|
+
return (0, exports.isGenericFieldConfig)(field) && ((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.type) === 'StorageField';
|
|
8
|
+
});
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
exports.hasStorageField = hasStorageField;
|
|
12
|
+
const isFormSchema = (schema) => {
|
|
13
|
+
return schema && Object.keys(schema).includes('fields');
|
|
14
|
+
};
|
|
15
|
+
exports.isFormSchema = isFormSchema;
|
|
16
|
+
const isGenericFieldConfig = (config) => {
|
|
17
|
+
return !Object.keys(config).includes('excluded');
|
|
18
|
+
};
|
|
19
|
+
exports.isGenericFieldConfig = isGenericFieldConfig;
|
|
20
|
+
//# sourceMappingURL=storageManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageManager.js","sourceRoot":"","sources":["../../../src/commands/utils/storageManager.ts"],"names":[],"mappings":";;;AAEO,MAAM,eAAe,GAAG,CAAC,IAAgB,EAAW,EAAE;IAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;;QACvD,OAAO,IAAA,4BAAoB,EAAC,KAAK,CAAC,IAAI,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,IAAI,MAAK,cAAc,CAAC;IACjF,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AANW,QAAA,eAAe,mBAM1B;AAEK,MAAM,YAAY,GAAG,CAAC,MAAoB,EAAwB,EAAE;IACzE,OAAO,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,MAAM,oBAAoB,GAAG,CAAC,MAA6B,EAAsC,EAAE;IACxG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/amplify-util-uibuilder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-rc.0d6bca41ff.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@aws-amplify/amplify-cli-core": "4.0.
|
|
18
|
-
"@aws-amplify/amplify-prompts": "2.7.0-
|
|
19
|
-
"@aws-amplify/codegen-ui": "2.
|
|
20
|
-
"@aws-amplify/codegen-ui-react": "2.
|
|
21
|
-
"amplify-codegen": "^3.4.
|
|
17
|
+
"@aws-amplify/amplify-cli-core": "4.0.5-rc.0d6bca41ff.0",
|
|
18
|
+
"@aws-amplify/amplify-prompts": "2.7.0-rc.0d6bca41ff.0",
|
|
19
|
+
"@aws-amplify/codegen-ui": "2.13.1",
|
|
20
|
+
"@aws-amplify/codegen-ui-react": "2.13.1",
|
|
21
|
+
"amplify-codegen": "^3.4.3",
|
|
22
22
|
"aws-sdk": "^2.1354.0",
|
|
23
23
|
"fs-extra": "^8.1.0",
|
|
24
24
|
"ora": "^4.0.3",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"usePathForSuiteName": "true",
|
|
74
74
|
"addFileAttribute": "true"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "4d59e2e00b36702cb0960d66da0c600a51b26792"
|
|
77
77
|
}
|
|
@@ -24,7 +24,7 @@ describe('should notify when packages are missing', () => {
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
|
-
notifyMissingPackages(context as unknown as $TSContext);
|
|
27
|
+
notifyMissingPackages(context as unknown as $TSContext, false);
|
|
28
28
|
expect(printerDependency.printer.debug).toBeCalledTimes(1);
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -40,7 +40,7 @@ describe('should notify when packages are missing', () => {
|
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
-
notifyMissingPackages(context as unknown as $TSContext);
|
|
43
|
+
notifyMissingPackages(context as unknown as $TSContext, false);
|
|
44
44
|
expect(printerDependency.printer.debug).toBeCalledTimes(1);
|
|
45
45
|
});
|
|
46
46
|
|
|
@@ -52,7 +52,7 @@ describe('should notify when packages are missing', () => {
|
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
|
-
notifyMissingPackages(context as unknown as $TSContext);
|
|
55
|
+
notifyMissingPackages(context as unknown as $TSContext, true);
|
|
56
56
|
expect(printerDependency.printer.warn).toBeCalledTimes(3);
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -69,6 +69,18 @@ describe('should notify when packages are missing', () => {
|
|
|
69
69
|
},
|
|
70
70
|
};
|
|
71
71
|
notifyMissingPackages(context as unknown as $TSContext);
|
|
72
|
+
expect(printerDependency.printer.warn).toBeCalledTimes(1);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('notifies for all dependencies except storage if user is not using StorageManager', () => {
|
|
76
|
+
const context = {
|
|
77
|
+
input: {
|
|
78
|
+
options: {
|
|
79
|
+
localEnvFilePath: __dirname + '/mock.json',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
notifyMissingPackages(context as unknown as $TSContext, false);
|
|
72
84
|
expect(printerDependency.printer.warn).toBeCalledTimes(2);
|
|
73
85
|
});
|
|
74
86
|
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StudioSchema } from '@aws-amplify/codegen-ui';
|
|
2
|
+
import { hasStorageField } from '../commands/utils';
|
|
3
|
+
|
|
4
|
+
const formWithNoCustomization: StudioSchema = {
|
|
5
|
+
id: 'f-123456',
|
|
6
|
+
name: 'BlogCreateForm',
|
|
7
|
+
formActionType: 'create',
|
|
8
|
+
dataType: {
|
|
9
|
+
dataSourceType: 'DataStore',
|
|
10
|
+
dataTypeName: 'Blog',
|
|
11
|
+
},
|
|
12
|
+
fields: {},
|
|
13
|
+
sectionalElements: {},
|
|
14
|
+
style: {},
|
|
15
|
+
cta: {},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const formWithNoStorageField: StudioSchema = {
|
|
19
|
+
...formWithNoCustomization,
|
|
20
|
+
dataType: { dataSourceType: 'Custom', dataTypeName: 'Blog' },
|
|
21
|
+
fields: {
|
|
22
|
+
name: { inputType: { type: 'TextField' } },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const formWithStorageField: StudioSchema = {
|
|
27
|
+
...formWithNoCustomization,
|
|
28
|
+
dataType: { dataSourceType: 'Custom', dataTypeName: 'Blog' },
|
|
29
|
+
fields: {
|
|
30
|
+
name: { inputType: { type: 'StorageField' } },
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
describe('hasStorageManager', () => {
|
|
35
|
+
it('should return false for form with no StorageManager config', () => {
|
|
36
|
+
expect(hasStorageField(formWithNoStorageField)).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should return true for form with StorageManager config', () => {
|
|
40
|
+
expect(hasStorageField(formWithStorageField)).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
isStudioForm,
|
|
17
17
|
isFormDetachedFromModel,
|
|
18
18
|
deleteDetachedForms,
|
|
19
|
+
hasStorageField,
|
|
20
|
+
isFormSchema,
|
|
19
21
|
} from './utils';
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -60,6 +62,7 @@ export const run = async (context: $TSContext, eventType: 'PostPush' | 'PostPull
|
|
|
60
62
|
let hasSuccessfulForm = false;
|
|
61
63
|
const failedResponseNames: string[] = [];
|
|
62
64
|
const modelNames = dataSchema?.models ? new Set(Object.keys(dataSchema.models)) : new Set<string>();
|
|
65
|
+
let hasStorageManagerField = false;
|
|
63
66
|
|
|
64
67
|
Object.entries(generatedResults).forEach(([key, results]) => {
|
|
65
68
|
results.forEach((result) => {
|
|
@@ -67,6 +70,10 @@ export const run = async (context: $TSContext, eventType: 'PostPush' | 'PostPull
|
|
|
67
70
|
successfulSchemas.push(result.schema);
|
|
68
71
|
if (key === 'form') {
|
|
69
72
|
hasSuccessfulForm = true;
|
|
73
|
+
|
|
74
|
+
if (!hasStorageManagerField && isFormSchema(result.schema) && hasStorageField(result.schema)) {
|
|
75
|
+
hasStorageManagerField = true;
|
|
76
|
+
}
|
|
70
77
|
}
|
|
71
78
|
} else {
|
|
72
79
|
const failedSchema = result.schema;
|
|
@@ -112,7 +119,7 @@ export const run = async (context: $TSContext, eventType: 'PostPush' | 'PostPull
|
|
|
112
119
|
);
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
notifyMissingPackages(context);
|
|
122
|
+
notifyMissingPackages(context, hasStorageManagerField);
|
|
116
123
|
|
|
117
124
|
await deleteDetachedForms(detachedForms, studioClient);
|
|
118
125
|
} catch (e) {
|
|
@@ -7,13 +7,14 @@ import { RequiredDependency } from '@aws-amplify/codegen-ui';
|
|
|
7
7
|
import { ReactRequiredDependencyProvider } from '@aws-amplify/codegen-ui-react';
|
|
8
8
|
import { extractArgs } from './extractArgs';
|
|
9
9
|
|
|
10
|
-
const getRequiredDependencies = (): RequiredDependency[] =>
|
|
10
|
+
const getRequiredDependencies = (hasStorageManagerField?: boolean): RequiredDependency[] =>
|
|
11
|
+
new ReactRequiredDependencyProvider().getRequiredDependencies(hasStorageManagerField);
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Displays a warning to the user if they have npm dependencies
|
|
14
15
|
* they need to install in their application for UIBuilder components to work properly
|
|
15
16
|
*/
|
|
16
|
-
export const notifyMissingPackages = (context: $TSContext): void => {
|
|
17
|
+
export const notifyMissingPackages = (context: $TSContext, hasStorageManagerField?: boolean): void => {
|
|
17
18
|
const args = extractArgs(context);
|
|
18
19
|
const localEnvFilePath = args.localEnvFilePath ?? pathManager.getLocalEnvFilePath();
|
|
19
20
|
if (!fs.existsSync(localEnvFilePath)) {
|
|
@@ -27,7 +28,7 @@ export const notifyMissingPackages = (context: $TSContext): void => {
|
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
const packageJson = JSONUtilities.readJson(packageJsonPath) as { dependencies: { [key: string]: string } };
|
|
30
|
-
getRequiredDependencies().forEach((dependency: $TSAny) => {
|
|
31
|
+
getRequiredDependencies(hasStorageManagerField).forEach((dependency: $TSAny) => {
|
|
31
32
|
const packageIsInstalled = Object.keys(packageJson.dependencies).includes(dependency.dependencyName);
|
|
32
33
|
if (!packageIsInstalled) {
|
|
33
34
|
printer.warn(
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StudioForm, StudioFormFieldConfig, StudioGenericFieldConfig, StudioSchema } from '@aws-amplify/codegen-ui';
|
|
2
|
+
|
|
3
|
+
export const hasStorageField = (form: StudioForm): boolean => {
|
|
4
|
+
const result = Object.values(form.fields).some((field) => {
|
|
5
|
+
return isGenericFieldConfig(field) && field.inputType?.type === 'StorageField';
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const isFormSchema = (schema: StudioSchema): schema is StudioForm => {
|
|
12
|
+
return schema && Object.keys(schema).includes('fields');
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const isGenericFieldConfig = (config: StudioFormFieldConfig): config is StudioGenericFieldConfig => {
|
|
16
|
+
return !Object.keys(config).includes('excluded');
|
|
17
|
+
};
|