@basemaps/cli 6.46.0 → 7.1.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/README.md +10 -108
- package/build/cli/__tests__/util.test.d.ts +0 -1
- package/build/cli/__tests__/util.test.js +11 -10
- package/build/cli/__tests__/util.test.js.map +1 -1
- package/build/cli/bin.d.ts +0 -1
- package/build/cli/config/action.bundle.assets.d.ts +5 -7
- package/build/cli/config/action.bundle.assets.js +34 -21
- package/build/cli/config/action.bundle.assets.js.map +1 -1
- package/build/cli/config/action.bundle.d.ts +1 -1
- package/build/cli/config/action.bundle.js +40 -12
- package/build/cli/config/action.bundle.js.map +1 -1
- package/build/cli/config/action.import.d.ts +4 -9
- package/build/cli/config/action.import.js +131 -110
- package/build/cli/config/action.import.js.map +1 -1
- package/build/cli/config/config.diff.d.ts +2 -2
- package/build/cli/config/config.diff.js +6 -4
- package/build/cli/config/config.diff.js.map +1 -1
- package/build/cli/config/config.update.d.ts +3 -5
- package/build/cli/config/config.update.js +42 -7
- package/build/cli/config/config.update.js.map +1 -1
- package/build/cli/folder.d.ts +0 -1
- package/build/cli/folder.js +1 -2
- package/build/cli/folder.js.map +1 -1
- package/build/cli/index.d.ts +0 -2
- package/build/cli/index.js +2 -17
- package/build/cli/index.js.map +1 -1
- package/build/cli/server/action.serve.d.ts +0 -1
- package/build/cli/server/action.serve.js +27 -4
- package/build/cli/server/action.serve.js.map +1 -1
- package/build/cli/util.d.ts +3 -8
- package/build/cli/util.js +48 -55
- package/build/cli/util.js.map +1 -1
- package/package.json +20 -24
- package/CHANGELOG.md +0 -1589
- package/build/cli/__tests__/util.test.d.ts.map +0 -1
- package/build/cli/base.cli.d.ts +0 -1
- package/build/cli/base.cli.d.ts.map +0 -1
- package/build/cli/base.cli.js +0 -2
- package/build/cli/base.cli.js.map +0 -1
- package/build/cli/bin.d.ts.map +0 -1
- package/build/cli/cogify/__tests__/batch.job.test.d.ts +0 -2
- package/build/cli/cogify/__tests__/batch.job.test.d.ts.map +0 -1
- package/build/cli/cogify/__tests__/batch.job.test.js +0 -92
- package/build/cli/cogify/__tests__/batch.job.test.js.map +0 -1
- package/build/cli/cogify/__tests__/semver.test.d.ts +0 -2
- package/build/cli/cogify/__tests__/semver.test.d.ts.map +0 -1
- package/build/cli/cogify/__tests__/semver.test.js +0 -62
- package/build/cli/cogify/__tests__/semver.test.js.map +0 -1
- package/build/cli/cogify/action.cog.d.ts +0 -20
- package/build/cli/cogify/action.cog.d.ts.map +0 -1
- package/build/cli/cogify/action.cog.js +0 -198
- package/build/cli/cogify/action.cog.js.map +0 -1
- package/build/cli/cogify/action.job.d.ts +0 -28
- package/build/cli/cogify/action.job.d.ts.map +0 -1
- package/build/cli/cogify/action.job.js +0 -176
- package/build/cli/cogify/action.job.js.map +0 -1
- package/build/cli/cogify/action.make.cog.d.ts +0 -23
- package/build/cli/cogify/action.make.cog.d.ts.map +0 -1
- package/build/cli/cogify/action.make.cog.js +0 -218
- package/build/cli/cogify/action.make.cog.js.map +0 -1
- package/build/cli/cogify/action.make.cog.pr.d.ts +0 -25
- package/build/cli/cogify/action.make.cog.pr.d.ts.map +0 -1
- package/build/cli/cogify/action.make.cog.pr.js +0 -96
- package/build/cli/cogify/action.make.cog.pr.js.map +0 -1
- package/build/cli/cogify/batch.job.d.ts +0 -40
- package/build/cli/cogify/batch.job.d.ts.map +0 -1
- package/build/cli/cogify/batch.job.js +0 -205
- package/build/cli/cogify/batch.job.js.map +0 -1
- package/build/cli/cogify/cutline.d.ts +0 -5
- package/build/cli/cogify/cutline.d.ts.map +0 -1
- package/build/cli/cogify/cutline.js +0 -33
- package/build/cli/cogify/cutline.js.map +0 -1
- package/build/cli/cogify/semver.util.d.ts +0 -24
- package/build/cli/cogify/semver.util.d.ts.map +0 -1
- package/build/cli/cogify/semver.util.js +0 -56
- package/build/cli/cogify/semver.util.js.map +0 -1
- package/build/cli/config/action.bundle.assets.d.ts.map +0 -1
- package/build/cli/config/action.bundle.d.ts.map +0 -1
- package/build/cli/config/action.cog.mapsheet.d.ts +0 -12
- package/build/cli/config/action.cog.mapsheet.d.ts.map +0 -1
- package/build/cli/config/action.cog.mapsheet.js +0 -107
- package/build/cli/config/action.cog.mapsheet.js.map +0 -1
- package/build/cli/config/action.imagery.config.d.ts +0 -11
- package/build/cli/config/action.imagery.config.d.ts.map +0 -1
- package/build/cli/config/action.imagery.config.js +0 -142
- package/build/cli/config/action.imagery.config.js.map +0 -1
- package/build/cli/config/action.import.d.ts.map +0 -1
- package/build/cli/config/config.diff.d.ts.map +0 -1
- package/build/cli/config/config.update.d.ts.map +0 -1
- package/build/cli/folder.d.ts.map +0 -1
- package/build/cli/github/github.d.ts +0 -49
- package/build/cli/github/github.d.ts.map +0 -1
- package/build/cli/github/github.js +0 -107
- package/build/cli/github/github.js.map +0 -1
- package/build/cli/github/make.cog.pr.d.ts +0 -42
- package/build/cli/github/make.cog.pr.d.ts.map +0 -1
- package/build/cli/github/make.cog.pr.js +0 -173
- package/build/cli/github/make.cog.pr.js.map +0 -1
- package/build/cli/index.d.ts.map +0 -1
- package/build/cli/overview/__test__/wmts.overview.test.d.ts +0 -2
- package/build/cli/overview/__test__/wmts.overview.test.d.ts.map +0 -1
- package/build/cli/overview/__test__/wmts.overview.test.js +0 -24
- package/build/cli/overview/__test__/wmts.overview.test.js.map +0 -1
- package/build/cli/overview/action.create.overview.d.ts +0 -17
- package/build/cli/overview/action.create.overview.d.ts.map +0 -1
- package/build/cli/overview/action.create.overview.js +0 -174
- package/build/cli/overview/action.create.overview.js.map +0 -1
- package/build/cli/overview/overview.wmts.d.ts +0 -3
- package/build/cli/overview/overview.wmts.d.ts.map +0 -1
- package/build/cli/overview/overview.wmts.js +0 -29
- package/build/cli/overview/overview.wmts.js.map +0 -1
- package/build/cli/overview/tile.generator.d.ts +0 -13
- package/build/cli/overview/tile.generator.d.ts.map +0 -1
- package/build/cli/overview/tile.generator.js +0 -86
- package/build/cli/overview/tile.generator.js.map +0 -1
- package/build/cli/overview/timer.d.ts +0 -14
- package/build/cli/overview/timer.d.ts.map +0 -1
- package/build/cli/overview/timer.js +0 -21
- package/build/cli/overview/timer.js.map +0 -1
- package/build/cli/server/action.serve.d.ts.map +0 -1
- package/build/cli/sprites/action.sprites.d.ts +0 -11
- package/build/cli/sprites/action.sprites.d.ts.map +0 -1
- package/build/cli/sprites/action.sprites.js +0 -42
- package/build/cli/sprites/action.sprites.js.map +0 -1
- package/build/cli/util.d.ts.map +0 -1
- package/build/cog/__tests__/builder.test.d.ts +0 -2
- package/build/cog/__tests__/builder.test.d.ts.map +0 -1
- package/build/cog/__tests__/builder.test.js +0 -81
- package/build/cog/__tests__/builder.test.js.map +0 -1
- package/build/cog/__tests__/cog.stac.job.test.d.ts +0 -2
- package/build/cog/__tests__/cog.stac.job.test.d.ts.map +0 -1
- package/build/cog/__tests__/cog.stac.job.test.js +0 -319
- package/build/cog/__tests__/cog.stac.job.test.js.map +0 -1
- package/build/cog/__tests__/cog.test.d.ts +0 -2
- package/build/cog/__tests__/cog.test.d.ts.map +0 -1
- package/build/cog/__tests__/cog.test.js +0 -91
- package/build/cog/__tests__/cog.test.js.map +0 -1
- package/build/cog/__tests__/cog.vrt.test.d.ts +0 -2
- package/build/cog/__tests__/cog.vrt.test.d.ts.map +0 -1
- package/build/cog/__tests__/cog.vrt.test.js +0 -229
- package/build/cog/__tests__/cog.vrt.test.js.map +0 -1
- package/build/cog/__tests__/cutline.test.d.ts +0 -2
- package/build/cog/__tests__/cutline.test.d.ts.map +0 -1
- package/build/cog/__tests__/cutline.test.js +0 -300
- package/build/cog/__tests__/cutline.test.js.map +0 -1
- package/build/cog/__tests__/projection.loader.test.d.ts +0 -2
- package/build/cog/__tests__/projection.loader.test.d.ts.map +0 -1
- package/build/cog/__tests__/projection.loader.test.js +0 -27
- package/build/cog/__tests__/projection.loader.test.js.map +0 -1
- package/build/cog/__tests__/source.tiff.testhelper.d.ts +0 -8
- package/build/cog/__tests__/source.tiff.testhelper.d.ts.map +0 -1
- package/build/cog/__tests__/source.tiff.testhelper.js +0 -41
- package/build/cog/__tests__/source.tiff.testhelper.js.map +0 -1
- package/build/cog/builder.d.ts +0 -49
- package/build/cog/builder.d.ts.map +0 -1
- package/build/cog/builder.js +0 -177
- package/build/cog/builder.js.map +0 -1
- package/build/cog/cog.d.ts +0 -22
- package/build/cog/cog.d.ts.map +0 -1
- package/build/cog/cog.js +0 -72
- package/build/cog/cog.js.map +0 -1
- package/build/cog/cog.stac.job.d.ts +0 -106
- package/build/cog/cog.stac.job.d.ts.map +0 -1
- package/build/cog/cog.stac.job.js +0 -257
- package/build/cog/cog.stac.job.js.map +0 -1
- package/build/cog/cog.vrt.d.ts +0 -18
- package/build/cog/cog.vrt.d.ts.map +0 -1
- package/build/cog/cog.vrt.js +0 -102
- package/build/cog/cog.vrt.js.map +0 -1
- package/build/cog/constants.d.ts +0 -5
- package/build/cog/constants.d.ts.map +0 -1
- package/build/cog/constants.js +0 -5
- package/build/cog/constants.js.map +0 -1
- package/build/cog/cutline.d.ts +0 -75
- package/build/cog/cutline.d.ts.map +0 -1
- package/build/cog/cutline.js +0 -250
- package/build/cog/cutline.js.map +0 -1
- package/build/cog/job.factory.d.ts +0 -10
- package/build/cog/job.factory.d.ts.map +0 -1
- package/build/cog/job.factory.js +0 -92
- package/build/cog/job.factory.js.map +0 -1
- package/build/cog/projection.loader.d.ts +0 -13
- package/build/cog/projection.loader.d.ts.map +0 -1
- package/build/cog/projection.loader.js +0 -27
- package/build/cog/projection.loader.js.map +0 -1
- package/build/cog/stac.d.ts +0 -32
- package/build/cog/stac.d.ts.map +0 -1
- package/build/cog/stac.js +0 -3
- package/build/cog/stac.js.map +0 -1
- package/build/cog/types.d.ts +0 -83
- package/build/cog/types.d.ts.map +0 -1
- package/build/cog/types.js +0 -2
- package/build/cog/types.js.map +0 -1
- package/build/gdal/__tests__/gdal.progress.test.d.ts +0 -2
- package/build/gdal/__tests__/gdal.progress.test.d.ts.map +0 -1
- package/build/gdal/__tests__/gdal.progress.test.js +0 -22
- package/build/gdal/__tests__/gdal.progress.test.js.map +0 -1
- package/build/gdal/__tests__/gdal.test.d.ts +0 -2
- package/build/gdal/__tests__/gdal.test.d.ts.map +0 -1
- package/build/gdal/__tests__/gdal.test.js +0 -52
- package/build/gdal/__tests__/gdal.test.js.map +0 -1
- package/build/gdal/gdal.cog.d.ts +0 -42
- package/build/gdal/gdal.cog.d.ts.map +0 -1
- package/build/gdal/gdal.cog.js +0 -108
- package/build/gdal/gdal.cog.js.map +0 -1
- package/build/gdal/gdal.command.d.ts +0 -44
- package/build/gdal/gdal.command.d.ts.map +0 -1
- package/build/gdal/gdal.command.js +0 -87
- package/build/gdal/gdal.command.js.map +0 -1
- package/build/gdal/gdal.config.d.ts +0 -51
- package/build/gdal/gdal.config.d.ts.map +0 -1
- package/build/gdal/gdal.config.js +0 -23
- package/build/gdal/gdal.config.js.map +0 -1
- package/build/gdal/gdal.d.ts +0 -19
- package/build/gdal/gdal.d.ts.map +0 -1
- package/build/gdal/gdal.docker.d.ts +0 -18
- package/build/gdal/gdal.docker.d.ts.map +0 -1
- package/build/gdal/gdal.docker.js +0 -82
- package/build/gdal/gdal.docker.js.map +0 -1
- package/build/gdal/gdal.js +0 -28
- package/build/gdal/gdal.js.map +0 -1
- package/build/gdal/gdal.local.d.ts +0 -10
- package/build/gdal/gdal.local.d.ts.map +0 -1
- package/build/gdal/gdal.local.js +0 -22
- package/build/gdal/gdal.local.js.map +0 -1
- package/build/gdal/gdal.progress.d.ts +0 -16
- package/build/gdal/gdal.progress.d.ts.map +0 -1
- package/build/gdal/gdal.progress.js +0 -50
- package/build/gdal/gdal.progress.js.map +0 -1
- package/build/index.d.ts +0 -6
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -6
- package/build/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @basemaps/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package contains cli's that are mainly used by the configuration and CICD processes in the LINZ Basemaps. All of the cli commands in this package will be build into docker container and publish as a [github container](https://github.com/linz/basemaps/pkgs/container/basemaps%2Fcli)
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -14,130 +14,32 @@ npm i @basemaps/cli
|
|
|
14
14
|
|
|
15
15
|
## Usage -- Bundle
|
|
16
16
|
|
|
17
|
-
Bundle config files into config bundle json from a given config path.
|
|
17
|
+
Bundle config files into config bundle json from a given config path. This is mainly use for [linz/basemaps-config](https://github.com/linz/basemaps-config) CICD process to bundle all the individual config json files into a single JSON bundle.
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
./bin/bmc.js bundle --config config/ --output config.json
|
|
20
|
+
./bin/bmc.js bundle --config config/ --assets assets/asset.tar --output config.json
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage -- Import
|
|
24
24
|
|
|
25
|
-
Import all configs from a bundled config.json into dynamo db from a given config path
|
|
25
|
+
Import all configs from a bundled config.json into dynamo db from a given config path. This is mainly use for [linz/basemaps-config](https://github.com/linz/basemaps-config) repository ci/cd process to deploy the config changes into DynamoDB.
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
./bin/bmc.js import --config config.json --commit
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
## Usage --
|
|
31
|
+
## Usage -- Create Config
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Create a individual config.json from a path of imagery for Basemaps to load as standalone server to view them. This is mainly used for the preview images for the Basemaps imagery import process.
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
./bin/bmc.js
|
|
36
|
+
./bin/bmc.js create-config --path s3://..../images/*.tiff --title image_title --commit
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
## Usage -- Overview
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
./bin/bmc.js screenshot --host HOST
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Dump the screenshots with config file
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
./bin/bmc.js screenshot --config s3://..../config.json.gz
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Usage -- sprites
|
|
54
|
-
|
|
55
|
-
Generate a sprite sheet from a list of sprites
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
./bin/bmc.js sprites --ratio 1 --ratio 2 --path ./config/sprites/topographic --output assets
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Outputs:
|
|
62
|
-
|
|
63
|
-
assets/topographic.json
|
|
64
|
-
assets/topographic.png
|
|
65
|
-
|
|
66
|
-
assets/topographic@2x.json
|
|
67
|
-
assets/topographic@2x.png
|
|
68
|
-
|
|
69
|
-
## Usage -- cogify
|
|
70
|
-
|
|
71
|
-
Create a collection of cloud optimized geotiff's from a collection of geotiff, that is optimized to be used in `@basemaps/tiler`
|
|
72
|
-
|
|
73
|
-
Create a list of COG's to create
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
./bin/bmc.js -V job --source ./source_folder/ --output ./source_folder/cogify/
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Build a specific COG
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
./bin/bmc.js -V cog --job ./cogs/01DYREBEEFFXEPBAYBED2TMAFJ/job.json --name 1-2-3 --commit
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Make cog job json
|
|
41
|
+
Create a overview tar file of tiles from the given of imagery. This create low zoom level tiles for the individual imagery and significantly improve the performance of serving individual imagery by pre-rendering and saving the tiles instead of rendering them on the fly.
|
|
86
42
|
|
|
87
43
|
```bash
|
|
88
|
-
./bin/bmc.js -
|
|
44
|
+
./bin/bmc.js create-overview --config s3://..../images/*.tiff --output overview/overviews.tar.co
|
|
89
45
|
```
|
|
90
|
-
|
|
91
|
-
Split make cog job into chunked sub-jobs
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
./bin/bmc.js -V split-job --job s3://imagery_path/job.json --output jobs.json
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Advanced Job creation
|
|
98
|
-
|
|
99
|
-
Useful configuration options for `cogify job`
|
|
100
|
-
|
|
101
|
-
### Min Tile zoom `--min-zoom :number`
|
|
102
|
-
|
|
103
|
-
using the argument `--min-zoom` will configure the highest COG tile that can be created
|
|
104
|
-
for example, `--min-zoom 10` means tiles of zoom `0 - 10` can be created but `11` cannot.
|
|
105
|
-
|
|
106
|
-
This is useful to control the size of COGS across varying imagery sets World level z0-5 vs region z12-15 vs specific area 20+
|
|
107
|
-
|
|
108
|
-
### Concurrency `--concurrency :number`
|
|
109
|
-
|
|
110
|
-
To load metadata quickly from S3 a lot of actions are run concurrently. using `--concurrent` controls the number of requests that can be outstanding at one time.
|
|
111
|
-
|
|
112
|
-
### Max COGs `--max-cogs :number`
|
|
113
|
-
|
|
114
|
-
Controls the number of output COGs to create for small imagery sets (<50GB) this number should be low < 5 for larger imagery sets this number can be much larger (100+ for TB+ imagery sets)
|
|
115
|
-
|
|
116
|
-
### GeoJson `--geojson`
|
|
117
|
-
|
|
118
|
-
Outputs two GeoJSON files to provide a representation of the source and target imagery, this can be used to help tune the generation parameters
|
|
119
|
-
|
|
120
|
-
## Building a COG collection
|
|
121
|
-
|
|
122
|
-
The best way to build a cog collection is to create multiple JOBS with `--geojson` enabled while adjusting `--max-cogs` and `--min-zoom` when a good covering is found the job can then be submitted to AWS for processing.
|
|
123
|
-
|
|
124
|
-
Using a large area of interest as shown in the imagery set below and is showing three different sets of parameters, The shaded green area is the original source imagery
|
|
125
|
-
|
|
126
|
-

|
|
127
|
-
|
|
128
|
-
### Green outline
|
|
129
|
-
|
|
130
|
-
**Arguments:** `--max-cogs 5 --min-zoom 15`
|
|
131
|
-
This has too much empty space inside the tile areas and is not a good example of a good collection of COGs to make.
|
|
132
|
-
|
|
133
|
-
### Red outline
|
|
134
|
-
|
|
135
|
-
**Arguments:** `--max-cogs 500 --min-zoom 25`
|
|
136
|
-
|
|
137
|
-
This creates too many tiles with many only including one or two source images.
|
|
138
|
-
|
|
139
|
-
### Blue outline
|
|
140
|
-
|
|
141
|
-
**Arguments:** `--max-cogs 70 --min-zoom 20`
|
|
142
|
-
|
|
143
|
-
This creates a decent covering without wasting too much space and not creating large area's of empty COG
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
2
3
|
import { nameImageryTitle } from '../util.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
describe('util', () => {
|
|
5
|
+
it('nameImageryTitle', () => {
|
|
6
|
+
assert.equal(nameImageryTitle('Palmerston-north urban 2016-17 12.125m'), 'palmerston-north_urban_2016-17_12-125m');
|
|
7
|
+
assert.equal(nameImageryTitle('Palmerston-north urban 2016-17 12-125'), 'palmerston-north_urban_2016-17_12-125');
|
|
8
|
+
assert.equal(nameImageryTitle('Palmerston-north / urban 2016-17 12.125'), 'palmerston-north_urban_2016-17_12-125');
|
|
9
|
+
assert.equal(nameImageryTitle('Palmerston.north / urban 2016-17 12.125'), 'palmerston-north_urban_2016-17_12-125');
|
|
10
|
+
assert.equal(nameImageryTitle('Manawatū urban 2016-17 12.125m'), 'manawatu_urban_2016-17_12-125m');
|
|
11
|
+
assert.equal(nameImageryTitle('ĀāĒēĪīŌōŪū urban 2016-17 12.125m'), 'aaeeiioouu_urban_2016-17_12-125m');
|
|
12
|
+
assert.equal(nameImageryTitle('Marlborough / Wellington 0.75m SNC50451 (2004-2005)'), 'marlborough_wellington_0-75m_snc50451_2004-2005');
|
|
12
13
|
});
|
|
13
14
|
});
|
|
14
15
|
//# sourceMappingURL=util.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.test.js","sourceRoot":"","sources":["../../../src/cli/__tests__/util.test.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"util.test.js","sourceRoot":"","sources":["../../../src/cli/__tests__/util.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,wCAAwC,CAAC,EAAE,wCAAwC,CAAC,CAAC;QACnH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,uCAAuC,CAAC,EAAE,uCAAuC,CAAC,CAAC;QACjH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,yCAAyC,CAAC,EAAE,uCAAuC,CAAC,CAAC;QACnH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,yCAAyC,CAAC,EAAE,uCAAuC,CAAC,CAAC;QACnH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,gCAAgC,CAAC,EAAE,gCAAgC,CAAC,CAAC;QACnG,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,EAAE,kCAAkC,CAAC,CAAC;QACvG,MAAM,CAAC,KAAK,CACV,gBAAgB,CAAC,qDAAqD,CAAC,EACvE,iDAAiD,CAClD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/build/cli/bin.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { CommandLineAction, CommandLineStringParameter } from '@rushstack/ts-command-line';
|
|
4
|
-
import { CotarIndexOptions } from '@cotar/core';
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
5
3
|
import { LogType } from '@basemaps/shared';
|
|
4
|
+
import { CommandLineAction, CommandLineStringParameter } from '@rushstack/ts-command-line';
|
|
6
5
|
import { Readable } from 'stream';
|
|
7
6
|
export declare function hashFile(stream: Readable): Promise<string>;
|
|
8
7
|
export declare class CommandBundleAssets extends CommandLineAction {
|
|
@@ -11,8 +10,7 @@ export declare class CommandBundleAssets extends CommandLineAction {
|
|
|
11
10
|
constructor();
|
|
12
11
|
protected onDefineParameters(): void;
|
|
13
12
|
protected onExecute(): Promise<void>;
|
|
14
|
-
buildTar(input:
|
|
13
|
+
buildTar(input: URL, output: string, logger: LogType): Promise<string>;
|
|
15
14
|
buildTarCo(input: string, output: string, logger: LogType): Promise<string>;
|
|
16
|
-
toTarIndex(filename: string, indexFileName: string,
|
|
15
|
+
toTarIndex(filename: string, indexFileName: string, logger: LogType): Promise<Buffer>;
|
|
17
16
|
}
|
|
18
|
-
//# sourceMappingURL=action.bundle.assets.d.ts.map
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SourceMemory } from '@
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createReadStream, promises as fs } from 'fs';
|
|
1
|
+
import { base58 } from '@basemaps/config';
|
|
2
|
+
import { fsa, LogConfig, SourceMemory } from '@basemaps/shared';
|
|
3
|
+
import { CotarIndexBuilder, TarReader } from '@cotar/builder';
|
|
4
|
+
import { CotarIndex } from '@cotar/core';
|
|
6
5
|
import { TarBuilder } from '@cotar/tar';
|
|
7
|
-
import {
|
|
8
|
-
import * as path from 'path';
|
|
6
|
+
import { CommandLineAction } from '@rushstack/ts-command-line';
|
|
9
7
|
import { createHash } from 'crypto';
|
|
10
|
-
import {
|
|
8
|
+
import { createReadStream, promises as fs } from 'fs';
|
|
11
9
|
const Packing = 25; // Packing factor for the hash map
|
|
12
10
|
const MaxSearch = 50; // Max search factor
|
|
13
11
|
export async function hashFile(stream) {
|
|
@@ -25,6 +23,18 @@ export class CommandBundleAssets extends CommandLineAction {
|
|
|
25
23
|
summary: 'Cli tool to create cotar file for the config assets',
|
|
26
24
|
documentation: 'Create a cotar file from a directory',
|
|
27
25
|
});
|
|
26
|
+
Object.defineProperty(this, "assets", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "output", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: void 0
|
|
37
|
+
});
|
|
28
38
|
}
|
|
29
39
|
onDefineParameters() {
|
|
30
40
|
this.assets = this.defineStringParameter({
|
|
@@ -43,11 +53,11 @@ export class CommandBundleAssets extends CommandLineAction {
|
|
|
43
53
|
const assets = this.assets.value;
|
|
44
54
|
const output = this.output.value;
|
|
45
55
|
if (assets == null || output == null)
|
|
46
|
-
throw new Error('Please provide a input
|
|
56
|
+
throw new Error('Please provide a input and output path');
|
|
47
57
|
if (!output.endsWith('.tar.co'))
|
|
48
58
|
throw new Error(`Invalid output, needs to be .tar.co :"${output}"`);
|
|
49
|
-
logger.info({
|
|
50
|
-
const tarFile = await this.buildTar(assets, output, logger);
|
|
59
|
+
logger.info({ input: assets }, 'BundleAssets:Start');
|
|
60
|
+
const tarFile = await this.buildTar(fsa.toUrl(assets), output, logger);
|
|
51
61
|
const cotarFile = await this.buildTarCo(tarFile, output, logger);
|
|
52
62
|
const cotarHash = await hashFile(createReadStream(cotarFile));
|
|
53
63
|
await fs.rename(cotarFile, cotarFile.replace('.tar.co', `-${cotarHash}.tar.co`));
|
|
@@ -59,12 +69,13 @@ export class CommandBundleAssets extends CommandLineAction {
|
|
|
59
69
|
const tarBuilder = new TarBuilder(outputTar);
|
|
60
70
|
const files = await fsa.toArray(fsa.list(input));
|
|
61
71
|
// Ensure files are put into the same order
|
|
62
|
-
files.sort((a, b) => a.localeCompare(b));
|
|
72
|
+
files.sort((a, b) => a.href.localeCompare(b.href));
|
|
63
73
|
logger.info({ output: outputTar, files: files.length }, 'Tar:Create');
|
|
64
|
-
const basePath = path.resolve(input);
|
|
65
74
|
for (const file of files) {
|
|
66
|
-
const filePath = file.replace(
|
|
67
|
-
|
|
75
|
+
const filePath = file.href.replace(input.href, '');
|
|
76
|
+
if (filePath.startsWith('/'))
|
|
77
|
+
filePath.slice(1); // Remove the leading '/'
|
|
78
|
+
await tarBuilder.write(decodeURI(filePath), await fsa.read(file));
|
|
68
79
|
}
|
|
69
80
|
await tarBuilder.close();
|
|
70
81
|
logger.info({ output: outputTar, stats: tarBuilder.stats, duration: Date.now() - startTime }, 'Tar:Create:Done');
|
|
@@ -72,24 +83,26 @@ export class CommandBundleAssets extends CommandLineAction {
|
|
|
72
83
|
}
|
|
73
84
|
async buildTarCo(input, output, logger) {
|
|
74
85
|
logger.info({ output }, 'Cotar:Create');
|
|
75
|
-
const opts = { packingFactor: 1 + Packing / 100, maxSearch: MaxSearch };
|
|
76
86
|
const indexFile = input + '.index';
|
|
77
87
|
const startTime = Date.now();
|
|
78
|
-
const buf = await this.toTarIndex(input, indexFile,
|
|
79
|
-
logger.info({ output }, 'Cotar:
|
|
88
|
+
const buf = await this.toTarIndex(input, indexFile, logger);
|
|
89
|
+
logger.info({ output }, 'Cotar:Create:WriteTar');
|
|
80
90
|
await fs.copyFile(input, output);
|
|
81
91
|
await fs.appendFile(output, buf);
|
|
82
92
|
const duration = Date.now() - startTime;
|
|
83
93
|
logger.info({ output, duration }, 'Cotar:Created');
|
|
84
94
|
return output;
|
|
85
95
|
}
|
|
86
|
-
async toTarIndex(filename, indexFileName,
|
|
96
|
+
async toTarIndex(filename, indexFileName, logger) {
|
|
87
97
|
const fd = await fs.open(filename, 'r');
|
|
88
98
|
logger.info({ index: indexFileName }, 'Cotar.Index:Start');
|
|
89
99
|
const startTime = Date.now();
|
|
90
|
-
const { buffer, count } = await CotarIndexBuilder.create(fd,
|
|
100
|
+
const { buffer, count } = await CotarIndexBuilder.create(fd, {
|
|
101
|
+
packingFactor: 1 + Packing / 100,
|
|
102
|
+
maxSearch: MaxSearch,
|
|
103
|
+
});
|
|
91
104
|
logger.info({ count, size: buffer.length, duration: Date.now() - startTime }, 'Cotar.Index:Created');
|
|
92
|
-
const index = await
|
|
105
|
+
const index = await CotarIndex.create(new SourceMemory('index', buffer));
|
|
93
106
|
await TarReader.validate(fd, index);
|
|
94
107
|
await fd.close();
|
|
95
108
|
return buffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.bundle.assets.js","sourceRoot":"","sources":["../../../src/cli/config/action.bundle.assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"action.bundle.assets.js","sourceRoot":"","sources":["../../../src/cli/config/action.bundle.assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,SAAS,EAAW,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAA8B,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAGtD,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,kCAAkC;AACtD,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,oBAAoB;AAE1C,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAAgB;IAC7C,OAAO,IAA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C,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACpC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -5,8 +5,8 @@ export declare class CommandBundle extends CommandLineAction {
|
|
|
5
5
|
private config;
|
|
6
6
|
private output;
|
|
7
7
|
private assets;
|
|
8
|
+
private configCache;
|
|
8
9
|
constructor();
|
|
9
10
|
protected onDefineParameters(): void;
|
|
10
11
|
onExecute(): Promise<void>;
|
|
11
12
|
}
|
|
12
|
-
//# sourceMappingURL=action.bundle.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ConfigJson } from '@basemaps/config';
|
|
1
|
+
import { ConfigJson } from '@basemaps/config-loader';
|
|
2
2
|
import { fsa, LogConfig } from '@basemaps/shared';
|
|
3
3
|
import { CommandLineAction } from '@rushstack/ts-command-line';
|
|
4
|
+
import pLimit from 'p-limit';
|
|
4
5
|
export const DefaultConfig = 'config/';
|
|
5
6
|
export const DefaultOutput = 'config/config.json';
|
|
6
7
|
export class CommandBundle extends CommandLineAction {
|
|
@@ -10,6 +11,30 @@ export class CommandBundle extends CommandLineAction {
|
|
|
10
11
|
summary: 'bundle a config json from config files',
|
|
11
12
|
documentation: 'Given a path of config files and bundle them into one config json',
|
|
12
13
|
});
|
|
14
|
+
Object.defineProperty(this, "config", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "output", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "assets", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "configCache", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: void 0
|
|
37
|
+
});
|
|
13
38
|
}
|
|
14
39
|
onDefineParameters() {
|
|
15
40
|
this.config = this.defineStringParameter({
|
|
@@ -26,22 +51,25 @@ export class CommandBundle extends CommandLineAction {
|
|
|
26
51
|
argumentName: 'ASSETS',
|
|
27
52
|
parameterLongName: '--assets',
|
|
28
53
|
description: 'Add assets location into the config bundle file',
|
|
29
|
-
|
|
54
|
+
});
|
|
55
|
+
this.configCache = this.defineStringParameter({
|
|
56
|
+
argumentName: 'CACHE',
|
|
57
|
+
parameterLongName: '--cache',
|
|
58
|
+
description: 'Location of the config cache to reduce number of requests needed to source file',
|
|
30
59
|
});
|
|
31
60
|
}
|
|
32
61
|
async onExecute() {
|
|
33
|
-
var _a, _b;
|
|
34
62
|
const logger = LogConfig.get();
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
63
|
+
const configUrl = fsa.toUrl(this.config.value ?? DefaultConfig);
|
|
64
|
+
const outputUrl = fsa.toUrl(this.output.value ?? DefaultOutput);
|
|
65
|
+
const cacheLocation = this.configCache.value ? fsa.toUrl(this.configCache.value) : undefined;
|
|
66
|
+
const q = pLimit(25);
|
|
67
|
+
const mem = await ConfigJson.fromUrl(configUrl, q, logger, cacheLocation);
|
|
68
|
+
if (this.assets.value)
|
|
69
|
+
mem.assets = this.assets.value;
|
|
38
70
|
const configJson = mem.toJson();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
throw new Error('Please provide a asset path.');
|
|
42
|
-
configJson.assets = assets;
|
|
43
|
-
await fsa.writeJson(bundle, configJson);
|
|
44
|
-
logger.info({ path: bundle }, 'ConfigBundled');
|
|
71
|
+
await fsa.write(outputUrl, JSON.stringify(configJson));
|
|
72
|
+
logger.info({ path: outputUrl }, 'ConfigBundled');
|
|
45
73
|
return;
|
|
46
74
|
}
|
|
47
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.bundle.js","sourceRoot":"","sources":["../../../src/cli/config/action.bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"action.bundle.js","sourceRoot":"","sources":["../../../src/cli/config/action.bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAA8B,MAAM,4BAA4B,CAAC;AAC3F,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAElD,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAMlD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,wCAAwC;YACjD,aAAa,EAAE,mEAAmE;SACnF,CAAC,CAAC;QAVG;;;;;WAAoC;QACpC;;;;;WAAoC;QACpC;;;;;WAAoC;QACpC;;;;;WAAyC;IAQjD,CAAC;IAES,kBAAkB;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACvC,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,UAAU;YAC7B,WAAW,EAAE,sBAAsB;SACpC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACvC,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,UAAU;YAC7B,WAAW,EAAE,2BAA2B;SACzC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACvC,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,UAAU;YAC7B,WAAW,EAAE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figProvider, ConfigLayer, ConfigProviderMemory } from '@basemaps/config';
|
|
2
2
|
import { TileMatrixSet } from '@basemaps/geo';
|
|
3
|
+
import { LogType } from '@basemaps/shared';
|
|
3
4
|
import { CommandLineAction } from '@rushstack/ts-command-line';
|
|
4
|
-
import { CogStacJob } from '../../cog/cog.stac.job.js';
|
|
5
|
-
import { FeatureCollection } from 'geojson';
|
|
6
5
|
export declare class CommandImport extends CommandLineAction {
|
|
7
6
|
private config;
|
|
8
|
-
private backup;
|
|
9
7
|
private output;
|
|
10
8
|
private commit;
|
|
9
|
+
private target;
|
|
11
10
|
promises: Promise<boolean>[];
|
|
12
11
|
/** List of paths to invalidate at the end of the request */
|
|
13
12
|
invalidations: string[];
|
|
@@ -17,8 +16,9 @@ export declare class CommandImport extends CommandLineAction {
|
|
|
17
16
|
backupConfig: ConfigProviderMemory;
|
|
18
17
|
constructor();
|
|
19
18
|
protected onDefineParameters(): void;
|
|
19
|
+
getConfig(logger: LogType): Promise<BasemapsConfigProvider>;
|
|
20
20
|
onExecute(): Promise<void>;
|
|
21
|
-
update(config: BaseConfig, commit: boolean): void;
|
|
21
|
+
update(config: BaseConfig, oldConfig: BasemapsConfigProvider, commit: boolean): void;
|
|
22
22
|
/**
|
|
23
23
|
* This function prepare for the markdown lines with preview urls for new inserted config layers
|
|
24
24
|
* @param mem new config data read from config bundle file
|
|
@@ -49,10 +49,6 @@ export declare class CommandImport extends CommandLineAction {
|
|
|
49
49
|
* @param cfg existing config data
|
|
50
50
|
*/
|
|
51
51
|
outputChange(output: string, mem: ConfigProviderMemory, cfg: BasemapsConfigProvider): Promise<void>;
|
|
52
|
-
_jobs: Map<string, CogStacJob>;
|
|
53
|
-
_loadJob(path: string): Promise<CogStacJob | undefined>;
|
|
54
|
-
_coverings: Map<string, FeatureCollection>;
|
|
55
|
-
_loadCovering(path: string): Promise<FeatureCollection>;
|
|
56
52
|
/**
|
|
57
53
|
* Prepare QA urls with center location
|
|
58
54
|
*/
|
|
@@ -61,4 +57,3 @@ export declare class CommandImport extends CommandLineAction {
|
|
|
61
57
|
tag: string;
|
|
62
58
|
}>;
|
|
63
59
|
}
|
|
64
|
-
//# sourceMappingURL=action.import.d.ts.map
|