@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 CHANGED
@@ -5,6 +5,31 @@ All notable changes to `@dforge-core/metadata` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.0.44] — 2026-10-21
9
+
10
+ ### Added
11
+
12
+ - **DSL `printPdf(entityCd, key, templateCd)`:** renders a print template to a PDF as the current user
13
+ and returns the stored file as a descriptor (`fileId`, `fileName`, `mimeType`, `size`, `checksum`).
14
+ Listed in `BUILTINS` with the entity argument checked at compile time.
15
+ - **DSL `sendEmail(to, subjectOrTemplate, dataOrBody?, attachments?)`:** an optional fourth argument
16
+ attaches files: a `printPdf()` result, or an array of them. At most 5 files and 10 MB per email.
17
+ - **DSL `downloadText(content, fileName, encoding?, mimeType?)` / `downloadBase64(base64, fileName,
18
+ mimeType?)`:** hand the user a file the script built (any code page such as `windows-1251`, line
19
+ endings as given). Both return the signed temp-file URL. Listed in `BUILTINS`; `download()` now points
20
+ to them.
21
+ - **`translations.schema.json`, `storedProcedures`:** result-column headers of a stored procedure
22
+ (`storedProcedures.<sp_cd>.columns.<column_cd>.label`), shared by every report bound to the procedure.
23
+ A report also takes a translated `desc`.
24
+
25
+ ### Changed
26
+
27
+ - **`reports.schema.json`, `columnDef`:** accepts `fieldTypeCd` and `format` (overrides `report.run`
28
+ applies) and `baseDatatypeCd` (read only when `columnsDef` is a dataset's whole column list). `visible`
29
+ stays accepted but is read by nothing. `ColumnDef` in `reports.ts` gains `fieldTypeCd` and `format`.
30
+ - **`entity.schema.json`, `traits`:** accepts a trait the module declares in its own `traits.json`, not only
31
+ the platform ones. Pack and install still refuse a name that is neither.
32
+
8
33
  ## [0.0.43] — 2026-10-19
9
34
 
10
35
  ### Added
package/dist/dsl/index.js CHANGED
@@ -854,9 +854,9 @@ var BUILTINS = [
854
854
  },
855
855
  {
856
856
  name: "sendEmail",
857
- signature: "sendEmail(to, subjectOrTemplate, dataOrBody?)",
857
+ signature: "sendEmail(to, subjectOrTemplate, dataOrBody?, attachments?)",
858
858
  returns: "void",
859
- 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>\u2026</p>')` sends raw HTML. A second argument with no spaces that contains `.` or `_` is read as a template code \u2014 so a raw subject like `'Shipped.'` silently becomes one; give a raw subject spaces. There is no fourth argument."
859
+ 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>\u2026</p>')` sends raw HTML. A second argument with no spaces that contains `.` or `_` is read as a template code \u2014 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."
860
860
  },
861
861
  // External calls
862
862
  {
@@ -895,7 +895,19 @@ var BUILTINS = [
895
895
  name: "download",
896
896
  signature: "download(url, fileName?)",
897
897
  returns: "void",
898
- doc: "Set a download URL on the action result; the browser opens it when the action returns. It fetches nothing and stores nothing \u2014 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."
898
+ doc: "Set a download URL on the action result; the browser opens it when the action returns. It fetches nothing and stores nothing \u2014 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."
899
+ },
900
+ {
901
+ name: "downloadText",
902
+ signature: "downloadText(content, fileName, encoding?, mimeType?)",
903
+ returns: "string",
904
+ doc: "Hand the user a text file the script built: encodes `content` in `encoding` (`utf-8` by default; `windows-1251`, `cp866`, `koi8-u`\u2026 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."
905
+ },
906
+ {
907
+ name: "downloadBase64",
908
+ signature: "downloadBase64(base64, fileName, mimeType?)",
909
+ returns: "string",
910
+ 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."
899
911
  },
900
912
  {
901
913
  name: "getSetting",
@@ -948,6 +960,13 @@ var BUILTINS = [
948
960
  returns: "link",
949
961
  entityArg: 0,
950
962
  doc: "Build a clickable link to a record, for an `entitylink` column. Always pass a **qualified** code \u2014 `entity_cd` is only unique per module."
963
+ },
964
+ {
965
+ name: "printPdf",
966
+ signature: "printPdf(entityCd, key, templateCd)",
967
+ returns: "object",
968
+ entityArg: 0,
969
+ doc: "Render a print template to a PDF **as the current user** and return the stored file as `{ fileId, fileName, mimeType, size, checksum }` \u2014 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."
951
970
  }
952
971
  ];
953
972
  var BUILTIN_BY_NAME = new Map(BUILTINS.map((b) => [b.name, b]));