@dremio/js-sdk 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) 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 +1 -2
  5. package/dist/cloud/arctic/ArcticResource.js +5 -7
  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 +1 -1
  11. package/dist/cloud/engines/EnginesResource.js +5 -5
  12. package/dist/cloud/engines/EnginesResource.js.map +1 -1
  13. package/dist/cloud/index.d.ts +3 -5
  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 +2 -3
  20. package/dist/cloud/oauth/OAuthApplicationsResource.js +8 -11
  21. package/dist/cloud/oauth/OAuthApplicationsResource.js.map +1 -1
  22. package/dist/cloud/projects/Project.d.ts +2 -2
  23. package/dist/cloud/projects/ProjectsResource.d.ts +3 -4
  24. package/dist/cloud/projects/ProjectsResource.js +8 -17
  25. package/dist/cloud/projects/ProjectsResource.js.map +1 -1
  26. package/dist/cloud/users/CloudUsersResource.d.ts +2 -3
  27. package/dist/cloud/users/CloudUsersResource.js +4 -7
  28. package/dist/cloud/users/CloudUsersResource.js.map +1 -1
  29. package/dist/common/Config.d.ts +4 -2
  30. package/dist/common/Config.js.map +1 -1
  31. package/dist/common/HttpError.d.ts +7 -13
  32. package/dist/common/HttpError.js +19 -36
  33. package/dist/common/HttpError.js.map +1 -1
  34. package/dist/common/Problem.d.ts +29 -34
  35. package/dist/common/Problem.js +47 -19
  36. package/dist/common/Problem.js.map +1 -1
  37. package/dist/common/createRequest.js +8 -33
  38. package/dist/common/createRequest.js.map +1 -1
  39. package/dist/common/problems.d.ts +11 -9
  40. package/dist/common/problems.js +18 -9
  41. package/dist/common/problems.js.map +1 -1
  42. package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.d.ts +2 -3
  43. package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.js +3 -5
  44. package/dist/enterprise/catalog/CatalogReferences/retrieveCatalogGrants.js.map +1 -1
  45. package/dist/enterprise/catalog/EnterpriseCatalogResource.js +3 -2
  46. package/dist/enterprise/catalog/EnterpriseCatalogResource.js.map +1 -1
  47. package/dist/enterprise/catalog/catalogRetrieve.js +4 -0
  48. package/dist/enterprise/catalog/catalogRetrieve.js.map +1 -1
  49. package/dist/enterprise/credentials/exchangePat.d.ts +2 -4
  50. package/dist/enterprise/credentials/exchangePat.js +3 -3
  51. package/dist/enterprise/credentials/exchangePat.js.map +1 -1
  52. package/dist/enterprise/engines/Engine.d.ts +3 -5
  53. package/dist/enterprise/engines/Engine.js +7 -11
  54. package/dist/enterprise/engines/Engine.js.map +1 -1
  55. package/dist/enterprise/engines/EnginesResource.d.ts +1 -3
  56. package/dist/enterprise/engines/EnginesResource.js +5 -7
  57. package/dist/enterprise/engines/EnginesResource.js.map +1 -1
  58. package/dist/enterprise/index.d.ts +7 -9
  59. package/dist/enterprise/index.js +0 -1
  60. package/dist/enterprise/index.js.map +1 -1
  61. package/dist/enterprise/roles/RolesResource.d.ts +2 -3
  62. package/dist/enterprise/roles/RolesResource.js +4 -7
  63. package/dist/enterprise/roles/RolesResource.js.map +1 -1
  64. package/dist/enterprise/scripts/EnterpriseScript.d.ts +3 -13
  65. package/dist/enterprise/scripts/EnterpriseScript.js +4 -6
  66. package/dist/enterprise/scripts/EnterpriseScript.js.map +1 -1
  67. package/dist/enterprise/scripts/EnterpriseScriptsResource.d.ts +6 -2
  68. package/dist/enterprise/scripts/EnterpriseScriptsResource.js +1 -1
  69. package/dist/enterprise/scripts/EnterpriseScriptsResource.js.map +1 -1
  70. package/dist/enterprise/users/EnterpriseUser.d.ts +2 -3
  71. package/dist/enterprise/users/EnterpriseUser.js +3 -5
  72. package/dist/enterprise/users/EnterpriseUser.js.map +1 -1
  73. package/dist/enterprise/users/EnterpriseUsersResource.d.ts +2 -3
  74. package/dist/enterprise/users/EnterpriseUsersResource.js +4 -7
  75. package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
  76. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.d.ts +1 -1
  77. package/dist/oss/catalog/CatalogReferences/FolderCatalogReference.d.ts +1 -1
  78. package/dist/oss/catalog/CatalogReferences/HomeCatalogReference.d.ts +1 -1
  79. package/dist/oss/catalog/CatalogReferences/SourceCatalogReference.d.ts +1 -1
  80. package/dist/oss/catalog/CatalogReferences/SpaceCatalogReference.d.ts +1 -1
  81. package/dist/oss/catalog/CatalogReferences/utils/catalogChildren.js +1 -0
  82. package/dist/oss/catalog/CatalogReferences/utils/catalogChildren.js.map +1 -1
  83. package/dist/oss/catalog/CatalogReferences/utils/getTags.d.ts +1 -2
  84. package/dist/oss/catalog/CatalogReferences/utils/getTags.js +2 -4
  85. package/dist/oss/catalog/CatalogReferences/utils/getTags.js.map +1 -1
  86. package/dist/oss/catalog/CatalogReferences/utils/getWiki.d.ts +1 -2
  87. package/dist/oss/catalog/CatalogReferences/utils/getWiki.js +2 -4
  88. package/dist/oss/catalog/CatalogReferences/utils/getWiki.js.map +1 -1
  89. package/dist/oss/catalog/CatalogResource.js +1 -0
  90. package/dist/oss/catalog/CatalogResource.js.map +1 -1
  91. package/dist/oss/catalog/CatalogTags.d.ts +2 -6
  92. package/dist/oss/catalog/CatalogTags.js +8 -13
  93. package/dist/oss/catalog/CatalogTags.js.map +1 -1
  94. package/dist/oss/catalog/CatalogWiki.d.ts +2 -6
  95. package/dist/oss/catalog/CatalogWiki.js +8 -13
  96. package/dist/oss/catalog/CatalogWiki.js.map +1 -1
  97. package/dist/oss/catalog/catalogErrors.d.ts +3 -14
  98. package/dist/oss/catalog/catalogErrors.js +9 -12
  99. package/dist/oss/catalog/catalogErrors.js.map +1 -1
  100. package/dist/oss/catalog/catalogRetrieve.d.ts +3 -2
  101. package/dist/oss/catalog/catalogRetrieve.js +6 -2
  102. package/dist/oss/catalog/catalogRetrieve.js.map +1 -1
  103. package/dist/oss/index.d.ts +4 -7
  104. package/dist/oss/index.js +0 -1
  105. package/dist/oss/index.js.map +1 -1
  106. package/dist/oss/jobs/Job.d.ts +3 -3
  107. package/dist/oss/jobs/Job.js +7 -9
  108. package/dist/oss/jobs/Job.js.map +1 -1
  109. package/dist/oss/jobs/JobsResource.d.ts +4 -5
  110. package/dist/oss/jobs/JobsResource.js +5 -7
  111. package/dist/oss/jobs/JobsResource.js.map +1 -1
  112. package/dist/oss/scripts/Script.d.ts +3 -22
  113. package/dist/oss/scripts/Script.js +12 -16
  114. package/dist/oss/scripts/Script.js.map +1 -1
  115. package/dist/oss/scripts/ScriptErrors.d.ts +6 -18
  116. package/dist/oss/scripts/ScriptErrors.js +10 -13
  117. package/dist/oss/scripts/ScriptErrors.js.map +1 -1
  118. package/dist/oss/scripts/ScriptsResource.d.ts +14 -6
  119. package/dist/oss/scripts/ScriptsResource.js +19 -21
  120. package/dist/oss/scripts/ScriptsResource.js.map +1 -1
  121. package/dist/oss/users/UsersResource.d.ts +2 -3
  122. package/dist/oss/users/UsersResource.js +4 -7
  123. package/dist/oss/users/UsersResource.js.map +1 -1
  124. package/package.json +1 -1
@@ -13,7 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export const scriptNotFoundError = (id) => ({
16
+ import { Problem, ValidationProblem } from "../../common/Problem.js";
17
+ export const scriptNotFoundError = (id) => new Problem({
17
18
  meta: {
18
19
  provided: {
19
20
  id,
@@ -22,16 +23,12 @@ export const scriptNotFoundError = (id) => ({
22
23
  title: "The script could not be found or you do not have permission to view it",
23
24
  type: "https://api.dremio.dev/problems/scripts/not-found",
24
25
  });
25
- export const duplicateScriptNameError = (name) => ({
26
- errors: [
27
- {
28
- detail: "A script with this name already exists",
29
- pointer: "#/name",
30
- type: "https://api.dremio.dev/problems/validation/field-conflict",
31
- value: name,
32
- },
33
- ],
34
- title: "There was a problem validating the content of the request",
35
- type: "https://api.dremio.dev/problems/validation-problem",
36
- });
26
+ export const duplicateScriptNameError = (name) => new ValidationProblem([
27
+ {
28
+ detail: "A script with this name already exists",
29
+ pointer: "#/name",
30
+ type: "https://api.dremio.dev/problems/validation/field-conflict",
31
+ value: name,
32
+ },
33
+ ]);
37
34
  //# sourceMappingURL=ScriptErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptErrors.js","sourceRoot":"","sources":["../../../src/oss/scripts/ScriptErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAU,EAAE,EAAE,CAChD,CAAC;IACC,IAAI,EAAE;QACJ,QAAQ,EAAE;YACR,EAAE;SACH;KACF;IACD,KAAK,EAAE,wEAAwE;IAC/E,IAAI,EAAE,mDAAmD;CAC1D,CAA4B,CAAC;AAEhC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,EAAE,CACvD,CAAC;IACC,MAAM,EAAE;QACN;YACE,MAAM,EAAE,wCAAwC;YAChD,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE,2DAA2D;YACjE,KAAK,EAAE,IAAI;SACZ;KACF;IACD,KAAK,EAAE,2DAA2D;IAClE,IAAI,EAAE,oDAAoD;CAC3D,CAAsC,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 { Problem, ValidationProblem } from \"../../common/Problem.ts\";\n\nexport const scriptNotFoundError = (id: string) =>\n ({\n meta: {\n provided: {\n id,\n },\n },\n title: \"The script could not be found or you do not have permission to view it\",\n type: \"https://api.dremio.dev/problems/scripts/not-found\",\n }) as const satisfies Problem;\n\nexport const duplicateScriptNameError = (name: string) =>\n ({\n errors: [\n {\n detail: \"A script with this name already exists\",\n pointer: \"#/name\",\n type: \"https://api.dremio.dev/problems/validation/field-conflict\",\n value: name,\n },\n ],\n title: \"There was a problem validating the content of the request\",\n type: \"https://api.dremio.dev/problems/validation-problem\",\n }) as const satisfies ValidationProblem;\n"]}
1
+ {"version":3,"file":"ScriptErrors.js","sourceRoot":"","sources":["../../../src/oss/scripts/ScriptErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAU,EAAE,EAAE,CAChD,IAAI,OAAO,CAAC;IACV,IAAI,EAAE;QACJ,QAAQ,EAAE;YACR,EAAE;SACH;KACF;IACD,KAAK,EAAE,wEAAwE;IAC/E,IAAI,EAAE,mDAAmD;CAC1D,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,EAAE,CACvD,IAAI,iBAAiB,CAAC;IACpB;QACE,MAAM,EAAE,wCAAwC;QAChD,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,2DAA2D;QACjE,KAAK,EAAE,IAAI;KACZ;CACF,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 { Problem, ValidationProblem } from \"../../common/Problem.js\";\n\nexport const scriptNotFoundError = (id: string) =>\n new Problem({\n meta: {\n provided: {\n id,\n },\n },\n title: \"The script could not be found or you do not have permission to view it\",\n type: \"https://api.dremio.dev/problems/scripts/not-found\",\n });\n\nexport const duplicateScriptNameError = (name: string) =>\n new ValidationProblem([\n {\n detail: \"A script with this name already exists\",\n pointer: \"#/name\",\n type: \"https://api.dremio.dev/problems/validation/field-conflict\",\n value: name,\n },\n ]);\n"]}
@@ -1,8 +1,8 @@
1
1
  import type { ResourceConfig, SonarV3Config } from "../../common/Config.ts";
2
2
  import { Script, type ScriptEntity } from "./Script.ts";
3
- import { Ok, Err } from "ts-results-es";
4
3
  import type { Query } from "../../common/Query.ts";
5
4
  import type { SignalParam } from "../../common/Params.ts";
5
+ import { Problem } from "../../common/Problem.ts";
6
6
  export declare class ScriptsResource {
7
7
  #private;
8
8
  constructor(config: ResourceConfig & SonarV3Config);
@@ -10,15 +10,23 @@ export declare class ScriptsResource {
10
10
  list(): {
11
11
  data({ signal }?: SignalParam): AsyncGenerator<Script, void, unknown>;
12
12
  };
13
- retrieve(id: string, { signal }?: SignalParam): Promise<Err<unknown> | Ok<Script>>;
13
+ retrieve(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<Script, import("../index.ts").HttpError | Problem<"https://api.dremio.dev/problems/scripts/not-found", {
14
+ provided: {
15
+ id: string;
16
+ };
17
+ }>>>;
14
18
  store(properties: {
15
19
  name: string;
16
20
  query: Query;
17
- }): Promise<Err<unknown> | Ok<Script>>;
21
+ }): Promise<import("ts-results-es").Result<Script, import("../../common/Problem.ts").ValidationProblem | import("../index.ts").HttpError>>;
18
22
  }
19
- export declare const listScripts: <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) => ({ signal }?: SignalParam) => Promise<S[]>;
20
- export declare const retrieveScript: <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) => (id: string, { signal }?: SignalParam) => Promise<Err<unknown> | Ok<S>>;
23
+ export declare const listScripts: <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) => ({ signal }?: SignalParam) => Promise<import("ts-results-es").Result<S[], import("../index.ts").HttpError>>;
24
+ export declare const retrieveScript: <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) => (id: string, { signal }?: SignalParam) => Promise<import("ts-results-es").Result<S, import("../index.ts").HttpError | Problem<"https://api.dremio.dev/problems/scripts/not-found", {
25
+ provided: {
26
+ id: string;
27
+ };
28
+ }>>>;
21
29
  export declare const storeScript: <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) => (properties: {
22
30
  name: string;
23
31
  query: Query;
24
- }) => Promise<Err<unknown> | Ok<S>>;
32
+ }) => Promise<import("ts-results-es").Result<S, import("../../common/Problem.ts").ValidationProblem | import("../index.ts").HttpError>>;
@@ -14,10 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Script, scriptEntityToProperties } from "./Script.js";
17
- import { Ok, Err } from "ts-results-es";
18
- import { HttpError } from "../../common/HttpError.js";
19
- import { isProblem } from "../../common/Problem.js";
20
17
  import { duplicateScriptNameError, scriptNotFoundError } from "./ScriptErrors.js";
18
+ import { Problem } from "../../common/Problem.js";
21
19
  export class ScriptsResource {
22
20
  #config;
23
21
  constructor(config) {
@@ -30,7 +28,7 @@ export class ScriptsResource {
30
28
  const l = listScripts(this.#config, this._scriptFromEntity.bind(this));
31
29
  return {
32
30
  async *data({ signal } = {}) {
33
- yield* await l({ signal });
31
+ yield* (await l({ signal })).unwrap();
34
32
  },
35
33
  };
36
34
  }
@@ -42,17 +40,17 @@ export class ScriptsResource {
42
40
  }
43
41
  }
44
42
  export const listScripts = ({ sonarV3Request }, _scriptFromEntity) => ({ signal } = {}) => sonarV3Request("scripts?maxResults=1000", { signal })
45
- .then((res) => res.json())
46
- .then((response) => response.data.map((entity) => _scriptFromEntity(entity)));
43
+ .map((response) => response.json())
44
+ .map((response) => response.data.map((entity) => _scriptFromEntity(entity))).promise;
47
45
  export const retrieveScript = ({ sonarV3Request }, _scriptFromEntity) => (id, { signal } = {}) => sonarV3Request(`scripts/${id}`, { signal })
48
- .then((res) => res.json())
49
- .then((entity) => Ok(_scriptFromEntity(entity)))
50
- .catch((e) => {
51
- if (e instanceof HttpError && e.status === 404) {
52
- return Err(scriptNotFoundError(id));
46
+ .map((response) => response.json())
47
+ .map((entity) => _scriptFromEntity(entity))
48
+ .mapErr((err) => {
49
+ if (err.status === 404) {
50
+ return scriptNotFoundError(id);
53
51
  }
54
- return Err(e);
55
- });
52
+ return err;
53
+ }).promise;
56
54
  export const storeScript = ({ sonarV3Request }, _scriptFromEntity) => (properties) => {
57
55
  const { query, ...rest } = properties;
58
56
  return sonarV3Request("scripts", {
@@ -67,14 +65,14 @@ export const storeScript = ({ sonarV3Request }, _scriptFromEntity) => (propertie
67
65
  keepalive: true,
68
66
  method: "POST",
69
67
  })
70
- .then((res) => res.json())
71
- .then((entity) => Ok(_scriptFromEntity(entity)))
72
- .catch((e) => {
73
- if (e instanceof HttpError && isProblem(e.body)) {
74
- if (e.body.detail?.includes("Cannot reuse the same script name"))
75
- return Err(duplicateScriptNameError(properties.name));
68
+ .map((response) => response.json())
69
+ .map((entity) => _scriptFromEntity(entity))
70
+ .mapErr((err) => {
71
+ if (err.body instanceof Problem &&
72
+ err.body.detail?.includes("Cannot reuse the same script name")) {
73
+ return duplicateScriptNameError(properties.name);
76
74
  }
77
- return Err(e);
78
- });
75
+ return err;
76
+ }).promise;
79
77
  };
80
78
  //# sourceMappingURL=ScriptsResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScriptsResource.js","sourceRoot":"","sources":["../../../src/oss/scripts/ScriptsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAqB,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAElF,MAAM,OAAO,eAAe;IAC1B,OAAO,CAAiC;IAExC,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,MAAoB;QACpC,OAAO,IAAI,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACvE,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,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CA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AAmB,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC;AAET,MAAM,CAAC,MAAM,WAAW,GACtB,CAAO,EAAE,cAAc,EAAiB,EAAE,iBAAmC,EAAE,EAAE,CACjF,CAAC,UAA0C,EAAE,EAAE;IAC7C,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;IACtC,OAAO,cAAc,CAAC,SAAS,EAAE;QAC/B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,GAAG,IAAI;YACP,OAAO,EAAE,KAAK,CAAC,GAAG;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC;QACF,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,MAAM;KACf,CAAC;SACC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAgB,CAAC;SACvC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;SAC/C,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;QACpB,IAAI,CAAC,YAAY,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,mCAAmC,CAAC;gBAC9D,OAAO,GAAG,CAAC,wBAAwB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,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, SonarV3Config } from \"../../common/Config.ts\";\nimport { Script, scriptEntityToProperties, type ScriptEntity } from \"./Script.ts\";\nimport { Ok, Err } from \"ts-results-es\";\nimport { HttpError } from \"../../common/HttpError.ts\";\nimport { isProblem } from \"../../common/Problem.ts\";\nimport type { Query } from \"../../common/Query.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { duplicateScriptNameError, scriptNotFoundError } from \"./ScriptErrors.ts\";\n\nexport class ScriptsResource {\n #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n _scriptFromEntity(entity: ScriptEntity) {\n return new Script(scriptEntityToProperties(entity), this.#config);\n }\n\n list() {\n const l = listScripts(this.#config, this._scriptFromEntity.bind(this));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* await l({ signal });\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return retrieveScript(this.#config, this._scriptFromEntity.bind(this))(id, { signal });\n }\n\n store(properties: { name: string; query: Query }) {\n return storeScript(this.#config, this._scriptFromEntity.bind(this))(properties);\n }\n}\n\nexport const listScripts =\n <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) =>\n ({ signal }: SignalParam = {}) =>\n sonarV3Request(\"scripts?maxResults=1000\", { signal })\n .then((res) => res.json() as Promise<{ data: E[] }>)\n .then((response) => response.data.map((entity) => _scriptFromEntity(entity)));\n\nexport const retrieveScript =\n <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) =>\n (id: string, { signal }: SignalParam = {}) =>\n sonarV3Request(`scripts/${id}`, { signal })\n .then((res) => res.json() as Promise<E>)\n .then((entity) => Ok(_scriptFromEntity(entity)))\n .catch((e: unknown) => {\n if (e instanceof HttpError && e.status === 404) {\n return Err(scriptNotFoundError(id));\n }\n return Err(e);\n });\n\nexport const storeScript =\n <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) =>\n (properties: { name: string; query: Query }) => {\n const { query, ...rest } = properties;\n return sonarV3Request(\"scripts\", {\n body: JSON.stringify({\n ...rest,\n content: query.sql,\n context: query.context,\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .then((res) => res.json() as Promise<E>)\n .then((entity) => Ok(_scriptFromEntity(entity)))\n .catch((e: unknown) => {\n if (e instanceof HttpError && isProblem(e.body)) {\n if (e.body.detail?.includes(\"Cannot reuse the same script name\"))\n return Err(duplicateScriptNameError(properties.name));\n }\n return Err(e);\n });\n };\n"]}
1
+ {"version":3,"file":"ScriptsResource.js","sourceRoot":"","sources":["../../../src/oss/scripts/ScriptsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAqB,MAAM,aAAa,CAAC;AAGlF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,MAAM,OAAO,eAAe;IAC1B,OAAO,CAAiC;IAExC,YAAY,MAAsC;QAChD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,MAAoB;QACpC,OAAO,IAAI,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,IAAI;QACF,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,C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9D,CAAC;YACD,OAAO,wBAAwB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC,OAAO,CAAC;AACf,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, SonarV3Config } from \"../../common/Config.ts\";\nimport { Script, scriptEntityToProperties, type ScriptEntity } from \"./Script.ts\";\nimport type { Query } from \"../../common/Query.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { duplicateScriptNameError, scriptNotFoundError } from \"./ScriptErrors.ts\";\nimport { Problem } from \"../../common/Problem.ts\";\n\nexport class ScriptsResource {\n #config: ResourceConfig & SonarV3Config;\n\n constructor(config: ResourceConfig & SonarV3Config) {\n this.#config = config;\n }\n\n _scriptFromEntity(entity: ScriptEntity) {\n return new Script(scriptEntityToProperties(entity), this.#config);\n }\n\n list() {\n const l = listScripts(this.#config, this._scriptFromEntity.bind(this));\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await l({ signal })).unwrap();\n },\n };\n }\n\n retrieve(id: string, { signal }: SignalParam = {}) {\n return retrieveScript(this.#config, this._scriptFromEntity.bind(this))(id, { signal });\n }\n\n store(properties: { name: string; query: Query }) {\n return storeScript(this.#config, this._scriptFromEntity.bind(this))(properties);\n }\n}\n\nexport const listScripts =\n <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) =>\n ({ signal }: SignalParam = {}) =>\n sonarV3Request(\"scripts?maxResults=1000\", { signal })\n .map((response) => response.json() as Promise<{ data: E[] }>)\n .map((response) => response.data.map((entity) => _scriptFromEntity(entity))).promise;\n\nexport const retrieveScript =\n <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) =>\n (id: string, { signal }: SignalParam = {}) =>\n sonarV3Request(`scripts/${id}`, { signal })\n .map((response) => response.json() as Promise<E>)\n .map((entity) => _scriptFromEntity(entity))\n .mapErr((err) => {\n if (err.status === 404) {\n return scriptNotFoundError(id);\n }\n return err;\n }).promise;\n\nexport const storeScript =\n <E, S>({ sonarV3Request }: SonarV3Config, _scriptFromEntity: (entity: E) => S) =>\n (properties: { name: string; query: Query }) => {\n const { query, ...rest } = properties;\n return sonarV3Request(\"scripts\", {\n body: JSON.stringify({\n ...rest,\n content: query.sql,\n context: query.context,\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((response) => response.json() as Promise<E>)\n .map((entity) => _scriptFromEntity(entity))\n .mapErr((err) => {\n if (\n err.body instanceof Problem &&\n err.body.detail?.includes(\"Cannot reuse the same script name\")\n ) {\n return duplicateScriptNameError(properties.name);\n }\n\n return err;\n }).promise;\n };\n"]}
@@ -1,4 +1,3 @@
1
- import { Err, Ok } from "ts-results-es";
2
1
  import { User, type UserEntity } from "./User.ts";
3
2
  import type { SonarV3Config } from "../../common/Config.ts";
4
3
  import type { SignalParam } from "../../common/Params.ts";
@@ -6,6 +5,6 @@ export declare class UsersResource {
6
5
  #private;
7
6
  constructor(config: SonarV3Config);
8
7
  _userFromEntity(entity: UserEntity): User;
9
- retrieveById(id: string, { signal }?: SignalParam): Promise<Err<unknown> | Ok<User>>;
10
- retrieveByName(name: string, { signal }?: SignalParam): Promise<Err<unknown> | Ok<User>>;
8
+ retrieveById(id: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<User, import("../index.ts").HttpError>>;
9
+ retrieveByName(name: string, { signal }?: SignalParam): Promise<import("ts-results-es").Result<User, import("../index.ts").HttpError>>;
11
10
  }
@@ -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 { User, userEntityToProperties } from "./User.js";
18
17
  export class UsersResource {
19
18
  #config;
@@ -26,16 +25,14 @@ export class UsersResource {
26
25
  retrieveById(id, { signal } = {}) {
27
26
  return this.#config
28
27
  .sonarV3Request(`user/${id}`, { signal })
29
- .then((res) => res.json())
30
- .then((entity) => Ok(this._userFromEntity(entity)))
31
- .catch((e) => Err(e));
28
+ .map((response) => response.json())
29
+ .map((entity) => this._userFromEntity(entity)).promise;
32
30
  }
33
31
  retrieveByName(name, { signal } = {}) {
34
32
  return this.#config
35
33
  .sonarV3Request(`user/by-name/${name}`, { signal })
36
- .then((res) => res.json())
37
- .then((entity) => Ok(this._userFromEntity(entity)))
38
- .catch((e) => Err(e));
34
+ .map((response) => response.json())
35
+ .map((entity) => this._userFromEntity(entity)).promise;
39
36
  }
40
37
  }
41
38
  //# sourceMappingURL=UsersResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UsersResource.js","sourceRoot":"","sources":["../../../src/oss/users/UsersResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAmB,MAAM,WAAW,CAAC;AAI1E,MAAM,OAAO,aAAa;IACxB,OAAO,CAAgB;IAEvB,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,eAAe,CAAC,MAAkB;QAChC,OAAO,IAAI,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,YAAY,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QACnD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACxC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAyB,CAAC;aAChD,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;aAClD,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,EAAE,MAAM,KAAkB,EAAE;QACvD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,gBAAgB,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aAClD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAyB,CAAC;aAChD,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;aAClD,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,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 { User, userEntityToProperties, type UserEntity } from \"./User.ts\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class UsersResource {\n #config: SonarV3Config;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n }\n\n _userFromEntity(entity: UserEntity) {\n return new User(userEntityToProperties(entity));\n }\n\n retrieveById(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/${id}`, { signal })\n .then((res) => res.json() as Promise<UserEntity>)\n .then((entity) => Ok(this._userFromEntity(entity)))\n .catch((e: unknown) => Err(e));\n }\n\n retrieveByName(name: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/by-name/${name}`, { signal })\n .then((res) => res.json() as Promise<UserEntity>)\n .then((entity) => Ok(this._userFromEntity(entity)))\n .catch((e: unknown) => Err(e));\n }\n}\n"]}
1
+ {"version":3,"file":"UsersResource.js","sourceRoot":"","sources":["../../../src/oss/users/UsersResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAmB,MAAM,WAAW,CAAC;AAI1E,MAAM,OAAO,aAAa;IACxB,OAAO,CAAgB;IAEvB,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,eAAe,CAAC,MAAkB;QAChC,OAAO,IAAI,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,YAAY,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE;QACnD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aACxC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAyB,CAAC;aACzD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,EAAE,MAAM,KAAkB,EAAE;QACvD,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,gBAAgB,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;aAClD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAyB,CAAC;aACzD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,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 { User, userEntityToProperties, type UserEntity } from \"./User.ts\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class UsersResource {\n #config: SonarV3Config;\n\n constructor(config: SonarV3Config) {\n this.#config = config;\n }\n\n _userFromEntity(entity: UserEntity) {\n return new User(userEntityToProperties(entity));\n }\n\n retrieveById(id: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/${id}`, { signal })\n .map((response) => response.json() as Promise<UserEntity>)\n .map((entity) => this._userFromEntity(entity)).promise;\n }\n\n retrieveByName(name: string, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`user/by-name/${name}`, { signal })\n .map((response) => response.json() as Promise<UserEntity>)\n .map((entity) => this._userFromEntity(entity)).promise;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",