@dremio/js-sdk 0.30.0 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/cloud/Dremio.d.ts +7 -1
  2. package/dist/cloud/Dremio.js +1 -1
  3. package/dist/cloud/Dremio.js.map +1 -1
  4. package/dist/cloud/catalog/EnterpriseCatalogResource.d.ts +25 -0
  5. package/dist/cloud/catalog/EnterpriseCatalogResource.js +71 -0
  6. package/dist/cloud/catalog/EnterpriseCatalogResource.js.map +1 -0
  7. package/dist/cloud/getResourceConfig.d.ts +6 -0
  8. package/dist/cloud/getResourceConfig.js +29 -16
  9. package/dist/cloud/getResourceConfig.js.map +1 -1
  10. package/dist/cloud/index.d.ts +1 -0
  11. package/dist/cloud/index.js +1 -0
  12. package/dist/cloud/index.js.map +1 -1
  13. package/dist/cloud/organizations/Organization.d.ts +3 -3
  14. package/dist/cloud/projects/Project.d.ts +30 -24
  15. package/dist/cloud/projects/Project.js +25 -1
  16. package/dist/cloud/projects/Project.js.map +1 -1
  17. package/dist/cloud/projects/ProjectsResource.d.ts +3 -1
  18. package/dist/cloud/projects/ProjectsResource.js +10 -3
  19. package/dist/cloud/projects/ProjectsResource.js.map +1 -1
  20. package/dist/cloud/projects/projectPropertiesCodec.d.ts +122 -0
  21. package/dist/cloud/projects/projectPropertiesCodec.js +109 -0
  22. package/dist/cloud/projects/projectPropertiesCodec.js.map +1 -0
  23. package/dist/cloud/replaceOriginResource.d.ts +6 -0
  24. package/dist/cloud/replaceOriginResource.js +34 -0
  25. package/dist/cloud/replaceOriginResource.js.map +1 -0
  26. package/dist/common/Config.d.ts +6 -0
  27. package/dist/common/Config.js.map +1 -1
  28. package/dist/common/ConflictResolver.d.ts +1 -0
  29. package/dist/common/ConflictResolver.js +17 -0
  30. package/dist/common/ConflictResolver.js.map +1 -0
  31. package/dist/common/HttpError.js +3 -1
  32. package/dist/common/HttpError.js.map +1 -1
  33. package/dist/common/safeParseResultToResult.d.ts +3 -0
  34. package/dist/common/safeParseResultToResult.js +24 -0
  35. package/dist/common/safeParseResultToResult.js.map +1 -0
  36. package/dist/enterprise/Dremio.d.ts +12 -5
  37. package/dist/enterprise/roles/Role.d.ts +4 -4
  38. package/dist/enterprise/roles/Role.js +2 -2
  39. package/dist/enterprise/roles/Role.js.map +1 -1
  40. package/dist/enterprise/roles/RoleReference.d.ts +10 -0
  41. package/dist/enterprise/roles/RoleReference.js +22 -0
  42. package/dist/enterprise/roles/RoleReference.js.map +1 -0
  43. package/dist/enterprise/roles/RolesResource.d.ts +2 -2
  44. package/dist/enterprise/roles/RolesResource.js +3 -3
  45. package/dist/enterprise/roles/RolesResource.js.map +1 -1
  46. package/dist/enterprise/scripts/EnterpriseScript.d.ts +26 -20
  47. package/dist/enterprise/scripts/EnterpriseScript.js +47 -14
  48. package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
  49. package/dist/enterprise/scripts/EnterpriseScriptsResource.d.ts +4 -2
  50. package/dist/enterprise/scripts/EnterpriseScriptsResource.js +4 -2
  51. package/dist/enterprise/scripts/EnterpriseScriptsResource.js.map +1 -1
  52. package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.d.ts +32 -0
  53. package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.js +51 -0
  54. package/dist/enterprise/scripts/enterpriseScriptPropertiesCodec.js.map +1 -0
  55. package/dist/enterprise/users/EnterpriseUser.d.ts +40 -0
  56. package/dist/enterprise/users/EnterpriseUser.js +23 -0
  57. package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
  58. package/dist/enterprise/users/EnterpriseUsersResource.d.ts +6 -0
  59. package/dist/enterprise/users/EnterpriseUsersResource.js +28 -1
  60. package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
  61. package/dist/oss/Dremio.d.ts +12 -5
  62. package/dist/oss/getResourceConfig.d.ts +12 -5
  63. package/dist/oss/getResourceConfig.js +15 -5
  64. package/dist/oss/getResourceConfig.js.map +1 -1
  65. package/dist/oss/jobs/JobsResource.d.ts +41 -3
  66. package/dist/oss/jobs/JobsResource.js +1 -1
  67. package/dist/oss/jobs/JobsResource.js.map +1 -1
  68. package/dist/oss/jobs/listJobs.d.ts +82 -6
  69. package/dist/oss/jobs/listJobs.js +3 -24
  70. package/dist/oss/jobs/listJobs.js.map +1 -1
  71. package/dist/oss/scripts/Script.d.ts +33 -41
  72. package/dist/oss/scripts/Script.js +35 -42
  73. package/dist/oss/scripts/Script.js.map +1 -1
  74. package/dist/oss/scripts/ScriptLike.d.ts +16 -0
  75. package/dist/oss/scripts/ScriptLike.js +17 -0
  76. package/dist/oss/scripts/ScriptLike.js.map +1 -0
  77. package/dist/oss/scripts/ScriptsResource.d.ts +4 -2
  78. package/dist/oss/scripts/ScriptsResource.js +4 -2
  79. package/dist/oss/scripts/ScriptsResource.js.map +1 -1
  80. package/dist/oss/scripts/scriptPropertiesCodec.d.ts +29 -0
  81. package/dist/oss/scripts/scriptPropertiesCodec.js +78 -0
  82. package/dist/oss/scripts/scriptPropertiesCodec.js.map +1 -0
  83. package/package.json +1 -1
  84. package/dist/cloud/projects/utils.d.ts +0 -2
  85. package/dist/cloud/projects/utils.js +0 -37
  86. package/dist/cloud/projects/utils.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import type { Config } from "../common/Config.ts";
2
- import { EnterpriseCatalogResource } from "../enterprise/catalog/EnterpriseCatalogResource.js";
2
+ import { EnterpriseCatalogResource } from "./catalog/EnterpriseCatalogResource.js";
3
3
  import { RolesResource } from "../enterprise/roles/RolesResource.js";
4
4
  import { EnterpriseScriptsResource } from "../enterprise/scripts/EnterpriseScriptsResource.js";
5
5
  import { SqlResource } from "../oss/sql/SqlResource.js";
@@ -42,10 +42,16 @@ export declare class Dremio {
42
42
  origin: string;
43
43
  request: import("../common/Config.ts").RequestFn;
44
44
  sonarV2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
45
+ sonarV2URL: (path: string) => URL;
45
46
  sonarV3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
47
+ sonarV3URL: (path: string) => URL;
46
48
  sonarV4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
49
+ sonarV4URL: (path: string) => URL;
47
50
  v2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
51
+ v2URL: (path: string) => URL;
48
52
  v3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
53
+ v3URL: (path: string) => URL;
49
54
  v4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
55
+ v4URL: (path: string) => URL;
50
56
  };
51
57
  }
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import moize from "moize";
17
- import { EnterpriseCatalogResource } from "../enterprise/catalog/EnterpriseCatalogResource.js";
17
+ import { EnterpriseCatalogResource } from "./catalog/EnterpriseCatalogResource.js";
18
18
  import { RolesResource } from "../enterprise/roles/RolesResource.js";
19
19
  import { EnterpriseScriptsResource } from "../enterprise/scripts/EnterpriseScriptsResource.js";
20
20
  import { SqlResource } from "../oss/sql/SqlResource.js";
@@ -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,CA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AAE,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\";\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"]}
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,wCAAwC,CAAC;AACnF,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;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C/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 \"./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"]}
@@ -0,0 +1,25 @@
1
+ import type { SonarV3Config } from "../../common/Config.ts";
2
+ import type { SignalParam } from "../../common/Params.ts";
3
+ import { baseRetrieve, baseRetrieveByPath } from "../../enterprise/catalog/catalogRetrieve.js";
4
+ import type { CatalogSearchParams } from "../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts";
5
+ import type { EnterpriseFunctionCatalogReference, EnterpriseHomeCatalogReference, EnterpriseSourceCatalogReference, EnterpriseSpaceCatalogReference } from "../interfaces.ts";
6
+ export declare class EnterpriseCatalogResource {
7
+ #private;
8
+ retrieve: ReturnType<typeof baseRetrieve>;
9
+ retrieveByPath: ReturnType<typeof baseRetrieveByPath>;
10
+ constructor(config: SonarV3Config);
11
+ list(): {
12
+ data(): AsyncGenerator<EnterpriseFunctionCatalogReference | EnterpriseHomeCatalogReference | EnterpriseSourceCatalogReference | EnterpriseSpaceCatalogReference, void, unknown>;
13
+ };
14
+ search(params: CatalogSearchParams): {
15
+ data({ signal }?: SignalParam): AsyncGenerator<import("../interfaces.ts").FolderSearchResult | import("../interfaces.ts").ReflectionSearchResult | import("../interfaces.ts").SourceSearchResult | import("../interfaces.ts").SpaceSearchResult | import("../interfaces.ts").TableSearchResult | import("../interfaces.ts").ViewSearchResult | import("../interfaces.ts").FunctionSearchResult | import("../interfaces.ts").ScriptSearchResult | import("../interfaces.ts").JobSearchResult, void, unknown>;
16
+ getPage: ({ pageParam, signal }?: {
17
+ pageParam?: string;
18
+ } & SignalParam) => import("ts-results-es").AsyncResult<{
19
+ data: (import("../interfaces.ts").FolderSearchResult | import("../interfaces.ts").ReflectionSearchResult | import("../interfaces.ts").SourceSearchResult | import("../interfaces.ts").SpaceSearchResult | import("../interfaces.ts").TableSearchResult | import("../interfaces.ts").ViewSearchResult | import("../interfaces.ts").FunctionSearchResult | import("../interfaces.ts").ScriptSearchResult | import("../interfaces.ts").JobSearchResult)[];
20
+ nextPageToken: string | undefined;
21
+ sessionId: string;
22
+ }, import("../index.ts").HttpError>;
23
+ };
24
+ _catalogReferenceFromEntity(entity: unknown): import("../interfaces.ts").EnterpriseCatalogReference;
25
+ }
@@ -0,0 +1,71 @@
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 { catalogReferenceFromProperties } from "../../enterprise/catalog/catalogReferenceFromProperties.js";
17
+ import { baseRetrieve, baseRetrieveByPath } from "../../enterprise/catalog/catalogRetrieve.js";
18
+ import { createCatalogSearch } from "../../enterprise/catalog/catalogSearch/createCatalogSearch.js";
19
+ import { catalogReferenceEntityToProperties } from "../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.js";
20
+ export class EnterpriseCatalogResource {
21
+ #config;
22
+ #catalogSearch;
23
+ retrieve;
24
+ retrieveByPath;
25
+ constructor(config) {
26
+ this.#config = config;
27
+ this.retrieve = baseRetrieve(config);
28
+ this.retrieveByPath = baseRetrieveByPath(config);
29
+ this.#catalogSearch = createCatalogSearch(this.#config, this._catalogReferenceFromEntity.bind(this));
30
+ }
31
+ list() {
32
+ const getRoot = () => this.#config
33
+ .sonarV3Request("catalog")
34
+ .map((res) => res.json())
35
+ .map((response) => response.data.map((entity) => catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), this.#config, this.retrieveByPath)))
36
+ .promise.then((result) => result.unwrap());
37
+ return {
38
+ async *data() {
39
+ yield* await getRoot();
40
+ },
41
+ };
42
+ }
43
+ search(params) {
44
+ const getPage = ({ pageParam, signal } = {}) => this.#catalogSearch(params, { pageParam, signal });
45
+ return {
46
+ async *data({ signal } = {}) {
47
+ const firstPageResult = await getPage({ signal }).promise;
48
+ if (firstPageResult.isErr()) {
49
+ throw firstPageResult.error;
50
+ }
51
+ const firstPage = firstPageResult.value;
52
+ yield* firstPage.data;
53
+ let nextPageToken = firstPage.nextPageToken;
54
+ while (nextPageToken && !signal?.aborted) {
55
+ const nextPageResult = await getPage({ pageParam: nextPageToken, signal }).promise;
56
+ if (nextPageResult.isErr()) {
57
+ throw nextPageResult.error;
58
+ }
59
+ const nextPage = nextPageResult.value;
60
+ yield* nextPage.data;
61
+ nextPageToken = nextPage.nextPageToken;
62
+ }
63
+ },
64
+ getPage,
65
+ };
66
+ }
67
+ _catalogReferenceFromEntity(entity) {
68
+ return catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), this.#config, this.retrieveByPath);
69
+ }
70
+ }
71
+ //# sourceMappingURL=EnterpriseCatalogResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/cloud/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,iFAAiF,CAAC;AAQrI,MAAM,OAAO,yBAAyB;IACpC,OAAO,CAAgB;IACvB,cAAc,CAAyC;IAEvD,QAAQ,CAAkC;IAC1C,cAAc,CAAwC;IAEtD,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,cAAc,GAAG,mBAAmB,CACvC,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAC5C,CAAC;IACJ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C,OAAO,aAAa,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;oBACzC,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;oBACnF,IAAI,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC;wBAC3B,MAAM,cAAc,CAAC,KAAK,CAAC;oBAC7B,CAAC;oBACD,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC;oBACtC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;oBACrB,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC;gBACzC,CAAC;YACH,CAAC;YACD,OAAO;SACR,CAAC;IACJ,CAAC;IAED,2BAA2B,CAAC,MAAe;QACzC,OAAO,8BAA8B,CACnC,kCAAkC,CAAC,MAAM,CAAC,EAC1C,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,cAAc,CACpB,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 type { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { catalogReferenceFromProperties } from \"../../enterprise/catalog/catalogReferenceFromProperties.ts\";\nimport { baseRetrieve, baseRetrieveByPath } from \"../../enterprise/catalog/catalogRetrieve.js\";\nimport type { CatalogSearchParams } from \"../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts\";\nimport { createCatalogSearch } from \"../../enterprise/catalog/catalogSearch/createCatalogSearch.js\";\nimport { catalogReferenceEntityToProperties } from \"../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.ts\";\nimport type {\n EnterpriseFunctionCatalogReference,\n EnterpriseHomeCatalogReference,\n EnterpriseSourceCatalogReference,\n EnterpriseSpaceCatalogReference,\n} from \"../interfaces.ts\";\n\nexport class EnterpriseCatalogResource {\n #config: SonarV3Config;\n #catalogSearch: ReturnType<typeof createCatalogSearch>;\n\n retrieve: ReturnType<typeof baseRetrieve>;\n retrieveByPath: ReturnType<typeof baseRetrieveByPath>;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n this.retrieve = baseRetrieve(config);\n this.retrieveByPath = baseRetrieveByPath(config);\n this.#catalogSearch = createCatalogSearch(\n this.#config,\n this._catalogReferenceFromEntity.bind(this),\n );\n }\n\n list() {\n const getRoot = () =>\n this.#config\n .sonarV3Request(\"catalog\")\n .map((res) => res.json() as Promise<{ data: unknown[] }>)\n .map((response) =>\n response.data.map(\n (entity: unknown) =>\n catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n ) as\n | EnterpriseFunctionCatalogReference\n | EnterpriseHomeCatalogReference\n | EnterpriseSourceCatalogReference\n | EnterpriseSpaceCatalogReference,\n ),\n )\n .promise.then((result) => result.unwrap());\n return {\n async *data() {\n yield* await getRoot();\n },\n };\n }\n\n search(params: CatalogSearchParams) {\n const getPage = ({ pageParam, signal }: { pageParam?: string } & SignalParam = {}) =>\n this.#catalogSearch(params, { pageParam, signal });\n return {\n async *data({ signal }: SignalParam = {}) {\n const firstPageResult = await getPage({ signal }).promise;\n if (firstPageResult.isErr()) {\n throw firstPageResult.error;\n }\n const firstPage = firstPageResult.value;\n yield* firstPage.data;\n let nextPageToken = firstPage.nextPageToken;\n while (nextPageToken && !signal?.aborted) {\n const nextPageResult = await getPage({ pageParam: nextPageToken, signal }).promise;\n if (nextPageResult.isErr()) {\n throw nextPageResult.error;\n }\n const nextPage = nextPageResult.value;\n yield* nextPage.data;\n nextPageToken = nextPage.nextPageToken;\n }\n },\n getPage,\n };\n }\n\n _catalogReferenceFromEntity(entity: unknown) {\n return catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n );\n }\n}\n"]}
@@ -9,9 +9,15 @@ export declare const getResourceConfig: (config: Config) => (projectId?: string)
9
9
  origin: string;
10
10
  request: import("../common/Config.ts").RequestFn;
11
11
  sonarV2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
12
+ sonarV2URL: (path: string) => URL;
12
13
  sonarV3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
14
+ sonarV3URL: (path: string) => URL;
13
15
  sonarV4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
16
+ sonarV4URL: (path: string) => URL;
14
17
  v2Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
18
+ v2URL: (path: string) => URL;
15
19
  v3Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
20
+ v3URL: (path: string) => URL;
16
21
  v4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
22
+ v4URL: (path: string) => URL;
17
23
  };
@@ -14,8 +14,25 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { createRequest } from "../common/createRequest.js";
17
+ import { _replaceOriginResource } from "./replaceOriginResource.js";
17
18
  export const getResourceConfig = (config) => (projectId) => {
18
19
  const request = createRequest(config);
20
+ const sonarV2URL = (path) => new URL(`/ui/projects/${projectId}/${path}`, _replaceOriginResource("api", "app"));
21
+ const sonarV3URL = (path) => {
22
+ if (!projectId) {
23
+ throw new Error("projectId is required");
24
+ }
25
+ return new URL(`/v0/projects/${projectId}/${path}`, config.origin);
26
+ };
27
+ const sonarV4URL = (path) => {
28
+ if (!projectId) {
29
+ throw new Error("projectId is required");
30
+ }
31
+ return new URL(`/v1/projects/${projectId}/${path}`, config.origin);
32
+ };
33
+ const v2URL = (path) => new URL(`/ui/${path}`, _replaceOriginResource("api", "app"));
34
+ const v3URL = (path) => new URL(`/v0/${path}`, config.origin);
35
+ const v4URL = (path) => new URL(`/v1/${path}`, config.origin);
19
36
  return {
20
37
  logger: config.logger,
21
38
  origin: config.origin,
@@ -24,23 +41,19 @@ export const getResourceConfig = (config) => (projectId) => {
24
41
  if (!projectId) {
25
42
  throw new Error("projectId is required");
26
43
  }
27
- return request(new URL(`/ui/projects/${projectId}/${path}`, config.origin.replace("api", "app")).toString(), init);
28
- },
29
- sonarV3Request: (path, init) => {
30
- if (!projectId) {
31
- throw new Error("projectId is required");
32
- }
33
- return request(`/v0/projects/${projectId}/${path}`, init);
34
- },
35
- sonarV4Request: (path, init) => {
36
- if (!projectId) {
37
- throw new Error("projectId is required");
38
- }
39
- return request(`/v1/projects/${projectId}/${path}`, init);
44
+ return request(sonarV2URL(path).toString(), init);
40
45
  },
41
- v2Request: (path, init) => request(new URL(`/ui/${path}`, config.origin.replace("api", "app")).toString(), init),
42
- v3Request: (path, init) => request(`/v0/${path}`, init),
43
- v4Request: (path, init) => request(`/v1/${path}`, init),
46
+ sonarV2URL,
47
+ sonarV3Request: (path, init) => request(sonarV3URL(path).toString(), init),
48
+ sonarV3URL,
49
+ sonarV4Request: (path, init) => request(sonarV4URL(path).toString(), init),
50
+ sonarV4URL,
51
+ v2Request: (path, init) => request(v2URL(path).toString(), init),
52
+ v2URL,
53
+ v3Request: (path, init) => request(v3URL(path).toString(), init),
54
+ v3URL,
55
+ v4Request: (path, init) => request(v4URL(path).toString(), init),
56
+ v4URL,
44
57
  };
45
58
  };
46
59
  //# sourceMappingURL=getResourceConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;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AAI,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QACvF,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,CAAC;QAC7E,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,CAAC;KAOrE,CAAC;AACb,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V2Config,\n V3Config,\n V4Config,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\n\nexport const getResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(\n new URL(\n `/ui/projects/${projectId}/${path}`,\n config.origin.replace(\"api\", \"app\"),\n ).toString(),\n init,\n );\n },\n sonarV3Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(`/v0/projects/${projectId}/${path}`, init);\n },\n sonarV4Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(`/v1/projects/${projectId}/${path}`, init);\n },\n v2Request: (path: string, init?: RequestInit) =>\n request(new URL(`/ui/${path}`, config.origin.replace(\"api\", \"app\")).toString(), init),\n v3Request: (path: string, init?: RequestInit) => request(`/v0/${path}`, init),\n v4Request: (path: string, init?: RequestInit) => request(`/v1/${path}`, init),\n } satisfies ResourceConfig &\n SonarV2Config &\n SonarV3Config &\n SonarV4Config &\n V2Config &\n V3Config &\n V4Config;\n};\n"]}
1
+ {"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,SAAkB,EAAE,EAAE;IAC1E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAClC,IAAI,GAAG,CAAC,gBAAgB,SAAS,IAAI,IAAI,EAAE,EAAE,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAErF,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE;QAClC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,IAAI,GAAG,CAAC,gBAAgB,SAAS,IAAI,IAAI,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE;QAClC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,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E,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QACtF,KAAK;QACL,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QACtF,KAAK;QACL,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC;QACtF,KAAK;KAOG,CAAC;AACb,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V2Config,\n V3Config,\n V4Config,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\nimport { _replaceOriginResource } from \"./replaceOriginResource.ts\";\n\nexport const getResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n\n const sonarV2URL = (path: string) =>\n new URL(`/ui/projects/${projectId}/${path}`, _replaceOriginResource(\"api\", \"app\"));\n\n const sonarV3URL = (path: string) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return new URL(`/v0/projects/${projectId}/${path}`, config.origin);\n };\n\n const sonarV4URL = (path: string) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return new URL(`/v1/projects/${projectId}/${path}`, config.origin);\n };\n\n const v2URL = (path: string) => new URL(`/ui/${path}`, _replaceOriginResource(\"api\", \"app\"));\n\n const v3URL = (path: string) => new URL(`/v0/${path}`, config.origin);\n\n const v4URL = (path: string) => new URL(`/v1/${path}`, config.origin);\n\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(sonarV2URL(path).toString(), init);\n },\n sonarV2URL,\n sonarV3Request: (path: string, init?: RequestInit) =>\n request(sonarV3URL(path).toString(), init),\n sonarV3URL,\n sonarV4Request: (path: string, init?: RequestInit) =>\n request(sonarV4URL(path).toString(), init),\n sonarV4URL,\n v2Request: (path: string, init?: RequestInit) => request(v2URL(path).toString(), init),\n v2URL,\n v3Request: (path: string, init?: RequestInit) => request(v3URL(path).toString(), init),\n v3URL,\n v4Request: (path: string, init?: RequestInit) => request(v4URL(path).toString(), init),\n v4URL,\n } satisfies ResourceConfig &\n SonarV2Config &\n SonarV3Config &\n SonarV4Config &\n V2Config &\n V3Config &\n V4Config;\n};\n"]}
@@ -3,3 +3,4 @@ export * from "../common/sharedExports.ts";
3
3
  export * from "./credentials/index.ts";
4
4
  export * from "./interfaces.ts";
5
5
  export * from "./oauth/oauth.ts";
6
+ export * from "./replaceOriginResource.ts";
@@ -18,4 +18,5 @@ export * from "../common/sharedExports.js";
18
18
  export * from "./credentials/index.js";
19
19
  export * from "./interfaces.js";
20
20
  export * from "./oauth/oauth.js";
21
+ export * from "./replaceOriginResource.js";
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./Dremio.ts\";\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport * from \"./oauth/oauth.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./Dremio.ts\";\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport * from \"./oauth/oauth.ts\";\nexport * from \"./replaceOriginResource.ts\";\n"]}
@@ -13,8 +13,8 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
13
13
  secretAccessKey: z.ZodMiniString<string>;
14
14
  type: z.ZodMiniEnum<{
15
15
  ACCESS_KEY: "ACCESS_KEY";
16
- AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
17
16
  IAM_ROLE: "IAM_ROLE";
17
+ AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
18
18
  }>;
19
19
  }, z.core.$strip>>;
20
20
  auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -69,8 +69,8 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
69
69
  secretAccessKey: z.ZodMiniString<string>;
70
70
  type: z.ZodMiniEnum<{
71
71
  ACCESS_KEY: "ACCESS_KEY";
72
- AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
73
72
  IAM_ROLE: "IAM_ROLE";
73
+ AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
74
74
  }>;
75
75
  }, z.core.$strip>>;
76
76
  auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -137,8 +137,8 @@ export declare class Organization implements OrganizationProperties {
137
137
  secretAccessKey: z.ZodMiniString<string>;
138
138
  type: z.ZodMiniEnum<{
139
139
  ACCESS_KEY: "ACCESS_KEY";
140
- AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
141
140
  IAM_ROLE: "IAM_ROLE";
141
+ AZURE_ACTIVE_DIRECTORY: "AZURE_ACTIVE_DIRECTORY";
142
142
  }>;
143
143
  }, z.core.$strip>>;
144
144
  auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -1,5 +1,9 @@
1
- import type { Result } from "ts-results-es";
1
+ import { AsyncResult, type Result } from "ts-results-es";
2
2
  import type { ProjectsResource } from "./ProjectsResource.ts";
3
+ import { projectUpdateSchema, type projectPropertiesCodec } from "./projectPropertiesCodec.ts";
4
+ import * as z from "zod/mini";
5
+ import type { V3Config } from "../../common/Config.ts";
6
+ import type { HttpError } from "../../common/HttpError.ts";
3
7
  export declare class Project implements ProjectInterface {
4
8
  #private;
5
9
  readonly cloudId: ProjectInterface["cloudId"];
@@ -17,31 +21,33 @@ export declare class Project implements ProjectInterface {
17
21
  readonly projectStore: ProjectInterface["projectStore"];
18
22
  readonly state: ProjectInterface["state"];
19
23
  readonly type: ProjectInterface["type"];
20
- constructor(properties: ProjectProperties, projectsResource: ProjectsResource);
21
- activate(): Promise<Result<undefined, import("../index.ts").HttpError>>;
22
- delete(): Promise<Result<undefined, import("../index.ts").HttpError>>;
24
+ constructor(config: V3Config, properties: ProjectProperties, projectsResource: ProjectsResource);
25
+ activate(): Promise<Result<undefined, HttpError>>;
26
+ delete(): Promise<Result<undefined, HttpError>>;
27
+ update(properties: z.output<typeof projectUpdateSchema>): AsyncResult<Project, HttpError | z.core.util.SafeParseResult<z.output<typeof projectUpdateSchema>>["error"]>;
23
28
  get settled(): boolean;
29
+ static updateSchema: z.ZodMiniObject<{
30
+ credentials: z.ZodMiniOptional<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
31
+ accessKeyId: z.ZodMiniString<string>;
32
+ secretAccessKey: z.ZodMiniOptional<z.ZodMiniString<string>>;
33
+ type: z.ZodMiniLiteral<"ACCESS_KEY">;
34
+ }, z.core.$strip>, z.ZodMiniObject<{
35
+ externalId: z.ZodMiniString<string>;
36
+ externalIdSignature: z.ZodMiniOptional<z.ZodMiniString<string>>;
37
+ instanceProfileArn: z.ZodMiniOptional<z.ZodMiniString<string>>;
38
+ roleArn: z.ZodMiniString<string>;
39
+ type: z.ZodMiniLiteral<"IAM_ROLE">;
40
+ }, z.core.$strip>, z.ZodMiniObject<{
41
+ accountName: z.ZodMiniString<string>;
42
+ clientId: z.ZodMiniString<string>;
43
+ clientSecret: z.ZodMiniString<string>;
44
+ tenantId: z.ZodMiniString<string>;
45
+ type: z.ZodMiniLiteral<"AZURE_STORAGE_CLIENT_CREDENTIALS">;
46
+ }, z.core.$strip>], "type">>;
47
+ name: z.ZodMiniOptional<z.ZodMiniString<string>>;
48
+ }, z.core.$strip>;
24
49
  }
25
- export type ProjectProperties = {
26
- readonly cloudId: string;
27
- readonly cloudType: "AWS" | "AZURE" | "UNKNOWN";
28
- readonly createdAt: Date;
29
- readonly createdBy: string;
30
- readonly credentials: Record<string, any>;
31
- readonly id: string;
32
- readonly lastStateError: {
33
- error: string;
34
- timestamp: Date;
35
- } | null;
36
- readonly modifiedAt: Date;
37
- readonly modifiedBy: string;
38
- readonly name: string;
39
- readonly numberOfEngines: number;
40
- readonly primaryCatalog: string;
41
- readonly projectStore: string;
42
- readonly state: "ACTIVATING" | "ACTIVE" | "ARCHIVED" | "ARCHIVING" | "CREATING" | "DEACTIVATING" | "INACTIVE" | "RESTORING";
43
- readonly type: "QUERY_ENGINE";
44
- };
50
+ export type ProjectProperties = z.output<typeof projectPropertiesCodec>;
45
51
  export type ProjectMethods = {
46
52
  delete(): Promise<Result<undefined, unknown>>;
47
53
  get settled(): boolean;
@@ -13,7 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { AsyncResult, Err } from "ts-results-es";
17
+ import { projectUpdateSchema } from "./projectPropertiesCodec.js";
18
+ import * as z from "zod/mini";
16
19
  export class Project {
20
+ #config;
17
21
  cloudId;
18
22
  cloudType;
19
23
  createdAt;
@@ -30,7 +34,8 @@ export class Project {
30
34
  state;
31
35
  type;
32
36
  #projectsResource;
33
- constructor(properties, projectsResource) {
37
+ constructor(config, properties, projectsResource) {
38
+ this.#config = config;
34
39
  this.cloudId = properties.cloudId;
35
40
  this.cloudType = properties.cloudType;
36
41
  this.createdAt = properties.createdAt;
@@ -54,8 +59,27 @@ export class Project {
54
59
  delete() {
55
60
  return this.#projectsResource.delete(this.id);
56
61
  }
62
+ update(properties) {
63
+ const parsedProperties = z.safeEncode(projectUpdateSchema, properties);
64
+ if (!parsedProperties.success) {
65
+ return new AsyncResult(Promise.resolve(Err(parsedProperties.error)));
66
+ }
67
+ return this.#config
68
+ .v3Request(`projects/${this.id}`, {
69
+ body: JSON.stringify(parsedProperties.data),
70
+ headers: {
71
+ Accept: "application/json",
72
+ "Content-Type": "application/json",
73
+ },
74
+ keepalive: true,
75
+ method: "PUT",
76
+ })
77
+ .map((res) => res.json())
78
+ .map((entity) => this.#projectsResource._createFromEntity(entity));
79
+ }
57
80
  get settled() {
58
81
  return this.state === "ACTIVE" || this.state === "ARCHIVED" || this.state === "INACTIVE";
59
82
  }
83
+ static updateSchema = projectUpdateSchema;
60
84
  }
61
85
  //# sourceMappingURL=Project.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,OAAO;IACT,OAAO,CAA8B;IACrC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,WAAW,CAAkC;IAC7C,EAAE,CAAyB;IAC3B,cAAc,CAAqC;IACnD,UAAU,CAAiC;IAC3C,UAAU,CAAiC;IAC3C,IAAI,CAA2B;IAC/B,eAAe,CAAsC;IACrD,cAAc,CAAqC;IACnD,YAAY,CAAmC;IAC/C,KAAK,CAA4B;IACjC,IAAI,CAA2B;IAExC,iBAAiB,CAAmB;IAEpC,YAAY,UAA6B,EAAE,gBAAkC;QAC3E,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,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,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;IAC3F,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 { Result } from \"ts-results-es\";\nimport type { ProjectsResource } from \"./ProjectsResource.ts\";\n\nexport class Project implements ProjectInterface {\n readonly cloudId: ProjectInterface[\"cloudId\"];\n readonly cloudType: ProjectInterface[\"cloudType\"];\n readonly createdAt: ProjectInterface[\"createdAt\"];\n readonly createdBy: ProjectInterface[\"createdBy\"];\n readonly credentials: ProjectInterface[\"credentials\"];\n readonly id: ProjectInterface[\"id\"];\n readonly lastStateError: ProjectInterface[\"lastStateError\"];\n readonly modifiedAt: ProjectInterface[\"modifiedAt\"];\n readonly modifiedBy: ProjectInterface[\"modifiedBy\"];\n readonly name: ProjectInterface[\"name\"];\n readonly numberOfEngines: ProjectInterface[\"numberOfEngines\"];\n readonly primaryCatalog: ProjectInterface[\"primaryCatalog\"];\n readonly projectStore: ProjectInterface[\"projectStore\"];\n readonly state: ProjectInterface[\"state\"];\n readonly type: ProjectInterface[\"type\"];\n\n #projectsResource: ProjectsResource;\n\n constructor(properties: ProjectProperties, projectsResource: ProjectsResource) {\n this.cloudId = properties.cloudId;\n this.cloudType = properties.cloudType;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.credentials = properties.credentials;\n this.id = properties.id;\n this.lastStateError = properties.lastStateError;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.numberOfEngines = properties.numberOfEngines;\n this.primaryCatalog = properties.primaryCatalog;\n this.projectStore = properties.projectStore;\n this.state = properties.state;\n this.type = properties.type;\n this.#projectsResource = projectsResource;\n }\n\n activate() {\n return this.#projectsResource.activate(this.id);\n }\n\n delete() {\n return this.#projectsResource.delete(this.id);\n }\n\n get settled() {\n return this.state === \"ACTIVE\" || this.state === \"ARCHIVED\" || this.state === \"INACTIVE\";\n }\n}\n\nexport type ProjectProperties = {\n readonly cloudId: string;\n readonly cloudType: \"AWS\" | \"AZURE\" | \"UNKNOWN\";\n readonly createdAt: Date;\n readonly createdBy: string;\n readonly credentials: Record<string, any>;\n readonly id: string;\n readonly lastStateError: {\n error: string;\n timestamp: Date;\n } | null;\n readonly modifiedAt: Date;\n readonly modifiedBy: string;\n readonly name: string;\n readonly numberOfEngines: number;\n readonly primaryCatalog: string;\n readonly projectStore: string;\n readonly state:\n | \"ACTIVATING\"\n | \"ACTIVE\"\n | \"ARCHIVED\"\n | \"ARCHIVING\"\n | \"CREATING\"\n | \"DEACTIVATING\"\n | \"INACTIVE\"\n | \"RESTORING\";\n readonly type: \"QUERY_ENGINE\";\n};\n\nexport type ProjectMethods = {\n delete(): Promise<Result<undefined, unknown>>;\n get settled(): boolean;\n};\n\nexport type ProjectInterface = ProjectProperties & ProjectMethods;\n"]}
1
+ {"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,GAAG,EAAe,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAA+B,MAAM,6BAA6B,CAAC;AAC/F,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAI9B,MAAM,OAAO,OAAO;IACT,OAAO,CAAW;IAClB,OAAO,CAA8B;IACrC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,WAAW,CAAkC;IAC7C,EAAE,CAAyB;IAC3B,cAAc,CAAqC;IACnD,UAAU,CAAiC;IAC3C,UAAU,CAAiC;IAC3C,IAAI,CAA2B;IAC/B,eAAe,CAAsC;IACrD,cAAc,CAAqC;IACnD,YAAY,CAAmC;IAC/C,KAAK,CAA4B;IACjC,IAAI,CAA2B;IAExC,iBAAiB,CAAmB;IAEpC,YAAY,MAAgB,EAAE,UAA6B,EAAE,gBAAkC;QAC7F,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAA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CAAC,YAAY,IAAI,CAAC,EAAE,EAAE,EAAE;YAChC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAC3C,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,EAAqD,CAAC;aAC3E,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;IAC3F,CAAC;IAED,MAAM,CAAC,YAAY,GAAG,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 { AsyncResult, Err, type Result } from \"ts-results-es\";\nimport type { ProjectsResource } from \"./ProjectsResource.ts\";\nimport { projectUpdateSchema, type projectPropertiesCodec } from \"./projectPropertiesCodec.ts\";\nimport * as z from \"zod/mini\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class Project implements ProjectInterface {\n readonly #config: V3Config;\n readonly cloudId: ProjectInterface[\"cloudId\"];\n readonly cloudType: ProjectInterface[\"cloudType\"];\n readonly createdAt: ProjectInterface[\"createdAt\"];\n readonly createdBy: ProjectInterface[\"createdBy\"];\n readonly credentials: ProjectInterface[\"credentials\"];\n readonly id: ProjectInterface[\"id\"];\n readonly lastStateError: ProjectInterface[\"lastStateError\"];\n readonly modifiedAt: ProjectInterface[\"modifiedAt\"];\n readonly modifiedBy: ProjectInterface[\"modifiedBy\"];\n readonly name: ProjectInterface[\"name\"];\n readonly numberOfEngines: ProjectInterface[\"numberOfEngines\"];\n readonly primaryCatalog: ProjectInterface[\"primaryCatalog\"];\n readonly projectStore: ProjectInterface[\"projectStore\"];\n readonly state: ProjectInterface[\"state\"];\n readonly type: ProjectInterface[\"type\"];\n\n #projectsResource: ProjectsResource;\n\n constructor(config: V3Config, properties: ProjectProperties, projectsResource: ProjectsResource) {\n this.#config = config;\n this.cloudId = properties.cloudId;\n this.cloudType = properties.cloudType;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.credentials = properties.credentials;\n this.id = properties.id;\n this.lastStateError = properties.lastStateError;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.numberOfEngines = properties.numberOfEngines;\n this.primaryCatalog = properties.primaryCatalog;\n this.projectStore = properties.projectStore;\n this.state = properties.state;\n this.type = properties.type;\n this.#projectsResource = projectsResource;\n }\n\n activate() {\n return this.#projectsResource.activate(this.id);\n }\n\n delete() {\n return this.#projectsResource.delete(this.id);\n }\n\n update(\n properties: z.output<typeof projectUpdateSchema>,\n ): AsyncResult<\n Project,\n HttpError | z.core.util.SafeParseResult<z.output<typeof projectUpdateSchema>>[\"error\"]\n > {\n const parsedProperties = z.safeEncode(projectUpdateSchema, properties);\n if (!parsedProperties.success) {\n return new AsyncResult(Promise.resolve(Err(parsedProperties.error)));\n }\n return this.#config\n .v3Request(`projects/${this.id}`, {\n body: JSON.stringify(parsedProperties.data),\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 projectPropertiesCodec>>)\n .map((entity) => this.#projectsResource._createFromEntity(entity));\n }\n\n get settled() {\n return this.state === \"ACTIVE\" || this.state === \"ARCHIVED\" || this.state === \"INACTIVE\";\n }\n\n static updateSchema = projectUpdateSchema;\n}\n\nexport type ProjectProperties = z.output<typeof projectPropertiesCodec>;\n\nexport type ProjectMethods = {\n delete(): Promise<Result<undefined, unknown>>;\n get settled(): boolean;\n};\n\nexport type ProjectInterface = ProjectProperties & ProjectMethods;\n"]}
@@ -1,10 +1,12 @@
1
1
  import type { ResourceConfig, V3Config } from "../../common/Config.ts";
2
2
  import { Project } from "./Project.ts";
3
3
  import type { SignalParam } from "../../common/Params.ts";
4
+ import * as z from "zod/mini";
5
+ import { projectPropertiesCodec } from "./projectPropertiesCodec.js";
4
6
  export declare class ProjectsResource {
5
7
  #private;
6
8
  constructor(config: ResourceConfig & V3Config);
7
- _createFromEntity(properties: unknown): Project;
9
+ _createFromEntity(entity: z.input<typeof projectPropertiesCodec>): Project;
8
10
  activate(id: string): Promise<import("ts-results-es").Result<undefined, import("../index.ts").HttpError>>;
9
11
  delete(id: string): Promise<import("ts-results-es").Result<undefined, import("../index.ts").HttpError>>;
10
12
  list(): {
@@ -14,16 +14,23 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Project } from "./Project.js";
17
- import { projectEntityToProperties } from "./utils.js";
18
17
  import { fromAbortable } from "../../common/fromAbortable.js";
19
18
  import { share, switchMap, timer } from "rxjs";
19
+ import * as z from "zod/mini";
20
+ import { projectPropertiesCodec } from "./projectPropertiesCodec.js";
20
21
  export class ProjectsResource {
21
22
  #config;
22
23
  constructor(config) {
23
24
  this.#config = config;
24
25
  }
25
- _createFromEntity(properties) {
26
- return new Project(projectEntityToProperties(properties), this);
26
+ _createFromEntity(entity) {
27
+ try {
28
+ return new Project(this.#config, z.decode(projectPropertiesCodec, entity), this);
29
+ }
30
+ catch (e) {
31
+ this.#config.logger?.error(entity, "failed to parse");
32
+ throw e;
33
+ }
27
34
  }
28
35
  activate(id) {
29
36
  return this.#config
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectsResource.js","sourceRoot":"","sources":["../../../src/cloud/projects/ProjectsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE/C,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,UAAmB;QACnC,OAAO,IAAI,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,EAAE,WAAW,EAAE;YACpC,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;aAClE,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,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C,CAAC,OAAO,CAAC;IAC7D,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, V3Config } from \"../../common/Config.ts\";\nimport { Project } from \"./Project.ts\";\nimport { projectEntityToProperties } from \"./utils.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport { share, switchMap, timer } from \"rxjs\";\n\nexport class ProjectsResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n _createFromEntity(properties: unknown) {\n return new Project(projectEntityToProperties(properties), this);\n }\n\n activate(id: string) {\n return this.#config\n .v3Request(`projects/${id}/activate`, {\n keepalive: true,\n method: \"PUT\",\n })\n .map(() => undefined).promise;\n }\n\n delete(id: string) {\n return this.#config\n .v3Request(`projects/${id}`, { keepalive: true, method: \"DELETE\" })\n .map(() => undefined).promise;\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"projects\", { signal })\n .map((res) => res.json() as Promise<unknown[]>)\n .map((projects) => projects.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n observe(id: string) {\n return timer(0, 5000).pipe(\n switchMap(() =>\n fromAbortable(({ signal }) =>\n this.retrieve(id, { signal }).then((result) => result.unwrap()),\n ),\n ),\n share(),\n );\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`projects/${id}`, { signal })\n .map((res) => res.json())\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}
1
+ {"version":3,"file":"ProjectsResource.js","sourceRoot":"","sources":["../../../src/cloud/projects/ProjectsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,MAA8C;QAC9D,IAAI,CAAC;YACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;QACnF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;YACtD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,EAAE,WAAW,EAAE;YACpC,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,YAAY,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SAAS,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACvC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAqD,CAAC;aAC3E,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,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, V3Config } from \"../../common/Config.ts\";\nimport { Project } from \"./Project.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport { share, switchMap, timer } from \"rxjs\";\nimport * as z from \"zod/mini\";\nimport { projectPropertiesCodec } from \"./projectPropertiesCodec.js\";\nexport class ProjectsResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n _createFromEntity(entity: z.input<typeof projectPropertiesCodec>) {\n try {\n return new Project(this.#config, z.decode(projectPropertiesCodec, entity), this);\n } catch (e) {\n this.#config.logger?.error(entity, \"failed to parse\");\n throw e;\n }\n }\n\n activate(id: string) {\n return this.#config\n .v3Request(`projects/${id}/activate`, {\n keepalive: true,\n method: \"PUT\",\n })\n .map(() => undefined).promise;\n }\n\n delete(id: string) {\n return this.#config\n .v3Request(`projects/${id}`, { keepalive: true, method: \"DELETE\" })\n .map(() => undefined).promise;\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .v3Request(\"projects\", { signal })\n .map((res) => res.json() as Promise<z.input<typeof projectPropertiesCodec>[]>)\n .map((projects) => projects.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n observe(id: string) {\n return timer(0, 5000).pipe(\n switchMap(() =>\n fromAbortable(({ signal }) =>\n this.retrieve(id, { signal }).then((result) => result.unwrap()),\n ),\n ),\n share(),\n );\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`projects/${id}`, { signal })\n .map((res) => res.json() as Promise<z.input<typeof projectPropertiesCodec>>)\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}