hub-import-zip-shim.mjs
39 lines 1.1 KB
Raw
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge Human 15 hours ago
1 /**
2 * Loads with Hub UI after global JSZip (UMD). Exposes one namespace for `hub.js`.
3 */
4 import {
5 buildImportZipBlobWithJsZip,
6 DEFAULT_HUB_IMPORT_ZIP_LIMITS,
7 getHubImportFileMode,
8 HUB_IMPORT_SEQUENTIAL_MULTI_SOURCE_TYPES,
9 HUB_IMPORT_ZIP_BULK_SOURCE_TYPES,
10 assertSingleFileWithinLimit,
11 } from './hub-client-import-zip.mjs';
12
13 function getJSZipCtor() {
14 const C = globalThis.JSZip;
15 if (typeof C !== 'function') {
16 throw new Error('JSZip is not loaded. Expected script before hub-import-zip-shim.mjs.');
17 }
18 return C;
19 }
20
21 const knowtationHubImportZip = {
22 get limits() {
23 return DEFAULT_HUB_IMPORT_ZIP_LIMITS;
24 },
25 HUB_IMPORT_SEQUENTIAL_MULTI_SOURCE_TYPES,
26 HUB_IMPORT_ZIP_BULK_SOURCE_TYPES,
27 getHubImportFileMode,
28 buildImportZipBlob: (fileList, opts) =>
29 buildImportZipBlobWithJsZip(getJSZipCtor(), fileList, DEFAULT_HUB_IMPORT_ZIP_LIMITS, opts),
30 assertSingleFileWithinLimit: (f) => assertSingleFileWithinLimit(f, DEFAULT_HUB_IMPORT_ZIP_LIMITS),
31 };
32
33 Object.defineProperty(globalThis, 'knowtationHubImportZip', {
34 value: knowtationHubImportZip,
35 enumerable: true,
36 configurable: true,
37 });
38
39 export { knowtationHubImportZip };
File History 1 commit
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge Human 15 hours ago