@naturalcycles/backend-lib 4.18.6 → 4.18.7

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseAdminService = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
5
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
6
  const adminInfoDisabled = () => ({
7
7
  email: 'authDisabled',
8
8
  permissions: [],
@@ -35,7 +35,7 @@ class BaseAdminService {
35
35
  getEmailPermissions(email) {
36
36
  if (!email)
37
37
  return;
38
- console.log(`getEmailPermissions (${(0, colors_1.dimGrey)(email)}) returning undefined (please override the implementation)`);
38
+ console.log(`getEmailPermissions (${(0, nodejs_lib_1.dimGrey)(email)}) returning undefined (please override the implementation)`);
39
39
  return;
40
40
  }
41
41
  /**
@@ -43,7 +43,7 @@ class BaseAdminService {
43
43
  */
44
44
  // eslint-disable-next-line max-params
45
45
  async onPermissionCheck(req, email, reqPermissions, required, granted, meta = {}) {
46
- req.log(`${(0, colors_1.dimGrey)(email)} ${required ? 'required' : 'optional'} permissions check [${(0, colors_1.dimGrey)(reqPermissions.join(', '))}]: ${granted ? (0, colors_1.green)('GRANTED') : (0, colors_1.red)('DENIED')}`, meta);
46
+ req.log(`${(0, nodejs_lib_1.dimGrey)(email)} ${required ? 'required' : 'optional'} permissions check [${(0, nodejs_lib_1.dimGrey)(reqPermissions.join(', '))}]: ${granted ? (0, nodejs_lib_1.green)('GRANTED') : (0, nodejs_lib_1.red)('DENIED')}`, meta);
47
47
  }
48
48
  async getEmailByToken(req, adminToken) {
49
49
  if (!adminToken)
@@ -51,7 +51,7 @@ class BaseAdminService {
51
51
  try {
52
52
  const decodedToken = await this.firebaseAuth.verifyIdToken(adminToken);
53
53
  const email = decodedToken?.email;
54
- req.log(`admin email: ${(0, colors_1.dimGrey)(email)}`);
54
+ req.log(`admin email: ${(0, nodejs_lib_1.dimGrey)(email)}`);
55
55
  return email;
56
56
  }
57
57
  catch (err) {
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const script_1 = require("@naturalcycles/nodejs-lib/dist/script");
4
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
5
  const yargs = require("yargs");
6
6
  const deployGae_1 = require("../deploy/deployGae");
7
7
  const deployHealthCheck_1 = require("../deploy/deployHealthCheck");
8
8
  const deployPrepare_1 = require("../deploy/deployPrepare");
9
- (0, script_1.runScript)(async () => {
9
+ (0, nodejs_lib_1.runScript)(async () => {
10
10
  const opt = yargs.options({
11
11
  ...deployPrepare_1.deployPrepareYargsOptions,
12
12
  ...deployHealthCheck_1.deployHealthCheckYargsOptions,
@@ -9,10 +9,10 @@ yarn deploy-health-check --url https://service-dot-yourproject.appspot.com
9
9
 
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const script_1 = require("@naturalcycles/nodejs-lib/dist/script");
12
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
13
13
  const yargs = require("yargs");
14
14
  const deployHealthCheck_1 = require("../deploy/deployHealthCheck");
15
- (0, script_1.runScript)(async () => {
15
+ (0, nodejs_lib_1.runScript)(async () => {
16
16
  const { url, ...opt } = yargs.options({
17
17
  ...deployHealthCheck_1.deployHealthCheckYargsOptions,
18
18
  url: {
@@ -6,10 +6,10 @@ yarn deploy-prepare
6
6
 
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- const script_1 = require("@naturalcycles/nodejs-lib/dist/script");
9
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
10
10
  const yargs = require("yargs");
11
11
  const deployPrepare_1 = require("../deploy/deployPrepare");
12
- (0, script_1.runScript)(async () => {
12
+ (0, nodejs_lib_1.runScript)(async () => {
13
13
  const opt = yargs.options(deployPrepare_1.deployPrepareYargsOptions).argv;
14
14
  await (0, deployPrepare_1.deployPrepare)(opt);
15
15
  });
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateGAEServiceName = exports.createAppYaml = exports.createAndSaveAppYaml = exports.createDeployInfo = exports.createAndSaveDeployInfo = void 0;
4
4
  const fs = require("node:fs");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
6
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
7
7
  const yaml = require("js-yaml");
8
8
  const APP_YAML_DEFAULT = () => ({
9
9
  runtime: 'nodejs18',
@@ -27,7 +27,7 @@ async function createAndSaveDeployInfo(backendCfg, targetDir) {
27
27
  const deployInfo = await createDeployInfo(backendCfg);
28
28
  const deployInfoPath = `${targetDir}/deployInfo.json`;
29
29
  fs.writeFileSync(deployInfoPath, JSON.stringify(deployInfo, null, 2));
30
- console.log(`saved ${(0, colors_1.dimGrey)(deployInfoPath)}`);
30
+ console.log(`saved ${(0, nodejs_lib_1.dimGrey)(deployInfoPath)}`);
31
31
  return deployInfo;
32
32
  }
33
33
  exports.createAndSaveDeployInfo = createAndSaveDeployInfo;
@@ -74,7 +74,7 @@ function createAndSaveAppYaml(backendCfg, deployInfo, projectDir, targetDir, app
74
74
  const appYaml = createAppYaml(backendCfg, deployInfo, projectDir, appYamlPassEnv);
75
75
  const appYamlPath = `${targetDir}/app.yaml`;
76
76
  fs.writeFileSync(appYamlPath, yaml.dump(appYaml));
77
- console.log(`saved ${(0, colors_1.dimGrey)(appYamlPath)}`);
77
+ console.log(`saved ${(0, nodejs_lib_1.dimGrey)(appYamlPath)}`);
78
78
  return appYaml;
79
79
  }
80
80
  exports.createAndSaveAppYaml = createAndSaveAppYaml;
@@ -84,18 +84,18 @@ function createAppYaml(backendCfg, deployInfo, projectDir, appYamlPassEnv = '')
84
84
  const { APP_ENV: processAppEnv } = process.env;
85
85
  const APP_ENV = processAppEnv || appEnvByBranch[gitBranch] || appEnvDefault;
86
86
  if (processAppEnv) {
87
- console.log(`using APP_ENV=${(0, colors_1.dimGrey)(processAppEnv)} from process.env`);
87
+ console.log(`using APP_ENV=${(0, nodejs_lib_1.dimGrey)(processAppEnv)} from process.env`);
88
88
  }
89
89
  const appYaml = APP_YAML_DEFAULT();
90
90
  // Check existing app.yaml
91
91
  const appYamlPath = `${projectDir}/app.yaml`;
92
92
  if (fs.existsSync(appYamlPath)) {
93
- console.log(`merging-in ${(0, colors_1.dimGrey)(appYamlPath)}`);
93
+ console.log(`merging-in ${(0, nodejs_lib_1.dimGrey)(appYamlPath)}`);
94
94
  (0, js_lib_1._merge)(appYaml, yaml.load(fs.readFileSync(appYamlPath, 'utf8')));
95
95
  }
96
96
  const appEnvYamlPath = `${projectDir}/app.${APP_ENV}.yaml`;
97
97
  if (fs.existsSync(appEnvYamlPath)) {
98
- console.log(`merging-in ${(0, colors_1.dimGrey)(appEnvYamlPath)}`);
98
+ console.log(`merging-in ${(0, nodejs_lib_1.dimGrey)(appEnvYamlPath)}`);
99
99
  (0, js_lib_1._merge)(appYaml, yaml.load(fs.readFileSync(appEnvYamlPath, 'utf8')));
100
100
  }
101
101
  // appYamlPassEnv
@@ -113,7 +113,7 @@ function createAppYaml(backendCfg, deployInfo, projectDir, appYamlPassEnv = '')
113
113
  return map;
114
114
  }, {});
115
115
  if (Object.keys(passEnv).length) {
116
- console.log(`will merge ${(0, colors_1.white)(String(Object.keys(passEnv).length))} process.env keys to app.yaml: ${(0, colors_1.dimGrey)(Object.keys(passEnv).join(', '))}`);
116
+ console.log(`will merge ${(0, nodejs_lib_1.white)(String(Object.keys(passEnv).length))} process.env keys to app.yaml: ${(0, nodejs_lib_1.dimGrey)(Object.keys(passEnv).join(', '))}`);
117
117
  }
118
118
  (0, js_lib_1._merge)(appYaml, {
119
119
  service,
@@ -4,7 +4,7 @@ exports.deployHealthCheck = exports.deployHealthCheckYargsOptions = void 0;
4
4
  const node_util_1 = require("node:util");
5
5
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
6
  const js_lib_1 = require("@naturalcycles/js-lib");
7
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
7
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
8
8
  const request_log_util_1 = require("../server/request.log.util");
9
9
  exports.deployHealthCheckYargsOptions = {
10
10
  thresholdHealthy: {
@@ -70,7 +70,7 @@ async function deployHealthCheck(url, opt = {}) {
70
70
  await makeAttempt();
71
71
  }
72
72
  if (failed) {
73
- console.log((0, colors_1.red)(`Health check failed!`));
73
+ console.log((0, nodejs_lib_2.red)(`Health check failed!`));
74
74
  if (logOnFailure) {
75
75
  try {
76
76
  (0, nodejs_lib_1.execVoidCommandSync)(`gcloud app logs read --project ${gaeProject} --service ${gaeService} --version ${gaeVersion}`, [], { shell: true });
@@ -87,7 +87,7 @@ async function deployHealthCheck(url, opt = {}) {
87
87
  }
88
88
  async function makeAttempt() {
89
89
  attempt++;
90
- console.log([`>>`, (0, colors_1.dimGrey)(url), (0, node_util_1.inspect)({ attempt }, inspectOpt)].join(' '));
90
+ console.log([`>>`, (0, nodejs_lib_2.dimGrey)(url), (0, node_util_1.inspect)({ attempt }, inspectOpt)].join(' '));
91
91
  const started = Date.now();
92
92
  const { err, statusCode = 0 } = await fetcher.doFetch({
93
93
  url,
@@ -123,7 +123,7 @@ async function deployHealthCheck(url, opt = {}) {
123
123
  console.log([
124
124
  `<< HTTP`,
125
125
  (0, request_log_util_1.coloredHttpCode)(statusCode),
126
- (0, colors_1.dimGrey)((0, js_lib_1._since)(started)),
126
+ (0, nodejs_lib_2.dimGrey)((0, js_lib_1._since)(started)),
127
127
  (0, node_util_1.inspect)((0, js_lib_1._filterFalsyValues)({ countHealthy, countUnhealthy }), inspectOpt),
128
128
  ].join(' '));
129
129
  if (attempt >= maxTries) {
@@ -135,7 +135,7 @@ async function deployHealthCheck(url, opt = {}) {
135
135
  console.log(doneReason);
136
136
  }
137
137
  else {
138
- console.log((0, colors_1.dimGrey)(`... waiting ${(0, js_lib_1._ms)(currentInterval)} ...`));
138
+ console.log((0, nodejs_lib_2.dimGrey)(`... waiting ${(0, js_lib_1._ms)(currentInterval)} ...`));
139
139
  await (0, js_lib_1.pDelay)(currentInterval);
140
140
  }
141
141
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deployPrepare = exports.deployPrepareYargsOptions = void 0;
4
4
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
6
- const fs_1 = require("@naturalcycles/nodejs-lib/dist/fs");
5
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
6
+ const nodejs_lib_3 = require("@naturalcycles/nodejs-lib");
7
7
  const paths_cnst_1 = require("../paths.cnst");
8
8
  const backend_cfg_util_1 = require("./backend.cfg.util");
9
9
  const deploy_util_1 = require("./deploy.util");
@@ -58,15 +58,15 @@ async function deployPrepare(opt = {}) {
58
58
  const backendCfg = (0, backend_cfg_util_1.getBackendCfg)(projectDir);
59
59
  const inputPatterns = backendCfg.files || DEFAULT_FILES;
60
60
  const appYamlPassEnv = opt.appYamlPassEnv || backendCfg.appYamlPassEnv;
61
- console.log(`1. Copy files to ${(0, colors_1.dimGrey)(targetDir)}`);
61
+ console.log(`1. Copy files to ${(0, nodejs_lib_2.dimGrey)(targetDir)}`);
62
62
  // Clean targetDir
63
63
  (0, nodejs_lib_1._emptyDirSync)(targetDir);
64
- (0, fs_1.kpySync)({
64
+ (0, nodejs_lib_3.kpySync)({
65
65
  baseDir: defaultFilesDir,
66
66
  outputDir: targetDir,
67
67
  dotfiles: true,
68
68
  });
69
- (0, fs_1.kpySync)({
69
+ (0, nodejs_lib_3.kpySync)({
70
70
  baseDir: projectDir,
71
71
  inputPatterns,
72
72
  outputDir: targetDir,
@@ -78,7 +78,7 @@ async function deployPrepare(opt = {}) {
78
78
  const npmrc = `//registry.npmjs.org/:_authToken=${NPM_TOKEN}`;
79
79
  (0, nodejs_lib_1._writeFileSync)(npmrcPath, npmrc);
80
80
  }
81
- console.log(`2. Generate ${(0, colors_1.dimGrey)('deployInfo.json')} and ${(0, colors_1.dimGrey)('app.yaml')} in targetDir`);
81
+ console.log(`2. Generate ${(0, nodejs_lib_2.dimGrey)('deployInfo.json')} and ${(0, nodejs_lib_2.dimGrey)('app.yaml')} in targetDir`);
82
82
  const deployInfo = await (0, deploy_util_1.createAndSaveDeployInfo)(backendCfg, targetDir);
83
83
  (0, deploy_util_1.createAndSaveAppYaml)(backendCfg, deployInfo, projectDir, targetDir, appYamlPassEnv);
84
84
  return deployInfo;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EnvSharedService = void 0;
4
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
4
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
5
  class EnvSharedService {
6
6
  constructor(cfg) {
7
7
  this.cfg = cfg;
@@ -24,12 +24,12 @@ class EnvSharedService {
24
24
  catch {
25
25
  throw new Error(`Cannot read envFile ${envFilePath}`);
26
26
  }
27
- console.log(`APP_ENV=${(0, colors_1.dimGrey)(APP_ENV)} loaded`);
27
+ console.log(`APP_ENV=${(0, nodejs_lib_1.dimGrey)(APP_ENV)} loaded`);
28
28
  }
29
29
  return this.env;
30
30
  }
31
31
  setEnv(env) {
32
- console.log(`setEnv APP_ENV=${(0, colors_1.dimGrey)(env ? env.name : 'undefined')}`);
32
+ console.log(`setEnv APP_ENV=${(0, nodejs_lib_1.dimGrey)(env ? env.name : 'undefined')}`);
33
33
  this.env = env;
34
34
  }
35
35
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.appEngineLogMiddleware = exports.ciLogger = exports.devLogger = exports.gaeLogger = void 0;
4
4
  const node_util_1 = require("node:util");
5
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
6
5
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
+ const nodejs_lib_2 = require("@naturalcycles/nodejs-lib");
7
7
  const { GOOGLE_CLOUD_PROJECT, GAE_INSTANCE } = process.env;
8
8
  const isGAE = !!GAE_INSTANCE;
9
9
  // Simple "request counter" (poor man's "correlation id") counter, to use on dev machine (not in the cloud)
@@ -44,8 +44,8 @@ function logToAppEngine(meta, args) {
44
44
  function logToDev(requestId, args) {
45
45
  // Run on local machine
46
46
  console.log([
47
- requestId ? [(0, colors_1.dimGrey)(`[${requestId}]`)] : [],
48
- ...args.map(a => (0, nodejs_lib_1.inspectAny)(a, { includeErrorStack: true, colors: true })),
47
+ requestId ? [(0, nodejs_lib_1.dimGrey)(`[${requestId}]`)] : [],
48
+ ...args.map(a => (0, nodejs_lib_2.inspectAny)(a, { includeErrorStack: true, colors: true })),
49
49
  ].join(' '));
50
50
  }
51
51
  /**
@@ -53,7 +53,7 @@ function logToDev(requestId, args) {
53
53
  * This is to not confuse e.g Sentry when it picks up messages with colors
54
54
  */
55
55
  function logToCI(args) {
56
- console.log(args.map(a => (0, nodejs_lib_1.inspectAny)(a, { includeErrorStack: true, colors: false })).join(' '));
56
+ console.log(args.map(a => (0, nodejs_lib_2.inspectAny)(a, { includeErrorStack: true, colors: false })).join(' '));
57
57
  }
58
58
  function appEngineLogMiddleware() {
59
59
  if (!isGAE || !GOOGLE_CLOUD_PROJECT) {
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.coloredHttpCode = exports.logRequest = void 0;
4
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
4
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
5
  function logRequest(req, statusCode, ...tokens) {
6
- req[logLevel(statusCode)]([coloredHttpCode(statusCode), req.method, (0, colors_1.boldGrey)(req.url), ...tokens].join(' '));
6
+ req[logLevel(statusCode)]([coloredHttpCode(statusCode), req.method, (0, nodejs_lib_1.boldGrey)(req.url), ...tokens].join(' '));
7
7
  }
8
8
  exports.logRequest = logRequest;
9
9
  function coloredHttpCode(statusCode) {
10
10
  if (statusCode >= 200 && statusCode < 400)
11
- return (0, colors_1.green)(statusCode);
11
+ return (0, nodejs_lib_1.green)(statusCode);
12
12
  if (statusCode >= 400 && statusCode < 500)
13
- return (0, colors_1.yellow)(statusCode);
14
- return (0, colors_1.red)(statusCode);
13
+ return (0, nodejs_lib_1.yellow)(statusCode);
14
+ return (0, nodejs_lib_1.red)(statusCode);
15
15
  }
16
16
  exports.coloredHttpCode = coloredHttpCode;
17
17
  function logLevel(statusCode) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.simpleRequestLoggerMiddleware = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
5
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
6
  const index_1 = require("../index");
7
7
  const request_log_util_1 = require("./request.log.util");
8
8
  const { APP_ENV } = process.env;
@@ -20,11 +20,11 @@ function simpleRequestLoggerMiddleware(_cfg = {}) {
20
20
  return (req, res, next) => {
21
21
  const started = Date.now();
22
22
  if (logStart) {
23
- req.log(['>>', req.method, (0, colors_1.boldGrey)(req.url)].join(' '));
23
+ req.log(['>>', req.method, (0, nodejs_lib_1.boldGrey)(req.url)].join(' '));
24
24
  }
25
25
  if (logFinish) {
26
26
  (0, index_1.onFinished)(res, () => {
27
- (0, request_log_util_1.logRequest)(req, res.statusCode, (0, colors_1.dimGrey)((0, js_lib_1._since)(started)));
27
+ (0, request_log_util_1.logRequest)(req, res.statusCode, (0, nodejs_lib_1.dimGrey)((0, js_lib_1._since)(started)));
28
28
  // Avoid logging twice. It was previously logged by genericErrorHandler
29
29
  // if (res.__err) {
30
30
  // logRequest(req, res.statusCode, dimGrey(_since(started)), inspectAny(res.__err))
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startServer = exports.BackendServer = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
- const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
6
+ const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
7
7
  const index_1 = require("../index");
8
8
  const { NODE_OPTIONS, APP_ENV } = process.env;
9
9
  class BackendServer {
@@ -45,8 +45,8 @@ class BackendServer {
45
45
  address = `http://${addr.address}:${port}`;
46
46
  }
47
47
  }
48
- console.log((0, colors_1.dimGrey)(`node ${process.version}, NODE_OPTIONS: ${NODE_OPTIONS || 'undefined'}, APP_ENV: ${APP_ENV || 'undefined'}`));
49
- console.log(`serverStarted on ${(0, colors_1.white)(address)} in ${(0, colors_1.dimGrey)((0, js_lib_1._ms)(process.uptime() * 1000))}`);
48
+ console.log((0, nodejs_lib_1.dimGrey)(`node ${process.version}, NODE_OPTIONS: ${NODE_OPTIONS || 'undefined'}, APP_ENV: ${APP_ENV || 'undefined'}`));
49
+ console.log(`serverStarted on ${(0, nodejs_lib_1.white)(address)} in ${(0, nodejs_lib_1.dimGrey)((0, js_lib_1._ms)(process.uptime() * 1000))}`);
50
50
  return {
51
51
  port,
52
52
  server: this.server,
@@ -58,9 +58,9 @@ class BackendServer {
58
58
  * Does `process.exit()` in the end.
59
59
  */
60
60
  async stop(reason) {
61
- console.log((0, colors_1.dimGrey)(`Server shutdown (${reason})...`));
61
+ console.log((0, nodejs_lib_1.dimGrey)(`Server shutdown (${reason})...`));
62
62
  const shutdownTimeout = setTimeout(() => {
63
- console.log((0, colors_1.boldGrey)('Forceful shutdown after timeout'));
63
+ console.log((0, nodejs_lib_1.boldGrey)('Forceful shutdown after timeout'));
64
64
  process.exit(0);
65
65
  }, this.cfg.forceShutdownTimeout ?? 10000);
66
66
  try {
@@ -69,7 +69,7 @@ class BackendServer {
69
69
  this.cfg.onShutdown?.(),
70
70
  ]);
71
71
  clearTimeout(shutdownTimeout);
72
- console.log((0, colors_1.dimGrey)('Shutdown completed.'));
72
+ console.log((0, nodejs_lib_1.dimGrey)('Shutdown completed.'));
73
73
  process.exit(0);
74
74
  }
75
75
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "4.18.6",
3
+ "version": "4.18.7",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "serve": "APP_ENV=dev nodemon",
@@ -1,5 +1,5 @@
1
1
  import { _assert, AppError } from '@naturalcycles/js-lib'
2
- import { dimGrey, green, red } from '@naturalcycles/nodejs-lib/dist/colors'
2
+ import { dimGrey, green, red } from '@naturalcycles/nodejs-lib'
3
3
  import type * as FirebaseAdmin from 'firebase-admin'
4
4
  import { BackendRequest, BackendRequestHandler } from '../server/server.model'
5
5
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { runScript } from '@naturalcycles/nodejs-lib/dist/script'
3
+ import { runScript } from '@naturalcycles/nodejs-lib'
4
4
  import * as yargs from 'yargs'
5
5
  import { deployGae } from '../deploy/deployGae'
6
6
  import { deployHealthCheckYargsOptions } from '../deploy/deployHealthCheck'
@@ -9,7 +9,7 @@ yarn deploy-health-check --url https://service-dot-yourproject.appspot.com
9
9
 
10
10
  */
11
11
 
12
- import { runScript } from '@naturalcycles/nodejs-lib/dist/script'
12
+ import { runScript } from '@naturalcycles/nodejs-lib'
13
13
  import * as yargs from 'yargs'
14
14
  import { deployHealthCheck, deployHealthCheckYargsOptions } from '../deploy/deployHealthCheck'
15
15
 
@@ -6,7 +6,7 @@ yarn deploy-prepare
6
6
 
7
7
  */
8
8
 
9
- import { runScript } from '@naturalcycles/nodejs-lib/dist/script'
9
+ import { runScript } from '@naturalcycles/nodejs-lib'
10
10
  import * as yargs from 'yargs'
11
11
  import { deployPrepare, deployPrepareYargsOptions } from '../deploy/deployPrepare'
12
12
 
@@ -1,6 +1,6 @@
1
1
  import * as fs from 'node:fs'
2
2
  import { _mapValues, _merge, _truncate, localTime } from '@naturalcycles/js-lib'
3
- import { dimGrey, white } from '@naturalcycles/nodejs-lib/dist/colors'
3
+ import { dimGrey, white } from '@naturalcycles/nodejs-lib'
4
4
  import * as yaml from 'js-yaml'
5
5
  import { BackendCfg } from './backend.cfg.util'
6
6
  import { AppYaml, DeployInfo } from './deploy.model'
@@ -1,7 +1,7 @@
1
1
  import { inspect, InspectOptions } from 'node:util'
2
2
  import { execVoidCommandSync } from '@naturalcycles/nodejs-lib'
3
3
  import { pDelay, _filterFalsyValues, _ms, _since, getFetcher } from '@naturalcycles/js-lib'
4
- import { dimGrey, red } from '@naturalcycles/nodejs-lib/dist/colors'
4
+ import { dimGrey, red } from '@naturalcycles/nodejs-lib'
5
5
  import { coloredHttpCode } from '../server/request.log.util'
6
6
 
7
7
  export interface DeployHealthCheckOptions {
@@ -1,6 +1,6 @@
1
1
  import { _emptyDirSync, _writeFileSync } from '@naturalcycles/nodejs-lib'
2
- import { dimGrey } from '@naturalcycles/nodejs-lib/dist/colors'
3
- import { kpySync } from '@naturalcycles/nodejs-lib/dist/fs'
2
+ import { dimGrey } from '@naturalcycles/nodejs-lib'
3
+ import { kpySync } from '@naturalcycles/nodejs-lib'
4
4
  import { srcDir } from '../paths.cnst'
5
5
  import { getBackendCfg } from './backend.cfg.util'
6
6
  import { DeployInfo } from './deploy.model'
@@ -1,4 +1,4 @@
1
- import { dimGrey } from '@naturalcycles/nodejs-lib/dist/colors'
1
+ import { dimGrey } from '@naturalcycles/nodejs-lib'
2
2
  import { BaseEnv } from './env.model'
3
3
 
4
4
  export interface EnvSharedServiceCfg {
@@ -1,5 +1,5 @@
1
1
  import { inspect } from 'node:util'
2
- import { dimGrey } from '@naturalcycles/nodejs-lib/dist/colors'
2
+ import { dimGrey } from '@naturalcycles/nodejs-lib'
3
3
  import { inspectAny } from '@naturalcycles/nodejs-lib'
4
4
  import { AnyObject, CommonLogger } from '@naturalcycles/js-lib'
5
5
  import { BackendRequestHandler } from './server.model'
@@ -1,5 +1,5 @@
1
1
  import { CommonLogLevel } from '@naturalcycles/js-lib'
2
- import { boldGrey, green, red, yellow } from '@naturalcycles/nodejs-lib/dist/colors'
2
+ import { boldGrey, green, red, yellow } from '@naturalcycles/nodejs-lib'
3
3
  import { BackendRequest } from './server.model'
4
4
 
5
5
  export function logRequest(req: BackendRequest, statusCode: number, ...tokens: any[]): void {
@@ -1,5 +1,5 @@
1
1
  import { _since } from '@naturalcycles/js-lib'
2
- import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib/dist/colors'
2
+ import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib'
3
3
  import { BackendRequestHandler, onFinished } from '../index'
4
4
  import { logRequest } from './request.log.util'
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { Server } from 'node:http'
2
2
  import { _Memo, _ms } from '@naturalcycles/js-lib'
3
- import { boldGrey, dimGrey, white } from '@naturalcycles/nodejs-lib/dist/colors'
3
+ import { boldGrey, dimGrey, white } from '@naturalcycles/nodejs-lib'
4
4
  import { createDefaultApp } from '../index'
5
5
  import { StartServerCfg, StartServerData } from './startServer.model'
6
6