@dremio/js-sdk 0.42.0 → 0.43.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 (115) hide show
  1. package/README.md +209 -0
  2. package/dist/cloud/ai/AIResource.d.ts +716 -17
  3. package/dist/cloud/ai/AIResource.js +40 -18
  4. package/dist/cloud/ai/AIResource.js.map +1 -1
  5. package/dist/cloud/ai/DremioModelProvider.d.ts +1 -1
  6. package/dist/cloud/ai/DremioModelProvider.js +6 -13
  7. package/dist/cloud/ai/DremioModelProvider.js.map +1 -1
  8. package/dist/cloud/ai/modelProviderCodec.d.ts +12 -0
  9. package/dist/cloud/replaceOriginResource.js +4 -0
  10. package/dist/cloud/replaceOriginResource.js.map +1 -1
  11. package/dist/common/ConflictResolver.d.ts +9 -1
  12. package/dist/common/ConflictResolver.js +10 -1
  13. package/dist/common/ConflictResolver.js.map +1 -1
  14. package/dist/common/refineRfc9557Schema.d.ts +1 -0
  15. package/dist/common/refineRfc9557Schema.js +26 -0
  16. package/dist/common/refineRfc9557Schema.js.map +1 -0
  17. package/dist/common/sharedExports.d.ts +1 -0
  18. package/dist/common/sharedExports.js +1 -0
  19. package/dist/common/sharedExports.js.map +1 -1
  20. package/dist/enterprise/Dremio.d.ts +1 -1
  21. package/dist/enterprise/Dremio.js +3 -2
  22. package/dist/enterprise/Dremio.js.map +1 -1
  23. package/dist/enterprise/ai/AIResource.d.ts +699 -18
  24. package/dist/enterprise/ai/AIResource.js +41 -19
  25. package/dist/enterprise/ai/AIResource.js.map +1 -1
  26. package/dist/enterprise/ai/chat/ChatSession.d.ts +4 -25
  27. package/dist/enterprise/ai/chat/ChatSession.js +6 -55
  28. package/dist/enterprise/ai/chat/ChatSession.js.map +1 -1
  29. package/dist/enterprise/ai/chat/UserChatMessage.d.ts +38 -22
  30. package/dist/enterprise/ai/chat/UserChatMessage.js +33 -41
  31. package/dist/enterprise/ai/chat/UserChatMessage.js.map +1 -1
  32. package/dist/enterprise/ai/chat/chatEventSchema.d.ts +169 -11
  33. package/dist/enterprise/ai/chat/chatEventSchema.js +183 -35
  34. package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -1
  35. package/dist/enterprise/ai/chat/eventWrappers/AgentChatPartialResponse.d.ts +0 -6
  36. package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.d.ts +6 -6
  37. package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.js +2 -2
  38. package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.js.map +1 -1
  39. package/dist/enterprise/ai/chat/index.d.ts +0 -3
  40. package/dist/enterprise/ai/chat/index.js +0 -1
  41. package/dist/enterprise/ai/chat/index.js.map +1 -1
  42. package/dist/enterprise/ai/chat/methods/sendChatMessage.js +4 -1
  43. package/dist/enterprise/ai/chat/methods/sendChatMessage.js.map +1 -1
  44. package/dist/enterprise/ai/chat/responseContent/AgentModelResponseContent.d.ts +1 -2
  45. package/dist/enterprise/ai/chat/responseContent/AgentModelResponseContent.js.map +1 -1
  46. package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.d.ts +1 -2
  47. package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.js +0 -1
  48. package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.js.map +1 -1
  49. package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.d.ts +1 -2
  50. package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.js +0 -1
  51. package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.js.map +1 -1
  52. package/dist/enterprise/ai/conversations/AgentConversation.d.ts +215 -0
  53. package/dist/enterprise/ai/conversations/AgentConversation.js +180 -0
  54. package/dist/enterprise/ai/conversations/AgentConversation.js.map +1 -0
  55. package/dist/enterprise/ai/conversations/conversationPropertiesCodec.d.ts +22 -0
  56. package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js +62 -0
  57. package/dist/enterprise/ai/conversations/conversationPropertiesCodec.js.map +1 -0
  58. package/dist/enterprise/ai/conversations/createConversationMachine.d.ts +682 -0
  59. package/dist/enterprise/ai/conversations/createConversationMachine.js +354 -0
  60. package/dist/enterprise/ai/conversations/createConversationMachine.js.map +1 -0
  61. package/dist/enterprise/ai/conversations/methods/createConversation.d.ts +28 -0
  62. package/dist/enterprise/ai/conversations/methods/createConversation.js +68 -0
  63. package/dist/enterprise/ai/conversations/methods/createConversation.js.map +1 -0
  64. package/dist/enterprise/ai/conversations/methods/createExchangeRun.d.ts +16 -0
  65. package/dist/enterprise/ai/conversations/methods/createExchangeRun.js +36 -0
  66. package/dist/enterprise/ai/conversations/methods/createExchangeRun.js.map +1 -0
  67. package/dist/enterprise/ai/conversations/methods/deleteConversation.d.ts +2 -0
  68. package/dist/enterprise/ai/conversations/methods/deleteConversation.js +24 -0
  69. package/dist/enterprise/ai/conversations/methods/deleteConversation.js.map +1 -0
  70. package/dist/enterprise/ai/conversations/methods/listConversations.d.ts +8 -0
  71. package/dist/enterprise/ai/conversations/methods/listConversations.js +30 -0
  72. package/dist/enterprise/ai/conversations/methods/listConversations.js.map +1 -0
  73. package/dist/enterprise/ai/conversations/methods/retrieveConversation.d.ts +12 -0
  74. package/dist/enterprise/ai/conversations/methods/retrieveConversation.js +29 -0
  75. package/dist/enterprise/ai/conversations/methods/retrieveConversation.js.map +1 -0
  76. package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.d.ts +86 -0
  77. package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.js +32 -0
  78. package/dist/enterprise/ai/conversations/methods/retrieveConversationHistory.js.map +1 -0
  79. package/dist/enterprise/ai/conversations/methods/stopExchangeRun.d.ts +2 -0
  80. package/dist/enterprise/ai/conversations/methods/stopExchangeRun.js +24 -0
  81. package/dist/enterprise/ai/conversations/methods/stopExchangeRun.js.map +1 -0
  82. package/dist/enterprise/ai/conversations/methods/streamRunEvents.d.ts +6 -0
  83. package/dist/enterprise/ai/conversations/methods/streamRunEvents.js +33 -0
  84. package/dist/enterprise/ai/conversations/methods/streamRunEvents.js.map +1 -0
  85. package/dist/enterprise/ai/conversations/methods/updateConversation.d.ts +15 -0
  86. package/dist/enterprise/ai/conversations/methods/updateConversation.js +35 -0
  87. package/dist/enterprise/ai/conversations/methods/updateConversation.js.map +1 -0
  88. package/dist/enterprise/ai/conversations/reduceChatEvents.d.ts +17 -0
  89. package/dist/enterprise/ai/conversations/reduceChatEvents.js +74 -0
  90. package/dist/enterprise/ai/conversations/reduceChatEvents.js.map +1 -0
  91. package/dist/enterprise/ai/index.d.ts +5 -1
  92. package/dist/enterprise/ai/index.js +4 -1
  93. package/dist/enterprise/ai/index.js.map +1 -1
  94. package/dist/enterprise/ai/modelProvider/ModelProvider.d.ts +15 -1
  95. package/dist/enterprise/ai/modelProvider/ModelProvider.js +12 -1
  96. package/dist/enterprise/ai/modelProvider/ModelProvider.js.map +1 -1
  97. package/dist/enterprise/ai/modelProvider/modelProviderCodec.d.ts +40 -0
  98. package/dist/enterprise/ai/modelProvider/modelProviderCodec.js +10 -1
  99. package/dist/enterprise/ai/modelProvider/modelProviderCodec.js.map +1 -1
  100. package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.d.ts +21 -0
  101. package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.js +17 -0
  102. package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.js.map +1 -1
  103. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.d.ts +1 -0
  104. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.js +1 -0
  105. package/dist/oss/catalog/CatalogReferences/DatasetCatalogReference.js.map +1 -1
  106. package/dist-iife/cloud.js +21620 -6202
  107. package/dist-iife/community.js +14 -0
  108. package/dist-iife/enterprise.js +19404 -4038
  109. package/package.json +5 -2
  110. package/dist/enterprise/ai/chat/ChatSessionClient.d.ts +0 -18
  111. package/dist/enterprise/ai/chat/ChatSessionClient.js +0 -55
  112. package/dist/enterprise/ai/chat/ChatSessionClient.js.map +0 -1
  113. package/dist/enterprise/ai/chat/UserChatMessageContent.d.ts +0 -19
  114. package/dist/enterprise/ai/chat/UserChatMessageContent.js +0 -44
  115. package/dist/enterprise/ai/chat/UserChatMessageContent.js.map +0 -1
@@ -22,10 +22,11 @@ import { DremioModelProvider } from "./DremioModelProvider.js";
22
22
  import { safeParseResultToResult } from "../../common/safeParseResultToResult.js";
23
23
  import { listAvailableModels } from "../../enterprise/ai/AIResource.js";
24
24
  import { createSendChatMessage } from "../../enterprise/ai/chat/methods/sendChatMessage.js";
25
- import { catchError, concatMap, endWith, map, of, scan, share, startWith, } from "rxjs";
26
- import { AgentEndTurn } from "../../enterprise/ai/chat/eventWrappers/AgentEndTurn.js";
27
- import { AgentChatExchange } from "../../enterprise/ai/chat/eventWrappers/AgentChatExchange.js";
28
- import { ChatSessionClient } from "../../enterprise/ai/chat/ChatSessionClient.js";
25
+ import { listConversations } from "../../enterprise/ai/conversations/methods/listConversations.js";
26
+ import { createConversation, } from "../../enterprise/ai/conversations/methods/createConversation.js";
27
+ import { retrieveConversation } from "../../enterprise/ai/conversations/methods/retrieveConversation.js";
28
+ import { retrieveConversationHistory } from "../../enterprise/ai/conversations/methods/retrieveConversationHistory.js";
29
+ import { createConversationMachine } from "../../enterprise/ai/conversations/createConversationMachine.js";
29
30
  export class AIResource {
30
31
  #config;
31
32
  constructor(config) {
@@ -46,6 +47,39 @@ export class AIResource {
46
47
  .map((res) => res.json())
47
48
  .andThen((entity) => safeDecodeModelProvider(this.#config, entity));
48
49
  }
50
+ get conversationMachine() {
51
+ return createConversationMachine(this.#config);
52
+ }
53
+ createConversation(body) {
54
+ return createConversation(this.#config)(body);
55
+ }
56
+ listConversations() {
57
+ const getPage = listConversations(this.#config);
58
+ return {
59
+ async *data({ signal } = {}) {
60
+ yield* (await getPage({ maxResults: 100 }, { signal }).map((response) => response.data).promise).unwrap();
61
+ },
62
+ getPage,
63
+ };
64
+ }
65
+ retrieveConversation(id, { signal } = {}) {
66
+ return retrieveConversation(this.#config)(id, { signal });
67
+ }
68
+ retrieveConversationHistory(id) {
69
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
70
+ const getPage = (params, { signal } = {}) => retrieveConversationHistory(this.#config)(id, { signal });
71
+ return {
72
+ async *data() {
73
+ const history = await getPage({}).then((result) => {
74
+ if (result.isErr()) {
75
+ throw result.error;
76
+ }
77
+ return result.value;
78
+ });
79
+ yield* history.data;
80
+ },
81
+ };
82
+ }
49
83
  listModelProviders() {
50
84
  const getPage = ({ signal } = {}) => {
51
85
  return this.#config
@@ -88,23 +122,11 @@ export class AIResource {
88
122
  /**
89
123
  * Sends a chat message to the Dremio AI Agent and returns an Observable containing
90
124
  * Agent replies.
125
+ *
126
+ * @deprecated
91
127
  */
92
128
  sendChatMessage(chatSession, userChatMessage) {
93
129
  return createSendChatMessage(this.#config)(chatSession, userChatMessage);
94
130
  }
95
- /**
96
- * Creates an Observable that emits each time the `AgentChatExchange` is updated
97
- * with events from the Agent.
98
- */
99
- createAgentChatExchange$(chatSession, userChatMessage, options = {}) {
100
- const initialAgentChatExchange = new AgentChatExchange(userChatMessage, []);
101
- return this.sendChatMessage(chatSession, userChatMessage).pipe(map((eventResult) => eventResult.unwrap()), concatMap((agentChatEvent) => options.mapChatEvents?.(agentChatEvent) || of(agentChatEvent)), endWith(new AgentEndTurn({ type: "reply_finished" })), catchError((error) => of(new AgentEndTurn({ error, type: "error" }))), scan((agentChatExchange, agentChatEvent) => agentChatExchange._addChatEvent(agentChatEvent), initialAgentChatExchange), startWith(initialAgentChatExchange), share());
102
- }
103
- createChatSessionClient(chatSession) {
104
- return new ChatSessionClient({
105
- chatSession,
106
- createAgentChatExchange$: this.createAgentChatExchange$.bind(this),
107
- });
108
- }
109
131
  }
110
132
  //# sourceMappingURL=AIResource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AIResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AIResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG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C,CAAC,EAC5F,OAAO,CAAC,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,EACrD,UAAU,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAC9E,IAAI,CACF,CAAC,iBAAiB,EAAE,cAAc,EAAE,EAAE,CAAC,iBAAiB,CAAC,aAAa,CAAC,cAAc,CAAC,EACtF,wBAAwB,CACzB,EACD,SAAS,CAAC,wBAAwB,CAAC,EACnC,KAAK,EAAE,CACR,CAAC;IACJ,CAAC;IAED,uBAAuB,CAAC,WAAwB;QAC9C,OAAO,IAAI,iBAAiB,CAAC;YAC3B,WAAW;YACX,wBAAwB,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;SACnE,CAAC,CAAC;IACL,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 { ChatSession } from \"../../enterprise/ai/chat/ChatSession.ts\";\nimport type { UserChatMessage } from \"../../enterprise/ai/chat/UserChatMessage.ts\";\nimport type { Logger, SonarV4Config, V4Config } from \"../../common/Config.ts\";\nimport { ModelProvider } from \"../../enterprise/ai/modelProvider/ModelProvider.ts\";\nimport * as z from \"zod/mini\";\nimport {\n dremioProvidedSchema,\n modelProviderCreateCodec,\n modelProviderRetrieveCodec,\n safeDecodeModelProvider,\n type SafeDecodeResultWithoutDremioLLM,\n} from \"./modelProviderCodec.js\";\nimport { modelProviderRetrieveCodec as baseModelProviderRetrieveCodec } from \"../../enterprise/ai/modelProvider/modelProviderCodec.ts\";\nimport { DremioModelProvider } from \"./DremioModelProvider.ts\";\nimport { safeParseResultToResult } from \"../../common/safeParseResultToResult.ts\";\nimport { listAvailableModels } from \"../../enterprise/ai/AIResource.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { createSendChatMessage } from \"../../enterprise/ai/chat/methods/sendChatMessage.ts\";\nimport type {\n AgentChatResponse,\n AgentResponseContent,\n} from \"../../enterprise/ai/chat/eventWrappers/AgentChatResponse.ts\";\nimport {\n catchError,\n concatMap,\n endWith,\n map,\n of,\n scan,\n share,\n startWith,\n type Observable,\n} from \"rxjs\";\nimport { AgentEndTurn } from \"../../enterprise/ai/chat/eventWrappers/AgentEndTurn.ts\";\nimport { AgentChatExchange } from \"../../enterprise/ai/chat/eventWrappers/AgentChatExchange.ts\";\nimport { ChatSessionClient } from \"../../enterprise/ai/chat/ChatSessionClient.ts\";\n\nexport class AIResource {\n #config: Logger & V4Config & SonarV4Config;\n\n constructor(config: Logger & V4Config & SonarV4Config) {\n this.#config = config;\n }\n\n createModelProvider(properties: z.output<typeof modelProviderCreateCodec>) {\n const body = z.encode(modelProviderCreateCodec, properties);\n return this.#config\n .v4Request(`model-provider/config`, {\n body: JSON.stringify(body),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.json() as Promise<z.input<typeof modelProviderRetrieveCodec>>)\n .andThen(\n (entity) =>\n safeDecodeModelProvider(this.#config, entity) as SafeDecodeResultWithoutDremioLLM,\n );\n }\n\n listModelProviders() {\n const getPage = ({ signal }: SignalParam = {}) => {\n return this.#config\n .v4Request(\"model-provider/config\", {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map(\n (res) => res.json() as Promise<{ configs: z.input<typeof modelProviderRetrieveCodec>[] }>,\n )\n .map((response) => ({\n data: response.configs.map((entity) =>\n safeParseResultToResult(z.safeDecode(modelProviderRetrieveCodec, entity)).map(\n (properties) => {\n if (\"dremioProvided\" in properties.config) {\n return new DremioModelProvider(\n this.#config,\n properties as z.infer<typeof dremioProvidedSchema>,\n );\n }\n return new ModelProvider(\n this.#config,\n properties as z.output<typeof baseModelProviderRetrieveCodec>,\n );\n },\n ),\n ),\n }));\n };\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await getPage({ signal }).promise).map((response) => response.data).unwrap();\n },\n getPage,\n };\n }\n\n listAvailableModels(...args: Parameters<ReturnType<typeof listAvailableModels>>) {\n return listAvailableModels(this.#config)(...args);\n }\n\n retrieveModelProvider(id: string) {\n return this.#config\n .v4Request(`model-provider/config/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n })\n .map((res) => res.json() as Promise<z.input<typeof modelProviderRetrieveCodec>>)\n .andThen((entity) => safeDecodeModelProvider(this.#config, entity));\n }\n\n /**\n * Sends a chat message to the Dremio AI Agent and returns an Observable containing\n * Agent replies.\n */\n sendChatMessage(chatSession: ChatSession, userChatMessage: UserChatMessage) {\n return createSendChatMessage(this.#config)(chatSession, userChatMessage);\n }\n\n /**\n * Creates an Observable that emits each time the `AgentChatExchange` is updated\n * with events from the Agent.\n */\n createAgentChatExchange$<T extends AgentResponseContent>(\n chatSession: ChatSession,\n userChatMessage: UserChatMessage,\n options: {\n mapChatEvents?: (\n v: AgentChatResponse<AgentResponseContent>,\n ) => Observable<AgentChatResponse<T>>;\n } = {},\n ) {\n const initialAgentChatExchange = new AgentChatExchange(userChatMessage, []);\n\n return this.sendChatMessage(chatSession, userChatMessage).pipe(\n map((eventResult) => eventResult.unwrap()),\n concatMap((agentChatEvent) => options.mapChatEvents?.(agentChatEvent) || of(agentChatEvent)),\n endWith(new AgentEndTurn({ type: \"reply_finished\" })),\n catchError((error: unknown) => of(new AgentEndTurn({ error, type: \"error\" }))),\n scan(\n (agentChatExchange, agentChatEvent) => agentChatExchange._addChatEvent(agentChatEvent),\n initialAgentChatExchange,\n ),\n startWith(initialAgentChatExchange),\n share(),\n );\n }\n\n createChatSessionClient(chatSession: ChatSession) {\n return new ChatSessionClient({\n chatSession,\n createAgentChatExchange$: this.createAgentChatExchange$.bind(this),\n });\n }\n}\n"]}
1
+ {"version":3,"file":"AIResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AIResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AACnF,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,GAExB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,0BAA0B,IAAI,8BAA8B,EAAE,MAAM,yDAAyD,CAAC;AACvI,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AACnG,OAAO,EACL,kBAAkB,GAEnB,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mEAAmE,CAAC;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,0EAA0E,CAAC;AAGvH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAE3G,MAAM,OAAO,UAAU;IACrB,OAAO,CAAoC;IAE3C,YAAY,MAAyC;QACnD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,mBAAmB,CAAC,UAAqD;QACvE,MAAM,IAAI,GAAG,C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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 { ChatSession } from \"../../enterprise/ai/chat/ChatSession.ts\";\nimport type { UserChatMessage } from \"../../enterprise/ai/chat/UserChatMessage.ts\";\nimport type { Logger, SonarV4Config, V4Config } from \"../../common/Config.ts\";\nimport { ModelProvider } from \"../../enterprise/ai/modelProvider/ModelProvider.ts\";\nimport * as z from \"zod/mini\";\nimport {\n dremioProvidedSchema,\n modelProviderCreateCodec,\n modelProviderRetrieveCodec,\n safeDecodeModelProvider,\n type SafeDecodeResultWithoutDremioLLM,\n} from \"./modelProviderCodec.js\";\nimport { modelProviderRetrieveCodec as baseModelProviderRetrieveCodec } from \"../../enterprise/ai/modelProvider/modelProviderCodec.ts\";\nimport { DremioModelProvider } from \"./DremioModelProvider.ts\";\nimport { safeParseResultToResult } from \"../../common/safeParseResultToResult.ts\";\nimport { listAvailableModels } from \"../../enterprise/ai/AIResource.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { createSendChatMessage } from \"../../enterprise/ai/chat/methods/sendChatMessage.ts\";\nimport { listConversations } from \"../../enterprise/ai/conversations/methods/listConversations.ts\";\nimport {\n createConversation,\n type createConversationCodec,\n} from \"../../enterprise/ai/conversations/methods/createConversation.ts\";\nimport { retrieveConversation } from \"../../enterprise/ai/conversations/methods/retrieveConversation.ts\";\nimport { retrieveConversationHistory } from \"../../enterprise/ai/conversations/methods/retrieveConversationHistory.ts\";\nimport type { ChatEvent } from \"../../enterprise/ai/chat/chatEventSchema.ts\";\nimport type { HttpError } from \"../../common/HttpError.ts\";\nimport { createConversationMachine } from \"../../enterprise/ai/conversations/createConversationMachine.ts\";\n\nexport class AIResource {\n #config: Logger & V4Config & SonarV4Config;\n\n constructor(config: Logger & V4Config & SonarV4Config) {\n this.#config = config;\n }\n\n createModelProvider(properties: z.output<typeof modelProviderCreateCodec>) {\n const body = z.encode(modelProviderCreateCodec, properties);\n return this.#config\n .v4Request(`model-provider/config`, {\n body: JSON.stringify(body),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.json() as Promise<z.input<typeof modelProviderRetrieveCodec>>)\n .andThen(\n (entity) =>\n safeDecodeModelProvider(this.#config, entity) as SafeDecodeResultWithoutDremioLLM,\n );\n }\n\n get conversationMachine() {\n return createConversationMachine(this.#config);\n }\n\n createConversation(body: z.input<typeof createConversationCodec>) {\n return createConversation(this.#config)(body);\n }\n\n listConversations() {\n const getPage = listConversations(this.#config);\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (\n await getPage({ maxResults: 100 }, { signal }).map((response) => response.data).promise\n ).unwrap();\n },\n getPage,\n };\n }\n\n retrieveConversation(id: string, { signal }: SignalParam = {}) {\n return retrieveConversation(this.#config)(id, { signal });\n }\n\n retrieveConversationHistory(id: string) {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n const getPage = (params: {}, { signal }: SignalParam = {}) =>\n retrieveConversationHistory(this.#config)(id, { signal });\n return {\n async *data(): AsyncGenerator<ChatEvent, void, HttpError> {\n const history = await getPage({}).then((result) => {\n if (result.isErr()) {\n throw result.error;\n }\n return result.value;\n });\n yield* history.data;\n },\n };\n }\n\n listModelProviders() {\n const getPage = ({ signal }: SignalParam = {}) => {\n return this.#config\n .v4Request(\"model-provider/config\", {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map(\n (res) => res.json() as Promise<{ configs: z.input<typeof modelProviderRetrieveCodec>[] }>,\n )\n .map((response) => ({\n data: response.configs.map((entity) =>\n safeParseResultToResult(z.safeDecode(modelProviderRetrieveCodec, entity)).map(\n (properties) => {\n if (\"dremioProvided\" in properties.config) {\n return new DremioModelProvider(\n this.#config,\n properties as z.infer<typeof dremioProvidedSchema>,\n );\n }\n return new ModelProvider(\n this.#config,\n properties as z.output<typeof baseModelProviderRetrieveCodec>,\n );\n },\n ),\n ),\n }));\n };\n return {\n async *data({ signal }: SignalParam = {}) {\n yield* (await getPage({ signal }).promise).map((response) => response.data).unwrap();\n },\n getPage,\n };\n }\n\n listAvailableModels(...args: Parameters<ReturnType<typeof listAvailableModels>>) {\n return listAvailableModels(this.#config)(...args);\n }\n\n retrieveModelProvider(id: string) {\n return this.#config\n .v4Request(`model-provider/config/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n })\n .map((res) => res.json() as Promise<z.input<typeof modelProviderRetrieveCodec>>)\n .andThen((entity) => safeDecodeModelProvider(this.#config, entity));\n }\n\n /**\n * Sends a chat message to the Dremio AI Agent and returns an Observable containing\n * Agent replies.\n *\n * @deprecated\n */\n sendChatMessage(chatSession: ChatSession, userChatMessage: UserChatMessage) {\n return createSendChatMessage(this.#config)(chatSession, userChatMessage);\n }\n}\n"]}
@@ -7,7 +7,7 @@ export declare class DremioModelProvider implements DremioModelProviderPropertie
7
7
  readonly id: DremioProviderConstructorProperties["id"];
8
8
  readonly isDefault: DremioProviderConstructorProperties["isDefault"];
9
9
  constructor(config: V4Config, properties: DremioProviderConstructorProperties);
10
- setDefault(): import("ts-results-es").AsyncResult<DremioModelProvider, import("../index.ts").HttpError>;
10
+ setDefault(): import("ts-results-es").AsyncResult<void, import("../index.ts").HttpError>;
11
11
  }
12
12
  type DremioModelProviderProperties = Pick<z.infer<typeof dremioProvidedSchema>, "id" | "isDefault">;
13
13
  export {};
@@ -18,8 +18,11 @@ import { dremioProvidedSchema } from "./modelProviderCodec.js";
18
18
  export class DremioModelProvider {
19
19
  id;
20
20
  isDefault;
21
+ // eslint-disable-next-line no-unused-private-class-members
21
22
  #defaultModelName;
23
+ // eslint-disable-next-line no-unused-private-class-members
22
24
  #sqlModelNames;
25
+ // eslint-disable-next-line no-unused-private-class-members
23
26
  #tag;
24
27
  #config;
25
28
  constructor(config, properties) {
@@ -32,27 +35,17 @@ export class DremioModelProvider {
32
35
  }
33
36
  setDefault() {
34
37
  return this.#config
35
- .v4Request(`model-provider/config/${this.id}`, {
38
+ .v4Request(`model-provider:setDefault`, {
36
39
  body: JSON.stringify({
37
- config: {
38
- dremioProvided: {},
39
- },
40
- defaultModelName: this.#defaultModelName,
41
40
  id: this.id,
42
- isDefault: true,
43
- name: "Dremio",
44
- sqlModelNames: this.#sqlModelNames,
45
- tag: this.#tag,
46
41
  }),
47
42
  headers: {
48
- Accept: "application/json",
49
43
  "Content-Type": "application/json",
50
44
  },
51
45
  keepalive: true,
52
- method: "PUT",
46
+ method: "POST",
53
47
  })
54
- .map((res) => res.json())
55
- .map((entity) => new DremioModelProvider(this.#config, z.parse(dremioProvidedSchema, entity)));
48
+ .map(() => undefined);
56
49
  }
57
50
  }
58
51
  //# sourceMappingURL=DremioModelProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DremioModelProvider.js","sourceRoot":"","sources":["../../../src/cloud/ai/DremioModelProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,MAAM,OAAO,mBAAmB;IACrB,EAAE,CAA4C;IAC9C,SAAS,CAAmD;IAC5D,iBAAiB,CAA0D;IAC3E,cAAc,CAAuD;IACrE,IAAI,CAA6C;IAE1D,OAAO,CAAW;IAElB,YAAY,MAAgB,EAAE,UAA+C;QAC3E,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACrD,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QAEtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC;IAC7B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,yBAAyB,IAAI,CAAC,EAAE,EAAE,EAAE;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,MAAM,EAAE;oBACN,cAAc,EAAE,EAAE;iBACnB;gBACD,gBAAgB,EAAE,IAAI,CAAC,iBAAiB;gBACxC,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,SAAS,EAAE,IAAI;gBACf,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,IAAI,CAAC,cAAc;gBAClC,GAAG,EAAE,IAAI,CAAC,IAAI;aACf,CAAC;YACF,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAmD,CAAC;aACzE,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CACzF,CAAC;IACN,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 * as z from \"zod/mini\";\nimport type { V4Config } from \"../../common/Config.ts\";\nimport { dremioProvidedSchema } from \"./modelProviderCodec.js\";\n\ntype DremioProviderConstructorProperties = z.infer<typeof dremioProvidedSchema>;\nexport class DremioModelProvider implements DremioModelProviderProperties {\n readonly id: DremioProviderConstructorProperties[\"id\"];\n readonly isDefault: DremioProviderConstructorProperties[\"isDefault\"];\n readonly #defaultModelName: DremioProviderConstructorProperties[\"defaultModelName\"];\n readonly #sqlModelNames: DremioProviderConstructorProperties[\"sqlModelNames\"];\n readonly #tag: DremioProviderConstructorProperties[\"tag\"];\n\n #config: V4Config;\n\n constructor(config: V4Config, properties: DremioProviderConstructorProperties) {\n this.#defaultModelName = properties.defaultModelName;\n this.id = properties.id;\n this.isDefault = properties.isDefault;\n\n this.#config = config;\n this.#sqlModelNames = properties.sqlModelNames;\n this.#tag = properties.tag;\n }\n\n setDefault() {\n return this.#config\n .v4Request(`model-provider/config/${this.id}`, {\n body: JSON.stringify({\n config: {\n dremioProvided: {},\n },\n defaultModelName: this.#defaultModelName,\n id: this.id,\n isDefault: true,\n name: \"Dremio\",\n sqlModelNames: this.#sqlModelNames,\n tag: this.#tag,\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.infer<typeof dremioProvidedSchema>>)\n .map(\n (entity) => new DremioModelProvider(this.#config, z.parse(dremioProvidedSchema, entity)),\n );\n }\n}\n\ntype DremioModelProviderProperties = Pick<z.infer<typeof dremioProvidedSchema>, \"id\" | \"isDefault\">;\n"]}
1
+ {"version":3,"file":"DremioModelProvider.js","sourceRoot":"","sources":["../../../src/cloud/ai/DremioModelProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,MAAM,OAAO,mBAAmB;IACrB,EAAE,CAA4C;IAC9C,SAAS,CAAmD;IACrE,2DAA2D;IAClD,iBAAiB,CAA0D;IACpF,2DAA2D;IAClD,cAAc,CAAuD;IAC9E,2DAA2D;IAClD,IAAI,CAA6C;IAE1D,OAAO,CAAW;IAElB,YAAY,MAAgB,EAAE,UAA+C;QAC3E,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACrD,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QAEtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC;IAC7B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,2BAA2B,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;aACZ,CAAC;YACF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,MAAM;SACf,CAAC;aACD,GAAG,CAAC,GAAG,EAAE,CAAC,SAAiB,CAAC,CAAC;IAClC,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 * as z from \"zod/mini\";\nimport type { V4Config } from \"../../common/Config.ts\";\nimport { dremioProvidedSchema } from \"./modelProviderCodec.js\";\n\ntype DremioProviderConstructorProperties = z.infer<typeof dremioProvidedSchema>;\nexport class DremioModelProvider implements DremioModelProviderProperties {\n readonly id: DremioProviderConstructorProperties[\"id\"];\n readonly isDefault: DremioProviderConstructorProperties[\"isDefault\"];\n // eslint-disable-next-line no-unused-private-class-members\n readonly #defaultModelName: DremioProviderConstructorProperties[\"defaultModelName\"];\n // eslint-disable-next-line no-unused-private-class-members\n readonly #sqlModelNames: DremioProviderConstructorProperties[\"sqlModelNames\"];\n // eslint-disable-next-line no-unused-private-class-members\n readonly #tag: DremioProviderConstructorProperties[\"tag\"];\n\n #config: V4Config;\n\n constructor(config: V4Config, properties: DremioProviderConstructorProperties) {\n this.#defaultModelName = properties.defaultModelName;\n this.id = properties.id;\n this.isDefault = properties.isDefault;\n\n this.#config = config;\n this.#sqlModelNames = properties.sqlModelNames;\n this.#tag = properties.tag;\n }\n\n setDefault() {\n return this.#config\n .v4Request(`model-provider:setDefault`, {\n body: JSON.stringify({\n id: this.id,\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map(() => undefined as void);\n }\n}\n\ntype DremioModelProviderProperties = Pick<z.infer<typeof dremioProvidedSchema>, \"id\" | \"isDefault\">;\n"]}
@@ -63,6 +63,12 @@ export declare const modelProviderRetrieveCodec: z.ZodMiniCodec<z.ZodMiniUnion<r
63
63
  EU: "EU";
64
64
  }>;
65
65
  }, z.core.$strip>;
66
+ }, z.core.$strict>, z.ZodMiniObject<{
67
+ openAiCompatibleApi: z.ZodMiniObject<{
68
+ completionsApiUrl: z.ZodMiniString<string>;
69
+ modelParameters: z.ZodMiniOptional<z.ZodMiniString<string>>;
70
+ organizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
71
+ }, z.core.$strip>;
66
72
  }, z.core.$strict>]>;
67
73
  }, z.core.$strip>, z.ZodMiniObject<{
68
74
  config: z.ZodMiniObject<{
@@ -116,6 +122,12 @@ export declare const modelProviderRetrieveCodec: z.ZodMiniCodec<z.ZodMiniUnion<r
116
122
  EU: "EU";
117
123
  }>;
118
124
  }, z.core.$strip>;
125
+ }, z.core.$strict>, z.ZodMiniObject<{
126
+ openAiCompatibleApi: z.ZodMiniObject<{
127
+ completionsApiUrl: z.ZodMiniString<string>;
128
+ modelParameters: z.ZodMiniOptional<z.ZodMiniString<string>>;
129
+ organizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
130
+ }, z.core.$strip>;
119
131
  }, z.core.$strict>]>;
120
132
  defaultModelName: z.ZodMiniString<string>;
121
133
  isDefault: z.ZodMiniBoolean<boolean>;
@@ -16,6 +16,7 @@
16
16
  const prodLikePattern = /^([^.]+)(\.(?:(?:eu\.)?dremio\.cloud|[^.]+\.dremio\.site))$/;
17
17
  const privateLinkPattern = /^([^.]+\.)([^.]+)((\.privatelink\.dremio\.cloud)|(\.privatelink\.([^.]+)\.dremio\.site))$/;
18
18
  const daasEnginePattern = /^(dcs-(?:aws|cloud)-\d+-ns\.)([^.]+)(\.drem\.io)$/;
19
+ const awsInternalPattern = /^([^.]+)(\.([^.]+\.aws\.dremio\.site))$/;
19
20
  /**
20
21
  * @hidden
21
22
  * @internal
@@ -23,6 +24,9 @@ const daasEnginePattern = /^(dcs-(?:aws|cloud)-\d+-ns\.)([^.]+)(\.drem\.io)$/;
23
24
  export function _replaceOriginResource(origin, resource) {
24
25
  const url = new URL(origin);
25
26
  const hostname = url.hostname;
27
+ if (awsInternalPattern.test(hostname)) {
28
+ url.hostname = hostname.replace(awsInternalPattern, `${resource}$2`);
29
+ }
26
30
  if (privateLinkPattern.test(hostname)) {
27
31
  url.hostname = hostname.replace(privateLinkPattern, `$1${resource}$3`);
28
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,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"]}
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;AAC9E,MAAM,kBAAkB,GAAG,yCAAyC,CAAC;AAErE;;;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,GAAG,QAAQ,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,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)$/;\nconst awsInternalPattern = /^([^.]+)(\\.([^.]+\\.aws\\.dremio\\.site))$/;\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 (awsInternalPattern.test(hostname)) {\n url.hostname = hostname.replace(awsInternalPattern, `${resource}$2`);\n }\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"]}
@@ -1 +1,9 @@
1
- export type ConflictResolver<T, C> = (local: T, remote: T, changes: C) => T | null | PromiseLike<T | null>;
1
+ type ConflictResolverReturn<C> = C | null | PromiseLike<C | null>;
2
+ export type ConflictResolver<T, C> = (local: T, remote: T, changes: C) => ConflictResolverReturn<C>;
3
+ declare function force<C>(_local: unknown, _remote: unknown, changes: C): ConflictResolverReturn<C>;
4
+ declare function yieldFn(_local: unknown, _remote: unknown, _changes: unknown): null;
5
+ export declare const ConflictResolutionStrategy: {
6
+ Force: typeof force;
7
+ Yield: typeof yieldFn;
8
+ };
9
+ export {};
@@ -13,5 +13,14 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export {};
16
+ function force(_local, _remote, changes) {
17
+ return changes;
18
+ }
19
+ function yieldFn(_local, _remote, _changes) {
20
+ return null;
21
+ }
22
+ export const ConflictResolutionStrategy = {
23
+ Force: force,
24
+ Yield: yieldFn,
25
+ };
17
26
  //# sourceMappingURL=ConflictResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConflictResolver.js","sourceRoot":"","sources":["../../src/common/ConflictResolver.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\nexport type ConflictResolver<T, C> = (\n local: T,\n remote: T,\n changes: C,\n) => T | null | PromiseLike<T | null>;\n"]}
1
+ {"version":3,"file":"ConflictResolver.js","sourceRoot":"","sources":["../../src/common/ConflictResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,SAAS,KAAK,CAAI,MAAe,EAAE,OAAgB,EAAE,OAAU;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CAAC,MAAe,EAAE,OAAgB,EAAE,QAAiB;IACnE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,OAAO;CACf,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\ntype ConflictResolverReturn<C> = C | null | PromiseLike<C | null>;\n\nexport type ConflictResolver<T, C> = (local: T, remote: T, changes: C) => ConflictResolverReturn<C>;\n\nfunction force<C>(_local: unknown, _remote: unknown, changes: C): ConflictResolverReturn<C> {\n return changes;\n}\n\nfunction yieldFn(_local: unknown, _remote: unknown, _changes: unknown) {\n return null;\n}\n\nexport const ConflictResolutionStrategy = {\n Force: force,\n Yield: yieldFn,\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare function refineRfc9557Schema(val: string): boolean;
@@ -0,0 +1,26 @@
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 { Temporal } from "temporal-polyfill";
17
+ export function refineRfc9557Schema(val) {
18
+ try {
19
+ Temporal.Instant.from(val);
20
+ return true;
21
+ }
22
+ catch {
23
+ return false;
24
+ }
25
+ }
26
+ //# sourceMappingURL=refineRfc9557Schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refineRfc9557Schema.js","sourceRoot":"","sources":["../../src/common/refineRfc9557Schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,IAAI,CAAC;QACH,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,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 } from \"temporal-polyfill\";\n\nexport function refineRfc9557Schema(val: string) {\n try {\n Temporal.Instant.from(val);\n return true;\n } catch {\n return false;\n }\n}\n"]}
@@ -4,3 +4,4 @@ export * from "./CredentialProvider.ts";
4
4
  export * from "./fromTextEventStream.ts";
5
5
  export * from "./Problem.ts";
6
6
  export * from "./Query.ts";
7
+ export * from "./ConflictResolver.ts";
@@ -19,4 +19,5 @@ export * from "./CredentialProvider.js";
19
19
  export * from "./fromTextEventStream.js";
20
20
  export * from "./Problem.js";
21
21
  export * from "./Query.js";
22
+ export * from "./ConflictResolver.js";
22
23
  //# sourceMappingURL=sharedExports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedExports.js","sourceRoot":"","sources":["../../src/common/sharedExports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,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 { HttpError } from \"../common/HttpError.ts\";\nexport { HttpError };\nexport * from \"./CredentialProvider.ts\";\nexport * from \"./fromTextEventStream.ts\";\nexport * from \"./Problem.ts\";\nexport * from \"./Query.ts\";\n"]}
1
+ {"version":3,"file":"sharedExports.js","sourceRoot":"","sources":["../../src/common/sharedExports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,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 { HttpError } from \"../common/HttpError.ts\";\nexport { HttpError };\nexport * from \"./CredentialProvider.ts\";\nexport * from \"./fromTextEventStream.ts\";\nexport * from \"./Problem.ts\";\nexport * from \"./Query.ts\";\nexport * from \"./ConflictResolver.ts\";\n"]}
@@ -10,7 +10,6 @@ import { GrantsResource } from "./grants/GrantsResource.js";
10
10
  import { AIResource } from "./ai/AIResource.js";
11
11
  export declare class Dremio {
12
12
  #private;
13
- readonly ai: AIResource;
14
13
  readonly catalog: EnterpriseCatalogResource;
15
14
  readonly engines: EnginesResource;
16
15
  readonly jobs: JobsResource;
@@ -23,6 +22,7 @@ export declare class Dremio {
23
22
  readonly sql: SqlResource;
24
23
  readonly users: EnterpriseUsersResource;
25
24
  constructor(config: Config);
25
+ ai: (_unused?: string) => AIResource;
26
26
  environment(): import("ts-results-es").AsyncResult<{
27
27
  clusterType: string;
28
28
  buildTime: import("temporal-polyfill").Temporal.Instant;
@@ -25,7 +25,7 @@ import { GrantsResource } from "./grants/GrantsResource.js";
25
25
  import { AIResource } from "./ai/AIResource.js";
26
26
  import { retrieveEnvironment } from "../oss/retrieveEnvironment.js";
27
27
  export class Dremio {
28
- ai;
28
+ #ai;
29
29
  catalog;
30
30
  engines;
31
31
  jobs;
@@ -40,7 +40,7 @@ export class Dremio {
40
40
  #resourceConfig;
41
41
  constructor(config) {
42
42
  this.#resourceConfig = getResourceConfig(config);
43
- this.ai = new AIResource(this.#resourceConfig);
43
+ this.#ai = new AIResource(this.#resourceConfig);
44
44
  this.catalog = new EnterpriseCatalogResource(this.#resourceConfig);
45
45
  this.engines = new EnginesResource(this.#resourceConfig);
46
46
  this.jobs = new JobsResource(this.#resourceConfig);
@@ -50,6 +50,7 @@ export class Dremio {
50
50
  this.sql = new SqlResource(this.#resourceConfig);
51
51
  this.users = new EnterpriseUsersResource(this.#resourceConfig);
52
52
  }
53
+ ai = (_unused) => this.#ai;
53
54
  environment() {
54
55
  return retrieveEnvironment(this.#resourceConfig);
55
56
  }
@@ -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;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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,WAAW;QACT,OAAO,mBAAmB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACnD,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\";\nimport { retrieveEnvironment } from \"../oss/retrieveEnvironment.ts\";\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 environment() {\n return retrieveEnvironment(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;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,OAAO,MAAM;IACR,GAAG,C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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 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\";\nimport { retrieveEnvironment } from \"../oss/retrieveEnvironment.ts\";\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 ai = (_unused?: string) => this.#ai;\n\n environment() {\n return retrieveEnvironment(this.#resourceConfig);\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}