@winible/winible-typed 2.79.1 → 2.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * @param message The log message
5
- * @param options Additional context for the log entry
6
- *
7
- * @example
8
- * // Basic usage
9
- * logger("User login successful");
10
- *
11
- * @example
12
- * // With user ID
13
- * logger("User login successful", { userId: "123456" });
14
- *
15
- * @example
16
- * // With error tracking (standard Error)
17
- * try {
18
- * throw new Error("Something went wrong");
19
- * } catch (error) {
20
- * logger("Operation failed", {
21
- * userId: "user123",
22
- * level: "error",
23
- * endpoint: "/auth",
24
- * method: "processPayment",
25
- * error
26
- * });
27
- * }
28
- *
29
- * @example
30
- * // With object-like error (e.g., from an API)
31
- * const apiError = { status: 403, message: "Forbidden", code: "ACCESS_DENIED" };
32
- * logger("API request failed", { error: apiError, level: "error" });
33
- *
34
- * @example
35
- * // With primitive error
36
- * logger("Validation failed", { error: "Invalid input", level: "warn" });
37
- *
38
- * @example
39
- * // With request tracking
40
- * logger("API request received", {
41
- * requestId: req.headers['x-request-id'],
42
- * endpoint: "/auth",
43
- * method: "validateToken"
44
- * action: "validateToken"
45
- * });
46
- */
47
- const logger = (message, options) => {
48
- const timestamp = new Date().toISOString();
49
- const environment = process.env.ENVIRONMENT || "development";
50
- const logEntry = Object.assign(Object.assign({ message, requestId: (options === null || options === void 0 ? void 0 : options.requestId) || "", timestamp, level: (options === null || options === void 0 ? void 0 : options.level) || "info", environment, endpoint: (options === null || options === void 0 ? void 0 : options.endpoint) || "", method: (options === null || options === void 0 ? void 0 : options.method) || "", action: (options === null || options === void 0 ? void 0 : options.action) || "", userId: (options === null || options === void 0 ? void 0 : options.userId) || "" }, ((options === null || options === void 0 ? void 0 : options.error)
51
- ? {
52
- error: (() => {
53
- var _a, _b, _c;
54
- // Handle different error types
55
- if (options.error instanceof Error) {
56
- // Standard Error object
57
- return {
58
- name: (_a = options.error) === null || _a === void 0 ? void 0 : _a.name,
59
- message: (_b = options.error) === null || _b === void 0 ? void 0 : _b.message,
60
- stack: (_c = options.error) === null || _c === void 0 ? void 0 : _c.stack,
61
- };
62
- }
63
- else if (typeof options.error === "object" &&
64
- options.error !== null) {
65
- // Object-like error but not an Error instance
66
- const errorObj = options.error;
67
- return {
68
- name: (errorObj === null || errorObj === void 0 ? void 0 : errorObj.name) || "UnknownError",
69
- message: (errorObj === null || errorObj === void 0 ? void 0 : errorObj.message) || String(errorObj),
70
- details: errorObj,
71
- };
72
- }
73
- else {
74
- // Primitive or other non-object error
75
- return {
76
- name: "UnknownError",
77
- message: String(options.error),
78
- };
79
- }
80
- })(),
81
- }
82
- : {})), ((options === null || options === void 0 ? void 0 : options.additionalData) ? { data: options.additionalData } : {}));
83
- // Log as JSON string on production for easier parsing in CloudWatch
84
- const outputLog = environment === "production"
85
- ? JSON.stringify(logEntry)
86
- : JSON.stringify(logEntry, null, 2);
87
- console.log(outputLog);
88
- };
89
- exports.default = logger;
90
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../utils/lambdaUtils/logger.ts"],"names":[],"mappings":";;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,MAAM,GAAG,CAAC,OAAe,EAAE,OAAuB,EAAE,EAAE;IAC1D,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,CAAC;IAE7D,MAAM,QAAQ,iCACZ,OAAO,EACP,SAAS,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,KAAI,EAAE,EACnC,SAAS,EACT,KAAK,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,K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