@laserdata/laser-sdk 0.4.0 → 0.5.0

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.
Files changed (95) hide show
  1. package/README.md +49 -3
  2. package/dist/agent/reliable-consumer.d.ts.map +1 -1
  3. package/dist/agent/reliable-consumer.js +5 -1
  4. package/dist/agent/reliable-consumer.js.map +1 -1
  5. package/dist/bridges/a2a.d.ts +1 -1
  6. package/dist/bridges/a2a.js +1 -1
  7. package/dist/client/capabilities.d.ts +15 -2
  8. package/dist/client/capabilities.d.ts.map +1 -1
  9. package/dist/client/capabilities.js +22 -1
  10. package/dist/client/capabilities.js.map +1 -1
  11. package/dist/client/connect-options.d.ts +5 -0
  12. package/dist/client/connect-options.d.ts.map +1 -0
  13. package/dist/client/connect-options.js +18 -0
  14. package/dist/client/connect-options.js.map +1 -0
  15. package/dist/client/errors.d.ts +23 -1
  16. package/dist/client/errors.d.ts.map +1 -1
  17. package/dist/client/errors.js +34 -0
  18. package/dist/client/errors.js.map +1 -1
  19. package/dist/client/laser.d.ts +17 -1
  20. package/dist/client/laser.d.ts.map +1 -1
  21. package/dist/client/laser.js +96 -26
  22. package/dist/client/laser.js.map +1 -1
  23. package/dist/client/managed.d.ts +1 -0
  24. package/dist/client/managed.d.ts.map +1 -1
  25. package/dist/client/managed.js +15 -2
  26. package/dist/client/managed.js.map +1 -1
  27. package/dist/iggy/apache-iggy.d.ts +69 -4
  28. package/dist/iggy/apache-iggy.d.ts.map +1 -1
  29. package/dist/iggy/apache-iggy.js +416 -23
  30. package/dist/iggy/apache-iggy.js.map +1 -1
  31. package/dist/index.d.ts +8 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +4 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/managed/filters.d.ts +358 -0
  36. package/dist/managed/filters.d.ts.map +1 -0
  37. package/dist/managed/filters.js +1913 -0
  38. package/dist/managed/filters.js.map +1 -0
  39. package/dist/stream/consumer.d.ts +11 -1
  40. package/dist/stream/consumer.d.ts.map +1 -1
  41. package/dist/stream/consumer.js +82 -9
  42. package/dist/stream/consumer.js.map +1 -1
  43. package/dist/stream/stream.d.ts +4 -1
  44. package/dist/stream/stream.d.ts.map +1 -1
  45. package/dist/stream/stream.js +11 -1
  46. package/dist/stream/stream.js.map +1 -1
  47. package/dist/stream/topic.d.ts +2 -0
  48. package/dist/stream/topic.d.ts.map +1 -1
  49. package/dist/stream/topic.js +6 -0
  50. package/dist/stream/topic.js.map +1 -1
  51. package/dist/wire/authz.d.ts +1 -1
  52. package/dist/wire/authz.d.ts.map +1 -1
  53. package/dist/wire/authz.js +12 -3
  54. package/dist/wire/authz.js.map +1 -1
  55. package/dist/wire/codes.d.ts +17 -0
  56. package/dist/wire/codes.d.ts.map +1 -1
  57. package/dist/wire/codes.js +17 -0
  58. package/dist/wire/codes.js.map +1 -1
  59. package/dist/wire/commands.d.ts +12 -1
  60. package/dist/wire/commands.d.ts.map +1 -1
  61. package/dist/wire/commands.js +13 -1
  62. package/dist/wire/commands.js.map +1 -1
  63. package/dist/wire/control.d.ts +4 -0
  64. package/dist/wire/control.d.ts.map +1 -1
  65. package/dist/wire/control.js +5 -0
  66. package/dist/wire/control.js.map +1 -1
  67. package/dist/wire/filter-codecs.d.ts +16 -0
  68. package/dist/wire/filter-codecs.d.ts.map +1 -0
  69. package/dist/wire/filter-codecs.js +519 -0
  70. package/dist/wire/filter-codecs.js.map +1 -0
  71. package/dist/wire/filter-eval.d.ts +75 -0
  72. package/dist/wire/filter-eval.d.ts.map +1 -0
  73. package/dist/wire/filter-eval.js +899 -0
  74. package/dist/wire/filter-eval.js.map +1 -0
  75. package/dist/wire/filter.d.ts +772 -0
  76. package/dist/wire/filter.d.ts.map +1 -0
  77. package/dist/wire/filter.js +2869 -0
  78. package/dist/wire/filter.js.map +1 -0
  79. package/dist/wire/hello.d.ts +18 -0
  80. package/dist/wire/hello.d.ts.map +1 -1
  81. package/dist/wire/hello.js +29 -3
  82. package/dist/wire/hello.js.map +1 -1
  83. package/dist/wire/http.d.ts +22 -0
  84. package/dist/wire/http.d.ts.map +1 -1
  85. package/dist/wire/http.js +54 -47
  86. package/dist/wire/http.js.map +1 -1
  87. package/dist/wire/limits.d.ts +25 -0
  88. package/dist/wire/limits.d.ts.map +1 -1
  89. package/dist/wire/limits.js +25 -0
  90. package/dist/wire/limits.js.map +1 -1
  91. package/dist/wire/result.d.ts +4 -0
  92. package/dist/wire/result.d.ts.map +1 -1
  93. package/dist/wire/result.js +50 -0
  94. package/dist/wire/result.js.map +1 -1
  95. package/package.json +6 -6
@@ -0,0 +1,772 @@
1
+ import { type Grant } from "./authz.js";
2
+ import type { CmpOp, Predicate } from "./query.js";
3
+ import { type ResultCode } from "./result.js";
4
+ import { type TypedValue } from "./schema.js";
5
+ export declare const FILTER_EVALUATOR_VERSION = 1;
6
+ export declare const MAX_REGEX_PREDICATES = 4;
7
+ /** One step of a {@link FieldPath}: an object key or an array index. */
8
+ export type PathSegment = {
9
+ readonly kind: "key";
10
+ readonly key: string;
11
+ } | {
12
+ readonly kind: "index";
13
+ readonly index: number;
14
+ };
15
+ /**
16
+ * A validated location inside a decoded payload. Keys are separated by `.`,
17
+ * array elements are selected with `[n]`, and a literal `.`, `[`, `]`, or `\`
18
+ * inside a key is escaped with `\`. The text form is canonical.
19
+ */
20
+ export declare class FieldPath {
21
+ readonly segments: readonly PathSegment[];
22
+ private constructor();
23
+ static parse(text: string): FieldPath;
24
+ toString(): string;
25
+ }
26
+ /** How a timestamp is written in the payload or literal. */
27
+ export type TimestampFormat = "rfc3339" | "epoch_seconds" | "epoch_millis" | "epoch_micros";
28
+ /** An explicit value coercion. A value that does not parse under it is unknown. */
29
+ export type Coerce = {
30
+ readonly kind: "timestamp";
31
+ readonly format: TimestampFormat;
32
+ } | {
33
+ readonly kind: "number";
34
+ };
35
+ export interface CoercedPredicate {
36
+ readonly pred: Predicate;
37
+ readonly coerce: Coerce;
38
+ }
39
+ export interface HeaderPredicate {
40
+ readonly key: string;
41
+ readonly op: CmpOp;
42
+ readonly value: TypedValue;
43
+ }
44
+ /**
45
+ * How the payload is decoded before payload predicates run. `unknown` is a
46
+ * codec this build does not know, for example one a newer catalog saved: it
47
+ * decodes so listings stay readable, but it never validates or compiles.
48
+ */
49
+ export type FilterCodec = "json" | "cbor" | "avro" | "protobuf" | "headers_only" | "unknown";
50
+ /** What happens to a record whose payload cannot be decoded. */
51
+ export type FaultPolicy = "stop" | "pass" | "drop";
52
+ /**
53
+ * What happens to a record the filter cannot judge on its own terms: one in
54
+ * another format (`foreignPolicy`), or one where a predicate's value has a
55
+ * type it cannot compare (`mismatchPolicy`). `reject` skips the record,
56
+ * `pass` delivers it marked unevaluated so the consumer decides.
57
+ */
58
+ export type RecordPolicy = "reject" | "pass";
59
+ /** How a text predicate matches, from cheapest to most expensive. */
60
+ export type TextMatch = "equals" | "prefix" | "suffix" | "contains" | "glob" | "regex";
61
+ /**
62
+ * A text match on a payload field, or on a header for `header_text`. The value
63
+ * must be text: a missing value is unknown, another type is a type mismatch.
64
+ */
65
+ export interface TextPredicate {
66
+ readonly field: string;
67
+ readonly kind: TextMatch;
68
+ readonly pattern: string;
69
+ readonly caseInsensitive?: boolean;
70
+ }
71
+ /**
72
+ * A declarative predicate over one record. Comparison truth is three-valued: a
73
+ * missing field or a type mismatch is unknown, and an unknown root selects
74
+ * nothing.
75
+ */
76
+ export type FilterExpr = {
77
+ readonly kind: "all";
78
+ readonly children: readonly FilterExpr[];
79
+ } | {
80
+ readonly kind: "any";
81
+ readonly children: readonly FilterExpr[];
82
+ } | {
83
+ readonly kind: "not";
84
+ readonly child: FilterExpr;
85
+ } | {
86
+ readonly kind: "pred";
87
+ readonly predicate: Predicate;
88
+ } | {
89
+ readonly kind: "pred_as";
90
+ readonly predicate: CoercedPredicate;
91
+ } | {
92
+ readonly kind: "present";
93
+ readonly path: FieldPath;
94
+ } | {
95
+ readonly kind: "absent";
96
+ readonly path: FieldPath;
97
+ } | {
98
+ readonly kind: "header";
99
+ readonly predicate: HeaderPredicate;
100
+ } | {
101
+ readonly kind: "text";
102
+ readonly predicate: TextPredicate;
103
+ } | {
104
+ readonly kind: "header_text";
105
+ readonly predicate: TextPredicate;
106
+ };
107
+ /**
108
+ * A literal in the builders. An integral `number` or a `bigint` is a `long`, a
109
+ * fractional `number` a `double`. Pass a {@link TypedValue} for another kind.
110
+ */
111
+ export type FilterLiteral = string | number | bigint | boolean | null | TypedValue | readonly FilterLiteral[];
112
+ /** Builders for the `FilterExpr` type. */
113
+ export declare const FilterExpr: {
114
+ readonly all: (children: readonly FilterExpr[]) => FilterExpr;
115
+ readonly any: (children: readonly FilterExpr[]) => FilterExpr;
116
+ readonly negate: (child: FilterExpr) => FilterExpr;
117
+ readonly pred: (fieldName: string, op: CmpOp, value: FilterLiteral) => FilterExpr;
118
+ readonly predAs: (fieldName: string, op: CmpOp, value: FilterLiteral, coerce: Coerce) => FilterExpr;
119
+ readonly present: (path: string) => FilterExpr;
120
+ readonly absent: (path: string) => FilterExpr;
121
+ readonly header: (key: string, op: CmpOp, value: FilterLiteral) => FilterExpr;
122
+ readonly text: (fieldName: string, kind: TextMatch, pattern: string, caseInsensitive?: boolean) => FilterExpr;
123
+ readonly headerText: (key: string, kind: TextMatch, pattern: string, caseInsensitive?: boolean) => FilterExpr;
124
+ };
125
+ /** One consumer filter: the expression plus everything that changes what it selects. */
126
+ export interface ConsumerFilter {
127
+ readonly v: number;
128
+ readonly evaluatorVersion: number;
129
+ readonly expr: FilterExpr;
130
+ readonly codec: FilterCodec;
131
+ readonly faultPolicy: FaultPolicy;
132
+ /** Default `reject`. */
133
+ readonly foreignPolicy?: RecordPolicy;
134
+ /** Default `reject`. */
135
+ readonly mismatchPolicy?: RecordPolicy;
136
+ readonly schemaRefs: readonly number[];
137
+ }
138
+ /** Builders for the `ConsumerFilter` type. */
139
+ export declare const ConsumerFilter: {
140
+ /** Decode the payload as JSON, with the default `stop` fault policy. */
141
+ readonly json: (expr: FilterExpr, faultPolicy?: FaultPolicy) => ConsumerFilter;
142
+ readonly cbor: (expr: FilterExpr, faultPolicy?: FaultPolicy) => ConsumerFilter;
143
+ readonly avro: (expr: FilterExpr, schemaRefs: readonly number[], faultPolicy?: FaultPolicy) => ConsumerFilter;
144
+ readonly protobuf: (expr: FilterExpr, schemaRefs: readonly number[], faultPolicy?: FaultPolicy) => ConsumerFilter;
145
+ /** Never decode the payload. Only header predicates are allowed. */
146
+ readonly headersOnly: (expr: FilterExpr, faultPolicy?: FaultPolicy) => ConsumerFilter;
147
+ /** The same filter under another policy for records that do not decode. */
148
+ readonly withFaultPolicy: (filter: ConsumerFilter, faultPolicy: FaultPolicy) => ConsumerFilter;
149
+ /** The same filter under another policy for records of another codec. */
150
+ readonly withForeignPolicy: (filter: ConsumerFilter, foreignPolicy: RecordPolicy) => ConsumerFilter;
151
+ /** The same filter under another policy for a field of an unexpected type. */
152
+ readonly withMismatchPolicy: (filter: ConsumerFilter, mismatchPolicy: RecordPolicy) => ConsumerFilter;
153
+ };
154
+ export declare function filterExprReadsPayload(expr: FilterExpr): boolean;
155
+ export declare function filterExprReadsHeaders(expr: FilterExpr): boolean;
156
+ /**
157
+ * SHA-256 over a domain tag and the canonical JSON encoding of the filter, byte
158
+ * for byte what every server and SDK computes.
159
+ */
160
+ export declare function consumerFilterDigest(filter: ConsumerFilter): Uint8Array;
161
+ /** The canonical JSON text of a filter, the encoding its digest covers. */
162
+ export declare function consumerFilterJson(filter: ConsumerFilter): string;
163
+ /** Parse a filter from its canonical JSON text. */
164
+ export declare function decodeConsumerFilterJson(text: string): ConsumerFilter;
165
+ export declare function validateConsumerFilter(filter: ConsumerFilter): void;
166
+ /** One glob element after escapes are resolved: any run, any one, or a literal. */
167
+ export type GlobToken = {
168
+ readonly kind: "run";
169
+ } | {
170
+ readonly kind: "one";
171
+ } | {
172
+ readonly kind: "literal";
173
+ readonly value: string;
174
+ };
175
+ export declare function globTokens(pattern: string): GlobToken[] | undefined;
176
+ export declare function unportableRegexConstruct(pattern: string): string | undefined;
177
+ /**
178
+ * An exact decimal number, compared without floating-point rounding. Leading
179
+ * and trailing zeros are normalized away, so `1.50` equals `1.5` and `-0`
180
+ * equals `0`.
181
+ */
182
+ export declare class ExactDecimal {
183
+ private readonly negative;
184
+ private readonly integer;
185
+ private readonly fraction;
186
+ private constructor();
187
+ /** Parse `[+-]digits[.digits]`: no exponent, no whitespace, at most 512 digits. */
188
+ static parse(text: string): ExactDecimal | undefined;
189
+ static fromInteger(value: bigint): ExactDecimal;
190
+ /** The exact value of a finite double, `undefined` for infinities and NaN. */
191
+ static fromDouble(value: number): ExactDecimal | undefined;
192
+ private static normalized;
193
+ /** `-1`, `0`, or `1` as this value is below, equal to, or above `other`. */
194
+ compare(other: ExactDecimal): number;
195
+ private static magnitude;
196
+ toString(): string;
197
+ }
198
+ /** Microseconds since the epoch for a text value, `undefined` when it does not parse exactly. */
199
+ export declare function timestampFromText(format: TimestampFormat, text: string): bigint | undefined;
200
+ /** Microseconds since the epoch for an integer value, `undefined` on overflow or for RFC 3339. */
201
+ export declare function timestampFromInteger(format: TimestampFormat, value: bigint): bigint | undefined;
202
+ /** The stream and topic a filtered read or preview addresses, by name. */
203
+ export interface FilterSource {
204
+ readonly stream: string;
205
+ readonly topic: string;
206
+ }
207
+ /** Whose progress a filtered read follows. */
208
+ export type FilterConsumer = {
209
+ readonly kind: "group_id";
210
+ readonly id: bigint;
211
+ } | {
212
+ readonly kind: "consumer";
213
+ readonly name: string;
214
+ } | {
215
+ readonly kind: "group";
216
+ readonly name: string;
217
+ };
218
+ /** Which filter a read executes. */
219
+ export type FilterRef = {
220
+ readonly kind: "inline";
221
+ readonly filter: ConsumerFilter;
222
+ } | {
223
+ readonly kind: "revision";
224
+ readonly filterId: number;
225
+ readonly revision: number;
226
+ } | {
227
+ readonly kind: "bound";
228
+ };
229
+ /** Which replica serves the read. */
230
+ export type ReadMode = "primary" | "local";
231
+ /** The exact source history a page was read from. */
232
+ export interface SourceGeneration {
233
+ readonly streamId: number;
234
+ readonly streamCreatedAtMicros: bigint;
235
+ readonly topicId: number;
236
+ readonly topicCreatedAtMicros: bigint;
237
+ readonly partitionId: number;
238
+ readonly partitionCreatedRevision: bigint;
239
+ readonly purgeGeneration: bigint;
240
+ }
241
+ export interface Continuation {
242
+ readonly groupId?: bigint;
243
+ readonly nextScanOffset: bigint;
244
+ readonly generation: SourceGeneration;
245
+ readonly digest: Uint8Array;
246
+ /**
247
+ * The route the page was read on. A continuation from a local page never
248
+ * resumes a primary read, because a local replica can lag a purge.
249
+ */
250
+ readonly readMode: ReadMode;
251
+ }
252
+ /** Where a filtered read starts. */
253
+ export type FilteredStart = {
254
+ readonly kind: "next";
255
+ } | {
256
+ readonly kind: "first";
257
+ } | {
258
+ readonly kind: "last";
259
+ } | {
260
+ readonly kind: "offset";
261
+ readonly offset: bigint;
262
+ } | {
263
+ readonly kind: "timestamp";
264
+ readonly micros: bigint;
265
+ } | {
266
+ readonly kind: "continue";
267
+ readonly continuation: Continuation;
268
+ };
269
+ export interface FilteredPollRequest {
270
+ readonly v: number;
271
+ readonly source: FilterSource;
272
+ readonly partitionId: number;
273
+ readonly consumer: FilterConsumer;
274
+ readonly filter: FilterRef;
275
+ readonly start: FilteredStart;
276
+ readonly count: number;
277
+ readonly maxReplyBytes: number;
278
+ readonly readMode: ReadMode;
279
+ }
280
+ export type StopReason = "filled" | "budget" | "end_of_visible" | "fault" | "oversized_record";
281
+ export type FaultReason = "malformed" | "too_large" | "too_deep" | "missing_schema" | "schema_not_allowed" | "schema_mismatch" | "foreign_codec" | "type_mismatch";
282
+ export interface RecordFault {
283
+ readonly offset: bigint;
284
+ readonly reason: FaultReason;
285
+ }
286
+ export interface AppliedPolicy {
287
+ readonly groupId?: bigint;
288
+ readonly digest: Uint8Array;
289
+ readonly filterId?: number;
290
+ readonly revision?: number;
291
+ }
292
+ /** One page of a filtered read. `records` is a standard polled-messages body. */
293
+ export interface FilteredPage {
294
+ readonly v: number;
295
+ readonly partitionId: number;
296
+ readonly policy: AppliedPolicy;
297
+ readonly generation: SourceGeneration;
298
+ readonly readMode: ReadMode;
299
+ readonly nextScanOffset?: bigint;
300
+ readonly safeAckOffset?: bigint;
301
+ readonly frontier: bigint;
302
+ readonly examined: number;
303
+ readonly matched: number;
304
+ readonly stop: StopReason;
305
+ readonly fault?: RecordFault;
306
+ readonly evaluationLimits?: {
307
+ readonly maxPayloadBytes: number;
308
+ readonly maxDepth: number;
309
+ };
310
+ readonly unevaluated: readonly bigint[];
311
+ readonly records: Uint8Array;
312
+ }
313
+ /** The start of the next request: continue after `page`, or repeat `original`. */
314
+ export declare function nextFilteredStart(page: FilteredPage, original: FilteredStart): FilteredStart;
315
+ export interface FilteredAck {
316
+ readonly groupId?: bigint;
317
+ readonly v: number;
318
+ readonly source: FilterSource;
319
+ readonly partitionId: number;
320
+ readonly consumer: FilterConsumer;
321
+ readonly generation: SourceGeneration;
322
+ readonly digest: Uint8Array;
323
+ readonly offset: bigint;
324
+ }
325
+ export interface AckReceipt {
326
+ readonly partitionId: number;
327
+ readonly offset: bigint;
328
+ readonly generation: SourceGeneration;
329
+ }
330
+ export interface FilterPreviewRequest {
331
+ readonly v: number;
332
+ readonly source: FilterSource;
333
+ readonly partitionId: number;
334
+ readonly filter: FilterRef;
335
+ readonly fromOffset: bigint;
336
+ readonly maxExamined: number;
337
+ readonly maxRecords: number;
338
+ readonly explain: boolean;
339
+ }
340
+ export type Verdict = "selected" | "rejected" | "fault";
341
+ export type Truth = "match" | "no_match" | "unknown";
342
+ export interface ExplainNode {
343
+ readonly label: string;
344
+ readonly truth?: Truth;
345
+ readonly children: readonly ExplainNode[];
346
+ }
347
+ export interface FilterExplanation {
348
+ readonly verdict: Verdict;
349
+ readonly fault?: FaultReason;
350
+ readonly root: ExplainNode;
351
+ }
352
+ export interface PreviewRecord {
353
+ readonly offset: bigint;
354
+ readonly timestampMicros: bigint;
355
+ readonly verdict: Verdict;
356
+ readonly fault?: FaultReason;
357
+ readonly payloadText: string;
358
+ readonly payloadTruncated: boolean;
359
+ readonly explanation?: FilterExplanation;
360
+ }
361
+ export interface FilterPreview {
362
+ readonly v: number;
363
+ readonly partitionId: number;
364
+ readonly policy: AppliedPolicy;
365
+ readonly readMode: ReadMode;
366
+ readonly examined: number;
367
+ readonly matched: number;
368
+ readonly faults: number;
369
+ readonly stop: StopReason;
370
+ readonly nextOffset?: bigint;
371
+ readonly frontier: bigint;
372
+ readonly records: readonly PreviewRecord[];
373
+ }
374
+ /** A typed user header value as the evaluator reads it. */
375
+ export type HeaderScalar = {
376
+ readonly kind: "bool";
377
+ readonly value: boolean;
378
+ } | {
379
+ readonly kind: "int";
380
+ readonly value: bigint;
381
+ } | {
382
+ readonly kind: "uint";
383
+ readonly value: bigint;
384
+ } | {
385
+ readonly kind: "float";
386
+ readonly value: number;
387
+ } | {
388
+ readonly kind: "string";
389
+ readonly value: string;
390
+ } | {
391
+ readonly kind: "raw";
392
+ readonly value: Uint8Array;
393
+ };
394
+ export interface FilterHeader {
395
+ readonly key: string;
396
+ readonly value: HeaderScalar;
397
+ }
398
+ export interface FilterTestRequest {
399
+ readonly v: number;
400
+ readonly filter: FilterRef;
401
+ readonly payload: Uint8Array;
402
+ readonly headers: readonly FilterHeader[];
403
+ }
404
+ export interface FilterTestResult {
405
+ readonly v: number;
406
+ readonly policy: AppliedPolicy;
407
+ readonly explanation: FilterExplanation;
408
+ }
409
+ export interface FilterValidation {
410
+ readonly v: number;
411
+ readonly digest: Uint8Array;
412
+ readonly readsPayload: boolean;
413
+ readonly readsHeaders: boolean;
414
+ }
415
+ export type FilterErrorReason = "invalid_request" | "unsupported" | "version_skew" | "not_found" | "conflict" | "source_changed" | "membership_stale" | "not_primary" | "catalog_unavailable" | "revision_disabled" | "too_large" | "unauthenticated" | "forbidden" | "unavailable" | "capacity_exhausted" | "backend"
416
+ /** A reason this build does not know. The error's `code` still classifies it. */
417
+ | "unknown";
418
+ /** A consumer-filter failure as the server reports it. */
419
+ export interface FilterError {
420
+ readonly code: ResultCode;
421
+ readonly reason: FilterErrorReason;
422
+ readonly message: string;
423
+ }
424
+ export type FilterOutcome = {
425
+ readonly kind: "page";
426
+ readonly page: FilteredPage;
427
+ } | {
428
+ readonly kind: "acknowledged";
429
+ readonly receipt: AckReceipt;
430
+ } | {
431
+ readonly kind: "preview";
432
+ readonly preview: FilterPreview;
433
+ } | {
434
+ readonly kind: "tested";
435
+ readonly result: FilterTestResult;
436
+ } | {
437
+ readonly kind: "validated";
438
+ readonly validation: FilterValidation;
439
+ };
440
+ export type FilterReply = {
441
+ readonly kind: "ok";
442
+ readonly outcome: FilterOutcome;
443
+ } | {
444
+ readonly kind: "err";
445
+ readonly error: FilterError;
446
+ };
447
+ export type FilterState = "active" | "archived" | "dropped";
448
+ export interface FilterGroupIdentity {
449
+ readonly streamId: number;
450
+ readonly streamCreatedAtMicros: bigint;
451
+ readonly topicId: number;
452
+ readonly topicCreatedAtMicros: bigint;
453
+ readonly groupId: bigint;
454
+ }
455
+ export interface FilterGroupRef {
456
+ readonly stream: string;
457
+ readonly topic: string;
458
+ readonly group: string;
459
+ }
460
+ export interface FilterRevisionInfo {
461
+ readonly enabled: boolean;
462
+ readonly revision: number;
463
+ readonly digest: Uint8Array;
464
+ readonly filter: ConsumerFilter;
465
+ readonly createdAtMicros: bigint;
466
+ }
467
+ export interface FilterSummary {
468
+ readonly id: number;
469
+ readonly name: string;
470
+ readonly description: string;
471
+ readonly state: FilterState;
472
+ readonly latestRevision: number;
473
+ readonly latestDigest: Uint8Array;
474
+ readonly codec: FilterCodec;
475
+ readonly bindings: number;
476
+ readonly createdAtMicros: bigint;
477
+ readonly updatedAtMicros: bigint;
478
+ }
479
+ export interface FilterBinding {
480
+ readonly group: FilterGroupRef;
481
+ readonly identity: FilterGroupIdentity;
482
+ readonly filterId: number;
483
+ readonly revision: number;
484
+ readonly digest: Uint8Array;
485
+ readonly boundAtMicros: bigint;
486
+ }
487
+ export interface FilterDetail {
488
+ readonly summary: FilterSummary;
489
+ readonly latest: FilterRevisionInfo;
490
+ readonly bindings: readonly FilterBinding[];
491
+ }
492
+ export type FilterMutation = {
493
+ readonly kind: "set_revision_enabled";
494
+ readonly filterId: number;
495
+ readonly revision: number;
496
+ readonly enabled: boolean;
497
+ } | {
498
+ readonly kind: "register";
499
+ readonly name: string;
500
+ readonly description: string;
501
+ readonly filter: ConsumerFilter;
502
+ } | {
503
+ readonly kind: "revise";
504
+ readonly filterId: number;
505
+ readonly expectedRevision: number;
506
+ readonly filter: ConsumerFilter;
507
+ } | {
508
+ readonly kind: "describe";
509
+ readonly filterId: number;
510
+ readonly description: string;
511
+ } | {
512
+ readonly kind: "archive";
513
+ readonly filterId: number;
514
+ } | {
515
+ readonly kind: "drop";
516
+ readonly filterId: number;
517
+ } | {
518
+ readonly kind: "bind";
519
+ readonly group: FilterGroupRef;
520
+ readonly filterId: number;
521
+ readonly revision: number;
522
+ } | {
523
+ readonly kind: "unbind";
524
+ readonly group: FilterGroupRef;
525
+ readonly expectedDigest: Uint8Array;
526
+ readonly expectedIdentity?: FilterGroupIdentity;
527
+ };
528
+ export interface FilterMutationRequest {
529
+ readonly v: number;
530
+ readonly operationId: bigint;
531
+ readonly mutation: FilterMutation;
532
+ }
533
+ /**
534
+ * The mutation the catalog appends to its control log, stamped by the
535
+ * streaming server with the actor and group identity, then by the plane with
536
+ * the caller's grants and, for a registration, the allocated filter id.
537
+ */
538
+ export interface FilterCatalogLimits {
539
+ readonly maxDefinitions: number;
540
+ readonly maxTombstones: number;
541
+ readonly maxRevisions: number;
542
+ readonly maxGroupIdentities: number;
543
+ /** Encoded bytes of every stored filter revision together. */
544
+ readonly maxCatalogBytes: bigint;
545
+ }
546
+ export interface FilterCatalogCommand {
547
+ readonly limits?: FilterCatalogLimits;
548
+ readonly operationId: bigint;
549
+ readonly actorUserId: number;
550
+ readonly mutation: FilterMutation;
551
+ readonly identity?: FilterGroupIdentity;
552
+ /** The id a registration takes, allocated before the append. */
553
+ readonly filterId?: number;
554
+ /** The grants the mutation is authorized with again when it applies. */
555
+ readonly grants?: readonly Grant[];
556
+ }
557
+ export interface FilterRevisionRef {
558
+ readonly filterId: number;
559
+ readonly revision: number;
560
+ readonly digest: Uint8Array;
561
+ }
562
+ export type FilterMutationResult = {
563
+ readonly kind: "revision_state";
564
+ readonly filterId: number;
565
+ readonly revision: number;
566
+ readonly enabled: boolean;
567
+ } | {
568
+ readonly kind: "registered";
569
+ readonly revision: FilterRevisionRef;
570
+ } | {
571
+ readonly kind: "revised";
572
+ readonly revision: FilterRevisionRef;
573
+ } | {
574
+ readonly kind: "described";
575
+ readonly filterId: number;
576
+ } | {
577
+ readonly kind: "archived";
578
+ readonly filterId: number;
579
+ } | {
580
+ readonly kind: "dropped";
581
+ readonly filterId: number;
582
+ } | {
583
+ readonly kind: "bound";
584
+ readonly binding: FilterBinding;
585
+ } | {
586
+ readonly kind: "unbound";
587
+ readonly binding: FilterBinding;
588
+ };
589
+ export type FilterMutationStatus = {
590
+ readonly kind: "pending";
591
+ } | {
592
+ readonly kind: "applied";
593
+ readonly result: FilterMutationResult;
594
+ } | {
595
+ readonly kind: "rejected";
596
+ readonly error: FilterError;
597
+ };
598
+ export interface FilterMutationOutcome {
599
+ readonly v: number;
600
+ readonly operationId: bigint;
601
+ readonly status: FilterMutationStatus;
602
+ }
603
+ export interface GetFilter {
604
+ readonly v: number;
605
+ readonly filterId: number;
606
+ }
607
+ export interface ListFilters {
608
+ readonly v: number;
609
+ readonly nameContains?: string;
610
+ readonly state?: FilterState;
611
+ /** Only filters with a lower id, so paging stays stable while the catalog changes. */
612
+ readonly beforeId?: number;
613
+ readonly page: number;
614
+ readonly pageSize: number;
615
+ }
616
+ export interface FilterPage {
617
+ readonly items: readonly FilterSummary[];
618
+ readonly page: number;
619
+ readonly pageSize: number;
620
+ readonly total: number;
621
+ }
622
+ export interface ListFilterRevisions {
623
+ readonly v: number;
624
+ readonly filterId: number;
625
+ readonly page: number;
626
+ readonly pageSize: number;
627
+ }
628
+ export interface FilterRevisionPage {
629
+ readonly filterId: number;
630
+ readonly items: readonly FilterRevisionInfo[];
631
+ readonly page: number;
632
+ readonly pageSize: number;
633
+ readonly total: number;
634
+ }
635
+ export interface GetFilterBinding {
636
+ readonly v: number;
637
+ readonly group: FilterGroupRef;
638
+ readonly identity?: FilterGroupIdentity;
639
+ }
640
+ export interface ListFilterBindings {
641
+ readonly v: number;
642
+ readonly filterId?: number;
643
+ readonly stream?: string;
644
+ readonly topic?: string;
645
+ readonly page: number;
646
+ readonly pageSize: number;
647
+ }
648
+ export interface FilterBindingPage {
649
+ readonly items: readonly FilterBinding[];
650
+ readonly page: number;
651
+ readonly pageSize: number;
652
+ readonly total: number;
653
+ }
654
+ export interface GetFilterOperation {
655
+ readonly v: number;
656
+ readonly operationId: bigint;
657
+ }
658
+ export type FilterPolicyRef = {
659
+ readonly kind: "revision";
660
+ readonly filterId: number;
661
+ readonly revision: number;
662
+ } | {
663
+ readonly kind: "binding";
664
+ readonly identity: FilterGroupIdentity;
665
+ };
666
+ export interface ResolveFilterPolicy {
667
+ readonly allowDisabled?: boolean;
668
+ readonly v: number;
669
+ readonly policy: FilterPolicyRef;
670
+ }
671
+ export interface ResolvedFilterPolicy {
672
+ readonly filterId: number;
673
+ readonly revision: number;
674
+ readonly digest: Uint8Array;
675
+ readonly state: FilterState;
676
+ readonly filter: ConsumerFilter;
677
+ }
678
+ export type FilterCatalogOutcome = {
679
+ readonly kind: "filter";
680
+ readonly detail: FilterDetail;
681
+ } | {
682
+ readonly kind: "filters";
683
+ readonly page: FilterPage;
684
+ } | {
685
+ readonly kind: "revisions";
686
+ readonly page: FilterRevisionPage;
687
+ } | {
688
+ readonly kind: "binding";
689
+ readonly binding: FilterBinding;
690
+ } | {
691
+ readonly kind: "bindings";
692
+ readonly page: FilterBindingPage;
693
+ } | {
694
+ readonly kind: "mutation";
695
+ readonly outcome: FilterMutationOutcome;
696
+ } | {
697
+ readonly kind: "policy";
698
+ readonly policy: ResolvedFilterPolicy;
699
+ };
700
+ export type FilterCatalogReply = {
701
+ readonly kind: "ok";
702
+ readonly outcome: FilterCatalogOutcome;
703
+ } | {
704
+ readonly kind: "err";
705
+ readonly error: FilterError;
706
+ };
707
+ export declare function validateFilteredPollRequest(request: FilteredPollRequest): void;
708
+ export declare function validateFilteredAck(ack: FilteredAck): void;
709
+ export declare function validateFilterPreviewRequest(request: FilterPreviewRequest): void;
710
+ export declare function validateFilterTestRequest(request: FilterTestRequest): void;
711
+ export declare function validateFilterGroupRef(group: FilterGroupRef): void;
712
+ export declare function validateFilterMutation(mutation: FilterMutation): void;
713
+ export declare function validateFilterMutationRequest(request: FilterMutationRequest): void;
714
+ export declare function validateCatalogPage(page: number, pageSize: number): void;
715
+ export declare function encodeFilterExpr(expr: FilterExpr): Map<string, unknown>;
716
+ export declare function encodeConsumerFilter(filter: ConsumerFilter): Map<string, unknown>;
717
+ export declare function encodeFilterSource(source: FilterSource): Map<string, unknown>;
718
+ export declare function encodeFilterConsumer(consumer: FilterConsumer): Map<string, unknown>;
719
+ export declare function encodeFilterRef(filter: FilterRef): unknown;
720
+ export declare function encodeSourceGeneration(generation: SourceGeneration): Map<string, unknown>;
721
+ export declare function encodeFilteredStart(start: FilteredStart): unknown;
722
+ export declare function encodeFilteredPollRequest(request: FilteredPollRequest): Map<string, unknown>;
723
+ export declare function encodeFilteredAck(ack: FilteredAck): Map<string, unknown>;
724
+ export declare function encodeFilterPreviewRequest(request: FilterPreviewRequest): Map<string, unknown>;
725
+ export declare function encodeHeaderScalar(value: HeaderScalar): Map<string, unknown>;
726
+ export declare function encodeFilterTestRequest(request: FilterTestRequest): Map<string, unknown>;
727
+ export declare function encodeFilteredPage(page: FilteredPage): Map<string, unknown>;
728
+ export declare function encodeFilterError(error: FilterError): Map<string, unknown>;
729
+ export declare function encodeFilterReply(reply: FilterReply): Map<string, unknown>;
730
+ export declare function encodeFilterGroupRef(group: FilterGroupRef): Map<string, unknown>;
731
+ export declare function encodeFilterGroupIdentity(identity: FilterGroupIdentity): Map<string, unknown>;
732
+ export declare function encodeFilterMutation(mutation: FilterMutation): Map<string, unknown>;
733
+ export declare function encodeFilterMutationRequest(request: FilterMutationRequest): Map<string, unknown>;
734
+ export declare function encodeFilterCatalogCommand(command: FilterCatalogCommand): Map<string, unknown>;
735
+ export declare function encodeGetFilter(request: GetFilter): Map<string, unknown>;
736
+ export declare function encodeListFilters(request: ListFilters): Map<string, unknown>;
737
+ export declare function encodeListFilterRevisions(request: ListFilterRevisions): Map<string, unknown>;
738
+ export declare function encodeGetFilterBinding(request: GetFilterBinding): Map<string, unknown>;
739
+ export declare function encodeListFilterBindings(request: ListFilterBindings): Map<string, unknown>;
740
+ export declare function encodeGetFilterOperation(request: GetFilterOperation): Map<string, unknown>;
741
+ export declare function encodeFilterCatalogReply(reply: FilterCatalogReply): Map<string, unknown>;
742
+ export declare function decodeFilterExpr(value: unknown, context: string): FilterExpr;
743
+ export declare function decodeFilterCodec(value: unknown, context: string): FilterCodec;
744
+ export declare function decodeConsumerFilter(value: unknown, context: string): ConsumerFilter;
745
+ export declare function decodeFilterSource(value: unknown, context: string): FilterSource;
746
+ export declare function decodeFilterConsumer(value: unknown, context: string): FilterConsumer;
747
+ export declare function decodeFilterRef(value: unknown, context: string): FilterRef;
748
+ export declare function decodeSourceGeneration(value: unknown, context: string): SourceGeneration;
749
+ export declare function decodeFilteredStart(value: unknown, context: string): FilteredStart;
750
+ export declare function decodeFilteredPollRequest(value: unknown, context: string): FilteredPollRequest;
751
+ export declare function decodeFilteredAck(value: unknown, context: string): FilteredAck;
752
+ export declare function decodeFilteredPage(value: unknown, context: string): FilteredPage;
753
+ export declare function decodeFilterError(value: unknown, context: string): FilterError;
754
+ export declare function decodeFilterReply(value: unknown, context: string): FilterReply;
755
+ export declare function decodeHeaderScalar(value: unknown, context: string): HeaderScalar;
756
+ export declare function decodeFilterGroupRef(value: unknown, context: string): FilterGroupRef;
757
+ export declare function decodeFilterGroupIdentity(value: unknown, context: string): FilterGroupIdentity;
758
+ export declare function decodeFilterMutation(value: unknown, context: string): FilterMutation;
759
+ export declare function decodeFilterMutationRequest(value: unknown, context: string): FilterMutationRequest;
760
+ export declare function decodeFilterCatalogCommand(value: unknown, context: string): FilterCatalogCommand;
761
+ export declare function decodeFilterMutationOutcome(value: unknown, context: string): FilterMutationOutcome;
762
+ export declare function decodeFilterCatalogReply(value: unknown, context: string): FilterCatalogReply;
763
+ export declare function rustDouble(value: number): string;
764
+ /**
765
+ * Parse JSON the way serde_json does, keeping integers exact. Objects become
766
+ * maps with the last duplicate key winning. Throws on anything serde_json
767
+ * rejects. `payload` mode decodes a record payload like the evaluator: only
768
+ * integers that fit i64 or u64 stay bigints, any other number is a double.
769
+ * `document` mode keeps every integer a bigint, for u128 fields.
770
+ */
771
+ export declare function parseCanonicalJson(text: string, mode?: "document" | "payload"): unknown;
772
+ //# sourceMappingURL=filter.d.ts.map