@query-farm/vgi 0.6.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 (206) hide show
  1. package/LICENSE +134 -0
  2. package/README.md +494 -0
  3. package/dist/__dbg.test-d.d.ts +1 -0
  4. package/dist/arguments/argument-spec.d.ts +51 -0
  5. package/dist/arguments/arguments.d.ts +13 -0
  6. package/dist/arrow/codec/branded.d.ts +83 -0
  7. package/dist/arrow/codec/registry.d.ts +29 -0
  8. package/dist/arrow/codec/repr.d.ts +23 -0
  9. package/dist/arrow/codec/type-descriptors.d.ts +109 -0
  10. package/dist/arrow/impl-arrowjs/build.d.ts +19 -0
  11. package/dist/arrow/impl-arrowjs/canonical.d.ts +15 -0
  12. package/dist/arrow/impl-arrowjs/empty.d.ts +7 -0
  13. package/dist/arrow/impl-arrowjs/filter.d.ts +11 -0
  14. package/dist/arrow/impl-arrowjs/index.d.ts +11 -0
  15. package/dist/arrow/impl-arrowjs/ipc.d.ts +24 -0
  16. package/dist/arrow/impl-arrowjs/iterate.d.ts +39 -0
  17. package/dist/arrow/impl-arrowjs/project.d.ts +10 -0
  18. package/dist/arrow/impl-arrowjs/schema.d.ts +62 -0
  19. package/dist/arrow/impl-arrowjs/statistics.d.ts +13 -0
  20. package/dist/arrow/impl-flechette/build.d.ts +14 -0
  21. package/dist/arrow/impl-flechette/canonical.d.ts +18 -0
  22. package/dist/arrow/impl-flechette/empty.d.ts +9 -0
  23. package/dist/arrow/impl-flechette/filter.d.ts +10 -0
  24. package/dist/arrow/impl-flechette/index.d.ts +11 -0
  25. package/dist/arrow/impl-flechette/ipc.d.ts +33 -0
  26. package/dist/arrow/impl-flechette/iterate.d.ts +29 -0
  27. package/dist/arrow/impl-flechette/message-meta.d.ts +10 -0
  28. package/dist/arrow/impl-flechette/normalize-type.d.ts +11 -0
  29. package/dist/arrow/impl-flechette/project.d.ts +3 -0
  30. package/dist/arrow/impl-flechette/schema.d.ts +47 -0
  31. package/dist/arrow/impl-flechette/statistics.d.ts +13 -0
  32. package/dist/arrow/index.d.ts +11 -0
  33. package/dist/arrow/predicates.d.ts +47 -0
  34. package/dist/arrow/repr.test-d.d.ts +52 -0
  35. package/dist/arrow/schema-types.d.ts +71 -0
  36. package/dist/arrow/types.d.ts +57 -0
  37. package/dist/catalog/attach-option.d.ts +33 -0
  38. package/dist/catalog/attach-options.d.ts +30 -0
  39. package/dist/catalog/composite.d.ts +33 -0
  40. package/dist/catalog/descriptors.d.ts +154 -0
  41. package/dist/catalog/interface.d.ts +239 -0
  42. package/dist/catalog/read-only.d.ts +33 -0
  43. package/dist/client/client.d.ts +189 -0
  44. package/dist/client/errors.d.ts +26 -0
  45. package/dist/client/helpers.d.ts +12 -0
  46. package/dist/client/protocol.d.ts +16 -0
  47. package/dist/client/types.d.ts +125 -0
  48. package/dist/client-entry.d.ts +11 -0
  49. package/dist/client-entry.js +48 -0
  50. package/dist/client-entry.js.map +9 -0
  51. package/dist/codec/asd.d.ts +25 -0
  52. package/dist/crypto.d.ts +36 -0
  53. package/dist/errors.d.ts +24 -0
  54. package/dist/filter-pushdown/collector.d.ts +32 -0
  55. package/dist/filter-pushdown/deserialize.d.ts +16 -0
  56. package/dist/filter-pushdown/evaluate.d.ts +51 -0
  57. package/dist/filter-pushdown/index.d.ts +4 -0
  58. package/dist/filter-pushdown/types.d.ts +84 -0
  59. package/dist/functions/aggregate.d.ts +129 -0
  60. package/dist/functions/copy-from.d.ts +81 -0
  61. package/dist/functions/copy-to.d.ts +121 -0
  62. package/dist/functions/registry.d.ts +16 -0
  63. package/dist/functions/scalar.d.ts +98 -0
  64. package/dist/functions/storage-cf-do.d.ts +47 -0
  65. package/dist/functions/storage.d.ts +86 -0
  66. package/dist/functions/table-buffering.d.ts +99 -0
  67. package/dist/functions/table-in-out.d.ts +64 -0
  68. package/dist/functions/table.d.ts +118 -0
  69. package/dist/functions/types.d.ts +157 -0
  70. package/dist/generated/vgi-client.d.ts +466 -0
  71. package/dist/generated/vgi-protocol-schemas.d.ts +115 -0
  72. package/dist/index.core.d.ts +42 -0
  73. package/dist/index.d.ts +2 -0
  74. package/dist/index.js +10888 -0
  75. package/dist/index.js.map +85 -0
  76. package/dist/metadata/resolve.d.ts +3 -0
  77. package/dist/metadata/serialize.d.ts +12 -0
  78. package/dist/metadata/types.d.ts +47 -0
  79. package/dist/protocol/dispatch.d.ts +23 -0
  80. package/dist/protocol/handlers/aggregate.d.ts +3 -0
  81. package/dist/protocol/handlers/catalog/admin.d.ts +3 -0
  82. package/dist/protocol/handlers/catalog/index.d.ts +3 -0
  83. package/dist/protocol/handlers/catalog/index_methods.d.ts +3 -0
  84. package/dist/protocol/handlers/catalog/macro.d.ts +3 -0
  85. package/dist/protocol/handlers/catalog/shared.d.ts +70 -0
  86. package/dist/protocol/handlers/catalog/table.d.ts +3 -0
  87. package/dist/protocol/handlers/catalog/view.d.ts +3 -0
  88. package/dist/protocol/handlers/function.d.ts +8 -0
  89. package/dist/protocol/handlers/shared.d.ts +31 -0
  90. package/dist/protocol/handlers/table-buffering.d.ts +3 -0
  91. package/dist/protocol/serialize.d.ts +4 -0
  92. package/dist/protocol/serializers/arguments.d.ts +3 -0
  93. package/dist/protocol/serializers/bind.d.ts +9 -0
  94. package/dist/protocol/serializers/cardinality.d.ts +7 -0
  95. package/dist/protocol/serializers/init.d.ts +9 -0
  96. package/dist/protocol/serializers/shared.d.ts +12 -0
  97. package/dist/protocol/state-serializer.d.ts +23 -0
  98. package/dist/protocol/types.d.ts +129 -0
  99. package/dist/secrets/helpers.d.ts +15 -0
  100. package/dist/types.d.ts +52 -0
  101. package/dist/util/arrow/index.d.ts +1 -0
  102. package/dist/util/bytes.d.ts +2 -0
  103. package/dist/util/statistics.d.ts +7 -0
  104. package/dist/worker-cf-entry.d.ts +30 -0
  105. package/dist/worker-cf-entry.js +8767 -0
  106. package/dist/worker-cf-entry.js.map +74 -0
  107. package/dist/worker.d.ts +36 -0
  108. package/package.json +96 -0
  109. package/src/arguments/argument-spec.ts +200 -0
  110. package/src/arguments/arguments.ts +81 -0
  111. package/src/arrow/codec/branded.ts +206 -0
  112. package/src/arrow/codec/registry.ts +674 -0
  113. package/src/arrow/codec/repr.ts +181 -0
  114. package/src/arrow/codec/type-descriptors.ts +137 -0
  115. package/src/arrow/impl-arrowjs/build.ts +88 -0
  116. package/src/arrow/impl-arrowjs/canonical.ts +509 -0
  117. package/src/arrow/impl-arrowjs/empty.ts +72 -0
  118. package/src/arrow/impl-arrowjs/filter.ts +53 -0
  119. package/src/arrow/impl-arrowjs/index.ts +54 -0
  120. package/src/arrow/impl-arrowjs/ipc.ts +67 -0
  121. package/src/arrow/impl-arrowjs/iterate.ts +159 -0
  122. package/src/arrow/impl-arrowjs/project.ts +73 -0
  123. package/src/arrow/impl-arrowjs/schema.ts +256 -0
  124. package/src/arrow/impl-arrowjs/statistics.ts +185 -0
  125. package/src/arrow/impl-flechette/build.ts +65 -0
  126. package/src/arrow/impl-flechette/canonical.ts +289 -0
  127. package/src/arrow/impl-flechette/empty.ts +20 -0
  128. package/src/arrow/impl-flechette/filter.ts +42 -0
  129. package/src/arrow/impl-flechette/index.ts +54 -0
  130. package/src/arrow/impl-flechette/ipc.ts +110 -0
  131. package/src/arrow/impl-flechette/iterate.ts +121 -0
  132. package/src/arrow/impl-flechette/message-meta.ts +175 -0
  133. package/src/arrow/impl-flechette/normalize-type.ts +99 -0
  134. package/src/arrow/impl-flechette/project.ts +64 -0
  135. package/src/arrow/impl-flechette/schema.ts +202 -0
  136. package/src/arrow/impl-flechette/statistics.ts +198 -0
  137. package/src/arrow/index.ts +129 -0
  138. package/src/arrow/predicates.ts +66 -0
  139. package/src/arrow/repr.test-d.ts +189 -0
  140. package/src/arrow/schema-types.ts +213 -0
  141. package/src/arrow/types.ts +74 -0
  142. package/src/catalog/attach-option.ts +107 -0
  143. package/src/catalog/attach-options.ts +79 -0
  144. package/src/catalog/composite.ts +180 -0
  145. package/src/catalog/descriptors.ts +164 -0
  146. package/src/catalog/interface.ts +721 -0
  147. package/src/catalog/read-only.ts +909 -0
  148. package/src/client/client.ts +1348 -0
  149. package/src/client/errors.ts +69 -0
  150. package/src/client/helpers.ts +56 -0
  151. package/src/client/protocol.ts +33 -0
  152. package/src/client/types.ts +140 -0
  153. package/src/client-entry.ts +112 -0
  154. package/src/codec/asd.ts +147 -0
  155. package/src/crypto.ts +143 -0
  156. package/src/errors.ts +61 -0
  157. package/src/filter-pushdown/collector.ts +147 -0
  158. package/src/filter-pushdown/deserialize.ts +253 -0
  159. package/src/filter-pushdown/evaluate.ts +591 -0
  160. package/src/filter-pushdown/index.ts +28 -0
  161. package/src/filter-pushdown/types.ts +91 -0
  162. package/src/functions/aggregate.ts +384 -0
  163. package/src/functions/copy-from.ts +282 -0
  164. package/src/functions/copy-to.ts +319 -0
  165. package/src/functions/registry.ts +258 -0
  166. package/src/functions/scalar.ts +356 -0
  167. package/src/functions/storage-cf-do.ts +303 -0
  168. package/src/functions/storage.ts +521 -0
  169. package/src/functions/table-buffering.ts +562 -0
  170. package/src/functions/table-in-out.ts +373 -0
  171. package/src/functions/table.ts +521 -0
  172. package/src/functions/types.ts +192 -0
  173. package/src/generated/vgi-client.ts +560 -0
  174. package/src/generated/vgi-protocol-schemas.ts +864 -0
  175. package/src/index.core.ts +267 -0
  176. package/src/index.ts +11 -0
  177. package/src/metadata/resolve.ts +109 -0
  178. package/src/metadata/serialize.ts +242 -0
  179. package/src/metadata/types.ts +60 -0
  180. package/src/protocol/dispatch.ts +52 -0
  181. package/src/protocol/handlers/aggregate.ts +355 -0
  182. package/src/protocol/handlers/catalog/admin.ts +368 -0
  183. package/src/protocol/handlers/catalog/index.ts +25 -0
  184. package/src/protocol/handlers/catalog/index_methods.ts +65 -0
  185. package/src/protocol/handlers/catalog/macro.ts +114 -0
  186. package/src/protocol/handlers/catalog/shared.ts +291 -0
  187. package/src/protocol/handlers/catalog/table.ts +401 -0
  188. package/src/protocol/handlers/catalog/view.ts +119 -0
  189. package/src/protocol/handlers/function.ts +302 -0
  190. package/src/protocol/handlers/shared.ts +80 -0
  191. package/src/protocol/handlers/table-buffering.ts +207 -0
  192. package/src/protocol/serialize.ts +23 -0
  193. package/src/protocol/serializers/arguments.ts +160 -0
  194. package/src/protocol/serializers/bind.ts +212 -0
  195. package/src/protocol/serializers/cardinality.ts +45 -0
  196. package/src/protocol/serializers/init.ts +247 -0
  197. package/src/protocol/serializers/shared.ts +46 -0
  198. package/src/protocol/state-serializer.ts +181 -0
  199. package/src/protocol/types.ts +153 -0
  200. package/src/secrets/helpers.ts +70 -0
  201. package/src/types.ts +71 -0
  202. package/src/util/arrow/index.ts +23 -0
  203. package/src/util/bytes.ts +14 -0
  204. package/src/util/statistics.ts +40 -0
  205. package/src/worker-cf-entry.ts +172 -0
  206. package/src/worker.ts +212 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Rebuild `type` as a flechette-native DataType. Idempotent for types that are
3
+ * already native (reconstructed from the same structural props). Unknown
4
+ * typeIds pass through unchanged as a safety net.
5
+ */
6
+ export declare function toFlechetteType(type: any): any;
7
+ /**
8
+ * Normalize every field's type in a schema-like object to flechette-native,
9
+ * preserving field name / nullable / metadata.
10
+ */
11
+ export declare function normalizeSchemaFields(fields: readonly any[]): any[];
@@ -0,0 +1,3 @@
1
+ import type { VgiSchema, VgiBatch } from "../types.js";
2
+ export declare function projectSchema(projectionIds: number[] | null, schema: VgiSchema): VgiSchema;
3
+ export declare function projectBatch(projectionIds: number[] | null, batch: VgiBatch): VgiBatch;
@@ -0,0 +1,47 @@
1
+ import { TimeUnit as F_TimeUnit, DateUnit as F_DateUnit, IntervalUnit as F_IntervalUnit, UnionMode as F_UnionMode } from "@query-farm/flechette";
2
+ import type { VgiField, VgiSchema, VgiDataType } from "../types.js";
3
+ export declare const TimeUnit: typeof F_TimeUnit;
4
+ export declare const DateUnit: typeof F_DateUnit;
5
+ export declare const IntervalUnit: typeof F_IntervalUnit;
6
+ export declare const UnionMode: typeof F_UnionMode;
7
+ export declare function schema(fields: readonly VgiField[], metadata?: Map<string, string>): VgiSchema;
8
+ export declare function field(name: string, type: VgiDataType, nullable?: boolean, metadata?: Map<string, string>): VgiField;
9
+ export declare const nullType: () => VgiDataType;
10
+ export declare const bool: () => VgiDataType;
11
+ export declare const int8: () => VgiDataType;
12
+ export declare const int16: () => VgiDataType;
13
+ export declare const int32: () => VgiDataType;
14
+ export declare const int64: () => VgiDataType;
15
+ export declare const uint8: () => VgiDataType;
16
+ export declare const uint16: () => VgiDataType;
17
+ export declare const uint32: () => VgiDataType;
18
+ export declare const uint64: () => VgiDataType;
19
+ export declare const int: (bitWidth?: 8 | 16 | 32 | 64, signed?: boolean) => VgiDataType;
20
+ export declare const float16: () => VgiDataType;
21
+ export declare const float32: () => VgiDataType;
22
+ export declare const float64: () => VgiDataType;
23
+ export declare const utf8: () => VgiDataType;
24
+ export declare const binary: () => VgiDataType;
25
+ export declare const fixedSizeBinary: (stride: number) => VgiDataType;
26
+ export declare function decimal(precision: number, scale: number, bitWidth?: 32 | 64 | 128 | 256): VgiDataType;
27
+ export declare const decimal128: (precision: number, scale: number) => VgiDataType;
28
+ export declare const decimal256: (precision: number, scale: number) => VgiDataType;
29
+ export declare const date: (unit?: number) => VgiDataType;
30
+ export declare const dateDay: () => VgiDataType;
31
+ export declare const dateMillisecond: () => VgiDataType;
32
+ export declare function time(unit?: number, _bitWidth?: 32 | 64): VgiDataType;
33
+ export declare const timeSecond: () => VgiDataType;
34
+ export declare const timeMillisecond: () => VgiDataType;
35
+ export declare const timeMicrosecond: () => VgiDataType;
36
+ export declare const timeNanosecond: () => VgiDataType;
37
+ export declare const timestamp: (unit?: number, timezone?: string | null) => VgiDataType;
38
+ export declare const duration: (unit?: number) => VgiDataType;
39
+ export declare const interval: (unit?: number) => VgiDataType;
40
+ export declare function list(child: VgiField | VgiDataType): VgiDataType;
41
+ export declare function fixedSizeList(child: VgiField | VgiDataType, listSize: number): VgiDataType;
42
+ export declare function struct(children: readonly VgiField[]): VgiDataType;
43
+ export declare function map(keyField: VgiField | VgiDataType, valueField: VgiField | VgiDataType, keysSorted?: boolean): VgiDataType;
44
+ export declare function dictionary(valueType: VgiDataType, indexType?: VgiDataType, ordered?: boolean, id?: number): VgiDataType;
45
+ export declare function union(mode: number, children: readonly (VgiField | VgiDataType)[], typeIds?: number[]): VgiDataType;
46
+ export declare const sparseUnion: (children: readonly (VgiField | VgiDataType)[], typeIds?: number[]) => VgiDataType;
47
+ export declare const denseUnion: (children: readonly (VgiField | VgiDataType)[], typeIds?: number[]) => VgiDataType;
@@ -0,0 +1,13 @@
1
+ import type { VgiBatch, VgiDataType } from "../types.js";
2
+ export interface ColumnStatistics {
3
+ columnName: string;
4
+ arrowType: VgiDataType;
5
+ min: any;
6
+ max: any;
7
+ hasNull: boolean;
8
+ hasNotNull: boolean;
9
+ distinctCount: bigint | number | null;
10
+ containsUnicode: boolean | null;
11
+ maxStringLength: bigint | number | null;
12
+ }
13
+ export declare function buildStatisticsBatch(stats: ColumnStatistics[]): VgiBatch;
@@ -0,0 +1,11 @@
1
+ export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, } from "./types.js";
2
+ export { TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, } from "./predicates.js";
3
+ export { backend, emptyBatch, batchFromRows, batchFromColumns, columnFromArray, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, readCanonicalValue, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, buildStatisticsBatch, } from "#arrow-impl";
4
+ export type { ColumnStatistics } from "#arrow-impl";
5
+ export { schema, field, nullType, bool, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, utf8, binary, 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, } from "./schema-types.js";
6
+ export type { 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, } from "./codec/type-descriptors.js";
7
+ export type { RichValue, RawValue, ValueFor, Repr } from "./codec/repr.js";
8
+ export { codecFor } from "./codec/registry.js";
9
+ export type { Codec } from "./codec/registry.js";
10
+ export type { Branded, Date32, Date64Ms, Time32S, Time32Ms, Time64Us, Time64Ns, TimestampSeconds, TimestampMillis, TimestampMicros, TimestampNanos, DurationSeconds, DurationMillis, DurationMicros, DurationNanos, UnscaledDecimal, Int64 as Int64Raw, Uint64 as Uint64Raw, } from "./codec/branded.js";
11
+ export { asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, } from "./codec/branded.js";
@@ -0,0 +1,47 @@
1
+ import type { VgiDataType } from "./types.js";
2
+ export declare const TypeId: {
3
+ readonly Null: 1;
4
+ readonly Int: 2;
5
+ readonly Float: 3;
6
+ readonly Binary: 4;
7
+ readonly Utf8: 5;
8
+ readonly Bool: 6;
9
+ readonly Decimal: 7;
10
+ readonly Date: 8;
11
+ readonly Time: 9;
12
+ readonly Timestamp: 10;
13
+ readonly Interval: 11;
14
+ readonly List: 12;
15
+ readonly Struct: 13;
16
+ readonly Union: 14;
17
+ readonly FixedSizeBinary: 15;
18
+ readonly FixedSizeList: 16;
19
+ readonly Map: 17;
20
+ readonly Duration: 18;
21
+ readonly LargeBinary: 19;
22
+ readonly LargeUtf8: 20;
23
+ readonly Dictionary: -1;
24
+ };
25
+ export declare function isNull(t: VgiDataType): boolean;
26
+ export declare function isInt(t: VgiDataType): boolean;
27
+ export declare function isFloat(t: VgiDataType): boolean;
28
+ export declare function isBinary(t: VgiDataType): boolean;
29
+ export declare function isUtf8(t: VgiDataType): boolean;
30
+ export declare function isBool(t: VgiDataType): boolean;
31
+ export declare function isDecimal(t: VgiDataType): boolean;
32
+ export declare function isDate(t: VgiDataType): boolean;
33
+ export declare function isTime(t: VgiDataType): boolean;
34
+ export declare function isTimestamp(t: VgiDataType): boolean;
35
+ export declare function isInterval(t: VgiDataType): boolean;
36
+ export declare function isList(t: VgiDataType): boolean;
37
+ export declare function isStruct(t: VgiDataType): boolean;
38
+ export declare function isUnion(t: VgiDataType): boolean;
39
+ export declare function isFixedSizeBinary(t: VgiDataType): boolean;
40
+ export declare function isFixedSizeList(t: VgiDataType): boolean;
41
+ export declare function isMap(t: VgiDataType): boolean;
42
+ export declare function isDuration(t: VgiDataType): boolean;
43
+ export declare function isDictionary(t: VgiDataType): boolean;
44
+ /** Runtime check: does `x` quack like a VgiBatch? Used at API boundaries
45
+ * where callers may pass either a batch or a plain column dict. Duck-typed
46
+ * because arrow-js and flechette use unrelated classes. */
47
+ export declare function isBatch(x: unknown): x is import("./types.js").VgiBatch;
@@ -0,0 +1,52 @@
1
+ import { list, asDate64Ms } from "./index.js";
2
+ import type { RichValue, RawValue, ValueFor, Date32Type, Date64Type, Int64Type, Int32Type, Utf8Type, BoolType, TimestampType, DecimalType, FloatType, StructType, ListType, TypedField, Date32, TimestampMicros, UnscaledDecimal } from "./index.js";
3
+ type Expect<T extends true> = T;
4
+ type Equal<A, B> = (<G>() => G extends A ? 1 : 2) extends (<G>() => G extends B ? 1 : 2) ? true : false;
5
+ type _r1 = Expect<Equal<RichValue<Date32Type>, Date>>;
6
+ type _r2 = Expect<Equal<RawValue<Date32Type>, Date32>>;
7
+ type _r3 = Expect<Equal<RichValue<Date64Type>, Date>>;
8
+ type _r4 = Expect<Equal<RichValue<Int64Type>, bigint>>;
9
+ type _r5 = Expect<Equal<RichValue<Int32Type>, number>>;
10
+ type _r6 = Expect<Equal<RichValue<Utf8Type>, string>>;
11
+ type _r7 = Expect<Equal<RichValue<BoolType>, boolean>>;
12
+ type _r8 = Expect<Equal<ValueFor<TimestampType<"us">, "rich">, bigint>>;
13
+ type _r9 = Expect<Equal<ValueFor<TimestampType<"us">, "raw">, TimestampMicros>>;
14
+ type _r10 = Expect<Equal<RawValue<DecimalType>, UnscaledDecimal>>;
15
+ type _r11 = Expect<Equal<RichValue<DecimalType>, bigint>>;
16
+ type _r12 = Expect<Equal<RichValue<FloatType>, number>>;
17
+ type _StructT = StructType<[TypedField<"a", Int32Type>, TypedField<"d", Date32Type>]>;
18
+ type _r13 = Expect<Equal<RichValue<_StructT>, {
19
+ a: number | null;
20
+ d: Date | null;
21
+ }>>;
22
+ type _r14 = Expect<Equal<RawValue<_StructT>, {
23
+ a: number | null;
24
+ d: Date32 | null;
25
+ }>>;
26
+ type _ListT = ListType<Int64Type>;
27
+ type _r15 = Expect<Equal<RichValue<_ListT>, Array<bigint | null>>>;
28
+ export type _AllChecks = [
29
+ _r1,
30
+ _r2,
31
+ _r3,
32
+ _r4,
33
+ _r5,
34
+ _r6,
35
+ _r7,
36
+ _r8,
37
+ _r9,
38
+ _r10,
39
+ _r11,
40
+ _r12,
41
+ _r13,
42
+ _r14,
43
+ _r15
44
+ ];
45
+ export declare const _unusedFactories: {
46
+ dateMillisecond: () => Date64Type;
47
+ bool: () => BoolType;
48
+ float64: () => FloatType;
49
+ list: typeof list;
50
+ asDate64Ms: typeof asDate64Ms;
51
+ };
52
+ export {};
@@ -0,0 +1,71 @@
1
+ import * as impl from "#arrow-impl";
2
+ import type { VgiField, VgiDataType } from "./types.js";
3
+ import type { NullDescriptor, BoolType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, IntType, FloatType, Utf8Type, BinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit } from "./codec/type-descriptors.js";
4
+ export declare const TimeUnit: {
5
+ readonly SECOND: import("@query-farm/apache-arrow").TimeUnit.SECOND;
6
+ readonly MILLISECOND: import("@query-farm/apache-arrow").TimeUnit.MILLISECOND;
7
+ readonly MICROSECOND: import("@query-farm/apache-arrow").TimeUnit.MICROSECOND;
8
+ readonly NANOSECOND: import("@query-farm/apache-arrow").TimeUnit.NANOSECOND;
9
+ }, DateUnit: {
10
+ readonly DAY: import("@query-farm/apache-arrow").DateUnit.DAY;
11
+ readonly MILLISECOND: import("@query-farm/apache-arrow").DateUnit.MILLISECOND;
12
+ }, IntervalUnit: {
13
+ readonly YEAR_MONTH: import("@query-farm/apache-arrow").IntervalUnit.YEAR_MONTH;
14
+ readonly DAY_TIME: import("@query-farm/apache-arrow").IntervalUnit.DAY_TIME;
15
+ readonly MONTH_DAY_NANO: import("@query-farm/apache-arrow").IntervalUnit.MONTH_DAY_NANO;
16
+ }, UnionMode: {
17
+ readonly Sparse: import("@query-farm/apache-arrow").UnionMode.Sparse;
18
+ readonly Dense: import("@query-farm/apache-arrow").UnionMode.Dense;
19
+ }, schema: typeof impl.schema;
20
+ /** field(): preserve the precise name + type so struct() can carry a typed
21
+ * child tuple. Runtime is the backend `field`. */
22
+ export declare function field<Name extends string, T extends VgiDataType>(name: Name, type: T, nullable?: boolean, metadata?: Map<string, string>): TypedField<Name, T>;
23
+ export declare const nullType: () => NullDescriptor;
24
+ export declare const bool: () => BoolType;
25
+ export declare const int8: () => Int8Type;
26
+ export declare const int16: () => Int16Type;
27
+ export declare const int32: () => Int32Type;
28
+ export declare const int64: () => Int64Type;
29
+ export declare const uint8: () => Uint8Type;
30
+ export declare const uint16: () => Uint16Type;
31
+ export declare const uint32: () => Uint32Type;
32
+ export declare const uint64: () => Uint64Type;
33
+ export declare function int(bitWidth?: 8 | 16 | 32 | 64, signed?: boolean): IntType<8 | 16 | 32 | 64, boolean>;
34
+ export declare const float16: () => FloatType;
35
+ export declare const float32: () => FloatType;
36
+ export declare const float64: () => FloatType;
37
+ export declare const utf8: () => Utf8Type;
38
+ export declare const binary: () => BinaryType;
39
+ export declare const fixedSizeBinary: (byteWidth: number) => FixedSizeBinaryType;
40
+ export declare const decimal: (precision: number, scale: number, bitWidth?: 32 | 64 | 128 | 256) => DecimalType;
41
+ export declare const decimal128: (precision: number, scale: number) => DecimalType;
42
+ export declare const decimal256: (precision: number, scale: number) => DecimalType;
43
+ export declare const date: (unit?: number) => Date64Type;
44
+ export declare const dateDay: () => Date32Type;
45
+ export declare const dateMillisecond: () => Date64Type;
46
+ export declare const timeSecond: () => Time32Type<"s">;
47
+ export declare const timeMillisecond: () => Time32Type<"ms">;
48
+ export declare const timeMicrosecond: () => Time64Type<"us">;
49
+ export declare const timeNanosecond: () => Time64Type<"ns">;
50
+ export declare function time(unit?: number, bitWidth?: 32 | 64): Time32Type<"s" | "ms"> | Time64Type<"us" | "ns">;
51
+ /** timestamp(unit): when called with a literal unit constant the result type
52
+ * carries that unit; with a runtime number it widens to TimestampType<TUnit>. */
53
+ export declare function timestamp<U extends TUnit = TUnit>(unit?: number, timezone?: string | null): TimestampType<U>;
54
+ export declare function duration<U extends TUnit = TUnit>(unit?: number): DurationType<U>;
55
+ export declare const timestampSeconds: (timezone?: string | null) => TimestampType<"s">;
56
+ export declare const timestampMillis: (timezone?: string | null) => TimestampType<"ms">;
57
+ export declare const timestampMicros: (timezone?: string | null) => TimestampType<"us">;
58
+ export declare const timestampNanos: (timezone?: string | null) => TimestampType<"ns">;
59
+ export declare const durationSeconds: () => DurationType<"s">;
60
+ export declare const durationMillis: () => DurationType<"ms">;
61
+ export declare const durationMicros: () => DurationType<"us">;
62
+ export declare const durationNanos: () => DurationType<"ns">;
63
+ export declare const interval: (unit?: number) => IntervalType;
64
+ export declare function list<T extends VgiDataType>(child: TypedField<string, T> | T): ListType<T>;
65
+ export declare function fixedSizeList<T extends VgiDataType>(child: TypedField<string, T> | T, listSize: number): FixedSizeListType<T>;
66
+ export declare function struct<const C extends readonly TypedField<string, VgiDataType>[]>(children: C): StructType<C>;
67
+ export declare function map<K extends VgiDataType, V extends VgiDataType>(keyField: TypedField<string, K> | K, valueField: TypedField<string, V> | V, keysSorted?: boolean): MapType<K, V>;
68
+ export declare function dictionary<V extends VgiDataType>(valueType: V, indexType?: VgiDataType, ordered?: boolean, id?: number): DictionaryType<V>;
69
+ export declare function union(mode: number, children: readonly (VgiField | VgiDataType)[], typeIds?: number[]): UnionType;
70
+ export declare const sparseUnion: (children: readonly (VgiField | VgiDataType)[], typeIds?: number[]) => UnionType;
71
+ export declare const denseUnion: (children: readonly (VgiField | VgiDataType)[], typeIds?: number[]) => UnionType;
@@ -0,0 +1,57 @@
1
+ /** Numeric Arrow type discriminator. Values match the Arrow Type enum
2
+ * (Null=1, Int=2, Float=3, Binary=4, Utf8=5, Bool=6, Decimal=7,
3
+ * Date=8, Time=9, Timestamp=10, Interval=11, List=12, Struct=13,
4
+ * Union=14, FixedSizeBinary=15, FixedSizeList=16, Map=17, Duration=18,
5
+ * LargeBinary=19, LargeUtf8=20, Dictionary=-1). Both backends agree. */
6
+ export type VgiTypeId = number;
7
+ export interface VgiDataType {
8
+ readonly typeId: VgiTypeId;
9
+ }
10
+ export interface VgiField {
11
+ readonly name: string;
12
+ readonly type: VgiDataType;
13
+ readonly nullable: boolean;
14
+ /** Always defined (possibly empty) so callers don't need null-checks.
15
+ * Both arrow-js Field.metadata and flechette's field.metadata are a
16
+ * Map; the field-factory in each backend ensures presence. */
17
+ readonly metadata: Map<string, string>;
18
+ }
19
+ export interface VgiSchema {
20
+ readonly fields: readonly VgiField[];
21
+ readonly metadata: Map<string, string>;
22
+ }
23
+ /** Column view. Generic dropped: arrow-js parameterizes on DataType, flechette
24
+ * on value type, so the facade exposes an erased shape. Callers cast at the
25
+ * use site (the column's static schema makes the value type known there). */
26
+ export interface VgiColumn {
27
+ readonly type: VgiDataType;
28
+ readonly length: number;
29
+ get(index: number): unknown;
30
+ [Symbol.iterator](): Iterator<unknown>;
31
+ }
32
+ export interface VgiBatch {
33
+ readonly schema: VgiSchema;
34
+ readonly numRows: number;
35
+ getChild(name: string): VgiColumn | null;
36
+ getChildAt(index: number): VgiColumn | null;
37
+ }
38
+ export interface VgiBackendInfo {
39
+ readonly name: "arrow-js" | "flechette";
40
+ }
41
+ /** Low-level handle for a single column's underlying Arrow Data. The shape
42
+ * differs per backend (arrow-js: a `Data` instance; flechette: the inner
43
+ * `Column.data[0]`-style object), so this is treated opaquely; it's only
44
+ * meant to be passed back into facade builders that know how to consume it. */
45
+ export type VgiColumnData = unknown;
46
+ /** A decoded union-typed value: which member is active (`tag`) and its `value`.
47
+ *
48
+ * DuckDB `UNION` / Arrow union values are *tagged* — the discriminator (which
49
+ * member is present) lives in the union's per-row type code, not in the member
50
+ * value. A plain scalar read returns only the member value and drops that tag,
51
+ * so union values are decoded into this wrapper instead: `tag` is the active
52
+ * member's field name (or `null` for a null union) and `value` is its decoded
53
+ * canonical value. Mirrors vgi-python's `vgi.arguments.TaggedUnion`. */
54
+ export interface TaggedUnion {
55
+ readonly tag: string | null;
56
+ readonly value: unknown;
57
+ }
@@ -0,0 +1,33 @@
1
+ import { type VgiDataType } from "../arrow/index.js";
2
+ /**
3
+ * Declarative spec for a single attach-time option.
4
+ *
5
+ * The catalog's `catalogsInfo()` emits these (serialized) in
6
+ * `CatalogInfo.attach_option_specs` so the DuckDB extension can validate
7
+ * user-supplied ATTACH options and cast them to the declared type before
8
+ * forwarding to the worker's `catalog_attach` handler.
9
+ */
10
+ export interface AttachOptionSpec {
11
+ /** Option name — matches the key users pass in the ATTACH statement. */
12
+ name: string;
13
+ /** Human-readable description (shown in discovery UIs). */
14
+ description: string;
15
+ /** Arrow data type the extension should cast user input to. */
16
+ type: VgiDataType;
17
+ /**
18
+ * Default value used when the user omits this option. Passed through to
19
+ * the worker's catalog_attach handler as-is if no override is given.
20
+ * Use `null` for "no default" (an unset option will then be absent from
21
+ * the options dict delivered to attach()).
22
+ */
23
+ default?: unknown;
24
+ }
25
+ /**
26
+ * Serialize an AttachOptionSpec to the wire format the extension expects
27
+ * (one IPC-serialized RecordBatch with a single row).
28
+ */
29
+ export declare function serializeAttachOptionSpec(spec: AttachOptionSpec): Uint8Array;
30
+ /**
31
+ * Convenience: serialize many specs at once for CatalogInfo.attach_option_specs.
32
+ */
33
+ export declare function serializeAttachOptionSpecs(specs: Iterable<AttachOptionSpec>): Uint8Array[];
@@ -0,0 +1,30 @@
1
+ import { type VgiDataType } from "../arrow/index.js";
2
+ /**
3
+ * Values supported in a CatalogAttach options map. The client infers an
4
+ * Arrow type per value:
5
+ *
6
+ * string → Utf8
7
+ * bigint → Int64
8
+ * number → Float64 (JS numbers are doubles — safe for small ints too)
9
+ * boolean → Bool
10
+ * Uint8Array → Binary
11
+ * null → Null (column with no concrete type; value is null)
12
+ *
13
+ * If you need types this can't express (Decimal, Timestamp, Int32 vs Int64,
14
+ * nested structs), drop down to `optionsBytes` on CatalogAttachOptions and
15
+ * build the RecordBatch yourself.
16
+ */
17
+ export type AttachOptionValue = string | number | bigint | boolean | null | Uint8Array;
18
+ /**
19
+ * Infer an Arrow DataType for a single JS value. Exported for tests; not
20
+ * part of the stable public API.
21
+ */
22
+ export declare function inferAttachOptionArrowType(value: AttachOptionValue): VgiDataType;
23
+ /**
24
+ * Serialize a plain key→value options map to an Arrow IPC RecordBatch.
25
+ *
26
+ * Returns `null` when the map is empty or has no entries — the wire layer
27
+ * then sends a null options field rather than a zero-column batch (which
28
+ * pyarrow's IPC reader rejects).
29
+ */
30
+ export declare function serializeAttachOptions(options: Record<string, AttachOptionValue> | undefined | null): Uint8Array | null;
@@ -0,0 +1,33 @@
1
+ import type { AttachOpaqueData, CatalogAttachResult, CatalogInfo, CopyFromFormatInfo, FunctionInfo, IndexInfo, MacroInfo, SchemaInfo, TableInfo, TransactionOpaqueData, ViewInfo } from "./interface.js";
2
+ import { CatalogInterface } from "./interface.js";
3
+ export declare class CompositeCatalogInterface extends CatalogInterface {
4
+ private readonly _backends;
5
+ constructor(_backends: CatalogInterface[]);
6
+ private _route;
7
+ catalogs(): string[];
8
+ catalogsInfo(): Promise<CatalogInfo[]>;
9
+ attach(name: string, options?: Record<string, unknown>, dataVersionSpec?: string | null, implementationVersion?: string | null): Promise<CatalogAttachResult>;
10
+ detach(attachOpaqueData: AttachOpaqueData): Promise<void>;
11
+ version(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): Promise<number>;
12
+ schemas(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): Promise<SchemaInfo[]>;
13
+ schemaGet(attachOpaqueData: AttachOpaqueData, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<SchemaInfo | null>;
14
+ schemaContentsTables(attachOpaqueData: AttachOpaqueData, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<TableInfo[]>;
15
+ schemaContentsViews(attachOpaqueData: AttachOpaqueData, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<ViewInfo[]>;
16
+ schemaContentsFunctions(attachOpaqueData: AttachOpaqueData, name: string, type: string, transactionOpaqueData?: TransactionOpaqueData): Promise<FunctionInfo[]>;
17
+ schemaContentsMacros(attachOpaqueData: AttachOpaqueData, name: string, type: string, transactionOpaqueData?: TransactionOpaqueData): Promise<MacroInfo[]>;
18
+ schemaContentsIndexes(attachOpaqueData: AttachOpaqueData, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<IndexInfo[]>;
19
+ indexGet(attachOpaqueData: AttachOpaqueData, schemaName: string, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<IndexInfo | null>;
20
+ tableGet(attachOpaqueData: AttachOpaqueData, schemaName: string, name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): Promise<TableInfo | null>;
21
+ tableScanFunctionGet(attachOpaqueData: AttachOpaqueData, schemaName: string, name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): Promise<any>;
22
+ tableScanBranchesGet(attachOpaqueData: AttachOpaqueData, schemaName: string, name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): Promise<any>;
23
+ tableColumnStatisticsGet(attachOpaqueData: AttachOpaqueData, schemaName: string, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<{
24
+ bytes: Uint8Array;
25
+ cacheMaxAgeSeconds: number | null;
26
+ } | null>;
27
+ viewGet(attachOpaqueData: AttachOpaqueData, schemaName: string, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<ViewInfo | null>;
28
+ macroGet(attachOpaqueData: AttachOpaqueData, schemaName: string, name: string, transactionOpaqueData?: TransactionOpaqueData): Promise<MacroInfo | null>;
29
+ copyFromFormats(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): Promise<CopyFromFormatInfo[]>;
30
+ transactionBegin(attachOpaqueData: AttachOpaqueData): Promise<Uint8Array | null>;
31
+ transactionCommit(attachOpaqueData: AttachOpaqueData, transactionOpaqueData: TransactionOpaqueData): Promise<void>;
32
+ transactionRollback(attachOpaqueData: AttachOpaqueData, transactionOpaqueData: TransactionOpaqueData): Promise<void>;
33
+ }
@@ -0,0 +1,154 @@
1
+ import type { VgiSchema, VgiDataType } from "../arrow/index.js";
2
+ import type { VgiFunction } from "../functions/types.js";
3
+ import type { Arguments } from "../arguments/arguments.js";
4
+ import type { ColumnStatistics } from "../util/statistics.js";
5
+ export interface SettingDescriptor {
6
+ name: string;
7
+ description: string;
8
+ type: VgiDataType;
9
+ /** Must be a JS primitive compatible with `type` (string, number, bigint, boolean). */
10
+ defaultValue?: string | number | bigint | boolean;
11
+ }
12
+ export interface ForeignKeyDef {
13
+ columns: string[];
14
+ referencedTable: string;
15
+ referencedColumns: string[];
16
+ referencedSchema?: string;
17
+ }
18
+ export type DefaultValue = string | number | boolean | null;
19
+ export interface TableDescriptor {
20
+ name: string;
21
+ columns?: VgiSchema;
22
+ function?: VgiFunction;
23
+ arguments?: Arguments;
24
+ notNull?: string[];
25
+ unique?: string[][];
26
+ check?: string[];
27
+ primaryKey?: string[][];
28
+ foreignKey?: ForeignKeyDef[];
29
+ defaults?: Record<string, DefaultValue>;
30
+ /** Per-column comment strings, applied as field metadata `comment`. */
31
+ columnComments?: Record<string, string>;
32
+ /**
33
+ * Generated (virtual) columns: map of column name → SQL expression computed
34
+ * from other physical columns. Applied as Arrow field metadata
35
+ * `generated_expression`, which the DuckDB VGI extension reads at table
36
+ * registration. The backing scan function should not return these columns —
37
+ * DuckDB evaluates the expressions client-side.
38
+ */
39
+ generatedColumns?: Record<string, string>;
40
+ /**
41
+ * Per-column statistics for the optimizer. Keys are column names; values
42
+ * are ColumnStatistics records with typed min/max and Arrow type info.
43
+ * DuckDB uses these for plan-time filter elimination and join reordering
44
+ * via the `catalog_table_column_statistics_get` RPC.
45
+ */
46
+ statistics?: Record<string, ColumnStatistics>;
47
+ /**
48
+ * Cache TTL for this table's column statistics. DuckDB caches the result
49
+ * of `catalog_table_column_statistics_get` for up to this many seconds.
50
+ * `undefined`/null means cache indefinitely; `0` means never cache
51
+ * (always re-fetch).
52
+ */
53
+ statisticsCacheMaxAgeSeconds?: number | null;
54
+ /**
55
+ * Dotted-path column references that MUST appear in a WHERE expression for
56
+ * any scan of this table. Top-level names (`"country"`) or struct subfields
57
+ * (`"bbox.xmin"`, `"nested.outer.inner"`). Empty/undefined (default) means
58
+ * no enforcement — the zero-cost fast path for every existing table.
59
+ *
60
+ * Satisfaction is prefix-based: a present filter on a shorter path satisfies
61
+ * any required path it is a prefix of. So a whole-struct filter on `bbox`
62
+ * satisfies all of `bbox.xmin` / `.xmax` / `.ymin` / `.ymax`. The VGI DuckDB
63
+ * extension's optimizer pass consults this list at bind time and throws a
64
+ * `BinderException` listing any unsatisfied paths.
65
+ */
66
+ requiredFieldFilterPaths?: string[];
67
+ supportsTimeTravel?: boolean;
68
+ /**
69
+ * Inline cardinality estimate/max surfaced through TableInfo. When set,
70
+ * the C++ extension uses these directly and skips the per-bind
71
+ * table_function_cardinality RPC. Only meaningful for function-backed
72
+ * tables; static-column tables don't have a function to call.
73
+ */
74
+ inlinedCardinality?: {
75
+ estimate: bigint;
76
+ max: bigint;
77
+ };
78
+ comment?: string;
79
+ tags?: Record<string, string>;
80
+ }
81
+ export interface ViewDescriptor {
82
+ name: string;
83
+ definition: string;
84
+ comment?: string;
85
+ /**
86
+ * Per-column comments keyed by the view's output column name. Unlike tables
87
+ * (whose column comments ride along as Arrow field metadata), a view ships
88
+ * only its SQL `definition`, so column comments need their own channel. The
89
+ * C++ extension aligns these by name against the bound output columns and
90
+ * feeds them into `CreateViewInfo.column_comments_map`; names that don't
91
+ * match a bound column are ignored.
92
+ */
93
+ columnComments?: Record<string, string>;
94
+ tags?: Record<string, string>;
95
+ }
96
+ export interface MacroDescriptor {
97
+ name: string;
98
+ macroType: "scalar" | "table";
99
+ parameters: string[];
100
+ parameterDefaultValues?: Uint8Array | null;
101
+ /**
102
+ * Optional mapping of parameter name to a human/agent-facing description.
103
+ * Keys must appear in `parameters`. Descriptions flow over the wire via the
104
+ * macro `arguments_schema`'s `vgi_doc` field metadata (the same channel
105
+ * functions use for per-argument docs), so the DuckDB extension's
106
+ * `vgi_function_arguments()` can surface them. Empty/omitted = no docs.
107
+ */
108
+ parameterDocs?: Record<string, string>;
109
+ definition: string;
110
+ comment?: string;
111
+ tags?: Record<string, string>;
112
+ }
113
+ export interface IndexDescriptor {
114
+ name: string;
115
+ tableName: string;
116
+ expressions: string[];
117
+ /** UNIQUE / PRIMARY / NONE; defaults to NONE. */
118
+ constraintType?: "NONE" | "UNIQUE" | "PRIMARY";
119
+ indexType?: string;
120
+ options?: Record<string, string>;
121
+ comment?: string;
122
+ tags?: Record<string, string>;
123
+ }
124
+ export interface SchemaDescriptor {
125
+ name: string;
126
+ tables?: TableDescriptor[];
127
+ views?: ViewDescriptor[];
128
+ macros?: MacroDescriptor[];
129
+ functions?: VgiFunction[];
130
+ indexes?: IndexDescriptor[];
131
+ comment?: string;
132
+ tags?: Record<string, string>;
133
+ }
134
+ export interface SecretTypeDescriptor {
135
+ name: string;
136
+ description: string;
137
+ schema: VgiSchema;
138
+ }
139
+ export interface CatalogDescriptor {
140
+ name: string;
141
+ defaultSchema?: string;
142
+ schemas: SchemaDescriptor[];
143
+ settings?: SettingDescriptor[];
144
+ secretTypes?: SecretTypeDescriptor[];
145
+ comment?: string;
146
+ tags?: Record<string, string>;
147
+ /**
148
+ * Homepage for this catalog — repo, docs, or dataset landing page. Surfaced
149
+ * through the `catalog_catalogs` discovery record as `CatalogInfo.source_url`,
150
+ * which DuckDB exposes via `duckdb_databases()`. Optional; omitted/`undefined`
151
+ * advertises a null `source_url`.
152
+ */
153
+ sourceUrl?: string;
154
+ }