@stonecrop/stonecrop 0.10.4 → 0.10.6
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/README.md +2 -2
- package/dist/doctype.js +81 -4
- package/dist/index.js +2 -2
- package/dist/registry.js +4 -4
- package/dist/src/composables/stonecrop.d.ts +5 -5
- package/dist/src/composables/stonecrop.d.ts.map +1 -1
- package/dist/src/doctype.d.ts +95 -4
- package/dist/src/doctype.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/registry.d.ts +10 -10
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/stonecrop.d.ts +14 -14
- package/dist/src/stonecrop.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +2 -2
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/stonecrop.d.ts +121 -31
- package/dist/stonecrop.js +4606 -1376
- package/dist/stonecrop.js.map +1 -1
- package/package.json +5 -5
- package/src/composables/stonecrop.ts +12 -16
- package/src/doctype.ts +112 -4
- package/src/index.ts +3 -2
- package/src/registry.ts +11 -11
- package/src/stonecrop.ts +15 -15
- package/src/types/index.ts +2 -2
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ app.mount('#app')
|
|
|
50
50
|
| Option | Type | Description |
|
|
51
51
|
|--------|------|-------------|
|
|
52
52
|
| `router` | `Router` | Vue Router instance. Required for route-based doctype resolution. |
|
|
53
|
-
| `getMeta` | `(ctx: RouteContext) =>
|
|
53
|
+
| `getMeta` | `(ctx: RouteContext) => Doctype \| Promise<Doctype>` | Lazy-loads doctype metadata for the current route. `ctx` has `path` and `segments`. |
|
|
54
54
|
| `fetchRecord` | `(doctype, id) => Promise<Record \| null>` | Injectable replacement for `Stonecrop.getRecord()`'s default REST fetch. Use this to plug in GraphQL or any other transport. |
|
|
55
55
|
| `fetchRecords` | `(doctype) => Promise<Record[]>` | Injectable replacement for `Stonecrop.getRecords()`'s default REST fetch. |
|
|
56
56
|
| `components` | `Record<string, Component>` | Additional Vue components to register globally. |
|
|
@@ -67,7 +67,7 @@ import StonecropPlugin from '@stonecrop/stonecrop'
|
|
|
67
67
|
import {
|
|
68
68
|
Stonecrop, // Core orchestration class
|
|
69
69
|
Registry, // Doctype registry (singleton)
|
|
70
|
-
|
|
70
|
+
Doctype, // Doctype definition class
|
|
71
71
|
useStonecrop, // Vue composable — primary integration point
|
|
72
72
|
HST, // HST store class
|
|
73
73
|
createHST, // HST factory function
|
package/dist/doctype.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { List, Map } from 'immutable';
|
|
1
2
|
/**
|
|
2
|
-
* Doctype
|
|
3
|
+
* Doctype runtime class with Immutable.js collections for HST change tracking.
|
|
3
4
|
* @public
|
|
4
5
|
*/
|
|
5
|
-
export default class
|
|
6
|
+
export default class Doctype {
|
|
6
7
|
/**
|
|
7
8
|
* The doctype name
|
|
8
9
|
* @public
|
|
@@ -42,7 +43,7 @@ export default class DoctypeMeta {
|
|
|
42
43
|
*/
|
|
43
44
|
component;
|
|
44
45
|
/**
|
|
45
|
-
* Creates a new
|
|
46
|
+
* Creates a new Doctype instance
|
|
46
47
|
* @param doctype - The doctype name
|
|
47
48
|
* @param schema - The doctype schema definition
|
|
48
49
|
* @param workflow - The doctype workflow configuration (XState machine)
|
|
@@ -56,6 +57,82 @@ export default class DoctypeMeta {
|
|
|
56
57
|
this.actions = actions;
|
|
57
58
|
this.component = component;
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a Doctype instance from a plain configuration object.
|
|
62
|
+
* Handles conversion of arrays to Immutable.js collections internally.
|
|
63
|
+
*
|
|
64
|
+
* This is the recommended way to create a Doctype from API responses
|
|
65
|
+
* or configuration files, as it encapsulates the Immutable.js construction
|
|
66
|
+
* that the framework uses internally.
|
|
67
|
+
*
|
|
68
|
+
* @param config - Plain object with doctype configuration (typically from API response)
|
|
69
|
+
* @returns A new Doctype instance with Immutable.js collections
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* // From an API response
|
|
74
|
+
* const response = await client.getMeta({ doctype: 'plan' })
|
|
75
|
+
* const doctype = Doctype.fromObject(response)
|
|
76
|
+
* registry.addDoctype(doctype)
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // From a configuration object
|
|
82
|
+
* const planDoctype = Doctype.fromObject({
|
|
83
|
+
* name: 'Plan',
|
|
84
|
+
* fields: [
|
|
85
|
+
* { fieldname: 'title', label: 'Title', fieldtype: 'Data' },
|
|
86
|
+
* { fieldname: 'status', label: 'Status', fieldtype: 'Data' },
|
|
87
|
+
* ],
|
|
88
|
+
* workflow: {
|
|
89
|
+
* id: 'plan',
|
|
90
|
+
* initial: 'draft',
|
|
91
|
+
* states: { draft: {}, submitted: {} }
|
|
92
|
+
* }
|
|
93
|
+
* })
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
static fromObject(config) {
|
|
99
|
+
const schema = config.fields ? List(config.fields) : List();
|
|
100
|
+
const actions = config.actions ? Map(config.actions) : Map();
|
|
101
|
+
return new Doctype(config.name, schema, config.workflow, actions);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Returns the schema as a plain array for use with components that expect
|
|
105
|
+
* plain JavaScript arrays (e.g., AForm, ATable).
|
|
106
|
+
*
|
|
107
|
+
* @returns Array of schema fields
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const schemaArray = doctype.getSchemaArray()
|
|
112
|
+
* // Use with AForm
|
|
113
|
+
* <AForm :schema="schemaArray" v-model:data="formData" />
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
getSchemaArray() {
|
|
119
|
+
if (!this.schema)
|
|
120
|
+
return [];
|
|
121
|
+
return this.schema.toArray();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns the actions as a plain object for use with components that expect
|
|
125
|
+
* plain JavaScript objects.
|
|
126
|
+
*
|
|
127
|
+
* @returns Object mapping action names to field trigger arrays
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
getActionsObject() {
|
|
132
|
+
if (!this.actions)
|
|
133
|
+
return {};
|
|
134
|
+
return this.actions.toObject();
|
|
135
|
+
}
|
|
59
136
|
/**
|
|
60
137
|
* Returns the transitions available from a given workflow state, derived from the
|
|
61
138
|
* doctype's XState workflow configuration.
|
|
@@ -93,7 +170,7 @@ export default class DoctypeMeta {
|
|
|
93
170
|
*
|
|
94
171
|
* @example
|
|
95
172
|
* ```ts
|
|
96
|
-
* const doctype = new
|
|
173
|
+
* const doctype = new Doctype('TaskItem', schema, workflow, actions)
|
|
97
174
|
* console.log(doctype.slug) // 'task-item'
|
|
98
175
|
* ```
|
|
99
176
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useStonecrop } from './composables/stonecrop';
|
|
2
2
|
import { useOperationLog, useUndoRedoShortcuts, withBatch } from './composables/operation-log';
|
|
3
|
-
import
|
|
3
|
+
import Doctype from './doctype';
|
|
4
4
|
import { getGlobalTriggerEngine, markOperationIrreversible, registerGlobalAction, registerTransitionAction, setFieldRollback, triggerTransition, } from './field-triggers';
|
|
5
5
|
import plugin from './plugins';
|
|
6
6
|
import Registry from './registry';
|
|
@@ -10,7 +10,7 @@ import { useOperationLogStore } from './stores/operation-log';
|
|
|
10
10
|
// Export schema validator
|
|
11
11
|
import { SchemaValidator, createValidator, validateSchema } from './schema-validator';
|
|
12
12
|
export { ValidationSeverity } from './schema-validator';
|
|
13
|
-
export {
|
|
13
|
+
export { Doctype, Registry, Stonecrop, useStonecrop,
|
|
14
14
|
// HST exports for advanced usage
|
|
15
15
|
HST, createHST,
|
|
16
16
|
// Field trigger system exports
|
package/dist/registry.js
CHANGED
|
@@ -16,7 +16,7 @@ export default class Registry {
|
|
|
16
16
|
name;
|
|
17
17
|
/**
|
|
18
18
|
* The registry property contains a collection of doctypes
|
|
19
|
-
* @see {@link
|
|
19
|
+
* @see {@link Doctype}
|
|
20
20
|
*/
|
|
21
21
|
registry;
|
|
22
22
|
/**
|
|
@@ -41,14 +41,14 @@ export default class Registry {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* The getMeta function fetches doctype metadata from an API based on route context
|
|
44
|
-
* @see {@link
|
|
44
|
+
* @see {@link Doctype}
|
|
45
45
|
*/
|
|
46
46
|
getMeta;
|
|
47
47
|
/**
|
|
48
48
|
* Get doctype metadata
|
|
49
49
|
* @param doctype - The doctype to fetch metadata for
|
|
50
50
|
* @returns The doctype metadata
|
|
51
|
-
* @see {@link
|
|
51
|
+
* @see {@link Doctype}
|
|
52
52
|
*/
|
|
53
53
|
addDoctype(doctype) {
|
|
54
54
|
if (!(doctype.slug in this.registry)) {
|
|
@@ -238,7 +238,7 @@ export default class Registry {
|
|
|
238
238
|
/**
|
|
239
239
|
* Get a registered doctype by slug
|
|
240
240
|
* @param slug - The doctype slug to look up
|
|
241
|
-
* @returns The
|
|
241
|
+
* @returns The Doctype instance if found, or undefined
|
|
242
242
|
* @public
|
|
243
243
|
*/
|
|
244
244
|
getDoctype(slug) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref, ComputedRef } from 'vue';
|
|
2
2
|
import Registry from '../registry';
|
|
3
3
|
import { Stonecrop } from '../stonecrop';
|
|
4
|
-
import
|
|
4
|
+
import Doctype from '../doctype';
|
|
5
5
|
import type { HSTNode } from '../stores/hst';
|
|
6
6
|
import type { HSTOperation, OperationLogConfig, OperationLogSnapshot } from '../types/operation-log';
|
|
7
7
|
import { SchemaTypes } from '@stonecrop/aform';
|
|
@@ -53,9 +53,9 @@ export type HSTStonecropReturn = BaseStonecropReturn & {
|
|
|
53
53
|
hstStore: Ref<HSTNode | undefined>;
|
|
54
54
|
formData: Ref<Record<string, any>>;
|
|
55
55
|
resolvedSchema: Ref<SchemaTypes[]>;
|
|
56
|
-
loadNestedData: (parentPath: string, childDoctype:
|
|
57
|
-
saveRecursive: (doctype:
|
|
58
|
-
createNestedContext: (basePath: string, childDoctype:
|
|
56
|
+
loadNestedData: (parentPath: string, childDoctype: Doctype, recordId?: string) => Record<string, any>;
|
|
57
|
+
saveRecursive: (doctype: Doctype, recordId: string) => Promise<Record<string, any>>;
|
|
58
|
+
createNestedContext: (basePath: string, childDoctype: Doctype) => {
|
|
59
59
|
provideHSTPath: (fieldname: string) => string;
|
|
60
60
|
handleHSTChange: (changeData: HSTChangeData) => void;
|
|
61
61
|
};
|
|
@@ -87,7 +87,7 @@ export declare function useStonecrop(): BaseStonecropReturn | HSTStonecropReturn
|
|
|
87
87
|
*/
|
|
88
88
|
export declare function useStonecrop(options: {
|
|
89
89
|
registry?: Registry;
|
|
90
|
-
doctype:
|
|
90
|
+
doctype: Doctype;
|
|
91
91
|
recordId?: string;
|
|
92
92
|
}): HSTStonecropReturn;
|
|
93
93
|
//# sourceMappingURL=stonecrop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../../src/composables/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,GAAG,EAAiC,WAAW,EAAE,MAAM,KAAK,CAAA;AAExF,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../../src/composables/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,GAAG,EAAiC,WAAW,EAAE,MAAM,KAAK,CAAA;AAExF,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc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ACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,OAAO,KACjB;QACJ,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;QAC7C,eAAe,EAAE,CAAC,UAAU,EAAE,aAAa,KAAK,IAAI,CAAA;KACpD,CAAA;CACD,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,mBAAmB,GAAG,kBAAkB,CAAA;AACxE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,CAAA"}
|
package/dist/src/doctype.d.ts
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
|
+
import type { SchemaTypes } from '@stonecrop/aform';
|
|
3
|
+
import type { UnknownMachineConfig } from 'xstate';
|
|
2
4
|
import type { ImmutableDoctype } from './types';
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* Plain object representation of doctype configuration for serialization/API responses.
|
|
7
|
+
* Compatible with the DoctypeMeta type from \@stonecrop/schema.
|
|
5
8
|
* @public
|
|
6
9
|
*/
|
|
7
|
-
export
|
|
10
|
+
export type DoctypeConfig = {
|
|
11
|
+
/** Display name of the doctype */
|
|
12
|
+
name: string;
|
|
13
|
+
/** URL-friendly slug (kebab-case) */
|
|
14
|
+
slug?: string;
|
|
15
|
+
/** Database table name */
|
|
16
|
+
tableName?: string;
|
|
17
|
+
/** Field definitions */
|
|
18
|
+
fields?: SchemaTypes[];
|
|
19
|
+
/** Workflow configuration */
|
|
20
|
+
workflow?: UnknownMachineConfig;
|
|
21
|
+
/** Actions and their field triggers */
|
|
22
|
+
actions?: Record<string, string[]>;
|
|
23
|
+
/** Parent doctype for inheritance */
|
|
24
|
+
inherits?: string;
|
|
25
|
+
/** Doctype to use for list views */
|
|
26
|
+
listDoctype?: string;
|
|
27
|
+
/** Parent doctype for child tables */
|
|
28
|
+
parentDoctype?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Doctype runtime class with Immutable.js collections for HST change tracking.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export default class Doctype {
|
|
8
35
|
/**
|
|
9
36
|
* The doctype name
|
|
10
37
|
* @public
|
|
@@ -42,7 +69,7 @@ export default class DoctypeMeta {
|
|
|
42
69
|
*/
|
|
43
70
|
readonly component?: Component;
|
|
44
71
|
/**
|
|
45
|
-
* Creates a new
|
|
72
|
+
* Creates a new Doctype instance
|
|
46
73
|
* @param doctype - The doctype name
|
|
47
74
|
* @param schema - The doctype schema definition
|
|
48
75
|
* @param workflow - The doctype workflow configuration (XState machine)
|
|
@@ -50,6 +77,70 @@ export default class DoctypeMeta {
|
|
|
50
77
|
* @param component - Optional Vue component for rendering the doctype
|
|
51
78
|
*/
|
|
52
79
|
constructor(doctype: string, schema: ImmutableDoctype['schema'], workflow: ImmutableDoctype['workflow'], actions: ImmutableDoctype['actions'], component?: Component);
|
|
80
|
+
/**
|
|
81
|
+
* Creates a Doctype instance from a plain configuration object.
|
|
82
|
+
* Handles conversion of arrays to Immutable.js collections internally.
|
|
83
|
+
*
|
|
84
|
+
* This is the recommended way to create a Doctype from API responses
|
|
85
|
+
* or configuration files, as it encapsulates the Immutable.js construction
|
|
86
|
+
* that the framework uses internally.
|
|
87
|
+
*
|
|
88
|
+
* @param config - Plain object with doctype configuration (typically from API response)
|
|
89
|
+
* @returns A new Doctype instance with Immutable.js collections
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* // From an API response
|
|
94
|
+
* const response = await client.getMeta({ doctype: 'plan' })
|
|
95
|
+
* const doctype = Doctype.fromObject(response)
|
|
96
|
+
* registry.addDoctype(doctype)
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* // From a configuration object
|
|
102
|
+
* const planDoctype = Doctype.fromObject({
|
|
103
|
+
* name: 'Plan',
|
|
104
|
+
* fields: [
|
|
105
|
+
* { fieldname: 'title', label: 'Title', fieldtype: 'Data' },
|
|
106
|
+
* { fieldname: 'status', label: 'Status', fieldtype: 'Data' },
|
|
107
|
+
* ],
|
|
108
|
+
* workflow: {
|
|
109
|
+
* id: 'plan',
|
|
110
|
+
* initial: 'draft',
|
|
111
|
+
* states: { draft: {}, submitted: {} }
|
|
112
|
+
* }
|
|
113
|
+
* })
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
static fromObject(config: DoctypeConfig): Doctype;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the schema as a plain array for use with components that expect
|
|
121
|
+
* plain JavaScript arrays (e.g., AForm, ATable).
|
|
122
|
+
*
|
|
123
|
+
* @returns Array of schema fields
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* const schemaArray = doctype.getSchemaArray()
|
|
128
|
+
* // Use with AForm
|
|
129
|
+
* <AForm :schema="schemaArray" v-model:data="formData" />
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
getSchemaArray(): SchemaTypes[];
|
|
135
|
+
/**
|
|
136
|
+
* Returns the actions as a plain object for use with components that expect
|
|
137
|
+
* plain JavaScript objects.
|
|
138
|
+
*
|
|
139
|
+
* @returns Object mapping action names to field trigger arrays
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
getActionsObject(): Record<string, string[]>;
|
|
53
144
|
/**
|
|
54
145
|
* Returns the transitions available from a given workflow state, derived from the
|
|
55
146
|
* doctype's XState workflow configuration.
|
|
@@ -79,7 +170,7 @@ export default class DoctypeMeta {
|
|
|
79
170
|
*
|
|
80
171
|
* @example
|
|
81
172
|
* ```ts
|
|
82
|
-
* const doctype = new
|
|
173
|
+
* const doctype = new Doctype('TaskItem', schema, workflow, actions)
|
|
83
174
|
* console.log(doctype.slug) // 'task-item'
|
|
84
175
|
* ```
|
|
85
176
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAElD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C;;;;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,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAC/B,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,sCAA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7 +2,7 @@ export type * from '@stonecrop/aform/types';
|
|
|
2
2
|
export type * from '@stonecrop/atable/types';
|
|
3
3
|
import { useStonecrop } from './composables/stonecrop';
|
|
4
4
|
import { useOperationLog, useUndoRedoShortcuts, withBatch } from './composables/operation-log';
|
|
5
|
-
import
|
|
5
|
+
import Doctype, { type DoctypeConfig } from './doctype';
|
|
6
6
|
import { getGlobalTriggerEngine, markOperationIrreversible, registerGlobalAction, registerTransitionAction, setFieldRollback, triggerTransition } from './field-triggers';
|
|
7
7
|
import plugin from './plugins';
|
|
8
8
|
import Registry from './registry';
|
|
@@ -16,6 +16,6 @@ export type { FieldTriggerEngine } from './field-triggers';
|
|
|
16
16
|
export type { FieldChangeContext, TransitionChangeContext, FieldTriggerExecutionResult, ActionExecutionResult, TransitionExecutionResult, FieldActionFunction, TransitionActionFunction, } from './types/field-triggers';
|
|
17
17
|
export type { ValidationIssue, ValidationResult, ValidatorOptions } from './schema-validator';
|
|
18
18
|
export { ValidationSeverity } from './schema-validator';
|
|
19
|
-
export {
|
|
19
|
+
export { Doctype, DoctypeConfig, Registry, Stonecrop, StonecropOptions, useStonecrop, HST, createHST, HSTNode, getGlobalTriggerEngine, registerGlobalAction, registerTransitionAction, setFieldRollback, triggerTransition, markOperationIrreversible, SchemaValidator, createValidator, validateSchema, useOperationLog, useOperationLogStore, useUndoRedoShortcuts, withBatch, };
|
|
20
20
|
export default plugin;
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,yBAAyB,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAC9F,OAAO,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,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EACN,OAAO,EACP,aAAa,EACb,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,YAAY,EAEZ,GAAG,EACH,SAAS,EACT,OAAO,EAEP,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EAEzB,eAAe,EACf,eAAe,EACf,cAAc,EAEd,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,GACT,CAAA;AAGD,eAAe,MAAM,CAAA"}
|
package/dist/src/registry.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SchemaTypes } from '@stonecrop/aform';
|
|
2
2
|
import { Router } from 'vue-router';
|
|
3
|
-
import
|
|
3
|
+
import Doctype from './doctype';
|
|
4
4
|
import { RouteContext } from './types/registry';
|
|
5
5
|
/**
|
|
6
6
|
* Stonecrop Registry class
|
|
@@ -19,9 +19,9 @@ export default class Registry {
|
|
|
19
19
|
readonly name: string;
|
|
20
20
|
/**
|
|
21
21
|
* The registry property contains a collection of doctypes
|
|
22
|
-
* @see {@link
|
|
22
|
+
* @see {@link Doctype}
|
|
23
23
|
*/
|
|
24
|
-
readonly registry: Record<string,
|
|
24
|
+
readonly registry: Record<string, Doctype>;
|
|
25
25
|
/**
|
|
26
26
|
* The Vue router instance
|
|
27
27
|
* @see {@link https://router.vuejs.org/}
|
|
@@ -32,19 +32,19 @@ export default class Registry {
|
|
|
32
32
|
* @param router - Optional Vue router instance for route management
|
|
33
33
|
* @param getMeta - Optional function to fetch doctype metadata from an API
|
|
34
34
|
*/
|
|
35
|
-
constructor(router?: Router, getMeta?: (routeContext: RouteContext) =>
|
|
35
|
+
constructor(router?: Router, getMeta?: (routeContext: RouteContext) => Doctype | Promise<Doctype>);
|
|
36
36
|
/**
|
|
37
37
|
* The getMeta function fetches doctype metadata from an API based on route context
|
|
38
|
-
* @see {@link
|
|
38
|
+
* @see {@link Doctype}
|
|
39
39
|
*/
|
|
40
|
-
getMeta?: (routeContext: RouteContext) =>
|
|
40
|
+
getMeta?: (routeContext: RouteContext) => Doctype | Promise<Doctype>;
|
|
41
41
|
/**
|
|
42
42
|
* Get doctype metadata
|
|
43
43
|
* @param doctype - The doctype to fetch metadata for
|
|
44
44
|
* @returns The doctype metadata
|
|
45
|
-
* @see {@link
|
|
45
|
+
* @see {@link Doctype}
|
|
46
46
|
*/
|
|
47
|
-
addDoctype(doctype:
|
|
47
|
+
addDoctype(doctype: Doctype): void;
|
|
48
48
|
/**
|
|
49
49
|
* Resolve nested Doctype and Table fields in a schema by embedding child schemas inline.
|
|
50
50
|
*
|
|
@@ -106,9 +106,9 @@ export default class Registry {
|
|
|
106
106
|
/**
|
|
107
107
|
* Get a registered doctype by slug
|
|
108
108
|
* @param slug - The doctype slug to look up
|
|
109
|
-
* @returns The
|
|
109
|
+
* @returns The Doctype instance if found, or undefined
|
|
110
110
|
* @public
|
|
111
111
|
*/
|
|
112
|
-
getDoctype(slug: string):
|
|
112
|
+
getDoctype(slug: string): Doctype | undefined;
|
|
113
113
|
}
|
|
114
114
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,OAAO,MAAM,WAAW,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAA;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE1C;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IAExB;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAWjG;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEpE;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO;IAsB3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,EAAE;IAwF1E;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IA4C5D;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;CAgB7C"}
|
package/dist/src/stonecrop.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataClient } from '@stonecrop/schema';
|
|
2
|
-
import
|
|
2
|
+
import Doctype from './doctype';
|
|
3
3
|
import Registry from './registry';
|
|
4
4
|
import { type HSTNode } from './stores/hst';
|
|
5
5
|
import type { OperationLogConfig } from './types/operation-log';
|
|
@@ -332,43 +332,43 @@ export declare class Stonecrop {
|
|
|
332
332
|
* @param doctype - The doctype to get records for
|
|
333
333
|
* @returns HST node containing records hash
|
|
334
334
|
*/
|
|
335
|
-
records(doctype: string |
|
|
335
|
+
records(doctype: string | Doctype): HSTNode;
|
|
336
336
|
/**
|
|
337
337
|
* Add a record to the store
|
|
338
338
|
* @param doctype - The doctype
|
|
339
339
|
* @param recordId - The record ID
|
|
340
340
|
* @param recordData - The record data
|
|
341
341
|
*/
|
|
342
|
-
addRecord(doctype: string |
|
|
342
|
+
addRecord(doctype: string | Doctype, recordId: string, recordData: any): void;
|
|
343
343
|
/**
|
|
344
344
|
* Get a specific record
|
|
345
345
|
* @param doctype - The doctype
|
|
346
346
|
* @param recordId - The record ID
|
|
347
347
|
* @returns HST node for the record or undefined
|
|
348
348
|
*/
|
|
349
|
-
getRecordById(doctype: string |
|
|
349
|
+
getRecordById(doctype: string | Doctype, recordId: string): HSTNode | undefined;
|
|
350
350
|
/**
|
|
351
351
|
* Remove a record from the store
|
|
352
352
|
* @param doctype - The doctype
|
|
353
353
|
* @param recordId - The record ID
|
|
354
354
|
*/
|
|
355
|
-
removeRecord(doctype: string |
|
|
355
|
+
removeRecord(doctype: string | Doctype, recordId: string): void;
|
|
356
356
|
/**
|
|
357
357
|
* Get all record IDs for a doctype
|
|
358
358
|
* @param doctype - The doctype
|
|
359
359
|
* @returns Array of record IDs
|
|
360
360
|
*/
|
|
361
|
-
getRecordIds(doctype: string |
|
|
361
|
+
getRecordIds(doctype: string | Doctype): string[];
|
|
362
362
|
/**
|
|
363
363
|
* Clear all records for a doctype
|
|
364
364
|
* @param doctype - The doctype
|
|
365
365
|
*/
|
|
366
|
-
clearRecords(doctype: string |
|
|
366
|
+
clearRecords(doctype: string | Doctype): void;
|
|
367
367
|
/**
|
|
368
368
|
* Setup method for doctype initialization
|
|
369
369
|
* @param doctype - The doctype to setup
|
|
370
370
|
*/
|
|
371
|
-
setup(doctype:
|
|
371
|
+
setup(doctype: Doctype): void;
|
|
372
372
|
/**
|
|
373
373
|
* Run action on doctype
|
|
374
374
|
* Executes the action and logs it to the operation log for audit tracking
|
|
@@ -376,20 +376,20 @@ export declare class Stonecrop {
|
|
|
376
376
|
* @param action - The action to run
|
|
377
377
|
* @param args - Action arguments (typically record IDs)
|
|
378
378
|
*/
|
|
379
|
-
runAction(doctype:
|
|
379
|
+
runAction(doctype: Doctype, action: string, args?: any[]): void;
|
|
380
380
|
/**
|
|
381
381
|
* Get records from server using the configured data client.
|
|
382
382
|
* @param doctype - The doctype
|
|
383
383
|
* @throws Error if no data client has been configured
|
|
384
384
|
*/
|
|
385
|
-
getRecords(doctype:
|
|
385
|
+
getRecords(doctype: Doctype): Promise<void>;
|
|
386
386
|
/**
|
|
387
387
|
* Get single record from server using the configured data client.
|
|
388
388
|
* @param doctype - The doctype
|
|
389
389
|
* @param recordId - The record ID
|
|
390
390
|
* @throws Error if no data client has been configured
|
|
391
391
|
*/
|
|
392
|
-
getRecord(doctype:
|
|
392
|
+
getRecord(doctype: Doctype, recordId: string): Promise<void>;
|
|
393
393
|
/**
|
|
394
394
|
* Dispatch an action to the server via the configured data client.
|
|
395
395
|
* All state changes flow through this single mutation endpoint.
|
|
@@ -400,7 +400,7 @@ export declare class Stonecrop {
|
|
|
400
400
|
* @returns Action result with success status, response data, and any error
|
|
401
401
|
* @throws Error if no data client has been configured
|
|
402
402
|
*/
|
|
403
|
-
dispatchAction(doctype:
|
|
403
|
+
dispatchAction(doctype: Doctype, action: string, args?: unknown[]): Promise<{
|
|
404
404
|
success: boolean;
|
|
405
405
|
data: unknown;
|
|
406
406
|
error: string | null;
|
|
@@ -428,12 +428,12 @@ export declare class Stonecrop {
|
|
|
428
428
|
* empty the doctype's declared `workflow.initial` state is used as the fallback,
|
|
429
429
|
* giving callers a reliable state name without having to duplicate that logic.
|
|
430
430
|
*
|
|
431
|
-
* @param doctype - The doctype slug or
|
|
431
|
+
* @param doctype - The doctype slug or Doctype instance
|
|
432
432
|
* @param recordId - The record identifier
|
|
433
433
|
* @returns The current state name, or an empty string if the doctype has no workflow
|
|
434
434
|
*
|
|
435
435
|
* @public
|
|
436
436
|
*/
|
|
437
|
-
getRecordState(doctype: string |
|
|
437
|
+
getRecordState(doctype: string | Doctype, recordId: string): string;
|
|
438
438
|
}
|
|
439
439
|
//# sourceMappingURL=stonecrop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../src/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD,OAAO,
|
|
1
|
+
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../src/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;CACnB;AAED;;;GAGG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,kBAAkB,CAAC,CAAyC;IACpE,OAAO,CAAC,mBAAmB,CAAC,CAA6B;IACzD,OAAO,CAAC,OAAO,CAAC,CAAY;IAE5B,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAE3B;;;;;OAKG;gBACS,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC,EAA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EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI;IAkC/D;;;;OAIG;IACG,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBjD;;;;;OAKG;IACG,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAelE;;;;;;;;;OASG;IACG,cAAc,CACnB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,EAAE,GACd,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAWrE;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;IAOlD;;;OAGG;IACH,QAAQ,IAAI,OAAO;IAInB;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAenE"}
|
|
@@ -4,7 +4,7 @@ import { List, Map } from 'immutable';
|
|
|
4
4
|
import type { Component } from 'vue';
|
|
5
5
|
import type { Router } from 'vue-router';
|
|
6
6
|
import type { AnyStateNodeConfig, UnknownMachineConfig } from 'xstate';
|
|
7
|
-
import type
|
|
7
|
+
import type Doctype from '../doctype';
|
|
8
8
|
import Registry from '../registry';
|
|
9
9
|
import { Stonecrop } from '../stonecrop';
|
|
10
10
|
import type { RouteContext } from './registry';
|
|
@@ -42,7 +42,7 @@ export type Schema = {
|
|
|
42
42
|
export type InstallOptions = {
|
|
43
43
|
router?: Router;
|
|
44
44
|
components?: Record<string, Component>;
|
|
45
|
-
getMeta?: (routeContext: RouteContext) =>
|
|
45
|
+
getMeta?: (routeContext: RouteContext) => Doctype | Promise<Doctype>;
|
|
46
46
|
/**
|
|
47
47
|
* Data client for fetching doctype metadata and records.
|
|
48
48
|
* Use \@stonecrop/graphql-client's StonecropClient for GraphQL backends,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,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,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,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,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,M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