@superbuilders/validate 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright © 2026 Bjorn Pagen <11238136+bjornpagen@users.noreply.github.com>
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # @superbuilders/validate
2
+
3
+ JSON Schema Draft 7 validation primitives for Superbuilders applications.
4
+
5
+ This package is a small, typed wrapper around AJV. It gives one compiled schema artifact that works as:
6
+
7
+ - an AJV-backed parser
8
+ - a Standard Schema validator
9
+ - a Standard JSON Schema provider
10
+ - an AI SDK structured-output schema input
11
+
12
+ It deliberately does not transform data. It validates unknown input and returns the same value with a narrowed TypeScript type when validation succeeds.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ bun add @superbuilders/validate
18
+ ```
19
+
20
+ ```bash
21
+ npm install @superbuilders/validate
22
+ ```
23
+
24
+ ## Basic Usage
25
+
26
+ ```typescript
27
+ import * as validate from "@superbuilders/validate"
28
+
29
+ const UserSchema = validate.compile({
30
+ type: "object",
31
+ additionalProperties: false,
32
+ required: ["id", "email"],
33
+ properties: {
34
+ id: { type: "string", minLength: 1 },
35
+ email: { type: "string", minLength: 1 }
36
+ }
37
+ } as const)
38
+
39
+ type User = validate.Infer<typeof UserSchema>
40
+
41
+ const result = UserSchema.parse(input)
42
+ if (!result.success) {
43
+ throw result.error
44
+ }
45
+
46
+ const user: User = result.data
47
+ ```
48
+
49
+ ## API
50
+
51
+ ### `validate.compile(schema)`
52
+
53
+ Compiles a JSON Schema Draft 7 schema with AJV and returns a `Validator<T>`.
54
+
55
+ ```typescript
56
+ const Schema = validate.compile({ type: "string" } as const)
57
+ ```
58
+
59
+ Do not pass explicit output generics. The output type is inferred from the schema when `json-schema-to-ts` can represent it.
60
+
61
+ ### `Schema.parse(value)`
62
+
63
+ Validates an unknown value.
64
+
65
+ ```typescript
66
+ const result = Schema.parse(value)
67
+ if (result.success) {
68
+ result.data
69
+ } else {
70
+ result.error
71
+ result.issues
72
+ }
73
+ ```
74
+
75
+ ### `validate.Infer<typeof Schema>`
76
+
77
+ Extracts the inferred output type from a compiled validator.
78
+
79
+ ```typescript
80
+ type Output = validate.Infer<typeof Schema>
81
+ ```
82
+
83
+ ### Standard Schema
84
+
85
+ Compiled validators implement `StandardSchemaV1`.
86
+
87
+ ```typescript
88
+ Schema["~standard"].validate(value)
89
+ ```
90
+
91
+ ### Standard JSON Schema
92
+
93
+ Compiled validators implement `StandardJSONSchemaV1`.
94
+
95
+ Only `target: "draft-07"` is supported.
96
+
97
+ ```typescript
98
+ const jsonSchema = Schema["~standard"].jsonSchema.input({ target: "draft-07" })
99
+ ```
100
+
101
+ Unsupported targets throw.
102
+
103
+ ## Strictness
104
+
105
+ AJV is configured with explicit strict options:
106
+
107
+ - `strict: true`
108
+ - `strictSchema: true`
109
+ - `strictNumbers: true`
110
+ - `strictTypes: true`
111
+ - `strictTuples: true`
112
+ - `strictRequired: true`
113
+ - `allowUnionTypes: false`
114
+ - `allowMatchingProperties: false`
115
+ - `validateFormats: true`
116
+ - `coerceTypes: false`
117
+ - `useDefaults: false`
118
+ - `removeAdditional: false`
119
+
120
+ Non-null `type` unions are rejected by AJV strict mode:
121
+
122
+ ```typescript
123
+ // Avoid this
124
+ { type: ["string", "number"] }
125
+
126
+ // Prefer this
127
+ { anyOf: [{ type: "string" }, { type: "number" }] }
128
+ ```
129
+
130
+ Nullable schemas are permitted:
131
+
132
+ ```typescript
133
+ { type: ["string", "null"] }
134
+ ```
135
+
136
+ ## Additional Properties
137
+
138
+ Always make `additionalProperties` explicit on object schemas.
139
+
140
+ Prefer closed objects:
141
+
142
+ ```typescript
143
+ {
144
+ type: "object",
145
+ additionalProperties: false,
146
+ required: ["id"],
147
+ properties: { id: { type: "string" } }
148
+ }
149
+ ```
150
+
151
+ Use `additionalProperties: true` only for intentional external/open-object projection boundaries, such as third-party API payloads where you validate and consume a subset of upstream fields.
152
+
153
+ ## Recursive Schemas
154
+
155
+ Recursive runtime schemas should use Draft 7 `$ref` and `definitions`.
156
+
157
+ `json-schema-to-ts` does not infer recursive schemas. For recursive data, write an explicit TypeScript domain type and expose a named parse function that validates with this library and returns `ValidationResult<YourType>`.
158
+
159
+ ## No Transforms
160
+
161
+ This library does not coerce, default, strip, or transform values.
162
+
163
+ If validation succeeds, `data` is the original value narrowed to the schema type.
@@ -0,0 +1,27 @@
1
+ import { type ErrorObject } from "ajv";
2
+ import type { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
3
+ import type { FromSchema, JSONSchema } from "json-schema-to-ts";
4
+ declare const ErrValidation: Error;
5
+ declare const ErrSchemaCompilation: Error;
6
+ declare const ErrUnsupportedSchemaTarget: Error;
7
+ declare const ErrUnsupportedSchemaDialect: Error;
8
+ type Draft07JsonSchema = JSONSchema;
9
+ type ValidationSuccess<T> = {
10
+ success: true;
11
+ data: T;
12
+ };
13
+ type ValidationFailure = {
14
+ success: false;
15
+ error: Error;
16
+ issues: ErrorObject[];
17
+ };
18
+ type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;
19
+ type Validator<T> = StandardSchemaV1<unknown, T> & StandardJSONSchemaV1<unknown, T> & {
20
+ parse(value: unknown): ValidationResult<T>;
21
+ };
22
+ type Infer<TValidator> = TValidator extends Validator<infer T> ? T : never;
23
+ declare function formatIssues(validationErrors?: readonly ErrorObject[]): string;
24
+ declare function issues(validationErrors?: readonly ErrorObject[]): StandardSchemaV1.Issue[];
25
+ declare function compile<const TSchema extends JSONSchema>(schemaSource: TSchema & Draft07JsonSchema): Validator<FromSchema<TSchema>>;
26
+ export type { Draft07JsonSchema, Infer, ValidationResult, Validator };
27
+ export { ErrSchemaCompilation, ErrUnsupportedSchemaDialect, ErrUnsupportedSchemaTarget, ErrValidation, compile, formatIssues, issues };
package/dist/index.js ADDED
@@ -0,0 +1,142 @@
1
+ // src/index.ts
2
+ import Ajv from "ajv";
3
+ import * as errors from "@superbuilders/errors";
4
+ var ErrValidation = errors.new("json schema validation");
5
+ var ErrSchemaCompilation = errors.new("json schema compilation");
6
+ var ErrUnsupportedSchemaTarget = errors.new("unsupported json schema target");
7
+ var ErrUnsupportedSchemaDialect = errors.new("unsupported json schema dialect");
8
+ var DRAFT_07_SCHEMA_URL = "http://json-schema.org/draft-07/schema#";
9
+ var ajv = new Ajv({
10
+ allErrors: true,
11
+ strict: true,
12
+ strictSchema: true,
13
+ strictNumbers: true,
14
+ strictTypes: true,
15
+ strictTuples: true,
16
+ strictRequired: true,
17
+ allowUnionTypes: false,
18
+ allowMatchingProperties: false,
19
+ validateFormats: true,
20
+ coerceTypes: false,
21
+ useDefaults: false,
22
+ removeAdditional: false
23
+ });
24
+ function formatIssues(validationErrors) {
25
+ if (validationErrors === undefined || validationErrors.length === 0) {
26
+ return "json schema validation failed";
27
+ }
28
+ return validationErrors.map(function formatIssue(issue) {
29
+ let message = issue.message;
30
+ if (message === undefined) {
31
+ message = "json schema validation failed";
32
+ }
33
+ if (issue.instancePath.length === 0) {
34
+ return message;
35
+ }
36
+ return `${issue.instancePath}: ${message}`;
37
+ }).join("; ");
38
+ }
39
+ function issues(validationErrors) {
40
+ if (validationErrors === undefined || validationErrors.length === 0) {
41
+ return [{ message: "json schema validation failed" }];
42
+ }
43
+ return validationErrors.map(function issueFromError(issue) {
44
+ const path = issue.instancePath.split("/").filter(function nonEmpty(part) {
45
+ return part.length > 0;
46
+ }).map(function pathSegment(part) {
47
+ return { key: part.replaceAll("~1", "/").replaceAll("~0", "~") };
48
+ });
49
+ let message = issue.message;
50
+ if (message === undefined) {
51
+ message = "json schema validation failed";
52
+ }
53
+ return { message, path };
54
+ });
55
+ }
56
+ function validationIssues(validationErrors) {
57
+ if (validationErrors === undefined) {
58
+ return [];
59
+ }
60
+ return validationErrors;
61
+ }
62
+ function assertDraft07SchemaDialect(schemaSource) {
63
+ if (typeof schemaSource === "boolean") {
64
+ return;
65
+ }
66
+ if (schemaSource.$schema !== undefined && schemaSource.$schema !== DRAFT_07_SCHEMA_URL) {
67
+ throw ErrUnsupportedSchemaDialect;
68
+ }
69
+ }
70
+ function draft07Schema(schemaSource) {
71
+ if (schemaSource === true) {
72
+ return { $schema: DRAFT_07_SCHEMA_URL };
73
+ }
74
+ if (schemaSource === false) {
75
+ return { $schema: DRAFT_07_SCHEMA_URL, not: {} };
76
+ }
77
+ return { $schema: DRAFT_07_SCHEMA_URL, ...structuredClone(schemaSource) };
78
+ }
79
+ function assertDraft07Target(options) {
80
+ if (options.target !== "draft-07") {
81
+ throw ErrUnsupportedSchemaTarget;
82
+ }
83
+ }
84
+ function buildValidator(schemaSource) {
85
+ assertDraft07SchemaDialect(schemaSource);
86
+ const compiledResult = errors.trySync(function compileSchema() {
87
+ return ajv.compile(schemaSource);
88
+ });
89
+ if (compiledResult.error) {
90
+ throw errors.wrap(ErrSchemaCompilation, compiledResult.error.message);
91
+ }
92
+ const compiled = compiledResult.data;
93
+ function parse(value) {
94
+ if (compiled(value)) {
95
+ return { success: true, data: value };
96
+ }
97
+ const validationErrors = validationIssues(compiled.errors === null ? undefined : compiled.errors);
98
+ return {
99
+ success: false,
100
+ error: errors.wrap(ErrValidation, formatIssues(validationErrors)),
101
+ issues: validationErrors
102
+ };
103
+ }
104
+ return {
105
+ parse,
106
+ "~standard": {
107
+ version: 1,
108
+ vendor: "@superbuilders/validate",
109
+ validate(value) {
110
+ const result = parse(value);
111
+ if (result.success) {
112
+ return { value: result.data };
113
+ }
114
+ return { issues: issues(result.issues) };
115
+ },
116
+ jsonSchema: {
117
+ input(options) {
118
+ assertDraft07Target(options);
119
+ return draft07Schema(schemaSource);
120
+ },
121
+ output(options) {
122
+ assertDraft07Target(options);
123
+ return draft07Schema(schemaSource);
124
+ }
125
+ }
126
+ }
127
+ };
128
+ }
129
+ function compile(schemaSource) {
130
+ return buildValidator(schemaSource);
131
+ }
132
+ export {
133
+ issues,
134
+ formatIssues,
135
+ compile,
136
+ ErrValidation,
137
+ ErrUnsupportedSchemaTarget,
138
+ ErrUnsupportedSchemaDialect,
139
+ ErrSchemaCompilation
140
+ };
141
+
142
+ //# debugId=C040DE77983A6A2864756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": [
5
+ "import Ajv, { type ErrorObject } from \"ajv\"\nimport type { StandardJSONSchemaV1, StandardSchemaV1 } from \"@standard-schema/spec\"\nimport * as errors from \"@superbuilders/errors\"\nimport type { FromSchema, JSONSchema } from \"json-schema-to-ts\"\n\nconst ErrValidation = errors.new(\"json schema validation\")\nconst ErrSchemaCompilation = errors.new(\"json schema compilation\")\nconst ErrUnsupportedSchemaTarget = errors.new(\"unsupported json schema target\")\nconst ErrUnsupportedSchemaDialect = errors.new(\"unsupported json schema dialect\")\nconst DRAFT_07_SCHEMA_URL = \"http://json-schema.org/draft-07/schema#\"\n\ntype Draft07JsonSchema = JSONSchema\n\ntype ValidationSuccess<T> = {\n\tsuccess: true\n\tdata: T\n}\n\ntype ValidationFailure = {\n\tsuccess: false\n\terror: Error\n\tissues: ErrorObject[]\n}\n\ntype ValidationResult<T> = ValidationSuccess<T> | ValidationFailure\n\ntype Validator<T> = StandardSchemaV1<unknown, T> &\n\tStandardJSONSchemaV1<unknown, T> & {\n\t\tparse(value: unknown): ValidationResult<T>\n\t}\n\ntype Infer<TValidator> = TValidator extends Validator<infer T> ? T : never\n\nconst ajv = new Ajv({\n\tallErrors: true,\n\tstrict: true,\n\tstrictSchema: true,\n\tstrictNumbers: true,\n\tstrictTypes: true,\n\tstrictTuples: true,\n\tstrictRequired: true,\n\tallowUnionTypes: false,\n\tallowMatchingProperties: false,\n\tvalidateFormats: true,\n\tcoerceTypes: false,\n\tuseDefaults: false,\n\tremoveAdditional: false\n})\n\nfunction formatIssues(validationErrors?: readonly ErrorObject[]): string {\n\tif (validationErrors === undefined || validationErrors.length === 0) {\n\t\treturn \"json schema validation failed\"\n\t}\n\treturn validationErrors\n\t\t.map(function formatIssue(issue) {\n\t\t\tlet message = issue.message\n\t\t\tif (message === undefined) {\n\t\t\t\tmessage = \"json schema validation failed\"\n\t\t\t}\n\t\t\tif (issue.instancePath.length === 0) {\n\t\t\t\treturn message\n\t\t\t}\n\t\t\treturn `${issue.instancePath}: ${message}`\n\t\t})\n\t\t.join(\"; \")\n}\n\nfunction issues(validationErrors?: readonly ErrorObject[]): StandardSchemaV1.Issue[] {\n\tif (validationErrors === undefined || validationErrors.length === 0) {\n\t\treturn [{ message: \"json schema validation failed\" }]\n\t}\n\treturn validationErrors.map(function issueFromError(issue) {\n\t\tconst path = issue.instancePath\n\t\t\t.split(\"/\")\n\t\t\t.filter(function nonEmpty(part) {\n\t\t\t\treturn part.length > 0\n\t\t\t})\n\t\t\t.map(function pathSegment(part) {\n\t\t\t\treturn { key: part.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\") }\n\t\t\t})\n\t\tlet message = issue.message\n\t\tif (message === undefined) {\n\t\t\tmessage = \"json schema validation failed\"\n\t\t}\n\t\treturn { message, path }\n\t})\n}\n\nfunction validationIssues(validationErrors?: ErrorObject[]): ErrorObject[] {\n\tif (validationErrors === undefined) {\n\t\treturn []\n\t}\n\treturn validationErrors\n}\n\nfunction assertDraft07SchemaDialect(schemaSource: Draft07JsonSchema): void {\n\tif (typeof schemaSource === \"boolean\") {\n\t\treturn\n\t}\n\tif (schemaSource.$schema !== undefined && schemaSource.$schema !== DRAFT_07_SCHEMA_URL) {\n\t\tthrow ErrUnsupportedSchemaDialect\n\t}\n}\n\nfunction draft07Schema(schemaSource: Draft07JsonSchema): Record<string, unknown> {\n\tif (schemaSource === true) {\n\t\treturn { $schema: DRAFT_07_SCHEMA_URL }\n\t}\n\tif (schemaSource === false) {\n\t\treturn { $schema: DRAFT_07_SCHEMA_URL, not: {} }\n\t}\n\n\treturn { $schema: DRAFT_07_SCHEMA_URL, ...structuredClone(schemaSource) }\n}\n\nfunction assertDraft07Target(options: StandardJSONSchemaV1.Options): void {\n\tif (options.target !== \"draft-07\") {\n\t\tthrow ErrUnsupportedSchemaTarget\n\t}\n}\n\nfunction buildValidator<TOutput>(schemaSource: Draft07JsonSchema): Validator<TOutput> {\n\tassertDraft07SchemaDialect(schemaSource)\n\tconst compiledResult = errors.trySync(function compileSchema() {\n\t\treturn ajv.compile<TOutput>(schemaSource)\n\t})\n\tif (compiledResult.error) {\n\t\tthrow errors.wrap(ErrSchemaCompilation, compiledResult.error.message)\n\t}\n\tconst compiled = compiledResult.data\n\n\tfunction parse(value: unknown): ValidationResult<TOutput> {\n\t\tif (compiled(value)) {\n\t\t\treturn { success: true, data: value }\n\t\t}\n\t\tconst validationErrors = validationIssues(\n\t\t\tcompiled.errors === null ? undefined : compiled.errors\n\t\t)\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: errors.wrap(ErrValidation, formatIssues(validationErrors)),\n\t\t\tissues: validationErrors\n\t\t}\n\t}\n\n\treturn {\n\t\tparse,\n\t\t\"~standard\": {\n\t\t\tversion: 1,\n\t\t\tvendor: \"@superbuilders/validate\",\n\t\t\tvalidate(value: unknown): StandardSchemaV1.Result<TOutput> {\n\t\t\t\tconst result = parse(value)\n\t\t\t\tif (result.success) {\n\t\t\t\t\treturn { value: result.data }\n\t\t\t\t}\n\t\t\t\treturn { issues: issues(result.issues) }\n\t\t\t},\n\t\t\tjsonSchema: {\n\t\t\t\tinput(options: StandardJSONSchemaV1.Options): Record<string, unknown> {\n\t\t\t\t\tassertDraft07Target(options)\n\t\t\t\t\treturn draft07Schema(schemaSource)\n\t\t\t\t},\n\t\t\t\toutput(options: StandardJSONSchemaV1.Options): Record<string, unknown> {\n\t\t\t\t\tassertDraft07Target(options)\n\t\t\t\t\treturn draft07Schema(schemaSource)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction compile<const TSchema extends JSONSchema>(\n\tschemaSource: TSchema & Draft07JsonSchema\n): Validator<FromSchema<TSchema>>\nfunction compile(schemaSource: Draft07JsonSchema): Validator<FromSchema<JSONSchema>> {\n\treturn buildValidator<FromSchema<JSONSchema>>(schemaSource)\n}\n\nexport type { Draft07JsonSchema, Infer, ValidationResult, Validator }\nexport {\n\tErrSchemaCompilation,\n\tErrUnsupportedSchemaDialect,\n\tErrUnsupportedSchemaTarget,\n\tErrValidation,\n\tcompile,\n\tformatIssues,\n\tissues\n}\n"
6
+ ],
7
+ "mappings": ";AAAA;AAEA;AAGA,IAAM,gBAAuB,WAAI,wBAAwB;AACzD,IAAM,uBAA8B,WAAI,yBAAyB;AACjE,IAAM,6BAAoC,WAAI,gCAAgC;AAC9E,IAAM,8BAAqC,WAAI,iCAAiC;AAChF,IAAM,sBAAsB;AAwB5B,IAAM,MAAM,IAAI,IAAI;AAAA,EACnB,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AAAA,EACb,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,yBAAyB;AAAA,EACzB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aAAa;AAAA,EACb,kBAAkB;AACnB,CAAC;AAED,SAAS,YAAY,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,OAAO,SAAS;AAAA,UACnB,OAAO,EAAE,OAAO,OAAO,KAAK;AAAA,QAC7B;AAAA,QACA,OAAO,EAAE,QAAQ,OAAO,OAAO,MAAM,EAAE;AAAA;AAAA,MAExC,YAAY;AAAA,QACX,KAAK,CAAC,SAAgE;AAAA,UACrE,oBAAoB,OAAO;AAAA,UAC3B,OAAO,cAAc,YAAY;AAAA;AAAA,QAElC,MAAM,CAAC,SAAgE;AAAA,UACtE,oBAAoB,OAAO;AAAA,UAC3B,OAAO,cAAc,YAAY;AAAA;AAAA,MAEnC;AAAA,IACD;AAAA,EACD;AAAA;AAMD,SAAS,OAAO,CAAC,cAAoE;AAAA,EACpF,OAAO,eAAuC,YAAY;AAAA;",
8
+ "debugId": "C040DE77983A6A2864756E2164756E21",
9
+ "names": []
10
+ }
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@superbuilders/validate",
3
+ "version": "0.1.0",
4
+ "description": "JSON Schema Draft 7 validation primitives for Superbuilders applications",
5
+ "module": "dist/index.js",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "bun run build.ts",
20
+ "typecheck": "bun --bun tsgo --noEmit && bun --bun tsc --project tsconfig.tests.json --noEmit && bun --bun tsc --project tsconfig.type-tests.json --noEmit",
21
+ "test": "bun test",
22
+ "test:watch": "bun test --watch",
23
+ "test:coverage": "bun test --coverage",
24
+ "prepublishOnly": "bun run build"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "dependencies": {
30
+ "@standard-schema/spec": "^1.1.0",
31
+ "@superbuilders/errors": "^3.0.2",
32
+ "ajv": "^8.20.0",
33
+ "json-schema-to-ts": "^3.1.1"
34
+ },
35
+ "devDependencies": {
36
+ "@types/bun": "^1.3.13",
37
+ "@typescript/native-preview": "^7.0.0-dev.20260511.1",
38
+ "typescript": "^6.0.3"
39
+ },
40
+ "keywords": [
41
+ "json-schema",
42
+ "draft-07",
43
+ "ajv",
44
+ "validation",
45
+ "standard-schema",
46
+ "standard-json-schema",
47
+ "typescript",
48
+ "superbuilders"
49
+ ],
50
+ "author": "Bjorn Pagen",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "https://github.com/primer-team/primer",
54
+ "directory": "packages/validate"
55
+ },
56
+ "peerDependencies": {
57
+ "typescript": "^6.0.3"
58
+ },
59
+ "engines": {
60
+ "node": ">=18"
61
+ },
62
+ "license": "0BSD"
63
+ }