@pilotdev/pilot-bim-dataprovider 25.9.0 → 25.10.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/lib/index.d.ts +4 -9
- package/lib/index.js +2 -5
- package/lib/index.js.map +1 -1
- package/lib/src/BimDataProviderApi.d.ts +52 -0
- package/lib/src/BimDataProviderApi.js +2 -0
- package/lib/src/BimDataProviderApi.js.map +1 -0
- package/lib/src/model/{BimDataIfcType.d.ts → BimDataClasses.d.ts} +159 -0
- package/lib/src/model/{BimDataIfcType.js → BimDataClasses.js} +203 -1
- package/lib/src/model/BimDataClasses.js.map +1 -0
- package/lib/src/model/BimDataCloudPart.d.ts +5 -9
- package/lib/src/model/BimDataCloudPart.js +11 -12
- package/lib/src/model/BimDataCloudPart.js.map +1 -1
- package/lib/src/model/BimDataModelPart.d.ts +4 -23
- package/lib/src/model/BimDataModelPart.js +22 -36
- package/lib/src/model/BimDataModelPart.js.map +1 -1
- package/lib/src/model/BimDataPart.d.ts +11 -21
- package/lib/src/model/BimDataPart.js +41 -67
- package/lib/src/model/BimDataPart.js.map +1 -1
- package/lib/src/model/BimDataProvider.d.ts +4 -17
- package/lib/src/model/BimDataProvider.js +18 -27
- package/lib/src/model/BimDataProvider.js.map +1 -1
- package/lib/src/utils/Consts.d.ts +17 -0
- package/lib/src/utils/Consts.js +20 -0
- package/lib/src/utils/Consts.js.map +1 -0
- package/lib/src/utils/ViewerTools.d.ts +17 -16
- package/lib/src/utils/ViewerTools.js +39 -21
- package/lib/src/utils/ViewerTools.js.map +1 -1
- package/lib/src/wasm/WasmWorker.d.ts +22 -70
- package/lib/src/wasm/WasmWorker.js +89 -180
- package/lib/src/wasm/WasmWorker.js.map +1 -1
- package/lib/src/wasm/{WasmWorkerThreadSafeWrapper.d.ts → WorkerApi.d.ts} +39 -21
- package/lib/src/wasm/WorkerApi.js +2 -0
- package/lib/src/wasm/WorkerApi.js.map +1 -0
- package/lib/src/wasm/cloud_readers/BinaryCloudReader.d.ts +18 -0
- package/lib/src/wasm/cloud_readers/BinaryCloudReader.js +228 -0
- package/lib/src/wasm/cloud_readers/BinaryCloudReader.js.map +1 -0
- package/lib/src/wasm/{DataAccessors → cloud_readers}/ICloudReader.d.ts +6 -6
- package/lib/src/wasm/cloud_readers/ICloudReader.js.map +1 -0
- package/lib/src/wasm/cloud_readers/WasmCloudReader.d.ts +20 -0
- package/lib/src/wasm/cloud_readers/WasmCloudReader.js +53 -0
- package/lib/src/wasm/cloud_readers/WasmCloudReader.js.map +1 -0
- package/lib/src/wasm/data_accessors/CloudPartAccessor.d.ts +20 -0
- package/lib/src/wasm/data_accessors/CloudPartAccessor.js +70 -0
- package/lib/src/wasm/data_accessors/CloudPartAccessor.js.map +1 -0
- package/lib/src/wasm/data_accessors/FileAccessor.d.ts +37 -0
- package/lib/src/wasm/data_accessors/FileAccessor.js +237 -0
- package/lib/src/wasm/data_accessors/FileAccessor.js.map +1 -0
- package/lib/src/wasm/data_accessors/ModelPartAccessor.d.ts +27 -0
- package/lib/src/wasm/data_accessors/ModelPartAccessor.js +142 -0
- package/lib/src/wasm/data_accessors/ModelPartAccessor.js.map +1 -0
- package/lib/src/wasm/file-system/File.d.ts +30 -0
- package/lib/src/wasm/file-system/File.js +58 -0
- package/lib/src/wasm/file-system/File.js.map +1 -0
- package/lib/src/wasm/file-system/FileAccessDispatcher.d.ts +12 -0
- package/lib/src/{model → wasm/file-system}/FileAccessDispatcher.js +59 -21
- package/lib/src/wasm/file-system/FileAccessDispatcher.js.map +1 -0
- package/lib/src/wasm/file-system/FileLoader.d.ts +41 -0
- package/lib/src/wasm/file-system/FileLoader.js +107 -0
- package/lib/src/wasm/file-system/FileLoader.js.map +1 -0
- package/lib/src/wasm/file-system/IFileSystem.d.ts +76 -0
- package/lib/src/wasm/file-system/IFileSystem.js +308 -0
- package/lib/src/wasm/file-system/IFileSystem.js.map +1 -0
- package/lib/src/{file-system → wasm/file-system}/IFileSystemCache.d.ts +10 -6
- package/lib/src/{file-system → wasm/file-system}/IFileSystemCache.js +11 -13
- package/lib/src/wasm/file-system/IFileSystemCache.js.map +1 -0
- package/lib/src/{file-system → wasm/file-system}/OPFS.d.ts +6 -6
- package/lib/src/{file-system → wasm/file-system}/OPFS.js +7 -3
- package/lib/src/wasm/file-system/OPFS.js.map +1 -0
- package/lib/src/wasm/file-system/PATH.js.map +1 -0
- package/lib/src/wasm/file-system/PartialFile.d.ts +48 -0
- package/lib/src/wasm/file-system/PartialFile.js +367 -0
- package/lib/src/wasm/file-system/PartialFile.js.map +1 -0
- package/lib/src/wasm/pilot_bim_dataprovider.d.ts +17 -1
- package/lib/src/wasm/wasm.worker-node.cjs +1 -1
- package/lib/src/wasm/wasm.worker-web.cjs +1 -1
- package/lib/src/wasm/worker.js +2 -0
- package/lib/src/wasm/worker.js.map +1 -1
- package/package.json +3 -4
- package/lib/src/file-system/IFileSystem.d.ts +0 -50
- package/lib/src/file-system/IFileSystem.js +0 -233
- package/lib/src/file-system/IFileSystem.js.map +0 -1
- package/lib/src/file-system/IFileSystemCache.js.map +0 -1
- package/lib/src/file-system/OPFS.js.map +0 -1
- package/lib/src/file-system/PATH.js.map +0 -1
- package/lib/src/model/BimDataElement.d.ts +0 -113
- package/lib/src/model/BimDataElement.js +0 -45
- package/lib/src/model/BimDataElement.js.map +0 -1
- package/lib/src/model/BimDataElementPropertySet.d.ts +0 -26
- package/lib/src/model/BimDataElementPropertySet.js +0 -90
- package/lib/src/model/BimDataElementPropertySet.js.map +0 -1
- package/lib/src/model/BimDataIfcRepresentationStatus.d.ts +0 -10
- package/lib/src/model/BimDataIfcRepresentationStatus.js +0 -12
- package/lib/src/model/BimDataIfcRepresentationStatus.js.map +0 -1
- package/lib/src/model/BimDataIfcType.js.map +0 -1
- package/lib/src/model/BimDataTessellation.d.ts +0 -13
- package/lib/src/model/BimDataTessellation.js +0 -16
- package/lib/src/model/BimDataTessellation.js.map +0 -1
- package/lib/src/model/Consts.d.ts +0 -7
- package/lib/src/model/Consts.js +0 -8
- package/lib/src/model/Consts.js.map +0 -1
- package/lib/src/model/FileAccessDispatcher.d.ts +0 -14
- package/lib/src/model/FileAccessDispatcher.js.map +0 -1
- package/lib/src/wasm/DataAccessors/BimCloudPartAccessor.d.ts +0 -17
- package/lib/src/wasm/DataAccessors/BimCloudPartAccessor.js +0 -60
- package/lib/src/wasm/DataAccessors/BimCloudPartAccessor.js.map +0 -1
- package/lib/src/wasm/DataAccessors/BimDataModelPartAccessor.d.ts +0 -20
- package/lib/src/wasm/DataAccessors/BimDataModelPartAccessor.js +0 -89
- package/lib/src/wasm/DataAccessors/BimDataModelPartAccessor.js.map +0 -1
- package/lib/src/wasm/DataAccessors/BimDataPartAccessor.d.ts +0 -8
- package/lib/src/wasm/DataAccessors/BimDataPartAccessor.js +0 -19
- package/lib/src/wasm/DataAccessors/BimDataPartAccessor.js.map +0 -1
- package/lib/src/wasm/DataAccessors/BinaryCloudReader.d.ts +0 -16
- package/lib/src/wasm/DataAccessors/BinaryCloudReader.js +0 -268
- package/lib/src/wasm/DataAccessors/BinaryCloudReader.js.map +0 -1
- package/lib/src/wasm/DataAccessors/ICloudReader.js.map +0 -1
- package/lib/src/wasm/DataAccessors/WasmCloudReader.d.ts +0 -16
- package/lib/src/wasm/DataAccessors/WasmCloudReader.js +0 -47
- package/lib/src/wasm/DataAccessors/WasmCloudReader.js.map +0 -1
- package/lib/src/wasm/WasmWorkerThreadSafeWrapper.js +0 -141
- package/lib/src/wasm/WasmWorkerThreadSafeWrapper.js.map +0 -1
- /package/lib/src/wasm/{DataAccessors → cloud_readers}/ICloudReader.js +0 -0
- /package/lib/src/{file-system → wasm/file-system}/PATH.d.ts +0 -0
- /package/lib/src/{file-system → wasm/file-system}/PATH.js +0 -0
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import * as comlink from "comlink";
|
|
2
2
|
import { BimDataBase } from "./BimDataPart.js";
|
|
3
3
|
export class BimDataModelPart extends BimDataBase {
|
|
4
|
-
async open(buffer) {
|
|
5
|
-
await super.open(buffer);
|
|
6
|
-
this.checkIsOpen();
|
|
7
|
-
}
|
|
8
4
|
async update(buffer) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const id = "tmp_" + (0xffffffff * Math.random() >>> 0);
|
|
6
|
+
const tmpDataPart = new BimDataBase(id, this._remote);
|
|
7
|
+
await tmpDataPart.init();
|
|
8
|
+
await tmpDataPart.open(buffer);
|
|
9
|
+
await this._remote.modelPartAccessor.mergeModelParts(this.lockId, tmpDataPart.lockId);
|
|
10
|
+
await tmpDataPart.remove();
|
|
11
|
+
await tmpDataPart.dispose();
|
|
12
12
|
}
|
|
13
13
|
async mergeWith(dataPartId) {
|
|
14
|
-
this.
|
|
15
|
-
return this._remote.mergeModelParts(this.id, dataPartId);
|
|
14
|
+
return this._remote.modelPartAccessor.mergeModelParts(this.lockId, dataPartId);
|
|
16
15
|
}
|
|
17
16
|
async getAllTessellations(compressed = false) {
|
|
18
|
-
this.checkIsOpen();
|
|
19
17
|
const map = new Map();
|
|
20
18
|
const transmitProxy = comlink.proxy((tessellations) => this.fillTessMap(map, tessellations));
|
|
21
|
-
await this._remote.getAllTessellations(this.
|
|
19
|
+
await this._remote.modelPartAccessor.getAllTessellations(this.lockId, compressed, transmitProxy);
|
|
22
20
|
return map;
|
|
23
21
|
}
|
|
24
22
|
async getTessellations(versionFrom, versionTo, compressed = false) {
|
|
25
|
-
this.checkIsOpen();
|
|
26
23
|
const map = new Map();
|
|
27
24
|
const tessArray = [];
|
|
28
25
|
const transmitProxy = comlink.proxy((tessellations) => this.fillArray(tessArray, tessellations));
|
|
29
26
|
let firstItemIdx = BigInt(0);
|
|
30
27
|
while (true) {
|
|
31
|
-
const nextItemIdx = await this._remote.getTessellations(this.
|
|
28
|
+
const nextItemIdx = await this._remote.modelPartAccessor.getTessellations(this.lockId, versionFrom, versionTo, firstItemIdx, compressed, transmitProxy);
|
|
32
29
|
if (nextItemIdx == BigInt(0)) {
|
|
33
30
|
break;
|
|
34
31
|
}
|
|
@@ -41,79 +38,68 @@ export class BimDataModelPart extends BimDataBase {
|
|
|
41
38
|
return map;
|
|
42
39
|
}
|
|
43
40
|
async getTessellationsInfo(versionFrom, versionTo, compressed = false) {
|
|
44
|
-
this.checkIsOpen();
|
|
45
41
|
const map = new Map();
|
|
46
42
|
const tessInfoArray = [];
|
|
47
43
|
const transmitProxy = comlink.proxy((tessellationsInfo) => this.fillArray(tessInfoArray, tessellationsInfo));
|
|
48
|
-
await this._remote.getTessellationsInfo(this.
|
|
44
|
+
await this._remote.modelPartAccessor.getTessellationsInfo(this.lockId, versionFrom, versionTo, compressed, transmitProxy);
|
|
49
45
|
tessInfoArray.forEach(x => map.set(x.key, x));
|
|
50
46
|
return map;
|
|
51
47
|
}
|
|
52
48
|
async getTessellation(tessellationKey, version, compressed = false) {
|
|
53
|
-
this.
|
|
54
|
-
return await this._remote.getTessellation(this.id, tessellationKey, version, compressed);
|
|
49
|
+
return await this._remote.modelPartAccessor.getTessellation(this.lockId, tessellationKey, version, compressed);
|
|
55
50
|
}
|
|
56
51
|
async getTessellationsById(tessellations, version, compressed = false) {
|
|
57
|
-
this.checkIsOpen();
|
|
58
52
|
const map = new Map();
|
|
59
53
|
const transmitProxy = comlink.proxy((tessellations) => this.fillTessMap(map, tessellations));
|
|
60
|
-
await this._remote.getTessellationsByIds(this.
|
|
54
|
+
await this._remote.modelPartAccessor.getTessellationsByIds(this.lockId, tessellations, version, compressed, transmitProxy);
|
|
61
55
|
return map;
|
|
62
56
|
}
|
|
63
57
|
async getAllElements() {
|
|
64
|
-
this.checkIsOpen();
|
|
65
58
|
const transmitResult = [];
|
|
66
59
|
const transmitProxy = comlink.proxy((elements) => this.fillArray(transmitResult, elements));
|
|
67
|
-
await this._remote.getAllElements(this.
|
|
60
|
+
await this._remote.modelPartAccessor.getAllElements(this.lockId, transmitProxy);
|
|
68
61
|
return transmitResult;
|
|
69
62
|
}
|
|
70
63
|
async getElements(versionFrom, versionTo) {
|
|
71
|
-
this.checkIsOpen();
|
|
72
64
|
const transmitResult = [];
|
|
73
65
|
const transmitProxy = comlink.proxy((elements) => this.fillArray(transmitResult, elements));
|
|
74
|
-
await this._remote.getElements(this.
|
|
66
|
+
await this._remote.modelPartAccessor.getElements(this.lockId, versionFrom, versionTo, transmitProxy);
|
|
75
67
|
return transmitResult;
|
|
76
68
|
}
|
|
77
69
|
async getDiffElements(versionFrom, versionTo) {
|
|
78
|
-
this.checkIsOpen();
|
|
79
70
|
const transmitResult = [];
|
|
80
71
|
const transmitProxy = comlink.proxy((elements) => this.fillArray(transmitResult, elements));
|
|
81
|
-
await this._remote.getDiffElements(this.
|
|
72
|
+
await this._remote.modelPartAccessor.getDiffElements(this.lockId, versionFrom, versionTo, transmitProxy);
|
|
82
73
|
return transmitResult;
|
|
83
74
|
}
|
|
84
75
|
async getElementProperties(elementId, version) {
|
|
85
|
-
this.
|
|
86
|
-
return this._remote.getElementProperties(this.id, elementId, version);
|
|
76
|
+
return this._remote.modelPartAccessor.getElementProperties(this.lockId, elementId, version);
|
|
87
77
|
}
|
|
88
78
|
async getElementPropertiesByIds(indexes, version, chunks = false) {
|
|
89
|
-
this.checkIsOpen();
|
|
90
79
|
if (!chunks) {
|
|
91
|
-
return this._remote.getElementPropertiesByIds(this.
|
|
80
|
+
return this._remote.modelPartAccessor.getElementPropertiesByIds(this.lockId, indexes, version);
|
|
92
81
|
}
|
|
93
82
|
const result = new Map();
|
|
94
83
|
const chunkElements = 10000;
|
|
95
84
|
for (let i = 0; i < indexes.length; i += chunkElements) {
|
|
96
85
|
const endIdx = Math.min(i + chunkElements, indexes.length);
|
|
97
|
-
const chunk = await this._remote.getElementPropertiesByIds(this.
|
|
86
|
+
const chunk = await this._remote.modelPartAccessor.getElementPropertiesByIds(this.lockId, indexes.slice(i, endIdx), version);
|
|
98
87
|
await this._remote.flushMemory();
|
|
99
88
|
chunk.forEach((value, key) => result.set(key, value));
|
|
100
89
|
}
|
|
101
90
|
return Promise.resolve(result);
|
|
102
91
|
}
|
|
103
92
|
async getElementTessellations(versionFrom, versionTo, compressed = false) {
|
|
104
|
-
this.checkIsOpen();
|
|
105
93
|
const map = new Map();
|
|
106
|
-
const result = await this._remote.getElementTessellations(this.
|
|
94
|
+
const result = await this._remote.modelPartAccessor.getElementTessellations(this.lockId, versionFrom, versionTo, compressed);
|
|
107
95
|
this.fillTessMap(map, result);
|
|
108
96
|
return map;
|
|
109
97
|
}
|
|
110
98
|
async getAllVersions() {
|
|
111
|
-
this.
|
|
112
|
-
return this._remote.getAllVersions(this.id);
|
|
99
|
+
return this._remote.modelPartAccessor.getAllVersions(this.lockId);
|
|
113
100
|
}
|
|
114
101
|
async getLatestVersion() {
|
|
115
|
-
this.
|
|
116
|
-
return this._remote.getLatestVersion(this.id);
|
|
102
|
+
return this._remote.modelPartAccessor.getLatestVersion(this.lockId);
|
|
117
103
|
}
|
|
118
104
|
fillTessMap(map, array) {
|
|
119
105
|
for (let i = 0; i < array.length; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BimDataModelPart.js","sourceRoot":"","sources":["../../../src/model/BimDataModelPart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"BimDataModelPart.js","sourceRoot":"","sources":["../../../src/model/BimDataModelPart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,WAAW,EAAU,MAAM,kBAAkB,CAAC;AAIvD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAE/C,KAAK,CAAC,MAAM,CAAC,MAAqC;QAChD,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,EAAE,IAAI,CA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ink from "comlink";
|
|
2
|
-
import {
|
|
2
|
+
import { WasmWorker } from "../wasm/WasmWorker.js";
|
|
3
|
+
import { IBimDataPart, OpenOptions } from "../BimDataProviderApi.js";
|
|
3
4
|
export type TProxy<T> = (t: T[]) => Promise<void>;
|
|
4
|
-
export interface IBimDataPart {
|
|
5
|
-
id: string;
|
|
6
|
-
open(buffer?: ArrayBuffer): Promise<void>;
|
|
7
|
-
write(buffer: ArrayBuffer, position: number): Promise<void>;
|
|
8
|
-
isValid(): Promise<boolean>;
|
|
9
|
-
close(): Promise<void>;
|
|
10
|
-
remove(): Promise<void>;
|
|
11
|
-
dispose(): Promise<void>;
|
|
12
|
-
}
|
|
13
5
|
export declare class BimDataBase implements IBimDataPart {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
private
|
|
6
|
+
protected _remote: comlink.Remote<WasmWorker>;
|
|
7
|
+
private _isOpen;
|
|
8
|
+
private _sourceFileId;
|
|
9
|
+
private _lockedFileId?;
|
|
10
|
+
constructor(sourceId: string, module: comlink.Remote<WasmWorker>);
|
|
18
11
|
get id(): string;
|
|
19
|
-
private static _tabId;
|
|
20
|
-
private static _fileAccessDispatcher;
|
|
21
|
-
constructor(_sourceFileId: string, module: comlink.Remote<WasmWorkerThreadSafeWrapper>);
|
|
22
|
-
init(): Promise<void>;
|
|
23
12
|
get isOpen(): boolean;
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
get lockId(): string;
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
open(source?: ArrayBuffer | ArrayBufferView | Blob | string, options?: OpenOptions): Promise<void>;
|
|
16
|
+
write(buffer: ArrayBuffer | ArrayBufferView, position: number): Promise<void>;
|
|
26
17
|
close(): Promise<void>;
|
|
27
18
|
dispose(): Promise<void>;
|
|
28
19
|
remove(): Promise<void>;
|
|
29
20
|
isValid(): Promise<boolean>;
|
|
30
|
-
protected checkIsOpen(): void;
|
|
31
21
|
protected fillArray<T>(target: T[], source: T[]): void;
|
|
32
22
|
}
|
|
@@ -1,79 +1,63 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
import * as comlink from "comlink";
|
|
3
|
-
import { isOPFSEnabled } from "../utils/ViewerTools.js";
|
|
4
|
-
import { FileAccessDispatcher, FileStatus } from "./FileAccessDispatcher.js";
|
|
5
2
|
export class BimDataBase {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
;
|
|
10
|
-
constructor(
|
|
11
|
-
this._sourceFileId = _sourceFileId;
|
|
12
|
-
this._remote = module;
|
|
3
|
+
_remote;
|
|
4
|
+
_isOpen;
|
|
5
|
+
_sourceFileId;
|
|
6
|
+
_lockedFileId;
|
|
7
|
+
constructor(sourceId, module) {
|
|
13
8
|
this._isOpen = false;
|
|
9
|
+
this._remote = module;
|
|
10
|
+
this._sourceFileId = sourceId;
|
|
11
|
+
this._lockedFileId = sourceId;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const copyFunc = async (targetPath, sourcePath) => {
|
|
20
|
-
try {
|
|
21
|
-
await this._remote.copy(targetPath, sourcePath);
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const copyId = BimDataBase._tabId + '_' + this._sourceFileId;
|
|
29
|
-
const fileStatus = await BimDataBase._fileAccessDispatcher.lockFile(this._sourceFileId, copyId, copyFunc);
|
|
30
|
-
switch (fileStatus) {
|
|
31
|
-
case FileStatus.Source:
|
|
32
|
-
break;
|
|
33
|
-
case FileStatus.Copy:
|
|
34
|
-
this._copyFileId = copyId;
|
|
35
|
-
await this._remote.open(copyId, undefined); // update tree cache
|
|
36
|
-
await this._remote.close(copyId);
|
|
37
|
-
break;
|
|
38
|
-
case FileStatus.Failed:
|
|
39
|
-
throw new Error("Failed to copy file.");
|
|
40
|
-
}
|
|
13
|
+
get id() {
|
|
14
|
+
return this._sourceFileId;
|
|
41
15
|
}
|
|
42
16
|
get isOpen() {
|
|
43
17
|
return this._isOpen;
|
|
44
18
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
19
|
+
get lockId() {
|
|
20
|
+
return this._lockedFileId ?? this._sourceFileId;
|
|
21
|
+
}
|
|
22
|
+
async init() {
|
|
23
|
+
this._lockedFileId = await this._remote.fileAccessor.lockFile(this.id);
|
|
24
|
+
}
|
|
25
|
+
async open(source, options) {
|
|
26
|
+
if (ArrayBuffer.isView(source) || source instanceof ArrayBuffer) {
|
|
27
|
+
comlink.transfer(source, [ArrayBuffer.isView(source) ? source.buffer : source]);
|
|
28
|
+
}
|
|
29
|
+
await this._remote.fileAccessor.open(this.lockId, source, options);
|
|
49
30
|
this._isOpen = true;
|
|
50
31
|
}
|
|
51
32
|
async write(buffer, position) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
await this._remote.write(this.id, buffer, position);
|
|
33
|
+
comlink.transfer(buffer, [ArrayBuffer.isView(buffer) ? buffer.buffer : buffer]);
|
|
34
|
+
await this._remote.fileAccessor.write(this.lockId, buffer, position);
|
|
55
35
|
}
|
|
56
36
|
async close() {
|
|
57
|
-
|
|
58
|
-
|
|
37
|
+
if (this._isOpen) {
|
|
38
|
+
await this._remote.fileAccessor.close(this.lockId);
|
|
39
|
+
this._isOpen = false;
|
|
40
|
+
}
|
|
59
41
|
}
|
|
60
42
|
async dispose() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
else
|
|
64
|
-
await this.remove();
|
|
65
|
-
await BimDataBase._fileAccessDispatcher?.unlockFile(this.id);
|
|
43
|
+
await this.close();
|
|
44
|
+
await this._remote.fileAccessor.unlockFile(this.lockId);
|
|
66
45
|
}
|
|
67
46
|
async remove() {
|
|
68
|
-
this.
|
|
69
|
-
await this.
|
|
47
|
+
await this._remote.fileAccessor.remove(this.lockId);
|
|
48
|
+
await this.close();
|
|
70
49
|
}
|
|
71
50
|
async isValid() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
51
|
+
try {
|
|
52
|
+
// check if file is valid: exist and can be accessed
|
|
53
|
+
if (!await this._remote.fileAccessor.isValid(this.lockId))
|
|
54
|
+
return false;
|
|
55
|
+
// check if file is can be read by modelPartAccessor or cloudPartAccessor
|
|
56
|
+
return (await this._remote.modelPartAccessor.isValid(this.lockId) || await this._remote.cloudPartAccessor.isValid(this.lockId));
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
77
61
|
}
|
|
78
62
|
fillArray(target, source) {
|
|
79
63
|
for (let i = 0; i < source.length; i++) {
|
|
@@ -81,14 +65,4 @@ export class BimDataBase {
|
|
|
81
65
|
}
|
|
82
66
|
}
|
|
83
67
|
}
|
|
84
|
-
_a = BimDataBase;
|
|
85
|
-
BimDataBase._tabId = (0xffffffff * Math.random() >>> 0) + '';
|
|
86
|
-
(() => {
|
|
87
|
-
if (isOPFSEnabled) {
|
|
88
|
-
_a._fileAccessDispatcher = new FileAccessDispatcher();
|
|
89
|
-
addEventListener('beforeunload', async () => {
|
|
90
|
-
await _a._fileAccessDispatcher.dispose();
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
})();
|
|
94
68
|
//# sourceMappingURL=BimDataPart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BimDataPart.js","sourceRoot":"","sources":["../../../src/model/BimDataPart.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BimDataPart.js","sourceRoot":"","sources":["../../../src/model/BimDataPart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAMnC,MAAM,OAAO,WAAW;IACZ,OAAO,CAA6B;IACtC,OAAO,CAAU;IACjB,aAAa,CAAS;IACtB,aAAa,CAAU;IAE/B,YAAY,QAAgB,EAAE,MAAkC;QAC9D,IAAI,CAAC,OAA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AAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB;IACH,CAAC;CACF"}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
import { IBimDataPart } from
|
|
2
|
-
import { IBimDataModelPart } from './BimDataModelPart.js';
|
|
3
|
-
import { IBimDataCloudPart } from './BimDataCloudPart.js';
|
|
4
|
-
export type FSType = 'OPFS' | 'MEMFS';
|
|
5
|
-
export interface IBimDataProvider {
|
|
6
|
-
init(): Promise<void>;
|
|
7
|
-
createDataFile(id: string): Promise<IBimDataPart>;
|
|
8
|
-
openModelPart(dataFile: IBimDataPart): Promise<IBimDataModelPart | undefined>;
|
|
9
|
-
openModelPart(id: string, buffer: ArrayBuffer): Promise<IBimDataModelPart | undefined>;
|
|
10
|
-
openCloudPart(dataFile: IBimDataPart): Promise<IBimDataCloudPart | undefined>;
|
|
11
|
-
openCloudPart(id: string, buffer: ArrayBuffer): Promise<IBimDataCloudPart | undefined>;
|
|
12
|
-
dispose(): Promise<void>;
|
|
13
|
-
flushMemory(): Promise<void>;
|
|
14
|
-
}
|
|
1
|
+
import { FlushMemoryOptions, FSType, IBimDataCloudPart, IBimDataModelPart, IBimDataPart, IBimDataProvider, OpenOptions } from "../BimDataProviderApi.js";
|
|
15
2
|
export declare class BimDataProvider implements IBimDataProvider {
|
|
16
3
|
private _workerObj;
|
|
17
4
|
get usedFSType(): FSType;
|
|
18
5
|
init(): Promise<void>;
|
|
19
6
|
createDataFile(id: string): Promise<IBimDataPart>;
|
|
20
|
-
openModelPart(
|
|
21
|
-
openCloudPart(
|
|
22
|
-
flushMemory(): Promise<void>;
|
|
7
|
+
openModelPart(sourceId: string | IBimDataPart, sourceData?: ArrayBuffer | ArrayBufferView | Blob | string, options?: OpenOptions): Promise<IBimDataModelPart>;
|
|
8
|
+
openCloudPart(sourceId: string | IBimDataPart, sourceData?: ArrayBuffer | ArrayBufferView | Blob | string, options?: OpenOptions): Promise<IBimDataCloudPart>;
|
|
9
|
+
flushMemory(options?: FlushMemoryOptions): Promise<void>;
|
|
23
10
|
dispose(): Promise<void>;
|
|
24
11
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BimDataBase } from './BimDataPart.js';
|
|
2
2
|
import { BimDataModelPart } from './BimDataModelPart.js';
|
|
3
|
-
import { BimDataCloudPart
|
|
3
|
+
import { BimDataCloudPart } from './BimDataCloudPart.js';
|
|
4
4
|
import { CorsWorker as Worker } from '../wasm/worker.js';
|
|
5
5
|
import { isOPFSEnabled } from "../utils/ViewerTools.js";
|
|
6
6
|
export class BimDataProvider {
|
|
7
|
+
_workerObj;
|
|
7
8
|
get usedFSType() {
|
|
8
9
|
return isOPFSEnabled ? 'OPFS' : 'MEMFS';
|
|
9
10
|
}
|
|
@@ -18,36 +19,26 @@ export class BimDataProvider {
|
|
|
18
19
|
await result.init();
|
|
19
20
|
return result;
|
|
20
21
|
}
|
|
21
|
-
async openModelPart(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
else {
|
|
29
|
-
modelPart = new BimDataModelPart(source.id, this._workerObj);
|
|
30
|
-
await modelPart.init();
|
|
31
|
-
await modelPart.open();
|
|
32
|
-
}
|
|
22
|
+
async openModelPart(sourceId, sourceData, options) {
|
|
23
|
+
const id = typeof sourceId == 'string' ? sourceId : sourceId.id;
|
|
24
|
+
const modelPart = new BimDataModelPart(id, this._workerObj);
|
|
25
|
+
await modelPart.init();
|
|
26
|
+
await modelPart.open(sourceData, options);
|
|
27
|
+
if (!await modelPart.isValid())
|
|
28
|
+
throw new Error("Given 3D model is not supported");
|
|
33
29
|
return modelPart;
|
|
34
30
|
}
|
|
35
|
-
async openCloudPart(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
else {
|
|
43
|
-
cloudPart = new BimDataCloudPart(source.id, this._workerObj);
|
|
44
|
-
await cloudPart.init();
|
|
45
|
-
await cloudPart.open();
|
|
46
|
-
}
|
|
31
|
+
async openCloudPart(sourceId, sourceData, options) {
|
|
32
|
+
const id = typeof sourceId == 'string' ? sourceId : sourceId.id;
|
|
33
|
+
const cloudPart = new BimDataCloudPart(id, this._workerObj);
|
|
34
|
+
await cloudPart.init();
|
|
35
|
+
await cloudPart.open(sourceData, options);
|
|
36
|
+
if (!await cloudPart.isValid())
|
|
37
|
+
throw new Error("Given 3D model is not supported");
|
|
47
38
|
return cloudPart;
|
|
48
39
|
}
|
|
49
|
-
async flushMemory() {
|
|
50
|
-
await this._workerObj?.flushMemory();
|
|
40
|
+
async flushMemory(options) {
|
|
41
|
+
await this._workerObj?.flushMemory(options);
|
|
51
42
|
}
|
|
52
43
|
async dispose() {
|
|
53
44
|
return this._workerObj?.dispose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BimDataProvider.js","sourceRoot":"","sources":["../../../src/model/BimDataProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"BimDataProvider.js","sourceRoot":"","sources":["../../../src/model/BimDataProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,MAAM,OAAO,eAAe;IAClB,UAAU,CAA8B;IAEhD,IAAI,UAAU;QACZ,OAAO,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,8BA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EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5D,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,SAAS,CAAC,OAAO,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAErD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC5C,MAAM,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const BimDataBigIntMaxValue: bigint;
|
|
2
|
+
export declare const BimDataBigIntMinValue: bigint;
|
|
3
|
+
export declare const S_IFDIR = 16895;
|
|
4
|
+
export declare const S_IFREG = 33279;
|
|
5
|
+
export declare const DATA_ROOT_FOLDER = "data";
|
|
6
|
+
export declare const OPFS_BIM_FOLDER = "Pilot-BIM";
|
|
7
|
+
export declare const OPFS_BIM_CACHE_FOLDER = "Pilot-BIM-Cache";
|
|
8
|
+
export declare const HEAP_SIZE_LIMIT: number;
|
|
9
|
+
export declare const OPFS_CACHE_MIN_QUOTA: number;
|
|
10
|
+
export declare const OPFS_CACHE_LIMIT: number;
|
|
11
|
+
export declare const MAX_WRITE_CHUNK_SIZE: number;
|
|
12
|
+
export declare const OPFS_CACHE_CHUNK_SIZE: number;
|
|
13
|
+
export declare const TRANSMIT_STEP = 200;
|
|
14
|
+
export declare const PartialFileSignature: Uint8Array;
|
|
15
|
+
export declare const SqliteFileSignature: Uint8Array;
|
|
16
|
+
export declare const BinaryCloudFileSignature: Uint8Array;
|
|
17
|
+
export declare const SupportedFileSignatures: Uint8Array[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const BimDataBigIntMaxValue = BigInt('3155378975999999999');
|
|
2
|
+
export const BimDataBigIntMinValue = BigInt('0');
|
|
3
|
+
export const S_IFDIR = 16895; //16384; // dir
|
|
4
|
+
export const S_IFREG = 33279; // file
|
|
5
|
+
const MB = 1024 * 1024;
|
|
6
|
+
const GB = 1024 * MB;
|
|
7
|
+
export const DATA_ROOT_FOLDER = "data";
|
|
8
|
+
export const OPFS_BIM_FOLDER = "Pilot-BIM";
|
|
9
|
+
export const OPFS_BIM_CACHE_FOLDER = "Pilot-BIM-Cache";
|
|
10
|
+
export const HEAP_SIZE_LIMIT = 1 * GB;
|
|
11
|
+
export const OPFS_CACHE_MIN_QUOTA = 2 * GB;
|
|
12
|
+
export const OPFS_CACHE_LIMIT = 40 * GB;
|
|
13
|
+
export const MAX_WRITE_CHUNK_SIZE = 1 * GB;
|
|
14
|
+
export const OPFS_CACHE_CHUNK_SIZE = 1 * MB;
|
|
15
|
+
export const TRANSMIT_STEP = 200;
|
|
16
|
+
export const PartialFileSignature = new Uint8Array([80, 97, 114, 116, 105, 97, 108, 32, 102, 105, 108, 101]); // "Partial file"
|
|
17
|
+
export const SqliteFileSignature = new Uint8Array([83, 81, 76, 105, 116, 101, 32, 102, 111, 114, 109, 97, 116, 32, 51]); // "SQLite format 3"
|
|
18
|
+
export const BinaryCloudFileSignature = new Uint8Array([80, 78, 84, 67]); // "PNTC"
|
|
19
|
+
export const SupportedFileSignatures = [SqliteFileSignature, BinaryCloudFileSignature];
|
|
20
|
+
//# sourceMappingURL=Consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Consts.js","sourceRoot":"","sources":["../../../src/utils/Consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAEjD,M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AC7I,MAAM,CAAC,MAAM,wBAAwB,GAAI,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,SAAS;AACrF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,mBAAmB,EAAE,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { BimDataTessellation, BimDataTessellationInfo } from "../model/BimDataTessellation.js";
|
|
4
|
-
import { VectorOf, WasmElementPropertySet, WasmIfcNode, WasmTessellation, IWasmBimModule, WasmCloudHierarchyItem, WasmPointsData, WasmPointsMetadata, IDisposable, WasmTessellationInfo } from "../wasm/pilot_bim_dataprovider.js";
|
|
1
|
+
import * as BimData from "../model/BimDataClasses.js";
|
|
2
|
+
import * as WasmData from "../wasm/pilot_bim_dataprovider.js";
|
|
5
3
|
export declare const isSecureContext: boolean;
|
|
6
4
|
export declare const isCrossOriginIsolated: boolean;
|
|
7
5
|
export declare const isOPFSEnabled: boolean;
|
|
8
6
|
export declare function isNode(): boolean;
|
|
9
|
-
type convertFunc<T, K> = (module: IWasmBimModule, value: T, transferable?: Transferable[]) => K;
|
|
7
|
+
type convertFunc<T, K> = (module: WasmData.IWasmBimModule, value: T, transferable?: Transferable[]) => K;
|
|
8
|
+
type transferFunc<T> = (value: T) => Transferable | undefined;
|
|
10
9
|
type transmitFunc<K> = (data: K[]) => Promise<void>;
|
|
11
10
|
export declare class BimDataConverter {
|
|
12
|
-
static toToBimDataElements(module: IWasmBimModule, ifcNodes: VectorOf<WasmIfcNode>, dispose: boolean, transfer?: boolean): BimDataElement[];
|
|
13
|
-
static toBimDataTessellations(module: IWasmBimModule, tessellations: VectorOf<WasmTessellation>, dispose: boolean, transfer?: boolean): BimDataTessellation[];
|
|
14
|
-
static toModelElementPropertySet(wasmPropertySets: VectorOf<WasmElementPropertySet>, dispose: boolean): BimDataElementPropertySet[];
|
|
15
|
-
static toBimCloudHierarchy(wasmHierarchy: VectorOf<WasmCloudHierarchyItem>, dispose: boolean): BimCloudHierarchyItem[];
|
|
16
|
-
static toCloudPoints(module: IWasmBimModule, wasmPointsData: WasmPointsData, transfer?: Transferable[] | boolean): Float32Array;
|
|
17
|
-
static toCloudMetadata(wasmPointsMetadata: WasmPointsMetadata, dispose: boolean): BimCloudMetadata;
|
|
18
|
-
static toBimDataElement(module: IWasmBimModule, ifcNode: WasmIfcNode, transfer?: Transferable[] | boolean): BimDataElement;
|
|
19
|
-
static toBimDataTessellation(module: IWasmBimModule, wasmTessellation: WasmTessellation, transfer?: Transferable[] | boolean): BimDataTessellation;
|
|
20
|
-
static toBimDataTessellationInfo(module: IWasmBimModule, wasmTessellationInfo: WasmTessellationInfo, transfer?: Transferable[] | boolean): BimDataTessellationInfo;
|
|
11
|
+
static toToBimDataElements(module: WasmData.IWasmBimModule, ifcNodes: WasmData.VectorOf<WasmData.WasmIfcNode>, dispose: boolean, transfer?: boolean): BimData.BimDataElement[];
|
|
12
|
+
static toBimDataTessellations(module: WasmData.IWasmBimModule, tessellations: WasmData.VectorOf<WasmData.WasmTessellation>, dispose: boolean, transfer?: boolean): BimData.BimDataTessellation[];
|
|
13
|
+
static toModelElementPropertySet(wasmPropertySets: WasmData.VectorOf<WasmData.WasmElementPropertySet>, dispose: boolean): BimData.BimDataElementPropertySet[];
|
|
14
|
+
static toBimCloudHierarchy(wasmHierarchy: WasmData.VectorOf<WasmData.WasmCloudHierarchyItem>, dispose: boolean): BimData.BimCloudHierarchyItem[];
|
|
15
|
+
static toCloudPoints(module: WasmData.IWasmBimModule, wasmPointsData: WasmData.WasmPointsData, transfer?: Transferable[] | boolean): Float32Array;
|
|
16
|
+
static toCloudMetadata(wasmPointsMetadata: WasmData.WasmPointsMetadata, dispose: boolean): BimData.BimCloudMetadata;
|
|
17
|
+
static toBimDataElement(module: WasmData.IWasmBimModule, ifcNode: WasmData.WasmIfcNode, transfer?: Transferable[] | boolean): BimData.BimDataElement;
|
|
18
|
+
static toBimDataTessellation(module: WasmData.IWasmBimModule, wasmTessellation: WasmData.WasmTessellation, transfer?: Transferable[] | boolean): BimData.BimDataTessellation;
|
|
19
|
+
static toBimDataTessellationInfo(module: WasmData.IWasmBimModule, wasmTessellationInfo: WasmData.WasmTessellationInfo, transfer?: Transferable[] | boolean): BimData.BimDataTessellationInfo;
|
|
21
20
|
private static toModelElementProperties;
|
|
22
21
|
private static toModelElementPropertyValue;
|
|
23
22
|
private static toBimCloudHierarchyItem;
|
|
24
23
|
}
|
|
25
|
-
export declare function transmitWasmData<WasmData extends IDisposable, BimData>(module: IWasmBimModule, wasmData: VectorOf<WasmData>, dispose: boolean, convert: convertFunc<WasmData, BimData>, transmit: transmitFunc<BimData>, step: number): Promise<void>;
|
|
26
|
-
export declare function transmitBimData<BimData>(bimData: Array<BimData>, transmit: transmitFunc<BimData>, step: number): Promise<void>;
|
|
24
|
+
export declare function transmitWasmData<WasmData extends WasmData.IDisposable, BimData>(module: WasmData.IWasmBimModule, wasmData: WasmData.VectorOf<WasmData>, dispose: boolean, convert: convertFunc<WasmData, BimData>, transmit: transmitFunc<BimData>, step: number): Promise<void>;
|
|
25
|
+
export declare function transmitBimData<BimData>(bimData: Array<BimData>, transmit: transmitFunc<BimData>, transfer: transferFunc<BimData>, step: number): Promise<void>;
|
|
27
26
|
export declare class BinaryConverter {
|
|
28
27
|
private static u8Array;
|
|
29
28
|
private static u16Array;
|
|
@@ -41,4 +40,6 @@ export declare class BinaryConverter {
|
|
|
41
40
|
static toI64(source: Uint8Array, offset: number): bigint;
|
|
42
41
|
static toU64(source: Uint8Array, offset: number): bigint;
|
|
43
42
|
}
|
|
43
|
+
export declare function isValidFileSignature(signature: Uint8Array, bufferView?: ArrayBufferLike | ArrayBufferView): boolean;
|
|
44
|
+
export declare function getPath(id: string): string;
|
|
44
45
|
export {};
|