@powerlines/schema 0.11.58 → 0.11.59
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/constants.cjs +18 -1
- package/dist/constants.d.cts +2 -1
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +2 -1
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +17 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/extract.cjs +10 -3
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts.map +1 -1
- package/dist/extract.mjs +11 -4
- package/dist/extract.mjs.map +1 -1
- package/dist/helpers.cjs +57 -15
- package/dist/helpers.d.cts +35 -6
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +35 -6
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +55 -16
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +6 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/resolve.cjs +35 -12
- package/dist/resolve.d.cts +7 -7
- package/dist/resolve.d.cts.map +1 -1
- package/dist/resolve.d.mts +7 -7
- package/dist/resolve.d.mts.map +1 -1
- package/dist/resolve.mjs +35 -12
- package/dist/resolve.mjs.map +1 -1
- package/dist/type-checks.cjs +94 -0
- package/dist/type-checks.d.cts +92 -1
- package/dist/type-checks.d.cts.map +1 -1
- package/dist/type-checks.d.mts +92 -1
- package/dist/type-checks.d.mts.map +1 -1
- package/dist/type-checks.mjs +94 -1
- package/dist/type-checks.mjs.map +1 -1
- package/dist/types.d.cts +4 -8
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +4 -8
- package/dist/types.d.mts.map +1 -1
- package/package.json +21 -17
package/dist/type-checks.d.mts
CHANGED
|
@@ -20,114 +20,198 @@ declare function isJsonSchemaPrimitiveType(value: unknown): value is JsonSchemaP
|
|
|
20
20
|
declare function isJsonSchemaType(value: unknown): value is JsonSchemaType;
|
|
21
21
|
/**
|
|
22
22
|
* Type guard for shared JSON Schema keyword groups.
|
|
23
|
+
*
|
|
24
|
+
* @param input - The value to check.
|
|
25
|
+
* @returns True if the input is a JSON Schema keyword group, false otherwise.
|
|
23
26
|
*/
|
|
24
27
|
declare function isJsonSchemaKeywords(input: unknown): input is JsonSchemaKeywords;
|
|
25
28
|
/**
|
|
26
29
|
* Type guard for generic JSON Schema objects with optional `$ref`.
|
|
30
|
+
*
|
|
31
|
+
* @param input - The value to check.
|
|
32
|
+
* @returns True if the input is a generic JSON Schema object, false otherwise.
|
|
27
33
|
*/
|
|
28
34
|
declare function isJsonSchemaAny(input: unknown): input is JsonSchemaAny;
|
|
29
35
|
/**
|
|
30
36
|
* Type guard for JSON Schema array types.
|
|
37
|
+
*
|
|
38
|
+
* @param input - The value to check.
|
|
39
|
+
* @returns True if the input is a JSON Schema array schema, false otherwise.
|
|
31
40
|
*/
|
|
32
41
|
declare function isJsonSchemaArray(input: unknown): input is JsonSchemaArray;
|
|
33
42
|
/**
|
|
34
43
|
* Type guard for bigint-backed integer schemas.
|
|
44
|
+
*
|
|
45
|
+
* @param input - The value to check.
|
|
46
|
+
* @returns True if the input is a bigint-backed integer schema, false otherwise.
|
|
35
47
|
*/
|
|
36
48
|
declare function isJsonSchemaBigint(input: unknown): input is JsonSchemaBigint;
|
|
37
49
|
/**
|
|
38
50
|
* Type guard for boolean schemas.
|
|
51
|
+
*
|
|
52
|
+
* @param input - The value to check.
|
|
53
|
+
* @returns True if the input is a boolean schema, false otherwise.
|
|
39
54
|
*/
|
|
40
55
|
declare function isJsonSchemaBoolean(input: unknown): input is JsonSchemaBoolean;
|
|
41
56
|
/**
|
|
42
57
|
* Type guard for date/time schemas.
|
|
58
|
+
*
|
|
59
|
+
* @param input - The value to check.
|
|
60
|
+
* @returns True if the input is a date or time schema, false otherwise.
|
|
43
61
|
*/
|
|
44
62
|
declare function isJsonSchemaDate(input: unknown): input is JsonSchemaDate;
|
|
45
63
|
/**
|
|
46
64
|
* Type guard for enum-constrained schemas.
|
|
65
|
+
*
|
|
66
|
+
* @param input - The value to check.
|
|
67
|
+
* @returns True if the input is an enum-constrained schema, false otherwise.
|
|
47
68
|
*/
|
|
48
69
|
declare function isJsonSchemaEnum(input: unknown): input is JsonSchemaEnum;
|
|
49
70
|
/**
|
|
50
71
|
* Type guard for `allOf` composition schemas.
|
|
72
|
+
*
|
|
73
|
+
* @param input - The value to check.
|
|
74
|
+
* @returns True if the input is an `allOf` schema, false otherwise.
|
|
51
75
|
*/
|
|
52
76
|
declare function isJsonSchemaAllOf(input: unknown): input is JsonSchemaAllOf;
|
|
53
77
|
/**
|
|
54
78
|
* Type guard for literal-value schemas.
|
|
79
|
+
*
|
|
80
|
+
* @param input - The value to check.
|
|
81
|
+
* @returns True if the input is a literal-value schema, false otherwise.
|
|
55
82
|
*/
|
|
56
83
|
declare function isJsonSchemaLiteral(input: unknown): input is JsonSchemaLiteral;
|
|
57
84
|
/**
|
|
58
85
|
* Type guard for map tuple-array schemas.
|
|
86
|
+
*
|
|
87
|
+
* @param input - The value to check.
|
|
88
|
+
* @returns True if the input is a map tuple-array schema, false otherwise.
|
|
59
89
|
*/
|
|
60
90
|
declare function isJsonSchemaMap(input: unknown): input is JsonSchemaMap;
|
|
61
91
|
/**
|
|
62
92
|
* Type guard for native enum schemas.
|
|
93
|
+
*
|
|
94
|
+
* @param input - The value to check.
|
|
95
|
+
* @returns True if the input is a native enum schema, false otherwise.
|
|
63
96
|
*/
|
|
64
97
|
declare function isJsonSchemaNativeEnum(input: unknown): input is JsonSchemaNativeEnum;
|
|
65
98
|
/**
|
|
66
99
|
* Type guard for impossible/never schemas.
|
|
100
|
+
*
|
|
101
|
+
* @param input - The value to check.
|
|
102
|
+
* @returns True if the input is a never schema, false otherwise.
|
|
67
103
|
*/
|
|
68
104
|
declare function isJsonSchemaNever(input: unknown): input is JsonSchemaNever;
|
|
69
105
|
/**
|
|
70
106
|
* Type guard for `null` schemas.
|
|
107
|
+
*
|
|
108
|
+
* @param input - The value to check.
|
|
109
|
+
* @returns True if the input is a null schema, false otherwise.
|
|
71
110
|
*/
|
|
72
111
|
declare function isJsonSchemaNull(input: unknown): input is JsonSchemaNull;
|
|
73
112
|
/**
|
|
74
113
|
* Type guard for nullable schema unions.
|
|
114
|
+
*
|
|
115
|
+
* @param input - The value to check.
|
|
116
|
+
* @returns True if the input is a nullable schema union, false otherwise.
|
|
75
117
|
*/
|
|
76
118
|
declare function isJsonSchemaNullable(input: unknown): input is JsonSchemaNullable;
|
|
77
119
|
/**
|
|
78
120
|
* Type guard for numeric schemas.
|
|
121
|
+
*
|
|
122
|
+
* @param input - The value to check.
|
|
123
|
+
* @returns True if the input is a numeric schema, false otherwise.
|
|
79
124
|
*/
|
|
80
125
|
declare function isJsonSchemaNumber(input: unknown): input is JsonSchemaNumber;
|
|
81
126
|
/**
|
|
82
127
|
* Type guard for integer schemas.
|
|
128
|
+
*
|
|
129
|
+
* @param input - The value to check.
|
|
130
|
+
* @returns True if the input is an integer schema, false otherwise.
|
|
83
131
|
*/
|
|
84
132
|
declare function isJsonSchemaInteger(input: unknown): input is JsonSchemaInteger;
|
|
85
133
|
/**
|
|
86
134
|
* Type guard for decimal schemas.
|
|
135
|
+
*
|
|
136
|
+
* @param input - The value to check.
|
|
137
|
+
* @returns True if the input is a decimal schema, false otherwise.
|
|
87
138
|
*/
|
|
88
139
|
declare function isJsonSchemaDecimal(input: unknown): input is JsonSchemaDecimal;
|
|
89
140
|
/**
|
|
90
141
|
* Type guard for object schemas.
|
|
142
|
+
*
|
|
143
|
+
* @param input - The value to check.
|
|
144
|
+
* @returns True if the input is an object schema, false otherwise.
|
|
91
145
|
*/
|
|
92
146
|
declare function isJsonSchemaObject(input: unknown): input is JsonSchemaObject;
|
|
93
147
|
/**
|
|
94
148
|
* Type guard for string schemas.
|
|
149
|
+
*
|
|
150
|
+
* @param input - The value to check.
|
|
151
|
+
* @returns True if the input is a string schema, false otherwise.
|
|
95
152
|
*/
|
|
96
153
|
declare function isJsonSchemaString(input: unknown): input is JsonSchemaString;
|
|
97
154
|
/**
|
|
98
155
|
* Type guard for set-like array schemas.
|
|
156
|
+
*
|
|
157
|
+
* @param input - The value to check.
|
|
158
|
+
* @returns True if the input is a set-like array schema, false otherwise.
|
|
99
159
|
*/
|
|
100
160
|
declare function isJsonSchemaSet(input: unknown): input is JsonSchemaSet;
|
|
101
161
|
/**
|
|
102
162
|
* Type guard for record schemas.
|
|
163
|
+
*
|
|
164
|
+
* @param input - The value to check.
|
|
165
|
+
* @returns True if the input is a record schema, false otherwise.
|
|
103
166
|
*/
|
|
104
167
|
declare function isJsonSchemaRecord(input: unknown): input is JsonSchemaRecord;
|
|
105
168
|
/**
|
|
106
169
|
* Type guard for tuple schemas.
|
|
170
|
+
*
|
|
171
|
+
* @param input - The value to check.
|
|
172
|
+
* @returns True if the input is a tuple schema, false otherwise.
|
|
107
173
|
*/
|
|
108
174
|
declare function isJsonSchemaTuple(input: unknown): input is JsonSchemaTuple;
|
|
109
175
|
/**
|
|
110
176
|
* Type guard for undefined-representing schemas.
|
|
177
|
+
*
|
|
178
|
+
* @param input - The value to check.
|
|
179
|
+
* @returns True if the input is an undefined-representing schema, false otherwise.
|
|
111
180
|
*/
|
|
112
181
|
declare function isJsonSchemaUndefined(input: unknown): input is JsonSchemaUndefined;
|
|
113
182
|
/**
|
|
114
183
|
* Type guard for primitive-union schema variants.
|
|
184
|
+
*
|
|
185
|
+
* @param input - The value to check.
|
|
186
|
+
* @returns True if the input is a primitive-union schema variant, false otherwise.
|
|
115
187
|
*/
|
|
116
188
|
declare function isJsonSchemaPrimitiveUnion(input: unknown): input is JsonSchemaPrimitiveUnion;
|
|
117
189
|
/**
|
|
118
190
|
* Type guard for union schemas.
|
|
191
|
+
*
|
|
192
|
+
* @param input - The value to check.
|
|
193
|
+
* @returns True if the input is a union schema, false otherwise.
|
|
119
194
|
*/
|
|
120
195
|
declare function isJsonSchemaUnion(input: unknown): input is JsonSchemaUnion;
|
|
121
196
|
/**
|
|
122
197
|
* Type guard for permissive unknown schemas.
|
|
198
|
+
*
|
|
199
|
+
* @param input - The value to check.
|
|
200
|
+
* @returns True if the input is a permissive unknown schema, false otherwise.
|
|
123
201
|
*/
|
|
124
202
|
declare function isJsonSchemaUnknown(input: unknown): input is JsonSchemaUnknown;
|
|
125
203
|
/**
|
|
126
204
|
* Type guard for `anyOf` composition schemas.
|
|
205
|
+
*
|
|
206
|
+
* @param input - The value to check.
|
|
207
|
+
* @returns True if the input is an `anyOf` schema, false otherwise.
|
|
127
208
|
*/
|
|
128
209
|
declare function isJsonSchemaAnyOf(input: unknown): input is JsonSchemaAnyOf;
|
|
129
210
|
/**
|
|
130
211
|
* Type guard for reference schemas.
|
|
212
|
+
*
|
|
213
|
+
* @param input - The value to check.
|
|
214
|
+
* @returns True if the input is a reference schema, false otherwise.
|
|
131
215
|
*/
|
|
132
216
|
declare function isJsonSchemaRef(input: unknown): input is JsonSchemaRef;
|
|
133
217
|
/**
|
|
@@ -220,6 +304,13 @@ declare function isSchema(input: unknown): input is Schema$1;
|
|
|
220
304
|
* @returns True if the input is a SchemaWithSource object, false otherwise.
|
|
221
305
|
*/
|
|
222
306
|
declare function isSchemaWithSource(input: unknown): input is ExtractedSchema;
|
|
307
|
+
/**
|
|
308
|
+
* Type guard for Powerlines Schemas that are in Object form.
|
|
309
|
+
*
|
|
310
|
+
* @param input - The value to check.
|
|
311
|
+
* @returns True if the input is a Powerlines Schema object in Object form, false otherwise.
|
|
312
|
+
*/
|
|
313
|
+
declare function isSchemaObject(input: unknown): input is Schema$1<JsonSchemaObject>;
|
|
223
314
|
//#endregion
|
|
224
|
-
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, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema };
|
|
315
|
+
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, isSchemaObject, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema };
|
|
225
316
|
//# sourceMappingURL=type-checks.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-checks.d.mts","names":[],"sources":["../src/type-checks.ts"],"mappings":";;;;;;;;AAoGA;;;;iBAAgB,yBAAA,CACd,KAAA,YACC,KAAA,IAAS,uBAAuB;;;;AAAA;AAanC;;iBAAgB,gBAAA,CAAiB,KAAA,YAAiB,KAAA,IAAS,cAAc
|
|
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;;;iBAwJgB,oBAAA,CAAqB,KAAA,YAAiB,KAAA,IAAS,cAAc;AAxJF;AAmB3E;;;;;;;;AAnB2E,iBAqK3D,eAAA,CAAgB,KAAA,YAAiB,KAAA,IAAS,MAAa;AAtIvE;;;;;;;;AAA2E;AAkB3E;AAlBA,iBA+LgB,qBAAA,CAAsB,KAAA,YAAiB,KAAA,IAAS,MAAa;;;;;;;AA7KN;AAgBvE;;iBA0KgB,cAAA,CAAe,KAAA,YAAiB,KAAA,IAAS,WAAkB;;;;;;AA1KA;AAqB3E;;;;iBA+KgB,oBAAA,CACd,KAAA,YACC,KAAA,IAAS,WAAkB;;;;AA/KR;AA0BtB;;iBA4KgB,QAAA,CAAS,KAAA,YAAiB,KAAA,IAAS,QAAM;;;;;;AA5KQ;iBA8LjD,kBAAA,CAAmB,KAAA,YAAiB,KAAA,IAAS,eAAgB;;;;;;;iBAiB7D,cAAA,CACd,KAAA,YACC,KAAA,IAAS,QAAM,CAAC,gBAAA"}
|
package/dist/type-checks.mjs
CHANGED
|
@@ -110,6 +110,9 @@ const hasValidJsonSchemaKeywords = (schema) => {
|
|
|
110
110
|
};
|
|
111
111
|
/**
|
|
112
112
|
* Type guard for shared JSON Schema keyword groups.
|
|
113
|
+
*
|
|
114
|
+
* @param input - The value to check.
|
|
115
|
+
* @returns True if the input is a JSON Schema keyword group, false otherwise.
|
|
113
116
|
*/
|
|
114
117
|
function isJsonSchemaKeywords(input) {
|
|
115
118
|
if (!isSetObject(input)) return false;
|
|
@@ -117,6 +120,9 @@ function isJsonSchemaKeywords(input) {
|
|
|
117
120
|
}
|
|
118
121
|
/**
|
|
119
122
|
* Type guard for generic JSON Schema objects with optional `$ref`.
|
|
123
|
+
*
|
|
124
|
+
* @param input - The value to check.
|
|
125
|
+
* @returns True if the input is a generic JSON Schema object, false otherwise.
|
|
120
126
|
*/
|
|
121
127
|
function isJsonSchemaAny(input) {
|
|
122
128
|
if (!isSetObject(input)) return false;
|
|
@@ -125,6 +131,9 @@ function isJsonSchemaAny(input) {
|
|
|
125
131
|
}
|
|
126
132
|
/**
|
|
127
133
|
* Type guard for JSON Schema array types.
|
|
134
|
+
*
|
|
135
|
+
* @param input - The value to check.
|
|
136
|
+
* @returns True if the input is a JSON Schema array schema, false otherwise.
|
|
128
137
|
*/
|
|
129
138
|
function isJsonSchemaArray(input) {
|
|
130
139
|
if (!isSetObject(input)) return false;
|
|
@@ -134,6 +143,9 @@ function isJsonSchemaArray(input) {
|
|
|
134
143
|
}
|
|
135
144
|
/**
|
|
136
145
|
* Type guard for bigint-backed integer schemas.
|
|
146
|
+
*
|
|
147
|
+
* @param input - The value to check.
|
|
148
|
+
* @returns True if the input is a bigint-backed integer schema, false otherwise.
|
|
137
149
|
*/
|
|
138
150
|
function isJsonSchemaBigint(input) {
|
|
139
151
|
if (!isSetObject(input)) return false;
|
|
@@ -143,6 +155,9 @@ function isJsonSchemaBigint(input) {
|
|
|
143
155
|
}
|
|
144
156
|
/**
|
|
145
157
|
* Type guard for boolean schemas.
|
|
158
|
+
*
|
|
159
|
+
* @param input - The value to check.
|
|
160
|
+
* @returns True if the input is a boolean schema, false otherwise.
|
|
146
161
|
*/
|
|
147
162
|
function isJsonSchemaBoolean(input) {
|
|
148
163
|
if (!isSetObject(input)) return false;
|
|
@@ -151,6 +166,9 @@ function isJsonSchemaBoolean(input) {
|
|
|
151
166
|
}
|
|
152
167
|
/**
|
|
153
168
|
* Type guard for date/time schemas.
|
|
169
|
+
*
|
|
170
|
+
* @param input - The value to check.
|
|
171
|
+
* @returns True if the input is a date or time schema, false otherwise.
|
|
154
172
|
*/
|
|
155
173
|
function isJsonSchemaDate(input) {
|
|
156
174
|
if (!isSetObject(input)) return false;
|
|
@@ -163,6 +181,9 @@ function isJsonSchemaDate(input) {
|
|
|
163
181
|
}
|
|
164
182
|
/**
|
|
165
183
|
* Type guard for enum-constrained schemas.
|
|
184
|
+
*
|
|
185
|
+
* @param input - The value to check.
|
|
186
|
+
* @returns True if the input is an enum-constrained schema, false otherwise.
|
|
166
187
|
*/
|
|
167
188
|
function isJsonSchemaEnum(input) {
|
|
168
189
|
if (!isSetObject(input)) return false;
|
|
@@ -178,6 +199,9 @@ function isJsonSchemaEnum(input) {
|
|
|
178
199
|
}
|
|
179
200
|
/**
|
|
180
201
|
* Type guard for `allOf` composition schemas.
|
|
202
|
+
*
|
|
203
|
+
* @param input - The value to check.
|
|
204
|
+
* @returns True if the input is an `allOf` schema, false otherwise.
|
|
181
205
|
*/
|
|
182
206
|
function isJsonSchemaAllOf(input) {
|
|
183
207
|
if (!isSetObject(input)) return false;
|
|
@@ -187,6 +211,9 @@ function isJsonSchemaAllOf(input) {
|
|
|
187
211
|
}
|
|
188
212
|
/**
|
|
189
213
|
* Type guard for literal-value schemas.
|
|
214
|
+
*
|
|
215
|
+
* @param input - The value to check.
|
|
216
|
+
* @returns True if the input is a literal-value schema, false otherwise.
|
|
190
217
|
*/
|
|
191
218
|
function isJsonSchemaLiteral(input) {
|
|
192
219
|
if (!isSetObject(input)) return false;
|
|
@@ -196,6 +223,9 @@ function isJsonSchemaLiteral(input) {
|
|
|
196
223
|
}
|
|
197
224
|
/**
|
|
198
225
|
* Type guard for map tuple-array schemas.
|
|
226
|
+
*
|
|
227
|
+
* @param input - The value to check.
|
|
228
|
+
* @returns True if the input is a map tuple-array schema, false otherwise.
|
|
199
229
|
*/
|
|
200
230
|
function isJsonSchemaMap(input) {
|
|
201
231
|
if (!isSetObject(input)) return false;
|
|
@@ -206,6 +236,9 @@ function isJsonSchemaMap(input) {
|
|
|
206
236
|
}
|
|
207
237
|
/**
|
|
208
238
|
* Type guard for native enum schemas.
|
|
239
|
+
*
|
|
240
|
+
* @param input - The value to check.
|
|
241
|
+
* @returns True if the input is a native enum schema, false otherwise.
|
|
209
242
|
*/
|
|
210
243
|
function isJsonSchemaNativeEnum(input) {
|
|
211
244
|
if (!isSetObject(input)) return false;
|
|
@@ -215,6 +248,9 @@ function isJsonSchemaNativeEnum(input) {
|
|
|
215
248
|
}
|
|
216
249
|
/**
|
|
217
250
|
* Type guard for impossible/never schemas.
|
|
251
|
+
*
|
|
252
|
+
* @param input - The value to check.
|
|
253
|
+
* @returns True if the input is a never schema, false otherwise.
|
|
218
254
|
*/
|
|
219
255
|
function isJsonSchemaNever(input) {
|
|
220
256
|
if (!isSetObject(input)) return false;
|
|
@@ -223,6 +259,9 @@ function isJsonSchemaNever(input) {
|
|
|
223
259
|
}
|
|
224
260
|
/**
|
|
225
261
|
* Type guard for `null` schemas.
|
|
262
|
+
*
|
|
263
|
+
* @param input - The value to check.
|
|
264
|
+
* @returns True if the input is a null schema, false otherwise.
|
|
226
265
|
*/
|
|
227
266
|
function isJsonSchemaNull(input) {
|
|
228
267
|
if (!isSetObject(input)) return false;
|
|
@@ -231,6 +270,9 @@ function isJsonSchemaNull(input) {
|
|
|
231
270
|
}
|
|
232
271
|
/**
|
|
233
272
|
* Type guard for nullable schema unions.
|
|
273
|
+
*
|
|
274
|
+
* @param input - The value to check.
|
|
275
|
+
* @returns True if the input is a nullable schema union, false otherwise.
|
|
234
276
|
*/
|
|
235
277
|
function isJsonSchemaNullable(input) {
|
|
236
278
|
if (!isSetObject(input)) return false;
|
|
@@ -242,6 +284,9 @@ function isJsonSchemaNullable(input) {
|
|
|
242
284
|
}
|
|
243
285
|
/**
|
|
244
286
|
* Type guard for numeric schemas.
|
|
287
|
+
*
|
|
288
|
+
* @param input - The value to check.
|
|
289
|
+
* @returns True if the input is a numeric schema, false otherwise.
|
|
245
290
|
*/
|
|
246
291
|
function isJsonSchemaNumber(input) {
|
|
247
292
|
if (!isSetObject(input)) return false;
|
|
@@ -251,18 +296,27 @@ function isJsonSchemaNumber(input) {
|
|
|
251
296
|
}
|
|
252
297
|
/**
|
|
253
298
|
* Type guard for integer schemas.
|
|
299
|
+
*
|
|
300
|
+
* @param input - The value to check.
|
|
301
|
+
* @returns True if the input is an integer schema, false otherwise.
|
|
254
302
|
*/
|
|
255
303
|
function isJsonSchemaInteger(input) {
|
|
256
304
|
return isJsonSchemaNumber(input) && input.type === "integer";
|
|
257
305
|
}
|
|
258
306
|
/**
|
|
259
307
|
* Type guard for decimal schemas.
|
|
308
|
+
*
|
|
309
|
+
* @param input - The value to check.
|
|
310
|
+
* @returns True if the input is a decimal schema, false otherwise.
|
|
260
311
|
*/
|
|
261
312
|
function isJsonSchemaDecimal(input) {
|
|
262
313
|
return isJsonSchemaNumber(input) && input.type === "number";
|
|
263
314
|
}
|
|
264
315
|
/**
|
|
265
316
|
* Type guard for object schemas.
|
|
317
|
+
*
|
|
318
|
+
* @param input - The value to check.
|
|
319
|
+
* @returns True if the input is an object schema, false otherwise.
|
|
266
320
|
*/
|
|
267
321
|
function isJsonSchemaObject(input) {
|
|
268
322
|
if (!isSetObject(input)) return false;
|
|
@@ -271,6 +325,9 @@ function isJsonSchemaObject(input) {
|
|
|
271
325
|
}
|
|
272
326
|
/**
|
|
273
327
|
* Type guard for string schemas.
|
|
328
|
+
*
|
|
329
|
+
* @param input - The value to check.
|
|
330
|
+
* @returns True if the input is a string schema, false otherwise.
|
|
274
331
|
*/
|
|
275
332
|
function isJsonSchemaString(input) {
|
|
276
333
|
if (!isSetObject(input)) return false;
|
|
@@ -279,6 +336,9 @@ function isJsonSchemaString(input) {
|
|
|
279
336
|
}
|
|
280
337
|
/**
|
|
281
338
|
* Type guard for set-like array schemas.
|
|
339
|
+
*
|
|
340
|
+
* @param input - The value to check.
|
|
341
|
+
* @returns True if the input is a set-like array schema, false otherwise.
|
|
282
342
|
*/
|
|
283
343
|
function isJsonSchemaSet(input) {
|
|
284
344
|
if (!isSetObject(input)) return false;
|
|
@@ -287,6 +347,9 @@ function isJsonSchemaSet(input) {
|
|
|
287
347
|
}
|
|
288
348
|
/**
|
|
289
349
|
* Type guard for record schemas.
|
|
350
|
+
*
|
|
351
|
+
* @param input - The value to check.
|
|
352
|
+
* @returns True if the input is a record schema, false otherwise.
|
|
290
353
|
*/
|
|
291
354
|
function isJsonSchemaRecord(input) {
|
|
292
355
|
if (!isSetObject(input)) return false;
|
|
@@ -295,6 +358,9 @@ function isJsonSchemaRecord(input) {
|
|
|
295
358
|
}
|
|
296
359
|
/**
|
|
297
360
|
* Type guard for tuple schemas.
|
|
361
|
+
*
|
|
362
|
+
* @param input - The value to check.
|
|
363
|
+
* @returns True if the input is a tuple schema, false otherwise.
|
|
298
364
|
*/
|
|
299
365
|
function isJsonSchemaTuple(input) {
|
|
300
366
|
if (!isSetObject(input)) return false;
|
|
@@ -303,6 +369,9 @@ function isJsonSchemaTuple(input) {
|
|
|
303
369
|
}
|
|
304
370
|
/**
|
|
305
371
|
* Type guard for undefined-representing schemas.
|
|
372
|
+
*
|
|
373
|
+
* @param input - The value to check.
|
|
374
|
+
* @returns True if the input is an undefined-representing schema, false otherwise.
|
|
306
375
|
*/
|
|
307
376
|
function isJsonSchemaUndefined(input) {
|
|
308
377
|
if (!isSetObject(input)) return false;
|
|
@@ -311,6 +380,9 @@ function isJsonSchemaUndefined(input) {
|
|
|
311
380
|
}
|
|
312
381
|
/**
|
|
313
382
|
* Type guard for primitive-union schema variants.
|
|
383
|
+
*
|
|
384
|
+
* @param input - The value to check.
|
|
385
|
+
* @returns True if the input is a primitive-union schema variant, false otherwise.
|
|
314
386
|
*/
|
|
315
387
|
function isJsonSchemaPrimitiveUnion(input) {
|
|
316
388
|
if (!isSetObject(input)) return false;
|
|
@@ -332,6 +404,9 @@ function isJsonSchemaPrimitiveUnion(input) {
|
|
|
332
404
|
}
|
|
333
405
|
/**
|
|
334
406
|
* Type guard for union schemas.
|
|
407
|
+
*
|
|
408
|
+
* @param input - The value to check.
|
|
409
|
+
* @returns True if the input is a union schema, false otherwise.
|
|
335
410
|
*/
|
|
336
411
|
function isJsonSchemaUnion(input) {
|
|
337
412
|
if (!isSetObject(input)) return false;
|
|
@@ -340,12 +415,18 @@ function isJsonSchemaUnion(input) {
|
|
|
340
415
|
}
|
|
341
416
|
/**
|
|
342
417
|
* Type guard for permissive unknown schemas.
|
|
418
|
+
*
|
|
419
|
+
* @param input - The value to check.
|
|
420
|
+
* @returns True if the input is a permissive unknown schema, false otherwise.
|
|
343
421
|
*/
|
|
344
422
|
function isJsonSchemaUnknown(input) {
|
|
345
423
|
return isJsonSchemaAny(input);
|
|
346
424
|
}
|
|
347
425
|
/**
|
|
348
426
|
* Type guard for `anyOf` composition schemas.
|
|
427
|
+
*
|
|
428
|
+
* @param input - The value to check.
|
|
429
|
+
* @returns True if the input is an `anyOf` schema, false otherwise.
|
|
349
430
|
*/
|
|
350
431
|
function isJsonSchemaAnyOf(input) {
|
|
351
432
|
if (!isSetObject(input)) return false;
|
|
@@ -354,6 +435,9 @@ function isJsonSchemaAnyOf(input) {
|
|
|
354
435
|
}
|
|
355
436
|
/**
|
|
356
437
|
* Type guard for reference schemas.
|
|
438
|
+
*
|
|
439
|
+
* @param input - The value to check.
|
|
440
|
+
* @returns True if the input is a reference schema, false otherwise.
|
|
357
441
|
*/
|
|
358
442
|
function isJsonSchemaRef(input) {
|
|
359
443
|
if (!isSetObject(input)) return false;
|
|
@@ -496,7 +580,16 @@ function isSchema(input) {
|
|
|
496
580
|
function isSchemaWithSource(input) {
|
|
497
581
|
return isSchema(input) && "source" in input && isSetObject(input.source) && "schema" in input.source && "variant" in input.source && isSetString(input.source.variant);
|
|
498
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* Type guard for Powerlines Schemas that are in Object form.
|
|
585
|
+
*
|
|
586
|
+
* @param input - The value to check.
|
|
587
|
+
* @returns True if the input is a Powerlines Schema object in Object form, false otherwise.
|
|
588
|
+
*/
|
|
589
|
+
function isSchemaObject(input) {
|
|
590
|
+
return isSchema(input) && isJsonSchemaObject(input.schema);
|
|
591
|
+
}
|
|
499
592
|
|
|
500
593
|
//#endregion
|
|
501
|
-
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, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema };
|
|
594
|
+
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, isSchemaObject, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema };
|
|
502
595
|
//# sourceMappingURL=type-checks.mjs.map
|