@powerlines/schema 0.11.56 → 0.11.57

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/extract.cjs CHANGED
@@ -246,11 +246,11 @@ function extractReflection(reflection) {
246
246
  */
247
247
  function extractJsonSchema(schema) {
248
248
  if ((0, _stryke_type_checks_is_set_object.isSetObject)(schema)) {
249
- if ((0, _stryke_zod.isZod3Type)(schema)) return (0, _stryke_zod.extractJsonSchema)(schema);
249
+ if ((0, _stryke_zod.isZod3Type)(schema)) return (0, _stryke_zod.extractJsonSchema)(schema, { target: "draft-2020-12" });
250
+ if (require_type_checks.isUntypedInputStrict(schema)) return convertUntypedInputToJsonSchema(schema);
251
+ if (require_type_checks.isUntypedSchemaStrict(schema)) return convertUntypedSchemaToJsonSchema(schema);
250
252
  if ((0, _stryke_json.isStandardJsonSchema)(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-2020-12" });
251
253
  if (require_type_checks.isValibotSchema(schema)) return convertValibotSchemaToJsonSchema(schema);
252
- if (require_type_checks.isUntypedInput(schema)) return convertUntypedInputToJsonSchema(schema);
253
- if (require_type_checks.isUntypedSchema(schema)) return convertUntypedSchemaToJsonSchema(schema);
254
254
  if (require_type_checks.isJsonSchema(schema)) return schema;
255
255
  }
256
256
  }
@@ -265,11 +265,11 @@ function extractResolvedVariant(input) {
265
265
  if (typeof input === "boolean") return "json-schema";
266
266
  if ((0, _stryke_type_checks_is_set_object.isSetObject)(input)) {
267
267
  if ((0, _stryke_zod.isZod3Type)(input)) return "zod3";
268
+ else if (require_type_checks.isUntypedInputStrict(input) || require_type_checks.isUntypedSchemaStrict(input)) return "untyped";
268
269
  else if ((0, _stryke_json.isStandardJsonSchema)(input)) return "standard-schema";
269
270
  else if (require_type_checks.isJsonSchema(input)) return "json-schema";
270
271
  else if (require_type_checks.isValibotSchema(input)) return "valibot";
271
272
  else if ((0, _powerlines_deepkit_vendor_type.isType)(input)) return "reflection";
272
- else if (require_type_checks.isUntypedInput(input) || require_type_checks.isUntypedSchema(input)) return "untyped";
273
273
  }
274
274
  throw new Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`);
275
275
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;AAuOA;;;;iBAAgB,gBAAA,CAAiB,MAAA,EAAQ,UAAA,GAAa,UAAU;;;;iBAgMhD,WAAA,CACd,OAAA,EAAS,kBAAA,EACT,KAAA,EAAO,WAAW;AAFpB;;;AAAA,iBA2CgB,iBAAA,CAAkB,UAAA,EAAY,IAAA,GAAO,UAAU;;;;iBAW/C,iBAAA,CAAkB,MAAA,YAAkB,UAAU;;AApD1C;AAyCpB;;;;;iBA6CgB,sBAAA,CACd,KAAA,EAAO,iBAAA,GACN,mBAAmB;;;AA/CyC;AAW/D;;;iBAoEgB,cAAA,CAAe,KAAA,EAAO,WAAA,GAAc,kBAAkB;AApER;AAkC9D;;;;;;;AAlC8D,iBAoFxC,aAAA,CACpB,KAAA,EAAO,iBAAA,EACP,OAAA,GAAU,kBAAA,GACT,OAAA,CAAQ,UAAA;AAnDW;AAgCtB;;;;;;;AAhCsB,iBAwFN,aAAA,CACd,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,iBAAA,GACN,YAAA;AA3DmE;AAgBtE;;;;;;;;;;;;;;;;AAGqB;AAqCrB;;;;;;;;;AAxDsE,iBAkIhD,uBAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,eAAA;;;;;AA3EI;AAuEf;;;;;;;;;;;;;;;;;;;AAI0B;AA6F1B;;;;;iBAAsB,OAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,MAAA"}
1
+ {"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;AAyOA;;;;iBAAgB,gBAAA,CAAiB,MAAA,EAAQ,UAAA,GAAa,UAAU;;;;iBAgMhD,WAAA,CACd,OAAA,EAAS,kBAAA,EACT,KAAA,EAAO,WAAW;AAFpB;;;AAAA,iBA2CgB,iBAAA,CAAkB,UAAA,EAAY,IAAA,GAAO,UAAU;;;;iBAW/C,iBAAA,CAAkB,MAAA,YAAkB,UAAU;;AApD1C;AAyCpB;;;;;iBA+CgB,sBAAA,CACd,KAAA,EAAO,iBAAA,GACN,mBAAmB;;;AAjDyC;AAW/D;;;iBAsEgB,cAAA,CAAe,KAAA,EAAO,WAAA,GAAc,kBAAkB;AAtER;AAoC9D;;;;;;;AApC8D,iBAsFxC,aAAA,CACpB,KAAA,EAAO,iBAAA,EACP,OAAA,GAAU,kBAAA,GACT,OAAA,CAAQ,UAAA;AAnDW;AAgCtB;;;;;;;AAhCsB,iBAwFN,aAAA,CACd,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,iBAAA,GACN,YAAA;AA3DmE;AAgBtE;;;;;;;;;;;;;;;;AAGqB;AAqCrB;;;;;;;;;AAxDsE,iBAkIhD,uBAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,eAAA;;;;;AA3EI;AAuEf;;;;;;;;;;;;;;;;;;;AAI0B;AA6F1B;;;;;iBAAsB,OAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,MAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.mts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;AAuOA;;;;iBAAgB,gBAAA,CAAiB,MAAA,EAAQ,UAAA,GAAa,UAAU;;;;iBAgMhD,WAAA,CACd,OAAA,EAAS,kBAAA,EACT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,GACN,mBAAmB;;;AAjDyC;AAW/D;;;iBAsEgB,cAAA,CAAe,KAAA,EAAO,WAAA,GAAc,kBAAkB;AAtER;AAoC9D;;;;;;;AApC8D,iBAsFxC,aAAA,CACpB,KAAA,EAAO,iBAAA,EACP,OAAA,GAAU,kBAAA,GACT,OAAA,CAAQ,UAAA;AAnDW;AAgCtB;;;;;;;AAhCsB,iBAwFN,aAAA,CACd,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,iBAAA,GACN,YAAA;AA3DmE;AAgBtE;;;;;;;;;;;;;;;;AAGqB;AAqCrB;;;;;;;;;AAxDsE,iBAkIhD,uBAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,eAAA;;;;;AA3EI;AAuEf;;;;;;;;;;;;;;;;;;;AAI0B;AA6F1B;;;;;iBAAsB,OAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,MAAA"}
package/dist/extract.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { isJsonSchema, isJsonSchemaObject, isSchema, isSchemaWithSource, isUntypedInput, isUntypedSchema, isValibotSchema } from "./type-checks.mjs";
1
+ import { isJsonSchema, isJsonSchemaObject, isSchema, isSchemaWithSource, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema } from "./type-checks.mjs";
2
2
  import { getCacheDirectory, writeSchema } from "./persistence.mjs";
3
3
  import { reflectionToJsonSchema } from "./reflection.mjs";
4
4
  import { resolve } from "./resolve.mjs";
@@ -244,11 +244,11 @@ function extractReflection(reflection) {
244
244
  */
245
245
  function extractJsonSchema$1(schema) {
246
246
  if (isSetObject$1(schema)) {
247
- if (isZod3Type(schema)) return extractJsonSchema(schema);
247
+ if (isZod3Type(schema)) return extractJsonSchema(schema, { target: "draft-2020-12" });
248
+ if (isUntypedInputStrict(schema)) return convertUntypedInputToJsonSchema(schema);
249
+ if (isUntypedSchemaStrict(schema)) return convertUntypedSchemaToJsonSchema(schema);
248
250
  if (isStandardJsonSchema(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-2020-12" });
249
251
  if (isValibotSchema(schema)) return convertValibotSchemaToJsonSchema(schema);
250
- if (isUntypedInput(schema)) return convertUntypedInputToJsonSchema(schema);
251
- if (isUntypedSchema(schema)) return convertUntypedSchemaToJsonSchema(schema);
252
252
  if (isJsonSchema(schema)) return schema;
253
253
  }
254
254
  }
@@ -263,11 +263,11 @@ function extractResolvedVariant(input) {
263
263
  if (typeof input === "boolean") return "json-schema";
264
264
  if (isSetObject$1(input)) {
265
265
  if (isZod3Type(input)) return "zod3";
266
+ else if (isUntypedInputStrict(input) || isUntypedSchemaStrict(input)) return "untyped";
266
267
  else if (isStandardJsonSchema(input)) return "standard-schema";
267
268
  else if (isJsonSchema(input)) return "json-schema";
268
269
  else if (isValibotSchema(input)) return "valibot";
269
270
  else if (isType(input)) return "reflection";
270
- else if (isUntypedInput(input) || isUntypedSchema(input)) return "untyped";
271
271
  }
272
272
  throw new Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`);
273
273
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extract.mjs","names":["isSetObject","extractJsonSchema","extractJsonSchemaZod"],"sources":["../src/extract.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 { Context } from \"@powerlines/core\";\nimport { isTypeDefinition } from \"@powerlines/core\";\nimport { esbuildPlugin } from \"@powerlines/deepkit/esbuild-plugin\";\nimport { isType, stringifyType, Type } from \"@powerlines/deepkit/vendor/type\";\nimport { StandardJSONSchemaV1 } from \"@standard-schema/spec\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { deepClone } from \"@stryke/helpers/deep-clone\";\nimport { isStandardJsonSchema } from \"@stryke/json\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetString } from \"@stryke/type-checks\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport {\n extractJsonSchema as extractJsonSchemaZod,\n isZod3Type\n} from \"@stryke/zod\";\nimport { toJsonSchema } from \"@valibot/to-json-schema\";\nimport defu from \"defu\";\nimport * as z3 from \"zod/v3\";\nimport { BundleOptions } from \"./bundle\";\nimport { getCacheDirectory, writeSchema } from \"./persistence\";\nimport { reflectionToJsonSchema } from \"./reflection\";\nimport { resolve } from \"./resolve\";\nimport {\n isJsonSchema,\n isJsonSchemaObject,\n isSchema,\n isSchemaWithSource,\n isUntypedInput,\n isUntypedSchema,\n isValibotSchema\n} from \"./type-checks\";\nimport {\n ExtractedSchema,\n JsonSchema,\n Schema,\n SchemaInput,\n SchemaInputVariant,\n SchemaSource,\n SchemaSourceInput,\n SchemaSourceVariant,\n TypeDefinitionReference,\n UntypedInputObject,\n UntypedSchema,\n ValibotSchema\n} from \"./types\";\n\nconst SCHEMA_BUNDLE_BASE_URI = \"https://powerlines.invalid/\";\n\nfunction normalizeUri(uri: string): string {\n return uri.endsWith(\"#\") ? uri.slice(0, -1) : uri;\n}\n\nfunction stripUriFragment(uri: string): string {\n const hashIndex = uri.indexOf(\"#\");\n\n return hashIndex >= 0 ? uri.slice(0, hashIndex) : uri;\n}\n\nfunction escapeJsonPointerToken(token: string): string {\n return token.replaceAll(\"~\", \"~0\").replaceAll(\"/\", \"~1\");\n}\n\nfunction toJsonPointer(path: string[]): string {\n if (path.length === 0) {\n return \"\";\n }\n\n return `/${path.map(segment => escapeJsonPointerToken(segment)).join(\"/\")}`;\n}\n\nfunction resolveUri(reference: string, baseUri: string): string {\n try {\n return normalizeUri(new URL(reference, baseUri).toString());\n } catch {\n return normalizeUri(reference);\n }\n}\n\nfunction collectReferenceTargets(\n value: unknown,\n path: string[],\n baseUri: string,\n uriToPointer: Map<string, string>,\n dynamicUriToFragment: Map<string, string>\n): void {\n if (!isSetObject(value)) {\n return;\n }\n\n const schema = value as Record<string, unknown>;\n const pointer = toJsonPointer(path);\n\n const currentBaseUri = isSetString(schema.$id)\n ? resolveUri(schema.$id, baseUri)\n : baseUri;\n\n const currentDocumentUri = stripUriFragment(currentBaseUri);\n\n uriToPointer.set(currentBaseUri, pointer);\n uriToPointer.set(currentDocumentUri, pointer);\n\n if (isSetString(schema.$anchor)) {\n uriToPointer.set(`${currentDocumentUri}#${schema.$anchor}`, pointer);\n }\n\n if (isSetString(schema.$dynamicAnchor)) {\n const dynamicTarget = `${currentDocumentUri}#${schema.$dynamicAnchor}`;\n uriToPointer.set(dynamicTarget, pointer);\n dynamicUriToFragment.set(dynamicTarget, `#${schema.$dynamicAnchor}`);\n }\n\n for (const [key, child] of Object.entries(schema)) {\n if (Array.isArray(child)) {\n child.forEach((entry, index) => {\n collectReferenceTargets(\n entry,\n [...path, key, String(index)],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n });\n continue;\n }\n\n collectReferenceTargets(\n child,\n [...path, key],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n }\n}\n\nfunction rewriteReferenceTargets(\n value: unknown,\n path: string[],\n baseUri: string,\n uriToPointer: Map<string, string>,\n dynamicUriToFragment: Map<string, string>\n): void {\n if (!isSetObject(value)) {\n return;\n }\n\n const schema = value as Record<string, unknown>;\n\n const currentBaseUri = isSetString(schema.$id)\n ? resolveUri(schema.$id, baseUri)\n : baseUri;\n\n if (isSetString(schema.$ref)) {\n const resolvedRefUri = resolveUri(schema.$ref, currentBaseUri);\n const pointer =\n uriToPointer.get(resolvedRefUri) ??\n uriToPointer.get(stripUriFragment(resolvedRefUri));\n\n if (pointer !== undefined) {\n schema.$ref = pointer.length > 0 ? `#${pointer}` : \"#\";\n }\n }\n\n if (isSetString(schema.$dynamicRef)) {\n const resolvedDynamicRefUri = resolveUri(\n schema.$dynamicRef,\n currentBaseUri\n );\n const dynamicFragment = dynamicUriToFragment.get(resolvedDynamicRefUri);\n\n if (dynamicFragment) {\n schema.$dynamicRef = dynamicFragment;\n } else {\n const pointer =\n uriToPointer.get(resolvedDynamicRefUri) ??\n uriToPointer.get(stripUriFragment(resolvedDynamicRefUri));\n\n if (pointer !== undefined) {\n schema.$dynamicRef = pointer.length > 0 ? `#${pointer}` : \"#\";\n }\n }\n }\n\n for (const [key, child] of Object.entries(schema)) {\n if (Array.isArray(child)) {\n child.forEach((entry, index) => {\n rewriteReferenceTargets(\n entry,\n [...path, key, String(index)],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n });\n continue;\n }\n\n rewriteReferenceTargets(\n child,\n [...path, key],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n }\n}\n\n/**\n * Bundles all external references in a JSON Schema into a single schema document by collecting all reference targets and rewriting the references to point to the bundled definitions. This ensures that the resulting schema is self-contained and can be used independently without relying on external documents.\n *\n * @param schema - The JSON Schema to bundle references for.\n * @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.\n */\nexport function bundleReferences(schema: JsonSchema): JsonSchema {\n if (!isSetObject(schema)) {\n return schema;\n }\n\n const bundledSchema = deepClone(schema) as Record<string, unknown>;\n const baseUri = isSetString(bundledSchema.$id)\n ? resolveUri(bundledSchema.$id, SCHEMA_BUNDLE_BASE_URI)\n : SCHEMA_BUNDLE_BASE_URI;\n\n const uriToPointer = new Map<string, string>();\n const dynamicUriToFragment = new Map<string, string>();\n\n collectReferenceTargets(\n bundledSchema,\n [],\n baseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n\n rewriteReferenceTargets(\n bundledSchema,\n [],\n baseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n\n return bundledSchema;\n}\n\nfunction convertNestedUntypedSchema(value: unknown): unknown {\n if (isUntypedSchema(value)) {\n return convertUntypedSchemaToJsonSchema(value);\n }\n\n if (isSetObject(value)) {\n if (isUntypedInput(value)) {\n return convertUntypedInputToJsonSchema(value);\n }\n\n const nested = value as Record<string, unknown>;\n if (\"$schema\" in nested && isUntypedSchema(nested.$schema)) {\n return convertUntypedSchemaToJsonSchema(nested.$schema);\n }\n }\n\n return value;\n}\n\nfunction convertNestedUntypedSchemaArray(value: unknown): unknown {\n if (!Array.isArray(value)) {\n return value;\n }\n\n return value.map(item => convertNestedUntypedSchema(item));\n}\n\nfunction convertValibotSchemaToJsonSchema(schema: unknown): JsonSchema {\n return toJsonSchema(schema as never, {\n target: \"draft-2020-12\"\n }) as JsonSchema;\n}\n\nfunction convertUntypedSchemaToJsonSchema(\n schema: UntypedSchema | Record<string, unknown>\n): JsonSchema {\n const source = schema as Record<string, unknown>;\n const jsonSchema: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(source)) {\n if (\n key === \"tsType\" ||\n key === \"markdownType\" ||\n key === \"tags\" ||\n key === \"args\" ||\n key === \"resolve\"\n ) {\n continue;\n }\n\n if (key === \"id\" && isSetString(value)) {\n jsonSchema.$id = value;\n continue;\n }\n\n if (\n key === \"properties\" ||\n key === \"patternProperties\" ||\n key === \"dependentSchemas\" ||\n key === \"$defs\" ||\n key === \"definitions\"\n ) {\n if (!isSetObject(value)) {\n jsonSchema[key] = value;\n continue;\n }\n\n jsonSchema[key] = Object.fromEntries(\n Object.entries(value).map(([propertyKey, propertyValue]) => [\n propertyKey,\n convertNestedUntypedSchema(propertyValue)\n ])\n );\n continue;\n }\n\n if (\n key === \"items\" ||\n key === \"contains\" ||\n key === \"if\" ||\n key === \"then\" ||\n key === \"else\" ||\n key === \"not\" ||\n key === \"propertyNames\" ||\n key === \"additionalProperties\" ||\n key === \"unevaluatedProperties\"\n ) {\n jsonSchema[key] = convertNestedUntypedSchema(value);\n continue;\n }\n\n if (key === \"oneOf\" || key === \"anyOf\" || key === \"allOf\") {\n jsonSchema[key] = convertNestedUntypedSchemaArray(value);\n continue;\n }\n\n jsonSchema[key] = value;\n }\n\n return jsonSchema;\n}\n\nfunction convertUntypedInputToJsonSchema(\n input: UntypedInputObject\n): JsonSchema {\n const inputObject = input as Record<string, unknown>;\n const base = isUntypedSchema(inputObject.$schema)\n ? convertUntypedSchemaToJsonSchema(inputObject.$schema)\n : {};\n const properties: Record<string, JsonSchema> = {};\n\n for (const [key, value] of Object.entries(inputObject)) {\n if (key.startsWith(\"$\")) {\n continue;\n }\n\n if (!isSetObject(value)) {\n continue;\n }\n\n if (isUntypedInput(value)) {\n properties[key] = convertUntypedInputToJsonSchema(value);\n continue;\n }\n\n const nested = value as Record<string, unknown>;\n if (\"$schema\" in nested && isUntypedSchema(nested.$schema)) {\n properties[key] = convertUntypedSchemaToJsonSchema(nested.$schema);\n continue;\n }\n\n if (isUntypedSchema(value)) {\n properties[key] = convertUntypedSchemaToJsonSchema(value);\n }\n }\n\n if (!isJsonSchemaObject(base)) {\n throw new Error(\n `Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`\n );\n }\n\n const baseProperties = isSetObject(base.properties) ? base.properties : {};\n const mergedProperties = {\n ...baseProperties,\n ...properties\n };\n\n return {\n ...base,\n type: base.type ?? \"object\",\n ...(Object.keys(mergedProperties).length > 0\n ? { properties: mergedProperties }\n : {})\n };\n}\n\n/**\n * Creates a hash string for a given schema definition input.\n */\nexport function extractHash(\n variant: SchemaInputVariant,\n input: SchemaInput\n): string {\n if (isSetString(input)) {\n return murmurhash({ variant, input });\n } else if (typeof input === \"boolean\") {\n return murmurhash({ variant, input });\n } else if (isSetObject(input)) {\n if (isZod3Type(input)) {\n return murmurhash({ variant, input: input._def });\n } else if (isStandardJsonSchema(input)) {\n return murmurhash({ variant, input: input[\"~standard\"] });\n } else if (isJsonSchema(input)) {\n return murmurhash({ variant, input });\n } else if (isValibotSchema(input)) {\n return murmurhash({\n variant,\n input: convertValibotSchemaToJsonSchema(input)\n });\n } else if (isUntypedInput(input)) {\n return murmurhash({\n variant,\n input: convertUntypedInputToJsonSchema(input)\n });\n } else if (isUntypedSchema(input)) {\n return murmurhash({\n variant,\n input: convertUntypedSchemaToJsonSchema(input)\n });\n } else if (isType(input)) {\n return murmurhash({ variant, input: stringifyType(input) });\n }\n }\n\n throw new Error(\n `Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`\n );\n}\n\n/**\n * Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.\n */\nexport function extractReflection(reflection: Type): JsonSchema | undefined {\n if (!isType(reflection)) {\n return undefined;\n }\n\n return reflectionToJsonSchema(reflection);\n}\n\n/**\n * Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.\n */\nexport function extractJsonSchema(schema: unknown): JsonSchema | undefined {\n if (isSetObject(schema)) {\n if (isZod3Type(schema)) {\n return extractJsonSchemaZod(schema) as JsonSchema;\n }\n if (isStandardJsonSchema(schema)) {\n return schema[\"~standard\"].jsonSchema.input({\n target: \"draft-2020-12\"\n });\n }\n if (isValibotSchema(schema)) {\n return convertValibotSchemaToJsonSchema(schema);\n }\n if (isUntypedInput(schema)) {\n return convertUntypedInputToJsonSchema(schema);\n }\n if (isUntypedSchema(schema)) {\n return convertUntypedSchemaToJsonSchema(schema);\n }\n if (isJsonSchema(schema)) {\n return schema;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolves the concrete source variant for a schema source input.\n *\n * @param input - The schema source input to inspect.\n * @returns The resolved schema source variant.\n * @throws Will throw an error when the input cannot be mapped to a supported source variant.\n */\nexport function extractResolvedVariant(\n input: SchemaSourceInput\n): SchemaSourceVariant {\n if (typeof input === \"boolean\") {\n return \"json-schema\";\n }\n\n if (isSetObject(input)) {\n if (isZod3Type(input)) {\n return \"zod3\";\n } else if (isStandardJsonSchema(input)) {\n return \"standard-schema\";\n } else if (isJsonSchema(input)) {\n return \"json-schema\";\n } else if (isValibotSchema(input)) {\n return \"valibot\";\n } else if (isType(input)) {\n return \"reflection\";\n } else if (isUntypedInput(input) || isUntypedSchema(input)) {\n return \"untyped\";\n }\n }\n\n throw new Error(\n `Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`\n );\n}\n\n/**\n * Determines the top-level input variant for schema extraction.\n *\n * @param input - The schema input to classify.\n * @returns The resolved schema input variant.\n */\nexport function extractVariant(input: SchemaInput): SchemaInputVariant {\n if (isSetString(input) || isTypeDefinition(input)) {\n return \"type-definition\";\n }\n\n return extractResolvedVariant(input as SchemaSourceInput);\n}\n\n/**\n * Extracts and normalizes a JSON Schema from a concrete schema source input.\n *\n * @param input - The schema source input to extract from.\n * @param variant - Optional source variant override. When omitted, the variant is inferred from the input.\n * @returns A promise that resolves to a bundled JSON Schema.\n * @throws Will throw an error if no valid JSON Schema can be extracted from the input.\n */\nexport async function extractSchema(\n input: SchemaSourceInput,\n variant?: SchemaInputVariant\n): Promise<JsonSchema> {\n if (isSchemaWithSource(input)) {\n return input.schema;\n }\n\n const resolvedVariant = variant ?? extractResolvedVariant(input);\n\n let schema: JsonSchema | undefined;\n if (\n resolvedVariant === \"zod3\" ||\n resolvedVariant === \"json-schema\" ||\n resolvedVariant === \"standard-schema\" ||\n resolvedVariant === \"untyped\" ||\n resolvedVariant === \"valibot\"\n ) {\n schema = extractJsonSchema(input);\n } else if (resolvedVariant === \"reflection\") {\n schema = extractReflection(input as Type);\n }\n\n if (schema) {\n return bundleReferences(schema);\n }\n\n throw new Error(\n `Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`\n );\n}\n\n/**\n * Builds source metadata for a schema input using a known source variant.\n *\n * @param variant - The schema source variant associated with the input.\n * @param input - The schema source input to wrap.\n * @returns The normalized schema source payload, including the source hash and variant.\n * @throws Will throw an error if the provided variant is unsupported.\n */\nexport function extractSource(\n variant: SchemaSourceVariant,\n input: SchemaSourceInput\n): SchemaSource {\n if (variant === \"zod3\") {\n return {\n hash: extractHash(variant, input),\n variant: \"zod3\",\n schema: input as z3.ZodTypeAny\n };\n } else if (variant === \"untyped\") {\n return {\n hash: extractHash(variant, input),\n variant: \"untyped\",\n schema: input as UntypedInputObject | UntypedSchema\n };\n } else if (variant === \"standard-schema\") {\n return {\n hash: extractHash(variant, input),\n variant: \"standard-schema\",\n schema: input as StandardJSONSchemaV1\n };\n } else if (variant === \"json-schema\") {\n return {\n hash: extractHash(variant, input),\n variant: \"json-schema\",\n schema: input as JsonSchema\n };\n } else if (variant === \"valibot\") {\n return {\n hash: extractHash(variant, input),\n variant: \"valibot\",\n schema: input as ValibotSchema\n };\n } else if (variant === \"reflection\") {\n return {\n hash: extractHash(variant, input),\n variant: \"reflection\",\n schema: input as Type\n };\n }\n\n throw new Error(\n `Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`\n );\n}\n\n/**\n * Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.\n *\n * @example\n * ```ts\n * // Resolve a schema definition from a file path\n * const schema1 = await extract(context, \"./schemas.ts#MySchema\");\n * // Resolve a schema definition from a JSON Schema object\n * const schema2 = await extract(context, schemaObject);\n * // Resolve a schema definition from a Zod schema\n * const schema3 = await extract(context, zodSchema);\n * // Resolve a schema definition from a reflected Deepkit Type object\n * const schema4 = await extract(context, reflectionType);\n * ```\n *\n * @see https://zod.dev/\n * @see https://valibot.dev/\n * @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec\n * @see https://json-schema.org/\n * @see https://ajv.js.org/json-type-definition.html\n * @see https://deepkit.io/en/documentation/runtime-types/reflection\n *\n * @param context - The context object providing access to the file system and cache path.\n * @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object. If the input is a string or a type definition reference, it will be resolved and bundled to obtain the actual schema definition before extraction.\n * @param options - Optional overrides for the Rolldown configuration used during extraction. This can include custom plugins, loaders, or other build options to control how the schema definition is resolved and bundled when the input is a type definition reference.\n * @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object. The function will attempt to extract a valid JSON Schema from the provided input, and if successful, it will return the schema. If the extraction process fails or if the input is not a valid schema definition, it will throw an error indicating the failure.\n */\nexport async function extractSchemaWithSource(\n context: Context,\n input: SchemaInput,\n options: BundleOptions = {}\n): Promise<ExtractedSchema> {\n if (isSchemaWithSource(input)) {\n return input;\n }\n\n if (isSchema(input)) {\n return {\n ...input,\n source: {\n hash: extractHash(\"json-schema\", input.schema),\n variant: \"json-schema\",\n schema: input.schema\n }\n };\n }\n\n let source: SchemaSource;\n\n const variant = extractVariant(input);\n const hash = extractHash(variant, input);\n\n if (variant === \"type-definition\") {\n const resolved = await resolve<SchemaSourceInput>(\n context,\n input as TypeDefinitionReference,\n defu(options, {\n plugins: [\n esbuildPlugin(context, {\n reflection: \"default\",\n level: \"all\"\n })\n ]\n })\n );\n\n source = extractSource(extractResolvedVariant(resolved), resolved);\n } else if (\n [\n \"json-schema\",\n \"standard-schema\",\n \"zod3\",\n \"untyped\",\n \"valibot\",\n \"reflection\"\n ].includes(variant)\n ) {\n source = extractSource(variant, input as SchemaSourceInput);\n } else {\n throw new Error(\n `Invalid schema definition input \"${\n variant\n }\". The variant must be one of \"type-definition\", \"json-schema\", \"standard-schema\", \"zod3\", \"untyped\", or \"reflection\".`\n );\n }\n\n return {\n variant,\n source,\n schema: await extractSchema(source.schema, source.variant),\n hash\n };\n}\n\n/**\n * Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.\n *\n * @example\n * ```ts\n * // Resolve a schema definition from a file path\n * const schema1 = await extract(context, \"./schemas.ts#MySchema\");\n * // Resolve a schema definition from a JSON Schema object\n * const schema2 = await extract(context, schemaObject);\n * // Resolve a schema definition from a Zod schema\n * const schema3 = await extract(context, zodSchema);\n * // Resolve a schema definition from a reflected Deepkit Type object\n * const schema4 = await extract(context, reflectionType);\n * ```\n *\n * @see https://zod.dev/\n * @see https://valibot.dev/\n * @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec\n * @see https://json-schema.org/\n * @see https://ajv.js.org/json-type-definition.html\n * @see https://deepkit.io/en/documentation/runtime-types/reflection\n * @see https://github.com/unjs/untyped\n * @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html\n *\n * @param context - The context object providing access to the file system and cache path.\n * @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.\n * @param options - Optional overrides for the Rolldown configuration used during extraction.\n * @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.\n * @throws Will throw an error if the input is not a valid schema definition or if the extraction process fails to produce a valid schema.\n */\nexport async function extract(\n context: Context,\n input: SchemaInput,\n options: BundleOptions = {}\n): Promise<Schema> {\n if (isSchemaWithSource(input) || isSchema(input)) {\n return input;\n }\n\n let result: Schema | undefined;\n\n const variant = extractVariant(input);\n const hash = extractHash(variant, input);\n\n const cacheFilePath = joinPaths(getCacheDirectory(context), `${hash}.json`);\n if (\n context.config.skipCache !== true &&\n context.fs.existsSync(cacheFilePath)\n ) {\n const schema = await context.fs.read(cacheFilePath);\n if (schema) {\n result = {\n variant,\n hash,\n schema: JSON.parse(schema) as JsonSchema\n };\n }\n }\n\n result ??= await extractSchemaWithSource(context, input, options);\n if (!result?.schema) {\n throw new Error(\n `Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`\n );\n }\n\n if (context.config.skipCache !== true) {\n await writeSchema(context, result);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgEA,MAAM,yBAAyB;AAE/B,SAAS,aAAa,KAAqB;CACzC,OAAO,IAAI,SAAS,GAAG,IAAI,IAAI,MAAM,GAAG,EAAE,IAAI;AAChD;AAEA,SAAS,iBAAiB,KAAqB;CAC7C,MAAM,YAAY,IAAI,QAAQ,GAAG;CAEjC,OAAO,aAAa,IAAI,IAAI,MAAM,GAAG,SAAS,IAAI;AACpD;AAEA,SAAS,uBAAuB,OAAuB;CACrD,OAAO,MAAM,WAAW,KAAK,IAAI,EAAE,WAAW,KAAK,IAAI;AACzD;AAEA,SAAS,cAAc,MAAwB;CAC7C,IAAI,KAAK,WAAW,GAClB,OAAO;CAGT,OAAO,IAAI,KAAK,KAAI,YAAW,uBAAuB,OAAO,CAAC,EAAE,KAAK,GAAG;AAC1E;AAEA,SAAS,WAAW,WAAmB,SAAyB;CAC9D,IAAI;EACF,OAAO,aAAa,IAAI,IAAI,WAAW,OAAO,EAAE,SAAS,CAAC;CAC5D,QAAQ;EACN,OAAO,aAAa,SAAS;CAC/B;AACF;AAEA,SAAS,wBACP,OACA,MACA,SACA,cACA,sBACM;CACN,IAAI,CAACA,cAAY,KAAK,GACpB;CAGF,MAAM,SAAS;CACf,MAAM,UAAU,cAAc,IAAI;CAElC,MAAM,iBAAiB,YAAY,OAAO,GAAG,IACzC,WAAW,OAAO,KAAK,OAAO,IAC9B;CAEJ,MAAM,qBAAqB,iBAAiB,cAAc;CAE1D,aAAa,IAAI,gBAA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,CACP,cAAc,SAAS;GACrB,YAAY;GACZ,OAAO;EACT,CAAC,CACH,EACF,CAAC,CACH;EAEA,SAAS,cAAc,uBAAuB,QAAQ,GAAG,QAAQ;CACnE,OAAO,IACL;EACE;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,SAAS,OAAO,GAElB,SAAS,cAAc,SAAS,KAA0B;MAE1D,MAAM,IAAI,MACR,oCACE,QACD,uHACH;CAGF,OAAO;EACL;EACA;EACA,QAAQ,MAAM,cAAc,OAAO,QAAQ,OAAO,OAAO;EACzD;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,eAAsB,QACpB,SACA,OACA,UAAyB,CAAC,GACT;CACjB,IAAI,mBAAmB,KAAK,KAAK,SAAS,KAAK,GAC7C,OAAO;CAGT,IAAI;CAEJ,MAAM,UAAU,eAAe,KAAK;CACpC,MAAM,OAAO,YAAY,SAAS,KAAK;CAEvC,MAAM,gBAAgB,UAAU,kBAAkB,OAAO,GAAG,GAAG,KAAK,MAAM;CAC1E,IACE,QAAQ,OAAO,cAAc,QAC7B,QAAQ,GAAG,WAAW,aAAa,GACnC;EACA,MAAM,SAAS,MAAM,QAAQ,GAAG,KAAK,aAAa;EAClD,IAAI,QACF,SAAS;GACP;GACA;GACA,QAAQ,KAAK,MAAM,MAAM;EAC3B;CAEJ;CAEA,WAAW,MAAM,wBAAwB,SAAS,OAAO,OAAO;CAChE,IAAI,CAAC,QAAQ,QACX,MAAM,IAAI,MACR,+NACF;CAGF,IAAI,QAAQ,OAAO,cAAc,MAC/B,MAAM,YAAY,SAAS,MAAM;CAGnC,OAAO;AACT"}
1
+ {"version":3,"file":"extract.mjs","names":["isSetObject","extractJsonSchema","extractJsonSchemaZod"],"sources":["../src/extract.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 { Context } from \"@powerlines/core\";\nimport { isTypeDefinition } from \"@powerlines/core\";\nimport { esbuildPlugin } from \"@powerlines/deepkit/esbuild-plugin\";\nimport { isType, stringifyType, Type } from \"@powerlines/deepkit/vendor/type\";\nimport { StandardJSONSchemaV1 } from \"@standard-schema/spec\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { deepClone } from \"@stryke/helpers/deep-clone\";\nimport { isStandardJsonSchema } from \"@stryke/json\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetString } from \"@stryke/type-checks\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport {\n extractJsonSchema as extractJsonSchemaZod,\n isZod3Type\n} from \"@stryke/zod\";\nimport { toJsonSchema } from \"@valibot/to-json-schema\";\nimport defu from \"defu\";\nimport * as z3 from \"zod/v3\";\nimport { BundleOptions } from \"./bundle\";\nimport { getCacheDirectory, writeSchema } from \"./persistence\";\nimport { reflectionToJsonSchema } from \"./reflection\";\nimport { resolve } from \"./resolve\";\nimport {\n isJsonSchema,\n isJsonSchemaObject,\n isSchema,\n isSchemaWithSource,\n isUntypedInput,\n isUntypedInputStrict,\n isUntypedSchema,\n isUntypedSchemaStrict,\n isValibotSchema\n} from \"./type-checks\";\nimport {\n ExtractedSchema,\n JsonSchema,\n Schema,\n SchemaInput,\n SchemaInputVariant,\n SchemaSource,\n SchemaSourceInput,\n SchemaSourceVariant,\n TypeDefinitionReference,\n UntypedInputObject,\n UntypedSchema,\n ValibotSchema\n} from \"./types\";\n\nconst SCHEMA_BUNDLE_BASE_URI = \"https://powerlines.invalid/\";\n\nfunction normalizeUri(uri: string): string {\n return uri.endsWith(\"#\") ? uri.slice(0, -1) : uri;\n}\n\nfunction stripUriFragment(uri: string): string {\n const hashIndex = uri.indexOf(\"#\");\n\n return hashIndex >= 0 ? uri.slice(0, hashIndex) : uri;\n}\n\nfunction escapeJsonPointerToken(token: string): string {\n return token.replaceAll(\"~\", \"~0\").replaceAll(\"/\", \"~1\");\n}\n\nfunction toJsonPointer(path: string[]): string {\n if (path.length === 0) {\n return \"\";\n }\n\n return `/${path.map(segment => escapeJsonPointerToken(segment)).join(\"/\")}`;\n}\n\nfunction resolveUri(reference: string, baseUri: string): string {\n try {\n return normalizeUri(new URL(reference, baseUri).toString());\n } catch {\n return normalizeUri(reference);\n }\n}\n\nfunction collectReferenceTargets(\n value: unknown,\n path: string[],\n baseUri: string,\n uriToPointer: Map<string, string>,\n dynamicUriToFragment: Map<string, string>\n): void {\n if (!isSetObject(value)) {\n return;\n }\n\n const schema = value as Record<string, unknown>;\n const pointer = toJsonPointer(path);\n\n const currentBaseUri = isSetString(schema.$id)\n ? resolveUri(schema.$id, baseUri)\n : baseUri;\n\n const currentDocumentUri = stripUriFragment(currentBaseUri);\n\n uriToPointer.set(currentBaseUri, pointer);\n uriToPointer.set(currentDocumentUri, pointer);\n\n if (isSetString(schema.$anchor)) {\n uriToPointer.set(`${currentDocumentUri}#${schema.$anchor}`, pointer);\n }\n\n if (isSetString(schema.$dynamicAnchor)) {\n const dynamicTarget = `${currentDocumentUri}#${schema.$dynamicAnchor}`;\n uriToPointer.set(dynamicTarget, pointer);\n dynamicUriToFragment.set(dynamicTarget, `#${schema.$dynamicAnchor}`);\n }\n\n for (const [key, child] of Object.entries(schema)) {\n if (Array.isArray(child)) {\n child.forEach((entry, index) => {\n collectReferenceTargets(\n entry,\n [...path, key, String(index)],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n });\n continue;\n }\n\n collectReferenceTargets(\n child,\n [...path, key],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n }\n}\n\nfunction rewriteReferenceTargets(\n value: unknown,\n path: string[],\n baseUri: string,\n uriToPointer: Map<string, string>,\n dynamicUriToFragment: Map<string, string>\n): void {\n if (!isSetObject(value)) {\n return;\n }\n\n const schema = value as Record<string, unknown>;\n\n const currentBaseUri = isSetString(schema.$id)\n ? resolveUri(schema.$id, baseUri)\n : baseUri;\n\n if (isSetString(schema.$ref)) {\n const resolvedRefUri = resolveUri(schema.$ref, currentBaseUri);\n const pointer =\n uriToPointer.get(resolvedRefUri) ??\n uriToPointer.get(stripUriFragment(resolvedRefUri));\n\n if (pointer !== undefined) {\n schema.$ref = pointer.length > 0 ? `#${pointer}` : \"#\";\n }\n }\n\n if (isSetString(schema.$dynamicRef)) {\n const resolvedDynamicRefUri = resolveUri(\n schema.$dynamicRef,\n currentBaseUri\n );\n const dynamicFragment = dynamicUriToFragment.get(resolvedDynamicRefUri);\n\n if (dynamicFragment) {\n schema.$dynamicRef = dynamicFragment;\n } else {\n const pointer =\n uriToPointer.get(resolvedDynamicRefUri) ??\n uriToPointer.get(stripUriFragment(resolvedDynamicRefUri));\n\n if (pointer !== undefined) {\n schema.$dynamicRef = pointer.length > 0 ? `#${pointer}` : \"#\";\n }\n }\n }\n\n for (const [key, child] of Object.entries(schema)) {\n if (Array.isArray(child)) {\n child.forEach((entry, index) => {\n rewriteReferenceTargets(\n entry,\n [...path, key, String(index)],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n });\n continue;\n }\n\n rewriteReferenceTargets(\n child,\n [...path, key],\n currentBaseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n }\n}\n\n/**\n * Bundles all external references in a JSON Schema into a single schema document by collecting all reference targets and rewriting the references to point to the bundled definitions. This ensures that the resulting schema is self-contained and can be used independently without relying on external documents.\n *\n * @param schema - The JSON Schema to bundle references for.\n * @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.\n */\nexport function bundleReferences(schema: JsonSchema): JsonSchema {\n if (!isSetObject(schema)) {\n return schema;\n }\n\n const bundledSchema = deepClone(schema) as Record<string, unknown>;\n const baseUri = isSetString(bundledSchema.$id)\n ? resolveUri(bundledSchema.$id, SCHEMA_BUNDLE_BASE_URI)\n : SCHEMA_BUNDLE_BASE_URI;\n\n const uriToPointer = new Map<string, string>();\n const dynamicUriToFragment = new Map<string, string>();\n\n collectReferenceTargets(\n bundledSchema,\n [],\n baseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n\n rewriteReferenceTargets(\n bundledSchema,\n [],\n baseUri,\n uriToPointer,\n dynamicUriToFragment\n );\n\n return bundledSchema;\n}\n\nfunction convertNestedUntypedSchema(value: unknown): unknown {\n if (isUntypedSchema(value)) {\n return convertUntypedSchemaToJsonSchema(value);\n }\n\n if (isSetObject(value)) {\n if (isUntypedInput(value)) {\n return convertUntypedInputToJsonSchema(value);\n }\n\n const nested = value as Record<string, unknown>;\n if (\"$schema\" in nested && isUntypedSchema(nested.$schema)) {\n return convertUntypedSchemaToJsonSchema(nested.$schema);\n }\n }\n\n return value;\n}\n\nfunction convertNestedUntypedSchemaArray(value: unknown): unknown {\n if (!Array.isArray(value)) {\n return value;\n }\n\n return value.map(item => convertNestedUntypedSchema(item));\n}\n\nfunction convertValibotSchemaToJsonSchema(schema: unknown): JsonSchema {\n return toJsonSchema(schema as never, {\n target: \"draft-2020-12\"\n }) as JsonSchema;\n}\n\nfunction convertUntypedSchemaToJsonSchema(\n schema: UntypedSchema | Record<string, unknown>\n): JsonSchema {\n const source = schema as Record<string, unknown>;\n const jsonSchema: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(source)) {\n if (\n key === \"tsType\" ||\n key === \"markdownType\" ||\n key === \"tags\" ||\n key === \"args\" ||\n key === \"resolve\"\n ) {\n continue;\n }\n\n if (key === \"id\" && isSetString(value)) {\n jsonSchema.$id = value;\n continue;\n }\n\n if (\n key === \"properties\" ||\n key === \"patternProperties\" ||\n key === \"dependentSchemas\" ||\n key === \"$defs\" ||\n key === \"definitions\"\n ) {\n if (!isSetObject(value)) {\n jsonSchema[key] = value;\n continue;\n }\n\n jsonSchema[key] = Object.fromEntries(\n Object.entries(value).map(([propertyKey, propertyValue]) => [\n propertyKey,\n convertNestedUntypedSchema(propertyValue)\n ])\n );\n continue;\n }\n\n if (\n key === \"items\" ||\n key === \"contains\" ||\n key === \"if\" ||\n key === \"then\" ||\n key === \"else\" ||\n key === \"not\" ||\n key === \"propertyNames\" ||\n key === \"additionalProperties\" ||\n key === \"unevaluatedProperties\"\n ) {\n jsonSchema[key] = convertNestedUntypedSchema(value);\n continue;\n }\n\n if (key === \"oneOf\" || key === \"anyOf\" || key === \"allOf\") {\n jsonSchema[key] = convertNestedUntypedSchemaArray(value);\n continue;\n }\n\n jsonSchema[key] = value;\n }\n\n return jsonSchema;\n}\n\nfunction convertUntypedInputToJsonSchema(\n input: UntypedInputObject\n): JsonSchema {\n const inputObject = input as Record<string, unknown>;\n const base = isUntypedSchema(inputObject.$schema)\n ? convertUntypedSchemaToJsonSchema(inputObject.$schema)\n : {};\n const properties: Record<string, JsonSchema> = {};\n\n for (const [key, value] of Object.entries(inputObject)) {\n if (key.startsWith(\"$\")) {\n continue;\n }\n\n if (!isSetObject(value)) {\n continue;\n }\n\n if (isUntypedInput(value)) {\n properties[key] = convertUntypedInputToJsonSchema(value);\n continue;\n }\n\n const nested = value as Record<string, unknown>;\n if (\"$schema\" in nested && isUntypedSchema(nested.$schema)) {\n properties[key] = convertUntypedSchemaToJsonSchema(nested.$schema);\n continue;\n }\n\n if (isUntypedSchema(value)) {\n properties[key] = convertUntypedSchemaToJsonSchema(value);\n }\n }\n\n if (!isJsonSchemaObject(base)) {\n throw new Error(\n `Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`\n );\n }\n\n const baseProperties = isSetObject(base.properties) ? base.properties : {};\n const mergedProperties = {\n ...baseProperties,\n ...properties\n };\n\n return {\n ...base,\n type: base.type ?? \"object\",\n ...(Object.keys(mergedProperties).length > 0\n ? { properties: mergedProperties }\n : {})\n };\n}\n\n/**\n * Creates a hash string for a given schema definition input.\n */\nexport function extractHash(\n variant: SchemaInputVariant,\n input: SchemaInput\n): string {\n if (isSetString(input)) {\n return murmurhash({ variant, input });\n } else if (typeof input === \"boolean\") {\n return murmurhash({ variant, input });\n } else if (isSetObject(input)) {\n if (isZod3Type(input)) {\n return murmurhash({ variant, input: input._def });\n } else if (isStandardJsonSchema(input)) {\n return murmurhash({ variant, input: input[\"~standard\"] });\n } else if (isJsonSchema(input)) {\n return murmurhash({ variant, input });\n } else if (isValibotSchema(input)) {\n return murmurhash({\n variant,\n input: convertValibotSchemaToJsonSchema(input)\n });\n } else if (isUntypedInput(input)) {\n return murmurhash({\n variant,\n input: convertUntypedInputToJsonSchema(input)\n });\n } else if (isUntypedSchema(input)) {\n return murmurhash({\n variant,\n input: convertUntypedSchemaToJsonSchema(input)\n });\n } else if (isType(input)) {\n return murmurhash({ variant, input: stringifyType(input) });\n }\n }\n\n throw new Error(\n `Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`\n );\n}\n\n/**\n * Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.\n */\nexport function extractReflection(reflection: Type): JsonSchema | undefined {\n if (!isType(reflection)) {\n return undefined;\n }\n\n return reflectionToJsonSchema(reflection);\n}\n\n/**\n * Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.\n */\nexport function extractJsonSchema(schema: unknown): JsonSchema | undefined {\n if (isSetObject(schema)) {\n if (isZod3Type(schema)) {\n return extractJsonSchemaZod(schema, {\n target: \"draft-2020-12\"\n }) as JsonSchema;\n }\n if (isUntypedInputStrict(schema)) {\n return convertUntypedInputToJsonSchema(schema);\n }\n if (isUntypedSchemaStrict(schema)) {\n return convertUntypedSchemaToJsonSchema(schema);\n }\n if (isStandardJsonSchema(schema)) {\n return schema[\"~standard\"].jsonSchema.input({\n target: \"draft-2020-12\"\n });\n }\n if (isValibotSchema(schema)) {\n return convertValibotSchemaToJsonSchema(schema);\n }\n if (isJsonSchema(schema)) {\n return schema;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolves the concrete source variant for a schema source input.\n *\n * @param input - The schema source input to inspect.\n * @returns The resolved schema source variant.\n * @throws Will throw an error when the input cannot be mapped to a supported source variant.\n */\nexport function extractResolvedVariant(\n input: SchemaSourceInput\n): SchemaSourceVariant {\n if (typeof input === \"boolean\") {\n return \"json-schema\";\n }\n\n if (isSetObject(input)) {\n if (isZod3Type(input)) {\n return \"zod3\";\n } else if (isUntypedInputStrict(input) || isUntypedSchemaStrict(input)) {\n return \"untyped\";\n } else if (isStandardJsonSchema(input)) {\n return \"standard-schema\";\n } else if (isJsonSchema(input)) {\n return \"json-schema\";\n } else if (isValibotSchema(input)) {\n return \"valibot\";\n } else if (isType(input)) {\n return \"reflection\";\n }\n }\n\n throw new Error(\n `Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`\n );\n}\n\n/**\n * Determines the top-level input variant for schema extraction.\n *\n * @param input - The schema input to classify.\n * @returns The resolved schema input variant.\n */\nexport function extractVariant(input: SchemaInput): SchemaInputVariant {\n if (isSetString(input) || isTypeDefinition(input)) {\n return \"type-definition\";\n }\n\n return extractResolvedVariant(input as SchemaSourceInput);\n}\n\n/**\n * Extracts and normalizes a JSON Schema from a concrete schema source input.\n *\n * @param input - The schema source input to extract from.\n * @param variant - Optional source variant override. When omitted, the variant is inferred from the input.\n * @returns A promise that resolves to a bundled JSON Schema.\n * @throws Will throw an error if no valid JSON Schema can be extracted from the input.\n */\nexport async function extractSchema(\n input: SchemaSourceInput,\n variant?: SchemaInputVariant\n): Promise<JsonSchema> {\n if (isSchemaWithSource(input)) {\n return input.schema;\n }\n\n const resolvedVariant = variant ?? extractResolvedVariant(input);\n\n let schema: JsonSchema | undefined;\n if (\n resolvedVariant === \"zod3\" ||\n resolvedVariant === \"json-schema\" ||\n resolvedVariant === \"standard-schema\" ||\n resolvedVariant === \"untyped\" ||\n resolvedVariant === \"valibot\"\n ) {\n schema = extractJsonSchema(input);\n } else if (resolvedVariant === \"reflection\") {\n schema = extractReflection(input as Type);\n }\n\n if (schema) {\n return bundleReferences(schema);\n }\n\n throw new Error(\n `Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`\n );\n}\n\n/**\n * Builds source metadata for a schema input using a known source variant.\n *\n * @param variant - The schema source variant associated with the input.\n * @param input - The schema source input to wrap.\n * @returns The normalized schema source payload, including the source hash and variant.\n * @throws Will throw an error if the provided variant is unsupported.\n */\nexport function extractSource(\n variant: SchemaSourceVariant,\n input: SchemaSourceInput\n): SchemaSource {\n if (variant === \"zod3\") {\n return {\n hash: extractHash(variant, input),\n variant: \"zod3\",\n schema: input as z3.ZodTypeAny\n };\n } else if (variant === \"untyped\") {\n return {\n hash: extractHash(variant, input),\n variant: \"untyped\",\n schema: input as UntypedInputObject | UntypedSchema\n };\n } else if (variant === \"standard-schema\") {\n return {\n hash: extractHash(variant, input),\n variant: \"standard-schema\",\n schema: input as StandardJSONSchemaV1\n };\n } else if (variant === \"json-schema\") {\n return {\n hash: extractHash(variant, input),\n variant: \"json-schema\",\n schema: input as JsonSchema\n };\n } else if (variant === \"valibot\") {\n return {\n hash: extractHash(variant, input),\n variant: \"valibot\",\n schema: input as ValibotSchema\n };\n } else if (variant === \"reflection\") {\n return {\n hash: extractHash(variant, input),\n variant: \"reflection\",\n schema: input as Type\n };\n }\n\n throw new Error(\n `Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`\n );\n}\n\n/**\n * Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.\n *\n * @example\n * ```ts\n * // Resolve a schema definition from a file path\n * const schema1 = await extract(context, \"./schemas.ts#MySchema\");\n * // Resolve a schema definition from a JSON Schema object\n * const schema2 = await extract(context, schemaObject);\n * // Resolve a schema definition from a Zod schema\n * const schema3 = await extract(context, zodSchema);\n * // Resolve a schema definition from a reflected Deepkit Type object\n * const schema4 = await extract(context, reflectionType);\n * ```\n *\n * @see https://zod.dev/\n * @see https://valibot.dev/\n * @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec\n * @see https://json-schema.org/\n * @see https://ajv.js.org/json-type-definition.html\n * @see https://deepkit.io/en/documentation/runtime-types/reflection\n *\n * @param context - The context object providing access to the file system and cache path.\n * @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object. If the input is a string or a type definition reference, it will be resolved and bundled to obtain the actual schema definition before extraction.\n * @param options - Optional overrides for the Rolldown configuration used during extraction. This can include custom plugins, loaders, or other build options to control how the schema definition is resolved and bundled when the input is a type definition reference.\n * @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object. The function will attempt to extract a valid JSON Schema from the provided input, and if successful, it will return the schema. If the extraction process fails or if the input is not a valid schema definition, it will throw an error indicating the failure.\n */\nexport async function extractSchemaWithSource(\n context: Context,\n input: SchemaInput,\n options: BundleOptions = {}\n): Promise<ExtractedSchema> {\n if (isSchemaWithSource(input)) {\n return input;\n }\n\n if (isSchema(input)) {\n return {\n ...input,\n source: {\n hash: extractHash(\"json-schema\", input.schema),\n variant: \"json-schema\",\n schema: input.schema\n }\n };\n }\n\n let source: SchemaSource;\n\n const variant = extractVariant(input);\n const hash = extractHash(variant, input);\n\n if (variant === \"type-definition\") {\n const resolved = await resolve<SchemaSourceInput>(\n context,\n input as TypeDefinitionReference,\n defu(options, {\n plugins: [\n esbuildPlugin(context, {\n reflection: \"default\",\n level: \"all\"\n })\n ]\n })\n );\n\n source = extractSource(extractResolvedVariant(resolved), resolved);\n } else if (\n [\n \"json-schema\",\n \"standard-schema\",\n \"zod3\",\n \"untyped\",\n \"valibot\",\n \"reflection\"\n ].includes(variant)\n ) {\n source = extractSource(variant, input as SchemaSourceInput);\n } else {\n throw new Error(\n `Invalid schema definition input \"${\n variant\n }\". The variant must be one of \"type-definition\", \"json-schema\", \"standard-schema\", \"zod3\", \"untyped\", or \"reflection\".`\n );\n }\n\n return {\n variant,\n source,\n schema: await extractSchema(source.schema, source.variant),\n hash\n };\n}\n\n/**\n * Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.\n *\n * @example\n * ```ts\n * // Resolve a schema definition from a file path\n * const schema1 = await extract(context, \"./schemas.ts#MySchema\");\n * // Resolve a schema definition from a JSON Schema object\n * const schema2 = await extract(context, schemaObject);\n * // Resolve a schema definition from a Zod schema\n * const schema3 = await extract(context, zodSchema);\n * // Resolve a schema definition from a reflected Deepkit Type object\n * const schema4 = await extract(context, reflectionType);\n * ```\n *\n * @see https://zod.dev/\n * @see https://valibot.dev/\n * @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec\n * @see https://json-schema.org/\n * @see https://ajv.js.org/json-type-definition.html\n * @see https://deepkit.io/en/documentation/runtime-types/reflection\n * @see https://github.com/unjs/untyped\n * @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html\n *\n * @param context - The context object providing access to the file system and cache path.\n * @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.\n * @param options - Optional overrides for the Rolldown configuration used during extraction.\n * @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.\n * @throws Will throw an error if the input is not a valid schema definition or if the extraction process fails to produce a valid schema.\n */\nexport async function extract(\n context: Context,\n input: SchemaInput,\n options: BundleOptions = {}\n): Promise<Schema> {\n if (isSchemaWithSource(input) || isSchema(input)) {\n return input;\n }\n\n let result: Schema | undefined;\n\n const variant = extractVariant(input);\n const hash = extractHash(variant, input);\n\n const cacheFilePath = joinPaths(getCacheDirectory(context), `${hash}.json`);\n if (\n context.config.skipCache !== true &&\n context.fs.existsSync(cacheFilePath)\n ) {\n const schema = await context.fs.read(cacheFilePath);\n if (schema) {\n result = {\n variant,\n hash,\n schema: JSON.parse(schema) as JsonSchema\n };\n }\n }\n\n result ??= await extractSchemaWithSource(context, input, options);\n if (!result?.schema) {\n throw new Error(\n `Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`\n );\n }\n\n if (context.config.skipCache !== true) {\n await writeSchema(context, result);\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA,MAAM,yBAAyB;AAE/B,SAAS,aAAa,KAAqB;CACzC,OAAO,IAAI,SAAS,GAAG,IAAI,IAAI,MAAM,GAAG,EAAE,IAAI;AAChD;AAEA,SAAS,iBAAiB,KAAqB;CAC7C,MAAM,YAAY,IAAI,QAAQ,GAAG;CAEjC,OAAO,aAAa,IAAI,IAAI,MAAM,GAAG,SAAS,IAAI;AACpD;AAEA,SAAS,uBAAuB,OAAuB;CACrD,OAAO,MAAM,WAAW,KAAK,IAAI,EAAE,WAAW,KAAK,IAAI;AACzD;AAEA,SAAS,cAAc,MAAwB;CAC7C,IAAI,KAAK,WAAW,GAClB,OAAO;CAGT,OAAO,IAAI,KAAK,KAAI,YAAW,uBAAuB,OAAO,CAAC,EAAE,KAAK,GAAG;AAC1E;AAEA,SAAS,WAAW,WAAmB,SAAyB;CAC9D,IAAI;EACF,OAAO,aAAa,IAAI,IAAI,WAAW,OAAO,EAAE,SAAS,CAAC;CAC5D,QAAQ;EACN,OAAO,aAAa,SAAS;CAC/B;AACF;AAEA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Q,OAAO,cAAc,MAC/B,MAAM,YAAY,SAAS,MAAM;CAGnC,OAAO;AACT"}
package/dist/index.cjs CHANGED
@@ -72,7 +72,9 @@ exports.isSchemaNullable = require_helpers.isSchemaNullable;
72
72
  exports.isSchemaWithSource = require_type_checks.isSchemaWithSource;
73
73
  exports.isStandardSchema = require_type_checks.isStandardSchema;
74
74
  exports.isUntypedInput = require_type_checks.isUntypedInput;
75
+ exports.isUntypedInputStrict = require_type_checks.isUntypedInputStrict;
75
76
  exports.isUntypedSchema = require_type_checks.isUntypedSchema;
77
+ exports.isUntypedSchemaStrict = require_type_checks.isUntypedSchemaStrict;
76
78
  exports.isValibotSchema = require_type_checks.isValibotSchema;
77
79
  exports.mergeSchemas = require_helpers.mergeSchemas;
78
80
  exports.readSchema = require_persistence.readSchema;
package/dist/index.d.cts CHANGED
@@ -8,7 +8,7 @@ import { applyJsonSchemaMetadata, getPrimarySchemaType, readSchemaTypes } from "
8
8
  import { getCacheDirectory, getCacheFilePath, readSchema, readSchemaSafe, writeSchema } from "./persistence.cjs";
9
9
  import { reflectionToJsonSchema } from "./reflection.cjs";
10
10
  import { resolve, resolveModule, resolveReflection } from "./resolve.cjs";
11
- import { 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 } from "./type-checks.cjs";
11
+ import { 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 } from "./type-checks.cjs";
12
12
 
13
13
  //#region src/index.d.ts
14
14
  declare module "zod" {
@@ -34,5 +34,5 @@ declare module "zod" {
34
34
  }
35
35
  }
36
36
  //#endregion
37
- export { BaseSchemaSource, BundleOptions, ExtractedSchema, GetPropertiesResult, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBigint, JsonSchemaBoolean, JsonSchemaConditionalKeywords, JsonSchemaDate, JsonSchemaDecimal, JsonSchemaDecimalFormat, JsonSchemaEnum, JsonSchemaInteger, JsonSchemaIntegerFormat, JsonSchemaKeywords, JsonSchemaLike, JsonSchemaLiteral, JsonSchemaLogicKeywords, JsonSchemaMap, JsonSchemaMetadataKeywords, JsonSchemaNativeEnum, JsonSchemaNever, JsonSchemaNull, JsonSchemaNullable, JsonSchemaNumber, JsonSchemaNumberFormat, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaPrimitiveUnion, JsonSchemaRecord, JsonSchemaRecordPropertyNames, JsonSchemaRef, JsonSchemaSchemaSource, JsonSchemaSet, JsonSchemaString, JsonSchemaStringFormat, JsonSchemaTuple, JsonSchemaType, JsonSchemaTypeNames, JsonSchemaUndefined, JsonSchemaUnion, JsonSchemaUnknown, ReflectionSchemaSource, Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant, StandardSchemaSchemaSource, TypeDefinitionReference, UntypedInputObject, UntypedSchema, UntypedSchemaSource, ValibotSchema, ValibotSchemaSource, Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, bundle, bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant, generateCode, getCacheDirectory, getCacheFilePath, getJsonSchemaType, getPrimarySchemaType, getProperties, getPropertiesList, 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, isPropertyOptional, isSchema, isSchemaNullable, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedSchema, isValibotSchema, mergeSchemas, readSchema, readSchemaSafe, readSchemaTypes, reflectionToJsonSchema, resolve, resolveModule, resolveReflection, stringifyType, stringifyValue, writeSchema };
37
+ export { BaseSchemaSource, BundleOptions, ExtractedSchema, GetPropertiesResult, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBigint, JsonSchemaBoolean, JsonSchemaConditionalKeywords, JsonSchemaDate, JsonSchemaDecimal, JsonSchemaDecimalFormat, JsonSchemaEnum, JsonSchemaInteger, JsonSchemaIntegerFormat, JsonSchemaKeywords, JsonSchemaLike, JsonSchemaLiteral, JsonSchemaLogicKeywords, JsonSchemaMap, JsonSchemaMetadataKeywords, JsonSchemaNativeEnum, JsonSchemaNever, JsonSchemaNull, JsonSchemaNullable, JsonSchemaNumber, JsonSchemaNumberFormat, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaPrimitiveUnion, JsonSchemaRecord, JsonSchemaRecordPropertyNames, JsonSchemaRef, JsonSchemaSchemaSource, JsonSchemaSet, JsonSchemaString, JsonSchemaStringFormat, JsonSchemaTuple, JsonSchemaType, JsonSchemaTypeNames, JsonSchemaUndefined, JsonSchemaUnion, JsonSchemaUnknown, ReflectionSchemaSource, Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant, StandardSchemaSchemaSource, TypeDefinitionReference, UntypedInputObject, UntypedSchema, UntypedSchemaSource, ValibotSchema, ValibotSchemaSource, Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, bundle, bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant, generateCode, getCacheDirectory, getCacheFilePath, getJsonSchemaType, getPrimarySchemaType, getProperties, getPropertiesList, 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, isPropertyOptional, isSchema, isSchemaNullable, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, mergeSchemas, readSchema, readSchemaSafe, readSchemaTypes, reflectionToJsonSchema, resolve, resolveModule, resolveReflection, stringifyType, stringifyValue, writeSchema };
38
38
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ import { applyJsonSchemaMetadata, getPrimarySchemaType, readSchemaTypes } from "
8
8
  import { getCacheDirectory, getCacheFilePath, readSchema, readSchemaSafe, writeSchema } from "./persistence.mjs";
9
9
  import { reflectionToJsonSchema } from "./reflection.mjs";
10
10
  import { resolve, resolveModule, resolveReflection } from "./resolve.mjs";
11
- import { 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 } from "./type-checks.mjs";
11
+ import { 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 } from "./type-checks.mjs";
12
12
 
13
13
  //#region src/index.d.ts
14
14
  declare module "zod" {
@@ -34,5 +34,5 @@ declare module "zod" {
34
34
  }
35
35
  }
36
36
  //#endregion
37
- export { BaseSchemaSource, BundleOptions, ExtractedSchema, GetPropertiesResult, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBigint, JsonSchemaBoolean, JsonSchemaConditionalKeywords, JsonSchemaDate, JsonSchemaDecimal, JsonSchemaDecimalFormat, JsonSchemaEnum, JsonSchemaInteger, JsonSchemaIntegerFormat, JsonSchemaKeywords, JsonSchemaLike, JsonSchemaLiteral, JsonSchemaLogicKeywords, JsonSchemaMap, JsonSchemaMetadataKeywords, JsonSchemaNativeEnum, JsonSchemaNever, JsonSchemaNull, JsonSchemaNullable, JsonSchemaNumber, JsonSchemaNumberFormat, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaPrimitiveUnion, JsonSchemaRecord, JsonSchemaRecordPropertyNames, JsonSchemaRef, JsonSchemaSchemaSource, JsonSchemaSet, JsonSchemaString, JsonSchemaStringFormat, JsonSchemaTuple, JsonSchemaType, JsonSchemaTypeNames, JsonSchemaUndefined, JsonSchemaUnion, JsonSchemaUnknown, ReflectionSchemaSource, Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant, StandardSchemaSchemaSource, TypeDefinitionReference, UntypedInputObject, UntypedSchema, UntypedSchemaSource, ValibotSchema, ValibotSchemaSource, Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, bundle, bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant, generateCode, getCacheDirectory, getCacheFilePath, getJsonSchemaType, getPrimarySchemaType, getProperties, getPropertiesList, 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, isPropertyOptional, isSchema, isSchemaNullable, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedSchema, isValibotSchema, mergeSchemas, readSchema, readSchemaSafe, readSchemaTypes, reflectionToJsonSchema, resolve, resolveModule, resolveReflection, stringifyType, stringifyValue, writeSchema };
37
+ export { BaseSchemaSource, BundleOptions, ExtractedSchema, GetPropertiesResult, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchema, JsonSchemaAllOf, JsonSchemaAny, JsonSchemaAnyOf, JsonSchemaArray, JsonSchemaBigint, JsonSchemaBoolean, JsonSchemaConditionalKeywords, JsonSchemaDate, JsonSchemaDecimal, JsonSchemaDecimalFormat, JsonSchemaEnum, JsonSchemaInteger, JsonSchemaIntegerFormat, JsonSchemaKeywords, JsonSchemaLike, JsonSchemaLiteral, JsonSchemaLogicKeywords, JsonSchemaMap, JsonSchemaMetadataKeywords, JsonSchemaNativeEnum, JsonSchemaNever, JsonSchemaNull, JsonSchemaNullable, JsonSchemaNumber, JsonSchemaNumberFormat, JsonSchemaObject, JsonSchemaPrimitiveType, JsonSchemaPrimitiveUnion, JsonSchemaRecord, JsonSchemaRecordPropertyNames, JsonSchemaRef, JsonSchemaSchemaSource, JsonSchemaSet, JsonSchemaString, JsonSchemaStringFormat, JsonSchemaTuple, JsonSchemaType, JsonSchemaTypeNames, JsonSchemaUndefined, JsonSchemaUnion, JsonSchemaUnknown, ReflectionSchemaSource, Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant, StandardSchemaSchemaSource, TypeDefinitionReference, UntypedInputObject, UntypedSchema, UntypedSchemaSource, ValibotSchema, ValibotSchemaSource, Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, bundle, bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant, generateCode, getCacheDirectory, getCacheFilePath, getJsonSchemaType, getPrimarySchemaType, getProperties, getPropertiesList, 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, isPropertyOptional, isSchema, isSchemaNullable, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, mergeSchemas, readSchema, readSchemaSafe, readSchemaTypes, reflectionToJsonSchema, resolve, resolveModule, resolveReflection, stringifyType, stringifyValue, writeSchema };
38
38
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { bundle } from "./bundle.mjs";
2
2
  import { JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchemaTypeNames } from "./constants.mjs";
3
3
  import { applyJsonSchemaMetadata, getPrimarySchemaType, readSchemaTypes } from "./metadata.mjs";
4
- import { 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 } from "./type-checks.mjs";
4
+ import { 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 } from "./type-checks.mjs";
5
5
  import { addProperty, getProperties, getPropertiesList, isPropertyOptional, isSchemaNullable, mergeSchemas } from "./helpers.mjs";
6
6
  import { generateCode, getJsonSchemaType, stringifyType, stringifyValue } from "./codegen.mjs";
7
7
  import { getCacheDirectory, getCacheFilePath, readSchema, readSchemaSafe, writeSchema } from "./persistence.mjs";
@@ -9,4 +9,4 @@ import { reflectionToJsonSchema } from "./reflection.mjs";
9
9
  import { resolve, resolveModule, resolveReflection } from "./resolve.mjs";
10
10
  import { bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant } from "./extract.mjs";
11
11
 
12
- export { JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchemaTypeNames, addProperty, applyJsonSchemaMetadata, bundle, bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant, generateCode, getCacheDirectory, getCacheFilePath, getJsonSchemaType, getPrimarySchemaType, getProperties, getPropertiesList, 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, isPropertyOptional, isSchema, isSchemaNullable, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedSchema, isValibotSchema, mergeSchemas, readSchema, readSchemaSafe, readSchemaTypes, reflectionToJsonSchema, resolve, resolveModule, resolveReflection, stringifyType, stringifyValue, writeSchema };
12
+ export { JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, JsonSchemaTypeNames, addProperty, applyJsonSchemaMetadata, bundle, bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant, generateCode, getCacheDirectory, getCacheFilePath, getJsonSchemaType, getPrimarySchemaType, getProperties, getPropertiesList, 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, isPropertyOptional, isSchema, isSchemaNullable, isSchemaWithSource, isStandardSchema, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, mergeSchemas, readSchema, readSchemaSafe, readSchemaTypes, reflectionToJsonSchema, resolve, resolveModule, resolveReflection, stringifyType, stringifyValue, writeSchema };
@@ -38,6 +38,34 @@ const DATE_FORMAT_SET = new Set([
38
38
  "unix-time"
39
39
  ]);
40
40
  const isSetBigint = (value) => typeof value === "bigint";
41
+ const UNTYPED_TYPE_NAME_SET = new Set([
42
+ "string",
43
+ "number",
44
+ "bigint",
45
+ "boolean",
46
+ "symbol",
47
+ "function",
48
+ "object",
49
+ "any",
50
+ "array"
51
+ ]);
52
+ const isUntypedJSType = (value) => (0, _stryke_type_checks.isSetString)(value) && UNTYPED_TYPE_NAME_SET.has(value);
53
+ const isUntypedTypeDescriptor = (value) => {
54
+ if (!(0, _stryke_type_checks.isSetObject)(value)) return false;
55
+ const descriptor = value;
56
+ if (descriptor.type !== void 0 && !((0, _stryke_type_checks.isSetString)(descriptor.type) && isUntypedJSType(descriptor.type) || Array.isArray(descriptor.type) && descriptor.type.every((item) => isUntypedJSType(item)))) return false;
57
+ if (descriptor.tsType !== void 0 && !(0, _stryke_type_checks.isSetString)(descriptor.tsType)) return false;
58
+ if (descriptor.markdownType !== void 0 && !(0, _stryke_type_checks.isSetString)(descriptor.markdownType)) return false;
59
+ if (descriptor.items !== void 0 && !(isUntypedTypeDescriptor(descriptor.items) || Array.isArray(descriptor.items) && descriptor.items.every((item) => isUntypedTypeDescriptor(item)))) return false;
60
+ return true;
61
+ };
62
+ const isUntypedFunctionArg = (value) => {
63
+ if (!isUntypedTypeDescriptor(value)) return false;
64
+ const arg = value;
65
+ if (arg.name !== void 0 && !(0, _stryke_type_checks.isSetString)(arg.name)) return false;
66
+ return arg.optional === void 0 || typeof arg.optional === "boolean";
67
+ };
68
+ const isRecordOfUntypedSchema = (value) => (0, _stryke_type_checks.isSetObject)(value) && Object.values(value).every((item) => isUntypedSchema(item));
41
69
  const isArrayOf = (value, predicate) => Array.isArray(value) && value.every((item) => predicate(item));
42
70
  const isTupleOfTwo = (value, aPredicate, bPredicate) => Array.isArray(value) && value.length === 2 && aPredicate(value[0]) && bPredicate(value[1]);
43
71
  const isOptionalString = (value) => value === void 0 || (0, _stryke_type_checks.isSetString)(value);
@@ -392,21 +420,33 @@ function isNullOnlyJsonSchema(input) {
392
420
  function isUntypedSchema(input) {
393
421
  if (!(0, _stryke_type_checks.isSetObject)(input)) return false;
394
422
  const schema = input;
423
+ if (!isUntypedTypeDescriptor(schema)) return false;
395
424
  if ("id" in schema && !(0, _stryke_type_checks.isSetString)(schema.id)) return false;
425
+ if ("resolve" in schema && !(0, _stryke_type_checks.isFunction)(schema.resolve)) return false;
426
+ if ("properties" in schema && !isRecordOfUntypedSchema(schema.properties)) return false;
427
+ if ("required" in schema && !isStringArray(schema.required)) return false;
396
428
  if ("title" in schema && !(0, _stryke_type_checks.isSetString)(schema.title)) return false;
397
429
  if ("description" in schema && !(0, _stryke_type_checks.isSetString)(schema.description)) return false;
398
430
  if ("$schema" in schema && !(0, _stryke_type_checks.isSetString)(schema.$schema)) return false;
399
- if ("tsType" in schema && !(0, _stryke_type_checks.isSetString)(schema.tsType)) return false;
400
- if ("markdownType" in schema && !(0, _stryke_type_checks.isSetString)(schema.markdownType)) return false;
401
- if ("type" in schema && !(0, _stryke_type_checks.isSetString)(schema.type) && !Array.isArray(schema.type)) return false;
402
- if ("required" in schema && !Array.isArray(schema.required)) return false;
403
- if ("tags" in schema && !Array.isArray(schema.tags)) return false;
404
- if ("args" in schema && !Array.isArray(schema.args)) return false;
405
- if ("properties" in schema && !(0, _stryke_type_checks.isSetObject)(schema.properties)) return false;
406
- if ("resolve" in schema && !(0, _stryke_type_checks.isFunction)(schema.resolve)) return false;
431
+ if ("tags" in schema && !isStringArray(schema.tags)) return false;
432
+ if ("args" in schema && (!Array.isArray(schema.args) || !schema.args.every((item) => isUntypedFunctionArg(item)))) return false;
433
+ if ("returns" in schema && !isUntypedTypeDescriptor(schema.returns)) return false;
407
434
  return true;
408
435
  }
409
436
  /**
437
+ * Strict type guard for untyped schema objects.
438
+ *
439
+ * @remarks
440
+ * This guard narrows values to the Untyped schema model while explicitly
441
+ * rejecting values that are also valid JSON Schema instances.
442
+ *
443
+ * @param input - The value to check.
444
+ * @returns True if the input is an untyped schema and not a JSON Schema.
445
+ */
446
+ function isUntypedSchemaStrict(input) {
447
+ return isUntypedSchema(input) && !isJsonSchema(input);
448
+ }
449
+ /**
410
450
  * Type guard for untyped input objects.
411
451
  *
412
452
  * @remarks
@@ -423,6 +463,22 @@ function isUntypedInput(input) {
423
463
  return true;
424
464
  }
425
465
  /**
466
+ * Strict type guard for untyped input objects.
467
+ *
468
+ * @remarks
469
+ * This guard narrows values to the Untyped input-object model while
470
+ * explicitly rejecting values that are valid JSON Schema objects.
471
+ *
472
+ * @param input - The value to check.
473
+ * @returns True if the input is an untyped input object and not JSON Schema.
474
+ */
475
+ function isUntypedInputStrict(input) {
476
+ if (!isUntypedInput(input) || isJsonSchema(input)) return false;
477
+ const inputObject = input;
478
+ if ("$schema" in inputObject && inputObject.$schema !== void 0 && !isUntypedSchemaStrict(inputObject.$schema)) return false;
479
+ return true;
480
+ }
481
+ /**
426
482
  * Type guard for Powerlines Schema objects.
427
483
  *
428
484
  * @param input - The value to check.
@@ -478,5 +534,7 @@ exports.isSchema = isSchema;
478
534
  exports.isSchemaWithSource = isSchemaWithSource;
479
535
  exports.isStandardSchema = isStandardSchema;
480
536
  exports.isUntypedInput = isUntypedInput;
537
+ exports.isUntypedInputStrict = isUntypedInputStrict;
481
538
  exports.isUntypedSchema = isUntypedSchema;
539
+ exports.isUntypedSchemaStrict = isUntypedSchemaStrict;
482
540
  exports.isValibotSchema = isValibotSchema;
@@ -174,6 +174,17 @@ declare function isNullOnlyJsonSchema(input: unknown): input is JsonSchemaNull;
174
174
  * @returns True if the input is an untyped schema object, false otherwise.
175
175
  */
176
176
  declare function isUntypedSchema(input: unknown): input is Schema;
177
+ /**
178
+ * Strict type guard for untyped schema objects.
179
+ *
180
+ * @remarks
181
+ * This guard narrows values to the Untyped schema model while explicitly
182
+ * rejecting values that are also valid JSON Schema instances.
183
+ *
184
+ * @param input - The value to check.
185
+ * @returns True if the input is an untyped schema and not a JSON Schema.
186
+ */
187
+ declare function isUntypedSchemaStrict(input: unknown): input is Schema;
177
188
  /**
178
189
  * Type guard for untyped input objects.
179
190
  *
@@ -184,6 +195,17 @@ declare function isUntypedSchema(input: unknown): input is Schema;
184
195
  * @returns True if the input is an untyped input object, false otherwise.
185
196
  */
186
197
  declare function isUntypedInput(input: unknown): input is InputObject;
198
+ /**
199
+ * Strict type guard for untyped input objects.
200
+ *
201
+ * @remarks
202
+ * This guard narrows values to the Untyped input-object model while
203
+ * explicitly rejecting values that are valid JSON Schema objects.
204
+ *
205
+ * @param input - The value to check.
206
+ * @returns True if the input is an untyped input object and not JSON Schema.
207
+ */
208
+ declare function isUntypedInputStrict(input: unknown): input is InputObject;
187
209
  /**
188
210
  * Type guard for Powerlines Schema objects.
189
211
  *
@@ -199,5 +221,5 @@ declare function isSchema(input: unknown): input is Schema$1;
199
221
  */
200
222
  declare function isSchemaWithSource(input: unknown): input is ExtractedSchema;
201
223
  //#endregion
202
- 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 };
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 };
203
225
  //# sourceMappingURL=type-checks.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-checks.d.cts","names":[],"sources":["../src/type-checks.ts"],"mappings":";;;;;;;;AAkGA;;;;iBAAgB,yBAAA,CACd,KAAA,YACC,KAAA,IAAS,uBAAuB;;;;AAAA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AxC6E,iBAuc7D,cAAA,CAAe,KAAA,YAAiB,KAAA,IAAS,WAAkB;AAtY3E;;;;;;;;AAAuE;AA2BvE;AA3BA,iBAgagB,oBAAA,CACd,KAAA,YACC,KAAA,IAAS,WAAkB;;;;;;;iBAuBd,QAAA,CAAS,KAAA,YAAiB,KAAA,IAAS,QAAM;AAxYzD;;;;;;AAAA,iBA0ZgB,kBAAA,CAAmB,KAAA,YAAiB,KAAA,IAAS,eAAgB"}
@@ -174,6 +174,17 @@ declare function isNullOnlyJsonSchema(input: unknown): input is JsonSchemaNull;
174
174
  * @returns True if the input is an untyped schema object, false otherwise.
175
175
  */
176
176
  declare function isUntypedSchema(input: unknown): input is Schema;
177
+ /**
178
+ * Strict type guard for untyped schema objects.
179
+ *
180
+ * @remarks
181
+ * This guard narrows values to the Untyped schema model while explicitly
182
+ * rejecting values that are also valid JSON Schema instances.
183
+ *
184
+ * @param input - The value to check.
185
+ * @returns True if the input is an untyped schema and not a JSON Schema.
186
+ */
187
+ declare function isUntypedSchemaStrict(input: unknown): input is Schema;
177
188
  /**
178
189
  * Type guard for untyped input objects.
179
190
  *
@@ -184,6 +195,17 @@ declare function isUntypedSchema(input: unknown): input is Schema;
184
195
  * @returns True if the input is an untyped input object, false otherwise.
185
196
  */
186
197
  declare function isUntypedInput(input: unknown): input is InputObject;
198
+ /**
199
+ * Strict type guard for untyped input objects.
200
+ *
201
+ * @remarks
202
+ * This guard narrows values to the Untyped input-object model while
203
+ * explicitly rejecting values that are valid JSON Schema objects.
204
+ *
205
+ * @param input - The value to check.
206
+ * @returns True if the input is an untyped input object and not JSON Schema.
207
+ */
208
+ declare function isUntypedInputStrict(input: unknown): input is InputObject;
187
209
  /**
188
210
  * Type guard for Powerlines Schema objects.
189
211
  *
@@ -199,5 +221,5 @@ declare function isSchema(input: unknown): input is Schema$1;
199
221
  */
200
222
  declare function isSchemaWithSource(input: unknown): input is ExtractedSchema;
201
223
  //#endregion
202
- 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 };
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 };
203
225
  //# sourceMappingURL=type-checks.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type-checks.d.mts","names":[],"sources":["../src/type-checks.ts"],"mappings":";;;;;;;;AAkGA;;;;iBAAgB,yBAAA,CACd,KAAA,YACC,K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a;AA1bA;AAwC7E;;;;;;;;AAxC6E,iBAuc7D,cAAA,CAAe,KAAA,YAAiB,KAAA,IAAS,WAAkB;AAtY3E;;;;;;;;AAAuE;AA2BvE;AA3BA,iBAgagB,oBAAA,CACd,KAAA,YACC,KAAA,IAAS,WAAkB;;;;;;;iBAuBd,QAAA,CAAS,KAAA,YAAiB,KAAA,IAAS,QAAM;AAxYzD;;;;;;AAAA,iBA0ZgB,kBAAA,CAAmB,KAAA,YAAiB,KAAA,IAAS,eAAgB"}
@@ -38,6 +38,34 @@ const DATE_FORMAT_SET = new Set([
38
38
  "unix-time"
39
39
  ]);
40
40
  const isSetBigint = (value) => typeof value === "bigint";
41
+ const UNTYPED_TYPE_NAME_SET = new Set([
42
+ "string",
43
+ "number",
44
+ "bigint",
45
+ "boolean",
46
+ "symbol",
47
+ "function",
48
+ "object",
49
+ "any",
50
+ "array"
51
+ ]);
52
+ const isUntypedJSType = (value) => isSetString(value) && UNTYPED_TYPE_NAME_SET.has(value);
53
+ const isUntypedTypeDescriptor = (value) => {
54
+ if (!isSetObject(value)) return false;
55
+ const descriptor = value;
56
+ if (descriptor.type !== void 0 && !(isSetString(descriptor.type) && isUntypedJSType(descriptor.type) || Array.isArray(descriptor.type) && descriptor.type.every((item) => isUntypedJSType(item)))) return false;
57
+ if (descriptor.tsType !== void 0 && !isSetString(descriptor.tsType)) return false;
58
+ if (descriptor.markdownType !== void 0 && !isSetString(descriptor.markdownType)) return false;
59
+ if (descriptor.items !== void 0 && !(isUntypedTypeDescriptor(descriptor.items) || Array.isArray(descriptor.items) && descriptor.items.every((item) => isUntypedTypeDescriptor(item)))) return false;
60
+ return true;
61
+ };
62
+ const isUntypedFunctionArg = (value) => {
63
+ if (!isUntypedTypeDescriptor(value)) return false;
64
+ const arg = value;
65
+ if (arg.name !== void 0 && !isSetString(arg.name)) return false;
66
+ return arg.optional === void 0 || typeof arg.optional === "boolean";
67
+ };
68
+ const isRecordOfUntypedSchema = (value) => isSetObject(value) && Object.values(value).every((item) => isUntypedSchema(item));
41
69
  const isArrayOf = (value, predicate) => Array.isArray(value) && value.every((item) => predicate(item));
42
70
  const isTupleOfTwo = (value, aPredicate, bPredicate) => Array.isArray(value) && value.length === 2 && aPredicate(value[0]) && bPredicate(value[1]);
43
71
  const isOptionalString = (value) => value === void 0 || isSetString(value);
@@ -392,21 +420,33 @@ function isNullOnlyJsonSchema(input) {
392
420
  function isUntypedSchema(input) {
393
421
  if (!isSetObject(input)) return false;
394
422
  const schema = input;
423
+ if (!isUntypedTypeDescriptor(schema)) return false;
395
424
  if ("id" in schema && !isSetString(schema.id)) return false;
425
+ if ("resolve" in schema && !isFunction(schema.resolve)) return false;
426
+ if ("properties" in schema && !isRecordOfUntypedSchema(schema.properties)) return false;
427
+ if ("required" in schema && !isStringArray(schema.required)) return false;
396
428
  if ("title" in schema && !isSetString(schema.title)) return false;
397
429
  if ("description" in schema && !isSetString(schema.description)) return false;
398
430
  if ("$schema" in schema && !isSetString(schema.$schema)) return false;
399
- if ("tsType" in schema && !isSetString(schema.tsType)) return false;
400
- if ("markdownType" in schema && !isSetString(schema.markdownType)) return false;
401
- if ("type" in schema && !isSetString(schema.type) && !Array.isArray(schema.type)) return false;
402
- if ("required" in schema && !Array.isArray(schema.required)) return false;
403
- if ("tags" in schema && !Array.isArray(schema.tags)) return false;
404
- if ("args" in schema && !Array.isArray(schema.args)) return false;
405
- if ("properties" in schema && !isSetObject(schema.properties)) return false;
406
- if ("resolve" in schema && !isFunction(schema.resolve)) return false;
431
+ if ("tags" in schema && !isStringArray(schema.tags)) return false;
432
+ if ("args" in schema && (!Array.isArray(schema.args) || !schema.args.every((item) => isUntypedFunctionArg(item)))) return false;
433
+ if ("returns" in schema && !isUntypedTypeDescriptor(schema.returns)) return false;
407
434
  return true;
408
435
  }
409
436
  /**
437
+ * Strict type guard for untyped schema objects.
438
+ *
439
+ * @remarks
440
+ * This guard narrows values to the Untyped schema model while explicitly
441
+ * rejecting values that are also valid JSON Schema instances.
442
+ *
443
+ * @param input - The value to check.
444
+ * @returns True if the input is an untyped schema and not a JSON Schema.
445
+ */
446
+ function isUntypedSchemaStrict(input) {
447
+ return isUntypedSchema(input) && !isJsonSchema(input);
448
+ }
449
+ /**
410
450
  * Type guard for untyped input objects.
411
451
  *
412
452
  * @remarks
@@ -423,6 +463,22 @@ function isUntypedInput(input) {
423
463
  return true;
424
464
  }
425
465
  /**
466
+ * Strict type guard for untyped input objects.
467
+ *
468
+ * @remarks
469
+ * This guard narrows values to the Untyped input-object model while
470
+ * explicitly rejecting values that are valid JSON Schema objects.
471
+ *
472
+ * @param input - The value to check.
473
+ * @returns True if the input is an untyped input object and not JSON Schema.
474
+ */
475
+ function isUntypedInputStrict(input) {
476
+ if (!isUntypedInput(input) || isJsonSchema(input)) return false;
477
+ const inputObject = input;
478
+ if ("$schema" in inputObject && inputObject.$schema !== void 0 && !isUntypedSchemaStrict(inputObject.$schema)) return false;
479
+ return true;
480
+ }
481
+ /**
426
482
  * Type guard for Powerlines Schema objects.
427
483
  *
428
484
  * @param input - The value to check.
@@ -442,5 +498,5 @@ function isSchemaWithSource(input) {
442
498
  }
443
499
 
444
500
  //#endregion
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 };
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 };
446
502
  //# sourceMappingURL=type-checks.mjs.map
@@ -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 { 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,OAAO,KAAK,EAAE,OAAM,SAAQ,cAAc,IAAI,CAAC;AAE9E,MAAM,iCAAiC,IAAI,IACzC,2BACF;AACA,MAAM,uBAAuB,IAAI,IAAoB,iBAAiB;;;;;;;AAQtE,SAAgB,0BACd,OACkC;CAClC,OACE,YAAY,KAAK,KACjB,+BAA+B,IAAI,KAAgC;AAEvE;;;;;;;AAQA,SAAgB,iBAAiB,OAAyC;CACxE,OACE,YAAY,KAAK,KAAK,qBAAqB,IAAI,KAAuB;AAE1E;AAEA,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,eAAe,UACnB,OAAO,UAAU;AAE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Q,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,SAAS,OAAiC;CACxD,OACE,YAAY,KAAK,KACjB,YAAY,SACZ,aAAa,MAAM,MAAM,KACzB,aAAa,SACb,YAAY,MAAM,OAAO,KACzB,UAAU,SACV,YAAY,MAAM,IAAI;AAE1B;;;;;;;AAQA,SAAgB,mBAAmB,OAA2C;CAC5E,OACE,SAAS,KAAK,KACd,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 type {\n FunctionArg as UntypedFunctionArg,\n InputObject as UntypedInputObject,\n Schema as UntypedSchema,\n TypeDescriptor as UntypedTypeDescriptor\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\ntype UntypedJSType =\n | \"string\"\n | \"number\"\n | \"bigint\"\n | \"boolean\"\n | \"symbol\"\n | \"function\"\n | \"object\"\n | \"any\"\n | \"array\";\n\nconst UNTYPED_TYPE_NAME_SET = new Set<UntypedJSType>([\n \"string\",\n \"number\",\n \"bigint\",\n \"boolean\",\n \"symbol\",\n \"function\",\n \"object\",\n \"any\",\n \"array\"\n]);\n\nconst isUntypedJSType = (value: unknown): value is UntypedJSType =>\n isSetString(value) && UNTYPED_TYPE_NAME_SET.has(value as UntypedJSType);\n\nconst isUntypedTypeDescriptor = (\n value: unknown\n): value is UntypedTypeDescriptor => {\n if (!isSetObject(value)) {\n return false;\n }\n\n const descriptor = value as Record<string, unknown>;\n if (\n descriptor.type !== undefined &&\n !(\n (isSetString(descriptor.type) && isUntypedJSType(descriptor.type)) ||\n (Array.isArray(descriptor.type) &&\n descriptor.type.every(item => isUntypedJSType(item)))\n )\n ) {\n return false;\n }\n\n if (descriptor.tsType !== undefined && !isSetString(descriptor.tsType)) {\n return false;\n }\n\n if (\n descriptor.markdownType !== undefined &&\n !isSetString(descriptor.markdownType)\n ) {\n return false;\n }\n\n if (\n descriptor.items !== undefined &&\n !(\n isUntypedTypeDescriptor(descriptor.items) ||\n (Array.isArray(descriptor.items) &&\n descriptor.items.every(item => isUntypedTypeDescriptor(item)))\n )\n ) {\n return false;\n }\n\n return true;\n};\n\nconst isUntypedFunctionArg = (value: unknown): value is UntypedFunctionArg => {\n if (!isUntypedTypeDescriptor(value)) {\n return false;\n }\n\n const arg = value as Record<string, unknown>;\n if (arg.name !== undefined && !isSetString(arg.name)) {\n return false;\n }\n\n return arg.optional === undefined || typeof arg.optional === \"boolean\";\n};\n\nconst isRecordOfUntypedSchema = (\n value: unknown\n): value is Record<string, UntypedSchema> =>\n isSetObject(value) &&\n Object.values(value).every(item => isUntypedSchema(item));\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 (!isUntypedTypeDescriptor(schema)) {\n return false;\n }\n if (\"id\" in schema && !isSetString(schema.id)) {\n return false;\n }\n if (\"resolve\" in schema && !isFunction(schema.resolve)) {\n return false;\n }\n if (\"properties\" in schema && !isRecordOfUntypedSchema(schema.properties)) {\n return false;\n }\n if (\"required\" in schema && !isStringArray(schema.required)) {\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 (\"tags\" in schema && !isStringArray(schema.tags)) {\n return false;\n }\n if (\n \"args\" in schema &&\n (!Array.isArray(schema.args) ||\n !schema.args.every(item => isUntypedFunctionArg(item)))\n ) {\n return false;\n }\n if (\"returns\" in schema && !isUntypedTypeDescriptor(schema.returns)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Strict type guard for untyped schema objects.\n *\n * @remarks\n * This guard narrows values to the Untyped schema model while explicitly\n * rejecting values that are also valid JSON Schema instances.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped schema and not a JSON Schema.\n */\nexport function isUntypedSchemaStrict(input: unknown): input is UntypedSchema {\n return isUntypedSchema(input) && !isJsonSchema(input);\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 * Strict type guard for untyped input objects.\n *\n * @remarks\n * This guard narrows values to the Untyped input-object model while\n * explicitly rejecting values that are valid JSON Schema objects.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped input object and not JSON Schema.\n */\nexport function isUntypedInputStrict(\n input: unknown\n): input is UntypedInputObject {\n if (!isUntypedInput(input) || isJsonSchema(input)) {\n return false;\n }\n\n const inputObject = input as Record<string, unknown>;\n if (\n \"$schema\" in inputObject &&\n inputObject.$schema !== undefined &&\n !isUntypedSchemaStrict(inputObject.$schema)\n ) {\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":";;;;AAgEA,MAAM,eAAe,UACnB,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAEpD,MAAM,gBAAgB,UACpB,OAAO,UAAU;AACnB,MAAM,qBAAqB,UACzB,YAAY,KAAK,KAAK,aAAa,KAAK;A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AGT,MAAM,cAAc;CACpB,IACE,aAAa,eACb,YAAY,YAAY,UACxB,CAAC,sBAAsB,YAAY,OAAO,GAE1C,OAAO;CAGT,OAAO;AACT;;;;;;;AAQA,SAAgB,SAAS,OAAiC;CACxD,OACE,YAAY,KAAK,KACjB,YAAY,SACZ,aAAa,MAAM,MAAM,KACzB,aAAa,SACb,YAAY,MAAM,OAAO,KACzB,UAAU,SACV,YAAY,MAAM,IAAI;AAE1B;;;;;;;AAQA,SAAgB,mBAAmB,OAA2C;CAC5E,OACE,SAAS,KAAK,KACd,YAAY,SACZ,YAAY,MAAM,MAAM,KACxB,YAAY,MAAM,UAClB,aAAa,MAAM,UACnB,YAAY,MAAM,OAAO,OAAO;AAEpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/schema",
3
- "version": "0.11.56",
3
+ "version": "0.11.57",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "keywords": [
@@ -59,9 +59,9 @@
59
59
  "typings": "dist/index.d.mts",
60
60
  "files": ["dist"],
61
61
  "dependencies": {
62
- "@powerlines/core": "^0.48.16",
63
- "@powerlines/deepkit": "^0.9.48",
64
- "@powerlines/unplugin": "^0.0.64",
62
+ "@powerlines/core": "^0.48.17",
63
+ "@powerlines/deepkit": "^0.9.49",
64
+ "@powerlines/unplugin": "^0.0.65",
65
65
  "@standard-schema/spec": "^1.1.0",
66
66
  "@stryke/hash": "^0.13.30",
67
67
  "@stryke/helpers": "^0.10.17",
@@ -92,5 +92,5 @@
92
92
  "valibot": { "optional": true }
93
93
  },
94
94
  "publishConfig": { "access": "public" },
95
- "gitHead": "d17a01b5c54562a22b817d886953571888e0f4a3"
95
+ "gitHead": "f3fdbd0e76de7d7e057362d235875488f4ee3a04"
96
96
  }