@basemaps/lambda-tiler 7.0.0 → 7.1.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.
Files changed (242) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/build/__tests__/config.data.d.ts +0 -1
  3. package/build/__tests__/config.data.js +2 -6
  4. package/build/__tests__/config.data.js.map +1 -1
  5. package/build/__tests__/index.test.d.ts +0 -1
  6. package/build/__tests__/index.test.js +28 -27
  7. package/build/__tests__/index.test.js.map +1 -1
  8. package/build/__tests__/tile.style.json.test.d.ts +0 -1
  9. package/build/__tests__/tile.style.json.test.js +38 -37
  10. package/build/__tests__/tile.style.json.test.js.map +1 -1
  11. package/build/__tests__/wmts.capability.test.d.ts +0 -1
  12. package/build/__tests__/wmts.capability.test.js +111 -122
  13. package/build/__tests__/wmts.capability.test.js.map +1 -1
  14. package/build/__tests__/xyz.util.d.ts +0 -1
  15. package/build/cli/render.preview.d.ts +0 -1
  16. package/build/cli/render.preview.js +13 -9
  17. package/build/cli/render.preview.js.map +1 -1
  18. package/build/cli/render.tile.d.ts +0 -1
  19. package/build/cli/render.tile.js +25 -17
  20. package/build/cli/render.tile.js.map +1 -1
  21. package/build/index.d.ts +0 -1
  22. package/build/index.js +24 -20
  23. package/build/index.js.map +1 -1
  24. package/build/routes/__tests__/attribution.test.d.ts +0 -1
  25. package/build/routes/__tests__/attribution.test.js +38 -37
  26. package/build/routes/__tests__/attribution.test.js.map +1 -1
  27. package/build/routes/__tests__/fonts.test.d.ts +0 -1
  28. package/build/routes/__tests__/fonts.test.js +61 -63
  29. package/build/routes/__tests__/fonts.test.js.map +1 -1
  30. package/build/routes/__tests__/health.test.d.ts +0 -1
  31. package/build/routes/__tests__/health.test.js +16 -16
  32. package/build/routes/__tests__/health.test.js.map +1 -1
  33. package/build/routes/__tests__/imagery.test.d.ts +0 -1
  34. package/build/routes/__tests__/imagery.test.js +10 -9
  35. package/build/routes/__tests__/imagery.test.js.map +1 -1
  36. package/build/routes/__tests__/memory.fs.d.ts +2 -3
  37. package/build/routes/__tests__/preview.index.test.d.ts +0 -1
  38. package/build/routes/__tests__/preview.index.test.js +88 -42
  39. package/build/routes/__tests__/preview.index.test.js.map +1 -1
  40. package/build/routes/__tests__/sprites.test.d.ts +0 -1
  41. package/build/routes/__tests__/sprites.test.js +34 -34
  42. package/build/routes/__tests__/sprites.test.js.map +1 -1
  43. package/build/routes/__tests__/tile.json.test.d.ts +0 -1
  44. package/build/routes/__tests__/tile.json.test.js +45 -51
  45. package/build/routes/__tests__/tile.json.test.js.map +1 -1
  46. package/build/routes/__tests__/tile.style.json.test.d.ts +0 -1
  47. package/build/routes/__tests__/tile.style.json.test.js +49 -50
  48. package/build/routes/__tests__/tile.style.json.test.js.map +1 -1
  49. package/build/routes/__tests__/wmts.test.d.ts +0 -1
  50. package/build/routes/__tests__/wmts.test.js +27 -20
  51. package/build/routes/__tests__/wmts.test.js.map +1 -1
  52. package/build/routes/__tests__/xyz.test.d.ts +0 -1
  53. package/build/routes/__tests__/xyz.test.js +97 -49
  54. package/build/routes/__tests__/xyz.test.js.map +1 -1
  55. package/build/routes/attribution.d.ts +1 -1
  56. package/build/routes/attribution.js +4 -5
  57. package/build/routes/attribution.js.map +1 -1
  58. package/build/routes/config.d.ts +0 -1
  59. package/build/routes/config.js +1 -2
  60. package/build/routes/config.js.map +1 -1
  61. package/build/routes/fonts.d.ts +0 -1
  62. package/build/routes/fonts.js +2 -3
  63. package/build/routes/fonts.js.map +1 -1
  64. package/build/routes/health.d.ts +1 -2
  65. package/build/routes/health.js +5 -15
  66. package/build/routes/health.js.map +1 -1
  67. package/build/routes/imagery.d.ts +0 -1
  68. package/build/routes/imagery.js +1 -1
  69. package/build/routes/imagery.js.map +1 -1
  70. package/build/routes/ping.d.ts +0 -1
  71. package/build/routes/ping.js +1 -1
  72. package/build/routes/ping.js.map +1 -1
  73. package/build/routes/preview.d.ts +6 -5
  74. package/build/routes/preview.index.d.ts +0 -1
  75. package/build/routes/preview.index.js +6 -5
  76. package/build/routes/preview.index.js.map +1 -1
  77. package/build/routes/preview.js +35 -10
  78. package/build/routes/preview.js.map +1 -1
  79. package/build/routes/sprites.d.ts +0 -1
  80. package/build/routes/sprites.js +2 -4
  81. package/build/routes/sprites.js.map +1 -1
  82. package/build/routes/tile.json.d.ts +0 -1
  83. package/build/routes/tile.json.js +10 -5
  84. package/build/routes/tile.json.js.map +1 -1
  85. package/build/routes/tile.style.json.d.ts +1 -1
  86. package/build/routes/tile.style.json.js +79 -16
  87. package/build/routes/tile.style.json.js.map +1 -1
  88. package/build/routes/tile.wmts.d.ts +0 -1
  89. package/build/routes/tile.wmts.js +8 -9
  90. package/build/routes/tile.wmts.js.map +1 -1
  91. package/build/routes/tile.xyz.d.ts +0 -1
  92. package/build/routes/tile.xyz.js.map +1 -1
  93. package/build/routes/tile.xyz.raster.d.ts +7 -8
  94. package/build/routes/tile.xyz.raster.js +22 -15
  95. package/build/routes/tile.xyz.raster.js.map +1 -1
  96. package/build/routes/tile.xyz.vector.d.ts +0 -1
  97. package/build/routes/tile.xyz.vector.js +4 -3
  98. package/build/routes/tile.xyz.vector.js.map +1 -1
  99. package/build/routes/version.d.ts +0 -1
  100. package/build/routes/version.js +3 -4
  101. package/build/routes/version.js.map +1 -1
  102. package/build/util/__test__/config.loader.test.d.ts +0 -1
  103. package/build/util/__test__/config.loader.test.js +35 -34
  104. package/build/util/__test__/config.loader.test.js.map +1 -1
  105. package/build/util/__test__/filter.test.d.ts +0 -1
  106. package/build/util/__test__/filter.test.js +17 -16
  107. package/build/util/__test__/filter.test.js.map +1 -1
  108. package/build/util/__test__/validate.test.d.ts +0 -1
  109. package/build/util/__test__/validate.test.js +26 -43
  110. package/build/util/__test__/validate.test.js.map +1 -1
  111. package/build/util/assets.provider.d.ts +5 -5
  112. package/build/util/assets.provider.js +8 -8
  113. package/build/util/assets.provider.js.map +1 -1
  114. package/build/util/config.cache.d.ts +2 -2
  115. package/build/util/config.cache.js +14 -3
  116. package/build/util/config.cache.js.map +1 -1
  117. package/build/util/config.loader.d.ts +0 -1
  118. package/build/util/config.loader.js +11 -12
  119. package/build/util/config.loader.js.map +1 -1
  120. package/build/util/cotar.serve.d.ts +3 -3
  121. package/build/util/cotar.serve.js +2 -2
  122. package/build/util/cotar.serve.js.map +1 -1
  123. package/build/util/etag.d.ts +0 -1
  124. package/build/util/etag.js.map +1 -1
  125. package/build/util/filter.d.ts +0 -1
  126. package/build/util/filter.js +4 -5
  127. package/build/util/filter.js.map +1 -1
  128. package/build/util/response.d.ts +0 -1
  129. package/build/util/source.cache.d.ts +8 -9
  130. package/build/util/source.cache.js +27 -24
  131. package/build/util/source.cache.js.map +1 -1
  132. package/build/util/swapping.lru.d.ts +0 -1
  133. package/build/util/swapping.lru.js +48 -7
  134. package/build/util/swapping.lru.js.map +1 -1
  135. package/build/util/validate.d.ts +17 -5
  136. package/build/util/validate.js +51 -15
  137. package/build/util/validate.js.map +1 -1
  138. package/build/wmts.capability.d.ts +1 -2
  139. package/build/wmts.capability.js +81 -12
  140. package/build/wmts.capability.js.map +1 -1
  141. package/bundle.sh +2 -2
  142. package/package.json +16 -18
  143. package/scripts/create.deployment.package.mjs +4 -11
  144. package/src/__tests__/config.data.ts +2 -6
  145. package/src/__tests__/index.test.ts +29 -27
  146. package/src/__tests__/tile.style.json.test.ts +40 -37
  147. package/src/__tests__/wmts.capability.test.ts +139 -120
  148. package/src/cli/render.preview.ts +14 -9
  149. package/src/cli/render.tile.ts +27 -18
  150. package/src/index.ts +28 -23
  151. package/src/routes/__tests__/attribution.test.ts +40 -37
  152. package/src/routes/__tests__/fonts.test.ts +68 -64
  153. package/src/routes/__tests__/health.test.ts +18 -17
  154. package/src/routes/__tests__/imagery.test.ts +11 -9
  155. package/src/routes/__tests__/preview.index.test.ts +114 -40
  156. package/src/routes/__tests__/sprites.test.ts +39 -34
  157. package/src/routes/__tests__/tile.json.test.ts +41 -39
  158. package/src/routes/__tests__/tile.style.json.test.ts +49 -46
  159. package/src/routes/__tests__/wmts.test.ts +28 -20
  160. package/src/routes/__tests__/xyz.test.ts +134 -55
  161. package/src/routes/attribution.ts +2 -2
  162. package/src/routes/config.ts +1 -0
  163. package/src/routes/fonts.ts +3 -3
  164. package/src/routes/health.ts +7 -13
  165. package/src/routes/imagery.ts +2 -1
  166. package/src/routes/ping.ts +1 -1
  167. package/src/routes/preview.index.ts +9 -5
  168. package/src/routes/preview.ts +44 -15
  169. package/src/routes/sprites.ts +4 -5
  170. package/src/routes/tile.json.ts +9 -2
  171. package/src/routes/tile.style.json.ts +89 -13
  172. package/src/routes/tile.wmts.ts +4 -3
  173. package/src/routes/tile.xyz.raster.ts +30 -23
  174. package/src/routes/tile.xyz.ts +1 -0
  175. package/src/routes/tile.xyz.vector.ts +5 -3
  176. package/src/routes/version.ts +3 -3
  177. package/src/util/__test__/config.loader.test.ts +38 -34
  178. package/src/util/__test__/filter.test.ts +19 -16
  179. package/src/util/__test__/validate.test.ts +28 -43
  180. package/src/util/assets.provider.ts +10 -9
  181. package/src/util/config.cache.ts +4 -3
  182. package/src/util/config.loader.ts +13 -13
  183. package/src/util/cotar.serve.ts +3 -2
  184. package/src/util/source.cache.ts +15 -26
  185. package/src/util/validate.ts +61 -14
  186. package/src/wmts.capability.ts +3 -3
  187. package/tsconfig.json +1 -0
  188. package/tsconfig.tsbuildinfo +1 -1
  189. package/build/__tests__/config.data.d.ts.map +0 -1
  190. package/build/__tests__/index.test.d.ts.map +0 -1
  191. package/build/__tests__/tile.style.json.test.d.ts.map +0 -1
  192. package/build/__tests__/wmts.capability.test.d.ts.map +0 -1
  193. package/build/__tests__/xyz.util.d.ts.map +0 -1
  194. package/build/cli/render.preview.d.ts.map +0 -1
  195. package/build/cli/render.tile.d.ts.map +0 -1
  196. package/build/index.d.ts.map +0 -1
  197. package/build/routes/__tests__/attribution.test.d.ts.map +0 -1
  198. package/build/routes/__tests__/fonts.test.d.ts.map +0 -1
  199. package/build/routes/__tests__/health.test.d.ts.map +0 -1
  200. package/build/routes/__tests__/imagery.test.d.ts.map +0 -1
  201. package/build/routes/__tests__/memory.fs.d.ts.map +0 -1
  202. package/build/routes/__tests__/preview.index.test.d.ts.map +0 -1
  203. package/build/routes/__tests__/sprites.test.d.ts.map +0 -1
  204. package/build/routes/__tests__/tile.json.test.d.ts.map +0 -1
  205. package/build/routes/__tests__/tile.style.json.test.d.ts.map +0 -1
  206. package/build/routes/__tests__/wmts.test.d.ts.map +0 -1
  207. package/build/routes/__tests__/xyz.test.d.ts.map +0 -1
  208. package/build/routes/attribution.d.ts.map +0 -1
  209. package/build/routes/config.d.ts.map +0 -1
  210. package/build/routes/fonts.d.ts.map +0 -1
  211. package/build/routes/health.d.ts.map +0 -1
  212. package/build/routes/imagery.d.ts.map +0 -1
  213. package/build/routes/ping.d.ts.map +0 -1
  214. package/build/routes/preview.d.ts.map +0 -1
  215. package/build/routes/preview.index.d.ts.map +0 -1
  216. package/build/routes/sprites.d.ts.map +0 -1
  217. package/build/routes/tile.json.d.ts.map +0 -1
  218. package/build/routes/tile.style.json.d.ts.map +0 -1
  219. package/build/routes/tile.wmts.d.ts.map +0 -1
  220. package/build/routes/tile.xyz.d.ts.map +0 -1
  221. package/build/routes/tile.xyz.raster.d.ts.map +0 -1
  222. package/build/routes/tile.xyz.vector.d.ts.map +0 -1
  223. package/build/routes/version.d.ts.map +0 -1
  224. package/build/util/__test__/config.loader.test.d.ts.map +0 -1
  225. package/build/util/__test__/filter.test.d.ts.map +0 -1
  226. package/build/util/__test__/validate.test.d.ts.map +0 -1
  227. package/build/util/assets.provider.d.ts.map +0 -1
  228. package/build/util/config.cache.d.ts.map +0 -1
  229. package/build/util/config.loader.d.ts.map +0 -1
  230. package/build/util/cotar.serve.d.ts.map +0 -1
  231. package/build/util/etag.d.ts.map +0 -1
  232. package/build/util/filter.d.ts.map +0 -1
  233. package/build/util/response.d.ts.map +0 -1
  234. package/build/util/source.cache.d.ts.map +0 -1
  235. package/build/util/source.tracer.d.ts +0 -18
  236. package/build/util/source.tracer.d.ts.map +0 -1
  237. package/build/util/source.tracer.js +0 -26
  238. package/build/util/source.tracer.js.map +0 -1
  239. package/build/util/swapping.lru.d.ts.map +0 -1
  240. package/build/util/validate.d.ts.map +0 -1
  241. package/build/wmts.capability.d.ts.map +0 -1
  242. package/src/util/source.tracer.ts +0 -38
@@ -1,31 +1,34 @@
1
+ import assert from 'node:assert';
2
+ import { afterEach, before, beforeEach, describe, it } from 'node:test';
3
+
1
4
  import { ConfigProviderMemory, StyleJson } from '@basemaps/config';
2
5
  import { Env } from '@basemaps/shared';
3
- import o from 'ospec';
4
6
  import { createSandbox } from 'sinon';
5
- import { handler } from '../../index.js';
6
- import { ConfigLoader } from '../../util/config.loader.js';
7
+
7
8
  import { FakeData } from '../../__tests__/config.data.js';
8
9
  import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
10
+ import { handler } from '../../index.js';
11
+ import { ConfigLoader } from '../../util/config.loader.js';
9
12
 
10
- o.spec('/v1/styles', () => {
13
+ describe('/v1/styles', () => {
11
14
  const host = 'https://tiles.test';
12
15
  const config = new ConfigProviderMemory();
13
16
  const sandbox = createSandbox();
14
17
 
15
- o.before(() => {
18
+ before(() => {
16
19
  process.env[Env.PublicUrlBase] = host;
17
20
  });
18
- o.beforeEach(() => {
21
+ beforeEach(() => {
19
22
  sandbox.stub(ConfigLoader, 'getDefaultConfig').resolves(config);
20
23
  });
21
- o.afterEach(() => {
24
+ afterEach(() => {
22
25
  sandbox.restore();
23
26
  config.objects.clear();
24
27
  });
25
- o('should not found style json', async () => {
28
+ it('should not found style json', async () => {
26
29
  const request = mockRequest('/v1/tiles/topographic/Google/style/topographic.json', 'get', Api.header);
27
30
  const res = await handler.router.handle(request);
28
- o(res.status).equals(404);
31
+ assert.equal(res.status, 404);
29
32
  });
30
33
 
31
34
  const fakeStyle: StyleJson = {
@@ -100,26 +103,26 @@ o.spec('/v1/styles', () => {
100
103
  style: fakeStyle,
101
104
  };
102
105
 
103
- o('should serve style json', async () => {
106
+ it('should serve style json', async () => {
104
107
  config.put(fakeRecord);
105
108
 
106
109
  const request = mockRequest('/v1/tiles/topographic/Google/style/topographic.json', 'get', Api.header);
107
110
 
108
111
  const res = await handler.router.handle(request);
109
- o(res.status).equals(200);
110
- o(res.header('content-type')).equals('application/json');
111
- o(res.header('cache-control')).equals('no-store');
112
+ assert.equal(res.status, 200, res.statusDescription);
113
+ assert.equal(res.header('content-type'), 'application/json');
114
+ assert.equal(res.header('cache-control'), 'no-store');
112
115
 
113
116
  const body = Buffer.from(res.body ?? '', 'base64').toString();
114
- fakeStyle.sources.basemaps_vector = {
117
+ fakeStyle.sources['basemaps_vector'] = {
115
118
  type: 'vector',
116
119
  url: `${host}/vector?api=${Api.key}`,
117
120
  };
118
- fakeStyle.sources.basemaps_raster = {
121
+ fakeStyle.sources['basemaps_raster'] = {
119
122
  type: 'raster',
120
123
  tiles: [`${host}/raster?api=${Api.key}`],
121
124
  };
122
- fakeStyle.sources.basemaps_raster_encode = {
125
+ fakeStyle.sources['basemaps_raster_encode'] = {
123
126
  type: 'raster',
124
127
  tiles: [`${host}/raster/{z}/{x}/{y}.webp?api=${Api.key}`],
125
128
  };
@@ -127,10 +130,10 @@ o.spec('/v1/styles', () => {
127
130
  fakeStyle.sprite = `${host}/sprite`;
128
131
  fakeStyle.glyphs = `${host}/glyphs`;
129
132
 
130
- o(JSON.parse(body)).deepEquals(fakeStyle);
133
+ assert.deepEqual(JSON.parse(body), fakeStyle);
131
134
  });
132
135
 
133
- o('should serve style json with excluded layers', async () => {
136
+ it('should serve style json with excluded layers', async () => {
134
137
  config.put(fakeRecord);
135
138
  const request = mockUrlRequest(
136
139
  '/v1/tiles/topographic/Google/style/topographic.json',
@@ -139,20 +142,20 @@ o.spec('/v1/styles', () => {
139
142
  );
140
143
 
141
144
  const res = await handler.router.handle(request);
142
- o(res.status).equals(200);
143
- o(res.header('content-type')).equals('application/json');
144
- o(res.header('cache-control')).equals('no-store');
145
+ assert.equal(res.status, 200, res.statusDescription);
146
+ assert.equal(res.header('content-type'), 'application/json');
147
+ assert.equal(res.header('cache-control'), 'no-store');
145
148
 
146
149
  const body = Buffer.from(res.body ?? '', 'base64').toString();
147
- fakeStyle.sources.basemaps_vector = {
150
+ fakeStyle.sources['basemaps_vector'] = {
148
151
  type: 'vector',
149
152
  url: `${host}/vector?api=${Api.key}`,
150
153
  };
151
- fakeStyle.sources.basemaps_raster = {
154
+ fakeStyle.sources['basemaps_raster'] = {
152
155
  type: 'raster',
153
156
  tiles: [`${host}/raster?api=${Api.key}`],
154
157
  };
155
- fakeStyle.sources.basemaps_raster_encode = {
158
+ fakeStyle.sources['basemaps_raster_encode'] = {
156
159
  type: 'raster',
157
160
  tiles: [`${host}/raster/{z}/{x}/{y}.webp?api=${Api.key}`],
158
161
  };
@@ -161,60 +164,60 @@ o.spec('/v1/styles', () => {
161
164
  fakeStyle.glyphs = `${host}/glyphs`;
162
165
  fakeStyle.layers = [fakeStyle.layers[2]];
163
166
 
164
- o(JSON.parse(body)).deepEquals(fakeStyle);
167
+ assert.deepEqual(JSON.parse(body), fakeStyle);
165
168
  });
166
169
 
167
- o('should create raster styles', async () => {
170
+ it('should create raster styles', async () => {
168
171
  const request = mockUrlRequest('/v1/styles/aerial.json', '', Api.header);
169
172
  const tileSet = FakeData.tileSetRaster('aerial');
170
173
  config.put(tileSet);
171
174
  const res = await handler.router.handle(request);
172
- o(res.status).equals(200);
175
+ assert.equal(res.status, 200, res.statusDescription);
173
176
 
174
177
  const body = JSON.parse(Buffer.from(res.body, 'base64').toString());
175
178
 
176
- o(body.version).equals(8);
177
- o(body.sources['basemaps-aerial'].type).deepEquals('raster');
178
- o(body.sources['basemaps-aerial'].tiles).deepEquals([
179
+ assert.equal(body.version, 8);
180
+ assert.deepEqual(body.sources['basemaps-aerial'].type, 'raster');
181
+ assert.deepEqual(body.sources['basemaps-aerial'].tiles, [
179
182
  `https://tiles.test/v1/tiles/aerial/WebMercatorQuad/{z}/{x}/{y}.webp?api=${Api.key}`,
180
183
  ]);
181
- o(body.sources['basemaps-aerial'].tileSize).deepEquals(256);
182
- o(body.layers).deepEquals([{ id: 'basemaps-aerial', type: 'raster', source: 'basemaps-aerial' }]);
184
+ assert.deepEqual(body.sources['basemaps-aerial'].tileSize, 256);
185
+ assert.deepEqual(body.layers, [{ id: 'basemaps-aerial', type: 'raster', source: 'basemaps-aerial' }]);
183
186
  });
184
187
 
185
- o('should support parameters', async () => {
188
+ it('should support parameters', async () => {
186
189
  const request = mockUrlRequest('/v1/styles/aerial.json', '?tileMatrix=NZTM2000Quad&format=jpg', Api.header);
187
190
  const tileSet = FakeData.tileSetRaster('aerial');
188
191
  config.put(tileSet);
189
192
  const res = await handler.router.handle(request);
190
- o(res.status).equals(200);
193
+ assert.equal(res.status, 200, res.statusDescription);
191
194
 
192
195
  const body = JSON.parse(Buffer.from(res.body, 'base64').toString());
193
196
 
194
- o(body.version).equals(8);
195
- o(body.sources['basemaps-aerial'].type).deepEquals('raster');
196
- o(body.sources['basemaps-aerial'].tiles).deepEquals([
197
+ assert.equal(body.version, 8);
198
+ assert.deepEqual(body.sources['basemaps-aerial'].type, 'raster');
199
+ assert.deepEqual(body.sources['basemaps-aerial'].tiles, [
197
200
  `https://tiles.test/v1/tiles/aerial/NZTM2000Quad/{z}/{x}/{y}.jpeg?api=${Api.key}`,
198
201
  ]);
199
- o(body.sources['basemaps-aerial'].tileSize).deepEquals(256);
200
- o(body.layers).deepEquals([{ id: 'basemaps-aerial', type: 'raster', source: 'basemaps-aerial' }]);
202
+ assert.deepEqual(body.sources['basemaps-aerial'].tileSize, 256);
203
+ assert.deepEqual(body.layers, [{ id: 'basemaps-aerial', type: 'raster', source: 'basemaps-aerial' }]);
201
204
  });
202
205
 
203
- o('should create raster styles from custom config', async () => {
206
+ it('should create raster styles from custom config', async () => {
204
207
  const configId = FakeData.bundle([FakeData.tileSetRaster('aerial')]);
205
208
  const request = mockUrlRequest('/v1/styles/aerial.json', `?config=${configId}`, Api.header);
206
209
 
207
210
  const res = await handler.router.handle(request);
208
- o(res.status).equals(200);
211
+ assert.equal(res.status, 200, res.statusDescription);
209
212
 
210
213
  const body = JSON.parse(Buffer.from(res.body, 'base64').toString());
211
214
 
212
- o(body.version).equals(8);
213
- o(body.sources['basemaps-aerial'].type).deepEquals('raster');
214
- o(body.sources['basemaps-aerial'].tiles).deepEquals([
215
+ assert.equal(body.version, 8);
216
+ assert.deepEqual(body.sources['basemaps-aerial'].type, 'raster');
217
+ assert.deepEqual(body.sources['basemaps-aerial'].tiles, [
215
218
  `https://tiles.test/v1/tiles/aerial/WebMercatorQuad/{z}/{x}/{y}.webp?api=${Api.key}&config=${configId}`,
216
219
  ]);
217
- o(body.sources['basemaps-aerial'].tileSize).deepEquals(256);
218
- o(body.layers).deepEquals([{ id: 'basemaps-aerial', type: 'raster', source: 'basemaps-aerial' }]);
220
+ assert.deepEqual(body.sources['basemaps-aerial'].tileSize, 256);
221
+ assert.deepEqual(body.layers, [{ id: 'basemaps-aerial', type: 'raster', source: 'basemaps-aerial' }]);
219
222
  });
220
223
  });
@@ -1,18 +1,26 @@
1
+ import assert from 'node:assert';
2
+ import { afterEach, beforeEach, describe, it } from 'node:test';
3
+
1
4
  import { ConfigProviderMemory } from '@basemaps/config';
2
- import o from 'ospec';
5
+ import { Env } from '@basemaps/shared';
3
6
  import { createSandbox } from 'sinon';
4
- import { handler } from '../../index.js';
5
- import { ConfigLoader } from '../../util/config.loader.js';
7
+
6
8
  import { Imagery2193, Imagery3857, Provider, TileSetAerial } from '../../__tests__/config.data.js';
7
9
  import { Api, mockUrlRequest } from '../../__tests__/xyz.util.js';
10
+ import { handler } from '../../index.js';
11
+ import { ConfigLoader } from '../../util/config.loader.js';
8
12
 
9
- o.spec('WMTSRouting', () => {
13
+ describe('WMTSRouting', () => {
10
14
  const sandbox = createSandbox();
11
15
  const config = new ConfigProviderMemory();
12
16
  const imagery = new Map();
13
17
 
14
- o.beforeEach(() => {
18
+ beforeEach(() => {
15
19
  sandbox.stub(ConfigLoader, 'load').resolves(config);
20
+ sandbox.stub(Env, 'get').callsFake((arg) => {
21
+ if (arg === Env.PublicUrlBase) return 'https://tiles.test';
22
+ return process.env[arg];
23
+ });
16
24
 
17
25
  imagery.set(Imagery3857.id, Imagery3857);
18
26
  imagery.set(Imagery2193.id, Imagery2193);
@@ -23,24 +31,24 @@ o.spec('WMTSRouting', () => {
23
31
  config.put(Provider);
24
32
  });
25
33
 
26
- o.afterEach(() => {
34
+ afterEach(() => {
27
35
  config.objects.clear();
28
36
  sandbox.restore();
29
37
  });
30
38
 
31
- o('should default to the aerial layer', async () => {
39
+ it('should default to the aerial layer', async () => {
32
40
  const req = mockUrlRequest(
33
41
  '/v1/tiles/WMTSCapabilities.xml',
34
42
  `format=png&api=${Api.key}&config=s3://linz-basemaps/config.json`,
35
43
  );
36
44
  const res = await handler.router.handle(req);
37
45
 
38
- o(res.status).equals(200);
46
+ assert.equal(res.status, 200);
39
47
  const lines = Buffer.from(res.body, 'base64').toString().split('\n');
40
48
 
41
49
  const titles = lines.filter((f) => f.startsWith(' <ows:Title>')).map((f) => f.trim());
42
50
 
43
- o(titles).deepEquals([
51
+ assert.deepEqual(titles, [
44
52
  '<ows:Title>Aerial Imagery</ows:Title>',
45
53
  '<ows:Title>Ōtorohanga 0.1m Urban Aerial Photos (2021)</ows:Title>',
46
54
  '<ows:Title>Google Maps Compatible for the World</ows:Title>',
@@ -48,60 +56,60 @@ o.spec('WMTSRouting', () => {
48
56
  ]);
49
57
 
50
58
  const resourceURLs = lines.filter((f) => f.includes('<ResourceURL')).map((f) => f.trim());
51
- o(resourceURLs).deepEquals([
59
+ assert.deepEqual(resourceURLs, [
52
60
  '<ResourceURL format="image/png" resourceType="tile" template="https://tiles.test/v1/tiles/aerial/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png?api=d01f7w7rnhdzg0p7fyrc9v9ard1&amp;config=Q5pC4UjWdtFLU1CYtLcRSmB49RekgDgMa5EGJnB2M" />',
53
61
  '<ResourceURL format="image/png" resourceType="tile" template="https://tiles.test/v1/tiles/ōtorohanga-urban-2021-0.1m/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png?api=d01f7w7rnhdzg0p7fyrc9v9ard1&amp;config=Q5pC4UjWdtFLU1CYtLcRSmB49RekgDgMa5EGJnB2M" />',
54
62
  ]);
55
63
  });
56
64
 
57
- o('should filter out date[after] by year', async () => {
65
+ it('should filter out date[after] by year', async () => {
58
66
  const req = mockUrlRequest(
59
67
  '/v1/tiles/WMTSCapabilities.xml',
60
68
  `format=png&api=${Api.key}&config=s3://linz-basemaps/config.json&date[after]=2022`,
61
69
  );
62
70
  const res = await handler.router.handle(req);
63
71
 
64
- o(res.status).equals(200);
72
+ assert.equal(res.status, 200);
65
73
  const lines = Buffer.from(res.body, 'base64').toString().split('\n');
66
74
  const titles = lines.filter((f) => f.startsWith(' <ows:Title>')).map((f) => f.trim());
67
75
 
68
- o(titles).deepEquals([
76
+ assert.deepEqual(titles, [
69
77
  '<ows:Title>Aerial Imagery</ows:Title>',
70
78
  '<ows:Title>Google Maps Compatible for the World</ows:Title>',
71
79
  '<ows:Title>LINZ NZTM2000 Map Tile Grid V2</ows:Title>',
72
80
  ]);
73
81
  });
74
82
 
75
- o('should filter out date[before] by year', async () => {
83
+ it('should filter out date[before] by year', async () => {
76
84
  const req = mockUrlRequest(
77
85
  '/v1/tiles/WMTSCapabilities.xml',
78
86
  `format=png&api=${Api.key}&config=s3://linz-basemaps/config.json&date[before]=2020`,
79
87
  );
80
88
  const res = await handler.router.handle(req);
81
89
 
82
- o(res.status).equals(200);
90
+ assert.equal(res.status, 200);
83
91
  const lines = Buffer.from(res.body, 'base64').toString().split('\n');
84
92
  const titles = lines.filter((f) => f.startsWith(' <ows:Title>')).map((f) => f.trim());
85
93
 
86
- o(titles).deepEquals([
94
+ assert.deepEqual(titles, [
87
95
  '<ows:Title>Aerial Imagery</ows:Title>',
88
96
  '<ows:Title>Google Maps Compatible for the World</ows:Title>',
89
97
  '<ows:Title>LINZ NZTM2000 Map Tile Grid V2</ows:Title>',
90
98
  ]);
91
99
  });
92
100
 
93
- o('should filter inclusive date[before] by year', async () => {
101
+ it('should filter inclusive date[before] by year', async () => {
94
102
  const req = mockUrlRequest(
95
103
  '/v1/tiles/WMTSCapabilities.xml',
96
104
  `format=png&api=${Api.key}&config=s3://linz-basemaps/config.json&date[before]=2021`,
97
105
  );
98
106
  const res = await handler.router.handle(req);
99
107
 
100
- o(res.status).equals(200);
108
+ assert.equal(res.status, 200);
101
109
  const lines = Buffer.from(res.body, 'base64').toString().split('\n');
102
110
  const titles = lines.filter((f) => f.startsWith(' <ows:Title>')).map((f) => f.trim());
103
111
 
104
- o(titles).deepEquals([
112
+ assert.deepEqual(titles, [
105
113
  '<ows:Title>Aerial Imagery</ows:Title>',
106
114
  '<ows:Title>Ōtorohanga 0.1m Urban Aerial Photos (2021)</ows:Title>',
107
115
  '<ows:Title>Google Maps Compatible for the World</ows:Title>',
@@ -109,7 +117,7 @@ o.spec('WMTSRouting', () => {
109
117
  ]);
110
118
 
111
119
  const resourceURLs = lines.filter((f) => f.includes('<ResourceURL')).map((f) => f.trim());
112
- o(resourceURLs).deepEquals([
120
+ assert.deepEqual(resourceURLs, [
113
121
  '<ResourceURL format="image/png" resourceType="tile" template="https://tiles.test/v1/tiles/aerial/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png?api=d01f7w7rnhdzg0p7fyrc9v9ard1&amp;config=Q5pC4UjWdtFLU1CYtLcRSmB49RekgDgMa5EGJnB2M&amp;date%5Bbefore%5D=2021" />',
114
122
  '<ResourceURL format="image/png" resourceType="tile" template="https://tiles.test/v1/tiles/ōtorohanga-urban-2021-0.1m/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.png?api=d01f7w7rnhdzg0p7fyrc9v9ard1&amp;config=Q5pC4UjWdtFLU1CYtLcRSmB49RekgDgMa5EGJnB2M" />',
115
123
  ]);
@@ -1,121 +1,200 @@
1
+ import assert from 'node:assert';
2
+ import { afterEach, beforeEach, describe, it } from 'node:test';
3
+
1
4
  import { ConfigProviderMemory } from '@basemaps/config';
2
5
  import { LogConfig } from '@basemaps/shared';
3
6
  import { round } from '@basemaps/test/build/rounding.js';
4
- import o from 'ospec';
5
- import sinon from 'sinon';
7
+
8
+ import { FakeData } from '../../__tests__/config.data.js';
9
+ import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
6
10
  import { handler } from '../../index.js';
7
11
  import { ConfigLoader } from '../../util/config.loader.js';
8
12
  import { Etag } from '../../util/etag.js';
9
- import { FakeData } from '../../__tests__/config.data.js';
10
- import { Api, mockRequest } from '../../__tests__/xyz.util.js';
11
-
12
- const sandbox = sinon.createSandbox();
13
13
 
14
14
  const TileSetNames = ['aerial', 'aerial:ōtorohanga_urban_2021_0-1m_RGB', '01FYWKAJ86W9P7RWM1VB62KD0H'];
15
- o.spec('/v1/tiles', () => {
15
+ describe('/v1/tiles', () => {
16
16
  const config = new ConfigProviderMemory();
17
17
 
18
- o.beforeEach(() => {
18
+ beforeEach(() => {
19
19
  LogConfig.get().level = 'silent';
20
- sandbox.stub(ConfigLoader, 'getDefaultConfig').resolves(config);
21
- config.objects.clear();
22
-
23
20
  for (const tileSetName of TileSetNames) config.put(FakeData.tileSetRaster(tileSetName));
24
-
25
- sandbox.stub(Etag, 'key').returns('fakeEtag');
26
21
  });
27
22
 
28
- o.afterEach(() => {
23
+ afterEach(() => {
29
24
  config.objects.clear();
30
- sandbox.restore();
31
25
  });
32
26
 
33
- o('should export handler', async () => {
27
+ it('should export handler', async () => {
34
28
  const base = await import('../../index.js');
35
- o(typeof base.handler).equals('function');
29
+ assert.equal(typeof base.handler, 'function');
36
30
  });
37
31
 
38
32
  TileSetNames.forEach((tileSetName) => {
39
- o(`should generate a tile/v1/tiles/${tileSetName}/global-mercator/0/0/0.png`, async () => {
33
+ it(`should generate a tile/v1/tiles/${tileSetName}/global-mercator/0/0/0.png`, async (t) => {
34
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
35
+ t.mock.method(Etag, 'key', () => 'fakeEtag');
36
+
40
37
  const request = mockRequest(`/v1/tiles/${tileSetName}/global-mercator/0/0/0.png`, 'get', Api.header);
41
38
  const res = await handler.router.handle(request);
42
- o(res.status).equals(200);
43
- o(res.header('content-type')).equals('image/png');
44
- o(res.header('eTaG')).equals('fakeEtag');
39
+ assert.equal(res.status, 200);
40
+ assert.equal(res.header('content-type'), 'image/png');
41
+ assert.equal(res.header('eTaG'), 'fakeEtag');
45
42
 
46
43
  // Validate the session information has been set correctly
47
- o(request.logContext['tileSet']).equals(tileSetName);
48
- o(request.logContext['xyz']).deepEquals({ x: 0, y: 0, z: 0 });
49
- o(round(request.logContext['location'])).deepEquals({ lat: 0, lon: 0 });
44
+ assert.equal(request.logContext['tileSet'], tileSetName);
45
+ assert.deepEqual(request.logContext['xyz'], { x: 0, y: 0, z: 0 });
46
+ assert.deepEqual(round(request.logContext['location']), { lat: 0, lon: 0 });
50
47
  });
51
48
  });
52
49
 
53
- o('should generate a tile 0,0,0 for webp', async () => {
50
+ it('should generate a tile 0,0,0 for webp', async (t) => {
51
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
52
+ t.mock.method(Etag, 'key', () => 'fakeEtag');
53
+
54
54
  const request = mockRequest('/v1/tiles/aerial/3857/0/0/0.webp', 'get', Api.header);
55
55
  const res = await handler.router.handle(request);
56
- o(res.status).equals(200);
57
- o(res.header('content-type')).equals('image/webp');
58
- o(res.header('eTaG')).equals('fakeEtag');
56
+
57
+ assert.equal(res.status, 200, res.statusDescription);
58
+ assert.equal(res.header('content-type'), 'image/webp');
59
+ assert.equal(res.header('eTaG'), 'fakeEtag');
59
60
  // o(res.body).equals(rasterMockBuffer.toString('base64'));
60
61
 
61
62
  // Validate the session information has been set correctly
62
- o(request.logContext['xyz']).deepEquals({ x: 0, y: 0, z: 0 });
63
- o(round(request.logContext['location'])).deepEquals({ lat: 0, lon: 0 });
63
+ assert.deepEqual(request.logContext['xyz'], { x: 0, y: 0, z: 0 });
64
+ assert.deepEqual(round(request.logContext['location']), { lat: 0, lon: 0 });
64
65
  });
65
66
 
66
67
  ['png', 'webp', 'jpeg', 'avif'].forEach((fmt) => {
67
- o(`should 200 with empty ${fmt} if a tile is out of bounds`, async () => {
68
- o.timeout(1_000);
69
-
70
- const res = await handler.router.handle(
71
- mockRequest(`/v1/tiles/aerial/global-mercator/0/0/0.${fmt}`, 'get', Api.header),
72
- );
73
- o(res.status).equals(200);
74
- o(res.header('content-type')).equals(`image/${fmt}`);
75
- o(res.header('etag')).notEquals(undefined);
76
- o(res.header('cache-control')).equals('public, max-age=604800, stale-while-revalidate=86400');
68
+ it(`should 200 with empty ${fmt} if a tile is out of bounds`, async (t) => {
69
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
70
+
71
+ const request = mockRequest(`/v1/tiles/aerial/global-mercator/0/0/0.${fmt}`, 'get', Api.header);
72
+ const res = await handler.router.handle(request);
73
+ assert.equal(res.status, 200, res.statusDescription);
74
+ assert.equal(res.header('content-type'), `image/${fmt}`);
75
+ assert.notEqual(res.header('etag'), undefined);
76
+ assert.equal(res.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
77
+ assert.deepEqual(request.logContext['pipeline'], 'rgba');
77
78
  });
78
79
  });
79
80
 
80
- o('should 304 if a tile is not modified', async () => {
81
+ it('should 304 if a tile is not modified', async (t) => {
82
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
83
+ t.mock.method(Etag, 'key', () => 'fakeEtag');
84
+
81
85
  const key = 'fakeEtag';
82
86
  const request = mockRequest('/v1/tiles/aerial/global-mercator/0/0/0.png', 'get', {
83
87
  'if-none-match': key,
84
88
  ...Api.header,
85
89
  });
86
90
  const res = await handler.router.handle(request);
87
- o(res.status).equals(304);
88
- o(res.header('eTaG')).equals(undefined);
91
+ assert.equal(res.status, 304);
92
+ assert.equal(res.header('eTaG'), undefined);
89
93
 
90
- o(request.logContext['cache']).deepEquals({ match: key, hit: true });
94
+ assert.deepEqual(request.logContext['cache'], { match: key, hit: true });
91
95
  });
92
96
 
93
- o('should 404 if a tile is outside of the range', async () => {
97
+ it('should 404 if a tile is outside of the range', async (t) => {
98
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
99
+
94
100
  const res = await handler.router.handle(
95
101
  mockRequest('/v1/tiles/aerial/global-mercator/25/0/0.png', 'get', Api.header),
96
102
  );
97
- o(res.status).equals(404);
103
+ assert.equal(res.status, 404);
98
104
 
99
105
  const resB = await handler.router.handle(mockRequest('/v1/tiles/aerial/2193/17/0/0.png', 'get', Api.header));
100
- o(resB.status).equals(404);
106
+ assert.equal(resB.status, 404);
101
107
  });
102
108
 
103
- o('should support utf8 tilesets', async () => {
109
+ it('should support utf8 tilesets', async (t) => {
110
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
111
+
104
112
  const fakeTileSet = FakeData.tileSetRaster('🦄 🌈');
105
113
  config.put(fakeTileSet);
106
114
  const req = mockRequest('/v1/tiles/🦄 🌈/global-mercator/0/0/0.png', 'get', Api.header);
107
- o(req.path).equals('/v1/tiles/%F0%9F%A6%84%20%F0%9F%8C%88/global-mercator/0/0/0.png');
115
+ assert.equal(req.path, '/v1/tiles/%F0%9F%A6%84%20%F0%9F%8C%88/global-mercator/0/0/0.png');
108
116
  const res = await handler.router.handle(req);
109
- o(res.status).equals(200);
110
- o(res.header('content-type')).equals('image/png');
111
- o(res.header('etag')).notEquals(undefined);
112
- o(res.header('cache-control')).equals('public, max-age=604800, stale-while-revalidate=86400');
117
+ assert.equal(res.status, 200, res.statusDescription);
118
+ assert.equal(res.header('content-type'), 'image/png');
119
+ assert.notEqual(res.header('etag'), undefined);
120
+ assert.equal(res.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
113
121
  });
114
122
 
115
123
  ['/favicon.ico', '/index.html', '/foo/bar'].forEach((path) => {
116
- o('should 404 on invalid paths: ' + path, async () => {
124
+ it('should 404 on invalid paths: ' + path, async (t) => {
125
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
126
+
117
127
  const res = await handler.router.handle(mockRequest(path, 'get', Api.header));
118
- o(res.status).equals(404);
128
+ assert.equal(res.status, 404);
119
129
  });
120
130
  });
131
+
132
+ it('should 404 if pipelines are defined but one is not requested', async (t) => {
133
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
134
+
135
+ const elevation = FakeData.tileSetRaster('elevation');
136
+
137
+ elevation.outputs = [{ title: 'Terrain RGB', name: 'terrain-rgb' }];
138
+ config.put(elevation);
139
+
140
+ const request = mockRequest('/v1/tiles/elevation/3857/11/2022/1283.webp', 'get', Api.header);
141
+
142
+ const res = await handler.router.handle(request);
143
+
144
+ assert.equal(res.status, 404, res.statusDescription);
145
+ });
146
+
147
+ it('should generate a terrain-rgb 11/2022/1283 in webp', async (t) => {
148
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
149
+
150
+ const elevation = FakeData.tileSetRaster('elevation');
151
+
152
+ elevation.outputs = [{ title: 'Terrain RGB', name: 'terrain-rgb', format: ['png', 'webp'] }];
153
+ config.put(elevation);
154
+
155
+ const request = mockUrlRequest('/v1/tiles/elevation/3857/11/2022/1283.webp', '?pipeline=terrain-rgb', Api.header);
156
+
157
+ const res = await handler.router.handle(request);
158
+
159
+ assert.equal(res.status, 200, res.statusDescription);
160
+ // Validate the session information has been set correctly
161
+ assert.deepEqual(request.logContext['xyz'], { x: 2022, y: 1283, z: 11 });
162
+ assert.deepEqual(request.logContext['pipeline'], 'terrain-rgb');
163
+ assert.deepEqual(round(request.logContext['location']), { lat: -41.44272638, lon: 175.51757812 });
164
+ });
165
+
166
+ it('should validate lossless if pipelines are defined but one is not requested', async (t) => {
167
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
168
+
169
+ const elevation = FakeData.tileSetRaster('elevation');
170
+
171
+ elevation.outputs = [{ title: 'Terrain RGB', name: 'terrain-rgb', format: ['png'] }];
172
+ config.put(elevation);
173
+
174
+ // JPEG is not lossless
175
+ const res = await handler.router.handle(
176
+ mockUrlRequest('/v1/tiles/elevation/3857/11/2022/1283.jpeg', '?pipeline=terrain-rgb', Api.header),
177
+ );
178
+ assert.equal(res.status, 400, res.statusDescription);
179
+ });
180
+
181
+ it('should validate not allow random extensions', async (t) => {
182
+ t.mock.method(ConfigLoader, 'getDefaultConfig', () => Promise.resolve(config));
183
+
184
+ const elevation = FakeData.tileSetRaster('elevation');
185
+
186
+ elevation.outputs = [{ title: 'Terrain RGB', name: 'terrain-rgb' }];
187
+ config.put(elevation);
188
+
189
+ // JPEG is not lossless
190
+ const resPbf = await handler.router.handle(
191
+ mockUrlRequest('/v1/tiles/elevation/3857/11/2022/1283.pbf', '?pipeline=terrain-rgb', Api.header),
192
+ );
193
+ assert.equal(resPbf.status, 400, resPbf.statusDescription);
194
+
195
+ const resZz = await handler.router.handle(
196
+ mockUrlRequest('/v1/tiles/elevation/3857/11/2022/1283.zzz', '?pipeline=terrain-rgb', Api.header),
197
+ );
198
+ assert.equal(resZz.status, 400, resZz.statusDescription);
199
+ });
121
200
  });
@@ -12,11 +12,11 @@ import {
12
12
  StacProvider,
13
13
  TileMatrixSet,
14
14
  } from '@basemaps/geo';
15
- import { BBox, MultiPolygon, multiPolygonToWgs84, Pair, union, Wgs84 } from '@linzjs/geojson';
16
15
  import { extractYearRangeFromName, extractYearRangeFromTitle } from '@basemaps/shared';
16
+ import { BBox, MultiPolygon, multiPolygonToWgs84, Pair, union, Wgs84 } from '@linzjs/geojson';
17
17
  import { HttpHeader, LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
18
- import { ConfigLoader } from '../util/config.loader.js';
19
18
 
19
+ import { ConfigLoader } from '../util/config.loader.js';
20
20
  import { Etag } from '../util/etag.js';
21
21
  import { filterLayers, yearRangeToInterval } from '../util/filter.js';
22
22
  import { NotFound, NotModified } from '../util/response.js';
@@ -1,6 +1,7 @@
1
1
  import { standardizeLayerName } from '@basemaps/config';
2
2
  import { GoogleTms, TileMatrixSets } from '@basemaps/geo';
3
3
  import { HttpHeader, LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
4
+
4
5
  import { ConfigLoader } from '../util/config.loader.js';
5
6
  import { Etag } from '../util/etag.js';
6
7
  import { NotFound, NotModified } from '../util/response.js';
@@ -1,5 +1,5 @@
1
1
  import { LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
2
- import path from 'path';
2
+
3
3
  import { assetProvider } from '../util/assets.provider.js';
4
4
 
5
5
  interface FontGet {
@@ -7,10 +7,10 @@ interface FontGet {
7
7
  }
8
8
 
9
9
  export async function fontGet(req: LambdaHttpRequest<FontGet>): Promise<LambdaHttpResponse> {
10
- const targetFile = path.join('fonts', req.params.fontStack, req.params.range) + '.pbf';
10
+ const targetFile = `fonts/${req.params.fontStack}/${req.params.range}.pbf`;
11
11
  return assetProvider.serve(req, targetFile, 'application/x-protobuf');
12
12
  }
13
13
 
14
14
  export async function fontList(req: LambdaHttpRequest): Promise<LambdaHttpResponse> {
15
- return assetProvider.serve(req, path.join('fonts', 'fonts.json'), 'application/json');
15
+ return assetProvider.serve(req, 'fonts/fonts.json', 'application/json');
16
16
  }