@powerlines/schema 0.11.45 → 0.11.47
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/bundle.cjs +1 -1
- package/dist/bundle.d.cts +1 -1
- package/dist/bundle.d.mts +1 -1
- package/dist/bundle.mjs +1 -1
- package/dist/bundle.mjs.map +1 -1
- package/dist/codegen.cjs +28 -22
- package/dist/codegen.d.cts +11 -11
- package/dist/codegen.d.cts.map +1 -1
- package/dist/codegen.d.mts +11 -11
- package/dist/codegen.d.mts.map +1 -1
- package/dist/codegen.mjs +36 -30
- package/dist/codegen.mjs.map +1 -1
- package/dist/constants.cjs +15 -11
- package/dist/constants.d.cts +4 -3
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +4 -3
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +13 -10
- package/dist/constants.mjs.map +1 -1
- package/dist/extract.cjs +158 -20
- package/dist/extract.d.cts +55 -16
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts +55 -16
- package/dist/extract.d.mts.map +1 -1
- package/dist/extract.mjs +158 -22
- package/dist/extract.mjs.map +1 -1
- package/dist/helpers.cjs +43 -8
- package/dist/helpers.d.cts +40 -6
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +40 -6
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +43 -10
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +39 -7
- package/dist/index.d.cts +8 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +7 -7
- package/dist/metadata.cjs +9 -35
- package/dist/metadata.d.cts +5 -26
- package/dist/metadata.d.cts.map +1 -1
- package/dist/metadata.d.mts +5 -26
- package/dist/metadata.d.mts.map +1 -1
- package/dist/metadata.mjs +9 -33
- package/dist/metadata.mjs.map +1 -1
- package/dist/persistence.d.cts +4 -4
- package/dist/persistence.d.cts.map +1 -1
- package/dist/persistence.d.mts +4 -4
- package/dist/persistence.d.mts.map +1 -1
- package/dist/persistence.mjs.map +1 -1
- package/dist/reflection.cjs +72 -50
- package/dist/reflection.d.cts +1 -1
- package/dist/reflection.d.cts.map +1 -1
- package/dist/reflection.d.mts +1 -1
- package/dist/reflection.d.mts.map +1 -1
- package/dist/reflection.mjs +74 -52
- package/dist/reflection.mjs.map +1 -1
- package/dist/type-checks.cjs +363 -83
- package/dist/type-checks.d.cts +138 -16
- package/dist/type-checks.d.cts.map +1 -1
- package/dist/type-checks.d.mts +138 -16
- package/dist/type-checks.d.mts.map +1 -1
- package/dist/type-checks.mjs +336 -85
- package/dist/type-checks.mjs.map +1 -1
- package/dist/types.d.cts +977 -175
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +977 -175
- package/dist/types.d.mts.map +1 -1
- package/dist/validate.mjs.map +1 -1
- package/package.json +5 -5
package/dist/type-checks.mjs
CHANGED
|
@@ -1,64 +1,338 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isFunction,
|
|
3
|
-
import { isJsonSchemaObjectType } from "@stryke/json";
|
|
1
|
+
import { JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES } from "./constants.mjs";
|
|
2
|
+
import { isFunction, isSetObject, isSetString } from "@stryke/type-checks";
|
|
4
3
|
|
|
5
4
|
//#region src/type-checks.ts
|
|
6
|
-
const JSON_SCHEMA_DATA_TYPE_SET = new Set(JSON_SCHEMA_DATA_TYPES);
|
|
7
5
|
const isSetNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
8
6
|
const isSetBoolean = (value) => typeof value === "boolean";
|
|
9
|
-
const isNonNegativeInteger = (value) => Number.isInteger(value) && value >= 0;
|
|
10
7
|
const isSchemaLikeValue = (value) => isSetObject(value) || isSetBoolean(value);
|
|
8
|
+
const isRecordOfSchemaLike = (value) => isSetObject(value) && Object.values(value).every((item) => isSchemaLikeValue(item));
|
|
9
|
+
const isVocabularyMap = (value) => isSetObject(value) && Object.values(value).every((item) => isSetBoolean(item));
|
|
11
10
|
const isStringArray = (value) => Array.isArray(value) && value.every((item) => isSetString(item));
|
|
12
11
|
const isRecordOfStringArrays = (value) => isSetObject(value) && Object.values(value).every((item) => isStringArray(item));
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
12
|
+
const JSON_SCHEMA_PRIMITIVE_TYPE_SET = new Set(JSON_SCHEMA_PRIMITIVE_TYPES);
|
|
13
|
+
const JSON_SCHEMA_TYPE_SET = new Set(JSON_SCHEMA_TYPES);
|
|
14
|
+
/**
|
|
15
|
+
* A helper type guard to check if a value is a JSON Schema primitive type.
|
|
16
|
+
*
|
|
17
|
+
* @param value - The value to check.
|
|
18
|
+
* @returns True if the value is a JSON Schema primitive type, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
function isJsonSchemaPrimitiveType(value) {
|
|
21
|
+
return isSetString(value) && JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(value);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A helper type guard to check if a value is a JSON Schema type.
|
|
25
|
+
*
|
|
26
|
+
* @param value - The value to check.
|
|
27
|
+
* @returns True if the value is a JSON Schema type, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
function isJsonSchemaType(value) {
|
|
30
|
+
return isSetString(value) && JSON_SCHEMA_TYPE_SET.has(value);
|
|
31
|
+
}
|
|
32
|
+
const DATE_FORMAT_SET = new Set([
|
|
33
|
+
"date",
|
|
34
|
+
"time",
|
|
35
|
+
"date-time",
|
|
36
|
+
"iso-time",
|
|
37
|
+
"iso-date-time",
|
|
38
|
+
"unix-time"
|
|
39
|
+
]);
|
|
40
|
+
const isSetBigint = (value) => typeof value === "bigint";
|
|
41
|
+
const isArrayOf = (value, predicate) => Array.isArray(value) && value.every((item) => predicate(item));
|
|
42
|
+
const isTupleOfTwo = (value, aPredicate, bPredicate) => Array.isArray(value) && value.length === 2 && aPredicate(value[0]) && bPredicate(value[1]);
|
|
43
|
+
const isOptionalString = (value) => value === void 0 || isSetString(value);
|
|
44
|
+
const isOptionalBoolean = (value) => value === void 0 || isSetBoolean(value);
|
|
45
|
+
const isOptionalNumber = (value) => value === void 0 || isSetNumber(value);
|
|
46
|
+
const isOptionalBigint = (value) => value === void 0 || isSetBigint(value);
|
|
47
|
+
const isOptionalJsonSchema = (value) => value === void 0 || isJsonSchema(value);
|
|
48
|
+
const isOptionalJsonSchemaArray = (value) => value === void 0 || isArrayOf(value, isJsonSchema);
|
|
49
|
+
const isOptionalPrimitiveTypeArray = (value) => value === void 0 || Array.isArray(value) && value.every((item) => isSetString(item) && JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(item));
|
|
50
|
+
const isOptionalJsonSchemaTypeArray = (value) => value === void 0 || Array.isArray(value) && value.every((item) => isSetString(item) && JSON_SCHEMA_TYPE_SET.has(item));
|
|
51
|
+
const hasValidJsonSchemaKeywords = (schema) => {
|
|
52
|
+
if (!isOptionalString(schema.$id)) return false;
|
|
53
|
+
if (!isOptionalString(schema.$schema)) return false;
|
|
54
|
+
if (schema.$vocabulary !== void 0 && !isVocabularyMap(schema.$vocabulary)) return false;
|
|
55
|
+
if (!isOptionalString(schema.$comment)) return false;
|
|
56
|
+
if (!isOptionalString(schema.$anchor)) return false;
|
|
57
|
+
if (schema.$defs !== void 0 && !isRecordOfSchemaLike(schema.$defs)) return false;
|
|
58
|
+
if (!isOptionalString(schema.$dynamicRef)) return false;
|
|
59
|
+
if (!isOptionalString(schema.$dynamicAnchor)) return false;
|
|
60
|
+
if (!isOptionalString(schema.name)) return false;
|
|
61
|
+
if (!isOptionalString(schema.title)) return false;
|
|
62
|
+
if (!isOptionalString(schema.description)) return false;
|
|
63
|
+
if (!isOptionalString(schema.docs)) return false;
|
|
64
|
+
if (schema.examples !== void 0 && !Array.isArray(schema.examples)) return false;
|
|
65
|
+
if (schema.alias !== void 0 && !isStringArray(schema.alias)) return false;
|
|
66
|
+
if (schema.tags !== void 0 && !isStringArray(schema.tags)) return false;
|
|
67
|
+
if (!isOptionalBoolean(schema.deprecated)) return false;
|
|
68
|
+
if (!isOptionalBoolean(schema.hidden)) return false;
|
|
69
|
+
if (!isOptionalBoolean(schema.ignore)) return false;
|
|
70
|
+
if (!isOptionalBoolean(schema.internal)) return false;
|
|
71
|
+
if (!isOptionalBoolean(schema.runtime)) return false;
|
|
72
|
+
if (!isOptionalBoolean(schema.readOnly)) return false;
|
|
73
|
+
if (!isOptionalBoolean(schema.writeOnly)) return false;
|
|
74
|
+
if (!isOptionalJsonSchemaArray(schema.allOf)) return false;
|
|
75
|
+
if (!isOptionalJsonSchemaArray(schema.anyOf)) return false;
|
|
76
|
+
if (!isOptionalJsonSchemaArray(schema.oneOf)) return false;
|
|
77
|
+
if (!isOptionalJsonSchema(schema.not)) return false;
|
|
78
|
+
if (!isOptionalJsonSchema(schema.if)) return false;
|
|
79
|
+
if (!isOptionalJsonSchema(schema.then)) return false;
|
|
80
|
+
if (!isOptionalJsonSchema(schema.else)) return false;
|
|
81
|
+
return true;
|
|
60
82
|
};
|
|
61
83
|
/**
|
|
84
|
+
* Type guard for shared JSON Schema keyword groups.
|
|
85
|
+
*/
|
|
86
|
+
function isJsonSchemaKeywords(input) {
|
|
87
|
+
if (!isSetObject(input)) return false;
|
|
88
|
+
return hasValidJsonSchemaKeywords(input);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Type guard for generic JSON Schema objects with optional `$ref`.
|
|
92
|
+
*/
|
|
93
|
+
function isJsonSchemaAny(input) {
|
|
94
|
+
if (!isSetObject(input)) return false;
|
|
95
|
+
const schema = input;
|
|
96
|
+
return hasValidJsonSchemaKeywords(schema) && isOptionalString(schema.$ref);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Type guard for JSON Schema array types.
|
|
100
|
+
*/
|
|
101
|
+
function isJsonSchemaArray(input) {
|
|
102
|
+
if (!isSetObject(input)) return false;
|
|
103
|
+
const schema = input;
|
|
104
|
+
if (!hasValidJsonSchemaKeywords(schema) || schema.type !== "array") return false;
|
|
105
|
+
return isOptionalJsonSchemaArray(schema.prefixItems) && isOptionalJsonSchema(schema.items) && isOptionalJsonSchema(schema.contains) && isOptionalNumber(schema.minItems) && isOptionalNumber(schema.maxItems) && isOptionalBoolean(schema.uniqueItems) && isOptionalNumber(schema.minContains) && isOptionalNumber(schema.maxContains) && (schema.unevaluatedItems === void 0 || isSetBoolean(schema.unevaluatedItems) || isJsonSchema(schema.unevaluatedItems));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Type guard for bigint-backed integer schemas.
|
|
109
|
+
*/
|
|
110
|
+
function isJsonSchemaBigint(input) {
|
|
111
|
+
if (!isSetObject(input)) return false;
|
|
112
|
+
const schema = input;
|
|
113
|
+
if (!hasValidJsonSchemaKeywords(schema) || schema.type !== "integer" || schema.format !== "int64") return false;
|
|
114
|
+
return isOptionalBigint(schema.minimum) && isOptionalBigint(schema.exclusiveMinimum) && isOptionalBigint(schema.maximum) && isOptionalBigint(schema.exclusiveMaximum) && isOptionalBigint(schema.multipleOf) && isOptionalBigint(schema.default) && (schema.enum === void 0 || isArrayOf(schema.enum, isSetBigint));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Type guard for boolean schemas.
|
|
118
|
+
*/
|
|
119
|
+
function isJsonSchemaBoolean(input) {
|
|
120
|
+
if (!isSetObject(input)) return false;
|
|
121
|
+
const schema = input;
|
|
122
|
+
return hasValidJsonSchemaKeywords(schema) && schema.type === "boolean" && isOptionalBoolean(schema.default);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Type guard for date/time schemas.
|
|
126
|
+
*/
|
|
127
|
+
function isJsonSchemaDate(input) {
|
|
128
|
+
if (!isSetObject(input)) return false;
|
|
129
|
+
const schema = input;
|
|
130
|
+
if (!hasValidJsonSchemaKeywords(schema)) return false;
|
|
131
|
+
if (schema.anyOf !== void 0) return isArrayOf(schema.anyOf, isJsonSchemaDate);
|
|
132
|
+
if (schema.type !== "integer" && schema.type !== "string") return false;
|
|
133
|
+
if (!isSetString(schema.format) || !DATE_FORMAT_SET.has(schema.format)) return false;
|
|
134
|
+
return isOptionalNumber(schema.minimum) && isOptionalNumber(schema.maximum) && (schema.default === void 0 || isSetString(schema.default) || isSetNumber(schema.default));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Type guard for enum-constrained schemas.
|
|
138
|
+
*/
|
|
139
|
+
function isJsonSchemaEnum(input) {
|
|
140
|
+
if (!isSetObject(input)) return false;
|
|
141
|
+
const schema = input;
|
|
142
|
+
if (!hasValidJsonSchemaKeywords(schema) || !isSetString(schema.type) || !JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(schema.type) || !Array.isArray(schema.enum)) return false;
|
|
143
|
+
const typeName = schema.type;
|
|
144
|
+
const enumValues = schema.enum;
|
|
145
|
+
const defaultValue = schema.default;
|
|
146
|
+
if (typeName === "string") return enumValues.every((value) => isSetString(value)) && (defaultValue === void 0 || isSetString(defaultValue));
|
|
147
|
+
if (typeName === "number" || typeName === "integer") return enumValues.every((value) => isSetNumber(value)) && (defaultValue === void 0 || isSetNumber(defaultValue));
|
|
148
|
+
if (typeName === "boolean") return enumValues.every((value) => isSetBoolean(value)) && (defaultValue === void 0 || isSetBoolean(defaultValue));
|
|
149
|
+
return typeName === "null" && enumValues.every((value) => value === null) && (defaultValue === void 0 || defaultValue === null);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Type guard for `allOf` composition schemas.
|
|
153
|
+
*/
|
|
154
|
+
function isJsonSchemaAllOf(input) {
|
|
155
|
+
if (!isSetObject(input)) return false;
|
|
156
|
+
const schema = input;
|
|
157
|
+
if (!hasValidJsonSchemaKeywords(schema) || !isArrayOf(schema.allOf, isJsonSchema)) return false;
|
|
158
|
+
return schema.unevaluatedProperties === void 0 || isSetBoolean(schema.unevaluatedProperties) || isJsonSchema(schema.unevaluatedProperties);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Type guard for literal-value schemas.
|
|
162
|
+
*/
|
|
163
|
+
function isJsonSchemaLiteral(input) {
|
|
164
|
+
if (!isSetObject(input)) return false;
|
|
165
|
+
const schema = input;
|
|
166
|
+
if (!hasValidJsonSchemaKeywords(schema) || !("const" in schema)) return false;
|
|
167
|
+
return schema.type === void 0 || isSetString(schema.type) && isJsonSchemaType(schema.type) || isOptionalJsonSchemaTypeArray(schema.type);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Type guard for map tuple-array schemas.
|
|
171
|
+
*/
|
|
172
|
+
function isJsonSchemaMap(input) {
|
|
173
|
+
if (!isSetObject(input)) return false;
|
|
174
|
+
const schema = input;
|
|
175
|
+
if (!hasValidJsonSchemaKeywords(schema) || schema.type !== "array" || schema.maxItems !== 125 || !isSetObject(schema.items)) return false;
|
|
176
|
+
const items = schema.items;
|
|
177
|
+
return items.type === "array" && isTupleOfTwo(items.prefixItems, isJsonSchema, isJsonSchema) && (items.items === void 0 || items.items === false) && items.minItems === 2 && items.maxItems === 2;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Type guard for native enum schemas.
|
|
181
|
+
*/
|
|
182
|
+
function isJsonSchemaNativeEnum(input) {
|
|
183
|
+
if (!isSetObject(input)) return false;
|
|
184
|
+
const schema = input;
|
|
185
|
+
const isValidType = schema.type === "string" || schema.type === "number" || Array.isArray(schema.type) && schema.type.length === 2 && schema.type[0] === "string" && schema.type[1] === "number";
|
|
186
|
+
return hasValidJsonSchemaKeywords(schema) && isValidType && Array.isArray(schema.enum) && schema.enum.every((value) => isSetString(value) || isSetNumber(value));
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Type guard for impossible/never schemas.
|
|
190
|
+
*/
|
|
191
|
+
function isJsonSchemaNever(input) {
|
|
192
|
+
if (!isSetObject(input)) return false;
|
|
193
|
+
const schema = input;
|
|
194
|
+
return hasValidJsonSchemaKeywords(schema) && isJsonSchemaAny(schema.not);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Type guard for `null` schemas.
|
|
198
|
+
*/
|
|
199
|
+
function isJsonSchemaNull(input) {
|
|
200
|
+
if (!isSetObject(input)) return false;
|
|
201
|
+
const schema = input;
|
|
202
|
+
return hasValidJsonSchemaKeywords(schema) && schema.type === "null" && (schema.const === void 0 || schema.const === null) && (schema.enum === void 0 || Array.isArray(schema.enum) && schema.enum.every((v) => v === null)) && (schema.default === void 0 || schema.default === null);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Type guard for nullable schema unions.
|
|
206
|
+
*/
|
|
207
|
+
function isJsonSchemaNullable(input) {
|
|
208
|
+
if (!isSetObject(input)) return false;
|
|
209
|
+
const schema = input;
|
|
210
|
+
if (!hasValidJsonSchemaKeywords(schema)) return false;
|
|
211
|
+
const anyOfBranch = schema.anyOf !== void 0 && Array.isArray(schema.anyOf) && schema.anyOf.length === 2 && isJsonSchema(schema.anyOf[0]) && isJsonSchemaNull(schema.anyOf[1]);
|
|
212
|
+
const typeBranch = Array.isArray(schema.type) && schema.type.length === 2 && (schema.type[0] === "null" && isSetString(schema.type[1]) && schema.type[1] !== "null" && JSON_SCHEMA_TYPE_SET.has(schema.type[1]) || schema.type[1] === "null" && isSetString(schema.type[0]) && schema.type[0] !== "null" && JSON_SCHEMA_TYPE_SET.has(schema.type[0]));
|
|
213
|
+
return anyOfBranch || typeBranch;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Type guard for numeric schemas.
|
|
217
|
+
*/
|
|
218
|
+
function isJsonSchemaNumber(input) {
|
|
219
|
+
if (!isSetObject(input)) return false;
|
|
220
|
+
const schema = input;
|
|
221
|
+
if (!hasValidJsonSchemaKeywords(schema) || schema.type !== "number" && schema.type !== "integer") return false;
|
|
222
|
+
return isOptionalString(schema.format) && isOptionalNumber(schema.minimum) && isOptionalNumber(schema.exclusiveMinimum) && isOptionalNumber(schema.maximum) && isOptionalNumber(schema.exclusiveMaximum) && isOptionalNumber(schema.multipleOf) && isOptionalNumber(schema.default) && (schema.enum === void 0 || isArrayOf(schema.enum, isSetNumber));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Type guard for integer schemas.
|
|
226
|
+
*/
|
|
227
|
+
function isJsonSchemaInteger(input) {
|
|
228
|
+
return isJsonSchemaNumber(input) && input.type === "integer";
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Type guard for decimal schemas.
|
|
232
|
+
*/
|
|
233
|
+
function isJsonSchemaDecimal(input) {
|
|
234
|
+
return isJsonSchemaNumber(input) && input.type === "number";
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Type guard for object schemas.
|
|
238
|
+
*/
|
|
239
|
+
function isJsonSchemaObject(input) {
|
|
240
|
+
if (!isSetObject(input)) return false;
|
|
241
|
+
const schema = input;
|
|
242
|
+
return hasValidJsonSchemaKeywords(schema) && schema.type === "object" && (schema.properties === void 0 || isRecordOfSchemaLike(schema.properties)) && (schema.patternProperties === void 0 || isRecordOfSchemaLike(schema.patternProperties)) && (schema.additionalProperties === void 0 || isSetBoolean(schema.additionalProperties) || isJsonSchema(schema.additionalProperties)) && (schema.required === void 0 || isStringArray(schema.required)) && (schema.unevaluatedProperties === void 0 || isSetBoolean(schema.unevaluatedProperties) || isJsonSchema(schema.unevaluatedProperties)) && (schema.dependencies === void 0 || isSetObject(schema.dependencies) && Object.values(schema.dependencies).every((item) => isStringArray(item) || isJsonSchema(item))) && (schema.dependentRequired === void 0 || isRecordOfStringArrays(schema.dependentRequired)) && (schema.dependentSchemas === void 0 || isRecordOfSchemaLike(schema.dependentSchemas)) && isOptionalNumber(schema.minProperties) && isOptionalNumber(schema.maxProperties) && (schema.primaryKey === void 0 || isStringArray(schema.primaryKey)) && isOptionalString(schema.databaseSchema);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Type guard for string schemas.
|
|
246
|
+
*/
|
|
247
|
+
function isJsonSchemaString(input) {
|
|
248
|
+
if (!isSetObject(input)) return false;
|
|
249
|
+
const schema = input;
|
|
250
|
+
return hasValidJsonSchemaKeywords(schema) && schema.type === "string" && isOptionalNumber(schema.minLength) && isOptionalNumber(schema.maxLength) && isOptionalString(schema.pattern) && isOptionalString(schema.format) && isOptionalString(schema.default) && (schema.enum === void 0 || isArrayOf(schema.enum, isSetString)) && isOptionalString(schema.contentMediaType) && isOptionalString(schema.contentEncoding) && isOptionalString(schema.contentSchema);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Type guard for set-like array schemas.
|
|
254
|
+
*/
|
|
255
|
+
function isJsonSchemaSet(input) {
|
|
256
|
+
if (!isSetObject(input)) return false;
|
|
257
|
+
const schema = input;
|
|
258
|
+
return hasValidJsonSchemaKeywords(schema) && schema.type === "array" && schema.uniqueItems === true && isOptionalJsonSchemaArray(schema.prefixItems) && isOptionalJsonSchema(schema.items) && isOptionalJsonSchema(schema.contains) && isOptionalNumber(schema.minItems) && isOptionalNumber(schema.maxItems) && isOptionalNumber(schema.minContains) && isOptionalNumber(schema.maxContains) && (schema.unevaluatedItems === void 0 || isSetBoolean(schema.unevaluatedItems) || isJsonSchema(schema.unevaluatedItems));
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Type guard for record schemas.
|
|
262
|
+
*/
|
|
263
|
+
function isJsonSchemaRecord(input) {
|
|
264
|
+
if (!isSetObject(input)) return false;
|
|
265
|
+
const schema = input;
|
|
266
|
+
return hasValidJsonSchemaKeywords(schema) && schema.type === "object" && (schema.patternProperties === void 0 || isRecordOfSchemaLike(schema.patternProperties)) && (schema.additionalProperties === void 0 || isSetBoolean(schema.additionalProperties) || isJsonSchema(schema.additionalProperties)) && isOptionalJsonSchema(schema.propertyNames);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Type guard for tuple schemas.
|
|
270
|
+
*/
|
|
271
|
+
function isJsonSchemaTuple(input) {
|
|
272
|
+
if (!isSetObject(input)) return false;
|
|
273
|
+
const schema = input;
|
|
274
|
+
return hasValidJsonSchemaKeywords(schema) && schema.type === "array" && isArrayOf(schema.prefixItems, isJsonSchema) && isOptionalNumber(schema.minItems) && isOptionalNumber(schema.maxItems) && isOptionalJsonSchema(schema.items) && isOptionalJsonSchema(schema.contains) && isOptionalBoolean(schema.uniqueItems) && isOptionalNumber(schema.minContains) && isOptionalNumber(schema.maxContains) && (schema.unevaluatedItems === void 0 || isSetBoolean(schema.unevaluatedItems) || isJsonSchema(schema.unevaluatedItems));
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Type guard for undefined-representing schemas.
|
|
278
|
+
*/
|
|
279
|
+
function isJsonSchemaUndefined(input) {
|
|
280
|
+
if (!isSetObject(input)) return false;
|
|
281
|
+
const schema = input;
|
|
282
|
+
return hasValidJsonSchemaKeywords(schema) && isJsonSchemaAny(schema.not) && (schema.default === void 0 || schema.default === void 0);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Type guard for primitive-union schema variants.
|
|
286
|
+
*/
|
|
287
|
+
function isJsonSchemaPrimitiveUnion(input) {
|
|
288
|
+
if (!isSetObject(input)) return false;
|
|
289
|
+
const schema = input;
|
|
290
|
+
if (!hasValidJsonSchemaKeywords(schema)) return false;
|
|
291
|
+
if (isSetString(schema.type) && JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(schema.type)) {
|
|
292
|
+
if (schema.enum === void 0) return true;
|
|
293
|
+
if (!Array.isArray(schema.enum)) return false;
|
|
294
|
+
if (schema.type === "string") return schema.enum.every((value) => isSetString(value)) && (schema.default === void 0 || isSetString(schema.default));
|
|
295
|
+
if (schema.type === "number") return schema.enum.every((value) => isSetNumber(value)) && (schema.default === void 0 || isSetNumber(schema.default));
|
|
296
|
+
if (schema.type === "boolean") return schema.enum.every((value) => isSetBoolean(value)) && (schema.default === void 0 || isSetBoolean(schema.default));
|
|
297
|
+
if (schema.type === "integer") {
|
|
298
|
+
if (schema.format !== "int64") return false;
|
|
299
|
+
return schema.enum.every((value) => isSetBigint(value)) && (schema.default === void 0 || isSetBigint(schema.default));
|
|
300
|
+
}
|
|
301
|
+
return schema.type === "null" && schema.enum.every((value) => value === null) && (schema.default === void 0 || schema.default === null);
|
|
302
|
+
}
|
|
303
|
+
return isOptionalPrimitiveTypeArray(schema.type) && schema.type !== void 0;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Type guard for union schemas.
|
|
307
|
+
*/
|
|
308
|
+
function isJsonSchemaUnion(input) {
|
|
309
|
+
if (!isSetObject(input)) return false;
|
|
310
|
+
const schema = input;
|
|
311
|
+
return hasValidJsonSchemaKeywords(schema) && (isJsonSchemaPrimitiveUnion(schema) || isJsonSchemaAnyOf(schema));
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Type guard for permissive unknown schemas.
|
|
315
|
+
*/
|
|
316
|
+
function isJsonSchemaUnknown(input) {
|
|
317
|
+
return isJsonSchemaAny(input);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Type guard for `anyOf` composition schemas.
|
|
321
|
+
*/
|
|
322
|
+
function isJsonSchemaAnyOf(input) {
|
|
323
|
+
if (!isSetObject(input)) return false;
|
|
324
|
+
const schema = input;
|
|
325
|
+
return hasValidJsonSchemaKeywords(schema) && isArrayOf(schema.anyOf, isJsonSchema);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Type guard for reference schemas.
|
|
329
|
+
*/
|
|
330
|
+
function isJsonSchemaRef(input) {
|
|
331
|
+
if (!isSetObject(input)) return false;
|
|
332
|
+
const schema = input;
|
|
333
|
+
return hasValidJsonSchemaKeywords(schema) && isSetString(schema.$ref);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
62
336
|
* Type guard for Standard Schema V1 objects.
|
|
63
337
|
*
|
|
64
338
|
* @param input - The value to check.
|
|
@@ -92,36 +366,7 @@ function isValibotSchema(input) {
|
|
|
92
366
|
* @returns True if the input is a JSON Schema type, false otherwise.
|
|
93
367
|
*/
|
|
94
368
|
function isJsonSchema(input) {
|
|
95
|
-
|
|
96
|
-
const schema = input;
|
|
97
|
-
if ("$ref" in schema && isSetString(schema.$ref)) return true;
|
|
98
|
-
if (!("type" in schema)) return false;
|
|
99
|
-
const schemaTypes = [];
|
|
100
|
-
if (isSetString(schema.type)) {
|
|
101
|
-
if (!JSON_SCHEMA_DATA_TYPE_SET.has(schema.type)) return false;
|
|
102
|
-
schemaTypes.push(schema.type);
|
|
103
|
-
} else if (Array.isArray(schema.type) && schema.type.length > 0) {
|
|
104
|
-
if (!schema.type.every((schemaType) => isSetString(schemaType) && JSON_SCHEMA_DATA_TYPE_SET.has(schemaType)) || new Set(schema.type).size !== schema.type.length) return false;
|
|
105
|
-
schemaTypes.push(...schema.type);
|
|
106
|
-
} else return false;
|
|
107
|
-
const typeKeywordValidators = schemaTypes.flatMap((schemaType) => Object.entries(TYPE_KEYWORD_VALIDATORS[schemaType]));
|
|
108
|
-
for (const [keyword, validator] of typeKeywordValidators) if (keyword in schema && !validator(schema[keyword])) return false;
|
|
109
|
-
if ("minItems" in schema && "maxItems" in schema && isNonNegativeInteger(schema.minItems) && isNonNegativeInteger(schema.maxItems) && schema.minItems > schema.maxItems) return false;
|
|
110
|
-
if ("minLength" in schema && "maxLength" in schema && isNonNegativeInteger(schema.minLength) && isNonNegativeInteger(schema.maxLength) && schema.minLength > schema.maxLength) return false;
|
|
111
|
-
if ("minProperties" in schema && "maxProperties" in schema && isNonNegativeInteger(schema.minProperties) && isNonNegativeInteger(schema.maxProperties) && schema.minProperties > schema.maxProperties) return false;
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Type guard for JSON Schema object forms.
|
|
116
|
-
*
|
|
117
|
-
* @remarks
|
|
118
|
-
* This function checks if the input is a JSON Schema object type, which is defined as having a `type` property equal to "object" or having a `properties` object. This is used to determine if a given input conforms to the structure of a JSON Schema object definition.
|
|
119
|
-
*
|
|
120
|
-
* @param input - The value to check.
|
|
121
|
-
* @returns True if the input is a JSON Schema object type, false otherwise.
|
|
122
|
-
*/
|
|
123
|
-
function isJsonSchemaObject(input) {
|
|
124
|
-
return isJsonSchemaObjectType(input) && (input.type === "object" || isObject(input.properties));
|
|
369
|
+
return isJsonSchemaString(input) || isJsonSchemaInteger(input) || isJsonSchemaDecimal(input) || isJsonSchemaBigint(input) || isJsonSchemaBoolean(input) || isJsonSchemaDate(input) || isJsonSchemaEnum(input) || isJsonSchemaLiteral(input) || isJsonSchemaNativeEnum(input) || isJsonSchemaNull(input) || isJsonSchemaArray(input) || isJsonSchemaObject(input) || isJsonSchemaRecord(input) || isJsonSchemaTuple(input) || isJsonSchemaUnion(input) || isJsonSchemaUndefined(input) || isJsonSchemaRef(input) || isJsonSchemaNever(input) || isJsonSchemaMap(input) || isJsonSchemaAny(input) || isJsonSchemaNullable(input) || isJsonSchemaAllOf(input) || isJsonSchemaUnknown(input) || isJsonSchemaSet(input);
|
|
125
370
|
}
|
|
126
371
|
/**
|
|
127
372
|
* Type guard for JSON Schemas that only accept `null`.
|
|
@@ -133,7 +378,7 @@ function isJsonSchemaObject(input) {
|
|
|
133
378
|
* @returns True if the input is a JSON Schema that only accepts `null`, false otherwise.
|
|
134
379
|
*/
|
|
135
380
|
function isNullOnlyJsonSchema(input) {
|
|
136
|
-
return
|
|
381
|
+
return isJsonSchemaNull(input);
|
|
137
382
|
}
|
|
138
383
|
/**
|
|
139
384
|
* Type guard for untyped schema objects.
|
|
@@ -186,10 +431,16 @@ function isUntypedInput(input) {
|
|
|
186
431
|
function isSchema(input) {
|
|
187
432
|
return isSetObject(input) && "schema" in input && isJsonSchema(input.schema) && "variant" in input && isSetString(input.variant) && "hash" in input && isSetString(input.hash);
|
|
188
433
|
}
|
|
189
|
-
|
|
434
|
+
/**
|
|
435
|
+
* Type guard for extracted schema objects that include source information.
|
|
436
|
+
*
|
|
437
|
+
* @param input - The value to check.
|
|
438
|
+
* @returns True if the input is a SchemaWithSource object, false otherwise.
|
|
439
|
+
*/
|
|
440
|
+
function isSchemaWithSource(input) {
|
|
190
441
|
return isSchema(input) && "source" in input && isSetObject(input.source) && "schema" in input.source && "variant" in input.source && isSetString(input.source.variant);
|
|
191
442
|
}
|
|
192
443
|
|
|
193
444
|
//#endregion
|
|
194
|
-
export {
|
|
445
|
+
export { isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isSchema, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedSchema, isValibotSchema };
|
|
195
446
|
//# sourceMappingURL=type-checks.mjs.map
|
package/dist/type-checks.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../src/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { isJsonSchemaObjectType } from \"@stryke/json\";\nimport {\n isFunction,\n isObject,\n isSetObject,\n isSetString\n} from \"@stryke/type-checks\";\nimport {\n InputObject as UntypedInputObject,\n Schema as UntypedSchema\n} from \"untyped\";\nimport type { BaseSchema } from \"valibot\";\nimport { JSON_SCHEMA_DATA_TYPES } from \"./constants\";\nimport { ExtractedSchema, JsonSchema, JsonSchemaObject, Schema } from \"./types\";\n\ntype JsonSchemaDataType = (typeof JSON_SCHEMA_DATA_TYPES)[number];\n\nconst JSON_SCHEMA_DATA_TYPE_SET = new Set<JsonSchemaDataType>(\n JSON_SCHEMA_DATA_TYPES\n);\n\ntype SchemaKeywordValidator = (value: unknown) => boolean;\n\nconst isSetNumber = (value: unknown): value is number =>\n typeof value === \"number\" && Number.isFinite(value);\n\nconst isSetBoolean = (value: unknown): value is boolean =>\n typeof value === \"boolean\";\n\nconst isNonNegativeInteger = (value: unknown): value is number =>\n Number.isInteger(value) && (value as number) >= 0;\n\nconst isSchemaLikeValue = (value: unknown): boolean =>\n isSetObject(value) || isSetBoolean(value);\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every(item => isSetString(item));\n\nconst isRecordOfStringArrays = (\n value: unknown\n): value is Record<string, string[]> =>\n isSetObject(value) && Object.values(value).every(item => isStringArray(item));\n\nconst TYPE_KEYWORD_VALIDATORS: Record<\n JsonSchemaDataType,\n Record<string, SchemaKeywordValidator>\n> = {\n string: {\n minLength: isNonNegativeInteger,\n maxLength: isNonNegativeInteger,\n pattern: isSetString,\n format: isSetString,\n contentEncoding: isSetString,\n contentMediaType: isSetString\n },\n number: {\n minimum: isSetNumber,\n maximum: isSetNumber,\n exclusiveMinimum: isSetNumber,\n exclusiveMaximum: isSetNumber,\n multipleOf: isSetNumber\n },\n integer: {\n minimum: isSetNumber,\n maximum: isSetNumber,\n exclusiveMinimum: isSetNumber,\n exclusiveMaximum: isSetNumber,\n multipleOf: isSetNumber\n },\n boolean: {},\n array: {\n items: isSchemaLikeValue,\n prefixItems: Array.isArray,\n contains: isSchemaLikeValue,\n minItems: isNonNegativeInteger,\n maxItems: isNonNegativeInteger,\n uniqueItems: isSetBoolean,\n minContains: isNonNegativeInteger,\n maxContains: isNonNegativeInteger\n },\n object: {\n properties: isSetObject,\n patternProperties: isSetObject,\n additionalProperties: isSchemaLikeValue,\n required: isStringArray,\n minProperties: isNonNegativeInteger,\n maxProperties: isNonNegativeInteger,\n dependentRequired: isRecordOfStringArrays,\n dependentSchemas: isSetObject,\n propertyNames: isSchemaLikeValue,\n unevaluatedProperties: isSchemaLikeValue\n },\n null: {}\n};\n\n/**\n * Type guard for Standard Schema V1 objects.\n *\n * @param input - The value to check.\n * @returns True if the input is a Standard Schema V1 object, false otherwise.\n */\nexport function isStandardSchema(input: unknown): input is StandardSchemaV1 {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (!isSetObject(schema[\"~standard\"])) {\n return false;\n }\n\n const standard = schema[\"~standard\"] as Record<string, unknown>;\n\n return standard.version === 1 && isFunction(standard.validate);\n}\n\n/**\n * Type guard for Valibot BaseSchema objects.\n *\n * @param input - The value to check.\n * @returns True if the input is a Valibot BaseSchema, false otherwise.\n */\nexport function isValibotSchema(\n input: unknown\n): input is BaseSchema<any, any, any> {\n if (!isSetObject(input) || !isStandardSchema(input)) {\n return false;\n }\n\n const schema = input as unknown as Record<string, unknown>;\n\n return (\n schema.kind === \"schema\" &&\n isSetString(schema.type) &&\n isSetBoolean(schema.async) &&\n isFunction(schema.reference) &&\n isSetString(schema.expects) &&\n isFunction(schema[\"~run\"])\n );\n}\n\n/**\n * Type guard for JSON Schema types.\n *\n * @remarks\n * This function checks if the input is a JSON Schema type, which is defined as having a `type` property or a `$ref` property. This is used to determine if a given input conforms to the structure of a JSON Schema definition that includes type information.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema type, false otherwise.\n */\nexport function isJsonSchema<T = unknown>(\n input: unknown\n): input is JsonSchema<T> {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n if (\"$ref\" in schema && isSetString(schema.$ref)) {\n return true;\n }\n\n if (!(\"type\" in schema)) {\n return false;\n }\n\n const schemaTypes: JsonSchemaDataType[] = [];\n\n if (isSetString(schema.type)) {\n if (!JSON_SCHEMA_DATA_TYPE_SET.has(schema.type as JsonSchemaDataType)) {\n return false;\n }\n\n schemaTypes.push(schema.type as JsonSchemaDataType);\n } else if (Array.isArray(schema.type) && schema.type.length > 0) {\n if (\n !schema.type.every(\n schemaType =>\n isSetString(schemaType) &&\n JSON_SCHEMA_DATA_TYPE_SET.has(schemaType as JsonSchemaDataType)\n ) ||\n new Set(schema.type).size !== schema.type.length\n ) {\n return false;\n }\n\n schemaTypes.push(...(schema.type as JsonSchemaDataType[]));\n } else {\n return false;\n }\n\n const typeKeywordValidators = schemaTypes.flatMap(schemaType =>\n Object.entries(TYPE_KEYWORD_VALIDATORS[schemaType])\n );\n\n for (const [keyword, validator] of typeKeywordValidators) {\n if (keyword in schema && !validator(schema[keyword])) {\n return false;\n }\n }\n\n if (\n \"minItems\" in schema &&\n \"maxItems\" in schema &&\n isNonNegativeInteger(schema.minItems) &&\n isNonNegativeInteger(schema.maxItems) &&\n schema.minItems > schema.maxItems\n ) {\n return false;\n }\n\n if (\n \"minLength\" in schema &&\n \"maxLength\" in schema &&\n isNonNegativeInteger(schema.minLength) &&\n isNonNegativeInteger(schema.maxLength) &&\n schema.minLength > schema.maxLength\n ) {\n return false;\n }\n\n if (\n \"minProperties\" in schema &&\n \"maxProperties\" in schema &&\n isNonNegativeInteger(schema.minProperties) &&\n isNonNegativeInteger(schema.maxProperties) &&\n schema.minProperties > schema.maxProperties\n ) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for JSON Schema object forms.\n *\n * @remarks\n * This function checks if the input is a JSON Schema object type, which is defined as having a `type` property equal to \"object\" or having a `properties` object. This is used to determine if a given input conforms to the structure of a JSON Schema object definition.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema object type, false otherwise.\n */\nexport function isJsonSchemaObject<\n T extends Record<string, any> = Record<string, any>\n>(input: unknown): input is JsonSchemaObject<T> {\n return (\n isJsonSchemaObjectType(input) &&\n (input.type === \"object\" || isObject(input.properties))\n );\n}\n\n/**\n * Type guard for JSON Schemas that only accept `null`.\n *\n * @remarks\n * This function checks if the input is a JSON Schema that exclusively accepts the `null` type. It verifies that the input is a valid JSON Schema and that its `type` property is set to \"null\". This is useful for identifying schemas that are specifically designed to allow only `null` values.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema that only accepts `null`, false otherwise.\n */\nexport function isNullOnlyJsonSchema(\n input: unknown\n): input is JsonSchema<null> {\n return isJsonSchema<null>(input) && input.type === \"null\";\n}\n\n/**\n * Type guard for untyped schema objects.\n *\n * @remarks\n * This function checks if the input is an untyped schema object, which is defined as having certain properties that are commonly found in untyped schema definitions. This includes properties such as `id`, `title`, `description`, `$schema`, `tsType`, `markdownType`, `type`, `required`, `tags`, `args`, `properties`, and `resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., strings for certain properties, arrays for others). This type guard is used to determine if a given input can be treated as an untyped schema object within the context of the Powerlines schema system.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped schema object, false otherwise.\n */\nexport function isUntypedSchema(input: unknown): input is UntypedSchema {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\"id\" in schema && !isSetString(schema.id)) {\n return false;\n }\n if (\"title\" in schema && !isSetString(schema.title)) {\n return false;\n }\n if (\"description\" in schema && !isSetString(schema.description)) {\n return false;\n }\n if (\"$schema\" in schema && !isSetString(schema.$schema)) {\n return false;\n }\n if (\"tsType\" in schema && !isSetString(schema.tsType)) {\n return false;\n }\n if (\"markdownType\" in schema && !isSetString(schema.markdownType)) {\n return false;\n }\n if (\n \"type\" in schema &&\n !isSetString(schema.type) &&\n !Array.isArray(schema.type)\n ) {\n return false;\n }\n if (\"required\" in schema && !Array.isArray(schema.required)) {\n return false;\n }\n if (\"tags\" in schema && !Array.isArray(schema.tags)) {\n return false;\n }\n if (\"args\" in schema && !Array.isArray(schema.args)) {\n return false;\n }\n if (\"properties\" in schema && !isSetObject(schema.properties)) {\n return false;\n }\n if (\"resolve\" in schema && !isFunction(schema.resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for untyped input objects.\n *\n * @remarks\n * This function checks if the input is an untyped input object, which is defined as having certain properties that are commonly found in untyped input definitions. This includes properties such as `$schema` and `$resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., objects for `$schema`, functions for `$resolve`). This type guard is used to determine if a given input can be treated as an untyped input object within the context of the Powerlines schema system.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped input object, false otherwise.\n */\nexport function isUntypedInput(input: unknown): input is UntypedInputObject {\n if (!isSetObject(input)) {\n return false;\n }\n\n const inputObject = input as Record<string, unknown>;\n if (\"$schema\" in inputObject && !isUntypedSchema(inputObject.$schema)) {\n return false;\n }\n if (\"$resolve\" in inputObject && !isFunction(inputObject.$resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for Powerlines Schema objects.\n *\n * @param input - The value to check.\n * @returns True if the input is a Powerlines Schema object, false otherwise.\n */\nexport function isSchema<T = unknown>(input: unknown): input is Schema<T> {\n return (\n isSetObject(input) &&\n \"schema\" in input &&\n isJsonSchema(input.schema) &&\n \"variant\" in input &&\n isSetString(input.variant) &&\n \"hash\" in input &&\n isSetString(input.hash)\n );\n}\n\nexport function isExtractedSchema<T = unknown>(\n input: unknown\n): input is ExtractedSchema<T> {\n return (\n isSchema<T>(input) &&\n \"source\" in input &&\n isSetObject(input.source) &&\n \"schema\" in input.source &&\n \"variant\" in input.source &&\n isSetString(input.source.variant)\n );\n}\n"],"mappings":";;;;;AAoCA,MAAM,4BAA4B,IAAI,IACpC,sBACF;AAIA,MAAM,eAAe,UACnB,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAEpD,MAAM,gBAAgB,UACpB,OAAO,UAAU;AAEnB,MAAM,wBAAwB,UAC5B,OAAO,UAAU,KAAK,KAAM,SAAoB;AAElD,MAAM,qBAAqB,UACzB,YAAY,KAAK,KAAK,aAAa,KAAK;AAE1C,MAAM,iBAAiB,UACrB,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAM,SAAQ,YAAY,IAAI,CAAC;AAE/D,MAAM,0BACJ,UAEA,YAAY,KAAK,KAAK,OAAO,OAAO,KAAK,EAAE,OAAM,SAAQ,cAAc,IAAI,CAAC;AAE9E,MAAM,0BAGF;CACF,QAAQ;EACN,WAAW;EACX,WAAW;EACX,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,kBAAkB;CACpB;CACA,QAAQ;EACN,SAAS;EACT,SAAS;EACT,kBAAkB;EAClB,kBAAkB;EAClB,YAAY;CACd;CACA,SAAS;EACP,SAAS;EACT,SAAS;EACT,kBAAkB;EAClB,kBAAkB;EAClB,YAAY;CACd;CACA,SAAS,CAAC;CACV,OAAO;EACL,OAAO;EACP,aAAa,MAAM;EACnB,UAAU;EACV,UAAU;EACV,UAAU;EACV,aAAa;EACb,aAAa;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BAAkB,UAAU,CAAC,YAAY,OAAO,YAAY,GAC9D,OAAO;CAET,IACE,UAAU,UACV,CAAC,YAAY,OAAO,IAAI,KACxB,CAAC,MAAM,QAAQ,OAAO,IAAI,GAE1B,OAAO;CAET,IAAI,cAAc,UAAU,CAAC,MAAM,QAAQ,OAAO,QAAQ,GACxD,OAAO;CAET,IAAI,UAAU,UAAU,CAAC,MAAM,QAAQ,OAAO,IAAI,GAChD,OAAO;CAET,IAAI,UAAU,UAAU,CAAC,MAAM,QAAQ,OAAO,IAAI,GAChD,OAAO;CAET,IAAI,gBAAgB,UAAU,CAAC,YAAY,OAAO,UAAU,GAC1D,OAAO;CAET,IAAI,aAAa,UAAU,CAAC,WAAW,OAAO,OAAO,GACnD,OAAO;CAGT,OAAO;AACT;;;;;;;;;;AAWA,SAAgB,eAAe,OAA6C;CAC1E,IAAI,CAAC,YAAY,KAAK,GACpB,OAAO;CAGT,MAAM,cAAc;CACpB,IAAI,aAAa,eAAe,CAAC,gBAAgB,YAAY,OAAO,GAClE,OAAO;CAET,IAAI,cAAc,eAAe,CAAC,WAAW,YAAY,QAAQ,GAC/D,OAAO;CAGT,OAAO;AACT;;;;;;;AAQA,SAAgB,SAAsB,OAAoC;CACxE,OACE,YAAY,KAAK,KACjB,YAAY,SACZ,aAAa,MAAM,MAAM,KACzB,aAAa,SACb,YAAY,MAAM,OAAO,KACzB,UAAU,SACV,YAAY,MAAM,IAAI;AAE1B;AAEA,SAAgB,kBACd,OAC6B;CAC7B,OACE,SAAY,KAAK,KACjB,YAAY,SACZ,YAAY,MAAM,MAAM,KACxB,YAAY,MAAM,UAClB,aAAa,MAAM,UACnB,YAAY,MAAM,OAAO,OAAO;AAEpC"}
|
|
1
|
+
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../src/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { isFunction, isSetObject, isSetString } from \"@stryke/type-checks\";\nimport {\n InputObject as UntypedInputObject,\n Schema as UntypedSchema\n} from \"untyped\";\nimport type { BaseSchema } from \"valibot\";\nimport { JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES } from \"./constants\";\nimport {\n JsonSchema,\n JsonSchemaAllOf,\n JsonSchemaAny,\n JsonSchemaAnyOf,\n JsonSchemaArray,\n JsonSchemaBigint,\n JsonSchemaBoolean,\n JsonSchemaDate,\n JsonSchemaDecimal,\n JsonSchemaEnum,\n JsonSchemaInteger,\n JsonSchemaKeywords,\n JsonSchemaLiteral,\n JsonSchemaMap,\n JsonSchemaNativeEnum,\n JsonSchemaNever,\n JsonSchemaNull,\n JsonSchemaNullable,\n JsonSchemaNumber,\n JsonSchemaObject,\n JsonSchemaPrimitiveType,\n JsonSchemaPrimitiveUnion,\n JsonSchemaRecord,\n JsonSchemaRef,\n JsonSchemaSet,\n JsonSchemaString,\n JsonSchemaTuple,\n JsonSchemaType,\n JsonSchemaUndefined,\n JsonSchemaUnion,\n JsonSchemaUnknown,\n Schema,\n ExtractedSchema as SchemaWithSource\n} from \"./types\";\n\nconst isSetNumber = (value: unknown): value is number =>\n typeof value === \"number\" && Number.isFinite(value);\n\nconst isSetBoolean = (value: unknown): value is boolean =>\n typeof value === \"boolean\";\nconst isSchemaLikeValue = (value: unknown): boolean =>\n isSetObject(value) || isSetBoolean(value);\n\nconst isRecordOfSchemaLike = (\n value: unknown\n): value is Record<string, unknown> =>\n isSetObject(value) &&\n Object.values(value).every(item => isSchemaLikeValue(item));\n\nconst isVocabularyMap = (value: unknown): value is Record<string, boolean> =>\n isSetObject(value) && Object.values(value).every(item => isSetBoolean(item));\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every(item => isSetString(item));\n\nconst isRecordOfStringArrays = (\n value: unknown\n): value is Record<string, string[]> =>\n isSetObject(value) && Object.values(value).every(item => isStringArray(item));\n\nconst JSON_SCHEMA_PRIMITIVE_TYPE_SET = new Set<JsonSchemaPrimitiveType>(\n JSON_SCHEMA_PRIMITIVE_TYPES\n);\nconst JSON_SCHEMA_TYPE_SET = new Set<JsonSchemaType>(JSON_SCHEMA_TYPES);\n\n/**\n * A helper type guard to check if a value is a JSON Schema primitive type.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSON Schema primitive type, false otherwise.\n */\nexport function isJsonSchemaPrimitiveType(\n value: unknown\n): value is JsonSchemaPrimitiveType {\n return (\n isSetString(value) &&\n JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(value as JsonSchemaPrimitiveType)\n );\n}\n\n/**\n * A helper type guard to check if a value is a JSON Schema type.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSON Schema type, false otherwise.\n */\nexport function isJsonSchemaType(value: unknown): value is JsonSchemaType {\n return (\n isSetString(value) && JSON_SCHEMA_TYPE_SET.has(value as JsonSchemaType)\n );\n}\n\nconst DATE_FORMAT_SET = new Set([\n \"date\",\n \"time\",\n \"date-time\",\n \"iso-time\",\n \"iso-date-time\",\n \"unix-time\"\n]);\n\nconst isSetBigint = (value: unknown): value is bigint =>\n typeof value === \"bigint\";\n\nconst isArrayOf = <T>(\n value: unknown,\n predicate: (item: unknown) => item is T\n): value is T[] => Array.isArray(value) && value.every(item => predicate(item));\n\nconst isTupleOfTwo = <A, B>(\n value: unknown,\n aPredicate: (item: unknown) => item is A,\n bPredicate: (item: unknown) => item is B\n): value is [A, B] =>\n Array.isArray(value) &&\n value.length === 2 &&\n aPredicate(value[0]) &&\n bPredicate(value[1]);\n\nconst isOptionalString = (value: unknown): value is string | undefined =>\n value === undefined || isSetString(value);\n\nconst isOptionalBoolean = (value: unknown): value is boolean | undefined =>\n value === undefined || isSetBoolean(value);\n\nconst isOptionalNumber = (value: unknown): value is number | undefined =>\n value === undefined || isSetNumber(value);\n\nconst isOptionalBigint = (value: unknown): value is bigint | undefined =>\n value === undefined || isSetBigint(value);\n\nconst isOptionalJsonSchema = (\n value: unknown\n): value is JsonSchema | undefined =>\n value === undefined || isJsonSchema(value);\n\nconst isOptionalJsonSchemaArray = (\n value: unknown\n): value is JsonSchema[] | undefined =>\n value === undefined || isArrayOf(value, isJsonSchema);\n\nconst isOptionalPrimitiveTypeArray = (\n value: unknown\n): value is JsonSchemaPrimitiveType[] | undefined =>\n value === undefined ||\n (Array.isArray(value) &&\n value.every(\n item =>\n isSetString(item) &&\n JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(item as JsonSchemaPrimitiveType)\n ));\n\nconst isOptionalJsonSchemaTypeArray = (\n value: unknown\n): value is JsonSchemaType[] | undefined =>\n value === undefined ||\n (Array.isArray(value) &&\n value.every(\n item =>\n isSetString(item) && JSON_SCHEMA_TYPE_SET.has(item as JsonSchemaType)\n ));\n\nconst hasValidJsonSchemaKeywords = (\n schema: Record<string, unknown>\n): boolean => {\n if (!isOptionalString(schema.$id)) {\n return false;\n }\n if (!isOptionalString(schema.$schema)) {\n return false;\n }\n if (\n schema.$vocabulary !== undefined &&\n !isVocabularyMap(schema.$vocabulary)\n ) {\n return false;\n }\n if (!isOptionalString(schema.$comment)) {\n return false;\n }\n if (!isOptionalString(schema.$anchor)) {\n return false;\n }\n if (schema.$defs !== undefined && !isRecordOfSchemaLike(schema.$defs)) {\n return false;\n }\n if (!isOptionalString(schema.$dynamicRef)) {\n return false;\n }\n if (!isOptionalString(schema.$dynamicAnchor)) {\n return false;\n }\n if (!isOptionalString(schema.name)) {\n return false;\n }\n if (!isOptionalString(schema.title)) {\n return false;\n }\n if (!isOptionalString(schema.description)) {\n return false;\n }\n if (!isOptionalString(schema.docs)) {\n return false;\n }\n if (schema.examples !== undefined && !Array.isArray(schema.examples)) {\n return false;\n }\n if (schema.alias !== undefined && !isStringArray(schema.alias)) {\n return false;\n }\n if (schema.tags !== undefined && !isStringArray(schema.tags)) {\n return false;\n }\n if (!isOptionalBoolean(schema.deprecated)) {\n return false;\n }\n if (!isOptionalBoolean(schema.hidden)) {\n return false;\n }\n if (!isOptionalBoolean(schema.ignore)) {\n return false;\n }\n if (!isOptionalBoolean(schema.internal)) {\n return false;\n }\n if (!isOptionalBoolean(schema.runtime)) {\n return false;\n }\n if (!isOptionalBoolean(schema.readOnly)) {\n return false;\n }\n if (!isOptionalBoolean(schema.writeOnly)) {\n return false;\n }\n\n if (!isOptionalJsonSchemaArray(schema.allOf)) {\n return false;\n }\n if (!isOptionalJsonSchemaArray(schema.anyOf)) {\n return false;\n }\n if (!isOptionalJsonSchemaArray(schema.oneOf)) {\n return false;\n }\n if (!isOptionalJsonSchema(schema.not)) {\n return false;\n }\n\n if (!isOptionalJsonSchema(schema.if)) {\n return false;\n }\n if (!isOptionalJsonSchema(schema.then)) {\n return false;\n }\n if (!isOptionalJsonSchema(schema.else)) {\n return false;\n }\n\n return true;\n};\n\n/**\n * Type guard for shared JSON Schema keyword groups.\n */\nexport function isJsonSchemaKeywords(\n input: unknown\n): input is JsonSchemaKeywords {\n if (!isSetObject(input)) {\n return false;\n }\n\n return hasValidJsonSchemaKeywords(input as Record<string, unknown>);\n}\n\n/**\n * Type guard for generic JSON Schema objects with optional `$ref`.\n */\nexport function isJsonSchemaAny(input: unknown): input is JsonSchemaAny {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return hasValidJsonSchemaKeywords(schema) && isOptionalString(schema.$ref);\n}\n\n/**\n * Type guard for JSON Schema array types.\n */\nexport function isJsonSchemaArray(input: unknown): input is JsonSchemaArray {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (!hasValidJsonSchemaKeywords(schema) || schema.type !== \"array\") {\n return false;\n }\n\n return (\n isOptionalJsonSchemaArray(schema.prefixItems) &&\n isOptionalJsonSchema(schema.items) &&\n isOptionalJsonSchema(schema.contains) &&\n isOptionalNumber(schema.minItems) &&\n isOptionalNumber(schema.maxItems) &&\n isOptionalBoolean(schema.uniqueItems) &&\n isOptionalNumber(schema.minContains) &&\n isOptionalNumber(schema.maxContains) &&\n (schema.unevaluatedItems === undefined ||\n isSetBoolean(schema.unevaluatedItems) ||\n isJsonSchema(schema.unevaluatedItems))\n );\n}\n\n/**\n * Type guard for bigint-backed integer schemas.\n */\nexport function isJsonSchemaBigint(input: unknown): input is JsonSchemaBigint {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\n !hasValidJsonSchemaKeywords(schema) ||\n schema.type !== \"integer\" ||\n schema.format !== \"int64\"\n ) {\n return false;\n }\n\n return (\n isOptionalBigint(schema.minimum) &&\n isOptionalBigint(schema.exclusiveMinimum) &&\n isOptionalBigint(schema.maximum) &&\n isOptionalBigint(schema.exclusiveMaximum) &&\n isOptionalBigint(schema.multipleOf) &&\n isOptionalBigint(schema.default) &&\n (schema.enum === undefined || isArrayOf(schema.enum, isSetBigint))\n );\n}\n\n/**\n * Type guard for boolean schemas.\n */\nexport function isJsonSchemaBoolean(\n input: unknown\n): input is JsonSchemaBoolean {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n schema.type === \"boolean\" &&\n isOptionalBoolean(schema.default)\n );\n}\n\n/**\n * Type guard for date/time schemas.\n */\nexport function isJsonSchemaDate(input: unknown): input is JsonSchemaDate {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (!hasValidJsonSchemaKeywords(schema)) {\n return false;\n }\n\n if (schema.anyOf !== undefined) {\n return isArrayOf(schema.anyOf, isJsonSchemaDate);\n }\n\n if (schema.type !== \"integer\" && schema.type !== \"string\") {\n return false;\n }\n\n if (!isSetString(schema.format) || !DATE_FORMAT_SET.has(schema.format)) {\n return false;\n }\n\n return (\n isOptionalNumber(schema.minimum) &&\n isOptionalNumber(schema.maximum) &&\n (schema.default === undefined ||\n isSetString(schema.default) ||\n isSetNumber(schema.default))\n );\n}\n\n/**\n * Type guard for enum-constrained schemas.\n */\nexport function isJsonSchemaEnum(input: unknown): input is JsonSchemaEnum {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\n !hasValidJsonSchemaKeywords(schema) ||\n !isSetString(schema.type) ||\n !JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(\n schema.type as JsonSchemaPrimitiveType\n ) ||\n !Array.isArray(schema.enum)\n ) {\n return false;\n }\n\n const typeName = schema.type as JsonSchemaPrimitiveType;\n const enumValues = schema.enum;\n const defaultValue = schema.default;\n\n if (typeName === \"string\") {\n return (\n enumValues.every(value => isSetString(value)) &&\n (defaultValue === undefined || isSetString(defaultValue))\n );\n }\n\n if (typeName === \"number\" || typeName === \"integer\") {\n return (\n enumValues.every(value => isSetNumber(value)) &&\n (defaultValue === undefined || isSetNumber(defaultValue))\n );\n }\n\n if (typeName === \"boolean\") {\n return (\n enumValues.every(value => isSetBoolean(value)) &&\n (defaultValue === undefined || isSetBoolean(defaultValue))\n );\n }\n\n return (\n typeName === \"null\" &&\n enumValues.every(value => value === null) &&\n (defaultValue === undefined || defaultValue === null)\n );\n}\n\n/**\n * Type guard for `allOf` composition schemas.\n */\nexport function isJsonSchemaAllOf(input: unknown): input is JsonSchemaAllOf {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\n !hasValidJsonSchemaKeywords(schema) ||\n !isArrayOf(schema.allOf, isJsonSchema)\n ) {\n return false;\n }\n\n return (\n schema.unevaluatedProperties === undefined ||\n isSetBoolean(schema.unevaluatedProperties) ||\n isJsonSchema(schema.unevaluatedProperties)\n );\n}\n\n/**\n * Type guard for literal-value schemas.\n */\nexport function isJsonSchemaLiteral(\n input: unknown\n): input is JsonSchemaLiteral {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (!hasValidJsonSchemaKeywords(schema) || !(\"const\" in schema)) {\n return false;\n }\n\n return (\n schema.type === undefined ||\n (isSetString(schema.type) && isJsonSchemaType(schema.type)) ||\n isOptionalJsonSchemaTypeArray(schema.type)\n );\n}\n\n/**\n * Type guard for map tuple-array schemas.\n */\nexport function isJsonSchemaMap(input: unknown): input is JsonSchemaMap {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\n !hasValidJsonSchemaKeywords(schema) ||\n schema.type !== \"array\" ||\n schema.maxItems !== 125 ||\n !isSetObject(schema.items)\n ) {\n return false;\n }\n\n const items = schema.items as Record<string, unknown>;\n\n return (\n items.type === \"array\" &&\n isTupleOfTwo(items.prefixItems, isJsonSchema, isJsonSchema) &&\n (items.items === undefined || items.items === false) &&\n items.minItems === 2 &&\n items.maxItems === 2\n );\n}\n\n/**\n * Type guard for native enum schemas.\n */\nexport function isJsonSchemaNativeEnum(\n input: unknown\n): input is JsonSchemaNativeEnum {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n const isValidType =\n schema.type === \"string\" ||\n schema.type === \"number\" ||\n (Array.isArray(schema.type) &&\n schema.type.length === 2 &&\n schema.type[0] === \"string\" &&\n schema.type[1] === \"number\");\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n isValidType &&\n Array.isArray(schema.enum) &&\n schema.enum.every(value => isSetString(value) || isSetNumber(value))\n );\n}\n\n/**\n * Type guard for impossible/never schemas.\n */\nexport function isJsonSchemaNever(input: unknown): input is JsonSchemaNever {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return hasValidJsonSchemaKeywords(schema) && isJsonSchemaAny(schema.not);\n}\n\n/**\n * Type guard for `null` schemas.\n */\nexport function isJsonSchemaNull(input: unknown): input is JsonSchemaNull {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n schema.type === \"null\" &&\n (schema.const === undefined || schema.const === null) &&\n (schema.enum === undefined ||\n (Array.isArray(schema.enum) && schema.enum.every(v => v === null))) &&\n (schema.default === undefined || schema.default === null)\n );\n}\n\n/**\n * Type guard for nullable schema unions.\n */\nexport function isJsonSchemaNullable(\n input: unknown\n): input is JsonSchemaNullable {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (!hasValidJsonSchemaKeywords(schema)) {\n return false;\n }\n\n const anyOfBranch =\n schema.anyOf !== undefined &&\n Array.isArray(schema.anyOf) &&\n schema.anyOf.length === 2 &&\n isJsonSchema(schema.anyOf[0]) &&\n isJsonSchemaNull(schema.anyOf[1]);\n\n const typeBranch =\n Array.isArray(schema.type) &&\n schema.type.length === 2 &&\n ((schema.type[0] === \"null\" &&\n isSetString(schema.type[1]) &&\n schema.type[1] !== \"null\" &&\n JSON_SCHEMA_TYPE_SET.has(schema.type[1] as JsonSchemaType)) ||\n (schema.type[1] === \"null\" &&\n isSetString(schema.type[0]) &&\n schema.type[0] !== \"null\" &&\n JSON_SCHEMA_TYPE_SET.has(schema.type[0] as JsonSchemaType)));\n\n return anyOfBranch || typeBranch;\n}\n\n/**\n * Type guard for numeric schemas.\n */\nexport function isJsonSchemaNumber(input: unknown): input is JsonSchemaNumber {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\n !hasValidJsonSchemaKeywords(schema) ||\n (schema.type !== \"number\" && schema.type !== \"integer\")\n ) {\n return false;\n }\n\n return (\n isOptionalString(schema.format) &&\n isOptionalNumber(schema.minimum) &&\n isOptionalNumber(schema.exclusiveMinimum) &&\n isOptionalNumber(schema.maximum) &&\n isOptionalNumber(schema.exclusiveMaximum) &&\n isOptionalNumber(schema.multipleOf) &&\n isOptionalNumber(schema.default) &&\n (schema.enum === undefined || isArrayOf(schema.enum, isSetNumber))\n );\n}\n\n/**\n * Type guard for integer schemas.\n */\nexport function isJsonSchemaInteger(\n input: unknown\n): input is JsonSchemaInteger {\n return isJsonSchemaNumber(input) && input.type === \"integer\";\n}\n\n/**\n * Type guard for decimal schemas.\n */\nexport function isJsonSchemaDecimal(\n input: unknown\n): input is JsonSchemaDecimal {\n return isJsonSchemaNumber(input) && input.type === \"number\";\n}\n\n/**\n * Type guard for object schemas.\n */\nexport function isJsonSchemaObject(input: unknown): input is JsonSchemaObject {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n schema.type === \"object\" &&\n (schema.properties === undefined ||\n isRecordOfSchemaLike(schema.properties)) &&\n (schema.patternProperties === undefined ||\n isRecordOfSchemaLike(schema.patternProperties)) &&\n (schema.additionalProperties === undefined ||\n isSetBoolean(schema.additionalProperties) ||\n isJsonSchema(schema.additionalProperties)) &&\n (schema.required === undefined || isStringArray(schema.required)) &&\n (schema.unevaluatedProperties === undefined ||\n isSetBoolean(schema.unevaluatedProperties) ||\n isJsonSchema(schema.unevaluatedProperties)) &&\n (schema.dependencies === undefined ||\n (isSetObject(schema.dependencies) &&\n Object.values(schema.dependencies).every(\n item => isStringArray(item) || isJsonSchema(item)\n ))) &&\n (schema.dependentRequired === undefined ||\n isRecordOfStringArrays(schema.dependentRequired)) &&\n (schema.dependentSchemas === undefined ||\n isRecordOfSchemaLike(schema.dependentSchemas)) &&\n isOptionalNumber(schema.minProperties) &&\n isOptionalNumber(schema.maxProperties) &&\n (schema.primaryKey === undefined || isStringArray(schema.primaryKey)) &&\n isOptionalString(schema.databaseSchema)\n );\n}\n\n/**\n * Type guard for string schemas.\n */\nexport function isJsonSchemaString(input: unknown): input is JsonSchemaString {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n schema.type === \"string\" &&\n isOptionalNumber(schema.minLength) &&\n isOptionalNumber(schema.maxLength) &&\n isOptionalString(schema.pattern) &&\n isOptionalString(schema.format) &&\n isOptionalString(schema.default) &&\n (schema.enum === undefined || isArrayOf(schema.enum, isSetString)) &&\n isOptionalString(schema.contentMediaType) &&\n isOptionalString(schema.contentEncoding) &&\n isOptionalString(schema.contentSchema)\n );\n}\n\n/**\n * Type guard for set-like array schemas.\n */\nexport function isJsonSchemaSet(input: unknown): input is JsonSchemaSet {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n schema.type === \"array\" &&\n schema.uniqueItems === true &&\n isOptionalJsonSchemaArray(schema.prefixItems) &&\n isOptionalJsonSchema(schema.items) &&\n isOptionalJsonSchema(schema.contains) &&\n isOptionalNumber(schema.minItems) &&\n isOptionalNumber(schema.maxItems) &&\n isOptionalNumber(schema.minContains) &&\n isOptionalNumber(schema.maxContains) &&\n (schema.unevaluatedItems === undefined ||\n isSetBoolean(schema.unevaluatedItems) ||\n isJsonSchema(schema.unevaluatedItems))\n );\n}\n\n/**\n * Type guard for record schemas.\n */\nexport function isJsonSchemaRecord(input: unknown): input is JsonSchemaRecord {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n schema.type === \"object\" &&\n (schema.patternProperties === undefined ||\n isRecordOfSchemaLike(schema.patternProperties)) &&\n (schema.additionalProperties === undefined ||\n isSetBoolean(schema.additionalProperties) ||\n isJsonSchema(schema.additionalProperties)) &&\n isOptionalJsonSchema(schema.propertyNames)\n );\n}\n\n/**\n * Type guard for tuple schemas.\n */\nexport function isJsonSchemaTuple(input: unknown): input is JsonSchemaTuple {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n schema.type === \"array\" &&\n isArrayOf(schema.prefixItems, isJsonSchema) &&\n isOptionalNumber(schema.minItems) &&\n isOptionalNumber(schema.maxItems) &&\n isOptionalJsonSchema(schema.items) &&\n isOptionalJsonSchema(schema.contains) &&\n isOptionalBoolean(schema.uniqueItems) &&\n isOptionalNumber(schema.minContains) &&\n isOptionalNumber(schema.maxContains) &&\n (schema.unevaluatedItems === undefined ||\n isSetBoolean(schema.unevaluatedItems) ||\n isJsonSchema(schema.unevaluatedItems))\n );\n}\n\n/**\n * Type guard for undefined-representing schemas.\n */\nexport function isJsonSchemaUndefined(\n input: unknown\n): input is JsonSchemaUndefined {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n isJsonSchemaAny(schema.not) &&\n (schema.default === undefined || schema.default === undefined)\n );\n}\n\n/**\n * Type guard for primitive-union schema variants.\n */\nexport function isJsonSchemaPrimitiveUnion(\n input: unknown\n): input is JsonSchemaPrimitiveUnion {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (!hasValidJsonSchemaKeywords(schema)) {\n return false;\n }\n\n if (\n isSetString(schema.type) &&\n JSON_SCHEMA_PRIMITIVE_TYPE_SET.has(schema.type as JsonSchemaPrimitiveType)\n ) {\n if (schema.enum === undefined) {\n return true;\n }\n\n if (!Array.isArray(schema.enum)) {\n return false;\n }\n\n if (schema.type === \"string\") {\n return (\n schema.enum.every(value => isSetString(value)) &&\n (schema.default === undefined || isSetString(schema.default))\n );\n }\n\n if (schema.type === \"number\") {\n return (\n schema.enum.every(value => isSetNumber(value)) &&\n (schema.default === undefined || isSetNumber(schema.default))\n );\n }\n\n if (schema.type === \"boolean\") {\n return (\n schema.enum.every(value => isSetBoolean(value)) &&\n (schema.default === undefined || isSetBoolean(schema.default))\n );\n }\n\n if (schema.type === \"integer\") {\n if (schema.format !== \"int64\") {\n return false;\n }\n\n return (\n schema.enum.every(value => isSetBigint(value)) &&\n (schema.default === undefined || isSetBigint(schema.default))\n );\n }\n\n return (\n schema.type === \"null\" &&\n schema.enum.every(value => value === null) &&\n (schema.default === undefined || schema.default === null)\n );\n }\n\n return isOptionalPrimitiveTypeArray(schema.type) && schema.type !== undefined;\n}\n\n/**\n * Type guard for union schemas.\n */\nexport function isJsonSchemaUnion(input: unknown): input is JsonSchemaUnion {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) &&\n (isJsonSchemaPrimitiveUnion(schema) || isJsonSchemaAnyOf(schema))\n );\n}\n\n/**\n * Type guard for permissive unknown schemas.\n */\nexport function isJsonSchemaUnknown(\n input: unknown\n): input is JsonSchemaUnknown {\n return isJsonSchemaAny(input);\n}\n\n/**\n * Type guard for `anyOf` composition schemas.\n */\nexport function isJsonSchemaAnyOf(input: unknown): input is JsonSchemaAnyOf {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return (\n hasValidJsonSchemaKeywords(schema) && isArrayOf(schema.anyOf, isJsonSchema)\n );\n}\n\n/**\n * Type guard for reference schemas.\n */\nexport function isJsonSchemaRef(input: unknown): input is JsonSchemaRef {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n return hasValidJsonSchemaKeywords(schema) && isSetString(schema.$ref);\n}\n\n/**\n * Type guard for Standard Schema V1 objects.\n *\n * @param input - The value to check.\n * @returns True if the input is a Standard Schema V1 object, false otherwise.\n */\nexport function isStandardSchema(input: unknown): input is StandardSchemaV1 {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (!isSetObject(schema[\"~standard\"])) {\n return false;\n }\n\n const standard = schema[\"~standard\"] as Record<string, unknown>;\n\n return standard.version === 1 && isFunction(standard.validate);\n}\n\n/**\n * Type guard for Valibot BaseSchema objects.\n *\n * @param input - The value to check.\n * @returns True if the input is a Valibot BaseSchema, false otherwise.\n */\nexport function isValibotSchema(\n input: unknown\n): input is BaseSchema<any, any, any> {\n if (!isSetObject(input) || !isStandardSchema(input)) {\n return false;\n }\n\n const schema = input as unknown as Record<string, unknown>;\n\n return (\n schema.kind === \"schema\" &&\n isSetString(schema.type) &&\n isSetBoolean(schema.async) &&\n isFunction(schema.reference) &&\n isSetString(schema.expects) &&\n isFunction(schema[\"~run\"])\n );\n}\n\n/**\n * Type guard for JSON Schema types.\n *\n * @remarks\n * This function checks if the input is a JSON Schema type, which is defined as having a `type` property or a `$ref` property. This is used to determine if a given input conforms to the structure of a JSON Schema definition that includes type information.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema type, false otherwise.\n */\nexport function isJsonSchema(input: unknown): input is JsonSchema {\n return (\n isJsonSchemaString(input) ||\n isJsonSchemaInteger(input) ||\n isJsonSchemaDecimal(input) ||\n isJsonSchemaBigint(input) ||\n isJsonSchemaBoolean(input) ||\n isJsonSchemaDate(input) ||\n isJsonSchemaEnum(input) ||\n isJsonSchemaLiteral(input) ||\n isJsonSchemaNativeEnum(input) ||\n isJsonSchemaNull(input) ||\n isJsonSchemaArray(input) ||\n isJsonSchemaObject(input) ||\n isJsonSchemaRecord(input) ||\n isJsonSchemaTuple(input) ||\n isJsonSchemaUnion(input) ||\n isJsonSchemaUndefined(input) ||\n isJsonSchemaRef(input) ||\n isJsonSchemaNever(input) ||\n isJsonSchemaMap(input) ||\n isJsonSchemaAny(input) ||\n isJsonSchemaNullable(input) ||\n isJsonSchemaAllOf(input) ||\n isJsonSchemaUnknown(input) ||\n isJsonSchemaSet(input)\n );\n}\n\n/**\n * Type guard for JSON Schemas that only accept `null`.\n *\n * @remarks\n * This function checks if the input is a JSON Schema that exclusively accepts the `null` type. It verifies that the input is a valid JSON Schema and that its `type` property is set to \"null\". This is useful for identifying schemas that are specifically designed to allow only `null` values.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema that only accepts `null`, false otherwise.\n */\nexport function isNullOnlyJsonSchema(input: unknown): input is JsonSchemaNull {\n return isJsonSchemaNull(input);\n}\n\n/**\n * Type guard for untyped schema objects.\n *\n * @remarks\n * This function checks if the input is an untyped schema object, which is defined as having certain properties that are commonly found in untyped schema definitions. This includes properties such as `id`, `title`, `description`, `$schema`, `tsType`, `markdownType`, `type`, `required`, `tags`, `args`, `properties`, and `resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., strings for certain properties, arrays for others). This type guard is used to determine if a given input can be treated as an untyped schema object within the context of the Powerlines schema system.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped schema object, false otherwise.\n */\nexport function isUntypedSchema(input: unknown): input is UntypedSchema {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\"id\" in schema && !isSetString(schema.id)) {\n return false;\n }\n if (\"title\" in schema && !isSetString(schema.title)) {\n return false;\n }\n if (\"description\" in schema && !isSetString(schema.description)) {\n return false;\n }\n if (\"$schema\" in schema && !isSetString(schema.$schema)) {\n return false;\n }\n if (\"tsType\" in schema && !isSetString(schema.tsType)) {\n return false;\n }\n if (\"markdownType\" in schema && !isSetString(schema.markdownType)) {\n return false;\n }\n if (\n \"type\" in schema &&\n !isSetString(schema.type) &&\n !Array.isArray(schema.type)\n ) {\n return false;\n }\n if (\"required\" in schema && !Array.isArray(schema.required)) {\n return false;\n }\n if (\"tags\" in schema && !Array.isArray(schema.tags)) {\n return false;\n }\n if (\"args\" in schema && !Array.isArray(schema.args)) {\n return false;\n }\n if (\"properties\" in schema && !isSetObject(schema.properties)) {\n return false;\n }\n if (\"resolve\" in schema && !isFunction(schema.resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for untyped input objects.\n *\n * @remarks\n * This function checks if the input is an untyped input object, which is defined as having certain properties that are commonly found in untyped input definitions. This includes properties such as `$schema` and `$resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., objects for `$schema`, functions for `$resolve`). This type guard is used to determine if a given input can be treated as an untyped input object within the context of the Powerlines schema system.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped input object, false otherwise.\n */\nexport function isUntypedInput(input: unknown): input is UntypedInputObject {\n if (!isSetObject(input)) {\n return false;\n }\n\n const inputObject = input as Record<string, unknown>;\n if (\"$schema\" in inputObject && !isUntypedSchema(inputObject.$schema)) {\n return false;\n }\n if (\"$resolve\" in inputObject && !isFunction(inputObject.$resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for Powerlines Schema objects.\n *\n * @param input - The value to check.\n * @returns True if the input is a Powerlines Schema object, false otherwise.\n */\nexport function isSchema(input: unknown): input is Schema {\n return (\n isSetObject(input) &&\n \"schema\" in input &&\n isJsonSchema(input.schema) &&\n \"variant\" in input &&\n isSetString(input.variant) &&\n \"hash\" in input &&\n isSetString(input.hash)\n );\n}\n\n/**\n * Type guard for extracted schema objects that include source information.\n *\n * @param input - The value to check.\n * @returns True if the input is a SchemaWithSource object, false otherwise.\n */\nexport function isSchemaWithSource(input: unknown): input is SchemaWithSource {\n return (\n isSchema(input) &&\n \"source\" in input &&\n isSetObject(input.source) &&\n \"schema\" in input.source &&\n \"variant\" in input.source &&\n isSetString(input.source.variant)\n );\n}\n"],"mappings":";;;;AA8DA,MAAM,eAAe,UACnB,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAEpD,MAAM,gBAAgB,UACpB,OAAO,UAAU;AACnB,MAAM,qBAAqB,UACzB,YAAY,KAAK,KAAK,aAAa,KAAK;AAE1C,MAAM,wBACJ,UAEA,YAAY,KAAK,KACjB,OAAO,OAAO,KAAK,EAAE,OAAM,SAAQ,kBAAkB,IAAI,CAAC;AAE5D,MAAM,mBAAmB,UACvB,YAAY,KAAK,KAAK,OAAO,OAAO,KAAK,EAAE,OAAM,SAAQ,aAAa,IAAI,CAAC;AAE7E,MAAM,iBAAiB,UACrB,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAM,SAAQ,YAAY,IAAI,CAAC;AAE/D,MAAM,0BACJ,UAEA,YAAY,KAAK,KAAK,OAAO,OA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