@dremio/js-sdk 0.8.0 → 0.10.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/cloud/arctic/ArcticResource.d.ts +8 -6
- package/dist/cloud/arctic/ArcticResource.js +28 -19
- package/dist/cloud/arctic/ArcticResource.js.map +1 -1
- package/dist/cloud/engines/EnginesResource.d.ts +8 -11
- package/dist/cloud/engines/EnginesResource.js +24 -22
- package/dist/cloud/engines/EnginesResource.js.map +1 -1
- package/dist/cloud/index.d.ts +30 -209
- package/dist/cloud/oauth/OAuthApplicationsResource.d.ts +8 -6
- package/dist/cloud/oauth/OAuthApplicationsResource.js +33 -26
- package/dist/cloud/oauth/OAuthApplicationsResource.js.map +1 -1
- package/dist/cloud/projects/Project.d.ts +2 -2
- package/dist/cloud/projects/Project.js +5 -5
- package/dist/cloud/projects/Project.js.map +1 -1
- package/dist/cloud/projects/ProjectsResource.d.ts +11 -12
- package/dist/cloud/projects/ProjectsResource.js +47 -26
- package/dist/cloud/projects/ProjectsResource.js.map +1 -1
- package/dist/cloud/resources.d.ts +39 -209
- package/dist/cloud/resources.js +9 -9
- package/dist/cloud/resources.js.map +1 -1
- package/dist/cloud/users/CloudUsersResource.d.ts +8 -10
- package/dist/cloud/users/CloudUsersResource.js +19 -15
- package/dist/cloud/users/CloudUsersResource.js.map +1 -1
- package/dist/common/HttpError.js +4 -2
- package/dist/common/HttpError.js.map +1 -1
- package/dist/common/Query.js +1 -2
- package/dist/common/Query.js.map +1 -1
- package/dist/enterprise/catalog/CatalogObjects/index.d.ts +1 -2
- package/dist/enterprise/catalog/CatalogObjects/index.js.map +1 -1
- package/dist/enterprise/catalog/EnterpriseCatalogResource.d.ts +9 -6
- package/dist/enterprise/catalog/EnterpriseCatalogResource.js +24 -19
- package/dist/enterprise/catalog/EnterpriseCatalogResource.js.map +1 -1
- package/dist/enterprise/catalog/catalogObjectFromEntity.js +0 -8
- package/dist/enterprise/catalog/catalogObjectFromEntity.js.map +1 -1
- package/dist/enterprise/index.d.ts +5 -36
- package/dist/enterprise/resources.d.ts +10 -36
- package/dist/enterprise/resources.js +5 -5
- package/dist/enterprise/resources.js.map +1 -1
- package/dist/enterprise/roles/RolesResource.d.ts +6 -4
- package/dist/enterprise/roles/RolesResource.js +14 -8
- package/dist/enterprise/roles/RolesResource.js.map +1 -1
- package/dist/enterprise/scripts/EnterpriseScript.d.ts +1 -1
- package/dist/enterprise/scripts/EnterpriseScript.js +1 -1
- package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
- package/dist/enterprise/scripts/EnterpriseScriptsResource.d.ts +9 -7
- package/dist/enterprise/scripts/EnterpriseScriptsResource.js +24 -55
- package/dist/enterprise/scripts/EnterpriseScriptsResource.js.map +1 -1
- package/dist/enterprise/users/EnterpriseUser.d.ts +11 -2
- package/dist/enterprise/users/EnterpriseUser.js +6 -0
- package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
- package/dist/enterprise/users/EnterpriseUsersResource.d.ts +9 -9
- package/dist/enterprise/users/EnterpriseUsersResource.js +20 -11
- package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
- package/dist/oss/catalog/CatalogObjects/index.d.ts +2 -3
- package/dist/oss/catalog/CatalogObjects/index.js.map +1 -1
- package/dist/oss/catalog/CatalogObjects/utils/catalogObjectFromEntity.d.ts +1 -2
- package/dist/oss/catalog/CatalogObjects/utils/catalogObjectFromEntity.js +0 -8
- package/dist/oss/catalog/CatalogObjects/utils/catalogObjectFromEntity.js.map +1 -1
- package/dist/oss/catalog/CatalogReferences/SourceCatalogReference.js +4 -4
- package/dist/oss/catalog/CatalogReferences/SourceCatalogReference.js.map +1 -1
- package/dist/oss/catalog/CatalogResource.d.ts +9 -6
- package/dist/oss/catalog/CatalogResource.js +24 -19
- package/dist/oss/catalog/CatalogResource.js.map +1 -1
- package/dist/oss/catalog/VersionReference.d.ts +12 -12
- package/dist/oss/catalog/VersionReference.js +18 -3
- package/dist/oss/catalog/VersionReference.js.map +1 -1
- package/dist/oss/index.d.ts +4 -32
- package/dist/oss/interfaces.d.ts +2 -2
- package/dist/oss/interfaces.js +1 -0
- package/dist/oss/interfaces.js.map +1 -1
- package/dist/oss/jobs/Job.d.ts +2 -42
- package/dist/oss/jobs/Job.js +0 -18
- package/dist/oss/jobs/Job.js.map +1 -1
- package/dist/oss/jobs/JobsResource.d.ts +11 -7
- package/dist/oss/jobs/JobsResource.js +50 -42
- package/dist/oss/jobs/JobsResource.js.map +1 -1
- package/dist/oss/jobs/utils/jobEntityToProperties.d.ts +40 -0
- package/dist/oss/jobs/utils/jobEntityToProperties.js +34 -0
- package/dist/oss/jobs/utils/jobEntityToProperties.js.map +1 -0
- package/dist/oss/resources.d.ts +8 -36
- package/dist/oss/resources.js +4 -8
- package/dist/oss/resources.js.map +1 -1
- package/dist/oss/scripts/ScriptsResource.d.ts +15 -6
- package/dist/oss/scripts/ScriptsResource.js +53 -45
- package/dist/oss/scripts/ScriptsResource.js.map +1 -1
- package/dist/oss/users/User.d.ts +9 -10
- package/dist/oss/users/User.js.map +1 -1
- package/dist/oss/users/UsersResource.d.ts +9 -9
- package/dist/oss/users/UsersResource.js +19 -10
- package/dist/oss/users/UsersResource.js.map +1 -1
- package/package.json +11 -13
- package/dist/cloud/projects/projectApiMethods.d.ts +0 -9
- package/dist/cloud/projects/projectApiMethods.js +0 -43
- package/dist/cloud/projects/projectApiMethods.js.map +0 -1
- package/dist/oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.d.ts +0 -31
- package/dist/oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.js +0 -58
- package/dist/oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.js.map +0 -1
|
@@ -15,10 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Err, Ok } from "ts-results-es";
|
|
17
17
|
import { OAuthApplication, OAuthApplicationDetails, } from "./OAuthApplication.js";
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export class OAuthApplicationsResource {
|
|
19
|
+
#config;
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.#config = config;
|
|
22
|
+
}
|
|
23
|
+
create(params) {
|
|
24
|
+
return this.#config
|
|
25
|
+
.request(new URL("/ui/oauth-applications", this.#config.origin.replace("api", "app")).toString(), {
|
|
22
26
|
body: JSON.stringify({
|
|
23
27
|
...params,
|
|
24
28
|
redirectUris: Array.from(params.redirectUris),
|
|
@@ -32,24 +36,27 @@ export const OAuthApplicationsResource = (config) => {
|
|
|
32
36
|
})
|
|
33
37
|
.then((res) => res.json())
|
|
34
38
|
.then((result) => Ok(result.id))
|
|
35
|
-
.catch((e) => Err(e))
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
.catch((e) => Err(e));
|
|
40
|
+
}
|
|
41
|
+
list() {
|
|
42
|
+
const l = ({ signal } = {}) => this.#config
|
|
43
|
+
.request(new URL("/ui/oauth-applications", this.#config.origin.replace("api", "app")).toString(), {
|
|
44
|
+
headers: {
|
|
45
|
+
Accept: "application/json",
|
|
46
|
+
},
|
|
47
|
+
signal,
|
|
48
|
+
})
|
|
49
|
+
.then((res) => res.json())
|
|
50
|
+
.then((oauthApplications) => oauthApplications.map((properties) => new OAuthApplication(properties, this.#config)));
|
|
51
|
+
return {
|
|
52
|
+
async *data({ signal } = {}) {
|
|
53
|
+
yield* await l({ signal });
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
retrieve(id, { signal } = {}) {
|
|
58
|
+
return this.#config
|
|
59
|
+
.request(new URL(`/ui/oauth-applications/${id}`, this.#config.origin.replace("api", "app")).toString(), {
|
|
53
60
|
headers: {
|
|
54
61
|
Accept: "application/json",
|
|
55
62
|
},
|
|
@@ -59,8 +66,8 @@ export const OAuthApplicationsResource = (config) => {
|
|
|
59
66
|
.then((entity) => Ok(new OAuthApplicationDetails({
|
|
60
67
|
...entity,
|
|
61
68
|
redirectUris: new Set(entity.redirectUris),
|
|
62
|
-
}, config)))
|
|
63
|
-
.catch((e) => Err(e))
|
|
64
|
-
}
|
|
65
|
-
}
|
|
69
|
+
}, this.#config)))
|
|
70
|
+
.catch((e) => Err(e));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
66
73
|
//# sourceMappingURL=OAuthApplicationsResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthApplicationsResource.js","sourceRoot":"","sources":["../../../src/cloud/oauth/OAuthApplicationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GAExB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,
|
|
1
|
+
{"version":3,"file":"OAuthApplicationsResource.js","sourceRoot":"","sources":["../../../src/cloud/oauth/OAuthApplicationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAGxC,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,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,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7B,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,IAAI,CACH,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,IAAI,EAMP,CACJ;aACA,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CACf,EAAE,CACA,IAAI,uBAAuB,CACzB;YACE,GAAG,MAAM;YACT,YAAY,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC;SAC3C,EACD,IAAI,CAAC,OAAO,CACb,CACF,CACF;aACA,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,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 } 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 .then((res) => res.json() as Promise<{ id: string }>)\n .then((result) => Ok(result.id))\n .catch((e: unknown) => Err(e));\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 .then((res) => res.json() as Promise<OAuthApplicationProperties[]>)\n .then((oauthApplications) =>\n oauthApplications.map((properties) => new OAuthApplication(properties, this.#config)),\n );\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await l({ signal });\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 .then(\n (res) =>\n res.json() as Promise<\n OAuthApplicationProperties & {\n clientId: string;\n redirectUris: string[];\n type: OAuthApplicationDetails[\"type\"];\n }\n >,\n )\n .then((entity) =>\n Ok(\n new OAuthApplicationDetails(\n {\n ...entity,\n redirectUris: new Set(entity.redirectUris),\n },\n this.#config,\n ),\n ),\n )\n .catch((e: unknown) => Err(e));\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Result } from "ts-results-es";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ProjectsResource } from "./ProjectsResource.ts";
|
|
3
3
|
export declare class Project implements ProjectInterface {
|
|
4
4
|
#private;
|
|
5
5
|
readonly cloudId: ProjectInterface["cloudId"];
|
|
@@ -17,7 +17,7 @@ export declare class Project implements ProjectInterface {
|
|
|
17
17
|
readonly projectStore: ProjectInterface["projectStore"];
|
|
18
18
|
readonly state: ProjectInterface["state"];
|
|
19
19
|
readonly type: ProjectInterface["type"];
|
|
20
|
-
constructor(properties: ProjectProperties,
|
|
20
|
+
constructor(properties: ProjectProperties, projectsResource: ProjectsResource);
|
|
21
21
|
activate(): Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<undefined>>;
|
|
22
22
|
delete(): Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<undefined>>;
|
|
23
23
|
get settled(): boolean;
|
|
@@ -29,8 +29,8 @@ export class Project {
|
|
|
29
29
|
projectStore;
|
|
30
30
|
state;
|
|
31
31
|
type;
|
|
32
|
-
#
|
|
33
|
-
constructor(properties,
|
|
32
|
+
#projectsResource;
|
|
33
|
+
constructor(properties, projectsResource) {
|
|
34
34
|
this.cloudId = properties.cloudId;
|
|
35
35
|
this.cloudType = properties.cloudType;
|
|
36
36
|
this.createdAt = properties.createdAt;
|
|
@@ -46,13 +46,13 @@ export class Project {
|
|
|
46
46
|
this.projectStore = properties.projectStore;
|
|
47
47
|
this.state = properties.state;
|
|
48
48
|
this.type = properties.type;
|
|
49
|
-
this.#
|
|
49
|
+
this.#projectsResource = projectsResource;
|
|
50
50
|
}
|
|
51
51
|
activate() {
|
|
52
|
-
return this.#
|
|
52
|
+
return this.#projectsResource.activate(this.id);
|
|
53
53
|
}
|
|
54
54
|
delete() {
|
|
55
|
-
return this.#
|
|
55
|
+
return this.#projectsResource.delete(this.id);
|
|
56
56
|
}
|
|
57
57
|
get settled() {
|
|
58
58
|
return this.state === "ACTIVE" || this.state === "ARCHIVED" || this.state === "INACTIVE";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,OAAO;IACT,OAAO,CAA8B;IACrC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,WAAW,CAAkC;IAC7C,EAAE,CAAyB;IAC3B,cAAc,CAAqC;IACnD,UAAU,CAAiC;IAC3C,UAAU,CAAiC;IAC3C,IAAI,CAA2B;IAC/B,eAAe,CAAsC;IACrD,cAAc,CAAqC;IACnD,YAAY,CAAmC;IAC/C,KAAK,CAA4B;IACjC,IAAI,CAA2B;IAExC,
|
|
1
|
+
{"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,OAAO;IACT,OAAO,CAA8B;IACrC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,WAAW,CAAkC;IAC7C,EAAE,CAAyB;IAC3B,cAAc,CAAqC;IACnD,UAAU,CAAiC;IAC3C,UAAU,CAAiC;IAC3C,IAAI,CAA2B;IAC/B,eAAe,CAAsC;IACrD,cAAc,CAAqC;IACnD,YAAY,CAAmC;IAC/C,KAAK,CAA4B;IACjC,IAAI,CAA2B;IAExC,iBAAiB,CAAmB;IAEpC,YAAY,UAA6B,EAAE,gBAAkC;QAC3E,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;IAC3F,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 { Result } from \"ts-results-es\";\nimport type { ProjectsResource } from \"./ProjectsResource.ts\";\n\nexport class Project implements ProjectInterface {\n readonly cloudId: ProjectInterface[\"cloudId\"];\n readonly cloudType: ProjectInterface[\"cloudType\"];\n readonly createdAt: ProjectInterface[\"createdAt\"];\n readonly createdBy: ProjectInterface[\"createdBy\"];\n readonly credentials: ProjectInterface[\"credentials\"];\n readonly id: ProjectInterface[\"id\"];\n readonly lastStateError: ProjectInterface[\"lastStateError\"];\n readonly modifiedAt: ProjectInterface[\"modifiedAt\"];\n readonly modifiedBy: ProjectInterface[\"modifiedBy\"];\n readonly name: ProjectInterface[\"name\"];\n readonly numberOfEngines: ProjectInterface[\"numberOfEngines\"];\n readonly primaryCatalog: ProjectInterface[\"primaryCatalog\"];\n readonly projectStore: ProjectInterface[\"projectStore\"];\n readonly state: ProjectInterface[\"state\"];\n readonly type: ProjectInterface[\"type\"];\n\n #projectsResource: ProjectsResource;\n\n constructor(properties: ProjectProperties, projectsResource: ProjectsResource) {\n this.cloudId = properties.cloudId;\n this.cloudType = properties.cloudType;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.credentials = properties.credentials;\n this.id = properties.id;\n this.lastStateError = properties.lastStateError;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.numberOfEngines = properties.numberOfEngines;\n this.primaryCatalog = properties.primaryCatalog;\n this.projectStore = properties.projectStore;\n this.state = properties.state;\n this.type = properties.type;\n this.#projectsResource = projectsResource;\n }\n\n activate() {\n return this.#projectsResource.activate(this.id);\n }\n\n delete() {\n return this.#projectsResource.delete(this.id);\n }\n\n get settled() {\n return this.state === \"ACTIVE\" || this.state === \"ARCHIVED\" || this.state === \"INACTIVE\";\n }\n}\n\nexport type ProjectProperties = {\n readonly cloudId: string;\n readonly cloudType: \"AWS\" | \"AZURE\" | \"UNKNOWN\";\n readonly createdAt: Date;\n readonly createdBy: string;\n readonly credentials: Record<string, any>;\n readonly id: string;\n readonly lastStateError: {\n error: string;\n timestamp: Date;\n } | null;\n readonly modifiedAt: Date;\n readonly modifiedBy: string;\n readonly name: string;\n readonly numberOfEngines: number;\n readonly primaryCatalog: string;\n readonly projectStore: string;\n readonly state:\n | \"ACTIVATING\"\n | \"ACTIVE\"\n | \"ARCHIVED\"\n | \"ARCHIVING\"\n | \"CREATING\"\n | \"DEACTIVATING\"\n | \"INACTIVE\"\n | \"RESTORING\";\n readonly type: \"QUERY_ENGINE\";\n};\n\nexport type ProjectMethods = {\n delete(): Promise<Result<undefined, unknown>>;\n get settled(): boolean;\n};\n\nexport type ProjectInterface = ProjectProperties & ProjectMethods;\n"]}
|
|
@@ -1,17 +1,16 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
list: () => {
|
|
4
|
+
import { Err, Ok, Result } from "ts-results-es";
|
|
5
|
+
export declare class ProjectsResource {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(config: ResourceConfig & V3Config);
|
|
8
|
+
_createFromEntity(properties: unknown): Project;
|
|
9
|
+
activate(id: string): Promise<Err<unknown> | Ok<undefined>>;
|
|
10
|
+
delete(id: string): Promise<Err<unknown> | Ok<undefined>>;
|
|
11
|
+
list(): {
|
|
13
12
|
data({ signal }?: SignalParam): AsyncGenerator<Project, void, unknown>;
|
|
14
13
|
};
|
|
15
|
-
observe
|
|
16
|
-
retrieve
|
|
17
|
-
}
|
|
14
|
+
observe(id: string): import("rxjs").Observable<Project>;
|
|
15
|
+
retrieve(id: string, { signal }?: SignalParam): Promise<Result<Project, unknown>>;
|
|
16
|
+
}
|
|
@@ -17,34 +17,55 @@ 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 {
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
20
|
+
import { Err, Ok, Result } from "ts-results-es";
|
|
21
|
+
export class ProjectsResource {
|
|
22
|
+
#config;
|
|
23
|
+
constructor(config) {
|
|
24
|
+
this.#config = config;
|
|
25
|
+
}
|
|
26
|
+
_createFromEntity(properties) {
|
|
27
|
+
return new Project(projectEntityToProperties(properties), this);
|
|
28
|
+
}
|
|
29
|
+
activate(id) {
|
|
30
|
+
return this.#config
|
|
31
|
+
.v3Request(`projects/${id}/activate`, {
|
|
32
|
+
keepalive: true,
|
|
33
|
+
method: "PUT",
|
|
34
|
+
})
|
|
35
|
+
.then(() => Ok(undefined))
|
|
36
|
+
.catch((e) => Err(e));
|
|
37
|
+
}
|
|
38
|
+
delete(id) {
|
|
39
|
+
return this.#config
|
|
40
|
+
.v3Request(`projects/${id}`, { keepalive: true, method: "DELETE" })
|
|
41
|
+
.then(() => Ok(undefined))
|
|
42
|
+
.catch((e) => Err(e));
|
|
43
|
+
}
|
|
44
|
+
list() {
|
|
45
|
+
const l = ({ signal } = {}) => this.#config
|
|
46
|
+
.v3Request("projects", { signal })
|
|
47
|
+
.then((res) => res.json())
|
|
48
|
+
.then((projects) => projects.map((entity) => this._createFromEntity(entity)));
|
|
49
|
+
return {
|
|
50
|
+
async *data({ signal } = {}) {
|
|
51
|
+
yield* await l({ signal });
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
observe(id) {
|
|
56
|
+
return timer(0, 5000).pipe(switchMap(() => fromAbortable(({ signal }) => this.retrieve(id, { signal }).then((result) => {
|
|
42
57
|
if (result.isErr()) {
|
|
43
58
|
throw result.error;
|
|
44
59
|
}
|
|
45
60
|
return result.value;
|
|
46
|
-
}))), share())
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
61
|
+
}))), share());
|
|
62
|
+
}
|
|
63
|
+
retrieve(id, { signal } = {}) {
|
|
64
|
+
return this.#config
|
|
65
|
+
.v3Request(`projects/${id}`, { signal })
|
|
66
|
+
.then((res) => res.json())
|
|
67
|
+
.then((entity) => Ok(this._createFromEntity(entity)))
|
|
68
|
+
.catch((e) => Err(e));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
50
71
|
//# sourceMappingURL=ProjectsResource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectsResource.js","sourceRoot":"","sources":["../../../src/cloud/projects/ProjectsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ProjectsResource.js","sourceRoot":"","sources":["../../../src/cloud/projects/ProjectsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO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C,CAAC,CAAC,CAAC,CAAC;IACnC,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, V3Config } from \"../../common/Config.ts\";\nimport { Project } from \"./Project.ts\";\nimport { projectEntityToProperties } from \"./utils.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport { share, switchMap, timer } from \"rxjs\";\nimport { Err, Ok, Result } from \"ts-results-es\";\nexport class ProjectsResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n _createFromEntity(properties: unknown) {\n return new Project(projectEntityToProperties(properties), this);\n }\n\n activate(id: string) {\n return this.#config\n .v3Request(`projects/${id}/activate`, {\n keepalive: true,\n method: \"PUT\",\n })\n .then(() => Ok(undefined))\n .catch((e: unknown) => Err(e));\n }\n\n delete(id: string) {\n return this.#config\n .v3Request(`projects/${id}`, { keepalive: true, method: \"DELETE\" })\n .then(() => Ok(undefined))\n .catch((e: unknown) => Err(e));\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"projects\", { signal })\n .then((res) => res.json() as Promise<unknown[]>)\n .then((projects) => projects.map((entity: unknown) => this._createFromEntity(entity)));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await l({ signal });\n },\n };\n }\n\n observe(id: string) {\n return timer(0, 5000).pipe(\n switchMap(() =>\n fromAbortable(({ signal }) =>\n this.retrieve(id, { signal }).then((result) => {\n if (result.isErr()) {\n throw result.error;\n }\n return result.value;\n }),\n ),\n ),\n share(),\n );\n }\n\n retrieve(id: string, { signal }: SignalParam = {}): Promise<Result<Project, unknown>> {\n return this.#config\n .v3Request(`projects/${id}`, { signal })\n .then((res) => res.json())\n .then((entity) => Ok(this._createFromEntity(entity)))\n .catch((e: unknown) => Err(e));\n }\n}\n"]}
|