@clickhouse/client 0.0.1 → 0.0.5

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.
package/README.md CHANGED
@@ -4,8 +4,11 @@
4
4
  </p>
5
5
  <br/>
6
6
  <p align="center">
7
- <a href="https://github.com/ClickHouse/clickhouse-js/actions/workflows/run-tests.yml">
8
- <img src="https://github.com/ClickHouse/clickhouse-js/actions/workflows/run-tests.yml/badge.svg?branch=main">
7
+ <a href="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests.yml">
8
+ <img src="https://github.com/ClickHouse/clickhouse-js/actions/workflows/tests.yml/badge.svg?branch=main">
9
+ </a>
10
+ <a href="http://htmlpreview.github.io/?https://github.com/ClickHouse/clickhouse-js/blob/main/coverage/lcov-report/index.html">
11
+ <img src="./coverage/badge.svg">
9
12
  </a>
10
13
  </p>
11
14
 
@@ -20,7 +23,7 @@ It is focused on data streaming for both inserts and selects using standard [Nod
20
23
  The client is tested with the following ClickHouse and Node.js versions:
21
24
 
22
25
  | Node.js | ClickHouse | Status |
23
- |---------|------------|--------|
26
+ | ------- | ---------- | ------ |
24
27
  | 14.x | 22.8 | ✔ |
25
28
  | 16.x | 22.8 | ✔ |
26
29
  | 18.x | 22.8 | ✔ |
@@ -28,6 +31,12 @@ The client is tested with the following ClickHouse and Node.js versions:
28
31
  | 16.x | 22.9 | ✔ |
29
32
  | 18.x | 22.9 | ✔ |
30
33
 
34
+ ## Installation
35
+
36
+ ```bash
37
+ npm i @clickhouse/client
38
+ ```
39
+
31
40
  ## Connection
32
41
 
33
42
  Currently, only HTTP(s) protocol is supported.
@@ -142,8 +151,8 @@ See also:
142
151
  ## Supported formats
143
152
 
144
153
  | Format | Input (array) | Input (stream) | Output (JSON) | Output (text) |
145
- |--------------------------------------------|---------------|----------------|---------------|---------------|
146
- | JSON | ❌ | ❌ | ✔️ | ✔️ |
154
+ | ------------------------------------------ | ------------- | -------------- | ------------- | ------------- |
155
+ | JSON | ❌ | ❌ | ✔️ | ✔️ |
147
156
  | JSONEachRow | ✔️ | ✔️ | ✔️ | ✔️ |
148
157
  | JSONStringsEachRow | ✔️ | ✔️ | ✔️ | ✔️ |
149
158
  | JSONCompactEachRow | ✔️ | ✔️ | ✔️ | ✔️ |
@@ -152,49 +161,49 @@ See also:
152
161
  | JSONCompactEachRowWithNamesAndTypes | ✔️ | ✔️ | ✔️ | ✔️ |
153
162
  | JSONCompactStringsEachRowWithNames | ✔️ | ✔️ | ✔️ | ✔️ |
154
163
  | JSONCompactStringsEachRowWithNamesAndTypes | ✔️ | ✔️ | ✔️ | ✔️ |
155
- | CSV | ❌ | ✔️ | ❌ | ✔️ |
156
- | CSVWithNames | ❌ | ✔️ | ❌ | ✔️ |
157
- | CSVWithNamesAndTypes | ❌ | ✔️ | ❌ | ✔️ |
158
- | TabSeparated | ❌ | ✔️ | ❌ | ✔️ |
159
- | TabSeparatedRaw | ❌ | ✔️ | ❌ | ✔️ |
160
- | TabSeparatedWithNames | ❌ | ✔️ | ❌ | ✔️ |
161
- | TabSeparatedWithNamesAndTypes | ❌ | ✔️ | ❌ | ✔️ |
162
- | CustomSeparated | ❌ | ✔️ | ❌ | ✔️ |
163
- | CustomSeparatedWithNames | ❌ | ✔️ | ❌ | ✔️ |
164
- | CustomSeparatedWithNamesAndTypes | ❌ | ✔️ | ❌ | ✔️ |
164
+ | CSV | ❌ | ✔️ | ❌ | ✔️ |
165
+ | CSVWithNames | ❌ | ✔️ | ❌ | ✔️ |
166
+ | CSVWithNamesAndTypes | ❌ | ✔️ | ❌ | ✔️ |
167
+ | TabSeparated | ❌ | ✔️ | ❌ | ✔️ |
168
+ | TabSeparatedRaw | ❌ | ✔️ | ❌ | ✔️ |
169
+ | TabSeparatedWithNames | ❌ | ✔️ | ❌ | ✔️ |
170
+ | TabSeparatedWithNamesAndTypes | ❌ | ✔️ | ❌ | ✔️ |
171
+ | CustomSeparated | ❌ | ✔️ | ❌ | ✔️ |
172
+ | CustomSeparatedWithNames | ❌ | ✔️ | ❌ | ✔️ |
173
+ | CustomSeparatedWithNamesAndTypes | ❌ | ✔️ | ❌ | ✔️ |
165
174
 
166
175
  The entire list of ClickHouse input and output formats is available [here](https://clickhouse.com/docs/en/interfaces/formats).
167
176
 
168
177
  ## Supported ClickHouse data types
169
178
 
170
- | Type | Status | JS type |
171
- |----------------|----------------|---------------------------------------|
172
- | UInt8/16/32 | ✔️ | number |
179
+ | Type | Status | JS type |
180
+ | -------------- | --------------- | ------------------------------------- |
181
+ | UInt8/16/32 | ✔️ | number |
173
182
  | UInt64/128/256 | ✔️❗- see below | string |
174
- | Int8/16/32 | ✔️ | number |
183
+ | Int8/16/32 | ✔️ | number |
175
184
  | Int64/128/256 | ✔️❗- see below | string |
176
- | Float32/64 | ✔️ | number |
185
+ | Float32/64 | ✔️ | number |
177
186
  | Decimal | ✔️❗- see below | number |
178
- | Boolean | ✔️ | boolean |
179
- | String | ✔️ | string |
180
- | FixedString | ✔️ | string |
181
- | UUID | ✔️ | string |
187
+ | Boolean | ✔️ | boolean |
188
+ | String | ✔️ | string |
189
+ | FixedString | ✔️ | string |
190
+ | UUID | ✔️ | string |
182
191
  | Date32/64 | ✔️❗- see below | string |
183
192
  | DateTime32/64 | ✔️❗- see below | string |
184
- | Enum | ✔️ | string |
185
- | LowCardinality | ✔️ | string |
186
- | Array(T) | ✔️ | Array\<JS type for T> |
187
- | JSON | ✔️ | object |
193
+ | Enum | ✔️ | string |
194
+ | LowCardinality | ✔️ | string |
195
+ | Array(T) | ✔️ | Array\<JS type for T> |
196
+ | JSON | ✔️ | object |
188
197
  | Nested | ❌ | - |
189
- | Tuple | ✔️ | Tuple |
190
- | Nullable(T) | ✔️ | JS type for T or null |
191
- | IPv4 | ✔️ | string |
192
- | IPv6 | ✔️ | string |
193
- | Point | ✔️ | [ number, number ] |
194
- | Ring | ✔️ | Array\<Point> |
195
- | Polygon | ✔️ | Array\<Ring> |
196
- | MultiPolygon | ✔️ | Array\<Polygon> |
197
- | Map(K, V) | ✔️ | Record\<JS type for K, JS type for V> |
198
+ | Tuple | ✔️ | Tuple |
199
+ | Nullable(T) | ✔️ | JS type for T or null |
200
+ | IPv4 | ✔️ | string |
201
+ | IPv6 | ✔️ | string |
202
+ | Point | ✔️ | [ number, number ] |
203
+ | Ring | ✔️ | Array\<Point> |
204
+ | Polygon | ✔️ | Array\<Ring> |
205
+ | MultiPolygon | ✔️ | Array\<Polygon> |
206
+ | Map(K, V) | ✔️ | Record\<JS type for K, JS type for V> |
198
207
 
199
208
  The entire list of supported ClickHouse formats is available [here](https://clickhouse.com/docs/en/sql-reference/data-types/).
200
209
 
@@ -245,12 +254,12 @@ class ClickHouseClient {
245
254
  }
246
255
  ```
247
256
 
248
- #### Rows response abstraction
257
+ #### ResultSet response abstraction
249
258
 
250
- Provides several convenience methods for data processing in your application.
259
+ Provides several convenience methods for data processing of select results in your application.
251
260
 
252
261
  ```ts
253
- class Rows {
262
+ class ResultSet {
254
263
  // Consume the entire stream and get the contents as a string
255
264
  // Can be used with any DataFormat
256
265
  // Should be called only once
@@ -259,17 +268,18 @@ class Rows {
259
268
  // Can be used only with JSON formats
260
269
  // Should be called only once
261
270
  json<T>(): Promise<T> {}
262
- // Returns a readable stream of Row instances for responses that can be streamed (i.e. all except JSON)
271
+ // Returns a readable stream for responses that can be streamed (i.e. all except JSON)
272
+ // Every iteration provides an array of `Row` instances
263
273
  // Should be called only once
264
274
  // NB: if called for the second time, the second stream will be just empty
265
275
  stream(): Stream.Readable {}
266
276
  }
267
277
 
268
- class Row {
269
- // Get the content of the row as plain string
270
- text(): string {}
271
- // Get the content of the row as a JS object
272
- json<T>(): T {}
278
+ interface Row {
279
+ // Get the content of an individual row as a plain string
280
+ text(): string
281
+ // Get the content of an individual row as a JS object
282
+ json<T>(): T
273
283
  }
274
284
  ```
275
285
 
@@ -359,265 +369,12 @@ class ClickHouseClient {
359
369
 
360
370
  ## Usage examples
361
371
 
362
- ### Create a table (single node)
363
-
364
- ```ts
365
- await client.exec({
366
- query: `
367
- CREATE TABLE foobar
368
- (id UInt64, name String)
369
- ENGINE MergeTree()
370
- ORDER BY (id)
371
- `,
372
- })
373
- ```
374
-
375
- ### Create a table (local cluster)
376
-
377
- ```ts
378
- await client.exec({
379
- query: `
380
- CREATE TABLE foobar ON CLUSTER '{cluster}'
381
- (id UInt64, name String)
382
- ENGINE ReplicatedMergeTree(
383
- '/clickhouse/{cluster}/tables/{database}/{table}/{shard}',
384
- '{replica}'
385
- )
386
- ORDER BY (id)
387
- `,
388
- // Recommended for cluster usage to avoid situations
389
- // where a query processing error occurred after the response code
390
- // and HTTP headers were sent to the client.
391
- // See https://clickhouse.com/docs/en/interfaces/http/#response-buffering
392
- clickhouse_settings: {
393
- wait_end_of_query: 1,
394
- },
395
- })
396
- ```
397
-
398
- ### Create a table (ClickHouse cloud)
399
-
400
- Note that `ENGINE` and `ON CLUSTER` clauses can be omitted entirely here.
401
-
402
- ClickHouse cloud will automatically use `ReplicatedMergeTree` with appropriate settings in this case.
403
-
404
- ```ts
405
- await client.exec({
406
- query: `
407
- CREATE TABLE foobar
408
- (id UInt64, name String)
409
- ORDER BY (id)
410
- `,
411
- // Recommended for cluster usage to avoid situations
412
- // where a query processing error occurred after the response code
413
- // and HTTP headers were sent to the client.
414
- // See https://clickhouse.com/docs/en/interfaces/http/#response-buffering
415
- clickhouse_settings: {
416
- wait_end_of_query: 1,
417
- },
418
- })
419
- ```
420
-
421
- ### Insert with array input (JSON\* family formats only)
422
-
423
- ```ts
424
- await client.insert({
425
- table: tableName,
426
- // structure should match the desired format, JSONEachRow in this example
427
- values: [
428
- { id: 42, name: 'foo' },
429
- { id: 42, name: 'bar' },
430
- ],
431
- format: 'JSONEachRow',
432
- })
433
- ```
434
-
435
- ### Insert with stream input (any format except JSON, stream is created out of an array)
436
-
437
- ```ts
438
- await client.insert({
439
- table: tableName,
440
- // structure should match the desired format, JSONCompactEachRow in this example
441
- values: Stream.Readable.from([
442
- [42, 'foo'],
443
- [42, 'bar'],
444
- ]),
445
- format: 'JSONCompactEachRow',
446
- })
447
- ```
448
-
449
- ### Insert with stream input (any format except JSON, flowing stream)
450
-
451
- ```ts
452
- const stream = new Stream.Readable({
453
- objectMode: true, // required for JSON* family formats
454
- read() {
455
- /* stub */
456
- },
457
- })
458
- // ... your (async) code pushing the values into the stream...
459
- await client.insert({
460
- table: tableName,
461
- values: stream,
462
- format: 'JSONEachRow', // or any other desired JSON* format
463
- })
464
- // close the stream when finished by pushing a null value there
465
- stream.push(null)
466
- ```
467
-
468
- ### Insert with stream input ("raw" formats like CSV* / TabSeparated* / CustomSeparated\*, stream is created out of an array)
469
-
470
- ```ts
471
- await client.insert({
472
- table: tableName,
473
- // structure should match the desired format, TabSeparated in this example
474
- values: Stream.Readable.from(['42,foobar'], {
475
- objectMode: false, // required for "raw" family formats
476
- }),
477
- format: 'TabSeparated', // or any other desired "raw" format
478
- })
479
- ```
480
-
481
- ### Insert with stream input ("raw" formats like CSV* / TabSeparated* / CustomSeparated\*, flowing stream)
482
-
483
- ```ts
484
- const stream = new Stream.Readable({
485
- objectMode: false, // required for "raw" family formats
486
- read() {
487
- /* stub */
488
- },
489
- })
490
- // ... your (async) code pushing the values into the stream...
491
- await client.insert({
492
- table: tableName,
493
- values: stream,
494
- format: 'TabSeparated', // or any other desired "raw" format
495
- })
496
- // close the stream when finished by pushing a null value there
497
- stream.push(null)
498
- ```
499
-
500
- ### Inserting a file (for example, CSV)
501
-
502
- ```ts
503
- const filename = Path.resolve(process.cwd(), 'path/to/file.csv')
504
- await client.insert({
505
- table: tableName,
506
- values: Fs.createReadStream(filename),
507
- format: 'CSVWithNames',
508
- })
509
- ```
372
+ You can find code samples in the [examples](./examples) folder (with [README](./examples/README.md)).
510
373
 
511
374
  See also:
512
375
 
513
- - [NDJSON file streaming example](https://github.com/ClickHouse/clickhouse-js/blob/60c484a3492420baed4b4c6c33cc0845262285e7/examples/streaming/stream_ndjson.ts)
514
376
  - [Memory leaks test using Brown University benchmarks files](https://github.com/ClickHouse/clickhouse-js/blob/60c484a3492420baed4b4c6c33cc0845262285e7/benchmarks/leaks/memory_leak_brown.ts#L72-L80)
515
377
 
516
- ### Selecting the data as JSON using a JSON\* family format
517
-
518
- ```ts
519
- const rows = await client.query({
520
- query: 'SELECT number FROM system.numbers LIMIT 5',
521
- format: 'JSONCompactEachRow',
522
- })
523
- const result = await rows.json()
524
- // result is [['0'], ['1'], ['2'], ['3'], ['4']]
525
- ```
526
-
527
- ### Selecting the data as JSON including response metadata
528
-
529
- ```ts
530
- const rows = await client.query({
531
- query: 'SELECT number FROM system.numbers LIMIT 2',
532
- format: 'JSON',
533
- })
534
- const result = await rows.json<ResponseJSON<{ number: string }>>()
535
-
536
- /* result will look like
537
-
538
- {
539
- "meta": [ { "name": "number", "type": "UInt64" } ],
540
- "data": [ { "number": "0"}, { "number": "1" } ],
541
- "rows": 2,
542
- "rows_before_limit_at_least": 2,
543
- "statistics": {
544
- "elapsed": 0.00013129,
545
- "rows_read": 2,
546
- "bytes_read": 16
547
- }
548
- }
549
-
550
- */
551
- ```
552
-
553
- ### Selecting the data as text
554
-
555
- ```ts
556
- const rows = await client.query({
557
- query: `SELECT number FROM system.numbers LIMIT 2`,
558
- format: 'CSV',
559
- })
560
- const result = await rows.text()
561
- // result is now '0\n1\n'
562
- ```
563
-
564
- ### Selecting the data as a stream
565
-
566
- ```ts
567
- const rows = await client.query({
568
- query: `SELECT * from ${tableName}`,
569
- format: 'JSONCompactEachRow',
570
- })
571
- for await (const row of rows.stream()) {
572
- const data = (row as Row).json()
573
- // ... your code processing the data here
574
- }
575
- ```
576
-
577
- ### Query with parameter binding
578
-
579
- ```ts
580
- const rows = await client.query({
581
- query: 'SELECT plus({val1: Int32}, {val2: Int32})',
582
- format: 'CSV',
583
- query_params: {
584
- val1: 10,
585
- val2: 20,
586
- },
587
- })
588
- const result = await rows.text()
589
- // result is '30\n'
590
- ```
591
-
592
- ### Query with custom ClickHouse settings
593
-
594
- ```ts
595
- await client.insert({
596
- table: tableName,
597
- values: [
598
- { id: 42, name: 'foo' },
599
- { id: 42, name: 'bar' },
600
- ],
601
- format: 'JSONEachRow',
602
- clickhouse_settings: { insert_quorum: '2' },
603
- })
604
- ```
605
-
606
- ### Abort query
607
-
608
- ```ts
609
- import { AbortController } from 'node-abort-controller'
610
-
611
- const controller = new AbortController()
612
- const selectPromise = client.query({
613
- query: 'SELECT sleep(3)',
614
- format: 'CSV',
615
- abort_signal: controller.signal as AbortSignal,
616
- })
617
- controller.abort()
618
- // selectPromise is now rejected with "The request was aborted" message
619
- ```
620
-
621
378
  ## Known limitations
622
379
 
623
380
  - Browser usage is not supported.
package/dist/client.d.ts CHANGED
@@ -2,42 +2,64 @@
2
2
  import Stream from 'stream';
3
3
  import { Logger } from './logger';
4
4
  import { type DataFormat } from './data_formatter';
5
- import { Rows } from './rows';
5
+ import { ResultSet } from './result';
6
6
  import type { ClickHouseSettings } from './settings';
7
7
  export interface ClickHouseClientConfigOptions {
8
+ /** A ClickHouse instance URL. Default value: `http://localhost:8123`. */
8
9
  host?: string;
10
+ /** The timeout to setup a connection in milliseconds. Default value: `10_000`. */
9
11
  connect_timeout?: number;
12
+ /** The request timeout in milliseconds. Default value: `30_000`. */
10
13
  request_timeout?: number;
14
+ /** Maximum number of sockets to allow per host. Default value: `Infinity`. */
11
15
  max_open_connections?: number;
12
16
  compression?: {
17
+ /** `response: true` instructs ClickHouse server to respond with compressed response body. Default: true. */
13
18
  response?: boolean;
19
+ /** `request: true` enabled compression on the client request body. Default: false. */
14
20
  request?: boolean;
15
21
  };
22
+ /** The name of the user on whose behalf requests are made. Default: 'default'. */
16
23
  username?: string;
24
+ /** The user password. Default: ''. */
17
25
  password?: string;
26
+ /** The name of the application using the nodejs client. Default: 'clickhouse-js'. */
18
27
  application?: string;
28
+ /** Database name to use. Default value: `default`. */
19
29
  database?: string;
30
+ /** ClickHouse settings to apply to all requests. Default value: {} */
20
31
  clickhouse_settings?: ClickHouseSettings;
21
32
  log?: {
33
+ /** Enable logging. Default value: false. */
22
34
  enable?: boolean;
35
+ /** A class to instantiate a custom logger implementation. */
23
36
  LoggerClass?: new (enabled: boolean) => Logger;
24
37
  };
25
38
  }
26
39
  export interface BaseParams {
40
+ /** ClickHouse settings that can be applied on query level. */
27
41
  clickhouse_settings?: ClickHouseSettings;
42
+ /** Parameters for query binding. https://clickhouse.com/docs/en/interfaces/http/#cli-queries-with-parameters */
28
43
  query_params?: Record<string, unknown>;
44
+ /** AbortSignal instance (using `node-abort-controller` package) to cancel a request in progress. */
29
45
  abort_signal?: AbortSignal;
30
46
  }
31
47
  export interface QueryParams extends BaseParams {
48
+ /** Statement to execute. */
32
49
  query: string;
50
+ /** Format of the resulting dataset. */
33
51
  format?: DataFormat;
34
52
  }
35
53
  export interface ExecParams extends BaseParams {
54
+ /** Statement to execute. */
36
55
  query: string;
37
56
  }
38
57
  export interface InsertParams<T = unknown> extends BaseParams {
58
+ /** Name of a table to insert into. */
39
59
  table: string;
60
+ /** A dataset to insert. */
40
61
  values: ReadonlyArray<T> | Stream.Readable;
62
+ /** Format of the dataset to insert. */
41
63
  format?: DataFormat;
42
64
  }
43
65
  export declare class ClickHouseClient {
@@ -46,7 +68,7 @@ export declare class ClickHouseClient {
46
68
  readonly logger: Logger;
47
69
  constructor(config?: ClickHouseClientConfigOptions);
48
70
  private getBaseParams;
49
- query(params: QueryParams): Promise<Rows>;
71
+ query(params: QueryParams): Promise<ResultSet>;
50
72
  exec(params: ExecParams): Promise<Stream.Readable>;
51
73
  insert<T>(params: InsertParams<T>): Promise<void>;
52
74
  ping(): Promise<boolean>;
package/dist/client.js CHANGED
@@ -9,7 +9,7 @@ const connection_1 = require("./connection");
9
9
  const logger_1 = require("./logger");
10
10
  const utils_1 = require("./utils");
11
11
  const data_formatter_1 = require("./data_formatter");
12
- const rows_1 = require("./rows");
12
+ const result_1 = require("./result");
13
13
  function validateConfig({ url }) {
14
14
  if (url.protocol !== 'http:' && url.protocol !== 'https:') {
15
15
  throw new Error(`Only http(s) protocol is supported, but given: [${url.protocol}]`);
@@ -88,15 +88,15 @@ class ClickHouseClient {
88
88
  var _a;
89
89
  const format = (_a = params.format) !== null && _a !== void 0 ? _a : 'JSON';
90
90
  const query = formatQuery(params.query, format);
91
- const stream = await this.connection.select({
91
+ const stream = await this.connection.query({
92
92
  query,
93
93
  ...this.getBaseParams(params),
94
94
  });
95
- return new rows_1.Rows(stream, format);
95
+ return new result_1.ResultSet(stream, format);
96
96
  }
97
97
  exec(params) {
98
98
  const query = removeSemi(params.query.trim());
99
- return this.connection.command({
99
+ return this.connection.exec({
100
100
  query,
101
101
  ...this.getBaseParams(params),
102
102
  });
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAC3B,6CAAgE;AAChE,qCAAiC;AACjC,mCAA6C;AAC7C,qDAIyB;AACzB,iCAA6B;AAgD7B,SAAS,cAAc,CAAC,EAAE,GAAG,EAAoB;IAC/C,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACzD,MAAM,IAAI,KAAK,CACb,mDAAmD,GAAG,CAAC,QAAQ,GAAG,CACnE,CAAA;KACF;IACD,0BAA0B;AAC5B,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI;QACF,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,CAAA;KACrB;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;KAC1E;AACH,CAAC;AAED,SAAS,eAAe,CACtB,MAAqC,EACrC,cAAuB;;IAEvB,OAAO;QACL,GAAG,EAAE,SAAS,CAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,uBAAuB,CAAC;QACtD,eAAe,EAAE,MAAA,MAAM,CAAC,eAAe,mCAAI,KAAM;QACjD,eAAe,EAAE,MAAA,MAAM,CAAC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E,CAAC,IAAA,2BAAU,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAClE,CAAC;AAED,SAAgB,YAAY,CAC1B,MAAsC;IAEtC,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACrC,CAAC;AAJD,oCAIC;AAED,SAAS,UAAU,CAAC,GAAiC;IACnD,IAAI,GAAG,EAAE;QACP,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;KACnB;AACH,CAAC"}
@@ -21,8 +21,8 @@ export declare abstract class BaseHttpAdapter implements Connection {
21
21
  protected abstract createClientRequest(url: URL, params: RequestParams): Http.ClientRequest;
22
22
  protected request(params: RequestParams): Promise<Stream.Readable>;
23
23
  ping(): Promise<boolean>;
24
- select(params: BaseParams): Promise<Stream.Readable>;
25
- command(params: BaseParams): Promise<Stream.Readable>;
24
+ query(params: BaseParams): Promise<Stream.Readable>;
25
+ exec(params: BaseParams): Promise<Stream.Readable>;
26
26
  insert(params: InsertParams): Promise<void>;
27
27
  close(): Promise<void>;
28
28
  private logResponse;
@@ -193,7 +193,7 @@ class BaseHttpAdapter {
193
193
  response.destroy();
194
194
  return true;
195
195
  }
196
- async select(params) {
196
+ async query(params) {
197
197
  const clickhouse_settings = withHttpSettings(params.clickhouse_settings, this.config.compression.decompress_response);
198
198
  const searchParams = (0, http_search_params_1.toSearchParams)({
199
199
  database: this.config.database,
@@ -208,7 +208,7 @@ class BaseHttpAdapter {
208
208
  decompress_response: clickhouse_settings.enable_http_compression === 1,
209
209
  });
210
210
  }
211
- async command(params) {
211
+ async exec(params) {
212
212
  const searchParams = (0, http_search_params_1.toSearchParams)({
213
213
  database: this.config.database,
214
214
  clickhouse_settings: params.clickhouse_settings,
@@ -1 +1 @@
1
- {"version":3,"file":"base_http_adapter.js","sourceRoot":"","sources":["../../../src/connection/adapter/base_http_adapter.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAE3B,gDAAuB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AC,GAAG,CAAC,QAAQ,GAC9D,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAChD,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,IAAI,CACxC,CAAA;IACH,CAAC;IAES,UAAU,CAAC,MAAqB;QACxC,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACpE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnE,CAAA;IACH,CAAC;CACF;AAhOD,0CAgOC"}
@@ -27,8 +27,8 @@ export interface InsertParams extends BaseParams {
27
27
  export interface Connection {
28
28
  ping(): Promise<boolean>;
29
29
  close(): Promise<void>;
30
- select(params: BaseParams): Promise<Stream.Readable>;
31
- command(params: BaseParams): Promise<Stream.Readable>;
30
+ query(params: BaseParams): Promise<Stream.Readable>;
31
+ exec(params: BaseParams): Promise<Stream.Readable>;
32
32
  insert(params: InsertParams): Promise<void>;
33
33
  }
34
34
  export declare function createConnection(params: ConnectionParams, logger: Logger): Connection;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ declare const _default: {
5
5
  };
6
6
  export default _default;
7
7
  export { type ClickHouseClientConfigOptions, type ClickHouseClient, type BaseParams, type QueryParams, type ExecParams, type InsertParams, } from './client';
8
- export { Row, Rows } from './rows';
8
+ export { Row, ResultSet } from './result';
9
9
  export type { Connection } from './connection';
10
10
  export type { DataFormat } from './data_formatter';
11
11
  export type { ClickHouseError } from './error';
package/dist/index.js CHANGED
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SettingsMap = exports.Rows = exports.Row = exports.createClient = void 0;
3
+ exports.SettingsMap = exports.ResultSet = exports.createClient = void 0;
4
4
  const client_1 = require("./client");
5
5
  Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } });
6
6
  exports.default = {
7
7
  createClient: client_1.createClient,
8
8
  };
9
- var rows_1 = require("./rows");
10
- Object.defineProperty(exports, "Row", { enumerable: true, get: function () { return rows_1.Row; } });
11
- Object.defineProperty(exports, "Rows", { enumerable: true, get: function () { return rows_1.Rows; } });
9
+ var result_1 = require("./result");
10
+ Object.defineProperty(exports, "ResultSet", { enumerable: true, get: function () { return result_1.ResultSet; } });
12
11
  var settings_1 = require("./settings");
13
12
  Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return settings_1.SettingsMap; } });
14
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAE9B,6FAFA,qBAAY,OAEA;AACrB,kBAAe;IACb,YAAY,EAAZ,qBAAY;CACb,CAAA;AAWD,+BAAkC;AAAzB,2FAAA,GAAG,OAAA;AAAE,4FAAA,IAAI,OAAA;AAQlB,uCAAwC;AAA/B,uGAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAE9B,6FAFA,qBAAY,OAEA;AACrB,kBAAe;IACb,YAAY,EAAZ,qBAAY;CACb,CAAA;AAWD,mCAAyC;AAA3B,mGAAA,SAAS,OAAA;AAQvB,uCAAwC;AAA/B,uGAAA,WAAW,OAAA"}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import Stream from 'stream';
3
3
  import { type DataFormat } from './data_formatter';
4
- export declare class Rows {
4
+ export declare class ResultSet {
5
5
  private _stream;
6
6
  private readonly format;
7
7
  constructor(_stream: Stream.Readable, format: DataFormat);
@@ -10,7 +10,7 @@ export declare class Rows {
10
10
  * and returns the result as a string.
11
11
  *
12
12
  * The method will throw if the underlying stream was already consumed
13
- * by calling the other methods
13
+ * by calling the other methods.
14
14
  */
15
15
  text(): Promise<string>;
16
16
  /**
@@ -18,32 +18,33 @@ export declare class Rows {
18
18
  * When the response is received in full, it will be decoded to return JSON.
19
19
  *
20
20
  * The method will throw if the underlying stream was already consumed
21
- * by calling the other methods
21
+ * by calling the other methods.
22
22
  */
23
23
  json<T>(): Promise<T>;
24
24
  /**
25
- * Returns a readable stream of {@link Row}s for responses
26
- * in {@link StreamableDataFormat} format.
25
+ * Returns a readable stream for responses that can be streamed
26
+ * (i.e. all except JSON).
27
+ *
28
+ * Every iteration provides an array of {@link Row} instances
29
+ * for {@link StreamableDataFormat} format.
30
+ *
31
+ * Should be called only once.
27
32
  *
28
33
  * The method will throw if called on a response in non-streamable format,
29
34
  * and if the underlying stream was already consumed
30
- * by calling the other methods
35
+ * by calling the other methods.
31
36
  */
32
37
  stream(): Stream.Readable;
33
38
  close(): void;
34
39
  }
35
- export declare class Row {
36
- private readonly chunk;
37
- private readonly format;
38
- constructor(chunk: string, format: DataFormat);
40
+ export interface Row {
39
41
  /**
40
- * Returns a string representation of a row.
42
+ * A string representation of a row.
41
43
  */
42
- text(): string;
44
+ text: string;
43
45
  /**
44
46
  * Returns a JSON representation of a row.
45
47
  * The method will throw if called on a response in JSON incompatible format.
46
- *
47
48
  * It is safe to call this method multiple times.
48
49
  */
49
50
  json<T>(): T;
package/dist/result.js ADDED
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ResultSet = void 0;
27
+ const stream_1 = __importStar(require("stream"));
28
+ const utils_1 = require("./utils");
29
+ const data_formatter_1 = require("./data_formatter");
30
+ class ResultSet {
31
+ constructor(_stream, format) {
32
+ Object.defineProperty(this, "_stream", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: _stream
37
+ });
38
+ Object.defineProperty(this, "format", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: format
43
+ });
44
+ }
45
+ /**
46
+ * The method waits for all the rows to be fully loaded
47
+ * and returns the result as a string.
48
+ *
49
+ * The method will throw if the underlying stream was already consumed
50
+ * by calling the other methods.
51
+ */
52
+ async text() {
53
+ if (this._stream.readableEnded) {
54
+ throw Error(streamAlreadyConsumedMessage);
55
+ }
56
+ return (await (0, utils_1.getAsText)(this._stream)).toString();
57
+ }
58
+ /**
59
+ * The method waits for the all the rows to be fully loaded.
60
+ * When the response is received in full, it will be decoded to return JSON.
61
+ *
62
+ * The method will throw if the underlying stream was already consumed
63
+ * by calling the other methods.
64
+ */
65
+ async json() {
66
+ if (this._stream.readableEnded) {
67
+ throw Error(streamAlreadyConsumedMessage);
68
+ }
69
+ return (0, data_formatter_1.decode)(await this.text(), this.format);
70
+ }
71
+ /**
72
+ * Returns a readable stream for responses that can be streamed
73
+ * (i.e. all except JSON).
74
+ *
75
+ * Every iteration provides an array of {@link Row} instances
76
+ * for {@link StreamableDataFormat} format.
77
+ *
78
+ * Should be called only once.
79
+ *
80
+ * The method will throw if called on a response in non-streamable format,
81
+ * and if the underlying stream was already consumed
82
+ * by calling the other methods.
83
+ */
84
+ stream() {
85
+ // If the underlying stream has already ended by calling `text` or `json`,
86
+ // Stream.pipeline will create a new empty stream
87
+ // but without "readableEnded" flag set to true
88
+ if (this._stream.readableEnded) {
89
+ throw Error(streamAlreadyConsumedMessage);
90
+ }
91
+ (0, data_formatter_1.validateStreamFormat)(this.format);
92
+ let decodedChunk = '';
93
+ const toRows = new stream_1.Transform({
94
+ transform(chunk, encoding, callback) {
95
+ decodedChunk += chunk.toString();
96
+ const rows = [];
97
+ // eslint-disable-next-line no-constant-condition
98
+ while (true) {
99
+ const idx = decodedChunk.indexOf('\n');
100
+ if (idx !== -1) {
101
+ const text = decodedChunk.slice(0, idx);
102
+ decodedChunk = decodedChunk.slice(idx + 1);
103
+ rows.push({
104
+ text,
105
+ json() {
106
+ return (0, data_formatter_1.decode)(text, 'JSON');
107
+ },
108
+ });
109
+ }
110
+ else {
111
+ if (rows.length) {
112
+ this.push(rows);
113
+ }
114
+ break;
115
+ }
116
+ }
117
+ callback();
118
+ },
119
+ autoDestroy: true,
120
+ objectMode: true,
121
+ });
122
+ return stream_1.default.pipeline(this._stream, toRows, function pipelineCb(err) {
123
+ if (err) {
124
+ console.error(err);
125
+ }
126
+ });
127
+ }
128
+ close() {
129
+ this._stream.destroy();
130
+ }
131
+ }
132
+ exports.ResultSet = ResultSet;
133
+ const streamAlreadyConsumedMessage = 'Stream has been already consumed';
134
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAA0C;AAE1C,mCAAmC;AACnC,qDAAgF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KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;wBACvC,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;wBAC1C,IAAI,CAAC,IAAI,CAAC;4BACR,IAAI;4BACJ,IAAI;gCACF,OAAO,IAAA,uBAAM,EAAC,IAAI,EAAE,MAAM,CAAC,CAAA;4BAC7B,CAAC;yBACF,CAAC,CAAA;qBACH;yBAAM;wBACL,IAAI,IAAI,CAAC,MAAM,EAAE;4BACf,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;yBAChB;wBACD,MAAK;qBACN;iBACF;gBACD,QAAQ,EAAE,CAAA;YACZ,CAAC;YACD,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;QAEF,OAAO,gBAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,UAAU,CAAC,GAAG;YAClE,IAAI,GAAG,EAAE;gBACP,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACnB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;IACxB,CAAC;CACF;AArGD,8BAqGC;AAgBD,MAAM,4BAA4B,GAAG,kCAAkC,CAAA"}
@@ -3,7 +3,7 @@ import type { CreateTableOptions, TableOptions } from './index';
3
3
  import type { WhereExpr } from './where';
4
4
  import type { NonEmptyArray } from './common';
5
5
  export declare const QueryFormatter: {
6
- createTable: <S extends Shape>(tableOptions: TableOptions<S>, { engine, if_not_exists, on_cluster, order_by, partition_by, primary_key, settings, }: CreateTableOptions<S>) => string;
6
+ createTable: <S extends Shape>(tableOptions: TableOptions<S>, { engine: _engine, if_not_exists, on_cluster, order_by, partition_by, primary_key, settings: _settings, }: CreateTableOptions<S>) => string;
7
7
  select: <S_1 extends Shape>(tableOptions: TableOptions<S_1>, whereExpr?: WhereExpr<S_1> | undefined, columns?: NonEmptyArray<keyof S_1> | undefined, orderBy?: NonEmptyArray<[keyof S_1, "ASC" | "DESC"]> | undefined) => string;
8
8
  };
9
9
  export declare function getTableName<S extends Shape>({ database, name, }: TableOptions<S>): string;
@@ -36,17 +36,19 @@ class Table {
36
36
  }
37
37
  async select({ abort_signal, clickhouse_settings, columns, order_by, where, } = {}) {
38
38
  const query = query_formatter_1.QueryFormatter.select(this.options, where, columns, order_by);
39
- const rows = await this.client.query({
39
+ const rs = await this.client.query({
40
40
  query,
41
41
  clickhouse_settings,
42
42
  abort_signal,
43
43
  format: 'JSONEachRow',
44
44
  });
45
- const stream = rows.stream();
45
+ const stream = rs.stream();
46
46
  async function* asyncGenerator() {
47
- for await (const row of stream) {
48
- const value = row.json();
49
- yield value;
47
+ for await (const rows of stream) {
48
+ for (const row of rows) {
49
+ const value = row.json();
50
+ yield value;
51
+ }
50
52
  }
51
53
  }
52
54
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/schema/table.ts"],"names":[],"mappings":";;;AAGA,uDAAgE;AA6ChE,MAAa,KAAK;IAChB,YACmB,MAAwB,EACxB,OAAwB;;;;;mBADxB;;;;;;mBACA;;IAChB,CAAC;IAEJ,qBAAqB;IACrB,KAAK,CAAC,MAAM,CAAC,OAA8B;QACzC,MAAM,KAAK,GAAG,gCAAc,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACtB,KAAK;YACL,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;SACjD,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAC,EACL,YAAY,EACZ,mBAAmB,EACnB,MAAM,GACW;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YACxB,mBAAmB;YACnB,YAAY;YACZ,KAAK,EAAE,IAAA,8BAAY,EAAC,IAAI,CAAC,O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QACH,CAAC;QAED,OAAO;YACL,cAAc;YACd,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,MAAM,MAAM,GAAG,EAAE,CAAA;gBACjB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,cAAc,EAAE,EAAE;oBAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;wBACxB,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;qBACtB;yBAAM;wBACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;qBACnB;iBACF;gBACD,OAAO,MAAM,CAAA;YACf,CAAC;SACF,CAAA;IACH,CAAC;CACF;AArED,sBAqEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/client",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "description": "Official JS client for ClickHouse DB",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -12,6 +12,11 @@
12
12
  "node": ">=14"
13
13
  },
14
14
  "private": false,
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/ClickHouse/clickhouse-js.git"
18
+ },
19
+ "homepage": "https://clickhouse.com",
15
20
  "scripts": {
16
21
  "build": "rm -rf dist; tsc",
17
22
  "build:all": "rm -rf dist; tsc --project tsconfig.dev.json",
@@ -31,8 +36,7 @@
31
36
  "dist"
32
37
  ],
33
38
  "dependencies": {
34
- "node-abort-controller": "^3.0.1",
35
- "split2": "^4.1.0"
39
+ "node-abort-controller": "^3.0.1"
36
40
  },
37
41
  "devDependencies": {
38
42
  "@types/jest": "^29.0.2",
@@ -49,8 +53,10 @@
49
53
  "jest-silent-reporter": "^0.5.0",
50
54
  "lint-staged": "^13.0.3",
51
55
  "prettier": "2.7.1",
56
+ "split2": "^4.1.0",
52
57
  "ts-jest": "^29.0.1",
53
- "ts-loader": "^9.3.1",
58
+ "ts-node": "^10.9.1",
59
+ "tsconfig-paths": "^4.1.0",
54
60
  "typescript": "^4.8.3",
55
61
  "uuid": "^9.0.0"
56
62
  },
package/dist/rows.js DELETED
@@ -1,114 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Row = exports.Rows = void 0;
7
- const stream_1 = __importDefault(require("stream"));
8
- const split2_1 = __importDefault(require("split2"));
9
- const utils_1 = require("./utils");
10
- const data_formatter_1 = require("./data_formatter");
11
- class Rows {
12
- constructor(_stream, format) {
13
- Object.defineProperty(this, "_stream", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: _stream
18
- });
19
- Object.defineProperty(this, "format", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: format
24
- });
25
- }
26
- /**
27
- * The method waits for all the rows to be fully loaded
28
- * and returns the result as a string.
29
- *
30
- * The method will throw if the underlying stream was already consumed
31
- * by calling the other methods
32
- */
33
- async text() {
34
- if (this._stream.readableEnded) {
35
- throw Error(streamAlreadyConsumedMessage);
36
- }
37
- return (await (0, utils_1.getAsText)(this._stream)).toString();
38
- }
39
- /**
40
- * The method waits for the all the rows to be fully loaded.
41
- * When the response is received in full, it will be decoded to return JSON.
42
- *
43
- * The method will throw if the underlying stream was already consumed
44
- * by calling the other methods
45
- */
46
- async json() {
47
- if (this._stream.readableEnded) {
48
- throw Error(streamAlreadyConsumedMessage);
49
- }
50
- return (0, data_formatter_1.decode)(await this.text(), this.format);
51
- }
52
- /**
53
- * Returns a readable stream of {@link Row}s for responses
54
- * in {@link StreamableDataFormat} format.
55
- *
56
- * The method will throw if called on a response in non-streamable format,
57
- * and if the underlying stream was already consumed
58
- * by calling the other methods
59
- */
60
- stream() {
61
- // If the underlying stream has already ended by calling `text` or `json`,
62
- // Stream.pipeline will create a new empty stream
63
- // but without "readableEnded" flag set to true
64
- if (this._stream.readableEnded) {
65
- throw Error(streamAlreadyConsumedMessage);
66
- }
67
- (0, data_formatter_1.validateStreamFormat)(this.format);
68
- return stream_1.default.pipeline(this._stream,
69
- // only JSON-based format are supported at the moment
70
- (0, split2_1.default)((row) => new Row(row, 'JSON')), function pipelineCb(err) {
71
- if (err) {
72
- console.error(err);
73
- }
74
- });
75
- }
76
- close() {
77
- this._stream.destroy();
78
- }
79
- }
80
- exports.Rows = Rows;
81
- class Row {
82
- constructor(chunk, format) {
83
- Object.defineProperty(this, "chunk", {
84
- enumerable: true,
85
- configurable: true,
86
- writable: true,
87
- value: chunk
88
- });
89
- Object.defineProperty(this, "format", {
90
- enumerable: true,
91
- configurable: true,
92
- writable: true,
93
- value: format
94
- });
95
- }
96
- /**
97
- * Returns a string representation of a row.
98
- */
99
- text() {
100
- return this.chunk;
101
- }
102
- /**
103
- * Returns a JSON representation of a row.
104
- * The method will throw if called on a response in JSON incompatible format.
105
- *
106
- * It is safe to call this method multiple times.
107
- */
108
- json() {
109
- return (0, data_formatter_1.decode)(this.text(), this.format);
110
- }
111
- }
112
- exports.Row = Row;
113
- const streamAlreadyConsumedMessage = 'Stream has been already consumed';
114
- //# sourceMappingURL=rows.js.map
package/dist/rows.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"rows.js","sourceRoot":"","sources":["../src/rows.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAC3B,oDAA0B;AAE1B,mCAAmC;AACnC,qDAAgF;AAEhF,MAAa,IAAI;IACf,YACU,OAAwB,EACf,MAAkB;;;;;mBAD3B;;;;;;mBACS;;IAChB,CAAC;IAEJ;;;;;;OAMG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;YAC9B,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,MAAM,IAAA,iBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IACnD,CAAC;IAED;;;;;;OAMG;IAC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
1
- import type { Infer, Shape } from './common';
2
- export declare function compactJson<S extends Shape>(shape: S, value: Infer<S>): Infer<S>[Extract<keyof S, string>][];
3
- export declare function decompactJson<S extends Shape>(shape: S, [row]: [unknown[]]): Infer<S>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decompactJson = exports.compactJson = void 0;
4
- function compactJson(shape, value) {
5
- const compacted = [];
6
- for (const key in shape) {
7
- if (key in value) {
8
- compacted.push(value[key]);
9
- }
10
- }
11
- return compacted;
12
- }
13
- exports.compactJson = compactJson;
14
- function decompactJson(shape, [row]) {
15
- const obj = {};
16
- let i = 0;
17
- for (const key in shape) {
18
- obj[key] = row[i];
19
- i++;
20
- }
21
- return obj;
22
- }
23
- exports.decompactJson = decompactJson;
24
- //# sourceMappingURL=compact.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/schema/compact.ts"],"names":[],"mappings":";;;AAEA,SAAgB,WAAW,CAAkB,KAAQ,EAAE,KAAe;IACpE,MAAM,SAAS,GAAG,EAAE,CAAA;IACpB,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,IAAI,GAAG,IAAI,KAAK,EAAE;YAChB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;SAC3B;KACF;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AARD,kCAQC;AAED,SAAgB,aAAa,CAAkB,KAAQ,EAAE,CAAC,GAAG,CAAc;IACzE,MAAM,GAAG,GAA4B,EAAE,CAAA;IACvC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC,EAAE,CAAA;KACJ;IACD,OAAO,GAAe,CAAA;AACxB,CAAC;AARD,sCAQC"}