@dforge-core/metadata 0.0.12 → 0.0.13

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 (111) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/index.d.ts +1221 -28
  3. package/dist/index.js +418 -32
  4. package/dist/index.js.map +1 -1
  5. package/package.json +6 -4
  6. package/schemas/data_views.schema.json +16 -3
  7. package/schemas/folders.schema.json +18 -2
  8. package/schemas/reports.schema.json +18 -2
  9. package/src/filter.ts +35 -3
  10. package/src/index.ts +9 -1
  11. package/dist/actions.d.ts +0 -31
  12. package/dist/actions.d.ts.map +0 -1
  13. package/dist/actions.js +0 -7
  14. package/dist/actions.js.map +0 -1
  15. package/dist/aggregation.d.ts +0 -13
  16. package/dist/aggregation.d.ts.map +0 -1
  17. package/dist/aggregation.js +0 -17
  18. package/dist/aggregation.js.map +0 -1
  19. package/dist/base-datatypes.d.ts +0 -5
  20. package/dist/base-datatypes.d.ts.map +0 -1
  21. package/dist/base-datatypes.js +0 -49
  22. package/dist/base-datatypes.js.map +0 -1
  23. package/dist/column-types.d.ts +0 -5
  24. package/dist/column-types.d.ts.map +0 -1
  25. package/dist/column-types.js +0 -18
  26. package/dist/column-types.js.map +0 -1
  27. package/dist/data-views.d.ts +0 -95
  28. package/dist/data-views.d.ts.map +0 -1
  29. package/dist/data-views.js +0 -18
  30. package/dist/data-views.js.map +0 -1
  31. package/dist/deps.d.ts +0 -55
  32. package/dist/deps.d.ts.map +0 -1
  33. package/dist/deps.js +0 -23
  34. package/dist/deps.js.map +0 -1
  35. package/dist/derive.d.ts +0 -19
  36. package/dist/derive.d.ts.map +0 -1
  37. package/dist/derive.js +0 -68
  38. package/dist/derive.js.map +0 -1
  39. package/dist/domains.d.ts +0 -32
  40. package/dist/domains.d.ts.map +0 -1
  41. package/dist/domains.js +0 -10
  42. package/dist/domains.js.map +0 -1
  43. package/dist/entity-meta.d.ts +0 -18
  44. package/dist/entity-meta.d.ts.map +0 -1
  45. package/dist/entity-meta.js +0 -45
  46. package/dist/entity-meta.js.map +0 -1
  47. package/dist/entity.d.ts +0 -116
  48. package/dist/entity.d.ts.map +0 -1
  49. package/dist/entity.js +0 -7
  50. package/dist/entity.js.map +0 -1
  51. package/dist/field-types.d.ts +0 -287
  52. package/dist/field-types.d.ts.map +0 -1
  53. package/dist/field-types.js +0 -58
  54. package/dist/field-types.js.map +0 -1
  55. package/dist/filter.d.ts +0 -26
  56. package/dist/filter.d.ts.map +0 -1
  57. package/dist/filter.js +0 -7
  58. package/dist/filter.js.map +0 -1
  59. package/dist/folders.d.ts +0 -32
  60. package/dist/folders.d.ts.map +0 -1
  61. package/dist/folders.js +0 -6
  62. package/dist/folders.js.map +0 -1
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/jobs.d.ts +0 -32
  65. package/dist/jobs.d.ts.map +0 -1
  66. package/dist/jobs.js +0 -3
  67. package/dist/jobs.js.map +0 -1
  68. package/dist/manifest.d.ts +0 -53
  69. package/dist/manifest.d.ts.map +0 -1
  70. package/dist/manifest.js +0 -4
  71. package/dist/manifest.js.map +0 -1
  72. package/dist/menus.d.ts +0 -32
  73. package/dist/menus.d.ts.map +0 -1
  74. package/dist/menus.js +0 -3
  75. package/dist/menus.js.map +0 -1
  76. package/dist/print-templates.d.ts +0 -36
  77. package/dist/print-templates.d.ts.map +0 -1
  78. package/dist/print-templates.js +0 -4
  79. package/dist/print-templates.js.map +0 -1
  80. package/dist/reports.d.ts +0 -84
  81. package/dist/reports.d.ts.map +0 -1
  82. package/dist/reports.js +0 -24
  83. package/dist/reports.js.map +0 -1
  84. package/dist/roles.d.ts +0 -10
  85. package/dist/roles.d.ts.map +0 -1
  86. package/dist/roles.js +0 -3
  87. package/dist/roles.js.map +0 -1
  88. package/dist/seed-data.d.ts +0 -8
  89. package/dist/seed-data.d.ts.map +0 -1
  90. package/dist/seed-data.js +0 -4
  91. package/dist/seed-data.js.map +0 -1
  92. package/dist/settings.d.ts +0 -26
  93. package/dist/settings.d.ts.map +0 -1
  94. package/dist/settings.js +0 -3
  95. package/dist/settings.js.map +0 -1
  96. package/dist/traits.d.ts +0 -14
  97. package/dist/traits.d.ts.map +0 -1
  98. package/dist/traits.js +0 -121
  99. package/dist/traits.js.map +0 -1
  100. package/dist/triggers.d.ts +0 -28
  101. package/dist/triggers.d.ts.map +0 -1
  102. package/dist/triggers.js +0 -3
  103. package/dist/triggers.js.map +0 -1
  104. package/dist/types.d.ts +0 -128
  105. package/dist/types.d.ts.map +0 -1
  106. package/dist/types.js +0 -7
  107. package/dist/types.js.map +0 -1
  108. package/dist/webhooks.d.ts +0 -31
  109. package/dist/webhooks.d.ts.map +0 -1
  110. package/dist/webhooks.js +0 -3
  111. package/dist/webhooks.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,31 +1,1224 @@
1
- export type { AlignType, BaseDatatypeCd, ColumnTypeCd, ColumnTypeDef, FieldDef, FieldLink, FieldOption, FieldTypeCd, FieldTypeDef, FlagCd, NamedKind, TraitDef, } from "./types";
2
- export { AggType, AGG_TYPE_LIST } from "./aggregation";
3
- export { fieldTypes, fieldTypeCds, isFieldTypeCd, getFieldType, fieldTypesByColumnType } from "./field-types";
4
- export { baseDatatypes, baseToDbDatatype } from "./base-datatypes";
5
- export { columnTypes, getColumnType } from "./column-types";
6
- export { traits, getTrait, expandTrait, expandTraits } from "./traits";
7
- export { deriveDbDatatype, deriveBaseDatatype, defaultParams, NUMERIC_TOTAL, type DeriveOptions, } from "./derive";
8
- export type { Filter, FilterCondition, FilterGroup, SortClause } from "./filter";
9
- export type { EntityDef, EntityReference, NumberSequenceDef, PeriodConfig, AccumulationConfig, SignConfig, LedgerRegistryEntry, TraitCd, } from "./entity";
10
- export { getLinks, getIdentityKeys, getPrimaryKeys } from "./entity-meta";
11
- export { dataViewKinds, type DataViewsFile, type DataViewDef, type DataSource, type ViewColumn, type ViewType, type KanbanViewConfig, type CalendarViewConfig, type TreeGridViewConfig, type ListViewConfig, type ListLevelConfig, type DiagramViewConfig, } from "./data-views";
12
- export { vizTypes, chartTypes, type ReportsFile, type ReportDef, type ReportLayout, type ReportPanel, type Dataset, type ReportQuery, type ColumnDef, type ParamDef, type VizType, } from "./reports";
13
- export type { ManifestDef, ManifestAuthor, ModuleDependency } from "./manifest";
14
- export type { DepsFile, DepEntity, DepColumn, DepColumnType, DepColumnMode, DepProvenance, DepProvenanceKind } from "./deps";
15
- export { DEP_COLUMN_TYPES } from "./deps";
16
- export type { DomainsFile, DomainDef } from "./domains";
17
- export type { MenusFile, MenuDef, MenuItemDef, MenuItemType } from "./menus";
18
- export type { FoldersFile, FolderDef, FolderEntityBinding } from "./folders";
19
- export type { RolesFile, RoleDef } from "./roles";
20
- export type { SettingsFile, SettingDef, SettingBaseDatatype } from "./settings";
21
- export type { JobsFile, JobDef } from "./jobs";
22
- export type { TriggersFile, TriggerDef, EntityEvent } from "./triggers";
23
- export type { WebhooksFile, WebhookSubscription, WebhookPayload } from "./webhooks";
24
- export type { PrintTemplatesFile, PrintTemplateDef, PrintPageSettings, PrintMargins } from "./print-templates";
25
- export type { SeedDataFile } from "./seed-data";
26
- export type { ActionsFile, ActionDef, ActionExecutionMode } from "./actions";
27
- export declare const flagDefs: readonly {
1
+ /** A `{ cd, name }` pair for friendly pickers (view kinds, viz types, …). */
2
+ interface NamedKind {
3
+ cd: string;
4
+ name: string;
5
+ }
6
+ /** Horizontal alignment for a column's display (authored via `params.align`). */
7
+ type AlignType = "left" | "right" | "center";
8
+ /** Column kind letter as stored in entity JSON / the `column` metadata table. */
9
+ type ColumnTypeCd = "D" | "R" | "S" | "F" | "A" | "L" | "G";
10
+ /** Abstract data type code from the `base_datatype` table. */
11
+ type BaseDatatypeCd = "binary" | "bool" | "culture" | "cuid" | "date" | "guid" | "json" | "link" | "number" | "project" | "ref" | "set" | "string" | "time" | "timestamp" | "xml";
12
+ /** Display flags string characters. V=Visible I=Identity E=Editable M=Mandatory H=Hidden. */
13
+ type FlagCd = "V" | "I" | "E" | "M" | "H";
14
+ /** Known field type codes from the field_type seed. */
15
+ type FieldTypeCd = "text" | "email" | "phone" | "url" | "textarea" | "number" | "currency" | "percent" | "checkbox" | "date" | "datetime" | "time" | "dropdown" | "flags" | "json" | "hidden" | "color" | "image" | "file" | "markdown" | "richtext" | "avatar" | "lookup" | "user" | "grid" | "list" | "tags" | "entitylink" | "code";
16
+ /**
17
+ * A UI field type from the `field_type` table. The author picks one of these;
18
+ * the physical `dbDatatype` and `baseDatatypeCd` are derived from it.
19
+ */
20
+ interface FieldTypeDef {
21
+ /** Stable code stored as `fieldTypeCd` on a field. */
22
+ cd: FieldTypeCd;
23
+ /** Human label for pickers. */
24
+ name: string;
25
+ /** Default column kind this field type implies (D / R / S). */
26
+ columnType: ColumnTypeCd;
27
+ /** Abstract datatype used for platform semantics. */
28
+ baseDatatypeCd: BaseDatatypeCd;
29
+ /** Aggregations this type supports: S=sum C=count A=avg M=min/max (letters). */
30
+ supportedAgg: string | null;
31
+ /** Default maximum length for string-backed types (e.g. color = 20). */
32
+ maxLen: number | null;
33
+ /** Default numeric scale for number-backed types (e.g. currency = 2). */
34
+ precision: number | null;
35
+ /** Whether the value participates in text filters. */
36
+ useStringInFilter: boolean;
37
+ /** Default field-type params merged into `params` when the field is created. */
38
+ defParams?: Record<string, unknown>;
39
+ }
40
+ /** Relationship link for Reference (R) and Set (S) columns. */
41
+ interface FieldLink {
42
+ /** Target entity code (the entity being referenced or collected). */
43
+ entity: string;
44
+ /** Column(s) in this entity (comma-separated for compound keys). */
45
+ thisKey: string;
46
+ /** Column(s) in the target entity (comma-separated for compound keys). */
47
+ otherKey: string;
48
+ }
49
+ /** A dropdown/flags option in `params.options` (rich form). */
50
+ interface FieldOption {
51
+ value: string;
52
+ label: string;
53
+ icon?: string;
54
+ color?: string;
55
+ }
56
+ /**
57
+ * A field/column definition as it appears under an entity's `fields` map.
58
+ * Mirrors the `field` $def in entity.schema.json. Trait fields are a subset of
59
+ * this shape, so the same type covers both. The open index signature keeps it
60
+ * tolerant of forward-compatible / type-specific extras (e.g. A/L register
61
+ * config under `params`).
62
+ */
63
+ interface FieldDef {
64
+ /** PostgreSQL data type (e.g. uuid, varchar, int4, numeric, timestamptz). */
65
+ dbDatatype?: string;
66
+ /** Abstract base datatype; required on Formula (F) columns. */
67
+ baseDatatypeCd?: BaseDatatypeCd;
68
+ /** UI field type code. */
69
+ fieldTypeCd?: FieldTypeCd;
70
+ /** Column kind (defaults to D when omitted). */
71
+ columnType?: ColumnTypeCd;
72
+ /** Display flags string (subset of V/I/E/M/H). */
73
+ flags?: string;
74
+ isPk?: boolean;
75
+ isNullable?: boolean;
76
+ isIdentity?: boolean;
77
+ /** Formula expression (F/G columns) or SQL default value. */
78
+ formula?: string;
79
+ orderNum?: number;
80
+ description?: string;
81
+ maxLen?: number;
82
+ precision?: number;
83
+ /** Input mask pattern for editing. */
84
+ editMask?: string;
85
+ /** Display format pattern. */
86
+ displayFmt?: string;
87
+ /** Relationship link for R and S columns. */
88
+ link?: FieldLink;
89
+ /**
90
+ * On a self-referencing R column, set true to ALLOW parent/child cycles.
91
+ * Absent ⇒ treated as an acyclic hierarchy guarded at the DB level.
92
+ */
93
+ cyclic?: boolean;
94
+ /**
95
+ * Reference to a reusable column domain, qualified as `module_cd.domain_cd`
96
+ * (unqualified resolves within the current module first, then tenant-created
97
+ * domains). Supplies `baseDatatypeCd`, `dbDatatype`, `fieldTypeCd`, `maxLen`,
98
+ * `precision` and `params`; declaring any of those alongside `domain` fails install.
99
+ */
100
+ domain?: string;
101
+ /** Filter criteria for reference lookups. */
102
+ refFilter?: unknown;
103
+ /** Field-type-specific configuration (dropdown options, register config, …). */
104
+ params?: {
105
+ options?: (string | FieldOption)[];
106
+ } & Record<string, unknown>;
107
+ [key: string]: unknown;
108
+ }
109
+ /** A reusable trait that expands into a set of fields (and optional references). */
110
+ interface TraitDef {
111
+ cd: string;
112
+ description: string;
113
+ /** Other traits this one includes (expanded first). */
114
+ includes?: string[];
115
+ /** Fields injected, keyed by column code. `{entity}` / `{Entity}` are templated. */
116
+ fields: Record<string, FieldDef>;
117
+ /** Foreign-key references injected (legacy `references` block). */
118
+ references?: Record<string, unknown>;
119
+ }
120
+ /** Description of a column kind for friendly pickers. */
121
+ interface ColumnTypeDef {
122
+ cd: ColumnTypeCd;
123
+ /** Author-facing label. */
124
+ name: string;
125
+ /** One-line explanation. */
126
+ description: string;
127
+ }
128
+
129
+ declare const AggType: {
130
+ readonly Sum: "sum";
131
+ readonly Count: "count";
132
+ readonly Avg: "avg";
133
+ readonly Min: "min";
134
+ readonly Max: "max";
135
+ readonly Group: "group";
136
+ };
137
+ /** One of the aggregation codes ("sum" | "count" | …). */
138
+ type AggType = (typeof AggType)[keyof typeof AggType];
139
+ /** All aggregation types as an array (useful for iteration). */
140
+ declare const AGG_TYPE_LIST: readonly AggType[];
141
+
142
+ declare const fieldTypes: readonly [{
143
+ readonly cd: "text";
144
+ readonly name: "Text";
145
+ readonly columnType: "D";
146
+ readonly baseDatatypeCd: "string";
147
+ readonly supportedAgg: null;
148
+ readonly maxLen: null;
149
+ readonly precision: null;
150
+ readonly useStringInFilter: true;
151
+ }, {
152
+ readonly cd: "avatar";
153
+ readonly name: "Avatar Name";
154
+ readonly columnType: "D";
155
+ readonly baseDatatypeCd: "string";
156
+ readonly supportedAgg: null;
157
+ readonly maxLen: null;
158
+ readonly precision: null;
159
+ readonly useStringInFilter: true;
160
+ }, {
161
+ readonly cd: "email";
162
+ readonly name: "Email";
163
+ readonly columnType: "D";
164
+ readonly baseDatatypeCd: "string";
165
+ readonly supportedAgg: null;
166
+ readonly maxLen: null;
167
+ readonly precision: null;
168
+ readonly useStringInFilter: true;
169
+ }, {
170
+ readonly cd: "phone";
171
+ readonly name: "Phone";
172
+ readonly columnType: "D";
173
+ readonly baseDatatypeCd: "string";
174
+ readonly supportedAgg: null;
175
+ readonly maxLen: null;
176
+ readonly precision: null;
177
+ readonly useStringInFilter: true;
178
+ }, {
179
+ readonly cd: "url";
180
+ readonly name: "URL";
181
+ readonly columnType: "D";
182
+ readonly baseDatatypeCd: "string";
183
+ readonly supportedAgg: null;
184
+ readonly maxLen: null;
185
+ readonly precision: null;
186
+ readonly useStringInFilter: true;
187
+ }, {
188
+ readonly cd: "textarea";
189
+ readonly name: "Multiline Text";
190
+ readonly columnType: "D";
191
+ readonly baseDatatypeCd: "string";
192
+ readonly supportedAgg: null;
193
+ readonly maxLen: null;
194
+ readonly precision: null;
195
+ readonly useStringInFilter: true;
196
+ }, {
197
+ readonly cd: "number";
198
+ readonly name: "Number";
199
+ readonly columnType: "D";
200
+ readonly baseDatatypeCd: "number";
201
+ readonly supportedAgg: "SCAM";
202
+ readonly maxLen: null;
203
+ readonly precision: null;
204
+ readonly useStringInFilter: false;
205
+ readonly defParams: {
206
+ readonly min: 0;
207
+ readonly max: 10000;
208
+ };
209
+ }, {
210
+ readonly cd: "currency";
211
+ readonly name: "Currency";
212
+ readonly columnType: "D";
213
+ readonly baseDatatypeCd: "number";
214
+ readonly supportedAgg: "SCAM";
215
+ readonly maxLen: null;
216
+ readonly precision: 2;
217
+ readonly useStringInFilter: false;
218
+ readonly defParams: {
219
+ readonly min: 0;
220
+ readonly max: 1000000;
221
+ };
222
+ }, {
223
+ readonly cd: "percent";
224
+ readonly name: "Percent";
225
+ readonly columnType: "D";
226
+ readonly baseDatatypeCd: "number";
227
+ readonly supportedAgg: "CAM";
228
+ readonly maxLen: null;
229
+ readonly precision: 2;
230
+ readonly useStringInFilter: false;
231
+ readonly defParams: {
232
+ readonly min: 0;
233
+ readonly max: 100;
234
+ };
235
+ }, {
236
+ readonly cd: "checkbox";
237
+ readonly name: "Checkbox";
238
+ readonly columnType: "D";
239
+ readonly baseDatatypeCd: "bool";
240
+ readonly supportedAgg: "C";
241
+ readonly maxLen: null;
242
+ readonly precision: null;
243
+ readonly useStringInFilter: false;
244
+ }, {
245
+ readonly cd: "date";
246
+ readonly name: "Date";
247
+ readonly columnType: "D";
248
+ readonly baseDatatypeCd: "date";
249
+ readonly supportedAgg: "CM";
250
+ readonly maxLen: null;
251
+ readonly precision: null;
252
+ readonly useStringInFilter: false;
253
+ }, {
254
+ readonly cd: "datetime";
255
+ readonly name: "Date & Time";
256
+ readonly columnType: "D";
257
+ readonly baseDatatypeCd: "timestamp";
258
+ readonly supportedAgg: "CM";
259
+ readonly maxLen: null;
260
+ readonly precision: null;
261
+ readonly useStringInFilter: false;
262
+ }, {
263
+ readonly cd: "time";
264
+ readonly name: "Time";
265
+ readonly columnType: "D";
266
+ readonly baseDatatypeCd: "time";
267
+ readonly supportedAgg: null;
268
+ readonly maxLen: null;
269
+ readonly precision: null;
270
+ readonly useStringInFilter: false;
271
+ }, {
272
+ readonly cd: "dropdown";
273
+ readonly name: "Dropdown";
274
+ readonly columnType: "D";
275
+ readonly baseDatatypeCd: "string";
276
+ readonly supportedAgg: "C";
277
+ readonly maxLen: null;
278
+ readonly precision: null;
279
+ readonly useStringInFilter: true;
280
+ }, {
281
+ readonly cd: "flags";
282
+ readonly name: "Flags";
283
+ readonly columnType: "D";
284
+ readonly baseDatatypeCd: "string";
285
+ readonly supportedAgg: "C";
286
+ readonly maxLen: null;
287
+ readonly precision: null;
288
+ readonly useStringInFilter: true;
289
+ readonly defParams: {
290
+ readonly style: "buttons";
291
+ };
292
+ }, {
293
+ readonly cd: "json";
294
+ readonly name: "JSON Editor";
295
+ readonly columnType: "D";
296
+ readonly baseDatatypeCd: "json";
297
+ readonly supportedAgg: null;
298
+ readonly maxLen: null;
299
+ readonly precision: null;
300
+ readonly useStringInFilter: false;
301
+ }, {
302
+ readonly cd: "hidden";
303
+ readonly name: "Hidden";
304
+ readonly columnType: "D";
305
+ readonly baseDatatypeCd: "string";
306
+ readonly supportedAgg: null;
307
+ readonly maxLen: null;
308
+ readonly precision: null;
309
+ readonly useStringInFilter: false;
310
+ }, {
311
+ readonly cd: "color";
312
+ readonly name: "Color Picker";
313
+ readonly columnType: "D";
314
+ readonly baseDatatypeCd: "string";
315
+ readonly supportedAgg: null;
316
+ readonly maxLen: 20;
317
+ readonly precision: null;
318
+ readonly useStringInFilter: false;
319
+ }, {
320
+ readonly cd: "image";
321
+ readonly name: "Image";
322
+ readonly columnType: "D";
323
+ readonly baseDatatypeCd: "binary";
324
+ readonly supportedAgg: null;
325
+ readonly maxLen: null;
326
+ readonly precision: null;
327
+ readonly useStringInFilter: false;
328
+ }, {
329
+ readonly cd: "file";
330
+ readonly name: "File";
331
+ readonly columnType: "D";
332
+ readonly baseDatatypeCd: "binary";
333
+ readonly supportedAgg: null;
334
+ readonly maxLen: null;
335
+ readonly precision: null;
336
+ readonly useStringInFilter: false;
337
+ }, {
338
+ readonly cd: "markdown";
339
+ readonly name: "Markdown";
340
+ readonly columnType: "D";
341
+ readonly baseDatatypeCd: "string";
342
+ readonly supportedAgg: null;
343
+ readonly maxLen: null;
344
+ readonly precision: null;
345
+ readonly useStringInFilter: true;
346
+ }, {
347
+ readonly cd: "richtext";
348
+ readonly name: "Rich Text Editor";
349
+ readonly columnType: "D";
350
+ readonly baseDatatypeCd: "string";
351
+ readonly supportedAgg: null;
352
+ readonly maxLen: null;
353
+ readonly precision: null;
354
+ readonly useStringInFilter: true;
355
+ }, {
356
+ readonly cd: "lookup";
357
+ readonly name: "Lookup";
358
+ readonly columnType: "R";
359
+ readonly baseDatatypeCd: "guid";
360
+ readonly supportedAgg: "C";
361
+ readonly maxLen: null;
362
+ readonly precision: null;
363
+ readonly useStringInFilter: true;
364
+ }, {
365
+ readonly cd: "user";
366
+ readonly name: "User Picker";
367
+ readonly columnType: "D";
368
+ readonly baseDatatypeCd: "cuid";
369
+ readonly supportedAgg: "C";
370
+ readonly maxLen: null;
371
+ readonly precision: null;
372
+ readonly useStringInFilter: false;
373
+ }, {
374
+ readonly cd: "grid";
375
+ readonly name: "Detail Grid";
376
+ readonly columnType: "S";
377
+ readonly baseDatatypeCd: "set";
378
+ readonly supportedAgg: "C";
379
+ readonly maxLen: null;
380
+ readonly precision: null;
381
+ readonly useStringInFilter: false;
382
+ }, {
383
+ readonly cd: "list";
384
+ readonly name: "Detail List";
385
+ readonly columnType: "S";
386
+ readonly baseDatatypeCd: "set";
387
+ readonly supportedAgg: "C";
388
+ readonly maxLen: null;
389
+ readonly precision: null;
390
+ readonly useStringInFilter: false;
391
+ }, {
392
+ readonly cd: "tags";
393
+ readonly name: "Tags";
394
+ readonly columnType: "D";
395
+ readonly baseDatatypeCd: "string";
396
+ readonly supportedAgg: "C";
397
+ readonly maxLen: null;
398
+ readonly precision: null;
399
+ readonly useStringInFilter: true;
400
+ }, {
401
+ readonly cd: "entitylink";
402
+ readonly name: "Entity Link";
403
+ readonly columnType: "D";
404
+ readonly baseDatatypeCd: "json";
405
+ readonly supportedAgg: "C";
406
+ readonly maxLen: null;
407
+ readonly precision: null;
408
+ readonly useStringInFilter: false;
409
+ }, {
410
+ readonly cd: "code";
411
+ readonly name: "Code Editor";
412
+ readonly columnType: "D";
413
+ readonly baseDatatypeCd: "string";
414
+ readonly supportedAgg: "C";
415
+ readonly maxLen: null;
416
+ readonly precision: null;
417
+ readonly useStringInFilter: false;
418
+ }];
419
+ /** Set of all known field type codes, for membership checks. */
420
+ declare const fieldTypeCds: ReadonlySet<string>;
421
+ /** Type guard: is `cd` one of the known field type codes? */
422
+ declare function isFieldTypeCd(cd: string | undefined): cd is FieldTypeCd;
423
+ /** Look up a field type by code, or `undefined` if unknown. */
424
+ declare function getFieldType(cd: string): FieldTypeDef | undefined;
425
+ /** Field types whose default column kind is `columnType` (e.g. "D" value types). */
426
+ declare function fieldTypesByColumnType(columnType: string): readonly FieldTypeDef[];
427
+
428
+ declare const baseDatatypes: readonly BaseDatatypeCd[];
429
+ /** Default PostgreSQL type for a base datatype, or `null` if non-physical. */
430
+ declare function baseToDbDatatype(base: string): string | null;
431
+
432
+ declare const columnTypes: readonly ColumnTypeDef[];
433
+ /** Look up a column type by letter. */
434
+ declare function getColumnType(cd: string): ColumnTypeDef | undefined;
435
+
436
+ declare const traits: readonly TraitDef[];
437
+ /** Look up a trait by code. */
438
+ declare function getTrait(cd: string): TraitDef | undefined;
439
+ /**
440
+ * Expand a trait (and any traits it includes) into the concrete fields it adds
441
+ * for `entityName`, with `{entity}` / `{Entity}` tokens resolved. Returns an
442
+ * empty object for unknown or marker traits. Field order follows include-depth
443
+ * first, then declaration order; later definitions win on key collisions.
444
+ */
445
+ declare function expandTrait(traitCd: string, entityName: string): Record<string, FieldDef>;
446
+ /** Expand several traits in order into one merged field map. */
447
+ declare function expandTraits(traitCds: readonly string[], entityName: string): Record<string, FieldDef>;
448
+
449
+ /** Total digits used when building a `numeric(total, scale)` type. */
450
+ declare const NUMERIC_TOTAL = 18;
451
+ interface DeriveOptions {
452
+ /** Author-specified max length; overrides the field type's default. */
453
+ maxLen?: number | null;
454
+ /** Author-specified numeric scale; overrides the field type's default. */
455
+ precision?: number | null;
456
+ }
457
+ /**
458
+ * Derive the PostgreSQL `dbDatatype` for a field type. Returns `null` for
459
+ * field types backed by relationships/sets (lookup, grid) that have no physical
460
+ * column of their own. Unknown field types fall back to `varchar`.
461
+ */
462
+ declare function deriveDbDatatype(fieldTypeCd: string, options?: DeriveOptions): string | null;
463
+ /** Default `params` to seed a new field of this type with (or `undefined`). */
464
+ declare function defaultParams(fieldTypeCd: string): Record<string, unknown> | undefined;
465
+ /** The base datatype code a field type maps to (for `baseDatatypeCd` on F columns). */
466
+ declare function deriveBaseDatatype(fieldTypeCd: string): string | undefined;
467
+
468
+ /**
469
+ * Every operator the server's FilterBuilder translates — the closed set the
470
+ * `o` enum in the data_views / reports / folders schemas mirrors, and the set
471
+ * the installer validates a package's filters against.
472
+ *
473
+ * Symbolic forms and their word aliases are equivalent (`=`/`eq`, `!=`/`notEq`,
474
+ * `>`/`gr`, …); a leading `!` negates, with `n`-prefixed spellings as the alias
475
+ * (`!in`/`nIn`). Note the two spellings authors most often get wrong: null
476
+ * checks are `null` / `!null` (not `isNull` / `isNotNull`) and substring
477
+ * matching is `contains` (not `like`).
478
+ */
479
+ declare const FILTER_OPERATORS: readonly ["=", "eq", "!=", "notEq", ">", "gr", ">=", "grEq", "<", "less", "<=", "lessEq", "eqRef", "contains", "!contains", "nContain", "start", "!start", "nStart", "end", "!end", "nEnd", "mask", "!mask", "nMask", "null", "empty", "!null", "nEmpty", "in", "!in", "nIn", "between", "btw", "!between", "nBetween", "f", "func"];
480
+ type FilterOperator = (typeof FILTER_OPERATORS)[number];
481
+ /** Every group combinator the server recognizes. `!`/`n` forms negate the group. */
482
+ declare const FILTER_GROUP_OPERATORS: readonly ["and", "or", "!and", "nAnd", "!or", "nOr"];
483
+ type FilterGroupOperator = (typeof FILTER_GROUP_OPERATORS)[number];
484
+ /** A single filter condition. */
485
+ interface FilterCondition {
486
+ /** Column code (supports dot navigation: 'customer.name'). */
487
+ c: string;
488
+ /** Operator — see {@link FILTER_OPERATORS}. */
489
+ o: FilterOperator;
490
+ /** Comparison value: scalar, array (in/nIn) or a `@param_code` reference. */
491
+ v?: unknown;
492
+ }
493
+ /** A boolean group of nested conditions/sub-groups. */
494
+ interface FilterGroup {
495
+ /** Group combinator. */
496
+ g: FilterGroupOperator;
497
+ /** Group items: nested conditions or sub-groups. */
498
+ i: Filter[];
499
+ }
500
+ /** A filter is either a single condition or a group. */
501
+ type Filter = FilterCondition | FilterGroup;
502
+ /** A sort clause `{ c, d }` as used by reports / per-source order. */
503
+ interface SortClause {
504
+ /** Column code. */
505
+ c: string;
506
+ /** Sort direction (default: asc). */
507
+ d?: "asc" | "desc";
508
+ }
509
+
510
+ /** Trait codes valid in an entity's `traits` array (entity.schema.json enum). */
511
+ type TraitCd = "identity" | "audit" | "audit-full" | "soft-delete" | "sorting" | "postable" | "accumulation" | "ledger" | "period" | "file-library";
512
+ /** Referential action for a FK's ON DELETE / ON UPDATE clause (omitted = noAction). */
513
+ type ReferentialAction = "cascade" | "setNull" | "restrict" | "noAction";
514
+ /** Foreign-key reference (legacy `references` block — prefer `link` on a field). */
515
+ interface EntityReference {
516
+ from: {
517
+ field: string;
518
+ };
519
+ to: {
520
+ entity: string;
521
+ field: string;
522
+ };
523
+ /** ON DELETE rule; `setNull` requires a nullable FK column. */
524
+ onDelete?: ReferentialAction;
525
+ /** ON UPDATE rule; a no-op for immutable `cuid` PKs. */
526
+ onUpdate?: ReferentialAction;
527
+ }
528
+ /** Automatic document numbering config (entity `numberSequence`). */
529
+ interface NumberSequenceDef {
530
+ /** Column code that receives the auto-generated number. */
531
+ column: string;
532
+ /** Module setting code to resolve the prefix from (folder-scoped). */
533
+ prefixSettingCd?: string;
534
+ /** Fallback prefix when no setting is configured. */
535
+ defaultPrefix: string;
536
+ /** Format pattern. Placeholders: {prefix}, {yyyy}, {yy}, {mm}, {dd}, {seq:N}. */
537
+ pattern?: string;
538
+ /** Counter reset period (default: year). */
539
+ resetPeriod?: "year" | "month" | "day" | "never";
540
+ }
541
+ /** Period-entity config (`period` block; requires the `period` trait). */
542
+ interface PeriodConfig {
543
+ /** Format for the period key. Placeholders: {yyyy}, {yy}, {MM}, {dd}, {q}. */
544
+ keyFormat: string;
545
+ }
546
+ /** Dynamic sign determination based on a field value. */
547
+ interface SignConfig {
548
+ /** Field code that determines direction. */
549
+ field: string;
550
+ /** Values that mean increase. */
551
+ positive: string[];
552
+ /** Values that mean decrease. */
553
+ negative: string[];
554
+ }
555
+ /** Accumulation-registry config (`accumulation` block; requires the trait). */
556
+ interface AccumulationConfig {
557
+ /** Balance entity code (e.g. 'stock'). */
558
+ balanceEntity: string;
559
+ /** Balance lookup dimensions: field-name array or balance→document field map. */
560
+ dimensions: string[] | Record<string, string>;
561
+ /** Document field → balance field resource mappings. */
562
+ resources: Record<string, {
563
+ balanceField: string;
564
+ }>;
565
+ /** Fixed posting direction for all postings. */
566
+ direction?: "increase" | "decrease";
567
+ /** Dynamic sign (alternative to `direction`). */
568
+ sign?: SignConfig;
569
+ autoCreateBalance?: boolean;
570
+ allowNegative?: boolean;
571
+ /** Document fields locked once posted. */
572
+ lockedFields?: string[];
573
+ }
574
+ /** One registry target within an L-column's `registries` array. */
575
+ interface LedgerRegistryEntry {
576
+ /** Movement entity code (e.g. 'posting_record'). */
577
+ movementEntity: string;
578
+ /** Line field → movement field mapping. */
579
+ movementMapping: Record<string, string>;
580
+ /** Balance entity code (e.g. 'balance_register'). */
581
+ balanceEntity: string;
582
+ balanceMapping: {
583
+ /** Balance row dimension columns. */
584
+ dimensions: string[];
585
+ /** Balance column for debit turnover. */
586
+ debitResource: string;
587
+ /** Balance column for credit turnover. */
588
+ creditResource: string;
589
+ };
590
+ }
591
+ /** A single entity definition (`entities/<code>.json`). */
592
+ interface EntityDef {
593
+ /** Qualified entity code to extend (e.g. 'fin.invoice') — turns this into an extension. */
594
+ extends?: string;
595
+ description?: string;
596
+ /** Database schema name override (defaults to module schema). */
597
+ schema?: string;
598
+ /** Database table/view name (defaults to entity code). */
599
+ dbObject?: string;
600
+ /** When true, maps to a SQL view (read-only, no DDL). */
601
+ isView?: boolean;
602
+ /** SELECT statement for view-backed entities (`isView=true`). */
603
+ viewSql?: string;
604
+ /** Display pattern using column placeholders, e.g. "{first_name} {last_name}". */
605
+ toString?: string;
606
+ /** Traits expanded at install time. */
607
+ traits?: TraitCd[];
608
+ /** Column definitions keyed by column code. Optional when a trait (e.g. `period`) supplies all columns. */
609
+ fields?: Record<string, FieldDef>;
610
+ /** Database constraints (unique, check, …); free-form per the schema. */
611
+ constraints?: Record<string, unknown>;
612
+ /** FK references (legacy format; prefer `link` on a field). */
613
+ references?: Record<string, EntityReference>;
614
+ /** Database index definitions; free-form per the schema. */
615
+ indexes?: Record<string, unknown>;
616
+ numberSequence?: NumberSequenceDef;
617
+ period?: PeriodConfig;
618
+ accumulation?: AccumulationConfig;
619
+ /** Entity-level platform behavior flags. */
620
+ params?: {
621
+ restricted?: boolean;
622
+ } & Record<string, unknown>;
623
+ }
624
+
625
+ /** `{ field, target }` for each Reference (R) column that declares a link. */
626
+ declare function getLinks(entity: EntityDef): Array<{
627
+ field: string;
628
+ target: string;
629
+ }>;
630
+ /**
631
+ * Identity-trait primary-key column codes for `entityCode` (e.g. `invoice_id`),
632
+ * excluding any the author already declared explicitly. Empty unless the entity
633
+ * carries the `identity` trait.
634
+ */
635
+ declare function getIdentityKeys(entity: EntityDef, entityCode: string): string[];
636
+ /**
637
+ * All primary-key column codes: fields flagged `isPk`, plus identity-trait keys.
638
+ * Order is explicit-first, then identity keys; duplicates removed.
639
+ */
640
+ declare function getPrimaryKeys(entity: EntityDef, entityCode: string): string[];
641
+
642
+ /** `viewType` values for `ui/data_views.json`. Source: data_views.schema.json. */
643
+ type ViewType = "grid" | "list" | "kanban" | "calendar" | "gallery" | "tree-grid" | "diagram" | "master-detail" | "library" | "matrix";
644
+ /** Friendly picker list of the view kinds. */
645
+ declare const dataViewKinds: readonly NamedKind[];
646
+ /** A column in a data source: shorthand string code or a configured object. */
647
+ type ViewColumn = string | {
648
+ /** Column code. */
649
+ column_cd: string;
650
+ /** Column width in pixels. */
651
+ width?: number;
652
+ /** Whether the column is visible (default true). */
653
+ visible?: boolean;
654
+ /** Pin column to an edge. */
655
+ pinned?: "left" | "right";
656
+ };
657
+ /** One data source within a view. */
658
+ interface DataSource {
659
+ /** Entity code to query. */
660
+ entityCode: string;
661
+ /** Nesting level (0 = root, 1+ = detail). */
662
+ level?: number;
663
+ /** Human-readable label (used in master-detail tabs). */
664
+ label?: string;
665
+ /** Column configuration. */
666
+ columns?: ViewColumn[];
667
+ /** Set field on the parent entity linking to this detail level. */
668
+ parentSetField?: string;
669
+ /** Per-source filter; overrides the view-level filter for this source. */
670
+ filter?: Filter;
671
+ /** Per-source sort order (array of `{ c, d }` entries). */
672
+ order?: unknown;
673
+ }
674
+ interface KanbanViewConfig {
675
+ /** Dropdown/flags/reference column to group cards by. */
676
+ groupByField: string;
677
+ }
678
+ interface CalendarViewConfig {
679
+ /** Date/timestamp column used to place events. */
680
+ dateField: string;
681
+ /** Column shown as event title (defaults to the entity toString). */
682
+ titleField?: string;
683
+ /** Column whose value drives the event pill color. */
684
+ colorField?: string;
685
+ }
686
+ interface TreeGridViewConfig {
687
+ /** Self-referencing FK column (parent record). */
688
+ parentField: string;
689
+ /** Node label field (defaults to entity toString). */
690
+ labelField?: string;
691
+ /** Field containing a Bootstrap icon class per node. */
692
+ iconField?: string;
693
+ }
694
+ interface ListLevelConfig {
695
+ /** Entity code for this child level. */
696
+ entityCode: string;
697
+ /** FK column in the child entity linking back to the parent. */
698
+ foreignKey: string;
699
+ /** Columns to display inline for each child row. */
700
+ columns?: string[];
701
+ }
702
+ interface ListViewConfig {
703
+ titleField?: string;
704
+ subtitleField?: string;
705
+ /** Hierarchical child levels for expandable list rows. */
706
+ levels?: ListLevelConfig[];
707
+ }
708
+ interface DiagramViewConfig {
709
+ /** Column to group diagram nodes by. */
710
+ groupByField?: string;
711
+ /** Group values hidden by default. */
712
+ defaultHiddenGroups?: string[];
713
+ }
714
+ /** A single data view (value in the `ui/data_views.json` map). */
715
+ interface DataViewDef {
716
+ viewType: ViewType;
717
+ /** Human-readable view name. */
718
+ label?: string;
719
+ /** Bootstrap icon class (e.g. 'bi-bounding-box'). */
720
+ icon?: string;
721
+ description?: string;
722
+ /** Data sources (at least one; master-detail needs two). */
723
+ dataSources: DataSource[];
724
+ /** Default filter applied to all sources unless one declares its own. */
725
+ filter?: Filter;
726
+ /** Default sort order. */
727
+ order?: unknown;
728
+ /** View-type-specific configuration. */
729
+ viewConfig?: KanbanViewConfig | CalendarViewConfig | TreeGridViewConfig | ListViewConfig | DiagramViewConfig | Record<string, unknown>;
730
+ }
731
+ /** A `ui/data_views.json` file: data view code → definition. */
732
+ type DataViewsFile = Record<string, DataViewDef>;
733
+
734
+ /** Report visualization types. Source: reports.schema.json (`vizType`). */
735
+ type VizType = "table" | "chart" | "metric" | "pivot";
736
+ /** Friendly picker list of report visualization types. */
737
+ declare const vizTypes: readonly NamedKind[];
738
+ /** Chart kinds used by report `config.chartType` (curated; rendered via Chart.js). */
739
+ declare const chartTypes: readonly NamedKind[];
740
+ /** A report parameter definition (report- or dataset-level). */
741
+ interface ParamDef {
742
+ /** Field type code (see settings for the common list). */
743
+ fieldTypeCd: string;
744
+ label?: string;
745
+ /** Display order in the parameter form (falls back to declaration order). */
746
+ orderNum?: number;
747
+ /** Whether the user must provide a value. */
748
+ required?: boolean;
749
+ /** Alternate spelling of `required` used by some modules. Prefer `required`. */
750
+ isRequired?: boolean;
751
+ /** Default value applied when the user doesn't provide one. */
752
+ default?: unknown;
753
+ /** Entity link for lookup-type params. */
754
+ link?: {
755
+ entity: string;
756
+ otherKey?: string;
757
+ };
758
+ /** Field-type-specific params. */
759
+ params?: Record<string, unknown>;
760
+ }
761
+ /** SQL/entity query for a `datasetType: 'Q'` dataset. */
762
+ interface ReportQuery {
763
+ /** Source entity code. */
764
+ entityCd: string;
765
+ /** Column codes to select (supports dot navigation: 'customer.name'). */
766
+ columns?: string[];
767
+ filter?: Filter;
768
+ sort?: SortClause[];
769
+ }
770
+ /** Per-column metadata override on a dataset. */
771
+ interface ColumnDef {
772
+ label?: string;
773
+ visible?: boolean;
774
+ width?: number;
775
+ }
776
+ /** A report dataset (value in the report's `datasets` map). */
777
+ interface Dataset {
778
+ /** Display label (used in panel headings if no `title`). */
779
+ caption?: string;
780
+ /** Q = SQL/entity query, S = stored procedure. */
781
+ datasetType: "Q" | "S";
782
+ /** Used when `datasetType` is 'Q'. */
783
+ query?: ReportQuery;
784
+ /** Used when `datasetType` is 'S'. */
785
+ procedureName?: string;
786
+ /** Optional column metadata overrides: field code → override. */
787
+ columnsDef?: Record<string, ColumnDef>;
788
+ /** Dataset-level parameters (alternative to report-level `parameters`). */
789
+ params?: Record<string, ParamDef>;
790
+ }
791
+ /** A single visualization panel within the report layout. */
792
+ interface ReportPanel {
793
+ vizType: VizType;
794
+ /** Dataset code (key in the report's `datasets` map). */
795
+ datasetCd: string;
796
+ title?: string;
797
+ /** Viz-type-specific config (chart → { chartType, categoryCol, … }). */
798
+ config?: Record<string, unknown>;
799
+ }
800
+ interface ReportLayout {
801
+ panels: ReportPanel[];
802
+ }
803
+ /** A single report (value in the `ui/reports.json` map). */
804
+ interface ReportDef {
805
+ /** Human-readable report title. */
806
+ description: string;
807
+ layout: ReportLayout;
808
+ /** Dataset code → dataset definition. */
809
+ datasets: Record<string, Dataset>;
810
+ /** Report-level parameters (alternative to per-dataset `params`). */
811
+ parameters?: Record<string, ParamDef>;
812
+ }
813
+ /** A `ui/reports.json` file: report code → definition. */
814
+ type ReportsFile = Record<string, ReportDef>;
815
+
816
+ /** Author block on a manifest. */
817
+ interface ManifestAuthor {
818
+ name: string;
819
+ url?: string;
820
+ }
821
+ /** A dependency value: a semver range, or a partial-dep object. */
822
+ type ModuleDependency = string | {
823
+ version: string;
824
+ entities?: string[];
825
+ };
826
+ /** A module package manifest (`manifest.json`). */
827
+ interface ManifestDef {
828
+ /** Package format version (currently 1). */
829
+ packageFormat: number;
830
+ /** Globally unique module UUID. */
831
+ moduleId: string;
832
+ /** Human-readable module code (becomes the schema name and `module_cd`). */
833
+ code: string;
834
+ /** 'module' (default) or 'pack' (a dependency bundle owning no entities). */
835
+ kind?: "module" | "pack";
836
+ /** Module version (semver). */
837
+ version: string;
838
+ /** Database schema version (semver). */
839
+ dbSchemaVersion: string;
840
+ displayName: string;
841
+ description?: string;
842
+ /** Schema name override (defaults to `code`; system modules use 'dForge'). */
843
+ schemaName?: string;
844
+ /** System module flag (cannot be uninstalled, admin-only). Omit for regular modules. */
845
+ system?: boolean;
846
+ author?: ManifestAuthor;
847
+ /** License identifier (e.g. 'proprietary', 'MIT'). */
848
+ license?: string;
849
+ /** Module code → semver range or partial-dep object. */
850
+ dependencies?: Record<string, ModuleDependency>;
851
+ /** Default audit history mode for this module's entities. */
852
+ auditHistory?: "none" | "minimal" | "full";
853
+ /** Entity code → relative path of its JSON file (dotted keys = extensions). */
854
+ entities?: Record<string, string>;
855
+ /** Module category for display (e.g. 'Integration', 'Finance'). */
856
+ category?: string;
857
+ /** Free-form tags for search/discovery. */
858
+ tags?: string[];
859
+ /** Bootstrap icon class (e.g. 'bi-link-45deg'). */
860
+ icon?: string;
861
+ /** Non-English locales the package promises to translate. */
862
+ supportedLocales?: string[];
863
+ /** Initial creation date (YYYY-MM-DD). Informational. */
864
+ created?: string;
865
+ /** Last manifest edit date (YYYY-MM-DD). Informational. */
866
+ updated?: string;
867
+ }
868
+
869
+ /**
870
+ * Allowed storage-class tokens for a consumed column — Postgres type names with
871
+ * length/scale stripped. Closed allowlist, kept in lockstep with the `type` enum in
872
+ * `deps.schema.json` (and `DependencyContractValidator.ValidColumnTypes` on the C#
873
+ * side); the `schemas.test.ts` parity guard fails if this drifts from the schema.
874
+ * Extend all three together if a provider column legitimately uses a type not here.
875
+ */
876
+ 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"];
877
+ /**
878
+ * Storage class pinned for a consumed column — the provider's physical Postgres type
879
+ * with length/scale stripped (e.g. `int8`, `numeric`, `varchar`). dForge's `cuid`
880
+ * Snowflake PK normalizes to `int8`. Pinning the storage class (not a coarse base
881
+ * type) keeps FK/lookup compatibility meaningful — an `int8` key needs `int8`, not
882
+ * any number. One of {@link DEP_COLUMN_TYPES}.
883
+ */
884
+ type DepColumnType = (typeof DEP_COLUMN_TYPES)[number];
885
+ /** Whether the consumer reads or writes a column. Default `read`. */
886
+ type DepColumnMode = "read" | "write";
887
+ /** Kinds of cross-module usage a provenance token can name. */
888
+ type DepProvenanceKind = "ref" | "extends" | "formula" | "action" | "view" | "report" | "print" | "role";
889
+ /**
890
+ * A usage token of the form `<kind>:<symbol>` — e.g. `ref:invoice.customer`,
891
+ * `extends:party`, `action:check_credit`, `role:fin.admin`. Names the consuming
892
+ * symbol so the completeness lint can reconcile declared vs actual usage. Note:
893
+ * `display` is intentionally not a kind — the label is the provider's concern.
894
+ */
895
+ type DepProvenance = `${DepProvenanceKind}:${string}`;
896
+ /** A single consumed provider column. */
897
+ interface DepColumn {
898
+ /** Storage class — the provider column's physical Postgres type, params stripped (`int8`, `varchar`, `numeric`, …). */
899
+ type: DepColumnType;
900
+ /** Per-column provenance: which symbols read/write/join on this column. */
901
+ use: DepProvenance[];
902
+ /** `write` implies an insert/update right + settable column. Default `read`; omit for reads. */
903
+ mode?: DepColumnMode;
904
+ }
905
+ /** What the consumer needs from one provider entity. */
906
+ interface DepEntity {
907
+ /** The provider entity's PK column — the anchor every reference joins on. No label/display. */
908
+ pk: string;
909
+ /** Entity-level provenance: why this entity is consumed (ref/extends/role/view/report/print/action). */
910
+ use: DepProvenance[];
911
+ /** Provider columns actually read/written/joined. Omit for extension-only targets. */
912
+ columns?: Record<string, DepColumn>;
913
+ }
914
+ /** A `deps/<provider>.json` file: the consumer's contract against one dependency. */
915
+ interface DepsFile {
916
+ /** Code of the dependency (provider) module this contract is against (e.g. `parties`). */
917
+ module: string;
918
+ /** Semver range the consumer requires of the provider (e.g. `>=0.1.0`). */
919
+ version: string;
920
+ /** Consumed provider entities, keyed by entity code. */
921
+ entities: Record<string, DepEntity>;
922
+ }
923
+
924
+ /** A single reusable column domain. */
925
+ interface DomainDef {
926
+ /** Human-readable label. Localizable via `translations/<locale>.json` → `domains.<code>.label`. */
927
+ description?: string;
928
+ /**
929
+ * Base datatype the domain stands for. Required — it is what a consuming column's
930
+ * DDL is generated from.
931
+ */
932
+ baseDatatypeCd: BaseDatatypeCd;
933
+ /** Physical Postgres type for consuming columns; omit to infer from `fieldTypeCd`. */
934
+ dbDatatype?: string;
935
+ /** Control used to render/edit consuming columns (e.g. `dropdown`, `text`, `number`). */
936
+ fieldTypeCd?: FieldTypeCd;
937
+ /** Max length for string-backed domains. */
938
+ maxLen?: number;
939
+ /** Decimal precision for numeric domains. */
940
+ precision?: number;
941
+ /**
942
+ * Field-type config shared by every consuming column — most importantly the option
943
+ * list for `dropdown`/`radio`/`flags`. Never copied onto columns: it resolves from
944
+ * the domain at load time, which is what lets its labels be translated once for all
945
+ * consumers. Per-locale label/icon/color overrides live in `translations/<locale>.json`
946
+ * under `domains.<code>.options.<value>`.
947
+ */
948
+ params?: {
949
+ options?: (string | FieldOption)[];
950
+ } & Record<string, unknown>;
951
+ }
952
+ /** A `domains.json` file: reusable column domains keyed by domain code. */
953
+ type DomainsFile = Record<string, DomainDef>;
954
+
955
+ /** Menu item type: V=Data View, D=Document, R=Report, null=folder/section. */
956
+ type MenuItemType = "V" | "D" | "R" | null;
957
+ /** A menu item; folder/section nodes nest children and omit `itemType`. */
958
+ interface MenuItemDef {
959
+ itemType?: MenuItemType;
960
+ /** Data view code (when `itemType` is 'V'). */
961
+ dataViewCode?: string;
962
+ /** Document code (when `itemType` is 'D'). */
963
+ documentCode?: string;
964
+ /** Report code (when `itemType` is 'R'). */
965
+ reportCode?: string;
966
+ orderNum?: number;
967
+ /** Display text. */
968
+ label: string;
969
+ description?: string;
970
+ /** Bootstrap icon name. */
971
+ icon?: string;
972
+ /** Child items keyed by item code (folder/section nodes). */
973
+ children?: Record<string, MenuItemDef>;
974
+ }
975
+ /** A menu (value in the `ui/menus.json` map). */
976
+ interface MenuDef {
977
+ label: string;
978
+ description?: string;
979
+ /** Folder codes where this menu is available. */
980
+ folders?: string[];
981
+ /** Menu items keyed by item code. */
982
+ items: Record<string, MenuItemDef>;
983
+ }
984
+ /** A `ui/menus.json` file: menu code → definition. */
985
+ type MenusFile = Record<string, MenuDef>;
986
+
987
+ /** Per-entity binding within a folder. */
988
+ interface FolderEntityBinding {
989
+ /** Data view code to use in this folder (commonly 'default'). */
990
+ viewName?: string;
991
+ /** Enable the quick-add (+) button for this entity here. */
992
+ quickAdd?: boolean;
993
+ /** Row-level filter: a SQL expression string or a canonical filter object. */
994
+ rowFilter?: string | Filter;
995
+ }
996
+ /** A folder node (the folders.json root, and each entry under `children`). */
997
+ interface FolderDef {
998
+ label?: string;
999
+ description?: string;
1000
+ /** Parent folder code (only used by sparse-tree imports; usually omitted). */
1001
+ parentCode?: string | null;
1002
+ /** URL-friendly folder path override. */
1003
+ folderPath?: string;
1004
+ /** Accent color (hex, e.g. '#2196F3'). */
1005
+ color?: string;
1006
+ /** Bootstrap icon class (e.g. 'bi-folder'). */
1007
+ icon?: string;
1008
+ /** Inherit security rights from the parent folder (default true). */
1009
+ inheritSecurity?: boolean;
1010
+ /** Entity code → folder-entity binding. */
1011
+ entities?: Record<string, FolderEntityBinding>;
1012
+ /** Nested folders keyed by sub-folder code (recursive). */
1013
+ children?: Record<string, FolderDef>;
1014
+ }
1015
+ /** A `folders.json` file: the root folder itself. */
1016
+ type FoldersFile = FolderDef;
1017
+
1018
+ /** A role with its entity rights (value in the roles map). */
1019
+ interface RoleDef {
1020
+ /** Role display name. */
1021
+ description: string;
1022
+ /** Entity code → rights string. Rights: S/I/U/D/C/E (pattern ^[SIUDCE]*$). */
1023
+ rights: Record<string, string>;
1024
+ }
1025
+ /** A `roles.json` file: role code → definition. */
1026
+ type RolesFile = Record<string, RoleDef>;
1027
+
1028
+ /** Underlying primitive datatype for a setting. */
1029
+ type SettingBaseDatatype = "string" | "number" | "bool" | "date" | "dateTime" | "time" | "json";
1030
+ /** A single setting definition (value in the settings map). */
1031
+ interface SettingDef {
1032
+ /** Field type code (must match a `dforge.field_type` code). */
1033
+ fieldTypeCd: string;
1034
+ /** Underlying primitive datatype (older settings declare this explicitly). */
1035
+ baseDatatypeCd?: SettingBaseDatatype;
1036
+ /** Display label (preferred for new settings). */
1037
+ label?: string;
1038
+ /** Display label (older style). Prefer `label`. */
1039
+ description?: string;
1040
+ /** Alternative older label key. Prefer `label`. */
1041
+ desc?: string;
1042
+ /** Default value before the user sets one. */
1043
+ defaultValue?: unknown;
1044
+ /** Formula to evaluate the default (alternative to `defaultValue`). */
1045
+ formula?: string;
1046
+ /** If true, must be set somewhere in the folder chain for install to proceed. */
1047
+ required?: boolean;
1048
+ /** Field-type-specific parameters (dropdown options, min/max, lookup link, …). */
1049
+ params?: Record<string, unknown>;
1050
+ }
1051
+ /** A `settings.json` file: setting code → definition. */
1052
+ type SettingsFile = Record<string, SettingDef>;
1053
+
1054
+ /** A single scheduled-job declaration. */
1055
+ interface JobDef {
1056
+ /** Unique identifier within the module. */
1057
+ code: string;
1058
+ description?: string;
1059
+ /** Action code in this module the scheduler fires. */
1060
+ action: string;
1061
+ /** Five-field cron expression (minute granularity). */
1062
+ schedule: string;
1063
+ /** Static parameters passed to the action as `__params`. */
1064
+ params?: Record<string, unknown>;
1065
+ /** Hard timeout in seconds (1–3600; > 300 requires class 'long_running'). */
1066
+ timeout: number;
1067
+ /** Max parallel runs (1–5; default 1). */
1068
+ concurrency?: number;
1069
+ /** Idempotency key template, e.g. '{job_cd}:{run.month}'. */
1070
+ idempotencyKey?: string;
1071
+ /** Routing class ('long_running' required for any timeout > 300s). */
1072
+ class?: "standard" | "long_running";
1073
+ /** IANA tz name overriding the tenant default. */
1074
+ timeZone?: string;
1075
+ /** Master switch (default true). */
1076
+ enabled?: boolean;
1077
+ /** Soft pause; admin 'trigger now' still works (default false). */
1078
+ paused?: boolean;
1079
+ }
1080
+ /** A `logic/jobs.json` file. */
1081
+ interface JobsFile {
1082
+ /** At most 50 jobs per module. */
1083
+ jobs: JobDef[];
1084
+ }
1085
+
1086
+ /** DB event a trigger or webhook watches. */
1087
+ type EntityEvent = "insert" | "update" | "delete" | "status_change" | "any";
1088
+ /** A single trigger declaration. */
1089
+ interface TriggerDef {
1090
+ /** Trigger code, unique within the module. */
1091
+ code: string;
1092
+ description?: string;
1093
+ /** Entity whose events this watches (cross-module via 'module.entity'). */
1094
+ entity: string;
1095
+ event: EntityEvent;
1096
+ /** Optional `[field]`-syntax formula; trigger fires only when true. */
1097
+ condition?: string;
1098
+ /** Action code to invoke (cross-module form 'module.action' supported). */
1099
+ action: string;
1100
+ /** Static parameters passed to the action, merged with the injected record id. */
1101
+ params?: Record<string, unknown>;
1102
+ /**
1103
+ * true: run in the background after the triggering tx commits (failures logged, not surfaced).
1104
+ * false (default): run synchronously in the same tx — a failure rolls the mutation back and
1105
+ * returns the error to the caller. Keep async:false actions fast.
1106
+ */
1107
+ async?: boolean;
1108
+ }
1109
+ /** A `logic/triggers.json` file. */
1110
+ interface TriggersFile {
1111
+ triggers: TriggerDef[];
1112
+ }
1113
+
1114
+ /** Outbound payload shaping for a webhook subscription. */
1115
+ interface WebhookPayload {
1116
+ /** Field codes to include. If omitted, all visible fields are included. */
1117
+ include?: string[];
1118
+ /** Include previous field values on update/status_change events. */
1119
+ includeOld?: boolean;
1120
+ }
1121
+ /** A single webhook subscription. */
1122
+ interface WebhookSubscription {
1123
+ /** Unique identifier within the module. */
1124
+ code: string;
1125
+ description: string;
1126
+ /** Entity code that triggers this webhook. */
1127
+ entity: string;
1128
+ event: EntityEvent;
1129
+ /** Formula evaluated against the record; webhook fires only if true. */
1130
+ condition?: string;
1131
+ /** Default endpoint URL (admin can override). */
1132
+ endpointUrl?: string;
1133
+ /** Secret code for the API key (from `dforge.secret`). */
1134
+ secretCd?: string;
1135
+ payload?: WebhookPayload;
1136
+ /** Enabled (default true). */
1137
+ enabled?: boolean;
1138
+ }
1139
+ /** A `webhooks.json` file. */
1140
+ interface WebhooksFile {
1141
+ subscriptions: WebhookSubscription[];
1142
+ }
1143
+
1144
+ /** Page margins (CSS lengths, e.g. '15mm'). */
1145
+ interface PrintMargins {
1146
+ top?: string;
1147
+ right?: string;
1148
+ bottom?: string;
1149
+ left?: string;
1150
+ }
1151
+ /** Default page geometry applied when printing from the UI. */
1152
+ interface PrintPageSettings {
1153
+ size?: "A4" | "letter" | "legal";
1154
+ orientation?: "portrait" | "landscape";
1155
+ margins?: PrintMargins;
1156
+ }
1157
+ /**
1158
+ * A print template or snippet (value in the print_templates map).
1159
+ * `type: 'template'` (default) is entity-bound; `type: 'snippet'` is a
1160
+ * module-scoped Liquid partial included via {% include 'module.snippet' %}.
1161
+ * Either `file` or `template` must be set (`file` wins when both are present).
1162
+ */
1163
+ interface PrintTemplateDef {
1164
+ type?: "template" | "snippet";
1165
+ /** Entity code rendered. Required for templates; ignored for snippets. */
1166
+ entityCd?: string;
1167
+ /** Human-readable label shown in the print menu. */
1168
+ description?: string;
1169
+ /** Inline Liquid HTML. */
1170
+ template?: string;
1171
+ /** Relative path under the module's `print_templates/` directory. */
1172
+ file?: string;
1173
+ /** Inline CSS, or a `.css` filename resolved relative to `print_templates/`. */
1174
+ css?: string;
1175
+ pageSettings?: PrintPageSettings;
1176
+ }
1177
+ /** A `ui/print_templates.json` file: template_cd → definition. */
1178
+ type PrintTemplatesFile = Record<string, PrintTemplateDef>;
1179
+
1180
+ /** A seed-data file: records to insert into one entity. */
1181
+ interface SeedDataFile {
1182
+ /** Target entity code. */
1183
+ entityCode: string;
1184
+ /** Records to insert; each is a `column_code → value` map. */
1185
+ records: Record<string, unknown>[];
1186
+ }
1187
+
1188
+ /**
1189
+ * Execution mode. 'single' (default) and 'each' run the DSL per selected record;
1190
+ * 'batch' runs once with all records exposed as `__records`.
1191
+ */
1192
+ type ActionExecutionMode = "single" | "each" | "batch";
1193
+ /** A single action declaration (value in the `ui/actions.json` map). */
1194
+ interface ActionDef {
1195
+ /** Human-readable description. */
1196
+ description: string;
1197
+ /** Button label. */
1198
+ label: string;
1199
+ /** Bootstrap icon class (e.g. 'bi-telephone-check'). */
1200
+ icon: string;
1201
+ /** Entity code this action targets. */
1202
+ entityCode: string;
1203
+ /** Per-record vs. batch execution. */
1204
+ executionMode: ActionExecutionMode;
1205
+ /** DSL script name (file under `logic/actions/<script>.dsl`). */
1206
+ script: string;
1207
+ /** Run inside a transaction (failures roll back). */
1208
+ isTransacted?: boolean;
1209
+ /** Display order. */
1210
+ orderNum?: number;
1211
+ /** Run in the background (newer `async`; some modules use `isAsync`). */
1212
+ async?: boolean;
1213
+ /** Alternate spelling of `async` used by some modules. Prefer `async`. */
1214
+ isAsync?: boolean;
1215
+ }
1216
+ /** A `ui/actions.json` file: action code → definition. */
1217
+ type ActionsFile = Record<string, ActionDef>;
1218
+
1219
+ declare const flagDefs: readonly {
28
1220
  value: "V" | "I" | "E" | "M" | "H";
29
1221
  label: string;
30
1222
  }[];
31
- //# sourceMappingURL=index.d.ts.map
1223
+
1224
+ export { AGG_TYPE_LIST, type AccumulationConfig, type ActionDef, type ActionExecutionMode, type ActionsFile, AggType, type AlignType, type BaseDatatypeCd, type CalendarViewConfig, type ColumnDef, type ColumnTypeCd, type ColumnTypeDef, DEP_COLUMN_TYPES, type DataSource, type DataViewDef, type DataViewsFile, type Dataset, type DepColumn, type DepColumnMode, type DepColumnType, type DepEntity, type DepProvenance, type DepProvenanceKind, type DepsFile, type DeriveOptions, type DiagramViewConfig, type DomainDef, type DomainsFile, type EntityDef, type EntityEvent, type EntityReference, FILTER_GROUP_OPERATORS, FILTER_OPERATORS, type FieldDef, type FieldLink, type FieldOption, type FieldTypeCd, type FieldTypeDef, type Filter, type FilterCondition, type FilterGroup, type FilterGroupOperator, type FilterOperator, type FlagCd, type FolderDef, type FolderEntityBinding, type FoldersFile, type JobDef, type JobsFile, type KanbanViewConfig, type LedgerRegistryEntry, type ListLevelConfig, type ListViewConfig, type ManifestAuthor, type ManifestDef, type MenuDef, type MenuItemDef, type MenuItemType, type MenusFile, type ModuleDependency, NUMERIC_TOTAL, type NamedKind, type NumberSequenceDef, type ParamDef, type PeriodConfig, type PrintMargins, type PrintPageSettings, type PrintTemplateDef, type PrintTemplatesFile, type ReportDef, type ReportLayout, type ReportPanel, type ReportQuery, type ReportsFile, type RoleDef, type RolesFile, type SeedDataFile, type SettingBaseDatatype, type SettingDef, type SettingsFile, type SignConfig, type SortClause, type TraitCd, type TraitDef, type TreeGridViewConfig, type TriggerDef, type TriggersFile, type ViewColumn, type ViewType, type VizType, type WebhookPayload, type WebhookSubscription, type WebhooksFile, baseDatatypes, baseToDbDatatype, chartTypes, columnTypes, dataViewKinds, defaultParams, deriveBaseDatatype, deriveDbDatatype, expandTrait, expandTraits, fieldTypeCds, fieldTypes, fieldTypesByColumnType, flagDefs, getColumnType, getFieldType, getIdentityKeys, getLinks, getPrimaryKeys, getTrait, isFieldTypeCd, traits, vizTypes };