@arktype/schema
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -44,1 +44,2 @@ export * from "./ast.js"; | ||
export * from "./structure/structure.js"; | ||
export { ParseError } from "@arktype/util"; |
@@ -44,1 +44,2 @@ export * from "./ast.js"; | ||
export * from "./structure/structure.js"; | ||
export { ParseError } from "@arktype/util"; |
@@ -13,3 +13,4 @@ import { RawPrimitiveConstraint } from "../constraint.js"; | ||
defaults: { | ||
description: node => `exactly length ${node.rule}` | ||
description: node => `exactly length ${node.rule}`, | ||
actual: data => `${data.length}` | ||
}, | ||
@@ -16,0 +17,0 @@ intersections: { |
@@ -41,2 +41,3 @@ import type { DivisorSchema, ExactLengthSchema, ExclusiveDateRangeSchema, ExclusiveNumericRangeSchema, InclusiveDateRangeSchema, InclusiveNumericRangeSchema, LimitSchemaValue, RegexSchema, UnknownRangeSchema } from "@arktype/schema"; | ||
array(): BaseRoot; | ||
overlaps(r: UnknownRoot): boolean; | ||
extends(r: UnknownRoot): boolean; | ||
@@ -99,2 +100,3 @@ subsumes(r: UnknownRoot): boolean; | ||
abstract extends(r: never): this is unknown; | ||
abstract overlaps(r: never): boolean; | ||
abstract array(): unknown; | ||
@@ -133,2 +135,3 @@ abstract pipe(morph: Morph): unknown; | ||
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>, e extends Morph<inferMorphOut<d>>, f extends Morph<inferMorphOut<e>>, g extends Morph<inferMorphOut<f>>>(a: a, b: b, c: c, d: d, e: e, f: f, g: g): Root<inferPipes<t, [a, b, c, d, e, f, g]>, $>; | ||
overlaps(r: Root): boolean; | ||
} | ||
@@ -135,0 +138,0 @@ export interface Root< |
@@ -61,2 +61,6 @@ import { includes, omit, throwParseError } from "@arktype/util"; | ||
} | ||
overlaps(r) { | ||
const intersection = this.intersect(r); | ||
return !(intersection instanceof Disjoint); | ||
} | ||
extends(r) { | ||
@@ -63,0 +67,0 @@ const intersection = this.intersect(r); |
@@ -1,2 +0,2 @@ | ||
import { DynamicBase, type Json, type array, type flattenListable, type requireKeys, type show } from "@arktype/util"; | ||
import { DynamicBase, ParseError, type Json, type array, type flattenListable, type requireKeys, type show } from "@arktype/util"; | ||
import { type GenericRoot } from "./generic.js"; | ||
@@ -61,2 +61,3 @@ import type { inferRoot, validateRoot } from "./inference.js"; | ||
export type exportedNameOf<$> = Exclude<keyof $ & string, PrivateDeclaration>; | ||
export type resolvableReferenceIn<$> = keyof $ extends infer k extends string ? k extends PrivateDeclaration<infer alias> ? alias : k : never; | ||
export type PrivateDeclaration<key extends string = string> = `#${key}`; | ||
@@ -150,6 +151,7 @@ type toRawScope<$> = RawRootScope<{ | ||
export declare const units: RootScope["units"]; | ||
export declare const rawRoot: RawRootScope["schema"]; | ||
export declare const rawSchema: RawRootScope["schema"]; | ||
export declare const rawNode: RawRootScope["node"]; | ||
export declare const defineRawRoot: RawRootScope["defineRoot"]; | ||
export declare const rawUnits: RawRootScope["units"]; | ||
export declare const parseAsSchema: <castTo = unknown>(def: unknown, opts?: NodeParseOptions) => Root<castTo, {}> | ParseError; | ||
export declare class RawRootModule<resolutions extends RawRootResolutions = RawRootResolutions> extends DynamicBase<resolutions> { | ||
@@ -156,0 +158,0 @@ readonly [arkKind]: "module"; |
@@ -35,3 +35,3 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { | ||
}; | ||
import { CompiledFunction, DynamicBase, bound, envHasCsp, flatMorph, hasDomain, isArray, printable, throwInternalError, throwParseError } from "@arktype/util"; | ||
import { CompiledFunction, DynamicBase, ParseError, bound, envHasCsp, flatMorph, hasDomain, isArray, printable, throwInternalError, throwParseError } from "@arktype/util"; | ||
import { globalConfig, mergeConfigs } from "./config.js"; | ||
@@ -359,6 +359,16 @@ import { validateUninstantiatedGenericNode } from "./generic.js"; | ||
export const units = root.units; | ||
export const rawRoot = root.raw.schema; | ||
export const rawSchema = root.raw.schema; | ||
export const rawNode = root.raw.node; | ||
export const defineRawRoot = root.raw.defineRoot; | ||
export const rawUnits = root.raw.units; | ||
export const parseAsSchema = (def, opts) => { | ||
try { | ||
return schema(def, opts); | ||
} | ||
catch (e) { | ||
if (e instanceof ParseError) | ||
return e; | ||
throw e; | ||
} | ||
}; | ||
export class RawRootModule extends DynamicBase { | ||
@@ -365,0 +375,0 @@ } |
{ | ||
"name": "@arktype/schema", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "author": { | ||
"dependencies": { | ||
"@arktype/util": "0.0.47" | ||
"@arktype/util": "0.0.48" | ||
}, | ||
@@ -29,0 +29,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
317131
7144
+ Added@arktype/util@0.0.48(transitive)
- Removed@arktype/util@0.0.47(transitive)
Updated@arktype/util@0.0.48