@basemaps/shared 6.7.0 → 6.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/build/__test__/api.path.test.js +57 -60
- package/build/__test__/api.test.js +29 -32
- package/build/__test__/env.test.js +9 -12
- package/build/__test__/util.test.js +36 -39
- package/build/__test__/vdom.parse.test.js +18 -21
- package/build/__test__/vdom.test.js +29 -32
- package/build/api.js +6 -10
- package/build/api.path.d.ts.map +1 -1
- package/build/api.path.js +15 -23
- package/build/aws/aws.dynamo.table.d.ts.map +1 -1
- package/build/aws/aws.dynamo.table.js +1 -2
- package/build/cli/__test__/git.tag.test.js +7 -10
- package/build/cli/api.key.js +4 -9
- package/build/cli/git.tag.js +4 -8
- package/build/composite.error.d.ts +1 -7
- package/build/composite.error.d.ts.map +1 -1
- package/build/composite.error.js +1 -13
- package/build/const.d.ts.map +1 -1
- package/build/const.js +3 -6
- package/build/file/__test__/file.local.test.js +19 -19
- package/build/file/__test__/file.operator.test.helper.d.ts.map +1 -1
- package/build/file/__test__/file.operator.test.helper.js +17 -21
- package/build/file/file.config.d.ts.map +1 -1
- package/build/file/file.config.js +2 -7
- package/build/file/index.d.ts +3 -3
- package/build/file/index.d.ts.map +1 -1
- package/build/file/index.js +14 -23
- package/build/index.d.ts +13 -14
- package/build/index.d.ts.map +1 -1
- package/build/index.js +18 -35
- package/build/log.d.ts +0 -3
- package/build/log.d.ts.map +1 -1
- package/build/log.js +6 -16
- package/build/logger.fatal.error.d.ts.map +1 -1
- package/build/logger.fatal.error.js +1 -5
- package/build/proj/__test__/projection.test.js +30 -33
- package/build/proj/__test__/projection.tile.matrix.set.test.js +130 -78
- package/build/proj/__test__/test.util.d.ts.map +1 -1
- package/build/proj/__test__/test.util.js +10 -17
- package/build/proj/citm2000.js +1 -4
- package/build/proj/nztm2000.js +1 -4
- package/build/proj/projection.d.ts +44 -33
- package/build/proj/projection.d.ts.map +1 -1
- package/build/proj/projection.js +84 -53
- package/build/proj/tile.set.name.d.ts.map +1 -1
- package/build/proj/tile.set.name.js +3 -7
- package/build/util.d.ts.map +1 -1
- package/build/util.js +5 -13
- package/build/vdom.d.ts.map +1 -1
- package/build/vdom.js +4 -11
- package/build/vdom.parse.d.ts +1 -1
- package/build/vdom.parse.d.ts.map +1 -1
- package/build/vdom.parse.js +5 -10
- package/package.json +12 -8
- package/build/__test__/aws.init.test.d.ts +0 -2
- package/build/__test__/aws.init.test.d.ts.map +0 -1
- package/build/__test__/aws.init.test.js +0 -9
- package/build/aws/api.key.table.d.ts +0 -29
- package/build/aws/api.key.table.d.ts.map +0 -1
- package/build/aws/api.key.table.js +0 -38
- package/build/aws/credentials.d.ts +0 -21
- package/build/aws/credentials.d.ts.map +0 -1
- package/build/aws/credentials.js +0 -42
- package/build/aws/index.d.ts +0 -18
- package/build/aws/index.d.ts.map +0 -1
- package/build/aws/index.js +0 -38
- package/build/aws/object.cache.d.ts +0 -6
- package/build/aws/object.cache.d.ts.map +0 -1
- package/build/aws/object.cache.js +0 -17
package/build/api.path.js
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const geo_1 = require("@basemaps/geo");
|
|
5
|
-
const tiler_1 = require("@basemaps/tiler");
|
|
6
|
-
var TileType;
|
|
1
|
+
import { Epsg, TileMatrixSets } from '@basemaps/geo';
|
|
2
|
+
import { getImageFormat } from '@basemaps/tiler';
|
|
3
|
+
export var TileType;
|
|
7
4
|
(function (TileType) {
|
|
8
5
|
TileType["WMTS"] = "WMTS";
|
|
9
6
|
TileType["Tile"] = "tile";
|
|
10
7
|
TileType["Attribution"] = "attribution";
|
|
11
|
-
})(TileType
|
|
12
|
-
var VectorFormat;
|
|
8
|
+
})(TileType || (TileType = {}));
|
|
9
|
+
export var VectorFormat;
|
|
13
10
|
(function (VectorFormat) {
|
|
14
11
|
VectorFormat["MapboxVectorTiles"] = "pbf";
|
|
15
|
-
})(VectorFormat
|
|
16
|
-
function setNameAndProjection(req, data) {
|
|
12
|
+
})(VectorFormat || (VectorFormat = {}));
|
|
13
|
+
export function setNameAndProjection(req, data) {
|
|
17
14
|
req.set('tileSet', data.name);
|
|
18
15
|
if (data.tileMatrix == null)
|
|
19
16
|
return;
|
|
20
17
|
req.set('projection', data.tileMatrix.projection);
|
|
21
18
|
}
|
|
22
|
-
exports.setNameAndProjection = setNameAndProjection;
|
|
23
19
|
function extractTileMatrixSet(text) {
|
|
24
20
|
var _a;
|
|
25
|
-
const projection =
|
|
21
|
+
const projection = Epsg.parse(text);
|
|
26
22
|
if (projection != null)
|
|
27
|
-
return (_a =
|
|
28
|
-
return
|
|
23
|
+
return (_a = TileMatrixSets.tryGet(projection.code)) !== null && _a !== void 0 ? _a : null;
|
|
24
|
+
return TileMatrixSets.find(text);
|
|
29
25
|
}
|
|
30
|
-
function tileXyzFromPath(path) {
|
|
26
|
+
export function tileXyzFromPath(path) {
|
|
31
27
|
if (path.length < 5)
|
|
32
28
|
return null;
|
|
33
29
|
const name = path[0];
|
|
@@ -43,13 +39,12 @@ function tileXyzFromPath(path) {
|
|
|
43
39
|
if (extStr === 'pbf') {
|
|
44
40
|
return { type: TileType.Tile, name, tileMatrix, x, y, z, ext: VectorFormat.MapboxVectorTiles };
|
|
45
41
|
}
|
|
46
|
-
const ext =
|
|
42
|
+
const ext = getImageFormat(extStr);
|
|
47
43
|
if (ext == null)
|
|
48
44
|
return null;
|
|
49
45
|
return { type: TileType.Tile, name, tileMatrix, x, y, z, ext };
|
|
50
46
|
}
|
|
51
|
-
|
|
52
|
-
function tileAttributionFromPath(path) {
|
|
47
|
+
export function tileAttributionFromPath(path) {
|
|
53
48
|
if (path.length < 3)
|
|
54
49
|
return null;
|
|
55
50
|
const name = path[0];
|
|
@@ -58,7 +53,6 @@ function tileAttributionFromPath(path) {
|
|
|
58
53
|
return null;
|
|
59
54
|
return { type: TileType.Attribution, name, tileMatrix };
|
|
60
55
|
}
|
|
61
|
-
exports.tileAttributionFromPath = tileAttributionFromPath;
|
|
62
56
|
/**
|
|
63
57
|
* Extract WMTS information from a path
|
|
64
58
|
*
|
|
@@ -68,7 +62,7 @@ exports.tileAttributionFromPath = tileAttributionFromPath;
|
|
|
68
62
|
* @param path
|
|
69
63
|
* @param tileSet
|
|
70
64
|
*/
|
|
71
|
-
function tileWmtsFromPath(path) {
|
|
65
|
+
export function tileWmtsFromPath(path) {
|
|
72
66
|
if (path.length > 3)
|
|
73
67
|
return null;
|
|
74
68
|
const name = path.length < 2 ? '' : path[0];
|
|
@@ -80,11 +74,10 @@ function tileWmtsFromPath(path) {
|
|
|
80
74
|
}
|
|
81
75
|
return { type: TileType.WMTS, name, tileMatrix: null };
|
|
82
76
|
}
|
|
83
|
-
exports.tileWmtsFromPath = tileWmtsFromPath;
|
|
84
77
|
/**
|
|
85
78
|
* Extract tile variables (`tileSet`, `projection`, `x`, `y`, `z` and `ext`) from an array
|
|
86
79
|
**/
|
|
87
|
-
function tileFromPath(path) {
|
|
80
|
+
export function tileFromPath(path) {
|
|
88
81
|
if (path.length < 1)
|
|
89
82
|
return null;
|
|
90
83
|
const fileName = path[path.length - 1].toLowerCase();
|
|
@@ -94,4 +87,3 @@ function tileFromPath(path) {
|
|
|
94
87
|
return tileAttributionFromPath(path);
|
|
95
88
|
return tileXyzFromPath(path);
|
|
96
89
|
}
|
|
97
|
-
exports.tileFromPath = tileFromPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws.dynamo.table.d.ts","sourceRoot":"","sources":["../../src/aws/aws.dynamo.table.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,eAAe;
|
|
1
|
+
{"version":3,"file":"aws.dynamo.table.d.ts","sourceRoot":"","sources":["../../src/aws/aws.dynamo.table.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const ans = git_tag_1.GitTag();
|
|
9
|
-
ospec_1.default(/^v\d+\.\d+\.\d+(-\d+-g[0-9a-f]+)?$/.test(ans.version)).equals(true)(`Got: ${ans.version}`);
|
|
10
|
-
ospec_1.default(/^[0-9a-f]+$/.test(ans.hash)).equals(true)(`Got: ${ans.hash}`);
|
|
1
|
+
import o from 'ospec';
|
|
2
|
+
import { GitTag } from '../git.tag.js';
|
|
3
|
+
o.spec('git.tag', () => {
|
|
4
|
+
o('format', () => {
|
|
5
|
+
const ans = GitTag();
|
|
6
|
+
o(/^v\d+\.\d+\.\d+(-\d+-g[0-9a-f]+)?$/.test(ans.version)).equals(true)(`Got: ${ans.version}`);
|
|
7
|
+
o(/^[0-9a-f]+$/.test(ans.hash)).equals(true)(`Got: ${ans.hash}`);
|
|
11
8
|
});
|
|
12
9
|
});
|
package/build/cli/api.key.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const aws_1 = require("../aws");
|
|
6
|
-
const base_x_1 = tslib_1.__importDefault(require("base-x"));
|
|
7
|
-
const crypto_1 = require("crypto");
|
|
8
|
-
const base58 = base_x_1.default('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
|
|
2
|
+
import baseX from 'base-x';
|
|
3
|
+
import { randomBytes } from 'crypto';
|
|
4
|
+
const base58 = baseX('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz');
|
|
9
5
|
/** Generate 10 32 character base58 encoded strings */
|
|
10
6
|
async function main() {
|
|
11
7
|
for (let i = 0; i < 10; i++) {
|
|
12
|
-
const bytes =
|
|
8
|
+
const bytes = randomBytes(32);
|
|
13
9
|
const apiKey = base58.encode(bytes).slice(0, 32);
|
|
14
10
|
console.log(apiKey);
|
|
15
|
-
await aws_1.Aws.apiKey.create(apiKey);
|
|
16
11
|
}
|
|
17
12
|
}
|
|
18
13
|
main();
|
package/build/cli/git.tag.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GitTag = void 0;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
function GitTag() {
|
|
1
|
+
import { execFileSync } from 'child_process';
|
|
2
|
+
export function GitTag() {
|
|
6
3
|
return {
|
|
7
|
-
version:
|
|
8
|
-
hash:
|
|
4
|
+
version: execFileSync('git', ['describe', '--tags', '--always', '--match', 'v*']).toString().trim(),
|
|
5
|
+
hash: execFileSync('git', ['rev-parse', 'HEAD']).toString().trim(),
|
|
9
6
|
};
|
|
10
7
|
}
|
|
11
|
-
exports.GitTag = GitTag;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Utility error to wrap other errors to make them more understandable
|
|
3
|
-
*/
|
|
4
|
-
export declare class CompositeError extends Error {
|
|
5
|
-
reason: Error;
|
|
6
|
-
constructor(msg: string, reason: Error);
|
|
7
|
-
}
|
|
1
|
+
export { CompositeError } from '@chunkd/core';
|
|
8
2
|
//# sourceMappingURL=composite.error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composite.error.d.ts","sourceRoot":"","sources":["../src/composite.error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"composite.error.d.ts","sourceRoot":"","sources":["../src/composite.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/build/composite.error.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompositeError = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Utility error to wrap other errors to make them more understandable
|
|
6
|
-
*/
|
|
7
|
-
class CompositeError extends Error {
|
|
8
|
-
constructor(msg, reason) {
|
|
9
|
-
super(msg);
|
|
10
|
-
this.reason = reason;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.CompositeError = CompositeError;
|
|
1
|
+
export { CompositeError } from '@chunkd/core';
|
package/build/const.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK;;;;;;;;;;;;;CAajB,CAAC;AAEF,eAAO,MAAM,GAAG;
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK;;;;;;;;;;;;;CAajB,CAAC;AAEF,eAAO,MAAM,GAAG;IACd,iDAAiD;;IAGjD,yCAAyC;;IAGzC,0DAA0D;;IAG1D,6DAA6D;;IAG7D,uDAAuD;;;QAIrD,gDAAgD;;QAEhD,2DAA2D;;;;;;;;;IAW7D,+EAA+E;iBAClE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIxC,gGAAgG;uBAC7E,MAAM,iBAAiB,MAAM,GAAG,MAAM;oBAazC,OAAO;CAGxB,CAAC"}
|
package/build/const.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Env = exports.Const = void 0;
|
|
4
1
|
// TODO load these from env vars
|
|
5
|
-
|
|
2
|
+
export const Const = {
|
|
6
3
|
Aws: {
|
|
7
4
|
Region: 'ap-southeast-2',
|
|
8
5
|
},
|
|
@@ -16,7 +13,7 @@ exports.Const = {
|
|
|
16
13
|
RequestLimitMinute: 1000,
|
|
17
14
|
},
|
|
18
15
|
};
|
|
19
|
-
|
|
16
|
+
export const Env = {
|
|
20
17
|
/** Public URL base that tiles are served from */
|
|
21
18
|
PublicUrlBase: 'BASEMAPS_PUBLIC_URL',
|
|
22
19
|
/** How many tiffs to load at one time */
|
|
@@ -45,7 +42,7 @@ exports.Env = {
|
|
|
45
42
|
},
|
|
46
43
|
/** Load an environment variable as a float, defaulting to defaultNumber if it does not exist */
|
|
47
44
|
getNumber(envName, defaultNumber) {
|
|
48
|
-
const current =
|
|
45
|
+
const current = Env.get(envName);
|
|
49
46
|
if (current === '' || current == null) {
|
|
50
47
|
return defaultNumber;
|
|
51
48
|
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
1
|
+
import { statSync, unlinkSync } from 'fs';
|
|
2
|
+
import o from 'ospec';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import url from 'url';
|
|
5
|
+
import { fsa } from '../index.js';
|
|
6
|
+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
7
7
|
function rmF(path) {
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
unlinkSync(path);
|
|
10
10
|
}
|
|
11
11
|
catch (_err) { }
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
o.spec('file.local', () => {
|
|
14
14
|
const jsonFilePath = __dirname + '/testing.json';
|
|
15
15
|
const jsonFilePathGz = jsonFilePath + '.gz';
|
|
16
|
-
|
|
16
|
+
o.afterEach(() => {
|
|
17
17
|
rmF(jsonFilePathGz);
|
|
18
18
|
rmF(jsonFilePath);
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
o('readJson writeJson gzip', async () => {
|
|
21
21
|
try {
|
|
22
|
-
await
|
|
23
|
-
const ans = await
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
await fsa.writeJson(jsonFilePathGz, { json: '1'.repeat(1000) });
|
|
23
|
+
const ans = await fsa.readJson(jsonFilePathGz);
|
|
24
|
+
o(statSync(jsonFilePathGz).size).equals(44);
|
|
25
|
+
o(ans).deepEquals({ json: '1'.repeat(1000) });
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
28
28
|
console.log(e);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
|
|
32
|
-
await
|
|
33
|
-
const ans = await
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
o('readJson writeJson', async () => {
|
|
32
|
+
await fsa.writeJson(jsonFilePath, { json: '1'.repeat(1000) });
|
|
33
|
+
const ans = await fsa.readJson(jsonFilePath);
|
|
34
|
+
o(statSync(jsonFilePath).size).equals(1016);
|
|
35
|
+
o(ans).deepEquals({ json: '1'.repeat(1000) });
|
|
36
36
|
});
|
|
37
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.operator.test.helper.d.ts","sourceRoot":"","sources":["../../../src/file/__test__/file.operator.test.helper.ts"],"names":[],"mappings":";AAGA,MAAM,WAAW,MAAM;
|
|
1
|
+
{"version":3,"file":"file.operator.test.helper.d.ts","sourceRoot":"","sources":["../../../src/file/__test__/file.operator.test.helper.ts"],"names":[],"mappings":";AAGA,MAAM,WAAW,MAAM;IACrB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;IACzC,0CAA0C;IAC1C,KAAK,IAAI,IAAI,CAAC;IACd,4CAA4C;IAC5C,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAgDzC"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.mockFileOperator = void 0;
|
|
4
|
-
const s3fs_1 = require("@linzjs/s3fs");
|
|
5
|
-
const __1 = require("..");
|
|
1
|
+
import { CompositeError } from '@linzjs/s3fs';
|
|
2
|
+
import { fsa } from '../index.js';
|
|
6
3
|
/**
|
|
7
4
|
* Create an interface for stubbing `FileOperator.read,write,readJson,writeJson`
|
|
8
5
|
*/
|
|
9
|
-
function mockFileOperator() {
|
|
10
|
-
const origWrite =
|
|
11
|
-
const origRead =
|
|
12
|
-
const origReadJson =
|
|
13
|
-
const origWriteJson =
|
|
6
|
+
export function mockFileOperator() {
|
|
7
|
+
const origWrite = fsa.write;
|
|
8
|
+
const origRead = fsa.read;
|
|
9
|
+
const origReadJson = fsa.readJson;
|
|
10
|
+
const origWriteJson = fsa.writeJson;
|
|
14
11
|
let jsStore = {};
|
|
15
12
|
const mockReadJson = async (path) => {
|
|
16
13
|
var _a;
|
|
17
|
-
const ans = (_a = jsStore[path]) !== null && _a !== void 0 ? _a : new
|
|
14
|
+
const ans = (_a = jsStore[path]) !== null && _a !== void 0 ? _a : new CompositeError('Not Found', 404, new Error('Mock'));
|
|
18
15
|
if (ans instanceof Error)
|
|
19
16
|
throw ans;
|
|
20
17
|
return ans;
|
|
@@ -25,7 +22,7 @@ function mockFileOperator() {
|
|
|
25
22
|
let rawStore = {};
|
|
26
23
|
const mockRead = async (path) => {
|
|
27
24
|
var _a;
|
|
28
|
-
const ans = (_a = rawStore[path]) !== null && _a !== void 0 ? _a : new
|
|
25
|
+
const ans = (_a = rawStore[path]) !== null && _a !== void 0 ? _a : new CompositeError('Not Found', 404, new Error('Mock'));
|
|
29
26
|
if (ans instanceof Error)
|
|
30
27
|
throw ans;
|
|
31
28
|
return ans;
|
|
@@ -41,19 +38,18 @@ function mockFileOperator() {
|
|
|
41
38
|
return rawStore;
|
|
42
39
|
},
|
|
43
40
|
setup() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
fsa.read = mockRead;
|
|
42
|
+
fsa.write = mockWrite;
|
|
43
|
+
fsa.readJson = mockReadJson;
|
|
44
|
+
fsa.writeJson = mockWriteJson;
|
|
48
45
|
jsStore = {};
|
|
49
46
|
rawStore = {};
|
|
50
47
|
},
|
|
51
48
|
teardown() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
fsa.read = origRead;
|
|
50
|
+
fsa.write = origWrite;
|
|
51
|
+
fsa.readJson = origReadJson;
|
|
52
|
+
fsa.writeJson = origWriteJson;
|
|
56
53
|
},
|
|
57
54
|
};
|
|
58
55
|
}
|
|
59
|
-
exports.mockFileOperator = mockFileOperator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.config.d.ts","sourceRoot":"","sources":["../../src/file/file.config.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG,UAAU,GAAG,mBAAmB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"file.config.d.ts","sourceRoot":"","sources":["../../src/file/file.config.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG,UAAU,GAAG,mBAAmB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,cAAc,CAE5D;AAED,oBAAY,UAAU,GAAG,eAAe,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAE3E,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,CAAC,IAAI,gBAAgB,CAI7E"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isConfigS3Role = exports.isFileConfigPath = void 0;
|
|
4
|
-
function isFileConfigPath(r) {
|
|
1
|
+
export function isFileConfigPath(r) {
|
|
5
2
|
return Array.isArray(r['files']);
|
|
6
3
|
}
|
|
7
|
-
|
|
8
|
-
function isConfigS3Role(r) {
|
|
4
|
+
export function isConfigS3Role(r) {
|
|
9
5
|
if (r == null)
|
|
10
6
|
return false;
|
|
11
7
|
if (typeof r === 'string')
|
|
12
8
|
return false;
|
|
13
9
|
return 'roleArn' in r && typeof r.roleArn === 'string';
|
|
14
10
|
}
|
|
15
|
-
exports.isConfigS3Role = isConfigS3Role;
|
package/build/file/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './file.config';
|
|
2
|
-
import { fsa as fsaSource } from '@
|
|
3
|
-
import { FileConfig } from './file.config';
|
|
1
|
+
export * from './file.config.js';
|
|
2
|
+
import { fsa as fsaSource } from '@chunkd/fs';
|
|
3
|
+
import { FileConfig } from './file.config.js';
|
|
4
4
|
export declare type FsaJson = typeof fsaSource & {
|
|
5
5
|
readJson<T>(filePath: string): Promise<T>;
|
|
6
6
|
writeJson<T>(filePath: string, obj: T): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,GAAG,IAAI,SAAS,EAAW,MAAM,YAAY,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAkB,MAAM,kBAAkB,CAAC;AAI9D,oBAAY,OAAO,GAAG,OAAO,SAAS,GAAG;IACvC,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1C,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,sCAAsC;IACtC,SAAS,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,GAAG,SAA8B,CAAC"}
|
package/build/file/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const zlib_1 = require("zlib");
|
|
10
|
-
const file_config_1 = require("./file.config");
|
|
11
|
-
const pGunzip = util_1.promisify(zlib_1.gunzip);
|
|
12
|
-
exports.fsa = s3fs_1.fsa;
|
|
13
|
-
exports.fsa.readJson = async function readJson(filePath) {
|
|
1
|
+
export * from './file.config.js';
|
|
2
|
+
import { fsa as fsaSource, FsAwsS3 } from '@chunkd/fs';
|
|
3
|
+
import { promisify } from 'util';
|
|
4
|
+
import { createGzip, gunzip } from 'zlib';
|
|
5
|
+
import { isConfigS3Role } from './file.config.js';
|
|
6
|
+
const pGunzip = promisify(gunzip);
|
|
7
|
+
export const fsa = fsaSource;
|
|
8
|
+
fsa.readJson = async function readJson(filePath) {
|
|
14
9
|
const data = await this.read(filePath);
|
|
15
10
|
if (filePath.endsWith('.gz')) {
|
|
16
11
|
return JSON.parse((await pGunzip(data)).toString());
|
|
@@ -19,10 +14,10 @@ exports.fsa.readJson = async function readJson(filePath) {
|
|
|
19
14
|
return JSON.parse(data.toString());
|
|
20
15
|
}
|
|
21
16
|
};
|
|
22
|
-
|
|
17
|
+
fsa.writeJson = async function writeJson(filePath, obj) {
|
|
23
18
|
const json = Buffer.from(JSON.stringify(obj, undefined, 2));
|
|
24
19
|
if (filePath.endsWith('.gz')) {
|
|
25
|
-
const gzip =
|
|
20
|
+
const gzip = createGzip();
|
|
26
21
|
gzip.end(json);
|
|
27
22
|
return this.write(filePath, gzip);
|
|
28
23
|
}
|
|
@@ -30,16 +25,12 @@ exports.fsa.writeJson = async function writeJson(filePath, obj) {
|
|
|
30
25
|
return this.write(filePath, json);
|
|
31
26
|
}
|
|
32
27
|
};
|
|
33
|
-
|
|
28
|
+
fsa.configure = function configure(cfg) {
|
|
34
29
|
if (cfg.type !== 's3')
|
|
35
30
|
return; // ignore local configs
|
|
36
|
-
if (!
|
|
31
|
+
if (!isConfigS3Role(cfg))
|
|
37
32
|
return; // ignore configs which don't need role assumptions
|
|
38
|
-
const { bucket } =
|
|
33
|
+
const { bucket } = FsAwsS3.parse(cfg.path);
|
|
39
34
|
const bucketUri = `s3://${bucket}/`;
|
|
40
|
-
|
|
41
|
-
if (existing != null)
|
|
42
|
-
throw new Error('Duplicate filesystem configuration loaded');
|
|
43
|
-
this.register(bucketUri, new s3fs_1.FsS3(aws_1.Aws.credentials.getS3ForRole(cfg)));
|
|
35
|
+
this.register(bucketUri, FsAwsS3.fromRoleArn(cfg.roleArn, cfg.externalId));
|
|
44
36
|
};
|
|
45
|
-
exports.fsa.register('s3://', new s3fs_1.FsS3(aws_1.Aws.s3));
|
package/build/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { Const, Env } from './const';
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export * from './api.
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './util';
|
|
1
|
+
export { Config } from '@basemaps/config';
|
|
2
|
+
export { Const, Env } from './const.js';
|
|
3
|
+
export { LogConfig, LogType } from './log.js';
|
|
4
|
+
export * from './api.path.js';
|
|
5
|
+
export * from './api.js';
|
|
6
|
+
export { V, VNode, VNodeElement, VNodeText } from './vdom.js';
|
|
7
|
+
export { VNodeParser } from './vdom.parse.js';
|
|
8
|
+
export { CompositeError } from './composite.error.js';
|
|
9
|
+
export { LoggerFatalError } from './logger.fatal.error.js';
|
|
10
|
+
export { TileSetName, TileSetNameValues } from './proj/tile.set.name.js';
|
|
11
|
+
export * from './proj/projection.js';
|
|
12
|
+
export * from './file/index.js';
|
|
13
|
+
export * from './util.js';
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC9C,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,cAAc,sBAAsB,CAAC;AAErC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,WAAW,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var vdom_1 = require("./vdom");
|
|
20
|
-
Object.defineProperty(exports, "V", { enumerable: true, get: function () { return vdom_1.V; } });
|
|
21
|
-
Object.defineProperty(exports, "VNode", { enumerable: true, get: function () { return vdom_1.VNode; } });
|
|
22
|
-
Object.defineProperty(exports, "VNodeElement", { enumerable: true, get: function () { return vdom_1.VNodeElement; } });
|
|
23
|
-
Object.defineProperty(exports, "VNodeText", { enumerable: true, get: function () { return vdom_1.VNodeText; } });
|
|
24
|
-
var vdom_parse_1 = require("./vdom.parse");
|
|
25
|
-
Object.defineProperty(exports, "VNodeParser", { enumerable: true, get: function () { return vdom_parse_1.VNodeParser; } });
|
|
26
|
-
var composite_error_1 = require("./composite.error");
|
|
27
|
-
Object.defineProperty(exports, "CompositeError", { enumerable: true, get: function () { return composite_error_1.CompositeError; } });
|
|
28
|
-
var logger_fatal_error_1 = require("./logger.fatal.error");
|
|
29
|
-
Object.defineProperty(exports, "LoggerFatalError", { enumerable: true, get: function () { return logger_fatal_error_1.LoggerFatalError; } });
|
|
30
|
-
var tile_set_name_1 = require("./proj/tile.set.name");
|
|
31
|
-
Object.defineProperty(exports, "TileSetName", { enumerable: true, get: function () { return tile_set_name_1.TileSetName; } });
|
|
32
|
-
Object.defineProperty(exports, "TileSetNameValues", { enumerable: true, get: function () { return tile_set_name_1.TileSetNameValues; } });
|
|
33
|
-
tslib_1.__exportStar(require("./proj/projection"), exports);
|
|
34
|
-
tslib_1.__exportStar(require("./file"), exports);
|
|
35
|
-
tslib_1.__exportStar(require("./util"), exports);
|
|
1
|
+
// Force aws-sdk connection reuse
|
|
2
|
+
process.env['AWS_NODEJS_CONNECTION_REUSE_ENABLED'] = '1';
|
|
3
|
+
import { Config, ConfigProviderDynamo } from '@basemaps/config';
|
|
4
|
+
import { Const } from './const.js';
|
|
5
|
+
Config.setConfigProvider(new ConfigProviderDynamo(Const.TileMetadata.TableName));
|
|
6
|
+
export { Config } from '@basemaps/config';
|
|
7
|
+
export { Const, Env } from './const.js';
|
|
8
|
+
export { LogConfig } from './log.js';
|
|
9
|
+
export * from './api.path.js';
|
|
10
|
+
export * from './api.js';
|
|
11
|
+
export { V, VNode, VNodeElement, VNodeText } from './vdom.js';
|
|
12
|
+
export { VNodeParser } from './vdom.parse.js';
|
|
13
|
+
export { CompositeError } from './composite.error.js';
|
|
14
|
+
export { LoggerFatalError } from './logger.fatal.error.js';
|
|
15
|
+
export { TileSetName, TileSetNameValues } from './proj/tile.set.name.js';
|
|
16
|
+
export * from './proj/projection.js';
|
|
17
|
+
export * from './file/index.js';
|
|
18
|
+
export * from './util.js';
|
package/build/log.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Writable } from 'stream';
|
|
2
1
|
export interface LogFunc {
|
|
3
2
|
(msg: string): void;
|
|
4
3
|
(obj: Record<string, unknown>, msg: string): void;
|
|
@@ -23,8 +22,6 @@ export declare const LogConfig: {
|
|
|
23
22
|
/** Get the currently configured logger */
|
|
24
23
|
get(): LogType;
|
|
25
24
|
set(log: LogType): void;
|
|
26
|
-
/** Overwrite the logger with a new logger that outputs to the provided stream*/
|
|
27
|
-
setOutputStream(stream: Writable): void;
|
|
28
25
|
/** Disable the logger */
|
|
29
26
|
disable(): void;
|
|
30
27
|
};
|
package/build/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACnD;AAID;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;CAClD;AAGD;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB,0CAA0C;WACnC,OAAO;aAOL,OAAO,GAAG,IAAI;IAIvB,yBAAyB;eACd,IAAI;CAGhB,CAAC"}
|
package/build/log.js
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.LogConfig = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pino_1 = tslib_1.__importDefault(require("pino"));
|
|
1
|
+
import pino from 'pino';
|
|
2
|
+
import { PrettyTransform } from 'pretty-json-log';
|
|
6
3
|
let currentLog;
|
|
4
|
+
const defaultOpts = { level: 'debug' };
|
|
7
5
|
/**
|
|
8
6
|
* Encapsulate the logger so that it can be swapped out
|
|
9
7
|
*/
|
|
10
|
-
|
|
8
|
+
export const LogConfig = {
|
|
11
9
|
/** Get the currently configured logger */
|
|
12
10
|
get() {
|
|
13
11
|
if (currentLog == null) {
|
|
14
|
-
currentLog =
|
|
12
|
+
currentLog = process.stdout.isTTY ? pino(defaultOpts, PrettyTransform.stream()) : pino(defaultOpts);
|
|
15
13
|
}
|
|
16
14
|
return currentLog;
|
|
17
15
|
},
|
|
18
16
|
set(log) {
|
|
19
17
|
currentLog = log;
|
|
20
18
|
},
|
|
21
|
-
/** Overwrite the logger with a new logger that outputs to the provided stream*/
|
|
22
|
-
setOutputStream(stream) {
|
|
23
|
-
let level = 'debug';
|
|
24
|
-
if (currentLog) {
|
|
25
|
-
level = currentLog.level;
|
|
26
|
-
}
|
|
27
|
-
currentLog = pino_1.default({ level }, stream);
|
|
28
|
-
},
|
|
29
19
|
/** Disable the logger */
|
|
30
20
|
disable() {
|
|
31
|
-
|
|
21
|
+
LogConfig.get().level = 'silent';
|
|
32
22
|
},
|
|
33
23
|
};
|