@quandis/qbo4.logging 4.0.1-CI-20240328-192659

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.
Files changed (58) hide show
  1. package/license.js +41 -0
  2. package/package.json +47 -0
  3. package/readme.md +11 -0
  4. package/src/ApplicationInsights.d.ts +27 -0
  5. package/src/ApplicationInsights.js +87 -0
  6. package/src/ApplicationInsights.js.map +1 -0
  7. package/src/ApplicationInsights.ts +85 -0
  8. package/src/ConsoleLogger.d.ts +10 -0
  9. package/src/ConsoleLogger.js +50 -0
  10. package/src/ConsoleLogger.js.map +1 -0
  11. package/src/ConsoleLogger.ts +57 -0
  12. package/src/ILogEntry.d.ts +7 -0
  13. package/src/ILogEntry.js +2 -0
  14. package/src/ILogEntry.js.map +1 -0
  15. package/src/ILogEntry.ts +9 -0
  16. package/src/ILogReader.d.ts +10 -0
  17. package/src/ILogReader.js +5 -0
  18. package/src/ILogReader.js.map +1 -0
  19. package/src/ILogReader.ts +12 -0
  20. package/src/ILogger.d.ts +22 -0
  21. package/src/ILogger.js +14 -0
  22. package/src/ILogger.js.map +1 -0
  23. package/src/ILogger.ts +39 -0
  24. package/src/ILoggerService.d.ts +13 -0
  25. package/src/ILoggerService.js +5 -0
  26. package/src/ILoggerService.js.map +1 -0
  27. package/src/ILoggerService.ts +14 -0
  28. package/src/LoggerService.d.ts +24 -0
  29. package/src/LoggerService.js +91 -0
  30. package/src/LoggerService.js.map +1 -0
  31. package/src/LoggerService.ts +83 -0
  32. package/src/MemoryLogger.d.ts +24 -0
  33. package/src/MemoryLogger.js +48 -0
  34. package/src/MemoryLogger.js.map +1 -0
  35. package/src/MemoryLogger.ts +58 -0
  36. package/src/Program.d.ts +26 -0
  37. package/src/Program.js +47 -0
  38. package/src/Program.js.map +1 -0
  39. package/src/Program.ts +55 -0
  40. package/src/declarations.d.ts +4 -0
  41. package/src/qbo-find.d.ts +1 -0
  42. package/src/qbo-find.js +79 -0
  43. package/src/qbo-find.js.map +1 -0
  44. package/src/qbo-find.ts +63 -0
  45. package/src/qbo-logging.d.ts +34 -0
  46. package/src/qbo-logging.js +187 -0
  47. package/src/qbo-logging.js.map +1 -0
  48. package/src/qbo-logging.ts +175 -0
  49. package/src/styles.d.ts +3 -0
  50. package/src/styles.js +14 -0
  51. package/src/styles.js.map +1 -0
  52. package/src/styles.ts +16 -0
  53. package/wwwroot/js/license.txt +41 -0
  54. package/wwwroot/js/qbo4.logging.js +35756 -0
  55. package/wwwroot/js/qbo4.logging.min.js +56 -0
  56. package/wwwroot/js/qbo4.logging.min.js.LICENSE.txt +41 -0
  57. package/wwwroot/js/qbo4.logging.min.js.map +1 -0
  58. package/wwwroot/readme.html +19 -0
@@ -0,0 +1,91 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Lifecycle, injectAll, injectable } from 'tsyringe';
14
+ import { ILoggerToken, LogLevel } from './ILogger.js';
15
+ import { services } from '@quandis/qbo4.configuration';
16
+ import { ILogReaderToken } from './ILogReader.js';
17
+ import { ILoggerServiceToken } from './ILoggerService.js';
18
+ import { RESOURCES } from './Program.js';
19
+ let LoggerService = class LoggerService {
20
+ constructor(loggers, readers) {
21
+ this.loggers = loggers;
22
+ this.readers = readers;
23
+ this.logTrace(`LoggingService.constructor loaded with ${loggers.length} loggers and ${readers.length} readers.`);
24
+ }
25
+ logTrace(message, ...args) {
26
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Trace, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
27
+ for (const logger of this.loggers) {
28
+ logger.logTrace(message, ...args);
29
+ }
30
+ }
31
+ logDebug(message, ...args) {
32
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Debug, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
33
+ for (const logger of this.loggers) {
34
+ logger.logDebug(message, ...args);
35
+ }
36
+ }
37
+ logInformation(message, ...args) {
38
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Information, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
39
+ for (const logger of this.loggers) {
40
+ logger.logInformation(message, ...args);
41
+ }
42
+ }
43
+ logWarning(message, ...args) {
44
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Warning, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
45
+ for (const logger of this.loggers) {
46
+ logger.logWarning(message, ...args);
47
+ }
48
+ }
49
+ logError(message, error, ...args) {
50
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Error, message: message, error, ...args }, bubbles: true, cancelable: true, composed: true }));
51
+ for (const logger of this.loggers) {
52
+ logger.logError(message, error, ...args);
53
+ }
54
+ }
55
+ logCritical(message, error, ...args) {
56
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Critical, message: message, error, ...args }, bubbles: true, cancelable: true, composed: true }));
57
+ for (const logger of this.loggers) {
58
+ logger.logCritical(message, error, ...args);
59
+ }
60
+ }
61
+ log(level, message, error, ...args) {
62
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: level, message: message, error, ...args }, bubbles: true, cancelable: true, composed: true }));
63
+ for (const logger of this.loggers) {
64
+ logger.log(level, message, error, ...args);
65
+ }
66
+ }
67
+ /**
68
+ * Retrieves all log entries.
69
+ */
70
+ getLogs() {
71
+ return this.readers.reduce((accumulatedLogs, reader) => {
72
+ const logs = reader.getLogs();
73
+ return accumulatedLogs.concat(logs);
74
+ }, []);
75
+ }
76
+ /**
77
+ * Clears all log entries from memory.
78
+ */
79
+ clearLogs() {
80
+ this.readers.forEach(reader => reader.clearLogs());
81
+ }
82
+ };
83
+ LoggerService = __decorate([
84
+ injectable(),
85
+ __param(0, injectAll(ILoggerToken)),
86
+ __param(1, injectAll(ILogReaderToken)),
87
+ __metadata("design:paramtypes", [Array, Array])
88
+ ], LoggerService);
89
+ export { LoggerService };
90
+ services.container.register(ILoggerServiceToken, { useClass: LoggerService }, { lifecycle: Lifecycle.Singleton });
91
+ //# sourceMappingURL=LoggerService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggerService.js","sourceRoot":"","sources":["LoggerService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAW,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAkB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGlC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAEtB,YAA6C,OAAkB,EAAsC,OAAqB;QAA7E,YAAO,GAAP,OAAO,CAAW;QAAsC,YAAO,GAAP,OAAO,CAAc;QACtH,IAAI,CAAC,QA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;QACxC,CAAC,EAAE,EAAE,CAAC,CAAC;IACX,CAAC;IAED;;OAEG;IACH,SAAS;QACL,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAvEY,aAAa;IADzB,UAAU,EAAE;IAGI,WAAA,SAAS,CAAC,YAAY,CAAC,CAAA;IAA8B,WAAA,SAAS,CAAC,eAAe,CAAC,CAAA;;GAFnF,aAAa,CAuEzB;;AAED,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAiB,mBAAmB,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { Lifecycle, injectAll, injectable } from 'tsyringe';
2
+ import { ILogEntry } from './ILogEntry.js';
3
+ import { ILogger, ILoggerToken, LogLevel } from './ILogger.js';
4
+ import { services } from '@quandis/qbo4.configuration';
5
+ import { ILogReader, ILogReaderToken } from './ILogReader.js';
6
+ import { ILoggerService, ILoggerServiceToken } from './ILoggerService.js';
7
+ import { RESOURCES } from './Program.js';
8
+
9
+ @injectable()
10
+ export class LoggerService implements ILoggerService {
11
+
12
+ constructor(@injectAll(ILoggerToken) private loggers: ILogger[], @injectAll(ILogReaderToken) private readers: ILogReader[]) {
13
+ this.logTrace(`LoggingService.constructor loaded with ${loggers.length} loggers and ${readers.length} readers.`);
14
+ }
15
+
16
+ logTrace(message: string, ...args: any[]): void {
17
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Trace, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
18
+ for (const logger of this.loggers) {
19
+ logger.logTrace(message, ...args);
20
+ }
21
+ }
22
+
23
+ logDebug(message: string, ...args: any[]): void {
24
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Debug, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
25
+ for (const logger of this.loggers) {
26
+ logger.logDebug(message, ...args);
27
+ }
28
+ }
29
+
30
+ logInformation(message: string, ...args: any[]): void {
31
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Information, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
32
+ for (const logger of this.loggers) {
33
+ logger.logInformation(message, ...args);
34
+ }
35
+ }
36
+
37
+ logWarning(message: string, ...args: any[]): void {
38
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Warning, message: message, ...args }, bubbles: true, cancelable: true, composed: true }));
39
+ for (const logger of this.loggers) {
40
+ logger.logWarning(message, ...args);
41
+ }
42
+ }
43
+
44
+ logError(message: string, error?: Error, ...args: any[]): void {
45
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Error, message: message, error, ...args }, bubbles: true, cancelable: true, composed: true }));
46
+ for (const logger of this.loggers) {
47
+ logger.logError(message, error, ...args);
48
+ }
49
+ }
50
+
51
+ logCritical(message: string, error?: Error, ...args: any[]): void {
52
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: LogLevel.Critical, message: message, error, ...args }, bubbles: true, cancelable: true, composed: true }));
53
+ for (const logger of this.loggers) {
54
+ logger.logCritical(message, error, ...args);
55
+ }
56
+ }
57
+
58
+ log(level: LogLevel, message: string, error?: Error, ...args: any[]): void {
59
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITING_LOG, { detail: { logLevel: level, message: message, error, ...args }, bubbles: true, cancelable: true, composed: true }));
60
+ for (const logger of this.loggers) {
61
+ logger.log(level, message, error, ...args);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Retrieves all log entries.
67
+ */
68
+ getLogs() {
69
+ return this.readers.reduce((accumulatedLogs: ILogEntry[], reader) => {
70
+ const logs = reader.getLogs();
71
+ return accumulatedLogs.concat(logs);
72
+ }, []);
73
+ }
74
+
75
+ /**
76
+ * Clears all log entries from memory.
77
+ */
78
+ clearLogs() {
79
+ this.readers.forEach(reader => reader.clearLogs());
80
+ }
81
+ }
82
+
83
+ services.container.register<ILoggerService>(ILoggerServiceToken, { useClass: LoggerService }, { lifecycle: Lifecycle.Singleton });
@@ -0,0 +1,24 @@
1
+ import { ILogger, LogLevel } from './ILogger.js';
2
+ import { ILogReader } from './ILogReader.js';
3
+ import { ILogEntry } from './ILogEntry.js';
4
+ /**
5
+ * A simple in-memory logger that stores log entries in memory.
6
+ */
7
+ export declare class MemoryLogger implements ILogger, ILogReader {
8
+ private logs;
9
+ logTrace(message: string, ...args: any[]): void;
10
+ logDebug(message: string, ...args: any[]): void;
11
+ logInformation(message: string, ...args: any[]): void;
12
+ logWarning(message: string, ...args: any[]): void;
13
+ logError(message: string, error?: Error, ...args: any[]): void;
14
+ logCritical(message: string, error?: Error, ...args: any[]): void;
15
+ log(level: LogLevel, message: string, error?: Error, ...args: any[]): void;
16
+ /**
17
+ * Retrieves all log entries.
18
+ */
19
+ getLogs(): ILogEntry[];
20
+ /**
21
+ * Clears all log entries from memory.
22
+ */
23
+ clearLogs(): void;
24
+ }
@@ -0,0 +1,48 @@
1
+ import { ILoggerToken, LogLevel } from './ILogger.js';
2
+ import { ILogReaderToken } from './ILogReader.js';
3
+ import { services } from '@quandis/qbo4.configuration';
4
+ /**
5
+ * A simple in-memory logger that stores log entries in memory.
6
+ */
7
+ export class MemoryLogger {
8
+ constructor() {
9
+ this.logs = [];
10
+ }
11
+ logTrace(message, ...args) {
12
+ this.logs.push({ logLevel: LogLevel.Trace, message, args });
13
+ }
14
+ logDebug(message, ...args) {
15
+ this.logs.push({ logLevel: LogLevel.Debug, message, args });
16
+ }
17
+ logInformation(message, ...args) {
18
+ this.logs.push({ logLevel: LogLevel.Information, message, args });
19
+ }
20
+ logWarning(message, ...args) {
21
+ this.logs.push({ logLevel: LogLevel.Warning, message, args });
22
+ }
23
+ logError(message, error, ...args) {
24
+ this.logs.push({ logLevel: LogLevel.Error, message, error, args });
25
+ }
26
+ logCritical(message, error, ...args) {
27
+ this.logs.push({ logLevel: LogLevel.Critical, message, error, args });
28
+ }
29
+ log(level, message, error, ...args) {
30
+ this.logs.push({ logLevel: level, message, error, args });
31
+ }
32
+ /**
33
+ * Retrieves all log entries.
34
+ */
35
+ getLogs() {
36
+ return this.logs;
37
+ }
38
+ /**
39
+ * Clears all log entries from memory.
40
+ */
41
+ clearLogs() {
42
+ this.logs = [];
43
+ }
44
+ }
45
+ services.container.registerSingleton(MemoryLogger);
46
+ services.container.register(ILoggerToken, { useToken: MemoryLogger });
47
+ services.container.register(ILogReaderToken, { useToken: MemoryLogger });
48
+ //# sourceMappingURL=MemoryLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MemoryLogger.js","sourceRoot":"","sources":["MemoryLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD;;GAEG;AACH,MAAM,OAAO,YAAY;IAAzB;QACY,SAAI,GAAgB,EAAE,CAAC;IA2CnC,CAAC;IAzCG,QAAQ,CAAC,OAAe,EAAE,GAAG,IAAW;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,QAAQ,CAAC,OAAe,EAAE,GAAG,IAAW;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,cAAc,CAAC,O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Y,EAAE,CAAC,CAAC;AAC/E,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAa,eAAe,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { ILogger, ILoggerToken, LogLevel } from './ILogger.js';
2
+ import { ILogReader, ILogReaderToken } from './ILogReader.js';
3
+ import { services } from '@quandis/qbo4.configuration';
4
+ import { ILogEntry } from './ILogEntry.js';
5
+
6
+ /**
7
+ * A simple in-memory logger that stores log entries in memory.
8
+ */
9
+ export class MemoryLogger implements ILogger, ILogReader {
10
+ private logs: ILogEntry[] = [];
11
+
12
+ logTrace(message: string, ...args: any[]): void {
13
+ this.logs.push({ logLevel: LogLevel.Trace, message, args });
14
+ }
15
+
16
+ logDebug(message: string, ...args: any[]): void {
17
+ this.logs.push({ logLevel: LogLevel.Debug, message, args });
18
+ }
19
+
20
+ logInformation(message: string, ...args: any[]): void {
21
+ this.logs.push({ logLevel: LogLevel.Information, message, args });
22
+ }
23
+
24
+ logWarning(message: string, ...args: any[]): void {
25
+ this.logs.push({ logLevel: LogLevel.Warning, message, args });
26
+ }
27
+
28
+ logError(message: string, error?: Error, ...args: any[]): void {
29
+ this.logs.push({ logLevel: LogLevel.Error, message, error, args });
30
+ }
31
+
32
+ logCritical(message: string, error?: Error, ...args: any[]): void {
33
+ this.logs.push({ logLevel: LogLevel.Critical, message, error, args });
34
+ }
35
+
36
+ log(level: LogLevel, message: string, error?: Error, ...args: any[]): void {
37
+ this.logs.push({ logLevel: level, message, error, args });
38
+ }
39
+
40
+ /**
41
+ * Retrieves all log entries.
42
+ */
43
+ getLogs() {
44
+ return this.logs;
45
+ }
46
+
47
+ /**
48
+ * Clears all log entries from memory.
49
+ */
50
+ clearLogs() {
51
+ this.logs = [];
52
+ }
53
+ }
54
+
55
+ services.container.registerSingleton(MemoryLogger);
56
+ services.container.register<ILogger>(ILoggerToken, { useToken: MemoryLogger });
57
+ services.container.register<ILogReader>(ILogReaderToken, { useToken: MemoryLogger });
58
+
@@ -0,0 +1,26 @@
1
+ import 'reflect-metadata';
2
+ export declare const RESOURCES: {
3
+ WRITE_LOG: string;
4
+ WRITING_LOG: string;
5
+ };
6
+ export * from '@quandis/qbo4.configuration';
7
+ export * from './ILogEntry.js';
8
+ export * from './ILogger.js';
9
+ export * from './ILoggerService.js';
10
+ export * from './ILogReader.js';
11
+ export * from './ConsoleLogger.js';
12
+ export * from './MemoryLogger.js';
13
+ export * from './ApplicationInsights.js';
14
+ export * from './LoggerService.js';
15
+ export * from './styles.js';
16
+ export * from './qbo-logging.js';
17
+ export * from './qbo-find.js';
18
+ export declare function enumValue<T>(enumObj: {
19
+ [s: number]: string;
20
+ }, value: string): T | undefined;
21
+ export declare function trace(message: string, ...args: any[]): void;
22
+ export declare function debug(message: string, ...args: any[]): void;
23
+ export declare function info(message: string, ...args: any[]): void;
24
+ export declare function warn(message: string, ...args: any[]): void;
25
+ export declare function error(message: string, ...args: any[]): void;
26
+ export declare function critial(message: string, error?: Error, ...args: any[]): void;
package/src/Program.js ADDED
@@ -0,0 +1,47 @@
1
+ import 'reflect-metadata';
2
+ import { LogLevel } from './ILogger.js';
3
+ // Constants specific to the logging module
4
+ export const RESOURCES = {
5
+ // DOM can cause a log to be written via: window.dispatchEvent(new CustomEvent('qbo-log', { detail: { logLevel: 3, message: '...'}})
6
+ WRITE_LOG: "qbo-log",
7
+ // DOM Can listen for a log to be written via: window.addEventListener('qbo-log-write', (event) => { ... })
8
+ WRITING_LOG: "qbo-log-write"
9
+ };
10
+ export * from '@quandis/qbo4.configuration';
11
+ export * from './ILogEntry.js';
12
+ export * from './ILogger.js';
13
+ export * from './ILoggerService.js';
14
+ export * from './ILogReader.js';
15
+ export * from './ConsoleLogger.js';
16
+ export * from './MemoryLogger.js';
17
+ export * from './ApplicationInsights.js';
18
+ export * from './LoggerService.js';
19
+ export * from './styles.js';
20
+ export * from './qbo-logging.js';
21
+ export * from './qbo-find.js';
22
+ export function enumValue(enumObj, value) {
23
+ const keys = Object.keys(enumObj).filter(x => isNaN(Number(x))); // Get enum keys
24
+ const foundKey = keys.find(key => key.toLowerCase() === value.toLowerCase());
25
+ return foundKey !== undefined ? enumObj[foundKey] : undefined;
26
+ }
27
+ export function trace(message, ...args) {
28
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Trace, message: message, ...args } }));
29
+ console.log(message, ...args);
30
+ }
31
+ export function debug(message, ...args) {
32
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Debug, message: message, ...args } }));
33
+ }
34
+ export function info(message, ...args) {
35
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Information, message: message, ...args } }));
36
+ }
37
+ export function warn(message, ...args) {
38
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Warning, message: message, ...args } }));
39
+ }
40
+ export function error(message, ...args) {
41
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Error, message: message, ...args } }));
42
+ }
43
+ export function critial(message, error, ...args) {
44
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Critical, message: message, error: error, ...args } }));
45
+ }
46
+ // export { enumValue }
47
+ //# sourceMappingURL=Program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Program.js","sourceRoot":"","sources":["Program.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,oIAAoI;IACpI,SAAS,EAAE,SAAS;IACpB,2GAA2G;IAC3G,WAAW,EAAE,eAAe;CAC/B,CAAC;AAEF,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC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ts ADDED
@@ -0,0 +1,55 @@
1
+ import 'reflect-metadata';
2
+ import { LogLevel } from './ILogger.js';
3
+
4
+ // Constants specific to the logging module
5
+ export const RESOURCES = {
6
+ // DOM can cause a log to be written via: window.dispatchEvent(new CustomEvent('qbo-log', { detail: { logLevel: 3, message: '...'}})
7
+ WRITE_LOG: "qbo-log",
8
+ // DOM Can listen for a log to be written via: window.addEventListener('qbo-log-write', (event) => { ... })
9
+ WRITING_LOG: "qbo-log-write"
10
+ };
11
+
12
+ export * from '@quandis/qbo4.configuration';
13
+ export * from './ILogEntry.js';
14
+ export * from './ILogger.js';
15
+ export * from './ILoggerService.js';
16
+ export * from './ILogReader.js';
17
+ export * from './ConsoleLogger.js';
18
+ export * from './MemoryLogger.js';
19
+ export * from './ApplicationInsights.js';
20
+ export * from './LoggerService.js';
21
+ export * from './styles.js'
22
+ export * from './qbo-logging.js';
23
+ export * from './qbo-find.js';
24
+
25
+ export function enumValue<T>(enumObj: { [s: number]: string }, value: string): T | undefined {
26
+ const keys = Object.keys(enumObj).filter(x => isNaN(Number(x))); // Get enum keys
27
+ const foundKey = keys.find(key => key.toLowerCase() === value.toLowerCase());
28
+ return foundKey !== undefined ? enumObj[foundKey as any] as T : undefined;
29
+ }
30
+
31
+ export function trace(message: string, ...args: any[]) {
32
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Trace, message: message, ...args } }))
33
+ console.log(message, ...args);
34
+ }
35
+
36
+ export function debug(message: string, ...args: any[]) {
37
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Debug, message: message, ...args } }))
38
+ }
39
+
40
+ export function info(message: string, ...args: any[]) {
41
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Information, message: message, ...args } }))
42
+ }
43
+
44
+ export function warn(message: string, ...args: any[]) {
45
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Warning, message: message, ...args } }))
46
+ }
47
+ export function error(message: string, ...args: any[]) {
48
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Error, message: message, ...args } }))
49
+ }
50
+ export function critial(message: string, error?: Error, ...args: any[]) {
51
+ window.dispatchEvent(new CustomEvent(RESOURCES.WRITE_LOG, { detail: { logLevel: LogLevel.Critical, message: message, error: error, ...args } }))
52
+ }
53
+
54
+
55
+ // export { enumValue }
@@ -0,0 +1,4 @@
1
+ declare module '*.css' {
2
+ const content: { [className: string]: string };
3
+ export default content;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,79 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { LitElement, html } from 'lit';
11
+ import { property } from 'lit/decorators.js';
12
+ import { findStyles } from './styles.js';
13
+ class QboFind extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.selector = '';
17
+ this.cssClass = '';
18
+ this.selectorRoot = '';
19
+ }
20
+ static { this.styles = [
21
+ findStyles
22
+ ]; }
23
+ render() {
24
+ return html `<slot>
25
+ <input type="text" @input="${this.handleInput}" placeholder="Filter ...">
26
+ </slot>
27
+ `;
28
+ }
29
+ connectedCallback() {
30
+ super.connectedCallback();
31
+ this.root = this.getRoot();
32
+ }
33
+ getRoot() {
34
+ if (this.selectorRoot) {
35
+ // Find the nearest ancestor with the specified tag name
36
+ let ancestor = this.closest(this.selectorRoot);
37
+ // If ancestor is not found in the current shadow DOM context, look up in the document
38
+ return ancestor ? ancestor : document;
39
+ }
40
+ else {
41
+ return document;
42
+ }
43
+ }
44
+ handleInput(event) {
45
+ const searchText = event.target.value.toLowerCase();
46
+ const elements = this.root?.querySelectorAll(this.selector);
47
+ if (elements === null || elements === undefined)
48
+ return;
49
+ elements.forEach(element => {
50
+ const textContent = element.textContent?.toLowerCase() || "";
51
+ if (!textContent.includes(searchText)) {
52
+ if (this.cssClass)
53
+ element.classList.add(this.cssClass);
54
+ else if (element instanceof HTMLElement)
55
+ element.style.display = 'none';
56
+ }
57
+ else {
58
+ if (this.cssClass)
59
+ element.classList.remove(this.cssClass);
60
+ else if (element instanceof HTMLElement)
61
+ element.style.display = '';
62
+ }
63
+ });
64
+ }
65
+ }
66
+ __decorate([
67
+ property({ type: String }),
68
+ __metadata("design:type", Object)
69
+ ], QboFind.prototype, "selector", void 0);
70
+ __decorate([
71
+ property({ type: String }),
72
+ __metadata("design:type", Object)
73
+ ], QboFind.prototype, "cssClass", void 0);
74
+ __decorate([
75
+ property({ type: String }),
76
+ __metadata("design:type", Object)
77
+ ], QboFind.prototype, "selectorRoot", void 0);
78
+ customElements.define('qbo-find', QboFind);
79
+ //# sourceMappingURL=qbo-find.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qbo-find.js","sourceRoot":"","sources":["qbo-find.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAO,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QAMI,aAAQ,GAAG,EAAE,CAAC;QAGd,aAAQ,GAAG,EAAE,CAAC;QA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,CAAC,OAAO,GAAG,MAAM,CAAC;YACvC,CAAC;iBAAM,CAAC;gBACJ,IAAI,IAAI,CAAC,QAAQ;oBACb,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;qBACvC,IAAI,OAAO,YAAY,WAAW;oBACnC,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;YACnC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;;AAlDD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACT;AA8CtB,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { findStyles } from './styles.js';
4
+
5
+ class QboFind extends LitElement {
6
+ static styles = [
7
+ findStyles
8
+ ];
9
+
10
+ @property({ type: String })
11
+ selector = '';
12
+
13
+ @property({ type: String })
14
+ cssClass = '';
15
+
16
+ @property({ type: String })
17
+ selectorRoot = '';
18
+
19
+ root: Element | Document | ShadowRoot | undefined;
20
+
21
+ render() {
22
+ return html`<slot>
23
+ <input type="text" @input="${this.handleInput}" placeholder="Filter ...">
24
+ </slot>
25
+ `;
26
+ }
27
+
28
+ connectedCallback() {
29
+ super.connectedCallback();
30
+ this.root = this.getRoot();
31
+ }
32
+ getRoot() {
33
+ if (this.selectorRoot) {
34
+ // Find the nearest ancestor with the specified tag name
35
+ let ancestor = this.closest(this.selectorRoot);
36
+ // If ancestor is not found in the current shadow DOM context, look up in the document
37
+ return ancestor ? ancestor : document;
38
+ } else {
39
+ return document;
40
+ }
41
+ }
42
+
43
+ handleInput(event) {
44
+ const searchText = event.target.value.toLowerCase();
45
+ const elements = this.root?.querySelectorAll(this.selector);
46
+ if (elements === null || elements === undefined) return;
47
+ elements.forEach(element => {
48
+ const textContent = element.textContent?.toLowerCase() || "";
49
+ if (!textContent.includes(searchText)) {
50
+ if (this.cssClass)
51
+ element.classList.add(this.cssClass);
52
+ else if (element instanceof HTMLElement)
53
+ element.style.display = 'none';
54
+ } else {
55
+ if (this.cssClass)
56
+ element.classList.remove(this.cssClass);
57
+ else if (element instanceof HTMLElement)
58
+ element.style.display = '';
59
+ }
60
+ });
61
+ }
62
+ }
63
+ customElements.define('qbo-find', QboFind);
@@ -0,0 +1,34 @@
1
+ import { LitElement } from "lit";
2
+ import { ILogEntry } from "./ILogEntry.js";
3
+ export declare class QboLogging extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ debug: boolean;
6
+ info: boolean;
7
+ warning: boolean;
8
+ error: boolean;
9
+ critial: boolean;
10
+ window: boolean;
11
+ logs: ILogEntry[];
12
+ logCounts: {
13
+ 0: number;
14
+ 1: number;
15
+ 2: number;
16
+ 3: number;
17
+ 4: number;
18
+ 5: number;
19
+ };
20
+ showModal: boolean;
21
+ private loggerService;
22
+ private static logLevelNames;
23
+ constructor();
24
+ showLogs(): void;
25
+ hideLogs(): void;
26
+ logWindowError: (event: any) => void;
27
+ logRejection: (event: any) => void;
28
+ addLog: (event: any) => void;
29
+ toLog(event: CustomEvent): ILogEntry;
30
+ connectedCallback(): Promise<void>;
31
+ disconnectedCallback(): Promise<void>;
32
+ renderLogCounts(): void;
33
+ render(): import("lit-html").TemplateResult<1>;
34
+ }