@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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves a cookie value by key from the request
|
|
5
|
+
* @param {NextRequest} req - The Next.js request object
|
|
6
|
+
* @returns {Promise<NextResponse>} JSON response containing the cookie key-value pair or error
|
|
7
|
+
*/
|
|
8
|
+
declare const getMethod: (req: NextRequest) => Promise<NextResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Sets a cookie with the specified key, value and options
|
|
11
|
+
* @param {NextRequest} req - The Next.js request object
|
|
12
|
+
* @returns {Promise<NextResponse>} JSON response indicating success or error
|
|
13
|
+
* @throws {Error} If key or value are missing in the request body
|
|
14
|
+
*/
|
|
15
|
+
declare const postMethod: (req: NextRequest) => Promise<NextResponse>;
|
|
16
|
+
|
|
17
|
+
export { getMethod, postMethod };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves a cookie value by key from the request
|
|
5
|
+
* @param {NextRequest} req - The Next.js request object
|
|
6
|
+
* @returns {Promise<NextResponse>} JSON response containing the cookie key-value pair or error
|
|
7
|
+
*/
|
|
8
|
+
declare const getMethod: (req: NextRequest) => Promise<NextResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Sets a cookie with the specified key, value and options
|
|
11
|
+
* @param {NextRequest} req - The Next.js request object
|
|
12
|
+
* @returns {Promise<NextResponse>} JSON response indicating success or error
|
|
13
|
+
* @throws {Error} If key or value are missing in the request body
|
|
14
|
+
*/
|
|
15
|
+
declare const postMethod: (req: NextRequest) => Promise<NextResponse>;
|
|
16
|
+
|
|
17
|
+
export { getMethod, postMethod };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/api/cookies.ts
|
|
21
|
+
var cookies_exports = {};
|
|
22
|
+
__export(cookies_exports, {
|
|
23
|
+
getMethod: () => getMethod,
|
|
24
|
+
postMethod: () => postMethod
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(cookies_exports);
|
|
27
|
+
var import_server = require("next/server");
|
|
28
|
+
var import_headers = require("next/headers");
|
|
29
|
+
|
|
30
|
+
// ../constants/src/index.ts
|
|
31
|
+
var DEFAULT_COOKIE_LIMIT = 7 * 24 * 60 * 60 * 1e3;
|
|
32
|
+
|
|
33
|
+
// src/api/cookies.ts
|
|
34
|
+
var getMethod = async (req) => {
|
|
35
|
+
const key = req.nextUrl.searchParams.get("key");
|
|
36
|
+
if (!key) return import_server.NextResponse.json({ error: "Missing key" }, { status: 400 });
|
|
37
|
+
const value = (0, import_headers.cookies)().get(key);
|
|
38
|
+
if (!value) return import_server.NextResponse.json({ error: "Missing value" }, { status: 400 });
|
|
39
|
+
return import_server.NextResponse.json({ key, value: value.value });
|
|
40
|
+
};
|
|
41
|
+
var postMethod = async (req) => {
|
|
42
|
+
const { key, value, maxAge: maxAgeAux } = await req.json();
|
|
43
|
+
let maxAge = maxAgeAux;
|
|
44
|
+
if (!key || value === void 0) {
|
|
45
|
+
return import_server.NextResponse.json({ error: "Missing key or value" }, { status: 400 });
|
|
46
|
+
}
|
|
47
|
+
if (maxAge === void 0) {
|
|
48
|
+
maxAge = DEFAULT_COOKIE_LIMIT;
|
|
49
|
+
}
|
|
50
|
+
(0, import_headers.cookies)().set({
|
|
51
|
+
name: key,
|
|
52
|
+
value,
|
|
53
|
+
secure: process.env.NODE_ENV === "production",
|
|
54
|
+
sameSite: "lax",
|
|
55
|
+
path: "/",
|
|
56
|
+
maxAge
|
|
57
|
+
});
|
|
58
|
+
return import_server.NextResponse.json({ success: true });
|
|
59
|
+
};
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
getMethod,
|
|
63
|
+
postMethod
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=cookies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/cookies.ts","../../../constants/src/index.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { cookies } from 'next/headers';\nimport { DEFAULT_COOKIE_LIMIT } from '@c-rex/constants';\n\n/**\n * Retrieves a cookie value by key from the request\n * @param {NextRequest} req - The Next.js request object\n * @returns {Promise<NextResponse>} JSON response containing the cookie key-value pair or error\n */\nexport const getMethod = async (req: NextRequest): Promise<NextResponse> => {\n const key = req.nextUrl.searchParams.get('key');\n if (!key) return NextResponse.json({ error: 'Missing key' }, { status: 400 });\n\n const value = cookies().get(key);\n if (!value) return NextResponse.json({ error: 'Missing value' }, { status: 400 });\n\n return NextResponse.json({ key, value: value.value });\n}\n\n/**\n * Sets a cookie with the specified key, value and options\n * @param {NextRequest} req - The Next.js request object\n * @returns {Promise<NextResponse>} JSON response indicating success or error\n * @throws {Error} If key or value are missing in the request body\n */\nexport const postMethod = async (req: NextRequest): Promise<NextResponse> => {\n const { key, value, maxAge: maxAgeAux } = await req.json();\n let maxAge = maxAgeAux;\n\n if (!key || value === undefined) {\n return NextResponse.json({ error: 'Missing key or value' }, { status: 400 });\n }\n\n if (maxAge === undefined) {\n maxAge = DEFAULT_COOKIE_LIMIT\n }\n\n cookies().set({\n name: key,\n value: value,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'lax',\n path: '/',\n maxAge: maxAge,\n });\n\n return NextResponse.json({ success: true });\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\";"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0C;AAC1C,qBAAwB;;;ACwEjB,IAAM,uBAAuB,IAAI,KAAK,KAAK,KAAK;;;ADhEhD,IAAM,YAAY,OAAO,QAA4C;AACxE,QAAM,MAAM,IAAI,QAAQ,aAAa,IAAI,KAAK;AAC9C,MAAI,CAAC,IAAK,QAAO,2BAAa,KAAK,EAAE,OAAO,cAAc,GAAG,EAAE,QAAQ,IAAI,CAAC;AAE5E,QAAM,YAAQ,wBAAQ,EAAE,IAAI,GAAG;AAC/B,MAAI,CAAC,MAAO,QAAO,2BAAa,KAAK,EAAE,OAAO,gBAAgB,GAAG,EAAE,QAAQ,IAAI,CAAC;AAEhF,SAAO,2BAAa,KAAK,EAAE,KAAK,OAAO,MAAM,MAAM,CAAC;AACxD;AAQO,IAAM,aAAa,OAAO,QAA4C;AACzE,QAAM,EAAE,KAAK,OAAO,QAAQ,UAAU,IAAI,MAAM,IAAI,KAAK;AACzD,MAAI,SAAS;AAEb,MAAI,CAAC,OAAO,UAAU,QAAW;AAC7B,WAAO,2BAAa,KAAK,EAAE,OAAO,uBAAuB,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC/E;AAEA,MAAI,WAAW,QAAW;AACtB,aAAS;AAAA,EACb;AAEA,8BAAQ,EAAE,IAAI;AAAA,IACV,MAAM;AAAA,IACN;AAAA,IACA,QAAQ,QAAQ,IAAI,aAAa;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN;AAAA,EACJ,CAAC;AAED,SAAO,2BAAa,KAAK,EAAE,SAAS,KAAK,CAAC;AAC9C;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/api/cookies.ts
|
|
2
|
+
import { NextResponse } from "next/server";
|
|
3
|
+
import { cookies } from "next/headers";
|
|
4
|
+
|
|
5
|
+
// ../constants/src/index.ts
|
|
6
|
+
var DEFAULT_COOKIE_LIMIT = 7 * 24 * 60 * 60 * 1e3;
|
|
7
|
+
|
|
8
|
+
// src/api/cookies.ts
|
|
9
|
+
var getMethod = async (req) => {
|
|
10
|
+
const key = req.nextUrl.searchParams.get("key");
|
|
11
|
+
if (!key) return NextResponse.json({ error: "Missing key" }, { status: 400 });
|
|
12
|
+
const value = cookies().get(key);
|
|
13
|
+
if (!value) return NextResponse.json({ error: "Missing value" }, { status: 400 });
|
|
14
|
+
return NextResponse.json({ key, value: value.value });
|
|
15
|
+
};
|
|
16
|
+
var postMethod = async (req) => {
|
|
17
|
+
const { key, value, maxAge: maxAgeAux } = await req.json();
|
|
18
|
+
let maxAge = maxAgeAux;
|
|
19
|
+
if (!key || value === void 0) {
|
|
20
|
+
return NextResponse.json({ error: "Missing key or value" }, { status: 400 });
|
|
21
|
+
}
|
|
22
|
+
if (maxAge === void 0) {
|
|
23
|
+
maxAge = DEFAULT_COOKIE_LIMIT;
|
|
24
|
+
}
|
|
25
|
+
cookies().set({
|
|
26
|
+
name: key,
|
|
27
|
+
value,
|
|
28
|
+
secure: process.env.NODE_ENV === "production",
|
|
29
|
+
sameSite: "lax",
|
|
30
|
+
path: "/",
|
|
31
|
+
maxAge
|
|
32
|
+
});
|
|
33
|
+
return NextResponse.json({ success: true });
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
getMethod,
|
|
37
|
+
postMethod
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=cookies.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/cookies.ts","../../../constants/src/index.ts"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { cookies } from 'next/headers';\nimport { DEFAULT_COOKIE_LIMIT } from '@c-rex/constants';\n\n/**\n * Retrieves a cookie value by key from the request\n * @param {NextRequest} req - The Next.js request object\n * @returns {Promise<NextResponse>} JSON response containing the cookie key-value pair or error\n */\nexport const getMethod = async (req: NextRequest): Promise<NextResponse> => {\n const key = req.nextUrl.searchParams.get('key');\n if (!key) return NextResponse.json({ error: 'Missing key' }, { status: 400 });\n\n const value = cookies().get(key);\n if (!value) return NextResponse.json({ error: 'Missing value' }, { status: 400 });\n\n return NextResponse.json({ key, value: value.value });\n}\n\n/**\n * Sets a cookie with the specified key, value and options\n * @param {NextRequest} req - The Next.js request object\n * @returns {Promise<NextResponse>} JSON response indicating success or error\n * @throws {Error} If key or value are missing in the request body\n */\nexport const postMethod = async (req: NextRequest): Promise<NextResponse> => {\n const { key, value, maxAge: maxAgeAux } = await req.json();\n let maxAge = maxAgeAux;\n\n if (!key || value === undefined) {\n return NextResponse.json({ error: 'Missing key or value' }, { status: 400 });\n }\n\n if (maxAge === undefined) {\n maxAge = DEFAULT_COOKIE_LIMIT\n }\n\n cookies().set({\n name: key,\n value: value,\n secure: process.env.NODE_ENV === 'production',\n sameSite: 'lax',\n path: '/',\n maxAge: maxAge,\n });\n\n return NextResponse.json({ success: true });\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\";"],"mappings":";AAAA,SAAsB,oBAAoB;AAC1C,SAAS,eAAe;;;ACwEjB,IAAM,uBAAuB,IAAI,KAAK,KAAK,KAAK;;;ADhEhD,IAAM,YAAY,OAAO,QAA4C;AACxE,QAAM,MAAM,IAAI,QAAQ,aAAa,IAAI,KAAK;AAC9C,MAAI,CAAC,IAAK,QAAO,aAAa,KAAK,EAAE,OAAO,cAAc,GAAG,EAAE,QAAQ,IAAI,CAAC;AAE5E,QAAM,QAAQ,QAAQ,EAAE,IAAI,GAAG;AAC/B,MAAI,CAAC,MAAO,QAAO,aAAa,KAAK,EAAE,OAAO,gBAAgB,GAAG,EAAE,QAAQ,IAAI,CAAC;AAEhF,SAAO,aAAa,KAAK,EAAE,KAAK,OAAO,MAAM,MAAM,CAAC;AACxD;AAQO,IAAM,aAAa,OAAO,QAA4C;AACzE,QAAM,EAAE,KAAK,OAAO,QAAQ,UAAU,IAAI,MAAM,IAAI,KAAK;AACzD,MAAI,SAAS;AAEb,MAAI,CAAC,OAAO,UAAU,QAAW;AAC7B,WAAO,aAAa,KAAK,EAAE,OAAO,uBAAuB,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC/E;AAEA,MAAI,WAAW,QAAW;AACtB,aAAS;AAAA,EACb;AAEA,UAAQ,EAAE,IAAI;AAAA,IACV,MAAM;AAAA,IACN;AAAA,IACA,QAAQ,QAAQ,IAAI,aAAa;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN;AAAA,EACJ,CAAC;AAED,SAAO,aAAa,KAAK,EAAE,SAAS,KAAK,CAAC;AAC9C;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles POST requests for RPC (Remote Procedure Call) functionality.
|
|
5
|
+
* Allows calling methods on registered services with parameters.
|
|
6
|
+
*
|
|
7
|
+
* @param req - The Next.js request object containing the RPC payload
|
|
8
|
+
* @returns A JSON response with the result of the method call, or an error if the service or method is not found
|
|
9
|
+
*/
|
|
10
|
+
declare const POST: (req: NextRequest) => Promise<NextResponse<{
|
|
11
|
+
error: string;
|
|
12
|
+
}> | NextResponse<{
|
|
13
|
+
data: any;
|
|
14
|
+
}>>;
|
|
15
|
+
|
|
16
|
+
export { POST };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles POST requests for RPC (Remote Procedure Call) functionality.
|
|
5
|
+
* Allows calling methods on registered services with parameters.
|
|
6
|
+
*
|
|
7
|
+
* @param req - The Next.js request object containing the RPC payload
|
|
8
|
+
* @returns A JSON response with the result of the method call, or an error if the service or method is not found
|
|
9
|
+
*/
|
|
10
|
+
declare const POST: (req: NextRequest) => Promise<NextResponse<{
|
|
11
|
+
error: string;
|
|
12
|
+
}> | NextResponse<{
|
|
13
|
+
data: any;
|
|
14
|
+
}>>;
|
|
15
|
+
|
|
16
|
+
export { POST };
|
package/dist/api/rpc.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
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 = 7 * 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.console.minimumLevel,
|
|
66
|
+
silent: configs.logs.console.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
|
+
super({
|
|
98
|
+
level: configs.logs.graylog.minimumLevel,
|
|
99
|
+
silent: configs.logs.graylog.silent
|
|
100
|
+
});
|
|
101
|
+
this.configs = configs;
|
|
102
|
+
this.graylogTransport = new import_winston_graylog2.default({
|
|
103
|
+
name: "Periotto-TEST",
|
|
104
|
+
silent: false,
|
|
105
|
+
handleExceptions: false,
|
|
106
|
+
graylog: {
|
|
107
|
+
servers: [{ host: "localhost", port: 12201 }]
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Logs a message to Graylog if the message category is included in the configured categories.
|
|
113
|
+
*
|
|
114
|
+
* @param info - The log information including level, message, and category
|
|
115
|
+
* @param callback - Callback function to execute after logging
|
|
116
|
+
*/
|
|
117
|
+
log(info, callback) {
|
|
118
|
+
const graylogCategory = this.configs.logs.graylog.categoriesLevel;
|
|
119
|
+
if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
|
|
120
|
+
this.graylogTransport.log(info, callback);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/logger.ts
|
|
126
|
+
var import_next_cookies = require("@c-rex/utils/next-cookies");
|
|
127
|
+
var CrexLogger = class {
|
|
128
|
+
customerConfig;
|
|
129
|
+
logger;
|
|
130
|
+
/**
|
|
131
|
+
* Initializes the logger instance if it hasn't been initialized yet.
|
|
132
|
+
* Loads customer configuration and creates the logger with appropriate transports.
|
|
133
|
+
*
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
async initLogger() {
|
|
137
|
+
try {
|
|
138
|
+
if (!this.customerConfig) {
|
|
139
|
+
this.customerConfig = await (0, import_next_cookies.getConfigs)();
|
|
140
|
+
}
|
|
141
|
+
if (!this.logger) {
|
|
142
|
+
this.logger = this.createLogger();
|
|
143
|
+
}
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.error("Error initializing logger:", error);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Logs a message with the specified level and optional category.
|
|
150
|
+
*
|
|
151
|
+
* @param options - Logging options
|
|
152
|
+
* @param options.level - The log level (error, warn, info, etc.)
|
|
153
|
+
* @param options.message - The message to log
|
|
154
|
+
* @param options.category - Optional category for the log message
|
|
155
|
+
*/
|
|
156
|
+
async log({ level, message, category }) {
|
|
157
|
+
await this.initLogger();
|
|
158
|
+
this.logger.log(level, message, category);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Creates a new Winston logger instance with configured transports.
|
|
162
|
+
*
|
|
163
|
+
* @private
|
|
164
|
+
* @returns A configured Winston logger instance
|
|
165
|
+
*/
|
|
166
|
+
createLogger() {
|
|
167
|
+
return import_winston.default.createLogger({
|
|
168
|
+
levels: LOG_LEVELS,
|
|
169
|
+
transports: [
|
|
170
|
+
new import_winston.default.transports.Console({
|
|
171
|
+
level: this.customerConfig.logs.console.minimumLevel,
|
|
172
|
+
silent: this.customerConfig.logs.console.silent
|
|
173
|
+
}),
|
|
174
|
+
new MatomoTransport(this.customerConfig),
|
|
175
|
+
new GraylogTransport(this.customerConfig)
|
|
176
|
+
]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// src/api/rpc.ts
|
|
182
|
+
var import_services = require("@c-rex/services");
|
|
183
|
+
var import_server = require("next/server");
|
|
184
|
+
var serviceRegistry = {
|
|
185
|
+
InformationUnitsService: import_services.InformationUnitsService,
|
|
186
|
+
CrexLogger,
|
|
187
|
+
LanguageService: import_services.LanguageService
|
|
188
|
+
};
|
|
189
|
+
var POST = async (req) => {
|
|
190
|
+
try {
|
|
191
|
+
const { method, params } = await req.json();
|
|
192
|
+
const [serviceName, methodName] = method.split(".");
|
|
193
|
+
const ServiceClass = serviceRegistry[serviceName];
|
|
194
|
+
if (!ServiceClass) {
|
|
195
|
+
return import_server.NextResponse.json({ error: `Service '${serviceName}' not found` }, { status: 404 });
|
|
196
|
+
}
|
|
197
|
+
const serviceInstance = new ServiceClass();
|
|
198
|
+
const handler = serviceInstance[methodName];
|
|
199
|
+
if (typeof handler !== "function") {
|
|
200
|
+
return import_server.NextResponse.json({ error: `Method '${methodName}' not found on '${serviceName}'` }, { status: 404 });
|
|
201
|
+
}
|
|
202
|
+
const result = await handler.call(serviceInstance, params);
|
|
203
|
+
return import_server.NextResponse.json({ data: result });
|
|
204
|
+
} catch (error) {
|
|
205
|
+
const logger = new CrexLogger();
|
|
206
|
+
logger.log({
|
|
207
|
+
level: "error",
|
|
208
|
+
message: `RPC.POST error: ${error}`
|
|
209
|
+
});
|
|
210
|
+
return import_server.NextResponse.json({ error: String(error) }, { status: 500 });
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
214
|
+
0 && (module.exports = {
|
|
215
|
+
POST
|
|
216
|
+
});
|
|
217
|
+
//# sourceMappingURL=rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/rpc.ts","../../src/logger.ts","../../src/transports/matomo.ts","../../../constants/src/index.ts","../../src/transports/graylog.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 { 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;;;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;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,KA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AAAA,IAC/G;AAEA,UAAM,SAAS,MAAM,QAAQ,KAAK,iBAAiB,MAAM;AACzD,WAAO,2BAAa,KAAK,EAAE,MAAM,OAAO,CAAC;AAAA,EAC7C,SAAS,OAAO;AACZ,UAAM,SAAS,IAAI,WAAW;AAC9B,WAAO,IAAI;AAAA,MACP,OAAO;AAAA,MACP,SAAS,mBAAmB,KAAK;AAAA,IACrC,CAAC;AACD,WAAO,2BAAa,KAAK,EAAE,OAAO,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,EACtE;AACJ;","names":["Transport","import_winston_transport","Transport","Graylog2Transport","winston"]}
|
package/dist/api/rpc.mjs
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// src/logger.ts
|
|
2
|
+
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 = 7 * 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.console.minimumLevel,
|
|
30
|
+
silent: configs.logs.console.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
|
+
super({
|
|
62
|
+
level: configs.logs.graylog.minimumLevel,
|
|
63
|
+
silent: configs.logs.graylog.silent
|
|
64
|
+
});
|
|
65
|
+
this.configs = configs;
|
|
66
|
+
this.graylogTransport = new Graylog2Transport({
|
|
67
|
+
name: "Periotto-TEST",
|
|
68
|
+
silent: false,
|
|
69
|
+
handleExceptions: false,
|
|
70
|
+
graylog: {
|
|
71
|
+
servers: [{ host: "localhost", port: 12201 }]
|
|
72
|
+
}
|
|
73
|
+
});
|
|
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
|
+
*/
|
|
81
|
+
log(info, callback) {
|
|
82
|
+
const graylogCategory = this.configs.logs.graylog.categoriesLevel;
|
|
83
|
+
if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
|
|
84
|
+
this.graylogTransport.log(info, callback);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/logger.ts
|
|
90
|
+
import { getConfigs } from "@c-rex/utils/next-cookies";
|
|
91
|
+
var CrexLogger = class {
|
|
92
|
+
customerConfig;
|
|
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
|
+
*/
|
|
100
|
+
async initLogger() {
|
|
101
|
+
try {
|
|
102
|
+
if (!this.customerConfig) {
|
|
103
|
+
this.customerConfig = await getConfigs();
|
|
104
|
+
}
|
|
105
|
+
if (!this.logger) {
|
|
106
|
+
this.logger = this.createLogger();
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.error("Error initializing logger:", error);
|
|
110
|
+
}
|
|
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
|
+
*/
|
|
120
|
+
async log({ level, message, category }) {
|
|
121
|
+
await this.initLogger();
|
|
122
|
+
this.logger.log(level, message, category);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new Winston logger instance with configured transports.
|
|
126
|
+
*
|
|
127
|
+
* @private
|
|
128
|
+
* @returns A configured Winston logger instance
|
|
129
|
+
*/
|
|
130
|
+
createLogger() {
|
|
131
|
+
return winston.createLogger({
|
|
132
|
+
levels: LOG_LEVELS,
|
|
133
|
+
transports: [
|
|
134
|
+
new winston.transports.Console({
|
|
135
|
+
level: this.customerConfig.logs.console.minimumLevel,
|
|
136
|
+
silent: this.customerConfig.logs.console.silent
|
|
137
|
+
}),
|
|
138
|
+
new MatomoTransport(this.customerConfig),
|
|
139
|
+
new GraylogTransport(this.customerConfig)
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// src/api/rpc.ts
|
|
146
|
+
import { InformationUnitsService, LanguageService } from "@c-rex/services";
|
|
147
|
+
import { NextResponse } from "next/server";
|
|
148
|
+
var serviceRegistry = {
|
|
149
|
+
InformationUnitsService,
|
|
150
|
+
CrexLogger,
|
|
151
|
+
LanguageService
|
|
152
|
+
};
|
|
153
|
+
var POST = async (req) => {
|
|
154
|
+
try {
|
|
155
|
+
const { method, params } = await req.json();
|
|
156
|
+
const [serviceName, methodName] = method.split(".");
|
|
157
|
+
const ServiceClass = serviceRegistry[serviceName];
|
|
158
|
+
if (!ServiceClass) {
|
|
159
|
+
return NextResponse.json({ error: `Service '${serviceName}' not found` }, { status: 404 });
|
|
160
|
+
}
|
|
161
|
+
const serviceInstance = new ServiceClass();
|
|
162
|
+
const handler = serviceInstance[methodName];
|
|
163
|
+
if (typeof handler !== "function") {
|
|
164
|
+
return NextResponse.json({ error: `Method '${methodName}' not found on '${serviceName}'` }, { status: 404 });
|
|
165
|
+
}
|
|
166
|
+
const result = await handler.call(serviceInstance, params);
|
|
167
|
+
return NextResponse.json({ data: result });
|
|
168
|
+
} catch (error) {
|
|
169
|
+
const logger = new CrexLogger();
|
|
170
|
+
logger.log({
|
|
171
|
+
level: "error",
|
|
172
|
+
message: `RPC.POST error: ${error}`
|
|
173
|
+
});
|
|
174
|
+
return NextResponse.json({ error: String(error) }, { status: 500 });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
POST
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=rpc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/logger.ts","../../src/transports/matomo.ts","../../../constants/src/index.ts","../../src/transports/graylog.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 { 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","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;AAoDO,IAAM,uBAAuB,IAAI,KAAK,KAAK,KAAK;;;ADhEhD,IAAM,kBAAN,cAA8B,UAAU;AAAA,EACpC;AAAA,EACC;AAAA;AAAA;AAAA;AAAA;AAAA;AA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