@dremio/js-sdk 0.23.0 → 0.24.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.
- package/dist/cloud/Dremio.d.ts +1 -0
- package/dist/cloud/getResourceConfig.d.ts +1 -0
- package/dist/cloud/getResourceConfig.js +1 -0
- package/dist/cloud/getResourceConfig.js.map +1 -1
- package/dist/common/Config.d.ts +7 -0
- package/dist/common/Config.js.map +1 -1
- package/dist/common/fromTextEventStream.d.ts +7 -0
- package/dist/common/fromTextEventStream.js +92 -0
- package/dist/common/fromTextEventStream.js.map +1 -0
- package/dist/common/sharedExports.d.ts +1 -0
- package/dist/common/sharedExports.js +1 -0
- package/dist/common/sharedExports.js.map +1 -1
- package/dist/enterprise/Dremio.d.ts +1 -0
- package/dist/oss/Dremio.d.ts +1 -0
- package/dist/oss/getResourceConfig.d.ts +1 -0
- package/dist/oss/getResourceConfig.js +1 -0
- package/dist/oss/getResourceConfig.js.map +1 -1
- package/package.json +2 -1
package/dist/cloud/Dremio.d.ts
CHANGED
|
@@ -38,5 +38,6 @@ export declare class Dremio {
|
|
|
38
38
|
sonarV2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
39
39
|
sonarV3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
40
40
|
v3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
41
|
+
v4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
41
42
|
};
|
|
42
43
|
}
|
|
@@ -11,4 +11,5 @@ export declare const getResourceConfig: (config: Config) => (projectId?: string)
|
|
|
11
11
|
sonarV2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
12
12
|
sonarV3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
13
13
|
v3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
14
|
+
v4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
14
15
|
};
|
|
@@ -33,6 +33,7 @@ export const getResourceConfig = (config) => (projectId) => {
|
|
|
33
33
|
return request(`/v0/projects/${projectId}/${path}`, init);
|
|
34
34
|
},
|
|
35
35
|
v3Request: (path, init) => request(`/v0/${path}`, init),
|
|
36
|
+
v4Request: (path, init) => request(`/v1/${path}`, init),
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
39
|
//# sourceMappingURL=getResourceConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,SAAkB,EAAE,EAAE;IAC1E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE;YACnD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,OAAO,CACZ,IAAI,GAAG,CACL,gBAAgB,SAAS,IAAI,IAAI,EAAE,EACnC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACpC,CAAC,QAAQ,EAAE,EACZ,IAAI,CACL,CAAC;QACJ,CAAC;QACD,cAAc,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE;YACnD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,OAAO,CAAC,gBAAgB,SAAS,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC;QACD,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,CAAC;QAC7E,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,CAAC;KACC,CAAC;AACnF,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n V3Config,\n V4Config,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\n\nexport const getResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(\n new URL(\n `/ui/projects/${projectId}/${path}`,\n config.origin.replace(\"api\", \"app\"),\n ).toString(),\n init,\n );\n },\n sonarV3Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(`/v0/projects/${projectId}/${path}`, init);\n },\n v3Request: (path: string, init?: RequestInit) => request(`/v0/${path}`, init),\n v4Request: (path: string, init?: RequestInit) => request(`/v1/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config & V3Config & V4Config;\n};\n"]}
|
package/dist/common/Config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/common/Config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AsyncResult } from \"ts-results-es\";\nimport type { CredentialProvider } from \"./CredentialProvider.ts\";\nimport type { HttpError } from \"./HttpError.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => AsyncResult<Response, HttpError>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: (input: string, init?: RequestInit) => Promise<Response>;\n\n /**\n * Dremio API base origin\n */\n origin: string;\n\n logger?: {\n debug: typeof console.debug;\n error: typeof console.error;\n info: typeof console.info;\n warn: typeof console.warn;\n };\n\n /**\n * Provides credentials to Dremio for all authenticated API requests.\n * Required unless using a custom `fetch` provider with its own credentials provision\n */\n credentials?: CredentialProvider;\n\n /**\n * Configure the maximum number of times to retry requests that failed due to a\n * temporary condition such as 429 or 503. Default is 10. Set to 0 to disable\n * automatic retry.\n */\n maxRetryCount?: number;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type ResourceConfig = {\n logger?: Config[\"logger\"];\n origin: Config[\"origin\"];\n request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV2Config = {\n sonarV2Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV3Config = {\n sonarV3Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV4Config = {\n sonarV4Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V3Config = {\n v3Request: RequestFn;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/common/Config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AsyncResult } from \"ts-results-es\";\nimport type { CredentialProvider } from \"./CredentialProvider.ts\";\nimport type { HttpError } from \"./HttpError.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => AsyncResult<Response, HttpError>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: (input: string, init?: RequestInit) => Promise<Response>;\n\n /**\n * Dremio API base origin\n */\n origin: string;\n\n logger?: {\n debug: typeof console.debug;\n error: typeof console.error;\n info: typeof console.info;\n warn: typeof console.warn;\n };\n\n /**\n * Provides credentials to Dremio for all authenticated API requests.\n * Required unless using a custom `fetch` provider with its own credentials provision\n */\n credentials?: CredentialProvider;\n\n /**\n * Configure the maximum number of times to retry requests that failed due to a\n * temporary condition such as 429 or 503. Default is 10. Set to 0 to disable\n * automatic retry.\n */\n maxRetryCount?: number;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type ResourceConfig = {\n logger?: Config[\"logger\"];\n origin: Config[\"origin\"];\n request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV2Config = {\n sonarV2Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV3Config = {\n sonarV3Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV4Config = {\n sonarV4Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V3Config = {\n v3Request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V4Config = {\n v4Request: RequestFn;\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { type EventSourceMessage } from "eventsource-parser/stream";
|
|
3
|
+
/**
|
|
4
|
+
* Takes an instance of `Response` that will resolve to a `text/event-stream` and maps it
|
|
5
|
+
* into an observable that emits for each event as it arrives
|
|
6
|
+
*/
|
|
7
|
+
export declare const fromTextEventStream: (response: Promise<Response>) => Observable<EventSourceMessage>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Observable } from "rxjs";
|
|
17
|
+
import { EventSourceParserStream } from "eventsource-parser/stream";
|
|
18
|
+
import { HttpError } from "./HttpError.js";
|
|
19
|
+
/**
|
|
20
|
+
* Takes an instance of `Response` that will resolve to a `text/event-stream` and maps it
|
|
21
|
+
* into an observable that emits for each event as it arrives
|
|
22
|
+
*/
|
|
23
|
+
export const fromTextEventStream = (response) => new Observable((subscriber) => {
|
|
24
|
+
/**
|
|
25
|
+
* Create an internal AbortController so that the response stream
|
|
26
|
+
* can be canceled early if the subscriber unsubscribes early
|
|
27
|
+
*/
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
const { signal } = controller;
|
|
30
|
+
response
|
|
31
|
+
.then(async (response) => {
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
throw await HttpError.fromResponse(response);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Even though the correct Content-Type header isn't strictly required,
|
|
37
|
+
* it's indicates either a client mistake or server implementation bug
|
|
38
|
+
*/
|
|
39
|
+
if (response.headers.get("Content-Type") !== "text/event-stream") {
|
|
40
|
+
throw new Error(`Expected response type to be text/event-stream. Received ${response.headers.get("Content-Type")}.`);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Response body should never be undefined for a text/event-stream
|
|
44
|
+
*/
|
|
45
|
+
if (!response.body) {
|
|
46
|
+
throw new Error(`Response body was undefined`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pipe the raw byte stream through a text decoder, and then
|
|
50
|
+
* through a parser that extracts individual SSE events
|
|
51
|
+
*/
|
|
52
|
+
return response.body
|
|
53
|
+
.pipeThrough(new TextDecoderStream())
|
|
54
|
+
.pipeThrough(new EventSourceParserStream());
|
|
55
|
+
})
|
|
56
|
+
.then(async (readableStream) => {
|
|
57
|
+
const reader = readableStream.getReader();
|
|
58
|
+
/**
|
|
59
|
+
* Check if the observable has been unsubscribed before reading
|
|
60
|
+
* each chunk
|
|
61
|
+
*/
|
|
62
|
+
while (!signal.aborted) {
|
|
63
|
+
const { done, value } = await reader.read();
|
|
64
|
+
/**
|
|
65
|
+
* Check again after reading a chunk if the observable
|
|
66
|
+
* has been unsubscribed to avoid calling .next() or
|
|
67
|
+
* .complete() unnecessarily on the observable
|
|
68
|
+
*/
|
|
69
|
+
if (signal.aborted) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
if (done) {
|
|
73
|
+
subscriber.complete();
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
subscriber.next(value);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Always call .cancel() on the reader even if the while loop
|
|
80
|
+
* was exited due to stream completion in order to indicate it
|
|
81
|
+
* can be fully cleaned up
|
|
82
|
+
*/
|
|
83
|
+
await reader.cancel();
|
|
84
|
+
})
|
|
85
|
+
.catch((e) => {
|
|
86
|
+
subscriber.error(e);
|
|
87
|
+
});
|
|
88
|
+
return () => {
|
|
89
|
+
controller.abort();
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=fromTextEventStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fromTextEventStream.js","sourceRoot":"","sources":["../../src/common/fromTextEventStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAA2B,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAA2B,EAAE,EAAE,CACjE,IAAI,UAAU,CAAqB,CAAC,UAAU,EAAE,EAAE;IAChD;;;OAGG;IACH,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAE9B,QAAQ;SACL,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACvB,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,MAAM,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;QAED;;;WAGG;QACH,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,mBAAmB,EAAE,CAAC;YACjE,MAAM,IAAI,KAAK,CACb,4DAA4D,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CACpG,CAAC;QACJ,CAAC;QAED;;WAEG;QACH,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QAED;;;WAGG;QACH,OAAO,QAAQ,CAAC,IAAI;aACjB,WAAW,CAAC,IAAI,iBAAiB,EAAE,CAAC;aACpC,WAAW,CAAC,IAAI,uBAAuB,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC;SACD,IAAI,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE;QAC7B,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;QAE1C;;;WAGG;QACH,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAE5C;;;;eAIG;YACH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM;YACR,CAAC;YAED,IAAI,IAAI,EAAE,CAAC;gBACT,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACtB,MAAM;YACR,CAAC;YAED,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QAED;;;;WAIG;QACH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;QACpB,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,EAAE;QACV,UAAU,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Observable } from \"rxjs\";\nimport { type EventSourceMessage, EventSourceParserStream } from \"eventsource-parser/stream\";\nimport { HttpError } from \"./HttpError.ts\";\n\n/**\n * Takes an instance of `Response` that will resolve to a `text/event-stream` and maps it\n * into an observable that emits for each event as it arrives\n */\nexport const fromTextEventStream = (response: Promise<Response>) =>\n new Observable<EventSourceMessage>((subscriber) => {\n /**\n * Create an internal AbortController so that the response stream\n * can be canceled early if the subscriber unsubscribes early\n */\n const controller = new AbortController();\n const { signal } = controller;\n\n response\n .then(async (response) => {\n if (!response.ok) {\n throw await HttpError.fromResponse(response);\n }\n\n /**\n * Even though the correct Content-Type header isn't strictly required,\n * it's indicates either a client mistake or server implementation bug\n */\n if (response.headers.get(\"Content-Type\") !== \"text/event-stream\") {\n throw new Error(\n `Expected response type to be text/event-stream. Received ${response.headers.get(\"Content-Type\")}.`,\n );\n }\n\n /**\n * Response body should never be undefined for a text/event-stream\n */\n if (!response.body) {\n throw new Error(`Response body was undefined`);\n }\n\n /**\n * Pipe the raw byte stream through a text decoder, and then\n * through a parser that extracts individual SSE events\n */\n return response.body\n .pipeThrough(new TextDecoderStream())\n .pipeThrough(new EventSourceParserStream());\n })\n .then(async (readableStream) => {\n const reader = readableStream.getReader();\n\n /**\n * Check if the observable has been unsubscribed before reading\n * each chunk\n */\n while (!signal.aborted) {\n const { done, value } = await reader.read();\n\n /**\n * Check again after reading a chunk if the observable\n * has been unsubscribed to avoid calling .next() or\n * .complete() unnecessarily on the observable\n */\n if (signal.aborted) {\n break;\n }\n\n if (done) {\n subscriber.complete();\n break;\n }\n\n subscriber.next(value);\n }\n\n /**\n * Always call .cancel() on the reader even if the while loop\n * was exited due to stream completion in order to indicate it\n * can be fully cleaned up\n */\n await reader.cancel();\n })\n .catch((e: unknown) => {\n subscriber.error(e);\n });\n\n return () => {\n controller.abort();\n };\n });\n"]}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { HttpError } from "../common/HttpError.js";
|
|
17
17
|
export { HttpError };
|
|
18
18
|
export * from "./CredentialProvider.js";
|
|
19
|
+
export * from "./fromTextEventStream.js";
|
|
19
20
|
export * from "./Problem.js";
|
|
20
21
|
export * from "./Query.js";
|
|
21
22
|
//# sourceMappingURL=sharedExports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedExports.js","sourceRoot":"","sources":["../../src/common/sharedExports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { HttpError } from \"../common/HttpError.ts\";\nexport { HttpError };\nexport * from \"./CredentialProvider.ts\";\nexport * from \"./Problem.ts\";\nexport * from \"./Query.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"sharedExports.js","sourceRoot":"","sources":["../../src/common/sharedExports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { HttpError } from \"../common/HttpError.ts\";\nexport { HttpError };\nexport * from \"./CredentialProvider.ts\";\nexport * from \"./fromTextEventStream.ts\";\nexport * from \"./Problem.ts\";\nexport * from \"./Query.ts\";\n"]}
|
|
@@ -34,5 +34,6 @@ export declare class Dremio {
|
|
|
34
34
|
sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
35
35
|
sonarV4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
36
36
|
v3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
37
|
+
v4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
37
38
|
};
|
|
38
39
|
}
|
package/dist/oss/Dremio.d.ts
CHANGED
|
@@ -25,5 +25,6 @@ export declare class Dremio {
|
|
|
25
25
|
sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
26
26
|
sonarV4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
27
27
|
v3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
28
|
+
v4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
28
29
|
};
|
|
29
30
|
}
|
|
@@ -12,4 +12,5 @@ export declare const getResourceConfig: (config: Config) => {
|
|
|
12
12
|
sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
13
13
|
sonarV4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
14
14
|
v3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
15
|
+
v4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
15
16
|
};
|
|
@@ -24,6 +24,7 @@ export const getResourceConfig = (config) => {
|
|
|
24
24
|
sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),
|
|
25
25
|
sonarV4Request: (path, init) => request(`/api/v4/${path}`, init),
|
|
26
26
|
v3Request: (path, init) => request(`/api/v3/${path}`, init),
|
|
27
|
+
v4Request: (path, init) => request(`/api/v4/${path}`, init),
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
30
|
//# sourceMappingURL=getResourceConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/oss/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/oss/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE;IAClD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC;QAC/D,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAC3D,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;KACmC,CAAC;AACnG,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V3Config,\n V4Config,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\n\nexport const getResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n sonarV4Request: (path, init) => request(`/api/v4/${path}`, init),\n v3Request: (path, init) => request(`/api/v3/${path}`, init),\n v4Request: (path, init) => request(`/api/v4/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config & SonarV4Config & V3Config & V4Config;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dremio/js-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "JavaScript library for the Dremio API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dremio",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"prepare": "node --run dist"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"eventsource-parser": "^3.0.1",
|
|
35
36
|
"moize": "^6",
|
|
36
37
|
"parse-ms": "^4",
|
|
37
38
|
"rxjs": "^7",
|