@basemaps/server 6.22.0 → 6.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [6.24.0](https://github.com/linz/basemaps/compare/v6.23.0...v6.24.0) (2022-04-05)
7
+
8
+ **Note:** Version bump only for package @basemaps/server
9
+
10
+
11
+
12
+
13
+
14
+ # [6.23.0](https://github.com/linz/basemaps/compare/v6.22.1...v6.23.0) (2022-04-04)
15
+
16
+ **Note:** Version bump only for package @basemaps/server
17
+
18
+
19
+
20
+
21
+
22
+ ## [6.22.1](https://github.com/linz/basemaps/compare/v6.22.0...v6.22.1) (2022-03-23)
23
+
24
+ **Note:** Version bump only for package @basemaps/server
25
+
26
+
27
+
28
+
29
+
6
30
  # [6.22.0](https://github.com/linz/basemaps/compare/v6.21.1...v6.22.0) (2022-03-20)
7
31
 
8
32
 
package/build/cli.d.ts CHANGED
@@ -5,11 +5,9 @@ export declare class BasemapsServerCommand extends Command {
5
5
  verbose: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
6
6
  port: import("@oclif/parser/lib/flags").IOptionFlag<number>;
7
7
  dynamo: flags.IOptionFlag<string | undefined>;
8
+ config: flags.IOptionFlag<string | undefined>;
8
9
  };
9
- static args: {
10
- name: string;
11
- required: boolean;
12
- }[];
10
+ static args: never[];
13
11
  loadFromPath(configPath: string, serverUrl: string): Promise<void>;
14
12
  run(): Promise<void>;
15
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAkBhD,qBAAa,qBAAsB,SAAQ,OAAO;IAChD,MAAM,CAAC,WAAW,SAAuD;IACzE,MAAM,CAAC,KAAK;;;;MAIV;IAEF,MAAM,CAAC,IAAI;;;QAA6C;IAElD,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8ClE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA0B3B"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAkBhD,qBAAa,qBAAsB,SAAQ,OAAO;IAChD,MAAM,CAAC,WAAW,SAAuD;IACzE,MAAM,CAAC,KAAK;;;;;MAKV;IAEF,MAAM,CAAC,IAAI,UAAM;IAEX,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8ClE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAsB3B"}
package/build/cli.js CHANGED
@@ -64,15 +64,13 @@ export class BasemapsServerCommand extends Command {
64
64
  }
65
65
  async run() {
66
66
  var _a;
67
- const { args, flags } = this.parse(BasemapsServerCommand);
67
+ const { flags } = this.parse(BasemapsServerCommand);
68
68
  if (flags.verbose)
69
69
  logger.level = 'debug';
70
- if (args.configPath == null && flags.dynamo == null) {
71
- }
72
70
  const ServerUrl = `http://localhost:${flags.port}`;
73
- if (args.configPath != null) {
74
- logger.info({ path: args.configPath }, 'Starting Server');
75
- await this.loadFromPath(args.configPath, ServerUrl);
71
+ if (flags.config != null) {
72
+ logger.info({ path: flags.config }, 'Starting Server');
73
+ await this.loadFromPath(flags.config, ServerUrl);
76
74
  }
77
75
  else if (flags.dynamo != null) {
78
76
  logger.info({ dynamo: flags.dynamo }, 'Starting Server');
@@ -93,5 +91,6 @@ BasemapsServerCommand.flags = {
93
91
  verbose: flags.boolean(),
94
92
  port: flags.integer({ default: 5000 }),
95
93
  dynamo: flags.string({ description: 'Dynamodb table', required: false }),
94
+ config: flags.string({ description: 'Configuration path', required: false }),
96
95
  };
97
- BasemapsServerCommand.args = [{ name: 'configPath', required: false }];
96
+ BasemapsServerCommand.args = [];
package/build/server.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export declare const BasemapsServer: import("express-serve-static-core").Express;
1
+ /// <reference types="node" />
2
+ export declare const BasemapsServer: import("fastify").FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").FastifyLoggerInstance> & PromiseLike<import("fastify").FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").FastifyLoggerInstance>>;
2
3
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,6CAAY,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,cAAc,kVAAY,CAAC"}
package/build/server.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { handler } from '@basemaps/lambda-tiler';
2
- import ulid from 'ulid';
3
- import express from 'express';
4
2
  import { lf } from '@linzjs/lambda';
5
- export const BasemapsServer = express();
3
+ import fastify from 'fastify';
4
+ import ulid from 'ulid';
5
+ export const BasemapsServer = fastify();
6
6
  function isAlbResult(r) {
7
7
  if (typeof r !== 'object')
8
8
  return false;
@@ -15,25 +15,27 @@ BasemapsServer.get('/v1/*', async (req, res) => {
15
15
  const event = {
16
16
  httpMethod: 'GET',
17
17
  requestContext: { elb: { targetGroupArn: 'arn:fake' } },
18
- path: req.path,
18
+ path: req.url,
19
19
  headers: req.headers,
20
20
  queryStringParameters: req.query,
21
21
  body: null,
22
22
  isBase64Encoded: false,
23
23
  };
24
- if (req.query['api'] == null)
25
- req.query['api'] = 'c' + instanceId;
24
+ if (req.query.api == null)
25
+ req.query.api = 'c' + instanceId;
26
26
  handler(event, {}, (err, r) => {
27
27
  var _a;
28
28
  if (err || !isAlbResult(r)) {
29
29
  lf.Logger.fatal({ err }, 'RequestFailed');
30
- return res.end(err);
30
+ res.send(err);
31
+ return;
31
32
  }
32
33
  res.status(r.statusCode);
33
34
  for (const [key, value] of Object.entries((_a = r.headers) !== null && _a !== void 0 ? _a : {}))
34
35
  res.header(key, String(value));
35
36
  if (r.body)
36
37
  res.send(Buffer.from(r.body, r.isBase64Encoded ? 'base64' : 'utf8'));
37
- res.end();
38
+ else
39
+ res.send('Not found');
38
40
  });
39
41
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basemaps/server",
3
- "version": "6.22.0",
3
+ "version": "6.24.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/linz/basemaps.git",
@@ -34,15 +34,12 @@
34
34
  "dependencies": {
35
35
  "@basemaps/config": "^6.21.1",
36
36
  "@basemaps/geo": "^6.21.1",
37
- "@basemaps/lambda-tiler": "^6.22.0",
38
- "@basemaps/shared": "^6.22.0",
37
+ "@basemaps/lambda-tiler": "^6.24.0",
38
+ "@basemaps/shared": "^6.23.0",
39
39
  "@linzjs/lambda": "^2.0.0",
40
40
  "@oclif/command": "^1.8.0",
41
- "express": "^4.17.1",
41
+ "fastify": "^3.27.4",
42
42
  "pretty-json-log": "^1.0.0"
43
43
  },
44
- "devDependencies": {
45
- "@types/express": "^4.17.13"
46
- },
47
- "gitHead": "b85a4a628bcdfea657a37de97faa23dde5c34798"
44
+ "gitHead": "8cfdb4b9821ae3e35e1fd56a551ed489817422a9"
48
45
  }