@dremio/js-sdk 0.19.0 → 0.21.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.
Files changed (38) hide show
  1. package/dist/cloud/Dremio.d.ts +42 -0
  2. package/dist/cloud/Dremio.js +63 -0
  3. package/dist/cloud/Dremio.js.map +1 -0
  4. package/dist/cloud/getResourceConfig.d.ts +14 -0
  5. package/dist/cloud/getResourceConfig.js +38 -0
  6. package/dist/cloud/getResourceConfig.js.map +1 -0
  7. package/dist/cloud/index.d.ts +1 -351
  8. package/dist/cloud/index.js +1 -33
  9. package/dist/cloud/index.js.map +1 -1
  10. package/dist/cloud/organizations/organizationEntityToProperties.d.ts +1 -1
  11. package/dist/enterprise/Dremio.d.ts +33 -0
  12. package/dist/enterprise/{resources.js → Dremio.js} +28 -19
  13. package/dist/enterprise/Dremio.js.map +1 -0
  14. package/dist/enterprise/index.d.ts +1 -28
  15. package/dist/enterprise/index.js +1 -25
  16. package/dist/enterprise/index.js.map +1 -1
  17. package/dist/enterprise/roles/Role.d.ts +14 -9
  18. package/dist/enterprise/roles/Role.js +38 -16
  19. package/dist/enterprise/roles/Role.js.map +1 -1
  20. package/dist/enterprise/roles/RolesResource.js +9 -4
  21. package/dist/enterprise/roles/RolesResource.js.map +1 -1
  22. package/dist/oss/Dremio.d.ts +29 -0
  23. package/dist/oss/{resources.js → Dremio.js} +21 -8
  24. package/dist/oss/Dremio.js.map +1 -0
  25. package/dist/oss/getResourceConfig.d.ts +15 -0
  26. package/dist/oss/getResourceConfig.js +29 -0
  27. package/dist/oss/getResourceConfig.js.map +1 -0
  28. package/dist/oss/index.d.ts +1 -24
  29. package/dist/oss/index.js +1 -23
  30. package/dist/oss/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/dist/cloud/resources.d.ts +0 -352
  33. package/dist/cloud/resources.js +0 -47
  34. package/dist/cloud/resources.js.map +0 -1
  35. package/dist/enterprise/resources.d.ts +0 -21
  36. package/dist/enterprise/resources.js.map +0 -1
  37. package/dist/oss/resources.d.ts +0 -13
  38. package/dist/oss/resources.js.map +0 -1
@@ -13,26 +13,35 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { JobsResource } from "../oss/jobs/JobsResource.js";
17
- import { Resources as CommunityResources } from "../oss/resources.js";
18
16
  import { EnterpriseCatalogResource } from "./catalog/EnterpriseCatalogResource.js";
19
- import { RolesResource } from "./roles/RolesResource.js";
17
+ import { JobsResource } from "../oss/jobs/JobsResource.js";
20
18
  import { EnterpriseScriptsResource } from "./scripts/EnterpriseScriptsResource.js";
19
+ import { SqlResource } from "../oss/sql/SqlResource.js";
21
20
  import { EnterpriseUsersResource } from "./users/EnterpriseUsersResource.js";
22
21
  import { EnginesResource } from "./engines/EnginesResource.js";
23
- import { SqlResource } from "../oss/sql/SqlResource.js";
24
- /**
25
- * @internal
26
- * @hidden
27
- */
28
- export const Resources = (config) => ({
29
- ...CommunityResources(config),
30
- catalog: new EnterpriseCatalogResource(config),
31
- engines: new EnginesResource(config),
32
- jobs: new JobsResource(config),
33
- roles: new RolesResource(config),
34
- scripts: new EnterpriseScriptsResource(config),
35
- sql: new SqlResource(config),
36
- users: new EnterpriseUsersResource(config),
37
- });
38
- //# sourceMappingURL=resources.js.map
22
+ import { RolesResource } from "./roles/RolesResource.js";
23
+ import { getResourceConfig } from "../oss/getResourceConfig.js";
24
+ export class Dremio {
25
+ catalog;
26
+ engines;
27
+ jobs;
28
+ roles;
29
+ scripts;
30
+ sql;
31
+ users;
32
+ #resourceConfig;
33
+ constructor(config) {
34
+ this.#resourceConfig = getResourceConfig(config);
35
+ this.catalog = new EnterpriseCatalogResource(this.#resourceConfig);
36
+ this.engines = new EnginesResource(this.#resourceConfig);
37
+ this.jobs = new JobsResource(this.#resourceConfig);
38
+ this.roles = new RolesResource(this.#resourceConfig);
39
+ this.scripts = new EnterpriseScriptsResource(this.#resourceConfig);
40
+ this.sql = new SqlResource(this.#resourceConfig);
41
+ this.users = new EnterpriseUsersResource(this.#resourceConfig);
42
+ }
43
+ get _resourceConfig() {
44
+ return this.#resourceConfig;
45
+ }
46
+ }
47
+ //# sourceMappingURL=Dremio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/enterprise/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,OAAO,MAAM;IACR,OAAO,CAA4B;IACnC,OAAO,CAAkB;IACzB,IAAI,CAAe;IACnB,KAAK,CAAgB;IACrB,OAAO,CAA4B;IACnC,GAAG,CAAc;IACjB,KAAK,CAA0B;IAC/B,eAAe,CAAuC;IAE/D,YAAY,MAAc;QACxB,IAAI,CAAC,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,KAAK,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACjE,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 type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"./catalog/EnterpriseCatalogResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.js\";\nimport { EnterpriseScriptsResource } from \"./scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { EnterpriseUsersResource } from \"./users/EnterpriseUsersResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { RolesResource } from \"./roles/RolesResource.js\";\nimport { getResourceConfig } from \"../oss/getResourceConfig.ts\";\n\nexport class Dremio {\n readonly catalog: EnterpriseCatalogResource;\n readonly engines: EnginesResource;\n readonly jobs: JobsResource;\n readonly roles: RolesResource;\n readonly scripts: EnterpriseScriptsResource;\n readonly sql: SqlResource;\n readonly users: EnterpriseUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.catalog = new EnterpriseCatalogResource(this.#resourceConfig);\n this.engines = new EnginesResource(this.#resourceConfig);\n this.jobs = new JobsResource(this.#resourceConfig);\n this.roles = new RolesResource(this.#resourceConfig);\n this.scripts = new EnterpriseScriptsResource(this.#resourceConfig);\n this.sql = new SqlResource(this.#resourceConfig);\n this.users = new EnterpriseUsersResource(this.#resourceConfig);\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
@@ -1,31 +1,4 @@
1
- import type { Config } from "../common/Config.ts";
2
- export declare const Dremio: (config: Config) => {
3
- _request: import("../common/Config.ts").RequestFn;
4
- _sonarResourceConfig: {
5
- logger: {
6
- debug: typeof console.debug;
7
- error: typeof console.error;
8
- info: typeof console.info;
9
- warn: typeof console.warn;
10
- } | undefined;
11
- origin: string;
12
- request: import("../common/Config.ts").RequestFn;
13
- sonarV2Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
14
- sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
15
- sonarV4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
16
- v3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
17
- };
18
- _sonarV2Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
19
- _sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
20
- _sonarV4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
21
- catalog: import("./catalog/EnterpriseCatalogResource.ts").EnterpriseCatalogResource;
22
- engines: import("./engines/EnginesResource.ts").EnginesResource;
23
- jobs: import("../oss/jobs/JobsResource.ts").JobsResource;
24
- roles: import("./roles/RolesResource.ts").RolesResource;
25
- scripts: import("./scripts/EnterpriseScriptsResource.ts").EnterpriseScriptsResource;
26
- sql: import("../oss/sql/SqlResource.ts").SqlResource;
27
- users: import("./users/EnterpriseUsersResource.ts").EnterpriseUsersResource;
28
- };
1
+ export * from "./Dremio.ts";
29
2
  export * from "../common/sharedExports.ts";
30
3
  export * from "./credentials/index.ts";
31
4
  export * from "./interfaces.ts";
@@ -13,31 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { createRequest } from "../common/createRequest.js";
17
- import { Resources } from "./resources.js";
18
- const getSonarResourceConfig = (config) => {
19
- const request = createRequest(config);
20
- return {
21
- logger: config.logger,
22
- origin: config.origin,
23
- request,
24
- sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),
25
- sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),
26
- sonarV4Request: (path, init) => request(`/api/v4/${path}`, init),
27
- v3Request: (path, init) => request(`/api/v3/${path}`, init),
28
- };
29
- };
30
- export const Dremio = (config) => {
31
- const sonarResourceConfig = getSonarResourceConfig(config);
32
- return {
33
- ...Resources(sonarResourceConfig),
34
- _request: sonarResourceConfig.request,
35
- _sonarResourceConfig: sonarResourceConfig,
36
- _sonarV2Request: sonarResourceConfig.sonarV2Request,
37
- _sonarV3Request: sonarResourceConfig.sonarV3Request,
38
- _sonarV4Request: sonarResourceConfig.sonarV4Request,
39
- };
40
- };
16
+ export * from "./Dremio.js";
41
17
  export * from "../common/sharedExports.js";
42
18
  export * from "./credentials/index.js";
43
19
  export * from "./interfaces.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enterprise/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAS3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE;IAChD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC;QAC/D,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;KACwB,CAAC;AACxF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,mBAAmB,CAAC,OAAO;QACrC,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,mBAAmB,CAAC,cAAc;QACnD,eAAe,EAAE,mBAAmB,CAAC,cAAc;QACnD,eAAe,EAAE,mBAAmB,CAAC,cAAc;KACpD,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createRequest } from \"../common/createRequest.ts\";\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V3Config,\n} from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n sonarV4Request: (path, init) => request(`/api/v4/${path}`, init),\n v3Request: (path, init) => request(`/api/v3/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config & SonarV4Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: sonarResourceConfig.request,\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV2Request: sonarResourceConfig.sonarV2Request,\n _sonarV3Request: sonarResourceConfig.sonarV3Request,\n _sonarV4Request: sonarResourceConfig.sonarV4Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enterprise/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,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\nexport * from \"./Dremio.ts\";\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\n"]}
@@ -1,14 +1,20 @@
1
+ import type { SonarV3Config } from "../../common/Config.ts";
1
2
  export declare class Role implements RoleProperties {
3
+ #private;
4
+ readonly roleReference: RoleProperties["roleReference"];
2
5
  readonly description: RoleProperties["description"];
3
- readonly id: RoleProperties["id"];
4
6
  readonly memberCount: RoleProperties["memberCount"];
5
- readonly name: RoleProperties["name"];
6
7
  readonly roles: RoleProperties["roles"];
7
- readonly type: RoleProperties["type"];
8
- constructor(properties: RoleProperties);
9
- static fromResource(properties: RoleEntity): Role;
8
+ constructor(properties: RoleProperties, config: SonarV3Config);
9
+ update(properties: {
10
+ name?: RoleReference["name"];
11
+ roles?: Role["roles"];
12
+ description?: Role["description"];
13
+ }): import("ts-results-es").AsyncResult<Role, import("../index.ts").HttpError>;
14
+ static fromResource(properties: RoleEntity, config: SonarV3Config): Role;
10
15
  }
11
16
  export declare class RoleReference {
17
+ #private;
12
18
  readonly id: string;
13
19
  readonly name: string;
14
20
  /**
@@ -19,15 +25,14 @@ export declare class RoleReference {
19
25
  id: RoleReference["id"];
20
26
  name: RoleReference["name"];
21
27
  type: RoleReference["type"];
22
- });
28
+ }, config: SonarV3Config);
29
+ delete(): import("ts-results-es").AsyncResult<void, import("../index.ts").HttpError>;
23
30
  }
24
31
  export type RoleProperties = {
32
+ readonly roleReference: RoleReference;
25
33
  readonly description: string | null;
26
- readonly id: string;
27
34
  readonly memberCount: number;
28
- readonly name: string;
29
35
  readonly roles: RoleReference[];
30
- readonly type: RoleEntity["type"];
31
36
  };
32
37
  export type RoleEntity = {
33
38
  id: string;
@@ -14,35 +14,50 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export class Role {
17
+ roleReference;
17
18
  description;
18
- id;
19
19
  memberCount;
20
- name;
21
20
  roles;
22
- type;
23
- constructor(properties) {
21
+ #config;
22
+ constructor(properties, config) {
23
+ this.roleReference = properties.roleReference;
24
24
  this.description = properties.description;
25
- this.id = properties.id;
26
25
  /**
27
26
  * Number of users and roles that are members of the role
28
27
  */
29
28
  this.memberCount = properties.memberCount;
30
- this.name = properties.name;
31
29
  /**
32
30
  * Information about the roles to which the role belong
33
31
  */
34
32
  this.roles = properties.roles;
35
- /**
36
- * Origin of the role
37
- */
38
- this.type = properties.type;
33
+ this.#config = config;
39
34
  }
40
- static fromResource(properties) {
35
+ update(properties) {
36
+ return this.#config
37
+ .sonarV3Request(`role/${this.roleReference.id}`, {
38
+ body: JSON.stringify({
39
+ description: properties.description ?? this.description,
40
+ name: properties.name ?? this.roleReference.name,
41
+ roles: properties.roles?.map((ref) => ref.id) || this.roles,
42
+ }),
43
+ headers: {
44
+ Accept: "application/json",
45
+ "Content-Type": "application/json",
46
+ },
47
+ keepalive: true,
48
+ method: "PUT",
49
+ })
50
+ .map((res) => res.json())
51
+ .map((roleEntity) => Role.fromResource(roleEntity, this.#config));
52
+ }
53
+ static fromResource(properties, config) {
54
+ const { description, id, name, roles, type, ...rest } = properties;
41
55
  return new Role({
42
- ...properties,
43
- description: properties.description?.length ? properties.description : null,
44
- roles: properties.roles.map((roleReferenceEntity) => new RoleReference(roleReferenceEntity)),
45
- });
56
+ ...rest,
57
+ description: description?.length ? description : null,
58
+ roleReference: new RoleReference({ id, name, type }, config),
59
+ roles: roles.map((roleReferenceEntity) => new RoleReference(roleReferenceEntity, config)),
60
+ }, config);
46
61
  }
47
62
  }
48
63
  export class RoleReference {
@@ -52,10 +67,17 @@ export class RoleReference {
52
67
  * Origin of the role
53
68
  */
54
69
  type;
55
- constructor(properties) {
70
+ #config;
71
+ constructor(properties, config) {
56
72
  this.id = properties.id;
57
73
  this.name = properties.name;
58
74
  this.type = properties.type;
75
+ this.#config = config;
76
+ }
77
+ delete() {
78
+ return this.#config
79
+ .sonarV3Request(`role/${this.id}`, { keepalive: true, method: "DELETE" })
80
+ .map(() => undefined);
59
81
  }
60
82
  }
61
83
  //# sourceMappingURL=Role.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Role.js","sourceRoot":"","sources":["../../../src/enterprise/roles/Role.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,OAAO,IAAI;IACN,WAAW,CAAgC;IAC3C,EAAE,CAAuB;IACzB,WAAW,CAAgC;IAC3C,IAAI,CAAyB;IAC7B,KAAK,CAA0B;IAC/B,IAAI,CAAyB;IAEtC,YAAY,UAA0B;QACpC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QAExB;;WAEG;QACH,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAE1C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE5B;;WAEG;QACH,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAE9B;;WAEG;QACH,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,UAAsB;QACxC,OAAO,IAAI,IAAI,CAAC;YACd,GAAG,UAAU;YACb,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;YAC3E,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,mBAAmB,CAAC,CAAC;SAC7F,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,aAAa;IACf,EAAE,CAAS;IACX,IAAI,CAAS;IAEtB;;OAEG;IACM,IAAI,CAAqB;IAElC,YAAY,UAIX;QACC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,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\nexport class Role implements RoleProperties {\n readonly description: RoleProperties[\"description\"];\n readonly id: RoleProperties[\"id\"];\n readonly memberCount: RoleProperties[\"memberCount\"];\n readonly name: RoleProperties[\"name\"];\n readonly roles: RoleProperties[\"roles\"];\n readonly type: RoleProperties[\"type\"];\n\n constructor(properties: RoleProperties) {\n this.description = properties.description;\n this.id = properties.id;\n\n /**\n * Number of users and roles that are members of the role\n */\n this.memberCount = properties.memberCount;\n\n this.name = properties.name;\n\n /**\n * Information about the roles to which the role belong\n */\n this.roles = properties.roles;\n\n /**\n * Origin of the role\n */\n this.type = properties.type;\n }\n\n static fromResource(properties: RoleEntity) {\n return new Role({\n ...properties,\n description: properties.description?.length ? properties.description : null,\n roles: properties.roles.map((roleReferenceEntity) => new RoleReference(roleReferenceEntity)),\n });\n }\n}\n\nexport class RoleReference {\n readonly id: string;\n readonly name: string;\n\n /**\n * Origin of the role\n */\n readonly type: RoleEntity[\"type\"];\n\n constructor(properties: {\n id: RoleReference[\"id\"];\n name: RoleReference[\"name\"];\n type: RoleReference[\"type\"];\n }) {\n this.id = properties.id;\n this.name = properties.name;\n this.type = properties.type;\n }\n}\n\nexport type RoleProperties = {\n readonly description: string | null;\n readonly id: string;\n readonly memberCount: number;\n readonly name: string;\n readonly roles: RoleReference[];\n readonly type: RoleEntity[\"type\"];\n};\n\nexport type RoleEntity = {\n id: string;\n name: string;\n type: \"INTERNAL\" | \"EXTERNAL\" | \"SYSTEM\";\n roles: RoleEntity[];\n memberCount: number;\n description: string;\n};\n"]}
1
+ {"version":3,"file":"Role.js","sourceRoot":"","sources":["../../../src/enterprise/roles/Role.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,OAAO,IAAI;IACN,aAAa,CAAkC;IAC/C,WAAW,CAAgC;IAC3C,WAAW,CAAgC;IAC3C,KAAK,CAA0B;IAE/B,OAAO,CAAgB;IAEhC,YAAY,UAA0B,EAAE,MAAqB;QAC3D,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAE9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAE1C;;WAEG;QACH,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAE1C;;WAEG;QACH,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAE9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,UAIN;QACC,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,QAAQ,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW;gBACvD,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI;gBAChD,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK;aAC5D,CAAC;YACF,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAyB,CAAC;aAC/C,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,UAAsB,EAAE,MAAqB;QAC/D,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;QACnE,OAAO,IAAI,IAAI,CACb;YACE,GAAG,IAAI;YACP,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;YACrD,aAAa,EAAE,IAAI,aAAa,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC;YAC5D,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;SAC1F,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,aAAa;IACf,EAAE,CAAS;IACX,IAAI,CAAS;IAEtB;;OAEG;IACM,IAAI,CAAqB;IAEzB,OAAO,CAAgB;IAEhC,YACE,UAIC,EACD,MAAqB;QAErB,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,QAAQ,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;aACxE,GAAG,CAAC,GAAG,EAAE,CAAC,SAAiB,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV3Config } from \"../../common/Config.ts\";\n\nexport class Role implements RoleProperties {\n readonly roleReference: RoleProperties[\"roleReference\"];\n readonly description: RoleProperties[\"description\"];\n readonly memberCount: RoleProperties[\"memberCount\"];\n readonly roles: RoleProperties[\"roles\"];\n\n readonly #config: SonarV3Config;\n\n constructor(properties: RoleProperties, config: SonarV3Config) {\n this.roleReference = properties.roleReference;\n\n this.description = properties.description;\n\n /**\n * Number of users and roles that are members of the role\n */\n this.memberCount = properties.memberCount;\n\n /**\n * Information about the roles to which the role belong\n */\n this.roles = properties.roles;\n\n this.#config = config;\n }\n\n update(properties: {\n name?: RoleReference[\"name\"];\n roles?: Role[\"roles\"];\n description?: Role[\"description\"];\n }) {\n return this.#config\n .sonarV3Request(`role/${this.roleReference.id}`, {\n body: JSON.stringify({\n description: properties.description ?? this.description,\n name: properties.name ?? this.roleReference.name,\n roles: properties.roles?.map((ref) => ref.id) || this.roles,\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<RoleEntity>)\n .map((roleEntity) => Role.fromResource(roleEntity, this.#config));\n }\n\n static fromResource(properties: RoleEntity, config: SonarV3Config) {\n const { description, id, name, roles, type, ...rest } = properties;\n return new Role(\n {\n ...rest,\n description: description?.length ? description : null,\n roleReference: new RoleReference({ id, name, type }, config),\n roles: roles.map((roleReferenceEntity) => new RoleReference(roleReferenceEntity, config)),\n },\n config,\n );\n }\n}\n\nexport class RoleReference {\n readonly id: string;\n readonly name: string;\n\n /**\n * Origin of the role\n */\n readonly type: RoleEntity[\"type\"];\n\n readonly #config: SonarV3Config;\n\n constructor(\n properties: {\n id: RoleReference[\"id\"];\n name: RoleReference[\"name\"];\n type: RoleReference[\"type\"];\n },\n config: SonarV3Config,\n ) {\n this.id = properties.id;\n this.name = properties.name;\n this.type = properties.type;\n this.#config = config;\n }\n\n delete() {\n return this.#config\n .sonarV3Request(`role/${this.id}`, { keepalive: true, method: \"DELETE\" })\n .map(() => undefined as void);\n }\n}\n\nexport type RoleProperties = {\n readonly roleReference: RoleReference;\n readonly description: string | null;\n readonly memberCount: number;\n readonly roles: RoleReference[];\n};\n\nexport type RoleEntity = {\n id: string;\n name: string;\n type: \"INTERNAL\" | \"EXTERNAL\" | \"SYSTEM\";\n roles: RoleEntity[];\n memberCount: number;\n description: string;\n};\n"]}
@@ -21,12 +21,17 @@ export class RolesResource {
21
21
  }
22
22
  list() {
23
23
  const getPage = ({ signal } = {}) => this.#config
24
- .sonarV3Request("role", { signal })
24
+ .sonarV3Request("role", {
25
+ headers: {
26
+ Accept: "application/json",
27
+ },
28
+ signal,
29
+ })
25
30
  .map((res) => res.json())
26
31
  .map((response) => {
27
32
  return {
28
33
  ...response,
29
- data: response.data.map((entity) => Role.fromResource(entity)),
34
+ data: response.data.map((entity) => Role.fromResource(entity, this.#config)),
30
35
  };
31
36
  });
32
37
  return {
@@ -42,13 +47,13 @@ export class RolesResource {
42
47
  return this.#config
43
48
  .sonarV3Request(`role/${id}`, { signal })
44
49
  .map((res) => res.json())
45
- .map((properties) => Role.fromResource(properties)).promise;
50
+ .map((properties) => Role.fromResource(properties, this.#config)).promise;
46
51
  }
47
52
  retrieveByName(name, { signal } = {}) {
48
53
  return this.#config
49
54
  .sonarV3Request(`role/by-name/${name}`, { signal })
50
55
  .map((res) => res.json())
51
- .map((properties) => Role.fromResource(properties)).promise;
56
+ .map((properties) => Role.fromResource(properties, this.#config)).promise;
52
57
  }
53
58
  }
54
59
  //# sourceMappingURL=RolesResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RolesResource.js","sourceRoot":"","sources":["../../../src/enterprise/roles/RolesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,IAAI,EAAmB,MAAM,WAAW,CAAC;AAGlD,MAAM,OAAO,aAAa;IACxB,OAAO,CAAgB;IAEvB,YAAY,MAAqB;QAC/B,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,cAAc,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC;aAClC,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,IAAI,EAGN,CACL;aACA,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChB,OAAO;gBACL,GAAG,QAAQ;gBACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;aAC/D,CAAC;QACJ,CAAC,CAAC,CAAC;QACP,OAAO;YACL,KAAK,CAAC,CAAC,IAAI;gBACT,KAAK,CAAC,CAAC,MAAM,OAAO,EAAE;qBACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;qBAClB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAC/C,CAAC;YACD,OAAO;SACR,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,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,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,EAAE,MAAM,KAAkB,EAAE;QACvD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,gBAAgB,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aAClD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { Role, type RoleEntity } from \"./Role.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class RolesResource {\n #config: SonarV3Config;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"role\", { signal })\n .map(\n (res) =>\n res.json() as Promise<{\n data: RoleEntity[];\n totalResults: number;\n }>,\n )\n .map((response) => {\n return {\n ...response,\n data: response.data.map((entity) => Role.fromResource(entity)),\n };\n });\n return {\n async *data() {\n yield* await getPage()\n .map((v) => v.data)\n .promise.then((result) => result.unwrap());\n },\n getPage,\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`role/${id}`, { signal })\n .map((res) => res.json())\n .map((properties) => Role.fromResource(properties)).promise;\n }\n\n retrieveByName(name: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`role/by-name/${name}`, { signal })\n .map((res) => res.json())\n .map((properties) => Role.fromResource(properties)).promise;\n }\n}\n"]}
1
+ {"version":3,"file":"RolesResource.js","sourceRoot":"","sources":["../../../src/enterprise/roles/RolesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,IAAI,EAAmB,MAAM,WAAW,CAAC;AAGlD,MAAM,OAAO,aAAa;IACxB,OAAO,CAAgB;IAEvB,YAAY,MAAqB;QAC/B,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,cAAc,CAAC,MAAM,EAAE;YACtB,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CAAC;aACD,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,IAAI,EAGN,CACL;aACA,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChB,OAAO;gBACL,GAAG,QAAQ;gBACX,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;aAC7E,CAAC;QACJ,CAAC,CAAC,CAAC;QACP,OAAO;YACL,KAAK,CAAC,CAAC,IAAI;gBACT,KAAK,CAAC,CAAC,MAAM,OAAO,EAAE;qBACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;qBAClB,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAC/C,CAAC;YACD,OAAO;SACR,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,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,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9E,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,EAAE,MAAM,KAAkB,EAAE;QACvD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,gBAAgB,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aAClD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9E,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { Role, type RoleEntity } from \"./Role.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class RolesResource {\n #config: SonarV3Config;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"role\", {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map(\n (res) =>\n res.json() as Promise<{\n data: RoleEntity[];\n totalResults: number;\n }>,\n )\n .map((response) => {\n return {\n ...response,\n data: response.data.map((entity) => Role.fromResource(entity, this.#config)),\n };\n });\n return {\n async *data() {\n yield* await getPage()\n .map((v) => v.data)\n .promise.then((result) => result.unwrap());\n },\n getPage,\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`role/${id}`, { signal })\n .map((res) => res.json())\n .map((properties) => Role.fromResource(properties, this.#config)).promise;\n }\n\n retrieveByName(name: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`role/by-name/${name}`, { signal })\n .map((res) => res.json())\n .map((properties) => Role.fromResource(properties, this.#config)).promise;\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import type { Config } from "../common/Config.ts";
2
+ import { CatalogResource } from "./catalog/CatalogResource.ts";
3
+ import { JobsResource } from "./jobs/JobsResource.ts";
4
+ import { ScriptsResource } from "./scripts/ScriptsResource.ts";
5
+ import { SqlResource } from "./sql/SqlResource.ts";
6
+ import { UsersResource } from "./users/UsersResource.ts";
7
+ export declare class Dremio {
8
+ #private;
9
+ readonly catalog: CatalogResource;
10
+ readonly jobs: JobsResource;
11
+ readonly scripts: ScriptsResource;
12
+ readonly sql: SqlResource;
13
+ readonly users: UsersResource;
14
+ constructor(config: Config);
15
+ get _resourceConfig(): {
16
+ logger: {
17
+ debug: typeof console.debug;
18
+ error: typeof console.error;
19
+ info: typeof console.info;
20
+ warn: typeof console.warn;
21
+ } | undefined;
22
+ origin: string;
23
+ request: import("../common/Config.ts").RequestFn;
24
+ sonarV2Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
25
+ sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
26
+ sonarV4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
27
+ v3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
28
+ };
29
+ }
@@ -18,11 +18,24 @@ import { JobsResource } from "./jobs/JobsResource.js";
18
18
  import { ScriptsResource } from "./scripts/ScriptsResource.js";
19
19
  import { SqlResource } from "./sql/SqlResource.js";
20
20
  import { UsersResource } from "./users/UsersResource.js";
21
- export const Resources = (config) => ({
22
- catalog: new CatalogResource(config),
23
- jobs: new JobsResource(config),
24
- scripts: new ScriptsResource(config),
25
- sql: new SqlResource(config),
26
- users: new UsersResource(config),
27
- });
28
- //# sourceMappingURL=resources.js.map
21
+ import { getResourceConfig } from "./getResourceConfig.js";
22
+ export class Dremio {
23
+ catalog;
24
+ jobs;
25
+ scripts;
26
+ sql;
27
+ users;
28
+ #resourceConfig;
29
+ constructor(config) {
30
+ this.#resourceConfig = getResourceConfig(config);
31
+ this.catalog = new CatalogResource(this.#resourceConfig);
32
+ this.jobs = new JobsResource(this.#resourceConfig);
33
+ this.scripts = new ScriptsResource(this.#resourceConfig);
34
+ this.sql = new SqlResource(this.#resourceConfig);
35
+ this.users = new UsersResource(this.#resourceConfig);
36
+ }
37
+ get _resourceConfig() {
38
+ return this.#resourceConfig;
39
+ }
40
+ }
41
+ //# sourceMappingURL=Dremio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/oss/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,OAAO,MAAM;IACR,OAAO,CAAkB;IACzB,IAAI,CAAe;IACnB,OAAO,CAAkB;IACzB,GAAG,CAAc;IACjB,KAAK,CAAgB;IACrB,eAAe,CAAuC;IAE/D,YAAY,MAAc;QACxB,IAAI,CAAC,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACvD,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 type { Config } from \"../common/Config.ts\";\nimport { CatalogResource } from \"./catalog/CatalogResource.ts\";\nimport { JobsResource } from \"./jobs/JobsResource.ts\";\nimport { ScriptsResource } from \"./scripts/ScriptsResource.ts\";\nimport { SqlResource } from \"./sql/SqlResource.ts\";\nimport { UsersResource } from \"./users/UsersResource.ts\";\nimport { getResourceConfig } from \"./getResourceConfig.ts\";\n\nexport class Dremio {\n readonly catalog: CatalogResource;\n readonly jobs: JobsResource;\n readonly scripts: ScriptsResource;\n readonly sql: SqlResource;\n readonly users: UsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.catalog = new CatalogResource(this.#resourceConfig);\n this.jobs = new JobsResource(this.#resourceConfig);\n this.scripts = new ScriptsResource(this.#resourceConfig);\n this.sql = new SqlResource(this.#resourceConfig);\n this.users = new UsersResource(this.#resourceConfig);\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { Config } from "../common/Config.ts";
2
+ export declare const getResourceConfig: (config: Config) => {
3
+ logger: {
4
+ debug: typeof console.debug;
5
+ error: typeof console.error;
6
+ info: typeof console.info;
7
+ warn: typeof console.warn;
8
+ } | undefined;
9
+ origin: string;
10
+ request: import("../common/Config.ts").RequestFn;
11
+ sonarV2Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
12
+ sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
13
+ sonarV4Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
14
+ v3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
15
+ };
@@ -0,0 +1,29 @@
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 { createRequest } from "../common/createRequest.js";
17
+ export const getResourceConfig = (config) => {
18
+ const request = createRequest(config);
19
+ return {
20
+ logger: config.logger,
21
+ origin: config.origin,
22
+ request,
23
+ sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),
24
+ sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),
25
+ sonarV4Request: (path, init) => request(`/api/v4/${path}`, init),
26
+ v3Request: (path, init) => request(`/api/v3/${path}`, init),
27
+ };
28
+ };
29
+ //# sourceMappingURL=getResourceConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/oss/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE;IAClD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC;QAC/D,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;KACwB,CAAC;AACxF,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V3Config,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\n\nexport const getResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n sonarV4Request: (path, init) => request(`/api/v4/${path}`, init),\n v3Request: (path, init) => request(`/api/v3/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config & SonarV4Config & V3Config;\n};\n"]}
@@ -1,27 +1,4 @@
1
- import type { Config } from "../common/Config.ts";
2
- export declare const Dremio: (config: Config) => {
3
- _request: import("../common/Config.ts").RequestFn;
4
- _sonarResourceConfig: {
5
- logger: {
6
- debug: typeof console.debug;
7
- error: typeof console.error;
8
- info: typeof console.info;
9
- warn: typeof console.warn;
10
- } | undefined;
11
- origin: string;
12
- request: import("../common/Config.ts").RequestFn;
13
- sonarV2Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
14
- sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
15
- v3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
16
- };
17
- _sonarV2Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
18
- _sonarV3Request: (path: string, init: RequestInit | undefined) => import("ts-results-es").AsyncResult<Response, import("../common/HttpError.ts").HttpError>;
19
- catalog: import("./catalog/CatalogResource.ts").CatalogResource;
20
- jobs: import("./jobs/JobsResource.ts").JobsResource;
21
- scripts: import("./scripts/ScriptsResource.ts").ScriptsResource;
22
- sql: import("./sql/SqlResource.ts").SqlResource;
23
- users: import("./users/UsersResource.ts").UsersResource;
24
- };
1
+ export * from "./Dremio.ts";
25
2
  export * from "../common/sharedExports.ts";
26
3
  export * from "./credentials/index.ts";
27
4
  export * from "./interfaces.ts";
package/dist/oss/index.js CHANGED
@@ -13,29 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { createRequest } from "../common/createRequest.js";
17
- import { Resources } from "./resources.js";
18
- const getSonarResourceConfig = (config) => {
19
- const request = createRequest(config);
20
- return {
21
- logger: config.logger,
22
- origin: config.origin,
23
- request,
24
- sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),
25
- sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),
26
- v3Request: (path, init) => request(`/api/v3/${path}`, init),
27
- };
28
- };
29
- export const Dremio = (config) => {
30
- const sonarResourceConfig = getSonarResourceConfig(config);
31
- return {
32
- ...Resources(sonarResourceConfig),
33
- _request: sonarResourceConfig.request,
34
- _sonarResourceConfig: sonarResourceConfig,
35
- _sonarV2Request: sonarResourceConfig.sonarV2Request,
36
- _sonarV3Request: sonarResourceConfig.sonarV3Request,
37
- };
38
- };
16
+ export * from "./Dremio.js";
39
17
  export * from "../common/sharedExports.js";
40
18
  export * from "./credentials/index.js";
41
19
  export * from "./interfaces.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oss/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE;IAChD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC;QAC/D,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;KACQ,CAAC;AACxE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,mBAAmB,CAAC,OAAO;QACrC,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,mBAAmB,CAAC,cAAc;QACnD,eAAe,EAAE,mBAAmB,CAAC,cAAc;KACpD,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createRequest } from \"../common/createRequest.ts\";\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n V3Config,\n} from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n v3Request: (path, init) => request(`/api/v3/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: sonarResourceConfig.request,\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV2Request: sonarResourceConfig.sonarV2Request,\n _sonarV3Request: sonarResourceConfig.sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oss/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,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\nexport * from \"./Dremio.ts\";\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",