@query-farm/vgi 0.48.2 → 0.48.4

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/README.md +27 -0
  2. package/dist/arrow/impl-arrowjs/iterate.d.ts +7 -3
  3. package/dist/arrow/impl-flechette/iterate.d.ts +2 -1
  4. package/dist/catalog/descriptors.d.ts +30 -0
  5. package/dist/catalog/interface.d.ts +28 -0
  6. package/dist/catalog/read-only.d.ts +16 -2
  7. package/dist/client-entry.js +9 -25
  8. package/dist/client-entry.js.map +4 -4
  9. package/dist/functions/aggregate.d.ts +2 -1
  10. package/dist/functions/copy-from.d.ts +2 -1
  11. package/dist/functions/copy-to.d.ts +2 -1
  12. package/dist/functions/scalar.d.ts +2 -1
  13. package/dist/functions/table-buffering.d.ts +2 -1
  14. package/dist/functions/table-in-out.d.ts +3 -2
  15. package/dist/functions/table.d.ts +2 -1
  16. package/dist/functions/types.d.ts +2 -1
  17. package/dist/index.core.d.ts +4 -1
  18. package/dist/index.js +360 -72
  19. package/dist/index.js.map +25 -23
  20. package/dist/metadata/types.d.ts +3 -1
  21. package/dist/protocol/handlers/catalog/shared.d.ts +8 -0
  22. package/dist/secrets/helpers.d.ts +31 -3
  23. package/dist/secrets/requirements.d.ts +38 -0
  24. package/dist/serve-entry.js +51 -33
  25. package/dist/serve-entry.js.map +9 -9
  26. package/dist/worker-cf-entry.d.ts +2 -2
  27. package/dist/worker-cf-entry.js +296 -50
  28. package/dist/worker-cf-entry.js.map +21 -18
  29. package/dist/write-results.d.ts +57 -0
  30. package/package.json +1 -1
  31. package/src/arrow/impl-arrowjs/iterate.ts +17 -40
  32. package/src/arrow/impl-flechette/iterate.ts +5 -24
  33. package/src/catalog/descriptors.ts +30 -0
  34. package/src/catalog/interface.ts +51 -0
  35. package/src/catalog/read-only.ts +129 -21
  36. package/src/functions/aggregate.ts +3 -2
  37. package/src/functions/copy-from.ts +3 -2
  38. package/src/functions/copy-to.ts +2 -1
  39. package/src/functions/scalar.ts +3 -2
  40. package/src/functions/table-buffering.ts +3 -2
  41. package/src/functions/table-in-out.ts +5 -4
  42. package/src/functions/table.ts +3 -2
  43. package/src/functions/types.ts +2 -1
  44. package/src/index.core.ts +33 -0
  45. package/src/metadata/resolve.ts +2 -1
  46. package/src/metadata/serialize.ts +25 -5
  47. package/src/metadata/types.ts +3 -1
  48. package/src/protocol/handlers/catalog/shared.ts +17 -0
  49. package/src/protocol/handlers/catalog/table.ts +37 -0
  50. package/src/protocol/handlers/function.ts +42 -14
  51. package/src/secrets/helpers.ts +96 -9
  52. package/src/secrets/requirements.ts +121 -0
  53. package/src/worker-cf-entry.ts +14 -0
  54. package/src/write-results.ts +174 -0
@@ -1,3 +1,4 @@
1
+ import { type RequiredSecret } from "../secrets/requirements.js";
1
2
  import { type VgiSchema, type VgiBatch, type VgiDataType } from "../arrow/index.js";
2
3
  import type { Arguments } from "../arguments/arguments.js";
3
4
  import { type ArgumentConstraints } from "../arguments/argument-spec.js";
@@ -106,7 +107,7 @@ export interface AggregateFunctionConfig<TArgs = Record<string, any>, TState = a
106
107
  * empty ResolvedSecrets. Mirrors vgi-python's `Secret()` annotation on an
107
108
  * aggregate `on_bind`.
108
109
  */
109
- requiredSecrets?: string[];
110
+ requiredSecrets?: RequiredSecret[];
110
111
  }
111
112
  type StateMap = Map<bigint, any>;
112
113
  interface ExecEntry {
@@ -1,3 +1,4 @@
1
+ import { type RequiredSecret } from "../secrets/requirements.js";
1
2
  import { type VgiSchema, type VgiDataType } from "../arrow/index.js";
2
3
  import type { OutputCollector } from "@query-farm/vgi-rpc";
3
4
  import type { BindRequest } from "../protocol/types.js";
@@ -54,7 +55,7 @@ export interface CopyFromFunctionConfig<TArgs = Record<string, unknown>> {
54
55
  tags?: Record<string, string>;
55
56
  examples?: FunctionExample[];
56
57
  requiredSettings?: string[];
57
- requiredSecrets?: string[];
58
+ requiredSecrets?: RequiredSecret[];
58
59
  /**
59
60
  * Optional secret-bind hook: forward CREATE SECRET credentials for
60
61
  * secret-backed cloud sources (S3/GCS/HTTP/…). Called during bind (only on the
@@ -1,3 +1,4 @@
1
+ import type { RequiredSecret } from "../secrets/requirements.js";
1
2
  import { type VgiBatch, type VgiDataType } from "../arrow/index.js";
2
3
  import type { BindRequest } from "../protocol/types.js";
3
4
  import type { FunctionExample } from "./types.js";
@@ -86,7 +87,7 @@ export interface CopyToFunctionConfig<TArgs = Record<string, unknown>> {
86
87
  tags?: Record<string, string>;
87
88
  examples?: FunctionExample[];
88
89
  requiredSettings?: string[];
89
- requiredSecrets?: string[];
90
+ requiredSecrets?: RequiredSecret[];
90
91
  /**
91
92
  * Optional secret-bind hook: forward CREATE SECRET credentials for
92
93
  * secret-backed cloud writes (S3/GCS/HTTP/…). Called during bind (only on the
@@ -1,3 +1,4 @@
1
+ import { type RequiredSecret } from "../secrets/requirements.js";
1
2
  import { type VgiSchema, type VgiBatch, type VgiDataType, type ValueFor, type Repr } from "../arrow/index.js";
2
3
  import type { AuthContext } from "@query-farm/vgi-rpc";
3
4
  import { FunctionStability, NullHandling, ArgumentMonotonicity } from "../types.js";
@@ -124,7 +125,7 @@ export interface ScalarFunctionConfig<P extends Record<string, VgiDataType> = Re
124
125
  parameterDefaultValues?: VgiBatch | null;
125
126
  maxWorkers?: number;
126
127
  requiredSettings?: string[];
127
- requiredSecrets?: string[];
128
+ requiredSecrets?: RequiredSecret[];
128
129
  /**
129
130
  * Result-cache opt-in: when set, this CacheControl's `vgi.cache.*` metadata
130
131
  * rides every output batch's custom metadata (per-batch — NOT the schema,
@@ -1,3 +1,4 @@
1
+ import { type RequiredSecret } from "../secrets/requirements.js";
1
2
  import { type VgiSchema, type VgiDataType, type VgiBatch } from "../arrow/index.js";
2
3
  import type { OutputCollector } from "@query-farm/vgi-rpc";
3
4
  import type { BindRequest, InitRequest, GlobalInitResponse } from "../protocol/types.js";
@@ -90,7 +91,7 @@ export interface TableBufferingConfig<TArgs = Record<string, any>, TState = any>
90
91
  tags?: Record<string, string> | undefined;
91
92
  maxWorkers?: number | undefined;
92
93
  requiredSettings?: string[] | undefined;
93
- requiredSecrets?: string[] | undefined;
94
+ requiredSecrets?: RequiredSecret[] | undefined;
94
95
  }
95
96
  /**
96
97
  * A table_buffering VgiFunction also carries its callback config so the
@@ -1,3 +1,4 @@
1
+ import { type RequiredSecret } from "../secrets/requirements.js";
1
2
  import { type VgiSchema, type VgiDataType, type VgiBatch } from "../arrow/index.js";
2
3
  import type { OutputCollector } from "@query-farm/vgi-rpc";
3
4
  import type { BindRequest, InitRequest, GlobalInitResponse } from "../protocol/types.js";
@@ -109,7 +110,7 @@ export interface TableInOutConfig<TArgs = Record<string, any>, TState = null> {
109
110
  tags?: Record<string, string>;
110
111
  maxWorkers?: number;
111
112
  requiredSettings?: string[];
112
- requiredSecrets?: string[];
113
+ requiredSecrets?: RequiredSecret[];
113
114
  }
114
115
  export declare function defineTableInOutFunction<TArgs = Record<string, any>, TState = null>(config: TableInOutConfig<TArgs, TState>): VgiFunction;
115
116
  export { PARENT_ROW_METADATA_KEY };
@@ -231,7 +232,7 @@ export interface RowTransformConfig<TArgs = Record<string, any>, TState = null>
231
232
  tags?: Record<string, string>;
232
233
  maxWorkers?: number;
233
234
  requiredSettings?: string[];
234
- requiredSecrets?: string[];
235
+ requiredSecrets?: RequiredSecret[];
235
236
  }
236
237
  /**
237
238
  * Define a blended ("UNNEST-style") table-in-out function: its positional args
@@ -1,3 +1,4 @@
1
+ import { type RequiredSecret } from "../secrets/requirements.js";
1
2
  import { type VgiSchema, type VgiBatch, type VgiDataType } from "../arrow/index.js";
2
3
  import type { OutputCollector } from "@query-farm/vgi-rpc";
3
4
  import type { PlanResult, TableFunctionPlanRequest } from "../protocol/serializers/splits.js";
@@ -179,7 +180,7 @@ export interface TableFunctionConfig<TArgs = Record<string, any>, TState = null>
179
180
  tags?: Record<string, string>;
180
181
  maxWorkers?: number;
181
182
  requiredSettings?: string[];
182
- requiredSecrets?: string[];
183
+ requiredSecrets?: RequiredSecret[];
183
184
  /** Row-order preservation behavior; flows to DuckDB's
184
185
  * TableFunction::order_preservation_type. */
185
186
  preservesOrder?: OrderPreservation;
@@ -1,3 +1,4 @@
1
+ import type { RequiredSecret } from "../secrets/requirements.js";
1
2
  import type { VgiSchema, VgiBatch } from "../arrow/index.js";
2
3
  import type { OutputCollector } from "@query-farm/vgi-rpc";
3
4
  import type { FunctionStability, NullHandling, ArgumentMonotonicity, OrderPreservation, OrderDependence, DistinctDependence, TableCardinality } from "../types.js";
@@ -71,7 +72,7 @@ export interface FunctionMeta {
71
72
  preservesOrder?: OrderPreservation | undefined;
72
73
  maxWorkers?: number | undefined;
73
74
  requiredSettings?: string[] | undefined;
74
- requiredSecrets?: string[] | undefined;
75
+ requiredSecrets?: RequiredSecret[] | undefined;
75
76
  orderDependent?: OrderDependence | undefined;
76
77
  distinctDependent?: DistinctDependence | undefined;
77
78
  /**
@@ -1,4 +1,6 @@
1
1
  export { CACHE_ETAG_KEY, CACHE_EXPIRES_KEY, CACHE_IF_MODIFIED_SINCE_KEY, CACHE_IF_NONE_MATCH_KEY, CACHE_LAST_MODIFIED_KEY, CACHE_NO_STORE_KEY, CACHE_NOT_MODIFIED_KEY, CACHE_PARTITION_SCOPE_KEY, CACHE_PER_VALUE_KEY, CACHE_REVALIDATABLE_KEY, CACHE_SCOPE_CATALOG, CACHE_SCOPE_KEY, CACHE_SCOPE_TRANSACTION, CACHE_STALE_IF_ERROR_KEY, CACHE_STALE_WHILE_REVALIDATE_KEY, CACHE_TTL_KEY, type CacheControl, cacheControlMetadata, type CacheScope, } from "./cache-control.js";
2
+ export { type WriteOperation, type WriteResultMode, type WriteOptions, WRITE_OPERATIONS, WRITE_RESULT_MODES, ROW_ID_METADATA_KEY, rowIdField, userColumns, validateWriteResultModes, supportsWriteResultMode, coerceWriteResultMode, writeResultSchema, writeCountBatch, writeRowsBatch, writeChangesBatch, writeResultBatch, writeOptions, } from "./write-results.js";
3
+ export type { ScanFunctionResultRecord } from "./catalog/interface.js";
2
4
  export { defineScalarFunction, type ScalarFunctionConfig, type ScalarBindParameters, type ScalarComputeInfo, type ScalarParameterDef } from "./functions/scalar.js";
3
5
  export { defineTableFunction, type TableFunctionConfig, type TableBindParams, type TableProcessParams } from "./functions/table.js";
4
6
  export { defineAggregate, GROUP_COLUMN_NAME, type AggregateFunctionConfig, type AggregateBindParams, type AggregateUpdateParams, type AggregateFinalizeParams, } from "./functions/aggregate.js";
@@ -36,7 +38,8 @@ export { ATTACH_TICKET_OPTION, ATTACH_TICKET_PREFIX, ATTACH_TICKETS_PROTOCOL_NAM
36
38
  export { type ColumnStatistics, serializeColumnStatistics } from "./util/statistics.js";
37
39
  export { toUint8Array } from "./util/bytes.js";
38
40
  export { iterRows, batchFromRows, batchFromColumns, emptyBatch, filterBatch, projectSchema, projectBatch, batchToScalarDict, batchToSecretDict, safeNumber, } from "./util/arrow/index.js";
39
- export { type SecretFields, type SecretsDict, secretType, secretsOfType, secretForScope, secretForScopeOfType, } from "./secrets/helpers.js";
41
+ export { type SecretFields, type SecretsDict, secretType, secretsOfType, secretOfType, requireSecretOfType, secretByName, secretForScope, secretForScopeOfType, } from "./secrets/helpers.js";
42
+ export { type RequiredSecret, type SecretRequirement, type SecretRequirementSpec, normalizeRequiredSecrets, } from "./secrets/requirements.js";
40
43
  export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./util/arrow/index.js";
41
44
  export { schema, field, nullType, int8, int16, int64, uint8, uint16, uint32, uint64, float16, float64, utf8, largeUtf8, binary, largeBinary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, codecFor, asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, readCanonicalValue, columnFromArray, decodeDictValue, backend, adoptArrowJsShape, } from "./arrow/index.js";
42
45
  export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, RichValue, RawValue, ValueFor, Repr, Codec, Branded, Date32, Date64Ms, Time32S, Time32Ms, Time64Us, Time64Ns, TimestampSeconds, TimestampMillis, TimestampMicros, TimestampNanos, DurationSeconds, DurationMillis, DurationMicros, DurationNanos, UnscaledDecimal, Int64Raw, Uint64Raw, } from "./arrow/index.js";