@lightdash/warehouses 2.540.0 → 2.542.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrinoWarehouseClient.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/TrinoWarehouseClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,sBAAsB,EAGtB,MAAM,EAIN,mBAAmB,EACnB,gBAAgB,EAGhB,gBAAgB,EAChB,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEH,iBAAiB,EAKpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAO5C,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAiBhE,oBAAY,UAAU;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,wBAAwB;IAC/B,SAAS,cAAc;IACvB,YAAY,6BAA6B;IACzC,mBAAmB,2BAA2B;IAC9C,iBAAiB,2BAA2B;IAC5C,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,SAAS,cAAc;IACvB,IAAI,SAAS;CAChB;AAED,UAAU,SAAS;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"TrinoWarehouseClient.d.ts","sourceRoot":"","sources":["../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,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CA2B3B;IAEK,YAAY;;;;;SAqBjB;CACJ"}
|
|
@@ -48,6 +48,40 @@ var TrinoTypes;
|
|
|
48
48
|
TrinoTypes["IPADDRESS"] = "ipaddress";
|
|
49
49
|
TrinoTypes["UUID"] = "uuid";
|
|
50
50
|
})(TrinoTypes || (exports.TrinoTypes = TrinoTypes = {}));
|
|
51
|
+
const getSanitizedHttpCause = (error) => {
|
|
52
|
+
if (typeof error !== 'object' ||
|
|
53
|
+
error === null ||
|
|
54
|
+
!('isAxiosError' in error) ||
|
|
55
|
+
error.isAxiosError !== true)
|
|
56
|
+
return undefined;
|
|
57
|
+
if ('status' in error && typeof error.status === 'number')
|
|
58
|
+
return { status: error.status };
|
|
59
|
+
if ('response' in error &&
|
|
60
|
+
typeof error.response === 'object' &&
|
|
61
|
+
error.response !== null &&
|
|
62
|
+
'status' in error.response &&
|
|
63
|
+
typeof error.response.status === 'number')
|
|
64
|
+
return { status: error.response.status };
|
|
65
|
+
return undefined;
|
|
66
|
+
};
|
|
67
|
+
const sanitizeTrinoCause = (cause) => {
|
|
68
|
+
if (typeof cause !== 'object' || cause === null)
|
|
69
|
+
return undefined;
|
|
70
|
+
if ('status' in cause && typeof cause.status === 'number')
|
|
71
|
+
return { status: cause.status };
|
|
72
|
+
if ('errorName' in cause &&
|
|
73
|
+
typeof cause.errorName === 'string' &&
|
|
74
|
+
'errorCode' in cause &&
|
|
75
|
+
typeof cause.errorCode === 'number' &&
|
|
76
|
+
'errorType' in cause &&
|
|
77
|
+
typeof cause.errorType === 'string')
|
|
78
|
+
return {
|
|
79
|
+
errorName: cause.errorName,
|
|
80
|
+
errorCode: cause.errorCode,
|
|
81
|
+
errorType: cause.errorType,
|
|
82
|
+
};
|
|
83
|
+
return getSanitizedHttpCause(cause);
|
|
84
|
+
};
|
|
51
85
|
const getErrorMessage = (e) => {
|
|
52
86
|
// Trino returns Object of type QueryError
|
|
53
87
|
if (e.message) {
|
|
@@ -244,7 +278,9 @@ class TrinoWarehouseClient extends WarehouseBaseClient_1.default {
|
|
|
244
278
|
session = await client.create(this.connectionOptions);
|
|
245
279
|
}
|
|
246
280
|
catch (e) {
|
|
247
|
-
|
|
281
|
+
const error = new common_1.WarehouseConnectionError(getErrorMessage(e));
|
|
282
|
+
error.cause = sanitizeTrinoCause(e);
|
|
283
|
+
throw error;
|
|
248
284
|
}
|
|
249
285
|
return {
|
|
250
286
|
session,
|
|
@@ -271,8 +307,10 @@ class TrinoWarehouseClient extends WarehouseBaseClient_1.default {
|
|
|
271
307
|
// eslint-disable-next-line no-await-in-loop
|
|
272
308
|
timezoneResult = await timezoneQuery.next();
|
|
273
309
|
if (timezoneResult.value.error) {
|
|
274
|
-
|
|
310
|
+
const error = new common_1.WarehouseQueryError(getErrorMessage(timezoneResult.value.error) ??
|
|
275
311
|
'Failed to set the time zone');
|
|
312
|
+
error.cause = sanitizeTrinoCause(timezoneResult.value.error);
|
|
313
|
+
throw error;
|
|
276
314
|
}
|
|
277
315
|
} while (!timezoneResult.done);
|
|
278
316
|
}
|
|
@@ -294,8 +332,10 @@ class TrinoWarehouseClient extends WarehouseBaseClient_1.default {
|
|
|
294
332
|
: alteredQuery);
|
|
295
333
|
let queryResult = await query.next();
|
|
296
334
|
if (queryResult.value.error) {
|
|
297
|
-
|
|
335
|
+
const error = new common_1.WarehouseQueryError(getErrorMessage(queryResult.value.error) ??
|
|
298
336
|
'Unexpected error in query execution');
|
|
337
|
+
error.cause = sanitizeTrinoCause(queryResult.value.error);
|
|
338
|
+
throw error;
|
|
299
339
|
}
|
|
300
340
|
const schema = queryResult.value.columns ?? [];
|
|
301
341
|
const fields = schema.reduce((acc, column) => {
|
|
@@ -344,7 +384,9 @@ class TrinoWarehouseClient extends WarehouseBaseClient_1.default {
|
|
|
344
384
|
}
|
|
345
385
|
}
|
|
346
386
|
catch (e) {
|
|
347
|
-
|
|
387
|
+
const error = new common_1.WarehouseQueryError(getErrorMessage(e));
|
|
388
|
+
error.cause = sanitizeTrinoCause(e instanceof common_1.WarehouseQueryError ? e.cause : e);
|
|
389
|
+
throw error;
|
|
348
390
|
}
|
|
349
391
|
finally {
|
|
350
392
|
await close();
|
|
@@ -362,7 +404,9 @@ class TrinoWarehouseClient extends WarehouseBaseClient_1.default {
|
|
|
362
404
|
return result;
|
|
363
405
|
}
|
|
364
406
|
catch (e) {
|
|
365
|
-
|
|
407
|
+
const error = new common_1.WarehouseQueryError(getErrorMessage(e));
|
|
408
|
+
error.cause = sanitizeTrinoCause(e);
|
|
409
|
+
throw error;
|
|
366
410
|
}
|
|
367
411
|
finally {
|
|
368
412
|
if (query)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/warehouses",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.542.0",
|
|
4
4
|
"description": "Warehouse connectors for Lightdash",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@databricks/sql": "1.13.0",
|
|
22
22
|
"@duckdb/node-api": "1.5.2-r.2",
|
|
23
23
|
"@google-cloud/bigquery": "8.3.1",
|
|
24
|
-
"@lightdash/common": "2.
|
|
24
|
+
"@lightdash/common": "2.542.0",
|
|
25
25
|
"node-fetch": "2.7.0",
|
|
26
26
|
"pg": "8.13.1",
|
|
27
27
|
"pg-cursor": "2.10.0",
|