@aws-amplify/amplify-util-uibuilder 1.6.8-beta.1 → 1.6.8-beta.3
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 +22 -0
- package/amplify-plugin.json +2 -11
- package/lib/clients/amplify-studio-client.d.ts.map +1 -1
- package/lib/clients/amplify-studio-client.js +1 -3
- package/lib/clients/amplify-studio-client.js.map +1 -1
- package/lib/commands/cloneComponentsFromEnv.d.ts.map +1 -1
- package/lib/commands/cloneComponentsFromEnv.js +2 -1
- package/lib/commands/cloneComponentsFromEnv.js.map +1 -1
- package/lib/commands/generateComponents.js +9 -9
- package/lib/commands/generateComponents.js.map +1 -1
- 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/detachedFormCleanup.d.ts.map +1 -1
- package/lib/commands/utils/detachedFormCleanup.js +1 -2
- package/lib/commands/utils/detachedFormCleanup.js.map +1 -1
- package/lib/commands/utils/featureFlags.d.ts.map +1 -1
- package/lib/commands/utils/featureFlags.js.map +1 -1
- package/lib/commands/utils/notifyMissingPackages.d.ts.map +1 -1
- package/lib/commands/utils/notifyMissingPackages.js.map +1 -1
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts.map +1 -1
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.js +9 -6
- package/lib/commands/utils/syncAmplifyUiBuilderComponents.js.map +1 -1
- package/lib/utils/prePushHandler.d.ts.map +1 -1
- package/lib/utils/prePushHandler.js +2 -5
- package/lib/utils/prePushHandler.js.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/createUiBuilderComponent.test.ts +4 -2
- package/src/__tests__/detachedFormCleanup.test.ts +3 -6
- package/src/__tests__/generateComponents.test.ts +1 -1
- package/src/__tests__/getAmplifyDataSchema.test.ts +2 -1
- package/src/__tests__/package.json +2 -2
- package/src/__tests__/prePushHandler.test.ts +3 -1
- package/src/__tests__/shouldRenderComponents.test.ts +8 -8
- package/src/__tests__/syncAmplifyUiComponents.test.ts +54 -53
- package/src/__tests__/utils.ts +2 -3
- package/src/clients/amplify-studio-client.ts +4 -8
- package/src/commands/cloneComponentsFromEnv.ts +4 -6
- package/src/commands/generateComponents.ts +11 -11
- package/src/commands/utils/codegenResources.ts +14 -15
- package/src/commands/utils/detachedFormCleanup.ts +6 -6
- package/src/commands/utils/featureFlags.ts +3 -4
- package/src/commands/utils/notifyMissingPackages.ts +1 -3
- package/src/commands/utils/syncAmplifyUiBuilderComponents.ts +12 -18
- package/src/utils/prePushHandler.ts +15 -15
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,7 +6,7 @@ import { isFormDetachedFromModel, isFormSchemaCustomized, shouldRenderComponents
|
|
|
6
6
|
|
|
7
7
|
// TODO: replace this type when amplify-codegen package export official types
|
|
8
8
|
type Schema = {
|
|
9
|
-
models: Record<string, unknown
|
|
9
|
+
models: Record<string, unknown>;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -17,18 +17,14 @@ export const prePushHandler = async (context: $TSContext): Promise<void> => {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const studioClient = await AmplifyStudioClient.setClientInfo(context);
|
|
20
|
-
const [formSchemas, localSchema] = await Promise.all<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'getModelIntrospection',
|
|
29
|
-
[context],
|
|
30
|
-
),
|
|
31
|
-
]);
|
|
20
|
+
const [formSchemas, localSchema] = await Promise.all<
|
|
21
|
+
[
|
|
22
|
+
Promise<{
|
|
23
|
+
entities: AmplifyUIBuilder.Form[];
|
|
24
|
+
}>,
|
|
25
|
+
Promise<Schema>,
|
|
26
|
+
]
|
|
27
|
+
>([studioClient.listForms(), context.amplify.invokePluginMethod(context, 'codegen', undefined, 'getModelIntrospection', [context])]);
|
|
32
28
|
|
|
33
29
|
if (!localSchema) {
|
|
34
30
|
printer.debug('Local schema not found');
|
|
@@ -41,7 +37,7 @@ const printDetachedFormsWarning = (formSchemas: { entities: AmplifyUIBuilder.For
|
|
|
41
37
|
const modelNames = new Set(Object.keys(localSchema.models));
|
|
42
38
|
const detachedCustomForms: string[] = [];
|
|
43
39
|
|
|
44
|
-
formSchemas.entities.forEach(form => {
|
|
40
|
+
formSchemas.entities.forEach((form) => {
|
|
45
41
|
// Only show warnings for schema's that have customization, otherwise it's the same as
|
|
46
42
|
// an autogenerated form.
|
|
47
43
|
if (isFormDetachedFromModel(form, modelNames) && isFormSchemaCustomized(form)) {
|
|
@@ -50,6 +46,10 @@ const printDetachedFormsWarning = (formSchemas: { entities: AmplifyUIBuilder.For
|
|
|
50
46
|
});
|
|
51
47
|
|
|
52
48
|
if (detachedCustomForms.length > 0) {
|
|
53
|
-
printer.warn(
|
|
49
|
+
printer.warn(
|
|
50
|
+
`The following form${
|
|
51
|
+
detachedCustomForms.length === 1 ? '' : 's'
|
|
52
|
+
} will no longer be available because the connected data model no longer exists: ${detachedCustomForms.join(', ')}`,
|
|
53
|
+
);
|
|
54
54
|
}
|
|
55
55
|
};
|