@dremio/js-sdk 0.5.1 → 0.7.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/common/Config.d.ts +7 -0
- package/dist/common/Config.js.map +1 -1
- package/dist/enterprise/engines/Engine.d.ts +16 -35
- package/dist/enterprise/engines/Engine.js +26 -12
- package/dist/enterprise/engines/Engine.js.map +1 -1
- package/dist/enterprise/engines/EnginesResource.d.ts +3 -0
- package/dist/enterprise/engines/EnginesResource.js +11 -0
- package/dist/enterprise/engines/EnginesResource.js.map +1 -1
- package/dist/enterprise/index.d.ts +2 -0
- package/dist/enterprise/index.js +2 -0
- package/dist/enterprise/index.js.map +1 -1
- package/dist/enterprise/resources.d.ts +2 -2
- package/dist/enterprise/resources.js.map +1 -1
- package/package.json +1 -1
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 { CredentialProvider } from \"./CredentialProvider.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => Promise<Response>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: RequestFn;\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/**\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 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 { CredentialProvider } from \"./CredentialProvider.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => Promise<Response>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: RequestFn;\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/**\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,29 +1,18 @@
|
|
|
1
1
|
import type { SonarV3Config } from "../../common/Config.ts";
|
|
2
|
-
import { type Result } from "ts-results-es";
|
|
2
|
+
import { Err, Ok, type Result } from "ts-results-es";
|
|
3
3
|
import { Temporal } from "temporal-polyfill";
|
|
4
|
+
import type { HttpError } from "../../common/HttpError.ts";
|
|
4
5
|
export declare class Engine {
|
|
5
6
|
#private;
|
|
6
7
|
readonly id: EngineEntity["id"];
|
|
7
8
|
readonly name: EngineEntity["name"];
|
|
8
9
|
readonly spec: {
|
|
9
10
|
c3StorageSize: EngineEntity["spec"]["c3StorageSize"];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
key: EngineEntity["spec"]["executorPodMetadata"]["tolerations"][number]["key"];
|
|
16
|
-
operator: EngineEntity["spec"]["executorPodMetadata"]["tolerations"][number]["operator"];
|
|
17
|
-
effect: EngineEntity["spec"]["executorPodMetadata"]["tolerations"][number]["effect"];
|
|
18
|
-
tolerationDuration: Temporal.Duration;
|
|
19
|
-
value?: EngineEntity["spec"]["executorPodMetadata"]["tolerations"][number]["value"];
|
|
20
|
-
}[];
|
|
21
|
-
idleTimeout?: Temporal.Duration;
|
|
22
|
-
resourceAllocationOffset: EngineEntity["spec"]["executorPodMetadata"]["resourceAllocationOffset"];
|
|
23
|
-
size: EngineEntity["spec"]["executorPodMetadata"]["size"];
|
|
24
|
-
spillStorageSize: EngineEntity["spec"]["executorPodMetadata"]["spillStorageSize"];
|
|
25
|
-
targetCpuCapacity: EngineEntity["spec"]["executorPodMetadata"]["targetCpuCapacity"];
|
|
26
|
-
};
|
|
11
|
+
size: EngineEntity["spec"]["size"];
|
|
12
|
+
spillStorageSize: EngineEntity["spec"]["spillStorageSize"];
|
|
13
|
+
targetCpuCapacity: EngineEntity["spec"]["targetCpuCapacity"];
|
|
14
|
+
resourceAllocationOffset: EngineEntity["spec"]["resourceAllocationOffset"];
|
|
15
|
+
idleTimeout?: Temporal.Duration;
|
|
27
16
|
};
|
|
28
17
|
readonly status: Omit<EngineEntity["status"], "message"> & {
|
|
29
18
|
message: string | null;
|
|
@@ -32,29 +21,21 @@ export declare class Engine {
|
|
|
32
21
|
get settled(): boolean;
|
|
33
22
|
start(): Promise<Result<Engine, unknown>>;
|
|
34
23
|
stop(): Promise<Result<Engine, unknown>>;
|
|
24
|
+
update(params: Partial<{
|
|
25
|
+
name: Engine["name"];
|
|
26
|
+
spec: Partial<Engine["spec"]>;
|
|
27
|
+
}>): Promise<Err<HttpError> | Ok<Engine>>;
|
|
35
28
|
}
|
|
36
29
|
export type EngineEntity = {
|
|
37
30
|
id: string;
|
|
38
31
|
name: string;
|
|
39
32
|
spec: {
|
|
40
33
|
c3StorageSize: string;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
key: string;
|
|
47
|
-
operator: "Exists" | "Equal";
|
|
48
|
-
effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute";
|
|
49
|
-
tolerationSeconds: number;
|
|
50
|
-
value?: number;
|
|
51
|
-
}[];
|
|
52
|
-
idleTimeout?: string;
|
|
53
|
-
resourceAllocationOffset: string;
|
|
54
|
-
size: "2XSmall" | "XSmall" | "Small" | "Medium" | "Large" | "XLarge" | "2XLarge";
|
|
55
|
-
spillStorageSize: string;
|
|
56
|
-
targetCpuCapacity: string;
|
|
57
|
-
};
|
|
34
|
+
idleTimeout?: string;
|
|
35
|
+
spillStorageSize: string;
|
|
36
|
+
targetCpuCapacity: string;
|
|
37
|
+
resourceAllocationOffset: string;
|
|
38
|
+
size: "2XSmall" | "XSmall" | "Small" | "Medium" | "Large" | "XLarge" | "2XLarge";
|
|
58
39
|
};
|
|
59
40
|
status: {
|
|
60
41
|
message: string;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import parseMilliseconds from "parse-ms";
|
|
17
16
|
import { Err, Ok } from "ts-results-es";
|
|
18
17
|
import { Temporal } from "temporal-polyfill";
|
|
19
18
|
export class Engine {
|
|
@@ -22,23 +21,15 @@ export class Engine {
|
|
|
22
21
|
spec;
|
|
23
22
|
status;
|
|
24
23
|
#config;
|
|
25
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
26
24
|
#tag;
|
|
27
25
|
constructor(entity, config) {
|
|
28
26
|
this.id = entity.id;
|
|
29
27
|
this.name = entity.name;
|
|
30
28
|
this.spec = {
|
|
31
29
|
...entity.spec,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
? Temporal.Duration.from(entity.spec.executorPodMetadata.idleTimeout)
|
|
36
|
-
: undefined,
|
|
37
|
-
tolerations: entity.spec.executorPodMetadata.tolerations.map(({ tolerationSeconds, ...toleration }) => ({
|
|
38
|
-
...toleration,
|
|
39
|
-
tolerationDuration: Temporal.Duration.from(parseMilliseconds(tolerationSeconds * 1000)),
|
|
40
|
-
})),
|
|
41
|
-
},
|
|
30
|
+
idleTimeout: entity.spec.idleTimeout
|
|
31
|
+
? Temporal.Duration.from(entity.spec.idleTimeout)
|
|
32
|
+
: undefined,
|
|
42
33
|
};
|
|
43
34
|
this.status = {
|
|
44
35
|
...entity.status,
|
|
@@ -72,5 +63,28 @@ export class Engine {
|
|
|
72
63
|
.then((entity) => Ok(new Engine(entity, this.#config)))
|
|
73
64
|
.catch((e) => Err(e));
|
|
74
65
|
}
|
|
66
|
+
async update(params) {
|
|
67
|
+
const updateOptions = {
|
|
68
|
+
name: params.name || this.name,
|
|
69
|
+
spec: {
|
|
70
|
+
...this.spec,
|
|
71
|
+
...params.spec,
|
|
72
|
+
},
|
|
73
|
+
version: this.#tag,
|
|
74
|
+
};
|
|
75
|
+
return this.#config
|
|
76
|
+
.sonarV3Request(`engines/${this.id}`, {
|
|
77
|
+
body: JSON.stringify(updateOptions),
|
|
78
|
+
headers: {
|
|
79
|
+
Accept: "application/json",
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
},
|
|
82
|
+
keepalive: true,
|
|
83
|
+
method: "PUT",
|
|
84
|
+
})
|
|
85
|
+
.then((res) => res.json())
|
|
86
|
+
.then((entity) => Ok(new Engine(entity, this.#config)))
|
|
87
|
+
.catch((e) => Err(e));
|
|
88
|
+
}
|
|
75
89
|
}
|
|
76
90
|
//# sourceMappingURL=Engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/enterprise/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/enterprise/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,MAAM,OAAO,MAAM;IACD,EAAE,CAAqB;IACvB,IAAI,CAAuB;IAC3B,IAAI,CAOlB;IACc,MAAM,CAEpB;IAEO,OAAO,CAAgB;IAEvB,IAAI,CAAS;IAEtB,YAAY,MAAoB,EAAE,MAAqB;QACrD,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG;YACV,GAAG,MAAM,CAAC,IAAI;YACd,WAAW,E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\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 { SonarV3Config } from \"../../common/Config.ts\";\nimport { Err, Ok, type Result } from \"ts-results-es\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class Engine {\n public readonly id: EngineEntity[\"id\"];\n public readonly name: EngineEntity[\"name\"];\n public readonly spec: {\n c3StorageSize: EngineEntity[\"spec\"][\"c3StorageSize\"];\n size: EngineEntity[\"spec\"][\"size\"];\n spillStorageSize: EngineEntity[\"spec\"][\"spillStorageSize\"];\n targetCpuCapacity: EngineEntity[\"spec\"][\"targetCpuCapacity\"];\n resourceAllocationOffset: EngineEntity[\"spec\"][\"resourceAllocationOffset\"];\n idleTimeout?: Temporal.Duration;\n };\n public readonly status: Omit<EngineEntity[\"status\"], \"message\"> & {\n message: string | null;\n };\n\n readonly #config: SonarV3Config;\n\n readonly #tag: string;\n\n constructor(entity: EngineEntity, config: SonarV3Config) {\n this.id = entity.id;\n this.name = entity.name;\n this.spec = {\n ...entity.spec,\n idleTimeout: entity.spec.idleTimeout\n ? Temporal.Duration.from(entity.spec.idleTimeout)\n : undefined,\n };\n this.status = {\n ...entity.status,\n message: entity.status.message?.length ? entity.status.message : null,\n };\n this.#tag = entity.version;\n this.#config = config;\n }\n\n get settled() {\n return this.status.state !== \"STARTING\" && this.status.state !== \"STOPPING\";\n }\n\n start(): Promise<Result<Engine, unknown>> {\n return this.#config\n .sonarV3Request(`engines/${this.id}/start`, {\n headers: { Accept: \"application/json\" },\n keepalive: true,\n method: \"PUT\",\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: unknown) => Err(e));\n }\n\n stop(): Promise<Result<Engine, unknown>> {\n return this.#config\n .sonarV3Request(`engines/${this.id}/stop`, {\n headers: { Accept: \"application/json\" },\n keepalive: true,\n method: \"PUT\",\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: unknown) => Err(e));\n }\n\n async update(\n params: Partial<{\n name: Engine[\"name\"];\n spec: Partial<Engine[\"spec\"]>;\n }>,\n ) {\n const updateOptions = {\n name: params.name || this.name,\n spec: {\n ...this.spec,\n ...params.spec,\n },\n version: this.#tag,\n };\n return this.#config\n .sonarV3Request(`engines/${this.id}`, {\n body: JSON.stringify(updateOptions),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: HttpError) => Err(e));\n }\n}\n\nexport type EngineEntity = {\n id: string;\n name: string;\n spec: {\n c3StorageSize: string;\n idleTimeout?: string;\n spillStorageSize: string;\n targetCpuCapacity: string;\n resourceAllocationOffset: string;\n size: \"2XSmall\" | \"XSmall\" | \"Small\" | \"Medium\" | \"Large\" | \"XLarge\" | \"2XLarge\";\n };\n status: {\n message: string;\n replicas: {\n id: string;\n executors: {\n cpu: number;\n memory: number;\n name: string;\n status: string;\n }[];\n }[];\n runningExecutors: number;\n runningReplicas: number;\n startingExecutors: number;\n startingReplicas: number;\n state: \"STARTING\" | \"RUNNING\" | \"STOPPING\" | \"STOPPED\" | \"WARNING\" | \"FAILED\";\n stoppingExecutors: number;\n stoppingReplicas: number;\n };\n version: string;\n};\n"]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { Err, Ok } from "ts-results-es";
|
|
1
2
|
import type { ResourceConfig, SonarV3Config } from "../../common/Config.ts";
|
|
2
3
|
import type { SignalParam } from "../../common/Params.ts";
|
|
3
4
|
import { Engine } from "./Engine.ts";
|
|
5
|
+
import type { HttpError } from "../../common/HttpError.ts";
|
|
4
6
|
export declare class EnginesResource {
|
|
5
7
|
#private;
|
|
6
8
|
constructor(config: ResourceConfig & SonarV3Config);
|
|
7
9
|
list(): {
|
|
8
10
|
data({ signal }?: SignalParam): AsyncGenerator<Engine, void, unknown>;
|
|
9
11
|
};
|
|
12
|
+
retrieve(id: string, { signal }?: SignalParam): Promise<Err<HttpError> | Ok<Engine>>;
|
|
10
13
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Err, Ok } from "ts-results-es";
|
|
16
17
|
import { Engine } from "./Engine.js";
|
|
17
18
|
export class EnginesResource {
|
|
18
19
|
#config;
|
|
@@ -30,5 +31,15 @@ export class EnginesResource {
|
|
|
30
31
|
},
|
|
31
32
|
};
|
|
32
33
|
}
|
|
34
|
+
retrieve(id, { signal } = {}) {
|
|
35
|
+
return this.#config
|
|
36
|
+
.sonarV3Request(`engines/${id}`, {
|
|
37
|
+
headers: { Accept: "application/json" },
|
|
38
|
+
signal,
|
|
39
|
+
})
|
|
40
|
+
.then((res) => res.json())
|
|
41
|
+
.then((entity) => Ok(new Engine(entity, this.#config)))
|
|
42
|
+
.catch((e) => Err(e));
|
|
43
|
+
}
|
|
33
44
|
}
|
|
34
45
|
//# sourceMappingURL=EnginesResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/enterprise/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/enterprise/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA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AAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;aACtD,KAAK,CAAC,CAAC,CAAY,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;CACF","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 { Err, Ok } from \"ts-results-es\";\nimport type { ResourceConfig, SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { Engine, type EngineEntity } from \"./Engine.ts\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class EnginesResource {\n readonly #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"engines\", { headers: { Accept: \"application/json\" }, signal })\n .then((res) => res.json() as Promise<{ data: EngineEntity[] }>)\n .then((res) => res.data.map((entity) => new Engine(entity, this.#config)));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await getPage({ signal });\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`engines/${id}`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: HttpError) => Err(e));\n }\n}\n"]}
|
|
@@ -13,10 +13,12 @@ export declare const Dremio: (config: Config) => {
|
|
|
13
13
|
request: import("../common/Config.ts").RequestFn;
|
|
14
14
|
sonarV2Request: (path: string, init: RequestInit | undefined) => Promise<Response>;
|
|
15
15
|
sonarV3Request: (path: string, init: RequestInit | undefined) => Promise<Response>;
|
|
16
|
+
sonarV4Request: (path: string, init: RequestInit | undefined) => Promise<Response>;
|
|
16
17
|
v3Request: (path: string, init: RequestInit | undefined) => Promise<Response>;
|
|
17
18
|
};
|
|
18
19
|
_sonarV2Request: (path: string, init: RequestInit | undefined) => Promise<Response>;
|
|
19
20
|
_sonarV3Request: (path: string, init: RequestInit | undefined) => Promise<Response>;
|
|
21
|
+
_sonarV4Request: (path: string, init: RequestInit | undefined) => Promise<Response>;
|
|
20
22
|
catalog: {
|
|
21
23
|
_catalogReferenceFromEntity: (entity: unknown) => import("./interfaces.ts").EnterpriseCatalogReference;
|
|
22
24
|
list: () => {
|
package/dist/enterprise/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const getSonarResourceConfig = (config) => {
|
|
|
23
23
|
request,
|
|
24
24
|
sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),
|
|
25
25
|
sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),
|
|
26
|
+
sonarV4Request: (path, init) => request(`/api/v4/${path}`, init),
|
|
26
27
|
v3Request: (path, init) => request(`/api/v3/${path}`, init),
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -34,6 +35,7 @@ export const Dremio = (config) => {
|
|
|
34
35
|
_sonarResourceConfig: sonarResourceConfig,
|
|
35
36
|
_sonarV2Request: sonarResourceConfig.sonarV2Request,
|
|
36
37
|
_sonarV3Request: sonarResourceConfig.sonarV3Request,
|
|
38
|
+
_sonarV4Request: sonarResourceConfig.sonarV4Request,
|
|
37
39
|
};
|
|
38
40
|
};
|
|
39
41
|
export * from "../common/sharedExports.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enterprise/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EA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e,EAAE,mBAAmB,CAAC,cAAc;KACpD,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,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 { createRequest } from \"../common/createRequest.ts\";\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V3Config,\n} from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (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 } satisfies ResourceConfig & SonarV2Config & SonarV3Config & SonarV4Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: sonarResourceConfig.request,\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV2Request: sonarResourceConfig.sonarV2Request,\n _sonarV3Request: sonarResourceConfig.sonarV3Request,\n _sonarV4Request: sonarResourceConfig.sonarV4Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport { Resources as _Resources };\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ResourceConfig, SonarV2Config, SonarV3Config, V3Config } from "../common/Config.ts";
|
|
1
|
+
import type { ResourceConfig, SonarV2Config, SonarV3Config, SonarV4Config, V3Config } from "../common/Config.ts";
|
|
2
2
|
import { EnginesResource } from "./engines/EnginesResource.ts";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* @hidden
|
|
6
6
|
*/
|
|
7
|
-
export declare const Resources: (config: ResourceConfig & SonarV2Config & SonarV3Config & V3Config) => {
|
|
7
|
+
export declare const Resources: (config: ResourceConfig & SonarV2Config & SonarV3Config & SonarV4Config & V3Config) => {
|
|
8
8
|
catalog: {
|
|
9
9
|
_catalogReferenceFromEntity: (entity: unknown) => import("./interfaces.ts").EnterpriseCatalogReference;
|
|
10
10
|
list: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/enterprise/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/enterprise/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAiF,EACjF,EAAE,CAAC,CAAC;IACJ,GAAG,kBAAkB,CAAC,MAAM,CAAC;IAC7B,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,IAAI,eAAe,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC;IAC1B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC;IAC5B,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC;CACvC,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 ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V3Config,\n} from \"../common/Config.ts\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport { Resources as CommunityResources } from \"../oss/resources.ts\";\nimport { EnterpriseCatalogResource } from \"./catalog/EnterpriseCatalogResource.ts\";\nimport { RolesResource } from \"./roles/RolesResource.ts\";\nimport { EnterpriseScriptsResource } from \"./scripts/EnterpriseScriptsResource.ts\";\nimport { EnterpriseUsersResource } from \"./users/EnterpriseUsersResource.ts\";\nimport { EnginesResource } from \"./engines/EnginesResource.ts\";\n\n/**\n * @internal\n * @hidden\n */\nexport const Resources = (\n config: ResourceConfig & SonarV2Config & SonarV3Config & SonarV4Config & V3Config,\n) => ({\n ...CommunityResources(config),\n catalog: EnterpriseCatalogResource(config),\n engines: new EnginesResource(config),\n jobs: JobsResource(config),\n roles: RolesResource(config),\n scripts: EnterpriseScriptsResource(config),\n users: EnterpriseUsersResource(config),\n});\n"]}
|