@basemaps/cli 7.0.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/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 -10
- 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 +0 -6
- 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 +2 -2
- package/build/cli/util.js +38 -37
- package/build/cli/util.js.map +1 -1
- package/package.json +20 -19
- package/CHANGELOG.md +0 -1612
- package/build/cli/__tests__/util.test.d.ts.map +0 -1
- package/build/cli/bin.d.ts.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.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/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 -19
- package/build/cli/overview/action.create.overview.d.ts.map +0 -1
- package/build/cli/overview/action.create.overview.js +0 -178
- 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/util.d.ts.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/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
|
@@ -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,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;QAClC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAA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C;QACxC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,eAAe,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,aAAqB,EAAE,MAAe;QACvE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,mBAAmB,CAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,EAAE,EAAE;YAC3D,aAAa,EAAE,CAAC,GAAG,OAAO,GAAG,GAAG;YAChC,SAAS,EAAE,SAAS;SACrB,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,EAAE,qBAAqB,CAAC,CAAC;QACrG,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QACzE,MAAM,SAAS,CAAC,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({
|
|
@@ -27,19 +52,24 @@ export class CommandBundle extends CommandLineAction {
|
|
|
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',
|
|
59
|
+
});
|
|
30
60
|
}
|
|
31
61
|
async onExecute() {
|
|
32
|
-
var _a, _b;
|
|
33
62
|
const logger = LogConfig.get();
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
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;
|
|
37
70
|
const configJson = mem.toJson();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
configJson.assets = assets;
|
|
41
|
-
await fsa.writeJson(bundle, configJson);
|
|
42
|
-
logger.info({ path: bundle }, 'ConfigBundled');
|
|
71
|
+
await fsa.write(outputUrl, JSON.stringify(configJson));
|
|
72
|
+
logger.info({ path: outputUrl }, 'ConfigBundled');
|
|
43
73
|
return;
|
|
44
74
|
}
|
|
45
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,O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AK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,aAAa,CAAC,CAAC;QAChE,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7F,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;QACrB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK;YAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QACtD,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,eAAe,CAAC,CAAC;QAClD,OAAO;IACT,CAAC;CACF"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { BaseConfig, BasemapsConfigProvider, 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 { FeatureCollection } from 'geojson';
|
|
5
|
-
import { CogJobJson } from '@basemaps/shared';
|
|
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, CogJobJson>;
|
|
53
|
-
_loadJob(path: string): Promise<CogJobJson | 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
|