@fdm-monster/server 1.9.0-rc1 → 1.9.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.
- package/.env.template +1 -1
- package/.yarn/install-state.gz +0 -0
- package/README.md +2 -2
- package/RELEASE_NOTES.MD +19 -0
- package/dist/constants/server-settings.constants.js +2 -1
- package/dist/constants/server-settings.constants.js.map +1 -1
- package/dist/controllers/printer-files.controller.js +3 -1
- package/dist/controllers/printer-files.controller.js.map +1 -1
- package/dist/controllers/server-public.controller.js +8 -4
- package/dist/controllers/server-public.controller.js.map +1 -1
- package/dist/controllers/validation/printer-files-controller.validation.js +9 -0
- package/dist/controllers/validation/printer-files-controller.validation.js.map +1 -1
- package/dist/entities/settings.entity.js.map +1 -1
- package/dist/handlers/logger-factory.js +2 -2
- package/dist/handlers/logger-factory.js.map +1 -1
- package/dist/handlers/logger.js +9 -151
- package/dist/handlers/logger.js.map +1 -1
- package/dist/handlers/logging/file-logging.transport.js +35 -0
- package/dist/handlers/logging/file-logging.transport.js.map +1 -0
- package/dist/handlers/logging/loki-logging.transport.js +55 -0
- package/dist/handlers/logging/loki-logging.transport.js.map +1 -0
- package/dist/handlers/logging/static.logger.js +134 -0
- package/dist/handlers/logging/static.logger.js.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/middleware/socketio.middleware.js +11 -3
- package/dist/middleware/socketio.middleware.js.map +1 -1
- package/dist/models/Settings.js +6 -1
- package/dist/models/Settings.js.map +1 -1
- package/dist/server.constants.js +2 -1
- package/dist/server.constants.js.map +1 -1
- package/dist/server.env.js +9 -10
- package/dist/server.env.js.map +1 -1
- package/dist/services/core/github.service.js +1 -1
- package/dist/services/core/github.service.js.map +1 -1
- package/dist/services/moonraker/moonraker-websocket.adapter.js +11 -6
- package/dist/services/moonraker/moonraker-websocket.adapter.js.map +1 -1
- package/dist/services/moonraker/moonraker.client.js +8 -4
- package/dist/services/moonraker/moonraker.client.js.map +1 -1
- package/dist/services/moonraker.api.js +2 -2
- package/dist/services/moonraker.api.js.map +1 -1
- package/dist/services/octoprint/octoprint-api.routes.js +1 -1
- package/dist/services/octoprint/octoprint-api.routes.js.map +1 -1
- package/dist/services/octoprint/octoprint.client.js +9 -9
- package/dist/services/octoprint/octoprint.client.js.map +1 -1
- package/dist/services/octoprint/utils/octoprint-http-client.builder.js.map +1 -1
- package/dist/services/octoprint.api.js +2 -5
- package/dist/services/octoprint.api.js.map +1 -1
- package/dist/services/prusa-link/prusa-link.api.js +6 -4
- package/dist/services/prusa-link/prusa-link.api.js.map +1 -1
- package/dist/services/validators/settings-service.validation.js +2 -1
- package/dist/services/validators/settings-service.validation.js.map +1 -1
- package/dist/shared/runtime-settings.migration.js +7 -0
- package/dist/shared/runtime-settings.migration.js.map +1 -1
- package/dist/state/socket-io.gateway.js +1 -1
- package/dist/state/socket-io.gateway.js.map +1 -1
- package/package.json +11 -10
package/.env.template
CHANGED
|
@@ -4,6 +4,7 @@ SERVER_PORT=4000
|
|
|
4
4
|
NODE_ENV=development
|
|
5
5
|
# Optional, default: mongodb://127.0.0.1:27017/fdm-monster
|
|
6
6
|
MONGO=mongodb://127.0.0.1:27017/fdm-monster
|
|
7
|
+
ENABLE_COLORED_LOGS=false
|
|
7
8
|
|
|
8
9
|
# Github Personal Access Token, allows downloading the Client bundle without hitting a Github API rate limit
|
|
9
10
|
GITHUB_PAT=1234567890abcdef1234567890abcdef12345678
|
|
@@ -39,7 +40,6 @@ OVERRIDE_DEMO_ROLE=ADMIN
|
|
|
39
40
|
# Debug express routes
|
|
40
41
|
DEBUG_ROUTES=false
|
|
41
42
|
DEBUG_SOCKET_STATES=false
|
|
42
|
-
DEBUG_FILE_WRITE_PRINTER_STATES=false
|
|
43
43
|
|
|
44
44
|
# Enables TypeORM
|
|
45
45
|
ENABLE_EXPERIMENTAL_TYPEORM=false
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
</a>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
|
-
FDM Monster is a server for managing your 3D printer farm through [OctoPrint](https://octoprint.org/) as well as [Klipper](https://www.klipper3d.org/) using [Moonraker](https://github.com/Arksine/moonraker).
|
|
23
|
+
FDM Monster is a server for managing your 3D printer farm through [OctoPrint](https://octoprint.org/) as well as [Klipper](https://www.klipper3d.org/) using [Moonraker](https://github.com/Arksine/moonraker) and [Prusa-Link](https://github.com/prusa3d/Prusa-Link).
|
|
24
24
|
|
|
25
25
|
## Check out our [documentation](https://docs.fdm-monster.net)
|
|
26
26
|
|
|
@@ -29,7 +29,7 @@ FDM Monster is a server for managing your 3D printer farm through [OctoPrint](ht
|
|
|
29
29
|
## Features 🖨️
|
|
30
30
|
Here is a list of features that make FDM Monster stand out:
|
|
31
31
|
|
|
32
|
-
- Adding OctoPrint and
|
|
32
|
+
- Adding OctoPrint, Moonraker and Prusa-Link instances
|
|
33
33
|
- Dragging or creating new printers on a customizable grid
|
|
34
34
|
- Drag n drop GCode to print
|
|
35
35
|
- Select printers and print one GCode file in batch
|
package/RELEASE_NOTES.MD
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# Develop
|
|
2
2
|
|
|
3
|
+
# FDM Monster 1.9.0
|
|
4
|
+
|
|
3
5
|
## Features
|
|
6
|
+
|
|
7
|
+
- Introduce separate upload timeout setting for better control and resilience
|
|
8
|
+
- Ability to add startPrint to specify print or not after upload
|
|
9
|
+
|
|
10
|
+
## Fixes
|
|
11
|
+
|
|
12
|
+
- OctoPrint 1.8.7 needs explicit passive flag in body instead of header to login
|
|
13
|
+
- PrusaLink subfeature was not added to printer type feature (new client packaged)
|
|
14
|
+
- Improve Moonraker error logging
|
|
15
|
+
- Make colored logs opt-in with "ENABLE_COLORED_LOGS: true" env var
|
|
16
|
+
- SocketIO gateway logs errors more explicitly
|
|
17
|
+
- Logger is now static, reducing memory usage and test duration
|
|
18
|
+
|
|
19
|
+
# FDM Monster 1.9.0-rc1
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
4
23
|
- Introduce PrusaLink adapter for limited printer support for these printers: MK3S(+) (needs PrusaLink extension with Raspberry Pi), Mini(+), MK4(S), XL, Core One
|
|
5
24
|
- Add opt-in Prometheus integration (still experimental)
|
|
6
25
|
- Add opt-in Loki integration (still experimental)
|
|
@@ -83,7 +83,8 @@ const getDefaultFrontendSettings = ()=>({
|
|
|
83
83
|
});
|
|
84
84
|
const timeoutSettingKey = "timeout";
|
|
85
85
|
const getDefaultTimeout = ()=>({
|
|
86
|
-
apiTimeout: 10000
|
|
86
|
+
apiTimeout: 10000,
|
|
87
|
+
apiUploadTimeout: 30000
|
|
87
88
|
});
|
|
88
89
|
const printerFileCleanSettingKey = "printerFileClean";
|
|
89
90
|
const getDefaultFileCleanSettings = ()=>({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants/server-settings.constants.ts"],"names":["credentialSettingsKey","frontendSettingKey","getDefaultCredentialSettings","getDefaultFileCleanSettings","getDefaultFrontendSettings","getDefaultServerSettings","getDefaultSettings","getDefaultTimeout","getDefaultWizardSettings","printerFileCleanSettingKey","serverSettingsKey","timeoutSettingKey","wizardSettingKey","wizardCompleted","wizardCompletedAt","wizardVersion","sentryDiagnosticsEnabled","loginRequired","registration","experimentalMoonrakerSupport","experimentalTypeormSupport","experimentalClientSupport","experimentalThumbnailSupport","experimentalPrusaLinkSupport","jwtExpiresIn","AppConstants","DEFAULT_JWT_EXPIRES_IN","refreshTokenAttempts","DEFAULT_REFRESH_TOKEN_ATTEMPTS","refreshTokenExpiry","DEFAULT_REFRESH_TOKEN_EXPIRY","gridCols","gridRows","largeTiles","tilePreferCancelOverQuickStop","apiTimeout","autoRemoveOldFilesBeforeUpload","autoRemoveOldFilesAtBoot","autoRemoveOldFilesCriteriumDays","jwtSecret","uuidv4"],"mappings":";;;;;;;;;;;IA+BaA,qBAAqB;eAArBA;;IAUAC,kBAAkB;eAAlBA;;IATAC,4BAA4B;eAA5BA;;
|
|
1
|
+
{"version":3,"sources":["../../src/constants/server-settings.constants.ts"],"names":["credentialSettingsKey","frontendSettingKey","getDefaultCredentialSettings","getDefaultFileCleanSettings","getDefaultFrontendSettings","getDefaultServerSettings","getDefaultSettings","getDefaultTimeout","getDefaultWizardSettings","printerFileCleanSettingKey","serverSettingsKey","timeoutSettingKey","wizardSettingKey","wizardCompleted","wizardCompletedAt","wizardVersion","sentryDiagnosticsEnabled","loginRequired","registration","experimentalMoonrakerSupport","experimentalTypeormSupport","experimentalClientSupport","experimentalThumbnailSupport","experimentalPrusaLinkSupport","jwtExpiresIn","AppConstants","DEFAULT_JWT_EXPIRES_IN","refreshTokenAttempts","DEFAULT_REFRESH_TOKEN_ATTEMPTS","refreshTokenExpiry","DEFAULT_REFRESH_TOKEN_EXPIRY","gridCols","gridRows","largeTiles","tilePreferCancelOverQuickStop","apiTimeout","apiUploadTimeout","autoRemoveOldFilesBeforeUpload","autoRemoveOldFilesAtBoot","autoRemoveOldFilesCriteriumDays","jwtSecret","uuidv4"],"mappings":";;;;;;;;;;;IA+BaA,qBAAqB;eAArBA;;IAUAC,kBAAkB;eAAlBA;;IATAC,4BAA4B;eAA5BA;;IAwBAC,2BAA2B;eAA3BA;;IAdAC,0BAA0B;eAA1BA;;IAtBAC,wBAAwB;eAAxBA;;IA0CAC,kBAAkB;eAAlBA;;IAZAC,iBAAiB;eAAjBA;;IArCAC,wBAAwB;eAAxBA;;IA0CAC,0BAA0B;eAA1BA;;IApCAC,iBAAiB;eAAjBA;;IA8BAC,iBAAiB;eAAjBA;;IArCAC,gBAAgB;eAAhBA;;;iCAZgB;sBASA;AAGtB,MAAMA,mBAAmB;AACzB,MAAMJ,2BAA2B,IAA0B,CAAA;QAChEK,iBAAiB;QACjBC,mBAAmB;QACnBC,eAAe;IACjB,CAAA;AAEO,MAAML,oBAAoB;AAC1B,MAAML,2BAA2B,IAA0B,CAAA;QAChEW,0BAA0B;QAC1BC,eAAe;QACfC,cAAc;QACdC,8BAA8B;QAC9BC,4BAA4B;QAC5BC,2BAA2B;QAC3BC,8BAA8B;QAC9BC,8BAA8B;IAChC,CAAA;AAEO,MAAMvB,wBAAwB;AAC9B,MAAME,+BAA+B,IAA8B,CAAA;QAExEsB,cAAcC,6BAAY,CAACC,sBAAsB;QAEjDC,sBAAsBF,6BAAY,CAACG,8BAA8B;QAEjEC,oBAAoBJ,6BAAY,CAACK,4BAA4B;IAC/D,CAAA;AAEO,MAAM7B,qBAAqB;AAC3B,MAAMG,6BAA6B,IAA4B,CAAA;QACpE2B,UAAU;QACVC,UAAU;QACVC,YAAY;QACZC,+BAA+B;IACjC,CAAA;AAEO,MAAMvB,oBAAoB;AAC1B,MAAMJ,oBAAoB,IAA2B,CAAA;QAC1D4B,YAAY;QACZC,kBAAkB;IACpB,CAAA;AAEO,MAAM3B,6BAA6B;AACnC,MAAMN,8BAA8B,IAA6B,CAAA;QACtEkC,gCAAgC;QAChCC,0BAA0B;QAC1BC,iCAAiC;IACnC,CAAA;AAEO,MAAMjC,qBAAqB,IAAO,CAAA;QACvC,CAACI,kBAAkB,EAAEL;QACrB,CAACO,iBAAiB,EAAEJ;QACpB,CAACR,sBAAsB,EAAE;YACvB,GAAGE,8BAA8B;YACjCsC,WAAWC,IAAAA,QAAM;QACnB;QACA,CAAChC,2BAA2B,EAAEN;QAC9B,CAACF,mBAAmB,EAAEG;QACtB,CAACO,kBAAkB,EAAEJ;IACvB,CAAA"}
|
|
@@ -149,6 +149,8 @@ class PrinterFilesController {
|
|
|
149
149
|
async uploadPrinterFile(req, res) {
|
|
150
150
|
const { currentPrinterId } = (0, _printerresolver.getScopedPrinter)(req);
|
|
151
151
|
const files = await this.multerService.multerLoadFileAsync(req, res, _serverconstants.AppConstants.defaultAcceptedGcodeExtensions, true);
|
|
152
|
+
const { startPrint: startPrintString } = await (0, _validators.validateInput)(req.body, _printerfilescontrollervalidation.uploadFileSchema);
|
|
153
|
+
const startPrint = startPrintString === "true";
|
|
152
154
|
if (!files?.length) {
|
|
153
155
|
throw new _runtimeexceptions.ValidationException({
|
|
154
156
|
error: `No file was available for upload. Did you upload files with one of these extensions: ${_serverconstants.AppConstants.defaultAcceptedGcodeExtensions.join(", ")}?`
|
|
@@ -165,7 +167,7 @@ class PrinterFilesController {
|
|
|
165
167
|
}
|
|
166
168
|
const uploadedFile = files[0];
|
|
167
169
|
const token = this.multerService.startTrackingSession(uploadedFile, currentPrinterId);
|
|
168
|
-
await this.printerApi.uploadFile(uploadedFile, token).catch((e)=>{
|
|
170
|
+
await this.printerApi.uploadFile(uploadedFile, startPrint, token).catch((e)=>{
|
|
169
171
|
try {
|
|
170
172
|
this.multerService.clearUploadedFile(uploadedFile);
|
|
171
173
|
} catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/controllers/printer-files.controller.ts"],"names":["PrinterFilesController","logger","constructor","loggerFactory","printerApi","printerLogin","printerFilesStore","printerFileCleanTask","settingsStore","multerService","printerThumbnailCache","name","purgeIndexedFiles","req","res","purgeFiles","send","getThumbnails","thumbnails","getAllValues","getFiles","currentPrinterId","getScopedPrinter","log","files","loadFiles","reloadThumbnail","filePath","validateInput","body","startPrintFileSchema","isThumbnailSupportEnabled","loadPrinterThumbnailRemote","params","id","e","error","errorSummary","captureException","startPrintFile","encodedFilePath","encodeURIComponent","startPrint","getFilesCache","currentPrinter","downloadFile","path","downloadFileSchema","response","setHeader","headers","length","data","pipe","deleteFileOrFolder","query","getFileSchema","result","deleteFile","clearPrinterFiles","failedFiles","succeededFiles","nonRecursiveFiles","file","push","purgePrinterFiles","getPrinterThumbnail","printerThumbnail","getValue","toString","uploadPrinterFile","multerLoadFileAsync","AppConstants","defaultAcceptedGcodeExtensions","ValidationException","join","fileCleanEnabled","isPreUploadFileCleanEnabled","cleanPrinterFiles","uploadedFile","token","startTrackingSession","uploadFile","catch","clearUploadedFile","loadPrinterThumbnailLocal","PrinterFiles","Clear","Get","Actions","Delete","Upload","apiRoute","authenticate","authorizeRoles","ROLES","ADMIN","OPERATOR","printerResolveMiddleware"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../src/controllers/printer-files.controller.ts"],"names":["PrinterFilesController","logger","constructor","loggerFactory","printerApi","printerLogin","printerFilesStore","printerFileCleanTask","settingsStore","multerService","printerThumbnailCache","name","purgeIndexedFiles","req","res","purgeFiles","send","getThumbnails","thumbnails","getAllValues","getFiles","currentPrinterId","getScopedPrinter","log","files","loadFiles","reloadThumbnail","filePath","validateInput","body","startPrintFileSchema","isThumbnailSupportEnabled","loadPrinterThumbnailRemote","params","id","e","error","errorSummary","captureException","startPrintFile","encodedFilePath","encodeURIComponent","startPrint","getFilesCache","currentPrinter","downloadFile","path","downloadFileSchema","response","setHeader","headers","length","data","pipe","deleteFileOrFolder","query","getFileSchema","result","deleteFile","clearPrinterFiles","failedFiles","succeededFiles","nonRecursiveFiles","file","push","purgePrinterFiles","getPrinterThumbnail","printerThumbnail","getValue","toString","uploadPrinterFile","multerLoadFileAsync","AppConstants","defaultAcceptedGcodeExtensions","startPrintString","uploadFileSchema","ValidationException","join","fileCleanEnabled","isPreUploadFileCleanEnabled","cleanPrinterFiles","uploadedFile","token","startTrackingSession","uploadFile","catch","clearUploadedFile","loadPrinterThumbnailLocal","PrinterFiles","Clear","Get","Actions","Delete","Upload","apiRoute","authenticate","authorizeRoles","ROLES","ADMIN","OPERATOR","printerResolveMiddleware"],"mappings":";;;;+BA6BaA;;;eAAAA;;;+BA7BoC;8BACQ;4BAC3B;iCACD;kDAMtB;mCAC6B;yBACK;wCACZ;mCACK;+BACJ;+BACA;sCACO;+BAEN;yBACG;qCACN;uCACU;sBACL;4BACJ;0BACJ;iCACQ;;;;;;;;;;AAI1B,MAAMA;;;;;;;;IACMC,OAAsB;IAEvCC,YACEC,aAA6B,EAC7B,AAAiBC,UAAuB,EACxC,AAAiBC,YAAsB,EACvC,AAAiBC,iBAAoC,EACrD,AAAiB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IC,IAAAA,4BAAc,EAAC;YAACC,6BAAK,CAACC,KAAK;YAAED,6BAAK,CAACE,QAAQ;SAAC;QAAGC,IAAAA,iCAAwB"}
|
|
@@ -53,6 +53,7 @@ class ServerPublicController {
|
|
|
53
53
|
getFeatures(req, res) {
|
|
54
54
|
const serverSettings = this.settingsStore.getServerSettings();
|
|
55
55
|
const moonrakerEnabled = serverSettings.experimentalMoonrakerSupport;
|
|
56
|
+
const prusaLinkEnabled = serverSettings.experimentalPrusaLinkSupport;
|
|
56
57
|
res.send({
|
|
57
58
|
printerGroupsApi: {
|
|
58
59
|
available: this.isTypeormMode,
|
|
@@ -63,11 +64,14 @@ class ServerPublicController {
|
|
|
63
64
|
available: true,
|
|
64
65
|
version: 1,
|
|
65
66
|
subFeatures: {
|
|
66
|
-
types:
|
|
67
|
+
types: [
|
|
67
68
|
"octoprint",
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
...moonrakerEnabled ? [
|
|
70
|
+
"klipper"
|
|
71
|
+
] : [],
|
|
72
|
+
...prusaLinkEnabled ? [
|
|
73
|
+
"prusaLink"
|
|
74
|
+
] : []
|
|
71
75
|
]
|
|
72
76
|
}
|
|
73
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/controllers/server-public.controller.ts"],"names":["ServerPublicController","constructor","settingsStore","serverVersion","serverReleaseService","monsterPiService","isTypeormMode","welcome","req","res","getSettings","getLoginRequired","send","message","getFeatures","serverSettings","getServerSettings","moonrakerEnabled","experimentalMoonrakerSupport","printerGroupsApi","available","version","subFeatures","multiplePrinterServices","types","getVersion","updateState","getState","monsterPiVersion","getMonsterPiVersionSafe","json","isNode","os","process","env","OS","monsterPi","update","synced","updateAvailable","airGapped","test","authenticate","permission","PERMS","ServerInfo","Get","apiRoute"],"mappings":";;;;+BAWaA;;;eAAAA;;;+BAXsB;iCACN;0BACN;8BACkB;wCACnB;+BACQ;sCACO;kCACJ;yBACC;;;;;;;;;;AAG3B,MAAMA;;;;;;IACXC,YACE,AAAiBC,aAA4B,EAC7C,AAAiBC,aAAqB,EACtC,AAAiBC,oBAA0C,EAC3D,AAAiBC,gBAAkC,EACnD,AAAiBC,aAAsB,CACvC;aALiBJ,gBAAAA;aACAC,gBAAAA;aACAC,uBAAAA;aACAC,mBAAAA;aACAC,gBAAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/controllers/server-public.controller.ts"],"names":["ServerPublicController","constructor","settingsStore","serverVersion","serverReleaseService","monsterPiService","isTypeormMode","welcome","req","res","getSettings","getLoginRequired","send","message","getFeatures","serverSettings","getServerSettings","moonrakerEnabled","experimentalMoonrakerSupport","prusaLinkEnabled","experimentalPrusaLinkSupport","printerGroupsApi","available","version","subFeatures","multiplePrinterServices","types","getVersion","updateState","getState","monsterPiVersion","getMonsterPiVersionSafe","json","isNode","os","process","env","OS","monsterPi","update","synced","updateAvailable","airGapped","test","authenticate","permission","PERMS","ServerInfo","Get","apiRoute"],"mappings":";;;;+BAWaA;;;eAAAA;;;+BAXsB;iCACN;0BACN;8BACkB;wCACnB;+BACQ;sCACO;kCACJ;yBACC;;;;;;;;;;AAG3B,MAAMA;;;;;;IACXC,YACE,AAAiBC,aAA4B,EAC7C,AAAiBC,aAAqB,EACtC,AAAiBC,oBAA0C,EAC3D,AAAiBC,gBAAkC,EACnD,AAAiBC,aAAsB,CACvC;aALiBJ,gBAAAA;aACAC,gBAAAA;aACAC,uBAAAA;aACAC,mBAAAA;aACAC,gBAAAA;IAEnB;IAKAC,QAAQC,GAAY,EAAEC,GAAa,EAAE;QACnC,IAAI,CAACP,aAAa,CAACQ,WAAW;QAE9B,IAAI,CAAC,IAAI,CAACR,aAAa,CAACS,gBAAgB,IAAI;YAC1C,OAAOF,IAAIG,IAAI,CAAC;gBACdC,SAAS;YACX;QACF;QAEA,OAAOJ,IAAIG,IAAI,CAAC;YACdC,SAAS;QACX;IACF;IAKAC,YAAYN,GAAY,EAAEC,GAAa,EAAE;QACvC,MAAM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,6 +17,9 @@ _export(exports, {
|
|
|
17
17
|
},
|
|
18
18
|
startPrintFileSchema: function() {
|
|
19
19
|
return startPrintFileSchema;
|
|
20
|
+
},
|
|
21
|
+
uploadFileSchema: function() {
|
|
22
|
+
return uploadFileSchema;
|
|
20
23
|
}
|
|
21
24
|
});
|
|
22
25
|
const _zod = require("zod");
|
|
@@ -29,5 +32,11 @@ const downloadFileSchema = _zod.z.object({
|
|
|
29
32
|
const getFileSchema = _zod.z.object({
|
|
30
33
|
path: _zod.z.string().min(1)
|
|
31
34
|
});
|
|
35
|
+
const uploadFileSchema = _zod.z.object({
|
|
36
|
+
startPrint: _zod.z.enum([
|
|
37
|
+
'true',
|
|
38
|
+
'false'
|
|
39
|
+
])
|
|
40
|
+
});
|
|
32
41
|
|
|
33
42
|
//# sourceMappingURL=printer-files-controller.validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controllers/validation/printer-files-controller.validation.ts"],"names":["downloadFileSchema","getFileSchema","startPrintFileSchema","z","object","filePath","string","min","path"],"mappings":";;;;;;;;;;;IAMaA,kBAAkB;eAAlBA;;IAIAC,aAAa;eAAbA;;IARAC,oBAAoB;eAApBA;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/controllers/validation/printer-files-controller.validation.ts"],"names":["downloadFileSchema","getFileSchema","startPrintFileSchema","uploadFileSchema","z","object","filePath","string","min","path","startPrint","enum"],"mappings":";;;;;;;;;;;IAMaA,kBAAkB;eAAlBA;;IAIAC,aAAa;eAAbA;;IARAC,oBAAoB;eAApBA;;IAYAC,gBAAgB;eAAhBA;;;qBAdK;AAEX,MAAMD,uBAAuBE,MAAC,CAACC,MAAM,CAAC;IAC3CC,UAAUF,MAAC,CAACG,MAAM,GAAGC,GAAG,CAAC;AAC3B;AAEO,MAAMR,qBAAqBI,MAAC,CAACC,MAAM,CAAC;IACzCI,MAAML,MAAC,CAACG,MAAM,GAAGC,GAAG,CAAC;AACvB;AAEO,MAAMP,gBAAgBG,MAAC,CAACC,MAAM,CAAC;IACpCI,MAAML,MAAC,CAACG,MAAM,GAAGC,GAAG,CAAC;AACvB;AAEO,MAAML,mBAAmBC,MAAC,CAACC,MAAM,CAAC;IACvCK,YAAYN,MAAC,CAACO,IAAI,CAAC;QAAC;QAAQ;KAAQ;AACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/entities/settings.entity.ts"],"names":["Settings","serverSettingsKey","credentialSettingsKey","wizardSettingKey","printerFileCleanSettingKey","frontendSettingKey","timeoutSettingKey","id","type","nullable"],"mappings":";;;;+BAYaA;;;eAAAA;;;yCALN;yBACgD;;;;;;;;;;IASrD,MAWA,OAQA,OAOA,OAOA,OAQA;AAzCA,OAACC,0CAAiB;AAWlB,QAACC,8CAAqB;AAQtB,QAACC,yCAAgB;AAOjB,QAACC,mDAA0B;AAO3B,QAACC,2CAAkB;AAQnB,QAACC,0CAAiB;AA9Cb,MAAMN;IAEXO,GAAW;IAGX,CAAA,KAAmB,CAQjB;IAGF,CAAA,MAAuB,CAKrB;IAGF,CAAA,MAAkB,CAIhB;IAGF,CAAA,MAA4B,CAI1B;IAGF,CAAA,MAAoB,CAKlB;IAGF,CAAA,MAAmB,
|
|
1
|
+
{"version":3,"sources":["../../src/entities/settings.entity.ts"],"names":["Settings","serverSettingsKey","credentialSettingsKey","wizardSettingKey","printerFileCleanSettingKey","frontendSettingKey","timeoutSettingKey","id","type","nullable"],"mappings":";;;;+BAYaA;;;eAAAA;;;yCALN;yBACgD;;;;;;;;;;IASrD,MAWA,OAQA,OAOA,OAOA,OAQA;AAzCA,OAACC,0CAAiB;AAWlB,QAACC,8CAAqB;AAQtB,QAACC,yCAAgB;AAOjB,QAACC,mDAA0B;AAO3B,QAACC,2CAAkB;AAQnB,QAACC,0CAAiB;AA9Cb,MAAMN;IAEXO,GAAW;IAGX,CAAA,KAAmB,CAQjB;IAGF,CAAA,MAAuB,CAKrB;IAGF,CAAA,MAAkB,CAIhB;IAGF,CAAA,MAA4B,CAI1B;IAGF,CAAA,MAAoB,CAKlB;IAGF,CAAA,MAAmB,CAGjB;AACJ;;;;;;;QA9CYC,MAAM;QAAeC,UAAU;;;uBACzC;;;QAUUD,MAAM;QAAeC,UAAU;;;uBACzC;;;QAOUD,MAAM;QAAeC,UAAU;;;uBACzC;;;QAMUD,MAAM;QAAeC,UAAU;;;uBACzC;;;QAMUD,MAAM;QAAeC,UAAU;;;uBACzC;;;QAOUD,MAAM;QAAeC,UAAU;;;uBACzC"}
|
|
@@ -10,8 +10,8 @@ Object.defineProperty(exports, "LoggerFactory", {
|
|
|
10
10
|
});
|
|
11
11
|
const _logger = require("./logger");
|
|
12
12
|
function LoggerFactory() {
|
|
13
|
-
return (name
|
|
14
|
-
return new _logger.LoggerService(name
|
|
13
|
+
return (name)=>{
|
|
14
|
+
return new _logger.LoggerService(name);
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/handlers/logger-factory.ts"],"names":["LoggerFactory","name","
|
|
1
|
+
{"version":3,"sources":["../../src/handlers/logger-factory.ts"],"names":["LoggerFactory","name","LoggerService"],"mappings":";;;;+BAIgBA;;;eAAAA;;;wBAJc;AAIvB,SAASA;IACd,OAAO,CAACC;QACN,OAAO,IAAIC,qBAAa,CAACD;IAC3B;AACF"}
|
package/dist/handlers/logger.js
CHANGED
|
@@ -8,172 +8,30 @@ Object.defineProperty(exports, "LoggerService", {
|
|
|
8
8
|
return LoggerService;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
12
|
-
const _path = require("path");
|
|
13
|
-
const _luxon = require("luxon");
|
|
14
|
-
const _serverconstants = require("../server.constants");
|
|
15
|
-
const _fsutils = require("../utils/fs.utils");
|
|
16
|
-
const _winstonloki = /*#__PURE__*/ _interop_require_default(require("winston-loki"));
|
|
17
|
-
const _zod = require("zod");
|
|
18
|
-
function _interop_require_default(obj) {
|
|
19
|
-
return obj && obj.__esModule ? obj : {
|
|
20
|
-
default: obj
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
const levelMap = {
|
|
24
|
-
error: "ERR",
|
|
25
|
-
warn: "WRN",
|
|
26
|
-
info: "INF",
|
|
27
|
-
debug: "DBG",
|
|
28
|
-
http: "HTT",
|
|
29
|
-
verbose: "VRB",
|
|
30
|
-
silly: "SLY"
|
|
31
|
-
};
|
|
32
|
-
const lokiLineClassProperty = "class";
|
|
33
|
-
const lokiValidationSchema = _zod.z.object({
|
|
34
|
-
lokiEnabled: _zod.z.boolean(),
|
|
35
|
-
lokiAddress: _zod.z.string().url(),
|
|
36
|
-
lokiTimeoutSeconds: _zod.z.coerce.number().positive().default(30),
|
|
37
|
-
lokiInterval: _zod.z.coerce.number().positive().default(15)
|
|
38
|
-
});
|
|
11
|
+
const _staticlogger = require("./logging/static.logger");
|
|
39
12
|
class LoggerService {
|
|
40
13
|
name;
|
|
41
14
|
logger;
|
|
42
|
-
constructor(name
|
|
43
|
-
const isProd = process.env[_serverconstants.AppConstants.NODE_ENV_KEY] === _serverconstants.AppConstants.defaultProductionEnv;
|
|
44
|
-
const isTest = process.env[_serverconstants.AppConstants.NODE_ENV_KEY] === _serverconstants.AppConstants.defaultTestEnv;
|
|
45
|
-
let effectiveLogLevel = logFilterLevel;
|
|
46
|
-
if (!effectiveLogLevel) {
|
|
47
|
-
effectiveLogLevel = isProd || isTest ? "warn" : "debug";
|
|
48
|
-
}
|
|
49
|
-
const isLokiEnabled = process.env[_serverconstants.AppConstants.ENABLE_LOKI_LOGGING] === "true";
|
|
50
|
-
const extraWinstonTransports = [];
|
|
51
|
-
if (isLokiEnabled) {
|
|
52
|
-
const lokiConfigValidationResult = lokiValidationSchema.safeParse({
|
|
53
|
-
lokiEnabled: isLokiEnabled,
|
|
54
|
-
lokiTimeoutSeconds: process.env[_serverconstants.AppConstants.LOKI_TIMEOUT_SECONDS],
|
|
55
|
-
lokiAddress: process.env[_serverconstants.AppConstants.LOKI_ADDRESS],
|
|
56
|
-
lokiInterval: process.env[_serverconstants.AppConstants.LOKI_INTERVAL]
|
|
57
|
-
});
|
|
58
|
-
if (lokiConfigValidationResult.success) {
|
|
59
|
-
extraWinstonTransports.push(new _winstonloki.default({
|
|
60
|
-
level: effectiveLogLevel,
|
|
61
|
-
host: lokiConfigValidationResult.data.lokiAddress,
|
|
62
|
-
interval: lokiConfigValidationResult.data.lokiInterval,
|
|
63
|
-
timeout: lokiConfigValidationResult.data.lokiTimeoutSeconds,
|
|
64
|
-
handleExceptions: true,
|
|
65
|
-
onConnectionError (error) {
|
|
66
|
-
console.debug(`Loki logger enabled, but connection failed. ${error}`);
|
|
67
|
-
},
|
|
68
|
-
labels: {
|
|
69
|
-
app: "fdm-monster-server"
|
|
70
|
-
},
|
|
71
|
-
json: false,
|
|
72
|
-
useWinstonMetaAsLabels: false,
|
|
73
|
-
format: _winston.default.format.json()
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
15
|
+
constructor(name){
|
|
77
16
|
this.name = name;
|
|
78
|
-
this.logger =
|
|
79
|
-
|
|
80
|
-
...extraWinstonTransports,
|
|
81
|
-
new _winston.default.transports.Console({
|
|
82
|
-
level: effectiveLogLevel,
|
|
83
|
-
format: _winston.default.format.combine(_winston.default.format((info)=>{
|
|
84
|
-
info.rawLevel = info.level;
|
|
85
|
-
return info;
|
|
86
|
-
})(), _winston.default.format.colorize({
|
|
87
|
-
colors: {
|
|
88
|
-
error: "red",
|
|
89
|
-
warn: "yellow",
|
|
90
|
-
info: "white",
|
|
91
|
-
debug: "gray",
|
|
92
|
-
http: "magenta",
|
|
93
|
-
verbose: "cyan",
|
|
94
|
-
silly: "gray"
|
|
95
|
-
},
|
|
96
|
-
level: true,
|
|
97
|
-
message: true,
|
|
98
|
-
all: false
|
|
99
|
-
}), _winston.default.format.printf((info)=>{
|
|
100
|
-
const now = new Date();
|
|
101
|
-
const timestamp = `${now.toISOString().split("T")[0]} ${now.toTimeString().split(" ")[0]}.${now.getMilliseconds().toString().padStart(3, "0")}`;
|
|
102
|
-
const levelAbbr = levelMap[info.rawLevel] || info.rawLevel.substring(0, 3).toUpperCase();
|
|
103
|
-
const gray = "\x1b[90m";
|
|
104
|
-
const reset = info.message.substring(0, 5) ?? "\x1b[0m";
|
|
105
|
-
const numberRegex = /\b\d+\b/g;
|
|
106
|
-
const coloredMessage = info.message.replace(numberRegex, (match)=>`\x1b[35m${match}${reset}`);
|
|
107
|
-
let logEntry = `${gray}[${timestamp} ${reset}${levelAbbr}${reset}${gray}]${reset} ${gray}[${reset}${name}${gray}]${reset} ${coloredMessage}`;
|
|
108
|
-
if (info.meta) {
|
|
109
|
-
const metaString = JSON.stringify(info.meta);
|
|
110
|
-
const coloredMeta = metaString.replace(numberRegex, (match)=>`\x1b[35m${match}${reset}`);
|
|
111
|
-
logEntry += ` ${coloredMeta}`;
|
|
112
|
-
}
|
|
113
|
-
return logEntry;
|
|
114
|
-
}))
|
|
115
|
-
})
|
|
116
|
-
],
|
|
117
|
-
format: _winston.default.format.printf((info)=>{
|
|
118
|
-
const now = new Date();
|
|
119
|
-
const timestamp = `${now.toISOString().split("T")[0]} ${now.toTimeString().split(" ")[0]}.${now.getMilliseconds().toString().padStart(3, "0")}`;
|
|
120
|
-
const levelAbbr = levelMap[info.level] || `[${info.level.substring(0, 3).toUpperCase()}]`;
|
|
121
|
-
let message = `[${timestamp} ${levelAbbr}] [${name}] ${info.message}`;
|
|
122
|
-
if (info.meta) {
|
|
123
|
-
const pascalCaseMeta = Object.entries(info.meta).reduce((acc, [key, value])=>{
|
|
124
|
-
const pascalKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
125
|
-
acc[pascalKey] = value;
|
|
126
|
-
return acc;
|
|
127
|
-
}, {});
|
|
128
|
-
message += ` ${JSON.stringify(pascalCaseMeta)}`;
|
|
129
|
-
}
|
|
130
|
-
return message;
|
|
131
|
-
})
|
|
17
|
+
this.logger = (0, _staticlogger.getStaticLogger)().child({
|
|
18
|
+
[_staticlogger.logContextClassProperty]: this.name
|
|
132
19
|
});
|
|
133
|
-
if (enableFileLogs) {
|
|
134
|
-
const date = _luxon.DateTime.now().toISODate();
|
|
135
|
-
const logFilePath = (0, _path.join)((0, _fsutils.superRootPath)(), _serverconstants.AppConstants.defaultLogsFolder, `${_serverconstants.AppConstants.logAppName}-${date}.log`);
|
|
136
|
-
this.logger.add(new _winston.default.transports.File({
|
|
137
|
-
level: isTest ? "warn" : "info",
|
|
138
|
-
filename: logFilePath,
|
|
139
|
-
maxsize: 5000000,
|
|
140
|
-
maxFiles: 5
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
20
|
}
|
|
144
21
|
newDebug(object) {
|
|
145
|
-
this.logger.debug(
|
|
146
|
-
...object,
|
|
147
|
-
[lokiLineClassProperty]: this.name
|
|
148
|
-
});
|
|
22
|
+
this.logger.debug(object);
|
|
149
23
|
}
|
|
150
24
|
log(message, meta) {
|
|
151
|
-
|
|
152
|
-
...meta,
|
|
153
|
-
[lokiLineClassProperty]: this.name
|
|
154
|
-
};
|
|
155
|
-
this.logger.log("info", message, enrichedMeta);
|
|
25
|
+
this.logger.log("info", message, meta);
|
|
156
26
|
}
|
|
157
27
|
warn(message, meta) {
|
|
158
|
-
|
|
159
|
-
...meta,
|
|
160
|
-
[lokiLineClassProperty]: this.name
|
|
161
|
-
};
|
|
162
|
-
this.logger.log("warn", message, enrichedMeta);
|
|
28
|
+
this.logger.log("warn", message, meta);
|
|
163
29
|
}
|
|
164
30
|
debug(message, meta) {
|
|
165
|
-
|
|
166
|
-
...meta,
|
|
167
|
-
[lokiLineClassProperty]: this.name
|
|
168
|
-
};
|
|
169
|
-
this.logger.log("debug", message, enrichedMeta);
|
|
31
|
+
this.logger.log("debug", message, meta);
|
|
170
32
|
}
|
|
171
33
|
error(message, meta) {
|
|
172
|
-
|
|
173
|
-
...meta,
|
|
174
|
-
[lokiLineClassProperty]: this.name
|
|
175
|
-
};
|
|
176
|
-
this.logger.log("error", message, enrichedMeta);
|
|
34
|
+
this.logger.log("error", message, meta);
|
|
177
35
|
}
|
|
178
36
|
}
|
|
179
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/handlers/logger.ts"],"names":["LoggerService","
|
|
1
|
+
{"version":3,"sources":["../../src/handlers/logger.ts"],"names":["LoggerService","logger","constructor","name","getStaticLogger","child","logContextClassProperty","newDebug","object","debug","log","message","meta","warn","error"],"mappings":";;;;+BAGaA;;;eAAAA;;;8BAF4C;AAElD,MAAMA;;IACXC,OAAuB;IAEvBC,YAAY,AAAiBC,IAAY,CAAE;aAAdA,OAAAA;QAC3B,IAAI,CAACF,MAAM,GAAGG,IAAAA,6BAAe,IAAGC,KAAK,CAAC;YAAE,CAACC,qCAAuB,CAAC,EAAE,IAAI,CAACH,IAAI;QAAC;IAC/E;IAEAI,SAASC,MAAW,EAAE;QACpB,IAAI,CAACP,MAAM,CAACQ,KAAK,CAACD;IACpB;IAEAE,IAAIC,OAAe,EAAEC,IAAU,EAAE;QAC/B,IAAI,CAACX,MAAM,CAACS,GAAG,CAAC,QAAQC,SAASC;IACnC;IAEAC,KAAKF,OAAe,EAAEC,IAAU,EAAE;QAChC,IAAI,CAACX,MAAM,CAACS,GAAG,CAAC,QAAQC,SAASC;IACnC;IAEAH,MAAME,OAAe,EAAEC,IAAU,EAAE;QACjC,IAAI,CAACX,MAAM,CAACS,GAAG,CAAC,SAASC,SAASC;IACpC;IAEAE,MAAMH,OAAe,EAAEC,IAAU,EAAE;QACjC,IAAI,CAACX,MAAM,CAACS,GAAG,CAAC,SAASC,SAASC;IACpC;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createFileLoggingTransport", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createFileLoggingTransport;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _luxon = require("luxon");
|
|
12
|
+
const _path = require("path");
|
|
13
|
+
const _fsutils = require("../../utils/fs.utils");
|
|
14
|
+
const _serverconstants = require("../../server.constants");
|
|
15
|
+
const _winston = /*#__PURE__*/ _interop_require_default(require("winston"));
|
|
16
|
+
function _interop_require_default(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function createFileLoggingTransport(options) {
|
|
22
|
+
if (!options.enabled) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const date = _luxon.DateTime.now().toISODate();
|
|
26
|
+
const logFilePath = (0, _path.join)((0, _fsutils.superRootPath)(), _serverconstants.AppConstants.defaultLogsFolder, `${_serverconstants.AppConstants.logAppName}-${date}.log`);
|
|
27
|
+
return new _winston.default.transports.File({
|
|
28
|
+
level: options.isTest ? "warn" : "info",
|
|
29
|
+
filename: logFilePath,
|
|
30
|
+
maxsize: 5000000,
|
|
31
|
+
maxFiles: 5
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=file-logging.transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/handlers/logging/file-logging.transport.ts"],"names":["createFileLoggingTransport","options","enabled","date","DateTime","now","toISODate","logFilePath","join","superRootPath","AppConstants","defaultLogsFolder","logAppName","winston","transports","File","level","isTest","filename","maxsize","maxFiles"],"mappings":";;;;+BAWgBA;;;eAAAA;;;uBAXS;sBACJ;yBACS;iCACD;gEACT;;;;;;AAOb,SAASA,2BAA2BC,OAA0B;IACnE,IAAI,CAACA,QAAQC,OAAO,EAAE;QACpB;IACF;IAEA,MAAMC,OAAOC,eAAQ,CAACC,GAAG,GAAGC,SAAS;IACrC,MAAMC,cAAcC,IAAAA,UAAI,EACtBC,IAAAA,sBAAa,KACbC,6BAAY,CAACC,iBAAiB,EAC9B,GAAGD,6BAAY,CAACE,UAAU,CAAC,CAAC,EAAET,KAAK,IAAI,CAAC;IAG1C,OAAO,IAAIU,gBAAO,CAACC,UAAU,CAACC,IAAI,CAAC;QACjCC,OAAOf,QAAQgB,MAAM,GAAG,SAAS;QACjCC,UAAUX;QACVY,SAAS;QACTC,UAAU;IACZ;AACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createLokiLoggingTransport", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createLokiLoggingTransport;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _winstonloki = /*#__PURE__*/ _interop_require_default(require("winston-loki"));
|
|
12
|
+
const _winston = /*#__PURE__*/ _interop_require_default(require("winston"));
|
|
13
|
+
const _nodeprocess = /*#__PURE__*/ _interop_require_default(require("node:process"));
|
|
14
|
+
const _serverconstants = require("../../server.constants");
|
|
15
|
+
const _zod = require("zod");
|
|
16
|
+
function _interop_require_default(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const lokiValidationSchema = _zod.z.object({
|
|
22
|
+
lokiEnabled: _zod.z.boolean(),
|
|
23
|
+
lokiAddress: _zod.z.string().url(),
|
|
24
|
+
lokiTimeoutSeconds: _zod.z.coerce.number().positive().default(30),
|
|
25
|
+
lokiInterval: _zod.z.coerce.number().positive().default(15)
|
|
26
|
+
});
|
|
27
|
+
function createLokiLoggingTransport(options) {
|
|
28
|
+
const lokiConfigValidationResult = lokiValidationSchema.safeParse({
|
|
29
|
+
lokiEnabled: _nodeprocess.default.env[_serverconstants.AppConstants.ENABLE_LOKI_LOGGING] === "true",
|
|
30
|
+
lokiTimeoutSeconds: _nodeprocess.default.env[_serverconstants.AppConstants.LOKI_TIMEOUT_SECONDS],
|
|
31
|
+
lokiAddress: _nodeprocess.default.env[_serverconstants.AppConstants.LOKI_ADDRESS],
|
|
32
|
+
lokiInterval: _nodeprocess.default.env[_serverconstants.AppConstants.LOKI_INTERVAL]
|
|
33
|
+
});
|
|
34
|
+
if (!lokiConfigValidationResult.success || !lokiConfigValidationResult.data.lokiEnabled) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
return new _winstonloki.default({
|
|
38
|
+
level: options.logLevel ?? "info",
|
|
39
|
+
host: lokiConfigValidationResult.data.lokiAddress,
|
|
40
|
+
interval: lokiConfigValidationResult.data.lokiInterval,
|
|
41
|
+
timeout: lokiConfigValidationResult.data.lokiTimeoutSeconds,
|
|
42
|
+
handleExceptions: true,
|
|
43
|
+
onConnectionError (error) {
|
|
44
|
+
console.debug(`Loki logger enabled, but connection failed. ${error}`);
|
|
45
|
+
},
|
|
46
|
+
labels: {
|
|
47
|
+
app: "fdm-monster-server"
|
|
48
|
+
},
|
|
49
|
+
json: false,
|
|
50
|
+
useWinstonMetaAsLabels: false,
|
|
51
|
+
format: _winston.default.format.json()
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=loki-logging.transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/handlers/logging/loki-logging.transport.ts"],"names":["createLokiLoggingTransport","lokiValidationSchema","z","object","lokiEnabled","boolean","lokiAddress","string","url","lokiTimeoutSeconds","coerce","number","positive","default","lokiInterval","options","lokiConfigValidationResult","safeParse","process","env","AppConstants","ENABLE_LOKI_LOGGING","LOKI_TIMEOUT_SECONDS","LOKI_ADDRESS","LOKI_INTERVAL","success","data","LokiTransport","level","logLevel","host","interval","timeout","handleExceptions","onConnectionError","error","console","debug","labels","app","json","useWinstonMetaAsLabels","format","winston"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;oE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