@naturalcycles/backend-lib 4.4.3 → 4.5.2

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/cfg/tsconfig.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "noFallthroughCasesInSwitch": true,
21
21
  "forceConsistentCasingInFileNames": true,
22
22
  "resolveJsonModule": true,
23
- "suppressImplicitAnyIndexErrors": true,
23
+ "suppressImplicitAnyIndexErrors": false,
24
24
  "noImplicitOverride": true,
25
25
  "noUncheckedIndexedAccess": true,
26
26
  "noPropertyAccessFromIndexSignature": true,
@@ -32,7 +32,7 @@ async function createAndSaveDeployInfo(backendCfg, targetDir) {
32
32
  }
33
33
  exports.createAndSaveDeployInfo = createAndSaveDeployInfo;
34
34
  async function createDeployInfo(backendCfg) {
35
- const simpleGit = require('simple-git/promise'); // lazy load
35
+ const simpleGit = require('simple-git'); // lazy load
36
36
  const git = simpleGit('.');
37
37
  const now = (0, js_lib_1.localTime)();
38
38
  const gitBranch = (await git.status()).current;
@@ -35,8 +35,6 @@ function redact(redactPaths, obj, error) {
35
35
  .map(path => (0, js_lib_1._get)(obj, path))
36
36
  .filter(Boolean)
37
37
  .forEach(secret => {
38
- if (secret) {
39
- error.message = error.message.replace(secret, REDACTED);
40
- }
38
+ error.message = error.message.replace(secret, REDACTED);
41
39
  });
42
40
  }
@@ -52,8 +52,6 @@ function redact(redactPaths, obj, error) {
52
52
  .map(path => (0, js_lib_1._get)(obj, path))
53
53
  .filter(Boolean)
54
54
  .forEach(secret => {
55
- if (secret) {
56
- error.message = error.message.replace(secret, REDACTED);
57
- }
55
+ error.message = error.message.replace(secret, REDACTED);
58
56
  });
59
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "4.4.3",
3
+ "version": "4.5.2",
4
4
  "scripts": {
5
5
  "prepare": "husky install && patch-package",
6
6
  "serve": "APP_ENV=dev nodemon",
@@ -29,7 +29,7 @@
29
29
  "ejs": "^3.0.1",
30
30
  "express": "^4.16.4",
31
31
  "express-promise-router": "^4.0.0",
32
- "firebase-admin": "^10.0.0",
32
+ "firebase-admin": "^11.0.0",
33
33
  "fs-extra": "^10.0.0",
34
34
  "helmet": "^5.0.0",
35
35
  "js-yaml": "^4.0.0",
@@ -39,12 +39,12 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@naturalcycles/bench-lib": "^1.0.7",
42
- "@naturalcycles/dev-lib": "^12.0.3",
42
+ "@naturalcycles/dev-lib": "^13.0.0",
43
43
  "@sentry/node": "^7.0.0",
44
44
  "@types/ejs": "^3.0.0",
45
45
  "@types/js-yaml": "^4.0.0",
46
- "@types/node": "^17.0.0",
47
- "fastify": "^3.20.1",
46
+ "@types/node": "^18.0.0",
47
+ "fastify": "^4.0.0",
48
48
  "jest": "^28.0.3",
49
49
  "nodemon": "^2.0.14",
50
50
  "patch-package": "^6.2.1",
@@ -40,7 +40,7 @@ export async function createAndSaveDeployInfo(
40
40
  }
41
41
 
42
42
  export async function createDeployInfo(backendCfg: BackendCfg): Promise<DeployInfo> {
43
- const simpleGit = require('simple-git/promise') as typeof simpleGitLib // lazy load
43
+ const simpleGit = require('simple-git') as typeof simpleGitLib // lazy load
44
44
  const git = simpleGit('.')
45
45
 
46
46
  const now = localTime()
@@ -59,8 +59,6 @@ function redact(redactPaths: string[], obj: any, error: Error): void {
59
59
  .map(path => _get(obj, path))
60
60
  .filter(Boolean)
61
61
  .forEach(secret => {
62
- if (secret) {
63
- error.message = error.message.replace(secret, REDACTED)
64
- }
62
+ error.message = error.message.replace(secret, REDACTED)
65
63
  })
66
64
  }
@@ -1,4 +1,6 @@
1
1
  import { Server } from 'http'
2
+ import { Socket } from 'net'
3
+ import { StringMap } from '@naturalcycles/js-lib'
2
4
 
3
5
  export interface DestroyableServer extends Server {
4
6
  destroy(): Promise<void>
@@ -10,7 +12,7 @@ export interface DestroyableServer extends Server {
10
12
  * @experimental
11
13
  */
12
14
  export function enableDestroy(server: Server): DestroyableServer {
13
- const connections = {}
15
+ const connections: StringMap<Socket> = {}
14
16
  const srv = server as DestroyableServer
15
17
 
16
18
  srv.on('connection', function (conn) {
@@ -23,7 +25,7 @@ export function enableDestroy(server: Server): DestroyableServer {
23
25
  // let started = Date.now()
24
26
  const p = new Promise(resolve => server.close(resolve))
25
27
  for (const key of Object.keys(connections)) {
26
- connections[key].destroy()
28
+ connections[key]!.destroy()
27
29
  }
28
30
  await p
29
31
  // console.log(`destroyed ${Object.keys(connections).length} con(s) in ${_since(started)}`)
@@ -31,7 +31,7 @@ interface Stat {
31
31
  const serverStatsMap: StringMap<Stat> = {}
32
32
 
33
33
  const percentiles = [50, 90, 99]
34
- const families = ['2xx', '4xx', '5xx']
34
+ const families: (keyof Stat)[] = ['2xx', '4xx', '5xx']
35
35
 
36
36
  // Store this number of last latencies
37
37
  const SIZE = 50
@@ -74,8 +74,6 @@ function redact(redactPaths: string[], obj: any, error: Error): void {
74
74
  .map(path => _get(obj, path))
75
75
  .filter(Boolean)
76
76
  .forEach(secret => {
77
- if (secret) {
78
- error.message = error.message.replace(secret, REDACTED)
79
- }
77
+ error.message = error.message.replace(secret, REDACTED)
80
78
  })
81
79
  }