@query-farm/vgi 0.38.0 → 0.40.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.
@@ -1,7 +1,7 @@
1
1
  export { createVgiFetch } from "./http/fetch.js";
2
2
  export type { VgiFetchOptions } from "./http/fetch.js";
3
3
  export type { HostingOptions } from "./rpc-server.js";
4
- export { AuthUnavailableError, GrantRefusedError, IdentityUnavailableError, StatusError, } from "@query-farm/vgi-rpc";
4
+ export { AuthUnavailableError, GrantKeys, GrantRefusedError, IdentityUnavailableError, StatusError, } from "@query-farm/vgi-rpc";
5
5
  export type { GrantMinter, IssuedGrant, TokenIdentity, TokenResolver } from "@query-farm/vgi-rpc";
6
6
  export { defineScalarFunction, defineTableFunction, defineAggregate, defineTableInOutFunction, defineRowTransformFunction, parentRowsMetadata, PARENT_ROW_METADATA_KEY, constraintSpecFields, cacheControlMetadata, FunctionRegistry, ReadOnlyCatalogInterface, CompositeCatalogInterface, CatalogInterface, Arguments, FunctionType, serializeAttachOptionSpec, serializeAttachOptionSpecs, serializeColumnStatistics, BindResultSchema, ScanFunctionResultSchema, } from "./index.core.js";
7
7
  export type { CacheControl, CacheScope, AttachOptionSpec, ColumnStatistics, CatalogAttachResult, CatalogDescriptor, CatalogInfo, TableInfo, AttachOpaqueData, TransactionOpaqueData, SchemaInfo, VgiFunction, TableProcessParams, ArgumentSpec, ArgumentConstraints, RowTransformConfig, RowTransformProcessParams, TableInOutBindParams, } from "./index.core.js";
@@ -9016,6 +9016,7 @@ function createLandingRoutes(info) {
9016
9016
 
9017
9017
  // src/rpc-server.ts
9018
9018
  import {
9019
+ GrantKeys,
9019
9020
  IdentityImpl,
9020
9021
  VgiRpcServer
9021
9022
  } from "@query-farm/vgi-rpc";
@@ -9032,7 +9033,8 @@ function buildRpcServer(primary, hosting, options) {
9032
9033
  return new VgiRpcServer(primary, {
9033
9034
  serverId: options.serverId,
9034
9035
  protocols,
9035
- identity
9036
+ identity,
9037
+ grantKeys: null
9036
9038
  });
9037
9039
  }
9038
9040
  function validatedHostedProtocols(hosting, primary) {
@@ -9075,11 +9077,13 @@ function validatedHostedProtocols(hosting, primary) {
9075
9077
  }
9076
9078
  function buildIdentity(hosting, env) {
9077
9079
  const { resolveToken, mintGrant } = hosting;
9078
- if (!resolveToken && !mintGrant)
9080
+ const grantKeys = hosting.grantKeys === undefined ? GrantKeys.fromEnv(env ?? processEnv()) : hosting.grantKeys;
9081
+ if (!resolveToken && !mintGrant && !grantKeys)
9079
9082
  return;
9080
9083
  return new IdentityImpl({
9081
9084
  resolveToken,
9082
9085
  mintGrant,
9086
+ grantKeys: grantKeys ?? undefined,
9083
9087
  introspectPrincipals: resolveToken ? resolveIntrospectPrincipals(hosting.introspectPrincipals, env) : undefined,
9084
9088
  maxAuthAge: hosting.maxAuthAge
9085
9089
  });
@@ -9100,6 +9104,9 @@ function resolveIntrospectPrincipals(explicit, env) {
9100
9104
  }
9101
9105
  return principals;
9102
9106
  }
9107
+ function processEnv() {
9108
+ return globalThis.process?.env;
9109
+ }
9103
9110
 
9104
9111
  // src/http/fetch.ts
9105
9112
  var requestAuthStorage;
@@ -9167,6 +9174,7 @@ function createVgiFetch(opts) {
9167
9174
  // src/worker-cf-entry.ts
9168
9175
  import {
9169
9176
  AuthUnavailableError as AuthUnavailableError2,
9177
+ GrantKeys as GrantKeys3,
9170
9178
  GrantRefusedError as GrantRefusedError2,
9171
9179
  IdentityUnavailableError as IdentityUnavailableError2,
9172
9180
  StatusError as StatusError2
@@ -11566,6 +11574,7 @@ import { str, bytes, int as int3, int32 as int323, float, float32 as float323, b
11566
11574
  import { subprocessConnect, httpConnect, tcpConnect } from "@query-farm/vgi-rpc";
11567
11575
  import {
11568
11576
  AuthUnavailableError,
11577
+ GrantKeys as GrantKeys2,
11569
11578
  GrantRefusedError,
11570
11579
  IdentityUnavailableError,
11571
11580
  StatusError
@@ -11585,6 +11594,7 @@ export {
11585
11594
  EXCHANGE_STATE_SCHEMA,
11586
11595
  FunctionRegistry,
11587
11596
  FunctionType,
11597
+ GrantKeys3 as GrantKeys,
11588
11598
  GrantRefusedError2 as GrantRefusedError,
11589
11599
  IdentityUnavailableError2 as IdentityUnavailableError,
11590
11600
  IntervalUnit2 as IntervalUnit,
@@ -11691,4 +11701,4 @@ export {
11691
11701
  utf82 as utf8
11692
11702
  };
11693
11703
 
11694
- //# debugId=41BE8762862D859564756E2164756E21
11704
+ //# debugId=F200255967300B1B64756E2164756E21