@dforge-core/metadata 0.0.12 → 0.0.14

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/index.d.ts +1251 -28
  3. package/dist/index.js +418 -32
  4. package/dist/index.js.map +1 -1
  5. package/package.json +60 -58
  6. package/schemas/data_views.schema.json +16 -3
  7. package/schemas/folders.schema.json +18 -2
  8. package/schemas/reports.schema.json +25 -4
  9. package/src/filter.ts +35 -3
  10. package/src/index.ts +10 -1
  11. package/src/reports.ts +38 -5
  12. package/dist/actions.d.ts +0 -31
  13. package/dist/actions.d.ts.map +0 -1
  14. package/dist/actions.js +0 -7
  15. package/dist/actions.js.map +0 -1
  16. package/dist/aggregation.d.ts +0 -13
  17. package/dist/aggregation.d.ts.map +0 -1
  18. package/dist/aggregation.js +0 -17
  19. package/dist/aggregation.js.map +0 -1
  20. package/dist/base-datatypes.d.ts +0 -5
  21. package/dist/base-datatypes.d.ts.map +0 -1
  22. package/dist/base-datatypes.js +0 -49
  23. package/dist/base-datatypes.js.map +0 -1
  24. package/dist/column-types.d.ts +0 -5
  25. package/dist/column-types.d.ts.map +0 -1
  26. package/dist/column-types.js +0 -18
  27. package/dist/column-types.js.map +0 -1
  28. package/dist/data-views.d.ts +0 -95
  29. package/dist/data-views.d.ts.map +0 -1
  30. package/dist/data-views.js +0 -18
  31. package/dist/data-views.js.map +0 -1
  32. package/dist/deps.d.ts +0 -55
  33. package/dist/deps.d.ts.map +0 -1
  34. package/dist/deps.js +0 -23
  35. package/dist/deps.js.map +0 -1
  36. package/dist/derive.d.ts +0 -19
  37. package/dist/derive.d.ts.map +0 -1
  38. package/dist/derive.js +0 -68
  39. package/dist/derive.js.map +0 -1
  40. package/dist/domains.d.ts +0 -32
  41. package/dist/domains.d.ts.map +0 -1
  42. package/dist/domains.js +0 -10
  43. package/dist/domains.js.map +0 -1
  44. package/dist/entity-meta.d.ts +0 -18
  45. package/dist/entity-meta.d.ts.map +0 -1
  46. package/dist/entity-meta.js +0 -45
  47. package/dist/entity-meta.js.map +0 -1
  48. package/dist/entity.d.ts +0 -116
  49. package/dist/entity.d.ts.map +0 -1
  50. package/dist/entity.js +0 -7
  51. package/dist/entity.js.map +0 -1
  52. package/dist/field-types.d.ts +0 -287
  53. package/dist/field-types.d.ts.map +0 -1
  54. package/dist/field-types.js +0 -58
  55. package/dist/field-types.js.map +0 -1
  56. package/dist/filter.d.ts +0 -26
  57. package/dist/filter.d.ts.map +0 -1
  58. package/dist/filter.js +0 -7
  59. package/dist/filter.js.map +0 -1
  60. package/dist/folders.d.ts +0 -32
  61. package/dist/folders.d.ts.map +0 -1
  62. package/dist/folders.js +0 -6
  63. package/dist/folders.js.map +0 -1
  64. package/dist/index.d.ts.map +0 -1
  65. package/dist/jobs.d.ts +0 -32
  66. package/dist/jobs.d.ts.map +0 -1
  67. package/dist/jobs.js +0 -3
  68. package/dist/jobs.js.map +0 -1
  69. package/dist/manifest.d.ts +0 -53
  70. package/dist/manifest.d.ts.map +0 -1
  71. package/dist/manifest.js +0 -4
  72. package/dist/manifest.js.map +0 -1
  73. package/dist/menus.d.ts +0 -32
  74. package/dist/menus.d.ts.map +0 -1
  75. package/dist/menus.js +0 -3
  76. package/dist/menus.js.map +0 -1
  77. package/dist/print-templates.d.ts +0 -36
  78. package/dist/print-templates.d.ts.map +0 -1
  79. package/dist/print-templates.js +0 -4
  80. package/dist/print-templates.js.map +0 -1
  81. package/dist/reports.d.ts +0 -84
  82. package/dist/reports.d.ts.map +0 -1
  83. package/dist/reports.js +0 -24
  84. package/dist/reports.js.map +0 -1
  85. package/dist/roles.d.ts +0 -10
  86. package/dist/roles.d.ts.map +0 -1
  87. package/dist/roles.js +0 -3
  88. package/dist/roles.js.map +0 -1
  89. package/dist/seed-data.d.ts +0 -8
  90. package/dist/seed-data.d.ts.map +0 -1
  91. package/dist/seed-data.js +0 -4
  92. package/dist/seed-data.js.map +0 -1
  93. package/dist/settings.d.ts +0 -26
  94. package/dist/settings.d.ts.map +0 -1
  95. package/dist/settings.js +0 -3
  96. package/dist/settings.js.map +0 -1
  97. package/dist/traits.d.ts +0 -14
  98. package/dist/traits.d.ts.map +0 -1
  99. package/dist/traits.js +0 -121
  100. package/dist/traits.js.map +0 -1
  101. package/dist/triggers.d.ts +0 -28
  102. package/dist/triggers.d.ts.map +0 -1
  103. package/dist/triggers.js +0 -3
  104. package/dist/triggers.js.map +0 -1
  105. package/dist/types.d.ts +0 -128
  106. package/dist/types.d.ts.map +0 -1
  107. package/dist/types.js +0 -7
  108. package/dist/types.js.map +0 -1
  109. package/dist/webhooks.d.ts +0 -31
  110. package/dist/webhooks.d.ts.map +0 -1
  111. package/dist/webhooks.js +0 -3
  112. package/dist/webhooks.js.map +0 -1
@@ -1,95 +0,0 @@
1
- import type { Filter } from "./filter";
2
- import type { NamedKind } from "./types";
3
- export type { NamedKind };
4
- /** `viewType` values for `ui/data_views.json`. Source: data_views.schema.json. */
5
- export type ViewType = "grid" | "list" | "kanban" | "calendar" | "gallery" | "tree-grid" | "diagram" | "master-detail" | "library" | "matrix";
6
- /** Friendly picker list of the view kinds. */
7
- export declare const dataViewKinds: readonly NamedKind[];
8
- /** A column in a data source: shorthand string code or a configured object. */
9
- export type ViewColumn = string | {
10
- /** Column code. */
11
- column_cd: string;
12
- /** Column width in pixels. */
13
- width?: number;
14
- /** Whether the column is visible (default true). */
15
- visible?: boolean;
16
- /** Pin column to an edge. */
17
- pinned?: "left" | "right";
18
- };
19
- /** One data source within a view. */
20
- export interface DataSource {
21
- /** Entity code to query. */
22
- entityCode: string;
23
- /** Nesting level (0 = root, 1+ = detail). */
24
- level?: number;
25
- /** Human-readable label (used in master-detail tabs). */
26
- label?: string;
27
- /** Column configuration. */
28
- columns?: ViewColumn[];
29
- /** Set field on the parent entity linking to this detail level. */
30
- parentSetField?: string;
31
- /** Per-source filter; overrides the view-level filter for this source. */
32
- filter?: Filter;
33
- /** Per-source sort order (array of `{ c, d }` entries). */
34
- order?: unknown;
35
- }
36
- export interface KanbanViewConfig {
37
- /** Dropdown/flags/reference column to group cards by. */
38
- groupByField: string;
39
- }
40
- export interface CalendarViewConfig {
41
- /** Date/timestamp column used to place events. */
42
- dateField: string;
43
- /** Column shown as event title (defaults to the entity toString). */
44
- titleField?: string;
45
- /** Column whose value drives the event pill color. */
46
- colorField?: string;
47
- }
48
- export interface TreeGridViewConfig {
49
- /** Self-referencing FK column (parent record). */
50
- parentField: string;
51
- /** Node label field (defaults to entity toString). */
52
- labelField?: string;
53
- /** Field containing a Bootstrap icon class per node. */
54
- iconField?: string;
55
- }
56
- export interface ListLevelConfig {
57
- /** Entity code for this child level. */
58
- entityCode: string;
59
- /** FK column in the child entity linking back to the parent. */
60
- foreignKey: string;
61
- /** Columns to display inline for each child row. */
62
- columns?: string[];
63
- }
64
- export interface ListViewConfig {
65
- titleField?: string;
66
- subtitleField?: string;
67
- /** Hierarchical child levels for expandable list rows. */
68
- levels?: ListLevelConfig[];
69
- }
70
- export interface DiagramViewConfig {
71
- /** Column to group diagram nodes by. */
72
- groupByField?: string;
73
- /** Group values hidden by default. */
74
- defaultHiddenGroups?: string[];
75
- }
76
- /** A single data view (value in the `ui/data_views.json` map). */
77
- export interface DataViewDef {
78
- viewType: ViewType;
79
- /** Human-readable view name. */
80
- label?: string;
81
- /** Bootstrap icon class (e.g. 'bi-bounding-box'). */
82
- icon?: string;
83
- description?: string;
84
- /** Data sources (at least one; master-detail needs two). */
85
- dataSources: DataSource[];
86
- /** Default filter applied to all sources unless one declares its own. */
87
- filter?: Filter;
88
- /** Default sort order. */
89
- order?: unknown;
90
- /** View-type-specific configuration. */
91
- viewConfig?: KanbanViewConfig | CalendarViewConfig | TreeGridViewConfig | ListViewConfig | DiagramViewConfig | Record<string, unknown>;
92
- }
93
- /** A `ui/data_views.json` file: data view code → definition. */
94
- export type DataViewsFile = Record<string, DataViewDef>;
95
- //# sourceMappingURL=data-views.d.ts.map
@@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AkB,GAClB,kBAAkB,GAClB,cAAc,GACd,iBAAiB,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3B;AAED,gEAAgE;AAChE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- // Data-view registries + the authoring shape of a `ui/data_views.json` file.
2
- //
3
- // `dataViewKinds` is the friendly picker list; `DataViewDef` and friends mirror
4
- // the structural `data_views.schema.json` so editors/MCP/CLI can build views.
5
- /** Friendly picker list of the view kinds. */
6
- export const dataViewKinds = [
7
- { cd: "grid", name: "Grid" },
8
- { cd: "list", name: "List" },
9
- { cd: "kanban", name: "Kanban" },
10
- { cd: "calendar", name: "Calendar" },
11
- { cd: "gallery", name: "Gallery" },
12
- { cd: "tree-grid", name: "Tree Grid" },
13
- { cd: "diagram", name: "Diagram" },
14
- { cd: "master-detail", name: "Master / Detail" },
15
- { cd: "library", name: "Library" },
16
- { cd: "matrix", name: "Matrix" },
17
- ];
18
- //# sourceMappingURL=data-views.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-views.js","sourceRoot":"","sources":["../src/data-views.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAoB9E,8CAA8C;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAyB;IAClD,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAC5B,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAC5B,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;IACpC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE;IACtC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAChD,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAClC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;CACvB,CAAC"}
package/dist/deps.d.ts DELETED
@@ -1,55 +0,0 @@
1
- /**
2
- * Allowed storage-class tokens for a consumed column — Postgres type names with
3
- * length/scale stripped. Closed allowlist, kept in lockstep with the `type` enum in
4
- * `deps.schema.json` (and `DependencyContractValidator.ValidColumnTypes` on the C#
5
- * side); the `schemas.test.ts` parity guard fails if this drifts from the schema.
6
- * Extend all three together if a provider column legitimately uses a type not here.
7
- */
8
- export declare const DEP_COLUMN_TYPES: readonly ["int2", "int4", "int8", "smallint", "integer", "bigint", "numeric", "decimal", "float4", "float8", "real", "money", "varchar", "text", "char", "bpchar", "bool", "boolean", "date", "time", "timetz", "timestamp", "timestamptz", "uuid", "json", "jsonb", "bytea"];
9
- /**
10
- * Storage class pinned for a consumed column — the provider's physical Postgres type
11
- * with length/scale stripped (e.g. `int8`, `numeric`, `varchar`). dForge's `cuid`
12
- * Snowflake PK normalizes to `int8`. Pinning the storage class (not a coarse base
13
- * type) keeps FK/lookup compatibility meaningful — an `int8` key needs `int8`, not
14
- * any number. One of {@link DEP_COLUMN_TYPES}.
15
- */
16
- export type DepColumnType = (typeof DEP_COLUMN_TYPES)[number];
17
- /** Whether the consumer reads or writes a column. Default `read`. */
18
- export type DepColumnMode = "read" | "write";
19
- /** Kinds of cross-module usage a provenance token can name. */
20
- export type DepProvenanceKind = "ref" | "extends" | "formula" | "action" | "view" | "report" | "print" | "role";
21
- /**
22
- * A usage token of the form `<kind>:<symbol>` — e.g. `ref:invoice.customer`,
23
- * `extends:party`, `action:check_credit`, `role:fin.admin`. Names the consuming
24
- * symbol so the completeness lint can reconcile declared vs actual usage. Note:
25
- * `display` is intentionally not a kind — the label is the provider's concern.
26
- */
27
- export type DepProvenance = `${DepProvenanceKind}:${string}`;
28
- /** A single consumed provider column. */
29
- export interface DepColumn {
30
- /** Storage class — the provider column's physical Postgres type, params stripped (`int8`, `varchar`, `numeric`, …). */
31
- type: DepColumnType;
32
- /** Per-column provenance: which symbols read/write/join on this column. */
33
- use: DepProvenance[];
34
- /** `write` implies an insert/update right + settable column. Default `read`; omit for reads. */
35
- mode?: DepColumnMode;
36
- }
37
- /** What the consumer needs from one provider entity. */
38
- export interface DepEntity {
39
- /** The provider entity's PK column — the anchor every reference joins on. No label/display. */
40
- pk: string;
41
- /** Entity-level provenance: why this entity is consumed (ref/extends/role/view/report/print/action). */
42
- use: DepProvenance[];
43
- /** Provider columns actually read/written/joined. Omit for extension-only targets. */
44
- columns?: Record<string, DepColumn>;
45
- }
46
- /** A `deps/<provider>.json` file: the consumer's contract against one dependency. */
47
- export interface DepsFile {
48
- /** Code of the dependency (provider) module this contract is against (e.g. `parties`). */
49
- module: string;
50
- /** Semver range the consumer requires of the provider (e.g. `>=0.1.0`). */
51
- version: string;
52
- /** Consumed provider entities, keyed by entity code. */
53
- entities: Record<string, DepEntity>;
54
- }
55
- //# sourceMappingURL=deps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,+QAOnB,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,qEAAqE;AACrE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7C,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAC1B,KAAK,GACL,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,OAAO,GACP,MAAM,CAAC;AAEV;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,iBAAiB,IAAI,MAAM,EAAE,CAAC;AAE7D,yCAAyC;AACzC,MAAM,WAAW,SAAS;IACzB,uHAAuH;IACvH,IAAI,EAAE,aAAa,CAAC;IACpB,2EAA2E;IAC3E,GAAG,EAAE,aAAa,EAAE,CAAC;IACrB,gGAAgG;IAChG,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,wDAAwD;AACxD,MAAM,WAAW,SAAS;IACzB,+FAA+F;IAC/F,EAAE,EAAE,MAAM,CAAC;IACX,wGAAwG;IACxG,GAAG,EAAE,aAAa,EAAE,CAAC;IACrB,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACxB,0FAA0F;IAC1F,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC"}
package/dist/deps.js DELETED
@@ -1,23 +0,0 @@
1
- // Dependency contracts — authoring shape of `deps/<provider>.json`. Mirror of deps.schema.json.
2
- //
3
- // One file per dependency declares everything a consumer module consumes from a
4
- // provider: the entities, columns (each pinned to its provider storage class — a
5
- // Postgres type token like int8/varchar/numeric, not a base datatype), and the
6
- // provenance of each usage. The provider stays the source of truth; this is the
7
- // consumer's import list. See docs/modules/dependency-contracts.md.
8
- /**
9
- * Allowed storage-class tokens for a consumed column — Postgres type names with
10
- * length/scale stripped. Closed allowlist, kept in lockstep with the `type` enum in
11
- * `deps.schema.json` (and `DependencyContractValidator.ValidColumnTypes` on the C#
12
- * side); the `schemas.test.ts` parity guard fails if this drifts from the schema.
13
- * Extend all three together if a provider column legitimately uses a type not here.
14
- */
15
- export const DEP_COLUMN_TYPES = [
16
- "int2", "int4", "int8", "smallint", "integer", "bigint",
17
- "numeric", "decimal", "float4", "float8", "real", "money",
18
- "varchar", "text", "char", "bpchar",
19
- "bool", "boolean",
20
- "date", "time", "timetz", "timestamp", "timestamptz",
21
- "uuid", "json", "jsonb", "bytea",
22
- ];
23
- //# sourceMappingURL=deps.js.map
package/dist/deps.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"deps.js","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAC/E,gFAAgF;AAChF,oEAAoE;AAEpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ;IACvD,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO;IACzD,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ;IACnC,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa;IACpD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;CACvB,CAAC"}
package/dist/derive.d.ts DELETED
@@ -1,19 +0,0 @@
1
- /** Total digits used when building a `numeric(total, scale)` type. */
2
- export declare const NUMERIC_TOTAL = 18;
3
- export interface DeriveOptions {
4
- /** Author-specified max length; overrides the field type's default. */
5
- maxLen?: number | null;
6
- /** Author-specified numeric scale; overrides the field type's default. */
7
- precision?: number | null;
8
- }
9
- /**
10
- * Derive the PostgreSQL `dbDatatype` for a field type. Returns `null` for
11
- * field types backed by relationships/sets (lookup, grid) that have no physical
12
- * column of their own. Unknown field types fall back to `varchar`.
13
- */
14
- export declare function deriveDbDatatype(fieldTypeCd: string, options?: DeriveOptions): string | null;
15
- /** Default `params` to seed a new field of this type with (or `undefined`). */
16
- export declare function defaultParams(fieldTypeCd: string): Record<string, unknown> | undefined;
17
- /** The base datatype code a field type maps to (for `baseDatatypeCd` on F columns). */
18
- export declare function deriveBaseDatatype(fieldTypeCd: string): string | undefined;
19
- //# sourceMappingURL=derive.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AASA,sEAAsE;AACtE,eAAO,MAAM,aAAa,KAAK,CAAC;AAkBhC,MAAM,WAAW,aAAa;IAC7B,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,GAAG,IAAI,CA4BhG;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAItF;AAED,uFAAuF;AACvF,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1E"}
package/dist/derive.js DELETED
@@ -1,68 +0,0 @@
1
- // Derivation helpers — turn a friendly field-type choice into the physical
2
- // metadata the platform needs, so the author never types a raw SQL type.
3
- //
4
- // Defaults follow how core modules actually author fields (e.g. currency →
5
- // numeric(18,2), color → varchar(20)); callers may always override the result.
6
- import { baseToDbDatatype } from "./base-datatypes";
7
- import { getFieldType } from "./field-types";
8
- /** Total digits used when building a `numeric(total, scale)` type. */
9
- export const NUMERIC_TOTAL = 18;
10
- /** Field types whose natural storage is unbounded `text` rather than `varchar`. */
11
- const TEXT_BACKED = new Set(["textarea", "markdown", "richtext", "code"]);
12
- /**
13
- * Field types the server pins to a fixed column type regardless of their base
14
- * datatype — mirrors `DdlService.ResolveDbTypeFromFieldType`. `file`/`image`
15
- * classify as `binary`, but dForge stores them as a JSON metadata reference
16
- * (`{ storagePath, fileName, … }`), NOT inline `bytea`; the column is `jsonb`.
17
- * Without this override the base path derives `bytea`, and the file-attach
18
- * pipeline — which reads/writes that JSON — fails on save.
19
- */
20
- const DB_DATATYPE_OVERRIDE = {
21
- file: "jsonb",
22
- image: "jsonb",
23
- };
24
- /**
25
- * Derive the PostgreSQL `dbDatatype` for a field type. Returns `null` for
26
- * field types backed by relationships/sets (lookup, grid) that have no physical
27
- * column of their own. Unknown field types fall back to `varchar`.
28
- */
29
- export function deriveDbDatatype(fieldTypeCd, options = {}) {
30
- const ft = getFieldType(fieldTypeCd);
31
- if (!ft)
32
- return "varchar";
33
- // Relationship-backed types (lookup → R, grid → S) never own a physical
34
- // column — the FK lives on a separate hidden column.
35
- if (ft.columnType === "R" || ft.columnType === "S")
36
- return null;
37
- // Server-pinned column types that don't follow the base-datatype path
38
- // (file/image → jsonb, not bytea). Mirrors ResolveDbTypeFromFieldType.
39
- const override = DB_DATATYPE_OVERRIDE[ft.cd];
40
- if (override)
41
- return override;
42
- const base = baseToDbDatatype(ft.baseDatatypeCd);
43
- if (base === null)
44
- return null; // other non-physical base (link/ref/set)
45
- if (ft.baseDatatypeCd === "number") {
46
- const precision = options.precision ?? ft.precision;
47
- return precision != null ? `numeric(${NUMERIC_TOTAL},${precision})` : "numeric";
48
- }
49
- if (ft.baseDatatypeCd === "string") {
50
- if (TEXT_BACKED.has(ft.cd))
51
- return "text";
52
- const maxLen = options.maxLen ?? ft.maxLen;
53
- return maxLen != null ? `varchar(${maxLen})` : "varchar";
54
- }
55
- return base;
56
- }
57
- /** Default `params` to seed a new field of this type with (or `undefined`). */
58
- export function defaultParams(fieldTypeCd) {
59
- const ft = getFieldType(fieldTypeCd);
60
- if (!ft?.defParams)
61
- return undefined;
62
- return { ...ft.defParams };
63
- }
64
- /** The base datatype code a field type maps to (for `baseDatatypeCd` on F columns). */
65
- export function deriveBaseDatatype(fieldTypeCd) {
66
- return getFieldType(fieldTypeCd)?.baseDatatypeCd;
67
- }
68
- //# sourceMappingURL=derive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"derive.js","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,sEAAsE;AACtE,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC,mFAAmF;AACnF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAA2B;IACpD,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;CACd,CAAC;AASF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB,EAAE,UAAyB,EAAE;IAChF,MAAM,EAAE,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAE1B,wEAAwE;IACxE,qDAAqD;IACrD,IAAI,EAAE,CAAC,UAAU,KAAK,GAAG,IAAI,EAAE,CAAC,UAAU,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAEhE,sEAAsE;IACtE,uEAAuE;IACvE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7C,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE9B,MAAM,IAAI,GAAG,gBAAgB,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;IACjD,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,CAAC,yCAAyC;IAEzE,IAAI,EAAE,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,CAAC;QACpD,OAAO,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,aAAa,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IACjF,CAAC;IAED,IAAI,EAAE,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;QACpC,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAAE,OAAO,MAAM,CAAC;QAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,MAAM,CAAC;QAC3C,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,aAAa,CAAC,WAAmB;IAChD,MAAM,EAAE,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,EAAE,SAAS;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;AAC5B,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACrD,OAAO,YAAY,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC;AAClD,CAAC"}
package/dist/domains.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import type { BaseDatatypeCd, FieldTypeCd, FieldOption } from "./types";
2
- /** A single reusable column domain. */
3
- export interface DomainDef {
4
- /** Human-readable label. Localizable via `translations/<locale>.json` → `domains.<code>.label`. */
5
- description?: string;
6
- /**
7
- * Base datatype the domain stands for. Required — it is what a consuming column's
8
- * DDL is generated from.
9
- */
10
- baseDatatypeCd: BaseDatatypeCd;
11
- /** Physical Postgres type for consuming columns; omit to infer from `fieldTypeCd`. */
12
- dbDatatype?: string;
13
- /** Control used to render/edit consuming columns (e.g. `dropdown`, `text`, `number`). */
14
- fieldTypeCd?: FieldTypeCd;
15
- /** Max length for string-backed domains. */
16
- maxLen?: number;
17
- /** Decimal precision for numeric domains. */
18
- precision?: number;
19
- /**
20
- * Field-type config shared by every consuming column — most importantly the option
21
- * list for `dropdown`/`radio`/`flags`. Never copied onto columns: it resolves from
22
- * the domain at load time, which is what lets its labels be translated once for all
23
- * consumers. Per-locale label/icon/color overrides live in `translations/<locale>.json`
24
- * under `domains.<code>.options.<value>`.
25
- */
26
- params?: {
27
- options?: (string | FieldOption)[];
28
- } & Record<string, unknown>;
29
- }
30
- /** A `domains.json` file: reusable column domains keyed by domain code. */
31
- export type DomainsFile = Record<string, DomainDef>;
32
- //# sourceMappingURL=domains.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExE,uCAAuC;AACvC,MAAM,WAAW,SAAS;IACzB,mGAAmG;IACnG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1E;AAED,2EAA2E;AAC3E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC"}
package/dist/domains.js DELETED
@@ -1,10 +0,0 @@
1
- // Column domains — authoring shape of `domains.json`. Mirror of domains.schema.json.
2
- //
3
- // A domain is a reusable, named semantic type: a base datatype, a control, sizing and
4
- // a shared option list under one code (e.g. `doc_status`). A column references it via
5
- // `FieldDef.domain` ("module_cd.domain_cd") instead of restating the definition. The
6
- // structural fields are materialized onto each column at install; `params` (the option
7
- // list) stays on the domain and resolves at load time, so a shared list is authored and
8
- // translated exactly once. See docs/modules/MODULE_CONVENTIONS.md.
9
- export {};
10
- //# sourceMappingURL=domains.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"domains.js","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,sFAAsF;AACtF,sFAAsF;AACtF,qFAAqF;AACrF,uFAAuF;AACvF,wFAAwF;AACxF,mEAAmE"}
@@ -1,18 +0,0 @@
1
- import type { EntityDef } from "./entity";
2
- /** `{ field, target }` for each Reference (R) column that declares a link. */
3
- export declare function getLinks(entity: EntityDef): Array<{
4
- field: string;
5
- target: string;
6
- }>;
7
- /**
8
- * Identity-trait primary-key column codes for `entityCode` (e.g. `invoice_id`),
9
- * excluding any the author already declared explicitly. Empty unless the entity
10
- * carries the `identity` trait.
11
- */
12
- export declare function getIdentityKeys(entity: EntityDef, entityCode: string): string[];
13
- /**
14
- * All primary-key column codes: fields flagged `isPk`, plus identity-trait keys.
15
- * Order is explicit-first, then identity keys; duplicates removed.
16
- */
17
- export declare function getPrimaryKeys(entity: EntityDef, entityCode: string): string[];
18
- //# sourceMappingURL=entity-meta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-meta.d.ts","sourceRoot":"","sources":["../src/entity-meta.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAQpF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAI/E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAa9E"}
@@ -1,45 +0,0 @@
1
- // Entity introspection helpers — derive the projections clients commonly need
2
- // (primary keys, identity-trait keys, reference links) from a raw EntityDef.
3
- // Shared so the editor, web app and CLI compute these the same way instead of
4
- // each reimplementing the rules.
5
- import { expandTrait } from "./traits";
6
- /** `{ field, target }` for each Reference (R) column that declares a link. */
7
- export function getLinks(entity) {
8
- const links = [];
9
- for (const [code, field] of Object.entries(entity.fields ?? {})) {
10
- if (field.columnType === "R" && field.link?.entity) {
11
- links.push({ field: code, target: field.link.entity });
12
- }
13
- }
14
- return links;
15
- }
16
- /**
17
- * Identity-trait primary-key column codes for `entityCode` (e.g. `invoice_id`),
18
- * excluding any the author already declared explicitly. Empty unless the entity
19
- * carries the `identity` trait.
20
- */
21
- export function getIdentityKeys(entity, entityCode) {
22
- if (!entity.traits?.includes("identity"))
23
- return [];
24
- const explicit = new Set(Object.keys(entity.fields ?? {}));
25
- return Object.keys(expandTrait("identity", entityCode)).filter((key) => !explicit.has(key));
26
- }
27
- /**
28
- * All primary-key column codes: fields flagged `isPk`, plus identity-trait keys.
29
- * Order is explicit-first, then identity keys; duplicates removed.
30
- */
31
- export function getPrimaryKeys(entity, entityCode) {
32
- const explicit = Object.entries(entity.fields ?? {})
33
- .filter(([, field]) => field.isPk)
34
- .map(([code]) => code);
35
- const seen = new Set(explicit);
36
- const result = [...explicit];
37
- for (const key of getIdentityKeys(entity, entityCode)) {
38
- if (!seen.has(key)) {
39
- seen.add(key);
40
- result.push(key);
41
- }
42
- }
43
- return result;
44
- }
45
- //# sourceMappingURL=entity-meta.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-meta.js","sourceRoot":"","sources":["../src/entity-meta.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,iCAAiC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,8EAA8E;AAC9E,MAAM,UAAU,QAAQ,CAAC,MAAiB;IACzC,MAAM,KAAK,GAA6C,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC;QACjE,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;YACpD,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,UAAkB;IACpE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,EAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAiB,EAAE,UAAkB;IACnE,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;SAClD,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SACjC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC"}
package/dist/entity.d.ts DELETED
@@ -1,116 +0,0 @@
1
- import type { FieldDef } from "./types";
2
- /** Trait codes valid in an entity's `traits` array (entity.schema.json enum). */
3
- export type TraitCd = "identity" | "audit" | "audit-full" | "soft-delete" | "sorting" | "postable" | "accumulation" | "ledger" | "period" | "file-library";
4
- /** Referential action for a FK's ON DELETE / ON UPDATE clause (omitted = noAction). */
5
- export type ReferentialAction = "cascade" | "setNull" | "restrict" | "noAction";
6
- /** Foreign-key reference (legacy `references` block — prefer `link` on a field). */
7
- export interface EntityReference {
8
- from: {
9
- field: string;
10
- };
11
- to: {
12
- entity: string;
13
- field: string;
14
- };
15
- /** ON DELETE rule; `setNull` requires a nullable FK column. */
16
- onDelete?: ReferentialAction;
17
- /** ON UPDATE rule; a no-op for immutable `cuid` PKs. */
18
- onUpdate?: ReferentialAction;
19
- }
20
- /** Automatic document numbering config (entity `numberSequence`). */
21
- export interface NumberSequenceDef {
22
- /** Column code that receives the auto-generated number. */
23
- column: string;
24
- /** Module setting code to resolve the prefix from (folder-scoped). */
25
- prefixSettingCd?: string;
26
- /** Fallback prefix when no setting is configured. */
27
- defaultPrefix: string;
28
- /** Format pattern. Placeholders: {prefix}, {yyyy}, {yy}, {mm}, {dd}, {seq:N}. */
29
- pattern?: string;
30
- /** Counter reset period (default: year). */
31
- resetPeriod?: "year" | "month" | "day" | "never";
32
- }
33
- /** Period-entity config (`period` block; requires the `period` trait). */
34
- export interface PeriodConfig {
35
- /** Format for the period key. Placeholders: {yyyy}, {yy}, {MM}, {dd}, {q}. */
36
- keyFormat: string;
37
- }
38
- /** Dynamic sign determination based on a field value. */
39
- export interface SignConfig {
40
- /** Field code that determines direction. */
41
- field: string;
42
- /** Values that mean increase. */
43
- positive: string[];
44
- /** Values that mean decrease. */
45
- negative: string[];
46
- }
47
- /** Accumulation-registry config (`accumulation` block; requires the trait). */
48
- export interface AccumulationConfig {
49
- /** Balance entity code (e.g. 'stock'). */
50
- balanceEntity: string;
51
- /** Balance lookup dimensions: field-name array or balance→document field map. */
52
- dimensions: string[] | Record<string, string>;
53
- /** Document field → balance field resource mappings. */
54
- resources: Record<string, {
55
- balanceField: string;
56
- }>;
57
- /** Fixed posting direction for all postings. */
58
- direction?: "increase" | "decrease";
59
- /** Dynamic sign (alternative to `direction`). */
60
- sign?: SignConfig;
61
- autoCreateBalance?: boolean;
62
- allowNegative?: boolean;
63
- /** Document fields locked once posted. */
64
- lockedFields?: string[];
65
- }
66
- /** One registry target within an L-column's `registries` array. */
67
- export interface LedgerRegistryEntry {
68
- /** Movement entity code (e.g. 'posting_record'). */
69
- movementEntity: string;
70
- /** Line field → movement field mapping. */
71
- movementMapping: Record<string, string>;
72
- /** Balance entity code (e.g. 'balance_register'). */
73
- balanceEntity: string;
74
- balanceMapping: {
75
- /** Balance row dimension columns. */
76
- dimensions: string[];
77
- /** Balance column for debit turnover. */
78
- debitResource: string;
79
- /** Balance column for credit turnover. */
80
- creditResource: string;
81
- };
82
- }
83
- /** A single entity definition (`entities/<code>.json`). */
84
- export interface EntityDef {
85
- /** Qualified entity code to extend (e.g. 'fin.invoice') — turns this into an extension. */
86
- extends?: string;
87
- description?: string;
88
- /** Database schema name override (defaults to module schema). */
89
- schema?: string;
90
- /** Database table/view name (defaults to entity code). */
91
- dbObject?: string;
92
- /** When true, maps to a SQL view (read-only, no DDL). */
93
- isView?: boolean;
94
- /** SELECT statement for view-backed entities (`isView=true`). */
95
- viewSql?: string;
96
- /** Display pattern using column placeholders, e.g. "{first_name} {last_name}". */
97
- toString?: string;
98
- /** Traits expanded at install time. */
99
- traits?: TraitCd[];
100
- /** Column definitions keyed by column code. Optional when a trait (e.g. `period`) supplies all columns. */
101
- fields?: Record<string, FieldDef>;
102
- /** Database constraints (unique, check, …); free-form per the schema. */
103
- constraints?: Record<string, unknown>;
104
- /** FK references (legacy format; prefer `link` on a field). */
105
- references?: Record<string, EntityReference>;
106
- /** Database index definitions; free-form per the schema. */
107
- indexes?: Record<string, unknown>;
108
- numberSequence?: NumberSequenceDef;
109
- period?: PeriodConfig;
110
- accumulation?: AccumulationConfig;
111
- /** Entity-level platform behavior flags. */
112
- params?: {
113
- restricted?: boolean;
114
- } & Record<string, unknown>;
115
- }
116
- //# sourceMappingURL=entity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,iFAAiF;AACjF,MAAM,MAAM,OAAO,GAChB,UAAU,GACV,OAAO,GACP,YAAY,GACZ,aAAa,GACb,SAAS,GACT,UAAU,GACV,cAAc,GACd,QAAQ,GACR,QAAQ,GACR,cAAc,CAAC;AAElB,uFAAuF;AACvF,MAAM,M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AM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC7C,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,4CAA4C;IAC5C,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5D"}
package/dist/entity.js DELETED
@@ -1,7 +0,0 @@
1
- // Entity definition — authoring shape of an `entities/*.json` file.
2
- //
3
- // Mirror of entity.schema.json. Describes a table/view mapping: its fields
4
- // (see FieldDef in types.ts), traits, references, number sequence and the
5
- // register configs for accumulation/ledger entities.
6
- export {};
7
- //# sourceMappingURL=entity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity.js","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,qDAAqD"}