@dremio/js-sdk 0.28.0 → 0.29.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.
@@ -13,6 +13,7 @@ import { JobsResource } from "../oss/jobs/JobsResource.ts";
13
13
  import { OAuthApplicationsResource } from "./oauth/OAuthApplicationsResource.ts";
14
14
  import { CloudsResource } from "./clouds/CloudsResource.js";
15
15
  import { UsersResource } from "./users/UsersResource.js";
16
+ import { EngineRulesResource } from "./engineRules/EngineRulesResource.ts";
16
17
  export declare class Dremio {
17
18
  #private;
18
19
  readonly ai: AiResource;
@@ -20,6 +21,7 @@ export declare class Dremio {
20
21
  readonly catalog: (projectId: string) => EnterpriseCatalogResource;
21
22
  readonly clouds: CloudsResource;
22
23
  readonly engines: (projectId: string) => EnginesResource;
24
+ readonly engineRules: (projectId: string) => EngineRulesResource;
23
25
  readonly jobs: (projectId: string) => JobsResource;
24
26
  readonly oauthApplications: OAuthApplicationsResource;
25
27
  readonly organizations: OrganizationsResource;
@@ -29,12 +29,14 @@ import { JobsResource } from "../oss/jobs/JobsResource.js";
29
29
  import { OAuthApplicationsResource } from "./oauth/OAuthApplicationsResource.js";
30
30
  import { CloudsResource } from "./clouds/CloudsResource.js";
31
31
  import { UsersResource } from "./users/UsersResource.js";
32
+ import { EngineRulesResource } from "./engineRules/EngineRulesResource.js";
32
33
  export class Dremio {
33
34
  ai;
34
35
  arctic;
35
36
  catalog;
36
37
  clouds;
37
38
  engines;
39
+ engineRules;
38
40
  jobs;
39
41
  oauthApplications;
40
42
  organizations;
@@ -52,6 +54,7 @@ export class Dremio {
52
54
  this.catalog = moize.default((projectId) => new EnterpriseCatalogResource(this.#resourceConfig(projectId)));
53
55
  this.clouds = new CloudsResource(this.#resourceConfig());
54
56
  this.engines = moize.default((projectId) => new EnginesResource(this.#resourceConfig(projectId)));
57
+ this.engineRules = moize.default((projectId) => new EngineRulesResource(this.#resourceConfig(projectId)));
55
58
  this.jobs = moize.default((projectId) => new JobsResource(this.#resourceConfig(projectId)));
56
59
  this.oauthApplications = new OAuthApplicationsResource(this.#resourceConfig());
57
60
  this.organizations = new OrganizationsResource(this.#resourceConfig());
@@ -1 +1 @@
1
- {"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/cloud/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,OAAO,MAAM;IACR,EAAE,CAAa;IACf,MAAM,CAAwC;IAC9C,OAAO,CAAmD;IAC1D,MAAM,CAAiB;IACvB,OAAO,CAAyC;IAChD,IAAI,CAAsC;IAC1C,iBAAiB,CAA4B;IAC7C,aAAa,CAAw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,IAAI,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CACxB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAC1E,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAC1B,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CACtF,CAAC;QACF,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,OAAO,CACtB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CACxE,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CACxB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAC/E,CAAC;IACJ,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport moize from \"moize\";\nimport type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"../enterprise/catalog/EnterpriseCatalogResource.js\";\nimport { RolesResource } from \"../enterprise/roles/RolesResource.js\";\nimport { EnterpriseScriptsResource } from \"../enterprise/scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { AiResource } from \"./ai/AiResource.ts\";\nimport { ArcticResource } from \"./arctic/ArcticResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { getResourceConfig } from \"./getResourceConfig.ts\";\nimport { OrganizationsResource } from \"./organizations/OrganizationsResource.js\";\nimport { ProjectsResource } from \"./projects/ProjectsResource.js\";\nimport { CloudUsersResource } from \"./users/CloudUsersResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport { OAuthApplicationsResource } from \"./oauth/OAuthApplicationsResource.ts\";\nimport { CloudsResource } from \"./clouds/CloudsResource.js\";\nimport { UsersResource } from \"./users/UsersResource.js\";\n\nexport class Dremio {\n readonly ai: AiResource;\n readonly arctic: (projectId: string) => ArcticResource;\n readonly catalog: (projectId: string) => EnterpriseCatalogResource;\n readonly clouds: CloudsResource;\n readonly engines: (projectId: string) => EnginesResource;\n readonly jobs: (projectId: string) => JobsResource;\n readonly oauthApplications: OAuthApplicationsResource;\n readonly organizations: OrganizationsResource;\n readonly projects: ProjectsResource;\n readonly roles: (projectId: string) => RolesResource;\n readonly scripts: (projectId: string) => EnterpriseScriptsResource;\n readonly sql: (projectId: string) => SqlResource;\n readonly _users: UsersResource;\n readonly users: (projectId: string) => CloudUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.ai = new AiResource(this.#resourceConfig());\n this.arctic = moize.default(\n (projectId: string) => new ArcticResource(this.#resourceConfig(projectId)),\n );\n this.catalog = moize.default(\n (projectId: string) => new EnterpriseCatalogResource(this.#resourceConfig(projectId)),\n );\n this.clouds = new CloudsResource(this.#resourceConfig());\n this.engines = moize.default(\n (projectId: string) => new EnginesResource(this.#resourceConfig(projectId)),\n );\n this.jobs = moize.default(\n (projectId: string) => new JobsResource(this.#resourceConfig(projectId)),\n );\n this.oauthApplications = new OAuthApplicationsResource(this.#resourceConfig());\n this.organizations = new OrganizationsResource(this.#resourceConfig());\n this.projects = new ProjectsResource(this.#resourceConfig());\n this.roles = moize.default(\n (projectId: string) => new RolesResource(this.#resourceConfig(projectId)),\n );\n this.scripts = moize.default(\n (projectId: string) => new EnterpriseScriptsResource(this.#resourceConfig(projectId)),\n );\n this.sql = moize.default(\n (projectId: string) => new SqlResource(this.#resourceConfig(projectId)),\n );\n this._users = new UsersResource(this.#resourceConfig());\n this.users = moize.default(\n (projectId: string) => new CloudUsersResource(this.#resourceConfig(projectId)),\n );\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
1
+ {"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/cloud/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;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AAC;QACxD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CACxB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAC/E,CAAC;IACJ,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport moize from \"moize\";\nimport type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"../enterprise/catalog/EnterpriseCatalogResource.js\";\nimport { RolesResource } from \"../enterprise/roles/RolesResource.js\";\nimport { EnterpriseScriptsResource } from \"../enterprise/scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { AiResource } from \"./ai/AiResource.ts\";\nimport { ArcticResource } from \"./arctic/ArcticResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { getResourceConfig } from \"./getResourceConfig.ts\";\nimport { OrganizationsResource } from \"./organizations/OrganizationsResource.js\";\nimport { ProjectsResource } from \"./projects/ProjectsResource.js\";\nimport { CloudUsersResource } from \"./users/CloudUsersResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport { OAuthApplicationsResource } from \"./oauth/OAuthApplicationsResource.ts\";\nimport { CloudsResource } from \"./clouds/CloudsResource.js\";\nimport { UsersResource } from \"./users/UsersResource.js\";\nimport { EngineRulesResource } from \"./engineRules/EngineRulesResource.ts\";\n\nexport class Dremio {\n readonly ai: AiResource;\n readonly arctic: (projectId: string) => ArcticResource;\n readonly catalog: (projectId: string) => EnterpriseCatalogResource;\n readonly clouds: CloudsResource;\n readonly engines: (projectId: string) => EnginesResource;\n readonly engineRules: (projectId: string) => EngineRulesResource;\n readonly jobs: (projectId: string) => JobsResource;\n readonly oauthApplications: OAuthApplicationsResource;\n readonly organizations: OrganizationsResource;\n readonly projects: ProjectsResource;\n readonly roles: (projectId: string) => RolesResource;\n readonly scripts: (projectId: string) => EnterpriseScriptsResource;\n readonly sql: (projectId: string) => SqlResource;\n readonly _users: UsersResource;\n readonly users: (projectId: string) => CloudUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.ai = new AiResource(this.#resourceConfig());\n this.arctic = moize.default(\n (projectId: string) => new ArcticResource(this.#resourceConfig(projectId)),\n );\n this.catalog = moize.default(\n (projectId: string) => new EnterpriseCatalogResource(this.#resourceConfig(projectId)),\n );\n this.clouds = new CloudsResource(this.#resourceConfig());\n this.engines = moize.default(\n (projectId: string) => new EnginesResource(this.#resourceConfig(projectId)),\n );\n this.engineRules = moize.default(\n (projectId: string) => new EngineRulesResource(this.#resourceConfig(projectId)),\n );\n this.jobs = moize.default(\n (projectId: string) => new JobsResource(this.#resourceConfig(projectId)),\n );\n this.oauthApplications = new OAuthApplicationsResource(this.#resourceConfig());\n this.organizations = new OrganizationsResource(this.#resourceConfig());\n this.projects = new ProjectsResource(this.#resourceConfig());\n this.roles = moize.default(\n (projectId: string) => new RolesResource(this.#resourceConfig(projectId)),\n );\n this.scripts = moize.default(\n (projectId: string) => new EnterpriseScriptsResource(this.#resourceConfig(projectId)),\n );\n this.sql = moize.default(\n (projectId: string) => new SqlResource(this.#resourceConfig(projectId)),\n );\n this._users = new UsersResource(this.#resourceConfig());\n this.users = moize.default(\n (projectId: string) => new CloudUsersResource(this.#resourceConfig(projectId)),\n );\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import z from "zod";
16
+ import * as z from "zod/mini";
17
17
  import { cloudPropertiesCodec } from "./cloudPropertiesCodec.js";
18
18
  import { Cloud } from "./Cloud.js";
19
19
  export class CloudsResource {
@@ -1 +1 @@
1
- {"version":3,"file":"CloudsResource.js","sourceRoot":"","sources":["../../../src/cloud/clouds/CloudsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,OAAO,cAAc;IAChB,OAAO,CAAW;IAE3B,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI;QACF,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO;aACT,SAAS,CAAC,QAAQ,EAAE;YACnB,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAqD,CAAC;aAC3E,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAClB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAChB,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAC3E;SACF,CAAC,CAAC,CAAC;QACR,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;YAClF,CAAC;YACD,OAAO;SACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport z from \"zod\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { cloudPropertiesCodec } from \"./cloudPropertiesCodec.js\";\nimport { Cloud } from \"./Cloud.ts\";\n\nexport class CloudsResource {\n readonly #config: V3Config;\n\n constructor(config: V3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"clouds\", {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof cloudPropertiesCodec>[]>)\n .map((entities) => ({\n data: entities.map(\n (entity) => new Cloud(this.#config, z.parse(cloudPropertiesCodec, entity)),\n ),\n }));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await getPage({ signal }).promise.then((result) => result.unwrap().data);\n },\n getPage,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"CloudsResource.js","sourceRoot":"","sources":["../../../src/cloud/clouds/CloudsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,OAAO,cAAc;IAChB,OAAO,CAAW;IAE3B,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI;QACF,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO;aACT,SAAS,CAAC,QAAQ,EAAE;YACnB,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;aAC3B;YACD,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAqD,CAAC;aAC3E,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAClB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAChB,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAC3E;SACF,CAAC,CAAC,CAAC;QACR,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;YAClF,CAAC;YACD,OAAO;SACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { cloudPropertiesCodec } from \"./cloudPropertiesCodec.js\";\nimport { Cloud } from \"./Cloud.ts\";\n\nexport class CloudsResource {\n readonly #config: V3Config;\n\n constructor(config: V3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"clouds\", {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map((res) => res.json() as Promise<z.input<typeof cloudPropertiesCodec>[]>)\n .map((entities) => ({\n data: entities.map(\n (entity) => new Cloud(this.#config, z.parse(cloudPropertiesCodec, entity)),\n ),\n }));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await getPage({ signal }).promise.then((result) => result.unwrap().data);\n },\n getPage,\n };\n }\n}\n"]}
@@ -0,0 +1,57 @@
1
+ import * as z from "zod/mini";
2
+ import type { SonarV3Config } from "../../common/Config.ts";
3
+ import { Result } from "ts-results-es";
4
+ declare const engineRouteRulePropertiesSchema: z.ZodMiniObject<{
5
+ action: z.ZodMiniLiteral<"ROUTE">;
6
+ condition: z.ZodMiniString<string>;
7
+ engineName: z.ZodMiniString<string>;
8
+ name: z.ZodMiniString<string>;
9
+ }, z.core.$strip>;
10
+ declare const engineRejectRulePropertiesSchema: z.ZodMiniObject<{
11
+ action: z.ZodMiniLiteral<"REJECT">;
12
+ condition: z.ZodMiniString<string>;
13
+ name: z.ZodMiniString<string>;
14
+ rejectMessage: z.ZodMiniString<string>;
15
+ }, z.core.$strip>;
16
+ export declare const engineRulePropertiesSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
17
+ action: z.ZodMiniLiteral<"ROUTE">;
18
+ condition: z.ZodMiniString<string>;
19
+ engineName: z.ZodMiniString<string>;
20
+ name: z.ZodMiniString<string>;
21
+ }, z.core.$strip>, z.ZodMiniObject<{
22
+ action: z.ZodMiniLiteral<"REJECT">;
23
+ condition: z.ZodMiniString<string>;
24
+ name: z.ZodMiniString<string>;
25
+ rejectMessage: z.ZodMiniString<string>;
26
+ }, z.core.$strip>], "action">;
27
+ export declare class EngineRouteRule implements z.infer<typeof engineRouteRulePropertiesSchema> {
28
+ #private;
29
+ readonly action = "ROUTE";
30
+ readonly condition: string;
31
+ readonly engineName: string;
32
+ readonly name: string;
33
+ constructor(config: SonarV3Config, properties: Omit<z.infer<typeof engineRouteRulePropertiesSchema>, "action">);
34
+ static schema: z.ZodMiniObject<{
35
+ action: z.ZodMiniLiteral<"ROUTE">;
36
+ condition: z.ZodMiniString<string>;
37
+ engineName: z.ZodMiniString<string>;
38
+ name: z.ZodMiniString<string>;
39
+ }, z.core.$strip>;
40
+ }
41
+ export declare class EngineRejectRule implements z.infer<typeof engineRejectRulePropertiesSchema> {
42
+ #private;
43
+ readonly action = "REJECT";
44
+ readonly condition: string;
45
+ readonly name: string;
46
+ readonly rejectMessage: string;
47
+ constructor(config: SonarV3Config, properties: Omit<z.infer<typeof engineRejectRulePropertiesSchema>, "action">);
48
+ static schema: z.ZodMiniObject<{
49
+ action: z.ZodMiniLiteral<"REJECT">;
50
+ condition: z.ZodMiniString<string>;
51
+ name: z.ZodMiniString<string>;
52
+ rejectMessage: z.ZodMiniString<string>;
53
+ }, z.core.$strip>;
54
+ }
55
+ export type EngineRule = EngineRejectRule | EngineRouteRule;
56
+ export declare function decodeEngineRule(config: SonarV3Config, entity: z.infer<typeof engineRulePropertiesSchema>): Result<EngineRule, z.core.util.SafeParseResult<z.output<typeof engineRulePropertiesSchema>>["error"]>;
57
+ export {};
@@ -0,0 +1,77 @@
1
+ /*
2
+ * Copyright (C) 2024-2025 Dremio Corporation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import * as z from "zod/mini";
17
+ import { Err, Ok, Result } from "ts-results-es";
18
+ const engineRouteRulePropertiesSchema = z.object({
19
+ action: z.literal("ROUTE"),
20
+ condition: z.string(),
21
+ engineName: z.string().check(z.minLength(1)),
22
+ name: z.string(),
23
+ });
24
+ const engineRejectRulePropertiesSchema = z.object({
25
+ action: z.literal("REJECT"),
26
+ condition: z.string(),
27
+ name: z.string(),
28
+ rejectMessage: z.string(),
29
+ });
30
+ export const engineRulePropertiesSchema = z.discriminatedUnion("action", [
31
+ engineRouteRulePropertiesSchema,
32
+ engineRejectRulePropertiesSchema,
33
+ ]);
34
+ export class EngineRouteRule {
35
+ // eslint-disable-next-line no-unused-private-class-members
36
+ #config;
37
+ action = "ROUTE";
38
+ condition;
39
+ engineName;
40
+ name;
41
+ constructor(config, properties) {
42
+ this.#config = config;
43
+ this.condition = properties.condition;
44
+ this.engineName = properties.engineName;
45
+ this.name = properties.name;
46
+ }
47
+ static schema = engineRouteRulePropertiesSchema;
48
+ }
49
+ export class EngineRejectRule {
50
+ // eslint-disable-next-line no-unused-private-class-members
51
+ #config;
52
+ action = "REJECT";
53
+ condition;
54
+ name;
55
+ rejectMessage;
56
+ constructor(config, properties) {
57
+ this.#config = config;
58
+ this.condition = properties.condition;
59
+ this.name = properties.name;
60
+ this.rejectMessage = properties.rejectMessage;
61
+ }
62
+ static schema = engineRejectRulePropertiesSchema;
63
+ }
64
+ export function decodeEngineRule(config, entity) {
65
+ const parseResult = z.safeDecode(engineRulePropertiesSchema, entity);
66
+ if (!parseResult.success) {
67
+ return Err(parseResult.error);
68
+ }
69
+ const parsed = parseResult.data;
70
+ switch (parsed.action) {
71
+ case "REJECT":
72
+ return Ok(new EngineRejectRule(config, parsed));
73
+ case "ROUTE":
74
+ return Ok(new EngineRouteRule(config, parsed));
75
+ }
76
+ }
77
+ //# sourceMappingURL=EngineRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngineRule.js","sourceRoot":"","sources":["../../../src/cloud/engineRules/EngineRule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAEH,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACvE,+BAA+B;IAC/B,gCAAgC;CACjC,CAAC,CAAC;AAEH,MAAM,OAAO,eAAe;IAC1B,2DAA2D;IAClD,OAAO,CAAgB;IACvB,MAAM,GAAG,OAAO,CAAC;IACjB,SAAS,CAAS;IAClB,U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AAO,EAAE,CAAC,IAAI,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;AACH,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { Err, Ok, Result } from \"ts-results-es\";\n\nconst engineRouteRulePropertiesSchema = z.object({\n action: z.literal(\"ROUTE\"),\n condition: z.string(),\n engineName: z.string().check(z.minLength(1)),\n name: z.string(),\n});\n\nconst engineRejectRulePropertiesSchema = z.object({\n action: z.literal(\"REJECT\"),\n condition: z.string(),\n name: z.string(),\n rejectMessage: z.string(),\n});\n\nexport const engineRulePropertiesSchema = z.discriminatedUnion(\"action\", [\n engineRouteRulePropertiesSchema,\n engineRejectRulePropertiesSchema,\n]);\n\nexport class EngineRouteRule implements z.infer<typeof engineRouteRulePropertiesSchema> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: SonarV3Config;\n readonly action = \"ROUTE\";\n readonly condition: string;\n readonly engineName: string;\n readonly name: string;\n\n constructor(\n config: SonarV3Config,\n properties: Omit<z.infer<typeof engineRouteRulePropertiesSchema>, \"action\">,\n ) {\n this.#config = config;\n this.condition = properties.condition;\n this.engineName = properties.engineName;\n this.name = properties.name;\n }\n\n static schema = engineRouteRulePropertiesSchema;\n}\n\nexport class EngineRejectRule implements z.infer<typeof engineRejectRulePropertiesSchema> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: SonarV3Config;\n readonly action = \"REJECT\";\n readonly condition: string;\n readonly name: string;\n readonly rejectMessage: string;\n\n constructor(\n config: SonarV3Config,\n properties: Omit<z.infer<typeof engineRejectRulePropertiesSchema>, \"action\">,\n ) {\n this.#config = config;\n this.condition = properties.condition;\n this.name = properties.name;\n this.rejectMessage = properties.rejectMessage;\n }\n\n static schema = engineRejectRulePropertiesSchema;\n}\n\nexport type EngineRule = EngineRejectRule | EngineRouteRule;\n\nexport function decodeEngineRule(\n config: SonarV3Config,\n entity: z.infer<typeof engineRulePropertiesSchema>,\n): Result<\n EngineRule,\n z.core.util.SafeParseResult<z.output<typeof engineRulePropertiesSchema>>[\"error\"]\n> {\n const parseResult = z.safeDecode(engineRulePropertiesSchema, entity);\n if (!parseResult.success) {\n return Err(parseResult.error);\n }\n const parsed = parseResult.data;\n switch (parsed.action) {\n case \"REJECT\":\n return Ok(new EngineRejectRule(config, parsed));\n case \"ROUTE\":\n return Ok(new EngineRouteRule(config, parsed));\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { SonarV3Config } from "../../common/Config.ts";
2
+ import type { SignalParam } from "../../common/Params.ts";
3
+ export declare class EngineRulesResource {
4
+ #private;
5
+ constructor(config: SonarV3Config);
6
+ list({ signal }?: SignalParam): import("ts-results-es").AsyncResult<{
7
+ defaultRule: import("./EngineRule.js").EngineRule;
8
+ rules: import("./EngineRule.js").EngineRule[];
9
+ tag: string;
10
+ }, import("../index.ts").HttpError>;
11
+ }
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (C) 2024-2025 Dremio Corporation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import * as z from "zod/mini";
17
+ import { decodeEngineRule, engineRulePropertiesSchema } from "./EngineRule.js";
18
+ export class EngineRulesResource {
19
+ #config;
20
+ constructor(config) {
21
+ this.#config = config;
22
+ }
23
+ list({ signal } = {}) {
24
+ return this.#config
25
+ .sonarV3Request("rules", { headers: { Accept: "application/json" }, signal })
26
+ .map((res) => res.json())
27
+ .map((res) => ({
28
+ defaultRule: decodeEngineRule(this.#config, res.ruleSet.ruleInfoDefault).unwrap(),
29
+ rules: res.ruleSet.ruleInfos.map((entity) => decodeEngineRule(this.#config, entity).unwrap()),
30
+ tag: res.ruleSet.tag,
31
+ }));
32
+ }
33
+ }
34
+ //# sourceMappingURL=EngineRulesResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngineRulesResource.js","sourceRoot":"","sources":["../../../src/cloud/engineRules/EngineRulesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,OAAO,mBAAmB;IACrB,OAAO,CAAgB;IAEhC,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;QAC/B,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;aAC5E,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,IAAI,EAMN,CACL;aACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACb,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE;YACjF,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC1C,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,EAAE,CAChD;YACD,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG;SACrB,CAAC,CAAC,CAAC;IACR,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { decodeEngineRule, engineRulePropertiesSchema } from \"./EngineRule.js\";\n\nexport class EngineRulesResource {\n readonly #config: SonarV3Config;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n }\n\n list({ signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(\"rules\", { headers: { Accept: \"application/json\" }, signal })\n .map(\n (res) =>\n res.json() as Promise<{\n ruleSet: {\n ruleInfos: z.infer<typeof engineRulePropertiesSchema>[];\n ruleInfoDefault: z.infer<typeof engineRulePropertiesSchema>;\n tag: string;\n };\n }>,\n )\n .map((res) => ({\n defaultRule: decodeEngineRule(this.#config, res.ruleSet.ruleInfoDefault).unwrap(),\n rules: res.ruleSet.ruleInfos.map((entity) =>\n decodeEngineRule(this.#config, entity).unwrap(),\n ),\n tag: res.ruleSet.tag,\n }));\n }\n}\n"]}
@@ -10,9 +10,10 @@ import type { ReflectionSummary } from "../enterprise/reflections/ReflectionSumm
10
10
  import type { Role } from "../enterprise/roles/Role.ts";
11
11
  import type { BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference } from "../oss/catalog/VersionReference.ts";
12
12
  import type { JobResultsSchema } from "../oss/jobs/utils/JobResultsResponse.ts";
13
+ import { type EngineRule, EngineRejectRule, EngineRouteRule } from "./engineRules/EngineRule.ts";
13
14
  export type { ArcticCatalog, CloudUser, Engine, Project };
14
- export type { Job, JobResultsSchema, Reflection, EnterpriseScript, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
15
- export { Organization, User };
15
+ export type { EngineRule, Job, JobResultsSchema, Reflection, EnterpriseScript, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
16
+ export { EngineRejectRule, EngineRouteRule, Organization, User };
16
17
  export * from "../enterprise/catalog/CatalogObjects/index.ts";
17
18
  export * from "../enterprise/catalog/CatalogReferences/index.ts";
18
19
  export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.ts";
@@ -15,7 +15,8 @@
15
15
  */
16
16
  import { Organization } from "./organizations/Organization.js";
17
17
  import { User } from "./users/User.js";
18
- export { Organization, User };
18
+ import { EngineRejectRule, EngineRouteRule } from "./engineRules/EngineRule.js";
19
+ export { EngineRejectRule, EngineRouteRule, Organization, User };
19
20
  export * from "../enterprise/catalog/CatalogObjects/index.js";
20
21
  export * from "../enterprise/catalog/CatalogReferences/index.js";
21
22
  export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.js";
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA0BvC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAC9B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+BAA+B,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ArcticCatalog } from \"./arctic/ArcticCatalog.ts\";\nimport type { CloudUser } from \"./users/CloudUser.ts\";\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Project } from \"./projects/Project.ts\";\nimport { Organization } from \"./organizations/Organization.ts\";\nimport { User } from \"./users/User.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseScript } from \"../enterprise/scripts/EnterpriseScript.ts\";\nimport type { ReflectionSummary } from \"../enterprise/reflections/ReflectionSummary.ts\";\nimport type { Role } from \"../enterprise/roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\nimport type { JobResultsSchema } from \"../oss/jobs/utils/JobResultsResponse.ts\";\n\nexport type { ArcticCatalog, CloudUser, Engine, Project };\nexport type {\n Job,\n JobResultsSchema,\n Reflection,\n EnterpriseScript,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport { Organization, User };\nexport * from \"../enterprise/catalog/CatalogObjects/index.ts\";\nexport * from \"../enterprise/catalog/CatalogReferences/index.ts\";\nexport * from \"../enterprise/catalog/catalogSearch/CatalogSearchResult.ts\";\nexport * from \"../enterprise/grants/Grant.ts\";\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAYvC,OAAO,EAAmB,gBAAgB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAgBjG,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AACjE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+BAA+B,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ArcticCatalog } from \"./arctic/ArcticCatalog.ts\";\nimport type { CloudUser } from \"./users/CloudUser.ts\";\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Project } from \"./projects/Project.ts\";\nimport { Organization } from \"./organizations/Organization.ts\";\nimport { User } from \"./users/User.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseScript } from \"../enterprise/scripts/EnterpriseScript.ts\";\nimport type { ReflectionSummary } from \"../enterprise/reflections/ReflectionSummary.ts\";\nimport type { Role } from \"../enterprise/roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\nimport type { JobResultsSchema } from \"../oss/jobs/utils/JobResultsResponse.ts\";\nimport { type EngineRule, EngineRejectRule, EngineRouteRule } from \"./engineRules/EngineRule.ts\";\n\nexport type { ArcticCatalog, CloudUser, Engine, Project };\nexport type {\n EngineRule,\n Job,\n JobResultsSchema,\n Reflection,\n EnterpriseScript,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport { EngineRejectRule, EngineRouteRule, Organization, User };\nexport * from \"../enterprise/catalog/CatalogObjects/index.ts\";\nexport * from \"../enterprise/catalog/CatalogReferences/index.ts\";\nexport * from \"../enterprise/catalog/catalogSearch/CatalogSearchResult.ts\";\nexport * from \"../enterprise/grants/Grant.ts\";\n"]}
@@ -4,11 +4,11 @@ import type { V2Config } from "../../common/Config.ts";
4
4
  import { Observable } from "rxjs";
5
5
  import type { SignalParam } from "../../common/Params.ts";
6
6
  export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
7
- auditDestinationCloudType: z.ZodMiniEnum<{
7
+ auditDestinationCloudType: z.ZodMiniOptional<z.ZodMiniEnum<{
8
8
  AWS: "AWS";
9
9
  AZURE: "AZURE";
10
- }>;
11
- auditDestinationCredentials: z.ZodMiniObject<{
10
+ }>>;
11
+ auditDestinationCredentials: z.ZodMiniOptional<z.ZodMiniObject<{
12
12
  accessKeyId: z.ZodMiniString<string>;
13
13
  secretAccessKey: z.ZodMiniString<string>;
14
14
  type: z.ZodMiniEnum<{
@@ -16,8 +16,8 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
16
16
  AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
17
17
  IAM_ROLE: "IAM_ROLE";
18
18
  }>;
19
- }, z.core.$strip>;
20
- auditDestinationPath: z.ZodMiniString<string>;
19
+ }, z.core.$strip>>;
20
+ auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
21
21
  cloudTags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
22
22
  key: z.ZodMiniString<string>;
23
23
  value: z.ZodMiniString<string>;
@@ -60,11 +60,11 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
60
60
  }>;
61
61
  createdBy: z.ZodMiniString<string>;
62
62
  modifiedBy: z.ZodMiniString<string>;
63
- auditDestinationCloudType: z.ZodMiniEnum<{
63
+ auditDestinationCloudType: z.ZodMiniOptional<z.ZodMiniEnum<{
64
64
  AWS: "AWS";
65
65
  AZURE: "AZURE";
66
- }>;
67
- auditDestinationCredentials: z.ZodMiniObject<{
66
+ }>>;
67
+ auditDestinationCredentials: z.ZodMiniOptional<z.ZodMiniObject<{
68
68
  accessKeyId: z.ZodMiniString<string>;
69
69
  secretAccessKey: z.ZodMiniString<string>;
70
70
  type: z.ZodMiniEnum<{
@@ -72,8 +72,8 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
72
72
  AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
73
73
  IAM_ROLE: "IAM_ROLE";
74
74
  }>;
75
- }, z.core.$strip>;
76
- auditDestinationPath: z.ZodMiniString<string>;
75
+ }, z.core.$strip>>;
76
+ auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
77
77
  defaultProjectId: z.ZodMiniString<string>;
78
78
  _isCreatedWithCFT: z.ZodMiniBoolean<boolean>;
79
79
  cloudTags: z.ZodMiniArray<z.ZodMiniObject<{
@@ -128,11 +128,11 @@ export declare class Organization implements OrganizationProperties {
128
128
  }>;
129
129
  createdBy: z.ZodMiniString<string>;
130
130
  modifiedBy: z.ZodMiniString<string>;
131
- auditDestinationCloudType: z.ZodMiniEnum<{
131
+ auditDestinationCloudType: z.ZodMiniOptional<z.ZodMiniEnum<{
132
132
  AWS: "AWS";
133
133
  AZURE: "AZURE";
134
- }>;
135
- auditDestinationCredentials: z.ZodMiniObject<{
134
+ }>>;
135
+ auditDestinationCredentials: z.ZodMiniOptional<z.ZodMiniObject<{
136
136
  accessKeyId: z.ZodMiniString<string>;
137
137
  secretAccessKey: z.ZodMiniString<string>;
138
138
  type: z.ZodMiniEnum<{
@@ -140,8 +140,8 @@ export declare class Organization implements OrganizationProperties {
140
140
  AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
141
141
  IAM_ROLE: "IAM_ROLE";
142
142
  }>;
143
- }, z.core.$strip>;
144
- auditDestinationPath: z.ZodMiniString<string>;
143
+ }, z.core.$strip>>;
144
+ auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
145
145
  defaultProjectId: z.ZodMiniString<string>;
146
146
  _isCreatedWithCFT: z.ZodMiniBoolean<boolean>;
147
147
  cloudTags: z.ZodMiniArray<z.ZodMiniObject<{
@@ -18,13 +18,13 @@ import { Temporal } from "temporal-polyfill";
18
18
  import { map, Observable, repeat, shareReplay, takeWhile, timer } from "rxjs";
19
19
  import { fromAbortable } from "../../common/fromAbortable.js";
20
20
  const organizationPropertiesInSchema = z.object({
21
- auditDestinationCloudType: z.enum(["AWS", "AZURE"]),
22
- auditDestinationCredentials: z.object({
21
+ auditDestinationCloudType: z.optional(z.enum(["AWS", "AZURE"])),
22
+ auditDestinationCredentials: z.optional(z.object({
23
23
  accessKeyId: z.string(),
24
24
  secretAccessKey: z.string(),
25
25
  type: z.enum(["ACCESS_KEY", "AZURE_ACTIVE_DIRECTORY", "IAM_ROLE"]),
26
- }),
27
- auditDestinationPath: z.string(),
26
+ })),
27
+ auditDestinationPath: z.optional(z.string()),
28
28
  cloudTags: z.optional(z.array(z.object({
29
29
  key: z.string(),
30
30
  value: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"Organization.js","sourceRoot":"","sources":["../../../src/cloud/organizations/Organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAA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AAE,IAAI,CAAC,gBAAgB;gBACvC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;aAC/B,CAAC,CACH;YACD,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,EAA0D,CAAC;aAChF,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAC1F,CAAC;IACN,CAAC;IAED,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC,GAAG,CAAC,GAAG,CAAC;;AAGtD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAgB,EAAE,EAAE,CAC9C,SAAS,WAAW,CAAC,EAAE,MAAM,KAAkB,EAAE;IAC/C,OAAO,MAAM;SACV,SAAS,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;SAC/E,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9F,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 * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\nimport { map, Observable, repeat, shareReplay, takeWhile, timer } from \"rxjs\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.enum([\"AWS\", \"AZURE\"]),\n auditDestinationCredentials: z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n auditDestinationPath: z.string(),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n };\n },\n },\n);\n\nconst organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {\n defaultProjectId: true,\n name: true,\n});\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n readonly updates$: Observable<Organization>;\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n\n this.updates$ = fromAbortable(\n ({ signal }) => retrieveOrg(this.#config)({ signal }).promise,\n ).pipe(\n repeat({ delay: () => timer(3000) }),\n takeWhile((result) => result.isOk() && !result.value.settled, true),\n map((result) => result.unwrap()),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n update(fields: Partial<z.infer<typeof organizationUpdateSchema>>) {\n return this.#config\n .v2Request(\"organizations\", {\n body: JSON.stringify(\n z.parse(organizationUpdateSchema, {\n defaultProjectId: this.defaultProjectId,\n name: fields.name || this.name,\n }),\n ),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map(\n (entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)),\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n\nexport const retrieveOrg = (config: V2Config) =>\n function retrieveOrg({ signal }: SignalParam = {}) {\n return config\n .v2Request(\"organizations\", { headers: { Accept: \"application/json\" }, signal })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map((entity) => new Organization(config, z.decode(organizationPropertiesCodec, entity)));\n };\n"]}
1
+ {"version":3,"file":"Organization.js","sourceRoot":"","sources":["../../../src/cloud/organizations/Organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,UAAU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CAAC,CAAC,KAAK,CAAC,wBAAwB,EAAE;gBAChC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;aAC/B,CAAC,CACH;YACD,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,EAA0D,CAAC;aAChF,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAC1F,CAAC;IACN,CAAC;IAED,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC,GAAG,CAAC,GAAG,CAAC;;AAGtD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAgB,EAAE,EAAE,CAC9C,SAAS,WAAW,CAAC,EAAE,MAAM,KAAkB,EAAE;IAC/C,OAAO,MAAM;SACV,SAAS,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;SAC/E,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9F,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 * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\nimport { map, Observable, repeat, shareReplay, takeWhile, timer } from \"rxjs\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.optional(z.enum([\"AWS\", \"AZURE\"])),\n auditDestinationCredentials: z.optional(\n z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n ),\n auditDestinationPath: z.optional(z.string()),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n };\n },\n },\n);\n\nconst organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {\n defaultProjectId: true,\n name: true,\n});\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n readonly updates$: Observable<Organization>;\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n\n this.updates$ = fromAbortable(\n ({ signal }) => retrieveOrg(this.#config)({ signal }).promise,\n ).pipe(\n repeat({ delay: () => timer(3000) }),\n takeWhile((result) => result.isOk() && !result.value.settled, true),\n map((result) => result.unwrap()),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n update(fields: Partial<z.infer<typeof organizationUpdateSchema>>) {\n return this.#config\n .v2Request(\"organizations\", {\n body: JSON.stringify(\n z.parse(organizationUpdateSchema, {\n defaultProjectId: this.defaultProjectId,\n name: fields.name || this.name,\n }),\n ),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map(\n (entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)),\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n\nexport const retrieveOrg = (config: V2Config) =>\n function retrieveOrg({ signal }: SignalParam = {}) {\n return config\n .v2Request(\"organizations\", { headers: { Accept: \"application/json\" }, signal })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map((entity) => new Organization(config, z.decode(organizationPropertiesCodec, entity)));\n };\n"]}
@@ -1,4 +1,4 @@
1
- import type z from "zod";
1
+ import * as z from "zod/mini";
2
2
  import type { userPropertiesCodec } from "./userPropertiesCodec.ts";
3
3
  import type { V2Config } from "../../common/Config.ts";
4
4
  export declare class User implements z.output<typeof userPropertiesCodec> {
@@ -11,4 +11,6 @@ export declare class User implements z.output<typeof userPropertiesCodec> {
11
11
  readonly status: z.output<typeof userPropertiesCodec>["status"];
12
12
  readonly username: string;
13
13
  constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>);
14
+ get displayName(): string;
15
+ get initials(): string;
14
16
  }
@@ -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 * as z from "zod/mini";
16
17
  export class User {
17
18
  // eslint-disable-next-line no-unused-private-class-members
18
19
  #config;
@@ -33,5 +34,23 @@ export class User {
33
34
  this.status = properties.status;
34
35
  this.username = properties.username;
35
36
  }
37
+ get displayName() {
38
+ if (this.givenName || this.familyName) {
39
+ return [this.givenName, this.familyName].filter(Boolean).join(" ");
40
+ }
41
+ if (this.username) {
42
+ return this.username;
43
+ }
44
+ if (this.email) {
45
+ return this.email;
46
+ }
47
+ return this.id;
48
+ }
49
+ get initials() {
50
+ if (this.givenName && this.familyName) {
51
+ return this.givenName.charAt(0) + this.familyName.charAt(0);
52
+ }
53
+ return this.displayName.slice(0, 2);
54
+ }
36
55
  }
37
56
  //# sourceMappingURL=User.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/cloud/users/User.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,IAAI;IACf,2DAA2D;IAClD,OAAO,CAAW;IAClB,KAAK,CAAgB;IACrB,UAAU,CAAgB;IAC1B,SAAS,CAAgB;IACzB,EAAE,CAAS;IACX,KAAK,CAAgD;IACrD,MAAM,CAAiD;IACvD,QAAQ,CAAS;IAE1B,YAAY,MAAgB,EAAE,UAAgD;QAC5E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IACtC,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type z from \"zod\";\nimport type { userPropertiesCodec } from \"./userPropertiesCodec.ts\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nexport class User implements z.output<typeof userPropertiesCodec> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V2Config;\n readonly email: string | null;\n readonly familyName: string | null;\n readonly givenName: string | null;\n readonly id: string;\n readonly roles: z.output<typeof userPropertiesCodec>[\"roles\"];\n readonly status: z.output<typeof userPropertiesCodec>[\"status\"];\n readonly username: string;\n\n constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>) {\n this.#config = config;\n this.email = properties.email;\n this.familyName = properties.familyName;\n this.givenName = properties.givenName;\n this.id = properties.id;\n this.roles = properties.roles;\n this.status = properties.status;\n this.username = properties.username;\n }\n}\n"]}
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/cloud/users/User.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,MAAM,OAAO,IAAI;IACf,2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,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { userPropertiesCodec } from \"./userPropertiesCodec.ts\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nexport class User implements z.output<typeof userPropertiesCodec> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V2Config;\n readonly email: string | null;\n readonly familyName: string | null;\n readonly givenName: string | null;\n readonly id: string;\n readonly roles: z.output<typeof userPropertiesCodec>[\"roles\"];\n readonly status: z.output<typeof userPropertiesCodec>[\"status\"];\n readonly username: string;\n\n constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>) {\n this.#config = config;\n this.email = properties.email;\n this.familyName = properties.familyName;\n this.givenName = properties.givenName;\n this.id = properties.id;\n this.roles = properties.roles;\n this.status = properties.status;\n this.username = properties.username;\n }\n\n get displayName(): string {\n if (this.givenName || this.familyName) {\n return [this.givenName, this.familyName].filter(Boolean).join(\" \");\n }\n\n if (this.username) {\n return this.username;\n }\n\n if (this.email) {\n return this.email;\n }\n\n return this.id;\n }\n\n get initials(): string {\n if (this.givenName && this.familyName) {\n return this.givenName.charAt(0) + this.familyName.charAt(0);\n }\n\n return this.displayName.slice(0, 2);\n }\n}\n"]}
@@ -33,8 +33,8 @@ export const userPropertiesCodec = z.codec(userPropertiesInSchema, z.extend(z.om
33
33
  lastName: true,
34
34
  }), {
35
35
  email: z.nullable(z.string().check(z.email())),
36
- familyName: z.nullable(z.string()),
37
- givenName: z.nullable(z.string()),
36
+ familyName: z.nullable(z.string().check(z.trim())),
37
+ givenName: z.nullable(z.string().check(z.trim())),
38
38
  }), {
39
39
  decode(v) {
40
40
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/users/userPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;KACjD,CAAC,CACH;IACD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACrD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CACxC,sBAAsB,EACtB,CAAC,CAAC,MAAM,CACN,CAAC,CAAC,IAAI,CAAC,sBAAsB,EAAE;IAC7B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;CACf,CAAC,EACF;IACE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAClC,CACF,EACD;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,GAAG,CAAC;YACJ,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI;YACtB,UAAU,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;YAC9B,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;SAC/B,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;QACpD,OAAO;YACL,GAAG,IAAI;YACP,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,QAAQ,EAAE,UAAU,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;CACF,CACF,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\n\nconst userPropertiesInSchema = z.object({\n email: z.string(),\n firstName: z.string(),\n id: z.string().check(z.minLength(1)),\n lastName: z.string(),\n roles: z.array(\n z.object({\n id: z.string(),\n name: z.string(),\n type: z.enum([\"INTERNAL\", \"EXTERNAL\", \"SYSTEM\"]),\n }),\n ),\n status: z.enum([\"ACTIVE\", \"INACTIVE\"]),\n username: z.string().check(z.trim(), z.minLength(1)),\n});\n\nexport const userPropertiesCodec = z.codec(\n userPropertiesInSchema,\n z.extend(\n z.omit(userPropertiesInSchema, {\n email: true,\n firstName: true,\n lastName: true,\n }),\n {\n email: z.nullable(z.string().check(z.email())),\n familyName: z.nullable(z.string()),\n givenName: z.nullable(z.string()),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n email: v.email || null,\n familyName: v.lastName || null,\n givenName: v.firstName || null,\n };\n },\n encode(v) {\n const { email, familyName, givenName, ...rest } = v;\n return {\n ...rest,\n email: email || \"\",\n firstName: givenName || \"\",\n lastName: familyName || \"\",\n };\n },\n },\n);\n"]}
1
+ {"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/users/userPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd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MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;QACpD,OAAO;YACL,GAAG,IAAI;YACP,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,QAAQ,EAAE,UAAU,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;CACF,CACF,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\n\nconst userPropertiesInSchema = z.object({\n email: z.string(),\n firstName: z.string(),\n id: z.string().check(z.minLength(1)),\n lastName: z.string(),\n roles: z.array(\n z.object({\n id: z.string(),\n name: z.string(),\n type: z.enum([\"INTERNAL\", \"EXTERNAL\", \"SYSTEM\"]),\n }),\n ),\n status: z.enum([\"ACTIVE\", \"INACTIVE\"]),\n username: z.string().check(z.trim(), z.minLength(1)),\n});\n\nexport const userPropertiesCodec = z.codec(\n userPropertiesInSchema,\n z.extend(\n z.omit(userPropertiesInSchema, {\n email: true,\n firstName: true,\n lastName: true,\n }),\n {\n email: z.nullable(z.string().check(z.email())),\n familyName: z.nullable(z.string().check(z.trim())),\n givenName: z.nullable(z.string().check(z.trim())),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n email: v.email || null,\n familyName: v.lastName || null,\n givenName: v.firstName || null,\n };\n },\n encode(v) {\n const { email, familyName, givenName, ...rest } = v;\n return {\n ...rest,\n email: email || \"\",\n firstName: givenName || \"\",\n lastName: familyName || \"\",\n };\n },\n },\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",