@wise/dynamic-flow-client 3.11.2 → 3.11.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/build/main.js CHANGED
@@ -7495,12 +7495,7 @@ var mergeChildrenValues = (displayOrder, getComponentValue) => displayOrder.redu
7495
7495
  var objectSchemaToComponent = (schemaMapperProps, mapperProps) => {
7496
7496
  const { uid, localValue, schema, model, validationErrors } = schemaMapperProps;
7497
7497
  const { $id, displayOrder, properties, required } = schema;
7498
- const propertyNames = Object.keys(properties);
7499
- if (displayOrder.length !== propertyNames.length) {
7500
- throw new Error(
7501
- `Object schema ${$id} has ${propertyNames.length} properties but only ${displayOrder.length} are listed in displayOrder`
7502
- );
7503
- }
7498
+ validateDisplayOrder($id, displayOrder, properties, mapperProps.logEvent);
7504
7499
  const componentMap = displayOrder.reduce((acc, propName) => {
7505
7500
  var _a;
7506
7501
  const propSchema = properties[propName];
@@ -7526,6 +7521,28 @@ var objectSchemaToComponent = (schemaMapperProps, mapperProps) => {
7526
7521
  displayOrder
7527
7522
  }));
7528
7523
  };
7524
+ var validateDisplayOrder = ($id, displayOrder, properties, logEvent) => {
7525
+ if (!displayOrder) {
7526
+ const message = `Object schema ${$id} has no displayOrder property.`;
7527
+ logEvent("error", message);
7528
+ throw new Error(message);
7529
+ }
7530
+ const propertyNames = Object.keys(properties);
7531
+ displayOrder.forEach((propName) => {
7532
+ if (!properties[propName]) {
7533
+ const message = `Object schema ${$id} has no property named "${propName}", but it is listed in the displayOrder array.`;
7534
+ logEvent("error", message);
7535
+ throw new Error(message);
7536
+ }
7537
+ });
7538
+ propertyNames.forEach((propName) => {
7539
+ if (!displayOrder.includes(propName)) {
7540
+ const message = `Object schema ${$id} has a "${propName}" property which is missing in the displayOrder array.`;
7541
+ logEvent("error", message);
7542
+ throw new Error(message);
7543
+ }
7544
+ });
7545
+ };
7529
7546
 
7530
7547
  // src/revamp/domain/components/AllOfComponent.ts
7531
7548
  var createAllOfComponent = (allOfProps) => {