@aws-amplify/amplify-util-uibuilder 1.6.19-gfix.0 → 1.7.0-mock-fix.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/API.md +1 -1
- package/CHANGELOG.md +4 -62
- package/lib/clients/amplify-studio-client.d.ts +5 -1
- package/lib/clients/amplify-studio-client.d.ts.map +1 -1
- package/lib/clients/amplify-studio-client.js +10 -2
- package/lib/clients/amplify-studio-client.js.map +1 -1
- package/lib/commands/cloneComponentsFromEnv.d.ts +1 -1
- package/lib/commands/cloneComponentsFromEnv.d.ts.map +1 -1
- package/lib/commands/generateComponents.d.ts +1 -1
- package/lib/commands/generateComponents.d.ts.map +1 -1
- package/lib/commands/generateComponents.js +1 -1
- package/lib/commands/generateComponents.js.map +1 -1
- package/lib/commands/utils/codegenResources.d.ts +3 -3
- package/lib/commands/utils/codegenResources.d.ts.map +1 -1
- package/lib/commands/utils/codegenResources.js +2 -2
- package/lib/commands/utils/codegenResources.js.map +1 -1
- package/lib/commands/utils/environmentHelpers.d.ts +1 -1
- package/lib/commands/utils/environmentHelpers.d.ts.map +1 -1
- package/lib/commands/utils/environmentHelpers.js +1 -1
- package/lib/commands/utils/environmentHelpers.js.map +1 -1
- package/lib/commands/utils/extractArgs.d.ts +1 -1
- package/lib/commands/utils/extractArgs.d.ts.map +1 -1
- package/lib/commands/utils/featureFlags.js +1 -1
- package/lib/commands/utils/featureFlags.js.map +1 -1
- package/lib/commands/utils/getUiBuilderComponentsPath.d.ts +1 -1
- package/lib/commands/utils/getUiBuilderComponentsPath.d.ts.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 +1 -1
- package/lib/commands/utils/notifyMissingPackages.js.map +1 -1
- package/lib/commands/utils/shouldRenderComponents.d.ts +1 -1
- package/lib/commands/utils/shouldRenderComponents.d.ts.map +1 -1
- package/lib/commands/utils/shouldRenderComponents.js +1 -1
- package/lib/commands/utils/shouldRenderComponents.js.map +1 -1
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts +3 -3
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts.map +1 -1
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.js +3 -3
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.js.map +1 -1
- package/lib/event-handlers/handle-PostEnvAdd.d.ts +1 -1
- package/lib/event-handlers/handle-PostEnvAdd.d.ts.map +1 -1
- package/lib/event-handlers/handle-PostPull.d.ts +1 -1
- package/lib/event-handlers/handle-PostPull.d.ts.map +1 -1
- package/lib/event-handlers/handle-PostPush.d.ts +1 -1
- package/lib/event-handlers/handle-PostPush.d.ts.map +1 -1
- package/lib/event-handlers/handle-PrePush.d.ts +1 -1
- package/lib/event-handlers/handle-PrePush.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/utils/prePushHandler.d.ts +1 -1
- package/lib/utils/prePushHandler.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/__tests__/cloneComponentsFromEnv.test.ts +5 -1
- package/src/__tests__/generateComponents.test.ts +5 -1
- package/src/__tests__/help.test.ts +1 -1
- package/src/__tests__/notifyMissingPackages.test.ts +5 -5
- package/src/__tests__/prePushHandler.test.ts +6 -2
- package/src/__tests__/shouldRenderComponents.test.ts +10 -6
- package/src/__tests__/syncAmplifyUiComponents.test.ts +11 -3
- package/src/__tests__/version.test.ts +1 -1
- package/src/clients/amplify-studio-client.ts +13 -1
- package/src/commands/cloneComponentsFromEnv.ts +1 -1
- package/src/commands/generateComponents.ts +2 -1
- package/src/commands/utils/codegenResources.ts +9 -3
- package/src/commands/utils/environmentHelpers.ts +1 -1
- package/src/commands/utils/extractArgs.ts +1 -1
- package/src/commands/utils/featureFlags.ts +1 -1
- package/src/commands/utils/getUiBuilderComponentsPath.ts +1 -1
- package/src/commands/utils/notifyMissingPackages.ts +1 -1
- package/src/commands/utils/shouldRenderComponents.ts +1 -1
- package/src/commands/utils/syncAmplifyUiBuilderComponents.ts +13 -4
- package/src/event-handlers/handle-PostEnvAdd.ts +1 -1
- package/src/event-handlers/handle-PostPull.ts +1 -1
- package/src/event-handlers/handle-PostPush.ts +1 -1
- package/src/event-handlers/handle-PrePush.ts +1 -1
- package/src/index.ts +1 -1
- package/src/utils/prePushHandler.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prePushHandler.d.ts","sourceRoot":"","sources":["../../src/utils/prePushHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prePushHandler.d.ts","sourceRoot":"","sources":["../../src/utils/prePushHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAU3D,eAAO,MAAM,cAAc,YAAmB,UAAU,KAAG,QAAQ,IAAI,CAmBtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/amplify-util-uibuilder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-mock-fix.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-
|
|
18
|
-
"@aws-amplify/
|
|
19
|
-
"@aws-amplify/codegen-ui
|
|
20
|
-
"amplify-
|
|
21
|
-
"amplify-codegen": "^3.4.
|
|
17
|
+
"@aws-amplify/amplify-cli-core": "4.0.2-mock-fix.0",
|
|
18
|
+
"@aws-amplify/amplify-prompts": "2.6.7-mock-fix.0",
|
|
19
|
+
"@aws-amplify/codegen-ui": "2.11.1",
|
|
20
|
+
"@aws-amplify/codegen-ui-react": "2.11.1",
|
|
21
|
+
"amplify-codegen": "^3.4.1",
|
|
22
22
|
"aws-sdk": "^2.1233.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": "0714aae4d666060bcd03ed481943f262eb07762a"
|
|
77
77
|
}
|
|
@@ -9,7 +9,7 @@ jest.mock('../commands/utils/featureFlags', () => ({
|
|
|
9
9
|
getTransformerVersion: jest.fn().mockReturnValue(2),
|
|
10
10
|
}));
|
|
11
11
|
jest.mock('../commands/utils/extractArgs');
|
|
12
|
-
jest.mock('amplify-cli-core');
|
|
12
|
+
jest.mock('@aws-amplify/amplify-cli-core');
|
|
13
13
|
|
|
14
14
|
const mockedComponentExport = jest.fn((envName: string) => {
|
|
15
15
|
if (envName === 'newEnvName') {
|
|
@@ -53,6 +53,10 @@ describe('can clone components to new environment', () => {
|
|
|
53
53
|
features: {
|
|
54
54
|
autoGenerateForms: 'true',
|
|
55
55
|
autoGenerateViews: 'true',
|
|
56
|
+
formFeatureFlags: {
|
|
57
|
+
isRelationshipSupported: 'false',
|
|
58
|
+
isNonModelSupported: 'false',
|
|
59
|
+
},
|
|
56
60
|
},
|
|
57
61
|
}),
|
|
58
62
|
}),
|
|
@@ -3,7 +3,7 @@ import * as utils from '../commands/utils';
|
|
|
3
3
|
import { run } from '../commands/generateComponents';
|
|
4
4
|
|
|
5
5
|
jest.mock('../commands/utils');
|
|
6
|
-
jest.mock('amplify-cli-core');
|
|
6
|
+
jest.mock('@aws-amplify/amplify-cli-core');
|
|
7
7
|
const awsMock = aws as any;
|
|
8
8
|
const utilsMock = utils as any;
|
|
9
9
|
|
|
@@ -69,6 +69,10 @@ describe('can generate components', () => {
|
|
|
69
69
|
features: {
|
|
70
70
|
autoGenerateForms: 'true',
|
|
71
71
|
autoGenerateViews: 'true',
|
|
72
|
+
formFeatureFlags: {
|
|
73
|
+
isRelationshipSupported: 'false',
|
|
74
|
+
isNonModelSupported: 'false',
|
|
75
|
+
},
|
|
72
76
|
},
|
|
73
77
|
}),
|
|
74
78
|
}),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as printerDependency from '@aws-amplify/amplify-prompts';
|
|
2
|
-
import * as JSONUtilitiesDependency from 'amplify-cli-core';
|
|
2
|
+
import * as JSONUtilitiesDependency from '@aws-amplify/amplify-cli-core';
|
|
3
3
|
import { notifyMissingPackages } from '../commands/utils/notifyMissingPackages';
|
|
4
|
-
import { $TSContext } from 'amplify-cli-core';
|
|
5
|
-
jest.mock('amplify-prompts');
|
|
6
|
-
jest.mock('amplify-cli-core');
|
|
4
|
+
import { $TSContext } from '@aws-amplify/amplify-cli-core';
|
|
5
|
+
jest.mock('@aws-amplify/amplify-prompts');
|
|
6
|
+
jest.mock('@aws-amplify/amplify-cli-core');
|
|
7
7
|
printerDependency.printer.info = jest.fn();
|
|
8
8
|
printerDependency.printer.debug = jest.fn();
|
|
9
9
|
printerDependency.printer.warn = jest.fn();
|
|
@@ -59,7 +59,7 @@ describe('should notify when packages are missing', () => {
|
|
|
59
59
|
it('notifies for partial missing dependencies', async () => {
|
|
60
60
|
JSONUtilitiesDependency.JSONUtilities.readJson = jest.fn().mockImplementation(() => ({
|
|
61
61
|
projectPath: __dirname,
|
|
62
|
-
dependencies: { '@aws-amplify/ui-react': '4.2
|
|
62
|
+
dependencies: { '@aws-amplify/ui-react': '4.4.2' },
|
|
63
63
|
}));
|
|
64
64
|
const context = {
|
|
65
65
|
input: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// aws-sdk, amplify-cli-core, amplify-prompts are in package dependencies
|
|
1
|
+
// aws-sdk, @aws-amplify/amplify-cli-core, amplify-prompts are in package dependencies
|
|
2
2
|
import aws from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies
|
|
3
3
|
import { Form } from 'aws-sdk/clients/amplifyuibuilder'; // eslint-disable-line import/no-extraneous-dependencies
|
|
4
4
|
import { printer } from '@aws-amplify/amplify-prompts'; // eslint-disable-line import/no-extraneous-dependencies
|
|
@@ -6,7 +6,7 @@ import * as utils from '../commands/utils';
|
|
|
6
6
|
import { prePushHandler } from '../utils/prePushHandler';
|
|
7
7
|
|
|
8
8
|
jest.mock('../commands/utils');
|
|
9
|
-
jest.mock('amplify-cli-core');
|
|
9
|
+
jest.mock('@aws-amplify/amplify-cli-core');
|
|
10
10
|
jest.mock('../commands/utils/featureFlags', () => ({
|
|
11
11
|
getTransformerVersion: jest.fn().mockImplementation(() => 2),
|
|
12
12
|
}));
|
|
@@ -80,6 +80,10 @@ describe('handlePrePush', () => {
|
|
|
80
80
|
features: {
|
|
81
81
|
autoGenerateForms: 'true',
|
|
82
82
|
autoGenerateViews: 'true',
|
|
83
|
+
formFeatureFlags: {
|
|
84
|
+
isRelationshipSupported: 'false',
|
|
85
|
+
isNonModelSupported: 'false',
|
|
86
|
+
},
|
|
83
87
|
},
|
|
84
88
|
})),
|
|
85
89
|
})),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
import { $TSContext } from 'amplify-cli-core';
|
|
2
|
+
import { $TSContext } from '@aws-amplify/amplify-cli-core';
|
|
3
3
|
import aws from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies
|
|
4
4
|
import { shouldRenderComponents } from '../commands/utils/shouldRenderComponents';
|
|
5
5
|
|
|
6
6
|
const awsMock = aws as any;
|
|
7
7
|
|
|
8
|
-
jest.mock('amplify-cli-core', () => ({
|
|
9
|
-
...jest.requireActual('amplify-cli-core'),
|
|
8
|
+
jest.mock('@aws-amplify/amplify-cli-core', () => ({
|
|
9
|
+
...jest.requireActual('@aws-amplify/amplify-cli-core'),
|
|
10
10
|
stateManager: {
|
|
11
11
|
getProjectConfig: jest.fn().mockReturnValue({
|
|
12
12
|
providers: ['awscloudformation'],
|
|
@@ -35,6 +35,10 @@ describe('should render components', () => {
|
|
|
35
35
|
features: {
|
|
36
36
|
autoGenerateForms: 'true',
|
|
37
37
|
autoGenerateViews: 'true',
|
|
38
|
+
formFeatureFlags: {
|
|
39
|
+
isRelationshipSupported: 'false',
|
|
40
|
+
isNonModelSupported: 'false',
|
|
41
|
+
},
|
|
38
42
|
},
|
|
39
43
|
})),
|
|
40
44
|
})),
|
|
@@ -62,7 +66,7 @@ describe('should render components', () => {
|
|
|
62
66
|
});
|
|
63
67
|
|
|
64
68
|
it("doesn't work if provider is not awscloudformation", async () => {
|
|
65
|
-
jest.mock('amplify-cli-core', () => ({
|
|
69
|
+
jest.mock('@aws-amplify/amplify-cli-core', () => ({
|
|
66
70
|
stateManager: {
|
|
67
71
|
getProjectConfig: jest.fn().mockReturnValue({
|
|
68
72
|
providers: [],
|
|
@@ -78,7 +82,7 @@ describe('should render components', () => {
|
|
|
78
82
|
});
|
|
79
83
|
|
|
80
84
|
it('should return false if frontend is ios', async () => {
|
|
81
|
-
jest.mock('amplify-cli-core', () => ({
|
|
85
|
+
jest.mock('@aws-amplify/amplify-cli-core', () => ({
|
|
82
86
|
stateManager: {
|
|
83
87
|
getProjectConfig: jest.fn().mockReturnValue({
|
|
84
88
|
providers: [],
|
|
@@ -91,7 +95,7 @@ describe('should render components', () => {
|
|
|
91
95
|
});
|
|
92
96
|
|
|
93
97
|
it('should return false if frontend is vue', async () => {
|
|
94
|
-
jest.mock('amplify-cli-core', () => ({
|
|
98
|
+
jest.mock('@aws-amplify/amplify-cli-core', () => ({
|
|
95
99
|
stateManager: {
|
|
96
100
|
getProjectConfig: jest.fn().mockReturnValue({
|
|
97
101
|
providers: [],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable spellcheck/spell-checker */
|
|
2
|
-
import { AmplifyCategories, AmplifySupportedService, stateManager } from 'amplify-cli-core'; // eslint-disable-line import/no-extraneous-dependencies
|
|
2
|
+
import { AmplifyCategories, AmplifySupportedService, stateManager } from '@aws-amplify/amplify-cli-core'; // eslint-disable-line import/no-extraneous-dependencies
|
|
3
3
|
import aws from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies
|
|
4
4
|
import {
|
|
5
5
|
generateUiBuilderComponents,
|
|
@@ -13,8 +13,8 @@ import { AmplifyStudioClient } from '../clients';
|
|
|
13
13
|
import * as createUiBuilderComponentDependency from '../commands/utils/codegenResources';
|
|
14
14
|
import { exampleSchema } from './utils';
|
|
15
15
|
|
|
16
|
-
jest.mock('amplify-cli-core', () => ({
|
|
17
|
-
...jest.requireActual('amplify-cli-core'),
|
|
16
|
+
jest.mock('@aws-amplify/amplify-cli-core', () => ({
|
|
17
|
+
...jest.requireActual('@aws-amplify/amplify-cli-core'),
|
|
18
18
|
FeatureFlags: {
|
|
19
19
|
getBoolean: () => false,
|
|
20
20
|
getNumber: () => 0,
|
|
@@ -139,6 +139,10 @@ describe('should sync amplify ui builder components', () => {
|
|
|
139
139
|
features: {
|
|
140
140
|
autoGenerateForms: 'true',
|
|
141
141
|
autoGenerateViews: 'true',
|
|
142
|
+
formFeatureFlags: {
|
|
143
|
+
isRelationshipSupported: 'false',
|
|
144
|
+
isNonModelSupported: 'false',
|
|
145
|
+
},
|
|
142
146
|
},
|
|
143
147
|
})),
|
|
144
148
|
})),
|
|
@@ -179,6 +183,10 @@ describe('should sync amplify ui builder components', () => {
|
|
|
179
183
|
expect.objectContaining({
|
|
180
184
|
autoGenerateForms: true,
|
|
181
185
|
autoGenerateViews: true,
|
|
186
|
+
formFeatureFlags: {
|
|
187
|
+
isRelationshipSupported: false,
|
|
188
|
+
isNonModelSupported: false,
|
|
189
|
+
},
|
|
182
190
|
}),
|
|
183
191
|
);
|
|
184
192
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
2
2
|
import { run } from '../commands/version';
|
|
3
|
-
jest.mock('amplify-prompts');
|
|
3
|
+
jest.mock('@aws-amplify/amplify-prompts');
|
|
4
4
|
printer.info = jest.fn();
|
|
5
5
|
describe('can run version script', () => {
|
|
6
6
|
it('runs version script', async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $TSContext, CloudformationProviderFacade } from 'amplify-cli-core';
|
|
1
|
+
import { $TSContext, CloudformationProviderFacade } from '@aws-amplify/amplify-cli-core';
|
|
2
2
|
import type { ServiceConfigurationOptions } from 'aws-sdk/lib/service';
|
|
3
3
|
import type { CreateComponentData, Component, Theme, Form } from 'aws-sdk/clients/amplifyuibuilder';
|
|
4
4
|
import { AmplifyUIBuilder, AmplifyBackend } from 'aws-sdk';
|
|
@@ -12,6 +12,10 @@ import { getTransformerVersion } from '../commands/utils/featureFlags';
|
|
|
12
12
|
export type StudioMetadata = {
|
|
13
13
|
autoGenerateForms: boolean;
|
|
14
14
|
autoGenerateViews: boolean;
|
|
15
|
+
formFeatureFlags: {
|
|
16
|
+
isRelationshipSupported: boolean;
|
|
17
|
+
isNonModelSupported: boolean;
|
|
18
|
+
};
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
/**
|
|
@@ -107,6 +111,10 @@ export default class AmplifyStudioClient {
|
|
|
107
111
|
this.metadata = {
|
|
108
112
|
autoGenerateForms: false,
|
|
109
113
|
autoGenerateViews: false,
|
|
114
|
+
formFeatureFlags: {
|
|
115
|
+
isRelationshipSupported: false,
|
|
116
|
+
isNonModelSupported: false,
|
|
117
|
+
},
|
|
110
118
|
};
|
|
111
119
|
}
|
|
112
120
|
|
|
@@ -126,6 +134,10 @@ export default class AmplifyStudioClient {
|
|
|
126
134
|
this.metadata = {
|
|
127
135
|
autoGenerateForms: response.features?.autoGenerateForms === 'true',
|
|
128
136
|
autoGenerateViews: response.features?.autoGenerateViews === 'true',
|
|
137
|
+
formFeatureFlags: {
|
|
138
|
+
isRelationshipSupported: response.features?.isRelationshipSupported === 'true',
|
|
139
|
+
isNonModelSupported: response.features?.isNonModelSupported === 'true',
|
|
140
|
+
},
|
|
129
141
|
};
|
|
130
142
|
} catch (err) {
|
|
131
143
|
throw new Error(`Failed to load metadata: ${err.message}`);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { StudioSchema } from '@aws-amplify/codegen-ui';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
5
|
-
import { $TSContext } from 'amplify-cli-core';
|
|
5
|
+
import { $TSContext } from '@aws-amplify/amplify-cli-core';
|
|
6
6
|
import { AmplifyStudioClient } from '../clients';
|
|
7
7
|
import {
|
|
8
8
|
notifyMissingPackages,
|
|
@@ -51,6 +51,7 @@ export const run = async (context: $TSContext, eventType: 'PostPush' | 'PostPull
|
|
|
51
51
|
formSchemas.entities,
|
|
52
52
|
dataSchema,
|
|
53
53
|
studioClient.metadata.autoGenerateForms && studioClient.isGraphQLSupported,
|
|
54
|
+
studioClient.metadata.formFeatureFlags,
|
|
54
55
|
),
|
|
55
56
|
};
|
|
56
57
|
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getGenericFromDataStore,
|
|
13
13
|
StudioForm,
|
|
14
14
|
StudioSchema,
|
|
15
|
+
FormFeatureFlags,
|
|
15
16
|
} from '@aws-amplify/codegen-ui';
|
|
16
17
|
import {
|
|
17
18
|
AmplifyRenderer,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
ReactThemeStudioTemplateRendererOptions,
|
|
27
28
|
} from '@aws-amplify/codegen-ui-react';
|
|
28
29
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
29
|
-
import { $TSContext } from 'amplify-cli-core';
|
|
30
|
+
import { $TSContext } from '@aws-amplify/amplify-cli-core';
|
|
30
31
|
import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
|
|
31
32
|
import { ModelIntrospectionSchema } from '@aws-amplify/appsync-modelgen-plugin';
|
|
32
33
|
|
|
@@ -95,11 +96,16 @@ export const createUiBuilderTheme = (
|
|
|
95
96
|
/**
|
|
96
97
|
* Writes form file to the work space
|
|
97
98
|
*/
|
|
98
|
-
export const createUiBuilderForm = (
|
|
99
|
+
export const createUiBuilderForm = (
|
|
100
|
+
context: $TSContext,
|
|
101
|
+
schema: StudioForm,
|
|
102
|
+
dataSchema?: GenericDataSchema,
|
|
103
|
+
formFeatureFlags?: FormFeatureFlags,
|
|
104
|
+
): StudioForm => {
|
|
99
105
|
const uiBuilderComponentsPath = getUiBuilderComponentsPath(context);
|
|
100
106
|
const rendererFactory = new StudioTemplateRendererFactory(
|
|
101
107
|
(form: StudioForm) =>
|
|
102
|
-
new AmplifyFormRenderer(form, dataSchema, config) as unknown as StudioTemplateRenderer<
|
|
108
|
+
new AmplifyFormRenderer(form, dataSchema, config, formFeatureFlags) as unknown as StudioTemplateRenderer<
|
|
103
109
|
unknown,
|
|
104
110
|
StudioForm,
|
|
105
111
|
FrameworkOutputManager<unknown>,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable spellcheck/spell-checker */
|
|
2
|
-
import { FeatureFlags, pathManager, stateManager } from 'amplify-cli-core';
|
|
2
|
+
import { FeatureFlags, pathManager, stateManager } from '@aws-amplify/amplify-cli-core';
|
|
3
3
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
4
4
|
|
|
5
5
|
// This is copy-pasta from the category api until they can expose the method to plugins
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pathManager, JSONUtilities, $TSContext, $TSAny } from 'amplify-cli-core';
|
|
1
|
+
import { pathManager, JSONUtilities, $TSContext, $TSAny } from '@aws-amplify/amplify-cli-core';
|
|
2
2
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import path from 'path';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable prefer-arrow/prefer-arrow-functions */
|
|
2
|
-
import { $TSContext, stateManager } from 'amplify-cli-core';
|
|
2
|
+
import { $TSContext, stateManager } from '@aws-amplify/amplify-cli-core';
|
|
3
3
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
4
4
|
import { AmplifyStudioClient } from '../../clients';
|
|
5
5
|
import { getAppId } from './environmentHelpers';
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
2
|
-
import { $TSContext } from 'amplify-cli-core';
|
|
3
|
-
import {
|
|
2
|
+
import { $TSContext } from '@aws-amplify/amplify-cli-core';
|
|
3
|
+
import {
|
|
4
|
+
StudioComponent,
|
|
5
|
+
StudioTheme,
|
|
6
|
+
GenericDataSchema,
|
|
7
|
+
StudioForm,
|
|
8
|
+
StudioSchema,
|
|
9
|
+
checkIsSupportedAsForm,
|
|
10
|
+
FormFeatureFlags,
|
|
11
|
+
} from '@aws-amplify/codegen-ui';
|
|
4
12
|
import { createUiBuilderComponent, createUiBuilderForm, createUiBuilderTheme, generateBaseForms } from './codegenResources';
|
|
5
13
|
import { getUiBuilderComponentsPath } from './getUiBuilderComponentsPath';
|
|
6
14
|
|
|
@@ -95,18 +103,19 @@ export const generateUiBuilderForms = (
|
|
|
95
103
|
formSchemas: any[],
|
|
96
104
|
dataSchema?: GenericDataSchema,
|
|
97
105
|
autoGenerateForms?: boolean,
|
|
106
|
+
formFeatureFlags?: FormFeatureFlags,
|
|
98
107
|
): CodegenResponse<StudioForm>[] => {
|
|
99
108
|
const modelMap: { [model: string]: Set<'create' | 'update'> } = {};
|
|
100
109
|
if (dataSchema?.dataSourceType === 'DataStore' && autoGenerateForms) {
|
|
101
110
|
Object.entries(dataSchema.models).forEach(([name, model]) => {
|
|
102
|
-
if (checkIsSupportedAsForm(model) && !model.isJoinTable) {
|
|
111
|
+
if (checkIsSupportedAsForm(model, formFeatureFlags) && !model.isJoinTable) {
|
|
103
112
|
modelMap[name] = new Set(['create', 'update']);
|
|
104
113
|
}
|
|
105
114
|
});
|
|
106
115
|
}
|
|
107
116
|
const codegenForm = (schema: StudioForm): CodegenResponse<StudioForm> => {
|
|
108
117
|
try {
|
|
109
|
-
const form = createUiBuilderForm(context, schema, dataSchema);
|
|
118
|
+
const form = createUiBuilderForm(context, schema, dataSchema, formFeatureFlags);
|
|
110
119
|
return { resultType: 'SUCCESS', schema: form };
|
|
111
120
|
} catch (e) {
|
|
112
121
|
printer.debug(`Failure caught processing ${schema.name}`);
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $TSContext } from 'amplify-cli-core';
|
|
1
|
+
import { $TSContext } from '@aws-amplify/amplify-cli-core';
|
|
2
2
|
import { printer } from '@aws-amplify/amplify-prompts';
|
|
3
3
|
import AmplifyUIBuilder from 'aws-sdk/clients/amplifyuibuilder';
|
|
4
4
|
import { AmplifyStudioClient } from '../clients';
|