@dforge-core/metadata 0.0.43 → 0.0.44
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 +25 -0
- package/dist/dsl/index.js +22 -3
- package/dist/dsl/index.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schemas/entity.schema.json +13 -3
- package/schemas/reports.schema.json +6 -2
- package/schemas/translations.schema.json +21 -0
- package/src/dsl/builtins.ts +22 -3
- package/src/reports.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dforge-core/metadata",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"description": "Canonical dForge authoring registries — field types, base datatypes, column types, traits, data-view kinds and chart types — with derivation helpers. Runtime-dependency-free; the single source of truth shared by editors, the web app and the CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dForge",
|
|
@@ -108,10 +108,20 @@
|
|
|
108
108
|
},
|
|
109
109
|
"traits": {
|
|
110
110
|
"type": "array",
|
|
111
|
-
"description": "Entity traits expanded during module install (authoring shortcut).
|
|
111
|
+
"description": "Entity traits expanded during module install (authoring shortcut): a platform trait, or one the module declares in its own traits.json. Pack and install refuse a name that is neither; the schema cannot see traits.json, so it accepts any trait-shaped name and lists only the platform traits.",
|
|
112
112
|
"items": {
|
|
113
|
-
"
|
|
114
|
-
|
|
113
|
+
"anyOf": [
|
|
114
|
+
{
|
|
115
|
+
"type": "string",
|
|
116
|
+
"enum": ["identity", "audit", "audit-full", "soft-delete", "sorting", "postable", "accumulation", "ledger", "period", "file-library"],
|
|
117
|
+
"description": "Platform trait."
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"type": "string",
|
|
121
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$",
|
|
122
|
+
"description": "A trait declared in the module's own traits.json."
|
|
123
|
+
}
|
|
124
|
+
]
|
|
115
125
|
},
|
|
116
126
|
"uniqueItems": true
|
|
117
127
|
},
|
|
@@ -401,9 +401,13 @@
|
|
|
401
401
|
|
|
402
402
|
"columnDef": {
|
|
403
403
|
"type": "object",
|
|
404
|
+
"description": "Override of one column the dataset already projects (from the entity, the stored procedure's result columns, or the register). Name only what differs: each key replaces the projected value. A label here is a literal and wins over a translated header.",
|
|
404
405
|
"properties": {
|
|
405
|
-
"label": { "type": "string" },
|
|
406
|
-
"
|
|
406
|
+
"label": { "type": "string", "description": "Column header. Not translated: leave it out to keep the entity's or the procedure's translated header." },
|
|
407
|
+
"fieldTypeCd": { "type": "string", "description": "Control the value renders with, replacing the projected one." },
|
|
408
|
+
"format": { "type": "string", "description": "Display format, replacing the column's display format." },
|
|
409
|
+
"baseDatatypeCd": { "type": "string", "description": "Read only where the dataset projects no columns of its own (a stored procedure with no result columns), when columnsDef is the column list. Ignored as an override: the projected column's datatype stands." },
|
|
410
|
+
"visible": { "type": "boolean", "description": "Accepted, but neither report.run nor the client reads it: it has no effect." },
|
|
407
411
|
"width": { "type": "integer", "minimum": 1 }
|
|
408
412
|
},
|
|
409
413
|
"additionalProperties": false
|
|
@@ -84,6 +84,23 @@
|
|
|
84
84
|
"$ref": "#/$defs/report"
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
+
"storedProcedures": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"description": "Stored-procedure code (logic/stored_procedures.json) → result-column headers. A header belongs to the procedure, not to a report: every dataset bound to the procedure shows the same translation. A dataset's columnsDef label overrides it with a literal, so leave the label out of columnsDef to keep the column translated. Required, per declared column, by `module pack` / `module validate` for each non-English supported locale; install only warns.",
|
|
90
|
+
"additionalProperties": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"properties": {
|
|
94
|
+
"columns": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"description": "Result column code → header.",
|
|
97
|
+
"additionalProperties": {
|
|
98
|
+
"$ref": "#/$defs/labelOnly"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
87
104
|
"actions": {
|
|
88
105
|
"type": "object",
|
|
89
106
|
"description": "Action code (ui/actions.json) → label, tooltip and parameter labels.",
|
|
@@ -248,6 +265,10 @@
|
|
|
248
265
|
"label": {
|
|
249
266
|
"$ref": "#/$defs/label"
|
|
250
267
|
},
|
|
268
|
+
"desc": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"description": "Translated report description."
|
|
271
|
+
},
|
|
251
272
|
"datasets": {
|
|
252
273
|
"type": "object",
|
|
253
274
|
"description": "Dataset code → caption.",
|
package/src/dsl/builtins.ts
CHANGED
|
@@ -149,9 +149,9 @@ export const BUILTINS: Builtin[] = [
|
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
name: "sendEmail",
|
|
152
|
-
signature: "sendEmail(to, subjectOrTemplate, dataOrBody?)",
|
|
152
|
+
signature: "sendEmail(to, subjectOrTemplate, dataOrBody?, attachments?)",
|
|
153
153
|
returns: "void",
|
|
154
|
-
doc: "Queue an outbound email. Three arguments, and the **second** picks the mode: `sendEmail(to, 'order.shipped', { ref: [code] })` sends a template, `sendEmail(to, 'Your order shipped', '<p>…</p>')` sends raw HTML. A second argument with no spaces that contains `.` or `_` is read as a template code — so a raw subject like `'Shipped.'` silently becomes one; give a raw subject spaces.
|
|
154
|
+
doc: "Queue an outbound email. Three arguments, and the **second** picks the mode: `sendEmail(to, 'order.shipped', { ref: [code] })` sends a template, `sendEmail(to, 'Your order shipped', '<p>…</p>')` sends raw HTML. A second argument with no spaces that contains `.` or `_` is read as a template code — so a raw subject like `'Shipped.'` silently becomes one; give a raw subject spaces. The optional **fourth** argument attaches files: a `printPdf()` result, or an array of them (`[a, b]`; pass a single file as itself, because a one-name `[a]` reads as a field reference in the DSL). Only a `printPdf()` result can be attached, and only by the user who generated it (or a workspace admin); at most 5 files and 10 MB in all per email (`Email:MaxAttachments`, `Email:MaxAttachmentBytes`). A file the sender may not attach fails the action. Not available in a scheduled job, whose emails with attachments are not queued.",
|
|
155
155
|
},
|
|
156
156
|
|
|
157
157
|
// External calls
|
|
@@ -192,7 +192,19 @@ export const BUILTINS: Builtin[] = [
|
|
|
192
192
|
name: "download",
|
|
193
193
|
signature: "download(url, fileName?)",
|
|
194
194
|
returns: "void",
|
|
195
|
-
doc: "Set a download URL on the action result; the browser opens it when the action returns. It fetches nothing and stores nothing — the URL must already serve the bytes, e.g. the `/api/temp-file/{token}` a service handed back. To put a remote file INTO storage, fetch it with `callApi()` and write it to a file column.",
|
|
195
|
+
doc: "Set a download URL on the action result; the browser opens it when the action returns. It fetches nothing and stores nothing — the URL must already serve the bytes, e.g. the `/api/temp-file/{token}` a service handed back. To hand over a file the script builds, use `downloadText()` / `downloadBase64()`. To put a remote file INTO storage, fetch it with `callApi()` and write it to a file column.",
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: "downloadText",
|
|
199
|
+
signature: "downloadText(content, fileName, encoding?, mimeType?)",
|
|
200
|
+
returns: "string",
|
|
201
|
+
doc: "Hand the user a text file the script built: encodes `content` in `encoding` (`utf-8` by default; `windows-1251`, `cp866`, `koi8-u`… also work), stores it in temp storage and sets it as the action's download. Line endings are written as given (join with `'\\r\\n'` for CR LF), no BOM. Returns the signed `/api/temp-file/{token}` URL, valid for an hour (`FileStorage:TempTokenExpirationMinutes`). An action has one download: a later call replaces the earlier. In a background or scheduled run nobody receives the download, so pass the URL on in `notify()`. Max 10 MB per file, 10 files per run.",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "downloadBase64",
|
|
205
|
+
signature: "downloadBase64(base64, fileName, mimeType?)",
|
|
206
|
+
returns: "string",
|
|
207
|
+
doc: "`downloadText()` for bytes: decodes `base64` and hands it to the user as `fileName` (`application/octet-stream` unless `mimeType` says otherwise). Returns the signed download URL.",
|
|
196
208
|
},
|
|
197
209
|
{
|
|
198
210
|
name: "getSetting",
|
|
@@ -247,6 +259,13 @@ export const BUILTINS: Builtin[] = [
|
|
|
247
259
|
entityArg: 0,
|
|
248
260
|
doc: "Build a clickable link to a record, for an `entitylink` column. Always pass a **qualified** code — `entity_cd` is only unique per module.",
|
|
249
261
|
},
|
|
262
|
+
{
|
|
263
|
+
name: "printPdf",
|
|
264
|
+
signature: "printPdf(entityCd, key, templateCd)",
|
|
265
|
+
returns: "object",
|
|
266
|
+
entityArg: 0,
|
|
267
|
+
doc: "Render a print template to a PDF **as the current user** and return the stored file as `{ fileId, fileName, mimeType, size, checksum }` — a descriptor, never the bytes. `key` is the record's `{ column: value }` key (or a scalar for a single-column key); `templateCd` is the template's code on that entity. The record is read under the user's rights and the folder's row filter, as the Generate PDF button reads it. Always pass a **qualified** entity code. Not available in a scheduled job or a background action (no signed-in user), refused in a computing-only run, and limited to 10 per execution; each render holds the action's transaction open while it works.",
|
|
268
|
+
},
|
|
250
269
|
];
|
|
251
270
|
|
|
252
271
|
export const BUILTIN_BY_NAME = new Map(BUILTINS.map((b) => [b.name, b]));
|
package/src/reports.ts
CHANGED
|
@@ -115,7 +115,11 @@ export interface ReportQuery {
|
|
|
115
115
|
|
|
116
116
|
/** Per-column metadata override on a dataset. */
|
|
117
117
|
export interface ColumnDef {
|
|
118
|
+
/** A literal header: wins over the entity's or the procedure's translated one. */
|
|
118
119
|
label?: string;
|
|
120
|
+
fieldTypeCd?: string;
|
|
121
|
+
format?: string;
|
|
122
|
+
/** Accepted, but read by nothing. */
|
|
119
123
|
visible?: boolean;
|
|
120
124
|
width?: number;
|
|
121
125
|
}
|