@power-plant/schema 0.0.25 → 0.0.26
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/codegen.cjs +304 -11
- package/dist/codegen.mjs +300 -11
- package/dist/constants-B7xonHLD.cjs +128 -0
- package/dist/constants-COGt3eeW.mjs +87 -0
- package/dist/constants-COGt3eeW.mjs.map +1 -0
- package/dist/helpers-reqtcaa8.mjs +921 -0
- package/dist/helpers-reqtcaa8.mjs.map +1 -0
- package/dist/helpers-sXsSapgI.cjs +1269 -0
- package/dist/index.cjs +788 -2
- package/dist/index.mjs +706 -2
- package/dist/rolldown-runtime-C_NdSu1c.cjs +34 -0
- package/dist/storage/index.cjs +6 -1
- package/dist/storage/index.mjs +3 -1
- package/dist/storage-B8aDmNpv.cjs +934 -0
- package/dist/storage-C3BT2Xh-.mjs +917 -0
- package/dist/storage-C3BT2Xh-.mjs.map +1 -0
- package/dist/valibot.cjs +124 -1
- package/dist/valibot.mjs +119 -1
- package/dist/zod.cjs +150 -1
- package/dist/zod.mjs +143 -1
- package/package.json +4 -4
- package/dist/constants-CjTQhR-l.cjs +0 -1
- package/dist/constants-lk1mMbgx.mjs +0 -2
- package/dist/constants-lk1mMbgx.mjs.map +0 -1
- package/dist/helpers-CFED4EbH.cjs +0 -1
- package/dist/helpers-s2Zqtb-K.mjs +0 -2
- package/dist/helpers-s2Zqtb-K.mjs.map +0 -1
- package/dist/rolldown-runtime-CMqjfN_6.cjs +0 -1
- package/dist/storage-BccFP9xn.mjs +0 -2
- package/dist/storage-BccFP9xn.mjs.map +0 -1
- package/dist/storage-CgfRQlqS.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-C3BT2Xh-.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/valibot.cjs
CHANGED
|
@@ -1 +1,124 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
3
|
+
const require_constants = require('./constants-B7xonHLD.cjs');
|
|
4
|
+
let valibot = require("valibot");
|
|
5
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
6
|
+
|
|
7
|
+
//#region src/valibot.ts
|
|
8
|
+
const jsonSchemaType = valibot.picklist(require_constants.JSON_SCHEMA_TYPES);
|
|
9
|
+
const jsonSchemaEnumValue = valibot.union([
|
|
10
|
+
valibot.string(),
|
|
11
|
+
valibot.number(),
|
|
12
|
+
valibot.bigint(),
|
|
13
|
+
valibot.boolean(),
|
|
14
|
+
valibot.null()
|
|
15
|
+
]);
|
|
16
|
+
const jsonSchemaNumeric = valibot.union([valibot.number(), valibot.bigint()]);
|
|
17
|
+
const jsonSchemaDeprecated = valibot.union([
|
|
18
|
+
valibot.boolean(),
|
|
19
|
+
valibot.string(),
|
|
20
|
+
valibot.object({
|
|
21
|
+
message: valibot.optional(valibot.string()),
|
|
22
|
+
since: valibot.optional(valibot.string()),
|
|
23
|
+
alternative: valibot.optional(valibot.string())
|
|
24
|
+
})
|
|
25
|
+
]);
|
|
26
|
+
const jsonSchemaExample = valibot.union([valibot.unknown(), valibot.object({
|
|
27
|
+
name: valibot.optional(valibot.string()),
|
|
28
|
+
description: valibot.optional(valibot.string()),
|
|
29
|
+
value: valibot.unknown()
|
|
30
|
+
})]);
|
|
31
|
+
const nonNegativeInt = valibot.pipe(valibot.number(), valibot.integer(), valibot.minValue(0));
|
|
32
|
+
const referenceSchema = valibot.object({ $ref: valibot.pipe(valibot.string(), valibot.minLength(1, "Reference must be a non-empty URI")) });
|
|
33
|
+
function refOr(schema) {
|
|
34
|
+
return valibot.union([referenceSchema, schema]);
|
|
35
|
+
}
|
|
36
|
+
const jsonSchemaKeywords = valibot.object({
|
|
37
|
+
$id: valibot.optional(valibot.string()),
|
|
38
|
+
$schema: valibot.optional(valibot.string()),
|
|
39
|
+
$vocabulary: valibot.optional(valibot.record(valibot.string(), valibot.boolean())),
|
|
40
|
+
$comment: valibot.optional(valibot.string()),
|
|
41
|
+
$anchor: valibot.optional(valibot.string()),
|
|
42
|
+
$dynamicRef: valibot.optional(valibot.string()),
|
|
43
|
+
$dynamicAnchor: valibot.optional(valibot.string()),
|
|
44
|
+
name: valibot.optional(valibot.string()),
|
|
45
|
+
version: valibot.optional(valibot.union([valibot.string(), valibot.number()])),
|
|
46
|
+
title: valibot.optional(valibot.string()),
|
|
47
|
+
description: valibot.optional(valibot.string()),
|
|
48
|
+
docs: valibot.optional(valibot.string()),
|
|
49
|
+
examples: valibot.optional(valibot.array(jsonSchemaExample)),
|
|
50
|
+
alias: valibot.optional(valibot.array(valibot.string())),
|
|
51
|
+
tags: valibot.optional(valibot.array(valibot.string())),
|
|
52
|
+
deprecated: valibot.optional(jsonSchemaDeprecated),
|
|
53
|
+
hidden: valibot.optional(valibot.boolean()),
|
|
54
|
+
ignore: valibot.optional(valibot.boolean()),
|
|
55
|
+
internal: valibot.optional(valibot.boolean()),
|
|
56
|
+
runtime: valibot.optional(valibot.boolean()),
|
|
57
|
+
readOnly: valibot.optional(valibot.boolean()),
|
|
58
|
+
writeOnly: valibot.optional(valibot.boolean())
|
|
59
|
+
});
|
|
60
|
+
const jsonSchema = valibot.lazy(() => {
|
|
61
|
+
const jsonSchemaMapItems = valibot.object({
|
|
62
|
+
type: valibot.literal("array"),
|
|
63
|
+
prefixItems: valibot.tuple([jsonSchema, jsonSchema]),
|
|
64
|
+
items: valibot.optional(valibot.literal(false)),
|
|
65
|
+
minItems: valibot.literal(2),
|
|
66
|
+
maxItems: valibot.literal(2)
|
|
67
|
+
});
|
|
68
|
+
const jsonSchemaDocument = valibot.object({
|
|
69
|
+
...jsonSchemaKeywords.entries,
|
|
70
|
+
$ref: valibot.optional(valibot.string()),
|
|
71
|
+
$defs: valibot.optional(valibot.record(valibot.string(), jsonSchema)),
|
|
72
|
+
type: valibot.optional(valibot.union([jsonSchemaType, valibot.array(jsonSchemaType)])),
|
|
73
|
+
const: valibot.optional(valibot.unknown()),
|
|
74
|
+
enum: valibot.optional(valibot.array(jsonSchemaEnumValue)),
|
|
75
|
+
format: valibot.optional(valibot.string()),
|
|
76
|
+
default: valibot.optional(valibot.unknown()),
|
|
77
|
+
allOf: valibot.optional(valibot.array(jsonSchema)),
|
|
78
|
+
anyOf: valibot.optional(valibot.array(jsonSchema)),
|
|
79
|
+
oneOf: valibot.optional(valibot.array(jsonSchema)),
|
|
80
|
+
not: valibot.optional(jsonSchema),
|
|
81
|
+
if: valibot.optional(jsonSchema),
|
|
82
|
+
then: valibot.optional(jsonSchema),
|
|
83
|
+
else: valibot.optional(jsonSchema),
|
|
84
|
+
properties: valibot.optional(valibot.record(valibot.string(), jsonSchema)),
|
|
85
|
+
patternProperties: valibot.optional(valibot.record(valibot.string(), jsonSchema)),
|
|
86
|
+
additionalProperties: valibot.optional(valibot.union([valibot.boolean(), jsonSchema])),
|
|
87
|
+
required: valibot.optional(valibot.array(valibot.string())),
|
|
88
|
+
propertyNames: valibot.optional(jsonSchema),
|
|
89
|
+
dependencies: valibot.optional(valibot.record(valibot.string(), valibot.union([valibot.array(valibot.string()), jsonSchema]))),
|
|
90
|
+
dependentRequired: valibot.optional(valibot.record(valibot.string(), valibot.array(valibot.string()))),
|
|
91
|
+
dependentSchemas: valibot.optional(valibot.record(valibot.string(), jsonSchema)),
|
|
92
|
+
minProperties: valibot.optional(nonNegativeInt),
|
|
93
|
+
maxProperties: valibot.optional(nonNegativeInt),
|
|
94
|
+
primaryKey: valibot.optional(valibot.array(valibot.string())),
|
|
95
|
+
databaseSchema: valibot.optional(valibot.string()),
|
|
96
|
+
unevaluatedProperties: valibot.optional(valibot.union([valibot.boolean(), jsonSchema])),
|
|
97
|
+
prefixItems: valibot.optional(valibot.array(jsonSchema)),
|
|
98
|
+
items: valibot.optional(valibot.union([jsonSchema, jsonSchemaMapItems])),
|
|
99
|
+
contains: valibot.optional(jsonSchema),
|
|
100
|
+
minItems: valibot.optional(nonNegativeInt),
|
|
101
|
+
maxItems: valibot.optional(nonNegativeInt),
|
|
102
|
+
uniqueItems: valibot.optional(valibot.boolean()),
|
|
103
|
+
minContains: valibot.optional(nonNegativeInt),
|
|
104
|
+
maxContains: valibot.optional(nonNegativeInt),
|
|
105
|
+
unevaluatedItems: valibot.optional(valibot.union([valibot.boolean(), jsonSchema])),
|
|
106
|
+
minLength: valibot.optional(nonNegativeInt),
|
|
107
|
+
maxLength: valibot.optional(nonNegativeInt),
|
|
108
|
+
pattern: valibot.optional(valibot.string()),
|
|
109
|
+
contentMediaType: valibot.optional(valibot.string()),
|
|
110
|
+
contentEncoding: valibot.optional(valibot.string()),
|
|
111
|
+
contentSchema: valibot.optional(valibot.string()),
|
|
112
|
+
minimum: valibot.optional(jsonSchemaNumeric),
|
|
113
|
+
maximum: valibot.optional(jsonSchemaNumeric),
|
|
114
|
+
exclusiveMinimum: valibot.optional(jsonSchemaNumeric),
|
|
115
|
+
exclusiveMaximum: valibot.optional(jsonSchemaNumeric),
|
|
116
|
+
multipleOf: valibot.optional(jsonSchemaNumeric)
|
|
117
|
+
});
|
|
118
|
+
return valibot.union([referenceSchema, jsonSchemaDocument]);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
exports.jsonSchema = jsonSchema;
|
|
123
|
+
exports.refOr = refOr;
|
|
124
|
+
exports.referenceSchema = referenceSchema;
|
package/dist/valibot.mjs
CHANGED
|
@@ -1,2 +1,120 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
import { r as JSON_SCHEMA_TYPES } from "./constants-COGt3eeW.mjs";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
|
|
4
|
+
//#region src/valibot.ts
|
|
5
|
+
const jsonSchemaType = v.picklist(JSON_SCHEMA_TYPES);
|
|
6
|
+
const jsonSchemaEnumValue = v.union([
|
|
7
|
+
v.string(),
|
|
8
|
+
v.number(),
|
|
9
|
+
v.bigint(),
|
|
10
|
+
v.boolean(),
|
|
11
|
+
v.null()
|
|
12
|
+
]);
|
|
13
|
+
const jsonSchemaNumeric = v.union([v.number(), v.bigint()]);
|
|
14
|
+
const jsonSchemaDeprecated = v.union([
|
|
15
|
+
v.boolean(),
|
|
16
|
+
v.string(),
|
|
17
|
+
v.object({
|
|
18
|
+
message: v.optional(v.string()),
|
|
19
|
+
since: v.optional(v.string()),
|
|
20
|
+
alternative: v.optional(v.string())
|
|
21
|
+
})
|
|
22
|
+
]);
|
|
23
|
+
const jsonSchemaExample = v.union([v.unknown(), v.object({
|
|
24
|
+
name: v.optional(v.string()),
|
|
25
|
+
description: v.optional(v.string()),
|
|
26
|
+
value: v.unknown()
|
|
27
|
+
})]);
|
|
28
|
+
const nonNegativeInt = v.pipe(v.number(), v.integer(), v.minValue(0));
|
|
29
|
+
const referenceSchema = v.object({ $ref: v.pipe(v.string(), v.minLength(1, "Reference must be a non-empty URI")) });
|
|
30
|
+
function refOr(schema) {
|
|
31
|
+
return v.union([referenceSchema, schema]);
|
|
32
|
+
}
|
|
33
|
+
const jsonSchemaKeywords = v.object({
|
|
34
|
+
$id: v.optional(v.string()),
|
|
35
|
+
$schema: v.optional(v.string()),
|
|
36
|
+
$vocabulary: v.optional(v.record(v.string(), v.boolean())),
|
|
37
|
+
$comment: v.optional(v.string()),
|
|
38
|
+
$anchor: v.optional(v.string()),
|
|
39
|
+
$dynamicRef: v.optional(v.string()),
|
|
40
|
+
$dynamicAnchor: v.optional(v.string()),
|
|
41
|
+
name: v.optional(v.string()),
|
|
42
|
+
version: v.optional(v.union([v.string(), v.number()])),
|
|
43
|
+
title: v.optional(v.string()),
|
|
44
|
+
description: v.optional(v.string()),
|
|
45
|
+
docs: v.optional(v.string()),
|
|
46
|
+
examples: v.optional(v.array(jsonSchemaExample)),
|
|
47
|
+
alias: v.optional(v.array(v.string())),
|
|
48
|
+
tags: v.optional(v.array(v.string())),
|
|
49
|
+
deprecated: v.optional(jsonSchemaDeprecated),
|
|
50
|
+
hidden: v.optional(v.boolean()),
|
|
51
|
+
ignore: v.optional(v.boolean()),
|
|
52
|
+
internal: v.optional(v.boolean()),
|
|
53
|
+
runtime: v.optional(v.boolean()),
|
|
54
|
+
readOnly: v.optional(v.boolean()),
|
|
55
|
+
writeOnly: v.optional(v.boolean())
|
|
56
|
+
});
|
|
57
|
+
const jsonSchema = v.lazy(() => {
|
|
58
|
+
const jsonSchemaMapItems = v.object({
|
|
59
|
+
type: v.literal("array"),
|
|
60
|
+
prefixItems: v.tuple([jsonSchema, jsonSchema]),
|
|
61
|
+
items: v.optional(v.literal(false)),
|
|
62
|
+
minItems: v.literal(2),
|
|
63
|
+
maxItems: v.literal(2)
|
|
64
|
+
});
|
|
65
|
+
const jsonSchemaDocument = v.object({
|
|
66
|
+
...jsonSchemaKeywords.entries,
|
|
67
|
+
$ref: v.optional(v.string()),
|
|
68
|
+
$defs: v.optional(v.record(v.string(), jsonSchema)),
|
|
69
|
+
type: v.optional(v.union([jsonSchemaType, v.array(jsonSchemaType)])),
|
|
70
|
+
const: v.optional(v.unknown()),
|
|
71
|
+
enum: v.optional(v.array(jsonSchemaEnumValue)),
|
|
72
|
+
format: v.optional(v.string()),
|
|
73
|
+
default: v.optional(v.unknown()),
|
|
74
|
+
allOf: v.optional(v.array(jsonSchema)),
|
|
75
|
+
anyOf: v.optional(v.array(jsonSchema)),
|
|
76
|
+
oneOf: v.optional(v.array(jsonSchema)),
|
|
77
|
+
not: v.optional(jsonSchema),
|
|
78
|
+
if: v.optional(jsonSchema),
|
|
79
|
+
then: v.optional(jsonSchema),
|
|
80
|
+
else: v.optional(jsonSchema),
|
|
81
|
+
properties: v.optional(v.record(v.string(), jsonSchema)),
|
|
82
|
+
patternProperties: v.optional(v.record(v.string(), jsonSchema)),
|
|
83
|
+
additionalProperties: v.optional(v.union([v.boolean(), jsonSchema])),
|
|
84
|
+
required: v.optional(v.array(v.string())),
|
|
85
|
+
propertyNames: v.optional(jsonSchema),
|
|
86
|
+
dependencies: v.optional(v.record(v.string(), v.union([v.array(v.string()), jsonSchema]))),
|
|
87
|
+
dependentRequired: v.optional(v.record(v.string(), v.array(v.string()))),
|
|
88
|
+
dependentSchemas: v.optional(v.record(v.string(), jsonSchema)),
|
|
89
|
+
minProperties: v.optional(nonNegativeInt),
|
|
90
|
+
maxProperties: v.optional(nonNegativeInt),
|
|
91
|
+
primaryKey: v.optional(v.array(v.string())),
|
|
92
|
+
databaseSchema: v.optional(v.string()),
|
|
93
|
+
unevaluatedProperties: v.optional(v.union([v.boolean(), jsonSchema])),
|
|
94
|
+
prefixItems: v.optional(v.array(jsonSchema)),
|
|
95
|
+
items: v.optional(v.union([jsonSchema, jsonSchemaMapItems])),
|
|
96
|
+
contains: v.optional(jsonSchema),
|
|
97
|
+
minItems: v.optional(nonNegativeInt),
|
|
98
|
+
maxItems: v.optional(nonNegativeInt),
|
|
99
|
+
uniqueItems: v.optional(v.boolean()),
|
|
100
|
+
minContains: v.optional(nonNegativeInt),
|
|
101
|
+
maxContains: v.optional(nonNegativeInt),
|
|
102
|
+
unevaluatedItems: v.optional(v.union([v.boolean(), jsonSchema])),
|
|
103
|
+
minLength: v.optional(nonNegativeInt),
|
|
104
|
+
maxLength: v.optional(nonNegativeInt),
|
|
105
|
+
pattern: v.optional(v.string()),
|
|
106
|
+
contentMediaType: v.optional(v.string()),
|
|
107
|
+
contentEncoding: v.optional(v.string()),
|
|
108
|
+
contentSchema: v.optional(v.string()),
|
|
109
|
+
minimum: v.optional(jsonSchemaNumeric),
|
|
110
|
+
maximum: v.optional(jsonSchemaNumeric),
|
|
111
|
+
exclusiveMinimum: v.optional(jsonSchemaNumeric),
|
|
112
|
+
exclusiveMaximum: v.optional(jsonSchemaNumeric),
|
|
113
|
+
multipleOf: v.optional(jsonSchemaNumeric)
|
|
114
|
+
});
|
|
115
|
+
return v.union([referenceSchema, jsonSchemaDocument]);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
export { jsonSchema, refOr, referenceSchema };
|
|
2
120
|
//# sourceMappingURL=valibot.mjs.map
|
package/dist/zod.cjs
CHANGED
|
@@ -1 +1,150 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
3
|
+
const require_constants = require('./constants-B7xonHLD.cjs');
|
|
4
|
+
const require_helpers = require('./helpers-sXsSapgI.cjs');
|
|
5
|
+
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
6
|
+
let zod_mini = require("zod/mini");
|
|
7
|
+
zod_mini = require_rolldown_runtime.__toESM(zod_mini, 1);
|
|
8
|
+
let zod_v4 = require("zod/v4");
|
|
9
|
+
zod_v4 = require_rolldown_runtime.__toESM(zod_v4, 1);
|
|
10
|
+
|
|
11
|
+
//#region src/zod.ts
|
|
12
|
+
const jsonSchemaType = zod_mini.enum(require_constants.JSON_SCHEMA_TYPES);
|
|
13
|
+
const jsonSchemaEnumValue = zod_mini.union([
|
|
14
|
+
zod_mini.string(),
|
|
15
|
+
zod_mini.number(),
|
|
16
|
+
zod_mini.bigint(),
|
|
17
|
+
zod_mini.boolean(),
|
|
18
|
+
zod_mini.null()
|
|
19
|
+
]);
|
|
20
|
+
const jsonSchemaNumeric = zod_mini.union([zod_mini.number(), zod_mini.bigint()]);
|
|
21
|
+
const jsonSchemaDeprecated = zod_mini.union([
|
|
22
|
+
zod_mini.boolean(),
|
|
23
|
+
zod_mini.string(),
|
|
24
|
+
zod_mini.object({
|
|
25
|
+
message: zod_mini.optional(zod_mini.string()),
|
|
26
|
+
since: zod_mini.optional(zod_mini.string()),
|
|
27
|
+
alternative: zod_mini.optional(zod_mini.string())
|
|
28
|
+
})
|
|
29
|
+
]);
|
|
30
|
+
const jsonSchemaExample = zod_mini.union([zod_mini.unknown(), zod_mini.object({
|
|
31
|
+
name: zod_mini.optional(zod_mini.string()),
|
|
32
|
+
description: zod_mini.optional(zod_mini.string()),
|
|
33
|
+
value: zod_mini.unknown()
|
|
34
|
+
})]);
|
|
35
|
+
const nonNegativeInt = zod_mini.number().check(zod_mini.int(), zod_mini.nonnegative());
|
|
36
|
+
const referenceSchema = zod_mini.object({ $ref: zod_mini.string().check(zod_mini.minLength(1, "Reference must be a non-empty URI")) });
|
|
37
|
+
function refOr(schema) {
|
|
38
|
+
return zod_mini.union([referenceSchema, schema]);
|
|
39
|
+
}
|
|
40
|
+
const jsonSchemaKeywords = zod_mini.object({
|
|
41
|
+
$id: zod_mini.optional(zod_mini.string()),
|
|
42
|
+
$schema: zod_mini.optional(zod_mini.string()),
|
|
43
|
+
$vocabulary: zod_mini.optional(zod_mini.record(zod_mini.string(), zod_mini.boolean())),
|
|
44
|
+
$comment: zod_mini.optional(zod_mini.string()),
|
|
45
|
+
$anchor: zod_mini.optional(zod_mini.string()),
|
|
46
|
+
$dynamicRef: zod_mini.optional(zod_mini.string()),
|
|
47
|
+
$dynamicAnchor: zod_mini.optional(zod_mini.string()),
|
|
48
|
+
name: zod_mini.optional(zod_mini.string()),
|
|
49
|
+
version: zod_mini.optional(zod_mini.union([zod_mini.string(), zod_mini.number()])),
|
|
50
|
+
title: zod_mini.optional(zod_mini.string()),
|
|
51
|
+
description: zod_mini.optional(zod_mini.string()),
|
|
52
|
+
docs: zod_mini.optional(zod_mini.string()),
|
|
53
|
+
examples: zod_mini.optional(zod_mini.array(jsonSchemaExample)),
|
|
54
|
+
alias: zod_mini.optional(zod_mini.array(zod_mini.string())),
|
|
55
|
+
tags: zod_mini.optional(zod_mini.array(zod_mini.string())),
|
|
56
|
+
deprecated: zod_mini.optional(jsonSchemaDeprecated),
|
|
57
|
+
hidden: zod_mini.optional(zod_mini.boolean()),
|
|
58
|
+
ignore: zod_mini.optional(zod_mini.boolean()),
|
|
59
|
+
internal: zod_mini.optional(zod_mini.boolean()),
|
|
60
|
+
runtime: zod_mini.optional(zod_mini.boolean()),
|
|
61
|
+
readOnly: zod_mini.optional(zod_mini.boolean()),
|
|
62
|
+
writeOnly: zod_mini.optional(zod_mini.boolean())
|
|
63
|
+
});
|
|
64
|
+
const jsonSchema = zod_mini.lazy(() => {
|
|
65
|
+
const jsonSchemaMapItems = zod_mini.object({
|
|
66
|
+
type: zod_mini.literal("array"),
|
|
67
|
+
prefixItems: zod_mini.tuple([jsonSchema, jsonSchema]),
|
|
68
|
+
items: zod_mini.optional(zod_mini.literal(false)),
|
|
69
|
+
minItems: zod_mini.literal(2),
|
|
70
|
+
maxItems: zod_mini.literal(2)
|
|
71
|
+
});
|
|
72
|
+
const jsonSchemaDocument = zod_mini.extend(jsonSchemaKeywords, {
|
|
73
|
+
$ref: zod_mini.optional(zod_mini.string()),
|
|
74
|
+
$defs: zod_mini.optional(zod_mini.record(zod_mini.string(), jsonSchema)),
|
|
75
|
+
type: zod_mini.optional(zod_mini.union([jsonSchemaType, zod_mini.array(jsonSchemaType)])),
|
|
76
|
+
const: zod_mini.optional(zod_mini.unknown()),
|
|
77
|
+
enum: zod_mini.optional(zod_mini.array(jsonSchemaEnumValue)),
|
|
78
|
+
format: zod_mini.optional(zod_mini.string()),
|
|
79
|
+
default: zod_mini.optional(zod_mini.unknown()),
|
|
80
|
+
allOf: zod_mini.optional(zod_mini.array(jsonSchema)),
|
|
81
|
+
anyOf: zod_mini.optional(zod_mini.array(jsonSchema)),
|
|
82
|
+
oneOf: zod_mini.optional(zod_mini.array(jsonSchema)),
|
|
83
|
+
not: zod_mini.optional(jsonSchema),
|
|
84
|
+
if: zod_mini.optional(jsonSchema),
|
|
85
|
+
then: zod_mini.optional(jsonSchema),
|
|
86
|
+
else: zod_mini.optional(jsonSchema),
|
|
87
|
+
properties: zod_mini.optional(zod_mini.record(zod_mini.string(), jsonSchema)),
|
|
88
|
+
patternProperties: zod_mini.optional(zod_mini.record(zod_mini.string(), jsonSchema)),
|
|
89
|
+
additionalProperties: zod_mini.optional(zod_mini.union([zod_mini.boolean(), jsonSchema])),
|
|
90
|
+
required: zod_mini.optional(zod_mini.array(zod_mini.string())),
|
|
91
|
+
propertyNames: zod_mini.optional(jsonSchema),
|
|
92
|
+
dependencies: zod_mini.optional(zod_mini.record(zod_mini.string(), zod_mini.union([zod_mini.array(zod_mini.string()), jsonSchema]))),
|
|
93
|
+
dependentRequired: zod_mini.optional(zod_mini.record(zod_mini.string(), zod_mini.array(zod_mini.string()))),
|
|
94
|
+
dependentSchemas: zod_mini.optional(zod_mini.record(zod_mini.string(), jsonSchema)),
|
|
95
|
+
minProperties: zod_mini.optional(nonNegativeInt),
|
|
96
|
+
maxProperties: zod_mini.optional(nonNegativeInt),
|
|
97
|
+
primaryKey: zod_mini.optional(zod_mini.array(zod_mini.string())),
|
|
98
|
+
databaseSchema: zod_mini.optional(zod_mini.string()),
|
|
99
|
+
unevaluatedProperties: zod_mini.optional(zod_mini.union([zod_mini.boolean(), jsonSchema])),
|
|
100
|
+
prefixItems: zod_mini.optional(zod_mini.array(jsonSchema)),
|
|
101
|
+
items: zod_mini.optional(zod_mini.union([jsonSchema, jsonSchemaMapItems])),
|
|
102
|
+
contains: zod_mini.optional(jsonSchema),
|
|
103
|
+
minItems: zod_mini.optional(nonNegativeInt),
|
|
104
|
+
maxItems: zod_mini.optional(nonNegativeInt),
|
|
105
|
+
uniqueItems: zod_mini.optional(zod_mini.boolean()),
|
|
106
|
+
minContains: zod_mini.optional(nonNegativeInt),
|
|
107
|
+
maxContains: zod_mini.optional(nonNegativeInt),
|
|
108
|
+
unevaluatedItems: zod_mini.optional(zod_mini.union([zod_mini.boolean(), jsonSchema])),
|
|
109
|
+
minLength: zod_mini.optional(nonNegativeInt),
|
|
110
|
+
maxLength: zod_mini.optional(nonNegativeInt),
|
|
111
|
+
pattern: zod_mini.optional(zod_mini.string()),
|
|
112
|
+
contentMediaType: zod_mini.optional(zod_mini.string()),
|
|
113
|
+
contentEncoding: zod_mini.optional(zod_mini.string()),
|
|
114
|
+
contentSchema: zod_mini.optional(zod_mini.string()),
|
|
115
|
+
minimum: zod_mini.optional(jsonSchemaNumeric),
|
|
116
|
+
maximum: zod_mini.optional(jsonSchemaNumeric),
|
|
117
|
+
exclusiveMinimum: zod_mini.optional(jsonSchemaNumeric),
|
|
118
|
+
exclusiveMaximum: zod_mini.optional(jsonSchemaNumeric),
|
|
119
|
+
multipleOf: zod_mini.optional(jsonSchemaNumeric)
|
|
120
|
+
});
|
|
121
|
+
return zod_mini.union([referenceSchema, jsonSchemaDocument]);
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* Converts a JSON Schema or {@link SchemaEnvelope} to a Zod schema.
|
|
125
|
+
*
|
|
126
|
+
* @param schema - The JSON Schema or {@link SchemaEnvelope} to convert to a Zod schema.
|
|
127
|
+
* @param params - Optional parameters for the conversion.
|
|
128
|
+
* @returns A Zod schema representing the JSON Schema.
|
|
129
|
+
*/
|
|
130
|
+
function toZodSchema(schema, params = {}) {
|
|
131
|
+
const jsonSchema = (0, _stryke_helpers_deep_clone.deepClone)(require_helpers.getJsonSchema(schema));
|
|
132
|
+
require_helpers.traverseSchema(jsonSchema, (subSchema) => {
|
|
133
|
+
if (require_helpers.isJsonSchemaAny(subSchema)) subSchema.type = [
|
|
134
|
+
"string",
|
|
135
|
+
"number",
|
|
136
|
+
"integer",
|
|
137
|
+
"boolean",
|
|
138
|
+
"null",
|
|
139
|
+
"array",
|
|
140
|
+
"object"
|
|
141
|
+
];
|
|
142
|
+
});
|
|
143
|
+
return zod_v4.fromJSONSchema(jsonSchema, params);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
exports.jsonSchema = jsonSchema;
|
|
148
|
+
exports.refOr = refOr;
|
|
149
|
+
exports.referenceSchema = referenceSchema;
|
|
150
|
+
exports.toZodSchema = toZodSchema;
|
package/dist/zod.mjs
CHANGED
|
@@ -1,2 +1,144 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { r as JSON_SCHEMA_TYPES } from "./constants-COGt3eeW.mjs";
|
|
2
|
+
import { f as traverseSchema, g as isJsonSchemaAny, n as getJsonSchema } from "./helpers-reqtcaa8.mjs";
|
|
3
|
+
import { deepClone } from "@stryke/helpers/deep-clone";
|
|
4
|
+
import * as z from "zod/mini";
|
|
5
|
+
import * as z4 from "zod/v4";
|
|
6
|
+
|
|
7
|
+
//#region src/zod.ts
|
|
8
|
+
const jsonSchemaType = z.enum(JSON_SCHEMA_TYPES);
|
|
9
|
+
const jsonSchemaEnumValue = z.union([
|
|
10
|
+
z.string(),
|
|
11
|
+
z.number(),
|
|
12
|
+
z.bigint(),
|
|
13
|
+
z.boolean(),
|
|
14
|
+
z.null()
|
|
15
|
+
]);
|
|
16
|
+
const jsonSchemaNumeric = z.union([z.number(), z.bigint()]);
|
|
17
|
+
const jsonSchemaDeprecated = z.union([
|
|
18
|
+
z.boolean(),
|
|
19
|
+
z.string(),
|
|
20
|
+
z.object({
|
|
21
|
+
message: z.optional(z.string()),
|
|
22
|
+
since: z.optional(z.string()),
|
|
23
|
+
alternative: z.optional(z.string())
|
|
24
|
+
})
|
|
25
|
+
]);
|
|
26
|
+
const jsonSchemaExample = z.union([z.unknown(), z.object({
|
|
27
|
+
name: z.optional(z.string()),
|
|
28
|
+
description: z.optional(z.string()),
|
|
29
|
+
value: z.unknown()
|
|
30
|
+
})]);
|
|
31
|
+
const nonNegativeInt = z.number().check(z.int(), z.nonnegative());
|
|
32
|
+
const referenceSchema = z.object({ $ref: z.string().check(z.minLength(1, "Reference must be a non-empty URI")) });
|
|
33
|
+
function refOr(schema) {
|
|
34
|
+
return z.union([referenceSchema, schema]);
|
|
35
|
+
}
|
|
36
|
+
const jsonSchemaKeywords = z.object({
|
|
37
|
+
$id: z.optional(z.string()),
|
|
38
|
+
$schema: z.optional(z.string()),
|
|
39
|
+
$vocabulary: z.optional(z.record(z.string(), z.boolean())),
|
|
40
|
+
$comment: z.optional(z.string()),
|
|
41
|
+
$anchor: z.optional(z.string()),
|
|
42
|
+
$dynamicRef: z.optional(z.string()),
|
|
43
|
+
$dynamicAnchor: z.optional(z.string()),
|
|
44
|
+
name: z.optional(z.string()),
|
|
45
|
+
version: z.optional(z.union([z.string(), z.number()])),
|
|
46
|
+
title: z.optional(z.string()),
|
|
47
|
+
description: z.optional(z.string()),
|
|
48
|
+
docs: z.optional(z.string()),
|
|
49
|
+
examples: z.optional(z.array(jsonSchemaExample)),
|
|
50
|
+
alias: z.optional(z.array(z.string())),
|
|
51
|
+
tags: z.optional(z.array(z.string())),
|
|
52
|
+
deprecated: z.optional(jsonSchemaDeprecated),
|
|
53
|
+
hidden: z.optional(z.boolean()),
|
|
54
|
+
ignore: z.optional(z.boolean()),
|
|
55
|
+
internal: z.optional(z.boolean()),
|
|
56
|
+
runtime: z.optional(z.boolean()),
|
|
57
|
+
readOnly: z.optional(z.boolean()),
|
|
58
|
+
writeOnly: z.optional(z.boolean())
|
|
59
|
+
});
|
|
60
|
+
const jsonSchema = z.lazy(() => {
|
|
61
|
+
const jsonSchemaMapItems = z.object({
|
|
62
|
+
type: z.literal("array"),
|
|
63
|
+
prefixItems: z.tuple([jsonSchema, jsonSchema]),
|
|
64
|
+
items: z.optional(z.literal(false)),
|
|
65
|
+
minItems: z.literal(2),
|
|
66
|
+
maxItems: z.literal(2)
|
|
67
|
+
});
|
|
68
|
+
const jsonSchemaDocument = z.extend(jsonSchemaKeywords, {
|
|
69
|
+
$ref: z.optional(z.string()),
|
|
70
|
+
$defs: z.optional(z.record(z.string(), jsonSchema)),
|
|
71
|
+
type: z.optional(z.union([jsonSchemaType, z.array(jsonSchemaType)])),
|
|
72
|
+
const: z.optional(z.unknown()),
|
|
73
|
+
enum: z.optional(z.array(jsonSchemaEnumValue)),
|
|
74
|
+
format: z.optional(z.string()),
|
|
75
|
+
default: z.optional(z.unknown()),
|
|
76
|
+
allOf: z.optional(z.array(jsonSchema)),
|
|
77
|
+
anyOf: z.optional(z.array(jsonSchema)),
|
|
78
|
+
oneOf: z.optional(z.array(jsonSchema)),
|
|
79
|
+
not: z.optional(jsonSchema),
|
|
80
|
+
if: z.optional(jsonSchema),
|
|
81
|
+
then: z.optional(jsonSchema),
|
|
82
|
+
else: z.optional(jsonSchema),
|
|
83
|
+
properties: z.optional(z.record(z.string(), jsonSchema)),
|
|
84
|
+
patternProperties: z.optional(z.record(z.string(), jsonSchema)),
|
|
85
|
+
additionalProperties: z.optional(z.union([z.boolean(), jsonSchema])),
|
|
86
|
+
required: z.optional(z.array(z.string())),
|
|
87
|
+
propertyNames: z.optional(jsonSchema),
|
|
88
|
+
dependencies: z.optional(z.record(z.string(), z.union([z.array(z.string()), jsonSchema]))),
|
|
89
|
+
dependentRequired: z.optional(z.record(z.string(), z.array(z.string()))),
|
|
90
|
+
dependentSchemas: z.optional(z.record(z.string(), jsonSchema)),
|
|
91
|
+
minProperties: z.optional(nonNegativeInt),
|
|
92
|
+
maxProperties: z.optional(nonNegativeInt),
|
|
93
|
+
primaryKey: z.optional(z.array(z.string())),
|
|
94
|
+
databaseSchema: z.optional(z.string()),
|
|
95
|
+
unevaluatedProperties: z.optional(z.union([z.boolean(), jsonSchema])),
|
|
96
|
+
prefixItems: z.optional(z.array(jsonSchema)),
|
|
97
|
+
items: z.optional(z.union([jsonSchema, jsonSchemaMapItems])),
|
|
98
|
+
contains: z.optional(jsonSchema),
|
|
99
|
+
minItems: z.optional(nonNegativeInt),
|
|
100
|
+
maxItems: z.optional(nonNegativeInt),
|
|
101
|
+
uniqueItems: z.optional(z.boolean()),
|
|
102
|
+
minContains: z.optional(nonNegativeInt),
|
|
103
|
+
maxContains: z.optional(nonNegativeInt),
|
|
104
|
+
unevaluatedItems: z.optional(z.union([z.boolean(), jsonSchema])),
|
|
105
|
+
minLength: z.optional(nonNegativeInt),
|
|
106
|
+
maxLength: z.optional(nonNegativeInt),
|
|
107
|
+
pattern: z.optional(z.string()),
|
|
108
|
+
contentMediaType: z.optional(z.string()),
|
|
109
|
+
contentEncoding: z.optional(z.string()),
|
|
110
|
+
contentSchema: z.optional(z.string()),
|
|
111
|
+
minimum: z.optional(jsonSchemaNumeric),
|
|
112
|
+
maximum: z.optional(jsonSchemaNumeric),
|
|
113
|
+
exclusiveMinimum: z.optional(jsonSchemaNumeric),
|
|
114
|
+
exclusiveMaximum: z.optional(jsonSchemaNumeric),
|
|
115
|
+
multipleOf: z.optional(jsonSchemaNumeric)
|
|
116
|
+
});
|
|
117
|
+
return z.union([referenceSchema, jsonSchemaDocument]);
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Converts a JSON Schema or {@link SchemaEnvelope} to a Zod schema.
|
|
121
|
+
*
|
|
122
|
+
* @param schema - The JSON Schema or {@link SchemaEnvelope} to convert to a Zod schema.
|
|
123
|
+
* @param params - Optional parameters for the conversion.
|
|
124
|
+
* @returns A Zod schema representing the JSON Schema.
|
|
125
|
+
*/
|
|
126
|
+
function toZodSchema(schema, params = {}) {
|
|
127
|
+
const jsonSchema = deepClone(getJsonSchema(schema));
|
|
128
|
+
traverseSchema(jsonSchema, (subSchema) => {
|
|
129
|
+
if (isJsonSchemaAny(subSchema)) subSchema.type = [
|
|
130
|
+
"string",
|
|
131
|
+
"number",
|
|
132
|
+
"integer",
|
|
133
|
+
"boolean",
|
|
134
|
+
"null",
|
|
135
|
+
"array",
|
|
136
|
+
"object"
|
|
137
|
+
];
|
|
138
|
+
});
|
|
139
|
+
return z4.fromJSONSchema(jsonSchema, params);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//#endregion
|
|
143
|
+
export { jsonSchema, refOr, referenceSchema, toZodSchema };
|
|
2
144
|
//# sourceMappingURL=zod.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@power-plant/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Power Plant utility package to help managing schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -142,9 +142,9 @@
|
|
|
142
142
|
"untyped": "^1.5.2"
|
|
143
143
|
},
|
|
144
144
|
"devDependencies": {
|
|
145
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
145
|
+
"@powerlines/plugin-tsdown": "^0.1.551",
|
|
146
146
|
"@types/node": "^25.9.5",
|
|
147
|
-
"powerlines": "^0.47.
|
|
147
|
+
"powerlines": "^0.47.150",
|
|
148
148
|
"valibot": "^1.4.2",
|
|
149
149
|
"zod": "^4.4.3"
|
|
150
150
|
},
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"zod": { "optional": true }
|
|
158
158
|
},
|
|
159
159
|
"publishConfig": { "access": "public" },
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "5a761f6fb1dfcaebd823b4b0c53d75839e3d7aad"
|
|
161
161
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={STRING:`string`,NUMBER:`number`,INTEGER:`integer`,BOOLEAN:`boolean`,NULL:`null`,OBJECT:`object`,ARRAY:`array`},t=[e.STRING,e.NUMBER,e.INTEGER,e.BOOLEAN,e.NULL],n=[...t,e.ARRAY,e.OBJECT],r=[`$id`,`$schema`,`$vocabulary`,`$comment`,`$anchor`,`$defs`,`$dynamicRef`,`$dynamicAnchor`,`alias`,`deprecated`,`description`,`title`,`docs`,`examples`,`hidden`,`ignore`,`internal`,`name`,`readOnly`,`runtime`,`tags`,`version`,`writeOnly`],i=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`]),a=new Set([`if`,`then`,`else`,`not`,`contains`,`items`,`additionalProperties`,`unevaluatedProperties`,`propertyNames`,`unevaluatedItems`]),o=new Set([`allOf`,`anyOf`,`oneOf`]);Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e={STRING:`string`,NUMBER:`number`,INTEGER:`integer`,BOOLEAN:`boolean`,NULL:`null`,OBJECT:`object`,ARRAY:`array`},t=[e.STRING,e.NUMBER,e.INTEGER,e.BOOLEAN,e.NULL],n=[...t,e.ARRAY,e.OBJECT],r=[`$id`,`$schema`,`$vocabulary`,`$comment`,`$anchor`,`$defs`,`$dynamicRef`,`$dynamicAnchor`,`alias`,`deprecated`,`description`,`title`,`docs`,`examples`,`hidden`,`ignore`,`internal`,`name`,`readOnly`,`runtime`,`tags`,`version`,`writeOnly`],i=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`]),a=new Set([`if`,`then`,`else`,`not`,`contains`,`items`,`additionalProperties`,`unevaluatedProperties`,`propertyNames`,`unevaluatedItems`]),o=new Set([`allOf`,`anyOf`,`oneOf`]);export{o as a,e as i,t as n,i as o,n as r,a as s,r as t};
|
|
2
|
-
//# sourceMappingURL=constants-lk1mMbgx.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-lk1mMbgx.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./constants-CjTQhR-l.cjs");let n=require("@stryke/type-checks/is-set-object"),r=require("@stryke/type-checks/is-set-string"),i=require("@stryke/type-checks"),a=require("@stryke/path/find"),ee=require("@stryke/resolve/constants"),te=require("@stryke/helpers/get-unique"),o=require("defu");o=e.t(o,1);function ne(e,r){if(!r||!(0,n.isSetObject)(e))return e;let i={...e},a=i;for(let e of t.t){let t=r[e];t!=null&&(a[e]=t)}return i}function s(e){if(!(0,n.isSetObject)(e))return[];let t=e;return Array.isArray(t.type)?t.type.filter(e=>(0,r.isSetString)(e)):(0,r.isSetString)(t.type)&&t.type!==`object`&&t.type!==`array`?[t.type]:[]}function re(e){if((0,n.isSetObject)(e))return s(e).find(e=>e!==`null`)}function ie(e){return!(0,i.isString)(e)&&e.file!==void 0}const c=e=>typeof e==`number`&&Number.isFinite(e),ae=e=>(0,i.isSetObject)(e)||(0,i.isBoolean)(e),l=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>ae(e)),oe=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>(0,i.isBoolean)(e)),u=e=>Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)),se=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>u(e)),d=new Set(t.n),f=new Set(t.r);function ce(e){return(0,i.isSetString)(e)&&d.has(e)}function p(e){return(0,i.isSetString)(e)&&f.has(e)}const le=new Set([`date`,`time`,`date-time`,`iso-time`,`iso-date-time`,`unix-time`]),m=e=>typeof e==`bigint`,ue=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`function`,`object`,`any`,`array`]),de=e=>(0,i.isSetString)(e)&&ue.has(e),h=e=>{if(!(0,i.isSetObject)(e))return!1;let t=e;return!(t.type!==void 0&&!((0,i.isSetString)(t.type)&&de(t.type)||Array.isArray(t.type)&&t.type.every(e=>de(e)))||t.tsType!==void 0&&!(0,i.isSetString)(t.tsType)||t.markdownType!==void 0&&!(0,i.isSetString)(t.markdownType)||t.items!==void 0&&!(h(t.items)||Array.isArray(t.items)&&t.items.every(e=>h(e))))},fe=e=>{if(!h(e))return!1;let t=e;return t.name!==void 0&&!(0,i.isSetString)(t.name)?!1:t.optional===void 0||typeof t.optional==`boolean`},pe=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>J(e)),g=(e,t)=>Array.isArray(e)&&e.every(e=>t(e)),me=(e,t,n)=>Array.isArray(e)&&e.length===2&&t(e[0])&&n(e[1]),_=(e,t=!1)=>e===void 0||(0,i.isString)(e)&&(t||e.length>0),v=e=>e===void 0||(0,i.isBoolean)(e),y=e=>e===void 0||c(e),b=e=>e===void 0||m(e),x=e=>e===void 0||q(e),S=e=>e===void 0||g(e,q),he=e=>e===void 0||Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)&&d.has(e)),ge=e=>e===void 0||Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)&&f.has(e)),C=e=>!(!_(e.$id)||!_(e.$schema)||e.$vocabulary!==void 0&&!oe(e.$vocabulary)||!_(e.$comment,!0)||!_(e.$anchor)||e.$defs!==void 0&&!l(e.$defs)||!_(e.$dynamicRef)||!_(e.$dynamicAnchor)||!_(e.name)||!_(e.title,!0)||!_(e.description,!0)||!_(e.docs,!0)||e.examples!==void 0&&!Array.isArray(e.examples)||e.alias!==void 0&&!u(e.alias)||e.tags!==void 0&&!u(e.tags)||!v(e.deprecated)||!v(e.hidden)||!v(e.ignore)||!v(e.internal)||!v(e.runtime)||!v(e.readOnly)||!v(e.writeOnly)||!S(e.allOf)||!S(e.anyOf)||!S(e.oneOf)||!x(e.not)||!x(e.if)||!x(e.then)||!x(e.else));function _e(e){return(0,i.isSetObject)(e)?C(e):!1}function w(e){if(!(0,i.isSetObject)(e))return!1;let n=e;return C(n)&&_(n.$ref)&&(!n.type||Array.isArray(n.type)&&n.type.every(e=>t.n.includes(e)))}function ve(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`array`?!1:S(t.prefixItems)&&x(t.items)&&x(t.contains)&&y(t.minItems)&&y(t.maxItems)&&v(t.uniqueItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||q(t.unevaluatedItems))}function T(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`integer`||t.format!==`int64`?!1:b(t.minimum)&&b(t.exclusiveMinimum)&&b(t.maximum)&&b(t.exclusiveMaximum)&&b(t.multipleOf)&&b(t.default)&&(t.enum===void 0||g(t.enum,m))}function ye(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`boolean`&&v(t.default)}function E(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)?t.anyOf===void 0?t.type!==`integer`&&t.type!==`string`||!(0,i.isSetString)(t.format)||!le.has(t.format)?!1:y(t.minimum)&&y(t.maximum)&&(t.default===void 0||(0,i.isSetString)(t.default)||c(t.default)):g(t.anyOf,E):!1}function D(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t)||!(0,i.isSetString)(t.type)||!d.has(t.type)||!Array.isArray(t.enum))return!1;let n=t.type,r=t.enum,a=t.default;return n===`string`?r.every(e=>(0,i.isSetString)(e))&&(a===void 0||(0,i.isSetString)(a)):n===`number`||n===`integer`?r.every(e=>c(e))&&(a===void 0||c(a)):n===`boolean`?r.every(e=>(0,i.isBoolean)(e))&&(a===void 0||(0,i.isBoolean)(a)):n===`null`&&r.every(e=>e===null)&&a==null}function O(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||!g(t.allOf,q)?!1:t.unevaluatedProperties===void 0||(0,i.isBoolean)(t.unevaluatedProperties)||q(t.unevaluatedProperties)}function k(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||!(`const`in t)?!1:t.type===void 0||(0,i.isSetString)(t.type)&&p(t.type)||ge(t.type)}function A(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t)||t.type!==`array`||t.maxItems!==125||!(0,i.isSetObject)(t.items))return!1;let n=t.items;return n.type===`array`&&me(n.prefixItems,q,q)&&(n.items===void 0||n.items===!1)&&n.minItems===2&&n.maxItems===2}function j(e){if(!(0,i.isSetObject)(e))return!1;let t=e,n=t.type===`string`||t.type===`number`||Array.isArray(t.type)&&t.type.length===2&&t.type[0]===`string`&&t.type[1]===`number`;return C(t)&&n&&Array.isArray(t.enum)&&t.enum.every(e=>(0,i.isSetString)(e)||c(e))}function M(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&w(t.not)}function N(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`null`&&(t.const===void 0||t.const===null)&&(t.enum===void 0||Array.isArray(t.enum)&&t.enum.every(e=>e===null))&&(t.default===void 0||t.default===null)}function P(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t))return!1;let n=t.anyOf!==void 0&&Array.isArray(t.anyOf)&&t.anyOf.length===2&&q(t.anyOf[0])&&N(t.anyOf[1]),r=Array.isArray(t.type)&&t.type.length===2&&(t.type[0]===`null`&&(0,i.isSetString)(t.type[1])&&t.type[1]!==`null`&&f.has(t.type[1])||t.type[1]===`null`&&(0,i.isSetString)(t.type[0])&&t.type[0]!==`null`&&f.has(t.type[0]));return n||r}function F(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`number`&&t.type!==`integer`?!1:_(t.format)&&y(t.minimum)&&y(t.exclusiveMinimum)&&y(t.maximum)&&y(t.exclusiveMaximum)&&y(t.multipleOf)&&y(t.default)&&(t.enum===void 0||g(t.enum,c))}function I(e){return F(e)&&e.type===`integer`}function L(e){return F(e)&&e.type===`number`}function R(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`object`&&(t.properties===void 0||l(t.properties))&&(t.patternProperties===void 0||l(t.patternProperties))&&(t.additionalProperties===void 0||(0,i.isBoolean)(t.additionalProperties)||q(t.additionalProperties))&&(t.required===void 0||u(t.required))&&(t.unevaluatedProperties===void 0||(0,i.isBoolean)(t.unevaluatedProperties)||q(t.unevaluatedProperties))&&(t.dependencies===void 0||(0,i.isSetObject)(t.dependencies)&&Object.values(t.dependencies).every(e=>u(e)||q(e)))&&(t.dependentRequired===void 0||se(t.dependentRequired))&&(t.dependentSchemas===void 0||l(t.dependentSchemas))&&y(t.minProperties)&&y(t.maxProperties)&&(t.primaryKey===void 0||u(t.primaryKey))&&_(t.databaseSchema)}function z(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`string`&&y(t.minLength)&&y(t.maxLength)&&_(t.pattern)&&_(t.format)&&_(t.default)&&(t.enum===void 0||g(t.enum,i.isSetString))&&_(t.contentMediaType)&&_(t.contentEncoding)&&_(t.contentSchema)}function B(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`array`&&t.uniqueItems===!0&&S(t.prefixItems)&&x(t.items)&&x(t.contains)&&y(t.minItems)&&y(t.maxItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||q(t.unevaluatedItems))}function V(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`object`&&(t.patternProperties===void 0||l(t.patternProperties))&&(t.additionalProperties===void 0||(0,i.isBoolean)(t.additionalProperties)||q(t.additionalProperties))&&x(t.propertyNames)}function H(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`array`&&g(t.prefixItems,q)&&y(t.minItems)&&y(t.maxItems)&&x(t.items)&&x(t.contains)&&v(t.uniqueItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||q(t.unevaluatedItems))}function U(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&w(t.not)&&(t.default===void 0||t.default===void 0)}function W(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)?(0,i.isSetString)(t.type)&&d.has(t.type)?t.enum===void 0?!0:Array.isArray(t.enum)?t.type===`string`?t.enum.every(e=>(0,i.isSetString)(e))&&(t.default===void 0||(0,i.isSetString)(t.default)):t.type===`number`?t.enum.every(e=>c(e))&&(t.default===void 0||c(t.default)):t.type===`boolean`?t.enum.every(e=>(0,i.isBoolean)(e))&&(t.default===void 0||(0,i.isBoolean)(t.default)):t.type===`integer`?t.format===`int64`&&t.enum.every(e=>m(e))&&(t.default===void 0||m(t.default)):t.type===`null`&&t.enum.every(e=>e===null)&&(t.default===void 0||t.default===null):!1:he(t.type)&&t.type!==void 0:!1}function G(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&(W(t)||xe(t))}function be(e){return w(e)}function xe(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&g(t.anyOf,q)}function Se(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&(0,i.isSetString)(t.$ref)}function K(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!(0,i.isSetObject)(t[`~standard`]))return!1;let n=t[`~standard`];return n.version===1&&(0,i.isFunction)(n.validate)}function Ce(e){if(!(0,i.isSetObject)(e)||!K(e))return!1;let t=e;return t.kind===`schema`&&(0,i.isSetString)(t.type)&&(0,i.isBoolean)(t.async)&&(0,i.isFunction)(t.reference)&&(0,i.isSetString)(t.expects)&&(0,i.isFunction)(t[`~run`])}function q(e){return z(e)||I(e)||L(e)||T(e)||ye(e)||E(e)||D(e)||k(e)||j(e)||N(e)||ve(e)||R(e)||V(e)||H(e)||G(e)||U(e)||Se(e)||M(e)||A(e)||w(e)||P(e)||O(e)||be(e)||B(e)}function we(e){return N(e)}function J(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!(!h(t)||`id`in t&&!(0,i.isSetString)(t.id)||`resolve`in t&&!(0,i.isFunction)(t.resolve)||`properties`in t&&!pe(t.properties)||`required`in t&&!u(t.required)||`title`in t&&!(0,i.isSetString)(t.title)||`description`in t&&!(0,i.isSetString)(t.description)||`$schema`in t&&!(0,i.isSetString)(t.$schema)||`tags`in t&&!u(t.tags)||`args`in t&&(!Array.isArray(t.args)||!t.args.every(e=>fe(e)))||`returns`in t&&!h(t.returns))}function Te(e){return J(e)&&!q(e)}function Ee(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!(`$schema`in t&&!J(t.$schema)||`$resolve`in t&&!(0,i.isFunction)(t.$resolve))}function De(e){if(!Ee(e)||q(e))return!1;let t=e;return!(`$schema`in t&&t.$schema!==void 0&&!Te(t.$schema))}function Y(e){return(0,i.isSetObject)(e)&&`schema`in e&&q(e.schema)&&`variant`in e&&(0,i.isSetString)(e.variant)&&`hash`in e&&(0,i.isSetString)(e.hash)}function Oe(e){return Y(e)}function ke(e){return Y(e)&&`source`in e&&(0,i.isSetObject)(e.source)&&`schema`in e.source&&`variant`in e.source&&(0,i.isSetString)(e.source.variant)}function Ae(e){return Y(e)&&R(e.schema)}function X(e){let t=Y(e)?e.schema:e;if(!q(t))throw TypeError(`The provided input is not a valid JSON Schema`);return t}function Z(e){let t=X(e);if(!R(t))throw TypeError(`The provided input is not a valid JSON Schema object`);return t}function je(e){let t=Z(e);return(0,i.isSetObject)(t.properties)?Object.entries(t.properties).reduce((e,[n,r])=>(r.name=n,r.required=!$(t,n),r.default=t.default?.[n]??r.default,e[n]=r,e),{}):{}}function Me(e){return Object.values(je(e))}function Ne(e,t){let n=Z(e);if(!(0,i.isSetObject)(n.properties))throw TypeError(`The provided schema does not have any properties`);let r=n.properties[t];if(!r)throw TypeError(`The provided schema does not have a property named "${t}"`);return{...r,name:t,required:!$(n,t),default:n.default?.[t]??r?.default}}function Pe(e,t,n){let r=Z(e);r.properties??={},r.required??=[],n.name=t,r.properties[t]=n,r.required.includes(t)||r.required.push(t),r.required.length===0&&delete r.required}function Q(e,n){let r={...e};for(let[e,a]of Object.entries(n)){let n=r[e];if(e===`required`)r[e]=(0,te.getUnique)([...Array.isArray(n)?n:[],...Array.isArray(a)?a:[]]);else if(t.o.has(e)&&(0,i.isSetObject)(n)&&(0,i.isSetObject)(a)){let t={...n};for(let[e,n]of Object.entries(a)){let r=t[e];t[e]=q(r)&&q(n)?Q(r,n):n}r[e]=t}else t.a.has(e)&&Array.isArray(n)&&Array.isArray(a)?r[e]=[...n,...a]:t.s.has(e)&&q(n)&&q(a)?r[e]=Q(n,a):r[e]=a}return r}function Fe(...e){let t=e.map(e=>X(e));return t.length===0?{}:t.reduce((e,t)=>{let n=e.type,r=t.type;return n&&r&&n!==r?t:Q(e,t)})}function Ie(e,n){return(0,o.default)(e,Object.fromEntries(t.t.filter(e=>n[e]!==void 0).map(e=>[e,n[e]])))}function Le(e){return(0,i.isSetObject)(e)?e.nullable===!0||s(e).includes(`null`):!1}function $(e,t){if(!e.properties?.[t])throw Error(`The property "${t}" does not exist in the parent schema.`);return!(e.required??[]).includes(t)}function Re(e){return ee.VALID_OBJECT_SOURCE_EXTENSIONS.includes((0,a.findFileExtensionSafe)(e))}function ze(e,t){let n=[];function r(e){let i=t(e);if(i!==void 0&&n.push(i),R(e))for(let t of Object.values(e.properties??{}))r(t);for(let t of[`allOf`,`anyOf`,`oneOf`,`not`,`if`,`then`,`else`,`$ref`,`items`,`additionalProperties`,`unevaluatedProperties`,`propertyNames`,`unevaluatedItems`,`contains`]){let n=e[t];if(Array.isArray(n))for(let e of n)q(e)&&r(e);else q(n)&&r(n)}}return r(e),n}Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return z}});
|