@genesislcap/foundation-forms 14.452.0 → 14.452.1-FUI-2538.1

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.
@@ -1456,6 +1456,15 @@
1456
1456
  "privacy": "private",
1457
1457
  "default": "false"
1458
1458
  },
1459
+ {
1460
+ "kind": "field",
1461
+ "name": "serverErrors",
1462
+ "type": {
1463
+ "text": "ErrorObject[]"
1464
+ },
1465
+ "privacy": "private",
1466
+ "default": "[]"
1467
+ },
1459
1468
  {
1460
1469
  "kind": "field",
1461
1470
  "name": "submitted",
@@ -1603,6 +1612,75 @@
1603
1612
  "kind": "field",
1604
1613
  "name": "dispatch"
1605
1614
  },
1615
+ {
1616
+ "kind": "method",
1617
+ "name": "setServerErrors",
1618
+ "parameters": [
1619
+ {
1620
+ "name": "errors",
1621
+ "type": {
1622
+ "text": "ErrorObject[]"
1623
+ }
1624
+ }
1625
+ ],
1626
+ "description": "Applies server-side validation errors returned from an EVENT_NACK response.\nErrors are merged into `core.additionalErrors` and shown inline on fields.",
1627
+ "privacy": "public"
1628
+ },
1629
+ {
1630
+ "kind": "method",
1631
+ "name": "clearServerErrors",
1632
+ "description": "Clears all server-side validation errors from the form.",
1633
+ "privacy": "public"
1634
+ },
1635
+ {
1636
+ "kind": "method",
1637
+ "name": "buildAdditionalErrors",
1638
+ "privacy": "private",
1639
+ "return": {
1640
+ "type": {
1641
+ "text": "ErrorObject[]"
1642
+ }
1643
+ },
1644
+ "parameters": [
1645
+ {
1646
+ "name": "uischema",
1647
+ "type": {
1648
+ "text": "UISchemaElement"
1649
+ }
1650
+ },
1651
+ {
1652
+ "name": "data",
1653
+ "type": {
1654
+ "text": "any"
1655
+ }
1656
+ }
1657
+ ]
1658
+ },
1659
+ {
1660
+ "kind": "method",
1661
+ "name": "applyAdditionalErrorsToCore",
1662
+ "privacy": "private",
1663
+ "parameters": [
1664
+ {
1665
+ "name": "nextCore",
1666
+ "type": {
1667
+ "text": "JsonFormsCore"
1668
+ }
1669
+ },
1670
+ {
1671
+ "name": "changedPath",
1672
+ "optional": true,
1673
+ "type": {
1674
+ "text": "string"
1675
+ }
1676
+ }
1677
+ ]
1678
+ },
1679
+ {
1680
+ "kind": "method",
1681
+ "name": "refreshAdditionalErrors",
1682
+ "privacy": "private"
1683
+ },
1606
1684
  {
1607
1685
  "kind": "field",
1608
1686
  "name": "validate",
@@ -1939,6 +2017,14 @@
1939
2017
  "package": "./validation"
1940
2018
  }
1941
2019
  },
2020
+ {
2021
+ "kind": "js",
2022
+ "name": "*",
2023
+ "declaration": {
2024
+ "name": "*",
2025
+ "package": "./server-errors"
2026
+ }
2027
+ },
1942
2028
  {
1943
2029
  "kind": "js",
1944
2030
  "name": "*",
@@ -1961,6 +2047,58 @@
1961
2047
  "declarations": [],
1962
2048
  "exports": []
1963
2049
  },
2050
+ {
2051
+ "kind": "javascript-module",
2052
+ "path": "src/utils/server-errors.ts",
2053
+ "declarations": [
2054
+ {
2055
+ "kind": "function",
2056
+ "name": "mapGenesisFieldErrorsToAdditionalErrors",
2057
+ "return": {
2058
+ "type": {
2059
+ "text": "ErrorObject[]"
2060
+ }
2061
+ },
2062
+ "parameters": [
2063
+ {
2064
+ "name": "errors",
2065
+ "type": {
2066
+ "text": "GenesisFieldError[] | undefined"
2067
+ },
2068
+ "description": "Genesis ERROR array from an EVENT_NACK response"
2069
+ },
2070
+ {
2071
+ "name": "schema",
2072
+ "optional": true,
2073
+ "type": {
2074
+ "text": "JSONSchema7"
2075
+ },
2076
+ "description": "JSON schema used to resolve `parentSchema` for each field"
2077
+ },
2078
+ {
2079
+ "name": "instancePathPrefix",
2080
+ "optional": true,
2081
+ "type": {
2082
+ "text": "string"
2083
+ },
2084
+ "description": "Optional prefix for bulk-insert rows (e.g. `/items/0`)"
2085
+ }
2086
+ ],
2087
+ "description": "Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]`\nsuitable for `additionalErrors` on the form core.\n\nOnly entries with a `FIELD` or `PATH` are mapped; generic errors (no field\nassociation) are omitted so callers can still surface them via toast/dialog.",
2088
+ "privacy": "public"
2089
+ }
2090
+ ],
2091
+ "exports": [
2092
+ {
2093
+ "kind": "js",
2094
+ "name": "mapGenesisFieldErrorsToAdditionalErrors",
2095
+ "declaration": {
2096
+ "name": "mapGenesisFieldErrorsToAdditionalErrors",
2097
+ "module": "src/utils/server-errors.ts"
2098
+ }
2099
+ }
2100
+ ]
2101
+ },
1964
2102
  {
1965
2103
  "kind": "javascript-module",
1966
2104
  "path": "src/utils/translation.ts",
@@ -1,5 +1,6 @@
1
1
  import { FoundationElement } from '@microsoft/fast-foundation';
2
2
  import { JSONSchema7 } from 'json-schema';
3
+ import { JSONForms } from './jsonforms/json-forms';
3
4
  import { BulkRowStatus, RendererEntry, UiSchema } from './types';
4
5
  /**
5
6
  * Set of default renderers used by the foundation-forms.
@@ -442,6 +443,11 @@ export declare class Form extends Form_base {
442
443
  * @internal
443
444
  */
444
445
  csvFileInput: HTMLInputElement;
446
+ /**
447
+ * Reference to the internal json-forms element.
448
+ * @internal
449
+ */
450
+ jsonFormsElement: JSONForms;
445
451
  /**
446
452
  * Stores the approval message entered by the user.
447
453
  * @internal
@@ -664,6 +670,16 @@ export declare class Form extends Form_base {
664
670
  * @public
665
671
  */
666
672
  reset(clearData?: boolean): void;
673
+ /**
674
+ * Maps Genesis EVENT_NACK field errors onto the form via additionalErrors.
675
+ * @internal
676
+ */
677
+ private applyServerFieldErrors;
678
+ /**
679
+ * Maps field errors from failed bulk-insert rows onto the form.
680
+ * @internal
681
+ */
682
+ private applyBulkServerFieldErrors;
667
683
  /**
668
684
  * Show the approval message modal
669
685
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAyB1C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C;AAEF,gBAAgB;AAChB,eAAO,MAAM,sBAAsB,2DAElC,CAAC"}
1
+ {"version":3,"file":"form.template.d.ts","sourceRoot":"","sources":["../../src/form.template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAiBnC,gBAAgB;AAChB,eAAO,MAAM,eAAe,GAAI,WAAM,8DAkHrC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,sBAAsB,2DAElC,CAAC"}
@@ -11,6 +11,7 @@ import { BulkRowStatus } from '../types';
11
11
  */
12
12
  export declare class JSONForms extends FASTElement {
13
13
  private _submitted;
14
+ private serverErrors;
14
15
  get submitted(): boolean;
15
16
  set submitted(value: boolean);
16
17
  prefix: any;
@@ -48,6 +49,20 @@ export declare class JSONForms extends FASTElement {
48
49
  bulkInsertChanged(): void;
49
50
  get props(): RendererProps;
50
51
  dispatch: (action: UpdateAction) => void;
52
+ /**
53
+ * Applies server-side validation errors returned from an EVENT_NACK response.
54
+ * Errors are merged into `core.additionalErrors` and shown inline on fields.
55
+ * @public
56
+ */
57
+ setServerErrors(errors: ErrorObject[]): void;
58
+ /**
59
+ * Clears all server-side validation errors from the form.
60
+ * @public
61
+ */
62
+ clearServerErrors(): void;
63
+ private buildAdditionalErrors;
64
+ private applyAdditionalErrorsToCore;
65
+ private refreshAdditionalErrors;
51
66
  /**
52
67
  * Performs client-side validation by running the validator defined in the UI schema.
53
68
  * @param uischema the UI schema
@@ -1 +1 @@
1
- {"version":3,"file":"json-forms.d.ts","sourceRoot":"","sources":["../../../src/jsonforms/json-forms.ts"],"names":[],"mappings":"AACA,OAAO,EASL,8BAA8B,EAE9B,aAAa,EAGb,eAAe,EACf,YAAY,EACZ,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,WAAW,EAKZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,GAAG,EAAE,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,E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export * from './logger';
4
4
  export * from './translation';
5
5
  export * from './validation';
6
+ export * from './server-errors';
6
7
  export * from './types';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { ErrorObject } from 'ajv';
2
+ import { JSONSchema7 } from 'json-schema';
3
+ /**
4
+ * Genesis EVENT_NACK field-level error entry.
5
+ * @public
6
+ */
7
+ export type GenesisFieldError = {
8
+ '@type'?: string;
9
+ CODE?: string;
10
+ TEXT: string;
11
+ STATUS_CODE?: string;
12
+ FIELD?: string;
13
+ PATH?: string | null;
14
+ };
15
+ /**
16
+ * Converts a JsonForms/Ajv instance path to a JSON Forms scope string.
17
+ * @example `/items/0/CCY` → `#/properties/items/items/0/properties/CCY`
18
+ * @internal
19
+ */
20
+ export declare function instancePathToJsonFormsScope(instancePath: string): string;
21
+ /**
22
+ * Converts a Genesis JSON-path or FIELD name to a JsonForms instance path.
23
+ * Strips the `$.` prefix and optional `DETAILS` segment used in event payloads.
24
+ * @internal
25
+ */
26
+ export declare function genesisFieldToInstancePath(field?: string, path?: string | null, instancePathPrefix?: string): string | null;
27
+ /**
28
+ * Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]`
29
+ * suitable for `additionalErrors` on the form core.
30
+ *
31
+ * Only entries with a `FIELD` or `PATH` are mapped; generic errors (no field
32
+ * association) are omitted so callers can still surface them via toast/dialog.
33
+ *
34
+ * @param errors - Genesis ERROR array from an EVENT_NACK response
35
+ * @param schema - JSON schema used to resolve `parentSchema` for each field
36
+ * @param instancePathPrefix - Optional prefix for bulk-insert rows (e.g. `/items/0`)
37
+ * @public
38
+ */
39
+ export declare function mapGenesisFieldErrorsToAdditionalErrors(errors: GenesisFieldError[] | undefined, schema?: JSONSchema7, instancePathPrefix?: string): ErrorObject[];
40
+ //# sourceMappingURL=server-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-errors.d.ts","sourceRoot":"","sources":["../../../src/utils/server-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAkBzE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EACpB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,GAAG,IAAI,CAuBf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,iBAAiB,EAAE,GAAG,SAAS,EACvC,MAAM,CAAC,EAAE,WAAW,EACpB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,WAAW,EAAE,CAoCf"}
package/dist/esm/form.js CHANGED
@@ -29,7 +29,7 @@ import { NumberControlRendererEntry } from './jsonforms/renderers/NumberControlR
29
29
  import { SegmentedControlRendererEntry } from './jsonforms/renderers/SegmentedControlRenderer';
30
30
  import { StringArrayEntry } from './jsonforms/renderers/StringArrayControlRenderer';
31
31
  import { StringControlRendererTemplate } from './jsonforms/renderers/StringControlRenderer';
32
- import { downloadCsvTemplate as downloadCsvFile, extractFieldsFromUiSchema, generateCsvTemplate, logger, mapCsvToSchema, parseCsv, } from './utils';
32
+ import { downloadCsvTemplate as downloadCsvFile, extractFieldsFromUiSchema, generateCsvTemplate, logger, mapCsvToSchema, mapGenesisFieldErrorsToAdditionalErrors, parseCsv, } from './utils';
33
33
  import { findModalParent, showConfirmationDialog } from './utils/confirmation-dialog-utils';
34
34
  import { removeDataPropertiesNotInSchema } from './utils/form-utils';
35
35
  import { generateBulkUiSchema, isBulkUiSchema } from './utils/schema-utils';
@@ -297,6 +297,7 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
297
297
  this.showApprovalModal();
298
298
  }
299
299
  else {
300
+ this.applyServerFieldErrors(formSubmitReq.ERROR);
300
301
  this.$emit('submit-failure', { payload, errors: formSubmitReq.ERROR });
301
302
  }
302
303
  }
@@ -313,7 +314,7 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
313
314
  */
314
315
  _submitBulk() {
315
316
  return __awaiter(this, void 0, void 0, function* () {
316
- var _a;
317
+ var _a, _b;
317
318
  const items = ((_a = this.data) === null || _a === void 0 ? void 0 : _a.items) || [];
318
319
  // Validate minimum items
319
320
  if (items.length < this.bulkInsertMinItems) {
@@ -390,15 +391,18 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
390
391
  this.$emit('bulk-submit-complete', results);
391
392
  // Also emit standard events based on overall result
392
393
  if (results.failed.length === 0) {
394
+ (_b = this.jsonFormsElement) === null || _b === void 0 ? void 0 : _b.clearServerErrors();
393
395
  this.$emit('submit-success', { payload: this.data, results });
394
396
  }
395
397
  else if (results.successful.length === 0) {
398
+ this.applyBulkServerFieldErrors(results.failed);
396
399
  this.$emit('submit-failure', {
397
400
  payload: this.data,
398
401
  errors: results.failed.flatMap((f) => f.errors),
399
402
  });
400
403
  }
401
404
  else {
405
+ this.applyBulkServerFieldErrors(results.failed);
402
406
  // Partial success - emit both events
403
407
  this.$emit('submit-partial-success', { payload: this.data, results });
404
408
  }
@@ -461,6 +465,7 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
461
465
  const response = yield this.connect.commitEvent(this.resourceName, commitPayload);
462
466
  if (response.ERROR) {
463
467
  this.updateRowStatus(index, { status: 'failed', errors: response.ERROR });
468
+ this.applyServerFieldErrors(response.ERROR, `/items/${index}`);
464
469
  this.$emit('row-submit-failure', { index, item, errors: response.ERROR });
465
470
  }
466
471
  else {
@@ -583,13 +588,43 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
583
588
  * @public
584
589
  */
585
590
  reset(clearData = true) {
591
+ var _a;
586
592
  this.submitted = false;
587
593
  this.clearRowSubmitStatuses();
594
+ (_a = this.jsonFormsElement) === null || _a === void 0 ? void 0 : _a.clearServerErrors();
588
595
  if (clearData) {
589
596
  this.data = {};
590
597
  }
591
598
  Observable.notify(this, 'submitted');
592
599
  }
600
+ /**
601
+ * Maps Genesis EVENT_NACK field errors onto the form via additionalErrors.
602
+ * @internal
603
+ */
604
+ applyServerFieldErrors(errors, instancePathPrefix) {
605
+ var _a, _b;
606
+ const additionalErrors = mapGenesisFieldErrorsToAdditionalErrors(errors, this.jsonSchema, instancePathPrefix);
607
+ if (additionalErrors.length) {
608
+ (_a = this.jsonFormsElement) === null || _a === void 0 ? void 0 : _a.setServerErrors(additionalErrors);
609
+ }
610
+ else {
611
+ (_b = this.jsonFormsElement) === null || _b === void 0 ? void 0 : _b.clearServerErrors();
612
+ }
613
+ }
614
+ /**
615
+ * Maps field errors from failed bulk-insert rows onto the form.
616
+ * @internal
617
+ */
618
+ applyBulkServerFieldErrors(failed) {
619
+ var _a, _b;
620
+ const additionalErrors = failed.flatMap(({ index, errors }) => mapGenesisFieldErrorsToAdditionalErrors(errors, this.jsonSchema, `/items/${index}`));
621
+ if (additionalErrors.length) {
622
+ (_a = this.jsonFormsElement) === null || _a === void 0 ? void 0 : _a.setServerErrors(additionalErrors);
623
+ }
624
+ else {
625
+ (_b = this.jsonFormsElement) === null || _b === void 0 ? void 0 : _b.clearServerErrors();
626
+ }
627
+ }
593
628
  /**
594
629
  * Show the approval message modal
595
630
  * @internal
@@ -634,6 +669,7 @@ let Form = class Form extends LifecycleMixin(FoundationElement) {
634
669
  const formSubmitReq = yield this.connect.commitEvent(this.resourceName, commitPayload);
635
670
  this.submitting = false;
636
671
  if (formSubmitReq.ERROR) {
672
+ this.applyServerFieldErrors(formSubmitReq.ERROR);
637
673
  this.$emit('submit-failure', { payload: this.pendingPayload, errors: formSubmitReq.ERROR });
638
674
  }
639
675
  else {
@@ -40,6 +40,7 @@ export const getPrefixedForm = (prefix) => html `
40
40
  </div>
41
41
  `)}
42
42
  <json-forms
43
+ ${ref('jsonFormsElement')}
43
44
  @submit-button-clicked=${(x) => x._submit()}
44
45
  @submit-part=${(x, c) => x.submitPart(c.event)}
45
46
  @submit-single-row=${(x, c) => x.submitSingleRow(c.event.detail.index)}
@@ -37,6 +37,7 @@ let JSONForms = class JSONForms extends FASTElement {
37
37
  constructor() {
38
38
  super(...arguments);
39
39
  this._submitted = false;
40
+ this.serverErrors = [];
40
41
  this.ajv = createAjv({ useDefaults: true, $data: true });
41
42
  /**
42
43
  * Row submit statuses for bulk insert mode.
@@ -54,16 +55,13 @@ let JSONForms = class JSONForms extends FASTElement {
54
55
  // the fresh errors. Without this, the value baked in by `Actions.init`
55
56
  // sticks forever even when validators would now return [].
56
57
  const nextCore = coreReducer(this.jsonforms.core, action);
57
- // Validate against the post-action data, not `this.jsonforms.core.data`
58
- // (which is still the pre-action snapshot at this point).
59
- const additionalErrors = this.validate(this.uichemaToUse, nextCore.data);
60
- this.jsonforms = Object.assign(Object.assign({}, this.jsonforms), { core: Object.assign(Object.assign({}, nextCore), { additionalErrors }) });
61
- this.$emit('data-change', {
62
- data: this.jsonforms.core.data,
63
- errors: this.jsonforms.core.errors,
64
- additionalErrors,
65
- path: action.path,
66
- });
58
+ if (action.path) {
59
+ const editedPath = action.path.startsWith('/')
60
+ ? action.path
61
+ : `/${action.path.replace(/\./g, '/')}`;
62
+ this.serverErrors = this.serverErrors.filter((e) => e.instancePath !== editedPath);
63
+ }
64
+ this.applyAdditionalErrorsToCore(nextCore, action.path);
67
65
  };
68
66
  /**
69
67
  * Performs client-side validation by running the validator defined in the UI schema.
@@ -139,6 +137,7 @@ let JSONForms = class JSONForms extends FASTElement {
139
137
  if (!this.schema) {
140
138
  return;
141
139
  }
140
+ this.serverErrors = [];
142
141
  this.uichemaToUse = (_a = this.uischema) !== null && _a !== void 0 ? _a : Generate.uiSchema(this.schema);
143
142
  if (!this.uischema) {
144
143
  logger.debug('UI schema not provided. Auto generated schema:', this.uichemaToUse);
@@ -152,7 +151,7 @@ let JSONForms = class JSONForms extends FASTElement {
152
151
  const core = coreReducer(initialCore, Actions.init(this.data, this.schema, this.uichemaToUse, {
153
152
  validationMode: this.validationMode || 'ValidateAndShow',
154
153
  ajv: this.ajv,
155
- additionalErrors: this.validate(this.uichemaToUse, this.data),
154
+ additionalErrors: this.buildAdditionalErrors(this.uichemaToUse, this.data),
156
155
  }));
157
156
  return core;
158
157
  };
@@ -166,7 +165,7 @@ let JSONForms = class JSONForms extends FASTElement {
166
165
  rowSubmitStatuses: this.rowSubmitStatuses,
167
166
  bulkInsert: this.bulkInsert,
168
167
  };
169
- const additionalErrors = this.validate(this.uichemaToUse, this.data);
168
+ const additionalErrors = this.buildAdditionalErrors(this.uichemaToUse, this.data);
170
169
  // Only notify consumers when `init` actually changed `core.data` (e.g. defaults
171
170
  // were filled in). A bare uischema/schema swap must not re-emit `this.data` —
172
171
  // when `<foundation-form>` mirrors the echo into its own `data` property it
@@ -202,13 +201,7 @@ let JSONForms = class JSONForms extends FASTElement {
202
201
  const nextCore = coreReducer(this.jsonforms.core, Actions.updateCore(this.data, this.schema, this.uichemaToUse));
203
202
  // Validate against the freshly-reduced data, not the still-assigned
204
203
  // `this.jsonforms.core.data` (which is the pre-action snapshot).
205
- const additionalErrors = this.validate(this.uichemaToUse, nextCore.data);
206
- this.jsonforms = Object.assign(Object.assign({}, this.jsonforms), { core: Object.assign(Object.assign({}, nextCore), { additionalErrors }) });
207
- this.$emit('data-change', {
208
- data: this.jsonforms.core.data,
209
- errors: this.jsonforms.core.errors,
210
- additionalErrors,
211
- });
204
+ this.applyAdditionalErrorsToCore(nextCore);
212
205
  }
213
206
  renderersChanged() {
214
207
  this.schemaChanged();
@@ -257,6 +250,43 @@ let JSONForms = class JSONForms extends FASTElement {
257
250
  visible: true,
258
251
  };
259
252
  }
253
+ /**
254
+ * Applies server-side validation errors returned from an EVENT_NACK response.
255
+ * Errors are merged into `core.additionalErrors` and shown inline on fields.
256
+ * @public
257
+ */
258
+ setServerErrors(errors) {
259
+ this.serverErrors = errors !== null && errors !== void 0 ? errors : [];
260
+ this.refreshAdditionalErrors();
261
+ }
262
+ /**
263
+ * Clears all server-side validation errors from the form.
264
+ * @public
265
+ */
266
+ clearServerErrors() {
267
+ this.serverErrors = [];
268
+ this.refreshAdditionalErrors();
269
+ }
270
+ buildAdditionalErrors(uischema, data) {
271
+ return [...this.validate(uischema, data), ...this.serverErrors];
272
+ }
273
+ applyAdditionalErrorsToCore(nextCore, changedPath) {
274
+ const additionalErrors = this.buildAdditionalErrors(this.uichemaToUse, nextCore.data);
275
+ this.jsonforms = Object.assign(Object.assign({}, this.jsonforms), { core: Object.assign(Object.assign({}, nextCore), { additionalErrors }) });
276
+ this.$emit('data-change', {
277
+ data: this.jsonforms.core.data,
278
+ errors: this.jsonforms.core.errors,
279
+ additionalErrors,
280
+ path: changedPath,
281
+ });
282
+ }
283
+ refreshAdditionalErrors() {
284
+ var _a;
285
+ if (!((_a = this.jsonforms) === null || _a === void 0 ? void 0 : _a.core) || !this.uichemaToUse) {
286
+ return;
287
+ }
288
+ this.applyAdditionalErrorsToCore(this.jsonforms.core);
289
+ }
260
290
  copyUISchemaToClipboard() {
261
291
  return __awaiter(this, void 0, void 0, function* () {
262
292
  try {
@@ -3,4 +3,5 @@ export * from './filters';
3
3
  export * from './logger';
4
4
  export * from './translation';
5
5
  export * from './validation';
6
+ export * from './server-errors';
6
7
  export * from './types';
@@ -0,0 +1,98 @@
1
+ import { Resolve } from '@jsonforms/core';
2
+ /**
3
+ * Converts a JsonForms/Ajv instance path to a JSON Forms scope string.
4
+ * @example `/items/0/CCY` → `#/properties/items/items/0/properties/CCY`
5
+ * @internal
6
+ */
7
+ export function instancePathToJsonFormsScope(instancePath) {
8
+ const segments = instancePath.replace(/^\//, '').split('/').filter(Boolean);
9
+ if (segments.length === 0) {
10
+ return '#';
11
+ }
12
+ let scope = '#';
13
+ for (let i = 0; i < segments.length; i += 1) {
14
+ const segment = segments[i];
15
+ if (i === 0) {
16
+ scope += `/properties/${segment}`;
17
+ }
18
+ else if (/^\d+$/.test(segment)) {
19
+ scope += `/items/${segment}`;
20
+ }
21
+ else {
22
+ scope += `/properties/${segment}`;
23
+ }
24
+ }
25
+ return scope;
26
+ }
27
+ /**
28
+ * Converts a Genesis JSON-path or FIELD name to a JsonForms instance path.
29
+ * Strips the `$.` prefix and optional `DETAILS` segment used in event payloads.
30
+ * @internal
31
+ */
32
+ export function genesisFieldToInstancePath(field, path, instancePathPrefix) {
33
+ let relativePath = null;
34
+ if (path) {
35
+ let normalized = path.replace(/^\$\.?/, '').replace(/\./g, '/');
36
+ normalized = normalized.replace(/^DETAILS\//, '');
37
+ relativePath = normalized.startsWith('/') ? normalized : `/${normalized}`;
38
+ }
39
+ else if (field) {
40
+ relativePath = field.startsWith('/') ? field : `/${field}`;
41
+ }
42
+ if (!relativePath) {
43
+ return null;
44
+ }
45
+ if (instancePathPrefix) {
46
+ const prefix = instancePathPrefix.startsWith('/')
47
+ ? instancePathPrefix.replace(/\/$/, '')
48
+ : `/${instancePathPrefix.replace(/\/$/, '')}`;
49
+ return `${prefix}${relativePath}`;
50
+ }
51
+ return relativePath;
52
+ }
53
+ /**
54
+ * Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]`
55
+ * suitable for `additionalErrors` on the form core.
56
+ *
57
+ * Only entries with a `FIELD` or `PATH` are mapped; generic errors (no field
58
+ * association) are omitted so callers can still surface them via toast/dialog.
59
+ *
60
+ * @param errors - Genesis ERROR array from an EVENT_NACK response
61
+ * @param schema - JSON schema used to resolve `parentSchema` for each field
62
+ * @param instancePathPrefix - Optional prefix for bulk-insert rows (e.g. `/items/0`)
63
+ * @public
64
+ */
65
+ export function mapGenesisFieldErrorsToAdditionalErrors(errors, schema, instancePathPrefix) {
66
+ if (!(errors === null || errors === void 0 ? void 0 : errors.length)) {
67
+ return [];
68
+ }
69
+ return errors
70
+ .map((entry) => {
71
+ const instancePath = genesisFieldToInstancePath(entry.FIELD, entry.PATH, instancePathPrefix);
72
+ if (!instancePath) {
73
+ return null;
74
+ }
75
+ const error = {
76
+ keyword: 'serverValidation',
77
+ message: entry.TEXT,
78
+ instancePath,
79
+ schemaPath: '',
80
+ params: { code: entry.CODE },
81
+ };
82
+ if (schema) {
83
+ try {
84
+ const scope = instancePathToJsonFormsScope(instancePath);
85
+ const jsonFormsSchema = schema;
86
+ const fieldSchema = Resolve.schema(jsonFormsSchema, scope, jsonFormsSchema);
87
+ if (fieldSchema) {
88
+ error.parentSchema = fieldSchema;
89
+ }
90
+ }
91
+ catch (_a) {
92
+ // parentSchema is best-effort; errors still render without it
93
+ }
94
+ }
95
+ return error;
96
+ })
97
+ .filter((e) => e !== null);
98
+ }
@@ -2736,6 +2736,32 @@
2736
2736
  ],
2737
2737
  "name": "generateCsvTemplate"
2738
2738
  },
2739
+ {
2740
+ "kind": "TypeAlias",
2741
+ "canonicalReference": "@genesislcap/foundation-forms!GenesisFieldError:type",
2742
+ "docComment": "/**\n * Genesis EVENT_NACK field-level error entry.\n *\n * @public\n */\n",
2743
+ "excerptTokens": [
2744
+ {
2745
+ "kind": "Content",
2746
+ "text": "export type GenesisFieldError = "
2747
+ },
2748
+ {
2749
+ "kind": "Content",
2750
+ "text": "{\n '@type'?: string;\n CODE?: string;\n TEXT: string;\n STATUS_CODE?: string;\n FIELD?: string;\n PATH?: string | null;\n}"
2751
+ },
2752
+ {
2753
+ "kind": "Content",
2754
+ "text": ";"
2755
+ }
2756
+ ],
2757
+ "fileUrlPath": "src/utils/server-errors.ts",
2758
+ "releaseTag": "Public",
2759
+ "name": "GenesisFieldError",
2760
+ "typeTokenRange": {
2761
+ "startIndex": 1,
2762
+ "endIndex": 2
2763
+ }
2764
+ },
2739
2765
  {
2740
2766
  "kind": "Function",
2741
2767
  "canonicalReference": "@genesislcap/foundation-forms!getAnyOfErrorMessage:function(1)",
@@ -3309,6 +3335,94 @@
3309
3335
  ],
3310
3336
  "name": "mapCsvToSchema"
3311
3337
  },
3338
+ {
3339
+ "kind": "Function",
3340
+ "canonicalReference": "@genesislcap/foundation-forms!mapGenesisFieldErrorsToAdditionalErrors:function(1)",
3341
+ "docComment": "/**\n * Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]` suitable for `additionalErrors` on the form core.\n *\n * Only entries with a `FIELD` or `PATH` are mapped; generic errors (no field association) are omitted so callers can still surface them via toast/dialog.\n *\n * @param errors - Genesis ERROR array from an EVENT_NACK response\n *\n * @param schema - JSON schema used to resolve `parentSchema` for each field\n *\n * @param instancePathPrefix - Optional prefix for bulk-insert rows (e.g. `/items/0`)\n *\n * @public\n */\n",
3342
+ "excerptTokens": [
3343
+ {
3344
+ "kind": "Content",
3345
+ "text": "export declare function mapGenesisFieldErrorsToAdditionalErrors(errors: "
3346
+ },
3347
+ {
3348
+ "kind": "Reference",
3349
+ "text": "GenesisFieldError",
3350
+ "canonicalReference": "@genesislcap/foundation-forms!GenesisFieldError:type"
3351
+ },
3352
+ {
3353
+ "kind": "Content",
3354
+ "text": "[] | undefined"
3355
+ },
3356
+ {
3357
+ "kind": "Content",
3358
+ "text": ", schema?: "
3359
+ },
3360
+ {
3361
+ "kind": "Reference",
3362
+ "text": "JSONSchema7",
3363
+ "canonicalReference": "@types/json-schema!JSONSchema7:interface"
3364
+ },
3365
+ {
3366
+ "kind": "Content",
3367
+ "text": ", instancePathPrefix?: "
3368
+ },
3369
+ {
3370
+ "kind": "Content",
3371
+ "text": "string"
3372
+ },
3373
+ {
3374
+ "kind": "Content",
3375
+ "text": "): "
3376
+ },
3377
+ {
3378
+ "kind": "Reference",
3379
+ "text": "ErrorObject",
3380
+ "canonicalReference": "ajv!ErrorObject:interface"
3381
+ },
3382
+ {
3383
+ "kind": "Content",
3384
+ "text": "[]"
3385
+ },
3386
+ {
3387
+ "kind": "Content",
3388
+ "text": ";"
3389
+ }
3390
+ ],
3391
+ "fileUrlPath": "src/utils/server-errors.ts",
3392
+ "returnTypeTokenRange": {
3393
+ "startIndex": 8,
3394
+ "endIndex": 10
3395
+ },
3396
+ "releaseTag": "Public",
3397
+ "overloadIndex": 1,
3398
+ "parameters": [
3399
+ {
3400
+ "parameterName": "errors",
3401
+ "parameterTypeTokenRange": {
3402
+ "startIndex": 1,
3403
+ "endIndex": 3
3404
+ },
3405
+ "isOptional": false
3406
+ },
3407
+ {
3408
+ "parameterName": "schema",
3409
+ "parameterTypeTokenRange": {
3410
+ "startIndex": 4,
3411
+ "endIndex": 5
3412
+ },
3413
+ "isOptional": true
3414
+ },
3415
+ {
3416
+ "parameterName": "instancePathPrefix",
3417
+ "parameterTypeTokenRange": {
3418
+ "startIndex": 6,
3419
+ "endIndex": 7
3420
+ },
3421
+ "isOptional": true
3422
+ }
3423
+ ],
3424
+ "name": "mapGenesisFieldErrorsToAdditionalErrors"
3425
+ },
3312
3426
  {
3313
3427
  "kind": "Variable",
3314
3428
  "canonicalReference": "@genesislcap/foundation-forms!MulticolumnDropdownControlRendererEntry:var",
@@ -1,3 +1,4 @@
1
+ import Ajv from 'ajv';
1
2
  import { Controller } from '@microsoft/fast-element';
2
3
  import { DatasourceOptions } from '@genesislcap/foundation-comms';
3
4
  import { DOMContainer } from '@genesislcap/foundation-utils';
@@ -9,6 +10,7 @@ import { FASTElement } from '@microsoft/fast-element';
9
10
  import { FilterMode } from '@genesislcap/foundation-ui';
10
11
  import { FoundationElement } from '@microsoft/fast-foundation';
11
12
  import { FoundationLayoutContainer } from '@genesislcap/foundation-utils';
13
+ import { JsonFormsRendererRegistryEntry } from '@jsonforms/core';
12
14
  import { JsonFormsState } from '@jsonforms/core';
13
15
  import { JSONSchema7 } from 'json-schema';
14
16
  import { KVStorage } from '@genesislcap/foundation-comms';
@@ -17,10 +19,13 @@ import { LayoutCacheContainer } from '@genesislcap/foundation-utils';
17
19
  import { Logger } from '@genesislcap/foundation-logger';
18
20
  import { OwnPropsOfControl } from '@jsonforms/core';
19
21
  import { RankedTester } from '@jsonforms/core';
22
+ import { RendererProps } from '@jsonforms/core';
20
23
  import { RuleEffect } from '@jsonforms/core';
21
24
  import { SchemaBasedCondition } from '@jsonforms/core';
22
25
  import { StatePropsOfControl } from '@jsonforms/core';
23
26
  import { UISchemaElement } from '@jsonforms/core';
27
+ import { UpdateAction } from '@jsonforms/core';
28
+ import { ValidationMode } from '@jsonforms/core';
24
29
  import { ViewTemplate } from '@microsoft/fast-element';
25
30
 
26
31
  /**
@@ -1069,6 +1074,11 @@ export declare class Form extends Form_base {
1069
1074
  * @internal
1070
1075
  */
1071
1076
  csvFileInput: HTMLInputElement;
1077
+ /**
1078
+ * Reference to the internal json-forms element.
1079
+ * @internal
1080
+ */
1081
+ jsonFormsElement: JSONForms;
1072
1082
  /**
1073
1083
  * Stores the approval message entered by the user.
1074
1084
  * @internal
@@ -1291,6 +1301,16 @@ export declare class Form extends Form_base {
1291
1301
  * @public
1292
1302
  */
1293
1303
  reset(clearData?: boolean): void;
1304
+ /**
1305
+ * Maps Genesis EVENT_NACK field errors onto the form via additionalErrors.
1306
+ * @internal
1307
+ */
1308
+ private applyServerFieldErrors;
1309
+ /**
1310
+ * Maps field errors from failed bulk-insert rows onto the form.
1311
+ * @internal
1312
+ */
1313
+ private applyBulkServerFieldErrors;
1294
1314
  /**
1295
1315
  * Show the approval message modal
1296
1316
  * @internal
@@ -1718,6 +1738,26 @@ export declare function generateCsvTemplate(schema: JSONSchema7 | undefined, uiS
1718
1738
  */
1719
1739
  export declare const genesisErrorTranslator: ErrorTranslator;
1720
1740
 
1741
+ /**
1742
+ * Genesis EVENT_NACK field-level error entry.
1743
+ * @public
1744
+ */
1745
+ export declare type GenesisFieldError = {
1746
+ '@type'?: string;
1747
+ CODE?: string;
1748
+ TEXT: string;
1749
+ STATUS_CODE?: string;
1750
+ FIELD?: string;
1751
+ PATH?: string | null;
1752
+ };
1753
+
1754
+ /**
1755
+ * Converts a Genesis JSON-path or FIELD name to a JsonForms instance path.
1756
+ * Strips the `$.` prefix and optional `DETAILS` segment used in event payloads.
1757
+ * @internal
1758
+ */
1759
+ export declare function genesisFieldToInstancePath(field?: string, path?: string | null, instancePathPrefix?: string): string | null;
1760
+
1721
1761
  /**
1722
1762
  * @internal
1723
1763
  * Needed to explicitly set as string as we don't want to let typescript set them as ascending numbers
@@ -1760,12 +1800,90 @@ export declare function getVerticalCategorizationHeight(layout: CategorizationLa
1760
1800
  */
1761
1801
  export declare type GroupRendererOptions = CategorizationRendererOptions;
1762
1802
 
1803
+ /**
1804
+ * Converts a JsonForms/Ajv instance path to a JSON Forms scope string.
1805
+ * @example `/items/0/CCY` → `#/properties/items/items/0/properties/CCY`
1806
+ * @internal
1807
+ */
1808
+ export declare function instancePathToJsonFormsScope(instancePath: string): string;
1809
+
1763
1810
  /**
1764
1811
  * Whether categorization `layout` selects the vertical renderer (string `'vertical'` or object `{ type: 'vertical' }`).
1765
1812
  * @public
1766
1813
  */
1767
1814
  export declare function isVerticalCategorizationLayout(layout: CategorizationLayoutType | undefined): boolean;
1768
1815
 
1816
+ /**
1817
+ * JSON Forms host element for schema-driven UI.
1818
+ * @public
1819
+ *
1820
+ * @fires change - Bubbles from nested dispatch-renderer when a control emits change (e.g. multiselect)
1821
+ * @fires data-change - Fired when bound form data changes
1822
+ */
1823
+ declare class JSONForms extends FASTElement {
1824
+ private _submitted;
1825
+ private serverErrors;
1826
+ get submitted(): boolean;
1827
+ set submitted(value: boolean);
1828
+ prefix: any;
1829
+ prefixChanged(): void;
1830
+ jsonforms: any;
1831
+ i18n: any;
1832
+ uichemaToUse: any;
1833
+ schema: any;
1834
+ schemaChanged(): void;
1835
+ uischema: UISchemaElement;
1836
+ uischemaChanged(): void;
1837
+ data: any;
1838
+ dataChanged(): void;
1839
+ renderers: JsonFormsRendererRegistryEntry[];
1840
+ renderersChanged(): void;
1841
+ validationMode: ValidationMode;
1842
+ validationModeChanged(): void;
1843
+ ajv: Ajv;
1844
+ ajvChanged(): void;
1845
+ readonly: boolean;
1846
+ readonlyChanged(): void;
1847
+ config: any;
1848
+ configChanged(): void;
1849
+ /**
1850
+ * Row submit statuses for bulk insert mode.
1851
+ * Passed from the parent foundation-form.
1852
+ */
1853
+ rowSubmitStatuses: Map<number, BulkRowStatus>;
1854
+ rowSubmitStatusesChanged(): void;
1855
+ /**
1856
+ * Whether the form is in bulk insert mode.
1857
+ * Passed from the parent foundation-form.
1858
+ */
1859
+ bulkInsert: boolean;
1860
+ bulkInsertChanged(): void;
1861
+ get props(): RendererProps;
1862
+ dispatch: (action: UpdateAction) => void;
1863
+ /**
1864
+ * Applies server-side validation errors returned from an EVENT_NACK response.
1865
+ * Errors are merged into `core.additionalErrors` and shown inline on fields.
1866
+ * @public
1867
+ */
1868
+ setServerErrors(errors: ErrorObject[]): void;
1869
+ /**
1870
+ * Clears all server-side validation errors from the form.
1871
+ * @public
1872
+ */
1873
+ clearServerErrors(): void;
1874
+ private buildAdditionalErrors;
1875
+ private applyAdditionalErrorsToCore;
1876
+ private refreshAdditionalErrors;
1877
+ /**
1878
+ * Performs client-side validation by running the validator defined in the UI schema.
1879
+ * @param uischema the UI schema
1880
+ * @param data the data to validate against (defaults to the current core data)
1881
+ * @returns ErrorObject[] that will be passed to JsonFormsCore as additionalErrors
1882
+ */
1883
+ validate: (uischema: UISchemaElement, data?: any) => ErrorObject[];
1884
+ copyUISchemaToClipboard(): Promise<void>;
1885
+ }
1886
+
1769
1887
  /**
1770
1888
  * Orientation options available for stepper renderer.
1771
1889
  * @public
@@ -1834,6 +1952,20 @@ export declare const logger: Logger;
1834
1952
  */
1835
1953
  export declare function mapCsvToSchema(csvRows: Record<string, string>[], schema: JSONSchema7 | undefined, uiSchema?: UiSchema): CsvMappingResult;
1836
1954
 
1955
+ /**
1956
+ * Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]`
1957
+ * suitable for `additionalErrors` on the form core.
1958
+ *
1959
+ * Only entries with a `FIELD` or `PATH` are mapped; generic errors (no field
1960
+ * association) are omitted so callers can still surface them via toast/dialog.
1961
+ *
1962
+ * @param errors - Genesis ERROR array from an EVENT_NACK response
1963
+ * @param schema - JSON schema used to resolve `parentSchema` for each field
1964
+ * @param instancePathPrefix - Optional prefix for bulk-insert rows (e.g. `/items/0`)
1965
+ * @public
1966
+ */
1967
+ export declare function mapGenesisFieldErrorsToAdditionalErrors(errors: GenesisFieldError[] | undefined, schema?: JSONSchema7, instancePathPrefix?: string): ErrorObject[];
1968
+
1837
1969
  /** @beta */
1838
1970
  export declare const MulticolumnDropdownControlRendererEntry: any;
1839
1971
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-forms",
3
3
  "description": "Genesis Foundation Forms",
4
- "version": "14.452.0",
4
+ "version": "14.452.1-FUI-2538.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -59,13 +59,13 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@genesislcap/foundation-testing": "14.452.0",
63
- "@genesislcap/genx": "14.452.0",
64
- "@genesislcap/rollup-builder": "14.452.0",
65
- "@genesislcap/ts-builder": "14.452.0",
66
- "@genesislcap/uvu-playwright-builder": "14.452.0",
67
- "@genesislcap/vite-builder": "14.452.0",
68
- "@genesislcap/webpack-builder": "14.452.0",
62
+ "@genesislcap/foundation-testing": "14.452.1-FUI-2538.1",
63
+ "@genesislcap/genx": "14.452.1-FUI-2538.1",
64
+ "@genesislcap/rollup-builder": "14.452.1-FUI-2538.1",
65
+ "@genesislcap/ts-builder": "14.452.1-FUI-2538.1",
66
+ "@genesislcap/uvu-playwright-builder": "14.452.1-FUI-2538.1",
67
+ "@genesislcap/vite-builder": "14.452.1-FUI-2538.1",
68
+ "@genesislcap/webpack-builder": "14.452.1-FUI-2538.1",
69
69
  "@types/json-schema": "^7.0.11",
70
70
  "@types/papaparse": "^5.3.14"
71
71
  },
@@ -82,12 +82,12 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@genesislcap/foundation-comms": "14.452.0",
86
- "@genesislcap/foundation-criteria": "14.452.0",
87
- "@genesislcap/foundation-logger": "14.452.0",
88
- "@genesislcap/foundation-notifications": "14.452.0",
89
- "@genesislcap/foundation-ui": "14.452.0",
90
- "@genesislcap/foundation-utils": "14.452.0",
85
+ "@genesislcap/foundation-comms": "14.452.1-FUI-2538.1",
86
+ "@genesislcap/foundation-criteria": "14.452.1-FUI-2538.1",
87
+ "@genesislcap/foundation-logger": "14.452.1-FUI-2538.1",
88
+ "@genesislcap/foundation-notifications": "14.452.1-FUI-2538.1",
89
+ "@genesislcap/foundation-ui": "14.452.1-FUI-2538.1",
90
+ "@genesislcap/foundation-utils": "14.452.1-FUI-2538.1",
91
91
  "@json-schema-tools/dereferencer": "^1.6.1",
92
92
  "@jsonforms/core": "^3.2.1",
93
93
  "@microsoft/fast-components": "2.30.6",
@@ -109,5 +109,5 @@
109
109
  "access": "public"
110
110
  },
111
111
  "customElements": "dist/custom-elements.json",
112
- "gitHead": "f2d34cef52ecea070247f239e9274d9d7bb74784"
112
+ "gitHead": "f02752e979beb9ef663a6ce89a4db72d1b9a9514"
113
113
  }