@clickhouse/client 0.0.13 → 0.0.14

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.
@@ -1,4 +1,4 @@
1
- declare const supportedJSONFormats: readonly ["JSON", "JSONObjectEachRow", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
1
+ declare const supportedJSONFormats: readonly ["JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata", "JSONObjectEachRow", "JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes"];
2
2
  declare const supportedRawFormats: readonly ["CSV", "CSVWithNames", "CSVWithNamesAndTypes", "TabSeparated", "TabSeparatedRaw", "TabSeparatedWithNames", "TabSeparatedWithNamesAndTypes", "CustomSeparated", "CustomSeparatedWithNames", "CustomSeparatedWithNamesAndTypes"];
3
3
  export type JSONDataFormat = (typeof supportedJSONFormats)[number];
4
4
  export type RawDataFormat = (typeof supportedRawFormats)[number];
@@ -11,9 +11,16 @@ const streamableJSONFormats = [
11
11
  'JSONCompactStringsEachRowWithNames',
12
12
  'JSONCompactStringsEachRowWithNamesAndTypes',
13
13
  ];
14
- const supportedJSONFormats = [
14
+ const singleDocumentJSONFormats = [
15
15
  'JSON',
16
+ 'JSONStrings',
17
+ 'JSONCompact',
18
+ 'JSONCompactStrings',
19
+ 'JSONColumnsWithMetadata',
16
20
  'JSONObjectEachRow',
21
+ ];
22
+ const supportedJSONFormats = [
23
+ ...singleDocumentJSONFormats,
17
24
  ...streamableJSONFormats,
18
25
  ];
19
26
  const supportedRawFormats = [
@@ -33,6 +40,10 @@ const streamableFormat = [
33
40
  ...streamableJSONFormats,
34
41
  ...supportedRawFormats,
35
42
  ];
43
+ function isNotStreamableJSONFamily(format) {
44
+ // @ts-expect-error JSON is not assignable to notStreamableJSONFormats
45
+ return singleDocumentJSONFormats.includes(format);
46
+ }
36
47
  function isStreamableJSONFamily(format) {
37
48
  // @ts-expect-error JSON is not assignable to streamableJSONFormats
38
49
  return streamableJSONFormats.includes(format);
@@ -54,7 +65,7 @@ exports.validateStreamFormat = validateStreamFormat;
54
65
  * @param format One of the supported formats: https://clickhouse.com/docs/en/interfaces/formats/
55
66
  */
56
67
  function decode(text, format) {
57
- if (format === 'JSON') {
68
+ if (isNotStreamableJSONFamily(format)) {
58
69
  return JSON.parse(text);
59
70
  }
60
71
  if (isStreamableJSONFamily(format)) {
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/data_formatter/formatter.ts"],"names":[],"mappings":";;;AAAA,MAAM,qBAAqB,GAAG;IAC5B,aAAa;IACb,oBAAoB;IACpB,oBAAoB;IACpB,2BAA2B;IAC3B,6BAA6B;IAC7B,qCAAqC;IACrC,oCAAoC;IACpC,4CAA4C;CACpC,CAAA;AACV,MAAM,oBAAoB,GAAG;IAC3B,MAAM;IACN,mBAAmB;IACnB,GAAG,qBAAqB;CAChB,CAAA;AACV,MAAM,mBAAmB,GAAG;IAC1B,KAAK;IACL,cAAc;IACd,sBAAsB;IACtB,cAAc;IACd,iBAAiB;IACjB,uBAAuB;IACvB,+BAA+B;IAC/B,iBAAiB;IACjB,0BAA0B;IAC1B,kCAAkC;CAC1B,CAAA;AAQV,0BAA0B;AAC1B,MAAM,gBAAgB,GAAG;IACvB,GAAG,qBAAqB;IACxB,GAAG,mBAAmB;CACd,CAAA;AAGV,SAAS,sBAAsB,CAC7B,MAAkB;IAElB,mEAAmE;IACnE,OAAO,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAC/C,CAAC;AAED,SAAgB,oBAAoB,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,OAAO,IAAI,CAAA;AACb,CAAC;AAXD,oDAWC;AAED;;;;GAIG;AACH,SAAgB,MAAM,CAAC,IAAY,EAAE,MAAkB;IACrD,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;KACxB;IACD,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAE;QAClC,OAAO,IAAI;aACR,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;KACjC;IACD,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,iBAAiB,MAAM,UAAU,CAAC,CAAA;KACnD;IACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,oBAAoB,CAAC,CAAA;AAC7E,CAAC;AAdD,wBAcC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,KAAU,EAAE,MAAkB;IACvD,IAAK,oBAA0C,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;KACpC;IACD,MAAM,IAAI,KAAK,CACb,iDAAiD,MAAM,WAAW,CACnE,CAAA;AACH,CAAC;AAPD,gCAOC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "0.0.13";
1
+ declare const _default: "0.0.14";
2
2
  export default _default;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '0.0.13';
3
+ exports.default = '0.0.14';
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/client",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Official JS client for ClickHouse DB",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [