@planeasyinc/le-core 0.0.11 → 0.0.12

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.
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > @planeasyinc/le-core@0.0.10 build /Users/yefimenko/Work/amsdal/form-engine/packages/le-core
3
+ > @planeasyinc/le-core@0.0.12 build /Users/yefimenko/Work/amsdal/form-engine/packages/le-core
4
4
  > tsc -p tsconfig.json
5
5
 
@@ -1,5 +1,4 @@
1
-
2
- 
3
- > @planeasyinc/le-core@0.0.10 lint /Users/yefimenko/Work/amsdal/form-engine/packages/le-core
4
- > eslint src
5
-
1
+
2
+ > @planeasyinc/le-core@0.0.11 lint /Users/yefimenko/Work/amsdal/form-engine/packages/le-core
3
+ > eslint src
4
+
@@ -1,72 +1,36 @@
1
-
2
- 
3
- > @planeasyinc/le-core@0.0.10 test /Users/yefimenko/Work/amsdal/form-engine/packages/le-core
4
- > vitest --run
5
-
6
- [?25l▲ [WARNING] The condition "path" here will never be used as it comes after both "import" and "require" [package.json]
7
-
8
- package.json:13:6:
9
-  13 │ "path": "./dist/public-api.d.ts"
10
- ╵ ~~~~~~
11
-
12
- The "import" condition comes earlier and will be used for all "import" statements:
13
-
14
- package.json:11:6:
15
-  11 │ "import": "./dist/public-api.js",
16
- ╵ ~~~~~~~~
17
-
18
- The "require" condition comes earlier and will be used for all "require" calls:
19
-
20
- package.json:12:6:
21
-  12 │ "require": "./dist/public-api.cjs",
22
- ╵ ~~~~~~~~~
23
-
24
-
25
-  RUN  v4.1.11 /Users/yefimenko/Work/amsdal/form-engine/packages/le-core
26
-
27
- [?2026h
28
-  ❯ src/utils/decodeJwt.test.ts [queued]
29
-
30
-  Test Files 0 passed (5)
31
-  Tests 0 passed (0)
32
-  Start at 16:36:37
33
-  Duration 926ms
34
- [?2026l[?2026h
35
-  ❯ src/adapter/normalize-ui.test.ts [queued]
36
-  ❯ src/utils/decodeJwt.test.ts [queued]
37
-
38
-  Test Files 0 passed (5)
39
-  Tests 0 passed (0)
40
-  Start at 16:36:37
41
-  Duration 1.09s
42
- [?2026l[?2026h ✓ src/utils/url-fragment-builder.test.ts (2 tests) 5ms
43
-
44
-  ❯ src/adapter/normalize-actions.test.ts [queued]
45
-  ❯ src/adapter/normalize-config.test.ts [queued]
46
-  ❯ src/adapter/normalize-ui.test.ts [queued]
47
-  ❯ src/utils/decodeJwt.test.ts 0/9
48
-
49
-  Test Files 1 passed (5)
50
-  Tests 2 passed (11)
51
-  Start at 16:36:37
52
-  Duration 1.57s
53
- [?2026l[?2026h ✓ src/utils/decodeJwt.test.ts (9 tests) 10ms
54
-
55
-  ❯ src/adapter/normalize-actions.test.ts [queued]
56
-  ❯ src/adapter/normalize-config.test.ts [queued]
57
-  ❯ src/adapter/normalize-ui.test.ts 0/5
58
-
59
-  Test Files 2 passed (5)
60
-  Tests 11 passed (16)
61
-  Start at 16:36:37
62
-  Duration 1.68s
63
- [?2026l ✓ src/adapter/normalize-ui.test.ts (5 tests) 7ms
64
- ✓ src/adapter/normalize-actions.test.ts (3 tests) 7ms
65
- ✓ src/adapter/normalize-config.test.ts (2 tests) 5ms
66
-
67
-  Test Files  5 passed (5)
68
-  Tests  21 passed (21)
69
-  Start at  16:36:37
70
-  Duration  1.75s (transform 1.13s, setup 0ms, import 2.16s, tests 34ms, environment 1ms)
71
-
72
- [?25h
1
+
2
+ > @planeasyinc/le-core@0.0.11 test /Users/yefimenko/Work/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
+  RUN  v4.1.11 /Users/yefimenko/Work/amsdal/form-engine/packages/le-core
25
+
26
+ ✓ src/adapter/normalize-ui.test.ts (5 tests) 9ms
27
+ ✓ src/utils/url-fragment-builder.test.ts (2 tests) 6ms
28
+ ✓ src/utils/decodeJwt.test.ts (9 tests) 17ms
29
+ ✓ src/adapter/normalize-actions.test.ts (3 tests) 11ms
30
+ ✓ src/adapter/normalize-config.test.ts (9 tests) 15ms
31
+
32
+  Test Files  5 passed (5)
33
+  Tests  28 passed (28)
34
+  Start at  18:01:58
35
+  Duration  1.09s (transform 805ms, setup 0ms, import 1.16s, tests 57ms, environment 1ms)
36
+
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-config.d.ts","sourceRoot":"","sources":["../../src/adapter/normalize-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,MAAM,EAAe,MAAM,oBAAoB,CAAC;AAQrE,eAAO,MAAM,eAAe,QAAS,GAAG,KAAG,MAE1C,CAAC"}
1
+ {"version":3,"file":"normalize-config.d.ts","sourceRoot":"","sources":["../../src/adapter/normalize-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,MAAM,EAAe,MAAM,oBAAoB,CAAC;AASrE,eAAO,MAAM,eAAe,QAAS,GAAG,KAAG,MAE1C,CAAC"}
@@ -5,6 +5,7 @@ import { normalizeDataSource } from './normalize-data-source';
5
5
  import { normalizeControlSource } from './normalize-control-source';
6
6
  import { normalizeActions } from './normalize-actions';
7
7
  import { normalizeAppearance, normalizeUi } from './normalize-ui';
8
+ import { normalizeDocumentation } from './normalize-documentation';
8
9
  export const normalizeConfig = (raw) => {
9
10
  return normalizeNode(raw);
10
11
  };
@@ -29,6 +30,7 @@ function normalizeNode(node) {
29
30
  const appearance = normalizeAppearance(node);
30
31
  return {
31
32
  ...base,
33
+ ...normalizeDocumentation(node),
32
34
  controlSource: normalizeControlSource(node.control_source),
33
35
  ...(appearance ? { ui: { appearance } } : {}),
34
36
  };
@@ -36,6 +38,7 @@ function normalizeNode(node) {
36
38
  if (node.type === 'table') {
37
39
  return {
38
40
  ...base,
41
+ ...normalizeDocumentation(node),
39
42
  dataSource: normalizeDataSource(node.data_source),
40
43
  actions: normalizeActions(node),
41
44
  ui: normalizeUi(node),
@@ -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,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElE,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,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;KAC/B,CAAC;IAEF,kBAAkB;IAClB,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,WAAW;YACjB,YAAY,EAAE,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAA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C,IAAI,CAAC,cAAc,CAAC;YAC1D,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,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,GAAG,sBAAsB,CAAC,IAAI,CAAC;YAC/B,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"}
@@ -0,0 +1,7 @@
1
+ import { LeDocumented } from '../models/internal';
2
+ /**
3
+ * The documentation of a table or a form node: only the fields it really has, so a node of a
4
+ * stored dashboard or an older backend, which sends neither, comes out as it did before.
5
+ * */
6
+ export declare const normalizeDocumentation: (node: any) => LeDocumented;
7
+ //# sourceMappingURL=normalize-documentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-documentation.d.ts","sourceRoot":"","sources":["../../src/adapter/normalize-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAkBtE;;;KAGK;AACL,eAAO,MAAM,sBAAsB,SAAU,GAAG,KAAG,YAQlD,CAAC"}
@@ -0,0 +1,24 @@
1
+ const KINDS = ['model', 'transaction'];
2
+ const text = (value) => {
3
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
4
+ };
5
+ const normalizeDocumentationRef = (raw) => {
6
+ const name = text(raw?.name);
7
+ if (!name || !KINDS.includes(raw.kind))
8
+ return undefined;
9
+ const provider = text(raw.provider);
10
+ return { kind: raw.kind, name, ...(provider ? { provider } : {}) };
11
+ };
12
+ /**
13
+ * The documentation of a table or a form node: only the fields it really has, so a node of a
14
+ * stored dashboard or an older backend, which sends neither, comes out as it did before.
15
+ * */
16
+ export const normalizeDocumentation = (node) => {
17
+ const description = text(node.description);
18
+ const documentation = normalizeDocumentationRef(node.documentation);
19
+ return {
20
+ ...(description ? { description } : {}),
21
+ ...(documentation ? { documentation } : {}),
22
+ };
23
+ };
24
+ //# sourceMappingURL=normalize-documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-documentation.js","sourceRoot":"","sources":["../../src/adapter/normalize-documentation.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAA8C,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAElF,MAAM,IAAI,GAAG,CAAC,KAAc,EAAsB,EAAE;IAClD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAAC,GAAQ,EAAkC,EAAE;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAE7B,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAEzD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEpC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACrE,CAAC,CAAC;AAEF;;;KAGK;AACL,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAS,EAAgB,EAAE;IAChE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,yBAAyB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEpE,OAAO;QACL,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC;AACJ,CAAC,CAAC"}
@@ -25,7 +25,24 @@ export interface LeGridNode extends LeBaseNode, LeContainerNode {
25
25
  export interface LeGridColNode extends LeBaseNode, LeContainerNode {
26
26
  type: 'grid_col';
27
27
  }
28
- export interface LeFormNode extends LeBaseNode {
28
+ /**
29
+ * Where the full documentation of a model or a transaction comes from: the transaction `provider`
30
+ * (`get_documentation_form` when absent) answers `{ kind, name }` with a form for the side panel.
31
+ * */
32
+ export interface LeDocumentationRef {
33
+ kind: 'model' | 'transaction';
34
+ name: string;
35
+ provider?: string;
36
+ }
37
+ /**
38
+ * The documentation a table or a form carries: `description` is one line of plain text drawn
39
+ * under the title, never as HTML; `documentation` puts an info button next to the title.
40
+ * */
41
+ export interface LeDocumented {
42
+ description?: string;
43
+ documentation?: LeDocumentationRef;
44
+ }
45
+ export interface LeFormNode extends LeBaseNode, LeDocumented {
29
46
  type: 'form';
30
47
  controlSource?: LeDataSource;
31
48
  onRender?: FeControlAction[];
@@ -34,7 +51,7 @@ export interface LeFormNode extends LeBaseNode {
34
51
  appearance?: LeAppearance;
35
52
  };
36
53
  }
37
- export interface LeTableNode extends LeBaseNode {
54
+ export interface LeTableNode extends LeBaseNode, LeDocumented {
38
55
  type: 'table';
39
56
  dataSource?: LeDataSource;
40
57
  act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AAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,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"}
@@ -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, LeQuickFilter, LeAppearance, LeAction, LeRowAction, LeCellAction, LeTableAction, LeDataSource, } from './models/internal';
5
+ export { LeNode, LeSectionNode, LeGridNode, LeGridColNode, LeChartNode, LeFormNode, LeTableNode, LeSort, LePagination, LeQuickFilter, LeAppearance, LeAction, LeRowAction, LeCellAction, LeTableAction, LeDataSource, LeDocumentationRef, LeDocumented, } 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';
@@ -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,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"}
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,EACZ,kBAAkB,EAClB,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"}
@@ -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;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"}
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;AAsB/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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planeasyinc/le-core",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/public-api.jcs",
@@ -23,7 +23,7 @@
23
23
  "typescript": "5.6.3",
24
24
  "@types/node": "18.15.3",
25
25
  "@types/web": "0.0.347",
26
- "@planeasyinc/fe-core": "0.1.36"
26
+ "@planeasyinc/fe-core": "0.1.40"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsc -p tsconfig.json",
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect } from 'vitest';
2
2
  import { normalizeConfig } from './normalize-config';
3
- import { LeFormNode } from '../models/internal';
3
+ import { LeFormNode, LeTableNode } from '../models/internal';
4
4
 
5
5
  const form = (extra: Record<string, unknown> = {}) => {
6
6
  return normalizeConfig({
@@ -24,3 +24,62 @@ describe('normalizeConfig — form', () => {
24
24
  expect(form({ appearance: 'fancy' }).ui).toBeUndefined();
25
25
  });
26
26
  });
27
+
28
+ const table = (extra: Record<string, unknown> = {}) => {
29
+ return normalizeConfig({
30
+ id: 'cls-Deal',
31
+ type: 'table',
32
+ title: 'Deal',
33
+ data_source: { type: 'class', entity_name: 'Deal' },
34
+ ...extra,
35
+ }) as LeTableNode;
36
+ };
37
+
38
+ const DEAL_DOCUMENTATION = { kind: 'model', name: 'Deal', provider: 'get_documentation_form' };
39
+
40
+ describe('normalizeConfig — documentation', () => {
41
+ it('keeps the description and the documentation reference of a table', () => {
42
+ const node = table({ description: 'A sales opportunity.', documentation: DEAL_DOCUMENTATION });
43
+
44
+ expect(node.description).toBe('A sales opportunity.');
45
+ expect(node.documentation).toEqual(DEAL_DOCUMENTATION);
46
+ });
47
+
48
+ it('keeps the description and the documentation reference of a form', () => {
49
+ const node = form({
50
+ description: 'Close a deal.',
51
+ documentation: { kind: 'transaction', name: 'close_deal' },
52
+ });
53
+
54
+ expect(node.description).toBe('Close a deal.');
55
+ expect(node.documentation).toEqual({ kind: 'transaction', name: 'close_deal' });
56
+ });
57
+
58
+ it('adds no documentation keys to a node of a stored dashboard, which sends neither field', () => {
59
+ expect('description' in table()).toBe(false);
60
+ expect('documentation' in table()).toBe(false);
61
+ expect('description' in form()).toBe(false);
62
+ expect('documentation' in form()).toBe(false);
63
+ });
64
+
65
+ it('keeps the description text as it is, HTML included, for the view to draw as text', () => {
66
+ expect(table({ description: '<b>bold</b> deal' }).description).toBe('<b>bold</b> deal');
67
+ });
68
+
69
+ it('drops a blank or non-text description, so no empty line is drawn', () => {
70
+ expect(table({ description: ' ' }).description).toBeUndefined();
71
+ expect(table({ description: 42 }).description).toBeUndefined();
72
+ });
73
+
74
+ it('drops a documentation reference without a name or with an unknown kind', () => {
75
+ expect(table({ documentation: { kind: 'model' } }).documentation).toBeUndefined();
76
+ expect(table({ documentation: { kind: 'class', name: 'Deal' } }).documentation).toBeUndefined();
77
+ expect(table({ documentation: 'Deal' }).documentation).toBeUndefined();
78
+ });
79
+
80
+ it('leaves the provider out when it is blank, so the default transaction is used', () => {
81
+ expect(
82
+ table({ documentation: { kind: 'model', name: 'Deal', provider: '' } }).documentation,
83
+ ).toEqual({ kind: 'model', name: 'Deal' });
84
+ });
85
+ });
@@ -6,6 +6,7 @@ import { normalizeDataSource } from './normalize-data-source';
6
6
  import { normalizeControlSource } from './normalize-control-source';
7
7
  import { normalizeActions } from './normalize-actions';
8
8
  import { normalizeAppearance, normalizeUi } from './normalize-ui';
9
+ import { normalizeDocumentation } from './normalize-documentation';
9
10
 
10
11
  export const normalizeConfig = (raw: any): LeNode => {
11
12
  return normalizeNode(raw);
@@ -36,6 +37,7 @@ function normalizeNode(node: any): LeNode {
36
37
 
37
38
  return {
38
39
  ...base,
40
+ ...normalizeDocumentation(node),
39
41
  controlSource: normalizeControlSource(node.control_source),
40
42
  ...(appearance ? { ui: { appearance } } : {}),
41
43
  } satisfies LeFormNode;
@@ -44,6 +46,7 @@ function normalizeNode(node: any): LeNode {
44
46
  if (node.type === 'table') {
45
47
  return {
46
48
  ...base,
49
+ ...normalizeDocumentation(node),
47
50
  dataSource: normalizeDataSource(node.data_source),
48
51
  actions: normalizeActions(node),
49
52
  ui: normalizeUi(node),
@@ -0,0 +1,31 @@
1
+ import { LeDocumentationRef, LeDocumented } from '../models/internal';
2
+
3
+ const KINDS: ReadonlyArray<LeDocumentationRef['kind']> = ['model', 'transaction'];
4
+
5
+ const text = (value: unknown): string | undefined => {
6
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
7
+ };
8
+
9
+ const normalizeDocumentationRef = (raw: any): LeDocumentationRef | undefined => {
10
+ const name = text(raw?.name);
11
+
12
+ if (!name || !KINDS.includes(raw.kind)) return undefined;
13
+
14
+ const provider = text(raw.provider);
15
+
16
+ return { kind: raw.kind, name, ...(provider ? { provider } : {}) };
17
+ };
18
+
19
+ /**
20
+ * The documentation of a table or a form node: only the fields it really has, so a node of a
21
+ * stored dashboard or an older backend, which sends neither, comes out as it did before.
22
+ * */
23
+ export const normalizeDocumentation = (node: any): LeDocumented => {
24
+ const description = text(node.description);
25
+ const documentation = normalizeDocumentationRef(node.documentation);
26
+
27
+ return {
28
+ ...(description ? { description } : {}),
29
+ ...(documentation ? { documentation } : {}),
30
+ };
31
+ };
@@ -38,7 +38,26 @@ export interface LeGridColNode extends LeBaseNode, LeContainerNode {
38
38
  type: 'grid_col';
39
39
  }
40
40
 
41
- export interface LeFormNode extends LeBaseNode {
41
+ /**
42
+ * Where the full documentation of a model or a transaction comes from: the transaction `provider`
43
+ * (`get_documentation_form` when absent) answers `{ kind, name }` with a form for the side panel.
44
+ * */
45
+ export interface LeDocumentationRef {
46
+ kind: 'model' | 'transaction';
47
+ name: string;
48
+ provider?: string;
49
+ }
50
+
51
+ /**
52
+ * The documentation a table or a form carries: `description` is one line of plain text drawn
53
+ * under the title, never as HTML; `documentation` puts an info button next to the title.
54
+ * */
55
+ export interface LeDocumented {
56
+ description?: string;
57
+ documentation?: LeDocumentationRef;
58
+ }
59
+
60
+ export interface LeFormNode extends LeBaseNode, LeDocumented {
42
61
  type: 'form';
43
62
  controlSource?: LeDataSource;
44
63
  onRender?: FeControlAction[];
@@ -48,7 +67,7 @@ export interface LeFormNode extends LeBaseNode {
48
67
  };
49
68
  }
50
69
 
51
- export interface LeTableNode extends LeBaseNode {
70
+ export interface LeTableNode extends LeBaseNode, LeDocumented {
52
71
  type: 'table';
53
72
  dataSource?: LeDataSource;
54
73
  actions?: LeNodeActions;
package/src/public-api.ts CHANGED
@@ -19,6 +19,8 @@ export {
19
19
  LeCellAction,
20
20
  LeTableAction,
21
21
  LeDataSource,
22
+ LeDocumentationRef,
23
+ LeDocumented,
22
24
  } from './models/internal';
23
25
  export { LeApiConfigModel, LeTheme } from './models/api-config.model';
24
26
  export { isFormNode, isChartNode, isGridNode, isTableNode, isSectionNode } from './guards';