@clickhouse/client-common 1.16.0 → 1.17.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.
- package/dist/clickhouse_types.d.ts +3 -0
- package/dist/clickhouse_types.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/connection.d.ts +6 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/settings.d.ts +5 -2
- package/dist/settings.js.map +1 -1
- package/dist/utils/stream.d.ts +2 -1
- package/dist/utils/stream.js +27 -30
- package/dist/utils/stream.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -42,6 +42,9 @@ export interface WithClickHouseSummary {
|
|
|
42
42
|
export interface WithResponseHeaders {
|
|
43
43
|
response_headers: ResponseHeaders;
|
|
44
44
|
}
|
|
45
|
+
export interface WithHttpStatusCode {
|
|
46
|
+
http_status_code?: number;
|
|
47
|
+
}
|
|
45
48
|
export interface ClickHouseProgress {
|
|
46
49
|
read_rows: string;
|
|
47
50
|
read_bytes: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clickhouse_types.js","sourceRoot":"","sources":["../src/clickhouse_types.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"clickhouse_types.js","sourceRoot":"","sources":["../src/clickhouse_types.ts"],"names":[],"mappings":";;AAyFA,sCAOC;AAID,sBAOC;AAID,kCAOC;AA/BD;kFACkF;AAClF,SAAgB,aAAa,CAAC,GAAY;IACxC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,UAAU,IAAI,GAAG;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC9B,CAAA;AACH,CAAC;AAED;kFACkF;AAClF,SAAgB,KAAK,CAAI,GAAY;IACnC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,KAAK,IAAI,GAAG;QACZ,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC9B,CAAA;AACH,CAAC;AAED;kFACkF;AAClF,SAAgB,WAAW,CAAC,GAAY;IACtC,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,WAAW,IAAI,GAAG;QAClB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAC9B,CAAA;AACH,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseClickHouseClientConfigOptions, ClickHouseSettings, ConnExecResult, IsSame, WithClickHouseSummary, WithResponseHeaders } from './index';
|
|
2
2
|
import { type DataFormat } from './index';
|
|
3
|
-
import type { InsertValues, NonEmptyArray } from './clickhouse_types';
|
|
3
|
+
import type { InsertValues, NonEmptyArray, WithHttpStatusCode } from './clickhouse_types';
|
|
4
4
|
import type { ImplementationDetails } from './config';
|
|
5
5
|
import type { ConnPingResult } from './connection';
|
|
6
6
|
import type { BaseResultSet } from './result';
|
|
@@ -84,7 +84,7 @@ export type ExecParamsWithValues<Stream> = ExecParams & {
|
|
|
84
84
|
export type CommandParams = ExecParams;
|
|
85
85
|
export type CommandResult = {
|
|
86
86
|
query_id: string;
|
|
87
|
-
} & WithClickHouseSummary & WithResponseHeaders;
|
|
87
|
+
} & WithClickHouseSummary & WithResponseHeaders & WithHttpStatusCode;
|
|
88
88
|
export type InsertResult = {
|
|
89
89
|
/**
|
|
90
90
|
* Indicates whether the INSERT statement was executed on the server.
|
|
@@ -98,7 +98,7 @@ export type InsertResult = {
|
|
|
98
98
|
* Otherwise, either {@link InsertParams.query_id} if it was set, or the id that was generated by the client.
|
|
99
99
|
*/
|
|
100
100
|
query_id: string;
|
|
101
|
-
} & WithClickHouseSummary & WithResponseHeaders;
|
|
101
|
+
} & WithClickHouseSummary & WithResponseHeaders & WithHttpStatusCode;
|
|
102
102
|
export type ExecResult<Stream> = ConnExecResult<Stream>;
|
|
103
103
|
/** {@link except} field contains a non-empty list of columns to exclude when generating `(* EXCEPT (...))` clause */
|
|
104
104
|
export interface InsertColumnsExcept {
|
package/dist/client.js
CHANGED
|
@@ -117,8 +117,10 @@ class ClickHouseClient {
|
|
|
117
117
|
*/
|
|
118
118
|
async command(params) {
|
|
119
119
|
const query = removeTrailingSemi(params.query.trim());
|
|
120
|
+
const ignore_error_response = params.ignore_error_response ?? false;
|
|
120
121
|
return await this.connection.command({
|
|
121
122
|
query,
|
|
123
|
+
ignore_error_response,
|
|
122
124
|
...this.withClientQueryParams(params),
|
|
123
125
|
});
|
|
124
126
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAYA,mCAA6E;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAYA,mCAA6E;AAO7E,qCAAoE;AAkKpE,MAAa,gBAAgB;IAW3B,YACE,MAAyE;QAX1D;;;;;WAA4C;QAC5C;;;;;WAAkC;QAClC;;;;;WAA8B;QAC9B;;;;;WAAoC;QACpC;;;;;WAAoC;QACpC;;;;;WAAkB;QAClB;;;;;WAA6B;QAC7B;;;;;WAAoB;QACpB;;;;;WAA0B;QAKzC,MAAM,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,WAAW;YACrC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE;YAC9B,CAAC,CAAC,IAAI,qBAAa,EAAE,CAAA;QACvB,MAAM,aAAa,GAAG,IAAA,6BAAoB,EACxC,MAAM,EACN,MAAM,EACN,MAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,IA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AS;QACjB,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,8CAA8C;QAC9C,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CACpD,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CACrB,MAAuB,EACvB,MAAkB;IAElB,IAAI,WAAW,GAAG,EAAE,CAAA;IACpB,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/D,WAAW,GAAG,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;QACjD,CAAC;aAAM,IACL,qBAAqB,CAAC,MAAM,CAAC,OAAO,CAAC;YACrC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAChC,CAAC;YACD,WAAW,GAAG,eAAe,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;QACnE,CAAC;IACH,CAAC;IACD,OAAO,eAAe,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,WAAW,WAAW,MAAM,EAAE,CAAA;AAC5E,CAAC"}
|
package/dist/connection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSONHandling } from '.';
|
|
2
|
-
import type { WithClickHouseSummary, WithResponseHeaders } from './clickhouse_types';
|
|
2
|
+
import type { WithClickHouseSummary, WithHttpStatusCode, WithResponseHeaders } from './clickhouse_types';
|
|
3
3
|
import type { LogWriter } from './logger';
|
|
4
4
|
import type { ClickHouseSettings } from './settings';
|
|
5
5
|
export type ConnectionAuth = {
|
|
@@ -49,6 +49,9 @@ export interface ConnBaseQueryParams {
|
|
|
49
49
|
export type ConnPingParams = {
|
|
50
50
|
select: boolean;
|
|
51
51
|
} & Omit<ConnBaseQueryParams, 'query' | 'query_params'>;
|
|
52
|
+
export interface ConnCommandParams extends ConnBaseQueryParams {
|
|
53
|
+
ignore_error_response?: boolean;
|
|
54
|
+
}
|
|
52
55
|
export interface ConnInsertParams<Stream> extends ConnBaseQueryParams {
|
|
53
56
|
values: string | Stream;
|
|
54
57
|
}
|
|
@@ -57,7 +60,7 @@ export interface ConnExecParams<Stream> extends ConnBaseQueryParams {
|
|
|
57
60
|
decompress_response_stream?: boolean;
|
|
58
61
|
ignore_error_response?: boolean;
|
|
59
62
|
}
|
|
60
|
-
export interface ConnBaseResult extends WithResponseHeaders {
|
|
63
|
+
export interface ConnBaseResult extends WithResponseHeaders, WithHttpStatusCode {
|
|
61
64
|
query_id: string;
|
|
62
65
|
}
|
|
63
66
|
export interface ConnQueryResult<Stream> extends ConnBaseResult {
|
|
@@ -78,7 +81,7 @@ export interface Connection<Stream> {
|
|
|
78
81
|
ping(params: ConnPingParams): Promise<ConnPingResult>;
|
|
79
82
|
query(params: ConnBaseQueryParams): Promise<ConnQueryResult<Stream>>;
|
|
80
83
|
insert(params: ConnInsertParams<Stream>): Promise<ConnInsertResult>;
|
|
81
|
-
command(params:
|
|
84
|
+
command(params: ConnCommandParams): Promise<ConnCommandResult>;
|
|
82
85
|
exec(params: ConnExecParams<Stream>): Promise<ConnExecResult<Stream>>;
|
|
83
86
|
close(): Promise<void>;
|
|
84
87
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { SimpleColumnTypes, parseColumnType, defaultJSONHandling, } from './pars
|
|
|
14
14
|
/** For implementation usage only - should not be re-exported */
|
|
15
15
|
export { formatQuerySettings, formatQueryParams, encodeJSON, isSupportedRawFormat, isStreamableJSONFamily, isNotStreamableJSONFamily, validateStreamFormat, } from './data_formatter';
|
|
16
16
|
export { type ValuesEncoder, type MakeResultSet, type MakeConnection, type HandleImplSpecificURLParams, type ImplementationDetails, booleanConfigURLValue, enumConfigURLValue, getConnectionParams, numberConfigURLValue, } from './config';
|
|
17
|
-
export { EXCEPTION_TAG_HEADER_NAME, isSuccessfulResponse, sleep, toSearchParams, transformUrl, withCompressionHeaders, withHttpSettings, isCredentialsAuth, isJWTAuth,
|
|
17
|
+
export { EXCEPTION_TAG_HEADER_NAME, isSuccessfulResponse, sleep, toSearchParams, transformUrl, withCompressionHeaders, withHttpSettings, isCredentialsAuth, isJWTAuth, extractErrorAtTheEndOfChunk, CARET_RETURN, } from './utils';
|
|
18
18
|
export { LogWriter, DefaultLogger, type LogWriterParams } from './logger';
|
|
19
19
|
export { getCurrentStackTrace, enhanceStackTrace } from './error';
|
|
20
20
|
export type { CompressionSettings, Connection, ConnectionParams, ConnInsertResult, ConnExecParams, ConnExecResult, ConnQueryResult, ConnBaseQueryParams, ConnBaseResult, ConnInsertParams, ConnPingResult, ConnCommandResult, ConnOperation, ConnPingParams, } from './connection';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enhanceStackTrace = exports.getCurrentStackTrace = exports.DefaultLogger = exports.LogWriter = exports.
|
|
3
|
+
exports.enhanceStackTrace = exports.getCurrentStackTrace = exports.DefaultLogger = exports.LogWriter = exports.CARET_RETURN = exports.extractErrorAtTheEndOfChunk = exports.isJWTAuth = exports.isCredentialsAuth = exports.withHttpSettings = exports.withCompressionHeaders = exports.transformUrl = exports.toSearchParams = exports.sleep = exports.isSuccessfulResponse = exports.EXCEPTION_TAG_HEADER_NAME = exports.numberConfigURLValue = exports.getConnectionParams = exports.enumConfigURLValue = exports.booleanConfigURLValue = exports.validateStreamFormat = exports.isNotStreamableJSONFamily = exports.isStreamableJSONFamily = exports.isSupportedRawFormat = exports.encodeJSON = exports.formatQueryParams = exports.formatQuerySettings = exports.defaultJSONHandling = exports.parseColumnType = exports.SimpleColumnTypes = exports.SettingsMap = exports.isException = exports.isRow = exports.isProgressRow = exports.ClickHouseLogLevel = exports.parseError = exports.ClickHouseError = exports.TupleParam = exports.ClickHouseClient = void 0;
|
|
4
4
|
/** Should be re-exported by the implementation */
|
|
5
5
|
var client_1 = require("./client");
|
|
6
6
|
Object.defineProperty(exports, "ClickHouseClient", { enumerable: true, get: function () { return client_1.ClickHouseClient; } });
|
|
@@ -45,7 +45,8 @@ Object.defineProperty(exports, "withCompressionHeaders", { enumerable: true, get
|
|
|
45
45
|
Object.defineProperty(exports, "withHttpSettings", { enumerable: true, get: function () { return utils_1.withHttpSettings; } });
|
|
46
46
|
Object.defineProperty(exports, "isCredentialsAuth", { enumerable: true, get: function () { return utils_1.isCredentialsAuth; } });
|
|
47
47
|
Object.defineProperty(exports, "isJWTAuth", { enumerable: true, get: function () { return utils_1.isJWTAuth; } });
|
|
48
|
-
Object.defineProperty(exports, "
|
|
48
|
+
Object.defineProperty(exports, "extractErrorAtTheEndOfChunk", { enumerable: true, get: function () { return utils_1.extractErrorAtTheEndOfChunk; } });
|
|
49
|
+
Object.defineProperty(exports, "CARET_RETURN", { enumerable: true, get: function () { return utils_1.CARET_RETURN; } });
|
|
49
50
|
var logger_2 = require("./logger");
|
|
50
51
|
Object.defineProperty(exports, "LogWriter", { enumerable: true, get: function () { return logger_2.LogWriter; } });
|
|
51
52
|
Object.defineProperty(exports, "DefaultLogger", { enumerable: true, get: function () { return logger_2.DefaultLogger; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,mCAeiB;AATf,0GAAA,gBAAgB,OAAA;AAiClB,mDAA6C;AAApC,4GAAA,UAAU,OAAA;AACnB,iCAAqD;AAA5C,wGAAA,eAAe,OAAA;AAAE,mGAAA,UAAU,OAAA;AACpC,mCAMiB;AALf,4GAAA,kBAAkB,OAAA;AAoBpB,uDAAsE;AAA7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AACtB,2HAAA,yBAAyB,OAAA;AACzB,sHAAA,oBAAoB,OAAA;AAEtB,mCAUiB;AAJf,+GAAA,qBAAqB,OAAA;AACrB,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,8GAAA,oBAAoB,OAAA;AAEtB,iCAYgB;AAXd,kHAAA,yBAAyB,OAAA;AACzB,6GAAA,oBAAoB,OAAA;AACpB,8FAAA,KAAK,OAAA;AACL,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,+GAAA,sBAAsB,OAAA;AACtB,yGAAA,gBAAgB,OAAA;AAChB,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AACT,oHAAA,2BAA2B,OAAA;AAC3B,qGAAA,YAAY,OAAA;AAEd,mCAAyE;AAAhE,mGAAA,SAAS,OAAA;AAAE,uGAAA,aAAa,OAAA;AACjC,iCAAiE;AAAxD,6GAAA,oBAAoB,OAAA;AAAE,0GAAA,iBAAiB,OAAA"}
|
package/dist/settings.d.ts
CHANGED
|
@@ -130,8 +130,11 @@ interface ClickHouseServerSettings {
|
|
|
130
130
|
asterisk_include_materialized_columns?: Bool;
|
|
131
131
|
/** If true, data from INSERT query is stored in queue and later flushed to table in background. If wait_for_async_insert is false, INSERT query is processed almost instantly, otherwise client will wait until data will be flushed to table */
|
|
132
132
|
async_insert?: Bool;
|
|
133
|
-
/** Maximum time to wait before dumping collected data per query since the first data appeared
|
|
134
|
-
|
|
133
|
+
/** Maximum time to wait before dumping collected data per query since the first data appeared.
|
|
134
|
+
*
|
|
135
|
+
* @see https://clickhouse.com/docs/operations/settings/settings#async_insert_busy_timeout_max_ms
|
|
136
|
+
*/
|
|
137
|
+
async_insert_busy_timeout_max_ms?: Milliseconds;
|
|
135
138
|
/** For async INSERT queries in the replicated table, specifies that deduplication of insertings blocks should be performed */
|
|
136
139
|
async_insert_deduplicate?: Bool;
|
|
137
140
|
/** Maximum size in bytes of unparsed data collected per query before being inserted */
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AA85DA,MAAa,WAAW;IACtB,YAAqC,MAA8B;QAA/C;;;;mBAAiB,MAAM;WAAwB;IAAG,CAAC;IAEvE,QAAQ;QACN,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;CACF;AAZD,kCAYC"}
|
package/dist/utils/stream.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const CARET_RETURN: 13;
|
|
1
2
|
/**
|
|
2
3
|
* After 25.11, a newline error character is preceded by a caret return
|
|
3
4
|
* this is a strong indication that we have an exception in the stream.
|
|
@@ -11,4 +12,4 @@
|
|
|
11
12
|
* In this case, the exception length is 5 (including the newline character),
|
|
12
13
|
* and the exception message is "boom".
|
|
13
14
|
*/
|
|
14
|
-
export declare function
|
|
15
|
+
export declare function extractErrorAtTheEndOfChunk(chunk: Uint8Array, exceptionTag: string): Error;
|
package/dist/utils/stream.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CARET_RETURN = void 0;
|
|
4
|
+
exports.extractErrorAtTheEndOfChunk = extractErrorAtTheEndOfChunk;
|
|
4
5
|
const error_1 = require("../error");
|
|
5
6
|
const EXCEPTION_MARKER = '__exception__';
|
|
6
7
|
const NEWLINE = 0x0a;
|
|
7
|
-
|
|
8
|
+
exports.CARET_RETURN = 0x0d;
|
|
8
9
|
/**
|
|
9
10
|
* After 25.11, a newline error character is preceded by a caret return
|
|
10
11
|
* this is a strong indication that we have an exception in the stream.
|
|
@@ -18,36 +19,32 @@ const CARET_RETURN = 0x0d;
|
|
|
18
19
|
* In this case, the exception length is 5 (including the newline character),
|
|
19
20
|
* and the exception message is "boom".
|
|
20
21
|
*/
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
2; // \r\n
|
|
32
|
-
let errMsgLenStartIdx = chunk.length - bytesCountAfterErrLenHint;
|
|
33
|
-
if (errMsgLenStartIdx < 1) {
|
|
34
|
-
return new Error('there was an error in the stream, but the last chunk is malformed');
|
|
35
|
-
}
|
|
36
|
-
do {
|
|
37
|
-
--errMsgLenStartIdx;
|
|
38
|
-
} while (chunk[errMsgLenStartIdx] !== NEWLINE);
|
|
39
|
-
const errMsgLen = parseInt(textDecoder.decode(chunk.subarray(errMsgLenStartIdx, -bytesCountAfterErrLenHint)));
|
|
40
|
-
if (isNaN(errMsgLen) || errMsgLen <= 0) {
|
|
41
|
-
return new Error('there was an error in the stream; failed to parse the message length');
|
|
42
|
-
}
|
|
43
|
-
const errMsg = textDecoder.decode(chunk.subarray(errMsgLenStartIdx - errMsgLen + 1, // skipping the newline character
|
|
44
|
-
errMsgLenStartIdx));
|
|
45
|
-
return (0, error_1.parseError)(errMsg);
|
|
22
|
+
function extractErrorAtTheEndOfChunk(chunk, exceptionTag) {
|
|
23
|
+
try {
|
|
24
|
+
const bytesCountAfterErrLenHint = 1 + // space
|
|
25
|
+
EXCEPTION_MARKER.length + // __exception__
|
|
26
|
+
2 + // \r\n
|
|
27
|
+
exceptionTag.length + // <value taken from the header>
|
|
28
|
+
2; // \r\n
|
|
29
|
+
let errMsgLenStartIdx = chunk.length - bytesCountAfterErrLenHint;
|
|
30
|
+
if (errMsgLenStartIdx < 1) {
|
|
31
|
+
return new Error('there was an error in the stream, but the last chunk is malformed');
|
|
46
32
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
do {
|
|
34
|
+
--errMsgLenStartIdx;
|
|
35
|
+
} while (chunk[errMsgLenStartIdx] !== NEWLINE);
|
|
36
|
+
const textDecoder = new TextDecoder('utf-8');
|
|
37
|
+
const errMsgLen = parseInt(textDecoder.decode(chunk.subarray(errMsgLenStartIdx, -bytesCountAfterErrLenHint)));
|
|
38
|
+
if (isNaN(errMsgLen) || errMsgLen <= 0) {
|
|
39
|
+
return new Error('there was an error in the stream; failed to parse the message length');
|
|
50
40
|
}
|
|
41
|
+
const errMsg = textDecoder.decode(chunk.subarray(errMsgLenStartIdx - errMsgLen + 1, // skipping the newline character
|
|
42
|
+
errMsgLenStartIdx));
|
|
43
|
+
return (0, error_1.parseError)(errMsg);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
// theoretically, it can happen if a proxy cuts the last chunk
|
|
47
|
+
return err;
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
//# sourceMappingURL=stream.js.map
|
package/dist/utils/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/utils/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/utils/stream.ts"],"names":[],"mappings":";;;AAoBA,kEAiDC;AArED,oCAAqC;AAErC,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAExC,MAAM,OAAO,GAAG,IAAa,CAAA;AAChB,QAAA,YAAY,GAAG,IAAa,CAAA;AAEzC;;;;;;;;;;;;GAYG;AACH,SAAgB,2BAA2B,CACzC,KAAiB,E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
2
2
|
export default _default;
|
package/dist/version.js
CHANGED
package/package.json
CHANGED