@stonecrop/stonecrop 0.10.12 → 0.10.13

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 (50) hide show
  1. package/dist/composables/stonecrop.js +19 -144
  2. package/dist/index.js +9 -6
  3. package/dist/plugins/index.js +4 -1
  4. package/dist/schema-validator.js +1 -13
  5. package/dist/src/composables/stonecrop.d.ts +2 -74
  6. package/dist/src/composables/stonecrop.d.ts.map +1 -1
  7. package/dist/src/doctype.d.ts +1 -27
  8. package/dist/src/doctype.d.ts.map +1 -1
  9. package/dist/src/index.d.ts +6 -9
  10. package/dist/src/index.d.ts.map +1 -1
  11. package/dist/src/plugins/index.d.ts.map +1 -1
  12. package/dist/src/schema-validator.d.ts +1 -62
  13. package/dist/src/schema-validator.d.ts.map +1 -1
  14. package/dist/src/stonecrop.d.ts +38 -17
  15. package/dist/src/stonecrop.d.ts.map +1 -1
  16. package/dist/src/stores/operation-log.d.ts +1 -1
  17. package/dist/src/types/composable.d.ts +230 -0
  18. package/dist/src/types/composable.d.ts.map +1 -0
  19. package/dist/src/types/doctype.d.ts +57 -0
  20. package/dist/src/types/doctype.d.ts.map +1 -0
  21. package/dist/src/types/index.d.ts +6 -67
  22. package/dist/src/types/index.d.ts.map +1 -1
  23. package/dist/src/types/plugin.d.ts +37 -0
  24. package/dist/src/types/plugin.d.ts.map +1 -0
  25. package/dist/src/types/schema-validator.d.ts +64 -0
  26. package/dist/src/types/schema-validator.d.ts.map +1 -0
  27. package/dist/src/types/stonecrop.d.ts +17 -0
  28. package/dist/src/types/stonecrop.d.ts.map +1 -0
  29. package/dist/stonecrop.d.ts +192 -3
  30. package/dist/stonecrop.js +1509 -1517
  31. package/dist/stonecrop.js.map +1 -1
  32. package/dist/types/composable.js +0 -0
  33. package/dist/types/doctype.js +0 -0
  34. package/dist/types/index.js +7 -2
  35. package/dist/types/plugin.js +0 -0
  36. package/dist/types/schema-validator.js +13 -0
  37. package/dist/types/stonecrop.js +0 -0
  38. package/package.json +5 -5
  39. package/src/composables/stonecrop.ts +26 -266
  40. package/src/doctype.ts +2 -29
  41. package/src/index.ts +12 -19
  42. package/src/plugins/index.ts +4 -1
  43. package/src/schema-validator.ts +3 -66
  44. package/src/stonecrop.ts +147 -16
  45. package/src/types/composable.ts +245 -0
  46. package/src/types/doctype.ts +60 -0
  47. package/src/types/index.ts +7 -74
  48. package/src/types/plugin.ts +38 -0
  49. package/src/types/schema-validator.ts +67 -0
  50. package/src/types/stonecrop.ts +17 -0
@@ -1,29 +1,23 @@
1
+ import { type SchemaTypes } from '@stonecrop/aform';
1
2
  import type { DataClient } from '@stonecrop/schema';
2
3
  import Doctype from './doctype';
3
4
  import Registry from './registry';
4
5
  import { type HSTNode } from './stores/hst';
5
6
  import type { OperationLogConfig } from './types/operation-log';
6
7
  import type { RouteContext } from './types/registry';
7
- /**
8
- * Options for constructing a Stonecrop instance directly.
9
- * When using the Vue plugin, pass these via `InstallOptions` instead.
10
- * @public
11
- */
12
- export interface StonecropOptions {
13
- /**
14
- * Data client for fetching doctype metadata and records.
15
- * Use \@stonecrop/graphql-client's StonecropClient for GraphQL backends,
16
- * or implement DataClient for custom data sources.
17
- *
18
- * Can be set later via `setClient()` for deferred configuration.
19
- */
20
- client?: DataClient;
21
- }
8
+ import type { StonecropOptions } from './types/stonecrop';
22
9
  /**
23
10
  * Main Stonecrop class with HST integration and built-in Operation Log
24
11
  * @public
25
12
  */
26
13
  export declare class Stonecrop {
14
+ /**
15
+ * Singleton instance of Stonecrop. Only one Stonecrop instance can exist
16
+ * per application, ensuring consistent HST state and registry access.
17
+ * Subsequent constructor calls return this instance instead of creating new ones.
18
+ * @internal
19
+ */
20
+ static _root: Stonecrop;
27
21
  private hstStore;
28
22
  private _operationLogStore?;
29
23
  private _operationLogConfig?;
@@ -31,7 +25,7 @@ export declare class Stonecrop {
31
25
  /** The registry instance containing all doctype definitions */
32
26
  readonly registry: Registry;
33
27
  /**
34
- * Creates a new Stonecrop instance with HST integration
28
+ * Creates a new Stonecrop instance with HST integration (singleton pattern)
35
29
  * @param registry - The Registry instance containing doctype definitions
36
30
  * @param operationLogConfig - Optional configuration for the operation log
37
31
  * @param options - Options including the data client (can be set later via setClient)
@@ -146,7 +140,7 @@ export declare class Stonecrop {
146
140
  getSnapshot: () => import("./types").OperationLogSnapshot;
147
141
  markIrreversible: (operationId: string, reason: string) => void;
148
142
  logAction: (doctype: string, actionName: string, recordIds?: string[], result?: "success" | "failure" | "pending", error?: string) => string;
149
- }, "operations" | "currentIndex" | "config" | "clientId">, Pick<{
143
+ }, "operations" | "clientId" | "currentIndex" | "config">, Pick<{
150
144
  operations: import("vue").Ref<{
151
145
  id: string;
152
146
  type: import("./types").HSTOperationType;
@@ -435,5 +429,32 @@ export declare class Stonecrop {
435
429
  * @public
436
430
  */
437
431
  getRecordState(doctype: string | Doctype, recordId: string): string;
432
+ /**
433
+ * Collect a record payload with all nested doctype fields from HST
434
+ * @param doctype - The doctype metadata
435
+ * @param recordId - The record ID to collect
436
+ * @returns The complete record payload ready for API submission
437
+ * @public
438
+ */
439
+ collectRecordPayload(doctype: Doctype, recordId: string): Record<string, any>;
440
+ /**
441
+ * Load nested data from HST or initialize with defaults
442
+ * @param parentPath - The HST path to check for existing data
443
+ * @param childDoctype - The child doctype metadata
444
+ * @param _recordId - Optional record ID to load
445
+ * @returns The loaded or initialized data
446
+ * @public
447
+ */
448
+ loadNestedData(parentPath: string, childDoctype: Doctype, _recordId?: string): Record<string, any>;
438
449
  }
450
+ /**
451
+ * Recursively collect nested data from HST using pre-resolved schemas
452
+ * @param resolvedSchema - The already-resolved schema (with nested schemas embedded)
453
+ * @param basePath - The base path in HST (e.g., "customer.123.address")
454
+ * @param hstStore - The HST store instance
455
+ * @returns The collected data object
456
+ * @public
457
+ */
458
+ declare function collectNestedData(resolvedSchema: SchemaTypes[], basePath: string, hstStore: HSTNode): Record<string, any>;
459
+ export { collectNestedData };
439
460
  //# sourceMappingURL=stonecrop.d.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AAiB,CAAC,cAAc,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAkClH;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -92,7 +92,7 @@ export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-
92
92
  getSnapshot: () => OperationLogSnapshot;
93
93
  markIrreversible: (operationId: string, reason: string) => void;
94
94
  logAction: (doctype: string, actionName: string, recordIds?: string[], result?: "success" | "failure" | "pending", error?: string) => string;
95
- }, "operations" | "currentIndex" | "config" | "clientId">, Pick<{
95
+ }, "operations" | "clientId" | "currentIndex" | "config">, Pick<{
96
96
  operations: import("vue").Ref<{
97
97
  id: string;
98
98
  type: import("..").HSTOperationType;
@@ -0,0 +1,230 @@
1
+ import { SchemaTypes } from '@stonecrop/aform';
2
+ import type { Ref, ComputedRef } from 'vue';
3
+ import type Doctype from '../doctype';
4
+ import type { HSTNode } from '../stores/hst';
5
+ import type { HSTOperation, OperationLogConfig, OperationLogSnapshot } from './operation-log';
6
+ /**
7
+ * Operation Log API - nested object containing all operation log functionality
8
+ * @public
9
+ */
10
+ export type OperationLogAPI = {
11
+ /**
12
+ * List of all recorded operations in the log.
13
+ * Each operation represents a state change that can be undone/redone.
14
+ */
15
+ operations: Ref<HSTOperation[]>;
16
+ /**
17
+ * Current position in the operation log.
18
+ * -1 means no operations, 0 means at first operation, etc.
19
+ */
20
+ currentIndex: Ref<number>;
21
+ /**
22
+ * Computed snapshot of undo/redo state.
23
+ * Use this for UI indicators (buttons, menu state).
24
+ */
25
+ undoRedoState: ComputedRef<{
26
+ canUndo: boolean;
27
+ canRedo: boolean;
28
+ undoCount: number;
29
+ redoCount: number;
30
+ currentIndex: number;
31
+ }>;
32
+ /**
33
+ * Whether undo is currently available.
34
+ * True when there are operations that can be undone.
35
+ */
36
+ canUndo: ComputedRef<boolean>;
37
+ /**
38
+ * Whether redo is currently available.
39
+ * True when there are undone operations that can be redone.
40
+ */
41
+ canRedo: ComputedRef<boolean>;
42
+ /**
43
+ * Number of operations available to undo.
44
+ */
45
+ undoCount: ComputedRef<number>;
46
+ /**
47
+ * Number of operations available to redo.
48
+ */
49
+ redoCount: ComputedRef<number>;
50
+ /**
51
+ * Undo the last operation.
52
+ * @param hstStore - The HST node to apply the inverse operation to
53
+ * @returns True if undo succeeded, false if nothing to undo
54
+ */
55
+ undo: (hstStore: HSTNode) => boolean;
56
+ /**
57
+ * Redo the last undone operation.
58
+ * @param hstStore - The HST node to apply the operation to
59
+ * @returns True if redo succeeded, false if nothing to redo
60
+ */
61
+ redo: (hstStore: HSTNode) => boolean;
62
+ /**
63
+ * Start batching multiple operations together.
64
+ * Call before a series of changes that should be undone/redone as a unit.
65
+ */
66
+ startBatch: () => void;
67
+ /**
68
+ * Commit the current batch of operations.
69
+ * @param description - Optional description for the batch
70
+ * @returns The batch operation ID, or null if no batch in progress
71
+ */
72
+ commitBatch: (description?: string) => string | null;
73
+ /**
74
+ * Cancel the current batch without committing.
75
+ * Discards all operations added since startBatch().
76
+ */
77
+ cancelBatch: () => void;
78
+ /**
79
+ * Clear all operations from the log.
80
+ * Resets the log to its initial empty state.
81
+ */
82
+ clear: () => void;
83
+ /**
84
+ * Get all operations for a specific doctype.
85
+ * @param doctype - The doctype name to filter by
86
+ * @param recordId - Optional record ID to further filter
87
+ * @returns Array of matching operations
88
+ */
89
+ getOperationsFor: (doctype: string, recordId?: string) => HSTOperation[];
90
+ /**
91
+ * Get a serializable snapshot of the operation log.
92
+ * Use for debugging, logging, or state persistence.
93
+ * @returns Snapshot containing operations and current index
94
+ */
95
+ getSnapshot: () => OperationLogSnapshot;
96
+ /**
97
+ * Mark an operation as irreversible.
98
+ * Irreversible operations cannot be undone.
99
+ * @param operationId - The operation ID to mark
100
+ * @param reason - Human-readable reason why it cannot be undone
101
+ */
102
+ markIrreversible: (operationId: string, reason: string) => void;
103
+ /**
104
+ * Log a custom action (non-HST operation).
105
+ * Use for tracking server calls, external side effects, etc.
106
+ * @param doctype - The doctype this action relates to
107
+ * @param actionName - Name of the action (e.g., 'save', 'submit')
108
+ * @param recordIds - Optional array of affected record IDs
109
+ * @param result - Optional result status
110
+ * @param error - Optional error message if result is 'failure'
111
+ * @returns The logged operation ID
112
+ */
113
+ logAction: (doctype: string, actionName: string, recordIds?: string[], result?: 'success' | 'failure' | 'pending', error?: string) => string;
114
+ /**
115
+ * Configure operation log options.
116
+ * @param options - Partial configuration to merge with existing settings
117
+ */
118
+ configure: (options: Partial<OperationLogConfig>) => void;
119
+ };
120
+ /**
121
+ * Base Stonecrop composable return type - includes operation log functionality
122
+ * @public
123
+ */
124
+ export type BaseStonecropReturn = {
125
+ /**
126
+ * Reactive reference to the Stonecrop singleton instance.
127
+ * Use this to access class methods like `getRecord()`, `addRecord()`, `runAction()`.
128
+ */
129
+ stonecrop: Ref<Stonecrop | undefined>;
130
+ /**
131
+ * Operation log API for undo/redo functionality.
132
+ * Use `operationLog.undo()` and `operationLog.redo()` for user-triggered operations.
133
+ * Use `operationLog.startBatch()` / `operationLog.commitBatch()` for grouping operations.
134
+ */
135
+ operationLog: OperationLogAPI;
136
+ };
137
+ /**
138
+ * HST-enabled Stonecrop composable return type
139
+ * @public
140
+ */
141
+ export type HSTStonecropReturn = BaseStonecropReturn & {
142
+ /**
143
+ * Generates a fully-qualified HST path for a field.
144
+ * Use this in nested components to create paths like "customer.123.address".
145
+ * @param fieldname - The field name to append to the path
146
+ * @param recordId - Optional record ID (defaults to current record)
147
+ * @returns The full HST path string
148
+ */
149
+ provideHSTPath: (fieldname: string, recordId?: string) => string;
150
+ /**
151
+ * Handles a field value change and updates HST.
152
+ * Call this from form input handlers to persist changes to the store.
153
+ * @param changeData - Object containing path, value, fieldname, and optional recordId
154
+ */
155
+ handleHSTChange: (changeData: HSTChangeData) => void;
156
+ /**
157
+ * Reactive reference to the HST node for this doctype/record.
158
+ * Use this to read current form state or subscribe to changes.
159
+ */
160
+ hstStore: Ref<HSTNode | undefined>;
161
+ /**
162
+ * Reactive form data bound to HST.
163
+ * Use this as the v-model target for form inputs. Changes sync to hstStore.
164
+ */
165
+ formData: Ref<Record<string, any>>;
166
+ /**
167
+ * Resolved schema with nested Doctype fields expanded.
168
+ * Use this to iterate over fields for rendering, excluding nested doctypes handled separately.
169
+ */
170
+ resolvedSchema: Ref<SchemaTypes[]>;
171
+ /**
172
+ * Loads or initializes nested doctype data.
173
+ * Use this when rendering a nested form component. Checks HST first, then initializes defaults.
174
+ * @param parentPath - The HST path to check for existing data
175
+ * @param childDoctype - The nested doctype metadata
176
+ * @param recordId - Optional record ID (reserved for future API fetch)
177
+ * @returns The loaded or initialized data object
178
+ */
179
+ loadNestedData: (parentPath: string, childDoctype: Doctype, recordId?: string) => Record<string, any>;
180
+ /**
181
+ * Collects a complete record payload with all nested data from HST.
182
+ * Use this before submitting to an API. Recursively includes 1:1 and 1:many nested records.
183
+ * @param doctype - The doctype metadata
184
+ * @param recordId - The record ID to collect
185
+ * @returns The complete record payload ready for API submission
186
+ */
187
+ collectRecordPayload: (doctype: Doctype, recordId: string) => Record<string, any>;
188
+ /**
189
+ * Creates a nested context for a child doctype component.
190
+ * Use this in parent components to pass scoped handlers to child components.
191
+ * @param basePath - The parent HST path prefix
192
+ * @param childDoctype - The child doctype metadata
193
+ * @returns Scoped provideHSTPath and handleHSTChange functions
194
+ */
195
+ createNestedContext: (basePath: string, childDoctype: Doctype) => {
196
+ provideHSTPath: (fieldname: string) => string;
197
+ handleHSTChange: (changeData: HSTChangeData) => void;
198
+ };
199
+ /**
200
+ * Loading state for async doctype resolution.
201
+ * True while fetching doctype by slug string from registry.
202
+ */
203
+ isLoading: Ref<boolean>;
204
+ /**
205
+ * Error state for doctype resolution failures.
206
+ * Set when doctype slug lookup fails.
207
+ */
208
+ error: Ref<Error | null>;
209
+ /**
210
+ * Resolved doctype instance.
211
+ * Available immediately if Doctype instance passed, after async resolution if slug string passed.
212
+ */
213
+ resolvedDoctype: Ref<Doctype | undefined>;
214
+ };
215
+ import type { Stonecrop } from '../stonecrop';
216
+ /**
217
+ * HST Change data structure
218
+ * @public
219
+ */
220
+ export type HSTChangeData = {
221
+ /** Full HST path to the changed field */
222
+ path: string;
223
+ /** New value for the field */
224
+ value: any;
225
+ /** Field name that changed */
226
+ fieldname: string;
227
+ /** Optional record ID */
228
+ recordId?: string;
229
+ };
230
+ //# sourceMappingURL=composable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composable.d.ts","sourceRoot":"","sources":["../../../src/types/composable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA;AAE3C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE7F;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B;;;OAGG;IACH,UAAU,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC,CAAA;IAC/B;;;OAGG;IACH,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzB;;;OAGG;IACH,aAAa,EAAE,WAAW,CAAC;QAC1B,OAAO,EAAE,OAAO,CAAA;QAChB,OAAO,EAAE,OAAO,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,CAAA;QACjB,YAAY,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;IACF;;;OAGG;IACH,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7B;;;OAGG;IACH,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7B;;OAEG;IACH,SAAS,EAAE,WAAW,CAAC,MA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AAGD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,8BAA8B;IAC9B,KAAK,EAAE,GAAG,CAAA;IACV,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
@@ -0,0 +1,57 @@
1
+ import type { SchemaTypes } from '@stonecrop/aform';
2
+ import type { WorkflowMeta } from '@stonecrop/schema';
3
+ import { List, Map } from 'immutable';
4
+ import type { AnyStateNodeConfig, UnknownMachineConfig } from 'xstate';
5
+ /**
6
+ * Immutable Doctype type for Stonecrop instances
7
+ * @public
8
+ */
9
+ export type ImmutableDoctype = {
10
+ readonly schema?: List<SchemaTypes>;
11
+ readonly workflow?: UnknownMachineConfig | AnyStateNodeConfig | WorkflowMeta;
12
+ readonly actions?: Map<string, string[]>;
13
+ };
14
+ /**
15
+ * Mutable Doctype type for Stonecrop instances
16
+ * @public
17
+ */
18
+ export type MutableDoctype = {
19
+ doctype?: string;
20
+ schema?: SchemaTypes[];
21
+ workflow?: UnknownMachineConfig | AnyStateNodeConfig | WorkflowMeta;
22
+ actions?: Record<string, string[]>;
23
+ };
24
+ /**
25
+ * Schema type for Stonecrop instances
26
+ * @public
27
+ */
28
+ export type Schema = {
29
+ doctype: string;
30
+ schema: List<SchemaTypes>;
31
+ };
32
+ /**
33
+ * Plain object representation of doctype configuration for serialization/API responses.
34
+ * Compatible with the DoctypeMeta type from \@stonecrop/schema.
35
+ * @public
36
+ */
37
+ export type DoctypeConfig = {
38
+ /** Display name of the doctype */
39
+ name: string;
40
+ /** URL-friendly slug (kebab-case) */
41
+ slug?: string;
42
+ /** Database table name */
43
+ tableName?: string;
44
+ /** Field definitions */
45
+ fields?: SchemaTypes[];
46
+ /** Workflow configuration (XState format or simple WorkflowMeta) */
47
+ workflow?: UnknownMachineConfig | WorkflowMeta;
48
+ /** Actions and their field triggers */
49
+ actions?: Record<string, string[]>;
50
+ /** Parent doctype for inheritance */
51
+ inherits?: string;
52
+ /** Doctype to use for list views */
53
+ listDoctype?: string;
54
+ /** Parent doctype for child tables */
55
+ parentDoctype?: string;
56
+ };
57
+ //# sourceMappingURL=doctype.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../../src/types/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACnC,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;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;CACzB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wBAAwB;IACxB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,YAAY,CAAA;IAC9C,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA"}
@@ -1,70 +1,9 @@
1
- import type { DataClient, WorkflowMeta } from '@stonecrop/schema';
2
- import type { SchemaTypes } from '@stonecrop/aform';
3
- import { List, Map } from 'immutable';
4
- import type { Component } from 'vue';
5
- import type { Router } from 'vue-router';
6
- import type { AnyStateNodeConfig, UnknownMachineConfig } from 'xstate';
7
- import type Doctype from '../doctype';
8
- import Registry from '../registry';
9
- import { Stonecrop } from '../stonecrop';
10
- import type { RouteContext } from './registry';
11
- /**
12
- * Immutable Doctype type for Stonecrop instances
13
- * @public
14
- */
15
- export type ImmutableDoctype = {
16
- readonly schema?: List<SchemaTypes>;
17
- readonly workflow?: UnknownMachineConfig | AnyStateNodeConfig | WorkflowMeta;
18
- readonly actions?: Map<string, string[]>;
19
- };
20
- /**
21
- * Mutable Doctype type for Stonecrop instances
22
- * @public
23
- */
24
- export type MutableDoctype = {
25
- doctype?: string;
26
- schema?: SchemaTypes[];
27
- workflow?: UnknownMachineConfig | AnyStateNodeConfig | WorkflowMeta;
28
- actions?: Record<string, string[]>;
29
- };
30
- /**
31
- * Schema type for Stonecrop instances
32
- * @public
33
- */
34
- export type Schema = {
35
- doctype: string;
36
- schema: List<SchemaTypes>;
37
- };
38
- /**
39
- * Install options for Stonecrop Vue plugin
40
- * @public
41
- */
42
- export type InstallOptions = {
43
- router?: Router;
44
- components?: Record<string, Component>;
45
- getMeta?: (routeContext: RouteContext) => Doctype | Promise<Doctype>;
46
- /**
47
- * Data client for fetching doctype metadata and records.
48
- * Use \@stonecrop/graphql-client's StonecropClient for GraphQL backends,
49
- * or implement DataClient for custom data sources.
50
- *
51
- * Can be set later via `useStonecropRegistry().setClient()` for deferred configuration.
52
- *
53
- * @example
54
- * ```ts
55
- * import { StonecropClient } from '@stonecrop/graphql-client'
56
- *
57
- * const client = new StonecropClient({ endpoint: '/graphql' })
58
- * app.use(StonecropPlugin, { client })
59
- * ```
60
- */
61
- client?: DataClient;
62
- /** Automatically run initialization callback after app mounting (default: false) */
63
- autoInitializeRouter?: boolean;
64
- /** Callback function called after plugin is ready and mounted */
65
- onRouterInitialized?: (registry: Registry, stonecrop: Stonecrop) => void | Promise<void>;
66
- };
1
+ export * from './composable';
2
+ export * from './doctype';
67
3
  export * from './field-triggers';
68
- export * from './registry';
69
4
  export * from './operation-log';
5
+ export * from './plugin';
6
+ export * from './registry';
7
+ export * from './schema-validator';
8
+ export * from './stonecrop';
70
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,KAAK,EAAE,MAAM,EA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;;;OAcG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACxF,CAAA;AAGD,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA"}
@@ -0,0 +1,37 @@
1
+ import type { DataClient } from '@stonecrop/schema';
2
+ import type { Component } from 'vue';
3
+ import type { Router } from 'vue-router';
4
+ import type Doctype from '../doctype';
5
+ import type Registry from '../registry';
6
+ import type { Stonecrop } from '../stonecrop';
7
+ import type { RouteContext } from './registry';
8
+ /**
9
+ * Install options for Stonecrop Vue plugin
10
+ * @public
11
+ */
12
+ export type InstallOptions = {
13
+ router?: Router;
14
+ components?: Record<string, Component>;
15
+ getMeta?: (routeContext: RouteContext) => Doctype | Promise<Doctype>;
16
+ /**
17
+ * Data client for fetching doctype metadata and records.
18
+ * Use \@stonecrop/graphql-client's StonecropClient for GraphQL backends,
19
+ * or implement DataClient for custom data sources.
20
+ *
21
+ * Can be set later via `useStonecropRegistry().setClient()` for deferred configuration.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * import { StonecropClient } from '@stonecrop/graphql-client'
26
+ *
27
+ * const client = new StonecropClient({ endpoint: '/graphql' })
28
+ * app.use(StonecropPlugin, { client })
29
+ * ```
30
+ */
31
+ client?: DataClient;
32
+ /** Automatically run initialization callback after app mounting (default: false) */
33
+ autoInitializeRouter?: boolean;
34
+ /** Callback function called after plugin is ready and mounted */
35
+ onRouterInitialized?: (registry: Registry, stonecrop: Stonecrop) => void | Promise<void>;
36
+ };
37
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACtC,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACpE;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACxF,CAAA"}
@@ -0,0 +1,64 @@
1
+ import type Registry from '../registry';
2
+ /**
3
+ * Validation severity levels
4
+ * @public
5
+ */
6
+ export declare enum ValidationSeverity {
7
+ /** Blocking error that prevents save */
8
+ ERROR = "error",
9
+ /** Advisory warning that allows save */
10
+ WARNING = "warning",
11
+ /** Informational message */
12
+ INFO = "info"
13
+ }
14
+ /**
15
+ * Validation issue
16
+ * @public
17
+ */
18
+ export interface ValidationIssue {
19
+ /** Severity level */
20
+ severity: ValidationSeverity;
21
+ /** Validation rule that failed */
22
+ rule: string;
23
+ /** Human-readable message */
24
+ message: string;
25
+ /** Doctype name */
26
+ doctype?: string;
27
+ /** Field name if applicable */
28
+ fieldname?: string;
29
+ /** Additional context */
30
+ context?: Record<string, unknown>;
31
+ }
32
+ /**
33
+ * Validation result
34
+ * @public
35
+ */
36
+ export interface ValidationResult {
37
+ /** Whether validation passed (no blocking errors) */
38
+ valid: boolean;
39
+ /** List of validation issues */
40
+ issues: ValidationIssue[];
41
+ /** Count of errors */
42
+ errorCount: number;
43
+ /** Count of warnings */
44
+ warningCount: number;
45
+ /** Count of info messages */
46
+ infoCount: number;
47
+ }
48
+ /**
49
+ * Schema validator options
50
+ * @public
51
+ */
52
+ export interface ValidatorOptions {
53
+ /** Registry instance for doctype lookups */
54
+ registry?: Registry;
55
+ /** Whether to validate Link field targets */
56
+ validateLinkTargets?: boolean;
57
+ /** Whether to validate workflow reachability */
58
+ validateWorkflows?: boolean;
59
+ /** Whether to validate action registration */
60
+ validateActions?: boolean;
61
+ /** Whether to validate required schema properties */
62
+ validateRequiredProperties?: boolean;
63
+ }
64
+ //# sourceMappingURL=schema-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../../src/types/schema-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AAEvC;;;GAGG;AACH,oBAAY,kBAAkB;IAC7B,wCAAwC;IACxC,KAAK,UAAU;IACf,wCAAwC;IACxC,OAAO,YAAY;IACnB,4BAA4B;IAC5B,IAAI,SAAS;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,qBAAqB;IACrB,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,qDAAqD;IACrD,KAAK,EAAE,OAAO,CAAA;IACd,gCAAgC;IAChC,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,wBAAwB;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,6CAA6C;IAC7C,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,qDAAqD;IACrD,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACpC"}
@@ -0,0 +1,17 @@
1
+ import type { DataClient } from '@stonecrop/schema';
2
+ /**
3
+ * Options for constructing a Stonecrop instance directly.
4
+ * When using the Vue plugin, pass these via `InstallOptions` instead.
5
+ * @public
6
+ */
7
+ export interface StonecropOptions {
8
+ /**
9
+ * Data client for fetching doctype metadata and records.
10
+ * Use \@stonecrop/graphql-client's StonecropClient for GraphQL backends,
11
+ * or implement DataClient for custom data sources.
12
+ *
13
+ * Can be set later via `setClient()` for deferred configuration.
14
+ */
15
+ client?: DataClient;
16
+ }
17
+ //# sourceMappingURL=stonecrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../../src/types/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;CACnB"}