90dc-core 1.2.2 → 1.2.3
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/dist/index.d.ts +5 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/models/BlueprintInterfaces.d.ts +34 -0
- package/dist/lib/models/BlueprintInterfaces.js +1 -0
- package/dist/lib/models/BlueprintInterfaces.js.map +1 -0
- package/dist/lib/models/ExerciseInterfaces.d.ts +36 -0
- package/dist/lib/models/ExerciseInterfaces.js +1 -0
- package/dist/lib/models/ExerciseInterfaces.js.map +1 -0
- package/dist/lib/models/ProgramInterfaces.d.ts +24 -0
- package/dist/lib/models/ProgramInterfaces.js +1 -0
- package/dist/lib/models/ProgramInterfaces.js.map +1 -0
- package/dist/lib/models/UserInterfaces.d.ts +75 -0
- package/dist/lib/models/UserInterfaces.js +1 -0
- package/dist/lib/models/UserInterfaces.js.map +1 -0
- package/dist/lib/models/WorkoutInterfaces.d.ts +28 -0
- package/dist/lib/models/WorkoutInterfaces.js +1 -0
- package/dist/lib/models/WorkoutInterfaces.js.map +1 -0
- package/dist/lib/utils/Logger/Logger.d.ts +8 -0
- package/dist/lib/utils/Logger/Logger.js +50 -0
- package/dist/lib/utils/Logger/Logger.js.map +1 -0
- package/dist/lib/utils/Logger.d.ts +8 -0
- package/dist/lib/utils/Logger.js +50 -0
- package/dist/lib/utils/Logger.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["//Interfaces\nexport * from \"./lib/models/ProgramInterfaces\";\nexport * from \"./lib/models/ExerciseInterfaces\";\nexport * from \"./lib/models/WorkoutInterfaces\";\nexport * from \"./lib/models/UserInterfaces\";\n\n//Utils\nexport * from \"./lib/utils/Logger\""],"names":[],"mappings":"AAAA,YAAY;AACZ,cAAc,iCAAiC;AAC/C,cAAc,kCAAkC;AAChD,cAAc,iCAAiC;AAC/C,cAAc,8BAA8B;AAE5C,OAAO;AACP,cAAc,qBAAoB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SupersetModel } from "./WorkoutInterfaces";
|
|
2
|
+
export interface ExerciseBlueprint {
|
|
3
|
+
uuid: string;
|
|
4
|
+
hasPriority: boolean;
|
|
5
|
+
isCompound: boolean;
|
|
6
|
+
homeWorkout: boolean;
|
|
7
|
+
needsEquipment: boolean;
|
|
8
|
+
isSuperset: boolean;
|
|
9
|
+
isFixed: boolean;
|
|
10
|
+
muscle: string;
|
|
11
|
+
rir: number;
|
|
12
|
+
order: number;
|
|
13
|
+
reps: string;
|
|
14
|
+
sets: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ProgramBlueprint {
|
|
17
|
+
programId: string;
|
|
18
|
+
title: string;
|
|
19
|
+
level: string;
|
|
20
|
+
numberOfDays: number;
|
|
21
|
+
workouts: WorkoutBlueprint[];
|
|
22
|
+
}
|
|
23
|
+
export interface WorkoutBlueprint {
|
|
24
|
+
uuid: string;
|
|
25
|
+
title: string;
|
|
26
|
+
duration: string;
|
|
27
|
+
exercises: ExerciseBlueprint[];
|
|
28
|
+
superset: SupersetModel[];
|
|
29
|
+
}
|
|
30
|
+
export interface SupersetBlueprint {
|
|
31
|
+
uuid: string;
|
|
32
|
+
workout: WorkoutBlueprint;
|
|
33
|
+
exercise: ExerciseBlueprint[];
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/BlueprintInterfaces.ts"],"sourcesContent":["import type { SupersetModel } from \"./WorkoutInterfaces\";\n\nexport interface ExerciseBlueprint {\n uuid: string;\n hasPriority: boolean;\n isCompound: boolean;\n homeWorkout: boolean;\n needsEquipment: boolean;\n isSuperset: boolean;\n isFixed: boolean;\n muscle: string;\n rir: number;\n order: number;\n reps: string;\n sets: string;\n}\n\nexport interface ProgramBlueprint {\n programId: string;\n title: string;\n level: string;\n numberOfDays: number;\n workouts: WorkoutBlueprint[];\n}\n\nexport interface WorkoutBlueprint {\n uuid: string;\n title: string;\n duration: string;\n exercises: ExerciseBlueprint[];\n superset: SupersetModel[];\n}\n\nexport interface SupersetBlueprint {\n uuid: string;\n workout: WorkoutBlueprint;\n exercise: ExerciseBlueprint[];\n}\n"],"names":[],"mappings":"AAAA,WAqCC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ProgramBlueprint } from "./BlueprintInterfaces";
|
|
2
|
+
export interface ExerciseModel {
|
|
3
|
+
uuid: string;
|
|
4
|
+
name: string;
|
|
5
|
+
level: string[];
|
|
6
|
+
isCompound: boolean;
|
|
7
|
+
needsEquipment: boolean;
|
|
8
|
+
hasPriority: boolean;
|
|
9
|
+
hasVariations: boolean;
|
|
10
|
+
variations: object;
|
|
11
|
+
muscles: string[];
|
|
12
|
+
homeWorkout: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ExerciseProgressRequest {
|
|
15
|
+
exerciseUuid: string;
|
|
16
|
+
reps: string;
|
|
17
|
+
weight: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ExerciseProgressGetRequest {
|
|
20
|
+
exerciseUuid: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ExerciseBlueprint {
|
|
23
|
+
uuid: string;
|
|
24
|
+
hasPriority: boolean;
|
|
25
|
+
isCompound: boolean;
|
|
26
|
+
homeWorkout: boolean;
|
|
27
|
+
needsEquipment: boolean;
|
|
28
|
+
isSuperset: boolean;
|
|
29
|
+
isFixed: boolean;
|
|
30
|
+
muscle: string;
|
|
31
|
+
rir: number;
|
|
32
|
+
order: number;
|
|
33
|
+
reps: string;
|
|
34
|
+
sets: string;
|
|
35
|
+
program: ProgramBlueprint;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/ExerciseInterfaces.ts"],"sourcesContent":["import type { ProgramBlueprint } from \"./BlueprintInterfaces\";\n\nexport interface ExerciseModel {\n uuid: string;\n name: string;\n level: string[];\n isCompound: boolean;\n needsEquipment: boolean;\n hasPriority: boolean;\n hasVariations: boolean;\n variations: object;\n muscles: string[];\n homeWorkout: boolean;\n}\nexport interface ExerciseProgressRequest {\n exerciseUuid: string;\n reps: string;\n weight: string;\n}\nexport interface ExerciseProgressGetRequest {\n exerciseUuid: string;\n}\nexport interface ExerciseBlueprint {\n uuid: string;\n hasPriority: boolean;\n isCompound: boolean;\n homeWorkout: boolean;\n needsEquipment: boolean;\n isSuperset: boolean;\n isFixed: boolean;\n muscle: string;\n rir: number;\n order: number;\n reps: string;\n sets: string;\n program: ProgramBlueprint;\n}\n"],"names":[],"mappings":"AAAA,WAoCC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { WorkoutBlueprint } from "./BlueprintInterfaces";
|
|
2
|
+
export interface ProgramModel {
|
|
3
|
+
programId: string;
|
|
4
|
+
userUuid: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ProgramIdRequest {
|
|
7
|
+
programId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProgramUserRequest {
|
|
10
|
+
userUuid: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UserProgramOptions {
|
|
13
|
+
level: string;
|
|
14
|
+
type: string;
|
|
15
|
+
numberOfDays: number;
|
|
16
|
+
userUuid: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ProgramBlueprint {
|
|
19
|
+
programId: string;
|
|
20
|
+
title: string;
|
|
21
|
+
level: string;
|
|
22
|
+
numberOfDays: number;
|
|
23
|
+
workouts: WorkoutBlueprint[];
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/ProgramInterfaces.ts"],"sourcesContent":["import type { WorkoutBlueprint } from \"./BlueprintInterfaces\";\n\nexport interface ProgramModel {\n programId: string;\n userUuid: string;\n}\nexport interface ProgramIdRequest {\n programId: string;\n}\nexport interface ProgramUserRequest {\n userUuid: string;\n}\nexport interface UserProgramOptions {\n level: string;\n type: string;\n numberOfDays: number;\n userUuid: string;\n}\n\nexport interface ProgramBlueprint {\n programId: string;\n title: string;\n level: string;\n numberOfDays: number;\n workouts: WorkoutBlueprint[];\n}\n"],"names":[],"mappings":"AAAA,WAyBC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export interface UserTypes {
|
|
2
|
+
userUuid: string;
|
|
3
|
+
email: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
avatar: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UserInfoModel {
|
|
9
|
+
userUuid: string;
|
|
10
|
+
height: string;
|
|
11
|
+
weight: string;
|
|
12
|
+
}
|
|
13
|
+
export interface LoginRequest {
|
|
14
|
+
email: string;
|
|
15
|
+
password: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UserPhotoRequest {
|
|
18
|
+
base64: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ProgressPhoto {
|
|
21
|
+
date: Date;
|
|
22
|
+
progressPhoto: string;
|
|
23
|
+
userUuid: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ForgotPassword {
|
|
26
|
+
uuid: string;
|
|
27
|
+
userUuid: string;
|
|
28
|
+
token: string;
|
|
29
|
+
date: Date;
|
|
30
|
+
}
|
|
31
|
+
export interface RefreshPayload {
|
|
32
|
+
userUuid: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TokenRequest {
|
|
35
|
+
token: string;
|
|
36
|
+
}
|
|
37
|
+
export interface RefreshRequest {
|
|
38
|
+
refreshToken: string;
|
|
39
|
+
}
|
|
40
|
+
export interface UuidRequest {
|
|
41
|
+
userUuid: string;
|
|
42
|
+
}
|
|
43
|
+
export interface EmailRequest {
|
|
44
|
+
email: string;
|
|
45
|
+
}
|
|
46
|
+
export interface TitleRequest {
|
|
47
|
+
title: string;
|
|
48
|
+
}
|
|
49
|
+
export interface UserPhoto {
|
|
50
|
+
base64: string;
|
|
51
|
+
title: string;
|
|
52
|
+
}
|
|
53
|
+
export default interface AuthenticationToken {
|
|
54
|
+
type: string;
|
|
55
|
+
contents: string;
|
|
56
|
+
}
|
|
57
|
+
export interface RestorePasswordRequest {
|
|
58
|
+
email: string;
|
|
59
|
+
}
|
|
60
|
+
export interface BeforeSubscriptionOptions {
|
|
61
|
+
firstName: string;
|
|
62
|
+
lastName: string;
|
|
63
|
+
sex: string;
|
|
64
|
+
goal: string;
|
|
65
|
+
weightGoal: string;
|
|
66
|
+
level: string;
|
|
67
|
+
type: string;
|
|
68
|
+
days: number;
|
|
69
|
+
}
|
|
70
|
+
export interface AfterSubscriptionOptions {
|
|
71
|
+
dateOfBirth: string;
|
|
72
|
+
metricSystem: string;
|
|
73
|
+
height: string;
|
|
74
|
+
weight: string;
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/UserInterfaces.ts"],"sourcesContent":["export interface UserTypes {\n userUuid: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: string;\n}\n\nexport interface UserInfoModel {\n userUuid: string;\n height: string;\n weight: string;\n}\n\nexport interface LoginRequest {\n email: string;\n password: string;\n}\n\nexport interface UserPhotoRequest {\n base64: string;\n}\n\nexport interface ProgressPhoto {\n date: Date;\n progressPhoto: string;\n userUuid: string;\n}\n\nexport interface ForgotPassword {\n uuid: string;\n userUuid: string;\n token: string;\n date: Date;\n}\n\nexport interface RefreshPayload {\n userUuid: string;\n}\n\nexport interface TokenRequest {\n token: string;\n}\n\nexport interface RefreshRequest {\n refreshToken: string;\n}\n\nexport interface UuidRequest {\n userUuid: string;\n}\n\nexport interface EmailRequest {\n email: string;\n}\n\nexport interface TitleRequest {\n title: string;\n}\n\nexport interface UserPhoto {\n base64: string;\n title: string;\n}\n\nexport default interface AuthenticationToken {\n type: string;\n contents: string;\n}\n\nexport interface RestorePasswordRequest {\n email: string;\n}\n\nexport interface BeforeSubscriptionOptions {\n firstName: string;\n lastName: string;\n sex: string;\n goal: string;\n weightGoal: string;\n level: string;\n type: string;\n days: number;\n}\n\nexport interface AfterSubscriptionOptions {\n dateOfBirth: string;\n metricSystem: string;\n height: string;\n weight: string;\n}\n"],"names":[],"mappings":"AAAA,WA0FC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ExerciseBlueprint } from "./BlueprintInterfaces";
|
|
2
|
+
export interface WorkoutModel {
|
|
3
|
+
uuid: string;
|
|
4
|
+
isFinished: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface SupersetModel {
|
|
7
|
+
uuid: string;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkoutExerciseModel {
|
|
10
|
+
WorkoutUuid: string;
|
|
11
|
+
ExerciseUuid: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SupersetExerciseModel {
|
|
14
|
+
SupersetUuid: string;
|
|
15
|
+
ExerciseUuid: string;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkoutBlueprint {
|
|
18
|
+
uuid: string;
|
|
19
|
+
title: string;
|
|
20
|
+
duration: string;
|
|
21
|
+
exercises: ExerciseBlueprint[];
|
|
22
|
+
superset: SupersetModel[];
|
|
23
|
+
}
|
|
24
|
+
export interface SupersetBlueprint {
|
|
25
|
+
uuid: string;
|
|
26
|
+
workout: WorkoutBlueprint;
|
|
27
|
+
exercise: ExerciseBlueprint[];
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/models/WorkoutInterfaces.ts"],"sourcesContent":["import type { ExerciseBlueprint } from \"./BlueprintInterfaces\";\n\nexport interface WorkoutModel {\n uuid: string;\n isFinished: boolean;\n}\nexport interface SupersetModel {\n uuid: string;\n}\nexport interface WorkoutExerciseModel {\n WorkoutUuid: string;\n ExerciseUuid: string;\n}\nexport interface SupersetExerciseModel {\n SupersetUuid: string;\n ExerciseUuid: string;\n}\nexport interface WorkoutBlueprint {\n uuid: string;\n title: string;\n duration: string;\n exercises: ExerciseBlueprint[];\n superset: SupersetModel[];\n}\n\nexport interface SupersetBlueprint {\n uuid: string;\n workout: WorkoutBlueprint;\n exercise: ExerciseBlueprint[];\n}"],"names":[],"mappings":"AAAA,WA6BC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import winston from 'winston';
|
|
2
|
+
class Logger {
|
|
3
|
+
static _serviceName = "";
|
|
4
|
+
static get serviceName() {
|
|
5
|
+
return this._serviceName;
|
|
6
|
+
}
|
|
7
|
+
static set serviceName(value) {
|
|
8
|
+
this._serviceName = value;
|
|
9
|
+
}
|
|
10
|
+
static getLogger() {
|
|
11
|
+
const levels = {
|
|
12
|
+
error: 0,
|
|
13
|
+
warn: 1,
|
|
14
|
+
info: 2,
|
|
15
|
+
http: 3,
|
|
16
|
+
debug: 4,
|
|
17
|
+
};
|
|
18
|
+
const level = () => {
|
|
19
|
+
const env = process.env.NODE_ENV || 'development';
|
|
20
|
+
const isDevelopment = env === 'development';
|
|
21
|
+
return isDevelopment ? 'debug' : 'warn';
|
|
22
|
+
};
|
|
23
|
+
const colors = {
|
|
24
|
+
error: 'red',
|
|
25
|
+
warn: 'yellow',
|
|
26
|
+
info: 'green',
|
|
27
|
+
http: 'magenta',
|
|
28
|
+
debug: 'white',
|
|
29
|
+
};
|
|
30
|
+
winston.addColors(colors);
|
|
31
|
+
const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), winston.format.colorize({ all: true }), winston.format.printf(
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
33
|
+
(info) => `${info.timestamp}@${this._serviceName} ${info.level}: ${info.message}`));
|
|
34
|
+
const transports = [
|
|
35
|
+
new winston.transports.Console(),
|
|
36
|
+
new winston.transports.File({
|
|
37
|
+
filename: 'logs/error.log',
|
|
38
|
+
level: 'error',
|
|
39
|
+
}),
|
|
40
|
+
new winston.transports.File({ filename: 'logs/all.log' }),
|
|
41
|
+
];
|
|
42
|
+
return winston.createLogger({
|
|
43
|
+
level: level(),
|
|
44
|
+
levels,
|
|
45
|
+
format,
|
|
46
|
+
transports,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export default Logger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/utils/Logger/Logger.ts"],"sourcesContent":["import winston from 'winston'\n\nclass Logger {\n\n private static _serviceName = \"\";\n\n static get serviceName(): string {\n return this._serviceName;\n }\n\n static set serviceName(value: string) {\n this._serviceName = value;\n }\n\n\n\n public static getLogger(){\n const levels = {\n error: 0,\n warn: 1,\n info: 2,\n http: 3,\n debug: 4,\n }\n\n const level = () => {\n const env = process.env.NODE_ENV || 'development'\n const isDevelopment = env === 'development'\n return isDevelopment ? 'debug' : 'warn'\n }\n\n const colors = {\n error: 'red',\n warn: 'yellow',\n info: 'green',\n http: 'magenta',\n debug: 'white',\n }\n\n winston.addColors(colors)\n\n const format: winston.Logform.Format = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),\n winston.format.colorize({ all: true }),\n winston.format.printf(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n (info) => `${info.timestamp}@${this._serviceName} ${info.level}: ${info.message}`,\n ),\n )\n\n const transports = [\n new winston.transports.Console(),\n new winston.transports.File({\n filename: 'logs/error.log',\n level: 'error',\n }),\n new winston.transports.File({ filename: 'logs/all.log' }),\n ]\n return winston.createLogger({\n level: level(),\n levels,\n format,\n transports,\n })\n\n }\n}\n\n\nexport default Logger"],"names":["winston","Logger","_serviceName","serviceName","value","getLogger","levels","error","warn","info","http","debug","level","env","process","NODE_ENV","isDevelopment","colors","addColors","format","combine","timestamp","colorize","all","printf","message","transports","Console","File","filename","createLogger"],"mappings":"AAAA,OAAOA,aAAa,UAAS;AAE7B,MAAMC;IAEJ,OAAeC,eAAe,GAAG;IAEjC,WAAWC,cAAsB;QAC/B,OAAO,IAAI,CAACD,YAAY;IAC1B;IAEA,WAAWC,YAAYC,KAAa,EAAE;QACpC,IAAI,CAACF,YAAY,GAAGE;IACtB;IAIA,OAAcC,YAAW;QACvB,MAAMC,SAAS;YACbC,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEA,MAAMC,QAAQ,IAAM;YAClB,MAAMC,MAAMC,QAAQD,GAAG,CAACE,QAAQ,IAAI;YACpC,MAAMC,gBAAgBH,QAAQ;YAC9B,OAAOG,gBAAgB,UAAU,MAAM;QACzC;QAEA,MAAMC,SAAS;YACbV,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEAX,QAAQkB,SAAS,CAACD;QAElB,MAAME,SAAiCnB,QAAQmB,MAAM,CAACC,OAAO,CAC3DpB,QAAQmB,MAAM,CAACE,SAAS,CAAC;YAAEF,QAAQ;QAAyB,IAC5DnB,QAAQmB,MAAM,CAACG,QAAQ,CAAC;YAAEC,KAAK,IAAI;QAAC,IACpCvB,QAAQmB,MAAM,CAACK,MAAM,CACnB,4EAA4E;QAC5E,CAACf,OAAS,CAAC,EAAEA,KAAKY,SAAS,CAAC,CAAC,EAAE,IAAI,CAACnB,YAAY,CAAC,CAAC,EAAEO,KAAKG,KAAK,CAAC,EAAE,EAAEH,KAAKgB,OAAO,CAAC,CAAC;QAIrF,MAAMC,aAAa;YACjB,IAAI1B,QAAQ0B,UAAU,CAACC,OAAO;YAC9B,IAAI3B,QAAQ0B,UAAU,CAACE,IAAI,CAAC;gBAC1BC,UAAU;gBACVjB,OAAO;YACT;YACA,IAAIZ,QAAQ0B,UAAU,CAACE,IAAI,CAAC;gBAAEC,UAAU;YAAe;SACxD;QACD,OAAO7B,QAAQ8B,YAAY,CAAC;YAC1BlB,OAAOA;YACPN;YACAa;YACAO;QACF;IAEF;AACF;AAGA,eAAezB,OAAM"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import winston from 'winston';
|
|
2
|
+
class Logger {
|
|
3
|
+
static _serviceName = "";
|
|
4
|
+
static get serviceName() {
|
|
5
|
+
return this._serviceName;
|
|
6
|
+
}
|
|
7
|
+
static set serviceName(value) {
|
|
8
|
+
this._serviceName = value;
|
|
9
|
+
}
|
|
10
|
+
static getLogger() {
|
|
11
|
+
const levels = {
|
|
12
|
+
error: 0,
|
|
13
|
+
warn: 1,
|
|
14
|
+
info: 2,
|
|
15
|
+
http: 3,
|
|
16
|
+
debug: 4,
|
|
17
|
+
};
|
|
18
|
+
const level = () => {
|
|
19
|
+
const env = process.env.NODE_ENV || 'development';
|
|
20
|
+
const isDevelopment = env === 'development';
|
|
21
|
+
return isDevelopment ? 'debug' : 'warn';
|
|
22
|
+
};
|
|
23
|
+
const colors = {
|
|
24
|
+
error: 'red',
|
|
25
|
+
warn: 'yellow',
|
|
26
|
+
info: 'green',
|
|
27
|
+
http: 'magenta',
|
|
28
|
+
debug: 'white',
|
|
29
|
+
};
|
|
30
|
+
winston.addColors(colors);
|
|
31
|
+
const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), winston.format.colorize({ all: true }), winston.format.printf(
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
33
|
+
(info) => `${info.timestamp}@${this._serviceName} ${info.level}: ${info.message}`));
|
|
34
|
+
const transports = [
|
|
35
|
+
new winston.transports.Console(),
|
|
36
|
+
new winston.transports.File({
|
|
37
|
+
filename: 'logs/error.log',
|
|
38
|
+
level: 'error',
|
|
39
|
+
}),
|
|
40
|
+
new winston.transports.File({ filename: 'logs/all.log' }),
|
|
41
|
+
];
|
|
42
|
+
return winston.createLogger({
|
|
43
|
+
level: level(),
|
|
44
|
+
levels,
|
|
45
|
+
format,
|
|
46
|
+
transports,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export default Logger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/utils/Logger.ts"],"sourcesContent":["import winston from 'winston'\n\nclass Logger {\n\n private static _serviceName = \"\";\n\n static get serviceName(): string {\n return this._serviceName;\n }\n\n static set serviceName(value: string) {\n this._serviceName = value;\n }\n\n public static getLogger(){\n const levels = {\n error: 0,\n warn: 1,\n info: 2,\n http: 3,\n debug: 4,\n }\n\n const level = () => {\n const env = process.env.NODE_ENV || 'development'\n const isDevelopment = env === 'development'\n return isDevelopment ? 'debug' : 'warn'\n }\n\n const colors = {\n error: 'red',\n warn: 'yellow',\n info: 'green',\n http: 'magenta',\n debug: 'white',\n }\n\n winston.addColors(colors)\n\n const format: winston.Logform.Format = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),\n winston.format.colorize({ all: true }),\n winston.format.printf(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n (info) => `${info.timestamp}@${this._serviceName} ${info.level}: ${info.message}`,\n ),\n )\n\n const transports = [\n new winston.transports.Console(),\n new winston.transports.File({\n filename: 'logs/error.log',\n level: 'error',\n }),\n new winston.transports.File({ filename: 'logs/all.log' }),\n ]\n return winston.createLogger({\n level: level(),\n levels,\n format,\n transports,\n })\n\n }\n}\n\n\nexport default Logger"],"names":["winston","Logger","_serviceName","serviceName","value","getLogger","levels","error","warn","info","http","debug","level","env","process","NODE_ENV","isDevelopment","colors","addColors","format","combine","timestamp","colorize","all","printf","message","transports","Console","File","filename","createLogger"],"mappings":"AAAA,OAAOA,aAAa,UAAS;AAE7B,MAAMC;IAEJ,OAAeC,eAAe,GAAG;IAEjC,WAAWC,cAAsB;QAC/B,OAAO,IAAI,CAACD,YAAY;IAC1B;IAEA,WAAWC,YAAYC,KAAa,EAAE;QACpC,IAAI,CAACF,YAAY,GAAGE;IACtB;IAEA,OAAcC,YAAW;QACvB,MAAMC,SAAS;YACbC,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEA,MAAMC,QAAQ,IAAM;YAClB,MAAMC,MAAMC,QAAQD,GAAG,CAACE,QAAQ,IAAI;YACpC,MAAMC,gBAAgBH,QAAQ;YAC9B,OAAOG,gBAAgB,UAAU,MAAM;QACzC;QAEA,MAAMC,SAAS;YACbV,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEAX,QAAQkB,SAAS,CAACD;QAElB,MAAME,SAAiCnB,QAAQmB,MAAM,CAACC,OAAO,CAC3DpB,QAAQmB,MAAM,CAACE,SAAS,CAAC;YAAEF,QAAQ;QAAyB,IAC5DnB,QAAQmB,MAAM,CAACG,QAAQ,CAAC;YAAEC,KAAK,IAAI;QAAC,IACpCvB,QAAQmB,MAAM,CAACK,MAAM,CACnB,4EAA4E;QAC5E,CAACf,OAAS,CAAC,EAAEA,KAAKY,SAAS,CAAC,CAAC,EAAE,IAAI,CAACnB,YAAY,CAAC,CAAC,EAAEO,KAAKG,KAAK,CAAC,EAAE,EAAEH,KAAKgB,OAAO,CAAC,CAAC;QAIrF,MAAMC,aAAa;YACjB,IAAI1B,QAAQ0B,UAAU,CAACC,OAAO;YAC9B,IAAI3B,QAAQ0B,UAAU,CAACE,IAAI,CAAC;gBAC1BC,UAAU;gBACVjB,OAAO;YACT;YACA,IAAIZ,QAAQ0B,UAAU,CAACE,IAAI,CAAC;gBAAEC,UAAU;YAAe;SACxD;QACD,OAAO7B,QAAQ8B,YAAY,CAAC;YAC1BlB,OAAOA;YACPN;YACAa;YACAO;QACF;IAEF;AACF;AAGA,eAAezB,OAAM"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "90dc-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "A package that contains utils and interfaces used to create 90dc",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@swc/cli": "^0.1.62",
|