@basemaps/lambda-tiler 6.46.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +93 -1
  3. package/build/__tests__/config.data.d.ts +0 -1
  4. package/build/__tests__/config.data.js +2 -6
  5. package/build/__tests__/config.data.js.map +1 -1
  6. package/build/__tests__/index.test.d.ts +0 -1
  7. package/build/__tests__/index.test.js +28 -27
  8. package/build/__tests__/index.test.js.map +1 -1
  9. package/build/__tests__/tile.style.json.test.d.ts +0 -1
  10. package/build/__tests__/tile.style.json.test.js +38 -37
  11. package/build/__tests__/tile.style.json.test.js.map +1 -1
  12. package/build/__tests__/wmts.capability.test.d.ts +0 -1
  13. package/build/__tests__/wmts.capability.test.js +111 -122
  14. package/build/__tests__/wmts.capability.test.js.map +1 -1
  15. package/build/__tests__/xyz.util.d.ts +0 -1
  16. package/build/cli/render.preview.d.ts +0 -1
  17. package/build/cli/render.preview.js +13 -9
  18. package/build/cli/render.preview.js.map +1 -1
  19. package/build/cli/render.tile.d.ts +0 -1
  20. package/build/cli/render.tile.js +25 -17
  21. package/build/cli/render.tile.js.map +1 -1
  22. package/build/index.d.ts +0 -1
  23. package/build/index.js +27 -31
  24. package/build/index.js.map +1 -1
  25. package/build/routes/__tests__/attribution.test.d.ts +0 -1
  26. package/build/routes/__tests__/attribution.test.js +38 -37
  27. package/build/routes/__tests__/attribution.test.js.map +1 -1
  28. package/build/routes/__tests__/fonts.test.d.ts +0 -1
  29. package/build/routes/__tests__/fonts.test.js +61 -63
  30. package/build/routes/__tests__/fonts.test.js.map +1 -1
  31. package/build/routes/__tests__/health.test.d.ts +0 -1
  32. package/build/routes/__tests__/health.test.js +16 -16
  33. package/build/routes/__tests__/health.test.js.map +1 -1
  34. package/build/routes/__tests__/imagery.test.d.ts +0 -1
  35. package/build/routes/__tests__/imagery.test.js +10 -9
  36. package/build/routes/__tests__/imagery.test.js.map +1 -1
  37. package/build/routes/__tests__/memory.fs.d.ts +2 -3
  38. package/build/routes/__tests__/preview.index.test.d.ts +0 -1
  39. package/build/routes/__tests__/preview.index.test.js +88 -42
  40. package/build/routes/__tests__/preview.index.test.js.map +1 -1
  41. package/build/routes/__tests__/sprites.test.d.ts +0 -1
  42. package/build/routes/__tests__/sprites.test.js +34 -34
  43. package/build/routes/__tests__/sprites.test.js.map +1 -1
  44. package/build/routes/__tests__/tile.json.test.d.ts +0 -1
  45. package/build/routes/__tests__/tile.json.test.js +45 -51
  46. package/build/routes/__tests__/tile.json.test.js.map +1 -1
  47. package/build/routes/__tests__/tile.style.json.test.d.ts +0 -1
  48. package/build/routes/__tests__/tile.style.json.test.js +49 -50
  49. package/build/routes/__tests__/tile.style.json.test.js.map +1 -1
  50. package/build/routes/__tests__/wmts.test.d.ts +0 -1
  51. package/build/routes/__tests__/wmts.test.js +27 -20
  52. package/build/routes/__tests__/wmts.test.js.map +1 -1
  53. package/build/routes/__tests__/xyz.test.d.ts +0 -1
  54. package/build/routes/__tests__/xyz.test.js +97 -49
  55. package/build/routes/__tests__/xyz.test.js.map +1 -1
  56. package/build/routes/attribution.d.ts +1 -1
  57. package/build/routes/attribution.js +4 -5
  58. package/build/routes/attribution.js.map +1 -1
  59. package/build/routes/config.d.ts +0 -1
  60. package/build/routes/config.js +1 -2
  61. package/build/routes/config.js.map +1 -1
  62. package/build/routes/fonts.d.ts +0 -1
  63. package/build/routes/fonts.js +2 -3
  64. package/build/routes/fonts.js.map +1 -1
  65. package/build/routes/health.d.ts +1 -2
  66. package/build/routes/health.js +5 -15
  67. package/build/routes/health.js.map +1 -1
  68. package/build/routes/imagery.d.ts +0 -1
  69. package/build/routes/imagery.js +1 -1
  70. package/build/routes/imagery.js.map +1 -1
  71. package/build/routes/ping.d.ts +0 -1
  72. package/build/routes/ping.js +1 -1
  73. package/build/routes/ping.js.map +1 -1
  74. package/build/routes/preview.d.ts +6 -5
  75. package/build/routes/preview.index.d.ts +0 -1
  76. package/build/routes/preview.index.js +6 -5
  77. package/build/routes/preview.index.js.map +1 -1
  78. package/build/routes/preview.js +35 -10
  79. package/build/routes/preview.js.map +1 -1
  80. package/build/routes/sprites.d.ts +0 -1
  81. package/build/routes/sprites.js +2 -4
  82. package/build/routes/sprites.js.map +1 -1
  83. package/build/routes/tile.json.d.ts +0 -1
  84. package/build/routes/tile.json.js +10 -5
  85. package/build/routes/tile.json.js.map +1 -1
  86. package/build/routes/tile.style.json.d.ts +1 -1
  87. package/build/routes/tile.style.json.js +79 -16
  88. package/build/routes/tile.style.json.js.map +1 -1
  89. package/build/routes/tile.wmts.d.ts +0 -1
  90. package/build/routes/tile.wmts.js +8 -9
  91. package/build/routes/tile.wmts.js.map +1 -1
  92. package/build/routes/tile.xyz.d.ts +0 -1
  93. package/build/routes/tile.xyz.js.map +1 -1
  94. package/build/routes/tile.xyz.raster.d.ts +7 -8
  95. package/build/routes/tile.xyz.raster.js +17 -13
  96. package/build/routes/tile.xyz.raster.js.map +1 -1
  97. package/build/routes/tile.xyz.vector.d.ts +0 -1
  98. package/build/routes/tile.xyz.vector.js +4 -3
  99. package/build/routes/tile.xyz.vector.js.map +1 -1
  100. package/build/routes/version.d.ts +0 -1
  101. package/build/routes/version.js +3 -4
  102. package/build/routes/version.js.map +1 -1
  103. package/build/util/__test__/config.loader.test.d.ts +0 -1
  104. package/build/util/__test__/config.loader.test.js +35 -34
  105. package/build/util/__test__/config.loader.test.js.map +1 -1
  106. package/build/util/__test__/filter.test.d.ts +0 -1
  107. package/build/util/__test__/filter.test.js +17 -16
  108. package/build/util/__test__/filter.test.js.map +1 -1
  109. package/build/util/__test__/validate.test.d.ts +0 -1
  110. package/build/util/__test__/validate.test.js +26 -43
  111. package/build/util/__test__/validate.test.js.map +1 -1
  112. package/build/util/assets.provider.d.ts +5 -5
  113. package/build/util/assets.provider.js +8 -8
  114. package/build/util/assets.provider.js.map +1 -1
  115. package/build/util/config.cache.d.ts +2 -2
  116. package/build/util/config.cache.js +14 -3
  117. package/build/util/config.cache.js.map +1 -1
  118. package/build/util/config.loader.d.ts +0 -1
  119. package/build/util/config.loader.js +18 -13
  120. package/build/util/config.loader.js.map +1 -1
  121. package/build/util/cotar.serve.d.ts +3 -3
  122. package/build/util/cotar.serve.js +2 -2
  123. package/build/util/cotar.serve.js.map +1 -1
  124. package/build/util/etag.d.ts +0 -1
  125. package/build/util/etag.js.map +1 -1
  126. package/build/util/filter.d.ts +0 -1
  127. package/build/util/filter.js +4 -5
  128. package/build/util/filter.js.map +1 -1
  129. package/build/util/response.d.ts +0 -1
  130. package/build/util/source.cache.d.ts +8 -9
  131. package/build/util/source.cache.js +27 -24
  132. package/build/util/source.cache.js.map +1 -1
  133. package/build/util/swapping.lru.d.ts +0 -1
  134. package/build/util/swapping.lru.js +48 -7
  135. package/build/util/swapping.lru.js.map +1 -1
  136. package/build/util/validate.d.ts +17 -5
  137. package/build/util/validate.js +51 -15
  138. package/build/util/validate.js.map +1 -1
  139. package/build/wmts.capability.d.ts +1 -2
  140. package/build/wmts.capability.js +81 -12
  141. package/build/wmts.capability.js.map +1 -1
  142. package/bundle.sh +2 -2
  143. package/package.json +16 -18
  144. package/scripts/create.deployment.package.mjs +4 -11
  145. package/src/__tests__/config.data.ts +2 -6
  146. package/src/__tests__/index.test.ts +29 -27
  147. package/src/__tests__/tile.style.json.test.ts +40 -37
  148. package/src/__tests__/wmts.capability.test.ts +139 -120
  149. package/src/cli/render.preview.ts +14 -9
  150. package/src/cli/render.tile.ts +27 -18
  151. package/src/index.ts +31 -35
  152. package/src/routes/__tests__/attribution.test.ts +40 -37
  153. package/src/routes/__tests__/fonts.test.ts +68 -64
  154. package/src/routes/__tests__/health.test.ts +18 -17
  155. package/src/routes/__tests__/imagery.test.ts +11 -9
  156. package/src/routes/__tests__/preview.index.test.ts +114 -40
  157. package/src/routes/__tests__/sprites.test.ts +39 -34
  158. package/src/routes/__tests__/tile.json.test.ts +41 -39
  159. package/src/routes/__tests__/tile.style.json.test.ts +49 -46
  160. package/src/routes/__tests__/wmts.test.ts +28 -20
  161. package/src/routes/__tests__/xyz.test.ts +134 -55
  162. package/src/routes/attribution.ts +2 -2
  163. package/src/routes/config.ts +1 -0
  164. package/src/routes/fonts.ts +3 -3
  165. package/src/routes/health.ts +7 -13
  166. package/src/routes/imagery.ts +2 -1
  167. package/src/routes/ping.ts +1 -1
  168. package/src/routes/preview.index.ts +9 -5
  169. package/src/routes/preview.ts +44 -15
  170. package/src/routes/sprites.ts +4 -5
  171. package/src/routes/tile.json.ts +9 -2
  172. package/src/routes/tile.style.json.ts +89 -13
  173. package/src/routes/tile.wmts.ts +4 -3
  174. package/src/routes/tile.xyz.raster.ts +26 -22
  175. package/src/routes/tile.xyz.ts +1 -0
  176. package/src/routes/tile.xyz.vector.ts +5 -3
  177. package/src/routes/version.ts +3 -3
  178. package/src/util/__test__/config.loader.test.ts +38 -34
  179. package/src/util/__test__/filter.test.ts +19 -16
  180. package/src/util/__test__/validate.test.ts +28 -43
  181. package/src/util/assets.provider.ts +10 -9
  182. package/src/util/config.cache.ts +4 -3
  183. package/src/util/config.loader.ts +20 -14
  184. package/src/util/cotar.serve.ts +3 -2
  185. package/src/util/source.cache.ts +15 -26
  186. package/src/util/validate.ts +61 -14
  187. package/src/wmts.capability.ts +3 -3
  188. package/tsconfig.json +1 -0
  189. package/tsconfig.tsbuildinfo +1 -1
  190. package/typedoc.json +4 -0
  191. package/build/__tests__/config.data.d.ts.map +0 -1
  192. package/build/__tests__/index.test.d.ts.map +0 -1
  193. package/build/__tests__/tile.style.json.test.d.ts.map +0 -1
  194. package/build/__tests__/wmts.capability.test.d.ts.map +0 -1
  195. package/build/__tests__/xyz.util.d.ts.map +0 -1
  196. package/build/arcgis/__tests__/arcgis.style.json.test.d.ts +0 -2
  197. package/build/arcgis/__tests__/arcgis.style.json.test.d.ts.map +0 -1
  198. package/build/arcgis/__tests__/arcgis.style.json.test.js +0 -131
  199. package/build/arcgis/__tests__/arcgis.style.json.test.js.map +0 -1
  200. package/build/arcgis/__tests__/vector.tiler.server.test.d.ts +0 -2
  201. package/build/arcgis/__tests__/vector.tiler.server.test.d.ts.map +0 -1
  202. package/build/arcgis/__tests__/vector.tiler.server.test.js +0 -54
  203. package/build/arcgis/__tests__/vector.tiler.server.test.js.map +0 -1
  204. package/build/arcgis/arcgis.info.d.ts +0 -3
  205. package/build/arcgis/arcgis.info.d.ts.map +0 -1
  206. package/build/arcgis/arcgis.info.js +0 -25
  207. package/build/arcgis/arcgis.info.js.map +0 -1
  208. package/build/arcgis/arcgis.style.json.d.ts +0 -9
  209. package/build/arcgis/arcgis.style.json.d.ts.map +0 -1
  210. package/build/arcgis/arcgis.style.json.js +0 -75
  211. package/build/arcgis/arcgis.style.json.js.map +0 -1
  212. package/build/arcgis/vector.tile.server.d.ts +0 -8
  213. package/build/arcgis/vector.tile.server.d.ts.map +0 -1
  214. package/build/arcgis/vector.tile.server.js +0 -73
  215. package/build/arcgis/vector.tile.server.js.map +0 -1
  216. package/build/cli/render.preview.d.ts.map +0 -1
  217. package/build/cli/render.tile.d.ts.map +0 -1
  218. package/build/index.d.ts.map +0 -1
  219. package/build/routes/__tests__/attribution.test.d.ts.map +0 -1
  220. package/build/routes/__tests__/fonts.test.d.ts.map +0 -1
  221. package/build/routes/__tests__/health.test.d.ts.map +0 -1
  222. package/build/routes/__tests__/imagery.test.d.ts.map +0 -1
  223. package/build/routes/__tests__/memory.fs.d.ts.map +0 -1
  224. package/build/routes/__tests__/preview.index.test.d.ts.map +0 -1
  225. package/build/routes/__tests__/sprites.test.d.ts.map +0 -1
  226. package/build/routes/__tests__/tile.json.test.d.ts.map +0 -1
  227. package/build/routes/__tests__/tile.style.json.test.d.ts.map +0 -1
  228. package/build/routes/__tests__/wmts.test.d.ts.map +0 -1
  229. package/build/routes/__tests__/xyz.test.d.ts.map +0 -1
  230. package/build/routes/attribution.d.ts.map +0 -1
  231. package/build/routes/config.d.ts.map +0 -1
  232. package/build/routes/fonts.d.ts.map +0 -1
  233. package/build/routes/health.d.ts.map +0 -1
  234. package/build/routes/imagery.d.ts.map +0 -1
  235. package/build/routes/ping.d.ts.map +0 -1
  236. package/build/routes/preview.d.ts.map +0 -1
  237. package/build/routes/preview.index.d.ts.map +0 -1
  238. package/build/routes/sprites.d.ts.map +0 -1
  239. package/build/routes/tile.json.d.ts.map +0 -1
  240. package/build/routes/tile.style.json.d.ts.map +0 -1
  241. package/build/routes/tile.wmts.d.ts.map +0 -1
  242. package/build/routes/tile.xyz.d.ts.map +0 -1
  243. package/build/routes/tile.xyz.raster.d.ts.map +0 -1
  244. package/build/routes/tile.xyz.vector.d.ts.map +0 -1
  245. package/build/routes/version.d.ts.map +0 -1
  246. package/build/util/__test__/config.loader.test.d.ts.map +0 -1
  247. package/build/util/__test__/filter.test.d.ts.map +0 -1
  248. package/build/util/__test__/validate.test.d.ts.map +0 -1
  249. package/build/util/assets.provider.d.ts.map +0 -1
  250. package/build/util/config.cache.d.ts.map +0 -1
  251. package/build/util/config.loader.d.ts.map +0 -1
  252. package/build/util/cotar.serve.d.ts.map +0 -1
  253. package/build/util/etag.d.ts.map +0 -1
  254. package/build/util/filter.d.ts.map +0 -1
  255. package/build/util/response.d.ts.map +0 -1
  256. package/build/util/source.cache.d.ts.map +0 -1
  257. package/build/util/source.tracer.d.ts +0 -18
  258. package/build/util/source.tracer.d.ts.map +0 -1
  259. package/build/util/source.tracer.js +0 -26
  260. package/build/util/source.tracer.js.map +0 -1
  261. package/build/util/swapping.lru.d.ts.map +0 -1
  262. package/build/util/validate.d.ts.map +0 -1
  263. package/build/wmts.capability.d.ts.map +0 -1
  264. package/src/arcgis/__tests__/arcgis.style.json.test.ts +0 -157
  265. package/src/arcgis/__tests__/vector.tiler.server.test.ts +0 -70
  266. package/src/arcgis/arcgis.info.ts +0 -26
  267. package/src/arcgis/arcgis.style.json.ts +0 -83
  268. package/src/arcgis/vector.tile.server.ts +0 -81
  269. package/src/util/source.tracer.ts +0 -38
@@ -1,34 +1,38 @@
1
1
  import { ConfigProviderMemory } from '@basemaps/config';
2
- import { initConfigFromUrls } from '@basemaps/config/build/json/tiff.config.js';
3
- import { ImageFormat, Tile, TileMatrixSet, TileMatrixSets } from '@basemaps/geo';
4
- import { LogConfig, setDefaultConfig } from '@basemaps/shared';
5
- import { fsa } from '@chunkd/fs';
2
+ import { initConfigFromUrls } from '@basemaps/config-loader';
3
+ import { Tile, TileMatrixSet, TileMatrixSets } from '@basemaps/geo';
4
+ import { fsa, LogConfig, setDefaultConfig } from '@basemaps/shared';
6
5
  import { LambdaHttpRequest, LambdaUrlRequest, UrlEvent } from '@linzjs/lambda';
7
6
  import { Context } from 'aws-lambda';
8
- import { pathToFileURL } from 'url';
9
- import { TileXyzRaster } from '../routes/tile.xyz.raster.js';
7
+ import { extname } from 'path';
10
8
 
11
- const target = pathToFileURL(`/home/blacha/tmp/imagery/southland-0.25-rural-2023/`);
12
- const tile = fromPath('/18/117833/146174.webp');
9
+ import { TileXyzRaster } from '../routes/tile.xyz.raster.js';
13
10
 
14
- const outputFormat = ImageFormat.Webp;
11
+ // Render configuration
12
+ const source = fsa.toUrl(`/home/blacha/data/elevation/christchurch_2020-2021/`);
13
+ const tile = fromPath('/14/7898/8615.webp');
14
+ const pipeline: string | null = 'color-ramp';
15
15
  let tileMatrix: TileMatrixSet | null = null;
16
16
 
17
- /** Convert a tile path /:z/:x/:y.png into a tile */
18
- function fromPath(s: string): Tile {
17
+ /** Convert a tile path /:z/:x/:y.png into a tile & extension */
18
+ function fromPath(s: string): Tile & { extension: string } {
19
+ const ext = extname(s).slice(1);
19
20
  const parts = s.split('.')[0].split('/').map(Number);
20
21
  if (s.startsWith('/')) parts.shift();
21
22
  if (parts.length !== 3) throw new Error(`Invalid tile path ${s}`);
22
- return { z: parts[0], x: parts[1], y: parts[2] };
23
+ return { z: parts[0], x: parts[1], y: parts[2], extension: ext };
23
24
  }
24
25
 
25
26
  async function main(): Promise<void> {
26
27
  const log = LogConfig.get();
28
+ log.level = 'trace';
27
29
  const provider = new ConfigProviderMemory();
28
30
  setDefaultConfig(provider);
29
- const { tileSet, imagery } = await initConfigFromUrls(provider, [target]);
31
+ const { imagery, tileSets } = await initConfigFromUrls(provider, [source]);
32
+
33
+ const tileSet = tileSets.find((f) => f.layers.length > 0);
30
34
 
31
- if (tileSet.layers.length === 0) throw new Error('No imagery found in path: ' + target);
35
+ if (tileSet == null || tileSet.layers.length === 0) throw new Error('No imagery found in path: ' + source);
32
36
  log.info({ tileSet: tileSet.name, layers: tileSet.layers.length }, 'TileSet:Loaded');
33
37
 
34
38
  for (const im of imagery) {
@@ -47,11 +51,16 @@ async function main(): Promise<void> {
47
51
  tile,
48
52
  tileMatrix,
49
53
  tileSet: tileSet.id,
50
- tileType: outputFormat,
54
+ tileType: tile.extension,
55
+ pipeline,
51
56
  });
57
+ const pipelineName = pipeline ? `-${pipeline}` : '';
52
58
 
53
- await fsa.write(`./${tile.z}_${tile.x}_${tile.y}.${outputFormat}`, Buffer.from(res.body, 'base64'));
54
- log.info({ path: `./${tile.z}_${tile.x}_${tile.y}.${outputFormat}` }, 'Tile:Write');
59
+ const fileName = `./render/${tile.z}_${tile.x}_${tile.y}${pipelineName}.${tile.extension}`;
60
+ await fsa.write(fsa.toUrl(fileName), Buffer.from(res.body, 'base64'));
61
+ log.info({ path: fileName, ...request.timer.metrics }, 'Tile:Write');
55
62
  }
56
63
 
57
- main();
64
+ main().catch((e) => {
65
+ LogConfig.get().fatal({ err: e }, 'Cli:Failed');
66
+ });
package/src/index.ts CHANGED
@@ -1,55 +1,55 @@
1
- import { 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';
1
+ import { FsaCache, FsaLog, LogConfig } from '@basemaps/shared';
2
+ import { LambdaHttpRequest, LambdaHttpResponse, lf } from '@linzjs/lambda';
3
+
6
4
  import { tileAttributionGet } from './routes/attribution.js';
7
5
  import { configImageryGet, configTileSetGet } from './routes/config.js';
8
6
  import { fontGet, fontList } from './routes/fonts.js';
9
7
  import { healthGet } from './routes/health.js';
10
8
  import { imageryGet } from './routes/imagery.js';
11
9
  import { pingGet } from './routes/ping.js';
10
+ import { previewIndexGet } from './routes/preview.index.js';
11
+ import { tilePreviewGet } from './routes/preview.js';
12
12
  import { spriteGet } from './routes/sprites.js';
13
13
  import { tileJsonGet } from './routes/tile.json.js';
14
14
  import { styleJsonGet } from './routes/tile.style.json.js';
15
15
  import { wmtsCapabilitiesGet } from './routes/tile.wmts.js';
16
16
  import { tileXyzGet } from './routes/tile.xyz.js';
17
17
  import { versionGet } from './routes/version.js';
18
- import { NotFound, OkResponse } from './util/response.js';
19
- import { CoSources } from './util/source.cache.js';
20
- import { St } from './util/source.tracer.js';
21
- import { tilePreviewGet } from './routes/preview.js';
22
- import { previewIndexGet } from './routes/preview.index.js';
18
+ import { NotFound } from './util/response.js';
23
19
 
24
20
  export const handler = lf.http(LogConfig.get());
25
21
 
26
22
  /** If the request takes too long, respond with a 408 timeout when there is approx 1 second remaining */
27
23
  handler.router.timeoutEarlyMs = 1_000;
28
24
 
25
+ function randomTrace(req: LambdaHttpRequest): void {
26
+ // If the env is set to trace level always trace requests
27
+ if (process.env['TRACE']) {
28
+ req.log.level = 'trace';
29
+ return;
30
+ }
31
+
32
+ // Set the logging level based off a percent
33
+ const rand = Math.random();
34
+ // 1% trace
35
+ if (rand < 0.01) req.log.level = 'trace';
36
+ // 5% debug
37
+ else if (rand < 0.04) req.log.level = 'debug';
38
+ // everything else info
39
+ else req.log.level = 'info';
40
+ }
41
+
29
42
  handler.router.hook('request', (req) => {
30
- req.set('name', 'LambdaTiler');
43
+ FsaLog.reset();
44
+
45
+ randomTrace(req);
31
46
 
32
- // Reset the request tracing before every request
33
- St.reset();
47
+ req.set('name', 'LambdaTiler');
34
48
  });
35
49
 
36
50
  handler.router.hook('response', (req, res) => {
37
- if (St.requests.length > 0) {
38
- // TODO this could be relaxed to every say 5% of requests if logging gets too verbose.
39
- req.set('requests', St.requests.slice(0, 100)); // limit to 100 requests (some tiles need 100s of requests)
40
- req.set('requestCount', St.requests.length);
41
- }
42
- // Log the source cache hit/miss ratio
43
- req.set('sources', {
44
- hits: CoSources.cache.hits,
45
- misses: CoSources.cache.misses,
46
- size: CoSources.cache.currentSize,
47
- resets: CoSources.cache.resets,
48
- clears: CoSources.cache.clears,
49
- cacheA: CoSources.cache.cacheA.size,
50
- cacheB: CoSources.cache.cacheB.size,
51
- });
52
-
51
+ req.set('requestCount', FsaLog.requests.length);
52
+ req.set('cacheSize', FsaCache.size);
53
53
  // Force access-control-allow-origin to everything
54
54
  res.header('access-control-allow-origin', '*');
55
55
  });
@@ -97,6 +97,8 @@ handler.router.get('/v1/tiles/:tileSet/:tileMatrix/:z/:x/:y.:tileType', tileXyzG
97
97
 
98
98
  // Preview
99
99
  handler.router.get('/v1/preview/:tileSet/:tileMatrix/:z/:lon/:lat', tilePreviewGet);
100
+ handler.router.get('/v1/preview/:tileSet/:tileMatrix/:z/:lon/:lat/:outputType', tilePreviewGet);
101
+
100
102
  handler.router.get('/v1/@:location', previewIndexGet);
101
103
  handler.router.get('/@:location', previewIndexGet);
102
104
 
@@ -108,9 +110,3 @@ handler.router.get('/v1/attribution/:tileSet/:tileMatrix/summary.json', tileAttr
108
110
  handler.router.get('/v1/tiles/:tileSet/:tileMatrix/WMTSCapabilities.xml', wmtsCapabilitiesGet);
109
111
  handler.router.get('/v1/tiles/:tileSet/WMTSCapabilities.xml', wmtsCapabilitiesGet);
110
112
  handler.router.get('/v1/tiles/WMTSCapabilities.xml', wmtsCapabilitiesGet);
111
-
112
- // Arcgis Vector
113
- handler.router.get('/v1/arcgis/rest/services/:tileSet/VectorTileServer', arcgisTileServerGet);
114
- handler.router.post('/v1/arcgis/rest/services/:tileSet/VectorTileServer', OkResponse);
115
- handler.router.get('/v1/arcgis/rest/services/:tileSet/VectorTileServer/root.json', arcgisStyleJsonGet);
116
- handler.router.get('/v1/arcgis/rest/info', arcgisInfoGet);
@@ -1,15 +1,18 @@
1
+ import assert from 'node:assert';
2
+ import { afterEach, beforeEach, describe, it } from 'node:test';
3
+
1
4
  import { Attribution } from '@basemaps/attribution';
2
5
  import { ConfigProviderMemory } from '@basemaps/config';
3
6
  import { GoogleTms, Nztm2000QuadTms, Projection } from '@basemaps/geo';
4
7
  import { LogConfig } from '@basemaps/shared';
5
8
  import { BBox } from '@linzjs/geojson';
6
9
  import { HttpHeader } from '@linzjs/lambda';
7
- import o from 'ospec';
8
10
  import sinon from 'sinon';
9
- import { handler } from '../../index.js';
10
- import { ConfigLoader } from '../../util/config.loader.js';
11
+
11
12
  import { FakeData, Imagery2193, Imagery3857, Provider, TileSetAerial } from '../../__tests__/config.data.js';
12
13
  import { mockUrlRequest } from '../../__tests__/xyz.util.js';
14
+ import { handler } from '../../index.js';
15
+ import { ConfigLoader } from '../../util/config.loader.js';
13
16
  import { createCoordinates } from '../attribution.js';
14
17
 
15
18
  // const ExpectedJson = {
@@ -280,11 +283,11 @@ import { createCoordinates } from '../attribution.js';
280
283
  // updatedAt: Date.now(),
281
284
  // };
282
285
  // }
283
- o.spec('/v1/attribution', () => {
286
+ describe('/v1/attribution', () => {
284
287
  const config = new ConfigProviderMemory();
285
288
  const sandbox = sinon.createSandbox();
286
289
 
287
- o.beforeEach(() => {
290
+ beforeEach(() => {
288
291
  LogConfig.get().level = 'silent';
289
292
  sandbox.stub(ConfigLoader, 'getDefaultConfig').resolves(config);
290
293
 
@@ -296,107 +299,107 @@ o.spec('/v1/attribution', () => {
296
299
  config.put(Provider);
297
300
  });
298
301
 
299
- o.afterEach(() => {
302
+ afterEach(() => {
300
303
  sandbox.restore();
301
304
  });
302
305
 
303
- o('should notFound', async () => {
306
+ it('should notFound', async () => {
304
307
  const request = mockUrlRequest(`/v1/attribution/aerial/1234/summary.json`);
305
308
  const res = await handler.router.handle(request);
306
309
 
307
- o(res.status).equals(404);
310
+ assert.equal(res.status, 404);
308
311
  });
309
312
 
310
- o('should 304 with etag match', async () => {
313
+ it('should 304 with etag match', async () => {
311
314
  const request = mockUrlRequest(`/v1/attribution/aerial/EPSG:3857/summary.json`, 'get', {
312
- [HttpHeader.IfNoneMatch]: 'E5HGpTqF8AiJ7VgGVKLehYnVfLN9jaVw8Sy6UafJRh2f',
315
+ [HttpHeader.IfNoneMatch]: 'AFV7dcchHkfyFvmmyXwpkxuAPb5BuVXLkLzzYgeB3mFy',
313
316
  });
314
317
 
315
318
  const res = await handler.router.handle(request);
316
319
 
317
- if (res.status === 200) o(res.header('etag')).equals('E5HGpTqF8AiJ7VgGVKLehYnVfLN9jaVw8Sy6UafJRh2f');
320
+ if (res.status === 200) assert.equal(res.header('etag'), 'AFV7dcchHkfyFvmmyXwpkxuAPb5BuVXLkLzzYgeB3mFy');
318
321
 
319
322
  console.log(res.header('etag'));
320
- o(res.status).equals(304);
323
+ assert.equal(res.status, 304);
321
324
  });
322
325
 
323
- o('should parse attribution', async () => {
326
+ it('should parse attribution', async () => {
324
327
  const request = mockUrlRequest(`/v1/attribution/aerial/EPSG:3857/summary.json`);
325
328
  const res = await handler.router.handle(request);
326
- o(res.status).equals(200);
329
+ assert.equal(res.status, 200);
327
330
 
328
331
  const json = JSON.parse(res.body);
329
332
 
330
333
  const attr = Attribution.fromStac(json);
331
- o(attr.attributions.length).equals(1);
332
- o(attr.attributions[0].minZoom).equals(0);
333
- o(attr.attributions[0].maxZoom).equals(32);
334
+ assert.equal(attr.attributions.length, 1);
335
+ assert.equal(attr.attributions[0].minZoom, 0);
336
+ assert.equal(attr.attributions[0].maxZoom, 32);
334
337
  });
335
338
 
336
- o.spec('ImageryRules', () => {
339
+ describe('ImageryRules', () => {
337
340
  const fakeLayer = { [2193]: Imagery2193.id, name: 'image', minZoom: 9, maxZoom: 16, title: 'Image' };
338
341
  const ts = FakeData.tileSetRaster('fake');
339
342
 
340
- o.beforeEach(() => {
343
+ beforeEach(() => {
341
344
  ts.layers = [fakeLayer];
342
345
  config.put(Imagery2193);
343
346
  config.put(ts);
344
347
  });
345
348
 
346
- o('should generate for NZTM', async () => {
349
+ it('should generate for NZTM', async () => {
347
350
  const req = mockUrlRequest('/v1/tiles/fake/NZTM2000/attribution.json', '');
348
351
  const res = await handler.router.handle(req);
349
- o(res.status).equals(200);
352
+ assert.equal(res.status, 200);
350
353
 
351
354
  const output = JSON.parse(res.body);
352
- o(output.title).equals(ts.title);
353
- o(output.collections[0].summaries['linz:zoom']).deepEquals({ min: 5, max: 11 });
355
+ assert.equal(output.title, ts.title);
356
+ assert.deepEqual(output.collections[0].summaries['linz:zoom'], { min: 5, max: 11 });
354
357
  });
355
358
 
356
- o('should generate with correct zooms for NZTM2000Quad', async () => {
359
+ it('should generate with correct zooms for NZTM2000Quad', async () => {
357
360
  const req = mockUrlRequest('/v1/tiles/fake/NZTM2000Quad/attribution.json', '');
358
361
  const res = await handler.router.handle(req);
359
- o(res.status).equals(200);
362
+ assert.equal(res.status, 200);
360
363
 
361
364
  const output = JSON.parse(res.body);
362
- o(output.title).equals(ts.title);
363
- o(output.collections[0].summaries['linz:zoom']).deepEquals({ min: 7, max: 14 });
365
+ assert.equal(output.title, ts.title);
366
+ assert.deepEqual(output.collections[0].summaries['linz:zoom'], { min: 7, max: 14 });
364
367
  });
365
368
 
366
- o('should generate with correct zooms for gebco NZTM2000Quad', async () => {
369
+ it('should generate with correct zooms for gebco NZTM2000Quad', async () => {
367
370
  const fakeGebco = { ...fakeLayer, minZoom: 0, maxZoom: 15 };
368
371
  ts.layers = [fakeGebco];
369
372
 
370
373
  const req = mockUrlRequest('/v1/tiles/fake/NZTM2000Quad/attribution.json', '');
371
374
  const res = await handler.router.handle(req);
372
- o(res.status).equals(200);
375
+ assert.equal(res.status, 200);
373
376
 
374
377
  const output = JSON.parse(res.body);
375
- o(output.title).equals(ts.title);
376
- o(output.collections[0].summaries['linz:zoom']).deepEquals({ min: 0, max: 13 });
378
+ assert.equal(output.title, ts.title);
379
+ assert.deepEqual(output.collections[0].summaries['linz:zoom'], { min: 0, max: 13 });
377
380
  });
378
381
 
379
- o('should generate with correct zooms for nz sentinel NZTM2000Quad', async () => {
382
+ it('should generate with correct zooms for nz sentinel NZTM2000Quad', async () => {
380
383
  const fakeGebco = { ...fakeLayer, minZoom: 0, maxZoom: 32 };
381
384
  ts.layers = [fakeGebco];
382
385
 
383
386
  const req = mockUrlRequest('/v1/tiles/fake/NZTM2000Quad/attribution.json', '');
384
387
  const res = await handler.router.handle(req);
385
- o(res.status).equals(200);
388
+ assert.equal(res.status, 200);
386
389
 
387
390
  const output = JSON.parse(res.body);
388
- o(output.title).equals(ts.title);
389
- o(output.collections[0].summaries['linz:zoom']).deepEquals({ min: 0, max: Nztm2000QuadTms.maxZoom });
391
+ assert.equal(output.title, ts.title);
392
+ assert.deepEqual(output.collections[0].summaries['linz:zoom'], { min: 0, max: Nztm2000QuadTms.maxZoom });
390
393
  });
391
394
  });
392
395
 
393
- o('should create valid coordinates', async () => {
396
+ it('should create valid coordinates', async () => {
394
397
  //bbox: BBox, files: NamedBounds[], proj: Projection
395
398
  const bbox = [174.79248047, -38.21228805, 175.25939941, -37.99616268] as BBox;
396
399
  const proj = Projection.get(GoogleTms);
397
400
  const coordinates = createCoordinates(bbox, Imagery3857.files, proj);
398
401
  console.log(JSON.stringify(coordinates));
399
- o(coordinates).deepEquals([
402
+ assert.deepEqual(coordinates, [
400
403
  [
401
404
  [
402
405
  [174.79247149, -38.09998972],
@@ -1,108 +1,112 @@
1
- import { base58, ConfigProviderMemory } from '@basemaps/config';
2
- import { getDefaultConfig } from '@basemaps/shared';
3
- import { fsa } from '@chunkd/fs';
4
- import o from 'ospec';
5
- import { createSandbox } from 'sinon';
1
+ import assert from 'node:assert';
2
+ import { afterEach, beforeEach, describe, it } from 'node:test';
3
+
4
+ import { base58, BaseConfig, ConfigProviderMemory } from '@basemaps/config';
5
+ import { setDefaultConfig } from '@basemaps/shared';
6
+ import { fsa, FsMemory } from '@chunkd/fs';
7
+
8
+ import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
6
9
  import { handler } from '../../index.js';
7
10
  import { CachedConfig } from '../../util/config.cache.js';
8
- import { ConfigLoader } from '../../util/config.loader.js';
9
11
  import { CoSources } from '../../util/source.cache.js';
10
- import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
11
12
  import { fontList } from '../fonts.js';
12
- import { FsMemory } from '@chunkd/source-memory';
13
13
 
14
- o.spec('/v1/fonts', () => {
14
+ describe('/v1/fonts', () => {
15
15
  const memory = new FsMemory();
16
- const sandbox = createSandbox();
17
16
  const config = new ConfigProviderMemory();
18
17
 
19
- o.before(() => {
18
+ beforeEach(() => {
19
+ config.objects.clear();
20
20
  fsa.register('memory://', memory);
21
+ config.assets = 'memory://assets/';
22
+ setDefaultConfig(config);
21
23
  });
22
24
 
23
- o.beforeEach(() => {
24
- config.assets = 'memory://';
25
- sandbox.stub(ConfigLoader, 'getDefaultConfig').resolves(config);
26
- });
27
-
28
- o.afterEach(() => {
29
- sandbox.restore();
25
+ afterEach(() => {
30
26
  CachedConfig.cache.clear();
31
27
  CoSources.cache.clear();
32
28
  memory.files.clear();
33
29
  });
34
30
 
35
- o('should return 404 if no font found', async () => {
31
+ it('should return 404 if no font found', async () => {
36
32
  const res = await fontList(mockRequest('/v1/fonts.json'));
37
- o(res.status).equals(404);
33
+ assert.equal(res.status, 404);
38
34
  });
39
35
 
40
- o('should return a list of fonts found', async () => {
41
- await fsa.write('memory://fonts/fonts.json', Buffer.from(JSON.stringify(['Roboto Black', 'Roboto Thin'])));
36
+ it('should return a list of fonts found', async () => {
37
+ await fsa.write(
38
+ new URL('memory://assets/fonts/fonts.json'),
39
+ Buffer.from(JSON.stringify(['Roboto Black', 'Roboto Thin'])),
40
+ );
42
41
  const res = await fontList(mockRequest('/v1/fonts.json'));
43
- o(res.status).equals(200);
44
- o(res.header('content-type')).equals('application/json');
45
- o(res.header('content-encoding')).equals(undefined);
46
- o(res._body?.toString()).equals(JSON.stringify(['Roboto Black', 'Roboto Thin']));
42
+ assert.equal(res.status, 200);
43
+ assert.equal(res.header('content-type'), 'application/json');
44
+ assert.equal(res.header('content-encoding'), undefined);
45
+ assert.equal(res._body?.toString(), JSON.stringify(['Roboto Black', 'Roboto Thin']));
47
46
  });
48
47
 
49
- o('should get the correct font', async () => {
50
- await fsa.write('memory://fonts/Roboto Thin/0-255.pbf', Buffer.from(''));
48
+ it('should get the correct font', async () => {
49
+ await fsa.write(new URL('memory://assets/fonts/Roboto Thin/0-255.pbf'), Buffer.from(''));
51
50
  const res255 = await handler.router.handle(mockRequest('/v1/fonts/Roboto Thin/0-255.pbf'));
52
- o(res255.status).equals(200);
53
- o(res255.header('content-type')).equals('application/x-protobuf');
54
- o(res255.header('content-encoding')).equals(undefined);
55
- o(res255.header('etag')).notEquals(undefined);
56
- o(res255.header('cache-control')).equals('public, max-age=604800, stale-while-revalidate=86400');
51
+ assert.equal(res255.status, 200);
52
+ assert.equal(res255.header('content-type'), 'application/x-protobuf');
53
+ assert.equal(res255.header('content-encoding'), undefined);
54
+ assert.notEqual(res255.header('etag'), undefined);
55
+ assert.equal(res255.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
57
56
 
58
57
  const res404 = await handler.router.handle(mockRequest('/v1/fonts/Roboto Thin/256-512.pbf'));
59
- o(res404.status).equals(404);
58
+ assert.equal(res404.status, 404);
60
59
  });
61
60
 
62
- o('should get the correct utf8 font', async () => {
63
- await fsa.write('memory://fonts/🦄 🌈/0-255.pbf', Buffer.from(''));
61
+ it('should get the correct utf8 font', async () => {
62
+ await fsa.write(new URL('memory://assets/fonts/🦄 🌈/0-255.pbf'), Buffer.from(''));
64
63
  const res255 = await handler.router.handle(mockRequest('/v1/fonts/🦄 🌈/0-255.pbf'));
65
- o(res255.status).equals(200);
66
- o(res255.header('content-type')).equals('application/x-protobuf');
67
- o(res255.header('content-encoding')).equals(undefined);
68
- o(res255.header('etag')).notEquals(undefined);
69
- o(res255.header('cache-control')).equals('public, max-age=604800, stale-while-revalidate=86400');
64
+ assert.equal(res255.status, 200);
65
+ assert.equal(res255.header('content-type'), 'application/x-protobuf');
66
+ assert.equal(res255.header('content-encoding'), undefined);
67
+ assert.notEqual(res255.header('etag'), undefined);
68
+ assert.equal(res255.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
70
69
  });
71
70
 
72
- o('should return 404 if no asset location set', async () => {
73
- getDefaultConfig().assets = undefined;
71
+ it('should return 404 if no asset location set', async () => {
72
+ config.assets = undefined;
74
73
  const res = await fontList(mockRequest('/v1/fonts.json'));
75
- o(res.status).equals(404);
74
+ assert.equal(res.status, 404);
76
75
  });
77
76
 
78
- o('should get the correct utf8 font with default assets', async () => {
79
- getDefaultConfig().assets = undefined;
80
- sandbox
81
- .stub(config.ConfigBundle, 'get')
82
- .resolves({ id: 'cb_latest', name: 'latest', path: 'latest', hash: 'hash', assets: 'memory://' });
83
- await fsa.write('memory://fonts/Roboto Thin/0-255.pbf', Buffer.from(''));
77
+ it('should get the correct utf8 font with default assets', async () => {
78
+ config.assets = undefined;
79
+ config.objects.set('cb_latest', {
80
+ id: 'cb_latest',
81
+ name: 'latest',
82
+ path: 'latest',
83
+ hash: 'hash',
84
+ assets: 'memory://new-location/',
85
+ } as BaseConfig);
86
+
87
+ await fsa.write(new URL('memory://new-location/fonts/Roboto Thin/0-255.pbf'), Buffer.from(''));
84
88
  const res255 = await handler.router.handle(mockRequest('/v1/fonts/Roboto Thin/0-255.pbf'));
85
- o(res255.status).equals(200);
86
- o(res255.header('content-type')).equals('application/x-protobuf');
87
- o(res255.header('content-encoding')).equals(undefined);
88
- o(res255.header('etag')).notEquals(undefined);
89
- o(res255.header('cache-control')).equals('public, max-age=604800, stale-while-revalidate=86400');
89
+ assert.equal(res255.status, 200, res255.statusDescription);
90
+ assert.equal(res255.header('content-type'), 'application/x-protobuf');
91
+ assert.equal(res255.header('content-encoding'), undefined);
92
+ assert.notEqual(res255.header('etag'), undefined);
93
+ assert.equal(res255.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
90
94
  });
91
95
 
92
- o('should get the correct utf8 font with config assets', async () => {
96
+ it('should get the correct utf8 font with config assets', async () => {
93
97
  const cfgBundle = new ConfigProviderMemory();
94
- cfgBundle.assets = 'memory://config/assets';
95
- await fsa.write('memory://linz-basemaps/bar.json', JSON.stringify(cfgBundle.toJson()));
96
- await fsa.write('memory://config/assets/fonts/🦄 🌈/0-255.pbf', Buffer.from(''));
98
+ cfgBundle.assets = 'memory://config/assets/';
99
+ await fsa.write(new URL('memory://linz-basemaps/bar.json'), JSON.stringify(cfgBundle.toJson()));
100
+ await fsa.write(new URL('memory://config/assets/fonts/🦄 🌈/0-255.pbf'), Buffer.from(''));
97
101
 
98
102
  const configLocation = base58.encode(Buffer.from('memory://linz-basemaps/bar.json'));
99
103
  const res255 = await handler.router.handle(
100
104
  mockUrlRequest('/v1/fonts/🦄 🌈/0-255.pbf', `?config=${configLocation}`, Api.header),
101
105
  );
102
- o(res255.status).equals(200);
103
- o(res255.header('content-type')).equals('application/x-protobuf');
104
- o(res255.header('content-encoding')).equals(undefined);
105
- o(res255.header('etag')).notEquals(undefined);
106
- o(res255.header('cache-control')).equals('public, max-age=604800, stale-while-revalidate=86400');
106
+ assert.equal(res255.status, 200);
107
+ assert.equal(res255.header('content-type'), 'application/x-protobuf');
108
+ assert.equal(res255.header('content-encoding'), undefined);
109
+ assert.notEqual(res255.header('etag'), undefined);
110
+ assert.equal(res255.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
107
111
  });
108
112
  });
@@ -1,12 +1,14 @@
1
+ import assert from 'node:assert';
2
+ import { afterEach, before, beforeEach, describe, it } from 'node:test';
3
+
1
4
  import { ConfigProviderMemory } from '@basemaps/config';
2
5
  import { LogConfig } from '@basemaps/shared';
3
6
  import { LambdaAlbRequest, LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
4
7
  import { Context } from 'aws-lambda';
5
- import o from 'ospec';
6
8
  import sinon from 'sinon';
7
- import { ConfigLoader } from '../../util/config.loader.js';
8
- import { FakeData } from '../../__tests__/config.data.js';
9
9
 
10
+ import { FakeData } from '../../__tests__/config.data.js';
11
+ import { ConfigLoader } from '../../util/config.loader.js';
10
12
  import { getTestBuffer, healthGet, TestTiles } from '../health.js';
11
13
  import { TileXyzRaster } from '../tile.xyz.raster.js';
12
14
 
@@ -22,24 +24,23 @@ const ctx: LambdaHttpRequest = new LambdaAlbRequest(
22
24
  LogConfig.get(),
23
25
  );
24
26
 
25
- o.spec('/v1/health', async () => {
26
- o.specTimeout(1000);
27
+ describe('/v1/health', async () => {
27
28
  const sandbox = sinon.createSandbox();
28
29
  const config = new ConfigProviderMemory();
29
30
 
30
31
  const fakeTileSet = FakeData.tileSetRaster('health');
31
- o.beforeEach(() => {
32
+ beforeEach(() => {
32
33
  config.objects.clear();
33
34
  sandbox.stub(ConfigLoader, 'getDefaultConfig').resolves(config);
34
35
  config.put(fakeTileSet);
35
36
  });
36
37
 
37
- o.afterEach(() => {
38
+ afterEach(() => {
38
39
  config.objects.clear();
39
40
  sandbox.restore();
40
41
  });
41
42
 
42
- o('Should return bad response', async () => {
43
+ it('Should return bad response', async () => {
43
44
  // Given ... a bad get tile response
44
45
  const BadResponse = new LambdaHttpResponse(500, 'Can not get Tile Set.');
45
46
  sandbox.stub(TileXyzRaster, 'tile').resolves(BadResponse);
@@ -48,14 +49,14 @@ o.spec('/v1/health', async () => {
48
49
  const res = await healthGet(ctx);
49
50
 
50
51
  // Then ...
51
- o(res.status).equals(500);
52
- o(res.statusDescription).equals('Can not get Tile Set.');
52
+ assert.equal(res.status, 500);
53
+ assert.equal(res.statusDescription, 'Can not get Tile Set.');
53
54
  });
54
55
 
55
56
  const Response1 = new LambdaHttpResponse(200, 'ok');
56
57
  const Response2 = new LambdaHttpResponse(200, 'ok');
57
58
 
58
- o.before(async () => {
59
+ before(async () => {
59
60
  const testTileFile1 = await getTestBuffer(TestTiles[0]);
60
61
  Response1.buffer(testTileFile1);
61
62
  const testTileFile2 = await getTestBuffer(TestTiles[1]);
@@ -63,7 +64,7 @@ o.spec('/v1/health', async () => {
63
64
  });
64
65
  // Prepare mock test tile response based on the static test tiles
65
66
 
66
- o('Should give a 200 response', async () => {
67
+ it('Should give a 200 response', async () => {
67
68
  // Given ... a series good get tile response
68
69
  const callback = sandbox.stub(TileXyzRaster, 'tile');
69
70
  callback.onCall(0).resolves(Response1);
@@ -73,11 +74,11 @@ o.spec('/v1/health', async () => {
73
74
  const res = await healthGet(ctx);
74
75
 
75
76
  // Then ...
76
- o(res.status).equals(200);
77
- o(res.statusDescription).equals('ok');
77
+ assert.equal(res.status, 200);
78
+ assert.equal(res.statusDescription, 'ok');
78
79
  });
79
80
 
80
- o('Should return mis-match tile response', async () => {
81
+ it('Should return mis-match tile response', async () => {
81
82
  // Given ... a bad get tile response for second get tile
82
83
  const callback = sandbox.stub(TileXyzRaster, 'tile');
83
84
  callback.onCall(0).resolves(Response1);
@@ -87,7 +88,7 @@ o.spec('/v1/health', async () => {
87
88
  const res = await healthGet(ctx);
88
89
 
89
90
  // Then ...
90
- o(res.status).equals(500);
91
- o(res.statusDescription).equals('TileSet does not match.');
91
+ assert.equal(res.status, 500);
92
+ assert.equal(res.statusDescription, 'TileSet does not match.');
92
93
  });
93
94
  });