@naturalcycles/backend-lib 5.16.0 → 5.17.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.
@@ -46,8 +46,11 @@ async function createDeployInfo(backendCfg, overrideBranch) {
46
46
  else {
47
47
  let branchName = gitBranch;
48
48
  if (backendCfg.hashedBranches) {
49
- // todo: jira
50
- branchName = (0, nodejs_lib_1.md5)(gitBranch).slice(0, 10);
49
+ // Obfuscates the branch name by hashing it.
50
+ // If there are Jira issue names in the branch name, the first one found will be used as a prefix.
51
+ const jiraIssue = gitBranch.match(/([Dd][Ee][Vv]-\d+)/)?.[0];
52
+ const branchHash = (0, nodejs_lib_1.md5)(gitBranch).slice(0, 10);
53
+ branchName = [jiraIssue, branchHash].filter(Boolean).join('-');
51
54
  }
52
55
  gaeService = validateGAEServiceName([branchName, gaeService].join('--'));
53
56
  }
@@ -58,6 +58,7 @@ const serverStatsHTMLHandler = (req, res) => {
58
58
  '<tr>',
59
59
  `<td><pre>${endpoint}</pre></td>`,
60
60
  `<td align="right"><pre>${stat.total}</pre></td>`,
61
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
61
62
  ...families.map(f => `<td align="right"><pre>${stat[f]}</pre></td>`),
62
63
  ...percentiles.map(pc => `<td align="right"><pre>${stat.pc[pc]}</pre></td>`),
63
64
  '</tr>',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "5.16.0",
3
+ "version": "5.17.1",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build",
@@ -18,37 +18,37 @@
18
18
  "deploy-health-check-debug2": "yarn tsn ./src/bin/deploy-health-check.ts --url https://api-master2.naturalcycles.com --thresholdUnhealthy 5"
19
19
  },
20
20
  "peerDependencies": {
21
- "@sentry/node": "^7.0.0"
21
+ "@sentry/node": "^7"
22
22
  },
23
23
  "dependencies": {
24
- "@naturalcycles/db-lib": "^9.1.0",
25
- "@naturalcycles/js-lib": "^14.244.0",
26
- "@naturalcycles/nodejs-lib": "^13.1.0",
27
- "@types/cookie-parser": "^1.4.1",
28
- "@types/cors": "^2.8.4",
29
- "@types/express": "^5.0.0",
30
- "@types/on-finished": "^2.3.1",
31
- "cookie-parser": "^1.4.3",
32
- "cors": "^2.8.5",
33
- "dotenv": "^16.0.0",
34
- "ejs": "^3.0.1",
35
- "express": "^4.16.4",
36
- "express-promise-router": "^4.0.0",
37
- "firebase-admin": "^13.0.0",
38
- "helmet": "^8.0.0",
39
- "on-finished": "^2.3.0",
40
- "simple-git": "^3.0.3",
41
- "yargs": "^17.0.0"
24
+ "@naturalcycles/db-lib": "^9",
25
+ "@naturalcycles/js-lib": "^14",
26
+ "@naturalcycles/nodejs-lib": "^13",
27
+ "@types/cookie-parser": "^1",
28
+ "@types/cors": "^2",
29
+ "@types/express": "^5",
30
+ "@types/on-finished": "^2",
31
+ "cookie-parser": "^1",
32
+ "cors": "^2",
33
+ "dotenv": "^16",
34
+ "ejs": "^3",
35
+ "express": "^4",
36
+ "express-promise-router": "^4",
37
+ "firebase-admin": "^13",
38
+ "helmet": "^8",
39
+ "on-finished": "^2",
40
+ "simple-git": "^3",
41
+ "yargs": "^17"
42
42
  },
43
43
  "devDependencies": {
44
- "@naturalcycles/bench-lib": "^3.0.0",
45
- "@naturalcycles/dev-lib": "^15.0.4",
46
- "@sentry/node": "^7.0.0",
47
- "@types/ejs": "^3.0.0",
48
- "@types/node": "^22.2.0",
49
- "@types/yargs": "^16.0.0",
50
- "fastify": "^5.0.0",
51
- "jest": "^29.0.1"
44
+ "@naturalcycles/bench-lib": "^3",
45
+ "@naturalcycles/dev-lib": "^15",
46
+ "@sentry/node": "^7",
47
+ "@types/ejs": "^3",
48
+ "@types/node": "^22",
49
+ "@types/yargs": "^16",
50
+ "fastify": "^5",
51
+ "jest": "^29"
52
52
  },
53
53
  "files": [
54
54
  "dist",
@@ -60,8 +60,11 @@ export async function createDeployInfo(
60
60
  let branchName = gitBranch
61
61
 
62
62
  if (backendCfg.hashedBranches) {
63
- // todo: jira
64
- branchName = md5(gitBranch).slice(0, 10)
63
+ // Obfuscates the branch name by hashing it.
64
+ // If there are Jira issue names in the branch name, the first one found will be used as a prefix.
65
+ const jiraIssue = gitBranch.match(/([Dd][Ee][Vv]-\d+)/)?.[0]
66
+ const branchHash = md5(gitBranch).slice(0, 10)
67
+ branchName = [jiraIssue, branchHash].filter(Boolean).join('-')
65
68
  }
66
69
 
67
70
  gaeService = validateGAEServiceName([branchName, gaeService].join('--'))
@@ -94,6 +94,7 @@ export const serverStatsHTMLHandler: BackendRequestHandler = (req, res) => {
94
94
  '<tr>',
95
95
  `<td><pre>${endpoint}</pre></td>`,
96
96
  `<td align="right"><pre>${stat.total}</pre></td>`,
97
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
97
98
  ...families.map(f => `<td align="right"><pre>${stat[f]}</pre></td>`),
98
99
  ...percentiles.map(pc => `<td align="right"><pre>${stat.pc![pc]}</pre></td>`),
99
100
  '</tr>',