@dremio/js-sdk 0.26.0 → 0.28.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/Dremio.d.ts +4 -0
- package/dist/cloud/Dremio.js +6 -0
- package/dist/cloud/Dremio.js.map +1 -1
- package/dist/cloud/clouds/Cloud.d.ts +15 -0
- package/dist/cloud/clouds/Cloud.js +38 -0
- package/dist/cloud/clouds/Cloud.js.map +1 -0
- package/dist/cloud/clouds/CloudsResource.d.ts +13 -0
- package/dist/cloud/clouds/CloudsResource.js +44 -0
- package/dist/cloud/clouds/CloudsResource.js.map +1 -0
- package/dist/cloud/clouds/cloudPropertiesCodec.d.ts +81 -0
- package/dist/cloud/clouds/cloudPropertiesCodec.js +82 -0
- package/dist/cloud/clouds/cloudPropertiesCodec.js.map +1 -0
- package/dist/cloud/interfaces.d.ts +2 -1
- package/dist/cloud/interfaces.js +2 -1
- package/dist/cloud/interfaces.js.map +1 -1
- package/dist/cloud/organizations/Organization.d.ts +9 -0
- package/dist/cloud/organizations/Organization.js +31 -1
- package/dist/cloud/organizations/Organization.js.map +1 -1
- package/dist/cloud/organizations/OrganizationsResource.js +2 -5
- package/dist/cloud/organizations/OrganizationsResource.js.map +1 -1
- package/dist/cloud/users/CloudUser.d.ts +3 -0
- package/dist/cloud/users/CloudUser.js +3 -0
- package/dist/cloud/users/CloudUser.js.map +1 -1
- package/dist/cloud/users/CloudUsersResource.d.ts +12 -0
- package/dist/cloud/users/CloudUsersResource.js +12 -0
- package/dist/cloud/users/CloudUsersResource.js.map +1 -1
- package/dist/cloud/users/User.d.ts +14 -0
- package/dist/cloud/users/User.js +37 -0
- package/dist/cloud/users/User.js.map +1 -0
- package/dist/cloud/users/UsersResource.d.ts +30 -0
- package/dist/cloud/users/UsersResource.js +85 -0
- package/dist/cloud/users/UsersResource.js.map +1 -0
- package/dist/cloud/users/userPropertiesCodec.d.ts +40 -0
- package/dist/cloud/users/userPropertiesCodec.js +57 -0
- package/dist/cloud/users/userPropertiesCodec.js.map +1 -0
- package/package.json +1 -1
package/dist/cloud/Dremio.d.ts
CHANGED
|
@@ -11,11 +11,14 @@ import { ProjectsResource } from "./projects/ProjectsResource.js";
|
|
|
11
11
|
import { CloudUsersResource } from "./users/CloudUsersResource.js";
|
|
12
12
|
import { JobsResource } from "../oss/jobs/JobsResource.ts";
|
|
13
13
|
import { OAuthApplicationsResource } from "./oauth/OAuthApplicationsResource.ts";
|
|
14
|
+
import { CloudsResource } from "./clouds/CloudsResource.js";
|
|
15
|
+
import { UsersResource } from "./users/UsersResource.js";
|
|
14
16
|
export declare class Dremio {
|
|
15
17
|
#private;
|
|
16
18
|
readonly ai: AiResource;
|
|
17
19
|
readonly arctic: (projectId: string) => ArcticResource;
|
|
18
20
|
readonly catalog: (projectId: string) => EnterpriseCatalogResource;
|
|
21
|
+
readonly clouds: CloudsResource;
|
|
19
22
|
readonly engines: (projectId: string) => EnginesResource;
|
|
20
23
|
readonly jobs: (projectId: string) => JobsResource;
|
|
21
24
|
readonly oauthApplications: OAuthApplicationsResource;
|
|
@@ -24,6 +27,7 @@ export declare class Dremio {
|
|
|
24
27
|
readonly roles: (projectId: string) => RolesResource;
|
|
25
28
|
readonly scripts: (projectId: string) => EnterpriseScriptsResource;
|
|
26
29
|
readonly sql: (projectId: string) => SqlResource;
|
|
30
|
+
readonly _users: UsersResource;
|
|
27
31
|
readonly users: (projectId: string) => CloudUsersResource;
|
|
28
32
|
constructor(config: Config);
|
|
29
33
|
get _resourceConfig(): (projectId?: string) => {
|
package/dist/cloud/Dremio.js
CHANGED
|
@@ -27,10 +27,13 @@ import { ProjectsResource } from "./projects/ProjectsResource.js";
|
|
|
27
27
|
import { CloudUsersResource } from "./users/CloudUsersResource.js";
|
|
28
28
|
import { JobsResource } from "../oss/jobs/JobsResource.js";
|
|
29
29
|
import { OAuthApplicationsResource } from "./oauth/OAuthApplicationsResource.js";
|
|
30
|
+
import { CloudsResource } from "./clouds/CloudsResource.js";
|
|
31
|
+
import { UsersResource } from "./users/UsersResource.js";
|
|
30
32
|
export class Dremio {
|
|
31
33
|
ai;
|
|
32
34
|
arctic;
|
|
33
35
|
catalog;
|
|
36
|
+
clouds;
|
|
34
37
|
engines;
|
|
35
38
|
jobs;
|
|
36
39
|
oauthApplications;
|
|
@@ -39,6 +42,7 @@ export class Dremio {
|
|
|
39
42
|
roles;
|
|
40
43
|
scripts;
|
|
41
44
|
sql;
|
|
45
|
+
_users;
|
|
42
46
|
users;
|
|
43
47
|
#resourceConfig;
|
|
44
48
|
constructor(config) {
|
|
@@ -46,6 +50,7 @@ export class Dremio {
|
|
|
46
50
|
this.ai = new AiResource(this.#resourceConfig());
|
|
47
51
|
this.arctic = moize.default((projectId) => new ArcticResource(this.#resourceConfig(projectId)));
|
|
48
52
|
this.catalog = moize.default((projectId) => new EnterpriseCatalogResource(this.#resourceConfig(projectId)));
|
|
53
|
+
this.clouds = new CloudsResource(this.#resourceConfig());
|
|
49
54
|
this.engines = moize.default((projectId) => new EnginesResource(this.#resourceConfig(projectId)));
|
|
50
55
|
this.jobs = moize.default((projectId) => new JobsResource(this.#resourceConfig(projectId)));
|
|
51
56
|
this.oauthApplications = new OAuthApplicationsResource(this.#resourceConfig());
|
|
@@ -54,6 +59,7 @@ export class Dremio {
|
|
|
54
59
|
this.roles = moize.default((projectId) => new RolesResource(this.#resourceConfig(projectId)));
|
|
55
60
|
this.scripts = moize.default((projectId) => new EnterpriseScriptsResource(this.#resourceConfig(projectId)));
|
|
56
61
|
this.sql = moize.default((projectId) => new SqlResource(this.#resourceConfig(projectId)));
|
|
62
|
+
this._users = new UsersResource(this.#resourceConfig());
|
|
57
63
|
this.users = moize.default((projectId) => new CloudUsersResource(this.#resourceConfig(projectId)));
|
|
58
64
|
}
|
|
59
65
|
get _resourceConfig() {
|
package/dist/cloud/Dremio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dremio.js","sourceRoot":"","sources":["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a,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CACxB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAC/E,CAAC;IACJ,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,eAAe,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 moize from \"moize\";\nimport type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"../enterprise/catalog/EnterpriseCatalogResource.js\";\nimport { RolesResource } from \"../enterprise/roles/RolesResource.js\";\nimport { EnterpriseScriptsResource } from \"../enterprise/scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { AiResource } from \"./ai/AiResource.ts\";\nimport { ArcticResource } from \"./arctic/ArcticResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { getResourceConfig } from \"./getResourceConfig.ts\";\nimport { OrganizationsResource } from \"./organizations/OrganizationsResource.js\";\nimport { ProjectsResource } from \"./projects/ProjectsResource.js\";\nimport { CloudUsersResource } from \"./users/CloudUsersResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport { OAuthApplicationsResource } from \"./oauth/OAuthApplicationsResource.ts\";\nimport { CloudsResource } from \"./clouds/CloudsResource.js\";\nimport { UsersResource } from \"./users/UsersResource.js\";\n\nexport class Dremio {\n readonly ai: AiResource;\n readonly arctic: (projectId: string) => ArcticResource;\n readonly catalog: (projectId: string) => EnterpriseCatalogResource;\n readonly clouds: CloudsResource;\n readonly engines: (projectId: string) => EnginesResource;\n readonly jobs: (projectId: string) => JobsResource;\n readonly oauthApplications: OAuthApplicationsResource;\n readonly organizations: OrganizationsResource;\n readonly projects: ProjectsResource;\n readonly roles: (projectId: string) => RolesResource;\n readonly scripts: (projectId: string) => EnterpriseScriptsResource;\n readonly sql: (projectId: string) => SqlResource;\n readonly _users: UsersResource;\n readonly users: (projectId: string) => CloudUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.ai = new AiResource(this.#resourceConfig());\n this.arctic = moize.default(\n (projectId: string) => new ArcticResource(this.#resourceConfig(projectId)),\n );\n this.catalog = moize.default(\n (projectId: string) => new EnterpriseCatalogResource(this.#resourceConfig(projectId)),\n );\n this.clouds = new CloudsResource(this.#resourceConfig());\n this.engines = moize.default(\n (projectId: string) => new EnginesResource(this.#resourceConfig(projectId)),\n );\n this.jobs = moize.default(\n (projectId: string) => new JobsResource(this.#resourceConfig(projectId)),\n );\n this.oauthApplications = new OAuthApplicationsResource(this.#resourceConfig());\n this.organizations = new OrganizationsResource(this.#resourceConfig());\n this.projects = new ProjectsResource(this.#resourceConfig());\n this.roles = moize.default(\n (projectId: string) => new RolesResource(this.#resourceConfig(projectId)),\n );\n this.scripts = moize.default(\n (projectId: string) => new EnterpriseScriptsResource(this.#resourceConfig(projectId)),\n );\n this.sql = moize.default(\n (projectId: string) => new SqlResource(this.#resourceConfig(projectId)),\n );\n this._users = new UsersResource(this.#resourceConfig());\n this.users = moize.default(\n (projectId: string) => new CloudUsersResource(this.#resourceConfig(projectId)),\n );\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
import type { cloudPropertiesCodec } from "./cloudPropertiesCodec.ts";
|
|
3
|
+
import type { V3Config } from "../../common/Config.ts";
|
|
4
|
+
import type { Temporal } from "temporal-polyfill";
|
|
5
|
+
export declare class Cloud implements z.output<typeof cloudPropertiesCodec> {
|
|
6
|
+
#private;
|
|
7
|
+
readonly attributes: z.output<typeof cloudPropertiesCodec>["attributes"];
|
|
8
|
+
readonly createdAt: Temporal.Instant;
|
|
9
|
+
readonly createdBy: string;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly modifiedAt: Temporal.Instant;
|
|
12
|
+
readonly modifiedBy: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
constructor(config: V3Config, properties: z.output<typeof cloudPropertiesCodec>);
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as z from "zod/mini";
|
|
17
|
+
export class Cloud {
|
|
18
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
19
|
+
#config;
|
|
20
|
+
attributes;
|
|
21
|
+
createdAt;
|
|
22
|
+
createdBy;
|
|
23
|
+
id;
|
|
24
|
+
modifiedAt;
|
|
25
|
+
modifiedBy;
|
|
26
|
+
name;
|
|
27
|
+
constructor(config, properties) {
|
|
28
|
+
this.#config = config;
|
|
29
|
+
this.attributes = properties.attributes;
|
|
30
|
+
this.createdAt = properties.createdAt;
|
|
31
|
+
this.createdBy = properties.createdBy;
|
|
32
|
+
this.id = properties.id;
|
|
33
|
+
this.modifiedAt = properties.modifiedAt;
|
|
34
|
+
this.modifiedBy = properties.modifiedBy;
|
|
35
|
+
this.name = properties.name;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Cloud.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cloud.js","sourceRoot":"","sources":["../../../src/cloud/clouds/Cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B,MAAM,OAAO,KAAK;IAChB,2DAA2D;IAClD,OAAO,CAAW;IAClB,UAAU,CAAsD;IAChE,SAAS,CAAmB;IAC5B,SAAS,CAAS;IAClB,EAAE,CAAS;IACX,UAAU,CAAmB;IAC7B,UAAU,CAAS;IACnB,IAAI,CAAS;IAEtB,YAAY,MAAgB,EAAE,UAAiD;QAC7E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,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;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 * as z from \"zod/mini\";\nimport type { cloudPropertiesCodec } from \"./cloudPropertiesCodec.ts\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { Temporal } from \"temporal-polyfill\";\n\nexport class Cloud implements z.output<typeof cloudPropertiesCodec> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V3Config;\n readonly attributes: z.output<typeof cloudPropertiesCodec>[\"attributes\"];\n readonly createdAt: Temporal.Instant;\n readonly createdBy: string;\n readonly id: string;\n readonly modifiedAt: Temporal.Instant;\n readonly modifiedBy: string;\n readonly name: string;\n\n constructor(config: V3Config, properties: z.output<typeof cloudPropertiesCodec>) {\n this.#config = config;\n this.attributes = properties.attributes;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.id = properties.id;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { V3Config } from "../../common/Config.ts";
|
|
2
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
3
|
+
import { Cloud } from "./Cloud.ts";
|
|
4
|
+
export declare class CloudsResource {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(config: V3Config);
|
|
7
|
+
list(): {
|
|
8
|
+
data({ signal }?: SignalParam): AsyncGenerator<Cloud, void, unknown>;
|
|
9
|
+
getPage: ({ signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
|
|
10
|
+
data: Cloud[];
|
|
11
|
+
}, import("../index.ts").HttpError>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import z from "zod";
|
|
17
|
+
import { cloudPropertiesCodec } from "./cloudPropertiesCodec.js";
|
|
18
|
+
import { Cloud } from "./Cloud.js";
|
|
19
|
+
export class CloudsResource {
|
|
20
|
+
#config;
|
|
21
|
+
constructor(config) {
|
|
22
|
+
this.#config = config;
|
|
23
|
+
}
|
|
24
|
+
list() {
|
|
25
|
+
const getPage = ({ signal } = {}) => this.#config
|
|
26
|
+
.v3Request("clouds", {
|
|
27
|
+
headers: {
|
|
28
|
+
Accept: "application/json",
|
|
29
|
+
},
|
|
30
|
+
signal,
|
|
31
|
+
})
|
|
32
|
+
.map((res) => res.json())
|
|
33
|
+
.map((entities) => ({
|
|
34
|
+
data: entities.map((entity) => new Cloud(this.#config, z.parse(cloudPropertiesCodec, entity))),
|
|
35
|
+
}));
|
|
36
|
+
return {
|
|
37
|
+
async *data({ signal } = {}) {
|
|
38
|
+
yield* await getPage({ signal }).promise.then((result) => result.unwrap().data);
|
|
39
|
+
},
|
|
40
|
+
getPage,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=CloudsResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloudsResource.js","sourceRoot":"","sources":["../../../src/cloud/clouds/CloudsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,OAAO,cAAc;IAChB,OAAO,CAAW;IAE3B,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI;QACF,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO;aACT,SAAS,CAAC,QAAQ,EAAE;YACnB,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAqD,CAAC;aAC3E,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAClB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAChB,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAC3E;SACF,CAAC,CAAC,CAAC;QACR,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;YAClF,CAAC;YACD,OAAO;SACR,CAAC;IACJ,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 z from \"zod\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { cloudPropertiesCodec } from \"./cloudPropertiesCodec.js\";\nimport { Cloud } from \"./Cloud.ts\";\n\nexport class CloudsResource {\n readonly #config: V3Config;\n\n constructor(config: V3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"clouds\", {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof cloudPropertiesCodec>[]>)\n .map((entities) => ({\n data: entities.map(\n (entity) => new Cloud(this.#config, z.parse(cloudPropertiesCodec, entity)),\n ),\n }));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await getPage({ signal }).promise.then((result) => result.unwrap().data);\n },\n getPage,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Temporal } from "temporal-polyfill";
|
|
2
|
+
import * as z from "zod/mini";
|
|
3
|
+
export declare const cloudPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
|
|
4
|
+
attributes: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
5
|
+
credentials: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
6
|
+
accessKeyId: z.ZodMiniString<string>;
|
|
7
|
+
secretAccessKey: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
8
|
+
type: z.ZodMiniLiteral<"ACCESS_KEY">;
|
|
9
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
10
|
+
externalId: z.ZodMiniString<string>;
|
|
11
|
+
externalIdSignature: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
12
|
+
roleArn: z.ZodMiniString<string>;
|
|
13
|
+
type: z.ZodMiniLiteral<"IAM_ROLE">;
|
|
14
|
+
}, z.core.$strip>], "type">;
|
|
15
|
+
region: z.ZodMiniString<string>;
|
|
16
|
+
securityGroupIds: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
17
|
+
subnets: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
18
|
+
vendor: z.ZodMiniLiteral<"AWS">;
|
|
19
|
+
vpcEndpointId: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
20
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
21
|
+
credentials: z.ZodMiniObject<{
|
|
22
|
+
clientId: z.ZodMiniString<string>;
|
|
23
|
+
clientSecret: z.ZodMiniString<string>;
|
|
24
|
+
subscriptionId: z.ZodMiniString<string>;
|
|
25
|
+
tenantId: z.ZodMiniString<string>;
|
|
26
|
+
type: z.ZodMiniLiteral<"AZURE_APP_CLIENT_CREDENTIALS">;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
privateEndpoints: z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
29
|
+
region: z.ZodMiniString<string>;
|
|
30
|
+
resourceGroup: z.ZodMiniString<string>;
|
|
31
|
+
securityGroup: z.ZodMiniString<string>;
|
|
32
|
+
subnets: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
33
|
+
vendor: z.ZodMiniLiteral<"AZURE">;
|
|
34
|
+
virtualNetwork: z.ZodMiniString<string>;
|
|
35
|
+
}, z.core.$strip>], "vendor">;
|
|
36
|
+
createdAt: z.ZodMiniString<string>;
|
|
37
|
+
createdBy: z.ZodMiniString<string>;
|
|
38
|
+
id: z.ZodMiniString<string>;
|
|
39
|
+
modifiedAt: z.ZodMiniString<string>;
|
|
40
|
+
modifiedBy: z.ZodMiniString<string>;
|
|
41
|
+
name: z.ZodMiniString<string>;
|
|
42
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
43
|
+
name: z.ZodMiniString<string>;
|
|
44
|
+
id: z.ZodMiniString<string>;
|
|
45
|
+
createdBy: z.ZodMiniString<string>;
|
|
46
|
+
modifiedBy: z.ZodMiniString<string>;
|
|
47
|
+
attributes: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
48
|
+
credentials: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
49
|
+
accessKeyId: z.ZodMiniString<string>;
|
|
50
|
+
secretAccessKey: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
51
|
+
type: z.ZodMiniLiteral<"ACCESS_KEY">;
|
|
52
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
53
|
+
externalId: z.ZodMiniString<string>;
|
|
54
|
+
externalIdSignature: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
55
|
+
roleArn: z.ZodMiniString<string>;
|
|
56
|
+
type: z.ZodMiniLiteral<"IAM_ROLE">;
|
|
57
|
+
}, z.core.$strip>], "type">;
|
|
58
|
+
region: z.ZodMiniString<string>;
|
|
59
|
+
securityGroupIds: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
60
|
+
subnets: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
61
|
+
vendor: z.ZodMiniLiteral<"AWS">;
|
|
62
|
+
vpcEndpointId: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
63
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
64
|
+
credentials: z.ZodMiniObject<{
|
|
65
|
+
clientId: z.ZodMiniString<string>;
|
|
66
|
+
clientSecret: z.ZodMiniString<string>;
|
|
67
|
+
subscriptionId: z.ZodMiniString<string>;
|
|
68
|
+
tenantId: z.ZodMiniString<string>;
|
|
69
|
+
type: z.ZodMiniLiteral<"AZURE_APP_CLIENT_CREDENTIALS">;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
privateEndpoints: z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
72
|
+
region: z.ZodMiniString<string>;
|
|
73
|
+
resourceGroup: z.ZodMiniString<string>;
|
|
74
|
+
securityGroup: z.ZodMiniString<string>;
|
|
75
|
+
subnets: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
76
|
+
vendor: z.ZodMiniLiteral<"AZURE">;
|
|
77
|
+
virtualNetwork: z.ZodMiniString<string>;
|
|
78
|
+
}, z.core.$strip>], "vendor">;
|
|
79
|
+
createdAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
80
|
+
modifiedAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
81
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Temporal } from "temporal-polyfill";
|
|
17
|
+
import * as z from "zod/mini";
|
|
18
|
+
const region = z.string();
|
|
19
|
+
const awsAttributesSchema = z.object({
|
|
20
|
+
credentials: z.discriminatedUnion("type", [
|
|
21
|
+
z.object({
|
|
22
|
+
accessKeyId: z.string(),
|
|
23
|
+
secretAccessKey: z.nullable(z.string()),
|
|
24
|
+
type: z.literal("ACCESS_KEY"),
|
|
25
|
+
}),
|
|
26
|
+
z.object({
|
|
27
|
+
externalId: z.string(),
|
|
28
|
+
externalIdSignature: z.optional(z.string()),
|
|
29
|
+
roleArn: z.string(),
|
|
30
|
+
type: z.literal("IAM_ROLE"),
|
|
31
|
+
}),
|
|
32
|
+
]),
|
|
33
|
+
region,
|
|
34
|
+
securityGroupIds: z.array(z.string()),
|
|
35
|
+
subnets: z.array(z.string()),
|
|
36
|
+
vendor: z.literal("AWS"),
|
|
37
|
+
vpcEndpointId: z.nullable(z.string()),
|
|
38
|
+
});
|
|
39
|
+
const azureAttributesSchema = z.object({
|
|
40
|
+
credentials: z.object({
|
|
41
|
+
clientId: z.string(),
|
|
42
|
+
clientSecret: z.string(),
|
|
43
|
+
subscriptionId: z.string(),
|
|
44
|
+
tenantId: z.string(),
|
|
45
|
+
type: z.literal("AZURE_APP_CLIENT_CREDENTIALS"),
|
|
46
|
+
}),
|
|
47
|
+
privateEndpoints: z.nullable(z.array(z.string())),
|
|
48
|
+
region,
|
|
49
|
+
resourceGroup: z.string(),
|
|
50
|
+
securityGroup: z.string(),
|
|
51
|
+
subnets: z.array(z.string()),
|
|
52
|
+
vendor: z.literal("AZURE"),
|
|
53
|
+
virtualNetwork: z.string(),
|
|
54
|
+
});
|
|
55
|
+
const cloudPropertiesInSchema = z.object({
|
|
56
|
+
attributes: z.discriminatedUnion("vendor", [awsAttributesSchema, azureAttributesSchema]),
|
|
57
|
+
createdAt: z.string(),
|
|
58
|
+
createdBy: z.string(),
|
|
59
|
+
id: z.string(),
|
|
60
|
+
modifiedAt: z.string(),
|
|
61
|
+
modifiedBy: z.string(),
|
|
62
|
+
name: z.string(),
|
|
63
|
+
});
|
|
64
|
+
export const cloudPropertiesCodec = z.codec(cloudPropertiesInSchema, z.extend(z.omit(cloudPropertiesInSchema, {
|
|
65
|
+
createdAt: true,
|
|
66
|
+
modifiedAt: true,
|
|
67
|
+
}), {
|
|
68
|
+
createdAt: z.instanceof(Temporal.Instant),
|
|
69
|
+
modifiedAt: z.instanceof(Temporal.Instant),
|
|
70
|
+
}), {
|
|
71
|
+
decode(v) {
|
|
72
|
+
return {
|
|
73
|
+
...v,
|
|
74
|
+
createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),
|
|
75
|
+
modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
encode(v) {
|
|
79
|
+
return { ...v, createdAt: v.createdAt.toString(), modifiedAt: v.modifiedAt.toString() };
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=cloudPropertiesCodec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/clouds/cloudPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAE1B,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,WAAW,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;QACxC,CAAC,CAAC,MAAM,CAAC;YACP,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;YACvB,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACvC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;SAC9B,CAAC;QACF,CAAC,CAAC,MAAM,CAAC;YACP,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;YACtB,mBAAmB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;YACnB,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,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AC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACzC,uBAAuB,EACvB,CAAC,CAAC,MAAM,CACN,CAAC,CAAC,IAAI,CAAC,uBAAuB,EAAE;IAC9B,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;CACjB,CAAC,EACF;IACE,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;CAC3C,CACF,EACD;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,GAAG,CAAC;YACJ,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;YACrE,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;SACxE,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,OAAO,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC1F,CAAC;CACF,CACF,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 { Temporal } from \"temporal-polyfill\";\nimport * as z from \"zod/mini\";\n\nconst region = z.string();\n\nconst awsAttributesSchema = z.object({\n credentials: z.discriminatedUnion(\"type\", [\n z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.nullable(z.string()),\n type: z.literal(\"ACCESS_KEY\"),\n }),\n z.object({\n externalId: z.string(),\n externalIdSignature: z.optional(z.string()),\n roleArn: z.string(),\n type: z.literal(\"IAM_ROLE\"),\n }),\n ]),\n region,\n securityGroupIds: z.array(z.string()),\n subnets: z.array(z.string()),\n vendor: z.literal(\"AWS\"),\n vpcEndpointId: z.nullable(z.string()),\n});\n\nconst azureAttributesSchema = z.object({\n credentials: z.object({\n clientId: z.string(),\n clientSecret: z.string(),\n subscriptionId: z.string(),\n tenantId: z.string(),\n type: z.literal(\"AZURE_APP_CLIENT_CREDENTIALS\"),\n }),\n privateEndpoints: z.nullable(z.array(z.string())),\n region,\n resourceGroup: z.string(),\n securityGroup: z.string(),\n subnets: z.array(z.string()),\n vendor: z.literal(\"AZURE\"),\n virtualNetwork: z.string(),\n});\n\nconst cloudPropertiesInSchema = z.object({\n attributes: z.discriminatedUnion(\"vendor\", [awsAttributesSchema, azureAttributesSchema]),\n createdAt: z.string(),\n createdBy: z.string(),\n id: z.string(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n});\n\nexport const cloudPropertiesCodec = z.codec(\n cloudPropertiesInSchema,\n z.extend(\n z.omit(cloudPropertiesInSchema, {\n createdAt: true,\n modifiedAt: true,\n }),\n {\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return { ...v, createdAt: v.createdAt.toString(), modifiedAt: v.modifiedAt.toString() };\n },\n },\n);\n"]}
|
|
@@ -3,6 +3,7 @@ import type { CloudUser } from "./users/CloudUser.ts";
|
|
|
3
3
|
import type { Engine } from "./engines/Engine.ts";
|
|
4
4
|
import type { Project } from "./projects/Project.ts";
|
|
5
5
|
import { Organization } from "./organizations/Organization.ts";
|
|
6
|
+
import { User } from "./users/User.ts";
|
|
6
7
|
import type { Job, Reflection } from "../oss/interfaces.ts";
|
|
7
8
|
import type { EnterpriseScript } from "../enterprise/scripts/EnterpriseScript.ts";
|
|
8
9
|
import type { ReflectionSummary } from "../enterprise/reflections/ReflectionSummary.ts";
|
|
@@ -11,7 +12,7 @@ import type { BranchHeadVersionReference, BareCommitVersionReference, TagVersion
|
|
|
11
12
|
import type { JobResultsSchema } from "../oss/jobs/utils/JobResultsResponse.ts";
|
|
12
13
|
export type { ArcticCatalog, CloudUser, Engine, Project };
|
|
13
14
|
export type { Job, JobResultsSchema, Reflection, EnterpriseScript, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
|
|
14
|
-
export { Organization };
|
|
15
|
+
export { Organization, User };
|
|
15
16
|
export * from "../enterprise/catalog/CatalogObjects/index.ts";
|
|
16
17
|
export * from "../enterprise/catalog/CatalogReferences/index.ts";
|
|
17
18
|
export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.ts";
|
package/dist/cloud/interfaces.js
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { Organization } from "./organizations/Organization.js";
|
|
17
|
-
|
|
17
|
+
import { User } from "./users/User.js";
|
|
18
|
+
export { Organization, User };
|
|
18
19
|
export * from "../enterprise/catalog/CatalogObjects/index.js";
|
|
19
20
|
export * from "../enterprise/catalog/CatalogReferences/index.js";
|
|
20
21
|
export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA0BvC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAC9B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+BAA+B,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 { ArcticCatalog } from \"./arctic/ArcticCatalog.ts\";\nimport type { CloudUser } from \"./users/CloudUser.ts\";\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Project } from \"./projects/Project.ts\";\nimport { Organization } from \"./organizations/Organization.ts\";\nimport { User } from \"./users/User.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseScript } from \"../enterprise/scripts/EnterpriseScript.ts\";\nimport type { ReflectionSummary } from \"../enterprise/reflections/ReflectionSummary.ts\";\nimport type { Role } from \"../enterprise/roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\nimport type { JobResultsSchema } from \"../oss/jobs/utils/JobResultsResponse.ts\";\n\nexport type { ArcticCatalog, CloudUser, Engine, Project };\nexport type {\n Job,\n JobResultsSchema,\n Reflection,\n EnterpriseScript,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport { Organization, User };\nexport * from \"../enterprise/catalog/CatalogObjects/index.ts\";\nexport * from \"../enterprise/catalog/CatalogReferences/index.ts\";\nexport * from \"../enterprise/catalog/catalogSearch/CatalogSearchResult.ts\";\nexport * from \"../enterprise/grants/Grant.ts\";\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
2
|
import { Temporal } from "temporal-polyfill";
|
|
3
3
|
import type { V2Config } from "../../common/Config.ts";
|
|
4
|
+
import { Observable } from "rxjs";
|
|
5
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
4
6
|
export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
|
|
5
7
|
auditDestinationCloudType: z.ZodMiniEnum<{
|
|
6
8
|
AWS: "AWS";
|
|
@@ -82,6 +84,10 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
82
84
|
modifiedAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
83
85
|
name: z.ZodMiniString<string>;
|
|
84
86
|
}, z.core.$strip>>;
|
|
87
|
+
declare const organizationUpdateSchema: z.ZodMiniObject<{
|
|
88
|
+
name: z.ZodMiniString<string>;
|
|
89
|
+
defaultProjectId: z.ZodMiniString<string>;
|
|
90
|
+
}, z.core.$strip>;
|
|
85
91
|
type OrganizationProperties = z.output<typeof organizationPropertiesCodec>;
|
|
86
92
|
export declare class Organization implements OrganizationProperties {
|
|
87
93
|
#private;
|
|
@@ -97,12 +103,14 @@ export declare class Organization implements OrganizationProperties {
|
|
|
97
103
|
readonly modifiedBy: OrganizationProperties["modifiedBy"];
|
|
98
104
|
readonly name: OrganizationProperties["name"];
|
|
99
105
|
readonly state: OrganizationProperties["state"];
|
|
106
|
+
readonly updates$: Observable<Organization>;
|
|
100
107
|
/**
|
|
101
108
|
* @hidden
|
|
102
109
|
*/
|
|
103
110
|
readonly _isCreatedWithCFT: OrganizationProperties["_isCreatedWithCFT"];
|
|
104
111
|
constructor(config: V2Config, properties: OrganizationProperties);
|
|
105
112
|
get settled(): boolean;
|
|
113
|
+
update(fields: Partial<z.infer<typeof organizationUpdateSchema>>): import("ts-results-es").AsyncResult<Organization, import("../index.ts").HttpError>;
|
|
106
114
|
static schema: z.ZodMiniObject<{
|
|
107
115
|
id: z.ZodMiniString<string>;
|
|
108
116
|
state: z.ZodMiniEnum<{
|
|
@@ -145,4 +153,5 @@ export declare class Organization implements OrganizationProperties {
|
|
|
145
153
|
name: z.ZodMiniString<string>;
|
|
146
154
|
}, z.core.$strip>;
|
|
147
155
|
}
|
|
156
|
+
export declare const retrieveOrg: (config: V2Config) => ({ signal }?: SignalParam) => import("ts-results-es").AsyncResult<Organization, import("../index.ts").HttpError>;
|
|
148
157
|
export {};
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as z from "zod/mini";
|
|
17
17
|
import { Temporal } from "temporal-polyfill";
|
|
18
|
+
import { map, Observable, repeat, shareReplay, takeWhile, timer } from "rxjs";
|
|
19
|
+
import { fromAbortable } from "../../common/fromAbortable.js";
|
|
18
20
|
const organizationPropertiesInSchema = z.object({
|
|
19
21
|
auditDestinationCloudType: z.enum(["AWS", "AZURE"]),
|
|
20
22
|
auditDestinationCredentials: z.object({
|
|
@@ -83,6 +85,10 @@ export const organizationPropertiesCodec = z.codec(organizationPropertiesInSchem
|
|
|
83
85
|
};
|
|
84
86
|
},
|
|
85
87
|
});
|
|
88
|
+
const organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {
|
|
89
|
+
defaultProjectId: true,
|
|
90
|
+
name: true,
|
|
91
|
+
});
|
|
86
92
|
export class Organization {
|
|
87
93
|
auditDestinationCloudType;
|
|
88
94
|
auditDestinationCredentials;
|
|
@@ -96,11 +102,11 @@ export class Organization {
|
|
|
96
102
|
modifiedBy;
|
|
97
103
|
name;
|
|
98
104
|
state;
|
|
105
|
+
updates$;
|
|
99
106
|
/**
|
|
100
107
|
* @hidden
|
|
101
108
|
*/
|
|
102
109
|
_isCreatedWithCFT;
|
|
103
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
104
110
|
#config;
|
|
105
111
|
constructor(config, properties) {
|
|
106
112
|
this.auditDestinationCloudType = properties.auditDestinationCloudType;
|
|
@@ -117,6 +123,7 @@ export class Organization {
|
|
|
117
123
|
this.name = properties.name;
|
|
118
124
|
this.state = properties.state;
|
|
119
125
|
this.#config = config;
|
|
126
|
+
this.updates$ = fromAbortable(({ signal }) => retrieveOrg(this.#config)({ signal }).promise).pipe(repeat({ delay: () => timer(3000) }), takeWhile((result) => result.isOk() && !result.value.settled, true), map((result) => result.unwrap()), shareReplay({ bufferSize: 1, refCount: true }));
|
|
120
127
|
}
|
|
121
128
|
get settled() {
|
|
122
129
|
return (this.state === "ACTIVE" ||
|
|
@@ -124,6 +131,29 @@ export class Organization {
|
|
|
124
131
|
this.state === "FAILED" ||
|
|
125
132
|
this.state === "INVALID");
|
|
126
133
|
}
|
|
134
|
+
update(fields) {
|
|
135
|
+
return this.#config
|
|
136
|
+
.v2Request("organizations", {
|
|
137
|
+
body: JSON.stringify(z.parse(organizationUpdateSchema, {
|
|
138
|
+
defaultProjectId: this.defaultProjectId,
|
|
139
|
+
name: fields.name || this.name,
|
|
140
|
+
})),
|
|
141
|
+
headers: {
|
|
142
|
+
Accept: "application/json",
|
|
143
|
+
"Content-Type": "application/json",
|
|
144
|
+
},
|
|
145
|
+
keepalive: true,
|
|
146
|
+
method: "PUT",
|
|
147
|
+
})
|
|
148
|
+
.map((res) => res.json())
|
|
149
|
+
.map((entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)));
|
|
150
|
+
}
|
|
127
151
|
static schema = organizationPropertiesCodec.def.out;
|
|
128
152
|
}
|
|
153
|
+
export const retrieveOrg = (config) => function retrieveOrg({ signal } = {}) {
|
|
154
|
+
return config
|
|
155
|
+
.v2Request("organizations", { headers: { Accept: "application/json" }, signal })
|
|
156
|
+
.map((res) => res.json())
|
|
157
|
+
.map((entity) => new Organization(config, z.decode(organizationPropertiesCodec, entity)));
|
|
158
|
+
};
|
|
129
159
|
//# sourceMappingURL=Organization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Organization.js","sourceRoot":"","sources":["../../../src/cloud/organizations/Organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,yBAAyB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnD,2BAA2B,EAAE,CAAC,CAAC,MAAM,CAAC;QACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;QAC3B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,wBAAwB,EAAE,UAAU,CAAC,CAAC;KACnE,CAAC;IACF,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,QAAQ,CACnB,CAAC,CAAC,KAAK,CACL,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,C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AAC,oBAAoB,GAAG,UAAU,CAAC,oBAAoB,CAAC;QAC5D,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,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACpD,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC;QACtD,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,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAE9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,CACL,IAAI,CAAC,KAAK,KAAK,QAAQ;YACvB,IAAI,CAAC,KAAK,KAAK,SAAS;YACxB,IAAI,CAAC,KAAK,KAAK,QAAQ;YACvB,IAAI,CAAC,KAAK,KAAK,SAAS,CACzB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC,GAAG,CAAC,GAAG,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 * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.enum([\"AWS\", \"AZURE\"]),\n auditDestinationCredentials: z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n auditDestinationPath: z.string(),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n };\n },\n },\n);\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Organ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* 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 * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\nimport { map, Observable, repeat, shareReplay, takeWhile, timer } from \"rxjs\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.enum([\"AWS\", \"AZURE\"]),\n auditDestinationCredentials: z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n auditDestinationPath: z.string(),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n };\n },\n },\n);\n\nconst organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {\n defaultProjectId: true,\n name: true,\n});\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n readonly updates$: Observable<Organization>;\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n\n this.updates$ = fromAbortable(\n ({ signal }) => retrieveOrg(this.#config)({ signal }).promise,\n ).pipe(\n repeat({ delay: () => timer(3000) }),\n takeWhile((result) => result.isOk() && !result.value.settled, true),\n map((result) => result.unwrap()),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n update(fields: Partial<z.infer<typeof organizationUpdateSchema>>) {\n return this.#config\n .v2Request(\"organizations\", {\n body: JSON.stringify(\n z.parse(organizationUpdateSchema, {\n defaultProjectId: this.defaultProjectId,\n name: fields.name || this.name,\n }),\n ),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map(\n (entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)),\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n\nexport const retrieveOrg = (config: V2Config) =>\n function retrieveOrg({ signal }: SignalParam = {}) {\n return config\n .v2Request(\"organizations\", { headers: { Accept: \"application/json\" }, signal })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map((entity) => new Organization(config, z.decode(organizationPropertiesCodec, entity)));\n };\n"]}
|
|
@@ -14,17 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import * as z from "zod/mini";
|
|
17
|
-
import { Organization, organizationPropertiesCodec } from "./Organization.js";
|
|
17
|
+
import { Organization, organizationPropertiesCodec, retrieveOrg } from "./Organization.js";
|
|
18
18
|
export class OrganizationsResource {
|
|
19
19
|
#config;
|
|
20
20
|
constructor(config) {
|
|
21
21
|
this.#config = config;
|
|
22
22
|
}
|
|
23
23
|
retrieve({ signal } = {}) {
|
|
24
|
-
return this.#config
|
|
25
|
-
.v2Request("organizations", { headers: { Accept: "application/json" }, signal })
|
|
26
|
-
.map((res) => res.json())
|
|
27
|
-
.map((entity) => this._organizationFromEntity(entity));
|
|
24
|
+
return retrieveOrg(this.#config)({ signal });
|
|
28
25
|
}
|
|
29
26
|
_organizationFromEntity(entity) {
|
|
30
27
|
return new Organization(this.#config, z.decode(organizationPropertiesCodec, entity));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrganizationsResource.js","sourceRoot":"","sources":["../../../src/cloud/organizations/OrganizationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"OrganizationsResource.js","sourceRoot":"","sources":["../../../src/cloud/organizations/OrganizationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG3F,MAAM,OAAO,qBAAqB;IACvB,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,QAAQ,CAAC,EAAE,MAAM,KAAkB,EAAE;QACnC,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,uBAAuB,CAAC,MAAmD;QACzE,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC;IACvF,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 * as z from \"zod/mini\";\nimport type { ResourceConfig, V2Config } from \"../../common/Config.ts\";\nimport { Organization, organizationPropertiesCodec, retrieveOrg } from \"./Organization.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class OrganizationsResource {\n readonly #config: ResourceConfig & V2Config;\n\n constructor(config: ResourceConfig & V2Config) {\n this.#config = config;\n }\n\n retrieve({ signal }: SignalParam = {}) {\n return retrieveOrg(this.#config)({ signal });\n }\n\n _organizationFromEntity(entity: z.input<typeof organizationPropertiesCodec>) {\n return new Organization(this.#config, z.decode(organizationPropertiesCodec, entity));\n }\n}\n"]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { EnterpriseUser, type EnterpriseUserProperties } from "../../enterprise/users/EnterpriseUser.ts";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*/
|
|
2
5
|
export declare class CloudUser extends EnterpriseUser {
|
|
3
6
|
}
|
|
4
7
|
export declare const cloudUserEntityToProperties: (entity: any) => EnterpriseUserProperties;
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { EnterpriseUser, } from "../../enterprise/users/EnterpriseUser.js";
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
17
20
|
export class CloudUser extends EnterpriseUser {
|
|
18
21
|
}
|
|
19
22
|
export const cloudUserEntityToProperties = (entity) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudUser.js","sourceRoot":"","sources":["../../../src/cloud/users/CloudUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,0CAA0C,CAAC;AAElD,MAAM,OAAO,SAAU,SAAQ,cAAc;CAAG;AAEhD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAW,EAAE,EAAE,CACzD,CAAC;IACC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI;IAC5D,UAAU,EAAE,MAAM,CAAC,QAAQ,IAAI,IAAI;IACnC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,IAAI;IACnC,EAAE,EAAE,MAAM,CAAC,EAAE;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;IAC7C,QAAQ,EAAE,MAAM,CAAC,IAAI;CACtB,CAA6B,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 {\n EnterpriseUser,\n type EnterpriseUserProperties,\n} from \"../../enterprise/users/EnterpriseUser.ts\";\n\nexport class CloudUser extends EnterpriseUser {}\n\nexport const cloudUserEntityToProperties = (entity: any) =>\n ({\n email: entity.email?.length > 0 ? entity.email : entity.name,\n familyName: entity.lastName || null,\n givenName: entity.firstName || null,\n id: entity.id,\n status: entity.active ? \"ACTIVE\" : \"INACTIVE\",\n username: entity.name,\n }) as EnterpriseUserProperties;\n"]}
|
|
1
|
+
{"version":3,"file":"CloudUser.js","sourceRoot":"","sources":["../../../src/cloud/users/CloudUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,cAAc,GAEf,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,cAAc;CAAG;AAEhD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAW,EAAE,EAAE,CACzD,CAAC;IACC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI;IAC5D,UAAU,EAAE,MAAM,CAAC,QAAQ,IAAI,IAAI;IACnC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,IAAI;IACnC,EAAE,EAAE,MAAM,CAAC,EAAE;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;IAC7C,QAAQ,EAAE,MAAM,CAAC,IAAI;CACtB,CAA6B,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 {\n EnterpriseUser,\n type EnterpriseUserProperties,\n} from \"../../enterprise/users/EnterpriseUser.ts\";\n\n/**\n * @deprecated\n */\nexport class CloudUser extends EnterpriseUser {}\n\nexport const cloudUserEntityToProperties = (entity: any) =>\n ({\n email: entity.email?.length > 0 ? entity.email : entity.name,\n familyName: entity.lastName || null,\n givenName: entity.firstName || null,\n id: entity.id,\n status: entity.active ? \"ACTIVE\" : \"INACTIVE\",\n username: entity.name,\n }) as EnterpriseUserProperties;\n"]}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import type { SonarV3Config, V3Config } from "../../common/Config.ts";
|
|
2
2
|
import type { SignalParam } from "../../common/Params.ts";
|
|
3
3
|
import { CloudUser } from "./CloudUser.ts";
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
4
7
|
export declare class CloudUsersResource {
|
|
5
8
|
#private;
|
|
6
9
|
constructor(config: SonarV3Config & V3Config);
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
7
13
|
_userFromEntity(entity: unknown): CloudUser;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
8
17
|
retrieveById(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<CloudUser, import("../index.ts").HttpError>>;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated
|
|
20
|
+
*/
|
|
9
21
|
retrieveByEmail(email: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<CloudUser, import("../index.ts").HttpError>>;
|
|
10
22
|
}
|
|
@@ -14,20 +14,32 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { CloudUser, cloudUserEntityToProperties } from "./CloudUser.js";
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
17
20
|
export class CloudUsersResource {
|
|
18
21
|
#config;
|
|
19
22
|
constructor(config) {
|
|
20
23
|
this.#config = config;
|
|
21
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated
|
|
27
|
+
*/
|
|
22
28
|
_userFromEntity(entity) {
|
|
23
29
|
return new CloudUser(cloudUserEntityToProperties(entity), this.#config);
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated
|
|
33
|
+
*/
|
|
25
34
|
retrieveById(id, { signal } = {}) {
|
|
26
35
|
return this.#config
|
|
27
36
|
.sonarV3Request(`user/${id}`, { signal })
|
|
28
37
|
.map((res) => res.json())
|
|
29
38
|
.map((entity) => this._userFromEntity(entity)).promise;
|
|
30
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
*/
|
|
31
43
|
retrieveByEmail(email, { signal } = {}) {
|
|
32
44
|
return this.#config
|
|
33
45
|
.sonarV3Request(`user/by-name/${email}`, { signal })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudUsersResource.js","sourceRoot":"","sources":["../../../src/cloud/users/CloudUsersResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,OAAO,kBAAkB;IAC7B,OAAO,CAA2B;IAElC,YAAY,MAAgC;QAC1C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,eAAe,CAAC,MAAe;QAC7B,OAAO,IAAI,SAAS,CAAC,2BAA2B,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,YAAY,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QACnD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACxC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,CAAC;IAED,eAAe,CAAC,KAAa,EAAE,EAAE,MAAM,KAAkB,EAAE;QACzD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,gBAAgB,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACnD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,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, V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { CloudUser, cloudUserEntityToProperties } from \"./CloudUser.ts\";\n\nexport class CloudUsersResource {\n #config: SonarV3Config & V3Config;\n\n constructor(config: SonarV3Config & V3Config) {\n this.#config = config;\n }\n\n _userFromEntity(entity: unknown) {\n return new CloudUser(cloudUserEntityToProperties(entity), this.#config);\n }\n\n retrieveById(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/${id}`, { signal })\n .map((res) => res.json())\n .map((entity) => this._userFromEntity(entity)).promise;\n }\n\n retrieveByEmail(email: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/by-name/${email}`, { signal })\n .map((res) => res.json())\n .map((entity) => this._userFromEntity(entity)).promise;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CloudUsersResource.js","sourceRoot":"","sources":["../../../src/cloud/users/CloudUsersResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAExE;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B,OAAO,CAA2B;IAElC,YAAY,MAAgC;QAC1C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,MAAe;QAC7B,OAAO,IAAI,SAAS,CAAC,2BAA2B,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QACnD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACxC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,KAAa,EAAE,EAAE,MAAM,KAAkB,EAAE;QACzD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,gBAAgB,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACnD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,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, V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { CloudUser, cloudUserEntityToProperties } from \"./CloudUser.ts\";\n\n/**\n * @deprecated\n */\nexport class CloudUsersResource {\n #config: SonarV3Config & V3Config;\n\n constructor(config: SonarV3Config & V3Config) {\n this.#config = config;\n }\n\n /**\n * @deprecated\n */\n _userFromEntity(entity: unknown) {\n return new CloudUser(cloudUserEntityToProperties(entity), this.#config);\n }\n\n /**\n * @deprecated\n */\n retrieveById(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/${id}`, { signal })\n .map((res) => res.json())\n .map((entity) => this._userFromEntity(entity)).promise;\n }\n\n /**\n * @deprecated\n */\n retrieveByEmail(email: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/by-name/${email}`, { signal })\n .map((res) => res.json())\n .map((entity) => this._userFromEntity(entity)).promise;\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type z from "zod";
|
|
2
|
+
import type { userPropertiesCodec } from "./userPropertiesCodec.ts";
|
|
3
|
+
import type { V2Config } from "../../common/Config.ts";
|
|
4
|
+
export declare class User implements z.output<typeof userPropertiesCodec> {
|
|
5
|
+
#private;
|
|
6
|
+
readonly email: string | null;
|
|
7
|
+
readonly familyName: string | null;
|
|
8
|
+
readonly givenName: string | null;
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly roles: z.output<typeof userPropertiesCodec>["roles"];
|
|
11
|
+
readonly status: z.output<typeof userPropertiesCodec>["status"];
|
|
12
|
+
readonly username: string;
|
|
13
|
+
constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>);
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export class User {
|
|
17
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
18
|
+
#config;
|
|
19
|
+
email;
|
|
20
|
+
familyName;
|
|
21
|
+
givenName;
|
|
22
|
+
id;
|
|
23
|
+
roles;
|
|
24
|
+
status;
|
|
25
|
+
username;
|
|
26
|
+
constructor(config, properties) {
|
|
27
|
+
this.#config = config;
|
|
28
|
+
this.email = properties.email;
|
|
29
|
+
this.familyName = properties.familyName;
|
|
30
|
+
this.givenName = properties.givenName;
|
|
31
|
+
this.id = properties.id;
|
|
32
|
+
this.roles = properties.roles;
|
|
33
|
+
this.status = properties.status;
|
|
34
|
+
this.username = properties.username;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=User.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/cloud/users/User.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,IAAI;IACf,2DAA2D;IAClD,OAAO,CAAW;IAClB,KAAK,CAAgB;IACrB,UAAU,CAAgB;IAC1B,SAAS,CAAgB;IACzB,EAAE,CAAS;IACX,KAAK,CAAgD;IACrD,MAAM,CAAiD;IACvD,QAAQ,CAAS;IAE1B,YAAY,MAAgB,EAAE,UAAgD;QAC5E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IACtC,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 z from \"zod\";\nimport type { userPropertiesCodec } from \"./userPropertiesCodec.ts\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nexport class User implements z.output<typeof userPropertiesCodec> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V2Config;\n readonly email: string | null;\n readonly familyName: string | null;\n readonly givenName: string | null;\n readonly id: string;\n readonly roles: z.output<typeof userPropertiesCodec>[\"roles\"];\n readonly status: z.output<typeof userPropertiesCodec>[\"status\"];\n readonly username: string;\n\n constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>) {\n this.#config = config;\n this.email = properties.email;\n this.familyName = properties.familyName;\n this.givenName = properties.givenName;\n this.id = properties.id;\n this.roles = properties.roles;\n this.status = properties.status;\n this.username = properties.username;\n }\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { V2Config } from "../../common/Config.ts";
|
|
2
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
3
|
+
import { User } from "./User.ts";
|
|
4
|
+
export declare class UsersResource {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(config: V2Config);
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
_list(): {
|
|
11
|
+
data({ signal }?: SignalParam): AsyncGenerator<User, void, unknown>;
|
|
12
|
+
getPage: ({ limit, offset, signal }: {
|
|
13
|
+
limit: number;
|
|
14
|
+
offset: number;
|
|
15
|
+
} & SignalParam) => import("ts-results-es").AsyncResult<{
|
|
16
|
+
data: User[];
|
|
17
|
+
itemsPerPage: number;
|
|
18
|
+
startIndex: number;
|
|
19
|
+
totalResults: number;
|
|
20
|
+
}, import("../index.ts").HttpError>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated
|
|
24
|
+
*/
|
|
25
|
+
_retrieveById(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<User, import("../index.ts").HttpError>;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated
|
|
28
|
+
*/
|
|
29
|
+
_retrieveByUsername(username: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<User, import("../index.ts").HttpError>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as z from "zod/mini";
|
|
17
|
+
import { userPropertiesCodec } from "./userPropertiesCodec.js";
|
|
18
|
+
import { User } from "./User.js";
|
|
19
|
+
export class UsersResource {
|
|
20
|
+
#config;
|
|
21
|
+
constructor(config) {
|
|
22
|
+
this.#config = config;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated
|
|
26
|
+
*/
|
|
27
|
+
_list() {
|
|
28
|
+
const getPage = ({ limit, offset, signal }) => this.#config
|
|
29
|
+
.v2Request(
|
|
30
|
+
// startIndex for this API must be >= 1
|
|
31
|
+
`user?${new URLSearchParams({ count: String(limit), startIndex: String(offset + 1) }).toString()}`, { headers: { Accept: "application/json" }, signal })
|
|
32
|
+
.map((res) => res.json())
|
|
33
|
+
.map((page) => ({
|
|
34
|
+
...page,
|
|
35
|
+
data: page.data.map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity))),
|
|
36
|
+
}));
|
|
37
|
+
return {
|
|
38
|
+
async *data({ signal } = {}) {
|
|
39
|
+
const USERS_PAGE_SIZE = 100;
|
|
40
|
+
let offset = 0;
|
|
41
|
+
const firstPageResult = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise;
|
|
42
|
+
if (firstPageResult.isErr()) {
|
|
43
|
+
throw firstPageResult.error;
|
|
44
|
+
}
|
|
45
|
+
let currentPage = firstPageResult.value;
|
|
46
|
+
yield* currentPage.data;
|
|
47
|
+
while (currentPage.totalResults > offset - 1 + USERS_PAGE_SIZE) {
|
|
48
|
+
offset += USERS_PAGE_SIZE;
|
|
49
|
+
currentPage = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise.then((result) => result.unwrap());
|
|
50
|
+
yield* currentPage.data;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
getPage,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated
|
|
58
|
+
*/
|
|
59
|
+
_retrieveById(id, { signal } = {}) {
|
|
60
|
+
return this.#config
|
|
61
|
+
.v2Request(`user/${id}`, {
|
|
62
|
+
headers: {
|
|
63
|
+
Accept: "application/json",
|
|
64
|
+
},
|
|
65
|
+
signal,
|
|
66
|
+
})
|
|
67
|
+
.map((res) => res.json())
|
|
68
|
+
.map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated
|
|
72
|
+
*/
|
|
73
|
+
_retrieveByUsername(username, { signal } = {}) {
|
|
74
|
+
return this.#config
|
|
75
|
+
.v2Request(`user/by-name/${username}`, {
|
|
76
|
+
headers: {
|
|
77
|
+
Accept: "application/json",
|
|
78
|
+
},
|
|
79
|
+
signal,
|
|
80
|
+
})
|
|
81
|
+
.map((res) => res.json())
|
|
82
|
+
.map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=UsersResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsersResource.js","sourceRoot":"","sources":["../../../src/cloud/users/UsersResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;A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;YACD,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAkD,CAAC;aACxE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACpF,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 * as z from \"zod/mini\";\nimport type { V2Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { userPropertiesCodec } from \"./userPropertiesCodec.js\";\nimport { User } from \"./User.ts\";\n\nexport class UsersResource {\n #config: V2Config;\n\n constructor(config: V2Config) {\n this.#config = config;\n }\n\n /**\n * @deprecated\n */\n _list() {\n const getPage = ({ limit, offset, signal }: { limit: number; offset: number } & SignalParam) =>\n this.#config\n .v2Request(\n // startIndex for this API must be >= 1\n `user?${new URLSearchParams({ count: String(limit), startIndex: String(offset + 1) }).toString()}`,\n { headers: { Accept: \"application/json\" }, signal },\n )\n .map(\n (res) =>\n res.json() as Promise<{\n data: z.input<typeof userPropertiesCodec>[];\n itemsPerPage: number;\n startIndex: number;\n totalResults: number;\n }>,\n )\n .map((page) => ({\n ...page,\n data: page.data.map(\n (entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)),\n ),\n }));\n\n return {\n async *data({ signal }: SignalParam = {}) {\n const USERS_PAGE_SIZE = 100;\n let offset = 0;\n const firstPageResult = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise;\n if (firstPageResult.isErr()) {\n throw firstPageResult.error;\n }\n let currentPage = firstPageResult.value;\n yield* currentPage.data;\n while (currentPage.totalResults > offset - 1 + USERS_PAGE_SIZE) {\n offset += USERS_PAGE_SIZE;\n currentPage = await getPage({ limit: USERS_PAGE_SIZE, offset, signal }).promise.then(\n (result) => result.unwrap(),\n );\n yield* currentPage.data;\n }\n },\n getPage,\n };\n }\n\n /**\n * @deprecated\n */\n _retrieveById(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .v2Request(`user/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n\n /**\n * @deprecated\n */\n _retrieveByUsername(username: string, { signal }: SignalParam = {}) {\n return this.#config\n .v2Request(`user/by-name/${username}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof userPropertiesCodec>>)\n .map((entity) => new User(this.#config, z.decode(userPropertiesCodec, entity)));\n }\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
export declare const userPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
|
|
3
|
+
email: z.ZodMiniString<string>;
|
|
4
|
+
firstName: z.ZodMiniString<string>;
|
|
5
|
+
id: z.ZodMiniString<string>;
|
|
6
|
+
lastName: z.ZodMiniString<string>;
|
|
7
|
+
roles: z.ZodMiniArray<z.ZodMiniObject<{
|
|
8
|
+
id: z.ZodMiniString<string>;
|
|
9
|
+
name: z.ZodMiniString<string>;
|
|
10
|
+
type: z.ZodMiniEnum<{
|
|
11
|
+
INTERNAL: "INTERNAL";
|
|
12
|
+
EXTERNAL: "EXTERNAL";
|
|
13
|
+
SYSTEM: "SYSTEM";
|
|
14
|
+
}>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
status: z.ZodMiniEnum<{
|
|
17
|
+
ACTIVE: "ACTIVE";
|
|
18
|
+
INACTIVE: "INACTIVE";
|
|
19
|
+
}>;
|
|
20
|
+
username: z.ZodMiniString<string>;
|
|
21
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
22
|
+
id: z.ZodMiniString<string>;
|
|
23
|
+
status: z.ZodMiniEnum<{
|
|
24
|
+
ACTIVE: "ACTIVE";
|
|
25
|
+
INACTIVE: "INACTIVE";
|
|
26
|
+
}>;
|
|
27
|
+
username: z.ZodMiniString<string>;
|
|
28
|
+
roles: z.ZodMiniArray<z.ZodMiniObject<{
|
|
29
|
+
id: z.ZodMiniString<string>;
|
|
30
|
+
name: z.ZodMiniString<string>;
|
|
31
|
+
type: z.ZodMiniEnum<{
|
|
32
|
+
INTERNAL: "INTERNAL";
|
|
33
|
+
EXTERNAL: "EXTERNAL";
|
|
34
|
+
SYSTEM: "SYSTEM";
|
|
35
|
+
}>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
email: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
38
|
+
familyName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
39
|
+
givenName: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2024-2025 Dremio Corporation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as z from "zod/mini";
|
|
17
|
+
const userPropertiesInSchema = z.object({
|
|
18
|
+
email: z.string(),
|
|
19
|
+
firstName: z.string(),
|
|
20
|
+
id: z.string().check(z.minLength(1)),
|
|
21
|
+
lastName: z.string(),
|
|
22
|
+
roles: z.array(z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
name: z.string(),
|
|
25
|
+
type: z.enum(["INTERNAL", "EXTERNAL", "SYSTEM"]),
|
|
26
|
+
})),
|
|
27
|
+
status: z.enum(["ACTIVE", "INACTIVE"]),
|
|
28
|
+
username: z.string().check(z.trim(), z.minLength(1)),
|
|
29
|
+
});
|
|
30
|
+
export const userPropertiesCodec = z.codec(userPropertiesInSchema, z.extend(z.omit(userPropertiesInSchema, {
|
|
31
|
+
email: true,
|
|
32
|
+
firstName: true,
|
|
33
|
+
lastName: true,
|
|
34
|
+
}), {
|
|
35
|
+
email: z.nullable(z.string().check(z.email())),
|
|
36
|
+
familyName: z.nullable(z.string()),
|
|
37
|
+
givenName: z.nullable(z.string()),
|
|
38
|
+
}), {
|
|
39
|
+
decode(v) {
|
|
40
|
+
return {
|
|
41
|
+
...v,
|
|
42
|
+
email: v.email || null,
|
|
43
|
+
familyName: v.lastName || null,
|
|
44
|
+
givenName: v.firstName || null,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
encode(v) {
|
|
48
|
+
const { email, familyName, givenName, ...rest } = v;
|
|
49
|
+
return {
|
|
50
|
+
...rest,
|
|
51
|
+
email: email || "",
|
|
52
|
+
firstName: givenName || "",
|
|
53
|
+
lastName: familyName || "",
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=userPropertiesCodec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":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9C,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAClC,CACF,EACD;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,GAAG,CAAC;YACJ,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI;YACtB,UAAU,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;YAC9B,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;SAC/B,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;QACpD,OAAO;YACL,GAAG,IAAI;YACP,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,QAAQ,EAAE,UAAU,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;CACF,CACF,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 * as z from \"zod/mini\";\n\nconst userPropertiesInSchema = z.object({\n email: z.string(),\n firstName: z.string(),\n id: z.string().check(z.minLength(1)),\n lastName: z.string(),\n roles: z.array(\n z.object({\n id: z.string(),\n name: z.string(),\n type: z.enum([\"INTERNAL\", \"EXTERNAL\", \"SYSTEM\"]),\n }),\n ),\n status: z.enum([\"ACTIVE\", \"INACTIVE\"]),\n username: z.string().check(z.trim(), z.minLength(1)),\n});\n\nexport const userPropertiesCodec = z.codec(\n userPropertiesInSchema,\n z.extend(\n z.omit(userPropertiesInSchema, {\n email: true,\n firstName: true,\n lastName: true,\n }),\n {\n email: z.nullable(z.string().check(z.email())),\n familyName: z.nullable(z.string()),\n givenName: z.nullable(z.string()),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n email: v.email || null,\n familyName: v.lastName || null,\n givenName: v.firstName || null,\n };\n },\n encode(v) {\n const { email, familyName, givenName, ...rest } = v;\n return {\n ...rest,\n email: email || \"\",\n firstName: givenName || \"\",\n lastName: familyName || \"\",\n };\n },\n },\n);\n"]}
|