@naturalcycles/backend-lib 5.13.0 → 5.14.1

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
@@ -6,7 +6,7 @@
6
6
  {
7
7
  "compilerOptions": {
8
8
  // Target/module
9
- "target": "es2022",
9
+ "target": "es2023",
10
10
  "lib": ["esnext"], // add "dom" if needed
11
11
  // module `nodenext` is a modern mode that auto-detects cjs/esm
12
12
  // it also defaults `esModuleInterop` and `allowSyntheticDefaultImports` to true
@@ -1,4 +1,4 @@
1
- import { UnixTimestampNumber } from '@naturalcycles/js-lib';
1
+ import type { UnixTimestamp } from '@naturalcycles/js-lib';
2
2
  export interface DeployInfo {
3
3
  gaeProject: string;
4
4
  gaeService: string;
@@ -10,7 +10,7 @@ export interface DeployInfo {
10
10
  /**
11
11
  * Unix timestamp of deployInfo.json being generated.
12
12
  */
13
- ts: UnixTimestampNumber;
13
+ ts: UnixTimestamp;
14
14
  }
15
15
  export interface AppYaml extends Record<string, any> {
16
16
  runtime: string;
@@ -22,6 +22,6 @@ function getDeployInfoStub(stub = '') {
22
22
  versionUrl: stub,
23
23
  gitBranch: stub,
24
24
  gitRev: stub,
25
- ts: Math.floor(Date.now() / 1000),
25
+ ts: js_lib_1.localTime.nowUnix(),
26
26
  };
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "5.13.0",
3
+ "version": "5.14.1",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build",
@@ -1,4 +1,4 @@
1
- import { UnixTimestampNumber } from '@naturalcycles/js-lib'
1
+ import type { UnixTimestamp } from '@naturalcycles/js-lib'
2
2
 
3
3
  export interface DeployInfo {
4
4
  gaeProject: string
@@ -12,7 +12,7 @@ export interface DeployInfo {
12
12
  /**
13
13
  * Unix timestamp of deployInfo.json being generated.
14
14
  */
15
- ts: UnixTimestampNumber
15
+ ts: UnixTimestamp
16
16
  }
17
17
 
18
18
  export interface AppYaml extends Record<string, any> {
@@ -1,5 +1,12 @@
1
1
  import { inspect, InspectOptions } from 'node:util'
2
- import { _filterFalsyValues, _ms, _since, getFetcher, pDelay } from '@naturalcycles/js-lib'
2
+ import {
3
+ _filterFalsyValues,
4
+ _ms,
5
+ _since,
6
+ getFetcher,
7
+ pDelay,
8
+ UnixTimestampMillis,
9
+ } from '@naturalcycles/js-lib'
3
10
  import { dimGrey, exec2, red } from '@naturalcycles/nodejs-lib'
4
11
  import { coloredHttpCode } from '../server/request.log.util'
5
12
 
@@ -126,7 +133,7 @@ export async function deployHealthCheck(
126
133
 
127
134
  console.log([`>>`, dimGrey(url), inspect({ attempt }, inspectOpt)].join(' '))
128
135
 
129
- const started = Date.now()
136
+ const started = Date.now() as UnixTimestampMillis
130
137
 
131
138
  const { err, statusCode = 0 } = await fetcher.doFetch({
132
139
  url,
@@ -8,9 +8,7 @@ import {
8
8
  StringMap,
9
9
  } from '@naturalcycles/js-lib'
10
10
  import { _inspect, InspectAnyOptions } from '@naturalcycles/nodejs-lib'
11
- // eslint-disable-next-line import-x/no-duplicates
12
11
  import type { Breadcrumb, NodeOptions, SeverityLevel } from '@sentry/node'
13
- // eslint-disable-next-line import-x/no-duplicates
14
12
  import type * as SentryLib from '@sentry/node'
15
13
  import { BackendErrorRequestHandler, BackendRequestHandler, getRequestLogger } from '../index'
16
14
 
@@ -1,4 +1,4 @@
1
- import { _memoFn } from '@naturalcycles/js-lib'
1
+ import { _memoFn, localTime } from '@naturalcycles/js-lib'
2
2
  import { fs2 } from '@naturalcycles/nodejs-lib'
3
3
  import type { DeployInfo } from '../deploy'
4
4
 
@@ -21,6 +21,6 @@ function getDeployInfoStub(stub = ''): DeployInfo {
21
21
  versionUrl: stub,
22
22
  gitBranch: stub,
23
23
  gitRev: stub,
24
- ts: Math.floor(Date.now() / 1000),
24
+ ts: localTime.nowUnix(),
25
25
  }
26
26
  }
@@ -1,4 +1,4 @@
1
- import { _since } from '@naturalcycles/js-lib'
1
+ import { _since, UnixTimestampMillis } from '@naturalcycles/js-lib'
2
2
  import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib'
3
3
  import { BackendRequestHandler, onFinished } from '../index'
4
4
  import { logRequest } from './request.log.util'
@@ -32,7 +32,7 @@ export function simpleRequestLoggerMiddleware(
32
32
  const { logStart, logFinish } = cfg
33
33
 
34
34
  return (req, res, next) => {
35
- const started = Date.now()
35
+ const started = Date.now() as UnixTimestampMillis
36
36
 
37
37
  if (logStart) {
38
38
  req.log(['>>', req.method, boldGrey(req.url)].join(' '))