geotiff 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-browser/geotiff.js +3 -2
- package/dist-browser/geotiff.js.map +1 -1
- package/dist-module/compression/basedecoder.d.ts +4 -0
- package/dist-module/compression/basedecoder.d.ts.map +1 -1
- package/dist-module/compression/basedecoder.js +6 -0
- package/dist-module/compression/index.d.ts +4 -4
- package/dist-module/compression/index.d.ts.map +1 -1
- package/dist-module/compression/index.js +4 -4
- package/dist-module/compression/jpeg.d.ts +6 -1
- package/dist-module/compression/jpeg.d.ts.map +1 -1
- package/dist-module/compression/jpeg.js +50 -5
- package/dist-module/compression/lzw.js +1 -1
- package/dist-module/compression/webimage.d.ts +1 -1
- package/dist-module/compression/webimage.d.ts.map +1 -1
- package/dist-module/compression/webimage.js +1 -1
- package/dist-module/dataslice.d.ts.map +1 -1
- package/dist-module/dataslice.js +2 -2
- package/dist-module/dataview64.d.ts +2 -2
- package/dist-module/dataview64.d.ts.map +1 -1
- package/dist-module/dataview64.js +4 -4
- package/dist-module/geotiff.d.ts +161 -45
- package/dist-module/geotiff.d.ts.map +1 -1
- package/dist-module/geotiff.js +111 -20
- package/dist-module/geotiffimage.d.ts +76 -110
- package/dist-module/geotiffimage.d.ts.map +1 -1
- package/dist-module/geotiffimage.js +98 -70
- package/dist-module/geotiffwriter.js +2 -2
- package/dist-module/globals.d.ts +48 -40
- package/dist-module/globals.d.ts.map +1 -1
- package/dist-module/globals.js +14 -10
- package/dist-module/imagefiledirectory.d.ts +2 -2
- package/dist-module/imagefiledirectory.d.ts.map +1 -1
- package/dist-module/imagefiledirectory.js +23 -12
- package/dist-module/logging.js +7 -7
- package/dist-module/pool.d.ts +2 -3
- package/dist-module/pool.d.ts.map +1 -1
- package/dist-module/pool.js +18 -16
- package/dist-module/predictor.js +1 -1
- package/dist-module/resample.d.ts +18 -18
- package/dist-module/resample.d.ts.map +1 -1
- package/dist-module/resample.js +12 -12
- package/dist-module/source/basesource.d.ts +7 -7
- package/dist-module/source/basesource.d.ts.map +1 -1
- package/dist-module/source/basesource.js +7 -7
- package/dist-module/source/blockedsource.d.ts +10 -10
- package/dist-module/source/blockedsource.d.ts.map +1 -1
- package/dist-module/source/blockedsource.js +12 -9
- package/dist-module/source/client/base.d.ts +8 -10
- package/dist-module/source/client/base.d.ts.map +1 -1
- package/dist-module/source/client/base.js +4 -3
- package/dist-module/source/client/fetch.d.ts +2 -7
- package/dist-module/source/client/fetch.d.ts.map +1 -1
- package/dist-module/source/client/fetch.js +7 -2
- package/dist-module/source/client/http.d.ts +4 -1
- package/dist-module/source/client/http.d.ts.map +1 -1
- package/dist-module/source/client/http.js +4 -4
- package/dist-module/source/client/xhr.d.ts +4 -1
- package/dist-module/source/client/xhr.d.ts.map +1 -1
- package/dist-module/source/client/xhr.js +1 -1
- package/dist-module/source/file.js +4 -4
- package/dist-module/source/filereader.js +1 -1
- package/dist-module/source/httputils.d.ts +14 -6
- package/dist-module/source/httputils.d.ts.map +1 -1
- package/dist-module/source/httputils.js +13 -12
- package/dist-module/source/remote.d.ts +31 -22
- package/dist-module/source/remote.d.ts.map +1 -1
- package/dist-module/source/remote.js +37 -13
- package/dist-module/utils.d.ts +7 -1
- package/dist-module/utils.d.ts.map +1 -1
- package/dist-module/utils.js +6 -0
- package/dist-module/worker/create.js +1 -1
- package/dist-node/compression/basedecoder.d.ts +4 -0
- package/dist-node/compression/basedecoder.d.ts.map +1 -1
- package/dist-node/compression/basedecoder.js +6 -0
- package/dist-node/compression/basedecoder.js.map +1 -1
- package/dist-node/compression/index.d.ts +4 -4
- package/dist-node/compression/index.d.ts.map +1 -1
- package/dist-node/compression/index.js +4 -4
- package/dist-node/compression/jpeg.d.ts +6 -1
- package/dist-node/compression/jpeg.d.ts.map +1 -1
- package/dist-node/compression/jpeg.js +50 -5
- package/dist-node/compression/jpeg.js.map +1 -1
- package/dist-node/compression/lzw.js +1 -1
- package/dist-node/compression/lzw.js.map +1 -1
- package/dist-node/compression/webimage.js +1 -1
- package/dist-node/compression/webimage.js.map +1 -1
- package/dist-node/dataslice.js +2 -2
- package/dist-node/dataslice.js.map +1 -1
- package/dist-node/dataview64.d.ts +2 -2
- package/dist-node/dataview64.d.ts.map +1 -1
- package/dist-node/dataview64.js +4 -4
- package/dist-node/dataview64.js.map +1 -1
- package/dist-node/geotiff.d.ts +161 -45
- package/dist-node/geotiff.d.ts.map +1 -1
- package/dist-node/geotiff.js +110 -20
- package/dist-node/geotiff.js.map +1 -1
- package/dist-node/geotiffimage.d.ts +77 -111
- package/dist-node/geotiffimage.d.ts.map +1 -1
- package/dist-node/geotiffimage.js +98 -70
- package/dist-node/geotiffimage.js.map +1 -1
- package/dist-node/geotiffwriter.js +2 -2
- package/dist-node/geotiffwriter.js.map +1 -1
- package/dist-node/globals.d.ts +48 -40
- package/dist-node/globals.d.ts.map +1 -1
- package/dist-node/globals.js +14 -10
- package/dist-node/globals.js.map +1 -1
- package/dist-node/imagefiledirectory.d.ts +2 -2
- package/dist-node/imagefiledirectory.d.ts.map +1 -1
- package/dist-node/imagefiledirectory.js +23 -12
- package/dist-node/imagefiledirectory.js.map +1 -1
- package/dist-node/logging.js +7 -7
- package/dist-node/logging.js.map +1 -1
- package/dist-node/pool.d.ts +2 -3
- package/dist-node/pool.d.ts.map +1 -1
- package/dist-node/pool.js +18 -16
- package/dist-node/pool.js.map +1 -1
- package/dist-node/predictor.js +1 -1
- package/dist-node/predictor.js.map +1 -1
- package/dist-node/resample.d.ts +18 -18
- package/dist-node/resample.d.ts.map +1 -1
- package/dist-node/resample.js +12 -12
- package/dist-node/source/basesource.d.ts +7 -7
- package/dist-node/source/basesource.d.ts.map +1 -1
- package/dist-node/source/basesource.js +7 -7
- package/dist-node/source/basesource.js.map +1 -1
- package/dist-node/source/blockedsource.d.ts +10 -10
- package/dist-node/source/blockedsource.d.ts.map +1 -1
- package/dist-node/source/blockedsource.js +12 -9
- package/dist-node/source/blockedsource.js.map +1 -1
- package/dist-node/source/client/base.d.ts +8 -10
- package/dist-node/source/client/base.d.ts.map +1 -1
- package/dist-node/source/client/base.js +4 -3
- package/dist-node/source/client/base.js.map +1 -1
- package/dist-node/source/client/fetch.d.ts +2 -6
- package/dist-node/source/client/fetch.d.ts.map +1 -1
- package/dist-node/source/client/fetch.js +7 -2
- package/dist-node/source/client/fetch.js.map +1 -1
- package/dist-node/source/client/http.d.ts +4 -1
- package/dist-node/source/client/http.d.ts.map +1 -1
- package/dist-node/source/client/http.js +4 -4
- package/dist-node/source/client/http.js.map +1 -1
- package/dist-node/source/client/xhr.d.ts +4 -1
- package/dist-node/source/client/xhr.d.ts.map +1 -1
- package/dist-node/source/client/xhr.js +1 -1
- package/dist-node/source/client/xhr.js.map +1 -1
- package/dist-node/source/file.js +4 -4
- package/dist-node/source/file.js.map +1 -1
- package/dist-node/source/filereader.js +1 -1
- package/dist-node/source/filereader.js.map +1 -1
- package/dist-node/source/httputils.d.ts +14 -6
- package/dist-node/source/httputils.d.ts.map +1 -1
- package/dist-node/source/httputils.js +13 -12
- package/dist-node/source/httputils.js.map +1 -1
- package/dist-node/source/remote.d.ts +31 -22
- package/dist-node/source/remote.d.ts.map +1 -1
- package/dist-node/source/remote.js +37 -13
- package/dist-node/source/remote.js.map +1 -1
- package/dist-node/utils.d.ts +7 -1
- package/dist-node/utils.d.ts.map +1 -1
- package/dist-node/utils.js +6 -0
- package/dist-node/utils.js.map +1 -1
- package/dist-node/worker/create.js +1 -1
- package/dist-node/worker/create.js.map +1 -1
- package/package.json +3 -54
package/dist-module/logging.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* A no-op logger
|
|
3
3
|
*/
|
|
4
4
|
class DummyLogger {
|
|
5
|
-
log() { }
|
|
6
|
-
debug() { }
|
|
7
|
-
info() { }
|
|
8
|
-
warn() { }
|
|
9
|
-
error() { }
|
|
10
|
-
time() { }
|
|
11
|
-
timeEnd() { }
|
|
5
|
+
log(..._args) { }
|
|
6
|
+
debug(..._args) { }
|
|
7
|
+
info(..._args) { }
|
|
8
|
+
warn(..._args) { }
|
|
9
|
+
error(..._args) { }
|
|
10
|
+
time(..._args) { }
|
|
11
|
+
timeEnd(..._args) { }
|
|
12
12
|
}
|
|
13
13
|
let LOGGER = new DummyLogger();
|
|
14
14
|
/**
|
package/dist-module/pool.d.ts
CHANGED
|
@@ -34,9 +34,8 @@ declare class Pool {
|
|
|
34
34
|
*/
|
|
35
35
|
constructor(size?: number, createWorker?: () => Worker);
|
|
36
36
|
workerWrappers: Promise<WorkerWrapper[]> | null;
|
|
37
|
-
bindParameters(compression: any, decoderParameters: any):
|
|
38
|
-
|
|
39
|
-
};
|
|
37
|
+
bindParameters(compression: any, decoderParameters: any): this;
|
|
38
|
+
decode(_buffer: any): Promise<void>;
|
|
40
39
|
destroy(): Promise<void>;
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.js"],"names":[],"mappings":";AAiFA;;GAEG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,0CAxBW,MAAY,MAAM,EAsC5B;IAbC,gDAA0B;IAe5B
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.js"],"names":[],"mappings":";AAiFA;;GAEG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,0CAxBW,MAAY,MAAM,EAsC5B;IAbC,gDAA0B;IAe5B,+DAeC;IAED,oCAEC;IAED,yBAOC;CACF;AA1JD;;GAEG;AAEH;;GAEG;AACH;IACE;;OAEG;IACH,oBAFW,MAAM,EAOhB;IAJC,eAAoB;IAEpB,qBAAqB;IACrB,oBAAqB;IAGvB;;;OAGG;IACH,mBAEC;IAED;;;OAGG;IACH,sBAEC;IAED,+BAUC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,kBACN,MAAM,EAAE,gBAgBlB;IAED,kBAEC;CACF"}
|
package/dist-module/pool.js
CHANGED
|
@@ -57,7 +57,7 @@ class WorkerWrapper {
|
|
|
57
57
|
reject = _reject;
|
|
58
58
|
});
|
|
59
59
|
this.jobs.set(jobId, { resolve, reject });
|
|
60
|
-
this.worker.postMessage({ ...message, jobId }, transferables);
|
|
60
|
+
this.worker.postMessage({ ...message, jobId }, { transfer: transferables });
|
|
61
61
|
return promise;
|
|
62
62
|
}
|
|
63
63
|
terminate() {
|
|
@@ -116,22 +116,24 @@ class Pool {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
bindParameters(compression, decoderParameters) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
},
|
|
119
|
+
this.decode = async (buffer) => {
|
|
120
|
+
if (preferWorker(compression) && this.workerWrappers) {
|
|
121
|
+
// select the worker with the lowest jobCount
|
|
122
|
+
const workerWrapper = (await this.workerWrappers).reduce((a, b) => {
|
|
123
|
+
return a.getJobCount() < b.getJobCount() ? a : b;
|
|
124
|
+
});
|
|
125
|
+
const { decoded } = await workerWrapper.submitJob({ compression, decoderParameters, buffer }, [buffer]);
|
|
126
|
+
return decoded;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const decoder = await getDecoder(compression, decoderParameters);
|
|
130
|
+
return decoder.decode(buffer);
|
|
131
|
+
}
|
|
134
132
|
};
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
async decode(_buffer) {
|
|
136
|
+
throw new Error('Pool not initialized. Call `pool.bindParameters()` first.');
|
|
135
137
|
}
|
|
136
138
|
async destroy() {
|
|
137
139
|
if (this.workerWrappers) {
|
package/dist-module/predictor.js
CHANGED
|
@@ -61,7 +61,7 @@ export function applyPredictor(block, predictor, width, height, bitsPerSample, p
|
|
|
61
61
|
default:
|
|
62
62
|
throw new Error(`Predictor 2 not allowed with ${bitsPerSample[0]} bits per sample.`);
|
|
63
63
|
}
|
|
64
|
-
decodeRowAcc(row, stride
|
|
64
|
+
decodeRowAcc(row, stride);
|
|
65
65
|
}
|
|
66
66
|
else if (predictor === 3) { // horizontal floating point
|
|
67
67
|
row = new Uint8Array(block, i * stride * width * bytesPerSample, stride * width * bytesPerSample);
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resample the input arrays using nearest neighbor value selection.
|
|
3
|
-
* @param {TypedArray[]} valueArrays The input arrays to resample
|
|
3
|
+
* @param {import("./geotiff").TypedArray[]} valueArrays The input arrays to resample
|
|
4
4
|
* @param {number} inWidth The width of the input rasters
|
|
5
5
|
* @param {number} inHeight The height of the input rasters
|
|
6
6
|
* @param {number} outWidth The desired width of the output rasters
|
|
7
7
|
* @param {number} outHeight The desired height of the output rasters
|
|
8
|
-
* @returns {TypedArray[]} The resampled rasters
|
|
8
|
+
* @returns {import("./geotiff").TypedArray[]} The resampled rasters
|
|
9
9
|
*/
|
|
10
|
-
export function resampleNearest(valueArrays: TypedArray[], inWidth: number, inHeight: number, outWidth: number, outHeight: number): TypedArray[];
|
|
10
|
+
export function resampleNearest(valueArrays: import("./geotiff").TypedArray[], inWidth: number, inHeight: number, outWidth: number, outHeight: number): import("./geotiff").TypedArray[];
|
|
11
11
|
/**
|
|
12
12
|
* Resample the input arrays using bilinear interpolation.
|
|
13
|
-
* @param {TypedArray[]} valueArrays The input arrays to resample
|
|
13
|
+
* @param {import("./geotiff").TypedArray[]} valueArrays The input arrays to resample
|
|
14
14
|
* @param {number} inWidth The width of the input rasters
|
|
15
15
|
* @param {number} inHeight The height of the input rasters
|
|
16
16
|
* @param {number} outWidth The desired width of the output rasters
|
|
17
17
|
* @param {number} outHeight The desired height of the output rasters
|
|
18
|
-
* @returns {TypedArray[]} The resampled rasters
|
|
18
|
+
* @returns {import("./geotiff").TypedArray[]} The resampled rasters
|
|
19
19
|
*/
|
|
20
|
-
export function resampleBilinear(valueArrays: TypedArray[], inWidth: number, inHeight: number, outWidth: number, outHeight: number): TypedArray[];
|
|
20
|
+
export function resampleBilinear(valueArrays: import("./geotiff").TypedArray[], inWidth: number, inHeight: number, outWidth: number, outHeight: number): import("./geotiff").TypedArray[];
|
|
21
21
|
/**
|
|
22
22
|
* Resample the input arrays using the selected resampling method.
|
|
23
|
-
* @param {TypedArray[]} valueArrays The input arrays to resample
|
|
23
|
+
* @param {import("./geotiff").TypedArray[]} valueArrays The input arrays to resample
|
|
24
24
|
* @param {number} inWidth The width of the input rasters
|
|
25
25
|
* @param {number} inHeight The height of the input rasters
|
|
26
26
|
* @param {number} outWidth The desired width of the output rasters
|
|
27
27
|
* @param {number} outHeight The desired height of the output rasters
|
|
28
28
|
* @param {string} [method = 'nearest'] The desired resampling method
|
|
29
|
-
* @returns {TypedArray[]} The resampled rasters
|
|
29
|
+
* @returns {import("./geotiff").TypedArray[]} The resampled rasters
|
|
30
30
|
*/
|
|
31
|
-
export function resample(valueArrays: TypedArray[], inWidth: number, inHeight: number, outWidth: number, outHeight: number, method?: string): TypedArray[];
|
|
31
|
+
export function resample(valueArrays: import("./geotiff").TypedArray[], inWidth: number, inHeight: number, outWidth: number, outHeight: number, method?: string): import("./geotiff").TypedArray[];
|
|
32
32
|
/**
|
|
33
33
|
* Resample the pixel interleaved input array using nearest neighbor value selection.
|
|
34
|
-
* @param {TypedArray}
|
|
34
|
+
* @param {import("./geotiff").TypedArray} valueArray The input array to resample
|
|
35
35
|
* @param {number} inWidth The width of the input rasters
|
|
36
36
|
* @param {number} inHeight The height of the input rasters
|
|
37
37
|
* @param {number} outWidth The desired width of the output rasters
|
|
38
38
|
* @param {number} outHeight The desired height of the output rasters
|
|
39
39
|
* @param {number} samples The number of samples per pixel for pixel
|
|
40
40
|
* interleaved data
|
|
41
|
-
* @returns {TypedArray} The resampled raster
|
|
41
|
+
* @returns {import("./geotiff").TypedArray} The resampled raster
|
|
42
42
|
*/
|
|
43
|
-
export function resampleNearestInterleaved(valueArray:
|
|
43
|
+
export function resampleNearestInterleaved(valueArray: import("./geotiff").TypedArray, inWidth: number, inHeight: number, outWidth: number, outHeight: number, samples: number): import("./geotiff").TypedArray;
|
|
44
44
|
/**
|
|
45
45
|
* Resample the pixel interleaved input array using bilinear interpolation.
|
|
46
|
-
* @param {TypedArray}
|
|
46
|
+
* @param {import("./geotiff").TypedArray} valueArray The input array to resample
|
|
47
47
|
* @param {number} inWidth The width of the input rasters
|
|
48
48
|
* @param {number} inHeight The height of the input rasters
|
|
49
49
|
* @param {number} outWidth The desired width of the output rasters
|
|
50
50
|
* @param {number} outHeight The desired height of the output rasters
|
|
51
51
|
* @param {number} samples The number of samples per pixel for pixel
|
|
52
52
|
* interleaved data
|
|
53
|
-
* @returns {TypedArray} The resampled raster
|
|
53
|
+
* @returns {import("./geotiff").TypedArray} The resampled raster
|
|
54
54
|
*/
|
|
55
|
-
export function resampleBilinearInterleaved(valueArray:
|
|
55
|
+
export function resampleBilinearInterleaved(valueArray: import("./geotiff").TypedArray, inWidth: number, inHeight: number, outWidth: number, outHeight: number, samples: number): import("./geotiff").TypedArray;
|
|
56
56
|
/**
|
|
57
57
|
* Resample the pixel interleaved input array using the selected resampling method.
|
|
58
|
-
* @param {TypedArray} valueArray The input array to resample
|
|
58
|
+
* @param {import("./geotiff").TypedArray} valueArray The input array to resample
|
|
59
59
|
* @param {number} inWidth The width of the input rasters
|
|
60
60
|
* @param {number} inHeight The height of the input rasters
|
|
61
61
|
* @param {number} outWidth The desired width of the output rasters
|
|
@@ -63,7 +63,7 @@ export function resampleBilinearInterleaved(valueArray: any, inWidth: number, in
|
|
|
63
63
|
* @param {number} samples The number of samples per pixel for pixel
|
|
64
64
|
* interleaved data
|
|
65
65
|
* @param {string} [method = 'nearest'] The desired resampling method
|
|
66
|
-
* @returns {TypedArray} The resampled rasters
|
|
66
|
+
* @returns {import("./geotiff").TypedArray} The resampled rasters
|
|
67
67
|
*/
|
|
68
|
-
export function resampleInterleaved(valueArray: TypedArray, inWidth: number, inHeight: number, outWidth: number, outHeight: number, samples: number, method?: string): TypedArray;
|
|
68
|
+
export function resampleInterleaved(valueArray: import("./geotiff").TypedArray, inWidth: number, inHeight: number, outWidth: number, outHeight: number, samples: number, method?: string): import("./geotiff").TypedArray;
|
|
69
69
|
//# sourceMappingURL=resample.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resample.d.ts","sourceRoot":"","sources":["../src/resample.js"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,6CAPW,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"resample.d.ts","sourceRoot":"","sources":["../src/resample.js"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,6CAPW,OAAO,WAAW,EAAE,UAAU,EAAE,WAChC,MAAM,YACN,MAAM,YACN,MAAM,aACN,MAAM,GACJ,OAAO,WAAW,EAAE,UAAU,EAAE,CAiB5C;AAQD;;;;;;;;GAQG;AACH,8CAPW,OAAO,WAAW,EAAE,UAAU,EAAE,WAChC,MAAM,YACN,MAAM,YACN,MAAM,aACN,MAAM,GACJ,OAAO,WAAW,EAAE,UAAU,EAAE,CAoC5C;AAED;;;;;;;;;GASG;AACH,sCARW,OAAO,WAAW,EAAE,UAAU,EAAE,WAChC,MAAM,YACN,MAAM,YACN,MAAM,aACN,MAAM,WACN,MAAM,GACJ,OAAO,WAAW,EAAE,UAAU,EAAE,CAY5C;AAED;;;;;;;;;;GAUG;AACH,uDATW,OAAO,WAAW,EAAE,UAAU,WAC9B,MAAM,YACN,MAAM,YACN,MAAM,aACN,MAAM,WACN,MAAM,GAEJ,OAAO,WAAW,EAAE,UAAU,CAmB1C;AAED;;;;;;;;;;GAUG;AACH,wDATW,OAAO,WAAW,EAAE,UAAU,WAC9B,MAAM,YACN,MAAM,YACN,MAAM,aACN,MAAM,WACN,MAAM,GAEJ,OAAO,WAAW,EAAE,UAAU,CAoC1C;AAED;;;;;;;;;;;GAWG;AACH,gDAVW,OAAO,WAAW,EAAE,UAAU,WAC9B,MAAM,YACN,MAAM,YACN,MAAM,aACN,MAAM,WACN,MAAM,WAEN,MAAM,GACJ,OAAO,WAAW,EAAE,UAAU,CAgB1C"}
|
package/dist-module/resample.js
CHANGED
|
@@ -6,12 +6,12 @@ function copyNewSize(array, width, height, samplesPerPixel = 1) {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Resample the input arrays using nearest neighbor value selection.
|
|
9
|
-
* @param {TypedArray[]} valueArrays The input arrays to resample
|
|
9
|
+
* @param {import("./geotiff").TypedArray[]} valueArrays The input arrays to resample
|
|
10
10
|
* @param {number} inWidth The width of the input rasters
|
|
11
11
|
* @param {number} inHeight The height of the input rasters
|
|
12
12
|
* @param {number} outWidth The desired width of the output rasters
|
|
13
13
|
* @param {number} outHeight The desired height of the output rasters
|
|
14
|
-
* @returns {TypedArray[]} The resampled rasters
|
|
14
|
+
* @returns {import("./geotiff").TypedArray[]} The resampled rasters
|
|
15
15
|
*/
|
|
16
16
|
export function resampleNearest(valueArrays, inWidth, inHeight, outWidth, outHeight) {
|
|
17
17
|
const relX = inWidth / outWidth;
|
|
@@ -36,12 +36,12 @@ function lerp(v0, v1, t) {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Resample the input arrays using bilinear interpolation.
|
|
39
|
-
* @param {TypedArray[]} valueArrays The input arrays to resample
|
|
39
|
+
* @param {import("./geotiff").TypedArray[]} valueArrays The input arrays to resample
|
|
40
40
|
* @param {number} inWidth The width of the input rasters
|
|
41
41
|
* @param {number} inHeight The height of the input rasters
|
|
42
42
|
* @param {number} outWidth The desired width of the output rasters
|
|
43
43
|
* @param {number} outHeight The desired height of the output rasters
|
|
44
|
-
* @returns {TypedArray[]} The resampled rasters
|
|
44
|
+
* @returns {import("./geotiff").TypedArray[]} The resampled rasters
|
|
45
45
|
*/
|
|
46
46
|
export function resampleBilinear(valueArrays, inWidth, inHeight, outWidth, outHeight) {
|
|
47
47
|
const relX = inWidth / outWidth;
|
|
@@ -70,13 +70,13 @@ export function resampleBilinear(valueArrays, inWidth, inHeight, outWidth, outHe
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Resample the input arrays using the selected resampling method.
|
|
73
|
-
* @param {TypedArray[]} valueArrays The input arrays to resample
|
|
73
|
+
* @param {import("./geotiff").TypedArray[]} valueArrays The input arrays to resample
|
|
74
74
|
* @param {number} inWidth The width of the input rasters
|
|
75
75
|
* @param {number} inHeight The height of the input rasters
|
|
76
76
|
* @param {number} outWidth The desired width of the output rasters
|
|
77
77
|
* @param {number} outHeight The desired height of the output rasters
|
|
78
78
|
* @param {string} [method = 'nearest'] The desired resampling method
|
|
79
|
-
* @returns {TypedArray[]} The resampled rasters
|
|
79
|
+
* @returns {import("./geotiff").TypedArray[]} The resampled rasters
|
|
80
80
|
*/
|
|
81
81
|
export function resample(valueArrays, inWidth, inHeight, outWidth, outHeight, method = 'nearest') {
|
|
82
82
|
switch (method.toLowerCase()) {
|
|
@@ -91,14 +91,14 @@ export function resample(valueArrays, inWidth, inHeight, outWidth, outHeight, me
|
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Resample the pixel interleaved input array using nearest neighbor value selection.
|
|
94
|
-
* @param {TypedArray}
|
|
94
|
+
* @param {import("./geotiff").TypedArray} valueArray The input array to resample
|
|
95
95
|
* @param {number} inWidth The width of the input rasters
|
|
96
96
|
* @param {number} inHeight The height of the input rasters
|
|
97
97
|
* @param {number} outWidth The desired width of the output rasters
|
|
98
98
|
* @param {number} outHeight The desired height of the output rasters
|
|
99
99
|
* @param {number} samples The number of samples per pixel for pixel
|
|
100
100
|
* interleaved data
|
|
101
|
-
* @returns {TypedArray} The resampled raster
|
|
101
|
+
* @returns {import("./geotiff").TypedArray} The resampled raster
|
|
102
102
|
*/
|
|
103
103
|
export function resampleNearestInterleaved(valueArray, inWidth, inHeight, outWidth, outHeight, samples) {
|
|
104
104
|
const relX = inWidth / outWidth;
|
|
@@ -118,14 +118,14 @@ export function resampleNearestInterleaved(valueArray, inWidth, inHeight, outWid
|
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Resample the pixel interleaved input array using bilinear interpolation.
|
|
121
|
-
* @param {TypedArray}
|
|
121
|
+
* @param {import("./geotiff").TypedArray} valueArray The input array to resample
|
|
122
122
|
* @param {number} inWidth The width of the input rasters
|
|
123
123
|
* @param {number} inHeight The height of the input rasters
|
|
124
124
|
* @param {number} outWidth The desired width of the output rasters
|
|
125
125
|
* @param {number} outHeight The desired height of the output rasters
|
|
126
126
|
* @param {number} samples The number of samples per pixel for pixel
|
|
127
127
|
* interleaved data
|
|
128
|
-
* @returns {TypedArray} The resampled raster
|
|
128
|
+
* @returns {import("./geotiff").TypedArray} The resampled raster
|
|
129
129
|
*/
|
|
130
130
|
export function resampleBilinearInterleaved(valueArray, inWidth, inHeight, outWidth, outHeight, samples) {
|
|
131
131
|
const relX = inWidth / outWidth;
|
|
@@ -154,7 +154,7 @@ export function resampleBilinearInterleaved(valueArray, inWidth, inHeight, outWi
|
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Resample the pixel interleaved input array using the selected resampling method.
|
|
157
|
-
* @param {TypedArray} valueArray The input array to resample
|
|
157
|
+
* @param {import("./geotiff").TypedArray} valueArray The input array to resample
|
|
158
158
|
* @param {number} inWidth The width of the input rasters
|
|
159
159
|
* @param {number} inHeight The height of the input rasters
|
|
160
160
|
* @param {number} outWidth The desired width of the output rasters
|
|
@@ -162,7 +162,7 @@ export function resampleBilinearInterleaved(valueArray, inWidth, inHeight, outWi
|
|
|
162
162
|
* @param {number} samples The number of samples per pixel for pixel
|
|
163
163
|
* interleaved data
|
|
164
164
|
* @param {string} [method = 'nearest'] The desired resampling method
|
|
165
|
-
* @returns {TypedArray} The resampled rasters
|
|
165
|
+
* @returns {import("./geotiff").TypedArray} The resampled rasters
|
|
166
166
|
*/
|
|
167
167
|
export function resampleInterleaved(valueArray, inWidth, inHeight, outWidth, outHeight, samples, method = 'nearest') {
|
|
168
168
|
switch (method.toLowerCase()) {
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export class BaseSource {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {
|
|
10
|
-
* @returns {
|
|
8
|
+
* @param {Array<Slice>} slices
|
|
9
|
+
* @param {AbortSignal} [signal]
|
|
10
|
+
* @returns {Promise<*[]>}
|
|
11
11
|
*/
|
|
12
|
-
fetch(slices: Slice
|
|
12
|
+
fetch(slices: Array<Slice>, signal?: AbortSignal): Promise<any[]>;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
14
|
* @param {Slice} slice
|
|
16
|
-
* @
|
|
15
|
+
* @param {AbortSignal} [_signal]
|
|
16
|
+
* @returns {Promise<*>}
|
|
17
17
|
*/
|
|
18
|
-
fetchSlice(slice: Slice):
|
|
18
|
+
fetchSlice(slice: Slice, _signal?: AbortSignal): Promise<any>;
|
|
19
19
|
/**
|
|
20
20
|
* Returns the filesize if already determined and null otherwise
|
|
21
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basesource.d.ts","sourceRoot":"","sources":["../../src/source/basesource.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;IACE;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"basesource.d.ts","sourceRoot":"","sources":["../../src/source/basesource.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;IACE;;;;OAIG;IACH,cAJW,KAAK,CAAC,KAAK,CAAC,WACZ,WAAW,GACT,OAAO,CAAC,GAAC,EAAE,CAAC,CAMxB;IAED;;;;OAIG;IACH,kBAJW,KAAK,YACL,WAAW,GACT,OAAO,CAAC,GAAC,CAAC,CAItB;IAED;;OAEG;IACH,qBAEC;IAED,uBAEC;CACF;;YAnCa,MAAM;YACN,MAAM"}
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export class BaseSource {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {
|
|
10
|
-
* @returns {
|
|
8
|
+
* @param {Array<Slice>} slices
|
|
9
|
+
* @param {AbortSignal} [signal]
|
|
10
|
+
* @returns {Promise<*[]>}
|
|
11
11
|
*/
|
|
12
|
-
async fetch(slices, signal
|
|
12
|
+
async fetch(slices, signal) {
|
|
13
13
|
return Promise.all(slices.map((slice) => this.fetchSlice(slice, signal)));
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
16
|
* @param {Slice} slice
|
|
18
|
-
* @
|
|
17
|
+
* @param {AbortSignal} [_signal]
|
|
18
|
+
* @returns {Promise<*>}
|
|
19
19
|
*/
|
|
20
|
-
async fetchSlice(slice) {
|
|
20
|
+
async fetchSlice(slice, _signal) {
|
|
21
21
|
throw new Error(`fetching of slice ${slice} not possible, not implemented`);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -19,15 +19,15 @@ export class BlockedSource extends BaseSource {
|
|
|
19
19
|
blockIdsToFetch: Set<any>;
|
|
20
20
|
abortedBlockIds: Set<any>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
22
|
* @param {import("./basesource").Slice[]} slices
|
|
23
|
+
* @param {AbortSignal} [signal]
|
|
24
|
+
* @return {Promise<ArrayBuffer[]>}
|
|
24
25
|
*/
|
|
25
|
-
fetch(slices: import("./basesource").Slice[], signal
|
|
26
|
+
fetch(slices: import("./basesource").Slice[], signal?: AbortSignal): Promise<ArrayBuffer[]>;
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param {AbortSignal} signal
|
|
28
|
+
* @param {AbortSignal} [signal]
|
|
29
29
|
*/
|
|
30
|
-
fetchBlocks(signal
|
|
30
|
+
fetchBlocks(signal?: AbortSignal): void;
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
33
|
* @param {Set} blockIds
|
|
@@ -35,11 +35,11 @@ export class BlockedSource extends BaseSource {
|
|
|
35
35
|
*/
|
|
36
36
|
groupBlocks(blockIds: Set<any>): BlockGroup[];
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
38
|
* @param {import("./basesource").Slice[]} slices
|
|
40
|
-
* @param {Map} blocks
|
|
39
|
+
* @param {Map<number, Block>} blocks
|
|
40
|
+
* @returns {ArrayBuffer[]}
|
|
41
41
|
*/
|
|
42
|
-
readSliceData(slices: import("./basesource").Slice[], blocks: Map<
|
|
42
|
+
readSliceData(slices: import("./basesource").Slice[], blocks: Map<number, Block>): ArrayBuffer[];
|
|
43
43
|
}
|
|
44
44
|
import { BaseSource } from './basesource.js';
|
|
45
45
|
import QuickLRU from 'quick-lru';
|
|
@@ -48,9 +48,9 @@ declare class Block {
|
|
|
48
48
|
*
|
|
49
49
|
* @param {number} offset
|
|
50
50
|
* @param {number} length
|
|
51
|
-
* @param {ArrayBuffer}
|
|
51
|
+
* @param {ArrayBuffer} data
|
|
52
52
|
*/
|
|
53
|
-
constructor(offset: number, length: number, data
|
|
53
|
+
constructor(offset: number, length: number, data: ArrayBuffer);
|
|
54
54
|
offset: number;
|
|
55
55
|
length: number;
|
|
56
56
|
data: ArrayBuffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockedsource.d.ts","sourceRoot":"","sources":["../../src/source/blockedsource.js"],"names":[],"mappings":"AAuCA;IACE;;;;;;OAMG;IACH,oBALW,UAAU,6BAElB;QAAyB,SAAS;QACT,SAAS;KAAC,EAwBrC;IApBC,mBAAoB;IACpB,kBAA0B;IAE1B,+BAKE;IAEF,iCAAiC;IACjC,eADW,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CACC;IAG9B,6BAA8B;IAG9B,0BAAgC;IAEhC,0BAAgC;IAOlC
|
|
1
|
+
{"version":3,"file":"blockedsource.d.ts","sourceRoot":"","sources":["../../src/source/blockedsource.js"],"names":[],"mappings":"AAuCA;IACE;;;;;;OAMG;IACH,oBALW,UAAU,6BAElB;QAAyB,SAAS;QACT,SAAS;KAAC,EAwBrC;IApBC,mBAAoB;IACpB,kBAA0B;IAE1B,+BAKE;IAEF,iCAAiC;IACjC,eADW,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CACC;IAG9B,6BAA8B;IAG9B,0BAAgC;IAEhC,0BAAgC;IAOlC;;;;OAIG;IACH,cAJW,OAAO,cAAc,EAAE,KAAK,EAAE,WAC9B,WAAW,GACV,OAAO,CAAC,WAAW,EAAE,CAAC,CAmFjC;IAED;;OAEG;IACH,qBAFW,WAAW,QA+CrB;IAED;;;;OAIG;IACH,iCAFa,UAAU,EAAE,CAiCxB;IAED;;;;OAIG;IACH,sBAJW,OAAO,cAAc,EAAE,KAAK,EAAE,UAC9B,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAChB,WAAW,EAAE,CA0CzB;CACF;2BAvS0B,iBAAiB;qBAFvB,WAAW;AAIhC;IACE;;;;;OAKG;IACH,oBAJW,MAAM,UACN,MAAM,QACN,WAAW,EAMrB;IAHC,eAAoB;IACpB,eAAoB;IACpB,kBAAgB;IAGlB;;OAEG;IACH,WAFa,MAAM,CAIlB;CACF;AAED;IACE;;;;;OAKG;IACH,oBAJW,MAAM,UACN,MAAM,YACN,MAAM,EAAE,EAMlB;IAHC,eAAoB;IACpB,eAAoB;IACpB,mBAAwB;CAE3B"}
|
|
@@ -6,9 +6,9 @@ class Block {
|
|
|
6
6
|
*
|
|
7
7
|
* @param {number} offset
|
|
8
8
|
* @param {number} length
|
|
9
|
-
* @param {ArrayBuffer}
|
|
9
|
+
* @param {ArrayBuffer} data
|
|
10
10
|
*/
|
|
11
|
-
constructor(offset, length, data
|
|
11
|
+
constructor(offset, length, data) {
|
|
12
12
|
this.offset = offset;
|
|
13
13
|
this.length = length;
|
|
14
14
|
this.data = data;
|
|
@@ -63,8 +63,9 @@ export class BlockedSource extends BaseSource {
|
|
|
63
63
|
return this.source.fileSize;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
66
|
* @param {import("./basesource").Slice[]} slices
|
|
67
|
+
* @param {AbortSignal} [signal]
|
|
68
|
+
* @return {Promise<ArrayBuffer[]>}
|
|
68
69
|
*/
|
|
69
70
|
async fetch(slices, signal) {
|
|
70
71
|
const blockRequests = [];
|
|
@@ -112,7 +113,7 @@ export class BlockedSource extends BaseSource {
|
|
|
112
113
|
abortedBlockIds.forEach((id) => this.blockIdsToFetch.add(id));
|
|
113
114
|
// start the retry of some blocks if required
|
|
114
115
|
if (abortedBlockIds.length > 0 && signal && !signal.aborted) {
|
|
115
|
-
this.fetchBlocks(
|
|
116
|
+
this.fetchBlocks();
|
|
116
117
|
for (const blockId of abortedBlockIds) {
|
|
117
118
|
const block = this.blockRequests.get(blockId);
|
|
118
119
|
if (!block) {
|
|
@@ -137,8 +138,7 @@ export class BlockedSource extends BaseSource {
|
|
|
137
138
|
return this.readSliceData(slices, requiredBlocks);
|
|
138
139
|
}
|
|
139
140
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @param {AbortSignal} signal
|
|
141
|
+
* @param {AbortSignal} [signal]
|
|
142
142
|
*/
|
|
143
143
|
fetchBlocks(signal) {
|
|
144
144
|
// check if we still need to
|
|
@@ -157,7 +157,7 @@ export class BlockedSource extends BaseSource {
|
|
|
157
157
|
const o = blockOffset - response.offset;
|
|
158
158
|
const t = Math.min(o + this.blockSize, response.data.byteLength);
|
|
159
159
|
const data = response.data.slice(o, t);
|
|
160
|
-
const block = new Block(blockOffset, data.byteLength, data
|
|
160
|
+
const block = new Block(blockOffset, data.byteLength, data);
|
|
161
161
|
this.blockCache.set(blockId, block);
|
|
162
162
|
this.abortedBlockIds.delete(blockId);
|
|
163
163
|
}
|
|
@@ -210,9 +210,9 @@ export class BlockedSource extends BaseSource {
|
|
|
210
210
|
return groups;
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
|
-
*
|
|
214
213
|
* @param {import("./basesource").Slice[]} slices
|
|
215
|
-
* @param {Map} blocks
|
|
214
|
+
* @param {Map<number, Block>} blocks
|
|
215
|
+
* @returns {ArrayBuffer[]}
|
|
216
216
|
*/
|
|
217
217
|
readSliceData(slices, blocks) {
|
|
218
218
|
return slices.map((slice) => {
|
|
@@ -226,6 +226,9 @@ export class BlockedSource extends BaseSource {
|
|
|
226
226
|
const sliceView = new Uint8Array(sliceData);
|
|
227
227
|
for (let blockId = blockIdLow; blockId <= blockIdHigh; ++blockId) {
|
|
228
228
|
const block = blocks.get(blockId);
|
|
229
|
+
if (!block) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
229
232
|
const delta = block.offset - slice.offset;
|
|
230
233
|
const topDelta = block.top - top;
|
|
231
234
|
let blockInnerOffset = 0;
|
|
@@ -5,30 +5,28 @@ export class BaseResponse {
|
|
|
5
5
|
get ok(): boolean;
|
|
6
6
|
/**
|
|
7
7
|
* Returns the status code of the response
|
|
8
|
+
* @returns {number} the status code
|
|
8
9
|
*/
|
|
9
|
-
get status():
|
|
10
|
+
get status(): number;
|
|
10
11
|
/**
|
|
11
12
|
* Returns the value of the specified header
|
|
12
13
|
* @param {string} headerName the header name
|
|
13
|
-
* @returns {string} the header value
|
|
14
|
+
* @returns {string|null} the header value
|
|
14
15
|
*/
|
|
15
|
-
getHeader(headerName: string): string;
|
|
16
|
+
getHeader(headerName: string): string | null;
|
|
16
17
|
/**
|
|
17
|
-
* @returns {ArrayBuffer} the response data of the request
|
|
18
|
+
* @returns {Promise<ArrayBuffer>} the response data of the request
|
|
18
19
|
*/
|
|
19
|
-
getData(): ArrayBuffer
|
|
20
|
+
getData(): Promise<ArrayBuffer>;
|
|
20
21
|
}
|
|
21
22
|
export class BaseClient {
|
|
22
23
|
constructor(url: any);
|
|
23
24
|
url: any;
|
|
24
25
|
/**
|
|
25
26
|
* Send a request with the options
|
|
26
|
-
* @param {
|
|
27
|
+
* @param {RequestInit} [options={}]
|
|
27
28
|
* @returns {Promise<BaseResponse>}
|
|
28
29
|
*/
|
|
29
|
-
request({ headers, signal }?:
|
|
30
|
-
headers: HeadersInit;
|
|
31
|
-
signal: AbortSignal;
|
|
32
|
-
}): Promise<BaseResponse>;
|
|
30
|
+
request({ headers, signal }?: RequestInit): Promise<BaseResponse>;
|
|
33
31
|
}
|
|
34
32
|
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/source/client/base.js"],"names":[],"mappings":"AAAA;IACE;;OAEG;IACH,kBAEC;IAED
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/source/client/base.js"],"names":[],"mappings":"AAAA;IACE;;OAEG;IACH,kBAEC;IAED;;;OAGG;IACH,cAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAIvB;IAED;;OAEG;IACH,WAFa,OAAO,CAAC,WAAW,CAAC,CAIhC;CACF;AAED;IACE,sBAEC;IADC,SAAc;IAGhB;;;;OAIG;IACH,8BAHW,WAAW,GACT,OAAO,CAAC,YAAY,CAAC,CAIjC;CACF"}
|
|
@@ -7,6 +7,7 @@ export class BaseResponse {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Returns the status code of the response
|
|
10
|
+
* @returns {number} the status code
|
|
10
11
|
*/
|
|
11
12
|
get status() {
|
|
12
13
|
throw new Error('not implemented');
|
|
@@ -14,13 +15,13 @@ export class BaseResponse {
|
|
|
14
15
|
/**
|
|
15
16
|
* Returns the value of the specified header
|
|
16
17
|
* @param {string} headerName the header name
|
|
17
|
-
* @returns {string} the header value
|
|
18
|
+
* @returns {string|null} the header value
|
|
18
19
|
*/
|
|
19
20
|
getHeader(headerName) {
|
|
20
21
|
throw new Error('not implemented');
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* @returns {ArrayBuffer} the response data of the request
|
|
24
|
+
* @returns {Promise<ArrayBuffer>} the response data of the request
|
|
24
25
|
*/
|
|
25
26
|
async getData() {
|
|
26
27
|
throw new Error('not implemented');
|
|
@@ -32,7 +33,7 @@ export class BaseClient {
|
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* Send a request with the options
|
|
35
|
-
* @param {
|
|
36
|
+
* @param {RequestInit} [options={}]
|
|
36
37
|
* @returns {Promise<BaseResponse>}
|
|
37
38
|
*/
|
|
38
39
|
async request({ headers, signal } = {}) {
|
|
@@ -2,13 +2,10 @@ export class FetchClient extends BaseClient {
|
|
|
2
2
|
constructor(url: any, credentials: any);
|
|
3
3
|
credentials: any;
|
|
4
4
|
/**
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {RequestInit} [options={}]
|
|
6
6
|
* @returns {Promise<FetchResponse>}
|
|
7
7
|
*/
|
|
8
|
-
request({ headers, signal }?:
|
|
9
|
-
headers: HeadersInit;
|
|
10
|
-
signal: AbortSignal;
|
|
11
|
-
}): Promise<FetchResponse>;
|
|
8
|
+
request({ headers, signal }?: RequestInit): Promise<FetchResponse>;
|
|
12
9
|
}
|
|
13
10
|
import { BaseClient } from './base.js';
|
|
14
11
|
declare class FetchResponse extends BaseResponse {
|
|
@@ -18,8 +15,6 @@ declare class FetchResponse extends BaseResponse {
|
|
|
18
15
|
*/
|
|
19
16
|
constructor(response: Response);
|
|
20
17
|
response: Response;
|
|
21
|
-
get status(): number;
|
|
22
|
-
getHeader(name: any): string | null;
|
|
23
18
|
getData(): Promise<any>;
|
|
24
19
|
}
|
|
25
20
|
import { BaseResponse } from './base.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/source/client/fetch.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/source/client/fetch.js"],"names":[],"mappings":"AAiCA;IACE,wCAGC;IADC,iBAA8B;IAGhC;;;OAGG;IACH,8BAHW,WAAW,GACT,OAAO,CAAC,aAAa,CAAC,CAOlC;CACF;2BAjDwC,WAAW;AAEpD;IACE;;;OAGG;IACH,sBAFW,QAAQ,EAKlB;IADC,mBAAwB;IAe1B,wBAMC;CACF;6BA/BwC,WAAW"}
|
|
@@ -11,13 +11,18 @@ class FetchResponse extends BaseResponse {
|
|
|
11
11
|
get status() {
|
|
12
12
|
return this.response.status;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} name
|
|
16
|
+
* @returns {string|null}
|
|
17
|
+
*/
|
|
14
18
|
getHeader(name) {
|
|
15
19
|
return this.response.headers.get(name);
|
|
16
20
|
}
|
|
17
21
|
async getData() {
|
|
18
22
|
const data = this.response.arrayBuffer
|
|
19
23
|
? await this.response.arrayBuffer()
|
|
20
|
-
|
|
24
|
+
// FIXME Can this really have a buffer property?
|
|
25
|
+
: (await /** @type {*} */ (this.response).buffer()).buffer;
|
|
21
26
|
return data;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
@@ -27,7 +32,7 @@ export class FetchClient extends BaseClient {
|
|
|
27
32
|
this.credentials = credentials;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
|
-
* @param {
|
|
35
|
+
* @param {RequestInit} [options={}]
|
|
31
36
|
* @returns {Promise<FetchResponse>}
|
|
32
37
|
*/
|
|
33
38
|
async request({ headers, signal } = {}) {
|
|
@@ -2,7 +2,10 @@ export class HttpClient extends BaseClient {
|
|
|
2
2
|
parsedUrl: any;
|
|
3
3
|
httpApi: any;
|
|
4
4
|
constructRequest(headers: any, signal: any): Promise<any>;
|
|
5
|
-
request({ headers, signal }?: {
|
|
5
|
+
request({ headers, signal }?: {
|
|
6
|
+
headers?: undefined;
|
|
7
|
+
signal?: undefined;
|
|
8
|
+
}): Promise<any>;
|
|
6
9
|
}
|
|
7
10
|
import { BaseClient } from './base.js';
|
|
8
11
|
//# sourceMappingURL=http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/source/client/http.js"],"names":[],"mappings":"AAgCA;IAGI,eAAuC;IACvC,aAAmE;IAGrE,0DAmCC;IAED
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/source/client/http.js"],"names":[],"mappings":"AAgCA;IAGI,eAAuC;IACvC,aAAmE;IAGrE,0DAmCC;IAED;;;qBAGC;CACF;2BA5EwC,WAAW"}
|