@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.
- package/dist/cloud/Dremio.d.ts +3 -2
- package/dist/cloud/Dremio.js +2 -2
- package/dist/cloud/Dremio.js.map +1 -1
- package/dist/cloud/ai/AIResource.d.ts +125 -0
- package/dist/cloud/ai/AIResource.js +113 -0
- package/dist/cloud/ai/AIResource.js.map +1 -0
- package/dist/cloud/ai/DremioModelProvider.d.ts +12 -0
- package/dist/cloud/ai/DremioModelProvider.js +49 -0
- package/dist/cloud/ai/DremioModelProvider.js.map +1 -0
- package/dist/cloud/ai/index.d.ts +4 -0
- package/dist/cloud/ai/index.js +20 -0
- package/dist/cloud/ai/index.js.map +1 -0
- package/dist/cloud/ai/modelProviderCodec.d.ts +180 -0
- package/dist/cloud/ai/modelProviderCodec.js +54 -0
- package/dist/cloud/ai/modelProviderCodec.js.map +1 -0
- package/dist/cloud/catalog/EnterpriseCatalogResource.d.ts +10 -3
- package/dist/cloud/catalog/EnterpriseCatalogResource.js +38 -0
- package/dist/cloud/catalog/EnterpriseCatalogResource.js.map +1 -1
- package/dist/cloud/catalog/FileUpload.d.ts +117 -0
- package/dist/cloud/catalog/FileUpload.js +103 -0
- package/dist/cloud/catalog/FileUpload.js.map +1 -0
- package/dist/cloud/getResourceConfig.d.ts +1 -0
- package/dist/cloud/getResourceConfig.js +3 -0
- package/dist/cloud/getResourceConfig.js.map +1 -1
- package/dist/cloud/interfaces.d.ts +3 -1
- package/dist/cloud/interfaces.js +3 -1
- package/dist/cloud/interfaces.js.map +1 -1
- package/dist/cloud/organizations/Organization.d.ts +10 -0
- package/dist/cloud/organizations/Organization.js +12 -0
- package/dist/cloud/organizations/Organization.js.map +1 -1
- package/dist/cloud/projects/Project.d.ts +1 -0
- package/dist/cloud/projects/Project.js +2 -0
- package/dist/cloud/projects/Project.js.map +1 -1
- package/dist/cloud/projects/projectPropertiesCodec.d.ts +6 -0
- package/dist/cloud/projects/projectPropertiesCodec.js +1 -0
- package/dist/cloud/projects/projectPropertiesCodec.js.map +1 -1
- package/dist/cloud/replaceOriginResource.js +6 -1
- package/dist/cloud/replaceOriginResource.js.map +1 -1
- package/dist/common/Config.d.ts +14 -0
- package/dist/common/Config.js.map +1 -1
- package/dist/common/createRequest.d.ts +1 -0
- package/dist/common/createRequest.js +1 -1
- package/dist/common/createRequest.js.map +1 -1
- package/dist/common/createXHR.d.ts +2 -0
- package/dist/common/createXHR.js +58 -0
- package/dist/common/createXHR.js.map +1 -0
- package/dist/enterprise/Dremio.d.ts +3 -1
- package/dist/enterprise/Dremio.js +3 -0
- package/dist/enterprise/Dremio.js.map +1 -1
- package/dist/enterprise/ai/AIResource.d.ts +118 -0
- package/dist/enterprise/ai/AIResource.js +123 -0
- package/dist/enterprise/ai/AIResource.js.map +1 -0
- package/dist/enterprise/ai/ModelProvider.d.ts +181 -0
- package/dist/enterprise/ai/ModelProvider.js +87 -0
- package/dist/enterprise/ai/ModelProvider.js.map +1 -0
- package/dist/enterprise/ai/chat/AgentChatPartialResponse.d.ts +42 -0
- package/dist/enterprise/ai/chat/AgentChatPartialResponse.js +65 -0
- package/dist/enterprise/ai/chat/AgentChatPartialResponse.js.map +1 -0
- package/dist/enterprise/ai/chat/AgentChatResponse.d.ts +87 -0
- package/dist/enterprise/ai/chat/AgentChatResponse.js +138 -0
- package/dist/enterprise/ai/chat/AgentChatResponse.js.map +1 -0
- package/dist/enterprise/ai/chat/AgentErrorResponseContent.d.ts +4 -0
- package/dist/enterprise/ai/chat/AgentErrorResponseContent.js +22 -0
- package/dist/enterprise/ai/chat/AgentErrorResponseContent.js.map +1 -0
- package/dist/enterprise/ai/chat/AgentModelResponseContent.d.ts +6 -0
- package/dist/enterprise/ai/chat/AgentModelResponseContent.js +24 -0
- package/dist/enterprise/ai/chat/AgentModelResponseContent.js.map +1 -0
- package/dist/enterprise/ai/chat/AgentToolRequestResponseContent.d.ts +9 -0
- package/dist/enterprise/ai/chat/AgentToolRequestResponseContent.js +35 -0
- package/dist/enterprise/ai/chat/AgentToolRequestResponseContent.js.map +1 -0
- package/dist/enterprise/ai/chat/AgentToolResultResponseContent.d.ts +8 -0
- package/dist/enterprise/ai/chat/AgentToolResultResponseContent.js +31 -0
- package/dist/enterprise/ai/chat/AgentToolResultResponseContent.js.map +1 -0
- package/dist/enterprise/ai/chat/ChatSession.d.ts +32 -0
- package/dist/enterprise/ai/chat/ChatSession.js +77 -0
- package/dist/enterprise/ai/chat/ChatSession.js.map +1 -0
- package/dist/enterprise/ai/chat/UserChatMessage.d.ts +30 -0
- package/dist/enterprise/ai/chat/UserChatMessage.js +68 -0
- package/dist/enterprise/ai/chat/UserChatMessage.js.map +1 -0
- package/dist/enterprise/ai/chat/UserChatMessageContent.d.ts +19 -0
- package/dist/enterprise/ai/chat/UserChatMessageContent.js +44 -0
- package/dist/enterprise/ai/chat/UserChatMessageContent.js.map +1 -0
- package/dist/enterprise/ai/chat/chatEventSchema.d.ts +35 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js +52 -0
- package/dist/enterprise/ai/chat/chatEventSchema.js.map +1 -0
- package/dist/enterprise/ai/chat/index.d.ts +9 -0
- package/dist/enterprise/ai/chat/index.js +25 -0
- package/dist/enterprise/ai/chat/index.js.map +1 -0
- package/dist/enterprise/ai/index.d.ts +3 -0
- package/dist/enterprise/ai/index.js +19 -0
- package/dist/enterprise/ai/index.js.map +1 -0
- package/dist/enterprise/ai/modelProviderCodec.d.ts +465 -0
- package/dist/enterprise/ai/modelProviderCodec.js +154 -0
- package/dist/enterprise/ai/modelProviderCodec.js.map +1 -0
- package/dist/enterprise/ai/modelProviderConfigSchemas.d.ts +296 -0
- package/dist/enterprise/ai/modelProviderConfigSchemas.js +159 -0
- package/dist/enterprise/ai/modelProviderConfigSchemas.js.map +1 -0
- package/dist/enterprise/interfaces.d.ts +1 -0
- package/dist/enterprise/interfaces.js +1 -0
- package/dist/enterprise/interfaces.js.map +1 -1
- package/dist/enterprise/users/EnterpriseUsersResource.d.ts +7 -0
- package/dist/enterprise/users/EnterpriseUsersResource.js +31 -0
- package/dist/enterprise/users/EnterpriseUsersResource.js.map +1 -1
- package/dist/enterprise/users/ServiceUser.d.ts +85 -0
- package/dist/enterprise/users/ServiceUser.js +79 -0
- package/dist/enterprise/users/ServiceUser.js.map +1 -0
- package/dist/enterprise/users/serviceUserOauthCredentialsCodec.d.ts +43 -0
- package/dist/enterprise/users/serviceUserOauthCredentialsCodec.js +110 -0
- package/dist/enterprise/users/serviceUserOauthCredentialsCodec.js.map +1 -0
- package/package.json +1 -1
- package/dist/cloud/ai/AiResource.d.ts +0 -12
- package/dist/cloud/ai/AiResource.js +0 -52
- package/dist/cloud/ai/AiResource.js.map +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
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 * as z from "zod/mini";
|
|
17
|
+
import { modelProviderCreateCodec, modelProviderRetrieveCodec as baseModelProviderRetrieveCodec, modelProviderUpdateCodec, } from "../../enterprise/ai/modelProviderCodec.js";
|
|
18
|
+
import { Err, Ok, Result } from "ts-results-es";
|
|
19
|
+
import { DremioModelProvider } from "./DremioModelProvider.js";
|
|
20
|
+
import { ModelProvider } from "../interfaces.js";
|
|
21
|
+
export { modelProviderCreateCodec, modelProviderUpdateCodec };
|
|
22
|
+
export const dremioProvidedSchema = z.object({
|
|
23
|
+
config: z.strictObject({
|
|
24
|
+
dremioProvided: z.object(),
|
|
25
|
+
}),
|
|
26
|
+
id: z.string(),
|
|
27
|
+
isDefault: z.boolean(),
|
|
28
|
+
name: z.string(),
|
|
29
|
+
});
|
|
30
|
+
export const modelProviderRetrieveCodec = z.codec(z.union([baseModelProviderRetrieveCodec.def.in, dremioProvidedSchema]), z.union([baseModelProviderRetrieveCodec.def.out, dremioProvidedSchema]), {
|
|
31
|
+
decode(v) {
|
|
32
|
+
if ("dremioProvided" in v.config) {
|
|
33
|
+
return v;
|
|
34
|
+
}
|
|
35
|
+
return z.decode(baseModelProviderRetrieveCodec, v);
|
|
36
|
+
},
|
|
37
|
+
encode(v) {
|
|
38
|
+
if ("dremioProvided" in v.config) {
|
|
39
|
+
return v;
|
|
40
|
+
}
|
|
41
|
+
return z.encode(baseModelProviderRetrieveCodec, v);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
export function safeDecodeModelProvider(config, entity) {
|
|
45
|
+
const decodeResult = z.safeDecode(modelProviderRetrieveCodec, entity);
|
|
46
|
+
if (decodeResult.success) {
|
|
47
|
+
if ("dremioProvided" in decodeResult.data.config) {
|
|
48
|
+
return Ok(new DremioModelProvider(config, decodeResult.data));
|
|
49
|
+
}
|
|
50
|
+
return Ok(new ModelProvider(config, decodeResult.data));
|
|
51
|
+
}
|
|
52
|
+
return Err(decodeResult.error);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=modelProviderCodec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelProviderCodec.js","sourceRoot":"","sources":["../../../src/cloud/ai/modelProviderCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,0BAA0B,IAAI,8BAA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CACF,CAAC;AAEF,MAAM,UAAU,uBAAuB,CACrC,MAAgB,EAChB,MAAkD;IAKlD,MAAM,YAAY,GAAG,CAAC,CAAC,UAAU,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;IAEtE,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,gBAAgB,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjD,OAAO,EAAE,CACP,IAAI,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,IAA4C,CAAC,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,CACP,IAAI,aAAa,CACf,MAAM,EACN,YAAY,CAAC,IAAuD,CACrE,CACF,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACjC,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 {\n modelProviderCreateCodec,\n modelProviderRetrieveCodec as baseModelProviderRetrieveCodec,\n modelProviderUpdateCodec,\n} from \"../../enterprise/ai/modelProviderCodec.ts\";\nimport { Err, Ok, Result } from \"ts-results-es\";\nimport { DremioModelProvider } from \"./DremioModelProvider.ts\";\nimport type { V4Config } from \"../../common/Config.ts\";\nimport { ModelProvider } from \"../interfaces.ts\";\n\nexport { modelProviderCreateCodec, modelProviderUpdateCodec };\n\nexport const dremioProvidedSchema = z.object({\n config: z.strictObject({\n dremioProvided: z.object(),\n }),\n id: z.string(),\n isDefault: z.boolean(),\n name: z.string(),\n});\n\nexport const modelProviderRetrieveCodec = z.codec(\n z.union([baseModelProviderRetrieveCodec.def.in, dremioProvidedSchema]),\n z.union([baseModelProviderRetrieveCodec.def.out, dremioProvidedSchema]),\n {\n decode(v) {\n if (\"dremioProvided\" in v.config) {\n return v as z.infer<typeof dremioProvidedSchema>;\n }\n\n return z.decode(\n baseModelProviderRetrieveCodec,\n v as z.input<typeof baseModelProviderRetrieveCodec>,\n );\n },\n encode(v) {\n if (\"dremioProvided\" in v.config) {\n return v as z.infer<typeof dremioProvidedSchema>;\n }\n\n return z.encode(\n baseModelProviderRetrieveCodec,\n v as z.output<typeof baseModelProviderRetrieveCodec>,\n );\n },\n },\n);\n\nexport function safeDecodeModelProvider(\n config: V4Config,\n entity: z.input<typeof modelProviderRetrieveCodec>,\n): Result<\n DremioModelProvider | ModelProvider,\n z.core.util.SafeParseResult<z.output<typeof modelProviderRetrieveCodec>>[\"error\"]\n> {\n const decodeResult = z.safeDecode(modelProviderRetrieveCodec, entity);\n\n if (decodeResult.success) {\n if (\"dremioProvided\" in decodeResult.data.config) {\n return Ok(\n new DremioModelProvider(config, decodeResult.data as z.infer<typeof dremioProvidedSchema>),\n );\n }\n return Ok(\n new ModelProvider(\n config,\n decodeResult.data as z.output<typeof baseModelProviderRetrieveCodec>,\n ),\n );\n }\n\n return Err(decodeResult.error);\n}\n\nexport type SafeDecodeResultWithoutDremioLLM = Result<\n ModelProvider,\n z.core.util.SafeParseResult<z.output<typeof modelProviderRetrieveCodec>>[\"error\"]\n>;\n"]}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AsyncResult } from "ts-results-es";
|
|
2
|
+
import type { SonarV2Config, SonarV3Config, XHRConfig } from "../../common/Config.ts";
|
|
2
3
|
import type { SignalParam } from "../../common/Params.ts";
|
|
3
4
|
import { baseRetrieve, baseRetrieveByPath } from "../../enterprise/catalog/catalogRetrieve.js";
|
|
4
5
|
import type { CatalogSearchParams } from "../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts";
|
|
5
6
|
import type { EnterpriseFunctionCatalogReference, EnterpriseHomeCatalogReference, EnterpriseSourceCatalogReference, EnterpriseSpaceCatalogReference } from "../interfaces.ts";
|
|
7
|
+
import { FileUpload, uploadExtensionSchema } from "./FileUpload.ts";
|
|
8
|
+
import * as z from "zod/mini";
|
|
6
9
|
export declare class EnterpriseCatalogResource {
|
|
7
10
|
#private;
|
|
8
11
|
retrieve: ReturnType<typeof baseRetrieve>;
|
|
9
12
|
retrieveByPath: ReturnType<typeof baseRetrieveByPath>;
|
|
10
|
-
constructor(config: SonarV3Config);
|
|
13
|
+
constructor(config: SonarV2Config & SonarV3Config & XHRConfig);
|
|
11
14
|
list(): {
|
|
12
15
|
data(): AsyncGenerator<EnterpriseFunctionCatalogReference | EnterpriseHomeCatalogReference | EnterpriseSourceCatalogReference | EnterpriseSpaceCatalogReference, void, unknown>;
|
|
13
16
|
};
|
|
17
|
+
upload(fileStream: ReadableStream, extension: z.infer<typeof uploadExtensionSchema>): AsyncResult<FileUpload, import("../index.ts").HttpError>;
|
|
18
|
+
uploadXHR(file: Blob, extension: z.infer<typeof uploadExtensionSchema>, options?: {
|
|
19
|
+
onProgress?: (e: ProgressEvent<XMLHttpRequestEventTarget>) => void;
|
|
20
|
+
}): AsyncResult<FileUpload, unknown>;
|
|
14
21
|
search(params: CatalogSearchParams): {
|
|
15
22
|
data({ signal }?: SignalParam): AsyncGenerator<import("../interfaces.ts").FolderSearchResult | import("../interfaces.ts").ReflectionSearchResult | import("../interfaces.ts").SourceSearchResult | import("../interfaces.ts").SpaceSearchResult | import("../interfaces.ts").TableSearchResult | import("../interfaces.ts").ViewSearchResult | import("../interfaces.ts").FunctionSearchResult | import("../interfaces.ts").ScriptSearchResult | import("../interfaces.ts").JobSearchResult, void, unknown>;
|
|
16
23
|
getPage: ({ pageParam, signal }?: {
|
|
17
24
|
pageParam?: string;
|
|
18
|
-
} & SignalParam) =>
|
|
25
|
+
} & SignalParam) => AsyncResult<{
|
|
19
26
|
data: (import("../interfaces.ts").FolderSearchResult | import("../interfaces.ts").ReflectionSearchResult | import("../interfaces.ts").SourceSearchResult | import("../interfaces.ts").SpaceSearchResult | import("../interfaces.ts").TableSearchResult | import("../interfaces.ts").ViewSearchResult | import("../interfaces.ts").FunctionSearchResult | import("../interfaces.ts").ScriptSearchResult | import("../interfaces.ts").JobSearchResult)[];
|
|
20
27
|
nextPageToken: string | undefined;
|
|
21
28
|
sessionId: string;
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { AsyncResult } from "ts-results-es";
|
|
16
17
|
import { catalogReferenceFromProperties } from "../../enterprise/catalog/catalogReferenceFromProperties.js";
|
|
17
18
|
import { baseRetrieve, baseRetrieveByPath } from "../../enterprise/catalog/catalogRetrieve.js";
|
|
18
19
|
import { createCatalogSearch } from "../../enterprise/catalog/catalogSearch/createCatalogSearch.js";
|
|
19
20
|
import { catalogReferenceEntityToProperties } from "../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.js";
|
|
21
|
+
import { FileUpload, uploadExtensionSchema } from "./FileUpload.js";
|
|
22
|
+
import * as z from "zod/mini";
|
|
20
23
|
export class EnterpriseCatalogResource {
|
|
21
24
|
#config;
|
|
22
25
|
#catalogSearch;
|
|
@@ -40,6 +43,41 @@ export class EnterpriseCatalogResource {
|
|
|
40
43
|
},
|
|
41
44
|
};
|
|
42
45
|
}
|
|
46
|
+
upload(fileStream, extension) {
|
|
47
|
+
return new AsyncResult((async () => {
|
|
48
|
+
const body = new FormData();
|
|
49
|
+
body.set("file", await new Response(fileStream).blob());
|
|
50
|
+
body.set("extension", extension);
|
|
51
|
+
return this.#config
|
|
52
|
+
.sonarV3Request("uploads", {
|
|
53
|
+
body,
|
|
54
|
+
headers: {
|
|
55
|
+
Accept: "text/plain",
|
|
56
|
+
},
|
|
57
|
+
keepalive: true,
|
|
58
|
+
method: "POST",
|
|
59
|
+
})
|
|
60
|
+
.map((res) => res.text())
|
|
61
|
+
.map((id) => new FileUpload(this.#config, id)).promise;
|
|
62
|
+
})());
|
|
63
|
+
}
|
|
64
|
+
uploadXHR(file, extension, options = {}) {
|
|
65
|
+
const body = new FormData();
|
|
66
|
+
body.set("file", file);
|
|
67
|
+
body.set("extension", extension);
|
|
68
|
+
return this.#config
|
|
69
|
+
.xhr("POST", this.#config.sonarV3URL("uploads").toString(), { Accept: "text/plain" }, body, (xhr) => {
|
|
70
|
+
if (typeof options.onProgress === "function") {
|
|
71
|
+
xhr.upload.addEventListener("progress", options.onProgress);
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
.map((xhr) => {
|
|
75
|
+
if (typeof options.onProgress === "function") {
|
|
76
|
+
xhr.upload.removeEventListener("progress", options.onProgress);
|
|
77
|
+
}
|
|
78
|
+
return new FileUpload(this.#config, xhr.responseText);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
43
81
|
search(params) {
|
|
44
82
|
const getPage = ({ pageParam, signal } = {}) => this.#catalogSearch(params, { pageParam, signal });
|
|
45
83
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/cloud/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"EnterpriseCatalogResource.js","sourceRoot":"","sources":["../../../src/cloud/catalog/EnterpriseCatalogResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AACpG,OA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AAE,CAAC;wBAC3B,MAAM,cAAc,CAAC,KAAK,CAAC;oBAC7B,CAAC;oBACD,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC;oBACtC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;oBACrB,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC;gBACzC,CAAC;YACH,CAAC;YACD,OAAO;SACR,CAAC;IACJ,CAAC;IAED,2BAA2B,CAAC,MAAe;QACzC,OAAO,8BAA8B,CACnC,kCAAkC,CAAC,MAAM,CAAC,EAC1C,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,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 { AsyncResult } from \"ts-results-es\";\nimport type { SonarV2Config, SonarV3Config, XHRConfig } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { catalogReferenceFromProperties } from \"../../enterprise/catalog/catalogReferenceFromProperties.ts\";\nimport { baseRetrieve, baseRetrieveByPath } from \"../../enterprise/catalog/catalogRetrieve.js\";\nimport type { CatalogSearchParams } from \"../../enterprise/catalog/catalogSearch/CatalogSearchParams.ts\";\nimport { createCatalogSearch } from \"../../enterprise/catalog/catalogSearch/createCatalogSearch.js\";\nimport { catalogReferenceEntityToProperties } from \"../../oss/catalog/CatalogReferences/utils/catalogReferenceEntityToProperties.ts\";\nimport type {\n EnterpriseFunctionCatalogReference,\n EnterpriseHomeCatalogReference,\n EnterpriseSourceCatalogReference,\n EnterpriseSpaceCatalogReference,\n} from \"../interfaces.ts\";\nimport { FileUpload, uploadExtensionSchema } from \"./FileUpload.ts\";\nimport * as z from \"zod/mini\";\n\nexport class EnterpriseCatalogResource {\n #config: SonarV2Config & SonarV3Config & XHRConfig;\n #catalogSearch: ReturnType<typeof createCatalogSearch>;\n\n retrieve: ReturnType<typeof baseRetrieve>;\n retrieveByPath: ReturnType<typeof baseRetrieveByPath>;\n\n constructor(config: SonarV2Config & SonarV3Config & XHRConfig) {\n this.#config = config;\n this.retrieve = baseRetrieve(config);\n this.retrieveByPath = baseRetrieveByPath(config);\n this.#catalogSearch = createCatalogSearch(\n this.#config,\n this._catalogReferenceFromEntity.bind(this),\n );\n }\n\n list() {\n const getRoot = () =>\n this.#config\n .sonarV3Request(\"catalog\")\n .map((res) => res.json() as Promise<{ data: unknown[] }>)\n .map((response) =>\n response.data.map(\n (entity: unknown) =>\n catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n ) as\n | EnterpriseFunctionCatalogReference\n | EnterpriseHomeCatalogReference\n | EnterpriseSourceCatalogReference\n | EnterpriseSpaceCatalogReference,\n ),\n )\n .promise.then((result) => result.unwrap());\n return {\n async *data() {\n yield* await getRoot();\n },\n };\n }\n\n upload(fileStream: ReadableStream, extension: z.infer<typeof uploadExtensionSchema>) {\n return new AsyncResult(\n (async () => {\n const body = new FormData();\n body.set(\"file\", await new Response(fileStream).blob());\n body.set(\"extension\", extension);\n\n return this.#config\n .sonarV3Request(\"uploads\", {\n body,\n headers: {\n Accept: \"text/plain\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.text())\n .map((id) => new FileUpload(this.#config, id)).promise;\n })(),\n );\n }\n\n uploadXHR(\n file: Blob,\n extension: z.infer<typeof uploadExtensionSchema>,\n options: { onProgress?: (e: ProgressEvent<XMLHttpRequestEventTarget>) => void } = {},\n ) {\n const body = new FormData();\n body.set(\"file\", file);\n body.set(\"extension\", extension);\n return this.#config\n .xhr(\n \"POST\",\n this.#config.sonarV3URL(\"uploads\").toString(),\n { Accept: \"text/plain\" },\n body,\n (xhr) => {\n if (typeof options.onProgress === \"function\") {\n xhr.upload.addEventListener(\"progress\", options.onProgress);\n }\n },\n )\n .map((xhr) => {\n if (typeof options.onProgress === \"function\") {\n xhr.upload.removeEventListener(\"progress\", options.onProgress);\n }\n return new FileUpload(this.#config, xhr.responseText);\n });\n }\n\n search(params: CatalogSearchParams) {\n const getPage = ({ pageParam, signal }: { pageParam?: string } & SignalParam = {}) =>\n this.#catalogSearch(params, { pageParam, signal });\n return {\n async *data({ signal }: SignalParam = {}) {\n const firstPageResult = await getPage({ signal }).promise;\n if (firstPageResult.isErr()) {\n throw firstPageResult.error;\n }\n const firstPage = firstPageResult.value;\n yield* firstPage.data;\n let nextPageToken = firstPage.nextPageToken;\n while (nextPageToken && !signal?.aborted) {\n const nextPageResult = await getPage({ pageParam: nextPageToken, signal }).promise;\n if (nextPageResult.isErr()) {\n throw nextPageResult.error;\n }\n const nextPage = nextPageResult.value;\n yield* nextPage.data;\n nextPageToken = nextPage.nextPageToken;\n }\n },\n getPage,\n };\n }\n\n _catalogReferenceFromEntity(entity: unknown) {\n return catalogReferenceFromProperties(\n catalogReferenceEntityToProperties(entity),\n this.#config,\n this.retrieveByPath,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
import type { SonarV3Config } from "../../common/Config.ts";
|
|
3
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
4
|
+
export declare const uploadExtensionSchema: z.ZodMiniEnum<{
|
|
5
|
+
csv: "csv";
|
|
6
|
+
json: "json";
|
|
7
|
+
parquet: "parquet";
|
|
8
|
+
}>;
|
|
9
|
+
declare const previewBodySchema: z.ZodMiniObject<{
|
|
10
|
+
fileFormat: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
11
|
+
comment: z.ZodMiniString<string>;
|
|
12
|
+
emptyAsNull: z.ZodMiniBoolean<boolean>;
|
|
13
|
+
escape: z.ZodMiniString<string>;
|
|
14
|
+
extractHeader: z.ZodMiniBoolean<boolean>;
|
|
15
|
+
fieldDelimiter: z.ZodMiniString<string>;
|
|
16
|
+
lineDelimiter: z.ZodMiniString<string>;
|
|
17
|
+
nullIf: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
18
|
+
quote: z.ZodMiniString<string>;
|
|
19
|
+
skipLines: z.ZodMiniNumber<number>;
|
|
20
|
+
trimSpace: z.ZodMiniBoolean<boolean>;
|
|
21
|
+
type: z.ZodMiniLiteral<"CSV">;
|
|
22
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
23
|
+
emptyAsNull: z.ZodMiniBoolean<boolean>;
|
|
24
|
+
nullIf: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
25
|
+
type: z.ZodMiniLiteral<"JSON">;
|
|
26
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
27
|
+
type: z.ZodMiniLiteral<"Parquet">;
|
|
28
|
+
}, z.core.$strict>], "type">;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export declare const fieldSchema: z.ZodMiniObject<{
|
|
31
|
+
metadata: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
32
|
+
name: z.ZodMiniString<string>;
|
|
33
|
+
nullable: z.ZodMiniBoolean<boolean>;
|
|
34
|
+
type: z.ZodMiniString<string>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
declare const fieldSchemaWithChildren: z.ZodMiniObject<{
|
|
37
|
+
metadata: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
38
|
+
name: z.ZodMiniString<string>;
|
|
39
|
+
nullable: z.ZodMiniBoolean<boolean>;
|
|
40
|
+
type: z.ZodMiniString<string>;
|
|
41
|
+
children: z.ZodMiniOptional<z.ZodMiniLazy<z.ZodMiniArray<z.ZodMiniObject<{
|
|
42
|
+
metadata: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
43
|
+
name: z.ZodMiniString<string>;
|
|
44
|
+
nullable: z.ZodMiniBoolean<boolean>;
|
|
45
|
+
type: z.ZodMiniString<string>;
|
|
46
|
+
}, z.core.$strip>>>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
declare const ingestBodySchema: z.ZodMiniObject<{
|
|
49
|
+
extension: z.ZodMiniEnum<{
|
|
50
|
+
csv: "csv";
|
|
51
|
+
json: "json";
|
|
52
|
+
parquet: "parquet";
|
|
53
|
+
}>;
|
|
54
|
+
fileFormat: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
55
|
+
comment: z.ZodMiniString<string>;
|
|
56
|
+
emptyAsNull: z.ZodMiniBoolean<boolean>;
|
|
57
|
+
escape: z.ZodMiniString<string>;
|
|
58
|
+
extractHeader: z.ZodMiniBoolean<boolean>;
|
|
59
|
+
fieldDelimiter: z.ZodMiniString<string>;
|
|
60
|
+
lineDelimiter: z.ZodMiniString<string>;
|
|
61
|
+
nullIf: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
62
|
+
quote: z.ZodMiniString<string>;
|
|
63
|
+
skipLines: z.ZodMiniNumber<number>;
|
|
64
|
+
trimSpace: z.ZodMiniBoolean<boolean>;
|
|
65
|
+
type: z.ZodMiniLiteral<"CSV">;
|
|
66
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
67
|
+
emptyAsNull: z.ZodMiniBoolean<boolean>;
|
|
68
|
+
nullIf: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
69
|
+
type: z.ZodMiniLiteral<"JSON">;
|
|
70
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
71
|
+
type: z.ZodMiniLiteral<"Parquet">;
|
|
72
|
+
}, z.core.$strict>], "type">;
|
|
73
|
+
namespace: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
74
|
+
schemaFields: z.ZodMiniArray<z.ZodMiniObject<{
|
|
75
|
+
metadata: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
76
|
+
name: z.ZodMiniString<string>;
|
|
77
|
+
nullable: z.ZodMiniBoolean<boolean>;
|
|
78
|
+
type: z.ZodMiniString<string>;
|
|
79
|
+
children: z.ZodMiniOptional<z.ZodMiniLazy<z.ZodMiniArray<z.ZodMiniObject<{
|
|
80
|
+
metadata: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
81
|
+
name: z.ZodMiniString<string>;
|
|
82
|
+
nullable: z.ZodMiniBoolean<boolean>;
|
|
83
|
+
type: z.ZodMiniString<string>;
|
|
84
|
+
}, z.core.$strip>>>>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
tableName: z.ZodMiniString<string>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
export declare class FileUpload {
|
|
89
|
+
#private;
|
|
90
|
+
readonly id: string;
|
|
91
|
+
constructor(config: SonarV3Config, id: string);
|
|
92
|
+
preview(configuration: z.infer<typeof previewBodySchema>, { signal }?: SignalParam): import("ts-results-es").AsyncResult<{
|
|
93
|
+
rows: [unknown][];
|
|
94
|
+
schema: z.infer<typeof fieldSchemaWithChildren>[];
|
|
95
|
+
}, import("../index.ts").HttpError>;
|
|
96
|
+
ingest(configuration: z.infer<typeof ingestBodySchema>): import("ts-results-es").AsyncResult<string, import("../index.ts").HttpError>;
|
|
97
|
+
static fileFormatSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
98
|
+
comment: z.ZodMiniString<string>;
|
|
99
|
+
emptyAsNull: z.ZodMiniBoolean<boolean>;
|
|
100
|
+
escape: z.ZodMiniString<string>;
|
|
101
|
+
extractHeader: z.ZodMiniBoolean<boolean>;
|
|
102
|
+
fieldDelimiter: z.ZodMiniString<string>;
|
|
103
|
+
lineDelimiter: z.ZodMiniString<string>;
|
|
104
|
+
nullIf: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
105
|
+
quote: z.ZodMiniString<string>;
|
|
106
|
+
skipLines: z.ZodMiniNumber<number>;
|
|
107
|
+
trimSpace: z.ZodMiniBoolean<boolean>;
|
|
108
|
+
type: z.ZodMiniLiteral<"CSV">;
|
|
109
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
110
|
+
emptyAsNull: z.ZodMiniBoolean<boolean>;
|
|
111
|
+
nullIf: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
112
|
+
type: z.ZodMiniLiteral<"JSON">;
|
|
113
|
+
}, z.core.$strict>, z.ZodMiniObject<{
|
|
114
|
+
type: z.ZodMiniLiteral<"Parquet">;
|
|
115
|
+
}, z.core.$strict>], "type">;
|
|
116
|
+
}
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
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 * as z from "zod/mini";
|
|
17
|
+
import { catalogPathToString } from "../../oss/catalog/CatalogReferences/utils/catalogPathToString.js";
|
|
18
|
+
export const uploadExtensionSchema = z.enum(["csv", "json", "parquet"]);
|
|
19
|
+
const csvFileFormatSchema = z.strictObject({
|
|
20
|
+
comment: z.string().check(z.minLength(1)),
|
|
21
|
+
emptyAsNull: z.boolean(),
|
|
22
|
+
escape: z.string().check(z.minLength(1)),
|
|
23
|
+
extractHeader: z.boolean(),
|
|
24
|
+
fieldDelimiter: z.string().check(z.minLength(1)),
|
|
25
|
+
lineDelimiter: z.string().check(z.minLength(1)),
|
|
26
|
+
nullIf: z.optional(z.array(z.string())),
|
|
27
|
+
quote: z.string().check(z.minLength(1)),
|
|
28
|
+
skipLines: z.number().check(z.int(), z.gte(0)),
|
|
29
|
+
trimSpace: z.boolean(),
|
|
30
|
+
type: z.literal("CSV"),
|
|
31
|
+
});
|
|
32
|
+
const jsonFileFormatSchema = z.strictObject({
|
|
33
|
+
emptyAsNull: z.boolean(),
|
|
34
|
+
nullIf: z.optional(z.array(z.string())),
|
|
35
|
+
type: z.literal("JSON"),
|
|
36
|
+
});
|
|
37
|
+
const parquetFileFormatSchema = z.strictObject({
|
|
38
|
+
type: z.literal("Parquet"),
|
|
39
|
+
});
|
|
40
|
+
const fileFormatSchema = z.discriminatedUnion("type", [
|
|
41
|
+
csvFileFormatSchema,
|
|
42
|
+
jsonFileFormatSchema,
|
|
43
|
+
parquetFileFormatSchema,
|
|
44
|
+
]);
|
|
45
|
+
const previewBodySchema = z.strictObject({
|
|
46
|
+
fileFormat: fileFormatSchema,
|
|
47
|
+
});
|
|
48
|
+
export const fieldSchema = z.object({
|
|
49
|
+
metadata: z.optional(z.record(z.string(), z.string())),
|
|
50
|
+
name: z.string(),
|
|
51
|
+
nullable: z.boolean(),
|
|
52
|
+
type: z.string(),
|
|
53
|
+
});
|
|
54
|
+
const fieldSchemaWithChildren = z.extend(fieldSchema, {
|
|
55
|
+
children: z.optional(z.lazy(() => z.array(fieldSchema))),
|
|
56
|
+
});
|
|
57
|
+
const ingestBodySchema = z.strictObject({
|
|
58
|
+
extension: z.enum(["csv", "json", "parquet"]),
|
|
59
|
+
fileFormat: fileFormatSchema,
|
|
60
|
+
namespace: z.array(z.string()),
|
|
61
|
+
schemaFields: z.array(fieldSchemaWithChildren),
|
|
62
|
+
tableName: z.string(),
|
|
63
|
+
});
|
|
64
|
+
export class FileUpload {
|
|
65
|
+
#config;
|
|
66
|
+
id;
|
|
67
|
+
constructor(config, id) {
|
|
68
|
+
this.#config = config;
|
|
69
|
+
this.id = id;
|
|
70
|
+
}
|
|
71
|
+
preview(configuration, { signal } = {}) {
|
|
72
|
+
return this.#config
|
|
73
|
+
.sonarV3Request(`uploads/${this.id}/preview`, {
|
|
74
|
+
body: JSON.stringify(z.parse(previewBodySchema, configuration)),
|
|
75
|
+
headers: {
|
|
76
|
+
Accept: "application/json",
|
|
77
|
+
"Content-Type": "application/json",
|
|
78
|
+
},
|
|
79
|
+
method: "POST",
|
|
80
|
+
signal,
|
|
81
|
+
})
|
|
82
|
+
.map((res) => res.json());
|
|
83
|
+
}
|
|
84
|
+
ingest(configuration) {
|
|
85
|
+
const parsedBody = z.parse(ingestBodySchema, configuration);
|
|
86
|
+
return this.#config
|
|
87
|
+
.sonarV3Request(`uploads/${this.id}/ingest`, {
|
|
88
|
+
body: JSON.stringify({
|
|
89
|
+
...parsedBody,
|
|
90
|
+
namespace: catalogPathToString(parsedBody.namespace),
|
|
91
|
+
}),
|
|
92
|
+
headers: {
|
|
93
|
+
Accept: "text/plain",
|
|
94
|
+
"Content-Type": "application/json",
|
|
95
|
+
},
|
|
96
|
+
keepalive: true,
|
|
97
|
+
method: "POST",
|
|
98
|
+
})
|
|
99
|
+
.map((res) => res.text());
|
|
100
|
+
}
|
|
101
|
+
static fileFormatSchema = fileFormatSchema;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=FileUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUpload.js","sourceRoot":"","sources":["../../../src/cloud/catalog/FileUpload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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AC,SAAS,CAAC;aACrD,CAAC;YACF,OAAO,EAAE;gBACP,MAAM,EAAE,YAAY;gBACpB,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,MAAM;SACf,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,gBAAgB,GAAG,gBAAgB,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 type { SonarV3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { catalogPathToString } from \"../../oss/catalog/CatalogReferences/utils/catalogPathToString.ts\";\n\nexport const uploadExtensionSchema = z.enum([\"csv\", \"json\", \"parquet\"]);\n\nconst csvFileFormatSchema = z.strictObject({\n comment: z.string().check(z.minLength(1)),\n emptyAsNull: z.boolean(),\n escape: z.string().check(z.minLength(1)),\n extractHeader: z.boolean(),\n fieldDelimiter: z.string().check(z.minLength(1)),\n lineDelimiter: z.string().check(z.minLength(1)),\n nullIf: z.optional(z.array(z.string())),\n quote: z.string().check(z.minLength(1)),\n skipLines: z.number().check(z.int(), z.gte(0)),\n trimSpace: z.boolean(),\n type: z.literal(\"CSV\"),\n});\n\nconst jsonFileFormatSchema = z.strictObject({\n emptyAsNull: z.boolean(),\n nullIf: z.optional(z.array(z.string())),\n type: z.literal(\"JSON\"),\n});\n\nconst parquetFileFormatSchema = z.strictObject({\n type: z.literal(\"Parquet\"),\n});\n\nconst fileFormatSchema = z.discriminatedUnion(\"type\", [\n csvFileFormatSchema,\n jsonFileFormatSchema,\n parquetFileFormatSchema,\n]);\n\nconst previewBodySchema = z.strictObject({\n fileFormat: fileFormatSchema,\n});\n\nexport const fieldSchema = z.object({\n metadata: z.optional(z.record(z.string(), z.string())),\n name: z.string(),\n nullable: z.boolean(),\n type: z.string(),\n});\n\nconst fieldSchemaWithChildren = z.extend(fieldSchema, {\n children: z.optional(z.lazy(() => z.array(fieldSchema))),\n});\n\nconst ingestBodySchema = z.strictObject({\n extension: z.enum([\"csv\", \"json\", \"parquet\"]),\n fileFormat: fileFormatSchema,\n namespace: z.array(z.string()),\n schemaFields: z.array(fieldSchemaWithChildren),\n tableName: z.string(),\n});\n\nexport class FileUpload {\n readonly #config: SonarV3Config;\n readonly id: string;\n\n constructor(config: SonarV3Config, id: string) {\n this.#config = config;\n this.id = id;\n }\n\n preview(configuration: z.infer<typeof previewBodySchema>, { signal }: SignalParam = {}) {\n return this.#config\n .sonarV3Request(`uploads/${this.id}/preview`, {\n body: JSON.stringify(z.parse(previewBodySchema, configuration)),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n method: \"POST\",\n signal,\n })\n .map(\n (res) =>\n res.json() as Promise<{\n rows: [unknown][];\n schema: z.infer<typeof fieldSchemaWithChildren>[];\n }>,\n );\n }\n\n ingest(configuration: z.infer<typeof ingestBodySchema>) {\n const parsedBody = z.parse(ingestBodySchema, configuration);\n return this.#config\n .sonarV3Request(`uploads/${this.id}/ingest`, {\n body: JSON.stringify({\n ...parsedBody,\n namespace: catalogPathToString(parsedBody.namespace),\n }),\n headers: {\n Accept: \"text/plain\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.text());\n }\n\n static fileFormatSchema = fileFormatSchema;\n}\n"]}
|
|
@@ -20,4 +20,5 @@ export declare const getResourceConfig: (config: Config) => (projectId?: string)
|
|
|
20
20
|
v3URL: (path: string) => URL;
|
|
21
21
|
v4Request: (path: string, init?: RequestInit) => import("ts-results-es").AsyncResult<Response, import("./index.ts").HttpError>;
|
|
22
22
|
v4URL: (path: string) => URL;
|
|
23
|
+
xhr: (method: string, input: string, headers?: Record<string, string>, body?: XMLHttpRequestBodyInit, modifyXHR?: (xhr: XMLHttpRequest) => void) => import("ts-results-es").AsyncResult<XMLHttpRequest, unknown>;
|
|
23
24
|
};
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { createRequest } from "../common/createRequest.js";
|
|
17
|
+
import { createXHR } from "../common/createXHR.js";
|
|
17
18
|
import { _replaceOriginResource } from "./replaceOriginResource.js";
|
|
18
19
|
export const getResourceConfig = (config) => (projectId) => {
|
|
19
20
|
const request = createRequest(config);
|
|
21
|
+
const xhr = createXHR(config);
|
|
20
22
|
const sonarV2URL = (path) => new URL(`/ui/projects/${projectId}/${path}`, _replaceOriginResource(config.origin, "app"));
|
|
21
23
|
const sonarV3URL = (path) => {
|
|
22
24
|
if (!projectId) {
|
|
@@ -54,6 +56,7 @@ export const getResourceConfig = (config) => (projectId) => {
|
|
|
54
56
|
v3URL,
|
|
55
57
|
v4Request: (path, init) => request(v4URL(path).toString(), init),
|
|
56
58
|
v4URL,
|
|
59
|
+
xhr,
|
|
57
60
|
};
|
|
58
61
|
};
|
|
59
62
|
//# sourceMappingURL=getResourceConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"getResourceConfig.js","sourceRoot":"","sources":["../../src/cloud/getResourceConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAaH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO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AAQ,EAAE,EAAE,IAAI,CAAC;QACtF,KAAK;QACL,GAAG;KAQM,CAAC;AACd,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n Config,\n ResourceConfig,\n SonarV2Config,\n SonarV3Config,\n SonarV4Config,\n V2Config,\n V3Config,\n V4Config,\n XHRConfig,\n} from \"../common/Config.ts\";\nimport { createRequest } from \"../common/createRequest.ts\";\nimport { createXHR } from \"../common/createXHR.ts\";\nimport { _replaceOriginResource } from \"./replaceOriginResource.ts\";\n\nexport const getResourceConfig = (config: Config) => (projectId?: string) => {\n const request = createRequest(config);\n const xhr = createXHR(config);\n\n const sonarV2URL = (path: string) =>\n new URL(`/ui/projects/${projectId}/${path}`, _replaceOriginResource(config.origin, \"app\"));\n\n const sonarV3URL = (path: string) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return new URL(`/v0/projects/${projectId}/${path}`, config.origin);\n };\n\n const sonarV4URL = (path: string) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return new URL(`/v1/projects/${projectId}/${path}`, config.origin);\n };\n\n const v2URL = (path: string) =>\n new URL(`/ui/${path}`, _replaceOriginResource(config.origin, \"app\"));\n\n const v3URL = (path: string) => new URL(`/v0/${path}`, config.origin);\n\n const v4URL = (path: string) => new URL(`/v1/${path}`, config.origin);\n\n return {\n logger: config.logger,\n origin: config.origin,\n request,\n sonarV2Request: (path: string, init?: RequestInit) => {\n if (!projectId) {\n throw new Error(\"projectId is required\");\n }\n return request(sonarV2URL(path).toString(), init);\n },\n sonarV2URL,\n sonarV3Request: (path: string, init?: RequestInit) =>\n request(sonarV3URL(path).toString(), init),\n sonarV3URL,\n sonarV4Request: (path: string, init?: RequestInit) =>\n request(sonarV4URL(path).toString(), init),\n sonarV4URL,\n v2Request: (path: string, init?: RequestInit) => request(v2URL(path).toString(), init),\n v2URL,\n v3Request: (path: string, init?: RequestInit) => request(v3URL(path).toString(), init),\n v3URL,\n v4Request: (path: string, init?: RequestInit) => request(v4URL(path).toString(), init),\n v4URL,\n xhr,\n } satisfies ResourceConfig &\n SonarV2Config &\n SonarV3Config &\n SonarV4Config &\n V2Config &\n V3Config &\n V4Config &\n XHRConfig;\n};\n"]}
|
|
@@ -11,10 +11,12 @@ import type { Role } from "../enterprise/roles/Role.ts";
|
|
|
11
11
|
import type { BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference } from "../oss/catalog/VersionReference.ts";
|
|
12
12
|
import type { JobResultsSchema } from "../oss/jobs/utils/JobResultsResponse.ts";
|
|
13
13
|
import { type EngineRule, EngineRejectRule, EngineRouteRule } from "./engineRules/EngineRule.ts";
|
|
14
|
+
import { FileUpload } from "./catalog/FileUpload.ts";
|
|
14
15
|
export type { ArcticCatalog, CloudUser, Engine, Project };
|
|
15
16
|
export type { EngineRule, Job, JobResultsSchema, Reflection, EnterpriseScript, ReflectionSummary, Role, BranchHeadVersionReference, BareCommitVersionReference, TagVersionReference, VersionReference, };
|
|
16
|
-
export { EngineRejectRule, EngineRouteRule, Organization, User };
|
|
17
|
+
export { EngineRejectRule, EngineRouteRule, FileUpload, Organization, User };
|
|
17
18
|
export * from "../enterprise/catalog/CatalogObjects/index.ts";
|
|
18
19
|
export * from "../enterprise/catalog/CatalogReferences/index.ts";
|
|
19
20
|
export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.ts";
|
|
20
21
|
export * from "../enterprise/grants/Grant.ts";
|
|
22
|
+
export * from "./ai/index.ts";
|
package/dist/cloud/interfaces.js
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
import { Organization } from "./organizations/Organization.js";
|
|
17
17
|
import { User } from "./users/User.js";
|
|
18
18
|
import { EngineRejectRule, EngineRouteRule } from "./engineRules/EngineRule.js";
|
|
19
|
-
|
|
19
|
+
import { FileUpload } from "./catalog/FileUpload.js";
|
|
20
|
+
export { EngineRejectRule, EngineRouteRule, FileUpload, Organization, User };
|
|
20
21
|
export * from "../enterprise/catalog/CatalogObjects/index.js";
|
|
21
22
|
export * from "../enterprise/catalog/CatalogReferences/index.js";
|
|
22
23
|
export * from "../enterprise/catalog/catalogSearch/CatalogSearchResult.js";
|
|
23
24
|
export * from "../enterprise/grants/Grant.js";
|
|
25
|
+
export * from "./ai/index.js";
|
|
24
26
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAYvC,OAAO,EAAmB,gBAAgB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/cloud/interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAYvC,OAAO,EAAmB,gBAAgB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAerD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAC7E,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ArcticCatalog } from \"./arctic/ArcticCatalog.ts\";\nimport type { CloudUser } from \"./users/CloudUser.ts\";\nimport type { Engine } from \"./engines/Engine.ts\";\nimport type { Project } from \"./projects/Project.ts\";\nimport { Organization } from \"./organizations/Organization.ts\";\nimport { User } from \"./users/User.ts\";\nimport type { Job, Reflection } from \"../oss/interfaces.ts\";\nimport type { EnterpriseScript } from \"../enterprise/scripts/EnterpriseScript.ts\";\nimport type { ReflectionSummary } from \"../enterprise/reflections/ReflectionSummary.ts\";\nimport type { Role } from \"../enterprise/roles/Role.ts\";\nimport type {\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n} from \"../oss/catalog/VersionReference.ts\";\nimport type { JobResultsSchema } from \"../oss/jobs/utils/JobResultsResponse.ts\";\nimport { type EngineRule, EngineRejectRule, EngineRouteRule } from \"./engineRules/EngineRule.ts\";\nimport { FileUpload } from \"./catalog/FileUpload.ts\";\nexport type { ArcticCatalog, CloudUser, Engine, Project };\nexport type {\n EngineRule,\n Job,\n JobResultsSchema,\n Reflection,\n EnterpriseScript,\n ReflectionSummary,\n Role,\n BranchHeadVersionReference,\n BareCommitVersionReference,\n TagVersionReference,\n VersionReference,\n};\nexport { EngineRejectRule, EngineRouteRule, FileUpload, Organization, User };\nexport * from \"../enterprise/catalog/CatalogObjects/index.ts\";\nexport * from \"../enterprise/catalog/CatalogReferences/index.ts\";\nexport * from \"../enterprise/catalog/catalogSearch/CatalogSearchResult.ts\";\nexport * from \"../enterprise/grants/Grant.ts\";\nexport * from \"./ai/index.ts\";\n"]}
|
|
@@ -30,6 +30,10 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
30
30
|
modifiedAt: z.ZodMiniString<string>;
|
|
31
31
|
modifiedBy: z.ZodMiniString<string>;
|
|
32
32
|
name: z.ZodMiniString<string>;
|
|
33
|
+
serverlessSupport: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
34
|
+
SUPPORTED: "SUPPORTED";
|
|
35
|
+
NOT_SUPPORTED: "NOT_SUPPORTED";
|
|
36
|
+
}>>;
|
|
33
37
|
state: z.ZodMiniEnum<{
|
|
34
38
|
FAILED: "FAILED";
|
|
35
39
|
INVALID: "INVALID";
|
|
@@ -76,6 +80,7 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
76
80
|
auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
77
81
|
defaultProjectId: z.ZodMiniString<string>;
|
|
78
82
|
_isCreatedWithCFT: z.ZodMiniBoolean<boolean>;
|
|
83
|
+
_serverlessSupported: z.ZodMiniBoolean<boolean>;
|
|
79
84
|
cloudTags: z.ZodMiniArray<z.ZodMiniObject<{
|
|
80
85
|
key: z.ZodMiniString<string>;
|
|
81
86
|
value: z.ZodMiniString<string>;
|
|
@@ -108,6 +113,10 @@ export declare class Organization implements OrganizationProperties {
|
|
|
108
113
|
* @hidden
|
|
109
114
|
*/
|
|
110
115
|
readonly _isCreatedWithCFT: OrganizationProperties["_isCreatedWithCFT"];
|
|
116
|
+
/**
|
|
117
|
+
* @hidden
|
|
118
|
+
*/
|
|
119
|
+
readonly _serverlessSupported: OrganizationProperties["_serverlessSupported"];
|
|
111
120
|
constructor(config: V2Config, properties: OrganizationProperties);
|
|
112
121
|
get settled(): boolean;
|
|
113
122
|
update(fields: Partial<z.infer<typeof organizationUpdateSchema>>): import("ts-results-es").AsyncResult<Organization, import("../index.ts").HttpError>;
|
|
@@ -144,6 +153,7 @@ export declare class Organization implements OrganizationProperties {
|
|
|
144
153
|
auditDestinationPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
145
154
|
defaultProjectId: z.ZodMiniString<string>;
|
|
146
155
|
_isCreatedWithCFT: z.ZodMiniBoolean<boolean>;
|
|
156
|
+
_serverlessSupported: z.ZodMiniBoolean<boolean>;
|
|
147
157
|
cloudTags: z.ZodMiniArray<z.ZodMiniObject<{
|
|
148
158
|
key: z.ZodMiniString<string>;
|
|
149
159
|
value: z.ZodMiniString<string>;
|
|
@@ -37,6 +37,7 @@ const organizationPropertiesInSchema = z.object({
|
|
|
37
37
|
modifiedAt: z.string(),
|
|
38
38
|
modifiedBy: z.string(),
|
|
39
39
|
name: z.string(),
|
|
40
|
+
serverlessSupport: z.optional(z.enum(["SUPPORTED", "NOT_SUPPORTED"])),
|
|
40
41
|
state: z.enum([
|
|
41
42
|
"ACTIVE",
|
|
42
43
|
"FAILED",
|
|
@@ -57,8 +58,10 @@ export const organizationPropertiesCodec = z.codec(organizationPropertiesInSchem
|
|
|
57
58
|
isCreatedWithCFT: true,
|
|
58
59
|
modifiedAt: true,
|
|
59
60
|
name: true,
|
|
61
|
+
serverlessSupport: true,
|
|
60
62
|
}), {
|
|
61
63
|
_isCreatedWithCFT: z.boolean(),
|
|
64
|
+
_serverlessSupported: z.boolean(),
|
|
62
65
|
cloudTags: z.array(z.object({
|
|
63
66
|
key: z.string(),
|
|
64
67
|
value: z.string(),
|
|
@@ -71,6 +74,7 @@ export const organizationPropertiesCodec = z.codec(organizationPropertiesInSchem
|
|
|
71
74
|
return {
|
|
72
75
|
...v,
|
|
73
76
|
_isCreatedWithCFT: v.isCreatedWithCFT,
|
|
77
|
+
_serverlessSupported: v.serverlessSupport === "SUPPORTED",
|
|
74
78
|
cloudTags: v.cloudTags ?? [],
|
|
75
79
|
createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),
|
|
76
80
|
modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),
|
|
@@ -82,6 +86,9 @@ export const organizationPropertiesCodec = z.codec(organizationPropertiesInSchem
|
|
|
82
86
|
createdAt: Temporal.Instant.toString(),
|
|
83
87
|
isCreatedWithCFT: v._isCreatedWithCFT,
|
|
84
88
|
modifiedAt: Temporal.Instant.toString(),
|
|
89
|
+
serverlessSupport: v._serverlessSupported
|
|
90
|
+
? "SUPPORTED"
|
|
91
|
+
: "NOT_SUPPORTED",
|
|
85
92
|
};
|
|
86
93
|
},
|
|
87
94
|
});
|
|
@@ -107,6 +114,10 @@ export class Organization {
|
|
|
107
114
|
* @hidden
|
|
108
115
|
*/
|
|
109
116
|
_isCreatedWithCFT;
|
|
117
|
+
/**
|
|
118
|
+
* @hidden
|
|
119
|
+
*/
|
|
120
|
+
_serverlessSupported;
|
|
110
121
|
#config;
|
|
111
122
|
constructor(config, properties) {
|
|
112
123
|
this.auditDestinationCloudType = properties.auditDestinationCloudType;
|
|
@@ -118,6 +129,7 @@ export class Organization {
|
|
|
118
129
|
this.defaultProjectId = properties.defaultProjectId;
|
|
119
130
|
this.id = properties.id;
|
|
120
131
|
this._isCreatedWithCFT = properties._isCreatedWithCFT;
|
|
132
|
+
this._serverlessSupported = properties._serverlessSupported;
|
|
121
133
|
this.modifiedAt = properties.modifiedAt;
|
|
122
134
|
this.modifiedBy = properties.modifiedBy;
|
|
123
135
|
this.name = properties.name;
|