@dforge-core/metadata 0.0.44 → 0.0.45
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 +14 -0
- package/dist/{actions-DvYTrCbP.d.ts → actions-D-0G_mqf.d.ts} +19 -1
- package/dist/dsl/index.d.ts +1 -1
- package/dist/dsl/index.js +13 -1
- package/dist/dsl/index.js.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schemas/entity.schema.json +1 -1
- package/src/actions.ts +19 -0
- package/src/derive.ts +1 -0
- package/src/dsl/builtins.ts +13 -1
- package/src/field-types.ts +1 -0
- package/src/index.ts +1 -1
- package/src/types.ts +1 -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.45",
|
|
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",
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
"fieldTypeCd": {
|
|
429
429
|
"type": "string",
|
|
430
430
|
"enum": [
|
|
431
|
-
"text", "avatar", "email", "phone", "url", "textarea", "number", "currency", "percent",
|
|
431
|
+
"text", "avatar", "email", "phone", "url", "textarea", "number", "currency", "percent", "filesize",
|
|
432
432
|
"checkbox", "date", "datetime", "time",
|
|
433
433
|
"dropdown", "flags", "tags", "json", "hidden", "color", "image", "file",
|
|
434
434
|
"markdown", "richtext", "lookup", "user", "grid", "list", "entitylink", "code"
|
package/src/actions.ts
CHANGED
|
@@ -60,6 +60,25 @@ export interface ActionDef {
|
|
|
60
60
|
* "Run in Background". A parameterless `isAsync` action is queued directly.
|
|
61
61
|
*/
|
|
62
62
|
isAsync?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Code of a print template of the action's entity. The run dialog renders it as a PDF beside the params when the
|
|
65
|
+
* action is opened on one record, so the user sees the document the action sends before it goes.
|
|
66
|
+
*/
|
|
67
|
+
previewTemplate?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Saved parameter sets the module ships for this action, keyed by set name. They install as shared sets owned by
|
|
70
|
+
* the module: read-only for users and refreshed on every install, and a user can save a set of their own under the
|
|
71
|
+
* same name, which wins for them. Each `values` key must be a param the action declares; a string starting with `=`
|
|
72
|
+
* is a formula. Needs the action to declare params.
|
|
73
|
+
*/
|
|
74
|
+
paramSets?: Record<string, ActionParamSetDef>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** One shipped parameter set of an action. */
|
|
78
|
+
export interface ActionParamSetDef {
|
|
79
|
+
description?: string;
|
|
80
|
+
/** Value by param code. */
|
|
81
|
+
values: Record<string, unknown>;
|
|
63
82
|
}
|
|
64
83
|
|
|
65
84
|
/** A `ui/actions.json` file: action code → definition. */
|
package/src/derive.ts
CHANGED
package/src/dsl/builtins.ts
CHANGED
|
@@ -151,7 +151,7 @@ export const BUILTINS: Builtin[] = [
|
|
|
151
151
|
name: "sendEmail",
|
|
152
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. 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).
|
|
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()`, `attachText()` or `attachBase64()` 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). A `printPdf()` file can be attached only by the user who generated it (or a workspace admin) and not in a scheduled job; a file built with `attachText()` / `attachBase64()` has no owner and works everywhere, a scheduled job included. 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.",
|
|
155
155
|
},
|
|
156
156
|
|
|
157
157
|
// External calls
|
|
@@ -206,6 +206,18 @@ export const BUILTINS: Builtin[] = [
|
|
|
206
206
|
returns: "string",
|
|
207
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.",
|
|
208
208
|
},
|
|
209
|
+
{
|
|
210
|
+
name: "attachText",
|
|
211
|
+
signature: "attachText(content, fileName, encoding?, mimeType?)",
|
|
212
|
+
returns: "object",
|
|
213
|
+
doc: "Build a text file to attach to an email: encodes `content` in `encoding` (`utf-8` by default) and returns a descriptor for `sendEmail()`'s fourth argument, e.g. `sendEmail(to, 'Interview', body, attachText(ics, 'invite.ics', 'utf-8', 'text/calendar'))`. The file keeps `mimeType` (`text/plain` by default). It is the script's own output, so no user's rights are involved and it works in a scheduled job. Only the emails of this run can name it. Max 10 MB per file and 10 files per run, shared with `downloadText()` / `downloadBase64()`.",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "attachBase64",
|
|
217
|
+
signature: "attachBase64(base64, fileName, mimeType?)",
|
|
218
|
+
returns: "object",
|
|
219
|
+
doc: "`attachText()` for bytes given as base64 (`application/octet-stream` unless `mimeType` says otherwise).",
|
|
220
|
+
},
|
|
209
221
|
{
|
|
210
222
|
name: "getSetting",
|
|
211
223
|
signature: "getSetting(settingCd)",
|
package/src/field-types.ts
CHANGED
|
@@ -20,6 +20,7 @@ export const fieldTypes = [
|
|
|
20
20
|
{ cd: "number", name: "Number", columnType: "D", baseDatatypeCd: "number", supportedAgg: "SCAM", maxLen: null, precision: null, useStringInFilter: false },
|
|
21
21
|
{ cd: "currency", name: "Currency", columnType: "D", baseDatatypeCd: "number", supportedAgg: "SCAM", maxLen: null, precision: 2, useStringInFilter: false },
|
|
22
22
|
{ cd: "percent", name: "Percent", columnType: "D", baseDatatypeCd: "number", supportedAgg: "CAM", maxLen: null, precision: 2, useStringInFilter: false },
|
|
23
|
+
{ cd: "filesize", name: "File Size", columnType: "D", baseDatatypeCd: "number", supportedAgg: "SCAM", maxLen: null, precision: null, useStringInFilter: false },
|
|
23
24
|
{ cd: "checkbox", name: "Checkbox", columnType: "D", baseDatatypeCd: "bool", supportedAgg: "C", maxLen: null, precision: null, useStringInFilter: false },
|
|
24
25
|
{ cd: "date", name: "Date", columnType: "D", baseDatatypeCd: "date", supportedAgg: "CM", maxLen: null, precision: null, useStringInFilter: false },
|
|
25
26
|
{ cd: "datetime", name: "Date & Time", columnType: "D", baseDatatypeCd: "timestamp", supportedAgg: "CM", maxLen: null, precision: null, useStringInFilter: false },
|
package/src/index.ts
CHANGED
|
@@ -185,7 +185,7 @@ export type {
|
|
|
185
185
|
TabGroupSection,
|
|
186
186
|
} from "./card-layouts";
|
|
187
187
|
export type { SeedDataFile, SeedDataRepeat } from "./seed-data";
|
|
188
|
-
export type { ActionsFile, ActionDef, ActionExecutionMode } from "./actions";
|
|
188
|
+
export type { ActionsFile, ActionDef, ActionParamSetDef, ActionExecutionMode } from "./actions";
|
|
189
189
|
|
|
190
190
|
// Flag catalog — the only letters valid on an authored column, at field level and
|
|
191
191
|
// on a per-view override alike (both `flags` patterns in entity.schema.json are
|