@c-rex/core 0.1.13 → 0.1.14

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/rpc.js DELETED
@@ -1,232 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/api/rpc.ts
31
- var rpc_exports = {};
32
- __export(rpc_exports, {
33
- POST: () => POST
34
- });
35
- module.exports = __toCommonJS(rpc_exports);
36
-
37
- // src/logger.ts
38
- var import_winston = __toESM(require("winston"));
39
-
40
- // src/transports/matomo.ts
41
- var import_winston_transport = __toESM(require("winston-transport"));
42
-
43
- // ../constants/src/index.ts
44
- var ALL = "*";
45
- var LOG_LEVELS = {
46
- critical: 2,
47
- error: 3,
48
- warning: 4,
49
- info: 6,
50
- debug: 7
51
- };
52
- var DEFAULT_COOKIE_LIMIT = 30 * 24 * 60 * 60 * 1e3;
53
-
54
- // src/transports/matomo.ts
55
- var MatomoTransport = class extends import_winston_transport.default {
56
- matomoTransport;
57
- configs;
58
- /**
59
- * Creates a new instance of MatomoTransport.
60
- *
61
- * @param configs - The application configuration containing logging settings
62
- */
63
- constructor(configs) {
64
- super({
65
- level: configs.logs.matomo.minimumLevel,
66
- silent: configs.logs.matomo.silent
67
- });
68
- this.matomoTransport = new import_winston_transport.default();
69
- this.configs = configs;
70
- }
71
- /**
72
- * Logs a message to Matomo if the message category is included in the configured categories.
73
- *
74
- * @param info - The log information including level, message, and category
75
- * @param callback - Callback function to execute after logging
76
- */
77
- log(info, callback) {
78
- const matomoCategory = this.configs.logs.matomo.categoriesLevel;
79
- if (matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {
80
- this.matomoTransport.log(info, callback);
81
- }
82
- }
83
- };
84
-
85
- // src/transports/graylog.ts
86
- var import_winston_transport2 = __toESM(require("winston-transport"));
87
- var import_winston_graylog2 = __toESM(require("winston-graylog2"));
88
- var GraylogTransport = class extends import_winston_transport2.default {
89
- graylogTransport;
90
- configs;
91
- /**
92
- * Creates a new instance of GraylogTransport.
93
- *
94
- * @param configs - The application configuration containing logging settings
95
- */
96
- constructor(configs) {
97
- if (!configs.logs.graylog.hostname || configs.logs.graylog.port === void 0) {
98
- throw new Error("Graylog hostname and port must be defined");
99
- }
100
- super({
101
- level: configs.logs.graylog.minimumLevel,
102
- silent: configs.logs.graylog.silent
103
- });
104
- this.configs = configs;
105
- this.graylogTransport = new import_winston_graylog2.default({
106
- name: configs.logs.graylog.app,
107
- silent: configs.logs.graylog.silent,
108
- handleExceptions: false,
109
- graylog: {
110
- servers: [
111
- { host: configs.logs.graylog.hostname, port: configs.logs.graylog.port }
112
- ]
113
- }
114
- });
115
- }
116
- /**
117
- * Logs a message to Graylog if the message category is included in the configured categories.
118
- *
119
- * @param info - The log information including level, message, and category
120
- * @param callback - Callback function to execute after logging
121
- */
122
- log(info, callback) {
123
- const graylogCategory = this.configs.logs.graylog.categoriesLevel;
124
- if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
125
- this.graylogTransport.log(info, callback);
126
- }
127
- }
128
- };
129
-
130
- // src/config.ts
131
- var import_headers = require("next/headers");
132
- function getServerConfig() {
133
- if (!global.__GLOBAL_CONFIG__) {
134
- throw new Error("Server config not initialized");
135
- }
136
- return global.__GLOBAL_CONFIG__;
137
- }
138
-
139
- // src/logger.ts
140
- var CrexLogger = class {
141
- customerConfig;
142
- logger;
143
- /**
144
- * Initializes the logger instance if it hasn't been initialized yet.
145
- * Loads customer configuration and creates the logger with appropriate transports.
146
- *
147
- * @private
148
- */
149
- async initLogger() {
150
- try {
151
- if (!this.customerConfig) {
152
- this.customerConfig = getServerConfig();
153
- }
154
- if (!this.logger) {
155
- this.logger = this.createLogger();
156
- }
157
- } catch (error) {
158
- console.log("Error initializing logger:", error);
159
- }
160
- }
161
- /**
162
- * Logs a message with the specified level and optional category.
163
- *
164
- * @param options - Logging options
165
- * @param options.level - The log level (error, warn, info, etc.)
166
- * @param options.message - The message to log
167
- * @param options.category - Optional category for the log message
168
- */
169
- async log({ level, message, category }) {
170
- await this.initLogger();
171
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
172
- const newMessage = `[${timestamp}] ${message}`;
173
- this.logger.log(level, newMessage, category);
174
- }
175
- /**
176
- * Creates a new Winston logger instance with configured transports.
177
- *
178
- * @private
179
- * @returns A configured Winston logger instance
180
- */
181
- createLogger() {
182
- return import_winston.default.createLogger({
183
- levels: LOG_LEVELS,
184
- transports: [
185
- new import_winston.default.transports.Console({
186
- level: this.customerConfig.logs.console.minimumLevel,
187
- silent: this.customerConfig.logs.console.silent
188
- }),
189
- new MatomoTransport(this.customerConfig),
190
- new GraylogTransport(this.customerConfig)
191
- ]
192
- });
193
- }
194
- };
195
-
196
- // src/api/rpc.ts
197
- var import_services = require("@c-rex/services");
198
- var import_server = require("next/server");
199
- var serviceRegistry = {
200
- InformationUnitsService: import_services.InformationUnitsService,
201
- CrexLogger,
202
- LanguageService: import_services.LanguageService
203
- };
204
- var POST = async (req) => {
205
- try {
206
- const { method, params } = await req.json();
207
- const [serviceName, methodName] = method.split(".");
208
- const ServiceClass = serviceRegistry[serviceName];
209
- if (!ServiceClass) {
210
- return import_server.NextResponse.json({ error: `Service '${serviceName}' not found` }, { status: 404 });
211
- }
212
- const serviceInstance = new ServiceClass();
213
- const handler = serviceInstance[methodName];
214
- if (typeof handler !== "function") {
215
- return import_server.NextResponse.json({ error: `Method '${methodName}' not found on '${serviceName}'` }, { status: 404 });
216
- }
217
- const result = await handler.call(serviceInstance, params);
218
- return import_server.NextResponse.json({ data: result });
219
- } catch (error) {
220
- const logger = new CrexLogger();
221
- logger.log({
222
- level: "error",
223
- message: `RPC.POST error: ${error}`
224
- });
225
- return import_server.NextResponse.json({ error: String(error) }, { status: 500 });
226
- }
227
- };
228
- // Annotate the CommonJS export names for ESM import in node:
229
- 0 && (module.exports = {
230
- POST
231
- });
232
- //# sourceMappingURL=rpc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/api/rpc.ts","../../src/logger.ts","../../src/transports/matomo.ts","../../../constants/src/index.ts","../../src/transports/graylog.ts","../../src/config.ts"],"sourcesContent":["import { CrexLogger } from '../logger';\nimport { InformationUnitsService, LanguageService } from '@c-rex/services';\nimport { NextRequest, NextResponse } from 'next/server';\n\n/**\n * Registry of available services that can be called via RPC.\n */\nconst serviceRegistry = {\n InformationUnitsService,\n CrexLogger,\n LanguageService\n};\n\n/**\n * Interface for RPC payload.\n */\ntype RpcPayload = {\n method: string;\n params: any;\n};\n\n/**\n * Handles POST requests for RPC (Remote Procedure Call) functionality.\n * Allows calling methods on registered services with parameters.\n * \n * @param req - The Next.js request object containing the RPC payload\n * @returns A JSON response with the result of the method call, or an error if the service or method is not found\n */\nexport const POST = async (req: NextRequest) => {\n try {\n const { method, params }: RpcPayload = await req.json();\n const [serviceName, methodName] = method.split('.');\n const ServiceClass = serviceRegistry[serviceName as keyof typeof serviceRegistry];\n\n if (!ServiceClass) {\n return NextResponse.json({ error: `Service '${serviceName}' not found` }, { status: 404 });\n }\n\n const serviceInstance = new ServiceClass();\n const handler = (serviceInstance as any)[methodName as any];\n\n if (typeof handler !== 'function') {\n return NextResponse.json({ error: `Method '${methodName}' not found on '${serviceName}'` }, { status: 404 });\n }\n\n const result = await handler.call(serviceInstance, params);\n return NextResponse.json({ data: result });\n } catch (error) {\n const logger = new CrexLogger()\n logger.log({\n level: \"error\",\n message: `RPC.POST error: ${error}`\n })\n return NextResponse.json({ error: String(error) }, { status: 500 });\n }\n}\n","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 { getServerConfig } from \"./config\";\n\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 = getServerConfig();\n }\n if (!this.logger) {\n this.logger = this.createLogger();\n }\n } catch (error) {\n console.log(\"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 const timestamp = new Date().toISOString();\n const newMessage = `[${timestamp}] ${message}`;\n this.logger.log(level, newMessage, 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.matomo.minimumLevel,\n silent: configs.logs.matomo.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 \"table-with-images\",\n] as const;\n\nexport const API = {\n MAX_RETRY: 3,\n API_TIMEOUT: 10000,\n RETRY_DELAY: 500,\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 BLOG_TYPE_AND_LINK = \"blog\";\nexport const DOCUMENTS_TYPE_AND_LINK = \"documents\";\n\nexport const TOPIC = \"TOPIC\";\nexport const DOCUMENT = \"DOCUMENT\";\nexport const PACKAGE = \"PACKAGE\";\nexport const FRAGMENT = \"FRAGMENT\";\n\nexport const RESULT_TYPES = {\n TOPIC: TOPIC,\n DOCUMENT: DOCUMENT,\n PACKAGE: PACKAGE,\n FRAGMENT: FRAGMENT\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 = 30 * 24 * 60 * 60 * 1000; // 30 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\";\n\nexport const WILD_CARD_OPTIONS = {\n BOTH: \"BOTH\",\n END: \"END\",\n START: \"START\",\n NONE: \"NONE\",\n} as const;\n\nexport const OPERATOR_OPTIONS = {\n AND: \"AND\",\n OR: \"OR\",\n} as const;\n\nexport const ARTICLE_PAGE_LAYOUT = {\n BLOG: \"BLOG\",\n DOCUMENT: \"DOCUMENT\",\n} as const;\n\nexport const DEVICE_OPTIONS = {\n MOBILE: \"mobile\",\n TABLET: \"tablet\",\n DESKTOP: \"desktop\",\n}\nexport const BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n \"2xl\": 1536,\n};\n\nexport const MARKER_COLORS = [\n \"red-500\",\n \"orange-500\",\n \"yellow-400\",\n \"green-500\",\n \"teal-500\",\n \"blue-500\",\n \"sky-500\",\n \"purple-500\",\n \"pink-500\",\n \"gray-500\",\n \"neutral-800\",\n \"cyan-500\",\n \"lime-500\",\n \"amber-500\",\n \"indigo-500\",\n];","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 private 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 if (!configs.logs.graylog.hostname || configs.logs.graylog.port === undefined) {\n throw new Error(\"Graylog hostname and port must be defined\");\n }\n\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: configs.logs.graylog.app,\n silent: configs.logs.graylog.silent,\n handleExceptions: false,\n graylog: {\n servers: [\n { host: configs.logs.graylog.hostname, port: configs.logs.graylog.port }\n ],\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","import { ConfigInterface, CookiesConfigs } from \"@c-rex/interfaces\";\nimport { SDK_CONFIG_KEY } from '@c-rex/constants';\nimport { cookies } from 'next/headers';\n\n/**\n * Retrieves and parses configuration data from a cookie.\n * @returns The parsed configuration object\n * @throws Error if the configuration cookie is not found or cannot be parsed\n */\nexport const getClientConfig = (): CookiesConfigs => {\n const jsonConfigs = cookies().get(SDK_CONFIG_KEY)?.value;\n if (!jsonConfigs) {\n throw new Error('Configs not found');\n }\n\n const configs: CookiesConfigs = JSON.parse(jsonConfigs);\n\n return configs;\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __GLOBAL_CONFIG__: ConfigInterface | null;\n}\n\nexport function initializeConfig(config: ConfigInterface) {\n if (global.__GLOBAL_CONFIG__) return global.__GLOBAL_CONFIG__;\n global.__GLOBAL_CONFIG__ = config;\n return global.__GLOBAL_CONFIG__;\n}\n\nexport function getServerConfig() {\n if (!global.__GLOBAL_CONFIG__) {\n throw new Error('Server config not initialized');\n }\n return global.__GLOBAL_CONFIG__;\n}\n\nexport function updateConfigProp(key: keyof ConfigInterface, value: any) {\n if (!global.__GLOBAL_CONFIG__) {\n throw new Error('Server config not initialized');\n }\n global.__GLOBAL_CONFIG__[key] = value;\n return global.__GLOBAL_CONFIG__;\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,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;AAyDO,IAAM,uBAAuB,KAAK,KAAK,KAAK,KAAK;;;ADrEjD,IAAM,kBAAN,cAA8B,yBAAAA,QAAU;AAAA,EACpC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- import winston from "winston";
3
-
4
- // src/transports/matomo.ts
5
- import Transport from "winston-transport";
6
-
7
- // ../constants/src/index.ts
8
- var ALL = "*";
9
- var LOG_LEVELS = {
10
- critical: 2,
11
- error: 3,
12
- warning: 4,
13
- info: 6,
14
- debug: 7
15
- };
16
- var DEFAULT_COOKIE_LIMIT = 30 * 24 * 60 * 60 * 1e3;
17
-
18
- // src/transports/matomo.ts
19
- var MatomoTransport = class extends Transport {
20
- matomoTransport;
21
- configs;
22
- /**
23
- * Creates a new instance of MatomoTransport.
24
- *
25
- * @param configs - The application configuration containing logging settings
26
- */
27
- constructor(configs) {
28
- super({
29
- level: configs.logs.matomo.minimumLevel,
30
- silent: configs.logs.matomo.silent
31
- });
32
- this.matomoTransport = new Transport();
33
- this.configs = configs;
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
- */
41
- log(info, callback) {
42
- const matomoCategory = this.configs.logs.matomo.categoriesLevel;
43
- if (matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {
44
- this.matomoTransport.log(info, callback);
45
- }
46
- }
47
- };
48
-
49
- // src/transports/graylog.ts
50
- import Transport2 from "winston-transport";
51
- import Graylog2Transport from "winston-graylog2";
52
- var GraylogTransport = class extends Transport2 {
53
- graylogTransport;
54
- configs;
55
- /**
56
- * Creates a new instance of GraylogTransport.
57
- *
58
- * @param configs - The application configuration containing logging settings
59
- */
60
- constructor(configs) {
61
- if (!configs.logs.graylog.hostname || configs.logs.graylog.port === void 0) {
62
- throw new Error("Graylog hostname and port must be defined");
63
- }
64
- super({
65
- level: configs.logs.graylog.minimumLevel,
66
- silent: configs.logs.graylog.silent
67
- });
68
- this.configs = configs;
69
- this.graylogTransport = new Graylog2Transport({
70
- name: configs.logs.graylog.app,
71
- silent: configs.logs.graylog.silent,
72
- handleExceptions: false,
73
- graylog: {
74
- servers: [
75
- { host: configs.logs.graylog.hostname, port: configs.logs.graylog.port }
76
- ]
77
- }
78
- });
79
- }
80
- /**
81
- * Logs a message to Graylog if the message category is included in the configured categories.
82
- *
83
- * @param info - The log information including level, message, and category
84
- * @param callback - Callback function to execute after logging
85
- */
86
- log(info, callback) {
87
- const graylogCategory = this.configs.logs.graylog.categoriesLevel;
88
- if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
89
- this.graylogTransport.log(info, callback);
90
- }
91
- }
92
- };
93
-
94
- // src/config.ts
95
- import { cookies } from "next/headers";
96
- function getServerConfig() {
97
- if (!global.__GLOBAL_CONFIG__) {
98
- throw new Error("Server config not initialized");
99
- }
100
- return global.__GLOBAL_CONFIG__;
101
- }
102
-
103
- // src/logger.ts
104
- var CrexLogger = class {
105
- customerConfig;
106
- logger;
107
- /**
108
- * Initializes the logger instance if it hasn't been initialized yet.
109
- * Loads customer configuration and creates the logger with appropriate transports.
110
- *
111
- * @private
112
- */
113
- async initLogger() {
114
- try {
115
- if (!this.customerConfig) {
116
- this.customerConfig = getServerConfig();
117
- }
118
- if (!this.logger) {
119
- this.logger = this.createLogger();
120
- }
121
- } catch (error) {
122
- console.log("Error initializing logger:", error);
123
- }
124
- }
125
- /**
126
- * Logs a message with the specified level and optional category.
127
- *
128
- * @param options - Logging options
129
- * @param options.level - The log level (error, warn, info, etc.)
130
- * @param options.message - The message to log
131
- * @param options.category - Optional category for the log message
132
- */
133
- async log({ level, message, category }) {
134
- await this.initLogger();
135
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
136
- const newMessage = `[${timestamp}] ${message}`;
137
- this.logger.log(level, newMessage, category);
138
- }
139
- /**
140
- * Creates a new Winston logger instance with configured transports.
141
- *
142
- * @private
143
- * @returns A configured Winston logger instance
144
- */
145
- createLogger() {
146
- return winston.createLogger({
147
- levels: LOG_LEVELS,
148
- transports: [
149
- new winston.transports.Console({
150
- level: this.customerConfig.logs.console.minimumLevel,
151
- silent: this.customerConfig.logs.console.silent
152
- }),
153
- new MatomoTransport(this.customerConfig),
154
- new GraylogTransport(this.customerConfig)
155
- ]
156
- });
157
- }
158
- };
159
-
160
- // src/api/rpc.ts
161
- import { InformationUnitsService, LanguageService } from "@c-rex/services";
162
- import { NextResponse } from "next/server";
163
- var serviceRegistry = {
164
- InformationUnitsService,
165
- CrexLogger,
166
- LanguageService
167
- };
168
- var POST = async (req) => {
169
- try {
170
- const { method, params } = await req.json();
171
- const [serviceName, methodName] = method.split(".");
172
- const ServiceClass = serviceRegistry[serviceName];
173
- if (!ServiceClass) {
174
- return NextResponse.json({ error: `Service '${serviceName}' not found` }, { status: 404 });
175
- }
176
- const serviceInstance = new ServiceClass();
177
- const handler = serviceInstance[methodName];
178
- if (typeof handler !== "function") {
179
- return NextResponse.json({ error: `Method '${methodName}' not found on '${serviceName}'` }, { status: 404 });
180
- }
181
- const result = await handler.call(serviceInstance, params);
182
- return NextResponse.json({ data: result });
183
- } catch (error) {
184
- const logger = new CrexLogger();
185
- logger.log({
186
- level: "error",
187
- message: `RPC.POST error: ${error}`
188
- });
189
- return NextResponse.json({ error: String(error) }, { status: 500 });
190
- }
191
- };
192
- export {
193
- POST
194
- };
195
- //# sourceMappingURL=rpc.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/logger.ts","../../src/transports/matomo.ts","../../../constants/src/index.ts","../../src/transports/graylog.ts","../../src/config.ts","../../src/api/rpc.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 { getServerConfig } from \"./config\";\n\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 = getServerConfig();\n }\n if (!this.logger) {\n this.logger = this.createLogger();\n }\n } catch (error) {\n console.log(\"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 const timestamp = new Date().toISOString();\n const newMessage = `[${timestamp}] ${message}`;\n this.logger.log(level, newMessage, 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.matomo.minimumLevel,\n silent: configs.logs.matomo.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 \"table-with-images\",\n] as const;\n\nexport const API = {\n MAX_RETRY: 3,\n API_TIMEOUT: 10000,\n RETRY_DELAY: 500,\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 BLOG_TYPE_AND_LINK = \"blog\";\nexport const DOCUMENTS_TYPE_AND_LINK = \"documents\";\n\nexport const TOPIC = \"TOPIC\";\nexport const DOCUMENT = \"DOCUMENT\";\nexport const PACKAGE = \"PACKAGE\";\nexport const FRAGMENT = \"FRAGMENT\";\n\nexport const RESULT_TYPES = {\n TOPIC: TOPIC,\n DOCUMENT: DOCUMENT,\n PACKAGE: PACKAGE,\n FRAGMENT: FRAGMENT\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 = 30 * 24 * 60 * 60 * 1000; // 30 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\";\n\nexport const WILD_CARD_OPTIONS = {\n BOTH: \"BOTH\",\n END: \"END\",\n START: \"START\",\n NONE: \"NONE\",\n} as const;\n\nexport const OPERATOR_OPTIONS = {\n AND: \"AND\",\n OR: \"OR\",\n} as const;\n\nexport const ARTICLE_PAGE_LAYOUT = {\n BLOG: \"BLOG\",\n DOCUMENT: \"DOCUMENT\",\n} as const;\n\nexport const DEVICE_OPTIONS = {\n MOBILE: \"mobile\",\n TABLET: \"tablet\",\n DESKTOP: \"desktop\",\n}\nexport const BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n \"2xl\": 1536,\n};\n\nexport const MARKER_COLORS = [\n \"red-500\",\n \"orange-500\",\n \"yellow-400\",\n \"green-500\",\n \"teal-500\",\n \"blue-500\",\n \"sky-500\",\n \"purple-500\",\n \"pink-500\",\n \"gray-500\",\n \"neutral-800\",\n \"cyan-500\",\n \"lime-500\",\n \"amber-500\",\n \"indigo-500\",\n];","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 private 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 if (!configs.logs.graylog.hostname || configs.logs.graylog.port === undefined) {\n throw new Error(\"Graylog hostname and port must be defined\");\n }\n\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: configs.logs.graylog.app,\n silent: configs.logs.graylog.silent,\n handleExceptions: false,\n graylog: {\n servers: [\n { host: configs.logs.graylog.hostname, port: configs.logs.graylog.port }\n ],\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","import { ConfigInterface, CookiesConfigs } from \"@c-rex/interfaces\";\nimport { SDK_CONFIG_KEY } from '@c-rex/constants';\nimport { cookies } from 'next/headers';\n\n/**\n * Retrieves and parses configuration data from a cookie.\n * @returns The parsed configuration object\n * @throws Error if the configuration cookie is not found or cannot be parsed\n */\nexport const getClientConfig = (): CookiesConfigs => {\n const jsonConfigs = cookies().get(SDK_CONFIG_KEY)?.value;\n if (!jsonConfigs) {\n throw new Error('Configs not found');\n }\n\n const configs: CookiesConfigs = JSON.parse(jsonConfigs);\n\n return configs;\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __GLOBAL_CONFIG__: ConfigInterface | null;\n}\n\nexport function initializeConfig(config: ConfigInterface) {\n if (global.__GLOBAL_CONFIG__) return global.__GLOBAL_CONFIG__;\n global.__GLOBAL_CONFIG__ = config;\n return global.__GLOBAL_CONFIG__;\n}\n\nexport function getServerConfig() {\n if (!global.__GLOBAL_CONFIG__) {\n throw new Error('Server config not initialized');\n }\n return global.__GLOBAL_CONFIG__;\n}\n\nexport function updateConfigProp(key: keyof ConfigInterface, value: any) {\n if (!global.__GLOBAL_CONFIG__) {\n throw new Error('Server config not initialized');\n }\n global.__GLOBAL_CONFIG__[key] = value;\n return global.__GLOBAL_CONFIG__;\n}","import { CrexLogger } from '../logger';\nimport { InformationUnitsService, LanguageService } from '@c-rex/services';\nimport { NextRequest, NextResponse } from 'next/server';\n\n/**\n * Registry of available services that can be called via RPC.\n */\nconst serviceRegistry = {\n InformationUnitsService,\n CrexLogger,\n LanguageService\n};\n\n/**\n * Interface for RPC payload.\n */\ntype RpcPayload = {\n method: string;\n params: any;\n};\n\n/**\n * Handles POST requests for RPC (Remote Procedure Call) functionality.\n * Allows calling methods on registered services with parameters.\n * \n * @param req - The Next.js request object containing the RPC payload\n * @returns A JSON response with the result of the method call, or an error if the service or method is not found\n */\nexport const POST = async (req: NextRequest) => {\n try {\n const { method, params }: RpcPayload = await req.json();\n const [serviceName, methodName] = method.split('.');\n const ServiceClass = serviceRegistry[serviceName as keyof typeof serviceRegistry];\n\n if (!ServiceClass) {\n return NextResponse.json({ error: `Service '${serviceName}' not found` }, { status: 404 });\n }\n\n const serviceInstance = new ServiceClass();\n const handler = (serviceInstance as any)[methodName as any];\n\n if (typeof handler !== 'function') {\n return NextResponse.json({ error: `Method '${methodName}' not found on '${serviceName}'` }, { status: 404 });\n }\n\n const result = await handler.call(serviceInstance, params);\n return NextResponse.json({ data: result });\n } catch (error) {\n const logger = new CrexLogger()\n logger.log({\n level: \"error\",\n message: `RPC.POST error: ${error}`\n })\n return NextResponse.json({ error: String(error) }, { status: 500 });\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;AAyDO,IAAM,uBAAuB,KAAK,KAAK,KAAK,KAAK;;;ADrEjD,IAAM,kBAAN,cAA8B,UAAU;AAAA,EACpC;AAAA,EACC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,YAAY,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