@catbee/utils 2.0.3 → 2.0.5

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/date/index.d.ts CHANGED
@@ -441,6 +441,49 @@ declare function isDST(timeZone: string, date?: Date | number): boolean;
441
441
  * ```
442
442
  */
443
443
  declare function getTimezoneAbbreviation(timeZone: string, date?: Date | number, locale?: string): string;
444
+ /**
445
+ * List of ISO 3166-1 alpha-2 country codes for use in timezone utilities.
446
+ * This list is used to generate country names and filter timezones by country.
447
+ */
448
+ declare const COUNTRY_CODES: string[];
449
+ type Country = {
450
+ code: string;
451
+ name: string;
452
+ };
453
+ /**
454
+ * Get a list of countries with their ISO codes and localized names.
455
+ * Uses Intl.DisplayNames to get the country names based on the provided locale.
456
+ *
457
+ * @param locale - Locale code for country names (default: 'en')
458
+ * @returns Array of country objects with code and name
459
+ *
460
+ * @example
461
+ * ```typescript
462
+ * getCountries('en');
463
+ * // [ { code: 'US', name: 'United States' }, { code: 'DE', name: 'Germany' }, ... ]
464
+ *
465
+ * getCountries('fr');
466
+ * // [ { code: 'US', name: 'États-Unis' }, { code: 'DE', name: 'Allemagne' }, ... ]
467
+ * ```
468
+ */
469
+ declare function getCountries(locale?: string): Country[];
470
+ /**
471
+ * List of all IANA timezone identifiers supported by the environment.
472
+ * This can be used to populate dropdowns or validate timezone inputs.
473
+ */
474
+ declare const TIMEZONE_NAMES: string[];
475
+ /**
476
+ * Get a list of all IANA timezone identifiers supported by the environment.
477
+ * This can be used to populate dropdowns or validate timezone inputs.
478
+ *
479
+ * @returns Array of timezone identifiers (e.g., 'America/New_York', 'Europe/Berlin')
480
+ * @example
481
+ * ```typescript
482
+ * getTimezones();
483
+ * // [ 'Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', ... ]
484
+ * ```
485
+ */
486
+ declare function getTimezones(): string[];
444
487
 
445
488
  /**
446
489
  * DateBuilder class for fluent date manipulation and building.
@@ -867,5 +910,5 @@ declare class DateBuilder {
867
910
  getTimezoneAbbreviation(timeZone: string): string;
868
911
  }
869
912
 
870
- export { DateBuilder, addDays, addMonths, addToDate, addYears, dateDiff, dateDiffDaysTZ, daysInMonth, endOf, formatDate, formatDateInTimeZone, formatDuration, formatRelativeTime, getDateFromDuration, getTimezoneAbbreviation, getTimezoneOffset, isBetween, isDST, isFuture, isLeapYear, isPast, isToday, isWeekend, parseDate, parseDuration, quarterOf, startOf, toTimeZone, weekOfYear };
913
+ export { COUNTRY_CODES, DateBuilder, TIMEZONE_NAMES, addDays, addMonths, addToDate, addYears, dateDiff, dateDiffDaysTZ, daysInMonth, endOf, formatDate, formatDateInTimeZone, formatDuration, formatRelativeTime, getCountries, getDateFromDuration, getTimezoneAbbreviation, getTimezoneOffset, getTimezones, isBetween, isDST, isFuture, isLeapYear, isPast, isToday, isWeekend, parseDate, parseDuration, quarterOf, startOf, toTimeZone, weekOfYear };
871
914
  export type { DateFormatOptions, DateFormatPreset };
package/date/index.mjs CHANGED
@@ -573,6 +573,278 @@ function getTimeZoneParts(date, timeZone) {
573
573
  };
574
574
  }
575
575
  __name(getTimeZoneParts, "getTimeZoneParts");
576
+ var COUNTRY_CODES = [
577
+ "AD",
578
+ "AE",
579
+ "AF",
580
+ "AG",
581
+ "AI",
582
+ "AL",
583
+ "AM",
584
+ "AO",
585
+ "AQ",
586
+ "AR",
587
+ "AS",
588
+ "AT",
589
+ "AU",
590
+ "AW",
591
+ "AX",
592
+ "AZ",
593
+ "BA",
594
+ "BB",
595
+ "BD",
596
+ "BE",
597
+ "BF",
598
+ "BG",
599
+ "BH",
600
+ "BI",
601
+ "BJ",
602
+ "BL",
603
+ "BM",
604
+ "BN",
605
+ "BO",
606
+ "BQ",
607
+ "BR",
608
+ "BS",
609
+ "BT",
610
+ "BV",
611
+ "BW",
612
+ "BY",
613
+ "BZ",
614
+ "CA",
615
+ "CC",
616
+ "CD",
617
+ "CF",
618
+ "CG",
619
+ "CH",
620
+ "CI",
621
+ "CK",
622
+ "CL",
623
+ "CM",
624
+ "CN",
625
+ "CO",
626
+ "CR",
627
+ "CU",
628
+ "CV",
629
+ "CW",
630
+ "CX",
631
+ "CY",
632
+ "CZ",
633
+ "DE",
634
+ "DJ",
635
+ "DK",
636
+ "DM",
637
+ "DO",
638
+ "DZ",
639
+ "EC",
640
+ "EE",
641
+ "EG",
642
+ "EH",
643
+ "ER",
644
+ "ES",
645
+ "ET",
646
+ "FI",
647
+ "FJ",
648
+ "FK",
649
+ "FM",
650
+ "FO",
651
+ "FR",
652
+ "GA",
653
+ "GB",
654
+ "GD",
655
+ "GE",
656
+ "GF",
657
+ "GG",
658
+ "GH",
659
+ "GI",
660
+ "GL",
661
+ "GM",
662
+ "GN",
663
+ "GP",
664
+ "GQ",
665
+ "GR",
666
+ "GS",
667
+ "GT",
668
+ "GU",
669
+ "GW",
670
+ "GY",
671
+ "HK",
672
+ "HM",
673
+ "HN",
674
+ "HR",
675
+ "HT",
676
+ "HU",
677
+ "ID",
678
+ "IE",
679
+ "IL",
680
+ "IM",
681
+ "IN",
682
+ "IO",
683
+ "IQ",
684
+ "IR",
685
+ "IS",
686
+ "IT",
687
+ "JE",
688
+ "JM",
689
+ "JO",
690
+ "JP",
691
+ "KE",
692
+ "KG",
693
+ "KH",
694
+ "KI",
695
+ "KM",
696
+ "KN",
697
+ "KP",
698
+ "KR",
699
+ "KW",
700
+ "KY",
701
+ "KZ",
702
+ "LA",
703
+ "LB",
704
+ "LC",
705
+ "LI",
706
+ "LK",
707
+ "LR",
708
+ "LS",
709
+ "LT",
710
+ "LU",
711
+ "LV",
712
+ "LY",
713
+ "MA",
714
+ "MC",
715
+ "MD",
716
+ "ME",
717
+ "MF",
718
+ "MG",
719
+ "MH",
720
+ "MK",
721
+ "ML",
722
+ "MM",
723
+ "MN",
724
+ "MO",
725
+ "MP",
726
+ "MQ",
727
+ "MR",
728
+ "MS",
729
+ "MT",
730
+ "MU",
731
+ "MV",
732
+ "MW",
733
+ "MX",
734
+ "MY",
735
+ "MZ",
736
+ "NA",
737
+ "NC",
738
+ "NE",
739
+ "NF",
740
+ "NG",
741
+ "NI",
742
+ "NL",
743
+ "NO",
744
+ "NP",
745
+ "NR",
746
+ "NU",
747
+ "NZ",
748
+ "OM",
749
+ "PA",
750
+ "PE",
751
+ "PF",
752
+ "PG",
753
+ "PH",
754
+ "PK",
755
+ "PL",
756
+ "PM",
757
+ "PN",
758
+ "PR",
759
+ "PS",
760
+ "PT",
761
+ "PW",
762
+ "PY",
763
+ "QA",
764
+ "RE",
765
+ "RO",
766
+ "RS",
767
+ "RU",
768
+ "RW",
769
+ "SA",
770
+ "SB",
771
+ "SC",
772
+ "SD",
773
+ "SE",
774
+ "SG",
775
+ "SH",
776
+ "SI",
777
+ "SJ",
778
+ "SK",
779
+ "SL",
780
+ "SM",
781
+ "SN",
782
+ "SO",
783
+ "SR",
784
+ "SS",
785
+ "ST",
786
+ "SV",
787
+ "SX",
788
+ "SY",
789
+ "SZ",
790
+ "TC",
791
+ "TD",
792
+ "TF",
793
+ "TG",
794
+ "TH",
795
+ "TJ",
796
+ "TK",
797
+ "TL",
798
+ "TM",
799
+ "TN",
800
+ "TO",
801
+ "TR",
802
+ "TT",
803
+ "TV",
804
+ "TW",
805
+ "TZ",
806
+ "UA",
807
+ "UG",
808
+ "UM",
809
+ "US",
810
+ "UY",
811
+ "UZ",
812
+ "VA",
813
+ "VC",
814
+ "VE",
815
+ "VG",
816
+ "VI",
817
+ "VN",
818
+ "VU",
819
+ "WF",
820
+ "WS",
821
+ "YE",
822
+ "YT",
823
+ "ZA",
824
+ "ZM",
825
+ "ZW"
826
+ ];
827
+ function getCountries(locale = "en") {
828
+ const regionNames = new Intl.DisplayNames([
829
+ locale
830
+ ], {
831
+ type: "region"
832
+ });
833
+ return COUNTRY_CODES.map((code) => ({
834
+ code,
835
+ name: regionNames.of(code)
836
+ }));
837
+ }
838
+ __name(getCountries, "getCountries");
839
+ var SUPPORTED_TIMEZONE_NAMES = Intl.supportedValuesOf("timeZone");
840
+ var TIMEZONE_NAMES = SUPPORTED_TIMEZONE_NAMES.includes("UTC") ? SUPPORTED_TIMEZONE_NAMES : [
841
+ ...SUPPORTED_TIMEZONE_NAMES,
842
+ "UTC"
843
+ ].sort((a, b) => a.localeCompare(b));
844
+ function getTimezones() {
845
+ return TIMEZONE_NAMES;
846
+ }
847
+ __name(getTimezones, "getTimezones");
576
848
 
577
849
  // src/date/date.builder.ts
578
850
  var DateBuilder = class _DateBuilder {
@@ -1177,4 +1449,4 @@ var DateBuilder = class _DateBuilder {
1177
1449
  }
1178
1450
  };
1179
1451
 
1180
- export { DateBuilder, addDays, addMonths, addToDate, addYears, dateDiff, dateDiffDaysTZ, daysInMonth, endOf, formatDate, formatDateInTimeZone, formatDuration, formatRelativeTime, getDateFromDuration, getTimezoneAbbreviation, getTimezoneOffset, isBetween, isDST, isFuture, isLeapYear, isPast, isToday, isWeekend, parseDate, parseDuration, quarterOf, startOf, toTimeZone, weekOfYear };
1452
+ export { COUNTRY_CODES, DateBuilder, TIMEZONE_NAMES, addDays, addMonths, addToDate, addYears, dateDiff, dateDiffDaysTZ, daysInMonth, endOf, formatDate, formatDateInTimeZone, formatDuration, formatRelativeTime, getCountries, getDateFromDuration, getTimezoneAbbreviation, getTimezoneOffset, getTimezones, isBetween, isDST, isFuture, isLeapYear, isPast, isToday, isWeekend, parseDate, parseDuration, quarterOf, startOf, toTimeZone, weekOfYear };
@@ -0,0 +1,58 @@
1
+ /*
2
+ * The MIT License
3
+ *
4
+ * Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ 'use strict';
26
+
27
+ var __defProp = Object.defineProperty;
28
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
29
+
30
+ // src/error/error.utils.ts
31
+ function ensureError(err) {
32
+ if (err instanceof Error) {
33
+ return err;
34
+ }
35
+ const message = typeof err === "string" ? err : hasErrorMessage(err) ? err.message : String(err);
36
+ return new Error(message, {
37
+ cause: err
38
+ });
39
+ }
40
+ __name(ensureError, "ensureError");
41
+ function hasErrorMessage(value) {
42
+ return typeof value === "object" && value !== null && "message" in value && typeof value.message === "string";
43
+ }
44
+ __name(hasErrorMessage, "hasErrorMessage");
45
+ function serializeError(err) {
46
+ const error = ensureError(err);
47
+ return {
48
+ name: error.name,
49
+ message: error.message,
50
+ stack: error.stack,
51
+ cause: error.cause
52
+ };
53
+ }
54
+ __name(serializeError, "serializeError");
55
+
56
+ exports.ensureError = ensureError;
57
+ exports.hasErrorMessage = hasErrorMessage;
58
+ exports.serializeError = serializeError;
@@ -0,0 +1,62 @@
1
+ /*
2
+ * The MIT License
3
+ *
4
+ * Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * Ensures the provided value is returned as an {@link Error}.
27
+ *
28
+ * If the value is not already an Error, a new Error is created using the
29
+ * value's message (if available) or its string representation. The original
30
+ * value is attached as the error's `cause`.
31
+ *
32
+ * @param err - The value to convert to an Error.
33
+ * @returns An Error instance.
34
+ */
35
+ declare function ensureError(err: unknown): Error;
36
+ /**
37
+ * Returns the error message for the provided value.
38
+ *
39
+ * If the value is not already an Error, it is first converted using
40
+ * {@link ensureError}.
41
+ *
42
+ * @param err - The value to extract the error message from.
43
+ * @returns The error message.
44
+ */
45
+ declare function hasErrorMessage(value: unknown): value is {
46
+ message: string;
47
+ };
48
+ interface SerializedError {
49
+ name: string;
50
+ message: string;
51
+ stack?: string;
52
+ cause?: unknown;
53
+ }
54
+ /**
55
+ * Serializes an error into a plain object containing its name, message, stack trace, and cause.
56
+ * @param err - The error to serialize.
57
+ * @returns An object representing the serialized error.
58
+ */
59
+ declare function serializeError(err: unknown): SerializedError;
60
+
61
+ export { ensureError, hasErrorMessage, serializeError };
62
+ export type { SerializedError };
@@ -0,0 +1,54 @@
1
+ /*
2
+ * The MIT License
3
+ *
4
+ * Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ var __defProp = Object.defineProperty;
26
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
27
+
28
+ // src/error/error.utils.ts
29
+ function ensureError(err) {
30
+ if (err instanceof Error) {
31
+ return err;
32
+ }
33
+ const message = typeof err === "string" ? err : hasErrorMessage(err) ? err.message : String(err);
34
+ return new Error(message, {
35
+ cause: err
36
+ });
37
+ }
38
+ __name(ensureError, "ensureError");
39
+ function hasErrorMessage(value) {
40
+ return typeof value === "object" && value !== null && "message" in value && typeof value.message === "string";
41
+ }
42
+ __name(hasErrorMessage, "hasErrorMessage");
43
+ function serializeError(err) {
44
+ const error = ensureError(err);
45
+ return {
46
+ name: error.name,
47
+ message: error.message,
48
+ stack: error.stack,
49
+ cause: error.cause
50
+ };
51
+ }
52
+ __name(serializeError, "serializeError");
53
+
54
+ export { ensureError, hasErrorMessage, serializeError };
package/index.cjs CHANGED
@@ -36,6 +36,7 @@ var date = require("./date/index.cjs");
36
36
  var decorator = require("./decorator/index.cjs");
37
37
  var directory = require("./directory/index.cjs");
38
38
  var env = require("./env/index.cjs");
39
+ var error = require("./error/index.cjs");
39
40
  var exception = require("./exception/index.cjs");
40
41
  var fs = require("./fs/index.cjs");
41
42
  var httpStatusCodes = require("./http-status-codes/index.cjs");
@@ -126,6 +127,12 @@ Object.keys(env).forEach(function (k) {
126
127
  get: function () { return env[k]; }
127
128
  });
128
129
  });
130
+ Object.keys(error).forEach(function (k) {
131
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
132
+ enumerable: true,
133
+ get: function () { return error[k]; }
134
+ });
135
+ });
129
136
  Object.keys(exception).forEach(function (k) {
130
137
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
131
138
  enumerable: true,
package/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export * from './date';
34
34
  export * from './decorator';
35
35
  export * from './directory';
36
36
  export * from './env';
37
+ export * from './error';
37
38
  export * from './exception';
38
39
  export * from './fs';
39
40
  export * from './http-status-codes';
package/index.mjs CHANGED
@@ -34,6 +34,7 @@ export * from "./date/index.mjs";
34
34
  export * from "./decorator/index.mjs";
35
35
  export * from "./directory/index.mjs";
36
36
  export * from "./env/index.mjs";
37
+ export * from "./error/index.mjs";
37
38
  export * from "./exception/index.mjs";
38
39
  export * from "./fs/index.mjs";
39
40
  export * from "./http-status-codes/index.mjs";
package/logger/index.cjs CHANGED
@@ -151,13 +151,14 @@ var _globalThis = typeof globalThis === "object" ? globalThis : global;
151
151
  var _global = _globalThis;
152
152
  function setupLogger(isGlobal = true) {
153
153
  const sensitiveFields = getExpandedSensitiveFields();
154
+ const { logger: loggerConfig } = config.getCatbeeGlobalConfig();
154
155
  const paths = /* @__PURE__ */ new Set([
155
156
  ...defaultRedactPaths,
156
157
  ...sensitiveFields.flatMap((field) => generateDeepPaths(field, 2))
157
158
  ]);
158
159
  const logParams = {
159
- name: config.getCatbeeGlobalConfig().logger?.name || "@catbee/utils",
160
- level: config.getCatbeeGlobalConfig().logger?.level || "info",
160
+ name: loggerConfig?.name ?? "@catbee/utils",
161
+ level: loggerConfig?.level ?? "info",
161
162
  redact: {
162
163
  paths: Array.from(paths),
163
164
  censor: /* @__PURE__ */ __name((value, path) => redact(value, path), "censor")
@@ -173,25 +174,25 @@ function setupLogger(isGlobal = true) {
173
174
  timestamp: pino.stdTimeFunctions.isoTime
174
175
  };
175
176
  let logger;
176
- const logDir = config.getCatbeeGlobalConfig().logger?.dir?.trim();
177
+ const logDir = loggerConfig?.dir?.trim();
177
178
  const hasFileLogging = Boolean(logDir);
178
- if (hasFileLogging && config.getCatbeeGlobalConfig().logger?.pretty) {
179
+ if (hasFileLogging && loggerConfig?.pretty) {
179
180
  logger = pino__default.default(logParams, pino__default.default.transport({
180
181
  targets: [
181
182
  {
182
183
  target: "pino-pretty",
183
- level: config.getCatbeeGlobalConfig().logger?.level ?? "info",
184
+ level: loggerConfig?.level ?? "info",
184
185
  options: {
185
- colorize: config.getCatbeeGlobalConfig().logger?.colorize,
186
+ colorize: loggerConfig?.colorize,
186
187
  translateTime: "SYS:standard",
187
188
  ignore: "pid,hostname",
188
- singleLine: config.getCatbeeGlobalConfig().logger?.singleLine,
189
+ singleLine: loggerConfig?.singleLine,
189
190
  levelFirst: true
190
191
  }
191
192
  },
192
193
  {
193
194
  target: "pino/file",
194
- level: config.getCatbeeGlobalConfig().logger?.level ?? "info",
195
+ level: loggerConfig?.level ?? "info",
195
196
  options: {
196
197
  destination: `${logDir}/app.log`,
197
198
  mkdir: true
@@ -207,14 +208,14 @@ function setupLogger(isGlobal = true) {
207
208
  mkdir: true
208
209
  }
209
210
  }));
210
- } else if (config.getCatbeeGlobalConfig().logger?.pretty) {
211
+ } else if (loggerConfig?.pretty) {
211
212
  logger = pino__default.default(logParams, pino__default.default.transport({
212
213
  target: "pino-pretty",
213
214
  options: {
214
- colorize: config.getCatbeeGlobalConfig().logger?.colorize,
215
+ colorize: loggerConfig?.colorize,
215
216
  translateTime: "SYS:standard",
216
217
  ignore: "pid,hostname",
217
- singleLine: config.getCatbeeGlobalConfig().logger?.singleLine,
218
+ singleLine: loggerConfig?.singleLine,
218
219
  levelFirst: true
219
220
  }
220
221
  }));
@@ -243,7 +244,7 @@ function getLogger(newInstance = false) {
243
244
  }
244
245
  __name(getLogger, "getLogger");
245
246
  function createChildLogger(bindings, parentLogger) {
246
- const logger = parentLogger || getLogger();
247
+ const logger = parentLogger ?? getLogger();
247
248
  return logger.child(bindings);
248
249
  }
249
250
  __name(createChildLogger, "createChildLogger");
package/logger/index.d.ts CHANGED
@@ -172,23 +172,23 @@ declare function getLogger(newInstance?: boolean): Logger$1;
172
172
  * @param {Logger} [parentLogger] - Parent logger (defaults to current context logger or global)
173
173
  * @returns {Logger} Child logger with merged context
174
174
  */
175
- declare function createChildLogger(bindings: Record<string, any>, parentLogger?: Logger$1): Logger$1;
175
+ declare function createChildLogger(bindings: Record<string, unknown>, parentLogger?: Logger$1): Logger$1;
176
176
  /**
177
177
  * Creates a request-scoped logger with request ID and stores it in context
178
178
  *
179
179
  * @param {string} requestId - Unique request identifier
180
- * @param {object} [additionalContext] - Additional context to include in logs
180
+ * @param {Record<string, unknown>} [additionalContext] - Additional context to include in logs
181
181
  * @returns {Logger} Request-scoped logger instance
182
182
  */
183
- declare function createRequestLogger(requestId: string, additionalContext?: Record<string, any>): Logger$1;
183
+ declare function createRequestLogger(requestId: string, additionalContext?: Record<string, unknown>): Logger$1;
184
184
  /**
185
185
  * Utility to safely log errors with proper stack trace extraction
186
186
  *
187
187
  * @param {Error|unknown} error - Error object to log
188
188
  * @param {string} [message] - Optional message to include
189
- * @param {Record<string, any>} [context] - Additional context properties
189
+ * @param {Record<string, unknown>} [context] - Additional context properties
190
190
  */
191
- declare function logError(error: Error | string, message?: string, context?: Record<string, any>): void;
191
+ declare function logError(error: Error | string, message?: string, context?: Record<string, unknown>): void;
192
192
  /**
193
193
  * Expands multiple sensitive field names into their variants.
194
194
  * Useful to match fields like `api_key`, `apiKey`, `apikey`, `APIKEY`, etc.