@basemaps/cli 6.13.0 → 6.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/build/cli/cogify/action.cog.d.ts.map +1 -1
- package/build/cli/cogify/action.cog.js +6 -8
- package/build/cli/util.d.ts +1 -1
- package/build/cli/util.d.ts.map +1 -1
- package/build/cli/util.js +16 -3
- package/build/cog/builder.d.ts +2 -2
- package/build/cog/builder.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,52 @@
|
|
|
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.16.1](https://github.com/linz/basemaps/compare/v6.16.0...v6.16.1) (2021-11-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @basemaps/cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [6.16.0](https://github.com/linz/basemaps/compare/v6.15.0...v6.16.0) (2021-11-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **lambda-tiler:** p-limit is a needed dependency ([#1998](https://github.com/linz/basemaps/issues/1998)) ([dfb1b25](https://github.com/linz/basemaps/commit/dfb1b2575e9b40b96ffa4bdcfa8f1496b18ae25e))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [6.15.0](https://github.com/linz/basemaps/compare/v6.14.2...v6.15.0) (2021-11-28)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **cli:** ensure all files from the job.json are created before logging JobComplete ([#1959](https://github.com/linz/basemaps/issues/1959)) ([78fd35a](https://github.com/linz/basemaps/commit/78fd35ad863c424069d79c8668e9e5b3195ccec9))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# [6.14.0](https://github.com/linz/basemaps/compare/v6.13.0...v6.14.0) (2021-10-27)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **cli:** s3 keys should not start with a "/" ([#1935](https://github.com/linz/basemaps/issues/1935)) ([bc9cc22](https://github.com/linz/basemaps/commit/bc9cc224c0c4da6a85c193c8eb3524108d31c17d))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* **cli:** compress text documents with gzip before uploading ([#1936](https://github.com/linz/basemaps/issues/1936)) ([7a6e090](https://github.com/linz/basemaps/commit/7a6e090d0cc26372425b664d6788569e39fd5cca))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
6
52
|
# [6.13.0](https://github.com/linz/basemaps/compare/v6.12.2...v6.13.0) (2021-10-25)
|
|
7
53
|
|
|
8
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.cog.d.ts","sourceRoot":"","sources":["../../../src/cli/cogify/action.cog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EACL,iBAAiB,EAIlB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAM5C,qBAAa,eAAgB,SAAQ,iBAAiB;IACpD,OAAO,CAAC,GAAG,CAAC,CAA6B;IACzC,OAAO,CAAC,IAAI,CAAC,CAA6B;IAC1C,OAAO,CAAC,MAAM,CAAC,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAAC,CAA8B;;IAU/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAgC7B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAqEhC,2DAA2D;IACrD,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"action.cog.d.ts","sourceRoot":"","sources":["../../../src/cli/cogify/action.cog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EACL,iBAAiB,EAIlB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAM5C,qBAAa,eAAgB,SAAQ,iBAAiB;IACpD,OAAO,CAAC,GAAG,CAAC,CAA6B;IACzC,OAAO,CAAC,IAAI,CAAC,CAA6B;IAC1C,OAAO,CAAC,MAAM,CAAC,CAA2B;IAC1C,OAAO,CAAC,QAAQ,CAAC,CAA8B;;IAU/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAgC7B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAqEhC,2DAA2D;IACrD,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBrE,SAAS,CAAC,kBAAkB,IAAI,IAAI;CA4BrC"}
|
|
@@ -107,23 +107,21 @@ export class ActionCogCreate extends CommandLineAction {
|
|
|
107
107
|
async checkJobStatus(job, logger) {
|
|
108
108
|
const basePath = job.getJobPath();
|
|
109
109
|
const expectedTiffs = new Set();
|
|
110
|
+
const jobSize = job.output.files.length;
|
|
111
|
+
for (const file of job.output.files)
|
|
112
|
+
expectedTiffs.add(`${file.name}.tiff`);
|
|
110
113
|
for await (const fileName of fsa.list(basePath)) {
|
|
111
114
|
const basename = path.basename(fileName);
|
|
112
115
|
// Look for tile tiffs only
|
|
113
116
|
if (!basename.includes('-') || !basename.endsWith('.tiff'))
|
|
114
117
|
continue;
|
|
115
|
-
expectedTiffs.
|
|
116
|
-
}
|
|
117
|
-
const jobSize = job.output.files.length;
|
|
118
|
-
for (const file of job.output.files) {
|
|
119
|
-
if (expectedTiffs.has(`${file.name}.tiff`))
|
|
120
|
-
expectedTiffs.delete(`${file.name}.tiff`);
|
|
118
|
+
expectedTiffs.delete(basename);
|
|
121
119
|
}
|
|
122
120
|
if (expectedTiffs.size === 0) {
|
|
123
|
-
logger.info({ tiffCount: jobSize }, 'CogCreate:JobComplete');
|
|
121
|
+
logger.info({ tiffCount: jobSize, tiffTotal: jobSize }, 'CogCreate:JobComplete');
|
|
124
122
|
}
|
|
125
123
|
else {
|
|
126
|
-
logger.info({ tiffCount: jobSize,
|
|
124
|
+
logger.info({ tiffCount: jobSize, tiffRemaining: expectedTiffs.size }, 'CogCreate:JobProgress');
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
onDefineParameters() {
|
package/build/cli/util.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export declare function getStaticBucket(): Promise<string | null>;
|
|
|
13
13
|
* @param cacheControl cache control headers @example 'public, max-age=604800, immutable'
|
|
14
14
|
* @returns whether the item was updated
|
|
15
15
|
*/
|
|
16
|
-
export declare function uploadStaticFile(
|
|
16
|
+
export declare function uploadStaticFile(filePath: string, target: string, contentType: string, cacheControl: string): Promise<boolean>;
|
|
17
17
|
//# sourceMappingURL=util.d.ts.map
|
package/build/cli/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/cli/util.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BjF;AAED,eAAO,MAAM,OAAO,cAAc,CAAC;AAEnC,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQjF;AAOD,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ9D;AAMD;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CA6BlB"}
|
package/build/cli/util.js
CHANGED
|
@@ -4,6 +4,9 @@ import CloudFront from 'aws-sdk/clients/cloudfront.js';
|
|
|
4
4
|
import S3 from 'aws-sdk/clients/s3.js';
|
|
5
5
|
import { CliId } from './base.cli.js';
|
|
6
6
|
import crypto from 'crypto';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { gzip } from 'zlib';
|
|
9
|
+
import { promisify } from 'util';
|
|
7
10
|
// Cloudfront has to be defined in us-east-1
|
|
8
11
|
const cloudFormation = new CloudFormation({ region: 'us-east-1' });
|
|
9
12
|
const cloudFront = new CloudFront({ region: 'us-east-1' });
|
|
@@ -70,6 +73,9 @@ export async function getStaticBucket() {
|
|
|
70
73
|
staticBucket = (_d = bucket.OutputValue) !== null && _d !== void 0 ? _d : null;
|
|
71
74
|
return staticBucket;
|
|
72
75
|
}
|
|
76
|
+
/** Extensions that should be gzipped before uploading */
|
|
77
|
+
const CompressExt = new Set(['.js', '.html', '.css', '.map', '.json', '.svg']);
|
|
78
|
+
const gzipPromise = promisify(gzip);
|
|
73
79
|
/**
|
|
74
80
|
* Upload a file to the static bucket
|
|
75
81
|
* @param path source file
|
|
@@ -78,23 +84,30 @@ export async function getStaticBucket() {
|
|
|
78
84
|
* @param cacheControl cache control headers @example 'public, max-age=604800, immutable'
|
|
79
85
|
* @returns whether the item was updated
|
|
80
86
|
*/
|
|
81
|
-
export async function uploadStaticFile(
|
|
82
|
-
const fileData = await fsa.read(
|
|
87
|
+
export async function uploadStaticFile(filePath, target, contentType, cacheControl) {
|
|
88
|
+
const fileData = await fsa.read(filePath);
|
|
83
89
|
const hash = crypto.createHash('sha512').update(fileData).digest('base64');
|
|
90
|
+
// S3 keys should not start with a `/`
|
|
91
|
+
if (target.startsWith('/'))
|
|
92
|
+
target = target.slice(1);
|
|
84
93
|
const bucket = await getStaticBucket();
|
|
85
94
|
if (bucket == null)
|
|
86
95
|
throw new Error('Unable to find static bucket');
|
|
87
96
|
const existing = await getHash(bucket, target);
|
|
88
97
|
if (hash === existing)
|
|
89
98
|
return false;
|
|
99
|
+
// Should we compress the file before uploading
|
|
100
|
+
const ext = path.extname(target);
|
|
101
|
+
const contentEncoding = CompressExt.has(ext) ? 'gzip' : undefined;
|
|
90
102
|
await s3
|
|
91
103
|
.putObject({
|
|
92
104
|
Bucket: bucket,
|
|
93
105
|
Key: target,
|
|
94
|
-
Body: fileData,
|
|
106
|
+
Body: contentEncoding === 'gzip' ? await gzipPromise(fileData, { level: 9 }) : fileData,
|
|
95
107
|
Metadata: { [HashKey]: hash },
|
|
96
108
|
ContentType: contentType,
|
|
97
109
|
CacheControl: cacheControl,
|
|
110
|
+
ContentEncoding: contentEncoding,
|
|
98
111
|
})
|
|
99
112
|
.promise();
|
|
100
113
|
return true;
|
package/build/cog/builder.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Epsg, TileMatrixSet } from '@basemaps/geo';
|
|
|
2
2
|
import { LogType } from '@basemaps/shared';
|
|
3
3
|
import { ChunkSource } from '@chunkd/core';
|
|
4
4
|
import { CogTiff } from '@cogeotiff/core';
|
|
5
|
-
import
|
|
5
|
+
import { LimitFunction } from 'p-limit';
|
|
6
6
|
import { Cutline } from './cutline.js';
|
|
7
7
|
import { CogBuilderMetadata, SourceMetadata } from './types.js';
|
|
8
8
|
export declare const InvalidProjectionCode = 32767;
|
|
@@ -20,7 +20,7 @@ export declare const CacheFolder = "./.cache";
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function guessProjection(wkt: string | null): Epsg | null;
|
|
22
22
|
export declare class CogBuilder {
|
|
23
|
-
q:
|
|
23
|
+
q: LimitFunction;
|
|
24
24
|
logger: LogType;
|
|
25
25
|
targetTms: TileMatrixSet;
|
|
26
26
|
srcProj?: Epsg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/cog/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAyC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAuB,MAAM,iBAAiB,CAAC;AAG/D,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/cog/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAyC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAuB,MAAM,iBAAiB,CAAC;AAG/D,OAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAC3C,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,WAAW,aAAa,CAAC;AAEtC;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAO/D;AAED,qBAAa,UAAU;IACrB,CAAC,EAAE,aAAa,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,IAAI,CAAC;IAGf,kBAAkB,cAAqB;IAEvC;;OAEG;gBACS,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI;IAO1F;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAoF7D,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAuBnC;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI;IAaxC,wFAAwF;YAC1E,WAAW;IA2BzB;;;;OAIG;IACG,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAWjF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.16.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@basemaps/config": "^6.10.0",
|
|
42
42
|
"@basemaps/geo": "^6.10.0",
|
|
43
|
-
"@basemaps/shared": "^6.
|
|
43
|
+
"@basemaps/shared": "^6.16.1",
|
|
44
44
|
"@chunkd/fs": "^7.3.1",
|
|
45
45
|
"@cogeotiff/core": "^6.0.2",
|
|
46
46
|
"@linzjs/geojson": "^6.10.0",
|
|
47
47
|
"@rushstack/ts-command-line": "^4.3.13",
|
|
48
48
|
"ansi-colors": "^4.1.1",
|
|
49
|
-
"p-limit": "^
|
|
49
|
+
"p-limit": "^4.0.0",
|
|
50
50
|
"pretty-json-log": "^1.0.0",
|
|
51
51
|
"zod": "^3.2.0"
|
|
52
52
|
},
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"files": [
|
|
61
61
|
"build/"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "5859ec22302eac1126b887d6399656272b3611cb"
|
|
64
64
|
}
|