@dremio/js-sdk 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/enterprise/catalog/EnterpriseCatalogResource.d.ts +446 -0
  2. package/dist/enterprise/catalog/EnterpriseCatalogResource.js +27 -0
  3. package/dist/enterprise/catalog/EnterpriseCatalogResource.js.map +1 -1
  4. package/dist/enterprise/catalog/catalogSearch/CatalogSearchParams.d.ts +20 -0
  5. package/dist/enterprise/catalog/catalogSearch/CatalogSearchParams.js +46 -0
  6. package/dist/enterprise/catalog/catalogSearch/CatalogSearchParams.js.map +1 -0
  7. package/dist/enterprise/catalog/catalogSearch/SearchApiResponse.d.ts +133 -0
  8. package/dist/enterprise/catalog/catalogSearch/SearchApiResponse.js +17 -0
  9. package/dist/enterprise/catalog/catalogSearch/SearchApiResponse.js.map +1 -0
  10. package/dist/enterprise/catalog/catalogSearch/SearchResult.d.ts +123 -0
  11. package/dist/enterprise/catalog/catalogSearch/SearchResult.js +27 -0
  12. package/dist/enterprise/catalog/catalogSearch/SearchResult.js.map +1 -0
  13. package/dist/enterprise/catalog/catalogSearch/catalogSearchParamsToObject.d.ts +5 -0
  14. package/dist/enterprise/catalog/catalogSearch/catalogSearchParamsToObject.js +52 -0
  15. package/dist/enterprise/catalog/catalogSearch/catalogSearchParamsToObject.js.map +1 -0
  16. package/dist/enterprise/catalog/catalogSearch/createCatalogSearch.d.ts +228 -0
  17. package/dist/enterprise/catalog/catalogSearch/createCatalogSearch.js +40 -0
  18. package/dist/enterprise/catalog/catalogSearch/createCatalogSearch.js.map +1 -0
  19. package/dist/enterprise/catalog/catalogSearch/mapSearchResult.d.ts +222 -0
  20. package/dist/enterprise/catalog/catalogSearch/mapSearchResult.js +162 -0
  21. package/dist/enterprise/catalog/catalogSearch/mapSearchResult.js.map +1 -0
  22. package/package.json +1 -1
@@ -0,0 +1,222 @@
1
+ import { Query } from "../../../common/Query.ts";
2
+ import type { Job } from "../../interfaces.ts";
3
+ import type { EnterpriseCatalogReference, EnterpriseDatasetCatalogReference, EnterpriseFolderCatalogReference, EnterpriseFunctionCatalogReference, EnterpriseSourceCatalogReference, EnterpriseSpaceCatalogReference } from "../CatalogReferences/index.ts";
4
+ import type { SearchApiResponse } from "./SearchApiResponse.ts";
5
+ export declare const mapSearchResult: (_catalogReferenceFromEntity: (entity: unknown) => EnterpriseCatalogReference) => (searchResult: SearchApiResponse["results"][number]) => {
6
+ readonly catalogReference: EnterpriseFolderCatalogReference;
7
+ readonly category: "FOLDER";
8
+ readonly owner: {
9
+ id: string;
10
+ type: "USER" | "ROLE";
11
+ username: string;
12
+ } | undefined;
13
+ readonly wiki: string | null;
14
+ readonly content?: undefined;
15
+ readonly createdAt?: undefined;
16
+ readonly id?: undefined;
17
+ readonly lastModifiedAt?: undefined;
18
+ readonly name?: undefined;
19
+ readonly columns?: undefined;
20
+ readonly labels?: undefined;
21
+ readonly functionSql?: undefined;
22
+ readonly error?: undefined;
23
+ readonly finishTime?: undefined;
24
+ readonly queriedDatasets?: undefined;
25
+ readonly queryType?: undefined;
26
+ readonly sql?: undefined;
27
+ readonly startTime?: undefined;
28
+ readonly state?: undefined;
29
+ readonly user?: undefined;
30
+ } | {
31
+ readonly category: "SCRIPT";
32
+ readonly content: string;
33
+ readonly createdAt: Date;
34
+ readonly id: string;
35
+ readonly lastModifiedAt: Date;
36
+ readonly name: string;
37
+ readonly owner: {
38
+ id: string;
39
+ type: "USER" | "ROLE";
40
+ username: string;
41
+ };
42
+ readonly catalogReference?: undefined;
43
+ readonly wiki?: undefined;
44
+ readonly columns?: undefined;
45
+ readonly labels?: undefined;
46
+ readonly functionSql?: undefined;
47
+ readonly error?: undefined;
48
+ readonly finishTime?: undefined;
49
+ readonly queriedDatasets?: undefined;
50
+ readonly queryType?: undefined;
51
+ readonly sql?: undefined;
52
+ readonly startTime?: undefined;
53
+ readonly state?: undefined;
54
+ readonly user?: undefined;
55
+ } | {
56
+ readonly catalogReference: EnterpriseDatasetCatalogReference;
57
+ readonly category: "REFLECTION";
58
+ readonly createdAt: Date;
59
+ readonly id: string;
60
+ readonly lastModifiedAt: Date;
61
+ readonly name: string;
62
+ readonly owner?: undefined;
63
+ readonly wiki?: undefined;
64
+ readonly content?: undefined;
65
+ readonly columns?: undefined;
66
+ readonly labels?: undefined;
67
+ readonly functionSql?: undefined;
68
+ readonly error?: undefined;
69
+ readonly finishTime?: undefined;
70
+ readonly queriedDatasets?: undefined;
71
+ readonly queryType?: undefined;
72
+ readonly sql?: undefined;
73
+ readonly startTime?: undefined;
74
+ readonly state?: undefined;
75
+ readonly user?: undefined;
76
+ } | {
77
+ readonly catalogReference: EnterpriseSourceCatalogReference;
78
+ readonly category: "SOURCE";
79
+ readonly createdAt: Date;
80
+ readonly owner: {
81
+ id: string;
82
+ type: "USER" | "ROLE";
83
+ username: string;
84
+ } | undefined;
85
+ readonly wiki?: undefined;
86
+ readonly content?: undefined;
87
+ readonly id?: undefined;
88
+ readonly lastModifiedAt?: undefined;
89
+ readonly name?: undefined;
90
+ readonly columns?: undefined;
91
+ readonly labels?: undefined;
92
+ readonly functionSql?: undefined;
93
+ readonly error?: undefined;
94
+ readonly finishTime?: undefined;
95
+ readonly queriedDatasets?: undefined;
96
+ readonly queryType?: undefined;
97
+ readonly sql?: undefined;
98
+ readonly startTime?: undefined;
99
+ readonly state?: undefined;
100
+ readonly user?: undefined;
101
+ } | {
102
+ readonly catalogReference: EnterpriseSpaceCatalogReference;
103
+ readonly category: "SPACE";
104
+ readonly createdAt: Date | null;
105
+ readonly lastModifiedAt: Date | null;
106
+ readonly owner: {
107
+ id: string;
108
+ type: "USER" | "ROLE";
109
+ username: string;
110
+ };
111
+ readonly wiki: string | null;
112
+ readonly content?: undefined;
113
+ readonly id?: undefined;
114
+ readonly name?: undefined;
115
+ readonly columns?: undefined;
116
+ readonly labels?: undefined;
117
+ readonly functionSql?: undefined;
118
+ readonly error?: undefined;
119
+ readonly finishTime?: undefined;
120
+ readonly queriedDatasets?: undefined;
121
+ readonly queryType?: undefined;
122
+ readonly sql?: undefined;
123
+ readonly startTime?: undefined;
124
+ readonly state?: undefined;
125
+ readonly user?: undefined;
126
+ } | {
127
+ readonly catalogReference: EnterpriseDatasetCatalogReference;
128
+ readonly category: "TABLE";
129
+ readonly columns: string[];
130
+ readonly createdAt: Date | null;
131
+ readonly labels: string[];
132
+ readonly lastModifiedAt: Date | null;
133
+ readonly owner: {
134
+ id: string;
135
+ type: "USER" | "ROLE";
136
+ username: string;
137
+ };
138
+ readonly wiki: string | null;
139
+ readonly content?: undefined;
140
+ readonly id?: undefined;
141
+ readonly name?: undefined;
142
+ readonly functionSql?: undefined;
143
+ readonly error?: undefined;
144
+ readonly finishTime?: undefined;
145
+ readonly queriedDatasets?: undefined;
146
+ readonly queryType?: undefined;
147
+ readonly sql?: undefined;
148
+ readonly startTime?: undefined;
149
+ readonly state?: undefined;
150
+ readonly user?: undefined;
151
+ } | {
152
+ readonly catalogReference: EnterpriseFunctionCatalogReference;
153
+ readonly category: "FUNCTION";
154
+ readonly createdAt: Date;
155
+ readonly functionSql: string;
156
+ readonly lastModifiedAt: Date;
157
+ readonly owner: {
158
+ id: string;
159
+ type: "USER" | "ROLE";
160
+ username: string;
161
+ };
162
+ readonly wiki?: undefined;
163
+ readonly content?: undefined;
164
+ readonly id?: undefined;
165
+ readonly name?: undefined;
166
+ readonly columns?: undefined;
167
+ readonly labels?: undefined;
168
+ readonly error?: undefined;
169
+ readonly finishTime?: undefined;
170
+ readonly queriedDatasets?: undefined;
171
+ readonly queryType?: undefined;
172
+ readonly sql?: undefined;
173
+ readonly startTime?: undefined;
174
+ readonly state?: undefined;
175
+ readonly user?: undefined;
176
+ } | {
177
+ readonly catalogReference: EnterpriseDatasetCatalogReference;
178
+ readonly category: "VIEW";
179
+ readonly columns: string[];
180
+ readonly createdAt: Date | null;
181
+ readonly labels: string[];
182
+ readonly lastModifiedAt: Date | null;
183
+ readonly owner: {
184
+ id: string;
185
+ type: "USER" | "ROLE";
186
+ username: string;
187
+ };
188
+ readonly wiki: string | null;
189
+ readonly content?: undefined;
190
+ readonly id?: undefined;
191
+ readonly name?: undefined;
192
+ readonly functionSql?: undefined;
193
+ readonly error?: undefined;
194
+ readonly finishTime?: undefined;
195
+ readonly queriedDatasets?: undefined;
196
+ readonly queryType?: undefined;
197
+ readonly sql?: undefined;
198
+ readonly startTime?: undefined;
199
+ readonly state?: undefined;
200
+ readonly user?: undefined;
201
+ } | {
202
+ readonly category: "JOB";
203
+ readonly error: string | undefined;
204
+ readonly finishTime: Date;
205
+ readonly id: string;
206
+ readonly queriedDatasets: EnterpriseDatasetCatalogReference[];
207
+ readonly queryType: Job["queryType"];
208
+ readonly sql: Query;
209
+ readonly startTime: Date;
210
+ readonly state: Job["state"];
211
+ readonly user: any;
212
+ readonly catalogReference?: undefined;
213
+ readonly owner?: undefined;
214
+ readonly wiki?: undefined;
215
+ readonly content?: undefined;
216
+ readonly createdAt?: undefined;
217
+ readonly lastModifiedAt?: undefined;
218
+ readonly name?: undefined;
219
+ readonly columns?: undefined;
220
+ readonly labels?: undefined;
221
+ readonly functionSql?: undefined;
222
+ };
@@ -0,0 +1,162 @@
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 { Query } from "../../../common/Query.js";
17
+ import { SearchCategory, } from "./SearchResult.js";
18
+ export const mapSearchResult = (_catalogReferenceFromEntity) => (searchResult) => {
19
+ switch (searchResult.category) {
20
+ case "FOLDER":
21
+ return {
22
+ catalogReference: _catalogReferenceFromEntity({
23
+ path: searchResult.catalogObject.path,
24
+ type: transformSearchTypeToCatalog(searchResult.catalogObject.type),
25
+ }),
26
+ category: SearchCategory.FOLDER,
27
+ owner: searchResult.catalogObject?.owner,
28
+ wiki: searchResult.catalogObject.wiki || null,
29
+ };
30
+ case "SCRIPT":
31
+ return {
32
+ category: SearchCategory.SCRIPT,
33
+ content: searchResult.scriptObject.content,
34
+ createdAt: new Date(searchResult.scriptObject.createdAt),
35
+ id: searchResult.scriptObject.id,
36
+ lastModifiedAt: new Date(searchResult.scriptObject.modifiedAt),
37
+ name: searchResult.scriptObject.name,
38
+ owner: searchResult.scriptObject.owner,
39
+ };
40
+ case "REFLECTION":
41
+ return {
42
+ catalogReference: _catalogReferenceFromEntity({
43
+ path: searchResult.reflectionObject.datasetPath,
44
+ type: transformSearchTypeToCatalog(searchResult.reflectionObject.datasetType.toUpperCase()),
45
+ }),
46
+ category: SearchCategory.REFLECTION,
47
+ createdAt: new Date(searchResult.reflectionObject.createdAt),
48
+ id: searchResult.reflectionObject.id,
49
+ lastModifiedAt: new Date(searchResult.reflectionObject.modifiedAt),
50
+ name: searchResult.reflectionObject.name,
51
+ };
52
+ case "SOURCE":
53
+ return {
54
+ catalogReference: _catalogReferenceFromEntity({
55
+ path: searchResult.catalogObject.path,
56
+ type: transformSearchTypeToCatalog(searchResult.catalogObject.type),
57
+ }),
58
+ category: SearchCategory.SOURCE,
59
+ createdAt: new Date(searchResult.catalogObject.createdAt),
60
+ owner: searchResult.catalogObject.owner,
61
+ };
62
+ case "SPACE":
63
+ return {
64
+ catalogReference: _catalogReferenceFromEntity({
65
+ path: searchResult.catalogObject.path,
66
+ type: transformSearchTypeToCatalog(searchResult.catalogObject.type),
67
+ }),
68
+ category: SearchCategory.SPACE,
69
+ createdAt: searchResult.catalogObject.createdAt
70
+ ? new Date(searchResult.catalogObject.createdAt)
71
+ : null,
72
+ lastModifiedAt: searchResult.catalogObject.modifiedAt
73
+ ? new Date(searchResult.catalogObject.modifiedAt)
74
+ : null,
75
+ owner: searchResult.catalogObject.owner,
76
+ wiki: searchResult.catalogObject.wiki || null,
77
+ };
78
+ case "TABLE":
79
+ return {
80
+ catalogReference: _catalogReferenceFromEntity({
81
+ path: searchResult.catalogObject.path,
82
+ type: transformSearchTypeToCatalog(searchResult.catalogObject.type),
83
+ }),
84
+ category: SearchCategory.TABLE,
85
+ columns: searchResult.catalogObject.columns,
86
+ createdAt: searchResult.catalogObject.createdAt
87
+ ? new Date(searchResult.catalogObject.createdAt)
88
+ : null,
89
+ labels: searchResult.catalogObject.labels,
90
+ lastModifiedAt: searchResult.catalogObject.modifiedAt
91
+ ? new Date(searchResult.catalogObject.modifiedAt)
92
+ : null,
93
+ owner: searchResult.catalogObject.owner,
94
+ wiki: searchResult.catalogObject.wiki || null,
95
+ };
96
+ case "UDF":
97
+ return {
98
+ catalogReference: _catalogReferenceFromEntity({
99
+ path: searchResult.catalogObject.path,
100
+ type: transformSearchTypeToCatalog(searchResult.catalogObject.type),
101
+ }),
102
+ category: SearchCategory.FUNCTION,
103
+ createdAt: new Date(searchResult.catalogObject.createdAt),
104
+ functionSql: searchResult.catalogObject.functionSql,
105
+ lastModifiedAt: new Date(searchResult.catalogObject.modifiedAt),
106
+ owner: searchResult.catalogObject.owner,
107
+ };
108
+ case "VIEW":
109
+ return {
110
+ catalogReference: _catalogReferenceFromEntity({
111
+ path: searchResult.catalogObject.path,
112
+ type: transformSearchTypeToCatalog(searchResult.catalogObject.type),
113
+ }),
114
+ category: SearchCategory.VIEW,
115
+ columns: searchResult.catalogObject.columns,
116
+ createdAt: searchResult.catalogObject.createdAt
117
+ ? new Date(searchResult.catalogObject.createdAt)
118
+ : null,
119
+ labels: searchResult.catalogObject.labels,
120
+ lastModifiedAt: searchResult.catalogObject.modifiedAt
121
+ ? new Date(searchResult.catalogObject.modifiedAt)
122
+ : null,
123
+ owner: searchResult.catalogObject.owner,
124
+ wiki: searchResult.catalogObject.wiki || null,
125
+ };
126
+ case "JOB":
127
+ return {
128
+ category: SearchCategory.JOB,
129
+ error: searchResult.jobObject.error,
130
+ finishTime: new Date(searchResult.jobObject.finishTime),
131
+ id: searchResult.jobObject.id,
132
+ queriedDatasets: searchResult.jobObject.queriedDatasets.map((dataset) => _catalogReferenceFromEntity({
133
+ path: dataset.datasetPath,
134
+ type: transformSearchTypeToCatalog(dataset.datasetType),
135
+ })),
136
+ queryType: searchResult.jobObject.jobType,
137
+ sql: new Query(searchResult.jobObject.sql),
138
+ startTime: new Date(searchResult.jobObject.startTime),
139
+ state: searchResult.jobObject.jobState,
140
+ user: searchResult.jobObject.user,
141
+ };
142
+ }
143
+ };
144
+ const transformSearchTypeToCatalog = (type) => {
145
+ switch (type) {
146
+ case "TABLE":
147
+ return "DATASET_DIRECT";
148
+ case "VIEW":
149
+ return "DATASET_VIRTUAL";
150
+ case "FOLDER":
151
+ return "FOLDER";
152
+ case "FUNCTION":
153
+ return "FUNCTION";
154
+ case "SPACE":
155
+ return "SPACE";
156
+ case "SOURCE":
157
+ return "SOURCE";
158
+ default:
159
+ return "FILE";
160
+ }
161
+ };
162
+ //# sourceMappingURL=mapSearchResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapSearchResult.js","sourceRoot":"","sources":["../../../../src/enterprise/catalog/catalogSearch/mapSearchResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAWjD,OAAO,EACL,cAAc,GAUf,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,eAAe,GAC1B,CAAC,2BAA4E,EAAE,EAAE,CACjF,CAAC,YAAkD,EAAE,EAAE;IACrD,QAAQ,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC9B,KAAK,QAAQ;YACX,OAAO;gBACL,gBAAgB,EAAE,2BAA2B,CAAC;oBAC5C,IAAI,EAAE,YAAY,CAAC,aA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AAK,EAAE,YAAY,CAAC,SAAS,CAAC,QAAwB;gBACtD,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,IAAW;aACN,CAAC;IACzC,CAAC;AACH,CAAC,CAAC;AAEJ,MAAM,4BAA4B,GAAG,CAAC,IAAY,EAAsC,EAAE;IACxF,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,OAAO;YACV,OAAO,gBAAgB,CAAC;QAC1B,KAAK,MAAM;YACT,OAAO,iBAAiB,CAAC;QAC3B,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC;QACpB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,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 { Query } from \"../../../common/Query.ts\";\nimport type { Job } from \"../../interfaces.ts\";\nimport type {\n EnterpriseCatalogReference,\n EnterpriseDatasetCatalogReference,\n EnterpriseFolderCatalogReference,\n EnterpriseFunctionCatalogReference,\n EnterpriseSourceCatalogReference,\n EnterpriseSpaceCatalogReference,\n} from \"../CatalogReferences/index.ts\";\nimport type { SearchApiResponse } from \"./SearchApiResponse.ts\";\nimport {\n SearchCategory,\n type FolderSearchResult,\n type FunctionSearchResult,\n type JobSearchResult,\n type ReflectionSearchResult,\n type ScriptSearchResult,\n type SourceSearchResult,\n type SpaceSearchResult,\n type TableSearchResult,\n type ViewSearchResult,\n} from \"./SearchResult.ts\";\n\nexport const mapSearchResult =\n (_catalogReferenceFromEntity: (entity: unknown) => EnterpriseCatalogReference) =>\n (searchResult: SearchApiResponse[\"results\"][number]) => {\n switch (searchResult.category) {\n case \"FOLDER\":\n return {\n catalogReference: _catalogReferenceFromEntity({\n path: searchResult.catalogObject.path,\n type: transformSearchTypeToCatalog(searchResult.catalogObject.type),\n }) as EnterpriseFolderCatalogReference,\n category: SearchCategory.FOLDER,\n owner: searchResult.catalogObject?.owner,\n wiki: searchResult.catalogObject.wiki || null,\n } as const satisfies FolderSearchResult;\n case \"SCRIPT\":\n return {\n category: SearchCategory.SCRIPT,\n content: searchResult.scriptObject.content,\n createdAt: new Date(searchResult.scriptObject.createdAt),\n id: searchResult.scriptObject.id,\n lastModifiedAt: new Date(searchResult.scriptObject.modifiedAt),\n name: searchResult.scriptObject.name,\n owner: searchResult.scriptObject.owner,\n } as const satisfies ScriptSearchResult;\n case \"REFLECTION\":\n return {\n catalogReference: _catalogReferenceFromEntity({\n path: searchResult.reflectionObject.datasetPath,\n type: transformSearchTypeToCatalog(\n searchResult.reflectionObject.datasetType.toUpperCase(),\n ),\n }) as EnterpriseDatasetCatalogReference,\n category: SearchCategory.REFLECTION,\n createdAt: new Date(searchResult.reflectionObject.createdAt),\n id: searchResult.reflectionObject.id,\n lastModifiedAt: new Date(searchResult.reflectionObject.modifiedAt),\n name: searchResult.reflectionObject.name,\n } as const satisfies ReflectionSearchResult;\n case \"SOURCE\":\n return {\n catalogReference: _catalogReferenceFromEntity({\n path: searchResult.catalogObject.path,\n type: transformSearchTypeToCatalog(searchResult.catalogObject.type),\n }) as EnterpriseSourceCatalogReference,\n category: SearchCategory.SOURCE,\n createdAt: new Date(searchResult.catalogObject.createdAt),\n owner: searchResult.catalogObject.owner,\n } as const satisfies SourceSearchResult;\n case \"SPACE\":\n return {\n catalogReference: _catalogReferenceFromEntity({\n path: searchResult.catalogObject.path,\n type: transformSearchTypeToCatalog(searchResult.catalogObject.type),\n }) as EnterpriseSpaceCatalogReference,\n category: SearchCategory.SPACE,\n createdAt: searchResult.catalogObject.createdAt\n ? new Date(searchResult.catalogObject.createdAt)\n : null,\n lastModifiedAt: searchResult.catalogObject.modifiedAt\n ? new Date(searchResult.catalogObject.modifiedAt)\n : null,\n owner: searchResult.catalogObject.owner,\n wiki: searchResult.catalogObject.wiki || null,\n } as const satisfies SpaceSearchResult;\n case \"TABLE\":\n return {\n catalogReference: _catalogReferenceFromEntity({\n path: searchResult.catalogObject.path,\n type: transformSearchTypeToCatalog(searchResult.catalogObject.type),\n }) as EnterpriseDatasetCatalogReference,\n category: SearchCategory.TABLE,\n columns: searchResult.catalogObject.columns,\n createdAt: searchResult.catalogObject.createdAt\n ? new Date(searchResult.catalogObject.createdAt)\n : null,\n labels: searchResult.catalogObject.labels,\n lastModifiedAt: searchResult.catalogObject.modifiedAt\n ? new Date(searchResult.catalogObject.modifiedAt)\n : null,\n owner: searchResult.catalogObject.owner,\n wiki: searchResult.catalogObject.wiki || null,\n } as const satisfies TableSearchResult;\n case \"UDF\":\n return {\n catalogReference: _catalogReferenceFromEntity({\n path: searchResult.catalogObject.path,\n type: transformSearchTypeToCatalog(searchResult.catalogObject.type),\n }) as EnterpriseFunctionCatalogReference,\n category: SearchCategory.FUNCTION,\n createdAt: new Date(searchResult.catalogObject.createdAt),\n functionSql: searchResult.catalogObject.functionSql,\n lastModifiedAt: new Date(searchResult.catalogObject.modifiedAt),\n owner: searchResult.catalogObject.owner,\n } as const satisfies FunctionSearchResult;\n case \"VIEW\":\n return {\n catalogReference: _catalogReferenceFromEntity({\n path: searchResult.catalogObject.path,\n type: transformSearchTypeToCatalog(searchResult.catalogObject.type),\n }) as EnterpriseDatasetCatalogReference,\n category: SearchCategory.VIEW,\n columns: searchResult.catalogObject.columns,\n createdAt: searchResult.catalogObject.createdAt\n ? new Date(searchResult.catalogObject.createdAt)\n : null,\n labels: searchResult.catalogObject.labels,\n lastModifiedAt: searchResult.catalogObject.modifiedAt\n ? new Date(searchResult.catalogObject.modifiedAt)\n : null,\n owner: searchResult.catalogObject.owner,\n wiki: searchResult.catalogObject.wiki || null,\n } as const satisfies ViewSearchResult;\n case \"JOB\":\n return {\n category: SearchCategory.JOB,\n error: searchResult.jobObject.error,\n finishTime: new Date(searchResult.jobObject.finishTime),\n id: searchResult.jobObject.id,\n queriedDatasets: searchResult.jobObject.queriedDatasets.map(\n (dataset) =>\n _catalogReferenceFromEntity({\n path: dataset.datasetPath,\n type: transformSearchTypeToCatalog(dataset.datasetType),\n }) as EnterpriseDatasetCatalogReference,\n ),\n queryType: searchResult.jobObject.jobType as Job[\"queryType\"],\n sql: new Query(searchResult.jobObject.sql),\n startTime: new Date(searchResult.jobObject.startTime),\n state: searchResult.jobObject.jobState as Job[\"state\"],\n user: searchResult.jobObject.user as any,\n } as const satisfies JobSearchResult;\n }\n };\n\nconst transformSearchTypeToCatalog = (type: string): EnterpriseCatalogReference[\"type\"] => {\n switch (type) {\n case \"TABLE\":\n return \"DATASET_DIRECT\";\n case \"VIEW\":\n return \"DATASET_VIRTUAL\";\n case \"FOLDER\":\n return \"FOLDER\";\n case \"FUNCTION\":\n return \"FUNCTION\";\n case \"SPACE\":\n return \"SPACE\";\n case \"SOURCE\":\n return \"SOURCE\";\n default:\n return \"FILE\";\n }\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.13.0",
3
+ "version": "0.14.1",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",