@regle/schemas 1.11.0-beta.1 → 1.11.0-beta.3
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/regle-schemas.d.ts +37 -4496
- package/dist/regle-schemas.js +2 -24
- package/package.json +11 -16
package/dist/regle-schemas.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createScopedUseRegle, useRootStorage } from "@regle/core";
|
|
2
2
|
import { computed, getCurrentScope, isRef, onScopeDispose, ref, unref, watch } from "vue";
|
|
3
3
|
|
|
4
|
-
//#region ../shared/utils/isFile.ts
|
|
5
4
|
/**
|
|
6
5
|
* Server side friendly way of checking for a File
|
|
7
6
|
*/
|
|
@@ -9,8 +8,6 @@ function isFile(value) {
|
|
|
9
8
|
return value?.constructor?.name == "File" || value?.constructor?.name == "FileList";
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region ../shared/utils/isEmpty.ts
|
|
14
11
|
/**
|
|
15
12
|
* This is the inverse of isFilled. It will check if the value is in any way empty (including arrays and objects)
|
|
16
13
|
*
|
|
@@ -30,12 +27,6 @@ function isEmpty(value, considerEmptyArrayInvalid = true) {
|
|
|
30
27
|
return !String(value).length;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region ../shared/utils/symbol.ts
|
|
35
|
-
const RegleRuleSymbol = Symbol("regle-rule");
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region ../shared/utils/cloneDeep.ts
|
|
39
30
|
function getRegExpFlags(regExp) {
|
|
40
31
|
if (typeof regExp.source.flags == "string") return regExp.source.flags;
|
|
41
32
|
else {
|
|
@@ -62,8 +53,6 @@ function cloneDeep(obj) {
|
|
|
62
53
|
return result;
|
|
63
54
|
}
|
|
64
55
|
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region ../shared/utils/object.utils.ts
|
|
67
56
|
function isObject(obj) {
|
|
68
57
|
if (obj && (obj instanceof Date || obj.constructor.name == "File" || obj.constructor.name == "FileList")) return false;
|
|
69
58
|
return typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
@@ -130,8 +119,6 @@ function merge(_obj1, ..._objs) {
|
|
|
130
119
|
return result;
|
|
131
120
|
}
|
|
132
121
|
|
|
133
|
-
//#endregion
|
|
134
|
-
//#region src/core/useRegleSchema.ts
|
|
135
122
|
function createUseRegleSchemaComposable(options, shortcuts) {
|
|
136
123
|
const globalOptions = {
|
|
137
124
|
autoDirty: options?.autoDirty,
|
|
@@ -144,7 +131,7 @@ function createUseRegleSchemaComposable(options, shortcuts) {
|
|
|
144
131
|
const { syncState = {
|
|
145
132
|
onUpdate: false,
|
|
146
133
|
onValidate: false
|
|
147
|
-
}
|
|
134
|
+
}, ...defaultOptions } = options$1 ?? {};
|
|
148
135
|
const { onUpdate: syncOnUpdate = false, onValidate: syncOnValidate = false } = syncState;
|
|
149
136
|
const resolvedOptions = {
|
|
150
137
|
...globalOptions,
|
|
@@ -173,7 +160,7 @@ function createUseRegleSchemaComposable(options, shortcuts) {
|
|
|
173
160
|
$rule: "schema",
|
|
174
161
|
$message: issue.message
|
|
175
162
|
};
|
|
176
|
-
}).forEach(({ isArray, $path
|
|
163
|
+
}).forEach(({ isArray, $path, ...issue }) => {
|
|
177
164
|
setObjectError(output, $path, [issue], isArray);
|
|
178
165
|
});
|
|
179
166
|
return output;
|
|
@@ -254,8 +241,6 @@ function createUseRegleSchemaComposable(options, shortcuts) {
|
|
|
254
241
|
*/
|
|
255
242
|
const useRegleSchema = createUseRegleSchemaComposable();
|
|
256
243
|
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region src/core/withDeps.ts
|
|
259
244
|
/**
|
|
260
245
|
*
|
|
261
246
|
* Force dependency on any RPC schema
|
|
@@ -276,8 +261,6 @@ function withDeps(schema, _depsArray) {
|
|
|
276
261
|
return schema;
|
|
277
262
|
}
|
|
278
263
|
|
|
279
|
-
//#endregion
|
|
280
|
-
//#region src/core/inferSchema.ts
|
|
281
264
|
function createInferSchemaHelper() {
|
|
282
265
|
function inferSchema$1(state, rulesFactory) {
|
|
283
266
|
return rulesFactory;
|
|
@@ -293,8 +276,6 @@ function createInferSchemaHelper() {
|
|
|
293
276
|
*/
|
|
294
277
|
const inferSchema = createInferSchemaHelper();
|
|
295
278
|
|
|
296
|
-
//#endregion
|
|
297
|
-
//#region src/core/defineRegleSchemaConfig.ts
|
|
298
279
|
/**
|
|
299
280
|
* Define a global regle configuration, where you can:
|
|
300
281
|
* - Define global modifiers
|
|
@@ -312,8 +293,6 @@ function defineRegleSchemaConfig({ modifiers, shortcuts }) {
|
|
|
312
293
|
};
|
|
313
294
|
}
|
|
314
295
|
|
|
315
|
-
//#endregion
|
|
316
|
-
//#region src/core/createScopedUseRegleSchema.ts
|
|
317
296
|
const { useCollectScope: useCollectSchemaScope, useScopedRegle: useScopedRegleSchema } = createScopedUseRegle({ customUseRegle: useRegleSchema });
|
|
318
297
|
const createScopedUseRegleSchema = (options) => {
|
|
319
298
|
const { customStore, customUseRegle = useRegleSchema, asRecord = false } = options ?? {};
|
|
@@ -324,5 +303,4 @@ const createScopedUseRegleSchema = (options) => {
|
|
|
324
303
|
});
|
|
325
304
|
};
|
|
326
305
|
|
|
327
|
-
//#endregion
|
|
328
306
|
export { createScopedUseRegleSchema, defineRegleSchemaConfig, inferSchema, useCollectSchemaScope, useRegleSchema, useScopedRegleSchema, withDeps };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regle/schemas",
|
|
3
|
-
"version": "1.11.0-beta.
|
|
3
|
+
"version": "1.11.0-beta.3",
|
|
4
4
|
"description": "Schemas adapter for Regle",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@standard-schema/spec": "1.0.0",
|
|
7
|
-
"@regle/core": "1.11.0-beta.
|
|
8
|
-
"@regle/rules": "1.11.0-beta.
|
|
7
|
+
"@regle/core": "1.11.0-beta.3",
|
|
8
|
+
"@regle/rules": "1.11.0-beta.3"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"valibot": "^1.0.0",
|
|
@@ -25,30 +25,25 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@total-typescript/ts-reset": "0.6.1",
|
|
28
|
-
"@types/node": "22.19.
|
|
28
|
+
"@types/node": "22.19.1",
|
|
29
29
|
"@vue/test-utils": "2.4.6",
|
|
30
30
|
"prettier": "3.6.2",
|
|
31
|
-
"tsdown": "0.16.
|
|
31
|
+
"tsdown": "0.16.6",
|
|
32
32
|
"type-fest": "5.2.0",
|
|
33
33
|
"typescript": "5.9.3",
|
|
34
34
|
"valibot": "1.1.0",
|
|
35
|
-
"vitest": "4.0.
|
|
36
|
-
"vue": "3.5.
|
|
37
|
-
"vue-tsc": "3.1.
|
|
35
|
+
"vitest": "4.0.13",
|
|
36
|
+
"vue": "3.5.24",
|
|
37
|
+
"vue-tsc": "3.1.5",
|
|
38
38
|
"zod": "4.1.12"
|
|
39
39
|
},
|
|
40
40
|
"type": "module",
|
|
41
41
|
"exports": {
|
|
42
42
|
".": {
|
|
43
43
|
"types": "./dist/regle-schemas.d.ts",
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"development": "./dist/regle-schemas.js",
|
|
48
|
-
"default": "./dist/regle-schemas.js"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"import": "./dist/regle-schemas.js"
|
|
44
|
+
"production": "./dist/regle-schemas.min.js",
|
|
45
|
+
"development": "./dist/regle-schemas.js",
|
|
46
|
+
"default": "./dist/regle-schemas.js"
|
|
52
47
|
},
|
|
53
48
|
"./package.json": "./package.json",
|
|
54
49
|
"./dist/*": "./dist/*"
|