@basemaps/lambda-tiler 6.29.0 → 6.30.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 (144) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/build/__tests__/config.data.d.ts +6 -0
  3. package/build/__tests__/config.data.d.ts.map +1 -0
  4. package/build/__tests__/config.data.js +81 -0
  5. package/build/__tests__/config.data.js.map +1 -0
  6. package/build/__tests__/index.test.js +4 -3
  7. package/build/__tests__/index.test.js.map +1 -0
  8. package/build/__tests__/route.test.js +1 -0
  9. package/build/__tests__/route.test.js.map +1 -0
  10. package/build/__tests__/tiff.cache.test.js +1 -0
  11. package/build/__tests__/tiff.cache.test.js.map +1 -0
  12. package/build/__tests__/tile.cache.key.test.js +1 -0
  13. package/build/__tests__/tile.cache.key.test.js.map +1 -0
  14. package/build/__tests__/tile.set.cache.test.js +2 -53
  15. package/build/__tests__/tile.set.cache.test.js.map +1 -0
  16. package/build/__tests__/tile.set.test.js +1 -0
  17. package/build/__tests__/tile.set.test.js.map +1 -0
  18. package/build/__tests__/tile.style.json.test.js +1 -0
  19. package/build/__tests__/tile.style.json.test.js.map +1 -0
  20. package/build/__tests__/wmts.capability.test.d.ts +1 -1
  21. package/build/__tests__/wmts.capability.test.d.ts.map +1 -1
  22. package/build/__tests__/wmts.capability.test.js +207 -128
  23. package/build/__tests__/wmts.capability.test.js.map +1 -0
  24. package/build/__tests__/xyz.test.js +6 -37
  25. package/build/__tests__/xyz.test.js.map +1 -0
  26. package/build/__tests__/xyz.util.d.ts +0 -2
  27. package/build/__tests__/xyz.util.d.ts.map +1 -1
  28. package/build/__tests__/xyz.util.js +7 -29
  29. package/build/__tests__/xyz.util.js.map +1 -0
  30. package/build/api.key.js +1 -0
  31. package/build/api.key.js.map +1 -0
  32. package/build/cli/dump.js +1 -0
  33. package/build/cli/dump.js.map +1 -0
  34. package/build/cli/tile.set.local.js +1 -0
  35. package/build/cli/tile.set.local.js.map +1 -0
  36. package/build/cotar.cache.d.ts +25 -0
  37. package/build/cotar.cache.d.ts.map +1 -0
  38. package/build/cotar.cache.js +50 -0
  39. package/build/cotar.cache.js.map +1 -0
  40. package/build/index.d.ts.map +1 -1
  41. package/build/index.js +31 -35
  42. package/build/index.js.map +1 -0
  43. package/build/router.js +1 -0
  44. package/build/router.js.map +1 -0
  45. package/build/routes/__tests__/attribution.test.js +5 -3
  46. package/build/routes/__tests__/attribution.test.js.map +1 -0
  47. package/build/routes/__tests__/fonts.test.js +9 -1
  48. package/build/routes/__tests__/fonts.test.js.map +1 -0
  49. package/build/routes/__tests__/health.test.js +1 -0
  50. package/build/routes/__tests__/health.test.js.map +1 -0
  51. package/build/routes/__tests__/imagery.test.js +1 -0
  52. package/build/routes/__tests__/imagery.test.js.map +1 -0
  53. package/build/routes/__tests__/memory.fs.js +1 -0
  54. package/build/routes/__tests__/memory.fs.js.map +1 -0
  55. package/build/routes/__tests__/sprites.test.js +1 -0
  56. package/build/routes/__tests__/sprites.test.js.map +1 -0
  57. package/build/routes/__tests__/wmts.test.js +59 -10
  58. package/build/routes/__tests__/wmts.test.js.map +1 -0
  59. package/build/routes/api.d.ts +0 -1
  60. package/build/routes/api.d.ts.map +1 -1
  61. package/build/routes/api.js +1 -3
  62. package/build/routes/api.js.map +1 -0
  63. package/build/routes/attribution.js +1 -0
  64. package/build/routes/attribution.js.map +1 -0
  65. package/build/routes/esri/rest.js +1 -0
  66. package/build/routes/esri/rest.js.map +1 -0
  67. package/build/routes/fonts.d.ts.map +1 -1
  68. package/build/routes/fonts.js +9 -1
  69. package/build/routes/fonts.js.map +1 -0
  70. package/build/routes/health.js +1 -0
  71. package/build/routes/health.js.map +1 -0
  72. package/build/routes/imagery.d.ts +8 -1
  73. package/build/routes/imagery.d.ts.map +1 -1
  74. package/build/routes/imagery.js +6 -7
  75. package/build/routes/imagery.js.map +1 -0
  76. package/build/routes/response.js +1 -0
  77. package/build/routes/response.js.map +1 -0
  78. package/build/routes/sprites.d.ts.map +1 -1
  79. package/build/routes/sprites.js +8 -14
  80. package/build/routes/sprites.js.map +1 -0
  81. package/build/routes/tile.etag.js +1 -0
  82. package/build/routes/tile.etag.js.map +1 -0
  83. package/build/routes/tile.js +1 -0
  84. package/build/routes/tile.js.map +1 -0
  85. package/build/routes/tile.json.d.ts.map +1 -1
  86. package/build/routes/tile.json.js +2 -2
  87. package/build/routes/tile.json.js.map +1 -0
  88. package/build/routes/tile.style.json.js +1 -0
  89. package/build/routes/tile.style.json.js.map +1 -0
  90. package/build/routes/tile.wmts.d.ts.map +1 -1
  91. package/build/routes/tile.wmts.js +19 -23
  92. package/build/routes/tile.wmts.js.map +1 -0
  93. package/build/routes/tile.xyz.js +1 -0
  94. package/build/routes/tile.xyz.js.map +1 -0
  95. package/build/source.tracer.js +1 -0
  96. package/build/source.tracer.js.map +1 -0
  97. package/build/tiff.cache.js +1 -0
  98. package/build/tiff.cache.js.map +1 -0
  99. package/build/tile.set.cache.d.ts +0 -1
  100. package/build/tile.set.cache.d.ts.map +1 -1
  101. package/build/tile.set.cache.js +1 -29
  102. package/build/tile.set.cache.js.map +1 -0
  103. package/build/tile.set.js +1 -0
  104. package/build/tile.set.js.map +1 -0
  105. package/build/tile.set.raster.d.ts.map +1 -1
  106. package/build/tile.set.raster.js +6 -3
  107. package/build/tile.set.raster.js.map +1 -0
  108. package/build/tile.set.vector.d.ts +0 -7
  109. package/build/tile.set.vector.d.ts.map +1 -1
  110. package/build/tile.set.vector.js +3 -20
  111. package/build/tile.set.vector.js.map +1 -0
  112. package/build/validate.js +1 -0
  113. package/build/validate.js.map +1 -0
  114. package/build/wmts.capability.d.ts +26 -12
  115. package/build/wmts.capability.d.ts.map +1 -1
  116. package/build/wmts.capability.js +136 -51
  117. package/build/wmts.capability.js.map +1 -0
  118. package/dist/index.js +86 -72
  119. package/dist/node_modules/.package-lock.json +1 -1
  120. package/dist/package-lock.json +2 -2
  121. package/dist/package.json +1 -1
  122. package/package.json +7 -7
  123. package/src/__tests__/config.data.ts +82 -0
  124. package/src/__tests__/index.test.ts +3 -3
  125. package/src/__tests__/tile.set.cache.test.ts +1 -67
  126. package/src/__tests__/wmts.capability.test.ts +224 -154
  127. package/src/__tests__/xyz.test.ts +5 -49
  128. package/src/__tests__/xyz.util.ts +6 -31
  129. package/src/cotar.cache.ts +54 -0
  130. package/src/index.ts +30 -33
  131. package/src/routes/__tests__/attribution.test.ts +4 -4
  132. package/src/routes/__tests__/fonts.test.ts +10 -1
  133. package/src/routes/__tests__/wmts.test.ts +75 -15
  134. package/src/routes/api.ts +0 -4
  135. package/src/routes/fonts.ts +9 -1
  136. package/src/routes/imagery.ts +9 -7
  137. package/src/routes/sprites.ts +7 -15
  138. package/src/routes/tile.json.ts +1 -2
  139. package/src/routes/tile.wmts.ts +20 -22
  140. package/src/tile.set.cache.ts +1 -28
  141. package/src/tile.set.raster.ts +4 -2
  142. package/src/tile.set.vector.ts +3 -21
  143. package/src/wmts.capability.ts +143 -58
  144. package/tsconfig.tsbuildinfo +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basemaps/lambda-tiler",
3
- "version": "6.29.0",
3
+ "version": "6.30.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@basemaps/lambda-tiler",
3
- "version": "6.29.0",
3
+ "version": "6.30.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@basemaps/lambda-tiler",
9
- "version": "6.29.0",
9
+ "version": "6.30.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "sharp": "0.30.7"
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basemaps/lambda-tiler",
3
- "version": "6.29.0",
3
+ "version": "6.30.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/linz/basemaps.git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basemaps/lambda-tiler",
3
- "version": "6.29.0",
3
+ "version": "6.30.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/linz/basemaps.git",
@@ -22,17 +22,17 @@
22
22
  "types": "./build/index.d.ts",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@basemaps/config": "^6.29.0",
25
+ "@basemaps/config": "^6.30.0",
26
26
  "@basemaps/geo": "^6.28.1",
27
27
  "@basemaps/lambda": "^6.7.0",
28
- "@basemaps/shared": "^6.29.0",
28
+ "@basemaps/shared": "^6.30.0",
29
29
  "@basemaps/tiler": "^6.29.0",
30
- "@basemaps/tiler-sharp": "^6.29.0",
30
+ "@basemaps/tiler-sharp": "^6.30.0",
31
31
  "@chunkd/fs": "^8.4.0",
32
32
  "@cogeotiff/core": "^7.0.0",
33
- "@cotar/core": "^5.3.0",
33
+ "@cotar/core": "^5.4.0",
34
34
  "@linzjs/geojson": "^6.28.1",
35
- "@linzjs/lambda": "^3.0.1",
35
+ "@linzjs/lambda": "^3.2.0",
36
36
  "p-limit": "^4.0.0",
37
37
  "path-to-regexp": "^6.1.0",
38
38
  "pixelmatch": "^5.1.0",
@@ -59,5 +59,5 @@
59
59
  "@types/sharp": "^0.30.3",
60
60
  "pretty-json-log": "^1.0.0"
61
61
  },
62
- "gitHead": "9097d2f045d734d0d5acd968f026fe29ab6afcda"
62
+ "gitHead": "c4858d318fd769e086a11e8b2a8f052b54964aab"
63
63
  }
@@ -0,0 +1,82 @@
1
+ import { ConfigTileSetRaster, TileSetType, ConfigImagery, ConfigProvider } from '@basemaps/config';
2
+ import { ImageFormat } from '@basemaps/geo';
3
+
4
+ export const TileSetAerial: ConfigTileSetRaster = {
5
+ id: 'ts_aerial',
6
+ name: 'aerial',
7
+ type: TileSetType.Raster,
8
+ format: ImageFormat.Webp,
9
+ description: 'aerial__description',
10
+ title: 'Aerial Imagery',
11
+ category: 'Basemap',
12
+ layers: [
13
+ {
14
+ 2193: 'im_01FYWKAJ86W9P7RWM1VB62KD0H',
15
+ 3857: 'im_01FYWKATAEK2ZTJQ2PX44Y0XNT',
16
+ title: 'Ōtorohanga 0.1m Urban Aerial Photos (2021)',
17
+ category: 'Urban Aerial Photos',
18
+ name: 'ōtorohanga_urban_2021_0-1m_RGB',
19
+ },
20
+ ],
21
+ };
22
+ export const Imagery2193: ConfigImagery = {
23
+ id: 'im_01FYWKAJ86W9P7RWM1VB62KD0H',
24
+ name: 'ōtorohanga_urban_2021_0-1m_RGB',
25
+ title: 'Ōtorohanga 0.1m Urban Aerial Photos (2021)',
26
+ category: 'Urban Aerial Photos',
27
+ projection: 2193,
28
+ tileMatrix: 'NZTM2000Quad',
29
+ uri: 's3://linz-basemaps/2193/ōtorohanga_urban_2021_0-1m_RGB/01FYWKAJ86W9P7RWM1VB62KD0H',
30
+ bounds: {
31
+ x: 1757351.3044652338,
32
+ y: 5766358.996410044,
33
+ width: 40970.247160854284,
34
+ height: 26905.833956381306,
35
+ },
36
+ files: [],
37
+ };
38
+ export const Imagery3857: ConfigImagery = {
39
+ id: 'im_01FYWKATAEK2ZTJQ2PX44Y0XNT',
40
+ name: 'ōtorohanga_urban_2021_0-1m_RGB',
41
+ title: 'Ōtorohanga 0.1m Urban Aerial Photos (2021)',
42
+ category: 'Urban Aerial Photos',
43
+ projection: 3857,
44
+ tileMatrix: 'WebMercatorQuad',
45
+ uri: 's3://linz-basemaps/3857/ōtorohanga_urban_2021_0-1m_RGB/01FYWKATAEK2ZTJQ2PX44Y0XNT',
46
+ bounds: {
47
+ x: 19457809.920274343,
48
+ y: -4609458.55370921,
49
+ width: 51977.179234057665,
50
+ height: 30574.81131407339,
51
+ },
52
+ files: [],
53
+ };
54
+
55
+ export const Provider: ConfigProvider = {
56
+ name: 'main',
57
+ id: 'pv_main_production',
58
+ updatedAt: Date.now(),
59
+ version: 1,
60
+ serviceIdentification: {
61
+ accessConstraints: 'the accessConstraints',
62
+ description: 'the description',
63
+ fees: 'the fees',
64
+ title: 'the title',
65
+ },
66
+ serviceProvider: {
67
+ contact: {
68
+ address: {
69
+ city: 'the city',
70
+ country: 'the country',
71
+ deliveryPoint: 'the deliveryPoint',
72
+ email: 'email address',
73
+ postalCode: 'the postalCode',
74
+ },
75
+ individualName: 'the contact name',
76
+ phone: 'the phone',
77
+ position: 'the position',
78
+ },
79
+ name: 'the name',
80
+ site: 'https://example.provider.com',
81
+ },
82
+ };
@@ -2,7 +2,7 @@ import { LogConfig } from '@basemaps/shared';
2
2
  import { LambdaAlbRequest, LambdaHttpRequest } from '@linzjs/lambda';
3
3
  import { Context } from 'aws-lambda';
4
4
  import o from 'ospec';
5
- import { handleRequest } from '../index.js';
5
+ import { handler } from '../index.js';
6
6
 
7
7
  o.spec('LambdaXyz index', () => {
8
8
  function req(path: string, method = 'get'): LambdaHttpRequest {
@@ -36,7 +36,7 @@ o.spec('LambdaXyz index', () => {
36
36
  process.env.GIT_VERSION = '1.2.3';
37
37
  process.env.GIT_HASH = 'abc456';
38
38
 
39
- const response = await handleRequest(req('/version'));
39
+ const response = await handler.router.handle(req('/v1/version'));
40
40
 
41
41
  o(response.status).equals(200);
42
42
  o(response.statusDescription).equals('ok');
@@ -49,7 +49,7 @@ o.spec('LambdaXyz index', () => {
49
49
  });
50
50
 
51
51
  o('should respond to /ping', async () => {
52
- const res = await handleRequest(req('/ping'));
52
+ const res = await handler.router.handle(req('/v1/ping'));
53
53
  o(res.status).equals(200);
54
54
  o(res.statusDescription).equals('ok');
55
55
  o(res.header('cache-control')).equals('no-store');
@@ -1,6 +1,5 @@
1
1
  import { ConfigImagery, ConfigTileSetRaster, TileSetType } from '@basemaps/config';
2
- import { Epsg, GoogleTms, Nztm2000Tms } from '@basemaps/geo';
3
- import { Config, TileSetName } from '@basemaps/shared';
2
+ import { GoogleTms } from '@basemaps/geo';
4
3
  import o from 'ospec';
5
4
  import sinon from 'sinon';
6
5
  import { TileSets } from '../tile.set.cache.js';
@@ -15,14 +14,6 @@ o.spec('TileSetCache', () => {
15
14
  uri: 's3://foo/bar',
16
15
  } as ConfigImagery;
17
16
 
18
- const imageTwo = {
19
- id: 'im_id2',
20
- name: 'wellington_urban_2018-19_0-3m',
21
- bounds: { x: 123, y: 456, width: 200, height: 300 },
22
- files: [{ name: 'foo', x: 123, y: 456, width: 200, height: 300 }],
23
- uri: 's3://foo/bar',
24
- } as ConfigImagery;
25
-
26
17
  const imgMap = new Map<string, ConfigImagery>();
27
18
  imgMap.set(imageOne.id, imageOne);
28
19
 
@@ -86,61 +77,4 @@ o.spec('TileSetCache', () => {
86
77
  o(subTileSet).equals(null);
87
78
  });
88
79
  });
89
-
90
- o.spec('loadTileSets', () => {
91
- o('load all', async () => {
92
- sandbox.stub(Config.TileSet, 'get');
93
-
94
- TileSets.add(new TileSetRaster('aerial', GoogleTms));
95
- TileSets.add(new TileSetRaster('aerial', Nztm2000Tms));
96
- const tileSets = await TileSets.getAll('aerial', null);
97
-
98
- o(tileSets.length).deepEquals(2);
99
-
100
- o(tileSets[0].fullName).equals(TileSetName.aerial);
101
- o(tileSets[0].components.name).equals(TileSetName.aerial);
102
- o(tileSets[0].tileMatrix.projection.code).equals(3857);
103
-
104
- o(tileSets[1].fullName).equals(TileSetName.aerial);
105
- o(tileSets[1].components.name).equals(TileSetName.aerial);
106
- o(tileSets[1].tileMatrix.projection.code).equals(2193);
107
- });
108
-
109
- o('load all subset projections', async () => {
110
- sandbox.stub(Config.TileSet, 'get');
111
-
112
- const ts1 = new TileSetRaster('aerial@head', Nztm2000Tms);
113
- ts1.imagery = imgMap;
114
- TileSets.add(ts1);
115
- const ts2 = new TileSetRaster('aerial@head', GoogleTms);
116
- ts2.imagery = imgMap;
117
- TileSets.add(ts2);
118
- const tileSets = await TileSets.getAll('aerial@head:tasman_rural_2018-19_0-3m', null);
119
-
120
- o(tileSets.length).deepEquals(2);
121
-
122
- o(tileSets[0].fullName).equals('aerial@head:tasman_rural_2018-19_0-3m');
123
- o(tileSets[0].tileMatrix.projection).equals(Epsg.Google);
124
- o(tileSets[1].fullName).equals('aerial@head:tasman_rural_2018-19_0-3m');
125
- o(tileSets[1].tileMatrix.projection).equals(Epsg.Nztm2000);
126
- });
127
-
128
- o('load all @tag', async () => {
129
- sandbox.stub(Config.TileSet, 'get');
130
- const imgMap = new Map();
131
- imgMap.set(imageOne.id, imageOne);
132
- imgMap.set(imageTwo.id, imageTwo);
133
- const ts1 = new TileSetRaster('aerial@head', Nztm2000Tms);
134
- ts1.imagery = imgMap;
135
- TileSets.add(ts1);
136
-
137
- const tileSets = await TileSets.getAll('aerial@head', null);
138
-
139
- o(tileSets.length).deepEquals(3);
140
-
141
- o(tileSets[0].fullName).equals('aerial@head');
142
- o(tileSets[1].fullName).equals('aerial@head:tasman_rural_2018-19_0-3m');
143
- o(tileSets[2].fullName).equals('aerial@head:wellington_urban_2018-19_0-3m');
144
- });
145
- });
146
80
  });