@query-farm/vgi 0.20.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.
Files changed (54) hide show
  1. package/dist/arrow/impl-arrowjs/index.d.ts +7 -0
  2. package/dist/arrow/impl-flechette/arrowjs-shape.d.ts +16 -0
  3. package/dist/arrow/impl-flechette/compat.d.ts +22 -0
  4. package/dist/arrow/impl-flechette/index.d.ts +2 -0
  5. package/dist/arrow/impl-flechette/ipc.d.ts +1 -1
  6. package/dist/arrow/index.d.ts +2 -2
  7. package/dist/arrow/predicates.d.ts +16 -0
  8. package/dist/cache-control.d.ts +33 -0
  9. package/dist/catalog/composite.d.ts +2 -0
  10. package/dist/catalog/interface.d.ts +11 -0
  11. package/dist/client-entry.js +9 -3
  12. package/dist/client-entry.js.map +7 -7
  13. package/dist/functions/registry.d.ts +31 -0
  14. package/dist/functions/scalar.d.ts +7 -3
  15. package/dist/generated/vgi-client.d.ts +16 -0
  16. package/dist/index.core.d.ts +2 -2
  17. package/dist/index.js +175 -19
  18. package/dist/index.js.map +19 -19
  19. package/dist/protocol/handlers/function.d.ts +8 -0
  20. package/dist/protocol/handlers/shared.d.ts +4 -0
  21. package/dist/protocol/types.d.ts +8 -0
  22. package/dist/serve-entry.js +40 -13
  23. package/dist/serve-entry.js.map +10 -10
  24. package/dist/util/arrow/index.d.ts +1 -1
  25. package/dist/worker-cf-entry.js +167 -17
  26. package/dist/worker-cf-entry.js.map +17 -17
  27. package/dist/worker.d.ts +9 -0
  28. package/package.json +5 -5
  29. package/src/arrow/impl-arrowjs/index.ts +10 -0
  30. package/src/arrow/impl-flechette/arrowjs-shape.ts +78 -0
  31. package/src/arrow/impl-flechette/canonical.ts +19 -0
  32. package/src/arrow/impl-flechette/compat.ts +254 -0
  33. package/src/arrow/impl-flechette/empty.ts +5 -1
  34. package/src/arrow/impl-flechette/index.ts +8 -0
  35. package/src/arrow/impl-flechette/ipc.ts +72 -6
  36. package/src/arrow/impl-flechette/normalize-type.ts +10 -2
  37. package/src/arrow/impl-flechette/schema.ts +13 -9
  38. package/src/arrow/index.ts +3 -0
  39. package/src/arrow/predicates.ts +59 -0
  40. package/src/cache-control.ts +35 -0
  41. package/src/catalog/composite.ts +9 -0
  42. package/src/catalog/interface.ts +15 -0
  43. package/src/catalog/read-only.ts +13 -0
  44. package/src/functions/registry.ts +127 -5
  45. package/src/functions/scalar.ts +10 -5
  46. package/src/generated/vgi-client.ts +17 -1
  47. package/src/index.core.ts +4 -0
  48. package/src/protocol/dispatch.ts +1 -0
  49. package/src/protocol/handlers/function.ts +38 -9
  50. package/src/protocol/handlers/shared.ts +25 -1
  51. package/src/protocol/serializers/bind.ts +7 -0
  52. package/src/protocol/types.ts +8 -0
  53. package/src/util/arrow/index.ts +1 -0
  54. package/src/worker.ts +15 -1
@@ -1 +1 @@
1
- export { emptyBatch, batchFromRows, batchFromColumns, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "../../arrow/index.js";
1
+ export { emptyBatch, batchFromRows, batchFromColumns, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, adoptArrowJsShape, } from "../../arrow/index.js";
@@ -95,6 +95,42 @@ function isDuration(t) {
95
95
  function isDictionary(t) {
96
96
  return t.typeId === TypeId.Dictionary;
97
97
  }
98
+ function typeSignature(t) {
99
+ if (t == null)
100
+ return "null";
101
+ const a = t;
102
+ const kids = () => Array.isArray(a.children) ? a.children.map((c) => `${c?.name ?? ""}:${typeSignature(c?.type ?? c)}`).join(",") : "";
103
+ switch (t.typeId) {
104
+ case TypeId.Int:
105
+ return `int${a.bitWidth}${a.isSigned ?? a.signed ?? true ? "" : "u"}`;
106
+ case TypeId.Float:
107
+ return `float${a.precision}`;
108
+ case TypeId.Decimal:
109
+ return `decimal${a.bitWidth ?? 128}(${a.precision},${a.scale})`;
110
+ case TypeId.Date:
111
+ case TypeId.Time:
112
+ case TypeId.Duration:
113
+ return `${t.typeId}[${a.unit}]`;
114
+ case TypeId.Timestamp:
115
+ return `ts[${a.unit},${a.timezone ?? ""}]`;
116
+ case TypeId.Interval:
117
+ return `iv[${a.unit}]`;
118
+ case TypeId.FixedSizeBinary:
119
+ return `fsb(${a.byteWidth ?? a.stride})`;
120
+ case TypeId.FixedSizeList:
121
+ return `fsl(${a.listSize ?? a.stride},${kids()})`;
122
+ case TypeId.List:
123
+ case TypeId.Struct:
124
+ case TypeId.Map:
125
+ return `${t.typeId}<${kids()}>`;
126
+ case TypeId.Union:
127
+ return `union(${a.mode},${kids()})`;
128
+ case TypeId.Dictionary:
129
+ return `dict(${typeSignature(a.dictionary)},${typeSignature(a.indices)},${a.ordered ?? a.isOrdered ?? false})`;
130
+ default:
131
+ return Array.isArray(a.children) ? `${t.typeId}<${kids()}>` : String(t.typeId);
132
+ }
133
+ }
98
134
  function isBatch(x) {
99
135
  return x != null && typeof x.numRows === "number" && x.schema != null && Array.isArray(x.schema.fields);
100
136
  }
@@ -1825,11 +1861,15 @@ __export(exports_impl_arrowjs, {
1825
1861
  batchFromRows: () => batchFromRows,
1826
1862
  batchFromColumns: () => batchFromColumns,
1827
1863
  backend: () => backend,
1864
+ adoptArrowJsShape: () => adoptArrowJsShape,
1828
1865
  UnionMode: () => UnionMode,
1829
1866
  TimeUnit: () => TimeUnit,
1830
1867
  IntervalUnit: () => IntervalUnit,
1831
1868
  DateUnit: () => DateUnit
1832
1869
  });
1870
+ function adoptArrowJsShape(batch) {
1871
+ return batch;
1872
+ }
1833
1873
  var backend;
1834
1874
  var init_impl_arrowjs = __esm(() => {
1835
1875
  init_schema();
@@ -1945,6 +1985,7 @@ __export(exports_arrow, {
1945
1985
  uint64: () => uint642,
1946
1986
  uint32: () => uint322,
1947
1987
  uint16: () => uint162,
1988
+ typeSignature: () => typeSignature,
1948
1989
  timestampSeconds: () => timestampSeconds,
1949
1990
  timestampNanos: () => timestampNanos,
1950
1991
  timestampMillis: () => timestampMillis,
@@ -2048,6 +2089,7 @@ __export(exports_arrow, {
2048
2089
  asDurationMicros: () => asDurationMicros,
2049
2090
  asDate64Ms: () => asDate64Ms,
2050
2091
  asDate32: () => asDate32,
2092
+ adoptArrowJsShape: () => adoptArrowJsShape,
2051
2093
  UnionMode: () => UnionMode2,
2052
2094
  TypeId: () => TypeId,
2053
2095
  TimeUnit: () => TimeUnit2,
@@ -2893,7 +2935,8 @@ var BIND_REQUEST_SCHEMA = schema2([
2893
2935
  field2("transaction_opaque_data", binary2(), true),
2894
2936
  field2("resolved_secrets_provided", bool2(), false),
2895
2937
  field2("at_unit", utf82(), true),
2896
- field2("at_value", utf82(), true)
2938
+ field2("at_value", utf82(), true),
2939
+ field2("schema_name", utf82(), true)
2897
2940
  ]);
2898
2941
  var COPY_FROM_STRUCT_TYPE = struct2([
2899
2942
  field2("format", utf82(), false),
@@ -2961,6 +3004,7 @@ function deserializeBindRequest(params) {
2961
3004
  resolved_secrets_provided: params.resolved_secrets_provided ?? false,
2962
3005
  at_unit: params.at_unit ? String(params.at_unit) : null,
2963
3006
  at_value: params.at_value ? String(params.at_value) : null,
3007
+ schema_name: params.schema_name ? String(params.schema_name) : null,
2964
3008
  copy_from: parseCopyFromContext(params.copy_from),
2965
3009
  copy_to: parseCopyToContext(params.copy_to)
2966
3010
  };
@@ -3791,11 +3835,21 @@ function wrapResult(values, innerSchema) {
3791
3835
  const batch = batchFromColumns(Object.fromEntries(a.fields.map((f) => [f.name, [values[f.name] ?? null]])), a);
3792
3836
  return { result: serializeBatch(batch) };
3793
3837
  }
3794
- function overloadContext(req) {
3838
+ function overloadContext(req, catalogInterface) {
3839
+ let catalogName = null;
3840
+ if (catalogInterface && req.attach_opaque_data) {
3841
+ try {
3842
+ catalogName = catalogInterface.catalogNameForAttach(req.attach_opaque_data);
3843
+ } catch {
3844
+ catalogName = null;
3845
+ }
3846
+ }
3795
3847
  return {
3796
3848
  arguments: req.arguments,
3797
3849
  inputSchema: req.input_schema,
3798
- isScalar: String(req.function_type).toLowerCase() === "scalar"
3850
+ isScalar: String(req.function_type).toLowerCase() === "scalar",
3851
+ schemaName: req.schema_name ?? null,
3852
+ catalogName
3799
3853
  };
3800
3854
  }
3801
3855
  function recoverFinalizeState(request, recoverExchangeState) {
@@ -4810,7 +4864,7 @@ var columnOpParams = schema2([
4810
4864
 
4811
4865
  // src/protocol/handlers/function.ts
4812
4866
  function registerFunctionMethods(protocol, config) {
4813
- const { registry, signingKey } = config;
4867
+ const { registry, signingKey, catalogInterface } = config;
4814
4868
  async function stripAttach(attach, ctx) {
4815
4869
  if (attach == null)
4816
4870
  return null;
@@ -4819,6 +4873,15 @@ function registerFunctionMethods(protocol, config) {
4819
4873
  return env;
4820
4874
  return openAttach(env, ctx?.auth, signingKey);
4821
4875
  }
4876
+ async function strippedContext(bindCall, ctx) {
4877
+ let attach = null;
4878
+ try {
4879
+ attach = await stripAttach(bindCall.attach_opaque_data, ctx);
4880
+ } catch {
4881
+ attach = null;
4882
+ }
4883
+ return overloadContext({ ...bindCall, attach_opaque_data: attach }, catalogInterface);
4884
+ }
4822
4885
  const initHeaderSchema = schema2([
4823
4886
  field2("execution_id", binary2(), false),
4824
4887
  field2("opaque_data", binary2(), true),
@@ -4835,7 +4898,7 @@ function registerFunctionMethods(protocol, config) {
4835
4898
  const innerParams = unwrapRequest(params.request);
4836
4899
  const request = deserializeBindRequest(innerParams);
4837
4900
  request.attach_opaque_data = await stripAttach(request.attach_opaque_data, ctx);
4838
- const func = registry.get(request.function_name, overloadContext(request));
4901
+ const func = registry.get(request.function_name, overloadContext(request, catalogInterface));
4839
4902
  const response = await func.bind(request);
4840
4903
  const serialized = serializeBindResponse(response);
4841
4904
  return wrapResult(serialized, BindResultSchema);
@@ -4850,7 +4913,7 @@ function registerFunctionMethods(protocol, config) {
4850
4913
  const innerParams = unwrapRequest(params.request);
4851
4914
  const request = deserializeInitRequest(innerParams);
4852
4915
  request.bind_call.attach_opaque_data = await stripAttach(request.bind_call.attach_opaque_data, undefined);
4853
- const func = registry.get(request.bind_call.function_name, overloadContext(request.bind_call));
4916
+ const func = registry.get(request.bind_call.function_name, overloadContext(request.bind_call, catalogInterface));
4854
4917
  const initResponse = await func.globalInit(request);
4855
4918
  const accumulatedState = recoverFinalizeState(request, config.recoverExchangeState);
4856
4919
  const handlers = func.createStreamHandlers(request, initResponse, accumulatedState);
@@ -4880,6 +4943,7 @@ function registerFunctionMethods(protocol, config) {
4880
4943
  return state;
4881
4944
  },
4882
4945
  exchange: async (state, input, out) => {
4946
+ input = adoptArrowJsShape(input);
4883
4947
  let handlers;
4884
4948
  let handlerState;
4885
4949
  if (state._handlers) {
@@ -4889,7 +4953,7 @@ function registerFunctionMethods(protocol, config) {
4889
4953
  const initRequestBatch = deserializeBatch(state.initRequestIpc);
4890
4954
  const initRequestDict = batchToScalarDict(initRequestBatch);
4891
4955
  const request = deserializeInitRequest(initRequestDict);
4892
- const func = registry.get(state.functionName, overloadContext(request.bind_call));
4956
+ const func = registry.get(state.functionName, await strippedContext(request.bind_call));
4893
4957
  const executionId = state.executionId;
4894
4958
  const opaqueData = state.opaqueData ?? null;
4895
4959
  const initResponse = {
@@ -4937,7 +5001,7 @@ function registerFunctionMethods(protocol, config) {
4937
5001
  handler: async (params) => {
4938
5002
  const innerParams = unwrapRequest(params.request);
4939
5003
  const request = deserializeCardinalityRequest(innerParams);
4940
- const func = registry.get(request.bind_call.function_name, overloadContext(request.bind_call));
5004
+ const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
4941
5005
  let cardResult;
4942
5006
  if (func.cardinality) {
4943
5007
  cardResult = serializeTableCardinality(await func.cardinality(request));
@@ -4950,10 +5014,10 @@ function registerFunctionMethods(protocol, config) {
4950
5014
  protocol.unary("table_function_statistics", {
4951
5015
  params: REQUEST_PARAMS_SCHEMA,
4952
5016
  result: RESULT_BINARY_NULLABLE_SCHEMA,
4953
- handler: (params) => {
5017
+ handler: async (params) => {
4954
5018
  const innerParams = unwrapRequest(params.request);
4955
5019
  const request = deserializeCardinalityRequest(innerParams);
4956
- const func = registry.get(request.bind_call.function_name, overloadContext(request.bind_call));
5020
+ const func = registry.get(request.bind_call.function_name, await strippedContext(request.bind_call));
4957
5021
  if (!func.statistics)
4958
5022
  return { result: null };
4959
5023
  const stats = func.statistics(request);
@@ -4973,7 +5037,7 @@ function registerFunctionMethods(protocol, config) {
4973
5037
  const bindCall = deserializeBindRequest(bindParams);
4974
5038
  const globalExecutionId = toUint8Array(innerParams.global_execution_id);
4975
5039
  const bindOpaqueData = innerParams.bind_opaque_data ? toUint8Array(innerParams.bind_opaque_data) : null;
4976
- const func = registry.get(bindCall.function_name, overloadContext(bindCall));
5040
+ const func = registry.get(bindCall.function_name, await strippedContext(bindCall));
4977
5041
  const map3 = func.dynamicToString ? await func.dynamicToString({ bindCall, bindOpaqueData, globalExecutionId }) : {};
4978
5042
  const keys = Object.keys(map3);
4979
5043
  const values = keys.map((k) => map3[k] ?? "");
@@ -6454,6 +6518,10 @@ function isPromise(v) {
6454
6518
  }
6455
6519
 
6456
6520
  class CatalogInterface {
6521
+ catalogNameForAttach(_attachOpaqueData) {
6522
+ const names = this.catalogs();
6523
+ return names.length === 1 ? names[0] : null;
6524
+ }
6457
6525
  create(name, onConflict, options) {
6458
6526
  throw new CatalogReadOnlyError("create");
6459
6527
  }
@@ -7188,7 +7256,8 @@ function buildVgiProtocol(config) {
7188
7256
  registerFunctionMethods(protocol, {
7189
7257
  registry: config.registry,
7190
7258
  recoverExchangeState: config.recoverExchangeState,
7191
- signingKey: config.signingKey
7259
+ signingKey: config.signingKey,
7260
+ catalogInterface: config.catalogInterface
7192
7261
  });
7193
7262
  registerAggregateMethods(protocol, config.registry);
7194
7263
  registerTableBufferingMethods(protocol, config.registry, config.signingKey);
@@ -7236,6 +7305,8 @@ var CACHE_REVALIDATABLE_KEY = "vgi.cache.revalidatable";
7236
7305
  var CACHE_STALE_WHILE_REVALIDATE_KEY = "vgi.cache.stale_while_revalidate";
7237
7306
  var CACHE_STALE_IF_ERROR_KEY = "vgi.cache.stale_if_error";
7238
7307
  var CACHE_NOT_MODIFIED_KEY = "vgi.cache.not_modified";
7308
+ var CACHE_PARTITION_SCOPE_KEY = "vgi.cache.partition_scope";
7309
+ var CACHE_PER_VALUE_KEY = "vgi.cache.per_value";
7239
7310
  var CACHE_IF_NONE_MATCH_KEY = "vgi.cache.if_none_match";
7240
7311
  var CACHE_IF_MODIFIED_SINCE_KEY = "vgi.cache.if_modified_since";
7241
7312
  var CACHE_SCOPE_CATALOG = "catalog";
@@ -7272,6 +7343,10 @@ function cacheControlMetadata(cc, extra) {
7272
7343
  md.set(CACHE_STALE_IF_ERROR_KEY, String(cc.staleIfError));
7273
7344
  if (cc.notModified)
7274
7345
  md.set(CACHE_NOT_MODIFIED_KEY, "1");
7346
+ if (cc.partitionScope)
7347
+ md.set(CACHE_PARTITION_SCOPE_KEY, "1");
7348
+ if (cc.perValue)
7349
+ md.set(CACHE_PER_VALUE_KEY, "1");
7275
7350
  return md;
7276
7351
  }
7277
7352
 
@@ -8042,6 +8117,17 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
8042
8117
  super();
8043
8118
  this._descriptor = descriptor;
8044
8119
  this._registry = registry;
8120
+ for (const sch of descriptor.schemas ?? []) {
8121
+ for (const fn of sch.functions ?? [])
8122
+ registry.registerInSchema(fn, sch.name, descriptor.name);
8123
+ for (const tbl of sch.tables ?? []) {
8124
+ for (const key of ["function", "insertFunction", "updateFunction", "deleteFunction"]) {
8125
+ const fn = tbl[key];
8126
+ if (fn)
8127
+ registry.registerInSchema(fn, sch.name, descriptor.name);
8128
+ }
8129
+ }
8130
+ }
8045
8131
  }
8046
8132
  catalogs() {
8047
8133
  return [this._descriptor.name];
@@ -8664,6 +8750,13 @@ class CompositeCatalogInterface extends CatalogInterface {
8664
8750
  }
8665
8751
  return route;
8666
8752
  }
8753
+ catalogNameForAttach(attachOpaqueData) {
8754
+ try {
8755
+ return this._route(attachOpaqueData).catalogNameForAttach(attachOpaqueData);
8756
+ } catch {
8757
+ return null;
8758
+ }
8759
+ }
8667
8760
  catalogs() {
8668
8761
  const all = [];
8669
8762
  for (const b of this._backends)
@@ -8761,8 +8854,11 @@ class CompositeCatalogInterface extends CatalogInterface {
8761
8854
  init_arrow();
8762
8855
  var EXACT_MATCH_SCORE = 2;
8763
8856
  var FAMILY_MATCH_SCORE = 1;
8857
+ function typesIdentical(a, b) {
8858
+ return typeSignature(a) === typeSignature(b);
8859
+ }
8764
8860
  function typesCompatible(actual, declared) {
8765
- if (actual.toString() === declared.toString())
8861
+ if (typesIdentical(actual, declared))
8766
8862
  return true;
8767
8863
  if (isInt(actual) && isInt(declared))
8768
8864
  return true;
@@ -8790,7 +8886,7 @@ function scoreTypes(specs, actualTypes) {
8790
8886
  const actual = actualTypes[i];
8791
8887
  if (actual === null)
8792
8888
  continue;
8793
- if (actual.toString() === spec.arrowType.toString()) {
8889
+ if (typesIdentical(actual, spec.arrowType)) {
8794
8890
  score += EXACT_MATCH_SCORE;
8795
8891
  } else if (typesCompatible(actual, spec.arrowType)) {
8796
8892
  score += FAMILY_MATCH_SCORE;
@@ -8803,7 +8899,7 @@ function scoreTypes(specs, actualTypes) {
8803
8899
  const actual = actualTypes[i];
8804
8900
  if (actual === null)
8805
8901
  continue;
8806
- if (actual.toString() === varArgsSpec.arrowType.toString()) {
8902
+ if (typesIdentical(actual, varArgsSpec.arrowType)) {
8807
8903
  score += EXACT_MATCH_SCORE;
8808
8904
  } else if (typesCompatible(actual, varArgsSpec.arrowType)) {
8809
8905
  score += FAMILY_MATCH_SCORE;
@@ -8889,9 +8985,17 @@ function filterByArgumentTypes(candidates, args, inputSchema, isScalar) {
8889
8985
  const maxScore = Math.max(...scored.map((s) => s.score));
8890
8986
  return scored.filter((s) => s.score === maxScore).map((s) => s.func);
8891
8987
  }
8988
+ function schemaKey(schemaName, functionName) {
8989
+ return `${schemaName.toLowerCase()}\x00${functionName}`;
8990
+ }
8991
+ function catalogKey(catalogName, schemaName, functionName) {
8992
+ return `${catalogName.toLowerCase()}\x00${schemaKey(schemaName, functionName)}`;
8993
+ }
8892
8994
 
8893
8995
  class FunctionRegistry {
8894
8996
  _functions = new Map;
8997
+ _bySchema = new Map;
8998
+ _byCatalog = new Map;
8895
8999
  register(func) {
8896
9000
  const name = func.meta.name;
8897
9001
  if (!this._functions.has(name)) {
@@ -8899,11 +9003,57 @@ class FunctionRegistry {
8899
9003
  }
8900
9004
  this._functions.get(name).push(func);
8901
9005
  }
9006
+ registerInSchema(func, schemaName, catalogName) {
9007
+ const add = (map3, key) => {
9008
+ const bucket = map3.get(key);
9009
+ if (!bucket) {
9010
+ map3.set(key, [func]);
9011
+ return;
9012
+ }
9013
+ if (!bucket.includes(func))
9014
+ bucket.push(func);
9015
+ };
9016
+ add(this._bySchema, schemaKey(schemaName, func.meta.name));
9017
+ if (catalogName) {
9018
+ add(this._byCatalog, catalogKey(catalogName, schemaName, func.meta.name));
9019
+ }
9020
+ }
9021
+ schemasFor(functionName) {
9022
+ const out = [];
9023
+ for (const key of this._bySchema.keys()) {
9024
+ const [schema3, name] = key.split("\x00");
9025
+ if (name === functionName)
9026
+ out.push(schema3);
9027
+ }
9028
+ return out.sort();
9029
+ }
8902
9030
  get(name, context) {
8903
- const candidates = this._functions.get(name);
9031
+ let candidates = this._functions.get(name);
9032
+ const catalogName = context?.catalogName;
9033
+ const schemaName = context?.schemaName;
9034
+ if (catalogName && schemaName) {
9035
+ const scoped = this._byCatalog.get(catalogKey(catalogName, schemaName, name));
9036
+ if (scoped && scoped.length > 0) {
9037
+ return this._disambiguate(name, scoped, context);
9038
+ }
9039
+ }
9040
+ if (schemaName) {
9041
+ const scoped = this._bySchema.get(schemaKey(schemaName, name));
9042
+ if (scoped && scoped.length > 0) {
9043
+ candidates = scoped;
9044
+ } else if (candidates && candidates.length > 0) {
9045
+ const schemas = this.schemasFor(name);
9046
+ if (schemas.length > 0) {
9047
+ throw new Error(`Function '${name}' is not registered in schema '${schemaName}'. ` + `It is available in: [${schemas.join(", ")}]`);
9048
+ }
9049
+ }
9050
+ }
8904
9051
  if (!candidates || candidates.length === 0) {
8905
9052
  throw new FunctionNotFoundError(name, this.names());
8906
9053
  }
9054
+ return this._disambiguate(name, candidates, context);
9055
+ }
9056
+ _disambiguate(name, candidates, context) {
8907
9057
  if (candidates.length === 1) {
8908
9058
  return candidates[0];
8909
9059
  }
@@ -9531,4 +9681,4 @@ export {
9531
9681
  Arguments
9532
9682
  };
9533
9683
 
9534
- //# debugId=9CBEC1BA4EDD0C8364756E2164756E21
9684
+ //# debugId=0DAB6D0BDC711A3364756E2164756E21