@dremio/js-sdk 0.19.0 → 0.20.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.
@@ -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,MAA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AC,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,CAA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\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",