@query-farm/vgi 0.30.0 → 0.32.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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/catalog/item-encoding.d.ts +17 -0
  3. package/dist/catalog/read-only.d.ts +16 -0
  4. package/dist/client-entry.js +19 -1
  5. package/dist/client-entry.js.map +3 -3
  6. package/dist/filter-pushdown/evaluate.d.ts +9 -0
  7. package/dist/filter-pushdown/history.d.ts +66 -0
  8. package/dist/filter-pushdown/index.d.ts +1 -0
  9. package/dist/functions/storage-cf-do.d.ts +2 -2
  10. package/dist/functions/storage.d.ts +39 -3
  11. package/dist/functions/table-in-out.d.ts +13 -8
  12. package/dist/functions/types.d.ts +14 -1
  13. package/dist/http/fetch.d.ts +1 -1
  14. package/dist/index.core.d.ts +1 -1
  15. package/dist/index.js +1280 -924
  16. package/dist/index.js.map +21 -17
  17. package/dist/protocol/carried-init-request.d.ts +28 -0
  18. package/dist/protocol/dispatch.d.ts +26 -7
  19. package/dist/protocol/handlers/function.d.ts +0 -1
  20. package/dist/protocol/handlers/shared.d.ts +0 -7
  21. package/dist/protocol/state-serializer.d.ts +29 -2
  22. package/dist/serve-entry.js +395 -188
  23. package/dist/serve-entry.js.map +16 -12
  24. package/dist/util/zstd-sync.d.ts +7 -0
  25. package/dist/worker-cf-entry.js +5047 -4710
  26. package/dist/worker-cf-entry.js.map +25 -21
  27. package/package.json +5 -4
  28. package/src/catalog/item-encoding.ts +59 -0
  29. package/src/catalog/read-only.ts +87 -19
  30. package/src/client/errors.ts +19 -0
  31. package/src/filter-pushdown/evaluate.ts +55 -8
  32. package/src/filter-pushdown/history.ts +239 -0
  33. package/src/filter-pushdown/index.ts +8 -0
  34. package/src/functions/storage-cf-do.ts +7 -12
  35. package/src/functions/storage.ts +54 -11
  36. package/src/functions/table-buffering.ts +0 -1
  37. package/src/functions/table-in-out.ts +99 -60
  38. package/src/functions/table.ts +41 -38
  39. package/src/functions/types.ts +14 -1
  40. package/src/http/fetch.ts +1 -9
  41. package/src/index.core.ts +1 -0
  42. package/src/protocol/carried-init-request.ts +139 -0
  43. package/src/protocol/dispatch.ts +28 -9
  44. package/src/protocol/handlers/catalog/admin.ts +5 -2
  45. package/src/protocol/handlers/function.ts +18 -15
  46. package/src/protocol/handlers/shared.ts +0 -22
  47. package/src/protocol/state-serializer.ts +109 -37
  48. package/src/util/zstd-sync.ts +50 -0
package/README.md CHANGED
@@ -41,7 +41,7 @@ npm install @query-farm/vgi
41
41
  Requires **Node.js ≥ 22.15** or **Bun**.
42
42
 
43
43
  > **Peer dependencies (since 0.3.0).** `@query-farm/apache-arrow` (`^21.1.1`) and
44
- > `@query-farm/vgi-rpc` (`^0.7.5`) are **peerDependencies** — install them directly
44
+ > `@query-farm/vgi-rpc` (`^0.24.0`) are **peerDependencies** — install them directly
45
45
  > alongside `@query-farm/vgi`:
46
46
  >
47
47
  > ```bash
@@ -0,0 +1,17 @@
1
+ import { type FunctionInfo } from "../generated/vgi-client.js";
2
+ /**
3
+ * Deep-freeze a catalog item (plain objects and arrays, recursively) so it can
4
+ * be shared between requests and its encoding memoized.
5
+ *
6
+ * Binary fields (`Uint8Array` and other ArrayBuffer views) are left as they are
7
+ * -- a typed array with elements cannot be frozen -- and must be treated as
8
+ * read-only by convention, like the rest of a shared item.
9
+ */
10
+ export declare function freezeCatalogItem<T extends object>(item: T): Readonly<T>;
11
+ /**
12
+ * Arrow-encode a FunctionInfo, once per frozen instance.
13
+ *
14
+ * The bytes returned for a frozen item are shared between calls; callers copy
15
+ * them into a response and never write to them.
16
+ */
17
+ export declare function encodeFunctionInfoOnce(info: FunctionInfo): Uint8Array;
@@ -7,6 +7,17 @@ export declare class ReadOnlyCatalogInterface extends CatalogInterface {
7
7
  private _registry;
8
8
  private _attachments;
9
9
  private _version;
10
+ /**
11
+ * Function listings by schema and listing type, built on first request. A
12
+ * listing depends only on the registered functions' static metadata, so it
13
+ * is built once and every request returns the same frozen FunctionInfo
14
+ * instances -- which the listing handler then encodes once each (see
15
+ * item-encoding.ts). The descriptor is treated as immutable after the first
16
+ * listing, as the rest of this class already does.
17
+ */
18
+ private _functionListings;
19
+ /** One frozen FunctionInfo per (declaring schema, function), shared by listings and `global_functions`. */
20
+ private _functionInfos;
10
21
  constructor(descriptor: CatalogDescriptor, registry: FunctionRegistry);
11
22
  /**
12
23
  * Which schema declares `fn`, by object identity, or null if no schema does.
@@ -50,6 +61,11 @@ export declare class ReadOnlyCatalogInterface extends CatalogInterface {
50
61
  } | null;
51
62
  schemaContentsViews(attachOpaqueData: AttachOpaqueData, path: string[], transactionOpaqueData?: TransactionOpaqueData): ViewInfo[];
52
63
  schemaContentsFunctions(attachOpaqueData: AttachOpaqueData, path: string[], type: string, transactionOpaqueData?: TransactionOpaqueData): FunctionInfo[];
64
+ /**
65
+ * The frozen FunctionInfo for `f` as declared in `schema`, built on first use.
66
+ * Shared between requests, so it must not (and, frozen, cannot) be mutated.
67
+ */
68
+ private _sharedFunctionInfo;
53
69
  /**
54
70
  * Build the wire `FunctionInfo` for one declared function.
55
71
  *
@@ -3409,6 +3409,24 @@ function wrapRpcWithErrorEnrichment(rpc) {
3409
3409
  throw e;
3410
3410
  }
3411
3411
  },
3412
+ async callRaw(method, input) {
3413
+ try {
3414
+ return await rpc.callRaw(method, input);
3415
+ } catch (e) {
3416
+ if (e instanceof RpcError)
3417
+ throw VgiClientError.fromRpcError(e);
3418
+ throw e;
3419
+ }
3420
+ },
3421
+ async streamRaw(method, input, options) {
3422
+ try {
3423
+ return await rpc.streamRaw(method, input, options);
3424
+ } catch (e) {
3425
+ if (e instanceof RpcError)
3426
+ throw VgiClientError.fromRpcError(e);
3427
+ throw e;
3428
+ }
3429
+ },
3412
3430
  describe: () => rpc.describe(),
3413
3431
  close: () => rpc.close()
3414
3432
  };
@@ -4344,4 +4362,4 @@ export {
4344
4362
  typeSignature
4345
4363
  };
4346
4364
 
4347
- //# debugId=8F5FB740A8A1AC8864756E2164756E21
4365
+ //# debugId=883855CB7A9BD5B664756E2164756E21