@aws-amplify/amplify-util-uibuilder 1.6.8-beta.1 → 1.6.8-beta.2

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/amplify-plugin.json +2 -11
  3. package/lib/clients/amplify-studio-client.d.ts.map +1 -1
  4. package/lib/clients/amplify-studio-client.js +1 -3
  5. package/lib/clients/amplify-studio-client.js.map +1 -1
  6. package/lib/commands/cloneComponentsFromEnv.d.ts.map +1 -1
  7. package/lib/commands/cloneComponentsFromEnv.js +2 -1
  8. package/lib/commands/cloneComponentsFromEnv.js.map +1 -1
  9. package/lib/commands/generateComponents.js +9 -9
  10. package/lib/commands/generateComponents.js.map +1 -1
  11. package/lib/commands/utils/codegenResources.d.ts.map +1 -1
  12. package/lib/commands/utils/codegenResources.js +2 -2
  13. package/lib/commands/utils/codegenResources.js.map +1 -1
  14. package/lib/commands/utils/detachedFormCleanup.d.ts.map +1 -1
  15. package/lib/commands/utils/detachedFormCleanup.js +1 -2
  16. package/lib/commands/utils/detachedFormCleanup.js.map +1 -1
  17. package/lib/commands/utils/featureFlags.d.ts.map +1 -1
  18. package/lib/commands/utils/featureFlags.js.map +1 -1
  19. package/lib/commands/utils/notifyMissingPackages.d.ts.map +1 -1
  20. package/lib/commands/utils/notifyMissingPackages.js.map +1 -1
  21. package/lib/commands/utils/syncAmplifyUiBuilderComponents.d.ts.map +1 -1
  22. package/lib/commands/utils/syncAmplifyUiBuilderComponents.js +9 -6
  23. package/lib/commands/utils/syncAmplifyUiBuilderComponents.js.map +1 -1
  24. package/lib/utils/prePushHandler.d.ts.map +1 -1
  25. package/lib/utils/prePushHandler.js +2 -5
  26. package/lib/utils/prePushHandler.js.map +1 -1
  27. package/package.json +4 -4
  28. package/src/__tests__/createUiBuilderComponent.test.ts +4 -2
  29. package/src/__tests__/detachedFormCleanup.test.ts +3 -6
  30. package/src/__tests__/generateComponents.test.ts +1 -1
  31. package/src/__tests__/getAmplifyDataSchema.test.ts +2 -1
  32. package/src/__tests__/package.json +2 -2
  33. package/src/__tests__/prePushHandler.test.ts +3 -1
  34. package/src/__tests__/shouldRenderComponents.test.ts +8 -8
  35. package/src/__tests__/syncAmplifyUiComponents.test.ts +54 -53
  36. package/src/__tests__/utils.ts +2 -3
  37. package/src/clients/amplify-studio-client.ts +4 -8
  38. package/src/commands/cloneComponentsFromEnv.ts +4 -6
  39. package/src/commands/generateComponents.ts +11 -11
  40. package/src/commands/utils/codegenResources.ts +14 -15
  41. package/src/commands/utils/detachedFormCleanup.ts +6 -6
  42. package/src/commands/utils/featureFlags.ts +3 -4
  43. package/src/commands/utils/notifyMissingPackages.ts +1 -3
  44. package/src/commands/utils/syncAmplifyUiBuilderComponents.ts +12 -18
  45. package/src/utils/prePushHandler.ts +15 -15
  46. 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<[Promise<{
21
- entities: AmplifyUIBuilder.Form[];
22
- }>, Promise<Schema>]>([
23
- studioClient.listForms(),
24
- context.amplify.invokePluginMethod(
25
- context,
26
- 'codegen',
27
- undefined,
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(`The following form${detachedCustomForms.length === 1 ? '' : 's'} will no longer be available because the connected data model no longer exists: ${detachedCustomForms.join(', ')}`);
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
  };