@basemaps/lambda-tiler 8.0.0 → 8.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/CHANGELOG.md +11 -0
- package/build/__tests__/index.test.js +24 -2
- package/build/__tests__/index.test.js.map +1 -1
- package/build/routes/version.d.ts +2 -2
- package/build/routes/version.js +17 -1
- package/build/routes/version.js.map +1 -1
- package/dist/index.js +31 -7
- package/dist/node_modules/.package-lock.json +4 -4
- package/dist/node_modules/semver/bin/semver.js +2 -0
- package/dist/node_modules/semver/classes/comparator.js +2 -0
- package/dist/node_modules/semver/classes/index.js +2 -0
- package/dist/node_modules/semver/classes/range.js +2 -0
- package/dist/node_modules/semver/classes/semver.js +4 -3
- package/dist/node_modules/semver/functions/clean.js +2 -0
- package/dist/node_modules/semver/functions/cmp.js +2 -0
- package/dist/node_modules/semver/functions/coerce.js +2 -0
- package/dist/node_modules/semver/functions/compare-build.js +2 -0
- package/dist/node_modules/semver/functions/compare-loose.js +2 -0
- package/dist/node_modules/semver/functions/compare.js +2 -0
- package/dist/node_modules/semver/functions/diff.js +2 -0
- package/dist/node_modules/semver/functions/eq.js +2 -0
- package/dist/node_modules/semver/functions/gt.js +2 -0
- package/dist/node_modules/semver/functions/gte.js +2 -0
- package/dist/node_modules/semver/functions/inc.js +2 -0
- package/dist/node_modules/semver/functions/lt.js +2 -0
- package/dist/node_modules/semver/functions/lte.js +2 -0
- package/dist/node_modules/semver/functions/major.js +2 -0
- package/dist/node_modules/semver/functions/minor.js +2 -0
- package/dist/node_modules/semver/functions/neq.js +2 -0
- package/dist/node_modules/semver/functions/parse.js +2 -0
- package/dist/node_modules/semver/functions/patch.js +2 -0
- package/dist/node_modules/semver/functions/prerelease.js +2 -0
- package/dist/node_modules/semver/functions/rcompare.js +2 -0
- package/dist/node_modules/semver/functions/rsort.js +2 -0
- package/dist/node_modules/semver/functions/satisfies.js +2 -0
- package/dist/node_modules/semver/functions/sort.js +2 -0
- package/dist/node_modules/semver/functions/valid.js +2 -0
- package/dist/node_modules/semver/index.js +2 -0
- package/dist/node_modules/semver/internal/constants.js +2 -0
- package/dist/node_modules/semver/internal/debug.js +2 -0
- package/dist/node_modules/semver/internal/identifiers.js +2 -0
- package/dist/node_modules/semver/internal/lrucache.js +2 -0
- package/dist/node_modules/semver/internal/parse-options.js +2 -0
- package/dist/node_modules/semver/internal/re.js +8 -4
- package/dist/node_modules/semver/package.json +3 -3
- package/dist/node_modules/semver/preload.js +2 -0
- package/dist/node_modules/semver/ranges/gtr.js +2 -0
- package/dist/node_modules/semver/ranges/intersects.js +2 -0
- package/dist/node_modules/semver/ranges/ltr.js +2 -0
- package/dist/node_modules/semver/ranges/max-satisfying.js +2 -0
- package/dist/node_modules/semver/ranges/min-satisfying.js +2 -0
- package/dist/node_modules/semver/ranges/min-version.js +2 -0
- package/dist/node_modules/semver/ranges/outside.js +2 -0
- package/dist/node_modules/semver/ranges/simplify.js +2 -0
- package/dist/node_modules/semver/ranges/subset.js +2 -0
- package/dist/node_modules/semver/ranges/to-comparators.js +2 -0
- package/dist/node_modules/semver/ranges/valid.js +2 -0
- package/dist/package-lock.json +5 -5
- package/dist/package.json +1 -1
- package/package.json +6 -6
- package/src/__tests__/index.test.ts +30 -2
- package/src/routes/version.ts +22 -2
- package/tsconfig.tsbuildinfo +1 -1
package/dist/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/lambda-tiler",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@basemaps/lambda-tiler",
|
|
9
|
-
"version": "8.
|
|
9
|
+
"version": "8.1.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lerc": "4.0.4",
|
|
@@ -539,9 +539,9 @@
|
|
|
539
539
|
"license": "Apache-2.0"
|
|
540
540
|
},
|
|
541
541
|
"node_modules/semver": {
|
|
542
|
-
"version": "7.7.
|
|
543
|
-
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.
|
|
544
|
-
"integrity": "sha512-
|
|
542
|
+
"version": "7.7.2",
|
|
543
|
+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
|
|
544
|
+
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
|
|
545
545
|
"license": "ISC",
|
|
546
546
|
"bin": {
|
|
547
547
|
"semver": "bin/semver.js"
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basemaps/lambda-tiler",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/linz/basemaps.git",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"types": "./build/index.d.ts",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@basemaps/config": "^8.
|
|
26
|
-
"@basemaps/config-loader": "^8.
|
|
25
|
+
"@basemaps/config": "^8.1.0",
|
|
26
|
+
"@basemaps/config-loader": "^8.1.0",
|
|
27
27
|
"@basemaps/geo": "^8.0.0",
|
|
28
|
-
"@basemaps/shared": "^8.
|
|
28
|
+
"@basemaps/shared": "^8.1.0",
|
|
29
29
|
"@basemaps/tiler": "^8.0.0",
|
|
30
|
-
"@basemaps/tiler-sharp": "^8.
|
|
30
|
+
"@basemaps/tiler-sharp": "^8.1.0",
|
|
31
31
|
"@linzjs/geojson": "^8.0.0",
|
|
32
32
|
"@linzjs/lambda": "^4.0.0",
|
|
33
33
|
"@mapbox/vector-tile": "^2.0.3",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"@types/pixelmatch": "^5.0.0",
|
|
57
57
|
"pretty-json-log": "^1.0.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "14a4364d39e226b7ed0396fee9c3adc534d1142b"
|
|
60
60
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { afterEach, describe, it } from 'node:test';
|
|
3
3
|
|
|
4
|
+
import { ConfigProviderMemory } from '@basemaps/config';
|
|
5
|
+
|
|
4
6
|
import { handler } from '../index.js';
|
|
7
|
+
import { ConfigLoader } from '../util/config.loader.js';
|
|
5
8
|
import { mockRequest } from './xyz.util.js';
|
|
6
9
|
|
|
7
10
|
describe('LambdaXyz index', () => {
|
|
@@ -17,7 +20,10 @@ describe('LambdaXyz index', () => {
|
|
|
17
20
|
delete process.env['BUILD_ID'];
|
|
18
21
|
});
|
|
19
22
|
|
|
20
|
-
it('should return version', async () => {
|
|
23
|
+
it('should return version', async (t) => {
|
|
24
|
+
const config = new ConfigProviderMemory();
|
|
25
|
+
t.mock.method(ConfigLoader, 'getDefaultConfig', () => config);
|
|
26
|
+
|
|
21
27
|
process.env['GIT_VERSION'] = '1.2.3';
|
|
22
28
|
process.env['GIT_HASH'] = 'abc456';
|
|
23
29
|
|
|
@@ -32,7 +38,10 @@ describe('LambdaXyz index', () => {
|
|
|
32
38
|
});
|
|
33
39
|
});
|
|
34
40
|
|
|
35
|
-
it('should include buildId if exists', async () => {
|
|
41
|
+
it('should include buildId if exists', async (t) => {
|
|
42
|
+
const config = new ConfigProviderMemory();
|
|
43
|
+
t.mock.method(ConfigLoader, 'getDefaultConfig', () => config);
|
|
44
|
+
|
|
36
45
|
process.env['GIT_VERSION'] = '1.2.3';
|
|
37
46
|
process.env['BUILD_ID'] = '1658821493-3';
|
|
38
47
|
|
|
@@ -46,6 +55,25 @@ describe('LambdaXyz index', () => {
|
|
|
46
55
|
buildId: '1658821493-3',
|
|
47
56
|
});
|
|
48
57
|
});
|
|
58
|
+
|
|
59
|
+
it('should return config information if present', async (t) => {
|
|
60
|
+
const config = new ConfigProviderMemory();
|
|
61
|
+
t.mock.method(ConfigLoader, 'getDefaultConfig', () => config);
|
|
62
|
+
config.id = 'config-id';
|
|
63
|
+
|
|
64
|
+
const response = await handler.router.handle(mockRequest('/v1/version'));
|
|
65
|
+
assert.deepEqual(JSON.parse(response.body), {
|
|
66
|
+
version: 'dev',
|
|
67
|
+
config: { id: 'config-id' },
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
config.hash = 'config-hash';
|
|
71
|
+
const responseHash = await handler.router.handle(mockRequest('/v1/version'));
|
|
72
|
+
assert.deepEqual(JSON.parse(responseHash.body), {
|
|
73
|
+
version: 'dev',
|
|
74
|
+
config: { id: 'config-id', hash: 'config-hash' },
|
|
75
|
+
});
|
|
76
|
+
});
|
|
49
77
|
});
|
|
50
78
|
|
|
51
79
|
it('should respond to /ping', async () => {
|
package/src/routes/version.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BasemapsConfigProvider, ConfigProviderMemory } from '@basemaps/config';
|
|
2
|
+
import { HttpHeader, LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
import { ConfigLoader } from '../util/config.loader.js';
|
|
5
|
+
|
|
6
|
+
function getConfigHash(cfg: BasemapsConfigProvider): { id: string; hash?: string } | undefined {
|
|
7
|
+
if (!ConfigProviderMemory.is(cfg)) return undefined;
|
|
8
|
+
if (cfg.id == null) return undefined;
|
|
9
|
+
return { id: cfg.id, hash: cfg.hash };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function versionGet(req: LambdaHttpRequest): Promise<LambdaHttpResponse> {
|
|
13
|
+
const config = await ConfigLoader.load(req);
|
|
4
14
|
const response = new LambdaHttpResponse(200, 'ok');
|
|
5
15
|
response.header(HttpHeader.CacheControl, 'no-store');
|
|
6
16
|
response.json({
|
|
@@ -9,16 +19,26 @@ export function versionGet(): Promise<LambdaHttpResponse> {
|
|
|
9
19
|
* @example "v6.42.1"
|
|
10
20
|
*/
|
|
11
21
|
version: process.env['GIT_VERSION'] ?? 'dev',
|
|
22
|
+
|
|
12
23
|
/**
|
|
13
24
|
* Full git commit hash
|
|
14
25
|
* @example "e4231b1ee62c276c8657c56677ced02681dfe5d6"
|
|
15
26
|
*/
|
|
16
27
|
hash: process.env['GIT_HASH'],
|
|
28
|
+
|
|
17
29
|
/**
|
|
30
|
+
*
|
|
18
31
|
* The exact build that this release was run from
|
|
19
32
|
* @example "1658821493-3"
|
|
20
33
|
*/
|
|
21
34
|
buildId: process.env['BUILD_ID'],
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Configuration id that was used to power this config
|
|
38
|
+
* @example { "id": "cb_01JTQ7ZK49F8EY4N5DRJ3XFT73", hash: "HcByZ8WS2zpaTxFJp6wSKg2eUpwahLqAGEQdcDxKxqp6" }
|
|
39
|
+
*/
|
|
40
|
+
config: getConfigHash(config),
|
|
22
41
|
});
|
|
42
|
+
|
|
23
43
|
return Promise.resolve(response);
|
|
24
44
|
}
|