@dremio/js-sdk 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cloud/arctic/ArcticCatalog.d.ts +1 -1
- package/dist/cloud/arctic/ArcticCatalog.js +2 -4
- package/dist/cloud/arctic/ArcticCatalog.js.map +1 -1
- package/dist/cloud/interfaces.d.ts +1 -0
- package/dist/cloud/interfaces.js +1 -0
- package/dist/cloud/interfaces.js.map +1 -1
- package/dist/enterprise/Dremio.d.ts +5 -0
- package/dist/enterprise/Dremio.js +6 -0
- package/dist/enterprise/Dremio.js.map +1 -1
- package/dist/enterprise/Grantee.d.ts +8 -8
- package/dist/enterprise/Grantee.js +12 -1
- package/dist/enterprise/Grantee.js.map +1 -1
- package/dist/enterprise/grants/Grant.d.ts +13 -0
- package/dist/enterprise/grants/Grant.js +29 -0
- package/dist/enterprise/grants/Grant.js.map +1 -0
- package/dist/enterprise/grants/GrantsResource.d.ts +8 -0
- package/dist/enterprise/grants/GrantsResource.js +26 -0
- package/dist/enterprise/grants/GrantsResource.js.map +1 -0
- package/dist/enterprise/grants/createRetrieveGrants.d.ts +5 -0
- package/dist/enterprise/grants/createRetrieveGrants.js +39 -0
- package/dist/enterprise/grants/createRetrieveGrants.js.map +1 -0
- package/dist/enterprise/interfaces.d.ts +1 -0
- package/dist/enterprise/interfaces.js +1 -0
- package/dist/enterprise/interfaces.js.map +1 -1
- package/dist/enterprise/scripts/EnterpriseScript.d.ts +3 -6
- package/dist/enterprise/scripts/EnterpriseScript.js +4 -12
- package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
- package/dist/enterprise/users/EnterpriseUser.d.ts +3 -2
- package/dist/enterprise/users/EnterpriseUser.js +5 -0
- package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UserGrantee } from "../../enterprise/Grantee.js";
|
|
2
2
|
export declare class ArcticCatalog implements ArcticCatalogProperties {
|
|
3
3
|
readonly createdAt: ArcticCatalogProperties["createdAt"];
|
|
4
4
|
readonly createdBy: ArcticCatalogProperties["createdBy"];
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { UserGrantee } from "../../enterprise/Grantee.js";
|
|
16
17
|
export class ArcticCatalog {
|
|
17
18
|
createdAt;
|
|
18
19
|
createdBy;
|
|
@@ -38,9 +39,6 @@ export const arcticCatalogEntityToProperties = (entity) => ({
|
|
|
38
39
|
modifiedAt: new Date(entity.modifiedAt),
|
|
39
40
|
modifiedBy: entity.modifiedBy,
|
|
40
41
|
name: entity.name,
|
|
41
|
-
owner:
|
|
42
|
-
id: entity.ownerId,
|
|
43
|
-
type: "USER",
|
|
44
|
-
},
|
|
42
|
+
owner: new UserGrantee(entity.ownerId),
|
|
45
43
|
});
|
|
46
44
|
//# sourceMappingURL=ArcticCatalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcticCatalog.js","sourceRoot":"","sources":["../../../src/cloud/arctic/ArcticCatalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"ArcticCatalog.js","sourceRoot":"","sources":["../../../src/cloud/arctic/ArcticCatalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,OAAO,aAAa;IACf,SAAS,CAAuC;IAChD,SAAS,CAAuC;IAChD,EAAE,CAAgC;IAClC,UAAU,CAAwC;IAClD,UAAU,CAAwC;IAClD,IAAI,CAAkC;IACtC,KAAK,CAAmC;IAEjD,YAAY,UAAmC;QAC7C,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;QAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAChC,CAAC;CACF;AAiBD,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,MAA2B,EAAE,EAAE,CAAC,CAAC;IAC/E,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,EAAE,EAAE,MAAM,CAAC,EAAE;IACb,UAAU,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC,UAAU;IAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,KAAK,EAAE,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;CACvC,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 { UserGrantee } from \"../../enterprise/Grantee.js\";\n\nexport class ArcticCatalog implements ArcticCatalogProperties {\n readonly createdAt: ArcticCatalogProperties[\"createdAt\"];\n readonly createdBy: ArcticCatalogProperties[\"createdBy\"];\n readonly id: ArcticCatalogProperties[\"id\"];\n readonly modifiedAt: ArcticCatalogProperties[\"modifiedAt\"];\n readonly modifiedBy: ArcticCatalogProperties[\"modifiedBy\"];\n readonly name: ArcticCatalogProperties[\"name\"];\n readonly owner: ArcticCatalogProperties[\"owner\"];\n\n constructor(properties: ArcticCatalogProperties) {\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 this.owner = properties.owner;\n }\n}\n\nexport type ArcticCatalogEntity = {\n id: string;\n name: string;\n ownerId: string;\n ownerName: string;\n createdBy: string;\n modifiedBy: string;\n createdAt: string;\n modifiedAt: string;\n state: \"ACTIVE\" | \"INACTIVE\";\n nessieEndpoint: string;\n};\n\ntype ArcticCatalogProperties = ReturnType<typeof arcticCatalogEntityToProperties>;\n\nexport const arcticCatalogEntityToProperties = (entity: ArcticCatalogEntity) => ({\n createdAt: new Date(entity.createdAt),\n createdBy: entity.createdBy,\n id: entity.id,\n modifiedAt: new Date(entity.modifiedAt),\n modifiedBy: entity.modifiedBy,\n name: entity.name,\n owner: new UserGrantee(entity.ownerId),\n});\n"]}
|
|
@@ -14,3 +14,4 @@ export type { Job, JobResultsSchema, Reflection, EnterpriseScript, ReflectionSum
|
|
|
14
14
|
export * from "../enterprise/catalog/CatalogObjects/index.ts";
|
|
15
15
|
export * from "../enterprise/catalog/CatalogReferences/index.ts";
|
|
16
16
|
export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.ts";
|
|
17
|
+
export * from "../enterprise/grants/Grant.ts";
|
package/dist/cloud/interfaces.js
CHANGED
|
@@ -16,4 +16,5 @@
|
|
|
16
16
|
export * from "../enterprise/catalog/CatalogObjects/index.js";
|
|
17
17
|
export * from "../enterprise/catalog/CatalogReferences/index.js";
|
|
18
18
|
export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.js";
|
|
19
|
+
export * from "../enterprise/grants/Grant.js";
|
|
19
20
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiCH,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,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 type { Organization } from \"./organizations/Organization.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 Organization,\n};\nexport * from \"../enterprise/catalog/CatalogObjects/index.ts\";\nexport * from \"../enterprise/catalog/CatalogReferences/index.ts\";\nexport * from \"../enterprise/catalog/catalogSearch/CatalogSearchResult.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiCH,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 type { Organization } from \"./organizations/Organization.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 Organization,\n};\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"]}
|
|
@@ -6,11 +6,16 @@ import { SqlResource } from "../oss/sql/SqlResource.js";
|
|
|
6
6
|
import { EnterpriseUsersResource } from "./users/EnterpriseUsersResource.js";
|
|
7
7
|
import { EnginesResource } from "./engines/EnginesResource.js";
|
|
8
8
|
import { RolesResource } from "./roles/RolesResource.js";
|
|
9
|
+
import { GrantsResource } from "./grants/GrantsResource.ts";
|
|
9
10
|
export declare class Dremio {
|
|
10
11
|
#private;
|
|
11
12
|
readonly catalog: EnterpriseCatalogResource;
|
|
12
13
|
readonly engines: EnginesResource;
|
|
13
14
|
readonly jobs: JobsResource;
|
|
15
|
+
/**
|
|
16
|
+
* @experimental
|
|
17
|
+
*/
|
|
18
|
+
readonly _grants: GrantsResource;
|
|
14
19
|
readonly roles: RolesResource;
|
|
15
20
|
readonly scripts: EnterpriseScriptsResource;
|
|
16
21
|
readonly sql: SqlResource;
|
|
@@ -21,10 +21,15 @@ import { EnterpriseUsersResource } from "./users/EnterpriseUsersResource.js";
|
|
|
21
21
|
import { EnginesResource } from "./engines/EnginesResource.js";
|
|
22
22
|
import { RolesResource } from "./roles/RolesResource.js";
|
|
23
23
|
import { getResourceConfig } from "../oss/getResourceConfig.js";
|
|
24
|
+
import { GrantsResource } from "./grants/GrantsResource.js";
|
|
24
25
|
export class Dremio {
|
|
25
26
|
catalog;
|
|
26
27
|
engines;
|
|
27
28
|
jobs;
|
|
29
|
+
/**
|
|
30
|
+
* @experimental
|
|
31
|
+
*/
|
|
32
|
+
_grants;
|
|
28
33
|
roles;
|
|
29
34
|
scripts;
|
|
30
35
|
sql;
|
|
@@ -35,6 +40,7 @@ export class Dremio {
|
|
|
35
40
|
this.catalog = new EnterpriseCatalogResource(this.#resourceConfig);
|
|
36
41
|
this.engines = new EnginesResource(this.#resourceConfig);
|
|
37
42
|
this.jobs = new JobsResource(this.#resourceConfig);
|
|
43
|
+
this._grants = new GrantsResource(this.#resourceConfig);
|
|
38
44
|
this.roles = new RolesResource(this.#resourceConfig);
|
|
39
45
|
this.scripts = new EnterpriseScriptsResource(this.#resourceConfig);
|
|
40
46
|
this.sql = new SqlResource(this.#resourceConfig);
|
|
@@ -1 +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;
|
|
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;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,OAAO,MAAM;IACR,OAAO,CAA4B;IACnC,OAAO,CAAkB;IACzB,IAAI,CAAe;IAE5B;;OAEG;IACM,OAAO,CAAiB;IACxB,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,OAAO,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,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\";\nimport { GrantsResource } from \"./grants/GrantsResource.ts\";\n\nexport class Dremio {\n readonly catalog: EnterpriseCatalogResource;\n readonly engines: EnginesResource;\n readonly jobs: JobsResource;\n\n /**\n * @experimental\n */\n readonly _grants: GrantsResource;\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._grants = new GrantsResource(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,9 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
id: string;
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export
|
|
6
|
-
id: string;
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
export declare class RoleGrantee {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
constructor(id: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class UserGrantee {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
constructor(id: string);
|
|
8
|
+
}
|
|
9
9
|
export type Grantee = RoleGrantee | UserGrantee;
|
|
@@ -13,5 +13,16 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export {
|
|
16
|
+
export class RoleGrantee {
|
|
17
|
+
id;
|
|
18
|
+
constructor(id) {
|
|
19
|
+
this.id = id;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export class UserGrantee {
|
|
23
|
+
id;
|
|
24
|
+
constructor(id) {
|
|
25
|
+
this.id = id;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
17
28
|
//# sourceMappingURL=Grantee.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grantee.js","sourceRoot":"","sources":["../../src/enterprise/Grantee.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","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
|
|
1
|
+
{"version":3,"file":"Grantee.js","sourceRoot":"","sources":["../../src/enterprise/Grantee.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,OAAO,WAAW;IACb,EAAE,CAAS;IAEpB,YAAY,EAAU;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF;AAED,MAAM,OAAO,WAAW;IACb,EAAE,CAAS;IAEpB,YAAY,EAAU;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,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 RoleGrantee {\n readonly id: string;\n\n constructor(id: string) {\n this.id = id;\n }\n}\n\nexport class UserGrantee {\n readonly id: string;\n\n constructor(id: string) {\n this.id = id;\n }\n}\n\nexport type Grantee = RoleGrantee | UserGrantee;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Grantee } from "../Grantee.ts";
|
|
2
|
+
export declare class Grant {
|
|
3
|
+
#private;
|
|
4
|
+
readonly grantee: Grantee;
|
|
5
|
+
readonly privileges: Set<string>;
|
|
6
|
+
readonly type: string;
|
|
7
|
+
constructor(properties: {
|
|
8
|
+
grantee: Grant["grantee"];
|
|
9
|
+
privileges: Grant["privileges"];
|
|
10
|
+
type: Grant["type"];
|
|
11
|
+
tag: string;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -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
|
+
export class Grant {
|
|
17
|
+
grantee;
|
|
18
|
+
privileges;
|
|
19
|
+
type;
|
|
20
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
21
|
+
#tag;
|
|
22
|
+
constructor(properties) {
|
|
23
|
+
this.grantee = properties.grantee;
|
|
24
|
+
this.privileges = properties.privileges;
|
|
25
|
+
this.type = properties.type;
|
|
26
|
+
this.#tag = properties.tag;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Grant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grant.js","sourceRoot":"","sources":["../../../src/enterprise/grants/Grant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,OAAO,KAAK;IACP,OAAO,CAAU;IACjB,UAAU,CAAc;IACxB,IAAI,CAAS;IACtB,2DAA2D;IAClD,IAAI,CAAS;IAEtB,YAAY,UAKX;QACC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC;IAC7B,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 { Grantee } from \"../Grantee.ts\";\n\nexport class Grant {\n readonly grantee: Grantee;\n readonly privileges: Set<string>;\n readonly type: string;\n // eslint-disable-next-line no-unused-private-class-members\n readonly #tag: string;\n\n constructor(properties: {\n grantee: Grant[\"grantee\"];\n privileges: Grant[\"privileges\"];\n type: Grant[\"type\"];\n tag: string;\n }) {\n this.grantee = properties.grantee;\n this.privileges = properties.privileges;\n this.type = properties.type;\n this.#tag = properties.tag;\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResourceConfig, SonarV3Config } from "../../common/Config.ts";
|
|
2
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
3
|
+
import type { Grantee } from "../Grantee.ts";
|
|
4
|
+
export declare class GrantsResource {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(config: ResourceConfig & SonarV3Config);
|
|
7
|
+
retrieve(grantee: Grantee, { signal }?: SignalParam): import("ts-results-es").AsyncResult<import("./Grant.ts").Grant[], import("../index.ts").HttpError>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { createRetrieveGrants } from "./createRetrieveGrants.js";
|
|
17
|
+
export class GrantsResource {
|
|
18
|
+
#config;
|
|
19
|
+
constructor(config) {
|
|
20
|
+
this.#config = config;
|
|
21
|
+
}
|
|
22
|
+
retrieve(grantee, { signal } = {}) {
|
|
23
|
+
return createRetrieveGrants(this.#config)(grantee, { signal });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=GrantsResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrantsResource.js","sourceRoot":"","sources":["../../../src/enterprise/grants/GrantsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,cAAc;IAChB,OAAO,CAAiC;IAEjD,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,QAAQ,CAAC,OAAgB,EAAE,EAAE,MAAM,KAAkB,EAAE;QACrD,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ResourceConfig, SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport type { Grantee } from \"../Grantee.ts\";\nimport { createRetrieveGrants } from \"./createRetrieveGrants.ts\";\n\nexport class GrantsResource {\n readonly #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n retrieve(grantee: Grantee, { signal }: SignalParam = {}) {\n return createRetrieveGrants(this.#config)(grantee, { signal });\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SonarV3Config } from "../../common/Config.ts";
|
|
2
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
3
|
+
import { type Grantee } from "../Grantee.ts";
|
|
4
|
+
import { Grant } from "./Grant.ts";
|
|
5
|
+
export declare function createRetrieveGrants(config: SonarV3Config): (grantee: Grantee, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<Grant[], import("../index.ts").HttpError>;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { RoleGrantee, UserGrantee } from "../Grantee.js";
|
|
17
|
+
import { Grant } from "./Grant.js";
|
|
18
|
+
export function createRetrieveGrants(config) {
|
|
19
|
+
return function retrieveGrants(grantee, { signal } = {}) {
|
|
20
|
+
return config
|
|
21
|
+
.sonarV3Request(`grant/${getRoleType(grantee)}/${grantee.id}`, {
|
|
22
|
+
headers: {
|
|
23
|
+
Accept: "application/json",
|
|
24
|
+
},
|
|
25
|
+
signal,
|
|
26
|
+
})
|
|
27
|
+
.map((res) => res.json())
|
|
28
|
+
.map((response) => response.grants.map((entity) => new Grant({
|
|
29
|
+
grantee: entity.granteeType === "ROLE"
|
|
30
|
+
? new RoleGrantee(entity.id)
|
|
31
|
+
: new UserGrantee(entity.id),
|
|
32
|
+
privileges: new Set(entity.privileges),
|
|
33
|
+
tag: entity.tag,
|
|
34
|
+
type: entity.type,
|
|
35
|
+
})));
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const getRoleType = (grantee) => (grantee instanceof UserGrantee ? "user" : "role");
|
|
39
|
+
//# sourceMappingURL=createRetrieveGrants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRetrieveGrants.js","sourceRoot":"","sources":["../../../src/enterprise/grants/createRetrieveGrants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAgB,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,UAAU,oBAAoB,CAAC,MAAqB;IACxD,OAAO,SAAS,cAAc,CAAC,OAAgB,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC3E,OAAO,MAAM;aACV,cAAc,CAAC,SAAS,WAAW,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,EAAE,EAAE,EAAE;YAC7D,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAwC,CAAC;aAC9D,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAChB,QAAQ,CAAC,MAAM,CAAC,GAAG,CACjB,CAAC,MAAM,EAAE,EAAE,CACT,IAAI,KAAK,CAAC;YACR,OAAO,EACL,MAAM,CAAC,WAAW,KAAK,MAAM;gBAC3B,CAAC,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5B,CAAC,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,UAAU,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC;YACtC,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CACL,CACF,CAAC;IACN,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,YAAY,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,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 { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { RoleGrantee, UserGrantee, type Grantee } from \"../Grantee.ts\";\nimport { Grant } from \"./Grant.ts\";\n\nexport function createRetrieveGrants(config: SonarV3Config) {\n return function retrieveGrants(grantee: Grantee, { signal }: SignalParam = {}) {\n return config\n .sonarV3Request(`grant/${getRoleType(grantee)}/${grantee.id}`, {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<{ grants: GrantEntity[] }>)\n .map((response) =>\n response.grants.map(\n (entity) =>\n new Grant({\n grantee:\n entity.granteeType === \"ROLE\"\n ? new RoleGrantee(entity.id)\n : new UserGrantee(entity.id),\n privileges: new Set(entity.privileges),\n tag: entity.tag,\n type: entity.type,\n }),\n ),\n );\n };\n}\n\nconst getRoleType = (grantee: Grantee) => (grantee instanceof UserGrantee ? \"user\" : \"role\");\n\ntype GrantEntity = {\n privileges: string[];\n granteeType: \"USER\" | \"ROLE\";\n id: string;\n tag: string;\n type: string;\n};\n"]}
|
|
@@ -14,3 +14,4 @@ export * from "./Ownable.ts";
|
|
|
14
14
|
export * from "./Grantee.ts";
|
|
15
15
|
export type { Engine, EnterpriseCatalogObject, EnterpriseCatalogReference, EnterpriseScript, EnterpriseUser, Job, JobResultsSchema, Reflection, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
|
|
16
16
|
export * from "./catalog/catalogSearch/CatalogSearchResult.ts";
|
|
17
|
+
export * from "./grants/Grant.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/enterprise/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAiB7B,cAAc,gDAAgD,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 { Engine } from \"./engines/Engine.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseCatalogObject } from \"./catalog/CatalogObjects/index.ts\";\nimport type { EnterpriseCatalogReference } from \"./catalog/CatalogReferences/index.ts\";\nimport type { EnterpriseScript } from \"./scripts/EnterpriseScript.ts\";\nimport type { EnterpriseUser } from \"./users/EnterpriseUser.ts\";\nimport type { ReflectionSummary } from \"./reflections/ReflectionSummary.ts\";\nimport type { Role } from \"./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\";\nexport * from \"./catalog/CatalogObjects/index.ts\";\nexport * from \"./catalog/CatalogReferences/index.ts\";\nexport * from \"./Ownable.ts\";\nexport * from \"./Grantee.ts\";\nexport type {\n Engine,\n EnterpriseCatalogObject,\n EnterpriseCatalogReference,\n EnterpriseScript,\n EnterpriseUser,\n Job,\n JobResultsSchema,\n Reflection,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport * from \"./catalog/catalogSearch/CatalogSearchResult.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/enterprise/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAiB7B,cAAc,gDAAgD,CAAC;AAC/D,cAAc,mBAAmB,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 { Engine } from \"./engines/Engine.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseCatalogObject } from \"./catalog/CatalogObjects/index.ts\";\nimport type { EnterpriseCatalogReference } from \"./catalog/CatalogReferences/index.ts\";\nimport type { EnterpriseScript } from \"./scripts/EnterpriseScript.ts\";\nimport type { EnterpriseUser } from \"./users/EnterpriseUser.ts\";\nimport type { ReflectionSummary } from \"./reflections/ReflectionSummary.ts\";\nimport type { Role } from \"./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\";\nexport * from \"./catalog/CatalogObjects/index.ts\";\nexport * from \"./catalog/CatalogReferences/index.ts\";\nexport * from \"./Ownable.ts\";\nexport * from \"./Grantee.ts\";\nexport type {\n Engine,\n EnterpriseCatalogObject,\n EnterpriseCatalogReference,\n EnterpriseScript,\n EnterpriseUser,\n Job,\n JobResultsSchema,\n Reflection,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport * from \"./catalog/catalogSearch/CatalogSearchResult.ts\";\nexport * from \"./grants/Grant.ts\";\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SonarV3Config } from "../../common/Config.ts";
|
|
2
|
-
import
|
|
2
|
+
import { RoleGrantee, UserGrantee } from "../Grantee.js";
|
|
3
3
|
import type { Ownable } from "../Ownable.ts";
|
|
4
4
|
import { Script, type ScriptEntity, type ScriptPatchableProperties } from "../../oss/scripts/Script.ts";
|
|
5
5
|
import type { SignalParam } from "../../common/Params.ts";
|
|
@@ -7,13 +7,10 @@ export declare class EnterpriseScript extends Script implements Ownable {
|
|
|
7
7
|
#private;
|
|
8
8
|
readonly owner: UserGrantee;
|
|
9
9
|
constructor(properties: EnterpriseScriptProperties, config: SonarV3Config);
|
|
10
|
-
grants({ signal }?: SignalParam): Promise<import("ts-results-es").Result<
|
|
10
|
+
grants({ signal }?: SignalParam): Promise<import("ts-results-es").Result<{
|
|
11
11
|
grantee: RoleGrantee;
|
|
12
12
|
privileges: Set<ScriptPrivileges>;
|
|
13
|
-
}
|
|
14
|
-
grantee: UserGrantee;
|
|
15
|
-
privileges: Set<ScriptPrivileges>;
|
|
16
|
-
})[], import("../index.ts").HttpError>>;
|
|
13
|
+
}[], import("../index.ts").HttpError>>;
|
|
17
14
|
save(properties: ScriptPatchableProperties & {
|
|
18
15
|
owner?: UserGrantee;
|
|
19
16
|
}): Promise<import("ts-results-es").Result<EnterpriseScript, import("../index.ts").ValidationProblem | import("../index.ts").HttpError>>;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { RoleGrantee, UserGrantee } from "../Grantee.js";
|
|
16
17
|
import { createScriptPatchedFields, saveScript, Script, scriptEntityToProperties, } from "../../oss/scripts/Script.js";
|
|
17
18
|
export class EnterpriseScript extends Script {
|
|
18
19
|
owner;
|
|
@@ -28,17 +29,11 @@ export class EnterpriseScript extends Script {
|
|
|
28
29
|
.map((res) => res.json())
|
|
29
30
|
.map((entity) => [
|
|
30
31
|
...entity.roles.map((grant) => ({
|
|
31
|
-
grantee:
|
|
32
|
-
id: grant.granteeId,
|
|
33
|
-
type: "ROLE",
|
|
34
|
-
},
|
|
32
|
+
grantee: new RoleGrantee(grant.granteeId),
|
|
35
33
|
privileges: new Set(grant.privileges),
|
|
36
34
|
})),
|
|
37
35
|
...entity.users.map((grant) => ({
|
|
38
|
-
grantee:
|
|
39
|
-
id: grant.granteeId,
|
|
40
|
-
type: "USER",
|
|
41
|
-
},
|
|
36
|
+
grantee: new UserGrantee(grant.granteeId),
|
|
42
37
|
privileges: new Set(grant.privileges),
|
|
43
38
|
})),
|
|
44
39
|
]).promise;
|
|
@@ -52,9 +47,6 @@ export class EnterpriseScript extends Script {
|
|
|
52
47
|
}
|
|
53
48
|
export const enterpriseScriptEntityToProperties = (entity) => ({
|
|
54
49
|
...scriptEntityToProperties(entity),
|
|
55
|
-
owner:
|
|
56
|
-
id: entity.owner,
|
|
57
|
-
type: "USER",
|
|
58
|
-
},
|
|
50
|
+
owner: new UserGrantee(entity.owner),
|
|
59
51
|
});
|
|
60
52
|
//# sourceMappingURL=EnterpriseScript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnterpriseScript.js","sourceRoot":"","sources":["../../../src/enterprise/scripts/EnterpriseScript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"EnterpriseScript.js","sourceRoot":"","sources":["../../../src/enterprise/scripts/EnterpriseScript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,MAAM,EACN,wBAAwB,GAGzB,MAAM,6BAA6B,CAAC;AAIrC,MAAM,OAAO,gBAAiB,SAAQ,MAAM;IACjC,KAAK,CAAc;IAC5B,OAAO,CAAgB;IAEvB,YAAY,UAAsC,EAAE,MAAqB;QACvE,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,EAAE,MAAM,KAAkB,EAAE;QACjC,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC;aACvD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CACF,CAAC,MAGA,EAAE,EAAE,CAAC;YACJ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC9B,OAAO,EAAE,IAAI,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;gBACzC,UAAU,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;aACtC,CAAC,CAAC;YACH,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC9B,OAAO,EAAE,IAAI,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;gBACzC,UAAU,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;aACtC,CAAC,CAAC;SACJ,CACF,CAAC,OAAO,CAAC;IACd,CAAC;IAEQ,KAAK,CAAC,IAAI,CAAC,UAA+D;QACjF,OAAO,UAAU,CACf,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,OAAO,CACb,CAAC;YACA,GAAG,yBAAyB,CAAC,UAAU,CAAC;YACxC,GAAG,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;SACxD,CAAC,CAAC,GAAG,CACJ,CAAC,KAA6B,EAAE,EAAE,CAChC,IAAI,gBAAgB,CAAC,kCAAkC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAChF,CAAC,OAAO,CAAC;IACZ,CAAC;CACF;AAMD,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,MAA8B,EAAE,EAAE,CAAC,CAAC;IACrF,GAAG,wBAAwB,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,IAAI,WAAW,CAAC,MAAM,CAAC,KAAe,CAAC;CAC/C,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 { SonarV3Config } from \"../../common/Config.ts\";\nimport { RoleGrantee, UserGrantee } from \"../Grantee.js\";\nimport type { Ownable } from \"../Ownable.ts\";\nimport {\n createScriptPatchedFields,\n saveScript,\n Script,\n scriptEntityToProperties,\n type ScriptEntity,\n type ScriptPatchableProperties,\n} from \"../../oss/scripts/Script.ts\";\n\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class EnterpriseScript extends Script implements Ownable {\n readonly owner: UserGrantee;\n #config: SonarV3Config;\n\n constructor(properties: EnterpriseScriptProperties, config: SonarV3Config) {\n super(properties, config);\n this.owner = properties.owner;\n this.#config = config;\n }\n\n grants({ signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`scripts/${this.id}/grants`, { signal })\n .map((res) => res.json())\n .map(\n (entity: {\n roles: { granteeId: string; privileges: ScriptPrivileges[] }[];\n users: { granteeId: string; privileges: ScriptPrivileges[] }[];\n }) => [\n ...entity.roles.map((grant) => ({\n grantee: new RoleGrantee(grant.granteeId),\n privileges: new Set(grant.privileges),\n })),\n ...entity.users.map((grant) => ({\n grantee: new UserGrantee(grant.granteeId),\n privileges: new Set(grant.privileges),\n })),\n ],\n ).promise;\n }\n\n override async save(properties: ScriptPatchableProperties & { owner?: UserGrantee }) {\n return saveScript(\n this.id,\n this.#config,\n )({\n ...createScriptPatchedFields(properties),\n ...(properties.owner && { owner: properties.owner.id }),\n }).map(\n (value: EnterpriseScriptEntity) =>\n new EnterpriseScript(enterpriseScriptEntityToProperties(value), this.#config),\n ).promise;\n }\n}\n\nexport type EnterpriseScriptProperties = ReturnType<typeof enterpriseScriptEntityToProperties>;\n\nexport type EnterpriseScriptEntity = ScriptEntity & { owner?: string };\n\nexport const enterpriseScriptEntityToProperties = (entity: EnterpriseScriptEntity) => ({\n ...scriptEntityToProperties(entity),\n owner: new UserGrantee(entity.owner as string),\n});\n\ntype ScriptPrivileges = \"DELETE\" | \"MANAGE_GRANTS\" | \"MODIFY\" | \"VIEW\";\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { V3Config } from "../../common/Config.ts";
|
|
1
|
+
import type { SonarV3Config, V3Config } from "../../common/Config.ts";
|
|
2
2
|
import type { SignalParam } from "../../common/Params.ts";
|
|
3
3
|
import { User, type UserEntity, type UserPatchableProperties } from "../../oss/users/User.ts";
|
|
4
4
|
import type { RoleReference } from "../roles/Role.ts";
|
|
@@ -6,8 +6,9 @@ export declare class EnterpriseUser extends User {
|
|
|
6
6
|
#private;
|
|
7
7
|
roles: RoleReference[];
|
|
8
8
|
source: string;
|
|
9
|
-
constructor(properties: EnterpriseUserProperties, config: V3Config);
|
|
9
|
+
constructor(properties: EnterpriseUserProperties, config: V3Config & SonarV3Config);
|
|
10
10
|
save(properties: EnterpriseUserPatchableProperties): import("ts-results-es").AsyncResult<EnterpriseUser, import("../index.ts").HttpError>;
|
|
11
|
+
grants({ signal }?: SignalParam): import("ts-results-es").AsyncResult<import("../interfaces.ts").Grant[], import("../index.ts").HttpError>;
|
|
11
12
|
tokens({ signal }?: SignalParam): Promise<import("ts-results-es").Result<{
|
|
12
13
|
createdAt: Date;
|
|
13
14
|
expiresAt: Date;
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { User, userEntityToProperties, } from "../../oss/users/User.js";
|
|
17
|
+
import { createRetrieveGrants } from "../grants/createRetrieveGrants.js";
|
|
18
|
+
import { UserGrantee } from "../Grantee.js";
|
|
17
19
|
export class EnterpriseUser extends User {
|
|
18
20
|
#config;
|
|
19
21
|
#tag;
|
|
@@ -46,6 +48,9 @@ export class EnterpriseUser extends User {
|
|
|
46
48
|
.map((res) => res.json())
|
|
47
49
|
.map((entity) => new EnterpriseUser(enterpriseUserEntityToProperties(entity), this.#config));
|
|
48
50
|
}
|
|
51
|
+
grants({ signal } = {}) {
|
|
52
|
+
return createRetrieveGrants(this.#config)(new UserGrantee(this.id), { signal });
|
|
53
|
+
}
|
|
49
54
|
tokens({ signal } = {}) {
|
|
50
55
|
return this.#config
|
|
51
56
|
.v3Request(`user/${this.id}/token`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnterpriseUser.js","sourceRoot":"","sources":["../../../src/enterprise/users/EnterpriseUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,IAAI,EACJ,sBAAsB,GAIvB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"EnterpriseUser.js","sourceRoot":"","sources":["../../../src/enterprise/users/EnterpriseUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,IAAI,EACJ,sBAAsB,GAIvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAY5C,MAAM,OAAO,cAAe,SAAQ,IAAI;IACtC,OAAO,CAA2B;IAClC,IAAI,CAAwB;IAE5B,KAAK,CAAkB;IACvB,MAAM,CAAS;IAEf,YAAY,UAAoC,EAAE,MAAgC;QAChF,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC;IAC7B,CAAC;IAEQ,IAAI,CAAC,UAA6C;QACzD,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,QAAQ,IAAI,CAAC,EAAE,EAAE,EAAE;YAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS;gBACjD,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,QAAQ,EAAE,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU;gBAClD,IAAI,EAAE,IAAI,CAAC,QAAQ;gBACnB,GAAG,EAAE,IAAI,CAAC,IAAI;aACf,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,EAAE,CAAC;aACxB,GAAG,CACF,CAAC,MAA4B,EAAE,EAAE,CAC/B,IAAI,cAAc,CAAC,gCAAgC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAC7E,CAAC;IACN,CAAC;IAED,MAAM,CAAC,EAAE,MAAM,KAAkB,EAAE;QACjC,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,EAAE,MAAM,KAAkB,EAAE;QACjC,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,QAAQ,IAAI,CAAC,EAAE,QAAQ,EAAE;YAClC,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;YACvC,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAiC,CAAC;aACvD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAChB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC5B,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACpC,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACpC,EAAE,EAAE,KAAK,CAAC,GAAG;YACb,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC,CACJ,CAAC,OAAO,CAAC;IACd,CAAC;CACF;AASD,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAA4B,EAAE,EAAE,CAAC,CAAC;IACjF,GAAG,sBAAsB,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,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 { SonarV3Config, V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport {\n User,\n userEntityToProperties,\n type UserEntity,\n type UserPatchableProperties,\n type UserProperties,\n} from \"../../oss/users/User.ts\";\nimport type { RoleReference } from \"../roles/Role.ts\";\nimport { createRetrieveGrants } from \"../grants/createRetrieveGrants.ts\";\nimport { UserGrantee } from \"../Grantee.ts\";\n\ntype UserTokensResponse = {\n data: {\n tid: string;\n uid: string;\n label: string;\n createdAt: string;\n expiresAt: string;\n }[];\n};\n\nexport class EnterpriseUser extends User {\n #config: V3Config & SonarV3Config;\n #tag: UserProperties[\"tag\"];\n\n roles: RoleReference[];\n source: string;\n\n constructor(properties: EnterpriseUserProperties, config: V3Config & SonarV3Config) {\n super(properties, config);\n this.#config = config;\n this.roles = properties.roles;\n this.source = properties.source;\n this.#tag = properties.tag;\n }\n\n override save(properties: EnterpriseUserPatchableProperties) {\n return this.#config\n .v3Request(`user/${this.id}`, {\n body: JSON.stringify({\n firstName: properties.givenName ?? this.givenName,\n id: this.id,\n lastName: properties.familyName ?? this.familyName,\n name: this.username,\n tag: this.#tag,\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())\n .map(\n (entity: EnterpriseUserEntity) =>\n new EnterpriseUser(enterpriseUserEntityToProperties(entity), this.#config),\n );\n }\n\n grants({ signal }: SignalParam = {}) {\n return createRetrieveGrants(this.#config)(new UserGrantee(this.id), { signal });\n }\n\n tokens({ signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`user/${this.id}/token`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .map((res) => res.json() as Promise<UserTokensResponse>)\n .map((response) =>\n response.data.map((token) => ({\n createdAt: new Date(token.createdAt),\n expiresAt: new Date(token.expiresAt),\n id: token.tid,\n label: token.label,\n })),\n ).promise;\n }\n}\n\nexport type EnterpriseUserEntity = UserEntity & {\n roles: RoleReference[];\n source: string;\n};\n\nexport type EnterpriseUserPatchableProperties = UserPatchableProperties & {};\n\nexport const enterpriseUserEntityToProperties = (entity: EnterpriseUserEntity) => ({\n ...userEntityToProperties(entity),\n roles: entity.roles,\n source: entity.source,\n});\n\nexport type EnterpriseUserProperties = ReturnType<typeof enterpriseUserEntityToProperties>;\n"]}
|