@stonecrop/stonecrop 0.56.2 → 0.56.4
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/stonecrop.js +23 -46
- package/dist/stonecrop.js.map +1 -1
- package/package.json +5 -5
package/dist/stonecrop.js
CHANGED
|
@@ -5,7 +5,7 @@ import { useLocalStorage, useMagicKeys, whenever } from "@vueuse/core";
|
|
|
5
5
|
import { componentCategory, componentLinkExpansion, flattenFields, getRecordIdField, getRecordIdentity, isActionAllowedInState, isActionAllowedOnNewRecord, normalizeFieldKind, resolveLinkRenderMode, toSlug } from "@stonecrop/schema";
|
|
6
6
|
import { List } from "immutable";
|
|
7
7
|
import { resolvedFieldsToColumns } from "@stonecrop/aform";
|
|
8
|
-
|
|
8
|
+
// src/client-handler.ts
|
|
9
9
|
var AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
|
|
10
10
|
/**
|
|
11
11
|
* Execute a docbuilder-authored `clientHandler` body against an injected API map.
|
|
@@ -39,8 +39,7 @@ async function executeClientHandler(code, api = {}) {
|
|
|
39
39
|
const names = Object.keys(api);
|
|
40
40
|
return new AsyncFunction(...names, code)(...names.map((name) => api[name]));
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
//#region src/draft.ts
|
|
42
|
+
// src/draft.ts
|
|
44
43
|
/**
|
|
45
44
|
* The route identity of a record the user is composing that does not exist on the server yet.
|
|
46
45
|
*
|
|
@@ -77,8 +76,7 @@ var DRAFT_RECORD_ID = "new";
|
|
|
77
76
|
function isDraftRecordId(recordId) {
|
|
78
77
|
return recordId === "new";
|
|
79
78
|
}
|
|
80
|
-
|
|
81
|
-
//#region src/stores/path.ts
|
|
79
|
+
// src/stores/path.ts
|
|
82
80
|
/**
|
|
83
81
|
* Parse a path string into segments, handling both dot notation and array bracket notation
|
|
84
82
|
* @param path - The path string to parse (e.g., "order.456.line_items[0].product")
|
|
@@ -88,8 +86,7 @@ function parsePath(path) {
|
|
|
88
86
|
if (!path) return [];
|
|
89
87
|
return path.replace(/\[(\d+)\]/g, ".$1").split(".").filter((segment) => segment.length > 0);
|
|
90
88
|
}
|
|
91
|
-
|
|
92
|
-
//#region src/record-access.ts
|
|
89
|
+
// src/record-access.ts
|
|
93
90
|
/**
|
|
94
91
|
* A record's path in its store, `doctype.recordId`. An ID the store would not keep as one part of a
|
|
95
92
|
* path is refused: an empty one would address every record of the doctype, and one with a dot or a
|
|
@@ -136,8 +133,7 @@ function noRecord(reason) {
|
|
|
136
133
|
set: refuse
|
|
137
134
|
};
|
|
138
135
|
}
|
|
139
|
-
|
|
140
|
-
//#region src/stores/operation-log.ts
|
|
136
|
+
// src/stores/operation-log.ts
|
|
141
137
|
/**
|
|
142
138
|
* Generate a UUID using crypto API or fallback
|
|
143
139
|
*/
|
|
@@ -576,8 +572,7 @@ var useOperationLogStore = defineStore("hst-operation-log", () => {
|
|
|
576
572
|
logAction
|
|
577
573
|
};
|
|
578
574
|
});
|
|
579
|
-
|
|
580
|
-
//#region src/field-triggers.ts
|
|
575
|
+
// src/field-triggers.ts
|
|
581
576
|
/**
|
|
582
577
|
* Field trigger execution engine integrated with Registry
|
|
583
578
|
* Singleton pattern following Registry implementation
|
|
@@ -1013,8 +1008,7 @@ function markOperationIrreversible(operationId, reason) {
|
|
|
1013
1008
|
useOperationLogStore().markIrreversible(operationId, reason);
|
|
1014
1009
|
} catch {}
|
|
1015
1010
|
}
|
|
1016
|
-
|
|
1017
|
-
//#region src/edit-record.ts
|
|
1011
|
+
// src/edit-record.ts
|
|
1018
1012
|
function readField(record, fieldname) {
|
|
1019
1013
|
return parsePath(fieldname).reduce((value, segment) => value == null ? void 0 : value[segment], record);
|
|
1020
1014
|
}
|
|
@@ -1064,8 +1058,7 @@ function newRecord(doctype, store, startingValues = {}) {
|
|
|
1064
1058
|
};
|
|
1065
1059
|
return record;
|
|
1066
1060
|
}
|
|
1067
|
-
|
|
1068
|
-
//#region src/stores/hst.ts
|
|
1061
|
+
// src/stores/hst.ts
|
|
1069
1062
|
/**
|
|
1070
1063
|
* Get the operation log store if available
|
|
1071
1064
|
*/
|
|
@@ -1380,8 +1373,7 @@ var HSTProxy = class HSTProxy {
|
|
|
1380
1373
|
function createHST(target, doctype) {
|
|
1381
1374
|
return new HSTProxy(target, doctype, "", null);
|
|
1382
1375
|
}
|
|
1383
|
-
|
|
1384
|
-
//#region src/stonecrop.ts
|
|
1376
|
+
// src/stonecrop.ts
|
|
1385
1377
|
/**
|
|
1386
1378
|
* Main Stonecrop class with HST integration and built-in Operation Log
|
|
1387
1379
|
* @public
|
|
@@ -1882,8 +1874,7 @@ function createCodedError(message, code) {
|
|
|
1882
1874
|
function recordNotFound(doctype, recordId) {
|
|
1883
1875
|
return createCodedError(`Record not found: ${doctype.doctype} ${recordId}`, "RECORD_NOT_FOUND");
|
|
1884
1876
|
}
|
|
1885
|
-
|
|
1886
|
-
//#region src/composables/stonecrop.ts
|
|
1877
|
+
// src/composables/stonecrop.ts
|
|
1887
1878
|
/**
|
|
1888
1879
|
* @public
|
|
1889
1880
|
*/
|
|
@@ -2213,8 +2204,7 @@ function updateNestedObject(obj, path, value) {
|
|
|
2213
2204
|
const finalKey = path[path.length - 1];
|
|
2214
2205
|
current[finalKey] = value;
|
|
2215
2206
|
}
|
|
2216
|
-
|
|
2217
|
-
//#region src/client-action.ts
|
|
2207
|
+
// src/client-action.ts
|
|
2218
2208
|
/**
|
|
2219
2209
|
* The identity an action's `record` settled on, or `undefined` when it states none.
|
|
2220
2210
|
*
|
|
@@ -2377,8 +2367,7 @@ function useClientAction(options = {}) {
|
|
|
2377
2367
|
}
|
|
2378
2368
|
return { run };
|
|
2379
2369
|
}
|
|
2380
|
-
|
|
2381
|
-
//#region src/composables/lazy-link.ts
|
|
2370
|
+
// src/composables/lazy-link.ts
|
|
2382
2371
|
/**
|
|
2383
2372
|
* Get the lazy link state for a specific link field on a doctype record.
|
|
2384
2373
|
*
|
|
@@ -2479,8 +2468,7 @@ function useLazyLink(doctype, recordId, linkFieldname) {
|
|
|
2479
2468
|
reload
|
|
2480
2469
|
};
|
|
2481
2470
|
}
|
|
2482
|
-
|
|
2483
|
-
//#region src/composables/operation-log.ts
|
|
2471
|
+
// src/composables/operation-log.ts
|
|
2484
2472
|
/**
|
|
2485
2473
|
* Composable for operation log management
|
|
2486
2474
|
* Provides easy access to undo/redo functionality and operation history
|
|
@@ -2675,8 +2663,7 @@ async function withBatch(fn, description) {
|
|
|
2675
2663
|
throw error;
|
|
2676
2664
|
}
|
|
2677
2665
|
}
|
|
2678
|
-
|
|
2679
|
-
//#region src/doctype.ts
|
|
2666
|
+
// src/doctype.ts
|
|
2680
2667
|
/**
|
|
2681
2668
|
* Doctype runtime class with Immutable.js collections for HST change tracking.
|
|
2682
2669
|
* @public
|
|
@@ -2991,8 +2978,7 @@ var Doctype = class Doctype {
|
|
|
2991
2978
|
return toSlug(this.doctype);
|
|
2992
2979
|
}
|
|
2993
2980
|
};
|
|
2994
|
-
|
|
2995
|
-
//#region src/record-fields.ts
|
|
2981
|
+
// src/record-fields.ts
|
|
2996
2982
|
/**
|
|
2997
2983
|
* A doctype's link declarations by the field each one binds to: `link.fieldname`, or the declaration's key when it
|
|
2998
2984
|
* names none.
|
|
@@ -3067,8 +3053,7 @@ function columnFields(columns) {
|
|
|
3067
3053
|
component: column.component
|
|
3068
3054
|
}]));
|
|
3069
3055
|
}
|
|
3070
|
-
|
|
3071
|
-
//#region src/uuidv7.ts
|
|
3056
|
+
// src/uuidv7.ts
|
|
3072
3057
|
/**
|
|
3073
3058
|
* Generate a UUID version 7 (time-ordered) string without an external dependency.
|
|
3074
3059
|
* @public
|
|
@@ -3123,8 +3108,7 @@ function resolveTokensInRecord(record, fields, registry, now) {
|
|
|
3123
3108
|
}
|
|
3124
3109
|
return out;
|
|
3125
3110
|
}
|
|
3126
|
-
|
|
3127
|
-
//#region src/compose-new-record.ts
|
|
3111
|
+
// src/compose-new-record.ts
|
|
3128
3112
|
/**
|
|
3129
3113
|
* How long a new record waits for a starting value that has not arrived. A value still missing by then is
|
|
3130
3114
|
* skipped and reported, and the record opens without it.
|
|
@@ -3348,8 +3332,7 @@ function checkPrefill(registry, doctype, values) {
|
|
|
3348
3332
|
if (!isPlainRecord(values)) throw check.refused("its values must be a record");
|
|
3349
3333
|
return checkFilledDocument(values, recordFields(registry, doctype), "", check);
|
|
3350
3334
|
}
|
|
3351
|
-
|
|
3352
|
-
//#region src/registry.ts
|
|
3335
|
+
// src/registry.ts
|
|
3353
3336
|
/**
|
|
3354
3337
|
* Stonecrop Registry class
|
|
3355
3338
|
* @public
|
|
@@ -3716,8 +3699,7 @@ var Registry = class Registry {
|
|
|
3716
3699
|
return composeNewRecord(this, doctype, options);
|
|
3717
3700
|
}
|
|
3718
3701
|
};
|
|
3719
|
-
|
|
3720
|
-
//#region src/plugins/index.ts
|
|
3702
|
+
// src/plugins/index.ts
|
|
3721
3703
|
/**
|
|
3722
3704
|
* Setup auto-initialization for user-defined initialization logic
|
|
3723
3705
|
* This function handles the post-mount initialization automatically
|
|
@@ -3784,8 +3766,7 @@ var plugin = { install: (app, options) => {
|
|
|
3784
3766
|
if (options?.components) for (const [tag, component] of Object.entries(options.components)) app.component(tag, component);
|
|
3785
3767
|
if (options?.autoInitializeRouter && options.onRouterInitialized) setupAutoInitialization(registry, stonecrop, options.onRouterInitialized);
|
|
3786
3768
|
} };
|
|
3787
|
-
|
|
3788
|
-
//#region src/stores/validation.ts
|
|
3769
|
+
// src/stores/validation.ts
|
|
3789
3770
|
/**
|
|
3790
3771
|
* Reactive per-field validation error store + the advisory field-validation trigger engine.
|
|
3791
3772
|
*
|
|
@@ -3880,8 +3861,7 @@ var useValidationStore = defineStore("stonecrop-validation", () => {
|
|
|
3880
3861
|
validateRecord
|
|
3881
3862
|
};
|
|
3882
3863
|
});
|
|
3883
|
-
|
|
3884
|
-
//#region src/types/schema-validator.ts
|
|
3864
|
+
// src/types/schema-validator.ts
|
|
3885
3865
|
/**
|
|
3886
3866
|
* Validation severity levels
|
|
3887
3867
|
* @public
|
|
@@ -3895,8 +3875,7 @@ var ValidationSeverity = /* @__PURE__ */ function(ValidationSeverity) {
|
|
|
3895
3875
|
ValidationSeverity["INFO"] = "info";
|
|
3896
3876
|
return ValidationSeverity;
|
|
3897
3877
|
}({});
|
|
3898
|
-
|
|
3899
|
-
//#region src/schema-validator.ts
|
|
3878
|
+
// src/schema-validator.ts
|
|
3900
3879
|
/**
|
|
3901
3880
|
* Schema validator class
|
|
3902
3881
|
* @public
|
|
@@ -4197,10 +4176,8 @@ function createValidator(registry, options) {
|
|
|
4197
4176
|
function validateSchema(doctype, schema, registry, workflow, actions) {
|
|
4198
4177
|
return createValidator(registry).validate(doctype, schema, workflow, actions);
|
|
4199
4178
|
}
|
|
4200
|
-
|
|
4201
|
-
//#region src/index.ts
|
|
4179
|
+
// src/index.ts
|
|
4202
4180
|
var src_default = plugin;
|
|
4203
|
-
//#endregion
|
|
4204
4181
|
export { DEFAULTS_TIMEOUT_MS, DRAFT_RECORD_ID, Doctype, FieldTriggerEngine, HST, Registry, SchemaValidator, Stonecrop, ValidationSeverity, composeNewRecord, createHST, createValidator, src_default as default, executeClientHandler, getGlobalTriggerEngine, isDraftRecordId, markOperationIrreversible, registerGlobalAction, registerTransitionAction, setFieldRollback, triggerTransition, useClientAction, useLazyLink, useOperationLog, useOperationLogStore, useStonecrop, useUndoRedoShortcuts, useValidationStore, validateSchema, withBatch };
|
|
4205
4182
|
|
|
4206
4183
|
//# sourceMappingURL=stonecrop.js.map
|