@query-farm/vgi 0.49.2 → 0.50.1

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 (37) hide show
  1. package/README.md +1 -1
  2. package/dist/catalog/composite.d.ts +1 -1
  3. package/dist/catalog/descriptors.d.ts +34 -2
  4. package/dist/catalog/interface.d.ts +47 -8
  5. package/dist/catalog/read-only.d.ts +48 -1
  6. package/dist/client/client.d.ts +13 -7
  7. package/dist/client-entry.d.ts +1 -1
  8. package/dist/client-entry.js +40 -16
  9. package/dist/client-entry.js.map +6 -6
  10. package/dist/functions/storage.d.ts +7 -0
  11. package/dist/generated/vgi-client.d.ts +4 -0
  12. package/dist/generated/vgi-protocol-schemas.d.ts +2 -2
  13. package/dist/generated/vgi-service.d.ts +7 -26
  14. package/dist/index.core.d.ts +4 -3
  15. package/dist/index.js +265 -170
  16. package/dist/index.js.map +16 -16
  17. package/dist/protocol/dispatch.d.ts +5 -3
  18. package/dist/serve-entry.js +43 -45
  19. package/dist/serve-entry.js.map +9 -9
  20. package/dist/worker-cf-entry.js +221 -154
  21. package/dist/worker-cf-entry.js.map +15 -15
  22. package/dist/write-results.d.ts +8 -1
  23. package/package.json +1 -1
  24. package/src/catalog/composite.ts +2 -2
  25. package/src/catalog/descriptors.ts +35 -2
  26. package/src/catalog/interface.ts +78 -10
  27. package/src/catalog/read-only.ts +297 -175
  28. package/src/client/client.ts +22 -13
  29. package/src/client-entry.ts +4 -0
  30. package/src/functions/storage.ts +44 -3
  31. package/src/generated/vgi-client.ts +6 -1
  32. package/src/generated/vgi-protocol-schemas.ts +8 -12
  33. package/src/generated/vgi-service.ts +9 -48
  34. package/src/index.core.ts +4 -3
  35. package/src/protocol/dispatch.ts +5 -3
  36. package/src/protocol/handlers/catalog/table.ts +14 -21
  37. package/src/write-results.ts +8 -3
@@ -42,6 +42,13 @@ export declare class FunctionStorageSqlite implements FunctionStorage {
42
42
  readonly dbPath: string;
43
43
  private _db;
44
44
  constructor(dbPath?: string);
45
+ /**
46
+ * Switch to WAL. Converting a fresh rollback-journal file needs an exclusive
47
+ * lock, and when two connections attempt it together SQLite returns
48
+ * SQLITE_BUSY without consulting the busy handler (waiting could deadlock),
49
+ * so retry here until busy_timeout's worth of time has passed.
50
+ */
51
+ private _setWal;
45
52
  close(): void;
46
53
  private _ensureTables;
47
54
  stateGet(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array): Promise<Uint8Array | null>;
@@ -149,6 +149,7 @@ export interface FunctionInfo {
149
149
  input_rows_per_call?: number | null;
150
150
  required_settings: string[];
151
151
  required_secrets: SecretLookupEntry[];
152
+ visibility?: string | null;
152
153
  }
153
154
  export interface QueryEvaluationContext {
154
155
  timezone: string;
@@ -568,6 +569,9 @@ export interface TableCreateRequest {
568
569
  options?: /** @ipc-record TypedValueBatch */ Uint8Array | null;
569
570
  layout?: /** @ipc-record TableLayout */ Uint8Array | null;
570
571
  }
572
+ export interface TableCreateResponse {
573
+ created: boolean;
574
+ }
571
575
  export interface TransactionBeginResponse {
572
576
  transaction_opaque_data?: Uint8Array | null;
573
577
  }
@@ -1,5 +1,5 @@
1
1
  /** Canonical fingerprint of the nested catalog wire schemas. */
2
- export declare const VGI_CATALOG_CONTRACT_HASH = "d9304d52d78b0ceb90319d9a83759781df4a711b72443790654335c8cfcad9bf";
2
+ export declare const VGI_CATALOG_CONTRACT_HASH = "e0965c93219b6ef6574d82c007c600462594a08085db1242b127ed27e193da0f";
3
3
  export declare const CatalogInfoSchema: import("../index.core.js").VgiSchema;
4
4
  export declare const SchemaInfoSchema: import("../index.core.js").VgiSchema;
5
5
  export declare const TableInfoSchema: import("../index.core.js").VgiSchema;
@@ -111,6 +111,7 @@ export declare const CatalogSchemaGetResultSchema: import("../index.core.js").Vg
111
111
  export declare const CatalogSchemaOptionDefinitionsResultSchema: import("../index.core.js").VgiSchema;
112
112
  export declare const CatalogSchemasResultSchema: import("../index.core.js").VgiSchema;
113
113
  export declare const CatalogTableConstraintsApplyResultSchema: import("../index.core.js").VgiSchema;
114
+ export declare const CatalogTableCreateResultSchema: import("../index.core.js").VgiSchema;
114
115
  export declare const CatalogTableGetResultSchema: import("../index.core.js").VgiSchema;
115
116
  export declare const CatalogTableOptionDefinitionsResultSchema: import("../index.core.js").VgiSchema;
116
117
  export declare const CatalogTransactionBeginResultSchema: import("../index.core.js").VgiSchema;
@@ -187,7 +188,6 @@ export declare const CatalogTableNotNullSetParamsSchema: import("../index.core.j
187
188
  export declare const CatalogTableOptionDefinitionsParamsSchema: import("../index.core.js").VgiSchema;
188
189
  export declare const CatalogTableRenameParamsSchema: import("../index.core.js").VgiSchema;
189
190
  export declare const CatalogTableScanBranchesGetParamsSchema: import("../index.core.js").VgiSchema;
190
- export declare const CatalogTableScanFunctionGetParamsSchema: import("../index.core.js").VgiSchema;
191
191
  export declare const CatalogTableUpdateFunctionGetParamsSchema: import("../index.core.js").VgiSchema;
192
192
  export declare const CatalogTransactionBeginParamsSchema: import("../index.core.js").VgiSchema;
193
193
  export declare const CatalogTransactionCommitParamsSchema: import("../index.core.js").VgiSchema;
@@ -3,7 +3,7 @@ import { type VgiSchema } from "../arrow/index.js";
3
3
  /** The protocol's wire name: the `vgi_rpc.protocol` routing key and the HTTP path segment. */
4
4
  export declare const VGI_PROTOCOL_NAME = "vgi.v3";
5
5
  /** The protocol's semver, stamped on every request by a client of this protocol. */
6
- export declare const VGI_PROTOCOL_VERSION = "3.2.0";
6
+ export declare const VGI_PROTOCOL_VERSION = "3.3.0";
7
7
  /** What a unary handler returns: the result row, now or later. */
8
8
  export type VgiReply<T> = T | ExternalRef | Promise<T | ExternalRef>;
9
9
  /** The result of a unary method with no `result` column. */
@@ -675,21 +675,6 @@ export interface CatalogTableScanBranchesGetParams {
675
675
  /** The `pushdown_filters` column (`binary`, nullable). */
676
676
  pushdown_filters: Uint8Array | null;
677
677
  }
678
- /** The params of `catalog_table_scan_function_get`, one property per params-schema column. */
679
- export interface CatalogTableScanFunctionGetParams {
680
- /** The `attach_opaque_data` column (`binary`). */
681
- attach_opaque_data: Uint8Array;
682
- /** The `schema_path` column (`list<item: string>`). */
683
- schema_path: WireList<string | null>;
684
- /** The `name` column (`string`). */
685
- name: string;
686
- /** The `at_unit` column (`string`, nullable). */
687
- at_unit: string | null;
688
- /** The `at_value` column (`string`, nullable). */
689
- at_value: string | null;
690
- /** The `transaction_opaque_data` column (`binary`, nullable). */
691
- transaction_opaque_data: Uint8Array | null;
692
- }
693
678
  /** The params of `catalog_table_update_function_get`, one property per params-schema column. */
694
679
  export interface CatalogTableUpdateFunctionGetParams {
695
680
  /** The `attach_opaque_data` column (`binary`). */
@@ -1281,9 +1266,13 @@ export interface VgiService {
1281
1266
  /**
1282
1267
  * Create a new table.
1283
1268
  *
1269
+ * Protocol 3.3: the reply says whether this call created the table (``created = false`` when ``IF NOT EXISTS`` found an existing one), so ``CREATE TABLE IF NOT EXISTS ... AS SELECT`` does not append into it.
1270
+ *
1284
1271
  * Wire method `catalog_table_create` (unary). Default: answers `UNIMPLEMENTED`.
1285
1272
  */
1286
- catalogTableCreate(params: CatalogTableCreateParams, ctx: CallContext): VgiReply<NoResult>;
1273
+ catalogTableCreate(params: CatalogTableCreateParams, ctx: CallContext): VgiReply<{
1274
+ result: Uint8Array;
1275
+ }>;
1287
1276
  /**
1288
1277
  * Get the delete function for a table. Returns `WriteFunctionResult` as IPC bytes.
1289
1278
  *
@@ -1347,7 +1336,7 @@ export interface VgiService {
1347
1336
  *
1348
1337
  * Protocol 3.2: ``pushdown_filters`` carries the query's predicates on the table (an Arrow IPC stream holding one VGI Filter Encoding v2 snapshot batch; column indexes refer to ``TableInfo.columns``) when the table declares ``scan_planning = "filtered"``. Every predicate is advisory. ``None`` means none were collected. See ``docs/protocol/scan-planning.md``.
1349
1338
  *
1350
- * Additive successor to ``catalog_table_scan_function_get``. Workers that only implement the legacy method continue to work — the VGI extension's C++ side catches ``MethodNotImplementedError`` and falls back to the legacy RPC, wrapping the single-function result as a one-branch list. Workers that implement BOTH the legacy and the branches method guarantee single-process compatibility with both old and new extensions.
1339
+ * Protocol 3.3: this is the only scan-discovery method; the single-function ``catalog_table_scan_function_get`` was removed. Every worker must answer it (a single-source table returns one branch). A worker answering ``MethodNotImplemented`` is a protocol error, not a fallback.
1351
1340
  *
1352
1341
  * Multi-branch tables compose a logical scan from N physical sources (canonical case: Kafka hot tier + Iceberg cold tier). The extension's optimizer rewrite stitches the branches together via ``LogicalSetOperation(UNION_ALL, ...)``, one arm per branch.
1353
1342
  *
@@ -1356,14 +1345,6 @@ export interface VgiService {
1356
1345
  catalogTableScanBranchesGet(params: CatalogTableScanBranchesGetParams, ctx: CallContext): VgiReply<{
1357
1346
  result: Uint8Array;
1358
1347
  }>;
1359
- /**
1360
- * Get the scan function for a table. Returns `ScanFunctionResult` as IPC bytes.
1361
- *
1362
- * Wire method `catalog_table_scan_function_get` (unary). Default: answers `UNIMPLEMENTED`.
1363
- */
1364
- catalogTableScanFunctionGet(params: CatalogTableScanFunctionGetParams, ctx: CallContext): VgiReply<{
1365
- result: Uint8Array;
1366
- }>;
1367
1348
  /**
1368
1349
  * Get the update function for a table. Returns `WriteFunctionResult` as IPC bytes.
1369
1350
  *
@@ -10,9 +10,10 @@ export { defineTableBufferingFunction, type TableBufferingConfig, type TableBuff
10
10
  export { defineCopyFromFunction, type CopyFromFunctionConfig, type CopyFromOption, type CopyFromReadParams, } from "./functions/copy-from.js";
11
11
  export { defineCopyToFunction, type CopyToFunctionConfig, type CopyToOption, type CopyToWriteParams, type CopyToCloseParams, } from "./functions/copy-to.js";
12
12
  export type { VgiFunction, FunctionMeta, StreamHandlers, FunctionExample, HandlerState } from "./functions/types.js";
13
- export { CatalogInterface, type CatalogAttachResult, type CatalogAttachResultInit, buildCatalogAttachResult, type SchemaContentsInfo, type CatalogContentsResult, type SchemaInfo, encodeSchemaInfo, decodeSchemaInfo, type TableInfo, encodeTableInfo, decodeTableInfo, type ViewInfo, encodeViewInfo, decodeViewInfo, type CatalogInfo, encodeCatalogInfo, decodeCatalogInfo, type FunctionInfo, encodeFunctionInfo, decodeFunctionInfo, type FunctionInfoOptions, type MacroInfo, encodeMacroInfo, decodeMacroInfo, type MacroType, type CopyFromFormatInfo, encodeCopyFromFormatInfo, type AttachOpaqueData, type TransactionOpaqueData, buildScanBranchesResult, encodeFormatOptions, type ScanBranchInput } from "./catalog/interface.js";
14
- export type { CatalogDescriptor, SchemaDescriptor, TableDescriptor, ViewDescriptor, MacroDescriptor, SettingDescriptor, SecretTypeDescriptor, ForeignKeyDef, DefaultValue } from "./catalog/descriptors.js";
15
- export { ReadOnlyCatalogInterface, READ_ONLY_ITEM_ATTACH_ID } from "./catalog/read-only.js";
13
+ export { CatalogInterface, type CatalogAttachResult, type CatalogAttachResultInit, buildCatalogAttachResult, type SchemaContentsInfo, type CatalogContentsResult, type SchemaInfo, encodeSchemaInfo, decodeSchemaInfo, type TableInfo, encodeTableInfo, decodeTableInfo, type ViewInfo, encodeViewInfo, decodeViewInfo, type CatalogInfo, encodeCatalogInfo, decodeCatalogInfo, type FunctionInfo, encodeFunctionInfo, decodeFunctionInfo, type FunctionInfoOptions, type MacroInfo, encodeMacroInfo, decodeMacroInfo, type MacroType, type CopyFromFormatInfo, encodeCopyFromFormatInfo, type AttachOpaqueData, type TransactionOpaqueData, buildScanBranchesResult, encodeFormatOptions, type ScanBranchInput, encodeScanFunctionResult, decodeScanFunctionResult, type ScanFunctionResult, decodeScanBranchesResult, type ScanBranchInfo, type ScanBranchesInfo } from "./catalog/interface.js";
14
+ export type { CatalogDescriptor, SchemaDescriptor, TableDescriptor, ViewDescriptor, MacroDescriptor, SettingDescriptor, SecretTypeDescriptor, ForeignKeyDef, DefaultValue, FunctionVisibility } from "./catalog/descriptors.js";
15
+ export { FUNCTION_VISIBILITY_PUBLIC, FUNCTION_VISIBILITY_TABLE_ONLY } from "./catalog/descriptors.js";
16
+ export { ReadOnlyCatalogInterface, READ_ONLY_ITEM_ATTACH_ID, functionInfoFor } from "./catalog/read-only.js";
16
17
  export * from "./catalog/public-codecs.js";
17
18
  export { CompositeCatalogInterface } from "./catalog/composite.js";
18
19
  export { FunctionRegistry } from "./functions/registry.js";