@genesislcap/foundation-forms 15.51.0 → 15.52.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/dist/custom-elements.json +1 -1
- package/dist/dts/utils/server-errors.d.ts +12 -2
- package/dist/dts/utils/server-errors.d.ts.map +1 -1
- package/dist/esm/utils/server-errors.js +34 -5
- package/dist/foundation-forms.api.json +1 -1
- package/dist/foundation-forms.d.ts +12 -2
- package/package.json +13 -13
|
@@ -2450,7 +2450,7 @@
|
|
|
2450
2450
|
"description": "Optional prefix for bulk-insert rows (e.g. `/items/0`)"
|
|
2451
2451
|
}
|
|
2452
2452
|
],
|
|
2453
|
-
"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
|
|
2453
|
+
"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` naming a field are mapped; generic errors\n(no field association, or about the whole payload) are omitted so callers can\nstill surface them via toast/dialog.",
|
|
2454
2454
|
"privacy": "public"
|
|
2455
2455
|
}
|
|
2456
2456
|
],
|
|
@@ -21,6 +21,15 @@ export declare function instancePathToJsonFormsScope(instancePath: string): stri
|
|
|
21
21
|
/**
|
|
22
22
|
* Converts a Genesis JSON-path or FIELD name to a JsonForms instance path.
|
|
23
23
|
* Strips the `$.` prefix and optional `DETAILS` segment used in event payloads.
|
|
24
|
+
*
|
|
25
|
+
* For a schema failure GSF sets PATH to where the failure was found. FIELD is the missing
|
|
26
|
+
* property for `required` (PATH is then its parent object) and PATH's last segment otherwise:
|
|
27
|
+
* - `PATH: '$.DETAILS', FIELD: 'NAME'` → `/NAME`
|
|
28
|
+
* - `PATH: '$.DETAILS.ENABLED', FIELD: 'ENABLED'` → `/ENABLED`
|
|
29
|
+
* - `PATH: '$.DETAILS.ITEMS[0]', FIELD: 'NAME'` → `/ITEMS/0/NAME`
|
|
30
|
+
*
|
|
31
|
+
* Returns null when the error is about the whole payload (`PATH: '$.DETAILS', FIELD: 'DETAILS'`,
|
|
32
|
+
* e.g. an additional property), since no control matches it.
|
|
24
33
|
* @internal
|
|
25
34
|
*/
|
|
26
35
|
export declare function genesisFieldToInstancePath(field?: string, path?: string | null, instancePathPrefix?: string): string | null;
|
|
@@ -28,8 +37,9 @@ export declare function genesisFieldToInstancePath(field?: string, path?: string
|
|
|
28
37
|
* Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]`
|
|
29
38
|
* suitable for `additionalErrors` on the form core.
|
|
30
39
|
*
|
|
31
|
-
* Only entries with a `FIELD` or `PATH` are mapped; generic errors
|
|
32
|
-
* association) are omitted so callers can
|
|
40
|
+
* Only entries with a `FIELD` or `PATH` naming a field are mapped; generic errors
|
|
41
|
+
* (no field association, or about the whole payload) are omitted so callers can
|
|
42
|
+
* still surface them via toast/dialog.
|
|
33
43
|
*
|
|
34
44
|
* @param errors - Genesis ERROR array from an EVENT_NACK response
|
|
35
45
|
* @param schema - JSON schema used to resolve `parentSchema` for each field
|
|
@@ -1 +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;
|
|
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;AAcD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EACpB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,GAAG,IAAI,CAgCf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,iBAAiB,EAAE,GAAG,SAAS,EACvC,MAAM,CAAC,EAAE,WAAW,EACpB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,WAAW,EAAE,CAoCf"}
|
|
@@ -24,17 +24,45 @@ export function instancePathToJsonFormsScope(instancePath) {
|
|
|
24
24
|
}
|
|
25
25
|
return scope;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Splits a Genesis JSON path into segments.
|
|
29
|
+
* @example `$.DETAILS.ITEMS[0].NAME` → `['DETAILS', 'ITEMS', '0', 'NAME']`
|
|
30
|
+
*/
|
|
31
|
+
function jsonPathSegments(path) {
|
|
32
|
+
return path
|
|
33
|
+
.replace(/^\$/, '')
|
|
34
|
+
.replace(/\[(\d+)\]/g, '.$1')
|
|
35
|
+
.split(/[./]/)
|
|
36
|
+
.filter(Boolean);
|
|
37
|
+
}
|
|
27
38
|
/**
|
|
28
39
|
* Converts a Genesis JSON-path or FIELD name to a JsonForms instance path.
|
|
29
40
|
* Strips the `$.` prefix and optional `DETAILS` segment used in event payloads.
|
|
41
|
+
*
|
|
42
|
+
* For a schema failure GSF sets PATH to where the failure was found. FIELD is the missing
|
|
43
|
+
* property for `required` (PATH is then its parent object) and PATH's last segment otherwise:
|
|
44
|
+
* - `PATH: '$.DETAILS', FIELD: 'NAME'` → `/NAME`
|
|
45
|
+
* - `PATH: '$.DETAILS.ENABLED', FIELD: 'ENABLED'` → `/ENABLED`
|
|
46
|
+
* - `PATH: '$.DETAILS.ITEMS[0]', FIELD: 'NAME'` → `/ITEMS/0/NAME`
|
|
47
|
+
*
|
|
48
|
+
* Returns null when the error is about the whole payload (`PATH: '$.DETAILS', FIELD: 'DETAILS'`,
|
|
49
|
+
* e.g. an additional property), since no control matches it.
|
|
30
50
|
* @internal
|
|
31
51
|
*/
|
|
32
52
|
export function genesisFieldToInstancePath(field, path, instancePathPrefix) {
|
|
33
53
|
let relativePath = null;
|
|
34
54
|
if (path) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
const segments = jsonPathSegments(path);
|
|
56
|
+
const fieldSegments = field ? jsonPathSegments(field) : [];
|
|
57
|
+
const pathEndsWithField = fieldSegments.length <= segments.length &&
|
|
58
|
+
fieldSegments.every((s, i) => segments[segments.length - fieldSegments.length + i] === s);
|
|
59
|
+
if (!pathEndsWithField) {
|
|
60
|
+
segments.push(...fieldSegments);
|
|
61
|
+
}
|
|
62
|
+
if (segments[0] === 'DETAILS') {
|
|
63
|
+
segments.shift();
|
|
64
|
+
}
|
|
65
|
+
relativePath = segments.length ? `/${segments.join('/')}` : null;
|
|
38
66
|
}
|
|
39
67
|
else if (field) {
|
|
40
68
|
relativePath = field.startsWith('/') ? field : `/${field}`;
|
|
@@ -54,8 +82,9 @@ export function genesisFieldToInstancePath(field, path, instancePathPrefix) {
|
|
|
54
82
|
* Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]`
|
|
55
83
|
* suitable for `additionalErrors` on the form core.
|
|
56
84
|
*
|
|
57
|
-
* Only entries with a `FIELD` or `PATH` are mapped; generic errors
|
|
58
|
-
* association) are omitted so callers can
|
|
85
|
+
* Only entries with a `FIELD` or `PATH` naming a field are mapped; generic errors
|
|
86
|
+
* (no field association, or about the whole payload) are omitted so callers can
|
|
87
|
+
* still surface them via toast/dialog.
|
|
59
88
|
*
|
|
60
89
|
* @param errors - Genesis ERROR array from an EVENT_NACK response
|
|
61
90
|
* @param schema - JSON schema used to resolve `parentSchema` for each field
|
|
@@ -3820,7 +3820,7 @@
|
|
|
3820
3820
|
{
|
|
3821
3821
|
"kind": "Function",
|
|
3822
3822
|
"canonicalReference": "@genesislcap/foundation-forms!mapGenesisFieldErrorsToAdditionalErrors:function(1)",
|
|
3823
|
-
"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",
|
|
3823
|
+
"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` naming a field are mapped; generic errors (no field association, or about the whole payload) 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",
|
|
3824
3824
|
"excerptTokens": [
|
|
3825
3825
|
{
|
|
3826
3826
|
"kind": "Content",
|
|
@@ -2094,6 +2094,15 @@ export declare type GenesisFieldError = {
|
|
|
2094
2094
|
/**
|
|
2095
2095
|
* Converts a Genesis JSON-path or FIELD name to a JsonForms instance path.
|
|
2096
2096
|
* Strips the `$.` prefix and optional `DETAILS` segment used in event payloads.
|
|
2097
|
+
*
|
|
2098
|
+
* For a schema failure GSF sets PATH to where the failure was found. FIELD is the missing
|
|
2099
|
+
* property for `required` (PATH is then its parent object) and PATH's last segment otherwise:
|
|
2100
|
+
* - `PATH: '$.DETAILS', FIELD: 'NAME'` → `/NAME`
|
|
2101
|
+
* - `PATH: '$.DETAILS.ENABLED', FIELD: 'ENABLED'` → `/ENABLED`
|
|
2102
|
+
* - `PATH: '$.DETAILS.ITEMS[0]', FIELD: 'NAME'` → `/ITEMS/0/NAME`
|
|
2103
|
+
*
|
|
2104
|
+
* Returns null when the error is about the whole payload (`PATH: '$.DETAILS', FIELD: 'DETAILS'`,
|
|
2105
|
+
* e.g. an additional property), since no control matches it.
|
|
2097
2106
|
* @internal
|
|
2098
2107
|
*/
|
|
2099
2108
|
export declare function genesisFieldToInstancePath(field?: string, path?: string | null, instancePathPrefix?: string): string | null;
|
|
@@ -2241,8 +2250,9 @@ export declare function mapCsvToSchema(csvRows: Record<string, string>[], schema
|
|
|
2241
2250
|
* Maps Genesis commitEvent NACK `ERROR[]` entries to JsonForms `ErrorObject[]`
|
|
2242
2251
|
* suitable for `additionalErrors` on the form core.
|
|
2243
2252
|
*
|
|
2244
|
-
* Only entries with a `FIELD` or `PATH` are mapped; generic errors
|
|
2245
|
-
* association) are omitted so callers can
|
|
2253
|
+
* Only entries with a `FIELD` or `PATH` naming a field are mapped; generic errors
|
|
2254
|
+
* (no field association, or about the whole payload) are omitted so callers can
|
|
2255
|
+
* still surface them via toast/dialog.
|
|
2246
2256
|
*
|
|
2247
2257
|
* @param errors - Genesis ERROR array from an EVENT_NACK response
|
|
2248
2258
|
* @param schema - JSON schema used to resolve `parentSchema` for each field
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-forms",
|
|
3
3
|
"description": "Genesis Foundation Forms",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.52.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@genesislcap/foundation-testing": "15.
|
|
60
|
-
"@genesislcap/genx": "15.
|
|
61
|
-
"@genesislcap/ts-builder": "15.
|
|
62
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
63
|
-
"@genesislcap/vite-builder": "15.
|
|
64
|
-
"@genesislcap/webpack-builder": "15.
|
|
59
|
+
"@genesislcap/foundation-testing": "15.52.0",
|
|
60
|
+
"@genesislcap/genx": "15.52.0",
|
|
61
|
+
"@genesislcap/ts-builder": "15.52.0",
|
|
62
|
+
"@genesislcap/uvu-playwright-builder": "15.52.0",
|
|
63
|
+
"@genesislcap/vite-builder": "15.52.0",
|
|
64
|
+
"@genesislcap/webpack-builder": "15.52.0",
|
|
65
65
|
"@types/json-schema": "^7.0.11",
|
|
66
66
|
"@types/papaparse": "^5.3.14"
|
|
67
67
|
},
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@genesislcap/foundation-comms": "15.
|
|
82
|
-
"@genesislcap/foundation-criteria": "15.
|
|
83
|
-
"@genesislcap/foundation-logger": "15.
|
|
84
|
-
"@genesislcap/foundation-notifications": "15.
|
|
85
|
-
"@genesislcap/foundation-ui": "15.
|
|
86
|
-
"@genesislcap/foundation-utils": "15.
|
|
81
|
+
"@genesislcap/foundation-comms": "15.52.0",
|
|
82
|
+
"@genesislcap/foundation-criteria": "15.52.0",
|
|
83
|
+
"@genesislcap/foundation-logger": "15.52.0",
|
|
84
|
+
"@genesislcap/foundation-notifications": "15.52.0",
|
|
85
|
+
"@genesislcap/foundation-ui": "15.52.0",
|
|
86
|
+
"@genesislcap/foundation-utils": "15.52.0",
|
|
87
87
|
"@json-schema-tools/dereferencer": "^1.6.1",
|
|
88
88
|
"@jsonforms/core": "^3.2.1",
|
|
89
89
|
"@microsoft/fast-components": "2.30.6",
|