@dremio/js-sdk 0.3.0 → 0.4.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 (49) hide show
  1. package/dist/cloud/ai/AiResource.d.ts +24 -0
  2. package/dist/cloud/ai/AiResource.js +55 -0
  3. package/dist/cloud/ai/AiResource.js.map +1 -0
  4. package/dist/cloud/engines/Engine.d.ts +1 -0
  5. package/dist/cloud/engines/Engine.js +1 -0
  6. package/dist/cloud/engines/Engine.js.map +1 -1
  7. package/dist/cloud/engines/utils.js +1 -0
  8. package/dist/cloud/engines/utils.js.map +1 -1
  9. package/dist/cloud/index.d.ts +5 -1
  10. package/dist/cloud/index.js +0 -1
  11. package/dist/cloud/index.js.map +1 -1
  12. package/dist/cloud/resources.d.ts +6 -0
  13. package/dist/cloud/resources.js +2 -0
  14. package/dist/cloud/resources.js.map +1 -1
  15. package/dist/enterprise/catalog/CatalogObjects/EnterpriseSourceCatalogObject.d.ts +6 -6
  16. package/dist/enterprise/engines/Engine.d.ts +1 -0
  17. package/dist/enterprise/engines/Engine.js +1 -0
  18. package/dist/enterprise/engines/Engine.js.map +1 -1
  19. package/dist/enterprise/index.d.ts +1 -1
  20. package/dist/enterprise/index.js +0 -1
  21. package/dist/enterprise/index.js.map +1 -1
  22. package/dist/enterprise/reflections/ReflectionSummary.d.ts +1 -0
  23. package/dist/enterprise/reflections/ReflectionSummary.js +1 -0
  24. package/dist/enterprise/reflections/ReflectionSummary.js.map +1 -1
  25. package/dist/enterprise/resources.d.ts +1 -0
  26. package/dist/enterprise/scripts/EnterpriseScript.d.ts +2 -2
  27. package/dist/oss/catalog/CatalogObjects/SourceCatalogObject.d.ts +1 -0
  28. package/dist/oss/catalog/CatalogObjects/SourceCatalogObject.js +1 -0
  29. package/dist/oss/catalog/CatalogObjects/SourceCatalogObject.js.map +1 -1
  30. package/dist/oss/catalog/CatalogReferences/BaseCatalogReference.d.ts +1 -1
  31. package/dist/oss/catalog/CatalogReferences/BaseCatalogReference.js +4 -7
  32. package/dist/oss/catalog/CatalogReferences/BaseCatalogReference.js.map +1 -1
  33. package/dist/oss/catalog/CatalogReferences/utils/catalogPathToString.d.ts +1 -0
  34. package/dist/oss/catalog/CatalogReferences/utils/catalogPathToString.js +18 -0
  35. package/dist/oss/catalog/CatalogReferences/utils/catalogPathToString.js.map +1 -0
  36. package/dist/oss/index.d.ts +1 -1
  37. package/dist/oss/index.js +0 -1
  38. package/dist/oss/index.js.map +1 -1
  39. package/dist/oss/jobs/Job.d.ts +1 -1
  40. package/dist/oss/jobs/Job.js +9 -4
  41. package/dist/oss/jobs/Job.js.map +1 -1
  42. package/dist/oss/jobs/JobsResource.d.ts +5 -1
  43. package/dist/oss/jobs/JobsResource.js +24 -19
  44. package/dist/oss/jobs/JobsResource.js.map +1 -1
  45. package/dist/oss/resources.d.ts +1 -0
  46. package/dist/oss/scripts/Script.d.ts +1 -0
  47. package/dist/oss/scripts/Script.js +1 -0
  48. package/dist/oss/scripts/Script.js.map +1 -1
  49. package/package.json +1 -1
@@ -0,0 +1,24 @@
1
+ import { Err, Ok } from "ts-results-es";
2
+ import type { ResourceConfig, V3Config } from "../../common/Config.ts";
3
+ import type { SignalParam } from "../../common/Params.ts";
4
+ export declare class AiResource {
5
+ #private;
6
+ constructor(config: ResourceConfig & V3Config);
7
+ autoProduceQuery: (project_id: string) => ({ datasetPaths, text }: {
8
+ datasetPaths: Set<string>;
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
+ }>>;
19
+ }
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
+ };
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (C) 2024-2025 Dremio Corporation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Err, Ok } from "ts-results-es";
17
+ import { HttpError } from "../../common/HttpError.js";
18
+ import { isProblem } from "../../common/Problem.js";
19
+ export class AiResource {
20
+ #config;
21
+ constructor(config) {
22
+ this.#config = config;
23
+ }
24
+ autoProduceQuery = (project_id) => ({ datasetPaths, text }, { signal } = {}) => this.#config
25
+ .v3Request("gen-ai/auto-produce-query", {
26
+ body: JSON.stringify({
27
+ datasetIdentifiers: Array.from(datasetPaths).map((datasetPath) => ({
28
+ datasetPath,
29
+ })),
30
+ projectId: project_id,
31
+ userInputtedText: text,
32
+ }),
33
+ headers: {
34
+ Accept: "application/json",
35
+ "Content-Type": "application/json",
36
+ },
37
+ method: "POST",
38
+ signal,
39
+ })
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
+ });
49
+ }
50
+ export const clarifyRequestErr = {
51
+ detail: "Please clarify your request and try again.",
52
+ title: "SQL could not be generated from the input text.",
53
+ type: "https://api.dremio.dev/problems/auto-produce-sql/clarify-request",
54
+ };
55
+ //# sourceM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AC,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,5 +1,6 @@
1
1
  import { type Result } from "ts-results-es";
2
2
  import type { SonarV3Config } from "../../common/Config.ts";
3
+ import { Temporal } from "temporal-polyfill";
3
4
  export declare class Engine implements EngineInterface {
4
5
  #private;
5
6
  readonly activeReplicas: EngineInterface["activeReplicas"];
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { Err, Ok } from "ts-results-es";
17
17
  import { engineEntityToProperties, enginePropertiesToEntity } from "./utils.js";
18
+ import { Temporal } from "temporal-polyfill";
18
19
  export class Engine {
19
20
  activeReplicas;
20
21
  additionalEngineStateInfo;
@@ -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;AAEhF,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;IAEv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B,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\";\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;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;IACl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AAC,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"]}
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import parseMilliseconds from "parse-ms";
17
+ import { Temporal } from "temporal-polyfill";
17
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
19
  export const engineEntityToProperties = (properties) => {
19
20
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/cloud/engines/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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;YACD,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,EAAE;QACJ,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,eAAe,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;KACtD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,aAA2C,EAAE,EAAE;IACtF,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GACzF,aAAa,CAAC;IAChB,OAAO;QACL,GAAG,IAAI;QACP,oBAAoB,EAAE,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC;QACrD,WAAW,EAAE,WAAW,IAAI,EAAE;QAC9B,qBAAqB,EAAE,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;QACvD,qBAAqB,EAAE,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;QACvD,mBAAmB,EAAE,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;KACpD,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 parseMilliseconds from \"parse-ms\";\nimport type { EngineConfiguration, EngineProperties } from \"./Engine.ts\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const engineEntityToProperties = (properties: any): EngineProperties => {\n return {\n activeReplicas: properties.activeReplicas,\n additionalEngineStateInfo: properties.additionalEngineStateInfo,\n configuration: {\n autoStopDelay: Temporal.Duration.from(\n parseMilliseconds(properties.autoStopDelaySeconds * 1000),\n ),\n cloudTags: properties.cloudTags,\n description: properties.description,\n drainTimeLimit: Temporal.Duration.from(\n parseMilliseconds(properties.drainTimeLimitSeconds * 1000),\n ),\n maxConcurrency: properties.maxConcurrency,\n maxReplicas: properties.maxReplicas,\n minReplicas: properties.minReplicas,\n queueTimeLimit: Temporal.Duration.from(\n parseMilliseconds(properties.queueTimeLimitSeconds * 1000),\n ),\n runTimeLimit: Temporal.Duration.from(\n parseMilliseconds(properties.runtimeLimitSeconds * 1000),\n ),\n size: properties.size,\n },\n id: properties.id,\n instanceFamily: properties.instanceFamily,\n name: properties.name,\n queriedAt: (() => {\n const d = new Date(properties.queriedAt);\n if (d.getTime() === 0) {\n return null;\n }\n return d;\n })(),\n state: properties.state,\n statusChangedAt: new Date(properties.statusChangedAt),\n };\n};\n\nexport const enginePropertiesToEntity = (configuration: Partial<EngineConfiguration>) => {\n const { autoStopDelay, description, drainTimeLimit, queueTimeLimit, runTimeLimit, ...rest } =\n configuration;\n return {\n ...rest,\n autoStopDelaySeconds: autoStopDelay?.total(\"seconds\"),\n description: description || \"\",\n drainTimeLimitSeconds: drainTimeLimit?.total(\"seconds\"),\n queueTimeLimitSeconds: queueTimeLimit?.total(\"seconds\"),\n runtimeLimitSeconds: runTimeLimit?.total(\"seconds\"),\n };\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/cloud/engines/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAAe,EAAoB,EAAE;IAC5E,OAAO;QACL,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,yBAAyB,EAAE,UAAU,CAAC,yBAAyB;QAC/D,aAAa,EAAE;YACb,aAAa,EAAE,QAAQ,CAAC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AAW,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GACzF,aAAa,CAAC;IAChB,OAAO;QACL,GAAG,IAAI;QACP,oBAAoB,EAAE,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC;QACrD,WAAW,EAAE,WAAW,IAAI,EAAE;QAC9B,qBAAqB,EAAE,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;QACvD,qBAAqB,EAAE,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;QACvD,mBAAmB,EAAE,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;KACpD,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 parseMilliseconds from \"parse-ms\";\nimport type { EngineConfiguration, EngineProperties } from \"./Engine.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const engineEntityToProperties = (properties: any): EngineProperties => {\n return {\n activeReplicas: properties.activeReplicas,\n additionalEngineStateInfo: properties.additionalEngineStateInfo,\n configuration: {\n autoStopDelay: Temporal.Duration.from(\n parseMilliseconds(properties.autoStopDelaySeconds * 1000),\n ),\n cloudTags: properties.cloudTags,\n description: properties.description,\n drainTimeLimit: Temporal.Duration.from(\n parseMilliseconds(properties.drainTimeLimitSeconds * 1000),\n ),\n maxConcurrency: properties.maxConcurrency,\n maxReplicas: properties.maxReplicas,\n minReplicas: properties.minReplicas,\n queueTimeLimit: Temporal.Duration.from(\n parseMilliseconds(properties.queueTimeLimitSeconds * 1000),\n ),\n runTimeLimit: Temporal.Duration.from(\n parseMilliseconds(properties.runtimeLimitSeconds * 1000),\n ),\n size: properties.size,\n },\n id: properties.id,\n instanceFamily: properties.instanceFamily,\n name: properties.name,\n queriedAt: (() => {\n const d = new Date(properties.queriedAt);\n if (d.getTime() === 0) {\n return null;\n }\n return d;\n })(),\n state: properties.state,\n statusChangedAt: new Date(properties.statusChangedAt),\n };\n};\n\nexport const enginePropertiesToEntity = (configuration: Partial<EngineConfiguration>) => {\n const { autoStopDelay, description, drainTimeLimit, queueTimeLimit, runTimeLimit, ...rest } =\n configuration;\n return {\n ...rest,\n autoStopDelaySeconds: autoStopDelay?.total(\"seconds\"),\n description: description || \"\",\n drainTimeLimitSeconds: drainTimeLimit?.total(\"seconds\"),\n queueTimeLimitSeconds: queueTimeLimit?.total(\"seconds\"),\n runtimeLimitSeconds: runTimeLimit?.total(\"seconds\"),\n };\n};\n"]}
@@ -1,4 +1,3 @@
1
- import "temporal-polyfill/global";
2
1
  import type { Config } from "../common/Config.ts";
3
2
  import { Resources } from "./resources.ts";
4
3
  export declare const Dremio: (config: Config) => {
@@ -16,6 +15,7 @@ export declare const Dremio: (config: Config) => {
16
15
  v3Request: (path: string, init?: RequestInit) => Promise<Response>;
17
16
  };
18
17
  _sonarV3Request: (projectId: string) => (path: string, init?: RequestInit) => Promise<Response>;
18
+ ai: import("./ai/AiResource.ts").AiResource;
19
19
  arctic: import("moize").Moized<(projectId: string) => {
20
20
  _createFromEntity: (entity: import("./arctic/ArcticCatalog.ts").ArcticCatalogEntity) => import("./interfaces.ts").ArcticCatalog;
21
21
  list: () => {
@@ -217,6 +217,7 @@ export declare const Dremio: (config: Config) => {
217
217
  }>>;
218
218
  jobs: import("moize").Moized<(projectId: string) => {
219
219
  create: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
220
+ createAndRetrieve: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
220
221
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
221
222
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
222
223
  }, Partial<{
@@ -232,16 +233,19 @@ export declare const Dremio: (config: Config) => {
232
233
  maxSize: number;
233
234
  onCacheAdd: import("moize").OnCacheOperation<(projectId: string) => {
234
235
  create: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
236
+ createAndRetrieve: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
235
237
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
236
238
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
237
239
  }>;
238
240
  onCacheChange: import("moize").OnCacheOperation<(projectId: string) => {
239
241
  create: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
242
+ createAndRetrieve: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
240
243
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
241
244
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
242
245
  }>;
243
246
  onCacheHit: import("moize").OnCacheOperation<(projectId: string) => {
244
247
  create: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
248
+ createAndRetrieve: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
245
249
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
246
250
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
247
251
  }>;
@@ -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 "temporal-polyfill/global";
17
16
  import { createRequest } from "../common/createRequest.js";
18
17
  import { Resources } from "./resources.js";
19
18
  const getSonarResourceConfig = (config) => (projectId) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,SAAkB,EAAE,EAAE;IACxE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAqB,EAAE;YACtE,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,OAAO,CAAC,gBAAgB,SAAS,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC;QACD,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAqB,EAAE,CACjE,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,CAAC;KACqB,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC;QAC/B,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,cAAc;KACtF,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,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 \"temporal-polyfill/global\";\nimport { createRequest } from \"../common/createRequest.ts\";\nimport type { Config, ResourceConfig, SonarV3Config, V3Config } from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV3Request: (path: string, init?: RequestInit): Promise<Response> => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(`/v0/projects/${projectId}/${path}`, init);\n },\n v3Request: (path: string, init?: RequestInit): Promise<Response> =>\n request(`/v0/${path}`, init),\n } satisfies ResourceConfig & SonarV3Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: createRequest(config),\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV3Request: (projectId: string) => sonarResourceConfig(projectId).sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport * from \"./oauth/oauth.ts\";\n\nexport { Resources as _Resources };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloud/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,SAAkB,EAAE,EAAE;IACxE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAqB,EAAE;YACtE,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,OAAO,CAAC,gBAAgB,SAAS,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;QAC5D,CAAC;QACD,SAAS,EAAE,CAAC,IAAY,EAAE,IAAkB,EAAqB,EAAE,CACjE,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,IAAI,CAAC;KACqB,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC;QAC/B,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,cAAc;KACtF,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,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 { createRequest } from \"../common/createRequest.ts\";\nimport type { Config, ResourceConfig, SonarV3Config, V3Config } from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV3Request: (path: string, init?: RequestInit): Promise<Response> => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(`/v0/projects/${projectId}/${path}`, init);\n },\n v3Request: (path: string, init?: RequestInit): Promise<Response> =>\n request(`/v0/${path}`, init),\n } satisfies ResourceConfig & SonarV3Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: createRequest(config),\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV3Request: (projectId: string) => sonarResourceConfig(projectId).sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport * from \"./oauth/oauth.ts\";\n\nexport { Resources as _Resources };\n"]}
@@ -1,10 +1,12 @@
1
1
  import type { ResourceConfig, SonarV3Config, V3Config } from "../common/Config.ts";
2
2
  import moize from "moize";
3
+ import { AiResource } from "./ai/AiResource.ts";
3
4
  /**
4
5
  * @internal
5
6
  * @hidden
6
7
  */
7
8
  export declare const Resources: (config: (projectId?: string) => ResourceConfig & SonarV3Config & V3Config) => {
9
+ ai: AiResource;
8
10
  arctic: moize.Moized<(projectId: string) => {
9
11
  _createFromEntity: (entity: import("./arctic/ArcticCatalog.ts").ArcticCatalogEntity) => import("./interfaces.ts").ArcticCatalog;
10
12
  list: () => {
@@ -206,6 +208,7 @@ export declare const Resources: (config: (projectId?: string) => ResourceConfig
206
208
  }>>;
207
209
  jobs: moize.Moized<(projectId: string) => {
208
210
  create: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
211
+ createAndRetrieve: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
209
212
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
210
213
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
211
214
  }, Partial<{
@@ -221,16 +224,19 @@ export declare const Resources: (config: (projectId?: string) => ResourceConfig
221
224
  maxSize: number;
222
225
  onCacheAdd: moize.OnCacheOperation<(projectId: string) => {
223
226
  create: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
227
+ createAndRetrieve: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
224
228
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
225
229
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
226
230
  }>;
227
231
  onCacheChange: moize.OnCacheOperation<(projectId: string) => {
228
232
  create: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
233
+ createAndRetrieve: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
229
234
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
230
235
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
231
236
  }>;
232
237
  onCacheHit: moize.OnCacheOperation<(projectId: string) => {
233
238
  create: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
239
+ createAndRetrieve: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
234
240
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
235
241
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
236
242
  }>;
@@ -23,11 +23,13 @@ import { CloudUsersResource } from "./users/CloudUsersResource.js";
23
23
  import { JobsResource } from "../oss/jobs/JobsResource.js";
24
24
  import moize from "moize";
25
25
  import { OAuthApplicationsResource } from "./oauth/OAuthApplicationsResource.js";
26
+ import { AiResource } from "./ai/AiResource.js";
26
27
  /**
27
28
  * @internal
28
29
  * @hidden
29
30
  */
30
31
  export const Resources = (config) => ({
32
+ ai: new AiResource(config()),
31
33
  arctic: moize.default((projectId) => ArcticResource(config(projectId))),
32
34
  catalog: moize.default((projectId) => EnterpriseCatalogResource(config(projectId))),
33
35
  engines: moize.default((projectId) => EnginesResource(config(projectId))),
@@ -1 +1 @@
1
- {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/cloud/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;A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M,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,yBAAyB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3F,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CACnF,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, V3Config } from \"../common/Config.ts\";\nimport { ArcticResource } from \"./arctic/ArcticResource.ts\";\nimport { EnterpriseCatalogResource } from \"../enterprise/catalog/EnterpriseCatalogResource.ts\";\nimport { RolesResource } from \"../enterprise/roles/RolesResource.ts\";\nimport { EnterpriseScriptsResource } from \"../enterprise/scripts/EnterpriseScriptsResource.ts\";\nimport { EnginesResource } from \"./engines/EnginesResource.ts\";\nimport { ProjectsResource } from \"./projects/ProjectsResource.ts\";\nimport { CloudUsersResource } from \"./users/CloudUsersResource.ts\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport moize from \"moize\";\nimport { OAuthApplicationsResource } from \"./oauth/OAuthApplicationsResource.ts\";\n\n/**\n * @internal\n * @hidden\n */\nexport const Resources = (\n config: (projectId?: string) => ResourceConfig & SonarV3Config & V3Config,\n) => ({\n arctic: moize.default((projectId: string) => ArcticResource(config(projectId))),\n catalog: moize.default((projectId: string) => EnterpriseCatalogResource(config(projectId))),\n engines: moize.default((projectId: string) => EnginesResource(config(projectId))),\n jobs: moize.default((projectId: string) => JobsResource(config(projectId))),\n oauthApplications: OAuthApplicationsResource(config()),\n projects: ProjectsResource(config()),\n roles: moize.default((projectId: string) => RolesResource(config(projectId))),\n scripts: moize.default((projectId: string) => EnterpriseScriptsResource(config(projectId))),\n users: moize.default((projectId: string) => CloudUsersResource(config(projectId))),\n});\n"]}
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/cloud/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAyE,EACzE,EAAE,CAAC,CAAC;IACJ,EAAE,EAAE,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/E,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,yBAAyB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3F,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IACjF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3E,iBAAiB,EAAE,yBAAyB,CAAC,MAAM,EAAE,CAAC;IACtD,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC;IACpC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,yBAAyB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3F,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CACnF,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, V3Config } from \"../common/Config.ts\";\nimport { ArcticResource } from \"./arctic/ArcticResource.ts\";\nimport { EnterpriseCatalogResource } from \"../enterprise/catalog/EnterpriseCatalogResource.ts\";\nimport { RolesResource } from \"../enterprise/roles/RolesResource.ts\";\nimport { EnterpriseScriptsResource } from \"../enterprise/scripts/EnterpriseScriptsResource.ts\";\nimport { EnginesResource } from \"./engines/EnginesResource.ts\";\nimport { ProjectsResource } from \"./projects/ProjectsResource.ts\";\nimport { CloudUsersResource } from \"./users/CloudUsersResource.ts\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport moize from \"moize\";\nimport { OAuthApplicationsResource } from \"./oauth/OAuthApplicationsResource.ts\";\nimport { AiResource } from \"./ai/AiResource.ts\";\n\n/**\n * @internal\n * @hidden\n */\nexport const Resources = (\n config: (projectId?: string) => ResourceConfig & SonarV3Config & V3Config,\n) => ({\n ai: new AiResource(config()),\n arctic: moize.default((projectId: string) => ArcticResource(config(projectId))),\n catalog: moize.default((projectId: string) => EnterpriseCatalogResource(config(projectId))),\n engines: moize.default((projectId: string) => EnginesResource(config(projectId))),\n jobs: moize.default((projectId: string) => JobsResource(config(projectId))),\n oauthApplications: OAuthApplicationsResource(config()),\n projects: ProjectsResource(config()),\n roles: moize.default((projectId: string) => RolesResource(config(projectId))),\n scripts: moize.default((projectId: string) => EnterpriseScriptsResource(config(projectId))),\n users: moize.default((projectId: string) => CloudUsersResource(config(projectId))),\n});\n"]}
@@ -17,10 +17,10 @@ export declare const enterpriseSourceEntityToProperties: (entity: any, config: S
17
17
  } | undefined;
18
18
  acceleration: {
19
19
  readonly activePolicyType: any;
20
- readonly gracePeriod: Temporal.Duration;
20
+ readonly gracePeriod: import("temporal-polyfill").Temporal.Duration;
21
21
  readonly neverExpire: any;
22
22
  readonly neverRefresh: any;
23
- readonly refreshPeriod: Temporal.Duration;
23
+ readonly refreshPeriod: import("temporal-polyfill").Temporal.Duration;
24
24
  readonly refreshSchedule: any;
25
25
  };
26
26
  allowCrossSourceSelection: any;
@@ -29,13 +29,13 @@ export declare const enterpriseSourceEntityToProperties: (entity: any, config: S
29
29
  disableMetadataValidityCheck: any;
30
30
  id: any;
31
31
  metadataPolicy: {
32
- readonly authTTL: Temporal.Duration;
32
+ readonly authTTL: import("temporal-polyfill").Temporal.Duration;
33
33
  readonly autoPromoteDatasets: any;
34
- readonly datasetExpireAfter: Temporal.Duration;
35
- readonly datasetRefreshAfter: Temporal.Duration;
34
+ readonly datasetExpireAfter: import("temporal-polyfill").Temporal.Duration;
35
+ readonly datasetRefreshAfter: import("temporal-polyfill").Temporal.Duration;
36
36
  readonly datasetUpdateMode: any;
37
37
  readonly deleteUnavailableDatasets: any;
38
- readonly namesRefresh: Temporal.Duration;
38
+ readonly namesRefresh: import("temporal-polyfill").Temporal.Duration;
39
39
  };
40
40
  name: any;
41
41
  sourceChangeState: any;
@@ -1,5 +1,6 @@
1
1
  import type { SonarV3Config } from "../../common/Config.ts";
2
2
  import { type Result } from "ts-results-es";
3
+ import { Temporal } from "temporal-polyfill";
3
4
  export declare class Engine {
4
5
  #private;
5
6
  readonly id: EngineEntity["id"];
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import parseMilliseconds from "parse-ms";
17
17
  import { Err, Ok } from "ts-results-es";
18
+ import { Temporal } from "temporal-polyfill";
18
19
  export class Engine {
19
20
  id;
20
21
  name;
@@ -1 +1 @@
1
- {"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../../src/enterprise/engines/Engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,eAAe,CAAC;AAErD,MAAM,OAAO,MAAM;IACD,EAAE,CAAqB;IACvB,IAAI,CAAuB;IAC3B,IAAI,CAmBlB;IACc,MAAM,CAEpB;IAEO,OAAO,CAAgB;IAEhC,2DAA2D;IAClD,IAAI,CAAS;IAEtB,YAAY,MAAoB,EAAE,MAAqB;QACrD,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC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AAE,MAAM,EAAE,kBAAkB,EAAE;YACvC,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,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,OAAO,EAAE;YACzC,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;YACvC,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,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 parseMilliseconds from \"parse-ms\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { Err, Ok, type Result } from \"ts-results-es\";\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 executorPodMetadata: {\n annotations: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"annotations\"];\n labels: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"labels\"];\n nodeSelectors: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"nodeSelectors\"];\n tolerations: {\n key: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"key\"];\n operator: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"operator\"];\n effect: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"effect\"];\n tolerationDuration: Temporal.Duration;\n value?: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"value\"];\n }[];\n idleTimeout?: Temporal.Duration;\n resourceAllocationOffset: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"resourceAllocationOffset\"];\n size: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"size\"];\n spillStorageSize: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"spillStorageSize\"];\n targetCpuCapacity: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"targetCpuCapacity\"];\n };\n };\n public readonly status: Omit<EngineEntity[\"status\"], \"message\"> & {\n message: string | null;\n };\n\n readonly #config: SonarV3Config;\n\n // eslint-disable-next-line no-unused-private-class-members\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 executorPodMetadata: {\n ...entity.spec.executorPodMetadata,\n idleTimeout: entity.spec.executorPodMetadata.idleTimeout\n ? Temporal.Duration.from(entity.spec.executorPodMetadata.idleTimeout)\n : undefined,\n tolerations: entity.spec.executorPodMetadata.tolerations.map(\n ({ tolerationSeconds, ...toleration }) => ({\n ...toleration,\n tolerationDuration: Temporal.Duration.from(parseMilliseconds(tolerationSeconds * 1000)),\n }),\n ),\n },\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\nexport type EngineEntity = {\n id: string;\n name: string;\n spec: {\n c3StorageSize: string;\n executorPodMetadata: {\n labels: Record<string, string>;\n annotations: Record<string, string>;\n nodeSelectors: Record<string, string>;\n tolerations: {\n key: string;\n operator: \"Exists\" | \"Equal\";\n effect: \"NoSchedule\" | \"PreferNoSchedule\" | \"NoExecute\";\n tolerationSeconds: number;\n value?: number;\n }[];\n idleTimeout?: string;\n resourceAllocationOffset: string;\n size: \"2XSmall\" | \"XSmall\" | \"Small\" | \"Medium\" | \"Large\" | \"XLarge\" | \"2XLarge\";\n spillStorageSize: string;\n targetCpuCapacity: string;\n };\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;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAM;IACD,EAAE,CAAqB;IACvB,IAAI,CAAuB;IAC3B,IAAI,CAmBlB;IACc,MAAM,CAEpB;IAEO,OAAO,CAAgB;IAEhC,2DAA2D;IAClD,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,mBAAmB,EAAE;gBACnB,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB;gBAClC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW;oBACtD,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC;oBACrE,CAAC,CAAC,SAAS;gBACb,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAC1D,CAAC,EAAE,iBAAiB,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;oBACzC,GAAG,UAAU;oBACb,kBAAkB,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,GAAG,IAA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,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,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 parseMilliseconds from \"parse-ms\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { Err, Ok, type Result } from \"ts-results-es\";\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 executorPodMetadata: {\n annotations: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"annotations\"];\n labels: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"labels\"];\n nodeSelectors: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"nodeSelectors\"];\n tolerations: {\n key: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"key\"];\n operator: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"operator\"];\n effect: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"effect\"];\n tolerationDuration: Temporal.Duration;\n value?: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"tolerations\"][number][\"value\"];\n }[];\n idleTimeout?: Temporal.Duration;\n resourceAllocationOffset: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"resourceAllocationOffset\"];\n size: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"size\"];\n spillStorageSize: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"spillStorageSize\"];\n targetCpuCapacity: EngineEntity[\"spec\"][\"executorPodMetadata\"][\"targetCpuCapacity\"];\n };\n };\n public readonly status: Omit<EngineEntity[\"status\"], \"message\"> & {\n message: string | null;\n };\n\n readonly #config: SonarV3Config;\n\n // eslint-disable-next-line no-unused-private-class-members\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 executorPodMetadata: {\n ...entity.spec.executorPodMetadata,\n idleTimeout: entity.spec.executorPodMetadata.idleTimeout\n ? Temporal.Duration.from(entity.spec.executorPodMetadata.idleTimeout)\n : undefined,\n tolerations: entity.spec.executorPodMetadata.tolerations.map(\n ({ tolerationSeconds, ...toleration }) => ({\n ...toleration,\n tolerationDuration: Temporal.Duration.from(parseMilliseconds(tolerationSeconds * 1000)),\n }),\n ),\n },\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\nexport type EngineEntity = {\n id: string;\n name: string;\n spec: {\n c3StorageSize: string;\n executorPodMetadata: {\n labels: Record<string, string>;\n annotations: Record<string, string>;\n nodeSelectors: Record<string, string>;\n tolerations: {\n key: string;\n operator: \"Exists\" | \"Equal\";\n effect: \"NoSchedule\" | \"PreferNoSchedule\" | \"NoExecute\";\n tolerationSeconds: number;\n value?: number;\n }[];\n idleTimeout?: string;\n resourceAllocationOffset: string;\n size: \"2XSmall\" | \"XSmall\" | \"Small\" | \"Medium\" | \"Large\" | \"XLarge\" | \"2XLarge\";\n spillStorageSize: string;\n targetCpuCapacity: string;\n };\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,4 +1,3 @@
1
- import "temporal-polyfill/global";
2
1
  import type { Config } from "../common/Config.ts";
3
2
  import { Resources } from "./resources.ts";
4
3
  export declare const Dremio: (config: Config) => {
@@ -29,6 +28,7 @@ export declare const Dremio: (config: Config) => {
29
28
  engines: import("./engines/EnginesResource.ts").EnginesResource;
30
29
  jobs: {
31
30
  create: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
31
+ createAndRetrieve: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
32
32
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
33
33
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
34
34
  };
@@ -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 "temporal-polyfill/global";
17
16
  import { createRequest } from "../common/createRequest.js";
18
17
  import { Resources } from "./resources.js";
19
18
  const getSonarResourceConfig = (config) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enterprise/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAQ3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE;IAChD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC;QAC/D,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;QAChE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;KACQ,CAAC;AACxE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,mBAAmB,CAAC,OAAO;QACrC,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,mBAAmB,CAAC,cAAc;QACnD,eAAe,EAAE,mBAAmB,CAAC,cAAc;KACpD,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,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 \"temporal-polyfill/global\";\nimport { createRequest } from \"../common/createRequest.ts\";\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n V3Config,\n} from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n v3Request: (path, init) => request(`/api/v3/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: sonarResourceConfig.request,\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV2Request: sonarResourceConfig.sonarV2Request,\n _sonarV3Request: sonarResourceConfig.sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport { Resources as _Resources };\n"]}
1
+ {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["/*\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 { createRequest } from \"../common/createRequest.ts\";\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n V3Config,\n} from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n v3Request: (path, init) => request(`/api/v3/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config & V3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: sonarResourceConfig.request,\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV2Request: sonarResourceConfig.sonarV2Request,\n _sonarV3Request: sonarResourceConfig.sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport { Resources as _Resources };\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { EnterpriseDatasetCatalogReference } from "../catalog/CatalogReferences/index.ts";
2
+ import { Temporal } from "temporal-polyfill";
2
3
  export declare class ReflectionSummary {
3
4
  createdAt: ReflectionProperties["createdAt"];
4
5
  dataset: ReflectionProperties["dataset"];
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import parseMilliseconds from "parse-ms";
17
+ import { Temporal } from "temporal-polyfill";
17
18
  export class ReflectionSummary {
18
19
  createdAt;
19
20
  dataset;
@@ -1 +1 @@
1
- {"version":3,"file":"ReflectionSummary.js","sourceRoot":"","sources":["../../../src/enterprise/reflections/ReflectionSummary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAGzC,MAAM,OAAO,iBAAiB;IAC5B,SAAS,CAAoC;IAC7C,OAAO,CAAkC;IACzC,EAAE,CAA6B;IAC/B,UAAU,CAAqC;IAC/C,SAAS,CAAoC;IAC7C,OAAO,CAAkC;IACzC,IAAI,CAA+B;IACnC,MAAM,CAAiC;IACvC,IAAI,CAA+B;IACnC,SAAS,CAAoC;IAC7C,YAAY,UAAgC;QAC1C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;IACxC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,MAsCnD,EAAE,EAAE,CAAC,CAAC;IACL,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IACrC,OAAO,EAAE,EAAuC;IAChD,wCAAwC;IACxC,MAAM;I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E,MAAM,CAAC,MAAM,CAAC,aAAa;QAC1C,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa;KAC3C;IACD,IAAI,EAAE,MAAM,CAAC,cAAc;IAC3B,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;CACtC,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 parseMilliseconds from \"parse-ms\";\nimport type { EnterpriseDatasetCatalogReference } from \"../catalog/CatalogReferences/index.ts\";\n\nexport class ReflectionSummary {\n createdAt: ReflectionProperties[\"createdAt\"];\n dataset: ReflectionProperties[\"dataset\"];\n id: ReflectionProperties[\"id\"];\n isCanAlter: ReflectionProperties[\"isCanAlter\"];\n isCanView: ReflectionProperties[\"isCanView\"];\n metrics: ReflectionProperties[\"metrics\"];\n name: ReflectionProperties[\"name\"];\n status: ReflectionProperties[\"status\"];\n type: ReflectionProperties[\"type\"];\n updatedAt: ReflectionProperties[\"updatedAt\"];\n constructor(properties: ReflectionProperties) {\n this.createdAt = properties.createdAt;\n this.dataset = properties.dataset;\n this.id = properties.id;\n this.isCanAlter = properties.isCanAlter;\n this.isCanView = properties.isCanView;\n this.metrics = properties.metrics;\n this.name = properties.name;\n this.status = properties.status;\n this.type = properties.type;\n this.updatedAt = properties.updatedAt;\n }\n}\n\nexport const reflectionSummaryEntityToProperties = (entity: {\n createdAt: string;\n id: string;\n isCanAlter: boolean;\n isCanView: boolean;\n chosenCount: number;\n consideredCount: number;\n currentSizeBytes: number;\n matchedCount: number;\n status: {\n availabilityStatus: \"AVAILABLE\" | \"EXPIRED\" | \"INCOMPLETE\" | \"NONE\";\n combinedStatus:\n | \"CAN_ACCELERATE\"\n | \"CAN_ACCELERATE_WITH_FAILURES\"\n | \"CANNOT_ACCELERATE_INITIALIZING\"\n | \"CANNOT_ACCELERATE_MANUAL\"\n | \"CANNOT_ACCELERATE_SCHEDULED\"\n | \"DISABLED\"\n | \"EXPIRED\"\n | \"FAILED\"\n | \"INVALID\"\n | \"INCOMPLETE\"\n | \"REFRESHING\";\n configStatus: \"OK\" | \"INVALID\";\n expiresAt: string;\n failureCount: number;\n lastDataFetchAt: string;\n lastFailureMessage: string;\n lastRefreshDurationMillis: number;\n refreshMethod: \"INCREMENTAL\" | \"FULL\" | \"NONE\";\n refreshStatus: \"GIVEN_UP\" | \"MANUAL\" | \"RUNNING\" | \"SCHEDULED\";\n };\n isEnabled: boolean;\n outputRecords: number;\n totalSizeBytes: number;\n name: string;\n reflectionType: \"RAW\" | \"AGGREGATION\";\n updatedAt: string;\n}) => ({\n createdAt: new Date(entity.createdAt),\n dataset: {} as EnterpriseDatasetCatalogReference,\n // dataset: new DatasetCatalogReference(\n // {\n // id: entity.datasetId,\n // path: entity.datasetPath,\n // type: entity.datasetType,\n // },\n // null as any,\n // ),\n id: entity.id,\n isCanAlter: entity.isCanAlter,\n isCanView: entity.isCanView,\n metrics: {\n chosenCount: entity.chosenCount,\n consideredCount: entity.consideredCount,\n currentSizeBytes: entity.currentSizeBytes,\n failureCount: entity.status.failureCount,\n matchedCount: entity.matchedCount,\n outputRecords: entity.outputRecords,\n totalSizeBytes: entity.totalSizeBytes,\n },\n name: entity.name,\n status: {\n availabilityStatus: entity.status.availabilityStatus,\n combinedStatus: entity.status.combinedStatus,\n configStatus: entity.status.configStatus,\n expiresAt: new Date(entity.status.expiresAt),\n isEnabled: entity.isEnabled,\n lastDataFetchAt: entity.status.lastDataFetchAt ? new Date(entity.status.lastDataFetchAt) : null,\n lastFailureMessage: entity.status.lastFailureMessage || null,\n lastRefreshDuration:\n typeof entity.status.lastRefreshDurationMillis === \"number\"\n ? Temporal.Duration.from(parseMilliseconds(entity.status.lastRefreshDurationMillis))\n : null,\n refreshMethod: entity.status.refreshMethod,\n refreshStatus: entity.status.refreshStatus,\n },\n type: entity.reflectionType,\n updatedAt: new Date(entity.updatedAt),\n});\n\ntype ReflectionProperties = ReturnType<typeof reflectionSummaryEntityToProperties>;\n"]}
1
+ {"version":3,"file":"ReflectionSummary.js","sourceRoot":"","sources":["../../../src/enterprise/reflections/ReflectionSummary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,iBAAiB;IAC5B,SAAS,CAAoC;IAC7C,OAAO,CAAkC;IACzC,EAAE,CAA6B;IAC/B,UAAU,CAAqC;IAC/C,SAAS,CAAoC;IAC7C,OAAO,CAAkC;IACzC,IAAI,CAA+B;IACnC,MAAM,CAAiC;IACvC,IAAI,CAA+B;IACnC,SAAS,CAAoC;IAC7C,YAAY,UAAgC;QAC1C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,SAAS,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,IAAI;QAC5D,mBAAmB,EACjB,OAAO,MAAM,CAAC,MAAM,CAAC,yBAAyB,KAAK,QAAQ;YACzD,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;YACpF,CAAC,CAAC,IAAI;QACV,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa;QAC1C,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa;KAC3C;IACD,IAAI,EAAE,MAAM,CAAC,cAAc;IAC3B,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;CACtC,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 parseMilliseconds from \"parse-ms\";\nimport type { EnterpriseDatasetCatalogReference } from \"../catalog/CatalogReferences/index.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\nexport class ReflectionSummary {\n createdAt: ReflectionProperties[\"createdAt\"];\n dataset: ReflectionProperties[\"dataset\"];\n id: ReflectionProperties[\"id\"];\n isCanAlter: ReflectionProperties[\"isCanAlter\"];\n isCanView: ReflectionProperties[\"isCanView\"];\n metrics: ReflectionProperties[\"metrics\"];\n name: ReflectionProperties[\"name\"];\n status: ReflectionProperties[\"status\"];\n type: ReflectionProperties[\"type\"];\n updatedAt: ReflectionProperties[\"updatedAt\"];\n constructor(properties: ReflectionProperties) {\n this.createdAt = properties.createdAt;\n this.dataset = properties.dataset;\n this.id = properties.id;\n this.isCanAlter = properties.isCanAlter;\n this.isCanView = properties.isCanView;\n this.metrics = properties.metrics;\n this.name = properties.name;\n this.status = properties.status;\n this.type = properties.type;\n this.updatedAt = properties.updatedAt;\n }\n}\n\nexport const reflectionSummaryEntityToProperties = (entity: {\n createdAt: string;\n id: string;\n isCanAlter: boolean;\n isCanView: boolean;\n chosenCount: number;\n consideredCount: number;\n currentSizeBytes: number;\n matchedCount: number;\n status: {\n availabilityStatus: \"AVAILABLE\" | \"EXPIRED\" | \"INCOMPLETE\" | \"NONE\";\n combinedStatus:\n | \"CAN_ACCELERATE\"\n | \"CAN_ACCELERATE_WITH_FAILURES\"\n | \"CANNOT_ACCELERATE_INITIALIZING\"\n | \"CANNOT_ACCELERATE_MANUAL\"\n | \"CANNOT_ACCELERATE_SCHEDULED\"\n | \"DISABLED\"\n | \"EXPIRED\"\n | \"FAILED\"\n | \"INVALID\"\n | \"INCOMPLETE\"\n | \"REFRESHING\";\n configStatus: \"OK\" | \"INVALID\";\n expiresAt: string;\n failureCount: number;\n lastDataFetchAt: string;\n lastFailureMessage: string;\n lastRefreshDurationMillis: number;\n refreshMethod: \"INCREMENTAL\" | \"FULL\" | \"NONE\";\n refreshStatus: \"GIVEN_UP\" | \"MANUAL\" | \"RUNNING\" | \"SCHEDULED\";\n };\n isEnabled: boolean;\n outputRecords: number;\n totalSizeBytes: number;\n name: string;\n reflectionType: \"RAW\" | \"AGGREGATION\";\n updatedAt: string;\n}) => ({\n createdAt: new Date(entity.createdAt),\n dataset: {} as EnterpriseDatasetCatalogReference,\n // dataset: new DatasetCatalogReference(\n // {\n // id: entity.datasetId,\n // path: entity.datasetPath,\n // type: entity.datasetType,\n // },\n // null as any,\n // ),\n id: entity.id,\n isCanAlter: entity.isCanAlter,\n isCanView: entity.isCanView,\n metrics: {\n chosenCount: entity.chosenCount,\n consideredCount: entity.consideredCount,\n currentSizeBytes: entity.currentSizeBytes,\n failureCount: entity.status.failureCount,\n matchedCount: entity.matchedCount,\n outputRecords: entity.outputRecords,\n totalSizeBytes: entity.totalSizeBytes,\n },\n name: entity.name,\n status: {\n availabilityStatus: entity.status.availabilityStatus,\n combinedStatus: entity.status.combinedStatus,\n configStatus: entity.status.configStatus,\n expiresAt: new Date(entity.status.expiresAt),\n isEnabled: entity.isEnabled,\n lastDataFetchAt: entity.status.lastDataFetchAt ? new Date(entity.status.lastDataFetchAt) : null,\n lastFailureMessage: entity.status.lastFailureMessage || null,\n lastRefreshDuration:\n typeof entity.status.lastRefreshDurationMillis === \"number\"\n ? Temporal.Duration.from(parseMilliseconds(entity.status.lastRefreshDurationMillis))\n : null,\n refreshMethod: entity.status.refreshMethod,\n refreshStatus: entity.status.refreshStatus,\n },\n type: entity.reflectionType,\n updatedAt: new Date(entity.updatedAt),\n});\n\ntype ReflectionProperties = ReturnType<typeof reflectionSummaryEntityToProperties>;\n"]}
@@ -16,6 +16,7 @@ export declare const Resources: (config: ResourceConfig & SonarV2Config & SonarV
16
16
  engines: EnginesResource;
17
17
  jobs: {
18
18
  create: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
19
+ createAndRetrieve: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
19
20
  observe: (id: string) => import("rxjs").Observable<import("../oss/jobs/Job.ts").JobResult>;
20
21
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("../oss/jobs/Job.ts").JobResult>;
21
22
  };
@@ -34,10 +34,10 @@ type EnterpriseScriptEntity = ScriptEntity & {
34
34
  };
35
35
  export declare const enterpriseScriptEntityToProperties: (entity: EnterpriseScriptEntity) => {
36
36
  owner: UserGrantee;
37
- createdAt: Temporal.Instant;
37
+ createdAt: import("temporal-polyfill").Temporal.Instant;
38
38
  createdBy: string;
39
39
  id: string;
40
- modifiedAt: Temporal.Instant;
40
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
41
41
  modifiedBy: string;
42
42
  name: string;
43
43
  query: import("../index.ts").Query;
@@ -1,6 +1,7 @@
1
1
  import type { SonarV3Config } from "../../../common/Config.ts";
2
2
  import { SourceCatalogReference } from "../CatalogReferences/SourceCatalogReference.ts";
3
3
  import type { RetrieveByPath } from "../CatalogReferences/BaseCatalogReference.ts";
4
+ import { Temporal } from "temporal-polyfill";
4
5
  export declare class SourceCatalogObject {
5
6
  readonly acceleration: SourceCatalogObjectProperties["acceleration"];
6
7
  readonly allowCrossSourceSelection: SourceCatalogObjectProperties["allowCrossSourceSelection"];
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import parseMilliseconds from "parse-ms";
17
17
  import { SourceCatalogReference } from "../CatalogReferences/SourceCatalogReference.js";
18
+ import { Temporal } from "temporal-polyfill";
18
19
  export class SourceCatalogObject {
19
20
  acceleration;
20
21
  allowCrossSourceSelection;
@@ -1 +1 @@
1
- {"version":3,"file":"SourceCatalogObject.js","sourceRoot":"","sources":["../../../../src/oss/catalog/CatalogObjects/SourceCatalogObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,MAAM,OAAO,mBAAmB;IACrB,YAAY,CAAgD;IAC5D,yBAAyB,CAA6D;IACtF,gBAAgB,CAAyB;IACzC,MAAM,CAA0C;IAChD,SAAS,CAA6C;IACtD,4BAA4B,CAAgE;IAC5F,cAAc,CAAkD;IAChE,iBAAiB,CAAqD;IACtE,MAAM,CAA0C;IAChD,IAAI,CAAwC;IAElC,GAAG,CAAS;IAE/B,YACE,UAGC;QAED,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,yBAAyB,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACtE,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAA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AAE,MAAM,CAAC,iBAAiB;IAC3C,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;IAC3B,GAAG,EAAE,MAAM,CAAC,GAAG;IACf,IAAI,EAAE,MAAM,CAAC,IAAI;CAClB,CAAU,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 parseMilliseconds from \"parse-ms\";\n\nimport type { SonarV3Config } from \"../../../common/Config.ts\";\nimport { SourceCatalogReference } from \"../CatalogReferences/SourceCatalogReference.ts\";\nimport type { RetrieveByPath } from \"../CatalogReferences/BaseCatalogReference.ts\";\n\nexport class SourceCatalogObject {\n readonly acceleration: SourceCatalogObjectProperties[\"acceleration\"];\n readonly allowCrossSourceSelection: SourceCatalogObjectProperties[\"allowCrossSourceSelection\"];\n readonly catalogReference: SourceCatalogReference;\n readonly config: SourceCatalogObjectProperties[\"config\"];\n readonly createdAt: SourceCatalogObjectProperties[\"createdAt\"];\n readonly disableMetadataValidityCheck: SourceCatalogObjectProperties[\"disableMetadataValidityCheck\"];\n readonly metadataPolicy: SourceCatalogObjectProperties[\"metadataPolicy\"];\n readonly sourceChangeState: SourceCatalogObjectProperties[\"sourceChangeState\"];\n readonly status: SourceCatalogObjectProperties[\"status\"];\n readonly type: SourceCatalogObjectProperties[\"type\"];\n\n protected readonly tag: string;\n\n constructor(\n properties: SourceCatalogObjectProperties & {\n catalogReference: SourceCatalogReference;\n tag: string;\n },\n ) {\n this.acceleration = properties.acceleration;\n this.allowCrossSourceSelection = properties.allowCrossSourceSelection;\n this.catalogReference = properties.catalogReference;\n this.config = properties.config;\n this.createdAt = properties.createdAt;\n this.disableMetadataValidityCheck = properties.disableMetadataValidityCheck;\n this.metadataPolicy = properties.metadataPolicy;\n this.sourceChangeState = properties.sourceChangeState;\n this.status = properties.status;\n this.tag = properties.tag;\n this.type = properties.type;\n\n this.pathString = this.catalogReference.pathString.bind(this.catalogReference);\n }\n\n get name() {\n return this.catalogReference.name;\n }\n\n /**\n * @deprecated\n */\n get id() {\n return this.catalogReference.id;\n }\n\n get path() {\n return this.catalogReference.path;\n }\n\n get settled() {\n return this.sourceChangeState === \"NONE\" || this.sourceChangeState === \"UNSPECIFIED\";\n }\n\n pathString: SourceCatalogReference[\"pathString\"];\n}\n\nexport const sourceEntityToProperties = (\n entity: any,\n config: SonarV3Config,\n retrieveByPath: RetrieveByPath,\n) =>\n ({\n acceleration: {\n activePolicyType: entity.accelerationActivePolicyType,\n gracePeriod: Temporal.Duration.from(parseMilliseconds(entity.accelerationGracePeriodMs)),\n neverExpire: entity.accelerationNeverExpire,\n neverRefresh: entity.accelerationNeverRefresh,\n refreshPeriod: Temporal.Duration.from(parseMilliseconds(entity.accelerationRefreshPeriodMs)),\n refreshSchedule: entity.accelerationRefreshSchedule,\n },\n allowCrossSourceSelection: entity.allowCrossSourceSelection,\n catalogReference: new SourceCatalogReference(\n {\n id: entity.id,\n path: [entity.name],\n },\n config,\n retrieveByPath,\n ),\n config: entity.config,\n createdAt: new Date(entity.createdAt),\n disableMetadataValidityCheck: entity.disableMetadataValidityCheck,\n id: entity.id,\n metadataPolicy: {\n authTTL: Temporal.Duration.from(parseMilliseconds(entity.metadataPolicy.authTTLMs)),\n autoPromoteDatasets: entity.metadataPolicy.autoPromoteDatasets,\n datasetExpireAfter: Temporal.Duration.from(\n parseMilliseconds(entity.metadataPolicy.datasetExpireAfterMs),\n ),\n datasetRefreshAfter: Temporal.Duration.from(\n parseMilliseconds(entity.metadataPolicy.datasetRefreshAfterMs),\n ),\n datasetUpdateMode: entity.metadataPolicy.datasetUpdateMode,\n deleteUnavailableDatasets: entity.metadataPolicy.deleteUnavailableDatasets,\n namesRefresh: Temporal.Duration.from(parseMilliseconds(entity.metadataPolicy.namesRefreshMs)),\n },\n name: entity.name,\n sourceChangeState: entity.sourceChangeState,\n status: entity.state.status,\n tag: entity.tag,\n type: entity.type,\n }) as const;\n\nexport type SourceCatalogObjectProperties = ReturnType<typeof sourceEntityToProperties>;\n"]}
1
+ {"version":3,"file":"SourceCatalogObject.js","sourceRoot":"","sources":["../../../../src/oss/catalog/CatalogObjects/SourceCatalogObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,mBAAmB;IACrB,YAAY,CAAgD;IAC5D,yBAAyB,CAA6D;IACtF,gBAAgB,CAAyB;IACzC,MAAM,CAA0C;IAChD,SAAS,CAA6C;IACtD,4BAA4B,CAAgE;IAC5F,cAAc,CAAkD;IAChE,iBAAiB,CAAqD;IACtE,MAAM,CAA0C;IAChD,IAAI,CAAwC;IAElC,GAAG,CAAS;IAE/B,YACE,UAGC;QAED,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,yBAAyB,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACtE,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,4BAA4B,GAAG,UAAU,CAAC,4BAA4B,CAAC;QAC5E,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,iBAAiB,GAAG,UAAU,CA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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 parseMilliseconds from \"parse-ms\";\n\nimport type { SonarV3Config } from \"../../../common/Config.ts\";\nimport { SourceCatalogReference } from \"../CatalogReferences/SourceCatalogReference.ts\";\nimport type { RetrieveByPath } from \"../CatalogReferences/BaseCatalogReference.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\nexport class SourceCatalogObject {\n readonly acceleration: SourceCatalogObjectProperties[\"acceleration\"];\n readonly allowCrossSourceSelection: SourceCatalogObjectProperties[\"allowCrossSourceSelection\"];\n readonly catalogReference: SourceCatalogReference;\n readonly config: SourceCatalogObjectProperties[\"config\"];\n readonly createdAt: SourceCatalogObjectProperties[\"createdAt\"];\n readonly disableMetadataValidityCheck: SourceCatalogObjectProperties[\"disableMetadataValidityCheck\"];\n readonly metadataPolicy: SourceCatalogObjectProperties[\"metadataPolicy\"];\n readonly sourceChangeState: SourceCatalogObjectProperties[\"sourceChangeState\"];\n readonly status: SourceCatalogObjectProperties[\"status\"];\n readonly type: SourceCatalogObjectProperties[\"type\"];\n\n protected readonly tag: string;\n\n constructor(\n properties: SourceCatalogObjectProperties & {\n catalogReference: SourceCatalogReference;\n tag: string;\n },\n ) {\n this.acceleration = properties.acceleration;\n this.allowCrossSourceSelection = properties.allowCrossSourceSelection;\n this.catalogReference = properties.catalogReference;\n this.config = properties.config;\n this.createdAt = properties.createdAt;\n this.disableMetadataValidityCheck = properties.disableMetadataValidityCheck;\n this.metadataPolicy = properties.metadataPolicy;\n this.sourceChangeState = properties.sourceChangeState;\n this.status = properties.status;\n this.tag = properties.tag;\n this.type = properties.type;\n\n this.pathString = this.catalogReference.pathString.bind(this.catalogReference);\n }\n\n get name() {\n return this.catalogReference.name;\n }\n\n /**\n * @deprecated\n */\n get id() {\n return this.catalogReference.id;\n }\n\n get path() {\n return this.catalogReference.path;\n }\n\n get settled() {\n return this.sourceChangeState === \"NONE\" || this.sourceChangeState === \"UNSPECIFIED\";\n }\n\n pathString: SourceCatalogReference[\"pathString\"];\n}\n\nexport const sourceEntityToProperties = (\n entity: any,\n config: SonarV3Config,\n retrieveByPath: RetrieveByPath,\n) =>\n ({\n acceleration: {\n activePolicyType: entity.accelerationActivePolicyType,\n gracePeriod: Temporal.Duration.from(parseMilliseconds(entity.accelerationGracePeriodMs)),\n neverExpire: entity.accelerationNeverExpire,\n neverRefresh: entity.accelerationNeverRefresh,\n refreshPeriod: Temporal.Duration.from(parseMilliseconds(entity.accelerationRefreshPeriodMs)),\n refreshSchedule: entity.accelerationRefreshSchedule,\n },\n allowCrossSourceSelection: entity.allowCrossSourceSelection,\n catalogReference: new SourceCatalogReference(\n {\n id: entity.id,\n path: [entity.name],\n },\n config,\n retrieveByPath,\n ),\n config: entity.config,\n createdAt: new Date(entity.createdAt),\n disableMetadataValidityCheck: entity.disableMetadataValidityCheck,\n id: entity.id,\n metadataPolicy: {\n authTTL: Temporal.Duration.from(parseMilliseconds(entity.metadataPolicy.authTTLMs)),\n autoPromoteDatasets: entity.metadataPolicy.autoPromoteDatasets,\n datasetExpireAfter: Temporal.Duration.from(\n parseMilliseconds(entity.metadataPolicy.datasetExpireAfterMs),\n ),\n datasetRefreshAfter: Temporal.Duration.from(\n parseMilliseconds(entity.metadataPolicy.datasetRefreshAfterMs),\n ),\n datasetUpdateMode: entity.metadataPolicy.datasetUpdateMode,\n deleteUnavailableDatasets: entity.metadataPolicy.deleteUnavailableDatasets,\n namesRefresh: Temporal.Duration.from(parseMilliseconds(entity.metadataPolicy.namesRefreshMs)),\n },\n name: entity.name,\n sourceChangeState: entity.sourceChangeState,\n status: entity.state.status,\n tag: entity.tag,\n type: entity.type,\n }) as const;\n\nexport type SourceCatalogObjectProperties = ReturnType<typeof sourceEntityToProperties>;\n"]}
@@ -8,7 +8,7 @@ export declare abstract class BaseCatalogReference {
8
8
  abstract catalogObject(): Promise<Result<CatalogObject, unknown>>;
9
9
  constructor(properties: BaseCatalogReferenceProperties);
10
10
  get name(): string;
11
- pathString: (SEPARATOR?: string) => string;
11
+ pathString(SEPARATOR?: string): string;
12
12
  }
13
13
  export type BaseCatalogReferenceProperties = {
14
14
  id: string;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { catalogPathToString } from "./utils/catalogPathToString.js";
16
17
  export class BaseCatalogReference {
17
18
  id;
18
19
  path;
@@ -23,12 +24,8 @@ export class BaseCatalogReference {
23
24
  get name() {
24
25
  return this.path.at(-1);
25
26
  }
26
- pathString = pathString(() => this.path);
27
+ pathString(SEPARATOR = ".") {
28
+ return catalogPathToString(this.path, SEPARATOR);
29
+ }
27
30
  }
28
- const requiresQuotes = /\W/;
29
- const pathString = (getPath) => (SEPARATOR = ".") => {
30
- return getPath()
31
- .map((part) => (requiresQuotes.test(part) ? `"${part}"` : part))
32
- .join(SEPARATOR);
33
- };
34
31
  //# sourceMappingURL=BaseCatalogReference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCatalogReference.js","sourceRoot":"","sources":["../../../../src/oss/catalog/CatalogReferences/BaseCatalogReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,MAAM,OAAgB,oBAAoB;IAC/B,EAAE,CAAuC;IACzC,IAAI,CAAyC;IAItD,YAAY,UAA0C;QACpD,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;IAC3B,CAAC;IAED,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,UAAU,GACd,CAAC,OAAuB,EAAE,EAAE,CAC5B,CAAC,YAAoB,GAAG,EAAU,EAAE;IAClC,OAAO,OAAO,EAAE;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC/D,IAAI,CAAC,SAAS,CAAC,CAAC;AACrB,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 { Result } from \"ts-results-es\";\nimport type { CatalogObject } from \"../CatalogObjects/index.ts\";\n\nexport type RetrieveByPath = (path: string[]) => Promise<Result<CatalogObject, unknown>>;\n\nexport abstract class BaseCatalogReference {\n readonly id: BaseCatalogReferenceProperties[\"id\"];\n readonly path: BaseCatalogReferenceProperties[\"path\"];\n abstract readonly type: string;\n abstract catalogObject(): Promise<Result<CatalogObject, unknown>>;\n\n constructor(properties: BaseCatalogReferenceProperties) {\n this.id = properties.id;\n this.path = properties.path;\n }\n\n get name() {\n return this.path.at(-1)!;\n }\n\n pathString = pathString(() => this.path);\n}\n\nconst requiresQuotes = /\\W/;\n\nconst pathString =\n (getPath: () => string[]) =>\n (SEPARATOR: string = \".\"): string => {\n return getPath()\n .map((part) => (requiresQuotes.test(part) ? `\"${part}\"` : part))\n .join(SEPARATOR);\n };\n\nexport type BaseCatalogReferenceProperties = { id: string; path: string[] };\n"]}
1
+ {"version":3,"file":"BaseCatalogReference.js","sourceRoot":"","sources":["../../../../src/oss/catalog/CatalogReferences/BaseCatalogReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAIrE,MAAM,OAAgB,oBAAoB;IAC/B,EAAE,CAAuC;IACzC,IAAI,CAAyC;IAItD,YAAY,UAA0C;QACpD,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;IAC3B,CAAC;IAED,UAAU,CAAC,YAAoB,GAAG;QAChC,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Result } from \"ts-results-es\";\nimport type { CatalogObject } from \"../CatalogObjects/index.ts\";\nimport { catalogPathToString } from \"./utils/catalogPathToString.ts\";\n\nexport type RetrieveByPath = (path: string[]) => Promise<Result<CatalogObject, unknown>>;\n\nexport abstract class BaseCatalogReference {\n readonly id: BaseCatalogReferenceProperties[\"id\"];\n readonly path: BaseCatalogReferenceProperties[\"path\"];\n abstract readonly type: string;\n abstract catalogObject(): Promise<Result<CatalogObject, unknown>>;\n\n constructor(properties: BaseCatalogReferenceProperties) {\n this.id = properties.id;\n this.path = properties.path;\n }\n\n get name() {\n return this.path.at(-1)!;\n }\n\n pathString(SEPARATOR: string = \".\") {\n return catalogPathToString(this.path, SEPARATOR);\n }\n}\n\nexport type BaseCatalogReferenceProperties = { id: string; path: string[] };\n"]}
@@ -0,0 +1 @@
1
+ export declare const catalogPathToString: (path: string[], SEPARATOR?: string) => string;
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (C) 2024-2025 Dremio Corporation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const catalogPathToString = (path, SEPARATOR = ".") => path.map((part) => (requiresQuotes.test(part) ? `"${part}"` : part)).join(SEPARATOR);
17
+ const requiresQuotes = /\W/;
18
+ //# sourceMappingURL=catalogPathToString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogPathToString.js","sourceRoot":"","sources":["../../../../../src/oss/catalog/CatalogReferences/utils/catalogPathToString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,YAAoB,GAAG,EAAE,EAAE,CAC7E,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAEvF,MAAM,cAAc,GAAG,IAAI,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const catalogPathToString = (path: string[], SEPARATOR: string = \".\") =>\n path.map((part) => (requiresQuotes.test(part) ? `\"${part}\"` : part)).join(SEPARATOR);\n\nconst requiresQuotes = /\\W/;\n"]}
@@ -1,4 +1,3 @@
1
- import "temporal-polyfill/global";
2
1
  import { createRequest } from "../common/createRequest.ts";
3
2
  import type { Config } from "../common/Config.ts";
4
3
  import { Resources } from "./resources.ts";
@@ -28,6 +27,7 @@ export declare const Dremio: (config: Config) => {
28
27
  };
29
28
  jobs: {
30
29
  create: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
30
+ createAndRetrieve: (query: import("../common/Query.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
31
31
  observe: (id: string) => import("rxjs").Observable<import("./jobs/Job.ts").JobResult>;
32
32
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("./jobs/Job.ts").JobResult>;
33
33
  };
package/dist/oss/index.js CHANGED
@@ -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 "temporal-polyfill/global";
17
16
  import { createRequest } from "../common/createRequest.js";
18
17
  import { Resources } from "./resources.js";
19
18
  const getSonarResourceConfig = (config) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oss/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE;IAChD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC;QAC/D,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;KACR,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,mBAAmB,CAAC,OAAO;QACrC,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,mBAAmB,CAAC,cAAc;QACnD,eAAe,EAAE,mBAAmB,CAAC,cAAc;KACpD,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,SAAS,IAAI,UAAU,EAAE,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 \"temporal-polyfill/global\";\nimport { createRequest } from \"../common/createRequest.ts\";\nimport type { Config, ResourceConfig, SonarV2Config, SonarV3Config } from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: sonarResourceConfig.request,\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV2Request: sonarResourceConfig.sonarV2Request,\n _sonarV3Request: sonarResourceConfig.sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport { createRequest, Resources as _Resources };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oss/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,EAAE;IAChD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;QACP,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC;QAC/D,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC;KACR,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO;QACL,GAAG,SAAS,CAAC,mBAAmB,CAAC;QACjC,QAAQ,EAAE,mBAAmB,CAAC,OAAO;QACrC,oBAAoB,EAAE,mBAAmB;QACzC,eAAe,EAAE,mBAAmB,CAAC,cAAc;QACnD,eAAe,EAAE,mBAAmB,CAAC,cAAc;KACpD,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,SAAS,IAAI,UAAU,EAAE,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 { createRequest } from \"../common/createRequest.ts\";\nimport type { Config, ResourceConfig, SonarV2Config, SonarV3Config } from \"../common/Config.ts\";\nimport { Resources } from \"./resources.ts\";\n\nconst getSonarResourceConfig = (config: Config) => {\n const request = createRequest(config);\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path, init) => request(`/apiv2/${path}`, init),\n sonarV3Request: (path, init) => request(`/api/v3/${path}`, init),\n } satisfies ResourceConfig & SonarV2Config & SonarV3Config;\n};\n\nexport const Dremio = (config: Config) => {\n const sonarResourceConfig = getSonarResourceConfig(config);\n return {\n ...Resources(sonarResourceConfig),\n _request: sonarResourceConfig.request,\n _sonarResourceConfig: sonarResourceConfig,\n _sonarV2Request: sonarResourceConfig.sonarV2Request,\n _sonarV3Request: sonarResourceConfig.sonarV3Request,\n };\n};\n\nexport * from \"../common/sharedExports.ts\";\nexport * from \"./credentials/index.ts\";\nexport * from \"./interfaces.ts\";\nexport { createRequest, Resources as _Resources };\n"]}
@@ -30,7 +30,7 @@ export declare class Job {
30
30
  };
31
31
  readonly totalRows: number;
32
32
  }, void, unknown>;
33
- slice: <T extends Record<string, unknown> = Record<string, unknown>>(start?: number, end?: number) => Promise<T[]>;
33
+ slice: <T extends Record<string, unknown> = Record<string, unknown>>(start?: number, end?: number) => Promise<Err<unknown> | Ok<T[]>>;
34
34
  };
35
35
  cancel(): Promise<Err<any> | Ok<undefined>>;
36
36
  }
@@ -112,11 +112,16 @@ export class Job {
112
112
  }
113
113
  }
114
114
  async #slice(start = 0, end = Infinity) {
115
- const rows = [];
116
- for await (const batch of this.#jsonBatches({ limit: end - start, offset: start })) {
117
- rows.push(...batch.rows);
115
+ try {
116
+ const rows = [];
117
+ for await (const batch of this.#jsonBatches({ limit: end - start, offset: start })) {
118
+ rows.push(...batch.rows);
119
+ }
120
+ return Ok(rows);
121
+ }
122
+ catch (e) {
123
+ return Err(e);
118
124
  }
119
- return rows;
120
125
  }
121
126
  async cancel() {
122
127
  return this.#config
@@ -1 +1 @@
1
- {"version":3,"file":"Job.js","sourceRoot":"","sources":["../../../src/oss/jobs/Job.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CA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;QACzD,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC;QAC5C,CAAC,CAAC,IAAI;IACR,2BAA2B,EAAE,MAAM,CAAC,2BAA2B;QAC7D,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC;QAC9C,CAAC,CAAC,IAAI;IACR,QAAQ,EAAE,MAAM,CAAC,QAAQ;IACzB,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;IAC/D,KAAK,EAAE,MAAM,CAAC,QAAQ;CACvB,CAAU,CAAC;AAMd,MAAM,cAAc,GAAG,GAAG,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 { Problem } from \"../../common/Problem.ts\";\nimport { Err, Ok, Result } from \"ts-results-es\";\nimport { lastValueFrom, map, of, switchMap, type Observable } from \"rxjs\";\nimport type { JobResultsResponse } from \"./utils/JobResultsResponse.ts\";\nimport { mapRowsToColumns } from \"./utils/mapRowsToColumns.ts\";\nimport { mapRowData } from \"./utils/mapRowData.ts\";\n\nexport class Job {\n readonly acceleration: JobProperties[\"acceleration\"];\n readonly cancellationReason: JobProperties[\"cancellationReason\"];\n readonly endedAt: JobProperties[\"endedAt\"];\n readonly id: JobProperties[\"id\"];\n readonly problem: JobProperties[\"problem\"];\n readonly queryType: JobProperties[\"queryType\"];\n readonly resourceSchedulingEndedAt: JobProperties[\"resourceSchedulingEndedAt\"];\n readonly resourceSchedulingStartedAt: JobProperties[\"resourceSchedulingStartedAt\"];\n readonly rowCount: JobProperties[\"rowCount\"];\n readonly startedAt: JobProperties[\"startedAt\"];\n readonly state: JobProperties[\"state\"];\n\n public readonly observer: Observable<Job>;\n #config: SonarV3Config;\n\n constructor(\n properties: JobProperties,\n config: SonarV3Config,\n observe: (id: string) => Observable<JobResult>,\n ) {\n this.acceleration = properties.acceleration;\n this.cancellationReason = properties.cancellationReason;\n this.endedAt = properties.endedAt;\n this.id = properties.id;\n this.problem = properties.problem;\n this.queryType = properties.queryType;\n this.resourceSchedulingEndedAt = properties.resourceSchedulingEndedAt;\n this.resourceSchedulingStartedAt = properties.resourceSchedulingStartedAt;\n this.rowCount = properties.rowCount;\n this.startedAt = properties.startedAt;\n this.state = properties.state;\n this.#config = config;\n this.observer = of(this).pipe(\n switchMap((job) => {\n if (!job.settled) {\n return observe(this.id).pipe(\n map((result) => {\n if (result.isErr()) {\n throw result.error;\n }\n return result.value;\n }),\n );\n } else {\n return of(job);\n }\n }),\n );\n }\n\n get settled() {\n return (\n this.state === \"COMPLETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID_STATE\" ||\n this.state === \"CANCELED\"\n );\n }\n\n get results() {\n return {\n jsonBatches: this.#jsonBatches.bind(this),\n slice: this.#slice.bind(this),\n };\n }\n\n async *#jsonBatches<T extends Record<string, unknown> = Record<string, unknown>>(\n args: { limit?: number; offset?: number } = {},\n ) {\n if (typeof args.limit === \"number\" && args.limit < 0) {\n throw new Error(\"Limit cannot be negative\");\n }\n\n if (typeof args.offset === \"number\" && args.offset < 0) {\n throw new Error(\"Offset cannot be negative\");\n }\n\n // Wait for job to enter a settled state before attempting to fetch batches\n if (!this.settled) {\n await lastValueFrom(this.observer);\n }\n\n const limitArg = args.limit ?? Infinity;\n const offsetArg = args.offset || 0;\n\n // Tracks whether there are more rows available from the job results endpoint\n let hasMore = true;\n\n // Tracks the currently requested offset. If the offset arg is provided, start from there instead of 0.\n let offset = offsetArg;\n\n // Keeps track of the total number of rows that need to be loaded\n const stopAfterOffset = limitArg + offsetArg;\n\n while (hasMore && offset < stopAfterOffset) {\n // Make batch_size dynamic to allow for requesting a smaller final page\n const batch_size = Math.min(MAX_BATCH_SIZE, stopAfterOffset - offset);\n\n const batch = await this.#config\n .sonarV3Request(`job/${this.id}/results?offset=${offset}&limit=${batch_size}`)\n .then((res) => res.json() as Promise<JobResultsResponse<T>>);\n\n offset += batch.rows.length;\n hasMore = batch.rows.length === batch_size;\n\n if (batch.rows.length) {\n const schema = { fields: batch.schema };\n mapRowData(batch.rows, batch.schema);\n yield {\n get columns() {\n return mapRowsToColumns(batch);\n },\n rows: batch.rows,\n schema,\n totalRows: batch.rowCount,\n } as const;\n }\n }\n }\n\n async #slice<T extends Record<string, unknown> = Record<string, unknown>>(\n start: number = 0,\n end: number = Infinity,\n ) {\n const rows: T[] = [];\n for await (const batch of this.#jsonBatches<T>({ limit: end - start, offset: start })) {\n rows.push(...batch.rows);\n }\n return rows;\n }\n\n async cancel() {\n return this.#config\n .sonarV3Request(`job/${this.id}/cancel`, {\n keepalive: true,\n method: \"POST\",\n })\n .then(() => Ok(undefined))\n .catch((e) => Err(e));\n }\n}\n\nexport const jobEntityToProperties = (\n id: string,\n entity: {\n jobState:\n | \"NOT_SUBMITTED\"\n | \"STARTING\"\n | \"RUNNING\"\n | \"COMPLETED\"\n | \"CANCELED\"\n | \"FAILED\"\n | \"CANCELLATION_REQUESTED\"\n | \"PLANNING\"\n | \"PENDING\"\n | \"METADATA_RETRIEVAL\"\n | \"QUEUED\"\n | \"ENGINE_START\"\n | \"EXECUTION_PLANNING\"\n | \"INVALID_STATE\";\n rowCount: number | null;\n errorMessage: string;\n startedAt: string | null;\n endedAt: string | null;\n acceleration: {\n reflectionRelationships: {\n datasetId: string;\n reflectionId: string;\n relationship: string;\n }[];\n };\n queryType:\n | \"UI_RUN\"\n | \"UI_PREVIEW\"\n | \"UI_INTERNAL_PREVIEW\"\n | \"UI_INTERNAL_RUN\"\n | \"UI_EXPORT\"\n | \"ODBC\"\n | \"JDBC\"\n | \"REST\"\n | \"ACCELERATOR_CREATE\"\n | \"ACCELERATOR_DROP\"\n | \"UNKNOWN\"\n | \"PREPARE_INTERNAL\"\n | \"ACCELERATOR_EXPLAIN\"\n | \"UI_INITIAL_PREVIEW\";\n resourceSchedulingStartedAt: string | null;\n resourceSchedulingEndedAt: string | null;\n cancellationReason: string | null;\n },\n) =>\n ({\n acceleration: entity.acceleration,\n cancellationReason: entity.cancellationReason,\n endedAt: entity.endedAt ? new Date(entity.endedAt) : null,\n id,\n problem: null as Problem | null,\n queryType: entity.queryType,\n resourceSchedulingEndedAt: entity.resourceSchedulingEndedAt\n ? new Date(entity.resourceSchedulingEndedAt)\n : null,\n resourceSchedulingStartedAt: entity.resourceSchedulingStartedAt\n ? new Date(entity.resourceSchedulingStartedAt)\n : null,\n rowCount: entity.rowCount,\n startedAt: entity.startedAt ? new Date(entity.startedAt) : null,\n state: entity.jobState,\n }) as const;\n\ntype JobProperties = ReturnType<typeof jobEntityToProperties>;\n\nexport type JobResult = Result<Job, unknown>;\n\nconst MAX_BATCH_SIZE = 500;\n"]}
1
+ {"version":3,"file":"Job.js","sourceRoot":"","sources":["../../../src/oss/jobs/Job.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAmB,MAAM,MAAM,CAAC;AAE1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,OAAO,GAAG;IACL,YAAY,CAAgC;IAC5C,kBAAkB,CAAsC;IACxD,OAAO,CAA2B;IAClC,EAAE,CAAsB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MAAM,CAAC,2BAA2B,CAAC;QAC9C,CAAC,CAAC,IAAI;IACR,QAAQ,EAAE,MAAM,CAAC,QAAQ;IACzB,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;IAC/D,KAAK,EAAE,MAAM,CAAC,QAAQ;CACvB,CAAU,CAAC;AAMd,MAAM,cAAc,GAAG,GAAG,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 { Problem } from \"../../common/Problem.ts\";\nimport { Err, Ok, Result } from \"ts-results-es\";\nimport { lastValueFrom, map, of, switchMap, type Observable } from \"rxjs\";\nimport type { JobResultsResponse } from \"./utils/JobResultsResponse.ts\";\nimport { mapRowsToColumns } from \"./utils/mapRowsToColumns.ts\";\nimport { mapRowData } from \"./utils/mapRowData.ts\";\n\nexport class Job {\n readonly acceleration: JobProperties[\"acceleration\"];\n readonly cancellationReason: JobProperties[\"cancellationReason\"];\n readonly endedAt: JobProperties[\"endedAt\"];\n readonly id: JobProperties[\"id\"];\n readonly problem: JobProperties[\"problem\"];\n readonly queryType: JobProperties[\"queryType\"];\n readonly resourceSchedulingEndedAt: JobProperties[\"resourceSchedulingEndedAt\"];\n readonly resourceSchedulingStartedAt: JobProperties[\"resourceSchedulingStartedAt\"];\n readonly rowCount: JobProperties[\"rowCount\"];\n readonly startedAt: JobProperties[\"startedAt\"];\n readonly state: JobProperties[\"state\"];\n\n public readonly observer: Observable<Job>;\n #config: SonarV3Config;\n\n constructor(\n properties: JobProperties,\n config: SonarV3Config,\n observe: (id: string) => Observable<JobResult>,\n ) {\n this.acceleration = properties.acceleration;\n this.cancellationReason = properties.cancellationReason;\n this.endedAt = properties.endedAt;\n this.id = properties.id;\n this.problem = properties.problem;\n this.queryType = properties.queryType;\n this.resourceSchedulingEndedAt = properties.resourceSchedulingEndedAt;\n this.resourceSchedulingStartedAt = properties.resourceSchedulingStartedAt;\n this.rowCount = properties.rowCount;\n this.startedAt = properties.startedAt;\n this.state = properties.state;\n this.#config = config;\n this.observer = of(this).pipe(\n switchMap((job) => {\n if (!job.settled) {\n return observe(this.id).pipe(\n map((result) => {\n if (result.isErr()) {\n throw result.error;\n }\n return result.value;\n }),\n );\n } else {\n return of(job);\n }\n }),\n );\n }\n\n get settled() {\n return (\n this.state === \"COMPLETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID_STATE\" ||\n this.state === \"CANCELED\"\n );\n }\n\n get results() {\n return {\n jsonBatches: this.#jsonBatches.bind(this),\n slice: this.#slice.bind(this),\n };\n }\n\n async *#jsonBatches<T extends Record<string, unknown> = Record<string, unknown>>(\n args: { limit?: number; offset?: number } = {},\n ) {\n if (typeof args.limit === \"number\" && args.limit < 0) {\n throw new Error(\"Limit cannot be negative\");\n }\n\n if (typeof args.offset === \"number\" && args.offset < 0) {\n throw new Error(\"Offset cannot be negative\");\n }\n\n // Wait for job to enter a settled state before attempting to fetch batches\n if (!this.settled) {\n await lastValueFrom(this.observer);\n }\n\n const limitArg = args.limit ?? Infinity;\n const offsetArg = args.offset || 0;\n\n // Tracks whether there are more rows available from the job results endpoint\n let hasMore = true;\n\n // Tracks the currently requested offset. If the offset arg is provided, start from there instead of 0.\n let offset = offsetArg;\n\n // Keeps track of the total number of rows that need to be loaded\n const stopAfterOffset = limitArg + offsetArg;\n\n while (hasMore && offset < stopAfterOffset) {\n // Make batch_size dynamic to allow for requesting a smaller final page\n const batch_size = Math.min(MAX_BATCH_SIZE, stopAfterOffset - offset);\n\n const batch = await this.#config\n .sonarV3Request(`job/${this.id}/results?offset=${offset}&limit=${batch_size}`)\n .then((res) => res.json() as Promise<JobResultsResponse<T>>);\n\n offset += batch.rows.length;\n hasMore = batch.rows.length === batch_size;\n\n if (batch.rows.length) {\n const schema = { fields: batch.schema };\n mapRowData(batch.rows, batch.schema);\n yield {\n get columns() {\n return mapRowsToColumns(batch);\n },\n rows: batch.rows,\n schema,\n totalRows: batch.rowCount,\n } as const;\n }\n }\n }\n\n async #slice<T extends Record<string, unknown> = Record<string, unknown>>(\n start: number = 0,\n end: number = Infinity,\n ) {\n try {\n const rows: T[] = [];\n for await (const batch of this.#jsonBatches<T>({ limit: end - start, offset: start })) {\n rows.push(...batch.rows);\n }\n return Ok(rows);\n } catch (e: unknown) {\n return Err(e);\n }\n }\n\n async cancel() {\n return this.#config\n .sonarV3Request(`job/${this.id}/cancel`, {\n keepalive: true,\n method: \"POST\",\n })\n .then(() => Ok(undefined))\n .catch((e) => Err(e));\n }\n}\n\nexport const jobEntityToProperties = (\n id: string,\n entity: {\n jobState:\n | \"NOT_SUBMITTED\"\n | \"STARTING\"\n | \"RUNNING\"\n | \"COMPLETED\"\n | \"CANCELED\"\n | \"FAILED\"\n | \"CANCELLATION_REQUESTED\"\n | \"PLANNING\"\n | \"PENDING\"\n | \"METADATA_RETRIEVAL\"\n | \"QUEUED\"\n | \"ENGINE_START\"\n | \"EXECUTION_PLANNING\"\n | \"INVALID_STATE\";\n rowCount: number | null;\n errorMessage: string;\n startedAt: string | null;\n endedAt: string | null;\n acceleration: {\n reflectionRelationships: {\n datasetId: string;\n reflectionId: string;\n relationship: string;\n }[];\n };\n queryType:\n | \"UI_RUN\"\n | \"UI_PREVIEW\"\n | \"UI_INTERNAL_PREVIEW\"\n | \"UI_INTERNAL_RUN\"\n | \"UI_EXPORT\"\n | \"ODBC\"\n | \"JDBC\"\n | \"REST\"\n | \"ACCELERATOR_CREATE\"\n | \"ACCELERATOR_DROP\"\n | \"UNKNOWN\"\n | \"PREPARE_INTERNAL\"\n | \"ACCELERATOR_EXPLAIN\"\n | \"UI_INITIAL_PREVIEW\";\n resourceSchedulingStartedAt: string | null;\n resourceSchedulingEndedAt: string | null;\n cancellationReason: string | null;\n },\n) =>\n ({\n acceleration: entity.acceleration,\n cancellationReason: entity.cancellationReason,\n endedAt: entity.endedAt ? new Date(entity.endedAt) : null,\n id,\n problem: null as Problem | null,\n queryType: entity.queryType,\n resourceSchedulingEndedAt: entity.resourceSchedulingEndedAt\n ? new Date(entity.resourceSchedulingEndedAt)\n : null,\n resourceSchedulingStartedAt: entity.resourceSchedulingStartedAt\n ? new Date(entity.resourceSchedulingStartedAt)\n : null,\n rowCount: entity.rowCount,\n startedAt: entity.startedAt ? new Date(entity.startedAt) : null,\n state: entity.jobState,\n }) as const;\n\ntype JobProperties = ReturnType<typeof jobEntityToProperties>;\n\nexport type JobResult = Result<Job, unknown>;\n\nconst MAX_BATCH_SIZE = 500;\n"]}
@@ -1,10 +1,14 @@
1
1
  import type { SonarV3Config } from "../../common/Config.ts";
2
- import { type JobResult } from "./Job.ts";
2
+ import { Job, type JobResult } from "./Job.ts";
3
3
  import { Query } from "../../common/Query.ts";
4
4
  import { Err, Ok } from "ts-results-es";
5
5
  import type { SignalParam } from "../../common/Params.ts";
6
6
  export declare const JobsResource: (config: SonarV3Config) => {
7
7
  create: (query: Query) => Promise<Err<unknown> | Ok<string>>;
8
+ /**
9
+ * A convenience method to combine job creation and retrieval
10
+ */
11
+ createAndRetrieve: (query: Query) => Promise<import("ts-results-es").Result<Job, unknown>>;
8
12
  observe: (id: string) => import("rxjs").Observable<JobResult>;
9
13
  retrieve: (id: string, { signal }?: SignalParam) => Promise<JobResult>;
10
14
  };
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Job, jobEntityToProperties } from "./Job.js";
17
17
  import { Query } from "../../common/Query.js";
18
- import { Err, Ok } from "ts-results-es";
18
+ import { Err, Ok, AsyncResult } from "ts-results-es";
19
19
  import { concatMap, shareReplay, takeWhile, timer } from "rxjs";
20
20
  import { fromAbortable } from "../../common/fromAbortable.js";
21
21
  export const JobsResource = (config) => {
@@ -43,30 +43,35 @@ export const JobsResource = (config) => {
43
43
  bufferSize: 1,
44
44
  refCount: true,
45
45
  }));
46
+ const create = (query) => {
47
+ return config
48
+ .sonarV3Request(`sql`, {
49
+ body: JSON.stringify({
50
+ context: query.context,
51
+ sql: query.sql,
52
+ }),
53
+ headers: {
54
+ Accept: "application/json",
55
+ "Content-Type": "application/json",
56
+ },
57
+ keepalive: true,
58
+ method: "POST",
59
+ })
60
+ .then((res) => res.json())
61
+ .then((response) => Ok(response.id))
62
+ .catch((e) => Err(e));
63
+ };
46
64
  const retrieve = (id, { signal } = {}) => config
47
65
  .sonarV3Request(`job/${id}`, { signal })
48
66
  .then((res) => res.json())
49
67
  .then((properties) => Ok(new Job(jobEntityToProperties(id, properties), config, observe)))
50
68
  .catch((e) => Err(e));
51
69
  return {
52
- create: (query) => {
53
- return config
54
- .sonarV3Request(`sql`, {
55
- body: JSON.stringify({
56
- context: query.context,
57
- sql: query.sql,
58
- }),
59
- headers: {
60
- Accept: "application/json",
61
- "Content-Type": "application/json",
62
- },
63
- keepalive: true,
64
- method: "POST",
65
- })
66
- .then((res) => res.json())
67
- .then((response) => Ok(response.id))
68
- .catch((e) => Err(e));
69
- },
70
+ create,
71
+ /**
72
+ * A convenience method to combine job creation and retrieval
73
+ */
74
+ createAndRetrieve: (query) => new AsyncResult(create(query)).andThen((jobId) => retrieve(jobId)).promise,
70
75
  observe,
71
76
  retrieve,
72
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"JobsResource.js","sourceRoot":"","sources":["../../../src/oss/jobs/JobsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAkB,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MA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AAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,OAAO;QACL,MAAM,EAAE,CAAC,KAAY,EAAE,EAAE;YACvB,OAAO,MAAM;iBACV,cAAc,CAAC,KAAK,EAAE;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,GAAG,EAAE,KAAK,CAAC,GAAG;iBACf,CAAC;gBACF,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,kBAAkB;iBACnC;gBACD,SAAS,EAAE,IAAI;gBACf,MAAM,EAAE,MAAM;aACf,CAAC;iBACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA6B,CAAC;iBACpD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;iBACnC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;QACD,OAAO;QACP,QAAQ;KACT,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 { Job, jobEntityToProperties, type JobResult } from \"./Job.ts\";\nimport { Query } from \"../../common/Query.ts\";\nimport { Err, Ok } from \"ts-results-es\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { concatMap, shareReplay, takeWhile, timer } from \"rxjs\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\n\nexport const JobsResource = (config: SonarV3Config) => {\n const observe = (id: string) =>\n /**\n * Check every 1000ms for job status changes. 1000ms may seem too frequent,\n * but it helps keep the client feeling snappy, especially for jobs that complete quickly.\n */\n timer(0, 1000).pipe(\n /**\n * Use `concatMap` instead of `switchMap` to avoid a situation where the call takes longer than\n * 1000ms (possibly due to network conditions or API slowdowns) which would cause switchMap to\n * constantly cancel unfinished requests (in which case, no requests would ever complete)\n */\n concatMap(() => fromAbortable(({ signal }) => retrieve(id, { signal }))),\n /**\n * Continue polling until the job has reached a settled state\n */\n takeWhile((jobResult) => jobResult.isOk() && !jobResult.value.settled, true),\n /**\n * Reuse the same polling for multiple subscribers, buffering only the latest result.\n * Make sure to unsubscribe from the source to stop polling when there are no subscribers (refCount: true)\n */\n shareReplay({\n bufferSize: 1,\n refCount: true,\n }),\n );\n const retrieve = (id: string, { signal }: SignalParam = {}): Promise<JobResult> =>\n config\n .sonarV3Request(`job/${id}`, { signal })\n .then((res) => res.json())\n .then((properties) => Ok(new Job(jobEntityToProperties(id, properties), config, observe)))\n .catch((e: unknown) => Err(e));\n return {\n create: (query: Query) => {\n return config\n .sonarV3Request(`sql`, {\n body: JSON.stringify({\n context: query.context,\n sql: query.sql,\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .then((res) => res.json() as Promise<{ id: string }>)\n .then((response) => Ok(response.id))\n .catch((e: unknown) => Err(e));\n },\n observe,\n retrieve,\n };\n};\n"]}
1
+ {"version":3,"file":"JobsResource.js","sourceRoot":"","sources":["../../../src/oss/jobs/JobsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAkB,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OA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IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;aACnC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC;IACF,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAE,EAAE,MAAM,KAAkB,EAAE,EAAsB,EAAE,CAChF,MAAM;SACH,cAAc,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;SACvC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,qBAAqB,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;SACzF,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,OAAO;QACL,MAAM;QACN;;WAEG;QACH,iBAAiB,EAAE,CAAC,KAAY,EAAE,EAAE,CAClC,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;QAC5E,OAAO;QACP,QAAQ;KACT,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 { Job, jobEntityToProperties, type JobResult } from \"./Job.ts\";\nimport { Query } from \"../../common/Query.ts\";\nimport { Err, Ok, AsyncResult } from \"ts-results-es\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { concatMap, shareReplay, takeWhile, timer } from \"rxjs\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\n\nexport const JobsResource = (config: SonarV3Config) => {\n const observe = (id: string) =>\n /**\n * Check every 1000ms for job status changes. 1000ms may seem too frequent,\n * but it helps keep the client feeling snappy, especially for jobs that complete quickly.\n */\n timer(0, 1000).pipe(\n /**\n * Use `concatMap` instead of `switchMap` to avoid a situation where the call takes longer than\n * 1000ms (possibly due to network conditions or API slowdowns) which would cause switchMap to\n * constantly cancel unfinished requests (in which case, no requests would ever complete)\n */\n concatMap(() => fromAbortable(({ signal }) => retrieve(id, { signal }))),\n /**\n * Continue polling until the job has reached a settled state\n */\n takeWhile((jobResult) => jobResult.isOk() && !jobResult.value.settled, true),\n /**\n * Reuse the same polling for multiple subscribers, buffering only the latest result.\n * Make sure to unsubscribe from the source to stop polling when there are no subscribers (refCount: true)\n */\n shareReplay({\n bufferSize: 1,\n refCount: true,\n }),\n );\n const create = (query: Query) => {\n return config\n .sonarV3Request(`sql`, {\n body: JSON.stringify({\n context: query.context,\n sql: query.sql,\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .then((res) => res.json() as Promise<{ id: string }>)\n .then((response) => Ok(response.id))\n .catch((e: unknown) => Err(e));\n };\n const retrieve = (id: string, { signal }: SignalParam = {}): Promise<JobResult> =>\n config\n .sonarV3Request(`job/${id}`, { signal })\n .then((res) => res.json())\n .then((properties) => Ok(new Job(jobEntityToProperties(id, properties), config, observe)))\n .catch((e: unknown) => Err(e));\n return {\n create,\n /**\n * A convenience method to combine job creation and retrieval\n */\n createAndRetrieve: (query: Query) =>\n new AsyncResult(create(query)).andThen((jobId) => retrieve(jobId)).promise,\n observe,\n retrieve,\n };\n};\n"]}
@@ -14,6 +14,7 @@ export declare const Resources: (config: ResourceConfig & SonarV2Config & SonarV
14
14
  };
15
15
  jobs: {
16
16
  create: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Err<unknown> | import("ts-results-es").Ok<string>>;
17
+ createAndRetrieve: (query: import("./index.ts").Query) => Promise<import("ts-results-es").Result<import("./interfaces.ts").Job, unknown>>;
17
18
  observe: (id: string) => import("rxjs").Observable<import("./jobs/Job.ts").JobResult>;
18
19
  retrieve: (id: string, { signal }?: import("../common/Params.ts").SignalParam) => Promise<import("./jobs/Job.ts").JobResult>;
19
20
  };
@@ -1,6 +1,7 @@
1
1
  import { Err, Ok } from "ts-results-es";
2
2
  import { Query } from "../../common/Query.ts";
3
3
  import type { SonarV3Config } from "../../common/Config.ts";
4
+ import { Temporal } from "temporal-polyfill";
4
5
  export declare class Script {
5
6
  #private;
6
7
  readonly createdAt: ScriptProperties["createdAt"];
@@ -17,6 +17,7 @@ import { Err, Ok } from "ts-results-es";
17
17
  import { Query } from "../../common/Query.js";
18
18
  import { HttpError } from "../../common/HttpError.js";
19
19
  import { duplicateScriptNameError } from "./ScriptErrors.js";
20
+ import { Temporal } from "temporal-polyfill";
20
21
  export class Script {
21
22
  createdAt;
22
23
  createdBy;
@@ -1 +1 @@
1
- {"version":3,"file":"Script.js","sourceRoot":"","sources":["../../../src/oss/scripts/Script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,OAAO,MAAM;IACR,SAAS,CAAgC;IACzC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SAAS,EAAE,IAAI;QACf,MAAM,EAAE,OAAO;KAChB,CAAC;SACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,MAAoB,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;SAC1C,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;QACpB,IAAI,CAAC,YAAY,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,mCAAmC,CAAC,EAAE,CAAC;gBACjE,OAAO,GAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACrD,CAAC;YACD,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QAED,MAAM,CAAC,CAAC;IACV,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 { Err, Ok } from \"ts-results-es\";\nimport { Query } from \"../../common/Query.ts\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { HttpError } from \"../../common/HttpError.ts\";\nimport { duplicateScriptNameError } from \"./ScriptErrors.ts\";\n\nexport class Script {\n readonly createdAt: ScriptProperties[\"createdAt\"];\n readonly createdBy: ScriptProperties[\"createdBy\"];\n readonly id: ScriptProperties[\"id\"];\n readonly modifiedAt: ScriptProperties[\"modifiedAt\"];\n readonly modifiedBy: ScriptProperties[\"modifiedBy\"];\n readonly name: ScriptProperties[\"name\"];\n readonly query: ScriptProperties[\"query\"];\n #config: SonarV3Config;\n\n constructor(properties: ScriptProperties, config: SonarV3Config) {\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.id = properties.id;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.query = properties.query;\n this.#config = config;\n }\n\n async delete() {\n return this.#config\n .sonarV3Request(`scripts/${this.id}`, {\n keepalive: true,\n method: \"DELETE\",\n })\n .then(() => Ok(undefined))\n .catch((e: unknown) => Err(e));\n }\n\n async save(properties: ScriptPatchableProperties) {\n return saveScript(\n this.id,\n this.#config,\n )(properties).then((result) =>\n result.map((value) => new Script(scriptEntityToProperties(value), this.#config)),\n );\n }\n}\n\nexport const scriptEntityToProperties = (entity: ScriptEntity) => ({\n createdAt: Temporal.Instant.from(entity.createdAt),\n createdBy: entity.createdBy,\n id: entity.id,\n modifiedAt: Temporal.Instant.from(entity.modifiedAt),\n modifiedBy: entity.modifiedBy,\n name: entity.name,\n query: new Query(entity.content, entity.context),\n});\n\nexport type ScriptEntity = {\n content: string;\n context: string[];\n createdAt: string;\n createdBy: string;\n id: string;\n modifiedAt: string;\n modifiedBy: string;\n name: string;\n};\n\nexport type ScriptPatchableProperties = {\n name?: ScriptProperties[\"name\"];\n query?: ScriptProperties[\"query\"];\n};\n\nexport type ScriptProperties = ReturnType<typeof scriptEntityToProperties>;\n\nexport const createScriptPatchedFields = (properties: ScriptPatchableProperties) => {\n const patchedFields = {} as {\n name?: string;\n content?: string;\n context?: string[];\n };\n if (properties.name) {\n patchedFields.name = properties.name;\n }\n if (properties.query) {\n patchedFields.content = properties.query.sql;\n patchedFields.context = properties.query.context;\n }\n return patchedFields;\n};\n\nexport const saveScript = (id: string, config: SonarV3Config) => (body: Record<string, any>) => {\n return config\n .sonarV3Request(`scripts/${id}`, {\n body: JSON.stringify(body),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PATCH\",\n })\n .then((res) => res.json())\n .then((entity: ScriptEntity) => Ok(entity))\n .catch((e: unknown) => {\n if (e instanceof HttpError) {\n if (e.body.detail?.includes(\"Cannot reuse the same script name\")) {\n return Err(duplicateScriptNameError(body[\"name\"]));\n }\n return Err(e.body);\n }\n\n throw e;\n });\n};\n"]}
1
+ {"version":3,"file":"Script.js","sourceRoot":"","sources":["../../../src/oss/scripts/Script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,MAAM;IACR,SAAS,CAAgC;IACzC,SAAS,CAAgC;IACzC,EAAE,CAAyB;IAC3B,UAAU,CAAiC;IAC3C,UAAU,CAAiC;IAC3C,IAAI,CAA2B;IAC/B,KAAK,CAA4B;IAC1C,OAAO,CAAgB;IAEvB,YAAY,UAA4B,EAAE,MAAqB;QAC7D,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CA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P,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 { Query } from \"../../common/Query.ts\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { HttpError } from \"../../common/HttpError.ts\";\nimport { duplicateScriptNameError } from \"./ScriptErrors.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\nexport class Script {\n readonly createdAt: ScriptProperties[\"createdAt\"];\n readonly createdBy: ScriptProperties[\"createdBy\"];\n readonly id: ScriptProperties[\"id\"];\n readonly modifiedAt: ScriptProperties[\"modifiedAt\"];\n readonly modifiedBy: ScriptProperties[\"modifiedBy\"];\n readonly name: ScriptProperties[\"name\"];\n readonly query: ScriptProperties[\"query\"];\n #config: SonarV3Config;\n\n constructor(properties: ScriptProperties, config: SonarV3Config) {\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.id = properties.id;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.query = properties.query;\n this.#config = config;\n }\n\n async delete() {\n return this.#config\n .sonarV3Request(`scripts/${this.id}`, {\n keepalive: true,\n method: \"DELETE\",\n })\n .then(() => Ok(undefined))\n .catch((e: unknown) => Err(e));\n }\n\n async save(properties: ScriptPatchableProperties) {\n return saveScript(\n this.id,\n this.#config,\n )(properties).then((result) =>\n result.map((value) => new Script(scriptEntityToProperties(value), this.#config)),\n );\n }\n}\n\nexport const scriptEntityToProperties = (entity: ScriptEntity) => ({\n createdAt: Temporal.Instant.from(entity.createdAt),\n createdBy: entity.createdBy,\n id: entity.id,\n modifiedAt: Temporal.Instant.from(entity.modifiedAt),\n modifiedBy: entity.modifiedBy,\n name: entity.name,\n query: new Query(entity.content, entity.context),\n});\n\nexport type ScriptEntity = {\n content: string;\n context: string[];\n createdAt: string;\n createdBy: string;\n id: string;\n modifiedAt: string;\n modifiedBy: string;\n name: string;\n};\n\nexport type ScriptPatchableProperties = {\n name?: ScriptProperties[\"name\"];\n query?: ScriptProperties[\"query\"];\n};\n\nexport type ScriptProperties = ReturnType<typeof scriptEntityToProperties>;\n\nexport const createScriptPatchedFields = (properties: ScriptPatchableProperties) => {\n const patchedFields = {} as {\n name?: string;\n content?: string;\n context?: string[];\n };\n if (properties.name) {\n patchedFields.name = properties.name;\n }\n if (properties.query) {\n patchedFields.content = properties.query.sql;\n patchedFields.context = properties.query.context;\n }\n return patchedFields;\n};\n\nexport const saveScript = (id: string, config: SonarV3Config) => (body: Record<string, any>) => {\n return config\n .sonarV3Request(`scripts/${id}`, {\n body: JSON.stringify(body),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PATCH\",\n })\n .then((res) => res.json())\n .then((entity: ScriptEntity) => Ok(entity))\n .catch((e: unknown) => {\n if (e instanceof HttpError) {\n if (e.body.detail?.includes(\"Cannot reuse the same script name\")) {\n return Err(duplicateScriptNameError(body[\"name\"]));\n }\n return Err(e.body);\n }\n\n throw e;\n });\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",