@naturalcycles/backend-lib 3.1.0 → 3.5.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.
@@ -7,7 +7,7 @@ const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
7
7
  const time_lib_1 = require("@naturalcycles/time-lib");
8
8
  const yaml = require("js-yaml");
9
9
  const APP_YAML_DEFAULT = () => ({
10
- runtime: 'nodejs14',
10
+ runtime: 'nodejs16',
11
11
  service: 'default',
12
12
  inbound_services: ['warmup'],
13
13
  instance_class: 'F1',
@@ -47,6 +47,8 @@ const DEFAULT_FILES = [
47
47
  'tsconfig.dist.json',
48
48
  '.gcloudignore',
49
49
  'app.yaml',
50
+ 'patches',
51
+ 'resources',
50
52
  ];
51
53
  const defaultFilesDir = `${paths_cnst_1.srcDir}/deploy/files-default`;
52
54
  async function deployPrepare(opt = {}) {
@@ -1,2 +1,2 @@
1
1
  import type { DeployInfo } from '../deploy';
2
- export declare const getDeployInfo: ((projectDir: string) => DeployInfo) & import("@naturalcycles/js-lib/dist/decorators/memoFn").MemoizedFunction;
2
+ export declare const getDeployInfo: ((projectDir: string) => DeployInfo) & import("@naturalcycles/js-lib").MemoizedFunction;
@@ -36,7 +36,12 @@ exports.genericErrorMiddleware = genericErrorMiddleware;
36
36
  function respondWithError(req, res, err) {
37
37
  var _a, _b;
38
38
  const { headersSent } = res;
39
- req.error(`genericErrorHandler${headersSent ? ' after headersSent' : ''}:\n`, err);
39
+ if (headersSent) {
40
+ req.error(`after headersSent`, err);
41
+ }
42
+ else {
43
+ req.error(err);
44
+ }
40
45
  const originalError = (0, js_lib_1._anyToError)(err, Error, {
41
46
  stringifyFn: nodejs_lib_1.inspectAnyStringifyFn,
42
47
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "3.1.0",
3
+ "version": "3.5.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install && patch-package",
6
6
  "serve": "APP_ENV=dev nodemon",
@@ -45,7 +45,6 @@
45
45
  "@types/ejs": "^3.0.0",
46
46
  "@types/js-yaml": "^4.0.0",
47
47
  "@types/node": "^16.4.1",
48
- "esbuild": "^0.13.13",
49
48
  "esbuild-register": "^3.1.2",
50
49
  "fastify": "^3.20.1",
51
50
  "jest": "^27.0.1",
@@ -85,7 +84,7 @@
85
84
  "url": "https://github.com/NaturalCycles/backend-lib"
86
85
  },
87
86
  "engines": {
88
- "node": ">=14.15.0"
87
+ "node": ">=16.13.0"
89
88
  },
90
89
  "type": "commonjs",
91
90
  "description": "Standard library for making Express.js / AppEngine based backend services",
@@ -8,7 +8,7 @@ import { BackendCfg } from './backend.cfg.util'
8
8
  import { AppYaml, DeployInfo } from './deploy.model'
9
9
 
10
10
  const APP_YAML_DEFAULT = (): AppYaml => ({
11
- runtime: 'nodejs14',
11
+ runtime: 'nodejs16',
12
12
  service: 'default',
13
13
  inbound_services: ['warmup'],
14
14
  instance_class: 'F1',
@@ -59,6 +59,8 @@ const DEFAULT_FILES = [
59
59
  'tsconfig.dist.json',
60
60
  '.gcloudignore',
61
61
  'app.yaml',
62
+ 'patches', // to allow patch-package
63
+ 'resources',
62
64
  ]
63
65
 
64
66
  const defaultFilesDir = `${srcDir}/deploy/files-default`
@@ -53,7 +53,11 @@ export function genericErrorMiddleware(
53
53
  export function respondWithError(req: BackendRequest, res: BackendResponse, err: any): void {
54
54
  const { headersSent } = res
55
55
 
56
- req.error(`genericErrorHandler${headersSent ? ' after headersSent' : ''}:\n`, err)
56
+ if (headersSent) {
57
+ req.error(`after headersSent`, err)
58
+ } else {
59
+ req.error(err)
60
+ }
57
61
 
58
62
  const originalError = _anyToError(err, Error, {
59
63
  stringifyFn: inspectAnyStringifyFn,