@dremio/js-sdk 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/cloud/engines/Engine.d.ts +1 -0
  2. package/dist/cloud/engines/Engine.js +1 -0
  3. package/dist/cloud/engines/Engine.js.map +1 -1
  4. package/dist/cloud/engines/utils.js +1 -0
  5. package/dist/cloud/engines/utils.js.map +1 -1
  6. package/dist/cloud/index.d.ts +0 -1
  7. package/dist/cloud/index.js +0 -1
  8. package/dist/cloud/index.js.map +1 -1
  9. package/dist/cloud/interfaces.d.ts +2 -1
  10. package/dist/cloud/interfaces.js.map +1 -1
  11. package/dist/enterprise/catalog/CatalogObjects/EnterpriseSourceCatalogObject.d.ts +6 -6
  12. package/dist/enterprise/engines/Engine.d.ts +1 -0
  13. package/dist/enterprise/engines/Engine.js +1 -0
  14. package/dist/enterprise/engines/Engine.js.map +1 -1
  15. package/dist/enterprise/index.d.ts +0 -1
  16. package/dist/enterprise/index.js +0 -1
  17. package/dist/enterprise/index.js.map +1 -1
  18. package/dist/enterprise/interfaces.d.ts +2 -1
  19. package/dist/enterprise/interfaces.js.map +1 -1
  20. package/dist/enterprise/reflections/ReflectionSummary.d.ts +1 -0
  21. package/dist/enterprise/reflections/ReflectionSummary.js +1 -0
  22. package/dist/enterprise/reflections/ReflectionSummary.js.map +1 -1
  23. package/dist/enterprise/scripts/EnterpriseScript.d.ts +2 -2
  24. package/dist/oss/catalog/CatalogObjects/SourceCatalogObject.d.ts +1 -0
  25. package/dist/oss/catalog/CatalogObjects/SourceCatalogObject.js +1 -0
  26. package/dist/oss/catalog/CatalogObjects/SourceCatalogObject.js.map +1 -1
  27. package/dist/oss/index.d.ts +0 -1
  28. package/dist/oss/index.js +0 -1
  29. package/dist/oss/index.js.map +1 -1
  30. package/dist/oss/interfaces.d.ts +2 -1
  31. package/dist/oss/interfaces.js.map +1 -1
  32. package/dist/oss/jobs/Job.d.ts +11 -2
  33. package/dist/oss/jobs/Job.js +22 -5
  34. package/dist/oss/jobs/Job.js.map +1 -1
  35. package/dist/oss/jobs/utils/JobResultsResponse.d.ts +1 -1
  36. package/dist/oss/jobs/utils/JobResultsResponse.js.map +1 -1
  37. package/dist/oss/scripts/Script.d.ts +1 -0
  38. package/dist/oss/scripts/Script.js +1 -0
  39. package/dist/oss/scripts/Script.js.map +1 -1
  40. package/package.json +1 -1
@@ -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;IAEvB,YAAY,UAA4B,EAAE,MAAqB;QAC7D,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,yBAAyB,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACtE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,UAAwC;QAC7C,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE;YACpC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,GAAG,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC;gBAC/C,GAAG,wBAAwB,CAAC,UAAU,CAAC;aACxC,CAAC;YACF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,EAAE,KAAK;SACd,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;aACzB,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;aACxF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Err, Ok, type Result } from \"ts-results-es\";\nimport type { SonarV3Config } from \"../../common/Config.ts\";\nimport { engineEntityToProperties, enginePropertiesToEntity } from \"./utils.ts\";\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;IAClD,IAAI,CAA0B;IAC9B,KAAK,CAA2B;IAChC,eAAe,CAAqC;IACpD,SAAS,CAA+B;IAEjD,OAAO,CAAgB;IAEvB,YAAY,UAA4B,EAAE,MA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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 { 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;;;;;;;;;;;;;;GAcG;AAEH,OAAO,iBAAiB,MAAM,UAAU,CAAC;AAGzC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAAe,EAAoB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,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,QAAQ,CAAC,IAAI,CACnC,iBAAiB,CAAC,UAAU,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAC1D;YACD,SAAS,EAAE,UAAU,CAAC,SAAS;YA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,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) => {
@@ -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"]}
@@ -7,7 +7,8 @@ import type { EnterpriseScript } from "../enterprise/scripts/EnterpriseScript.ts
7
7
  import type { ReflectionSummary } from "../enterprise/reflections/ReflectionSummary.ts";
8
8
  import type { Role } from "../enterprise/roles/Role.ts";
9
9
  import type { BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference } from "../oss/catalog/VersionReference.ts";
10
+ import type { JobResultsSchema } from "../oss/jobs/utils/JobResultsResponse.ts";
10
11
  export type { ArcticCatalog, CloudUser, Engine, Project };
11
- export type { Job, Reflection, EnterpriseScript, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
12
+ export type { Job, JobResultsSchema, Reflection, EnterpriseScript, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
12
13
  export * from "../enterprise/catalog/CatalogObjects/index.ts";
13
14
  export * from "../enterprise/catalog/CatalogReferences/index.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA8BH,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,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 { ArcticCatalog } from \"./arctic/ArcticCatalog.ts\";\nimport type { CloudUser } from \"./users/CloudUser.ts\";\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Project } from \"./projects/Project.ts\";\n\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseScript } from \"../enterprise/scripts/EnterpriseScript.ts\";\nimport type { ReflectionSummary } from \"../enterprise/reflections/ReflectionSummary.ts\";\nimport type { Role } from \"../enterprise/roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\n\nexport type { ArcticCatalog, CloudUser, Engine, Project };\nexport type {\n Job,\n Reflection,\n EnterpriseScript,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport * from \"../enterprise/catalog/CatalogObjects/index.ts\";\nexport * from \"../enterprise/catalog/CatalogReferences/index.ts\";\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgCH,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,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 { ArcticCatalog } from \"./arctic/ArcticCatalog.ts\";\nimport type { CloudUser } from \"./users/CloudUser.ts\";\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Project } from \"./projects/Project.ts\";\n\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseScript } from \"../enterprise/scripts/EnterpriseScript.ts\";\nimport type { ReflectionSummary } from \"../enterprise/reflections/ReflectionSummary.ts\";\nimport type { Role } from \"../enterprise/roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\nimport type { JobResultsSchema } from \"../oss/jobs/utils/JobResultsResponse.ts\";\n\nexport type { ArcticCatalog, CloudUser, Engine, Project };\nexport type {\n Job,\n JobResultsSchema,\n Reflection,\n EnterpriseScript,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport * from \"../enterprise/catalog/CatalogObjects/index.ts\";\nexport * from \"../enterprise/catalog/CatalogReferences/index.ts\";\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,2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;IAC9E,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO;aAChB,cAAc,CAAC,WAAW,IAAI,CAAC,EAAE,QAAQ,EAAE;YAC1C,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;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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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\";\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) => {
@@ -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":[],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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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enterprise/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,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 { 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"]}
@@ -7,8 +7,9 @@ import type { EnterpriseUser } from "./users/EnterpriseUser.ts";
7
7
  import type { ReflectionSummary } from "./reflections/ReflectionSummary.ts";
8
8
  import type { Role } from "./roles/Role.ts";
9
9
  import type { BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference } from "../oss/catalog/VersionReference.ts";
10
+ import type { JobResultsSchema } from "../oss/jobs/utils/JobResultsResponse.ts";
10
11
  export * from "./catalog/CatalogObjects/index.ts";
11
12
  export * from "./catalog/CatalogReferences/index.ts";
12
13
  export * from "./Ownable.ts";
13
14
  export * from "./Grantee.ts";
14
- export type { Engine, EnterpriseCatalogObject, EnterpriseCatalogReference, EnterpriseScript, EnterpriseUser, Job, Reflection, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
15
+ export type { Engine, EnterpriseCatalogObject, EnterpriseCatalogReference, EnterpriseScript, EnterpriseUser, Job, JobResultsSchema, Reflection, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/enterprise/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseCatalogObject } from \"./catalog/CatalogObjects/index.ts\";\nimport type { EnterpriseCatalogReference } from \"./catalog/CatalogReferences/index.ts\";\nimport type { EnterpriseScript } from \"./scripts/EnterpriseScript.ts\";\nimport type { EnterpriseUser } from \"./users/EnterpriseUser.ts\";\nimport type { ReflectionSummary } from \"./reflections/ReflectionSummary.ts\";\nimport type { Role } from \"./roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\n\nexport * from \"./catalog/CatalogObjects/index.ts\";\nexport * from \"./catalog/CatalogReferences/index.ts\";\nexport * from \"./Ownable.ts\";\nexport * from \"./Grantee.ts\";\nexport type {\n Engine,\n EnterpriseCatalogObject,\n EnterpriseCatalogReference,\n EnterpriseScript,\n EnterpriseUser,\n Job,\n Reflection,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/enterprise/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseCatalogObject } from \"./catalog/CatalogObjects/index.ts\";\nimport type { EnterpriseCatalogReference } from \"./catalog/CatalogReferences/index.ts\";\nimport type { EnterpriseScript } from \"./scripts/EnterpriseScript.ts\";\nimport type { EnterpriseUser } from \"./users/EnterpriseUser.ts\";\nimport type { ReflectionSummary } from \"./reflections/ReflectionSummary.ts\";\nimport type { Role } from \"./roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\nimport type { JobResultsSchema } from \"../oss/jobs/utils/JobResultsResponse.ts\";\nexport * from \"./catalog/CatalogObjects/index.ts\";\nexport * from \"./catalog/CatalogReferences/index.ts\";\nexport * from \"./Ownable.ts\";\nexport * from \"./Grantee.ts\";\nexport type {\n Engine,\n EnterpriseCatalogObject,\n EnterpriseCatalogReference,\n EnterpriseScript,\n EnterpriseUser,\n Job,\n JobResultsSchema,\n Reflection,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\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,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AC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI;QAC/F,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,IAAI,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\";\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,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QACpD,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc;QAC5C,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY;QACxC,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QAC5C,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI;QAC/F,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,IAAI,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"]}
@@ -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,GAA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C,IAAI;IACjB,iBAAiB,EAAE,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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) 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\";\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"]}
@@ -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";
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"]}
@@ -3,6 +3,7 @@ import type { Reflection } from "./reflections/Reflection.ts";
3
3
  import type { Script } from "./scripts/Script.ts";
4
4
  import type { User } from "./users/User.ts";
5
5
  import type { BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference } from "./catalog/VersionReference.ts";
6
+ import type { JobResultsSchema } from "./jobs/utils/JobResultsResponse.ts";
6
7
  export * from "./catalog/CatalogObjects/index.ts";
7
8
  export * from "./catalog/CatalogReferences/index.ts";
8
- export type { Job, Reflection, Script, User, VersionReference, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, };
9
+ export type { Job, JobResultsSchema, Reflection, Script, User, VersionReference, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, };
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/oss/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAaH,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,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 { Job } from \"./jobs/Job.ts\";\nimport type { Reflection } from \"./reflections/Reflection.ts\";\nimport type { Script } from \"./scripts/Script.ts\";\nimport type { User } from \"./users/User.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"./catalog/VersionReference.ts\";\n\nexport * from \"./catalog/CatalogObjects/index.ts\";\nexport * from \"./catalog/CatalogReferences/index.ts\";\nexport type {\n Job,\n Reflection,\n Script,\n User,\n VersionReference,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/oss/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,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 { Job } from \"./jobs/Job.ts\";\nimport type { Reflection } from \"./reflections/Reflection.ts\";\nimport type { Script } from \"./scripts/Script.ts\";\nimport type { User } from \"./users/User.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"./catalog/VersionReference.ts\";\nimport type { JobResultsSchema } from \"./jobs/utils/JobResultsResponse.ts\";\n\nexport * from \"./catalog/CatalogObjects/index.ts\";\nexport * from \"./catalog/CatalogReferences/index.ts\";\nexport type {\n Job,\n JobResultsSchema,\n Reflection,\n Script,\n User,\n VersionReference,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n};\n"]}
@@ -2,6 +2,7 @@ import type { SonarV3Config } from "../../common/Config.ts";
2
2
  import type { Problem } from "../../common/Problem.ts";
3
3
  import { Err, Ok, Result } from "ts-results-es";
4
4
  import { type Observable } from "rxjs";
5
+ import type { SignalParam } from "../../common/Params.ts";
5
6
  export declare class Job {
6
7
  #private;
7
8
  readonly acceleration: JobProperties["acceleration"];
@@ -22,7 +23,7 @@ export declare class Job {
22
23
  jsonBatches: <T extends Record<string, unknown> = Record<string, unknown>>(args?: {
23
24
  limit?: number;
24
25
  offset?: number;
25
- }) => AsyncGenerator<{
26
+ }, { signal }?: SignalParam) => AsyncGenerator<{
26
27
  readonly columns: Record<Extract<keyof T, string>, unknown[] | Float64Array<ArrayBuffer> | Float32Array<ArrayBuffer> | Int32Array<ArrayBuffer>>;
27
28
  readonly rows: T[];
28
29
  readonly schema: {
@@ -30,8 +31,16 @@ export declare class Job {
30
31
  };
31
32
  readonly totalRows: number;
32
33
  }, void, unknown>;
33
- slice: <T extends Record<string, unknown> = Record<string, unknown>>(start?: number, end?: number) => Promise<Err<unknown> | Ok<T[]>>;
34
+ metadata: ({ signal }?: SignalParam) => Promise<Err<unknown> | Ok<{
35
+ schema: import("./utils/JobResultsResponse.ts").JobResultsSchema<string>;
36
+ totalRows: number;
37
+ }>>;
38
+ slice: <T extends Record<string, unknown> = Record<string, unknown>>(start?: number, end?: number, { signal }?: SignalParam) => Promise<Err<unknown> | Ok<T[]>>;
34
39
  };
40
+ /**
41
+ * @returns A `Job` instance once it's reached a settled state
42
+ */
43
+ retrieveSettled(): Promise<Job>;
35
44
  cancel(): Promise<Err<any> | Ok<undefined>>;
36
45
  }
37
46
  export declare const jobEntityToProperties: (id: string, entity: {
@@ -67,10 +67,17 @@ export class Job {
67
67
  get results() {
68
68
  return {
69
69
  jsonBatches: this.#jsonBatches.bind(this),
70
+ metadata: this.#metadata.bind(this),
70
71
  slice: this.#slice.bind(this),
71
72
  };
72
73
  }
73
- async *#jsonBatches(args = {}) {
74
+ /**
75
+ * @returns A `Job` instance once it's reached a settled state
76
+ */
77
+ retrieveSettled() {
78
+ return lastValueFrom(this.observer);
79
+ }
80
+ async *#jsonBatches(args = {}, { signal } = {}) {
74
81
  if (typeof args.limit === "number" && args.limit < 0) {
75
82
  throw new Error("Limit cannot be negative");
76
83
  }
@@ -79,7 +86,7 @@ export class Job {
79
86
  }
80
87
  // Wait for job to enter a settled state before attempting to fetch batches
81
88
  if (!this.settled) {
82
- await lastValueFrom(this.observer);
89
+ await this.retrieveSettled();
83
90
  }
84
91
  const limitArg = args.limit ?? Infinity;
85
92
  const offsetArg = args.offset || 0;
@@ -93,7 +100,7 @@ export class Job {
93
100
  // Make batch_size dynamic to allow for requesting a smaller final page
94
101
  const batch_size = Math.min(MAX_BATCH_SIZE, stopAfterOffset - offset);
95
102
  const batch = await this.#config
96
- .sonarV3Request(`job/${this.id}/results?offset=${offset}&limit=${batch_size}`)
103
+ .sonarV3Request(`job/${this.id}/results?offset=${offset}&limit=${batch_size}`, { signal })
97
104
  .then((res) => res.json());
98
105
  offset += batch.rows.length;
99
106
  hasMore = batch.rows.length === batch_size;
@@ -111,10 +118,20 @@ export class Job {
111
118
  }
112
119
  }
113
120
  }
114
- async #slice(start = 0, end = Infinity) {
121
+ async #metadata({ signal } = {}) {
122
+ return this.#config
123
+ .sonarV3Request(`job/${this.id}/results?offset=0&limit=0`, { signal })
124
+ .then((res) => res.json())
125
+ .then((response) => Ok({
126
+ schema: response.schema,
127
+ totalRows: response.rowCount,
128
+ }))
129
+ .catch((e) => Err(e));
130
+ }
131
+ async #slice(start = 0, end = Infinity, { signal } = {}) {
115
132
  try {
116
133
  const rows = [];
117
- for await (const batch of this.#jsonBatches({ limit: end - start, offset: start })) {
134
+ for await (const batch of this.#jsonBatches({ limit: end - start, offset: start }, { signal })) {
118
135
  rows.push(...batch.rows);
119
136
  }
120
137
  return Ok(rows);
@@ -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,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;IACxB,OAAO,CAA2B;IAClC,SAAS,CAA6B;IACtC,yBAAyB,CAA6C;IACtE,2BAA2B,CAA+C;IAC1E,QAAQ,CAA4B;IACpC,SAAS,CAA6B;IACtC,KAAK,CAAyB;IAEvB,QAAQ,CAAkB;IAC1C,OAAO,CAAgB;IAEvB,YACE,UAAyB,EACzB,MAAqB,EACrB,OAA8C;QAE9C,IAAI,CA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;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
+ {"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;AAGnD,MAAM,OAAO,GAAG;IACL,YAAY,CAAgC;IAC5C,kBAAkB,CAAsC;IACxD,OAAO,CAA2B;IAClC,EAAE,CAAsB;IACxB,OAAO,CAA2B;IAClC,SAAS,CAA6B;IACtC,yBAAyB,CAA6C;IACtE,2BAA2B,CAA+C;IAC1E,QAAQ,CAA4B;IACpC,SAAS,CAA6B;IACtC,KAAK,CAAyB;IAEvB,QAAQ,CAAkB;IAC1C,OAAO,CAAgB;IAEvB,YACE,UAAyB,EACzB,MAAqB,EACrB,OAA8C;QAE9C,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,kBAAkB,GAAG,UAAU,CAAC,kBAAkB,CAAC;QACxD,IAAI,CAAC,OAAO,GAA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C,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;IACzD,EAAE;IACF,OAAO,EAAE,IAAsB;IAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,yBAAyB,EAAE,MAAM,CAAC,yBAAyB;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\";\nimport type { SignalParam } from \"../../common/Params.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 metadata: this.#metadata.bind(this),\n slice: this.#slice.bind(this),\n };\n }\n\n /**\n * @returns A `Job` instance once it's reached a settled state\n */\n retrieveSettled() {\n return lastValueFrom(this.observer);\n }\n\n async *#jsonBatches<T extends Record<string, unknown> = Record<string, unknown>>(\n args: { limit?: number; offset?: number } = {},\n { signal }: SignalParam = {},\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 this.retrieveSettled();\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}`, { signal })\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 #metadata({ signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`job/${this.id}/results?offset=0&limit=0`, { signal })\n .then((res) => res.json() as Promise<JobResultsResponse>)\n .then((response) =>\n Ok({\n schema: response.schema,\n totalRows: response.rowCount,\n }),\n )\n .catch((e: unknown) => Err(e));\n }\n\n async #slice<T extends Record<string, unknown> = Record<string, unknown>>(\n start: number = 0,\n end: number = Infinity,\n { signal }: SignalParam = {},\n ) {\n try {\n const rows: T[] = [];\n for await (const batch of this.#jsonBatches<T>(\n { limit: end - start, offset: start },\n { signal },\n )) {\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"]}
@@ -73,7 +73,7 @@ type StructType = {
73
73
  }[];
74
74
  };
75
75
  type ComplexTypes = ListType | StructType;
76
- export type JobResultsSchema<TName extends string> = {
76
+ export type JobResultsSchema<TName extends string = string> = {
77
77
  name: TName;
78
78
  type: SimpleTypes | ComplexTypes;
79
79
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"JobResultsResponse.js","sourceRoot":"","sources":["../../../../src/oss/jobs/utils/JobResultsResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype VarcharType = {\n name: \"VARCHAR\";\n};\n\ntype TextType = {\n name: \"TEXT\";\n};\n\ntype BinaryType = {\n name: \"BINARY\";\n};\n\ntype VarbinaryType = {\n name: \"VARBINARY\";\n};\n\ntype FloatType = {\n name: \"FLOAT\";\n};\n\ntype DecimalType = {\n name: \"DECIMAL\";\n};\n\ntype IntegerType = {\n name: \"INTEGER\";\n};\n\ntype MixedType = {\n name: \"MIXED\";\n};\n\ntype UnionType = {\n name: \"UNION\";\n};\n\ntype DateType = {\n name: \"DATE\";\n};\n\ntype TimeType = {\n name: \"TIME\";\n};\n\ntype DatetimeType = {\n name: \"DATETIME\";\n};\n\ntype MapType = {\n name: \"MAP\";\n};\n\ntype GeoType = {\n name: \"GEO\";\n};\n\ntype OtherType = {\n name: \"OTHER\";\n};\n\ntype AnyType = {\n name: \"ANY\";\n};\n\ntype DoubleType = {\n name: \"DOUBLE\";\n};\n\ntype BigintType = {\n name: \"BIGINT\";\n};\n\ntype BooleanType = {\n name: \"BOOLEAN\";\n};\n\ntype TimestampType = {\n name: \"TIMESTAMP\";\n};\n\ntype SimpleTypes =\n | VarcharType\n | DoubleType\n | BigintType\n | BooleanType\n | TimestampType\n | TextType\n | BinaryType\n | VarbinaryType\n | FloatType\n | DecimalType\n | IntegerType\n | MixedType\n | UnionType\n | DateType\n | TimeType\n | DatetimeType\n | MapType\n | GeoType\n | OtherType\n | AnyType;\n\ntype ListType = {\n name: \"LIST\";\n subSchema: {\n type: SimpleTypes | ComplexTypes;\n }[];\n};\n\ntype StructType = {\n name: \"STRUCT\";\n subSchema: {\n name: string;\n type: SimpleTypes | ComplexTypes;\n }[];\n};\n\ntype ComplexTypes = ListType | StructType;\n\nexport type JobResultsSchema<TName extends string> = {\n name: TName;\n type: SimpleTypes | ComplexTypes;\n}[];\n\nexport type JobResultsResponse<T extends Record<string, unknown> = Record<string, unknown>> = {\n rowCount: number;\n rows: T[];\n schema: JobResultsSchema<Extract<keyof T, string>>;\n};\n"]}
1
+ {"version":3,"file":"JobResultsResponse.js","sourceRoot":"","sources":["../../../../src/oss/jobs/utils/JobResultsResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype VarcharType = {\n name: \"VARCHAR\";\n};\n\ntype TextType = {\n name: \"TEXT\";\n};\n\ntype BinaryType = {\n name: \"BINARY\";\n};\n\ntype VarbinaryType = {\n name: \"VARBINARY\";\n};\n\ntype FloatType = {\n name: \"FLOAT\";\n};\n\ntype DecimalType = {\n name: \"DECIMAL\";\n};\n\ntype IntegerType = {\n name: \"INTEGER\";\n};\n\ntype MixedType = {\n name: \"MIXED\";\n};\n\ntype UnionType = {\n name: \"UNION\";\n};\n\ntype DateType = {\n name: \"DATE\";\n};\n\ntype TimeType = {\n name: \"TIME\";\n};\n\ntype DatetimeType = {\n name: \"DATETIME\";\n};\n\ntype MapType = {\n name: \"MAP\";\n};\n\ntype GeoType = {\n name: \"GEO\";\n};\n\ntype OtherType = {\n name: \"OTHER\";\n};\n\ntype AnyType = {\n name: \"ANY\";\n};\n\ntype DoubleType = {\n name: \"DOUBLE\";\n};\n\ntype BigintType = {\n name: \"BIGINT\";\n};\n\ntype BooleanType = {\n name: \"BOOLEAN\";\n};\n\ntype TimestampType = {\n name: \"TIMESTAMP\";\n};\n\ntype SimpleTypes =\n | VarcharType\n | DoubleType\n | BigintType\n | BooleanType\n | TimestampType\n | TextType\n | BinaryType\n | VarbinaryType\n | FloatType\n | DecimalType\n | IntegerType\n | MixedType\n | UnionType\n | DateType\n | TimeType\n | DatetimeType\n | MapType\n | GeoType\n | OtherType\n | AnyType;\n\ntype ListType = {\n name: \"LIST\";\n subSchema: {\n type: SimpleTypes | ComplexTypes;\n }[];\n};\n\ntype StructType = {\n name: \"STRUCT\";\n subSchema: {\n name: string;\n type: SimpleTypes | ComplexTypes;\n }[];\n};\n\ntype ComplexTypes = ListType | StructType;\n\nexport type JobResultsSchema<TName extends string = string> = {\n name: TName;\n type: SimpleTypes | ComplexTypes;\n}[];\n\nexport type JobResultsResponse<T extends Record<string, unknown> = Record<string, unknown>> = {\n rowCount: number;\n rows: T[];\n schema: JobResultsSchema<Extract<keyof T, string>>;\n};\n"]}
@@ -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,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,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AAG,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;AAC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SACV,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE;QAC/B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,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\";\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.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",