@loaders.gl/excel 5.0.0-alpha.5 → 5.0.0-alpha.7
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/dist.dev.js +41481 -41286
- package/dist/dist.min.js +45 -45
- package/dist/excel-loader-with-parser.d.ts +6 -2
- package/dist/excel-loader-with-parser.d.ts.map +1 -1
- package/dist/excel-loader.d.ts +14 -7
- package/dist/excel-loader.d.ts.map +1 -1
- package/dist/excel-loader.js +8 -8
- package/dist/excel-loader.js.map +1 -1
- package/dist/excel-worker.js +243 -22
- package/dist/index.cjs +255 -55
- package/dist/index.cjs.map +3 -3
- package/package.json +6 -5
- package/src/excel-loader.ts +10 -7
|
@@ -18,9 +18,11 @@ export declare const ExcelWorkerLoaderWithParser: {
|
|
|
18
18
|
readonly batchType: never;
|
|
19
19
|
readonly version: any;
|
|
20
20
|
readonly worker: true;
|
|
21
|
+
readonly serializeWorkerResult: typeof import("@loaders.gl/arrow/transport").serializeArrowWorkerResult;
|
|
22
|
+
readonly deserializeWorkerResult: typeof import("@loaders.gl/arrow/transport").deserializeArrowWorkerResult;
|
|
21
23
|
readonly options: {
|
|
22
24
|
readonly excel: {
|
|
23
|
-
readonly shape: "
|
|
25
|
+
readonly shape: "arrow-table";
|
|
24
26
|
readonly sheet: undefined;
|
|
25
27
|
};
|
|
26
28
|
};
|
|
@@ -41,9 +43,11 @@ export declare const ExcelLoaderWithParser: {
|
|
|
41
43
|
readonly batchType: never;
|
|
42
44
|
readonly version: any;
|
|
43
45
|
readonly worker: true;
|
|
46
|
+
readonly serializeWorkerResult: typeof import("@loaders.gl/arrow/transport").serializeArrowWorkerResult;
|
|
47
|
+
readonly deserializeWorkerResult: typeof import("@loaders.gl/arrow/transport").deserializeArrowWorkerResult;
|
|
44
48
|
readonly options: {
|
|
45
49
|
readonly excel: {
|
|
46
|
-
readonly shape: "
|
|
50
|
+
readonly shape: "arrow-table";
|
|
47
51
|
readonly sheet: undefined;
|
|
48
52
|
};
|
|
49
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excel-loader-with-parser.d.ts","sourceRoot":"","sources":["../src/excel-loader-with-parser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA2B,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAUnE,4CAA4C;AAC5C,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,wCAAwC;IACxC,KAAK,CAAC,EAAE;QACN,uDAAuD;QACvD,KAAK,CAAC,EAA4B,AAA1B,yBAAyB,CAAC,kBAAkB,GAAG,aAAa,CAAC;QACrE,mEAAmE;QACnE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,+EAA+E;QAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"excel-loader-with-parser.d.ts","sourceRoot":"","sources":["../src/excel-loader-with-parser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA2B,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAUnE,4CAA4C;AAC5C,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,wCAAwC;IACxC,KAAK,CAAC,EAAE;QACN,uDAAuD;QACvD,KAAK,CAAC,EAA4B,AAA1B,yBAAyB,CAAC,kBAAkB,GAAG,aAAa,CAAC;QACrE,mEAAmE;QACnE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,+EAA+E;QAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;CAE2C,CAAC;AAEpF,8BAA8B;AAC9B,eAAO,MAAM,qBAAqB;kCAGjB,WAAW,YACd,kBAAkB,KAC3B,OAAO,CAAC,cAAc,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;CAWoD,CAAC"}
|
package/dist/excel-loader.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { ArrowTable, ObjectRowTable } from '@loaders.gl/schema';
|
|
3
|
+
import { deserializeArrowWorkerResult, serializeArrowWorkerResult } from '@loaders.gl/arrow/transport';
|
|
3
4
|
/** Options for parsing Excel worksheets. */
|
|
4
5
|
export type ExcelLoaderOptions = LoaderOptions & {
|
|
5
6
|
/** Options for ExcelLoader */
|
|
@@ -19,9 +20,11 @@ declare function preload(): Promise<{
|
|
|
19
20
|
readonly batchType: never;
|
|
20
21
|
readonly version: any;
|
|
21
22
|
readonly worker: true;
|
|
23
|
+
readonly serializeWorkerResult: typeof serializeArrowWorkerResult;
|
|
24
|
+
readonly deserializeWorkerResult: typeof deserializeArrowWorkerResult;
|
|
22
25
|
readonly options: {
|
|
23
26
|
readonly excel: {
|
|
24
|
-
readonly shape: "
|
|
27
|
+
readonly shape: "arrow-table";
|
|
25
28
|
readonly sheet: undefined;
|
|
26
29
|
};
|
|
27
30
|
};
|
|
@@ -36,14 +39,16 @@ declare function preload(): Promise<{
|
|
|
36
39
|
readonly binary: true;
|
|
37
40
|
}>;
|
|
38
41
|
/** Metadata-only worker loader for Excel files. */
|
|
39
|
-
export declare const
|
|
42
|
+
export declare const ExcelLoader: {
|
|
40
43
|
readonly dataType: ObjectRowTable | ArrowTable;
|
|
41
44
|
readonly batchType: never;
|
|
42
45
|
readonly version: any;
|
|
43
46
|
readonly worker: true;
|
|
47
|
+
readonly serializeWorkerResult: typeof serializeArrowWorkerResult;
|
|
48
|
+
readonly deserializeWorkerResult: typeof deserializeArrowWorkerResult;
|
|
44
49
|
readonly options: {
|
|
45
50
|
readonly excel: {
|
|
46
|
-
readonly shape: "
|
|
51
|
+
readonly shape: "arrow-table";
|
|
47
52
|
readonly sheet: undefined;
|
|
48
53
|
};
|
|
49
54
|
};
|
|
@@ -58,19 +63,21 @@ export declare const ExcelWorkerLoader: {
|
|
|
58
63
|
readonly category: "table";
|
|
59
64
|
readonly binary: true;
|
|
60
65
|
};
|
|
61
|
-
/**
|
|
62
|
-
export declare const
|
|
63
|
-
readonly preload: typeof preload;
|
|
66
|
+
/** @deprecated Use ExcelLoader. */
|
|
67
|
+
export declare const ExcelWorkerLoader: {
|
|
64
68
|
readonly dataType: ObjectRowTable | ArrowTable;
|
|
65
69
|
readonly batchType: never;
|
|
66
70
|
readonly version: any;
|
|
67
71
|
readonly worker: true;
|
|
72
|
+
readonly serializeWorkerResult: typeof serializeArrowWorkerResult;
|
|
73
|
+
readonly deserializeWorkerResult: typeof deserializeArrowWorkerResult;
|
|
68
74
|
readonly options: {
|
|
69
75
|
readonly excel: {
|
|
70
|
-
readonly shape: "
|
|
76
|
+
readonly shape: "arrow-table";
|
|
71
77
|
readonly sheet: undefined;
|
|
72
78
|
};
|
|
73
79
|
};
|
|
80
|
+
readonly preload: typeof preload;
|
|
74
81
|
readonly name: "Excel";
|
|
75
82
|
readonly id: "excel";
|
|
76
83
|
readonly module: "excel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excel-loader.d.ts","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"excel-loader.d.ts","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AAMrC,4CAA4C;AAC5C,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,8BAA8B;IAC9B,KAAK,CAAC,EAAE;QACN,uDAAuD;QACvD,KAAK,CAAC,EAA4B,AAA1B,yBAAyB,CAAC,kBAAkB,GAAG,aAAa,CAAC;QACrE,mEAAmE;QACnE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,+EAA+E;QAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,+DAA+D;AAC/D,iBAAe,OAAO;;uBAQS,cAAc,GAAG,UAAU;wBACrC,KAAK;;;;;;;;;;;;;;;;;;;;GANzB;AAED,mDAAmD;AACnD,eAAO,MAAM,WAAW;uBAEO,cAAc,GAAG,UAAU;wBACrC,KAAK;;;;;;;;;;;;;;;;;;;;;CAYyD,CAAC;AAEpF,mCAAmC;AACnC,eAAO,MAAM,iBAAiB;uBAhBC,cAAc,GAAG,UAAU;wBACrC,KAAK;;;;;;;;;;;;;;;;;;;;;CAekB,CAAC"}
|
package/dist/excel-loader.js
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { ExcelFormat } from "./excel-format.js";
|
|
5
|
+
import { deserializeArrowWorkerResult, serializeArrowWorkerResult } from '@loaders.gl/arrow/transport';
|
|
5
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-alpha.
|
|
8
|
+
const VERSION = typeof "5.0.0-alpha.7" !== 'undefined' ? "5.0.0-alpha.7" : 'latest';
|
|
8
9
|
/** Preloads the parser-bearing Excel loader implementation. */
|
|
9
10
|
async function preload() {
|
|
10
11
|
const { ExcelLoaderWithParser } = await import("./excel-loader-with-parser.js");
|
|
11
12
|
return ExcelLoaderWithParser;
|
|
12
13
|
}
|
|
13
14
|
/** Metadata-only worker loader for Excel files. */
|
|
14
|
-
export const
|
|
15
|
+
export const ExcelLoader = {
|
|
15
16
|
...ExcelFormat,
|
|
16
17
|
dataType: null,
|
|
17
18
|
batchType: null,
|
|
18
19
|
version: VERSION,
|
|
19
20
|
worker: true,
|
|
21
|
+
serializeWorkerResult: serializeArrowWorkerResult,
|
|
22
|
+
deserializeWorkerResult: deserializeArrowWorkerResult,
|
|
20
23
|
options: {
|
|
21
24
|
excel: {
|
|
22
|
-
shape: '
|
|
25
|
+
shape: 'arrow-table',
|
|
23
26
|
sheet: undefined // Load default Sheet
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
preload
|
|
27
30
|
};
|
|
28
|
-
/**
|
|
29
|
-
export const
|
|
30
|
-
...ExcelWorkerLoader,
|
|
31
|
-
preload
|
|
32
|
-
};
|
|
31
|
+
/** @deprecated Use ExcelLoader. */
|
|
32
|
+
export const ExcelWorkerLoader = ExcelLoader;
|
|
33
33
|
//# sourceMappingURL=excel-loader.js.map
|
package/dist/excel-loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excel-loader.js","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,WAAW,EAAC,0BAAuB;
|
|
1
|
+
{"version":3,"file":"excel-loader.js","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAC3C,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AAErC,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,sBAAkB,KAAK,WAAW,CAAC,CAAC,iBAAa,CAAC,CAAC,QAAQ,CAAC;AAe5E,+DAA+D;AAC/D,KAAK,UAAU,OAAO;IACpB,MAAM,EAAC,qBAAqB,EAAC,GAAG,MAAM,MAAM,iCAA8B,CAAC;IAC3E,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,WAAW;IACd,QAAQ,EAAE,IAA8C;IACxD,SAAS,EAAE,IAAa;IACxB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,IAAI;IACZ,qBAAqB,EAAE,0BAA0B;IACjD,uBAAuB,EAAE,4BAA4B;IACrD,OAAO,EAAE;QACP,KAAK,EAAE;YACL,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE,SAAS,CAAC,qBAAqB;SACvC;KACF;IACD,OAAO;CAC0E,CAAC;AAEpF,mCAAmC;AACnC,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC"}
|
package/dist/excel-worker.js
CHANGED
|
@@ -26876,6 +26876,9 @@
|
|
|
26876
26876
|
return { type: "null", nullable: true };
|
|
26877
26877
|
}
|
|
26878
26878
|
function getDataTypeFromTypedArray(array) {
|
|
26879
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
26880
|
+
return "float16";
|
|
26881
|
+
}
|
|
26879
26882
|
switch (array.constructor) {
|
|
26880
26883
|
case Int8Array:
|
|
26881
26884
|
return "int8";
|
|
@@ -41852,6 +41855,13 @@ return true;`);
|
|
|
41852
41855
|
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
41853
41856
|
return "utf8-view";
|
|
41854
41857
|
}
|
|
41858
|
+
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
41859
|
+
const largeListType = arrowType;
|
|
41860
|
+
return {
|
|
41861
|
+
type: "large-list",
|
|
41862
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
41863
|
+
};
|
|
41864
|
+
}
|
|
41855
41865
|
switch (arrowType.constructor) {
|
|
41856
41866
|
case Null2:
|
|
41857
41867
|
return "null";
|
|
@@ -41990,12 +42000,6 @@ return true;`);
|
|
|
41990
42000
|
type: "list",
|
|
41991
42001
|
children: [serializeArrowField(listField)]
|
|
41992
42002
|
};
|
|
41993
|
-
case LargeList2:
|
|
41994
|
-
const largeListType = arrowType;
|
|
41995
|
-
return {
|
|
41996
|
-
type: "large-list",
|
|
41997
|
-
children: [serializeArrowField(largeListType.valueField)]
|
|
41998
|
-
};
|
|
41999
42003
|
case FixedSizeList2:
|
|
42000
42004
|
const fixedSizeList = arrowType;
|
|
42001
42005
|
return {
|
|
@@ -42048,7 +42052,13 @@ return true;`);
|
|
|
42048
42052
|
}
|
|
42049
42053
|
case "large-list": {
|
|
42050
42054
|
const field = deserializeArrowField(dataType.children[0], options);
|
|
42051
|
-
|
|
42055
|
+
const LargeList3 = getOptionalArrowConstructor("LargeList");
|
|
42056
|
+
if (!LargeList3) {
|
|
42057
|
+
throw new Error(
|
|
42058
|
+
"LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
|
|
42059
|
+
);
|
|
42060
|
+
}
|
|
42061
|
+
return new LargeList3(field);
|
|
42052
42062
|
}
|
|
42053
42063
|
case "fixed-size-list": {
|
|
42054
42064
|
const child = deserializeArrowField(dataType.children[0], options);
|
|
@@ -42144,11 +42154,11 @@ return true;`);
|
|
|
42144
42154
|
throw new Error("array type not supported");
|
|
42145
42155
|
}
|
|
42146
42156
|
}
|
|
42147
|
-
function
|
|
42148
|
-
return Arrow_dom_exports;
|
|
42157
|
+
function getOptionalArrowConstructor(typeName) {
|
|
42158
|
+
return Arrow_dom_exports[typeName];
|
|
42149
42159
|
}
|
|
42150
42160
|
function isArrowViewType(arrowType, viewTypeName) {
|
|
42151
|
-
const constructor =
|
|
42161
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
42152
42162
|
if (constructor && arrowType instanceof constructor) {
|
|
42153
42163
|
return true;
|
|
42154
42164
|
}
|
|
@@ -42156,12 +42166,16 @@ return true;`);
|
|
|
42156
42166
|
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
42157
42167
|
return Boolean(guard?.(arrowType));
|
|
42158
42168
|
}
|
|
42169
|
+
function isOptionalArrowType(arrowType, typeName) {
|
|
42170
|
+
const constructor = getOptionalArrowConstructor(typeName);
|
|
42171
|
+
return Boolean(constructor && arrowType instanceof constructor);
|
|
42172
|
+
}
|
|
42159
42173
|
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
42160
42174
|
const viewTypeMode = options?.viewTypes || "never";
|
|
42161
42175
|
if (viewTypeMode === "never") {
|
|
42162
42176
|
return fallbackType;
|
|
42163
42177
|
}
|
|
42164
|
-
const constructor =
|
|
42178
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
42165
42179
|
if (constructor) {
|
|
42166
42180
|
return new constructor();
|
|
42167
42181
|
}
|
|
@@ -42173,7 +42187,7 @@ return true;`);
|
|
|
42173
42187
|
return fallbackType;
|
|
42174
42188
|
}
|
|
42175
42189
|
function makeRequiredArrowViewType(viewTypeName) {
|
|
42176
|
-
const constructor =
|
|
42190
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
42177
42191
|
if (!constructor) {
|
|
42178
42192
|
throw new Error(
|
|
42179
42193
|
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
@@ -42557,36 +42571,217 @@ return true;`);
|
|
|
42557
42571
|
}
|
|
42558
42572
|
});
|
|
42559
42573
|
|
|
42574
|
+
// ../arrow/src/lib/utils/split-arrow-buffers.ts
|
|
42575
|
+
function splitArrowBuffers(input, options = {}) {
|
|
42576
|
+
if (isArrowTable2(input)) {
|
|
42577
|
+
return splitArrowTableBuffersInternal(input, options);
|
|
42578
|
+
}
|
|
42579
|
+
if (isArrowRecordBatch2(input)) {
|
|
42580
|
+
return splitArrowRecordBatchBuffers(input, options);
|
|
42581
|
+
}
|
|
42582
|
+
if (isArrowVector2(input)) {
|
|
42583
|
+
return splitArrowVectorBuffers(input, options);
|
|
42584
|
+
}
|
|
42585
|
+
return splitArrowDataBuffers(input, options);
|
|
42586
|
+
}
|
|
42587
|
+
function isArrowTable2(input) {
|
|
42588
|
+
return "batches" in input;
|
|
42589
|
+
}
|
|
42590
|
+
function isArrowRecordBatch2(input) {
|
|
42591
|
+
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
42592
|
+
}
|
|
42593
|
+
function isArrowVector2(input) {
|
|
42594
|
+
return "data" in input && Array.isArray(input.data);
|
|
42595
|
+
}
|
|
42596
|
+
function splitArrowTableBuffersInternal(table, options) {
|
|
42597
|
+
const recordBatches = table.batches.map(
|
|
42598
|
+
(recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
|
|
42599
|
+
);
|
|
42600
|
+
return new Table(table.schema, recordBatches);
|
|
42601
|
+
}
|
|
42602
|
+
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
42603
|
+
return new RecordBatch3(
|
|
42604
|
+
recordBatch.schema,
|
|
42605
|
+
splitArrowDataBuffers(recordBatch.data, options)
|
|
42606
|
+
);
|
|
42607
|
+
}
|
|
42608
|
+
function splitArrowDataBuffers(data, options) {
|
|
42609
|
+
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
42610
|
+
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
42611
|
+
const buffers = {
|
|
42612
|
+
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
42613
|
+
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
42614
|
+
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
42615
|
+
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
42616
|
+
};
|
|
42617
|
+
return new Data(
|
|
42618
|
+
data.type,
|
|
42619
|
+
data.offset,
|
|
42620
|
+
data.length,
|
|
42621
|
+
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
42622
|
+
data._nullCount,
|
|
42623
|
+
buffers,
|
|
42624
|
+
children,
|
|
42625
|
+
dictionary
|
|
42626
|
+
);
|
|
42627
|
+
}
|
|
42628
|
+
function splitArrowVectorBuffers(vector, options) {
|
|
42629
|
+
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
42630
|
+
}
|
|
42631
|
+
function splitArrowBuffer(array, options) {
|
|
42632
|
+
if (!isArrowTypedArray(array)) {
|
|
42633
|
+
return array;
|
|
42634
|
+
}
|
|
42635
|
+
if (options.copy === "none") {
|
|
42636
|
+
return array;
|
|
42637
|
+
}
|
|
42638
|
+
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
42639
|
+
return array;
|
|
42640
|
+
}
|
|
42641
|
+
return array.slice();
|
|
42642
|
+
}
|
|
42643
|
+
function isArrowTypedArray(value) {
|
|
42644
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
42645
|
+
}
|
|
42646
|
+
var init_split_arrow_buffers = __esm({
|
|
42647
|
+
"../arrow/src/lib/utils/split-arrow-buffers.ts"() {
|
|
42648
|
+
"use strict";
|
|
42649
|
+
init_Arrow_dom();
|
|
42650
|
+
}
|
|
42651
|
+
});
|
|
42652
|
+
|
|
42653
|
+
// ../arrow/src/lib/utils/arrow-table-transport.ts
|
|
42654
|
+
function dehydrateArrowTable(table, options) {
|
|
42655
|
+
const splitTable = splitArrowBuffers(table, options);
|
|
42656
|
+
return {
|
|
42657
|
+
shape: "arrow-table",
|
|
42658
|
+
transport: "arrow-js",
|
|
42659
|
+
schema: serializeArrowSchema(splitTable.schema),
|
|
42660
|
+
batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
|
|
42661
|
+
};
|
|
42662
|
+
}
|
|
42663
|
+
function hydrateArrowTable(table) {
|
|
42664
|
+
const schema = deserializeArrowSchema(table.schema);
|
|
42665
|
+
const recordBatches = table.batches.map(
|
|
42666
|
+
(recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
|
|
42667
|
+
);
|
|
42668
|
+
return new Table(schema, recordBatches);
|
|
42669
|
+
}
|
|
42670
|
+
function serializeArrowWorkerResult(result, options) {
|
|
42671
|
+
if (!isArrowTableWrapper(result)) {
|
|
42672
|
+
return result;
|
|
42673
|
+
}
|
|
42674
|
+
const workerOptions = options;
|
|
42675
|
+
const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
|
|
42676
|
+
return {
|
|
42677
|
+
...result,
|
|
42678
|
+
data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
|
|
42679
|
+
};
|
|
42680
|
+
}
|
|
42681
|
+
function deserializeArrowWorkerResult(result) {
|
|
42682
|
+
if (!isDehydratedArrowTableWrapper(result)) {
|
|
42683
|
+
return result;
|
|
42684
|
+
}
|
|
42685
|
+
return { ...result, data: hydrateArrowTable(result.data) };
|
|
42686
|
+
}
|
|
42687
|
+
function isArrowTableWrapper(value) {
|
|
42688
|
+
const table = value;
|
|
42689
|
+
return Boolean(
|
|
42690
|
+
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
42691
|
+
);
|
|
42692
|
+
}
|
|
42693
|
+
function isDehydratedArrowTableWrapper(value) {
|
|
42694
|
+
const table = value;
|
|
42695
|
+
return Boolean(
|
|
42696
|
+
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
42697
|
+
);
|
|
42698
|
+
}
|
|
42699
|
+
function dehydrateArrowRecordBatch(recordBatch) {
|
|
42700
|
+
return { data: dehydrateArrowData(recordBatch.data) };
|
|
42701
|
+
}
|
|
42702
|
+
function dehydrateArrowData(data) {
|
|
42703
|
+
return {
|
|
42704
|
+
type: serializeArrowType(data.type),
|
|
42705
|
+
offset: data.offset,
|
|
42706
|
+
length: data.length,
|
|
42707
|
+
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
42708
|
+
nullCount: data._nullCount,
|
|
42709
|
+
buffers: {
|
|
42710
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
42711
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
42712
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
42713
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
42714
|
+
},
|
|
42715
|
+
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
42716
|
+
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
42717
|
+
};
|
|
42718
|
+
}
|
|
42719
|
+
function dehydrateArrowVector(vector) {
|
|
42720
|
+
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
42721
|
+
}
|
|
42722
|
+
function hydrateArrowData(data) {
|
|
42723
|
+
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
42724
|
+
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
42725
|
+
return new Data(
|
|
42726
|
+
deserializeArrowType(data.type),
|
|
42727
|
+
data.offset,
|
|
42728
|
+
data.length,
|
|
42729
|
+
data.nullCount,
|
|
42730
|
+
data.buffers,
|
|
42731
|
+
children,
|
|
42732
|
+
dictionary
|
|
42733
|
+
);
|
|
42734
|
+
}
|
|
42735
|
+
function hydrateArrowVector(vector) {
|
|
42736
|
+
return new Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
42737
|
+
}
|
|
42738
|
+
var init_arrow_table_transport = __esm({
|
|
42739
|
+
"../arrow/src/lib/utils/arrow-table-transport.ts"() {
|
|
42740
|
+
"use strict";
|
|
42741
|
+
init_Arrow_dom();
|
|
42742
|
+
init_src();
|
|
42743
|
+
init_split_arrow_buffers();
|
|
42744
|
+
}
|
|
42745
|
+
});
|
|
42746
|
+
|
|
42747
|
+
// ../arrow/src/transport.ts
|
|
42748
|
+
var init_transport = __esm({
|
|
42749
|
+
"../arrow/src/transport.ts"() {
|
|
42750
|
+
"use strict";
|
|
42751
|
+
init_arrow_table_transport();
|
|
42752
|
+
}
|
|
42753
|
+
});
|
|
42754
|
+
|
|
42560
42755
|
// src/excel-loader.ts
|
|
42561
42756
|
async function preload() {
|
|
42562
42757
|
const { ExcelLoaderWithParser: ExcelLoaderWithParser2 } = await Promise.resolve().then(() => (init_excel_loader_with_parser(), excel_loader_with_parser_exports));
|
|
42563
42758
|
return ExcelLoaderWithParser2;
|
|
42564
42759
|
}
|
|
42565
|
-
var VERSION,
|
|
42760
|
+
var VERSION, ExcelLoader, ExcelWorkerLoader;
|
|
42566
42761
|
var init_excel_loader = __esm({
|
|
42567
42762
|
"src/excel-loader.ts"() {
|
|
42568
42763
|
"use strict";
|
|
42569
42764
|
init_excel_format();
|
|
42570
|
-
|
|
42571
|
-
|
|
42765
|
+
init_transport();
|
|
42766
|
+
VERSION = true ? "5.0.0-alpha.7" : "latest";
|
|
42767
|
+
ExcelLoader = {
|
|
42572
42768
|
...ExcelFormat,
|
|
42573
42769
|
dataType: null,
|
|
42574
42770
|
batchType: null,
|
|
42575
42771
|
version: VERSION,
|
|
42576
42772
|
worker: true,
|
|
42773
|
+
serializeWorkerResult: serializeArrowWorkerResult,
|
|
42774
|
+
deserializeWorkerResult: deserializeArrowWorkerResult,
|
|
42577
42775
|
options: {
|
|
42578
42776
|
excel: {
|
|
42579
|
-
shape: "
|
|
42777
|
+
shape: "arrow-table",
|
|
42580
42778
|
sheet: void 0
|
|
42581
42779
|
// Load default Sheet
|
|
42582
42780
|
}
|
|
42583
42781
|
},
|
|
42584
42782
|
preload
|
|
42585
42783
|
};
|
|
42586
|
-
|
|
42587
|
-
...ExcelWorkerLoader,
|
|
42588
|
-
preload
|
|
42589
|
-
};
|
|
42784
|
+
ExcelWorkerLoader = ExcelLoader;
|
|
42590
42785
|
}
|
|
42591
42786
|
});
|
|
42592
42787
|
|
|
@@ -42936,9 +43131,22 @@ return true;`);
|
|
|
42936
43131
|
}
|
|
42937
43132
|
|
|
42938
43133
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
42939
|
-
async function createLoaderWorker(loader) {
|
|
43134
|
+
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
42940
43135
|
await createWorker(
|
|
42941
|
-
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
43136
|
+
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
43137
|
+
selectLoader(options || {}),
|
|
43138
|
+
input,
|
|
43139
|
+
options,
|
|
43140
|
+
workerContext,
|
|
43141
|
+
loaderContext
|
|
43142
|
+
),
|
|
43143
|
+
(inputIterator, options, workerContext, loaderContext) => processLoaderWorkerBatches(
|
|
43144
|
+
selectLoader(options || {}),
|
|
43145
|
+
inputIterator,
|
|
43146
|
+
options,
|
|
43147
|
+
workerContext,
|
|
43148
|
+
loaderContext
|
|
43149
|
+
)
|
|
42942
43150
|
);
|
|
42943
43151
|
}
|
|
42944
43152
|
async function processLoaderWorkerData(loader, input, options = {}, workerContext, loaderContext = {}) {
|
|
@@ -42954,6 +43162,19 @@ return true;`);
|
|
|
42954
43162
|
});
|
|
42955
43163
|
return loader.serializeWorkerResult ? loader.serializeWorkerResult(result, options, loaderContext) : result;
|
|
42956
43164
|
}
|
|
43165
|
+
async function* processLoaderWorkerBatches(loader, inputIterator, options = {}, workerContext, loaderContext = {}) {
|
|
43166
|
+
if (!loader.parseInBatches) {
|
|
43167
|
+
throw new Error(`${loader.id} loader does not support batched parsing`);
|
|
43168
|
+
}
|
|
43169
|
+
const resultIterator = loader.parseInBatches(inputIterator, options, {
|
|
43170
|
+
...loaderContext,
|
|
43171
|
+
coreApi: createWorkerCoreApi(),
|
|
43172
|
+
_parse: createParseOnMainThread(workerContext?.process)
|
|
43173
|
+
});
|
|
43174
|
+
for await (const batch of resultIterator) {
|
|
43175
|
+
yield loader.serializeWorkerBatch ? loader.serializeWorkerBatch(batch, options, loaderContext) : batch;
|
|
43176
|
+
}
|
|
43177
|
+
}
|
|
42957
43178
|
function createWorkerCoreApi() {
|
|
42958
43179
|
const unavailable = (methodName) => () => {
|
|
42959
43180
|
throw new Error(`context.coreApi.${methodName} is unavailable inside worker loaders.`);
|