@query-farm/vgi 0.50.0 → 0.51.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 (40) hide show
  1. package/dist/functions/aggregate.d.ts +25 -21
  2. package/dist/functions/execution-cache.d.ts +11 -0
  3. package/dist/functions/storage-cf-do.d.ts +38 -0
  4. package/dist/functions/storage-seal.d.ts +27 -0
  5. package/dist/functions/storage.d.ts +49 -1
  6. package/dist/functions/table-buffering.d.ts +30 -0
  7. package/dist/http/fetch.d.ts +7 -0
  8. package/dist/index.core.d.ts +3 -2
  9. package/dist/index.js +749 -384
  10. package/dist/index.js.map +20 -18
  11. package/dist/protocol/dispatch.d.ts +9 -0
  12. package/dist/protocol/handlers/aggregate.d.ts +1 -1
  13. package/dist/protocol/handlers/catalog/shared.d.ts +10 -0
  14. package/dist/protocol/handlers/function.d.ts +2 -0
  15. package/dist/protocol/handlers/table-buffering.d.ts +1 -1
  16. package/dist/protocol/types.d.ts +8 -0
  17. package/dist/serve-entry.d.ts +16 -2
  18. package/dist/serve-entry.js +1034 -526
  19. package/dist/serve-entry.js.map +20 -18
  20. package/dist/worker-cf-entry.js +2713 -2217
  21. package/dist/worker-cf-entry.js.map +26 -24
  22. package/package.json +1 -1
  23. package/src/functions/aggregate.ts +101 -152
  24. package/src/functions/copy-from.ts +2 -2
  25. package/src/functions/execution-cache.ts +59 -0
  26. package/src/functions/storage-cf-do.ts +152 -22
  27. package/src/functions/storage-seal.ts +208 -0
  28. package/src/functions/storage.ts +120 -3
  29. package/src/functions/table-buffering.ts +91 -15
  30. package/src/functions/table-in-out.ts +3 -1
  31. package/src/functions/table.ts +4 -4
  32. package/src/http/fetch.ts +9 -0
  33. package/src/index.core.ts +3 -1
  34. package/src/protocol/dispatch.ts +12 -2
  35. package/src/protocol/handlers/aggregate.ts +123 -82
  36. package/src/protocol/handlers/catalog/shared.ts +20 -0
  37. package/src/protocol/handlers/function.ts +38 -11
  38. package/src/protocol/handlers/table-buffering.ts +44 -32
  39. package/src/protocol/types.ts +8 -0
  40. package/src/serve-entry.ts +33 -3
@@ -4,6 +4,8 @@ import type { Arguments } from "../arguments/arguments.js";
4
4
  import { type ArgumentConstraints } from "../arguments/argument-spec.js";
5
5
  import type { VgiFunction } from "./types.js";
6
6
  import type { FunctionExample } from "./types.js";
7
+ import { type BoundStorage } from "./storage.js";
8
+ import { ExecutionCache } from "./execution-cache.js";
7
9
  export declare const GROUP_COLUMN_NAME = "__vgi_group_id";
8
10
  export interface AggregateBindParams<TArgs = Record<string, any>> {
9
11
  args: TArgs;
@@ -109,28 +111,31 @@ export interface AggregateFunctionConfig<TArgs = Record<string, any>, TState = a
109
111
  */
110
112
  requiredSecrets?: RequiredSecret[];
111
113
  }
112
- type StateMap = Map<bigint, any>;
113
- interface ExecEntry {
114
- states: StateMap;
115
- bindArgs: Arguments;
116
- bindParams: AggregateBindParams<any>;
117
- loaded: Set<bigint>;
118
- }
119
- /**
120
- * Fetch the execution context — bind args/params + states for requested gids.
121
- * On cache miss, tries to reconstruct from on-disk files written by a
122
- * sibling worker. Returns undefined if the exec never existed anywhere.
123
- * `requestedGids` (optional) tells us which group states to pre-load.
124
- */
125
- export declare function getExecutionState(executionId: Uint8Array, requestedGids?: Iterable<bigint>): ExecEntry | undefined;
126
- export declare function setExecutionState(executionId: Uint8Array, entry: Omit<ExecEntry, "loaded">): void;
114
+ /** Key of the sealed bind context within FrameworkNS.AGGREGATE_STATE. */
115
+ export declare const AGGREGATE_CONTEXT_KEY: Uint8Array<ArrayBufferLike>;
116
+ /** Per-(shard, execution) cache of the decoded bind context. */
117
+ export declare const aggregateContextCache: ExecutionCache<AggregateBindParams<any>>;
118
+ /** Encode one group's state for storage. */
119
+ export declare function encodeGroupState(state: unknown): Uint8Array;
120
+ /** Decode one group's state from storage. */
121
+ export declare function decodeGroupState(bytes: Uint8Array): any;
127
122
  /**
128
- * Persist the given group states to disk so sibling workers can pick them up.
129
- * Deletes the on-disk entry when the in-memory state was removed (gid no
130
- * longer present in states map).
123
+ * The stored bind context: the wire `arguments` and `input_schema` bytes and
124
+ * the argument names, exactly as aggregate_bind received them, so a cold
125
+ * process rebuilds the same AggregateBindParams (args are re-extracted from
126
+ * the arguments with the function's declaration). No secrets.
131
127
  */
132
- export declare function persistGroupStates(executionId: Uint8Array, gids: Iterable<bigint>): void;
133
- export declare function deleteExecutionState(executionId: Uint8Array): void;
128
+ export interface StoredAggregateContext {
129
+ argumentsIpc: Uint8Array;
130
+ inputSchemaIpc: Uint8Array | null;
131
+ argumentNames: (string | null)[] | null;
132
+ }
133
+ export declare function encodeAggregateContext(ctx: StoredAggregateContext): Uint8Array;
134
+ export declare function decodeAggregateContext(bytes: Uint8Array): StoredAggregateContext;
135
+ /** Read the stored states of `gids` (absent groups are left out of the map). */
136
+ export declare function loadGroupStates(storage: BoundStorage, gids: bigint[]): Promise<Map<bigint, any>>;
137
+ /** Write the states of `gids` that are present in `states` (one batched put). */
138
+ export declare function storeGroupStates(storage: BoundStorage, states: Map<bigint, any>, gids: Iterable<bigint>): Promise<void>;
134
139
  /**
135
140
  * Declare an aggregate function. The returned VgiFunction has `kind:
136
141
  * "aggregate"` plus a `config` handle the dispatch layer uses to drive the
@@ -139,4 +144,3 @@ export declare function deleteExecutionState(executionId: Uint8Array): void;
139
144
  export declare function defineAggregate<TArgs = Record<string, any>, TState = any>(config: AggregateFunctionConfig<TArgs, TState>): VgiFunction & {
140
145
  aggregateConfig: AggregateFunctionConfig<TArgs, TState>;
141
146
  };
142
- export {};
@@ -0,0 +1,11 @@
1
+ export declare class ExecutionCache<V> {
2
+ readonly maxEntries: number;
3
+ private readonly _map;
4
+ constructor(maxEntries: number);
5
+ private static _key;
6
+ get(shardKey: string, executionId: Uint8Array): V | undefined;
7
+ set(shardKey: string, executionId: Uint8Array, value: V): void;
8
+ delete(shardKey: string, executionId: Uint8Array): void;
9
+ clear(): void;
10
+ get size(): number;
11
+ }
@@ -5,7 +5,27 @@ export type FetchLike = (input: string, init?: {
5
5
  method?: string;
6
6
  headers?: Record<string, string>;
7
7
  body?: string;
8
+ signal?: AbortSignal;
8
9
  }) => Promise<Response>;
10
+ /** The DO server's shard_key rule (vgi-cloudflare-durable-object-storage). */
11
+ export declare const SHARD_KEY_RE: RegExp;
12
+ /**
13
+ * Shard for a call not bound to an ATTACH (no attach uuid to shard on): one
14
+ * shared DO per tenant, as vgi-python's client does. Every attach-bound call
15
+ * carries its own `att-<uuid hex>` shard instead.
16
+ */
17
+ export declare const ANONYMOUS_SHARD_KEY = "loc-anon";
18
+ /** Retry policy for the DO client. */
19
+ export interface CfDoRetryOptions {
20
+ /** Per-attempt fetch timeout, ms (default 30000; 0 disables). */
21
+ timeoutMs?: number;
22
+ /** Total attempts including the first (default 4). */
23
+ maxAttempts?: number;
24
+ /** First backoff, ms (default 100); doubles per attempt, full jitter. */
25
+ baseDelayMs?: number;
26
+ /** Backoff cap, ms (default 2000). */
27
+ maxDelayMs?: number;
28
+ }
9
29
  export declare class FunctionStorageCfDo implements FunctionStorage {
10
30
  private readonly _baseUrl;
11
31
  private readonly _token;
@@ -16,12 +36,19 @@ export declare class FunctionStorageCfDo implements FunctionStorage {
16
36
  * the same account/zone — a same-zone public-URL fetch is rejected (CF
17
37
  * error 1042), but a service binding routes worker-to-worker directly. */
18
38
  private readonly _fetch;
39
+ private readonly _retry;
40
+ /** Test hook: how the client waits between attempts. */
41
+ private readonly _sleep;
19
42
  constructor(opts: {
20
43
  url: string;
21
44
  token?: string | null;
22
45
  shardKey?: string;
23
46
  fetch?: FetchLike;
47
+ retry?: CfDoRetryOptions;
48
+ sleep?: (ms: number) => Promise<void>;
24
49
  });
50
+ /** The shard this instance routes to ("" = the anonymous shard). */
51
+ get shardKey(): string;
25
52
  /** Build an instance from environment variables. */
26
53
  static fromEnv(): FunctionStorageCfDo;
27
54
  /**
@@ -37,11 +64,22 @@ export declare class FunctionStorageCfDo implements FunctionStorage {
37
64
  queueClear(executionId: Uint8Array): Promise<number>;
38
65
  stateGet(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
39
66
  statePut(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, value: Uint8Array): Promise<void>;
67
+ stateGetMany(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
68
+ statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
40
69
  stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
41
70
  stateLogScan(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
42
71
  executionClear(scopeId: Uint8Array): Promise<number>;
43
72
  private _statePutMany;
44
73
  /** Drive state_scan / state_drain across pages. attemptId is null for scan. */
45
74
  private _statePaged;
75
+ /**
76
+ * POST one call. The body (and so its `attempt_id`, for destructive ops) is
77
+ * built once and resent unchanged on every retry, so the DO's replay
78
+ * detection makes a retried put/drain/pop a no-op. Retries transport errors,
79
+ * timeouts, 5xx and 429 with exponential backoff and full jitter, bounded by
80
+ * `maxAttempts`. 4xx other than 429 is the caller's error and is not retried.
81
+ * The bearer token never appears in an error message.
82
+ */
46
83
  private _post;
84
+ private _once;
47
85
  }
@@ -0,0 +1,27 @@
1
+ export declare const STORAGE_PAYLOAD_INFO = "vgi.storage.payload.v1";
2
+ export declare const STORAGE_PAYLOAD_VERSION = 1;
3
+ /** A framework payload read from storage could not be authenticated. */
4
+ export declare class StoragePayloadError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ /** The storage slot a payload is bound to. */
8
+ export interface StorageSlot {
9
+ shardKey: string;
10
+ scopeId: Uint8Array;
11
+ ns: Uint8Array;
12
+ key: Uint8Array;
13
+ }
14
+ /** The associated data binding a payload to its storage slot. */
15
+ export declare function storagePayloadAad(slot: StorageSlot): Uint8Array;
16
+ /** `HKDF-SHA256(ikm, salt = "", info = "vgi.storage.payload.v1", 32)` as raw bytes. */
17
+ export declare function deriveStoragePayloadKey(ikm: Uint8Array): Promise<Uint8Array>;
18
+ /** Seal under an explicit `ikm`. `nonce` exists for test vectors only. */
19
+ export declare function sealWith(payload: Uint8Array, ikm: Uint8Array, slot: StorageSlot, nonce?: Uint8Array): Promise<Uint8Array>;
20
+ /** Open under an explicit `ikm`; {@link StoragePayloadError} on any failure. */
21
+ export declare function openWith(blob: Uint8Array, ikm: Uint8Array, slot: StorageSlot): Promise<Uint8Array>;
22
+ /** Test hook: replace the host-local key source (null restores the key file). */
23
+ export declare function setStorageSealHostLocalKey(fn: (() => Promise<Uint8Array>) | null): void;
24
+ /** Seal a framework payload bound to its storage slot. */
25
+ export declare function sealPayload(payload: Uint8Array, signingKey: Uint8Array | undefined, slot: StorageSlot): Promise<Uint8Array>;
26
+ /** Open an envelope from {@link sealPayload} for the same slot. */
27
+ export declare function openPayload(blob: Uint8Array, signingKey: Uint8Array | undefined, slot: StorageSlot): Promise<Uint8Array>;
@@ -22,16 +22,34 @@ export interface FunctionStorage {
22
22
  queueClear(executionId: Uint8Array): Promise<number>;
23
23
  stateGet(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
24
24
  statePut(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, value: Uint8Array): Promise<void>;
25
+ /** Batched read: one value (or null) per key, in key order. One round trip
26
+ * on a remote backend. */
27
+ stateGetMany(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
28
+ /** Batched atomic upsert of `(key, value)` pairs. One round trip on a remote
29
+ * backend; a no-op for an empty list. */
30
+ statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
25
31
  stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
26
32
  stateLogScan(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
27
33
  /** Wipe all state + log rows for a scope across every namespace. */
28
34
  executionClear(scopeId: Uint8Array): Promise<number>;
29
35
  /** Optional cleanup hook. Implementations holding a connection should release it here. */
30
36
  close?(): Promise<void> | void;
37
+ /**
38
+ * Optional: a view of this backend routed to one attach shard. A backend
39
+ * that partitions remotely (the Cloudflare DO, one Durable Object per
40
+ * logical ATTACH) implements it; a local backend that needs no routing
41
+ * omits it. {@link BoundStorage} calls it with the shard key the framework
42
+ * derived from the request's authenticated attach (`att-<uuid hex>`), or
43
+ * `""` when the call is not bound to an ATTACH.
44
+ */
45
+ forShard?(shardKey: string): FunctionStorage;
31
46
  }
32
47
  export declare const FrameworkNS: {
33
48
  readonly BUFFERING_INIT: Uint8Array<ArrayBufferLike>;
34
49
  readonly STREAMING_FINALIZE: Uint8Array<ArrayBufferLike>;
50
+ /** Aggregate group states (key = packIntKey(group_id)) and, at key
51
+ * packIntKey(-2), the sealed bind context. Same bytes as vgi-python. */
52
+ readonly AGGREGATE_STATE: Uint8Array<ArrayBufferLike>;
35
53
  };
36
54
  /** Encode an int as 8-byte little-endian, matching Python's pack_int_key. */
37
55
  export declare function packIntKey(i: number | bigint): Uint8Array;
@@ -53,6 +71,8 @@ export declare class FunctionStorageSqlite implements FunctionStorage {
53
71
  private _ensureTables;
54
72
  stateGet(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
55
73
  statePut(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, value: Uint8Array): Promise<void>;
74
+ stateGetMany(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
75
+ statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
56
76
  stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
57
77
  stateLogScan(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
58
78
  executionClear(scopeId: Uint8Array): Promise<number>;
@@ -67,13 +87,23 @@ export declare class BoundStorage {
67
87
  private _base;
68
88
  private _executionId;
69
89
  private _substreamId;
90
+ private _shardKey;
70
91
  /**
71
92
  * @param substreamId The table-in-out substream this storage serves -- the
72
93
  * client-minted `InitRequest.substream_id`, identical across the
73
94
  * substream's init, every tick and its finalize -- or `null` when the
74
95
  * client sent none. Keys {@link put}.
96
+ * @param shardKey The attach shard every call routes to: `att-<uuid hex>`,
97
+ * derived by the framework from the request's authenticated attach (see
98
+ * {@link shardKeyOf}), or `""` when the call is not bound to an ATTACH. A
99
+ * backend with `forShard` (the Cloudflare DO) routes on it; it is also part
100
+ * of every sealed framework payload's AAD.
75
101
  */
76
- constructor(storage: FunctionStorage, executionId: Uint8Array, substreamId?: Uint8Array | null);
102
+ constructor(storage: FunctionStorage, executionId: Uint8Array, substreamId?: Uint8Array | null, shardKey?: string);
103
+ /** The attach shard this view routes to ("" when not bound to an ATTACH). */
104
+ get shardKey(): string;
105
+ /** The execution (scope) id this view is bound to. */
106
+ get executionId(): Uint8Array;
77
107
  /**
78
108
  * Upsert this substream's state into the execution's worker state, which
79
109
  * {@link collect} drains at finalize.
@@ -96,11 +126,29 @@ export declare class BoundStorage {
96
126
  queueClear(): Promise<number>;
97
127
  stateGet(ns: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
98
128
  statePut(ns: Uint8Array, key: Uint8Array, value: Uint8Array): Promise<void>;
129
+ /** Batched read, one value (or null) per key. One round trip remotely. */
130
+ stateGetMany(ns: Uint8Array, keys: Uint8Array[]): Promise<Array<Uint8Array | null>>;
131
+ /** Batched atomic upsert. One round trip remotely. */
132
+ statePutMany(ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
99
133
  stateAppend(ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
100
134
  stateLogScan(ns: Uint8Array, key: Uint8Array, afterId?: number, limit?: number | null): Promise<Array<[number, Uint8Array]>>;
101
135
  executionClear(): Promise<number>;
136
+ private _slot;
137
+ /** Seal `payload` to its slot, store it, and return the stored envelope. */
138
+ sealedPut(ns: Uint8Array, key: Uint8Array, payload: Uint8Array, signingKey: Uint8Array | undefined): Promise<Uint8Array>;
139
+ /** Open an envelope from {@link sealedPut} for this slot (StoragePayloadError on failure). */
140
+ openSealed(ns: Uint8Array, key: Uint8Array, sealed: Uint8Array, signingKey: Uint8Array | undefined): Promise<Uint8Array>;
141
+ /** Read and open a sealed framework payload; null when the slot is empty. */
142
+ sealedGet(ns: Uint8Array, key: Uint8Array, signingKey: Uint8Array | undefined): Promise<Uint8Array | null>;
102
143
  static packIntKey(i: number | bigint): Uint8Array;
103
144
  }
145
+ /**
146
+ * The attach shard key the framework stamped on a request's bind call when it
147
+ * opened the attach (`att-<uuid hex>`), or `""` when there is none.
148
+ */
149
+ export declare function shardKeyOf(bindCall: {
150
+ storage_shard_key?: string | null | undefined;
151
+ } | null | undefined): string;
104
152
  /**
105
153
  * Resolve the FunctionStorage backend from environment variables.
106
154
  *
@@ -7,6 +7,7 @@ import type { VgiFunction, FunctionExample } from "./types.js";
7
7
  import type { ArgumentConstraints } from "../arguments/argument-spec.js";
8
8
  import { FunctionStability } from "../types.js";
9
9
  import { BoundStorage } from "./storage.js";
10
+ import { ExecutionCache } from "./execution-cache.js";
10
11
  export interface TableBufferingBindParams<TArgs = Record<string, any>> {
11
12
  args: TArgs;
12
13
  bindCall: BindRequest;
@@ -102,6 +103,35 @@ export interface TableBufferingVgiFunction extends VgiFunction {
102
103
  bufferingExtractArgs: (request: BindRequest) => any;
103
104
  }
104
105
  export declare function defineTableBufferingFunction<TArgs = Record<string, any>, TState = any>(config: TableBufferingConfig<TArgs, TState>): TableBufferingVgiFunction;
106
+ /** Decoded buffered init context, as cached and as returned by the loader. */
107
+ export interface BufferingInit {
108
+ request: InitRequest;
109
+ response: GlobalInitResponse;
110
+ }
111
+ /**
112
+ * Decoded buffered-init context per (shard, execution). The init is written
113
+ * once and read on every process/combine RPC; with this, a process batch costs
114
+ * the function's own storage calls only. Small: one entry per in-flight
115
+ * buffered execution, evicted by the destructor.
116
+ */
117
+ export declare const bufferingInitCache: ExecutionCache<BufferingInit>;
118
+ /**
119
+ * Persist a buffered sink init's context so any worker can serve the unary
120
+ * process/combine RPCs that follow, which carry no init context themselves.
121
+ *
122
+ * The stored InitRequest carries `bind_call.secrets`, so it is sealed
123
+ * (./storage-seal.ts) to its (shard, execution, ns, key) slot. Its attach and
124
+ * transaction values are NOT stored: every process/combine request carries
125
+ * them, and the loader fills them in from the request after opening them.
126
+ */
127
+ export declare function persistBufferingInit(request: InitRequest, response: GlobalInitResponse, signingKey: Uint8Array | undefined): Promise<void>;
128
+ /**
129
+ * Load a buffered execution's init context: the in-process cache, else the
130
+ * sealed storage copy (opened, decoded, then cached). Throws when the
131
+ * execution is unknown, and StoragePayloadError when the stored copy does not
132
+ * authenticate for this shard / execution.
133
+ */
134
+ export declare function loadBufferingInit(bound: BoundStorage, signingKey: Uint8Array | undefined): Promise<BufferingInit>;
105
135
  export declare function encodeBufferingInit(request: InitRequest, response: GlobalInitResponse): Uint8Array;
106
136
  export declare function decodeBufferingInit(payload: Uint8Array): {
107
137
  request: InitRequest;
@@ -15,6 +15,13 @@ export interface VgiFetchOptions extends HostingOptions {
15
15
  * grants): tickets sealed under a generated key would die on restart.
16
16
  * Defaults to `true`, since this factory requires the key to be passed. */
17
17
  signingKeyConfigured?: boolean | undefined;
18
+ /**
19
+ * Input key material for sealed framework storage payloads. Pass the
20
+ * configured `VGI_SIGNING_KEY` *string* (its UTF-8 bytes are the cross-SDK
21
+ * ikm, so Python, Java and TypeScript workers of one deployment agree), or
22
+ * bytes to use unchanged. Defaults to {@link signingKey}'s bytes.
23
+ */
24
+ storageSealKey?: Uint8Array | string | undefined;
18
25
  /** State-token TTL in seconds (default 3600). */
19
26
  tokenTtl?: number | undefined;
20
27
  /** URL path prefix for VGI requests (default "/vgi"). Pass "" to mount at
@@ -48,8 +48,9 @@ export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, }
48
48
  export { schema, field, nullType, int8, int16, int64, uint8, uint16, uint32, uint64, float16, float64, utf8, largeUtf8, binary, largeBinary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, codecFor, asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, readCanonicalValue, columnFromArray, decodeDictValue, backend, adoptArrowJsShape, } from "./arrow/index.js";
49
49
  export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, RichValue, RawValue, ValueFor, Repr, Codec, Branded, Date32, Date64Ms, Time32S, Time32Ms, Time64Us, Time64Ns, TimestampSeconds, TimestampMillis, TimestampMicros, TimestampNanos, DurationSeconds, DurationMillis, DurationMicros, DurationNanos, UnscaledDecimal, Int64Raw, Uint64Raw, } from "./arrow/index.js";
50
50
  export type { ScalarComputeRow, ScalarOutputValue, ScalarComputeResult } from "./functions/scalar.js";
51
- export { type FunctionStorage, type WorkerStateKey, FunctionStorageSqlite, BoundStorage, UnknownInvocationError, resolveStorageFromEnv, setStorage, storage as functionStorage, } from "./functions/storage.js";
52
- export { FunctionStorageCfDo, type FetchLike } from "./functions/storage-cf-do.js";
51
+ export { type FunctionStorage, type WorkerStateKey, FunctionStorageSqlite, BoundStorage, UnknownInvocationError, resolveStorageFromEnv, setStorage, shardKeyOf, storage as functionStorage, } from "./functions/storage.js";
52
+ export { FunctionStorageCfDo, type FetchLike, type CfDoRetryOptions } from "./functions/storage-cf-do.js";
53
+ export { StoragePayloadError } from "./functions/storage-seal.js";
53
54
  export { VgiClient, VgiClientError } from "./client/client.js";
54
55
  export type { VgiClientOptions, TableFunctionOptions, TableFunctionRowsOptions, Int64Mode, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType as ClientCatalogFunctionType, CatalogAttachOptions, AttachOptionValue, CatalogSnapshot, LoadCatalogOptions, } from "./client/types.js";
55
56
  export { str, bytes, int, int32, float, float32, bool, toSchema, OutputCollector, AuthContext } from "@query-farm/vgi-rpc";