arktype 2.2.10 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +181 -15
- package/out/attributes.d.ts +50 -14
- package/out/checkers.d.ts +172 -0
- package/out/chunk-2U2AWCI3.js +626 -0
- package/out/chunk-4CUA5XIP.js +7 -0
- package/out/chunk-5U2ZMDNI.js +1566 -0
- package/out/chunk-DLWCO4RV.js +18 -0
- package/out/chunk-E3DZXEZK.js +72 -0
- package/out/chunk-EVCML554.js +47 -0
- package/out/chunk-G45P2CLE.js +63 -0
- package/out/chunk-GPNK5353.js +2529 -0
- package/out/chunk-MLKGABMK.js +9 -0
- package/out/chunk-NRIGTMPM.js +7 -0
- package/out/chunk-PRTMQCHS.js +3 -0
- package/out/chunk-R5G57XC7.js +7 -0
- package/out/chunk-RAZ3TXOE.js +313 -0
- package/out/chunk-SWOOCAHN.js +4 -0
- package/out/chunk-TAHPKDNM.js +3 -0
- package/out/chunk-UETB6YE2.js +14 -0
- package/out/chunk-UK5UGFOX.js +254 -0
- package/out/chunk-VV6YDN2D.js +6118 -0
- package/out/codecs.d.ts +21 -0
- package/out/codecs.js +7 -0
- package/out/config.d.ts +8 -3
- package/out/config.js +2 -3
- package/out/declare.d.ts +17 -3
- package/out/deferred.d.ts +10 -0
- package/out/errors.d.ts +1 -0
- package/out/errors.js +2 -0
- package/out/fn.d.ts +1 -1
- package/out/generic.d.ts +3 -3
- package/out/i18n.d.ts +2 -0
- package/out/i18n.js +2 -0
- package/out/index.d.ts +5 -4
- package/out/index.js +8 -9
- package/out/internal.d.ts +70 -0
- package/out/internal.js +17 -0
- package/out/island.d.ts +2 -0
- package/out/island.js +6 -0
- package/out/islandDependency.d.ts +2 -0
- package/out/islandDependency.js +18 -0
- package/out/keywords/Array.d.ts +2 -2
- package/out/keywords/builtins.d.ts +5 -3
- package/out/keywords/constructors.d.ts +9 -1
- package/out/keywords/functions.d.ts +254 -0
- package/out/keywords/keywords.d.ts +8 -9
- package/out/keywords/number.d.ts +2 -8
- package/out/keywords/phrases.d.ts +245 -0
- package/out/keywords/string.d.ts +14 -113
- package/out/keywords/ts.d.ts +35 -33
- package/out/keywords/ts.js +4 -82
- package/out/locale.d.ts +19 -0
- package/out/locales/de.d.ts +2 -0
- package/out/locales/de.js +2 -0
- package/out/locales/en.d.ts +4 -0
- package/out/locales/en.js +5 -0
- package/out/match.d.ts +6 -6
- package/out/module.d.ts +1 -1
- package/out/mutatesInput.js +3 -0
- package/out/parser/ast/generic.d.ts +6 -3
- package/out/parser/ast/infer.d.ts +1 -1
- package/out/parser/ast/validate.d.ts +11 -6
- package/out/parser/definition.d.ts +68 -7
- package/out/parser/objectLiteral.d.ts +40 -12
- package/out/parser/property.d.ts +3 -5
- package/out/parser/reduce/dynamic.d.ts +16 -7
- package/out/parser/reduce/shared.d.ts +4 -0
- package/out/parser/reduce/static.d.ts +13 -13
- package/out/parser/shift/operand/date.d.ts +0 -5
- package/out/parser/shift/operand/operand.d.ts +2 -1
- package/out/parser/shift/operand/unenclosed.d.ts +9 -6
- package/out/parser/shift/operand/unresolvable.d.ts +68 -0
- package/out/parser/shift/operator/bounds.d.ts +9 -4
- package/out/parser/shift/operator/brand.d.ts +2 -2
- package/out/parser/shift/operator/default.d.ts +2 -2
- package/out/parser/shift/operator/divisor.d.ts +2 -2
- package/out/parser/shift/operator/operator.d.ts +1 -1
- package/out/parser/shift/tokens.d.ts +9 -2
- package/out/parser/string.d.ts +61 -7
- package/out/parser/tupleExpressions.d.ts +7 -3
- package/out/precompiled.d.ts +1 -0
- package/out/precompiled.js +2 -0
- package/out/runtime.d.ts +181 -0
- package/out/runtime.js +4 -0
- package/out/runtimeDevelopment.d.ts +1 -0
- package/out/runtimeDevelopment.js +133 -0
- package/out/runtimeExports.d.ts +1 -0
- package/out/scope.d.ts +40 -11
- package/out/standalone/artifact.d.ts +265 -0
- package/out/standalone/baking.d.ts +201 -0
- package/out/standalone/combinators.d.ts +13 -0
- package/out/standalone/compilers.d.ts +23 -0
- package/out/standalone/creators.d.ts +41 -0
- package/out/standalone/fallbacks.d.ts +48 -0
- package/out/standalone/keys.d.ts +31 -0
- package/out/standalone/modules.d.ts +26 -0
- package/out/standalone/sites.d.ts +52 -0
- package/out/standalone/units.d.ts +31 -0
- package/out/standalone/values.d.ts +60 -0
- package/out/standalone.d.ts +16 -0
- package/out/type.d.ts +45 -6
- package/out/variants/array.d.ts +1 -1
- package/out/variants/base.d.ts +47 -27
- package/out/variants/date.d.ts +1 -1
- package/out/variants/instantiate.d.ts +4 -2
- package/out/variants/number.d.ts +1 -1
- package/out/variants/object.d.ts +17 -12
- package/out/variants/string.d.ts +1 -1
- package/package.json +169 -8
- package/skills/arktype/SKILL.md +278 -43
- package/skills/arktype/references/migrating.md +1296 -0
- package/skills/arktype/references/precompile.md +191 -0
- package/out/attributes.js +0 -3
- package/out/fn.js +0 -58
- package/out/generic.js +0 -37
- package/out/keywords/Array.js +0 -21
- package/out/keywords/FormData.js +0 -40
- package/out/keywords/TypedArray.js +0 -16
- package/out/keywords/builtins.js +0 -11
- package/out/keywords/constructors.js +0 -16
- package/out/keywords/keywords.js +0 -48
- package/out/keywords/number.js +0 -49
- package/out/keywords/string.js +0 -467
- package/out/match.js +0 -95
- package/out/module.js +0 -3
- package/out/nary.js +0 -1
- package/out/parser/ast/bounds.js +0 -1
- package/out/parser/ast/default.js +0 -1
- package/out/parser/ast/divisor.js +0 -1
- package/out/parser/ast/generic.js +0 -1
- package/out/parser/ast/infer.js +0 -1
- package/out/parser/ast/keyof.js +0 -1
- package/out/parser/ast/utils.js +0 -1
- package/out/parser/ast/validate.js +0 -3
- package/out/parser/definition.js +0 -78
- package/out/parser/objectLiteral.js +0 -113
- package/out/parser/property.js +0 -16
- package/out/parser/reduce/dynamic.js +0 -153
- package/out/parser/reduce/shared.js +0 -25
- package/out/parser/reduce/static.js +0 -1
- package/out/parser/shift/operand/date.js +0 -23
- package/out/parser/shift/operand/enclosed.js +0 -82
- package/out/parser/shift/operand/genericArgs.js +0 -16
- package/out/parser/shift/operand/operand.js +0 -16
- package/out/parser/shift/operand/unenclosed.js +0 -59
- package/out/parser/shift/operator/bounds.js +0 -91
- package/out/parser/shift/operator/brand.js +0 -6
- package/out/parser/shift/operator/default.js +0 -29
- package/out/parser/shift/operator/divisor.js +0 -13
- package/out/parser/shift/operator/operator.js +0 -28
- package/out/parser/shift/tokens.js +0 -37
- package/out/parser/string.js +0 -42
- package/out/parser/tupleExpressions.js +0 -75
- package/out/parser/tupleLiteral.js +0 -128
- package/out/scope.js +0 -106
- package/out/type.js +0 -55
- package/out/variants/array.js +0 -1
- package/out/variants/base.js +0 -1
- package/out/variants/date.js +0 -1
- package/out/variants/instantiate.js +0 -1
- package/out/variants/number.js +0 -1
- package/out/variants/object.js +0 -1
- package/out/variants/string.js +0 -1
- /package/out/{declare.js → mutatesInput.d.ts} +0 -0
package/out/scope.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { BaseScope, type AliasDefEntry, type ArkSchemaRegistry, type ArkSchemaScopeConfig, type BaseNode, type BaseParseContext, type BaseParseContextInput, type BaseParseOptions, type BaseRoot, type GenericAst, type GenericParamAst, type GenericParamDef, type
|
|
2
|
-
import { type Brand, type ErrorType, type JsonStructure, type anyOrNever, type array, type
|
|
1
|
+
import { BaseScope, RootModule, type AliasDefEntry, type ArkSchemaRegistry, type ArkSchemaScopeConfig, type BaseNode, type BaseParseContext, type BaseParseContextInput, type BaseParseOptions, type BaseRoot, type GenericAst, type GenericParamAst, type GenericParamDef, type NodeInput, type NodeKind, type PreparsedNodeResolution, type PrivateDeclaration, type RootSchema, type arkKind, type exportedNameOf, type nodeOfKind, type reducibleKindOf, type toInternalScope, type writeDuplicateAliasError, type writeShallowCycleErrorMessage } from "@ark/schema";
|
|
2
|
+
import { type Brand, type Dict, type ErrorMessage, type ErrorType, type JsonStructure, type anyOrNever, type array, type inferred, type noSuggest } from "@ark/util";
|
|
3
|
+
import type { InferredMorph } from "./attributes.ts";
|
|
3
4
|
import type { DeclarationParser } from "./declare.ts";
|
|
4
5
|
import { InternalFnParser, type FnParser } from "./fn.ts";
|
|
5
|
-
import { type GenericDeclaration, type GenericParser, type ParameterString, type baseGenericConstraints, type parseGenericParams, type parseValidGenericParams } from "./generic.ts";
|
|
6
|
-
import type { Ark
|
|
6
|
+
import { type Generic, type GenericDeclaration, type GenericParser, type ParameterString, type baseGenericConstraints, type parseGenericParams, type parseValidGenericParams } from "./generic.ts";
|
|
7
|
+
import type { Ark } from "./keywords/keywords.ts";
|
|
7
8
|
import { InternalMatchParser, type MatchParser } from "./match.ts";
|
|
8
9
|
import type { BoundModule, Module, Submodule, exportScope, instantiateExport } from "./module.ts";
|
|
9
10
|
import type { NaryIntersectionParser, NaryMergeParser, NaryPipeParser, NaryUnionParser } from "./nary.ts";
|
|
11
|
+
import type { GenericInstantiationAst } from "./parser/ast/generic.ts";
|
|
10
12
|
import type { DefAst, InferredAst } from "./parser/ast/infer.ts";
|
|
11
|
-
import { type inferDefinition } from "./parser/definition.ts";
|
|
13
|
+
import { type inferDefinition, type validateDefinition } from "./parser/definition.ts";
|
|
12
14
|
import type { ParsedOptionalProperty } from "./parser/property.ts";
|
|
15
|
+
import type { BranchOperator } from "./parser/reduce/shared.ts";
|
|
13
16
|
import type { ParsedDefaultableProperty } from "./parser/shift/operator/default.ts";
|
|
17
|
+
import type { parseString } from "./parser/string.ts";
|
|
14
18
|
import { InternalTypeParser, type DefinitionParser, type EnumeratedTypeParser, type InstanceOfTypeParser, type SchemaParser, type TypeParser, type UnitTypeParser, type ValueOfTypeParser } from "./type.ts";
|
|
15
19
|
/** The convenience properties attached to `scope` */
|
|
16
20
|
export type ScopeParserAttachments = Omit<ScopeParser, never>;
|
|
@@ -72,11 +76,12 @@ export interface InternalScope {
|
|
|
72
76
|
}
|
|
73
77
|
export declare class InternalScope<$ extends {} = {}> extends BaseScope<$> {
|
|
74
78
|
get ambientAttachments(): Ark.boundTypeAttachments<$> | undefined;
|
|
75
|
-
|
|
79
|
+
private keywordConfigOf;
|
|
80
|
+
protected preparseEntry(alias: string, def: unknown): AliasDefEntry;
|
|
76
81
|
parseGenericParams(def: string, opts: BaseParseOptions): array<GenericParamDef>;
|
|
77
|
-
protected
|
|
78
|
-
protected
|
|
79
|
-
|
|
82
|
+
protected normValue(resolution: unknown): unknown;
|
|
83
|
+
protected preparseOwn(def: unknown, opts: BaseParseOptions): BaseRoot | BaseParseContextInput;
|
|
84
|
+
parseOwn(def: unknown, ctx: BaseParseContext): BaseRoot;
|
|
80
85
|
unit: UnitTypeParser<$>;
|
|
81
86
|
valueOf: ValueOfTypeParser<$>;
|
|
82
87
|
enumerated: EnumeratedTypeParser<$>;
|
|
@@ -95,13 +100,37 @@ export declare class InternalScope<$ extends {} = {}> extends BaseScope<$> {
|
|
|
95
100
|
static scope: ScopeParser;
|
|
96
101
|
static module: ModuleParser;
|
|
97
102
|
}
|
|
103
|
+
export declare const keywordModule: (def: Dict, config: ArkScopeConfig & {
|
|
104
|
+
name: string;
|
|
105
|
+
}) => RootModule;
|
|
106
|
+
export declare const writeParameterizedGenericKeyMessage: <name extends string>(name: name) => writeParameterizedGenericKeyMessage<name>;
|
|
107
|
+
export type writeParameterizedGenericKeyMessage<name extends string> = `${name} is defined by a generic, so its key must not declare parameters`;
|
|
98
108
|
export declare const scope: ScopeParser;
|
|
109
|
+
type InferredDefinition = {
|
|
110
|
+
[inferred]: unknown;
|
|
111
|
+
};
|
|
99
112
|
export declare namespace scope {
|
|
100
113
|
type validate<def> = {
|
|
101
|
-
[k in keyof def]: k extends noSuggest ? unknown : parseScopeKey<k, def>["params"] extends infer params ? params extends array<GenericParamAst> ? params["length"] extends 0 ? def[k] extends
|
|
114
|
+
[k in keyof def]: k extends noSuggest ? unknown : parseScopeKey<k, def>["params"] extends infer params ? params extends array<GenericParamAst> ? params["length"] extends 0 ? def[k] extends InferredDefinition | PreparsedResolution ? def[k] : k extends (PrivateDeclaration<infer name extends keyof def & string>) ? ErrorType<writeDuplicateAliasError<name>> : validateAlias<k, def[k], bootstrapAliases<def>> : def[k] extends Generic ? ErrorType<writeParameterizedGenericKeyMessage<parseScopeKey<k, def>["name"] & string>> : validateDefinition<def[k], bootstrapAliases<def>, baseGenericConstraints<params>> : params : never;
|
|
102
115
|
};
|
|
103
116
|
type infer<def> = inferBootstrapped<bootstrapAliases<def>>;
|
|
104
117
|
}
|
|
118
|
+
type validateAlias<k, def, $> = shallowCycleMessageOf<k, def, $> extends infer message extends string ? ErrorMessage<message> : validateDefinition<def, $, {}>;
|
|
119
|
+
type shallowCycleMessageOf<k, def, $> = def extends string ? aliasNameOf<k> extends infer name extends string ? name extends (shallowClosure<shallowReferencesOf<parseString<def, $, {}>, $>, $>) ? shallowCycleOf<name, parseString<def, $, {}>, $, [name]> extends (infer cycle extends string[]) ? writeShallowCycleErrorMessage<name, cycle> : never : undefined : never : undefined;
|
|
120
|
+
type aliasNameOf<k> = k extends PrivateDeclaration<infer name> ? name : k;
|
|
121
|
+
type aliasAstOf<name, $> = name extends string ? (name extends keyof $ ? $[name] : $[PrivateDeclaration<name> & keyof $]) extends Def<infer def extends string> ? parseString<def, $, {}> : undefined : never;
|
|
122
|
+
type shallowReferencesOf<ast, $> = ast extends readonly [infer l, infer operator, infer r] ? operator extends "def" ? r : operator extends ShallowOperator ? shallowReferencesOf<l, $> | (pipesFromMorph<l, operator, $> extends true ? never : shallowReferencesOf<r, $>) : never : never;
|
|
123
|
+
type ShallowOperator = BranchOperator | "#";
|
|
124
|
+
type pipesFromMorph<l, operator, $> = operator extends "|>" ? includesMorphAst<l, $, never> : false;
|
|
125
|
+
type includesMorphAst<ast, $, seen> = ast extends InferredAst<infer t> ? [
|
|
126
|
+
Extract<t, InferredMorph>
|
|
127
|
+
] extends [never] ? false : true : ast extends DefAst<infer def, infer alias> ? def extends string ? alias extends seen ? false : includesMorphAst<aliasAstOf<alias, $>, $, seen | alias> : true : ast extends GenericInstantiationAst ? true : ast extends readonly unknown[] ? true extends includesMorphAst<ast[number], $, seen> ? true : false : false;
|
|
128
|
+
type shallowClosure<frontier, $, reached = never> = [
|
|
129
|
+
frontier
|
|
130
|
+
] extends [never] ? reached : shallowClosure<Exclude<shallowReferencesOf<aliasAstOf<frontier, $>, $>, frontier | reached>, $, frontier | reached>;
|
|
131
|
+
type shallowCycleOf<name, ast, $, path extends unknown[]> = ast extends readonly [infer l, infer operator, infer r] ? operator extends "def" ? r extends name ? path : r extends path[number] ? never : name extends shallowClosure<r, $, Exclude<path[number], name>> ? shallowCycleOf<name, aliasAstOf<r, $>, $, [...path, r]> : never : operator extends ShallowOperator ? [
|
|
132
|
+
shallowCycleOf<name, l, $, path>
|
|
133
|
+
] extends [never] ? pipesFromMorph<l, operator, $> extends true ? never : shallowCycleOf<name, r, $, path> : shallowCycleOf<name, l, $, path> : never : never;
|
|
105
134
|
export interface Scope<$ = {}> {
|
|
106
135
|
t: $;
|
|
107
136
|
[arkKind]: "scope";
|
|
@@ -114,7 +143,7 @@ export interface Scope<$ = {}> {
|
|
|
114
143
|
aliases: Record<string, unknown>;
|
|
115
144
|
internal: toInternalScope<$>;
|
|
116
145
|
defineSchema<const def extends RootSchema>(schema: def): def;
|
|
117
|
-
node<
|
|
146
|
+
node<kind extends NodeKind>(kind: kind, input: NodeInput<kind>, opts?: BaseParseOptions): nodeOfKind<reducibleKindOf<kind>>;
|
|
118
147
|
unit: UnitTypeParser<$>;
|
|
119
148
|
enumerated: EnumeratedTypeParser<$>;
|
|
120
149
|
valueOf: ValueOfTypeParser<$>;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { ToJsonSchema, type BaseNode, type BaseRoot, type RootUnit } from "@ark/schema";
|
|
2
|
+
import type { InternalTypedFn } from "../fn.ts";
|
|
3
|
+
import type { HoleKind } from "../runtime.ts";
|
|
4
|
+
import { failureSources, type Baking, type Configured, type DefaultCheck, type ExportedValue, type FactoryParam, type Foldable, type SharedWrite, type StandaloneBake, type StandaloneFactory, type StandaloneIntrospection, type ValidatorMember } from "./baking.ts";
|
|
5
|
+
import { type CreatedFrom, type RootApplier, type ValidatorAttributes, type ValidatorForm } from "./creators.ts";
|
|
6
|
+
import { type ComposedString } from "./keys.ts";
|
|
7
|
+
import { type SharedModule, type UnitScope } from "./modules.ts";
|
|
8
|
+
import { type Writer } from "./sites.ts";
|
|
9
|
+
import { type CollectedDefault } from "./units.ts";
|
|
10
|
+
import { DataParts, type HoleCell } from "./values.ts";
|
|
11
|
+
type DeclarationRole = "shape" | "keys" | "literal" | "made" | "standIn" | "json" | "jsonSchema" | "traversal";
|
|
12
|
+
interface RootApplyOptions {
|
|
13
|
+
asValidator: boolean;
|
|
14
|
+
readsAllows: boolean;
|
|
15
|
+
unconfigured: boolean;
|
|
16
|
+
pipes: boolean;
|
|
17
|
+
throws?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface WrittenValidator {
|
|
20
|
+
parts: string;
|
|
21
|
+
attributes: string[];
|
|
22
|
+
created: (load?: string) => string;
|
|
23
|
+
}
|
|
24
|
+
interface WriteDataOptions {
|
|
25
|
+
values?: unknown[];
|
|
26
|
+
parts?: DataParts;
|
|
27
|
+
}
|
|
28
|
+
interface DataPartWriter {
|
|
29
|
+
prefix: string;
|
|
30
|
+
valueOf: (text: string) => string;
|
|
31
|
+
declarationOf: (name: string, value: string) => string;
|
|
32
|
+
readsRuntime: boolean;
|
|
33
|
+
declareLocal?: (value: string) => string;
|
|
34
|
+
readIn: (name: string) => string;
|
|
35
|
+
read: (specifier: string, name: string) => string;
|
|
36
|
+
}
|
|
37
|
+
interface JsonSchemaWriter {
|
|
38
|
+
text: string;
|
|
39
|
+
values: unknown[];
|
|
40
|
+
}
|
|
41
|
+
interface Declarations {
|
|
42
|
+
statements: string[];
|
|
43
|
+
namesByValue: Map<unknown, string>;
|
|
44
|
+
valuesByRole: Record<DeclarationRole, unknown[]>;
|
|
45
|
+
}
|
|
46
|
+
interface WritingScope {
|
|
47
|
+
params: string[];
|
|
48
|
+
args: string[];
|
|
49
|
+
imports: Record<string, string[]>;
|
|
50
|
+
shapesByName: Record<string, string>;
|
|
51
|
+
cellReads: Record<string, string>;
|
|
52
|
+
narrowedBy: Record<string, HoleCell>;
|
|
53
|
+
}
|
|
54
|
+
interface SharedUnit extends WritingScope {
|
|
55
|
+
unit: RootUnit;
|
|
56
|
+
returned: string[];
|
|
57
|
+
read: ReadonlySet<string>;
|
|
58
|
+
own: BaseRoot[];
|
|
59
|
+
}
|
|
60
|
+
export declare class StandaloneArtifact {
|
|
61
|
+
exports: Record<string, ExportedValue>;
|
|
62
|
+
sharedModules: Record<string, SharedModule>;
|
|
63
|
+
imports: Record<string, string[]>;
|
|
64
|
+
holeExpressions: Map<unknown, string>;
|
|
65
|
+
holeLabels: Map<unknown, string>;
|
|
66
|
+
classes: Set<unknown>;
|
|
67
|
+
checks: string[];
|
|
68
|
+
checksAsWhole: boolean;
|
|
69
|
+
validatorNames: Map<BaseRoot<import("@ark/schema").InternalRootDeclaration>, string>;
|
|
70
|
+
defaultValues: Set<BaseRoot<import("@ark/schema").InternalRootDeclaration>>;
|
|
71
|
+
readRoots: Set<BaseRoot<import("@ark/schema").InternalRootDeclaration>>;
|
|
72
|
+
runtimeReadRoots: Set<BaseRoot<import("@ark/schema").InternalRootDeclaration>>;
|
|
73
|
+
unitRoots: Set<BaseRoot<import("@ark/schema").InternalRootDeclaration>>;
|
|
74
|
+
unitsRead: [rootCount: number, units: RootUnit[]] | undefined;
|
|
75
|
+
writtenRead: [rootCount: number, nodes: BaseNode[]] | undefined;
|
|
76
|
+
unitsByHead: Map<string, RootUnit>;
|
|
77
|
+
localNamesByUnit: Map<RootUnit, string>;
|
|
78
|
+
unit: RootUnit | undefined;
|
|
79
|
+
writing: WritingScope | undefined;
|
|
80
|
+
sharing: SharedWrite | undefined;
|
|
81
|
+
readsCell: boolean;
|
|
82
|
+
defersCellReads: boolean;
|
|
83
|
+
setCells: [cell: HoleCell, param: string][];
|
|
84
|
+
heldReads: string[];
|
|
85
|
+
keyLookups: ReadonlySet<object>;
|
|
86
|
+
patternInstances: ReadonlySet<RegExp>;
|
|
87
|
+
defaultsByMorph: ReadonlyMap<unknown, CollectedDefault>;
|
|
88
|
+
defaultNames: Map<unknown, string>;
|
|
89
|
+
objectUnits: ReadonlySet<unknown>;
|
|
90
|
+
metas: ReadonlySet<object>;
|
|
91
|
+
declarations: Declarations;
|
|
92
|
+
sharedWriters: Map<string, string>;
|
|
93
|
+
emitting: Set<object>;
|
|
94
|
+
moduleNames: Map<object, string>;
|
|
95
|
+
typedFnNames: Map<InternalTypedFn, string>;
|
|
96
|
+
stringModules: Record<ComposedString, Map<BaseRoot, string>>;
|
|
97
|
+
links: string[];
|
|
98
|
+
writtenValidators: Map<string, string>;
|
|
99
|
+
modules: string[];
|
|
100
|
+
fills: string[];
|
|
101
|
+
defaults: string[];
|
|
102
|
+
lateNames: Set<string>;
|
|
103
|
+
comparedRoots: BaseRoot[];
|
|
104
|
+
templates: Set<unknown>;
|
|
105
|
+
exportedRoots: ReadonlySet<BaseRoot>;
|
|
106
|
+
checkedRoots: ReadonlySet<BaseRoot>;
|
|
107
|
+
factory: StandaloneFactory | undefined;
|
|
108
|
+
defaultChecks: readonly DefaultCheck[];
|
|
109
|
+
holesByName: Map<string, readonly unknown[]>;
|
|
110
|
+
baking: Baking;
|
|
111
|
+
introspected: BaseRoot | undefined;
|
|
112
|
+
constructor(exports: Record<string, ExportedValue>, sharedModules: Record<string, SharedModule>, imports: Record<string, string[]>, baking: Baking, called?: StandaloneFactory | StandaloneIntrospection);
|
|
113
|
+
get checksAtCreation(): boolean;
|
|
114
|
+
receive(params: FactoryParam[]): void;
|
|
115
|
+
cellOf(value: unknown): HoleCell | undefined;
|
|
116
|
+
heldOf(holes: readonly unknown[]): readonly unknown[];
|
|
117
|
+
isShared(unit: RootUnit): boolean;
|
|
118
|
+
cellModuleOf(cell: HoleCell): string;
|
|
119
|
+
readCell(cell: HoleCell): string;
|
|
120
|
+
emitCell(cell: HoleCell): string;
|
|
121
|
+
writeSets(): string[];
|
|
122
|
+
checkFacts(checked: CheckedHole[]): void;
|
|
123
|
+
refuseNameDependence(): void;
|
|
124
|
+
holeNamed(name: string, read?: (fn: Function) => string): unknown;
|
|
125
|
+
labelArg(label: string | undefined, after?: string): string;
|
|
126
|
+
receiveHole(hole: unknown, expression: string, label: string): boolean;
|
|
127
|
+
heldFrom(expression: string): string;
|
|
128
|
+
receiverOf(value: Foldable, id: string, label: string): string;
|
|
129
|
+
compareInput(param: string, path: PropertyKey[], value: unknown, root: string, checked: CheckedHole[], isWritable?: boolean, mayBeUnset?: boolean): void;
|
|
130
|
+
refuseHoleOrdering(l: BaseNode, r: BaseNode): void;
|
|
131
|
+
get roots(): BaseRoot[];
|
|
132
|
+
get readsOnlyAllows(): boolean;
|
|
133
|
+
variantOf(root: BaseRoot): number;
|
|
134
|
+
unitsOf(root: BaseRoot): RootUnit[];
|
|
135
|
+
headUnitOf(root: BaseRoot): RootUnit;
|
|
136
|
+
get writtenNodes(): BaseNode[];
|
|
137
|
+
writtenSelected(selects: (node: BaseNode) => boolean): BaseNode[];
|
|
138
|
+
get declared(): BaseNode[];
|
|
139
|
+
get units(): RootUnit[];
|
|
140
|
+
get comparedValues(): unknown[];
|
|
141
|
+
collectExport(value: unknown, path: string): void;
|
|
142
|
+
collectType(root: BaseRoot): void;
|
|
143
|
+
collectMetaTypes(): boolean;
|
|
144
|
+
collectDefaultTypes(): boolean;
|
|
145
|
+
writeCreateBody(configured: Configured): string;
|
|
146
|
+
writeCalls(): string[][] | undefined;
|
|
147
|
+
writeFactory(index: number, configured: Configured): string;
|
|
148
|
+
private writeBakedAfter;
|
|
149
|
+
private internTableOf;
|
|
150
|
+
get internsByHolder(): boolean;
|
|
151
|
+
get internsAcrossModules(): boolean;
|
|
152
|
+
private internNameOf;
|
|
153
|
+
private internKeyOf;
|
|
154
|
+
private contentNameOf;
|
|
155
|
+
writeRekeying(read: string): string[];
|
|
156
|
+
writeIntrospection({ member, type, data, params, thrown }: StandaloneIntrospection, index: number, configured: Configured): string;
|
|
157
|
+
writeBake({ bakes, members }: StandaloneBake, index: number): string;
|
|
158
|
+
get sharedWriterDeclarations(): string;
|
|
159
|
+
writeFactoryFunction(index: number, params: FactoryParam[], configured: Configured, statements: string[]): string;
|
|
160
|
+
writeDefaultChecks(): {
|
|
161
|
+
check: string;
|
|
162
|
+
key: string;
|
|
163
|
+
}[];
|
|
164
|
+
get localUnits(): RootUnit[];
|
|
165
|
+
writeSharedUnits(): void;
|
|
166
|
+
specifierOf(name: string): string;
|
|
167
|
+
readValue(name: string): string;
|
|
168
|
+
writeShared(unit: RootUnit): void;
|
|
169
|
+
writeSharedModule(unit: RootUnit, specifier: string): void;
|
|
170
|
+
writeSharedRefs(writing: SharedUnit): string[];
|
|
171
|
+
writeFlatUnit(writing: SharedUnit, refs: string[], links: string[]): string[];
|
|
172
|
+
writeScopedUnit(writing: SharedUnit, refs: string[], links: string[]): [declarations: string[], scope: UnitScope | undefined];
|
|
173
|
+
writeUnitNodes(writing: SharedUnit): string[];
|
|
174
|
+
writeCtxNode(root: BaseRoot, unit: RootUnit): string;
|
|
175
|
+
get writesCheckerNodes(): boolean;
|
|
176
|
+
isCheckerNode(root: BaseRoot, unit: RootUnit): boolean;
|
|
177
|
+
writeTemplateCall(unit: RootUnit, prologue: string[], returned: string[]): string | undefined;
|
|
178
|
+
writeUnitArray(unit: RootUnit, returned: string[]): string | undefined;
|
|
179
|
+
declareMembers(unit: RootUnit, readers: string[]): string[];
|
|
180
|
+
readsCells(fn: string): string;
|
|
181
|
+
validatorOnLoad(fn: string): string;
|
|
182
|
+
traversalsOf(root: BaseRoot, unit: RootUnit): string[];
|
|
183
|
+
read(specifier: string, name: string, param?: string, arg?: string): string;
|
|
184
|
+
importName(specifier: string, name: string): void;
|
|
185
|
+
dependenciesOf(unit: RootUnit, read: ReadonlySet<string>): Record<string, string[]>;
|
|
186
|
+
shareUnitFunction(params: string, body: string): string;
|
|
187
|
+
writeBody(eagerReads?: string[]): string[];
|
|
188
|
+
writeDeferred(traversals: string[], validators: (readonly [string, WrittenValidator])[], eagerReads: string[]): string[] | undefined;
|
|
189
|
+
writeValidator(root: BaseRoot): WrittenValidator;
|
|
190
|
+
validatorFormOf(root: BaseRoot): ValidatorForm;
|
|
191
|
+
attributesOf(root: BaseRoot, form: ValidatorForm): ValidatorAttributes;
|
|
192
|
+
creatorOf(form: ValidatorForm, applier: RootApplier | undefined, makes: CreatedFrom | undefined): string;
|
|
193
|
+
emitIntrospection(root: BaseRoot, baked: Set<ValidatorMember>): string[];
|
|
194
|
+
private bakedMembersOf;
|
|
195
|
+
private bakedLengths;
|
|
196
|
+
private bakingMember;
|
|
197
|
+
private baked;
|
|
198
|
+
private assertBakedWithin;
|
|
199
|
+
private countBaked;
|
|
200
|
+
writesWithoutFallback(root: BaseRoot): boolean;
|
|
201
|
+
readJson(root: BaseRoot): string;
|
|
202
|
+
private writeDataParts;
|
|
203
|
+
private dataPartsOf;
|
|
204
|
+
share(name: string, declaration: string, imports?: Record<string, string[]>, readsRuntime?: boolean): string;
|
|
205
|
+
readConstant(name: string, value: string): string;
|
|
206
|
+
readSite(emitted: string): string;
|
|
207
|
+
readFailure(name: keyof typeof failureSources): string;
|
|
208
|
+
declareFailure(name: keyof typeof failureSources): string;
|
|
209
|
+
failureImports(failure: keyof typeof failureSources | undefined): Record<string, string[]>;
|
|
210
|
+
writeReplayOf(root: BaseRoot, target: ToJsonSchema.Target | undefined, parts: DataParts): JsonSchemaWriter | undefined;
|
|
211
|
+
private replayOf;
|
|
212
|
+
declareJsonSchema(writer: string, values: unknown[]): string;
|
|
213
|
+
jsonSchemaNameOf(writer: string): string | undefined;
|
|
214
|
+
writeJsonSchemaWriter(root: BaseRoot, write: () => unknown, values: unknown[], parts: DataParts): string;
|
|
215
|
+
get jsonSchemaParts(): DataPartWriter;
|
|
216
|
+
writeJsonSchema(root: BaseRoot, write: () => unknown, { isRead, values, parts }: {
|
|
217
|
+
isRead?: boolean;
|
|
218
|
+
values?: unknown[];
|
|
219
|
+
parts: DataParts;
|
|
220
|
+
}): string;
|
|
221
|
+
writeData(value: unknown, opts?: WriteDataOptions): string;
|
|
222
|
+
emitRootApply(root: BaseRoot, opts: RootApplyOptions): [rootApply: string | RootApplier, allows: string, isCompact: boolean];
|
|
223
|
+
emitUndetailedApply(root: BaseRoot, ctx: string, { asValidator, readsAllows, unconfigured, pipes }: RootApplyOptions): [rootApply: string | RootApplier, allows: string, isCompact: boolean];
|
|
224
|
+
emitApplier({ readsAllows, ...applier }: Omit<RootApplier, "args"> & {
|
|
225
|
+
args?: string;
|
|
226
|
+
readsAllows?: boolean;
|
|
227
|
+
}): string;
|
|
228
|
+
appliedIndexOf(root: BaseRoot): number;
|
|
229
|
+
compactPartsOf(root: BaseRoot, indices: number[], asValidator: boolean): [flat?: string[] | undefined, traversals?: string | undefined];
|
|
230
|
+
flatTraversalsOf(root: BaseRoot, indices: number[]): string[] | undefined;
|
|
231
|
+
elementTraversalsOf(root: BaseRoot): string | undefined;
|
|
232
|
+
compactTraversalsOf(root: BaseRoot): string | undefined;
|
|
233
|
+
emitExpression(root: BaseRoot): string;
|
|
234
|
+
emitDescription(root: BaseRoot): string;
|
|
235
|
+
stringModuleOf(root: BaseRoot, kind: ComposedString): string;
|
|
236
|
+
writeStringModule(root: BaseRoot, kind: ComposedString, parts: (string | BaseRoot)[]): string;
|
|
237
|
+
emitString(s: string): string;
|
|
238
|
+
exportOf(value: unknown): string;
|
|
239
|
+
withHoles(value: Foldable, expression: string): string;
|
|
240
|
+
isComparedId(id: string): boolean;
|
|
241
|
+
readValidator(root: BaseRoot): string | undefined;
|
|
242
|
+
readByRuntime(root: BaseRoot): string | undefined;
|
|
243
|
+
declareConst(value: unknown, role: DeclarationRole, expression: string): string;
|
|
244
|
+
shapeOf(node: BaseRoot): string;
|
|
245
|
+
writeFilledShape(node: BaseRoot, shape: string, unit: RootUnit, traversals: string[]): string;
|
|
246
|
+
writeShapeFlags(node: BaseRoot, unit: RootUnit): string;
|
|
247
|
+
writeShape(node: BaseRoot, shape: string, unit: RootUnit, traversals: string[]): string;
|
|
248
|
+
emitRef(value: unknown): string;
|
|
249
|
+
emitAll(values: readonly unknown[]): string;
|
|
250
|
+
emit(value: unknown): string;
|
|
251
|
+
readMeta(meta: object): string | undefined;
|
|
252
|
+
writeSharedLiteral(value: unknown): string | undefined;
|
|
253
|
+
emitDefault(morph: unknown, key: PropertyKey, value: BaseRoot, defaultValue: unknown): string;
|
|
254
|
+
readSharedDefault(key: PropertyKey, value: BaseRoot, defaultValue: unknown): string;
|
|
255
|
+
readSharedValue(prefix: string, write: () => string): string;
|
|
256
|
+
emitWriters(writers: readonly Writer[]): string;
|
|
257
|
+
emitRaisingTraversal(ctx: "Traversal" | "FirstIssueTraversal"): string;
|
|
258
|
+
emitSite(site: object): string;
|
|
259
|
+
emitLiteral(value: object): string;
|
|
260
|
+
writeLiteral(value: object, emitElement?: (element: unknown) => string): [literal: string, elements: string[]];
|
|
261
|
+
emitElement(value: unknown): string;
|
|
262
|
+
}
|
|
263
|
+
export declare const uncountedJsonOf: (json: unknown) => unknown;
|
|
264
|
+
type CheckedHole = [hole: unknown, kind: HoleKind, expression: string];
|
|
265
|
+
export {};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { type BaseRoot, type BaseScope, type ErrorDetail, type GenericRoot, type MutatesInput } from "@ark/schema";
|
|
2
|
+
import type { TypedFn } from "../fn.ts";
|
|
3
|
+
import type { Generic } from "../generic.ts";
|
|
4
|
+
import type { type } from "../keywords/keywords.ts";
|
|
5
|
+
import type { Module } from "../module.ts";
|
|
6
|
+
import type { HoleKind, IntrospectionMember } from "../runtime.ts";
|
|
7
|
+
import type { Scope } from "../scope.ts";
|
|
8
|
+
import type { SharedModule } from "./modules.ts";
|
|
9
|
+
import { type HoleCells } from "./values.ts";
|
|
10
|
+
export type ExportedValue = type.Any | Module | Scope<any> | Generic | TypedFn;
|
|
11
|
+
export type Foldable = BaseRoot | ExportedValue | BaseScope | GenericRoot;
|
|
12
|
+
export type StandaloneExport = ExportedValue | StandaloneFactory | StandaloneIntrospection | StandaloneBake;
|
|
13
|
+
export declare const introspectionMembers: readonly ["expression", "description", "json", "toJSON", "toJsonSchema", "~standard.jsonSchema"];
|
|
14
|
+
export type FoldedMember = Exclude<IntrospectionMember, "~standard.jsonSchema">;
|
|
15
|
+
export declare const defaultMembers: readonly ["assert", "meta", "~standard", "methods"];
|
|
16
|
+
export type ValidatorMember = (typeof defaultMembers)[number] | IntrospectionMember;
|
|
17
|
+
export type ValidatorMembers = {
|
|
18
|
+
[member in ValidatorMember]?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export interface StandaloneIntrospection {
|
|
21
|
+
member: FoldedMember;
|
|
22
|
+
type: BaseRoot;
|
|
23
|
+
data: unknown;
|
|
24
|
+
params: FactoryParam[];
|
|
25
|
+
defaultChecks?: readonly DefaultCheck[];
|
|
26
|
+
thrown?: unknown;
|
|
27
|
+
}
|
|
28
|
+
export interface StandaloneBake extends BakedMembers {
|
|
29
|
+
bakes: BaseRoot | BakedNamespace;
|
|
30
|
+
}
|
|
31
|
+
export interface BakedNamespace {
|
|
32
|
+
[name: string]: BaseRoot | BakedNamespace;
|
|
33
|
+
}
|
|
34
|
+
export declare const bakedRootsOf: (bakes: BaseRoot | BakedNamespace) => BaseRoot[];
|
|
35
|
+
export interface StandaloneFactory {
|
|
36
|
+
type: ExportedValue;
|
|
37
|
+
params: FactoryParam[];
|
|
38
|
+
internedBy?: number | undefined;
|
|
39
|
+
defaultChecks?: readonly DefaultCheck[];
|
|
40
|
+
}
|
|
41
|
+
export type FactoryParam = HoleParam | InputParam | HelperParam | ProgressParam;
|
|
42
|
+
export type DefaultCheck = [
|
|
43
|
+
node: BaseRoot,
|
|
44
|
+
value: unknown,
|
|
45
|
+
key: PropertyKey | null
|
|
46
|
+
];
|
|
47
|
+
export interface HoleParam {
|
|
48
|
+
kind: HoleKind;
|
|
49
|
+
label: string;
|
|
50
|
+
value: unknown;
|
|
51
|
+
isOwn?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface InputParam {
|
|
54
|
+
kind: "input";
|
|
55
|
+
label: string;
|
|
56
|
+
reads: [path: PropertyKey[], value: unknown][];
|
|
57
|
+
mayBeUnset?: boolean;
|
|
58
|
+
isWritable?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface HelperParam {
|
|
61
|
+
kind: "helper";
|
|
62
|
+
label: string;
|
|
63
|
+
file: string;
|
|
64
|
+
name: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ProgressParam {
|
|
67
|
+
kind: "progress";
|
|
68
|
+
label: string;
|
|
69
|
+
at: number;
|
|
70
|
+
}
|
|
71
|
+
export type Configured = ConfiguredModule | false | undefined;
|
|
72
|
+
export type Checks = "types" | "helpers" | "none";
|
|
73
|
+
export type Optimization = "speed" | "size";
|
|
74
|
+
export interface ConfiguredModule {
|
|
75
|
+
fingerprint: string;
|
|
76
|
+
path: string;
|
|
77
|
+
config: string;
|
|
78
|
+
}
|
|
79
|
+
export interface StandaloneOptions {
|
|
80
|
+
configured?: Configured;
|
|
81
|
+
members?: ValidatorMembers | undefined;
|
|
82
|
+
bake?: (<t>(write: () => t) => t) | undefined;
|
|
83
|
+
errors?: ErrorDetail | undefined;
|
|
84
|
+
freeze?: boolean | undefined;
|
|
85
|
+
lazy?: boolean | undefined;
|
|
86
|
+
checks?: Checks | undefined;
|
|
87
|
+
holdsIds?: boolean | undefined;
|
|
88
|
+
mutatesInput?: MutatesInput | undefined;
|
|
89
|
+
optimize?: Optimization | undefined;
|
|
90
|
+
strategy?: string | undefined;
|
|
91
|
+
jsonInput?: boolean | undefined;
|
|
92
|
+
hoisted?: boolean | undefined;
|
|
93
|
+
values?: boolean | undefined;
|
|
94
|
+
readOnLoad?: readonly string[] | undefined;
|
|
95
|
+
defers?: boolean | undefined;
|
|
96
|
+
combines?: boolean | undefined;
|
|
97
|
+
shapes?: boolean | undefined;
|
|
98
|
+
called?: boolean | undefined;
|
|
99
|
+
defersIssues?: boolean | undefined;
|
|
100
|
+
/** @internal the chars a site's baked introspection may total */
|
|
101
|
+
bakedLimit?: number | undefined;
|
|
102
|
+
readsAllows?: boolean | undefined;
|
|
103
|
+
piped?: boolean | undefined;
|
|
104
|
+
cells?: HoleCells | undefined;
|
|
105
|
+
sharedWrites?: SharedWrites | undefined;
|
|
106
|
+
baked?: Record<string, BakedMembers> | undefined;
|
|
107
|
+
interned?: ReadonlyMap<unknown, string> | undefined;
|
|
108
|
+
scopeNameOf?: ((scope: BaseScope) => string | undefined) | undefined;
|
|
109
|
+
}
|
|
110
|
+
export interface BakedMembers {
|
|
111
|
+
members: readonly IntrospectionMember[];
|
|
112
|
+
lost: boolean;
|
|
113
|
+
}
|
|
114
|
+
export type SharedWrite = [specifier: string, module: SharedModule][];
|
|
115
|
+
export type SharedWrites = Map<string, Map<string, SharedWrite>>;
|
|
116
|
+
export interface ValidatorReads {
|
|
117
|
+
called: boolean;
|
|
118
|
+
readsAllows: boolean;
|
|
119
|
+
piped: boolean;
|
|
120
|
+
}
|
|
121
|
+
export declare const wholeReads: ValidatorReads;
|
|
122
|
+
export interface Baking extends ValidatorReads {
|
|
123
|
+
members: ReadonlySet<ValidatorMember>;
|
|
124
|
+
bakedByRoot: ReadonlyMap<unknown, BakedMembers>;
|
|
125
|
+
write: <t>(write: () => t) => t;
|
|
126
|
+
firstIssue: boolean;
|
|
127
|
+
detailsErrors: boolean;
|
|
128
|
+
freezes: boolean;
|
|
129
|
+
readsConfig: boolean;
|
|
130
|
+
createsLazily: boolean;
|
|
131
|
+
compilesValidators: boolean;
|
|
132
|
+
checksTypes: boolean;
|
|
133
|
+
holdsIds: boolean;
|
|
134
|
+
mutatesInput: MutatesInput | undefined;
|
|
135
|
+
jsonInput: boolean;
|
|
136
|
+
hoisted: boolean;
|
|
137
|
+
shortest: boolean;
|
|
138
|
+
strategy: string;
|
|
139
|
+
defers: boolean;
|
|
140
|
+
flattens: boolean;
|
|
141
|
+
combines: boolean;
|
|
142
|
+
shapes: boolean;
|
|
143
|
+
compiledInputs: ReadonlySet<string>;
|
|
144
|
+
defersIssues: boolean;
|
|
145
|
+
bakedLimit: number;
|
|
146
|
+
issues: IssueFeatures;
|
|
147
|
+
sharedWrites: SharedWrites;
|
|
148
|
+
cells: HoleCells | undefined;
|
|
149
|
+
interned: ReadonlyMap<unknown, string> | undefined;
|
|
150
|
+
scopeNameOf: ((scope: BaseScope) => string | undefined) | undefined;
|
|
151
|
+
}
|
|
152
|
+
export declare const writeFunction: (baking: Baking, name: string, params: string, body: string, isCalledOnLoad?: boolean) => string;
|
|
153
|
+
export declare const holdsOnlyMeta: (members: ReadonlySet<ValidatorMember>) => boolean;
|
|
154
|
+
export declare const isCreatedByRuntime: (members: ReadonlySet<ValidatorMember>, baking: Baking) => boolean;
|
|
155
|
+
export declare const writeLazyRead: (name: string, initial: string) => string;
|
|
156
|
+
export declare const internsByHolder: (baking: Baking) => boolean;
|
|
157
|
+
export declare const writeValue: (hoisted: boolean, name: string, expression: string, isPure?: boolean) => string;
|
|
158
|
+
export declare const invalidErrorsOf: (defersIssues: boolean) => string;
|
|
159
|
+
export declare const appliedSignature = "(data, onFail) => ";
|
|
160
|
+
export declare const failureSources: {
|
|
161
|
+
readonly invalid: readonly ["data, onFail", (created: string) => string];
|
|
162
|
+
readonly invalidCall: readonly ["data, args, onFail", (created: string) => string];
|
|
163
|
+
readonly applyInvalid: readonly ["data, ctx", `\tctx.addError({ code: "predicate", path: ctx.path.slice(), data })`];
|
|
164
|
+
readonly applyBy: readonly ["allows", `\treturn (data, ctx) => {
|
|
165
|
+
\t\tconst depth = ctx.path.length
|
|
166
|
+
\t\tif (allows(data, ctx)) return
|
|
167
|
+
\t\tctx.path.length = depth
|
|
168
|
+
\t\tctx.addError({ code: "predicate", path: ctx.path.slice(), data })
|
|
169
|
+
\t}`];
|
|
170
|
+
};
|
|
171
|
+
/** what the issues of a program's validators may hold */
|
|
172
|
+
export interface IssueFeatures {
|
|
173
|
+
reportsIndices: boolean;
|
|
174
|
+
bracketsKeys: boolean;
|
|
175
|
+
writesText: boolean;
|
|
176
|
+
callsSiteText: boolean;
|
|
177
|
+
listsUnions: boolean;
|
|
178
|
+
rewritesUnions: boolean;
|
|
179
|
+
traversesUnions: boolean;
|
|
180
|
+
appliesValues: boolean;
|
|
181
|
+
transformsBranches: boolean;
|
|
182
|
+
failsInBranches: boolean;
|
|
183
|
+
discriminatesBooleans: boolean;
|
|
184
|
+
readsSummary: boolean;
|
|
185
|
+
readsErrors: boolean;
|
|
186
|
+
holdsExpression: boolean;
|
|
187
|
+
namesTraversalError: boolean;
|
|
188
|
+
findsOnRead: boolean;
|
|
189
|
+
}
|
|
190
|
+
export declare const noIssueFeatures: IssueFeatures;
|
|
191
|
+
export interface StandaloneModules {
|
|
192
|
+
code: string;
|
|
193
|
+
modules: Record<string, string>;
|
|
194
|
+
folds: Record<string, [name: string, index: number]>;
|
|
195
|
+
checking: string[];
|
|
196
|
+
values: string[];
|
|
197
|
+
calls: Record<string, string[]>;
|
|
198
|
+
issues: IssueFeatures;
|
|
199
|
+
}
|
|
200
|
+
export declare const bakingOf: (exports: Record<string, StandaloneExport>, opts: StandaloneOptions, isModular: boolean) => Baking;
|
|
201
|
+
export declare const writeFixConfig: (configured: Configured) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type BaseNode, type NodeCompiler, type NodeId } from "@ark/schema";
|
|
2
|
+
export declare const combines: (node: BaseNode) => boolean;
|
|
3
|
+
export interface CombinatorCompiler extends NodeCompiler {
|
|
4
|
+
readonly link: {
|
|
5
|
+
byId: Record<NodeId, BaseNode>;
|
|
6
|
+
};
|
|
7
|
+
readonly shapes: boolean;
|
|
8
|
+
refToId(id: NodeId, opts?: {
|
|
9
|
+
kind: "Allows" | "Apply";
|
|
10
|
+
}): string;
|
|
11
|
+
}
|
|
12
|
+
/** a node's checker, if it combines */
|
|
13
|
+
export declare const writeCombinator: (js: CombinatorCompiler, node: BaseNode) => string | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type BaseNode, type BaseRoot, type nodeOfKind, type RootUnit, type UnionNode } from "@ark/schema";
|
|
2
|
+
import { type IssueContext } from "./sites.ts";
|
|
3
|
+
import { runtimeKeyOf } from "./values.ts";
|
|
4
|
+
export declare const discriminantContextOf: (node: UnionNode) => IssueContext;
|
|
5
|
+
export declare const listsBranches: (node: UnionNode) => boolean;
|
|
6
|
+
export declare const listedIssueOf: (node: UnionNode) => string;
|
|
7
|
+
export interface Bases {
|
|
8
|
+
nodes: nodeOfKind<"domain" | "proto" | "unit">[];
|
|
9
|
+
site: object;
|
|
10
|
+
}
|
|
11
|
+
export declare const basesOf: (node: UnionNode) => Bases | undefined;
|
|
12
|
+
export declare const refNameOf: (unit: string, i: number) => string;
|
|
13
|
+
export declare const unifies: (node: BaseNode) => boolean;
|
|
14
|
+
export declare const assertReportsIssues: (units: readonly RootUnit[]) => void;
|
|
15
|
+
export declare const compiledForSize: number;
|
|
16
|
+
export declare const shapedForSize: number;
|
|
17
|
+
export declare const jsonVariantOf: (variant: number) => number;
|
|
18
|
+
type UnitKeyOf = typeof runtimeKeyOf;
|
|
19
|
+
export declare const rootUnitsOf: (root: BaseRoot, variant?: number, keyOf?: UnitKeyOf) => RootUnit[];
|
|
20
|
+
export declare const isChecker: (root: BaseRoot, variant: number) => boolean;
|
|
21
|
+
export declare const isCheckerIn: (unit: RootUnit, root: BaseRoot) => boolean;
|
|
22
|
+
export declare const unitOf: (node: BaseNode, reader: RootUnit) => RootUnit;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Baking, type failureSources, type ValidatorMember, type ValidatorReads } from "./baking.ts";
|
|
2
|
+
import type { IntrospectionMember } from "../runtime.ts";
|
|
3
|
+
/** a root apply a creator is passed, with the params it's declared by */
|
|
4
|
+
export interface RootApplier {
|
|
5
|
+
params: string;
|
|
6
|
+
apply: string;
|
|
7
|
+
args: string;
|
|
8
|
+
failure?: keyof typeof failureSources;
|
|
9
|
+
local?: boolean;
|
|
10
|
+
bound?: string;
|
|
11
|
+
ownsCalls?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** how a validator is written: what's read of it, and what it's created from */
|
|
14
|
+
export interface ValidatorForm {
|
|
15
|
+
members: ReadonlySet<ValidatorMember>;
|
|
16
|
+
reads: ValidatorReads;
|
|
17
|
+
isTemplate: boolean;
|
|
18
|
+
ownsValidator: boolean;
|
|
19
|
+
unconfigured: boolean;
|
|
20
|
+
pipes: boolean;
|
|
21
|
+
byRuntime: boolean;
|
|
22
|
+
bakedAfter?: ReadonlySet<IntrospectionMember> | undefined;
|
|
23
|
+
}
|
|
24
|
+
/** what a validator is created with besides its root apply */
|
|
25
|
+
export interface ValidatorAttributes {
|
|
26
|
+
id: string;
|
|
27
|
+
held: string | undefined;
|
|
28
|
+
meta: string | undefined;
|
|
29
|
+
attributes: string[];
|
|
30
|
+
onFail: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare const fusedApplierOf: (baking: Baking, form: ValidatorForm, applied: string | RootApplier) => RootApplier | undefined;
|
|
33
|
+
export declare const madeApplierOf: (form: ValidatorForm, applied: string | RootApplier, allows: string) => RootApplier | undefined;
|
|
34
|
+
export declare const boundApplierOf: (applier: RootApplier, readsAllows: boolean) => RootApplier | undefined;
|
|
35
|
+
export declare const writtenAttributesOf: (writesId: boolean, form: ValidatorForm, attributes: string[], meta: string | undefined, onFail: string | undefined) => string[];
|
|
36
|
+
export declare const canPipe: (baking: Baking, members: ReadonlySet<ValidatorMember>, unconfigured: boolean) => boolean;
|
|
37
|
+
export declare const preciseFormOf: (baking: Baking, members: ReadonlySet<ValidatorMember>, unconfigured: boolean, reads: ValidatorReads) => "object" | "apply" | undefined;
|
|
38
|
+
export declare const frozen: (baking: Baking, expression: string) => string;
|
|
39
|
+
export type CreatedFrom = "parts" | "node";
|
|
40
|
+
/** the params and body of the function creating a validator from its root apply */
|
|
41
|
+
export declare const creatorSourceOf: (baking: Baking, form: ValidatorForm, applier: RootApplier | undefined, makes: CreatedFrom | undefined) => [params: string, body: string];
|