@basemaps/cli 6.22.0 → 6.22.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 CHANGED
@@ -3,6 +3,17 @@
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.22.1](https://github.com/linz/basemaps/compare/v6.22.0...v6.22.1) (2022-03-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cli:** allow unicode job names ([#2126](https://github.com/linz/basemaps/issues/2126)) ([bab5cef](https://github.com/linz/basemaps/commit/bab5cefdc8365cb52bf687230a078ea599c359ce))
12
+
13
+
14
+
15
+
16
+
6
17
  # [6.22.0](https://github.com/linz/basemaps/compare/v6.21.1...v6.22.0) (2022-03-20)
7
18
 
8
19
 
@@ -1,5 +1,5 @@
1
1
  import o from 'ospec';
2
- import { extractResolutionFromName } from '../action.batch.js';
2
+ import { ActionBatchJob, extractResolutionFromName } from '../action.batch.js';
3
3
  o.spec('action.batch', () => {
4
4
  o('extractResolutionFromName', () => {
5
5
  o(extractResolutionFromName('2013')).equals(-1);
@@ -10,4 +10,14 @@ o.spec('action.batch', () => {
10
10
  o(extractResolutionFromName('wellington_urban_2017_1.00m')).equals(1000);
11
11
  o(extractResolutionFromName('wellington_urban_2017_0.025m')).equals(25);
12
12
  });
13
+ o('should create valid jobNames', () => {
14
+ const fakeJob = { id: '01FHRPYJ5FV1XAARZAC4T4K6MC', name: 'geographx_nz_texture_shade_2012_8-0m' };
15
+ o(ActionBatchJob.id(fakeJob, '0')).equals('01FHRPYJ5FV1XAARZAC4T4K6MC-9af5e139bbb3e502-0');
16
+ fakeJob.name = 'ōtorohanga_urban_2021_0.1m_RGB';
17
+ o(ActionBatchJob.id(fakeJob, '0')).equals('01FHRPYJ5FV1XAARZAC4T4K6MC-5294acface81c107-0');
18
+ });
19
+ o('should truncate job names to 128 characters', () => {
20
+ const fakeJob = { id: '01FHRPYJ5FV1XAARZAC4T4K6MC', name: 'geographx_nz_texture_shade_2012_8-0m' };
21
+ o(ActionBatchJob.id(fakeJob, 'this is a really long file name it should over flow 128 characters so it should be truncated at some point.tiff')).equals('01FHRPYJ5FV1XAARZAC4T4K6MC-9af5e139bbb3e502-this is a really long file name it should over flow 128 characters so it should be t');
22
+ });
13
23
  });
@@ -14,7 +14,15 @@ export declare class ActionBatchJob extends CommandLineAction {
14
14
  private commit?;
15
15
  private oneCog?;
16
16
  constructor();
17
- static id(job: CogJob, name: string): string;
17
+ /**
18
+ * Create a id for a job
19
+ *
20
+ * This needs to be within `[a-Z_-]` upto 128 characters log
21
+ * @param job job to process
22
+ * @param fileName output filename
23
+ * @returns job id
24
+ */
25
+ static id(job: CogJob, fileName: string): string;
18
26
  static batchOne(jobPath: string, job: CogJob, batch: Batch, name: string, isCommit: boolean): Promise<{
19
27
  jobName: string;
20
28
  jobId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"action.batch.d.ts","sourceRoot":"","sources":["../../../src/cli/cogify/action.batch.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAwD,MAAM,4BAA4B,CAAC;AACrH,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAS5C;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,OAAO,CAAC,GAAG,CAAC,CAA6B;IACzC,OAAO,CAAC,MAAM,CAAC,CAA2B;IAC1C,OAAO,CAAC,MAAM,CAAC,CAA6B;;IAU5C,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;WAI/B,QAAQ,CACnB,OAAO,EAAE,MAA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f,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IA6B9D;;;OAGG;WACU,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAqBrE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;WAanB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,qBAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAyD9G,SAAS,CAAC,kBAAkB,IAAI,IAAI;CAqBrC"}
@@ -2,6 +2,7 @@ import { TileMatrixSet } from '@basemaps/geo';
2
2
  import { Env, fsa, LogConfig, Projection } from '@basemaps/shared';
3
3
  import { CommandLineAction } from '@rushstack/ts-command-line';
4
4
  import Batch from 'aws-sdk/clients/batch.js';
5
+ import { createHash } from 'crypto';
5
6
  import { CogStacJob } from '../../cog/cog.stac.job.js';
6
7
  const JobQueue = 'CogBatchJobQueue';
7
8
  const JobDefinition = 'CogBatchJob';
@@ -28,8 +29,18 @@ export class ActionBatchJob extends CommandLineAction {
28
29
  documentation: 'Submit a list of cogs to a AWS Batch queue to be process',
29
30
  });
30
31
  }
31
- static id(job, name) {
32
- return `${job.id}-${job.name}-${name}`;
32
+ /**
33
+ * Create a id for a job
34
+ *
35
+ * This needs to be within `[a-Z_-]` upto 128 characters log
36
+ * @param job job to process
37
+ * @param fileName output filename
38
+ * @returns job id
39
+ */
40
+ static id(job, fileName) {
41
+ // Job names are uncontrolled so hash the name and grab a small slice to use as a identifier
42
+ const jobName = createHash('sha256').update(job.name).digest('hex').slice(0, 16);
43
+ return `${job.id}-${jobName}-${fileName}`.slice(0, 128);
33
44
  }
34
45
  static async batchOne(jobPath, job, batch, name, isCommit) {
35
46
  const jobName = ActionBatchJob.id(job, name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basemaps/cli",
3
- "version": "6.22.0",
3
+ "version": "6.22.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,5 +59,5 @@
59
59
  "files": [
60
60
  "build/"
61
61
  ],
62
- "gitHead": "b85a4a628bcdfea657a37de97faa23dde5c34798"
62
+ "gitHead": "3190b6a49a91b3220b429a736484a93f3b76c721"
63
63
  }