@milaboratories/milaboratories.pool-explorer 1.2.65 → 1.2.67

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,4582 @@
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
+ /**
1295
+ * Optional header names aligned 1:1 with {@link columnIndices}. When provided,
1296
+ * each is written verbatim — letting callers supply disambiguated labels the
1297
+ * spec's intrinsic `pl7.app/label` may not carry. When omitted (or an
1298
+ * individual entry is empty), the header falls back to the column's
1299
+ * spec-derived label.
1300
+ *
1301
+ * Additive on purpose: the UI (ui-vue) and the desktop-app runtime version
1302
+ * independently, so a newer UI must not send a shape an older runtime cannot
1303
+ * read. Older runtimes ignore this field and use {@link columnIndices} alone.
1304
+ */
1305
+ headerNames?: string[];
1306
+ range?: TableRange;
1307
+ chunkSize?: number;
1308
+ includeHeader?: boolean;
1309
+ bom?: boolean;
1310
+ compression?: {
1311
+ type: "gzip";
1312
+ level?: number;
1313
+ };
1314
+ signal?: AbortSignal;
1315
+ }
1316
+ /** Result of a PTable file download. */
1317
+ interface WritePTableToFsResult {
1318
+ path: string;
1319
+ rowsWritten: number;
1320
+ bytesWritten: number;
1321
+ }
1322
+ /**
1323
+ * Maximum number of data rows allowed per sheet in an `xlsx` export, kept below
1324
+ * Excel's hard limit of 1,048,576. The driver rejects oversized `xlsx` exports
1325
+ * (see {@link PFrameDriver.exportPTable}); UIs use it to gate the `xlsx` option.
1326
+ */
1327
+ /** Options for {@link PFrameDriver.exportPTable}. */
1328
+ interface ExportPTableOptions {
1329
+ /** Destination file path; its extension selects the output format
1330
+ * (`csv`/`tsv`/`parquet`/`xlsx`). */
1331
+ path: string;
1332
+ /** Unified indices of the columns to export, in output order
1333
+ * (axes first, then data columns). */
1334
+ columnIndices: number[];
1335
+ /**
1336
+ * Optional header names aligned 1:1 with {@link columnIndices}. When provided,
1337
+ * each is written verbatim — letting callers supply disambiguated labels the
1338
+ * spec's intrinsic `pl7.app/label` may not carry. When omitted (or an
1339
+ * individual entry is empty), the header falls back to the column's
1340
+ * spec-derived label.
1341
+ *
1342
+ * Additive on purpose: the UI (ui-vue) and the desktop-app runtime version
1343
+ * independently, so a newer UI must not send a shape an older runtime cannot
1344
+ * read. Older runtimes ignore this field and use {@link columnIndices} alone.
1345
+ */
1346
+ headerNames?: string[];
1347
+ } //#endregion
1348
+ //#endregion
1349
+ //#region ../../../../lib/model/common/dist/drivers/pframe/data_info.d.ts
1350
+ //#region src/drivers/pframe/data_info.d.ts
1351
+ /**
1352
+ * Represents a JavaScript representation of a value in a PColumn. Can be null, a number, or a string.
1353
+ * These are the primitive types that can be stored directly in PColumns.
1354
+ *
1355
+ * Note: Actual columns can hold more value types, which are converted to these JavaScript types
1356
+ * once they enter the JavaScript runtime.
1357
+ */
1358
+ type PColumnValue = null | number | string;
1359
+ /**
1360
+ * Represents a key for a PColumn value.
1361
+ * Can be an array of strings or numbers.
1362
+ */
1363
+ type PColumnKey = (number | string)[];
1364
+ /**
1365
+ * Represents a single entry in a PColumn's data structure.
1366
+ * Contains a key and a value.
1367
+ */
1368
+ /**
1369
+ * Represents column data stored as a simple JSON structure.
1370
+ * Used for small datasets that can be efficiently stored directly in memory.
1371
+ */
1372
+ type JsonDataInfo = {
1373
+ /** Identifier for this data format ('Json') */type: "Json"; /** Number of axes that make up the complete key (tuple length) */
1374
+ keyLength: number;
1375
+ /**
1376
+ * Key-value pairs where keys are stringified tuples of axis values
1377
+ * and values are the column values for those coordinates
1378
+ */
1379
+ data: Record<string, PColumnValue>;
1380
+ };
1381
+ /**
1382
+ * Represents column data partitioned across multiple JSON blobs.
1383
+ * Used for larger datasets that need to be split into manageable chunks.
1384
+ */
1385
+ type JsonPartitionedDataInfo<Blob> = {
1386
+ /** Identifier for this data format ('JsonPartitioned') */type: "JsonPartitioned"; /** Number of leading axes used for partitioning */
1387
+ partitionKeyLength: number; /** Map of stringified partition keys to blob references */
1388
+ parts: Record<string, Blob>;
1389
+ };
1390
+ /**
1391
+ * Represents a binary format chunk containing index and values as separate blobs.
1392
+ * Used for efficient storage and retrieval of column data in binary format.
1393
+ */
1394
+ type BinaryChunk<Blob> = {
1395
+ /** Binary blob containing structured index information */index: Blob; /** Binary blob containing the actual values */
1396
+ values: Blob;
1397
+ };
1398
+ /**
1399
+ * Represents column data partitioned across multiple binary chunks.
1400
+ * Optimized for efficient storage and retrieval of large datasets.
1401
+ */
1402
+ type BinaryPartitionedDataInfo<Blob> = {
1403
+ /** Identifier for this data format ('BinaryPartitioned') */type: "BinaryPartitioned"; /** Number of leading axes used for partitioning */
1404
+ partitionKeyLength: number; /** Map of stringified partition keys to binary chunks */
1405
+ parts: Record<string, BinaryChunk<Blob>>;
1406
+ };
1407
+ type ParquetPartitionedDataInfo<Blob> = {
1408
+ /** Identifier for this data format ('ParquetPartitioned') */type: "ParquetPartitioned"; /** Number of leading axes used for partitioning */
1409
+ partitionKeyLength: number; /** Map of stringified partition keys to parquet files */
1410
+ parts: Record<string, Blob>;
1411
+ };
1412
+ /**
1413
+ * Union type representing all possible data storage formats for PColumn data.
1414
+ * The specific format used depends on data size, access patterns, and performance requirements.
1415
+ *
1416
+ * @template Blob - Type parameter representing the storage reference type (could be ResourceInfo, PFrameBlobId, etc.)
1417
+ */
1418
+ type DataInfo<Blob> = JsonDataInfo | JsonPartitionedDataInfo<Blob> | BinaryPartitionedDataInfo<Blob> | ParquetPartitionedDataInfo<Blob>;
1419
+ /**
1420
+ * Type guard function that checks if the given value is a valid DataInfo.
1421
+ *
1422
+ * @param value - The value to check
1423
+ * @returns True if the value is a valid DataInfo, false otherwise
1424
+ */
1425
+ /**
1426
+ * Represents a single key-value entry in a column's explicit data structure.
1427
+ * Used when directly instantiating PColumns with explicit data.
1428
+ */
1429
+ type PColumnValuesEntry = {
1430
+ key: PColumnKey;
1431
+ val: PColumnValue;
1432
+ };
1433
+ /**
1434
+ * Array of key-value entries representing explicit column data.
1435
+ * Used for lightweight explicit instantiation of PColumns.
1436
+ */
1437
+ type PColumnValues = PColumnValuesEntry[];
1438
+ /**
1439
+ * Entry-based representation of JsonDataInfo
1440
+ */
1441
+ //#endregion
1442
+ //#region ../../../../lib/util/helpers/dist/types/brand.d.ts
1443
+ //#region src/types/brand.d.ts
1444
+ /**
1445
+ * Phantom-property brand. The key is a plain string literal rather than a
1446
+ * `unique symbol` so the resulting type stays fully nameable across packages.
1447
+ *
1448
+ * A `unique symbol` key forces TS, when forced to expand `Branded<T, B>` into
1449
+ * its structural form (e.g. inside `Record<BrandedUnion, V>` index signatures
1450
+ * during dts emit), to write out `typeof __brand` — a value-level reference
1451
+ * to the symbol. If the symbol's declaring module isn't reachable from the
1452
+ * compilation root, dts emit fails with TS4023 ("cannot be named"). Using a
1453
+ * string key sidesteps this entirely: `{ __brand: B }` is a plain structural
1454
+ * type, nameable from anywhere.
1455
+ *
1456
+ * Phantom keys provide compile-time discrimination only — two different brand
1457
+ * tags `B1 ≠ B2` make `Branded<T, B1>` and `Branded<T, B2>` mutually
1458
+ * incompatible regardless of whether the key is a symbol or a string.
1459
+ */
1460
+ type Branded<T, B> = T & {
1461
+ readonly __brand: B;
1462
+ };
1463
+ //#endregion
1464
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/overridden.d.ts
1465
+ //#region src/drivers/pframe/spec/overridden.d.ts
1466
+ type SpecOverrides = Pick<PColumnSpec, "domain" | "contextDomain" | "annotations"> & {
1467
+ axesSpec?: AxisPatches;
1468
+ };
1469
+ /**
1470
+ * `source` can reference a leaf or a Filtered/Discovered id, but never another
1471
+ * Overridden id — there is no `Overridden<Overridden<...>>`. Repeated overrides
1472
+ * merge at the outer wrapper via {@link mergeSpecOverrides}.
1473
+ */
1474
+ interface ColumnOverriddenKey {
1475
+ __isOverridden: true;
1476
+ source: Exclude<ColumnUniversalId, ColumnOverriddenId>;
1477
+ specOverrides: SpecOverrides;
1478
+ }
1479
+ type ColumnOverriddenId = Branded<CanonicalizedJson<ColumnOverriddenKey>, "ColumnOverriddenId">;
1480
+ //#endregion
1481
+ //#region ../../../../lib/model/common/dist/drivers/pframe/query/query_common.d.ts
1482
+ //#region src/drivers/pframe/query/query_common.d.ts
1483
+ /**
1484
+ * Structural type information for a single column: the axis value types (in
1485
+ * order) and the single column value type. Mirrors the self-contained
1486
+ * `typeSpec` shape carried by the data layer (`{ axes, column }`).
1487
+ */
1488
+ type ColumnTypeSpec = {
1489
+ /** List of axis value types defining the dimensions of the data */axes: AxisValueType[]; /** The single column value type */
1490
+ column: ColumnValueType;
1491
+ };
1492
+ /**
1493
+ * Unary mathematical operation kinds.
1494
+ *
1495
+ * These operations take a single numeric input and produce a numeric output.
1496
+ * **Null handling**: If input is null, result is null.
1497
+ *
1498
+ * Operations:
1499
+ * - `abs` - Absolute value: |x|
1500
+ * - `ceil` - Round up to nearest integer
1501
+ * - `floor` - Round down to nearest integer
1502
+ * - `round` - Round to nearest integer (banker's rounding)
1503
+ * - `sqrt` - Square root (returns NaN for negative inputs)
1504
+ * - `log` - Natural logarithm (ln)
1505
+ * - `log2` - Base-2 logarithm
1506
+ * - `log10` - Base-10 logarithm
1507
+ * - `exp` - Exponential function (e^x)
1508
+ * - `negate` - Negation (-x)
1509
+ */
1510
+ type NumericUnaryOperand = "abs" | "ceil" | "floor" | "round" | "sqrt" | "log" | "log2" | "log10" | "exp" | "negate";
1511
+ /**
1512
+ * Binary mathematical operation kinds.
1513
+ *
1514
+ * These operations take two numeric inputs and produce a numeric result.
1515
+ * **Null handling**: If either operand is null, result is null.
1516
+ *
1517
+ * Operations:
1518
+ * - `add` - Addition: left + right
1519
+ * - `sub` - Subtraction: left - right
1520
+ * - `mul` - Multiplication: left * right
1521
+ * - `div` - Division: left / right (division by zero returns Infinity or NaN)
1522
+ * - `mod` - Modulo: left % right
1523
+ * - `power` - Exponentiation: left ** right
1524
+ */
1525
+ type NumericBinaryOperand = "add" | "sub" | "mul" | "div" | "mod" | "power";
1526
+ /**
1527
+ * Numeric comparison operation kinds.
1528
+ *
1529
+ * These operations compare two numeric inputs and produce a boolean result.
1530
+ * **Null handling**: If either operand is null, result is null.
1531
+ *
1532
+ * Operations:
1533
+ * - `eq` - Equal: left == right
1534
+ * - `ne` - Not equal: left != right
1535
+ * - `lt` - Less than: left < right
1536
+ * - `le` - Less or equal: left <= right
1537
+ * - `gt` - Greater than: left > right
1538
+ * - `ge` - Greater or equal: left >= right
1539
+ */
1540
+ type NumericComparisonOperand = "eq" | "ne" | "lt" | "le" | "gt" | "ge";
1541
+ /**
1542
+ * Constant value expression.
1543
+ *
1544
+ * Represents a literal constant value in an expression tree.
1545
+ * The value can be a string, number, or boolean.
1546
+ *
1547
+ * @example
1548
+ * // Constant number
1549
+ * { type: 'constant', value: 42 }
1550
+ *
1551
+ * // Constant string
1552
+ * { type: 'constant', value: 'hello' }
1553
+ *
1554
+ * // Constant boolean
1555
+ * { type: 'constant', value: true }
1556
+ */
1557
+ type ExprConstant = {
1558
+ type: "constant";
1559
+ value: string | number | boolean;
1560
+ };
1561
+ /**
1562
+ * Null check expression.
1563
+ *
1564
+ * Tests if an expression evaluates to null.
1565
+ * **Input**: Any expression.
1566
+ * **Output**: Boolean (true if input is null, false otherwise).
1567
+ *
1568
+ * @template I - The expression type (for recursion)
1569
+ *
1570
+ * @example
1571
+ * // Check if column value is null
1572
+ * { type: 'isNull', input: columnRef }
1573
+ *
1574
+ * // Combine with NOT to check for non-null
1575
+ * { type: 'not', input: { type: 'isNull', input: columnRef } }
1576
+ */
1577
+ interface ExprIsNull<I> {
1578
+ type: "isNull";
1579
+ /** Input expression to check for null */
1580
+ input: I;
1581
+ }
1582
+ /**
1583
+ * Null coalescing expression.
1584
+ *
1585
+ * Returns the input value if it is not null, otherwise returns the replacement value.
1586
+ * Equivalent to SQL's `IFNULL(input, replacement)` or `COALESCE(input, replacement)`.
1587
+ * **Input**: Any expression.
1588
+ * **Output**: Same type as input/replacement.
1589
+ * **Null handling**: If input is null, returns replacement; otherwise returns input.
1590
+ *
1591
+ * The Rust runtime also accepts the legacy `"ifNull"` tag as a serde
1592
+ * alias; new code should emit `"fillNull"`.
1593
+ *
1594
+ * @template I - The expression type (for recursion)
1595
+ *
1596
+ * @example
1597
+ * // Replace null values with 0
1598
+ * { type: 'fillNull', input: columnRef, replacement: { type: 'constant', value: 0 } }
1599
+ *
1600
+ * // Replace null strings with 'unknown'
1601
+ * { type: 'fillNull', input: nameColumn, replacement: { type: 'constant', value: 'unknown' } }
1602
+ */
1603
+ interface ExprFillNull<I> {
1604
+ type: "fillNull";
1605
+ /** Value to check for null */
1606
+ input: I;
1607
+ /** Replacement value if input is null */
1608
+ replacement: I;
1609
+ }
1610
+ /**
1611
+ * Unary mathematical expression.
1612
+ *
1613
+ * Applies a unary mathematical function to a single input expression.
1614
+ * **Input**: One expression that evaluates to a numeric value.
1615
+ * **Output**: Numeric value.
1616
+ * **Null handling**: If input is null, result is null.
1617
+ *
1618
+ * @template I - The expression type (for recursion)
1619
+ *
1620
+ * @example
1621
+ * // Absolute value of column "value"
1622
+ * { type: 'unaryMath', operand: 'abs', input: columnRef }
1623
+ *
1624
+ * // Natural log of expression
1625
+ * { type: 'unaryMath', operand: 'log', input: someExpr }
1626
+ *
1627
+ * @see NumericUnaryOperand for available operations
1628
+ */
1629
+ interface ExprNumericUnary<I> {
1630
+ type: "numericUnary";
1631
+ /** The mathematical operation to apply */
1632
+ operand: NumericUnaryOperand;
1633
+ /** Input expression (must evaluate to numeric) */
1634
+ input: I;
1635
+ }
1636
+ /**
1637
+ * Binary mathematical expression.
1638
+ *
1639
+ * Applies a binary arithmetic operation to two input expressions.
1640
+ * **Input**: Two expressions that evaluate to numeric values.
1641
+ * **Output**: Numeric value.
1642
+ * **Null handling**: If either operand is null, result is null.
1643
+ *
1644
+ * @template I - The expression type (for recursion)
1645
+ *
1646
+ * @example
1647
+ * // Addition: col_a + col_b
1648
+ * { type: 'binaryMath', operand: 'add', left: colA, right: colB }
1649
+ *
1650
+ * // Division: col_a / 2
1651
+ * { type: 'binaryMath', operand: 'div', left: colA, right: { type: 'constant', value: 2 } }
1652
+ *
1653
+ * @see NumericBinaryOperand for available operations
1654
+ */
1655
+ interface ExprNumericBinary<I> {
1656
+ type: "numericBinary";
1657
+ /** The arithmetic operation to apply */
1658
+ operand: NumericBinaryOperand;
1659
+ /** Left operand expression */
1660
+ left: I;
1661
+ /** Right operand expression */
1662
+ right: I;
1663
+ }
1664
+ /**
1665
+ * Numeric comparison expression.
1666
+ *
1667
+ * Compares two numeric expressions and produces a boolean result.
1668
+ * **Input**: Two expressions that evaluate to numeric values.
1669
+ * **Output**: Boolean.
1670
+ * **Null handling**: If either operand is null, result is null.
1671
+ *
1672
+ * @template I - The expression type (for recursion)
1673
+ *
1674
+ * @example
1675
+ * // Greater than: col_a > 10
1676
+ * { type: 'numericComparison', operand: 'gt', left: colA, right: { type: 'constant', value: 10 } }
1677
+ *
1678
+ * // Equality: col_a == col_b
1679
+ * { type: 'numericComparison', operand: 'eq', left: colA, right: colB }
1680
+ *
1681
+ * // Range check (combine with logical AND): 0 <= x && x < 100
1682
+ * // { type: 'logical', operand: 'and', input: [
1683
+ * // { type: 'numericComparison', operand: 'ge', left: colX, right: { type: 'constant', value: 0 } },
1684
+ * // { type: 'numericComparison', operand: 'lt', left: colX, right: { type: 'constant', value: 100 } }
1685
+ * // ]}
1686
+ *
1687
+ * @see NumericComparisonOperand for available operations
1688
+ */
1689
+ interface ExprNumericComparison<I> {
1690
+ type: "numericComparison";
1691
+ /** The comparison operation to apply */
1692
+ operand: NumericComparisonOperand;
1693
+ /** Left operand expression */
1694
+ left: I;
1695
+ /** Right operand expression */
1696
+ right: I;
1697
+ }
1698
+ /**
1699
+ * String equality check.
1700
+ *
1701
+ * Compares input string to a reference value.
1702
+ * **Input**: Expression evaluating to a string.
1703
+ * **Output**: Boolean.
1704
+ * **Null handling**: Returns false if input is null.
1705
+ *
1706
+ * @template I - The expression type (for recursion)
1707
+ *
1708
+ * @example
1709
+ * // Check if name equals "John" (case-sensitive)
1710
+ * // Matches only: "John"
1711
+ * { type: 'stringEquals', input: nameColumn, value: 'John' }
1712
+ *
1713
+ * @example
1714
+ * // Check if name equals "John" (case-insensitive)
1715
+ * // Matches: "john", "JOHN", "John", "jOhN"
1716
+ * { type: 'stringEquals', input: nameColumn, value: 'John', caseInsensitive: true }
1717
+ */
1718
+ interface ExprStringEquals<I> {
1719
+ type: "stringEquals";
1720
+ /** Input expression (must evaluate to string) */
1721
+ input: I;
1722
+ /** Reference string to compare against */
1723
+ value: string;
1724
+ /** If true, comparison ignores case */
1725
+ caseInsensitive: boolean;
1726
+ }
1727
+ /**
1728
+ * Regular expression match check.
1729
+ *
1730
+ * Tests if input string matches a regular expression pattern.
1731
+ * **Input**: Expression evaluating to a string.
1732
+ * **Output**: Boolean (true if pattern matches).
1733
+ * **Null handling**: Returns false if input is null.
1734
+ *
1735
+ * @template I - The expression type (for recursion)
1736
+ *
1737
+ * @example
1738
+ * // Check if value matches email pattern
1739
+ * { type: 'stringRegex', input: emailColumn, value: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$' }
1740
+ *
1741
+ * // Check if starts with "prefix"
1742
+ * { type: 'stringRegex', input: valueColumn, value: '^prefix' }
1743
+ *
1744
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions | MDN Regular Expressions Guide}
1745
+ */
1746
+ interface ExprStringRegex<I> {
1747
+ type: "stringRegex";
1748
+ /** Input expression (must evaluate to string) */
1749
+ input: I;
1750
+ /** Regular expression pattern */
1751
+ value: string;
1752
+ }
1753
+ /**
1754
+ * Substring containment check.
1755
+ *
1756
+ * Tests if input string contains a specified substring.
1757
+ * **Input**: Expression evaluating to a string.
1758
+ * **Output**: Boolean (true if substring is found).
1759
+ * **Null handling**: Returns false if input is null.
1760
+ *
1761
+ * @template I - The expression type (for recursion)
1762
+ *
1763
+ * @example
1764
+ * // Case-sensitive contains
1765
+ * { type: 'stringContains', input: descColumn, value: 'error', caseInsensitive: false }
1766
+ *
1767
+ * // Case-insensitive contains
1768
+ * { type: 'stringContains', input: descColumn, value: 'ERROR', caseInsensitive: true }
1769
+ */
1770
+ interface ExprStringContains<I> {
1771
+ type: "stringContains";
1772
+ /** Input expression (must evaluate to string) */
1773
+ input: I;
1774
+ /** Substring to search for */
1775
+ value: string;
1776
+ /** If true, comparison ignores case */
1777
+ caseInsensitive: boolean;
1778
+ }
1779
+ /**
1780
+ * Fuzzy string containment check with edit distance.
1781
+ *
1782
+ * Tests if input string approximately matches a pattern within a specified edit distance.
1783
+ * Uses Levenshtein distance (or substitution-only distance) for fuzzy matching.
1784
+ * **Input**: Expression evaluating to a string.
1785
+ * **Output**: Boolean (true if approximate match found within maxEdits).
1786
+ * **Null handling**: Returns false if input is null.
1787
+ *
1788
+ * @template I - The expression type (for recursion)
1789
+ *
1790
+ * @example
1791
+ * // Match "color" with up to 1 edit (catches "colour", "colr", etc.)
1792
+ * {
1793
+ * type: 'stringContainsFuzzy',
1794
+ * input: textColumn,
1795
+ * value: 'color',
1796
+ * maxEdits: 1,
1797
+ * caseInsensitive: true,
1798
+ * substitutionsOnly: false,
1799
+ * wildcard: null
1800
+ * }
1801
+ *
1802
+ * // Match with wildcard (? matches any single character)
1803
+ * {
1804
+ * type: 'stringContainsFuzzy',
1805
+ * input: textColumn,
1806
+ * value: 'te?t',
1807
+ * maxEdits: 0,
1808
+ * caseInsensitive: false,
1809
+ * substitutionsOnly: false,
1810
+ * wildcard: '?'
1811
+ * }
1812
+ */
1813
+ interface ExprStringContainsFuzzy<I> {
1814
+ type: "stringContainsFuzzy";
1815
+ /** Input expression (must evaluate to string) */
1816
+ input: I;
1817
+ /** Pattern to match against */
1818
+ value: string;
1819
+ /**
1820
+ * Maximum edit distance (Levenshtein distance).
1821
+ * 0 = exact match only, 1 = one edit allowed, etc.
1822
+ */
1823
+ maxEdits: number;
1824
+ /** If true, comparison ignores case */
1825
+ caseInsensitive: boolean;
1826
+ /**
1827
+ * If true, only substitutions count as edits (no insertions/deletions).
1828
+ * Useful when you want to match strings of same length with typos.
1829
+ */
1830
+ substitutionsOnly: boolean;
1831
+ /**
1832
+ * Optional wildcard character that matches any single character.
1833
+ * Example: '?' in "te?t" matches "test", "text", "tent", etc.
1834
+ * Set to null to disable wildcard matching.
1835
+ */
1836
+ wildcard: null | string;
1837
+ }
1838
+ /**
1839
+ * Logical NOT expression.
1840
+ *
1841
+ * Negates a boolean expression.
1842
+ * **Input**: Expression evaluating to boolean.
1843
+ * **Output**: Boolean (inverted).
1844
+ * **Null handling**: NOT null = null.
1845
+ *
1846
+ * @template I - The expression type (for recursion)
1847
+ *
1848
+ * @example
1849
+ * // NOT (value > 10)
1850
+ * { type: 'not', input: comparisonExpr }
1851
+ */
1852
+ interface ExprLogicalUnary<I> {
1853
+ type: "not";
1854
+ /** Input boolean expression to negate */
1855
+ input: I;
1856
+ }
1857
+ /**
1858
+ * Logical AND/OR expression.
1859
+ *
1860
+ * Combines multiple boolean expressions using AND or OR logic.
1861
+ * **Input**: Array of expressions evaluating to boolean (minimum 2).
1862
+ * **Output**: Boolean.
1863
+ *
1864
+ * **Null handling**
1865
+ * - AND: null AND true = null, null AND false = false
1866
+ * - OR: null OR true = true, null OR false = null
1867
+ *
1868
+ * @template I - The expression type (for recursion)
1869
+ *
1870
+ * @example
1871
+ * // (a > 0) AND (b < 100)
1872
+ * { type: 'and', input: [exprA, exprB] }
1873
+ *
1874
+ * // (status == 'active') OR (status == 'pending')
1875
+ * { type: 'or', input: [statusActive, statusPending] }
1876
+ */
1877
+ interface ExprLogicalVariadic<I> {
1878
+ /** Logical operation: 'and' or 'or' */
1879
+ type: "and" | "or";
1880
+ /** Array of boolean expressions to combine (minimum 2 elements) */
1881
+ input: I[];
1882
+ }
1883
+ /**
1884
+ * Set membership check expression.
1885
+ *
1886
+ * Tests if a value is present in a predefined set of values.
1887
+ * **Input**: Expression evaluating to string or number.
1888
+ * **Output**: Boolean.
1889
+ * **Null handling**: Returns false if input is null.
1890
+ *
1891
+ * @template I - The expression type (for recursion)
1892
+ * @template T - The type of set elements (string or number)
1893
+ *
1894
+ * @example
1895
+ * // Check if status is in ['active', 'pending', 'review']
1896
+ * {
1897
+ * type: 'isIn',
1898
+ * input: statusColumn,
1899
+ * set: ['active', 'pending', 'review']
1900
+ * }
1901
+ */
1902
+ interface ExprIsIn<I, T extends string | number> {
1903
+ type: "isIn";
1904
+ /** Input expression to test */
1905
+ input: I;
1906
+ /** Set of allowed values */
1907
+ set: T[];
1908
+ /** If true, the predicate is inverted (true for values NOT in `set`). */
1909
+ negate: boolean;
1910
+ }
1911
+ /**
1912
+ * Type cast expression.
1913
+ *
1914
+ * Converts the input value to a different column value type. Mirrors
1915
+ * SQL `CAST(input AS U)`.
1916
+ *
1917
+ * **Input**: any expression.
1918
+ * **Output**: a value of `targetType`.
1919
+ * **Null handling**: null in → null out.
1920
+ *
1921
+ * @template I - The expression type (for recursion)
1922
+ */
1923
+ interface ExprCast<I> {
1924
+ type: "cast";
1925
+ /** Expression to cast. */
1926
+ input: I;
1927
+ /** Target column value type. */
1928
+ targetType: ColumnValueType;
1929
+ }
1930
+ /**
1931
+ * A single `when → then` case in a {@link ExprConditional} expression.
1932
+ *
1933
+ * @template I - The expression type (for recursion)
1934
+ */
1935
+ interface ExprConditionalCase<I> {
1936
+ /** Boolean predicate that selects this branch. */
1937
+ when: I;
1938
+ /** Value produced when `when` evaluates to true. */
1939
+ then: I;
1940
+ }
1941
+ /**
1942
+ * Conditional (CASE WHEN) expression.
1943
+ *
1944
+ * Evaluates `cases` in order; the value of the first case whose `when`
1945
+ * is true is returned. If no case matches, `otherwise` is used (or
1946
+ * null when omitted).
1947
+ *
1948
+ * **Result type**: the type of the first case's `then`; subsequent
1949
+ * `then`s and `otherwise` are cast to it.
1950
+ *
1951
+ * @template I - The expression type (for recursion)
1952
+ *
1953
+ * @example
1954
+ * {
1955
+ * type: 'conditional',
1956
+ * cases: [
1957
+ * { when: gtTwenty, then: { type: 'constant', value: 'high' } },
1958
+ * { when: gtTen, then: { type: 'constant', value: 'mid' } }
1959
+ * ],
1960
+ * otherwise: { type: 'constant', value: 'low' }
1961
+ * }
1962
+ */
1963
+ interface ExprConditional<I> {
1964
+ type: "conditional";
1965
+ /** Cases evaluated in order; first matching wins. At least one. */
1966
+ cases: [ExprConditionalCase<I>, ...ExprConditionalCase<I>[]];
1967
+ /** Fallback value when no case matches. */
1968
+ otherwise?: I;
1969
+ }
1970
+ /** Ranking function kind. */
1971
+ type RankingKind = "rank" | "denseRank" | "rowNumber";
1972
+ /**
1973
+ * Ranking expression (always a window function).
1974
+ *
1975
+ * Orders rows by `orderBy` within each partition and assigns ranks
1976
+ * according to `kind`. Output is always `Long`.
1977
+ *
1978
+ * @template I - The expression type (for recursion)
1979
+ * @template A - Axis selector type
1980
+ * @template C - Column selector type
1981
+ */
1982
+ interface ExprRanking<I, A, C> {
1983
+ type: "ranking";
1984
+ /** Ranking semantics. */
1985
+ kind: RankingKind;
1986
+ /** Expression to order by within each partition. */
1987
+ orderBy: I;
1988
+ /** If true (default), sort ascending; if false, descending. */
1989
+ ascending?: boolean;
1990
+ /** Partition specification — at least one entry when supplied. */
1991
+ partitionBy?: [QuerySelector<A, C>, ...QuerySelector<A, C>[]];
1992
+ }
1993
+ /**
1994
+ * Axis reference expression.
1995
+ *
1996
+ * References an axis value for use in expressions (filtering, sorting, etc.).
1997
+ * The axis identifier type varies by context (spec vs data layer).
1998
+ *
1999
+ * @template A - Axis identifier type (e.g., SingleAxisSelector for spec, number for data)
2000
+ *
2001
+ * @example
2002
+ * // Reference axis by selector (spec layer)
2003
+ * { type: 'axisRef', value: { name: 'sample' } }
2004
+ *
2005
+ * // Reference axis by index (data layer)
2006
+ * { type: 'axisRef', value: 0 }
2007
+ */
2008
+ interface ExprAxisRef<A> {
2009
+ type: "axisRef";
2010
+ /** Axis identifier (selector or index depending on context) */
2011
+ value: A;
2012
+ }
2013
+ /**
2014
+ * Column reference expression.
2015
+ *
2016
+ * References a column value for use in expressions (filtering, arithmetic, etc.).
2017
+ * The column identifier type varies by context (spec vs data layer).
2018
+ *
2019
+ * @template C - Column identifier type (e.g., PObjectId for spec, number for data)
2020
+ *
2021
+ * @example
2022
+ * // Reference column by ID (spec layer)
2023
+ * { type: 'columnRef', value: 'col_abc123' }
2024
+ *
2025
+ * // Reference column by index (data layer)
2026
+ * { type: 'columnRef', value: 0 }
2027
+ */
2028
+ interface ExprColumnRef<C> {
2029
+ type: "columnRef";
2030
+ /** Column identifier (ID or index depending on context) */
2031
+ value: C;
2032
+ }
2033
+ type InferBooleanExpressionUnion<E> = [E extends ExprNumericComparison<unknown> ? Extract<E, {
2034
+ type: "numericComparison";
2035
+ }> : never, E extends ExprStringEquals<unknown> ? Extract<E, {
2036
+ type: "stringEquals";
2037
+ }> : never, E extends ExprStringContains<unknown> ? Extract<E, {
2038
+ type: "stringContains";
2039
+ }> : never, E extends ExprStringContainsFuzzy<unknown> ? Extract<E, {
2040
+ type: "stringContainsFuzzy";
2041
+ }> : never, E extends ExprStringRegex<unknown> ? Extract<E, {
2042
+ type: "stringRegex";
2043
+ }> : never, E extends ExprIsNull<unknown> ? Extract<E, {
2044
+ type: "isNull";
2045
+ }> : never, E extends ExprLogicalUnary<unknown> ? Extract<E, {
2046
+ type: "not";
2047
+ }> : never, E extends ExprLogicalVariadic<unknown> ? Extract<E, {
2048
+ type: "and" | "or";
2049
+ }> : never, E extends ExprIsIn<unknown, string | number> ? Extract<E, {
2050
+ type: "isIn";
2051
+ }> : never][number];
2052
+ /**
2053
+ * Selector for referencing an axis in queries.
2054
+ *
2055
+ * Used to identify a specific axis dimension in operations like:
2056
+ * - Sorting by axis values
2057
+ * - Partitioning for window functions
2058
+ * - Filtering/slicing axes
2059
+ *
2060
+ * @template A - Axis identifier type (typically string name or numeric index)
2061
+ *
2062
+ * @example
2063
+ * // Select axis by name
2064
+ * { type: 'axis', id: 'sample' }
2065
+ *
2066
+ * // Select axis by index
2067
+ * { type: 'axis', id: 0 }
2068
+ */
2069
+ interface QueryAxisSelector<A> {
2070
+ type: "axis";
2071
+ /** Axis identifier (name or index depending on context) */
2072
+ id: A;
2073
+ }
2074
+ /**
2075
+ * Selector for referencing a column in queries.
2076
+ *
2077
+ * Used to identify a specific column in operations like:
2078
+ * - Sorting by column values
2079
+ * - Partitioning for window functions
2080
+ * - Aggregation expressions
2081
+ *
2082
+ * @template C - Column identifier type (typically string name or numeric index)
2083
+ *
2084
+ * @example
2085
+ * // Select column by name
2086
+ * { type: 'column', id: 'expression_value' }
2087
+ *
2088
+ * // Select column by index
2089
+ * { type: 'column', id: 0 }
2090
+ */
2091
+ interface QueryColumnSelector<C> {
2092
+ type: "column";
2093
+ /** Column identifier (name or index depending on context) */
2094
+ id: C;
2095
+ }
2096
+ /**
2097
+ * Axis-or-column selector — mirrors the Rust `Selector<AxisSelector,
2098
+ * ColumnSelector>` enum
2099
+ * (`packages/bridge/src/query/query_sort.rs`). Used for the
2100
+ * `partitionBy` / `over` fields of window expressions where either an
2101
+ * axis or a column can drive the partition.
2102
+ */
2103
+ type QuerySelector<A, C> = QueryAxisSelector<A> | QueryColumnSelector<C>;
2104
+ /**
2105
+ * Left outer join query operation.
2106
+ *
2107
+ * Joins a primary query with one or more secondary queries using left outer join semantics.
2108
+ * All records from the primary are preserved; matching records from secondaries are joined,
2109
+ * non-matching positions are filled with nulls.
2110
+ *
2111
+ * **Join behavior**:
2112
+ * - All records from `primary` are preserved
2113
+ * - For each secondary, matching records (by axis keys) are joined
2114
+ * - Missing matches from secondaries are filled with null values
2115
+ * - Empty `secondary` array acts as identity (returns primary unchanged)
2116
+ *
2117
+ * **Null handling**: Null join keys don't match; positions without matches get null values.
2118
+ *
2119
+ * @template JE - Join entry type
2120
+ *
2121
+ * @example
2122
+ * // Left join samples with optional annotations
2123
+ * {
2124
+ * type: 'outerJoin',
2125
+ * primary: samplesQuery,
2126
+ * secondary: [annotationsQuery, metadataQuery]
2127
+ * }
2128
+ * // Result has all samples; annotations/metadata are null where not available
2129
+ */
2130
+ interface QueryOuterJoin<JE extends QueryJoinEntry<unknown>> {
2131
+ type: "outerJoin";
2132
+ /** Primary query - all its records are preserved */
2133
+ primary: JE;
2134
+ /** Secondary queries - joined where keys match, null where they don't */
2135
+ secondary: JE[];
2136
+ }
2137
+ /**
2138
+ * Axis slicing query operation.
2139
+ *
2140
+ * Filters data by fixing one or more axes to specific constant values.
2141
+ * Each filtered axis is removed from the resulting data shape (reduces dimensionality).
2142
+ *
2143
+ * **Behavior**:
2144
+ * - Each axis filter selects records where that axis equals the constant
2145
+ * - Filtered axes are removed from the output spec
2146
+ * - Multiple filters apply conjunctively (AND)
2147
+ *
2148
+ * @template Q - Input query type
2149
+ * @template A - Axis selector type
2150
+ *
2151
+ * @example
2152
+ * // Spec layer: axisSelector is a SingleAxisSelector.
2153
+ * {
2154
+ * type: 'sliceAxes',
2155
+ * input: fullDataQuery,
2156
+ * axisFilters: [
2157
+ * { axisSelector: { name: 'sample' }, constant: 'Sample1' },
2158
+ * { axisSelector: { name: 'condition' }, constant: 'Treatment' }
2159
+ * ]
2160
+ * }
2161
+ *
2162
+ * @example
2163
+ * // Data layer: axisSelector is the axis index.
2164
+ * {
2165
+ * type: 'sliceAxes',
2166
+ * input: fullDataQuery,
2167
+ * axisFilters: [{ axisSelector: 0, constant: 'Sample1' }]
2168
+ * }
2169
+ */
2170
+ interface QuerySliceAxes<Q, A> {
2171
+ type: "sliceAxes";
2172
+ /** Input query to slice */
2173
+ input: Q;
2174
+ /** List of axis filters to apply (at least one required) */
2175
+ axisFilters: {
2176
+ /** Axis to filter. `SingleAxisSelector` at the spec layer; axis index at the data layer. */axisSelector: A; /** The constant value to filter the axis to */
2177
+ constant: string | number;
2178
+ }[];
2179
+ }
2180
+ /**
2181
+ * Sort query operation.
2182
+ *
2183
+ * Reorders records by one or more axes or columns.
2184
+ * Does not change data shape or values, only record order.
2185
+ *
2186
+ * **Behavior**:
2187
+ * - Sort entries are applied in priority order (first entry = primary sort key)
2188
+ * - Ties in first sort key are broken by second, etc.
2189
+ * - All axes and columns pass through unchanged
2190
+ * - Only the physical ordering of records changes
2191
+ *
2192
+ * @template Q - Input query type
2193
+ * @template SE - Sort entry type
2194
+ *
2195
+ * @example
2196
+ * // Sort by score descending, then by name ascending for ties
2197
+ * {
2198
+ * type: 'sort',
2199
+ * input: dataQuery,
2200
+ * sortBy: [
2201
+ * { expression: { type: 'columnRef', value: 'score' }, ascending: false, nullsFirst: false },
2202
+ * { expression: { type: 'axisRef', value: { name: 'name' } }, ascending: true, nullsFirst: false }
2203
+ * ]
2204
+ * }
2205
+ */
2206
+ interface QuerySort<Q, E> {
2207
+ type: "sort";
2208
+ /** Input query to sort */
2209
+ input: Q;
2210
+ /** Sort criteria in priority order (at least one required) */
2211
+ sortBy: {
2212
+ expression: E; /** If true, sort ascending (A-Z, 0-9); if false, descending */
2213
+ ascending: boolean;
2214
+ /**
2215
+ * Null placement control:
2216
+ * - true: nulls sort before non-null values
2217
+ * - false: nulls sort after non-null values
2218
+ */
2219
+ nullsFirst: boolean;
2220
+ }[];
2221
+ }
2222
+ /**
2223
+ * Filter query operation.
2224
+ *
2225
+ * Filters records based on a boolean predicate expression.
2226
+ * Only records where predicate evaluates to true are kept.
2227
+ *
2228
+ * **Behavior**:
2229
+ * - Evaluates predicate for each record
2230
+ * - Keeps records where predicate is true
2231
+ * - Discards records where predicate is false or null
2232
+ * - Data shape (axes, columns) is preserved
2233
+ *
2234
+ * **Null handling**: Records with null predicate result are excluded (null ≠ true).
2235
+ *
2236
+ * @template Q - Input query type
2237
+ * @template E - Expression type
2238
+ *
2239
+ * @example
2240
+ * // Filter to records where value > 10 AND status == 'active'
2241
+ * {
2242
+ * type: 'filter',
2243
+ * input: dataQuery,
2244
+ * predicate: {
2245
+ * type: 'logical',
2246
+ * operand: 'and',
2247
+ * input: [
2248
+ * { type: 'numericComparison', operand: 'gt', left: valueRef, right: { type: 'constant', value: 10 } },
2249
+ * { type: 'stringEquals', input: statusRef, value: 'active' }
2250
+ * ]
2251
+ * }
2252
+ * }
2253
+ */
2254
+ interface QueryFilter<Q, E> {
2255
+ type: "filter";
2256
+ /** Input query to filter */
2257
+ input: Q;
2258
+ /** Boolean predicate expression - only true records pass */
2259
+ predicate: E;
2260
+ }
2261
+ /**
2262
+ * Column reference query (leaf node).
2263
+ *
2264
+ * References an existing column by its unique identifier.
2265
+ * This is a leaf node in the query tree that retrieves actual data.
2266
+ *
2267
+ * The column must exist in the dataset and its spec (axes, value type)
2268
+ * becomes the output spec of this query node.
2269
+ *
2270
+ * @example
2271
+ * // Reference column by ID
2272
+ * { type: 'column', column: 'col_abc123' }
2273
+ *
2274
+ * @template C - Column reference type (e.g., PObjectId for spec, full PColumn for rich queries)
2275
+ */
2276
+ interface QueryColumn<C = PObjectId> {
2277
+ type: "column";
2278
+ /** Column reference (ID or full column object depending on context) */
2279
+ column: C;
2280
+ }
2281
+ /**
2282
+ * Inline column query (leaf node).
2283
+ *
2284
+ * Creates a column with inline/embedded data and type specification.
2285
+ * Useful for creating constant columns or injecting computed data.
2286
+ *
2287
+ * The data is provided via dataInfo which contains the actual values
2288
+ * or reference to where data is stored.
2289
+ *
2290
+ * @template T - Type spec type
2291
+ *
2292
+ * @example
2293
+ * // Create inline column with constant values
2294
+ * {
2295
+ * type: 'inlineColumn',
2296
+ * spec: { axes: ['sample'], columns: ['Int'] },
2297
+ * dataInfo: { ... } // JsonDataInfo object
2298
+ * }
2299
+ */
2300
+ interface QueryInlineColumn<T> {
2301
+ type: "inlineColumn";
2302
+ /** Type specification defining axes and column types */
2303
+ spec: T;
2304
+ /** Data information containing or referencing the actual values */
2305
+ dataInfo: JsonDataInfo;
2306
+ }
2307
+ /**
2308
+ * Sparse to dense column query operation.
2309
+ *
2310
+ * Densifies a sparse column over the Cartesian product of distinct
2311
+ * axis values: `axes` partitions the column's own axes into two sets
2312
+ * (the listed axes on one side, the rest on the other); both sides
2313
+ * contribute their distinct values, and the cross product fills in
2314
+ * the missing tuples (null on rows that have no underlying value).
2315
+ *
2316
+ * **Use case**: graph-maker and other UI surfaces that need a dense
2317
+ * grid to plot.
2318
+ *
2319
+ * **Behavior**:
2320
+ * - Output axes = input axes (no axes are added).
2321
+ * - Missing axis-tuple combinations become null in the output (or
2322
+ * filled later via `pl7.app/graph/isDenseAxis` /
2323
+ * `treatAbsentValuesAs` annotations).
2324
+ *
2325
+ * @template C - Column reference type
2326
+ * @template A - Axis selector type (named selectors at the spec layer,
2327
+ * numeric axis indices at the data layer)
2328
+ * @template SO - Spec override type
2329
+ *
2330
+ * @example
2331
+ * // Spec layer: name the axis to expand across.
2332
+ * {
2333
+ * type: 'sparseToDenseColumn',
2334
+ * column: 'col_abc123',
2335
+ * axes: [{ name: 'sample' }],
2336
+ * specOverride: { ... } // optional spec modifications
2337
+ * }
2338
+ *
2339
+ * @example
2340
+ * // Data layer: the same query after spec→data lowering.
2341
+ * {
2342
+ * type: 'sparseToDenseColumn',
2343
+ * column: 'col_abc123',
2344
+ * axes: [0],
2345
+ * specOverride: { ... }
2346
+ * }
2347
+ */
2348
+ interface QuerySparseToDenseColumn<C, A, SO> {
2349
+ type: "sparseToDenseColumn";
2350
+ /** Column reference (ID or full column object depending on context) */
2351
+ column: C;
2352
+ /** Optional override for the column specification */
2353
+ specOverride?: SO;
2354
+ /**
2355
+ * Axes that participate in the cartesian-product densification.
2356
+ * Named selectors at the spec layer; resolved to numeric axis
2357
+ * indices during spec→data lowering. The Rust runtime also accepts
2358
+ * the legacy field name `axesIndices` as a serde alias.
2359
+ */
2360
+ axes: [A, ...A[]];
2361
+ }
2362
+ /**
2363
+ * Symmetric join query operation (inner join or full outer join).
2364
+ *
2365
+ * Joins multiple queries symmetrically (order doesn't affect result semantics).
2366
+ *
2367
+ * **Inner Join** (`type: 'innerJoin'`):
2368
+ * - Returns only records that exist in ALL entries
2369
+ * - Null join keys don't match, so records with null keys are excluded
2370
+ * - Result contains intersection of all entries by axis keys
2371
+ *
2372
+ * **Full Join** (`type: 'fullJoin'`):
2373
+ * - Returns all records from ALL entries
2374
+ * - Missing values are filled with nulls
2375
+ * - Null join keys create separate groups
2376
+ * - Result contains union of all entries by axis keys
2377
+ *
2378
+ * **Single entry**: Acts as identity (returns entry unchanged).
2379
+ *
2380
+ * @template JE - Join entry type
2381
+ *
2382
+ * @example
2383
+ * // Inner join: only records present in all queries
2384
+ * {
2385
+ * type: 'innerJoin',
2386
+ * entries: [query1Entry, query2Entry, query3Entry]
2387
+ * }
2388
+ *
2389
+ * // Full join: all records from all queries, nulls for missing
2390
+ * {
2391
+ * type: 'fullJoin',
2392
+ * entries: [query1Entry, query2Entry]
2393
+ * }
2394
+ */
2395
+ interface QuerySymmetricJoin<JE extends QueryJoinEntry<unknown>> {
2396
+ /** 'innerJoin' for intersection, 'fullJoin' for union with nulls */
2397
+ type: "innerJoin" | "fullJoin";
2398
+ /** Queries to join (at least one required) */
2399
+ entries: JE[];
2400
+ }
2401
+ /**
2402
+ * Join entry wrapper.
2403
+ *
2404
+ * Wraps a query to be used as an entry in join operations.
2405
+ * The wrapper allows for additional metadata or configuration
2406
+ * on each joined query (e.g., specifying join keys, aliases).
2407
+ *
2408
+ * @template Q - Query type
2409
+ *
2410
+ * @example
2411
+ * // Wrap a query for use in join
2412
+ * { entry: someQuery }
2413
+ */
2414
+ interface QueryJoinEntry<Q> {
2415
+ /** The query to be joined */
2416
+ entry: Q;
2417
+ }
2418
+ /**
2419
+ * Linker-join query operation.
2420
+ *
2421
+ * Inner-joins a linker column (`linker`) with one or more secondary subqueries,
2422
+ * then projects out the linker's one-side axes from the joined result. Used to
2423
+ * traverse a linker relationship: rows on the secondary side are "lifted" onto
2424
+ * the linker's many-side axes, with one-side axes collapsed away.
2425
+ *
2426
+ * Mirrors {@link QueryOuterJoin}'s `{ primary, secondary }` shape (with
2427
+ * `secondary` as an array), but the linker side is a specialized sub-struct —
2428
+ * a plain column reference rather than a full join entry.
2429
+ *
2430
+ * **Join behavior**:
2431
+ * - The linker column is inner-joined with all `secondary` entries
2432
+ * - After the join, the linker's one-side axes are projected out
2433
+ * - Result axes = joined axes minus the linker's one-side axes
2434
+ *
2435
+ * **Note**: `secondary` must contain at least one entry (empty has no
2436
+ * well-defined meaning for linker-join).
2437
+ *
2438
+ * @template L - Linker sub-struct type (layer-specific)
2439
+ * @template JE - Join entry type for the secondary side
2440
+ *
2441
+ * @example
2442
+ * // Traverse linker l1 and read rest data lifted onto l1's many-side
2443
+ * {
2444
+ * type: 'linkerJoin',
2445
+ * linker: { column: 'l1' },
2446
+ * secondary: [{ entry: restQuery, ... }]
2447
+ * }
2448
+ */
2449
+ interface QueryLinkerJoin<L, JE extends QueryJoinEntry<unknown>> {
2450
+ type: "linkerJoin";
2451
+ /** Linker side — column reference plus layer-specific integration data. */
2452
+ linker: L;
2453
+ /** Rest side — one or more subqueries joined with the linker (at least one). */
2454
+ secondary: JE[];
2455
+ }
2456
+ /**
2457
+ * `transformColumns` mode.
2458
+ *
2459
+ * - `"append"` — existing columns pass through; the new columns are
2460
+ * appended.
2461
+ * - `"replace"` — only the listed columns are kept; everything else is
2462
+ * dropped.
2463
+ *
2464
+ * The Rust runtime accepts the legacy `"add"` tag as a serde alias;
2465
+ * new code should emit `"append"`.
2466
+ */
2467
+ type TransformColumnsMode = "append" | "replace";
2468
+ /**
2469
+ * Single column entry for {@link QueryTransformColumns}.
2470
+ *
2471
+ * @template E - Expression type
2472
+ * @template SO - Spec override type (typically `PColumnIdAndSpec` at
2473
+ * the spec layer, or layer-specific id+typespec at the data layer)
2474
+ */
2475
+ interface TransformColumnEntry<E, SO> {
2476
+ /** Expression computing the column values. */
2477
+ expression: E;
2478
+ /**
2479
+ * Optional spec override. If omitted, the runtime auto-derives the
2480
+ * column's spec from the host's input and the expression.
2481
+ * `valueType` is always inferred from the expression.
2482
+ */
2483
+ specOverride?: SO;
2484
+ }
2485
+ /**
2486
+ * Transform-columns query operation.
2487
+ *
2488
+ * Computes one or more derived columns from `input`. Axes are
2489
+ * preserved.
2490
+ *
2491
+ * @template Q - Input query type
2492
+ * @template E - Expression type
2493
+ * @template SO - Spec override type
2494
+ */
2495
+ interface QueryTransformColumns<Q, E, SO> {
2496
+ type: "transformColumns";
2497
+ /** Input query. */
2498
+ input: Q;
2499
+ /** `"append"` to add new columns; `"replace"` to keep only listed columns. */
2500
+ mode: TransformColumnsMode;
2501
+ /** Derived columns to compute (at least one). */
2502
+ columns: [TransformColumnEntry<E, SO>, ...TransformColumnEntry<E, SO>[]];
2503
+ }
2504
+ /**
2505
+ * Spec-override query operation — client-side-only structural node.
2506
+ *
2507
+ * Overlays a {@link SpecOverrides} patch on top of the inner query's spec.
2508
+ * Carries no topological change — it is collapsed at the host boundary
2509
+ * (`resolvePColumn`) before the query reaches pframe-engine. The engine
2510
+ * never sees this node.
2511
+ *
2512
+ * Emitted by `ColumnOverriddenRecipe.getQuery()`; the only currently
2513
+ * supported shape is `specOverride{ input: <plain column ref>, override }`
2514
+ * (i.e. `Overridden<Lazy>`). More complex projections under Overridden are
2515
+ * a future engine work item.
2516
+ *
2517
+ * @template Q - Input query type
2518
+ * @template SO - Spec override type
2519
+ */
2520
+ interface QuerySpecOverride<Q, SO> {
2521
+ type: "specOverride";
2522
+ /** Input query whose spec is to be overridden. */
2523
+ input: Q;
2524
+ /** Spec override patch to overlay on the inner spec. */
2525
+ override: SO;
2526
+ } //#endregion
2527
+ //#endregion
2528
+ //#region ../../../../lib/model/common/dist/drivers/pframe/query/query_data.d.ts
2529
+ //#region src/drivers/pframe/query/query_data.d.ts
2530
+ /**
2531
+ * Column identifier with type specification.
2532
+ *
2533
+ * Pairs a column ID with its full type specification (axes and column types).
2534
+ * Used in data layer to carry type information alongside column references.
2535
+ */
2536
+ type ColumnIdAndTypeSpec = {
2537
+ /** Unique identifier of the column */id: PObjectId; /** Type specification defining the axes and the single column value type */
2538
+ spec: ColumnTypeSpec;
2539
+ };
2540
+ /**
2541
+ * Join entry for data layer queries.
2542
+ *
2543
+ * Extends the base join entry with axes mapping information.
2544
+ * The mapping specifies how axes from this entry align with the joined result.
2545
+ *
2546
+ * @example
2547
+ * // Join entry with axes mapping [0, 2] means:
2548
+ * // - This entry's axis 0 maps to result axis 0
2549
+ * // - This entry's axis 1 maps to result axis 2
2550
+ * { entry: queryData, axesMapping: [0, 2] }
2551
+ */
2552
+ interface DataQueryJoinEntry extends QueryJoinEntry<DataQuery> {
2553
+ /** Maps this entry's axes to the result axes by index */
2554
+ axesMapping: number[];
2555
+ }
2556
+ /** @see QueryColumn */
2557
+ type DataQueryColumn = QueryColumn;
2558
+ /** @see QueryInlineColumn */
2559
+ type DataQueryInlineColumn = QueryInlineColumn<ColumnIdAndTypeSpec>;
2560
+ /** @see QuerySparseToDenseColumn */
2561
+ type DataQuerySparseToDenseColumn = QuerySparseToDenseColumn<PObjectId, number, ColumnIdAndTypeSpec>;
2562
+ /** @see QuerySymmetricJoin */
2563
+ type DataQuerySymmetricJoin = QuerySymmetricJoin<DataQueryJoinEntry>;
2564
+ /** @see QueryOuterJoin */
2565
+ type DataQueryOuterJoin = QueryOuterJoin<DataQueryJoinEntry>;
2566
+ /**
2567
+ * Linker side of a data-layer linker-join.
2568
+ *
2569
+ * Carries the linker column id along with integration-derived artifacts needed
2570
+ * for execution:
2571
+ * - `axesMapping` — how the linker's axes map into the joined result
2572
+ * - `oneSideAxesIndices` — which axis indices in the joined result to project out
2573
+ */
2574
+ type DataQueryLinkerJoinLinker = {
2575
+ /** Linker column reference. */column: PObjectId; /** Linker's axes mapped into the joined result. */
2576
+ axesMapping: number[]; /** Axis indices (in the joined result) to project out — the linker's one-side axes. */
2577
+ oneSideAxesIndices: number[];
2578
+ };
2579
+ /** @see QueryLinkerJoin */
2580
+ type DataQueryLinkerJoin = QueryLinkerJoin<DataQueryLinkerJoinLinker, DataQueryJoinEntry>;
2581
+ /** @see QuerySliceAxes */
2582
+ type DataQuerySliceAxes = QuerySliceAxes<DataQuery, number>;
2583
+ /** @see QuerySort */
2584
+ type DataQuerySort = QuerySort<DataQuery, DataQueryExpression>;
2585
+ /** @see QueryFilter */
2586
+ type DataQueryFilter = QueryFilter<DataQuery, DataQueryBooleanExpression>;
2587
+ /** @see QueryTransformColumns */
2588
+ type DataQueryTransformColumns = QueryTransformColumns<DataQuery, DataQueryExpression, ColumnIdAndTypeSpec>;
2589
+ /**
2590
+ * Union of all data layer query types.
2591
+ *
2592
+ * The data layer operates with numeric indices for axes and columns,
2593
+ * making it suitable for runtime query execution and optimization.
2594
+ *
2595
+ * Includes:
2596
+ * - Leaf nodes: column, inlineColumn, sparseToDenseColumn
2597
+ * - Join operations: innerJoin, fullJoin, outerJoin, linkerJoin
2598
+ * - Transformations: sliceAxes, sort, filter, transformColumns
2599
+ */
2600
+ type DataQuery = DataQueryColumn | DataQueryInlineColumn | DataQuerySparseToDenseColumn | DataQuerySymmetricJoin | DataQueryOuterJoin | DataQueryLinkerJoin | DataQuerySliceAxes | DataQuerySort | DataQueryFilter | DataQueryTransformColumns;
2601
+ /** @see ExprAxisRef */
2602
+ type DataExprAxisRef = ExprAxisRef<number>;
2603
+ /** @see ExprColumnRef */
2604
+ type DataExprColumnRef = ExprColumnRef<number>;
2605
+ 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>;
2606
+ type DataQueryBooleanExpression = InferBooleanExpressionUnion<DataQueryExpression>; //#endregion
2607
+ //#endregion
2608
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec_driver.d.ts
2609
+ //#region src/drivers/pframe/spec_driver.d.ts
2610
+ /** Matches a string value either exactly or by regex pattern */
2611
+ type StringMatcher = {
2612
+ type: "exact";
2613
+ value: string;
2614
+ } | {
2615
+ type: "regex";
2616
+ value: string;
2617
+ };
2618
+ /** Map of key to array of string matchers (OR-ed per key, AND-ed across keys) */
2619
+ type MatcherMap = Record<string, StringMatcher[]>;
2620
+ /** Selector for matching axes by various criteria */
2621
+ interface MultiAxisSelector {
2622
+ /** Match any of the axis types listed here */
2623
+ readonly type?: AxisValueType[];
2624
+ /** Match any of the axis names listed here */
2625
+ readonly name?: StringMatcher[];
2626
+ /** Match requires all the domains listed here */
2627
+ readonly domain?: MatcherMap;
2628
+ /** Match requires all the context domains listed here */
2629
+ readonly contextDomain?: MatcherMap;
2630
+ /** Match requires all the annotations listed here */
2631
+ readonly annotations?: MatcherMap;
2632
+ }
2633
+ /** Column selector for discover columns request, matching columns by various criteria.
2634
+ * Multiple selectors are OR-ed: a column matches if it satisfies any selector. */
2635
+ interface MultiColumnSelector {
2636
+ /** Match any of the value types listed here */
2637
+ readonly type?: ColumnValueType[];
2638
+ /** Match any of the names listed here */
2639
+ readonly name?: StringMatcher[];
2640
+ /** Match requires all the domains listed here */
2641
+ readonly domain?: MatcherMap;
2642
+ /** Match requires all the context domains listed here */
2643
+ readonly contextDomain?: MatcherMap;
2644
+ /** Match requires all the annotations listed here */
2645
+ readonly annotations?: MatcherMap;
2646
+ /** Match any of the axis selectors listed here */
2647
+ readonly axes?: MultiAxisSelector[];
2648
+ /** When true (default), allows matching if only a subset of axes match */
2649
+ readonly partialAxesMatch?: boolean;
2650
+ }
2651
+ /** Qualifications needed for both query (already-integrated) columns and the hit column. */
2652
+ interface ColumnAxesWithQualifications {
2653
+ /** Already integrated (query) columns with their qualifications. */
2654
+ axesSpec: AxisSpec[];
2655
+ /** Qualifications for each already integrated (query) column. */
2656
+ qualifications: AxisQualification[];
2657
+ }
2658
+ /** Fine-grained constraints controlling axes matching and qualification behavior */
2659
+ interface DiscoverColumnsConstraints {
2660
+ /** Allow source (query) axes that have no match in the hit column */
2661
+ allowFloatingSourceAxes: boolean;
2662
+ /** Allow hit column axes that have no match in the source (query) */
2663
+ allowFloatingHitAxes: boolean;
2664
+ /** Allow source (query) axes to be qualified (contextDomain extended) */
2665
+ allowSourceQualifications: boolean;
2666
+ /** Allow hit column axes to be qualified (contextDomain extended) */
2667
+ allowHitQualifications: boolean;
2668
+ }
2669
+ /** Request for discovering columns compatible with a given axes integration */
2670
+ interface DiscoverColumnsRequest {
2671
+ /** Include columns matching these selectors (OR-ed); empty or omitted matches all columns */
2672
+ includeColumns?: MultiColumnSelector[];
2673
+ /** Exclude columns matching these selectors (OR-ed); applied after include filter */
2674
+ excludeColumns?: MultiColumnSelector[];
2675
+ /** Already integrated axes with qualifications */
2676
+ axes: ColumnAxesWithQualifications[];
2677
+ /** Maximum number of hops allowed between provided axes integration and returned hits (0 = direct only) */
2678
+ maxHops?: number;
2679
+ /** Constraints controlling axes matching and qualification behavior */
2680
+ constraints: DiscoverColumnsConstraints;
2681
+ }
2682
+ /** Linker step: traversal through a linker column */
2683
+ interface DiscoverColumnsLinkerStep {
2684
+ type: "linker";
2685
+ /** The linker column traversed in this step */
2686
+ linker: PColumnIdAndSpec;
2687
+ }
2688
+ /**
2689
+ * Filter step: intersects the current subquery with a filter column on shared
2690
+ * axes. Filter columns carry `pl7.app/isSubset: "true"` with axes ⊆ dataset
2691
+ * axes, so the inner-join narrows the key space to rows where the filter is
2692
+ * present.
2693
+ */
2694
+ interface DiscoverColumnsFilterStep {
2695
+ type: "filter";
2696
+ /** The filter column applied in this step */
2697
+ filter: PColumnIdAndSpec;
2698
+ }
2699
+ /** A step traversed during path-based column discovery. Discriminated by `type`. */
2700
+ type DiscoverColumnsStepInfo = DiscoverColumnsLinkerStep | DiscoverColumnsFilterStep;
2701
+ /**
2702
+ * Input to `buildQuery`: a terminal column plus an ordered
2703
+ * path of wrapping steps (linker hops, filter joins). Produces a
2704
+ * {@link SpecQueryJoinEntry} ready to be plugged into an
2705
+ * `innerJoin`/`fullJoin`/`outerJoin` entry list.
2706
+ *
2707
+ * Path ordering: `path[0]` is outermost (first applied), `path[N-1]` is
2708
+ * closest to `column`. Omit or pass `[]` for a direct column with no
2709
+ * wrapping.
2710
+ *
2711
+ * Columns are referenced by id — specs are resolved later at
2712
+ * `evaluateQuery` against the registered specs of the PFrame, so the
2713
+ * caller cannot disagree with the frame about spec content.
2714
+ *
2715
+ * Qualifications annotate the resulting outermost entry; they do not
2716
+ * propagate into the inner query.
2717
+ */
2718
+ type BuildQueryInput = {
2719
+ /** Shape version marker — bumped only on breaking structural changes. */readonly version: "v1"; /** Terminal column id — the column actually returning data. */
2720
+ readonly column: PObjectId; /** Ordered path from source integration to `column`. Outermost first. */
2721
+ readonly path?: DiscoverColumnsStepInfo[]; /** Axis qualifications attached to the resulting join entry. */
2722
+ readonly qualifications?: AxisQualification[];
2723
+ };
2724
+ /** Qualifications info for a discover columns response mapping variant */
2725
+ interface DiscoverColumnsResponseQualifications {
2726
+ /** Qualifications for each query (already-integrated) column set */
2727
+ forQueries: AxisQualification[][];
2728
+ /** Qualifications for the hit column */
2729
+ forHit: AxisQualification[];
2730
+ }
2731
+ /** A single mapping variant describing how a hit column can be integrated */
2732
+ interface DiscoverColumnsMappingVariant {
2733
+ /** Full qualifications needed for integration */
2734
+ qualifications: DiscoverColumnsResponseQualifications;
2735
+ /** Distinctive (minimal) qualifications needed for integration */
2736
+ distinctiveQualifications: DiscoverColumnsResponseQualifications;
2737
+ }
2738
+ /** A single hit in the discover columns response */
2739
+ interface DiscoverColumnsResponseHit {
2740
+ /** The column that was found compatible */
2741
+ hit: PColumnIdAndSpec;
2742
+ /** Linker steps traversed to reach this hit; empty for direct matches */
2743
+ path: DiscoverColumnsStepInfo[];
2744
+ /** Possible ways to integrate this column with the existing set */
2745
+ mappingVariants: DiscoverColumnsMappingVariant[];
2746
+ }
2747
+ /** Response from discover columns */
2748
+ interface DiscoverColumnsResponse {
2749
+ /** Columns that could be integrated and possible ways to integrate them */
2750
+ hits: DiscoverColumnsResponseHit[];
2751
+ }
2752
+ /** Request for deleting an entry from a given axes integration */
2753
+ interface DeleteColumnRequest {
2754
+ /** Already integrated axes with qualifications */
2755
+ axes: ColumnAxesWithQualifications[];
2756
+ /** Zero based index of the entry to be deleted */
2757
+ delete: number;
2758
+ }
2759
+ /** Response from delete column */
2760
+ interface DeleteColumnResponse {
2761
+ axes: ColumnAxesWithQualifications[];
2762
+ }
2763
+ /** Response from evaluating a query against a PFrame. */
2764
+ type EvaluateQueryResponse = {
2765
+ /**
2766
+ * The table specification describing the structure of the query result,
2767
+ * including all axes and columns that will be present in the output.
2768
+ */
2769
+ tableSpec: PTableColumnSpec[];
2770
+ /**
2771
+ * The data layer query representation with numeric indices,
2772
+ * suitable for execution by the data processing engine.
2773
+ */
2774
+ dataQuery: DataQuery;
2775
+ };
2776
+ /** Handle to a spec-only PFrame (no data, synchronous operations). */
2777
+ type SpecFrameHandle = Branded<string, "SpecFrameHandle">;
2778
+ /**
2779
+ * Synchronous driver for spec-level PFrame operations.
2780
+ *
2781
+ * Unlike the async PFrameDriver (which works with data), this driver
2782
+ * operates on column specifications only. All methods are synchronous
2783
+ * because the underlying WASM PFrame computes results immediately.
2784
+ */
2785
+ interface PFrameSpecDriver {
2786
+ /** Create a spec-only PFrame from column specs. Returns a pool entry with handle and unref. */
2787
+ createSpecFrame(specs: Record<string, PColumnSpec>): PoolEntry<SpecFrameHandle>;
2788
+ /** List all columns currently registered in the frame. */
2789
+ listColumns(handle: SpecFrameHandle): PColumnIdAndSpec[];
2790
+ /** Discover columns compatible with given axes integration. */
2791
+ discoverColumns(handle: SpecFrameHandle, request: DiscoverColumnsRequest): DiscoverColumnsResponse;
2792
+ /** Delete an entry from a given axes integration */
2793
+ deleteColumn(handle: SpecFrameHandle, request: DeleteColumnRequest): DeleteColumnResponse;
2794
+ /** Evaluates a query specification against this PFrame */
2795
+ evaluateQuery(handle: SpecFrameHandle, request: SpecQuery): EvaluateQueryResponse;
2796
+ /**
2797
+ * Assembles a {@link SpecQueryJoinEntry} from a terminal column plus an
2798
+ * ordered path of wrapping steps (linker hops, filter joins).
2799
+ *
2800
+ * Pure over its input — no frame handle is needed. Column ids are resolved
2801
+ * later at {@link evaluateQuery} against the registered specs.
2802
+ */
2803
+ buildQuery(input: BuildQueryInput): SpecQueryJoinEntry;
2804
+ /** Expand index-based parentAxes in AxesSpec to resolved AxisId parents in AxesId. */
2805
+ expandAxes(spec: AxesSpec): AxesId;
2806
+ /** Collapse resolved AxisId parents back to index-based parentAxes in AxesSpec. */
2807
+ collapseAxes(ids: AxesId): AxesSpec;
2808
+ /** Find the index of an axis matching the given selector. Returns -1 if not found. */
2809
+ findAxis(spec: AxesSpec, selector: SingleAxisSelector): number;
2810
+ /** Find the flat index of a table column matching the given selector. Returns -1 if not found. */
2811
+ findTableColumn(tableSpec: PTableColumnSpec[], selector: PTableColumnId): number;
2812
+ /**
2813
+ * Upgrades selector-based legacy record filters into index-based data-layer
2814
+ * boolean expressions, resolved against the provided unified table spec
2815
+ * (axes first, then columns).
2816
+ */
2817
+ rewriteLegacyFilters(request: {
2818
+ tableSpec: PTableColumnSpec[];
2819
+ filters: PTableRecordFilter[];
2820
+ }): DataQueryBooleanExpression[];
2821
+ } //#endregion
2822
+ //#endregion
2823
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/selectors.d.ts
2824
+ /** Single axis selector */
2825
+ interface SingleAxisSelector {
2826
+ /** Axis name (required) */
2827
+ name: string;
2828
+ /** Axis type (optional) */
2829
+ type?: AxisValueType;
2830
+ /** Domain requirements (optional) */
2831
+ domain?: Domain;
2832
+ /** Context-domain requirements (optional) */
2833
+ contextDomain?: Domain;
2834
+ /** Parent axes requirements (optional) */
2835
+ parentAxes?: SingleAxisSelector[];
2836
+ }
2837
+ /** Qualification applied to a single axis to make it compatible during integration. */
2838
+ interface AxisQualification {
2839
+ /** Axis selector identifying which axis is qualified. */
2840
+ readonly axis: SingleAxisSelector;
2841
+ /** Additional context domain entries applied to the axis. */
2842
+ readonly contextDomain: Record<string, string>;
2843
+ }
2844
+ /**
2845
+ * Reference to an axis by its numerical index within the anchor column's axes array
2846
+ * Format: [anchorId, axisIndex]
2847
+ */
2848
+ //#endregion
2849
+ //#region ../../../../lib/model/common/dist/drivers/pframe/query/query_spec.d.ts
2850
+ //#region src/drivers/pframe/query/query_spec.d.ts
2851
+ /**
2852
+ * Join entry for spec-layer queries — the base join entry extended with
2853
+ * per-axis domain constraints. Absent `qualifications` is equivalent to `[]`.
2854
+ *
2855
+ * @example
2856
+ * {
2857
+ * entry: querySpec,
2858
+ * qualifications: [{ axis: { name: 'sample' }, contextDomain: { ... } }]
2859
+ * }
2860
+ */
2861
+ type SpecQueryJoinEntry<C = ColumnUniversalId> = QueryJoinEntry<SpecQuery<C>> & {
2862
+ qualifications?: readonly {
2863
+ /** Axis to qualify. */axis: SingleAxisSelector; /** Additional domain constraints for this axis. */
2864
+ contextDomain: Domain;
2865
+ }[];
2866
+ };
2867
+ /** @see QueryColumn */
2868
+ type SpecQueryColumn<C = ColumnUniversalId> = QueryColumn<C>;
2869
+ /** @see QueryInlineColumn */
2870
+ type SpecQueryInlineColumn = QueryInlineColumn<PColumnIdAndSpec>;
2871
+ /** @see QuerySparseToDenseColumn */
2872
+ type SpecQuerySparseToDenseColumn<C = ColumnUniversalId> = QuerySparseToDenseColumn<C, SingleAxisSelector, PColumnIdAndSpec>;
2873
+ /** @see QuerySymmetricJoin */
2874
+ type SpecQuerySymmetricJoin<C = ColumnUniversalId> = QuerySymmetricJoin<SpecQueryJoinEntry<C>>;
2875
+ /** @see QueryOuterJoin */
2876
+ type SpecQueryOuterJoin<C = ColumnUniversalId> = QueryOuterJoin<SpecQueryJoinEntry<C>>;
2877
+ /** @see QueryLinkerJoin */
2878
+ type SpecQueryLinkerJoin<C = ColumnUniversalId> = QueryLinkerJoin<SpecQuery<C>, SpecQueryJoinEntry<C>>;
2879
+ /** @see QuerySliceAxes */
2880
+ type SpecQuerySliceAxes<C = ColumnUniversalId> = QuerySliceAxes<SpecQuery<C>, SingleAxisSelector>;
2881
+ /** @see QuerySort */
2882
+ type SpecQuerySort<C = ColumnUniversalId> = QuerySort<SpecQuery<C>, SpecQueryExpression>;
2883
+ /** @see QueryFilter */
2884
+ type SpecQueryFilter<C = ColumnUniversalId> = QueryFilter<SpecQuery<C>, SpecQueryBooleanExpression>;
2885
+ /** @see QueryTransformColumns */
2886
+ type SpecQueryTransformColumns<C = ColumnUniversalId> = QueryTransformColumns<SpecQuery<C>, SpecQueryExpression, PColumnIdAndSpec>;
2887
+ /**
2888
+ * Client-side spec-override node — collapsed at the host boundary, never
2889
+ * sent to pframe-engine.
2890
+ *
2891
+ * @see QuerySpecOverride
2892
+ */
2893
+ type SpecQuerySpecOverride<C = ColumnUniversalId> = QuerySpecOverride<SpecQuery<C>, SpecOverrides>;
2894
+ /**
2895
+ * Union of all spec layer query types.
2896
+ *
2897
+ * The spec layer operates with named selectors and column IDs,
2898
+ * making it suitable for user-facing query construction and validation.
2899
+ *
2900
+ * @template C - Column reference type. Defaults to PObjectId (ID-only).
2901
+ * Can be parameterized with richer types (e.g., PColumn<Data>) to carry
2902
+ * full column data directly in the query tree.
2903
+ *
2904
+ * Includes:
2905
+ * - Leaf nodes: column, inlineColumn, sparseToDenseColumn
2906
+ * - Join operations: innerJoin, fullJoin, outerJoin, linkerJoin
2907
+ * - Transformations: sliceAxes, sort, filter, transformColumns
2908
+ * - Client-side overlays: specOverride (collapsed before reaching the engine)
2909
+ */
2910
+ 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>;
2911
+ /** @see ExprAxisRef */
2912
+ type SpecExprAxisRef = ExprAxisRef<SingleAxisSelector>;
2913
+ /** @see ExprColumnRef */
2914
+ type SpecExprColumnRef = ExprColumnRef<ColumnUniversalId>;
2915
+ 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>;
2916
+ type SpecQueryBooleanExpression = InferBooleanExpressionUnion<SpecQueryExpression>; //#endregion
2917
+ //#endregion
2918
+ //#region ../../../../lib/model/common/dist/drivers/pframe/table_calculate.d.ts
2919
+ //#region src/drivers/pframe/table_calculate.d.ts
2920
+ /** Defines a terminal column node in the join request tree */
2921
+ interface ColumnJoinEntry<Col> {
2922
+ /** Node type discriminator */
2923
+ readonly type: "column";
2924
+ /** Local column */
2925
+ readonly column: Col;
2926
+ }
2927
+ /**
2928
+ * Axis filter slicing target axis from column axes.
2929
+ * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).
2930
+ * */
2931
+ interface ConstantAxisFilter {
2932
+ /** Filter type discriminator */
2933
+ readonly type: "constant";
2934
+ /** Index of axis to slice (zero-based) */
2935
+ readonly axisIndex: number;
2936
+ /** Equality filter reference value, see {@link SingleValueEqualPredicate} */
2937
+ readonly constant: string | number;
2938
+ }
2939
+ /** Defines a terminal column node in the join request tree */
2940
+ interface SlicedColumnJoinEntry<Col> {
2941
+ /** Node type discriminator */
2942
+ readonly type: "slicedColumn";
2943
+ /** Local column */
2944
+ readonly column: Col;
2945
+ /** New column id */
2946
+ readonly newId: PObjectId;
2947
+ /** Non-empty list of axis filters */
2948
+ readonly axisFilters: ConstantAxisFilter[];
2949
+ }
2950
+ interface ArtificialColumnJoinEntry<Col> {
2951
+ /** Node type discriminator */
2952
+ readonly type: "artificialColumn";
2953
+ /** Column definition */
2954
+ readonly column: Col;
2955
+ /** New column id */
2956
+ readonly newId: PObjectId;
2957
+ /** Indices of axes to pick from the column (zero-based) */
2958
+ readonly axesIndices: number[];
2959
+ }
2960
+ /** Defines a terminal column node in the join request tree */
2961
+ interface InlineColumnJoinEntry {
2962
+ /** Node type discriminator */
2963
+ readonly type: "inlineColumn";
2964
+ /** Column definition */
2965
+ readonly column: PColumn<PColumnValues>;
2966
+ }
2967
+ /**
2968
+ * Defines a join request tree node that will output only records present in
2969
+ * all child nodes ({@link entries}).
2970
+ * */
2971
+ interface InnerJoin<Col> {
2972
+ /** Node type discriminator */
2973
+ readonly type: "inner";
2974
+ /** Child nodes to be inner joined */
2975
+ readonly entries: JoinEntry<Col>[];
2976
+ }
2977
+ /**
2978
+ * Defines a join request tree node that will output all records present at
2979
+ * least in one of the child nodes ({@link entries}), values for those PColumns
2980
+ * that lack corresponding combinations of axis values will be null.
2981
+ * */
2982
+ interface FullJoin<Col> {
2983
+ /** Node type discriminator */
2984
+ readonly type: "full";
2985
+ /** Child nodes to be fully outer joined */
2986
+ readonly entries: JoinEntry<Col>[];
2987
+ }
2988
+ /**
2989
+ * Defines a join request tree node that will output all records present in
2990
+ * {@link primary} child node, and records from the {@link secondary} nodes will
2991
+ * be added to the output only if present, values for those PColumns from the
2992
+ * {@link secondary} list, that lack corresponding combinations of axis values
2993
+ * will be null.
2994
+ *
2995
+ * This node can be thought as a chain of SQL LEFT JOIN operations starting from
2996
+ * the {@link primary} node and adding {@link secondary} nodes one by one.
2997
+ * */
2998
+ interface OuterJoin<Col> {
2999
+ /** Node type discriminator */
3000
+ readonly type: "outer";
3001
+ /** Primes the join operation. Left part of LEFT JOIN. */
3002
+ readonly primary: JoinEntry<Col>;
3003
+ /** Driven nodes, giving their values only if primary node have corresponding
3004
+ * nodes. Right parts of LEFT JOIN chain. */
3005
+ readonly secondary: JoinEntry<Col>[];
3006
+ }
3007
+ /**
3008
+ * Base type of all join request tree nodes. Join request tree allows to combine
3009
+ * information from multiple PColumns into a PTable. Correlation between records
3010
+ * is performed by looking for records with the same values in common axis between
3011
+ * the PColumns. Common axis are those axis which have equal {@link AxisId} derived
3012
+ * from the columns axes spec.
3013
+ * */
3014
+ type JoinEntry<Col> = ColumnJoinEntry<Col> | SlicedColumnJoinEntry<Col> | ArtificialColumnJoinEntry<Col> | InlineColumnJoinEntry | InnerJoin<Col> | FullJoin<Col> | OuterJoin<Col>;
3015
+ /** Container representing whole data stored in specific PTable column. */
3016
+ interface FullPTableColumnData {
3017
+ /** Unified spec */
3018
+ readonly spec: PTableColumnSpec;
3019
+ /** Data */
3020
+ readonly data: PTableVector;
3021
+ }
3022
+ interface SingleValueIsNAPredicate {
3023
+ /** Comparison operator */
3024
+ readonly operator: "IsNA";
3025
+ }
3026
+ interface SingleValueEqualPredicate {
3027
+ /** Comparison operator */
3028
+ readonly operator: "Equal";
3029
+ /** Reference value, NA values will not match */
3030
+ readonly reference: string | number;
3031
+ }
3032
+ interface SingleValueInSetPredicate {
3033
+ /** Comparison operator */
3034
+ readonly operator: "InSet";
3035
+ /** Reference values, NA values will not match */
3036
+ readonly references: (string | number)[];
3037
+ }
3038
+ interface SingleValueIEqualPredicate {
3039
+ /** Comparison operator (case insensitive) */
3040
+ readonly operator: "IEqual";
3041
+ /** Reference value, NA values will not match */
3042
+ readonly reference: string;
3043
+ }
3044
+ interface SingleValueLessPredicate {
3045
+ /** Comparison operator */
3046
+ readonly operator: "Less";
3047
+ /** Reference value, NA values will not match */
3048
+ readonly reference: string | number;
3049
+ }
3050
+ interface SingleValueLessOrEqualPredicate {
3051
+ /** Comparison operator */
3052
+ readonly operator: "LessOrEqual";
3053
+ /** Reference value, NA values will not match */
3054
+ readonly reference: string | number;
3055
+ }
3056
+ interface SingleValueGreaterPredicate {
3057
+ /** Comparison operator */
3058
+ readonly operator: "Greater";
3059
+ /** Reference value, NA values will not match */
3060
+ readonly reference: string | number;
3061
+ }
3062
+ interface SingleValueGreaterOrEqualPredicate {
3063
+ /** Comparison operator */
3064
+ readonly operator: "GreaterOrEqual";
3065
+ /** Reference value, NA values will not match */
3066
+ readonly reference: string | number;
3067
+ }
3068
+ interface SingleValueStringContainsPredicate {
3069
+ /** Comparison operator */
3070
+ readonly operator: "StringContains";
3071
+ /** Reference substring, NA values are skipped */
3072
+ readonly substring: string;
3073
+ }
3074
+ interface SingleValueStringIContainsPredicate {
3075
+ /** Comparison operator (case insensitive) */
3076
+ readonly operator: "StringIContains";
3077
+ /** Reference substring, NA values are skipped */
3078
+ readonly substring: string;
3079
+ }
3080
+ interface SingleValueMatchesPredicate {
3081
+ /** Comparison operator */
3082
+ readonly operator: "Matches";
3083
+ /** Regular expression, NA values are skipped */
3084
+ readonly regex: string;
3085
+ }
3086
+ interface SingleValueStringContainsFuzzyPredicate {
3087
+ /** Comparison operator */
3088
+ readonly operator: "StringContainsFuzzy";
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 SingleValueStringIContainsFuzzyPredicate {
3111
+ /** Comparison operator (case insensitive) */
3112
+ readonly operator: "StringIContainsFuzzy";
3113
+ /** Reference value, NA values are skipped */
3114
+ readonly reference: string;
3115
+ /**
3116
+ * Integer specifying the upper bound of edit distance between
3117
+ * reference and actual value.
3118
+ * When {@link substitutionsOnly} is not defined or set to false
3119
+ * Levenshtein distance is used (substitutions and indels)
3120
+ * @see https://en.wikipedia.org/wiki/Levenshtein_distance
3121
+ * When {@link substitutionsOnly} is set to true
3122
+ * Hamming distance is used (substitutions only)
3123
+ * @see https://en.wikipedia.org/wiki/Hamming_distance
3124
+ */
3125
+ readonly maxEdits: number;
3126
+ /** Changes the type of edit distance in {@link maxEdits} */
3127
+ readonly substitutionsOnly?: boolean;
3128
+ /**
3129
+ * Some character in {@link reference} that will match any
3130
+ * single character in searched text.
3131
+ */
3132
+ readonly wildcard?: string;
3133
+ }
3134
+ interface SingleValueNotPredicateV2 {
3135
+ /** Comparison operator */
3136
+ readonly operator: "Not";
3137
+ /** Operand to negate */
3138
+ readonly operand: SingleValuePredicateV2;
3139
+ }
3140
+ interface SingleValueAndPredicateV2 {
3141
+ /** Comparison operator */
3142
+ readonly operator: "And";
3143
+ /** Operands to combine */
3144
+ readonly operands: SingleValuePredicateV2[];
3145
+ }
3146
+ interface SingleValueOrPredicateV2 {
3147
+ /** Comparison operator */
3148
+ readonly operator: "Or";
3149
+ /** Operands to combine */
3150
+ readonly operands: SingleValuePredicateV2[];
3151
+ }
3152
+ /** Filtering predicate for a single axis or column value */
3153
+ type SingleValuePredicateV2 = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueInSetPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicateV2 | SingleValueAndPredicateV2 | SingleValueOrPredicateV2 | SingleValueIEqualPredicate | SingleValueStringIContainsPredicate | SingleValueStringIContainsFuzzyPredicate;
3154
+ /**
3155
+ * Filter PTable records based on specific axis or column value. If this is an
3156
+ * axis value filter and the axis is part of a partitioning key in some of the
3157
+ * source PColumns, the filter will be pushed down to those columns, so only
3158
+ * specific partitions will be retrieved from the remote storage.
3159
+ * */
3160
+ interface PTableRecordSingleValueFilterV2 {
3161
+ /** Filter type discriminator */
3162
+ readonly type: "bySingleColumnV2";
3163
+ /** Target axis selector to examine values from */
3164
+ readonly column: PTableColumnId;
3165
+ /** Value predicate */
3166
+ readonly predicate: SingleValuePredicateV2;
3167
+ }
3168
+ /** Generic PTable records filter */
3169
+ type PTableRecordFilter = PTableRecordSingleValueFilterV2;
3170
+ /** Sorting parameters for a PTable. */
3171
+ type PTableSorting = {
3172
+ /** Unified column identifier */readonly column: PTableColumnId; /** Sorting order */
3173
+ readonly ascending: boolean; /** Sorting in respect to NA and absent values */
3174
+ readonly naAndAbsentAreLeastValues: boolean;
3175
+ };
3176
+ /** Information required to instantiate a PTable. */
3177
+ interface PTableDef<Col> {
3178
+ /** Join tree to populate the PTable */
3179
+ readonly src: JoinEntry<Col>;
3180
+ /** Partition filters */
3181
+ readonly partitionFilters: PTableRecordFilter[];
3182
+ /** Record filters */
3183
+ readonly filters: PTableRecordFilter[];
3184
+ /** Table sorting */
3185
+ readonly sorting: PTableSorting[];
3186
+ }
3187
+ /** Information required to instantiate a PTable (V2, query-based). */
3188
+ interface PTableDefV2<Col> {
3189
+ /** Pre-built query spec describing joins, filters and sorting */
3190
+ readonly query: SpecQuery<Col>;
3191
+ }
3192
+ /** Request to create and retrieve entirety of data of PTable. */
3193
+ type CalculateTableDataRequest<Col> = {
3194
+ /** Join tree to populate the PTable */readonly src: JoinEntry<Col>; /** Record filters */
3195
+ readonly filters: PTableRecordFilter[]; /** Table sorting */
3196
+ readonly sorting: PTableSorting[];
3197
+ };
3198
+ /** Response for {@link CalculateTableDataRequest} */
3199
+ type CalculateTableDataResponse = FullPTableColumnData[];
3200
+ //#endregion
3201
+ //#region ../../../../lib/model/common/dist/ref.d.ts
3202
+ //#region src/ref.d.ts
3203
+ declare const PlRef: ZodReadonly<ZodObject<{
3204
+ __isRef: ZodLiteral<true>;
3205
+ blockId: ZodString;
3206
+ name: ZodString;
3207
+ requireEnrichments: ZodOptional<ZodLiteral<true>>;
3208
+ }, "strip", ZodTypeAny, {
3209
+ __isRef: true;
3210
+ blockId: string;
3211
+ name: string;
3212
+ requireEnrichments?: true | undefined;
3213
+ }, {
3214
+ __isRef: true;
3215
+ blockId: string;
3216
+ name: string;
3217
+ requireEnrichments?: true | undefined;
3218
+ }>>;
3219
+ type PlRef = TypeOf<typeof PlRef>;
3220
+ /** @deprecated use {@link PlRef} */
3221
+ //#endregion
3222
+ //#region ../../../../lib/model/common/dist/pool/spec.d.ts
3223
+ //#region src/pool/spec.d.ts
3224
+ /** Any object exported into the result pool by the block always have spec attached to it */
3225
+ type PObjectSpec = {
3226
+ /** PObject kind discriminator */readonly kind: string; /** Name is common part of PObject identity */
3227
+ readonly name: string; /** Domain is a set of key-value pairs that can be used to identify the object */
3228
+ readonly domain?: Record<string, string>;
3229
+ /** Context domain provides additional axis/column identity that is matched
3230
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3231
+ readonly contextDomain?: Record<string, string>; /** Additional information attached to the object */
3232
+ readonly annotations?: Record<string, string>;
3233
+ };
3234
+ type LocalPObjectKey = {
3235
+ resolvePath: string[];
3236
+ name: string;
3237
+ };
3238
+ type LocalPObjectId = Branded<CanonicalizedJson<LocalPObjectKey>, "LocalPObjectId">;
3239
+ type GlobalPObjectKey = PlRef;
3240
+ type GlobalPObjectId = Branded<CanonicalizedJson<GlobalPObjectKey>, "GlobalPObjectId">;
3241
+ /** Stable PObject id */
3242
+ type PObjectId = LocalPObjectId | GlobalPObjectId;
3243
+ /**
3244
+ * Full PObject representation.
3245
+ *
3246
+ * @template Data type of the object referencing or describing the "data" part of the PObject
3247
+ * */
3248
+ interface PObject<Data> {
3249
+ /** Fully rendered PObjects are assigned a stable identifier. */
3250
+ readonly id: PObjectId;
3251
+ /** PObject spec, allowing it to be found among other PObjects */
3252
+ readonly spec: PObjectSpec;
3253
+ /** A handle to data object */
3254
+ readonly data: Data;
3255
+ }
3256
+ //#endregion
3257
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/spec.d.ts
3258
+ //#region src/drivers/pframe/spec/spec.d.ts
3259
+ declare const ValueType: {
3260
+ readonly Int: "Int";
3261
+ readonly Long: "Long";
3262
+ readonly Float: "Float";
3263
+ readonly Double: "Double";
3264
+ readonly String: "String";
3265
+ readonly Bytes: "Bytes";
3266
+ };
3267
+ type AxisValueType = Extract<ValueType, "Int" | "Long" | "String">;
3268
+ type ColumnValueType = ValueType;
3269
+ /** PFrame columns and axes within them may store one of these types. */
3270
+ type ValueType = (typeof ValueType)[keyof typeof ValueType];
3271
+ type Metadata = Record<string, string>;
3272
+ declare const Domain: {
3273
+ readonly Alphabet: "pl7.app/alphabet";
3274
+ readonly BlockId: "pl7.app/blockId";
3275
+ readonly VDJ: {
3276
+ readonly Clustering: {
3277
+ readonly BlockId: "pl7.app/vdj/clustering/blockId";
3278
+ };
3279
+ readonly ScClonotypeChain: {
3280
+ readonly Index: "pl7.app/vdj/scClonotypeChain/index";
3281
+ };
3282
+ };
3283
+ };
3284
+ type Domain = Metadata & Partial<{
3285
+ [Domain.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
3286
+ [Domain.BlockId]: string;
3287
+ [Domain.VDJ.ScClonotypeChain.Index]: "primary" | "secondary" | (string & {});
3288
+ }>;
3289
+ /**
3290
+ * Specification of an individual axis.
3291
+ *
3292
+ * Each axis is a part of a composite key that addresses data inside the PColumn.
3293
+ *
3294
+ * Each record inside a PColumn is addressed by a unique tuple of values set for
3295
+ * all the axes specified in the column spec.
3296
+ */
3297
+ type AxisSpec = {
3298
+ /** Type of the axis value. Should not use non-key types like float or double. */readonly type: AxisValueType; /** Name of the axis */
3299
+ readonly name: string;
3300
+ /** Adds auxiliary information to the axis name, type and parents to form a
3301
+ * unique identifier */
3302
+ readonly domain?: Record<string, string>;
3303
+ /** Context domain provides additional axis identity that is matched
3304
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3305
+ readonly contextDomain?: Record<string, string>;
3306
+ /** Any additional information attached to the axis that does not affect its
3307
+ * identifier */
3308
+ readonly annotations?: Record<string, string>;
3309
+ /**
3310
+ * Parent axes provide contextual grouping for the axis in question, establishing
3311
+ * a hierarchy where the current axis is dependent on one or more axes for its
3312
+ * full definition and meaning. For instance, in a data structure where each
3313
+ * "container" axis may contain multiple "item" axes, the `item` axis would
3314
+ * list the index of the `container` axis in this field to denote its dependency.
3315
+ *
3316
+ * This means that the identity or significance of the `item` axis is only
3317
+ * interpretable when combined with its parent `container` axis. An `item` axis
3318
+ * index by itself may be non-unique and only gains uniqueness within the context
3319
+ * of its parent `container`. Therefore, the `parentAxes` field is essential for
3320
+ * mapping these relationships and ensuring data coherence across nested or
3321
+ * multi-level data models.
3322
+ *
3323
+ * A list of zero-based indices of parent axes in the overall axes specification
3324
+ * from the column spec. Each index corresponds to the position of a parent axis
3325
+ * in the list that defines the structure of the data model.
3326
+ */
3327
+ readonly parentAxes?: number[];
3328
+ };
3329
+ /** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
3330
+ /** Common type representing spec for all the axes in a column */
3331
+ type AxesSpec = AxisSpec[];
3332
+ /**
3333
+ * Full column specification including all axes specs and specs of the column
3334
+ * itself.
3335
+ *
3336
+ * A PColumn in its essence represents a mapping from a fixed size, explicitly
3337
+ * typed tuple to an explicitly typed value.
3338
+ *
3339
+ * (axis1Value1, axis2Value1, ...) -> columnValue
3340
+ *
3341
+ * Each element in tuple correspond to the axis having the same index in axesSpec.
3342
+ */
3343
+ type PUniversalColumnSpec = PObjectSpec & {
3344
+ /** Defines specific type of BObject, the most generic type of unit of
3345
+ * information in Platforma Project. */
3346
+ readonly kind: "PColumn"; /** Type of column values */
3347
+ readonly valueType: string; /** Column name */
3348
+ readonly name: string;
3349
+ /** Adds auxiliary information to the axis name, type and parents to form a
3350
+ * unique identifier */
3351
+ readonly domain?: Record<string, string>;
3352
+ /** Context domain provides additional column identity that is matched
3353
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3354
+ readonly contextDomain?: Record<string, string>;
3355
+ /** Any additional information attached to the column that does not affect its
3356
+ * identifier */
3357
+ readonly annotations?: Record<string, string>; /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */
3358
+ readonly parentAxes?: number[]; /** Axes specifications */
3359
+ readonly axesSpec: AxesSpec;
3360
+ };
3361
+ /**
3362
+ * Specification of a data column.
3363
+ *
3364
+ * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)
3365
+ * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex
3366
+ * values like files or other abstract data types. Data columns are optimized for storing and processing
3367
+ * basic tabular data.
3368
+ */
3369
+ type PDataColumnSpec = PUniversalColumnSpec & {
3370
+ /** Type of column values */readonly valueType: ValueType;
3371
+ };
3372
+ type PColumnSpec = PDataColumnSpec;
3373
+ /** Unique PColumnSpec identifier */
3374
+ interface PColumn<Data> extends PObject<Data> {
3375
+ /** PColumn spec, allowing it to be found among other PObjects */
3376
+ readonly spec: PColumnSpec;
3377
+ }
3378
+ /** Columns in a PFrame also have internal identifier, this object represents
3379
+ * combination of specs and such id */
3380
+ interface PColumnIdAndSpec {
3381
+ /** Internal column id within the PFrame */
3382
+ readonly columnId: PObjectId;
3383
+ /** Column spec */
3384
+ readonly spec: PColumnSpec;
3385
+ }
3386
+ /** Get column id and spec from a column */
3387
+ interface AxisId {
3388
+ /** Type of the axis or column value. For an axis should not use non-key
3389
+ * types like float or double. */
3390
+ readonly type: AxisValueType;
3391
+ /** Name of the axis or column */
3392
+ readonly name: string;
3393
+ /** Adds auxiliary information to the axis or column name and type to form a
3394
+ * unique identifier */
3395
+ readonly domain?: Record<string, string>;
3396
+ /** Context domain provides additional axis identity that is matched
3397
+ * by kinship rules (subset/superset/overlap) rather than exact equality */
3398
+ readonly contextDomain?: Record<string, string>;
3399
+ }
3400
+ /** Array of axis ids */
3401
+ type AxesId = AxisId[];
3402
+ /** Extracts axis ids from axis spec */
3403
+ //#endregion
3404
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/filtered_column.d.ts
3405
+ //#region src/drivers/pframe/spec/filtered_column.d.ts
3406
+ /** Value of an axis filter */
3407
+ type AxisFilterValue = number | string;
3408
+ /** Axis filter by index */
3409
+ type AxisFilterByIdx = [number, AxisFilterValue];
3410
+ /** Axis filter by name */
3411
+ /**
3412
+ * `source` is either a leaf {@link PObjectId} or a {@link ColumnDiscoveredId}.
3413
+ * Filtered never nests inside Filtered (flat-merge invariant), and Filtered is
3414
+ * never the outer wrapper around Overridden — Overridden is always outermost.
3415
+ */
3416
+ interface ColumnFilteredKey {
3417
+ __isFiltered: true;
3418
+ source: ColumnUniversalId;
3419
+ axisFilters: AxisFilterByIdx[];
3420
+ }
3421
+ type ColumnFilteredId = Branded<CanonicalizedJson<ColumnFilteredKey>, "ColumnFilteredId">;
3422
+ //#endregion
3423
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/ids.d.ts
3424
+ //#region src/drivers/pframe/spec/ids.d.ts
3425
+ /**
3426
+ * Per-axis patches keyed by positional index in the base spec's `axesSpec`.
3427
+ *
3428
+ * Using position rather than `name` lets us disambiguate linker-style specs
3429
+ * that carry multiple axes with the same `name` differentiated by `domain` /
3430
+ * `contextDomain` (e.g. a `group`, `group/primary`, `group/secondary` triple).
3431
+ *
3432
+ * A patch at index `>= base.axesSpec.length` appends a new axis at that slot.
3433
+ */
3434
+ type AxisPatches = Record<number, Partial<AxisSpec>>;
3435
+ /**
3436
+ * Universal column identifier optionally anchored and optionally filtered.
3437
+ * @deprecated use {@link ColumnUniversalKey}
3438
+ */
3439
+ type ColumnUniversalId = LocalPObjectId | GlobalPObjectId | ColumnFilteredId | ColumnDiscoveredId | ColumnOverriddenId;
3440
+ /**
3441
+ * Canonically serializes a column key to a branded string id. Accepts both
3442
+ * the new {@link ColumnUniversalKey} and the deprecated {@link UniversalPColumnId}
3443
+ * (anchored / old filtered object form).
3444
+ */
3445
+ //#endregion
3446
+ //#region ../../../../lib/model/common/dist/drivers/pframe/spec/discovered_column.d.ts
3447
+ //#region src/drivers/pframe/spec/discovered_column.d.ts
3448
+ interface ColumnDiscoveredKey {
3449
+ __isDiscovered: true;
3450
+ column: ColumnUniversalId;
3451
+ path?: PathItem[];
3452
+ columnQualifications?: AxisQualification[];
3453
+ queriesQualifications?: Record<PObjectId, AxisQualification[]>;
3454
+ }
3455
+ type ColumnDiscoveredId = Branded<CanonicalizedJson<ColumnDiscoveredKey>, "ColumnDiscoveredId">;
3456
+ type PathItem = {
3457
+ type: "linker";
3458
+ column: ColumnUniversalId;
3459
+ };
3460
+ //#endregion
3461
+ //#region ../../../../lib/model/common/dist/drivers/interfaces.d.ts
3462
+ //#region src/drivers/interfaces.d.ts
3463
+ /**
3464
+ * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
3465
+ */
3466
+ interface BlobLike {
3467
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
3468
+ readonly size: number;
3469
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
3470
+ readonly type: string;
3471
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
3472
+ text(): Promise<string>;
3473
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
3474
+ slice(start?: number, end?: number): BlobLike;
3475
+ }
3476
+ /**
3477
+ * Intended to match web.File, node.File, node-fetch.File, etc.
3478
+ */
3479
+ interface FileLike extends BlobLike {
3480
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
3481
+ readonly lastModified: number;
3482
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
3483
+ readonly name: string;
3484
+ } //#endregion
3485
+ //#endregion
3486
+ //#region ../../../../lib/model/common/dist/drivers/blob.d.ts
3487
+ //#region src/drivers/blob.d.ts
3488
+ /** Handle of locally downloaded blob. This handle is issued only after the
3489
+ * blob's content is downloaded locally, and ready for quick access. */
3490
+ type LocalBlobHandle = Branded$1<string, "LocalBlobHandle">;
3491
+ /** Handle of remote blob. This handle is issued as soon as the data becomes
3492
+ * available on the remote server. */
3493
+ type RemoteBlobHandle = Branded$1<string, "RemoteBlobHandle">;
3494
+ /** Being configured inside the output structure provides information about
3495
+ * blob's content and means to retrieve it when needed. */
3496
+ /** Range in bytes, from should be less than to. */
3497
+ declare const RangeBytes: ZodObject<{
3498
+ /** Included left border. */from: ZodNumber; /** Excluded right border. */
3499
+ to: ZodNumber;
3500
+ }, "strip", ZodTypeAny, {
3501
+ from: number;
3502
+ to: number;
3503
+ }, {
3504
+ from: number;
3505
+ to: number;
3506
+ }>;
3507
+ type RangeBytes = TypeOf<typeof RangeBytes>;
3508
+ /** Defines API of blob driver as it is seen from the block UI code. */
3509
+ interface BlobDriver {
3510
+ /**
3511
+ * Given the blob handle returns its content.
3512
+ * Depending on the handle type, content will be served from locally downloaded file,
3513
+ * or directly from remote platforma storage.
3514
+ */
3515
+ getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;
3516
+ }
3517
+ /**
3518
+ * Operational metrics of the blob download driver.
3519
+ */
3520
+ //#endregion
3521
+ //#region ../../../../lib/model/common/dist/drivers/log.d.ts
3522
+ //#region src/drivers/log.d.ts
3523
+ /** Prefix constants — single source of truth for handle format. */
3524
+ declare const LIVE_LOG_PREFIX = "log+live://log/";
3525
+ declare const READY_LOG_PREFIX = "log+ready://log/";
3526
+ /** Handle of the live logs of a program.
3527
+ * The resource that represents a log can be deleted,
3528
+ * in this case the handle should be refreshed. */
3529
+ type LiveLogHandle = Branded$1<`${typeof LIVE_LOG_PREFIX}${string}`, "LiveLogHandle">;
3530
+ /** Handle of the ready logs of a program. */
3531
+ type ReadyLogHandle = Branded$1<`${typeof READY_LOG_PREFIX}${string}`, "ReadyLogHandle">;
3532
+ /** Handle of logs. This handle should be passed
3533
+ * to the driver for retrieving logs. */
3534
+ type AnyLogHandle = LiveLogHandle | ReadyLogHandle;
3535
+ /** Type guard to check if a value is any kind of log handle. */
3536
+ /** Driver to retrieve logs given log handle */
3537
+ interface LogsDriver {
3538
+ lastLines(/** A handle that was issued previously. */
3539
+
3540
+ handle: AnyLogHandle, /** Allows client to limit total data sent from server. */
3541
+
3542
+ lineCount: number,
3543
+ /** Makes streamer to perform seek operation to given offset before sending the contents.
3544
+ * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
3545
+ * If undefined, then starts from the end. */
3546
+
3547
+ offsetBytes?: number,
3548
+ /** Is substring for line search pattern.
3549
+ * This option makes controller to send to the client only lines, that
3550
+ * have given substring. */
3551
+
3552
+ searchStr?: string): Promise<StreamingApiResponse>;
3553
+ readText(/** A handle that was issued previously. */
3554
+
3555
+ handle: AnyLogHandle, /** Allows client to limit total data sent from server. */
3556
+
3557
+ lineCount: number,
3558
+ /** Makes streamer to perform seek operation to given offset before sending the contents.
3559
+ * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
3560
+ * If undefined of 0, then starts from the beginning. */
3561
+
3562
+ offsetBytes?: number,
3563
+ /** Is substring for line search pattern.
3564
+ * This option makes controller to send to the client only lines, that
3565
+ * have given substring. */
3566
+
3567
+ searchStr?: string): Promise<StreamingApiResponse>;
3568
+ }
3569
+ /** Response of the driver.
3570
+ * The caller should give a handle to retrieve it.
3571
+ * It can be OK or outdated, in which case the handle
3572
+ * should be issued again. */
3573
+ type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;
3574
+ type StreamingApiResponseOk = {
3575
+ /** The handle don't have to be updated,
3576
+ * the response is OK. */
3577
+ shouldUpdateHandle: false; /** Whether the log can still grow or it's in a final state. */
3578
+ live: boolean; /** Data of the response, in bytes. */
3579
+ data: Uint8Array; /** Current size of the file. It can grow if it's still live. */
3580
+ size: number; /** Offset in bytes from the beginning of a file. */
3581
+ newOffset: number;
3582
+ };
3583
+ /** The handle should be issued again, this one is done. */
3584
+ type StreamingApiResponseHandleOutdated = {
3585
+ shouldUpdateHandle: true;
3586
+ };
3587
+ //#endregion
3588
+ //#region ../../../../lib/model/common/dist/drivers/pframe/column_filter.d.ts
3589
+ //#region src/drivers/pframe/column_filter.d.ts
3590
+ /** Allows to search multiple columns in different contexts. */
3591
+ interface ColumnFilter {
3592
+ /** Match any of the types listed here. If undefined, will be ignored during
3593
+ * matching. */
3594
+ readonly type?: ValueType[];
3595
+ /** Match any of the names listed here. If undefined, will be ignored during
3596
+ * matching. */
3597
+ readonly name?: string[];
3598
+ /** Match requires all the domains listed here to have corresponding values. */
3599
+ readonly domainValue?: Record<string, string>;
3600
+ /** Match requires all the annotations listed here to have corresponding values. */
3601
+ readonly annotationValue?: Record<string, string>;
3602
+ /** Match requires all the annotations listed here to match corresponding regex
3603
+ * pattern. */
3604
+ readonly annotationPattern?: Record<string, string>;
3605
+ } //#endregion
3606
+ //#endregion
3607
+ //#region ../../../../lib/model/common/dist/drivers/pframe/find_columns.d.ts
3608
+ //#region src/drivers/pframe/find_columns.d.ts
3609
+ /**
3610
+ * Request to search among existing columns in the PFrame. Two filtering
3611
+ * criteria can be used: (1) column ашдеук, to search for columns with
3612
+ * specific properties like name, annotations and domains, and (2) being
3613
+ * compatible with the given list of axis ids.
3614
+ * */
3615
+ interface FindColumnsRequest {
3616
+ /** Basic column filter */
3617
+ readonly columnFilter: ColumnFilter;
3618
+ /** Will only search for columns compatible with these list of axis ids */
3619
+ readonly compatibleWith: AxisId[];
3620
+ /**
3621
+ * Defines what level of compatibility with provided list of axis ids is required.
3622
+ *
3623
+ * If true will search only for such columns which axes completely maps onto the
3624
+ * axes listed in the {@link compatibleWith} list.
3625
+ * */
3626
+ readonly strictlyCompatible: boolean;
3627
+ }
3628
+ /** Response for {@link FindColumnsRequest} */
3629
+ interface FindColumnsResponse {
3630
+ /** Array of column ids found using request criteria. */
3631
+ readonly hits: PColumnIdAndSpec[];
3632
+ } //#endregion
3633
+ //#endregion
3634
+ //#region ../../../../lib/model/common/dist/drivers/pframe/unique_values.d.ts
3635
+ //#region src/drivers/pframe/unique_values.d.ts
3636
+ /** Calculate set of unique values for a specific axis for the filtered set of records */
3637
+ interface UniqueValuesRequest {
3638
+ /** Target axis id */
3639
+ readonly columnId: PObjectId;
3640
+ /** Target axis id, if not specified calculates unique column values */
3641
+ readonly axis?: AxisId;
3642
+ /** Filters to apply before calculating unique values */
3643
+ readonly filters: PTableRecordFilter[];
3644
+ /** Max number of values to return, if reached response will contain overflow flag */
3645
+ readonly limit: number;
3646
+ }
3647
+ interface UniqueValuesResponse {
3648
+ /** Unique values */
3649
+ readonly values: PTableVector;
3650
+ /** True if limit was reached and response contain non-exhaustive list of values. */
3651
+ readonly overflow: boolean;
3652
+ } //#endregion
3653
+ //#endregion
3654
+ //#region ../../../../lib/model/common/dist/drivers/pframe/pframe.d.ts
3655
+ /** Information required to instantiate a PFrame. */
3656
+ type PFrameDef<Col> = Col[]; //#endregion
3657
+ //#endregion
3658
+ //#region ../../../../lib/model/common/dist/drivers/pframe/driver.d.ts
3659
+ //#region src/drivers/pframe/driver.d.ts
3660
+ /** PFrame handle */
3661
+ type PFrameHandle = Branded$1<string, "PFrame">;
3662
+ /** PFrame handle */
3663
+ type PTableHandle = Branded$1<string, "PTable">;
3664
+ /** Model-side PFrame service — creates frames/tables from column definitions. */
3665
+ interface PFrameModelDriver<Col = PColumn<string | PColumnValues | DataInfo<string>>> {
3666
+ createPFrame(def: PFrameDef<Col>): PFrameHandle;
3667
+ createPTable(def: PTableDef<Col>): PTableHandle;
3668
+ createPTableV2(def: PTableDefV2<Col>): PTableHandle;
3669
+ }
3670
+ /** Allows to access main data layer features of platforma */
3671
+ interface PFrameDriver {
3672
+ /**
3673
+ * Finds columns given filtering criteria on column name, annotations etc.
3674
+ * and a set of axes ids to find only columns with compatible specs.
3675
+ * */
3676
+ findColumns(handle: PFrameHandle, request: FindColumnsRequest): Promise<FindColumnsResponse>;
3677
+ /** Retrieve single column spec */
3678
+ getColumnSpec(handle: PFrameHandle, columnId: PObjectId): Promise<PColumnSpec | null>;
3679
+ /** Retrieve information about all columns currently added to the PFrame */
3680
+ listColumns(handle: PFrameHandle): Promise<PColumnIdAndSpec[]>;
3681
+ /** Calculates data for the table and returns complete data representation of it */
3682
+ calculateTableData(handle: PFrameHandle, request: CalculateTableDataRequest<PObjectId>, range?: TableRange): Promise<CalculateTableDataResponse>;
3683
+ /** Calculate set of unique values for a specific axis for the filtered set of records */
3684
+ getUniqueValues(handle: PFrameHandle, request: UniqueValuesRequest): Promise<UniqueValuesResponse>;
3685
+ /** Unified table shape */
3686
+ getShape(handle: PTableHandle): Promise<PTableShape>;
3687
+ /**
3688
+ * Returns ordered array of table axes specs (primary key "columns" in SQL
3689
+ * terms) and data column specs (regular "columns" in SQL terms).
3690
+ *
3691
+ * Data for a specific table column can be retrieved using unified indexing
3692
+ * corresponding to elements in this array.
3693
+ *
3694
+ * Axes are always listed first.
3695
+ * */
3696
+ getSpec(handle: PTableHandle): Promise<PTableColumnSpec[]>;
3697
+ /**
3698
+ * Retrieve the data from the table. To retrieve only data required, it can be
3699
+ * sliced both horizontally ({@link columnIndices}) and vertically
3700
+ * ({@link range}).
3701
+ *
3702
+ * @param columnIndices unified indices of columns to be retrieved
3703
+ * @param range optionally limit the range of records to retrieve
3704
+ * */
3705
+ getData(handle: PTableHandle, columnIndices: number[], range?: TableRange): Promise<PTableVector[]>;
3706
+ /**
3707
+ * Stream the table to a file at the given path. Caller is responsible
3708
+ * for producing the destination path (e.g. via the `Dialog` service).
3709
+ */
3710
+ writePTableToFs(handle: PTableHandle, options: WritePTableToFsOptions): Promise<WritePTableToFsResult>;
3711
+ /**
3712
+ * Export the table to a file. The output format is selected from the file
3713
+ * extension of `options.path` (`csv`, `tsv`, `parquet`, or `xlsx`).
3714
+ *
3715
+ * `options.columnIndices` selects the columns to export (output order). Column
3716
+ * headers are derived on the driver side from each field's label annotation
3717
+ * (falling back to its spec name), so the caller supplies only the path and
3718
+ * the columns.
3719
+ *
3720
+ * For `xlsx` the driver rejects tables whose row count would exceed the
3721
+ * 1,000,000-row per-sheet limit (below Excel's hard cap of 1,048,576).
3722
+ */
3723
+ exportPTable(handle: PTableHandle, options: ExportPTableOptions): Promise<void>;
3724
+ } //#endregion
3725
+ //#endregion
3726
+ //#region ../../../../lib/model/common/dist/drivers/ls.d.ts
3727
+ //#region src/drivers/ls.d.ts
3728
+ type ImportFileHandleUpload = `upload://upload/${string}`;
3729
+ type ImportFileHandleIndex = `index://index/${string}`;
3730
+ type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;
3731
+ type LocalImportFileHandle = Branded$1<ImportFileHandle, "Local">;
3732
+ /** Results in upload */
3733
+ type StorageHandleLocal = `local://${string}`;
3734
+ /** Results in index */
3735
+ type StorageHandleRemote = `remote://${string}`;
3736
+ type StorageHandle = StorageHandleLocal | StorageHandleRemote;
3737
+ type StorageEntry = {
3738
+ /** Stable machine identifier (e.g. "library", "root", "local"). Used for filtering. */id: string; /** Human-readable display name. */
3739
+ name: string;
3740
+ handle: StorageHandle;
3741
+ initialFullPath: string;
3742
+ };
3743
+ type ListFilesResult = {
3744
+ parent?: string;
3745
+ entries: LsEntry[];
3746
+ };
3747
+ type LsEntry = {
3748
+ type: "dir";
3749
+ name: string;
3750
+ fullPath: string;
3751
+ } | {
3752
+ type: "file";
3753
+ name: string;
3754
+ fullPath: string; /** This handle should be set to args... */
3755
+ handle: ImportFileHandle;
3756
+ };
3757
+ type OpenDialogFilter = {
3758
+ /** Human-readable file type name */readonly name: string; /** File extensions */
3759
+ readonly extensions: string[];
3760
+ };
3761
+ type OpenDialogOps = {
3762
+ /** Open dialog window title */readonly title?: string; /** Custom label for the confirmation button, when left empty the default label will be used. */
3763
+ readonly buttonLabel?: string; /** Limits of file types user can select */
3764
+ readonly filters?: OpenDialogFilter[];
3765
+ };
3766
+ type OpenSingleFileResponse = {
3767
+ /** Contains local file handle, allowing file importing or content reading. If user canceled
3768
+ * the dialog, field will be undefined. */
3769
+ readonly file?: LocalImportFileHandle;
3770
+ };
3771
+ type OpenMultipleFilesResponse = {
3772
+ /** Contains local file handles, allowing file importing or content reading. If user canceled
3773
+ * the dialog, field will be undefined. */
3774
+ readonly files?: LocalImportFileHandle[];
3775
+ };
3776
+ /** Can be used to limit request for local file content to a certain bytes range */
3777
+ interface LsDriver {
3778
+ /** remote and local storages */
3779
+ getStorageList(): Promise<StorageEntry[]>;
3780
+ listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;
3781
+ /** Opens system file open dialog allowing to select single file and awaits user action */
3782
+ showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;
3783
+ /** Opens system file open dialog allowing to multiple files and awaits user action */
3784
+ showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;
3785
+ /** Given a handle to a local file, allows to get file size */
3786
+ getLocalFileSize(file: LocalImportFileHandle): Promise<number>;
3787
+ /** Given a handle to a local file, allows to get its content */
3788
+ getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;
3789
+ /**
3790
+ * Resolves browser's File object into platforma's import file handle.
3791
+ *
3792
+ * This method is useful among other things for implementation of UI
3793
+ * components, that handle file Drag&Drop.
3794
+ * */
3795
+ fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;
3796
+ /** Saves currently opened block webview as a PDF. */
3797
+ exportToPdf?(): Promise<void>;
3798
+ }
3799
+ /** Gets a file path from an import handle. */
3800
+ //#endregion
3801
+ //#region ../../../../lib/model/common/dist/columns/column_selector.d.ts
3802
+ //#region src/columns/column_selector.d.ts
3803
+ /** Relaxed string matcher input: plain string, single matcher, or array of mixed. */
3804
+ type RelaxedStringMatchers = string | StringMatcher | (string | StringMatcher)[];
3805
+ /** Relaxed record matcher: values can be plain strings or relaxed matchers. */
3806
+ type RelaxedRecord = Record<string, RelaxedStringMatchers>;
3807
+ /** Relaxed axis selector — accepts plain strings where strict requires StringMatcher[]. */
3808
+ interface RelaxedAxisSelector {
3809
+ name?: RelaxedStringMatchers;
3810
+ type?: AxisValueType | AxisValueType[];
3811
+ domain?: RelaxedRecord;
3812
+ contextDomain?: RelaxedRecord;
3813
+ annotations?: RelaxedRecord;
3814
+ }
3815
+ /** Relaxed column selector — convenient hand-written form. */
3816
+ interface RelaxedColumnSelector {
3817
+ name?: RelaxedStringMatchers;
3818
+ type?: ColumnValueType | ColumnValueType[];
3819
+ domain?: RelaxedRecord;
3820
+ contextDomain?: RelaxedRecord;
3821
+ annotations?: RelaxedRecord;
3822
+ axes?: RelaxedAxisSelector[];
3823
+ partialAxesMatch?: boolean;
3824
+ }
3825
+ /** One or many relaxed column selectors; normalizes to MultiColumnSelector[]. */
3826
+ type ColumnSelector = RelaxedColumnSelector | RelaxedColumnSelector[];
3827
+ //#endregion
3828
+ //#region ../../../../lib/model/common/dist/drivers/columns/discover_columns_options.d.ts
3829
+ //#region src/drivers/columns/discover_columns_options.d.ts
3830
+ /**
3831
+ * Axis matching behaviour applied to `discover` requests.
3832
+ *
3833
+ * - `enrichment` (default) — anchor axes may float over un-mapped hit axes;
3834
+ * used by tooling that "extends" a query.
3835
+ * - `related` — both source and hit axes may float; widest match.
3836
+ * - `exact` — no floating, no qualifications; strict equality.
3837
+ */
3838
+ type MatchingMode = "enrichment" | "related" | "exact";
3839
+ /**
3840
+ * Single entry accepted by `DiscoverColumnsOptions.anchors`. All variants are
3841
+ * trivially JSON-serialisable so the option carrier crosses the
3842
+ * sandbox/host VM bridge unchanged.
3843
+ */
3844
+ type AnchorEntry = PlRef | PObjectId | PColumnSpec | RelaxedColumnSelector;
3845
+ /** Qualifications needed for both already-integrated anchor columns and the hit column. */
3846
+ /**
3847
+ * Options object accepted by sandbox `discoverColumns()` and by the host
3848
+ * `ColumnsCollectionDriver.discover` / `.filter` methods. Pure JSON shape —
3849
+ * no class instances, no closures.
3850
+ */
3851
+ interface DiscoverColumnsOptions {
3852
+ /** Include columns matching these selectors. If omitted, includes all. */
3853
+ include?: ColumnSelector;
3854
+ /** Exclude columns matching these selectors. */
3855
+ exclude?: ColumnSelector;
3856
+ /** Axis matching behavior. Default: 'enrichment'. Ignored if no anchors. */
3857
+ mode?: MatchingMode;
3858
+ /** Anchors enable axis-aware discovery + linker traversal. */
3859
+ anchors?: Record<string, AnchorEntry>;
3860
+ /** Maximum linker hops. Default: 4 when anchors present, 0 otherwise. */
3861
+ maxHops?: number;
3862
+ }
3863
+ /**
3864
+ * Options accepted by `ColumnsCollection.discover` / driver `.discover`.
3865
+ * Traversal scope (`mode`, `maxHops`) must be specified explicitly — the
3866
+ * defaults from {@link DiscoverColumnsOptions} are intentionally surfaced as
3867
+ * required choices at the discovery entrypoint.
3868
+ */
3869
+ type ColumnsDiscoverOptions = DiscoverColumnsOptions;
3870
+ /**
3871
+ * Options accepted by `ColumnsCollection.filter` / driver `.filter`. Traversal
3872
+ * scope is fixed by the source collection, so `mode` / `maxHops` are not part
3873
+ * of the filter surface — only `include` / `exclude` / `anchors`.
3874
+ */
3875
+ type ColumnsFilterOptions = Omit<DiscoverColumnsOptions, "mode" | "maxHops">;
3876
+ /** Translate a {@link MatchingMode} into the boolean-flag form the spec driver consumes. */
3877
+ //#endregion
3878
+ //#region ../../../../lib/model/common/dist/columns/types.d.ts
3879
+ //#region src/columns/types.d.ts
3880
+ /**
3881
+ * Opaque sandbox/host accessor handle.
3882
+ *
3883
+ * Both the sandbox `TreeNodeAccessor.handle` and the host-issued accessor
3884
+ * keys alias this brand — `sdk/model` re-exports the same type so the two
3885
+ * sides stay structurally identical.
3886
+ */
3887
+ type AccessorHandle = Branded$1<string, "AccessorHandle">;
3888
+ /**
3889
+ * Structural subset of {@link FieldTraversalStep} (from `@platforma-sdk/model`)
3890
+ * needed by the host/sandbox column-providers traversal.
3891
+ *
3892
+ * Defined locally so this module does not depend on the sandbox `render`
3893
+ * subtree. Both `TreeNodeAccessor.traverse` (sandbox) and
3894
+ * `PlTreeNodeAccessor.traverse` (host) accept a superset of these fields, so
3895
+ * structural compatibility is preserved.
3896
+ */
3897
+ interface FieldTraversalStepLike {
3898
+ /** Field name */
3899
+ readonly field: string;
3900
+ /** Asserted field type — used by `accessor.traverse` to validate. */
3901
+ readonly assertFieldType?: "Input" | "Output" | "Service" | "OTW" | "Dynamic" | "MTW";
3902
+ /** Don't terminate chain if current resource or field has an error associated. */
3903
+ readonly ignoreError?: true;
3904
+ }
3905
+ /**
3906
+ * Raw entry returned by {@link GlobalCfgRenderCtxMethods.getUpstreamBlockCtx}
3907
+ * on the sandbox side, or by `collectUpstreamBlockCtx` on the host side.
3908
+ * Carries handle ids only — providers wrap them into accessor instances as
3909
+ * needed.
3910
+ *
3911
+ * Generic over the handle type so the same shape backs both:
3912
+ * - sandbox (`AHandle = AccessorHandle`, a `Branded<string, "AccessorHandle">`)
3913
+ * - host (`AHandle = PlTreeNodeAccessor`, the resolved accessor instance)
3914
+ *
3915
+ * Default `AHandle = string` since `AccessorHandle` is a brand on `string` —
3916
+ * the default is safe for the sandbox case.
3917
+ */
3918
+ interface UpstreamBlockCtx<AHandle = string> {
3919
+ blockId: string;
3920
+ prodCtx?: AHandle;
3921
+ stagingCtx?: AHandle;
3922
+ /** True when the `prodCtx` ctx-holder exists but `prodUiCtx` is still rendering. */
3923
+ prodIncomplete?: boolean;
3924
+ /** True when the `stagingCtx` ctx-holder exists but `stagingUiCtx` is still rendering. */
3925
+ stagingIncomplete?: boolean;
3926
+ }
3927
+ /**
3928
+ * Minimal accessor surface used by column-providers / column-registry
3929
+ * traversal.
3930
+ *
3931
+ * Both sandbox `TreeNodeAccessor` and host `PlTreeNodeAccessor` satisfy this
3932
+ * contract directly — `traverse(step)` is defined on both, and the other
3933
+ * members already match by shape. No `resolvePath` member: when canonical
3934
+ * `PObjectId`s are required (local-id construction inside the
3935
+ * outputs/prerun branch), the traversal helpers thread the path explicitly.
3936
+ */
3937
+ interface AccessorLike<Self extends AccessorLike<Self>> {
3938
+ /** Resource type carried by the underlying node (only `.name` is used). */
3939
+ readonly resourceType: {
3940
+ readonly name: string;
3941
+ };
3942
+ /**
3943
+ * Single-step field traversal. Returns `undefined` when the field is
3944
+ * absent / unresolved (with `ignoreError`). Same shape on sandbox and host —
3945
+ * sandbox `TreeNodeAccessor.traverse` is an alias for `resolveAny` and host
3946
+ * `PlTreeNodeAccessor.traverse` is the canonical method.
3947
+ */
3948
+ traverse(step: FieldTraversalStepLike): Self | undefined;
3949
+ /** List input-field names on this node. */
3950
+ listInputFields(): string[];
3951
+ /** Whether the input-field collection on this node is finalized. */
3952
+ getInputsLocked(): boolean;
3953
+ /** Whether this node has a data payload attached. */
3954
+ hasData(): boolean;
3955
+ /** Decode the data payload as JSON. Returns `undefined` if no data. */
3956
+ getDataAsJson<T = unknown>(): T | undefined;
3957
+ }
3958
+ /**
3959
+ * One indexed column — the canonical record produced by every traversal.
3960
+ * Carries everything needed to read spec/data/status under a stable id.
3961
+ *
3962
+ * Generic over the accessor flavour so the same record shape works for both
3963
+ * the sandbox `TreeNodeAccessor` and the host `PlTreeNodeAccessor`.
3964
+ */
3965
+ //#endregion
3966
+ //#region ../../../../lib/model/common/dist/drivers/columns/columns_collection_driver.d.ts
3967
+ //#region src/drivers/columns/columns_collection_driver.d.ts
3968
+ /**
3969
+ * Opaque host-owned handle for a `ColumnsCollection` instance. Issued by
3970
+ * {@link ColumnsCollectionDriver.create}, refcounted by the driver, and
3971
+ * pinned to the active render ctx via the VM injector — sandbox never
3972
+ * sees raw refcounting.
3973
+ */
3974
+ type CollectionHandle = Branded$1<string, "CollectionHandle">;
3975
+ /**
3976
+ * JSON descriptor crossing the VM bridge in place of a sandbox
3977
+ * `ColumnsSource`. Always plain data — no closures, no class instances.
3978
+ *
3979
+ * - `"collection"` – reference another driver-managed collection by handle
3980
+ * (chaining, splicing).
3981
+ * - `"result_pool"` – fan-out into the host's current render ctx upstream
3982
+ * block ctxes. Carries no payload — the host always uses its own pool.
3983
+ * - `"accessor"` – walk the host tree starting at the given accessor
3984
+ * handle from a `path` prefix.
3985
+ * - `"ids"` – pre-resolved id list (sandbox-materialised provider).
3986
+ */
3987
+ type SerializedColumnsSource = {
3988
+ readonly kind: "collection";
3989
+ readonly handle: CollectionHandle;
3990
+ } | {
3991
+ readonly kind: "result_pool";
3992
+ } | {
3993
+ readonly kind: "accessor";
3994
+ readonly accessor: AccessorHandle;
3995
+ readonly path: string[];
3996
+ } | {
3997
+ readonly kind: "ids";
3998
+ readonly ids: ColumnUniversalId[];
3999
+ readonly isFinal: boolean;
4000
+ };
4001
+ /**
4002
+ * Per-call host bindings the driver needs to resolve sources whose
4003
+ * shape references render-ctx state (`"accessor"`, `"result_pool"`).
4004
+ *
4005
+ * The VM injector inside `pl-middle-layer` supplies these on every call;
4006
+ * UI-side direct callers that only build collections out of `"ids"` /
4007
+ * `"collection"` sources may omit the bindings entirely.
4008
+ *
4009
+ * Parameterised on the concrete accessor flavour so host implementations
4010
+ * keep their static types (e.g. `PlTreeNodeAccessor`) without leaking that
4011
+ * dependency into `@milaboratories/pl-model-common`.
4012
+ */
4013
+ interface ColumnsCollectionDriverHost<A extends AccessorLike<A> = AccessorLike<any>> {
4014
+ /** Resolve an {@link AccessorHandle} to the host's concrete accessor. */
4015
+ resolveAccessor(handle: AccessorHandle): A;
4016
+ /** Snapshot of upstream-block ctx pairs from the current render ctx. */
4017
+ getUpstreamBlockCtxes(): ReadonlyArray<UpstreamBlockCtx<A>>;
4018
+ /**
4019
+ * Per-call spec driver. The injector supplies the active render ctx's
4020
+ * `PFrameSpec` service; `discover` / `filter` use it to build a spec
4021
+ * frame and run a single discovery query.
4022
+ */
4023
+ getSpecDriver(): PFrameSpecDriver;
4024
+ /**
4025
+ * Resolve the canonical {@link PColumnSpec} for a leaf {@link PObjectId}.
4026
+ * Returns `undefined` when the id is not present in the active registry
4027
+ * (e.g. handed to the driver via a `{kind:"ids"}` source whose underlying
4028
+ * column has since left the visible scope). Override-wrapped ids are
4029
+ * unwrapped by the caller — this method only resolves the underlying leaf.
4030
+ */
4031
+ resolveSpec(id: PObjectId): PColumnSpec | undefined;
4032
+ }
4033
+ /**
4034
+ * Sandbox / UI view of the `ColumnsCollection` driver. Same methods as
4035
+ * {@link ColumnsCollectionDriver}, but the `host` parameters are dropped —
4036
+ * the VM bridge / UI wrapper supplies them on every call so callers only
4037
+ * pass plain data (handles + source descriptors + option objects).
4038
+ *
4039
+ * `getService("columnsCollection")` returns a value of this shape on both
4040
+ * sandbox and UI sides.
4041
+ */
4042
+ interface ColumnsCollectionDriverModel {
4043
+ /** Build a fresh collection from the supplied source descriptors. */
4044
+ create(sources: ReadonlyArray<SerializedColumnsSource>): CollectionHandle;
4045
+ /** Whether the collection currently exposes zero columns. */
4046
+ isEmpty(handle: CollectionHandle): boolean;
4047
+ /** Whether enumeration is finalised across every contributing source. */
4048
+ isFinal(handle: CollectionHandle): boolean;
4049
+ /** Canonical id list for the columns visible through this collection. */
4050
+ getColumns(handle: CollectionHandle): ColumnUniversalId[];
4051
+ /** Append one or more sources and return a fresh collection handle. */
4052
+ addSource(handle: CollectionHandle, sources: ReadonlyArray<SerializedColumnsSource>): CollectionHandle;
4053
+ /** Anchored/selector-driven discovery. Returns a fresh handle. */
4054
+ discover(handle: CollectionHandle, options: ColumnsDiscoverOptions): CollectionHandle;
4055
+ /** Selector-only filter (no anchor traversal). Returns a fresh handle. */
4056
+ filter(handle: CollectionHandle, options: ColumnsFilterOptions): CollectionHandle;
4057
+ }
4058
+ /**
4059
+ * Synchronous host-side driver for `ColumnsCollection` operations. All
4060
+ * collection state lives on the host side, addressable through opaque
4061
+ * {@link CollectionHandle}s. Every handle-minting method returns a
4062
+ * {@link PoolEntry} so callers can wire the refcount into their own
4063
+ * lifecycle; the VM bridge pins each entry to the active render ctx and
4064
+ * forwards only the handle string to sandbox.
4065
+ *
4066
+ * Sandbox / UI callers consume {@link ColumnsCollectionDriverModel}
4067
+ * instead; the bridge maps that surface onto this one by injecting
4068
+ * {@link ColumnsCollectionDriverHost} bindings.
4069
+ */
4070
+ interface ColumnsCollectionDriver {
4071
+ create(sources: ReadonlyArray<SerializedColumnsSource>, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4072
+ isEmpty(handle: CollectionHandle): boolean;
4073
+ isFinal(handle: CollectionHandle): boolean;
4074
+ getColumns(handle: CollectionHandle, host: ColumnsCollectionDriverHost): ColumnUniversalId[];
4075
+ addSource(handle: CollectionHandle, sources: ReadonlyArray<SerializedColumnsSource>, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4076
+ discover(handle: CollectionHandle, options: ColumnsDiscoverOptions, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4077
+ filter(handle: CollectionHandle, options: ColumnsFilterOptions, host: ColumnsCollectionDriverHost): PoolEntry<CollectionHandle>;
4078
+ } //#endregion
4079
+ //#endregion
4080
+ //#region ../../../../lib/model/common/dist/services/service_types.d.ts
4081
+ //#region src/services/service_types.d.ts
4082
+ type ServiceTypesLike<Model = unknown, Ui = unknown, Kind extends ServiceType = ServiceType, ModelHost = Model, UiHost = Ui> = {
4083
+ readonly __types?: {
4084
+ model: Model;
4085
+ ui: Ui;
4086
+ kind: Kind;
4087
+ modelHost: ModelHost;
4088
+ uiHost: UiHost;
4089
+ };
4090
+ };
4091
+ type InferServiceUi<S extends ServiceTypesLike> = S extends ServiceTypesLike<unknown, infer U, ServiceType, unknown, unknown> ? U : unknown;
4092
+ type ServiceName<S extends ServiceTypesLike = ServiceTypesLike> = Branded$1<string, S>;
4093
+ type ServiceType = "node" | "wasm" | "main";
4094
+ type ServiceBrand<T> = T extends Branded$1<string, infer S extends ServiceTypesLike> ? S : never;
4095
+ /** Contract between any service provider and any service consumer. */
4096
+ interface ServiceDispatch {
4097
+ getServiceNames(): ServiceName[];
4098
+ getServiceMethods(serviceId: ServiceName): string[];
4099
+ callServiceMethod(serviceId: ServiceName, method: string, ...args: unknown[]): unknown;
4100
+ }
4101
+ type TServices = typeof Services;
4102
+ type ExtractServiceName<T> = T extends Branded$1<infer N extends string, any> ? N : never;
4103
+ /** Model-side service interfaces keyed by service name literal. */
4104
+ /** UI-side service interfaces keyed by service name literal. */
4105
+ type UiServices$1 = { [K in keyof TServices as ExtractServiceName<TServices[K]>]: InferServiceUi<ServiceBrand<TServices[K]>> };
4106
+ /** Map from Services keys to their unbranded string name literals. */
4107
+ type ServiceNameLiterals = { [K in keyof TServices]: ExtractServiceName<TServices[K]> };
4108
+ /** Auto-derived requires* feature flags from Services keys. */
4109
+ type ServiceRequireFlags = { [K in keyof TServices as `requires${K & string}`]?: boolean };
4110
+ //#endregion
4111
+ //#region ../../../../lib/model/common/dist/services/service_declarations.d.ts
4112
+ //#region src/services/service_declarations.d.ts
4113
+ declare const Services: {
4114
+ PFrameSpec: Branded$1<"pframeSpec", ServiceTypesLike<PFrameSpecDriver, PFrameSpecDriver, "wasm", PFrameSpecDriver, PFrameSpecDriver>>;
4115
+ PFrame: Branded$1<"pframe", ServiceTypesLike<PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver, "node", PFrameModelDriver<PColumn<string | PColumnValues | DataInfo<string>>>, PFrameDriver>>;
4116
+ Dialog: Branded$1<"dialog", ServiceTypesLike<Record<string, never>, DialogService, "main", Record<string, never>, DialogService>>;
4117
+ ColumnsCollection: Branded$1<"columnsCollection", ServiceTypesLike<ColumnsCollectionDriverModel, ColumnsCollectionDriverModel, "wasm", ColumnsCollectionDriver, ColumnsCollectionDriver>>;
4118
+ }; //#endregion
4119
+ //#endregion
4120
+ //#region ../../../../lib/model/common/dist/flags/block_flags.d.ts
4121
+ /**
4122
+ * Known block flags. Flags are set during model compilation, see `BlockModel.create` for more details and for initial values.
4123
+ */
4124
+ type BlockCodeKnownFeatureFlags = {
4125
+ readonly supportsLazyState?: boolean;
4126
+ readonly supportsPframeQueryRanking?: boolean;
4127
+ readonly requiresModelAPIVersion?: number;
4128
+ readonly requiresUIAPIVersion?: number;
4129
+ readonly requiresCreatePTable?: number;
4130
+ readonly requiresPFramesVersion?: number;
4131
+ } & ServiceRequireFlags;
4132
+ /**
4133
+ * Required PFrames version. Bump this in lockstep with the `@milaboratories/pframes-rs-*`
4134
+ * version in `pnpm-workspace.yaml` so blocks built against the new SDK refuse to load on
4135
+ * older desktop apps.
4136
+ */
4137
+ //#endregion
4138
+ //#region ../../../../lib/model/common/dist/driver_kit.d.ts
4139
+ //#region src/driver_kit.d.ts
4140
+ /** Set of all drivers exposed in UI SDK via the platforma object. */
4141
+ interface DriverKit {
4142
+ /** Driver allowing to retrieve blob data */
4143
+ readonly blobDriver: BlobDriver;
4144
+ /** Driver allowing to dynamically work with logs */
4145
+ readonly logDriver: LogsDriver;
4146
+ /**
4147
+ * Driver allowing to list local and remote files that current user has
4148
+ * access to.
4149
+ *
4150
+ * Along with file listing this driver provides import handles for listed
4151
+ * files, that can be communicated to the workflow via block arguments,
4152
+ * converted into blobs using standard workflow library functions.
4153
+ * */
4154
+ readonly lsDriver: LsDriver;
4155
+ /** Driver allowing to interact with PFrames and PTables */
4156
+ readonly pFrameDriver: PFrameDriver;
4157
+ } //#endregion
4158
+ //#endregion
4159
+ //#region ../../../../lib/model/common/dist/errors.d.ts
4160
+ type ResultOrError<S, F = Error> = {
4161
+ value: S;
4162
+ error?: undefined;
4163
+ } | {
4164
+ error: F;
4165
+ };
4166
+ //#endregion
4167
+ //#region ../../../../lib/model/common/dist/utag.d.ts
4168
+ //#region src/utag.d.ts
4169
+ /** Value returned for changing states supporting reactive listening for changes */
4170
+ interface ValueWithUTag<V> {
4171
+ /** Value snapshot. */
4172
+ readonly value: V;
4173
+ /**
4174
+ * Unique tag for the value snapshot.
4175
+ *
4176
+ * It can be used to synchronously detect if changes happened after current
4177
+ * snapshot was retrieved, or asynchronously await next value snapshot,
4178
+ * generated on underlying data changes.
4179
+ * */
4180
+ readonly uTag: string;
4181
+ }
4182
+ interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
4183
+ readonly author?: AuthorMarker;
4184
+ } //#endregion
4185
+ //#endregion
4186
+ //#region ../../../../sdk/model/dist/block_state_patch.d.ts
4187
+ //#region src/block_state_patch.d.ts
4188
+ /** Patch for the structural object */
4189
+ type Patch<K, V> = {
4190
+ /** Field name to patch */readonly key: K; /** New value for the field */
4191
+ readonly value: V;
4192
+ };
4193
+ /** Creates union type of all possible shallow patches for the given structure */
4194
+ type Unionize<T extends Record<string, unknown>> = { [K in keyof T]: Patch<K, T[K]> }[keyof T];
4195
+ /** Patch for the BlockState, pushed by onStateUpdates method in SDK. */
4196
+ type BlockStatePatch<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> = Unionize<BlockState<Args, Outputs, UiState, Href>>; //#endregion
4197
+ //#endregion
4198
+ //#region ../../../../sdk/model/dist/plugin_handle.d.ts
4199
+ //#region src/plugin_handle.d.ts
4200
+ /**
4201
+ * Phantom-only base type for constraining PluginHandle's type parameter.
4202
+ *
4203
+ * PluginFactory has create() → PluginInstance with function properties, making it invariant
4204
+ * under strictFunctionTypes. PluginFactoryLike exposes only the covariant `__types` phantom,
4205
+ * avoiding the contravariance chain. Handles only need `__types` for type extraction.
4206
+ *
4207
+ * PluginFactory extends PluginFactoryLike, so every concrete factory satisfies this constraint.
4208
+ */
4209
+ 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> {
4210
+ readonly __types?: {
4211
+ data: Data;
4212
+ params: Params;
4213
+ outputs: Outputs;
4214
+ modelServices: ModelServices;
4215
+ uiServices: UiServices;
4216
+ };
4217
+ }
4218
+ /** Extract the Data type from a PluginFactoryLike phantom. */
4219
+ /**
4220
+ * Opaque handle for a plugin instance. Runtime value is the plugin instance ID string.
4221
+ * Branded with factory phantom `F` for type-safe data/outputs extraction.
4222
+ * Constrained with PluginFactoryLike (not PluginFactory) to avoid variance issues.
4223
+ */
4224
+ type PluginHandle<F extends PluginFactoryLike = PluginFactoryLike> = Branded<string, F>;
4225
+ /** Construct the output key for a plugin output in the block outputs map. */
4226
+ //#endregion
4227
+ //#region ../../../../sdk/model/dist/block_storage.d.ts
4228
+ /** Payload for storage mutation operations. SDK defines specific operations. */
4229
+ type MutateStoragePayload<T = unknown> = {
4230
+ operation: "update-block-data";
4231
+ value: T;
4232
+ } | {
4233
+ operation: "update-plugin-data";
4234
+ pluginId: PluginHandle;
4235
+ value: unknown;
4236
+ };
4237
+ /**
4238
+ * Updates the data in BlockStorage (immutable)
4239
+ *
4240
+ * @param storage - The current BlockStorage
4241
+ * @param payload - The update payload with operation and value
4242
+ * @returns A new BlockStorage with updated data
4243
+ */
4244
+ //#endregion
4245
+ //#region ../../../../sdk/model/dist/bconfig/lambdas.d.ts
4246
+ /** Additional information that may alter lambda rendering procedure. */
4247
+ type ConfigRenderLambdaFlags = {
4248
+ /**
4249
+ * Tells the system that corresponding computable should be created with StableOnlyRetentive rendering mode.
4250
+ * This flag can be overridden by the system.
4251
+ * */
4252
+ retentive?: boolean;
4253
+ /**
4254
+ * Tells the system that resulting computable has important side-effects, thus it's rendering is required even
4255
+ * nobody is actively monitoring rendered values. Like file upload progress, that triggers upload itself.
4256
+ * */
4257
+ isActive?: boolean;
4258
+ /**
4259
+ * If true, result will be wrapped with additional status information,
4260
+ * such as stability status and explicit error
4261
+ */
4262
+ withStatus?: boolean;
4263
+ };
4264
+ /** Creates branded Cfg type */
4265
+ interface ConfigRenderLambda<Return = unknown> extends ConfigRenderLambdaFlags {
4266
+ /** Type marker */
4267
+ __renderLambda: true;
4268
+ /** Phantom property for type inference. Never set at runtime. */
4269
+ __phantomReturn?: Return;
4270
+ /** Reference to a callback registered inside the model code. */
4271
+ handle: string;
4272
+ }
4273
+ type ExtractFunctionHandleReturn<Func extends ConfigRenderLambda> = Func extends ConfigRenderLambda<infer Return> ? Return : never;
4274
+ /** Infers the output type from a TypedConfig or ConfigRenderLambda */
4275
+ /** Maps lambda-only outputs configuration to inferred output types (for V3 blocks) */
4276
+ type InferOutputsFromLambdas<OutputsCfg extends Record<string, ConfigRenderLambda>> = { [Key in keyof OutputsCfg]: OutputWithStatus<ExtractFunctionHandleReturn<OutputsCfg[Key]>> & {
4277
+ __unwrap: OutputsCfg[Key] extends {
4278
+ withStatus: true;
4279
+ } ? false : true;
4280
+ } }; //#endregion
4281
+ //#endregion
4282
+ //#region ../../../../sdk/model/dist/block_api_v1.d.ts
4283
+ //#region src/block_api_v1.d.ts
4284
+ /** Returned by state subscription methods to be able to cancel the subscription. */
4285
+ type CancelSubscription = () => void;
4286
+ /** Defines methods to read and write current block data. */
4287
+ interface BlockApiV1<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> {
4288
+ /**
4289
+ * Use this method to retrieve block state during UI initialization. Then use
4290
+ * {@link onStateUpdates} method to subscribe for updates.
4291
+ * */
4292
+ loadBlockState(): Promise<BlockState<Args, Outputs, UiState, Href>>;
4293
+ /**
4294
+ * Subscribe to updates of block state.
4295
+ *
4296
+ * This method internally have several ways to limit the rate at which new
4297
+ * states are pushed to the corresponding callback. Among other rate limiting
4298
+ * approaches it guarantees that new state will never be pushed to the
4299
+ * supplied async callback until the previous call returns.
4300
+ *
4301
+ * It is a good idea to develop the callback in such a way that it will wait
4302
+ * until the given state propagates all the way to the DOM. See for example
4303
+ * nextTick() method from Vue framework to achieve this.
4304
+ *
4305
+ * This method will only push args and uiState patches if changes were made
4306
+ * externally, i.e. by another user editing the same block.
4307
+ *
4308
+ * @return function that cancels created subscription
4309
+ * */
4310
+ onStateUpdates(cb: (updates: BlockStatePatch<Args, Outputs, UiState, Href>[]) => Promise<void>): CancelSubscription;
4311
+ /**
4312
+ * Sets block args.
4313
+ *
4314
+ * This method returns when corresponding arguments are safely saved so in
4315
+ * case the window is closed there will be no information losses. This
4316
+ * function under the hood may delay actual persistence of the supplied
4317
+ * arguments.
4318
+ * */
4319
+ setBlockArgs(args: Args): Promise<void>;
4320
+ /**
4321
+ * Sets block ui state.
4322
+ *
4323
+ * This method returns when corresponding arguments are safely saved so in
4324
+ * case the window is closed there will be no information losses. This
4325
+ * function under the hood may delay actual persistence of the supplied
4326
+ * values.
4327
+ * */
4328
+ setBlockUiState(state: UiState): Promise<void>;
4329
+ /**
4330
+ * Sets block args and ui state.
4331
+ *
4332
+ * This method returns when corresponding arguments are safely saved so in
4333
+ * case the window is closed there will be no information losses. This
4334
+ * function under the hood may delay actual persistence of the supplied
4335
+ * values.
4336
+ * */
4337
+ setBlockArgsAndUiState(args: Args, state: UiState): Promise<void>;
4338
+ /**
4339
+ * Sets block navigation state.
4340
+ * */
4341
+ setNavigationState(state: NavigationState<Href>): Promise<void>;
4342
+ } //#endregion
4343
+ //#endregion
4344
+ //#region ../../../../node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.d.ts
4345
+ declare type Operation = AddOperation<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;
4346
+ interface BaseOperation {
4347
+ path: string;
4348
+ }
4349
+ interface AddOperation<T> extends BaseOperation {
4350
+ op: 'add';
4351
+ value: T;
4352
+ }
4353
+ interface RemoveOperation extends BaseOperation {
4354
+ op: 'remove';
4355
+ }
4356
+ interface ReplaceOperation<T> extends BaseOperation {
4357
+ op: 'replace';
4358
+ value: T;
4359
+ }
4360
+ interface MoveOperation extends BaseOperation {
4361
+ op: 'move';
4362
+ from: string;
4363
+ }
4364
+ interface CopyOperation extends BaseOperation {
4365
+ op: 'copy';
4366
+ from: string;
4367
+ }
4368
+ interface TestOperation<T> extends BaseOperation {
4369
+ op: 'test';
4370
+ value: T;
4371
+ }
4372
+ interface GetOperation<T> extends BaseOperation {
4373
+ op: '_get';
4374
+ value: T;
4375
+ }
4376
+ //#endregion
4377
+ //#region ../../../../sdk/model/dist/block_api_v2.d.ts
4378
+ //#region src/block_api_v2.d.ts
4379
+ /** Defines methods to read and write current block data. */
4380
+ interface BlockApiV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> {
4381
+ /**
4382
+ * Use this method to retrieve block state during UI initialization. Then use
4383
+ * {@link onStateUpdates} method to subscribe for updates.
4384
+ * */
4385
+ loadBlockState(): Promise<ResultOrError<ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>>>;
4386
+ /**
4387
+ * Get all json patches (rfc6902) that were applied to the block state.
4388
+ * */
4389
+ getPatches(uTag: string): Promise<ResultOrError<ValueWithUTagAndAuthor<Operation[]>>>;
4390
+ /**
4391
+ * Sets block args.
4392
+ *
4393
+ * This method returns when corresponding arguments are safely saved so in
4394
+ * case the window is closed there will be no information losses. This
4395
+ * function under the hood may delay actual persistence of the supplied
4396
+ * arguments.
4397
+ * */
4398
+ setBlockArgs(args: Args, author?: AuthorMarker): Promise<ResultOrError<void>>;
4399
+ /**
4400
+ * Sets block ui state.
4401
+ *
4402
+ * This method returns when corresponding arguments are safely saved so in
4403
+ * case the window is closed there will be no information losses. This
4404
+ * function under the hood may delay actual persistence of the supplied
4405
+ * values.
4406
+ * */
4407
+ setBlockUiState(state: UiState, author?: AuthorMarker): Promise<ResultOrError<void>>;
4408
+ /**
4409
+ * Sets block args and ui state.
4410
+ *
4411
+ * This method returns when corresponding arguments are safely saved so in
4412
+ * case the window is closed there will be no information losses. This
4413
+ * function under the hood may delay actual persistence of the supplied
4414
+ * values.
4415
+ * */
4416
+ setBlockArgsAndUiState(args: Args, state: UiState, author?: AuthorMarker): Promise<ResultOrError<void>>;
4417
+ /**
4418
+ * Sets block navigation state.
4419
+ * */
4420
+ setNavigationState(state: NavigationState<Href>): Promise<ResultOrError<void>>;
4421
+ /**
4422
+ * Disposes the block API.
4423
+ * */
4424
+ dispose(): Promise<ResultOrError<void>>;
4425
+ } //#endregion
4426
+ //#endregion
4427
+ //#region ../../../../sdk/model/dist/version.d.ts
4428
+ type SdkInfo = {
4429
+ readonly sdkVersion: string;
4430
+ };
4431
+ //#endregion
4432
+ //#region ../../../../sdk/model/dist/services/block_services.d.ts
4433
+ //#region src/services/block_services.d.ts
4434
+ /**
4435
+ * Services required by all V3 blocks by default.
4436
+ * Edit this when a new service should be available to all blocks.
4437
+ *
4438
+ * Standalone module to avoid circular dependencies between block_model.ts
4439
+ * and service type resolution.
4440
+ */
4441
+ declare const BLOCK_SERVICE_FLAGS: {
4442
+ readonly requiresPFrameSpec: true;
4443
+ readonly requiresPFrame: true;
4444
+ readonly requiresDialog: true;
4445
+ readonly requiresColumnsCollection: true;
4446
+ };
4447
+ type BlockServiceFlags = typeof BLOCK_SERVICE_FLAGS;
4448
+ //#endregion
4449
+ //#region ../../../../sdk/model/dist/services/service_resolve.d.ts
4450
+ //#region src/services/service_resolve.d.ts
4451
+ type FlagToName<Flag extends string> = Flag extends `requires${infer K}` ? K extends keyof ServiceNameLiterals ? ServiceNameLiterals[K] : never : never;
4452
+ type RequiredServiceNames<Flags> = { [K in keyof Flags & `requires${string}`]: Flags[K] extends true ? FlagToName<K & string> : never }[keyof Flags & `requires${string}`];
4453
+ type ResolveUiServices<Flags> = Pick<UiServices$1, RequiredServiceNames<Flags> & keyof UiServices$1>;
4454
+ type BlockDefaultUiServices = ResolveUiServices<BlockServiceFlags>; //#endregion
4455
+ //#endregion
4456
+ //#region ../../../../sdk/model/dist/plugin_model.d.ts
4457
+ /**
4458
+ * Runtime definition for a single public output field.
4459
+ * Stored in PluginModel and passed through BlockModelInfo to the UI layer.
4460
+ */
4461
+ type PublicOutputFieldDef = {
4462
+ readonly getter: (data: unknown) => unknown;
4463
+ };
4464
+ //#endregion
4465
+ //#region ../../../../sdk/model/dist/block_api_v3.d.ts
4466
+ //#region src/block_api_v3.d.ts
4467
+ /** Defines methods to read and write current block data. */
4468
+ interface BlockApiV3<_Data = unknown, _Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, Href extends `/${string}` = `/${string}`> {
4469
+ /**
4470
+ * Use this method to retrieve block state during UI initialization. Then use
4471
+ * {@link onStateUpdates} method to subscribe for updates.
4472
+ * */
4473
+ loadBlockState(): Promise<ResultOrError<ValueWithUTag<BlockStateV3<_Data, Outputs, Href>>>>;
4474
+ /**
4475
+ * Get all json patches (rfc6902) that were applied to the block state.
4476
+ * */
4477
+ getPatches(uTag: string): Promise<ResultOrError<ValueWithUTagAndAuthor<Operation[]>>>;
4478
+ /**
4479
+ * Mutates block storage with the given operation.
4480
+ *
4481
+ * This method returns when the data is safely saved so in case the window is
4482
+ * closed there will be no information losses. This function under the hood
4483
+ * may delay actual persistence of the supplied values.
4484
+ * */
4485
+ mutateStorage(payload: MutateStoragePayload, author?: AuthorMarker): Promise<ResultOrError<void>>;
4486
+ /**
4487
+ * Sets block navigation state.
4488
+ * */
4489
+ setNavigationState(state: NavigationState<Href>): Promise<ResultOrError<void>>;
4490
+ /**
4491
+ * Disposes the block API.
4492
+ * */
4493
+ dispose(): Promise<ResultOrError<void>>;
4494
+ } //#endregion
4495
+ //#endregion
4496
+ //#region ../../../../sdk/model/dist/platforma.d.ts
4497
+ //#region src/platforma.d.ts
4498
+ /** Defines all methods to interact with the platform environment from within a block UI. @deprecated */
4499
+ 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 {
4500
+ /** Information about SDK version current platforma environment was compiled with. */
4501
+ readonly sdkInfo: SdkInfo;
4502
+ readonly apiVersion?: 1;
4503
+ }
4504
+ /** V2 version based on effective json patches pulling API */
4505
+ 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 {
4506
+ /** Information about SDK version current platforma environment was compiled with. */
4507
+ readonly sdkInfo: SdkInfo;
4508
+ readonly apiVersion: 2;
4509
+ }
4510
+ 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 {
4511
+ /** Information about SDK version current platforma environment was compiled with. */
4512
+ readonly sdkInfo: SdkInfo;
4513
+ readonly apiVersion: 3;
4514
+ /** Service dispatch — lists available services, their methods, and invokes them. */
4515
+ readonly serviceDispatch: ServiceDispatch;
4516
+ /** @internal Type brand for plugin type inference. Not used at runtime. */
4517
+ readonly __pluginsBrand?: Plugins;
4518
+ /** @internal Type brand for UI service type inference. Not used at runtime. */
4519
+ readonly __uiServicesBrand?: UiServices;
4520
+ }
4521
+ 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>;
4522
+ type PlatformaExtended<Pl extends Platforma = Platforma> = Pl & {
4523
+ blockModelInfo: BlockModelInfo;
4524
+ };
4525
+ type BlockModelInfo = {
4526
+ outputs: Record<string, {
4527
+ withStatus: boolean;
4528
+ }>;
4529
+ pluginIds: PluginHandle[];
4530
+ featureFlags: BlockCodeKnownFeatureFlags;
4531
+ pluginPublicOutputs: Record<string, Record<string, PublicOutputFieldDef>>;
4532
+ };
4533
+ type InferOutputsType<Pl extends Platforma> = Pl extends Platforma<unknown, infer Outputs> ? Outputs : never;
4534
+ type InferDataType<Pl extends Platforma> = Pl extends Platforma<unknown, Record<string, OutputWithStatus<unknown>>, infer Data> ? Data : never;
4535
+ type InferHrefType<Pl extends Platforma> = Pl extends Platforma<unknown, BlockOutputsBase, unknown, infer Href> ? Href : never;
4536
+ //#endregion
4537
+ //#region ../model/dist/index.d.ts
4538
+ //#region src/index.d.ts
4539
+ /**
4540
+ * Pool Explorer persists nothing: the page renders whatever the result pool
4541
+ * currently exposes, and its filter controls are local Vue state. The kind's
4542
+ * `BlockParams` is empty for the same reason, so `init` takes no params.
4543
+ */
4544
+ type BlockData$1 = Record<string, never>;
4545
+ declare const platforma: PlatformaExtended<PlatformaV3<BlockData$1, BlockData$1, InferOutputsFromLambdas<{
4546
+ allSpecs: ConfigRenderLambda<{
4547
+ readonly entries: {
4548
+ readonly ref: {
4549
+ readonly __isRef: true;
4550
+ readonly blockId: string;
4551
+ readonly name: string;
4552
+ readonly requireEnrichments?: true | undefined | undefined;
4553
+ };
4554
+ readonly obj: {
4555
+ readonly kind: string;
4556
+ readonly name: string;
4557
+ readonly domain?: {
4558
+ [x: string]: string;
4559
+ } | undefined;
4560
+ readonly contextDomain?: {
4561
+ [x: string]: string;
4562
+ } | undefined;
4563
+ readonly annotations?: {
4564
+ [x: string]: string;
4565
+ } | undefined;
4566
+ };
4567
+ }[];
4568
+ readonly isComplete: boolean;
4569
+ }>;
4570
+ }>, "/", {}, BlockDefaultUiServices>>;
4571
+ //#endregion
4572
+ //#region src/index.d.ts
4573
+ type BlockContract = {
4574
+ outputs: InferOutputsType<typeof platforma>;
4575
+ data: InferDataType<typeof platforma>;
4576
+ href: InferHrefType<typeof platforma>;
4577
+ };
4578
+ type BlockOutputs = BlockContract["outputs"];
4579
+ type BlockData = BlockContract["data"];
4580
+ //#endregion
4581
+ export type { BlockContract, BlockData, BlockOutputs };
4582
+ //# sourceMappingURL=AGENTS.d.ts.map