@dremio/js-sdk 0.10.0 → 0.11.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/ai/AiResource.d.ts +3 -15
- package/dist/cloud/ai/AiResource.js +11 -14
- package/dist/cloud/ai/AiResource.js.map +1 -1
- package/dist/cloud/arctic/ArcticResource.d.ts +1 -2
- package/dist/cloud/arctic/ArcticResource.js +5 -7
- package/dist/cloud/arctic/ArcticResource.js.map +1 -1
- package/dist/cloud/engines/Engine.d.ts +2 -3
- package/dist/cloud/engines/Engine.js +5 -6
- package/dist/cloud/engines/Engine.js.map +1 -1
- package/dist/cloud/engines/EnginesResource.d.ts +1 -1
- package/dist/cloud/engines/EnginesResource.js +5 -5
- package/dist/cloud/engines/EnginesResource.js.map +1 -1
- package/dist/cloud/index.d.ts +3 -5
- package/dist/cloud/index.js +0 -1
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/oauth/OAuthApplication.d.ts +1 -2
- package/dist/cloud/oauth/OAuthApplication.js +1 -3
- package/dist/cloud/oauth/OAuthApplication.js.map +1 -1
- package/dist/cloud/oauth/OAuthApplicationsResource.d.ts +2 -3
- package/dist/cloud/oauth/OAuthApplicationsResource.js +8 -11
- package/dist/cloud/oauth/OAuthApplicationsResource.js.map +1 -1
- package/dist/cloud/projects/Project.d.ts +2 -2
- package/dist/cloud/projects/ProjectsResource.d.ts +3 -4
- package/dist/cloud/projects/ProjectsResource.js +8 -17
- package/dist/cloud/projects/ProjectsResource.js.map +1 -1
- package/dist/cloud/users/CloudUsersResource.d.ts +2 -3
- package/dist/cloud/users/CloudUsersResource.js +4 -7
- package/dist/cloud/users/CloudUsersResource.js.map +1 -1
- package/dist/common/Config.d.ts +4 -2
- package/dist/common/Config.js.map +1 -1
- package/dist/common/HttpError.d.ts +7 -13
- package/dist/common/HttpError.js +19 -36
- package/dist/common/HttpError.js.map +1 -1
- package/dist/common/Problem.d.ts +29 -34
- package/dist/common/Problem.js +47 -19
- package/dist/common/Problem.js.map +1 -1
- package/dist/common/createRequest.js +8 -33
- package/dist/common/createRequest.js.map +1 -1
- package/dist/common/problems.d.ts +11 -9
- package/dist/common/problems.js +18 -9
- package/dist/common/problems.js.map +1 -1
- package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.d.ts +2 -3
- package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.js +3 -5
- package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.js.map +1 -1
- package/dist/enterprise/catalog/EnterpriseCatalogResource.js +3 -2
- package/dist/enterprise/catalog/EnterpriseCatalogResource.js.map +1 -1
- package/dist/enterprise/catalog/catalogRetrieve.js +4 -0
- package/dist/enterprise/catalog/catalogRetrieve.js.map +1 -1
- package/dist/enterprise/credentials/exchangePat.d.ts +2 -4
- package/dist/enterprise/credentials/exchangePat.js +3 -3
- package/dist/enterprise/credentials/exchangePat.js.map +1 -1
- package/dist/enterprise/engines/Engine.d.ts +3 -5
- package/dist/enterprise/engines/Engine.js +7 -11
- package/dist/enterprise/engines/Engine.js.map +1 -1
- package/dist/enterprise/engines/EnginesResource.d.ts +1 -3
- package/dist/enterprise/engines/EnginesResource.js +5 -7
- package/dist/enterprise/engines/EnginesResource.js.map +1 -1
- package/dist/enterprise/index.d.ts +7 -9
- package/dist/enterprise/index.js +0 -1
- package/dist/enterprise/index.js.map +1 -1
- package/dist/enterprise/roles/RolesResource.d.ts +2 -3
- package/dist/enterprise/roles/RolesResource.js +4 -7
- package/dist/enterprise/roles/RolesResource.js.map +1 -1
- package/dist/enterprise/scripts/EnterpriseScript.d.ts +3 -13
- package/dist/enterprise/scripts/EnterpriseScript.js +4 -6
- package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
- package/dist/enterprise/scripts/EnterpriseScriptsResource.d.ts +6 -2
- package/dist/enterprise/scripts/EnterpriseScriptsResource.js +1 -1
- package/dist/enterprise/scripts/EnterpriseScriptsResource.js.map +1 -1
- package/dist/enterprise/users/EnterpriseUser.d.ts +2 -3
- package/dist/enterprise/users/EnterpriseUser.js +3 -5
- package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
- package/dist/enterprise/users/EnterpriseUsersResource.d.ts +2 -3
- package/dist/enterprise/users/EnterpriseUsersResource.js +4 -7
- package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
- package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.d.ts +1 -1
- package/dist/oss/catalog/CatalogReferences/FolderCatalogReference.d.ts +1 -1
- package/dist/oss/catalog/CatalogReferences/HomeCatalogReference.d.ts +1 -1
- package/dist/oss/catalog/CatalogReferences/SourceCatalogReference.d.ts +1 -1
- package/dist/oss/catalog/CatalogReferences/SpaceCatalogReference.d.ts +1 -1
- package/dist/oss/catalog/CatalogReferences/utils/catalogChildren.js +1 -0
- package/dist/oss/catalog/CatalogReferences/utils/catalogChildren.js.map +1 -1
- package/dist/oss/catalog/CatalogReferences/utils/getTags.d.ts +1 -2
- package/dist/oss/catalog/CatalogReferences/utils/getTags.js +2 -4
- package/dist/oss/catalog/CatalogReferences/utils/getTags.js.map +1 -1
- package/dist/oss/catalog/CatalogReferences/utils/getWiki.d.ts +1 -2
- package/dist/oss/catalog/CatalogReferences/utils/getWiki.js +2 -4
- package/dist/oss/catalog/CatalogReferences/utils/getWiki.js.map +1 -1
- package/dist/oss/catalog/CatalogResource.js +1 -0
- package/dist/oss/catalog/CatalogResource.js.map +1 -1
- package/dist/oss/catalog/CatalogTags.d.ts +2 -6
- package/dist/oss/catalog/CatalogTags.js +8 -13
- package/dist/oss/catalog/CatalogTags.js.map +1 -1
- package/dist/oss/catalog/CatalogWiki.d.ts +2 -6
- package/dist/oss/catalog/CatalogWiki.js +8 -13
- package/dist/oss/catalog/CatalogWiki.js.map +1 -1
- package/dist/oss/catalog/catalogErrors.d.ts +3 -14
- package/dist/oss/catalog/catalogErrors.js +9 -12
- package/dist/oss/catalog/catalogErrors.js.map +1 -1
- package/dist/oss/catalog/catalogRetrieve.d.ts +3 -2
- package/dist/oss/catalog/catalogRetrieve.js +6 -2
- package/dist/oss/catalog/catalogRetrieve.js.map +1 -1
- package/dist/oss/index.d.ts +4 -7
- package/dist/oss/index.js +0 -1
- package/dist/oss/index.js.map +1 -1
- package/dist/oss/jobs/Job.d.ts +3 -3
- package/dist/oss/jobs/Job.js +7 -9
- package/dist/oss/jobs/Job.js.map +1 -1
- package/dist/oss/jobs/JobsResource.d.ts +4 -5
- package/dist/oss/jobs/JobsResource.js +5 -7
- package/dist/oss/jobs/JobsResource.js.map +1 -1
- package/dist/oss/scripts/Script.d.ts +3 -22
- package/dist/oss/scripts/Script.js +12 -16
- package/dist/oss/scripts/Script.js.map +1 -1
- package/dist/oss/scripts/ScriptErrors.d.ts +6 -18
- package/dist/oss/scripts/ScriptErrors.js +10 -13
- package/dist/oss/scripts/ScriptErrors.js.map +1 -1
- package/dist/oss/scripts/ScriptsResource.d.ts +14 -6
- package/dist/oss/scripts/ScriptsResource.js +19 -21
- package/dist/oss/scripts/ScriptsResource.js.map +1 -1
- package/dist/oss/users/UsersResource.d.ts +2 -3
- package/dist/oss/users/UsersResource.js +4 -7
- package/dist/oss/users/UsersResource.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
import { Err, Ok } from "ts-results-es";
|
|
2
1
|
import type { ResourceConfig, V3Config } from "../../common/Config.ts";
|
|
3
2
|
import type { SignalParam } from "../../common/Params.ts";
|
|
3
|
+
import { Problem } from "../../common/Problem.ts";
|
|
4
4
|
export declare class AiResource {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(config: ResourceConfig & V3Config);
|
|
7
7
|
autoProduceQuery: (project_id: string) => ({ datasetPaths, text }: {
|
|
8
8
|
datasetPaths: Set<string>;
|
|
9
9
|
text: string;
|
|
10
|
-
}, { signal }?: SignalParam) => Promise<
|
|
11
|
-
readonly detail: "Please clarify your request and try again.";
|
|
12
|
-
readonly title: "SQL could not be generated from the input text.";
|
|
13
|
-
readonly type: "https://api.dremio.dev/problems/auto-produce-sql/clarify-request";
|
|
14
|
-
}> | Err<{
|
|
15
|
-
readonly detail: string;
|
|
16
|
-
readonly title: "An unexpected error occurred while processing this request.";
|
|
17
|
-
readonly type: "https://api.dremio.dev/problems/unexpected-error";
|
|
18
|
-
}>>;
|
|
10
|
+
}, { signal }?: SignalParam) => Promise<import("ts-results-es").Result<string, import("../index.ts").HttpError | Problem<"https://api.dremio.dev/problems/auto-produce-sql/clarify-request", undefined>>>;
|
|
19
11
|
}
|
|
20
|
-
export declare const clarifyRequestErr:
|
|
21
|
-
readonly detail: "Please clarify your request and try again.";
|
|
22
|
-
readonly title: "SQL could not be generated from the input text.";
|
|
23
|
-
readonly type: "https://api.dremio.dev/problems/auto-produce-sql/clarify-request";
|
|
24
|
-
};
|
|
12
|
+
export declare const clarifyRequestErr: Problem<"https://api.dremio.dev/problems/auto-produce-sql/clarify-request", undefined>;
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import { HttpError } from "../../common/HttpError.js";
|
|
18
|
-
import { isProblem } from "../../common/Problem.js";
|
|
16
|
+
import { Problem } from "../../common/Problem.js";
|
|
19
17
|
export class AiResource {
|
|
20
18
|
#config;
|
|
21
19
|
constructor(config) {
|
|
@@ -37,19 +35,18 @@ export class AiResource {
|
|
|
37
35
|
method: "POST",
|
|
38
36
|
signal,
|
|
39
37
|
})
|
|
40
|
-
.
|
|
41
|
-
.
|
|
42
|
-
.
|
|
43
|
-
if (e instanceof
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
38
|
+
.map((res) => res.json())
|
|
39
|
+
.map((response) => response.sql)
|
|
40
|
+
.mapErr((e) => {
|
|
41
|
+
if (e.body instanceof Problem &&
|
|
42
|
+
e.body.detail?.includes("INVALID_ARGUMENT: SQL could not be generated. Please clarify your request."))
|
|
43
|
+
return clarifyRequestErr;
|
|
44
|
+
return e;
|
|
45
|
+
}).promise;
|
|
49
46
|
}
|
|
50
|
-
export const clarifyRequestErr = {
|
|
47
|
+
export const clarifyRequestErr = new Problem({
|
|
51
48
|
detail: "Please clarify your request and try again.",
|
|
52
49
|
title: "SQL could not be generated from the input text.",
|
|
53
50
|
type: "https://api.dremio.dev/problems/auto-produce-sql/clarify-request",
|
|
54
|
-
};
|
|
51
|
+
});
|
|
55
52
|
//# sourceMappingURL=AiResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AiResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"AiResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AiResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,MAAM,OAAO,UAAU;IACZ,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,gBAAgB,GACd,CAAC,UAAkB,EAAE,EAAE,CACvB,CACE,EAAE,YAAY,EAAE,IAAI,EAA+C,EACnE,EAAE,MAAM,KAAkB,EAAE,EAC5B,EAAE,CACF,IAAI,CAAC,OAAO;SACT,SAAS,CAAC,2BAA2B,EAAE;QACtC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACjE,WAAW;aACZ,CAAC,CAAC;YACH,SAAS,EAAE,UAAU;YACrB,gBAAgB,EAAE,IAAI;SACvB,CAAC;QACF,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SACnC;QACD,MAAM,EAAE,MAAM;QACd,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA8B,CAAC;SACpD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;SAC/B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACZ,IACE,CAAC,CAAC,IAAI,YAAY,OAAO;YACzB,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CACrB,4EAA4E,CAC7E;YAED,OAAO,iBAAiB,CAAC;QAE3B,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC,OAAO,CAAC;CAClB;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,OAAO,CAAC;IAC3C,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,iDAAiD;IACxD,IAAI,EAAE,kEAAkE;CACzE,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 { ResourceConfig, V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { Problem } from \"../../common/Problem.ts\";\n\nexport class AiResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n autoProduceQuery =\n (project_id: string) =>\n (\n { datasetPaths, text }: { datasetPaths: Set<string>; text: string },\n { signal }: SignalParam = {},\n ) =>\n this.#config\n .v3Request(\"gen-ai/auto-produce-query\", {\n body: JSON.stringify({\n datasetIdentifiers: Array.from(datasetPaths).map((datasetPath) => ({\n datasetPath,\n })),\n projectId: project_id,\n userInputtedText: text,\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n method: \"POST\",\n signal,\n })\n .map((res) => res.json() as Promise<{ sql: string }>)\n .map((response) => response.sql)\n .mapErr((e) => {\n if (\n e.body instanceof Problem &&\n e.body.detail?.includes(\n \"INVALID_ARGUMENT: SQL could not be generated. Please clarify your request.\",\n )\n )\n return clarifyRequestErr;\n\n return e;\n }).promise;\n}\n\nexport const clarifyRequestErr = new Problem({\n detail: \"Please clarify your request and try again.\",\n title: \"SQL could not be generated from the input text.\",\n type: \"https://api.dremio.dev/problems/auto-produce-sql/clarify-request\",\n});\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Err, Ok } from "ts-results-es";
|
|
2
1
|
import type { SonarV3Config } from "../../common/Config.ts";
|
|
3
2
|
import type { SignalParam } from "../../common/Params.ts";
|
|
4
3
|
import { ArcticCatalog, type ArcticCatalogEntity } from "./ArcticCatalog.ts";
|
|
@@ -13,5 +12,5 @@ export declare class ArcticResource {
|
|
|
13
12
|
list(): {
|
|
14
13
|
data({ signal }?: SignalParam): AsyncGenerator<ArcticCatalog, void, unknown>;
|
|
15
14
|
};
|
|
16
|
-
retrieve(id: string, { signal }?: SignalParam): Promise<
|
|
15
|
+
retrieve(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<ArcticCatalog, import("../index.ts").HttpError>>;
|
|
17
16
|
}
|
|
@@ -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 { Err, Ok } from "ts-results-es";
|
|
17
16
|
import { ArcticCatalog, arcticCatalogEntityToProperties, } from "./ArcticCatalog.js";
|
|
18
17
|
export class ArcticResource {
|
|
19
18
|
#config;
|
|
@@ -30,20 +29,19 @@ export class ArcticResource {
|
|
|
30
29
|
list() {
|
|
31
30
|
const l = ({ signal } = {}) => this.#config
|
|
32
31
|
.sonarV3Request("arctic/catalogs", { signal })
|
|
33
|
-
.
|
|
34
|
-
.
|
|
32
|
+
.map((res) => res.json())
|
|
33
|
+
.map((response) => response.data.map((entity) => this._createFromEntity(entity))).promise;
|
|
35
34
|
return {
|
|
36
35
|
async *data({ signal } = {}) {
|
|
37
|
-
yield* await l({ signal });
|
|
36
|
+
yield* (await l({ signal })).unwrap();
|
|
38
37
|
},
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
40
|
retrieve(id, { signal } = {}) {
|
|
42
41
|
return this.#config
|
|
43
42
|
.sonarV3Request(`arctic/catalogs/${id}`, { signal })
|
|
44
|
-
.
|
|
45
|
-
.
|
|
46
|
-
.catch((e) => Err(e));
|
|
43
|
+
.map((res) => res.json())
|
|
44
|
+
.map((entity) => this._createFromEntity(entity)).promise;
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
//# sourceMappingURL=ArcticResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcticResource.js","sourceRoot":"","sources":["../../../src/cloud/arctic/ArcticResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"ArcticResource.js","sourceRoot":"","sources":["../../../src/cloud/arctic/ArcticResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,aAAa,EACb,+BAA+B,GAEhC,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,cAAc;IAChB,OAAO,CAAgB;IAEhC,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAC,MAA2B;QAC3C,OAAO,IAAI,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CACzC,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,CAAC;aAC7C,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,IAAI,EAKN,CACL;aACA,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9F,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACxC,CAAC;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACnD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAkC,CAAC;aACxD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,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 type { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport {\n ArcticCatalog,\n arcticCatalogEntityToProperties,\n type ArcticCatalogEntity,\n} from \"./ArcticCatalog.ts\";\n\nexport class ArcticResource {\n readonly #config: SonarV3Config;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n }\n\n /**\n * @hidden\n * @internal\n */\n _createFromEntity(entity: ArcticCatalogEntity) {\n return new ArcticCatalog(arcticCatalogEntityToProperties(entity));\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"arctic/catalogs\", { signal })\n .map(\n (res) =>\n res.json() as Promise<{\n data: ArcticCatalogEntity[];\n nextPageToken: string | null;\n previousPageToken: string | null;\n totalResults: number;\n }>,\n )\n .map((response) => response.data.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`arctic/catalogs/${id}`, { signal })\n .map((res) => res.json() as Promise<ArcticCatalogEntity>)\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Result } from "ts-results-es";
|
|
2
1
|
import type { SonarV3Config } from "../../common/Config.ts";
|
|
3
2
|
import { Temporal } from "temporal-polyfill";
|
|
4
3
|
export declare class Engine implements EngineInterface {
|
|
@@ -13,7 +12,7 @@ export declare class Engine implements EngineInterface {
|
|
|
13
12
|
readonly statusChangedAt: EngineInterface["statusChangedAt"];
|
|
14
13
|
readonly queriedAt: EngineInterface["queriedAt"];
|
|
15
14
|
constructor(properties: EngineProperties, config: SonarV3Config);
|
|
16
|
-
update(properties: Partial<EngineConfiguration>): Promise<
|
|
15
|
+
update(properties: Partial<EngineConfiguration>): Promise<Engine>;
|
|
17
16
|
}
|
|
18
17
|
export type EngineSize = "XX_SMALL_V1" | "X_SMALL_V1" | "SMALL_V1" | "MEDIUM_V1" | "LARGE_V1" | "X_LARGE_V1" | "XX_LARGE_V1" | "XXX_LARGE_V1";
|
|
19
18
|
export type EngineConfiguration = {
|
|
@@ -43,6 +42,6 @@ export type EngineProperties = {
|
|
|
43
42
|
readonly queriedAt: Date | null;
|
|
44
43
|
};
|
|
45
44
|
export type EngineMethods = {
|
|
46
|
-
update(properties: Partial<EngineConfiguration>): Promise<
|
|
45
|
+
update(properties: Partial<EngineConfiguration>): Promise<Engine>;
|
|
47
46
|
};
|
|
48
47
|
export type EngineInterface = EngineProperties & EngineMethods;
|
|
@@ -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 { Err, Ok } from "ts-results-es";
|
|
17
16
|
import { engineEntityToProperties, enginePropertiesToEntity } from "./utils.js";
|
|
18
17
|
import { Temporal } from "temporal-polyfill";
|
|
19
18
|
export class Engine {
|
|
@@ -39,8 +38,8 @@ export class Engine {
|
|
|
39
38
|
this.queriedAt = properties.queriedAt;
|
|
40
39
|
this.#config = config;
|
|
41
40
|
}
|
|
42
|
-
update(properties) {
|
|
43
|
-
|
|
41
|
+
async update(properties) {
|
|
42
|
+
const result = await this.#config
|
|
44
43
|
.sonarV3Request(`engines/${this.id}`, {
|
|
45
44
|
body: JSON.stringify({
|
|
46
45
|
...enginePropertiesToEntity(this.configuration),
|
|
@@ -51,9 +50,9 @@ export class Engine {
|
|
|
51
50
|
},
|
|
52
51
|
method: "PUT",
|
|
53
52
|
})
|
|
54
|
-
.
|
|
55
|
-
.
|
|
56
|
-
|
|
53
|
+
.map((res) => res.json())
|
|
54
|
+
.map((properties) => new Engine(engineEntityToProperties(properties), this.#config)).promise;
|
|
55
|
+
return result.unwrap();
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
//# sourceMappingURL=Engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/cloud/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/cloud/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAM;IACR,cAAc,CAAoC;IAClD,yBAAyB,CAA+C;IACxE,aAAa,CAAmC;IAChD,EAAE,CAAwB;IAC1B,cAAc,CAAoC;IAClD,IAAI,CAA0B;IAC9B,KAAK,CAA2B;IAChC,eAAe,CAAqC;IACpD,SAAS,CAA+B;IAEjD,OAAO,CAAgB;IAEvB,YAAY,UAA4B,EAAE,MAAqB;QAC7D,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,yBAAyB,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACtE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAwC;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO;aAC9B,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,GAAG,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC;gBAC/C,GAAG,wBAAwB,CAAC,UAAU,CAAC;aACxC,CAAC;YACF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/F,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;IACzB,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 type { SonarV3Config } from \"../../common/Config.ts\";\nimport { engineEntityToProperties, enginePropertiesToEntity } from \"./utils.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\nexport class Engine implements EngineInterface {\n readonly activeReplicas: EngineInterface[\"activeReplicas\"];\n readonly additionalEngineStateInfo: EngineInterface[\"additionalEngineStateInfo\"];\n readonly configuration: EngineInterface[\"configuration\"];\n readonly id: EngineInterface[\"id\"];\n readonly instanceFamily: EngineInterface[\"instanceFamily\"];\n readonly name: EngineInterface[\"name\"];\n readonly state: EngineInterface[\"state\"];\n readonly statusChangedAt: EngineInterface[\"statusChangedAt\"];\n readonly queriedAt: EngineInterface[\"queriedAt\"];\n\n #config: SonarV3Config;\n\n constructor(properties: EngineProperties, config: SonarV3Config) {\n this.activeReplicas = properties.activeReplicas;\n this.additionalEngineStateInfo = properties.additionalEngineStateInfo;\n this.configuration = properties.configuration;\n this.id = properties.id;\n this.instanceFamily = properties.instanceFamily;\n this.name = properties.name;\n this.state = properties.state;\n this.statusChangedAt = properties.statusChangedAt;\n this.queriedAt = properties.queriedAt;\n this.#config = config;\n }\n\n async update(properties: Partial<EngineConfiguration>): Promise<Engine> {\n const result = await this.#config\n .sonarV3Request(`engines/${this.id}`, {\n body: JSON.stringify({\n ...enginePropertiesToEntity(this.configuration),\n ...enginePropertiesToEntity(properties),\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n method: \"PUT\",\n })\n .map((res) => res.json())\n .map((properties) => new Engine(engineEntityToProperties(properties), this.#config)).promise;\n return result.unwrap();\n }\n}\n\nexport type EngineSize =\n | \"XX_SMALL_V1\"\n | \"X_SMALL_V1\"\n | \"SMALL_V1\"\n | \"MEDIUM_V1\"\n | \"LARGE_V1\"\n | \"X_LARGE_V1\"\n | \"XX_LARGE_V1\"\n | \"XXX_LARGE_V1\";\n\nexport type EngineConfiguration = {\n readonly autoStopDelay: Temporal.Duration;\n readonly cloudTags: { key: string; value: string }[];\n readonly description: string | null;\n readonly drainTimeLimit: Temporal.Duration;\n readonly maxConcurrency: number;\n readonly maxReplicas: number;\n readonly minReplicas: number;\n readonly queueTimeLimit: Temporal.Duration;\n readonly runTimeLimit: Temporal.Duration;\n readonly size: EngineSize;\n};\n\nexport type EngineProperties = {\n readonly activeReplicas: number;\n readonly additionalEngineStateInfo: \"NONE\";\n readonly configuration: EngineConfiguration;\n readonly id: string;\n readonly instanceFamily: unknown;\n readonly name: string;\n readonly state: \"DELETING\" | \"DISABLED\" | \"DISABLING\" | \"ENABLED\" | \"ENABLING\" | \"INVALID\";\n readonly statusChangedAt: Date;\n readonly queriedAt: Date | null;\n};\n\nexport type EngineMethods = {\n update(properties: Partial<EngineConfiguration>): Promise<Engine>;\n};\n\nexport type EngineInterface = EngineProperties & EngineMethods;\n"]}
|
|
@@ -8,5 +8,5 @@ export declare class EnginesResource {
|
|
|
8
8
|
list(): {
|
|
9
9
|
data({ signal }?: SignalParam): AsyncGenerator<Engine, void, unknown>;
|
|
10
10
|
};
|
|
11
|
-
retrieve(id: string): Promise<Engine
|
|
11
|
+
retrieve(id: string): Promise<import("ts-results-es").Result<Engine, import("../index.ts").HttpError>>;
|
|
12
12
|
}
|
|
@@ -26,19 +26,19 @@ export class EnginesResource {
|
|
|
26
26
|
list() {
|
|
27
27
|
const l = ({ signal } = {}) => this.#config
|
|
28
28
|
.sonarV3Request("engines", { signal })
|
|
29
|
-
.
|
|
30
|
-
.
|
|
29
|
+
.map((res) => res.json())
|
|
30
|
+
.map((engines) => engines.map((entity) => this._createFromEntity(entity))).promise;
|
|
31
31
|
return {
|
|
32
32
|
async *data({ signal } = {}) {
|
|
33
|
-
yield* await l({ signal });
|
|
33
|
+
yield* (await l({ signal })).unwrap();
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
retrieve(id) {
|
|
38
38
|
return this.#config
|
|
39
39
|
.sonarV3Request(`engines/${id}`)
|
|
40
|
-
.
|
|
41
|
-
.
|
|
40
|
+
.map((res) => res.json())
|
|
41
|
+
.map((entity) => this._createFromEntity(entity)).promise;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
//# sourceMappingURL=EnginesResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/cloud/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGtD,MAAM,OAAO,eAAe;IACjB,OAAO,CAAiC;IAEjD,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,UAAmB;QACnC,OAAO,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACxE,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CACzC,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC;aACrC,
|
|
1
|
+
{"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/cloud/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGtD,MAAM,OAAO,eAAe;IACjB,OAAO,CAAiC;IAEjD,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,UAAmB;QACnC,OAAO,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACxE,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CACzC,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC;aACrC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAwB,CAAC;aAC9C,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACvF,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACxC,CAAC;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,EAAE,EAAE,CAAC;aAC/B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,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 type { ResourceConfig, SonarV3Config } from \"../../common/Config.ts\";\nimport { Engine } from \"./Engine.ts\";\nimport { engineEntityToProperties } from \"./utils.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class EnginesResource {\n readonly #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n _createFromEntity(properties: unknown) {\n return new Engine(engineEntityToProperties(properties), this.#config);\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"engines\", { signal })\n .map((res) => res.json() as Promise<unknown[]>)\n .map((engines) => engines.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n retrieve(id: string) {\n return this.#config\n .sonarV3Request(`engines/${id}`)\n .map((res) => res.json())\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}
|
package/dist/cloud/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Config } from "../common/Config.ts";
|
|
2
|
-
import { Resources } from "./resources.ts";
|
|
3
2
|
export declare const Dremio: (config: Config) => {
|
|
4
3
|
_request: import("../common/Config.ts").RequestFn;
|
|
5
4
|
_sonarResourceConfig: (projectId?: string) => {
|
|
@@ -11,10 +10,10 @@ export declare const Dremio: (config: Config) => {
|
|
|
11
10
|
} | undefined;
|
|
12
11
|
origin: string;
|
|
13
12
|
request: import("../common/Config.ts").RequestFn;
|
|
14
|
-
sonarV3Request: (path: string, init?: RequestInit) =>
|
|
15
|
-
v3Request: (path: string, init?: RequestInit) =>
|
|
13
|
+
sonarV3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
|
|
14
|
+
v3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
|
|
16
15
|
};
|
|
17
|
-
_sonarV3Request: (projectId: string) => (path: string, init?: RequestInit) =>
|
|
16
|
+
_sonarV3Request: (projectId: string) => (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
|
|
18
17
|
ai: import("./ai/AiResource.ts").AiResource;
|
|
19
18
|
arctic: import("moize").Moized<(projectId: string) => import("./arctic/ArcticResource.ts").ArcticResource, Partial<{
|
|
20
19
|
isDeepEqual: boolean;
|
|
@@ -310,4 +309,3 @@ export * from "../common/sharedExports.ts";
|
|
|
310
309
|
export * from "./credentials/index.ts";
|
|
311
310
|
export * from "./interfaces.ts";
|
|
312
311
|
export * from "./oauth/oauth.ts";
|
|
313
|
-
export { Resources as _Resources };
|
package/dist/cloud/index.js
CHANGED
package/dist/cloud/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,SAAkB,EAAE,EAAE;IACxE,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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,SAAkB,EAAE,EAAE;IACxE,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,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;KAC1B,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC;QAC/B,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,cAAc;KACtF,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,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 { Config, ResourceConfig, SonarV3Config, V3Config } from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\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 } satisfies ResourceConfig & SonarV3Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: createRequest(config),\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV3Request: (projectId: string) => sonarResourceConfig(projectId).sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport * from \"./oauth/oauth.ts\";\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Err, Ok } from "ts-results-es";
|
|
2
1
|
import type { ResourceConfig } from "../../common/Config.ts";
|
|
3
2
|
export declare class OAuthApplication {
|
|
4
3
|
#private;
|
|
@@ -6,7 +5,7 @@ export declare class OAuthApplication {
|
|
|
6
5
|
readonly name: OAuthApplicationProperties["name"];
|
|
7
6
|
readonly state: OAuthApplicationProperties["state"];
|
|
8
7
|
constructor(properties: OAuthApplicationProperties, config: ResourceConfig);
|
|
9
|
-
delete(): Promise<
|
|
8
|
+
delete(): Promise<import("ts-results-es").Result<void, import("../index.ts").HttpError>>;
|
|
10
9
|
}
|
|
11
10
|
export type OAuthApplicationProperties = {
|
|
12
11
|
id: 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 { Err, Ok } from "ts-results-es";
|
|
17
16
|
export class OAuthApplication {
|
|
18
17
|
id;
|
|
19
18
|
name;
|
|
@@ -31,8 +30,7 @@ export class OAuthApplication {
|
|
|
31
30
|
keepalive: true,
|
|
32
31
|
method: "DELETE",
|
|
33
32
|
})
|
|
34
|
-
.
|
|
35
|
-
.catch((e) => Err(e));
|
|
33
|
+
.map(() => undefined).promise;
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
export class OAuthApplicationDetails extends OAuthApplication {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthApplication.js","sourceRoot":"","sources":["../../../src/cloud/oauth/OAuthApplication.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"OAuthApplication.js","sourceRoot":"","sources":["../../../src/cloud/oauth/OAuthApplication.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,OAAO,gBAAgB;IAClB,EAAE,CAAmC;IACrC,IAAI,CAAqC;IACzC,KAAK,CAAsC;IAC3C,OAAO,CAAiB;IAEjC,YAAY,UAAsC,EAAE,MAAsB;QACxE,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO;aAChB,OAAO,CACN,IAAI,GAAG,CACL,0BAA0B,IAAI,CAAC,EAAE,EAAE,EACnC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAC1C,CAAC,QAAQ,EAAE,EACZ;YACE,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,QAAQ;SACjB,CACF;aACA,GAAG,CAAC,GAAG,EAAE,CAAC,SAAiB,CAAC,CAAC,OAAO,CAAC;IAC1C,CAAC;CACF;AAQD,MAAM,OAAO,uBAAwB,SAAQ,gBAAgB;IAClD,QAAQ,CAAgD;IACxD,YAAY,CAAoD;IAChE,IAAI,CAA4C;IAEzD,YAAY,UAA6C,EAAE,MAAsB;QAC/E,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC9B,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 type { ResourceConfig } from \"../../common/Config.ts\";\n\nexport class OAuthApplication {\n readonly id: OAuthApplicationProperties[\"id\"];\n readonly name: OAuthApplicationProperties[\"name\"];\n readonly state: OAuthApplicationProperties[\"state\"];\n readonly #config: ResourceConfig;\n\n constructor(properties: OAuthApplicationProperties, config: ResourceConfig) {\n this.id = properties.id;\n this.name = properties.name;\n this.state = properties.state;\n this.#config = config;\n }\n\n delete() {\n return this.#config\n .request(\n new URL(\n `/ui/oauth-applications/${this.id}`,\n this.#config.origin.replace(\"api\", \"app\"),\n ).toString(),\n {\n keepalive: true,\n method: \"DELETE\",\n },\n )\n .map(() => undefined as void).promise;\n }\n}\n\nexport type OAuthApplicationProperties = {\n id: string;\n name: string;\n state: \"ENABLED\" | \"DISABLED\";\n};\n\nexport class OAuthApplicationDetails extends OAuthApplication {\n readonly clientId: OAuthApplicationDetailsProperties[\"clientId\"];\n readonly redirectUris: OAuthApplicationDetailsProperties[\"redirectUris\"];\n readonly type: OAuthApplicationDetailsProperties[\"type\"];\n\n constructor(properties: OAuthApplicationDetailsProperties, config: ResourceConfig) {\n super(properties, config);\n this.clientId = properties.clientId;\n this.redirectUris = properties.redirectUris;\n this.type = properties.type;\n }\n}\n\nexport type OAuthApplicationDetailsProperties = OAuthApplicationProperties & {\n clientId: string;\n redirectUris: Set<string>;\n type: \"NATIVE\" | \"REGULAR_WEB\" | \"SPA\";\n};\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Err, Ok } from "ts-results-es";
|
|
2
1
|
import type { ResourceConfig } from "../../common/Config.ts";
|
|
3
2
|
import type { SignalParam } from "../../common/Params.ts";
|
|
4
3
|
import { OAuthApplication, OAuthApplicationDetails } from "./OAuthApplication.ts";
|
|
@@ -9,9 +8,9 @@ export declare class OAuthApplicationsResource {
|
|
|
9
8
|
name: OAuthApplicationDetails["name"];
|
|
10
9
|
redirectUris: OAuthApplicationDetails["redirectUris"];
|
|
11
10
|
type: OAuthApplicationDetails["type"];
|
|
12
|
-
}): Promise<
|
|
11
|
+
}): Promise<import("ts-results-es").Result<string, import("../index.ts").HttpError>>;
|
|
13
12
|
list(): {
|
|
14
13
|
data({ signal }?: SignalParam): AsyncGenerator<OAuthApplication, void, unknown>;
|
|
15
14
|
};
|
|
16
|
-
retrieve(id: string, { signal }?: SignalParam): Promise<
|
|
15
|
+
retrieve(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<OAuthApplicationDetails, import("../index.ts").HttpError>>;
|
|
17
16
|
}
|
|
@@ -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 { Err, Ok } from "ts-results-es";
|
|
17
16
|
import { OAuthApplication, OAuthApplicationDetails, } from "./OAuthApplication.js";
|
|
18
17
|
export class OAuthApplicationsResource {
|
|
19
18
|
#config;
|
|
@@ -34,9 +33,8 @@ export class OAuthApplicationsResource {
|
|
|
34
33
|
keepalive: true,
|
|
35
34
|
method: "POST",
|
|
36
35
|
})
|
|
37
|
-
.
|
|
38
|
-
.
|
|
39
|
-
.catch((e) => Err(e));
|
|
36
|
+
.map((res) => res.json())
|
|
37
|
+
.map((result) => result.id).promise;
|
|
40
38
|
}
|
|
41
39
|
list() {
|
|
42
40
|
const l = ({ signal } = {}) => this.#config
|
|
@@ -46,11 +44,11 @@ export class OAuthApplicationsResource {
|
|
|
46
44
|
},
|
|
47
45
|
signal,
|
|
48
46
|
})
|
|
49
|
-
.
|
|
50
|
-
.
|
|
47
|
+
.map((res) => res.json())
|
|
48
|
+
.map((oauthApplications) => oauthApplications.map((properties) => new OAuthApplication(properties, this.#config))).promise;
|
|
51
49
|
return {
|
|
52
50
|
async *data({ signal } = {}) {
|
|
53
|
-
yield* await l({ signal });
|
|
51
|
+
yield* (await l({ signal })).unwrap();
|
|
54
52
|
},
|
|
55
53
|
};
|
|
56
54
|
}
|
|
@@ -62,12 +60,11 @@ export class OAuthApplicationsResource {
|
|
|
62
60
|
},
|
|
63
61
|
signal,
|
|
64
62
|
})
|
|
65
|
-
.
|
|
66
|
-
.
|
|
63
|
+
.map((res) => res.json())
|
|
64
|
+
.map((entity) => new OAuthApplicationDetails({
|
|
67
65
|
...entity,
|
|
68
66
|
redirectUris: new Set(entity.redirectUris),
|
|
69
|
-
}, this.#config))
|
|
70
|
-
.catch((e) => Err(e));
|
|
67
|
+
}, this.#config)).promise;
|
|
71
68
|
}
|
|
72
69
|
}
|
|
73
70
|
//# sourceMappingURL=OAuthApplicationsResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthApplicationsResource.js","sourceRoot":"","sources":["../../../src/cloud/oauth/OAuthApplicationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"OAuthApplicationsResource.js","sourceRoot":"","sources":["../../../src/cloud/oauth/OAuthApplicationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,OAAO,yBAAyB;IAC3B,OAAO,CAAiB;IAEjC,YAAY,MAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,MAIN;QACC,OAAO,IAAI,CAAC,OAAO;aAChB,OAAO,CACN,IAAI,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EACvF;YACE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,GAAG,MAAM;gBACT,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;aAC9C,CAAC;YACF,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,MAAM;SACf,CACF;aACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA6B,CAAC;aACnD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACxC,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CACzC,IAAI,CAAC,OAAO;aACT,OAAO,CACN,IAAI,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EACvF;YACE,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CACF;aACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA2C,CAAC;aACjE,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CACzB,iBAAiB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACtF,CAAC,OAAO,CAAC;QACd,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACxC,CAAC;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,OAAO,IAAI,CAAC,OAAO;aAChB,OAAO,CACN,IAAI,GAAG,CACL,0BAA0B,EAAE,EAAE,EAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAC1C,CAAC,QAAQ,EAAE,EACZ;YACE,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CACF;aACA,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,IAAI,EAMP,CACJ;aACA,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CACT,IAAI,uBAAuB,CACzB;YACE,GAAG,MAAM;YACT,YAAY,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC;SAC3C,EACD,IAAI,CAAC,OAAO,CACb,CACJ,CAAC,OAAO,CAAC;IACd,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 type { ResourceConfig } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport {\n OAuthApplication,\n OAuthApplicationDetails,\n type OAuthApplicationProperties,\n} from \"./OAuthApplication.ts\";\n\nexport class OAuthApplicationsResource {\n readonly #config: ResourceConfig;\n\n constructor(config: ResourceConfig) {\n this.#config = config;\n }\n\n create(params: {\n name: OAuthApplicationDetails[\"name\"];\n redirectUris: OAuthApplicationDetails[\"redirectUris\"];\n type: OAuthApplicationDetails[\"type\"];\n }) {\n return this.#config\n .request(\n new URL(\"/ui/oauth-applications\", this.#config.origin.replace(\"api\", \"app\")).toString(),\n {\n body: JSON.stringify({\n ...params,\n redirectUris: Array.from(params.redirectUris),\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n },\n )\n .map((res) => res.json() as Promise<{ id: string }>)\n .map((result) => result.id).promise;\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .request(\n new URL(\"/ui/oauth-applications\", this.#config.origin.replace(\"api\", \"app\")).toString(),\n {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n },\n )\n .map((res) => res.json() as Promise<OAuthApplicationProperties[]>)\n .map((oauthApplications) =>\n oauthApplications.map((properties) => new OAuthApplication(properties, this.#config)),\n ).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .request(\n new URL(\n `/ui/oauth-applications/${id}`,\n this.#config.origin.replace(\"api\", \"app\"),\n ).toString(),\n {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n },\n )\n .map(\n (res) =>\n res.json() as Promise<\n OAuthApplicationProperties & {\n clientId: string;\n redirectUris: string[];\n type: OAuthApplicationDetails[\"type\"];\n }\n >,\n )\n .map(\n (entity) =>\n new OAuthApplicationDetails(\n {\n ...entity,\n redirectUris: new Set(entity.redirectUris),\n },\n this.#config,\n ),\n ).promise;\n }\n}\n"]}
|
|
@@ -18,8 +18,8 @@ export declare class Project implements ProjectInterface {
|
|
|
18
18
|
readonly state: ProjectInterface["state"];
|
|
19
19
|
readonly type: ProjectInterface["type"];
|
|
20
20
|
constructor(properties: ProjectProperties, projectsResource: ProjectsResource);
|
|
21
|
-
activate(): Promise<
|
|
22
|
-
delete(): Promise<
|
|
21
|
+
activate(): Promise<Result<undefined, import("../index.ts").HttpError>>;
|
|
22
|
+
delete(): Promise<Result<undefined, import("../index.ts").HttpError>>;
|
|
23
23
|
get settled(): boolean;
|
|
24
24
|
}
|
|
25
25
|
export type ProjectProperties = {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { ResourceConfig, V3Config } from "../../common/Config.ts";
|
|
2
2
|
import { Project } from "./Project.ts";
|
|
3
3
|
import type { SignalParam } from "../../common/Params.ts";
|
|
4
|
-
import { Err, Ok, Result } from "ts-results-es";
|
|
5
4
|
export declare class ProjectsResource {
|
|
6
5
|
#private;
|
|
7
6
|
constructor(config: ResourceConfig & V3Config);
|
|
8
7
|
_createFromEntity(properties: unknown): Project;
|
|
9
|
-
activate(id: string): Promise<
|
|
10
|
-
delete(id: string): Promise<
|
|
8
|
+
activate(id: string): Promise<import("ts-results-es").Result<undefined, import("../index.ts").HttpError>>;
|
|
9
|
+
delete(id: string): Promise<import("ts-results-es").Result<undefined, import("../index.ts").HttpError>>;
|
|
11
10
|
list(): {
|
|
12
11
|
data({ signal }?: SignalParam): AsyncGenerator<Project, void, unknown>;
|
|
13
12
|
};
|
|
14
13
|
observe(id: string): import("rxjs").Observable<Project>;
|
|
15
|
-
retrieve(id: string, { signal }?: SignalParam): Promise<Result<Project,
|
|
14
|
+
retrieve(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<Project, import("../index.ts").HttpError>>;
|
|
16
15
|
}
|
|
@@ -17,7 +17,6 @@ import { Project } from "./Project.js";
|
|
|
17
17
|
import { projectEntityToProperties } from "./utils.js";
|
|
18
18
|
import { fromAbortable } from "../../common/fromAbortable.js";
|
|
19
19
|
import { share, switchMap, timer } from "rxjs";
|
|
20
|
-
import { Err, Ok, Result } from "ts-results-es";
|
|
21
20
|
export class ProjectsResource {
|
|
22
21
|
#config;
|
|
23
22
|
constructor(config) {
|
|
@@ -32,40 +31,32 @@ export class ProjectsResource {
|
|
|
32
31
|
keepalive: true,
|
|
33
32
|
method: "PUT",
|
|
34
33
|
})
|
|
35
|
-
.
|
|
36
|
-
.catch((e) => Err(e));
|
|
34
|
+
.map(() => undefined).promise;
|
|
37
35
|
}
|
|
38
36
|
delete(id) {
|
|
39
37
|
return this.#config
|
|
40
38
|
.v3Request(`projects/${id}`, { keepalive: true, method: "DELETE" })
|
|
41
|
-
.
|
|
42
|
-
.catch((e) => Err(e));
|
|
39
|
+
.map(() => undefined).promise;
|
|
43
40
|
}
|
|
44
41
|
list() {
|
|
45
42
|
const l = ({ signal } = {}) => this.#config
|
|
46
43
|
.v3Request("projects", { signal })
|
|
47
|
-
.
|
|
48
|
-
.
|
|
44
|
+
.map((res) => res.json())
|
|
45
|
+
.map((projects) => projects.map((entity) => this._createFromEntity(entity))).promise;
|
|
49
46
|
return {
|
|
50
47
|
async *data({ signal } = {}) {
|
|
51
|
-
yield* await l({ signal });
|
|
48
|
+
yield* (await l({ signal })).unwrap();
|
|
52
49
|
},
|
|
53
50
|
};
|
|
54
51
|
}
|
|
55
52
|
observe(id) {
|
|
56
|
-
return timer(0, 5000).pipe(switchMap(() => fromAbortable(({ signal }) => this.retrieve(id, { signal }).then((result) =>
|
|
57
|
-
if (result.isErr()) {
|
|
58
|
-
throw result.error;
|
|
59
|
-
}
|
|
60
|
-
return result.value;
|
|
61
|
-
}))), share());
|
|
53
|
+
return timer(0, 5000).pipe(switchMap(() => fromAbortable(({ signal }) => this.retrieve(id, { signal }).then((result) => result.unwrap()))), share());
|
|
62
54
|
}
|
|
63
55
|
retrieve(id, { signal } = {}) {
|
|
64
56
|
return this.#config
|
|
65
57
|
.v3Request(`projects/${id}`, { signal })
|
|
66
|
-
.
|
|
67
|
-
.
|
|
68
|
-
.catch((e) => Err(e));
|
|
58
|
+
.map((res) => res.json())
|
|
59
|
+
.map((entity) => this._createFromEntity(entity)).promise;
|
|
69
60
|
}
|
|
70
61
|
}
|
|
71
62
|
//# sourceMappingURL=ProjectsResource.js.map
|