@basemaps/cli 6.6.0 → 6.10.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/basemaps.js +2 -0
  3. package/build/cli/base.cli.d.ts +1 -1
  4. package/build/cli/base.cli.d.ts.map +1 -1
  5. package/build/cli/base.cli.js +25 -27
  6. package/build/cli/basemaps/action.invalidate.d.ts +1 -1
  7. package/build/cli/basemaps/action.invalidate.d.ts.map +1 -1
  8. package/build/cli/basemaps/action.invalidate.js +14 -18
  9. package/build/cli/basemaps/action.tileset.info.d.ts +1 -1
  10. package/build/cli/basemaps/action.tileset.info.d.ts.map +1 -1
  11. package/build/cli/basemaps/action.tileset.info.js +18 -23
  12. package/build/cli/basemaps/index.d.ts +2 -2
  13. package/build/cli/basemaps/index.d.ts.map +1 -1
  14. package/build/cli/basemaps/index.js +10 -14
  15. package/build/cli/basemaps/tileset.action.d.ts.map +1 -1
  16. package/build/cli/basemaps/tileset.action.js +4 -8
  17. package/build/cli/basemaps/tileset.util.d.ts +1 -13
  18. package/build/cli/basemaps/tileset.util.d.ts.map +1 -1
  19. package/build/cli/basemaps/tileset.util.js +20 -63
  20. package/build/cli/cli.table.d.ts.map +1 -1
  21. package/build/cli/cli.table.js +2 -7
  22. package/build/cli/cogify/__test__/action.batch.test.js +11 -14
  23. package/build/cli/cogify/__test__/semver.test.js +50 -53
  24. package/build/cli/cogify/action.batch.d.ts +2 -2
  25. package/build/cli/cogify/action.batch.d.ts.map +1 -1
  26. package/build/cli/cogify/action.batch.js +16 -22
  27. package/build/cli/cogify/action.cog.d.ts +1 -1
  28. package/build/cli/cogify/action.cog.d.ts.map +1 -1
  29. package/build/cli/cogify/action.cog.js +29 -33
  30. package/build/cli/cogify/action.job.d.ts.map +1 -1
  31. package/build/cli/cogify/action.job.js +21 -26
  32. package/build/cli/cogify/index.d.ts +2 -2
  33. package/build/cli/cogify/index.d.ts.map +1 -1
  34. package/build/cli/cogify/index.js +9 -13
  35. package/build/cli/cogify/semver.util.d.ts.map +1 -1
  36. package/build/cli/cogify/semver.util.js +2 -5
  37. package/build/cli/folder.js +6 -11
  38. package/build/cli/tag.action.js +1 -4
  39. package/build/cli/util.js +11 -16
  40. package/build/cog/__test__/builder.test.js +31 -35
  41. package/build/cog/__test__/cog.stac.job.test.js +59 -62
  42. package/build/cog/__test__/cog.test.js +26 -29
  43. package/build/cog/__test__/cog.vrt.test.js +90 -90
  44. package/build/cog/__test__/cutline.test.js +71 -71
  45. package/build/cog/__test__/source.tiff.testhelper.d.ts +1 -1
  46. package/build/cog/__test__/source.tiff.testhelper.d.ts.map +1 -1
  47. package/build/cog/__test__/source.tiff.testhelper.js +6 -9
  48. package/build/cog/builder.d.ts +3 -3
  49. package/build/cog/builder.d.ts.map +1 -1
  50. package/build/cog/builder.js +43 -48
  51. package/build/cog/cog.d.ts +2 -2
  52. package/build/cog/cog.d.ts.map +1 -1
  53. package/build/cog/cog.js +15 -19
  54. package/build/cog/cog.stac.job.d.ts +10 -10
  55. package/build/cog/cog.stac.job.d.ts.map +1 -1
  56. package/build/cog/cog.stac.job.js +48 -52
  57. package/build/cog/cog.vrt.d.ts +2 -2
  58. package/build/cog/cog.vrt.d.ts.map +1 -1
  59. package/build/cog/cog.vrt.js +16 -18
  60. package/build/cog/constants.js +2 -5
  61. package/build/cog/cutline.d.ts +21 -21
  62. package/build/cog/cutline.d.ts.map +1 -1
  63. package/build/cog/cutline.js +53 -58
  64. package/build/cog/job.factory.d.ts +2 -2
  65. package/build/cog/job.factory.d.ts.map +1 -1
  66. package/build/cog/job.factory.js +25 -41
  67. package/build/cog/stac.d.ts +1 -1
  68. package/build/cog/stac.d.ts.map +1 -1
  69. package/build/cog/stac.js +2 -5
  70. package/build/cog/types.d.ts +1 -1
  71. package/build/cog/types.d.ts.map +1 -1
  72. package/build/cog/types.js +1 -2
  73. package/build/gdal/__test__/gdal.progress.test.js +11 -14
  74. package/build/gdal/__test__/gdal.test.js +35 -38
  75. package/build/gdal/gdal.cog.d.ts +2 -2
  76. package/build/gdal/gdal.cog.d.ts.map +1 -1
  77. package/build/gdal/gdal.cog.js +14 -18
  78. package/build/gdal/gdal.command.d.ts +1 -1
  79. package/build/gdal/gdal.command.d.ts.map +1 -1
  80. package/build/gdal/gdal.command.js +4 -9
  81. package/build/gdal/gdal.config.d.ts.map +1 -1
  82. package/build/gdal/gdal.config.js +4 -7
  83. package/build/gdal/gdal.d.ts +1 -1
  84. package/build/gdal/gdal.d.ts.map +1 -1
  85. package/build/gdal/gdal.docker.d.ts +1 -1
  86. package/build/gdal/gdal.docker.d.ts.map +1 -1
  87. package/build/gdal/gdal.docker.js +8 -13
  88. package/build/gdal/gdal.js +7 -11
  89. package/build/gdal/gdal.local.d.ts +1 -1
  90. package/build/gdal/gdal.local.d.ts.map +1 -1
  91. package/build/gdal/gdal.local.js +2 -6
  92. package/build/gdal/gdal.progress.d.ts.map +1 -1
  93. package/build/gdal/gdal.progress.js +2 -6
  94. package/build/index.d.ts +5 -5
  95. package/build/index.d.ts.map +1 -1
  96. package/build/index.js +4 -11
  97. package/{cogify → cogify.js} +1 -1
  98. package/package.json +15 -13
  99. package/basemaps +0 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,58 @@
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.10.0](https://github.com/linz/basemaps/compare/v6.9.1...v6.10.0) (2021-09-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * correctly bundle with esm modules ([#1858](https://github.com/linz/basemaps/issues/1858)) ([708a22e](https://github.com/linz/basemaps/commit/708a22ec1006c25cf2c057b75f61cc813e943aac))
12
+
13
+
14
+ ### Features
15
+
16
+ * replace s3fs with chunkd/fs ([#1859](https://github.com/linz/basemaps/issues/1859)) ([9b6f2d3](https://github.com/linz/basemaps/commit/9b6f2d3609c336f96c2ae32246f241cb396e71c8))
17
+ * switch to esm modules ([#1857](https://github.com/linz/basemaps/issues/1857)) ([75bdff8](https://github.com/linz/basemaps/commit/75bdff8da35104f10f6b6ecf58a2c6006245af6e))
18
+
19
+
20
+
21
+
22
+
23
+ ## [6.9.1](https://github.com/linz/basemaps/compare/v6.9.0...v6.9.1) (2021-09-09)
24
+
25
+ **Note:** Version bump only for package @basemaps/cli
26
+
27
+
28
+
29
+
30
+
31
+ # [6.9.0](https://github.com/linz/basemaps/compare/v6.8.0...v6.9.0) (2021-09-09)
32
+
33
+ **Note:** Version bump only for package @basemaps/cli
34
+
35
+
36
+
37
+
38
+
39
+ # [6.8.0](https://github.com/linz/basemaps/compare/v6.7.0...v6.8.0) (2021-09-01)
40
+
41
+
42
+ ### Features
43
+
44
+ * **server:** create a standalone express server ([#1819](https://github.com/linz/basemaps/issues/1819)) ([83488af](https://github.com/linz/basemaps/commit/83488af658a3ed8f3080dd2ea9f120ac3abd2444))
45
+
46
+
47
+
48
+
49
+
50
+ # [6.7.0](https://github.com/linz/basemaps/compare/v6.6.1...v6.7.0) (2021-08-15)
51
+
52
+ **Note:** Version bump only for package @basemaps/cli
53
+
54
+
55
+
56
+
57
+
6
58
  # [6.6.0](https://github.com/linz/basemaps/compare/v6.5.0...v6.6.0) (2021-07-29)
7
59
 
8
60
  **Note:** Version bump only for package @basemaps/cli
package/basemaps.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './build/cli/basemaps/index.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { CommandLineParser } from '@rushstack/ts-command-line';
3
- import 'source-map-support/register';
3
+ import 'source-map-support/register.js';
4
4
  /** Useful traceability information */
5
5
  export declare const CliInfo: {
6
6
  package: string;
@@ -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;AAE/D,OAAO,6BAA6B,CAAC;AAMrC,uCAAuC;AACvC,eAAO,MAAM,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAIrE,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,KAAK,QAAc,CAAC;AAEjC,8BAAsB,eAAgB,SAAQ,iBAAiB;IAC3D,OAAO,gEAIJ;IACH,YAAY,gEAIT;IAEH,SAAS,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBpC,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAI7B,GAAG,IAAI,IAAI;CAUrB"}
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;AAI/D,OAAO,gCAAgC,CAAC;AAOxC,uCAAuC;AACvC,eAAO,MAAM,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAIrE,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;IAoBpC,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAI7B,GAAG,IAAI,IAAI;CAUnB"}
@@ -1,26 +1,25 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
2
  var _a, _b, _c;
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.BaseCommandLine = exports.CliId = exports.CliInfo = void 0;
6
- const tslib_1 = require("tslib");
7
- const shared_1 = require("@basemaps/shared");
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');
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 { readFileSync } from 'fs';
7
+ import path from 'path';
8
+ import { PrettyTransform } from 'pretty-json-log';
9
+ import 'source-map-support/register.js';
10
+ import * as ulid from 'ulid';
11
+ import url from 'url';
12
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
13
+ const packageJson = JSON.parse(readFileSync(path.join(__dirname, '../../package.json')).toString());
15
14
  /** Useful traceability information */
16
- exports.CliInfo = {
15
+ export const CliInfo = {
17
16
  package: packageJson.name,
18
17
  version: (_a = process.env.GIT_VERSION) !== null && _a !== void 0 ? _a : packageJson.version,
19
- hash: (_c = (_b = process.env.GIT_HASH) !== null && _b !== void 0 ? _b : packageJson.gitHead) !== null && _c !== void 0 ? _c : git_tag_1.GitTag().hash,
18
+ hash: (_c = (_b = process.env.GIT_HASH) !== null && _b !== void 0 ? _b : packageJson.gitHead) !== null && _c !== void 0 ? _c : GitTag().hash,
20
19
  };
21
20
  /** Unique Id for this instance of the cli being run */
22
- exports.CliId = ulid.ulid();
23
- class BaseCommandLine extends ts_command_line_1.CommandLineParser {
21
+ export const CliId = ulid.ulid();
22
+ export class BaseCommandLine extends CommandLineParser {
24
23
  constructor() {
25
24
  super(...arguments);
26
25
  this.verbose = this.defineFlagParameter({
@@ -37,20 +36,20 @@ class BaseCommandLine extends ts_command_line_1.CommandLineParser {
37
36
  onExecute() {
38
37
  // If the console is a tty pretty print the output
39
38
  if (process.stdout.isTTY) {
40
- shared_1.LogConfig.setOutputStream(pretty_json_log_1.PrettyTransform.stream());
39
+ LogConfig.setOutputStream(PrettyTransform.stream());
41
40
  }
42
41
  if (this.verbose.value) {
43
- shared_1.LogConfig.get().level = 'debug';
42
+ LogConfig.get().level = 'debug';
44
43
  }
45
44
  else if (this.extraVerbose.value) {
46
- shared_1.LogConfig.get().level = 'trace';
45
+ LogConfig.get().level = 'trace';
47
46
  }
48
47
  else {
49
- shared_1.LogConfig.get().level = 'info';
48
+ LogConfig.get().level = 'info';
50
49
  }
51
- const logger = shared_1.LogConfig.get().child({ id: exports.CliId });
52
- logger.info(exports.CliInfo, 'CliStart');
53
- shared_1.LogConfig.set(logger);
50
+ const logger = LogConfig.get().child({ id: CliId });
51
+ logger.info(CliInfo, 'CliStart');
52
+ LogConfig.set(logger);
54
53
  return super.onExecute();
55
54
  }
56
55
  onDefineParameters() {
@@ -58,14 +57,13 @@ class BaseCommandLine extends ts_command_line_1.CommandLineParser {
58
57
  }
59
58
  run() {
60
59
  this.executeWithoutErrorHandling().catch((err) => {
61
- if (err instanceof shared_1.LoggerFatalError) {
62
- shared_1.LogConfig.get().fatal(err.obj, err.message);
60
+ if (err instanceof LoggerFatalError) {
61
+ LogConfig.get().fatal(err.obj, err.message);
63
62
  }
64
63
  else {
65
- shared_1.LogConfig.get().fatal({ err }, 'Failed to run command');
64
+ LogConfig.get().fatal({ err }, 'Failed to run command');
66
65
  }
67
66
  process.exit(1);
68
67
  });
69
68
  }
70
69
  }
71
- exports.BaseCommandLine = BaseCommandLine;
@@ -1,4 +1,4 @@
1
- import { TileSetBaseAction } from './tileset.action';
1
+ import { TileSetBaseAction } from './tileset.action.js';
2
2
  export declare class TileSetInvalidateAction extends TileSetBaseAction {
3
3
  private commit;
4
4
  private projection;
@@ -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,kBAAkB,CAAC;AAGrD,qBAAa,uBAAwB,SAAQ,iBAAiB;IAC1D,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;CAgB7C"}
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
- const geo_1 = require("@basemaps/geo");
6
- const shared_1 = require("@basemaps/shared");
7
- const tag_action_1 = require("../tag.action");
8
- const tileset_action_1 = require("./tileset.action");
9
- const tileset_util_1 = require("./tileset.util");
10
- class TileSetInvalidateAction extends tileset_action_1.TileSetBaseAction {
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(tag_action_1.TagActions.Commit);
20
- this.projection = this.defineIntegerParameter(tag_action_1.TagActions.Projection);
21
- this.tileSet = this.defineStringParameter(tag_action_1.TagActions.TileSet);
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 = geo_1.Epsg.tryGet(this.projection.value);
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 shared_1.Config.TileSet.get(shared_1.Config.TileSet.id(tileSet));
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
- shared_1.LogConfig.get().info({ tileSet, projection }, 'Invalidating');
28
+ LogConfig.get().info({ tileSet, projection }, 'Invalidating');
32
29
  if (this.commit.value) {
33
- await tileset_util_1.invalidateXYZCache(tileSet, projection, this.commit.value);
30
+ await invalidateXYZCache(tileSet, projection, this.commit.value);
34
31
  }
35
32
  else {
36
- shared_1.LogConfig.get().warn('DryRun:Done');
33
+ LogConfig.get().warn('DryRun:Done');
37
34
  }
38
35
  }
39
36
  }
40
- exports.TileSetInvalidateAction = TileSetInvalidateAction;
@@ -1,4 +1,4 @@
1
- import { TileSetBaseAction } from './tileset.action';
1
+ import { TileSetBaseAction } from './tileset.action.js';
2
2
  export declare class TileSetInfoAction extends TileSetBaseAction {
3
3
  private imagery;
4
4
  private projection;
@@ -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,kBAAkB,CAAC;AAGrD,qBAAa,iBAAkB,SAAQ,iBAAiB;IACpD,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;CAuB7C"}
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
- const geo_1 = require("@basemaps/geo");
7
- const shared_1 = require("@basemaps/shared");
8
- const c = tslib_1.__importStar(require("ansi-colors"));
9
- const tag_action_1 = require("../tag.action");
10
- const tileset_action_1 = require("./tileset.action");
11
- const tileset_util_1 = require("./tileset.util");
12
- class TileSetInfoAction extends tileset_action_1.TileSetBaseAction {
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(tag_action_1.TagActions.Imagery);
22
- this.projection = this.defineIntegerParameter(tag_action_1.TagActions.Projection);
23
- this.tileSet = this.defineStringParameter(tag_action_1.TagActions.TileSet);
24
- this.version = this.defineIntegerParameter(tag_action_1.TagActions.Version);
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 shared_1.Config.Imagery.get(imageryId);
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 = geo_1.Epsg.tryGet(this.projection.value);
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
- shared_1.LogConfig.get().fatal('Missing --tileset and --projection or --imagery');
44
+ LogConfig.get().fatal('Missing --tileset and --projection or --imagery');
49
45
  console.log(this.renderHelpText());
50
46
  return;
51
47
  }
52
- const tileSetId = shared_1.Config.TileSet.id(tileSet);
53
- const tsData = await shared_1.Config.TileSet.get(tileSetId);
48
+ const tileSetId = Config.TileSet.id(tileSet);
49
+ const tsData = await Config.TileSet.get(tileSetId);
54
50
  if (tsData == null) {
55
- shared_1.LogConfig.get().fatal({ tileSet }, 'Unable to find tile set');
51
+ LogConfig.get().fatal({ tileSet }, 'Unable to find tile set');
56
52
  return;
57
53
  }
58
- await tileset_util_1.printTileSet(tsData, projection);
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":";AAGA,OAAO,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,qBAAa,mBAAoB,SAAQ,eAAe;;CAavD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/basemaps/index.ts"],"names":[],"mappings":";AAGA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjD,qBAAa,mBAAoB,SAAQ,eAAe;;CAavD"}
@@ -1,25 +1,21 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.BasemapsCommandLine = void 0;
5
- const shared_1 = require("@basemaps/shared");
6
- const pretty_json_log_1 = require("pretty-json-log");
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 { LogConfig } from '@basemaps/shared';
3
+ import { PrettyTransform } from 'pretty-json-log';
4
+ import 'source-map-support/register.js';
5
+ import { BaseCommandLine } from '../base.cli.js';
6
+ import { TileSetInvalidateAction } from './action.invalidate.js';
7
+ import { TileSetInfoAction } from './action.tileset.info.js';
8
+ export class BasemapsCommandLine extends BaseCommandLine {
12
9
  constructor() {
13
10
  super({
14
11
  toolFilename: 'basemaps',
15
12
  toolDescription: 'Basemaps configuration utilities',
16
13
  });
17
- this.addAction(new action_tileset_info_1.TileSetInfoAction());
18
- this.addAction(new action_invalidate_1.TileSetInvalidateAction());
14
+ this.addAction(new TileSetInfoAction());
15
+ this.addAction(new TileSetInvalidateAction());
19
16
  if (process.stdout.isTTY) {
20
- shared_1.LogConfig.setOutputStream(pretty_json_log_1.PrettyTransform.stream());
17
+ LogConfig.setOutputStream(PrettyTransform.stream());
21
18
  }
22
19
  }
23
20
  }
24
- exports.BasemapsCommandLine = BasemapsCommandLine;
25
21
  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;IAC7D,iDAAiD;IACjD,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAyB,GAAG,IAAI;CAK5F"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TileSetBaseAction = void 0;
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 = shared_1.LogConfig.get()) {
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,cAAc,CAAC;AAgBxC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAYzF;AASD,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;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC;CAC1B;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,CAoB9G;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAItG"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invalidateXYZCache = exports.printTileSet = exports.printTileSetImagery = exports.TileSetTable = exports.rgbaToHex = exports.parseRgba = void 0;
4
- const tslib_1 = require("tslib");
5
- const config_1 = require("@basemaps/config");
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
- exports.rgbaToHex = rgbaToHex;
56
- exports.TileSetTable = new cli_table_1.CliTable();
57
- exports.TileSetTable.field('Imagery Id', 30, (obj) => c.dim(obj.imagery.id));
58
- exports.TileSetTable.field('Name', 40, (obj) => obj.imagery.name);
59
- exports.TileSetTable.field('Zoom', 10, (obj) => obj.layer.minZoom + ' -> ' + obj.layer.maxZoom);
60
- exports.TileSetTable.field('CreatedAt', 10, (obj) => new Date(obj.imagery.createdAt).toISOString());
61
- async function printTileSetImagery(tsData, projection) {
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 = shared_1.Config.TileSet.getImageId(layer, projection);
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
- exports.TileSetTable.header();
75
- exports.TileSetTable.print(ruleImagery);
34
+ TileSetTable.header();
35
+ TileSetTable.print(ruleImagery);
76
36
  }
77
- exports.printTileSetImagery = printTileSetImagery;
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 === config_1.TileSetType.Vector)
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 util_1.invalidateCache(path, commit);
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;IAC/C,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;CAGxB"}
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"}
@@ -1,12 +1,8 @@
1
- "use strict";
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const ospec_1 = tslib_1.__importDefault(require("ospec"));
5
- const action_batch_1 = require("../action.batch");
6
- ospec_1.default.spec('action.batch', () => {
7
- ospec_1.default('extractResolutionFromName', () => {
8
- ospec_1.default(action_batch_1.extractResolutionFromName('2013')).equals(-1);
9
- ospec_1.default(action_batch_1.extractResolutionFromName('new_zealand_sentinel_2018-19_10m')).equals(10000);
10
- ospec_1.default(action_batch_1.extractResolutionFromName('abc2017def_1.00m')).equals(1000);
11
- ospec_1.default(action_batch_1.extractResolutionFromName('wellington_urban_2017_0.10m')).equals(100);
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
  });