@arktype/schema
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,3 +5,2 @@ import { attest, contextualize } from "@arktype/attest" | ||
import { boundKindPairsByLower } from "../constraints/refinements/range.js" | ||
import type { IntersectionDef } from "../schemas/intersection.js" | ||
import { Disjoint } from "../shared/disjoint.js" | ||
@@ -104,3 +103,3 @@ | ||
[max]: { rule: 10 } | ||
} as IntersectionDef) | ||
} as never) | ||
@@ -120,3 +119,3 @@ attest(t.allows(cases.lessThanMin)).equals(false) | ||
} | ||
} as IntersectionDef) | ||
} as never) | ||
const r = schema({ | ||
@@ -127,3 +126,3 @@ ...basis, | ||
} | ||
} as IntersectionDef) | ||
} as never) | ||
const expected = | ||
@@ -138,3 +137,3 @@ min === "min" ? | ||
exactLength: 6 | ||
} as IntersectionDef) | ||
} as never) | ||
: schema({ | ||
@@ -154,3 +153,3 @@ unit: new Date(6) | ||
} | ||
} as IntersectionDef) | ||
} as never) | ||
const r = schema({ | ||
@@ -162,3 +161,3 @@ ...basis, | ||
} | ||
} as IntersectionDef) | ||
} as never) | ||
attest(l.intersect(r)).instanceOf(Disjoint) | ||
@@ -169,7 +168,7 @@ attest(r.intersect(l)).instanceOf(Disjoint) | ||
it("non-overlapping limits", () => { | ||
const l = schema({ ...basis, [min]: 3 } as IntersectionDef) | ||
const l = schema({ ...basis, [min]: 3 } as never) | ||
const r = schema({ | ||
...basis, | ||
[max]: 1 | ||
} as IntersectionDef) | ||
} as never) | ||
attest(l.intersect(r)).instanceOf(Disjoint) | ||
@@ -183,7 +182,7 @@ attest(r.intersect(l)).instanceOf(Disjoint) | ||
[min]: 3 | ||
} as IntersectionDef) | ||
} as never) | ||
const greater = schema({ | ||
...basis, | ||
[min]: 4 | ||
} as IntersectionDef) | ||
} as never) | ||
attest(lesser.and(greater).json).equals(greater.json) | ||
@@ -197,7 +196,7 @@ attest(greater.and(lesser).json).equals(greater.json) | ||
[max]: 3 | ||
} as IntersectionDef) | ||
} as never) | ||
const greater = schema({ | ||
...basis, | ||
[max]: { rule: 4, exclusive: true } | ||
} as IntersectionDef) | ||
} as never) | ||
attest(lesser.and(greater).json).equals(lesser.json) | ||
@@ -211,7 +210,7 @@ attest(greater.and(lesser).json).equals(lesser.json) | ||
[max]: { rule: 3, exclusive: true } | ||
} as IntersectionDef) | ||
} as never) | ||
const inclusive = schema({ | ||
...basis, | ||
[max]: 3 | ||
} as IntersectionDef) | ||
} as never) | ||
attest(exclusive.and(inclusive).json).equals(exclusive.json) | ||
@@ -218,0 +217,0 @@ attest(inclusive.and(exclusive).json).equals(exclusive.json) |
@@ -5,10 +5,8 @@ import type { Key } from "@arktype/util" | ||
export namespace internalKeywords { | ||
export interface exports { | ||
lengthBoundable: string | unknown[] | ||
propertyKey: Key | ||
} | ||
export interface internalKeywordExports { | ||
lengthBoundable: string | unknown[] | ||
propertyKey: Key | ||
} | ||
export type internalKeywords = SchemaModule<internalKeywords.exports> | ||
export type internalKeywords = SchemaModule<internalKeywordExports> | ||
@@ -15,0 +13,0 @@ export const internalKeywords: internalKeywords = schemaScope( |
import type { SchemaModule } from "../module.js" | ||
import { schemaScope } from "../scope.js" | ||
export namespace jsObjects { | ||
export interface exports { | ||
Array: Array<unknown> | ||
Function: Function | ||
Date: Date | ||
Error: Error | ||
Map: Map<unknown, unknown> | ||
RegExp: RegExp | ||
Set: Set<unknown> | ||
WeakMap: WeakMap<object, unknown> | ||
WeakSet: WeakSet<object> | ||
Promise: Promise<unknown> | ||
} | ||
export interface jsObjectExports { | ||
Array: Array<unknown> | ||
Function: Function | ||
Date: Date | ||
Error: Error | ||
Map: Map<unknown, unknown> | ||
RegExp: RegExp | ||
Set: Set<unknown> | ||
WeakMap: WeakMap<object, unknown> | ||
WeakSet: WeakSet<object> | ||
Promise: Promise<unknown> | ||
} | ||
export type jsObjects = SchemaModule<jsObjects.exports> | ||
export type jsObjects = SchemaModule<jsObjectExports> | ||
@@ -21,0 +19,0 @@ export const jsObjects: jsObjects = schemaScope( |
@@ -6,7 +6,7 @@ import type { GenericSchema } from "../generic.js" | ||
// and used to bootstrap nodes with constraints | ||
import { tsKeywords } from "./tsKeywords.js" | ||
import { tsKeywords, type tsKeywordExports } from "./tsKeywords.js" | ||
import { jsObjects } from "./jsObjects.js" | ||
import { parsing } from "./parsing.js" | ||
import { validation } from "./validation.js" | ||
import { jsObjects, type jsObjectExports } from "./jsObjects.js" | ||
import { parsing, type parsingExports } from "./parsing.js" | ||
import { validation, type validationExports } from "./validation.js" | ||
@@ -40,7 +40,7 @@ type TsGenericsExports<$ = Ark> = { | ||
export interface Ark | ||
extends tsKeywords.exports, | ||
jsObjects.exports, | ||
validation.exports, | ||
extends tsKeywordExports, | ||
jsObjectExports, | ||
validationExports, | ||
TsGenericsExports { | ||
parse: SchemaModule<parsing.exports> | ||
parse: SchemaModule<parsingExports> | ||
} |
@@ -62,13 +62,11 @@ import { | ||
export namespace parsing { | ||
export type exports = { | ||
url: (In: string) => Out<URL> | ||
number: (In: string) => Out<number> | ||
integer: (In: string) => Out<number> | ||
date: (In: string) => Out<Date> | ||
json: (In: string) => Out<unknown> | ||
} | ||
export type parsingExports = { | ||
url: (In: string) => Out<URL> | ||
number: (In: string) => Out<number> | ||
integer: (In: string) => Out<number> | ||
date: (In: string) => Out<Date> | ||
json: (In: string) => Out<unknown> | ||
} | ||
export type parsing = SchemaModule<parsing.exports> | ||
export type parsing = SchemaModule<parsingExports> | ||
@@ -75,0 +73,0 @@ export const parsing: parsing = schemaScope({ |
@@ -5,22 +5,20 @@ import type { type } from "../inference.js" | ||
export namespace tsKeywords { | ||
export interface exports { | ||
any: any | ||
bigint: bigint | ||
boolean: boolean | ||
false: false | ||
never: never | ||
null: null | ||
number: number | ||
object: object | ||
string: string | ||
symbol: symbol | ||
true: true | ||
unknown: unknown | ||
void: void | ||
undefined: undefined | ||
} | ||
export interface tsKeywordExports { | ||
any: any | ||
bigint: bigint | ||
boolean: boolean | ||
false: false | ||
never: never | ||
null: null | ||
number: number | ||
object: object | ||
string: string | ||
symbol: symbol | ||
true: true | ||
unknown: unknown | ||
void: void | ||
undefined: undefined | ||
} | ||
export type tsKeywords = SchemaModule<tsKeywords.exports> | ||
export type tsKeywords = SchemaModule<tsKeywordExports> | ||
@@ -27,0 +25,0 @@ export const tsKeywords: tsKeywords = schemaScope( |
@@ -57,18 +57,16 @@ import type { SchemaModule } from "../module.js" | ||
export namespace validation { | ||
export interface exports { | ||
alpha: string | ||
alphanumeric: string | ||
lowercase: string | ||
uppercase: string | ||
creditCard: string | ||
email: string | ||
uuid: string | ||
url: string | ||
semver: string | ||
integer: number | ||
} | ||
export interface validationExports { | ||
alpha: string | ||
alphanumeric: string | ||
lowercase: string | ||
uppercase: string | ||
creditCard: string | ||
email: string | ||
uuid: string | ||
url: string | ||
semver: string | ||
integer: number | ||
} | ||
export type validation = SchemaModule<validation.exports> | ||
export type validation = SchemaModule<validationExports> | ||
@@ -75,0 +73,0 @@ export const validation: validation = schemaScope( |
import { DynamicBase, type isAnyOrNever } from "@arktype/util" | ||
import type { Schema } from "./schema.js" | ||
import { addArkKind, type arkKind } from "./shared/utils.js" | ||
import { addArkKind, arkKind } from "./shared/utils.js" | ||
@@ -5,0 +5,0 @@ export type PreparsedNodeResolution = { |
@@ -0,1 +1,2 @@ | ||
export {}; | ||
// export type inferPropsInput<input extends PropsInput> = | ||
@@ -2,0 +3,0 @@ // input extends PropsInputTuple<infer named, infer indexed> |
import type { Key } from "@arktype/util"; | ||
import type { SchemaModule } from "../module.js"; | ||
export declare namespace internalKeywords { | ||
interface exports { | ||
lengthBoundable: string | unknown[]; | ||
propertyKey: Key; | ||
} | ||
export interface internalKeywordExports { | ||
lengthBoundable: string | unknown[]; | ||
propertyKey: Key; | ||
} | ||
export type internalKeywords = SchemaModule<internalKeywords.exports>; | ||
export type internalKeywords = SchemaModule<internalKeywordExports>; | ||
export declare const internalKeywords: internalKeywords; |
import type { SchemaModule } from "../module.js"; | ||
export declare namespace jsObjects { | ||
interface exports { | ||
Array: Array<unknown>; | ||
Function: Function; | ||
Date: Date; | ||
Error: Error; | ||
Map: Map<unknown, unknown>; | ||
RegExp: RegExp; | ||
Set: Set<unknown>; | ||
WeakMap: WeakMap<object, unknown>; | ||
WeakSet: WeakSet<object>; | ||
Promise: Promise<unknown>; | ||
} | ||
export interface jsObjectExports { | ||
Array: Array<unknown>; | ||
Function: Function; | ||
Date: Date; | ||
Error: Error; | ||
Map: Map<unknown, unknown>; | ||
RegExp: RegExp; | ||
Set: Set<unknown>; | ||
WeakMap: WeakMap<object, unknown>; | ||
WeakSet: WeakSet<object>; | ||
Promise: Promise<unknown>; | ||
} | ||
export type jsObjects = SchemaModule<jsObjects.exports>; | ||
export type jsObjects = SchemaModule<jsObjectExports>; | ||
export declare const jsObjects: jsObjects; |
import type { GenericSchema } from "../generic.js"; | ||
import type { SchemaModule } from "../module.js"; | ||
import { type SchemaScope } from "../scope.js"; | ||
import { tsKeywords } from "./tsKeywords.js"; | ||
import { jsObjects } from "./jsObjects.js"; | ||
import { parsing } from "./parsing.js"; | ||
import { validation } from "./validation.js"; | ||
import { type tsKeywordExports } from "./tsKeywords.js"; | ||
import { type jsObjectExports } from "./jsObjects.js"; | ||
import { type parsingExports } from "./parsing.js"; | ||
import { type validationExports } from "./validation.js"; | ||
type TsGenericsExports<$ = Ark> = { | ||
@@ -18,5 +18,5 @@ Record: GenericSchema<[ | ||
export declare const keywordNodes: SchemaModule<Ark>; | ||
export interface Ark extends tsKeywords.exports, jsObjects.exports, validation.exports, TsGenericsExports { | ||
parse: SchemaModule<parsing.exports>; | ||
export interface Ark extends tsKeywordExports, jsObjectExports, validationExports, TsGenericsExports { | ||
parse: SchemaModule<parsingExports>; | ||
} | ||
export {}; |
import type { SchemaModule } from "../module.js"; | ||
import type { Out } from "../schemas/morph.js"; | ||
export declare namespace parsing { | ||
type exports = { | ||
url: (In: string) => Out<URL>; | ||
number: (In: string) => Out<number>; | ||
integer: (In: string) => Out<number>; | ||
date: (In: string) => Out<Date>; | ||
json: (In: string) => Out<unknown>; | ||
}; | ||
} | ||
export type parsing = SchemaModule<parsing.exports>; | ||
export type parsingExports = { | ||
url: (In: string) => Out<URL>; | ||
number: (In: string) => Out<number>; | ||
integer: (In: string) => Out<number>; | ||
date: (In: string) => Out<Date>; | ||
json: (In: string) => Out<unknown>; | ||
}; | ||
export type parsing = SchemaModule<parsingExports>; | ||
export declare const parsing: parsing; |
import type { SchemaModule } from "../module.js"; | ||
export declare namespace tsKeywords { | ||
interface exports { | ||
any: any; | ||
bigint: bigint; | ||
boolean: boolean; | ||
false: false; | ||
never: never; | ||
null: null; | ||
number: number; | ||
object: object; | ||
string: string; | ||
symbol: symbol; | ||
true: true; | ||
unknown: unknown; | ||
void: void; | ||
undefined: undefined; | ||
} | ||
export interface tsKeywordExports { | ||
any: any; | ||
bigint: bigint; | ||
boolean: boolean; | ||
false: false; | ||
never: never; | ||
null: null; | ||
number: number; | ||
object: object; | ||
string: string; | ||
symbol: symbol; | ||
true: true; | ||
unknown: unknown; | ||
void: void; | ||
undefined: undefined; | ||
} | ||
export type tsKeywords = SchemaModule<tsKeywords.exports>; | ||
export type tsKeywords = SchemaModule<tsKeywordExports>; | ||
export declare const tsKeywords: tsKeywords; |
import type { SchemaModule } from "../module.js"; | ||
export declare namespace validation { | ||
interface exports { | ||
alpha: string; | ||
alphanumeric: string; | ||
lowercase: string; | ||
uppercase: string; | ||
creditCard: string; | ||
email: string; | ||
uuid: string; | ||
url: string; | ||
semver: string; | ||
integer: number; | ||
} | ||
export interface validationExports { | ||
alpha: string; | ||
alphanumeric: string; | ||
lowercase: string; | ||
uppercase: string; | ||
creditCard: string; | ||
email: string; | ||
uuid: string; | ||
url: string; | ||
semver: string; | ||
integer: number; | ||
} | ||
export type validation = SchemaModule<validation.exports>; | ||
export type validation = SchemaModule<validationExports>; | ||
export declare const validation: validation; |
import { DynamicBase, type isAnyOrNever } from "@arktype/util"; | ||
import type { Schema } from "./schema.js"; | ||
import { type arkKind } from "./shared/utils.js"; | ||
import { arkKind } from "./shared/utils.js"; | ||
export type PreparsedNodeResolution = { | ||
@@ -5,0 +5,0 @@ [arkKind]: "generic" | "module"; |
import { DynamicBase } from "@arktype/util"; | ||
import { addArkKind } from "./shared/utils.js"; | ||
import { addArkKind, arkKind } from "./shared/utils.js"; | ||
export class SchemaModule extends DynamicBase { | ||
@@ -4,0 +4,0 @@ constructor(types) { |
{ | ||
"name": "@arktype/schema", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
@@ -42,4 +42,4 @@ "author": { | ||
"dependencies": { | ||
"@arktype/util": "0.0.35" | ||
"@arktype/util": "0.0.36" | ||
} | ||
} |
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
699185
14622
+ Added@arktype/util@0.0.36(transitive)
- Removed@arktype/util@0.0.35(transitive)
Updated@arktype/util@0.0.36