@milaboratories/milaboratories.pool-explorer 1.2.64 → 1.2.66

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.
@@ -0,0 +1,4568 @@
1
+ //#region ../../../../lib/model/common/dist/author_marker.d.ts
2
+ //#region src/author_marker.d.ts
3
+ /** Structure to help resolve conflicts if multiple participants writes to
4
+ * the same state */
5
+ interface AuthorMarker {
6
+ /** Unique identifier of client or even a specific window that sets this
7
+ * particular state */
8
+ authorId: string;
9
+ /** Sequential version of the state local to the author */
10
+ localVersion: number;
11
+ } //#endregion
12
+ //#endregion
13
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.d.cts
14
+ type Primitive = string | number | symbol | bigint | boolean | null | undefined;
15
+ //#endregion
16
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.d.cts
17
+ declare namespace util {
18
+ type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends (<V>() => V extends U ? 1 : 2) ? true : false;
19
+ export type isAny<T> = 0 extends 1 & T ? true : false;
20
+ export const assertEqual: <A, B>(_: AssertEqual<A, B>) => void;
21
+ export function assertIs<T>(_arg: T): void;
22
+ export function assertNever(_x: never): never;
23
+ export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
24
+ export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
25
+ export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
26
+ export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
27
+ export type InexactPartial<T> = { [k in keyof T]?: T[k] | undefined };
28
+ export const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k };
29
+ export const getValidEnumValues: (obj: any) => any[];
30
+ export const objectValues: (obj: any) => any[];
31
+ export const objectKeys: ObjectConstructor["keys"];
32
+ export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
33
+ export type identity<T> = objectUtil.identity<T>;
34
+ export type flatten<T> = objectUtil.flatten<T>;
35
+ export type noUndefined<T> = T extends undefined ? never : T;
36
+ export const isInteger: NumberConstructor["isInteger"];
37
+ export function joinValues<T extends any[]>(array: T, separator?: string): string;
38
+ export const jsonStringifyReplacer: (_: string, value: any) => any;
39
+ export {};
40
+ }
41
+ declare namespace objectUtil {
42
+ export type MergeShapes<U, V> = keyof U & keyof V extends never ? U & V : { [k in Exclude<keyof U, keyof V>]: U[k] } & V;
43
+ type optionalKeys<T extends object> = { [k in keyof T]: undefined extends T[k] ? k : never }[keyof T];
44
+ type requiredKeys<T extends object> = { [k in keyof T]: undefined extends T[k] ? never : k }[keyof T];
45
+ export type addQuestionMarks<T extends object, _O = any> = { [K in requiredKeys<T>]: T[K] } & { [K in optionalKeys<T>]?: T[K] } & { [k in keyof T]?: unknown };
46
+ export type identity<T> = T;
47
+ export type flatten<T> = identity<{ [k in keyof T]: T[k] }>;
48
+ export type noNeverKeys<T> = { [k in keyof T]: [T[k]] extends [never] ? never : k }[keyof T];
49
+ export type noNever<T> = identity<{ [k in noNeverKeys<T>]: k extends keyof T ? T[k] : never }>;
50
+ export const mergeShapes: <U, T>(first: U, second: T) => T & U;
51
+ export type extendShape<A extends object, B extends object> = 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] };
52
+ export {};
53
+ }
54
+ declare const ZodParsedType: {
55
+ string: "string";
56
+ nan: "nan";
57
+ number: "number";
58
+ integer: "integer";
59
+ float: "float";
60
+ boolean: "boolean";
61
+ date: "date";
62
+ bigint: "bigint";
63
+ symbol: "symbol";
64
+ function: "function";
65
+ undefined: "undefined";
66
+ null: "null";
67
+ array: "array";
68
+ object: "object";
69
+ unknown: "unknown";
70
+ promise: "promise";
71
+ void: "void";
72
+ never: "never";
73
+ map: "map";
74
+ set: "set";
75
+ };
76
+ type ZodParsedType = keyof typeof ZodParsedType;
77
+ //#endregion
78
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.d.cts
79
+ type allKeys<T> = T extends any ? keyof T : never;
80
+ type typeToFlattenedError<T, U = string> = {
81
+ formErrors: U[];
82
+ fieldErrors: { [P in allKeys<T>]?: U[] };
83
+ };
84
+ declare const ZodIssueCode: {
85
+ invalid_type: "invalid_type";
86
+ invalid_literal: "invalid_literal";
87
+ custom: "custom";
88
+ invalid_union: "invalid_union";
89
+ invalid_union_discriminator: "invalid_union_discriminator";
90
+ invalid_enum_value: "invalid_enum_value";
91
+ unrecognized_keys: "unrecognized_keys";
92
+ invalid_arguments: "invalid_arguments";
93
+ invalid_return_type: "invalid_return_type";
94
+ invalid_date: "invalid_date";
95
+ invalid_string: "invalid_string";
96
+ too_small: "too_small";
97
+ too_big: "too_big";
98
+ invalid_intersection_types: "invalid_intersection_types";
99
+ not_multiple_of: "not_multiple_of";
100
+ not_finite: "not_finite";
101
+ };
102
+ type ZodIssueCode = keyof typeof ZodIssueCode;
103
+ type ZodIssueBase = {
104
+ path: (string | number)[];
105
+ message?: string | undefined;
106
+ };
107
+ interface ZodInvalidTypeIssue extends ZodIssueBase {
108
+ code: typeof ZodIssueCode.invalid_type;
109
+ expected: ZodParsedType;
110
+ received: ZodParsedType;
111
+ }
112
+ interface ZodInvalidLiteralIssue extends ZodIssueBase {
113
+ code: typeof ZodIssueCode.invalid_literal;
114
+ expected: unknown;
115
+ received: unknown;
116
+ }
117
+ interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
118
+ code: typeof ZodIssueCode.unrecognized_keys;
119
+ keys: string[];
120
+ }
121
+ interface ZodInvalidUnionIssue extends ZodIssueBase {
122
+ code: typeof ZodIssueCode.invalid_union;
123
+ unionErrors: ZodError[];
124
+ }
125
+ interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
126
+ code: typeof ZodIssueCode.invalid_union_discriminator;
127
+ options: Primitive[];
128
+ }
129
+ interface ZodInvalidEnumValueIssue extends ZodIssueBase {
130
+ received: string | number;
131
+ code: typeof ZodIssueCode.invalid_enum_value;
132
+ options: (string | number)[];
133
+ }
134
+ interface ZodInvalidArgumentsIssue extends ZodIssueBase {
135
+ code: typeof ZodIssueCode.invalid_arguments;
136
+ argumentsError: ZodError;
137
+ }
138
+ interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
139
+ code: typeof ZodIssueCode.invalid_return_type;
140
+ returnTypeError: ZodError;
141
+ }
142
+ interface ZodInvalidDateIssue extends ZodIssueBase {
143
+ code: typeof ZodIssueCode.invalid_date;
144
+ }
145
+ type StringValidation = "email" | "url" | "emoji" | "uuid" | "nanoid" | "regex" | "cuid" | "cuid2" | "ulid" | "datetime" | "date" | "time" | "duration" | "ip" | "cidr" | "base64" | "jwt" | "base64url" | {
146
+ includes: string;
147
+ position?: number | undefined;
148
+ } | {
149
+ startsWith: string;
150
+ } | {
151
+ endsWith: string;
152
+ };
153
+ interface ZodInvalidStringIssue extends ZodIssueBase {
154
+ code: typeof ZodIssueCode.invalid_string;
155
+ validation: StringValidation;
156
+ }
157
+ interface ZodTooSmallIssue extends ZodIssueBase {
158
+ code: typeof ZodIssueCode.too_small;
159
+ minimum: number | bigint;
160
+ inclusive: boolean;
161
+ exact?: boolean;
162
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
163
+ }
164
+ interface ZodTooBigIssue extends ZodIssueBase {
165
+ code: typeof ZodIssueCode.too_big;
166
+ maximum: number | bigint;
167
+ inclusive: boolean;
168
+ exact?: boolean;
169
+ type: "array" | "string" | "number" | "set" | "date" | "bigint";
170
+ }
171
+ interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
172
+ code: typeof ZodIssueCode.invalid_intersection_types;
173
+ }
174
+ interface ZodNotMultipleOfIssue extends ZodIssueBase {
175
+ code: typeof ZodIssueCode.not_multiple_of;
176
+ multipleOf: number | bigint;
177
+ }
178
+ interface ZodNotFiniteIssue extends ZodIssueBase {
179
+ code: typeof ZodIssueCode.not_finite;
180
+ }
181
+ interface ZodCustomIssue extends ZodIssueBase {
182
+ code: typeof ZodIssueCode.custom;
183
+ params?: {
184
+ [k: string]: any;
185
+ };
186
+ }
187
+ type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
188
+ type ZodIssue = ZodIssueOptionalMessage & {
189
+ fatal?: boolean | undefined;
190
+ message: string;
191
+ };
192
+ type recursiveZodFormattedError<T> = T extends [any, ...any[]] ? { [K in keyof T]?: ZodFormattedError<T[K]> } : T extends any[] ? {
193
+ [k: number]: ZodFormattedError<T[number]>;
194
+ } : T extends object ? { [K in keyof T]?: ZodFormattedError<T[K]> } : unknown;
195
+ type ZodFormattedError<T, U = string> = {
196
+ _errors: U[];
197
+ } & recursiveZodFormattedError<NonNullable<T>>;
198
+ declare class ZodError<T = any> extends Error {
199
+ issues: ZodIssue[];
200
+ get errors(): ZodIssue[];
201
+ constructor(issues: ZodIssue[]);
202
+ format(): ZodFormattedError<T>;
203
+ format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
204
+ static create: (issues: ZodIssue[]) => ZodError<any>;
205
+ static assert(value: unknown): asserts value is ZodError;
206
+ toString(): string;
207
+ get message(): string;
208
+ get isEmpty(): boolean;
209
+ addIssue: (sub: ZodIssue) => void;
210
+ addIssues: (subs?: ZodIssue[]) => void;
211
+ flatten(): typeToFlattenedError<T>;
212
+ flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
213
+ get formErrors(): typeToFlattenedError<T, string>;
214
+ }
215
+ type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
216
+ type IssueData = stripPath<ZodIssueOptionalMessage> & {
217
+ path?: (string | number)[];
218
+ fatal?: boolean | undefined;
219
+ };
220
+ type ErrorMapCtx = {
221
+ defaultError: string;
222
+ data: any;
223
+ };
224
+ type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
225
+ message: string;
226
+ };
227
+ //#endregion
228
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.d.cts
229
+ type ParseParams = {
230
+ path: (string | number)[];
231
+ errorMap: ZodErrorMap;
232
+ async: boolean;
233
+ };
234
+ type ParsePathComponent = string | number;
235
+ type ParsePath = ParsePathComponent[];
236
+ interface ParseContext {
237
+ readonly common: {
238
+ readonly issues: ZodIssue[];
239
+ readonly contextualErrorMap?: ZodErrorMap | undefined;
240
+ readonly async: boolean;
241
+ };
242
+ readonly path: ParsePath;
243
+ readonly schemaErrorMap?: ZodErrorMap | undefined;
244
+ readonly parent: ParseContext | null;
245
+ readonly data: any;
246
+ readonly parsedType: ZodParsedType;
247
+ }
248
+ type ParseInput = {
249
+ data: any;
250
+ path: (string | number)[];
251
+ parent: ParseContext;
252
+ };
253
+ declare class ParseStatus {
254
+ value: "aborted" | "dirty" | "valid";
255
+ dirty(): void;
256
+ abort(): void;
257
+ static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
258
+ static mergeObjectAsync(status: ParseStatus, pairs: {
259
+ key: ParseReturnType<any>;
260
+ value: ParseReturnType<any>;
261
+ }[]): Promise<SyncParseReturnType<any>>;
262
+ static mergeObjectSync(status: ParseStatus, pairs: {
263
+ key: SyncParseReturnType<any>;
264
+ value: SyncParseReturnType<any>;
265
+ alwaysSet?: boolean;
266
+ }[]): SyncParseReturnType;
267
+ }
268
+ type INVALID = {
269
+ status: "aborted";
270
+ };
271
+ declare const INVALID: INVALID;
272
+ type DIRTY<T> = {
273
+ status: "dirty";
274
+ value: T;
275
+ };
276
+ declare const DIRTY: <T>(value: T) => DIRTY<T>;
277
+ type OK<T> = {
278
+ status: "valid";
279
+ value: T;
280
+ };
281
+ declare const OK: <T>(value: T) => OK<T>;
282
+ type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
283
+ type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
284
+ type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
285
+ //#endregion
286
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/enumUtil.d.cts
287
+ declare namespace enumUtil {
288
+ type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends ((k: infer Intersection) => void) ? Intersection : never;
289
+ type GetUnionLast<T> = UnionToIntersectionFn<T> extends (() => infer Last) ? Last : never;
290
+ type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
291
+ type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
292
+ export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
293
+ export {};
294
+ }
295
+ //#endregion
296
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.d.cts
297
+ declare namespace errorUtil {
298
+ type ErrMessage = string | {
299
+ message?: string | undefined;
300
+ };
301
+ const errToObj: (message?: ErrMessage) => {
302
+ message?: string | undefined;
303
+ };
304
+ const toString: (message?: ErrMessage) => string | undefined;
305
+ }
306
+ //#endregion
307
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/partialUtil.d.cts
308
+ declare namespace partialUtil {
309
+ type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<ZodRawShape> ? ZodObject<{ [k in keyof T["shape"]]: ZodOptional<DeepPartial<T["shape"][k]>> }, T["_def"]["unknownKeys"], T["_def"]["catchall"]> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? { [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never } extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
310
+ }
311
+ //#endregion
312
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/standard-schema.d.cts
313
+ /**
314
+ * The Standard Schema interface.
315
+ */
316
+ type StandardSchemaV1<Input = unknown, Output = Input> = {
317
+ /**
318
+ * The Standard Schema properties.
319
+ */
320
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
321
+ };
322
+ declare namespace StandardSchemaV1 {
323
+ /**
324
+ * The Standard Schema properties interface.
325
+ */
326
+ export interface Props<Input = unknown, Output = Input> {
327
+ /**
328
+ * The version number of the standard.
329
+ */
330
+ readonly version: 1;
331
+ /**
332
+ * The vendor name of the schema library.
333
+ */
334
+ readonly vendor: string;
335
+ /**
336
+ * Validates unknown input values.
337
+ */
338
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
339
+ /**
340
+ * Inferred types associated with the schema.
341
+ */
342
+ readonly types?: Types<Input, Output> | undefined;
343
+ }
344
+ /**
345
+ * The result interface of the validate function.
346
+ */
347
+ export type Result<Output> = SuccessResult<Output> | FailureResult;
348
+ /**
349
+ * The result interface if validation succeeds.
350
+ */
351
+ export interface SuccessResult<Output> {
352
+ /**
353
+ * The typed output value.
354
+ */
355
+ readonly value: Output;
356
+ /**
357
+ * The non-existent issues.
358
+ */
359
+ readonly issues?: undefined;
360
+ }
361
+ /**
362
+ * The result interface if validation fails.
363
+ */
364
+ export interface FailureResult {
365
+ /**
366
+ * The issues of failed validation.
367
+ */
368
+ readonly issues: ReadonlyArray<Issue>;
369
+ }
370
+ /**
371
+ * The issue interface of the failure output.
372
+ */
373
+ export interface Issue {
374
+ /**
375
+ * The error message of the issue.
376
+ */
377
+ readonly message: string;
378
+ /**
379
+ * The path of the issue, if any.
380
+ */
381
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
382
+ }
383
+ /**
384
+ * The path segment interface of the issue.
385
+ */
386
+ export interface PathSegment {
387
+ /**
388
+ * The key representing a path segment.
389
+ */
390
+ readonly key: PropertyKey;
391
+ }
392
+ /**
393
+ * The Standard Schema types interface.
394
+ */
395
+ export interface Types<Input = unknown, Output = Input> {
396
+ /**
397
+ * The input type of the schema.
398
+ */
399
+ readonly input: Input;
400
+ /**
401
+ * The output type of the schema.
402
+ */
403
+ readonly output: Output;
404
+ }
405
+ /**
406
+ * Infers the input type of a Standard Schema.
407
+ */
408
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
409
+ /**
410
+ * Infers the output type of a Standard Schema.
411
+ */
412
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
413
+ export {};
414
+ }
415
+ //#endregion
416
+ //#region ../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.d.cts
417
+ interface RefinementCtx {
418
+ addIssue: (arg: IssueData) => void;
419
+ path: (string | number)[];
420
+ }
421
+ type ZodRawShape = {
422
+ [k: string]: ZodTypeAny;
423
+ };
424
+ type ZodTypeAny = ZodType<any, any, any>;
425
+ type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
426
+ type input<T extends ZodType<any, any, any>> = T["_input"];
427
+ type output<T extends ZodType<any, any, any>> = T["_output"];
428
+ type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
429
+ interface ZodTypeDef {
430
+ errorMap?: ZodErrorMap | undefined;
431
+ description?: string | undefined;
432
+ }
433
+ type RawCreateParams = {
434
+ errorMap?: ZodErrorMap | undefined;
435
+ invalid_type_error?: string | undefined;
436
+ required_error?: string | undefined;
437
+ message?: string | undefined;
438
+ description?: string | undefined;
439
+ } | undefined;
440
+ type SafeParseSuccess<Output> = {
441
+ success: true;
442
+ data: Output;
443
+ error?: never;
444
+ };
445
+ type SafeParseError<Input> = {
446
+ success: false;
447
+ error: ZodError<Input>;
448
+ data?: never;
449
+ };
450
+ type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
451
+ declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
452
+ readonly _type: Output;
453
+ readonly _output: Output;
454
+ readonly _input: Input;
455
+ readonly _def: Def;
456
+ get description(): string | undefined;
457
+ "~standard": StandardSchemaV1.Props<Input, Output>;
458
+ abstract _parse(input: ParseInput): ParseReturnType<Output>;
459
+ _getType(input: ParseInput): string;
460
+ _getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
461
+ _processInputParams(input: ParseInput): {
462
+ status: ParseStatus;
463
+ ctx: ParseContext;
464
+ };
465
+ _parseSync(input: ParseInput): SyncParseReturnType<Output>;
466
+ _parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
467
+ parse(data: unknown, params?: util.InexactPartial<ParseParams>): Output;
468
+ safeParse(data: unknown, params?: util.InexactPartial<ParseParams>): SafeParseReturnType<Input, Output>;
469
+ "~validate"(data: unknown): StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
470
+ parseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<Output>;
471
+ safeParseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
472
+ /** Alias of safeParseAsync */
473
+ spa: (data: unknown, params?: util.InexactPartial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
474
+ refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
475
+ refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
476
+ refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
477
+ refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
478
+ _refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
479
+ superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
480
+ superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
481
+ superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects<this, Output, Input>;
482
+ constructor(def: Def);
483
+ optional(): ZodOptional<this>;
484
+ nullable(): ZodNullable<this>;
485
+ nullish(): ZodOptional<ZodNullable<this>>;
486
+ array(): ZodArray<this>;
487
+ promise(): ZodPromise<this>;
488
+ or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
489
+ and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
490
+ transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
491
+ default(def: util.noUndefined<Input>): ZodDefault<this>;
492
+ default(def: () => util.noUndefined<Input>): ZodDefault<this>;
493
+ brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
494
+ catch(def: Output): ZodCatch<this>;
495
+ catch(def: (ctx: {
496
+ error: ZodError;
497
+ input: Input;
498
+ }) => Output): ZodCatch<this>;
499
+ describe(description: string): this;
500
+ pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
501
+ readonly(): ZodReadonly<this>;
502
+ isOptional(): boolean;
503
+ isNullable(): boolean;
504
+ }
505
+ type IpVersion = "v4" | "v6";
506
+ type ZodStringCheck = {
507
+ kind: "min";
508
+ value: number;
509
+ message?: string | undefined;
510
+ } | {
511
+ kind: "max";
512
+ value: number;
513
+ message?: string | undefined;
514
+ } | {
515
+ kind: "length";
516
+ value: number;
517
+ message?: string | undefined;
518
+ } | {
519
+ kind: "email";
520
+ message?: string | undefined;
521
+ } | {
522
+ kind: "url";
523
+ message?: string | undefined;
524
+ } | {
525
+ kind: "emoji";
526
+ message?: string | undefined;
527
+ } | {
528
+ kind: "uuid";
529
+ message?: string | undefined;
530
+ } | {
531
+ kind: "nanoid";
532
+ message?: string | undefined;
533
+ } | {
534
+ kind: "cuid";
535
+ message?: string | undefined;
536
+ } | {
537
+ kind: "includes";
538
+ value: string;
539
+ position?: number | undefined;
540
+ message?: string | undefined;
541
+ } | {
542
+ kind: "cuid2";
543
+ message?: string | undefined;
544
+ } | {
545
+ kind: "ulid";
546
+ message?: string | undefined;
547
+ } | {
548
+ kind: "startsWith";
549
+ value: string;
550
+ message?: string | undefined;
551
+ } | {
552
+ kind: "endsWith";
553
+ value: string;
554
+ message?: string | undefined;
555
+ } | {
556
+ kind: "regex";
557
+ regex: RegExp;
558
+ message?: string | undefined;
559
+ } | {
560
+ kind: "trim";
561
+ message?: string | undefined;
562
+ } | {
563
+ kind: "toLowerCase";
564
+ message?: string | undefined;
565
+ } | {
566
+ kind: "toUpperCase";
567
+ message?: string | undefined;
568
+ } | {
569
+ kind: "jwt";
570
+ alg?: string;
571
+ message?: string | undefined;
572
+ } | {
573
+ kind: "datetime";
574
+ offset: boolean;
575
+ local: boolean;
576
+ precision: number | null;
577
+ message?: string | undefined;
578
+ } | {
579
+ kind: "date";
580
+ message?: string | undefined;
581
+ } | {
582
+ kind: "time";
583
+ precision: number | null;
584
+ message?: string | undefined;
585
+ } | {
586
+ kind: "duration";
587
+ message?: string | undefined;
588
+ } | {
589
+ kind: "ip";
590
+ version?: IpVersion | undefined;
591
+ message?: string | undefined;
592
+ } | {
593
+ kind: "cidr";
594
+ version?: IpVersion | undefined;
595
+ message?: string | undefined;
596
+ } | {
597
+ kind: "base64";
598
+ message?: string | undefined;
599
+ } | {
600
+ kind: "base64url";
601
+ message?: string | undefined;
602
+ };
603
+ interface ZodStringDef extends ZodTypeDef {
604
+ checks: ZodStringCheck[];
605
+ typeName: ZodFirstPartyTypeKind.ZodString;
606
+ coerce: boolean;
607
+ }
608
+ declare class ZodString extends ZodType<string, ZodStringDef, string> {
609
+ _parse(input: ParseInput): ParseReturnType<string>;
610
+ protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects<this, string, string>;
611
+ _addCheck(check: ZodStringCheck): ZodString;
612
+ email(message?: errorUtil.ErrMessage): ZodString;
613
+ url(message?: errorUtil.ErrMessage): ZodString;
614
+ emoji(message?: errorUtil.ErrMessage): ZodString;
615
+ uuid(message?: errorUtil.ErrMessage): ZodString;
616
+ nanoid(message?: errorUtil.ErrMessage): ZodString;
617
+ cuid(message?: errorUtil.ErrMessage): ZodString;
618
+ cuid2(message?: errorUtil.ErrMessage): ZodString;
619
+ ulid(message?: errorUtil.ErrMessage): ZodString;
620
+ base64(message?: errorUtil.ErrMessage): ZodString;
621
+ base64url(message?: errorUtil.ErrMessage): ZodString;
622
+ jwt(options?: {
623
+ alg?: string;
624
+ message?: string | undefined;
625
+ }): ZodString;
626
+ ip(options?: string | {
627
+ version?: IpVersion;
628
+ message?: string | undefined;
629
+ }): ZodString;
630
+ cidr(options?: string | {
631
+ version?: IpVersion;
632
+ message?: string | undefined;
633
+ }): ZodString;
634
+ datetime(options?: string | {
635
+ message?: string | undefined;
636
+ precision?: number | null;
637
+ offset?: boolean;
638
+ local?: boolean;
639
+ }): ZodString;
640
+ date(message?: string): ZodString;
641
+ time(options?: string | {
642
+ message?: string | undefined;
643
+ precision?: number | null;
644
+ }): ZodString;
645
+ duration(message?: errorUtil.ErrMessage): ZodString;
646
+ regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
647
+ includes(value: string, options?: {
648
+ message?: string;
649
+ position?: number;
650
+ }): ZodString;
651
+ startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
652
+ endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
653
+ min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
654
+ max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
655
+ length(len: number, message?: errorUtil.ErrMessage): ZodString;
656
+ /**
657
+ * Equivalent to `.min(1)`
658
+ */
659
+ nonempty(message?: errorUtil.ErrMessage): ZodString;
660
+ trim(): ZodString;
661
+ toLowerCase(): ZodString;
662
+ toUpperCase(): ZodString;
663
+ get isDatetime(): boolean;
664
+ get isDate(): boolean;
665
+ get isTime(): boolean;
666
+ get isDuration(): boolean;
667
+ get isEmail(): boolean;
668
+ get isURL(): boolean;
669
+ get isEmoji(): boolean;
670
+ get isUUID(): boolean;
671
+ get isNANOID(): boolean;
672
+ get isCUID(): boolean;
673
+ get isCUID2(): boolean;
674
+ get isULID(): boolean;
675
+ get isIP(): boolean;
676
+ get isCIDR(): boolean;
677
+ get isBase64(): boolean;
678
+ get isBase64url(): boolean;
679
+ get minLength(): number | null;
680
+ get maxLength(): number | null;
681
+ static create: (params?: RawCreateParams & {
682
+ coerce?: true;
683
+ }) => ZodString;
684
+ }
685
+ type ZodNumberCheck = {
686
+ kind: "min";
687
+ value: number;
688
+ inclusive: boolean;
689
+ message?: string | undefined;
690
+ } | {
691
+ kind: "max";
692
+ value: number;
693
+ inclusive: boolean;
694
+ message?: string | undefined;
695
+ } | {
696
+ kind: "int";
697
+ message?: string | undefined;
698
+ } | {
699
+ kind: "multipleOf";
700
+ value: number;
701
+ message?: string | undefined;
702
+ } | {
703
+ kind: "finite";
704
+ message?: string | undefined;
705
+ };
706
+ interface ZodNumberDef extends ZodTypeDef {
707
+ checks: ZodNumberCheck[];
708
+ typeName: ZodFirstPartyTypeKind.ZodNumber;
709
+ coerce: boolean;
710
+ }
711
+ declare class ZodNumber extends ZodType<number, ZodNumberDef, number> {
712
+ _parse(input: ParseInput): ParseReturnType<number>;
713
+ static create: (params?: RawCreateParams & {
714
+ coerce?: boolean;
715
+ }) => ZodNumber;
716
+ gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
717
+ min: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
718
+ gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
719
+ lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
720
+ max: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
721
+ lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
722
+ protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
723
+ _addCheck(check: ZodNumberCheck): ZodNumber;
724
+ int(message?: errorUtil.ErrMessage): ZodNumber;
725
+ positive(message?: errorUtil.ErrMessage): ZodNumber;
726
+ negative(message?: errorUtil.ErrMessage): ZodNumber;
727
+ nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
728
+ nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
729
+ multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
730
+ step: (value: number, message?: errorUtil.ErrMessage) => ZodNumber;
731
+ finite(message?: errorUtil.ErrMessage): ZodNumber;
732
+ safe(message?: errorUtil.ErrMessage): ZodNumber;
733
+ get minValue(): number | null;
734
+ get maxValue(): number | null;
735
+ get isInt(): boolean;
736
+ get isFinite(): boolean;
737
+ }
738
+ interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
739
+ type: T;
740
+ typeName: ZodFirstPartyTypeKind.ZodArray;
741
+ exactLength: {
742
+ value: number;
743
+ message?: string | undefined;
744
+ } | null;
745
+ minLength: {
746
+ value: number;
747
+ message?: string | undefined;
748
+ } | null;
749
+ maxLength: {
750
+ value: number;
751
+ message?: string | undefined;
752
+ } | null;
753
+ }
754
+ type ArrayCardinality = "many" | "atleastone";
755
+ type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
756
+ declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
757
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
758
+ get element(): T;
759
+ min(minLength: number, message?: errorUtil.ErrMessage): this;
760
+ max(maxLength: number, message?: errorUtil.ErrMessage): this;
761
+ length(len: number, message?: errorUtil.ErrMessage): this;
762
+ nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
763
+ static create: <El extends ZodTypeAny>(schema: El, params?: RawCreateParams) => ZodArray<El>;
764
+ }
765
+ type UnknownKeysParam = "passthrough" | "strict" | "strip";
766
+ interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
767
+ typeName: ZodFirstPartyTypeKind.ZodObject;
768
+ shape: () => T;
769
+ catchall: Catchall;
770
+ unknownKeys: UnknownKeys;
771
+ }
772
+ type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
773
+ type baseObjectOutputType<Shape extends ZodRawShape> = { [k in keyof Shape]: Shape[k]["_output"] };
774
+ type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
775
+ type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{ [k in keyof Shape]: Shape[k]["_input"] }>;
776
+ type CatchallOutput<T extends ZodType> = ZodType extends T ? unknown : {
777
+ [k: string]: T["_output"];
778
+ };
779
+ type CatchallInput<T extends ZodType> = ZodType extends T ? unknown : {
780
+ [k: string]: T["_input"];
781
+ };
782
+ type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
783
+ [k: string]: unknown;
784
+ } : unknown;
785
+ type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
786
+ declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
787
+ private _cached;
788
+ _getCached(): {
789
+ shape: T;
790
+ keys: string[];
791
+ };
792
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
793
+ get shape(): T;
794
+ strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
795
+ strip(): ZodObject<T, "strip", Catchall>;
796
+ passthrough(): ZodObject<T, "passthrough", Catchall>;
797
+ /**
798
+ * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
799
+ * If you want to pass through unknown properties, use `.passthrough()` instead.
800
+ */
801
+ nonstrict: () => ZodObject<T, "passthrough", Catchall>;
802
+ extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
803
+ /**
804
+ * @deprecated Use `.extend` instead
805
+ * */
806
+ augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
807
+ /**
808
+ * Prior to zod@1.0.12 there was a bug in the
809
+ * inferred type of merged objects. Please
810
+ * upgrade if you are experiencing issues.
811
+ */
812
+ merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
813
+ setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & { [k in Key]: Schema }, UnknownKeys, Catchall>;
814
+ catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
815
+ pick<Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>(mask: Mask): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
816
+ omit<Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
817
+ /**
818
+ * @deprecated
819
+ */
820
+ deepPartial(): partialUtil.DeepPartial<this>;
821
+ partial(): ZodObject<{ [k in keyof T]: ZodOptional<T[k]> }, UnknownKeys, Catchall>;
822
+ partial<Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{ [k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k] }>, UnknownKeys, Catchall>;
823
+ required(): ZodObject<{ [k in keyof T]: deoptional<T[k]> }, UnknownKeys, Catchall>;
824
+ required<Mask extends util.Exactly<{ [k in keyof T]?: true }, Mask>>(mask: Mask): ZodObject<objectUtil.noNever<{ [k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k] }>, UnknownKeys, Catchall>;
825
+ keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
826
+ static create: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strip", ZodTypeAny, objectOutputType<Shape, ZodTypeAny, "strip">, objectInputType<Shape, ZodTypeAny, "strip">>;
827
+ static strictCreate: <Shape extends ZodRawShape>(shape: Shape, params?: RawCreateParams) => ZodObject<Shape, "strict">;
828
+ static lazycreate: <Shape extends ZodRawShape>(shape: () => Shape, params?: RawCreateParams) => ZodObject<Shape, "strip">;
829
+ }
830
+ type AnyZodObject = ZodObject<any, any, any>;
831
+ type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
832
+ interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>> extends ZodTypeDef {
833
+ options: T;
834
+ typeName: ZodFirstPartyTypeKind.ZodUnion;
835
+ }
836
+ declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
837
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
838
+ get options(): T;
839
+ static create: <Options extends Readonly<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>>(types: Options, params?: RawCreateParams) => ZodUnion<Options>;
840
+ }
841
+ interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
842
+ left: T;
843
+ right: U;
844
+ typeName: ZodFirstPartyTypeKind.ZodIntersection;
845
+ }
846
+ declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
847
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
848
+ static create: <TSchema extends ZodTypeAny, USchema extends ZodTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => ZodIntersection<TSchema, USchema>;
849
+ }
850
+ type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
851
+ type AssertArray<T> = T extends any[] ? T : never;
852
+ type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_output"] : never }>;
853
+ type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
854
+ type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{ [k in keyof T]: T[k] extends ZodType<any, any, any> ? T[k]["_input"] : never }>;
855
+ type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
856
+ interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
857
+ items: T;
858
+ rest: Rest;
859
+ typeName: ZodFirstPartyTypeKind.ZodTuple;
860
+ }
861
+ declare class ZodTuple<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
862
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
863
+ get items(): T;
864
+ rest<RestSchema extends ZodTypeAny>(rest: RestSchema): ZodTuple<T, RestSchema>;
865
+ static create: <Items extends [ZodTypeAny, ...ZodTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => ZodTuple<Items, null>;
866
+ }
867
+ interface ZodLiteralDef<T = any> extends ZodTypeDef {
868
+ value: T;
869
+ typeName: ZodFirstPartyTypeKind.ZodLiteral;
870
+ }
871
+ declare class ZodLiteral<T> extends ZodType<T, ZodLiteralDef<T>, T> {
872
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
873
+ get value(): T;
874
+ static create: <Value extends Primitive>(value: Value, params?: RawCreateParams) => ZodLiteral<Value>;
875
+ }
876
+ type EnumValues<T extends string = string> = readonly [T, ...T[]];
877
+ type Values<T extends EnumValues> = { [k in T[number]]: k };
878
+ interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
879
+ values: T;
880
+ typeName: ZodFirstPartyTypeKind.ZodEnum;
881
+ }
882
+ type Writeable<T> = { -readonly [P in keyof T]: T[P] };
883
+ type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
884
+ type typecast<A, T> = A extends T ? A : never;
885
+ declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
886
+ declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
887
+ declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>, T[number]> {
888
+ _cache: Set<T[number]> | undefined;
889
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
890
+ get options(): T;
891
+ get enum(): Values<T>;
892
+ get Values(): Values<T>;
893
+ get Enum(): Values<T>;
894
+ extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract, newDef?: RawCreateParams): ZodEnum<Writeable<ToExtract>>;
895
+ exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude, newDef?: RawCreateParams): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
896
+ static create: typeof createZodEnum;
897
+ }
898
+ interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
899
+ type: T;
900
+ typeName: ZodFirstPartyTypeKind.ZodPromise;
901
+ }
902
+ declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
903
+ unwrap(): T;
904
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
905
+ static create: <Inner extends ZodTypeAny>(schema: Inner, params?: RawCreateParams) => ZodPromise<Inner>;
906
+ }
907
+ type RefinementEffect<T> = {
908
+ type: "refinement";
909
+ refinement: (arg: T, ctx: RefinementCtx) => any;
910
+ };
911
+ type TransformEffect<T> = {
912
+ type: "transform";
913
+ transform: (arg: T, ctx: RefinementCtx) => any;
914
+ };
915
+ type PreprocessEffect<T> = {
916
+ type: "preprocess";
917
+ transform: (arg: T, ctx: RefinementCtx) => any;
918
+ };
919
+ type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
920
+ interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
921
+ schema: T;
922
+ typeName: ZodFirstPartyTypeKind.ZodEffects;
923
+ effect: Effect<any>;
924
+ }
925
+ declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
926
+ innerType(): T;
927
+ sourceType(): T;
928
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
929
+ static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"]>;
930
+ static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
931
+ }
932
+ interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
933
+ innerType: T;
934
+ typeName: ZodFirstPartyTypeKind.ZodOptional;
935
+ }
936
+ declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
937
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
938
+ unwrap(): T;
939
+ static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodOptional<Inner>;
940
+ }
941
+ interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
942
+ innerType: T;
943
+ typeName: ZodFirstPartyTypeKind.ZodNullable;
944
+ }
945
+ declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
946
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
947
+ unwrap(): T;
948
+ static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodNullable<Inner>;
949
+ }
950
+ interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
951
+ innerType: T;
952
+ defaultValue: () => util.noUndefined<T["_input"]>;
953
+ typeName: ZodFirstPartyTypeKind.ZodDefault;
954
+ }
955
+ declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
956
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
957
+ removeDefault(): T;
958
+ static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
959
+ default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
960
+ }) => ZodDefault<Inner>;
961
+ }
962
+ interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
963
+ innerType: T;
964
+ catchValue: (ctx: {
965
+ error: ZodError;
966
+ input: unknown;
967
+ }) => T["_input"];
968
+ typeName: ZodFirstPartyTypeKind.ZodCatch;
969
+ }
970
+ declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
971
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
972
+ removeCatch(): T;
973
+ static create: <Inner extends ZodTypeAny>(type: Inner, params: RawCreateParams & {
974
+ catch: Inner["_output"] | (() => Inner["_output"]);
975
+ }) => ZodCatch<Inner>;
976
+ }
977
+ interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
978
+ type: T;
979
+ typeName: ZodFirstPartyTypeKind.ZodBranded;
980
+ }
981
+ declare const BRAND: unique symbol;
982
+ type BRAND<T extends string | number | symbol> = {
983
+ [BRAND]: { [k in T]: true };
984
+ };
985
+ declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
986
+ _parse(input: ParseInput): ParseReturnType<any>;
987
+ unwrap(): T;
988
+ }
989
+ interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
990
+ in: A;
991
+ out: B;
992
+ typeName: ZodFirstPartyTypeKind.ZodPipeline;
993
+ }
994
+ declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
995
+ _parse(input: ParseInput): ParseReturnType<any>;
996
+ static create<ASchema extends ZodTypeAny, BSchema extends ZodTypeAny>(a: ASchema, b: BSchema): ZodPipeline<ASchema, BSchema>;
997
+ }
998
+ type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
999
+ readonly [Symbol.toStringTag]: string;
1000
+ } | Date | Error | Generator | Promise<unknown> | RegExp;
1001
+ 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>;
1002
+ interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
1003
+ innerType: T;
1004
+ typeName: ZodFirstPartyTypeKind.ZodReadonly;
1005
+ }
1006
+ declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, MakeReadonly<T["_input"]>> {
1007
+ _parse(input: ParseInput): ParseReturnType<this["_output"]>;
1008
+ static create: <Inner extends ZodTypeAny>(type: Inner, params?: RawCreateParams) => ZodReadonly<Inner>;
1009
+ unwrap(): T;
1010
+ }
1011
+ declare enum ZodFirstPartyTypeKind {
1012
+ ZodString = "ZodString",
1013
+ ZodNumber = "ZodNumber",
1014
+ ZodNaN = "ZodNaN",
1015
+ ZodBigInt = "ZodBigInt",
1016
+ ZodBoolean = "ZodBoolean",
1017
+ ZodDate = "ZodDate",
1018
+ ZodSymbol = "ZodSymbol",
1019
+ ZodUndefined = "ZodUndefined",
1020
+ ZodNull = "ZodNull",
1021
+ ZodAny = "ZodAny",
1022
+ ZodUnknown = "ZodUnknown",
1023
+ ZodNever = "ZodNever",
1024
+ ZodVoid = "ZodVoid",
1025
+ ZodArray = "ZodArray",
1026
+ ZodObject = "ZodObject",
1027
+ ZodUnion = "ZodUnion",
1028
+ ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
1029
+ ZodIntersection = "ZodIntersection",
1030
+ ZodTuple = "ZodTuple",
1031
+ ZodRecord = "ZodRecord",
1032
+ ZodMap = "ZodMap",
1033
+ ZodSet = "ZodSet",
1034
+ ZodFunction = "ZodFunction",
1035
+ ZodLazy = "ZodLazy",
1036
+ ZodLiteral = "ZodLiteral",
1037
+ ZodEnum = "ZodEnum",
1038
+ ZodEffects = "ZodEffects",
1039
+ ZodNativeEnum = "ZodNativeEnum",
1040
+ ZodOptional = "ZodOptional",
1041
+ ZodNullable = "ZodNullable",
1042
+ ZodDefault = "ZodDefault",
1043
+ ZodCatch = "ZodCatch",
1044
+ ZodPromise = "ZodPromise",
1045
+ ZodBranded = "ZodBranded",
1046
+ ZodPipeline = "ZodPipeline",
1047
+ ZodReadonly = "ZodReadonly"
1048
+ }
1049
+ //#endregion
1050
+ //#region ../../../../lib/model/pl-error-like/dist/error_like_shape.d.ts
1051
+ //#region src/error_like_shape.d.ts
1052
+ declare const BasePlErrorLike: ZodObject<{
1053
+ type: ZodLiteral<"PlError">;
1054
+ name: ZodString;
1055
+ message: ZodString; /** The message with all details needed for SDK developers. */
1056
+ fullMessage: ZodOptional<ZodString>;
1057
+ stack: ZodOptional<ZodString>;
1058
+ }, "strip", ZodTypeAny, {
1059
+ type: "PlError";
1060
+ message: string;
1061
+ name: string;
1062
+ fullMessage?: string | undefined;
1063
+ stack?: string | undefined;
1064
+ }, {
1065
+ type: "PlError";
1066
+ message: string;
1067
+ name: string;
1068
+ fullMessage?: string | undefined;
1069
+ stack?: string | undefined;
1070
+ }>;
1071
+ /** Known Pl backend and ML errors. */
1072
+ type PlErrorLike = TypeOf<typeof BasePlErrorLike> & {
1073
+ cause?: ErrorLike;
1074
+ errors?: ErrorLike[];
1075
+ };
1076
+ declare const PlErrorLike: ZodType<PlErrorLike>;
1077
+ declare const BaseStandardErrorLike: ZodObject<{
1078
+ type: ZodLiteral<"StandardError">;
1079
+ name: ZodString;
1080
+ message: ZodString;
1081
+ stack: ZodOptional<ZodString>;
1082
+ }, "strip", ZodTypeAny, {
1083
+ type: "StandardError";
1084
+ message: string;
1085
+ name: string;
1086
+ stack?: string | undefined;
1087
+ }, {
1088
+ type: "StandardError";
1089
+ message: string;
1090
+ name: string;
1091
+ stack?: string | undefined;
1092
+ }>;
1093
+ /** Others unknown errors that could be thrown by the client. */
1094
+ type StandardErrorLike = TypeOf<typeof BaseStandardErrorLike> & {
1095
+ cause?: ErrorLike;
1096
+ errors?: ErrorLike[];
1097
+ };
1098
+ declare const StandardErrorLike: ZodType<StandardErrorLike>;
1099
+ declare const ErrorLike: ZodUnion<[ZodType<StandardErrorLike, ZodTypeDef, StandardErrorLike>, ZodType<PlErrorLike, ZodTypeDef, PlErrorLike>]>;
1100
+ type ErrorLike = TypeOf<typeof ErrorLike>;
1101
+ /** Converts everything into ErrorLike. */
1102
+ //#endregion
1103
+ //#region ../../../../lib/model/common/dist/common_types.d.ts
1104
+ type OutputWithStatus<T> = {
1105
+ ok: true;
1106
+ value: T;
1107
+ stable: boolean;
1108
+ } | {
1109
+ ok: false;
1110
+ errors: ErrorLike[];
1111
+ moreErrors: boolean;
1112
+ };
1113
+ /** Base type for block outputs */
1114
+ type BlockOutputsBase = Record<string, OutputWithStatus<unknown>>;
1115
+ //#endregion
1116
+ //#region ../../../../lib/model/common/dist/navigation.d.ts
1117
+ /**
1118
+ * Part of the block state, representing current navigation information
1119
+ * (i.e. currently selected section)
1120
+ */
1121
+ type NavigationState<Href extends `/${string}` = `/${string}`> = {
1122
+ readonly href: Href;
1123
+ };
1124
+ //#endregion
1125
+ //#region ../../../../lib/model/common/dist/json.d.ts
1126
+ //#region src/json.d.ts
1127
+ type JsonPrimitive = string | number | boolean | null;
1128
+ type JsonValue = JsonPrimitive | JsonValue[] | {
1129
+ [key: string]: JsonValue;
1130
+ };
1131
+ type NotAssignableToJson = bigint | symbol | Function;
1132
+ type JsonCompatible<T> = unknown extends T ? unknown : [T] extends [JsonValue] ? T : [T] extends [NotAssignableToJson] ? never : { [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue] ? T[P] : [Exclude<T[P], undefined>] extends [NotAssignableToJson] ? never : JsonCompatible<T[P]> };
1133
+ type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
1134
+ __json_stringified: T;
1135
+ };
1136
+ type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
1137
+ __json_canonicalized: T;
1138
+ };
1139
+ //#endregion
1140
+ //#region ../../../../lib/model/common/dist/block_state.d.ts
1141
+ //#region src/block_state.d.ts
1142
+ /**
1143
+ * @template Args sets type of block arguments passed to the workflow
1144
+ * @template Outputs type of the outputs returned by the workflow and rendered
1145
+ * according to the output configuration specified for the block
1146
+ * @template UiState data that stores only UI related state, that is not passed
1147
+ * to the workflow
1148
+ * @template Href typed href to represent navigation state
1149
+ */
1150
+ type BlockState<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> = {
1151
+ /** Block arguments passed to the workflow */args: Args;
1152
+ /** UI State persisted in the block state but not passed to the backend
1153
+ * template */
1154
+ ui: UiState; /** Outputs rendered with block config */
1155
+ outputs: Outputs; /** Current navigation state */
1156
+ navigationState: NavigationState<Href>;
1157
+ readonly author: AuthorMarker | undefined;
1158
+ };
1159
+ type BlockStateV3<_Data = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, Href extends `/${string}` = `/${string}`> = {
1160
+ /** Block storage persisted in the block state */blockStorage: StringifiedJson; /** Outputs rendered with block config */
1161
+ outputs: Outputs; /** Current navigation state */
1162
+ navigationState: NavigationState<Href>;
1163
+ readonly author: AuthorMarker | undefined;
1164
+ }; //#endregion
1165
+ //#endregion
1166
+ //#region ../../../../lib/model/common/dist/branding.d.ts
1167
+ //#region src/branding.d.ts
1168
+ type Brand<B, K extends string = "__pl_model_brand__"> = { [key in K]: B };
1169
+ type Branded$1<T, B, K extends string = "__pl_model_brand__"> = T & Brand<B, K>; //#endregion
1170
+ //#endregion
1171
+ //#region ../../../../lib/model/common/dist/dialog/index.d.ts
1172
+ //#region src/dialog/index.d.ts
1173
+ /**
1174
+ * File filter passed to the native save dialog. Matches Electron's
1175
+ * `FileFilter` shape so desktop runtimes can forward it verbatim.
1176
+ */
1177
+ interface FileFilter {
1178
+ name: string;
1179
+ extensions: string[];
1180
+ }
1181
+ /**
1182
+ * Options accepted by `Dialog.showSaveDialog`. The UI supplies only a
1183
+ * default file name; the main-process handler decides the default
1184
+ * directory (e.g. `~/Downloads`).
1185
+ */
1186
+ interface ShowSaveDialogOptions {
1187
+ defaultFileName?: string;
1188
+ filters?: FileFilter[];
1189
+ title?: string;
1190
+ }
1191
+ /** Result of `Dialog.showSaveDialog`. */
1192
+ interface ShowSaveDialogResult {
1193
+ canceled: boolean;
1194
+ path?: string;
1195
+ }
1196
+ /**
1197
+ * UI-facing save-dialog service. Implemented by desktop runtimes that
1198
+ * can open a native file picker; absent in web/preview environments.
1199
+ */
1200
+ interface DialogService {
1201
+ showSaveDialog(options: ShowSaveDialogOptions): Promise<ShowSaveDialogResult>;
1202
+ } //#endregion
1203
+ //#endregion
1204
+ //#region ../../../../lib/model/common/dist/pool_entry.d.ts
1205
+ //#region src/pool_entry.d.ts
1206
+ interface PoolEntry<K extends string = string, R extends {} = {}> extends Disposable {
1207
+ /** Resource key, calculated using provided `calculateParamsKey` function */
1208
+ readonly key: K;
1209
+ /** Resource itself created by `createNewResource` function */
1210
+ readonly resource: R;
1211
+ /**
1212
+ * Release the reference. Idempotent.
1213
+ * Same as `[Symbol.dispose]()` — provided as a named function
1214
+ * for use in callbacks (e.g. `addOnDestroy(entry.unref)`).
1215
+ */
1216
+ readonly unref: () => void;
1217
+ }
1218
+ /**
1219
+ * Wraps a PoolEntry for use with `using`. Auto-calls `unref()` at end of scope
1220
+ * unless `keep()` is called to transfer ownership to the caller.
1221
+ */
1222
+ //#endregion
1223
+ //#region ../../../../lib/model/common/dist/drivers/pframe/table_common.d.ts
1224
+ //#region src/drivers/pframe/table_common.d.ts
1225
+ type PTableColumnSpecAxis = {
1226
+ type: "axis";
1227
+ id: AxisId;
1228
+ spec: AxisSpec;
1229
+ };
1230
+ type PTableColumnSpecColumn = {
1231
+ type: "column";
1232
+ /**
1233
+ * Leaf column id as it appears in the SpecQuery — may be a rich
1234
+ * {@link ColumnUniversalId} (Discovered / Overridden / Filtered) or a bare
1235
+ * {@link PObjectId}. The host resolver strips to bare via `extractPObjectId`
1236
+ * before physical lookup.
1237
+ */
1238
+ id: ColumnUniversalId;
1239
+ spec: PColumnSpec;
1240
+ };
1241
+ /** Unified spec object for axes and columns */
1242
+ type PTableColumnSpec = PTableColumnSpecAxis | PTableColumnSpecColumn;
1243
+ type PTableColumnIdAxis = {
1244
+ type: "axis";
1245
+ id: AxisId;
1246
+ };
1247
+ type PTableColumnIdColumn = {
1248
+ type: "column"; /** @see PTableColumnSpecColumn.id */
1249
+ id: ColumnUniversalId;
1250
+ };
1251
+ /** Unified PTable column identifier */
1252
+ type PTableColumnId = PTableColumnIdAxis | PTableColumnIdColumn;
1253
+ //#endregion
1254
+ //#region ../../../../lib/model/common/dist/drivers/pframe/data_types.d.ts
1255
+ //#region src/drivers/pframe/data_types.d.ts
1256
+ type PVectorDataInt = Int32Array;
1257
+ type PVectorDataLong = BigInt64Array;
1258
+ type PVectorDataFloat = Float32Array;
1259
+ type PVectorDataDouble = Float64Array;
1260
+ type PVectorDataString = (null | string)[];
1261
+ type PVectorDataBytes = (null | Uint8Array)[];
1262
+ type PVectorDataTyped<DataType extends ValueType> = DataType extends typeof ValueType.Int ? PVectorDataInt : DataType extends typeof ValueType.Long ? PVectorDataLong : DataType extends typeof ValueType.Float ? PVectorDataFloat : DataType extends typeof ValueType.Double ? PVectorDataDouble : DataType extends typeof ValueType.String ? PVectorDataString : DataType extends typeof ValueType.Bytes ? PVectorDataBytes : never;
1263
+ type PTableVectorTyped<DataType extends ValueType> = {
1264
+ /** Stored data type */readonly type: DataType; /** Values for present positions */
1265
+ readonly data: PVectorDataTyped<DataType>;
1266
+ /**
1267
+ * Encoded bit array marking some elements of this vector as NA,
1268
+ * call {@link bitSet} to read the data.
1269
+ * In old desktop versions NA values are encoded as magic values in data array.
1270
+ * */
1271
+ readonly isNA?: Uint8Array; /** @deprecated Always empty. Kept for backwards compatibility with old blocks. */
1272
+ readonly absent?: Uint8Array;
1273
+ };
1274
+ /** Table column data */
1275
+ type PTableVector = PTableVectorTyped<ValueType>;
1276
+ /** Used in requests to partially retrieve table's data */
1277
+ type TableRange = {
1278
+ /** Index of the first record to retrieve */readonly offset: number; /** Block length */
1279
+ readonly length: number;
1280
+ };
1281
+ /** Unified information about table shape */
1282
+ type PTableShape = {
1283
+ /** Number of unified table columns, including all axes and PColumn values */columns: number; /** Number of rows */
1284
+ rows: number;
1285
+ };
1286
+ /** Supported formats for PTable file download. */
1287
+ type PTableDownloadFormat = "csv" | "tsv";
1288
+ /** Compression applied to the written file. */
1289
+ /** Options for downloading PTable data to a file. */
1290
+ interface WritePTableToFsOptions {
1291
+ path: string;
1292
+ format: PTableDownloadFormat;
1293
+ columnIndices: number[];
1294
+ range?: TableRange;
1295
+ chunkSize?: number;
1296
+ includeHeader?: boolean;
1297
+ bom?: boolean;
1298
+ compression?: {
1299
+ type: "gzip";
1300
+ level?: number;
1301
+ };
1302
+ signal?: AbortSignal;
1303
+ }
1304
+ /** Result of a PTable file download. */
1305
+ interface WritePTableToFsResult {
1306
+ path: string;
1307
+ rowsWritten: number;
1308
+ bytesWritten: number;
1309
+ }
1310
+ /**
1311
+ * Maximum number of data rows allowed per sheet in an `xlsx` export, kept below
1312
+ * Excel's hard limit of 1,048,576. The driver rejects oversized `xlsx` exports
1313
+ * (see {@link PFrameDriver.exportPTable}); UIs use it to gate the `xlsx` option.
1314
+ */
1315
+ /** Options for {@link PFrameDriver.exportPTable}. */
1316
+ interface ExportPTableOptions {
1317
+ /** Destination file path; its extension selects the output format
1318
+ * (`csv`/`tsv`/`parquet`/`xlsx`). */
1319
+ path: string;
1320
+ /** Unified indices of the columns to export, in output order
1321
+ * (axes first, then data columns). */
1322
+ columnIndices: number[];
1323
+ } //#endregion
1324
+ //#endregion
1325
+ //#region ../../../../lib/model/common/dist/drivers/pframe/data_info.d.ts
1326
+ //#region src/drivers/pframe/data_info.d.ts
1327
+ /**
1328
+ * Represents a JavaScript representation of a value in a PColumn. Can be null, a number, or a string.
1329
+ * These are the primitive types that can be stored directly in PColumns.
1330
+ *
1331
+ * Note: Actual columns can hold more value types, which are converted to these JavaScript types
1332
+ * once they enter the JavaScript runtime.
1333
+ */
1334
+ type PColumnValue = null | number | string;
1335
+ /**
1336
+ * Represents a key for a PColumn value.
1337
+ * Can be an array of strings or numbers.
1338
+ */
1339
+ type PColumnKey = (number | string)[];
1340
+ /**
1341
+ * Represents a single entry in a PColumn's data structure.
1342
+ * Contains a key and a value.
1343
+ */
1344
+ /**
1345
+ * Represents column data stored as a simple JSON structure.
1346
+ * Used for small datasets that can be efficiently stored directly in memory.
1347
+ */
1348
+ type JsonDataInfo = {
1349
+ /** Identifier for this data format ('Json') */type: "Json"; /** Number of axes that make up the complete key (tuple length) */
1350
+ keyLength: number;
1351
+ /**
1352
+ * Key-value pairs where keys are stringified tuples of axis values
1353
+ * and values are the column values for those coordinates
1354
+ */
1355
+ data: Record<string, PColumnValue>;
1356
+ };
1357
+ /**
1358
+ * Represents column data partitioned across multiple JSON blobs.
1359
+ * Used for larger datasets that need to be split into manageable chunks.
1360
+ */
1361
+ type JsonPartitionedDataInfo<Blob> = {
1362
+ /** Identifier for this data format ('JsonPartitioned') */type: "JsonPartitioned"; /** Number of leading axes used for partitioning */
1363
+ partitionKeyLength: number; /** Map of stringified partition keys to blob references */
1364
+ parts: Record<string, Blob>;
1365
+ };
1366
+ /**
1367
+ * Represents a binary format chunk containing index and values as separate blobs.
1368
+ * Used for efficient storage and retrieval of column data in binary format.
1369
+ */
1370
+ type BinaryChunk<Blob> = {
1371
+ /** Binary blob containing structured index information */index: Blob; /** Binary blob containing the actual values */
1372
+ values: Blob;
1373
+ };
1374
+ /**
1375
+ * Represents column data partitioned across multiple binary chunks.
1376
+ * Optimized for efficient storage and retrieval of large datasets.
1377
+ */
1378
+ type BinaryPartitionedDataInfo<Blob> = {
1379
+ /** Identifier for this data format ('BinaryPartitioned') */type: "BinaryPartitioned"; /** Number of leading axes used for partitioning */
1380
+ partitionKeyLength: number; /** Map of stringified partition keys to binary chunks */
1381
+ parts: Record<string, BinaryChunk<Blob>>;
1382
+ };
1383
+ type ParquetPartitionedDataInfo<Blob> = {
1384
+ /** Identifier for this data format ('ParquetPartitioned') */type: "ParquetPartitioned"; /** Number of leading axes used for partitioning */
1385
+ partitionKeyLength: number; /** Map of stringified partition keys to parquet files */
1386
+ parts: Record<string, Blob>;
1387
+ };
1388
+ /**
1389
+ * Union type representing all possible data storage formats for PColumn data.
1390
+ * The specific format used depends on data size, access patterns, and performance requirements.
1391
+ *
1392
+ * @template Blob - Type parameter representing the storage reference type (could be ResourceInfo, PFrameBlobId, etc.)
1393
+ */
1394
+ type DataInfo<Blob> = JsonDataInfo | JsonPartitionedDataInfo<Blob> | BinaryPartitionedDataInfo<Blob> | ParquetPartitionedDataInfo<Blob>;
1395
+ /**
1396
+ * Type guard function that checks if the given value is a valid DataInfo.
1397
+ *
1398
+ * @param value - The value to check
1399
+ * @returns True if the value is a valid DataInfo, false otherwise
1400
+ */
1401
+ /**
1402
+ * Represents a single key-value entry in a column's explicit data structure.
1403
+ * Used when directly instantiating PColumns with explicit data.
1404
+ */
1405
+ type PColumnValuesEntry = {
1406
+ key: PColumnKey;
1407
+ val: PColumnValue;
1408
+ };
1409
+ /**
1410
+ * Array of key-value entries representing explicit column data.
1411
+ * Used for lightweight explicit instantiation of PColumns.
1412
+ */
1413
+ type PColumnValues = PColumnValuesEntry[];
1414
+ /**
1415
+ * Entry-based representation of JsonDataInfo
1416
+ */
1417
+ //#endregion
1418
+ //#region ../../../../lib/util/helpers/dist/types/brand.d.ts
1419
+ //#region src/types/brand.d.ts
1420
+ /**
1421
+ * Phantom-property brand. The key is a plain string literal rather than a
1422
+ * `unique symbol` so the resulting type stays fully nameable across packages.
1423
+ *
1424
+ * A `unique symbol` key forces TS, when forced to expand `Branded<T, B>` into
1425
+ * its structural form (e.g. inside `Record<BrandedUnion, V>` index signatures
1426
+ * during dts emit), to write out `typeof __brand` — a value-level reference
1427
+ * to the symbol. If the symbol's declaring module isn't reachable from the
1428
+ * compilation root, dts emit fails with TS4023 ("cannot be named"). Using a
1429
+ * string key sidesteps this entirely: `{ __brand: B }` is a plain structural
1430
+ * type, nameable from anywhere.
1431
+ *
1432
+ * Phantom keys provide compile-time discrimination only — two different brand
1433
+ * tags `B1 ≠ B2` make `Branded<T, B1>` and `Branded<T, B2>` mutually
1434
+ * incompatible regardless of whether the key is a symbol or a string.
1435
+ */
1436
+ type Branded<T, B> = T & {
1437
+ readonly __brand: B;
1438
+ };
1439
+ //#endregion
1440
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/overridden.d.ts
1441
+ //#region src/drivers/pframe/spec/overridden.d.ts
1442
+ type SpecOverrides = Pick<PColumnSpec, "domain" | "contextDomain" | "annotations"> & {
1443
+ axesSpec?: AxisPatches;
1444
+ };
1445
+ /**
1446
+ * `source` can reference a leaf or a Filtered/Discovered id, but never another
1447
+ * Overridden id — there is no `Overridden<Overridden<...>>`. Repeated overrides
1448
+ * merge at the outer wrapper via {@link mergeSpecOverrides}.
1449
+ */
1450
+ interface ColumnOverriddenKey {
1451
+ __isOverridden: true;
1452
+ source: Exclude<ColumnUniversalId, ColumnOverriddenId>;
1453
+ specOverrides: SpecOverrides;
1454
+ }
1455
+ type ColumnOverriddenId = Branded<CanonicalizedJson<ColumnOverriddenKey>, "ColumnOverriddenId">;
1456
+ //#endregion
1457
+ //#region ../../../../lib/model/common/dist/drivers/pframe/query/query_common.d.ts
1458
+ //#region src/drivers/pframe/query/query_common.d.ts
1459
+ /**
1460
+ * Structural type information for a single column: the axis value types (in
1461
+ * order) and the single column value type. Mirrors the self-contained
1462
+ * `typeSpec` shape carried by the data layer (`{ axes, column }`).
1463
+ */
1464
+ type ColumnTypeSpec = {
1465
+ /** List of axis value types defining the dimensions of the data */axes: AxisValueType[]; /** The single column value type */
1466
+ column: ColumnValueType;
1467
+ };
1468
+ /**
1469
+ * Unary mathematical operation kinds.
1470
+ *
1471
+ * These operations take a single numeric input and produce a numeric output.
1472
+ * **Null handling**: If input is null, result is null.
1473
+ *
1474
+ * Operations:
1475
+ * - `abs` - Absolute value: |x|
1476
+ * - `ceil` - Round up to nearest integer
1477
+ * - `floor` - Round down to nearest integer
1478
+ * - `round` - Round to nearest integer (banker's rounding)
1479
+ * - `sqrt` - Square root (returns NaN for negative inputs)
1480
+ * - `log` - Natural logarithm (ln)
1481
+ * - `log2` - Base-2 logarithm
1482
+ * - `log10` - Base-10 logarithm
1483
+ * - `exp` - Exponential function (e^x)
1484
+ * - `negate` - Negation (-x)
1485
+ */
1486
+ type NumericUnaryOperand = "abs" | "ceil" | "floor" | "round" | "sqrt" | "log" | "log2" | "log10" | "exp" | "negate";
1487
+ /**
1488
+ * Binary mathematical operation kinds.
1489
+ *
1490
+ * These operations take two numeric inputs and produce a numeric result.
1491
+ * **Null handling**: If either operand is null, result is null.
1492
+ *
1493
+ * Operations:
1494
+ * - `add` - Addition: left + right
1495
+ * - `sub` - Subtraction: left - right
1496
+ * - `mul` - Multiplication: left * right
1497
+ * - `div` - Division: left / right (division by zero returns Infinity or NaN)
1498
+ * - `mod` - Modulo: left % right
1499
+ * - `power` - Exponentiation: left ** right
1500
+ */
1501
+ type NumericBinaryOperand = "add" | "sub" | "mul" | "div" | "mod" | "power";
1502
+ /**
1503
+ * Numeric comparison operation kinds.
1504
+ *
1505
+ * These operations compare two numeric inputs and produce a boolean result.
1506
+ * **Null handling**: If either operand is null, result is null.
1507
+ *
1508
+ * Operations:
1509
+ * - `eq` - Equal: left == right
1510
+ * - `ne` - Not equal: left != right
1511
+ * - `lt` - Less than: left < right
1512
+ * - `le` - Less or equal: left <= right
1513
+ * - `gt` - Greater than: left > right
1514
+ * - `ge` - Greater or equal: left >= right
1515
+ */
1516
+ type NumericComparisonOperand = "eq" | "ne" | "lt" | "le" | "gt" | "ge";
1517
+ /**
1518
+ * Constant value expression.
1519
+ *
1520
+ * Represents a literal constant value in an expression tree.
1521
+ * The value can be a string, number, or boolean.
1522
+ *
1523
+ * @example
1524
+ * // Constant number
1525
+ * { type: 'constant', value: 42 }
1526
+ *
1527
+ * // Constant string
1528
+ * { type: 'constant', value: 'hello' }
1529
+ *
1530
+ * // Constant boolean
1531
+ * { type: 'constant', value: true }
1532
+ */
1533
+ type ExprConstant = {
1534
+ type: "constant";
1535
+ value: string | number | boolean;
1536
+ };
1537
+ /**
1538
+ * Null check expression.
1539
+ *
1540
+ * Tests if an expression evaluates to null.
1541
+ * **Input**: Any expression.
1542
+ * **Output**: Boolean (true if input is null, false otherwise).
1543
+ *
1544
+ * @template I - The expression type (for recursion)
1545
+ *
1546
+ * @example
1547
+ * // Check if column value is null
1548
+ * { type: 'isNull', input: columnRef }
1549
+ *
1550
+ * // Combine with NOT to check for non-null
1551
+ * { type: 'not', input: { type: 'isNull', input: columnRef } }
1552
+ */
1553
+ interface ExprIsNull<I> {
1554
+ type: "isNull";
1555
+ /** Input expression to check for null */
1556
+ input: I;
1557
+ }
1558
+ /**
1559
+ * Null coalescing expression.
1560
+ *
1561
+ * Returns the input value if it is not null, otherwise returns the replacement value.
1562
+ * Equivalent to SQL's `IFNULL(input, replacement)` or `COALESCE(input, replacement)`.
1563
+ * **Input**: Any expression.
1564
+ * **Output**: Same type as input/replacement.
1565
+ * **Null handling**: If input is null, returns replacement; otherwise returns input.
1566
+ *
1567
+ * The Rust runtime also accepts the legacy `"ifNull"` tag as a serde
1568
+ * alias; new code should emit `"fillNull"`.
1569
+ *
1570
+ * @template I - The expression type (for recursion)
1571
+ *
1572
+ * @example
1573
+ * // Replace null values with 0
1574
+ * { type: 'fillNull', input: columnRef, replacement: { type: 'constant', value: 0 } }
1575
+ *
1576
+ * // Replace null strings with 'unknown'
1577
+ * { type: 'fillNull', input: nameColumn, replacement: { type: 'constant', value: 'unknown' } }
1578
+ */
1579
+ interface ExprFillNull<I> {
1580
+ type: "fillNull";
1581
+ /** Value to check for null */
1582
+ input: I;
1583
+ /** Replacement value if input is null */
1584
+ replacement: I;
1585
+ }
1586
+ /**
1587
+ * Unary mathematical expression.
1588
+ *
1589
+ * Applies a unary mathematical function to a single input expression.
1590
+ * **Input**: One expression that evaluates to a numeric value.
1591
+ * **Output**: Numeric value.
1592
+ * **Null handling**: If input is null, result is null.
1593
+ *
1594
+ * @template I - The expression type (for recursion)
1595
+ *
1596
+ * @example
1597
+ * // Absolute value of column "value"
1598
+ * { type: 'unaryMath', operand: 'abs', input: columnRef }
1599
+ *
1600
+ * // Natural log of expression
1601
+ * { type: 'unaryMath', operand: 'log', input: someExpr }
1602
+ *
1603
+ * @see NumericUnaryOperand for available operations
1604
+ */
1605
+ interface ExprNumericUnary<I> {
1606
+ type: "numericUnary";
1607
+ /** The mathematical operation to apply */
1608
+ operand: NumericUnaryOperand;
1609
+ /** Input expression (must evaluate to numeric) */
1610
+ input: I;
1611
+ }
1612
+ /**
1613
+ * Binary mathematical expression.
1614
+ *
1615
+ * Applies a binary arithmetic operation to two input expressions.
1616
+ * **Input**: Two expressions that evaluate to numeric values.
1617
+ * **Output**: Numeric value.
1618
+ * **Null handling**: If either operand is null, result is null.
1619
+ *
1620
+ * @template I - The expression type (for recursion)
1621
+ *
1622
+ * @example
1623
+ * // Addition: col_a + col_b
1624
+ * { type: 'binaryMath', operand: 'add', left: colA, right: colB }
1625
+ *
1626
+ * // Division: col_a / 2
1627
+ * { type: 'binaryMath', operand: 'div', left: colA, right: { type: 'constant', value: 2 } }
1628
+ *
1629
+ * @see NumericBinaryOperand for available operations
1630
+ */
1631
+ interface ExprNumericBinary<I> {
1632
+ type: "numericBinary";
1633
+ /** The arithmetic operation to apply */
1634
+ operand: NumericBinaryOperand;
1635
+ /** Left operand expression */
1636
+ left: I;
1637
+ /** Right operand expression */
1638
+ right: I;
1639
+ }
1640
+ /**
1641
+ * Numeric comparison expression.
1642
+ *
1643
+ * Compares two numeric expressions and produces a boolean result.
1644
+ * **Input**: Two expressions that evaluate to numeric values.
1645
+ * **Output**: Boolean.
1646
+ * **Null handling**: If either operand is null, result is null.
1647
+ *
1648
+ * @template I - The expression type (for recursion)
1649
+ *
1650
+ * @example
1651
+ * // Greater than: col_a > 10
1652
+ * { type: 'numericComparison', operand: 'gt', left: colA, right: { type: 'constant', value: 10 } }
1653
+ *
1654
+ * // Equality: col_a == col_b
1655
+ * { type: 'numericComparison', operand: 'eq', left: colA, right: colB }
1656
+ *
1657
+ * // Range check (combine with logical AND): 0 <= x && x < 100
1658
+ * // { type: 'logical', operand: 'and', input: [
1659
+ * // { type: 'numericComparison', operand: 'ge', left: colX, right: { type: 'constant', value: 0 } },
1660
+ * // { type: 'numericComparison', operand: 'lt', left: colX, right: { type: 'constant', value: 100 } }
1661
+ * // ]}
1662
+ *
1663
+ * @see NumericComparisonOperand for available operations
1664
+ */
1665
+ interface ExprNumericComparison<I> {
1666
+ type: "numericComparison";
1667
+ /** The comparison operation to apply */
1668
+ operand: NumericComparisonOperand;
1669
+ /** Left operand expression */
1670
+ left: I;
1671
+ /** Right operand expression */
1672
+ right: I;
1673
+ }
1674
+ /**
1675
+ * String equality check.
1676
+ *
1677
+ * Compares input string to a reference value.
1678
+ * **Input**: Expression evaluating to a string.
1679
+ * **Output**: Boolean.
1680
+ * **Null handling**: Returns false if input is null.
1681
+ *
1682
+ * @template I - The expression type (for recursion)
1683
+ *
1684
+ * @example
1685
+ * // Check if name equals "John" (case-sensitive)
1686
+ * // Matches only: "John"
1687
+ * { type: 'stringEquals', input: nameColumn, value: 'John' }
1688
+ *
1689
+ * @example
1690
+ * // Check if name equals "John" (case-insensitive)
1691
+ * // Matches: "john", "JOHN", "John", "jOhN"
1692
+ * { type: 'stringEquals', input: nameColumn, value: 'John', caseInsensitive: true }
1693
+ */
1694
+ interface ExprStringEquals<I> {
1695
+ type: "stringEquals";
1696
+ /** Input expression (must evaluate to string) */
1697
+ input: I;
1698
+ /** Reference string to compare against */
1699
+ value: string;
1700
+ /** If true, comparison ignores case */
1701
+ caseInsensitive: boolean;
1702
+ }
1703
+ /**
1704
+ * Regular expression match check.
1705
+ *
1706
+ * Tests if input string matches a regular expression pattern.
1707
+ * **Input**: Expression evaluating to a string.
1708
+ * **Output**: Boolean (true if pattern matches).
1709
+ * **Null handling**: Returns false if input is null.
1710
+ *
1711
+ * @template I - The expression type (for recursion)
1712
+ *
1713
+ * @example
1714
+ * // Check if value matches email pattern
1715
+ * { type: 'stringRegex', input: emailColumn, value: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$' }
1716
+ *
1717
+ * // Check if starts with "prefix"
1718
+ * { type: 'stringRegex', input: valueColumn, value: '^prefix' }
1719
+ *
1720
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions | MDN Regular Expressions Guide}
1721
+ */
1722
+ interface ExprStringRegex<I> {
1723
+ type: "stringRegex";
1724
+ /** Input expression (must evaluate to string) */
1725
+ input: I;
1726
+ /** Regular expression pattern */
1727
+ value: string;
1728
+ }
1729
+ /**
1730
+ * Substring containment check.
1731
+ *
1732
+ * Tests if input string contains a specified substring.
1733
+ * **Input**: Expression evaluating to a string.
1734
+ * **Output**: Boolean (true if substring is found).
1735
+ * **Null handling**: Returns false if input is null.
1736
+ *
1737
+ * @template I - The expression type (for recursion)
1738
+ *
1739
+ * @example
1740
+ * // Case-sensitive contains
1741
+ * { type: 'stringContains', input: descColumn, value: 'error', caseInsensitive: false }
1742
+ *
1743
+ * // Case-insensitive contains
1744
+ * { type: 'stringContains', input: descColumn, value: 'ERROR', caseInsensitive: true }
1745
+ */
1746
+ interface ExprStringContains<I> {
1747
+ type: "stringContains";
1748
+ /** Input expression (must evaluate to string) */
1749
+ input: I;
1750
+ /** Substring to search for */
1751
+ value: string;
1752
+ /** If true, comparison ignores case */
1753
+ caseInsensitive: boolean;
1754
+ }
1755
+ /**
1756
+ * Fuzzy string containment check with edit distance.
1757
+ *
1758
+ * Tests if input string approximately matches a pattern within a specified edit distance.
1759
+ * Uses Levenshtein distance (or substitution-only distance) for fuzzy matching.
1760
+ * **Input**: Expression evaluating to a string.
1761
+ * **Output**: Boolean (true if approximate match found within maxEdits).
1762
+ * **Null handling**: Returns false if input is null.
1763
+ *
1764
+ * @template I - The expression type (for recursion)
1765
+ *
1766
+ * @example
1767
+ * // Match "color" with up to 1 edit (catches "colour", "colr", etc.)
1768
+ * {
1769
+ * type: 'stringContainsFuzzy',
1770
+ * input: textColumn,
1771
+ * value: 'color',
1772
+ * maxEdits: 1,
1773
+ * caseInsensitive: true,
1774
+ * substitutionsOnly: false,
1775
+ * wildcard: null
1776
+ * }
1777
+ *
1778
+ * // Match with wildcard (? matches any single character)
1779
+ * {
1780
+ * type: 'stringContainsFuzzy',
1781
+ * input: textColumn,
1782
+ * value: 'te?t',
1783
+ * maxEdits: 0,
1784
+ * caseInsensitive: false,
1785
+ * substitutionsOnly: false,
1786
+ * wildcard: '?'
1787
+ * }
1788
+ */
1789
+ interface ExprStringContainsFuzzy<I> {
1790
+ type: "stringContainsFuzzy";
1791
+ /** Input expression (must evaluate to string) */
1792
+ input: I;
1793
+ /** Pattern to match against */
1794
+ value: string;
1795
+ /**
1796
+ * Maximum edit distance (Levenshtein distance).
1797
+ * 0 = exact match only, 1 = one edit allowed, etc.
1798
+ */
1799
+ maxEdits: number;
1800
+ /** If true, comparison ignores case */
1801
+ caseInsensitive: boolean;
1802
+ /**
1803
+ * If true, only substitutions count as edits (no insertions/deletions).
1804
+ * Useful when you want to match strings of same length with typos.
1805
+ */
1806
+ substitutionsOnly: boolean;
1807
+ /**
1808
+ * Optional wildcard character that matches any single character.
1809
+ * Example: '?' in "te?t" matches "test", "text", "tent", etc.
1810
+ * Set to null to disable wildcard matching.
1811
+ */
1812
+ wildcard: null | string;
1813
+ }
1814
+ /**
1815
+ * Logical NOT expression.
1816
+ *
1817
+ * Negates a boolean expression.
1818
+ * **Input**: Expression evaluating to boolean.
1819
+ * **Output**: Boolean (inverted).
1820
+ * **Null handling**: NOT null = null.
1821
+ *
1822
+ * @template I - The expression type (for recursion)
1823
+ *
1824
+ * @example
1825
+ * // NOT (value > 10)
1826
+ * { type: 'not', input: comparisonExpr }
1827
+ */
1828
+ interface ExprLogicalUnary<I> {
1829
+ type: "not";
1830
+ /** Input boolean expression to negate */
1831
+ input: I;
1832
+ }
1833
+ /**
1834
+ * Logical AND/OR expression.
1835
+ *
1836
+ * Combines multiple boolean expressions using AND or OR logic.
1837
+ * **Input**: Array of expressions evaluating to boolean (minimum 2).
1838
+ * **Output**: Boolean.
1839
+ *
1840
+ * **Null handling**
1841
+ * - AND: null AND true = null, null AND false = false
1842
+ * - OR: null OR true = true, null OR false = null
1843
+ *
1844
+ * @template I - The expression type (for recursion)
1845
+ *
1846
+ * @example
1847
+ * // (a > 0) AND (b < 100)
1848
+ * { type: 'and', input: [exprA, exprB] }
1849
+ *
1850
+ * // (status == 'active') OR (status == 'pending')
1851
+ * { type: 'or', input: [statusActive, statusPending] }
1852
+ */
1853
+ interface ExprLogicalVariadic<I> {
1854
+ /** Logical operation: 'and' or 'or' */
1855
+ type: "and" | "or";
1856
+ /** Array of boolean expressions to combine (minimum 2 elements) */
1857
+ input: I[];
1858
+ }
1859
+ /**
1860
+ * Set membership check expression.
1861
+ *
1862
+ * Tests if a value is present in a predefined set of values.
1863
+ * **Input**: Expression evaluating to string or number.
1864
+ * **Output**: Boolean.
1865
+ * **Null handling**: Returns false if input is null.
1866
+ *
1867
+ * @template I - The expression type (for recursion)
1868
+ * @template T - The type of set elements (string or number)
1869
+ *
1870
+ * @example
1871
+ * // Check if status is in ['active', 'pending', 'review']
1872
+ * {
1873
+ * type: 'isIn',
1874
+ * input: statusColumn,
1875
+ * set: ['active', 'pending', 'review']
1876
+ * }
1877
+ */
1878
+ interface ExprIsIn<I, T extends string | number> {
1879
+ type: "isIn";
1880
+ /** Input expression to test */
1881
+ input: I;
1882
+ /** Set of allowed values */
1883
+ set: T[];
1884
+ /** If true, the predicate is inverted (true for values NOT in `set`). */
1885
+ negate: boolean;
1886
+ }
1887
+ /**
1888
+ * Type cast expression.
1889
+ *
1890
+ * Converts the input value to a different column value type. Mirrors
1891
+ * SQL `CAST(input AS U)`.
1892
+ *
1893
+ * **Input**: any expression.
1894
+ * **Output**: a value of `targetType`.
1895
+ * **Null handling**: null in → null out.
1896
+ *
1897
+ * @template I - The expression type (for recursion)
1898
+ */
1899
+ interface ExprCast<I> {
1900
+ type: "cast";
1901
+ /** Expression to cast. */
1902
+ input: I;
1903
+ /** Target column value type. */
1904
+ targetType: ColumnValueType;
1905
+ }
1906
+ /**
1907
+ * A single `when → then` case in a {@link ExprConditional} expression.
1908
+ *
1909
+ * @template I - The expression type (for recursion)
1910
+ */
1911
+ interface ExprConditionalCase<I> {
1912
+ /** Boolean predicate that selects this branch. */
1913
+ when: I;
1914
+ /** Value produced when `when` evaluates to true. */
1915
+ then: I;
1916
+ }
1917
+ /**
1918
+ * Conditional (CASE WHEN) expression.
1919
+ *
1920
+ * Evaluates `cases` in order; the value of the first case whose `when`
1921
+ * is true is returned. If no case matches, `otherwise` is used (or
1922
+ * null when omitted).
1923
+ *
1924
+ * **Result type**: the type of the first case's `then`; subsequent
1925
+ * `then`s and `otherwise` are cast to it.
1926
+ *
1927
+ * @template I - The expression type (for recursion)
1928
+ *
1929
+ * @example
1930
+ * {
1931
+ * type: 'conditional',
1932
+ * cases: [
1933
+ * { when: gtTwenty, then: { type: 'constant', value: 'high' } },
1934
+ * { when: gtTen, then: { type: 'constant', value: 'mid' } }
1935
+ * ],
1936
+ * otherwise: { type: 'constant', value: 'low' }
1937
+ * }
1938
+ */
1939
+ interface ExprConditional<I> {
1940
+ type: "conditional";
1941
+ /** Cases evaluated in order; first matching wins. At least one. */
1942
+ cases: [ExprConditionalCase<I>, ...ExprConditionalCase<I>[]];
1943
+ /** Fallback value when no case matches. */
1944
+ otherwise?: I;
1945
+ }
1946
+ /** Ranking function kind. */
1947
+ type RankingKind = "rank" | "denseRank" | "rowNumber";
1948
+ /**
1949
+ * Ranking expression (always a window function).
1950
+ *
1951
+ * Orders rows by `orderBy` within each partition and assigns ranks
1952
+ * according to `kind`. Output is always `Long`.
1953
+ *
1954
+ * @template I - The expression type (for recursion)
1955
+ * @template A - Axis selector type
1956
+ * @template C - Column selector type
1957
+ */
1958
+ interface ExprRanking<I, A, C> {
1959
+ type: "ranking";
1960
+ /** Ranking semantics. */
1961
+ kind: RankingKind;
1962
+ /** Expression to order by within each partition. */
1963
+ orderBy: I;
1964
+ /** If true (default), sort ascending; if false, descending. */
1965
+ ascending?: boolean;
1966
+ /** Partition specification — at least one entry when supplied. */
1967
+ partitionBy?: [QuerySelector<A, C>, ...QuerySelector<A, C>[]];
1968
+ }
1969
+ /**
1970
+ * Axis reference expression.
1971
+ *
1972
+ * References an axis value for use in expressions (filtering, sorting, etc.).
1973
+ * The axis identifier type varies by context (spec vs data layer).
1974
+ *
1975
+ * @template A - Axis identifier type (e.g., SingleAxisSelector for spec, number for data)
1976
+ *
1977
+ * @example
1978
+ * // Reference axis by selector (spec layer)
1979
+ * { type: 'axisRef', value: { name: 'sample' } }
1980
+ *
1981
+ * // Reference axis by index (data layer)
1982
+ * { type: 'axisRef', value: 0 }
1983
+ */
1984
+ interface ExprAxisRef<A> {
1985
+ type: "axisRef";
1986
+ /** Axis identifier (selector or index depending on context) */
1987
+ value: A;
1988
+ }
1989
+ /**
1990
+ * Column reference expression.
1991
+ *
1992
+ * References a column value for use in expressions (filtering, arithmetic, etc.).
1993
+ * The column identifier type varies by context (spec vs data layer).
1994
+ *
1995
+ * @template C - Column identifier type (e.g., PObjectId for spec, number for data)
1996
+ *
1997
+ * @example
1998
+ * // Reference column by ID (spec layer)
1999
+ * { type: 'columnRef', value: 'col_abc123' }
2000
+ *
2001
+ * // Reference column by index (data layer)
2002
+ * { type: 'columnRef', value: 0 }
2003
+ */
2004
+ interface ExprColumnRef<C> {
2005
+ type: "columnRef";
2006
+ /** Column identifier (ID or index depending on context) */
2007
+ value: C;
2008
+ }
2009
+ type InferBooleanExpressionUnion<E> = [E extends ExprNumericComparison<unknown> ? Extract<E, {
2010
+ type: "numericComparison";
2011
+ }> : never, E extends ExprStringEquals<unknown> ? Extract<E, {
2012
+ type: "stringEquals";
2013
+ }> : never, E extends ExprStringContains<unknown> ? Extract<E, {
2014
+ type: "stringContains";
2015
+ }> : never, E extends ExprStringContainsFuzzy<unknown> ? Extract<E, {
2016
+ type: "stringContainsFuzzy";
2017
+ }> : never, E extends ExprStringRegex<unknown> ? Extract<E, {
2018
+ type: "stringRegex";
2019
+ }> : never, E extends ExprIsNull<unknown> ? Extract<E, {
2020
+ type: "isNull";
2021
+ }> : never, E extends ExprLogicalUnary<unknown> ? Extract<E, {
2022
+ type: "not";
2023
+ }> : never, E extends ExprLogicalVariadic<unknown> ? Extract<E, {
2024
+ type: "and" | "or";
2025
+ }> : never, E extends ExprIsIn<unknown, string | number> ? Extract<E, {
2026
+ type: "isIn";
2027
+ }> : never][number];
2028
+ /**
2029
+ * Selector for referencing an axis in queries.
2030
+ *
2031
+ * Used to identify a specific axis dimension in operations like:
2032
+ * - Sorting by axis values
2033
+ * - Partitioning for window functions
2034
+ * - Filtering/slicing axes
2035
+ *
2036
+ * @template A - Axis identifier type (typically string name or numeric index)
2037
+ *
2038
+ * @example
2039
+ * // Select axis by name
2040
+ * { type: 'axis', id: 'sample' }
2041
+ *
2042
+ * // Select axis by index
2043
+ * { type: 'axis', id: 0 }
2044
+ */
2045
+ interface QueryAxisSelector<A> {
2046
+ type: "axis";
2047
+ /** Axis identifier (name or index depending on context) */
2048
+ id: A;
2049
+ }
2050
+ /**
2051
+ * Selector for referencing a column in queries.
2052
+ *
2053
+ * Used to identify a specific column in operations like:
2054
+ * - Sorting by column values
2055
+ * - Partitioning for window functions
2056
+ * - Aggregation expressions
2057
+ *
2058
+ * @template C - Column identifier type (typically string name or numeric index)
2059
+ *
2060
+ * @example
2061
+ * // Select column by name
2062
+ * { type: 'column', id: 'expression_value' }
2063
+ *
2064
+ * // Select column by index
2065
+ * { type: 'column', id: 0 }
2066
+ */
2067
+ interface QueryColumnSelector<C> {
2068
+ type: "column";
2069
+ /** Column identifier (name or index depending on context) */
2070
+ id: C;
2071
+ }
2072
+ /**
2073
+ * Axis-or-column selector — mirrors the Rust `Selector<AxisSelector,
2074
+ * ColumnSelector>` enum
2075
+ * (`packages/bridge/src/query/query_sort.rs`). Used for the
2076
+ * `partitionBy` / `over` fields of window expressions where either an
2077
+ * axis or a column can drive the partition.
2078
+ */
2079
+ type QuerySelector<A, C> = QueryAxisSelector<A> | QueryColumnSelector<C>;
2080
+ /**
2081
+ * Left outer join query operation.
2082
+ *
2083
+ * Joins a primary query with one or more secondary queries using left outer join semantics.
2084
+ * All records from the primary are preserved; matching records from secondaries are joined,
2085
+ * non-matching positions are filled with nulls.
2086
+ *
2087
+ * **Join behavior**:
2088
+ * - All records from `primary` are preserved
2089
+ * - For each secondary, matching records (by axis keys) are joined
2090
+ * - Missing matches from secondaries are filled with null values
2091
+ * - Empty `secondary` array acts as identity (returns primary unchanged)
2092
+ *
2093
+ * **Null handling**: Null join keys don't match; positions without matches get null values.
2094
+ *
2095
+ * @template JE - Join entry type
2096
+ *
2097
+ * @example
2098
+ * // Left join samples with optional annotations
2099
+ * {
2100
+ * type: 'outerJoin',
2101
+ * primary: samplesQuery,
2102
+ * secondary: [annotationsQuery, metadataQuery]
2103
+ * }
2104
+ * // Result has all samples; annotations/metadata are null where not available
2105
+ */
2106
+ interface QueryOuterJoin<JE extends QueryJoinEntry<unknown>> {
2107
+ type: "outerJoin";
2108
+ /** Primary query - all its records are preserved */
2109
+ primary: JE;
2110
+ /** Secondary queries - joined where keys match, null where they don't */
2111
+ secondary: JE[];
2112
+ }
2113
+ /**
2114
+ * Axis slicing query operation.
2115
+ *
2116
+ * Filters data by fixing one or more axes to specific constant values.
2117
+ * Each filtered axis is removed from the resulting data shape (reduces dimensionality).
2118
+ *
2119
+ * **Behavior**:
2120
+ * - Each axis filter selects records where that axis equals the constant
2121
+ * - Filtered axes are removed from the output spec
2122
+ * - Multiple filters apply conjunctively (AND)
2123
+ *
2124
+ * @template Q - Input query type
2125
+ * @template A - Axis selector type
2126
+ *
2127
+ * @example
2128
+ * // Spec layer: axisSelector is a SingleAxisSelector.
2129
+ * {
2130
+ * type: 'sliceAxes',
2131
+ * input: fullDataQuery,
2132
+ * axisFilters: [
2133
+ * { axisSelector: { name: 'sample' }, constant: 'Sample1' },
2134
+ * { axisSelector: { name: 'condition' }, constant: 'Treatment' }
2135
+ * ]
2136
+ * }
2137
+ *
2138
+ * @example
2139
+ * // Data layer: axisSelector is the axis index.
2140
+ * {
2141
+ * type: 'sliceAxes',
2142
+ * input: fullDataQuery,
2143
+ * axisFilters: [{ axisSelector: 0, constant: 'Sample1' }]
2144
+ * }
2145
+ */
2146
+ interface QuerySliceAxes<Q, A> {
2147
+ type: "sliceAxes";
2148
+ /** Input query to slice */
2149
+ input: Q;
2150
+ /** List of axis filters to apply (at least one required) */
2151
+ axisFilters: {
2152
+ /** Axis to filter. `SingleAxisSelector` at the spec layer; axis index at the data layer. */axisSelector: A; /** The constant value to filter the axis to */
2153
+ constant: string | number;
2154
+ }[];
2155
+ }
2156
+ /**
2157
+ * Sort query operation.
2158
+ *
2159
+ * Reorders records by one or more axes or columns.
2160
+ * Does not change data shape or values, only record order.
2161
+ *
2162
+ * **Behavior**:
2163
+ * - Sort entries are applied in priority order (first entry = primary sort key)
2164
+ * - Ties in first sort key are broken by second, etc.
2165
+ * - All axes and columns pass through unchanged
2166
+ * - Only the physical ordering of records changes
2167
+ *
2168
+ * @template Q - Input query type
2169
+ * @template SE - Sort entry type
2170
+ *
2171
+ * @example
2172
+ * // Sort by score descending, then by name ascending for ties
2173
+ * {
2174
+ * type: 'sort',
2175
+ * input: dataQuery,
2176
+ * sortBy: [
2177
+ * { expression: { type: 'columnRef', value: 'score' }, ascending: false, nullsFirst: false },
2178
+ * { expression: { type: 'axisRef', value: { name: 'name' } }, ascending: true, nullsFirst: false }
2179
+ * ]
2180
+ * }
2181
+ */
2182
+ interface QuerySort<Q, E> {
2183
+ type: "sort";
2184
+ /** Input query to sort */
2185
+ input: Q;
2186
+ /** Sort criteria in priority order (at least one required) */
2187
+ sortBy: {
2188
+ expression: E; /** If true, sort ascending (A-Z, 0-9); if false, descending */
2189
+ ascending: boolean;
2190
+ /**
2191
+ * Null placement control:
2192
+ * - true: nulls sort before non-null values
2193
+ * - false: nulls sort after non-null values
2194
+ */
2195
+ nullsFirst: boolean;
2196
+ }[];
2197
+ }
2198
+ /**
2199
+ * Filter query operation.
2200
+ *
2201
+ * Filters records based on a boolean predicate expression.
2202
+ * Only records where predicate evaluates to true are kept.
2203
+ *
2204
+ * **Behavior**:
2205
+ * - Evaluates predicate for each record
2206
+ * - Keeps records where predicate is true
2207
+ * - Discards records where predicate is false or null
2208
+ * - Data shape (axes, columns) is preserved
2209
+ *
2210
+ * **Null handling**: Records with null predicate result are excluded (null ≠ true).
2211
+ *
2212
+ * @template Q - Input query type
2213
+ * @template E - Expression type
2214
+ *
2215
+ * @example
2216
+ * // Filter to records where value > 10 AND status == 'active'
2217
+ * {
2218
+ * type: 'filter',
2219
+ * input: dataQuery,
2220
+ * predicate: {
2221
+ * type: 'logical',
2222
+ * operand: 'and',
2223
+ * input: [
2224
+ * { type: 'numericComparison', operand: 'gt', left: valueRef, right: { type: 'constant', value: 10 } },
2225
+ * { type: 'stringEquals', input: statusRef, value: 'active' }
2226
+ * ]
2227
+ * }
2228
+ * }
2229
+ */
2230
+ interface QueryFilter<Q, E> {
2231
+ type: "filter";
2232
+ /** Input query to filter */
2233
+ input: Q;
2234
+ /** Boolean predicate expression - only true records pass */
2235
+ predicate: E;
2236
+ }
2237
+ /**
2238
+ * Column reference query (leaf node).
2239
+ *
2240
+ * References an existing column by its unique identifier.
2241
+ * This is a leaf node in the query tree that retrieves actual data.
2242
+ *
2243
+ * The column must exist in the dataset and its spec (axes, value type)
2244
+ * becomes the output spec of this query node.
2245
+ *
2246
+ * @example
2247
+ * // Reference column by ID
2248
+ * { type: 'column', column: 'col_abc123' }
2249
+ *
2250
+ * @template C - Column reference type (e.g., PObjectId for spec, full PColumn for rich queries)
2251
+ */
2252
+ interface QueryColumn<C = PObjectId> {
2253
+ type: "column";
2254
+ /** Column reference (ID or full column object depending on context) */
2255
+ column: C;
2256
+ }
2257
+ /**
2258
+ * Inline column query (leaf node).
2259
+ *
2260
+ * Creates a column with inline/embedded data and type specification.
2261
+ * Useful for creating constant columns or injecting computed data.
2262
+ *
2263
+ * The data is provided via dataInfo which contains the actual values
2264
+ * or reference to where data is stored.
2265
+ *
2266
+ * @template T - Type spec type
2267
+ *
2268
+ * @example
2269
+ * // Create inline column with constant values
2270
+ * {
2271
+ * type: 'inlineColumn',
2272
+ * spec: { axes: ['sample'], columns: ['Int'] },
2273
+ * dataInfo: { ... } // JsonDataInfo object
2274
+ * }
2275
+ */
2276
+ interface QueryInlineColumn<T> {
2277
+ type: "inlineColumn";
2278
+ /** Type specification defining axes and column types */
2279
+ spec: T;
2280
+ /** Data information containing or referencing the actual values */
2281
+ dataInfo: JsonDataInfo;
2282
+ }
2283
+ /**
2284
+ * Sparse to dense column query operation.
2285
+ *
2286
+ * Densifies a sparse column over the Cartesian product of distinct
2287
+ * axis values: `axes` partitions the column's own axes into two sets
2288
+ * (the listed axes on one side, the rest on the other); both sides
2289
+ * contribute their distinct values, and the cross product fills in
2290
+ * the missing tuples (null on rows that have no underlying value).
2291
+ *
2292
+ * **Use case**: graph-maker and other UI surfaces that need a dense
2293
+ * grid to plot.
2294
+ *
2295
+ * **Behavior**:
2296
+ * - Output axes = input axes (no axes are added).
2297
+ * - Missing axis-tuple combinations become null in the output (or
2298
+ * filled later via `pl7.app/graph/isDenseAxis` /
2299
+ * `treatAbsentValuesAs` annotations).
2300
+ *
2301
+ * @template C - Column reference type
2302
+ * @template A - Axis selector type (named selectors at the spec layer,
2303
+ * numeric axis indices at the data layer)
2304
+ * @template SO - Spec override type
2305
+ *
2306
+ * @example
2307
+ * // Spec layer: name the axis to expand across.
2308
+ * {
2309
+ * type: 'sparseToDenseColumn',
2310
+ * column: 'col_abc123',
2311
+ * axes: [{ name: 'sample' }],
2312
+ * specOverride: { ... } // optional spec modifications
2313
+ * }
2314
+ *
2315
+ * @example
2316
+ * // Data layer: the same query after spec→data lowering.
2317
+ * {
2318
+ * type: 'sparseToDenseColumn',
2319
+ * column: 'col_abc123',
2320
+ * axes: [0],
2321
+ * specOverride: { ... }
2322
+ * }
2323
+ */
2324
+ interface QuerySparseToDenseColumn<C, A, SO> {
2325
+ type: "sparseToDenseColumn";
2326
+ /** Column reference (ID or full column object depending on context) */
2327
+ column: C;
2328
+ /** Optional override for the column specification */
2329
+ specOverride?: SO;
2330
+ /**
2331
+ * Axes that participate in the cartesian-product densification.
2332
+ * Named selectors at the spec layer; resolved to numeric axis
2333
+ * indices during spec→data lowering. The Rust runtime also accepts
2334
+ * the legacy field name `axesIndices` as a serde alias.
2335
+ */
2336
+ axes: [A, ...A[]];
2337
+ }
2338
+ /**
2339
+ * Symmetric join query operation (inner join or full outer join).
2340
+ *
2341
+ * Joins multiple queries symmetrically (order doesn't affect result semantics).
2342
+ *
2343
+ * **Inner Join** (`type: 'innerJoin'`):
2344
+ * - Returns only records that exist in ALL entries
2345
+ * - Null join keys don't match, so records with null keys are excluded
2346
+ * - Result contains intersection of all entries by axis keys
2347
+ *
2348
+ * **Full Join** (`type: 'fullJoin'`):
2349
+ * - Returns all records from ALL entries
2350
+ * - Missing values are filled with nulls
2351
+ * - Null join keys create separate groups
2352
+ * - Result contains union of all entries by axis keys
2353
+ *
2354
+ * **Single entry**: Acts as identity (returns entry unchanged).
2355
+ *
2356
+ * @template JE - Join entry type
2357
+ *
2358
+ * @example
2359
+ * // Inner join: only records present in all queries
2360
+ * {
2361
+ * type: 'innerJoin',
2362
+ * entries: [query1Entry, query2Entry, query3Entry]
2363
+ * }
2364
+ *
2365
+ * // Full join: all records from all queries, nulls for missing
2366
+ * {
2367
+ * type: 'fullJoin',
2368
+ * entries: [query1Entry, query2Entry]
2369
+ * }
2370
+ */
2371
+ interface QuerySymmetricJoin<JE extends QueryJoinEntry<unknown>> {
2372
+ /** 'innerJoin' for intersection, 'fullJoin' for union with nulls */
2373
+ type: "innerJoin" | "fullJoin";
2374
+ /** Queries to join (at least one required) */
2375
+ entries: JE[];
2376
+ }
2377
+ /**
2378
+ * Join entry wrapper.
2379
+ *
2380
+ * Wraps a query to be used as an entry in join operations.
2381
+ * The wrapper allows for additional metadata or configuration
2382
+ * on each joined query (e.g., specifying join keys, aliases).
2383
+ *
2384
+ * @template Q - Query type
2385
+ *
2386
+ * @example
2387
+ * // Wrap a query for use in join
2388
+ * { entry: someQuery }
2389
+ */
2390
+ interface QueryJoinEntry<Q> {
2391
+ /** The query to be joined */
2392
+ entry: Q;
2393
+ }
2394
+ /**
2395
+ * Linker-join query operation.
2396
+ *
2397
+ * Inner-joins a linker column (`linker`) with one or more secondary subqueries,
2398
+ * then projects out the linker's one-side axes from the joined result. Used to
2399
+ * traverse a linker relationship: rows on the secondary side are "lifted" onto
2400
+ * the linker's many-side axes, with one-side axes collapsed away.
2401
+ *
2402
+ * Mirrors {@link QueryOuterJoin}'s `{ primary, secondary }` shape (with
2403
+ * `secondary` as an array), but the linker side is a specialized sub-struct —
2404
+ * a plain column reference rather than a full join entry.
2405
+ *
2406
+ * **Join behavior**:
2407
+ * - The linker column is inner-joined with all `secondary` entries
2408
+ * - After the join, the linker's one-side axes are projected out
2409
+ * - Result axes = joined axes minus the linker's one-side axes
2410
+ *
2411
+ * **Note**: `secondary` must contain at least one entry (empty has no
2412
+ * well-defined meaning for linker-join).
2413
+ *
2414
+ * @template L - Linker sub-struct type (layer-specific)
2415
+ * @template JE - Join entry type for the secondary side
2416
+ *
2417
+ * @example
2418
+ * // Traverse linker l1 and read rest data lifted onto l1's many-side
2419
+ * {
2420
+ * type: 'linkerJoin',
2421
+ * linker: { column: 'l1' },
2422
+ * secondary: [{ entry: restQuery, ... }]
2423
+ * }
2424
+ */
2425
+ interface QueryLinkerJoin<L, JE extends QueryJoinEntry<unknown>> {
2426
+ type: "linkerJoin";
2427
+ /** Linker side — column reference plus layer-specific integration data. */
2428
+ linker: L;
2429
+ /** Rest side — one or more subqueries joined with the linker (at least one). */
2430
+ secondary: JE[];
2431
+ }
2432
+ /**
2433
+ * `transformColumns` mode.
2434
+ *
2435
+ * - `"append"` — existing columns pass through; the new columns are
2436
+ * appended.
2437
+ * - `"replace"` — only the listed columns are kept; everything else is
2438
+ * dropped.
2439
+ *
2440
+ * The Rust runtime accepts the legacy `"add"` tag as a serde alias;
2441
+ * new code should emit `"append"`.
2442
+ */
2443
+ type TransformColumnsMode = "append" | "replace";
2444
+ /**
2445
+ * Single column entry for {@link QueryTransformColumns}.
2446
+ *
2447
+ * @template E - Expression type
2448
+ * @template SO - Spec override type (typically `PColumnIdAndSpec` at
2449
+ * the spec layer, or layer-specific id+typespec at the data layer)
2450
+ */
2451
+ interface TransformColumnEntry<E, SO> {
2452
+ /** Expression computing the column values. */
2453
+ expression: E;
2454
+ /**
2455
+ * Optional spec override. If omitted, the runtime auto-derives the
2456
+ * column's spec from the host's input and the expression.
2457
+ * `valueType` is always inferred from the expression.
2458
+ */
2459
+ specOverride?: SO;
2460
+ }
2461
+ /**
2462
+ * Transform-columns query operation.
2463
+ *
2464
+ * Computes one or more derived columns from `input`. Axes are
2465
+ * preserved.
2466
+ *
2467
+ * @template Q - Input query type
2468
+ * @template E - Expression type
2469
+ * @template SO - Spec override type
2470
+ */
2471
+ interface QueryTransformColumns<Q, E, SO> {
2472
+ type: "transformColumns";
2473
+ /** Input query. */
2474
+ input: Q;
2475
+ /** `"append"` to add new columns; `"replace"` to keep only listed columns. */
2476
+ mode: TransformColumnsMode;
2477
+ /** Derived columns to compute (at least one). */
2478
+ columns: [TransformColumnEntry<E, SO>, ...TransformColumnEntry<E, SO>[]];
2479
+ }
2480
+ /**
2481
+ * Spec-override query operation — client-side-only structural node.
2482
+ *
2483
+ * Overlays a {@link SpecOverrides} patch on top of the inner query's spec.
2484
+ * Carries no topological change — it is collapsed at the host boundary
2485
+ * (`resolvePColumn`) before the query reaches pframe-engine. The engine
2486
+ * never sees this node.
2487
+ *
2488
+ * Emitted by `ColumnOverriddenRecipe.getQuery()`; the only currently
2489
+ * supported shape is `specOverride{ input: <plain column ref>, override }`
2490
+ * (i.e. `Overridden<Lazy>`). More complex projections under Overridden are
2491
+ * a future engine work item.
2492
+ *
2493
+ * @template Q - Input query type
2494
+ * @template SO - Spec override type
2495
+ */
2496
+ interface QuerySpecOverride<Q, SO> {
2497
+ type: "specOverride";
2498
+ /** Input query whose spec is to be overridden. */
2499
+ input: Q;
2500
+ /** Spec override patch to overlay on the inner spec. */
2501
+ override: SO;
2502
+ } //#endregion
2503
+ //#endregion
2504
+ //#region ../../../../lib/model/common/dist/drivers/pframe/query/query_data.d.ts
2505
+ //#region src/drivers/pframe/query/query_data.d.ts
2506
+ /**
2507
+ * Column identifier with type specification.
2508
+ *
2509
+ * Pairs a column ID with its full type specification (axes and column types).
2510
+ * Used in data layer to carry type information alongside column references.
2511
+ */
2512
+ type ColumnIdAndTypeSpec = {
2513
+ /** Unique identifier of the column */id: PObjectId; /** Type specification defining the axes and the single column value type */
2514
+ spec: ColumnTypeSpec;
2515
+ };
2516
+ /**
2517
+ * Join entry for data layer queries.
2518
+ *
2519
+ * Extends the base join entry with axes mapping information.
2520
+ * The mapping specifies how axes from this entry align with the joined result.
2521
+ *
2522
+ * @example
2523
+ * // Join entry with axes mapping [0, 2] means:
2524
+ * // - This entry's axis 0 maps to result axis 0
2525
+ * // - This entry's axis 1 maps to result axis 2
2526
+ * { entry: queryData, axesMapping: [0, 2] }
2527
+ */
2528
+ interface DataQueryJoinEntry extends QueryJoinEntry<DataQuery> {
2529
+ /** Maps this entry's axes to the result axes by index */
2530
+ axesMapping: number[];
2531
+ }
2532
+ /** @see QueryColumn */
2533
+ type DataQueryColumn = QueryColumn;
2534
+ /** @see QueryInlineColumn */
2535
+ type DataQueryInlineColumn = QueryInlineColumn<ColumnIdAndTypeSpec>;
2536
+ /** @see QuerySparseToDenseColumn */
2537
+ type DataQuerySparseToDenseColumn = QuerySparseToDenseColumn<PObjectId, number, ColumnIdAndTypeSpec>;
2538
+ /** @see QuerySymmetricJoin */
2539
+ type DataQuerySymmetricJoin = QuerySymmetricJoin<DataQueryJoinEntry>;
2540
+ /** @see QueryOuterJoin */
2541
+ type DataQueryOuterJoin = QueryOuterJoin<DataQueryJoinEntry>;
2542
+ /**
2543
+ * Linker side of a data-layer linker-join.
2544
+ *
2545
+ * Carries the linker column id along with integration-derived artifacts needed
2546
+ * for execution:
2547
+ * - `axesMapping` — how the linker's axes map into the joined result
2548
+ * - `oneSideAxesIndices` — which axis indices in the joined result to project out
2549
+ */
2550
+ type DataQueryLinkerJoinLinker = {
2551
+ /** Linker column reference. */column: PObjectId; /** Linker's axes mapped into the joined result. */
2552
+ axesMapping: number[]; /** Axis indices (in the joined result) to project out — the linker's one-side axes. */
2553
+ oneSideAxesIndices: number[];
2554
+ };
2555
+ /** @see QueryLinkerJoin */
2556
+ type DataQueryLinkerJoin = QueryLinkerJoin<DataQueryLinkerJoinLinker, DataQueryJoinEntry>;
2557
+ /** @see QuerySliceAxes */
2558
+ type DataQuerySliceAxes = QuerySliceAxes<DataQuery, number>;
2559
+ /** @see QuerySort */
2560
+ type DataQuerySort = QuerySort<DataQuery, DataQueryExpression>;
2561
+ /** @see QueryFilter */
2562
+ type DataQueryFilter = QueryFilter<DataQuery, DataQueryBooleanExpression>;
2563
+ /** @see QueryTransformColumns */
2564
+ type DataQueryTransformColumns = QueryTransformColumns<DataQuery, DataQueryExpression, ColumnIdAndTypeSpec>;
2565
+ /**
2566
+ * Union of all data layer query types.
2567
+ *
2568
+ * The data layer operates with numeric indices for axes and columns,
2569
+ * making it suitable for runtime query execution and optimization.
2570
+ *
2571
+ * Includes:
2572
+ * - Leaf nodes: column, inlineColumn, sparseToDenseColumn
2573
+ * - Join operations: innerJoin, fullJoin, outerJoin, linkerJoin
2574
+ * - Transformations: sliceAxes, sort, filter, transformColumns
2575
+ */
2576
+ type DataQuery = DataQueryColumn | DataQueryInlineColumn | DataQuerySparseToDenseColumn | DataQuerySymmetricJoin | DataQueryOuterJoin | DataQueryLinkerJoin | DataQuerySliceAxes | DataQuerySort | DataQueryFilter | DataQueryTransformColumns;
2577
+ /** @see ExprAxisRef */
2578
+ type DataExprAxisRef = ExprAxisRef<number>;
2579
+ /** @see ExprColumnRef */
2580
+ type DataExprColumnRef = ExprColumnRef<number>;
2581
+ type DataQueryExpression = DataExprColumnRef | DataExprAxisRef | ExprConstant | ExprNumericBinary<DataQueryExpression> | ExprNumericComparison<DataQueryExpression> | ExprNumericUnary<DataQueryExpression> | ExprStringEquals<DataQueryExpression> | ExprStringContains<DataQueryExpression> | ExprStringRegex<DataQueryExpression> | ExprStringContainsFuzzy<DataQueryExpression> | ExprIsNull<DataQueryExpression> | ExprFillNull<DataQueryExpression> | ExprLogicalUnary<DataQueryExpression> | ExprLogicalVariadic<DataQueryExpression> | ExprIsIn<DataQueryExpression, string> | ExprIsIn<DataQueryExpression, number> | ExprCast<DataQueryExpression> | ExprConditional<DataQueryExpression> | ExprRanking<DataQueryExpression, number, number>;
2582
+ type DataQueryBooleanExpression = InferBooleanExpressionUnion<DataQueryExpression>; //#endregion
2583
+ //#endregion
2584
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec_driver.d.ts
2585
+ //#region src/drivers/pframe/spec_driver.d.ts
2586
+ /** Matches a string value either exactly or by regex pattern */
2587
+ type StringMatcher = {
2588
+ type: "exact";
2589
+ value: string;
2590
+ } | {
2591
+ type: "regex";
2592
+ value: string;
2593
+ };
2594
+ /** Map of key to array of string matchers (OR-ed per key, AND-ed across keys) */
2595
+ type MatcherMap = Record<string, StringMatcher[]>;
2596
+ /** Selector for matching axes by various criteria */
2597
+ interface MultiAxisSelector {
2598
+ /** Match any of the axis types listed here */
2599
+ readonly type?: AxisValueType[];
2600
+ /** Match any of the axis names listed here */
2601
+ readonly name?: StringMatcher[];
2602
+ /** Match requires all the domains listed here */
2603
+ readonly domain?: MatcherMap;
2604
+ /** Match requires all the context domains listed here */
2605
+ readonly contextDomain?: MatcherMap;
2606
+ /** Match requires all the annotations listed here */
2607
+ readonly annotations?: MatcherMap;
2608
+ }
2609
+ /** Column selector for discover columns request, matching columns by various criteria.
2610
+ * Multiple selectors are OR-ed: a column matches if it satisfies any selector. */
2611
+ interface MultiColumnSelector {
2612
+ /** Match any of the value types listed here */
2613
+ readonly type?: ColumnValueType[];
2614
+ /** Match any of the names listed here */
2615
+ readonly name?: StringMatcher[];
2616
+ /** Match requires all the domains listed here */
2617
+ readonly domain?: MatcherMap;
2618
+ /** Match requires all the context domains listed here */
2619
+ readonly contextDomain?: MatcherMap;
2620
+ /** Match requires all the annotations listed here */
2621
+ readonly annotations?: MatcherMap;
2622
+ /** Match any of the axis selectors listed here */
2623
+ readonly axes?: MultiAxisSelector[];
2624
+ /** When true (default), allows matching if only a subset of axes match */
2625
+ readonly partialAxesMatch?: boolean;
2626
+ }
2627
+ /** Qualifications needed for both query (already-integrated) columns and the hit column. */
2628
+ interface ColumnAxesWithQualifications {
2629
+ /** Already integrated (query) columns with their qualifications. */
2630
+ axesSpec: AxisSpec[];
2631
+ /** Qualifications for each already integrated (query) column. */
2632
+ qualifications: AxisQualification[];
2633
+ }
2634
+ /** Fine-grained constraints controlling axes matching and qualification behavior */
2635
+ interface DiscoverColumnsConstraints {
2636
+ /** Allow source (query) axes that have no match in the hit column */
2637
+ allowFloatingSourceAxes: boolean;
2638
+ /** Allow hit column axes that have no match in the source (query) */
2639
+ allowFloatingHitAxes: boolean;
2640
+ /** Allow source (query) axes to be qualified (contextDomain extended) */
2641
+ allowSourceQualifications: boolean;
2642
+ /** Allow hit column axes to be qualified (contextDomain extended) */
2643
+ allowHitQualifications: boolean;
2644
+ }
2645
+ /** Request for discovering columns compatible with a given axes integration */
2646
+ interface DiscoverColumnsRequest {
2647
+ /** Include columns matching these selectors (OR-ed); empty or omitted matches all columns */
2648
+ includeColumns?: MultiColumnSelector[];
2649
+ /** Exclude columns matching these selectors (OR-ed); applied after include filter */
2650
+ excludeColumns?: MultiColumnSelector[];
2651
+ /** Already integrated axes with qualifications */
2652
+ axes: ColumnAxesWithQualifications[];
2653
+ /** Maximum number of hops allowed between provided axes integration and returned hits (0 = direct only) */
2654
+ maxHops?: number;
2655
+ /** Constraints controlling axes matching and qualification behavior */
2656
+ constraints: DiscoverColumnsConstraints;
2657
+ }
2658
+ /** Linker step: traversal through a linker column */
2659
+ interface DiscoverColumnsLinkerStep {
2660
+ type: "linker";
2661
+ /** The linker column traversed in this step */
2662
+ linker: PColumnIdAndSpec;
2663
+ }
2664
+ /**
2665
+ * Filter step: intersects the current subquery with a filter column on shared
2666
+ * axes. Filter columns carry `pl7.app/isSubset: "true"` with axes ⊆ dataset
2667
+ * axes, so the inner-join narrows the key space to rows where the filter is
2668
+ * present.
2669
+ */
2670
+ interface DiscoverColumnsFilterStep {
2671
+ type: "filter";
2672
+ /** The filter column applied in this step */
2673
+ filter: PColumnIdAndSpec;
2674
+ }
2675
+ /** A step traversed during path-based column discovery. Discriminated by `type`. */
2676
+ type DiscoverColumnsStepInfo = DiscoverColumnsLinkerStep | DiscoverColumnsFilterStep;
2677
+ /**
2678
+ * Input to `buildQuery`: a terminal column plus an ordered
2679
+ * path of wrapping steps (linker hops, filter joins). Produces a
2680
+ * {@link SpecQueryJoinEntry} ready to be plugged into an
2681
+ * `innerJoin`/`fullJoin`/`outerJoin` entry list.
2682
+ *
2683
+ * Path ordering: `path[0]` is outermost (first applied), `path[N-1]` is
2684
+ * closest to `column`. Omit or pass `[]` for a direct column with no
2685
+ * wrapping.
2686
+ *
2687
+ * Columns are referenced by id — specs are resolved later at
2688
+ * `evaluateQuery` against the registered specs of the PFrame, so the
2689
+ * caller cannot disagree with the frame about spec content.
2690
+ *
2691
+ * Qualifications annotate the resulting outermost entry; they do not
2692
+ * propagate into the inner query.
2693
+ */
2694
+ type BuildQueryInput = {
2695
+ /** Shape version marker — bumped only on breaking structural changes. */readonly version: "v1"; /** Terminal column id — the column actually returning data. */
2696
+ readonly column: PObjectId; /** Ordered path from source integration to `column`. Outermost first. */
2697
+ readonly path?: DiscoverColumnsStepInfo[]; /** Axis qualifications attached to the resulting join entry. */
2698
+ readonly qualifications?: AxisQualification[];
2699
+ };
2700
+ /** Qualifications info for a discover columns response mapping variant */
2701
+ interface DiscoverColumnsResponseQualifications {
2702
+ /** Qualifications for each query (already-integrated) column set */
2703
+ forQueries: AxisQualification[][];
2704
+ /** Qualifications for the hit column */
2705
+ forHit: AxisQualification[];
2706
+ }
2707
+ /** A single mapping variant describing how a hit column can be integrated */
2708
+ interface DiscoverColumnsMappingVariant {
2709
+ /** Full qualifications needed for integration */
2710
+ qualifications: DiscoverColumnsResponseQualifications;
2711
+ /** Distinctive (minimal) qualifications needed for integration */
2712
+ distinctiveQualifications: DiscoverColumnsResponseQualifications;
2713
+ }
2714
+ /** A single hit in the discover columns response */
2715
+ interface DiscoverColumnsResponseHit {
2716
+ /** The column that was found compatible */
2717
+ hit: PColumnIdAndSpec;
2718
+ /** Linker steps traversed to reach this hit; empty for direct matches */
2719
+ path: DiscoverColumnsStepInfo[];
2720
+ /** Possible ways to integrate this column with the existing set */
2721
+ mappingVariants: DiscoverColumnsMappingVariant[];
2722
+ }
2723
+ /** Response from discover columns */
2724
+ interface DiscoverColumnsResponse {
2725
+ /** Columns that could be integrated and possible ways to integrate them */
2726
+ hits: DiscoverColumnsResponseHit[];
2727
+ }
2728
+ /** Request for deleting an entry from a given axes integration */
2729
+ interface DeleteColumnRequest {
2730
+ /** Already integrated axes with qualifications */
2731
+ axes: ColumnAxesWithQualifications[];
2732
+ /** Zero based index of the entry to be deleted */
2733
+ delete: number;
2734
+ }
2735
+ /** Response from delete column */
2736
+ interface DeleteColumnResponse {
2737
+ axes: ColumnAxesWithQualifications[];
2738
+ }
2739
+ /** Response from evaluating a query against a PFrame. */
2740
+ type EvaluateQueryResponse = {
2741
+ /**
2742
+ * The table specification describing the structure of the query result,
2743
+ * including all axes and columns that will be present in the output.
2744
+ */
2745
+ tableSpec: PTableColumnSpec[];
2746
+ /**
2747
+ * The data layer query representation with numeric indices,
2748
+ * suitable for execution by the data processing engine.
2749
+ */
2750
+ dataQuery: DataQuery;
2751
+ };
2752
+ /** Handle to a spec-only PFrame (no data, synchronous operations). */
2753
+ type SpecFrameHandle = Branded<string, "SpecFrameHandle">;
2754
+ /**
2755
+ * Synchronous driver for spec-level PFrame operations.
2756
+ *
2757
+ * Unlike the async PFrameDriver (which works with data), this driver
2758
+ * operates on column specifications only. All methods are synchronous
2759
+ * because the underlying WASM PFrame computes results immediately.
2760
+ */
2761
+ interface PFrameSpecDriver {
2762
+ /** Create a spec-only PFrame from column specs. Returns a pool entry with handle and unref. */
2763
+ createSpecFrame(specs: Record<string, PColumnSpec>): PoolEntry<SpecFrameHandle>;
2764
+ /** List all columns currently registered in the frame. */
2765
+ listColumns(handle: SpecFrameHandle): PColumnIdAndSpec[];
2766
+ /** Discover columns compatible with given axes integration. */
2767
+ discoverColumns(handle: SpecFrameHandle, request: DiscoverColumnsRequest): DiscoverColumnsResponse;
2768
+ /** Delete an entry from a given axes integration */
2769
+ deleteColumn(handle: SpecFrameHandle, request: DeleteColumnRequest): DeleteColumnResponse;
2770
+ /** Evaluates a query specification against this PFrame */
2771
+ evaluateQuery(handle: SpecFrameHandle, request: SpecQuery): EvaluateQueryResponse;
2772
+ /**
2773
+ * Assembles a {@link SpecQueryJoinEntry} from a terminal column plus an
2774
+ * ordered path of wrapping steps (linker hops, filter joins).
2775
+ *
2776
+ * Pure over its input — no frame handle is needed. Column ids are resolved
2777
+ * later at {@link evaluateQuery} against the registered specs.
2778
+ */
2779
+ buildQuery(input: BuildQueryInput): SpecQueryJoinEntry;
2780
+ /** Expand index-based parentAxes in AxesSpec to resolved AxisId parents in AxesId. */
2781
+ expandAxes(spec: AxesSpec): AxesId;
2782
+ /** Collapse resolved AxisId parents back to index-based parentAxes in AxesSpec. */
2783
+ collapseAxes(ids: AxesId): AxesSpec;
2784
+ /** Find the index of an axis matching the given selector. Returns -1 if not found. */
2785
+ findAxis(spec: AxesSpec, selector: SingleAxisSelector): number;
2786
+ /** Find the flat index of a table column matching the given selector. Returns -1 if not found. */
2787
+ findTableColumn(tableSpec: PTableColumnSpec[], selector: PTableColumnId): number;
2788
+ /**
2789
+ * Upgrades selector-based legacy record filters into index-based data-layer
2790
+ * boolean expressions, resolved against the provided unified table spec
2791
+ * (axes first, then columns).
2792
+ */
2793
+ rewriteLegacyFilters(request: {
2794
+ tableSpec: PTableColumnSpec[];
2795
+ filters: PTableRecordFilter[];
2796
+ }): DataQueryBooleanExpression[];
2797
+ } //#endregion
2798
+ //#endregion
2799
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/selectors.d.ts
2800
+ /** Single axis selector */
2801
+ interface SingleAxisSelector {
2802
+ /** Axis name (required) */
2803
+ name: string;
2804
+ /** Axis type (optional) */
2805
+ type?: AxisValueType;
2806
+ /** Domain requirements (optional) */
2807
+ domain?: Domain;
2808
+ /** Context-domain requirements (optional) */
2809
+ contextDomain?: Domain;
2810
+ /** Parent axes requirements (optional) */
2811
+ parentAxes?: SingleAxisSelector[];
2812
+ }
2813
+ /** Qualification applied to a single axis to make it compatible during integration. */
2814
+ interface AxisQualification {
2815
+ /** Axis selector identifying which axis is qualified. */
2816
+ readonly axis: SingleAxisSelector;
2817
+ /** Additional context domain entries applied to the axis. */
2818
+ readonly contextDomain: Record<string, string>;
2819
+ }
2820
+ /**
2821
+ * Reference to an axis by its numerical index within the anchor column's axes array
2822
+ * Format: [anchorId, axisIndex]
2823
+ */
2824
+ //#endregion
2825
+ //#region ../../../../lib/model/common/dist/drivers/pframe/query/query_spec.d.ts
2826
+ //#region src/drivers/pframe/query/query_spec.d.ts
2827
+ /**
2828
+ * Join entry for spec-layer queries — the base join entry extended with
2829
+ * per-axis domain constraints. Absent `qualifications` is equivalent to `[]`.
2830
+ *
2831
+ * @example
2832
+ * {
2833
+ * entry: querySpec,
2834
+ * qualifications: [{ axis: { name: 'sample' }, contextDomain: { ... } }]
2835
+ * }
2836
+ */
2837
+ type SpecQueryJoinEntry<C = ColumnUniversalId> = QueryJoinEntry<SpecQuery<C>> & {
2838
+ qualifications?: readonly {
2839
+ /** Axis to qualify. */axis: SingleAxisSelector; /** Additional domain constraints for this axis. */
2840
+ contextDomain: Domain;
2841
+ }[];
2842
+ };
2843
+ /** @see QueryColumn */
2844
+ type SpecQueryColumn<C = ColumnUniversalId> = QueryColumn<C>;
2845
+ /** @see QueryInlineColumn */
2846
+ type SpecQueryInlineColumn = QueryInlineColumn<PColumnIdAndSpec>;
2847
+ /** @see QuerySparseToDenseColumn */
2848
+ type SpecQuerySparseToDenseColumn<C = ColumnUniversalId> = QuerySparseToDenseColumn<C, SingleAxisSelector, PColumnIdAndSpec>;
2849
+ /** @see QuerySymmetricJoin */
2850
+ type SpecQuerySymmetricJoin<C = ColumnUniversalId> = QuerySymmetricJoin<SpecQueryJoinEntry<C>>;
2851
+ /** @see QueryOuterJoin */
2852
+ type SpecQueryOuterJoin<C = ColumnUniversalId> = QueryOuterJoin<SpecQueryJoinEntry<C>>;
2853
+ /** @see QueryLinkerJoin */
2854
+ type SpecQueryLinkerJoin<C = ColumnUniversalId> = QueryLinkerJoin<SpecQuery<C>, SpecQueryJoinEntry<C>>;
2855
+ /** @see QuerySliceAxes */
2856
+ type SpecQuerySliceAxes<C = ColumnUniversalId> = QuerySliceAxes<SpecQuery<C>, SingleAxisSelector>;
2857
+ /** @see QuerySort */
2858
+ type SpecQuerySort<C = ColumnUniversalId> = QuerySort<SpecQuery<C>, SpecQueryExpression>;
2859
+ /** @see QueryFilter */
2860
+ type SpecQueryFilter<C = ColumnUniversalId> = QueryFilter<SpecQuery<C>, SpecQueryBooleanExpression>;
2861
+ /** @see QueryTransformColumns */
2862
+ type SpecQueryTransformColumns<C = ColumnUniversalId> = QueryTransformColumns<SpecQuery<C>, SpecQueryExpression, PColumnIdAndSpec>;
2863
+ /**
2864
+ * Client-side spec-override node — collapsed at the host boundary, never
2865
+ * sent to pframe-engine.
2866
+ *
2867
+ * @see QuerySpecOverride
2868
+ */
2869
+ type SpecQuerySpecOverride<C = ColumnUniversalId> = QuerySpecOverride<SpecQuery<C>, SpecOverrides>;
2870
+ /**
2871
+ * Union of all spec layer query types.
2872
+ *
2873
+ * The spec layer operates with named selectors and column IDs,
2874
+ * making it suitable for user-facing query construction and validation.
2875
+ *
2876
+ * @template C - Column reference type. Defaults to PObjectId (ID-only).
2877
+ * Can be parameterized with richer types (e.g., PColumn<Data>) to carry
2878
+ * full column data directly in the query tree.
2879
+ *
2880
+ * Includes:
2881
+ * - Leaf nodes: column, inlineColumn, sparseToDenseColumn
2882
+ * - Join operations: innerJoin, fullJoin, outerJoin, linkerJoin
2883
+ * - Transformations: sliceAxes, sort, filter, transformColumns
2884
+ * - Client-side overlays: specOverride (collapsed before reaching the engine)
2885
+ */
2886
+ type SpecQuery<C = ColumnUniversalId> = SpecQueryColumn<C> | SpecQueryInlineColumn | SpecQuerySparseToDenseColumn<C> | SpecQuerySymmetricJoin<C> | SpecQueryOuterJoin<C> | SpecQueryLinkerJoin<C> | SpecQuerySliceAxes<C> | SpecQuerySort<C> | SpecQueryFilter<C> | SpecQueryTransformColumns<C> | SpecQuerySpecOverride<C>;
2887
+ /** @see ExprAxisRef */
2888
+ type SpecExprAxisRef = ExprAxisRef<SingleAxisSelector>;
2889
+ /** @see ExprColumnRef */
2890
+ type SpecExprColumnRef = ExprColumnRef<ColumnUniversalId>;
2891
+ type SpecQueryExpression = SpecExprColumnRef | SpecExprAxisRef | ExprConstant | ExprNumericBinary<SpecQueryExpression> | ExprNumericComparison<SpecQueryExpression> | ExprNumericUnary<SpecQueryExpression> | ExprStringEquals<SpecQueryExpression> | ExprStringContains<SpecQueryExpression> | ExprStringRegex<SpecQueryExpression> | ExprStringContainsFuzzy<SpecQueryExpression> | ExprIsNull<SpecQueryExpression> | ExprFillNull<SpecQueryExpression> | ExprLogicalUnary<SpecQueryExpression> | ExprLogicalVariadic<SpecQueryExpression> | ExprIsIn<SpecQueryExpression, string> | ExprIsIn<SpecQueryExpression, number> | ExprCast<SpecQueryExpression> | ExprConditional<SpecQueryExpression> | ExprRanking<SpecQueryExpression, SingleAxisSelector, PObjectId>;
2892
+ type SpecQueryBooleanExpression = InferBooleanExpressionUnion<SpecQueryExpression>; //#endregion
2893
+ //#endregion
2894
+ //#region ../../../../lib/model/common/dist/drivers/pframe/table_calculate.d.ts
2895
+ //#region src/drivers/pframe/table_calculate.d.ts
2896
+ /** Defines a terminal column node in the join request tree */
2897
+ interface ColumnJoinEntry<Col> {
2898
+ /** Node type discriminator */
2899
+ readonly type: "column";
2900
+ /** Local column */
2901
+ readonly column: Col;
2902
+ }
2903
+ /**
2904
+ * Axis filter slicing target axis from column axes.
2905
+ * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).
2906
+ * */
2907
+ interface ConstantAxisFilter {
2908
+ /** Filter type discriminator */
2909
+ readonly type: "constant";
2910
+ /** Index of axis to slice (zero-based) */
2911
+ readonly axisIndex: number;
2912
+ /** Equality filter reference value, see {@link SingleValueEqualPredicate} */
2913
+ readonly constant: string | number;
2914
+ }
2915
+ /** Defines a terminal column node in the join request tree */
2916
+ interface SlicedColumnJoinEntry<Col> {
2917
+ /** Node type discriminator */
2918
+ readonly type: "slicedColumn";
2919
+ /** Local column */
2920
+ readonly column: Col;
2921
+ /** New column id */
2922
+ readonly newId: PObjectId;
2923
+ /** Non-empty list of axis filters */
2924
+ readonly axisFilters: ConstantAxisFilter[];
2925
+ }
2926
+ interface ArtificialColumnJoinEntry<Col> {
2927
+ /** Node type discriminator */
2928
+ readonly type: "artificialColumn";
2929
+ /** Column definition */
2930
+ readonly column: Col;
2931
+ /** New column id */
2932
+ readonly newId: PObjectId;
2933
+ /** Indices of axes to pick from the column (zero-based) */
2934
+ readonly axesIndices: number[];
2935
+ }
2936
+ /** Defines a terminal column node in the join request tree */
2937
+ interface InlineColumnJoinEntry {
2938
+ /** Node type discriminator */
2939
+ readonly type: "inlineColumn";
2940
+ /** Column definition */
2941
+ readonly column: PColumn<PColumnValues>;
2942
+ }
2943
+ /**
2944
+ * Defines a join request tree node that will output only records present in
2945
+ * all child nodes ({@link entries}).
2946
+ * */
2947
+ interface InnerJoin<Col> {
2948
+ /** Node type discriminator */
2949
+ readonly type: "inner";
2950
+ /** Child nodes to be inner joined */
2951
+ readonly entries: JoinEntry<Col>[];
2952
+ }
2953
+ /**
2954
+ * Defines a join request tree node that will output all records present at
2955
+ * least in one of the child nodes ({@link entries}), values for those PColumns
2956
+ * that lack corresponding combinations of axis values will be null.
2957
+ * */
2958
+ interface FullJoin<Col> {
2959
+ /** Node type discriminator */
2960
+ readonly type: "full";
2961
+ /** Child nodes to be fully outer joined */
2962
+ readonly entries: JoinEntry<Col>[];
2963
+ }
2964
+ /**
2965
+ * Defines a join request tree node that will output all records present in
2966
+ * {@link primary} child node, and records from the {@link secondary} nodes will
2967
+ * be added to the output only if present, values for those PColumns from the
2968
+ * {@link secondary} list, that lack corresponding combinations of axis values
2969
+ * will be null.
2970
+ *
2971
+ * This node can be thought as a chain of SQL LEFT JOIN operations starting from
2972
+ * the {@link primary} node and adding {@link secondary} nodes one by one.
2973
+ * */
2974
+ interface OuterJoin<Col> {
2975
+ /** Node type discriminator */
2976
+ readonly type: "outer";
2977
+ /** Primes the join operation. Left part of LEFT JOIN. */
2978
+ readonly primary: JoinEntry<Col>;
2979
+ /** Driven nodes, giving their values only if primary node have corresponding
2980
+ * nodes. Right parts of LEFT JOIN chain. */
2981
+ readonly secondary: JoinEntry<Col>[];
2982
+ }
2983
+ /**
2984
+ * Base type of all join request tree nodes. Join request tree allows to combine
2985
+ * information from multiple PColumns into a PTable. Correlation between records
2986
+ * is performed by looking for records with the same values in common axis between
2987
+ * the PColumns. Common axis are those axis which have equal {@link AxisId} derived
2988
+ * from the columns axes spec.
2989
+ * */
2990
+ type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | ArtificialColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
2991
+ /** Container representing whole data stored in specific PTable column. */
2992
+ interface FullPTableColumnData {
2993
+ /** Unified spec */
2994
+ readonly spec: PTableColumnSpec;
2995
+ /** Data */
2996
+ readonly data: PTableVector;
2997
+ }
2998
+ interface SingleValueIsNAPredicate {
2999
+ /** Comparison operator */
3000
+ readonly operator: "IsNA";
3001
+ }
3002
+ interface SingleValueEqualPredicate {
3003
+ /** Comparison operator */
3004
+ readonly operator: "Equal";
3005
+ /** Reference value, NA values will not match */
3006
+ readonly reference: string | number;
3007
+ }
3008
+ interface SingleValueInSetPredicate {
3009
+ /** Comparison operator */
3010
+ readonly operator: "InSet";
3011
+ /** Reference values, NA values will not match */
3012
+ readonly references: (string | number)[];
3013
+ }
3014
+ interface SingleValueIEqualPredicate {
3015
+ /** Comparison operator (case insensitive) */
3016
+ readonly operator: "IEqual";
3017
+ /** Reference value, NA values will not match */
3018
+ readonly reference: string;
3019
+ }
3020
+ interface SingleValueLessPredicate {
3021
+ /** Comparison operator */
3022
+ readonly operator: "Less";
3023
+ /** Reference value, NA values will not match */
3024
+ readonly reference: string | number;
3025
+ }
3026
+ interface SingleValueLessOrEqualPredicate {
3027
+ /** Comparison operator */
3028
+ readonly operator: "LessOrEqual";
3029
+ /** Reference value, NA values will not match */
3030
+ readonly reference: string | number;
3031
+ }
3032
+ interface SingleValueGreaterPredicate {
3033
+ /** Comparison operator */
3034
+ readonly operator: "Greater";
3035
+ /** Reference value, NA values will not match */
3036
+ readonly reference: string | number;
3037
+ }
3038
+ interface SingleValueGreaterOrEqualPredicate {
3039
+ /** Comparison operator */
3040
+ readonly operator: "GreaterOrEqual";
3041
+ /** Reference value, NA values will not match */
3042
+ readonly reference: string | number;
3043
+ }
3044
+ interface SingleValueStringContainsPredicate {
3045
+ /** Comparison operator */
3046
+ readonly operator: "StringContains";
3047
+ /** Reference substring, NA values are skipped */
3048
+ readonly substring: string;
3049
+ }
3050
+ interface SingleValueStringIContainsPredicate {
3051
+ /** Comparison operator (case insensitive) */
3052
+ readonly operator: "StringIContains";
3053
+ /** Reference substring, NA values are skipped */
3054
+ readonly substring: string;
3055
+ }
3056
+ interface SingleValueMatchesPredicate {
3057
+ /** Comparison operator */
3058
+ readonly operator: "Matches";
3059
+ /** Regular expression, NA values are skipped */
3060
+ readonly regex: string;
3061
+ }
3062
+ interface SingleValueStringContainsFuzzyPredicate {
3063
+ /** Comparison operator */
3064
+ readonly operator: "StringContainsFuzzy";
3065
+ /** Reference value, NA values are skipped */
3066
+ readonly reference: string;
3067
+ /**
3068
+ * Integer specifying the upper bound of edit distance between
3069
+ * reference and actual value.
3070
+ * When {@link substitutionsOnly} is not defined or set to false
3071
+ * Levenshtein distance is used (substitutions and indels)
3072
+ * @see https://en.wikipedia.org/wiki/Levenshtein_distance
3073
+ * When {@link substitutionsOnly} is set to true
3074
+ * Hamming distance is used (substitutions only)
3075
+ * @see https://en.wikipedia.org/wiki/Hamming_distance
3076
+ */
3077
+ readonly maxEdits: number;
3078
+ /** Changes the type of edit distance in {@link maxEdits} */
3079
+ readonly substitutionsOnly?: boolean;
3080
+ /**
3081
+ * Some character in {@link reference} that will match any
3082
+ * single character in searched text.
3083
+ */
3084
+ readonly wildcard?: string;
3085
+ }
3086
+ interface SingleValueStringIContainsFuzzyPredicate {
3087
+ /** Comparison operator (case insensitive) */
3088
+ readonly operator: "StringIContainsFuzzy";
3089
+ /** Reference value, NA values are skipped */
3090
+ readonly reference: string;
3091
+ /**
3092
+ * Integer specifying the upper bound of edit distance between
3093
+ * reference and actual value.
3094
+ * When {@link substitutionsOnly} is not defined or set to false
3095
+ * Levenshtein distance is used (substitutions and indels)
3096
+ * @see https://en.wikipedia.org/wiki/Levenshtein_distance
3097
+ * When {@link substitutionsOnly} is set to true
3098
+ * Hamming distance is used (substitutions only)
3099
+ * @see https://en.wikipedia.org/wiki/Hamming_distance
3100
+ */
3101
+ readonly maxEdits: number;
3102
+ /** Changes the type of edit distance in {@link maxEdits} */
3103
+ readonly substitutionsOnly?: boolean;
3104
+ /**
3105
+ * Some character in {@link reference} that will match any
3106
+ * single character in searched text.
3107
+ */
3108
+ readonly wildcard?: string;
3109
+ }
3110
+ interface SingleValueNotPredicateV2 {
3111
+ /** Comparison operator */
3112
+ readonly operator: "Not";
3113
+ /** Operand to negate */
3114
+ readonly operand: SingleValuePredicateV2;
3115
+ }
3116
+ interface SingleValueAndPredicateV2 {
3117
+ /** Comparison operator */
3118
+ readonly operator: "And";
3119
+ /** Operands to combine */
3120
+ readonly operands: SingleValuePredicateV2[];
3121
+ }
3122
+ interface SingleValueOrPredicateV2 {
3123
+ /** Comparison operator */
3124
+ readonly operator: "Or";
3125
+ /** Operands to combine */
3126
+ readonly operands: SingleValuePredicateV2[];
3127
+ }
3128
+ /** Filtering predicate for a single axis or column value */
3129
+ type SingleValuePredicateV2 = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueInSetPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicateV2 | SingleValueAndPredicateV2 | SingleValueOrPredicateV2 | SingleValueIEqualPredicate | SingleValueStringIContainsPredicate | SingleValueStringIContainsFuzzyPredicate;
3130
+ /**
3131
+ * Filter PTable records based on specific axis or column value. If this is an
3132
+ * axis value filter and the axis is part of a partitioning key in some of the
3133
+ * source PColumns, the filter will be pushed down to those columns, so only
3134
+ * specific partitions will be retrieved from the remote storage.
3135
+ * */
3136
+ interface PTableRecordSingleValueFilterV2 {
3137
+ /** Filter type discriminator */
3138
+ readonly type: "bySingleColumnV2";
3139
+ /** Target axis selector to examine values from */
3140
+ readonly column: PTableColumnId;
3141
+ /** Value predicate */
3142
+ readonly predicate: SingleValuePredicateV2;
3143
+ }
3144
+ /** Generic PTable records filter */
3145
+ type PTableRecordFilter = PTableRecordSingleValueFilterV2;
3146
+ /** Sorting parameters for a PTable. */
3147
+ type PTableSorting = {
3148
+ /** Unified column identifier */readonly column: PTableColumnId; /** Sorting order */
3149
+ readonly ascending: boolean; /** Sorting in respect to NA and absent values */
3150
+ readonly naAndAbsentAreLeastValues: boolean;
3151
+ };
3152
+ /** Information required to instantiate a PTable. */
3153
+ interface PTableDef<Col> {
3154
+ /** Join tree to populate the PTable */
3155
+ readonly src: JoinEntry<Col>;
3156
+ /** Partition filters */
3157
+ readonly partitionFilters: PTableRecordFilter[];
3158
+ /** Record filters */
3159
+ readonly filters: PTableRecordFilter[];
3160
+ /** Table sorting */
3161
+ readonly sorting: PTableSorting[];
3162
+ }
3163
+ /** Information required to instantiate a PTable (V2, query-based). */
3164
+ interface PTableDefV2<Col> {
3165
+ /** Pre-built query spec describing joins, filters and sorting */
3166
+ readonly query: SpecQuery<Col>;
3167
+ }
3168
+ /** Request to create and retrieve entirety of data of PTable. */
3169
+ type CalculateTableDataRequest<Col> = {
3170
+ /** Join tree to populate the PTable */readonly src: JoinEntry<Col>; /** Record filters */
3171
+ readonly filters: PTableRecordFilter[]; /** Table sorting */
3172
+ readonly sorting: PTableSorting[];
3173
+ };
3174
+ /** Response for {@link CalculateTableDataRequest} */
3175
+ type CalculateTableDataResponse = FullPTableColumnData[];
3176
+ //#endregion
3177
+ //#region ../../../../lib/model/common/dist/ref.d.ts
3178
+ //#region src/ref.d.ts
3179
+ declare const PlRef: ZodReadonly<ZodObject<{
3180
+ __isRef: ZodLiteral<true>;
3181
+ blockId: ZodString;
3182
+ name: ZodString;
3183
+ requireEnrichments: ZodOptional<ZodLiteral<true>>;
3184
+ }, "strip", ZodTypeAny, {
3185
+ __isRef: true;
3186
+ blockId: string;
3187
+ name: string;
3188
+ requireEnrichments?: true | undefined;
3189
+ }, {
3190
+ __isRef: true;
3191
+ blockId: string;
3192
+ name: string;
3193
+ requireEnrichments?: true | undefined;
3194
+ }>>;
3195
+ type PlRef = TypeOf<typeof PlRef>;
3196
+ /** @deprecated use {@link PlRef} */
3197
+ //#endregion
3198
+ //#region ../../../../lib/model/common/dist/pool/spec.d.ts
3199
+ //#region src/pool/spec.d.ts
3200
+ /** Any object exported into the result pool by the block always have spec attached to it */
3201
+ type PObjectSpec = {
3202
+ /** PObject kind discriminator */readonly kind: string; /** Name is common part of PObject identity */
3203
+ readonly name: string; /** Domain is a set of key-value pairs that can be used to identify the object */
3204
+ readonly domain?: Record<string, string>;
3205
+ /** Context domain provides additional axis/column identity that is matched
3206
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3207
+ readonly contextDomain?: Record<string, string>; /** Additional information attached to the object */
3208
+ readonly annotations?: Record<string, string>;
3209
+ };
3210
+ type LocalPObjectKey = {
3211
+ resolvePath: string[];
3212
+ name: string;
3213
+ };
3214
+ type LocalPObjectId = Branded<CanonicalizedJson<LocalPObjectKey>, "LocalPObjectId">;
3215
+ type GlobalPObjectKey = PlRef;
3216
+ type GlobalPObjectId = Branded<CanonicalizedJson<GlobalPObjectKey>, "GlobalPObjectId">;
3217
+ /** Stable PObject id */
3218
+ type PObjectId = LocalPObjectId | GlobalPObjectId;
3219
+ /**
3220
+ * Full PObject representation.
3221
+ *
3222
+ * @template Data type of the object referencing or describing the "data" part of the PObject
3223
+ * */
3224
+ interface PObject<Data> {
3225
+ /** Fully rendered PObjects are assigned a stable identifier. */
3226
+ readonly id: PObjectId;
3227
+ /** PObject spec, allowing it to be found among other PObjects */
3228
+ readonly spec: PObjectSpec;
3229
+ /** A handle to data object */
3230
+ readonly data: Data;
3231
+ }
3232
+ //#endregion
3233
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/spec.d.ts
3234
+ //#region src/drivers/pframe/spec/spec.d.ts
3235
+ declare const ValueType: {
3236
+ readonly Int: "Int";
3237
+ readonly Long: "Long";
3238
+ readonly Float: "Float";
3239
+ readonly Double: "Double";
3240
+ readonly String: "String";
3241
+ readonly Bytes: "Bytes";
3242
+ };
3243
+ type AxisValueType = Extract<ValueType, "Int" | "Long" | "String">;
3244
+ type ColumnValueType = ValueType;
3245
+ /** PFrame columns and axes within them may store one of these types. */
3246
+ type ValueType = (typeof ValueType)[keyof typeof ValueType];
3247
+ type Metadata = Record<string, string>;
3248
+ declare const Domain: {
3249
+ readonly Alphabet: "pl7.app/alphabet";
3250
+ readonly BlockId: "pl7.app/blockId";
3251
+ readonly VDJ: {
3252
+ readonly Clustering: {
3253
+ readonly BlockId: "pl7.app/vdj/clustering/blockId";
3254
+ };
3255
+ readonly ScClonotypeChain: {
3256
+ readonly Index: "pl7.app/vdj/scClonotypeChain/index";
3257
+ };
3258
+ };
3259
+ };
3260
+ type Domain = Metadata & Partial<{
3261
+ [Domain.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
3262
+ [Domain.BlockId]: string;
3263
+ [Domain.VDJ.ScClonotypeChain.Index]: "primary" | "secondary" | (string & {});
3264
+ }>;
3265
+ /**
3266
+ * Specification of an individual axis.
3267
+ *
3268
+ * Each axis is a part of a composite key that addresses data inside the PColumn.
3269
+ *
3270
+ * Each record inside a PColumn is addressed by a unique tuple of values set for
3271
+ * all the axes specified in the column spec.
3272
+ */
3273
+ type AxisSpec = {
3274
+ /** Type of the axis value. Should not use non-key types like float or double. */readonly type: AxisValueType; /** Name of the axis */
3275
+ readonly name: string;
3276
+ /** Adds auxiliary information to the axis name, type and parents to form a
3277
+ * unique identifier */
3278
+ readonly domain?: Record<string, string>;
3279
+ /** Context domain provides additional axis identity that is matched
3280
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3281
+ readonly contextDomain?: Record<string, string>;
3282
+ /** Any additional information attached to the axis that does not affect its
3283
+ * identifier */
3284
+ readonly annotations?: Record<string, string>;
3285
+ /**
3286
+ * Parent axes provide contextual grouping for the axis in question, establishing
3287
+ * a hierarchy where the current axis is dependent on one or more axes for its
3288
+ * full definition and meaning. For instance, in a data structure where each
3289
+ * "container" axis may contain multiple "item" axes, the `item` axis would
3290
+ * list the index of the `container` axis in this field to denote its dependency.
3291
+ *
3292
+ * This means that the identity or significance of the `item` axis is only
3293
+ * interpretable when combined with its parent `container` axis. An `item` axis
3294
+ * index by itself may be non-unique and only gains uniqueness within the context
3295
+ * of its parent `container`. Therefore, the `parentAxes` field is essential for
3296
+ * mapping these relationships and ensuring data coherence across nested or
3297
+ * multi-level data models.
3298
+ *
3299
+ * A list of zero-based indices of parent axes in the overall axes specification
3300
+ * from the column spec. Each index corresponds to the position of a parent axis
3301
+ * in the list that defines the structure of the data model.
3302
+ */
3303
+ readonly parentAxes?: number[];
3304
+ };
3305
+ /** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
3306
+ /** Common type representing spec for all the axes in a column */
3307
+ type AxesSpec = AxisSpec[];
3308
+ /**
3309
+ * Full column specification including all axes specs and specs of the column
3310
+ * itself.
3311
+ *
3312
+ * A PColumn in its essence represents a mapping from a fixed size, explicitly
3313
+ * typed tuple to an explicitly typed value.
3314
+ *
3315
+ * (axis1Value1, axis2Value1, ...) -> columnValue
3316
+ *
3317
+ * Each element in tuple correspond to the axis having the same index in axesSpec.
3318
+ */
3319
+ type PUniversalColumnSpec = PObjectSpec & {
3320
+ /** Defines specific type of BObject, the most generic type of unit of
3321
+ * information in Platforma Project. */
3322
+ readonly kind: "PColumn"; /** Type of column values */
3323
+ readonly valueType: string; /** Column name */
3324
+ readonly name: string;
3325
+ /** Adds auxiliary information to the axis name, type and parents to form a
3326
+ * unique identifier */
3327
+ readonly domain?: Record<string, string>;
3328
+ /** Context domain provides additional column identity that is matched
3329
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3330
+ readonly contextDomain?: Record<string, string>;
3331
+ /** Any additional information attached to the column that does not affect its
3332
+ * identifier */
3333
+ readonly annotations?: Record<string, string>; /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */
3334
+ readonly parentAxes?: number[]; /** Axes specifications */
3335
+ readonly axesSpec: AxesSpec;
3336
+ };
3337
+ /**
3338
+ * Specification of a data column.
3339
+ *
3340
+ * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)
3341
+ * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex
3342
+ * values like files or other abstract data types. Data columns are optimized for storing and processing
3343
+ * basic tabular data.
3344
+ */
3345
+ type PDataColumnSpec = PUniversalColumnSpec & {
3346
+ /** Type of column values */readonly valueType: ValueType;
3347
+ };
3348
+ type PColumnSpec = PDataColumnSpec;
3349
+ /** Unique PColumnSpec identifier */
3350
+ interface PColumn<Data> extends PObject<Data> {
3351
+ /** PColumn spec, allowing it to be found among other PObjects */
3352
+ readonly spec: PColumnSpec;
3353
+ }
3354
+ /** Columns in a PFrame also have internal identifier, this object represents
3355
+ * combination of specs and such id */
3356
+ interface PColumnIdAndSpec {
3357
+ /** Internal column id within the PFrame */
3358
+ readonly columnId: PObjectId;
3359
+ /** Column spec */
3360
+ readonly spec: PColumnSpec;
3361
+ }
3362
+ /** Get column id and spec from a column */
3363
+ interface AxisId {
3364
+ /** Type of the axis or column value. For an axis should not use non-key
3365
+ * types like float or double. */
3366
+ readonly type: AxisValueType;
3367
+ /** Name of the axis or column */
3368
+ readonly name: string;
3369
+ /** Adds auxiliary information to the axis or column name and type to form a
3370
+ * unique identifier */
3371
+ readonly domain?: Record<string, string>;
3372
+ /** Context domain provides additional axis identity that is matched
3373
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3374
+ readonly contextDomain?: Record<string, string>;
3375
+ }
3376
+ /** Array of axis ids */
3377
+ type AxesId = AxisId[];
3378
+ /** Extracts axis ids from axis spec */
3379
+ //#endregion
3380
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/filtered_column.d.ts
3381
+ //#region src/drivers/pframe/spec/filtered_column.d.ts
3382
+ /** Value of an axis filter */
3383
+ type AxisFilterValue = number | string;
3384
+ /** Axis filter by index */
3385
+ type AxisFilterByIdx = [number, AxisFilterValue];
3386
+ /** Axis filter by name */
3387
+ /**
3388
+ * `source` is either a leaf {@link PObjectId} or a {@link ColumnDiscoveredId}.
3389
+ * Filtered never nests inside Filtered (flat-merge invariant), and Filtered is
3390
+ * never the outer wrapper around Overridden — Overridden is always outermost.
3391
+ */
3392
+ interface ColumnFilteredKey {
3393
+ __isFiltered: true;
3394
+ source: ColumnUniversalId;
3395
+ axisFilters: AxisFilterByIdx[];
3396
+ }
3397
+ type ColumnFilteredId = Branded<CanonicalizedJson<ColumnFilteredKey>, "ColumnFilteredId">;
3398
+ //#endregion
3399
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/ids.d.ts
3400
+ //#region src/drivers/pframe/spec/ids.d.ts
3401
+ /**
3402
+ * Per-axis patches keyed by positional index in the base spec's `axesSpec`.
3403
+ *
3404
+ * Using position rather than `name` lets us disambiguate linker-style specs
3405
+ * that carry multiple axes with the same `name` differentiated by `domain` /
3406
+ * `contextDomain` (e.g. a `group`, `group/primary`, `group/secondary` triple).
3407
+ *
3408
+ * A patch at index `>= base.axesSpec.length` appends a new axis at that slot.
3409
+ */
3410
+ type AxisPatches = Record<number, Partial<AxisSpec>>;
3411
+ /**
3412
+ * Universal column identifier optionally anchored and optionally filtered.
3413
+ * @deprecated use {@link ColumnUniversalKey}
3414
+ */
3415
+ type ColumnUniversalId = LocalPObjectId | GlobalPObjectId | ColumnFilteredId | ColumnDiscoveredId | ColumnOverriddenId;
3416
+ /**
3417
+ * Canonically serializes a column key to a branded string id. Accepts both
3418
+ * the new {@link ColumnUniversalKey} and the deprecated {@link UniversalPColumnId}
3419
+ * (anchored / old filtered object form).
3420
+ */
3421
+ //#endregion
3422
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/discovered_column.d.ts
3423
+ //#region src/drivers/pframe/spec/discovered_column.d.ts
3424
+ interface ColumnDiscoveredKey {
3425
+ __isDiscovered: true;
3426
+ column: ColumnUniversalId;
3427
+ path?: PathItem[];
3428
+ columnQualifications?: AxisQualification[];
3429
+ queriesQualifications?: Record<PObjectId, AxisQualification[]>;
3430
+ }
3431
+ type ColumnDiscoveredId = Branded<CanonicalizedJson<ColumnDiscoveredKey>, "ColumnDiscoveredId">;
3432
+ type PathItem = {
3433
+ type: "linker";
3434
+ column: ColumnUniversalId;
3435
+ };
3436
+ //#endregion
3437
+ //#region ../../../../lib/model/common/dist/drivers/interfaces.d.ts
3438
+ //#region src/drivers/interfaces.d.ts
3439
+ /**
3440
+ * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
3441
+ */
3442
+ interface BlobLike {
3443
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
3444
+ readonly size: number;
3445
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
3446
+ readonly type: string;
3447
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
3448
+ text(): Promise<string>;
3449
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
3450
+ slice(start?: number, end?: number): BlobLike;
3451
+ }
3452
+ /**
3453
+ * Intended to match web.File, node.File, node-fetch.File, etc.
3454
+ */
3455
+ interface FileLike extends BlobLike {
3456
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
3457
+ readonly lastModified: number;
3458
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
3459
+ readonly name: string;
3460
+ } //#endregion
3461
+ //#endregion
3462
+ //#region ../../../../lib/model/common/dist/drivers/blob.d.ts
3463
+ //#region src/drivers/blob.d.ts
3464
+ /** Handle of locally downloaded blob. This handle is issued only after the
3465
+ * blob's content is downloaded locally, and ready for quick access. */
3466
+ type LocalBlobHandle = Branded$1<string, "LocalBlobHandle">;
3467
+ /** Handle of remote blob. This handle is issued as soon as the data becomes
3468
+ * available on the remote server. */
3469
+ type RemoteBlobHandle = Branded$1<string, "RemoteBlobHandle">;
3470
+ /** Being configured inside the output structure provides information about
3471
+ * blob's content and means to retrieve it when needed. */
3472
+ /** Range in bytes, from should be less than to. */
3473
+ declare const RangeBytes: ZodObject<{
3474
+ /** Included left border. */from: ZodNumber; /** Excluded right border. */
3475
+ to: ZodNumber;
3476
+ }, "strip", ZodTypeAny, {
3477
+ from: number;
3478
+ to: number;
3479
+ }, {
3480
+ from: number;
3481
+ to: number;
3482
+ }>;
3483
+ type RangeBytes = TypeOf<typeof RangeBytes>;
3484
+ /** Defines API of blob driver as it is seen from the block UI code. */
3485
+ interface BlobDriver {
3486
+ /**
3487
+ * Given the blob handle returns its content.
3488
+ * Depending on the handle type, content will be served from locally downloaded file,
3489
+ * or directly from remote platforma storage.
3490
+ */
3491
+ getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;
3492
+ }
3493
+ /**
3494
+ * Operational metrics of the blob download driver.
3495
+ */
3496
+ //#endregion
3497
+ //#region ../../../../lib/model/common/dist/drivers/log.d.ts
3498
+ //#region src/drivers/log.d.ts
3499
+ /** Prefix constants — single source of truth for handle format. */
3500
+ declare const LIVE_LOG_PREFIX = "log+live://log/";
3501
+ declare const READY_LOG_PREFIX = "log+ready://log/";
3502
+ /** Handle of the live logs of a program.
3503
+ * The resource that represents a log can be deleted,
3504
+ * in this case the handle should be refreshed. */
3505
+ type LiveLogHandle = Branded$1<`${typeof LIVE_LOG_PREFIX}${string}`, "LiveLogHandle">;
3506
+ /** Handle of the ready logs of a program. */
3507
+ type ReadyLogHandle = Branded$1<`${typeof READY_LOG_PREFIX}${string}`, "ReadyLogHandle">;
3508
+ /** Handle of logs. This handle should be passed
3509
+ * to the driver for retrieving logs. */
3510
+ type AnyLogHandle = LiveLogHandle | ReadyLogHandle;
3511
+ /** Type guard to check if a value is any kind of log handle. */
3512
+ /** Driver to retrieve logs given log handle */
3513
+ interface LogsDriver {
3514
+ lastLines(/** A handle that was issued previously. */
3515
+
3516
+ handle: AnyLogHandle, /** Allows client to limit total data sent from server. */
3517
+
3518
+ lineCount: number,
3519
+ /** Makes streamer to perform seek operation to given offset before sending the contents.
3520
+ * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
3521
+ * If undefined, then starts from the end. */
3522
+
3523
+ offsetBytes?: number,
3524
+ /** Is substring for line search pattern.
3525
+ * This option makes controller to send to the client only lines, that
3526
+ * have given substring. */
3527
+
3528
+ searchStr?: string): Promise<StreamingApiResponse>;
3529
+ readText(/** A handle that was issued previously. */
3530
+
3531
+ handle: AnyLogHandle, /** Allows client to limit total data sent from server. */
3532
+
3533
+ lineCount: number,
3534
+ /** Makes streamer to perform seek operation to given offset before sending the contents.
3535
+ * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
3536
+ * If undefined of 0, then starts from the beginning. */
3537
+
3538
+ offsetBytes?: number,
3539
+ /** Is substring for line search pattern.
3540
+ * This option makes controller to send to the client only lines, that
3541
+ * have given substring. */
3542
+
3543
+ searchStr?: string): Promise<StreamingApiResponse>;
3544
+ }
3545
+ /** Response of the driver.
3546
+ * The caller should give a handle to retrieve it.
3547
+ * It can be OK or outdated, in which case the handle
3548
+ * should be issued again. */
3549
+ type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;
3550
+ type StreamingApiResponseOk = {
3551
+ /** The handle don't have to be updated,
3552
+ * the response is OK. */
3553
+ shouldUpdateHandle: false; /** Whether the log can still grow or it's in a final state. */
3554
+ live: boolean; /** Data of the response, in bytes. */
3555
+ data: Uint8Array; /** Current size of the file. It can grow if it's still live. */
3556
+ size: number; /** Offset in bytes from the beginning of a file. */
3557
+ newOffset: number;
3558
+ };
3559
+ /** The handle should be issued again, this one is done. */
3560
+ type StreamingApiResponseHandleOutdated = {
3561
+ shouldUpdateHandle: true;
3562
+ };
3563
+ //#endregion
3564
+ //#region ../../../../lib/model/common/dist/drivers/pframe/column_filter.d.ts
3565
+ //#region src/drivers/pframe/column_filter.d.ts
3566
+ /** Allows to search multiple columns in different contexts. */
3567
+ interface ColumnFilter {
3568
+ /** Match any of the types listed here. If undefined, will be ignored during
3569
+ * matching. */
3570
+ readonly type?: ValueType[];
3571
+ /** Match any of the names listed here. If undefined, will be ignored during
3572
+ * matching. */
3573
+ readonly name?: string[];
3574
+ /** Match requires all the domains listed here to have corresponding values. */
3575
+ readonly domainValue?: Record<string, string>;
3576
+ /** Match requires all the annotations listed here to have corresponding values. */
3577
+ readonly annotationValue?: Record<string, string>;
3578
+ /** Match requires all the annotations listed here to match corresponding regex
3579
+ * pattern. */
3580
+ readonly annotationPattern?: Record<string, string>;
3581
+ } //#endregion
3582
+ //#endregion
3583
+ //#region ../../../../lib/model/common/dist/drivers/pframe/find_columns.d.ts
3584
+ //#region src/drivers/pframe/find_columns.d.ts
3585
+ /**
3586
+ * Request to search among existing columns in the PFrame. Two filtering
3587
+ * criteria can be used: (1) column ашдеук, to search for columns with
3588
+ * specific properties like name, annotations and domains, and (2) being
3589
+ * compatible with the given list of axis ids.
3590
+ * */
3591
+ interface FindColumnsRequest {
3592
+ /** Basic column filter */
3593
+ readonly columnFilter: ColumnFilter;
3594
+ /** Will only search for columns compatible with these list of axis ids */
3595
+ readonly compatibleWith: AxisId[];
3596
+ /**
3597
+ * Defines what level of compatibility with provided list of axis ids is required.
3598
+ *
3599
+ * If true will search only for such columns which axes completely maps onto the
3600
+ * axes listed in the {@link compatibleWith} list.
3601
+ * */
3602
+ readonly strictlyCompatible: boolean;
3603
+ }
3604
+ /** Response for {@link FindColumnsRequest} */
3605
+ interface FindColumnsResponse {
3606
+ /** Array of column ids found using request criteria. */
3607
+ readonly hits: PColumnIdAndSpec[];
3608
+ } //#endregion
3609
+ //#endregion
3610
+ //#region ../../../../lib/model/common/dist/drivers/pframe/unique_values.d.ts
3611
+ //#region src/drivers/pframe/unique_values.d.ts
3612
+ /** Calculate set of unique values for a specific axis for the filtered set of records */
3613
+ interface UniqueValuesRequest {
3614
+ /** Target axis id */
3615
+ readonly columnId: PObjectId;
3616
+ /** Target axis id, if not specified calculates unique column values */
3617
+ readonly axis?: AxisId;
3618
+ /** Filters to apply before calculating unique values */
3619
+ readonly filters: PTableRecordFilter[];
3620
+ /** Max number of values to return, if reached response will contain overflow flag */
3621
+ readonly limit: number;
3622
+ }
3623
+ interface UniqueValuesResponse {
3624
+ /** Unique values */
3625
+ readonly values: PTableVector;
3626
+ /** True if limit was reached and response contain non-exhaustive list of values. */
3627
+ readonly overflow: boolean;
3628
+ } //#endregion
3629
+ //#endregion
3630
+ //#region ../../../../lib/model/common/dist/drivers/pframe/pframe.d.ts
3631
+ /** Information required to instantiate a PFrame. */
3632
+ type PFrameDef<Col> = Col[]; //#endregion
3633
+ //#endregion
3634
+ //#region ../../../../lib/model/common/dist/drivers/pframe/driver.d.ts
3635
+ //#region src/drivers/pframe/driver.d.ts
3636
+ /** PFrame handle */
3637
+ type PFrameHandle = Branded$1<string, "PFrame">;
3638
+ /** PFrame handle */
3639
+ type PTableHandle = Branded$1<string, "PTable">;
3640
+ /** Model-side PFrame service — creates frames/tables from column definitions. */
3641
+ interface PFrameModelDriver<Col = PColumn<string | PColumnValues | DataInfo<string>>> {
3642
+ createPFrame(def: PFrameDef<Col>): PFrameHandle;
3643
+ createPTable(def: PTableDef<Col>): PTableHandle;
3644
+ createPTableV2(def: PTableDefV2<Col>): PTableHandle;
3645
+ }
3646
+ /** Allows to access main data layer features of platforma */
3647
+ interface PFrameDriver {
3648
+ /**
3649
+ * Finds columns given filtering criteria on column name, annotations etc.
3650
+ * and a set of axes ids to find only columns with compatible specs.
3651
+ * */
3652
+ findColumns(handle: PFrameHandle, request: FindColumnsRequest): Promise<FindColumnsResponse>;
3653
+ /** Retrieve single column spec */
3654
+ getColumnSpec(handle: PFrameHandle, columnId: PObjectId): Promise<PColumnSpec | null>;
3655
+ /** Retrieve information about all columns currently added to the PFrame */
3656
+ listColumns(handle: PFrameHandle): Promise<PColumnIdAndSpec[]>;
3657
+ /** Calculates data for the table and returns complete data representation of it */
3658
+ calculateTableData(handle: PFrameHandle, request: CalculateTableDataRequest<PObjectId>, range?: TableRange): Promise<CalculateTableDataResponse>;
3659
+ /** Calculate set of unique values for a specific axis for the filtered set of records */
3660
+ getUniqueValues(handle: PFrameHandle, request: UniqueValuesRequest): Promise<UniqueValuesResponse>;
3661
+ /** Unified table shape */
3662
+ getShape(handle: PTableHandle): Promise<PTableShape>;
3663
+ /**
3664
+ * Returns ordered array of table axes specs (primary key "columns" in SQL
3665
+ * terms) and data column specs (regular "columns" in SQL terms).
3666
+ *
3667
+ * Data for a specific table column can be retrieved using unified indexing
3668
+ * corresponding to elements in this array.
3669
+ *
3670
+ * Axes are always listed first.
3671
+ * */
3672
+ getSpec(handle: PTableHandle): Promise<PTableColumnSpec[]>;
3673
+ /**
3674
+ * Retrieve the data from the table. To retrieve only data required, it can be
3675
+ * sliced both horizontally ({@link columnIndices}) and vertically
3676
+ * ({@link range}).
3677
+ *
3678
+ * @param columnIndices unified indices of columns to be retrieved
3679
+ * @param range optionally limit the range of records to retrieve
3680
+ * */
3681
+ getData(handle: PTableHandle, columnIndices: number[], range?: TableRange): Promise<PTableVector[]>;
3682
+ /**
3683
+ * Stream the table to a file at the given path. Caller is responsible
3684
+ * for producing the destination path (e.g. via the `Dialog` service).
3685
+ */
3686
+ writePTableToFs(handle: PTableHandle, options: WritePTableToFsOptions): Promise<WritePTableToFsResult>;
3687
+ /**
3688
+ * Export the table to a file. The output format is selected from the file
3689
+ * extension of `options.path` (`csv`, `tsv`, `parquet`, or `xlsx`).
3690
+ *
3691
+ * `options.columnIndices` selects the columns to export (output order). Column
3692
+ * headers are derived on the driver side from each field's label annotation
3693
+ * (falling back to its spec name), so the caller supplies only the path and
3694
+ * the columns.
3695
+ *
3696
+ * For `xlsx` the driver rejects tables whose row count would exceed the
3697
+ * 1,000,000-row per-sheet limit (below Excel's hard cap of 1,048,576).
3698
+ */
3699
+ exportPTable(handle: PTableHandle, options: ExportPTableOptions): Promise<void>;
3700
+ } //#endregion
3701
+ //#endregion
3702
+ //#region ../../../../lib/model/common/dist/drivers/ls.d.ts
3703
+ //#region src/drivers/ls.d.ts
3704
+ type ImportFileHandleUpload = `upload://upload/${string}`;
3705
+ type ImportFileHandleIndex = `index://index/${string}`;
3706
+ type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;
3707
+ type LocalImportFileHandle = Branded$1<ImportFileHandle, "Local">;
3708
+ /** Results in upload */
3709
+ type StorageHandleLocal = `local://${string}`;
3710
+ /** Results in index */
3711
+ type StorageHandleRemote = `remote://${string}`;
3712
+ type StorageHandle = StorageHandleLocal | StorageHandleRemote;
3713
+ type StorageEntry = {
3714
+ /** Stable machine identifier (e.g. "library", "root", "local"). Used for filtering. */id: string; /** Human-readable display name. */
3715
+ name: string;
3716
+ handle: StorageHandle;
3717
+ initialFullPath: string;
3718
+ };
3719
+ type ListFilesResult = {
3720
+ parent?: string;
3721
+ entries: LsEntry[];
3722
+ };
3723
+ type LsEntry = {
3724
+ type: "dir";
3725
+ name: string;
3726
+ fullPath: string;
3727
+ } | {
3728
+ type: "file";
3729
+ name: string;
3730
+ fullPath: string; /** This handle should be set to args... */
3731
+ handle: ImportFileHandle;
3732
+ };
3733
+ type OpenDialogFilter = {
3734
+ /** Human-readable file type name */readonly name: string; /** File extensions */
3735
+ readonly extensions: string[];
3736
+ };
3737
+ type OpenDialogOps = {
3738
+ /** Open dialog window title */readonly title?: string; /** Custom label for the confirmation button, when left empty the default label will be used. */
3739
+ readonly buttonLabel?: string; /** Limits of file types user can select */
3740
+ readonly filters?: OpenDialogFilter[];
3741
+ };
3742
+ type OpenSingleFileResponse = {
3743
+ /** Contains local file handle, allowing file importing or content reading. If user canceled
3744
+ * the dialog, field will be undefined. */
3745
+ readonly file?: LocalImportFileHandle;
3746
+ };
3747
+ type OpenMultipleFilesResponse = {
3748
+ /** Contains local file handles, allowing file importing or content reading. If user canceled
3749
+ * the dialog, field will be undefined. */
3750
+ readonly files?: LocalImportFileHandle[];
3751
+ };
3752
+ /** Can be used to limit request for local file content to a certain bytes range */
3753
+ interface LsDriver {
3754
+ /** remote and local storages */
3755
+ getStorageList(): Promise<StorageEntry[]>;
3756
+ listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;
3757
+ /** Opens system file open dialog allowing to select single file and awaits user action */
3758
+ showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;
3759
+ /** Opens system file open dialog allowing to multiple files and awaits user action */
3760
+ showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;
3761
+ /** Given a handle to a local file, allows to get file size */
3762
+ getLocalFileSize(file: LocalImportFileHandle): Promise<number>;
3763
+ /** Given a handle to a local file, allows to get its content */
3764
+ getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;
3765
+ /**
3766
+ * Resolves browser's File object into platforma's import file handle.
3767
+ *
3768
+ * This method is useful among other things for implementation of UI
3769
+ * components, that handle file Drag&Drop.
3770
+ * */
3771
+ fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;
3772
+ /** Saves currently opened block webview as a PDF. */
3773
+ exportToPdf?(): Promise<void>;
3774
+ }
3775
+ /** Gets a file path from an import handle. */
3776
+ //#endregion
3777
+ //#region ../../../../lib/model/common/dist/columns/column_selector.d.ts
3778
+ //#region src/columns/column_selector.d.ts
3779
+ /** Relaxed string matcher input: plain string, single matcher, or array of mixed. */
3780
+ type RelaxedStringMatchers = string | StringMatcher | (string | StringMatcher)[];
3781
+ /** Relaxed record matcher: values can be plain strings or relaxed matchers. */
3782
+ type RelaxedRecord = Record<string, RelaxedStringMatchers>;
3783
+ /** Relaxed axis selector — accepts plain strings where strict requires StringMatcher[]. */
3784
+ interface RelaxedAxisSelector {
3785
+ name?: RelaxedStringMatchers;
3786
+ type?: AxisValueType | AxisValueType[];
3787
+ domain?: RelaxedRecord;
3788
+ contextDomain?: RelaxedRecord;
3789
+ annotations?: RelaxedRecord;
3790
+ }
3791
+ /** Relaxed column selector — convenient hand-written form. */
3792
+ interface RelaxedColumnSelector {
3793
+ name?: RelaxedStringMatchers;
3794
+ type?: ColumnValueType | ColumnValueType[];
3795
+ domain?: RelaxedRecord;
3796
+ contextDomain?: RelaxedRecord;
3797
+ annotations?: RelaxedRecord;
3798
+ axes?: RelaxedAxisSelector[];
3799
+ partialAxesMatch?: boolean;
3800
+ }
3801
+ /** One or many relaxed column selectors; normalizes to MultiColumnSelector[]. */
3802
+ type ColumnSelector = RelaxedColumnSelector | RelaxedColumnSelector[];
3803
+ //#endregion
3804
+ //#region ../../../../lib/model/common/dist/drivers/columns/discover_columns_options.d.ts
3805
+ //#region src/drivers/columns/discover_columns_options.d.ts
3806
+ /**
3807
+ * Axis matching behaviour applied to `discover` requests.
3808
+ *
3809
+ * - `enrichment` (default) — anchor axes may float over un-mapped hit axes;
3810
+ * used by tooling that "extends" a query.
3811
+ * - `related` — both source and hit axes may float; widest match.
3812
+ * - `exact` — no floating, no qualifications; strict equality.
3813
+ */
3814
+ type MatchingMode = "enrichment" | "related" | "exact";
3815
+ /**
3816
+ * Single entry accepted by `DiscoverColumnsOptions.anchors`. All variants are
3817
+ * trivially JSON-serialisable so the option carrier crosses the
3818
+ * sandbox/host VM bridge unchanged.
3819
+ */
3820
+ type AnchorEntry = PlRef | PObjectId | PColumnSpec | RelaxedColumnSelector;
3821
+ /** Qualifications needed for both already-integrated anchor columns and the hit column. */
3822
+ /**
3823
+ * Options object accepted by sandbox `discoverColumns()` and by the host
3824
+ * `ColumnsCollectionDriver.discover` / `.filter` methods. Pure JSON shape —
3825
+ * no class instances, no closures.
3826
+ */
3827
+ interface DiscoverColumnsOptions {
3828
+ /** Include columns matching these selectors. If omitted, includes all. */
3829
+ include?: ColumnSelector;
3830
+ /** Exclude columns matching these selectors. */
3831
+ exclude?: ColumnSelector;
3832
+ /** Axis matching behavior. Default: 'enrichment'. Ignored if no anchors. */
3833
+ mode?: MatchingMode;
3834
+ /** Anchors enable axis-aware discovery + linker traversal. */
3835
+ anchors?: Record<string, AnchorEntry>;
3836
+ /** Maximum linker hops. Default: 4 when anchors present, 0 otherwise. */
3837
+ maxHops?: number;
3838
+ }
3839
+ /**
3840
+ * Options accepted by `ColumnsCollection.discover` / driver `.discover`.
3841
+ * Traversal scope (`mode`, `maxHops`) must be specified explicitly — the
3842
+ * defaults from {@link DiscoverColumnsOptions} are intentionally surfaced as
3843
+ * required choices at the discovery entrypoint.
3844
+ */
3845
+ type ColumnsDiscoverOptions = DiscoverColumnsOptions;
3846
+ /**
3847
+ * Options accepted by `ColumnsCollection.filter` / driver `.filter`. Traversal
3848
+ * scope is fixed by the source collection, so `mode` / `maxHops` are not part
3849
+ * of the filter surface — only `include` / `exclude` / `anchors`.
3850
+ */
3851
+ type ColumnsFilterOptions = Omit<DiscoverColumnsOptions, "mode" | "maxHops">;
3852
+ /** Translate a {@link MatchingMode} into the boolean-flag form the spec driver consumes. */
3853
+ //#endregion
3854
+ //#region ../../../../lib/model/common/dist/columns/types.d.ts
3855
+ //#region src/columns/types.d.ts
3856
+ /**
3857
+ * Opaque sandbox/host accessor handle.
3858
+ *
3859
+ * Both the sandbox `TreeNodeAccessor.handle` and the host-issued accessor
3860
+ * keys alias this brand — `sdk/model` re-exports the same type so the two
3861
+ * sides stay structurally identical.
3862
+ */
3863
+ type AccessorHandle = Branded$1<string, "AccessorHandle">;
3864
+ /**
3865
+ * Structural subset of {@link FieldTraversalStep} (from `@platforma-sdk/model`)
3866
+ * needed by the host/sandbox column-providers traversal.
3867
+ *
3868
+ * Defined locally so this module does not depend on the sandbox `render`
3869
+ * subtree. Both `TreeNodeAccessor.traverse` (sandbox) and
3870
+ * `PlTreeNodeAccessor.traverse` (host) accept a superset of these fields, so
3871
+ * structural compatibility is preserved.
3872
+ */
3873
+ interface FieldTraversalStepLike {
3874
+ /** Field name */
3875
+ readonly field: string;
3876
+ /** Asserted field type — used by `accessor.traverse` to validate. */
3877
+ readonly assertFieldType?: "Input" | "Output" | "Service" | "OTW" | "Dynamic" | "MTW";
3878
+ /** Don't terminate chain if current resource or field has an error associated. */
3879
+ readonly ignoreError?: true;
3880
+ }
3881
+ /**
3882
+ * Raw entry returned by {@link GlobalCfgRenderCtxMethods.getUpstreamBlockCtx}
3883
+ * on the sandbox side, or by `collectUpstreamBlockCtx` on the host side.
3884
+ * Carries handle ids only — providers wrap them into accessor instances as
3885
+ * needed.
3886
+ *
3887
+ * Generic over the handle type so the same shape backs both:
3888
+ * - sandbox (`AHandle = AccessorHandle`, a `Branded<string, "AccessorHandle">`)
3889
+ * - host (`AHandle = PlTreeNodeAccessor`, the resolved accessor instance)
3890
+ *
3891
+ * Default `AHandle = string` since `AccessorHandle` is a brand on `string` —
3892
+ * the default is safe for the sandbox case.
3893
+ */
3894
+ interface UpstreamBlockCtx<AHandle = string> {
3895
+ blockId: string;
3896
+ prodCtx?: AHandle;
3897
+ stagingCtx?: AHandle;
3898
+ /** True when the `prodCtx` ctx-holder exists but `prodUiCtx` is still rendering. */
3899
+ prodIncomplete?: boolean;
3900
+ /** True when the `stagingCtx` ctx-holder exists but `stagingUiCtx` is still rendering. */
3901
+ stagingIncomplete?: boolean;
3902
+ }
3903
+ /**
3904
+ * Minimal accessor surface used by column-providers / column-registry
3905
+ * traversal.
3906
+ *
3907
+ * Both sandbox `TreeNodeAccessor` and host `PlTreeNodeAccessor` satisfy this
3908
+ * contract directly — `traverse(step)` is defined on both, and the other
3909
+ * members already match by shape. No `resolvePath` member: when canonical
3910
+ * `PObjectId`s are required (local-id construction inside the
3911
+ * outputs/prerun branch), the traversal helpers thread the path explicitly.
3912
+ */
3913
+ interface AccessorLike<Self extends AccessorLike<Self>> {
3914
+ /** Resource type carried by the underlying node (only `.name` is used). */
3915
+ readonly resourceType: {
3916
+ readonly name: string;
3917
+ };
3918
+ /**
3919
+ * Single-step field traversal. Returns `undefined` when the field is
3920
+ * absent / unresolved (with `ignoreError`). Same shape on sandbox and host —
3921
+ * sandbox `TreeNodeAccessor.traverse` is an alias for `resolveAny` and host
3922
+ * `PlTreeNodeAccessor.traverse` is the canonical method.
3923
+ */
3924
+ traverse(step: FieldTraversalStepLike): Self | undefined;
3925
+ /** List input-field names on this node. */
3926
+ listInputFields(): string[];
3927
+ /** Whether the input-field collection on this node is finalized. */
3928
+ getInputsLocked(): boolean;
3929
+ /** Whether this node has a data payload attached. */
3930
+ hasData(): boolean;
3931
+ /** Decode the data payload as JSON. Returns `undefined` if no data. */
3932
+ getDataAsJson<T = unknown>(): T | undefined;
3933
+ }
3934
+ /**
3935
+ * One indexed column — the canonical record produced by every traversal.
3936
+ * Carries everything needed to read spec/data/status under a stable id.
3937
+ *
3938
+ * Generic over the accessor flavour so the same record shape works for both
3939
+ * the sandbox `TreeNodeAccessor` and the host `PlTreeNodeAccessor`.
3940
+ */
3941
+ //#endregion
3942
+ //#region ../../../../lib/model/common/dist/drivers/columns/columns_collection_driver.d.ts
3943
+ //#region src/drivers/columns/columns_collection_driver.d.ts
3944
+ /**
3945
+ * Opaque host-owned handle for a `ColumnsCollection` instance. Issued by
3946
+ * {@link ColumnsCollectionDriver.create}, refcounted by the driver, and
3947
+ * pinned to the active render ctx via the VM injector — sandbox never
3948
+ * sees raw refcounting.
3949
+ */
3950
+ type CollectionHandle = Branded$1<string, "CollectionHandle">;
3951
+ /**
3952
+ * JSON descriptor crossing the VM bridge in place of a sandbox
3953
+ * `ColumnsSource`. Always plain data — no closures, no class instances.
3954
+ *
3955
+ * - `"collection"` – reference another driver-managed collection by handle
3956
+ * (chaining, splicing).
3957
+ * - `"result_pool"` – fan-out into the host's current render ctx upstream
3958
+ * block ctxes. Carries no payload — the host always uses its own pool.
3959
+ * - `"accessor"` – walk the host tree starting at the given accessor
3960
+ * handle from a `path` prefix.
3961
+ * - `"ids"` – pre-resolved id list (sandbox-materialised provider).
3962
+ */
3963
+ type SerializedColumnsSource = {
3964
+ readonly kind: "collection";
3965
+ readonly handle: CollectionHandle;
3966
+ } | {
3967
+ readonly kind: "result_pool";
3968
+ } | {
3969
+ readonly kind: "accessor";
3970
+ readonly accessor: AccessorHandle;
3971
+ readonly path: string[];
3972
+ } | {
3973
+ readonly kind: "ids";
3974
+ readonly ids: ColumnUniversalId[];
3975
+ readonly isFinal: boolean;
3976
+ };
3977
+ /**
3978
+ * Per-call host bindings the driver needs to resolve sources whose
3979
+ * shape references render-ctx state (`"accessor"`, `"result_pool"`).
3980
+ *
3981
+ * The VM injector inside `pl-middle-layer` supplies these on every call;
3982
+ * UI-side direct callers that only build collections out of `"ids"` /
3983
+ * `"collection"` sources may omit the bindings entirely.
3984
+ *
3985
+ * Parameterised on the concrete accessor flavour so host implementations
3986
+ * keep their static types (e.g. `PlTreeNodeAccessor`) without leaking that
3987
+ * dependency into `@milaboratories/pl-model-common`.
3988
+ */
3989
+ interface ColumnsCollectionDriverHost<A extends AccessorLike<A> = AccessorLike<any>> {
3990
+ /** Resolve an {@link AccessorHandle} to the host's concrete accessor. */
3991
+ resolveAccessor(handle: AccessorHandle): A;
3992
+ /** Snapshot of upstream-block ctx pairs from the current render ctx. */
3993
+ getUpstreamBlockCtxes(): ReadonlyArray<UpstreamBlockCtx<A>>;
3994
+ /**
3995
+ * Per-call spec driver. The injector supplies the active render ctx's
3996
+ * `PFrameSpec` service; `discover` / `filter` use it to build a spec
3997
+ * frame and run a single discovery query.
3998
+ */
3999
+ getSpecDriver(): PFrameSpecDriver;
4000
+ /**
4001
+ * Resolve the canonical {@link PColumnSpec} for a leaf {@link PObjectId}.
4002
+ * Returns `undefined` when the id is not present in the active registry
4003
+ * (e.g. handed to the driver via a `{kind:"ids"}` source whose underlying
4004
+ * column has since left the visible scope). Override-wrapped ids are
4005
+ * unwrapped by the caller — this method only resolves the underlying leaf.
4006
+ */
4007
+ resolveSpec(id: PObjectId): PColumnSpec | undefined;
4008
+ }
4009
+ /**
4010
+ * Sandbox / UI view of the `ColumnsCollection` driver. Same methods as
4011
+ * {@link ColumnsCollectionDriver}, but the `host` parameters are dropped —
4012
+ * the VM bridge / UI wrapper supplies them on every call so callers only
4013
+ * pass plain data (handles + source descriptors + option objects).
4014
+ *
4015
+ * `getService("columnsCollection")` returns a value of this shape on both
4016
+ * sandbox and UI sides.
4017
+ */
4018
+ interface ColumnsCollectionDriverModel {
4019
+ /** Build a fresh collection from the supplied source descriptors. */
4020
+ create(sources: ReadonlyArray<SerializedColumnsSource>): CollectionHandle;
4021
+ /** Whether the collection currently exposes zero columns. */
4022
+ isEmpty(handle: CollectionHandle): boolean;
4023
+ /** Whether enumeration is finalised across every contributing source. */
4024
+ isFinal(handle: CollectionHandle): boolean;
4025
+ /** Canonical id list for the columns visible through this collection. */
4026
+ getColumns(handle: CollectionHandle): ColumnUniversalId[];
4027
+ /** Append one or more sources and return a fresh collection handle. */
4028
+ addSource(handle: CollectionHandle, sources: ReadonlyArray<SerializedColumnsSource>): CollectionHandle;
4029
+ /** Anchored/selector-driven discovery. Returns a fresh handle. */
4030
+ discover(handle: CollectionHandle, options: ColumnsDiscoverOptions): CollectionHandle;
4031
+ /** Selector-only filter (no anchor traversal). Returns a fresh handle. */
4032
+ filter(handle: CollectionHandle, options: ColumnsFilterOptions): CollectionHandle;
4033
+ }
4034
+ /**
4035
+ * Synchronous host-side driver for `ColumnsCollection` operations. All
4036
+ * collection state lives on the host side, addressable through opaque
4037
+ * {@link CollectionHandle}s. Every handle-minting method returns a
4038
+ * {@link PoolEntry} so callers can wire the refcount into their own
4039
+ * lifecycle; the VM bridge pins each entry to the active render ctx and
4040
+ * forwards only the handle string to sandbox.
4041
+ *
4042
+ * Sandbox / UI callers consume {@link ColumnsCollectionDriverModel}
4043
+ * instead; the bridge maps that surface onto this one by injecting
4044
+ * {@link ColumnsCollectionDriverHost} bindings.
4045
+ */
4046
+ interface ColumnsCollectionDriver {
4047
+ create(sources: ReadonlyArray<SerializedColumnsSource>, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4048
+ isEmpty(handle: CollectionHandle): boolean;
4049
+ isFinal(handle: CollectionHandle): boolean;
4050
+ getColumns(handle: CollectionHandle, host: ColumnsCollectionDriverHost): ColumnUniversalId[];
4051
+ addSource(handle: CollectionHandle, sources: ReadonlyArray<SerializedColumnsSource>, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4052
+ discover(handle: CollectionHandle, options: ColumnsDiscoverOptions, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4053
+ filter(handle: CollectionHandle, options: ColumnsFilterOptions, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4054
+ } //#endregion
4055
+ //#endregion
4056
+ //#region ../../../../lib/model/common/dist/services/service_types.d.ts
4057
+ //#region src/services/service_types.d.ts
4058
+ type ServiceTypesLike<Model = unknown, Ui = unknown, Kind extends ServiceType = ServiceType, ModelHost = Model, UiHost = Ui> = {
4059
+ readonly __types?: {
4060
+ model: Model;
4061
+ ui: Ui;
4062
+ kind: Kind;
4063
+ modelHost: ModelHost;
4064
+ uiHost: UiHost;
4065
+ };
4066
+ };
4067
+ type InferServiceUi<S extends ServiceTypesLike> = S extends ServiceTypesLike<unknown, infer U, ServiceType, unknown, unknown> ? U : unknown;
4068
+ type ServiceName<S extends ServiceTypesLike = ServiceTypesLike> = Branded$1<string, S>;
4069
+ type ServiceType = "node" | "wasm" | "main";
4070
+ type ServiceBrand<T> = T extends Branded$1<string, infer S extends ServiceTypesLike> ? S : never;
4071
+ /** Contract between any service provider and any service consumer. */
4072
+ interface ServiceDispatch {
4073
+ getServiceNames(): ServiceName[];
4074
+ getServiceMethods(serviceId: ServiceName): string[];
4075
+ callServiceMethod(serviceId: ServiceName, method: string, ...args: unknown[]): unknown;
4076
+ }
4077
+ type TServices = typeof Services;
4078
+ type ExtractServiceName<T> = T extends Branded$1<infer N extends string, any> ? N : never;
4079
+ /** Model-side service interfaces keyed by service name literal. */
4080
+ /** UI-side service interfaces keyed by service name literal. */
4081
+ type UiServices$1 = { [K in keyof TServices as ExtractServiceName<TServices[K]>]: InferServiceUi<ServiceBrand<TServices[K]>> };
4082
+ /** Map from Services keys to their unbranded string name literals. */
4083
+ type ServiceNameLiterals = { [K in keyof TServices]: ExtractServiceName<TServices[K]> };
4084
+ /** Auto-derived requires* feature flags from Services keys. */
4085
+ type ServiceRequireFlags = { [K in keyof TServices as `requires${K & string}`]?: boolean };
4086
+ //#endregion
4087
+ //#region ../../../../lib/model/common/dist/services/service_declarations.d.ts
4088
+ //#region src/services/service_declarations.d.ts
4089
+ declare const Services: {
4090
+ PFrameSpec: Branded$1<"pframeSpec", ServiceTypesLike<PFrameSpecDriver, PFrameSpecDriver, "wasm", PFrameSpecDriver, PFrameSpecDriver>>;
4091
+ PFrame: Branded$1<"pframe", ServiceTypesLike<PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver, "node", PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver>>;
4092
+ Dialog: Branded$1<"dialog", ServiceTypesLike<Record<string, never>, DialogService, "main", Record<string, never>, DialogService>>;
4093
+ ColumnsCollection: Branded$1<"columnsCollection", ServiceTypesLike<ColumnsCollectionDriverModel, ColumnsCollectionDriverModel, "wasm", ColumnsCollectionDriver, ColumnsCollectionDriver>>;
4094
+ }; //#endregion
4095
+ //#endregion
4096
+ //#region ../../../../lib/model/common/dist/flags/block_flags.d.ts
4097
+ /**
4098
+ * Known block flags. Flags are set during model compilation, see `BlockModel.create` for more details and for initial values.
4099
+ */
4100
+ type BlockCodeKnownFeatureFlags = {
4101
+ readonly supportsLazyState?: boolean;
4102
+ readonly supportsPframeQueryRanking?: boolean;
4103
+ readonly requiresModelAPIVersion?: number;
4104
+ readonly requiresUIAPIVersion?: number;
4105
+ readonly requiresCreatePTable?: number;
4106
+ readonly requiresPFramesVersion?: number;
4107
+ } & ServiceRequireFlags;
4108
+ /**
4109
+ * Required PFrames version. Bump this in lockstep with the `@milaboratories/pframes-rs-*`
4110
+ * version in `pnpm-workspace.yaml` so blocks built against the new SDK refuse to load on
4111
+ * older desktop apps.
4112
+ */
4113
+ //#endregion
4114
+ //#region ../../../../lib/model/common/dist/driver_kit.d.ts
4115
+ //#region src/driver_kit.d.ts
4116
+ /** Set of all drivers exposed in UI SDK via the platforma object. */
4117
+ interface DriverKit {
4118
+ /** Driver allowing to retrieve blob data */
4119
+ readonly blobDriver: BlobDriver;
4120
+ /** Driver allowing to dynamically work with logs */
4121
+ readonly logDriver: LogsDriver;
4122
+ /**
4123
+ * Driver allowing to list local and remote files that current user has
4124
+ * access to.
4125
+ *
4126
+ * Along with file listing this driver provides import handles for listed
4127
+ * files, that can be communicated to the workflow via block arguments,
4128
+ * converted into blobs using standard workflow library functions.
4129
+ * */
4130
+ readonly lsDriver: LsDriver;
4131
+ /** Driver allowing to interact with PFrames and PTables */
4132
+ readonly pFrameDriver: PFrameDriver;
4133
+ } //#endregion
4134
+ //#endregion
4135
+ //#region ../../../../lib/model/common/dist/errors.d.ts
4136
+ type ResultOrError<S, F = Error> = {
4137
+ value: S;
4138
+ error?: undefined;
4139
+ } | {
4140
+ error: F;
4141
+ };
4142
+ //#endregion
4143
+ //#region ../../../../lib/model/common/dist/utag.d.ts
4144
+ //#region src/utag.d.ts
4145
+ /** Value returned for changing states supporting reactive listening for changes */
4146
+ interface ValueWithUTag<V> {
4147
+ /** Value snapshot. */
4148
+ readonly value: V;
4149
+ /**
4150
+ * Unique tag for the value snapshot.
4151
+ *
4152
+ * It can be used to synchronously detect if changes happened after current
4153
+ * snapshot was retrieved, or asynchronously await next value snapshot,
4154
+ * generated on underlying data changes.
4155
+ * */
4156
+ readonly uTag: string;
4157
+ }
4158
+ interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
4159
+ readonly author?: AuthorMarker;
4160
+ } //#endregion
4161
+ //#endregion
4162
+ //#region ../../../../sdk/model/dist/block_state_patch.d.ts
4163
+ //#region src/block_state_patch.d.ts
4164
+ /** Patch for the structural object */
4165
+ type Patch<K, V> = {
4166
+ /** Field name to patch */readonly key: K; /** New value for the field */
4167
+ readonly value: V;
4168
+ };
4169
+ /** Creates union type of all possible shallow patches for the given structure */
4170
+ type Unionize<T extends Record<string, unknown>> = { [K in keyof T]: Patch<K, T[K]> }[keyof T];
4171
+ /** Patch for the BlockState, pushed by onStateUpdates method in SDK. */
4172
+ type BlockStatePatch<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> = Unionize<BlockState<Args, Outputs, UiState, Href>>; //#endregion
4173
+ //#endregion
4174
+ //#region ../../../../sdk/model/dist/plugin_handle.d.ts
4175
+ //#region src/plugin_handle.d.ts
4176
+ /**
4177
+ * Phantom-only base type for constraining PluginHandle's type parameter.
4178
+ *
4179
+ * PluginFactory has create() → PluginInstance with function properties, making it invariant
4180
+ * under strictFunctionTypes. PluginFactoryLike exposes only the covariant `__types` phantom,
4181
+ * avoiding the contravariance chain. Handles only need `__types` for type extraction.
4182
+ *
4183
+ * PluginFactory extends PluginFactoryLike, so every concrete factory satisfies this constraint.
4184
+ */
4185
+ interface PluginFactoryLike<Data extends Record<string, unknown> = Record<string, unknown>, Params extends undefined | Record<string, unknown> = undefined | Record<string, unknown>, Outputs extends Record<string, unknown> = Record<string, unknown>, ModelServices = unknown, UiServices = unknown> {
4186
+ readonly __types?: {
4187
+ data: Data;
4188
+ params: Params;
4189
+ outputs: Outputs;
4190
+ modelServices: ModelServices;
4191
+ uiServices: UiServices;
4192
+ };
4193
+ }
4194
+ /** Extract the Data type from a PluginFactoryLike phantom. */
4195
+ /**
4196
+ * Opaque handle for a plugin instance. Runtime value is the plugin instance ID string.
4197
+ * Branded with factory phantom `F` for type-safe data/outputs extraction.
4198
+ * Constrained with PluginFactoryLike (not PluginFactory) to avoid variance issues.
4199
+ */
4200
+ type PluginHandle<F extends PluginFactoryLike = PluginFactoryLike> = Branded<string, F>;
4201
+ /** Construct the output key for a plugin output in the block outputs map. */
4202
+ //#endregion
4203
+ //#region ../../../../sdk/model/dist/block_storage.d.ts
4204
+ /** Payload for storage mutation operations. SDK defines specific operations. */
4205
+ type MutateStoragePayload<T = unknown> = {
4206
+ operation: "update-block-data";
4207
+ value: T;
4208
+ } | {
4209
+ operation: "update-plugin-data";
4210
+ pluginId: PluginHandle;
4211
+ value: unknown;
4212
+ };
4213
+ /**
4214
+ * Updates the data in BlockStorage (immutable)
4215
+ *
4216
+ * @param storage - The current BlockStorage
4217
+ * @param payload - The update payload with operation and value
4218
+ * @returns A new BlockStorage with updated data
4219
+ */
4220
+ //#endregion
4221
+ //#region ../../../../sdk/model/dist/bconfig/lambdas.d.ts
4222
+ /** Additional information that may alter lambda rendering procedure. */
4223
+ type ConfigRenderLambdaFlags = {
4224
+ /**
4225
+ * Tells the system that corresponding computable should be created with StableOnlyRetentive rendering mode.
4226
+ * This flag can be overridden by the system.
4227
+ * */
4228
+ retentive?: boolean;
4229
+ /**
4230
+ * Tells the system that resulting computable has important side-effects, thus it's rendering is required even
4231
+ * nobody is actively monitoring rendered values. Like file upload progress, that triggers upload itself.
4232
+ * */
4233
+ isActive?: boolean;
4234
+ /**
4235
+ * If true, result will be wrapped with additional status information,
4236
+ * such as stability status and explicit error
4237
+ */
4238
+ withStatus?: boolean;
4239
+ };
4240
+ /** Creates branded Cfg type */
4241
+ interface ConfigRenderLambda<Return = unknown> extends ConfigRenderLambdaFlags {
4242
+ /** Type marker */
4243
+ __renderLambda: true;
4244
+ /** Phantom property for type inference. Never set at runtime. */
4245
+ __phantomReturn?: Return;
4246
+ /** Reference to a callback registered inside the model code. */
4247
+ handle: string;
4248
+ }
4249
+ type ExtractFunctionHandleReturn<Func extends ConfigRenderLambda> = Func extends ConfigRenderLambda<infer Return> ? Return : never;
4250
+ /** Infers the output type from a TypedConfig or ConfigRenderLambda */
4251
+ /** Maps lambda-only outputs configuration to inferred output types (for V3 blocks) */
4252
+ type InferOutputsFromLambdas<OutputsCfg extends Record<string, ConfigRenderLambda>> = { [Key in keyof OutputsCfg]: OutputWithStatus<ExtractFunctionHandleReturn<OutputsCfg[Key]>> & {
4253
+ __unwrap: OutputsCfg[Key] extends {
4254
+ withStatus: true;
4255
+ } ? false : true;
4256
+ } }; //#endregion
4257
+ //#endregion
4258
+ //#region ../../../../sdk/model/dist/block_api_v1.d.ts
4259
+ //#region src/block_api_v1.d.ts
4260
+ /** Returned by state subscription methods to be able to cancel the subscription. */
4261
+ type CancelSubscription = () => void;
4262
+ /** Defines methods to read and write current block data. */
4263
+ interface BlockApiV1<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> {
4264
+ /**
4265
+ * Use this method to retrieve block state during UI initialization. Then use
4266
+ * {@link onStateUpdates} method to subscribe for updates.
4267
+ * */
4268
+ loadBlockState(): Promise<BlockState<Args, Outputs, UiState, Href>>;
4269
+ /**
4270
+ * Subscribe to updates of block state.
4271
+ *
4272
+ * This method internally have several ways to limit the rate at which new
4273
+ * states are pushed to the corresponding callback. Among other rate limiting
4274
+ * approaches it guarantees that new state will never be pushed to the
4275
+ * supplied async callback until the previous call returns.
4276
+ *
4277
+ * It is a good idea to develop the callback in such a way that it will wait
4278
+ * until the given state propagates all the way to the DOM. See for example
4279
+ * nextTick() method from Vue framework to achieve this.
4280
+ *
4281
+ * This method will only push args and uiState patches if changes were made
4282
+ * externally, i.e. by another user editing the same block.
4283
+ *
4284
+ * @return function that cancels created subscription
4285
+ * */
4286
+ onStateUpdates(cb: (updates: BlockStatePatch<Args, Outputs, UiState, Href>[]) => Promise<void>): CancelSubscription;
4287
+ /**
4288
+ * Sets block args.
4289
+ *
4290
+ * This method returns when corresponding arguments are safely saved so in
4291
+ * case the window is closed there will be no information losses. This
4292
+ * function under the hood may delay actual persistence of the supplied
4293
+ * arguments.
4294
+ * */
4295
+ setBlockArgs(args: Args): Promise<void>;
4296
+ /**
4297
+ * Sets block ui state.
4298
+ *
4299
+ * This method returns when corresponding arguments are safely saved so in
4300
+ * case the window is closed there will be no information losses. This
4301
+ * function under the hood may delay actual persistence of the supplied
4302
+ * values.
4303
+ * */
4304
+ setBlockUiState(state: UiState): Promise<void>;
4305
+ /**
4306
+ * Sets block args and ui state.
4307
+ *
4308
+ * This method returns when corresponding arguments are safely saved so in
4309
+ * case the window is closed there will be no information losses. This
4310
+ * function under the hood may delay actual persistence of the supplied
4311
+ * values.
4312
+ * */
4313
+ setBlockArgsAndUiState(args: Args, state: UiState): Promise<void>;
4314
+ /**
4315
+ * Sets block navigation state.
4316
+ * */
4317
+ setNavigationState(state: NavigationState<Href>): Promise<void>;
4318
+ } //#endregion
4319
+ //#endregion
4320
+ //#region ../../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.d.ts
4321
+ declare type Operation = AddOperation<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;
4322
+ interface BaseOperation {
4323
+ path: string;
4324
+ }
4325
+ interface AddOperation<T> extends BaseOperation {
4326
+ op: 'add';
4327
+ value: T;
4328
+ }
4329
+ interface RemoveOperation extends BaseOperation {
4330
+ op: 'remove';
4331
+ }
4332
+ interface ReplaceOperation<T> extends BaseOperation {
4333
+ op: 'replace';
4334
+ value: T;
4335
+ }
4336
+ interface MoveOperation extends BaseOperation {
4337
+ op: 'move';
4338
+ from: string;
4339
+ }
4340
+ interface CopyOperation extends BaseOperation {
4341
+ op: 'copy';
4342
+ from: string;
4343
+ }
4344
+ interface TestOperation<T> extends BaseOperation {
4345
+ op: 'test';
4346
+ value: T;
4347
+ }
4348
+ interface GetOperation<T> extends BaseOperation {
4349
+ op: '_get';
4350
+ value: T;
4351
+ }
4352
+ //#endregion
4353
+ //#region ../../../../sdk/model/dist/block_api_v2.d.ts
4354
+ //#region src/block_api_v2.d.ts
4355
+ /** Defines methods to read and write current block data. */
4356
+ interface BlockApiV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> {
4357
+ /**
4358
+ * Use this method to retrieve block state during UI initialization. Then use
4359
+ * {@link onStateUpdates} method to subscribe for updates.
4360
+ * */
4361
+ loadBlockState(): Promise<ResultOrError<ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>>>;
4362
+ /**
4363
+ * Get all json patches (rfc6902) that were applied to the block state.
4364
+ * */
4365
+ getPatches(uTag: string): Promise<ResultOrError<ValueWithUTagAndAuthor<Operation[]>>>;
4366
+ /**
4367
+ * Sets block args.
4368
+ *
4369
+ * This method returns when corresponding arguments are safely saved so in
4370
+ * case the window is closed there will be no information losses. This
4371
+ * function under the hood may delay actual persistence of the supplied
4372
+ * arguments.
4373
+ * */
4374
+ setBlockArgs(args: Args, author?: AuthorMarker): Promise<ResultOrError<void>>;
4375
+ /**
4376
+ * Sets block ui state.
4377
+ *
4378
+ * This method returns when corresponding arguments are safely saved so in
4379
+ * case the window is closed there will be no information losses. This
4380
+ * function under the hood may delay actual persistence of the supplied
4381
+ * values.
4382
+ * */
4383
+ setBlockUiState(state: UiState, author?: AuthorMarker): Promise<ResultOrError<void>>;
4384
+ /**
4385
+ * Sets block args and ui state.
4386
+ *
4387
+ * This method returns when corresponding arguments are safely saved so in
4388
+ * case the window is closed there will be no information losses. This
4389
+ * function under the hood may delay actual persistence of the supplied
4390
+ * values.
4391
+ * */
4392
+ setBlockArgsAndUiState(args: Args, state: UiState, author?: AuthorMarker): Promise<ResultOrError<void>>;
4393
+ /**
4394
+ * Sets block navigation state.
4395
+ * */
4396
+ setNavigationState(state: NavigationState<Href>): Promise<ResultOrError<void>>;
4397
+ /**
4398
+ * Disposes the block API.
4399
+ * */
4400
+ dispose(): Promise<ResultOrError<void>>;
4401
+ } //#endregion
4402
+ //#endregion
4403
+ //#region ../../../../sdk/model/dist/version.d.ts
4404
+ type SdkInfo = {
4405
+ readonly sdkVersion: string;
4406
+ };
4407
+ //#endregion
4408
+ //#region ../../../../sdk/model/dist/services/block_services.d.ts
4409
+ //#region src/services/block_services.d.ts
4410
+ /**
4411
+ * Services required by all V3 blocks by default.
4412
+ * Edit this when a new service should be available to all blocks.
4413
+ *
4414
+ * Standalone module to avoid circular dependencies between block_model.ts
4415
+ * and service type resolution.
4416
+ */
4417
+ declare const BLOCK_SERVICE_FLAGS: {
4418
+ readonly requiresPFrameSpec: true;
4419
+ readonly requiresPFrame: true;
4420
+ readonly requiresDialog: true;
4421
+ readonly requiresColumnsCollection: true;
4422
+ };
4423
+ type BlockServiceFlags = typeof BLOCK_SERVICE_FLAGS;
4424
+ //#endregion
4425
+ //#region ../../../../sdk/model/dist/services/service_resolve.d.ts
4426
+ //#region src/services/service_resolve.d.ts
4427
+ type FlagToName<Flag extends string> = Flag extends `requires${infer K}` ? K extends keyof ServiceNameLiterals ? ServiceNameLiterals[K] : never : never;
4428
+ type RequiredServiceNames<Flags> = { [K in keyof Flags & `requires${string}`]: Flags[K] extends true ? FlagToName<K & string> : never }[keyof Flags & `requires${string}`];
4429
+ type ResolveUiServices<Flags> = Pick<UiServices$1, RequiredServiceNames<Flags> & keyof UiServices$1>;
4430
+ type BlockDefaultUiServices = ResolveUiServices<BlockServiceFlags>; //#endregion
4431
+ //#endregion
4432
+ //#region ../../../../sdk/model/dist/plugin_model.d.ts
4433
+ /**
4434
+ * Runtime definition for a single public output field.
4435
+ * Stored in PluginModel and passed through BlockModelInfo to the UI layer.
4436
+ */
4437
+ type PublicOutputFieldDef = {
4438
+ readonly getter: (data: unknown) => unknown;
4439
+ };
4440
+ //#endregion
4441
+ //#region ../../../../sdk/model/dist/block_api_v3.d.ts
4442
+ //#region src/block_api_v3.d.ts
4443
+ /** Defines methods to read and write current block data. */
4444
+ interface BlockApiV3<_Data = unknown, _Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, Href extends `/${string}` = `/${string}`> {
4445
+ /**
4446
+ * Use this method to retrieve block state during UI initialization. Then use
4447
+ * {@link onStateUpdates} method to subscribe for updates.
4448
+ * */
4449
+ loadBlockState(): Promise<ResultOrError<ValueWithUTag<BlockStateV3<_Data, Outputs, Href>>>>;
4450
+ /**
4451
+ * Get all json patches (rfc6902) that were applied to the block state.
4452
+ * */
4453
+ getPatches(uTag: string): Promise<ResultOrError<ValueWithUTagAndAuthor<Operation[]>>>;
4454
+ /**
4455
+ * Mutates block storage with the given operation.
4456
+ *
4457
+ * This method returns when the data is safely saved so in case the window is
4458
+ * closed there will be no information losses. This function under the hood
4459
+ * may delay actual persistence of the supplied values.
4460
+ * */
4461
+ mutateStorage(payload: MutateStoragePayload, author?: AuthorMarker): Promise<ResultOrError<void>>;
4462
+ /**
4463
+ * Sets block navigation state.
4464
+ * */
4465
+ setNavigationState(state: NavigationState<Href>): Promise<ResultOrError<void>>;
4466
+ /**
4467
+ * Disposes the block API.
4468
+ * */
4469
+ dispose(): Promise<ResultOrError<void>>;
4470
+ } //#endregion
4471
+ //#endregion
4472
+ //#region ../../../../sdk/model/dist/platforma.d.ts
4473
+ //#region src/platforma.d.ts
4474
+ /** Defines all methods to interact with the platform environment from within a block UI. @deprecated */
4475
+ interface PlatformaV1<Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, UiState = unknown, Href extends `/${string}` = `/${string}`> extends BlockApiV1<Args, Outputs, UiState, Href>, DriverKit {
4476
+ /** Information about SDK version current platforma environment was compiled with. */
4477
+ readonly sdkInfo: SdkInfo;
4478
+ readonly apiVersion?: 1;
4479
+ }
4480
+ /** V2 version based on effective json patches pulling API */
4481
+ interface PlatformaV2<Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, UiState = unknown, Href extends `/${string}` = `/${string}`> extends BlockApiV2<Args, Outputs, UiState, Href>, DriverKit {
4482
+ /** Information about SDK version current platforma environment was compiled with. */
4483
+ readonly sdkInfo: SdkInfo;
4484
+ readonly apiVersion: 2;
4485
+ }
4486
+ interface PlatformaV3<Data = unknown, Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, Href extends `/${string}` = `/${string}`, Plugins extends Record<string, unknown> = Record<string, unknown>, UiServices extends Partial<UiServices$1> = Partial<UiServices$1>> extends BlockApiV3<Data, Args, Outputs, Href>, DriverKit {
4487
+ /** Information about SDK version current platforma environment was compiled with. */
4488
+ readonly sdkInfo: SdkInfo;
4489
+ readonly apiVersion: 3;
4490
+ /** Service dispatch — lists available services, their methods, and invokes them. */
4491
+ readonly serviceDispatch: ServiceDispatch;
4492
+ /** @internal Type brand for plugin type inference. Not used at runtime. */
4493
+ readonly __pluginsBrand?: Plugins;
4494
+ /** @internal Type brand for UI service type inference. Not used at runtime. */
4495
+ readonly __uiServicesBrand?: UiServices;
4496
+ }
4497
+ type Platforma<Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, UiStateOrData = unknown, Href extends `/${string}` = `/${string}`> = PlatformaV1<Args, Outputs, UiStateOrData, Href> | PlatformaV2<Args, Outputs, UiStateOrData, Href> | PlatformaV3<UiStateOrData, Args, Outputs, Href>;
4498
+ type PlatformaExtended<Pl extends Platforma = Platforma> = Pl & {
4499
+ blockModelInfo: BlockModelInfo;
4500
+ };
4501
+ type BlockModelInfo = {
4502
+ outputs: Record<string, {
4503
+ withStatus: boolean;
4504
+ }>;
4505
+ pluginIds: PluginHandle[];
4506
+ featureFlags: BlockCodeKnownFeatureFlags;
4507
+ pluginPublicOutputs: Record<string, Record<string, PublicOutputFieldDef>>;
4508
+ };
4509
+ type InferOutputsType<Pl extends Platforma> = Pl extends Platforma<unknown, infer Outputs> ? Outputs : never;
4510
+ type InferDataType<Pl extends Platforma> = Pl extends Platforma<unknown, Record<string, OutputWithStatus<unknown>>, infer Data> ? Data : never;
4511
+ type InferHrefType<Pl extends Platforma> = Pl extends Platforma<unknown, BlockOutputsBase, unknown, infer Href> ? Href : never;
4512
+ //#endregion
4513
+ //#region ../model/dist/index.d.ts
4514
+ //#region src/index.d.ts
4515
+ type BlockData$1 = {
4516
+ titleArgs: string;
4517
+ };
4518
+ declare const platforma: PlatformaExtended<PlatformaV3<BlockData$1, BlockData$1, InferOutputsFromLambdas<{
4519
+ allSpecs: ConfigRenderLambda<{
4520
+ readonly entries: {
4521
+ readonly ref: {
4522
+ readonly __isRef: true;
4523
+ readonly blockId: string;
4524
+ readonly name: string;
4525
+ readonly requireEnrichments?: true | undefined | undefined;
4526
+ };
4527
+ readonly obj: {
4528
+ readonly kind: string;
4529
+ readonly name: string;
4530
+ readonly domain?: {
4531
+ [x: string]: string;
4532
+ } | undefined;
4533
+ readonly contextDomain?: {
4534
+ [x: string]: string;
4535
+ } | undefined;
4536
+ readonly annotations?: {
4537
+ [x: string]: string;
4538
+ } | undefined;
4539
+ };
4540
+ }[];
4541
+ readonly isComplete: boolean;
4542
+ }>;
4543
+ }>, "/", {}, BlockDefaultUiServices>>;
4544
+ //#endregion
4545
+ //#region src/index.d.ts
4546
+ type BlockContract = {
4547
+ outputs: InferOutputsType<typeof platforma>;
4548
+ data: InferDataType<typeof platforma>;
4549
+ href: InferHrefType<typeof platforma>;
4550
+ };
4551
+ type BlockOutputs = BlockContract["outputs"];
4552
+ type BlockData = BlockContract["data"];
4553
+ declare const BlockPointer: {
4554
+ readonly type: "from-pack-v2";
4555
+ readonly packUrl: string;
4556
+ readonly rootUrl: string;
4557
+ };
4558
+ type PoolExplorerBlockContract = BlockContract;
4559
+ type PoolExplorerBlockOutputs = BlockOutputs;
4560
+ type PoolExplorerBlockData = BlockData;
4561
+ declare const PoolExplorerBlockPointer: {
4562
+ readonly type: "from-pack-v2";
4563
+ readonly packUrl: string;
4564
+ readonly rootUrl: string;
4565
+ };
4566
+ //#endregion
4567
+ export { BlockContract, BlockData, BlockOutputs, BlockPointer, PoolExplorerBlockContract, PoolExplorerBlockData, PoolExplorerBlockOutputs, PoolExplorerBlockPointer, platforma };
4568
+ //# sourceMappingURL=index.d.ts.map