@basemaps/cli 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/basemaps.js +2 -0
- package/build/cli/base.cli.d.ts +1 -1
- package/build/cli/base.cli.d.ts.map +1 -1
- package/build/cli/base.cli.js +22 -33
- package/build/cli/basemaps/action.invalidate.d.ts +1 -1
- package/build/cli/basemaps/action.invalidate.d.ts.map +1 -1
- package/build/cli/basemaps/action.invalidate.js +14 -18
- package/build/cli/basemaps/action.tileset.info.d.ts +1 -1
- package/build/cli/basemaps/action.tileset.info.d.ts.map +1 -1
- package/build/cli/basemaps/action.tileset.info.js +18 -23
- package/build/cli/basemaps/index.d.ts +2 -2
- package/build/cli/basemaps/index.d.ts.map +1 -1
- package/build/cli/basemaps/index.js +7 -16
- package/build/cli/basemaps/tileset.action.d.ts.map +1 -1
- package/build/cli/basemaps/tileset.action.js +4 -8
- package/build/cli/basemaps/tileset.util.d.ts +1 -13
- package/build/cli/basemaps/tileset.util.d.ts.map +1 -1
- package/build/cli/basemaps/tileset.util.js +20 -63
- package/build/cli/cli.table.d.ts.map +1 -1
- package/build/cli/cli.table.js +2 -7
- package/build/cli/cogify/__test__/action.batch.test.js +11 -14
- package/build/cli/cogify/__test__/semver.test.js +50 -53
- package/build/cli/cogify/action.batch.d.ts +2 -2
- package/build/cli/cogify/action.batch.d.ts.map +1 -1
- package/build/cli/cogify/action.batch.js +16 -22
- package/build/cli/cogify/action.cog.d.ts +1 -1
- package/build/cli/cogify/action.cog.d.ts.map +1 -1
- package/build/cli/cogify/action.cog.js +29 -33
- package/build/cli/cogify/action.job.d.ts.map +1 -1
- package/build/cli/cogify/action.job.js +21 -26
- package/build/cli/cogify/index.d.ts +2 -2
- package/build/cli/cogify/index.d.ts.map +1 -1
- package/build/cli/cogify/index.js +9 -13
- package/build/cli/cogify/semver.util.d.ts.map +1 -1
- package/build/cli/cogify/semver.util.js +2 -5
- package/build/cli/folder.js +6 -11
- package/build/cli/tag.action.js +1 -4
- package/build/cli/util.js +11 -16
- package/build/cog/__test__/builder.test.js +31 -35
- package/build/cog/__test__/cog.stac.job.test.js +59 -62
- package/build/cog/__test__/cog.test.js +26 -29
- package/build/cog/__test__/cog.vrt.test.js +90 -90
- package/build/cog/__test__/cutline.test.js +71 -71
- package/build/cog/__test__/source.tiff.testhelper.d.ts +1 -1
- package/build/cog/__test__/source.tiff.testhelper.d.ts.map +1 -1
- package/build/cog/__test__/source.tiff.testhelper.js +6 -9
- package/build/cog/builder.d.ts +3 -3
- package/build/cog/builder.d.ts.map +1 -1
- package/build/cog/builder.js +43 -48
- package/build/cog/cog.d.ts +2 -2
- package/build/cog/cog.d.ts.map +1 -1
- package/build/cog/cog.js +15 -19
- package/build/cog/cog.stac.job.d.ts +10 -10
- package/build/cog/cog.stac.job.d.ts.map +1 -1
- package/build/cog/cog.stac.job.js +48 -52
- package/build/cog/cog.vrt.d.ts +2 -2
- package/build/cog/cog.vrt.d.ts.map +1 -1
- package/build/cog/cog.vrt.js +16 -18
- package/build/cog/constants.js +2 -5
- package/build/cog/cutline.d.ts +21 -21
- package/build/cog/cutline.d.ts.map +1 -1
- package/build/cog/cutline.js +53 -58
- package/build/cog/job.factory.d.ts +2 -2
- package/build/cog/job.factory.d.ts.map +1 -1
- package/build/cog/job.factory.js +25 -41
- package/build/cog/stac.d.ts +1 -1
- package/build/cog/stac.d.ts.map +1 -1
- package/build/cog/stac.js +2 -5
- package/build/cog/types.d.ts +1 -1
- package/build/cog/types.d.ts.map +1 -1
- package/build/cog/types.js +1 -2
- package/build/gdal/__test__/gdal.progress.test.js +11 -14
- package/build/gdal/__test__/gdal.test.js +35 -38
- package/build/gdal/gdal.cog.d.ts +2 -2
- package/build/gdal/gdal.cog.d.ts.map +1 -1
- package/build/gdal/gdal.cog.js +14 -18
- package/build/gdal/gdal.command.d.ts +1 -1
- package/build/gdal/gdal.command.d.ts.map +1 -1
- package/build/gdal/gdal.command.js +4 -9
- package/build/gdal/gdal.config.d.ts.map +1 -1
- package/build/gdal/gdal.config.js +4 -7
- package/build/gdal/gdal.d.ts +1 -1
- package/build/gdal/gdal.d.ts.map +1 -1
- package/build/gdal/gdal.docker.d.ts +1 -1
- package/build/gdal/gdal.docker.d.ts.map +1 -1
- package/build/gdal/gdal.docker.js +8 -13
- package/build/gdal/gdal.js +7 -11
- package/build/gdal/gdal.local.d.ts +1 -1
- package/build/gdal/gdal.local.d.ts.map +1 -1
- package/build/gdal/gdal.local.js +2 -6
- package/build/gdal/gdal.progress.d.ts.map +1 -1
- package/build/gdal/gdal.progress.js +2 -6
- package/build/index.d.ts +5 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -11
- package/{cogify → cogify.js} +1 -1
- package/package.json +15 -13
- package/basemaps +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,67 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.11.0](https://github.com/linz/basemaps/compare/v6.10.1...v6.11.0) (2021-10-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cli:** correct path issues with ESM modules being bundled into docker containers ([#1888](https://github.com/linz/basemaps/issues/1888)) ([7c1b2f4](https://github.com/linz/basemaps/commit/7c1b2f4979956a09f63b461463bb43788ce0122c))
|
|
12
|
+
* **cli:** work around certificate issues ([#1890](https://github.com/linz/basemaps/issues/1890)) ([5e90775](https://github.com/linz/basemaps/commit/5e907752f0a195d6b6b976bb1bbf56895e6e18f7))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **server:** use the lambda handler directly ([#1870](https://github.com/linz/basemaps/issues/1870)) ([408ff56](https://github.com/linz/basemaps/commit/408ff5654cc04aae35d05eb5bbc47a51f99ec5b2))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# [6.10.0](https://github.com/linz/basemaps/compare/v6.9.1...v6.10.0) (2021-09-22)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* correctly bundle with esm modules ([#1858](https://github.com/linz/basemaps/issues/1858)) ([708a22e](https://github.com/linz/basemaps/commit/708a22ec1006c25cf2c057b75f61cc813e943aac))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* replace s3fs with chunkd/fs ([#1859](https://github.com/linz/basemaps/issues/1859)) ([9b6f2d3](https://github.com/linz/basemaps/commit/9b6f2d3609c336f96c2ae32246f241cb396e71c8))
|
|
34
|
+
* switch to esm modules ([#1857](https://github.com/linz/basemaps/issues/1857)) ([75bdff8](https://github.com/linz/basemaps/commit/75bdff8da35104f10f6b6ecf58a2c6006245af6e))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [6.9.1](https://github.com/linz/basemaps/compare/v6.9.0...v6.9.1) (2021-09-09)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @basemaps/cli
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# [6.9.0](https://github.com/linz/basemaps/compare/v6.8.0...v6.9.0) (2021-09-09)
|
|
49
|
+
|
|
50
|
+
**Note:** Version bump only for package @basemaps/cli
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# [6.8.0](https://github.com/linz/basemaps/compare/v6.7.0...v6.8.0) (2021-09-01)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
* **server:** create a standalone express server ([#1819](https://github.com/linz/basemaps/issues/1819)) ([83488af](https://github.com/linz/basemaps/commit/83488af658a3ed8f3080dd2ea9f120ac3abd2444))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
6
67
|
# [6.7.0](https://github.com/linz/basemaps/compare/v6.6.1...v6.7.0) (2021-08-15)
|
|
7
68
|
|
|
8
69
|
**Note:** Version bump only for package @basemaps/cli
|
package/basemaps.js
ADDED
package/build/cli/base.cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.cli.d.ts","sourceRoot":"","sources":["../../src/cli/base.cli.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"base.cli.d.ts","sourceRoot":"","sources":["../../src/cli/base.cli.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,gCAAgC,CAAC;AAGxC,uCAAuC;AACvC,eAAO,MAAM,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAKrE,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,KAAK,QAAc,CAAC;AAEjC,8BAAsB,eAAgB,SAAQ,iBAAiB;IAC7D,OAAO,gEAIJ;IACH,YAAY,gEAIT;IAEH,SAAS,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAI7B,GAAG,IAAI,IAAI;CAUnB"}
|
package/build/cli/base.cli.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const git_tag_1 = require("@basemaps/shared/build/cli/git.tag");
|
|
9
|
-
const ts_command_line_1 = require("@rushstack/ts-command-line");
|
|
10
|
-
const pretty_json_log_1 = require("pretty-json-log");
|
|
11
|
-
require("source-map-support/register");
|
|
12
|
-
const ulid = tslib_1.__importStar(require("ulid"));
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
14
|
-
const packageJson = require('../../package.json');
|
|
2
|
+
var _a, _b;
|
|
3
|
+
import { LogConfig, LoggerFatalError } from '@basemaps/shared';
|
|
4
|
+
import { GitTag } from '@basemaps/shared/build/cli/git.tag.js';
|
|
5
|
+
import { CommandLineParser } from '@rushstack/ts-command-line';
|
|
6
|
+
import 'source-map-support/register.js';
|
|
7
|
+
import * as ulid from 'ulid';
|
|
15
8
|
/** Useful traceability information */
|
|
16
|
-
|
|
17
|
-
package
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
export const CliInfo = {
|
|
10
|
+
// Detect unlinked packages looks for this string since its a package name, slightly work around it
|
|
11
|
+
package: '@' + 'basemaps/cli',
|
|
12
|
+
version: (_a = process.env.GIT_VERSION) !== null && _a !== void 0 ? _a : GitTag().version,
|
|
13
|
+
hash: (_b = process.env.GIT_HASH) !== null && _b !== void 0 ? _b : GitTag().hash,
|
|
20
14
|
};
|
|
21
15
|
/** Unique Id for this instance of the cli being run */
|
|
22
|
-
|
|
23
|
-
class BaseCommandLine extends
|
|
16
|
+
export const CliId = ulid.ulid();
|
|
17
|
+
export class BaseCommandLine extends CommandLineParser {
|
|
24
18
|
constructor() {
|
|
25
19
|
super(...arguments);
|
|
26
20
|
this.verbose = this.defineFlagParameter({
|
|
@@ -35,22 +29,18 @@ class BaseCommandLine extends ts_command_line_1.CommandLineParser {
|
|
|
35
29
|
});
|
|
36
30
|
}
|
|
37
31
|
onExecute() {
|
|
38
|
-
// If the console is a tty pretty print the output
|
|
39
|
-
if (process.stdout.isTTY) {
|
|
40
|
-
shared_1.LogConfig.setOutputStream(pretty_json_log_1.PrettyTransform.stream());
|
|
41
|
-
}
|
|
42
32
|
if (this.verbose.value) {
|
|
43
|
-
|
|
33
|
+
LogConfig.get().level = 'debug';
|
|
44
34
|
}
|
|
45
35
|
else if (this.extraVerbose.value) {
|
|
46
|
-
|
|
36
|
+
LogConfig.get().level = 'trace';
|
|
47
37
|
}
|
|
48
38
|
else {
|
|
49
|
-
|
|
39
|
+
LogConfig.get().level = 'info';
|
|
50
40
|
}
|
|
51
|
-
const logger =
|
|
52
|
-
logger.info(
|
|
53
|
-
|
|
41
|
+
const logger = LogConfig.get().child({ id: CliId });
|
|
42
|
+
logger.info(CliInfo, 'CliStart');
|
|
43
|
+
LogConfig.set(logger);
|
|
54
44
|
return super.onExecute();
|
|
55
45
|
}
|
|
56
46
|
onDefineParameters() {
|
|
@@ -58,14 +48,13 @@ class BaseCommandLine extends ts_command_line_1.CommandLineParser {
|
|
|
58
48
|
}
|
|
59
49
|
run() {
|
|
60
50
|
this.executeWithoutErrorHandling().catch((err) => {
|
|
61
|
-
if (err instanceof
|
|
62
|
-
|
|
51
|
+
if (err instanceof LoggerFatalError) {
|
|
52
|
+
LogConfig.get().fatal(err.obj, err.message);
|
|
63
53
|
}
|
|
64
54
|
else {
|
|
65
|
-
|
|
55
|
+
LogConfig.get().fatal({ err }, 'Failed to run command');
|
|
66
56
|
}
|
|
67
57
|
process.exit(1);
|
|
68
58
|
});
|
|
69
59
|
}
|
|
70
60
|
}
|
|
71
|
-
exports.BaseCommandLine = BaseCommandLine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.invalidate.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/action.invalidate.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"action.invalidate.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/action.invalidate.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,qBAAa,uBAAwB,SAAQ,iBAAiB;IAC5D,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,OAAO,CAA6B;;IAU5C,SAAS,CAAC,kBAAkB,IAAI,IAAI;cAMpB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB3C"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TileSetInvalidateAction = void 0;
|
|
4
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class TileSetInvalidateAction extends
|
|
2
|
+
import { Epsg } from '@basemaps/geo';
|
|
3
|
+
import { Config, LogConfig } from '@basemaps/shared';
|
|
4
|
+
import { TagActions } from '../tag.action.js';
|
|
5
|
+
import { TileSetBaseAction } from './tileset.action.js';
|
|
6
|
+
import { invalidateXYZCache } from './tileset.util.js';
|
|
7
|
+
export class TileSetInvalidateAction extends TileSetBaseAction {
|
|
11
8
|
constructor() {
|
|
12
9
|
super({
|
|
13
10
|
actionName: 'invalidate',
|
|
@@ -16,25 +13,24 @@ class TileSetInvalidateAction extends tileset_action_1.TileSetBaseAction {
|
|
|
16
13
|
});
|
|
17
14
|
}
|
|
18
15
|
onDefineParameters() {
|
|
19
|
-
this.commit = this.defineFlagParameter(
|
|
20
|
-
this.projection = this.defineIntegerParameter(
|
|
21
|
-
this.tileSet = this.defineStringParameter(
|
|
16
|
+
this.commit = this.defineFlagParameter(TagActions.Commit);
|
|
17
|
+
this.projection = this.defineIntegerParameter(TagActions.Projection);
|
|
18
|
+
this.tileSet = this.defineStringParameter(TagActions.TileSet);
|
|
22
19
|
}
|
|
23
20
|
async onExecute() {
|
|
24
21
|
const tileSet = this.tileSet.value;
|
|
25
|
-
const projection =
|
|
22
|
+
const projection = Epsg.tryGet(this.projection.value);
|
|
26
23
|
if (projection == null)
|
|
27
24
|
return this.fatal({ projection: this.projection.value }, 'Invalid projection');
|
|
28
|
-
const tsData = await
|
|
25
|
+
const tsData = await Config.TileSet.get(Config.TileSet.id(tileSet));
|
|
29
26
|
if (tsData == null)
|
|
30
27
|
return this.fatal({ tileSet }, 'Could not find tileset');
|
|
31
|
-
|
|
28
|
+
LogConfig.get().info({ tileSet, projection }, 'Invalidating');
|
|
32
29
|
if (this.commit.value) {
|
|
33
|
-
await
|
|
30
|
+
await invalidateXYZCache(tileSet, projection, this.commit.value);
|
|
34
31
|
}
|
|
35
32
|
else {
|
|
36
|
-
|
|
33
|
+
LogConfig.get().warn('DryRun:Done');
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
exports.TileSetInvalidateAction = TileSetInvalidateAction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.tileset.info.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/action.tileset.info.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"action.tileset.info.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/action.tileset.info.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,qBAAa,iBAAkB,SAAQ,iBAAiB;IACtD,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,OAAO,CAA8B;;IAU7C,SAAS,CAAC,kBAAkB,IAAI,IAAI;YAOtB,SAAS;cAcP,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAuB3C"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TileSetInfoAction = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class TileSetInfoAction extends
|
|
2
|
+
import { Epsg } from '@basemaps/geo';
|
|
3
|
+
import { Config, LogConfig } from '@basemaps/shared';
|
|
4
|
+
import * as c from 'ansi-colors';
|
|
5
|
+
import { TagActions } from '../tag.action.js';
|
|
6
|
+
import { TileSetBaseAction } from './tileset.action.js';
|
|
7
|
+
import { printTileSet } from './tileset.util.js';
|
|
8
|
+
export class TileSetInfoAction extends TileSetBaseAction {
|
|
13
9
|
constructor() {
|
|
14
10
|
super({
|
|
15
11
|
actionName: 'info',
|
|
@@ -18,13 +14,13 @@ class TileSetInfoAction extends tileset_action_1.TileSetBaseAction {
|
|
|
18
14
|
});
|
|
19
15
|
}
|
|
20
16
|
onDefineParameters() {
|
|
21
|
-
this.imagery = this.defineStringParameter(
|
|
22
|
-
this.projection = this.defineIntegerParameter(
|
|
23
|
-
this.tileSet = this.defineStringParameter(
|
|
24
|
-
this.version = this.defineIntegerParameter(
|
|
17
|
+
this.imagery = this.defineStringParameter(TagActions.Imagery);
|
|
18
|
+
this.projection = this.defineIntegerParameter(TagActions.Projection);
|
|
19
|
+
this.tileSet = this.defineStringParameter(TagActions.TileSet);
|
|
20
|
+
this.version = this.defineIntegerParameter(TagActions.Version);
|
|
25
21
|
}
|
|
26
22
|
async imageInfo(imageryId) {
|
|
27
|
-
const img = await
|
|
23
|
+
const img = await Config.Imagery.get(imageryId);
|
|
28
24
|
if (img == null)
|
|
29
25
|
throw new Error('Cannot find imagery with id ' + imageryId);
|
|
30
26
|
console.log(c.bold('Imagery:'), img.name);
|
|
@@ -38,24 +34,23 @@ class TileSetInfoAction extends tileset_action_1.TileSetBaseAction {
|
|
|
38
34
|
}
|
|
39
35
|
async onExecute() {
|
|
40
36
|
const tileSet = this.tileSet.value;
|
|
41
|
-
const projection =
|
|
37
|
+
const projection = Epsg.tryGet(this.projection.value);
|
|
42
38
|
if (projection == null)
|
|
43
39
|
return this.fatal({ projection: this.projection.value }, 'Invalid projection');
|
|
44
40
|
const imgId = this.imagery.value;
|
|
45
41
|
if (imgId != null)
|
|
46
42
|
return this.imageInfo(imgId);
|
|
47
43
|
if (tileSet == null) {
|
|
48
|
-
|
|
44
|
+
LogConfig.get().fatal('Missing --tileset and --projection or --imagery');
|
|
49
45
|
console.log(this.renderHelpText());
|
|
50
46
|
return;
|
|
51
47
|
}
|
|
52
|
-
const tileSetId =
|
|
53
|
-
const tsData = await
|
|
48
|
+
const tileSetId = Config.TileSet.id(tileSet);
|
|
49
|
+
const tsData = await Config.TileSet.get(tileSetId);
|
|
54
50
|
if (tsData == null) {
|
|
55
|
-
|
|
51
|
+
LogConfig.get().fatal({ tileSet }, 'Unable to find tile set');
|
|
56
52
|
return;
|
|
57
53
|
}
|
|
58
|
-
await
|
|
54
|
+
await printTileSet(tsData, projection);
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
|
-
exports.TileSetInfoAction = TileSetInfoAction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import 'source-map-support/register';
|
|
3
|
-
import { BaseCommandLine } from '../base.cli';
|
|
2
|
+
import 'source-map-support/register.js';
|
|
3
|
+
import { BaseCommandLine } from '../base.cli.js';
|
|
4
4
|
export declare class BasemapsCommandLine extends BaseCommandLine {
|
|
5
5
|
constructor();
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/index.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjD,qBAAa,mBAAoB,SAAQ,eAAe;;CASvD"}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require("source-map-support/register");
|
|
8
|
-
const base_cli_1 = require("../base.cli");
|
|
9
|
-
const action_invalidate_1 = require("./action.invalidate");
|
|
10
|
-
const action_tileset_info_1 = require("./action.tileset.info");
|
|
11
|
-
class BasemapsCommandLine extends base_cli_1.BaseCommandLine {
|
|
2
|
+
import 'source-map-support/register.js';
|
|
3
|
+
import { BaseCommandLine } from '../base.cli.js';
|
|
4
|
+
import { TileSetInvalidateAction } from './action.invalidate.js';
|
|
5
|
+
import { TileSetInfoAction } from './action.tileset.info.js';
|
|
6
|
+
export class BasemapsCommandLine extends BaseCommandLine {
|
|
12
7
|
constructor() {
|
|
13
8
|
super({
|
|
14
9
|
toolFilename: 'basemaps',
|
|
15
10
|
toolDescription: 'Basemaps configuration utilities',
|
|
16
11
|
});
|
|
17
|
-
this.addAction(new
|
|
18
|
-
this.addAction(new
|
|
19
|
-
if (process.stdout.isTTY) {
|
|
20
|
-
shared_1.LogConfig.setOutputStream(pretty_json_log_1.PrettyTransform.stream());
|
|
21
|
-
}
|
|
12
|
+
this.addAction(new TileSetInfoAction());
|
|
13
|
+
this.addAction(new TileSetInvalidateAction());
|
|
22
14
|
}
|
|
23
15
|
}
|
|
24
|
-
exports.BasemapsCommandLine = BasemapsCommandLine;
|
|
25
16
|
new BasemapsCommandLine().run();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileset.action.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/tileset.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,8BAAsB,iBAAkB,SAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"tileset.action.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/tileset.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,8BAAsB,iBAAkB,SAAQ,iBAAiB;IAC/D,iDAAiD;IACjD,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAyB,GAAG,IAAI;CAK1F"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const shared_1 = require("@basemaps/shared");
|
|
5
|
-
const ts_command_line_1 = require("@rushstack/ts-command-line");
|
|
6
|
-
class TileSetBaseAction extends ts_command_line_1.CommandLineAction {
|
|
1
|
+
import { LogConfig } from '@basemaps/shared';
|
|
2
|
+
import { CommandLineAction } from '@rushstack/ts-command-line';
|
|
3
|
+
export class TileSetBaseAction extends CommandLineAction {
|
|
7
4
|
/** Log a fatal error and render the help text */
|
|
8
|
-
fatal(obj, msg, logger =
|
|
5
|
+
fatal(obj, msg, logger = LogConfig.get()) {
|
|
9
6
|
logger.fatal(obj, msg);
|
|
10
7
|
console.log('\n');
|
|
11
8
|
console.log(this.renderHelpText());
|
|
12
9
|
}
|
|
13
10
|
}
|
|
14
|
-
exports.TileSetBaseAction = TileSetBaseAction;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import { ConfigImagery, ConfigLayer, ConfigTileSet, ConfigTileSetRaster } from '@basemaps/config';
|
|
2
2
|
import { Epsg } from '@basemaps/geo';
|
|
3
|
-
import { CliTable } from '../cli.table';
|
|
4
|
-
/**
|
|
5
|
-
* Parse a hexstring into RGBA
|
|
6
|
-
*
|
|
7
|
-
* Defaults to 0 if missing values
|
|
8
|
-
* @param str string to parse
|
|
9
|
-
*/
|
|
10
|
-
export declare function parseRgba(str: string): {
|
|
11
|
-
r: number;
|
|
12
|
-
g: number;
|
|
13
|
-
b: number;
|
|
14
|
-
alpha: number;
|
|
15
|
-
};
|
|
3
|
+
import { CliTable } from '../cli.table.js';
|
|
16
4
|
export declare function rgbaToHex(c: {
|
|
17
5
|
r: number;
|
|
18
6
|
g: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileset.util.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/tileset.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tileset.util.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/tileset.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAU3C,wBAAgB,SAAS,CAAC,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEvF;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,+BAAsC,CAAC;AAMhE,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CActG;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAc9G;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAItG"}
|
|
@@ -1,47 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const shared_1 = require("@basemaps/shared");
|
|
7
|
-
const c = tslib_1.__importStar(require("ansi-colors"));
|
|
8
|
-
const cli_table_1 = require("../cli.table");
|
|
9
|
-
const util_1 = require("../util");
|
|
10
|
-
/**
|
|
11
|
-
* Parse a string as hex, return 0 on failure
|
|
12
|
-
* @param str string to parse
|
|
13
|
-
*/
|
|
14
|
-
function parseHex(str) {
|
|
15
|
-
if (str === '')
|
|
16
|
-
return 0;
|
|
17
|
-
const val = parseInt(str, 16);
|
|
18
|
-
if (isNaN(val)) {
|
|
19
|
-
throw new Error('Invalid hex byte: ' + str);
|
|
20
|
-
}
|
|
21
|
-
return val;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Parse a hexstring into RGBA
|
|
25
|
-
*
|
|
26
|
-
* Defaults to 0 if missing values
|
|
27
|
-
* @param str string to parse
|
|
28
|
-
*/
|
|
29
|
-
function parseRgba(str) {
|
|
30
|
-
if (str.startsWith('0x'))
|
|
31
|
-
str = str.slice(2);
|
|
32
|
-
else if (str.startsWith('#'))
|
|
33
|
-
str = str.slice(1);
|
|
34
|
-
if (str.length !== 6 && str.length !== 8) {
|
|
35
|
-
throw new Error('Invalid hex color: ' + str);
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
r: parseHex(str.substr(0, 2)),
|
|
39
|
-
g: parseHex(str.substr(2, 2)),
|
|
40
|
-
b: parseHex(str.substr(4, 2)),
|
|
41
|
-
alpha: parseHex(str.substr(6, 2)),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
exports.parseRgba = parseRgba;
|
|
1
|
+
import { TileSetType } from '@basemaps/config';
|
|
2
|
+
import { Config } from '@basemaps/shared';
|
|
3
|
+
import * as c from 'ansi-colors';
|
|
4
|
+
import { CliTable } from '../cli.table.js';
|
|
5
|
+
import { invalidateCache } from '../util.js';
|
|
45
6
|
/**
|
|
46
7
|
* Convert a number to a two digit hex string. numbers < 16 are padded with '0'
|
|
47
8
|
*/
|
|
@@ -49,20 +10,19 @@ function numberToHexString(n) {
|
|
|
49
10
|
const ans = n.toString(16);
|
|
50
11
|
return ans.length === 1 ? '0' + ans : ans;
|
|
51
12
|
}
|
|
52
|
-
function rgbaToHex(c) {
|
|
13
|
+
export function rgbaToHex(c) {
|
|
53
14
|
return numberToHexString(c.r) + numberToHexString(c.g) + numberToHexString(c.b) + numberToHexString(c.alpha);
|
|
54
15
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const allImagery = await shared_1.Config.TileSet.getImagery(tsData);
|
|
16
|
+
export const TileSetTable = new CliTable();
|
|
17
|
+
TileSetTable.field('Imagery Id', 30, (obj) => c.dim(obj.imagery.id));
|
|
18
|
+
TileSetTable.field('Name', 40, (obj) => obj.imagery.name);
|
|
19
|
+
TileSetTable.field('Zoom', 10, (obj) => obj.layer.minZoom + ' -> ' + obj.layer.maxZoom);
|
|
20
|
+
TileSetTable.field('CreatedAt', 10, (obj) => new Date(obj.imagery.createdAt).toISOString());
|
|
21
|
+
export async function printTileSetImagery(tsData, projection) {
|
|
22
|
+
const allImagery = await Config.getTileSetImagery(tsData);
|
|
63
23
|
const ruleImagery = [];
|
|
64
24
|
for (const layer of tsData.layers) {
|
|
65
|
-
const imgId =
|
|
25
|
+
const imgId = Config.getImageId(layer, projection);
|
|
66
26
|
if (imgId != null) {
|
|
67
27
|
const imagery = allImagery.get(imgId);
|
|
68
28
|
if (imagery == null)
|
|
@@ -71,15 +31,14 @@ async function printTileSetImagery(tsData, projection) {
|
|
|
71
31
|
}
|
|
72
32
|
}
|
|
73
33
|
console.log('');
|
|
74
|
-
|
|
75
|
-
|
|
34
|
+
TileSetTable.header();
|
|
35
|
+
TileSetTable.print(ruleImagery);
|
|
76
36
|
}
|
|
77
|
-
|
|
78
|
-
async function printTileSet(tsData, projection, printImagery = true) {
|
|
37
|
+
export async function printTileSet(tsData, projection, printImagery = true) {
|
|
79
38
|
console.log(c.bold('TileSet:'), `${tsData.name} `);
|
|
80
39
|
console.log(c.bold('CreatedAt:'), new Date(tsData.createdAt).toISOString());
|
|
81
40
|
console.log(c.bold('UpdatedAt:'), new Date(tsData.updatedAt).toISOString());
|
|
82
|
-
if (tsData.type ===
|
|
41
|
+
if (tsData.type === TileSetType.Vector)
|
|
83
42
|
return;
|
|
84
43
|
if (tsData.background) {
|
|
85
44
|
console.log(c.bold('Background'), tsData.background);
|
|
@@ -90,12 +49,10 @@ async function printTileSet(tsData, projection, printImagery = true) {
|
|
|
90
49
|
if (printImagery)
|
|
91
50
|
await printTileSetImagery(tsData, projection);
|
|
92
51
|
}
|
|
93
|
-
exports.printTileSet = printTileSet;
|
|
94
52
|
/**
|
|
95
53
|
* Invalidate the cloudfront distribution cache when updating imagery sets
|
|
96
54
|
*/
|
|
97
|
-
async function invalidateXYZCache(name, projection, commit = false) {
|
|
55
|
+
export async function invalidateXYZCache(name, projection, commit = false) {
|
|
98
56
|
const path = `/v1/tiles/${name}/${projection.toEpsgString()}/*`;
|
|
99
|
-
return
|
|
57
|
+
return invalidateCache(path, commit);
|
|
100
58
|
}
|
|
101
|
-
exports.invalidateXYZCache = invalidateXYZCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.table.d.ts","sourceRoot":"","sources":["../../src/cli/cli.table.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.table.d.ts","sourceRoot":"","sources":["../../src/cli/cli.table.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACjD,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAA;KAAE,EAAE,CAAM;IAE1E,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI;IAInE,MAAM,IAAI,IAAI;IAId,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM;IAIpB,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,IAAI;CAGtB"}
|
package/build/cli/cli.table.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CliTable = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const c = tslib_1.__importStar(require("ansi-colors"));
|
|
1
|
+
import * as c from 'ansi-colors';
|
|
6
2
|
/**
|
|
7
3
|
* Simple fixed width table formatter
|
|
8
4
|
*/
|
|
9
|
-
class CliTable {
|
|
5
|
+
export class CliTable {
|
|
10
6
|
constructor() {
|
|
11
7
|
this.fields = [];
|
|
12
8
|
}
|
|
@@ -23,4 +19,3 @@ class CliTable {
|
|
|
23
19
|
obj.forEach((o) => console.log(this.line(o)));
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
|
-
exports.CliTable = CliTable;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ospec_1.default(action_batch_1.extractResolutionFromName('wellington_urban_2017_0-10m')).equals(100);
|
|
13
|
-
ospec_1.default(action_batch_1.extractResolutionFromName('wellington_urban_2017_1.00m')).equals(1000);
|
|
14
|
-
ospec_1.default(action_batch_1.extractResolutionFromName('wellington_urban_2017_0.025m')).equals(25);
|
|
1
|
+
import o from 'ospec';
|
|
2
|
+
import { extractResolutionFromName } from '../action.batch.js';
|
|
3
|
+
o.spec('action.batch', () => {
|
|
4
|
+
o('extractResolutionFromName', () => {
|
|
5
|
+
o(extractResolutionFromName('2013')).equals(-1);
|
|
6
|
+
o(extractResolutionFromName('new_zealand_sentinel_2018-19_10m')).equals(10000);
|
|
7
|
+
o(extractResolutionFromName('abc2017def_1.00m')).equals(1000);
|
|
8
|
+
o(extractResolutionFromName('wellington_urban_2017_0.10m')).equals(100);
|
|
9
|
+
o(extractResolutionFromName('wellington_urban_2017_0-10m')).equals(100);
|
|
10
|
+
o(extractResolutionFromName('wellington_urban_2017_1.00m')).equals(1000);
|
|
11
|
+
o(extractResolutionFromName('wellington_urban_2017_0.025m')).equals(25);
|
|
15
12
|
});
|
|
16
13
|
});
|