@morlay/session-rdb 0.0.16 → 0.0.17
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 +44 -10
- package/dist/artifact.d.mts +9 -2
- package/dist/artifact.mjs +3 -3
- package/dist/{import-BPEHfHNk.mjs → import-DZIAjOUr.mjs} +2 -1
- package/dist/import.d.mts +1 -1
- package/dist/import.mjs +1 -1
- package/dist/{index-CgAqCQAb.d.mts → index-BEKoV1Uy.d.mts} +11 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +509 -6
- package/dist/{log-BIuXv09P.mjs → log-DO69NQnn.mjs} +16 -1
- package/dist/schema-Bo6Hy5gW.d.mts +3476 -0
- package/dist/{sqlite-IH5I48aL.mjs → sqlite-BIPdMNQb.mjs} +504 -6
- package/dist/storage.d.mts +10 -2
- package/dist/storage.mjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +1 -1
- package/drizzle/postgres/20260910120001_v3_storage_tables/migration.sql +65 -0
- package/drizzle/postgres/20260910120001_v3_storage_tables/snapshot.json +1236 -0
- package/drizzle/postgres/20260910130001_v3_session_title_backfill/migration.sql +10 -0
- package/drizzle/postgres/20260910130001_v3_session_title_backfill/snapshot.json +1236 -0
- package/drizzle/sqlite/20260910120000_v3_storage_tables/migration.sql +66 -0
- package/drizzle/sqlite/20260910120000_v3_storage_tables/snapshot.json +958 -0
- package/drizzle/sqlite/20260910130000_v3_session_title_backfill/migration.sql +13 -0
- package/drizzle/sqlite/20260910130000_v3_session_title_backfill/snapshot.json +958 -0
- package/package.json +6 -4
- package/src/backend.ts +7 -0
- package/src/branch.ts +2 -0
- package/src/drizzle/postgres-v3.ts +5 -0
- package/src/drizzle/sqlite-v3.ts +5 -0
- package/src/entities/v3/index.ts +20 -0
- package/src/entities/v3/session-projcache-rows.ts +27 -0
- package/src/entities/v3/sessions.ts +6 -0
- package/src/entities/v3/storage-units.ts +10 -0
- package/src/entities/v3/workspace-sessions.ts +24 -0
- package/src/entities/v3/workspace-state.ts +18 -0
- package/src/entities/v3/workspaces.ts +19 -0
- package/src/import-storages.ts +173 -0
- package/src/index.ts +53 -0
- package/src/log.ts +19 -0
- package/src/postgres.ts +70 -2
- package/src/schema.ts +16 -2
- package/src/sqlite.ts +87 -4
- package/src/storage-takeover/index.ts +60 -0
- package/src/storage-takeover/projection-cache.ts +445 -0
- package/src/storage-takeover/repository.ts +420 -0
- package/src/storage-takeover/storage-backend.ts +177 -0
- package/src/storage-takeover/types.ts +82 -0
- package/dist/schema-COK7-wRV.d.mts +0 -104
|
@@ -0,0 +1,3476 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { SessionStorageMetadata } from "@deepseek-ai/dsh-session-persistence";
|
|
3
|
+
import { Session, SessionEvent, SessionHeader, SessionId, SessionLogOffset, SessionSeq, SessionSeqCursor } from "@deepseek-ai/dsh-session";
|
|
4
|
+
import { KvUnit } from "@deepseek-ai/dsh-storage";
|
|
5
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
6
|
+
import { SessionId as SessionId$1 } from "@deepseek-ai/dsh-session/types";
|
|
7
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/json-schema.d.cts
|
|
8
|
+
type _JSONSchema = boolean | JSONSchema;
|
|
9
|
+
type SchemaType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
10
|
+
type JSONSchema = {
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
13
|
+
$id?: string;
|
|
14
|
+
$anchor?: string;
|
|
15
|
+
$ref?: string;
|
|
16
|
+
$dynamicRef?: string;
|
|
17
|
+
$dynamicAnchor?: string;
|
|
18
|
+
$vocabulary?: Record<string, boolean>;
|
|
19
|
+
$comment?: string;
|
|
20
|
+
$defs?: Record<string, JSONSchema>;
|
|
21
|
+
type?: SchemaType | SchemaType[];
|
|
22
|
+
additionalItems?: _JSONSchema;
|
|
23
|
+
unevaluatedItems?: _JSONSchema;
|
|
24
|
+
prefixItems?: _JSONSchema[];
|
|
25
|
+
items?: _JSONSchema | _JSONSchema[];
|
|
26
|
+
contains?: _JSONSchema;
|
|
27
|
+
additionalProperties?: _JSONSchema;
|
|
28
|
+
unevaluatedProperties?: _JSONSchema;
|
|
29
|
+
properties?: Record<string, _JSONSchema>;
|
|
30
|
+
patternProperties?: Record<string, _JSONSchema>;
|
|
31
|
+
dependentSchemas?: Record<string, _JSONSchema>;
|
|
32
|
+
propertyNames?: _JSONSchema;
|
|
33
|
+
if?: _JSONSchema;
|
|
34
|
+
then?: _JSONSchema;
|
|
35
|
+
else?: _JSONSchema;
|
|
36
|
+
allOf?: JSONSchema[];
|
|
37
|
+
anyOf?: JSONSchema[];
|
|
38
|
+
oneOf?: JSONSchema[];
|
|
39
|
+
not?: _JSONSchema;
|
|
40
|
+
multipleOf?: number;
|
|
41
|
+
maximum?: number;
|
|
42
|
+
exclusiveMaximum?: number | boolean;
|
|
43
|
+
minimum?: number;
|
|
44
|
+
exclusiveMinimum?: number | boolean;
|
|
45
|
+
maxLength?: number;
|
|
46
|
+
minLength?: number;
|
|
47
|
+
pattern?: string;
|
|
48
|
+
maxItems?: number;
|
|
49
|
+
minItems?: number;
|
|
50
|
+
uniqueItems?: boolean;
|
|
51
|
+
maxContains?: number;
|
|
52
|
+
minContains?: number;
|
|
53
|
+
maxProperties?: number;
|
|
54
|
+
minProperties?: number;
|
|
55
|
+
required?: string[];
|
|
56
|
+
dependentRequired?: Record<string, string[]>;
|
|
57
|
+
enum?: Array<string | number | boolean | null>;
|
|
58
|
+
const?: string | number | boolean | null;
|
|
59
|
+
id?: string;
|
|
60
|
+
title?: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
default?: unknown;
|
|
63
|
+
deprecated?: boolean;
|
|
64
|
+
readOnly?: boolean;
|
|
65
|
+
writeOnly?: boolean;
|
|
66
|
+
nullable?: boolean;
|
|
67
|
+
examples?: unknown[];
|
|
68
|
+
format?: string;
|
|
69
|
+
contentMediaType?: string;
|
|
70
|
+
contentEncoding?: string;
|
|
71
|
+
contentSchema?: JSONSchema;
|
|
72
|
+
_prefault?: unknown;
|
|
73
|
+
};
|
|
74
|
+
type BaseSchema = JSONSchema;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/standard-schema.d.cts
|
|
77
|
+
/** The Standard interface. */
|
|
78
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
79
|
+
/** The Standard properties. */
|
|
80
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
81
|
+
}
|
|
82
|
+
declare namespace StandardTypedV1 {
|
|
83
|
+
/** The Standard properties interface. */
|
|
84
|
+
interface Props<Input = unknown, Output = Input> {
|
|
85
|
+
/** The version number of the standard. */
|
|
86
|
+
readonly version: 1;
|
|
87
|
+
/** The vendor name of the schema library. */
|
|
88
|
+
readonly vendor: string;
|
|
89
|
+
/** Inferred types associated with the schema. */
|
|
90
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
91
|
+
}
|
|
92
|
+
/** The Standard types interface. */
|
|
93
|
+
interface Types<Input = unknown, Output = Input> {
|
|
94
|
+
/** The input type of the schema. */
|
|
95
|
+
readonly input: Input;
|
|
96
|
+
/** The output type of the schema. */
|
|
97
|
+
readonly output: Output;
|
|
98
|
+
}
|
|
99
|
+
/** Infers the input type of a Standard. */
|
|
100
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
101
|
+
/** Infers the output type of a Standard. */
|
|
102
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
103
|
+
}
|
|
104
|
+
/** The Standard Schema interface. */
|
|
105
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
106
|
+
/** The Standard Schema properties. */
|
|
107
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
108
|
+
}
|
|
109
|
+
declare namespace StandardSchemaV1 {
|
|
110
|
+
/** The Standard Schema properties interface. */
|
|
111
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
112
|
+
/** Validates unknown input values. */
|
|
113
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
114
|
+
}
|
|
115
|
+
/** The result interface of the validate function. */
|
|
116
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
117
|
+
/** The result interface if validation succeeds. */
|
|
118
|
+
interface SuccessResult<Output> {
|
|
119
|
+
/** The typed output value. */
|
|
120
|
+
readonly value: Output;
|
|
121
|
+
/** The absence of issues indicates success. */
|
|
122
|
+
readonly issues?: undefined;
|
|
123
|
+
}
|
|
124
|
+
interface Options {
|
|
125
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
126
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
127
|
+
}
|
|
128
|
+
/** The result interface if validation fails. */
|
|
129
|
+
interface FailureResult {
|
|
130
|
+
/** The issues of failed validation. */
|
|
131
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
132
|
+
}
|
|
133
|
+
/** The issue interface of the failure output. */
|
|
134
|
+
interface Issue {
|
|
135
|
+
/** The error message of the issue. */
|
|
136
|
+
readonly message: string;
|
|
137
|
+
/** The path of the issue, if any. */
|
|
138
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
139
|
+
}
|
|
140
|
+
/** The path segment interface of the issue. */
|
|
141
|
+
interface PathSegment {
|
|
142
|
+
/** The key representing a path segment. */
|
|
143
|
+
readonly key: PropertyKey;
|
|
144
|
+
}
|
|
145
|
+
/** The Standard types interface. */
|
|
146
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
147
|
+
/** Infers the input type of a Standard. */
|
|
148
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
149
|
+
/** Infers the output type of a Standard. */
|
|
150
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
151
|
+
}
|
|
152
|
+
/** The Standard JSON Schema interface. */
|
|
153
|
+
interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
154
|
+
/** The Standard JSON Schema properties. */
|
|
155
|
+
readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
|
|
156
|
+
}
|
|
157
|
+
declare namespace StandardJSONSchemaV1 {
|
|
158
|
+
/** The Standard JSON Schema properties interface. */
|
|
159
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
160
|
+
/** Methods for generating the input/output JSON Schema. */
|
|
161
|
+
readonly jsonSchema: Converter;
|
|
162
|
+
}
|
|
163
|
+
/** The Standard JSON Schema converter interface. */
|
|
164
|
+
interface Converter {
|
|
165
|
+
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
166
|
+
readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
167
|
+
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
168
|
+
readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
169
|
+
}
|
|
170
|
+
/** The target version of the generated JSON Schema.
|
|
171
|
+
*
|
|
172
|
+
* It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use.
|
|
173
|
+
*
|
|
174
|
+
* The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
|
|
175
|
+
*
|
|
176
|
+
* All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
|
|
177
|
+
*/
|
|
178
|
+
type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
|
|
179
|
+
/** The options for the input/output methods. */
|
|
180
|
+
interface Options {
|
|
181
|
+
/** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
|
|
182
|
+
readonly target: Target;
|
|
183
|
+
/** Implicit support for additional vendor-specific parameters, if needed. */
|
|
184
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
185
|
+
}
|
|
186
|
+
/** The Standard types interface. */
|
|
187
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
188
|
+
/** Infers the input type of a Standard. */
|
|
189
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
190
|
+
/** Infers the output type of a Standard. */
|
|
191
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
192
|
+
}
|
|
193
|
+
interface StandardSchemaWithJSONProps<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {}
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/registries.d.cts
|
|
196
|
+
declare const $output: unique symbol;
|
|
197
|
+
type $output = typeof $output;
|
|
198
|
+
declare const $input: unique symbol;
|
|
199
|
+
type $input = typeof $input;
|
|
200
|
+
type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends ((...args: infer P) => infer R) ? (...args: { [K in keyof P]: $replace<P[K], S>; }) => $replace<R, S> : Meta extends object ? { [K in keyof Meta]: $replace<Meta[K], S>; } : Meta;
|
|
201
|
+
type MetadataType = object | undefined;
|
|
202
|
+
declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
|
|
203
|
+
_meta: Meta;
|
|
204
|
+
_schema: Schema;
|
|
205
|
+
_map: WeakMap<Schema, $replace<Meta, Schema>>;
|
|
206
|
+
_idmap: Map<string, Schema>;
|
|
207
|
+
add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;
|
|
208
|
+
clear(): this;
|
|
209
|
+
remove(schema: Schema): this;
|
|
210
|
+
get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;
|
|
211
|
+
has(schema: Schema): boolean;
|
|
212
|
+
}
|
|
213
|
+
interface JSONSchemaMeta {
|
|
214
|
+
id?: string | undefined;
|
|
215
|
+
title?: string | undefined;
|
|
216
|
+
description?: string | undefined;
|
|
217
|
+
deprecated?: boolean | undefined;
|
|
218
|
+
[k: string]: unknown;
|
|
219
|
+
}
|
|
220
|
+
interface GlobalMeta extends JSONSchemaMeta {}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/to-json-schema.d.cts
|
|
223
|
+
type Processor<T extends $ZodType = $ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void;
|
|
224
|
+
/**
|
|
225
|
+
* Called for each schema that has no JSON Schema equivalent. Return a JSON Schema to use in its
|
|
226
|
+
* place, `"any"` to fall back to the `unrepresentable: "any"` behavior, or `"throw"`/`undefined` to
|
|
227
|
+
* throw the default error. Throwing from the handler propagates, so custom errors work too.
|
|
228
|
+
*/
|
|
229
|
+
type UnrepresentableHandler<T extends $ZodType = $ZodType> = (ctx: {
|
|
230
|
+
zodSchema: T;
|
|
231
|
+
path: (string | number)[];
|
|
232
|
+
/** The error Zod would throw. Distinguishes sites that share a `zodSchema`, e.g. an `undefined`
|
|
233
|
+
* vs a `bigint` member of the same literal. */
|
|
234
|
+
message: string;
|
|
235
|
+
}) => BaseSchema | "throw" | "any" | undefined;
|
|
236
|
+
interface JSONSchemaGeneratorParams {
|
|
237
|
+
processors: Record<string, Processor>;
|
|
238
|
+
/** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
|
|
239
|
+
* @default globalRegistry */
|
|
240
|
+
metadata?: $ZodRegistry<Record<string, any>>;
|
|
241
|
+
/** The JSON Schema version to target.
|
|
242
|
+
* - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12
|
|
243
|
+
* - `"draft-07"` — JSON Schema Draft 7
|
|
244
|
+
* - `"draft-04"` — JSON Schema Draft 4
|
|
245
|
+
* - `"openapi-3.0"` — OpenAPI 3.0 Schema Object */
|
|
246
|
+
target?: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string) | undefined;
|
|
247
|
+
/** How to handle unrepresentable types.
|
|
248
|
+
* - `"throw"` — Default. Unrepresentable types throw an error
|
|
249
|
+
* - `"any"` — Unrepresentable types become `{}`
|
|
250
|
+
* - A function — called once per unrepresentable schema; see {@link UnrepresentableHandler}. */
|
|
251
|
+
unrepresentable?: "throw" | "any" | UnrepresentableHandler<$ZodTypes>;
|
|
252
|
+
/** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
|
|
253
|
+
override?: (ctx: {
|
|
254
|
+
zodSchema: $ZodTypes;
|
|
255
|
+
jsonSchema: BaseSchema;
|
|
256
|
+
path: (string | number)[];
|
|
257
|
+
}) => void;
|
|
258
|
+
/** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, defaults, coerced primitives, etc.
|
|
259
|
+
* - `"output"` — Default. Convert the output schema.
|
|
260
|
+
* - `"input"` — Convert the input schema. */
|
|
261
|
+
io?: "input" | "output";
|
|
262
|
+
cycles?: "ref" | "throw";
|
|
263
|
+
reused?: "ref" | "inline";
|
|
264
|
+
external?: {
|
|
265
|
+
registry: $ZodRegistry<{
|
|
266
|
+
id?: string | undefined;
|
|
267
|
+
}>;
|
|
268
|
+
uri?: ((id: string) => string) | undefined;
|
|
269
|
+
defs: Record<string, BaseSchema>;
|
|
270
|
+
} | undefined;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Parameters for the toJSONSchema function.
|
|
274
|
+
*/
|
|
275
|
+
type ToJSONSchemaParams = Omit<JSONSchemaGeneratorParams, "processors" | "external">;
|
|
276
|
+
interface ProcessParams {
|
|
277
|
+
schemaPath: $ZodType[];
|
|
278
|
+
path: (string | number)[];
|
|
279
|
+
}
|
|
280
|
+
interface Seen {
|
|
281
|
+
/** JSON Schema result for this Zod schema */
|
|
282
|
+
schema: BaseSchema;
|
|
283
|
+
/** A cached version of the schema that doesn't get overwritten during ref resolution */
|
|
284
|
+
def?: BaseSchema;
|
|
285
|
+
defId?: string | undefined;
|
|
286
|
+
/** Number of times this schema was encountered during traversal */
|
|
287
|
+
count: number;
|
|
288
|
+
/** Cycle path */
|
|
289
|
+
cycle?: (string | number)[] | undefined;
|
|
290
|
+
isParent?: boolean | undefined;
|
|
291
|
+
/** Schema to inherit JSON Schema properties from (set by processor for wrappers) */
|
|
292
|
+
ref?: $ZodType | null;
|
|
293
|
+
/** JSON Schema property path for this schema */
|
|
294
|
+
path?: (string | number)[] | undefined;
|
|
295
|
+
}
|
|
296
|
+
interface ToJSONSchemaContext {
|
|
297
|
+
processors: Record<string, Processor>;
|
|
298
|
+
metadataRegistry: $ZodRegistry<Record<string, any>>;
|
|
299
|
+
target: "draft-04" | "draft-07" | "draft-2020-12" | "openapi-3.0" | ({} & string);
|
|
300
|
+
unrepresentable: "throw" | "any" | UnrepresentableHandler;
|
|
301
|
+
override: (ctx: {
|
|
302
|
+
zodSchema: $ZodType;
|
|
303
|
+
jsonSchema: BaseSchema;
|
|
304
|
+
path: (string | number)[];
|
|
305
|
+
}) => void;
|
|
306
|
+
io: "input" | "output";
|
|
307
|
+
counter: number;
|
|
308
|
+
seen: Map<$ZodType, Seen>;
|
|
309
|
+
/** Registry conversions share one `seen` map across every emitted schema. These hold the
|
|
310
|
+
* `external` the whole-map passes below last ran for, so the passes are not repeated once per
|
|
311
|
+
* schema — and still re-run if the map grows or `external` is swapped. `sharedEmitDoneFor`
|
|
312
|
+
* covers both passes in `finalize`: the ref flattening and the `$defs` build.
|
|
313
|
+
*
|
|
314
|
+
* The passes are valid only while nothing they read has changed, so both are cleared in
|
|
315
|
+
* `processSchema()` when the map grows, and in `JSONSchemaGenerator.emit()`, which can also change
|
|
316
|
+
* the `cycles` and `reused` they branch on.
|
|
317
|
+
*
|
|
318
|
+
* One case is deliberately not covered: an `override` callback that writes to
|
|
319
|
+
* `metadataRegistry` mid-conversion. It runs inside `finalize`, so a registry conversion has
|
|
320
|
+
* nowhere left to clear the guards, and later schemas keep the ids the first pass saw. That
|
|
321
|
+
* output was never coherent — before this, whether a shared subschema was inlined or extracted
|
|
322
|
+
* depended on which registry entry happened to be emitted when the callback fired. */
|
|
323
|
+
sharedDefsExtractedFor?: ToJSONSchemaContext["external"];
|
|
324
|
+
sharedEmitDoneFor?: ToJSONSchemaContext["external"];
|
|
325
|
+
cycles: "ref" | "throw";
|
|
326
|
+
reused: "ref" | "inline";
|
|
327
|
+
/** The `allOf` array of each intersection encountered during traversal, innermost first. `finalize` folds every emitted object holding one; see `foldIntersection`. */
|
|
328
|
+
intersections: BaseSchema[][];
|
|
329
|
+
/** Rewrites a processor deferred to `finalize`, where the flatten has resolved every ref and the union branches are in place. */
|
|
330
|
+
deferred: (() => void)[];
|
|
331
|
+
external?: {
|
|
332
|
+
registry: $ZodRegistry<{
|
|
333
|
+
id?: string | undefined;
|
|
334
|
+
}>;
|
|
335
|
+
uri?: ((id: string) => string) | undefined;
|
|
336
|
+
defs: Record<string, BaseSchema>;
|
|
337
|
+
} | undefined;
|
|
338
|
+
}
|
|
339
|
+
type ZodStandardSchemaWithJSON$1<T> = StandardSchemaWithJSONProps<input<T>, output<T>>;
|
|
340
|
+
interface ZodStandardJSONSchemaPayload<T> extends BaseSchema {
|
|
341
|
+
"~standard": ZodStandardSchemaWithJSON$1<T>;
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/util.d.cts
|
|
345
|
+
type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
|
|
346
|
+
type MimeTypes = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "application/javascript" | "application/pdf" | "application/zip" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/octet-stream" | "application/graphql" | "text/html" | "text/plain" | "text/css" | "text/javascript" | "text/csv" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "video/mp4" | "video/webm" | "video/ogg" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf" | "multipart/form-data" | (string & {});
|
|
347
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
348
|
+
type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
349
|
+
type MakePartial<T, K extends keyof T> = Omit$1<T, K> & InexactPartial<Pick<T, K>>;
|
|
350
|
+
type NoUndefined<T> = T extends undefined ? never : T;
|
|
351
|
+
type Widen<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends bigint ? bigint : T;
|
|
352
|
+
type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
353
|
+
[k: string]: unknown;
|
|
354
|
+
};
|
|
355
|
+
type Mask<Keys extends PropertyKey> = { [K in Keys]?: true; };
|
|
356
|
+
type Writeable<T> = { -readonly [P in keyof T]: T[P]; } & {};
|
|
357
|
+
type InexactPartial<T> = { [P in keyof T]?: T[P] | undefined; };
|
|
358
|
+
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
359
|
+
readonly [Symbol.toStringTag]: string;
|
|
360
|
+
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
361
|
+
type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
362
|
+
type SomeObject = Record<PropertyKey, any>;
|
|
363
|
+
type Identity<T> = T;
|
|
364
|
+
type Flatten<T> = Identity<{ [k in keyof T]: T[k]; }>;
|
|
365
|
+
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
366
|
+
type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K]; } & { [K in keyof B]: B[K]; }>;
|
|
367
|
+
type TupleItems = ReadonlyArray<SomeType>;
|
|
368
|
+
type AnyFunc = (...args: any[]) => any;
|
|
369
|
+
type MaybeAsync<T> = T | Promise<T>;
|
|
370
|
+
type EnumValue = string | number;
|
|
371
|
+
type EnumLike = Readonly<Record<string, EnumValue>>;
|
|
372
|
+
type ToEnum<T extends EnumValue> = Flatten<{ [k in T]: k; }>;
|
|
373
|
+
type Literal = string | number | bigint | boolean | null | undefined;
|
|
374
|
+
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
375
|
+
type HasLength = {
|
|
376
|
+
length: number;
|
|
377
|
+
};
|
|
378
|
+
type Numeric = number | bigint | Date;
|
|
379
|
+
type PropValues = Record<string, Set<Primitive>>;
|
|
380
|
+
type PrimitiveSet = Set<Primitive>;
|
|
381
|
+
type EmptyToNever<T> = keyof T extends never ? never : T;
|
|
382
|
+
declare abstract class Class {
|
|
383
|
+
constructor(..._args: any[]);
|
|
384
|
+
}
|
|
385
|
+
/** A trait's prototype members: a partial view of its own interface, with `this` typed as the instance. */
|
|
386
|
+
type ProtoOf<T> = { [K in keyof T]?: (T[K] extends ((...args: infer A) => infer R) ? (...args: A) => R : T[K]) | undefined; } & ThisType<T>;
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/versions.d.cts
|
|
389
|
+
declare const version: {
|
|
390
|
+
readonly major: 4;
|
|
391
|
+
readonly minor: 6;
|
|
392
|
+
readonly patch: number;
|
|
393
|
+
};
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/schemas.d.cts
|
|
396
|
+
interface ParseContext<T extends $ZodIssueBase = never> {
|
|
397
|
+
/** Customize error messages. */
|
|
398
|
+
readonly error?: $ZodErrorMap<T>;
|
|
399
|
+
/** Include the `input` field in issue objects. Default `false`. */
|
|
400
|
+
readonly reportInput?: boolean;
|
|
401
|
+
/** Skip eval-based fast path. Default `false`. */
|
|
402
|
+
readonly jitless?: boolean;
|
|
403
|
+
}
|
|
404
|
+
/** @internal */
|
|
405
|
+
interface ParseContextInternal<T extends $ZodIssueBase = never> extends ParseContext<T> {
|
|
406
|
+
readonly async?: boolean | undefined;
|
|
407
|
+
readonly direction?: "forward" | "backward";
|
|
408
|
+
readonly skipChecks?: boolean;
|
|
409
|
+
/** Set only by `validate`/`validateAsync`. A container may stop before its next child, never inside one, so a map entry and a tuple's fixed items parse whole. */
|
|
410
|
+
readonly abortEarly?: boolean;
|
|
411
|
+
}
|
|
412
|
+
interface ParsePayload<T = unknown> {
|
|
413
|
+
value: T;
|
|
414
|
+
issues: $ZodRawIssue[];
|
|
415
|
+
/** A way to mark a whole payload as aborted. Used in codecs/pipes. */
|
|
416
|
+
aborted?: boolean;
|
|
417
|
+
/** @internal Set when the value came from a repeat visit to a node still being
|
|
418
|
+
* parsed. Its checks run on the node itself, against the finished value. */
|
|
419
|
+
memo?: boolean | undefined;
|
|
420
|
+
}
|
|
421
|
+
type CheckFn<T> = (input: ParsePayload<T>) => MaybeAsync<void>;
|
|
422
|
+
interface $ZodTypeDef {
|
|
423
|
+
type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom" | "properties";
|
|
424
|
+
error?: $ZodErrorMap<never> | undefined;
|
|
425
|
+
checks?: $ZodCheck<never>[];
|
|
426
|
+
}
|
|
427
|
+
interface _$ZodTypeInternals {
|
|
428
|
+
/** The `@zod/core` version of this schema */
|
|
429
|
+
version: typeof version;
|
|
430
|
+
/** Schema definition. */
|
|
431
|
+
def: $ZodTypeDef;
|
|
432
|
+
/** @internal Randomly generated ID for this schema. */
|
|
433
|
+
/** @internal List of deferred initializers. */
|
|
434
|
+
deferred: AnyFunc[] | undefined;
|
|
435
|
+
/** @internal Parses input and runs all checks (refinements). */
|
|
436
|
+
run(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
|
|
437
|
+
/** @internal Parses input, doesn't run checks. */
|
|
438
|
+
parse(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
|
|
439
|
+
/** @internal Stores identifiers for the set of traits implemented by this schema. */
|
|
440
|
+
traits: Set<string>;
|
|
441
|
+
/** @internal Indicates that a schema output type should be considered optional inside objects.
|
|
442
|
+
* @default Required
|
|
443
|
+
*/
|
|
444
|
+
/** @internal Three rungs, each strictly stronger than the last:
|
|
445
|
+
* undefined — required; the container may not omit this slot
|
|
446
|
+
* "optional" — the container may omit it; nothing is supplied in its place
|
|
447
|
+
* "defaulted" — the container may omit it AND this schema substitutes a value
|
|
448
|
+
* Consumers asking "may the slot be absent?" test `!== undefined`.
|
|
449
|
+
* $ZodOptional asks the stronger question and tests `=== "defaulted"`. */
|
|
450
|
+
optin?: "optional" | "defaulted" | undefined;
|
|
451
|
+
/** @internal */
|
|
452
|
+
optout?: "optional" | undefined;
|
|
453
|
+
/** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
|
|
454
|
+
*
|
|
455
|
+
* Defined on: enum, const, literal, null, undefined
|
|
456
|
+
* Passthrough: optional, nullable, branded, default, catch, pipe
|
|
457
|
+
* Todo: unions?
|
|
458
|
+
*/
|
|
459
|
+
values?: PrimitiveSet | undefined;
|
|
460
|
+
/** Default value bubbled up from */
|
|
461
|
+
/** @internal A set of literal discriminators used for the fast path in discriminated unions. */
|
|
462
|
+
propValues?: PropValues | undefined;
|
|
463
|
+
/** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
|
|
464
|
+
pattern: RegExp | undefined;
|
|
465
|
+
/** @internal The constructor function of this schema. */
|
|
466
|
+
constr: new (def: any) => $ZodType;
|
|
467
|
+
/** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
|
|
468
|
+
bag: Record<string, unknown>;
|
|
469
|
+
/** @internal The set of issues this schema might throw during type checking. */
|
|
470
|
+
isst: $ZodIssueBase;
|
|
471
|
+
/** @internal Subject to change, not a public API. */
|
|
472
|
+
processJSONSchema?: ((ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void) | undefined;
|
|
473
|
+
/** An optional method used to override `toJSONSchema` logic. */
|
|
474
|
+
toJSONSchema?: () => unknown;
|
|
475
|
+
/** @internal The parent of this schema. Only set during certain clone operations. */
|
|
476
|
+
parent?: $ZodType | undefined;
|
|
477
|
+
}
|
|
478
|
+
/** @internal */
|
|
479
|
+
interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
|
|
480
|
+
/** @internal The inferred output type */
|
|
481
|
+
output: O;
|
|
482
|
+
/** @internal The inferred input type */
|
|
483
|
+
input: I;
|
|
484
|
+
}
|
|
485
|
+
type $ZodStandardSchema<T> = StandardSchemaV1.Props<input<T>, output<T>>;
|
|
486
|
+
type SomeType = {
|
|
487
|
+
_zod: _$ZodTypeInternals;
|
|
488
|
+
};
|
|
489
|
+
interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>> {
|
|
490
|
+
_zod: Internals;
|
|
491
|
+
"~standard": $ZodStandardSchema<this>;
|
|
492
|
+
}
|
|
493
|
+
interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals> extends $ZodType<T["output"], T["input"], T> {}
|
|
494
|
+
declare const $ZodType: $constructor<$ZodType>;
|
|
495
|
+
interface $ZodStringDef extends $ZodTypeDef {
|
|
496
|
+
type: "string";
|
|
497
|
+
coerce?: boolean;
|
|
498
|
+
checks?: $ZodCheck<string>[];
|
|
499
|
+
}
|
|
500
|
+
interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {
|
|
501
|
+
def: $ZodStringDef;
|
|
502
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
503
|
+
pattern: RegExp;
|
|
504
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
505
|
+
isst: $ZodIssueInvalidType;
|
|
506
|
+
bag: LoosePartial<{
|
|
507
|
+
minimum: number;
|
|
508
|
+
maximum: number;
|
|
509
|
+
patterns: Set<RegExp>;
|
|
510
|
+
format: string;
|
|
511
|
+
contentEncoding: string;
|
|
512
|
+
/** the pattern admits strings its `format` keyword forbids, so `toJSONSchema` must not emit it */
|
|
513
|
+
laxFormat: boolean;
|
|
514
|
+
}>;
|
|
515
|
+
}
|
|
516
|
+
interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInternals<Input>> {}
|
|
517
|
+
declare const $ZodString: $constructor<$ZodString>;
|
|
518
|
+
interface $ZodStringFormatDef<Format extends string = string> extends $ZodStringDef, $ZodCheckStringFormatDef<Format> {}
|
|
519
|
+
interface $ZodStringFormatInternals<Format extends string = string> extends $ZodStringInternals<string>, $ZodCheckStringFormatInternals {
|
|
520
|
+
def: $ZodStringFormatDef<Format>;
|
|
521
|
+
}
|
|
522
|
+
interface $ZodStringFormat<Format extends string = string> extends $ZodType {
|
|
523
|
+
_zod: $ZodStringFormatInternals<Format>;
|
|
524
|
+
}
|
|
525
|
+
declare const $ZodStringFormat: $constructor<$ZodStringFormat>;
|
|
526
|
+
interface $ZodGUIDInternals extends $ZodStringFormatInternals<"guid"> {}
|
|
527
|
+
interface $ZodGUID extends $ZodType {
|
|
528
|
+
_zod: $ZodGUIDInternals;
|
|
529
|
+
}
|
|
530
|
+
declare const $ZodGUID: $constructor<$ZodGUID>;
|
|
531
|
+
interface $ZodUUIDDef extends $ZodStringFormatDef<"uuid"> {
|
|
532
|
+
version?: "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" | "v8";
|
|
533
|
+
}
|
|
534
|
+
interface $ZodUUIDInternals extends $ZodStringFormatInternals<"uuid"> {
|
|
535
|
+
def: $ZodUUIDDef;
|
|
536
|
+
}
|
|
537
|
+
interface $ZodUUID extends $ZodType {
|
|
538
|
+
_zod: $ZodUUIDInternals;
|
|
539
|
+
}
|
|
540
|
+
declare const $ZodUUID: $constructor<$ZodUUID>;
|
|
541
|
+
interface $ZodEmailInternals extends $ZodStringFormatInternals<"email"> {}
|
|
542
|
+
interface $ZodEmail extends $ZodType {
|
|
543
|
+
_zod: $ZodEmailInternals;
|
|
544
|
+
}
|
|
545
|
+
declare const $ZodEmail: $constructor<$ZodEmail>;
|
|
546
|
+
interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
|
|
547
|
+
hostname?: RegExp | undefined;
|
|
548
|
+
protocol?: RegExp | undefined;
|
|
549
|
+
normalize?: boolean | undefined;
|
|
550
|
+
}
|
|
551
|
+
interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
|
|
552
|
+
def: $ZodURLDef;
|
|
553
|
+
}
|
|
554
|
+
interface $ZodURL extends $ZodType {
|
|
555
|
+
_zod: $ZodURLInternals;
|
|
556
|
+
}
|
|
557
|
+
declare const $ZodURL: $constructor<$ZodURL>;
|
|
558
|
+
interface $ZodEmojiInternals extends $ZodStringFormatInternals<"emoji"> {}
|
|
559
|
+
interface $ZodEmoji extends $ZodType {
|
|
560
|
+
_zod: $ZodEmojiInternals;
|
|
561
|
+
}
|
|
562
|
+
declare const $ZodEmoji: $constructor<$ZodEmoji>;
|
|
563
|
+
interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {
|
|
564
|
+
length?: number | undefined;
|
|
565
|
+
}
|
|
566
|
+
interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {
|
|
567
|
+
def: $ZodNanoIDDef;
|
|
568
|
+
}
|
|
569
|
+
interface $ZodNanoID extends $ZodType {
|
|
570
|
+
_zod: $ZodNanoIDInternals;
|
|
571
|
+
}
|
|
572
|
+
declare const $ZodNanoID: $constructor<$ZodNanoID>;
|
|
573
|
+
/**
|
|
574
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
575
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
576
|
+
* See https://github.com/paralleldrive/cuid.
|
|
577
|
+
*/
|
|
578
|
+
interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {}
|
|
579
|
+
/**
|
|
580
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
581
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
582
|
+
* See https://github.com/paralleldrive/cuid.
|
|
583
|
+
*/
|
|
584
|
+
interface $ZodCUID extends $ZodType {
|
|
585
|
+
_zod: $ZodCUIDInternals;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
589
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
590
|
+
* See https://github.com/paralleldrive/cuid.
|
|
591
|
+
*/
|
|
592
|
+
declare const $ZodCUID: $constructor<$ZodCUID>;
|
|
593
|
+
interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {}
|
|
594
|
+
interface $ZodCUID2 extends $ZodType {
|
|
595
|
+
_zod: $ZodCUID2Internals;
|
|
596
|
+
}
|
|
597
|
+
declare const $ZodCUID2: $constructor<$ZodCUID2>;
|
|
598
|
+
interface $ZodULIDInternals extends $ZodStringFormatInternals<"ulid"> {}
|
|
599
|
+
interface $ZodULID extends $ZodType {
|
|
600
|
+
_zod: $ZodULIDInternals;
|
|
601
|
+
}
|
|
602
|
+
declare const $ZodULID: $constructor<$ZodULID>;
|
|
603
|
+
interface $ZodXIDInternals extends $ZodStringFormatInternals<"xid"> {}
|
|
604
|
+
interface $ZodXID extends $ZodType {
|
|
605
|
+
_zod: $ZodXIDInternals;
|
|
606
|
+
}
|
|
607
|
+
declare const $ZodXID: $constructor<$ZodXID>;
|
|
608
|
+
interface $ZodKSUIDInternals extends $ZodStringFormatInternals<"ksuid"> {}
|
|
609
|
+
interface $ZodKSUID extends $ZodType {
|
|
610
|
+
_zod: $ZodKSUIDInternals;
|
|
611
|
+
}
|
|
612
|
+
declare const $ZodKSUID: $constructor<$ZodKSUID>;
|
|
613
|
+
interface $ZodISODateTimeDef extends $ZodStringFormatDef<"datetime"> {
|
|
614
|
+
precision: number | null;
|
|
615
|
+
offset: boolean;
|
|
616
|
+
local: boolean;
|
|
617
|
+
}
|
|
618
|
+
interface $ZodISODateTimeInternals extends $ZodStringFormatInternals {
|
|
619
|
+
def: $ZodISODateTimeDef;
|
|
620
|
+
}
|
|
621
|
+
interface $ZodISODateTime extends $ZodType {
|
|
622
|
+
_zod: $ZodISODateTimeInternals;
|
|
623
|
+
}
|
|
624
|
+
declare const $ZodISODateTime: $constructor<$ZodISODateTime>;
|
|
625
|
+
interface $ZodISODateInternals extends $ZodStringFormatInternals<"date"> {}
|
|
626
|
+
interface $ZodISODate extends $ZodType {
|
|
627
|
+
_zod: $ZodISODateInternals;
|
|
628
|
+
}
|
|
629
|
+
declare const $ZodISODate: $constructor<$ZodISODate>;
|
|
630
|
+
interface $ZodISOTimeDef extends $ZodStringFormatDef<"time"> {
|
|
631
|
+
precision?: number | null;
|
|
632
|
+
}
|
|
633
|
+
interface $ZodISOTimeInternals extends $ZodStringFormatInternals<"time"> {
|
|
634
|
+
def: $ZodISOTimeDef;
|
|
635
|
+
}
|
|
636
|
+
interface $ZodISOTime extends $ZodType {
|
|
637
|
+
_zod: $ZodISOTimeInternals;
|
|
638
|
+
}
|
|
639
|
+
declare const $ZodISOTime: $constructor<$ZodISOTime>;
|
|
640
|
+
interface $ZodISODurationInternals extends $ZodStringFormatInternals<"duration"> {}
|
|
641
|
+
interface $ZodISODuration extends $ZodType {
|
|
642
|
+
_zod: $ZodISODurationInternals;
|
|
643
|
+
}
|
|
644
|
+
declare const $ZodISODuration: $constructor<$ZodISODuration>;
|
|
645
|
+
interface $ZodIPv4Def extends $ZodStringFormatDef<"ipv4"> {
|
|
646
|
+
version?: "v4";
|
|
647
|
+
}
|
|
648
|
+
interface $ZodIPv4Internals extends $ZodStringFormatInternals<"ipv4"> {
|
|
649
|
+
def: $ZodIPv4Def;
|
|
650
|
+
}
|
|
651
|
+
interface $ZodIPv4 extends $ZodType {
|
|
652
|
+
_zod: $ZodIPv4Internals;
|
|
653
|
+
}
|
|
654
|
+
declare const $ZodIPv4: $constructor<$ZodIPv4>;
|
|
655
|
+
interface $ZodIPv6Def extends $ZodStringFormatDef<"ipv6"> {
|
|
656
|
+
version?: "v6";
|
|
657
|
+
}
|
|
658
|
+
interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> {
|
|
659
|
+
def: $ZodIPv6Def;
|
|
660
|
+
}
|
|
661
|
+
interface $ZodIPv6 extends $ZodType {
|
|
662
|
+
_zod: $ZodIPv6Internals;
|
|
663
|
+
}
|
|
664
|
+
declare const $ZodIPv6: $constructor<$ZodIPv6>;
|
|
665
|
+
interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
|
|
666
|
+
version?: "v4";
|
|
667
|
+
}
|
|
668
|
+
interface $ZodCIDRv4Internals extends $ZodStringFormatInternals<"cidrv4"> {
|
|
669
|
+
def: $ZodCIDRv4Def;
|
|
670
|
+
}
|
|
671
|
+
interface $ZodCIDRv4 extends $ZodType {
|
|
672
|
+
_zod: $ZodCIDRv4Internals;
|
|
673
|
+
}
|
|
674
|
+
declare const $ZodCIDRv4: $constructor<$ZodCIDRv4>;
|
|
675
|
+
interface $ZodCIDRv6Def extends $ZodStringFormatDef<"cidrv6"> {
|
|
676
|
+
version?: "v6";
|
|
677
|
+
}
|
|
678
|
+
interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6"> {
|
|
679
|
+
def: $ZodCIDRv6Def;
|
|
680
|
+
}
|
|
681
|
+
interface $ZodCIDRv6 extends $ZodType {
|
|
682
|
+
_zod: $ZodCIDRv6Internals;
|
|
683
|
+
}
|
|
684
|
+
declare const $ZodCIDRv6: $constructor<$ZodCIDRv6>;
|
|
685
|
+
interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64"> {}
|
|
686
|
+
interface $ZodBase64 extends $ZodType {
|
|
687
|
+
_zod: $ZodBase64Internals;
|
|
688
|
+
}
|
|
689
|
+
declare const $ZodBase64: $constructor<$ZodBase64>;
|
|
690
|
+
interface $ZodBase64URLInternals extends $ZodStringFormatInternals<"base64url"> {}
|
|
691
|
+
interface $ZodBase64URL extends $ZodType {
|
|
692
|
+
_zod: $ZodBase64URLInternals;
|
|
693
|
+
}
|
|
694
|
+
declare const $ZodBase64URL: $constructor<$ZodBase64URL>;
|
|
695
|
+
interface $ZodE164Internals extends $ZodStringFormatInternals<"e164"> {}
|
|
696
|
+
interface $ZodE164 extends $ZodType {
|
|
697
|
+
_zod: $ZodE164Internals;
|
|
698
|
+
}
|
|
699
|
+
declare const $ZodE164: $constructor<$ZodE164>;
|
|
700
|
+
interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> {
|
|
701
|
+
alg?: JWTAlgorithm | undefined;
|
|
702
|
+
}
|
|
703
|
+
interface $ZodJWTInternals extends $ZodStringFormatInternals<"jwt"> {
|
|
704
|
+
def: $ZodJWTDef;
|
|
705
|
+
}
|
|
706
|
+
interface $ZodJWT extends $ZodType {
|
|
707
|
+
_zod: $ZodJWTInternals;
|
|
708
|
+
}
|
|
709
|
+
declare const $ZodJWT: $constructor<$ZodJWT>;
|
|
710
|
+
interface $ZodNumberDef extends $ZodTypeDef {
|
|
711
|
+
type: "number";
|
|
712
|
+
coerce?: boolean;
|
|
713
|
+
}
|
|
714
|
+
interface $ZodNumberInternals<Input = unknown> extends $ZodTypeInternals<number, Input> {
|
|
715
|
+
def: $ZodNumberDef;
|
|
716
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
717
|
+
pattern: RegExp;
|
|
718
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
719
|
+
isst: $ZodIssueInvalidType;
|
|
720
|
+
bag: LoosePartial<{
|
|
721
|
+
minimum: number;
|
|
722
|
+
maximum: number;
|
|
723
|
+
exclusiveMinimum: number;
|
|
724
|
+
exclusiveMaximum: number;
|
|
725
|
+
format: string;
|
|
726
|
+
pattern: RegExp;
|
|
727
|
+
}>;
|
|
728
|
+
}
|
|
729
|
+
interface $ZodNumber<Input = unknown> extends $ZodType {
|
|
730
|
+
_zod: $ZodNumberInternals<Input>;
|
|
731
|
+
}
|
|
732
|
+
declare const $ZodNumber: $constructor<$ZodNumber>;
|
|
733
|
+
interface $ZodBooleanDef extends $ZodTypeDef {
|
|
734
|
+
type: "boolean";
|
|
735
|
+
coerce?: boolean;
|
|
736
|
+
checks?: $ZodCheck<boolean>[];
|
|
737
|
+
}
|
|
738
|
+
interface $ZodBooleanInternals<T = unknown> extends $ZodTypeInternals<boolean, T> {
|
|
739
|
+
pattern: RegExp;
|
|
740
|
+
def: $ZodBooleanDef;
|
|
741
|
+
isst: $ZodIssueInvalidType;
|
|
742
|
+
}
|
|
743
|
+
interface $ZodBoolean<T = unknown> extends $ZodType {
|
|
744
|
+
_zod: $ZodBooleanInternals<T>;
|
|
745
|
+
}
|
|
746
|
+
declare const $ZodBoolean: $constructor<$ZodBoolean>;
|
|
747
|
+
interface $ZodBigIntDef extends $ZodTypeDef {
|
|
748
|
+
type: "bigint";
|
|
749
|
+
coerce?: boolean;
|
|
750
|
+
}
|
|
751
|
+
interface $ZodBigIntInternals<T = unknown> extends $ZodTypeInternals<bigint, T> {
|
|
752
|
+
pattern: RegExp;
|
|
753
|
+
/** @internal Internal API, use with caution */
|
|
754
|
+
def: $ZodBigIntDef;
|
|
755
|
+
isst: $ZodIssueInvalidType;
|
|
756
|
+
bag: LoosePartial<{
|
|
757
|
+
minimum: bigint;
|
|
758
|
+
maximum: bigint;
|
|
759
|
+
format: string;
|
|
760
|
+
}>;
|
|
761
|
+
}
|
|
762
|
+
interface $ZodBigInt<T = unknown> extends $ZodType {
|
|
763
|
+
_zod: $ZodBigIntInternals<T>;
|
|
764
|
+
}
|
|
765
|
+
declare const $ZodBigInt: $constructor<$ZodBigInt>;
|
|
766
|
+
interface $ZodSymbolDef extends $ZodTypeDef {
|
|
767
|
+
type: "symbol";
|
|
768
|
+
}
|
|
769
|
+
interface $ZodSymbolInternals extends $ZodTypeInternals<symbol, symbol> {
|
|
770
|
+
def: $ZodSymbolDef;
|
|
771
|
+
isst: $ZodIssueInvalidType;
|
|
772
|
+
}
|
|
773
|
+
interface $ZodSymbol extends $ZodType {
|
|
774
|
+
_zod: $ZodSymbolInternals;
|
|
775
|
+
}
|
|
776
|
+
declare const $ZodSymbol: $constructor<$ZodSymbol>;
|
|
777
|
+
interface $ZodUndefinedDef extends $ZodTypeDef {
|
|
778
|
+
type: "undefined";
|
|
779
|
+
}
|
|
780
|
+
interface $ZodUndefinedInternals extends $ZodTypeInternals<undefined, undefined> {
|
|
781
|
+
pattern: RegExp;
|
|
782
|
+
def: $ZodUndefinedDef;
|
|
783
|
+
values: PrimitiveSet;
|
|
784
|
+
isst: $ZodIssueInvalidType;
|
|
785
|
+
}
|
|
786
|
+
interface $ZodUndefined extends $ZodType {
|
|
787
|
+
_zod: $ZodUndefinedInternals;
|
|
788
|
+
}
|
|
789
|
+
declare const $ZodUndefined: $constructor<$ZodUndefined>;
|
|
790
|
+
interface $ZodNullDef extends $ZodTypeDef {
|
|
791
|
+
type: "null";
|
|
792
|
+
}
|
|
793
|
+
interface $ZodNullInternals extends $ZodTypeInternals<null, null> {
|
|
794
|
+
pattern: RegExp;
|
|
795
|
+
def: $ZodNullDef;
|
|
796
|
+
values: PrimitiveSet;
|
|
797
|
+
isst: $ZodIssueInvalidType;
|
|
798
|
+
}
|
|
799
|
+
interface $ZodNull extends $ZodType {
|
|
800
|
+
_zod: $ZodNullInternals;
|
|
801
|
+
}
|
|
802
|
+
declare const $ZodNull: $constructor<$ZodNull>;
|
|
803
|
+
interface $ZodAnyDef extends $ZodTypeDef {
|
|
804
|
+
type: "any";
|
|
805
|
+
}
|
|
806
|
+
interface $ZodAnyInternals extends $ZodTypeInternals<any, any> {
|
|
807
|
+
def: $ZodAnyDef;
|
|
808
|
+
isst: never;
|
|
809
|
+
}
|
|
810
|
+
interface $ZodAny extends $ZodType {
|
|
811
|
+
_zod: $ZodAnyInternals;
|
|
812
|
+
}
|
|
813
|
+
declare const $ZodAny: $constructor<$ZodAny>;
|
|
814
|
+
interface $ZodUnknownDef extends $ZodTypeDef {
|
|
815
|
+
type: "unknown";
|
|
816
|
+
}
|
|
817
|
+
interface $ZodUnknownInternals extends $ZodTypeInternals<unknown, unknown> {
|
|
818
|
+
def: $ZodUnknownDef;
|
|
819
|
+
isst: never;
|
|
820
|
+
}
|
|
821
|
+
interface $ZodUnknown extends $ZodType {
|
|
822
|
+
_zod: $ZodUnknownInternals;
|
|
823
|
+
}
|
|
824
|
+
declare const $ZodUnknown: $constructor<$ZodUnknown>;
|
|
825
|
+
interface $ZodNeverDef extends $ZodTypeDef {
|
|
826
|
+
type: "never";
|
|
827
|
+
}
|
|
828
|
+
interface $ZodNeverInternals extends $ZodTypeInternals<never, never> {
|
|
829
|
+
def: $ZodNeverDef;
|
|
830
|
+
isst: $ZodIssueInvalidType;
|
|
831
|
+
}
|
|
832
|
+
interface $ZodNever extends $ZodType {
|
|
833
|
+
_zod: $ZodNeverInternals;
|
|
834
|
+
}
|
|
835
|
+
declare const $ZodNever: $constructor<$ZodNever>;
|
|
836
|
+
interface $ZodVoidDef extends $ZodTypeDef {
|
|
837
|
+
type: "void";
|
|
838
|
+
}
|
|
839
|
+
interface $ZodVoidInternals extends $ZodTypeInternals<void, void> {
|
|
840
|
+
def: $ZodVoidDef;
|
|
841
|
+
isst: $ZodIssueInvalidType;
|
|
842
|
+
}
|
|
843
|
+
interface $ZodVoid extends $ZodType {
|
|
844
|
+
_zod: $ZodVoidInternals;
|
|
845
|
+
}
|
|
846
|
+
declare const $ZodVoid: $constructor<$ZodVoid>;
|
|
847
|
+
interface $ZodDateDef extends $ZodTypeDef {
|
|
848
|
+
type: "date";
|
|
849
|
+
coerce?: boolean;
|
|
850
|
+
}
|
|
851
|
+
interface $ZodDateInternals<T = unknown> extends $ZodTypeInternals<Date, T> {
|
|
852
|
+
def: $ZodDateDef;
|
|
853
|
+
isst: $ZodIssueInvalidType;
|
|
854
|
+
bag: LoosePartial<{
|
|
855
|
+
minimum: Date;
|
|
856
|
+
maximum: Date;
|
|
857
|
+
format: string;
|
|
858
|
+
}>;
|
|
859
|
+
}
|
|
860
|
+
interface $ZodDate<T = unknown> extends $ZodType {
|
|
861
|
+
_zod: $ZodDateInternals<T>;
|
|
862
|
+
}
|
|
863
|
+
declare const $ZodDate: $constructor<$ZodDate>;
|
|
864
|
+
interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
865
|
+
type: "array";
|
|
866
|
+
element: T;
|
|
867
|
+
}
|
|
868
|
+
interface $ZodArrayInternals<T extends SomeType = $ZodType> extends _$ZodTypeInternals {
|
|
869
|
+
def: $ZodArrayDef<T>;
|
|
870
|
+
isst: $ZodIssueInvalidType;
|
|
871
|
+
output: output<T>[];
|
|
872
|
+
input: input<T>[];
|
|
873
|
+
}
|
|
874
|
+
interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType<any, any, $ZodArrayInternals<T>> {}
|
|
875
|
+
declare const $ZodArray: $constructor<$ZodArray>;
|
|
876
|
+
type OptionalOutSchema = {
|
|
877
|
+
_zod: {
|
|
878
|
+
optout: "optional";
|
|
879
|
+
};
|
|
880
|
+
};
|
|
881
|
+
type OptionalInSchema = {
|
|
882
|
+
_zod: {
|
|
883
|
+
optin: "optional" | "defaulted";
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : { [k in string]: output<T[keyof T]>; } : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"]; } & { -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"]; } & Extra>;
|
|
887
|
+
type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : { [k in string]: input<T[keyof T]>; } : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"]; } & { -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"]; } & Extra>;
|
|
888
|
+
type $ZodObjectConfig = {
|
|
889
|
+
out: Record<string, unknown>;
|
|
890
|
+
in: Record<string, unknown>;
|
|
891
|
+
};
|
|
892
|
+
type $loose = {
|
|
893
|
+
out: Record<string, unknown>;
|
|
894
|
+
in: Record<string, unknown>;
|
|
895
|
+
};
|
|
896
|
+
type $strict = {
|
|
897
|
+
out: {};
|
|
898
|
+
in: {};
|
|
899
|
+
};
|
|
900
|
+
type $strip = {
|
|
901
|
+
out: {};
|
|
902
|
+
in: {};
|
|
903
|
+
};
|
|
904
|
+
type $catchall<T extends SomeType> = {
|
|
905
|
+
out: {
|
|
906
|
+
[k: string]: output<T>;
|
|
907
|
+
};
|
|
908
|
+
in: {
|
|
909
|
+
[k: string]: input<T>;
|
|
910
|
+
};
|
|
911
|
+
};
|
|
912
|
+
type $ZodShape = Readonly<{
|
|
913
|
+
[k: string]: $ZodType;
|
|
914
|
+
}>;
|
|
915
|
+
interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
|
|
916
|
+
type: "object";
|
|
917
|
+
shape: Shape;
|
|
918
|
+
catchall?: $ZodType | undefined;
|
|
919
|
+
}
|
|
920
|
+
interface $ZodObjectInternals<
|
|
921
|
+
/** @ts-ignore Cast variance */
|
|
922
|
+
out Shape extends $ZodShape = $ZodShape, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
|
|
923
|
+
def: $ZodObjectDef<Shape>;
|
|
924
|
+
config: Config;
|
|
925
|
+
isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys;
|
|
926
|
+
propValues: PropValues;
|
|
927
|
+
output: $InferObjectOutput<Shape, Config["out"]>;
|
|
928
|
+
input: $InferObjectInput<Shape, Config["in"]>;
|
|
929
|
+
optin?: "optional" | undefined;
|
|
930
|
+
optout?: "optional" | undefined;
|
|
931
|
+
}
|
|
932
|
+
type $ZodLooseShape = Record<string, any>;
|
|
933
|
+
interface $ZodObject<
|
|
934
|
+
/** @ts-ignore Cast variance */
|
|
935
|
+
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {}
|
|
936
|
+
declare const $ZodObject: $constructor<$ZodObject>;
|
|
937
|
+
type $InferUnionOutput<T extends SomeType> = T extends any ? output<T> : never;
|
|
938
|
+
type $InferUnionInput<T extends SomeType> = T extends any ? input<T> : never;
|
|
939
|
+
interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
|
|
940
|
+
type: "union";
|
|
941
|
+
options: Options;
|
|
942
|
+
inclusive?: boolean;
|
|
943
|
+
}
|
|
944
|
+
type IsOptionalIn<T extends SomeType> = T extends OptionalInSchema ? true : false;
|
|
945
|
+
type IsOptionalOut<T extends SomeType> = T extends OptionalOutSchema ? true : false;
|
|
946
|
+
interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends _$ZodTypeInternals {
|
|
947
|
+
def: $ZodUnionDef<T>;
|
|
948
|
+
isst: $ZodIssueInvalidUnion;
|
|
949
|
+
pattern: T[number]["_zod"]["pattern"];
|
|
950
|
+
values: T[number]["_zod"]["values"];
|
|
951
|
+
output: $InferUnionOutput<T[number]>;
|
|
952
|
+
input: $InferUnionInput<T[number]>;
|
|
953
|
+
optin: IsOptionalIn<T[number]> extends false ? "optional" | "defaulted" | undefined : "optional" | "defaulted";
|
|
954
|
+
optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
|
|
955
|
+
}
|
|
956
|
+
interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType<any, any, $ZodUnionInternals<T>> {
|
|
957
|
+
_zod: $ZodUnionInternals<T>;
|
|
958
|
+
}
|
|
959
|
+
declare const $ZodUnion: $constructor<$ZodUnion>;
|
|
960
|
+
interface $ZodDiscriminatedUnionDef<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends $ZodUnionDef<Options> {
|
|
961
|
+
discriminator: Disc;
|
|
962
|
+
unionFallback?: boolean;
|
|
963
|
+
}
|
|
964
|
+
interface $ZodDiscriminatedUnionInternals<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends $ZodUnionInternals<Options> {
|
|
965
|
+
def: $ZodDiscriminatedUnionDef<Options, Disc>;
|
|
966
|
+
propValues: PropValues;
|
|
967
|
+
bag: LoosePartial<{
|
|
968
|
+
optionsMap: Map<Primitive, $ZodType | null>;
|
|
969
|
+
}>;
|
|
970
|
+
}
|
|
971
|
+
interface $ZodDiscriminatedUnion<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends $ZodType {
|
|
972
|
+
_zod: $ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
973
|
+
}
|
|
974
|
+
declare const $ZodDiscriminatedUnion: $constructor<$ZodDiscriminatedUnion>;
|
|
975
|
+
interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
976
|
+
type: "intersection";
|
|
977
|
+
left: Left;
|
|
978
|
+
right: Right;
|
|
979
|
+
}
|
|
980
|
+
interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _$ZodTypeInternals {
|
|
981
|
+
def: $ZodIntersectionDef<A, B>;
|
|
982
|
+
isst: never;
|
|
983
|
+
optin: A["_zod"]["optin"] | B["_zod"]["optin"];
|
|
984
|
+
optout: A["_zod"]["optout"] | B["_zod"]["optout"];
|
|
985
|
+
output: output<A> & output<B>;
|
|
986
|
+
input: input<A> & input<B>;
|
|
987
|
+
}
|
|
988
|
+
interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
|
|
989
|
+
_zod: $ZodIntersectionInternals<A, B>;
|
|
990
|
+
}
|
|
991
|
+
declare const $ZodIntersection: $constructor<$ZodIntersection>;
|
|
992
|
+
interface $ZodTupleDef<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodTypeDef {
|
|
993
|
+
type: "tuple";
|
|
994
|
+
items: T;
|
|
995
|
+
rest: Rest;
|
|
996
|
+
}
|
|
997
|
+
type $InferTupleInputType<T extends TupleItems, Rest extends SomeType | null> = [...TupleInputTypeWithOptionals<T>, ...(Rest extends SomeType ? input<Rest>[] : [])];
|
|
998
|
+
type TupleInputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: input<T[k]>; };
|
|
999
|
+
type TupleInputTypeWithOptionals<T extends TupleItems> = T extends readonly [...infer Prefix extends SomeType[], infer Tail extends SomeType] ? Tail["_zod"]["optin"] extends "optional" | "defaulted" ? [...TupleInputTypeWithOptionals<Prefix>, input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
|
|
1000
|
+
type $InferTupleOutputType<T extends TupleItems, Rest extends SomeType | null> = [...TupleOutputTypeWithOptionals<T>, ...(Rest extends SomeType ? output<Rest>[] : [])];
|
|
1001
|
+
type TupleOutputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: output<T[k]>; };
|
|
1002
|
+
type TupleOutputTypeWithOptionals<T extends TupleItems> = T extends readonly [...infer Prefix extends SomeType[], infer Tail extends SomeType] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
|
|
1003
|
+
interface $ZodTupleInternals<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends _$ZodTypeInternals {
|
|
1004
|
+
def: $ZodTupleDef<T, Rest>;
|
|
1005
|
+
isst: $ZodIssueInvalidType | $ZodIssueTooBig<unknown[]> | $ZodIssueTooSmall<unknown[]>;
|
|
1006
|
+
output: $InferTupleOutputType<T, Rest>;
|
|
1007
|
+
input: $InferTupleInputType<T, Rest>;
|
|
1008
|
+
}
|
|
1009
|
+
interface $ZodTuple<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends $ZodType {
|
|
1010
|
+
_zod: $ZodTupleInternals<T, Rest>;
|
|
1011
|
+
}
|
|
1012
|
+
declare const $ZodTuple: $constructor<$ZodTuple>;
|
|
1013
|
+
type $ZodRecordKey = $ZodType<string | number | symbol, unknown>;
|
|
1014
|
+
interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1015
|
+
type: "record";
|
|
1016
|
+
keyType: Key;
|
|
1017
|
+
valueType: Value;
|
|
1018
|
+
/** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */
|
|
1019
|
+
mode?: "strict" | "loose";
|
|
1020
|
+
partial?: boolean;
|
|
1021
|
+
}
|
|
1022
|
+
type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<output<Key>, output<Value>>> : Record<output<Key>, output<Value>>;
|
|
1023
|
+
type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<input<Key> & PropertyKey, input<Value>>> : [Value] extends [OptionalInSchema] ? Partial<Record<input<Key> & PropertyKey, input<Value>>> : Record<input<Key> & PropertyKey, input<Value>>;
|
|
1024
|
+
interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
|
|
1025
|
+
def: $ZodRecordDef<Key, Value>;
|
|
1026
|
+
isst: $ZodIssueInvalidType | $ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
|
|
1027
|
+
optin?: "optional" | undefined;
|
|
1028
|
+
optout?: "optional" | undefined;
|
|
1029
|
+
}
|
|
1030
|
+
type $partial = {
|
|
1031
|
+
"~~partial": true;
|
|
1032
|
+
};
|
|
1033
|
+
interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodType {
|
|
1034
|
+
_zod: $ZodRecordInternals<Key, Value>;
|
|
1035
|
+
}
|
|
1036
|
+
declare const $ZodRecord: $constructor<$ZodRecord>;
|
|
1037
|
+
interface $ZodMapDef<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1038
|
+
type: "map";
|
|
1039
|
+
keyType: Key;
|
|
1040
|
+
valueType: Value;
|
|
1041
|
+
}
|
|
1042
|
+
interface $ZodMapInternals<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodTypeInternals<Map<output<Key>, output<Value>>, Map<input<Key>, input<Value>>> {
|
|
1043
|
+
def: $ZodMapDef<Key, Value>;
|
|
1044
|
+
isst: $ZodIssueInvalidType | $ZodIssueInvalidKey | $ZodIssueInvalidElement<unknown>;
|
|
1045
|
+
optin?: "optional" | undefined;
|
|
1046
|
+
optout?: "optional" | undefined;
|
|
1047
|
+
}
|
|
1048
|
+
interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType = $ZodType> extends $ZodType {
|
|
1049
|
+
_zod: $ZodMapInternals<Key, Value>;
|
|
1050
|
+
}
|
|
1051
|
+
declare const $ZodMap: $constructor<$ZodMap>;
|
|
1052
|
+
interface $ZodSetDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1053
|
+
type: "set";
|
|
1054
|
+
valueType: T;
|
|
1055
|
+
}
|
|
1056
|
+
interface $ZodSetInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<Set<output<T>>, Set<input<T>>> {
|
|
1057
|
+
def: $ZodSetDef<T>;
|
|
1058
|
+
isst: $ZodIssueInvalidType;
|
|
1059
|
+
optin?: "optional" | undefined;
|
|
1060
|
+
optout?: "optional" | undefined;
|
|
1061
|
+
}
|
|
1062
|
+
interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
|
|
1063
|
+
_zod: $ZodSetInternals<T>;
|
|
1064
|
+
}
|
|
1065
|
+
declare const $ZodSet: $constructor<$ZodSet>;
|
|
1066
|
+
type $InferEnumOutput<T extends EnumLike> = T[keyof T] & {};
|
|
1067
|
+
type $InferEnumInput<T extends EnumLike> = T[keyof T] & {};
|
|
1068
|
+
interface $ZodEnumDef<T extends EnumLike = EnumLike> extends $ZodTypeDef {
|
|
1069
|
+
type: "enum";
|
|
1070
|
+
entries: T;
|
|
1071
|
+
}
|
|
1072
|
+
interface $ZodEnumInternals<
|
|
1073
|
+
/** @ts-ignore Cast variance */
|
|
1074
|
+
out T extends EnumLike = EnumLike> extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
|
|
1075
|
+
def: $ZodEnumDef<T>;
|
|
1076
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
1077
|
+
values: PrimitiveSet;
|
|
1078
|
+
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
1079
|
+
pattern: RegExp;
|
|
1080
|
+
isst: $ZodIssueInvalidValue;
|
|
1081
|
+
}
|
|
1082
|
+
interface $ZodEnum<T extends EnumLike = EnumLike> extends $ZodType {
|
|
1083
|
+
_zod: $ZodEnumInternals<T>;
|
|
1084
|
+
}
|
|
1085
|
+
declare const $ZodEnum: $constructor<$ZodEnum>;
|
|
1086
|
+
interface $ZodLiteralDef<T extends Literal> extends $ZodTypeDef {
|
|
1087
|
+
type: "literal";
|
|
1088
|
+
values: T[];
|
|
1089
|
+
}
|
|
1090
|
+
interface $ZodLiteralInternals<T extends Literal = Literal> extends $ZodTypeInternals<T, T> {
|
|
1091
|
+
def: $ZodLiteralDef<T>;
|
|
1092
|
+
values: Set<T>;
|
|
1093
|
+
pattern: RegExp;
|
|
1094
|
+
isst: $ZodIssueInvalidValue;
|
|
1095
|
+
}
|
|
1096
|
+
interface $ZodLiteral<T extends Literal = Literal> extends $ZodType {
|
|
1097
|
+
_zod: $ZodLiteralInternals<T>;
|
|
1098
|
+
}
|
|
1099
|
+
declare const $ZodLiteral: $constructor<$ZodLiteral>;
|
|
1100
|
+
type _File = typeof globalThis extends {
|
|
1101
|
+
File: infer F extends new (...args: any[]) => any;
|
|
1102
|
+
} ? InstanceType<F> : {};
|
|
1103
|
+
/** Do not reference this directly. */
|
|
1104
|
+
interface File extends _File {
|
|
1105
|
+
readonly type: string;
|
|
1106
|
+
readonly size: number;
|
|
1107
|
+
}
|
|
1108
|
+
interface $ZodFileDef extends $ZodTypeDef {
|
|
1109
|
+
type: "file";
|
|
1110
|
+
}
|
|
1111
|
+
interface $ZodFileInternals extends $ZodTypeInternals<File, File> {
|
|
1112
|
+
def: $ZodFileDef;
|
|
1113
|
+
isst: $ZodIssueInvalidType;
|
|
1114
|
+
bag: LoosePartial<{
|
|
1115
|
+
minimum: number;
|
|
1116
|
+
maximum: number;
|
|
1117
|
+
mime: MimeTypes[];
|
|
1118
|
+
}>;
|
|
1119
|
+
}
|
|
1120
|
+
interface $ZodFile extends $ZodType {
|
|
1121
|
+
_zod: $ZodFileInternals;
|
|
1122
|
+
}
|
|
1123
|
+
declare const $ZodFile: $constructor<$ZodFile>;
|
|
1124
|
+
interface $ZodTransformDef extends $ZodTypeDef {
|
|
1125
|
+
type: "transform";
|
|
1126
|
+
transform: (input: unknown, payload: ParsePayload<unknown>) => MaybeAsync<unknown>;
|
|
1127
|
+
}
|
|
1128
|
+
interface $ZodTransformInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I> {
|
|
1129
|
+
def: $ZodTransformDef;
|
|
1130
|
+
isst: never;
|
|
1131
|
+
}
|
|
1132
|
+
interface $ZodTransform<O = unknown, I = unknown> extends $ZodType {
|
|
1133
|
+
_zod: $ZodTransformInternals<O, I>;
|
|
1134
|
+
}
|
|
1135
|
+
declare const $ZodTransform: $constructor<$ZodTransform>;
|
|
1136
|
+
interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1137
|
+
type: "optional";
|
|
1138
|
+
innerType: T;
|
|
1139
|
+
}
|
|
1140
|
+
interface $ZodOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | undefined, input<T> | undefined> {
|
|
1141
|
+
def: $ZodOptionalDef<T>;
|
|
1142
|
+
optin: "optional" | "defaulted";
|
|
1143
|
+
optout: "optional";
|
|
1144
|
+
isst: never;
|
|
1145
|
+
values: T["_zod"]["values"];
|
|
1146
|
+
pattern: T["_zod"]["pattern"];
|
|
1147
|
+
}
|
|
1148
|
+
interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
|
|
1149
|
+
_zod: $ZodOptionalInternals<T>;
|
|
1150
|
+
}
|
|
1151
|
+
declare const $ZodOptional: $constructor<$ZodOptional>;
|
|
1152
|
+
interface $ZodExactOptionalDef<T extends SomeType = $ZodType> extends $ZodOptionalDef<T> {}
|
|
1153
|
+
interface $ZodExactOptionalInternals<T extends SomeType = $ZodType> extends $ZodOptionalInternals<T> {
|
|
1154
|
+
def: $ZodExactOptionalDef<T>;
|
|
1155
|
+
output: output<T>;
|
|
1156
|
+
input: input<T>;
|
|
1157
|
+
}
|
|
1158
|
+
interface $ZodExactOptional<T extends SomeType = $ZodType> extends $ZodType {
|
|
1159
|
+
_zod: $ZodExactOptionalInternals<T>;
|
|
1160
|
+
}
|
|
1161
|
+
declare const $ZodExactOptional: $constructor<$ZodExactOptional>;
|
|
1162
|
+
interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1163
|
+
type: "nullable";
|
|
1164
|
+
innerType: T;
|
|
1165
|
+
}
|
|
1166
|
+
interface $ZodNullableInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | null, input<T> | null> {
|
|
1167
|
+
def: $ZodNullableDef<T>;
|
|
1168
|
+
optin: T["_zod"]["optin"];
|
|
1169
|
+
optout: T["_zod"]["optout"];
|
|
1170
|
+
isst: never;
|
|
1171
|
+
values: T["_zod"]["values"];
|
|
1172
|
+
pattern: T["_zod"]["pattern"];
|
|
1173
|
+
}
|
|
1174
|
+
interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
|
|
1175
|
+
_zod: $ZodNullableInternals<T>;
|
|
1176
|
+
}
|
|
1177
|
+
declare const $ZodNullable: $constructor<$ZodNullable>;
|
|
1178
|
+
interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1179
|
+
type: "default";
|
|
1180
|
+
innerType: T;
|
|
1181
|
+
/** The default value. May be a getter. */
|
|
1182
|
+
defaultValue: NoUndefined<output<T>>;
|
|
1183
|
+
}
|
|
1184
|
+
interface $ZodDefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
|
|
1185
|
+
def: $ZodDefaultDef<T>;
|
|
1186
|
+
optin: "defaulted";
|
|
1187
|
+
optout?: "optional" | undefined;
|
|
1188
|
+
isst: never;
|
|
1189
|
+
values: T["_zod"]["values"];
|
|
1190
|
+
}
|
|
1191
|
+
interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
|
|
1192
|
+
_zod: $ZodDefaultInternals<T>;
|
|
1193
|
+
}
|
|
1194
|
+
declare const $ZodDefault: $constructor<$ZodDefault>;
|
|
1195
|
+
interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1196
|
+
type: "prefault";
|
|
1197
|
+
innerType: T;
|
|
1198
|
+
/** The default value. May be a getter. */
|
|
1199
|
+
defaultValue: input<T>;
|
|
1200
|
+
}
|
|
1201
|
+
interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
|
|
1202
|
+
def: $ZodPrefaultDef<T>;
|
|
1203
|
+
optin: "defaulted";
|
|
1204
|
+
optout?: "optional" | undefined;
|
|
1205
|
+
isst: never;
|
|
1206
|
+
values: T["_zod"]["values"];
|
|
1207
|
+
}
|
|
1208
|
+
interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
|
|
1209
|
+
_zod: $ZodPrefaultInternals<T>;
|
|
1210
|
+
}
|
|
1211
|
+
declare const $ZodPrefault: $constructor<$ZodPrefault>;
|
|
1212
|
+
interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1213
|
+
type: "nonoptional";
|
|
1214
|
+
innerType: T;
|
|
1215
|
+
}
|
|
1216
|
+
interface $ZodNonOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, NoUndefined<input<T>>> {
|
|
1217
|
+
def: $ZodNonOptionalDef<T>;
|
|
1218
|
+
isst: $ZodIssueInvalidType;
|
|
1219
|
+
values: T["_zod"]["values"];
|
|
1220
|
+
optin: "optional" | undefined;
|
|
1221
|
+
optout: "optional" | undefined;
|
|
1222
|
+
}
|
|
1223
|
+
interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
|
|
1224
|
+
_zod: $ZodNonOptionalInternals<T>;
|
|
1225
|
+
}
|
|
1226
|
+
declare const $ZodNonOptional: $constructor<$ZodNonOptional>;
|
|
1227
|
+
interface $ZodSuccessDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1228
|
+
type: "success";
|
|
1229
|
+
innerType: T;
|
|
1230
|
+
}
|
|
1231
|
+
interface $ZodSuccessInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<boolean, input<T>> {
|
|
1232
|
+
def: $ZodSuccessDef<T>;
|
|
1233
|
+
isst: never;
|
|
1234
|
+
optin: T["_zod"]["optin"];
|
|
1235
|
+
optout: "optional" | undefined;
|
|
1236
|
+
}
|
|
1237
|
+
interface $ZodSuccess<T extends SomeType = $ZodType> extends $ZodType {
|
|
1238
|
+
_zod: $ZodSuccessInternals<T>;
|
|
1239
|
+
}
|
|
1240
|
+
declare const $ZodSuccess: $constructor<$ZodSuccess>;
|
|
1241
|
+
interface $ZodCatchCtx extends ParsePayload {
|
|
1242
|
+
/** @deprecated Use `ctx.issues` */
|
|
1243
|
+
error: {
|
|
1244
|
+
issues: $ZodIssue[];
|
|
1245
|
+
};
|
|
1246
|
+
/** @deprecated Use `ctx.value` */
|
|
1247
|
+
input: unknown;
|
|
1248
|
+
}
|
|
1249
|
+
interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1250
|
+
type: "catch";
|
|
1251
|
+
innerType: T;
|
|
1252
|
+
catchValue: (ctx: $ZodCatchCtx) => unknown;
|
|
1253
|
+
}
|
|
1254
|
+
interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T>, input<T>> {
|
|
1255
|
+
def: $ZodCatchDef<T>;
|
|
1256
|
+
optin: T["_zod"]["optin"];
|
|
1257
|
+
optout: T["_zod"]["optout"];
|
|
1258
|
+
isst: never;
|
|
1259
|
+
values: T["_zod"]["values"];
|
|
1260
|
+
}
|
|
1261
|
+
interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
|
|
1262
|
+
_zod: $ZodCatchInternals<T>;
|
|
1263
|
+
}
|
|
1264
|
+
declare const $ZodCatch: $constructor<$ZodCatch>;
|
|
1265
|
+
interface $ZodNaNDef extends $ZodTypeDef {
|
|
1266
|
+
type: "nan";
|
|
1267
|
+
}
|
|
1268
|
+
interface $ZodNaNInternals extends $ZodTypeInternals<number, number> {
|
|
1269
|
+
def: $ZodNaNDef;
|
|
1270
|
+
isst: $ZodIssueInvalidType;
|
|
1271
|
+
}
|
|
1272
|
+
interface $ZodNaN extends $ZodType {
|
|
1273
|
+
_zod: $ZodNaNInternals;
|
|
1274
|
+
}
|
|
1275
|
+
declare const $ZodNaN: $constructor<$ZodNaN>;
|
|
1276
|
+
interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1277
|
+
type: "pipe";
|
|
1278
|
+
in: A;
|
|
1279
|
+
out: B;
|
|
1280
|
+
/** Only defined inside $ZodCodec instances. */
|
|
1281
|
+
transform?: (value: output<A>, payload: ParsePayload<output<A>>) => MaybeAsync<input<B>>;
|
|
1282
|
+
/** Only defined inside $ZodCodec instances. */
|
|
1283
|
+
reverseTransform?: (value: input<B>, payload: ParsePayload<input<B>>) => MaybeAsync<output<A>>;
|
|
1284
|
+
}
|
|
1285
|
+
interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeInternals<output<B>, input<A>> {
|
|
1286
|
+
def: $ZodPipeDef<A, B>;
|
|
1287
|
+
isst: never;
|
|
1288
|
+
values: A["_zod"]["values"];
|
|
1289
|
+
optin: A["_zod"]["optin"];
|
|
1290
|
+
optout: B["_zod"]["optout"];
|
|
1291
|
+
propValues: A["_zod"]["propValues"];
|
|
1292
|
+
}
|
|
1293
|
+
interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
|
|
1294
|
+
_zod: $ZodPipeInternals<A, B>;
|
|
1295
|
+
}
|
|
1296
|
+
declare const $ZodPipe: $constructor<$ZodPipe>;
|
|
1297
|
+
interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1298
|
+
type: "readonly";
|
|
1299
|
+
innerType: T;
|
|
1300
|
+
}
|
|
1301
|
+
interface $ZodReadonlyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<MakeReadonly<output<T>>, MakeReadonly<input<T>>> {
|
|
1302
|
+
def: $ZodReadonlyDef<T>;
|
|
1303
|
+
optin: T["_zod"]["optin"];
|
|
1304
|
+
optout: T["_zod"]["optout"];
|
|
1305
|
+
isst: never;
|
|
1306
|
+
propValues: T["_zod"]["propValues"];
|
|
1307
|
+
values: T["_zod"]["values"];
|
|
1308
|
+
}
|
|
1309
|
+
interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
|
|
1310
|
+
_zod: $ZodReadonlyInternals<T>;
|
|
1311
|
+
}
|
|
1312
|
+
declare const $ZodReadonly: $constructor<$ZodReadonly>;
|
|
1313
|
+
interface $ZodTemplateLiteralDef extends $ZodTypeDef {
|
|
1314
|
+
type: "template_literal";
|
|
1315
|
+
parts: $ZodTemplateLiteralPart[];
|
|
1316
|
+
format?: string | undefined;
|
|
1317
|
+
}
|
|
1318
|
+
interface $ZodTemplateLiteralInternals<Template extends string = string> extends $ZodTypeInternals<Template, Template> {
|
|
1319
|
+
pattern: RegExp;
|
|
1320
|
+
def: $ZodTemplateLiteralDef;
|
|
1321
|
+
isst: $ZodIssueInvalidType;
|
|
1322
|
+
}
|
|
1323
|
+
interface $ZodTemplateLiteral<Template extends string = string> extends $ZodType {
|
|
1324
|
+
_zod: $ZodTemplateLiteralInternals<Template>;
|
|
1325
|
+
}
|
|
1326
|
+
type LiteralPart = Exclude<Literal, symbol>;
|
|
1327
|
+
interface SchemaPartInternals extends $ZodTypeInternals<LiteralPart, LiteralPart> {
|
|
1328
|
+
pattern: RegExp;
|
|
1329
|
+
}
|
|
1330
|
+
interface SchemaPart extends $ZodType {
|
|
1331
|
+
_zod: SchemaPartInternals;
|
|
1332
|
+
}
|
|
1333
|
+
type $ZodTemplateLiteralPart = LiteralPart | SchemaPart;
|
|
1334
|
+
declare const $ZodTemplateLiteral: $constructor<$ZodTemplateLiteral>;
|
|
1335
|
+
type $ZodFunctionArgs = $ZodType<unknown[], unknown[]>;
|
|
1336
|
+
type $ZodFunctionIn = $ZodFunctionArgs;
|
|
1337
|
+
type $ZodFunctionOut = $ZodType;
|
|
1338
|
+
type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : output<Args>) => input<Returns>;
|
|
1339
|
+
type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : output<Args>) => MaybeAsync<input<Returns>>;
|
|
1340
|
+
type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : input<Args>) => output<Returns>;
|
|
1341
|
+
type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (...args: $ZodFunctionIn extends Args ? never[] : input<Args>) => Promise<output<Returns>>;
|
|
1342
|
+
interface $ZodFunctionDef<In extends $ZodFunctionIn = $ZodFunctionIn, Out extends $ZodFunctionOut = $ZodFunctionOut> extends $ZodTypeDef {
|
|
1343
|
+
type: "function";
|
|
1344
|
+
input: In;
|
|
1345
|
+
output: Out;
|
|
1346
|
+
}
|
|
1347
|
+
interface $ZodFunctionInternals<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> extends $ZodTypeInternals<$InferOuterFunctionType<Args, Returns>, $InferInnerFunctionType<Args, Returns>> {
|
|
1348
|
+
def: $ZodFunctionDef<Args, Returns>;
|
|
1349
|
+
isst: $ZodIssueInvalidType;
|
|
1350
|
+
}
|
|
1351
|
+
interface $ZodFunction<Args extends $ZodFunctionIn = $ZodFunctionIn, Returns extends $ZodFunctionOut = $ZodFunctionOut> extends $ZodType<any, any, $ZodFunctionInternals<Args, Returns>> {
|
|
1352
|
+
/** @deprecated */
|
|
1353
|
+
_def: $ZodFunctionDef<Args, Returns>;
|
|
1354
|
+
_input: $InferInnerFunctionType<Args, Returns>;
|
|
1355
|
+
_output: $InferOuterFunctionType<Args, Returns>;
|
|
1356
|
+
implement<F extends $InferInnerFunctionType<Args, Returns>>(func: F): (...args: Parameters<this["_output"]>) => ReturnType<F> extends ReturnType<this["_output"]> ? ReturnType<F> : ReturnType<this["_output"]>;
|
|
1357
|
+
implementAsync<F extends $InferInnerFunctionTypeAsync<Args, Returns>>(func: F): F extends $InferOuterFunctionTypeAsync<Args, Returns> ? F : $InferOuterFunctionTypeAsync<Args, Returns>;
|
|
1358
|
+
input<const Items extends TupleItems, const Rest extends $ZodFunctionOut = $ZodFunctionOut>(args: Items, rest?: Rest): $ZodFunction<$ZodTuple<Items, Rest>, Returns>;
|
|
1359
|
+
input<NewArgs extends $ZodFunctionIn>(args: NewArgs): $ZodFunction<NewArgs, Returns>;
|
|
1360
|
+
input(...args: any[]): $ZodFunction<any, Returns>;
|
|
1361
|
+
output<NewReturns extends $ZodType>(output: NewReturns): $ZodFunction<Args, NewReturns>;
|
|
1362
|
+
}
|
|
1363
|
+
declare const $ZodFunction: $constructor<$ZodFunction>;
|
|
1364
|
+
interface $ZodPromiseDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1365
|
+
type: "promise";
|
|
1366
|
+
innerType: T;
|
|
1367
|
+
}
|
|
1368
|
+
interface $ZodPromiseInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<Promise<output<T>>, MaybeAsync<input<T>>> {
|
|
1369
|
+
def: $ZodPromiseDef<T>;
|
|
1370
|
+
isst: never;
|
|
1371
|
+
}
|
|
1372
|
+
interface $ZodPromise<T extends SomeType = $ZodType> extends $ZodType {
|
|
1373
|
+
_zod: $ZodPromiseInternals<T>;
|
|
1374
|
+
}
|
|
1375
|
+
declare const $ZodPromise: $constructor<$ZodPromise>;
|
|
1376
|
+
interface $ZodLazyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1377
|
+
type: "lazy";
|
|
1378
|
+
getter: () => T;
|
|
1379
|
+
}
|
|
1380
|
+
interface $ZodLazyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T>, input<T>> {
|
|
1381
|
+
def: $ZodLazyDef<T>;
|
|
1382
|
+
isst: never;
|
|
1383
|
+
/** Auto-cached way to retrieve the inner schema */
|
|
1384
|
+
innerType: T;
|
|
1385
|
+
pattern: T["_zod"]["pattern"];
|
|
1386
|
+
propValues: T["_zod"]["propValues"];
|
|
1387
|
+
optin: T["_zod"]["optin"];
|
|
1388
|
+
optout: T["_zod"]["optout"];
|
|
1389
|
+
}
|
|
1390
|
+
interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
|
|
1391
|
+
_zod: $ZodLazyInternals<T>;
|
|
1392
|
+
}
|
|
1393
|
+
declare const $ZodLazy: $constructor<$ZodLazy>;
|
|
1394
|
+
interface $ZodCustomDef<O = unknown> extends $ZodTypeDef, $ZodCheckDef {
|
|
1395
|
+
type: "custom";
|
|
1396
|
+
check: "custom";
|
|
1397
|
+
path?: PropertyKey[] | undefined;
|
|
1398
|
+
error?: $ZodErrorMap | undefined;
|
|
1399
|
+
params?: Record<string, any> | undefined;
|
|
1400
|
+
fn: (arg: O) => unknown;
|
|
1401
|
+
}
|
|
1402
|
+
interface $ZodCustomInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I>, $ZodCheckInternals<O> {
|
|
1403
|
+
def: $ZodCustomDef;
|
|
1404
|
+
issc: $ZodIssue;
|
|
1405
|
+
isst: never;
|
|
1406
|
+
bag: LoosePartial<{
|
|
1407
|
+
Class: typeof Class;
|
|
1408
|
+
}>;
|
|
1409
|
+
}
|
|
1410
|
+
interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
|
|
1411
|
+
_zod: $ZodCustomInternals<O, I>;
|
|
1412
|
+
}
|
|
1413
|
+
declare const $ZodCustom: $constructor<$ZodCustom>;
|
|
1414
|
+
interface $ZodPropertiesDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef, $ZodCheckDef {
|
|
1415
|
+
type: "properties";
|
|
1416
|
+
check: "properties";
|
|
1417
|
+
shape: Shape;
|
|
1418
|
+
}
|
|
1419
|
+
interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape> extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>, $ZodCheckInternals<{ -readonly [k in keyof Shape]: Widen<input<Shape[k]>>; }> {
|
|
1420
|
+
def: $ZodPropertiesDef<Shape>;
|
|
1421
|
+
isst: $ZodIssueInvalidType;
|
|
1422
|
+
issc: $ZodIssue;
|
|
1423
|
+
}
|
|
1424
|
+
interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
|
|
1425
|
+
_zod: $ZodPropertiesInternals<Shape>;
|
|
1426
|
+
[Symbol.iterator](): Iterator<this>;
|
|
1427
|
+
}
|
|
1428
|
+
declare const $ZodProperties: $constructor<$ZodProperties>;
|
|
1429
|
+
type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodProperties | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
|
|
1430
|
+
//#endregion
|
|
1431
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/checks.d.cts
|
|
1432
|
+
interface $ZodCheckDef {
|
|
1433
|
+
check: string;
|
|
1434
|
+
error?: $ZodErrorMap<never> | undefined;
|
|
1435
|
+
/** If true, no later checks will be executed if this check fails. Default `false`. */
|
|
1436
|
+
abort?: boolean | undefined;
|
|
1437
|
+
/** If provided, the check runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
|
|
1438
|
+
when?: ((payload: ParsePayload) => boolean) | undefined;
|
|
1439
|
+
}
|
|
1440
|
+
interface $ZodCheckInternals<T> {
|
|
1441
|
+
def: $ZodCheckDef;
|
|
1442
|
+
/** The set of issues this check might throw. */
|
|
1443
|
+
issc?: $ZodIssueBase;
|
|
1444
|
+
check(payload: ParsePayload<T>): MaybeAsync<void>;
|
|
1445
|
+
onattach: ((schema: $ZodType) => void)[];
|
|
1446
|
+
}
|
|
1447
|
+
interface $ZodCheck<in T = never> {
|
|
1448
|
+
_zod: $ZodCheckInternals<T>;
|
|
1449
|
+
}
|
|
1450
|
+
declare const $ZodCheck: $constructor<$ZodCheck<any>>;
|
|
1451
|
+
interface $ZodCheckLessThanDef extends $ZodCheckDef {
|
|
1452
|
+
check: "less_than";
|
|
1453
|
+
value: Numeric;
|
|
1454
|
+
inclusive: boolean;
|
|
1455
|
+
}
|
|
1456
|
+
interface $ZodCheckLessThanInternals<T extends Numeric = Numeric> extends $ZodCheckInternals<T> {
|
|
1457
|
+
def: $ZodCheckLessThanDef;
|
|
1458
|
+
issc: $ZodIssueTooBig<T>;
|
|
1459
|
+
}
|
|
1460
|
+
interface $ZodCheckLessThan<T extends Numeric = Numeric> extends $ZodCheck<T> {
|
|
1461
|
+
_zod: $ZodCheckLessThanInternals<T>;
|
|
1462
|
+
}
|
|
1463
|
+
declare const $ZodCheckLessThan: $constructor<$ZodCheckLessThan>;
|
|
1464
|
+
interface $ZodCheckGreaterThanDef extends $ZodCheckDef {
|
|
1465
|
+
check: "greater_than";
|
|
1466
|
+
value: Numeric;
|
|
1467
|
+
inclusive: boolean;
|
|
1468
|
+
}
|
|
1469
|
+
interface $ZodCheckGreaterThanInternals<T extends Numeric = Numeric> extends $ZodCheckInternals<T> {
|
|
1470
|
+
def: $ZodCheckGreaterThanDef;
|
|
1471
|
+
issc: $ZodIssueTooSmall<T>;
|
|
1472
|
+
}
|
|
1473
|
+
interface $ZodCheckGreaterThan<T extends Numeric = Numeric> extends $ZodCheck<T> {
|
|
1474
|
+
_zod: $ZodCheckGreaterThanInternals<T>;
|
|
1475
|
+
}
|
|
1476
|
+
declare const $ZodCheckGreaterThan: $constructor<$ZodCheckGreaterThan>;
|
|
1477
|
+
interface $ZodCheckMultipleOfDef<T extends number | bigint = number | bigint> extends $ZodCheckDef {
|
|
1478
|
+
check: "multiple_of";
|
|
1479
|
+
value: T;
|
|
1480
|
+
}
|
|
1481
|
+
interface $ZodCheckMultipleOfInternals<T extends number | bigint = number | bigint> extends $ZodCheckInternals<T> {
|
|
1482
|
+
def: $ZodCheckMultipleOfDef<T>;
|
|
1483
|
+
issc: $ZodIssueNotMultipleOf;
|
|
1484
|
+
}
|
|
1485
|
+
interface $ZodCheckMultipleOf<T extends number | bigint = number | bigint> extends $ZodCheck<T> {
|
|
1486
|
+
_zod: $ZodCheckMultipleOfInternals<T>;
|
|
1487
|
+
}
|
|
1488
|
+
declare const $ZodCheckMultipleOf: $constructor<$ZodCheckMultipleOf<number | bigint>>;
|
|
1489
|
+
type $ZodNumberFormats = "int32" | "uint32" | "float32" | "float64" | "safeint";
|
|
1490
|
+
interface $ZodCheckNumberFormatDef<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodCheckDef {
|
|
1491
|
+
check: "number_format";
|
|
1492
|
+
format: Format;
|
|
1493
|
+
}
|
|
1494
|
+
interface $ZodCheckNumberFormatInternals<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodCheckInternals<number> {
|
|
1495
|
+
def: $ZodCheckNumberFormatDef<Format>;
|
|
1496
|
+
issc: $ZodIssueInvalidType | $ZodIssueTooBig<"number"> | $ZodIssueTooSmall<"number">;
|
|
1497
|
+
}
|
|
1498
|
+
interface $ZodCheckNumberFormat<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodCheck<number> {
|
|
1499
|
+
_zod: $ZodCheckNumberFormatInternals<Format>;
|
|
1500
|
+
}
|
|
1501
|
+
declare const $ZodCheckNumberFormat: $constructor<$ZodCheckNumberFormat>;
|
|
1502
|
+
interface $ZodCheckMaxLengthDef extends $ZodCheckDef {
|
|
1503
|
+
check: "max_length";
|
|
1504
|
+
maximum: number;
|
|
1505
|
+
}
|
|
1506
|
+
interface $ZodCheckMaxLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
|
|
1507
|
+
def: $ZodCheckMaxLengthDef;
|
|
1508
|
+
issc: $ZodIssueTooBig<T>;
|
|
1509
|
+
}
|
|
1510
|
+
interface $ZodCheckMaxLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
|
|
1511
|
+
_zod: $ZodCheckMaxLengthInternals<T>;
|
|
1512
|
+
}
|
|
1513
|
+
declare const $ZodCheckMaxLength: $constructor<$ZodCheckMaxLength>;
|
|
1514
|
+
interface $ZodCheckMinLengthDef extends $ZodCheckDef {
|
|
1515
|
+
check: "min_length";
|
|
1516
|
+
minimum: number;
|
|
1517
|
+
}
|
|
1518
|
+
interface $ZodCheckMinLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
|
|
1519
|
+
def: $ZodCheckMinLengthDef;
|
|
1520
|
+
issc: $ZodIssueTooSmall<T>;
|
|
1521
|
+
}
|
|
1522
|
+
interface $ZodCheckMinLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
|
|
1523
|
+
_zod: $ZodCheckMinLengthInternals<T>;
|
|
1524
|
+
}
|
|
1525
|
+
declare const $ZodCheckMinLength: $constructor<$ZodCheckMinLength>;
|
|
1526
|
+
interface $ZodCheckLengthEqualsDef extends $ZodCheckDef {
|
|
1527
|
+
check: "length_equals";
|
|
1528
|
+
length: number;
|
|
1529
|
+
}
|
|
1530
|
+
interface $ZodCheckLengthEqualsInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
|
|
1531
|
+
def: $ZodCheckLengthEqualsDef;
|
|
1532
|
+
issc: $ZodIssueTooBig<T> | $ZodIssueTooSmall<T>;
|
|
1533
|
+
}
|
|
1534
|
+
interface $ZodCheckLengthEquals<T extends HasLength = HasLength> extends $ZodCheck<T> {
|
|
1535
|
+
_zod: $ZodCheckLengthEqualsInternals<T>;
|
|
1536
|
+
}
|
|
1537
|
+
declare const $ZodCheckLengthEquals: $constructor<$ZodCheckLengthEquals>;
|
|
1538
|
+
type $ZodStringFormats = "email" | "url" | "emoji" | "uuid" | "guid" | "nanoid" | "cuid" | "cuid2" | "ulid" | "xid" | "ksuid" | "datetime" | "date" | "time" | "duration" | "ipv4" | "ipv6" | "cidrv4" | "cidrv6" | "base64" | "base64url" | "json_string" | "e164" | "credit_card" | "iban" | "lowercase" | "uppercase" | "regex" | "jwt" | "starts_with" | "ends_with" | "includes";
|
|
1539
|
+
interface $ZodCheckStringFormatDef<Format extends string = string> extends $ZodCheckDef {
|
|
1540
|
+
check: "string_format";
|
|
1541
|
+
format: Format;
|
|
1542
|
+
pattern?: RegExp | undefined;
|
|
1543
|
+
}
|
|
1544
|
+
interface $ZodCheckStringFormatInternals extends $ZodCheckInternals<string> {
|
|
1545
|
+
def: $ZodCheckStringFormatDef;
|
|
1546
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
1547
|
+
}
|
|
1548
|
+
interface $ZodCheckRegexDef extends $ZodCheckStringFormatDef {
|
|
1549
|
+
format: "regex";
|
|
1550
|
+
pattern: RegExp;
|
|
1551
|
+
}
|
|
1552
|
+
interface $ZodCheckRegexInternals extends $ZodCheckInternals<string> {
|
|
1553
|
+
def: $ZodCheckRegexDef;
|
|
1554
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
1555
|
+
}
|
|
1556
|
+
interface $ZodCheckRegex extends $ZodCheck<string> {
|
|
1557
|
+
_zod: $ZodCheckRegexInternals;
|
|
1558
|
+
}
|
|
1559
|
+
declare const $ZodCheckRegex: $constructor<$ZodCheckRegex>;
|
|
1560
|
+
interface $ZodCheckLowerCaseDef extends $ZodCheckStringFormatDef<"lowercase"> {}
|
|
1561
|
+
interface $ZodCheckLowerCaseInternals extends $ZodCheckInternals<string> {
|
|
1562
|
+
def: $ZodCheckLowerCaseDef;
|
|
1563
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
1564
|
+
}
|
|
1565
|
+
interface $ZodCheckLowerCase extends $ZodCheck<string> {
|
|
1566
|
+
_zod: $ZodCheckLowerCaseInternals;
|
|
1567
|
+
}
|
|
1568
|
+
declare const $ZodCheckLowerCase: $constructor<$ZodCheckLowerCase>;
|
|
1569
|
+
interface $ZodCheckUpperCaseDef extends $ZodCheckStringFormatDef<"uppercase"> {}
|
|
1570
|
+
interface $ZodCheckUpperCaseInternals extends $ZodCheckInternals<string> {
|
|
1571
|
+
def: $ZodCheckUpperCaseDef;
|
|
1572
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
1573
|
+
}
|
|
1574
|
+
interface $ZodCheckUpperCase extends $ZodCheck<string> {
|
|
1575
|
+
_zod: $ZodCheckUpperCaseInternals;
|
|
1576
|
+
}
|
|
1577
|
+
declare const $ZodCheckUpperCase: $constructor<$ZodCheckUpperCase>;
|
|
1578
|
+
interface $ZodCheckIncludesDef extends $ZodCheckStringFormatDef<"includes"> {
|
|
1579
|
+
includes: string;
|
|
1580
|
+
position?: number | undefined;
|
|
1581
|
+
}
|
|
1582
|
+
interface $ZodCheckIncludesInternals extends $ZodCheckInternals<string> {
|
|
1583
|
+
def: $ZodCheckIncludesDef;
|
|
1584
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
1585
|
+
}
|
|
1586
|
+
interface $ZodCheckIncludes extends $ZodCheck<string> {
|
|
1587
|
+
_zod: $ZodCheckIncludesInternals;
|
|
1588
|
+
}
|
|
1589
|
+
declare const $ZodCheckIncludes: $constructor<$ZodCheckIncludes>;
|
|
1590
|
+
interface $ZodCheckStartsWithDef extends $ZodCheckStringFormatDef<"starts_with"> {
|
|
1591
|
+
prefix: string;
|
|
1592
|
+
}
|
|
1593
|
+
interface $ZodCheckStartsWithInternals extends $ZodCheckInternals<string> {
|
|
1594
|
+
def: $ZodCheckStartsWithDef;
|
|
1595
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
1596
|
+
}
|
|
1597
|
+
interface $ZodCheckStartsWith extends $ZodCheck<string> {
|
|
1598
|
+
_zod: $ZodCheckStartsWithInternals;
|
|
1599
|
+
}
|
|
1600
|
+
declare const $ZodCheckStartsWith: $constructor<$ZodCheckStartsWith>;
|
|
1601
|
+
interface $ZodCheckEndsWithDef extends $ZodCheckStringFormatDef<"ends_with"> {
|
|
1602
|
+
suffix: string;
|
|
1603
|
+
}
|
|
1604
|
+
interface $ZodCheckEndsWithInternals extends $ZodCheckInternals<string> {
|
|
1605
|
+
def: $ZodCheckEndsWithDef;
|
|
1606
|
+
issc: $ZodIssueInvalidStringFormat;
|
|
1607
|
+
}
|
|
1608
|
+
interface $ZodCheckEndsWith extends $ZodCheckInternals<string> {
|
|
1609
|
+
_zod: $ZodCheckEndsWithInternals;
|
|
1610
|
+
}
|
|
1611
|
+
declare const $ZodCheckEndsWith: $constructor<$ZodCheckEndsWith>;
|
|
1612
|
+
//#endregion
|
|
1613
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/errors.d.cts
|
|
1614
|
+
interface $ZodIssueBase {
|
|
1615
|
+
readonly code?: string;
|
|
1616
|
+
readonly input?: unknown;
|
|
1617
|
+
readonly path: PropertyKey[];
|
|
1618
|
+
readonly message: string;
|
|
1619
|
+
}
|
|
1620
|
+
type $ZodInvalidTypeExpected = "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "never" | "void" | "date" | "array" | "object" | "tuple" | "record" | "map" | "set" | "file" | "nonoptional" | "nan" | "function" | (string & {});
|
|
1621
|
+
interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
|
|
1622
|
+
readonly code: "invalid_type";
|
|
1623
|
+
readonly expected: $ZodInvalidTypeExpected;
|
|
1624
|
+
readonly input?: Input;
|
|
1625
|
+
}
|
|
1626
|
+
interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
|
|
1627
|
+
readonly code: "too_big";
|
|
1628
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
1629
|
+
readonly maximum: number | bigint;
|
|
1630
|
+
readonly inclusive?: boolean;
|
|
1631
|
+
readonly exact?: boolean;
|
|
1632
|
+
readonly input?: Input;
|
|
1633
|
+
}
|
|
1634
|
+
interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
|
|
1635
|
+
readonly code: "too_small";
|
|
1636
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
1637
|
+
readonly minimum: number | bigint;
|
|
1638
|
+
/** True if the allowable range includes the minimum */
|
|
1639
|
+
readonly inclusive?: boolean;
|
|
1640
|
+
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
|
|
1641
|
+
readonly exact?: boolean;
|
|
1642
|
+
readonly input?: Input;
|
|
1643
|
+
}
|
|
1644
|
+
interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
|
|
1645
|
+
readonly code: "invalid_format";
|
|
1646
|
+
readonly format: $ZodStringFormats | (string & {});
|
|
1647
|
+
readonly pattern?: string;
|
|
1648
|
+
readonly input?: string;
|
|
1649
|
+
}
|
|
1650
|
+
interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
|
|
1651
|
+
readonly code: "not_multiple_of";
|
|
1652
|
+
readonly divisor: number;
|
|
1653
|
+
readonly input?: Input;
|
|
1654
|
+
}
|
|
1655
|
+
interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
|
|
1656
|
+
readonly code: "unrecognized_keys";
|
|
1657
|
+
readonly keys: string[];
|
|
1658
|
+
readonly input?: Record<string, unknown>;
|
|
1659
|
+
}
|
|
1660
|
+
interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
|
|
1661
|
+
readonly code: "invalid_union";
|
|
1662
|
+
readonly errors: $ZodIssue[][];
|
|
1663
|
+
readonly input?: unknown;
|
|
1664
|
+
readonly discriminator?: string | undefined;
|
|
1665
|
+
readonly options?: Primitive[];
|
|
1666
|
+
readonly inclusive?: true;
|
|
1667
|
+
}
|
|
1668
|
+
interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
|
|
1669
|
+
readonly code: "invalid_union";
|
|
1670
|
+
readonly errors: [];
|
|
1671
|
+
readonly input?: unknown;
|
|
1672
|
+
readonly discriminator?: string | undefined;
|
|
1673
|
+
readonly inclusive: false;
|
|
1674
|
+
/** Indices of the options that matched */
|
|
1675
|
+
readonly matches: number[];
|
|
1676
|
+
}
|
|
1677
|
+
type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;
|
|
1678
|
+
interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
|
|
1679
|
+
readonly code: "invalid_key";
|
|
1680
|
+
readonly origin: "map" | "record";
|
|
1681
|
+
readonly issues: $ZodIssue[];
|
|
1682
|
+
readonly input?: Input;
|
|
1683
|
+
}
|
|
1684
|
+
interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
|
|
1685
|
+
readonly code: "invalid_element";
|
|
1686
|
+
readonly origin: "map" | "set";
|
|
1687
|
+
readonly key: unknown;
|
|
1688
|
+
readonly issues: $ZodIssue[];
|
|
1689
|
+
readonly input?: Input;
|
|
1690
|
+
}
|
|
1691
|
+
interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
|
|
1692
|
+
readonly code: "invalid_value";
|
|
1693
|
+
readonly values: Primitive[];
|
|
1694
|
+
readonly input?: Input;
|
|
1695
|
+
}
|
|
1696
|
+
interface $ZodIssueCustom extends $ZodIssueBase {
|
|
1697
|
+
readonly code: "custom";
|
|
1698
|
+
readonly params?: Record<string, any> | undefined;
|
|
1699
|
+
readonly input?: unknown;
|
|
1700
|
+
}
|
|
1701
|
+
type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
|
|
1702
|
+
type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue$1<T> : never;
|
|
1703
|
+
type RawIssue$1<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
|
|
1704
|
+
/** The input data */
|
|
1705
|
+
readonly input: unknown;
|
|
1706
|
+
/** The schema or check that originated this issue. */
|
|
1707
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
1708
|
+
/** The schema that owns the issue. Equal to `inst` when a schema originated the issue, and the schema the check was attached to when a check did. */
|
|
1709
|
+
readonly schema?: $ZodType | undefined;
|
|
1710
|
+
/** If `true`, Zod will continue executing checks/refinements after this issue. */
|
|
1711
|
+
readonly continue?: boolean | undefined;
|
|
1712
|
+
} & Record<string, unknown>> : never;
|
|
1713
|
+
type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
|
|
1714
|
+
interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
|
|
1715
|
+
(issue: $ZodRawIssue<T>): {
|
|
1716
|
+
message: string;
|
|
1717
|
+
} | string | undefined | null;
|
|
1718
|
+
}
|
|
1719
|
+
interface $ZodError<T = unknown> extends Error {
|
|
1720
|
+
type: T;
|
|
1721
|
+
issues: $ZodIssue[];
|
|
1722
|
+
_zod: {
|
|
1723
|
+
output: T;
|
|
1724
|
+
def: $ZodIssue[];
|
|
1725
|
+
};
|
|
1726
|
+
stack?: string;
|
|
1727
|
+
name: string;
|
|
1728
|
+
}
|
|
1729
|
+
declare const $ZodError: $constructor<$ZodError>;
|
|
1730
|
+
type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
|
|
1731
|
+
type _FlattenedError<T, U = string> = {
|
|
1732
|
+
formErrors: U[];
|
|
1733
|
+
fieldErrors: { [P in keyof T]?: U[]; };
|
|
1734
|
+
};
|
|
1735
|
+
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? { [K in keyof T]?: $ZodFormattedError<T[K], U>; } : T extends any[] ? {
|
|
1736
|
+
[k: number]: $ZodFormattedError<T[number], U>;
|
|
1737
|
+
} : T extends object ? Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U>; }> : any;
|
|
1738
|
+
type $ZodFormattedError<T, U = string> = {
|
|
1739
|
+
_errors: U[];
|
|
1740
|
+
} & Flatten<_ZodFormattedError<T, U>>;
|
|
1741
|
+
//#endregion
|
|
1742
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/core.d.cts
|
|
1743
|
+
type ZodTrait = {
|
|
1744
|
+
_zod: {
|
|
1745
|
+
def: any;
|
|
1746
|
+
[k: string]: any;
|
|
1747
|
+
};
|
|
1748
|
+
};
|
|
1749
|
+
interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
|
|
1750
|
+
new (def: D): T;
|
|
1751
|
+
init(inst: T, def: D): asserts inst is T;
|
|
1752
|
+
}
|
|
1753
|
+
interface $constructorParams {
|
|
1754
|
+
Parent?: typeof Class;
|
|
1755
|
+
}
|
|
1756
|
+
declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void,
|
|
1757
|
+
/** This trait's members, installed once on every prototype that composes it. They cannot be declared in the initializer above: that runs per instance, and the prototype is shared. */
|
|
1758
|
+
proto?: ProtoOf<T>, params?: $constructorParams): $constructor<T, D>;
|
|
1759
|
+
declare const $brand: unique symbol;
|
|
1760
|
+
type $brand<T extends string | number | symbol = string | number | symbol> = {
|
|
1761
|
+
[$brand]: { [k in T]: true; };
|
|
1762
|
+
};
|
|
1763
|
+
type $ZodBranded<T extends SomeType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
|
|
1764
|
+
_zod: {
|
|
1765
|
+
input: input<T> & $brand<Brand>;
|
|
1766
|
+
output: output<T> & $brand<Brand>;
|
|
1767
|
+
};
|
|
1768
|
+
} : Dir extends "in" ? {
|
|
1769
|
+
_zod: {
|
|
1770
|
+
input: input<T> & $brand<Brand>;
|
|
1771
|
+
};
|
|
1772
|
+
} : {
|
|
1773
|
+
_zod: {
|
|
1774
|
+
output: output<T> & $brand<Brand>;
|
|
1775
|
+
};
|
|
1776
|
+
});
|
|
1777
|
+
type input<T> = T extends {
|
|
1778
|
+
_zod: {
|
|
1779
|
+
input: any;
|
|
1780
|
+
};
|
|
1781
|
+
} ? T["_zod"]["input"] : unknown;
|
|
1782
|
+
type output<T> = T extends {
|
|
1783
|
+
_zod: {
|
|
1784
|
+
output: any;
|
|
1785
|
+
};
|
|
1786
|
+
} ? T["_zod"]["output"] : unknown;
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/core/api.d.cts
|
|
1789
|
+
type Params<T extends $ZodType | $ZodCheck, IssueTypes extends $ZodIssueBase, OmitKeys extends keyof T["_zod"]["def"] = never> = Flatten<Partial<EmptyToNever<Omit<T["_zod"]["def"], OmitKeys> & ([IssueTypes] extends [never] ? {} : {
|
|
1790
|
+
error?: string | $ZodErrorMap<IssueTypes> | undefined;
|
|
1791
|
+
/** @deprecated This parameter is deprecated. Use `error` instead. */
|
|
1792
|
+
message?: string | undefined;
|
|
1793
|
+
})>>>;
|
|
1794
|
+
type TypeParams<T extends $ZodType = $ZodType & {
|
|
1795
|
+
_isst: never;
|
|
1796
|
+
}, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error"> = never> = Params<T, NonNullable<T["_zod"]["isst"]>, "type" | "checks" | "error" | AlsoOmit>;
|
|
1797
|
+
type CheckParams<T extends $ZodCheck = $ZodCheck // & { _issc: never },
|
|
1798
|
+
, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
|
|
1799
|
+
type CheckStringFormatParams<T extends $ZodStringFormat = $ZodStringFormat, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "coerce" | "checks" | "error" | "check" | "format"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "type" | "coerce" | "checks" | "error" | "check" | "format" | AlsoOmit>;
|
|
1800
|
+
type CheckTypeParams<T extends $ZodType & $ZodCheck = $ZodType & $ZodCheck, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error" | "check"> = never> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
|
|
1801
|
+
type $ZodCheckEmailParams = CheckStringFormatParams<$ZodEmail, "when">;
|
|
1802
|
+
type $ZodCheckGUIDParams = CheckStringFormatParams<$ZodGUID, "pattern" | "when">;
|
|
1803
|
+
type $ZodCheckUUIDParams = CheckStringFormatParams<$ZodUUID, "pattern" | "when">;
|
|
1804
|
+
type $ZodCheckURLParams = CheckStringFormatParams<$ZodURL, "when">;
|
|
1805
|
+
type $ZodCheckEmojiParams = CheckStringFormatParams<$ZodEmoji, "when">;
|
|
1806
|
+
type $ZodCheckNanoIDParams = CheckStringFormatParams<$ZodNanoID, "when" | "pattern">;
|
|
1807
|
+
/**
|
|
1808
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1809
|
+
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
1810
|
+
* See https://github.com/paralleldrive/cuid.
|
|
1811
|
+
*/
|
|
1812
|
+
type $ZodCheckCUIDParams = CheckStringFormatParams<$ZodCUID, "when">;
|
|
1813
|
+
type $ZodCheckCUID2Params = CheckStringFormatParams<$ZodCUID2, "when">;
|
|
1814
|
+
type $ZodCheckULIDParams = CheckStringFormatParams<$ZodULID, "when">;
|
|
1815
|
+
type $ZodCheckXIDParams = CheckStringFormatParams<$ZodXID, "when">;
|
|
1816
|
+
type $ZodCheckKSUIDParams = CheckStringFormatParams<$ZodKSUID, "when">;
|
|
1817
|
+
type $ZodCheckIPv4Params = CheckStringFormatParams<$ZodIPv4, "pattern" | "when" | "version">;
|
|
1818
|
+
type $ZodCheckIPv6Params = CheckStringFormatParams<$ZodIPv6, "pattern" | "when" | "version">;
|
|
1819
|
+
type $ZodCheckCIDRv4Params = CheckStringFormatParams<$ZodCIDRv4, "pattern" | "when">;
|
|
1820
|
+
type $ZodCheckCIDRv6Params = CheckStringFormatParams<$ZodCIDRv6, "pattern" | "when">;
|
|
1821
|
+
type $ZodCheckBase64Params = CheckStringFormatParams<$ZodBase64, "pattern" | "when">;
|
|
1822
|
+
type $ZodCheckBase64URLParams = CheckStringFormatParams<$ZodBase64URL, "pattern" | "when">;
|
|
1823
|
+
type $ZodCheckE164Params = CheckStringFormatParams<$ZodE164, "when">;
|
|
1824
|
+
type $ZodCheckJWTParams = CheckStringFormatParams<$ZodJWT, "pattern" | "when">;
|
|
1825
|
+
type $ZodCheckISODateTimeParams = CheckStringFormatParams<$ZodISODateTime, "pattern" | "when">;
|
|
1826
|
+
type $ZodCheckISODateParams = CheckStringFormatParams<$ZodISODate, "pattern" | "when">;
|
|
1827
|
+
type $ZodCheckISOTimeParams = CheckStringFormatParams<$ZodISOTime, "pattern" | "when">;
|
|
1828
|
+
type $ZodCheckISODurationParams = CheckStringFormatParams<$ZodISODuration, "when">;
|
|
1829
|
+
type $ZodCheckNumberFormatParams = CheckParams<$ZodCheckNumberFormat, "format" | "when">;
|
|
1830
|
+
type $ZodCheckLessThanParams = CheckParams<$ZodCheckLessThan, "inclusive" | "value" | "when">;
|
|
1831
|
+
type $ZodCheckGreaterThanParams = CheckParams<$ZodCheckGreaterThan, "inclusive" | "value" | "when">;
|
|
1832
|
+
type $ZodCheckMultipleOfParams = CheckParams<$ZodCheckMultipleOf, "value" | "when">;
|
|
1833
|
+
type $ZodCheckMaxLengthParams = CheckParams<$ZodCheckMaxLength, "maximum" | "when">;
|
|
1834
|
+
type $ZodCheckMinLengthParams = CheckParams<$ZodCheckMinLength, "minimum" | "when">;
|
|
1835
|
+
type $ZodCheckLengthEqualsParams = CheckParams<$ZodCheckLengthEquals, "length" | "when">;
|
|
1836
|
+
type $ZodCheckRegexParams = CheckParams<$ZodCheckRegex, "format" | "pattern" | "when">;
|
|
1837
|
+
type $ZodCheckLowerCaseParams = CheckParams<$ZodCheckLowerCase, "format" | "when">;
|
|
1838
|
+
type $ZodCheckUpperCaseParams = CheckParams<$ZodCheckUpperCase, "format" | "when">;
|
|
1839
|
+
type $ZodCheckIncludesParams = CheckParams<$ZodCheckIncludes, "includes" | "format" | "when" | "pattern">;
|
|
1840
|
+
type $ZodCheckStartsWithParams = CheckParams<$ZodCheckStartsWith, "prefix" | "format" | "when" | "pattern">;
|
|
1841
|
+
type $ZodCheckEndsWithParams = CheckParams<$ZodCheckEndsWith, "suffix" | "format" | "pattern" | "when">;
|
|
1842
|
+
type $ZodEnumParams = TypeParams<$ZodEnum, "entries">;
|
|
1843
|
+
type $ZodNonOptionalParams = TypeParams<$ZodNonOptional, "innerType">;
|
|
1844
|
+
type $ZodCustomParams = CheckTypeParams<$ZodCustom, "fn">;
|
|
1845
|
+
type $ZodSuperRefineIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
|
|
1846
|
+
type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
|
|
1847
|
+
/** The schema or check that originated this issue. */
|
|
1848
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
1849
|
+
/** If `true`, Zod will execute subsequent checks/refinements instead of immediately aborting */
|
|
1850
|
+
readonly continue?: boolean | undefined;
|
|
1851
|
+
} & Record<string, unknown>> : never;
|
|
1852
|
+
interface $RefinementCtx<T = unknown> extends ParsePayload<T> {
|
|
1853
|
+
addIssue(arg: string | $ZodSuperRefineIssue): void;
|
|
1854
|
+
}
|
|
1855
|
+
interface $ZodSuperRefineParams {
|
|
1856
|
+
/** If provided, the refinement runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
|
|
1857
|
+
when?: ((payload: ParsePayload) => boolean) | undefined;
|
|
1858
|
+
}
|
|
1859
|
+
//#endregion
|
|
1860
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/errors.d.cts
|
|
1861
|
+
/** An Error-like class used to store Zod validation issues. */
|
|
1862
|
+
interface ZodError<T = unknown> extends $ZodError<T> {
|
|
1863
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
1864
|
+
format(): $ZodFormattedError<T>;
|
|
1865
|
+
format<U>(mapper: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
|
|
1866
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
1867
|
+
flatten(): $ZodFlattenedError<T>;
|
|
1868
|
+
flatten<U>(mapper: (issue: $ZodIssue) => U): $ZodFlattenedError<T, U>;
|
|
1869
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
1870
|
+
addIssue(issue: $ZodIssue): void;
|
|
1871
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
1872
|
+
addIssues(issues: $ZodIssue[]): void;
|
|
1873
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
1874
|
+
isEmpty: boolean;
|
|
1875
|
+
}
|
|
1876
|
+
declare const ZodError: $constructor<ZodError>;
|
|
1877
|
+
//#endregion
|
|
1878
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/parse.d.cts
|
|
1879
|
+
type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
|
|
1880
|
+
type ZodSafeParseSuccess<T> = {
|
|
1881
|
+
success: true;
|
|
1882
|
+
data: T;
|
|
1883
|
+
error?: never;
|
|
1884
|
+
};
|
|
1885
|
+
type ZodSafeParseError<T> = {
|
|
1886
|
+
success: false;
|
|
1887
|
+
data?: never;
|
|
1888
|
+
error: ZodError<T>;
|
|
1889
|
+
};
|
|
1890
|
+
//#endregion
|
|
1891
|
+
//#region ../../node_modules/.pnpm/zod@4.6.1/node_modules/zod/v4/classic/schemas.d.cts
|
|
1892
|
+
type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<input<T>, output<T>>;
|
|
1893
|
+
interface ZodType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
|
|
1894
|
+
def: Internals["def"];
|
|
1895
|
+
type: Internals["def"]["type"];
|
|
1896
|
+
/** @deprecated Use `.def` instead. */
|
|
1897
|
+
_def: Internals["def"];
|
|
1898
|
+
/** @deprecated Use `z.output<typeof schema>` instead. */
|
|
1899
|
+
_output: Internals["output"];
|
|
1900
|
+
/** @deprecated Use `z.input<typeof schema>` instead. */
|
|
1901
|
+
_input: Internals["input"];
|
|
1902
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
1903
|
+
/** Converts this schema to a JSON Schema representation. */
|
|
1904
|
+
toJSONSchema(params?: ToJSONSchemaParams): ZodStandardJSONSchemaPayload<this>;
|
|
1905
|
+
check(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
|
|
1906
|
+
with(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
|
|
1907
|
+
clone(def?: Internals["def"], params?: {
|
|
1908
|
+
parent: boolean;
|
|
1909
|
+
}): this;
|
|
1910
|
+
register<R extends $ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [$replace<R["_meta"], this>?] : [$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
|
|
1911
|
+
brand<T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(value?: T): PropertyKey extends T ? this : $ZodBranded<this, T, Dir>;
|
|
1912
|
+
parse(data: unknown, params?: ParseContext<$ZodIssue>): output<this>;
|
|
1913
|
+
safeParse(data: unknown, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<output<this>>;
|
|
1914
|
+
parseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<output<this>>;
|
|
1915
|
+
safeParseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
|
|
1916
|
+
spa: (data: unknown, params?: ParseContext<$ZodIssue>) => Promise<ZodSafeParseResult<output<this>>>;
|
|
1917
|
+
validate(data: unknown, params?: ParseContext<$ZodIssue>): data is input<this>;
|
|
1918
|
+
validateAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<boolean>;
|
|
1919
|
+
encode(data: output<this>, params?: ParseContext<$ZodIssue>): input<this>;
|
|
1920
|
+
decode(data: input<this>, params?: ParseContext<$ZodIssue>): output<this>;
|
|
1921
|
+
encodeAsync(data: output<this>, params?: ParseContext<$ZodIssue>): Promise<input<this>>;
|
|
1922
|
+
decodeAsync(data: input<this>, params?: ParseContext<$ZodIssue>): Promise<output<this>>;
|
|
1923
|
+
safeEncode(data: output<this>, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<input<this>>;
|
|
1924
|
+
safeDecode(data: input<this>, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<output<this>>;
|
|
1925
|
+
safeEncodeAsync(data: output<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<input<this>>>;
|
|
1926
|
+
safeDecodeAsync(data: input<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
|
|
1927
|
+
refine<Ch extends (arg: output<this>) => unknown | Promise<unknown>>(check: Ch, params?: string | $ZodCustomParams): Ch extends ((arg: any) => arg is infer R) ? this & ZodType<R, input<this>> : this;
|
|
1928
|
+
superRefine(refinement: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => void | Promise<void>, params?: $ZodSuperRefineParams): this;
|
|
1929
|
+
overwrite(fn: (x: output<this>) => output<this>): this;
|
|
1930
|
+
optional(): ZodOptional<this>;
|
|
1931
|
+
exactOptional(): ZodExactOptional<this>;
|
|
1932
|
+
nonoptional(params?: string | $ZodNonOptionalParams): ZodNonOptional<this>;
|
|
1933
|
+
nullable(): ZodNullable<this>;
|
|
1934
|
+
nullish(): ZodOptional<ZodNullable<this>>;
|
|
1935
|
+
default(def: NoUndefined<output<this>>): ZodDefault<this>;
|
|
1936
|
+
default(def: () => NoUndefined<output<this>>): ZodDefault<this>;
|
|
1937
|
+
prefault(def: () => input<this>): ZodPrefault<this>;
|
|
1938
|
+
prefault(def: input<this>): ZodPrefault<this>;
|
|
1939
|
+
array(): ZodArray<this>;
|
|
1940
|
+
or<T extends SomeType>(option: T): ZodUnion<[this, T]>;
|
|
1941
|
+
and<T extends SomeType>(incoming: T): ZodIntersection<this, T>;
|
|
1942
|
+
transform<NewOut>(transform: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, output<this>>>;
|
|
1943
|
+
catch(def: output<this>): ZodCatch<this>;
|
|
1944
|
+
catch(def: (ctx: $ZodCatchCtx) => output<this>): ZodCatch<this>;
|
|
1945
|
+
pipe<T extends $ZodType<any, output<this>>>(target: T | $ZodType<any, output<this>>): ZodPipe<this, T>;
|
|
1946
|
+
readonly(): ZodReadonly<this>;
|
|
1947
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
|
|
1948
|
+
describe(description: string): this;
|
|
1949
|
+
description?: string;
|
|
1950
|
+
/** Returns the metadata associated with this instance in `z.globalRegistry` */
|
|
1951
|
+
meta(): $replace<GlobalMeta, this> | undefined;
|
|
1952
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
|
|
1953
|
+
meta(data: $replace<GlobalMeta, this>): this;
|
|
1954
|
+
/** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
|
|
1955
|
+
*
|
|
1956
|
+
* ```ts
|
|
1957
|
+
* const schema = z.string().optional();
|
|
1958
|
+
* const isOptional = schema.safeParse(undefined).success; // true
|
|
1959
|
+
* ```
|
|
1960
|
+
*/
|
|
1961
|
+
isOptional(): boolean;
|
|
1962
|
+
/**
|
|
1963
|
+
* @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
|
|
1964
|
+
*
|
|
1965
|
+
* ```ts
|
|
1966
|
+
* const schema = z.string().nullable();
|
|
1967
|
+
* const isNullable = schema.safeParse(null).success; // true
|
|
1968
|
+
* ```
|
|
1969
|
+
*/
|
|
1970
|
+
isNullable(): boolean;
|
|
1971
|
+
apply<T, TArgs extends unknown[] = []>(fn: (schema: this, ...args: TArgs) => T, ...args: TArgs): T;
|
|
1972
|
+
}
|
|
1973
|
+
interface _ZodType<out Internals extends $ZodTypeInternals = $ZodTypeInternals> extends ZodType<any, any, Internals> {}
|
|
1974
|
+
declare const ZodType: $constructor<ZodType>;
|
|
1975
|
+
interface _ZodString<T extends $ZodStringInternals<unknown> = $ZodStringInternals<unknown>> extends _ZodType<T> {
|
|
1976
|
+
format: string | null;
|
|
1977
|
+
minLength: number | null;
|
|
1978
|
+
maxLength: number | null;
|
|
1979
|
+
regex(regex: RegExp, params?: string | $ZodCheckRegexParams): this;
|
|
1980
|
+
includes(value: string, params?: string | $ZodCheckIncludesParams): this;
|
|
1981
|
+
startsWith(value: string, params?: string | $ZodCheckStartsWithParams): this;
|
|
1982
|
+
endsWith(value: string, params?: string | $ZodCheckEndsWithParams): this;
|
|
1983
|
+
min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
|
|
1984
|
+
max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
|
|
1985
|
+
length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
|
|
1986
|
+
nonempty(params?: string | $ZodCheckMinLengthParams): this;
|
|
1987
|
+
lowercase(params?: string | $ZodCheckLowerCaseParams): this;
|
|
1988
|
+
uppercase(params?: string | $ZodCheckUpperCaseParams): this;
|
|
1989
|
+
trim(): this;
|
|
1990
|
+
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
1991
|
+
toLowerCase(): this;
|
|
1992
|
+
toUpperCase(): this;
|
|
1993
|
+
slugify(): this;
|
|
1994
|
+
}
|
|
1995
|
+
/** @internal */
|
|
1996
|
+
declare const _ZodString: $constructor<_ZodString>;
|
|
1997
|
+
interface ZodString extends _ZodString<$ZodStringInternals<string>> {
|
|
1998
|
+
/** @deprecated Use `z.email()` instead. */
|
|
1999
|
+
email(params?: string | $ZodCheckEmailParams): this;
|
|
2000
|
+
/** @deprecated Use `z.url()` instead. */
|
|
2001
|
+
url(params?: string | $ZodCheckURLParams): this;
|
|
2002
|
+
/** @deprecated Use `z.jwt()` instead. */
|
|
2003
|
+
jwt(params?: string | $ZodCheckJWTParams): this;
|
|
2004
|
+
/** @deprecated Use `z.emoji()` instead. */
|
|
2005
|
+
emoji(params?: string | $ZodCheckEmojiParams): this;
|
|
2006
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
2007
|
+
guid(params?: string | $ZodCheckGUIDParams): this;
|
|
2008
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
2009
|
+
uuid(params?: string | $ZodCheckUUIDParams): this;
|
|
2010
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
2011
|
+
uuidv4(params?: string | $ZodCheckUUIDParams): this;
|
|
2012
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
2013
|
+
uuidv6(params?: string | $ZodCheckUUIDParams): this;
|
|
2014
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
2015
|
+
uuidv7(params?: string | $ZodCheckUUIDParams): this;
|
|
2016
|
+
/** @deprecated Use `z.nanoid()` instead. */
|
|
2017
|
+
nanoid(params?: string | $ZodCheckNanoIDParams): this;
|
|
2018
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
2019
|
+
guid(params?: string | $ZodCheckGUIDParams): this;
|
|
2020
|
+
/**
|
|
2021
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
2022
|
+
* (timestamps embedded in the id). Use `z.cuid2()` instead.
|
|
2023
|
+
* See https://github.com/paralleldrive/cuid.
|
|
2024
|
+
*/
|
|
2025
|
+
cuid(params?: string | $ZodCheckCUIDParams): this;
|
|
2026
|
+
/** @deprecated Use `z.cuid2()` instead. */
|
|
2027
|
+
cuid2(params?: string | $ZodCheckCUID2Params): this;
|
|
2028
|
+
/** @deprecated Use `z.ulid()` instead. */
|
|
2029
|
+
ulid(params?: string | $ZodCheckULIDParams): this;
|
|
2030
|
+
/** @deprecated Use `z.base64()` instead. */
|
|
2031
|
+
base64(params?: string | $ZodCheckBase64Params): this;
|
|
2032
|
+
/** @deprecated Use `z.base64url()` instead. */
|
|
2033
|
+
base64url(params?: string | $ZodCheckBase64URLParams): this;
|
|
2034
|
+
/** @deprecated Use `z.xid()` instead. */
|
|
2035
|
+
xid(params?: string | $ZodCheckXIDParams): this;
|
|
2036
|
+
/** @deprecated Use `z.ksuid()` instead. */
|
|
2037
|
+
ksuid(params?: string | $ZodCheckKSUIDParams): this;
|
|
2038
|
+
/** @deprecated Use `z.ipv4()` instead. */
|
|
2039
|
+
ipv4(params?: string | $ZodCheckIPv4Params): this;
|
|
2040
|
+
/** @deprecated Use `z.ipv6()` instead. */
|
|
2041
|
+
ipv6(params?: string | $ZodCheckIPv6Params): this;
|
|
2042
|
+
/** @deprecated Use `z.cidrv4()` instead. */
|
|
2043
|
+
cidrv4(params?: string | $ZodCheckCIDRv4Params): this;
|
|
2044
|
+
/** @deprecated Use `z.cidrv6()` instead. */
|
|
2045
|
+
cidrv6(params?: string | $ZodCheckCIDRv6Params): this;
|
|
2046
|
+
/** @deprecated Use `z.e164()` instead. */
|
|
2047
|
+
e164(params?: string | $ZodCheckE164Params): this;
|
|
2048
|
+
/** @deprecated Use `z.iso.datetime()` instead. */
|
|
2049
|
+
datetime(params?: string | $ZodCheckISODateTimeParams): this;
|
|
2050
|
+
/** @deprecated Use `z.iso.date()` instead. */
|
|
2051
|
+
date(params?: string | $ZodCheckISODateParams): this;
|
|
2052
|
+
/** @deprecated Use `z.iso.time()` instead. */
|
|
2053
|
+
time(params?: string | $ZodCheckISOTimeParams): this;
|
|
2054
|
+
/** @deprecated Use `z.iso.duration()` instead. */
|
|
2055
|
+
duration(params?: string | $ZodCheckISODurationParams): this;
|
|
2056
|
+
}
|
|
2057
|
+
declare const ZodString: $constructor<ZodString>;
|
|
2058
|
+
interface _ZodNumber<Internals extends $ZodNumberInternals = $ZodNumberInternals> extends _ZodType<Internals> {
|
|
2059
|
+
gt(value: number, params?: string | $ZodCheckGreaterThanParams): this;
|
|
2060
|
+
/** Identical to .min() */
|
|
2061
|
+
gte(value: number, params?: string | $ZodCheckGreaterThanParams): this;
|
|
2062
|
+
min(value: number, params?: string | $ZodCheckGreaterThanParams): this;
|
|
2063
|
+
lt(value: number, params?: string | $ZodCheckLessThanParams): this;
|
|
2064
|
+
/** Identical to .max() */
|
|
2065
|
+
lte(value: number, params?: string | $ZodCheckLessThanParams): this;
|
|
2066
|
+
max(value: number, params?: string | $ZodCheckLessThanParams): this;
|
|
2067
|
+
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
2068
|
+
int(params?: string | $ZodCheckNumberFormatParams): this;
|
|
2069
|
+
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
2070
|
+
safe(params?: string | $ZodCheckNumberFormatParams): this;
|
|
2071
|
+
positive(params?: string | $ZodCheckGreaterThanParams): this;
|
|
2072
|
+
nonnegative(params?: string | $ZodCheckGreaterThanParams): this;
|
|
2073
|
+
negative(params?: string | $ZodCheckLessThanParams): this;
|
|
2074
|
+
nonpositive(params?: string | $ZodCheckLessThanParams): this;
|
|
2075
|
+
multipleOf(value: number, params?: string | $ZodCheckMultipleOfParams): this;
|
|
2076
|
+
/** @deprecated Use `.multipleOf()` instead. */
|
|
2077
|
+
step(value: number, params?: string | $ZodCheckMultipleOfParams): this;
|
|
2078
|
+
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
2079
|
+
finite(params?: unknown): this;
|
|
2080
|
+
minValue: number | null;
|
|
2081
|
+
maxValue: number | null;
|
|
2082
|
+
/** @deprecated Check the `format` property instead. */
|
|
2083
|
+
isInt: boolean;
|
|
2084
|
+
/** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
|
|
2085
|
+
isFinite: boolean;
|
|
2086
|
+
format: string | null;
|
|
2087
|
+
}
|
|
2088
|
+
interface ZodNumber extends _ZodNumber<$ZodNumberInternals<number>> {}
|
|
2089
|
+
declare const ZodNumber: $constructor<ZodNumber>;
|
|
2090
|
+
interface _ZodBoolean<T extends $ZodBooleanInternals = $ZodBooleanInternals> extends _ZodType<T> {}
|
|
2091
|
+
interface ZodBoolean extends _ZodBoolean<$ZodBooleanInternals<boolean>> {}
|
|
2092
|
+
declare const ZodBoolean: $constructor<ZodBoolean>;
|
|
2093
|
+
interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInternals<T>>, $ZodArray<T> {
|
|
2094
|
+
element: T;
|
|
2095
|
+
min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
|
|
2096
|
+
nonempty(params?: string | $ZodCheckMinLengthParams): this;
|
|
2097
|
+
max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
|
|
2098
|
+
length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
|
|
2099
|
+
unwrap(): T;
|
|
2100
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2101
|
+
}
|
|
2102
|
+
declare const ZodArray: $constructor<ZodArray>;
|
|
2103
|
+
type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = { [K in keyof Ext]: K extends keyof Base ? output<Ext[K]> extends output<Base[K]> ? input<Ext[K]> extends input<Base[K]> ? Ext[K] : never : never : Ext[K]; };
|
|
2104
|
+
interface ZodObject<
|
|
2105
|
+
/** @ts-ignore Cast variance */
|
|
2106
|
+
out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
|
|
2107
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2108
|
+
shape: Shape;
|
|
2109
|
+
keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
|
|
2110
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
2111
|
+
catchall<T extends SomeType>(schema: T): ZodObject<Shape, $catchall<T>>;
|
|
2112
|
+
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
2113
|
+
passthrough(): ZodObject<Shape, $loose>;
|
|
2114
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
2115
|
+
loose(): ZodObject<Shape, $loose>;
|
|
2116
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
2117
|
+
strict(): ZodObject<Shape, $strict>;
|
|
2118
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
2119
|
+
strip(): ZodObject<Shape, $strip>;
|
|
2120
|
+
extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
2121
|
+
safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
2122
|
+
/**
|
|
2123
|
+
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
2124
|
+
*/
|
|
2125
|
+
merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
2126
|
+
pick<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
2127
|
+
omit<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
2128
|
+
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]>; }, Config>;
|
|
2129
|
+
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
2130
|
+
exactPartial(): ZodObject<{ -readonly [k in keyof Shape]: ZodExactOptional<Shape[k]>; }, Config>;
|
|
2131
|
+
exactPartial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodExactOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
2132
|
+
required(): ZodObject<{ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>; }, Config>;
|
|
2133
|
+
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
2134
|
+
}
|
|
2135
|
+
declare const ZodObject: $constructor<ZodObject>;
|
|
2136
|
+
interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
|
|
2137
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2138
|
+
options: T;
|
|
2139
|
+
}
|
|
2140
|
+
declare const ZodUnion: $constructor<ZodUnion>;
|
|
2141
|
+
interface ZodDiscriminatedUnion<Options extends readonly SomeType[] = readonly $ZodType[], Disc extends string = string> extends ZodUnion<Options>, $ZodDiscriminatedUnion<Options, Disc> {
|
|
2142
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2143
|
+
_zod: $ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
2144
|
+
def: $ZodDiscriminatedUnionDef<Options, Disc>;
|
|
2145
|
+
}
|
|
2146
|
+
declare const ZodDiscriminatedUnion: $constructor<ZodDiscriminatedUnion>;
|
|
2147
|
+
interface ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodIntersectionInternals<A, B>>, $ZodIntersection<A, B> {
|
|
2148
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2149
|
+
}
|
|
2150
|
+
declare const ZodIntersection: $constructor<ZodIntersection>;
|
|
2151
|
+
interface ZodEnum<
|
|
2152
|
+
/** @ts-ignore Cast variance */
|
|
2153
|
+
out T extends EnumLike = EnumLike> extends _ZodType<$ZodEnumInternals<T>>, $ZodEnum<T> {
|
|
2154
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2155
|
+
enum: T;
|
|
2156
|
+
options: Array<T[keyof T]>;
|
|
2157
|
+
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Pick<T, U[number]>>>;
|
|
2158
|
+
exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Omit<T, U[number]>>>;
|
|
2159
|
+
}
|
|
2160
|
+
declare const ZodEnum: $constructor<ZodEnum>;
|
|
2161
|
+
interface ZodLiteral<T extends Literal = Literal> extends _ZodType<$ZodLiteralInternals<T>>, $ZodLiteral<T> {
|
|
2162
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2163
|
+
values: Set<T>;
|
|
2164
|
+
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
2165
|
+
value: T;
|
|
2166
|
+
}
|
|
2167
|
+
declare const ZodLiteral: $constructor<ZodLiteral>;
|
|
2168
|
+
interface ZodTransform<O = unknown, I = unknown> extends _ZodType<$ZodTransformInternals<O, I>>, $ZodTransform<O, I> {
|
|
2169
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2170
|
+
}
|
|
2171
|
+
declare const ZodTransform: $constructor<ZodTransform>;
|
|
2172
|
+
interface ZodOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodOptionalInternals<T>>, $ZodOptional<T> {
|
|
2173
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2174
|
+
unwrap(): T;
|
|
2175
|
+
}
|
|
2176
|
+
declare const ZodOptional: $constructor<ZodOptional>;
|
|
2177
|
+
interface ZodExactOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodExactOptionalInternals<T>>, $ZodExactOptional<T> {
|
|
2178
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2179
|
+
unwrap(): T;
|
|
2180
|
+
}
|
|
2181
|
+
declare const ZodExactOptional: $constructor<ZodExactOptional>;
|
|
2182
|
+
interface ZodNullable<T extends SomeType = $ZodType> extends _ZodType<$ZodNullableInternals<T>>, $ZodNullable<T> {
|
|
2183
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2184
|
+
unwrap(): T;
|
|
2185
|
+
}
|
|
2186
|
+
declare const ZodNullable: $constructor<ZodNullable>;
|
|
2187
|
+
interface ZodDefault<T extends SomeType = $ZodType> extends _ZodType<$ZodDefaultInternals<T>>, $ZodDefault<T> {
|
|
2188
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2189
|
+
unwrap(): T;
|
|
2190
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
2191
|
+
removeDefault(): T;
|
|
2192
|
+
}
|
|
2193
|
+
declare const ZodDefault: $constructor<ZodDefault>;
|
|
2194
|
+
interface ZodPrefault<T extends SomeType = $ZodType> extends _ZodType<$ZodPrefaultInternals<T>>, $ZodPrefault<T> {
|
|
2195
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2196
|
+
unwrap(): T;
|
|
2197
|
+
}
|
|
2198
|
+
declare const ZodPrefault: $constructor<ZodPrefault>;
|
|
2199
|
+
interface ZodNonOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodNonOptionalInternals<T>>, $ZodNonOptional<T> {
|
|
2200
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2201
|
+
unwrap(): T;
|
|
2202
|
+
}
|
|
2203
|
+
declare const ZodNonOptional: $constructor<ZodNonOptional>;
|
|
2204
|
+
interface ZodCatch<T extends SomeType = $ZodType> extends _ZodType<$ZodCatchInternals<T>>, $ZodCatch<T> {
|
|
2205
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2206
|
+
unwrap(): T;
|
|
2207
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
2208
|
+
removeCatch(): T;
|
|
2209
|
+
}
|
|
2210
|
+
declare const ZodCatch: $constructor<ZodCatch>;
|
|
2211
|
+
interface ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodPipeInternals<A, B>>, $ZodPipe<A, B> {
|
|
2212
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2213
|
+
in: A;
|
|
2214
|
+
out: B;
|
|
2215
|
+
}
|
|
2216
|
+
declare const ZodPipe: $constructor<ZodPipe>;
|
|
2217
|
+
interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadonlyInternals<T>>, $ZodReadonly<T> {
|
|
2218
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2219
|
+
unwrap(): T;
|
|
2220
|
+
}
|
|
2221
|
+
declare const ZodReadonly: $constructor<ZodReadonly>;
|
|
2222
|
+
//#endregion
|
|
2223
|
+
//#region ../../vendor/deepseek-harness/packages/session/session-projection/lib/types/types.d.ts
|
|
2224
|
+
/**
|
|
2225
|
+
* Pure-type outlet of the session-projection Service Definition: the one projection type
|
|
2226
|
+
* table, importable from client aggregates without dragging the host-side
|
|
2227
|
+
* cordis Context merges of the package root (dsh-agent → dsh-session). Domain
|
|
2228
|
+
* packages may declare-merge through either the package root or this outlet —
|
|
2229
|
+
* re-export preserves symbol identity, so both land on the same table.
|
|
2230
|
+
*
|
|
2231
|
+
* @module @deepseek-ai/dsh-session-projection/types
|
|
2232
|
+
*/
|
|
2233
|
+
/**
|
|
2234
|
+
* The merge-extensible client projection table shared by wire blocks, client
|
|
2235
|
+
* cells, and React hooks. Domain packages merge their client-visible key here;
|
|
2236
|
+
* values are wire-JSON whole values. How a value is rendered is the slot
|
|
2237
|
+
* system's business, never this layer's.
|
|
2238
|
+
*/
|
|
2239
|
+
interface SessionProjectionMap {}
|
|
2240
|
+
/**
|
|
2241
|
+
* The merge-extensible host fold-state table. Each client-visible key also
|
|
2242
|
+
* appears in {@link SessionProjectionMap}; host-only keys appear only here.
|
|
2243
|
+
* Values must be plain JSON so the projection cache can persist them.
|
|
2244
|
+
*/
|
|
2245
|
+
interface SessionProjectionStateMap {}
|
|
2246
|
+
//#endregion
|
|
2247
|
+
//#region ../../vendor/deepseek-harness/packages/session/session-projection/lib/types/index.d.ts
|
|
2248
|
+
declare module '@deepseek-ai/cordis' {
|
|
2249
|
+
interface Context {
|
|
2250
|
+
sessionProjections: SessionProjectionRegistry;
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* One domain's state-driven computation unit: a pure synchronous fold plus
|
|
2255
|
+
* declarations and an optional client view — never an opaque getter. The framework drives
|
|
2256
|
+
* `apply` on every committed session event; the domain holds no
|
|
2257
|
+
* subscriptions and owns only the computation. All functions MUST be
|
|
2258
|
+
* synchronous (an async unit would tear the carriers' consistency cut), and
|
|
2259
|
+
* `state` MUST be plain JSON (the persisted-cache precondition).
|
|
2260
|
+
*/
|
|
2261
|
+
interface ProjectionDefinition<K extends keyof SessionProjectionStateMap, S extends SessionProjectionStateMap[K] = SessionProjectionStateMap[K]> {
|
|
2262
|
+
/** The projection key this unit owns (its `SessionProjectionStateMap` entry). */
|
|
2263
|
+
key: K;
|
|
2264
|
+
/** Validates persisted state before it seeds a fold. */
|
|
2265
|
+
stateSchema: ZodType<S>;
|
|
2266
|
+
/**
|
|
2267
|
+
* State for the empty log and its immutable Session metadata.
|
|
2268
|
+
* @param header - immutable metadata for the Session being projected.
|
|
2269
|
+
* @param inheritedEventCount - exact fork-inherited prefix length.
|
|
2270
|
+
* @returns the initial state.
|
|
2271
|
+
*/
|
|
2272
|
+
init(header: SessionHeader, inheritedEventCount: SessionLogOffset): NoInfer<S>;
|
|
2273
|
+
/**
|
|
2274
|
+
* Pure transition: previous state + one committed event → next state. A
|
|
2275
|
+
* unit uninterested in an event MUST return the same state reference — an
|
|
2276
|
+
* unchanged reference (`Object.is`) produces zero downstream work.
|
|
2277
|
+
* @param state - the state covering all prior events.
|
|
2278
|
+
* @param event - the next committed session event.
|
|
2279
|
+
* @returns the next state (same reference when the event is not the unit's).
|
|
2280
|
+
*/
|
|
2281
|
+
apply(state: NoInfer<S>, event: SessionEvent): NoInfer<S>;
|
|
2282
|
+
/** Client view. Omit for host-only units. */
|
|
2283
|
+
wire?: K extends keyof SessionProjectionMap ? {
|
|
2284
|
+
/** Validates the wire payload before it leaves the host. */
|
|
2285
|
+
viewSchema: ZodType<SessionProjectionMap[K]>;
|
|
2286
|
+
/**
|
|
2287
|
+
* State → wire payload (the read-side projection). The live drive keeps
|
|
2288
|
+
* the two latest raw results and compares them with `Object.is`; an
|
|
2289
|
+
* object-valued view must reuse its reference to suppress publication
|
|
2290
|
+
* across internal-only state changes.
|
|
2291
|
+
* @param state - the current state.
|
|
2292
|
+
* @returns the whole current value for this unit's key.
|
|
2293
|
+
*/
|
|
2294
|
+
view(state: NoInfer<S>): SessionProjectionMap[K];
|
|
2295
|
+
} : never;
|
|
2296
|
+
/**
|
|
2297
|
+
* Persisted-cache invalidation version: bump whenever the serialized state fields or the
|
|
2298
|
+
* fold semantics change, so persisted `(sessionId, key, ver, seq, val)`
|
|
2299
|
+
* rows from an older unit are discarded instead of being forward-applied
|
|
2300
|
+
* into garbage. Non-negative integer.
|
|
2301
|
+
*/
|
|
2302
|
+
stateVersion: number;
|
|
2303
|
+
}
|
|
2304
|
+
/**
|
|
2305
|
+
* Change-feed listener: one unit's raw `view` result changed by `Object.is`
|
|
2306
|
+
* for one session. `value` is the schema-validated output; `seq` is the
|
|
2307
|
+
* unit's watermark at emission (the seq of the event that caused the change).
|
|
2308
|
+
*/
|
|
2309
|
+
type ProjectionChangeListener = (session: Session, key: Extract<keyof SessionProjectionMap, string>, value: unknown, seq: SessionSeq) => void;
|
|
2310
|
+
/**
|
|
2311
|
+
* One consistent read cut over every registered client-visible unit for one session.
|
|
2312
|
+
* `asOfSeq` is the shared watermark — the seq of the last event every value
|
|
2313
|
+
* reflects (`-1` for an empty log).
|
|
2314
|
+
*/
|
|
2315
|
+
interface ProjectionSnapshot {
|
|
2316
|
+
/** Seq of the last event the values reflect; -1 for an empty log. */
|
|
2317
|
+
asOfSeq: SessionSeqCursor;
|
|
2318
|
+
/** Whole current client value per registered key. */
|
|
2319
|
+
values: Partial<SessionProjectionMap>;
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* One unit's checkpoint: its internal state (plain JSON by the unit
|
|
2323
|
+
* contract), the seq of the last event folded into it, and the unit
|
|
2324
|
+
* `stateVersion` that produced it — the persisted projection-cache row
|
|
2325
|
+
* `(sessionId, key, ver, seq, val)` minus the two outer keys. A row is
|
|
2326
|
+
* never authoritative, only a fold shortcut: `restore` discards it on a
|
|
2327
|
+
* version mismatch or when it claims events past the stored log end.
|
|
2328
|
+
*/
|
|
2329
|
+
interface ProjectionCheckpointRow {
|
|
2330
|
+
/** The registering unit's `stateVersion` at fold time. */
|
|
2331
|
+
ver: number;
|
|
2332
|
+
/** Seq of the last event folded into `val`; -1 for the empty log. */
|
|
2333
|
+
seq: SessionSeqCursor;
|
|
2334
|
+
/** The unit's internal state — plain JSON per the unit contract. */
|
|
2335
|
+
val: unknown;
|
|
2336
|
+
}
|
|
2337
|
+
/** Checkpoint rows keyed by projection key (one session's persisted cache value). */
|
|
2338
|
+
type ProjectionCheckpoint = Record<string, ProjectionCheckpointRow>;
|
|
2339
|
+
/**
|
|
2340
|
+
* `ctx.sessionProjections`: the projection unit table and its drive. The
|
|
2341
|
+
* service subscribes to `session/event` once; every committed event passes
|
|
2342
|
+
* every registered unit's `apply` (eager drive). A changed state reference
|
|
2343
|
+
* computes the next client view; the change feed is notified only when its
|
|
2344
|
+
* raw result changes by `Object.is`.
|
|
2345
|
+
* Cells build lazily — a unit registered after events flowed, or a session
|
|
2346
|
+
* older than the registry, folds `init` over the in-memory log on first
|
|
2347
|
+
* touch (event or read). Registration is an effect (disposer rides the
|
|
2348
|
+
* calling fiber): an unloaded domain plugin's key disappears from snapshots
|
|
2349
|
+
* and clients read it as capability absence. A host reader either declares
|
|
2350
|
+
* `sessionProjections` in its plugin `inject` or fails explicitly when the
|
|
2351
|
+
* registry or required key is absent. Contributors may preserve optional
|
|
2352
|
+
* registration through `ctx.inject(['sessionProjections'], ...)`. Registrants sharing a key
|
|
2353
|
+
* share one unit and are counted: the same tool package mounted in N agent
|
|
2354
|
+
* presets registers N times, and the key survives until the last one
|
|
2355
|
+
* unloads.
|
|
2356
|
+
*/
|
|
2357
|
+
declare class SessionProjectionRegistry extends Service {
|
|
2358
|
+
private readonly registrations;
|
|
2359
|
+
private readonly listeners;
|
|
2360
|
+
/**
|
|
2361
|
+
* Create and install the registry as `ctx.sessionProjections`.
|
|
2362
|
+
* @param ctx - Cordis context that owns the service.
|
|
2363
|
+
*/
|
|
2364
|
+
constructor(ctx: Context);
|
|
2365
|
+
/**
|
|
2366
|
+
* Register one domain's unit. The registration is an effect on the calling
|
|
2367
|
+
* context's fiber: disposing the fiber (or calling the returned disposer)
|
|
2368
|
+
* removes the key — and the unit's cached cells — from subsequent drives
|
|
2369
|
+
* and snapshots.
|
|
2370
|
+
* @param definition - key, state schema, pure unit functions, and stateVersion.
|
|
2371
|
+
* @returns the exact disposer that unregisters this unit.
|
|
2372
|
+
*/
|
|
2373
|
+
register<K extends keyof SessionProjectionMap, S extends SessionProjectionStateMap[K]>(definition: Omit<ProjectionDefinition<K, S>, 'wire'> & {
|
|
2374
|
+
wire: NonNullable<ProjectionDefinition<K, S>['wire']>;
|
|
2375
|
+
}): () => void;
|
|
2376
|
+
/**
|
|
2377
|
+
* Register one host-only unit. Its state is omitted from client snapshots
|
|
2378
|
+
* and always checkpointed like every other unit.
|
|
2379
|
+
* @param definition - key, state schema, pure unit functions, and stateVersion.
|
|
2380
|
+
* @returns the exact disposer that unregisters this unit.
|
|
2381
|
+
*/
|
|
2382
|
+
register<K extends Exclude<keyof SessionProjectionStateMap, keyof SessionProjectionMap>, S extends SessionProjectionStateMap[K]>(definition: Omit<ProjectionDefinition<K, S>, 'wire'>): () => void;
|
|
2383
|
+
/**
|
|
2384
|
+
* Subscribe to the change feed. The registration is an effect on the
|
|
2385
|
+
* calling context's fiber.
|
|
2386
|
+
* @param listener - called once per client-visible unit whose raw view changed by `Object.is`, per committed event.
|
|
2387
|
+
* @returns the exact disposer that unsubscribes.
|
|
2388
|
+
*/
|
|
2389
|
+
onChanged(listener: ProjectionChangeListener): () => void;
|
|
2390
|
+
/**
|
|
2391
|
+
* Read one unit's current host state after materializing every registered
|
|
2392
|
+
* unit at the Session cursor. Unrelated wire views are not produced.
|
|
2393
|
+
* The returned value is live; callers must not mutate it.
|
|
2394
|
+
* @param session - the session whose state is read.
|
|
2395
|
+
* @param key - the registered unit key.
|
|
2396
|
+
* @returns current state, or `undefined` when the key is not registered.
|
|
2397
|
+
*/
|
|
2398
|
+
stateOf<K extends keyof SessionProjectionStateMap>(session: Session, key: K): SessionProjectionStateMap[K] | undefined;
|
|
2399
|
+
/**
|
|
2400
|
+
* One consistent cut over every registered client-visible unit for one session, read from
|
|
2401
|
+
* the watermark cache (missing cells fold lazily over the in-memory log).
|
|
2402
|
+
* Fully synchronous — every value and `asOfSeq` reflect the same log
|
|
2403
|
+
* position. Each value passes its unit's `viewSchema` before leaving.
|
|
2404
|
+
* @param session - the session whose projection values are read.
|
|
2405
|
+
* @param keys - optional client-visible outputs; state materialization remains complete.
|
|
2406
|
+
* @returns the snapshot; `values` is empty when no selected client-visible unit is registered.
|
|
2407
|
+
*/
|
|
2408
|
+
snapshot(session: Session, keys?: readonly Extract<keyof SessionProjectionMap, string>[]): ProjectionSnapshot;
|
|
2409
|
+
/**
|
|
2410
|
+
* Read only already-materialized client-visible cells without folding history.
|
|
2411
|
+
* Values may trail the live Session and are therefore hints, not a complete
|
|
2412
|
+
* baseline. Missing cells are omitted.
|
|
2413
|
+
* @param session - attached Session whose cached cells are inspected.
|
|
2414
|
+
* @param keys - optional wire keys to view.
|
|
2415
|
+
* @returns the lowest common cached cut, or `undefined` when no wire cell exists.
|
|
2416
|
+
*/
|
|
2417
|
+
cachedSnapshot(session: Session, keys?: readonly Extract<keyof SessionProjectionMap, string>[]): ProjectionSnapshot | undefined;
|
|
2418
|
+
/**
|
|
2419
|
+
* State-level checkpoint of every persisted unit for one session, read
|
|
2420
|
+
* from the watermark cache (missing cells fold lazily over the in-memory
|
|
2421
|
+
* log). This is the write side of the persisted projection cache: the
|
|
2422
|
+
* returned rows are the `(key → {ver, seq, val})` part of the durable
|
|
2423
|
+
* `(sessionId, key, ver, seq, val)`
|
|
2424
|
+
* rows. Every `val` is a DETACHED structured clone — never the live
|
|
2425
|
+
* cell reference: the watermark cache is this registry's authoritative
|
|
2426
|
+
* mutable state, and a caller reaching the live reference could corrupt
|
|
2427
|
+
* every subsequent snapshot and frame through it (plain JSON by the unit
|
|
2428
|
+
* contract, so the clone is total).
|
|
2429
|
+
* @param session - the session whose unit states are checkpointed.
|
|
2430
|
+
* @returns one row per registered key.
|
|
2431
|
+
*/
|
|
2432
|
+
checkpoint(session: Session): ProjectionCheckpoint;
|
|
2433
|
+
/**
|
|
2434
|
+
* The stored seq a {@link restore} tail read over `checkpoint` must start
|
|
2435
|
+
* at: one event BELOW the lowest usable watermark (a row is usable when
|
|
2436
|
+
* its `ver` matches the live unit's `stateVersion`; an absent or mismatched row
|
|
2437
|
+
* pulls the floor to `0` — that key must refold the full log). The
|
|
2438
|
+
* one-below anchor is load-bearing: the tail then proves how far the
|
|
2439
|
+
* stored log still extends, so {@link restore} can detect a log that
|
|
2440
|
+
* shrank below a row's watermark (crash-repair truncation) instead of
|
|
2441
|
+
* serving the stale row as current — an empty tail read from the anchor
|
|
2442
|
+
* yields an end below every watermark and the restore rejects for a full
|
|
2443
|
+
* re-read.
|
|
2444
|
+
* @param checkpoint - persisted rows for one session (possibly stale or empty).
|
|
2445
|
+
* @returns the offset for the stored-log suffix read (`SessionHandle.read`),
|
|
2446
|
+
* or `undefined` when no unit is registered (no read needed —
|
|
2447
|
+
* {@link restore} would serve empty values regardless).
|
|
2448
|
+
*/
|
|
2449
|
+
restoreFloor(checkpoint: ProjectionCheckpoint): SessionLogOffset | undefined;
|
|
2450
|
+
/**
|
|
2451
|
+
* View a checkpoint's rows without any log read: for every registered
|
|
2452
|
+
* client-visible unit whose row's `ver` matches, serve the schema-validated
|
|
2453
|
+
* `view` of the schema-validated stored state; mismatched, malformed, or absent rows leave their key
|
|
2454
|
+
* absent (a cold or listing consumer treats it as not-yet-available and a
|
|
2455
|
+
* fuller read path refolds it). The zero-I/O rung of the read ladder —
|
|
2456
|
+
* values are as stale as their rows, never wrong.
|
|
2457
|
+
* @param checkpoint - persisted rows for one session (possibly stale or empty).
|
|
2458
|
+
* @param keys - optional wire keys to view.
|
|
2459
|
+
* @returns whole values per key with a usable row; empty when none.
|
|
2460
|
+
*/
|
|
2461
|
+
viewCheckpoint(checkpoint: ProjectionCheckpoint, keys?: readonly Extract<keyof SessionProjectionMap, string>[]): Partial<SessionProjectionMap>;
|
|
2462
|
+
/**
|
|
2463
|
+
* Cold read: fold every persisted unit over a stored log suffix, seeding
|
|
2464
|
+
* each from its checkpoint row when usable — the one read recipe (cached
|
|
2465
|
+
* state + forward tail replay + `view`) applied without a live `Session`.
|
|
2466
|
+
* Call with the stored events at or past `restoreFloor(checkpoint)` (a
|
|
2467
|
+
* `SessionHandle.read` slice) and that same floor as
|
|
2468
|
+
* `baseSeq`; the floor's one-below anchor makes the supplied end honest,
|
|
2469
|
+
* so a shrunk log is detected here. A row is usable iff its
|
|
2470
|
+
* `ver` matches the live unit's `stateVersion`, it does not predate `baseSeq`
|
|
2471
|
+
* (`seq >= baseSeq - 1`), and it does not claim events past the
|
|
2472
|
+
* supplied end (`seq <= endSeq`); an unusable row is discarded
|
|
2473
|
+
* and its key refolds from `init` — which is only sound over the full
|
|
2474
|
+
* log, so a discarded row with `baseSeq > 0` throws (the caller re-reads
|
|
2475
|
+
* from seq 0, e.g. after a crash-repair truncation shrank the log below
|
|
2476
|
+
* a row's watermark).
|
|
2477
|
+
* @param checkpoint - persisted rows for one session (possibly stale or empty).
|
|
2478
|
+
* @param events - the stored events with `seq >= baseSeq`, in seq order.
|
|
2479
|
+
* @param baseSeq - the seq `events` starts at (its first event's seq when non-empty).
|
|
2480
|
+
* @param header - immutable metadata for the Session being restored.
|
|
2481
|
+
* @param inheritedEventCount - exact fork-inherited prefix length supplied to unit initialization.
|
|
2482
|
+
* @returns the snapshot cut at the supplied log end (`asOfSeq` is the last
|
|
2483
|
+
* supplied event's seq, `baseSeq - 1` for an empty tail) plus the
|
|
2484
|
+
* refreshed checkpoint rows at that cut, ready for a durable write-back.
|
|
2485
|
+
*/
|
|
2486
|
+
restore(checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq: SessionLogOffset, header: SessionHeader, inheritedEventCount: SessionLogOffset): {
|
|
2487
|
+
snapshot: ProjectionSnapshot;
|
|
2488
|
+
checkpoint: ProjectionCheckpoint;
|
|
2489
|
+
};
|
|
2490
|
+
/**
|
|
2491
|
+
* Restore an exact cut and install its states on the supplied prepared Session.
|
|
2492
|
+
* A later publication reuses these cells; ordinary live reads and event drive
|
|
2493
|
+
* advance any constructor-owned suffix exactly once.
|
|
2494
|
+
* @param session - exact prepared Session that owns the restored log prefix.
|
|
2495
|
+
* @param checkpoint - persisted rows for this Session lifecycle.
|
|
2496
|
+
* @param events - exact events at the observation cut.
|
|
2497
|
+
* @param baseSeq - first supplied event sequence.
|
|
2498
|
+
* @returns all projection values at the supplied cut.
|
|
2499
|
+
*/
|
|
2500
|
+
hydrate(session: Session, checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq: SessionLogOffset): ProjectionSnapshot;
|
|
2501
|
+
/** Materialize every registered unit cell at the Session's current cursor. */
|
|
2502
|
+
private materializeCells;
|
|
2503
|
+
/** Fold one unit from init over `events`, producing a cell watermarked at the last folded event. */
|
|
2504
|
+
private buildCell;
|
|
2505
|
+
/** Read (or lazily build, folding the full in-memory log) one unit's cell. */
|
|
2506
|
+
private cellFor;
|
|
2507
|
+
/** Advance one existing cell through a contiguous Session prefix. */
|
|
2508
|
+
private advanceCell;
|
|
2509
|
+
/** Eager drive: pass one committed event through every unit; notify on changed raw view references. */
|
|
2510
|
+
private drive;
|
|
2511
|
+
/** Return one schema-validated wire value. */
|
|
2512
|
+
private viewCell;
|
|
2513
|
+
}
|
|
2514
|
+
//#endregion
|
|
2515
|
+
//#region ../../vendor/deepseek-harness/packages/storage/storage-domain/lib/types/spec.d.ts
|
|
2516
|
+
/** Global singleton declaration: schema plus the value used before the first write. */
|
|
2517
|
+
interface DomainGlobalSpec<G> {
|
|
2518
|
+
/** Validates the stored global at the durable boundary. */
|
|
2519
|
+
readonly schema: ZodType<G>;
|
|
2520
|
+
/** Value served when the medium holds no global yet; not written until the first `set`. */
|
|
2521
|
+
readonly initial: G;
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* One table declaration. `K` is a phantom key type (typically a branded
|
|
2525
|
+
* string) carried for compile-time projection only; keys are plain strings on
|
|
2526
|
+
* the medium.
|
|
2527
|
+
*/
|
|
2528
|
+
interface DomainTableSpec<K extends string = string, V = unknown> {
|
|
2529
|
+
/** Validates every stored record at the durable boundary. */
|
|
2530
|
+
readonly valueSchema: ZodType<V>;
|
|
2531
|
+
/** Phantom carrier for the key type; never present at runtime. */
|
|
2532
|
+
readonly __key?: K;
|
|
2533
|
+
}
|
|
2534
|
+
/** Static declaration of one domain: identity, version, and record layout. */
|
|
2535
|
+
interface DomainSpec {
|
|
2536
|
+
/** Domain name; must match `UNIT_NAME_RE` (doubles as the backend unit name). */
|
|
2537
|
+
readonly name: string;
|
|
2538
|
+
/** Current domain format version; reads enforce it according to the selected layout. */
|
|
2539
|
+
readonly version: number;
|
|
2540
|
+
/**
|
|
2541
|
+
* Medium layout for the backend unit: `single` (the default) stores the
|
|
2542
|
+
* whole unit as one document; `per-record` stores each record as its own
|
|
2543
|
+
* document, for units whose records are large, sparse, or individually
|
|
2544
|
+
* disposable — the projection cache — and scopes version checks per record
|
|
2545
|
+
* (an unaccepted record document is discarded, never migrated).
|
|
2546
|
+
*/
|
|
2547
|
+
readonly layout?: 'single' | 'per-record';
|
|
2548
|
+
/**
|
|
2549
|
+
* Older domain versions whose stored records the current record schemas
|
|
2550
|
+
* also accept (the declaring owner vouches for that, typically by
|
|
2551
|
+
* declaring the fields older records lack as optional). `per-record` backends
|
|
2552
|
+
* read documents stamped with a listed version instead of discarding them,
|
|
2553
|
+
* and accept a legacy whole-unit file so stamped for the one-time
|
|
2554
|
+
* bootstrap; writes always stamp {@link version}.
|
|
2555
|
+
*/
|
|
2556
|
+
readonly compatibleVersions?: readonly number[];
|
|
2557
|
+
/**
|
|
2558
|
+
* What `open` does with a stored table record that fails its zod schema.
|
|
2559
|
+
* Absent (the default), the whole open rejects with `invalid-record` —
|
|
2560
|
+
* right for authoritative data. `'backup-and-skip'` is for domains whose
|
|
2561
|
+
* records are disposable derived data: the backend moves the record's
|
|
2562
|
+
* document aside (`KvUnit.backupRecord`), the failure is logged with
|
|
2563
|
+
* its cause, and the open continues with the record absent. A backend
|
|
2564
|
+
* without `backupRecord` (no per-record document to move) falls back
|
|
2565
|
+
* to the rejecting default. The global slot always rejects.
|
|
2566
|
+
*/
|
|
2567
|
+
readonly invalidRecords?: 'backup-and-skip';
|
|
2568
|
+
/** Optional global singleton slot. */
|
|
2569
|
+
readonly global?: DomainGlobalSpec<unknown>;
|
|
2570
|
+
/** Table declarations keyed by table name; each name must match `UNIT_NAME_RE`. */
|
|
2571
|
+
readonly tables: Record<string, DomainTableSpec>;
|
|
2572
|
+
}
|
|
2573
|
+
/** Key type of one declared table, recovered from its phantom carrier. */
|
|
2574
|
+
type TableKeyOf<S extends DomainSpec, N extends keyof S['tables']> = S['tables'][N] extends DomainTableSpec<infer K> ? K : never;
|
|
2575
|
+
/** Value type of one declared table. */
|
|
2576
|
+
type TableValueOf<S extends DomainSpec, N extends keyof S['tables']> = S['tables'][N] extends DomainTableSpec<string, infer V> ? V : never;
|
|
2577
|
+
//#endregion
|
|
2578
|
+
//#region ../../vendor/deepseek-harness/packages/storage/storage-domain/lib/types/domain.d.ts
|
|
2579
|
+
/** Handle on a domain's global singleton. */
|
|
2580
|
+
interface DomainGlobal<G> {
|
|
2581
|
+
/**
|
|
2582
|
+
* Current value, synchronously from the authoritative in-memory state.
|
|
2583
|
+
* Before the first `set` this is the spec's `initial`.
|
|
2584
|
+
* @returns the current global value.
|
|
2585
|
+
*/
|
|
2586
|
+
get(): G;
|
|
2587
|
+
/**
|
|
2588
|
+
* Replace the value durably. Queued on the domain's write chain; the first
|
|
2589
|
+
* `set` is what materializes the global on the medium.
|
|
2590
|
+
* @param value - New value; must satisfy the spec's schema (not re-checked
|
|
2591
|
+
* here — validation happens at the durable read boundary).
|
|
2592
|
+
* @returns resolution after durability and event emission.
|
|
2593
|
+
*/
|
|
2594
|
+
set(value: G): Promise<void>;
|
|
2595
|
+
}
|
|
2596
|
+
/**
|
|
2597
|
+
* Handle on one declared table. Records are plain immutable data: returned
|
|
2598
|
+
* values are the stored objects themselves (no defensive copies) and must not
|
|
2599
|
+
* be mutated in place — replace via `put`/`update`.
|
|
2600
|
+
*/
|
|
2601
|
+
interface KvTable<K extends string, V> {
|
|
2602
|
+
/**
|
|
2603
|
+
* Read one record, synchronously from memory.
|
|
2604
|
+
* @param key - Record key.
|
|
2605
|
+
* @returns the record, or `undefined` when absent.
|
|
2606
|
+
*/
|
|
2607
|
+
get(key: K): V | undefined;
|
|
2608
|
+
/**
|
|
2609
|
+
* Snapshot iterator over `[key, record]` pairs. A snapshot, not a live
|
|
2610
|
+
* view: iteration stays stable while queued writes land.
|
|
2611
|
+
* @returns the pair iterator.
|
|
2612
|
+
*/
|
|
2613
|
+
entries(): IterableIterator<[K, V]>;
|
|
2614
|
+
/**
|
|
2615
|
+
* Snapshot iterator over keys.
|
|
2616
|
+
* @returns the key iterator.
|
|
2617
|
+
*/
|
|
2618
|
+
keys(): IterableIterator<K>;
|
|
2619
|
+
/** Current record count. */
|
|
2620
|
+
readonly size: number;
|
|
2621
|
+
/**
|
|
2622
|
+
* Insert or overwrite one record durably.
|
|
2623
|
+
* @param key - Record key.
|
|
2624
|
+
* @param value - The full new record (no partial merge).
|
|
2625
|
+
* @returns resolution after durability and event emission.
|
|
2626
|
+
*/
|
|
2627
|
+
put(key: K, value: V): Promise<void>;
|
|
2628
|
+
/**
|
|
2629
|
+
* Delete one record durably.
|
|
2630
|
+
* @param key - Record key.
|
|
2631
|
+
* @returns `true` when the record existed, `false` when it was already
|
|
2632
|
+
* absent (no write and no event in that case).
|
|
2633
|
+
*/
|
|
2634
|
+
delete(key: K): Promise<boolean>;
|
|
2635
|
+
/**
|
|
2636
|
+
* Atomic read-modify-write on the domain's write chain: `fn` sees the
|
|
2637
|
+
* value current at its queue slot, so concurrent updates never interleave.
|
|
2638
|
+
* @param key - Record key; a missing key rejects with `missing-key`.
|
|
2639
|
+
* @param fn - Synchronous pure transform from current to next record.
|
|
2640
|
+
* @returns the stored next record.
|
|
2641
|
+
*/
|
|
2642
|
+
update(key: K, fn: (current: V) => V): Promise<V>;
|
|
2643
|
+
}
|
|
2644
|
+
/** Global handle of a spec: typed when declared, `never` (inaccessible) when not. */
|
|
2645
|
+
type DomainGlobalHandleOf<S extends DomainSpec> = S extends {
|
|
2646
|
+
readonly global: DomainGlobalSpec<infer G>;
|
|
2647
|
+
} ? DomainGlobal<G> : never;
|
|
2648
|
+
/** One open domain, typed by its spec. */
|
|
2649
|
+
interface Domain<S extends DomainSpec> {
|
|
2650
|
+
/** Domain name from the spec. */
|
|
2651
|
+
readonly name: string;
|
|
2652
|
+
/** Global singleton handle; a spec without `global` has no usable handle (`never`). */
|
|
2653
|
+
readonly global: DomainGlobalHandleOf<S>;
|
|
2654
|
+
/**
|
|
2655
|
+
* Resolve one declared table handle. Handles are stable — repeated calls
|
|
2656
|
+
* return the same instance.
|
|
2657
|
+
* @param name - Declared table name.
|
|
2658
|
+
* @returns the typed table handle.
|
|
2659
|
+
*/
|
|
2660
|
+
table<N extends keyof S['tables'] & string>(name: N): KvTable<TableKeyOf<S, N>, TableValueOf<S, N>>;
|
|
2661
|
+
/**
|
|
2662
|
+
* Close this domain: reject new writes immediately, drain already-queued
|
|
2663
|
+
* writes (their events still emit), release the backend unit, then free
|
|
2664
|
+
* the domain name for a later open. Idempotent — repeated calls share one
|
|
2665
|
+
* teardown. The consumer owns this call (typically as its own `ctx.effect`
|
|
2666
|
+
* disposer); the facility closes any domain left open when it unmounts.
|
|
2667
|
+
* @returns resolution after the unit is released.
|
|
2668
|
+
*/
|
|
2669
|
+
close(): Promise<void>;
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* The single domain implementation behind the {@link Domain} interface. The
|
|
2673
|
+
* facility constructs it from a validated `loadAll` snapshot and erases it to
|
|
2674
|
+
* `Domain<S>`; nothing outside this package constructs one.
|
|
2675
|
+
*/
|
|
2676
|
+
declare class DomainImpl {
|
|
2677
|
+
private readonly ctx;
|
|
2678
|
+
private readonly unit;
|
|
2679
|
+
private readonly onClosed;
|
|
2680
|
+
/** Domain name from the spec. */
|
|
2681
|
+
readonly name: string;
|
|
2682
|
+
private readonly tables;
|
|
2683
|
+
private globalValue;
|
|
2684
|
+
private readonly globalHandle?;
|
|
2685
|
+
/** Tail of the write chain; every link settles (rejections are observed by the caller's slice). */
|
|
2686
|
+
private chain;
|
|
2687
|
+
/** Set when close begins: new writes reject while already-queued writes drain. */
|
|
2688
|
+
private disposing;
|
|
2689
|
+
/** Set when close finishes (chain drained, unit closed): reads reject from here on. */
|
|
2690
|
+
private closed;
|
|
2691
|
+
private disposal?;
|
|
2692
|
+
/**
|
|
2693
|
+
* @param ctx - Context that carries `domain/changed` emissions.
|
|
2694
|
+
* @param spec - The domain declaration.
|
|
2695
|
+
* @param unit - The opened backend unit; this instance owns its lifecycle.
|
|
2696
|
+
* @param records - Validated records from the unit's `loadAll`, one entry
|
|
2697
|
+
* per declared table (empty maps included) — the facility builds it from
|
|
2698
|
+
* the spec, so the entry set IS the table set.
|
|
2699
|
+
* @param globalValue - Validated stored global, or the spec's `initial`
|
|
2700
|
+
* when the medium held none; `undefined` when the spec declares no global.
|
|
2701
|
+
* @param onClosed - Facility hook run once after teardown completes; frees
|
|
2702
|
+
* the domain name for a later open.
|
|
2703
|
+
*/
|
|
2704
|
+
constructor(ctx: Context, spec: DomainSpec, unit: KvUnit, records: Map<string, Map<string, unknown>>, globalValue: unknown, onClosed: () => void);
|
|
2705
|
+
/** Global singleton handle; accessing it on a spec that declares no global is a caller bug and throws. */
|
|
2706
|
+
get global(): DomainGlobal<unknown>;
|
|
2707
|
+
/**
|
|
2708
|
+
* Resolve one declared table handle; an undeclared name is a caller bug
|
|
2709
|
+
* and throws.
|
|
2710
|
+
* @param name - Declared table name.
|
|
2711
|
+
* @returns the stable table handle.
|
|
2712
|
+
*/
|
|
2713
|
+
table(name: string): KvTable<string, unknown>;
|
|
2714
|
+
/**
|
|
2715
|
+
* Close this domain: reject new writes immediately, drain already-queued
|
|
2716
|
+
* writes (their events still emit), close the unit, then free the name via
|
|
2717
|
+
* the facility hook. Idempotent — repeated calls share one teardown.
|
|
2718
|
+
* @returns resolution after the unit is released.
|
|
2719
|
+
*/
|
|
2720
|
+
close(): Promise<void>;
|
|
2721
|
+
private runClose;
|
|
2722
|
+
/**
|
|
2723
|
+
* Dispatch one post-durability change notification, containing observer
|
|
2724
|
+
* failures: the write is already committed (medium and memory both hold
|
|
2725
|
+
* the new state), so a throwing listener must not retroactively reject it.
|
|
2726
|
+
*/
|
|
2727
|
+
private emitChanged;
|
|
2728
|
+
private enqueue;
|
|
2729
|
+
private assertReadable;
|
|
2730
|
+
}
|
|
2731
|
+
//#endregion
|
|
2732
|
+
//#region ../../vendor/deepseek-harness/packages/storage/storage-domain/lib/types/events.d.ts
|
|
2733
|
+
/**
|
|
2734
|
+
* Change-event vocabulary of the domain data form. Every durable write emits
|
|
2735
|
+
* one event after the backend resolves durability, carrying the new snapshot
|
|
2736
|
+
* and an operation discriminant — never the old value (a diffing consumer
|
|
2737
|
+
* keeps its own previous snapshot). This is the event source for cross-process
|
|
2738
|
+
* change push (RPC frames) in a later phase.
|
|
2739
|
+
* @module @deepseek-ai/dsh-storage-domain/src/events
|
|
2740
|
+
*/
|
|
2741
|
+
/** Shared location fields of one durable domain change. */
|
|
2742
|
+
interface DomainChangedBase {
|
|
2743
|
+
/** Owning domain name. */
|
|
2744
|
+
readonly domain: string;
|
|
2745
|
+
/** Table name; `''` for a global-singleton write. */
|
|
2746
|
+
readonly table: string;
|
|
2747
|
+
/** Record key; `''` for a global-singleton write. */
|
|
2748
|
+
readonly key: string;
|
|
2749
|
+
}
|
|
2750
|
+
/** A record (or the global singleton) was inserted or overwritten. */
|
|
2751
|
+
interface DomainChangedPut extends DomainChangedBase {
|
|
2752
|
+
readonly operation: 'put';
|
|
2753
|
+
/** The new snapshot. */
|
|
2754
|
+
readonly value: unknown;
|
|
2755
|
+
}
|
|
2756
|
+
/** A record was deleted; tombstones carry no value. */
|
|
2757
|
+
interface DomainChangedDeleted extends DomainChangedBase {
|
|
2758
|
+
readonly operation: 'deleted';
|
|
2759
|
+
readonly value?: never;
|
|
2760
|
+
}
|
|
2761
|
+
/** One durable domain change; a closed union — switch on `operation`. */
|
|
2762
|
+
type DomainChanged = DomainChangedPut | DomainChangedDeleted;
|
|
2763
|
+
declare module '@deepseek-ai/cordis' {
|
|
2764
|
+
interface Events {
|
|
2765
|
+
/**
|
|
2766
|
+
* A domain record or the global singleton changed, emitted once per write
|
|
2767
|
+
* strictly after the backend acknowledged durability. Events of one
|
|
2768
|
+
* domain arrive in its write-chain order.
|
|
2769
|
+
* @param change - domain, table (`''` for global), key (`''` for global),
|
|
2770
|
+
* operation discriminant, and on `put` the new snapshot.
|
|
2771
|
+
* @mode emit
|
|
2772
|
+
*/
|
|
2773
|
+
'domain/changed'(change: DomainChanged): void;
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
//#endregion
|
|
2777
|
+
//#region ../../vendor/deepseek-harness/packages/storage/storage-domain/lib/types/index.d.ts
|
|
2778
|
+
declare module '@deepseek-ai/dsh-storage' {
|
|
2779
|
+
interface StorageForms {
|
|
2780
|
+
domain: DomainFacility;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
declare module '@deepseek-ai/cordis' {
|
|
2784
|
+
interface Context {
|
|
2785
|
+
storageDomain: DomainFacility;
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* Plugin config. Which backend serves which domain is decided here, not
|
|
2790
|
+
* globally on the hub: `backend` is the default route and `routes` overrides
|
|
2791
|
+
* it per domain name. A route naming an unregistered backend fails loud at
|
|
2792
|
+
* `open` with `backend-not-found`.
|
|
2793
|
+
*/
|
|
2794
|
+
interface Config$2 {
|
|
2795
|
+
/** Default backend name for every domain without an explicit route. Required: there is no universally correct medium. */
|
|
2796
|
+
backend: string;
|
|
2797
|
+
/** Per-domain overrides: domain name → backend name. */
|
|
2798
|
+
routes?: Record<string, string>;
|
|
2799
|
+
}
|
|
2800
|
+
declare const Config$2: z<Config$2>;
|
|
2801
|
+
/**
|
|
2802
|
+
* The mounted domain facility. Opens declared domains over routed backends;
|
|
2803
|
+
* one facility instance owns the open-domain table and enforces single-open
|
|
2804
|
+
* per domain name.
|
|
2805
|
+
*/
|
|
2806
|
+
declare class DomainFacility {
|
|
2807
|
+
private readonly ctx;
|
|
2808
|
+
private readonly config;
|
|
2809
|
+
private readonly domains;
|
|
2810
|
+
/** Names reserved by an in-flight or completed open, so concurrent opens of one name fail loud. */
|
|
2811
|
+
private readonly reserved;
|
|
2812
|
+
/**
|
|
2813
|
+
* @param ctx - Context of the domain plugin; open-domain effects and change
|
|
2814
|
+
* events attach here.
|
|
2815
|
+
* @param config - Validated plugin config.
|
|
2816
|
+
*/
|
|
2817
|
+
constructor(ctx: Context, config: Config$2);
|
|
2818
|
+
/**
|
|
2819
|
+
* Open one declared domain. Steps, each failing the whole call: reject a
|
|
2820
|
+
* name that is already open (`already-open`); resolve the backend route
|
|
2821
|
+
* (`backend-not-found` passes through from the hub); require its `kv` facet
|
|
2822
|
+
* (`facet-unsupported`); open the unit projected from the spec (backend
|
|
2823
|
+
* `version-mismatch`/`malformed-medium` pass through); load and validate
|
|
2824
|
+
* every stored record against the spec's zod schemas (`invalid-record`
|
|
2825
|
+
* with the offending table and key — unless the spec declares
|
|
2826
|
+
* `invalidRecords: 'backup-and-skip'` and the unit can move documents aside, in
|
|
2827
|
+
* which case the failing record is backed up, logged, and skipped);
|
|
2828
|
+
* construct the domain.
|
|
2829
|
+
*
|
|
2830
|
+
* Lifecycle: the CALLER owns the returned handle and closes it via
|
|
2831
|
+
* `Domain.close()` (typically as its own `ctx.effect` disposer) — the
|
|
2832
|
+
* facility does not tie the domain to any consumer fiber. Domains still
|
|
2833
|
+
* open when the facility unmounts are closed by the plugin disposer.
|
|
2834
|
+
* @param spec - The domain declaration, typically from `defineDomain`.
|
|
2835
|
+
* @returns the opened domain handle, typed by the spec.
|
|
2836
|
+
*/
|
|
2837
|
+
open<S extends DomainSpec>(spec: S): Promise<Domain<S>>;
|
|
2838
|
+
/**
|
|
2839
|
+
* Look up an open domain by name, untyped. Diagnostic surface (the package
|
|
2840
|
+
* invariant cross-checks change events against live domain state); typed
|
|
2841
|
+
* consumers hold the handle returned by {@link open}.
|
|
2842
|
+
* @param name - Domain name.
|
|
2843
|
+
* @returns the open domain runtime, or `undefined` when not open.
|
|
2844
|
+
*/
|
|
2845
|
+
get(name: string): DomainImpl | undefined;
|
|
2846
|
+
/**
|
|
2847
|
+
* Close every domain still open on this facility. The unmount path for
|
|
2848
|
+
* consumers that never called `Domain.close()` themselves; closing is
|
|
2849
|
+
* idempotent, so double-closing an already-closed domain is harmless.
|
|
2850
|
+
* @returns resolution after every unit is released.
|
|
2851
|
+
*/
|
|
2852
|
+
closeAll(): Promise<void>;
|
|
2853
|
+
}
|
|
2854
|
+
//#endregion
|
|
2855
|
+
//#region ../../vendor/deepseek-harness/packages/session/session-projection-cache/lib/types/spec.d.ts
|
|
2856
|
+
/**
|
|
2857
|
+
* The stored-log identity a record is bound to: the immutable header fields
|
|
2858
|
+
* that distinguish one session lifecycle from another under the same id. A
|
|
2859
|
+
* session id names a slot, not a lifecycle — a deleted-then-recreated id, or
|
|
2860
|
+
* a persistence root swapped under a surviving cache, would otherwise let an
|
|
2861
|
+
* old record pass every watermark check and seed state folded from an
|
|
2862
|
+
* unrelated log. Reads validate this against the live header (listing) or
|
|
2863
|
+
* the stored header (cold read) before accepting any record.
|
|
2864
|
+
*
|
|
2865
|
+
* The format and lineage fields are optional because records admitted through
|
|
2866
|
+
* `compatibleVersions` predate them. The reader (`identityMatches`) refuses an
|
|
2867
|
+
* absent format generation because no current Session log can prove that
|
|
2868
|
+
* record's fold semantics. It interprets absent lineage as unseeded only after
|
|
2869
|
+
* the format generation matches. Current-version writes always store all three
|
|
2870
|
+
* fields.
|
|
2871
|
+
*/
|
|
2872
|
+
declare const checkpointIdentity: ZodObject<{
|
|
2873
|
+
formatVersion: ZodOptional<ZodNumber>;
|
|
2874
|
+
createdAt: ZodNumber;
|
|
2875
|
+
cwd: ZodOptional<ZodString>;
|
|
2876
|
+
isSeeded: ZodOptional<ZodBoolean>;
|
|
2877
|
+
inheritedEventCount: ZodOptional<ZodPipe<ZodNumber, ZodTransform<SessionLogOffset, number>>>;
|
|
2878
|
+
}, $strip>;
|
|
2879
|
+
/** The identity fields a record is bound to, inferred from {@link checkpointIdentity}. */
|
|
2880
|
+
type CheckpointIdentity = output<typeof checkpointIdentity>;
|
|
2881
|
+
//#endregion
|
|
2882
|
+
//#region ../../vendor/deepseek-harness/packages/session/session-projection-cache/lib/types/index.d.ts
|
|
2883
|
+
declare module '@deepseek-ai/cordis' {
|
|
2884
|
+
interface Context {
|
|
2885
|
+
sessionProjectionCache: SessionProjectionCache;
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* Plugin config. Both throttle triggers are deployment choices with no
|
|
2890
|
+
* universally correct value, so the composition states them explicitly
|
|
2891
|
+
* (cordis.yml); the three mandatory write points (session creation,
|
|
2892
|
+
* `turn/end`, and session disposal) are policy, not tunables, and always
|
|
2893
|
+
* fire.
|
|
2894
|
+
*/
|
|
2895
|
+
interface Config$1 {
|
|
2896
|
+
/** Committed events per session that force a durable checkpoint write between mandatory points. */
|
|
2897
|
+
writeEveryEvents: number;
|
|
2898
|
+
/** Longest time (milliseconds) a dirty checkpoint may stay unwritten between mandatory points. */
|
|
2899
|
+
writeIntervalMs: number;
|
|
2900
|
+
}
|
|
2901
|
+
declare const Config$1: z<Config$1>;
|
|
2902
|
+
/**
|
|
2903
|
+
* The persisted projection cache service. Opens the `session_projcache`
|
|
2904
|
+
* domain at init, checkpoints live sessions on a throttled write-behind
|
|
2905
|
+
* (count/interval triggers from {@link Config}) plus three mandatory points —
|
|
2906
|
+
* session creation, `turn/end`, and session disposal (the live-to-cold
|
|
2907
|
+
* moment) — and serves the
|
|
2908
|
+
* cached rows for a session header. Every durable write is fail-soft:
|
|
2909
|
+
* failures log a warning and the cache self-heals on the next write.
|
|
2910
|
+
*/
|
|
2911
|
+
declare class SessionProjectionCache extends Service {
|
|
2912
|
+
config: Config$1;
|
|
2913
|
+
static inject: string[];
|
|
2914
|
+
static Config: z<Config$1>;
|
|
2915
|
+
private table?;
|
|
2916
|
+
private readonly dirty;
|
|
2917
|
+
constructor(ctx: Context, config: Config$1);
|
|
2918
|
+
/** Open the domain and install the write-behind listeners. */
|
|
2919
|
+
protected [Service.init](): Promise<void>;
|
|
2920
|
+
/**
|
|
2921
|
+
* The stored record for one session, accepted only when its bound log
|
|
2922
|
+
* identity matches `expected`. A session id names a slot, not a lifecycle:
|
|
2923
|
+
* a recreated id or a persistence store swapped under a surviving cache
|
|
2924
|
+
* must not let an old record seed state folded from an unrelated log.
|
|
2925
|
+
* Synchronous from the domain's in-memory state — the same state every
|
|
2926
|
+
* write mutated, so a read can never go around the write chain to the
|
|
2927
|
+
* medium.
|
|
2928
|
+
* @param id - the session whose record is read.
|
|
2929
|
+
* @param expected - the log identity the caller holds (live or stored header).
|
|
2930
|
+
* @returns the identity-matching record, or `undefined` (absent or unrelated).
|
|
2931
|
+
*/
|
|
2932
|
+
private recordFor;
|
|
2933
|
+
/**
|
|
2934
|
+
* The zero-I/O listing read: whole values viewed straight from the stored
|
|
2935
|
+
* rows (version-matching keys only), each cut carried with its watermark so
|
|
2936
|
+
* a client value store can seed under its higher-seq-wins rule — as stale
|
|
2937
|
+
* as the last durable checkpoint but never wrong, and never from an
|
|
2938
|
+
* unrelated log (the caller's header is the identity witness). Fresher
|
|
2939
|
+
* paths (the history tail baseline) supersede these values whenever a
|
|
2940
|
+
* session is actually opened.
|
|
2941
|
+
* @param meta - the listed session's header (identity witness; no log read).
|
|
2942
|
+
* @param inheritedEventCount - exact inherited prefix length that completes
|
|
2943
|
+
* the checkpoint identity.
|
|
2944
|
+
* @param keys - optional projection keys required by the caller's audience.
|
|
2945
|
+
* @returns the cut (`asOfSeq` = lowest served-row watermark), or
|
|
2946
|
+
* `undefined` when no usable row exists for this lifecycle.
|
|
2947
|
+
*/
|
|
2948
|
+
cachedSnapshot(meta: SessionHeader, inheritedEventCount: SessionLogOffset, keys?: readonly Extract<keyof SessionProjectionMap, string>[]): ProjectionSnapshot | undefined;
|
|
2949
|
+
/**
|
|
2950
|
+
* Read only a predecessor checkpoint's title as a zero-I/O listing hint.
|
|
2951
|
+
*
|
|
2952
|
+
* The authoritative Session header supplies the lifecycle identity. A cache
|
|
2953
|
+
* checkpoint can lag that log but cannot lead it because writes flush the
|
|
2954
|
+
* log first, so a matching predecessor title is a genuine (possibly stale)
|
|
2955
|
+
* fact from this Session. The registry still requires the current title
|
|
2956
|
+
* projection's row version and schema. No other predecessor projection is
|
|
2957
|
+
* exposed: format normalization can change their current meaning, and the
|
|
2958
|
+
* strict {@link cachedSnapshot} / hydration paths continue to reject them.
|
|
2959
|
+
* @param meta - authoritative listed Session header.
|
|
2960
|
+
* @param inheritedEventCount - exact inherited cut completing the lifecycle identity.
|
|
2961
|
+
* @returns a title-only checkpoint view with `asOfSeq: -1`, or `undefined`
|
|
2962
|
+
* when the record is current, newer, unrelated, missing, or incompatible
|
|
2963
|
+
* with the title unit. The sentinel avoids reusing a sequence that a
|
|
2964
|
+
* cardinality-changing Session migration may have remapped.
|
|
2965
|
+
*/
|
|
2966
|
+
cachedPredecessorTitle(meta: SessionHeader, inheritedEventCount: SessionLogOffset): ProjectionSnapshot | undefined;
|
|
2967
|
+
/** View selected wire rows and bind them to their lowest served watermark. */
|
|
2968
|
+
private viewRecord;
|
|
2969
|
+
/**
|
|
2970
|
+
* Hydrate projection cells for an already-prepared Session without another
|
|
2971
|
+
* persistence read. The cache seeds matching rows; the supplied exact log
|
|
2972
|
+
* advances every unit to the observation cut. No checkpoint is written
|
|
2973
|
+
* because the logical observation may contain recovery events not yet durable.
|
|
2974
|
+
* @param session - exact unpublished Session retained by persistence.
|
|
2975
|
+
* @param events - exact logical event prefix represented by the observation.
|
|
2976
|
+
* @returns all projection values at the event cut.
|
|
2977
|
+
*/
|
|
2978
|
+
hydratePrepared(session: Session, events: readonly SessionEvent[]): ProjectionSnapshot;
|
|
2979
|
+
/**
|
|
2980
|
+
* Durably checkpoint one live session NOW (all mandatory points call
|
|
2981
|
+
* this; tests and carriers may too). The registry cut is snapshotted at
|
|
2982
|
+
* this boundary (states are live references), then the session's record is
|
|
2983
|
+
* replaced on the domain's write chain. NOT fail-soft — callers on the
|
|
2984
|
+
* fail-soft paths contain it.
|
|
2985
|
+
* @param session - the live session to checkpoint.
|
|
2986
|
+
* @returns resolution after durability and event emission.
|
|
2987
|
+
*/
|
|
2988
|
+
write(session: Session): Promise<void>;
|
|
2989
|
+
/**
|
|
2990
|
+
* Cold-read one session's projections from its complete log. Each unit is
|
|
2991
|
+
* seeded from the identity-checked cached rows — the registry skips `apply`
|
|
2992
|
+
* for the already-folded prefix (events at or below the row's `seq`) — and
|
|
2993
|
+
* the refreshed checkpoint is written back (fail-soft, fire-and-forget), so
|
|
2994
|
+
* the first cold read creates the cache row and later ones seed from it.
|
|
2995
|
+
* The caller supplies the complete log in seq order: this service never
|
|
2996
|
+
* consults the persistence layer.
|
|
2997
|
+
* @param meta - the stored session header (identity witness).
|
|
2998
|
+
* @param inheritedEventCount - exact inherited prefix length for projection initialization and identity.
|
|
2999
|
+
* @param events - the session's complete log, in seq order.
|
|
3000
|
+
* @returns the projection cut at the log end.
|
|
3001
|
+
*/
|
|
3002
|
+
coldSnapshot(meta: SessionHeader, inheritedEventCount: SessionLogOffset, events: readonly SessionEvent[]): ProjectionSnapshot;
|
|
3003
|
+
private installWritePath;
|
|
3004
|
+
/**
|
|
3005
|
+
* One fail-soft durable checkpoint. Every caller has work by construction:
|
|
3006
|
+
* the throttle triggers only fire dirty (markClean clears the timer with
|
|
3007
|
+
* the counter) and the mandatory points write unconditionally.
|
|
3008
|
+
*/
|
|
3009
|
+
private flushSoft;
|
|
3010
|
+
/** Reset one session's dirty bookkeeping (its checkpoint is being written). */
|
|
3011
|
+
private markClean;
|
|
3012
|
+
/** Replace one session's stored record with its log identity and a detached snapshot of `rows`. */
|
|
3013
|
+
private put;
|
|
3014
|
+
private requireTable;
|
|
3015
|
+
}
|
|
3016
|
+
//#endregion
|
|
3017
|
+
//#region ../../vendor/deepseek-harness/packages/util/brand/lib/types/index.d.ts
|
|
3018
|
+
/**
|
|
3019
|
+
* Duplicate-install-safe nominal primitive helpers.
|
|
3020
|
+
*
|
|
3021
|
+
* A brand makes structurally identical strings or numbers non-interchangeable
|
|
3022
|
+
* at the type level: a `SessionId` cannot be passed where a `ToolCallId` is
|
|
3023
|
+
* expected, and an event sequence cannot be passed as a log offset. Comparison,
|
|
3024
|
+
* logging, and serialization retain the underlying primitive behavior.
|
|
3025
|
+
*
|
|
3026
|
+
* This package owns no concrete domain value and keeps no runtime identity or mutable
|
|
3027
|
+
* state, so independently installed copies produce interchangeable values.
|
|
3028
|
+
*
|
|
3029
|
+
* @module @deepseek-ai/dsh-brand
|
|
3030
|
+
*/
|
|
3031
|
+
declare const BRAND: unique symbol;
|
|
3032
|
+
/** A string carrying a compile-time-only brand `B`. */
|
|
3033
|
+
type Branded<B extends string> = string & {
|
|
3034
|
+
readonly [BRAND]: B;
|
|
3035
|
+
};
|
|
3036
|
+
//#endregion
|
|
3037
|
+
//#region ../../vendor/deepseek-harness/packages/workspace/workspace/lib/types/types.d.ts
|
|
3038
|
+
/**
|
|
3039
|
+
* Identifies one workspace record. A generated uuid, never the path: path
|
|
3040
|
+
* normalization rewrites paths, and a reference anchor must stay stable.
|
|
3041
|
+
*/
|
|
3042
|
+
type WorkspaceId$1 = Branded<'WorkspaceId'>;
|
|
3043
|
+
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
3044
|
+
interface RemoteErrorDetailsMap {
|
|
3045
|
+
/** No registration carries that Workspace identity. */
|
|
3046
|
+
'workspace/not-found': {
|
|
3047
|
+
readonly workspaceId: WorkspaceId$1;
|
|
3048
|
+
};
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* One workspace: a stable id over an existing directory, a display title, and
|
|
3053
|
+
* an ordered candidate account of sessions. Membership requires both an id in
|
|
3054
|
+
* that account and a session header whose canonical cwd equals the workspace
|
|
3055
|
+
* path. Consumers only see this interface; the implementation stays private.
|
|
3056
|
+
*/
|
|
3057
|
+
interface Workspace {
|
|
3058
|
+
/** Stable record id (generated uuid). */
|
|
3059
|
+
readonly id: WorkspaceId$1;
|
|
3060
|
+
/**
|
|
3061
|
+
* Canonical directory path: the `fs.realpath` of the path given at create
|
|
3062
|
+
* time (trailing slashes, `..`, and symlinks all resolved). Never rewritten
|
|
3063
|
+
* afterwards, even when the directory disappears (see {@link status}).
|
|
3064
|
+
*/
|
|
3065
|
+
readonly path: string;
|
|
3066
|
+
/** Display title. Defaults to the final path segment, or a filesystem root's own spelling; duplicates are allowed. */
|
|
3067
|
+
readonly title: string;
|
|
3068
|
+
/** ISO-8601 creation instant, stamped at create and never rewritten. */
|
|
3069
|
+
readonly createdAt: string;
|
|
3070
|
+
/** ISO-8601 instant of the last durable mutation (create counts as one). */
|
|
3071
|
+
readonly updatedAt: string;
|
|
3072
|
+
/**
|
|
3073
|
+
* Header-validated sessions in manually owned order: a new session is
|
|
3074
|
+
* prepended at attach, explicit reordering goes through
|
|
3075
|
+
* `insertSessionBefore`, and activity never reorders. The durable candidate
|
|
3076
|
+
* account is filtered synchronously: missing headers, invalid cwd values,
|
|
3077
|
+
* and canonical cwd mismatches are never returned. A subsequent workspace
|
|
3078
|
+
* mutation prunes those filtered candidates durably.
|
|
3079
|
+
*/
|
|
3080
|
+
readonly sessionIds: readonly SessionId$1[];
|
|
3081
|
+
/**
|
|
3082
|
+
* Replace the display title durably.
|
|
3083
|
+
* @param title - New title; any string, duplicates across workspaces allowed.
|
|
3084
|
+
* @returns resolution after durability.
|
|
3085
|
+
*/
|
|
3086
|
+
setTitle(title: string): Promise<void>;
|
|
3087
|
+
/**
|
|
3088
|
+
* Prepend a session to this workspace's candidate account. An already
|
|
3089
|
+
* accounted id resolves without writing, aside from the durable
|
|
3090
|
+
* filtered-candidate prune every accepted mutation performs. A new id's
|
|
3091
|
+
* live or persisted
|
|
3092
|
+
* header cwd must resolve to an existing directory equal to {@link path};
|
|
3093
|
+
* unknown ids, missing or invalid cwd values, and mismatches reject without
|
|
3094
|
+
* writing.
|
|
3095
|
+
* @param sessionId - The session to record.
|
|
3096
|
+
* @returns resolution after durability.
|
|
3097
|
+
*/
|
|
3098
|
+
attachSession(sessionId: SessionId$1): Promise<void>;
|
|
3099
|
+
/**
|
|
3100
|
+
* Move an accounted session within the manual order, DOM-insertBefore-like:
|
|
3101
|
+
* with an anchor the session lands before it, without one it appends to the
|
|
3102
|
+
* end. Only the moved id changes position. A session or anchor absent from
|
|
3103
|
+
* the account rejects without writing; a move to the current position
|
|
3104
|
+
* resolves without writing, aside from the durable filtered-candidate
|
|
3105
|
+
* prune every accepted mutation performs; decided on the domain write
|
|
3106
|
+
* chain.
|
|
3107
|
+
* @param sessionId - The accounted session to move.
|
|
3108
|
+
* @param beforeSessionId - Accounted anchor to insert before; omitted appends.
|
|
3109
|
+
* @returns resolution after durability.
|
|
3110
|
+
*/
|
|
3111
|
+
insertSessionBefore(sessionId: SessionId$1, beforeSessionId?: SessionId$1): Promise<void>;
|
|
3112
|
+
/**
|
|
3113
|
+
* Remove a session from this workspace's account. Idempotent: an id not on
|
|
3114
|
+
* the account resolves without writing, aside from the durable
|
|
3115
|
+
* filtered-candidate prune every accepted mutation performs; decided on
|
|
3116
|
+
* the domain write chain like attach. Never touches the session's own stored log.
|
|
3117
|
+
* @param sessionId - The session to remove.
|
|
3118
|
+
* @returns resolution after durability.
|
|
3119
|
+
*/
|
|
3120
|
+
detachSession(sessionId: SessionId$1): Promise<void>;
|
|
3121
|
+
/**
|
|
3122
|
+
* Live directory check, uncached: whether {@link path} currently exists and
|
|
3123
|
+
* is a directory. A missing directory never mutates the record — the
|
|
3124
|
+
* directory may only be temporarily moved.
|
|
3125
|
+
* @returns `'ok'` when the directory exists, `'missing-dir'` otherwise.
|
|
3126
|
+
*/
|
|
3127
|
+
status(): Promise<'ok' | 'missing-dir'>;
|
|
3128
|
+
}
|
|
3129
|
+
//#endregion
|
|
3130
|
+
//#region ../../vendor/deepseek-harness/packages/workspace/workspace/lib/types/spec.d.ts
|
|
3131
|
+
/**
|
|
3132
|
+
* Durable shape of one workspace record. `path` is the `fs.realpath` canon
|
|
3133
|
+
* stamped at create; `sessionIds` is the ordered ownership account (array
|
|
3134
|
+
* order is display order); timestamps are ISO-8601 strings.
|
|
3135
|
+
*/
|
|
3136
|
+
declare const workspaceRecord: ZodObject<{
|
|
3137
|
+
path: ZodString;
|
|
3138
|
+
title: ZodString;
|
|
3139
|
+
sessionIds: ZodArray<ZodPipe<ZodString, ZodTransform<SessionId, string>>>;
|
|
3140
|
+
createdAt: ZodString;
|
|
3141
|
+
updatedAt: ZodString;
|
|
3142
|
+
}, $strip>;
|
|
3143
|
+
/** One stored workspace record, inferred from {@link workspaceRecord}. */
|
|
3144
|
+
type WorkspaceRecord = output<typeof workspaceRecord>;
|
|
3145
|
+
/**
|
|
3146
|
+
* Durable registry state. `initialized` distinguishes a valid empty registry
|
|
3147
|
+
* from one that still needs the header-only history bootstrap;
|
|
3148
|
+
* `workspaceIds` is the authoritative display order. `archivedSessionIds` is
|
|
3149
|
+
* the registry-global archive set layered over workspace accounting: an
|
|
3150
|
+
* archived session keeps its `sessionIds` slot (unarchiving must restore the
|
|
3151
|
+
* position), so the set never participates in the one-owner accounting
|
|
3152
|
+
* invariant. Defaulted so records written before the field parse unchanged.
|
|
3153
|
+
*/
|
|
3154
|
+
declare const workspaceDomainState: ZodObject<{
|
|
3155
|
+
initialized: ZodBoolean;
|
|
3156
|
+
workspaceIds: ZodArray<ZodPipe<ZodString, ZodTransform<WorkspaceId$1, string>>>;
|
|
3157
|
+
archivedSessionIds: ZodDefault<ZodArray<ZodPipe<ZodString, ZodTransform<SessionId, string>>>>;
|
|
3158
|
+
pendingMutation: ZodOptional<ZodDiscriminatedUnion<[ZodObject<{
|
|
3159
|
+
operation: ZodLiteral<"create">;
|
|
3160
|
+
workspaceId: ZodPipe<ZodString, ZodTransform<WorkspaceId$1, string>>;
|
|
3161
|
+
}, $strip>, ZodObject<{
|
|
3162
|
+
operation: ZodLiteral<"delete">;
|
|
3163
|
+
workspaceId: ZodPipe<ZodString, ZodTransform<WorkspaceId$1, string>>;
|
|
3164
|
+
}, $strip>], "operation">>;
|
|
3165
|
+
}, $strip>;
|
|
3166
|
+
/** Durable registry state inferred from {@link workspaceDomainState}. */
|
|
3167
|
+
type WorkspaceDomainState = output<typeof workspaceDomainState>;
|
|
3168
|
+
//#endregion
|
|
3169
|
+
//#region ../../vendor/deepseek-harness/packages/workspace/workspace/lib/types/index.d.ts
|
|
3170
|
+
/** Identifies one workspace record (see `src/types.ts` for the brand rationale). */
|
|
3171
|
+
type WorkspaceId = WorkspaceId$1;
|
|
3172
|
+
/**
|
|
3173
|
+
* Brand a string as a {@link WorkspaceId}.
|
|
3174
|
+
* @param id - Raw workspace id string.
|
|
3175
|
+
* @returns the same string, branded at compile time.
|
|
3176
|
+
*/
|
|
3177
|
+
declare function WorkspaceId(id: string): WorkspaceId;
|
|
3178
|
+
declare module '@deepseek-ai/cordis' {
|
|
3179
|
+
interface Context {
|
|
3180
|
+
workspaceRegistry: WorkspaceRegistry;
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
/**
|
|
3184
|
+
* Durable workspace registry. Startup waits for `sessionPersistence`, builds
|
|
3185
|
+
* one canonical-cwd header index, and completes the one-time history
|
|
3186
|
+
* bootstrap before the service becomes active. The persistence dependency is
|
|
3187
|
+
* mandatory so an unavailable peer can never be mistaken for an empty
|
|
3188
|
+
* history and commit the initialized marker.
|
|
3189
|
+
*/
|
|
3190
|
+
declare class WorkspaceRegistry extends Service {
|
|
3191
|
+
static inject: string[];
|
|
3192
|
+
private table?;
|
|
3193
|
+
private global?;
|
|
3194
|
+
private state?;
|
|
3195
|
+
private readonly entities;
|
|
3196
|
+
private readonly headers;
|
|
3197
|
+
private readonly sessionPaths;
|
|
3198
|
+
private readonly invalidSessionPaths;
|
|
3199
|
+
private operationTail;
|
|
3200
|
+
private readonly host;
|
|
3201
|
+
constructor(ctx: Context);
|
|
3202
|
+
/** Open the domain, finish bootstrap when required, and rebuild the ordered cache. */
|
|
3203
|
+
protected [Service.init](): Promise<void>;
|
|
3204
|
+
/**
|
|
3205
|
+
* Create or reuse a workspace for an existing directory. The fully qualified
|
|
3206
|
+
* path is canonicalized through `fs.realpath`; a relative, nonexistent, or
|
|
3207
|
+
* non-directory path rejects. Repeated calls for the same canonical path
|
|
3208
|
+
* return the existing entity without changing its title.
|
|
3209
|
+
* A newly created workspace is prepended to the durable registry order.
|
|
3210
|
+
* Different canonical paths may share a display title.
|
|
3211
|
+
* @param path - Existing directory to own, in a fully qualified path spelling.
|
|
3212
|
+
* @param title - Display title used only when a new record is created.
|
|
3213
|
+
* @returns the existing or newly durable workspace.
|
|
3214
|
+
*/
|
|
3215
|
+
create(path: string, title?: string): Promise<Workspace>;
|
|
3216
|
+
/**
|
|
3217
|
+
* Look up a workspace by id.
|
|
3218
|
+
* @param id - Workspace id.
|
|
3219
|
+
* @returns the workspace, or `undefined` when unknown.
|
|
3220
|
+
*/
|
|
3221
|
+
get(id: WorkspaceId): Workspace | undefined;
|
|
3222
|
+
/**
|
|
3223
|
+
* Synchronous workspace projection in durable registry order. Every
|
|
3224
|
+
* entity's `sessionIds` getter is already filtered by the startup/live
|
|
3225
|
+
* canonical-cwd header index; this method performs no persistence reads.
|
|
3226
|
+
* @returns a fresh ordered array of workspace entities.
|
|
3227
|
+
*/
|
|
3228
|
+
list(): Workspace[];
|
|
3229
|
+
/**
|
|
3230
|
+
* Delete one workspace registration while retaining its directory and every
|
|
3231
|
+
* session log. The durable order is updated before the table deletion; a
|
|
3232
|
+
* failed table write restores the prior order and keeps the entity
|
|
3233
|
+
* published. Unknown ids are an idempotent no-op for domain callers.
|
|
3234
|
+
* @param id - Workspace registration to remove.
|
|
3235
|
+
* @returns `true` when a record was deleted, `false` when it was unknown.
|
|
3236
|
+
*/
|
|
3237
|
+
delete(id: WorkspaceId): Promise<boolean>;
|
|
3238
|
+
/**
|
|
3239
|
+
* Move one workspace within the durable display order, DOM-insertBefore-like.
|
|
3240
|
+
* With an anchor it lands before that workspace; without one it appends.
|
|
3241
|
+
* @param id - Workspace to move.
|
|
3242
|
+
* @param beforeId - Workspace anchor; omitted appends.
|
|
3243
|
+
* @returns the complete committed workspace order.
|
|
3244
|
+
*/
|
|
3245
|
+
insertBefore(id: WorkspaceId, beforeId?: WorkspaceId): Promise<readonly WorkspaceId[]>;
|
|
3246
|
+
/**
|
|
3247
|
+
* The registry-global archive set: sessions hidden from every grouping
|
|
3248
|
+
* surface. Archiving never touches workspace accounting — an archived
|
|
3249
|
+
* session keeps its `sessionIds` slot so unarchiving restores its position.
|
|
3250
|
+
* @returns the archived session ids in archive order.
|
|
3251
|
+
*/
|
|
3252
|
+
get archivedSessionIds(): readonly SessionId[];
|
|
3253
|
+
/**
|
|
3254
|
+
* Archive one session durably. The session must exist (live or in session
|
|
3255
|
+
* persistence); its workspace accounting — or lack of one — is irrelevant.
|
|
3256
|
+
* An already archived id resolves without writing.
|
|
3257
|
+
* @param sessionId - The session to archive.
|
|
3258
|
+
* @returns resolution after durability.
|
|
3259
|
+
*/
|
|
3260
|
+
archiveSession(sessionId: SessionId): Promise<void>;
|
|
3261
|
+
/**
|
|
3262
|
+
* Whether a session is live, header-indexed, or present in a fresh
|
|
3263
|
+
* persistence listing. Only a definite miss returns false — a failing
|
|
3264
|
+
* `sessionPersistence.list()` propagates so storage faults never
|
|
3265
|
+
* masquerade as an unknown session.
|
|
3266
|
+
*/
|
|
3267
|
+
private sessionKnown;
|
|
3268
|
+
/**
|
|
3269
|
+
* Resolve by canonical directory path without creating or mutating a
|
|
3270
|
+
* workspace. A missing path rejects during `realpath`; an existing unowned
|
|
3271
|
+
* directory returns `undefined`.
|
|
3272
|
+
* @param path - Existing directory path in a fully qualified spelling.
|
|
3273
|
+
* @returns the workspace owning the canonical path, when one exists.
|
|
3274
|
+
*/
|
|
3275
|
+
resolveByPath(path: string): Promise<Workspace | undefined>;
|
|
3276
|
+
private createCanonical;
|
|
3277
|
+
private deleteKnown;
|
|
3278
|
+
/**
|
|
3279
|
+
* Complete the one mutation explicitly named by durable state. Unexplained
|
|
3280
|
+
* order/table divergence still reaches {@link validateStoredState} and
|
|
3281
|
+
* fails loud; this path never guesses which operation created a row from its shape alone.
|
|
3282
|
+
*/
|
|
3283
|
+
private recoverPendingMutation;
|
|
3284
|
+
private bootstrap;
|
|
3285
|
+
private validateStoredState;
|
|
3286
|
+
private rebuildEntities;
|
|
3287
|
+
private replaceHeaderIndex;
|
|
3288
|
+
private indexHeaders;
|
|
3289
|
+
private indexHeader;
|
|
3290
|
+
/** Every stored session's header, projected from the persistence snapshot listing. */
|
|
3291
|
+
private listStoredHeaders;
|
|
3292
|
+
private indexLiveSessions;
|
|
3293
|
+
private reportFilteredCandidates;
|
|
3294
|
+
private readSessionHeader;
|
|
3295
|
+
private requireTable;
|
|
3296
|
+
private requireState;
|
|
3297
|
+
private setState;
|
|
3298
|
+
private enqueueOperation;
|
|
3299
|
+
}
|
|
3300
|
+
//#endregion
|
|
3301
|
+
//#region src/storage-takeover/types.d.ts
|
|
3302
|
+
/**
|
|
3303
|
+
* 一个会话的完整 checkpoint:上游 `CheckpointIdentity`(日志身份,唯一权威定义
|
|
3304
|
+
* 在被替换的 projcache spec 里)+ 上游 `ProjectionCheckpoint`(逐 key 行)+ 会话键。
|
|
3305
|
+
*/
|
|
3306
|
+
interface StoredProjcacheEntry {
|
|
3307
|
+
sessionId: SessionId;
|
|
3308
|
+
identity: CheckpointIdentity;
|
|
3309
|
+
rows: ProjectionCheckpoint;
|
|
3310
|
+
}
|
|
3311
|
+
/**
|
|
3312
|
+
* storages 接管表的方言无关访问层:SQLite 与 PostgreSQL 两个 Backend 各提供
|
|
3313
|
+
* 同一实现,调用方(KV 后端与投影缓存服务)不感知介质差异。读方法返回持久
|
|
3314
|
+
* 值的语义视图,workspace 的写入在介质事务内整体替换。
|
|
3315
|
+
*/
|
|
3316
|
+
interface StorageRepository {
|
|
3317
|
+
/** 读一个域的版本戳;域从未打开时 undefined。 */
|
|
3318
|
+
readUnitVersion(name: string): Promise<number | undefined>;
|
|
3319
|
+
/** 写入域的首次版本戳;已存在时保持原值。 */
|
|
3320
|
+
insertUnitVersion(name: string, version: number): Promise<void>;
|
|
3321
|
+
/** 读全部 workspace 记录(按 workspace id)。 */
|
|
3322
|
+
listWorkspaces(): Promise<Array<{
|
|
3323
|
+
id: string;
|
|
3324
|
+
record: WorkspaceRecord;
|
|
3325
|
+
}>>;
|
|
3326
|
+
/** 覆盖写一条 workspace 记录(含归属行)。 */
|
|
3327
|
+
putWorkspace(id: string, record: WorkspaceRecord): Promise<void>;
|
|
3328
|
+
/** 删除一条 workspace 记录(缺失为 no-op)。 */
|
|
3329
|
+
deleteWorkspace(id: string): Promise<void>;
|
|
3330
|
+
/** 读 workspace 单例;从未写入时 null。 */
|
|
3331
|
+
readWorkspaceState(): Promise<WorkspaceDomainState | null>;
|
|
3332
|
+
/** 覆盖写 workspace 单例(显示顺序与归档集一并整体替换)。 */
|
|
3333
|
+
writeWorkspaceState(state: WorkspaceDomainState): Promise<void>;
|
|
3334
|
+
/** 读全部投影 checkpoint(含逐 key 行)。 */
|
|
3335
|
+
loadProjcache(): Promise<StoredProjcacheEntry[]>;
|
|
3336
|
+
/**
|
|
3337
|
+
* 同步读一个会话的 checkpoint:只有同步驱动(SQLite)提供,读路径直接落到
|
|
3338
|
+
* 介质;异步驱动(PostgreSQL)缺席,调用方退化为写穿镜像。上游的
|
|
3339
|
+
* `cachedSnapshot` 系列是同步签名,这里的存在性就是"能否直读库"的开关。
|
|
3340
|
+
* @param sessionId - 会话 id。
|
|
3341
|
+
* @returns 该会话的 checkpoint,缺失时 `undefined`。
|
|
3342
|
+
*/
|
|
3343
|
+
readProjcacheSync?(sessionId: string): StoredProjcacheEntry | undefined;
|
|
3344
|
+
/**
|
|
3345
|
+
* 同步读一个会话的标题列(`t_sessions.f_title` / `f_title_seq`,rdb 写路径与
|
|
3346
|
+
* rewind 维护):只有同步驱动提供,列表消费直接取会话数据,不依赖 checkpoint
|
|
3347
|
+
* 行是否存在。
|
|
3348
|
+
* @param sessionId - 会话 id。
|
|
3349
|
+
* @returns 标题与其事件 seq,未写过标题时 `undefined`。
|
|
3350
|
+
*/
|
|
3351
|
+
readSessionTitleSync?(sessionId: string): {
|
|
3352
|
+
title: string;
|
|
3353
|
+
seq: number;
|
|
3354
|
+
} | undefined;
|
|
3355
|
+
/**
|
|
3356
|
+
* 覆盖写一个会话的 checkpoint 行(先清旧行再写新行,同一事务)。记录头
|
|
3357
|
+
* 不在这里:它与 `t_sessions` 行 1:1,identity 直接复用该行的列。
|
|
3358
|
+
* @param sessionId - 会话 id。
|
|
3359
|
+
* @param rows - 每个投影 key 一行。
|
|
3360
|
+
*/
|
|
3361
|
+
putProjcache(sessionId: string, rows: ProjectionCheckpoint): Promise<void>;
|
|
3362
|
+
/** 删除一个会话的 checkpoint(缺失为 no-op)。 */
|
|
3363
|
+
deleteProjcache(sessionId: string): Promise<void>;
|
|
3364
|
+
}
|
|
3365
|
+
//#endregion
|
|
3366
|
+
//#region src/backend.d.ts
|
|
3367
|
+
interface SessionRow {
|
|
3368
|
+
fSessionId: string;
|
|
3369
|
+
fHeadEventId: string;
|
|
3370
|
+
fHeadSequence: number;
|
|
3371
|
+
fVersion: number;
|
|
3372
|
+
fCreatedAt: number;
|
|
3373
|
+
fCwd: string | null;
|
|
3374
|
+
fParentSession: string | null;
|
|
3375
|
+
fSeedLength: number | null;
|
|
3376
|
+
fOrigin: string | null;
|
|
3377
|
+
fDelegationDepth: number | null;
|
|
3378
|
+
fIncarnation: string;
|
|
3379
|
+
fRevision: number;
|
|
3380
|
+
}
|
|
3381
|
+
interface EventInsert {
|
|
3382
|
+
fEventId: string;
|
|
3383
|
+
fParentId: string;
|
|
3384
|
+
fType: string;
|
|
3385
|
+
fKind: string;
|
|
3386
|
+
fRole: string;
|
|
3387
|
+
fName: string;
|
|
3388
|
+
fActionId: string;
|
|
3389
|
+
fEncoding: string;
|
|
3390
|
+
fData: string;
|
|
3391
|
+
fCreatedAt: number;
|
|
3392
|
+
}
|
|
3393
|
+
interface EventRow {
|
|
3394
|
+
fEventId: string;
|
|
3395
|
+
fSequence: number;
|
|
3396
|
+
fType: string;
|
|
3397
|
+
fKind: string;
|
|
3398
|
+
fRole: string;
|
|
3399
|
+
fName: string;
|
|
3400
|
+
fActionId: string;
|
|
3401
|
+
fCreatedAt: number;
|
|
3402
|
+
fData: string;
|
|
3403
|
+
fSurfaceOp: string | null;
|
|
3404
|
+
}
|
|
3405
|
+
interface BackendTx {
|
|
3406
|
+
upsertSession(storage: SessionStorageMetadata, incarnation: string): Promise<void>;
|
|
3407
|
+
getHead(id: SessionId): Promise<Pick<SessionRow, "fHeadEventId" | "fHeadSequence">>;
|
|
3408
|
+
getSeedLength(id: SessionId): Promise<number | null>;
|
|
3409
|
+
updateSeedLength(id: SessionId, seedLength: number): Promise<void>;
|
|
3410
|
+
/** 从事件表重算会话标题(最后一条 `session/title`)并写回会话行。 */
|
|
3411
|
+
refreshTitle(id: SessionId): Promise<void>;
|
|
3412
|
+
insertEvents(events: EventInsert[]): Promise<void>;
|
|
3413
|
+
insertBridges(rows: Array<{
|
|
3414
|
+
fSessionId: SessionId;
|
|
3415
|
+
fEventId: string;
|
|
3416
|
+
fSequence: number;
|
|
3417
|
+
fSurfaceOp: string | null;
|
|
3418
|
+
}>): Promise<void>;
|
|
3419
|
+
updateHead(id: SessionId, headEventId: string, headSequence: number): Promise<void>;
|
|
3420
|
+
bumpRevision(id: SessionId): Promise<void>;
|
|
3421
|
+
deleteBridgeTail(id: SessionId, fromSequence: number): Promise<void>;
|
|
3422
|
+
getPrevBridge(id: SessionId, sequence: number): Promise<{
|
|
3423
|
+
fEventId: string;
|
|
3424
|
+
fSequence: number;
|
|
3425
|
+
} | undefined>;
|
|
3426
|
+
}
|
|
3427
|
+
interface Backend {
|
|
3428
|
+
readonly kind: "sqlite" | "postgres";
|
|
3429
|
+
readonly storeIdentity: string;
|
|
3430
|
+
/** storages 接管表(workspace 域与投影 checkpoint)的访问层:与事件日志同介质。 */
|
|
3431
|
+
readonly storage: StorageRepository;
|
|
3432
|
+
open(): Promise<void>;
|
|
3433
|
+
getSession(id: SessionId): Promise<SessionRow | undefined>;
|
|
3434
|
+
getEventRows(id: SessionId, fromSequence?: number): Promise<EventRow[]>;
|
|
3435
|
+
listSessions(): Promise<SessionRow[]>;
|
|
3436
|
+
transaction<T>(fn: (tx: BackendTx) => Promise<T>): Promise<T>;
|
|
3437
|
+
close(): Promise<void>;
|
|
3438
|
+
}
|
|
3439
|
+
//#endregion
|
|
3440
|
+
//#region src/write-guard.d.ts
|
|
3441
|
+
declare class WriteGuard {
|
|
3442
|
+
private readonly headSeqs;
|
|
3443
|
+
confirmHead(id: SessionId, head: number): void;
|
|
3444
|
+
assertNoConcurrentWriter(id: SessionId, storedHead: number): void;
|
|
3445
|
+
}
|
|
3446
|
+
//#endregion
|
|
3447
|
+
//#region src/schema.d.ts
|
|
3448
|
+
declare const SCHEMA_VERSION = 3;
|
|
3449
|
+
declare const SESSION_PERSISTENCE_SQLITE_APPLICATION_ID = 1146308688;
|
|
3450
|
+
declare const EVENT_ENCODING = "json";
|
|
3451
|
+
declare const tPersistenceState: any;
|
|
3452
|
+
declare const tSchemaMeta: any;
|
|
3453
|
+
declare const tSessions: any;
|
|
3454
|
+
declare const tEvents: any;
|
|
3455
|
+
declare const tSessionEvents: any;
|
|
3456
|
+
declare const tStorageUnits: any;
|
|
3457
|
+
declare const tWorkspaces: any;
|
|
3458
|
+
declare const tWorkspaceSessions: any;
|
|
3459
|
+
declare const tWorkspaceState: any;
|
|
3460
|
+
declare const tSessionProjcacheRows: any;
|
|
3461
|
+
type JournalMode = "wal" | "delete" | "truncate" | "persist";
|
|
3462
|
+
declare const DEFAULT_BUSY_TIMEOUT_MS = 5000;
|
|
3463
|
+
type EventKind = "message" | "thinking" | "turn" | "tool" | "request" | "config" | "audit" | "lifecycle" | "inbox" | "compaction" | "llm" | "subagent" | "team" | "workflow" | "goal" | "schedule" | "todo" | "web";
|
|
3464
|
+
type EventRole = "user" | "assistant" | "tool";
|
|
3465
|
+
declare function eventKind(event: {
|
|
3466
|
+
type: string;
|
|
3467
|
+
data?: unknown;
|
|
3468
|
+
}): EventKind | "";
|
|
3469
|
+
declare function eventDimensions(event: SessionEvent): {
|
|
3470
|
+
kind: string;
|
|
3471
|
+
role: string;
|
|
3472
|
+
name: string;
|
|
3473
|
+
actionId: string;
|
|
3474
|
+
};
|
|
3475
|
+
//#endregion
|
|
3476
|
+
export { EventRow as C, BackendTx as S, StorageRepository as T, tWorkspaceSessions as _, JournalMode as a, WriteGuard as b, eventDimensions as c, tPersistenceState as d, tSchemaMeta as f, tStorageUnits as g, tSessions as h, EventRole as i, eventKind as l, tSessionProjcacheRows as m, EVENT_ENCODING as n, SCHEMA_VERSION as o, tSessionEvents as p, EventKind as r, SESSION_PERSISTENCE_SQLITE_APPLICATION_ID as s, DEFAULT_BUSY_TIMEOUT_MS as t, tEvents as u, tWorkspaceState as v, SessionRow as w, Backend as x, tWorkspaces as y };
|