@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,24 +1,12 @@
1
- import { Err, Ok } from "ts-results-es";
2
1
  import type { ResourceConfig, V3Config } from "../../common/Config.ts";
3
2
  import type { SignalParam } from "../../common/Params.ts";
3
+ import { Problem } from "../../common/Problem.ts";
4
4
  export declare class AiResource {
5
5
  #private;
6
6
  constructor(config: ResourceConfig & V3Config);
7
7
  autoProduceQuery: (project_id: string) => ({ datasetPaths, text }: {
8
8
  datasetPaths: Set<string>;
9
9
  text: string;
10
- }, { signal }?: SignalParam) => Promise<Ok<string> | Err<{
11
- readonly detail: "Please clarify your request and try again.";
12
- readonly title: "SQL could not be generated from the input text.";
13
- readonly type: "https://api.dremio.dev/problems/auto-produce-sql/clarify-request";
14
- }> | Err<{
15
- readonly detail: string;
16
- readonly title: "An unexpected error occurred while processing this request.";
17
- readonly type: "https://api.dremio.dev/problems/unexpected-error";
18
- }>>;
10
+ }, { signal }?: SignalParam) => Promise<import("ts-results-es").Result<string, import("../index.ts").HttpError | Problem<"https://api.dremio.dev/problems/auto-produce-sql/clarify-request", undefined>>>;
19
11
  }
20
- export declare const clarifyRequestErr: {
21
- readonly detail: "Please clarify your request and try again.";
22
- readonly title: "SQL could not be generated from the input text.";
23
- readonly type: "https://api.dremio.dev/problems/auto-produce-sql/clarify-request";
24
- };
12
+ export declare const clarifyRequestErr: Problem<"https://api.dremio.dev/problems/auto-produce-sql/clarify-request", undefined>;
@@ -13,9 +13,7 @@
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
- import { HttpError } from "../../common/HttpError.js";
18
- import { isProblem } from "../../common/Problem.js";
16
+ import { Problem } from "../../common/Problem.js";
19
17
  export class AiResource {
20
18
  #config;
21
19
  constructor(config) {
@@ -37,19 +35,18 @@ export class AiResource {
37
35
  method: "POST",
38
36
  signal,
39
37
  })
40
- .then((res) => res.json())
41
- .then((response) => Ok(response.sql))
42
- .catch((e) => {
43
- if (e instanceof HttpError && isProblem(e.body)) {
44
- if (e.body.detail?.includes("INVALID_ARGUMENT: SQL could not be generated. Please clarify your request."))
45
- return Err(clarifyRequestErr);
46
- }
47
- return Err(e);
48
- });
38
+ .map((res) => res.json())
39
+ .map((response) => response.sql)
40
+ .mapErr((e) => {
41
+ if (e.body instanceof Problem &&
42
+ e.body.detail?.includes("INVALID_ARGUMENT: SQL could not be generated. Please clarify your request."))
43
+ return clarifyRequestErr;
44
+ return e;
45
+ }).promise;
49
46
  }
50
- export const clarifyRequestErr = {
47
+ export const clarifyRequestErr = new Problem({
51
48
  detail: "Please clarify your request and try again.",
52
49
  title: "SQL could not be generated from the input text.",
53
50
  type: "https://api.dremio.dev/problems/auto-produce-sql/clarify-request",
54
- };
51
+ });
55
52
  //# sourceMappingURL=AiResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AiResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AiResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAgB,MAAM,yBAAyB,CAAC;AAGlE,MAAM,OAAO,UAAU;IACZ,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,gBAAgB,GACd,CAAC,UAAkB,EAAE,EAAE,CACvB,CACE,EAAE,YAAY,EAAE,IAAI,EAA+C,EACnE,EAAE,MAAM,KAAkB,EAAE,EAC5B,EAAE,CACF,IAAI,CAAC,OAAO;SACT,SAAS,CAAC,2BAA2B,EAAE;QACtC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACjE,WAAW;aACZ,CAAC,CAAC;YACH,SAAS,EAAE,UAAU;YACrB,gBAAgB,EAAE,IAAI;SACvB,CAAC;QACF,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SACnC;QACD,MAAM,EAAE,MAAM;QACd,MAAM;KACP,CAAC;SACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA8B,CAAC;SACrD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;SACpC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;QACpB,IAAI,CAAC,YAAY,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,IACE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CACrB,4EAA4E,CAC7E;gBAED,OAAO,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,GAAG,CAAC,CAAuC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;CACV;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,iDAAiD;IACxD,IAAI,EAAE,kEAAkE;CAC9C,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 { ResourceConfig, V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { HttpError } from \"../../common/HttpError.ts\";\nimport { isProblem, type Problem } from \"../../common/Problem.ts\";\nimport type { unexpectedError } from \"../../common/problems.ts\";\n\nexport class AiResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n autoProduceQuery =\n (project_id: string) =>\n (\n { datasetPaths, text }: { datasetPaths: Set<string>; text: string },\n { signal }: SignalParam = {},\n ) =>\n this.#config\n .v3Request(\"gen-ai/auto-produce-query\", {\n body: JSON.stringify({\n datasetIdentifiers: Array.from(datasetPaths).map((datasetPath) => ({\n datasetPath,\n })),\n projectId: project_id,\n userInputtedText: text,\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n method: \"POST\",\n signal,\n })\n .then((res) => res.json() as Promise<{ sql: string }>)\n .then((response) => Ok(response.sql))\n .catch((e: unknown) => {\n if (e instanceof HttpError && isProblem(e.body)) {\n if (\n e.body.detail?.includes(\n \"INVALID_ARGUMENT: SQL could not be generated. Please clarify your request.\",\n )\n )\n return Err(clarifyRequestErr);\n }\n return Err(e as ReturnType<typeof unexpectedError>);\n });\n}\n\nexport const clarifyRequestErr = {\n detail: \"Please clarify your request and try again.\",\n title: \"SQL could not be generated from the input text.\",\n type: \"https://api.dremio.dev/problems/auto-produce-sql/clarify-request\",\n} as const satisfies Problem;\n"]}
1
+ {"version":3,"file":"AiResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AiResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,MAAM,OAAO,UAAU;IACZ,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,gBAAgB,GACd,CAAC,UAAkB,EAAE,EAAE,CACvB,CACE,EAAE,YAAY,EAAE,IAAI,EAA+C,EACnE,EAAE,MAAM,KAAkB,EAAE,EAC5B,EAAE,CACF,IAAI,CAAC,OAAO;SACT,SAAS,CAAC,2BAA2B,EAAE;QACtC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACjE,WAAW;aACZ,CAAC,CAAC;YACH,SAAS,EAAE,UAAU;YACrB,gBAAgB,EAAE,IAAI;SACvB,CAAC;QACF,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;SACnC;QACD,MAAM,EAAE,MAAM;QACd,MAAM;KACP,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA8B,CAAC;SACpD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;SAC/B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACZ,IACE,CAAC,CAAC,IAAI,YAAY,OAAO;YACzB,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CACrB,4EAA4E,CAC7E;YAED,OAAO,iBAAiB,CAAC;QAE3B,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC,OAAO,CAAC;CAClB;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,OAAO,CAAC;IAC3C,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,iDAAiD;IACxD,IAAI,EAAE,kEAAkE;CACzE,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 { ResourceConfig, V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { Problem } from \"../../common/Problem.ts\";\n\nexport class AiResource {\n readonly #config: ResourceConfig & V3Config;\n\n constructor(config: ResourceConfig & V3Config) {\n this.#config = config;\n }\n\n autoProduceQuery =\n (project_id: string) =>\n (\n { datasetPaths, text }: { datasetPaths: Set<string>; text: string },\n { signal }: SignalParam = {},\n ) =>\n this.#config\n .v3Request(\"gen-ai/auto-produce-query\", {\n body: JSON.stringify({\n datasetIdentifiers: Array.from(datasetPaths).map((datasetPath) => ({\n datasetPath,\n })),\n projectId: project_id,\n userInputtedText: text,\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n method: \"POST\",\n signal,\n })\n .map((res) => res.json() as Promise<{ sql: string }>)\n .map((response) => response.sql)\n .mapErr((e) => {\n if (\n e.body instanceof Problem &&\n e.body.detail?.includes(\n \"INVALID_ARGUMENT: SQL could not be generated. Please clarify your request.\",\n )\n )\n return clarifyRequestErr;\n\n return e;\n }).promise;\n}\n\nexport const clarifyRequestErr = new Problem({\n detail: \"Please clarify your request and try again.\",\n title: \"SQL could not be generated from the input text.\",\n type: \"https://api.dremio.dev/problems/auto-produce-sql/clarify-request\",\n});\n"]}
@@ -1,15 +1,16 @@
1
- import { Err } from "ts-results-es";
2
1
  import type { SonarV3Config } from "../../common/Config.ts";
3
2
  import type { SignalParam } from "../../common/Params.ts";
4
3
  import { ArcticCatalog, type ArcticCatalogEntity } from "./ArcticCatalog.ts";
5
- export declare const ArcticResource: (config: SonarV3Config) => {
4
+ export declare class ArcticResource {
5
+ #private;
6
+ constructor(config: SonarV3Config);
6
7
  /**
7
8
  * @hidden
8
9
  * @internal
9
10
  */
10
- _createFromEntity: (entity: ArcticCatalogEntity) => ArcticCatalog;
11
- list: () => {
12
- data({ signal }?: SignalParam): AsyncGenerator<ArcticCatalog, void, unknown>;
11
+ _createFromEntity(entity: ArcticCatalogEntity): ArcticCatalog;
12
+ list(): {
13
+ data({ signal }?: SignalParam): AsyncGenerator<ArcticCatalog[], void, any>;
13
14
  };
14
- retrieve: (id: string, { signal }?: SignalParam) => Promise<ArcticCatalog | Err<unknown>>;
15
- };
15
+ retrieve(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<ArcticCatalog, import("../index.ts").HttpError>>;
16
+ }
@@ -13,28 +13,35 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Err } from "ts-results-es";
17
16
  import { ArcticCatalog, arcticCatalogEntityToProperties, } from "./ArcticCatalog.js";
18
- export const ArcticResource = (config) => {
19
- return {
20
- /**
21
- * @hidden
22
- * @internal
23
- */
24
- _createFromEntity: (entity) => new ArcticCatalog(arcticCatalogEntityToProperties(entity)),
25
- list: () => ({
17
+ export class ArcticResource {
18
+ #config;
19
+ constructor(config) {
20
+ this.#config = config;
21
+ }
22
+ /**
23
+ * @hidden
24
+ * @internal
25
+ */
26
+ _createFromEntity(entity) {
27
+ return new ArcticCatalog(arcticCatalogEntityToProperties(entity));
28
+ }
29
+ list() {
30
+ const l = ({ signal } = {}) => this.#config
31
+ .sonarV3Request("arctic/catalogs", { signal })
32
+ .map((res) => res.json())
33
+ .map((response) => response.data.map((entity) => this._createFromEntity(entity))).promise;
34
+ return {
26
35
  async *data({ signal } = {}) {
27
- yield* await config
28
- .sonarV3Request("arctic/catalogs", { signal })
29
- .then((res) => res.json())
30
- .then((response) => response.data.map((entity) => new ArcticCatalog(arcticCatalogEntityToProperties(entity))));
36
+ yield* await l({ signal });
31
37
  },
32
- }),
33
- retrieve: (id, { signal } = {}) => config
38
+ };
39
+ }
40
+ retrieve(id, { signal } = {}) {
41
+ return this.#config
34
42
  .sonarV3Request(`arctic/catalogs/${id}`, { signal })
35
- .then((res) => res.json())
36
- .then((entity) => new ArcticCatalog(arcticCatalogEntityToProperties(entity)))
37
- .catch((e) => Err(e)),
38
- };
39
- };
43
+ .map((res) => res.json())
44
+ .map((entity) => this._createFromEntity(entity)).promise;
45
+ }
46
+ }
40
47
  //# sourceMappingURL=ArcticResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArcticResource.js","sourceRoot":"","sources":["../../../src/cloud/arctic/ArcticResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EACL,aAAa,EACb,+BAA+B,GAEhC,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAqB,EAAE,EAAE;IACtD,OAAO;QACL;;;WAGG;QACH,iBAAiB,EAAE,CAAC,MAA2B,EAAE,EAAE,CACjD,IAAI,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;YACX,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,MAAM;qBAChB,cAAc,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,CAAC;qBAC7C,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;qBACzB,IAAI,CACH,CAAC,QAKA,EAAE,EAAE,CACH,QAAQ,CAAC,IAAI,CAAC,GAAG,CACf,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC,CACvE,CACJ,CAAC;YACN,CAAC;SACF,CAAC;QACF,QAAQ,EAAE,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CACrD,MAAM;aACH,cAAc,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACnD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACzB,IAAI,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC;aACjF,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACnC,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 { Err } from \"ts-results-es\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport {\n ArcticCatalog,\n arcticCatalogEntityToProperties,\n type ArcticCatalogEntity,\n} from \"./ArcticCatalog.ts\";\n\nexport const ArcticResource = (config: SonarV3Config) => {\n return {\n /**\n * @hidden\n * @internal\n */\n _createFromEntity: (entity: ArcticCatalogEntity) =>\n new ArcticCatalog(arcticCatalogEntityToProperties(entity)),\n list: () => ({\n async *data({ signal }: SignalParam = {}) {\n yield* await config\n .sonarV3Request(\"arctic/catalogs\", { signal })\n .then((res) => res.json())\n .then(\n (response: {\n data: ArcticCatalogEntity[];\n nextPageToken: string | null;\n previousPageToken: string | null;\n totalResults: number;\n }) =>\n response.data.map(\n (entity) => new ArcticCatalog(arcticCatalogEntityToProperties(entity)),\n ),\n );\n },\n }),\n retrieve: (id: string, { signal }: SignalParam = {}) =>\n config\n .sonarV3Request(`arctic/catalogs/${id}`, { signal })\n .then((res) => res.json())\n .then((entity: any) => new ArcticCatalog(arcticCatalogEntityToProperties(entity)))\n .catch((e: unknown) => Err(e)),\n };\n};\n"]}
1
+ {"version":3,"file":"ArcticResource.js","sourceRoot":"","sources":["../../../src/cloud/arctic/ArcticResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,aAAa,EACb,+BAA+B,GAEhC,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,cAAc;IAChB,OAAO,CAAgB;IAEhC,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAC,MAA2B;QAC3C,OAAO,IAAI,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CACzC,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,CAAC;aAC7C,GAAG,CACF,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,IAAI,EAKN,CACL;aACA,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9F,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7B,CAAC;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QAC/C,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACnD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAkC,CAAC;aACxD,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 { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport {\n ArcticCatalog,\n arcticCatalogEntityToProperties,\n type ArcticCatalogEntity,\n} from \"./ArcticCatalog.ts\";\n\nexport class ArcticResource {\n readonly #config: SonarV3Config;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n }\n\n /**\n * @hidden\n * @internal\n */\n _createFromEntity(entity: ArcticCatalogEntity) {\n return new ArcticCatalog(arcticCatalogEntityToProperties(entity));\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"arctic/catalogs\", { signal })\n .map(\n (res) =>\n res.json() as Promise<{\n data: ArcticCatalogEntity[];\n nextPageToken: string | null;\n previousPageToken: string | null;\n totalResults: number;\n }>,\n )\n .map((response) => response.data.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await l({ signal });\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`arctic/catalogs/${id}`, { signal })\n .map((res) => res.json() as Promise<ArcticCatalogEntity>)\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}
@@ -1,4 +1,3 @@
1
- import { type Result } from "ts-results-es";
2
1
  import type { SonarV3Config } from "../../common/Config.ts";
3
2
  import { Temporal } from "temporal-polyfill";
4
3
  export declare class Engine implements EngineInterface {
@@ -13,7 +12,7 @@ export declare class Engine implements EngineInterface {
13
12
  readonly statusChangedAt: EngineInterface["statusChangedAt"];
14
13
  readonly queriedAt: EngineInterface["queriedAt"];
15
14
  constructor(properties: EngineProperties, config: SonarV3Config);
16
- update(properties: Partial<EngineConfiguration>): Promise<Result<Engine, unknown>>;
15
+ update(properties: Partial<EngineConfiguration>): Promise<Engine>;
17
16
  }
18
17
  export type EngineSize = "XX_SMALL_V1" | "X_SMALL_V1" | "SMALL_V1" | "MEDIUM_V1" | "LARGE_V1" | "X_LARGE_V1" | "XX_LARGE_V1" | "XXX_LARGE_V1";
19
18
  export type EngineConfiguration = {
@@ -43,6 +42,6 @@ export type EngineProperties = {
43
42
  readonly queriedAt: Date | null;
44
43
  };
45
44
  export type EngineMethods = {
46
- update(properties: Partial<EngineConfiguration>): Promise<Result<Engine, unknown>>;
45
+ update(properties: Partial<EngineConfiguration>): Promise<Engine>;
47
46
  };
48
47
  export type EngineInterface = EngineProperties & EngineMethods;
@@ -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 { engineEntityToProperties, enginePropertiesToEntity } from "./utils.js";
18
17
  import { Temporal } from "temporal-polyfill";
19
18
  export class Engine {
@@ -39,8 +38,8 @@ export class Engine {
39
38
  this.queriedAt = properties.queriedAt;
40
39
  this.#config = config;
41
40
  }
42
- update(properties) {
43
- return this.#config
41
+ async update(properties) {
42
+ const result = await this.#config
44
43
  .sonarV3Request(`engines/${this.id}`, {
45
44
  body: JSON.stringify({
46
45
  ...enginePropertiesToEntity(this.configuration),
@@ -51,9 +50,9 @@ export class Engine {
51
50
  },
52
51
  method: "PUT",
53
52
  })
54
- .then((res) => res.json())
55
- .then((properties) => Ok(new Engine(engineEntityToProperties(properties), this.#config)))
56
- .catch((e) => Err(e));
53
+ .map((res) => res.json())
54
+ .map((properties) => new Engine(engineEntityToProperties(properties), this.#config)).promise;
55
+ return result.unwrap();
57
56
  }
58
57
  }
59
58
  //# sourceMappingURL=Engine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/cloud/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAM;IACR,cAAc,CAAoC;IAClD,yBAAyB,CAA+C;IACxE,aAAa,CAAmC;IAChD,EAAE,CAAwB;IAC1B,cAAc,CAAoC;IAClD,IAAI,CAA0B;IAC9B,KAAK,CAA2B;IAChC,eAAe,CAAqC;IACpD,SAAS,CAA+B;IAEjD,OAAO,CAAgB;IAEvB,YAAY,UAA4B,EAAE,MAAqB;QAC7D,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,yBAAyB,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACtE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,UAAwC;QAC7C,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,GAAG,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC;gBAC/C,GAAG,wBAAwB,CAAC,UAAU,CAAC;aACxC,CAAC;YACF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,EAAE,KAAK;SACd,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACzB,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;aACxF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,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, type Result } from \"ts-results-es\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { engineEntityToProperties, enginePropertiesToEntity } from \"./utils.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\nexport class Engine implements EngineInterface {\n readonly activeReplicas: EngineInterface[\"activeReplicas\"];\n readonly additionalEngineStateInfo: EngineInterface[\"additionalEngineStateInfo\"];\n readonly configuration: EngineInterface[\"configuration\"];\n readonly id: EngineInterface[\"id\"];\n readonly instanceFamily: EngineInterface[\"instanceFamily\"];\n readonly name: EngineInterface[\"name\"];\n readonly state: EngineInterface[\"state\"];\n readonly statusChangedAt: EngineInterface[\"statusChangedAt\"];\n readonly queriedAt: EngineInterface[\"queriedAt\"];\n\n #config: SonarV3Config;\n\n constructor(properties: EngineProperties, config: SonarV3Config) {\n this.activeReplicas = properties.activeReplicas;\n this.additionalEngineStateInfo = properties.additionalEngineStateInfo;\n this.configuration = properties.configuration;\n this.id = properties.id;\n this.instanceFamily = properties.instanceFamily;\n this.name = properties.name;\n this.state = properties.state;\n this.statusChangedAt = properties.statusChangedAt;\n this.queriedAt = properties.queriedAt;\n this.#config = config;\n }\n\n update(properties: Partial<EngineConfiguration>): Promise<Result<Engine, unknown>> {\n return this.#config\n .sonarV3Request(`engines/${this.id}`, {\n body: JSON.stringify({\n ...enginePropertiesToEntity(this.configuration),\n ...enginePropertiesToEntity(properties),\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n method: \"PUT\",\n })\n .then((res) => res.json())\n .then((properties) => Ok(new Engine(engineEntityToProperties(properties), this.#config)))\n .catch((e) => Err(e));\n }\n}\n\nexport type EngineSize =\n | \"XX_SMALL_V1\"\n | \"X_SMALL_V1\"\n | \"SMALL_V1\"\n | \"MEDIUM_V1\"\n | \"LARGE_V1\"\n | \"X_LARGE_V1\"\n | \"XX_LARGE_V1\"\n | \"XXX_LARGE_V1\";\n\nexport type EngineConfiguration = {\n readonly autoStopDelay: Temporal.Duration;\n readonly cloudTags: { key: string; value: string }[];\n readonly description: string | null;\n readonly drainTimeLimit: Temporal.Duration;\n readonly maxConcurrency: number;\n readonly maxReplicas: number;\n readonly minReplicas: number;\n readonly queueTimeLimit: Temporal.Duration;\n readonly runTimeLimit: Temporal.Duration;\n readonly size: EngineSize;\n};\n\nexport type EngineProperties = {\n readonly activeReplicas: number;\n readonly additionalEngineStateInfo: \"NONE\";\n readonly configuration: EngineConfiguration;\n readonly id: string;\n readonly instanceFamily: unknown;\n readonly name: string;\n readonly state: \"DELETING\" | \"DISABLED\" | \"DISABLING\" | \"ENABLED\" | \"ENABLING\" | \"INVALID\";\n readonly statusChangedAt: Date;\n readonly queriedAt: Date | null;\n};\n\nexport type EngineMethods = {\n update(properties: Partial<EngineConfiguration>): Promise<Result<Engine, unknown>>;\n};\n\nexport type EngineInterface = EngineProperties & EngineMethods;\n"]}
1
+ {"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/cloud/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAM;IACR,cAAc,CAAoC;IAClD,yBAAyB,CAA+C;IACxE,aAAa,CAAmC;IAChD,EAAE,CAAwB;IAC1B,cAAc,CAAoC;IAClD,IAAI,CAA0B;IAC9B,KAAK,CAA2B;IAChC,eAAe,CAAqC;IACpD,SAAS,CAA+B;IAEjD,OAAO,CAAgB;IAEvB,YAAY,UAA4B,EAAE,MAAqB;QAC7D,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,yBAAyB,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACtE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAwC;QACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO;aAC9B,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,GAAG,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC;gBAC/C,GAAG,wBAAwB,CAAC,UAAU,CAAC;aACxC,CAAC;YACF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/F,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;IACzB,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 { engineEntityToProperties, enginePropertiesToEntity } from \"./utils.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\nexport class Engine implements EngineInterface {\n readonly activeReplicas: EngineInterface[\"activeReplicas\"];\n readonly additionalEngineStateInfo: EngineInterface[\"additionalEngineStateInfo\"];\n readonly configuration: EngineInterface[\"configuration\"];\n readonly id: EngineInterface[\"id\"];\n readonly instanceFamily: EngineInterface[\"instanceFamily\"];\n readonly name: EngineInterface[\"name\"];\n readonly state: EngineInterface[\"state\"];\n readonly statusChangedAt: EngineInterface[\"statusChangedAt\"];\n readonly queriedAt: EngineInterface[\"queriedAt\"];\n\n #config: SonarV3Config;\n\n constructor(properties: EngineProperties, config: SonarV3Config) {\n this.activeReplicas = properties.activeReplicas;\n this.additionalEngineStateInfo = properties.additionalEngineStateInfo;\n this.configuration = properties.configuration;\n this.id = properties.id;\n this.instanceFamily = properties.instanceFamily;\n this.name = properties.name;\n this.state = properties.state;\n this.statusChangedAt = properties.statusChangedAt;\n this.queriedAt = properties.queriedAt;\n this.#config = config;\n }\n\n async update(properties: Partial<EngineConfiguration>): Promise<Engine> {\n const result = await this.#config\n .sonarV3Request(`engines/${this.id}`, {\n body: JSON.stringify({\n ...enginePropertiesToEntity(this.configuration),\n ...enginePropertiesToEntity(properties),\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n method: \"PUT\",\n })\n .map((res) => res.json())\n .map((properties) => new Engine(engineEntityToProperties(properties), this.#config)).promise;\n return result.unwrap();\n }\n}\n\nexport type EngineSize =\n | \"XX_SMALL_V1\"\n | \"X_SMALL_V1\"\n | \"SMALL_V1\"\n | \"MEDIUM_V1\"\n | \"LARGE_V1\"\n | \"X_LARGE_V1\"\n | \"XX_LARGE_V1\"\n | \"XXX_LARGE_V1\";\n\nexport type EngineConfiguration = {\n readonly autoStopDelay: Temporal.Duration;\n readonly cloudTags: { key: string; value: string }[];\n readonly description: string | null;\n readonly drainTimeLimit: Temporal.Duration;\n readonly maxConcurrency: number;\n readonly maxReplicas: number;\n readonly minReplicas: number;\n readonly queueTimeLimit: Temporal.Duration;\n readonly runTimeLimit: Temporal.Duration;\n readonly size: EngineSize;\n};\n\nexport type EngineProperties = {\n readonly activeReplicas: number;\n readonly additionalEngineStateInfo: \"NONE\";\n readonly configuration: EngineConfiguration;\n readonly id: string;\n readonly instanceFamily: unknown;\n readonly name: string;\n readonly state: \"DELETING\" | \"DISABLED\" | \"DISABLING\" | \"ENABLED\" | \"ENABLING\" | \"INVALID\";\n readonly statusChangedAt: Date;\n readonly queriedAt: Date | null;\n};\n\nexport type EngineMethods = {\n update(properties: Partial<EngineConfiguration>): Promise<Engine>;\n};\n\nexport type EngineInterface = EngineProperties & EngineMethods;\n"]}
@@ -1,15 +1,12 @@
1
- import { Ok } from "ts-results-es";
2
1
  import type { ResourceConfig, SonarV3Config } from "../../common/Config.ts";
3
2
  import { Engine } from "./Engine.ts";
4
3
  import type { SignalParam } from "../../common/Params.ts";
5
- export declare const EnginesResource: (config: ResourceConfig & SonarV3Config) => {
6
- /**
7
- * @hidden
8
- * @internal
9
- */
10
- _createFromEntity: (properties: unknown) => Engine;
11
- list: () => {
12
- data({ signal }?: SignalParam): AsyncGenerator<any, void, any>;
4
+ export declare class EnginesResource {
5
+ #private;
6
+ constructor(config: ResourceConfig & SonarV3Config);
7
+ _createFromEntity(properties: unknown): Engine;
8
+ list(): {
9
+ data({ signal }?: SignalParam): AsyncGenerator<Engine[], void, any>;
13
10
  };
14
- retrieve: (id: string) => Promise<Ok<Engine>>;
15
- };
11
+ retrieve(id: string): Promise<import("ts-results-es").Result<Engine, import("../index.ts").HttpError>>;
12
+ }
@@ -13,30 +13,32 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Ok } from "ts-results-es";
17
16
  import { Engine } from "./Engine.js";
18
17
  import { engineEntityToProperties } from "./utils.js";
19
- export const EnginesResource = (config) => {
20
- return {
21
- /**
22
- * @hidden
23
- * @internal
24
- */
25
- _createFromEntity: (properties) => new Engine(engineEntityToProperties(properties), config),
26
- list: () => {
27
- return {
28
- async *data({ signal } = {}) {
29
- yield* await config
30
- .sonarV3Request("engines", { signal })
31
- .then((res) => res.json())
32
- .then((engines) => engines.map((properties) => new Engine(engineEntityToProperties(properties), config)));
33
- },
34
- };
35
- },
36
- retrieve: (id) => config
18
+ export class EnginesResource {
19
+ #config;
20
+ constructor(config) {
21
+ this.#config = config;
22
+ }
23
+ _createFromEntity(properties) {
24
+ return new Engine(engineEntityToProperties(properties), this.#config);
25
+ }
26
+ list() {
27
+ const l = ({ signal } = {}) => this.#config
28
+ .sonarV3Request("engines", { signal })
29
+ .map((res) => res.json())
30
+ .map((engines) => engines.map((entity) => this._createFromEntity(entity))).promise;
31
+ return {
32
+ async *data({ signal } = {}) {
33
+ yield* await l({ signal });
34
+ },
35
+ };
36
+ }
37
+ retrieve(id) {
38
+ return this.#config
37
39
  .sonarV3Request(`engines/${id}`)
38
- .then((res) => res.json())
39
- .then((properties) => Ok(new Engine(engineEntityToProperties(properties), config))),
40
- };
41
- };
40
+ .map((res) => res.json())
41
+ .map((entity) => this._createFromEntity(entity)).promise;
42
+ }
43
+ }
42
44
  //# sourceMappingURL=EnginesResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/cloud/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGtD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAsC,EAAE,EAAE;IACxE,OAAO;QACL;;;WAGG;QACH,iBAAiB,EAAE,CAAC,UAAmB,EAAE,EAAE,CACzC,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAC1D,IAAI,EAAE,GAAG,EAAE;YACT,OAAO;gBACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;oBACtC,KAAK,CAAC,CAAC,MAAM,MAAM;yBAChB,cAAc,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC;yBACrC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;yBACzB,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAChB,OAAO,CAAC,GAAG,CACT,CAAC,UAAmB,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAClF,CACF,CAAC;gBACN,CAAC;aACF,CAAC;QACJ,CAAC;QAED,QAAQ,EAAE,CAAC,EAAU,EAAE,EAAE,CACvB,MAAM;aACH,cAAc,CAAC,WAAW,EAAE,EAAE,CAAC;aAC/B,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACzB,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;KACxF,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 { Ok } from \"ts-results-es\";\nimport type { ResourceConfig, SonarV3Config } from \"../../common/Config.ts\";\nimport { Engine } from \"./Engine.ts\";\nimport { engineEntityToProperties } from \"./utils.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport const EnginesResource = (config: ResourceConfig & SonarV3Config) => {\n return {\n /**\n * @hidden\n * @internal\n */\n _createFromEntity: (properties: unknown) =>\n new Engine(engineEntityToProperties(properties), config),\n list: () => {\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await config\n .sonarV3Request(\"engines\", { signal })\n .then((res) => res.json())\n .then((engines) =>\n engines.map(\n (properties: unknown) => new Engine(engineEntityToProperties(properties), config),\n ),\n );\n },\n };\n },\n\n retrieve: (id: string) =>\n config\n .sonarV3Request(`engines/${id}`)\n .then((res) => res.json())\n .then((properties) => Ok(new Engine(engineEntityToProperties(properties), config))),\n };\n};\n"]}
1
+ {"version":3,"file":"EnginesResource.js","sourceRoot":"","sources":["../../../src/cloud/engines/EnginesResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGtD,MAAM,OAAO,eAAe;IACjB,OAAO,CAAiC;IAEjD,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,UAAmB;QACnC,OAAO,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACxE,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,KAAkB,EAAE,EAAE,EAAE,CACzC,IAAI,CAAC,OAAO;aACT,cAAc,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC;aACrC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAwB,CAAC;aAC9C,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACvF,OAAO;YACL,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAkB,EAAE;gBACtC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7B,CAAC;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,EAAE,EAAE,CAAC;aAC/B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACxB,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, SonarV3Config } from \"../../common/Config.ts\";\nimport { Engine } from \"./Engine.ts\";\nimport { engineEntityToProperties } from \"./utils.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class EnginesResource {\n readonly #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n _createFromEntity(properties: unknown) {\n return new Engine(engineEntityToProperties(properties), this.#config);\n }\n\n list() {\n const l = ({ signal }: SignalParam = {}) =>\n this.#config\n .sonarV3Request(\"engines\", { signal })\n .map((res) => res.json() as Promise<unknown[]>)\n .map((engines) => engines.map((entity) => this._createFromEntity(entity))).promise;\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await l({ signal });\n },\n };\n }\n\n retrieve(id: string) {\n return this.#config\n .sonarV3Request(`engines/${id}`)\n .map((res) => res.json())\n .map((entity) => this._createFromEntity(entity)).promise;\n }\n}\n"]}