@powerlines/schema 0.11.41 → 0.11.42
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 +0 -1
- package/dist/codegen.cjs +0 -1
- package/dist/constants.cjs +0 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.mjs +0 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/extract.cjs +23 -9
- package/dist/extract.d.cts +2 -3
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts +2 -3
- package/dist/extract.d.mts.map +1 -1
- package/dist/extract.mjs +28 -12
- package/dist/extract.mjs.map +1 -1
- package/dist/helpers.cjs +0 -1
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +30 -4
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +30 -4
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -3
- package/dist/metadata.cjs +1 -2
- package/dist/metadata.d.cts.map +1 -1
- package/dist/metadata.d.mts.map +1 -1
- package/dist/metadata.mjs +1 -1
- package/dist/metadata.mjs.map +1 -1
- package/dist/persistence.cjs +0 -1
- package/dist/reflection.cjs +0 -1
- package/dist/resolve.cjs +0 -1
- package/dist/type-checks.cjs +27 -2
- package/dist/type-checks.d.cts +17 -1
- package/dist/type-checks.d.cts.map +1 -1
- package/dist/type-checks.d.mts +17 -1
- package/dist/type-checks.d.mts.map +1 -1
- package/dist/type-checks.mjs +25 -1
- package/dist/type-checks.mjs.map +1 -1
- package/dist/types.d.cts +34 -19
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +34 -19
- package/dist/types.d.mts.map +1 -1
- package/dist/validate.cjs +1 -12
- package/dist/validate.mjs +1 -10
- package/dist/validate.mjs.map +1 -1
- package/package.json +20 -53
- package/dist/types.cjs +0 -0
- package/dist/types.mjs +0 -1
- package/dist/validate.d.cts +0 -21
- package/dist/validate.d.cts.map +0 -1
- package/dist/validate.d.mts +0 -21
- package/dist/validate.d.mts.map +0 -1
package/dist/types.d.mts
CHANGED
|
@@ -2,12 +2,14 @@ import { Type } from "@powerlines/deepkit/vendor/type";
|
|
|
2
2
|
import { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
4
|
import { FormatName } from "ajv-formats/dist/formats.js";
|
|
5
|
-
import { InputObject, Schema
|
|
5
|
+
import { InputObject, Schema } from "untyped";
|
|
6
|
+
import { BaseIssue, BaseSchema } from "valibot";
|
|
6
7
|
import * as z3 from "zod/v3";
|
|
7
8
|
|
|
8
9
|
//#region src/types.d.ts
|
|
9
10
|
type UntypedInputObject = InputObject;
|
|
10
|
-
type UntypedSchema = Schema
|
|
11
|
+
type UntypedSchema = Schema;
|
|
12
|
+
type ValibotSchema<TInput = unknown, TOutput = unknown, TIssue extends BaseIssue<unknown> = BaseIssue<unknown>> = BaseSchema<TInput, TOutput, TIssue>;
|
|
11
13
|
/**
|
|
12
14
|
* JSON Schema primitive type names used by {@link stringifyType}.
|
|
13
15
|
*/
|
|
@@ -155,17 +157,28 @@ type UncheckedJsonSchemaType<T, IsPartial extends boolean> = ({
|
|
|
155
157
|
*/
|
|
156
158
|
$comment?: string;
|
|
157
159
|
/**
|
|
158
|
-
* A record of schema definitions that can be referenced throughout the schema using
|
|
160
|
+
* A record of schema definitions that can be referenced throughout the schema using {@link UncheckedJsonSchemaType.$ref}. This property can be used to define reusable schema components and reduce redundancy in schema definitions. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
159
161
|
*/
|
|
160
162
|
$defs?: Record<string, UncheckedJsonSchemaType<Known, true>>;
|
|
161
|
-
/**
|
|
162
|
-
* A record of schema definitions that can be referenced throughout the schema using `$ref`. This property is a legacy version of `$defs` and is maintained for backward compatibility with earlier versions of the JSON Schema specification. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
163
|
-
*/
|
|
164
|
-
definitions?: Record<string, UncheckedJsonSchemaType<Known, true>>;
|
|
165
163
|
/**
|
|
166
164
|
* A name for the schema, which can be used by documentation tools or other libraries that support this feature to provide a human-readable name or description for the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
167
165
|
*/
|
|
168
166
|
name?: string;
|
|
167
|
+
/**
|
|
168
|
+
* A unique identifier for the schema, which can be used to reference or identify the schema in various contexts. This property is part of the JSON Schema specification and does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
169
|
+
*
|
|
170
|
+
* @remarks
|
|
171
|
+
* This property is a legacy version of {@link UncheckedJsonSchemaType.$id} and is maintained for backward compatibility with earlier versions of the JSON Schema specification. The presence of this property does not affect the validation behavior of the schema itself, but it can be used to reference or identify the schema in various contexts when used in conjunction with compatible tools.
|
|
172
|
+
*
|
|
173
|
+
* @deprecated Use {@link UncheckedJsonSchemaType.$id} instead.
|
|
174
|
+
*/
|
|
175
|
+
id?: string;
|
|
176
|
+
/**
|
|
177
|
+
* A record of schema definitions that can be referenced throughout the schema using {@link UncheckedJsonSchemaType.$ref}. This property is a legacy version of {@link UncheckedJsonSchemaType.$defs} and is maintained for backward compatibility with earlier versions of the JSON Schema specification. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
178
|
+
*
|
|
179
|
+
* @deprecated Use {@link UncheckedJsonSchemaType.$defs} instead.
|
|
180
|
+
*/
|
|
181
|
+
definitions?: Record<string, UncheckedJsonSchemaType<Known, true>>;
|
|
169
182
|
[keyword: string]: any;
|
|
170
183
|
};
|
|
171
184
|
interface SchemaMetadata {
|
|
@@ -184,7 +197,7 @@ interface SchemaMetadata {
|
|
|
184
197
|
/**
|
|
185
198
|
* An array of example values that conform to the schema. This property can be used to provide sample data for documentation purposes or to assist developers in understanding the expected structure and content of the data that the schema represents. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the expected data when used in conjunction with compatible tools.
|
|
186
199
|
*/
|
|
187
|
-
examples?:
|
|
200
|
+
examples?: unknown[];
|
|
188
201
|
/**
|
|
189
202
|
* An array of strings or an alias reference to indicate that the field is an alias for one or more other fields.
|
|
190
203
|
*/
|
|
@@ -193,10 +206,6 @@ interface SchemaMetadata {
|
|
|
193
206
|
* An array of strings indicating groups that the schema belongs to. This property can be used for organizational or categorization purposes in documentation tools or other libraries that support this feature. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
194
207
|
*/
|
|
195
208
|
tags?: string[];
|
|
196
|
-
/**
|
|
197
|
-
* A visibility level for the schema, which can be used by documentation tools or other libraries that support this feature to determine how the schema should be presented or accessed. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
198
|
-
*/
|
|
199
|
-
visibility?: "public" | "protected" | "private";
|
|
200
209
|
/**
|
|
201
210
|
* An indicator specifying if the field is deprecated or not. This property can be used by documentation tools or other libraries that support this feature to provide additional information or warnings about the usage of the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
202
211
|
*/
|
|
@@ -259,15 +268,15 @@ type JsonSchemaObject<T extends Record<string, any> = Record<string, any>> = Omi
|
|
|
259
268
|
properties: Record<string, JsonSchemaProperty<T>>; /** The property names that are required on the object. */
|
|
260
269
|
required?: string[];
|
|
261
270
|
} & SchemaMetadata;
|
|
262
|
-
type SchemaSourceVariant = "standard-schema" | "json-schema" | "zod3" | "untyped" | "reflection";
|
|
271
|
+
type SchemaSourceVariant = "standard-schema" | "json-schema" | "zod3" | "untyped" | "valibot" | "reflection";
|
|
263
272
|
type SchemaInputVariant = SchemaSourceVariant | "type-definition";
|
|
264
|
-
type SchemaSourceInput<T = unknown> = StandardJSONSchemaV1 | JsonSchema<T> | z3.ZodTypeAny | UntypedInputObject | UntypedSchema | Type;
|
|
273
|
+
type SchemaSourceInput<T = unknown> = StandardJSONSchemaV1 | JsonSchema<T> | z3.ZodTypeAny | UntypedInputObject | UntypedSchema | ValibotSchema | Type;
|
|
265
274
|
type TypeDefinitionReference = TypeDefinition | string;
|
|
266
|
-
type SchemaInput<T = unknown> = SchemaSourceInput<T> | Schema<T> | TypeDefinitionReference;
|
|
275
|
+
type SchemaInput<T = unknown> = SchemaSourceInput<T> | Schema$1<T> | TypeDefinitionReference;
|
|
267
276
|
/**
|
|
268
277
|
* A schema extracted from a source input, normalized to JSON Schema.
|
|
269
278
|
*/
|
|
270
|
-
interface Schema<T = unknown> {
|
|
279
|
+
interface Schema$1<T = unknown> {
|
|
271
280
|
/** A stable content hash for the normalized schema. */
|
|
272
281
|
hash: string;
|
|
273
282
|
/** The source variant used to derive the normalized {@link JsonSchema}. */
|
|
@@ -313,11 +322,17 @@ interface UntypedSchemaSource extends BaseSchemaSource {
|
|
|
313
322
|
/** The original Untyped schema input. */
|
|
314
323
|
schema: UntypedInputObject | UntypedSchema;
|
|
315
324
|
}
|
|
316
|
-
|
|
317
|
-
|
|
325
|
+
interface ValibotSchemaSource extends BaseSchemaSource {
|
|
326
|
+
/** Indicates the source input comes from the Valibot schema model. */
|
|
327
|
+
variant: "valibot";
|
|
328
|
+
/** The original Valibot schema input. */
|
|
329
|
+
schema: ValibotSchema;
|
|
330
|
+
}
|
|
331
|
+
type SchemaSource = JsonSchemaSchemaSource | StandardSchemaSchemaSource | Zod3SchemaSource | UntypedSchemaSource | ValibotSchemaSource | ReflectionSchemaSource;
|
|
332
|
+
interface ExtractedSchema<T = unknown> extends Schema$1<T> {
|
|
318
333
|
/** The schema source that produced this normalized schema. */
|
|
319
334
|
source: SchemaSource;
|
|
320
335
|
}
|
|
321
336
|
//#endregion
|
|
322
|
-
export { BaseSchemaSource, ExtractedSchema, JsonSchema, JsonSchemaLike, JsonSchemaNullable, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaProperty, JsonSchemaSchemaSource, JsonType, NumberFormat, NumberKeywords, ReflectionSchemaSource, Schema, SchemaInput, SchemaInputVariant, SchemaMetadata, SchemaSource, SchemaSourceInput, SchemaSourceVariant, StandardSchemaSchemaSource, StringKeywords, TypeDefinitionReference, UntypedInputObject, UntypedSchema, UntypedSchemaSource, Zod3SchemaSource };
|
|
337
|
+
export { BaseSchemaSource, ExtractedSchema, JsonSchema, JsonSchemaLike, JsonSchemaNullable, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaProperty, JsonSchemaSchemaSource, JsonType, NumberFormat, NumberKeywords, ReflectionSchemaSource, Schema$1 as Schema, SchemaInput, SchemaInputVariant, SchemaMetadata, SchemaSource, SchemaSourceInput, SchemaSourceVariant, StandardSchemaSchemaSource, StringKeywords, TypeDefinitionReference, UntypedInputObject, UntypedSchema, UntypedSchemaSource, ValibotSchema, ValibotSchemaSource, Zod3SchemaSource };
|
|
323
338
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;KA0BY,kBAAA,GAAqB,WAAW;AAAA,KAChC,aAAA,GAAgB,MAAO;AAAA,KAEvB,aAAA,qDAGK,SAAA,YAAqB,SAAA,aAClC,UAAA,CAAW,MAAA,EAAQ,OAAA,EAAS,MAAA;;;;KAKpB,uBAAA;AAAA,KASP,uBAAA,2GACmD,IAAA,KACpD,IAAI;AAAA,KAEH,mBAAA,OAA0B,CAAA,gBAAiB,CAAA,EAAG,CAAC,6BAClD,CAAA,sBAEE,CAAA;;;AA3B+B;KAiCvB,cAAA,GAAiB,uBAAA,CAAwB,KAAA,UACnD,cAAA;AAAA,KAEG,sBAAA,MAA4B,OAAA,CAAQ,uBAAA,CAAwB,CAAA;AAAA,KAErD,Q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AAA,CAAW,CAAA;AAAA;AAAA,UAGJ,gBAAA;EAvKK;EAyKpB,IAAA;EA3Z8B;EA8Z9B,OAAA,EAAS,mBAAA;EA5ZW;EA+ZpB,MAAA,EAAQ,iBAAA,CAAkB,CAAA;AAAA;AAAA,UAGX,sBAAA,sBAEP,gBAAA,CAAiB,CAAA;EAjaL;EAmapB,OAAA;EAna+C;EAsa/C,MAAA,EAAQ,UAAA,CAAW,CAAA;AAAA;AAAA,UAGJ,0BAAA,SAAmC,gBAAgB;EAra3B;EAuavC,OAAA;EAraU;EAwaV,MAAA,EAAQ,oBAAA;AAAA;AAAA,UAGO,gBAAA,SAAyB,gBAAgB;EAzaxB;EA2ahC,OAAA;EAxaI;EA2aJ,MAAA,EAAQ,EAAA,CAAG,UAAA;AAAA;AAAA,UAGI,sBAAA,SAA+B,gBAAgB;EA1apD;EA4aV,OAAA;EAraQ;EAwaR,MAAA,EAAQ,IAAA;AAAA;AAAA,UAGO,mBAAA,SAA4B,gBAAA;EAzarC;EA2aN,OAAA;EAzagB;EA4ahB,MAAA,EAAQ,kBAAA,GAAqB,aAAA;AAAA;AAAA,UAGd,mBAAA,SAA4B,gBAAgB;EA3a/C;EA6aZ,OAAA;EA7asC;EAgbtC,MAAA,EAAQ,aAAA;AAAA;AAAA,KAGE,YAAA,GACR,sBAAA,GACA,0BAAA,GACA,gBAAA,GACA,mBAAA,GACA,mBAAA,GACA,sBAAA;AAAA,UAEa,eAAA,sBAAqC,QAAA,CAAO,CAAA;EApb7C;EAsbd,MAAA,EAAQ,YAAA;AAAA"}
|
package/dist/validate.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
1
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
let ajv = require("ajv");
|
|
4
3
|
ajv = require_runtime.__toESM(ajv, 1);
|
|
@@ -23,16 +22,6 @@ function getValidator(schema) {
|
|
|
23
22
|
(0, ajv_formats.default)(ajv$1);
|
|
24
23
|
return ajv$1;
|
|
25
24
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Gets a validation function for a given JSON Schema.
|
|
28
|
-
*
|
|
29
|
-
* @param schema - The JSON Schema to create a validation function for.
|
|
30
|
-
* @returns A function that validates data against the schema and returns a boolean indicating validity.
|
|
31
|
-
*/
|
|
32
|
-
function getValidatorFunction(schema) {
|
|
33
|
-
return getValidator(schema).compile(schema);
|
|
34
|
-
}
|
|
35
25
|
|
|
36
26
|
//#endregion
|
|
37
|
-
exports.getValidator = getValidator;
|
|
38
|
-
exports.getValidatorFunction = getValidatorFunction;
|
|
27
|
+
exports.getValidator = getValidator;
|
package/dist/validate.mjs
CHANGED
|
@@ -19,16 +19,7 @@ function getValidator(schema) {
|
|
|
19
19
|
addFormats(ajv);
|
|
20
20
|
return ajv;
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Gets a validation function for a given JSON Schema.
|
|
24
|
-
*
|
|
25
|
-
* @param schema - The JSON Schema to create a validation function for.
|
|
26
|
-
* @returns A function that validates data against the schema and returns a boolean indicating validity.
|
|
27
|
-
*/
|
|
28
|
-
function getValidatorFunction(schema) {
|
|
29
|
-
return getValidator(schema).compile(schema);
|
|
30
|
-
}
|
|
31
22
|
|
|
32
23
|
//#endregion
|
|
33
|
-
export { getValidator
|
|
24
|
+
export { getValidator };
|
|
34
25
|
//# sourceMappingURL=validate.mjs.map
|
package/dist/validate.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.mjs","names":[],"sources":["../src/validate.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 Ajv, { ValidateFunction } from \"ajv\";\nimport addFormats from \"ajv-formats\";\nimport { JsonSchema } from \"./types\";\n\n/**\n * Gets an Ajv validator instance for a given JSON Schema.\n *\n * @param schema - The JSON Schema to create a validator for.\n * @returns An Ajv instance with the schema added.\n */\nexport function getValidator<T = unknown>(schema: JsonSchema<T>): Ajv {\n const ajv = new Ajv({\n schemas: [schema],\n code: { source: true, esm: true }\n });\n\n addFormats(ajv);\n\n return ajv;\n}\n\n/**\n * Gets a validation function for a given JSON Schema.\n *\n * @param schema - The JSON Schema to create a validation function for.\n * @returns A function that validates data against the schema and returns a boolean indicating validity.\n */\nexport function getValidatorFunction<T = unknown>(\n schema: JsonSchema<T>\n): ValidateFunction<T> {\n const ajv = getValidator(schema);\n\n return ajv.compile<T>(schema);\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,aAA0B,QAA4B;CACpE,MAAM,MAAM,IAAI,IAAI;EAClB,SAAS,CAAC,MAAM;EAChB,MAAM;GAAE,QAAQ;GAAM,KAAK;EAAK;CAClC,CAAC;CAED,WAAW,GAAG;CAEd,OAAO;AACT
|
|
1
|
+
{"version":3,"file":"validate.mjs","names":[],"sources":["../src/validate.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 Ajv, { ValidateFunction } from \"ajv\";\nimport addFormats from \"ajv-formats\";\nimport { JsonSchema } from \"./types\";\n\n/**\n * Gets an Ajv validator instance for a given JSON Schema.\n *\n * @param schema - The JSON Schema to create a validator for.\n * @returns An Ajv instance with the schema added.\n */\nexport function getValidator<T = unknown>(schema: JsonSchema<T>): Ajv {\n const ajv = new Ajv({\n schemas: [schema],\n code: { source: true, esm: true }\n });\n\n addFormats(ajv);\n\n return ajv;\n}\n\n/**\n * Gets a validation function for a given JSON Schema.\n *\n * @param schema - The JSON Schema to create a validation function for.\n * @returns A function that validates data against the schema and returns a boolean indicating validity.\n */\nexport function getValidatorFunction<T = unknown>(\n schema: JsonSchema<T>\n): ValidateFunction<T> {\n const ajv = getValidator(schema);\n\n return ajv.compile<T>(schema);\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,aAA0B,QAA4B;CACpE,MAAM,MAAM,IAAI,IAAI;EAClB,SAAS,CAAC,MAAM;EAChB,MAAM;GAAE,QAAQ;GAAM,KAAK;EAAK;CAClC,CAAC;CAED,WAAW,GAAG;CAEd,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/schema",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.42",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"zod",
|
|
8
8
|
"valibot",
|
|
9
9
|
"deepkit",
|
|
10
|
+
"untyped",
|
|
10
11
|
"ajv",
|
|
11
12
|
"standard-schema",
|
|
12
13
|
"json-schema",
|
|
@@ -50,51 +51,6 @@
|
|
|
50
51
|
"type": "module",
|
|
51
52
|
"exports": {
|
|
52
53
|
".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
|
|
53
|
-
"./bundle": {
|
|
54
|
-
"import": "./dist/bundle.mjs",
|
|
55
|
-
"require": "./dist/bundle.cjs"
|
|
56
|
-
},
|
|
57
|
-
"./codegen": {
|
|
58
|
-
"import": "./dist/codegen.mjs",
|
|
59
|
-
"require": "./dist/codegen.cjs"
|
|
60
|
-
},
|
|
61
|
-
"./constants": {
|
|
62
|
-
"import": "./dist/constants.mjs",
|
|
63
|
-
"require": "./dist/constants.cjs"
|
|
64
|
-
},
|
|
65
|
-
"./extract": {
|
|
66
|
-
"import": "./dist/extract.mjs",
|
|
67
|
-
"require": "./dist/extract.cjs"
|
|
68
|
-
},
|
|
69
|
-
"./helpers": {
|
|
70
|
-
"import": "./dist/helpers.mjs",
|
|
71
|
-
"require": "./dist/helpers.cjs"
|
|
72
|
-
},
|
|
73
|
-
"./metadata": {
|
|
74
|
-
"import": "./dist/metadata.mjs",
|
|
75
|
-
"require": "./dist/metadata.cjs"
|
|
76
|
-
},
|
|
77
|
-
"./persistence": {
|
|
78
|
-
"import": "./dist/persistence.mjs",
|
|
79
|
-
"require": "./dist/persistence.cjs"
|
|
80
|
-
},
|
|
81
|
-
"./reflection": {
|
|
82
|
-
"import": "./dist/reflection.mjs",
|
|
83
|
-
"require": "./dist/reflection.cjs"
|
|
84
|
-
},
|
|
85
|
-
"./resolve": {
|
|
86
|
-
"import": "./dist/resolve.mjs",
|
|
87
|
-
"require": "./dist/resolve.cjs"
|
|
88
|
-
},
|
|
89
|
-
"./type-checks": {
|
|
90
|
-
"import": "./dist/type-checks.mjs",
|
|
91
|
-
"require": "./dist/type-checks.cjs"
|
|
92
|
-
},
|
|
93
|
-
"./types": { "import": "./dist/types.mjs", "require": "./dist/types.cjs" },
|
|
94
|
-
"./validate": {
|
|
95
|
-
"import": "./dist/validate.mjs",
|
|
96
|
-
"require": "./dist/validate.cjs"
|
|
97
|
-
},
|
|
98
54
|
"./package.json": "./package.json"
|
|
99
55
|
},
|
|
100
56
|
"main": "./dist/index.cjs",
|
|
@@ -103,9 +59,9 @@
|
|
|
103
59
|
"typings": "dist/index.d.mts",
|
|
104
60
|
"files": ["dist"],
|
|
105
61
|
"dependencies": {
|
|
106
|
-
"@powerlines/core": "^0.48.
|
|
107
|
-
"@powerlines/deepkit": "^0.9.
|
|
108
|
-
"@powerlines/unplugin": "^0.0.
|
|
62
|
+
"@powerlines/core": "^0.48.5",
|
|
63
|
+
"@powerlines/deepkit": "^0.9.37",
|
|
64
|
+
"@powerlines/unplugin": "^0.0.53",
|
|
109
65
|
"@standard-schema/spec": "^1.1.0",
|
|
110
66
|
"@stryke/hash": "^0.13.29",
|
|
111
67
|
"@stryke/helpers": "^0.10.16",
|
|
@@ -114,6 +70,7 @@
|
|
|
114
70
|
"@stryke/type-checks": "^0.6.9",
|
|
115
71
|
"@stryke/types": "^0.12.4",
|
|
116
72
|
"@stryke/zod": "^0.3.22",
|
|
73
|
+
"@valibot/to-json-schema": "^1.7.0",
|
|
117
74
|
"ajv": "^8.20.0",
|
|
118
75
|
"ajv-formats": "^3.0.1",
|
|
119
76
|
"defu": "^6.1.7",
|
|
@@ -121,9 +78,19 @@
|
|
|
121
78
|
"typescript": "^6.0.3",
|
|
122
79
|
"untyped": "^1.5.2"
|
|
123
80
|
},
|
|
124
|
-
"devDependencies": {
|
|
125
|
-
|
|
126
|
-
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"@types/node": "^25.9.1",
|
|
83
|
+
"valibot": "^1.4.0",
|
|
84
|
+
"zod": "^4.4.3"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"zod": "^3.25.0 || ^4.0.0",
|
|
88
|
+
"valibot": "^1.4.0 || ^1.5.0"
|
|
89
|
+
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"zod": { "optional": true },
|
|
92
|
+
"valibot": { "optional": true }
|
|
93
|
+
},
|
|
127
94
|
"publishConfig": { "access": "public" },
|
|
128
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "6ca3515304ea3e458094bd7650a9bfbe0681a124"
|
|
129
96
|
}
|
package/dist/types.cjs
DELETED
|
File without changes
|
package/dist/types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/validate.d.cts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { JsonSchema } from "./types.cjs";
|
|
2
|
-
import Ajv, { ValidateFunction } from "ajv";
|
|
3
|
-
|
|
4
|
-
//#region src/validate.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Gets an Ajv validator instance for a given JSON Schema.
|
|
7
|
-
*
|
|
8
|
-
* @param schema - The JSON Schema to create a validator for.
|
|
9
|
-
* @returns An Ajv instance with the schema added.
|
|
10
|
-
*/
|
|
11
|
-
declare function getValidator<T = unknown>(schema: JsonSchema<T>): Ajv;
|
|
12
|
-
/**
|
|
13
|
-
* Gets a validation function for a given JSON Schema.
|
|
14
|
-
*
|
|
15
|
-
* @param schema - The JSON Schema to create a validation function for.
|
|
16
|
-
* @returns A function that validates data against the schema and returns a boolean indicating validity.
|
|
17
|
-
*/
|
|
18
|
-
declare function getValidatorFunction<T = unknown>(schema: JsonSchema<T>): ValidateFunction<T>;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { getValidator, getValidatorFunction };
|
|
21
|
-
//# sourceMappingURL=validate.d.cts.map
|
package/dist/validate.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.cts","names":[],"sources":["../src/validate.ts"],"mappings":";;;;;;AA4BA;;;;iBAAgB,YAAA,aAAA,CAA0B,MAAA,EAAQ,UAAA,CAAW,CAAA,IAAK,GAAA;;;;;;;iBAiBlD,oBAAA,aAAA,CACd,MAAA,EAAQ,UAAA,CAAW,CAAA,IAClB,gBAAA,CAAiB,CAAA"}
|
package/dist/validate.d.mts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { JsonSchema } from "./types.mjs";
|
|
2
|
-
import Ajv, { ValidateFunction } from "ajv";
|
|
3
|
-
|
|
4
|
-
//#region src/validate.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Gets an Ajv validator instance for a given JSON Schema.
|
|
7
|
-
*
|
|
8
|
-
* @param schema - The JSON Schema to create a validator for.
|
|
9
|
-
* @returns An Ajv instance with the schema added.
|
|
10
|
-
*/
|
|
11
|
-
declare function getValidator<T = unknown>(schema: JsonSchema<T>): Ajv;
|
|
12
|
-
/**
|
|
13
|
-
* Gets a validation function for a given JSON Schema.
|
|
14
|
-
*
|
|
15
|
-
* @param schema - The JSON Schema to create a validation function for.
|
|
16
|
-
* @returns A function that validates data against the schema and returns a boolean indicating validity.
|
|
17
|
-
*/
|
|
18
|
-
declare function getValidatorFunction<T = unknown>(schema: JsonSchema<T>): ValidateFunction<T>;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { getValidator, getValidatorFunction };
|
|
21
|
-
//# sourceMappingURL=validate.d.mts.map
|
package/dist/validate.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.mts","names":[],"sources":["../src/validate.ts"],"mappings":";;;;;;AA4BA;;;;iBAAgB,YAAA,aAAA,CAA0B,MAAA,EAAQ,UAAA,CAAW,CAAA,IAAK,GAAA;;;;;;;iBAiBlD,oBAAA,aAAA,CACd,MAAA,EAAQ,UAAA,CAAW,CAAA,IAClB,gBAAA,CAAiB,CAAA"}
|