@dremio/js-sdk 0.18.0 → 0.19.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/enterprise/roles/Role.d.ts +23 -7
- package/dist/enterprise/roles/Role.js +23 -0
- package/dist/enterprise/roles/Role.js.map +1 -1
- package/dist/enterprise/roles/RolesResource.d.ts +7 -0
- package/dist/enterprise/roles/RolesResource.js +19 -0
- package/dist/enterprise/roles/RolesResource.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,18 +6,34 @@ export declare class Role implements RoleProperties {
|
|
|
6
6
|
readonly roles: RoleProperties["roles"];
|
|
7
7
|
readonly type: RoleProperties["type"];
|
|
8
8
|
constructor(properties: RoleProperties);
|
|
9
|
-
static fromResource(properties:
|
|
9
|
+
static fromResource(properties: RoleEntity): Role;
|
|
10
|
+
}
|
|
11
|
+
export declare class RoleReference {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Origin of the role
|
|
16
|
+
*/
|
|
17
|
+
readonly type: RoleEntity["type"];
|
|
18
|
+
constructor(properties: {
|
|
19
|
+
id: RoleReference["id"];
|
|
20
|
+
name: RoleReference["name"];
|
|
21
|
+
type: RoleReference["type"];
|
|
22
|
+
});
|
|
10
23
|
}
|
|
11
|
-
export type RoleReference = {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
type: string;
|
|
15
|
-
};
|
|
16
24
|
export type RoleProperties = {
|
|
17
25
|
readonly description: string | null;
|
|
18
26
|
readonly id: string;
|
|
19
27
|
readonly memberCount: number;
|
|
20
28
|
readonly name: string;
|
|
21
29
|
readonly roles: RoleReference[];
|
|
22
|
-
readonly type:
|
|
30
|
+
readonly type: RoleEntity["type"];
|
|
31
|
+
};
|
|
32
|
+
export type RoleEntity = {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
type: "INTERNAL" | "EXTERNAL" | "SYSTEM";
|
|
36
|
+
roles: RoleEntity[];
|
|
37
|
+
memberCount: number;
|
|
38
|
+
description: string;
|
|
23
39
|
};
|
|
@@ -23,16 +23,39 @@ export class Role {
|
|
|
23
23
|
constructor(properties) {
|
|
24
24
|
this.description = properties.description;
|
|
25
25
|
this.id = properties.id;
|
|
26
|
+
/**
|
|
27
|
+
* Number of users and roles that are members of the role
|
|
28
|
+
*/
|
|
26
29
|
this.memberCount = properties.memberCount;
|
|
27
30
|
this.name = properties.name;
|
|
31
|
+
/**
|
|
32
|
+
* Information about the roles to which the role belong
|
|
33
|
+
*/
|
|
28
34
|
this.roles = properties.roles;
|
|
35
|
+
/**
|
|
36
|
+
* Origin of the role
|
|
37
|
+
*/
|
|
29
38
|
this.type = properties.type;
|
|
30
39
|
}
|
|
31
40
|
static fromResource(properties) {
|
|
32
41
|
return new Role({
|
|
33
42
|
...properties,
|
|
34
43
|
description: properties.description?.length ? properties.description : null,
|
|
44
|
+
roles: properties.roles.map((roleReferenceEntity) => new RoleReference(roleReferenceEntity)),
|
|
35
45
|
});
|
|
36
46
|
}
|
|
37
47
|
}
|
|
48
|
+
export class RoleReference {
|
|
49
|
+
id;
|
|
50
|
+
name;
|
|
51
|
+
/**
|
|
52
|
+
* Origin of the role
|
|
53
|
+
*/
|
|
54
|
+
type;
|
|
55
|
+
constructor(properties) {
|
|
56
|
+
this.id = properties.id;
|
|
57
|
+
this.name = properties.name;
|
|
58
|
+
this.type = properties.type;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
38
61
|
//# 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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;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"]}
|
|
@@ -4,6 +4,13 @@ import type { SignalParam } from "../../common/Params.ts";
|
|
|
4
4
|
export declare class RolesResource {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(config: SonarV3Config);
|
|
7
|
+
list(): {
|
|
8
|
+
data(): AsyncGenerator<Role, void, unknown>;
|
|
9
|
+
getPage: ({ signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
|
|
10
|
+
data: Role[];
|
|
11
|
+
totalResults: number;
|
|
12
|
+
}, import("../index.ts").HttpError>;
|
|
13
|
+
};
|
|
7
14
|
retrieve(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<Role, import("../index.ts").HttpError>>;
|
|
8
15
|
retrieveByName(name: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<Role, import("../index.ts").HttpError>>;
|
|
9
16
|
}
|
|
@@ -19,6 +19,25 @@ export class RolesResource {
|
|
|
19
19
|
constructor(config) {
|
|
20
20
|
this.#config = config;
|
|
21
21
|
}
|
|
22
|
+
list() {
|
|
23
|
+
const getPage = ({ signal } = {}) => this.#config
|
|
24
|
+
.sonarV3Request("role", { signal })
|
|
25
|
+
.map((res) => res.json())
|
|
26
|
+
.map((response) => {
|
|
27
|
+
return {
|
|
28
|
+
...response,
|
|
29
|
+
data: response.data.map((entity) => Role.fromResource(entity)),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
async *data() {
|
|
34
|
+
yield* await getPage()
|
|
35
|
+
.map((v) => v.data)
|
|
36
|
+
.promise.then((result) => result.unwrap());
|
|
37
|
+
},
|
|
38
|
+
getPage,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
22
41
|
retrieve(id, { signal } = {}) {
|
|
23
42
|
return this.#config
|
|
24
43
|
.sonarV3Request(`role/${id}`, { signal })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RolesResource.js","sourceRoot":"","sources":["../../../src/enterprise/roles/RolesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,IAAI,
|
|
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"]}
|