@basemaps/lambda-tiler 6.32.1 → 6.34.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/build/__tests__/xyz.util.d.ts +1 -1
  3. package/build/__tests__/xyz.util.d.ts.map +1 -1
  4. package/build/__tests__/xyz.util.js +2 -2
  5. package/build/__tests__/xyz.util.js.map +1 -1
  6. package/build/arcgis/__tests__/arcgis.style.json.test.d.ts +2 -0
  7. package/build/arcgis/__tests__/arcgis.style.json.test.d.ts.map +1 -0
  8. package/build/arcgis/__tests__/arcgis.style.json.test.js +128 -0
  9. package/build/arcgis/__tests__/arcgis.style.json.test.js.map +1 -0
  10. package/build/arcgis/__tests__/vector.tiler.server.test.d.ts +2 -0
  11. package/build/arcgis/__tests__/vector.tiler.server.test.d.ts.map +1 -0
  12. package/build/arcgis/__tests__/vector.tiler.server.test.js +47 -0
  13. package/build/arcgis/__tests__/vector.tiler.server.test.js.map +1 -0
  14. package/build/arcgis/arcgis.info.d.ts +3 -0
  15. package/build/arcgis/arcgis.info.d.ts.map +1 -0
  16. package/build/arcgis/arcgis.info.js +25 -0
  17. package/build/arcgis/arcgis.info.js.map +1 -0
  18. package/build/arcgis/arcgis.style.json.d.ts +9 -0
  19. package/build/arcgis/arcgis.style.json.d.ts.map +1 -0
  20. package/build/arcgis/arcgis.style.json.js +73 -0
  21. package/build/arcgis/arcgis.style.json.js.map +1 -0
  22. package/build/arcgis/vector.tile.server.d.ts +8 -0
  23. package/build/arcgis/vector.tile.server.d.ts.map +1 -0
  24. package/build/arcgis/vector.tile.server.js +71 -0
  25. package/build/arcgis/vector.tile.server.js.map +1 -0
  26. package/build/index.d.ts.map +1 -1
  27. package/build/index.js +22 -8
  28. package/build/index.js.map +1 -1
  29. package/build/routes/__tests__/fonts.test.js +14 -26
  30. package/build/routes/__tests__/fonts.test.js.map +1 -1
  31. package/build/routes/__tests__/sprites.test.js +7 -1
  32. package/build/routes/__tests__/sprites.test.js.map +1 -1
  33. package/build/routes/__tests__/xyz.test.js +1 -2
  34. package/build/routes/__tests__/xyz.test.js.map +1 -1
  35. package/build/routes/fonts.d.ts +0 -2
  36. package/build/routes/fonts.d.ts.map +1 -1
  37. package/build/routes/fonts.js +3 -66
  38. package/build/routes/fonts.js.map +1 -1
  39. package/build/routes/sprites.d.ts.map +1 -1
  40. package/build/routes/sprites.js +3 -29
  41. package/build/routes/sprites.js.map +1 -1
  42. package/build/routes/tile.xyz.vector.js +2 -2
  43. package/build/routes/tile.xyz.vector.js.map +1 -1
  44. package/build/util/assets.provider.d.ts +27 -0
  45. package/build/util/assets.provider.d.ts.map +1 -0
  46. package/build/util/assets.provider.js +56 -0
  47. package/build/util/assets.provider.js.map +1 -0
  48. package/build/util/config.cache.d.ts +16 -0
  49. package/build/util/config.cache.d.ts.map +1 -0
  50. package/build/util/config.cache.js +41 -0
  51. package/build/util/config.cache.js.map +1 -0
  52. package/build/util/response.d.ts +3 -1
  53. package/build/util/response.d.ts.map +1 -1
  54. package/build/util/response.js +2 -0
  55. package/build/util/response.js.map +1 -1
  56. package/build/util/source.cache.d.ts +1 -0
  57. package/build/util/source.cache.d.ts.map +1 -1
  58. package/build/util/source.cache.js +2 -1
  59. package/build/util/source.cache.js.map +1 -1
  60. package/build/util/swapping.lru.d.ts +1 -0
  61. package/build/util/swapping.lru.d.ts.map +1 -1
  62. package/build/util/swapping.lru.js +7 -0
  63. package/build/util/swapping.lru.js.map +1 -1
  64. package/build/util/validate.d.ts +0 -5
  65. package/build/util/validate.d.ts.map +1 -1
  66. package/build/util/validate.js +1 -23
  67. package/build/util/validate.js.map +1 -1
  68. package/dist/index.js +52 -52
  69. package/dist/node_modules/.package-lock.json +4 -4
  70. package/dist/node_modules/node-abi/abi_registry.json +8 -1
  71. package/dist/node_modules/node-abi/package.json +1 -1
  72. package/dist/package-lock.json +8 -8
  73. package/dist/package.json +1 -1
  74. package/package.json +4 -4
  75. package/src/__tests__/xyz.util.ts +7 -2
  76. package/src/arcgis/__tests__/arcgis.style.json.test.ts +153 -0
  77. package/src/arcgis/__tests__/vector.tiler.server.test.ts +61 -0
  78. package/src/arcgis/arcgis.info.ts +26 -0
  79. package/src/arcgis/arcgis.style.json.ts +81 -0
  80. package/src/arcgis/vector.tile.server.ts +78 -0
  81. package/src/index.ts +25 -8
  82. package/src/routes/__tests__/fonts.test.ts +14 -29
  83. package/src/routes/__tests__/sprites.test.ts +7 -2
  84. package/src/routes/__tests__/xyz.test.ts +2 -2
  85. package/src/routes/fonts.ts +4 -64
  86. package/src/routes/sprites.ts +4 -27
  87. package/src/routes/tile.xyz.vector.ts +2 -2
  88. package/src/util/assets.provider.ts +67 -0
  89. package/src/util/config.cache.ts +44 -0
  90. package/src/util/response.ts +4 -1
  91. package/src/util/source.cache.ts +2 -1
  92. package/src/util/swapping.lru.ts +7 -0
  93. package/src/util/validate.ts +1 -27
  94. package/tsconfig.json +1 -0
  95. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,55 @@
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.34.0](https://github.com/linz/basemaps/compare/v6.33.0...v6.34.0) (2022-08-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **lambda-tiler:** the min tile matrix zoom number ([#2404](https://github.com/linz/basemaps/issues/2404)) ([58b7d08](https://github.com/linz/basemaps/commit/58b7d087b38b86d126b3bea8c55187415cc7501a))
12
+
13
+
14
+ ### Features
15
+
16
+ * **lambda-tiler:** Assets provider to get assets from any location. ([#2374](https://github.com/linz/basemaps/issues/2374)) ([c145f28](https://github.com/linz/basemaps/commit/c145f283bf5875d5e7b15909cc37811b029303f4))
17
+ * **lambda-tiler:** Provide get info api and post tileserver api for arcgis BM-78 ([#2407](https://github.com/linz/basemaps/issues/2407)) ([d9b091b](https://github.com/linz/basemaps/commit/d9b091bf4e6fd2b91804a7b9bbcd388dd8b75ee8))
18
+ * **lambda-tiler:** Provide support for Arcgis online vector map. BM-78 ([#2403](https://github.com/linz/basemaps/issues/2403)) ([900a84e](https://github.com/linz/basemaps/commit/900a84e2b0275ae84fe327e9a91493f0aaa5c2e7))
19
+ * **lambda-tiler:** Some unit test for the arcgis api. BM-78 ([#2412](https://github.com/linz/basemaps/issues/2412)) ([67aff51](https://github.com/linz/basemaps/commit/67aff5179f8a64d7ca3fb52fed1e5cac93ba3736))
20
+
21
+
22
+
23
+
24
+
25
+ # [6.33.0](https://github.com/linz/basemaps/compare/v6.32.2...v6.33.0) (2022-08-01)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **lambda-analytics:** do not track invalid api keys BM-642 ([#2392](https://github.com/linz/basemaps/issues/2392)) ([9f84285](https://github.com/linz/basemaps/commit/9f84285ed203bf3443f288b20482cb18d6b13c40))
31
+ * **lambda-tiler:** lower cache amount to two 700MB caches ([#2394](https://github.com/linz/basemaps/issues/2394)) ([02bcc42](https://github.com/linz/basemaps/commit/02bcc4240b4301b82699423537ac684d28ba6420))
32
+ * **lambda-tiler:** Return 204 non content for empty 404 vector tile. ([#2391](https://github.com/linz/basemaps/issues/2391)) ([0d4373e](https://github.com/linz/basemaps/commit/0d4373e3a7f3c0f0880da52024e932f0dbcc0396))
33
+
34
+
35
+ ### Features
36
+
37
+ * **lambda-tiler:** count number of requests served ([#2387](https://github.com/linz/basemaps/issues/2387)) ([e94b613](https://github.com/linz/basemaps/commit/e94b613c1be0e3782ae2c3395b7eeadb14030145))
38
+
39
+
40
+
41
+
42
+
43
+ ## [6.32.2](https://github.com/linz/basemaps/compare/v6.32.1...v6.32.2) (2022-07-28)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * **lambda-tiler:** always include access-control-allow-origin ([#2385](https://github.com/linz/basemaps/issues/2385)) ([1edc2b6](https://github.com/linz/basemaps/commit/1edc2b6ccef295ad9c1b6ed32045f6d19827ba06))
49
+ * **lambda-tiler:** increase source cache to approx 1GB ([#2384](https://github.com/linz/basemaps/issues/2384)) ([83236fb](https://github.com/linz/basemaps/commit/83236fb4115f5190cbec1258f845449aa4406a03))
50
+
51
+
52
+
53
+
54
+
6
55
  ## [6.32.1](https://github.com/linz/basemaps/compare/v6.32.0...v6.32.1) (2022-07-28)
7
56
 
8
57
  **Note:** Version bump only for package @basemaps/lambda-tiler
@@ -1,6 +1,6 @@
1
1
  import { LambdaHttpRequest } from '@linzjs/lambda';
2
2
  export declare function mockRequest(path: string, method?: string, headers?: Record<string, string>): LambdaHttpRequest;
3
- export declare function mockUrlRequest(path: string, query?: string, headers?: Record<string, unknown>): LambdaHttpRequest;
3
+ export declare function mockUrlRequest(path: string, query?: string, headers?: Record<string, unknown>, method?: string): LambdaHttpRequest;
4
4
  export declare const Api: {
5
5
  key: string;
6
6
  header: {
@@ -1 +1 @@
1
- {"version":3,"file":"xyz.util.d.ts","sourceRoot":"","sources":["../../src/__tests__/xyz.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AAGvF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAQ,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,iBAAiB,CAajH;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,iBAAiB,CAYjH;AAED,eAAO,MAAM,GAAG;;;;;CAGf,CAAC"}
1
+ {"version":3,"file":"xyz.util.d.ts","sourceRoot":"","sources":["../../src/__tests__/xyz.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AAGvF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAQ,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,iBAAiB,CAajH;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,SAAK,EACV,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,MAAM,CAAC,EAAE,MAAM,GACd,iBAAiB,CAYnB;AAED,eAAO,MAAM,GAAG;;;;;CAGf,CAAC"}
@@ -10,9 +10,9 @@ export function mockRequest(path, method = 'get', headers = {}) {
10
10
  isBase64Encoded: false,
11
11
  }, {}, LogConfig.get());
12
12
  }
13
- export function mockUrlRequest(path, query = '', headers = {}) {
13
+ export function mockUrlRequest(path, query = '', headers = {}, method) {
14
14
  return new LambdaUrlRequest({
15
- requestContext: { http: { method: 'GET' } },
15
+ requestContext: { http: { method: method ? method.toUpperCase() : 'GET' } },
16
16
  headers,
17
17
  rawPath: encodeURI(path),
18
18
  rawQueryString: query,
@@ -1 +1 @@
1
- {"version":3,"file":"xyz.util.js","sourceRoot":"","sources":["../../src/__tests__/xyz.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAqB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvF,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,MAAM,GAAG,KAAK,EAAE,UAAkC,EAAE;IAC5F,OAAO,IAAI,gBAAgB,CACzB;QACE,cAAc,EAAE,IAAW;QAC3B,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE;QAChC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC;QACrB,OAAO;QACP,IAAI,EAAE,IAAI;QACV,eAAe,EAAE,KAAK;KACvB,EACD,EAAa,EACb,SAAS,CAAC,GAAG,EAAE,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAK,GAAG,EAAE,EAAE,UAAmC,EAAE;IAC5F,OAAO,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SAAS,CAAC,IAAI,CAAC;QACxB,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,KAAK;KAChB,EACR,EAAa,EACb,SAAS,CAAC,GAAG,EAAE,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,GAAG,EAAE,6BAA6B;IAClC,MAAM,EAAE,EAAE,gBAAgB,EAAE,6BAA6B,EAAE;CAC5D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=arcgis.style.json.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis.style.json.test.d.ts","sourceRoot":"","sources":["../../../src/arcgis/__tests__/arcgis.style.json.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,128 @@
1
+ import { Config } from '@basemaps/config';
2
+ import { Env } from '@basemaps/shared';
3
+ import o from 'ospec';
4
+ import { createSandbox } from 'sinon';
5
+ import { handler } from '../../index.js';
6
+ import { FakeData } from '../../__tests__/config.data.js';
7
+ import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
8
+ o.spec('v1/arcgis/rest/services/', () => {
9
+ const host = 'https://tiles.test';
10
+ const sandbox = createSandbox();
11
+ o.before(() => {
12
+ process.env[Env.PublicUrlBase] = host;
13
+ });
14
+ o.afterEach(() => sandbox.restore());
15
+ o('should not found tile set', async () => {
16
+ const request = mockRequest('/v1/arcgis/rest/services/topographic/VectorTileServer/root.json', 'get', Api.header);
17
+ sandbox.stub(Config.TileSet, 'get').resolves(null);
18
+ const res = await handler.router.handle(request);
19
+ o(res.status).equals(404);
20
+ });
21
+ o('should not found style', async () => {
22
+ const request = mockRequest('/v1/arcgis/rest/services/topographic/VectorTileServer/root.json', 'get', Api.header);
23
+ sandbox.stub(Config.TileSet, 'get').resolves(FakeData.tileSetVector('topographic'));
24
+ sandbox.stub(Config.Style, 'get').resolves(null);
25
+ const res = await handler.router.handle(request);
26
+ o(res.status).equals(404);
27
+ });
28
+ const fakeStyle = {
29
+ version: 8,
30
+ id: 'test',
31
+ name: 'topographic',
32
+ sources: {
33
+ basemaps_vector: {
34
+ type: 'vector',
35
+ url: `/vector`,
36
+ },
37
+ basemaps_raster: {
38
+ type: 'raster',
39
+ tiles: [`/raster`],
40
+ },
41
+ },
42
+ layers: [
43
+ {
44
+ source: 'basemaps_vector',
45
+ layout: {
46
+ visibility: 'visible',
47
+ },
48
+ paint: {
49
+ 'background-color': 'rgba(206, 229, 242, 1)',
50
+ },
51
+ id: 'Background-vector',
52
+ type: 'background',
53
+ minzoom: 0,
54
+ },
55
+ {
56
+ source: 'basemaps_raster',
57
+ layout: {
58
+ visibility: 'visible',
59
+ },
60
+ paint: {
61
+ 'background-color': 'rgba(222, 229, 132, 1)',
62
+ },
63
+ id: 'Background-raster',
64
+ type: 'background',
65
+ minzoom: 0,
66
+ },
67
+ ],
68
+ glyphs: '/glyphs',
69
+ sprite: '/sprite',
70
+ metadata: { id: 'test' },
71
+ };
72
+ const fakeRecord = {
73
+ id: 'st_topographic',
74
+ name: 'topographic',
75
+ style: fakeStyle,
76
+ };
77
+ o('should serve style json and remove the raster source and layers, then replace the vector url', async () => {
78
+ var _a;
79
+ const request = mockRequest('/v1/arcgis/rest/services/topographic/VectorTileServer/root.json', 'get', Api.header);
80
+ sandbox.stub(Config.TileSet, 'get').resolves(FakeData.tileSetVector('topographic'));
81
+ sandbox.stub(Config.Style, 'get').resolves(fakeRecord);
82
+ const res = await handler.router.handle(request);
83
+ o(res.status).equals(200);
84
+ o(res.header('content-type')).equals('application/json');
85
+ o(res.header('cache-control')).equals('no-store');
86
+ const body = Buffer.from((_a = res.body) !== null && _a !== void 0 ? _a : '', 'base64').toString();
87
+ fakeStyle.sources.basemaps_vector = {
88
+ type: 'vector',
89
+ url: `${host}/v1/arcgis/rest/services/topographic/VectorTileServer?api=${Api.key}&f=json`,
90
+ };
91
+ delete fakeStyle.sources.basemaps_raster;
92
+ fakeStyle.layers = [fakeStyle.layers[0]];
93
+ fakeStyle.sprite = `${host}/sprite`;
94
+ fakeStyle.glyphs = `${host}/glyphs`;
95
+ o(JSON.parse(body)).deepEquals(fakeStyle);
96
+ });
97
+ o('should not found for raster tileset', async () => {
98
+ const request = mockRequest('/v1/arcgis/rest/services/raster/VectorTileServer/root.json', 'get', Api.header);
99
+ sandbox.stub(Config.TileSet, 'get').resolves(FakeData.tileSetRaster('raster'));
100
+ sandbox.stub(Config.Style, 'get').resolves(fakeRecord);
101
+ const res = await handler.router.handle(request);
102
+ o(res.status).equals(404);
103
+ });
104
+ o('should fine the new style with url query', async () => {
105
+ var _a;
106
+ const request = mockUrlRequest('/v1/arcgis/rest/services/topographic/VectorTileServer/root.json', 'style=topolite', Api.header);
107
+ sandbox.stub(Config.TileSet, 'get').resolves(FakeData.tileSetVector('topographic'));
108
+ sandbox
109
+ .stub(Config.Style, 'get')
110
+ .withArgs('st_topolite')
111
+ .resolves(fakeRecord);
112
+ const res = await handler.router.handle(request);
113
+ o(res.status).equals(200);
114
+ o(res.header('content-type')).equals('application/json');
115
+ o(res.header('cache-control')).equals('no-store');
116
+ const body = Buffer.from((_a = res.body) !== null && _a !== void 0 ? _a : '', 'base64').toString();
117
+ fakeStyle.sources.basemaps_vector = {
118
+ type: 'vector',
119
+ url: `${host}/v1/arcgis/rest/services/topographic/VectorTileServer?api=${Api.key}&f=json`,
120
+ };
121
+ delete fakeStyle.sources.basemaps_raster;
122
+ fakeStyle.layers = [fakeStyle.layers[0]];
123
+ fakeStyle.sprite = `${host}/sprite`;
124
+ fakeStyle.glyphs = `${host}/glyphs`;
125
+ o(JSON.parse(body)).deepEquals(fakeStyle);
126
+ });
127
+ });
128
+ //# sourceMappingURL=arcgis.style.json.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis.style.json.test.js","sourceRoot":"","sources":["../../../src/arcgis/__tests__/arcgis.style.json.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAC;AACrD,OAA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arcgis/__tests__/vector.tiler.server.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ import { Config } from '@basemaps/config';
2
+ import { Env } from '@basemaps/shared';
3
+ import o from 'ospec';
4
+ import { createSandbox } from 'sinon';
5
+ import { handler } from '../../index.js';
6
+ import { FakeData } from '../../__tests__/config.data.js';
7
+ import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
8
+ o.spec('v1/arcgis/rest/services/', () => {
9
+ const host = 'https://tiles.test';
10
+ const sandbox = createSandbox();
11
+ o.before(() => {
12
+ process.env[Env.PublicUrlBase] = host;
13
+ });
14
+ o.afterEach(() => sandbox.restore());
15
+ o('should not found tile set', async () => {
16
+ const request = mockUrlRequest('/v1/arcgis/rest/services/topographic/VectorTileServer', 'f=json', Api.header);
17
+ sandbox.stub(Config.TileSet, 'get').resolves(null);
18
+ const res = await handler.router.handle(request);
19
+ o(res.status).equals(404);
20
+ });
21
+ o('should return the vector tile server', async () => {
22
+ var _a;
23
+ const request = mockUrlRequest('/v1/arcgis/rest/services/topographic/VectorTileServer', 'f=json', Api.header);
24
+ sandbox.stub(Config.TileSet, 'get').resolves(FakeData.tileSetVector('topographic'));
25
+ const res = await handler.router.handle(request);
26
+ o(res.status).equals(200);
27
+ o(res.header('content-type')).equals('application/json');
28
+ o(res.header('cache-control')).equals('no-store');
29
+ const body = JSON.parse(Buffer.from((_a = res.body) !== null && _a !== void 0 ? _a : '', 'base64').toString());
30
+ o(body.tiles[0]).equals(`${host}/v1/tiles/topographic/WebMercatorQuad/{z}/{x}/{y}.pbf?api=${Api.key}`);
31
+ o(body.tileInfo.lods.length).equals(17);
32
+ });
33
+ o('should not return with no f=json query', async () => {
34
+ const request = mockRequest('/v1/arcgis/rest/services/topographic/VectorTileServer', 'get', Api.header);
35
+ sandbox.stub(Config.TileSet, 'get').resolves(FakeData.tileSetVector('topographic'));
36
+ const res = await handler.router.handle(request);
37
+ o(res.status).equals(404);
38
+ });
39
+ o('should return ok for post request', async () => {
40
+ const request = mockUrlRequest('/v1/arcgis/rest/services/topographic/VectorTileServer', 'f=json', Api.header, 'POST');
41
+ sandbox.stub(Config.TileSet, 'get').resolves(FakeData.tileSetVector('topographic'));
42
+ const res = await handler.router.handle(request);
43
+ o(res.status).equals(200);
44
+ o(res.body).deepEquals(`{"id":"${request.id}","correlationId":"${request.correlationId}","message":"ok"}`);
45
+ });
46
+ });
47
+ //# sourceMappingURL=vector.tiler.server.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector.tiler.server.test.js","sourceRoot":"","sources":["../../../src/arcgis/__tests__/vector.tiler.server.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE/E,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACtC,MAAM,IAAI,GAAG,oBAAoB,CAAC;IAClC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAEhC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;QACZ,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,OAAO,GAAG,cAAc,CAAC,uDAAuD,EAAE,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CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
2
+ export declare function arcgisInfoGet(req: LambdaHttpRequest): Promise<LambdaHttpResponse>;
3
+ //# sourceMappingURL=arcgis.info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis.info.d.ts","sourceRoot":"","sources":["../../src/arcgis/arcgis.info.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAInF,wBAAsB,aAAa,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAoBvF"}
@@ -0,0 +1,25 @@
1
+ import { Env } from '@basemaps/shared';
2
+ import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
3
+ import { Etag } from '../util/etag.js';
4
+ import { NotFound, NotModified } from '../util/response.js';
5
+ export async function arcgisInfoGet(req) {
6
+ const host = Env.get(Env.PublicUrlBase);
7
+ if (host == null)
8
+ return NotFound();
9
+ const info = {
10
+ currentVersion: 10.1,
11
+ fullVersion: '10.1',
12
+ owningSystemUrl: host,
13
+ };
14
+ const json = JSON.stringify(info);
15
+ const data = Buffer.from(json);
16
+ const cacheKey = Etag.key(data);
17
+ if (Etag.isNotModified(req, cacheKey))
18
+ return NotModified();
19
+ const response = new LambdaHttpResponse(200, 'ok');
20
+ response.header(HttpHeader.CacheControl, 'public, max-age=604800, stale-while-revalidate=86400');
21
+ response.buffer(data, 'application/json');
22
+ req.set('bytes', data.byteLength);
23
+ return response;
24
+ }
25
+ //# sourceMappingURL=arcgis.info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis.info.js","sourceRoot":"","sources":["../../src/arcgis/arcgis.info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAqB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAsB;IACxD,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACxC,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,QAAQ,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG;QACX,cAAc,EAAE,IAAI;QACpB,WAAW,EAAE,MAAM;QACnB,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC;QAAE,OAAO,WAAW,EAAE,CAAC;IAE5D,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,sDAAsD,CAAC,CAAC;IACjG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAC1C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
2
+ interface StyleGet {
3
+ Params: {
4
+ tileSet: string;
5
+ };
6
+ }
7
+ export declare function arcgisStyleJsonGet(req: LambdaHttpRequest<StyleGet>): Promise<LambdaHttpResponse>;
8
+ export {};
9
+ //# sourceMappingURL=arcgis.style.json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis.style.json.d.ts","sourceRoot":"","sources":["../../src/arcgis/arcgis.style.json.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAMnF,UAAU,QAAQ;IAChB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AA0CD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA0BtG"}
@@ -0,0 +1,73 @@
1
+ import { Config, TileSetType } from '@basemaps/config';
2
+ import { Env, fsa } from '@basemaps/shared';
3
+ import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
4
+ import { convertRelativeUrl } from '../routes/tile.style.json.js';
5
+ import { Etag } from '../util/etag.js';
6
+ import { NotFound, NotModified } from '../util/response.js';
7
+ import { Validate } from '../util/validate.js';
8
+ function tileserverUrl(tileSet, apiKey) {
9
+ var _a;
10
+ const host = (_a = Env.get(Env.PublicUrlBase)) !== null && _a !== void 0 ? _a : '';
11
+ const url = `/v1/arcgis/rest/services/${tileSet}/VectorTileServer`;
12
+ const fullUrl = new URL(fsa.join(host, url));
13
+ fullUrl.searchParams.set('api', apiKey);
14
+ fullUrl.searchParams.set('f', 'json');
15
+ return fullUrl.toString().replace(/%7B/g, '{').replace(/%7D/g, '}');
16
+ }
17
+ function convertStyleJson(tileSet, style, apiKey) {
18
+ var _a;
19
+ const sources = JSON.parse(JSON.stringify(style.sources));
20
+ // Only keep the vector layer and update the source url
21
+ for (const [key, value] of Object.entries(sources)) {
22
+ if (value.type === 'vector') {
23
+ value.url = tileserverUrl(tileSet, apiKey);
24
+ sources[key] = value;
25
+ }
26
+ else {
27
+ delete sources[key];
28
+ }
29
+ }
30
+ // Remove all the not vector layers.
31
+ const layers = [];
32
+ for (const layer of style.layers) {
33
+ if (layer.source != null && !sources.hasOwnProperty(layer.source))
34
+ continue;
35
+ layers.push(layer);
36
+ }
37
+ return {
38
+ version: 8,
39
+ id: style.id,
40
+ name: style.name,
41
+ sources,
42
+ layers,
43
+ metadata: (_a = style.metadata) !== null && _a !== void 0 ? _a : {},
44
+ glyphs: convertRelativeUrl(style.glyphs),
45
+ sprite: convertRelativeUrl(style.sprite),
46
+ };
47
+ }
48
+ export async function arcgisStyleJsonGet(req) {
49
+ const apiKey = Validate.apiKey(req);
50
+ const tileSet = await Config.TileSet.get(Config.TileSet.id(req.params.tileSet));
51
+ if ((tileSet === null || tileSet === void 0 ? void 0 : tileSet.type) !== TileSetType.Vector)
52
+ return NotFound();
53
+ const style = req.query.get('style');
54
+ const styleName = style ? style : 'topographic'; // Defalut to topographic style
55
+ // Get style Config from db
56
+ const dbId = Config.Style.id(styleName);
57
+ const styleConfig = await Config.Style.get(dbId);
58
+ if (styleConfig == null)
59
+ return NotFound();
60
+ // Prepare sources and add linz source
61
+ const styleJson = convertStyleJson(tileSet.name, styleConfig.style, apiKey);
62
+ const data = Buffer.from(JSON.stringify(styleJson));
63
+ const cacheKey = Etag.key(data);
64
+ if (Etag.isNotModified(req, cacheKey))
65
+ return NotModified();
66
+ const response = new LambdaHttpResponse(200, 'ok');
67
+ response.header(HttpHeader.ETag, cacheKey);
68
+ response.header(HttpHeader.CacheControl, 'no-store');
69
+ response.buffer(data, 'application/json');
70
+ req.set('bytes', data.byteLength);
71
+ return response;
72
+ }
73
+ //# sourceMappingURL=arcgis.style.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis.style.json.js","sourceRoot":"","sources":["../../src/arcgis/arcgis.style.json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,k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 };
6
+ }
7
+ export declare function arcgisTileServerGet(req: LambdaHttpRequest<VectorTileServer>): Promise<LambdaHttpResponse>;
8
+ //# sourceMappingURL=vector.tile.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector.tile.server.d.ts","sourceRoot":"","sources":["../../src/arcgis/vector.tile.server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AASnF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA4D/G"}
@@ -0,0 +1,71 @@
1
+ import { Config, TileSetType } from '@basemaps/config';
2
+ import { GoogleTms } from '@basemaps/geo';
3
+ import { HttpHeader, LambdaHttpResponse } from '@linzjs/lambda';
4
+ import { convertRelativeUrl } from '../routes/tile.style.json.js';
5
+ import { NotFound } from '../util/response.js';
6
+ import { Validate } from '../util/validate.js';
7
+ /** Zoom level for the tilematrix which will be slice by 1 during the covertion to arcgis tileserve lods */
8
+ const MaxTileMatrixZoom = 18;
9
+ const MinTileMatrixZoom = 1;
10
+ export async function arcgisTileServerGet(req) {
11
+ const tileSet = await Config.TileSet.get(Config.TileSet.id(req.params.tileSet));
12
+ if ((tileSet === null || tileSet === void 0 ? void 0 : tileSet.type) !== TileSetType.Vector)
13
+ return NotFound();
14
+ const apiKey = Validate.apiKey(req);
15
+ const f = req.query.get('f');
16
+ if (f !== 'json')
17
+ return NotFound();
18
+ const extent = {
19
+ xmin: GoogleTms.extent.x,
20
+ ymin: GoogleTms.extent.y,
21
+ xmax: GoogleTms.extent.right,
22
+ ymax: GoogleTms.extent.bottom,
23
+ // TODO where is wkid from
24
+ spatialReference: { wkid: 102100, latestWkid: GoogleTms.projection.code },
25
+ };
26
+ const vectorTileServer = {
27
+ currentVersion: 10.81,
28
+ name: tileSet.name,
29
+ capabilities: 'TilesOnly',
30
+ type: 'indexedVector',
31
+ defaultStyles: '',
32
+ tiles: [convertRelativeUrl(`/v1/tiles/${tileSet.name}/WebMercatorQuad/{z}/{x}/{y}.pbf`, apiKey)],
33
+ exportTilesAllowed: false,
34
+ maxExportTilesCount: 0,
35
+ initialExtent: extent,
36
+ fullExtent: extent,
37
+ minScale: 0.0,
38
+ maxScale: 0.0,
39
+ tileInfo: {
40
+ rows: 512,
41
+ cols: 512,
42
+ dpi: 96,
43
+ format: 'pbf',
44
+ origin: { x: GoogleTms.extent.x, y: GoogleTms.extent.bottom },
45
+ spatialReference: { wkid: 102100, latestWkid: GoogleTms.projection.code },
46
+ lods: GoogleTms.zooms.slice(MinTileMatrixZoom, MaxTileMatrixZoom).map((c, i) => {
47
+ return {
48
+ level: i,
49
+ resolution: c.scaleDenominator * 0.28e-3,
50
+ scale: c.scaleDenominator,
51
+ };
52
+ }),
53
+ },
54
+ maxzoom: 22,
55
+ minLOD: 0,
56
+ maxLOD: 15,
57
+ resourceInfo: {
58
+ styleVersion: 8,
59
+ tileCompression: 'gzip',
60
+ cacheInfo: { storageInfo: { packetSize: 128, storageFormat: 'compactV2' } },
61
+ },
62
+ };
63
+ const json = JSON.stringify(vectorTileServer, null, 2);
64
+ const data = Buffer.from(json);
65
+ const response = new LambdaHttpResponse(200, 'ok');
66
+ response.header(HttpHeader.CacheControl, 'no-store');
67
+ response.buffer(data, 'application/json');
68
+ req.set('bytes', data.byteLength);
69
+ return response;
70
+ }
71
+ //# sourceMappingURL=vector.tile.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector.tile.server.js","sourceRoot":"","sources":["../../src/arcgis/vector.tile.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAA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C;IAEF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACrD,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAC1C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,OAAO;;CAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,OAAO;;CAA2B,CAAC"}
package/build/index.js CHANGED
@@ -1,5 +1,8 @@
1
- import { LogConfig } from '@basemaps/shared';
2
- import { LambdaHttpResponse, LambdaUrlRequest, lf } from '@linzjs/lambda';
1
+ import { Env, LogConfig } from '@basemaps/shared';
2
+ import { LambdaHttpResponse, lf } from '@linzjs/lambda';
3
+ import { arcgisInfoGet } from './arcgis/arcgis.info.js';
4
+ import { arcgisStyleJsonGet } from './arcgis/arcgis.style.json.js';
5
+ import { arcgisTileServerGet } from './arcgis/vector.tile.server.js';
3
6
  import { tileAttributionGet } from './routes/attribution.js';
4
7
  import { fontGet, fontList } from './routes/fonts.js';
5
8
  import { healthGet } from './routes/health.js';
@@ -11,16 +14,23 @@ import { styleJsonGet } from './routes/tile.style.json.js';
11
14
  import { wmtsCapabilitiesGet } from './routes/tile.wmts.js';
12
15
  import { tileXyzGet } from './routes/tile.xyz.js';
13
16
  import { versionGet } from './routes/version.js';
14
- import { NotFound } from './util/response.js';
17
+ import { assetProvider } from './util/assets.provider.js';
18
+ import { NotFound, OkResponse } from './util/response.js';
15
19
  import { CoSources } from './util/source.cache.js';
16
20
  import { St } from './util/source.tracer.js';
17
21
  export const handler = lf.http(LogConfig.get());
18
22
  handler.router.hook('request', (req) => {
19
23
  req.set('name', 'LambdaTiler');
24
+ // Set the asset location for asset provider
25
+ const assetLocation = Env.get(Env.AssetLocation);
26
+ assetProvider.set(assetLocation);
20
27
  // Reset the request tracing before every request
21
28
  St.reset();
22
29
  });
30
+ let totalRequests = 0;
23
31
  handler.router.hook('response', (req, res) => {
32
+ totalRequests++;
33
+ req.set('requestsTotal', totalRequests); // Number of requests served by this lambda
24
34
  if (St.requests.length > 0) {
25
35
  // TODO this could be relaxed to every say 5% of requests if logging gets too verbose.
26
36
  req.set('requests', St.requests.slice(0, 100)); // limit to 100 requests (some tiles need 100s of requests)
@@ -32,15 +42,14 @@ handler.router.hook('response', (req, res) => {
32
42
  misses: CoSources.cache.misses,
33
43
  size: CoSources.cache.currentSize,
34
44
  resets: CoSources.cache.resets,
45
+ clears: CoSources.cache.clears,
35
46
  cacheA: CoSources.cache.cacheA.size,
36
47
  cacheB: CoSources.cache.cacheB.size,
37
48
  });
38
- // FunctionURLs automatically inject CORS responses for us
39
- if (!(req instanceof LambdaUrlRequest) && req.headers.has('origin')) {
40
- res.header('access-control-allow-origin', '*');
41
- }
49
+ // Force access-control-allow-origin to everything
50
+ res.header('access-control-allow-origin', '*');
42
51
  });
43
- // CORS is handled by function url hook so just return ok if the route exists
52
+ // CORS is handled by response hook so just return ok if the route exists
44
53
  handler.router.options('*', (req) => {
45
54
  const route = handler.router.router.find('GET', req.path);
46
55
  if (route == null)
@@ -76,4 +85,9 @@ handler.router.get('/v1/attribution/:tileSet/:tileMatrix/summary.json', tileAttr
76
85
  handler.router.get('/v1/tiles/:tileSet/:tileMatrix/WMTSCapabilities.xml', wmtsCapabilitiesGet);
77
86
  handler.router.get('/v1/tiles/:tileSet/WMTSCapabilities.xml', wmtsCapabilitiesGet);
78
87
  handler.router.get('/v1/tiles/WMTSCapabilities.xml', wmtsCapabilitiesGet);
88
+ // Arcgis Vector
89
+ handler.router.get('/v1/arcgis/rest/services/:tileSet/VectorTileServer', arcgisTileServerGet);
90
+ handler.router.post('/v1/arcgis/rest/services/:tileSet/VectorTileServer', OkResponse);
91
+ handler.router.get('/v1/arcgis/rest/services/:tileSet/VectorTileServer/root.json', arcgisStyleJsonGet);
92
+ handler.router.get('/v1/arcgis/rest/info', arcgisInfoGet);
79
93
  //# sourceMappingURL=index.js.map