@stonecrop/stonecrop 0.4.37 → 0.5.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.
- package/README.md +92 -3
- package/dist/src/composable.d.ts +74 -8
- package/dist/src/composable.d.ts.map +1 -1
- package/dist/src/composable.js +348 -0
- package/dist/src/composables/operation-log.d.ts +136 -0
- package/dist/src/composables/operation-log.d.ts.map +1 -0
- package/dist/src/composables/operation-log.js +221 -0
- package/dist/src/doctype.d.ts +9 -1
- package/dist/src/doctype.d.ts.map +1 -1
- package/dist/{doctype.js → src/doctype.js} +9 -3
- package/dist/src/field-triggers.d.ts +178 -0
- package/dist/src/field-triggers.d.ts.map +1 -0
- package/dist/src/field-triggers.js +564 -0
- package/dist/src/index.d.ts +12 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +18 -0
- package/dist/src/plugins/index.d.ts +11 -13
- package/dist/src/plugins/index.d.ts.map +1 -1
- package/dist/src/plugins/index.js +90 -0
- package/dist/src/registry.d.ts +9 -3
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/{registry.js → src/registry.js} +14 -1
- package/dist/src/stonecrop.d.ts +350 -114
- package/dist/src/stonecrop.d.ts.map +1 -1
- package/dist/src/stonecrop.js +251 -0
- package/dist/src/stores/hst.d.ts +157 -0
- package/dist/src/stores/hst.d.ts.map +1 -0
- package/dist/src/stores/hst.js +483 -0
- package/dist/src/stores/index.d.ts +5 -1
- package/dist/src/stores/index.d.ts.map +1 -1
- package/dist/{stores → src/stores}/index.js +4 -1
- package/dist/src/stores/operation-log.d.ts +268 -0
- package/dist/src/stores/operation-log.d.ts.map +1 -0
- package/dist/src/stores/operation-log.js +571 -0
- package/dist/src/types/field-triggers.d.ts +186 -0
- package/dist/src/types/field-triggers.d.ts.map +1 -0
- package/dist/src/types/field-triggers.js +4 -0
- package/dist/src/types/index.d.ts +13 -2
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +4 -0
- package/dist/src/types/operation-log.d.ts +165 -0
- package/dist/src/types/operation-log.d.ts.map +1 -0
- package/dist/src/types/registry.d.ts +11 -0
- package/dist/src/types/registry.d.ts.map +1 -0
- package/dist/src/types/registry.js +0 -0
- package/dist/stonecrop.d.ts +1555 -159
- package/dist/stonecrop.js +1974 -7028
- package/dist/stonecrop.js.map +1 -1
- package/dist/stonecrop.umd.cjs +4 -8
- package/dist/stonecrop.umd.cjs.map +1 -1
- package/dist/tests/setup.d.ts +5 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/setup.js +15 -0
- package/package.json +5 -4
- package/src/composable.ts +481 -31
- package/src/composables/operation-log.ts +254 -0
- package/src/doctype.ts +9 -3
- package/src/field-triggers.ts +671 -0
- package/src/index.ts +50 -4
- package/src/plugins/index.ts +70 -22
- package/src/registry.ts +18 -3
- package/src/stonecrop.ts +246 -155
- package/src/stores/hst.ts +703 -0
- package/src/stores/index.ts +6 -1
- package/src/stores/operation-log.ts +671 -0
- package/src/types/field-triggers.ts +201 -0
- package/src/types/index.ts +17 -6
- package/src/types/operation-log.ts +205 -0
- package/src/types/registry.ts +10 -0
- package/dist/composable.js +0 -50
- package/dist/index.js +0 -6
- package/dist/plugins/index.js +0 -49
- package/dist/src/stores/data.d.ts +0 -11
- package/dist/src/stores/data.d.ts.map +0 -1
- package/dist/stores/data.js +0 -7
- package/src/stores/data.ts +0 -8
- /package/dist/{exceptions.js → src/exceptions.js} +0 -0
- /package/dist/{types/index.js → src/types/operation-log.js} +0 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import type { HSTOperation, HSTOperationInput, OperationLogConfig, UndoRedoState, OperationLogSnapshot, OperationSource } from '../types/operation-log';
|
|
2
|
+
import type { HSTNode } from './hst';
|
|
3
|
+
/**
|
|
4
|
+
* Global HST Operation Log Store
|
|
5
|
+
* Tracks all mutations with full metadata for undo/redo, sync, and audit
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare const useOperationLogStore: import("pinia").StoreDefinition<"hst-operation-log", Pick<{
|
|
10
|
+
operations: import("vue").Ref<{
|
|
11
|
+
id: string;
|
|
12
|
+
type: import("..").HSTOperationType;
|
|
13
|
+
path: string;
|
|
14
|
+
fieldname: string;
|
|
15
|
+
beforeValue: any;
|
|
16
|
+
afterValue: any;
|
|
17
|
+
doctype: string;
|
|
18
|
+
recordId?: string | undefined;
|
|
19
|
+
timestamp: Date;
|
|
20
|
+
source?: OperationSource | undefined;
|
|
21
|
+
reversible: boolean;
|
|
22
|
+
irreversibleReason?: string | undefined;
|
|
23
|
+
transition?: string | undefined;
|
|
24
|
+
currentState?: string | undefined;
|
|
25
|
+
targetState?: string | undefined;
|
|
26
|
+
actionName?: string | undefined;
|
|
27
|
+
actionRecordIds?: string[] | undefined;
|
|
28
|
+
actionResult?: "success" | "failure" | "pending" | undefined;
|
|
29
|
+
actionError?: string | undefined;
|
|
30
|
+
userId?: string | undefined;
|
|
31
|
+
metadata?: Record<string, any> | undefined;
|
|
32
|
+
parentOperationId?: string | undefined;
|
|
33
|
+
childOperationIds?: string[] | undefined;
|
|
34
|
+
}[], HSTOperation[] | {
|
|
35
|
+
id: string;
|
|
36
|
+
type: import("..").HSTOperationType;
|
|
37
|
+
path: string;
|
|
38
|
+
fieldname: string;
|
|
39
|
+
beforeValue: any;
|
|
40
|
+
afterValue: any;
|
|
41
|
+
doctype: string;
|
|
42
|
+
recordId?: string | undefined;
|
|
43
|
+
timestamp: Date;
|
|
44
|
+
source?: OperationSource | undefined;
|
|
45
|
+
reversible: boolean;
|
|
46
|
+
irreversibleReason?: string | undefined;
|
|
47
|
+
transition?: string | undefined;
|
|
48
|
+
currentState?: string | undefined;
|
|
49
|
+
targetState?: string | undefined;
|
|
50
|
+
actionName?: string | undefined;
|
|
51
|
+
actionRecordIds?: string[] | undefined;
|
|
52
|
+
actionResult?: "success" | "failure" | "pending" | undefined;
|
|
53
|
+
actionError?: string | undefined;
|
|
54
|
+
userId?: string | undefined;
|
|
55
|
+
metadata?: Record<string, any> | undefined;
|
|
56
|
+
parentOperationId?: string | undefined;
|
|
57
|
+
childOperationIds?: string[] | undefined;
|
|
58
|
+
}[]>;
|
|
59
|
+
currentIndex: import("vue").Ref<number, number>;
|
|
60
|
+
config: import("vue").Ref<{
|
|
61
|
+
maxOperations?: number | undefined;
|
|
62
|
+
enableCrossTabSync?: boolean | undefined;
|
|
63
|
+
autoSyncInterval?: number | undefined;
|
|
64
|
+
enablePersistence?: boolean | undefined;
|
|
65
|
+
persistenceKeyPrefix?: string | undefined;
|
|
66
|
+
userId?: string | undefined;
|
|
67
|
+
operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
|
|
68
|
+
}, OperationLogConfig | {
|
|
69
|
+
maxOperations?: number | undefined;
|
|
70
|
+
enableCrossTabSync?: boolean | undefined;
|
|
71
|
+
autoSyncInterval?: number | undefined;
|
|
72
|
+
enablePersistence?: boolean | undefined;
|
|
73
|
+
persistenceKeyPrefix?: string | undefined;
|
|
74
|
+
userId?: string | undefined;
|
|
75
|
+
operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
clientId: import("vue").Ref<string, string>;
|
|
78
|
+
undoRedoState: import("vue").ComputedRef<UndoRedoState>;
|
|
79
|
+
canUndo: import("vue").ComputedRef<boolean>;
|
|
80
|
+
canRedo: import("vue").ComputedRef<boolean>;
|
|
81
|
+
undoCount: import("vue").ComputedRef<number>;
|
|
82
|
+
redoCount: import("vue").ComputedRef<number>;
|
|
83
|
+
configure: (options: Partial<OperationLogConfig>) => void;
|
|
84
|
+
addOperation: (operation: HSTOperationInput, source?: OperationSource) => string;
|
|
85
|
+
startBatch: () => void;
|
|
86
|
+
commitBatch: (description?: string) => string | null;
|
|
87
|
+
cancelBatch: () => void;
|
|
88
|
+
undo: (store: HSTNode) => boolean;
|
|
89
|
+
redo: (store: HSTNode) => boolean;
|
|
90
|
+
clear: () => void;
|
|
91
|
+
getOperationsFor: (doctype: string, recordId?: string) => HSTOperation[];
|
|
92
|
+
getSnapshot: () => OperationLogSnapshot;
|
|
93
|
+
markIrreversible: (operationId: string, reason: string) => void;
|
|
94
|
+
logAction: (doctype: string, actionName: string, recordIds?: string[], result?: "success" | "failure" | "pending", error?: string) => string;
|
|
95
|
+
}, "operations" | "clientId" | "currentIndex" | "config">, Pick<{
|
|
96
|
+
operations: import("vue").Ref<{
|
|
97
|
+
id: string;
|
|
98
|
+
type: import("..").HSTOperationType;
|
|
99
|
+
path: string;
|
|
100
|
+
fieldname: string;
|
|
101
|
+
beforeValue: any;
|
|
102
|
+
afterValue: any;
|
|
103
|
+
doctype: string;
|
|
104
|
+
recordId?: string | undefined;
|
|
105
|
+
timestamp: Date;
|
|
106
|
+
source?: OperationSource | undefined;
|
|
107
|
+
reversible: boolean;
|
|
108
|
+
irreversibleReason?: string | undefined;
|
|
109
|
+
transition?: string | undefined;
|
|
110
|
+
currentState?: string | undefined;
|
|
111
|
+
targetState?: string | undefined;
|
|
112
|
+
actionName?: string | undefined;
|
|
113
|
+
actionRecordIds?: string[] | undefined;
|
|
114
|
+
actionResult?: "success" | "failure" | "pending" | undefined;
|
|
115
|
+
actionError?: string | undefined;
|
|
116
|
+
userId?: string | undefined;
|
|
117
|
+
metadata?: Record<string, any> | undefined;
|
|
118
|
+
parentOperationId?: string | undefined;
|
|
119
|
+
childOperationIds?: string[] | undefined;
|
|
120
|
+
}[], HSTOperation[] | {
|
|
121
|
+
id: string;
|
|
122
|
+
type: import("..").HSTOperationType;
|
|
123
|
+
path: string;
|
|
124
|
+
fieldname: string;
|
|
125
|
+
beforeValue: any;
|
|
126
|
+
afterValue: any;
|
|
127
|
+
doctype: string;
|
|
128
|
+
recordId?: string | undefined;
|
|
129
|
+
timestamp: Date;
|
|
130
|
+
source?: OperationSource | undefined;
|
|
131
|
+
reversible: boolean;
|
|
132
|
+
irreversibleReason?: string | undefined;
|
|
133
|
+
transition?: string | undefined;
|
|
134
|
+
currentState?: string | undefined;
|
|
135
|
+
targetState?: string | undefined;
|
|
136
|
+
actionName?: string | undefined;
|
|
137
|
+
actionRecordIds?: string[] | undefined;
|
|
138
|
+
actionResult?: "success" | "failure" | "pending" | undefined;
|
|
139
|
+
actionError?: string | undefined;
|
|
140
|
+
userId?: string | undefined;
|
|
141
|
+
metadata?: Record<string, any> | undefined;
|
|
142
|
+
parentOperationId?: string | undefined;
|
|
143
|
+
childOperationIds?: string[] | undefined;
|
|
144
|
+
}[]>;
|
|
145
|
+
currentIndex: import("vue").Ref<number, number>;
|
|
146
|
+
config: import("vue").Ref<{
|
|
147
|
+
maxOperations?: number | undefined;
|
|
148
|
+
enableCrossTabSync?: boolean | undefined;
|
|
149
|
+
autoSyncInterval?: number | undefined;
|
|
150
|
+
enablePersistence?: boolean | undefined;
|
|
151
|
+
persistenceKeyPrefix?: string | undefined;
|
|
152
|
+
userId?: string | undefined;
|
|
153
|
+
operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
|
|
154
|
+
}, OperationLogConfig | {
|
|
155
|
+
maxOperations?: number | undefined;
|
|
156
|
+
enableCrossTabSync?: boolean | undefined;
|
|
157
|
+
autoSyncInterval?: number | undefined;
|
|
158
|
+
enablePersistence?: boolean | undefined;
|
|
159
|
+
persistenceKeyPrefix?: string | undefined;
|
|
160
|
+
userId?: string | undefined;
|
|
161
|
+
operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
|
|
162
|
+
}>;
|
|
163
|
+
clientId: import("vue").Ref<string, string>;
|
|
164
|
+
undoRedoState: import("vue").ComputedRef<UndoRedoState>;
|
|
165
|
+
canUndo: import("vue").ComputedRef<boolean>;
|
|
166
|
+
canRedo: import("vue").ComputedRef<boolean>;
|
|
167
|
+
undoCount: import("vue").ComputedRef<number>;
|
|
168
|
+
redoCount: import("vue").ComputedRef<number>;
|
|
169
|
+
configure: (options: Partial<OperationLogConfig>) => void;
|
|
170
|
+
addOperation: (operation: HSTOperationInput, source?: OperationSource) => string;
|
|
171
|
+
startBatch: () => void;
|
|
172
|
+
commitBatch: (description?: string) => string | null;
|
|
173
|
+
cancelBatch: () => void;
|
|
174
|
+
undo: (store: HSTNode) => boolean;
|
|
175
|
+
redo: (store: HSTNode) => boolean;
|
|
176
|
+
clear: () => void;
|
|
177
|
+
getOperationsFor: (doctype: string, recordId?: string) => HSTOperation[];
|
|
178
|
+
getSnapshot: () => OperationLogSnapshot;
|
|
179
|
+
markIrreversible: (operationId: string, reason: string) => void;
|
|
180
|
+
logAction: (doctype: string, actionName: string, recordIds?: string[], result?: "success" | "failure" | "pending", error?: string) => string;
|
|
181
|
+
}, "undoRedoState" | "canUndo" | "canRedo" | "undoCount" | "redoCount">, Pick<{
|
|
182
|
+
operations: import("vue").Ref<{
|
|
183
|
+
id: string;
|
|
184
|
+
type: import("..").HSTOperationType;
|
|
185
|
+
path: string;
|
|
186
|
+
fieldname: string;
|
|
187
|
+
beforeValue: any;
|
|
188
|
+
afterValue: any;
|
|
189
|
+
doctype: string;
|
|
190
|
+
recordId?: string | undefined;
|
|
191
|
+
timestamp: Date;
|
|
192
|
+
source?: OperationSource | undefined;
|
|
193
|
+
reversible: boolean;
|
|
194
|
+
irreversibleReason?: string | undefined;
|
|
195
|
+
transition?: string | undefined;
|
|
196
|
+
currentState?: string | undefined;
|
|
197
|
+
targetState?: string | undefined;
|
|
198
|
+
actionName?: string | undefined;
|
|
199
|
+
actionRecordIds?: string[] | undefined;
|
|
200
|
+
actionResult?: "success" | "failure" | "pending" | undefined;
|
|
201
|
+
actionError?: string | undefined;
|
|
202
|
+
userId?: string | undefined;
|
|
203
|
+
metadata?: Record<string, any> | undefined;
|
|
204
|
+
parentOperationId?: string | undefined;
|
|
205
|
+
childOperationIds?: string[] | undefined;
|
|
206
|
+
}[], HSTOperation[] | {
|
|
207
|
+
id: string;
|
|
208
|
+
type: import("..").HSTOperationType;
|
|
209
|
+
path: string;
|
|
210
|
+
fieldname: string;
|
|
211
|
+
beforeValue: any;
|
|
212
|
+
afterValue: any;
|
|
213
|
+
doctype: string;
|
|
214
|
+
recordId?: string | undefined;
|
|
215
|
+
timestamp: Date;
|
|
216
|
+
source?: OperationSource | undefined;
|
|
217
|
+
reversible: boolean;
|
|
218
|
+
irreversibleReason?: string | undefined;
|
|
219
|
+
transition?: string | undefined;
|
|
220
|
+
currentState?: string | undefined;
|
|
221
|
+
targetState?: string | undefined;
|
|
222
|
+
actionName?: string | undefined;
|
|
223
|
+
actionRecordIds?: string[] | undefined;
|
|
224
|
+
actionResult?: "success" | "failure" | "pending" | undefined;
|
|
225
|
+
actionError?: string | undefined;
|
|
226
|
+
userId?: string | undefined;
|
|
227
|
+
metadata?: Record<string, any> | undefined;
|
|
228
|
+
parentOperationId?: string | undefined;
|
|
229
|
+
childOperationIds?: string[] | undefined;
|
|
230
|
+
}[]>;
|
|
231
|
+
currentIndex: import("vue").Ref<number, number>;
|
|
232
|
+
config: import("vue").Ref<{
|
|
233
|
+
maxOperations?: number | undefined;
|
|
234
|
+
enableCrossTabSync?: boolean | undefined;
|
|
235
|
+
autoSyncInterval?: number | undefined;
|
|
236
|
+
enablePersistence?: boolean | undefined;
|
|
237
|
+
persistenceKeyPrefix?: string | undefined;
|
|
238
|
+
userId?: string | undefined;
|
|
239
|
+
operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
|
|
240
|
+
}, OperationLogConfig | {
|
|
241
|
+
maxOperations?: number | undefined;
|
|
242
|
+
enableCrossTabSync?: boolean | undefined;
|
|
243
|
+
autoSyncInterval?: number | undefined;
|
|
244
|
+
enablePersistence?: boolean | undefined;
|
|
245
|
+
persistenceKeyPrefix?: string | undefined;
|
|
246
|
+
userId?: string | undefined;
|
|
247
|
+
operationFilter?: ((operation: HSTOperation) => boolean) | undefined;
|
|
248
|
+
}>;
|
|
249
|
+
clientId: import("vue").Ref<string, string>;
|
|
250
|
+
undoRedoState: import("vue").ComputedRef<UndoRedoState>;
|
|
251
|
+
canUndo: import("vue").ComputedRef<boolean>;
|
|
252
|
+
canRedo: import("vue").ComputedRef<boolean>;
|
|
253
|
+
undoCount: import("vue").ComputedRef<number>;
|
|
254
|
+
redoCount: import("vue").ComputedRef<number>;
|
|
255
|
+
configure: (options: Partial<OperationLogConfig>) => void;
|
|
256
|
+
addOperation: (operation: HSTOperationInput, source?: OperationSource) => string;
|
|
257
|
+
startBatch: () => void;
|
|
258
|
+
commitBatch: (description?: string) => string | null;
|
|
259
|
+
cancelBatch: () => void;
|
|
260
|
+
undo: (store: HSTNode) => boolean;
|
|
261
|
+
redo: (store: HSTNode) => boolean;
|
|
262
|
+
clear: () => void;
|
|
263
|
+
getOperationsFor: (doctype: string, recordId?: string) => HSTOperation[];
|
|
264
|
+
getSnapshot: () => OperationLogSnapshot;
|
|
265
|
+
markIrreversible: (operationId: string, reason: string) => void;
|
|
266
|
+
logAction: (doctype: string, actionName: string, recordIds?: string[], result?: "success" | "failure" | "pending", error?: string) => string;
|
|
267
|
+
}, "undo" | "redo" | "configure" | "addOperation" | "startBatch" | "commitBatch" | "cancelBatch" | "clear" | "getOperationsFor" | "getSnapshot" | "markIrreversible" | "logAction">>;
|
|
268
|
+
//# sourceMappingURL=operation-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-log.d.ts","sourceRoot":"","sources":["../../../src/stores/operation-log.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EAEpB,eAAe,EACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AA4EpC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA2DJ,OAAO,CAAC,kBAAkB,CAAC;8BAkBtB,iBAAiB,WAAU,eAAe;;gCAwDxC,MAAM,KAAG,MAAM,GAAG,IAAI;;kBA+DpC,OAAO,KAAG,OAAO;kBAmDjB,OAAO,KAAG,OAAO;;gCA2FH,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAxTmB,OAAO,CAAC,kBAAkB,CAAC;8BAkBtB,iBAAiB,WAAU,eAAe;;gCAwDxC,MAAM,KAAG,MAAM,GAAG,IAAI;;kBA+DpC,OAAO,KAAG,OAAO;kBAmDjB,OAAO,KAAG,OAAO;;gCA2FH,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAxTmB,OAAO,CAAC,kBAAkB,CAAC;8BAkBtB,iBAAiB,WAAU,eAAe;;gCAwDxC,MAAM,KAAG,MAAM,GAAG,IAAI;;kBA+DpC,OAAO,KAAG,OAAO;kBAmDjB,OAAO,KAAG,OAAO;;gCA2FH,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;oLA6MR,CAAA"}
|