@dremio/js-sdk 0.31.8 → 0.32.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 (113) hide show
  1. package/dist/cloud/Dremio.d.ts +3 -2
  2. package/dist/cloud/Dremio.js +2 -2
  3. package/dist/cloud/Dremio.js.map +1 -1
  4. package/dist/cloud/ai/AIResource.d.ts +125 -0
  5. package/dist/cloud/ai/AIResource.js +113 -0
  6. package/dist/cloud/ai/AIResource.js.map +1 -0
  7. package/dist/cloud/ai/DremioModelProvider.d.ts +12 -0
  8. package/dist/cloud/ai/DremioModelProvider.js +49 -0
  9. package/dist/cloud/ai/DremioModelProvider.js.map +1 -0
  10. package/dist/cloud/ai/index.d.ts +4 -0
  11. package/dist/cloud/ai/index.js +20 -0
  12. package/dist/cloud/ai/index.js.map +1 -0
  13. package/dist/cloud/ai/modelProviderCodec.d.ts +180 -0
  14. package/dist/cloud/ai/modelProviderCodec.js +54 -0
  15. package/dist/cloud/ai/modelProviderCodec.js.map +1 -0
  16. package/dist/cloud/catalog/EnterpriseCatalogResource.d.ts +10 -3
  17. package/dist/cloud/catalog/EnterpriseCatalogResource.js +38 -0
  18. package/dist/cloud/catalog/EnterpriseCatalogResource.js.map +1 -1
  19. package/dist/cloud/catalog/FileUpload.d.ts +117 -0
  20. package/dist/cloud/catalog/FileUpload.js +103 -0
  21. package/dist/cloud/catalog/FileUpload.js.map +1 -0
  22. package/dist/cloud/getResourceConfig.d.ts +1 -0
  23. package/dist/cloud/getResourceConfig.js +3 -0
  24. package/dist/cloud/getResourceConfig.js.map +1 -1
  25. package/dist/cloud/interfaces.d.ts +3 -1
  26. package/dist/cloud/interfaces.js +3 -1
  27. package/dist/cloud/interfaces.js.map +1 -1
  28. package/dist/cloud/organizations/Organization.d.ts +10 -0
  29. package/dist/cloud/organizations/Organization.js +12 -0
  30. package/dist/cloud/organizations/Organization.js.map +1 -1
  31. package/dist/cloud/projects/Project.d.ts +1 -0
  32. package/dist/cloud/projects/Project.js +2 -0
  33. package/dist/cloud/projects/Project.js.map +1 -1
  34. package/dist/cloud/projects/projectPropertiesCodec.d.ts +6 -0
  35. package/dist/cloud/projects/projectPropertiesCodec.js +1 -0
  36. package/dist/cloud/projects/projectPropertiesCodec.js.map +1 -1
  37. package/dist/cloud/replaceOriginResource.js +6 -1
  38. package/dist/cloud/replaceOriginResource.js.map +1 -1
  39. package/dist/common/Config.d.ts +14 -0
  40. package/dist/common/Config.js.map +1 -1
  41. package/dist/common/createRequest.d.ts +1 -0
  42. package/dist/common/createRequest.js +1 -1
  43. package/dist/common/createRequest.js.map +1 -1
  44. package/dist/common/createXHR.d.ts +2 -0
  45. package/dist/common/createXHR.js +58 -0
  46. package/dist/common/createXHR.js.map +1 -0
  47. package/dist/enterprise/Dremio.d.ts +3 -1
  48. package/dist/enterprise/Dremio.js +3 -0
  49. package/dist/enterprise/Dremio.js.map +1 -1
  50. package/dist/enterprise/ai/AIResource.d.ts +118 -0
  51. package/dist/enterprise/ai/AIResource.js +123 -0
  52. package/dist/enterprise/ai/AIResource.js.map +1 -0
  53. package/dist/enterprise/ai/ModelProvider.d.ts +181 -0
  54. package/dist/enterprise/ai/ModelProvider.js +87 -0
  55. package/dist/enterprise/ai/ModelProvider.js.map +1 -0
  56. package/dist/enterprise/ai/chat/AgentChatPartialResponse.d.ts +42 -0
  57. package/dist/enterprise/ai/chat/AgentChatPartialResponse.js +65 -0
  58. package/dist/enterprise/ai/chat/AgentChatPartialResponse.js.map +1 -0
  59. package/dist/enterprise/ai/chat/AgentChatResponse.d.ts +87 -0
  60. package/dist/enterprise/ai/chat/AgentChatResponse.js +138 -0
  61. package/dist/enterprise/ai/chat/AgentChatResponse.js.map +1 -0
  62. package/dist/enterprise/ai/chat/AgentErrorResponseContent.d.ts +4 -0
  63. package/dist/enterprise/ai/chat/AgentErrorResponseContent.js +22 -0
  64. package/dist/enterprise/ai/chat/AgentErrorResponseContent.js.map +1 -0
  65. package/dist/enterprise/ai/chat/AgentModelResponseContent.d.ts +6 -0
  66. package/dist/enterprise/ai/chat/AgentModelResponseContent.js +24 -0
  67. package/dist/enterprise/ai/chat/AgentModelResponseContent.js.map +1 -0
  68. package/dist/enterprise/ai/chat/AgentToolRequestResponseContent.d.ts +9 -0
  69. package/dist/enterprise/ai/chat/AgentToolRequestResponseContent.js +35 -0
  70. package/dist/enterprise/ai/chat/AgentToolRequestResponseContent.js.map +1 -0
  71. package/dist/enterprise/ai/chat/AgentToolResultResponseContent.d.ts +8 -0
  72. package/dist/enterprise/ai/chat/AgentToolResultResponseContent.js +31 -0
  73. package/dist/enterprise/ai/chat/AgentToolResultResponseContent.js.map +1 -0
  74. package/dist/enterprise/ai/chat/ChatSession.d.ts +32 -0
  75. package/dist/enterprise/ai/chat/ChatSession.js +77 -0
  76. package/dist/enterprise/ai/chat/ChatSession.js.map +1 -0
  77. package/dist/enterprise/ai/chat/UserChatMessage.d.ts +30 -0
  78. package/dist/enterprise/ai/chat/UserChatMessage.js +68 -0
  79. package/dist/enterprise/ai/chat/UserChatMessage.js.map +1 -0
  80. package/dist/enterprise/ai/chat/UserChatMessageContent.d.ts +19 -0
  81. package/dist/enterprise/ai/chat/UserChatMessageContent.js +44 -0
  82. package/dist/enterprise/ai/chat/UserChatMessageContent.js.map +1 -0
  83. package/dist/enterprise/ai/chat/chatEventSchema.d.ts +35 -0
  84. package/dist/enterprise/ai/chat/chatEventSchema.js +52 -0
  85. package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -0
  86. package/dist/enterprise/ai/chat/index.d.ts +9 -0
  87. package/dist/enterprise/ai/chat/index.js +25 -0
  88. package/dist/enterprise/ai/chat/index.js.map +1 -0
  89. package/dist/enterprise/ai/index.d.ts +3 -0
  90. package/dist/enterprise/ai/index.js +19 -0
  91. package/dist/enterprise/ai/index.js.map +1 -0
  92. package/dist/enterprise/ai/modelProviderCodec.d.ts +465 -0
  93. package/dist/enterprise/ai/modelProviderCodec.js +154 -0
  94. package/dist/enterprise/ai/modelProviderCodec.js.map +1 -0
  95. package/dist/enterprise/ai/modelProviderConfigSchemas.d.ts +296 -0
  96. package/dist/enterprise/ai/modelProviderConfigSchemas.js +159 -0
  97. package/dist/enterprise/ai/modelProviderConfigSchemas.js.map +1 -0
  98. package/dist/enterprise/interfaces.d.ts +1 -0
  99. package/dist/enterprise/interfaces.js +1 -0
  100. package/dist/enterprise/interfaces.js.map +1 -1
  101. package/dist/enterprise/users/EnterpriseUsersResource.d.ts +7 -0
  102. package/dist/enterprise/users/EnterpriseUsersResource.js +31 -0
  103. package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
  104. package/dist/enterprise/users/ServiceUser.d.ts +85 -0
  105. package/dist/enterprise/users/ServiceUser.js +79 -0
  106. package/dist/enterprise/users/ServiceUser.js.map +1 -0
  107. package/dist/enterprise/users/serviceUserOauthCredentialsCodec.d.ts +43 -0
  108. package/dist/enterprise/users/serviceUserOauthCredentialsCodec.js +110 -0
  109. package/dist/enterprise/users/serviceUserOauthCredentialsCodec.js.map +1 -0
  110. package/package.json +1 -1
  111. package/dist/cloud/ai/AiResource.d.ts +0 -12
  112. package/dist/cloud/ai/AiResource.js +0 -52
  113. package/dist/cloud/ai/AiResource.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Organization.js","sourceRoot":"","sources":["../../../src/cloud/organizations/Organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,yBAAyB,EAAE,CAAC,CAAC,QA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AAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;aAChF,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAC1F,CAAC;IACN,CAAC;IAED,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC,GAAG,CAAC,GAAG,CAAC;;AAGtD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAgB,EAAE,EAAE,CAC9C,SAAS,WAAW,CAAC,EAAE,MAAM,KAAkB,EAAE;IAC/C,OAAO,MAAM;SACV,SAAS,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;SAC/E,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;SAChF,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9F,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 * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\nimport { map, Observable, repeat, shareReplay, takeWhile, timer } from \"rxjs\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.optional(z.enum([\"AWS\", \"AZURE\"])),\n auditDestinationCredentials: z.optional(\n z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n ),\n auditDestinationPath: z.optional(z.string()),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n };\n },\n },\n);\n\nconst organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {\n defaultProjectId: true,\n name: true,\n});\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n readonly updates$: Observable<Organization>;\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n\n this.updates$ = fromAbortable(\n ({ signal }) => retrieveOrg(this.#config)({ signal }).promise,\n ).pipe(\n repeat({ delay: () => timer(3000) }),\n takeWhile((result) => result.isOk() && !result.value.settled, true),\n map((result) => result.unwrap()),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n update(fields: Partial<z.infer<typeof organizationUpdateSchema>>) {\n return this.#config\n .v2Request(\"organizations\", {\n body: JSON.stringify(\n z.parse(organizationUpdateSchema, {\n defaultProjectId: this.defaultProjectId,\n name: fields.name || this.name,\n }),\n ),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map(\n (entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)),\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n\nexport const retrieveOrg = (config: V2Config) =>\n function retrieveOrg({ signal }: SignalParam = {}) {\n return config\n .v2Request(\"organizations\", { headers: { Accept: \"application/json\" }, signal })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map((entity) => new Organization(config, z.decode(organizationPropertiesCodec, entity)));\n };\n"]}
1
+ {"version":3,"file":"Organization.js","sourceRoot":"","sources":["../../../src/cloud/organizations/Organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,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AAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9F,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 * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\nimport { map, Observable, repeat, shareReplay, takeWhile, timer } from \"rxjs\";\nimport { fromAbortable } from \"../../common/fromAbortable.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.optional(z.enum([\"AWS\", \"AZURE\"])),\n auditDestinationCredentials: z.optional(\n z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n ),\n auditDestinationPath: z.optional(z.string()),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n serverlessSupport: z.optional(z.enum([\"SUPPORTED\", \"NOT_SUPPORTED\"])),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n serverlessSupport: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n _serverlessSupported: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n _serverlessSupported: v.serverlessSupport === \"SUPPORTED\",\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n serverlessSupport: v._serverlessSupported\n ? (\"SUPPORTED\" as const)\n : (\"NOT_SUPPORTED\" as const),\n };\n },\n },\n);\n\nconst organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {\n defaultProjectId: true,\n name: true,\n});\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n readonly updates$: Observable<Organization>;\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n /**\n * @hidden\n */\n readonly _serverlessSupported: OrganizationProperties[\"_serverlessSupported\"];\n\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this._serverlessSupported = properties._serverlessSupported;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n\n this.updates$ = fromAbortable(\n ({ signal }) => retrieveOrg(this.#config)({ signal }).promise,\n ).pipe(\n repeat({ delay: () => timer(3000) }),\n takeWhile((result) => result.isOk() && !result.value.settled, true),\n map((result) => result.unwrap()),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n update(fields: Partial<z.infer<typeof organizationUpdateSchema>>) {\n return this.#config\n .v2Request(\"organizations\", {\n body: JSON.stringify(\n z.parse(organizationUpdateSchema, {\n defaultProjectId: this.defaultProjectId,\n name: fields.name || this.name,\n }),\n ),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map(\n (entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)),\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n\nexport const retrieveOrg = (config: V2Config) =>\n function retrieveOrg({ signal }: SignalParam = {}) {\n return config\n .v2Request(\"organizations\", { headers: { Accept: \"application/json\" }, signal })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map((entity) => new Organization(config, z.decode(organizationPropertiesCodec, entity)));\n };\n"]}
@@ -6,6 +6,7 @@ import type { V3Config } from "../../common/Config.ts";
6
6
  import type { HttpError } from "../../common/HttpError.ts";
7
7
  export declare class Project implements ProjectInterface {
8
8
  #private;
9
+ readonly catalog: ProjectInterface["catalog"];
9
10
  readonly cloudId: ProjectInterface["cloudId"];
10
11
  readonly cloudType: ProjectInterface["cloudType"];
11
12
  readonly createdAt: ProjectInterface["createdAt"];
@@ -18,6 +18,7 @@ import { projectUpdateSchema } from "./projectPropertiesCodec.js";
18
18
  import * as z from "zod/mini";
19
19
  export class Project {
20
20
  #config;
21
+ catalog;
21
22
  cloudId;
22
23
  cloudType;
23
24
  createdAt;
@@ -36,6 +37,7 @@ export class Project {
36
37
  #projectsResource;
37
38
  constructor(config, properties, projectsResource) {
38
39
  this.#config = config;
40
+ this.catalog = properties.catalog;
39
41
  this.cloudId = properties.cloudId;
40
42
  this.cloudType = properties.cloudType;
41
43
  this.createdAt = properties.createdAt;
@@ -1 +1 @@
1
- {"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,GAAG,EAAe,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAA+B,MAAM,6BAA6B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,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;IAC3F,CAAC;IAED,MAAM,CAAC,YAAY,GAAG,mBAAmB,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 { AsyncResult, Err, type Result } from \"ts-results-es\";\nimport type { ProjectsResource } from \"./ProjectsResource.ts\";\nimport { projectUpdateSchema, type projectPropertiesCodec } from \"./projectPropertiesCodec.ts\";\nimport * as z from \"zod/mini\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class Project implements ProjectInterface {\n readonly #config: V3Config;\n readonly cloudId: ProjectInterface[\"cloudId\"];\n readonly cloudType: ProjectInterface[\"cloudType\"];\n readonly createdAt: ProjectInterface[\"createdAt\"];\n readonly createdBy: ProjectInterface[\"createdBy\"];\n readonly credentials: ProjectInterface[\"credentials\"];\n readonly id: ProjectInterface[\"id\"];\n readonly lastStateError: ProjectInterface[\"lastStateError\"];\n readonly modifiedAt: ProjectInterface[\"modifiedAt\"];\n readonly modifiedBy: ProjectInterface[\"modifiedBy\"];\n readonly name: ProjectInterface[\"name\"];\n readonly numberOfEngines: ProjectInterface[\"numberOfEngines\"];\n readonly primaryCatalog: ProjectInterface[\"primaryCatalog\"];\n readonly projectStore: ProjectInterface[\"projectStore\"];\n readonly state: ProjectInterface[\"state\"];\n readonly type: ProjectInterface[\"type\"];\n\n #projectsResource: ProjectsResource;\n\n constructor(config: V3Config, properties: ProjectProperties, projectsResource: ProjectsResource) {\n this.#config = config;\n this.cloudId = properties.cloudId;\n this.cloudType = properties.cloudType;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.credentials = properties.credentials;\n this.id = properties.id;\n this.lastStateError = properties.lastStateError;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.numberOfEngines = properties.numberOfEngines;\n this.primaryCatalog = properties.primaryCatalog;\n this.projectStore = properties.projectStore;\n this.state = properties.state;\n this.type = properties.type;\n this.#projectsResource = projectsResource;\n }\n\n activate() {\n return this.#projectsResource.activate(this.id);\n }\n\n delete() {\n return this.#projectsResource.delete(this.id);\n }\n\n update(\n properties: z.output<typeof projectUpdateSchema>,\n ): AsyncResult<\n Project,\n HttpError | z.core.util.SafeParseResult<z.output<typeof projectUpdateSchema>>[\"error\"]\n > {\n const parsedProperties = z.safeEncode(projectUpdateSchema, properties);\n if (!parsedProperties.success) {\n return new AsyncResult(Promise.resolve(Err(parsedProperties.error)));\n }\n return this.#config\n .v3Request(`projects/${this.id}`, {\n body: JSON.stringify(parsedProperties.data),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof projectPropertiesCodec>>)\n .map((entity) => this.#projectsResource._createFromEntity(entity));\n }\n\n get settled() {\n return this.state === \"ACTIVE\" || this.state === \"ARCHIVED\" || this.state === \"INACTIVE\";\n }\n\n static updateSchema = projectUpdateSchema;\n}\n\nexport type ProjectProperties = z.output<typeof projectPropertiesCodec>;\n\nexport type ProjectMethods = {\n delete(): Promise<Result<undefined, unknown>>;\n get settled(): boolean;\n};\n\nexport type ProjectInterface = ProjectProperties & ProjectMethods;\n"]}
1
+ {"version":3,"file":"Project.js","sourceRoot":"","sources":["../../../src/cloud/projects/Project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,GAAG,EAAe,MAAM,eAAe,CAAC;AAE9D,OAAO,E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,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;IAC3F,CAAC;IAED,MAAM,CAAC,YAAY,GAAG,mBAAmB,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 { AsyncResult, Err, type Result } from \"ts-results-es\";\nimport type { ProjectsResource } from \"./ProjectsResource.ts\";\nimport { projectUpdateSchema, type projectPropertiesCodec } from \"./projectPropertiesCodec.ts\";\nimport * as z from \"zod/mini\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\n\nexport class Project implements ProjectInterface {\n readonly #config: V3Config;\n readonly catalog: ProjectInterface[\"catalog\"];\n readonly cloudId: ProjectInterface[\"cloudId\"];\n readonly cloudType: ProjectInterface[\"cloudType\"];\n readonly createdAt: ProjectInterface[\"createdAt\"];\n readonly createdBy: ProjectInterface[\"createdBy\"];\n readonly credentials: ProjectInterface[\"credentials\"];\n readonly id: ProjectInterface[\"id\"];\n readonly lastStateError: ProjectInterface[\"lastStateError\"];\n readonly modifiedAt: ProjectInterface[\"modifiedAt\"];\n readonly modifiedBy: ProjectInterface[\"modifiedBy\"];\n readonly name: ProjectInterface[\"name\"];\n readonly numberOfEngines: ProjectInterface[\"numberOfEngines\"];\n readonly primaryCatalog: ProjectInterface[\"primaryCatalog\"];\n readonly projectStore: ProjectInterface[\"projectStore\"];\n readonly state: ProjectInterface[\"state\"];\n readonly type: ProjectInterface[\"type\"];\n\n #projectsResource: ProjectsResource;\n\n constructor(config: V3Config, properties: ProjectProperties, projectsResource: ProjectsResource) {\n this.#config = config;\n this.catalog = properties.catalog;\n this.cloudId = properties.cloudId;\n this.cloudType = properties.cloudType;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.credentials = properties.credentials;\n this.id = properties.id;\n this.lastStateError = properties.lastStateError;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.numberOfEngines = properties.numberOfEngines;\n this.primaryCatalog = properties.primaryCatalog;\n this.projectStore = properties.projectStore;\n this.state = properties.state;\n this.type = properties.type;\n this.#projectsResource = projectsResource;\n }\n\n activate() {\n return this.#projectsResource.activate(this.id);\n }\n\n delete() {\n return this.#projectsResource.delete(this.id);\n }\n\n update(\n properties: z.output<typeof projectUpdateSchema>,\n ): AsyncResult<\n Project,\n HttpError | z.core.util.SafeParseResult<z.output<typeof projectUpdateSchema>>[\"error\"]\n > {\n const parsedProperties = z.safeEncode(projectUpdateSchema, properties);\n if (!parsedProperties.success) {\n return new AsyncResult(Promise.resolve(Err(parsedProperties.error)));\n }\n return this.#config\n .v3Request(`projects/${this.id}`, {\n body: JSON.stringify(parsedProperties.data),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof projectPropertiesCodec>>)\n .map((entity) => this.#projectsResource._createFromEntity(entity));\n }\n\n get settled() {\n return this.state === \"ACTIVE\" || this.state === \"ARCHIVED\" || this.state === \"INACTIVE\";\n }\n\n static updateSchema = projectUpdateSchema;\n}\n\nexport type ProjectProperties = z.output<typeof projectPropertiesCodec>;\n\nexport type ProjectMethods = {\n delete(): Promise<Result<undefined, unknown>>;\n get settled(): boolean;\n};\n\nexport type ProjectInterface = ProjectProperties & ProjectMethods;\n"]}
@@ -1,5 +1,8 @@
1
1
  import * as z from "zod/mini";
2
2
  export declare const projectPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
3
+ catalog: z.ZodMiniOptional<z.ZodMiniObject<{
4
+ storageLocation: z.ZodMiniString<string>;
5
+ }, z.core.$strip>>;
3
6
  cloudId: z.ZodMiniString<string>;
4
7
  cloudType: z.ZodMiniEnum<{
5
8
  AWS: "AWS";
@@ -67,6 +70,9 @@ export declare const projectPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject<{
67
70
  }>;
68
71
  createdBy: z.ZodMiniString<string>;
69
72
  modifiedBy: z.ZodMiniString<string>;
73
+ catalog: z.ZodMiniOptional<z.ZodMiniObject<{
74
+ storageLocation: z.ZodMiniString<string>;
75
+ }, z.core.$strip>>;
70
76
  cloudId: z.ZodMiniString<string>;
71
77
  cloudType: z.ZodMiniEnum<{
72
78
  AWS: "AWS";
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import * as z from "zod/mini";
17
17
  const sharedProjectPropertiesInSchema = z.object({
18
+ catalog: z.optional(z.object({ storageLocation: z.string() })),
18
19
  cloudId: z.string(),
19
20
  cloudType: z.enum(["AWS", "AZURE"]),
20
21
  createdAt: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"projectPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/projects/projectPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,QAAQ,CACrB,CAAC,CAAC,kBAAkB,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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 * as z from \"zod/mini\";\n\nconst sharedProjectPropertiesInSchema = z.object({\n cloudId: z.string(),\n cloudType: z.enum([\"AWS\", \"AZURE\"]),\n createdAt: z.string(),\n createdBy: z.string(),\n credentials: z.optional(\n z.discriminatedUnion(\"type\", [\n z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.optional(z.string()),\n type: z.literal(\"ACCESS_KEY\"),\n }),\n z.object({\n externalId: z.string(),\n externalIdSignature: z.optional(z.string()),\n instanceProfileArn: z.optional(z.nullable(z.string())),\n roleArn: z.string(),\n type: z.literal(\"IAM_ROLE\"),\n }),\n z.object({\n accountName: z.string(),\n clientId: z.string(),\n clientSecret: z.string(),\n tenantId: z.string(),\n type: z.literal(\"AZURE_STORAGE_CLIENT_CREDENTIALS\"),\n }),\n ]),\n ),\n id: z.string(),\n jdbcConnectionString: z.optional(z.string()),\n lastStateError: z.optional(z.object({ error: z.string(), timestamp: z.number() })),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n numberOfEngines: z.number().check(z.int(), z.minimum(0)),\n primaryCatalog: z.optional(z.string()),\n projectStore: z.optional(z.string()),\n state: z.enum([\n \"ACTIVATING\",\n \"ACTIVE\",\n \"ARCHIVED\",\n \"ARCHIVING\",\n \"CREATING\",\n \"DEACTIVATING\",\n \"INACTIVE\",\n \"RESTORING\",\n ]),\n type: z.enum([\"QUERY_ENGINE\"]),\n});\n\nexport const projectPropertiesCodec = z.codec(\n sharedProjectPropertiesInSchema,\n z.extend(z.omit(sharedProjectPropertiesInSchema, { createdAt: true, modifiedAt: true }), {\n createdAt: z.instanceof(Date),\n modifiedAt: z.instanceof(Date),\n }),\n {\n decode(v) {\n const { createdAt, modifiedAt, ...rest } = v;\n return {\n ...rest,\n createdAt: new Date(createdAt),\n modifiedAt: new Date(modifiedAt),\n };\n },\n encode(v) {\n const { createdAt, modifiedAt, ...rest } = v;\n return {\n ...rest,\n createdAt: createdAt.toString(),\n modifiedAt: modifiedAt.toString(),\n };\n },\n },\n);\n\nexport const projectUpdateSchema = z.partial(\n z.extend(z.pick(projectPropertiesCodec.def.in, { credentials: true }), {\n name: z.string().check(\n z.minLength(6, \"Project name must be at least 6 characters\"),\n z.maxLength(30, \"Project name must be at most 30 characters\"),\n z.regex(\n /^[a-z][a-z0-9-]*[a-z0-9]$/,\n \"Project name must start with a letter, contain only lowercase letters, numbers, and hyphens, and cannot end with a hyphen\",\n ),\n z.superRefine((val, ctx) => {\n const foundWord = projectDisallowedWords.find((word) => val.includes(word));\n if (foundWord) {\n ctx.addIssue({\n code: \"custom\",\n input: val,\n message: `Project name cannot contain the word \"${foundWord}\"`,\n });\n }\n }),\n ),\n }),\n);\n\nconst projectDisallowedWords = [\n \"dremio\",\n \"ssl\",\n \"admin\",\n \"system\",\n \"null\",\n \"undefined\",\n \"static\",\n \"assets\",\n \"login\",\n \"logout\",\n] as const;\n"]}
1
+ {"version":3,"file":"projectPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/projects/projectPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,E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KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;CACA,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 * as z from \"zod/mini\";\n\nconst sharedProjectPropertiesInSchema = z.object({\n catalog: z.optional(z.object({ storageLocation: z.string() })),\n cloudId: z.string(),\n cloudType: z.enum([\"AWS\", \"AZURE\"]),\n createdAt: z.string(),\n createdBy: z.string(),\n credentials: z.optional(\n z.discriminatedUnion(\"type\", [\n z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.optional(z.string()),\n type: z.literal(\"ACCESS_KEY\"),\n }),\n z.object({\n externalId: z.string(),\n externalIdSignature: z.optional(z.string()),\n instanceProfileArn: z.optional(z.nullable(z.string())),\n roleArn: z.string(),\n type: z.literal(\"IAM_ROLE\"),\n }),\n z.object({\n accountName: z.string(),\n clientId: z.string(),\n clientSecret: z.string(),\n tenantId: z.string(),\n type: z.literal(\"AZURE_STORAGE_CLIENT_CREDENTIALS\"),\n }),\n ]),\n ),\n id: z.string(),\n jdbcConnectionString: z.optional(z.string()),\n lastStateError: z.optional(z.object({ error: z.string(), timestamp: z.number() })),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n numberOfEngines: z.number().check(z.int(), z.minimum(0)),\n primaryCatalog: z.optional(z.string()),\n projectStore: z.optional(z.string()),\n state: z.enum([\n \"ACTIVATING\",\n \"ACTIVE\",\n \"ARCHIVED\",\n \"ARCHIVING\",\n \"CREATING\",\n \"DEACTIVATING\",\n \"INACTIVE\",\n \"RESTORING\",\n ]),\n type: z.enum([\"QUERY_ENGINE\"]),\n});\n\nexport const projectPropertiesCodec = z.codec(\n sharedProjectPropertiesInSchema,\n z.extend(z.omit(sharedProjectPropertiesInSchema, { createdAt: true, modifiedAt: true }), {\n createdAt: z.instanceof(Date),\n modifiedAt: z.instanceof(Date),\n }),\n {\n decode(v) {\n const { createdAt, modifiedAt, ...rest } = v;\n return {\n ...rest,\n createdAt: new Date(createdAt),\n modifiedAt: new Date(modifiedAt),\n };\n },\n encode(v) {\n const { createdAt, modifiedAt, ...rest } = v;\n return {\n ...rest,\n createdAt: createdAt.toString(),\n modifiedAt: modifiedAt.toString(),\n };\n },\n },\n);\n\nexport const projectUpdateSchema = z.partial(\n z.extend(z.pick(projectPropertiesCodec.def.in, { credentials: true }), {\n name: z.string().check(\n z.minLength(6, \"Project name must be at least 6 characters\"),\n z.maxLength(30, \"Project name must be at most 30 characters\"),\n z.regex(\n /^[a-z][a-z0-9-]*[a-z0-9]$/,\n \"Project name must start with a letter, contain only lowercase letters, numbers, and hyphens, and cannot end with a hyphen\",\n ),\n z.superRefine((val, ctx) => {\n const foundWord = projectDisallowedWords.find((word) => val.includes(word));\n if (foundWord) {\n ctx.addIssue({\n code: \"custom\",\n input: val,\n message: `Project name cannot contain the word \"${foundWord}\"`,\n });\n }\n }),\n ),\n }),\n);\n\nconst projectDisallowedWords = [\n \"dremio\",\n \"ssl\",\n \"admin\",\n \"system\",\n \"null\",\n \"undefined\",\n \"static\",\n \"assets\",\n \"login\",\n \"logout\",\n] as const;\n"]}
@@ -14,7 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  const prodLikePattern = /^([^.]+)(\.(?:(?:eu\.)?dremio\.cloud|[^.]+\.dremio\.site))$/;
17
- const daasEnginePattern = /^(dcs-aws-\d+-ns\.)([^.]+)(\.drem\.io)$/;
17
+ const privateLinkPattern = /^([^.]+\.)([^.]+)((\.privatelink\.dremio\.cloud)|(\.privatelink\.([^.]+)\.dremio\.site))$/;
18
+ const daasEnginePattern = /^(dcs-(?:aws|cloud)-\d+-ns\.)([^.]+)(\.drem\.io)$/;
18
19
  /**
19
20
  * @hidden
20
21
  * @internal
@@ -22,6 +23,10 @@ const daasEnginePattern = /^(dcs-aws-\d+-ns\.)([^.]+)(\.drem\.io)$/;
22
23
  export function _replaceOriginResource(origin, resource) {
23
24
  const url = new URL(origin);
24
25
  const hostname = url.hostname;
26
+ if (privateLinkPattern.test(hostname)) {
27
+ url.hostname = hostname.replace(privateLinkPattern, `$1${resource}$3`);
28
+ return url.origin;
29
+ }
25
30
  if (daasEnginePattern.test(hostname)) {
26
31
  url.hostname = hostname.replace(daasEnginePattern, `$1${resource}$3`);
27
32
  return url.origin;
@@ -1 +1 @@
1
- {"version":3,"file":"replaceOriginResource.js","sourceRoot":"","sources":["../../src/cloud/replaceOriginResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,eAAe,GAAG,6DAA6D,CAAC;AACtF,MAAM,iBAAiB,GAAG,yCAAyC,CAAC;AAEpE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwB,EAAE,QAAgB;IAC/E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAE9B,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC;QACtE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,QAAQ,IAAI,CAAC,CAAC;QAClE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,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 { Config } from \"../common/Config.ts\";\n\nconst prodLikePattern = /^([^.]+)(\\.(?:(?:eu\\.)?dremio\\.cloud|[^.]+\\.dremio\\.site))$/;\nconst daasEnginePattern = /^(dcs-aws-\\d+-ns\\.)([^.]+)(\\.drem\\.io)$/;\n\n/**\n * @hidden\n * @internal\n */\nexport function _replaceOriginResource(origin: Config[\"origin\"], resource: string): string {\n const url = new URL(origin);\n const hostname = url.hostname;\n\n if (daasEnginePattern.test(hostname)) {\n url.hostname = hostname.replace(daasEnginePattern, `$1${resource}$3`);\n return url.origin;\n }\n\n if (prodLikePattern.test(hostname)) {\n url.hostname = hostname.replace(prodLikePattern, `${resource}$2`);\n return url.origin;\n }\n\n return url.origin;\n}\n"]}
1
+ {"version":3,"file":"replaceOriginResource.js","sourceRoot":"","sources":["../../src/cloud/replaceOriginResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,eAAe,GAAG,6DAA6D,CAAC;AACtF,MAAM,kBAAkB,GACtB,2FAA2F,CAAC;AAC9F,MAAM,iBAAiB,GAAG,mDAAmD,CAAC;AAE9E;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwB,EAAE,QAAgB;IAC/E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAE9B,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC;QACvE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC;QACtE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,QAAQ,IAAI,CAAC,CAAC;QAClE,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,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 { Config } from \"../common/Config.ts\";\n\nconst prodLikePattern = /^([^.]+)(\\.(?:(?:eu\\.)?dremio\\.cloud|[^.]+\\.dremio\\.site))$/;\nconst privateLinkPattern =\n /^([^.]+\\.)([^.]+)((\\.privatelink\\.dremio\\.cloud)|(\\.privatelink\\.([^.]+)\\.dremio\\.site))$/;\nconst daasEnginePattern = /^(dcs-(?:aws|cloud)-\\d+-ns\\.)([^.]+)(\\.drem\\.io)$/;\n\n/**\n * @hidden\n * @internal\n */\nexport function _replaceOriginResource(origin: Config[\"origin\"], resource: string): string {\n const url = new URL(origin);\n const hostname = url.hostname;\n\n if (privateLinkPattern.test(hostname)) {\n url.hostname = hostname.replace(privateLinkPattern, `$1${resource}$3`);\n return url.origin;\n }\n\n if (daasEnginePattern.test(hostname)) {\n url.hostname = hostname.replace(daasEnginePattern, `$1${resource}$3`);\n return url.origin;\n }\n\n if (prodLikePattern.test(hostname)) {\n url.hostname = hostname.replace(prodLikePattern, `${resource}$2`);\n return url.origin;\n }\n\n return url.origin;\n}\n"]}
@@ -39,6 +39,13 @@ export type ResourceConfig = {
39
39
  origin: Config["origin"];
40
40
  request: RequestFn;
41
41
  };
42
+ /**
43
+ * @hidden
44
+ * @internal
45
+ */
46
+ export type Logger = {
47
+ logger?: Config["logger"];
48
+ };
42
49
  /**
43
50
  * @hidden
44
51
  * @internal
@@ -87,3 +94,10 @@ export type V4Config = {
87
94
  v4Request: RequestFn;
88
95
  v4URL: (path: string) => URL;
89
96
  };
97
+ /**
98
+ * @hidden
99
+ * @internal
100
+ */
101
+ export type XHRConfig = {
102
+ xhr: (method: string, input: string, headers?: Record<string, string>, body?: XMLHttpRequestBodyInit, modifyXHR?: (xhr: XMLHttpRequest) => void) => AsyncResult<XMLHttpRequest, unknown>;
103
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/common/Config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AsyncResult } from \"ts-results-es\";\nimport type { CredentialProvider } from \"./CredentialProvider.ts\";\nimport type { HttpError } from \"./HttpError.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => AsyncResult<Response, HttpError>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: (input: string, init?: RequestInit) => Promise<Response>;\n\n /**\n * Dremio API base origin\n */\n origin: string;\n\n logger?: {\n debug: typeof console.debug;\n error: typeof console.error;\n info: typeof console.info;\n warn: typeof console.warn;\n };\n\n /**\n * Provides credentials to Dremio for all authenticated API requests.\n * Required unless using a custom `fetch` provider with its own credentials provision\n */\n credentials?: CredentialProvider;\n\n /**\n * Configure the maximum number of times to retry requests that failed due to a\n * temporary condition such as 429 or 503. Default is 10. Set to 0 to disable\n * automatic retry.\n */\n maxRetryCount?: number;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type ResourceConfig = {\n logger?: Config[\"logger\"];\n origin: Config[\"origin\"];\n request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV2Config = {\n sonarV2Request: RequestFn;\n sonarV2URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV3Config = {\n sonarV3Request: RequestFn;\n sonarV3URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV4Config = {\n sonarV4Request: RequestFn;\n sonarV4URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V2Config = {\n v2Request: RequestFn;\n v2URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V3Config = {\n v3Request: RequestFn;\n v3URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V4Config = {\n v4Request: RequestFn;\n v4URL: (path: string) => URL;\n};\n"]}
1
+ {"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/common/Config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AsyncResult } from \"ts-results-es\";\nimport type { CredentialProvider } from \"./CredentialProvider.ts\";\nimport type { HttpError } from \"./HttpError.ts\";\n\nexport type RequestFn = (input: string, init?: RequestInit) => AsyncResult<Response, HttpError>;\n\nexport type Config = {\n /**\n * Custom `fetch` provider\n * @default globalThis.fetch\n */\n fetch?: (input: string, init?: RequestInit) => Promise<Response>;\n\n /**\n * Dremio API base origin\n */\n origin: string;\n\n logger?: {\n debug: typeof console.debug;\n error: typeof console.error;\n info: typeof console.info;\n warn: typeof console.warn;\n };\n\n /**\n * Provides credentials to Dremio for all authenticated API requests.\n * Required unless using a custom `fetch` provider with its own credentials provision\n */\n credentials?: CredentialProvider;\n\n /**\n * Configure the maximum number of times to retry requests that failed due to a\n * temporary condition such as 429 or 503. Default is 10. Set to 0 to disable\n * automatic retry.\n */\n maxRetryCount?: number;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type ResourceConfig = {\n logger?: Config[\"logger\"];\n origin: Config[\"origin\"];\n request: RequestFn;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type Logger = {\n logger?: Config[\"logger\"];\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV2Config = {\n sonarV2Request: RequestFn;\n sonarV2URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV3Config = {\n sonarV3Request: RequestFn;\n sonarV3URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type SonarV4Config = {\n sonarV4Request: RequestFn;\n sonarV4URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V2Config = {\n v2Request: RequestFn;\n v2URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V3Config = {\n v3Request: RequestFn;\n v3URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type V4Config = {\n v4Request: RequestFn;\n v4URL: (path: string) => URL;\n};\n\n/**\n * @hidden\n * @internal\n */\nexport type XHRConfig = {\n xhr: (\n method: string,\n input: string,\n headers?: Record<string, string>,\n body?: XMLHttpRequestBodyInit,\n modifyXHR?: (xhr: XMLHttpRequest) => void,\n ) => AsyncResult<XMLHttpRequest, unknown>;\n};\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { Config, RequestFn } from "./Config.ts";
2
+ export declare const getHeadersFromConfig: (config: Config) => Promise<RequestInit["headers"]>;
2
3
  /**
3
4
  * @internal
4
5
  * @hidden
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { AsyncResult, Err, Ok, Result } from "ts-results-es";
17
17
  import { HttpError } from "./HttpError.js";
18
- const getHeadersFromConfig = async (config) => {
18
+ export const getHeadersFromConfig = async (config) => {
19
19
  if (config.credentials) {
20
20
  return {
21
21
  Authorization: `Bearer ${await config.credentials.get(config)}`,
@@ -1 +1 @@
1
- {"version":3,"file":"createRequest.js","sourceRoot":"","sources":["../../src/common/createRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAAc,EAAmC,EAAE;IACrF,IAAI,MAAM,CAAC,WAA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,CAAC,UAAkB,EAAU,EAAE;IACrD,4CAA4C;IAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAEhC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,wCAAwC;IACxC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAE3C,qEAAqE;IACrE,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,CAAC;IACX,CAAC;IAED,+DAA+D;IAC/D,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,kBAAkB,GAAG,MAAM,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 { AsyncResult, Err, Ok, Result } from \"ts-results-es\";\nimport type { Config, RequestFn } from \"./Config.ts\";\nimport { HttpError } from \"./HttpError.ts\";\n\nconst getHeadersFromConfig = async (config: Config): Promise<RequestInit[\"headers\"]> => {\n if (config.credentials) {\n return {\n Authorization: `Bearer ${await config.credentials.get(config)}`,\n };\n }\n return {};\n};\n\n/**\n * @internal\n * @hidden\n */\nexport const createRequest = (config: Config): RequestFn => {\n const fetch = (config.fetch as typeof globalThis.fetch) || globalThis.fetch;\n const MAX_RETRIES = config.maxRetryCount ?? 10;\n\n return function request(input: string, init?: RequestInit) {\n const startFetch = async (triesRemaining: number): Promise<Result<Response, HttpError>> => {\n const start = performance.now();\n\n return fetch(new URL(input, config.origin), {\n ...init,\n headers: { ...(await getHeadersFromConfig(config)), ...init?.headers },\n }).then(async (res) => {\n config.logger?.debug(\n `${init?.method?.toUpperCase() || \"GET\"} ${input} (${res.status}) [${Math.round(performance.now() - start)}ms]`,\n );\n\n if (!res.ok) {\n if (isRetryableResponse(res) && triesRemaining > 0) {\n const retryWait = getRetryWait(res, triesRemaining, MAX_RETRIES);\n config.logger?.warn(\n `${init?.method?.toUpperCase() || \"GET\"} ${input} (${res.status}) [Retrying in ${retryWait}ms]`,\n );\n await new Promise((resolve) => setTimeout(resolve, retryWait));\n return startFetch(triesRemaining - 1);\n }\n return Err(await HttpError.fromResponse(res));\n }\n\n return Ok(res);\n });\n };\n\n return new AsyncResult(startFetch(MAX_RETRIES));\n };\n};\n\nconst getRetryWait = (res: Response, triesRemaining: number, maxRetries: number) => {\n const retryAfter = res.headers.get(\"retry-after\");\n\n if (retryAfter) {\n return parseRetryAfter(retryAfter);\n }\n\n return Math.min(MAX_RETRY_INTERVAL, 2 ** (maxRetries - triesRemaining) * 1000 + 6000);\n};\n\nconst isRetryableResponse = (res: Response) => {\n return res.status === 429 || res.status === 502 || res.status === 503;\n};\n\nconst parseRetryAfter = (retryAfter: string): number => {\n // Try parsing as the <delay-seconds> format\n const nval = Number(retryAfter);\n\n if (Number.isFinite(nval)) {\n return Math.min(MAX_RETRY_WAIT, Math.max(0, nval * 1000));\n }\n\n // Try parsing as the <http-date> format\n const retryDateMs = Date.parse(retryAfter);\n\n // This case is hit when value couldn't be parsed as a number or date\n if (Number.isNaN(retryDateMs)) {\n return 0;\n }\n\n // Return the number of millseconds between target date and now\n return Math.min(MAX_RETRY_WAIT, Math.max(0, retryDateMs - Date.now()));\n};\n\n/**\n * There really shouldn't be a case where the client needs to wait longer than\n * five minutes before retrying a request, so if the API requests a longer retry\n * interval, ignore it.\n */\nconst MAX_RETRY_WAIT = 300_000;\n\n/**\n * When no retry-after is provided, cap the retry interval to 30 seconds.\n */\nconst MAX_RETRY_INTERVAL = 30_000;\n"]}
1
+ {"version":3,"file":"createRequest.js","sourceRoot":"","sources":["../../src/common/createRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAAc,EAAmC,EAAE;IAC5F,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,OAAO;YACL,aAAa,EAAE,UAAU,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;SAChE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAa,EAAE;IACzD,MAAM,KAAK,GAAI,MAAM,CAAC,KAAiC,IAAI,UAAU,CAAC,KAAK,CAAC;IAC5E,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC;IAE/C,OAAO,SAAS,OAAO,CAAC,KAAa,EAAE,IAAkB;QACvD,MAAM,UAAU,GAAG,KAAK,EAAE,cAAsB,EAAwC,EAAE;YACxF,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;YAEhC,OAAO,KAAK,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,M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,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,kBAAkB,GAAG,MAAM,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 { AsyncResult, Err, Ok, Result } from \"ts-results-es\";\nimport type { Config, RequestFn } from \"./Config.ts\";\nimport { HttpError } from \"./HttpError.ts\";\n\nexport const getHeadersFromConfig = async (config: Config): Promise<RequestInit[\"headers\"]> => {\n if (config.credentials) {\n return {\n Authorization: `Bearer ${await config.credentials.get(config)}`,\n };\n }\n return {};\n};\n\n/**\n * @internal\n * @hidden\n */\nexport const createRequest = (config: Config): RequestFn => {\n const fetch = (config.fetch as typeof globalThis.fetch) || globalThis.fetch;\n const MAX_RETRIES = config.maxRetryCount ?? 10;\n\n return function request(input: string, init?: RequestInit) {\n const startFetch = async (triesRemaining: number): Promise<Result<Response, HttpError>> => {\n const start = performance.now();\n\n return fetch(new URL(input, config.origin), {\n ...init,\n headers: { ...(await getHeadersFromConfig(config)), ...init?.headers },\n }).then(async (res) => {\n config.logger?.debug(\n `${init?.method?.toUpperCase() || \"GET\"} ${input} (${res.status}) [${Math.round(performance.now() - start)}ms]`,\n );\n\n if (!res.ok) {\n if (isRetryableResponse(res) && triesRemaining > 0) {\n const retryWait = getRetryWait(res, triesRemaining, MAX_RETRIES);\n config.logger?.warn(\n `${init?.method?.toUpperCase() || \"GET\"} ${input} (${res.status}) [Retrying in ${retryWait}ms]`,\n );\n await new Promise((resolve) => setTimeout(resolve, retryWait));\n return startFetch(triesRemaining - 1);\n }\n return Err(await HttpError.fromResponse(res));\n }\n\n return Ok(res);\n });\n };\n\n return new AsyncResult(startFetch(MAX_RETRIES));\n };\n};\n\nconst getRetryWait = (res: Response, triesRemaining: number, maxRetries: number) => {\n const retryAfter = res.headers.get(\"retry-after\");\n\n if (retryAfter) {\n return parseRetryAfter(retryAfter);\n }\n\n return Math.min(MAX_RETRY_INTERVAL, 2 ** (maxRetries - triesRemaining) * 1000 + 6000);\n};\n\nconst isRetryableResponse = (res: Response) => {\n return res.status === 429 || res.status === 502 || res.status === 503;\n};\n\nconst parseRetryAfter = (retryAfter: string): number => {\n // Try parsing as the <delay-seconds> format\n const nval = Number(retryAfter);\n\n if (Number.isFinite(nval)) {\n return Math.min(MAX_RETRY_WAIT, Math.max(0, nval * 1000));\n }\n\n // Try parsing as the <http-date> format\n const retryDateMs = Date.parse(retryAfter);\n\n // This case is hit when value couldn't be parsed as a number or date\n if (Number.isNaN(retryDateMs)) {\n return 0;\n }\n\n // Return the number of millseconds between target date and now\n return Math.min(MAX_RETRY_WAIT, Math.max(0, retryDateMs - Date.now()));\n};\n\n/**\n * There really shouldn't be a case where the client needs to wait longer than\n * five minutes before retrying a request, so if the API requests a longer retry\n * interval, ignore it.\n */\nconst MAX_RETRY_WAIT = 300_000;\n\n/**\n * When no retry-after is provided, cap the retry interval to 30 seconds.\n */\nconst MAX_RETRY_INTERVAL = 30_000;\n"]}
@@ -0,0 +1,2 @@
1
+ import type { Config, XHRConfig } from "./Config.ts";
2
+ export declare function createXHR(config: Config): XHRConfig["xhr"];
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Copyright (C) 2024-2025 Dremio Corporation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { AsyncResult, Err, Ok } from "ts-results-es";
17
+ import { getHeadersFromConfig } from "./createRequest.js";
18
+ import { HttpError } from "./HttpError.js";
19
+ export function createXHR(config) {
20
+ return function xhr(method, input, headers, body, modifyXHR) {
21
+ if (!("XMLHttpRequest" in globalThis)) {
22
+ throw new Error("XMLHttpRequest is not available in this environment");
23
+ }
24
+ return new AsyncResult((async function () {
25
+ const authHeaders = await getHeadersFromConfig(config);
26
+ return new Promise((resolve, reject) => {
27
+ const xhr = new XMLHttpRequest();
28
+ xhr.open(method, input);
29
+ Object.entries({ ...headers, ...authHeaders }).forEach(([key, value]) => {
30
+ xhr.setRequestHeader(key, value);
31
+ });
32
+ modifyXHR?.(xhr);
33
+ xhr.onload = () => {
34
+ if (xhr.status >= 200 && xhr.status < 300) {
35
+ try {
36
+ resolve(xhr);
37
+ }
38
+ catch (e) {
39
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
40
+ reject(e);
41
+ }
42
+ }
43
+ else {
44
+ reject(new HttpError(xhr.status, JSON.parse(xhr.responseText)));
45
+ }
46
+ };
47
+ xhr.onerror = function (e) {
48
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
49
+ reject(e);
50
+ };
51
+ xhr.send(body);
52
+ })
53
+ .then((val) => Ok(val))
54
+ .catch((e) => Err(e));
55
+ })());
56
+ };
57
+ }
58
+ //# sourceMappingURL=createXHR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createXHR.js","sourceRoot":"","sources":["../../src/common/createXHR.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,o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,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBAClE,CAAC;gBACH,CAAC,CAAC;gBAEF,GAAG,CAAC,OAAO,GAAG,UAAU,CAAC;oBACvB,2EAA2E;oBAC3E,MAAM,CAAC,CAAC,CAAC,CAAC;gBACZ,CAAC,CAAC;gBAEF,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC,CAAC;iBACC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;iBACtB,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,EAAE,CACL,CAAC;IACJ,CAAC,CAAC;AACJ,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 { AsyncResult, Err, Ok } from \"ts-results-es\";\nimport type { Config, XHRConfig } from \"./Config.ts\";\nimport { getHeadersFromConfig } from \"./createRequest.ts\";\nimport { HttpError } from \"./HttpError.ts\";\n\nexport function createXHR(config: Config): XHRConfig[\"xhr\"] {\n return function xhr(method, input, headers, body, modifyXHR) {\n if (!(\"XMLHttpRequest\" in globalThis)) {\n throw new Error(\"XMLHttpRequest is not available in this environment\");\n }\n return new AsyncResult(\n (async function () {\n const authHeaders = await getHeadersFromConfig(config);\n return new Promise<XMLHttpRequest>((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n xhr.open(method, input);\n\n Object.entries({ ...headers, ...authHeaders }).forEach(([key, value]) => {\n xhr.setRequestHeader(key, value as string);\n });\n\n modifyXHR?.(xhr);\n\n xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n try {\n resolve(xhr);\n } catch (e: unknown) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(e);\n }\n } else {\n reject(new HttpError(xhr.status, JSON.parse(xhr.responseText)));\n }\n };\n\n xhr.onerror = function (e) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(e);\n };\n\n xhr.send(body);\n })\n .then((val) => Ok(val))\n .catch((e: unknown) => Err(e));\n })(),\n );\n };\n}\n"]}
@@ -6,9 +6,11 @@ import { SqlResource } from "../oss/sql/SqlResource.js";
6
6
  import { EnterpriseUsersResource } from "./users/EnterpriseUsersResource.js";
7
7
  import { EnginesResource } from "./engines/EnginesResource.js";
8
8
  import { RolesResource } from "./roles/RolesResource.js";
9
- import { GrantsResource } from "./grants/GrantsResource.ts";
9
+ import { GrantsResource } from "./grants/GrantsResource.js";
10
+ import { AIResource } from "./ai/AIResource.js";
10
11
  export declare class Dremio {
11
12
  #private;
13
+ readonly ai: AIResource;
12
14
  readonly catalog: EnterpriseCatalogResource;
13
15
  readonly engines: EnginesResource;
14
16
  readonly jobs: JobsResource;
@@ -22,7 +22,9 @@ import { EnginesResource } from "./engines/EnginesResource.js";
22
22
  import { RolesResource } from "./roles/RolesResource.js";
23
23
  import { getResourceConfig } from "../oss/getResourceConfig.js";
24
24
  import { GrantsResource } from "./grants/GrantsResource.js";
25
+ import { AIResource } from "./ai/AIResource.js";
25
26
  export class Dremio {
27
+ ai;
26
28
  catalog;
27
29
  engines;
28
30
  jobs;
@@ -37,6 +39,7 @@ export class Dremio {
37
39
  #resourceConfig;
38
40
  constructor(config) {
39
41
  this.#resourceConfig = getResourceConfig(config);
42
+ this.ai = new AIResource(this.#resourceConfig);
40
43
  this.catalog = new EnterpriseCatalogResource(this.#resourceConfig);
41
44
  this.engines = new EnginesResource(this.#resourceConfig);
42
45
  this.jobs = new JobsResource(this.#resourceConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/enterprise/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,OAAO,MAAM;IACR,OAAO,CAA4B;IACnC,OAAO,CAAkB;IACzB,IAAI,CAAe;IAE5B;;OAEG;IACM,OAAO,CAAiB;IACxB,KAAK,CAAgB;IACrB,OAAO,CAA4B;IACnC,GAAG,CAAc;IACjB,KAAK,CAA0B;IAC/B,eAAe,CAAuC;IAE/D,YAAY,MAAc;QACxB,IAAI,CAAC,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"./catalog/EnterpriseCatalogResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.js\";\nimport { EnterpriseScriptsResource } from \"./scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { EnterpriseUsersResource } from \"./users/EnterpriseUsersResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { RolesResource } from \"./roles/RolesResource.js\";\nimport { getResourceConfig } from \"../oss/getResourceConfig.ts\";\nimport { GrantsResource } from \"./grants/GrantsResource.ts\";\n\nexport class Dremio {\n readonly catalog: EnterpriseCatalogResource;\n readonly engines: EnginesResource;\n readonly jobs: JobsResource;\n\n /**\n * @experimental\n */\n readonly _grants: GrantsResource;\n readonly roles: RolesResource;\n readonly scripts: EnterpriseScriptsResource;\n readonly sql: SqlResource;\n readonly users: EnterpriseUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.catalog = new EnterpriseCatalogResource(this.#resourceConfig);\n this.engines = new EnginesResource(this.#resourceConfig);\n this.jobs = new JobsResource(this.#resourceConfig);\n this._grants = new GrantsResource(this.#resourceConfig);\n this.roles = new RolesResource(this.#resourceConfig);\n this.scripts = new EnterpriseScriptsResource(this.#resourceConfig);\n this.sql = new SqlResource(this.#resourceConfig);\n this.users = new EnterpriseUsersResource(this.#resourceConfig);\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
1
+ {"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/enterprise/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,OAAO,MAAM;IACR,EAAE,CAAa;IACf,OAAO,CAA4B;IACnC,OAAO,CAAkB;IACzB,IAAI,CAAe;IAE5B;;OAEG;IACM,OAAO,CAAiB;IACxB,KAAK,CAAgB;IACrB,OAAO,CAA4B;IACnC,GAAG,CAAc;IACjB,KAAK,CAA0B;IAC/B,eAAe,CAAuC;IAE/D,YAAY,MAAc;QACxB,IAAI,CAAC,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,EAAE,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnE,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"./catalog/EnterpriseCatalogResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.js\";\nimport { EnterpriseScriptsResource } from \"./scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { EnterpriseUsersResource } from \"./users/EnterpriseUsersResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { RolesResource } from \"./roles/RolesResource.js\";\nimport { getResourceConfig } from \"../oss/getResourceConfig.js\";\nimport { GrantsResource } from \"./grants/GrantsResource.js\";\nimport { AIResource } from \"./ai/AIResource.js\";\n\nexport class Dremio {\n readonly ai: AIResource;\n readonly catalog: EnterpriseCatalogResource;\n readonly engines: EnginesResource;\n readonly jobs: JobsResource;\n\n /**\n * @experimental\n */\n readonly _grants: GrantsResource;\n readonly roles: RolesResource;\n readonly scripts: EnterpriseScriptsResource;\n readonly sql: SqlResource;\n readonly users: EnterpriseUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.ai = new AIResource(this.#resourceConfig);\n this.catalog = new EnterpriseCatalogResource(this.#resourceConfig);\n this.engines = new EnginesResource(this.#resourceConfig);\n this.jobs = new JobsResource(this.#resourceConfig);\n this._grants = new GrantsResource(this.#resourceConfig);\n this.roles = new RolesResource(this.#resourceConfig);\n this.scripts = new EnterpriseScriptsResource(this.#resourceConfig);\n this.sql = new SqlResource(this.#resourceConfig);\n this.users = new EnterpriseUsersResource(this.#resourceConfig);\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
@@ -0,0 +1,118 @@
1
+ import { ChatSession } from "./chat/ChatSession.ts";
2
+ import type { UserChatMessage } from "./chat/UserChatMessage.ts";
3
+ import { AgentChatResponse } from "./chat/AgentChatResponse.ts";
4
+ import type { Logger, SonarV4Config, V4Config } from "../../common/Config.ts";
5
+ import { ModelProvider } from "./ModelProvider.ts";
6
+ import * as z from "zod/mini";
7
+ import { modelProviderCreateCodec } from "./modelProviderCodec.js";
8
+ import type { SignalParam } from "../../common/Params.ts";
9
+ import type { listModelsPropertiesSchema } from "./modelProviderConfigSchemas.ts";
10
+ import { Err, Ok } from "ts-results-es";
11
+ import type { HttpError } from "../../common/HttpError.ts";
12
+ import { Problem } from "../../common/Problem.ts";
13
+ export declare class AIResource {
14
+ #private;
15
+ constructor(config: Logger & V4Config & SonarV4Config);
16
+ createModelProvider(properties: z.output<typeof modelProviderCreateCodec>): import("ts-results-es").AsyncResult<ModelProvider, HttpError>;
17
+ listModelProviders(): {
18
+ data({ signal }?: SignalParam): AsyncGenerator<Ok<ModelProvider> | Err<z.core.$ZodError<{
19
+ name: string;
20
+ id: string;
21
+ tag: string;
22
+ createdBy: string;
23
+ modifiedBy: string;
24
+ config: {
25
+ amazonBedrock: {
26
+ auth: {
27
+ role: {
28
+ roleArn: string;
29
+ };
30
+ } | {
31
+ accessKey: {
32
+ accessKeyId: string;
33
+ };
34
+ };
35
+ region: "ap-east-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-southeast-5" | "ap-southeast-7" | "ca-central-1" | "eu-central-1" | "eu-central-2" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "il-central-1" | "me-central-1" | "sa-east-1" | "us-east-1" | "us-east-2" | "us-gov-east-1" | "us-gov-west-1" | "us-west-1" | "us-west-2";
36
+ };
37
+ } | {
38
+ anthropic: Record<string, never>;
39
+ } | {
40
+ azureOpenAi: {
41
+ auth: {
42
+ clientSecretAuth: {
43
+ azureClientId: string;
44
+ azureTenantId: string;
45
+ };
46
+ };
47
+ resourceName: string;
48
+ };
49
+ } | {
50
+ googleGemini: Record<string, never>;
51
+ } | {
52
+ openAi: {
53
+ organizationId: string;
54
+ };
55
+ };
56
+ defaultModelName: string;
57
+ isDefault: boolean;
58
+ createdAt: import("temporal-polyfill").Temporal.Instant;
59
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
60
+ sqlModelNames: Set<string>;
61
+ }>>, void, unknown>;
62
+ getPage: ({ signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
63
+ data: (Ok<ModelProvider> | Err<z.core.$ZodError<{
64
+ name: string;
65
+ id: string;
66
+ tag: string;
67
+ createdBy: string;
68
+ modifiedBy: string;
69
+ config: {
70
+ amazonBedrock: {
71
+ auth: {
72
+ role: {
73
+ roleArn: string;
74
+ };
75
+ } | {
76
+ accessKey: {
77
+ accessKeyId: string;
78
+ };
79
+ };
80
+ region: "ap-east-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-southeast-5" | "ap-southeast-7" | "ca-central-1" | "eu-central-1" | "eu-central-2" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "il-central-1" | "me-central-1" | "sa-east-1" | "us-east-1" | "us-east-2" | "us-gov-east-1" | "us-gov-west-1" | "us-west-1" | "us-west-2";
81
+ };
82
+ } | {
83
+ anthropic: Record<string, never>;
84
+ } | {
85
+ azureOpenAi: {
86
+ auth: {
87
+ clientSecretAuth: {
88
+ azureClientId: string;
89
+ azureTenantId: string;
90
+ };
91
+ };
92
+ resourceName: string;
93
+ };
94
+ } | {
95
+ googleGemini: Record<string, never>;
96
+ } | {
97
+ openAi: {
98
+ organizationId: string;
99
+ };
100
+ };
101
+ defaultModelName: string;
102
+ isDefault: boolean;
103
+ createdAt: import("temporal-polyfill").Temporal.Instant;
104
+ modifiedAt: import("temporal-polyfill").Temporal.Instant;
105
+ sqlModelNames: Set<string>;
106
+ }>>)[];
107
+ }, HttpError>;
108
+ };
109
+ listAvailableModels(properties: z.infer<typeof listModelsPropertiesSchema>): import("ts-results-es").AsyncResult<Set<string>, HttpError>;
110
+ retrieveModelProvider(id: string, { signal }?: SignalParam): import("ts-results-es").AsyncResult<ModelProvider, HttpError>;
111
+ /**
112
+ * Sends a chat message to the Dremio AI Agent and returns an Observable containing
113
+ * Agent replies.
114
+ */
115
+ sendChatMessage(chatSession: ChatSession): (chatMessage: UserChatMessage) => import("rxjs").Observable<Ok<AgentChatResponse<import("./chat/AgentChatResponse.ts").AgentResponseContent>> | Err<HttpError | Problem<SendChatMessageProblemCodes, undefined>>>;
116
+ }
117
+ type SendChatMessageProblemCodes = "https://api.dremio.dev/problems/ai-agent/chat/agent-disabled" | "https://api.dremio.dev/problems/ai-agent/chat/input-too-large" | "https://api.dremio.dev/problems/ai-agent/chat/model-provider-not-found" | "https://api.dremio.dev/problems/ai-agent/chat/no-default-model-provider" | "https://api.dremio.dev/problems/ai-agent/chat/no-model-provider-privilege" | "https://api.dremio.dev/problems/ai-agent/chat/preview-disabled" | "https://api.dremio.dev/problems/ai-agent/chat/rate-limit-exceeded";
118
+ export {};