@stonecrop/stonecrop 0.13.4 → 0.13.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/dist/src/composables/lazy-link.d.ts.map +1 -1
- package/dist/src/composables/lazy-link.js +1 -2
- package/dist/src/composables/stonecrop.js +8 -8
- package/dist/src/doctype.d.ts.map +1 -1
- package/dist/src/doctype.js +2 -0
- package/dist/src/field-triggers.d.ts.map +1 -1
- package/dist/src/field-triggers.js +11 -9
- package/dist/src/plugins/index.d.ts.map +1 -1
- package/dist/src/plugins/index.js +0 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +7 -6
- package/dist/src/schema-validator.d.ts.map +1 -1
- package/dist/src/schema-validator.js +10 -0
- package/dist/src/stonecrop.d.ts.map +1 -1
- package/dist/src/stonecrop.js +9 -1
- package/dist/src/stores/hst.d.ts.map +1 -1
- package/dist/src/stores/hst.js +5 -14
- package/dist/src/stores/operation-log.d.ts.map +1 -1
- package/dist/src/stores/operation-log.js +21 -29
- package/dist/src/types/composable.d.ts +1 -1
- package/dist/src/types/composable.d.ts.map +1 -1
- package/dist/stonecrop.d.ts +1 -1
- package/dist/stonecrop.js +1328 -1334
- package/dist/stonecrop.js.map +1 -1
- package/package.json +11 -14
- package/src/composables/lazy-link.ts +1 -2
- package/src/composables/stonecrop.ts +10 -10
- package/src/doctype.ts +2 -0
- package/src/field-triggers.ts +11 -9
- package/src/plugins/index.ts +0 -1
- package/src/registry.ts +11 -8
- package/src/schema-validator.ts +10 -0
- package/src/stonecrop.ts +10 -3
- package/src/stores/hst.ts +13 -30
- package/src/stores/operation-log.ts +25 -31
- package/src/types/composable.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-link.d.ts","sourceRoot":"","sources":["../../../src/composables/lazy-link.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,YAAY,CAAA;AAEhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"lazy-link.d.ts","sourceRoot":"","sources":["../../../src/composables/lazy-link.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,YAAY,CAAA;AAEhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,QAAQ,CAoH/F"}
|
|
@@ -51,11 +51,10 @@ export function useLazyLink(doctype, recordId, linkFieldname) {
|
|
|
51
51
|
try {
|
|
52
52
|
// Create function from serialized string and invoke it
|
|
53
53
|
// The function receives the stonecrop instance and path as parameters
|
|
54
|
-
//
|
|
54
|
+
// oxlint-disable-next-line @typescript-eslint/no-implied-eval
|
|
55
55
|
const fn = new Function('stonecrop', 'path', 'hst', `
|
|
56
56
|
return (${handler})(stonecrop, path, hst)
|
|
57
57
|
`);
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
59
58
|
return await fn(stonecropInstance, getLinkPath(), hstStore);
|
|
60
59
|
}
|
|
61
60
|
catch (err) {
|
|
@@ -61,11 +61,11 @@ export function useStonecrop(options) {
|
|
|
61
61
|
currentIndex: -1,
|
|
62
62
|
});
|
|
63
63
|
// Operation log methods
|
|
64
|
-
const undo = (
|
|
65
|
-
return stonecrop.value?.getOperationLogStore().undo(
|
|
64
|
+
const undo = (hstNode) => {
|
|
65
|
+
return stonecrop.value?.getOperationLogStore().undo(hstNode) ?? false;
|
|
66
66
|
};
|
|
67
|
-
const redo = (
|
|
68
|
-
return stonecrop.value?.getOperationLogStore().redo(
|
|
67
|
+
const redo = (hstNode) => {
|
|
68
|
+
return stonecrop.value?.getOperationLogStore().redo(hstNode) ?? false;
|
|
69
69
|
};
|
|
70
70
|
const startBatch = () => {
|
|
71
71
|
stonecrop.value?.getOperationLogStore().startBatch();
|
|
@@ -94,8 +94,8 @@ export function useStonecrop(options) {
|
|
|
94
94
|
const markIrreversible = (operationId, reason) => {
|
|
95
95
|
stonecrop.value?.getOperationLogStore().markIrreversible(operationId, reason);
|
|
96
96
|
};
|
|
97
|
-
const logAction = (doctype, actionName, recordIds, result = 'success',
|
|
98
|
-
return stonecrop.value?.getOperationLogStore().logAction(doctype, actionName, recordIds, result,
|
|
97
|
+
const logAction = (doctype, actionName, recordIds, result = 'success', errorMessage) => {
|
|
98
|
+
return stonecrop.value?.getOperationLogStore().logAction(doctype, actionName, recordIds, result, errorMessage) ?? '';
|
|
99
99
|
};
|
|
100
100
|
const configure = (config) => {
|
|
101
101
|
stonecrop.value?.getOperationLogStore().configure(config);
|
|
@@ -358,11 +358,11 @@ export function useStonecrop(options) {
|
|
|
358
358
|
* @param recordId - Record ID to fetch
|
|
359
359
|
* @param options - Query options (includeNested to control which links are fetched)
|
|
360
360
|
*/
|
|
361
|
-
const fetchNestedData = async (path, doctype, recordId,
|
|
361
|
+
const fetchNestedData = async (path, doctype, recordId, fetchOptions) => {
|
|
362
362
|
if (!stonecrop.value) {
|
|
363
363
|
throw new Error('Stonecrop instance not available');
|
|
364
364
|
}
|
|
365
|
-
return stonecrop.value.fetchNestedData(path, doctype, recordId,
|
|
365
|
+
return stonecrop.value.fetchNestedData(path, doctype, recordId, fetchOptions);
|
|
366
366
|
};
|
|
367
367
|
/**
|
|
368
368
|
* Collect a record payload with all nested doctype fields from HST
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAA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,QAAQ,CAAC,EAClC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,EACtC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,EACpC,SAAS,CAAC,EAAE,SAAS,EACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAUxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAOjD;;;;;;;;;;;;;;OAcG;IACH,cAAc,IAAI,WAAW,EAAE;IAK/B;;;;;;;OAOG;IACH,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAK5C;;;;;;;;;;;;;;OAcG;IACH,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAuC3F;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,GAC7B;QACA,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,CAAA;QACf,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;QACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;QACxB,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC7B,GACD,SAAS;IASZ;;;;;;;;;;;;;;;OAeG;IACH,IAAI,IAAI,WAKP;CACD"}
|
package/dist/src/doctype.js
CHANGED
|
@@ -166,6 +166,7 @@ export default class Doctype {
|
|
|
166
166
|
const states = workflow.states;
|
|
167
167
|
if (!states.includes(currentState))
|
|
168
168
|
return [];
|
|
169
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Array.isArray(workflow.states) confirms WorkflowMeta format above
|
|
169
170
|
const actions = workflow.actions;
|
|
170
171
|
if (!actions)
|
|
171
172
|
return [];
|
|
@@ -214,6 +215,7 @@ export default class Doctype {
|
|
|
214
215
|
const workflow = this.workflow;
|
|
215
216
|
if (!workflow || !Array.isArray(workflow.states))
|
|
216
217
|
return undefined;
|
|
218
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Array.isArray(workflow.states) confirms WorkflowMeta format above
|
|
217
219
|
const actions = workflow.actions;
|
|
218
220
|
return actions?.[actionName];
|
|
219
221
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-triggers.d.ts","sourceRoot":"","sources":["../../src/field-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,KAAK,EAEX,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EAEnB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,wBAAwB,CAAA;AAE/B;;;;GAIG;AACH,qBAAa,kBAAkB;IAC9B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,kBAAkB,CAAA;IAEhC,OAAO,CAAC,OAAO,CAA4F;IAC3G,OAAO,CAAC,cAAc,CAA2C;IACjE,OAAO,CAAC,kBAAkB,CAA2C;IACrE,OAAO,CAAC,mBAAmB,CAA0C;IACrE,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,uBAAuB,CAA8C;IAE7E;;;OAGG;gBACS,OAAO,GAAE,mBAAwB;
|
|
1
|
+
{"version":3,"file":"field-triggers.d.ts","sourceRoot":"","sources":["../../src/field-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,KAAK,EAEX,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EAEnB,uBAAuB,EACvB,wBAAwB,EACxB,yB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AAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;CACb,GACC,OAAO,CAAC,GAAG,CAAC,CAmBd;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAS/F"}
|
|
@@ -30,6 +30,7 @@ export class FieldTriggerEngine {
|
|
|
30
30
|
enableRollback: options.enableRollback ?? true,
|
|
31
31
|
errorHandler: options.errorHandler,
|
|
32
32
|
};
|
|
33
|
+
return this;
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
36
|
* Register a global action function
|
|
@@ -86,6 +87,7 @@ export class FieldTriggerEngine {
|
|
|
86
87
|
const transitionMap = new Map();
|
|
87
88
|
// Convert from different Map types to regular Map
|
|
88
89
|
// Check for Immutable.js Map first (has entrySeq method)
|
|
90
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Immutable.js interop: runtime duck-type check follows
|
|
89
91
|
const immutableActions = actions;
|
|
90
92
|
if (typeof immutableActions.entrySeq === 'function') {
|
|
91
93
|
// Immutable Map
|
|
@@ -102,6 +104,7 @@ export class FieldTriggerEngine {
|
|
|
102
104
|
else if (actions && typeof actions === 'object') {
|
|
103
105
|
// Plain object
|
|
104
106
|
Object.entries(actions).forEach(([key, value]) => {
|
|
107
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Object.entries value type is unknown at runtime; guarded by typeof object check above
|
|
105
108
|
this.categorizeAction(key, value, actionMap, transitionMap);
|
|
106
109
|
});
|
|
107
110
|
}
|
|
@@ -160,9 +163,10 @@ export class FieldTriggerEngine {
|
|
|
160
163
|
if (rollbackEnabled && context.store) {
|
|
161
164
|
snapshot = this.captureSnapshot(context);
|
|
162
165
|
}
|
|
163
|
-
// Execute actions sequentially
|
|
166
|
+
// Execute actions sequentially — each action may depend on state set by the previous; stop-on-error semantics require sequential execution
|
|
164
167
|
for (const actionName of triggers) {
|
|
165
168
|
try {
|
|
169
|
+
// oxlint-disable-next-line eslint/no-await-in-loop -- intentionally sequential; actions are order-dependent and stop on first failure
|
|
166
170
|
const actionResult = await this.executeAction(actionName, context, options.timeout);
|
|
167
171
|
actionResults.push(actionResult);
|
|
168
172
|
if (!actionResult.success) {
|
|
@@ -190,7 +194,6 @@ export class FieldTriggerEngine {
|
|
|
190
194
|
rolledBack = true;
|
|
191
195
|
}
|
|
192
196
|
catch (rollbackError) {
|
|
193
|
-
// eslint-disable-next-line no-console
|
|
194
197
|
console.error('[FieldTriggers] Rollback failed:', rollbackError);
|
|
195
198
|
}
|
|
196
199
|
}
|
|
@@ -205,7 +208,6 @@ export class FieldTriggerEngine {
|
|
|
205
208
|
}
|
|
206
209
|
}
|
|
207
210
|
catch (handlerError) {
|
|
208
|
-
// eslint-disable-next-line no-console
|
|
209
211
|
console.error('[FieldTriggers] Error in global error handler:', handlerError);
|
|
210
212
|
}
|
|
211
213
|
}
|
|
@@ -234,9 +236,10 @@ export class FieldTriggerEngine {
|
|
|
234
236
|
return [];
|
|
235
237
|
}
|
|
236
238
|
const results = [];
|
|
237
|
-
// Execute transition actions sequentially
|
|
239
|
+
// Execute transition actions sequentially — transitions are state-machine steps; order and stop-on-error are required
|
|
238
240
|
for (const actionName of transitionActions) {
|
|
239
241
|
try {
|
|
242
|
+
// oxlint-disable-next-line eslint/no-await-in-loop -- intentionally sequential; transition actions are order-dependent and stop on first failure
|
|
240
243
|
const actionResult = await this.executeTransitionAction(actionName, context, options.timeout);
|
|
241
244
|
results.push(actionResult);
|
|
242
245
|
if (!actionResult.success) {
|
|
@@ -264,11 +267,11 @@ export class FieldTriggerEngine {
|
|
|
264
267
|
try {
|
|
265
268
|
// Call with FieldChangeContext (base context type)
|
|
266
269
|
if (failedResult.error) {
|
|
270
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- action result carries string name; FieldAction cast required by errorHandler signature
|
|
267
271
|
this.options.errorHandler(failedResult.error, context, failedResult.action);
|
|
268
272
|
}
|
|
269
273
|
}
|
|
270
274
|
catch (handlerError) {
|
|
271
|
-
// eslint-disable-next-line no-console
|
|
272
275
|
console.error('[FieldTriggers] Error in global error handler:', handlerError);
|
|
273
276
|
}
|
|
274
277
|
}
|
|
@@ -305,6 +308,7 @@ export class FieldTriggerEngine {
|
|
|
305
308
|
if (!actionFn) {
|
|
306
309
|
throw new Error(`Transition action "${actionName}" not found in registry`);
|
|
307
310
|
}
|
|
311
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- actionFn may be FieldActionFunction set from globalActions fallback; polymorphic function type
|
|
308
312
|
await this.executeWithTimeout(actionFn, context, actionTimeout);
|
|
309
313
|
const executionTime = performance.now() - startTime;
|
|
310
314
|
return {
|
|
@@ -430,7 +434,7 @@ export class FieldTriggerEngine {
|
|
|
430
434
|
Promise.resolve(fn(context))
|
|
431
435
|
.then(result => {
|
|
432
436
|
clearTimeout(timeoutId);
|
|
433
|
-
resolve(result);
|
|
437
|
+
return resolve(result);
|
|
434
438
|
})
|
|
435
439
|
.catch(error => {
|
|
436
440
|
clearTimeout(timeoutId);
|
|
@@ -459,7 +463,6 @@ export class FieldTriggerEngine {
|
|
|
459
463
|
}
|
|
460
464
|
catch (error) {
|
|
461
465
|
if (this.options.debug) {
|
|
462
|
-
// eslint-disable-next-line no-console
|
|
463
466
|
console.warn('[FieldTriggers] Failed to capture snapshot:', error);
|
|
464
467
|
}
|
|
465
468
|
return undefined;
|
|
@@ -479,12 +482,11 @@ export class FieldTriggerEngine {
|
|
|
479
482
|
// Restore the entire record from snapshot
|
|
480
483
|
context.store.set(recordPath, snapshot);
|
|
481
484
|
if (this.options.debug) {
|
|
482
|
-
//
|
|
485
|
+
// oxlint-disable-next-line no-console
|
|
483
486
|
console.log(`[FieldTriggers] Rolled back ${recordPath} to previous state`);
|
|
484
487
|
}
|
|
485
488
|
}
|
|
486
489
|
catch (error) {
|
|
487
|
-
// eslint-disable-next-line no-console
|
|
488
490
|
console.error('[FieldTriggers] Failed to restore snapshot:', error);
|
|
489
491
|
throw error;
|
|
490
492
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,MAAM,EAAY,MAAM,KAAK,CAAA;AA2BhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,MAAM,EAAY,MAAM,KAAK,CAAA;AA2BhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,MAAM,EAAE,MAoDb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -81,7 +81,6 @@ const plugin = {
|
|
|
81
81
|
}
|
|
82
82
|
catch (error) {
|
|
83
83
|
// Pinia not available - operation log won't work, but app should still function
|
|
84
|
-
// eslint-disable-next-line no-console
|
|
85
84
|
console.warn('Pinia not available - operation log features will be disabled:', error);
|
|
86
85
|
}
|
|
87
86
|
// Register custom components
|
|
@@ -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;AAChE,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnE,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,C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CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjG;;;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;IAuB3B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,EAAE;IAkHrE;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAkDrB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAoD5D;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI7C;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAWvF;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAwBtG;;;OAGG;IACH,OAAO,CAAC,oBAAoB;CAgC5B"}
|
package/dist/src/registry.js
CHANGED
|
@@ -54,6 +54,7 @@ export default class Registry {
|
|
|
54
54
|
Registry._root = this;
|
|
55
55
|
this.router = router;
|
|
56
56
|
this.getMeta = getMeta;
|
|
57
|
+
return this;
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
60
|
* The getMeta function fetches doctype metadata from an API based on route context
|
|
@@ -139,9 +140,10 @@ export default class Registry {
|
|
|
139
140
|
if ('fieldtype' in field && field.fieldtype === 'Link') {
|
|
140
141
|
const link = linksByFieldname.get(field.fieldname);
|
|
141
142
|
if (!link) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
// oxlint-disable typescript/no-unsafe-type-assertion -- SchemaTypes union narrowed to FieldMeta by fieldtype === 'Link' check; options may not exist on all members
|
|
144
|
+
const linkDoctype = typeof field.options === 'string' ? field.options : undefined;
|
|
145
|
+
// oxlint-enable typescript/no-unsafe-type-assertion
|
|
146
|
+
if (linkDoctype === undefined) {
|
|
145
147
|
console.warn(`[Stonecrop] Link field "${field.fieldname}" has no \`options\` or corresponding \`links\` declaration. ` +
|
|
146
148
|
`AFormLink will be created without a \`doctype\` prop, so navigation will not work. ` +
|
|
147
149
|
`Add \`"options": "<doctype-slug>"\` to the field definition.`);
|
|
@@ -151,7 +153,7 @@ export default class Registry {
|
|
|
151
153
|
resolvedFields.push({
|
|
152
154
|
...fieldRest,
|
|
153
155
|
component: fieldRest.component || 'AFormLink',
|
|
154
|
-
...(
|
|
156
|
+
...(linkDoctype !== undefined ? { doctype: linkDoctype } : {}),
|
|
155
157
|
});
|
|
156
158
|
continue;
|
|
157
159
|
}
|
|
@@ -354,8 +356,7 @@ export default class Registry {
|
|
|
354
356
|
const doctype = this.registry[doctypeSlug];
|
|
355
357
|
if (!doctype?.links)
|
|
356
358
|
return [];
|
|
357
|
-
return Object.entries(doctype.links).map(([fieldname, link]) => ({
|
|
358
|
-
...link,
|
|
359
|
+
return Object.entries(doctype.links).map(([fieldname, link]) => Object.assign({}, link, {
|
|
359
360
|
fieldname,
|
|
360
361
|
}));
|
|
361
362
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../src/schema-validator.ts"],"names":[],"mappings":"AAAA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 -57,6 +57,7 @@ export class SchemaValidator {
|
|
|
57
57
|
// Validate action registration
|
|
58
58
|
if (this.options.validateActions && actions) {
|
|
59
59
|
const actionsMap = actions instanceof Map ? actions : actions.toObject();
|
|
60
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- toObject() returns plain object; runtime-safe cast for Map<string, string[]>
|
|
60
61
|
issues.push(...this.validateActionRegistration(doctype, actionsMap));
|
|
61
62
|
}
|
|
62
63
|
// Calculate counts
|
|
@@ -101,8 +102,11 @@ export class SchemaValidator {
|
|
|
101
102
|
}
|
|
102
103
|
// Validate nested schemas (recursively)
|
|
103
104
|
if ('schema' in field) {
|
|
105
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- 'schema' in field guard confirms property exists; SchemaTypes union narrowed at runtime
|
|
104
106
|
const nestedSchema = field.schema;
|
|
107
|
+
// oxlint-disable typescript/no-unsafe-type-assertion -- Immutable List or plain array; toArray() returns SchemaTypes elements
|
|
105
108
|
const nestedArray = (Array.isArray(nestedSchema) ? nestedSchema : nestedSchema.toArray?.() || []);
|
|
109
|
+
// oxlint-enable typescript/no-unsafe-type-assertion
|
|
106
110
|
issues.push(...this.validateRequiredProperties(doctype, nestedArray));
|
|
107
111
|
}
|
|
108
112
|
}
|
|
@@ -115,6 +119,7 @@ export class SchemaValidator {
|
|
|
115
119
|
validateLinkFields(doctype, schema, registry) {
|
|
116
120
|
const issues = [];
|
|
117
121
|
for (const field of schema) {
|
|
122
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- 'fieldtype' in field guard confirms property exists; accessing unknown-typed fieldtype safely
|
|
118
123
|
const fieldtype = 'fieldtype' in field ? field.fieldtype : undefined;
|
|
119
124
|
// Check Link fields
|
|
120
125
|
if (fieldtype === 'Link') {
|
|
@@ -156,8 +161,11 @@ export class SchemaValidator {
|
|
|
156
161
|
}
|
|
157
162
|
// Recursively check nested schemas
|
|
158
163
|
if ('schema' in field) {
|
|
164
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- 'schema' in field guard confirms property exists; SchemaTypes union narrowed at runtime
|
|
159
165
|
const nestedSchema = field.schema;
|
|
166
|
+
// oxlint-disable typescript/no-unsafe-type-assertion -- Immutable List or plain array; toArray() returns SchemaTypes elements
|
|
160
167
|
const nestedArray = (Array.isArray(nestedSchema) ? nestedSchema : nestedSchema.toArray?.() || []);
|
|
168
|
+
// oxlint-enable typescript/no-unsafe-type-assertion
|
|
161
169
|
issues.push(...this.validateLinkFields(doctype, nestedArray, registry));
|
|
162
170
|
}
|
|
163
171
|
}
|
|
@@ -312,6 +320,7 @@ export class SchemaValidator {
|
|
|
312
320
|
reachableStates.add(transition);
|
|
313
321
|
}
|
|
314
322
|
else if (transition && typeof transition === 'object') {
|
|
323
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- 'target' in transition guard confirms property; accessing unknown-typed target safely
|
|
315
324
|
const target = 'target' in transition ? transition.target : undefined;
|
|
316
325
|
if (typeof target === 'string') {
|
|
317
326
|
reachableStates.add(target);
|
|
@@ -362,6 +371,7 @@ export class SchemaValidator {
|
|
|
362
371
|
// Check each action name
|
|
363
372
|
for (const actionName of actionNames) {
|
|
364
373
|
// Check if action is registered globally
|
|
374
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- introspecting FieldTriggerEngine private fields for validation; no public API for this check
|
|
365
375
|
const engine = triggerEngine;
|
|
366
376
|
const isRegistered = engine.globalActions?.has(actionName) || engine.globalTransitionActions?.has(actionName);
|
|
367
377
|
if (!isRegistered) {
|
|
@@ -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,OAAO,MAAM,WAAW,CAAA;AAE/B,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,cA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CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IA6BnE;;;;;;OAMG;IACH,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IA+B7E;;;;;;;;;OASG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAoB1D;;;;;;;;;;;;;OAaG;IACG,eAAe,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;KAAE,GAC9C,OAAO,CAAC,IAAI,CAAC;IAgChB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CA2BzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,SAAS,GAAG,SAAS,CAEpD"}
|
package/dist/src/stonecrop.js
CHANGED
|
@@ -40,6 +40,7 @@ export class Stonecrop {
|
|
|
40
40
|
// Initialize HST store with auto-sync to Registry
|
|
41
41
|
this.initializeHSTStore();
|
|
42
42
|
this.setupRegistrySync();
|
|
43
|
+
return this;
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Set the data client for fetching doctype metadata and records.
|
|
@@ -313,9 +314,12 @@ export class Stonecrop {
|
|
|
313
314
|
const records = await this._client.getRecords(doctype);
|
|
314
315
|
// Store each record in HST
|
|
315
316
|
records.forEach(record => {
|
|
316
|
-
if (record.id) {
|
|
317
|
+
if (typeof record.id === 'string' && record.id) {
|
|
317
318
|
this.addRecord(doctype, record.id, record);
|
|
318
319
|
}
|
|
320
|
+
else if (typeof record.id === 'number') {
|
|
321
|
+
this.addRecord(doctype, String(record.id), record);
|
|
322
|
+
}
|
|
319
323
|
});
|
|
320
324
|
}
|
|
321
325
|
/**
|
|
@@ -402,6 +406,7 @@ export class Stonecrop {
|
|
|
402
406
|
if (!meta?.workflow)
|
|
403
407
|
return '';
|
|
404
408
|
const record = this.getRecordById(slug, recordId);
|
|
409
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- HSTNode.get returns any; status is always string in workflow records
|
|
405
410
|
const status = record?.get('status');
|
|
406
411
|
// Handle both XState format and WorkflowMeta format
|
|
407
412
|
const workflow = meta.workflow;
|
|
@@ -412,10 +417,12 @@ export class Stonecrop {
|
|
|
412
417
|
}
|
|
413
418
|
else {
|
|
414
419
|
// XState format: states is an object, use initial or first key
|
|
420
|
+
// oxlint-disable typescript/no-unsafe-type-assertion -- XState MachineConfig has `initial` but type union doesn't expose it; runtime-guarded by typeof check
|
|
415
421
|
initialState =
|
|
416
422
|
typeof workflow.initial === 'string'
|
|
417
423
|
? workflow.initial
|
|
418
424
|
: (Object.keys(workflow.states ?? {})[0] ?? '');
|
|
425
|
+
// oxlint-enable typescript/no-unsafe-type-assertion
|
|
419
426
|
}
|
|
420
427
|
return status || initialState;
|
|
421
428
|
}
|
|
@@ -564,6 +571,7 @@ export function getStonecrop() {
|
|
|
564
571
|
return Stonecrop._root;
|
|
565
572
|
}
|
|
566
573
|
function createCodedError(message, code) {
|
|
574
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- extending Error with code property; CodedError cast is the standard pattern for typed error objects
|
|
567
575
|
const error = new Error(message);
|
|
568
576
|
error.code = code;
|
|
569
577
|
return error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hst.d.ts","sourceRoot":"","sources":["../../../src/stores/hst.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAe3C,UAAU,cAAc;IACvB,QAAQ,CAAC,EAAE;QACV,KAAK,CAAC,EAAE;YACP,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;SAC7B,CAAA;KACD,CAAA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O;IAwC1B,WAAW,IAAI,OAAO,GAAG,IAAI;IAc7B,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,MAAM;IAIjB,QAAQ,IAAI,MAAM;IAIlB,cAAc,IAAI,MAAM,EAAE;IAI1B;;OAEG;IACG,iBAAiB,CACtB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GACzF,OAAO,CAAC,GAAG,CAAC;IAgEf,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,WAAW;YAoBL,mBAAmB;IA6DjC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IA8CnB,OAAO,CAAC,WAAW;IAcnB;;;;OAIG;IACH,OAAO,CAAC,SAAS;CAUjB;AAED;;;;;;;;;GASG;AACH,iBAAS,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAGD,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,CAAA"}
|
package/dist/src/stores/hst.js
CHANGED
|
@@ -38,6 +38,7 @@ class HST {
|
|
|
38
38
|
// In test environment, try different ways to access Registry
|
|
39
39
|
// First, try the global Registry if it exists
|
|
40
40
|
if (typeof globalThis !== 'undefined') {
|
|
41
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- Window interface extended with RegistryGlobal in declare global above; no other way to access globalThis properties
|
|
41
42
|
const globalRegistry = globalThis.Registry?._root;
|
|
42
43
|
if (globalRegistry) {
|
|
43
44
|
return globalRegistry;
|
|
@@ -128,7 +129,6 @@ class HSTProxy {
|
|
|
128
129
|
// Get current value for change context
|
|
129
130
|
const fullPath = this.resolvePath(path);
|
|
130
131
|
if (fullPath === undefined) {
|
|
131
|
-
// eslint-disable-next-line no-console
|
|
132
132
|
console.warn('HST.set: resolved path is undefined, skipping operation');
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
@@ -342,13 +342,11 @@ class HSTProxy {
|
|
|
342
342
|
obj.$patch({ [key]: value });
|
|
343
343
|
}
|
|
344
344
|
else {
|
|
345
|
-
;
|
|
346
345
|
obj[key] = value;
|
|
347
346
|
}
|
|
348
347
|
return;
|
|
349
348
|
}
|
|
350
349
|
// Vue reactive or plain object
|
|
351
|
-
;
|
|
352
350
|
obj[key] = value;
|
|
353
351
|
}
|
|
354
352
|
async triggerFieldActions(fullPath, beforeValue, afterValue) {
|
|
@@ -398,17 +396,13 @@ class HSTProxy {
|
|
|
398
396
|
// Silently handle trigger errors to not break the main flow
|
|
399
397
|
// In production, you might want to log this error
|
|
400
398
|
if (error instanceof Error) {
|
|
401
|
-
// eslint-disable-next-line no-console
|
|
402
399
|
console.warn('Field trigger error:', error.message);
|
|
403
400
|
// Optional: emit an event or call error handler
|
|
404
401
|
}
|
|
405
402
|
}
|
|
406
403
|
}
|
|
407
404
|
isVueReactive(obj) {
|
|
408
|
-
return
|
|
409
|
-
typeof obj === 'object' &&
|
|
410
|
-
'__v_isReactive' in obj &&
|
|
411
|
-
obj.__v_isReactive === true);
|
|
405
|
+
return obj && typeof obj === 'object' && '__v_isReactive' in obj && obj.__v_isReactive === true;
|
|
412
406
|
}
|
|
413
407
|
isPiniaStore(obj) {
|
|
414
408
|
return obj && typeof obj === 'object' && ('$state' in obj || '$patch' in obj || '$id' in obj);
|
|
@@ -431,12 +425,9 @@ class HSTProxy {
|
|
|
431
425
|
('size' in obj && hasGetMethod && hasSetMethod);
|
|
432
426
|
let constructorName;
|
|
433
427
|
try {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
typeof objWithConstructor.constructor === 'object' &&
|
|
438
|
-
'name' in objWithConstructor.constructor) {
|
|
439
|
-
const nameValue = objWithConstructor.constructor.name;
|
|
428
|
+
if ('constructor' in obj && obj.constructor && typeof obj.constructor === 'object' && 'name' in obj.constructor) {
|
|
429
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- obj.constructor.name accessed after 'name' in check; obj is any throughout this method
|
|
430
|
+
const nameValue = obj.constructor.name;
|
|
440
431
|
constructorName = typeof nameValue === 'string' ? nameValue : undefined;
|
|
441
432
|
}
|
|
442
433
|
}
|
|
@@ -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;
|
|
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;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