@dforge-core/metadata 0.0.40 → 0.0.42
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 +29 -0
- package/dist/dsl/index.js +4 -4
- package/dist/dsl/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/schemas/entity.schema.json +32 -2
- package/schemas/roles.schema.json +5 -2
- package/src/dsl/builtins.ts +4 -4
- package/src/index.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.42",
|
|
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",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"ajv": "^8.20.0",
|
|
55
55
|
"tsup": "^8.5.1",
|
|
56
56
|
"typescript": "^6.0.3",
|
|
57
|
-
"vitest": "^
|
|
57
|
+
"vitest": "^5.0.4"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"sync-schemas": "node scripts/sync-schemas.mjs",
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"anyOf": [
|
|
8
8
|
{ "required": ["fields"] },
|
|
9
|
-
{ "required": ["traits"] }
|
|
9
|
+
{ "required": ["traits"] },
|
|
10
|
+
{ "required": ["extends", "reactions"] }
|
|
10
11
|
],
|
|
11
12
|
"properties": {
|
|
12
13
|
"extends": {
|
|
@@ -191,11 +192,20 @@
|
|
|
191
192
|
"type": "array",
|
|
192
193
|
"minItems": 1,
|
|
193
194
|
"items": { "type": "string" },
|
|
194
|
-
"description": "Indexed columns, in order. Install refuses any key other than fields and
|
|
195
|
+
"description": "Indexed columns, in order. Install refuses any key other than fields, using, unique and where - \"columns\", which a unique constraint accepts, included."
|
|
195
196
|
},
|
|
196
197
|
"using": {
|
|
197
198
|
"enum": ["btree", "hash", "gin", "gist", "brin"],
|
|
198
199
|
"description": "Index method. Omitted, btree."
|
|
200
|
+
},
|
|
201
|
+
"unique": {
|
|
202
|
+
"type": "boolean",
|
|
203
|
+
"description": "A unique index. With \"where\" it is unique among the rows the condition selects, which a unique constraint cannot be (unique among the rows that are not deleted)."
|
|
204
|
+
},
|
|
205
|
+
"where": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"minLength": 1,
|
|
208
|
+
"description": "A partial index: SQL condition over the table's columns, e.g. \"is_deleted = false\". Only the rows it selects are indexed, and a query uses the index only when its own filter implies the condition. One condition, without ';', '$' or comments. Changing it rebuilds the index on upgrade."
|
|
199
209
|
}
|
|
200
210
|
}
|
|
201
211
|
}
|
|
@@ -208,6 +218,26 @@
|
|
|
208
218
|
"$ref": "#/$defs/periodConfig",
|
|
209
219
|
"description": "Period entity configuration. Requires 'period' trait."
|
|
210
220
|
},
|
|
221
|
+
"periodGuards": {
|
|
222
|
+
"type": "array",
|
|
223
|
+
"description": "Closed-period locks for a document that posts to no register. Each guard names a period entity, the date the document's period follows from, and the column that references the period. The platform fills that column from the date and makes it a foreign key, so a document is written only into a period that exists and is open, and a period documents refer to cannot be deleted. Not allowed on an extension.",
|
|
224
|
+
"items": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"required": ["periodEntity", "periodDateField", "periodField", "lockedFields"],
|
|
227
|
+
"properties": {
|
|
228
|
+
"periodEntity": { "type": "string", "description": "The period entity ('period' trait): this module's, or another module's as 'module.entity'." },
|
|
229
|
+
"periodDateField": { "type": "string", "description": "The document's date column the period is resolved from." },
|
|
230
|
+
"periodField": { "type": "string", "description": "The document's column referencing the period's key (varchar, like the key). Filled by the platform from the date; whatever a writer puts there is replaced." },
|
|
231
|
+
"periodKeyField": { "type": "string", "default": "period_key", "description": "The period entity's key column. Must be its primary key or unique." },
|
|
232
|
+
"periodClosedField": { "type": "string", "default": "closed", "description": "The period entity's closed flag." },
|
|
233
|
+
"lockedFields": { "type": "array", "items": { "type": "string" }, "minItems": 1, "description": "Fields a closed period freezes. Insert and delete are always refused there, and the date is always watched; [\"periodDateField\"] refuses just that, [\"*\"] freezes the whole row." },
|
|
234
|
+
"lineEntity": { "type": "string", "description": "The document's line entity, guarded through its header's date." },
|
|
235
|
+
"lineField": { "type": "string", "description": "The line's foreign key to the header." },
|
|
236
|
+
"lockedLineFields": { "type": "array", "items": { "type": "string" }, "minItems": 1, "description": "Line fields a closed period freezes; [\"*\"] for the whole row. Required with lineEntity." }
|
|
237
|
+
},
|
|
238
|
+
"additionalProperties": false
|
|
239
|
+
}
|
|
240
|
+
},
|
|
211
241
|
"accumulation": {
|
|
212
242
|
"$ref": "#/$defs/accumulationConfig",
|
|
213
243
|
"description": "Accumulation registry configuration (simple document without lines). Requires 'accumulation' trait."
|
|
@@ -18,11 +18,14 @@
|
|
|
18
18
|
},
|
|
19
19
|
"rights": {
|
|
20
20
|
"type": "object",
|
|
21
|
-
"description": "
|
|
21
|
+
"description": "Security object → rights string. Keys are PREFIX-NAMESPACED so an action and an entity may share a code: a bare key is an entity code in this module ('invoice'), 'module.entity' is an entity owned by a module this one depends on ('parties.party'), 'action:<action_cd>' is an action from this module's ui/actions.json, and 'sp:<sp_cd>' is a stored procedure from logic/stored_procedures.json ('sp:module.sp_cd' for a dependency's), and 'report:<report_cd>' is a report from ui/reports.json ('report:module.report_cd' for a dependency's). A grant on an action written WITHOUT the 'action:' prefix is read as an entity code, resolves to nothing, and is silently dropped at install — action.execute then returns PERMISSION_DENIED.",
|
|
22
|
+
"propertyNames": {
|
|
23
|
+
"pattern": "^(action:[A-Za-z_][A-Za-z0-9_-]*|(sp|report):([A-Za-z_][A-Za-z0-9_-]*\\.)?[A-Za-z_][A-Za-z0-9_-]*|([A-Za-z_][A-Za-z0-9_-]*\\.)?[A-Za-z_][A-Za-z0-9_-]*)$"
|
|
24
|
+
},
|
|
22
25
|
"additionalProperties": {
|
|
23
26
|
"type": "string",
|
|
24
27
|
"pattern": "^[SIUDCE]*$",
|
|
25
|
-
"description": "Rights: S=Select, I=Insert, U=Update, D=Delete, C=Clone, E=Execute"
|
|
28
|
+
"description": "Rights: S=Select, I=Insert, U=Update, D=Delete, C=Clone, E=Execute. Entity objects take any of SIUDC; actions, stored procedures and reports take E."
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
},
|
package/src/dsl/builtins.ts
CHANGED
|
@@ -99,15 +99,15 @@ export const BUILTINS: Builtin[] = [
|
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
name: "getAccountBalance",
|
|
102
|
-
signature: "getAccountBalance(register, account, filter?, asOf?)",
|
|
102
|
+
signature: "getAccountBalance(register, account, filter?, asOf?, options?)",
|
|
103
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.",
|
|
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. `options`: `groupBy` (a name or array — returns an array, a row per combination with a non-zero balance), `exclude: { entity, key }` (leaves out that document's postings) and `before` (a moment, exclusive, in place of `asOf`).",
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
name: "getAccountTurnover",
|
|
108
|
-
signature: "getAccountTurnover(register, account, filter, from, to)",
|
|
108
|
+
signature: "getAccountTurnover(register, account, filter, from, to, options?)",
|
|
109
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.",
|
|
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. `options` takes `groupBy` and `exclude` as in `getAccountBalance`; a grouped turnover has a row per combination that moved.",
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
name: "getCorrespondence",
|