@c-rex/core 0.1.1 → 0.1.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/api/cookies.d.mts +17 -0
- package/dist/api/cookies.d.ts +17 -0
- package/dist/api/cookies.js +65 -0
- package/dist/api/cookies.js.map +1 -0
- package/dist/api/cookies.mjs +39 -0
- package/dist/api/cookies.mjs.map +1 -0
- package/dist/api/rpc.d.mts +16 -0
- package/dist/api/rpc.d.ts +16 -0
- package/dist/api/rpc.js +217 -0
- package/dist/api/rpc.js.map +1 -0
- package/dist/api/rpc.mjs +180 -0
- package/dist/api/rpc.mjs.map +1 -0
- package/dist/api/token.d.mts +13 -0
- package/dist/api/token.d.ts +13 -0
- package/dist/api/token.js +61 -0
- package/dist/api/token.js.map +1 -0
- package/dist/api/token.mjs +36 -0
- package/dist/api/token.mjs.map +1 -0
- package/dist/index.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +183 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -83
- package/dist/index.mjs.map +1 -1
- package/dist/logger.d.mts +24 -0
- package/dist/logger.d.ts +24 -0
- package/dist/logger.js +51 -9
- package/dist/logger.js.map +1 -1
- package/dist/logger.mjs +52 -10
- package/dist/logger.mjs.map +1 -1
- package/package.json +19 -5
package/dist/logger.js
CHANGED
|
@@ -47,12 +47,17 @@ var LOG_LEVELS = {
|
|
|
47
47
|
info: 6,
|
|
48
48
|
debug: 7
|
|
49
49
|
};
|
|
50
|
-
var
|
|
50
|
+
var DEFAULT_COOKIE_LIMIT = 7 * 24 * 60 * 60 * 1e3;
|
|
51
51
|
|
|
52
52
|
// src/transports/matomo.ts
|
|
53
53
|
var MatomoTransport = class extends import_winston_transport.default {
|
|
54
54
|
matomoTransport;
|
|
55
55
|
configs;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new instance of MatomoTransport.
|
|
58
|
+
*
|
|
59
|
+
* @param configs - The application configuration containing logging settings
|
|
60
|
+
*/
|
|
56
61
|
constructor(configs) {
|
|
57
62
|
super({
|
|
58
63
|
level: configs.logs.console.minimumLevel,
|
|
@@ -61,6 +66,12 @@ var MatomoTransport = class extends import_winston_transport.default {
|
|
|
61
66
|
this.matomoTransport = new import_winston_transport.default();
|
|
62
67
|
this.configs = configs;
|
|
63
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Logs a message to Matomo if the message category is included in the configured categories.
|
|
71
|
+
*
|
|
72
|
+
* @param info - The log information including level, message, and category
|
|
73
|
+
* @param callback - Callback function to execute after logging
|
|
74
|
+
*/
|
|
64
75
|
log(info, callback) {
|
|
65
76
|
const matomoCategory = this.configs.logs.matomo.categoriesLevel;
|
|
66
77
|
if (matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {
|
|
@@ -75,6 +86,11 @@ var import_winston_graylog2 = __toESM(require("winston-graylog2"));
|
|
|
75
86
|
var GraylogTransport = class extends import_winston_transport2.default {
|
|
76
87
|
graylogTransport;
|
|
77
88
|
configs;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new instance of GraylogTransport.
|
|
91
|
+
*
|
|
92
|
+
* @param configs - The application configuration containing logging settings
|
|
93
|
+
*/
|
|
78
94
|
constructor(configs) {
|
|
79
95
|
super({
|
|
80
96
|
level: configs.logs.graylog.minimumLevel,
|
|
@@ -90,6 +106,12 @@ var GraylogTransport = class extends import_winston_transport2.default {
|
|
|
90
106
|
}
|
|
91
107
|
});
|
|
92
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Logs a message to Graylog if the message category is included in the configured categories.
|
|
111
|
+
*
|
|
112
|
+
* @param info - The log information including level, message, and category
|
|
113
|
+
* @param callback - Callback function to execute after logging
|
|
114
|
+
*/
|
|
93
115
|
log(info, callback) {
|
|
94
116
|
const graylogCategory = this.configs.logs.graylog.categoriesLevel;
|
|
95
117
|
if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
|
|
@@ -103,22 +125,42 @@ var import_next_cookies = require("@c-rex/utils/next-cookies");
|
|
|
103
125
|
var CrexLogger = class {
|
|
104
126
|
customerConfig;
|
|
105
127
|
logger;
|
|
128
|
+
/**
|
|
129
|
+
* Initializes the logger instance if it hasn't been initialized yet.
|
|
130
|
+
* Loads customer configuration and creates the logger with appropriate transports.
|
|
131
|
+
*
|
|
132
|
+
* @private
|
|
133
|
+
*/
|
|
106
134
|
async initLogger() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
throw new Error("SDK not initialized");
|
|
135
|
+
try {
|
|
136
|
+
if (!this.customerConfig) {
|
|
137
|
+
this.customerConfig = await (0, import_next_cookies.getConfigs)();
|
|
111
138
|
}
|
|
112
|
-
this.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
139
|
+
if (!this.logger) {
|
|
140
|
+
this.logger = this.createLogger();
|
|
141
|
+
}
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.error("Error initializing logger:", error);
|
|
116
144
|
}
|
|
117
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Logs a message with the specified level and optional category.
|
|
148
|
+
*
|
|
149
|
+
* @param options - Logging options
|
|
150
|
+
* @param options.level - The log level (error, warn, info, etc.)
|
|
151
|
+
* @param options.message - The message to log
|
|
152
|
+
* @param options.category - Optional category for the log message
|
|
153
|
+
*/
|
|
118
154
|
async log({ level, message, category }) {
|
|
119
155
|
await this.initLogger();
|
|
120
156
|
this.logger.log(level, message, category);
|
|
121
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Creates a new Winston logger instance with configured transports.
|
|
160
|
+
*
|
|
161
|
+
* @private
|
|
162
|
+
* @returns A configured Winston logger instance
|
|
163
|
+
*/
|
|
122
164
|
createLogger() {
|
|
123
165
|
return import_winston.default.createLogger({
|
|
124
166
|
levels: LOG_LEVELS,
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/logger.ts","../src/transports/matomo.ts","../../constants/src/index.ts","../src/transports/graylog.ts"],"sourcesContent":["import winston from \"winston\";\nimport { MatomoTransport } from \"./transports/matomo\";\nimport { GraylogTransport } from \"./transports/graylog\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { LOG_LEVELS, SDK_CONFIG_KEY } from \"@c-rex/constants\";\nimport { getCookie } from \"@c-rex/utils/next-cookies\";\n\nexport class CrexLogger {\n private customerConfig!: ConfigInterface;\n public logger!: winston.Logger;\n\n private async initLogger() {\n if (!this.customerConfig) {\n const jsonConfigs = await getCookie(SDK_CONFIG_KEY);\n if (!jsonConfigs) {\n throw new Error(\"SDK not initialized\");\n }\n this.customerConfig = JSON.parse(jsonConfigs) as ConfigInterface;\n }\n\n if (!this.logger) {\n this.logger = this.createLogger();\n }\n }\n\n public async log({ level, message, category }: {\n level: LogLevelType,\n message: string,\n category?: LogCategoriesType\n }) {\n await this.initLogger();\n this.logger.log(level, message, category);\n }\n\n private createLogger() {\n return winston.createLogger({\n levels: LOG_LEVELS,\n transports: [\n new winston.transports.Console({\n level: this.customerConfig.logs.console.minimumLevel,\n silent: this.customerConfig.logs.console.silent,\n }),\n new MatomoTransport(this.customerConfig),\n new GraylogTransport(this.customerConfig),\n ],\n });\n }\n}","import Transport from \"winston-transport\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { ALL } from \"@c-rex/constants\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\n\nexport class MatomoTransport extends Transport {\n public matomoTransport: any;\n private configs: ConfigInterface;\n\n constructor(configs: ConfigInterface) {\n super({\n level: configs.logs.console.minimumLevel,\n silent: configs.logs.console.silent,\n });\n\n this.matomoTransport = new Transport();\n this.configs = configs;\n }\n\n log(\n info: { level: LogLevelType, message: string, category: LogCategoriesType },\n callback: () => void,\n ): void {\n const matomoCategory = this.configs.logs.matomo.categoriesLevel\n\n if (matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {\n\n this.matomoTransport.log(info, callback);\n }\n }\n}\n","export const ALL = \"*\"\n\nexport const LOG_CATEGORIES = [\n \"NoLicense\",\n \"Scenario\",\n \"Favorites\",\n \"Subscription\",\n \"Share\",\n \"Document\",\n \"Search\",\n \"History\",\n \"Notification\",\n \"UserProfile\",\n] as const;\n\nexport const LOG_LEVELS = {\n critical: 2,\n error: 3,\n warning: 4,\n info: 6,\n debug: 7,\n} as const;\n\nexport const RESULT_VIEW_STYLES = [\n \"cards\",\n \"table\",\n] as const;\n\nexport const API = {\n MAX_RETRY: 3,\n API_TIMEOUT: 10000,\n API_HEADERS: {\n \"content-Type\": \"application/json\",\n },\n};\n\nexport const SDK_CONFIG_KEY = \"crex-sdk-config\";\n\nexport const CONTENT_LANG_KEY = \"CONTENT_LANG_KEY\";\n\nexport const AVAILABLE_CONTENT_LANG_KEY = \"AVAILABLE_CONTENT_LANG_KEY\";\n\nexport const UI_LANG_KEY = \"UI_LANG_KEY\";\n\nexport const FLAGS_BY_LANG = {\n \"en\": \"US\",\n \"de\": \"DE\",\n};\n\nexport const DEFAULT_UI_LANG = \"en\";\n\nexport const UI_LANG_OPTIONS = [\"en\", \"de\"];\n\nexport const RESULT_TYPES = {\n TOPIC: \"TOPIC\",\n DOCUMENT: \"DOCUMENT\",\n PACKAGE: \"PACKAGE\",\n} as const;","import Transport from \"winston-transport\";\nimport Graylog2Transport from \"winston-graylog2\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { ALL } from \"@c-rex/constants\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\n\nexport class GraylogTransport extends Transport {\n public graylogTransport: any;\n public configs: ConfigInterface\n\n constructor(configs: ConfigInterface) {\n super({\n level: configs.logs.graylog.minimumLevel,\n silent: configs.logs.graylog.silent,\n });\n\n this.configs = configs;\n this.graylogTransport = new Graylog2Transport({\n name: \"Periotto-TEST\",\n silent: false,\n handleExceptions: false,\n graylog: {\n servers: [{ host: \"localhost\", port: 12201 }],\n },\n });\n }\n\n log(\n info: { level: LogLevelType, message: string, category: LogCategoriesType },\n callback: () => void,\n ): void {\n const graylogCategory = this.configs.logs.graylog.categoriesLevel\n\n if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {\n this.graylogTransport.log(info, callback);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;;;ACApB,+BAAsB;;;ACAf,IAAM,MAAM;AAeZ,IAAM,aAAa;AAAA,EACtB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AACX;AAeO,IAAM,iBAAiB;;;AD/BvB,IAAM,kBAAN,cAA8B,yBAAAA,QAAU;AAAA,EACpC;AAAA,EACC;AAAA,EAER,YAAY,SAA0B;AAClC,UAAM;AAAA,MACF,OAAO,QAAQ,KAAK,QAAQ;AAAA,MAC5B,QAAQ,QAAQ,KAAK,QAAQ;AAAA,IACjC,CAAC;AAED,SAAK,kBAAkB,IAAI,yBAAAA,QAAU;AACrC,SAAK,UAAU;AAAA,EACnB;AAAA,EAEA,IACI,MACA,UACI;AACJ,UAAM,iBAAiB,KAAK,QAAQ,KAAK,OAAO;AAEhD,QAAI,eAAe,SAAS,KAAK,QAAQ,KAAK,eAAe,SAAS,GAAG,GAAG;AAExE,WAAK,gBAAgB,IAAI,MAAM,QAAQ;AAAA,IAC3C;AAAA,EACJ;AACJ;;;AE9BA,IAAAC,4BAAsB;AACtB,8BAA8B;AAKvB,IAAM,mBAAN,cAA+B,0BAAAC,QAAU;AAAA,EACrC;AAAA,EACA;AAAA,EAEP,YAAY,SAA0B;AAClC,UAAM;AAAA,MACF,OAAO,QAAQ,KAAK,QAAQ;AAAA,MAC5B,QAAQ,QAAQ,KAAK,QAAQ;AAAA,IACjC,CAAC;AAED,SAAK,UAAU;AACf,SAAK,mBAAmB,IAAI,wBAAAC,QAAkB;AAAA,MAC1C,MAAM;AAAA,MACN,QAAQ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_transport","Transport","Graylog2Transport","winston"]}
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts","../src/transports/matomo.ts","../../constants/src/index.ts","../src/transports/graylog.ts"],"sourcesContent":["import winston from \"winston\";\nimport { MatomoTransport } from \"./transports/matomo\";\nimport { GraylogTransport } from \"./transports/graylog\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { LOG_LEVELS } from \"@c-rex/constants\";\nimport { getConfigs } from \"@c-rex/utils/next-cookies\";\n\n/**\n * Logger class for the CREX application.\n * Provides logging functionality with multiple transports (Console, Matomo, Graylog).\n */\nexport class CrexLogger {\n private customerConfig!: ConfigInterface;\n public logger!: winston.Logger;\n\n /**\n * Initializes the logger instance if it hasn't been initialized yet.\n * Loads customer configuration and creates the logger with appropriate transports.\n * \n * @private\n */\n private async initLogger() {\n try {\n if (!this.customerConfig) {\n this.customerConfig = await getConfigs();\n }\n\n if (!this.logger) {\n this.logger = this.createLogger();\n }\n } catch (error) {\n console.error(\"Error initializing logger:\", error);\n }\n }\n\n /**\n * Logs a message with the specified level and optional category.\n * \n * @param options - Logging options\n * @param options.level - The log level (error, warn, info, etc.)\n * @param options.message - The message to log\n * @param options.category - Optional category for the log message\n */\n public async log({ level, message, category }: {\n level: LogLevelType,\n message: string,\n category?: LogCategoriesType\n }) {\n await this.initLogger();\n this.logger.log(level, message, category);\n }\n\n /**\n * Creates a new Winston logger instance with configured transports.\n * \n * @private\n * @returns A configured Winston logger instance\n */\n private createLogger() {\n return winston.createLogger({\n levels: LOG_LEVELS,\n transports: [\n new winston.transports.Console({\n level: this.customerConfig.logs.console.minimumLevel,\n silent: this.customerConfig.logs.console.silent,\n }),\n new MatomoTransport(this.customerConfig),\n new GraylogTransport(this.customerConfig),\n ],\n });\n }\n}","import Transport from \"winston-transport\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { ALL } from \"@c-rex/constants\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\n\n/**\n * Winston transport for sending logs to Matomo analytics.\n * Extends the base Winston transport with Matomo-specific functionality.\n */\nexport class MatomoTransport extends Transport {\n public matomoTransport: any;\n private configs: ConfigInterface;\n\n /**\n * Creates a new instance of MatomoTransport.\n * \n * @param configs - The application configuration containing logging settings\n */\n constructor(configs: ConfigInterface) {\n super({\n level: configs.logs.console.minimumLevel,\n silent: configs.logs.console.silent,\n });\n\n this.matomoTransport = new Transport();\n this.configs = configs;\n }\n\n /**\n * Logs a message to Matomo if the message category is included in the configured categories.\n * \n * @param info - The log information including level, message, and category\n * @param callback - Callback function to execute after logging\n */\n log(\n info: { level: LogLevelType, message: string, category: LogCategoriesType },\n callback: () => void,\n ): void {\n const matomoCategory = this.configs.logs.matomo.categoriesLevel\n\n if (matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {\n this.matomoTransport.log(info, callback);\n }\n }\n}\n","export const ALL = \"*\"\n\nexport const LOG_CATEGORIES = [\n \"NoLicense\",\n \"Scenario\",\n \"Favorites\",\n \"Subscription\",\n \"Share\",\n \"Document\",\n \"Search\",\n \"History\",\n \"Notification\",\n \"UserProfile\",\n] as const;\n\nexport const LOG_LEVELS = {\n critical: 2,\n error: 3,\n warning: 4,\n info: 6,\n debug: 7,\n} as const;\n\nexport const RESULT_VIEW_STYLES = [\n \"cards\",\n \"table\",\n] as const;\n\nexport const API = {\n MAX_RETRY: 3,\n API_TIMEOUT: 10000,\n API_HEADERS: {\n \"content-Type\": \"application/json\",\n },\n};\n\nexport const SDK_CONFIG_KEY = \"crex-sdk-config\";\n\nexport const CONTENT_LANG_KEY = \"CONTENT_LANG_KEY\";\n\nexport const AVAILABLE_CONTENT_LANG_KEY = \"AVAILABLE_CONTENT_LANG_KEY\";\n\nexport const UI_LANG_KEY = \"UI_LANG_KEY\";\n\nexport const FLAGS_BY_LANG = {\n \"en\": \"US\",\n \"de\": \"DE\",\n};\n\nexport const DEFAULT_LANG = \"en-US\";\n\nexport const EN_LANG = \"en\";\n\nexport const UI_LANG_OPTIONS = [\"en-us\", \"de-de\"];\n\nexport const TOPICS_TYPE_AND_LINK = \"topics\";\nexport const DOCUMENTS_TYPE_AND_LINK = \"documents\";\n\nexport const TOPIC = \"TOPIC\";\nexport const DOCUMENT = \"DOCUMENT\";\nexport const PACKAGE = \"PACKAGE\";\n\nexport const RESULT_TYPES = {\n TOPIC: TOPIC,\n DOCUMENT: DOCUMENT,\n PACKAGE: PACKAGE,\n} as const;\n\nexport const FILES_EXTENSIONS = {\n PDF: \"application/pdf\",\n HTML: \"text/html\",\n} as const;\n\nexport const DEFAULT_COOKIE_LIMIT = 7 * 24 * 60 * 60 * 1000; // 7 days in milliseconds\n\nexport const ICONS_BY_FILE_EXTENSION = {\n \"application/pdf\": \"FaFilePdf\",\n} as const;\n\nexport const DEFAULT_ICON = \"file\";\n\nexport const CREX_TOKEN_HEADER_KEY = \"crex-token\";","import Transport from \"winston-transport\";\nimport Graylog2Transport from \"winston-graylog2\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { ALL } from \"@c-rex/constants\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\n\n/**\n * Winston transport for sending logs to Graylog.\n * Extends the base Winston transport with Graylog-specific functionality.\n */\nexport class GraylogTransport extends Transport {\n public graylogTransport: any;\n public configs: ConfigInterface\n\n /**\n * Creates a new instance of GraylogTransport.\n * \n * @param configs - The application configuration containing logging settings\n */\n constructor(configs: ConfigInterface) {\n super({\n level: configs.logs.graylog.minimumLevel,\n silent: configs.logs.graylog.silent,\n });\n\n this.configs = configs;\n this.graylogTransport = new Graylog2Transport({\n name: \"Periotto-TEST\",\n silent: false,\n handleExceptions: false,\n graylog: {\n servers: [{ host: \"localhost\", port: 12201 }],\n },\n });\n }\n\n /**\n * Logs a message to Graylog if the message category is included in the configured categories.\n * \n * @param info - The log information including level, message, and category\n * @param callback - Callback function to execute after logging\n */\n log(\n info: { level: LogLevelType, message: string, category: LogCategoriesType },\n callback: () => void,\n ): void {\n const graylogCategory = this.configs.logs.graylog.categoriesLevel\n\n if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {\n this.graylogTransport.log(info, callback);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;;;ACApB,+BAAsB;;;ACAf,IAAM,MAAM;AAeZ,IAAM,aAAa;AAAA,EACtB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AACX;AAoDO,IAAM,uBAAuB,IAAI,KAAK,KAAK,KAAK;;;ADhEhD,IAAM,kBAAN,cAA8B,yBAAAA,QAAU;AAAA,EACpC;AAAA,EACC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,YAAY,SAA0B;AAClC,UAAM;AAAA,MACF,OAAO,QAAQ,KAAK,QAAQ;AAAA,MAC5B,QAAQ,QAAQ,KAAK,QAAQ;AAAA,IACjC,CAAC;AAED,SAAK,kBAAkB,IAAI,yBAAAA,QAAU;AACrC,SAAK,UAAU;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IACI,MACA,UACI;AACJ,UAAM,iBAAiB,KAAK,QAAQ,KAAK,OAAO;AAEhD,QAAI,eAAe,SAAS,KAAK,QAAQ,KAAK,eAAe,SAAS,GAAG,GAAG;AACxE,WAAK,gBAAgB,IAAI,MAAM,QAAQ;AAAA,IAC3C;AAAA,EACJ;AACJ;;;AE5CA,IAAAC,4BAAsB;AACtB,8BAA8B;AASvB,IAAM,mBAAN,cAA+B,0BAAAC,QAAU;AAAA,EACrC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOP,YAAY,SAA0B;AAClC,UAAM;AAAA,MACF,OAAO,QAAQ,KAAK,QAAQ;AAAA,MAC5B,QAAQ,QAAQ,KAAK,QAAQ;AAAA,IACjC,CAAC;AAED,SAAK,U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K,QAAQ;AAAA,UACxC,QAAQ,KAAK,eAAe,KAAK,QAAQ;AAAA,QAC7C,CAAC;AAAA,QACD,IAAI,gBAAgB,KAAK,cAAc;AAAA,QACvC,IAAI,iBAAiB,KAAK,cAAc;AAAA,MAC5C;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":["Transport","import_winston_transport","Transport","Graylog2Transport","winston"]}
|
package/dist/logger.mjs
CHANGED
|
@@ -13,12 +13,17 @@ var LOG_LEVELS = {
|
|
|
13
13
|
info: 6,
|
|
14
14
|
debug: 7
|
|
15
15
|
};
|
|
16
|
-
var
|
|
16
|
+
var DEFAULT_COOKIE_LIMIT = 7 * 24 * 60 * 60 * 1e3;
|
|
17
17
|
|
|
18
18
|
// src/transports/matomo.ts
|
|
19
19
|
var MatomoTransport = class extends Transport {
|
|
20
20
|
matomoTransport;
|
|
21
21
|
configs;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new instance of MatomoTransport.
|
|
24
|
+
*
|
|
25
|
+
* @param configs - The application configuration containing logging settings
|
|
26
|
+
*/
|
|
22
27
|
constructor(configs) {
|
|
23
28
|
super({
|
|
24
29
|
level: configs.logs.console.minimumLevel,
|
|
@@ -27,6 +32,12 @@ var MatomoTransport = class extends Transport {
|
|
|
27
32
|
this.matomoTransport = new Transport();
|
|
28
33
|
this.configs = configs;
|
|
29
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Logs a message to Matomo if the message category is included in the configured categories.
|
|
37
|
+
*
|
|
38
|
+
* @param info - The log information including level, message, and category
|
|
39
|
+
* @param callback - Callback function to execute after logging
|
|
40
|
+
*/
|
|
30
41
|
log(info, callback) {
|
|
31
42
|
const matomoCategory = this.configs.logs.matomo.categoriesLevel;
|
|
32
43
|
if (matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {
|
|
@@ -41,6 +52,11 @@ import Graylog2Transport from "winston-graylog2";
|
|
|
41
52
|
var GraylogTransport = class extends Transport2 {
|
|
42
53
|
graylogTransport;
|
|
43
54
|
configs;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new instance of GraylogTransport.
|
|
57
|
+
*
|
|
58
|
+
* @param configs - The application configuration containing logging settings
|
|
59
|
+
*/
|
|
44
60
|
constructor(configs) {
|
|
45
61
|
super({
|
|
46
62
|
level: configs.logs.graylog.minimumLevel,
|
|
@@ -56,6 +72,12 @@ var GraylogTransport = class extends Transport2 {
|
|
|
56
72
|
}
|
|
57
73
|
});
|
|
58
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Logs a message to Graylog if the message category is included in the configured categories.
|
|
77
|
+
*
|
|
78
|
+
* @param info - The log information including level, message, and category
|
|
79
|
+
* @param callback - Callback function to execute after logging
|
|
80
|
+
*/
|
|
59
81
|
log(info, callback) {
|
|
60
82
|
const graylogCategory = this.configs.logs.graylog.categoriesLevel;
|
|
61
83
|
if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
|
|
@@ -65,26 +87,46 @@ var GraylogTransport = class extends Transport2 {
|
|
|
65
87
|
};
|
|
66
88
|
|
|
67
89
|
// src/logger.ts
|
|
68
|
-
import {
|
|
90
|
+
import { getConfigs } from "@c-rex/utils/next-cookies";
|
|
69
91
|
var CrexLogger = class {
|
|
70
92
|
customerConfig;
|
|
71
93
|
logger;
|
|
94
|
+
/**
|
|
95
|
+
* Initializes the logger instance if it hasn't been initialized yet.
|
|
96
|
+
* Loads customer configuration and creates the logger with appropriate transports.
|
|
97
|
+
*
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
72
100
|
async initLogger() {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
throw new Error("SDK not initialized");
|
|
101
|
+
try {
|
|
102
|
+
if (!this.customerConfig) {
|
|
103
|
+
this.customerConfig = await getConfigs();
|
|
77
104
|
}
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
105
|
+
if (!this.logger) {
|
|
106
|
+
this.logger = this.createLogger();
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.error("Error initializing logger:", error);
|
|
82
110
|
}
|
|
83
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Logs a message with the specified level and optional category.
|
|
114
|
+
*
|
|
115
|
+
* @param options - Logging options
|
|
116
|
+
* @param options.level - The log level (error, warn, info, etc.)
|
|
117
|
+
* @param options.message - The message to log
|
|
118
|
+
* @param options.category - Optional category for the log message
|
|
119
|
+
*/
|
|
84
120
|
async log({ level, message, category }) {
|
|
85
121
|
await this.initLogger();
|
|
86
122
|
this.logger.log(level, message, category);
|
|
87
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new Winston logger instance with configured transports.
|
|
126
|
+
*
|
|
127
|
+
* @private
|
|
128
|
+
* @returns A configured Winston logger instance
|
|
129
|
+
*/
|
|
88
130
|
createLogger() {
|
|
89
131
|
return winston.createLogger({
|
|
90
132
|
levels: LOG_LEVELS,
|
package/dist/logger.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/logger.ts","../src/transports/matomo.ts","../../constants/src/index.ts","../src/transports/graylog.ts"],"sourcesContent":["import winston from \"winston\";\nimport { MatomoTransport } from \"./transports/matomo\";\nimport { GraylogTransport } from \"./transports/graylog\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { LOG_LEVELS
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts","../src/transports/matomo.ts","../../constants/src/index.ts","../src/transports/graylog.ts"],"sourcesContent":["import winston from \"winston\";\nimport { MatomoTransport } from \"./transports/matomo\";\nimport { GraylogTransport } from \"./transports/graylog\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { LOG_LEVELS } from \"@c-rex/constants\";\nimport { getConfigs } from \"@c-rex/utils/next-cookies\";\n\n/**\n * Logger class for the CREX application.\n * Provides logging functionality with multiple transports (Console, Matomo, Graylog).\n */\nexport class CrexLogger {\n private customerConfig!: ConfigInterface;\n public logger!: winston.Logger;\n\n /**\n * Initializes the logger instance if it hasn't been initialized yet.\n * Loads customer configuration and creates the logger with appropriate transports.\n * \n * @private\n */\n private async initLogger() {\n try {\n if (!this.customerConfig) {\n this.customerConfig = await getConfigs();\n }\n\n if (!this.logger) {\n this.logger = this.createLogger();\n }\n } catch (error) {\n console.error(\"Error initializing logger:\", error);\n }\n }\n\n /**\n * Logs a message with the specified level and optional category.\n * \n * @param options - Logging options\n * @param options.level - The log level (error, warn, info, etc.)\n * @param options.message - The message to log\n * @param options.category - Optional category for the log message\n */\n public async log({ level, message, category }: {\n level: LogLevelType,\n message: string,\n category?: LogCategoriesType\n }) {\n await this.initLogger();\n this.logger.log(level, message, category);\n }\n\n /**\n * Creates a new Winston logger instance with configured transports.\n * \n * @private\n * @returns A configured Winston logger instance\n */\n private createLogger() {\n return winston.createLogger({\n levels: LOG_LEVELS,\n transports: [\n new winston.transports.Console({\n level: this.customerConfig.logs.console.minimumLevel,\n silent: this.customerConfig.logs.console.silent,\n }),\n new MatomoTransport(this.customerConfig),\n new GraylogTransport(this.customerConfig),\n ],\n });\n }\n}","import Transport from \"winston-transport\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { ALL } from \"@c-rex/constants\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\n\n/**\n * Winston transport for sending logs to Matomo analytics.\n * Extends the base Winston transport with Matomo-specific functionality.\n */\nexport class MatomoTransport extends Transport {\n public matomoTransport: any;\n private configs: ConfigInterface;\n\n /**\n * Creates a new instance of MatomoTransport.\n * \n * @param configs - The application configuration containing logging settings\n */\n constructor(configs: ConfigInterface) {\n super({\n level: configs.logs.console.minimumLevel,\n silent: configs.logs.console.silent,\n });\n\n this.matomoTransport = new Transport();\n this.configs = configs;\n }\n\n /**\n * Logs a message to Matomo if the message category is included in the configured categories.\n * \n * @param info - The log information including level, message, and category\n * @param callback - Callback function to execute after logging\n */\n log(\n info: { level: LogLevelType, message: string, category: LogCategoriesType },\n callback: () => void,\n ): void {\n const matomoCategory = this.configs.logs.matomo.categoriesLevel\n\n if (matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {\n this.matomoTransport.log(info, callback);\n }\n }\n}\n","export const ALL = \"*\"\n\nexport const LOG_CATEGORIES = [\n \"NoLicense\",\n \"Scenario\",\n \"Favorites\",\n \"Subscription\",\n \"Share\",\n \"Document\",\n \"Search\",\n \"History\",\n \"Notification\",\n \"UserProfile\",\n] as const;\n\nexport const LOG_LEVELS = {\n critical: 2,\n error: 3,\n warning: 4,\n info: 6,\n debug: 7,\n} as const;\n\nexport const RESULT_VIEW_STYLES = [\n \"cards\",\n \"table\",\n] as const;\n\nexport const API = {\n MAX_RETRY: 3,\n API_TIMEOUT: 10000,\n API_HEADERS: {\n \"content-Type\": \"application/json\",\n },\n};\n\nexport const SDK_CONFIG_KEY = \"crex-sdk-config\";\n\nexport const CONTENT_LANG_KEY = \"CONTENT_LANG_KEY\";\n\nexport const AVAILABLE_CONTENT_LANG_KEY = \"AVAILABLE_CONTENT_LANG_KEY\";\n\nexport const UI_LANG_KEY = \"UI_LANG_KEY\";\n\nexport const FLAGS_BY_LANG = {\n \"en\": \"US\",\n \"de\": \"DE\",\n};\n\nexport const DEFAULT_LANG = \"en-US\";\n\nexport const EN_LANG = \"en\";\n\nexport const UI_LANG_OPTIONS = [\"en-us\", \"de-de\"];\n\nexport const TOPICS_TYPE_AND_LINK = \"topics\";\nexport const DOCUMENTS_TYPE_AND_LINK = \"documents\";\n\nexport const TOPIC = \"TOPIC\";\nexport const DOCUMENT = \"DOCUMENT\";\nexport const PACKAGE = \"PACKAGE\";\n\nexport const RESULT_TYPES = {\n TOPIC: TOPIC,\n DOCUMENT: DOCUMENT,\n PACKAGE: PACKAGE,\n} as const;\n\nexport const FILES_EXTENSIONS = {\n PDF: \"application/pdf\",\n HTML: \"text/html\",\n} as const;\n\nexport const DEFAULT_COOKIE_LIMIT = 7 * 24 * 60 * 60 * 1000; // 7 days in milliseconds\n\nexport const ICONS_BY_FILE_EXTENSION = {\n \"application/pdf\": \"FaFilePdf\",\n} as const;\n\nexport const DEFAULT_ICON = \"file\";\n\nexport const CREX_TOKEN_HEADER_KEY = \"crex-token\";","import Transport from \"winston-transport\";\nimport Graylog2Transport from \"winston-graylog2\";\nimport { LogCategoriesType, LogLevelType } from \"@c-rex/types\";\nimport { ALL } from \"@c-rex/constants\";\nimport { ConfigInterface } from \"@c-rex/interfaces\";\n\n/**\n * Winston transport for sending logs to Graylog.\n * Extends the base Winston transport with Graylog-specific functionality.\n */\nexport class GraylogTransport extends Transport {\n public graylogTransport: any;\n public configs: ConfigInterface\n\n /**\n * Creates a new instance of GraylogTransport.\n * \n * @param configs - The application configuration containing logging settings\n */\n constructor(configs: ConfigInterface) {\n super({\n level: configs.logs.graylog.minimumLevel,\n silent: configs.logs.graylog.silent,\n });\n\n this.configs = configs;\n this.graylogTransport = new Graylog2Transport({\n name: \"Periotto-TEST\",\n silent: false,\n handleExceptions: false,\n graylog: {\n servers: [{ host: \"localhost\", port: 12201 }],\n },\n });\n }\n\n /**\n * Logs a message to Graylog if the message category is included in the configured categories.\n * \n * @param info - The log information including level, message, and category\n * @param callback - Callback function to execute after logging\n */\n log(\n info: { level: LogLevelType, message: string, category: LogCategoriesType },\n callback: () => void,\n ): void {\n const graylogCategory = this.configs.logs.graylog.categoriesLevel\n\n if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {\n this.graylogTransport.log(info, callback);\n }\n }\n}\n"],"mappings":";AAAA,OAAO,aAAa;;;ACApB,OAAO,eAAe;;;ACAf,IAAM,MAAM;AAeZ,IAAM,aAAa;AAAA,EACtB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AACX;AAoDO,IAAM,uBAAuB,IAAI,KAAK,KAAK,KAAK;;;ADhEhD,IAAM,kBAAN,cAA8B,UAAU;AAAA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;;;AH9CA,SAAS,kBAAkB;AAMpB,IAAM,aAAN,MAAiB;AAAA,EACZ;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQP,MAAc,aAAa;AACvB,QAAI;AACA,UAAI,CAAC,KAAK,gBAAgB;AACtB,aAAK,iBAAiB,MAAM,WAAW;AAAA,MAC3C;AAEA,UAAI,CAAC,KAAK,QAAQ;AACd,aAAK,SAAS,KAAK,aAAa;AAAA,MACpC;AAAA,IACJ,SAAS,OAAO;AACZ,cAAQ,MAAM,8BAA8B,KAAK;AAAA,IACrD;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,IAAI,EAAE,OAAO,SAAS,SAAS,GAIzC;AACC,UAAM,KAAK,WAAW;AACtB,SAAK,OAAO,IAAI,OAAO,SAAS,QAAQ;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,eAAe;AACnB,WAAO,QAAQ,aAAa;AAAA,MACxB,QAAQ;AAAA,MACR,YAAY;AAAA,QACR,IAAI,QAAQ,WAAW,QAAQ;AAAA,UAC3B,OAAO,KAAK,eAAe,KAAK,QAAQ;AAAA,UACxC,QAAQ,KAAK,eAAe,KAAK,QAAQ;AAAA,QAC7C,CAAC;AAAA,QACD,IAAI,gBAAgB,KAAK,cAAc;AAAA,QACvC,IAAI,iBAAiB,KAAK,cAAc;AAAA,MAC5C;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":["Transport","Transport"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-rex/core",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "0.1.3",
|
|
7
4
|
"files": [
|
|
8
5
|
"dist"
|
|
9
6
|
],
|
|
@@ -17,12 +14,29 @@
|
|
|
17
14
|
"require": "./dist/index.js",
|
|
18
15
|
"default": "./dist/index.js"
|
|
19
16
|
},
|
|
20
|
-
"./package.json": "./package.json",
|
|
21
17
|
"./logger": {
|
|
22
18
|
"types": "./dist/logger.d.ts",
|
|
23
19
|
"import": "./dist/logger.mjs",
|
|
24
20
|
"require": "./dist/logger.js",
|
|
25
21
|
"default": "./dist/logger.js"
|
|
22
|
+
},
|
|
23
|
+
"./cookies": {
|
|
24
|
+
"types": "./dist/api/cookies.d.ts",
|
|
25
|
+
"import": "./dist/api/cookies.mjs",
|
|
26
|
+
"require": "./dist/api/cookies.js",
|
|
27
|
+
"default": "./dist/api/cookies.js"
|
|
28
|
+
},
|
|
29
|
+
"./token": {
|
|
30
|
+
"types": "./dist/api/token.d.ts",
|
|
31
|
+
"import": "./dist/api/token.mjs",
|
|
32
|
+
"require": "./dist/api/token.js",
|
|
33
|
+
"default": "./dist/api/token.js"
|
|
34
|
+
},
|
|
35
|
+
"./rpc": {
|
|
36
|
+
"types": "./dist/api/rpc.d.ts",
|
|
37
|
+
"import": "./dist/api/rpc.mjs",
|
|
38
|
+
"require": "./dist/api/rpc.js",
|
|
39
|
+
"default": "./dist/api/rpc.js"
|
|
26
40
|
}
|
|
27
41
|
},
|
|
28
42
|
"sideEffects": false,
|