@stndrds/schema 1.0.0-alpha.294 → 1.0.0-alpha.68
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/chunk-36UBIXJN.js +82 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-IXHWBBIY.mjs +721 -0
- package/dist/chunk-KG75T7MA.mjs +18664 -0
- package/dist/chunk-NEVERCM3.js +41 -0
- package/dist/chunk-V2RPPE2Y.mjs +41 -0
- package/dist/chunk-V32FQLWX.js +721 -0
- package/dist/chunk-V5QXU2OK.mjs +82 -0
- package/dist/chunk-XGFBT4K2.js +18664 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/default-roles-42X3TJI5.mjs +21 -0
- package/dist/default-roles-C3FYDYMN.js +21 -0
- package/dist/index.d.mts +3392 -10868
- package/dist/index.d.ts +3392 -10868
- package/dist/index.js +1705 -10256
- package/dist/index.mjs +1735 -9398
- package/dist/runtime-B0G6eBXO.d.ts +12810 -0
- package/dist/runtime-fj4EKCWH.d.mts +12810 -0
- package/dist/runtime.d.mts +6 -0
- package/dist/runtime.d.ts +6 -0
- package/dist/runtime.js +323 -0
- package/dist/runtime.mjs +323 -0
- package/dist/utils.d.mts +55 -35
- package/dist/utils.d.ts +55 -35
- package/dist/utils.js +19 -31
- package/dist/utils.mjs +19 -2
- package/dist/validation/validators.d.mts +4 -0
- package/dist/validation/validators.d.ts +4 -0
- package/dist/validation/validators.js +121 -0
- package/dist/validation/validators.mjs +121 -0
- package/dist/validators-B6L_hVBw.d.ts +1564 -0
- package/dist/validators-CgiGGhyH.d.mts +1564 -0
- package/package.json +16 -106
- package/dist/all-CDJSpI46.d.ts +0 -978
- package/dist/all-Cru_CaSY.d.mts +0 -978
- package/dist/attributes-CNYwg_Nr.d.ts +0 -584
- package/dist/attributes-CWPLbp7c.d.mts +0 -584
- package/dist/capabilities.d.mts +0 -146
- package/dist/capabilities.d.ts +0 -146
- package/dist/capabilities.js +0 -77
- package/dist/capabilities.mjs +0 -70
- package/dist/chunk-2WWGHULM.mjs +0 -226
- package/dist/chunk-4KMUATDG.js +0 -609
- package/dist/chunk-5WATIVCA.js +0 -10
- package/dist/chunk-ACKMC6FL.js +0 -17
- package/dist/chunk-AYVHMVKQ.mjs +0 -15
- package/dist/chunk-CLZORRMS.mjs +0 -570
- package/dist/chunk-DVXGSTWJ.js +0 -81
- package/dist/chunk-E6JUYGJX.js +0 -22
- package/dist/chunk-EEH4XQ7W.js +0 -61
- package/dist/chunk-EW5XR2X3.js +0 -12
- package/dist/chunk-GO6LQADH.mjs +0 -57
- package/dist/chunk-HRQEZUAA.mjs +0 -29
- package/dist/chunk-HTSTPTNZ.js +0 -10
- package/dist/chunk-HURC6CW3.js +0 -241
- package/dist/chunk-JZNR4HKQ.mjs +0 -1432
- package/dist/chunk-KAWYU7TE.js +0 -657
- package/dist/chunk-KNGWHQLR.js +0 -16
- package/dist/chunk-LV3FEUKU.mjs +0 -14
- package/dist/chunk-NS63SPNN.mjs +0 -8
- package/dist/chunk-O73ROMWQ.mjs +0 -85
- package/dist/chunk-OSSGN43B.mjs +0 -8
- package/dist/chunk-Q44QKLN4.mjs +0 -43
- package/dist/chunk-Q4SZAMJT.js +0 -72
- package/dist/chunk-QT35SI3K.mjs +0 -641
- package/dist/chunk-QVLQPW3O.mjs +0 -10
- package/dist/chunk-QWKLQRBX.js +0 -35
- package/dist/chunk-R2DAEDRF.mjs +0 -74
- package/dist/chunk-R5LAJCBU.mjs +0 -67
- package/dist/chunk-SI34M4IC.js +0 -45
- package/dist/chunk-T5PM73EF.js +0 -1504
- package/dist/chunk-UANQJ2GH.mjs +0 -25
- package/dist/chunk-UXAHLSWC.mjs +0 -8
- package/dist/chunk-V2UA2D4E.js +0 -10
- package/dist/chunk-YIP5FJ5H.js +0 -27
- package/dist/chunk-YKWSHBT5.js +0 -32
- package/dist/chunk-YUFTHPOE.mjs +0 -20
- package/dist/chunk-ZDQ5AP26.mjs +0 -31
- package/dist/chunk-ZPFOKBIN.js +0 -89
- package/dist/exceptions.d.mts +0 -511
- package/dist/exceptions.d.ts +0 -511
- package/dist/exceptions.js +0 -158
- package/dist/exceptions.mjs +0 -1
- package/dist/helpers-CXkVwpsl.d.ts +0 -76
- package/dist/helpers-Dul_r9rJ.d.mts +0 -76
- package/dist/index-BdVnHL3F.d.mts +0 -853
- package/dist/index-CFhPHQaI.d.ts +0 -853
- package/dist/migrations-DaFneOfx.d.ts +0 -39
- package/dist/migrations-fRvadl6i.d.mts +0 -39
- package/dist/objects-CDwMSnqv.d.mts +0 -250
- package/dist/objects-DJv6WrDE.d.ts +0 -250
- package/dist/types-CVYiFc69.d.mts +0 -38
- package/dist/types-NGEww_ln.d.ts +0 -38
- package/dist/validation/all.d.mts +0 -11
- package/dist/validation/all.d.ts +0 -11
- package/dist/validation/all.js +0 -131
- package/dist/validation/all.mjs +0 -18
- package/dist/validation/complex/currency.d.mts +0 -15
- package/dist/validation/complex/currency.d.ts +0 -15
- package/dist/validation/complex/currency.js +0 -11
- package/dist/validation/complex/currency.mjs +0 -2
- package/dist/validation/complex/location.d.mts +0 -22
- package/dist/validation/complex/location.d.ts +0 -22
- package/dist/validation/complex/location.js +0 -11
- package/dist/validation/complex/location.mjs +0 -2
- package/dist/validation/complex/phone.d.mts +0 -22
- package/dist/validation/complex/phone.d.ts +0 -22
- package/dist/validation/complex/phone.js +0 -11
- package/dist/validation/complex/phone.mjs +0 -2
- package/dist/validation/complex/relation.d.mts +0 -25
- package/dist/validation/complex/relation.d.ts +0 -25
- package/dist/validation/complex/relation.js +0 -19
- package/dist/validation/complex/relation.mjs +0 -2
- package/dist/validation/complex/richtext.d.mts +0 -13
- package/dist/validation/complex/richtext.d.ts +0 -13
- package/dist/validation/complex/richtext.js +0 -11
- package/dist/validation/complex/richtext.mjs +0 -2
- package/dist/validation/complex/select.d.mts +0 -20
- package/dist/validation/complex/select.d.ts +0 -20
- package/dist/validation/complex/select.js +0 -19
- package/dist/validation/complex/select.mjs +0 -2
- package/dist/validation/complex/user.d.mts +0 -13
- package/dist/validation/complex/user.d.ts +0 -13
- package/dist/validation/complex/user.js +0 -11
- package/dist/validation/complex/user.mjs +0 -2
- package/dist/validation/computed/formula.d.mts +0 -14
- package/dist/validation/computed/formula.d.ts +0 -14
- package/dist/validation/computed/formula.js +0 -11
- package/dist/validation/computed/formula.mjs +0 -2
- package/dist/validation/computed/rollup.d.mts +0 -14
- package/dist/validation/computed/rollup.d.ts +0 -14
- package/dist/validation/computed/rollup.js +0 -11
- package/dist/validation/computed/rollup.mjs +0 -2
- package/dist/validation/config/index.d.mts +0 -7
- package/dist/validation/config/index.d.ts +0 -7
- package/dist/validation/config/index.js +0 -52
- package/dist/validation/config/index.mjs +0 -7
- package/dist/validation/core/index.d.mts +0 -19
- package/dist/validation/core/index.d.ts +0 -19
- package/dist/validation/core/index.js +0 -14
- package/dist/validation/core/index.mjs +0 -1
- package/dist/validation/object/index.d.mts +0 -32
- package/dist/validation/object/index.d.ts +0 -32
- package/dist/validation/object/index.js +0 -69
- package/dist/validation/object/index.mjs +0 -16
- package/dist/validation/primitives/checkbox.d.mts +0 -12
- package/dist/validation/primitives/checkbox.d.ts +0 -12
- package/dist/validation/primitives/checkbox.js +0 -11
- package/dist/validation/primitives/checkbox.mjs +0 -2
- package/dist/validation/primitives/date.d.mts +0 -25
- package/dist/validation/primitives/date.d.ts +0 -25
- package/dist/validation/primitives/date.js +0 -11
- package/dist/validation/primitives/date.mjs +0 -2
- package/dist/validation/primitives/number.d.mts +0 -12
- package/dist/validation/primitives/number.d.ts +0 -12
- package/dist/validation/primitives/number.js +0 -11
- package/dist/validation/primitives/number.mjs +0 -2
- package/dist/validation/primitives/text.d.mts +0 -12
- package/dist/validation/primitives/text.d.ts +0 -12
- package/dist/validation/primitives/text.js +0 -11
- package/dist/validation/primitives/text.mjs +0 -2
package/dist/chunk-UANQJ2GH.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_VALIDATION_MESSAGES } from './chunk-HRQEZUAA.mjs';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
function createNumberValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
5
|
-
let schema = z.number();
|
|
6
|
-
if (attr.min !== void 0) {
|
|
7
|
-
schema = schema.min(attr.min, messages.minValue(attr, attr.min));
|
|
8
|
-
}
|
|
9
|
-
if (attr.max !== void 0) {
|
|
10
|
-
schema = schema.max(attr.max, messages.maxValue(attr, attr.max));
|
|
11
|
-
}
|
|
12
|
-
if (attr.renderAs === "rating") {
|
|
13
|
-
schema = schema.min(attr.min ?? 0);
|
|
14
|
-
schema = schema.max(attr.max ?? 5);
|
|
15
|
-
}
|
|
16
|
-
if (attr.unit === "percentage") {
|
|
17
|
-
schema = schema.min(attr.min ?? 0).max(attr.max ?? 100);
|
|
18
|
-
}
|
|
19
|
-
if (attr.unit === "integer") {
|
|
20
|
-
schema = schema.int(messages.mustBeInteger(attr));
|
|
21
|
-
}
|
|
22
|
-
return schema;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { createNumberValidator };
|
package/dist/chunk-UXAHLSWC.mjs
DELETED
package/dist/chunk-V2UA2D4E.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
|
|
4
|
-
var zod = require('zod');
|
|
5
|
-
|
|
6
|
-
function createRollupValidator(_attr, _messages = chunkYKWSHBT5_js.DEFAULT_VALIDATION_MESSAGES) {
|
|
7
|
-
return zod.z.unknown();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
exports.createRollupValidator = createRollupValidator;
|
package/dist/chunk-YIP5FJ5H.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
|
|
4
|
-
var zod = require('zod');
|
|
5
|
-
|
|
6
|
-
function createNumberValidator(attr, messages = chunkYKWSHBT5_js.DEFAULT_VALIDATION_MESSAGES) {
|
|
7
|
-
let schema = zod.z.number();
|
|
8
|
-
if (attr.min !== void 0) {
|
|
9
|
-
schema = schema.min(attr.min, messages.minValue(attr, attr.min));
|
|
10
|
-
}
|
|
11
|
-
if (attr.max !== void 0) {
|
|
12
|
-
schema = schema.max(attr.max, messages.maxValue(attr, attr.max));
|
|
13
|
-
}
|
|
14
|
-
if (attr.renderAs === "rating") {
|
|
15
|
-
schema = schema.min(attr.min ?? 0);
|
|
16
|
-
schema = schema.max(attr.max ?? 5);
|
|
17
|
-
}
|
|
18
|
-
if (attr.unit === "percentage") {
|
|
19
|
-
schema = schema.min(attr.min ?? 0).max(attr.max ?? 100);
|
|
20
|
-
}
|
|
21
|
-
if (attr.unit === "integer") {
|
|
22
|
-
schema = schema.int(messages.mustBeInteger(attr));
|
|
23
|
-
}
|
|
24
|
-
return schema;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.createNumberValidator = createNumberValidator;
|
package/dist/chunk-YKWSHBT5.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/validation/core/messages.ts
|
|
4
|
-
var DEFAULT_VALIDATION_MESSAGES = {
|
|
5
|
-
required: (attr) => `${attr.label} is required`,
|
|
6
|
-
invalidType: (attr, expected) => `${attr.label} must be a ${expected}`,
|
|
7
|
-
minLength: (attr, min) => `${attr.label} must be at least ${min} characters`,
|
|
8
|
-
maxLength: (attr, max) => `${attr.label} must be at most ${max} characters`,
|
|
9
|
-
invalidPattern: (attr) => `${attr.label} format is invalid`,
|
|
10
|
-
minValue: (attr, min) => `${attr.label} must be at least ${min}`,
|
|
11
|
-
maxValue: (attr, max) => `${attr.label} must be at most ${max}`,
|
|
12
|
-
mustBeInteger: (attr) => `${attr.label} must be an integer`,
|
|
13
|
-
invalidDate: (attr) => `${attr.label} must be a valid date`,
|
|
14
|
-
invalidOption: (attr, options) => `${attr.label} must be one of: ${options.join(", ")}`,
|
|
15
|
-
invalidId: (attr) => `${attr.label} must be a valid ID`,
|
|
16
|
-
maxItems: (attr, max) => `${attr.label} must have at most ${max} item${max > 1 ? "s" : ""}`,
|
|
17
|
-
invalidRichtext: (attr) => `${attr.label} must be valid rich text content`,
|
|
18
|
-
invalidPhone: (attr) => `${attr.label} must be a valid phone number`,
|
|
19
|
-
invalidCurrency: (attr) => `${attr.label} must be a valid currency value`,
|
|
20
|
-
invalidLocation: (attr) => `${attr.label} must be a valid location`
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// src/validation/core/errors.ts
|
|
24
|
-
function formatZodErrors(error) {
|
|
25
|
-
return error.issues.map((err) => ({
|
|
26
|
-
path: err.path.map(String),
|
|
27
|
-
message: err.message
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.DEFAULT_VALIDATION_MESSAGES = DEFAULT_VALIDATION_MESSAGES;
|
|
32
|
-
exports.formatZodErrors = formatZodErrors;
|
package/dist/chunk-YUFTHPOE.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_VALIDATION_MESSAGES } from './chunk-HRQEZUAA.mjs';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
function createLocationValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
5
|
-
return z.object(
|
|
6
|
-
{
|
|
7
|
-
address: z.string().optional(),
|
|
8
|
-
address2: z.string().optional(),
|
|
9
|
-
city: z.string().optional(),
|
|
10
|
-
state: z.string().optional(),
|
|
11
|
-
postalCode: z.string().optional(),
|
|
12
|
-
country: z.string().length(3).optional(),
|
|
13
|
-
latitude: z.number().min(-90).max(90).optional(),
|
|
14
|
-
longitude: z.number().min(-180).max(180).optional()
|
|
15
|
-
},
|
|
16
|
-
{ message: messages.invalidLocation(attr) }
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { createLocationValidator };
|
package/dist/chunk-ZDQ5AP26.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_VALIDATION_MESSAGES } from './chunk-HRQEZUAA.mjs';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
function createSelectValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
5
|
-
const validValues = attr.options.map((opt) => opt.value);
|
|
6
|
-
if (validValues.length === 0) return z.never();
|
|
7
|
-
const validLabels = attr.options.map((opt) => opt.label);
|
|
8
|
-
return z.enum(validValues, {
|
|
9
|
-
message: messages.invalidOption(attr, validLabels)
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function createMultiselectValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
13
|
-
const validValues = attr.options.map((opt) => opt.value);
|
|
14
|
-
if (validValues.length === 0) return z.never();
|
|
15
|
-
const validLabels = attr.options.map((opt) => opt.label);
|
|
16
|
-
return z.array(
|
|
17
|
-
z.enum(validValues, {
|
|
18
|
-
message: messages.invalidOption(attr, validLabels)
|
|
19
|
-
})
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function createStatusValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
|
|
23
|
-
const validValues = attr.options.map((opt) => opt.value);
|
|
24
|
-
if (validValues.length === 0) return z.never();
|
|
25
|
-
const validLabels = attr.options.map((opt) => opt.label);
|
|
26
|
-
return z.enum(validValues, {
|
|
27
|
-
message: messages.invalidOption(attr, validLabels)
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { createMultiselectValidator, createSelectValidator, createStatusValidator };
|
package/dist/chunk-ZPFOKBIN.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
|
|
4
|
-
var zod = require('zod');
|
|
5
|
-
|
|
6
|
-
// src/lib/text-format.ts
|
|
7
|
-
var TEXT_FORMAT_PATTERNS = {
|
|
8
|
-
email: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
|
|
9
|
-
url: "^https?:\\/\\/[\\w\\-]+(\\.[\\w\\-]+)+[/#?]?.*$",
|
|
10
|
-
slug: "^[a-z0-9]+(?:-[a-z0-9]+)*$"
|
|
11
|
-
};
|
|
12
|
-
function resolveTextPattern(attr) {
|
|
13
|
-
if (attr.pattern) return attr.pattern;
|
|
14
|
-
return attr.format ? TEXT_FORMAT_PATTERNS[attr.format] : void 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// src/lib/lru-cache.ts
|
|
18
|
-
var LRUCache = class {
|
|
19
|
-
constructor(capacity) {
|
|
20
|
-
if (!Number.isInteger(capacity) || capacity <= 0) {
|
|
21
|
-
throw new Error("LRU cache capacity must be greater than 0");
|
|
22
|
-
}
|
|
23
|
-
this.capacity = capacity;
|
|
24
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
25
|
-
}
|
|
26
|
-
get(key) {
|
|
27
|
-
if (!this.cache.has(key)) {
|
|
28
|
-
return void 0;
|
|
29
|
-
}
|
|
30
|
-
const value = this.cache.get(key);
|
|
31
|
-
this.cache.delete(key);
|
|
32
|
-
this.cache.set(key, value);
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
set(key, value) {
|
|
36
|
-
if (this.cache.has(key)) {
|
|
37
|
-
this.cache.delete(key);
|
|
38
|
-
} else if (this.cache.size >= this.capacity) {
|
|
39
|
-
const first = this.cache.keys().next();
|
|
40
|
-
if (!first.done) {
|
|
41
|
-
this.cache.delete(first.value);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
this.cache.set(key, value);
|
|
45
|
-
}
|
|
46
|
-
has(key) {
|
|
47
|
-
return this.cache.has(key);
|
|
48
|
-
}
|
|
49
|
-
clear() {
|
|
50
|
-
this.cache.clear();
|
|
51
|
-
}
|
|
52
|
-
get size() {
|
|
53
|
-
return this.cache.size;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/validation/core/regex-cache.ts
|
|
58
|
-
function createRegexCache(capacity = 100) {
|
|
59
|
-
return new LRUCache(capacity);
|
|
60
|
-
}
|
|
61
|
-
function getCachedRegex(cache, pattern) {
|
|
62
|
-
let cached = cache.get(pattern);
|
|
63
|
-
if (!cached) {
|
|
64
|
-
cached = new RegExp(pattern);
|
|
65
|
-
cache.set(pattern, cached);
|
|
66
|
-
}
|
|
67
|
-
return cached;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/validation/primitives/text.ts
|
|
71
|
-
var textRegexCache = createRegexCache();
|
|
72
|
-
function createTextValidator(attr, messages = chunkYKWSHBT5_js.DEFAULT_VALIDATION_MESSAGES) {
|
|
73
|
-
let schema = zod.z.string();
|
|
74
|
-
if (attr.minLength !== void 0) {
|
|
75
|
-
schema = schema.min(attr.minLength, messages.minLength(attr, attr.minLength));
|
|
76
|
-
}
|
|
77
|
-
if (attr.maxLength !== void 0) {
|
|
78
|
-
schema = schema.max(attr.maxLength, messages.maxLength(attr, attr.maxLength));
|
|
79
|
-
}
|
|
80
|
-
const pattern = resolveTextPattern(attr);
|
|
81
|
-
if (pattern) {
|
|
82
|
-
schema = schema.regex(getCachedRegex(textRegexCache, pattern), messages.invalidPattern(attr));
|
|
83
|
-
}
|
|
84
|
-
return schema;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
exports.TEXT_FORMAT_PATTERNS = TEXT_FORMAT_PATTERNS;
|
|
88
|
-
exports.createTextValidator = createTextValidator;
|
|
89
|
-
exports.resolveTextPattern = resolveTextPattern;
|