@dforge-core/metadata 0.0.32 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/dsl/index.js +39 -0
- package/dist/dsl/index.js.map +1 -1
- package/dist/index.d.ts +68 -20
- package/dist/index.js.map +1 -1
- package/package.json +66 -67
- package/schemas/deps.schema.json +7 -2
- package/schemas/domains.schema.json +1 -1
- package/schemas/entity.schema.json +10 -13
- package/schemas/registers.schema.json +415 -0
- package/schemas/reports.schema.json +69 -4
- package/schemas/seed_data.schema.json +12 -1
- package/schemas/settings.schema.json +24 -1
- package/schemas/traits.schema.json +26 -1
- package/schemas/translations.schema.json +2 -2
- package/src/dsl/builtins.ts +47 -2
- package/src/entity.ts +3 -8
- package/src/index.ts +1 -1
- package/src/reports.ts +28 -3
- package/src/seed-data.ts +9 -1
- package/src/settings.ts +21 -8
- package/src/translations.ts +1 -1
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"views": {
|
|
34
34
|
"type": "object",
|
|
35
|
-
"description": "Data view code → label.",
|
|
35
|
+
"description": "Data view code → label and description (the subtitle under the view title).",
|
|
36
36
|
"additionalProperties": {
|
|
37
|
-
"$ref": "#/$defs/
|
|
37
|
+
"$ref": "#/$defs/labelDesc"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"menus": {
|
package/src/dsl/builtins.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// The DSL's platform globals. Signatures and prose track
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// skills/dforge-module-author/references/action-dsl.md — that file is the source
|
|
3
|
+
// of truth; re-sync when it changes. (The path used to name a dforge-mcp
|
|
4
|
+
// checkout, which this repo has no such directory for.)
|
|
5
|
+
//
|
|
6
|
+
// The list itself is pinned against the server's DslBuiltins.FunctionNames by
|
|
7
|
+
// test/dsl-builtins.test.ts, in both directions: a builtin core defines and this
|
|
8
|
+
// catalog omits is reported as dsl/unknown-builtin on correct code.
|
|
4
9
|
|
|
5
10
|
export interface Builtin {
|
|
6
11
|
name: string;
|
|
@@ -71,6 +76,46 @@ export const BUILTINS: Builtin[] = [
|
|
|
71
76
|
doc: "Load the referenced record for a FK column. Read its fields with `ref.get('field')`.",
|
|
72
77
|
},
|
|
73
78
|
|
|
79
|
+
// Register reads. The first argument names a REGISTER (`module_cd.register_cd`,
|
|
80
|
+
// declared in that module's registers.json) and not an entity, so none of these
|
|
81
|
+
// carries `entityArg` — entity-code completion there would offer the wrong list.
|
|
82
|
+
{
|
|
83
|
+
name: "getBalance",
|
|
84
|
+
signature: "getBalance(register, dims?, asOf?)",
|
|
85
|
+
returns: "object",
|
|
86
|
+
doc: "Balance of an accumulation register per resource. A dimension left out of `dims` is summed over, so passing none gives the register's total. `asOf` reads as of a date instead of now.",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "getTurnover",
|
|
90
|
+
signature: "getTurnover(register, dims, from, to)",
|
|
91
|
+
returns: "object",
|
|
92
|
+
doc: "What moved through a register over an interval: `{in, out, net}` per resource. `dims` may be `null` to sum over every dimension; `from` and `to` are both required.",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "getSlice",
|
|
96
|
+
signature: "getSlice(register, dims, onDate?, mode?)",
|
|
97
|
+
returns: "object | null",
|
|
98
|
+
doc: "One record of an information register — the latest on or before `onDate`, or `null` when there is none. Returns the record plus `_period`. Unlike a balance, a dimension may NOT be omitted: a slice is one keyed record, not a sum.",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "getAccountBalance",
|
|
102
|
+
signature: "getAccountBalance(register, account, filter?, asOf?)",
|
|
103
|
+
returns: "object",
|
|
104
|
+
doc: "Balance of one account of an accounting register: `{debit, credit, net}` per resource. `filter` narrows by a dimension, or by an analytic kind the ACCOUNT declares — an analytic takes the key alone, or `{ entity, value }` to name one entity of a kind that is a union of several.",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "getAccountTurnover",
|
|
108
|
+
signature: "getAccountTurnover(register, account, filter, from, to)",
|
|
109
|
+
returns: "object",
|
|
110
|
+
doc: "What moved through one account over an interval: `{debit, credit, net}` per resource. `filter` narrows as in `getAccountBalance` and may be `null`; `from` and `to` are both required.",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "getCorrespondence",
|
|
114
|
+
signature: "getCorrespondence(register, debitAccount, creditAccount, filter, from, to)",
|
|
115
|
+
returns: "object",
|
|
116
|
+
doc: "What moved between two accounts over an interval. Needs `lineMode: \"compound\"` — a classic register records the other half of an entry as an untied second row and cannot answer this. `filter` narrows by dimensions the two sides share, never by an analytic (an analytic belongs to one account and this read names two).",
|
|
117
|
+
},
|
|
118
|
+
|
|
74
119
|
// Messaging
|
|
75
120
|
{
|
|
76
121
|
name: "error",
|
package/src/entity.ts
CHANGED
|
@@ -162,12 +162,8 @@ export interface EntityDef {
|
|
|
162
162
|
description?: string;
|
|
163
163
|
/** Database schema name override (defaults to module schema). */
|
|
164
164
|
schema?: string;
|
|
165
|
-
/** Database table
|
|
165
|
+
/** Database table name (defaults to entity code). */
|
|
166
166
|
dbObject?: string;
|
|
167
|
-
/** When true, maps to a SQL view (read-only, no DDL). */
|
|
168
|
-
isView?: boolean;
|
|
169
|
-
/** SELECT statement for view-backed entities (`isView=true`). */
|
|
170
|
-
viewSql?: string;
|
|
171
167
|
/** Display pattern using column placeholders, e.g. "{first_name} {last_name}". */
|
|
172
168
|
toString?: string;
|
|
173
169
|
/** Audit trail level; overrides the manifest's `auditHistory`. */
|
|
@@ -191,9 +187,8 @@ export interface EntityDef {
|
|
|
191
187
|
params?: { restricted?: boolean } & Record<string, unknown>;
|
|
192
188
|
/**
|
|
193
189
|
* Entity views keyed by view name — the platform's column-level security.
|
|
194
|
-
* Unrelated to `
|
|
195
|
-
*
|
|
196
|
-
* "view" also names in this platform. A
|
|
190
|
+
* Unrelated to `ui/data_views.json` (grids, kanban, calendars), which the
|
|
191
|
+
* word "view" also names in this platform. A
|
|
197
192
|
* folder binds one view per entity through `ui/folders.json`
|
|
198
193
|
* (`entities.<code>.viewName`); users working in that folder see ONLY the
|
|
199
194
|
* columns the view lists. An entity without views (or a folder naming the
|
package/src/index.ts
CHANGED
|
@@ -148,7 +148,7 @@ export type {
|
|
|
148
148
|
SetSection,
|
|
149
149
|
TabGroupSection,
|
|
150
150
|
} from "./card-layouts";
|
|
151
|
-
export type { SeedDataFile } from "./seed-data";
|
|
151
|
+
export type { SeedDataFile, SeedDataRepeat } from "./seed-data";
|
|
152
152
|
export type { ActionsFile, ActionDef, ActionExecutionMode } from "./actions";
|
|
153
153
|
|
|
154
154
|
// Flag catalog — the only letters valid on an authored column, at field level and
|
package/src/reports.ts
CHANGED
|
@@ -120,12 +120,33 @@ export interface ColumnDef {
|
|
|
120
120
|
width?: number;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* An accounting register read over an interval: one row per account of the register's chart,
|
|
125
|
+
* with opening, turnover and closing debit/credit for one resource, netted per account.
|
|
126
|
+
*/
|
|
127
|
+
export interface RegisterSource {
|
|
128
|
+
/** The register, `module_cd.register_cd`. */
|
|
129
|
+
name: string;
|
|
130
|
+
/** The one resource the six balance columns are about. */
|
|
131
|
+
resource: string;
|
|
132
|
+
/** Two date params, or the record of `entity` a key param finds and its two date columns. */
|
|
133
|
+
interval: { entity?: string; key?: string; from: string; to: string };
|
|
134
|
+
/** Chart columns in nav notation, `<chart>.<column>`. */
|
|
135
|
+
columns?: string[];
|
|
136
|
+
/** A filter over the chart, in the same nav notation. */
|
|
137
|
+
filter?: Filter;
|
|
138
|
+
/** Chart columns to sort by, in nav notation. */
|
|
139
|
+
sort?: SortClause[];
|
|
140
|
+
/** The query rollup without `leafKey` and `measures`. */
|
|
141
|
+
rollup?: { tree: string; treeKey: string; parentField: string; labels: string[]; order?: string };
|
|
142
|
+
}
|
|
143
|
+
|
|
123
144
|
/** A report dataset (value in the report's `datasets` map). */
|
|
124
145
|
export interface Dataset {
|
|
125
146
|
/** Display label (used in panel headings if no `title`). */
|
|
126
147
|
caption?: string;
|
|
127
|
-
/** Q = SQL/entity query, S = stored procedure. */
|
|
128
|
-
datasetType: "Q" | "S";
|
|
148
|
+
/** Q = SQL/entity query, S = stored procedure, R = an accounting register read over an interval. */
|
|
149
|
+
datasetType: "Q" | "S" | "R";
|
|
129
150
|
/** Used when `datasetType` is 'Q'. */
|
|
130
151
|
query?: ReportQuery;
|
|
131
152
|
/**
|
|
@@ -134,6 +155,8 @@ export interface Dataset {
|
|
|
134
155
|
* and never schema-qualified. `module.spCd` binds a dependency's procedure.
|
|
135
156
|
*/
|
|
136
157
|
spCd?: string;
|
|
158
|
+
/** Used when `datasetType` is 'R'. */
|
|
159
|
+
register?: RegisterSource;
|
|
137
160
|
/** Optional column metadata overrides: field code → override. */
|
|
138
161
|
columnsDef?: Record<string, ColumnDef>;
|
|
139
162
|
/**
|
|
@@ -188,7 +211,9 @@ export interface ReportLayout {
|
|
|
188
211
|
|
|
189
212
|
/** A single report (value in the `ui/reports.json` map). */
|
|
190
213
|
export interface ReportDef {
|
|
191
|
-
/**
|
|
214
|
+
/** Report name: page title, breadcrumb and menu entry. Omit and `description` is the name. */
|
|
215
|
+
label?: string;
|
|
216
|
+
/** What the report shows, under its name on the page. */
|
|
192
217
|
description: string;
|
|
193
218
|
layout: ReportLayout;
|
|
194
219
|
/** Dataset code → dataset definition. */
|
package/src/seed-data.ts
CHANGED
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
export interface SeedDataFile {
|
|
6
6
|
/** Target entity code. */
|
|
7
7
|
entityCode: string;
|
|
8
|
-
/** Records to insert; each is a `column_code → value` map. */
|
|
8
|
+
/** Records to insert; each is a `column_code → value` map. In `demo-data/` a value may be `{ "$f": "<formula>" }`. */
|
|
9
9
|
records: Record<string, unknown>[];
|
|
10
|
+
/** `demo-data/` only: insert every record once per value of `@var`, `from`..`to` inclusive. */
|
|
11
|
+
repeat?: SeedDataRepeat;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SeedDataRepeat {
|
|
15
|
+
var?: string;
|
|
16
|
+
from?: number;
|
|
17
|
+
to: number;
|
|
10
18
|
}
|
package/src/settings.ts
CHANGED
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
/** Underlying primitive datatype for a setting. */
|
|
4
4
|
export type SettingBaseDatatype = "string" | "number" | "bool" | "date" | "dateTime" | "time" | "json";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
export interface
|
|
8
|
-
/** Field type code (must match a `dforge.field_type` code). */
|
|
9
|
-
fieldTypeCd: string;
|
|
10
|
-
/** Underlying primitive datatype (older settings declare this explicitly). */
|
|
11
|
-
baseDatatypeCd?: SettingBaseDatatype;
|
|
6
|
+
/** Properties carried by every setting regardless of where its control comes from. */
|
|
7
|
+
export interface SettingDefBase {
|
|
12
8
|
/** Display label (preferred for new settings). */
|
|
13
9
|
label?: string;
|
|
14
10
|
/** Display label (older style). Prefer `label`. */
|
|
@@ -21,9 +17,26 @@ export interface SettingDef {
|
|
|
21
17
|
formula?: string;
|
|
22
18
|
/** If true, must be set somewhere in the folder chain for install to proceed. */
|
|
23
19
|
required?: boolean;
|
|
24
|
-
/** Field-type-specific parameters (dropdown options, min/max, lookup link, …). */
|
|
25
|
-
params?: Record<string, unknown>;
|
|
26
20
|
}
|
|
27
21
|
|
|
22
|
+
/** A setting declares its control inline or borrows it from a reusable column domain. */
|
|
23
|
+
export type SettingDef =
|
|
24
|
+
| (SettingDefBase & {
|
|
25
|
+
/** Field type code (must match a `dforge.field_type` code). */
|
|
26
|
+
fieldTypeCd: string;
|
|
27
|
+
/** Underlying primitive datatype (older settings declare this explicitly). */
|
|
28
|
+
baseDatatypeCd?: SettingBaseDatatype;
|
|
29
|
+
/** Field-type-specific parameters (dropdown options, min/max, lookup link, …). */
|
|
30
|
+
params?: Record<string, unknown>;
|
|
31
|
+
domain?: never;
|
|
32
|
+
})
|
|
33
|
+
| (SettingDefBase & {
|
|
34
|
+
/** Column domain supplying fieldTypeCd, baseDatatypeCd and params. */
|
|
35
|
+
domain: string;
|
|
36
|
+
fieldTypeCd?: never;
|
|
37
|
+
baseDatatypeCd?: never;
|
|
38
|
+
params?: never;
|
|
39
|
+
});
|
|
40
|
+
|
|
28
41
|
/** A `settings.json` file: setting code → definition. */
|
|
29
42
|
export type SettingsFile = Record<string, SettingDef>;
|
package/src/translations.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface TranslationsFile {
|
|
|
47
47
|
domains?: Record<string, TranslatedWithOptions>;
|
|
48
48
|
/** Folder code (flat, not the path) → label. */
|
|
49
49
|
folders?: Record<string, { label?: string }>;
|
|
50
|
-
views?: Record<string, { label?: string }>;
|
|
50
|
+
views?: Record<string, { label?: string; desc?: string }>;
|
|
51
51
|
menus?: Record<string, TranslatedMenu>;
|
|
52
52
|
settings?: Record<string, { label?: string; desc?: string }>;
|
|
53
53
|
/** Module-qualified role code → label. */
|