@atscript/moost-wf 0.1.201 → 0.1.203
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/dist/index.d.mts +3 -1
- package/dist/index.mjs +5 -6
- package/dist/plugin.mjs +13 -2
- package/dist/store.mjs +2 -2
- package/package.json +12 -12
package/dist/index.d.mts
CHANGED
|
@@ -46,7 +46,9 @@ interface TFormActions {
|
|
|
46
46
|
declare function extractPassContext(type: TAtscriptAnnotatedType, wfContext: Record<string, unknown>): Record<string, unknown>;
|
|
47
47
|
/**
|
|
48
48
|
* Read declared action names from `@ui.form.action` and `@wf.action.withData` annotations.
|
|
49
|
-
*
|
|
49
|
+
* One action per field; `@wf.action.withData` wins, as on the client
|
|
50
|
+
* (`getDeclaredFormActions`): a same-id `@ui.form.action` next to it only gives
|
|
51
|
+
* the action its link label. Results are cached per type identity.
|
|
50
52
|
*/
|
|
51
53
|
declare function getFormActions(type: TAtscriptAnnotatedType): TFormActions;
|
|
52
54
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,9 @@ function extractPassContext(type, wfContext) {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Read declared action names from `@ui.form.action` and `@wf.action.withData` annotations.
|
|
23
|
-
*
|
|
23
|
+
* One action per field; `@wf.action.withData` wins, as on the client
|
|
24
|
+
* (`getDeclaredFormActions`): a same-id `@ui.form.action` next to it only gives
|
|
25
|
+
* the action its link label. Results are cached per type identity.
|
|
24
26
|
*/
|
|
25
27
|
function getFormActions(type) {
|
|
26
28
|
const cached = formActionsCache.get(type);
|
|
@@ -37,16 +39,13 @@ function getFormActions(type) {
|
|
|
37
39
|
}
|
|
38
40
|
const objectType = type;
|
|
39
41
|
for (const [, fieldType] of objectType.type.props) {
|
|
40
|
-
const formAction = fieldType.metadata.get(UI_FORM_ACTION);
|
|
41
|
-
if (formAction) {
|
|
42
|
-
actions.push(typeof formAction === "string" ? formAction : formAction.id);
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
42
|
const wfAction = fieldType.metadata.get(WF_ACTION_WITH_DATA);
|
|
46
43
|
if (wfAction) {
|
|
47
44
|
actionsWithData.push(wfAction);
|
|
48
45
|
continue;
|
|
49
46
|
}
|
|
47
|
+
const formAction = fieldType.metadata.get(UI_FORM_ACTION);
|
|
48
|
+
if (formAction) actions.push(typeof formAction === "string" ? formAction : formAction.id);
|
|
50
49
|
}
|
|
51
50
|
const result = {
|
|
52
51
|
actions,
|
package/dist/plugin.mjs
CHANGED
|
@@ -39,13 +39,14 @@ function wfPlugin() {
|
|
|
39
39
|
}
|
|
40
40
|
}) },
|
|
41
41
|
action: { withData: new AnnotationSpec({
|
|
42
|
-
description: "Form action that sends partial form data with deep-partial validation. Workflow-only — the server validates filled fields but allows missing ones. Use for actions like 'save draft' where partial data is useful.",
|
|
42
|
+
description: "Form action that sends partial form data with deep-partial validation. Workflow-only — the server validates filled fields but allows missing ones. Use for actions like 'save draft' where partial data is useful. A `@ui.form.action` with the same id on the field gives the action its link label; a different id there is an error.",
|
|
43
43
|
nodeType: ["prop", "type"],
|
|
44
44
|
argument: {
|
|
45
45
|
name: "id",
|
|
46
46
|
type: "string",
|
|
47
47
|
description: "The action name"
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
|
+
validate: validateWithData
|
|
49
50
|
}) },
|
|
50
51
|
store: { fromContext: new AnnotationSpec({
|
|
51
52
|
description: "Copy a value from `state.context` to a top-level column on every `set()`. Use to add indexable shadow columns (e.g. `approver`) for UIs and queries without forking the base wf-state schema. The JSON `state` blob remains the source of truth — columns are derived. Path: dot-notation only (`approval.approver`); no array indices or wildcards. Field type must be string | number | boolean. Field must be optional or have a default — context shape varies between flow steps and a path-miss writes null.",
|
|
@@ -63,6 +64,16 @@ function wfPlugin() {
|
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
66
|
}
|
|
67
|
+
function validateWithData(token, args) {
|
|
68
|
+
const id = args[0]?.text;
|
|
69
|
+
const linkId = token.parentNode?.annotations?.find((a) => a.name === "ui.form.action")?.args[0]?.text;
|
|
70
|
+
if (id === void 0 || linkId === void 0 || linkId === id) return [];
|
|
71
|
+
return [{
|
|
72
|
+
message: `@ui.form.action '${linkId}' and @wf.action.withData '${id}' name different actions — a field's action link and its withData must name the same action`,
|
|
73
|
+
severity: 1,
|
|
74
|
+
range: token.range
|
|
75
|
+
}];
|
|
76
|
+
}
|
|
66
77
|
const validateStoreFromContext = (token, args, doc) => {
|
|
67
78
|
const errors = [];
|
|
68
79
|
const field = token.parentNode;
|
package/dist/store.mjs
CHANGED
|
@@ -280,8 +280,8 @@ var AsWfStateRecord = class {
|
|
|
280
280
|
throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
|
-
$ak("db.index.fulltext", "db.index.fulltext.language", "db.index.fulltext.match", "db.index.plain", "db.index.unique", "db.view.joins", "expect.pattern", "ui.dict.attr", "ui.form.classes", "ui.form.styles", "ui.form.validate", "ui.literalLabel", "ui.table.classes", "ui.table.selectWith", "ui.table.styles", "wf.context.pass");
|
|
284
|
-
$nr("db.agg.avg", "db.agg.count", "db.agg.countDistinct", "db.agg.max", "db.agg.min", "db.agg.sum", "db.alias", "db.amount.currency.ref", "db.column", "db.column.collate", "db.column.derived", "db.column.dimension", "db.column.filterable", "db.column.measure", "db.column.precision", "db.column.renamed", "db.column.searchable", "db.column.sortable", "db.column.version", "db.column.version.exempt", "db.column.version.token", "db.compute", "db.default", "db.default.increment", "db.default.now", "db.default.store", "db.default.uuid", "db.depth.limit", "db.encrypted", "db.http.path", "db.ignore", "db.index.fulltext", "db.index.fulltext.language", "db.index.fulltext.match", "db.index.geo", "db.index.plain", "db.index.unique", "db.json", "db.onUpdate.inc", "db.onUpdate.now", "db.patch.strategy", "db.rel.FK", "db.rel.filter", "db.rel.filterable", "db.rel.from", "db.rel.onDelete", "db.rel.onUpdate", "db.rel.store", "db.rel.to", "db.rel.via", "db.schema", "db.search.filter", "db.search.vector", "db.search.vector.threshold", "db.sort.nulls", "db.space", "db.sync.method", "db.table", "db.table.filterable", "db.table.preferredId.uniqueIndex", "db.table.renamed", "db.table.sortable", "db.unit.ref", "db.view", "db.view.filter", "db.view.for", "db.view.having", "db.view.joins", "db.view.materialized", "db.view.renamed", "db.writeOnly", "meta.default", "meta.id", "meta.readonly", "meta.required", "ui.dict.attr", "ui.dict.descr", "ui.dict.filterable", "ui.dict.label", "ui.dict.searchable", "ui.dict.sortable", "ui.form.disabled", "ui.form.hidden", "ui.form.order", "ui.form.prefix.ref", "ui.form.suffix.ref", "ui.nav.group", "ui.nav.hidden", "ui.nav.order", "ui.table.exclude", "ui.table.fill", "ui.table.order", "ui.table.selectWith", "ui.valueHelp.fill", "ui.valueLabel", "wf.store.fromContext");
|
|
283
|
+
$ak("db.compute.host", "db.index.fulltext", "db.index.fulltext.language", "db.index.fulltext.match", "db.index.plain", "db.index.unique", "db.view.joins", "expect.pattern", "ui.dict.attr", "ui.form.classes", "ui.form.styles", "ui.form.validate", "ui.literalLabel", "ui.table.classes", "ui.table.selectWith", "ui.table.styles", "wf.context.pass");
|
|
284
|
+
$nr("db.agg.avg", "db.agg.count", "db.agg.countDistinct", "db.agg.max", "db.agg.min", "db.agg.sum", "db.alias", "db.amount.currency.ref", "db.column", "db.column.collate", "db.column.derived", "db.column.dimension", "db.column.filterable", "db.column.measure", "db.column.precision", "db.column.renamed", "db.column.searchable", "db.column.sortable", "db.column.version", "db.column.version.exempt", "db.column.version.token", "db.compute", "db.compute.host", "db.default", "db.default.increment", "db.default.now", "db.default.store", "db.default.uuid", "db.depth.limit", "db.encrypted", "db.http.path", "db.ignore", "db.index.fulltext", "db.index.fulltext.language", "db.index.fulltext.match", "db.index.geo", "db.index.plain", "db.index.unique", "db.json", "db.onUpdate.inc", "db.onUpdate.now", "db.patch.strategy", "db.rel.FK", "db.rel.filter", "db.rel.filterable", "db.rel.from", "db.rel.onDelete", "db.rel.onUpdate", "db.rel.store", "db.rel.to", "db.rel.via", "db.schema", "db.search.filter", "db.search.vector", "db.search.vector.threshold", "db.sort.nulls", "db.space", "db.sync.method", "db.table", "db.table.filterable", "db.table.preferredId.uniqueIndex", "db.table.renamed", "db.table.sortable", "db.unit.ref", "db.view", "db.view.filter", "db.view.for", "db.view.having", "db.view.joins", "db.view.materialized", "db.view.renamed", "db.view.writable", "db.writeOnly", "meta.default", "meta.id", "meta.readonly", "meta.required", "ui.dict.attr", "ui.dict.descr", "ui.dict.filterable", "ui.dict.label", "ui.dict.searchable", "ui.dict.sortable", "ui.form.disabled", "ui.form.hidden", "ui.form.order", "ui.form.prefix.ref", "ui.form.suffix.ref", "ui.nav.group", "ui.nav.hidden", "ui.nav.order", "ui.table.exclude", "ui.table.fill", "ui.table.order", "ui.table.selectWith", "ui.valueHelp.fill", "ui.valueLabel", "wf.store.fromContext");
|
|
285
285
|
defineAnnotatedType("union", JsonValue).item(defineAnnotatedType().designType("string").tags("string").$type).item(defineAnnotatedType().designType("number").tags("number").$type).item(defineAnnotatedType().designType("boolean").tags("boolean").$type).item(defineAnnotatedType().designType("null").tags("null").$type).item(defineAnnotatedType("array").of(defineAnnotatedType().ref(JsonValue).$type).$type).item(defineAnnotatedType("object").propPattern(/^.+$/, defineAnnotatedType().ref(JsonValue).$type).$type);
|
|
286
286
|
defineAnnotatedType("object", AsWfStateRecord).prop("handle", defineAnnotatedType().designType("string").tags("string").annotate("ui.table.exclude", true).annotate("db.index.unique", "handle_idx", true).annotate("expect.maxLength", { length: 256 }).$type).prop("schemaId", defineAnnotatedType().designType("string").tags("string").annotate("db.index.plain", { name: "schema_idx" }, true).annotate("expect.maxLength", { length: 256 }).$type).prop("state", defineAnnotatedType("object").prop("context", defineAnnotatedType().ref(JsonValue).$type).prop("indexes", defineAnnotatedType("array").of(defineAnnotatedType().designType("number").tags("number").$type).$type).prop("meta", defineAnnotatedType("object").propPattern(/^.+$/, defineAnnotatedType().ref(JsonValue).$type).optional().$type).annotate("ui.table.exclude", true).annotate("db.json", true).$type).prop("expiresAt", defineAnnotatedType().designType("number").tags("timestamp", "number").annotate("db.index.plain", { name: "expires_idx" }, true).annotate("expect.int", {}).optional().$type).prop("updatedAt", defineAnnotatedType().designType("number").tags("timestamp", "number").annotate("db.default.now", true).annotate("db.index.plain", { name: "updated_idx" }, true).annotate("expect.int", {}).$type).prop("createdAt", defineAnnotatedType().designType("number").tags("timestamp", "number").annotate("expect.int", {}).$type).prop("createdBy", defineAnnotatedType().designType("string").tags("string").annotate("ui.table.exclude", true).annotate("expect.maxLength", { length: 128 }).optional().$type).prop("lastUpdatedBy", defineAnnotatedType().designType("string").tags("string").annotate("ui.table.exclude", true).annotate("expect.maxLength", { length: 128 }).optional().$type);
|
|
287
287
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/moost-wf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.203",
|
|
4
4
|
"description": "Workflow form integration for moost — decorators, interceptors, and serialization driven by atscript type metadata",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@atscript/core": "^0.2.
|
|
60
|
-
"@atscript/db": "^0.1.
|
|
61
|
-
"@atscript/db-sql-tools": "^0.1.
|
|
62
|
-
"@atscript/db-sqlite": "^0.1.
|
|
63
|
-
"@atscript/typescript": "^0.2.
|
|
59
|
+
"@atscript/core": "^0.2.29",
|
|
60
|
+
"@atscript/db": "^0.1.206",
|
|
61
|
+
"@atscript/db-sql-tools": "^0.1.206",
|
|
62
|
+
"@atscript/db-sqlite": "^0.1.206",
|
|
63
|
+
"@atscript/typescript": "^0.2.29",
|
|
64
64
|
"@moostjs/event-wf": "^0.7.13",
|
|
65
65
|
"@prostojs/wf": "^0.3.0",
|
|
66
66
|
"@uniqu/core": "^0.2.2",
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"@wooksjs/event-wf": "^0.8.8",
|
|
70
70
|
"@wooksjs/http-body": "^0.8.8",
|
|
71
71
|
"moost": "^0.7.13",
|
|
72
|
-
"unplugin-atscript": "^0.2.
|
|
72
|
+
"unplugin-atscript": "^0.2.29",
|
|
73
73
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14",
|
|
74
|
-
"@atscript/ui": "^0.1.
|
|
75
|
-
"@atscript/ui-fns": "^0.1.
|
|
74
|
+
"@atscript/ui": "^0.1.203",
|
|
75
|
+
"@atscript/ui-fns": "^0.1.203"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@atscript/core": "^0.2.
|
|
79
|
-
"@atscript/db": "^0.1.
|
|
80
|
-
"@atscript/typescript": "^0.2.
|
|
78
|
+
"@atscript/core": "^0.2.29",
|
|
79
|
+
"@atscript/db": "^0.1.206",
|
|
80
|
+
"@atscript/typescript": "^0.2.29",
|
|
81
81
|
"@moostjs/event-wf": "^0.7.13",
|
|
82
82
|
"@wooksjs/event-core": "^0.8.8",
|
|
83
83
|
"@wooksjs/event-wf": "^0.8.8",
|