@alanszp/core 10.0.1 → 12.0.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.
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.appIdentifier = void 0;
|
|
4
|
+
const shortEnvName = {
|
|
5
|
+
production: "prd",
|
|
6
|
+
staging: "stg",
|
|
7
|
+
development: "dev",
|
|
8
|
+
test: "tst",
|
|
9
|
+
};
|
|
4
10
|
function appIdentifier() {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const appName = (_b = (_a = process.env.SERVICE_NAME) !== null && _a !== void 0 ? _a : process.env.API_ORIGIN_NAME) !== null && _b !== void 0 ? _b : "undef";
|
|
13
|
+
const roleName = process.env.ROLE_NAME;
|
|
14
|
+
const env = process.env.NODE_ENV
|
|
15
|
+
? (_c = shortEnvName[process.env.NODE_ENV]) !== null && _c !== void 0 ? _c : process.env.NODE_ENV
|
|
16
|
+
: "dev";
|
|
17
|
+
return `${roleName ? `${appName}:${roleName}` : appName}:${env}`;
|
|
8
18
|
}
|
|
9
19
|
exports.appIdentifier = appIdentifier;
|
|
10
20
|
//# sourceMappingURL=appIdentifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appIdentifier.js","sourceRoot":"","sources":["../../src/app/appIdentifier.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa
|
|
1
|
+
{"version":3,"file":"appIdentifier.js","sourceRoot":"","sources":["../../src/app/appIdentifier.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAA2B;IAC3C,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,KAAK;IAClB,IAAI,EAAE,KAAK;CACZ,CAAC;AAEF,SAAgB,aAAa;;IAC3B,MAAM,OAAO,GACX,MAAA,MAAA,OAAO,CAAC,GAAG,CAAC,YAAY,mCAAI,OAAO,CAAC,GAAG,CAAC,eAAe,mCAAI,OAAO,CAAC;IAErE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IAEvC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ;QAC9B,CAAC,CAAC,MAAA,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,OAAO,CAAC,GAAG,CAAC,QAAQ;QAC5D,CAAC,CAAC,KAAK,CAAC;IAEV,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;AACnE,CAAC;AAXD,sCAWC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alanszp/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Alan's core TS/JS lib.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^20.11.17"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "085a76a387bc0e272e09e9cb1b6f48f814512940"
|
|
25
25
|
}
|
package/src/app/appIdentifier.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
const shortEnvName: Record<string, string> = {
|
|
2
|
+
production: "prd",
|
|
3
|
+
staging: "stg",
|
|
4
|
+
development: "dev",
|
|
5
|
+
test: "tst",
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
export function appIdentifier() {
|
|
2
|
-
const appName =
|
|
3
|
-
|
|
4
|
-
|
|
9
|
+
const appName =
|
|
10
|
+
process.env.SERVICE_NAME ?? process.env.API_ORIGIN_NAME ?? "undef";
|
|
11
|
+
|
|
12
|
+
const roleName = process.env.ROLE_NAME;
|
|
13
|
+
|
|
14
|
+
const env = process.env.NODE_ENV
|
|
15
|
+
? shortEnvName[process.env.NODE_ENV] ?? process.env.NODE_ENV
|
|
16
|
+
: "dev";
|
|
17
|
+
|
|
18
|
+
return `${roleName ? `${appName}:${roleName}` : appName}:${env}`;
|
|
5
19
|
}
|