@query-farm/vgi 0.21.0 → 0.22.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.
- package/dist/cache-control.d.ts +26 -0
- package/dist/catalog/composite.d.ts +2 -0
- package/dist/catalog/interface.d.ts +11 -0
- package/dist/client-entry.js +5 -3
- package/dist/client-entry.js.map +5 -5
- package/dist/functions/registry.d.ts +31 -0
- package/dist/functions/scalar.d.ts +7 -3
- package/dist/generated/vgi-client.d.ts +16 -0
- package/dist/index.core.d.ts +1 -1
- package/dist/index.js +120 -16
- package/dist/index.js.map +15 -15
- package/dist/protocol/handlers/function.d.ts +8 -0
- package/dist/protocol/handlers/shared.d.ts +4 -0
- package/dist/protocol/types.d.ts +8 -0
- package/dist/serve-entry.js +35 -13
- package/dist/serve-entry.js.map +8 -8
- package/dist/worker-cf-entry.js +115 -14
- package/dist/worker-cf-entry.js.map +13 -13
- package/dist/worker.d.ts +9 -0
- package/package.json +3 -3
- package/src/cache-control.ts +27 -0
- package/src/catalog/composite.ts +9 -0
- package/src/catalog/interface.ts +15 -0
- package/src/catalog/read-only.ts +13 -0
- package/src/functions/registry.ts +106 -1
- package/src/functions/scalar.ts +10 -5
- package/src/generated/vgi-client.ts +17 -1
- package/src/index.core.ts +1 -0
- package/src/protocol/dispatch.ts +1 -0
- package/src/protocol/handlers/function.ts +29 -8
- package/src/protocol/handlers/shared.ts +25 -1
- package/src/protocol/serializers/bind.ts +7 -0
- package/src/protocol/types.ts +8 -0
- package/src/worker.ts +15 -1
package/src/worker.ts
CHANGED
|
@@ -65,6 +65,14 @@ export interface WorkerConfig {
|
|
|
65
65
|
/** Factory that receives the built ReadOnlyCatalogInterface and returns a custom catalog. */
|
|
66
66
|
catalogInterfaceFactory?: (base: ReadOnlyCatalogInterface) => CatalogInterface;
|
|
67
67
|
catalogName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Registry to dispatch through. Pass the same instance used to build a
|
|
70
|
+
* pre-constructed `catalogInterface` — catalogs record which schema (and
|
|
71
|
+
* catalog) declares each function on the registry they are given, and
|
|
72
|
+
* schema-qualified resolution only works if that is the registry the worker
|
|
73
|
+
* dispatches on. Omit to have the worker create its own.
|
|
74
|
+
*/
|
|
75
|
+
registry?: FunctionRegistry;
|
|
68
76
|
}
|
|
69
77
|
|
|
70
78
|
export class Worker {
|
|
@@ -73,7 +81,10 @@ export class Worker {
|
|
|
73
81
|
private _catalogName?: string;
|
|
74
82
|
|
|
75
83
|
constructor(config: WorkerConfig) {
|
|
76
|
-
|
|
84
|
+
// Reuse the caller's registry when given: a catalogInterface built
|
|
85
|
+
// elsewhere recorded its per-schema function ownership there, and that
|
|
86
|
+
// index is what makes a schema-qualified bind resolve correctly.
|
|
87
|
+
this._registry = config.registry ?? new FunctionRegistry();
|
|
77
88
|
this._catalogName = config.catalogName;
|
|
78
89
|
|
|
79
90
|
// Register explicit functions
|
|
@@ -89,6 +100,9 @@ export class Worker {
|
|
|
89
100
|
if (schema.functions) {
|
|
90
101
|
for (const func of schema.functions) {
|
|
91
102
|
this._registry.register(func);
|
|
103
|
+
// Also index by owning schema + catalog so a schema-qualified bind
|
|
104
|
+
// resolves when one name is declared in more than one schema.
|
|
105
|
+
this._registry.registerInSchema(func, schema.name, config.catalog.name);
|
|
92
106
|
}
|
|
93
107
|
}
|
|
94
108
|
}
|