@loaders.gl/loader-utils 4.0.4 → 4.1.0-alpha.10
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/index.cjs +35 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/json-loader.js +1 -1
- package/dist/json-loader.js.map +1 -1
- package/dist/lib/binary-utils/array-buffer-utils.d.ts +7 -2
- package/dist/lib/binary-utils/array-buffer-utils.d.ts.map +1 -1
- package/dist/lib/binary-utils/array-buffer-utils.js +3 -0
- package/dist/lib/binary-utils/array-buffer-utils.js.map +1 -1
- package/dist/lib/binary-utils/get-first-characters.d.ts.map +1 -1
- package/dist/lib/binary-utils/get-first-characters.js.map +1 -1
- package/dist/lib/binary-utils/memory-conversion-utils.d.ts.map +1 -1
- package/dist/lib/binary-utils/memory-conversion-utils.js.map +1 -1
- package/dist/lib/file-provider/file-handle-file.d.ts +11 -3
- package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -1
- package/dist/lib/file-provider/file-handle-file.js +9 -4
- package/dist/lib/file-provider/file-handle-file.js.map +1 -1
- package/dist/lib/files/blob-file.d.ts.map +1 -1
- package/dist/lib/files/blob-file.js.map +1 -1
- package/dist/lib/files/file.d.ts.map +1 -1
- package/dist/lib/files/file.js.map +1 -1
- package/dist/lib/files/http-file.d.ts.map +1 -1
- package/dist/lib/files/http-file.js.map +1 -1
- package/dist/lib/files/node-file-facade.d.ts +5 -1
- package/dist/lib/files/node-file-facade.d.ts.map +1 -1
- package/dist/lib/files/node-file-facade.js +6 -0
- package/dist/lib/files/node-file-facade.js.map +1 -1
- package/dist/lib/filesystems/filesystem.d.ts.map +1 -1
- package/dist/lib/filesystems/filesystem.js.map +1 -1
- package/dist/lib/filesystems/node-filesystem-facade.d.ts.map +1 -1
- package/dist/lib/filesystems/node-filesystem-facade.js.map +1 -1
- package/dist/lib/node/buffer.browser.d.ts.map +1 -1
- package/dist/lib/node/buffer.browser.js.map +1 -1
- package/dist/lib/node/buffer.d.ts.map +1 -1
- package/dist/lib/node/buffer.js.map +1 -1
- package/dist/lib/node/stream.d.ts.map +1 -1
- package/dist/lib/node/stream.js.map +1 -1
- package/dist/lib/option-utils/merge-loader-options.d.ts.map +1 -1
- package/dist/lib/option-utils/merge-loader-options.js +5 -1
- package/dist/lib/option-utils/merge-loader-options.js.map +1 -1
- package/dist/lib/sources/data-source.d.ts.map +1 -1
- package/dist/lib/sources/data-source.js.map +1 -1
- package/dist/lib/sources/image-source.d.ts +2 -0
- package/dist/lib/sources/image-source.d.ts.map +1 -1
- package/dist/lib/sources/image-source.js.map +1 -1
- package/dist/lib/sources/image-tile-source.d.ts.map +1 -1
- package/dist/lib/sources/image-tile-source.js.map +1 -1
- package/dist/lib/sources/tile-source-adapter.d.ts.map +1 -1
- package/dist/lib/sources/tile-source-adapter.js.map +1 -1
- package/dist/lib/sources/tile-source.d.ts.map +1 -1
- package/dist/lib/sources/tile-source.js.map +1 -1
- package/dist/lib/sources/utils/utils.d.ts.map +1 -1
- package/dist/lib/sources/utils/utils.js.map +1 -1
- package/dist/lib/sources/vector-tile-source.d.ts.map +1 -1
- package/dist/lib/sources/vector-tile-source.js.map +1 -1
- package/dist/loader-types.d.ts +4 -4
- package/dist/loader-types.d.ts.map +1 -1
- package/dist/loader-types.js.map +1 -1
- package/dist/service-types.d.ts.map +1 -1
- package/dist/service-types.js.map +1 -1
- package/dist/writer-types.d.ts +10 -2
- package/dist/writer-types.d.ts.map +1 -1
- package/dist/writer-types.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +3 -1
- package/src/lib/binary-utils/array-buffer-utils.ts +10 -2
- package/src/lib/binary-utils/get-first-characters.ts +2 -1
- package/src/lib/binary-utils/memory-conversion-utils.ts +2 -1
- package/src/lib/file-provider/file-handle-file.ts +21 -8
- package/src/lib/files/blob-file.ts +2 -1
- package/src/lib/files/file.ts +2 -1
- package/src/lib/files/http-file.ts +2 -1
- package/src/lib/files/node-file-facade.ts +13 -2
- package/src/lib/filesystems/filesystem.ts +2 -1
- package/src/lib/filesystems/node-filesystem-facade.ts +2 -1
- package/src/lib/node/buffer.browser.ts +2 -1
- package/src/lib/node/buffer.ts +2 -1
- package/src/lib/node/stream.ts +2 -1
- package/src/lib/option-utils/merge-loader-options.ts +11 -3
- package/src/lib/sources/data-source.ts +2 -1
- package/src/lib/sources/image-source.ts +4 -1
- package/src/lib/sources/image-tile-source.ts +2 -1
- package/src/lib/sources/tile-source-adapter.ts +2 -1
- package/src/lib/sources/tile-source.ts +2 -1
- package/src/lib/sources/utils/utils.ts +2 -1
- package/src/lib/sources/vector-tile-source.ts +2 -1
- package/src/loader-types.ts +7 -5
- package/src/service-types.ts +2 -1
- package/src/writer-types.ts +15 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-filesystem-facade.js","names":["isBrowser","NOT_IMPLEMENTED","Error","NodeFileSystemFacade","constructor","options","_globalThis$loaders","readable","writable","globalThis","loaders","NodeFileSystem","openReadableFile","path","flags","openWritableFile","mode","readdir","dirname","arguments","length","undefined","stat","unlink","fetch"],"sources":["../../../src/lib/filesystems/node-filesystem-facade.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"node-filesystem-facade.js","names":["isBrowser","NOT_IMPLEMENTED","Error","NodeFileSystemFacade","constructor","options","_globalThis$loaders","readable","writable","globalThis","loaders","NodeFileSystem","openReadableFile","path","flags","openWritableFile","mode","readdir","dirname","arguments","length","undefined","stat","unlink","fetch"],"sources":["../../../src/lib/filesystems/node-filesystem-facade.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {isBrowser} from '../env-utils/globals';\nimport {Stat} from '../files/file';\nimport {NodeFileFacade as NodeFile} from '../files/node-file-facade';\nimport {RandomAccessFileSystem} from './filesystem';\n\nconst NOT_IMPLEMENTED = new Error('Not implemented');\n\n/**\n * FileSystem pass-through for Node.js\n * Compatible with BrowserFileSystem.\n * @note Dummy implementation, not used (constructor returns a real NodeFileSystem instance)\n * @param options\n */\nexport class NodeFileSystemFacade implements RandomAccessFileSystem {\n // implements FileSystem\n constructor(options: {[key: string]: any}) {\n if (globalThis.loaders?.NodeFileSystem) {\n return new globalThis.loaders.NodeFileSystem(options);\n }\n if (isBrowser) {\n throw new Error('Can\\'t instantiate NodeFileSystem in browser.');\n }\n throw new Error(\n 'Can\\'t instantiate NodeFileSystem. Make sure to import @loaders.gl/polyfills first.'\n );\n }\n\n // DUMMY IMPLEMENTATION, not used (constructor returns a real NodeFileSystem instance)\n\n // implements RandomAccessReadFileSystem\n\n readonly readable = true;\n readonly writable = true;\n\n async openReadableFile(path: string, flags): Promise<NodeFile> {\n throw NOT_IMPLEMENTED;\n }\n\n // implements RandomAccessWriteFileSystem\n async openWritableFile(path: string, flags, mode): Promise<NodeFile> {\n throw NOT_IMPLEMENTED;\n }\n\n // Implements file system\n\n async readdir(dirname = '.', options?: {}): Promise<string[]> {\n throw NOT_IMPLEMENTED;\n }\n\n async stat(path: string, options?: {}): Promise<Stat> {\n throw NOT_IMPLEMENTED;\n }\n\n async unlink(path: string): Promise<void> {\n throw NOT_IMPLEMENTED;\n }\n\n async fetch(path: RequestInfo, options?: RequestInit): Promise<Response> {\n throw NOT_IMPLEMENTED;\n }\n}\n"],"mappings":"SAIQA,SAAS;AAKjB,MAAMC,eAAe,GAAG,IAAIC,KAAK,CAAC,iBAAiB,CAAC;AAQpD,OAAO,MAAMC,oBAAoB,CAAmC;EAElEC,WAAWA,CAACC,OAA6B,EAAE;IAAA,IAAAC,mBAAA;IAAA,KAgBlCC,QAAQ,GAAG,IAAI;IAAA,KACfC,QAAQ,GAAG,IAAI;IAhBtB,KAAAF,mBAAA,GAAIG,UAAU,CAACC,OAAO,cAAAJ,mBAAA,eAAlBA,mBAAA,CAAoBK,cAAc,EAAE;MACtC,OAAO,IAAIF,UAAU,CAACC,OAAO,CAACC,cAAc,CAACN,OAAO,CAAC;IACvD;IACA,IAAIL,SAAS,EAAE;MACb,MAAM,IAAIE,KAAK,CAAC,+CAA+C,CAAC;IAClE;IACA,MAAM,IAAIA,KAAK,CACb,qFACF,CAAC;EACH;EASA,MAAMU,gBAAgBA,CAACC,IAAY,EAAEC,KAAK,EAAqB;IAC7D,MAAMb,eAAe;EACvB;EAGA,MAAMc,gBAAgBA,CAACF,IAAY,EAAEC,KAAK,EAAEE,IAAI,EAAqB;IACnE,MAAMf,eAAe;EACvB;EAIA,MAAMgB,OAAOA,CAAA,EAAiD;IAAA,IAAhDC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;IAAA,IAAEd,OAAY,GAAAc,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IACvC,MAAMpB,eAAe;EACvB;EAEA,MAAMqB,IAAIA,CAACT,IAAY,EAAER,OAAY,EAAiB;IACpD,MAAMJ,eAAe;EACvB;EAEA,MAAMsB,MAAMA,CAACV,IAAY,EAAiB;IACxC,MAAMZ,eAAe;EACvB;EAEA,MAAMuB,KAAKA,CAACX,IAAiB,EAAER,OAAqB,EAAqB;IACvE,MAAMJ,eAAe;EACvB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.browser.d.ts","sourceRoot":"","sources":["../../../src/lib/node/buffer.browser.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"buffer.browser.d.ts","sourceRoot":"","sources":["../../../src/lib/node/buffer.browser.ts"],"names":[],"mappings":";AAOA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,KAAA,OAEnC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAEjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.browser.js","names":["toArrayBuffer","buffer","toBuffer","binaryData","Error"],"sources":["../../../src/lib/node/buffer.browser.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"buffer.browser.js","names":["toArrayBuffer","buffer","toBuffer","binaryData","Error"],"sources":["../../../src/lib/node/buffer.browser.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Isolates Buffer references to ensure they are only bundled under Node.js (avoids big webpack polyfill)\n// this file is selected by the package.json \"browser\" field).\n\n/**\n * Convert Buffer to ArrayBuffer\n * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toArrayBuffer(buffer) {\n return buffer;\n}\n\n/**\n * Convert (copy) ArrayBuffer to Buffer\n */\nexport function toBuffer(binaryData: ArrayBuffer | Buffer): Buffer {\n throw new Error('Buffer not supported in browser');\n}\n"],"mappings":"AAYA,OAAO,SAASA,aAAaA,CAACC,MAAM,EAAE;EACpC,OAAOA,MAAM;AACf;AAKA,OAAO,SAASC,QAAQA,CAACC,UAAgC,EAAU;EACjE,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;AACpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/lib/node/buffer.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/lib/node/buffer.ts"],"names":[],"mappings":";AAOA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,KAAA,OAOnC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAejE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.js","names":["toArrayBuffer","buffer","Buffer","isBuffer","typedArray","Uint8Array","byteOffset","length","slice","toBuffer","binaryData","ArrayBuffer","isView","from","Error"],"sources":["../../../src/lib/node/buffer.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"buffer.js","names":["toArrayBuffer","buffer","Buffer","isBuffer","typedArray","Uint8Array","byteOffset","length","slice","toBuffer","binaryData","ArrayBuffer","isView","from","Error"],"sources":["../../../src/lib/node/buffer.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Isolates Buffer references to ensure they are only bundled under Node.js (avoids big webpack polyfill)\n// this file is selected by the package.json \"browser\" field).\n\n/**\n * Convert Buffer to ArrayBuffer\n * Converts Node.js `Buffer` to `ArrayBuffer` (without triggering bundler to include Buffer polyfill on browser)\n * @todo better data type\n */\nexport function toArrayBuffer(buffer) {\n // TODO - per docs we should just be able to call buffer.buffer, but there are issues\n if (Buffer.isBuffer(buffer)) {\n const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);\n return typedArray.slice().buffer;\n }\n return buffer;\n}\n\n/**\n * Convert (copy) ArrayBuffer to Buffer\n */\nexport function toBuffer(binaryData: ArrayBuffer | Buffer): Buffer {\n if (Buffer.isBuffer(binaryData)) {\n return binaryData;\n }\n\n if (ArrayBuffer.isView(binaryData)) {\n binaryData = binaryData.buffer;\n }\n\n // TODO - move to loaders.gl/polyfills\n if (typeof Buffer !== 'undefined' && binaryData instanceof ArrayBuffer) {\n return Buffer.from(binaryData);\n }\n\n throw new Error('toBuffer');\n}\n"],"mappings":"AAYA,OAAO,SAASA,aAAaA,CAACC,MAAM,EAAE;EAEpC,IAAIC,MAAM,CAACC,QAAQ,CAACF,MAAM,CAAC,EAAE;IAC3B,MAAMG,UAAU,GAAG,IAAIC,UAAU,CAACJ,MAAM,CAACA,MAAM,EAAEA,MAAM,CAACK,UAAU,EAAEL,MAAM,CAACM,MAAM,CAAC;IAClF,OAAOH,UAAU,CAACI,KAAK,CAAC,CAAC,CAACP,MAAM;EAClC;EACA,OAAOA,MAAM;AACf;AAKA,OAAO,SAASQ,QAAQA,CAACC,UAAgC,EAAU;EACjE,IAAIR,MAAM,CAACC,QAAQ,CAACO,UAAU,CAAC,EAAE;IAC/B,OAAOA,UAAU;EACnB;EAEA,IAAIC,WAAW,CAACC,MAAM,CAACF,UAAU,CAAC,EAAE;IAClCA,UAAU,GAAGA,UAAU,CAACT,MAAM;EAChC;EAGA,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAIQ,UAAU,YAAYC,WAAW,EAAE;IACtE,OAAOT,MAAM,CAACW,IAAI,CAACH,UAAU,CAAC;EAChC;EAEA,MAAM,IAAII,KAAK,CAAC,UAAU,CAAC;AAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/node/stream.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/node/stream.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,YAAY,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErC,wCAAwC;AACxC,eAAO,MAAM,SAAS,yBAAmB,CAAC;AAE1C,eAAO,MAAM,WAAW,SAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","names":["stream","Transform","isSupported","Boolean"],"sources":["../../../src/lib/node/stream.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"stream.js","names":["stream","Transform","isSupported","Boolean"],"sources":["../../../src/lib/node/stream.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport * as stream from 'stream';\n\nexport type {Writable} from 'stream';\n\n/** Wrapper for Node.js stream method */\nexport const Transform = stream.Transform;\n\nexport const isSupported = Boolean(stream);\n"],"mappings":"AAIA,OAAO,KAAKA,MAAM,MAAM,QAAQ;AAKhC,OAAO,MAAMC,SAAS,GAAGD,MAAM,CAACC,SAAS;AAEzC,OAAO,MAAMC,WAAW,GAAGC,OAAO,CAACH,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-loader-options.d.ts","sourceRoot":"","sources":["../../../src/lib/option-utils/merge-loader-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge-loader-options.d.ts","sourceRoot":"","sources":["../../../src/lib/option-utils/merge-loader-options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,aAAa,EAC9D,WAAW,EAAE,OAAO,GAAG,SAAS,EAChC,UAAU,EAAE,OAAO,GAClB,OAAO,CAET"}
|
|
@@ -2,12 +2,16 @@ export function mergeLoaderOptions(baseOptions, newOptions) {
|
|
|
2
2
|
return mergeOptionsRecursively(baseOptions || {}, newOptions);
|
|
3
3
|
}
|
|
4
4
|
function mergeOptionsRecursively(baseOptions, newOptions) {
|
|
5
|
+
let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
6
|
+
if (level > 3) {
|
|
7
|
+
return newOptions;
|
|
8
|
+
}
|
|
5
9
|
const options = {
|
|
6
10
|
...baseOptions
|
|
7
11
|
};
|
|
8
12
|
for (const [key, newValue] of Object.entries(newOptions)) {
|
|
9
13
|
if (newValue && typeof newValue === 'object' && !Array.isArray(newValue)) {
|
|
10
|
-
options[key] = mergeOptionsRecursively(options[key] || {}, newOptions[key]);
|
|
14
|
+
options[key] = mergeOptionsRecursively(options[key] || {}, newOptions[key], level + 1);
|
|
11
15
|
} else {
|
|
12
16
|
options[key] = newOptions[key];
|
|
13
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-loader-options.js","names":["mergeLoaderOptions","baseOptions","newOptions","mergeOptionsRecursively","options","key","newValue","Object","entries","Array","isArray"],"sources":["../../../src/lib/option-utils/merge-loader-options.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"merge-loader-options.js","names":["mergeLoaderOptions","baseOptions","newOptions","mergeOptionsRecursively","level","arguments","length","undefined","options","key","newValue","Object","entries","Array","isArray"],"sources":["../../../src/lib/option-utils/merge-loader-options.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {LoaderOptions} from '../../loader-types';\n\n/**\n *\n * @param baseOptions Can be undefined, in which case a fresh options object will be minted\n * @param newOptions\n * @returns\n */\nexport function mergeLoaderOptions<Options extends LoaderOptions>(\n baseOptions: Options | undefined,\n newOptions: Options\n): Options {\n return mergeOptionsRecursively(baseOptions || {}, newOptions) as Options;\n}\n\nfunction mergeOptionsRecursively(\n baseOptions: Record<string, unknown>,\n newOptions: Record<string, unknown>,\n level = 0\n): Record<string, unknown> {\n // Sanity check (jest test runner overwrites the console object which can lead to infinite recursion)\n if (level > 3) {\n return newOptions;\n }\n\n const options = {...baseOptions};\n for (const [key, newValue] of Object.entries(newOptions)) {\n if (newValue && typeof newValue === 'object' && !Array.isArray(newValue)) {\n options[key] = mergeOptionsRecursively(\n (options[key] as Record<string, unknown>) || {},\n newOptions[key] as Record<string, unknown>,\n level + 1\n );\n // Object.assign(options[key] as object, newOptions[key]);\n } else {\n options[key] = newOptions[key];\n }\n }\n return options as Record<string, unknown>;\n}\n"],"mappings":"AAYA,OAAO,SAASA,kBAAkBA,CAChCC,WAAgC,EAChCC,UAAmB,EACV;EACT,OAAOC,uBAAuB,CAACF,WAAW,IAAI,CAAC,CAAC,EAAEC,UAAU,CAAC;AAC/D;AAEA,SAASC,uBAAuBA,CAC9BF,WAAoC,EACpCC,UAAmC,EAEV;EAAA,IADzBE,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAGT,IAAID,KAAK,GAAG,CAAC,EAAE;IACb,OAAOF,UAAU;EACnB;EAEA,MAAMM,OAAO,GAAG;IAAC,GAAGP;EAAW,CAAC;EAChC,KAAK,MAAM,CAACQ,GAAG,EAAEC,QAAQ,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACV,UAAU,CAAC,EAAE;IACxD,IAAIQ,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,IAAI,CAACG,KAAK,CAACC,OAAO,CAACJ,QAAQ,CAAC,EAAE;MACxEF,OAAO,CAACC,GAAG,CAAC,GAAGN,uBAAuB,CACnCK,OAAO,CAACC,GAAG,CAAC,IAAgC,CAAC,CAAC,EAC/CP,UAAU,CAACO,GAAG,CAAC,EACfL,KAAK,GAAG,CACV,CAAC;IAEH,CAAC,MAAM;MACLI,OAAO,CAACC,GAAG,CAAC,GAAGP,UAAU,CAACO,GAAG,CAAC;IAChC;EACF;EACA,OAAOD,OAAO;AAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/data-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/data-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE5D,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG;IAC5B,kGAAkG;IAClG,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B,CAAC;AAEF,qCAAqC;AACrC,8BAAsB,UAAU,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe;IAC/E,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,gEAAgE;IAChE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjE,8DAA8D;IAC9D,WAAW,EAAE,aAAa,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAQ;IAE9B,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,MAAM;IAMzB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAMtB,0DAA0D;IAC1D,eAAe,IAAI,IAAI;IAIvB;;;OAGG;IACH,eAAe,CAAC,KAAK,GAAE,OAAc;CAOtC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,aAAa,SAKvC,MAAM,iBAAiB,WAAW,uBAWlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-source.js","names":["DataSource","constructor","props","data","fetch","loadOptions","_needsRefresh","getFetchFunction","setProps","Object","assign","setNeedsRefresh","getNeedsRefresh","clear","arguments","length","undefined","needsRefresh","options","fetchFunction","url","fetchOptions"],"sources":["../../../src/lib/sources/data-source.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"data-source.js","names":["DataSource","constructor","props","data","fetch","loadOptions","_needsRefresh","getFetchFunction","setProps","Object","assign","setNeedsRefresh","getNeedsRefresh","clear","arguments","length","undefined","needsRefresh","options","fetchFunction","url","fetchOptions"],"sources":["../../../src/lib/sources/data-source.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\n\n/** Common properties for all data sources */\nexport type DataSourceProps = {\n /** LoaderOptions provide an option to override `fetch`. Will also be passed to any sub loaders */\n loadOptions?: LoaderOptions;\n};\n\n/** base class of all data sources */\nexport abstract class DataSource<PropsT extends DataSourceProps = DataSourceProps> {\n abstract data: unknown;\n /** A resolved fetch function extracted from loadOptions prop */\n fetch: (url: string, options?: RequestInit) => Promise<Response>;\n /** The actual load options, if calling a loaders.gl loader */\n loadOptions: LoaderOptions;\n _needsRefresh: boolean = true;\n\n props: PropsT;\n\n constructor(props: PropsT) {\n this.props = {...props};\n this.loadOptions = {...props.loadOptions};\n this.fetch = getFetchFunction(this.loadOptions);\n }\n\n setProps(props: PropsT) {\n this.props = Object.assign(this.props, props);\n // TODO - add a shallow compare to avoid setting refresh if no change?\n this.setNeedsRefresh();\n }\n\n /** Mark this data source as needing a refresh (redraw) */\n setNeedsRefresh(): void {\n this._needsRefresh = true;\n }\n\n /**\n * Does this data source need refreshing?\n * @note The specifics of the refresh mechanism depends on type of data source\n */\n getNeedsRefresh(clear: boolean = true) {\n const needsRefresh = this._needsRefresh;\n if (clear) {\n this._needsRefresh = false;\n }\n return needsRefresh;\n }\n}\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: LoaderOptions) {\n const fetchFunction = options?.fetch;\n\n // options.fetch can be a function\n if (fetchFunction && typeof fetchFunction === 'function') {\n return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n }\n\n // options.fetch can be an options object, use global fetch with those options\n const fetchOptions = options?.fetch;\n if (fetchOptions && typeof fetchOptions !== 'function') {\n return (url) => fetch(url, fetchOptions);\n }\n\n // else return the global fetch function\n return (url) => fetch(url);\n}\n"],"mappings":"AAaA,OAAO,MAAeA,UAAU,CAAmD;EAUjFC,WAAWA,CAACC,KAAa,EAAE;IAAA,KATlBC,IAAI;IAAA,KAEbC,KAAK;IAAA,KAELC,WAAW;IAAA,KACXC,aAAa,GAAY,IAAI;IAAA,KAE7BJ,KAAK;IAGH,IAAI,CAACA,KAAK,GAAG;MAAC,GAAGA;IAAK,CAAC;IACvB,IAAI,CAACG,WAAW,GAAG;MAAC,GAAGH,KAAK,CAACG;IAAW,CAAC;IACzC,IAAI,CAACD,KAAK,GAAGG,gBAAgB,CAAC,IAAI,CAACF,WAAW,CAAC;EACjD;EAEAG,QAAQA,CAACN,KAAa,EAAE;IACtB,IAAI,CAACA,KAAK,GAAGO,MAAM,CAACC,MAAM,CAAC,IAAI,CAACR,KAAK,EAAEA,KAAK,CAAC;IAE7C,IAAI,CAACS,eAAe,CAAC,CAAC;EACxB;EAGAA,eAAeA,CAAA,EAAS;IACtB,IAAI,CAACL,aAAa,GAAG,IAAI;EAC3B;EAMAM,eAAeA,CAAA,EAAwB;IAAA,IAAvBC,KAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IACnC,MAAMG,YAAY,GAAG,IAAI,CAACX,aAAa;IACvC,IAAIO,KAAK,EAAE;MACT,IAAI,CAACP,aAAa,GAAG,KAAK;IAC5B;IACA,OAAOW,YAAY;EACrB;AACF;AASA,OAAO,SAASV,gBAAgBA,CAACW,OAAuB,EAAE;EACxD,MAAMC,aAAa,GAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEd,KAAK;EAGpC,IAAIe,aAAa,IAAI,OAAOA,aAAa,KAAK,UAAU,EAAE;IACxD,OAAO,CAACC,GAAW,EAAEC,YAA0B,KAAKF,aAAa,CAACC,GAAG,EAAEC,YAAY,CAAC;EACtF;EAGA,MAAMA,YAAY,GAAGH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEd,KAAK;EACnC,IAAIiB,YAAY,IAAI,OAAOA,YAAY,KAAK,UAAU,EAAE;IACtD,OAAQD,GAAG,IAAKhB,KAAK,CAACgB,GAAG,EAAEC,YAAY,CAAC;EAC1C;EAGA,OAAQD,GAAG,IAAKhB,KAAK,CAACgB,GAAG,CAAC;AAC5B"}
|
|
@@ -35,6 +35,8 @@ export type GetImageParameters = {
|
|
|
35
35
|
styles?: unknown;
|
|
36
36
|
/** bounding box of the requested map image */
|
|
37
37
|
boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];
|
|
38
|
+
/** @deprecated use boundingBox */
|
|
39
|
+
bbox?: [number, number, number, number];
|
|
38
40
|
/** pixel width of returned image */
|
|
39
41
|
width: number;
|
|
40
42
|
/** pixels */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/image-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/image-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAEF,wDAAwD;AACxD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,8FAA8F;IAC9F,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACzE,+BAA+B;IAC/B,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC7B,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uBAAuB;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,cAAc;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACxE,kCAAkC;IAClC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa;IACb,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAE/C;;;;GAIG;AACH,8BAAsB,WAAW,CAC/B,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,CAClD,SAAQ,UAAU,CAAC,MAAM,CAAC;IAC1B,MAAM,CAAC,IAAI,EAAE,MAAM,CAAc;IACjC,MAAM,CAAC,OAAO,QAAS,MAAM,KAAG,OAAO,CAAU;IAEjD,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IACpD,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;CACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-source.js","names":["DataSource","ImageSource","type","testURL","url"],"sources":["../../../src/lib/sources/image-source.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"image-source.js","names":["DataSource","ImageSource","type","testURL","url"],"sources":["../../../src/lib/sources/image-source.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {DataSourceProps} from './data-source';\nimport {DataSource} from './data-source';\nimport {ImageType} from './utils/image-type';\n\n/**\n * Normalized capabilities of an Image service\n * @example\n * The WMSService will normalize the response to the WMS `GetCapabilities`\n * data structure extracted from WMS XML response into an ImageSourceMetadata.\n */\nexport type ImageSourceMetadata = {\n name: string;\n title?: string;\n abstract?: string;\n keywords: string[];\n layers: ImageSourceLayer[];\n};\n\n/** Description of one data layer in the image source */\nexport type ImageSourceLayer = {\n /** Name of this layer */\n name?: string;\n /** Human readable title of this layer */\n title?: string;\n /** Coordinate systems supported by this layer */\n crs?: string[];\n /** layer limits in unspecified CRS:84-like lng/lat, for quick access w/o CRS calculations. */\n boundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n /** Sub layers of this layer */\n layers?: ImageSourceLayer[];\n};\n\n/** Generic parameters for requesting an image from an image source */\nexport type GetImageParameters = {\n /** Layers to render */\n layers: string | string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];\n /** @deprecated use boundingBox */\n bbox?: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** crs for the image (not the bounding box) */\n crs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\nexport type ImageSourceProps = DataSourceProps;\n\n/**\n * MapImageSource - data sources that allow data to be queried by (geospatial) extents\n * @note\n * - If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport abstract class ImageSource<\n PropsT extends ImageSourceProps = ImageSourceProps\n> extends DataSource<PropsT> {\n static type: string = 'template';\n static testURL = (url: string): boolean => false;\n\n abstract getMetadata(): Promise<ImageSourceMetadata>;\n abstract getImage(parameters: GetImageParameters): Promise<ImageType>;\n}\n"],"mappings":"SAKQA,UAAU;AA0DlB,OAAO,MAAeC,WAAW,SAEvBD,UAAU,CAAS;AAFPC,WAAW,CAGxBC,IAAI,GAAW,UAAU;AAHZD,WAAW,CAIxBE,OAAO,GAAIC,GAAW,IAAc,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/image-tile-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image-tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/image-tile-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAC,UAAU,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,SAAS,SAAS,kBAAkB,GAAG,kBAAkB,CACxF,SAAQ,UAAU,CAAC,SAAS,CAAC;IAC7B,YAAY,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;CACxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-tile-source.js","names":[],"sources":["../../../src/lib/sources/image-tile-source.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"image-tile-source.js","names":[],"sources":["../../../src/lib/sources/image-tile-source.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ImageType} from './utils/image-type';\nimport type {TileSource, TileSourceMetadata} from './tile-source';\nimport type {GetTileParameters} from './tile-source';\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) tile\n * @note If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport interface ImageTileSource<MetadataT extends TileSourceMetadata = TileSourceMetadata>\n extends TileSource<MetadataT> {\n getImageTile(parameters: GetTileParameters): Promise<ImageType | null>;\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source-adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/tile-source-adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tile-source-adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/tile-source-adapter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAEhE;;;;GAIG;AACH,qBAAa,iBAAiB,CAAC,SAAS,CAAE,YAAW,UAAU,CAAC,mBAAmB,CAAC;IAClF,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;gBACzB,MAAM,EAAE,WAAW;IAGzB,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAGjD,sBAAsB;IACtB,OAAO,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAOxD,+BAA+B;IAK/B,gEAAgE;IAChE,SAAS,CAAC,kBAAkB,CAC1B,UAAU,EAAE,iBAAiB,GAC5B,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAc7D,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAO7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source-adapter.js","names":["TileSourceAdapter","constructor","source","viewportSource","getMetadata","getTile","parameters","width","height","boundingBox","getTileBoundingBox","getImage","layers","crs","Error","x","y","zoom","getTileLowerLeftCorner","tiles","longitude","latitudeRadians","Math","atan","sinh","PI","latitude"],"sources":["../../../src/lib/sources/tile-source-adapter.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"tile-source-adapter.js","names":["TileSourceAdapter","constructor","source","viewportSource","getMetadata","getTile","parameters","width","height","boundingBox","getTileBoundingBox","getImage","layers","crs","Error","x","y","zoom","getTileLowerLeftCorner","tiles","longitude","latitudeRadians","Math","atan","sinh","PI","latitude"],"sources":["../../../src/lib/sources/tile-source-adapter.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n\nimport {TileSource, GetTileParameters} from './tile-source';\nimport {ImageSource, ImageSourceMetadata} from './image-source';\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) extents\n * @note\n * - If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport class TileSourceAdapter<MetadataT> implements TileSource<ImageSourceMetadata> {\n readonly viewportSource: ImageSource;\n constructor(source: ImageSource) {\n this.viewportSource = source;\n }\n async getMetadata(): Promise<ImageSourceMetadata> {\n return await this.viewportSource.getMetadata();\n }\n /** Flat parameters */\n getTile(parameters: GetTileParameters): Promise<unknown> {\n const width = 512;\n const height = 512;\n const boundingBox = this.getTileBoundingBox(parameters);\n return this.viewportSource.getImage({boundingBox, layers: [], width, height});\n }\n\n /** deck.gl style parameters */\n // getTileData(parameters: TileLoadParameters): Promise<unknown | null> {\n // return this.viewportSource.getImage\n // }\n\n /** Bounding box of tiles in this tileset `[[w, s], [e, n]]` */\n protected getTileBoundingBox(\n parameters: GetTileParameters\n ): [min: [x: number, y: number], max: [x: number, y: number]] {\n if (parameters.crs && parameters.crs !== 'ESPG3758') {\n throw new Error('SRS not ESPG3758');\n }\n const {x, y, zoom} = parameters;\n\n return [\n /** Bounding box of tile in this tileset `[[w, s], ...]` */\n this.getTileLowerLeftCorner(x, y, zoom),\n /** Bounding box of tile in this tileset `[..., [e, n]]` */\n this.getTileLowerLeftCorner(x + 1, y - 1, zoom)\n ];\n }\n\n getTileLowerLeftCorner(x: number, y: number, zoom: number): [number, number] {\n const tiles = 2 ^ zoom;\n const longitude = (x / tiles) * 360.0 - 180.0;\n const latitudeRadians = Math.atan(Math.sinh(Math.PI * (1 - (2 * (y + 1)) / tiles)));\n const latitude = (180.0 * latitudeRadians) / Math.PI;\n return [longitude, latitude];\n }\n}\n"],"mappings":"AAWA,OAAO,MAAMA,iBAAiB,C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,GAAG,CAAC,CAAC,GAAIG,KAAK,CAAC,CAAC,CAAC;IACnF,MAAMO,QAAQ,GAAI,KAAK,GAAGL,eAAe,GAAIC,IAAI,CAACG,EAAE;IACpD,OAAO,CAACL,SAAS,EAAEM,QAAQ,CAAC;EAC9B;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/tile-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/tile-source.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAEzE,wBAAwB;IACxB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QACf,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,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,cAAc,CAAC;AACjE,MAAM,MAAM,cAAc,GAAG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC;AACxF,MAAM,MAAM,iBAAiB,GAAG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAAC;AAE3F;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,EAAE,CAAC;AAEjC;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,SAAS,SAAS,kBAAkB;IAC9D,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,sBAAsB;IACtB,OAAO,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,+BAA+B;IAC/B,WAAW,CAAC,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source.js","names":[],"sources":["../../../src/lib/sources/tile-source.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"tile-source.js","names":[],"sources":["../../../src/lib/sources/tile-source.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/**\n * Normalized capabilities of an Image service\n * Sources are expected to normalize the response to capabilities\n * @example\n * A WMS service would normalize the response to the WMS `GetCapabilities` data structure extracted from WMS XML response\n * into an TileSourceMetadata.\n */\nexport type TileSourceMetadata = {\n format?: string;\n formatHeader?: unknown;\n\n /** Name of the tileset (extracted from JSON metadata if available) */\n name?: string;\n title?: string;\n abstract?: string;\n keywords?: string[];\n /** Attribution string (extracted from JSON metadata if available) */\n attributions?: string[];\n\n /** Minimal zoom level of tiles in this tileset */\n minZoom?: number;\n /** Maximal zoom level of tiles in this tileset */\n maxZoom?: number;\n /** Bounding box of tiles in this tileset `[[w, s], [e, n]]` */\n boundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n\n /** Layer information */\n layer?: {\n name: string;\n title?: string;\n srs?: string[];\n boundingBox?: [number, number, number, number];\n layers: TileSourceLayer[];\n };\n};\n\n/**\n * Description of one data layer in the image source\n */\nexport type TileSourceLayer = {\n name: string;\n title?: string;\n srs?: string[];\n boundingBox?: [number, number, number, number];\n layers: TileSourceLayer[];\n};\n\n/**\n * Generic parameters for requesting an image from an image source\n */\nexport type GetTileParameters = {\n /** Layers to render */\n layers: string | string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n zoom: number;\n /** tile x coordinate */\n x: number;\n /** tile y coordinate */\n y: number;\n /** Coordinate reference system for the image (not the bounding box) */\n crs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\nexport type TileLoadParameters = {\n index: {x: number; y: number; z: number};\n id: string;\n bbox: TileBoundingBox;\n zoom?: number;\n url?: string | null;\n signal?: AbortSignal;\n userData?: Record<string, any>;\n};\n\n/** deck.gl compatible bounding box */\nexport type TileBoundingBox = NonGeoBoundingBox | GeoBoundingBox;\nexport type GeoBoundingBox = {west: number; north: number; east: number; south: number};\nexport type NonGeoBoundingBox = {left: number; top: number; right: number; bottom: number};\n\n/**\n * Props for a TileSource\n */\nexport type TileSourceProps = {};\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) extents\n * @note\n * - If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport interface TileSource<MetadataT extends TileSourceMetadata> {\n getMetadata(): Promise<MetadataT>;\n /** Flat parameters */\n getTile(parameters: GetTileParameters): Promise<unknown>;\n /** deck.gl style parameters */\n getTileData?(parameters: TileLoadParameters): Promise<unknown | null>;\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/sources/utils/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/sources/utils/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE5D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,aAAa,SAKvC,MAAM,iBAAiB,WAAW,uBAWlD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,SAAS;IAAC,WAAW,CAAC,EAAE,GAAG,CAAA;CAAC,EACtE,KAAK,EAAE,KAAK,GACX,QAAQ,CAAC,KAAK,CAAC,CAUjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getFetchFunction","options","fetchFunction","fetch","url","fetchOptions","mergeImageServiceProps","props","loadOptions"],"sources":["../../../../src/lib/sources/utils/utils.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"utils.js","names":["getFetchFunction","options","fetchFunction","fetch","url","fetchOptions","mergeImageServiceProps","props","loadOptions"],"sources":["../../../../src/lib/sources/utils/utils.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: LoaderOptions) {\n const fetchFunction = options?.fetch;\n\n // options.fetch can be a function\n if (fetchFunction && typeof fetchFunction === 'function') {\n return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n }\n\n // options.fetch can be an options object, use global fetch with those options\n const fetchOptions = options?.fetch;\n if (fetchOptions && typeof fetchOptions !== 'function') {\n return (url) => fetch(url, fetchOptions);\n }\n\n // else return the global fetch function\n return (url) => fetch(url);\n}\n\nexport function mergeImageServiceProps<Props extends {loadOptions?: any}>(\n props: Props\n): Required<Props> {\n // @ts-expect-error\n return {\n // Default fetch\n ...props,\n loadOptions: {\n ...props.loadOptions,\n fetch: getFetchFunction(props.loadOptions)\n }\n };\n}\n"],"mappings":"AAaA,OAAO,SAASA,gBAAgBA,CAACC,OAAuB,EAAE;EACxD,MAAMC,aAAa,GAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,KAAK;EAGpC,IAAID,aAAa,IAAI,OAAOA,aAAa,KAAK,UAAU,EAAE;IACxD,OAAO,CAACE,GAAW,EAAEC,YAA0B,KAAKH,aAAa,CAACE,GAAG,EAAEC,YAAY,CAAC;EACtF;EAGA,MAAMA,YAAY,GAAGJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,KAAK;EACnC,IAAIE,YAAY,IAAI,OAAOA,YAAY,KAAK,UAAU,EAAE;IACtD,OAAQD,GAAG,IAAKD,KAAK,CAACC,GAAG,EAAEC,YAAY,CAAC;EAC1C;EAGA,OAAQD,GAAG,IAAKD,KAAK,CAACC,GAAG,CAAC;AAC5B;AAEA,OAAO,SAASE,sBAAsBA,CACpCC,KAAY,EACK;EAEjB,OAAO;IAEL,GAAGA,KAAK;IACRC,WAAW,EAAE;MACX,GAAGD,KAAK,CAACC,WAAW;MACpBL,KAAK,EAAEH,gBAAgB,CAACO,KAAK,CAACC,WAAW;IAC3C;EACF,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/vector-tile-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-tile-source.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/vector-tile-source.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,SAAS,SAAS,kBAAkB,GAAG,kBAAkB,CACzF,SAAQ,UAAU,CAAC,SAAS,CAAC;IAC7B,aAAa,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-source.js","names":[],"sources":["../../../src/lib/sources/vector-tile-source.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"vector-tile-source.js","names":[],"sources":["../../../src/lib/sources/vector-tile-source.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TileSource, TileSourceMetadata} from './tile-source';\nimport {GetTileParameters} from './tile-source';\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) tile\n * @note If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport interface VectorTileSource<MetadataT extends TileSourceMetadata = TileSourceMetadata>\n extends TileSource<MetadataT> {\n getVectorTile(parameters: GetTileParameters): Promise<unknown | null>;\n}\n"],"mappings":""}
|
package/dist/loader-types.d.ts
CHANGED
|
@@ -133,14 +133,14 @@ export type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderO
|
|
|
133
133
|
parseFile?: (file: ReadableFile, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
|
|
134
134
|
/** Parse synchronously and atomically from an arraybuffer */
|
|
135
135
|
parseSync?: (arrayBuffer: ArrayBuffer, options?: LoaderOptionsT, context?: LoaderContext) => DataT;
|
|
136
|
-
/** Parse atomically from a string asynchronously */
|
|
137
|
-
parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
|
|
138
|
-
/** Parse atomically from a string synchronously */
|
|
139
|
-
parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;
|
|
140
136
|
/** Parse batches of data from an iterator (e.g. fetch stream), return an iterator that yield parsed batches. */
|
|
141
137
|
parseInBatches?: (iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>, options?: LoaderOptionsT, context?: LoaderContext) => AsyncIterable<BatchT>;
|
|
142
138
|
/** For random access, file like sources, source that don't integrate with fetch. */
|
|
143
139
|
parseFileInBatches?: (file: ReadableFile, options?: LoaderOptionsT, context?: LoaderContext) => AsyncIterable<BatchT>;
|
|
140
|
+
/** Parse atomically from a string asynchronously */
|
|
141
|
+
parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;
|
|
142
|
+
/** Parse atomically from a string synchronously */
|
|
143
|
+
parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;
|
|
144
144
|
};
|
|
145
145
|
/**
|
|
146
146
|
* A Loader context is provided as a third parameters to a loader object's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader-types.d.ts","sourceRoot":"","sources":["../src/loader-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader-types.d.ts","sourceRoot":"","sources":["../src/loader-types.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACT,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAI9C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAAC;IACtD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAGlC,kDAAkD;IAClD,GAAG,CAAC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AAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAE3D,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtC;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,OAAO,CAAC,CAAC;AAmBpB;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAE3D,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,gBAAgB,CAAC,OAAO,CAAC,CAK3B;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,SAAS,MAAM,EACtB,QAAQ,SAAS,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAE3D,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,EACnE,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAKlD"}
|
package/dist/loader-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader-types.js","names":["parseFromContext","data","loaders","options","context","_parse","parseSyncFromContext","loader","_parseSync","Error","parseInBatchesFromContext","_parseInBatches"],"sources":["../src/loader-types.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {\n FetchLike,\n TransformBatches /* , DataType, SyncDataType, BatchableDataType */\n} from './types';\nimport {ReadableFile} from './lib/files/file';\n\n// LOADERS\n\n/**\n * Core Loader Options\n */\nexport type LoaderOptions = {\n /** fetch options or a custom fetch function */\n fetch?: typeof fetch | FetchLike | RequestInit | null;\n /** Do not throw on errors */\n nothrow?: boolean;\n\n /** loader selection, search first for supplied mimeType */\n mimeType?: string;\n /** loader selection, provide fallback mimeType is server does not provide */\n fallbackMimeType?: string;\n /** loader selection, avoid searching registered loaders */\n ignoreRegisteredLoaders?: boolean;\n\n // general\n /** Experimental: Supply a logger to the parser */\n log?: any;\n /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n useLocalLibraries?: boolean;\n\n // batched parsing\n\n /** Size of each batch. `auto` matches batches to size of incoming chunks */\n batchSize?: number | 'auto';\n /** Minimal amount of time between batches */\n batchDebounceMs?: number;\n /** Stop loading after a given number of rows (compare SQL limit clause) */\n limit?: 0;\n /** Experimental: Stop loading after reaching */\n _limitMB?: 0;\n /** Generate metadata batches */\n metadata?: boolean;\n /** Transforms to run on incoming batches */\n transforms?: TransformBatches[];\n\n // workers\n\n /** CDN load workers from */\n CDN?: string | null;\n /** Set to `false` to disable workers */\n worker?: boolean;\n /** Number of concurrent workers (per loader) on desktop browser */\n maxConcurrency?: number;\n /** Number of concurrent workers (per loader) on mobile browsers */\n maxMobileConcurrency?: number;\n /** Set to `false` to prevent reuse workers */\n reuseWorkers?: boolean;\n /** Whether to use workers under Node.js (experimental) */\n _nodeWorkers?: boolean;\n /** set to 'test' to run local worker */\n _workerType?: string;\n\n /** @deprecated `options.batchType` removed, Use `options.<loader>.type` instead */\n batchType?: 'row' | 'columnar' | 'arrow';\n /** @deprecated `options.throw removed`, Use `options.nothrow` instead */\n throws?: boolean;\n /** @deprecated `options.dataType` no longer used */\n dataType?: never;\n /** @deprecated `options.uri` no longer used */\n uri?: never;\n /** @deprecated Use `options.fetch.method` */\n method?: never;\n /** @deprecated Use `options.fetch.headers` */\n headers?: never;\n /** @deprecated Use `options.fetch.body` */\n body?: never;\n /** @deprecated Use `options.fetch.mode` */\n mode?: never;\n /** @deprecated Use `options.fetch.credentials` */\n credentials?: never;\n /** @deprecated Use `options.fetch.cache` */\n cache?: never;\n /** @deprecated Use `options.fetch.redirect` */\n redirect?: never;\n /** @deprecated Use `options.fetch.referrer` */\n referrer?: never;\n /** @deprecated Use `options.fetch.referrerPolicy` */\n referrerPolicy?: never;\n /** @deprecated Use `options.fetch.integrity` */\n integrity?: never;\n /** @deprecated Use `options.fetch.keepalive` */\n keepalive?: never;\n /** @deprecated Use `options.fetch.signal` */\n signal?: never;\n\n // Accept other keys (loader options objects, e.g. `options.csv`, `options.json` ...)\n [loaderId: string]: unknown;\n};\n\ntype PreloadOptions = {\n [key: string]: unknown;\n};\n\n/**\n * A worker loader definition that can be used with `@loaders.gl/core` functions\n */\nexport type Loader<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = {\n /** The result type of this loader */\n dataType?: DataT;\n /** The batched result type of this loader */\n batchType?: BatchT;\n\n /** Default Options */\n options: LoaderOptionsT;\n /** Deprecated Options */\n deprecatedOptions?: Record<string, string | Record<string, string>>;\n\n /** Human readable name */\n name: string;\n /** id should be the same as the field used in LoaderOptions */\n id: string;\n /** module is used to generate worker threads, need to be the module directory name */\n module: string;\n /** Version should be injected by build tools */\n version: string;\n /** A boolean, or a URL */\n worker?: string | boolean;\n // end Worker\n\n /** Which category does this loader belong to */\n category?: string;\n /** File extensions that are potential matches with this loader. */\n extensions: string[];\n /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */\n mimeTypes: string[];\n\n /** Is the input of this loader binary */\n binary?: boolean;\n /** Is the input of this loader text */\n text?: boolean;\n\n /** Test some initial bytes of content to see if this loader might be a match */\n tests?: (((ArrayBuffer: ArrayBuffer) => boolean) | ArrayBuffer | string)[];\n\n /** @deprecated */\n supported?: boolean;\n /** @deprecated */\n testText?: (string: string) => boolean;\n};\n\n/**\n * A \"bundled\" loader definition that can be used with `@loaders.gl/core` functions\n * If a worker loader is supported it will also be supported.\n */\nexport type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = Loader<\n DataT,\n BatchT,\n LoaderOptionsT\n> & {\n /** Perform actions before load. @deprecated Not officially supported. */\n preload?: Preload;\n /** Parse asynchronously and atomically from an arraybuffer */\n parse: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => Promise<DataT>;\n /** Parse asynchronously and atomically from a random access \"file like\" input */\n parseFile?: (\n file: ReadableFile,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => Promise<DataT>;\n /** Parse synchronously and atomically from an arraybuffer */\n parseSync?: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => DataT;\n /** Parse atomically from a string asynchronously */\n parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;\n /** Parse atomically from a string synchronously */\n parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;\n /** Parse batches of data from an iterator (e.g. fetch stream), return an iterator that yield parsed batches. */\n parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n /** For random access, file like sources, source that don't integrate with fetch. */\n parseFileInBatches?: (\n file: ReadableFile,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n};\n\n/**\n * A Loader context is provided as a third parameters to a loader object's\n * parse functions when that loader is called by other loaders rather then\n * directly by the application.\n *\n * - The context object allows the subloaders to be aware of the parameters and\n * options that the application provided in the top level call.\n * - The context also providedsaccess to parse functions so that the subloader\n * does not need to include the core module.\n * - In addition, the context's parse functions may also redirect loads from worker\n * threads back to main thread.\n */\nexport type LoaderContext = {\n /** Loader list provided to top-level loader call plus any sub loaders */\n loaders?: Loader[] | null;\n /** If URL is available. */\n url?: string;\n /** the file name component of the URL (leading path and query string removed) */\n filename?: string;\n /** the directory name component of the URL (leading path excluding file name and query string) */\n baseUrl?: string;\n /** Query string (characters after `?`) */\n queryString?: string;\n\n /** Provides access to any application overrides of fetch() */\n fetch: typeof fetch | FetchLike;\n\n /** TBD */\n response?: Response;\n\n /**\n * Parse function for subloaders. Avoids importing `core`. In workers, may redirect to main thread\n */\n _parse: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => Promise<any>;\n\n /**\n * ParseSync function. Avoids importing `core`. In workers, may redirect to main thread\n * @deprecated Do not call directly, use `parseSyncFromContext` instead\n */\n _parseSync?: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => any;\n\n /**\n * ParseInBatches function. Avoids importing `core`.\n * @deprecated Do not call directly, use `parseInBatchesFromContext` instead\n */\n _parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer> | Response,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => AsyncIterable<any> | Promise<AsyncIterable<any>>;\n};\n\n// type Parse = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => Promise<any>;\n// type ParseSync = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => any;\n// type ParseText = (text: string, options?: LoaderOptions) => Promise<any>;\n// type ParseTextSync = (text: string, options?: LoaderOptions) => any;\n// type ParseInBatches = (\n// iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n// type ParseFileInBatches = (\n// file: Blob,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n\ntype Preload = (url: string, options?: PreloadOptions) => any;\n\n/** Typescript helper to extract options type from a generic loader type */\nexport type LoaderOptionsType<T = Loader> = T extends Loader<any, any, infer Options>\n ? Options\n : never;\n/** Typescript helper to extract data type from a generic loader type */\nexport type LoaderReturnType<T = Loader> = T extends Loader<infer Return, any, any>\n ? Return\n : never;\n/** Typescript helper to extract batch type from a generic loader type */\nexport type LoaderBatchType<T = Loader> = T extends Loader<any, infer Batch, any> ? Batch : never;\n\n/**\n * Parses `data` asynchronously using the supplied loader, parse function provided via the loader context\n */\nexport async function parseFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<LoaderReturnType<LoaderT>>;\n\n/**\n * Parses `data` asynchronously by matching one of the supplied loader\n */\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown>;\n\n/**\n * Parses `data` using a specified loader\n * @param data\n * @param loaders\n * @param options\n * @param context\n */\n// implementation signature\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader | Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown> {\n return context._parse(data, loaders, options, context);\n}\n\n/**\n * Parses `data` synchronously using the specified loader, parse function provided via the loader context\n */\nexport function parseSyncFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): LoaderReturnType<LoaderT> {\n if (!context._parseSync) {\n throw new Error('parseSync');\n }\n return context._parseSync(data, loader, options, context);\n}\n\n/**\n * Parses `data` synchronously using a specified loader, parse function provided via the loader context\n */\nexport async function parseInBatchesFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: Iterable<ArrayBuffer> | AsyncIterable<ArrayBuffer> | Response,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<AsyncIterable<LoaderBatchType<LoaderT>>> {\n if (!context._parseInBatches) {\n throw new Error('parseInBatches');\n }\n return context._parseInBatches(data, loader, options, context);\n}\n"],"mappings":"AA0UA,OAAO,eAAeA,gBAAgBA,CACpCC,IAAiB,EACjBC,OAA0B,EAC1BC,OAAkC,EAClCC,OAAsB,EACJ;EAClB,OAAOA,OAAO,CAACC,MAAM,CAACJ,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,CAAC;AACxD;AAKA,OAAO,SAASE,oBAAoBA,CAIlCL,IAAiB,EACjBM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EACK;EAC3B,IAAI,CAACA,OAAO,CAACI,UAAU,EAAE;IACvB,MAAM,IAAIC,KAAK,CAAC,WAAW,CAAC;EAC9B;EACA,OAAOL,OAAO,CAACI,UAAU,CAACP,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAC3D;AAKA,OAAO,eAAeM,yBAAyBA,CAI7CT,IAAmE,EACnEM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EAC4B;EAClD,IAAI,CAACA,OAAO,CAACO,eAAe,EAAE;IAC5B,MAAM,IAAIF,KAAK,CAAC,gBAAgB,CAAC;EACnC;EACA,OAAOL,OAAO,CAACO,eAAe,CAACV,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAChE"}
|
|
1
|
+
{"version":3,"file":"loader-types.js","names":["parseFromContext","data","loaders","options","context","_parse","parseSyncFromContext","loader","_parseSync","Error","parseInBatchesFromContext","_parseInBatches"],"sources":["../src/loader-types.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n FetchLike,\n TransformBatches /* , DataType, SyncDataType, BatchableDataType */\n} from './types';\nimport {ReadableFile} from './lib/files/file';\n\n// LOADERS\n\n/**\n * Core Loader Options\n */\nexport type LoaderOptions = {\n /** fetch options or a custom fetch function */\n fetch?: typeof fetch | FetchLike | RequestInit | null;\n /** Do not throw on errors */\n nothrow?: boolean;\n\n /** loader selection, search first for supplied mimeType */\n mimeType?: string;\n /** loader selection, provide fallback mimeType is server does not provide */\n fallbackMimeType?: string;\n /** loader selection, avoid searching registered loaders */\n ignoreRegisteredLoaders?: boolean;\n\n // general\n /** Experimental: Supply a logger to the parser */\n log?: any;\n /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n useLocalLibraries?: boolean;\n\n // batched parsing\n\n /** Size of each batch. `auto` matches batches to size of incoming chunks */\n batchSize?: number | 'auto';\n /** Minimal amount of time between batches */\n batchDebounceMs?: number;\n /** Stop loading after a given number of rows (compare SQL limit clause) */\n limit?: 0;\n /** Experimental: Stop loading after reaching */\n _limitMB?: 0;\n /** Generate metadata batches */\n metadata?: boolean;\n /** Transforms to run on incoming batches */\n transforms?: TransformBatches[];\n\n // workers\n\n /** CDN load workers from */\n CDN?: string | null;\n /** Set to `false` to disable workers */\n worker?: boolean;\n /** Number of concurrent workers (per loader) on desktop browser */\n maxConcurrency?: number;\n /** Number of concurrent workers (per loader) on mobile browsers */\n maxMobileConcurrency?: number;\n /** Set to `false` to prevent reuse workers */\n reuseWorkers?: boolean;\n /** Whether to use workers under Node.js (experimental) */\n _nodeWorkers?: boolean;\n /** set to 'test' to run local worker */\n _workerType?: string;\n\n /** @deprecated `options.batchType` removed, Use `options.<loader>.type` instead */\n batchType?: 'row' | 'columnar' | 'arrow';\n /** @deprecated `options.throw removed`, Use `options.nothrow` instead */\n throws?: boolean;\n /** @deprecated `options.dataType` no longer used */\n dataType?: never;\n /** @deprecated `options.uri` no longer used */\n uri?: never;\n /** @deprecated Use `options.fetch.method` */\n method?: never;\n /** @deprecated Use `options.fetch.headers` */\n headers?: never;\n /** @deprecated Use `options.fetch.body` */\n body?: never;\n /** @deprecated Use `options.fetch.mode` */\n mode?: never;\n /** @deprecated Use `options.fetch.credentials` */\n credentials?: never;\n /** @deprecated Use `options.fetch.cache` */\n cache?: never;\n /** @deprecated Use `options.fetch.redirect` */\n redirect?: never;\n /** @deprecated Use `options.fetch.referrer` */\n referrer?: never;\n /** @deprecated Use `options.fetch.referrerPolicy` */\n referrerPolicy?: never;\n /** @deprecated Use `options.fetch.integrity` */\n integrity?: never;\n /** @deprecated Use `options.fetch.keepalive` */\n keepalive?: never;\n /** @deprecated Use `options.fetch.signal` */\n signal?: never;\n\n // Accept other keys (loader options objects, e.g. `options.csv`, `options.json` ...)\n [loaderId: string]: unknown;\n};\n\ntype PreloadOptions = {\n [key: string]: unknown;\n};\n\n/**\n * A worker loader definition that can be used with `@loaders.gl/core` functions\n */\nexport type Loader<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = {\n /** The result type of this loader */\n dataType?: DataT;\n /** The batched result type of this loader */\n batchType?: BatchT;\n\n /** Default Options */\n options: LoaderOptionsT;\n /** Deprecated Options */\n deprecatedOptions?: Record<string, string | Record<string, string>>;\n\n /** Human readable name */\n name: string;\n /** id should be the same as the field used in LoaderOptions */\n id: string;\n /** module is used to generate worker threads, need to be the module directory name */\n module: string;\n /** Version should be injected by build tools */\n version: string;\n /** A boolean, or a URL */\n worker?: string | boolean;\n // end Worker\n\n /** Which category does this loader belong to */\n category?: string;\n /** File extensions that are potential matches with this loader. */\n extensions: string[];\n /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */\n mimeTypes: string[];\n\n /** Is the input of this loader binary */\n binary?: boolean;\n /** Is the input of this loader text */\n text?: boolean;\n\n /** Test some initial bytes of content to see if this loader might be a match */\n tests?: (((ArrayBuffer: ArrayBuffer) => boolean) | ArrayBuffer | string)[];\n\n /** @deprecated */\n supported?: boolean;\n /** @deprecated */\n testText?: (string: string) => boolean;\n};\n\n/**\n * A \"bundled\" loader definition that can be used with `@loaders.gl/core` functions\n * If a worker loader is supported it will also be supported.\n */\nexport type LoaderWithParser<DataT = any, BatchT = any, LoaderOptionsT = LoaderOptions> = Loader<\n DataT,\n BatchT,\n LoaderOptionsT\n> & {\n /** Perform actions before load. @deprecated Not officially supported. */\n preload?: Preload;\n /** Parse asynchronously and atomically from an arraybuffer */\n parse: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => Promise<DataT>;\n /** Parse asynchronously and atomically from a random access \"file like\" input */\n parseFile?: (\n file: ReadableFile,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => Promise<DataT>;\n /** Parse synchronously and atomically from an arraybuffer */\n parseSync?: (\n arrayBuffer: ArrayBuffer,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => DataT;\n /** Parse batches of data from an iterator (e.g. fetch stream), return an iterator that yield parsed batches. */\n parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n /** For random access, file like sources, source that don't integrate with fetch. */\n parseFileInBatches?: (\n file: ReadableFile,\n options?: LoaderOptionsT,\n context?: LoaderContext\n ) => AsyncIterable<BatchT>;\n\n /** Parse atomically from a string asynchronously */\n parseText?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => Promise<DataT>;\n /** Parse atomically from a string synchronously */\n parseTextSync?: (text: string, options?: LoaderOptionsT, context?: LoaderContext) => DataT;\n};\n\n/**\n * A Loader context is provided as a third parameters to a loader object's\n * parse functions when that loader is called by other loaders rather then\n * directly by the application.\n *\n * - The context object allows the subloaders to be aware of the parameters and\n * options that the application provided in the top level call.\n * - The context also providedsaccess to parse functions so that the subloader\n * does not need to include the core module.\n * - In addition, the context's parse functions may also redirect loads from worker\n * threads back to main thread.\n */\nexport type LoaderContext = {\n /** Loader list provided to top-level loader call plus any sub loaders */\n loaders?: Loader[] | null;\n /** If URL is available. */\n url?: string;\n /** the file name component of the URL (leading path and query string removed) */\n filename?: string;\n /** the directory name component of the URL (leading path excluding file name and query string) */\n baseUrl?: string;\n /** Query string (characters after `?`) */\n queryString?: string;\n\n /** Provides access to any application overrides of fetch() */\n fetch: typeof fetch | FetchLike;\n\n /** TBD */\n response?: Response;\n\n /**\n * Parse function for subloaders. Avoids importing `core`. In workers, may redirect to main thread\n */\n _parse: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => Promise<any>;\n\n /**\n * ParseSync function. Avoids importing `core`. In workers, may redirect to main thread\n * @deprecated Do not call directly, use `parseSyncFromContext` instead\n */\n _parseSync?: (\n arrayBuffer: ArrayBuffer,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => any;\n\n /**\n * ParseInBatches function. Avoids importing `core`.\n * @deprecated Do not call directly, use `parseInBatchesFromContext` instead\n */\n _parseInBatches?: (\n iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer> | Response,\n loaders?: Loader | Loader[] | LoaderOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n ) => AsyncIterable<any> | Promise<AsyncIterable<any>>;\n};\n\n// type Parse = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => Promise<any>;\n// type ParseSync = (\n// arrayBuffer: ArrayBuffer,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => any;\n// type ParseText = (text: string, options?: LoaderOptions) => Promise<any>;\n// type ParseTextSync = (text: string, options?: LoaderOptions) => any;\n// type ParseInBatches = (\n// iterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n// type ParseFileInBatches = (\n// file: Blob,\n// options?: LoaderOptions,\n// context?: LoaderContext\n// ) => AsyncIterable<any>;\n\ntype Preload = (url: string, options?: PreloadOptions) => any;\n\n/** Typescript helper to extract options type from a generic loader type */\nexport type LoaderOptionsType<T = Loader> = T extends Loader<any, any, infer Options>\n ? Options\n : never;\n/** Typescript helper to extract data type from a generic loader type */\nexport type LoaderReturnType<T = Loader> = T extends Loader<infer Return, any, any>\n ? Return\n : never;\n/** Typescript helper to extract batch type from a generic loader type */\nexport type LoaderBatchType<T = Loader> = T extends Loader<any, infer Batch, any> ? Batch : never;\n\n/**\n * Parses `data` asynchronously using the supplied loader, parse function provided via the loader context\n */\nexport async function parseFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<LoaderReturnType<LoaderT>>;\n\n/**\n * Parses `data` asynchronously by matching one of the supplied loader\n */\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown>;\n\n/**\n * Parses `data` using a specified loader\n * @param data\n * @param loaders\n * @param options\n * @param context\n */\n// implementation signature\nexport async function parseFromContext(\n data: ArrayBuffer,\n loaders: Loader | Loader[],\n options: LoaderOptions | undefined,\n context: LoaderContext\n): Promise<unknown> {\n return context._parse(data, loaders, options, context);\n}\n\n/**\n * Parses `data` synchronously using the specified loader, parse function provided via the loader context\n */\nexport function parseSyncFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: ArrayBuffer,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): LoaderReturnType<LoaderT> {\n if (!context._parseSync) {\n throw new Error('parseSync');\n }\n return context._parseSync(data, loader, options, context);\n}\n\n/**\n * Parses `data` synchronously using a specified loader, parse function provided via the loader context\n */\nexport async function parseInBatchesFromContext<\n LoaderT extends Loader,\n OptionsT extends LoaderOptions = LoaderOptionsType<LoaderT>\n>(\n data: Iterable<ArrayBuffer> | AsyncIterable<ArrayBuffer> | Response,\n loader: LoaderT,\n options: OptionsT | undefined,\n context: LoaderContext\n): Promise<AsyncIterable<LoaderBatchType<LoaderT>>> {\n if (!context._parseInBatches) {\n throw new Error('parseInBatches');\n }\n return context._parseInBatches(data, loader, options, context);\n}\n"],"mappings":"AA4UA,OAAO,eAAeA,gBAAgBA,CACpCC,IAAiB,EACjBC,OAA0B,EAC1BC,OAAkC,EAClCC,OAAsB,EACJ;EAClB,OAAOA,OAAO,CAACC,MAAM,CAACJ,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,CAAC;AACxD;AAKA,OAAO,SAASE,oBAAoBA,CAIlCL,IAAiB,EACjBM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EACK;EAC3B,IAAI,CAACA,OAAO,CAACI,UAAU,EAAE;IACvB,MAAM,IAAIC,KAAK,CAAC,WAAW,CAAC;EAC9B;EACA,OAAOL,OAAO,CAACI,UAAU,CAACP,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAC3D;AAKA,OAAO,eAAeM,yBAAyBA,CAI7CT,IAAmE,EACnEM,MAAe,EACfJ,OAA6B,EAC7BC,OAAsB,EAC4B;EAClD,IAAI,CAACA,OAAO,CAACO,eAAe,EAAE;IAC5B,MAAM,IAAIF,KAAK,CAAC,gBAAgB,CAAC;EACnC;EACA,OAAOL,OAAO,CAACO,eAAe,CAACV,IAAI,EAAEM,MAAM,EAAEJ,OAAO,EAAEC,OAAO,CAAC;AAChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../src/service-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../src/service-types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAE9E,8BAA8B;AAC9B,MAAM,WAAW,OAAO,CAAC,OAAO,GAAG,WAAW,EAAE,YAAY,GAAG,gBAAgB;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-types.js","names":[],"sources":["../src/service-types.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"service-types.js","names":[],"sources":["../src/service-types.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ImageSource, ImageSourceProps} from './lib/sources/image-source';\n\n/** Export interface source */\nexport interface Service<SourceT = ImageSource, SourcePropsT = ImageSourceProps> {\n source?: SourceT;\n props?: SourcePropsT;\n type: string;\n testURL: (url: string) => boolean;\n create(props: SourcePropsT): SourceT;\n}\n"],"mappings":""}
|
package/dist/writer-types.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOpt
|
|
|
35
35
|
binary?: boolean;
|
|
36
36
|
/** Is the input of this loader text */
|
|
37
37
|
text?: boolean;
|
|
38
|
+
/** Default options for this writer */
|
|
38
39
|
options: WriterOptionsT;
|
|
39
40
|
deprecatedOptions?: Record<string, string>;
|
|
40
41
|
};
|
|
@@ -42,11 +43,18 @@ export type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOpt
|
|
|
42
43
|
* A writer definition that can be used with `@loaders.gl/core` functions
|
|
43
44
|
*/
|
|
44
45
|
export type WriterWithEncoder<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = Writer<DataT, BatchT, WriterOptionsT> & {
|
|
45
|
-
|
|
46
|
+
/** Encode to binary, asynchronously */
|
|
47
|
+
encode(data: DataT, options?: WriterOptionsT): Promise<ArrayBuffer>;
|
|
48
|
+
/** Encode to binary, synchronously */
|
|
46
49
|
encodeSync?(data: DataT, options?: WriterOptionsT): ArrayBuffer;
|
|
50
|
+
/** Encode to binary in batches */
|
|
51
|
+
encodeInBatches?(data: AsyncIterable<any>, options?: WriterOptionsT): AsyncIterable<ArrayBuffer>;
|
|
52
|
+
/** Encode to text, asynchronously. For text formats. */
|
|
47
53
|
encodeText?(table: DataT, options?: WriterOptionsT): Promise<string>;
|
|
54
|
+
/** Encode to text, synchronously. For text formats. */
|
|
48
55
|
encodeTextSync?(table: DataT, options?: WriterOptionsT): string;
|
|
49
|
-
|
|
56
|
+
/** Encode to text in batched. For text formats. */
|
|
57
|
+
encodeTextInBatches?(data: AsyncIterable<any>, options?: WriterOptionsT): AsyncIterable<ArrayBuffer>;
|
|
50
58
|
encodeURLtoURL?: (inputUrl: string, outputUrl: string, options?: WriterOptionsT) => Promise<string>;
|
|
51
59
|
};
|
|
52
60
|
/** Typescript helper to extract the writer options type from a generic writer type */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer-types.d.ts","sourceRoot":"","sources":["../src/writer-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writer-types.d.ts","sourceRoot":"","sources":["../src/writer-types.ts"],"names":[],"mappings":"AAMA,0BAA0B;AAC1B,MAAM,MAAM,aAAa,GAAG;IAC1B,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8BAA8B;IAC9B,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB,CAAC;AAEF;;GAEG;AAEH,MAAM,MAAM,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,cAAc,GAAG,aAAa,IAAI;IACtF,sCAAsC;IACtC,QAA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CAAC,CAAC;IAEjG,wDAAwD;IACxD,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrE,uDAAuD;IACvD,cAAc,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAChE,mDAAmD;IACnD,mBAAmB,CAAC,CAClB,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,EACxB,OAAO,CAAC,EAAE,cAAc,GACvB,aAAa,CAAC,WAAW,CAAC,CAAC;IAE9B,cAAc,CAAC,EAAE,CACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAEF,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,GACzF,OAAO,GACP,KAAK,CAAC"}
|
package/dist/writer-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer-types.js","names":[],"sources":["../src/writer-types.ts"],"sourcesContent":["// loaders.gl
|
|
1
|
+
{"version":3,"file":"writer-types.js","names":[],"sources":["../src/writer-types.ts"],"sourcesContent":["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// WRITERS\n\n/** Options for writers */\nexport type WriterOptions = {\n /** worker source. If is set will be used instead of loading worker from the Internet */\n source?: string | null;\n /** Force to load WASM libraries from local file system in NodeJS or from loaders.gl CDN in a web browser */\n useLocalLibraries?: boolean;\n /** writer-specific options */\n [writerId: string]: any;\n};\n\n/**\n * A writer definition that can be used with `@loaders.gl/core` functions\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type Writer<DataT = unknown, BatchT = unknown, WriterOptionsT = WriterOptions> = {\n /** The result type of this loader */\n dataType?: DataT;\n /** The batched result type of this loader */\n batchType?: BatchT;\n\n /** Human readable name */\n name: string;\n /** id should be the same as the field used in LoaderOptions */\n id: string;\n /** module is used to generate worker threads, need to be the module directory name */\n module: string;\n /** Version should be injected by build tools */\n version: string;\n /** A boolean, or a URL */\n worker?: string | boolean;\n // end Worker\n\n /** Which category does this loader belong to */\n category?: string;\n /** File extensions that are potential matches with this loader. */\n extensions: string[];\n /** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */\n mimeTypes?: string[];\n\n /** Is the input of this loader binary */\n binary?: boolean;\n /** Is the input of this loader text */\n text?: boolean;\n\n /** Default options for this writer */\n options: WriterOptionsT;\n deprecatedOptions?: Record<string, string>;\n};\n\n/**\n * A writer definition that can be used with `@loaders.gl/core` functions\n */\nexport type WriterWithEncoder<\n DataT = unknown,\n BatchT = unknown,\n WriterOptionsT = WriterOptions\n> = Writer<DataT, BatchT, WriterOptionsT> & {\n /** Encode to binary, asynchronously */\n encode(data: DataT, options?: WriterOptionsT): Promise<ArrayBuffer>;\n /** Encode to binary, synchronously */\n encodeSync?(data: DataT, options?: WriterOptionsT): ArrayBuffer;\n /** Encode to binary in batches */\n encodeInBatches?(data: AsyncIterable<any>, options?: WriterOptionsT): AsyncIterable<ArrayBuffer>;\n\n /** Encode to text, asynchronously. For text formats. */\n encodeText?(table: DataT, options?: WriterOptionsT): Promise<string>;\n /** Encode to text, synchronously. For text formats. */\n encodeTextSync?(table: DataT, options?: WriterOptionsT): string;\n /** Encode to text in batched. For text formats. */\n encodeTextInBatches?(\n data: AsyncIterable<any>,\n options?: WriterOptionsT\n ): AsyncIterable<ArrayBuffer>;\n\n encodeURLtoURL?: (\n inputUrl: string,\n outputUrl: string,\n options?: WriterOptionsT\n ) => Promise<string>;\n};\n\n/** Typescript helper to extract the writer options type from a generic writer type */\nexport type WriterOptionsType<T = Writer> = T extends Writer<unknown, unknown, infer Options>\n ? Options\n : never;\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/loader-utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-alpha.10",
|
|
4
4
|
"description": "Framework-independent loaders for 3D graphics formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"module": "dist/index.js",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
26
27
|
"import": "./dist/index.js",
|
|
27
|
-
"require": "./dist/index.cjs"
|
|
28
|
-
"types": "./dist/index.d.ts"
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"sideEffects": false,
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"scripts": {},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/runtime": "^7.3.1",
|
|
50
|
-
"@loaders.gl/worker-utils": "4.0.
|
|
50
|
+
"@loaders.gl/worker-utils": "4.1.0-alpha.10",
|
|
51
51
|
"@probe.gl/stats": "^4.0.2"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "19f43c2d90d8b50860c3f8e487429779a386287d"
|
|
54
54
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// loaders.gl
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
|
|
4
5
|
// TYPES
|
|
@@ -63,6 +64,7 @@ export {parseJSON} from './lib/parser-utils/parse-json';
|
|
|
63
64
|
export {
|
|
64
65
|
sliceArrayBuffer,
|
|
65
66
|
concatenateArrayBuffers,
|
|
67
|
+
concatenateArrayBuffersFromArray,
|
|
66
68
|
concatenateTypedArrays,
|
|
67
69
|
compareArrayBuffers
|
|
68
70
|
} from './lib/binary-utils/array-buffer-utils';
|
|
@@ -26,10 +26,18 @@ export function compareArrayBuffers(
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Concatenate a sequence of ArrayBuffers
|
|
29
|
+
* Concatenate a sequence of ArrayBuffers from arguments
|
|
30
30
|
* @return A concatenated ArrayBuffer
|
|
31
31
|
*/
|
|
32
|
-
export function concatenateArrayBuffers(...sources: (ArrayBuffer | Uint8Array)[]):
|
|
32
|
+
export function concatenateArrayBuffers(...sources: (ArrayBuffer | Uint8Array)[]): any {
|
|
33
|
+
return concatenateArrayBuffersFromArray(sources);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Concatenate a sequence of ArrayBuffers from array
|
|
38
|
+
* @return A concatenated ArrayBuffer
|
|
39
|
+
*/
|
|
40
|
+
export function concatenateArrayBuffersFromArray(sources: (ArrayBuffer | Uint8Array)[]): any {
|
|
33
41
|
// Make sure all inputs are wrapped in typed arrays
|
|
34
42
|
const sourceArrays = sources.map((source2) =>
|
|
35
43
|
source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2
|