@planeasyinc/le-core 0.0.8 → 0.0.9
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/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-test.log +33 -0
- package/dist/adapter/normalize-actions.d.ts.map +1 -1
- package/dist/adapter/normalize-actions.js +9 -0
- package/dist/adapter/normalize-actions.js.map +1 -1
- package/dist/adapter/normalize-config.js +3 -1
- package/dist/adapter/normalize-config.js.map +1 -1
- package/dist/adapter/normalize-ui.d.ts +2 -0
- package/dist/adapter/normalize-ui.d.ts.map +1 -1
- package/dist/adapter/normalize-ui.js +13 -0
- package/dist/adapter/normalize-ui.js.map +1 -1
- package/dist/models/api-config.model.d.ts.map +1 -1
- package/dist/models/internal.d.ts +25 -0
- package/dist/models/internal.d.ts.map +1 -1
- package/dist/public-api.d.ts +1 -1
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js.map +1 -1
- package/dist/utils/decodeJwt.js +1 -1
- package/dist/utils/decodeJwt.js.map +1 -1
- package/package.json +3 -3
- package/src/adapter/normalize-actions.test.ts +48 -0
- package/src/adapter/normalize-actions.ts +13 -1
- package/src/adapter/normalize-config.test.ts +26 -0
- package/src/adapter/normalize-config.ts +4 -1
- package/src/adapter/normalize-ui.test.ts +36 -0
- package/src/adapter/normalize-ui.ts +19 -0
- package/src/models/api-config.model.ts +1 -1
- package/src/models/internal.ts +28 -0
- package/src/public-api.ts +4 -1
- package/src/utils/decodeJwt.test.ts +60 -0
- package/src/utils/decodeJwt.ts +1 -1
- package/tsconfig.json +0 -12
- package/dist/adapter/normalizeConfig.d.ts +0 -3
- package/dist/adapter/normalizeConfig.d.ts.map +0 -1
- package/dist/adapter/normalizeConfig.js +0 -49
- package/dist/adapter/normalizeConfig.js.map +0 -1
- package/dist/planeasyinc-le-core-0.0.4.tgz +0 -0
- package/dist/utils/normalize-actions.d.ts +0 -3
- package/dist/utils/normalize-actions.d.ts.map +0 -1
- package/dist/utils/normalize-actions.js +0 -48
- package/dist/utils/normalize-actions.js.map +0 -1
- package/dist/utils/normalize-control-source.d.ts +0 -3
- package/dist/utils/normalize-control-source.d.ts.map +0 -1
- package/dist/utils/normalize-control-source.js +0 -17
- package/dist/utils/normalize-control-source.js.map +0 -1
- package/dist/utils/normalize-data-source.d.ts +0 -3
- package/dist/utils/normalize-data-source.d.ts.map +0 -1
- package/dist/utils/normalize-data-source.js +0 -10
- package/dist/utils/normalize-data-source.js.map +0 -1
- package/dist/utils/normalize-ui.d.ts +0 -2
- package/dist/utils/normalize-ui.d.ts.map +0 -1
- package/dist/utils/normalize-ui.js +0 -17
- package/dist/utils/normalize-ui.js.map +0 -1
- package/dist/utils/normalizeActions.d.ts +0 -3
- package/dist/utils/normalizeActions.d.ts.map +0 -1
- package/dist/utils/normalizeActions.js +0 -35
- package/dist/utils/normalizeActions.js.map +0 -1
- package/dist/utils/normalizeControlSource.d.ts +0 -3
- package/dist/utils/normalizeControlSource.d.ts.map +0 -1
- package/dist/utils/normalizeControlSource.js +0 -17
- package/dist/utils/normalizeControlSource.js.map +0 -1
- package/dist/utils/normalizeDataSource.d.ts +0 -3
- package/dist/utils/normalizeDataSource.d.ts.map +0 -1
- package/dist/utils/normalizeDataSource.js +0 -10
- package/dist/utils/normalizeDataSource.js.map +0 -1
- package/dist/utils/normalizeUI.d.ts +0 -2
- package/dist/utils/normalizeUI.d.ts.map +0 -1
- package/dist/utils/normalizeUI.js +0 -17
- package/dist/utils/normalizeUI.js.map +0 -1
- package/dist/utils/urlFragmantBuilder.d.ts +0 -11
- package/dist/utils/urlFragmantBuilder.d.ts.map +0 -1
- package/dist/utils/urlFragmantBuilder.js +0 -34
- package/dist/utils/urlFragmantBuilder.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
> @planeasyinc/le-core@0.0.8 test /home/ubuntu/amsdal/form-engine/packages/le-core
|
|
3
|
+
> vitest --run
|
|
4
|
+
|
|
5
|
+
▲ [WARNING] The condition "path" here will never be used as it comes after both "import" and "require" [package.json]
|
|
6
|
+
|
|
7
|
+
package.json:13:6:
|
|
8
|
+
13 │ "path": "./dist/public-api.d.ts"
|
|
9
|
+
╵ ~~~~~~
|
|
10
|
+
|
|
11
|
+
The "import" condition comes earlier and will be used for all "import" statements:
|
|
12
|
+
|
|
13
|
+
package.json:11:6:
|
|
14
|
+
11 │ "import": "./dist/public-api.js",
|
|
15
|
+
╵ ~~~~~~~~
|
|
16
|
+
|
|
17
|
+
The "require" condition comes earlier and will be used for all "require" calls:
|
|
18
|
+
|
|
19
|
+
package.json:12:6:
|
|
20
|
+
12 │ "require": "./dist/public-api.cjs",
|
|
21
|
+
╵ ~~~~~~~~~
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.11 [39m[90m/home/ubuntu/amsdal/form-engine/packages/le-core[39m
|
|
25
|
+
|
|
26
|
+
[32m✓[39m src/utils/decodeJwt.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 14[2mms[22m[39m
|
|
27
|
+
[32m✓[39m src/utils/url-fragment-builder.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
28
|
+
|
|
29
|
+
[2m Test Files [22m [1m[32m2 passed[39m[22m[90m (2)[39m
|
|
30
|
+
[2m Tests [22m [1m[32m11 passed[39m[22m[90m (11)[39m
|
|
31
|
+
[2m Start at [22m 15:37:46
|
|
32
|
+
[2m Duration [22m 659ms[2m (transform 180ms, setup 0ms, import 298ms, tests 26ms, environment 0ms)[22m
|
|
33
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-actions.d.ts","sourceRoot":"","sources":["../../src/adapter/normalize-actions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"normalize-actions.d.ts","sourceRoot":"","sources":["../../src/adapter/normalize-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,aAAa,EAAe,MAAM,oBAAoB,CAAC;AA6CxF,eAAO,MAAM,gBAAgB,SAAU,GAAG,KAAG,aAAa,GAAG,SAsB5D,CAAC"}
|
|
@@ -29,11 +29,20 @@ const normalizeRowAction = (action) => {
|
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
+
const normalizeCellAction = (action) => {
|
|
33
|
+
if (!action.column) {
|
|
34
|
+
throw new Error(`Cell action of type "${action.type}" is missing required "column" property`);
|
|
35
|
+
}
|
|
36
|
+
return { ...normalizeRowAction(action), column: action.column };
|
|
37
|
+
};
|
|
32
38
|
export const normalizeActions = (node) => {
|
|
33
39
|
const result = {};
|
|
34
40
|
if (node.on_row_click) {
|
|
35
41
|
result.onRowClick = node.on_row_click.map(normalizeRowAction);
|
|
36
42
|
}
|
|
43
|
+
if (node.on_cell_click) {
|
|
44
|
+
result.onCellClick = node.on_cell_click.map(normalizeCellAction);
|
|
45
|
+
}
|
|
37
46
|
if (node.table_actions) {
|
|
38
47
|
result.tableActions = node.table_actions.map((action) => ({
|
|
39
48
|
type: action.type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-actions.js","sourceRoot":"","sources":["../../src/adapter/normalize-actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,eAAe,GAAG,CAAC,MAAW,EAAY,EAAE;IAChD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,UAAU,EAAE,sBAAsB,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1D,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,MAAW,EAAe,EAAE;IACtD,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK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
|
|
5
5
|
import { normalizeControlSource } from './normalize-control-source';
|
|
6
6
|
import { normalizeActions } from './normalize-actions';
|
|
7
|
-
import { normalizeUi } from './normalize-ui';
|
|
7
|
+
import { normalizeAppearance, normalizeUi } from './normalize-ui';
|
|
8
8
|
export const normalizeConfig = (raw) => {
|
|
9
9
|
return normalizeNode(raw);
|
|
10
10
|
};
|
|
@@ -26,9 +26,11 @@ function normalizeNode(node) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
if (node.type === 'form') {
|
|
29
|
+
const appearance = normalizeAppearance(node);
|
|
29
30
|
return {
|
|
30
31
|
...base,
|
|
31
32
|
controlSource: normalizeControlSource(node.control_source),
|
|
33
|
+
...(appearance ? { ui: { appearance } } : {}),
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
if (node.type === 'table') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-config.js","sourceRoot":"","sources":["../../src/adapter/normalize-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-config.js","sourceRoot":"","sources":["../../src/adapter/normalize-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,w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AE,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACzB,CAAC;IACzB,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC1B,OAAO;YACL,GAAG,IAAI;YACP,UAAU,EAAE,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC;YACjD,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC;YAC/B,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC;SACA,CAAC;IAC1B,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC1B,OAAO;YACL,GAAG,IAAI;SACR,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-ui.d.ts","sourceRoot":"","sources":["../../src/adapter/normalize-ui.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,SAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"normalize-ui.d.ts","sourceRoot":"","sources":["../../src/adapter/normalize-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,eAAO,MAAM,mBAAmB,SAAU,GAAG,KAAG,YAAY,GAAG,SAE9D,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,GAAG,QA+BpC,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export const normalizeAppearance = (node) => {
|
|
2
|
+
return node.appearance === 'card' ? 'card' : undefined;
|
|
3
|
+
};
|
|
1
4
|
export const normalizeUi = (node) => {
|
|
2
5
|
const ui = {};
|
|
3
6
|
if (node.pagination?.enabled) {
|
|
@@ -12,6 +15,16 @@ export const normalizeUi = (node) => {
|
|
|
12
15
|
fields: node.sort.sortable_fields,
|
|
13
16
|
};
|
|
14
17
|
}
|
|
18
|
+
if (node.quick_filters?.length) {
|
|
19
|
+
ui.quickFilters = node.quick_filters.map((filter) => ({
|
|
20
|
+
label: filter.label,
|
|
21
|
+
...(filter.filters ? { filters: filter.filters } : {}),
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
const appearance = normalizeAppearance(node);
|
|
25
|
+
if (appearance) {
|
|
26
|
+
ui.appearance = appearance;
|
|
27
|
+
}
|
|
15
28
|
return Object.keys(ui).length ? ui : undefined;
|
|
16
29
|
};
|
|
17
30
|
//# sourceMappingURL=normalize-ui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-ui.js","sourceRoot":"","sources":["../../src/adapter/normalize-ui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-ui.js","sourceRoot":"","sources":["../../src/adapter/normalize-ui.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAS,EAA4B,EAAE;IACzE,OAAO,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAS,EAAE,EAAE;IACvC,MAAM,EAAE,GAAQ,EAAE,CAAC;IAEnB,IAAI,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;QAC7B,EAAE,CAAC,UAAU,GAAG;YACd,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB;YAC3C,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB;SAC3C,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;QAC7D,EAAE,CAAC,IAAI,GAAG;YACR,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YAC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,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"api-config.model.d.ts","sourceRoot":"","sources":["../../src/models/api-config.model.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GACZ,QAAQ,GACR,YAAY,GACZ,OAAO,GACP,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,GACT,MAAM,GACN,gBAAgB,GAChB,SAAS,CAAC;AAEd,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -25,6 +25,9 @@ export interface LeGridColNode extends LeBaseNode, LeContainerNode {
|
|
|
25
25
|
export interface LeFormNode extends LeBaseNode {
|
|
26
26
|
type: 'form';
|
|
27
27
|
controlSource?: LeDataSource;
|
|
28
|
+
ui?: {
|
|
29
|
+
appearance?: LeAppearance;
|
|
30
|
+
};
|
|
28
31
|
}
|
|
29
32
|
export interface LeTableNode extends LeBaseNode {
|
|
30
33
|
type: 'table';
|
|
@@ -33,6 +36,8 @@ export interface LeTableNode extends LeBaseNode {
|
|
|
33
36
|
ui?: {
|
|
34
37
|
pagination?: LePagination;
|
|
35
38
|
sort?: LeSort;
|
|
39
|
+
quickFilters?: LeQuickFilter[];
|
|
40
|
+
appearance?: LeAppearance;
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
43
|
export interface LeChartNode extends LeBaseNode {
|
|
@@ -46,6 +51,19 @@ export interface LeSort {
|
|
|
46
51
|
default: string[];
|
|
47
52
|
fields: string[];
|
|
48
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* `card`: the page of a table or a form follows one page format - no empty toolbar above the content,
|
|
56
|
+
* a table titled like a form header and framed like a form card.
|
|
57
|
+
* */
|
|
58
|
+
export type LeAppearance = 'card';
|
|
59
|
+
/**
|
|
60
|
+
* A button above the table that narrows its rows: a click puts its `filters` into the request,
|
|
61
|
+
* in place of the filters of the previous button. A button without filters shows all rows.
|
|
62
|
+
* */
|
|
63
|
+
export interface LeQuickFilter {
|
|
64
|
+
label: string;
|
|
65
|
+
filters?: Record<string, string>;
|
|
66
|
+
}
|
|
49
67
|
export interface LeDataSource {
|
|
50
68
|
kind: string;
|
|
51
69
|
entity: string;
|
|
@@ -53,6 +71,7 @@ export interface LeDataSource {
|
|
|
53
71
|
}
|
|
54
72
|
export interface LeNodeActions {
|
|
55
73
|
onRowClick?: LeRowAction[];
|
|
74
|
+
onCellClick?: LeCellAction[];
|
|
56
75
|
tableActions?: LeTableAction[];
|
|
57
76
|
}
|
|
58
77
|
export interface LeAction {
|
|
@@ -63,6 +82,12 @@ export interface LeRowAction {
|
|
|
63
82
|
type: string;
|
|
64
83
|
node: LeNode;
|
|
65
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* A row action bound to one column: it runs on a click on that column's cell, not on the whole row.
|
|
87
|
+
* */
|
|
88
|
+
export interface LeCellAction extends LeRowAction {
|
|
89
|
+
column: string;
|
|
90
|
+
}
|
|
66
91
|
export interface LeTableAction {
|
|
67
92
|
type: string;
|
|
68
93
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/models/internal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GACd,UAAU,GACV,aAAa,GACb,aAAa,GACb,UAAU,GACV,WAAW,GACX,WAAW,CAAC;AAEhB,MAAM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AE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;KAEK;AACL,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,QAAQ,EAAE,CAAC;CACrB"}
|
package/dist/public-api.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { normalizeConfig } from './adapter/normalize-config';
|
|
|
2
2
|
export { normalizeControlSource } from './adapter/normalize-control-source';
|
|
3
3
|
export { normalizeDataSource } from './adapter/normalize-data-source';
|
|
4
4
|
export { normalizeActions } from './adapter/normalize-actions';
|
|
5
|
-
export { LeNode, LeSectionNode, LeGridNode, LeGridColNode, LeChartNode, LeFormNode, LeTableNode, LeSort, LePagination, LeAction, LeRowAction, LeTableAction, LeDataSource, } from './models/internal';
|
|
5
|
+
export { LeNode, LeSectionNode, LeGridNode, LeGridColNode, LeChartNode, LeFormNode, LeTableNode, LeSort, LePagination, LeQuickFilter, LeAppearance, LeAction, LeRowAction, LeCellAction, LeTableAction, LeDataSource, } from './models/internal';
|
|
6
6
|
export { LeApiConfigModel, LeTheme } from './models/api-config.model';
|
|
7
7
|
export { isFormNode, isChartNode, isGridNode, isTableNode, isSectionNode } from './guards';
|
|
8
8
|
export { UrlFragmentBuilder } from './utils/url-fragment-builder';
|
package/dist/public-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,EACX,MAAM,EACN,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/public-api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAoB/D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/utils/decodeJwt.js
CHANGED
|
@@ -24,7 +24,7 @@ export const decodeJwt = (token) => {
|
|
|
24
24
|
catch {
|
|
25
25
|
throw new Error('Invalid JWT: payload is not valid JSON');
|
|
26
26
|
}
|
|
27
|
-
if (typeof parsed !== 'object' || parsed === null) {
|
|
27
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
28
28
|
throw new Error('Invalid JWT: payload must be an object');
|
|
29
29
|
}
|
|
30
30
|
return parsed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeJwt.js","sourceRoot":"","sources":["../../src/utils/decodeJwt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAmB,KAAa,EAAK,EAAE;IAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEnF,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,mDAAmD;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,wDAAwD;QACrF,IAAI,GAAG,kBAAkB,CACvB,MAAM;aACH,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,CAAC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C;QACH,mDAAmD;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,wDAAwD;QACrF,IAAI,GAAG,kBAAkB,CACvB,MAAM;aACH,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;aAC/D,IAAI,CAAC,EAAE,CAAC,CACZ,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planeasyinc/le-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/public-api.jcs",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"typescript": "5.6.3",
|
|
21
|
-
"vitest": "^4.1.7",
|
|
22
21
|
"@types/node": "18.15.3",
|
|
23
22
|
"@types/web": "0.0.347"
|
|
24
23
|
},
|
|
25
24
|
"scripts": {
|
|
26
25
|
"build": "tsc -p tsconfig.json",
|
|
27
|
-
"
|
|
26
|
+
"clean": "rimraf dist",
|
|
27
|
+
"test": "vitest --run",
|
|
28
28
|
"lint": "eslint src"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { normalizeActions } from './normalize-actions';
|
|
3
|
+
|
|
4
|
+
const controlSource = {
|
|
5
|
+
type: 'dynamic',
|
|
6
|
+
dynamic_value: {
|
|
7
|
+
type: 'transaction',
|
|
8
|
+
entity_name: 'citations',
|
|
9
|
+
body: { document: '{row.document}' },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe('normalizeActions', () => {
|
|
14
|
+
it('returns undefined for a node without actions', () => {
|
|
15
|
+
expect(normalizeActions({})).toBeUndefined();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('normalizes a cell action like a row action and keeps its column', () => {
|
|
19
|
+
const actions = normalizeActions({
|
|
20
|
+
on_cell_click: [{ type: 'open_sidebar', column: 'citations', control_source: controlSource }],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
expect(actions?.onCellClick).toEqual([
|
|
24
|
+
{
|
|
25
|
+
type: 'open_sidebar',
|
|
26
|
+
column: 'citations',
|
|
27
|
+
node: {
|
|
28
|
+
id: '',
|
|
29
|
+
type: 'form',
|
|
30
|
+
controlSource: {
|
|
31
|
+
kind: 'transaction',
|
|
32
|
+
entity: 'citations',
|
|
33
|
+
params: { document: '{row.document}' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
expect(actions?.onRowClick).toBeUndefined();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('rejects a cell action without a column', () => {
|
|
42
|
+
expect(() =>
|
|
43
|
+
normalizeActions({
|
|
44
|
+
on_cell_click: [{ type: 'open_sidebar', control_source: controlSource }],
|
|
45
|
+
}),
|
|
46
|
+
).toThrow('Cell action of type "open_sidebar" is missing required "column" property');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LeAction, LeNodeActions, LeRowAction } from '../models/internal';
|
|
1
|
+
import { LeAction, LeCellAction, LeNodeActions, LeRowAction } from '../models/internal';
|
|
2
2
|
import { normalizeControlSource } from './normalize-control-source';
|
|
3
3
|
|
|
4
4
|
const normalizeAction = (action: any): LeAction => {
|
|
@@ -35,6 +35,14 @@ const normalizeRowAction = (action: any): LeRowAction => {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
const normalizeCellAction = (action: any): LeCellAction => {
|
|
39
|
+
if (!action.column) {
|
|
40
|
+
throw new Error(`Cell action of type "${action.type}" is missing required "column" property`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return { ...normalizeRowAction(action), column: action.column };
|
|
44
|
+
};
|
|
45
|
+
|
|
38
46
|
export const normalizeActions = (node: any): LeNodeActions | undefined => {
|
|
39
47
|
const result: LeNodeActions = {};
|
|
40
48
|
|
|
@@ -42,6 +50,10 @@ export const normalizeActions = (node: any): LeNodeActions | undefined => {
|
|
|
42
50
|
result.onRowClick = node.on_row_click.map(normalizeRowAction);
|
|
43
51
|
}
|
|
44
52
|
|
|
53
|
+
if (node.on_cell_click) {
|
|
54
|
+
result.onCellClick = node.on_cell_click.map(normalizeCellAction);
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
if (node.table_actions) {
|
|
46
58
|
result.tableActions = node.table_actions.map((action: any) => ({
|
|
47
59
|
type: action.type,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { normalizeConfig } from './normalize-config';
|
|
3
|
+
import { LeFormNode } from '../models/internal';
|
|
4
|
+
|
|
5
|
+
const form = (extra: Record<string, unknown> = {}) => {
|
|
6
|
+
return normalizeConfig({
|
|
7
|
+
id: 'page',
|
|
8
|
+
type: 'form',
|
|
9
|
+
control_source: {
|
|
10
|
+
type: 'dynamic',
|
|
11
|
+
dynamic_value: { type: 'transaction', entity_name: 'page' },
|
|
12
|
+
},
|
|
13
|
+
...extra,
|
|
14
|
+
}) as LeFormNode;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe('normalizeConfig — form', () => {
|
|
18
|
+
it('keeps the card appearance of a form', () => {
|
|
19
|
+
expect(form({ appearance: 'card' }).ui).toEqual({ appearance: 'card' });
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('gives a form without an appearance no ui settings', () => {
|
|
23
|
+
expect(form().ui).toBeUndefined();
|
|
24
|
+
expect(form({ appearance: 'fancy' }).ui).toBeUndefined();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -5,7 +5,7 @@ import { extractLayout } from '../utils/extractLayout';
|
|
|
5
5
|
import { normalizeDataSource } from './normalize-data-source';
|
|
6
6
|
import { normalizeControlSource } from './normalize-control-source';
|
|
7
7
|
import { normalizeActions } from './normalize-actions';
|
|
8
|
-
import { normalizeUi } from './normalize-ui';
|
|
8
|
+
import { normalizeAppearance, normalizeUi } from './normalize-ui';
|
|
9
9
|
|
|
10
10
|
export const normalizeConfig = (raw: any): LeNode => {
|
|
11
11
|
return normalizeNode(raw);
|
|
@@ -32,9 +32,12 @@ function normalizeNode(node: any): LeNode {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (node.type === 'form') {
|
|
35
|
+
const appearance = normalizeAppearance(node);
|
|
36
|
+
|
|
35
37
|
return {
|
|
36
38
|
...base,
|
|
37
39
|
controlSource: normalizeControlSource(node.control_source),
|
|
40
|
+
...(appearance ? { ui: { appearance } } : {}),
|
|
38
41
|
} satisfies LeFormNode;
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { normalizeUi } from './normalize-ui';
|
|
3
|
+
|
|
4
|
+
describe('normalizeUi', () => {
|
|
5
|
+
it('returns undefined for a node without ui settings', () => {
|
|
6
|
+
expect(normalizeUi({})).toBeUndefined();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('keeps the quick filters in their order, a button without filters stays without them', () => {
|
|
10
|
+
const ui = normalizeUi({
|
|
11
|
+
quick_filters: [
|
|
12
|
+
{ label: 'all' },
|
|
13
|
+
{ label: 'domain', filters: { kind: 'domain' } },
|
|
14
|
+
{ label: 'awaiting deploy', filters: { deployed: 'awaiting deploy' } },
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
expect(ui?.quickFilters).toEqual([
|
|
19
|
+
{ label: 'all' },
|
|
20
|
+
{ label: 'domain', filters: { kind: 'domain' } },
|
|
21
|
+
{ label: 'awaiting deploy', filters: { deployed: 'awaiting deploy' } },
|
|
22
|
+
]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('leaves out an empty list of quick filters', () => {
|
|
26
|
+
expect(normalizeUi({ quick_filters: [] })).toBeUndefined();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('keeps the card appearance of a table', () => {
|
|
30
|
+
expect(normalizeUi({ appearance: 'card' })?.appearance).toBe('card');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('leaves out an appearance it does not know', () => {
|
|
34
|
+
expect(normalizeUi({ appearance: 'fancy' })).toBeUndefined();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { LeAppearance } from '../models/internal';
|
|
2
|
+
|
|
3
|
+
export const normalizeAppearance = (node: any): LeAppearance | undefined => {
|
|
4
|
+
return node.appearance === 'card' ? 'card' : undefined;
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
export const normalizeUi = (node: any) => {
|
|
2
8
|
const ui: any = {};
|
|
3
9
|
|
|
@@ -15,5 +21,18 @@ export const normalizeUi = (node: any) => {
|
|
|
15
21
|
};
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
if (node.quick_filters?.length) {
|
|
25
|
+
ui.quickFilters = node.quick_filters.map((filter: any) => ({
|
|
26
|
+
label: filter.label,
|
|
27
|
+
...(filter.filters ? { filters: filter.filters } : {}),
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const appearance = normalizeAppearance(node);
|
|
32
|
+
|
|
33
|
+
if (appearance) {
|
|
34
|
+
ui.appearance = appearance;
|
|
35
|
+
}
|
|
36
|
+
|
|
18
37
|
return Object.keys(ui).length ? ui : undefined;
|
|
19
38
|
};
|
package/src/models/internal.ts
CHANGED
|
@@ -37,6 +37,9 @@ export interface LeGridColNode extends LeBaseNode, LeContainerNode {
|
|
|
37
37
|
export interface LeFormNode extends LeBaseNode {
|
|
38
38
|
type: 'form';
|
|
39
39
|
controlSource?: LeDataSource;
|
|
40
|
+
ui?: {
|
|
41
|
+
appearance?: LeAppearance;
|
|
42
|
+
};
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
export interface LeTableNode extends LeBaseNode {
|
|
@@ -46,6 +49,8 @@ export interface LeTableNode extends LeBaseNode {
|
|
|
46
49
|
ui?: {
|
|
47
50
|
pagination?: LePagination;
|
|
48
51
|
sort?: LeSort;
|
|
52
|
+
quickFilters?: LeQuickFilter[];
|
|
53
|
+
appearance?: LeAppearance;
|
|
49
54
|
};
|
|
50
55
|
}
|
|
51
56
|
|
|
@@ -63,6 +68,21 @@ export interface LeSort {
|
|
|
63
68
|
fields: string[];
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
/**
|
|
72
|
+
* `card`: the page of a table or a form follows one page format - no empty toolbar above the content,
|
|
73
|
+
* a table titled like a form header and framed like a form card.
|
|
74
|
+
* */
|
|
75
|
+
export type LeAppearance = 'card';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A button above the table that narrows its rows: a click puts its `filters` into the request,
|
|
79
|
+
* in place of the filters of the previous button. A button without filters shows all rows.
|
|
80
|
+
* */
|
|
81
|
+
export interface LeQuickFilter {
|
|
82
|
+
label: string;
|
|
83
|
+
filters?: Record<string, string>;
|
|
84
|
+
}
|
|
85
|
+
|
|
66
86
|
export interface LeDataSource {
|
|
67
87
|
kind: string;
|
|
68
88
|
entity: string;
|
|
@@ -71,6 +91,7 @@ export interface LeDataSource {
|
|
|
71
91
|
|
|
72
92
|
export interface LeNodeActions {
|
|
73
93
|
onRowClick?: LeRowAction[];
|
|
94
|
+
onCellClick?: LeCellAction[];
|
|
74
95
|
tableActions?: LeTableAction[];
|
|
75
96
|
}
|
|
76
97
|
|
|
@@ -84,6 +105,13 @@ export interface LeRowAction {
|
|
|
84
105
|
node: LeNode;
|
|
85
106
|
}
|
|
86
107
|
|
|
108
|
+
/**
|
|
109
|
+
* A row action bound to one column: it runs on a click on that column's cell, not on the whole row.
|
|
110
|
+
* */
|
|
111
|
+
export interface LeCellAction extends LeRowAction {
|
|
112
|
+
column: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
87
115
|
export interface LeTableAction {
|
|
88
116
|
type: string;
|
|
89
117
|
label: string;
|
package/src/public-api.ts
CHANGED
|
@@ -12,12 +12,15 @@ export {
|
|
|
12
12
|
LeTableNode,
|
|
13
13
|
LeSort,
|
|
14
14
|
LePagination,
|
|
15
|
+
LeQuickFilter,
|
|
16
|
+
LeAppearance,
|
|
15
17
|
LeAction,
|
|
16
18
|
LeRowAction,
|
|
19
|
+
LeCellAction,
|
|
17
20
|
LeTableAction,
|
|
18
21
|
LeDataSource,
|
|
19
22
|
} from './models/internal';
|
|
20
23
|
export { LeApiConfigModel, LeTheme } from './models/api-config.model';
|
|
21
|
-
export { isFormNode, isChartNode, isGridNode, isTableNode, isSectionNode
|
|
24
|
+
export { isFormNode, isChartNode, isGridNode, isTableNode, isSectionNode } from './guards';
|
|
22
25
|
export { UrlFragmentBuilder } from './utils/url-fragment-builder';
|
|
23
26
|
export { decodeJwt } from './utils/decodeJwt';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { decodeJwt } from './decodeJwt';
|
|
3
|
+
|
|
4
|
+
describe('decodeJwt', () => {
|
|
5
|
+
it('should decode JWT', () => {
|
|
6
|
+
const jwt =
|
|
7
|
+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFkbWluQHBsYW5lYXN5LmNvbSIsImV4cCI6MTc4NzE2MDg2OH0.oEtdcH-PDBKvtLqrT9aJm0CEM9wgqj1SmbK4q8oGHiY';
|
|
8
|
+
const result = decodeJwt<{ email: string; exp: number }>(jwt);
|
|
9
|
+
|
|
10
|
+
expect(result.email).toBe('admin@planeasy.com');
|
|
11
|
+
expect(result.exp).toBe(1787160868);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should decode payload with URL-safe base64 chars', () => {
|
|
15
|
+
// payload: {"data":"a+b/c","n":1} encoded with -/_ and no padding
|
|
16
|
+
const jwt = 'header.eyJkYXRhIjoiYStiL2MiLCJuIjoxfQ.sig';
|
|
17
|
+
const result = decodeJwt<{ data: string; n: number }>(jwt);
|
|
18
|
+
|
|
19
|
+
expect(result.data).toBe('a+b/c');
|
|
20
|
+
expect(result.n).toBe(1);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should decode payload with UTF-8 multibyte chars', () => {
|
|
24
|
+
// payload: {"name":"Андрій"}
|
|
25
|
+
const jwt = 'header.eyJuYW1lIjoi0JDQvdC00YDRltC5In0.sig';
|
|
26
|
+
const result = decodeJwt<{ name: string }>(jwt);
|
|
27
|
+
|
|
28
|
+
expect(result.name).toBe('Андрій');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should throw when payload segment is missing', () => {
|
|
32
|
+
expect(() => decodeJwt('onlyonesegment')).toThrow('missing payload segment');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should throw when payload segment is empty', () => {
|
|
36
|
+
expect(() => decodeJwt('header..sig')).toThrow('missing payload segment');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should throw on empty string', () => {
|
|
40
|
+
expect(() => decodeJwt('')).toThrow('missing payload segment');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should throw when payload is not valid JSON', () => {
|
|
44
|
+
// "not json" base64url-encoded → decodes fine but JSON.parse fails
|
|
45
|
+
const jwt = 'header.bm90IGpzb24.sig';
|
|
46
|
+
expect(() => decodeJwt(jwt)).toThrow('not valid JSON');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should throw when payload is a JSON non-object (array)', () => {
|
|
50
|
+
// payload: [1,2,3]
|
|
51
|
+
const jwt = 'header.WzEsMiwzXQ.sig';
|
|
52
|
+
expect(() => decodeJwt(jwt)).toThrow('must be an object');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should throw when payload is a JSON primitive (number)', () => {
|
|
56
|
+
// payload: 42
|
|
57
|
+
const jwt = 'header.NDI.sig';
|
|
58
|
+
expect(() => decodeJwt(jwt)).toThrow('must be an object');
|
|
59
|
+
});
|
|
60
|
+
});
|
package/src/utils/decodeJwt.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const decodeJwt = <T extends object>(token: string): T => {
|
|
|
28
28
|
throw new Error('Invalid JWT: payload is not valid JSON');
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
if (typeof parsed !== 'object' || parsed === null) {
|
|
31
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
32
32
|
throw new Error('Invalid JWT: payload must be an object');
|
|
33
33
|
}
|
|
34
34
|
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
//{
|
|
2
|
-
// "extends": "../../tsconfig.base.json",
|
|
3
|
-
// "compilerOptions": {
|
|
4
|
-
// "target": "ES2022",
|
|
5
|
-
// "module": "ESNext",
|
|
6
|
-
// "rootDir": "./src",
|
|
7
|
-
// "outDir": "./dist",
|
|
8
|
-
// "composite": true
|
|
9
|
-
// },
|
|
10
|
-
// "include": ["src"]
|
|
11
|
-
//}
|
|
12
|
-
|
|
13
1
|
{
|
|
14
2
|
"compilerOptions": {
|
|
15
3
|
"target": "ES2022",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeConfig.d.ts","sourceRoot":"","sources":["../../src/adapter/normalizeConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,MAAM,EAAe,MAAM,oBAAoB,CAAC;AAQrE,eAAO,MAAM,eAAe,QAAS,GAAG,KAAG,MAE1C,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { v7 as uuid } from 'uuid';
|
|
2
|
-
import { isContainer } from '../utils/isContainer';
|
|
3
|
-
import { extractLayout } from '../utils/extractLayout';
|
|
4
|
-
import { normalizeDataSource } from '../utils/normalize-data-source';
|
|
5
|
-
import { normalizeControlSource } from '../utils/normalize-control-source';
|
|
6
|
-
import { normalizeActions } from '../utils/normalize-actions';
|
|
7
|
-
import { normalizeUi } from '../utils/normalize-ui';
|
|
8
|
-
export const normalizeConfig = (raw) => {
|
|
9
|
-
return normalizeNode(raw);
|
|
10
|
-
};
|
|
11
|
-
function normalizeNode(node) {
|
|
12
|
-
const id = node.id || uuid();
|
|
13
|
-
const base = {
|
|
14
|
-
id,
|
|
15
|
-
type: node.type,
|
|
16
|
-
title: node.title || undefined,
|
|
17
|
-
};
|
|
18
|
-
// container nodes
|
|
19
|
-
if (isContainer(node)) {
|
|
20
|
-
return {
|
|
21
|
-
...base,
|
|
22
|
-
kind: 'container',
|
|
23
|
-
isParentMenu: node.type === 'section' && (node.elements?.length ?? 0) > 1,
|
|
24
|
-
children: (node.elements || []).map(normalizeNode),
|
|
25
|
-
layout: extractLayout(node),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
if (node.type === 'form') {
|
|
29
|
-
return {
|
|
30
|
-
...base,
|
|
31
|
-
controlSource: normalizeControlSource(node.control_source),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
if (node.type === 'table') {
|
|
35
|
-
return {
|
|
36
|
-
...base,
|
|
37
|
-
dataSource: normalizeDataSource(node.data_source),
|
|
38
|
-
actions: normalizeActions(node),
|
|
39
|
-
ui: normalizeUi(node),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (node.type === 'chart') {
|
|
43
|
-
return {
|
|
44
|
-
...base,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
throw new Error(`Unknown type ${node.type}`);
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=normalizeConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeConfig.js","sourceRoot":"","sources":["../../src/adapter/normalizeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAQ,EAAU,EAAE;IAClD,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,SAAS,aAAa,CAAC,IAAS;IAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC;IAE7B,MAAM,IAAI,GAAG;QACX,EAAE;QACF,IAAI,EAAE,IAAI,CAAC,IAA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,CAAC;AAqC1E,eAAO,MAAM,gBAAgB,SAAU,GAAG,KAAG,aAAa,GAAG,SAkB5D,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { normalizeControlSource } from './normalize-control-source';
|
|
2
|
-
const normalizeAction = (action) => {
|
|
3
|
-
return {
|
|
4
|
-
type: action.type,
|
|
5
|
-
dataSource: normalizeControlSource(action.control_source),
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
const normalizeRowAction = (action) => {
|
|
9
|
-
if (!action.content && !action.control_source) {
|
|
10
|
-
throw new Error(`Row action of type "${action.type}" is missing required "content" property`);
|
|
11
|
-
}
|
|
12
|
-
if (action.control_source) {
|
|
13
|
-
return {
|
|
14
|
-
type: action.type,
|
|
15
|
-
node: {
|
|
16
|
-
id: '',
|
|
17
|
-
type: 'form',
|
|
18
|
-
controlSource: normalizeControlSource(action.control_source),
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
type: action.type,
|
|
24
|
-
node: {
|
|
25
|
-
id: action.id,
|
|
26
|
-
// title: action.title,
|
|
27
|
-
type: action.content.content_type,
|
|
28
|
-
controlSource: normalizeControlSource(action.content.control_source),
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export const normalizeActions = (node) => {
|
|
33
|
-
const result = {};
|
|
34
|
-
if (node.on_row_click) {
|
|
35
|
-
result.onRowClick = node.on_row_click.map(normalizeRowAction);
|
|
36
|
-
}
|
|
37
|
-
if (node.table_actions) {
|
|
38
|
-
result.tableActions = node.table_actions.map((action) => ({
|
|
39
|
-
type: action.type,
|
|
40
|
-
name: action.name,
|
|
41
|
-
label: action.label,
|
|
42
|
-
hideLabel: action.hideLabel,
|
|
43
|
-
actions: action.actions.map(normalizeAction),
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
return Object.keys(result).length ? result : undefined;
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=normalize-actions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-actions.js","sourceRoot":"","sources":["../../src/utils/normalize-actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,eAAe,GAAG,CAAC,MAAW,EAAY,EAAE;IAChD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,UAAU,EAAE,sBAAsB,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1D,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,MAAW,EAAe,EAAE;IACtD,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,CAAC,IAAI,0CAA0C,CAAC,CAAC;IAChG,CAAC;IAED,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE;gBACJ,EAAE,EAAE,EAAE;gBACN,IAAI,EAAE,MAAM;gBACZ,aAAa,EAAE,sBAAsB,CAAC,MAAM,CAAC,cAAc,CAAC;aAC7D;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE;YACJ,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,uBAAuB;YACvB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY;YACjC,aAAa,EAAE,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;SACrE;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAS,EAA6B,EAAE;IACvE,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC;YAC7D,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;SAC7C,CAAC,CAAC,CAAC;IACN,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-control-source.d.ts","sourceRoot":"","sources":["../../src/utils/normalize-control-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAO,MAAM,sBAAsB,OAAQ,GAAG,KAAG,YAAY,GAAG,SAgB/D,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { normalizeDataSource } from './normalize-data-source';
|
|
2
|
-
export const normalizeControlSource = (cs) => {
|
|
3
|
-
if (!cs)
|
|
4
|
-
return undefined;
|
|
5
|
-
if (cs.type === 'dynamic') {
|
|
6
|
-
return normalizeDataSource(cs.dynamic_value);
|
|
7
|
-
}
|
|
8
|
-
if (cs.type === 'static') {
|
|
9
|
-
return {
|
|
10
|
-
kind: 'static',
|
|
11
|
-
entity: 'static',
|
|
12
|
-
params: cs.static_value,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=normalize-control-source.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-control-source.js","sourceRoot":"","sources":["../../src/utils/normalize-control-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAO,EAA4B,EAAE;IAC1E,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAE1B,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,mBAAmB,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,EAAE,CAAC,YAAY;SACxB,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-data-source.d.ts","sourceRoot":"","sources":["../../src/utils/normalize-data-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,eAAO,MAAM,mBAAmB,OAAQ,GAAG,KAAG,YAAY,GAAG,SAQ5D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-data-source.js","sourceRoot":"","sources":["../../src/utils/normalize-data-source.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAO,EAA4B,EAAE;IACvE,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAE1B,OAAO;QACL,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,MAAM,EAAE,EAAE,CAAC,WAAW;QACtB,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,SAAS;KAC7B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-ui.d.ts","sourceRoot":"","sources":["../../src/utils/normalize-ui.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,SAAU,GAAG,QAkBpC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const normalizeUi = (node) => {
|
|
2
|
-
const ui = {};
|
|
3
|
-
if (node.pagination?.enabled) {
|
|
4
|
-
ui.pagination = {
|
|
5
|
-
pageSize: node.pagination.default_page_size,
|
|
6
|
-
options: node.pagination.page_size_options,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (node.sort?.enabled && node.sort?.sortable_fields?.length) {
|
|
10
|
-
ui.sort = {
|
|
11
|
-
default: node.sort.default_sort,
|
|
12
|
-
fields: node.sort.sortable_fields,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return Object.keys(ui).length ? ui : undefined;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=normalize-ui.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-ui.js","sourceRoot":"","sources":["../../src/utils/normalize-ui.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAS,EAAE,EAAE;IACvC,MAAM,EAAE,GAAQ,EAAE,CAAC;IAEnB,IAAI,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;QAC7B,EAAE,CAAC,UAAU,GAAG;YACd,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB;YAC3C,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB;SAC3C,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;QAC7D,EAAE,CAAC,IAAI,GAAG;YACR,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YAC/B,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe;SAClC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeActions.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,aAAa,EAAe,MAAM,oBAAoB,CAAC;AAsB1E,eAAO,MAAM,gBAAgB,SAAU,GAAG,KAAG,aAAa,GAAG,SAkB5D,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { normalizeControlSource } from './normalizeControlSource';
|
|
2
|
-
const normalizeAction = (action) => {
|
|
3
|
-
return {
|
|
4
|
-
type: action.type,
|
|
5
|
-
dataSource: normalizeControlSource(action.control_source),
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
const normalizeRowAction = (action) => {
|
|
9
|
-
return {
|
|
10
|
-
type: action.type,
|
|
11
|
-
node: {
|
|
12
|
-
id: action.id,
|
|
13
|
-
// title: action.title,
|
|
14
|
-
type: action.content.content_type,
|
|
15
|
-
controlSource: normalizeControlSource(action.content.control_source),
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export const normalizeActions = (node) => {
|
|
20
|
-
const result = {};
|
|
21
|
-
if (node.on_row_click) {
|
|
22
|
-
result.onRowClick = node.on_row_click.map(normalizeRowAction);
|
|
23
|
-
}
|
|
24
|
-
if (node.table_actions) {
|
|
25
|
-
result.tableActions = node.table_actions.map((action) => ({
|
|
26
|
-
type: action.type,
|
|
27
|
-
name: action.name,
|
|
28
|
-
label: action.label,
|
|
29
|
-
hideLabel: action.hideLabel,
|
|
30
|
-
actions: action.actions.map(normalizeAction),
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
return Object.keys(result).length ? result : undefined;
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=normalizeActions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeActions.js","sourceRoot":"","sources":["../../src/utils/normalizeActions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,eAAe,GAAG,CAAC,MAAW,EAAY,EAAE;IAChD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,UAAU,EAAE,sBAAsB,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1D,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,MAAW,EAAe,EAAE;IACtD,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE;YACJ,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,uBAAuB;YACvB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY;YACjC,aAAa,EAAE,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;SACrE;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAS,EAA6B,EAAE;IACvE,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC;YAC7D,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;SAC7C,CAAC,CAAC,CAAC;IACN,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeControlSource.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeControlSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAO,MAAM,sBAAsB,OAAQ,GAAG,KAAG,YAAY,GAAG,SAgB/D,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { normalizeDataSource } from './normalizeDataSource';
|
|
2
|
-
export const normalizeControlSource = (cs) => {
|
|
3
|
-
if (!cs)
|
|
4
|
-
return undefined;
|
|
5
|
-
if (cs.type === 'dynamic') {
|
|
6
|
-
return normalizeDataSource(cs.dynamic_value);
|
|
7
|
-
}
|
|
8
|
-
if (cs.type === 'static') {
|
|
9
|
-
return {
|
|
10
|
-
kind: 'static',
|
|
11
|
-
entity: 'static',
|
|
12
|
-
params: cs.static_value,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=normalizeControlSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeControlSource.js","sourceRoot":"","sources":["../../src/utils/normalizeControlSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAO,EAA4B,EAAE;IAC1E,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAE1B,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,mBAAmB,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,EAAE,CAAC,YAAY;SACxB,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeDataSource.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeDataSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,eAAO,MAAM,mBAAmB,OAAQ,GAAG,KAAG,YAAY,GAAG,SAQ5D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeDataSource.js","sourceRoot":"","sources":["../../src/utils/normalizeDataSource.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAO,EAA4B,EAAE;IACvE,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAE1B,OAAO;QACL,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,MAAM,EAAE,EAAE,CAAC,WAAW;QACtB,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,SAAS;KAC7B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeUI.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeUI.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,SAAU,GAAG,QAkBpC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const normalizeUI = (node) => {
|
|
2
|
-
const ui = {};
|
|
3
|
-
if (node.pagination?.enabled) {
|
|
4
|
-
ui.pagination = {
|
|
5
|
-
pageSize: node.pagination.default_page_size,
|
|
6
|
-
options: node.pagination.page_size_options,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
if (node.sort?.enabled && node.sort?.sortable_fields?.length) {
|
|
10
|
-
ui.sort = {
|
|
11
|
-
default: node.sort.default_sort,
|
|
12
|
-
fields: node.sort.sortable_fields,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return Object.keys(ui).length ? ui : undefined;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=normalizeUI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeUI.js","sourceRoot":"","sources":["../../src/utils/normalizeUI.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAS,EAAE,EAAE;IACvC,MAAM,EAAE,GAAQ,EAAE,CAAC;IAEnB,IAAI,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;QAC7B,EAAE,CAAC,UAAU,GAAG;YACd,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB;YAC3C,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB;SAC3C,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;QAC7D,EAAE,CAAC,IAAI,GAAG;YACR,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YAC/B,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe;SAClC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare class UrlFragmentBuilder {
|
|
2
|
-
private urlFragments;
|
|
3
|
-
private queryFragments;
|
|
4
|
-
constructor(fragment?: string | string[]);
|
|
5
|
-
setFragment(fragment: string | string[]): UrlFragmentBuilder;
|
|
6
|
-
setQuery(query: string): UrlFragmentBuilder;
|
|
7
|
-
build(): string;
|
|
8
|
-
private buildUrlFragments;
|
|
9
|
-
private buildQueryFragments;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=urlFragmantBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"urlFragmantBuilder.d.ts","sourceRoot":"","sources":["../../src/utils/urlFragmantBuilder.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,cAAc,CAAgB;gBAE1B,QAAQ,GAAE,MAAM,GAAG,MAAM,EAAO;IAI5C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,kBAAkB;IAU5D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB;IAM3C,KAAK,IAAI,MAAM;IAIf,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,mBAAmB;CAK5B"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export class UrlFragmentBuilder {
|
|
2
|
-
urlFragments = [];
|
|
3
|
-
queryFragments = [];
|
|
4
|
-
constructor(fragment = []) {
|
|
5
|
-
this.setFragment(fragment);
|
|
6
|
-
}
|
|
7
|
-
setFragment(fragment) {
|
|
8
|
-
if (Array.isArray(fragment)) {
|
|
9
|
-
this.urlFragments.push(...fragment);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
this.urlFragments.push(fragment);
|
|
13
|
-
}
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
setQuery(query) {
|
|
17
|
-
this.queryFragments.push(query);
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
build() {
|
|
21
|
-
return this.buildUrlFragments() + this.buildQueryFragments();
|
|
22
|
-
}
|
|
23
|
-
buildUrlFragments() {
|
|
24
|
-
return this.urlFragments
|
|
25
|
-
.filter((item) => !!item)
|
|
26
|
-
.map((item) => (item.startsWith('/') ? item.slice(1) : item))
|
|
27
|
-
.join('/');
|
|
28
|
-
}
|
|
29
|
-
buildQueryFragments() {
|
|
30
|
-
const query = this.queryFragments.filter((item) => !!item).join('&');
|
|
31
|
-
return query ? `?${query}` : '';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=urlFragmantBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"urlFragmantBuilder.js","sourceRoot":"","sources":["../../src/utils/urlFragmantBuilder.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAkB;IACrB,YAAY,GAAa,EAAE,CAAC;IAC5B,cAAc,GAAa,EAAE,CAAC;IAEtC,YAAY,WAA8B,EAAE;QAC1C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,WAAW,CAAC,QAA2B;QACrC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAEhC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,iBA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