@qualithm/arrow-flight-client 0.1.0 → 0.1.1

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 (36) hide show
  1. package/README.md +46 -14
  2. package/dist/client/flight-client.d.ts.map +1 -1
  3. package/dist/client/flight-client.js +5 -9
  4. package/dist/client/flight-client.js.map +1 -1
  5. package/dist/client/flight-sql-client.d.ts.map +1 -1
  6. package/dist/client/flight-sql-client.js +5 -8
  7. package/dist/client/flight-sql-client.js.map +1 -1
  8. package/dist/gen/arrow/flight/FlightSql_pb.d.ts +2382 -1962
  9. package/dist/gen/arrow/flight/FlightSql_pb.js +316 -1957
  10. package/dist/gen/arrow/flight/Flight_pb.d.ts +847 -720
  11. package/dist/gen/arrow/flight/Flight_pb.js +119 -230
  12. package/dist/testing/builders.d.ts +53 -0
  13. package/dist/testing/builders.d.ts.map +1 -0
  14. package/dist/testing/builders.js +95 -0
  15. package/dist/testing/builders.js.map +1 -0
  16. package/dist/testing/descriptors.d.ts +43 -0
  17. package/dist/testing/descriptors.d.ts.map +1 -0
  18. package/dist/testing/descriptors.js +47 -0
  19. package/dist/testing/descriptors.js.map +1 -0
  20. package/dist/testing/helpers.d.ts +70 -0
  21. package/dist/testing/helpers.d.ts.map +1 -0
  22. package/dist/testing/helpers.js +95 -0
  23. package/dist/testing/helpers.js.map +1 -0
  24. package/dist/testing/index.d.ts +44 -0
  25. package/dist/testing/index.d.ts.map +1 -0
  26. package/dist/testing/index.js +49 -0
  27. package/dist/testing/index.js.map +1 -0
  28. package/dist/testing/streams.d.ts +88 -0
  29. package/dist/testing/streams.d.ts.map +1 -0
  30. package/dist/testing/streams.js +112 -0
  31. package/dist/testing/streams.js.map +1 -0
  32. package/package.json +17 -7
  33. package/dist/gen/arrow/flight/FlightSql_pb.d.ts.map +0 -1
  34. package/dist/gen/arrow/flight/FlightSql_pb.js.map +0 -1
  35. package/dist/gen/arrow/flight/Flight_pb.d.ts.map +0 -1
  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AElE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAA;IACX,CAAC;IAED,oDAAoD;IACpD,MAAM,MAAM,GAAG,IAAI,uBAAuB,EAAE,CAAA;IAC5C,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IAE/B,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,CAAA;IAEf,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;IAE1C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAA;IACX,CAAC;IAED,+BAA+B;IAC/B,0FAA0F;IAC1F,oEAAoE;IACpE,OAAO;QACL,MAAM,CAAC,gBAAgB,EAAE;YACvB,UAAU,EAAE,QAAQ;YACpB,QAAQ,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;YAC3B,WAAW,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;SAC/B,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * FlightDescriptor helper functions for tests.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import type { FlightDescriptorInput } from "../client/types.js";
7
+ /**
8
+ * Create a path-based FlightDescriptor input.
9
+ *
10
+ * Path descriptors identify a dataset by a hierarchical path (like "db/schema/table").
11
+ *
12
+ * @param path - Path segments
13
+ * @returns FlightDescriptorInput for path descriptor
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // Create descriptor for "test/integers"
18
+ * const descriptor = pathDescriptor("test", "integers")
19
+ *
20
+ * // Use with client
21
+ * const info = await client.getFlightInfo(descriptor)
22
+ * ```
23
+ */
24
+ export declare function pathDescriptor(...path: string[]): FlightDescriptorInput;
25
+ /**
26
+ * Create a command-based FlightDescriptor input.
27
+ *
28
+ * Command descriptors contain opaque bytes interpreted by the server.
29
+ *
30
+ * @param cmd - Command bytes or string (will be UTF-8 encoded)
31
+ * @returns FlightDescriptorInput for command descriptor
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // Create descriptor with SQL query command
36
+ * const descriptor = cmdDescriptor("SELECT * FROM users")
37
+ *
38
+ * // Create descriptor with binary command
39
+ * const descriptor = cmdDescriptor(new Uint8Array([0x01, 0x02]))
40
+ * ```
41
+ */
42
+ export declare function cmdDescriptor(cmd: string | Uint8Array): FlightDescriptorInput;
43
+ //# sourceMappingURL=descriptors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/testing/descriptors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,qBAAqB,CAEvE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,qBAAqB,CAG7E"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * FlightDescriptor helper functions for tests.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /**
7
+ * Create a path-based FlightDescriptor input.
8
+ *
9
+ * Path descriptors identify a dataset by a hierarchical path (like "db/schema/table").
10
+ *
11
+ * @param path - Path segments
12
+ * @returns FlightDescriptorInput for path descriptor
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Create descriptor for "test/integers"
17
+ * const descriptor = pathDescriptor("test", "integers")
18
+ *
19
+ * // Use with client
20
+ * const info = await client.getFlightInfo(descriptor)
21
+ * ```
22
+ */
23
+ export function pathDescriptor(...path) {
24
+ return { type: "path", path };
25
+ }
26
+ /**
27
+ * Create a command-based FlightDescriptor input.
28
+ *
29
+ * Command descriptors contain opaque bytes interpreted by the server.
30
+ *
31
+ * @param cmd - Command bytes or string (will be UTF-8 encoded)
32
+ * @returns FlightDescriptorInput for command descriptor
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * // Create descriptor with SQL query command
37
+ * const descriptor = cmdDescriptor("SELECT * FROM users")
38
+ *
39
+ * // Create descriptor with binary command
40
+ * const descriptor = cmdDescriptor(new Uint8Array([0x01, 0x02]))
41
+ * ```
42
+ */
43
+ export function cmdDescriptor(cmd) {
44
+ const cmdBytes = typeof cmd === "string" ? new TextEncoder().encode(cmd) : cmd;
45
+ return { type: "cmd", cmd: cmdBytes };
46
+ }
47
+ //# sourceMappingURL=descriptors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/testing/descriptors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAAC,GAAG,IAAc;IAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAC/B,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,GAAwB;IACpD,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAC9E,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAA;AACvC,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Table and RecordBatch creation helpers for tests.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { type RecordBatch, type Table, tableFromArrays } from "apache-arrow";
7
+ /**
8
+ * Input data for creating test tables.
9
+ * Keys are column names, values are typed arrays or regular arrays.
10
+ */
11
+ export type TestTableData = Parameters<typeof tableFromArrays>[0];
12
+ /**
13
+ * Create an Arrow Table from simple arrays.
14
+ *
15
+ * Automatically infers types from the input arrays:
16
+ * - Int32Array → Int32
17
+ * - Float64Array → Float64
18
+ * - string[] → Utf8
19
+ * - number[] → Float64
20
+ *
21
+ * @param data - Object mapping column names to arrays
22
+ * @returns Arrow Table
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const table = createTestTable({
27
+ * id: new Int32Array([1, 2, 3]),
28
+ * value: new Float64Array([1.1, 2.2, 3.3]),
29
+ * name: ["alice", "bob", "charlie"]
30
+ * })
31
+ * ```
32
+ */
33
+ export declare function createTestTable(data: TestTableData): Table;
34
+ /**
35
+ * Create a single RecordBatch from simple arrays.
36
+ *
37
+ * @param data - Object mapping column names to arrays
38
+ * @returns Arrow RecordBatch
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const batch = createTestBatch({
43
+ * id: new Int32Array([1, 2, 3]),
44
+ * value: new Float64Array([1.1, 2.2, 3.3])
45
+ * })
46
+ * ```
47
+ */
48
+ export declare function createTestBatch(data: TestTableData): RecordBatch;
49
+ /**
50
+ * Create a Table with standard integer test data.
51
+ *
52
+ * @param count - Number of rows (default: 10)
53
+ * @returns Table with `id` (Int32) and `value` (Int32) columns
54
+ */
55
+ export declare function createIntegerTable(count?: number): Table;
56
+ /**
57
+ * Create a Table with standard float test data.
58
+ *
59
+ * @param count - Number of rows (default: 10)
60
+ * @returns Table with `id` (Int32) and `value` (Float64) columns
61
+ */
62
+ export declare function createFloatTable(count?: number): Table;
63
+ /**
64
+ * Create a Table with string test data.
65
+ *
66
+ * @param count - Number of rows (default: 10)
67
+ * @returns Table with `id` (Int32) and `name` (Utf8) columns
68
+ */
69
+ export declare function createStringTable(count?: number): Table;
70
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/testing/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE5E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,KAAK,CAE1D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,WAAW,CAIhE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAK,GAAG,KAAK,CAUpD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,SAAK,GAAG,KAAK,CAUlD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,SAAK,GAAG,KAAK,CAUnD"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Table and RecordBatch creation helpers for tests.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { tableFromArrays } from "apache-arrow";
7
+ /**
8
+ * Create an Arrow Table from simple arrays.
9
+ *
10
+ * Automatically infers types from the input arrays:
11
+ * - Int32Array → Int32
12
+ * - Float64Array → Float64
13
+ * - string[] → Utf8
14
+ * - number[] → Float64
15
+ *
16
+ * @param data - Object mapping column names to arrays
17
+ * @returns Arrow Table
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const table = createTestTable({
22
+ * id: new Int32Array([1, 2, 3]),
23
+ * value: new Float64Array([1.1, 2.2, 3.3]),
24
+ * name: ["alice", "bob", "charlie"]
25
+ * })
26
+ * ```
27
+ */
28
+ export function createTestTable(data) {
29
+ return tableFromArrays(data);
30
+ }
31
+ /**
32
+ * Create a single RecordBatch from simple arrays.
33
+ *
34
+ * @param data - Object mapping column names to arrays
35
+ * @returns Arrow RecordBatch
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const batch = createTestBatch({
40
+ * id: new Int32Array([1, 2, 3]),
41
+ * value: new Float64Array([1.1, 2.2, 3.3])
42
+ * })
43
+ * ```
44
+ */
45
+ export function createTestBatch(data) {
46
+ const table = createTestTable(data);
47
+ // Tables created from tableFromArrays have exactly one batch
48
+ return table.batches[0];
49
+ }
50
+ /**
51
+ * Create a Table with standard integer test data.
52
+ *
53
+ * @param count - Number of rows (default: 10)
54
+ * @returns Table with `id` (Int32) and `value` (Int32) columns
55
+ */
56
+ export function createIntegerTable(count = 10) {
57
+ const ids = new Int32Array(count);
58
+ const values = new Int32Array(count);
59
+ for (let i = 0; i < count; i++) {
60
+ ids[i] = i + 1;
61
+ values[i] = (i + 1) * 10;
62
+ }
63
+ return createTestTable({ id: ids, value: values });
64
+ }
65
+ /**
66
+ * Create a Table with standard float test data.
67
+ *
68
+ * @param count - Number of rows (default: 10)
69
+ * @returns Table with `id` (Int32) and `value` (Float64) columns
70
+ */
71
+ export function createFloatTable(count = 10) {
72
+ const ids = new Int32Array(count);
73
+ const values = new Float64Array(count);
74
+ for (let i = 0; i < count; i++) {
75
+ ids[i] = i + 1;
76
+ values[i] = (i + 1) * 1.1;
77
+ }
78
+ return createTestTable({ id: ids, value: values });
79
+ }
80
+ /**
81
+ * Create a Table with string test data.
82
+ *
83
+ * @param count - Number of rows (default: 10)
84
+ * @returns Table with `id` (Int32) and `name` (Utf8) columns
85
+ */
86
+ export function createStringTable(count = 10) {
87
+ const ids = new Int32Array(count);
88
+ const names = [];
89
+ for (let i = 0; i < count; i++) {
90
+ ids[i] = i + 1;
91
+ names.push(`item-${String(i + 1)}`);
92
+ }
93
+ return createTestTable({ id: ids, name: names });
94
+ }
95
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/testing/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAgC,eAAe,EAAE,MAAM,cAAc,CAA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,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;IAC3B,CAAC;IAED,OAAO,eAAe,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAK,GAAG,EAAE;IAC1C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;IACjC,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACd,KAAK,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,eAAe,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;AAClD,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Testing utilities for Arrow Flight Client.
3
+ *
4
+ * This subpath export (`@qualithm/arrow-flight-client/testing`) provides:
5
+ *
6
+ * - **Table helpers** — Create Arrow Tables and RecordBatches for tests
7
+ * - **FlightData builders** — Construct FlightData messages without protobuf boilerplate
8
+ * - **Mock streams** — Create async iterables for testing stream consumers
9
+ * - **Descriptor helpers** — Build FlightDescriptor inputs easily
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import {
14
+ * // Table helpers
15
+ * createTestTable, createTestBatch,
16
+ * // FlightData builders
17
+ * createEmptyFlightData, tableToFlightData,
18
+ * // Mock streams
19
+ * asyncIterable, emptyStream,
20
+ * // Descriptor helpers
21
+ * pathDescriptor, cmdDescriptor
22
+ * } from "@qualithm/arrow-flight-client/testing"
23
+ *
24
+ * // Create test data
25
+ * const table = createTestTable({ id: [1, 2, 3], value: [1.1, 2.2, 3.3] })
26
+ *
27
+ * // Build FlightData from table
28
+ * const flightData = await tableToFlightData(table)
29
+ *
30
+ * // Create mock streams
31
+ * const stream = asyncIterable(flightData)
32
+ *
33
+ * // Build descriptors
34
+ * const descriptor = pathDescriptor("test", "integers")
35
+ * ```
36
+ *
37
+ * @packageDocumentation
38
+ */
39
+ export { createFloatTable, createIntegerTable, createStringTable, createTestBatch, createTestTable, type TestTableData } from "./helpers.js";
40
+ export { batchesToFlightData, collectFlightData, createEmptyFlightData, tableToFlightData } from "./builders.js";
41
+ export { asyncIterable, concatStreams, delayedIterable, emptyStream, errorAfter } from "./streams.js";
42
+ export { cmdDescriptor, pathDescriptor } from "./descriptors.js";
43
+ export { FlightDataSchema, FlightDescriptor_DescriptorType, FlightDescriptorSchema, FlightEndpointSchema, FlightInfoSchema, TicketSchema } from "../gen/arrow/flight/Flight_pb.js";
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,KAAK,aAAa,EACnB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,eAAe,CAAA;AAGtB,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACX,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGhE,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACb,MAAM,kCAAkC,CAAA"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Testing utilities for Arrow Flight Client.
3
+ *
4
+ * This subpath export (`@qualithm/arrow-flight-client/testing`) provides:
5
+ *
6
+ * - **Table helpers** — Create Arrow Tables and RecordBatches for tests
7
+ * - **FlightData builders** — Construct FlightData messages without protobuf boilerplate
8
+ * - **Mock streams** — Create async iterables for testing stream consumers
9
+ * - **Descriptor helpers** — Build FlightDescriptor inputs easily
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import {
14
+ * // Table helpers
15
+ * createTestTable, createTestBatch,
16
+ * // FlightData builders
17
+ * createEmptyFlightData, tableToFlightData,
18
+ * // Mock streams
19
+ * asyncIterable, emptyStream,
20
+ * // Descriptor helpers
21
+ * pathDescriptor, cmdDescriptor
22
+ * } from "@qualithm/arrow-flight-client/testing"
23
+ *
24
+ * // Create test data
25
+ * const table = createTestTable({ id: [1, 2, 3], value: [1.1, 2.2, 3.3] })
26
+ *
27
+ * // Build FlightData from table
28
+ * const flightData = await tableToFlightData(table)
29
+ *
30
+ * // Create mock streams
31
+ * const stream = asyncIterable(flightData)
32
+ *
33
+ * // Build descriptors
34
+ * const descriptor = pathDescriptor("test", "integers")
35
+ * ```
36
+ *
37
+ * @packageDocumentation
38
+ */
39
+ // Table helpers
40
+ export { createFloatTable, createIntegerTable, createStringTable, createTestBatch, createTestTable } from "./helpers.js";
41
+ // FlightData builders
42
+ export { batchesToFlightData, collectFlightData, createEmptyFlightData, tableToFlightData } from "./builders.js";
43
+ // Mock streams
44
+ export { asyncIterable, concatStreams, delayedIterable, emptyStream, errorAfter } from "./streams.js";
45
+ // Descriptor helpers
46
+ export { cmdDescriptor, pathDescriptor } from "./descriptors.js";
47
+ // Re-export proto schemas for advanced test fixture construction
48
+ export { FlightDataSchema, FlightDescriptor_DescriptorType, FlightDescriptorSchema, FlightEndpointSchema, FlightInfoSchema, TicketSchema } from "../gen/arrow/flight/Flight_pb.js";
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,gBAAgB;AAChB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EAEhB,MAAM,cAAc,CAAA;AAErB,sBAAsB;AACtB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,eAAe,CAAA;AAEtB,eAAe;AACf,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACX,MAAM,cAAc,CAAA;AAErB,qBAAqB;AACrB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEhE,iEAAiE;AACjE,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACb,MAAM,kCAAkC,CAAA"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Mock stream utilities for testing stream consumers.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /**
7
+ * Create an async iterable from an array of items.
8
+ *
9
+ * Useful for testing stream consumers with predetermined data.
10
+ *
11
+ * @param items - Array of items to yield
12
+ * @returns Async iterable that yields each item
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const flightData = [createEmptyFlightData()]
17
+ * const stream = asyncIterable(flightData)
18
+ *
19
+ * for await (const data of stream) {
20
+ * console.log(data)
21
+ * }
22
+ * ```
23
+ */
24
+ export declare function asyncIterable<T>(items: T[]): AsyncGenerator<T>;
25
+ /**
26
+ * Create an empty async iterable.
27
+ *
28
+ * Useful for testing edge cases with empty streams.
29
+ *
30
+ * @returns Empty async iterable
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const stream = emptyStream()
35
+ * const result = await collectFlightData(stream)
36
+ * expect(result).toEqual([])
37
+ * ```
38
+ */
39
+ export declare function emptyStream<T>(): AsyncIterable<T>;
40
+ /**
41
+ * Concatenate multiple async iterables into one.
42
+ *
43
+ * @param streams - Async iterables to concatenate
44
+ * @returns Combined async iterable
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const stream1 = asyncIterable([data1])
49
+ * const stream2 = asyncIterable([data2, data3])
50
+ * const combined = concatStreams(stream1, stream2)
51
+ *
52
+ * // Yields data1, data2, data3 in order
53
+ * ```
54
+ */
55
+ export declare function concatStreams<T>(...streams: AsyncIterable<T>[]): AsyncIterable<T>;
56
+ /**
57
+ * Create an async iterable that yields items with delays.
58
+ *
59
+ * Useful for testing timeout handling and streaming behavior.
60
+ *
61
+ * @param items - Array of items to yield
62
+ * @param delayMs - Delay between items in milliseconds
63
+ * @returns Async iterable with delays
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const stream = delayedIterable([data1, data2], 100)
68
+ * // Yields data1, waits 100ms, yields data2
69
+ * ```
70
+ */
71
+ export declare function delayedIterable<T>(items: T[], delayMs: number): AsyncIterable<T>;
72
+ /**
73
+ * Create an async iterable that throws an error after yielding some items.
74
+ *
75
+ * Useful for testing error handling in stream consumers.
76
+ *
77
+ * @param items - Items to yield before throwing
78
+ * @param error - Error to throw
79
+ * @returns Async iterable that throws
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const stream = errorAfter([data1], new Error("connection lost"))
84
+ * // Yields data1, then throws Error
85
+ * ```
86
+ */
87
+ export declare function errorAfter<T>(items: T[], error: Error): AsyncGenerator<T>;
88
+ //# sourceMappingURL=streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../src/testing/streams.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAuB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,CAIrE;AAED;;;;;;;;;;;;;GAaG;AAEH,wBAAuB,WAAW,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAExD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAuB,aAAa,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAMxF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAuB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAOvF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAuB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAKhF"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Mock stream utilities for testing stream consumers.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /**
7
+ * Create an async iterable from an array of items.
8
+ *
9
+ * Useful for testing stream consumers with predetermined data.
10
+ *
11
+ * @param items - Array of items to yield
12
+ * @returns Async iterable that yields each item
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const flightData = [createEmptyFlightData()]
17
+ * const stream = asyncIterable(flightData)
18
+ *
19
+ * for await (const data of stream) {
20
+ * console.log(data)
21
+ * }
22
+ * ```
23
+ */
24
+ export async function* asyncIterable(items) {
25
+ for (const item of items) {
26
+ yield await Promise.resolve(item);
27
+ }
28
+ }
29
+ /**
30
+ * Create an empty async iterable.
31
+ *
32
+ * Useful for testing edge cases with empty streams.
33
+ *
34
+ * @returns Empty async iterable
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const stream = emptyStream()
39
+ * const result = await collectFlightData(stream)
40
+ * expect(result).toEqual([])
41
+ * ```
42
+ */
43
+ export async function* emptyStream() {
44
+ // Yields nothing
45
+ }
46
+ /**
47
+ * Concatenate multiple async iterables into one.
48
+ *
49
+ * @param streams - Async iterables to concatenate
50
+ * @returns Combined async iterable
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const stream1 = asyncIterable([data1])
55
+ * const stream2 = asyncIterable([data2, data3])
56
+ * const combined = concatStreams(stream1, stream2)
57
+ *
58
+ * // Yields data1, data2, data3 in order
59
+ * ```
60
+ */
61
+ export async function* concatStreams(...streams) {
62
+ for (const stream of streams) {
63
+ for await (const item of stream) {
64
+ yield item;
65
+ }
66
+ }
67
+ }
68
+ /**
69
+ * Create an async iterable that yields items with delays.
70
+ *
71
+ * Useful for testing timeout handling and streaming behavior.
72
+ *
73
+ * @param items - Array of items to yield
74
+ * @param delayMs - Delay between items in milliseconds
75
+ * @returns Async iterable with delays
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const stream = delayedIterable([data1, data2], 100)
80
+ * // Yields data1, waits 100ms, yields data2
81
+ * ```
82
+ */
83
+ export async function* delayedIterable(items, delayMs) {
84
+ for (let i = 0; i < items.length; i++) {
85
+ if (i > 0) {
86
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
87
+ }
88
+ yield items[i];
89
+ }
90
+ }
91
+ /**
92
+ * Create an async iterable that throws an error after yielding some items.
93
+ *
94
+ * Useful for testing error handling in stream consumers.
95
+ *
96
+ * @param items - Items to yield before throwing
97
+ * @param error - Error to throw
98
+ * @returns Async iterable that throws
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * const stream = errorAfter([data1], new Error("connection lost"))
103
+ * // Yields data1, then throws Error
104
+ * ```
105
+ */
106
+ export async function* errorAfter(items, error) {
107
+ for (const item of items) {
108
+ yield await Promise.resolve(item);
109
+ }
110
+ throw error;
111
+ }
112
+ //# sourceMappingURL=streams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streams.js","sourceRoot":"","sources":["../../src/testing/streams.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,SAA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 @@
1
1
  {
2
2
  "name": "@qualithm/arrow-flight-client",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Unified Arrow Flight and Flight SQL client for JavaScript and TypeScript runtimes.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -12,6 +12,7 @@
12
12
  "apache-arrow",
13
13
  "typescript"
14
14
  ],
15
+ "sideEffects": false,
15
16
  "license": "Apache-2.0",
16
17
  "author": "Qualithm",
17
18
  "repository": {
@@ -28,9 +29,17 @@
28
29
  "exports": {
29
30
  ".": {
30
31
  "bun": "./dist/index.js",
32
+ "deno": "./dist/index.js",
31
33
  "node": "./dist/index.js",
32
34
  "import": "./dist/index.js",
33
35
  "types": "./dist/index.d.ts"
36
+ },
37
+ "./testing": {
38
+ "bun": "./dist/testing/index.js",
39
+ "deno": "./dist/testing/index.js",
40
+ "node": "./dist/testing/index.js",
41
+ "import": "./dist/testing/index.js",
42
+ "types": "./dist/testing/index.d.ts"
34
43
  }
35
44
  },
36
45
  "files": [
@@ -46,7 +55,7 @@
46
55
  "bench:ipc": "bun run bench/ipc.ts",
47
56
  "bench": "bun run bench/index.ts",
48
57
  "build:watch": "tsc -p tsconfig.build.json --watch",
49
- "build": "tsc -p tsconfig.build.json",
58
+ "build": "tsc -p tsconfig.build.json && cp -r src/gen dist/gen",
50
59
  "clean": "rm -rf dist",
51
60
  "dev": "bun --watch run src/index.ts",
52
61
  "docs": "typedoc",
@@ -73,12 +82,12 @@
73
82
  "apache-arrow": "^21.1.0"
74
83
  },
75
84
  "devDependencies": {
76
- "@bufbuild/buf": "^1.66.0",
85
+ "@bufbuild/buf": "^1.66.1",
77
86
  "@bufbuild/protoc-gen-es": "^2.11.0",
78
87
  "@eslint/js": "10.0.1",
79
88
  "@types/bun": "1.3.10",
80
- "@vitest/coverage-v8": "^4.0.18",
81
- "eslint": "10.0.2",
89
+ "@vitest/coverage-v8": "^4.1.0",
90
+ "eslint": "10.0.3",
82
91
  "eslint-plugin-simple-import-sort": "12.1.1",
83
92
  "eslint-plugin-unused-imports": "4.4.1",
84
93
  "globals": "17.4.0",
@@ -86,10 +95,11 @@
86
95
  "prettier": "3.8.1",
87
96
  "typedoc": "0.28.17",
88
97
  "typescript": "5.9.3",
89
- "typescript-eslint": "8.56.1",
90
- "vitest": "^4.0.18"
98
+ "typescript-eslint": "8.57.0",
99
+ "vitest": "^4.1.0"
91
100
  },
92
101
  "overrides": {
102
+ "flatted": "3.4.1",
93
103
  "minimatch": "10.2.3",
94
104
  "undici": "6.23.0"
95
105
  }