@dremio/js-sdk 0.9.0 → 0.11.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.
Files changed (167) hide show
  1. package/dist/cloud/ai/AiResource.d.ts +3 -15
  2. package/dist/cloud/ai/AiResource.js +11 -14
  3. package/dist/cloud/ai/AiResource.js.map +1 -1
  4. package/dist/cloud/arctic/ArcticResource.d.ts +8 -7
  5. package/dist/cloud/arctic/ArcticResource.js +27 -20
  6. package/dist/cloud/arctic/ArcticResource.js.map +1 -1
  7. package/dist/cloud/engines/Engine.d.ts +2 -3
  8. package/dist/cloud/engines/Engine.js +5 -6
  9. package/dist/cloud/engines/Engine.js.map +1 -1
  10. package/dist/cloud/engines/EnginesResource.d.ts +8 -11
  11. package/dist/cloud/engines/EnginesResource.js +25 -23
  12. package/dist/cloud/engines/EnginesResource.js.map +1 -1
  13. package/dist/cloud/index.d.ts +33 -214
  14. package/dist/cloud/index.js +0 -1
  15. package/dist/cloud/index.js.map +1 -1
  16. package/dist/cloud/oauth/OAuthApplication.d.ts +1 -2
  17. package/dist/cloud/oauth/OAuthApplication.js +1 -3
  18. package/dist/cloud/oauth/OAuthApplication.js.map +1 -1
  19. package/dist/cloud/oauth/OAuthApplicationsResource.d.ts +9 -8
  20. package/dist/cloud/oauth/OAuthApplicationsResource.js +35 -31
  21. package/dist/cloud/oauth/OAuthApplicationsResource.js.map +1 -1
  22. package/dist/cloud/projects/Project.d.ts +4 -4
  23. package/dist/cloud/projects/Project.js +5 -5
  24. package/dist/cloud/projects/Project.js.map +1 -1
  25. package/dist/cloud/projects/ProjectsResource.d.ts +11 -13
  26. package/dist/cloud/projects/ProjectsResource.js +42 -30
  27. package/dist/cloud/projects/ProjectsResource.js.map +1 -1
  28. package/dist/cloud/resources.d.ts +39 -209
  29. package/dist/cloud/resources.js +9 -9
  30. package/dist/cloud/resources.js.map +1 -1
  31. package/dist/cloud/users/CloudUsersResource.d.ts +8 -11
  32. package/dist/cloud/users/CloudUsersResource.js +19 -18
  33. package/dist/cloud/users/CloudUsersResource.js.map +1 -1
  34. package/dist/common/Config.d.ts +4 -2
  35. package/dist/common/Config.js.map +1 -1
  36. package/dist/common/HttpError.d.ts +7 -13
  37. package/dist/common/HttpError.js +19 -34
  38. package/dist/common/HttpError.js.map +1 -1
  39. package/dist/common/Problem.d.ts +29 -34
  40. package/dist/common/Problem.js +47 -19
  41. package/dist/common/Problem.js.map +1 -1
  42. package/dist/common/Query.js +1 -2
  43. package/dist/common/Query.js.map +1 -1
  44. package/dist/common/createRequest.js +8 -33
  45. package/dist/common/createRequest.js.map +1 -1
  46. package/dist/common/problems.d.ts +11 -9
  47. package/dist/common/problems.js +18 -9
  48. package/dist/common/problems.js.map +1 -1
  49. package/dist/enterprise/catalog/CatalogObjects/index.d.ts +1 -2
  50. package/dist/enterprise/catalog/CatalogObjects/index.js.map +1 -1
  51. package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.d.ts +2 -3
  52. package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.js +3 -5
  53. package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.js.map +1 -1
  54. package/dist/enterprise/catalog/EnterpriseCatalogResource.d.ts +9 -6
  55. package/dist/enterprise/catalog/EnterpriseCatalogResource.js +25 -19
  56. package/dist/enterprise/catalog/EnterpriseCatalogResource.js.map +1 -1
  57. package/dist/enterprise/catalog/catalogObjectFromEntity.js +0 -8
  58. package/dist/enterprise/catalog/catalogObjectFromEntity.js.map +1 -1
  59. package/dist/enterprise/catalog/catalogRetrieve.js +4 -0
  60. package/dist/enterprise/catalog/catalogRetrieve.js.map +1 -1
  61. package/dist/enterprise/credentials/exchangePat.d.ts +2 -4
  62. package/dist/enterprise/credentials/exchangePat.js +3 -3
  63. package/dist/enterprise/credentials/exchangePat.js.map +1 -1
  64. package/dist/enterprise/engines/Engine.d.ts +3 -5
  65. package/dist/enterprise/engines/Engine.js +7 -11
  66. package/dist/enterprise/engines/Engine.js.map +1 -1
  67. package/dist/enterprise/engines/EnginesResource.d.ts +2 -4
  68. package/dist/enterprise/engines/EnginesResource.js +4 -6
  69. package/dist/enterprise/engines/EnginesResource.js.map +1 -1
  70. package/dist/enterprise/index.d.ts +12 -45
  71. package/dist/enterprise/index.js +0 -1
  72. package/dist/enterprise/index.js.map +1 -1
  73. package/dist/enterprise/resources.d.ts +10 -36
  74. package/dist/enterprise/resources.js +5 -5
  75. package/dist/enterprise/resources.js.map +1 -1
  76. package/dist/enterprise/roles/RolesResource.d.ts +6 -5
  77. package/dist/enterprise/roles/RolesResource.js +16 -13
  78. package/dist/enterprise/roles/RolesResource.js.map +1 -1
  79. package/dist/enterprise/scripts/EnterpriseScript.d.ts +4 -14
  80. package/dist/enterprise/scripts/EnterpriseScript.js +4 -6
  81. package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
  82. package/dist/enterprise/scripts/EnterpriseScriptsResource.d.ts +13 -7
  83. package/dist/enterprise/scripts/EnterpriseScriptsResource.js +24 -55
  84. package/dist/enterprise/scripts/EnterpriseScriptsResource.js.map +1 -1
  85. package/dist/enterprise/users/EnterpriseUser.d.ts +8 -5
  86. package/dist/enterprise/users/EnterpriseUser.js +3 -5
  87. package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
  88. package/dist/enterprise/users/EnterpriseUsersResource.d.ts +9 -10
  89. package/dist/enterprise/users/EnterpriseUsersResource.js +20 -14
  90. package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
  91. package/dist/oss/catalog/CatalogObjects/index.d.ts +2 -3
  92. package/dist/oss/catalog/CatalogObjects/index.js.map +1 -1
  93. package/dist/oss/catalog/CatalogObjects/utils/catalogObjectFromEntity.d.ts +1 -2
  94. package/dist/oss/catalog/CatalogObjects/utils/catalogObjectFromEntity.js +0 -8
  95. package/dist/oss/catalog/CatalogObjects/utils/catalogObjectFromEntity.js.map +1 -1
  96. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.d.ts +1 -1
  97. package/dist/oss/catalog/CatalogReferences/FolderCatalogReference.d.ts +1 -1
  98. package/dist/oss/catalog/CatalogReferences/HomeCatalogReference.d.ts +1 -1
  99. package/dist/oss/catalog/CatalogReferences/SourceCatalogReference.d.ts +1 -1
  100. package/dist/oss/catalog/CatalogReferences/SourceCatalogReference.js +4 -4
  101. package/dist/oss/catalog/CatalogReferences/SourceCatalogReference.js.map +1 -1
  102. package/dist/oss/catalog/CatalogReferences/SpaceCatalogReference.d.ts +1 -1
  103. package/dist/oss/catalog/CatalogReferences/utils/catalogChildren.js +1 -0
  104. package/dist/oss/catalog/CatalogReferences/utils/catalogChildren.js.map +1 -1
  105. package/dist/oss/catalog/CatalogReferences/utils/getTags.d.ts +1 -2
  106. package/dist/oss/catalog/CatalogReferences/utils/getTags.js +2 -4
  107. package/dist/oss/catalog/CatalogReferences/utils/getTags.js.map +1 -1
  108. package/dist/oss/catalog/CatalogReferences/utils/getWiki.d.ts +1 -2
  109. package/dist/oss/catalog/CatalogReferences/utils/getWiki.js +2 -4
  110. package/dist/oss/catalog/CatalogReferences/utils/getWiki.js.map +1 -1
  111. package/dist/oss/catalog/CatalogResource.d.ts +9 -6
  112. package/dist/oss/catalog/CatalogResource.js +25 -19
  113. package/dist/oss/catalog/CatalogResource.js.map +1 -1
  114. package/dist/oss/catalog/CatalogTags.d.ts +2 -6
  115. package/dist/oss/catalog/CatalogTags.js +8 -13
  116. package/dist/oss/catalog/CatalogTags.js.map +1 -1
  117. package/dist/oss/catalog/CatalogWiki.d.ts +2 -6
  118. package/dist/oss/catalog/CatalogWiki.js +8 -13
  119. package/dist/oss/catalog/CatalogWiki.js.map +1 -1
  120. package/dist/oss/catalog/VersionReference.d.ts +12 -12
  121. package/dist/oss/catalog/VersionReference.js +18 -3
  122. package/dist/oss/catalog/VersionReference.js.map +1 -1
  123. package/dist/oss/catalog/catalogErrors.d.ts +3 -14
  124. package/dist/oss/catalog/catalogErrors.js +9 -12
  125. package/dist/oss/catalog/catalogErrors.js.map +1 -1
  126. package/dist/oss/catalog/catalogRetrieve.d.ts +3 -2
  127. package/dist/oss/catalog/catalogRetrieve.js +6 -2
  128. package/dist/oss/catalog/catalogRetrieve.js.map +1 -1
  129. package/dist/oss/index.d.ts +8 -39
  130. package/dist/oss/index.js +0 -1
  131. package/dist/oss/index.js.map +1 -1
  132. package/dist/oss/interfaces.d.ts +2 -2
  133. package/dist/oss/interfaces.js +1 -0
  134. package/dist/oss/interfaces.js.map +1 -1
  135. package/dist/oss/jobs/Job.d.ts +5 -45
  136. package/dist/oss/jobs/Job.js +7 -27
  137. package/dist/oss/jobs/Job.js.map +1 -1
  138. package/dist/oss/jobs/JobsResource.d.ts +11 -8
  139. package/dist/oss/jobs/JobsResource.js +52 -46
  140. package/dist/oss/jobs/JobsResource.js.map +1 -1
  141. package/dist/oss/jobs/utils/jobEntityToProperties.d.ts +40 -0
  142. package/dist/oss/jobs/utils/jobEntityToProperties.js +34 -0
  143. package/dist/oss/jobs/utils/jobEntityToProperties.js.map +1 -0
  144. package/dist/oss/resources.d.ts +8 -36
  145. package/dist/oss/resources.js +4 -8
  146. package/dist/oss/resources.js.map +1 -1
  147. package/dist/oss/scripts/Script.d.ts +3 -22
  148. package/dist/oss/scripts/Script.js +12 -16
  149. package/dist/oss/scripts/Script.js.map +1 -1
  150. package/dist/oss/scripts/ScriptErrors.d.ts +6 -18
  151. package/dist/oss/scripts/ScriptErrors.js +10 -13
  152. package/dist/oss/scripts/ScriptErrors.js.map +1 -1
  153. package/dist/oss/scripts/ScriptsResource.d.ts +24 -7
  154. package/dist/oss/scripts/ScriptsResource.js +57 -51
  155. package/dist/oss/scripts/ScriptsResource.js.map +1 -1
  156. package/dist/oss/users/User.d.ts +9 -10
  157. package/dist/oss/users/User.js.map +1 -1
  158. package/dist/oss/users/UsersResource.d.ts +9 -10
  159. package/dist/oss/users/UsersResource.js +19 -13
  160. package/dist/oss/users/UsersResource.js.map +1 -1
  161. package/package.json +11 -13
  162. package/dist/cloud/projects/projectApiMethods.d.ts +0 -9
  163. package/dist/cloud/projects/projectApiMethods.js +0 -43
  164. package/dist/cloud/projects/projectApiMethods.js.map +0 -1
  165. package/dist/oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.d.ts +0 -31
  166. package/dist/oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.js +0 -58
  167. package/dist/oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.js.map +0 -1
@@ -1,4 +1,3 @@
1
- import type { VersionedDatasetCatalogObject } from "../../../oss/interfaces.ts";
2
1
  import type { EnterpriseDatasetCatalogObject } from "./EnterpriseDatasetCatalogObject.ts";
3
2
  import type { EnterpriseFileCatalogObject } from "./EnterpriseFileCatalogObject.ts";
4
3
  import type { EnterpriseFolderCatalogObject } from "./EnterpriseFolderCatalogObject.ts";
@@ -7,4 +6,4 @@ import type { EnterpriseHomeCatalogObject } from "./EnterpriseHomeCatalogObject.
7
6
  import type { EnterpriseSourceCatalogObject } from "./EnterpriseSourceCatalogObject.ts";
8
7
  import type { EnterpriseSpaceCatalogObject } from "./EnterpriseSpaceCatalogObject.ts";
9
8
  export type { EnterpriseDatasetCatalogObject, EnterpriseFileCatalogObject, EnterpriseFolderCatalogObject, EnterpriseFunctionCatalogObject, EnterpriseHomeCatalogObject, EnterpriseSourceCatalogObject, EnterpriseSpaceCatalogObject, };
10
- export type EnterpriseCatalogObject = EnterpriseDatasetCatalogObject | EnterpriseFileCatalogObject | EnterpriseFolderCatalogObject | EnterpriseFunctionCatalogObject | EnterpriseHomeCatalogObject | EnterpriseSourceCatalogObject | EnterpriseSpaceCatalogObject | VersionedDatasetCatalogObject;
9
+ export type EnterpriseCatalogObject = EnterpriseDatasetCatalogObject | EnterpriseFileCatalogObject | EnterpriseFolderCatalogObject | EnterpriseFunctionCatalogObject | EnterpriseHomeCatalogObject | EnterpriseSourceCatalogObject | EnterpriseSpaceCatalogObject;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/enterprise/catalog/CatalogObjects/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { VersionedDatasetCatalogObject } from \"../../../oss/interfaces.ts\";\nimport type { EnterpriseDatasetCatalogObject } from \"./EnterpriseDatasetCatalogObject.ts\";\nimport type { EnterpriseFileCatalogObject } from \"./EnterpriseFileCatalogObject.ts\";\nimport type { EnterpriseFolderCatalogObject } from \"./EnterpriseFolderCatalogObject.ts\";\nimport type { EnterpriseFunctionCatalogObject } from \"./EnterpriseFunctionCatalogObject.ts\";\nimport type { EnterpriseHomeCatalogObject } from \"./EnterpriseHomeCatalogObject.ts\";\nimport type { EnterpriseSourceCatalogObject } from \"./EnterpriseSourceCatalogObject.ts\";\nimport type { EnterpriseSpaceCatalogObject } from \"./EnterpriseSpaceCatalogObject.ts\";\n\nexport type {\n EnterpriseDatasetCatalogObject,\n EnterpriseFileCatalogObject,\n EnterpriseFolderCatalogObject,\n EnterpriseFunctionCatalogObject,\n EnterpriseHomeCatalogObject,\n EnterpriseSourceCatalogObject,\n EnterpriseSpaceCatalogObject,\n};\n\nexport type EnterpriseCatalogObject =\n | EnterpriseDatasetCatalogObject\n | EnterpriseFileCatalogObject\n | EnterpriseFolderCatalogObject\n | EnterpriseFunctionCatalogObject\n | EnterpriseHomeCatalogObject\n | EnterpriseSourceCatalogObject\n | EnterpriseSpaceCatalogObject\n | VersionedDatasetCatalogObject;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/enterprise/catalog/CatalogObjects/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { EnterpriseDatasetCatalogObject } from \"./EnterpriseDatasetCatalogObject.ts\";\nimport type { EnterpriseFileCatalogObject } from \"./EnterpriseFileCatalogObject.ts\";\nimport type { EnterpriseFolderCatalogObject } from \"./EnterpriseFolderCatalogObject.ts\";\nimport type { EnterpriseFunctionCatalogObject } from \"./EnterpriseFunctionCatalogObject.ts\";\nimport type { EnterpriseHomeCatalogObject } from \"./EnterpriseHomeCatalogObject.ts\";\nimport type { EnterpriseSourceCatalogObject } from \"./EnterpriseSourceCatalogObject.ts\";\nimport type { EnterpriseSpaceCatalogObject } from \"./EnterpriseSpaceCatalogObject.ts\";\n\nexport type {\n EnterpriseDatasetCatalogObject,\n EnterpriseFileCatalogObject,\n EnterpriseFolderCatalogObject,\n EnterpriseFunctionCatalogObject,\n EnterpriseHomeCatalogObject,\n EnterpriseSourceCatalogObject,\n EnterpriseSpaceCatalogObject,\n};\n\nexport type EnterpriseCatalogObject =\n | EnterpriseDatasetCatalogObject\n | EnterpriseFileCatalogObject\n | EnterpriseFolderCatalogObject\n | EnterpriseFunctionCatalogObject\n | EnterpriseHomeCatalogObject\n | EnterpriseSourceCatalogObject\n | EnterpriseSpaceCatalogObject;\n"]}
@@ -1,4 +1,3 @@
1
- import { Err, Ok } from "ts-results-es";
2
1
  import type { SonarV3Config } from "../../../common/Config.ts";
3
2
  import type { Grantee } from "../../Grantee.ts";
4
3
  import type { CatalogReference } from "../../../oss/catalog/CatalogReferences/index.ts";
@@ -9,7 +8,7 @@ export type CatalogGrants<A extends string> = {
9
8
  privileges: A[];
10
9
  }[];
11
10
  };
12
- export declare const retrieveCatalogGrants: (config: SonarV3Config) => (catalogReference: CatalogReference) => Promise<Err<any> | Ok<{
11
+ export declare const retrieveCatalogGrants: (config: SonarV3Config) => (catalogReference: CatalogReference) => Promise<import("ts-results-es").Result<{
13
12
  availablePrivileges: any;
14
13
  grants: any;
15
- }>>;
14
+ }, import("../../index.ts").HttpError>>;
@@ -13,18 +13,16 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Err, Ok } from "ts-results-es";
17
16
  export const retrieveCatalogGrants = (config) => (catalogReference) => {
18
17
  return config
19
18
  .sonarV3Request(`catalog/${catalogReference.id}/grants`)
20
- .then((res) => res.json())
21
- .then((entity) => Ok({
19
+ .map((res) => res.json())
20
+ .map((entity) => ({
22
21
  availablePrivileges: entity.availablePrivileges,
23
22
  grants: entity.grants.map((grantEntity) => ({
24
23
  grantee: { id: grantEntity.id, type: grantEntity.granteeType },
25
24
  privileges: grantEntity.privileges,
26
25
  })),
27
- }))
28
- .catch((e) => Err(e));
26
+ })).promise;
29
27
  };
30
28
  //# sourceMappingURL=retrieveCatalogGrants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrieveCatalogGrants.js","sourceRoot":"","sources":["../../../../src/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAaxC,MAAM,CAAC,MAAM,qBAAqB,GAChC,CAAC,MAAqB,EAAE,EAAE,CAAC,CAAC,gBAAkC,EAAE,EAAE;IAChE,OAAO,MAAM;SACV,cAAc,CAAC,WAAW,gBAAgB,CAAC,EAAE,SAAS,CAAC;SACvD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CACf,EAAE,CAAC;QACD,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;QAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,WAAgB,EAAE,EAAE,CAAC,CAAC;YAC/C,OAAO,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,WAAW,EAAE;YAC9D,UAAU,EAAE,WAAW,CAAC,UAAU;SACnC,CAAC,CAAC;KAC4B,CAAC,CACnC;SACA,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B,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 { Err, Ok } from \"ts-results-es\";\nimport type { SonarV3Config } from \"../../../common/Config.ts\";\nimport type { Grantee } from \"../../Grantee.ts\";\nimport type { CatalogReference } from \"../../../oss/catalog/CatalogReferences/index.ts\";\n\nexport type CatalogGrants<A extends string> = {\n availablePrivileges: A[];\n grants: {\n grantee: Grantee;\n privileges: A[];\n }[];\n};\n\nexport const retrieveCatalogGrants =\n (config: SonarV3Config) => (catalogReference: CatalogReference) => {\n return config\n .sonarV3Request(`catalog/${catalogReference.id}/grants`)\n .then((res) => res.json())\n .then((entity) =>\n Ok({\n availablePrivileges: entity.availablePrivileges,\n grants: entity.grants.map((grantEntity: any) => ({\n grantee: { id: grantEntity.id, type: grantEntity.granteeType },\n privileges: grantEntity.privileges,\n })),\n } satisfies CatalogGrants<string>),\n )\n .catch((e) => Err(e));\n };\n"]}
1
+ {"version":3,"file":"retrieveCatalogGrants.js","sourceRoot":"","sources":["../../../../src/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,MAAM,CAAC,MAAM,qBAAqB,GAChC,CAAC,MAAqB,EAAE,EAAE,CAAC,CAAC,gBAAkC,EAAE,EAAE;IAChE,OAAO,MAAM;SACV,cAAc,CAAC,WAAW,gBAAgB,CAAC,EAAE,SAAS,CAAC;SACvD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACxB,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CACT,CAAC;QACC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;QAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,WAAgB,EAAE,EAAE,CAAC,CAAC;YAC/C,OAAO,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,WAAW,EAAE;YAC9D,UAAU,EAAE,WAAW,CAAC,UAAU;SACnC,CAAC,CAAC;KACJ,CAAiC,CACrC,CAAC,OAAO,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV3Config } from \"../../../common/Config.ts\";\nimport type { Grantee } from \"../../Grantee.ts\";\nimport type { CatalogReference } from \"../../../oss/catalog/CatalogReferences/index.ts\";\n\nexport type CatalogGrants<A extends string> = {\n availablePrivileges: A[];\n grants: {\n grantee: Grantee;\n privileges: A[];\n }[];\n};\n\nexport const retrieveCatalogGrants =\n (config: SonarV3Config) => (catalogReference: CatalogReference) => {\n return config\n .sonarV3Request(`catalog/${catalogReference.id}/grants`)\n .map((res) => res.json())\n .map(\n (entity) =>\n ({\n availablePrivileges: entity.availablePrivileges,\n grants: entity.grants.map((grantEntity: any) => ({\n grantee: { id: grantEntity.id, type: grantEntity.granteeType },\n privileges: grantEntity.privileges,\n })),\n }) satisfies CatalogGrants<string>,\n ).promise;\n };\n"]}
@@ -1,10 +1,13 @@
1
1
  import type { SonarV3Config } from "../../common/Config.ts";
2
2
  import type { EnterpriseFunctionCatalogReference, EnterpriseHomeCatalogReference, EnterpriseSourceCatalogReference, EnterpriseSpaceCatalogReference } from "./CatalogReferences/index.ts";
3
- export declare const EnterpriseCatalogResource: (config: SonarV3Config) => {
4
- _catalogReferenceFromEntity: (entity: unknown) => import("./CatalogReferences/index.ts").EnterpriseCatalogReference;
5
- list: () => {
3
+ import { baseRetrieve, baseRetrieveByPath } from "./catalogRetrieve.ts";
4
+ export declare class EnterpriseCatalogResource {
5
+ #private;
6
+ retrieve: ReturnType<typeof baseRetrieve>;
7
+ retrieveByPath: ReturnType<typeof baseRetrieveByPath>;
8
+ constructor(config: SonarV3Config);
9
+ list(): {
6
10
  data(): AsyncGenerator<EnterpriseFunctionCatalogReference | EnterpriseHomeCatalogReference | EnterpriseSourceCatalogReference | EnterpriseSpaceCatalogReference, void, unknown>;
7
11
  };
8
- retrieve: (key: string) => Promise<import("ts-results-es").Result<import("./CatalogObjects/index.ts").EnterpriseCatalogObject, unknown>>;
9
- retrieveByPath: (key: string[]) => Promise<import("ts-results-es").Result<import("./CatalogObjects/index.ts").EnterpriseCatalogObject, unknown>>;
10
- };
12
+ _catalogReferenceFromEntity(entity: unknown): import("./CatalogReferences/index.ts").EnterpriseCatalogReference;
13
+ }
@@ -16,23 +16,29 @@
16
16
  import { catalogReferenceEntityToProperties } from "../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.js";
17
17
  import { catalogReferenceFromProperties } from "./catalogReferenceFromProperties.js";
18
18
  import { baseRetrieve, baseRetrieveByPath } from "./catalogRetrieve.js";
19
- export const EnterpriseCatalogResource = (config) => {
20
- const retrieve = baseRetrieve(config);
21
- const retrieveByPath = baseRetrieveByPath(config);
22
- return {
23
- _catalogReferenceFromEntity: (entity) => catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), config, retrieveByPath),
24
- list: () => {
25
- return {
26
- async *data() {
27
- yield* await config
28
- .sonarV3Request("catalog")
29
- .then((res) => res.json())
30
- .then((response) => response.data.map((entity) => catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), config, retrieveByPath)));
31
- },
32
- };
33
- },
34
- retrieve,
35
- retrieveByPath,
36
- };
37
- };
19
+ export class EnterpriseCatalogResource {
20
+ #config;
21
+ retrieve;
22
+ retrieveByPath;
23
+ constructor(config) {
24
+ this.#config = config;
25
+ this.retrieve = baseRetrieve(config);
26
+ this.retrieveByPath = baseRetrieveByPath(config);
27
+ }
28
+ list() {
29
+ const getRoot = () => this.#config
30
+ .sonarV3Request("catalog")
31
+ .map((res) => res.json())
32
+ .map((response) => response.data.map((entity) => catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), this.#config, this.retrieveByPath)))
33
+ .promise.then((result) => result.unwrap());
34
+ return {
35
+ async *data() {
36
+ yield* await getRoot();
37
+ },
38
+ };
39
+ }
40
+ _catalogReferenceFromEntity(entity) {
41
+ return catalogReferenceFromProperties(catalogReferenceEntityToProperties(entity), this.#config, this.retrieveByPath);
42
+ }
43
+ }
38
44
  //# sourceMappingURL=EnterpriseCatalogResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/enterprise/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,kCAAkC,EAAE,MAAM,iFAAiF,CAAC;AACrI,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAOrF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAqB,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,cAAc,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAElD,OAAO;QACL,2BAA2B,EAAE,CAAC,MAAe,EAAE,EAAE,CAC/C,8BAA8B,CAC5B,kCAAkC,CAAC,MAAM,CAAC,EAC1C,MAAM,EACN,cAAc,CACf;QACH,IAAI,EAAE,GAAG,EAAE;YACT,OAAO;gBACL,KAAK,CAAC,CAAC,IAAI;oBACT,KAAK,CAAC,CAAC,MAAM,MAAM;yBAChB,cAAc,CAAC,SAAS,CAAC;yBACzB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;yBACzB,IAAI,CAAC,CAAC,QAA6B,EAAE,EAAE,CACtC,QAAQ,CAAC,IAAI,CAAC,GAAG,CACf,CAAC,MAAe,EAAE,EAAE,CAClB,8BAA8B,CAC5B,kCAAkC,CAAC,MAAM,CAAC,EAC1C,MAAM,EACN,cAAc,CAKmB,CACtC,CACF,CAAC;gBACN,CAAC;aACF,CAAC;QACJ,CAAC;QACD,QAAQ;QACR,cAAc;KACf,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { catalogReferenceEntityToProperties } from \"../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.ts\";\nimport { catalogReferenceFromProperties } from \"./catalogReferenceFromProperties.ts\";\nimport type {\n EnterpriseFunctionCatalogReference,\n EnterpriseHomeCatalogReference,\n EnterpriseSourceCatalogReference,\n EnterpriseSpaceCatalogReference,\n} from \"./CatalogReferences/index.ts\";\nimport { baseRetrieve, baseRetrieveByPath } from \"./catalogRetrieve.ts\";\n\nexport const EnterpriseCatalogResource = (config: SonarV3Config) => {\n const retrieve = baseRetrieve(config);\n const retrieveByPath = baseRetrieveByPath(config);\n\n return {\n _catalogReferenceFromEntity: (entity: unknown) =>\n catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n config,\n retrieveByPath,\n ),\n list: () => {\n return {\n async *data() {\n yield* await config\n .sonarV3Request(\"catalog\")\n .then((res) => res.json())\n .then((response: { data: unknown[] }) =>\n response.data.map(\n (entity: unknown) =>\n catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n config,\n retrieveByPath,\n ) as\n | EnterpriseFunctionCatalogReference\n | EnterpriseHomeCatalogReference\n | EnterpriseSourceCatalogReference\n | EnterpriseSpaceCatalogReference,\n ),\n );\n },\n };\n },\n retrieve,\n retrieveByPath,\n };\n};\n"]}
1
+ {"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/enterprise/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,kCAAkC,EAAE,MAAM,iFAAiF,CAAC;AACrI,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAOrF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,OAAO,yBAAyB;IACpC,OAAO,CAAgB;IACvB,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;IACnD,CAAC;IAED,IAAI;QACF,MAAM,OAAO,GAAG,GAAG,EAAE,CACnB,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,SAAS,CAAC;aACzB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAkC,CAAC;aACxD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAChB,QAAQ,CAAC,IAAI,CAAC,GAAG,CACf,CAAC,MAAe,EAAE,EAAE,CAClB,8BAA8B,CAC5B,kCAAkC,CAAC,MAAM,CAAC,EAC1C,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,cAAc,CAKc,CACtC,CACF;aACA,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/C,OAAO;YACL,KAAK,CAAC,CAAC,IAAI;gBACT,KAAK,CAAC,CAAC,MAAM,OAAO,EAAE,CAAC;YACzB,CAAC;SACF,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 { catalogReferenceEntityToProperties } from \"../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.ts\";\nimport { catalogReferenceFromProperties } from \"./catalogReferenceFromProperties.ts\";\nimport type {\n EnterpriseFunctionCatalogReference,\n EnterpriseHomeCatalogReference,\n EnterpriseSourceCatalogReference,\n EnterpriseSpaceCatalogReference,\n} from \"./CatalogReferences/index.ts\";\nimport { baseRetrieve, baseRetrieveByPath } from \"./catalogRetrieve.ts\";\n\nexport class EnterpriseCatalogResource {\n #config: SonarV3Config;\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 }\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 _catalogReferenceFromEntity(entity: unknown) {\n return catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n );\n }\n}\n"]}
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { VersionedDatasetCatalogObject } from "../../oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.js";
17
16
  import { FunctionCatalogReference } from "../../oss/catalog/CatalogReferences/FunctionCatalogReference.js";
18
17
  import { EnterpriseDatasetCatalogObject, enterpriseDatasetEntityToProperties, } from "./CatalogObjects/EnterpriseDatasetCatalogObject.js";
19
18
  import { EnterpriseFileCatalogObject } from "./CatalogObjects/EnterpriseFileCatalogObject.js";
@@ -30,13 +29,6 @@ export const catalogObjectFromEntity = (config, retrieveByPath) => (entity) => {
30
29
  return EnterpriseFolderCatalogObject.fromResource(entity, config, retrieveByPath);
31
30
  case "EnterpriseDataset":
32
31
  case "dataset": {
33
- try {
34
- JSON.parse(entity.id);
35
- return VersionedDatasetCatalogObject.fromResource(entity, retrieveByPath, config);
36
- }
37
- catch (e) {
38
- // continue
39
- }
40
32
  return new EnterpriseDatasetCatalogObject(enterpriseDatasetEntityToProperties(entity, config, retrieveByPath));
41
33
  }
42
34
  case "EnterpriseSource":
@@ -1 +1 @@
1
- {"version":3,"file":"catalogObjectFromEntity.js","sourceRoot":"","sources":["../../../src/enterprise/catalog/catalogObjectFromEntity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,6BAA6B,EAAE,MAAM,mEAAmE,CAAC;AAClH,OAAO,EAAE,wBAAwB,EAAE,MAAM,iEAAiE,CAAC;AAE3G,OAAO,EACL,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAClG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EA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AC1B,KAAK,UAAU;gBACb,OAAO,IAAI,+BAA+B,CAAC;oBACzC,gBAAgB,EAAE,IAAI,wBAAwB,CAC5C;wBACE,EAAE,EAAE,MAAM,CAAC,EAAE;wBACb,IAAI,EAAE,MAAM,CAAC,IAAI;qBAClB,EACD,cAAc,CACf;oBACD,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;oBACrC,EAAE,EAAE,MAAM,CAAC,EAAE;oBACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,YAAY,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;oBAC3C,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,GAAG,EAAE,MAAM,CAAC,GAAG;iBAChB,CAAC,CAAC;YACL;gBACE,MAAM,IAAI,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { VersionedDatasetCatalogObject } from \"../../oss/catalog/CatalogObjects/VersionedDatasetCatalogObject.ts\";\nimport { FunctionCatalogReference } from \"../../oss/catalog/CatalogReferences/FunctionCatalogReference.ts\";\nimport type { EnterpriseCatalogObject } from \"../interfaces.ts\";\nimport {\n EnterpriseDatasetCatalogObject,\n enterpriseDatasetEntityToProperties,\n} from \"./CatalogObjects/EnterpriseDatasetCatalogObject.ts\";\nimport { EnterpriseFileCatalogObject } from \"./CatalogObjects/EnterpriseFileCatalogObject.ts\";\nimport { EnterpriseFolderCatalogObject } from \"./CatalogObjects/EnterpriseFolderCatalogObject.ts\";\nimport { EnterpriseFunctionCatalogObject } from \"./CatalogObjects/EnterpriseFunctionCatalogObject.ts\";\nimport { EnterpriseHomeCatalogObject } from \"./CatalogObjects/EnterpriseHomeCatalogObject.ts\";\nimport {\n EnterpriseSourceCatalogObject,\n enterpriseSourceEntityToProperties,\n} from \"./CatalogObjects/EnterpriseSourceCatalogObject.ts\";\nimport { EnterpriseSpaceCatalogObject } from \"./CatalogObjects/EnterpriseSpaceCatalogObject.ts\";\n\nexport const catalogObjectFromEntity =\n (config: SonarV3Config, retrieveByPath: any) =>\n (entity: any): EnterpriseCatalogObject => {\n {\n switch (entity.entityType) {\n case \"EnterpriseFolder\":\n case \"folder\":\n return EnterpriseFolderCatalogObject.fromResource(\n entity,\n config,\n retrieveByPath,\n ) as EnterpriseFolderCatalogObject;\n case \"EnterpriseDataset\":\n case \"dataset\": {\n try {\n JSON.parse(entity.id);\n return VersionedDatasetCatalogObject.fromResource(\n entity,\n retrieveByPath,\n config,\n ) as any;\n } catch (e) {\n // continue\n }\n return new EnterpriseDatasetCatalogObject(\n enterpriseDatasetEntityToProperties(entity, config, retrieveByPath),\n );\n }\n case \"EnterpriseSource\":\n case \"source\": {\n return new EnterpriseSourceCatalogObject(\n enterpriseSourceEntityToProperties(entity, config, retrieveByPath),\n );\n }\n\n case \"home\":\n return EnterpriseHomeCatalogObject.fromResource(entity, config, retrieveByPath);\n case \"EnterpriseSpace\":\n case \"space\":\n return EnterpriseSpaceCatalogObject.fromResource(entity, config, retrieveByPath);\n case \"file\":\n return EnterpriseFileCatalogObject.fromResource(entity, retrieveByPath);\n case \"EnterpriseFunction\":\n case \"function\":\n return new EnterpriseFunctionCatalogObject({\n catalogReference: new FunctionCatalogReference(\n {\n id: entity.id,\n path: entity.path,\n },\n retrieveByPath,\n ),\n createdAt: new Date(entity.createdAt),\n id: entity.id,\n isScalar: entity.isScalar,\n lastModified: new Date(entity.lastModified),\n path: entity.path,\n returnType: entity.returnType,\n tag: entity.tag,\n });\n default:\n throw new Error(\"Unexpected \" + entity.entityType);\n }\n }\n };\n"]}
1
+ {"version":3,"file":"catalogObjectFromEntity.js","sourceRoot":"","sources":["../../../src/enterprise/catalog/catalogObjectFromEntity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,iEAAiE,CAAC;AAE3G,OAAO,EACL,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAClG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,MAAM,CAAC,MAAM,uBAAuB,GAClC,CAAC,MAAqB,EAAE,cAAmB,EAAE,EAAE,CAC/C,CAAC,MAAW,EAA2B,EAAE;IACvC,CAAC;QACC,QAAQ,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1B,KAAK,kBAAkB,CAAC;YACxB,KAAK,QAAQ;gBACX,OAAO,6BAA6B,CAAC,YAAY,CAC/C,MAAM,EACN,MAAM,EACN,cAAc,CACkB,CAAC;YACrC,KAAK,mBAAmB,CAAC;YACzB,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,OAAO,IAAI,8BAA8B,CACvC,mCAAmC,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CACpE,CAAC;YACJ,CAAC;YACD,KAAK,kBAAkB,CAAC;YACxB,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,OAAO,IAAI,6BAA6B,CACtC,kCAAkC,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CACnE,CAAC;YACJ,CAAC;YAED,KAAK,MAAM;gBACT,OAAO,2BAA2B,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;YAClF,KAAK,iBAAiB,CAAC;YACvB,KAAK,OAAO;gBACV,OAAO,4BAA4B,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;YACnF,KAAK,MAAM;gBACT,OAAO,2BAA2B,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;YAC1E,KAAK,oBAAoB,CAAC;YAC1B,KAAK,UAAU;gBACb,OAAO,IAAI,+BAA+B,CAAC;oBACzC,gBAAgB,EAAE,IAAI,wBAAwB,CAC5C;wBACE,EAAE,EAAE,MAAM,CAAC,EAAE;wBACb,IAAI,EAAE,MAAM,CAAC,IAAI;qBAClB,EACD,cAAc,CACf;oBACD,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;oBACrC,EAAE,EAAE,MAAM,CAAC,EAAE;oBACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,YAAY,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;oBAC3C,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,GAAG,EAAE,MAAM,CAAC,GAAG;iBAChB,CAAC,CAAC;YACL;gBACE,MAAM,IAAI,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { FunctionCatalogReference } from \"../../oss/catalog/CatalogReferences/FunctionCatalogReference.ts\";\nimport type { EnterpriseCatalogObject } from \"../interfaces.ts\";\nimport {\n EnterpriseDatasetCatalogObject,\n enterpriseDatasetEntityToProperties,\n} from \"./CatalogObjects/EnterpriseDatasetCatalogObject.ts\";\nimport { EnterpriseFileCatalogObject } from \"./CatalogObjects/EnterpriseFileCatalogObject.ts\";\nimport { EnterpriseFolderCatalogObject } from \"./CatalogObjects/EnterpriseFolderCatalogObject.ts\";\nimport { EnterpriseFunctionCatalogObject } from \"./CatalogObjects/EnterpriseFunctionCatalogObject.ts\";\nimport { EnterpriseHomeCatalogObject } from \"./CatalogObjects/EnterpriseHomeCatalogObject.ts\";\nimport {\n EnterpriseSourceCatalogObject,\n enterpriseSourceEntityToProperties,\n} from \"./CatalogObjects/EnterpriseSourceCatalogObject.ts\";\nimport { EnterpriseSpaceCatalogObject } from \"./CatalogObjects/EnterpriseSpaceCatalogObject.ts\";\n\nexport const catalogObjectFromEntity =\n (config: SonarV3Config, retrieveByPath: any) =>\n (entity: any): EnterpriseCatalogObject => {\n {\n switch (entity.entityType) {\n case \"EnterpriseFolder\":\n case \"folder\":\n return EnterpriseFolderCatalogObject.fromResource(\n entity,\n config,\n retrieveByPath,\n ) as EnterpriseFolderCatalogObject;\n case \"EnterpriseDataset\":\n case \"dataset\": {\n return new EnterpriseDatasetCatalogObject(\n enterpriseDatasetEntityToProperties(entity, config, retrieveByPath),\n );\n }\n case \"EnterpriseSource\":\n case \"source\": {\n return new EnterpriseSourceCatalogObject(\n enterpriseSourceEntityToProperties(entity, config, retrieveByPath),\n );\n }\n\n case \"home\":\n return EnterpriseHomeCatalogObject.fromResource(entity, config, retrieveByPath);\n case \"EnterpriseSpace\":\n case \"space\":\n return EnterpriseSpaceCatalogObject.fromResource(entity, config, retrieveByPath);\n case \"file\":\n return EnterpriseFileCatalogObject.fromResource(entity, retrieveByPath);\n case \"EnterpriseFunction\":\n case \"function\":\n return new EnterpriseFunctionCatalogObject({\n catalogReference: new FunctionCatalogReference(\n {\n id: entity.id,\n path: entity.path,\n },\n retrieveByPath,\n ),\n createdAt: new Date(entity.createdAt),\n id: entity.id,\n isScalar: entity.isScalar,\n lastModified: new Date(entity.lastModified),\n path: entity.path,\n returnType: entity.returnType,\n tag: entity.tag,\n });\n default:\n throw new Error(\"Unexpected \" + entity.entityType);\n }\n }\n };\n"]}
@@ -24,6 +24,7 @@ export const baseRetrieve = (config) => batch(async (ids) => {
24
24
  const id = Array.from(ids).at(0);
25
25
  return config
26
26
  .sonarV3Request(`catalog/${id}?maxChildren=0`)
27
+ .promise.then((result) => result.unwrap())
27
28
  .then((res) => res.json())
28
29
  .then((response) => {
29
30
  results.set(id, Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(response)));
@@ -50,6 +51,7 @@ export const baseRetrieve = (config) => batch(async (ids) => {
50
51
  headers: { "Content-Type": "application/json" },
51
52
  method: "POST",
52
53
  })
54
+ .promise.then((result) => result.unwrap())
53
55
  .then((res) => res.json())
54
56
  .then((response) => response.data))).then((chunks) => chunks.flat());
55
57
  for (const catalogItem of catalogItems) {
@@ -74,6 +76,7 @@ export const baseRetrieveByPath = (config) => batch(async (paths) => {
74
76
  const path = Array.from(paths).at(0);
75
77
  return config
76
78
  .sonarV3Request(`catalog/by-path/${path.map(encodeURIComponent).join("/")}?maxChildren=0`)
79
+ .promise.then((result) => result.unwrap())
77
80
  .then((res) => res.json())
78
81
  .then((response) => {
79
82
  results.set(path, Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(response)));
@@ -100,6 +103,7 @@ export const baseRetrieveByPath = (config) => batch(async (paths) => {
100
103
  headers: { "Content-Type": "application/json" },
101
104
  method: "POST",
102
105
  })
106
+ .promise.then((result) => result.unwrap())
103
107
  .then((res) => res.json())
104
108
  .then((response) => response.data))).then((chunks) => chunks.flat());
105
109
  for (const catalogItem of catalogItems) {
@@ -1 +1 @@
1
- {"version":3,"file":"catalogRetrieve.js","sourceRoot":"","sources":["../../../src/enterprise/catalog/catalogRetrieve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAqB,EAAE,EAAE,CACpD,KAAK,CAAC,KAAK,EAAE,GAAgB,EAAE,EAAE;IAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoD,CAAC;IAE5E,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE,CAAC;QAClC,OAAO,MAAM;aACV,cAAc,CAAC,WAAW,EAAE,gBAAgB,CAAC;aAC7C,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACzB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,OAAO,CAAC,GAAG,CACT,EAAE,EACF,EAAE,CAAC,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAQ,CAAC,CACjF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,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QAC3B,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,MAAM,EAAE,MAAM;KACf,CAAC;SACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CACrC,CACF,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAElC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAC1F,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,QAAQ,CAAQ,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,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 { batch } from \"../../common/batch.ts\";\nimport { Err, Ok, type Result } from \"ts-results-es\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { catalogObjectFromEntity } from \"./catalogObjectFromEntity.ts\";\nimport { HttpError } from \"../../common/HttpError.ts\";\nimport type { EnterpriseCatalogObject } from \"./CatalogObjects/index.ts\";\nimport { unableToRetrieveProblem } from \"../../oss/catalog/catalogErrors.ts\";\n\nexport const baseRetrieve = (config: SonarV3Config) =>\n batch(async (ids: Set<string>) => {\n const results = new Map<string, Result<EnterpriseCatalogObject, unknown>>();\n\n if (ids.size === 1) {\n const id = Array.from(ids).at(0)!;\n return config\n .sonarV3Request(`catalog/${id}?maxChildren=0`)\n .then((res) => res.json())\n .then((response) => {\n results.set(\n id,\n Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(response) as any),\n );\n return results;\n })\n .catch((e) => {\n if (e instanceof HttpError && (e.body as any)?.detail) {\n results.set(id, Err(unableToRetrieveProblem((e.body as any).detail)));\n } else {\n results.set(id, Err(unableToRetrieveProblem()));\n }\n\n return results;\n });\n }\n\n const idsArray = Array.from(ids);\n const chunks = [];\n\n while (idsArray.length > 0) {\n chunks.push(idsArray.splice(0, Math.min(50, idsArray.length)));\n }\n\n const catalogItems = await Promise.all(\n chunks.map((chunk) =>\n config\n .sonarV3Request(`catalog/by-ids?maxChildren=0`, {\n body: JSON.stringify(chunk),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n })\n .then((res) => res.json())\n .then((response) => response.data),\n ),\n ).then((chunks) => chunks.flat());\n\n for (const catalogItem of catalogItems) {\n results.set(\n catalogItem.id,\n Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(catalogItem) as any),\n );\n }\n\n for (const id of ids) {\n if (!results.has(id)) {\n results.set(id, Err(unableToRetrieveProblem()));\n }\n }\n\n return results;\n });\n\nexport const baseRetrieveByPath = (config: SonarV3Config) =>\n batch(async (paths: Set<string[]>) => {\n const results = new Map<string[], Result<EnterpriseCatalogObject, unknown>>();\n\n // Because the key is a reference type (array), we need to store the\n // original path reference\n const originalKeyRef = new Map<string, string[]>();\n for (const key of paths) {\n originalKeyRef.set(JSON.stringify(key), key);\n }\n\n if (paths.size === 1) {\n const path = Array.from(paths).at(0)!;\n return config\n .sonarV3Request(`catalog/by-path/${path.map(encodeURIComponent).join(\"/\")}?maxChildren=0`)\n .then((res) => res.json())\n .then((response) => {\n results.set(\n path,\n Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(response)) as any,\n );\n return results;\n })\n .catch((e) => {\n if (e instanceof HttpError && (e.body as any)?.detail) {\n results.set(path, Err(unableToRetrieveProblem((e.body as any).detail)));\n } else {\n results.set(path, Err(unableToRetrieveProblem()));\n }\n return results;\n });\n }\n\n const pathsArray = Array.from(paths);\n const chunks = [];\n\n while (pathsArray.length > 0) {\n chunks.push(pathsArray.splice(0, Math.min(50, pathsArray.length)));\n }\n\n const catalogItems = await Promise.all(\n chunks.map((chunk) =>\n config\n .sonarV3Request(`catalog/by-paths?maxChildren=0`, {\n body: JSON.stringify(chunk),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n })\n .then((res) => res.json())\n .then((response) => response.data),\n ),\n ).then((chunks) => chunks.flat());\n\n for (const catalogItem of catalogItems) {\n const resolved = catalogObjectFromEntity(config, baseRetrieveByPath(config))(catalogItem);\n const originalKey = originalKeyRef.get(JSON.stringify(resolved.path));\n if (originalKey) {\n results.set(originalKey, Ok(resolved) as any);\n }\n }\n\n for (const path of paths) {\n if (!results.has(path)) {\n results.set(path, Err(unableToRetrieveProblem()));\n }\n }\n\n return results;\n });\n"]}
1
+ {"version":3,"file":"catalogRetrieve.js","sourceRoot":"","sources":["../../../src/enterprise/catalog/catalogRetrieve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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3B,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,MAAM,EAAE,MAAM;KACf,CAAC;SACD,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;SACzC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CACrC,CACF,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAElC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAC1F,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,QAAQ,CAAQ,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,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 { batch } from \"../../common/batch.ts\";\nimport { Err, Ok, type Result } from \"ts-results-es\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { catalogObjectFromEntity } from \"./catalogObjectFromEntity.ts\";\nimport { HttpError } from \"../../common/HttpError.ts\";\nimport type { EnterpriseCatalogObject } from \"./CatalogObjects/index.ts\";\nimport { unableToRetrieveProblem } from \"../../oss/catalog/catalogErrors.ts\";\n\nexport const baseRetrieve = (config: SonarV3Config) =>\n batch(async (ids: Set<string>) => {\n const results = new Map<string, Result<EnterpriseCatalogObject, unknown>>();\n\n if (ids.size === 1) {\n const id = Array.from(ids).at(0)!;\n return config\n .sonarV3Request(`catalog/${id}?maxChildren=0`)\n .promise.then((result) => result.unwrap())\n .then((res) => res.json())\n .then((response) => {\n results.set(\n id,\n Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(response) as any),\n );\n return results;\n })\n .catch((e) => {\n if (e instanceof HttpError && (e.body as any)?.detail) {\n results.set(id, Err(unableToRetrieveProblem((e.body as any).detail)));\n } else {\n results.set(id, Err(unableToRetrieveProblem()));\n }\n\n return results;\n });\n }\n\n const idsArray = Array.from(ids);\n const chunks = [];\n\n while (idsArray.length > 0) {\n chunks.push(idsArray.splice(0, Math.min(50, idsArray.length)));\n }\n\n const catalogItems = await Promise.all(\n chunks.map((chunk) =>\n config\n .sonarV3Request(`catalog/by-ids?maxChildren=0`, {\n body: JSON.stringify(chunk),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n })\n .promise.then((result) => result.unwrap())\n .then((res) => res.json())\n .then((response) => response.data),\n ),\n ).then((chunks) => chunks.flat());\n\n for (const catalogItem of catalogItems) {\n results.set(\n catalogItem.id,\n Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(catalogItem) as any),\n );\n }\n\n for (const id of ids) {\n if (!results.has(id)) {\n results.set(id, Err(unableToRetrieveProblem()));\n }\n }\n\n return results;\n });\n\nexport const baseRetrieveByPath = (config: SonarV3Config) =>\n batch(async (paths: Set<string[]>) => {\n const results = new Map<string[], Result<EnterpriseCatalogObject, unknown>>();\n\n // Because the key is a reference type (array), we need to store the\n // original path reference\n const originalKeyRef = new Map<string, string[]>();\n for (const key of paths) {\n originalKeyRef.set(JSON.stringify(key), key);\n }\n\n if (paths.size === 1) {\n const path = Array.from(paths).at(0)!;\n return config\n .sonarV3Request(`catalog/by-path/${path.map(encodeURIComponent).join(\"/\")}?maxChildren=0`)\n .promise.then((result) => result.unwrap())\n .then((res) => res.json())\n .then((response) => {\n results.set(\n path,\n Ok(catalogObjectFromEntity(config, baseRetrieveByPath(config))(response)) as any,\n );\n return results;\n })\n .catch((e) => {\n if (e instanceof HttpError && (e.body as any)?.detail) {\n results.set(path, Err(unableToRetrieveProblem((e.body as any).detail)));\n } else {\n results.set(path, Err(unableToRetrieveProblem()));\n }\n return results;\n });\n }\n\n const pathsArray = Array.from(paths);\n const chunks = [];\n\n while (pathsArray.length > 0) {\n chunks.push(pathsArray.splice(0, Math.min(50, pathsArray.length)));\n }\n\n const catalogItems = await Promise.all(\n chunks.map((chunk) =>\n config\n .sonarV3Request(`catalog/by-paths?maxChildren=0`, {\n body: JSON.stringify(chunk),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n })\n .promise.then((result) => result.unwrap())\n .then((res) => res.json())\n .then((response) => response.data),\n ),\n ).then((chunks) => chunks.flat());\n\n for (const catalogItem of catalogItems) {\n const resolved = catalogObjectFromEntity(config, baseRetrieveByPath(config))(catalogItem);\n const originalKey = originalKeyRef.get(JSON.stringify(resolved.path));\n if (originalKey) {\n results.set(originalKey, Ok(resolved) as any);\n }\n }\n\n for (const path of paths) {\n if (!results.has(path)) {\n results.set(path, Err(unableToRetrieveProblem()));\n }\n }\n\n return results;\n });\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { Config } from "../../common/Config.ts";
2
+ import { Problem } from "../../common/Problem.ts";
2
3
  export declare const exchangePat: (endpoint: URL, config: Config) => (subject_token: string) => Promise<{
3
4
  access_token: string;
4
5
  expires_in: number;
@@ -6,7 +7,4 @@ export declare const exchangePat: (endpoint: URL, config: Config) => (subject_to
6
7
  issued_token_type: string;
7
8
  scope: string;
8
9
  }>;
9
- export declare const invalidSubjectToken: {
10
- readonly title: "The provided subject_token is invalid.";
11
- readonly type: "https://api.dremio.dev/problems/oauth2/invalid-subject-token";
12
- };
10
+ export declare const invalidSubjectToken: Problem<"https://api.dremio.dev/problems/oauth2/invalid-subject-token", undefined>;
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { HttpError } from "../../common/HttpError.js";
17
- import {} from "../../common/Problem.js";
17
+ import { Problem } from "../../common/Problem.js";
18
18
  export const exchangePat = (endpoint, config) => (subject_token) => {
19
19
  const body = new URLSearchParams({
20
20
  grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
@@ -48,8 +48,8 @@ export const exchangePat = (endpoint, config) => (subject_token) => {
48
48
  throw e;
49
49
  });
50
50
  };
51
- export const invalidSubjectToken = {
51
+ export const invalidSubjectToken = new Problem({
52
52
  title: "The provided subject_token is invalid.",
53
53
  type: "https://api.dremio.dev/problems/oauth2/invalid-subject-token",
54
- };
54
+ });
55
55
  //# sourceMappingURL=exchangePat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exchangePat.js","sourceRoot":"","sources":["../../../src/enterprise/credentials/exchangePat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAgB,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAa,EAAE,MAAc,EAAE,EAAE,CAAC,CAAC,aAAqB,EAAE,EAAE;IACtF,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC;QAC/B,UAAU,EAAE,iDAAiD;QAC7D,KAAK,EAAE,YAAY;QACnB,aAAa;QACb,kBAAkB,EAAE,+DAA+D;KACpF,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;QAC7D,IAAI;QACJ,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,mCAAmC;SACpD;QACD,MAAM,EAAE,MAAM;KACf,CAAC;SACC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAClB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,MAAM,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAMb,CAAC;IACL,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,IAAI,CAAC,YAAY,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACrB,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBACzC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE;oBACzC,KAAK,EAAE,mBAAmB;iBAC3B,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,wCAAwC;IAC/C,IAAI,EAAE,8DAA8D;CAC1C,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 { HttpError } from \"../../common/HttpError.ts\";\nimport type { Config } from \"../../common/Config.ts\";\nimport { type Problem } from \"../../common/Problem.ts\";\n\nexport const exchangePat = (endpoint: URL, config: Config) => (subject_token: string) => {\n const body = new URLSearchParams({\n grant_type: \"urn:ietf:params:oauth:grant-type:token-exchange\",\n scope: \"dremio.all\",\n subject_token,\n subject_token_type: \"urn:ietf:params:oauth:token-type:dremio:personal-access-token\",\n });\n return (config.fetch || globalThis.fetch)(endpoint.toString(), {\n body,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n method: \"POST\",\n })\n .then(async (res) => {\n if (!res.ok) {\n throw await HttpError.fromResponse(res);\n }\n\n return res.json() as Promise<{\n access_token: string;\n expires_in: number;\n token_type: string;\n issued_token_type: string;\n scope: string;\n }>;\n })\n .catch((e) => {\n if (e instanceof HttpError) {\n if (e.status === 401) {\n config.logger?.warn(invalidSubjectToken);\n throw new Error(invalidSubjectToken.title, {\n cause: invalidSubjectToken,\n });\n }\n }\n throw e;\n });\n};\n\nexport const invalidSubjectToken = {\n title: \"The provided subject_token is invalid.\",\n type: \"https://api.dremio.dev/problems/oauth2/invalid-subject-token\",\n} as const satisfies Problem;\n"]}
1
+ {"version":3,"file":"exchangePat.js","sourceRoot":"","sources":["../../../src/enterprise/credentials/exchangePat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAa,EAAE,MAAc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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 { HttpError } from \"../../common/HttpError.ts\";\nimport type { Config } from \"../../common/Config.ts\";\nimport { Problem } from \"../../common/Problem.ts\";\n\nexport const exchangePat = (endpoint: URL, config: Config) => (subject_token: string) => {\n const body = new URLSearchParams({\n grant_type: \"urn:ietf:params:oauth:grant-type:token-exchange\",\n scope: \"dremio.all\",\n subject_token,\n subject_token_type: \"urn:ietf:params:oauth:token-type:dremio:personal-access-token\",\n });\n return (config.fetch || globalThis.fetch)(endpoint.toString(), {\n body,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n method: \"POST\",\n })\n .then(async (res) => {\n if (!res.ok) {\n throw await HttpError.fromResponse(res);\n }\n\n return res.json() as Promise<{\n access_token: string;\n expires_in: number;\n token_type: string;\n issued_token_type: string;\n scope: string;\n }>;\n })\n .catch((e) => {\n if (e instanceof HttpError) {\n if (e.status === 401) {\n config.logger?.warn(invalidSubjectToken);\n throw new Error(invalidSubjectToken.title, {\n cause: invalidSubjectToken,\n });\n }\n }\n throw e;\n });\n};\n\nexport const invalidSubjectToken = new Problem({\n title: \"The provided subject_token is invalid.\",\n type: \"https://api.dremio.dev/problems/oauth2/invalid-subject-token\",\n});\n"]}
@@ -1,7 +1,5 @@
1
1
  import type { SonarV3Config } from "../../common/Config.ts";
2
- import { Err, Ok, type Result } from "ts-results-es";
3
2
  import { Temporal } from "temporal-polyfill";
4
- import type { HttpError } from "../../common/HttpError.ts";
5
3
  export declare class Engine {
6
4
  #private;
7
5
  readonly id: EngineEntity["id"];
@@ -19,12 +17,12 @@ export declare class Engine {
19
17
  };
20
18
  constructor(entity: EngineEntity, config: SonarV3Config);
21
19
  get settled(): boolean;
22
- start(): Promise<Result<Engine, unknown>>;
23
- stop(): Promise<Result<Engine, unknown>>;
20
+ start(): Promise<import("ts-results-es").Result<Engine, import("../index.ts").HttpError>>;
21
+ stop(): Promise<import("ts-results-es").Result<Engine, import("../index.ts").HttpError>>;
24
22
  update(params: Partial<{
25
23
  name: Engine["name"];
26
24
  spec: Partial<Engine["spec"]>;
27
- }>): Promise<Err<HttpError> | Ok<Engine>>;
25
+ }>): Promise<import("ts-results-es").Result<Engine, import("../index.ts").HttpError>>;
28
26
  }
29
27
  export type EngineEntity = {
30
28
  id: string;
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Err, Ok } from "ts-results-es";
17
16
  import { Temporal } from "temporal-polyfill";
18
17
  export class Engine {
19
18
  id;
@@ -48,9 +47,8 @@ export class Engine {
48
47
  keepalive: true,
49
48
  method: "PUT",
50
49
  })
51
- .then((res) => res.json())
52
- .then((entity) => Ok(new Engine(entity, this.#config)))
53
- .catch((e) => Err(e));
50
+ .map((res) => res.json())
51
+ .map((entity) => new Engine(entity, this.#config)).promise;
54
52
  }
55
53
  stop() {
56
54
  return this.#config
@@ -59,11 +57,10 @@ export class Engine {
59
57
  keepalive: true,
60
58
  method: "PUT",
61
59
  })
62
- .then((res) => res.json())
63
- .then((entity) => Ok(new Engine(entity, this.#config)))
64
- .catch((e) => Err(e));
60
+ .map((res) => res.json())
61
+ .map((entity) => new Engine(entity, this.#config)).promise;
65
62
  }
66
- async update(params) {
63
+ update(params) {
67
64
  const updateOptions = {
68
65
  name: params.name || this.name,
69
66
  spec: {
@@ -82,9 +79,8 @@ export class Engine {
82
79
  keepalive: true,
83
80
  method: "PUT",
84
81
  })
85
- .then((res) => res.json())
86
- .then((entity) => Ok(new Engine(entity, this.#config)))
87
- .catch((e) => Err(e));
82
+ .map((res) => res.json())
83
+ .map((entity) => new Engine(entity, this.#config)).promise;
88
84
  }
89
85
  }
90
86
  //# sourceMappingURL=Engine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/enterprise/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,MAAM,OAAO,MAAM;IACD,EAAE,CAAqB;IACvB,IAAI,CAAuB;IAC3B,IAAI,CAOlB;IACc,MAAM,CAEpB;IAEO,OAAO,CAAgB;IAEvB,IAAI,CAAS;IAEtB,YAAY,MAAoB,EAAE,MAAqB;QACrD,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG;YACV,GAAG,MAAM,CAAC,IAAI;YACd,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW;gBAClC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;gBACjD,CAAC,CAAC,SAAS;SACd,CAAC;QACF,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,MAAM,CAAC,MAAM;YAChB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;SACtE,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,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,IAAI;aACf;YACD,OAAO,EAAE,IAAI,CAAC,IAAI;SACnB,CAAC;QACF,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;YACnC,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA2B,CAAC;aAClD,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;aACtD,KAAK,CAAC,CAAC,CAAY,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,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 { Err, Ok, type Result } from \"ts-results-es\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class Engine {\n public readonly id: EngineEntity[\"id\"];\n public readonly name: EngineEntity[\"name\"];\n public readonly spec: {\n c3StorageSize: EngineEntity[\"spec\"][\"c3StorageSize\"];\n size: EngineEntity[\"spec\"][\"size\"];\n spillStorageSize: EngineEntity[\"spec\"][\"spillStorageSize\"];\n targetCpuCapacity: EngineEntity[\"spec\"][\"targetCpuCapacity\"];\n resourceAllocationOffset: EngineEntity[\"spec\"][\"resourceAllocationOffset\"];\n idleTimeout?: Temporal.Duration;\n };\n public readonly status: Omit<EngineEntity[\"status\"], \"message\"> & {\n message: string | null;\n };\n\n readonly #config: SonarV3Config;\n\n readonly #tag: string;\n\n constructor(entity: EngineEntity, config: SonarV3Config) {\n this.id = entity.id;\n this.name = entity.name;\n this.spec = {\n ...entity.spec,\n idleTimeout: entity.spec.idleTimeout\n ? Temporal.Duration.from(entity.spec.idleTimeout)\n : undefined,\n };\n this.status = {\n ...entity.status,\n message: entity.status.message?.length ? entity.status.message : null,\n };\n this.#tag = entity.version;\n this.#config = config;\n }\n\n get settled() {\n return this.status.state !== \"STARTING\" && this.status.state !== \"STOPPING\";\n }\n\n start(): Promise<Result<Engine, unknown>> {\n return this.#config\n .sonarV3Request(`engines/${this.id}/start`, {\n headers: { Accept: \"application/json\" },\n keepalive: true,\n method: \"PUT\",\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: unknown) => Err(e));\n }\n\n stop(): Promise<Result<Engine, unknown>> {\n return this.#config\n .sonarV3Request(`engines/${this.id}/stop`, {\n headers: { Accept: \"application/json\" },\n keepalive: true,\n method: \"PUT\",\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: unknown) => Err(e));\n }\n\n async update(\n params: Partial<{\n name: Engine[\"name\"];\n spec: Partial<Engine[\"spec\"]>;\n }>,\n ) {\n const updateOptions = {\n name: params.name || this.name,\n spec: {\n ...this.spec,\n ...params.spec,\n },\n version: this.#tag,\n };\n return this.#config\n .sonarV3Request(`engines/${this.id}`, {\n body: JSON.stringify(updateOptions),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: HttpError) => Err(e));\n }\n}\n\nexport type EngineEntity = {\n id: string;\n name: string;\n spec: {\n c3StorageSize: string;\n idleTimeout?: string;\n spillStorageSize: string;\n targetCpuCapacity: string;\n resourceAllocationOffset: string;\n size: \"2XSmall\" | \"XSmall\" | \"Small\" | \"Medium\" | \"Large\" | \"XLarge\" | \"2XLarge\";\n };\n status: {\n message: string;\n replicas: {\n id: string;\n executors: {\n cpu: number;\n memory: number;\n name: string;\n status: string;\n }[];\n }[];\n runningExecutors: number;\n runningReplicas: number;\n startingExecutors: number;\n startingReplicas: number;\n state: \"STARTING\" | \"RUNNING\" | \"STOPPING\" | \"STOPPED\" | \"WARNING\" | \"FAILED\";\n stoppingExecutors: number;\n stoppingReplicas: number;\n };\n version: string;\n};\n"]}
1
+ {"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/enterprise/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAM;IACD,EAAE,CAAqB;IACvB,IAAI,CAAuB;IAC3B,IAAI,CAOlB;IACc,MAAM,CAEpB;IAEO,OAAO,CAAgB;IAEvB,IAAI,CAAS;IAEtB,YAAY,MAAoB,EAAE,MAAqB;QACrD,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG;YACV,GAAG,MAAM,CAAC,IAAI;YACd,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW;gBAClC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;gBACjD,CAAC,CAAC,SAAS;SACd,CAAC;QACF,IAAI,C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AO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/D,CAAC;IAED,MAAM,CACJ,MAGE;QAEF,MAAM,aAAa,GAAG;YACpB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;YAC9B,IAAI,EAAE;gBACJ,GAAG,IAAI,CAAC,IAAI;gBACZ,GAAG,MAAM,CAAC,IAAI;aACf;YACD,OAAO,EAAE,IAAI,CAAC,IAAI;SACnB,CAAC;QACF,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;YACnC,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,EAA2B,CAAC;aACjD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/D,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 { Temporal } from \"temporal-polyfill\";\n\nexport class Engine {\n public readonly id: EngineEntity[\"id\"];\n public readonly name: EngineEntity[\"name\"];\n public readonly spec: {\n c3StorageSize: EngineEntity[\"spec\"][\"c3StorageSize\"];\n size: EngineEntity[\"spec\"][\"size\"];\n spillStorageSize: EngineEntity[\"spec\"][\"spillStorageSize\"];\n targetCpuCapacity: EngineEntity[\"spec\"][\"targetCpuCapacity\"];\n resourceAllocationOffset: EngineEntity[\"spec\"][\"resourceAllocationOffset\"];\n idleTimeout?: Temporal.Duration;\n };\n public readonly status: Omit<EngineEntity[\"status\"], \"message\"> & {\n message: string | null;\n };\n\n readonly #config: SonarV3Config;\n\n readonly #tag: string;\n\n constructor(entity: EngineEntity, config: SonarV3Config) {\n this.id = entity.id;\n this.name = entity.name;\n this.spec = {\n ...entity.spec,\n idleTimeout: entity.spec.idleTimeout\n ? Temporal.Duration.from(entity.spec.idleTimeout)\n : undefined,\n };\n this.status = {\n ...entity.status,\n message: entity.status.message?.length ? entity.status.message : null,\n };\n this.#tag = entity.version;\n this.#config = config;\n }\n\n get settled() {\n return this.status.state !== \"STARTING\" && this.status.state !== \"STOPPING\";\n }\n\n start() {\n return this.#config\n .sonarV3Request(`engines/${this.id}/start`, {\n headers: { Accept: \"application/json\" },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<EngineEntity>)\n .map((entity) => new Engine(entity, this.#config)).promise;\n }\n\n stop() {\n return this.#config\n .sonarV3Request(`engines/${this.id}/stop`, {\n headers: { Accept: \"application/json\" },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<EngineEntity>)\n .map((entity) => new Engine(entity, this.#config)).promise;\n }\n\n update(\n params: Partial<{\n name: Engine[\"name\"];\n spec: Partial<Engine[\"spec\"]>;\n }>,\n ) {\n const updateOptions = {\n name: params.name || this.name,\n spec: {\n ...this.spec,\n ...params.spec,\n },\n version: this.#tag,\n };\n return this.#config\n .sonarV3Request(`engines/${this.id}`, {\n body: JSON.stringify(updateOptions),\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<EngineEntity>)\n .map((entity) => new Engine(entity, this.#config)).promise;\n }\n}\n\nexport type EngineEntity = {\n id: string;\n name: string;\n spec: {\n c3StorageSize: string;\n idleTimeout?: string;\n spillStorageSize: string;\n targetCpuCapacity: string;\n resourceAllocationOffset: string;\n size: \"2XSmall\" | \"XSmall\" | \"Small\" | \"Medium\" | \"Large\" | \"XLarge\" | \"2XLarge\";\n };\n status: {\n message: string;\n replicas: {\n id: string;\n executors: {\n cpu: number;\n memory: number;\n name: string;\n status: string;\n }[];\n }[];\n runningExecutors: number;\n runningReplicas: number;\n startingExecutors: number;\n startingReplicas: number;\n state: \"STARTING\" | \"RUNNING\" | \"STOPPING\" | \"STOPPED\" | \"WARNING\" | \"FAILED\";\n stoppingExecutors: number;\n stoppingReplicas: number;\n };\n version: string;\n};\n"]}
@@ -1,13 +1,11 @@
1
- import { Err, Ok } from "ts-results-es";
2
1
  import type { ResourceConfig, SonarV3Config } from "../../common/Config.ts";
3
2
  import type { SignalParam } from "../../common/Params.ts";
4
3
  import { Engine } from "./Engine.ts";
5
- import type { HttpError } from "../../common/HttpError.ts";
6
4
  export declare class EnginesResource {
7
5
  #private;
8
6
  constructor(config: ResourceConfig & SonarV3Config);
9
7
  list(): {
10
- data({ signal }?: SignalParam): AsyncGenerator<Engine, void, unknown>;
8
+ data({ signal }?: SignalParam): AsyncGenerator<Engine[], void, any>;
11
9
  };
12
- retrieve(id: string, { signal }?: SignalParam): Promise<Err<HttpError> | Ok<Engine>>;
10
+ retrieve(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<Engine, import("../index.ts").HttpError>>;
13
11
  }
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Err, Ok } from "ts-results-es";
17
16
  import { Engine } from "./Engine.js";
18
17
  export class EnginesResource {
19
18
  #config;
@@ -23,8 +22,8 @@ export class EnginesResource {
23
22
  list() {
24
23
  const getPage = ({ signal } = {}) => this.#config
25
24
  .sonarV3Request("engines", { headers: { Accept: "application/json" }, signal })
26
- .then((res) => res.json())
27
- .then((res) => res.data.map((entity) => new Engine(entity, this.#config)));
25
+ .map((res) => res.json())
26
+ .map((res) => res.data.map((entity) => new Engine(entity, this.#config))).promise;
28
27
  return {
29
28
  async *data({ signal } = {}) {
30
29
  yield* await getPage({ signal });
@@ -37,9 +36,8 @@ export class EnginesResource {
37
36
  headers: { Accept: "application/json" },
38
37
  signal,
39
38
  })
40
- .then((res) => res.json())
41
- .then((entity) => Ok(new Engine(entity, this.#config)))
42
- .catch((e) => Err(e));
39
+ .map((res) => res.json())
40
+ .map((entity) => new Engine(entity, this.#config)).promise;
43
41
  }
44
42
  }
45
43
  //# sourceMappingURL=EnginesResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/enterprise/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AAGxD,MAAM,OAAO,eAAe;IACjB,OAAO,CAAiC;IAEjD,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI;QACF,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;aAC9E,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAuC,CAAC;aAC9D,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/E,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YACnC,CAAC;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE;YAC/B,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;YACvC,MAAM;SACP,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA2B,CAAC;aAClD,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;aACtD,KAAK,CAAC,CAAC,CAAY,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,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 { Err, Ok } from \"ts-results-es\";\nimport type { ResourceConfig, SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { Engine, type EngineEntity } from \"./Engine.ts\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class EnginesResource {\n readonly #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"engines\", { headers: { Accept: \"application/json\" }, signal })\n .then((res) => res.json() as Promise<{ data: EngineEntity[] }>)\n .then((res) => res.data.map((entity) => new Engine(entity, this.#config)));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await getPage({ signal });\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`engines/${id}`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .then((res) => res.json() as Promise<EngineEntity>)\n .then((entity) => Ok(new Engine(entity, this.#config)))\n .catch((e: HttpError) => Err(e));\n }\n}\n"]}
1
+ {"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/enterprise/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AAExD,MAAM,OAAO,eAAe;IACjB,OAAO,CAAiC;IAEjD,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI;QACF,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;aAC9E,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAuC,CAAC;aAC7D,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACtF,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YACnC,CAAC;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE;YAC/B,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;YACvC,MAAM;SACP,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA2B,CAAC;aACjD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/D,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ResourceConfig, SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { Engine, type EngineEntity } from \"./Engine.ts\";\n\nexport class EnginesResource {\n readonly #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n list() {\n const getPage = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"engines\", { headers: { Accept: \"application/json\" }, signal })\n .map((res) => res.json() as Promise<{ data: EngineEntity[] }>)\n .map((res) => res.data.map((entity) => new Engine(entity, this.#config))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await getPage({ signal });\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`engines/${id}`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .map((res) => res.json() as Promise<EngineEntity>)\n .map((entity) => new Engine(entity, this.#config)).promise;\n }\n}\n"]}