Socket
Socket
Sign inDemoInstall

@ark/schema

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ark/schema - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

out/intrinsic.d.ts

27

out/config.d.ts
import { type mutable, type requireKeys, type show } from "@ark/util";
import type { Ark } from "./keywords/keywords.js";
import type { InternalBaseScope, IntrinsicKeywords } from "./scope.js";
import type { intrinsic } from "./intrinsic.js";
import type { ActualWriter, ArkErrorCode, ExpectedWriter, MessageWriter, ProblemWriter } from "./shared/errors.js";
import { type DescriptionWriter, type NodeKind } from "./shared/implement.js";
export interface ArkSchemaRegistryContents {
intrinsic: typeof intrinsic;
config: ArkConfig;
defaultConfig: ResolvedArkConfig;
}
declare global {
export interface ArkEnv {
$(): Ark;
meta(): {};
preserve(): never;
registry(): {
ambient: InternalBaseScope;
intrinsic: IntrinsicKeywords;
config: ArkConfig;
defaultConfig: ResolvedArkConfig;
};
registry(): ArkSchemaRegistryContents;
}
export namespace ArkEnv {
type $ = ReturnType<ArkEnv["$"]>;
type meta = ReturnType<ArkEnv["meta"]>;
type preserve = ReturnType<ArkEnv["preserve"]>;
}

@@ -49,8 +44,8 @@ }

}
type resolveConfig<config extends ArkConfig> = {
[k in keyof config]-?: k extends NodeKind ? Required<config[k]> : config[k];
};
export type resolveConfig<config extends ArkConfig> = show<{
[k in keyof ArkConfig]-?: k extends NodeKind ? Required<config[k]> : config[k];
} & Omit<config, keyof ArkConfig>>;
export type ResolvedArkConfig = resolveConfig<ArkConfig>;
export declare const extendConfig: (base: ArkConfig, extension: ArkConfig | undefined) => ArkConfig;
export declare const resolveConfig: (config: ArkConfig | undefined) => ResolvedArkConfig;
export declare const resolveConfig: <config extends ArkConfig>(config: config | undefined) => resolveConfig<config>;
export {};

@@ -19,6 +19,2 @@ import { $ark } from "@ark/util";

};
const nonInheritedKeys = [
"intrinsic",
"prereducedAliases"
];
export const extendConfig = (base, extension) => {

@@ -28,8 +24,4 @@ if (!extension)

const result = mergeConfigs(base, extension);
nonInheritedKeys.forEach(k => {
if (!(k in extension))
delete result[k];
});
return result;
};
export const resolveConfig = (config) => extendConfig(extendConfig($ark.defaultConfig, $ark.config), config);

@@ -6,3 +6,3 @@ import { type array, type describe, type listable, type satisfy } from "@ark/util";

import type { IntersectionInner, MutableIntersectionInner } from "./roots/intersection.js";
import type { BaseRoot, SchemaRoot, UnknownRoot } from "./roots/root.js";
import type { BaseRoot } from "./roots/root.js";
import type { NodeCompiler } from "./shared/compile.js";

@@ -52,7 +52,7 @@ import type { BaseNodeDeclaration } from "./shared/declare.js";

export type intersectConstraintKinds<l extends ConstraintKind, r extends ConstraintKind> = Node<l | r | "unit" | "union"> | Disjoint | null;
export declare const throwInvalidOperandError: (kind: "pattern" | "divisor" | "exactLength" | "max" | "min" | "maxLength" | "minLength" | "before" | "after" | "required" | "optional" | "index" | "sequence" | "structure" | "predicate", expected: SchemaRoot<unknown, any>, actual: SchemaRoot<unknown, any>) => never;
export declare const writeInvalidOperandMessage: <kind extends ConstraintKind, expected extends SchemaRoot, actual extends SchemaRoot>(kind: kind, expected: expected, actual: actual) => never;
export type writeInvalidOperandMessage<kind extends ConstraintKind, actual extends SchemaRoot> = `${Capitalize<kind>} operand must be ${describe<Prerequisite<kind>>} (was ${describe<Exclude<actual["infer"], Prerequisite<kind>>>})`;
export declare const throwInvalidOperandError: (kind: "pattern" | "divisor" | "exactLength" | "max" | "min" | "maxLength" | "minLength" | "before" | "after" | "required" | "optional" | "index" | "sequence" | "structure" | "predicate", expected: BaseRoot<import("./roots/root.js").InternalRootDeclaration>, actual: BaseRoot<import("./roots/root.js").InternalRootDeclaration>) => never;
export declare const writeInvalidOperandMessage: <kind extends ConstraintKind, expected extends BaseRoot, actual extends BaseRoot>(kind: kind, expected: expected, actual: actual) => string;
export type writeInvalidOperandMessage<kind extends ConstraintKind, actual> = `${Capitalize<kind>} operand must be ${describe<Prerequisite<kind>>} (was ${describe<Exclude<actual, Prerequisite<kind>>>})`;
export interface ConstraintAttachments {
impliedBasis: UnknownRoot | null;
impliedBasis: BaseRoot | null;
impliedSiblings?: array<BaseConstraint> | null;

@@ -59,0 +59,0 @@ }

import { Callable, type array, type Json } from "@ark/util";
import type { inferRoot } from "./inference.js";
import type { SchemaRoot, UnknownRoot } from "./roots/root.js";
import type { BaseScope, InternalBaseScope } from "./scope.js";
import type { BaseNode } from "./node.js";
import type { BaseRoot } from "./roots/root.js";
import type { BaseScope } from "./scope.js";
import { arkKind } from "./shared/utils.js";
export type GenericParamAst<name extends string = string, constraint = unknown> = [name: name, constraint: constraint];
export type GenericParamDef<name extends string = string> = name | ConstrainedGenericParamDef;
export type ConstrainedGenericParamDef<name extends string = string> = GenericParamAst<name>;
export type GenericParamDef<name extends string = string> = name | readonly [name, unknown];
export declare const parseGeneric: (paramDefs: array<GenericParamDef>, bodyDef: unknown, $: BaseScope) => GenericRoot;
type genericParamSchemaToAst<schema extends GenericParamDef, $> = schema extends string ? GenericParamAst<schema> : schema extends ConstrainedGenericParamDef ? [
schema[0],
inferRoot<schema[1], $>
] : never;
export type genericParamSchemasToAst<schemas extends array<GenericParamDef>, $> = [...{
[i in keyof schemas]: genericParamSchemaToAst<schemas[i], $>;
}];
export type genericParamAstToDefs<asts extends array<GenericParamAst>> = {
[i in keyof asts]: GenericParamDef<asts[i][0]>;
};
export type genericParamNames<params extends array<GenericParamAst>> = {

@@ -26,47 +15,53 @@ [i in keyof params]: params[i][0];

};
type instantiateParams<params extends array<GenericParamAst>> = {
[i in keyof params]: params[i] extends (GenericParamAst<infer name, infer constraint>) ? GenericParam<name, constraint> : never;
export type GenericArgResolutions<params extends array<GenericParamAst> = array<GenericParamAst>> = {
[i in keyof params as params[i & `${number}`][0]]: BaseRoot;
};
export type GenericRootInstantiator<params extends array<GenericParamAst>, def, $> = <args extends instantiateConstraintsOf<params>>(...args: args) => SchemaRoot<inferRoot<def, $ & bindGenericNodeInstantiation<params, $, args>>>;
type instantiateConstraintsOf<params extends array<GenericParamAst>> = {
[i in keyof params]: SchemaRoot<params[i][1]>;
};
export type GenericParam<name extends string = string, constraint = unknown> = readonly [name: name, constraint: UnknownRoot<constraint>];
export type bindGenericNodeInstantiation<params extends array<GenericParamAst>, $, args> = {
[i in keyof params & `${number}` as params[i][0]]: inferRoot<args[i & keyof args], $>;
};
export interface GenericProps<params extends array<GenericParamAst> = array<GenericParamAst>, bodyDef = any, $ = any> {
export declare class LazyGenericBody<argResolutions = {}, returns = unknown> extends Callable<(args: argResolutions) => returns> {
}
export interface GenericAst<params extends array<GenericParamAst> = array<GenericParamAst>, bodyDef = unknown, $ = unknown, arg$ = $> {
[arkKind]: "generic";
paramsAst: params;
params: instantiateParams<params>;
bodyDef: bodyDef;
$: $;
arg$: arg$;
names: genericParamNames<params>;
constraints: instantiateConstraintsOf<params>;
bodyDef: bodyDef;
$: BaseScope<$>;
t: this;
}
export type GenericArgResolutions<params extends array<GenericParamAst> = array<GenericParamAst>> = {
[i in keyof params as params[i & `${number}`][0]]: SchemaRoot<params[i & `${number}`][1]>;
};
export declare class LazyGenericBody<argResolutions = {}, returns = unknown> extends Callable<(args: argResolutions) => returns> {
}
export declare class GenericRoot<params extends array<GenericParamAst> = array<GenericParamAst>, bodyDef = unknown, $ = {}, arg$ = $> extends Callable<GenericRootInstantiator<params, bodyDef, $>> {
paramDefs: genericParamAstToDefs<params>;
export declare class GenericRoot<params extends array<GenericParamAst> = array<GenericParamAst>, bodyDef = unknown> extends Callable<(...args: {
[i in keyof params]: BaseRoot;
}) => BaseRoot> {
paramDefs: array<GenericParamDef>;
bodyDef: bodyDef;
$: BaseScope<$>;
arg$: BaseScope<arg$>;
$: BaseScope;
arg$: BaseScope;
readonly [arkKind] = "generic";
readonly paramsAst: params;
constructor(paramDefs: genericParamAstToDefs<params>, bodyDef: bodyDef, $: BaseScope<$>, arg$: BaseScope<arg$>);
defIsLazy(): this is GenericRoot<params, LazyGenericBody, $, arg$>;
bindScope($: InternalBaseScope): this;
readonly t: GenericAst<params, bodyDef, {}, {}>;
constructor(paramDefs: array<GenericParamDef>, bodyDef: bodyDef, $: BaseScope, arg$: BaseScope);
defIsLazy(): this is GenericRoot<params, LazyGenericBody>;
bindScope($: BaseScope): this;
get json(): Json;
get params(): instantiateParams<params>;
get params(): {
[i in keyof params]: [params[i][0], BaseRoot];
};
get names(): genericParamNames<params>;
get constraints(): instantiateConstraintsOf<params>;
get baseInstantiation(): SchemaRoot;
get constraints(): {
[i in keyof params]: BaseRoot;
};
get baseInstantiation(): BaseRoot;
validateBaseInstantiation(): this;
get internal(): this;
get references(): import("./node.js").BaseNode<import("./index.js").BaseNodeDeclaration>[];
get references(): BaseNode[];
}
export type GenericHktSchemaParser<$ = {}> = <const paramsDef extends array<GenericParamDef>>(...params: paramsDef) => <hkt extends abstract new () => GenericHkt, params extends Array<GenericParamAst> = genericParamSchemasToAst<paramsDef, $>>(instantiateDef: LazyGenericBody<GenericArgResolutions<params>>, hkt: hkt) => GenericRoot<params, InstanceType<hkt>, $, $>;
export type genericParamSchemasToAst<schemas extends readonly GenericParamDef[]> = {
[i in keyof schemas]: schemas[i] extends GenericParamDef<infer name> ? [
name,
unknown
] : never;
};
export type genericHktToConstraints<hkt extends abstract new () => GenericHkt> = Parameters<InstanceType<hkt>["hkt"]>[0];
export type GenericHktSchemaParser = <const paramsDef extends readonly GenericParamDef[]>(...params: paramsDef) => GenericHktSchemaBodyParser<genericParamSchemasToAst<paramsDef>>;
export type GenericHktSchemaBodyParser<params extends array<GenericParamAst>> = <hkt extends abstract new () => GenericHkt>(instantiateDef: LazyGenericBody<GenericArgResolutions<params>>, hkt: hkt) => GenericRoot<{
[i in keyof params]: [params[i][0], genericHktToConstraints<hkt>[i]];
}, InstanceType<hkt>>;
export declare abstract class GenericHkt<hkt extends (args: any) => unknown = (args: any) => unknown> {

@@ -84,2 +79,1 @@ readonly args: array;

export type writeUnsatisfiedParameterConstraintMessage<name extends string, constraint extends string, arg extends string> = `${name} must be assignable to ${constraint} (was ${arg})`;
export {};

@@ -104,3 +104,3 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

get params() {
return this.paramDefs.map((param) => typeof param === "string" ?
return this.paramDefs.map(param => typeof param === "string" ?
[param, $ark.intrinsic.unknown]

@@ -107,0 +107,0 @@ : [param[0], this.$.parseRoot(param[1])]);

@@ -1,12 +0,5 @@

export * from "./ast.js";
export * from "./config.js";
export * from "./constraint.js";
export * from "./generic.js";
export * from "./inference.js";
export * from "./keywords/internal.js";
export * from "./keywords/jsObjects.js";
export * from "./keywords/keywords.js";
export * from "./keywords/parsing.js";
export * from "./keywords/tsKeywords.js";
export * from "./keywords/validation.js";
export * from "./intrinsic.js";
export * from "./kinds.js";

@@ -13,0 +6,0 @@ export * from "./module.js";

@@ -1,12 +0,5 @@

export * from "./ast.js";
export * from "./config.js";
export * from "./constraint.js";
export * from "./generic.js";
export * from "./inference.js";
export * from "./keywords/internal.js";
export * from "./keywords/jsObjects.js";
export * from "./keywords/keywords.js";
export * from "./keywords/parsing.js";
export * from "./keywords/tsKeywords.js";
export * from "./keywords/validation.js";
export * from "./intrinsic.js";
export * from "./kinds.js";

@@ -13,0 +6,0 @@ export * from "./module.js";

@@ -14,3 +14,3 @@ import { type array, type listable } from "@ark/util";

import { UnitNode, type UnitDeclaration } from "./roots/unit.js";
import type { InternalBaseScope } from "./scope.js";
import type { BaseScope } from "./scope.js";
import type { ConstraintKind, NodeKind, OpenNodeKind, RootKind, UnknownAttachments, UnknownNodeImplementation } from "./shared/implement.js";

@@ -41,3 +41,3 @@ import type { makeRootAndArrayPropertiesMutable } from "./shared/utils.js";

export declare const nodeImplementationsByKind: Record<NodeKind, UnknownNodeImplementation>;
export declare const nodeClassesByKind: Record<NodeKind, new (attachments: UnknownAttachments, $: InternalBaseScope) => BaseNode>;
export declare const nodeClassesByKind: Record<NodeKind, new (attachments: UnknownAttachments, $: BaseScope) => BaseNode>;
interface NodesByKind extends BoundNodesByKind {

@@ -44,0 +44,0 @@ alias: AliasNode;

@@ -40,5 +40,3 @@ import { $ark, envHasCsp, flatMorph } from "@ark/util";

]), {
jitless: envHasCsp(),
intrinsic: false,
prereducedAliases: false
jitless: envHasCsp()
});

@@ -45,0 +43,0 @@ export const nodeClassesByKind = {

import { DynamicBase, type anyOrNever } from "@ark/util";
import type { SchemaRoot } from "./roots/root.js";
import type { BaseRoot } from "./roots/root.js";
import type { BaseScope, InternalResolution, InternalResolutions } from "./scope.js";
import { arkKind } from "./shared/utils.js";

@@ -7,9 +8,12 @@ export type PreparsedNodeResolution = {

};
export declare class RootModule<exports extends object = {}> extends DynamicBase<exports> {
export declare class RootModule<exports extends {} = {}> extends DynamicBase<exports> {
get [arkKind](): "module";
}
export interface InternalModule<exports extends InternalResolutions = InternalResolutions> extends RootModule<exports> {
}
export declare const bindModule: (module: InternalModule, $: BaseScope) => InternalModule;
type exportSchemaScope<$> = {
[k in keyof $]: $[k] extends PreparsedNodeResolution ? [
[k in keyof $]: $[k] extends InternalResolution ? [
$[k]
] extends [anyOrNever] ? SchemaRoot<$[k], $> : $[k] : SchemaRoot<$[k], $>;
] extends [anyOrNever] ? BaseRoot : $[k] : BaseRoot;
};

@@ -16,0 +20,0 @@ export declare const SchemaModule: new <$ = {}>(types: exportSchemaScope<$>) => SchemaModule<$>;

@@ -1,3 +0,3 @@

import { DynamicBase } from "@ark/util";
import { arkKind } from "./shared/utils.js";
import { DynamicBase, flatMorph } from "@ark/util";
import { arkKind, hasArkKind } from "./shared/utils.js";
export class RootModule extends DynamicBase {

@@ -9,2 +9,6 @@ // ensure `[arkKind]` is non-enumerable so it doesn't get spread on import/export

}
export const bindModule = (module, $) => new RootModule(flatMorph(module, (alias, value) => [
alias,
hasArkKind(value, "module") ? bindModule(value, $) : value.bindScope($)
]));
export const SchemaModule = RootModule;
import { Callable, type Guardable, type Json, type Key, type array, type conform, type listable, type mutable } from "@ark/util";
import type { ArkErrors } from "arktype";
import type { BaseConstraint } from "./constraint.js";

@@ -6,5 +7,5 @@ import type { Inner, Node, reducibleKindOf } from "./kinds.js";

import type { MorphNode } from "./roots/morph.js";
import type { BaseRoot, Root } from "./roots/root.js";
import type { BaseRoot } from "./roots/root.js";
import type { UnitNode } from "./roots/unit.js";
import type { InternalBaseScope } from "./scope.js";
import type { BaseScope } from "./scope.js";
import type { NodeCompiler } from "./shared/compile.js";

@@ -15,3 +16,2 @@ import type { BaseMeta, BaseNodeDeclaration, attachmentsOf } from "./shared/declare.js";

import { type arkKind } from "./shared/utils.js";
export type UnknownNode = BaseNode | Root;
export declare abstract class BaseNode<

@@ -22,5 +22,5 @@ /** uses -ignore rather than -expect-error because this is not an error in .d.ts

attachments: UnknownAttachments;
$: InternalBaseScope;
constructor(attachments: UnknownAttachments, $: InternalBaseScope);
bindScope($: InternalBaseScope): this;
$: BaseScope;
constructor(attachments: UnknownAttachments, $: BaseScope);
bindScope($: BaseScope): this;
abstract traverseAllows: TraverseAllows<d["prerequisite"]>;

@@ -41,3 +41,3 @@ abstract traverseApply: TraverseApply<d["prerequisite"]>;

allows: (data: d["prerequisite"]) => boolean;
traverse(data: d["prerequisite"]): unknown;
traverse(data: d["prerequisite"]): ArkErrors | {} | null | undefined;
get in(): this extends {

@@ -52,3 +52,3 @@ [arkKind]: "root";

toString(): string;
equals(other: UnknownNode): boolean;
equals(other: BaseNode): boolean;
assertHasKind<kind extends NodeKind>(kind: kind): Node<kind>;

@@ -75,11 +75,11 @@ hasKind<kind extends NodeKind>(kind: kind): this is Node<kind>;

/** a literal key (named property) or a node (index signatures) representing part of a type structure */
export type TypeKey = Key | BaseRoot;
export type TypeIndexer = TypeKey | number;
export type KeyOrKeyNode = Key | BaseRoot;
export type GettableKeyOrNode = KeyOrKeyNode | number;
export type FlatRef<root extends BaseRoot = BaseRoot> = {
path: array<TypeKey>;
path: array<KeyOrKeyNode>;
node: root;
propString: string;
};
export declare const typePathToPropString: (path: array<TypeKey>) => string;
export declare const flatRef: <node extends BaseRoot>(path: array<TypeKey>, node: node) => FlatRef<node>;
export declare const typePathToPropString: (path: array<KeyOrKeyNode>) => string;
export declare const flatRef: <node extends BaseRoot>(path: array<KeyOrKeyNode>, node: node) => FlatRef<node>;
export declare const flatRefsAreEqual: (l: FlatRef, r: FlatRef) => boolean;

@@ -90,3 +90,3 @@ export declare const appendUniqueFlatRefs: <node extends BaseRoot>(existing: FlatRef<node>[] | undefined, refs: listable<FlatRef<node>>) => FlatRef<node>[];

shouldTransform?: ShouldTransformFn;
bindScope?: InternalBaseScope;
bindScope?: BaseScope;
prereduced?: boolean;

@@ -96,3 +96,3 @@ };

export interface DeepNodeTransformContext extends DeepNodeTransformOptions {
path: mutable<array<TypeKey>>;
path: mutable<array<KeyOrKeyNode>>;
seen: {

@@ -99,0 +99,0 @@ [originalId: string]: (() => BaseNode | undefined) | undefined;

import type { GenericArgResolutions } from "./generic.js";
import { type NormalizedSchema } from "./kinds.js";
import type { BaseNode } from "./node.js";
import type { InternalBaseScope } from "./scope.js";
import type { BaseScope } from "./scope.js";
import { type NodeKind, type RootKind } from "./shared/implement.js";

@@ -18,3 +18,3 @@ export type NodeParseOptions<prereduced extends boolean = boolean> = {

export interface NodeParseContext<kind extends NodeKind = NodeKind> extends NodeParseOptions {
$: InternalBaseScope;
$: BaseScope;
args: GenericArgResolutions;

@@ -27,2 +27,2 @@ schema: NormalizedSchema<kind>;

export declare const registerNodeId: (kind: NodeKind, opts: NodeParseOptions) => string;
export declare const parseNode: <kind extends NodeKind>(id: string, kind: kind, schema: NormalizedSchema<kind>, $: InternalBaseScope, opts: NodeParseOptions) => BaseNode;
export declare const parseNode: <kind extends NodeKind>(id: string, kind: kind, schema: NormalizedSchema<kind>, $: BaseScope, opts: NodeParseOptions) => BaseNode;

@@ -1,2 +0,1 @@

import type { constrain, of } from "./ast.js";
import { BaseConstraint } from "./constraint.js";

@@ -38,2 +37,1 @@ import type { errorContext } from "./kinds.js";

export type PredicateCast<input = never, narrowed extends input = input> = (input: input, ctx: TraversalContext) => input is narrowed;
export type inferPredicate<t, predicate> = predicate extends (data: any, ...args: any[]) => data is infer narrowed ? t extends of<unknown, infer constraints> ? constrain<of<narrowed, constraints>, "predicate", any> : constrain<narrowed, "predicate", any> : constrain<t, "predicate", any>;
import { InternalPrimitiveConstraint, writeInvalidOperandMessage } from "../constraint.js";
import type { BaseRoot, SchemaRoot } from "../roots/root.js";
import type { BaseRoot } from "../roots/root.js";
import type { BaseMeta, declareNode } from "../shared/declare.js";

@@ -27,3 +27,3 @@ import { type nodeImplementationOf } from "../shared/implement.js";

}
export declare const writeIndivisibleMessage: <node extends SchemaRoot>(t: node) => writeIndivisibleMessage<node>;
export type writeIndivisibleMessage<node extends SchemaRoot> = writeInvalidOperandMessage<"divisor", node>;
export declare const writeIndivisibleMessage: (t: BaseRoot) => string;
export type writeIndivisibleMessage<actual> = writeInvalidOperandMessage<"divisor", actual>;

@@ -5,3 +5,3 @@ import type { NodeCompiler } from "../shared/compile.js";

import type { TraverseAllows, TraverseApply } from "../shared/traversal.js";
import { BaseRoot, type InternalRootDeclaration } from "./root.js";
import { BaseRoot } from "./root.js";
export interface AliasInner<alias extends string = string> extends BaseMeta {

@@ -23,3 +23,2 @@ readonly alias: alias;

get resolution(): BaseRoot;
rawKeyOf(): BaseRoot<InternalRootDeclaration>;
get shortDescription(): string;

@@ -26,0 +25,0 @@ traverseAllows: TraverseAllows;

@@ -57,5 +57,2 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

}
rawKeyOf() {
return this.resolution.keyof();
}
get shortDescription() {

@@ -62,0 +59,0 @@ return domainDescriptions.object;

@@ -10,3 +10,2 @@ import type { array, Key } from "@ark/util";

structure: undefined;
rawKeyOf(): BaseRoot;
traverseApply: TraverseApply<d["prerequisite"]>;

@@ -13,0 +12,0 @@ get errorContext(): d["errorContext"];

import { compileErrorContext } from "../shared/implement.js";
import { BaseRoot } from "./root.js";
export class InternalBasis extends BaseRoot {
rawKeyOf() {
return this.$.units(this.literalKeys);
}
traverseApply = (data, ctx) => {

@@ -8,0 +5,0 @@ if (!this.traverseAllows(data, ctx))

@@ -49,3 +49,2 @@ import { type array, type listable, type show } from "@ark/util";

compile(js: NodeCompiler): void;
rawKeyOf(): BaseRoot;
}

@@ -52,0 +51,0 @@ export declare const intersectionImplementation: nodeImplementationOf<IntersectionDeclaration>;

@@ -1,2 +0,2 @@

import { $ark, flatMorph, hasDomain, isEmptyObject, isKeyOf, omit, pick, throwParseError } from "@ark/util";
import { flatMorph, hasDomain, isEmptyObject, isKeyOf, omit, pick, throwParseError } from "@ark/util";
import { constraintKeyParser, flattenConstraints, intersectConstraints } from "../constraint.js";

@@ -88,9 +88,2 @@ import { metaKeys } from "../shared/declare.js";

}
rawKeyOf() {
return (this.basis ?
this.structure ?
this.basis.rawKeyOf().or(this.structure.keyof())
: this.basis.rawKeyOf()
: this.structure?.keyof() ?? $ark.intrinsic.never.internal);
}
}

@@ -226,4 +219,4 @@ const intersectIntersections = (l, r, ctx) => {

"unknown"
: node.structure?.description ??
node.children.map(child => child.description).join(" and "),
: (node.structure?.description ??
node.children.map(child => child.description).join(" and ")),
expected: source => ` • ${source.errors.map(e => e.expected).join("\n • ")}`,

@@ -230,0 +223,0 @@ problem: ctx => `(${ctx.actual}) must be...\n${ctx.expected}`

import { type array, type listable } from "@ark/util";
import type { distillConstrainableIn } from "../ast.js";
import type { InferredRoot } from "../inference.js";
import type { Node, NodeSchema } from "../kinds.js";
import type { NodeCompiler } from "../shared/compile.js";
import type { BaseMeta, declareNode } from "../shared/declare.js";
import type { ArkError, ArkErrors } from "../shared/errors.js";
import { type nodeImplementationOf } from "../shared/implement.js";
import { type inferPipe } from "../shared/intersections.js";
import type { TraversalContext, TraverseAllows, TraverseApply } from "../shared/traversal.js";
import { BaseRoot, type Root, type schemaKindRightOf } from "./root.js";
import { BaseRoot, type schemaKindRightOf } from "./root.js";
export type MorphChildKind = schemaKindRightOf<"morph"> | "alias";

@@ -16,11 +12,9 @@ export type MorphChildNode = Node<MorphChildKind>;

export type Morph<i = any, o = unknown> = (In: i, ctx: TraversalContext) => o;
export type Out<o = any> = ["=>", o];
export type MorphAst<i = any, o = any> = (In: i) => Out<o>;
export interface MorphInner extends BaseMeta {
readonly in: MorphChildNode;
readonly morphs: array<Morph | Root>;
readonly morphs: array<Morph | BaseRoot>;
}
export interface MorphSchema extends BaseMeta {
readonly in: MorphChildSchema;
readonly morphs: listable<Morph | Root>;
readonly morphs: listable<Morph | BaseRoot>;
}

@@ -42,3 +36,2 @@ export interface MorphDeclaration extends declareNode<{

traverseApply: TraverseApply;
expression: string;
get shortDescription(): string;

@@ -50,8 +43,6 @@ compile(js: NodeCompiler): void;

hasEqualMorphs(r: MorphNode): boolean;
lastMorph: Morph<any, unknown> | Root<unknown, any> | undefined;
lastMorph: BaseRoot<import("./root.js").InternalRootDeclaration> | Morph<any, unknown> | undefined;
validatedOut: BaseRoot | undefined;
rawKeyOf(): BaseRoot;
expression: string;
}
export declare const writeMorphIntersectionMessage: (lDescription: string, rDescription: string) => string;
export type inferPipes<t, pipes extends Morph[]> = pipes extends [infer head extends Morph, ...infer tail extends Morph[]] ? inferPipes<pipes[0] extends InferredRoot<infer tPipe> ? inferPipe<t, tPipe> : inferMorphOut<head> extends infer out ? (In: distillConstrainableIn<t>) => Out<out> : never, tail> : t;
export type inferMorphOut<morph extends Morph> = Exclude<ReturnType<morph>, ArkError | ArkErrors>;

@@ -43,20 +43,13 @@ import { $ark, arrayEquals, liftArray, throwParseError } from "@ark/util";

// to can be a union as any schema is allowed
return ctx.$.schema(inTersection.branches.map(inBranch => ctx.$.node("morph", {
return inTersection.distribute(inBranch => ctx.$.node("morph", {
morphs: l.morphs,
in: inBranch
})));
}), ctx.$.rootNode);
},
...defineRightwardIntersections("morph", (l, r, ctx) => {
const inTersection = intersectNodes(l.in, r, ctx);
return (inTersection instanceof Disjoint ? inTersection
: inTersection.kind === "union" ?
ctx.$.node("union", inTersection.branches.map(branch => ({
...l.inner,
in: branch
})))
: ctx.$.node("morph", {
...l.inner,
// TODO: https://github.com/arktypeio/arktype/issues/1067
in: inTersection
}));
return inTersection instanceof Disjoint ? inTersection : (inTersection.distribute(branch => ({
...l.inner,
in: branch
}), ctx.$.rootNode));
})

@@ -74,3 +67,2 @@ }

};
expression = `(In: ${this.in.expression}) => Out<${this.out?.expression ?? "unknown"}>`;
get shortDescription() {

@@ -107,5 +99,3 @@ return this.in.shortDescription;

: undefined;
rawKeyOf() {
return this.in.rawKeyOf();
}
expression = `(In: ${this.in.expression}) => Out<${this.out.expression}>`;
}

@@ -112,0 +102,0 @@ export const writeMorphIntersectionMessage = (lDescription, rDescription) => `The intersection of distinct morphs at a single path is indeterminate:

@@ -1,18 +0,16 @@

import type { ConstraintKind, DivisorSchema, ExactLengthSchema, ExclusiveDateRangeSchema, ExclusiveNumericRangeSchema, FlatRef, InclusiveDateRangeSchema, InclusiveNumericRangeSchema, InferredRoot, LimitSchemaValue, PatternSchema, TypeIndexer, TypeKey, UnknownRangeSchema, writeInvalidOperandMessage } from "@ark/schema";
import { type Callable, type ErrorMessage, type Json, type anyOrNever, type array, type conform, type typeToString, type unset } from "@ark/util";
import type { constrain, distillConstrainableIn, distillConstrainableOut, distillIn, distillOut } from "../ast.js";
import { type array } from "@ark/util";
import { type PrimitiveConstraintKind } from "../constraint.js";
import type { Node, NodeSchema, Prerequisite, reducibleKindOf } from "../kinds.js";
import { BaseNode } from "../node.js";
import type { Node, NodeSchema, reducibleKindOf } from "../kinds.js";
import { BaseNode, type FlatRef, type GettableKeyOrNode, type KeyOrKeyNode } from "../node.js";
import type { Predicate } from "../predicate.js";
import type { BaseScope } from "../scope.js";
import type { DivisorSchema } from "../refinements/divisor.js";
import type { ExactLengthSchema } from "../refinements/exactLength.js";
import type { PatternSchema } from "../refinements/pattern.js";
import type { ExclusiveDateRangeSchema, ExclusiveNumericRangeSchema, InclusiveDateRangeSchema, InclusiveNumericRangeSchema, LimitSchemaValue, UnknownRangeSchema } from "../refinements/range.js";
import type { BaseMeta, BaseNodeDeclaration } from "../shared/declare.js";
import { Disjoint } from "../shared/disjoint.js";
import { ArkErrors } from "../shared/errors.js";
import { type NodeKind, type RootKind, type kindRightOf } from "../shared/implement.js";
import { type inferIntersection } from "../shared/intersections.js";
import { arkKind, inferred, type internalImplementationOf } from "../shared/utils.js";
import type { UndeclaredKeyBehavior, arkKeyOf, getArkKey } from "../structure/structure.js";
import type { constraintKindOf } from "./intersection.js";
import type { Morph, MorphNode, inferMorphOut, inferPipes } from "./morph.js";
import { arkKind } from "../shared/utils.js";
import type { UndeclaredKeyBehavior } from "../structure/structure.js";
import type { Morph, MorphNode } from "./morph.js";
import type { UnionChildKind } from "./union.js";

@@ -22,34 +20,32 @@ export interface InternalRootDeclaration extends BaseNodeDeclaration {

}
export type UnknownRoot<t = unknown> = SchemaRoot<t> | BaseRoot;
export type TypeOnlyRootKey = (keyof SchemaRoot & symbol) | "infer" | "inferIn" | "t" | "tIn" | "tOut";
export declare abstract class BaseRoot<
/** uses -ignore rather than -expect-error because this is not an error in .d.ts
* @ts-ignore allow instantiation assignment to the base type */
out d extends InternalRootDeclaration = InternalRootDeclaration> extends BaseNode<d> implements internalImplementationOf<SchemaRoot, TypeOnlyRootKey | "intersect"> {
[inferred]?: unknown;
readonly branches: readonly Node<UnionChildKind>[];
/** @ts-ignore cast variance */
out d extends InternalRootDeclaration = InternalRootDeclaration> extends BaseNode<d> {
readonly [arkKind] = "root";
get internal(): this;
as(): this;
abstract rawKeyOf(): BaseRoot;
readonly branches: readonly Node<UnionChildKind>[];
distribute<mapOut, reduceOut = mapOut[]>(mapBranch: (branch: Node<UnionChildKind>, i: number, branches: array<Node<UnionChildKind>>) => mapOut, reduceMapped?: (mappedBranches: mapOut[]) => reduceOut): reduceOut;
abstract get shortDescription(): string;
keyof(): BaseRoot;
protected intersect(r: unknown): BaseRoot | Disjoint;
isUnknown(): boolean;
isNever(): boolean;
intersect(r: unknown): BaseRoot | Disjoint;
toNeverIfDisjoint(): BaseRoot;
and(r: unknown): BaseRoot;
or(r: unknown): BaseRoot;
assert(data: unknown): unknown;
pick(...keys: TypeKey[]): BaseRoot;
omit(...keys: TypeKey[]): BaseRoot;
pick(...keys: KeyOrKeyNode[]): BaseRoot;
omit(...keys: KeyOrKeyNode[]): BaseRoot;
required(): BaseRoot;
partial(): BaseRoot;
keyof(): BaseRoot;
merge(r: unknown): BaseRoot;
private applyStructuralOperation;
get(...path: TypeIndexer[]): BaseRoot;
get(...path: GettableKeyOrNode[]): BaseRoot;
extract(r: unknown): BaseRoot;
exclude(r: UnknownRoot): BaseRoot;
exclude(r: BaseRoot): BaseRoot;
array(): BaseRoot;
overlaps(r: UnknownRoot): boolean;
extends(r: UnknownRoot): boolean;
subsumes(r: UnknownRoot): boolean;
overlaps(r: BaseRoot): boolean;
extends(r: BaseRoot): boolean;
subsumes(r: BaseRoot): boolean;
configure(configOrDescription: BaseMeta | string): this;

@@ -93,96 +89,3 @@ describe(description: string): this;

} : schema;
export declare abstract class Root<t = unknown, $ = any> extends Callable<(data: unknown) => distillOut<t> | ArkErrors> {
t: t;
tIn: distillConstrainableIn<t>;
tOut: distillConstrainableOut<t>;
infer: distillOut<t>;
inferIn: distillIn<t>;
[inferred]: t;
json: Json;
description: string;
expression: string;
internal: BaseRoot;
abstract $: BaseScope<$>;
abstract get in(): unknown;
abstract get out(): unknown;
abstract as(): unknown;
abstract keyof(): unknown;
abstract intersect(r: never): unknown | Disjoint;
abstract and(r: never): unknown;
abstract or(r: never): unknown;
abstract constrain(kind: never, schema: never): unknown;
abstract equals(r: never): this is unknown;
abstract extract(r: never): unknown;
abstract exclude(r: never): unknown;
abstract extends(r: never): this is unknown;
abstract overlaps(r: never): boolean;
abstract pick(...keys: never): unknown;
abstract omit(...keys: never): unknown;
abstract array(): unknown;
abstract pipe(morph: Morph): unknown;
isUnknown(): boolean;
isNever(): boolean;
assert(data: unknown): this["infer"];
allows(data: unknown): data is this["inferIn"];
traverse(data: unknown): distillOut<t> | ArkErrors;
configure(configOrDescription: BaseMeta | string): this;
describe(description: string): this;
onUndeclaredKey(behavior: UndeclaredKeyBehavior): this;
onDeepUndeclaredKey(behavior: UndeclaredKeyBehavior): this;
from(literal: this["inferIn"]): this["infer"];
}
declare class _SchemaRoot<t = unknown, $ = any> extends Root<t, $> {
$: BaseScope<$>;
as<t = unset>(...args: validateChainedAsArgs<t>): SchemaRoot<t, $>;
get in(): SchemaRoot<this["tIn"], $>;
get out(): SchemaRoot<this["tOut"], $>;
keyof(): SchemaRoot<keyof this["inferIn"], $>;
pick<const key extends arkKeyOf<t> = never>(this: validateStructuralOperand<"pick", this>, ...keys: array<key | InferredRoot<key>>): SchemaRoot<{
[k in key]: getArkKey<t, k>;
}, $>;
omit<const key extends arkKeyOf<t> = never>(this: validateStructuralOperand<"omit", this>, ...keys: array<key | InferredRoot<key>>): SchemaRoot<{
[k in key]: getArkKey<t, k>;
}, $>;
required(this: validateStructuralOperand<"required", this>): SchemaRoot<{
[k in keyof this["inferIn"]]-?: this["inferIn"][k];
}, $>;
partial(this: validateStructuralOperand<"partial", this>): SchemaRoot<{
[k in keyof this["inferIn"]]?: this["inferIn"][k];
}, $>;
get<k1 extends arkKeyOf<t>>(k1: k1 | InferredRoot<k1>): SchemaRoot<getArkKey<t, k1>, $>;
get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>>(k1: k1 | InferredRoot<k1>, k2: k2 | InferredRoot<k2>): SchemaRoot<getArkKey<getArkKey<t, k1>, k2>, $>;
get<k1 extends arkKeyOf<t>, k2 extends arkKeyOf<getArkKey<t, k1>>, k3 extends arkKeyOf<getArkKey<getArkKey<t, k1>, k2>>>(k1: k1 | InferredRoot<k1>, k2: k2 | InferredRoot<k2>, k3: k3 | InferredRoot<k3>): SchemaRoot<getArkKey<getArkKey<getArkKey<t, k1>, k2>, k3>, $>;
intersect<r extends SchemaRoot>(r: r): SchemaRoot<inferIntersection<t, r["t"]>> | Disjoint;
and<r extends SchemaRoot>(r: r): SchemaRoot<inferIntersection<t, r["t"]>>;
or<r extends SchemaRoot>(r: r): SchemaRoot<t | r["t"]>;
array(): SchemaRoot<t[], $>;
constrain<kind extends PrimitiveConstraintKind, const schema extends NodeSchema<kind>>(kind: conform<kind, constraintKindOf<this["inferIn"]>>, schema: schema): SchemaRoot<constrain<t, kind, schema>, $>;
equals<r>(r: SchemaRoot<r>): this is SchemaRoot<r>;
extract<r>(r: SchemaRoot<r>): SchemaRoot<t, $>;
exclude<r>(r: SchemaRoot<r>): SchemaRoot<t, $>;
extends<r>(other: SchemaRoot<r>): this is SchemaRoot<r> & {
[inferred]?: r;
};
pipe<a extends Morph<this["infer"]>>(a: a): SchemaRoot<inferPipes<t, [a]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>>(a: a, b: b): SchemaRoot<inferPipes<t, [a, b]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>>(a: a, b: b, c: c): SchemaRoot<inferPipes<t, [a, b, c]>, $>;
pipe<a extends Morph<this["infer"]>, b extends Morph<inferMorphOut<a>>, c extends Morph<inferMorphOut<b>>, d extends Morph<inferMorphOut<c>>>(a: a, b: b, c: c, d: d): SchemaRoot<inferPipes<t, [a, b, c, d]>, $>;
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>>>(a: a, b: b, c: c, d: d, e: e): SchemaRoot<inferPipes<t, [a, b, c, d, e]>, $>;
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>>>(a: a, b: b, c: c, d: d, e: e, f: f): SchemaRoot<inferPipes<t, [a, b, c, d, e, f]>, $>;
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): SchemaRoot<inferPipes<t, [a, b, c, d, e, f, g]>, $>;
overlaps(r: SchemaRoot): boolean;
}
export declare const typeOrTermExtends: (t: unknown, base: unknown) => boolean;
export type validateChainedAsArgs<t> = [
t
] extends [unset] ? [
t
] extends [anyOrNever] ? [
] : [
ErrorMessage<"as requires an explicit type parameter like myType.as<t>()">
] : [];
export interface SchemaRoot<
/** @ts-expect-error allow instantiation assignment to the base type */
out t = unknown, $ = any> extends _SchemaRoot<t, $> {
}
export type intersectRoot<l extends RootKind, r extends NodeKind> = [

@@ -195,11 +98,5 @@ l,

export type schemaKindOrRightOf<kind extends RootKind> = kind | schemaKindRightOf<kind>;
export type validateStructuralOperand<name extends StructuralOperationName, t extends {
inferIn: unknown;
}> = t["inferIn"] extends object ? t : ErrorMessage<writeNonStructuralOperandMessage<name, typeToString<t["inferIn"]>>>;
export type validateChainedConstraint<kind extends ConstraintKind, t extends {
inferIn: unknown;
}> = t["inferIn"] extends Prerequisite<kind> ? t : ErrorMessage<writeInvalidOperandMessage<kind, SchemaRoot<t["inferIn"]>>>;
export type StructuralOperationName = "pick" | "omit" | "get" | "required" | "partial";
export type StructuralOperationName = "keyof" | "pick" | "omit" | "get" | "required" | "partial" | "merge";
export declare const writeNonStructuralOperandMessage: <operation extends StructuralOperationName, operand extends string>(operation: operation, operand: operand) => writeNonStructuralOperandMessage<operation, operand>;
export type writeNonStructuralOperandMessage<operation extends StructuralOperationName, operand extends string> = `${operation} operand must be an object (was ${operand})`;
export declare const writeNonStructuralOperandMessage: <operation extends StructuralOperationName, operand extends string>(operation: operation, operand: operand) => writeNonStructuralOperandMessage<operation, operand>;
export {};

@@ -38,10 +38,12 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

import { BaseNode, appendUniqueFlatRefs } from "../node.js";
import { Disjoint } from "../shared/disjoint.js";
import { Disjoint, writeUnsatisfiableExpressionError } from "../shared/disjoint.js";
import { ArkErrors } from "../shared/errors.js";
import { structuralKinds } from "../shared/implement.js";
import { intersectNodesRoot, pipeNodesRoot } from "../shared/intersections.js";
import { arkKind, hasArkKind, inferred } from "../shared/utils.js";
import { arkKind, hasArkKind } from "../shared/utils.js";
let BaseRoot = (() => {
let _classSuper = BaseNode;
let _instanceExtraInitializers = [];
let _required_decorators;
let _partial_decorators;
let _keyof_decorators;

@@ -52,4 +54,8 @@ let _get_flatMorphs_decorators;

const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
_required_decorators = [cached];
_partial_decorators = [cached];
_keyof_decorators = [cached];
_get_flatMorphs_decorators = [cached];
__esDecorate(this, null, _required_decorators, { kind: "method", name: "required", static: false, private: false, access: { has: obj => "required" in obj, get: obj => obj.required }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _partial_decorators, { kind: "method", name: "partial", static: false, private: false, access: { has: obj => "partial" in obj, get: obj => obj.partial }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _keyof_decorators, { kind: "method", name: "keyof", static: false, private: false, access: { has: obj => "keyof" in obj, get: obj => obj.keyof }, metadata: _metadata }, null, _instanceExtraInitializers);

@@ -59,5 +65,3 @@ __esDecorate(this, null, _get_flatMorphs_decorators, { kind: "getter", name: "flatMorphs", static: false, private: false, access: { has: obj => "flatMorphs" in obj, get: obj => obj.flatMorphs }, metadata: _metadata }, null, _instanceExtraInitializers);

}
[inferred] = __runInitializers(this, _instanceExtraInitializers);
branches = this.hasKind("union") ? this.inner.branches : [this];
[arkKind] = "root";
[arkKind] = (__runInitializers(this, _instanceExtraInitializers), "root");
get internal() {

@@ -69,13 +73,7 @@ return this;

}
keyof() {
const result = this.rawKeyOf();
if (result.branches.length === 0) {
throwParseError(`keyof ${this.expression} results in an unsatisfiable type`);
}
return result;
branches = this.hasKind("union") ? this.inner.branches : [this];
distribute(mapBranch, reduceMapped) {
const mappedBranches = this.branches.map(mapBranch);
return reduceMapped?.(mappedBranches) ?? mappedBranches;
}
intersect(r) {
const rNode = this.$.parseRoot(r);
return intersectNodesRoot(this, rNode, this.$);
}
isUnknown() {

@@ -87,2 +85,9 @@ return this.hasKind("intersection") && this.children.length === 0;

}
intersect(r) {
const rNode = this.$.parseRoot(r);
return intersectNodesRoot(this, rNode, this.$);
}
toNeverIfDisjoint() {
return this;
}
and(r) {

@@ -95,3 +100,3 @@ const result = this.intersect(r);

const branches = [...this.branches, ...rNode.branches];
return this.$.schema(branches);
return this.$.rootNode(branches);
}

@@ -103,27 +108,42 @@ assert(data) {

pick(...keys) {
return this.applyStructuralOperation("pick", keys);
return this.$.rootNode(this.applyStructuralOperation("pick", keys));
}
omit(...keys) {
return this.applyStructuralOperation("omit", keys);
return this.$.rootNode(this.applyStructuralOperation("omit", keys));
}
required() {
return this.applyStructuralOperation("required", []);
return this.$.rootNode(this.applyStructuralOperation("required", []));
}
partial() {
return this.applyStructuralOperation("partial", []);
return this.$.rootNode(this.applyStructuralOperation("partial", []));
}
keyof() {
const result = this.applyStructuralOperation("keyof", []).reduce((result, branch) => result.intersect(branch).toNeverIfDisjoint(), $ark.intrinsic.unknown.internal);
if (result.branches.length === 0) {
throwParseError(writeUnsatisfiableExpressionError(`keyof ${this.expression}`));
}
return result;
}
merge(r) {
const rNode = this.$.parseRoot(r);
return this.$.rootNode(rNode.distribute(branch => this.applyStructuralOperation("merge", [
structureOf(branch) ??
throwParseError(writeNonStructuralOperandMessage("merge", branch.expression))
])));
}
applyStructuralOperation(operation, args) {
if (this.hasKind("union")) {
return this.$.schema(this.branches.map(branch => branch.applyStructuralOperation(operation, args)));
}
if (this.hasKind("morph")) {
return this.$.node("morph", {
...this.inner,
in: this.in.applyStructuralOperation(operation, args)
});
}
if (this.hasKind("intersection")) {
if (!this.inner.structure) {
throwParseError(writeNonStructuralOperandMessage(operation, this.expression));
return this.distribute(branch => {
if (branch.equals($ark.intrinsic.object) && operation !== "merge")
// ideally this wouldn't be a special case, but for now it
// allows us to bypass `assertHasKeys` checks on base
// instantiations of generics like Pick and Omit. Could
// potentially be removed once constraints can reference each other:
// https://github.com/arktypeio/arktype/issues/1053
return branch;
const structure = structureOf(branch);
if (!structure) {
throwParseError(writeNonStructuralOperandMessage(operation, branch.expression));
}
if (operation === "keyof")
return structure.keyof();
const structuralMethodName = operation === "required" ? "require"

@@ -133,10 +153,6 @@ : operation === "partial" ? "optionalize"

return this.$.node("intersection", {
...this.inner,
structure: this.inner.structure[structuralMethodName](...args)
...branch.inner,
structure: structure[structuralMethodName](...args)
});
}
if (this.isBasis() && this.domain === "object")
// if it's an object but has no Structure node, return an empty object
return $ark.intrinsic.object.internal.bindScope(this.$);
return throwParseError(writeNonStructuralOperandMessage(operation, this.expression));
});
}

@@ -155,10 +171,10 @@ get(...path) {

const rNode = this.$.parseRoot(r);
return this.$.schema(this.branches.filter(branch => branch.extends(rNode)));
return this.$.rootNode(this.branches.filter(branch => branch.extends(rNode)));
}
exclude(r) {
const rNode = this.$.parseRoot(r);
return this.$.schema(this.branches.filter(branch => !branch.extends(rNode)));
return this.$.rootNode(this.branches.filter(branch => !branch.extends(rNode)));
}
array() {
return this.$.schema({
return this.$.rootNode({
proto: Array,

@@ -200,16 +216,11 @@ sequence: this

}
if (this.hasKind("union")) {
const branches = this.branches.map(node => node.pipe(morph));
return this.$.node("union", { ...this.inner, branches });
}
if (this.hasKind("morph")) {
return this.$.node("morph", {
...this.inner,
morphs: [...this.morphs, morph]
});
}
return this.$.node("morph", {
in: this,
morphs: [morph]
});
return this.distribute(node => node.hasKind("morph") ?
this.$.node("morph", {
in: node.in,
morphs: [...node.morphs, morph]
})
: this.$.node("morph", {
in: node,
morphs: [morph]
}), branches => this.$.rootNode(branches));
}

@@ -239,3 +250,4 @@ get flatMorphs() {

const constraint = this.$.node(kind, schema);
if (constraint.impliedBasis && !this[io].extends(constraint.impliedBasis)) {
const operand = io === "root" ? this : this[io];
if (constraint.impliedBasis && !operand.extends(constraint.impliedBasis)) {
return throwInvalidOperandError(kind, constraint.impliedBasis, this);

@@ -246,5 +258,5 @@ }

});
const result = io === "in" ?
intersectNodesRoot(this, partialIntersection, this.$)
: pipeNodesRoot(this, partialIntersection, this.$);
const result = io === "out" ?
pipeNodesRoot(this, partialIntersection, this.$)
: intersectNodesRoot(this, partialIntersection, this.$);
if (result instanceof Disjoint)

@@ -328,2 +340,15 @@ result.throw();

: base === t;
const structureOf = (branch) => {
if (branch.hasKind("morph"))
return null;
if (branch.hasKind("intersection")) {
return (branch.inner.structure ??
(branch.basis?.domain === "object" ?
$ark.intrinsic.emptyStructure.bindScope(branch.$)
: null));
}
if (branch.isBasis() && branch.domain === "object")
return $ark.intrinsic.emptyStructure.bindScope(branch.$);
return null;
};
export const writeNonStructuralOperandMessage = (operation, operand) => `${operation} operand must be an object (was ${operand})`;

@@ -49,3 +49,2 @@ import { type Domain, type Json, type Key, type SerializedPrimitive, type show } from "@ark/util";

private compileIndiscriminable;
rawKeyOf(): BaseRoot;
get nestableExpression(): string;

@@ -52,0 +51,0 @@ discriminate(): Discriminant | null;

@@ -35,3 +35,3 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

};
import { $ark, appendUnique, arrayEquals, cached, domainDescriptions, flatMorph, groupBy, isArray, isKeyOf, printable, throwInternalError, throwParseError } from "@ark/util";
import { appendUnique, arrayEquals, cached, domainDescriptions, flatMorph, groupBy, isArray, isKeyOf, printable, throwInternalError, throwParseError } from "@ark/util";
import { typePathToPropString } from "../node.js";

@@ -81,3 +81,3 @@ import { compileLiteralPropAccess, compileSerializedValue } from "../shared/compile.js";

defaults: {
description: node => describeBranches(node.branches.map(branch => branch.description)),
description: node => node.distribute(branch => branch.description, describeBranches),
expected: ctx => {

@@ -123,3 +123,3 @@ const byPath = groupBy(ctx.errors, "propString");

return resultBranches;
return ctx.$.schema(l.ordered || r.ordered ?
return ctx.$.rootNode(l.ordered || r.ordered ?
{

@@ -137,3 +137,3 @@ branches: resultBranches,

return branches[0];
return ctx.$.schema(l.ordered ? { branches, ordered: true } : { branches });
return ctx.$.rootNode(l.ordered ? { branches, ordered: true } : { branches });
})

@@ -159,5 +159,5 @@ }

discriminantJson = this.discriminant ? discriminantToJson(this.discriminant) : null;
expression = expressBranches(this.branches.map(n => n.nestableExpression));
expression = this.distribute(n => n.nestableExpression, expressBranches);
get shortDescription() {
return describeBranches(this.branches.map(branch => branch.shortDescription));
return this.distribute(branch => branch.shortDescription, describeBranches);
}

@@ -224,5 +224,2 @@ traverseAllows = (data, ctx) => this.branches.some(b => b.traverseAllows(data, ctx));

}
rawKeyOf() {
return this.branches.reduce((result, branch) => result.and(branch.rawKeyOf()), $ark.intrinsic.unknown.internal);
}
get nestableExpression() {

@@ -229,0 +226,0 @@ // avoid adding unnecessary parentheses around boolean since it's

@@ -1,26 +0,21 @@

import { DynamicBase, ParseError, type Json, type anyOrNever, type array, type flattenListable, type show } from "@ark/util";
import { type ArkConfig, type ResolvedArkConfig } from "./config.js";
import { GenericRoot, type GenericHktSchemaParser, type GenericParamDef } from "./generic.js";
import type { inferRoot, validateRoot } from "./inference.js";
import type { internal } from "./keywords/internal.js";
import type { jsObjects } from "./keywords/jsObjects.js";
import type { tsKeywords } from "./keywords/tsKeywords.js";
import { ParseError, type Json, type anyOrNever, type array, type conform, type flattenListable, type noSuggest, type show } from "@ark/util";
import { resolveConfig, type ArkConfig } from "./config.js";
import { GenericRoot, type GenericHktSchemaBodyParser, type GenericParamDef, type genericParamSchemasToAst } from "./generic.js";
import { type Node, type NodeSchema, type RootSchema, type reducibleKindOf } from "./kinds.js";
import { type PreparsedNodeResolution, type SchemaModule } from "./module.js";
import { RootModule, type InternalModule, type PreparsedNodeResolution, type SchemaModule } from "./module.js";
import type { BaseNode } from "./node.js";
import { type NodeParseOptions } from "./parse.js";
import { type AliasNode } from "./roots/alias.js";
import type { BaseRoot, SchemaRoot } from "./roots/root.js";
import type { BaseRoot } from "./roots/root.js";
import type { NodeKind, RootKind } from "./shared/implement.js";
import { arkKind, type internalImplementationOf } from "./shared/utils.js";
export type nodeResolutions<keywords> = {
[k in keyof keywords]: BaseRoot;
};
export type BaseResolutions = Record<string, BaseRoot>;
import { arkKind } from "./shared/utils.js";
export type InternalResolutions = Record<string, InternalResolution | undefined>;
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 resolvableReferenceIn<$> = {
[k in keyof $]: k extends string ? k extends PrivateDeclaration<infer alias> ? alias : k extends noSuggest ? never : k : never;
}[keyof $];
export type resolveReference<reference extends resolvableReferenceIn<$>, $> = reference extends keyof $ ? $[reference] : $[`#${reference}` & keyof $];
export type PrivateDeclaration<key extends string = string> = `#${key}`;
type toInternalScope<$> = InternalBaseScope<{
export type InternalResolution = BaseRoot | GenericRoot | InternalModule;
export type toInternalScope<$> = BaseScope<{
[k in keyof $]: $[k] extends {

@@ -30,14 +25,16 @@ [arkKind]: infer kind;

$[k]
] extends [anyOrNever] ? BaseRoot : kind extends "generic" ? GenericRoot : kind extends "module" ? InternalRootModule : never : BaseRoot;
] extends [anyOrNever] ? BaseRoot : kind extends "generic" ? GenericRoot : kind extends "module" ? InternalModule : never : BaseRoot;
}>;
export interface IntrinsicKeywords extends tsKeywords, jsObjects, internal {
}
export type InternalResolution = BaseRoot | GenericRoot | InternalRootModule;
type CachedResolution = string | InternalResolution;
type CachedResolution = string | BaseRoot | GenericRoot;
export declare const writeDuplicateAliasError: <alias extends string>(alias: alias) => writeDuplicateAliasError<alias>;
export type writeDuplicateAliasError<alias extends string> = `#${alias} duplicates public alias ${alias}`;
export type AliasDefEntry = [name: string, defValue: unknown];
export declare abstract class InternalBaseScope<$ extends InternalResolutions = InternalResolutions> implements internalImplementationOf<BaseScope, "t"> {
readonly config: ArkConfig;
readonly resolvedConfig: ResolvedArkConfig;
export interface ArkScopeConfig extends ArkConfig {
ambient?: boolean | string;
prereducedAliases?: boolean;
}
export type ResolvedArkScopeConfig = resolveConfig<ArkScopeConfig>;
export declare abstract class BaseScope<$ extends {} = {}> {
readonly config: ArkScopeConfig;
readonly resolvedConfig: ResolvedArkScopeConfig;
readonly id: string;

@@ -59,11 +56,11 @@ readonly [arkKind] = "scope";

* corresponding definitions.**/
def: Record<string, unknown>, config?: ArkConfig);
def: Record<string, unknown>, config?: ArkScopeConfig);
get internal(): this;
defineSchema(def: RootSchema): RootSchema;
schema(def: RootSchema, opts?: NodeParseOptions): BaseRoot;
defineSchema<def extends RootSchema>(def: def): def;
defineRoot(def: RootSchema): RootSchema;
generic(...params: array<GenericParamDef>): ReturnType<GenericHktSchemaParser>;
generic<const paramsDef extends readonly GenericParamDef[]>(...params: paramsDef): GenericHktSchemaBodyParser<genericParamSchemasToAst<paramsDef>>;
units(values: array, opts?: NodeParseOptions): BaseRoot;
protected lazyResolutions: AliasNode[];
lazilyResolve(resolve: () => BaseRoot, syntheticAlias?: string): AliasNode;
rootNode(def: RootSchema, opts?: NodeParseOptions): BaseRoot;
node<kinds extends NodeKind | array<RootKind>, prereduced extends boolean = false>(kinds: kinds, nodeSchema: NodeSchema<flattenListable<kinds>>, opts?: NodeParseOptions<prereduced>): Node<prereduced extends true ? flattenListable<kinds> : reducibleKindOf<flattenListable<kinds>>>;

@@ -73,75 +70,37 @@ protected finalizeRootArgs(opts: NodeParseOptions, resolve: () => BaseRoot): NodeParseOptions;

maybeResolveRoot(name: string): BaseRoot | undefined;
maybeResolveGenericOrRoot(name: string): BaseRoot | GenericRoot | undefined;
preparseRoot(def: unknown): unknown;
preparseAlias(k: string, v: unknown): AliasDefEntry;
maybeResolve(name: string): InternalResolution | undefined;
maybeResolve(name: string): Exclude<CachedResolution, string> | undefined;
get ambient(): InternalModule;
maybeShallowResolve(name: string): CachedResolution | undefined;
/** If name is a valid reference to a submodule alias, return its resolution */
protected maybeResolveSubalias(name: string): BaseRoot | GenericRoot | undefined;
import<names extends exportedNameOf<$>[]>(...names: names): show<destructuredImportContext<$, names>>;
import<names extends exportedNameOf<$>[]>(...names: names): SchemaModule<show<destructuredImportContext<$, names>>>;
private _exportedResolutions;
private _exports;
export<names extends exportedNameOf<$>[]>(...names: names): show<destructuredExportContext<$, names>>;
export<names extends exportedNameOf<$>[]>(...names: names): SchemaModule<show<destructuredExportContext<$, names>>>;
resolve<name extends exportedNameOf<$>>(name: name): destructuredExportContext<$, []>[name];
abstract parseRoot(schema: any, opts?: NodeParseOptions): BaseRoot;
abstract parseRoot(schema: unknown, opts?: NodeParseOptions): BaseRoot;
}
export type validateAliases<aliases> = {
[k in keyof aliases]: aliases[k] extends PreparsedNodeResolution ? aliases[k] : validateRoot<aliases[k], aliases>;
};
export type instantiateAliases<aliases> = {
[k in keyof aliases]: aliases[k] extends PreparsedNodeResolution ? aliases[k] : inferRoot<aliases[k], aliases>;
type instantiateAliases<aliases> = {
[k in keyof aliases]: aliases[k] extends InternalResolution ? aliases[k] : BaseRoot;
} & unknown;
export declare const schemaScope: <const aliases>(aliases: validateAliases<aliases>, config?: ArkConfig) => SchemaScope<instantiateAliases<aliases>>;
export interface BaseScope<$ = {}> {
t: $;
[arkKind]: "scope";
config: ArkConfig;
references: readonly BaseNode[];
json: Json;
exportedNames: array<exportedNameOf<$>>;
/** The set of names defined at the root-level of the scope mapped to their
* corresponding definitions.**/
aliases: Record<string, unknown>;
internal: toInternalScope<$>;
defineSchema<const def extends RootSchema>(schema: def): def;
schema<const def extends RootSchema>(schema: def, opts?: NodeParseOptions): SchemaRoot<inferRoot<def, $>, $>;
units<const branches extends array>(values: branches, opts?: NodeParseOptions): SchemaRoot<branches[number], $>;
node<kinds extends NodeKind | array<RootKind>>(kinds: kinds, schema: NodeSchema<flattenListable<kinds>>, opts?: NodeParseOptions): Node<reducibleKindOf<flattenListable<kinds>>>;
import<names extends exportedNameOf<$>[]>(...names: names): SchemaModule<show<destructuredImportContext<$, names>>>;
export<names extends exportedNameOf<$>[]>(...names: names): SchemaModule<show<destructuredExportContext<$, names>>>;
resolve<name extends exportedNameOf<$>>(name: name): $[name] extends PreparsedNodeResolution ? $[name] : SchemaRoot<$[name], $>;
parseRoot(def: any, opts?: NodeParseOptions): SchemaRoot;
export declare const schemaScope: <const aliases extends { [k in keyof aliases]: conform<aliases[k], RootSchema | PreparsedNodeResolution>; }>(aliases: aliases, config?: ArkScopeConfig) => SchemaScope<instantiateAliases<aliases>>;
export declare class SchemaScope<$ extends InternalResolutions = InternalResolutions> extends BaseScope<$> {
defineRoot<schema extends RootSchema>(schema: schema): schema;
parseRoot(schema: RootSchema, opts?: NodeParseOptions): BaseRoot;
}
export declare class InternalSchemaScope<$ extends InternalResolutions = InternalResolutions> extends InternalBaseScope<$> {
parseRoot(def: unknown, opts?: NodeParseOptions): BaseRoot;
}
/** @ts-ignore sometimes infinite? requires further investigation */
export interface SchemaScope<$ = {}> extends BaseScope<$> {
defineRoot: this["defineSchema"];
parseRoot: this["schema"];
generic: GenericHktSchemaParser<$>;
}
export declare const SchemaScope: new <$ = {}>(...args: ConstructorParameters<typeof InternalBaseScope>) => SchemaScope<$>;
export declare const root: SchemaScope;
export declare const schema: SchemaScope["schema"];
export declare const $root: SchemaScope;
export declare const rootNode: SchemaScope["rootNode"];
export declare const node: SchemaScope["node"];
export declare const defineRoot: SchemaScope["defineRoot"];
export declare const units: SchemaScope["units"];
export declare const generic: SchemaScope["generic"];
export declare const internalSchema: InternalBaseScope["schema"];
export declare const internalNode: InternalBaseScope["node"];
export declare const defineInternalRoot: InternalBaseScope["defineRoot"];
export declare const internalUnits: InternalBaseScope["units"];
export declare const internalGeneric: InternalBaseScope["generic"];
export declare const parseAsSchema: <castTo = unknown>(def: unknown, opts?: NodeParseOptions) => SchemaRoot<castTo, {}> | ParseError;
export declare class InternalRootModule<resolutions extends InternalResolutions = InternalResolutions> extends DynamicBase<resolutions> {
readonly [arkKind]: "module";
}
export declare const defineSchema: SchemaScope["defineSchema"];
export declare const genericNode: SchemaScope["generic"];
export declare const parseAsSchema: (def: unknown, opts?: NodeParseOptions) => BaseRoot | ParseError;
export type destructuredExportContext<$, names extends exportedNameOf<$>[]> = {
[k in names extends [] ? exportedNameOf<$> : names[number]]: $[k];
[k in names["length"] extends 0 ? exportedNameOf<$> : names[number]]: $[k];
};
export type destructuredImportContext<$, names extends exportedNameOf<$>[]> = {
[k in names extends [] ? exportedNameOf<$> : names[number] as `#${k & string}`]: $[k];
[k in names["length"] extends 0 ? exportedNameOf<$> : names[number] as `#${k & string}`]: $[k];
};
export type RootExportCache = Record<string, BaseRoot | GenericRoot | InternalRootModule | undefined>;
export type RootExportCache = Record<string, BaseRoot | GenericRoot | RootModule | undefined>;
export declare const writeUnresolvableMessage: <token extends string>(token: token) => writeUnresolvableMessage<token>;

@@ -148,0 +107,0 @@ export type writeUnresolvableMessage<token extends string> = `'${token}' is unresolvable`;

@@ -35,7 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

};
import { $ark, DynamicBase, ParseError, bound, flatMorph, hasDomain, isArray, printable, throwInternalError, throwParseError } from "@ark/util";
import { $ark, ParseError, bound, flatMorph, hasDomain, isArray, printable, throwInternalError, throwParseError } from "@ark/util";
import { resolveConfig } from "./config.js";
import { GenericRoot, LazyGenericBody } from "./generic.js";
import { nodeImplementationsByKind } from "./kinds.js";
import { RootModule } from "./module.js";
import { RootModule, bindModule } from "./module.js";
import { parseNode, registerNodeId, schemaKindOf } from "./parse.js";

@@ -51,25 +51,25 @@ import { normalizeAliasSchema } from "./roots/alias.js";

const scopesById = {};
$ark.intrinsic = {};
let InternalBaseScope = (() => {
$ark.ambient = {};
let BaseScope = (() => {
let _instanceExtraInitializers = [];
let _defineSchema_decorators;
let _schema_decorators;
let _defineRoot_decorators;
let _generic_decorators;
let _units_decorators;
let _rootNode_decorators;
let _node_decorators;
return class InternalBaseScope {
return class BaseScope {
static {
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
_defineSchema_decorators = [bound];
_schema_decorators = [bound];
_defineRoot_decorators = [bound];
_generic_decorators = [bound];
_units_decorators = [bound];
_rootNode_decorators = [bound];
_node_decorators = [bound];
__esDecorate(this, null, _defineSchema_decorators, { kind: "method", name: "defineSchema", static: false, private: false, access: { has: obj => "defineSchema" in obj, get: obj => obj.defineSchema }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _schema_decorators, { kind: "method", name: "schema", static: false, private: false, access: { has: obj => "schema" in obj, get: obj => obj.schema }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _defineRoot_decorators, { kind: "method", name: "defineRoot", static: false, private: false, access: { has: obj => "defineRoot" in obj, get: obj => obj.defineRoot }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _generic_decorators, { kind: "method", name: "generic", static: false, private: false, access: { has: obj => "generic" in obj, get: obj => obj.generic }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _units_decorators, { kind: "method", name: "units", static: false, private: false, access: { has: obj => "units" in obj, get: obj => obj.units }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _rootNode_decorators, { kind: "method", name: "rootNode", static: false, private: false, access: { has: obj => "rootNode" in obj, get: obj => obj.rootNode }, metadata: _metadata }, null, _instanceExtraInitializers);
__esDecorate(this, null, _node_decorators, { kind: "method", name: "node", static: false, private: false, access: { has: obj => "node" in obj, get: obj => obj.node }, metadata: _metadata }, null, _instanceExtraInitializers);

@@ -110,7 +110,2 @@ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });

});
if ($ark.ambient) {
// ensure exportedResolutions is populated
$ark.ambient.export();
this.resolutions = {};
}
scopesById[this.id] = this;

@@ -124,5 +119,2 @@ }

}
schema(def, opts) {
return this.node(schemaKindOf(def), def, opts);
}
defineRoot(def) {

@@ -156,2 +148,5 @@ return this.defineSchema(def);

}
rootNode(def, opts) {
return this.node(schemaKindOf(def), def, opts);
}
node(kinds, nodeSchema, opts = {}) {

@@ -213,3 +208,3 @@ let kind = typeof kinds === "string" ? kinds : schemaKindOf(nodeSchema, kinds);

maybeResolveRoot(name) {
const result = this.maybeResolveGenericOrRoot(name);
const result = this.maybeResolve(name);
if (hasArkKind(result, "generic"))

@@ -219,8 +214,2 @@ return;

}
maybeResolveGenericOrRoot(name) {
const resolution = this.maybeResolve(name);
if (hasArkKind(resolution, "module"))
return throwParseError(writeMissingSubmoduleAccessMessage(name));
return resolution;
}
preparseRoot(def) {

@@ -236,4 +225,7 @@ return def;

this.node("alias", { alias: resolution }, { prereduced: true })
: resolution;
: (resolution ?? maybeResolveSubalias(this.aliases, name));
}
get ambient() {
return $ark.ambient;
}
maybeShallowResolve(name) {

@@ -243,3 +235,3 @@ const cached = this.resolutions[name];

return cached;
const def = this.aliases[name] ?? $ark.ambient?.resolutions[name];
const def = this.aliases[name] ?? this.ambient?.[name];
if (!def)

@@ -250,8 +242,4 @@ return this.maybeResolveSubalias(name);

return (this.resolutions[name] = preparsed.bindScope(this));
if (hasArkKind(preparsed, "module")) {
return (this.resolutions[name] = new RootModule(flatMorph(preparsed, (alias, node) => [
alias,
node.bindScope(this)
])));
}
if (hasArkKind(preparsed, "module"))
return throwParseError(writeMissingSubmoduleAccessMessage(name));
this.resolutions[name] = name;

@@ -278,4 +266,7 @@ return (this.resolutions[name] = this.parseRoot(preparsed, {

for (const name of this.exportedNames) {
const resolution = this.maybeResolve(name);
if (hasArkKind(resolution, "root")) {
const def = this.aliases[name];
if (hasArkKind(def, "module"))
this._exports[name] = bindModule(def, this);
else {
const resolution = this.maybeResolve(name);
resolution.references

@@ -290,11 +281,20 @@ .filter(node => node.hasKind("alias"))

});
this._exports[name] = resolution;
}
this._exports[name] = resolution;
}
this.lazyResolutions.forEach(node => node.resolution);
if (this.resolvedConfig.ambient === true)
// spread all exports to ambient
Object.assign($ark.ambient, this._exports);
else if (typeof this.resolvedConfig.ambient === "string") {
// add exports as a subscope with the config value as a name
Object.assign($ark.ambient, {
[this.resolvedConfig.ambient]: new RootModule({
...this._exports
})
});
}
this._exportedResolutions = resolutionsOfModule(this, this._exports);
Object.assign(this.json, resolutionsToJson(this._exportedResolutions));
Object.assign(this.resolutions, this._exportedResolutions);
if (this.config.intrinsic)
Object.assign($ark.intrinsic, this._exportedResolutions);
this.references = Object.values(this.referencesById);

@@ -316,8 +316,8 @@ if (!this.resolvedConfig.jitless)

})();
export { InternalBaseScope };
export { BaseScope };
const resolutionsToJson = (resolutions) => flatMorph(resolutions, (k, v) => [
k,
hasArkKind(v, "root") || hasArkKind(v, "generic") ?
v.json
: resolutionsToJson(v)
hasArkKind(v, "root") || hasArkKind(v, "generic") ? v.json
: hasArkKind(v, "module") ? resolutionsToJson(v)
: throwInternalError(`Unexpected resolution ${printable(v)}`)
]);

@@ -339,31 +339,27 @@ const maybeResolveSubalias = (base, name) => {

if (resolution === undefined)
return;
if (hasArkKind(resolution, "module"))
return maybeResolveSubalias(resolution, subalias);
return maybeResolveSubalias(prefixSchema, subalias);
if (hasArkKind(resolution, "root") || hasArkKind(resolution, "generic"))
return resolution;
if (hasArkKind(resolution, "module"))
return throwParseError(writeMissingSubmoduleAccessMessage(name));
throwInternalError(`Unexpected resolution for alias '${name}': ${printable(resolution)}`);
};
export const schemaScope = (aliases, config) => new SchemaScope(aliases, config);
export class InternalSchemaScope extends InternalBaseScope {
parseRoot(def, opts = {}) {
const node = this.schema(def, this.finalizeRootArgs(opts, () => node));
export class SchemaScope extends BaseScope {
defineRoot(schema) {
return schema;
}
parseRoot(schema, opts = {}) {
const node = this.rootNode(schema, this.finalizeRootArgs(opts, () => node));
return node;
}
}
export const SchemaScope = InternalSchemaScope;
export const root = new SchemaScope({});
export const schema = root.schema;
export const node = root.node;
export const defineRoot = root.defineRoot;
export const units = root.units;
export const generic = root.generic;
export const internalSchema = root.internal.schema;
export const internalNode = root.internal.node;
export const defineInternalRoot = root.internal.defineRoot;
export const internalUnits = root.internal.units;
export const internalGeneric = root.internal.generic;
export const $root = new SchemaScope({});
export const rootNode = $root.rootNode;
export const node = $root.node;
export const defineSchema = $root.defineSchema;
export const genericNode = $root.generic;
export const parseAsSchema = (def, opts) => {
try {
return schema(def, opts);
return rootNode(def, opts);
}

@@ -376,4 +372,2 @@ catch (e) {

};
export class InternalRootModule extends DynamicBase {
}
const resolutionsOfModule = ($, typeSet) => {

@@ -388,6 +382,4 @@ const result = {};

}
else if (hasArkKind(v, "generic"))
else if (hasArkKind(v, "root") || hasArkKind(v, "generic"))
result[k] = v;
else if (hasArkKind(v, "root"))
result[k] = v;
else

@@ -394,0 +386,0 @@ throwInternalError(`Unexpected scope resolution ${printable(v)}`);

@@ -1,2 +0,2 @@

import type { merge, show } from "@ark/util";
import type { show } from "@ark/util";
import type { Node, reducibleKindOf } from "../kinds.js";

@@ -28,3 +28,3 @@ import type { Disjoint } from "./disjoint.js";

[k in keyof d]: k extends keyof DeclarationInput ? DeclarationInput[k] : never;
} & DeclarationInput> = merge<{
} & DeclarationInput> = show<Omit<{
intersectionIsOpen: false;

@@ -34,3 +34,3 @@ prerequisite: prerequisiteOf<d>;

reducibleTo: d["kind"];
}, d & {
}, keyof d> & d & {
errorContext: d["errorContext"] extends {} ? BaseErrorContext<d["kind"]> : null;

@@ -37,0 +37,0 @@ }>;

@@ -34,4 +34,7 @@ import { type Key } from "@ark/util";

withPrefixKey(key: string | symbol, kind: PropKind): Disjoint;
toNeverIfDisjoint(): BaseRoot;
}
export type DisjointKind = keyof OperandsByDisjointKind;
export declare const writeUnsatisfiableExpressionError: <expression extends string>(expression: expression) => writeUnsatisfiableExpressionError<expression>;
export type writeUnsatisfiableExpressionError<expression extends string> = `${expression} results in an unsatisfiable type`;
export {};

@@ -1,3 +0,3 @@

import { isArray, throwParseError } from "@ark/util";
import { hasArkKind, pathToPropString } from "./utils.js";
import { $ark, isArray, throwParseError } from "@ark/util";
import { isNode, pathToPropString } from "./utils.js";
export class Disjoint extends Array {

@@ -27,3 +27,3 @@ static init(kind, l, r, ctx) {

const pathString = pathToPropString(path);
return `Intersection${pathString && ` at ${pathString}`} of ${describeReasons(l, r)} results in an unsatisfiable type`;
return writeUnsatisfiableExpressionError(`Intersection${pathString && ` at ${pathString}`} of ${describeReasons(l, r)}`);
}

@@ -49,6 +49,10 @@ return `The following intersections result in unsatisfiable types:\n• ${this.map(({ path, l, r }) => `${path}: ${describeReasons(l, r)}`).join("\n• ")}`;

}
toNeverIfDisjoint() {
return $ark.intrinsic.never;
}
}
const describeReasons = (l, r) => `${describeReason(l)} and ${describeReason(r)}`;
const describeReason = (value) => hasArkKind(value, "root") ? value.expression
: isArray(value) ? value.map(describeReason).join(" | ")
const describeReason = (value) => isNode(value) ? value.expression
: isArray(value) ? value.map(describeReason).join(" | ") || "never"
: String(value);
export const writeUnsatisfiableExpressionError = (expression) => `${expression} results in an unsatisfiable type`;

@@ -7,3 +7,3 @@ import { type Entry, type Json, type JsonData, type PartialRecord, type arrayIndexOf, type keySet, type keySetOf, type listable, type propValueOf, type requireKeys, type show } from "@ark/util";

import type { BaseRoot, schemaKindOrRightOf, schemaKindRightOf } from "../roots/root.js";
import type { InternalBaseScope } from "../scope.js";
import type { BaseScope } from "../scope.js";
import type { StructureInner } from "../structure/structure.js";

@@ -53,3 +53,3 @@ import type { BaseErrorContext, BaseMeta, BaseNodeDeclaration } from "./declare.js";

export interface IntersectionContext extends InternalIntersectionOptions {
$: InternalBaseScope;
$: BaseScope;
invert: boolean;

@@ -103,3 +103,3 @@ }

collapsibleKey?: keyof d["inner"];
reduce?: (inner: d["inner"], $: InternalBaseScope) => Node<d["reducibleTo"]> | Disjoint | undefined;
reduce?: (inner: d["inner"], $: BaseScope) => Node<d["reducibleTo"]> | Disjoint | undefined;
}

@@ -106,0 +106,0 @@ export interface UnknownNodeImplementation extends CommonNodeImplementationInput<BaseNodeDeclaration> {

@@ -1,37 +0,10 @@

import { Hkt, type array, type conform, type intersectArrays, type isAny, type show } from "@ark/util";
import type { Constraints, of, parseConstraints } from "../ast.js";
import type { BaseNode } from "../node.js";
import type { MorphAst, MorphNode, Out } from "../roots/morph.js";
import type { MorphNode } from "../roots/morph.js";
import type { BaseRoot } from "../roots/root.js";
import type { InternalBaseScope } from "../scope.js";
import type { BaseScope } from "../scope.js";
import { Disjoint } from "./disjoint.js";
import type { IntersectionContext, RootKind } from "./implement.js";
export type inferIntersection<l, r> = _inferIntersection<l, r, false>;
export type inferPipe<l, r> = _inferIntersection<l, r, true>;
type _inferIntersection<l, r, piped extends boolean> = [
l
] extends [never] ? never : [r] extends [never] ? never : [l & r] extends [never] ? never : isAny<l | r> extends true ? any : l extends MorphAst<infer lIn, infer lOut> ? r extends MorphAst<any, infer rOut> ? piped extends true ? (In: lIn) => Out<rOut> : never : piped extends true ? (In: lIn) => Out<r> : (In: _inferIntersection<lIn, r, false>) => Out<lOut> : r extends MorphAst<infer rIn, infer rOut> ? (In: _inferIntersection<rIn, l, false>) => Out<rOut> : parseConstraints<l> extends ([
infer lBase,
infer lConstraints extends Constraints
]) ? parseConstraints<r> extends ([
infer rBase,
infer rConstraints extends Constraints
]) ? of<_inferIntersection<lBase, rBase, piped>, lConstraints & rConstraints> : of<_inferIntersection<lBase, r, piped>, lConstraints> : parseConstraints<r> extends ([
infer rBase,
infer rConstraints extends Constraints
]) ? of<_inferIntersection<l, rBase, piped>, rConstraints> : [l, r] extends [object, object] ? intersectObjects<l, r, piped> extends infer result ? result : never : l & r;
declare class MorphableIntersection<piped extends boolean> extends Hkt.Kind {
hkt: (In: conform<this[Hkt.args], [l: unknown, r: unknown]>) => _inferIntersection<(typeof In)[0], (typeof In)[1], piped>;
}
type intersectObjects<l, r, piped extends boolean> = [
l,
r
] extends [infer lList extends array, infer rList extends array] ? intersectArrays<lList, rList, MorphableIntersection<piped>> : show<{
[k in keyof l]: k extends keyof r ? _inferIntersection<l[k], r[k], piped> : l[k];
} & {
[k in keyof r]: k extends keyof l ? _inferIntersection<l[k], r[k], piped> : r[k];
}>;
type InternalNodeIntersection<ctx> = <l extends BaseNode, r extends BaseNode>(l: l, r: r, ctx: ctx) => l["kind"] | r["kind"] extends RootKind ? BaseRoot | Disjoint : BaseNode | Disjoint | null;
export declare const intersectNodesRoot: InternalNodeIntersection<InternalBaseScope>;
export declare const pipeNodesRoot: InternalNodeIntersection<InternalBaseScope>;
export declare const intersectNodesRoot: InternalNodeIntersection<BaseScope>;
export declare const pipeNodesRoot: InternalNodeIntersection<BaseScope>;
export declare const intersectNodes: InternalNodeIntersection<IntersectionContext>;

@@ -38,0 +11,0 @@ export declare const pipeFromMorph: (from: MorphNode, to: BaseRoot, ctx: IntersectionContext) => MorphNode | Disjoint;

@@ -1,2 +0,1 @@

import { Hkt } from "@ark/util";
import { Disjoint } from "./disjoint.js";

@@ -3,0 +2,0 @@ import { isNode } from "./utils.js";

@@ -1,5 +0,5 @@

import type { NonNegativeIntegerString } from "../keywords/internal.js";
import { type NonNegativeIntegerLiteral } from "@ark/util";
export declare const registryName: string;
export declare const reference: (name: string) => RegisteredReference;
export declare const registeredReference: (value: object | symbol) => RegisteredReference;
export type RegisteredReference<to extends string = string> = `$ark${"" | NonNegativeIntegerString}.${to}`;
export type RegisteredReference<to extends string = string> = `$ark${"" | NonNegativeIntegerLiteral}.${to}`;
import { type array, type mutable, type requireKeys, type show } from "@ark/util";
import type { BaseConstraint } from "../constraint.js";
import type { GenericRoot } from "../generic.js";
import type { InternalModule } from "../module.js";
import type { BaseNode } from "../node.js";
import type { BaseRoot } from "../roots/root.js";
import type { InternalBaseScope, InternalRootModule } from "../scope.js";
import type { BaseScope } from "../scope.js";
import type { ArkError } from "./errors.js";

@@ -24,9 +25,9 @@ export declare const makeRootAndArrayPropertiesMutable: <o extends object>(o: o) => makeRootAndArrayPropertiesMutable<o>;

export type arkKind = typeof arkKind;
export declare const arkKind: unique symbol;
export declare const arkKind: " arkKind";
export interface ArkKinds {
constraint: BaseConstraint;
root: BaseRoot;
scope: InternalBaseScope;
scope: BaseScope;
generic: GenericRoot;
module: InternalRootModule;
module: InternalModule;
error: ArkError;

@@ -37,2 +38,1 @@ }

export declare const isNode: (value: unknown) => value is BaseNode;
export declare const inferred: unique symbol;

@@ -1,2 +0,2 @@

import { flatMorph, isArray, isDotAccessible, printable, throwParseError } from "@ark/util";
import { flatMorph, isArray, isDotAccessible, noSuggest, printable, throwParseError } from "@ark/util";
export const makeRootAndArrayPropertiesMutable = (o) =>

@@ -24,8 +24,4 @@ // this cast should not be required, but it seems TS is referencing

};
export const arkKind = Symbol("ArkTypeInternalKind");
export const arkKind = noSuggest("arkKind");
export const hasArkKind = (value, kind) => value?.[arkKind] === kind;
export const isNode = (value) => hasArkKind(value, "root") || hasArkKind(value, "constraint");
// ideally this could be just declared since it is not used at runtime,
// but it doesn't play well with typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/issues/4608
// easiest solution seems to be just having it declared as a value so it doesn't break when we import at runtime
export const inferred = Symbol("inferred");
import { BaseConstraint } from "../constraint.js";
import type { Node, RootSchema } from "../kinds.js";
import { type DeepNodeTransformContext, type DeepNodeTransformation } from "../node.js";
import { type BaseNode, type DeepNodeTransformContext, type DeepNodeTransformation, type FlatRef } from "../node.js";
import type { BaseRoot } from "../roots/root.js";

@@ -34,4 +34,4 @@ import type { BaseMeta, declareNode } from "../shared/declare.js";

traverseApply: TraverseApply<object>;
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): import("../node.js").BaseNode<import("../shared/declare.js").BaseNodeDeclaration> | null;
get flatRefs(): import("../node.js").FlatRef<BaseRoot<import("../roots/root.js").InternalRootDeclaration>>[];
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): BaseNode | null;
get flatRefs(): FlatRef[];
compile(): void;

@@ -41,2 +41,2 @@ }

export declare const writeInvalidPropertyKeyMessage: <indexSchema extends string>(indexSchema: indexSchema) => writeInvalidPropertyKeyMessage<indexSchema>;
export type writeInvalidPropertyKeyMessage<indexSchema extends string> = `Indexed key definition '${indexSchema}' must be a string, number or symbol`;
export type writeInvalidPropertyKeyMessage<indexSchema extends string> = `Indexed key definition '${indexSchema}' must be a string or symbol`;

@@ -15,4 +15,4 @@ import { $ark, append, printable, stringAndSymbolicEntriesOf, throwParseError } from "@ark/util";

parse: (schema, ctx) => {
const key = ctx.$.schema(schema);
if (!key.extends($ark.intrinsic.propertyKey)) {
const key = ctx.$.rootNode(schema);
if (!key.extends($ark.intrinsic.key)) {
return throwParseError(writeInvalidPropertyKeyMessage(key.expression));

@@ -29,3 +29,3 @@ }

child: true,
parse: (schema, ctx) => ctx.$.schema(schema)
parse: (schema, ctx) => ctx.$.rootNode(schema)
}

@@ -91,2 +91,2 @@ },

export const writeEnumerableIndexBranches = (keys) => `Index keys ${keys.join(", ")} should be specified as named props.`;
export const writeInvalidPropertyKeyMessage = (indexSchema) => `Indexed key definition '${indexSchema}' must be a string, number or symbol`;
export const writeInvalidPropertyKeyMessage = (indexSchema) => `Indexed key definition '${indexSchema}' must be a string or symbol`;

@@ -10,4 +10,2 @@ import type { declareNode } from "../shared/declare.js";

}
export type Default<v = any> = ["=", v];
export type DefaultableAst<t = any, v = any> = (In?: t) => Default<v>;
export type OptionalDeclaration = declareNode<BasePropDeclaration<"optional"> & {

@@ -14,0 +12,0 @@ schema: OptionalSchema;

@@ -11,3 +11,3 @@ import { implementNode } from "../shared/implement.js";

child: true,
parse: (schema, ctx) => ctx.$.schema(schema)
parse: (schema, ctx) => ctx.$.rootNode(schema)
},

@@ -14,0 +14,0 @@ default: {

import { type Key } from "@ark/util";
import { BaseConstraint } from "../constraint.js";
import type { Node, RootSchema } from "../kinds.js";
import { type DeepNodeTransformContext, type DeepNodeTransformation, type FlatRef } from "../node.js";
import { type BaseNode, type DeepNodeTransformContext, type DeepNodeTransformation, type FlatRef } from "../node.js";
import type { BaseRoot } from "../roots/root.js";

@@ -36,3 +36,3 @@ import { type NodeCompiler } from "../shared/compile.js";

get flatRefs(): FlatRef[];
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): import("../node.js").BaseNode<import("../shared/declare.js").BaseNodeDeclaration> | null;
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): BaseNode | null;
private defaultValueMorphs;

@@ -39,0 +39,0 @@ private defaultValueMorphsReference;

@@ -20,3 +20,3 @@ import { compileErrorContext, implementNode } from "../shared/implement.js";

child: true,
parse: (schema, ctx) => ctx.$.schema(schema)
parse: (schema, ctx) => ctx.$.rootNode(schema)
}

@@ -23,0 +23,0 @@ },

import { type array, type satisfy } from "@ark/util";
import { BaseConstraint } from "../constraint.js";
import type { RootSchema } from "../kinds.js";
import { type DeepNodeTransformContext, type DeepNodeTransformation, type FlatRef } from "../node.js";
import { type BaseNode, type DeepNodeTransformContext, type DeepNodeTransformation, type FlatRef } from "../node.js";
import type { MaxLengthNode } from "../refinements/maxLength.js";

@@ -58,3 +58,3 @@ import type { MinLengthNode } from "../refinements/minLength.js";

compile(js: NodeCompiler): void;
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): import("../node.js").BaseNode<import("../shared/declare.js").BaseNodeDeclaration> | null;
protected _transform(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): BaseNode | null;
tuple: SequenceTuple;

@@ -61,0 +61,0 @@ expression: string;

@@ -47,3 +47,3 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

undefined
: schema.map(element => ctx.$.schema(element))
: schema.map(element => ctx.$.rootNode(element))
};

@@ -59,3 +59,3 @@ export const sequenceImplementation = implementNode({

child: true,
parse: (schema, ctx) => ctx.$.schema(schema, ctx)
parse: (schema, ctx) => ctx.$.rootNode(schema, ctx)
},

@@ -62,0 +62,0 @@ minVariadicLength: {

@@ -1,8 +0,6 @@

import { type array, type join, type Key, type typeToString } from "@ark/util";
import { type array, type Key } from "@ark/util";
import { BaseConstraint } from "../constraint.js";
import type { InferredRoot } from "../inference.js";
import type { NonNegativeIntegerString } from "../keywords/internal.js";
import type { TypeIndexer, TypeKey } from "../node.js";
import type { GettableKeyOrNode, KeyOrKeyNode } from "../node.js";
import { type BaseRoot } from "../roots/root.js";
import type { InternalBaseScope } from "../scope.js";
import type { BaseScope } from "../scope.js";
import type { NodeCompiler } from "../shared/compile.js";

@@ -54,7 +52,7 @@ import type { BaseMeta, declareNode } from "../shared/declare.js";

keyof(): BaseRoot;
assertHasKeys(keys: array<TypeKey>): undefined;
get(indexer: TypeIndexer, ...path: array<TypeIndexer>): BaseRoot;
assertHasKeys(keys: array<KeyOrKeyNode>): void;
get(indexer: GettableKeyOrNode, ...path: array<GettableKeyOrNode>): BaseRoot;
readonly exhaustive: boolean;
pick(...keys: TypeKey[]): StructureNode;
omit(...keys: TypeKey[]): StructureNode;
pick(...keys: KeyOrKeyNode[]): StructureNode;
omit(...keys: KeyOrKeyNode[]): StructureNode;
optionalize(): StructureNode;

@@ -77,18 +75,4 @@ require(): StructureNode;

/** extract enumerable named props from an index signature */
export declare const normalizeIndex: (signature: BaseRoot, value: BaseRoot, $: InternalBaseScope) => NormalizedIndex;
export type toArkKey<o, k extends keyof o> = k extends number ? [
o,
number
] extends [array, k] ? NonNegativeIntegerString : `${k}` : k;
export type arkKeyOf<o> = o extends array ? (number extends o["length"] ? NonNegativeIntegerString : never) | {
[k in keyof o]-?: k extends `${infer index extends number}` ? index | k : never;
}[keyof o & `${number}`] : {
[k in keyof o]: k extends number ? k | `${k}` : k;
}[keyof o];
export type getArkKey<o, k extends arkKeyOf<o>> = o[Extract<k extends NonNegativeIntegerString ? number : k, keyof o>];
export declare const typeKeyToString: (k: TypeKey) => string;
export type typeKeyToString<k extends TypeKey> = typeToString<k extends InferredRoot<infer t> ? t : k>;
export declare const writeInvalidKeysMessage: <o extends string, keys extends array<TypeKey>>(o: o, keys: keys) => writeInvalidKeysMessage<o, keys>;
export type writeInvalidKeysMessage<o extends string, keys extends array<TypeKey>> = `Key${keys["length"] extends 1 ? "" : "s"} ${join<{
[i in keyof keys]: typeKeyToString<keys[i]>;
}, ", ">} ${keys["length"] extends 1 ? "does" : "do"} not exist on ${o}`;
export declare const normalizeIndex: (signature: BaseRoot, value: BaseRoot, $: BaseScope) => NormalizedIndex;
export declare const typeKeyToString: (k: KeyOrKeyNode) => string;
export declare const writeInvalidKeysMessage: <o extends string, keys extends array<KeyOrKeyNode>>(o: o, keys: keys) => string;

@@ -61,3 +61,3 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {

: this.required
: this.optional ?? [];
: (this.optional ?? []);
propsByKey = flatMorph(this.props, (i, node) => [node.key, node]);

@@ -160,3 +160,3 @@ propsByKeyReference = registeredReference(this.propsByKey);

merge(r) {
const inner = makeRootAndArrayPropertiesMutable(this.filterKeys("omit", [r.keyof()]));
const inner = this.filterKeys("omit", [r.keyof()]);
if (r.required)

@@ -177,4 +177,4 @@ inner.required = append(inner.required, r.required);

filterKeys(operation, keys) {
const result = { ...this.inner };
const includeKey = (key) => {
const result = makeRootAndArrayPropertiesMutable(this.inner);
const shouldKeep = (key) => {
const matchesKey = keys.some(k => typeOrTermExtends(key, k));

@@ -184,7 +184,7 @@ return operation === "pick" ? matchesKey : !matchesKey;

if (result.required)
result.required = result.required.filter(prop => includeKey(prop.key));
result.required = result.required.filter(prop => shouldKeep(prop.key));
if (result.optional)
result.optional = result.optional.filter(prop => includeKey(prop.key));
result.optional = result.optional.filter(prop => shouldKeep(prop.key));
if (result.index)
result.index = result.index.filter(index => includeKey(index.signature));
result.index = result.index.filter(index => shouldKeep(index.signature));
return result;

@@ -191,0 +191,0 @@ }

{
"name": "@ark/schema",
"version": "0.2.2",
"version": "0.3.0",
"license": "MIT",

@@ -27,3 +27,3 @@ "author": {

"dependencies": {
"@ark/util": "0.1.2"
"@ark/util": "0.2.0"
},

@@ -30,0 +30,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc