@stonecrop/stonecrop 0.13.12 → 0.14.0

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.
Files changed (45) hide show
  1. package/README.md +6 -3
  2. package/dist/probe.tsbuildinfo +1 -0
  3. package/dist/src/client-handler.d.ts +43 -0
  4. package/dist/src/client-handler.d.ts.map +1 -0
  5. package/dist/src/client-handler.js +42 -0
  6. package/dist/src/doctype.d.ts +42 -7
  7. package/dist/src/doctype.d.ts.map +1 -1
  8. package/dist/src/doctype.js +77 -18
  9. package/dist/src/index.d.ts +5 -1
  10. package/dist/src/index.d.ts.map +1 -1
  11. package/dist/src/index.js +6 -0
  12. package/dist/src/registry.d.ts +1 -1
  13. package/dist/src/registry.d.ts.map +1 -1
  14. package/dist/src/registry.js +46 -38
  15. package/dist/src/schema-validator.d.ts.map +1 -1
  16. package/dist/src/schema-validator.js +44 -47
  17. package/dist/src/stonecrop.d.ts +0 -6
  18. package/dist/src/stonecrop.d.ts.map +1 -1
  19. package/dist/src/stores/index.d.ts +2 -0
  20. package/dist/src/stores/index.d.ts.map +1 -1
  21. package/dist/src/stores/index.js +1 -0
  22. package/dist/src/stores/operation-log.d.ts +0 -6
  23. package/dist/src/stores/operation-log.d.ts.map +1 -1
  24. package/dist/src/stores/operation-log.js +0 -1
  25. package/dist/src/stores/validation.d.ts +83 -0
  26. package/dist/src/stores/validation.d.ts.map +1 -0
  27. package/dist/src/stores/validation.js +104 -0
  28. package/dist/src/types/doctype.d.ts +1 -1
  29. package/dist/src/types/doctype.d.ts.map +1 -1
  30. package/dist/src/types/operation-log.d.ts +0 -2
  31. package/dist/src/types/operation-log.d.ts.map +1 -1
  32. package/dist/stonecrop.d.ts +166 -22
  33. package/dist/stonecrop.js +5241 -1958
  34. package/dist/stonecrop.js.map +1 -1
  35. package/package.json +4 -4
  36. package/src/client-handler.ts +55 -0
  37. package/src/doctype.ts +83 -22
  38. package/src/index.ts +12 -0
  39. package/src/registry.ts +45 -40
  40. package/src/schema-validator.ts +52 -48
  41. package/src/stores/index.ts +2 -0
  42. package/src/stores/operation-log.ts +7 -10
  43. package/src/stores/validation.ts +138 -0
  44. package/src/types/doctype.ts +1 -1
  45. package/src/types/operation-log.ts +0 -3
@@ -60,7 +60,6 @@ export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-
60
60
  config: import("vue").Ref<{
61
61
  maxOperations?: number | undefined;
62
62
  enableCrossTabSync?: boolean | undefined;
63
- autoSyncInterval?: number | undefined;
64
63
  enablePersistence?: boolean | undefined;
65
64
  persistenceKeyPrefix?: string | undefined;
66
65
  userId?: string | undefined;
@@ -68,7 +67,6 @@ export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-
68
67
  }, OperationLogConfig | {
69
68
  maxOperations?: number | undefined;
70
69
  enableCrossTabSync?: boolean | undefined;
71
- autoSyncInterval?: number | undefined;
72
70
  enablePersistence?: boolean | undefined;
73
71
  persistenceKeyPrefix?: string | undefined;
74
72
  userId?: string | undefined;
@@ -146,7 +144,6 @@ export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-
146
144
  config: import("vue").Ref<{
147
145
  maxOperations?: number | undefined;
148
146
  enableCrossTabSync?: boolean | undefined;
149
- autoSyncInterval?: number | undefined;
150
147
  enablePersistence?: boolean | undefined;
151
148
  persistenceKeyPrefix?: string | undefined;
152
149
  userId?: string | undefined;
@@ -154,7 +151,6 @@ export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-
154
151
  }, OperationLogConfig | {
155
152
  maxOperations?: number | undefined;
156
153
  enableCrossTabSync?: boolean | undefined;
157
- autoSyncInterval?: number | undefined;
158
154
  enablePersistence?: boolean | undefined;
159
155
  persistenceKeyPrefix?: string | undefined;
160
156
  userId?: string | undefined;
@@ -232,7 +228,6 @@ export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-
232
228
  config: import("vue").Ref<{
233
229
  maxOperations?: number | undefined;
234
230
  enableCrossTabSync?: boolean | undefined;
235
- autoSyncInterval?: number | undefined;
236
231
  enablePersistence?: boolean | undefined;
237
232
  persistenceKeyPrefix?: string | undefined;
238
233
  userId?: string | undefined;
@@ -240,7 +235,6 @@ export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-
240
235
  }, OperationLogConfig | {
241
236
  maxOperations?: number | undefined;
242
237
  enableCrossTabSync?: boolean | undefined;
243
- autoSyncInterval?: number | undefined;
244
238
  enablePersistence?: boolean | undefined;
245
239
  persistenceKeyPrefix?: string | undefined;
246
240
  userId?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"operation-log.d.ts","sourceRoot":"","sources":["../../../src/stores/operation-log.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAEX,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,MAAM,wBAAwB,CAAA;AA8F/B;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA4DJ,OAAO,CAAC,kBAAkB,CAAC;8BAkBtB,iBAAiB,WAAU,eAAe;;gCA0DxC,MAAM,KAAG,MAAM,GAAG,IAAI;;kBA2EpC,OAAO,KAAG,OAAO;kBAiDjB,OAAO,KAAG,OAAO;;gCAkEH,MAAM,aAAa,MAAM,KAAG,YAAY,EAAE;uBA1BrD,oBAAoB;oCAmCL,MAAM,UAAU,MAAM;yBAmBnD,MAAM,cACH,MAAM,cACN,MAAM,EAAE,WACZ,SAAS,GAAG,SAAS,GAAG,SAAS,UACjC,MAAM,KACZ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA3SmB,OAAO,CAAC,kBAAkB,CAAC;8BAkBtB,iBAAiB,WAAU,eA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config = ref({
83
83
  maxOperations: 100,
84
84
  enableCrossTabSync: true,
85
- autoSyncInterval: 30000,
86
85
  enablePersistence: false,
87
86
  persistenceKeyPrefix: 'stonecrop-ops',
88
87
  });
@@ -0,0 +1,83 @@
1
+ import type { TriggerDefinition } from '@stonecrop/schema';
2
+ /**
3
+ * A single validation error contributed by a trigger, displayed on a field.
4
+ * @public
5
+ */
6
+ export interface ValidationError {
7
+ /** The trigger that produced this error — the namespace a re-run clears before repopulating */
8
+ trigger: string;
9
+ /** The fieldname the error displays on (the `setError` target, not necessarily a fired field) */
10
+ field: string;
11
+ /** The message to display */
12
+ message: string;
13
+ }
14
+ /**
15
+ * Reactive per-field validation error store + the advisory field-validation trigger engine.
16
+ *
17
+ * Holds the errors produced by field-validation triggers (see `TriggerDefinition` in
18
+ * `@stonecrop/schema`) and runs a trigger's `clientHandler` on demand. Errors are **namespaced
19
+ * by trigger**: re-running a trigger clears its own prior contributions before repopulating, so a
20
+ * corrected value clears its stale error without disturbing other triggers.
21
+ *
22
+ * The engine is **advisory** and does **no rollback** — an invalid value stays in the record so the
23
+ * user can fix it; validity is reported separately via `isValid` (read by the save gate) and
24
+ * the per-field messages are surfaced via `errorsByField` / `errorsFor` for display.
25
+ *
26
+ * @public
27
+ */
28
+ export declare const useValidationStore: import("pinia").StoreDefinition<"stonecrop-validation", Pick<{
29
+ errors: import("vue").Ref<{
30
+ trigger: string;
31
+ field: string;
32
+ message: string;
33
+ }[], ValidationError[] | {
34
+ trigger: string;
35
+ field: string;
36
+ message: string;
37
+ }[]>;
38
+ isValid: import("vue").ComputedRef<boolean>;
39
+ errorsByField: import("vue").ComputedRef<Record<string, string[]>>;
40
+ errorsFor: (field: string) => string[];
41
+ setError: (trigger: string, field: string, message: string) => void;
42
+ clearTrigger: (trigger: string) => void;
43
+ clearAll: () => void;
44
+ validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
45
+ validateRecord: (triggers: Record<string, TriggerDefinition>, record: Record<string, unknown>) => Promise<void>;
46
+ }, "errors">, Pick<{
47
+ errors: import("vue").Ref<{
48
+ trigger: string;
49
+ field: string;
50
+ message: string;
51
+ }[], ValidationError[] | {
52
+ trigger: string;
53
+ field: string;
54
+ message: string;
55
+ }[]>;
56
+ isValid: import("vue").ComputedRef<boolean>;
57
+ errorsByField: import("vue").ComputedRef<Record<string, string[]>>;
58
+ errorsFor: (field: string) => string[];
59
+ setError: (trigger: string, field: string, message: string) => void;
60
+ clearTrigger: (trigger: string) => void;
61
+ clearAll: () => void;
62
+ validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
63
+ validateRecord: (triggers: Record<string, TriggerDefinition>, record: Record<string, unknown>) => Promise<void>;
64
+ }, "isValid" | "errorsByField">, Pick<{
65
+ errors: import("vue").Ref<{
66
+ trigger: string;
67
+ field: string;
68
+ message: string;
69
+ }[], ValidationError[] | {
70
+ trigger: string;
71
+ field: string;
72
+ message: string;
73
+ }[]>;
74
+ isValid: import("vue").ComputedRef<boolean>;
75
+ errorsByField: import("vue").ComputedRef<Record<string, string[]>>;
76
+ errorsFor: (field: string) => string[];
77
+ setError: (trigger: string, field: string, message: string) => void;
78
+ clearTrigger: (trigger: string) => void;
79
+ clearAll: () => void;
80
+ validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
81
+ validateRecord: (triggers: Record<string, TriggerDefinition>, record: Record<string, unknown>) => Promise<void>;
82
+ }, "errorsFor" | "setError" | "clearTrigger" | "clearAll" | "validateField" | "validateRecord">>;
83
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/stores/validation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAG1D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,+FAA+F;IAC/F,OAAO,E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,gBAC7B,MAAM,UACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,OAAO,CAAC,IAAI,CAAC;+BAeL,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,UACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,OAAO,CAAC,IAAI,CAAC;gGAef,CAAA"}
@@ -0,0 +1,104 @@
1
+ import { defineStore } from 'pinia';
2
+ import { ref, computed } from 'vue';
3
+ import { executeClientHandler } from '../client-handler';
4
+ /**
5
+ * Reactive per-field validation error store + the advisory field-validation trigger engine.
6
+ *
7
+ * Holds the errors produced by field-validation triggers (see `TriggerDefinition` in
8
+ * `@stonecrop/schema`) and runs a trigger's `clientHandler` on demand. Errors are **namespaced
9
+ * by trigger**: re-running a trigger clears its own prior contributions before repopulating, so a
10
+ * corrected value clears its stale error without disturbing other triggers.
11
+ *
12
+ * The engine is **advisory** and does **no rollback** — an invalid value stays in the record so the
13
+ * user can fix it; validity is reported separately via `isValid` (read by the save gate) and
14
+ * the per-field messages are surfaced via `errorsByField` / `errorsFor` for display.
15
+ *
16
+ * @public
17
+ */
18
+ export const useValidationStore = defineStore('stonecrop-validation', () => {
19
+ const errors = ref([]);
20
+ /** True when no field currently carries a validation error. */
21
+ const isValid = computed(() => errors.value.length === 0);
22
+ /** Errors grouped by field — the shape a renderer consumes (e.g. AForm `:errors`). */
23
+ const errorsByField = computed(() => {
24
+ const map = {};
25
+ for (const e of errors.value) {
26
+ if (!map[e.field])
27
+ map[e.field] = [];
28
+ map[e.field].push(e.message);
29
+ }
30
+ return map;
31
+ });
32
+ /** Messages currently displayed on `field`. */
33
+ function errorsFor(field) {
34
+ return errors.value.filter(e => e.field === field).map(e => e.message);
35
+ }
36
+ /** Record an error contributed by `trigger`, displayed on `field`. */
37
+ function setError(trigger, field, message) {
38
+ errors.value.push({ trigger, field, message });
39
+ }
40
+ /** Remove every error contributed by `trigger` (its namespace). */
41
+ function clearTrigger(trigger) {
42
+ errors.value = errors.value.filter(e => e.trigger !== trigger);
43
+ }
44
+ /** Remove every validation error. */
45
+ function clearAll() {
46
+ errors.value = [];
47
+ }
48
+ /**
49
+ * Run a single trigger against a read-only snapshot of `record`. Clears the trigger's prior
50
+ * errors, then executes its `clientHandler` with `{ record, value, setError }`. Fails **open** —
51
+ * a throwing validator warns and records nothing, so a broken validator never blocks the user.
52
+ */
53
+ async function runTrigger(name, def, record, value) {
54
+ clearTrigger(name);
55
+ // Shallow-frozen copy: the validator reads siblings but can neither mutate the record nor
56
+ // reassign fields (advisory reads only) — and mutation can't leak back to the caller.
57
+ const frozen = Object.freeze({ ...record });
58
+ const boundSetError = (field, message) => setError(name, field, message);
59
+ try {
60
+ await executeClientHandler(def.clientHandler, { record: frozen, value, setError: boundSetError });
61
+ }
62
+ catch (error) {
63
+ // Advisory by design: a broken validator must never block save (a bug in one trigger must
64
+ // not trap the user, especially in production). It fails OPEN — but a throw is an error in
65
+ // the author's code, so surface it loudly (error severity, trigger named) rather than
66
+ // silently: a broken validator that just "does nothing" is the real footgun here.
67
+ if (typeof console !== 'undefined') {
68
+ console.error(`Validation trigger "${name}" threw and was ignored (advisory — save is not blocked). ` +
69
+ `Fix its clientHandler:`, error);
70
+ }
71
+ }
72
+ }
73
+ /**
74
+ * Run every trigger whose `on` set includes `changedField`, passing that field's current value.
75
+ * Call on the edit path (desktop-driven) so editing either bound field re-validates the pair.
76
+ */
77
+ async function validateField(triggers, changedField, record) {
78
+ const runs = [];
79
+ for (const [name, def] of Object.entries(triggers)) {
80
+ if (def.on.includes(changedField)) {
81
+ runs.push(runTrigger(name, def, record, record[changedField]));
82
+ }
83
+ }
84
+ await Promise.all(runs);
85
+ }
86
+ /**
87
+ * Run **all** triggers (no fired-field filter) — the authoritative client gate at save-attempt,
88
+ * covering triggers whose fields were never edited. `value` is undefined (no single changed field).
89
+ */
90
+ async function validateRecord(triggers, record) {
91
+ await Promise.all(Object.entries(triggers).map(([name, def]) => runTrigger(name, def, record, undefined)));
92
+ }
93
+ return {
94
+ errors,
95
+ isValid,
96
+ errorsByField,
97
+ errorsFor,
98
+ setError,
99
+ clearTrigger,
100
+ clearAll,
101
+ validateField,
102
+ validateRecord,
103
+ };
104
+ });
@@ -21,7 +21,7 @@ export type DoctypeConfig = {
21
21
  name: string;
22
22
  /** URL-friendly slug (kebab-case) */
23
23
  slug?: string;
24
- /** Field definitions (including link fields with fieldtype: 'Link') */
24
+ /** Field definitions (a link field is one carrying `doctype`) */
25
25
  fields?: DoctypeField[];
26
26
  /** Relationship links to other doctypes */
27
27
  links?: Record<string, LinkDeclaration>;
@@ -1 +1 @@
1
- {"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../../src/types/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACpF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CACxC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,MAAM,CAAC,EAAE,YAAY,EAAE,CAAA;IACvB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAA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AC,CAAA;IAClC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
@@ -94,8 +94,6 @@ export interface OperationLogConfig {
94
94
  maxOperations?: number;
95
95
  /** Enable cross-tab synchronization (default: true) */
96
96
  enableCrossTabSync?: boolean;
97
- /** Auto-sync interval in milliseconds (default: 30000) */
98
- autoSyncInterval?: number;
99
97
  /** Enable operation persistence to localStorage (default: false) */
100
98
  enablePersistence?: boolean;
101
99
  /** Persistence key prefix */
@@ -1 +1 @@
1
- {"version":3,"file":"operation-log.d.ts","sourceRoot":"","sources":["../../../src/types/operation-log.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CAAA;AAEnF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAE1E;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;IAEV,kCAAkC;IAClC,IAAI,EAAE,gBAAgB,CAAA;IAEtB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IAEZ,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IAEjB,iCAAiC;IACjC,WAAW,EAAE,GAAG,CAAA;IAEhB,gCAAgC;IAChC,UAAU,EAAE,GAAG,CAAA;IAEf,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAA;IAEf,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,iCAAiC;IACjC,SAAS,EAAE,IAAI,CAAA;IAEf,oEAAoE;IACpE,MAAM,CAAC,EAAE,eAAe,CAAA;IAExB,2CAA2C;IAC3C,UAAU,EAAE,OAAO,CAAA;IAEnB,0CAA0C;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE3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SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;CACtD;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,eAAe;IACf,OAAO,EAAE,OAAO,CAAA;IAEhB,eAAe;IACf,OAAO,EAAE,OAAO,CAAA;IAEhB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAA;IAEjB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAA;IAEjB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,gCAAgC;IAChC,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,6CAA6C;IAC7C,YAAY,EAAE,MAAM,CAAA;IACpB,iCAAiC;IACjC,eAAe,EAAE,MAAM,CAAA;IACvB,8CAA8C;IAC9C,oBAAoB,EAAE,MAAM,CAAA;IAC5B,iDAAiD;IACjD,sBAAsB,EAAE,MAAM,CAAA;IAC9B,wCAAwC;IACxC,eAAe,CAAC,EAAE,IAAI,CAAA;IACtB,wCAAwC;IACxC,eAAe,CAAC,EAAE,IAAI,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,cAAc,GAAG,eAAe,CAAA;AAElG;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,gCAAgC;IAChC,IAAI,EAAE,mBAAmB,CAAA;IACzB,wDAAwD;IACxD,SAAS,CAAC,EAAE,YAAY,CAAA;IACxB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,YAAY,EAAE,CAAA;IAC3B,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,SAAS,EAAE,IAAI,CAAA;CACf"}
@@ -12,6 +12,7 @@ import type { ResolvedField } from '@stonecrop/aform';
12
12
  import { Router } from 'vue-router';
13
13
  import { Store } from 'pinia';
14
14
  import { StoreDefinition } from 'pinia';
15
+ import type { TriggerDefinition } from '@stonecrop/schema';
15
16
  import type { UnknownMachineConfig } from 'xstate';
16
17
  import type { WorkflowMeta } from '@stonecrop/schema';
17
18
 
@@ -82,6 +83,15 @@ export declare interface BatchOperation {
82
83
  reversible: boolean;
83
84
  }
84
85
 
86
+ /**
87
+ * Named capabilities injected into a clientHandler body as function parameters.
88
+ * The caller (the assembly composable) owns what each name resolves to — typically
89
+ * `router`, `record`, `runAction`, and a read-only `graphql`.
90
+ *
91
+ * @public
92
+ */
93
+ export declare type ClientHandlerApi = Record<string, unknown>;
94
+
85
95
  /**
86
96
  * Factory function for HST creation
87
97
  * Creates a new HSTNode proxy for hierarchical state tree navigation.
@@ -208,8 +218,8 @@ export declare class Doctype {
208
218
  * const planDoctype = Doctype.fromObject({
209
219
  * name: 'Plan',
210
220
  * fields: [
211
- * { fieldname: 'title', label: 'Title', fieldtype: 'Data' },
212
- * { fieldname: 'status', label: 'Status', fieldtype: 'Data' },
221
+ * { fieldname: 'title', label: 'Title', component: 'ATextInput' },
222
+ * { fieldname: 'status', label: 'Status', component: 'ATextInput' },
213
223
  * ],
214
224
  * workflow: {
215
225
  * id: 'plan',
@@ -266,6 +276,44 @@ export declare class Doctype {
266
276
  name: string;
267
277
  targetState: string;
268
278
  }>;
279
+ /**
280
+ * Returns the stateless **Commands** available in a given workflow state — side-effect
281
+ * actions (save/print/email…) that do not change workflow state. Unlike transitions,
282
+ * Commands may exist on a workflow that declares no `states` (a commands-only doctype),
283
+ * and a Command with no `allowedStates` is available in every state.
284
+ *
285
+ * Only meaningful for WorkflowMeta format; XState workflows have no Commands.
286
+ *
287
+ * @param currentState - The record's current state, used to honor a Command's `allowedStates`
288
+ * @returns Array of command descriptors with `name`
289
+ *
290
+ * @example
291
+ * ```ts
292
+ * const commands = doctype.getAvailableCommands('Draft')
293
+ * // [{ name: 'Print' }]
294
+ * ```
295
+ *
296
+ * @public
297
+ */
298
+ getAvailableCommands(currentState?: string): Array<{
299
+ name: string;
300
+ }>;
301
+ /**
302
+ * Returns the field-validation **triggers** declared on this doctype's workflow (advisory,
303
+ * client-side). Keyed by trigger name. Returns undefined when the workflow is absent, is an
304
+ * XState machine (no triggers), or simply declares none.
305
+ *
306
+ * @returns The `workflow.triggers` map, or undefined
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * const triggers = doctype.getTriggers()
311
+ * // { dateOrder: { on: ['start_date', 'end_date'], clientHandler: '…' } }
312
+ * ```
313
+ *
314
+ * @public
315
+ */
316
+ getTriggers(): Record<string, TriggerDefinition> | undefined;
269
317
  /**
270
318
  * Returns metadata for a specific action, if available.
271
319
  * Only works with WorkflowMeta format; returns undefined for XState format.
@@ -276,18 +324,15 @@ export declare class Doctype {
276
324
  * @example
277
325
  * ```ts
278
326
  * const actionMeta = doctype.getActionMeta('submit')
279
- * // { label: 'Submit', handler: 'plan:submit', allowedStates: ['draft'] }
327
+ * // { label: 'Submit', allowedStates: ['draft'] }
280
328
  * ```
281
329
  *
282
330
  * @public
283
331
  */
284
332
  getActionMeta(actionName: string): {
285
333
  label: string;
286
- handler: string;
287
334
  requiredFields?: string[];
288
335
  allowedStates?: string[];
289
- confirm?: boolean;
290
- args?: Record<string, unknown>;
291
336
  } | undefined;
292
337
  /**
293
338
  * Converts the registered doctype string to a slug (kebab-case). The following conversions are made:
@@ -318,7 +363,7 @@ export declare type DoctypeConfig = {
318
363
  name: string;
319
364
  /** URL-friendly slug (kebab-case) */
320
365
  slug?: string;
321
- /** Field definitions (including link fields with fieldtype: 'Link') */
366
+ /** Field definitions (a link field is one carrying `doctype`) */
322
367
  fields?: DoctypeField[];
323
368
  /** Relationship links to other doctypes */
324
369
  links?: Record<string, LinkDeclaration>;
@@ -330,6 +375,36 @@ export declare type DoctypeConfig = {
330
375
  inherits?: string;
331
376
  };
332
377
 
378
+ /**
379
+ * Execute a docbuilder-authored `clientHandler` body against an injected API map.
380
+ *
381
+ * `code` is a function *body* (statements), not a full function — authored in the
382
+ * docbuilder code editor and stored on `ActionDefinition.clientHandler`. It is compiled
383
+ * with the AsyncFunction constructor, so `await` works directly. Each key of `api`
384
+ * becomes a parameter name bound to its value, so a handler can reference `router`,
385
+ * `record`, `runAction`, etc. by name.
386
+ *
387
+ * This executor is deliberately concern-free: it performs no routing, dispatch, or HST
388
+ * writes itself — the caller assembles `api`. The injected set is an *intent* contract,
389
+ * not a sandbox (an AsyncFunction body can still reach `fetch`/`window`); enforcement of
390
+ * what a handler may actually do lives server-side, not here.
391
+ *
392
+ * Errors are propagated to the caller as a rejected promise — syntax errors at compile
393
+ * time and thrown errors / rejections at run time — so callers handle both uniformly.
394
+ *
395
+ * @param code - the clientHandler body, e.g. `"router.push('/users')"`
396
+ * @param api - named capabilities injected as parameters (default: none)
397
+ * @returns whatever the body returns (typically `void`)
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * await executeClientHandler("await runAction('Assign', [record.id])", { runAction, record })
402
+ * ```
403
+ *
404
+ * @public
405
+ */
406
+ export declare function executeClientHandler(code: string, api?: ClientHandlerApi): Promise<unknown>;
407
+
333
408
  /**
334
409
  * Supported action types for field triggers
335
410
  * @public
@@ -1057,8 +1132,6 @@ export declare interface OperationLogConfig {
1057
1132
  maxOperations?: number;
1058
1133
  /** Enable cross-tab synchronization (default: true) */
1059
1134
  enableCrossTabSync?: boolean;
1060
- /** Auto-sync interval in milliseconds (default: 30000) */
1061
- autoSyncInterval?: number;
1062
1135
  /** Enable operation persistence to localStorage (default: false) */
1063
1136
  enablePersistence?: boolean;
1064
1137
  /** Persistence key prefix */
@@ -1256,7 +1329,7 @@ export declare class Registry {
1256
1329
  *
1257
1330
  * - `kind: 'table'` or `kind: 'link'` → `[]` or `{}`
1258
1331
  * - `kind: 'fieldset'` → recursively initializes children as `{}`
1259
- * - `kind: 'field'` → derives default from `fieldtype`; falls back to `null`
1332
+ * - `kind: 'field'` → derives the default from the component's category; falls back to `null`
1260
1333
  *
1261
1334
  * @param schema - The resolved schema array to derive defaults from
1262
1335
  * @returns A plain object with default values for each field
@@ -1483,7 +1556,6 @@ export declare class Stonecrop {
1483
1556
  config: Ref< {
1484
1557
  maxOperations?: number | undefined;
1485
1558
  enableCrossTabSync?: boolean | undefined;
1486
- autoSyncInterval?: number | undefined;
1487
1559
  enablePersistence?: boolean | undefined;
1488
1560
  persistenceKeyPrefix?: string | undefined;
1489
1561
  userId?: string | undefined;
@@ -1491,7 +1563,6 @@ export declare class Stonecrop {
1491
1563
  }, OperationLogConfig | {
1492
1564
  maxOperations?: number | undefined;
1493
1565
  enableCrossTabSync?: boolean | undefined;
1494
- autoSyncInterval?: number | undefined;
1495
1566
  enablePersistence?: boolean | undefined;
1496
1567
  persistenceKeyPrefix?: string | undefined;
1497
1568
  userId?: string | undefined;
@@ -1569,7 +1640,6 @@ export declare class Stonecrop {
1569
1640
  config: Ref< {
1570
1641
  maxOperations?: number | undefined;
1571
1642
  enableCrossTabSync?: boolean | undefined;
1572
- autoSyncInterval?: number | undefined;
1573
1643
  enablePersistence?: boolean | undefined;
1574
1644
  persistenceKeyPrefix?: string | undefined;
1575
1645
  userId?: string | undefined;
@@ -1577,7 +1647,6 @@ export declare class Stonecrop {
1577
1647
  }, OperationLogConfig | {
1578
1648
  maxOperations?: number | undefined;
1579
1649
  enableCrossTabSync?: boolean | undefined;
1580
- autoSyncInterval?: number | undefined;
1581
1650
  enablePersistence?: boolean | undefined;
1582
1651
  persistenceKeyPrefix?: string | undefined;
1583
1652
  userId?: string | undefined;
@@ -1655,7 +1724,6 @@ export declare class Stonecrop {
1655
1724
  config: Ref< {
1656
1725
  maxOperations?: number | undefined;
1657
1726
  enableCrossTabSync?: boolean | undefined;
1658
- autoSyncInterval?: number | undefined;
1659
1727
  enablePersistence?: boolean | undefined;
1660
1728
  persistenceKeyPrefix?: string | undefined;
1661
1729
  userId?: string | undefined;
@@ -1663,7 +1731,6 @@ export declare class Stonecrop {
1663
1731
  }, OperationLogConfig | {
1664
1732
  maxOperations?: number | undefined;
1665
1733
  enableCrossTabSync?: boolean | undefined;
1666
- autoSyncInterval?: number | undefined;
1667
1734
  enablePersistence?: boolean | undefined;
1668
1735
  persistenceKeyPrefix?: string | undefined;
1669
1736
  userId?: string | undefined;
@@ -2141,7 +2208,6 @@ currentIndex: Ref<number, number>;
2141
2208
  config: Ref< {
2142
2209
  maxOperations?: number | undefined;
2143
2210
  enableCrossTabSync?: boolean | undefined;
2144
- autoSyncInterval?: number | undefined;
2145
2211
  enablePersistence?: boolean | undefined;
2146
2212
  persistenceKeyPrefix?: string | undefined;
2147
2213
  userId?: string | undefined;
@@ -2149,7 +2215,6 @@ operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
2149
2215
  }, OperationLogConfig | {
2150
2216
  maxOperations?: number | undefined;
2151
2217
  enableCrossTabSync?: boolean | undefined;
2152
- autoSyncInterval?: number | undefined;
2153
2218
  enablePersistence?: boolean | undefined;
2154
2219
  persistenceKeyPrefix?: string | undefined;
2155
2220
  userId?: string | undefined;
@@ -2227,7 +2292,6 @@ currentIndex: Ref<number, number>;
2227
2292
  config: Ref< {
2228
2293
  maxOperations?: number | undefined;
2229
2294
  enableCrossTabSync?: boolean | undefined;
2230
- autoSyncInterval?: number | undefined;
2231
2295
  enablePersistence?: boolean | undefined;
2232
2296
  persistenceKeyPrefix?: string | undefined;
2233
2297
  userId?: string | undefined;
@@ -2235,7 +2299,6 @@ operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
2235
2299
  }, OperationLogConfig | {
2236
2300
  maxOperations?: number | undefined;
2237
2301
  enableCrossTabSync?: boolean | undefined;
2238
- autoSyncInterval?: number | undefined;
2239
2302
  enablePersistence?: boolean | undefined;
2240
2303
  persistenceKeyPrefix?: string | undefined;
2241
2304
  userId?: string | undefined;
@@ -2313,7 +2376,6 @@ currentIndex: Ref<number, number>;
2313
2376
  config: Ref< {
2314
2377
  maxOperations?: number | undefined;
2315
2378
  enableCrossTabSync?: boolean | undefined;
2316
- autoSyncInterval?: number | undefined;
2317
2379
  enablePersistence?: boolean | undefined;
2318
2380
  persistenceKeyPrefix?: string | undefined;
2319
2381
  userId?: string | undefined;
@@ -2321,7 +2383,6 @@ operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
2321
2383
  }, OperationLogConfig | {
2322
2384
  maxOperations?: number | undefined;
2323
2385
  enableCrossTabSync?: boolean | undefined;
2324
- autoSyncInterval?: number | undefined;
2325
2386
  enablePersistence?: boolean | undefined;
2326
2387
  persistenceKeyPrefix?: string | undefined;
2327
2388
  userId?: string | undefined;
@@ -2398,6 +2459,76 @@ export declare function useStonecrop(options: {
2398
2459
  */
2399
2460
  export declare function useUndoRedoShortcuts(hstStore: HSTNode, enabled?: boolean): void;
2400
2461
 
2462
+ /**
2463
+ * Reactive per-field validation error store + the advisory field-validation trigger engine.
2464
+ *
2465
+ * Holds the errors produced by field-validation triggers (see `TriggerDefinition` in
2466
+ * `@stonecrop/schema`) and runs a trigger's `clientHandler` on demand. Errors are **namespaced
2467
+ * by trigger**: re-running a trigger clears its own prior contributions before repopulating, so a
2468
+ * corrected value clears its stale error without disturbing other triggers.
2469
+ *
2470
+ * The engine is **advisory** and does **no rollback** — an invalid value stays in the record so the
2471
+ * user can fix it; validity is reported separately via `isValid` (read by the save gate) and
2472
+ * the per-field messages are surfaced via `errorsByField` / `errorsFor` for display.
2473
+ *
2474
+ * @public
2475
+ */
2476
+ export declare const useValidationStore: StoreDefinition<"stonecrop-validation", Pick<{
2477
+ errors: Ref< {
2478
+ trigger: string;
2479
+ field: string;
2480
+ message: string;
2481
+ }[], ValidationError[] | {
2482
+ trigger: string;
2483
+ field: string;
2484
+ message: string;
2485
+ }[]>;
2486
+ isValid: ComputedRef<boolean>;
2487
+ errorsByField: ComputedRef<Record<string, string[]>>;
2488
+ errorsFor: (field: string) => string[];
2489
+ setError: (trigger: string, field: string, message: string) => void;
2490
+ clearTrigger: (trigger: string) => void;
2491
+ clearAll: () => void;
2492
+ validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
2493
+ validateRecord: (triggers: Record<string, TriggerDefinition>, record: Record<string, unknown>) => Promise<void>;
2494
+ }, "errors">, Pick<{
2495
+ errors: Ref< {
2496
+ trigger: string;
2497
+ field: string;
2498
+ message: string;
2499
+ }[], ValidationError[] | {
2500
+ trigger: string;
2501
+ field: string;
2502
+ message: string;
2503
+ }[]>;
2504
+ isValid: ComputedRef<boolean>;
2505
+ errorsByField: ComputedRef<Record<string, string[]>>;
2506
+ errorsFor: (field: string) => string[];
2507
+ setError: (trigger: string, field: string, message: string) => void;
2508
+ clearTrigger: (trigger: string) => void;
2509
+ clearAll: () => void;
2510
+ validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
2511
+ validateRecord: (triggers: Record<string, TriggerDefinition>, record: Record<string, unknown>) => Promise<void>;
2512
+ }, "isValid" | "errorsByField">, Pick<{
2513
+ errors: Ref< {
2514
+ trigger: string;
2515
+ field: string;
2516
+ message: string;
2517
+ }[], ValidationError[] | {
2518
+ trigger: string;
2519
+ field: string;
2520
+ message: string;
2521
+ }[]>;
2522
+ isValid: ComputedRef<boolean>;
2523
+ errorsByField: ComputedRef<Record<string, string[]>>;
2524
+ errorsFor: (field: string) => string[];
2525
+ setError: (trigger: string, field: string, message: string) => void;
2526
+ clearTrigger: (trigger: string) => void;
2527
+ clearAll: () => void;
2528
+ validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
2529
+ validateRecord: (triggers: Record<string, TriggerDefinition>, record: Record<string, unknown>) => Promise<void>;
2530
+ }, "errorsFor" | "setError" | "clearTrigger" | "clearAll" | "validateField" | "validateRecord">>;
2531
+
2401
2532
  /**
2402
2533
  * Quick validation helper
2403
2534
  * @param doctype - Doctype name
@@ -2410,6 +2541,19 @@ export declare function useUndoRedoShortcuts(hstStore: HSTNode, enabled?: boolea
2410
2541
  */
2411
2542
  export declare function validateSchema(doctype: string, schema: List<DoctypeField> | DoctypeField[] | undefined, registry: Registry, workflow?: AnyStateNodeConfig, actions?: Map_2<string, string[]> | Map<string, string[]>): ValidationResult;
2412
2543
 
2544
+ /**
2545
+ * A single validation error contributed by a trigger, displayed on a field.
2546
+ * @public
2547
+ */
2548
+ export declare interface ValidationError {
2549
+ /** The trigger that produced this error — the namespace a re-run clears before repopulating */
2550
+ trigger: string;
2551
+ /** The fieldname the error displays on (the `setError` target, not necessarily a fired field) */
2552
+ field: string;
2553
+ /** The message to display */
2554
+ message: string;
2555
+ }
2556
+
2413
2557
  /**
2414
2558
  * Validation issue
2415
2559
  * @public