@cyberskill/shared 3.4.0 → 3.5.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.
- package/dist/config/graphql-codegen/graphql-codegen.type.d.ts +1 -1
- package/dist/config/storybook/storybook.preview.js +8 -15
- package/dist/config/storybook/storybook.preview.js.map +1 -1
- package/dist/config/vitest/vitest.unit.js.map +1 -1
- package/dist/constant/index.js +2 -2
- package/dist/constant/response-status.d.ts +254 -0
- package/dist/constant/response-status.js +65 -1
- package/dist/constant/response-status.js.map +1 -1
- package/dist/node/cli/index.js +10 -9
- package/dist/node/cli/index.js.map +1 -1
- package/dist/node/command/command.util.js +32 -20
- package/dist/node/command/command.util.js.map +1 -1
- package/dist/node/express/express.type.d.ts +2 -0
- package/dist/node/express/express.util.js +11 -4
- package/dist/node/express/express.util.js.map +1 -1
- package/dist/node/log/log.type.d.ts +1 -5
- package/dist/node/log/log.type.js.map +1 -1
- package/dist/node/log/log.util.d.ts +2 -4
- package/dist/node/log/log.util.js +38 -40
- package/dist/node/log/log.util.js.map +1 -1
- package/dist/node/mongo/mongo.controller.d.ts +3 -1
- package/dist/node/mongo/mongo.controller.mongoose.js +75 -78
- package/dist/node/mongo/mongo.controller.mongoose.js.map +1 -1
- package/dist/node/mongo/mongo.controller.native.d.ts +9 -1
- package/dist/node/mongo/mongo.controller.native.js +17 -14
- package/dist/node/mongo/mongo.controller.native.js.map +1 -1
- package/dist/node/mongo/mongo.controller.type.d.ts +76 -0
- package/dist/node/mongo/mongo.dynamic-populate.d.ts +2 -1
- package/dist/node/mongo/mongo.dynamic-populate.js +12 -12
- package/dist/node/mongo/mongo.dynamic-populate.js.map +1 -1
- package/dist/node/mongo/mongo.internal-types.d.ts +81 -0
- package/dist/node/mongo/mongo.internal-types.js +40 -0
- package/dist/node/mongo/mongo.internal-types.js.map +1 -0
- package/dist/node/mongo/mongo.populate.d.ts +2 -1
- package/dist/node/mongo/mongo.populate.js +130 -171
- package/dist/node/mongo/mongo.populate.js.map +1 -1
- package/dist/node/mongo/mongo.type.d.ts +1 -1
- package/dist/node/mongo/mongo.type.js.map +1 -1
- package/dist/node/mongo/mongo.util.d.ts +7 -7
- package/dist/node/mongo/mongo.util.js +34 -32
- package/dist/node/mongo/mongo.util.js.map +1 -1
- package/dist/node/path/path.constant.d.ts +3 -6
- package/dist/node/path/path.constant.js +31 -25
- package/dist/node/path/path.constant.js.map +1 -1
- package/dist/node/storage/index.js +2 -2
- package/dist/node/storage/storage.util.d.ts +6 -0
- package/dist/node/storage/storage.util.js +4 -1
- package/dist/node/storage/storage.util.js.map +1 -1
- package/dist/react/log/log.type.d.ts +1 -5
- package/dist/react/log/log.util.d.ts +2 -5
- package/dist/react/log/log.util.js +21 -25
- package/dist/react/log/log.util.js.map +1 -1
- package/dist/util/common/common.util.d.ts +8 -0
- package/dist/util/common/common.util.js +4 -1
- package/dist/util/common/common.util.js.map +1 -1
- package/dist/util/common/index.js +2 -2
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +7 -6
- package/dist/util/log/index.d.ts +2 -0
- package/dist/util/log/index.js +2 -0
- package/dist/util/log/log.type.d.ts +8 -0
- package/dist/util/log/log.util.d.ts +17 -0
- package/dist/util/log/log.util.js +14 -0
- package/dist/util/log/log.util.js.map +1 -0
- package/package.json +83 -40
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
import { RESPONSE_STATUS as e } from "../../constant/response-status.js";
|
|
2
|
-
import {
|
|
2
|
+
import { baseCatchError as t } from "../../util/log/log.util.js";
|
|
3
|
+
import { consola as n } from "consola/browser";
|
|
3
4
|
//#region src/react/log/log.util.ts
|
|
4
|
-
var
|
|
5
|
-
silent:
|
|
6
|
-
level:
|
|
7
|
-
fatal:
|
|
8
|
-
error:
|
|
9
|
-
warn:
|
|
10
|
-
log:
|
|
11
|
-
info:
|
|
12
|
-
success:
|
|
13
|
-
ready:
|
|
14
|
-
start:
|
|
15
|
-
box:
|
|
16
|
-
debug:
|
|
17
|
-
trace:
|
|
18
|
-
verbose:
|
|
5
|
+
var r = {
|
|
6
|
+
silent: n.silent,
|
|
7
|
+
level: n.level,
|
|
8
|
+
fatal: n.fatal,
|
|
9
|
+
error: n.error,
|
|
10
|
+
warn: n.warn,
|
|
11
|
+
log: n.log,
|
|
12
|
+
info: n.info,
|
|
13
|
+
success: n.success,
|
|
14
|
+
ready: n.ready,
|
|
15
|
+
start: n.start,
|
|
16
|
+
box: n.box,
|
|
17
|
+
debug: n.debug,
|
|
18
|
+
trace: n.trace,
|
|
19
|
+
verbose: n.verbose
|
|
19
20
|
};
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
return i && n.error(s.message), o && typeof o == "function" && o(s), a === void 0 ? {
|
|
23
|
-
success: !1,
|
|
24
|
-
message: s.message,
|
|
25
|
-
code: e.INTERNAL_SERVER_ERROR.CODE
|
|
26
|
-
} : a;
|
|
21
|
+
function i(e, n) {
|
|
22
|
+
return t(e, n, (e) => r.error(e));
|
|
27
23
|
}
|
|
28
|
-
function
|
|
24
|
+
function a(t, n) {
|
|
29
25
|
let r = Error(t);
|
|
30
26
|
throw r.code = n ?? e.INTERNAL_SERVER_ERROR.CODE, r;
|
|
31
27
|
}
|
|
32
28
|
//#endregion
|
|
33
|
-
export {
|
|
29
|
+
export { i as catchError, r as log, a as throwError };
|
|
34
30
|
|
|
35
31
|
//# sourceMappingURL=log.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.util.js","names":[],"sources":["../../../src/react/log/log.util.ts"],"sourcesContent":["import { consola } from 'consola/browser';\n\nimport type { I_Log, I_Return } from '#typescript/index.js';\n\nimport { RESPONSE_STATUS } from '#constant/index.js';\n\nimport type { I_CatchErrorOptions } from './log.type.js';\n\n/**\n * Browser-compatible logging interface using consola.\n * This object provides all standard consola logging methods for use in browser environments,\n * including error, warning, info, success, and debug logging capabilities.\n */\nexport const log: I_Log = {\n silent: consola.silent,\n level: consola.level,\n fatal: consola.fatal,\n error: consola.error,\n warn: consola.warn,\n log: consola.log,\n info: consola.info,\n success: consola.success,\n ready: consola.ready,\n start: consola.start,\n box: consola.box,\n debug: consola.debug,\n trace: consola.trace,\n verbose: consola.verbose,\n};\n\n/**\n * Catches and handles errors with configurable behavior for React applications.\n *
|
|
1
|
+
{"version":3,"file":"log.util.js","names":[],"sources":["../../../src/react/log/log.util.ts"],"sourcesContent":["import { consola } from 'consola/browser';\n\nimport type { I_Log, I_Return } from '#typescript/index.js';\n\nimport { RESPONSE_STATUS } from '#constant/index.js';\nimport { baseCatchError } from '#util/log/index.js';\n\nimport type { I_CatchErrorOptions } from './log.type.js';\n\n/**\n * Browser-compatible logging interface using consola.\n * This object provides all standard consola logging methods for use in browser environments,\n * including error, warning, info, success, and debug logging capabilities.\n */\nexport const log: I_Log = {\n silent: consola.silent,\n level: consola.level,\n fatal: consola.fatal,\n error: consola.error,\n warn: consola.warn,\n log: consola.log,\n info: consola.info,\n success: consola.success,\n ready: consola.ready,\n start: consola.start,\n box: consola.box,\n debug: consola.debug,\n trace: consola.trace,\n verbose: consola.verbose,\n};\n\n/**\n * Catches and handles errors with configurable behavior for React applications.\n * Delegates to the shared `baseCatchError` implementation, using the browser\n * consola instance for logging.\n *\n * @param errorInput - The error to catch and handle, can be Error object, string, or unknown type.\n * @param options - Configuration options for error handling behavior.\n * @returns Either the specified return value or a standardized error response object.\n */\nexport function catchError<T = unknown>(errorInput: unknown, options: I_CatchErrorOptions & { returnValue: T }): T;\nexport function catchError<T = unknown>(errorInput: unknown, options?: I_CatchErrorOptions): I_Return<T>;\nexport function catchError<T = unknown>(errorInput: unknown, options?: I_CatchErrorOptions): I_Return<T> | T {\n return baseCatchError<T>(errorInput, options, message => log.error(message));\n}\n\n/**\n * Throws a standardized error with a message and optional HTTP status code.\n * Provides a consistent way to throw errors across React and Node environments.\n *\n * @param message - The error message.\n * @param code - Optional HTTP status code (defaults to 500).\n */\nexport function throwError(message: string, code?: number): never {\n const error = new Error(message);\n (error as Error & { code?: number }).code = code ?? RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE;\n throw error;\n}\n"],"mappings":";;;;AAcA,IAAa,IAAa;CACtB,QAAQ,EAAQ;CAChB,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,MAAM,EAAQ;CACd,KAAK,EAAQ;CACb,MAAM,EAAQ;CACd,SAAS,EAAQ;CACjB,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,KAAK,EAAQ;CACb,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,SAAS,EAAQ;CACpB;AAaD,SAAgB,EAAwB,GAAqB,GAAgD;AACzG,QAAO,EAAkB,GAAY,IAAS,MAAW,EAAI,MAAM,EAAQ,CAAC;;AAUhF,SAAgB,EAAW,GAAiB,GAAsB;CAC9D,IAAM,IAAY,MAAM,EAAQ;AAEhC,OADC,EAAoC,OAAO,KAAQ,EAAgB,sBAAsB,MACpF"}
|
|
@@ -50,3 +50,11 @@ export declare function uniqueArray<T>(arr: T[], keyFn?: (item: T) => string | n
|
|
|
50
50
|
* @throws {Error} When NODE_ENV is production but NODE_ENV_MODE is development.
|
|
51
51
|
*/
|
|
52
52
|
export declare function mapEnvironment(env: I_NodeEnvInput): I_EnvFlags;
|
|
53
|
+
/**
|
|
54
|
+
* Checks if value is object-like (e.g., objects, arrays, etc.), not null.
|
|
55
|
+
* Re-exported from util for general use across the codebase.
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value to check.
|
|
58
|
+
* @returns True if the value is an object and not null.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isObject(value: unknown): value is object;
|
|
@@ -119,7 +119,10 @@ function m(t) {
|
|
|
119
119
|
IS_PROD: o
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
+
function h(e) {
|
|
123
|
+
return typeof e == "object" && !!e;
|
|
124
|
+
}
|
|
122
125
|
//#endregion
|
|
123
|
-
export { l as escapeRegExp, m as mapEnvironment, u as regexSearchMapper, f as removeAccent, p as uniqueArray };
|
|
126
|
+
export { l as escapeRegExp, h as isObject, m as mapEnvironment, u as regexSearchMapper, f as removeAccent, p as uniqueArray };
|
|
124
127
|
|
|
125
128
|
//# sourceMappingURL=common.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.util.js","names":[],"sources":["../../../src/util/common/common.util.ts"],"sourcesContent":["import { E_Environment } from '#typescript/index.js';\n\nimport type { I_EnvFlags, I_NodeEnvInput } from './common.type.js';\n\nconst charMap: Record<string, string[]> = {\n a: ['à', 'á', 'ạ', 'ả', 'ã', 'â', 'ầ', 'ấ', 'ậ', 'ẩ', 'ẫ', 'ă', 'ằ', 'ắ', 'ặ', 'ẳ', 'ẵ'],\n e: ['è', 'é', 'ẹ', 'ẻ', 'ẽ', 'ê', 'ề', 'ế', 'ệ', 'ể', 'ễ'],\n i: ['ì', 'í', 'ị', 'ỉ', 'ĩ'],\n o: ['ò', 'ó', 'ọ', 'ỏ', 'õ', 'ô', 'ồ', 'ố', 'ộ', 'ổ', 'ỗ', 'ơ', 'ờ', 'ớ', 'ợ', 'ở', 'ỡ'],\n u: ['ù', 'ú', 'ụ', 'ủ', 'ũ', 'ư', 'ừ', 'ứ', 'ự', 'ử', 'ữ'],\n y: ['ỳ', 'ý', 'ỵ', 'ỷ', 'ỹ'],\n d: ['đ'],\n};\n\nconst upperCharMap: Record<string, string[]> = Object.entries(charMap).reduce(\n (map, [key, value]) => {\n map[key.toUpperCase()] = value.map(char => char.toUpperCase());\n return map;\n },\n {} as Record<string, string[]>,\n);\n\nconst combinedMap = { ...charMap, ...upperCharMap };\n\n// Pre-compute replacement map and search regex for better performance\n// This avoids rebuilding regexes and maps on every function call\nconst replacementMap = new Map<string, string>();\nconst charsToMatch = new Set<string>();\n\nObject.entries(combinedMap).forEach(([baseChar, variations]) => {\n // The replacement pattern is the same for the base char and all its variations\n // Example: 'a', 'à', 'á'... all map to '(a|à|á...)'\n const replacement = `(${[baseChar, ...variations].join('|')})`;\n\n [baseChar, ...variations].forEach((char) => {\n replacementMap.set(char, replacement);\n charsToMatch.add(char);\n });\n});\n\n// Construct a single regex that matches any character in our map\nconst patternString = [...charsToMatch].join('');\n// We use a character class regex: [abc...]\n// eslint-disable-next-line regexp/no-empty-character-class -- regex is built dynamically from precomputed charMap\nconst searchRegex = new RegExp(`[${patternString}]`, 'g');\n\nconst RE_ESCAPE_REGEXP = /[.*+?^${}()|[\\]\\\\]/g;\n\n/**\n * Escapes special characters in a string for use in a regular expression.\n * This function escapes characters that have special meaning in regex (e.g., ., *, +, ?, etc.)\n * so they are treated as literal characters.\n *\n * @param str - The string to escape.\n * @returns The escaped string safe for use in a RegExp.\n */\nexport function escapeRegExp(str: string): string {\n return str.replace(RE_ESCAPE_REGEXP, '\\\\$&');\n}\n\n/**\n * Convert a string to a regex pattern that matches the string and its accented variations.\n * This function normalizes the input string and creates a regex pattern that can match\n * both the original characters and their accented equivalents.\n *\n * Optimization: Uses pre-computed regex and map to perform replacement in a single pass (O(N)),\n * instead of iterating through all character groups (O(K*N)).\n * Removed unnecessary NFD normalization which improves performance and fixes\n * matching against NFC target strings.\n *\n * @param str - The string to convert to a regex pattern.\n * @returns The regex pattern as a string that matches the original string and its accented variations.\n */\nexport function regexSearchMapper(str: string) {\n str = escapeRegExp(str);\n return str.replace(searchRegex, match => replacementMap.get(match) || match);\n}\n\nconst RE_DIACRITIC = /\\p{Diacritic}/gu;\n\n/**\n * Remove accents from a string.\n * This function normalizes the string using NFD normalization and removes all diacritical marks.\n *\n * @param str - The string to remove accents from.\n * @returns The string without any accents or diacritical marks.\n */\nexport function removeAccent(str: string) {\n return str.normalize('NFD').replace(RE_DIACRITIC, '');\n}\n\n/**\n * Remove duplicates from an array based on a key function.\n * This function can remove duplicates either by comparing values directly (when no keyFn is provided)\n * or by using a custom key function to determine uniqueness.\n *\n * @param arr - The array to remove duplicates from.\n * @param keyFn - Optional function that returns a unique key for each item in the array.\n * @returns A new array with duplicates removed, maintaining the original order.\n */\nexport function uniqueArray<T>(\n arr: T[],\n keyFn?: (item: T) => string | number,\n): T[] {\n if (!keyFn) {\n return [...new Set(arr)];\n }\n\n const seen = new Set<string | number>();\n const result: T[] = [];\n\n for (const item of arr) {\n const key = keyFn(item);\n if (!seen.has(key)) {\n seen.add(key);\n result.push(item);\n }\n }\n\n return result;\n}\n\n/**\n * Map environment variables to boolean flags indicating the current environment.\n * This function takes NODE_ENV and NODE_ENV_MODE variables and returns flags\n * indicating whether the current environment is development, staging, or production.\n *\n * @param env - The environment variables object containing NODE_ENV and NODE_ENV_MODE.\n * @returns An object containing boolean flags for the environment (IS_DEV, IS_STAG, IS_PROD).\n * @throws {Error} When NODE_ENV is production but NODE_ENV_MODE is development.\n */\nexport function mapEnvironment(env: I_NodeEnvInput): I_EnvFlags {\n const { NODE_ENV = E_Environment.DEVELOPMENT, NODE_ENV_MODE = E_Environment.DEVELOPMENT } = env;\n\n const IS_DEV = NODE_ENV === E_Environment.DEVELOPMENT && NODE_ENV_MODE === E_Environment.DEVELOPMENT;\n const IS_STAG = NODE_ENV === E_Environment.PRODUCTION && NODE_ENV_MODE === E_Environment.STAGING;\n const IS_PROD = NODE_ENV === E_Environment.PRODUCTION && NODE_ENV_MODE === E_Environment.PRODUCTION;\n\n if (NODE_ENV === E_Environment.PRODUCTION && NODE_ENV_MODE === E_Environment.DEVELOPMENT) {\n throw new Error('NODE_ENV_MODE must be set to staging or production in production environment');\n }\n\n return { IS_DEV, IS_STAG, IS_PROD };\n}\n"],"mappings":";;AAIA,IAAM,IAAoC;CACtC,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CACxF,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CAC1D,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAI;CAC5B,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CACxF,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CAC1D,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAI;CAC5B,GAAG,CAAC,IAAI;CACX,EAEK,IAAyC,OAAO,QAAQ,EAAQ,CAAC,QAClE,GAAK,CAAC,GAAK,QACR,EAAI,EAAI,aAAa,IAAI,EAAM,KAAI,MAAQ,EAAK,aAAa,CAAC,EACvD,IAEX,EAAE,CACL,EAEK,IAAc;CAAE,GAAG;CAAS,GAAG;CAAc,EAI7C,oBAAiB,IAAI,KAAqB,EAC1C,oBAAe,IAAI,KAAa;AAEtC,OAAO,QAAQ,EAAY,CAAC,SAAS,CAAC,GAAU,OAAgB;CAG5D,IAAM,IAAc,IAAI,CAAC,GAAU,GAAG,EAAW,CAAC,KAAK,IAAI,CAAC;AAE5D,EAAC,GAAU,GAAG,EAAW,CAAC,SAAS,MAAS;AAExC,EADA,EAAe,IAAI,GAAM,EAAY,EACrC,EAAa,IAAI,EAAK;GACxB;EACJ;AAGF,IAAM,IAAgB,CAAC,GAAG,EAAa,CAAC,KAAK,GAAG,EAG1C,IAAkB,OAAO,IAAI,EAAc,IAAI,IAAI,EAEnD,IAAmB;AAUzB,SAAgB,EAAa,GAAqB;AAC9C,QAAO,EAAI,QAAQ,GAAkB,OAAO;;AAgBhD,SAAgB,EAAkB,GAAa;AAE3C,QADA,IAAM,EAAa,EAAI,EAChB,EAAI,QAAQ,IAAa,MAAS,EAAe,IAAI,EAAM,IAAI,EAAM;;AAGhF,IAAM,IAAe;AASrB,SAAgB,EAAa,GAAa;AACtC,QAAO,EAAI,UAAU,MAAM,CAAC,QAAQ,GAAc,GAAG;;AAYzD,SAAgB,EACZ,GACA,GACG;AACH,KAAI,CAAC,EACD,QAAO,CAAC,GAAG,IAAI,IAAI,EAAI,CAAC;CAG5B,IAAM,oBAAO,IAAI,KAAsB,EACjC,IAAc,EAAE;AAEtB,MAAK,IAAM,KAAQ,GAAK;EACpB,IAAM,IAAM,EAAM,EAAK;AACvB,EAAK,EAAK,IAAI,EAAI,KACd,EAAK,IAAI,EAAI,EACb,EAAO,KAAK,EAAK;;AAIzB,QAAO;;AAYX,SAAgB,EAAe,GAAiC;CAC5D,IAAM,EAAE,cAAW,EAAc,aAAa,mBAAgB,EAAc,gBAAgB,GAEtF,IAAS,MAAa,EAAc,eAAe,MAAkB,EAAc,aACnF,IAAU,MAAa,EAAc,cAAc,MAAkB,EAAc,SACnF,IAAU,MAAa,EAAc,cAAc,MAAkB,EAAc;AAEzF,KAAI,MAAa,EAAc,cAAc,MAAkB,EAAc,YACzE,OAAU,MAAM,+EAA+E;AAGnG,QAAO;EAAE;EAAQ;EAAS;EAAS"}
|
|
1
|
+
{"version":3,"file":"common.util.js","names":[],"sources":["../../../src/util/common/common.util.ts"],"sourcesContent":["import { E_Environment } from '#typescript/index.js';\n\nimport type { I_EnvFlags, I_NodeEnvInput } from './common.type.js';\n\nconst charMap: Record<string, string[]> = {\n a: ['à', 'á', 'ạ', 'ả', 'ã', 'â', 'ầ', 'ấ', 'ậ', 'ẩ', 'ẫ', 'ă', 'ằ', 'ắ', 'ặ', 'ẳ', 'ẵ'],\n e: ['è', 'é', 'ẹ', 'ẻ', 'ẽ', 'ê', 'ề', 'ế', 'ệ', 'ể', 'ễ'],\n i: ['ì', 'í', 'ị', 'ỉ', 'ĩ'],\n o: ['ò', 'ó', 'ọ', 'ỏ', 'õ', 'ô', 'ồ', 'ố', 'ộ', 'ổ', 'ỗ', 'ơ', 'ờ', 'ớ', 'ợ', 'ở', 'ỡ'],\n u: ['ù', 'ú', 'ụ', 'ủ', 'ũ', 'ư', 'ừ', 'ứ', 'ự', 'ử', 'ữ'],\n y: ['ỳ', 'ý', 'ỵ', 'ỷ', 'ỹ'],\n d: ['đ'],\n};\n\nconst upperCharMap: Record<string, string[]> = Object.entries(charMap).reduce(\n (map, [key, value]) => {\n map[key.toUpperCase()] = value.map(char => char.toUpperCase());\n return map;\n },\n {} as Record<string, string[]>,\n);\n\nconst combinedMap = { ...charMap, ...upperCharMap };\n\n// Pre-compute replacement map and search regex for better performance\n// This avoids rebuilding regexes and maps on every function call\nconst replacementMap = new Map<string, string>();\nconst charsToMatch = new Set<string>();\n\nObject.entries(combinedMap).forEach(([baseChar, variations]) => {\n // The replacement pattern is the same for the base char and all its variations\n // Example: 'a', 'à', 'á'... all map to '(a|à|á...)'\n const replacement = `(${[baseChar, ...variations].join('|')})`;\n\n [baseChar, ...variations].forEach((char) => {\n replacementMap.set(char, replacement);\n charsToMatch.add(char);\n });\n});\n\n// Construct a single regex that matches any character in our map\nconst patternString = [...charsToMatch].join('');\n// We use a character class regex: [abc...]\n// eslint-disable-next-line regexp/no-empty-character-class -- regex is built dynamically from precomputed charMap\nconst searchRegex = new RegExp(`[${patternString}]`, 'g');\n\nconst RE_ESCAPE_REGEXP = /[.*+?^${}()|[\\]\\\\]/g;\n\n/**\n * Escapes special characters in a string for use in a regular expression.\n * This function escapes characters that have special meaning in regex (e.g., ., *, +, ?, etc.)\n * so they are treated as literal characters.\n *\n * @param str - The string to escape.\n * @returns The escaped string safe for use in a RegExp.\n */\nexport function escapeRegExp(str: string): string {\n return str.replace(RE_ESCAPE_REGEXP, '\\\\$&');\n}\n\n/**\n * Convert a string to a regex pattern that matches the string and its accented variations.\n * This function normalizes the input string and creates a regex pattern that can match\n * both the original characters and their accented equivalents.\n *\n * Optimization: Uses pre-computed regex and map to perform replacement in a single pass (O(N)),\n * instead of iterating through all character groups (O(K*N)).\n * Removed unnecessary NFD normalization which improves performance and fixes\n * matching against NFC target strings.\n *\n * @param str - The string to convert to a regex pattern.\n * @returns The regex pattern as a string that matches the original string and its accented variations.\n */\nexport function regexSearchMapper(str: string) {\n str = escapeRegExp(str);\n return str.replace(searchRegex, match => replacementMap.get(match) || match);\n}\n\nconst RE_DIACRITIC = /\\p{Diacritic}/gu;\n\n/**\n * Remove accents from a string.\n * This function normalizes the string using NFD normalization and removes all diacritical marks.\n *\n * @param str - The string to remove accents from.\n * @returns The string without any accents or diacritical marks.\n */\nexport function removeAccent(str: string) {\n return str.normalize('NFD').replace(RE_DIACRITIC, '');\n}\n\n/**\n * Remove duplicates from an array based on a key function.\n * This function can remove duplicates either by comparing values directly (when no keyFn is provided)\n * or by using a custom key function to determine uniqueness.\n *\n * @param arr - The array to remove duplicates from.\n * @param keyFn - Optional function that returns a unique key for each item in the array.\n * @returns A new array with duplicates removed, maintaining the original order.\n */\nexport function uniqueArray<T>(\n arr: T[],\n keyFn?: (item: T) => string | number,\n): T[] {\n if (!keyFn) {\n return [...new Set(arr)];\n }\n\n const seen = new Set<string | number>();\n const result: T[] = [];\n\n for (const item of arr) {\n const key = keyFn(item);\n if (!seen.has(key)) {\n seen.add(key);\n result.push(item);\n }\n }\n\n return result;\n}\n\n/**\n * Map environment variables to boolean flags indicating the current environment.\n * This function takes NODE_ENV and NODE_ENV_MODE variables and returns flags\n * indicating whether the current environment is development, staging, or production.\n *\n * @param env - The environment variables object containing NODE_ENV and NODE_ENV_MODE.\n * @returns An object containing boolean flags for the environment (IS_DEV, IS_STAG, IS_PROD).\n * @throws {Error} When NODE_ENV is production but NODE_ENV_MODE is development.\n */\nexport function mapEnvironment(env: I_NodeEnvInput): I_EnvFlags {\n const { NODE_ENV = E_Environment.DEVELOPMENT, NODE_ENV_MODE = E_Environment.DEVELOPMENT } = env;\n\n const IS_DEV = NODE_ENV === E_Environment.DEVELOPMENT && NODE_ENV_MODE === E_Environment.DEVELOPMENT;\n const IS_STAG = NODE_ENV === E_Environment.PRODUCTION && NODE_ENV_MODE === E_Environment.STAGING;\n const IS_PROD = NODE_ENV === E_Environment.PRODUCTION && NODE_ENV_MODE === E_Environment.PRODUCTION;\n\n if (NODE_ENV === E_Environment.PRODUCTION && NODE_ENV_MODE === E_Environment.DEVELOPMENT) {\n throw new Error('NODE_ENV_MODE must be set to staging or production in production environment');\n }\n\n return { IS_DEV, IS_STAG, IS_PROD };\n}\n\n/**\n * Checks if value is object-like (e.g., objects, arrays, etc.), not null.\n * Re-exported from util for general use across the codebase.\n *\n * @param value - The value to check.\n * @returns True if the value is an object and not null.\n */\nexport function isObject(value: unknown): value is object {\n return value != null && typeof value === 'object';\n}\n"],"mappings":";;AAIA,IAAM,IAAoC;CACtC,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CACxF,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CAC1D,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAI;CAC5B,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CACxF,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAI;CAC1D,GAAG;EAAC;EAAK;EAAK;EAAK;EAAK;EAAI;CAC5B,GAAG,CAAC,IAAI;CACX,EAEK,IAAyC,OAAO,QAAQ,EAAQ,CAAC,QAClE,GAAK,CAAC,GAAK,QACR,EAAI,EAAI,aAAa,IAAI,EAAM,KAAI,MAAQ,EAAK,aAAa,CAAC,EACvD,IAEX,EAAE,CACL,EAEK,IAAc;CAAE,GAAG;CAAS,GAAG;CAAc,EAI7C,oBAAiB,IAAI,KAAqB,EAC1C,oBAAe,IAAI,KAAa;AAEtC,OAAO,QAAQ,EAAY,CAAC,SAAS,CAAC,GAAU,OAAgB;CAG5D,IAAM,IAAc,IAAI,CAAC,GAAU,GAAG,EAAW,CAAC,KAAK,IAAI,CAAC;AAE5D,EAAC,GAAU,GAAG,EAAW,CAAC,SAAS,MAAS;AAExC,EADA,EAAe,IAAI,GAAM,EAAY,EACrC,EAAa,IAAI,EAAK;GACxB;EACJ;AAGF,IAAM,IAAgB,CAAC,GAAG,EAAa,CAAC,KAAK,GAAG,EAG1C,IAAkB,OAAO,IAAI,EAAc,IAAI,IAAI,EAEnD,IAAmB;AAUzB,SAAgB,EAAa,GAAqB;AAC9C,QAAO,EAAI,QAAQ,GAAkB,OAAO;;AAgBhD,SAAgB,EAAkB,GAAa;AAE3C,QADA,IAAM,EAAa,EAAI,EAChB,EAAI,QAAQ,IAAa,MAAS,EAAe,IAAI,EAAM,IAAI,EAAM;;AAGhF,IAAM,IAAe;AASrB,SAAgB,EAAa,GAAa;AACtC,QAAO,EAAI,UAAU,MAAM,CAAC,QAAQ,GAAc,GAAG;;AAYzD,SAAgB,EACZ,GACA,GACG;AACH,KAAI,CAAC,EACD,QAAO,CAAC,GAAG,IAAI,IAAI,EAAI,CAAC;CAG5B,IAAM,oBAAO,IAAI,KAAsB,EACjC,IAAc,EAAE;AAEtB,MAAK,IAAM,KAAQ,GAAK;EACpB,IAAM,IAAM,EAAM,EAAK;AACvB,EAAK,EAAK,IAAI,EAAI,KACd,EAAK,IAAI,EAAI,EACb,EAAO,KAAK,EAAK;;AAIzB,QAAO;;AAYX,SAAgB,EAAe,GAAiC;CAC5D,IAAM,EAAE,cAAW,EAAc,aAAa,mBAAgB,EAAc,gBAAgB,GAEtF,IAAS,MAAa,EAAc,eAAe,MAAkB,EAAc,aACnF,IAAU,MAAa,EAAc,cAAc,MAAkB,EAAc,SACnF,IAAU,MAAa,EAAc,cAAc,MAAkB,EAAc;AAEzF,KAAI,MAAa,EAAc,cAAc,MAAkB,EAAc,YACzE,OAAU,MAAM,+EAA+E;AAGnG,QAAO;EAAE;EAAQ;EAAS;EAAS;;AAUvC,SAAgB,EAAS,GAAiC;AACtD,QAAwB,OAAO,KAAU,cAAlC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { escapeRegExp as e,
|
|
2
|
-
export { e as escapeRegExp, t as
|
|
1
|
+
import { escapeRegExp as e, isObject as t, mapEnvironment as n, regexSearchMapper as r, removeAccent as i, uniqueArray as a } from "./common.util.js";
|
|
2
|
+
export { e as escapeRegExp, t as isObject, n as mapEnvironment, r as regexSearchMapper, i as removeAccent, a as uniqueArray };
|
package/dist/util/index.d.ts
CHANGED
package/dist/util/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { escapeRegExp as e,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { escapeRegExp as e, isObject as t, mapEnvironment as n, regexSearchMapper as r, removeAccent as i, uniqueArray as a } from "./common/common.util.js";
|
|
2
|
+
import { baseCatchError as o } from "./log/log.util.js";
|
|
3
|
+
import { deepClone as s, deepMerge as c, getNestedValue as l, isJSON as u, normalizeMongoFilter as d, setNestedValue as f } from "./object/object.util.js";
|
|
4
|
+
import { serializer as p } from "./serializer/serializer.util.js";
|
|
5
|
+
import { generateRandomPassword as m, generateRandomString as h, generateShortId as g, generateSlug as _, getFileName as v, substringBetween as y } from "./string/string.util.js";
|
|
6
|
+
import { validate as b } from "./validate/validate.util.js";
|
|
7
|
+
export { o as baseCatchError, s as deepClone, c as deepMerge, e as escapeRegExp, m as generateRandomPassword, h as generateRandomString, g as generateShortId, _ as generateSlug, v as getFileName, l as getNestedValue, u as isJSON, t as isObject, n as mapEnvironment, d as normalizeMongoFilter, r as regexSearchMapper, i as removeAccent, p as serializer, f as setNestedValue, y as substringBetween, a as uniqueArray, b as validate };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { I_Return } from '../../typescript/index.js';
|
|
2
|
+
import { I_CatchErrorOptions } from './log.type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Core error-catching implementation shared between Node and React environments.
|
|
5
|
+
* Normalizes the error input, optionally logs via the provided logger, invokes
|
|
6
|
+
* an optional callback, and returns either the caller-supplied fallback value or
|
|
7
|
+
* a standardized `I_Return` failure object.
|
|
8
|
+
*
|
|
9
|
+
* @param errorInput - The thrown value to handle.
|
|
10
|
+
* @param options - Behavior options (shouldLog, returnValue, callback).
|
|
11
|
+
* @param logError - Environment-specific function used to log the error message.
|
|
12
|
+
* @returns The fallback value `T` when `returnValue` is provided, otherwise `I_Return<T>`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function baseCatchError<T = unknown>(errorInput: unknown, options: I_CatchErrorOptions & {
|
|
15
|
+
returnValue: T;
|
|
16
|
+
}, logError: (message: string) => void): T;
|
|
17
|
+
export declare function baseCatchError<T = unknown>(errorInput: unknown, options: I_CatchErrorOptions | undefined, logError: (message: string) => void): I_Return<T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RESPONSE_STATUS as e } from "../../constant/response-status.js";
|
|
2
|
+
//#region src/util/log/log.util.ts
|
|
3
|
+
function t(t, n, r) {
|
|
4
|
+
let { shouldLog: i = !0, returnValue: a, callback: o } = n ?? {}, s = t instanceof Error ? t : Error(typeof t == "string" ? t : "Unknown error");
|
|
5
|
+
return i && r(s.message), o && typeof o == "function" && o(s), a === void 0 ? {
|
|
6
|
+
success: !1,
|
|
7
|
+
message: s.message,
|
|
8
|
+
code: e.INTERNAL_SERVER_ERROR.CODE
|
|
9
|
+
} : a;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as baseCatchError };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=log.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.util.js","names":[],"sources":["../../../src/util/log/log.util.ts"],"sourcesContent":["import type { I_Return } from '#typescript/index.js';\n\nimport { RESPONSE_STATUS } from '#constant/index.js';\n\nimport type { I_CatchErrorOptions } from './log.type.js';\n\n/**\n * Core error-catching implementation shared between Node and React environments.\n * Normalizes the error input, optionally logs via the provided logger, invokes\n * an optional callback, and returns either the caller-supplied fallback value or\n * a standardized `I_Return` failure object.\n *\n * @param errorInput - The thrown value to handle.\n * @param options - Behavior options (shouldLog, returnValue, callback).\n * @param logError - Environment-specific function used to log the error message.\n * @returns The fallback value `T` when `returnValue` is provided, otherwise `I_Return<T>`.\n */\nexport function baseCatchError<T = unknown>(\n errorInput: unknown,\n options: I_CatchErrorOptions & { returnValue: T },\n logError: (message: string) => void,\n): T;\nexport function baseCatchError<T = unknown>(\n errorInput: unknown,\n options: I_CatchErrorOptions | undefined,\n logError: (message: string) => void,\n): I_Return<T>;\nexport function baseCatchError<T = unknown>(\n errorInput: unknown,\n options: I_CatchErrorOptions | undefined,\n logError: (message: string) => void,\n): I_Return<T> | T {\n const { shouldLog = true, returnValue, callback } = options ?? {};\n\n const error = errorInput instanceof Error\n ? errorInput\n : new Error(typeof errorInput === 'string' ? errorInput : 'Unknown error');\n\n if (shouldLog) {\n logError(error.message);\n }\n\n if (callback && typeof callback === 'function') {\n callback(error);\n }\n\n if (returnValue !== undefined) {\n return returnValue as T;\n }\n\n return {\n success: false,\n message: error.message,\n code: RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE,\n };\n}\n"],"mappings":";;AA2BA,SAAgB,EACZ,GACA,GACA,GACe;CACf,IAAM,EAAE,eAAY,IAAM,gBAAa,gBAAa,KAAW,EAAE,EAE3D,IAAQ,aAAsB,QAC9B,IACI,MAAM,OAAO,KAAe,WAAW,IAAa,gBAAgB;AAc9E,QAZI,KACA,EAAS,EAAM,QAAQ,EAGvB,KAAY,OAAO,KAAa,cAChC,EAAS,EAAM,EAGf,MAAgB,KAAA,IAIb;EACH,SAAS;EACT,SAAS,EAAM;EACf,MAAM,EAAgB,sBAAsB;EAC/C,GAPU"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberskill/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -16,145 +16,190 @@
|
|
|
16
16
|
"sideEffects": [
|
|
17
17
|
"./dist/style.css"
|
|
18
18
|
],
|
|
19
|
+
"imports": {
|
|
20
|
+
"#public/*": "./public/*",
|
|
21
|
+
"#config/*": "./src/config/*",
|
|
22
|
+
"#constant/*": "./src/constant/*",
|
|
23
|
+
"#node/*": "./src/node/*",
|
|
24
|
+
"#react/*": "./src/react/*",
|
|
25
|
+
"#style/*": "./src/style/*",
|
|
26
|
+
"#typescript/*": "./src/typescript/*",
|
|
27
|
+
"#util/*": "./src/util/*"
|
|
28
|
+
},
|
|
19
29
|
"exports": {
|
|
20
30
|
"./config": {
|
|
21
31
|
"types": "./dist/config/index.d.ts",
|
|
22
|
-
"import": "./dist/config/index.js"
|
|
32
|
+
"import": "./dist/config/index.js",
|
|
33
|
+
"default": "./dist/config/index.js"
|
|
23
34
|
},
|
|
24
35
|
"./config/commitlint": {
|
|
25
36
|
"types": "./dist/config/commitlint/index.d.ts",
|
|
26
|
-
"import": "./dist/config/commitlint/index.js"
|
|
37
|
+
"import": "./dist/config/commitlint/index.js",
|
|
38
|
+
"default": "./dist/config/commitlint/index.js"
|
|
27
39
|
},
|
|
28
40
|
"./config/env": {
|
|
29
41
|
"types": "./dist/config/env/index.d.ts",
|
|
30
|
-
"import": "./dist/config/env/index.js"
|
|
42
|
+
"import": "./dist/config/env/index.js",
|
|
43
|
+
"default": "./dist/config/env/index.js"
|
|
31
44
|
},
|
|
32
45
|
"./config/eslint": {
|
|
33
46
|
"types": "./dist/config/eslint/index.d.ts",
|
|
34
|
-
"import": "./dist/config/eslint/index.js"
|
|
47
|
+
"import": "./dist/config/eslint/index.js",
|
|
48
|
+
"default": "./dist/config/eslint/index.js"
|
|
35
49
|
},
|
|
36
50
|
"./config/graphql-codegen": {
|
|
37
51
|
"types": "./dist/config/graphql-codegen/index.d.ts",
|
|
38
|
-
"import": "./dist/config/graphql-codegen/index.js"
|
|
52
|
+
"import": "./dist/config/graphql-codegen/index.js",
|
|
53
|
+
"default": "./dist/config/graphql-codegen/index.js"
|
|
39
54
|
},
|
|
40
55
|
"./config/lint-staged": {
|
|
41
56
|
"types": "./dist/config/lint-staged/index.d.ts",
|
|
42
|
-
"import": "./dist/config/lint-staged/index.js"
|
|
57
|
+
"import": "./dist/config/lint-staged/index.js",
|
|
58
|
+
"default": "./dist/config/lint-staged/index.js"
|
|
43
59
|
},
|
|
44
60
|
"./config/vitest": {
|
|
45
61
|
"types": "./dist/config/vitest/index.d.ts",
|
|
46
|
-
"import": "./dist/config/vitest/index.js"
|
|
62
|
+
"import": "./dist/config/vitest/index.js",
|
|
63
|
+
"default": "./dist/config/vitest/index.js"
|
|
47
64
|
},
|
|
48
65
|
"./config/storybook": {
|
|
49
66
|
"types": "./dist/config/storybook/index.d.ts",
|
|
50
|
-
"import": "./dist/config/storybook/index.js"
|
|
67
|
+
"import": "./dist/config/storybook/index.js",
|
|
68
|
+
"default": "./dist/config/storybook/index.js"
|
|
51
69
|
},
|
|
52
70
|
"./constant": {
|
|
53
71
|
"types": "./dist/constant/index.d.ts",
|
|
54
|
-
"import": "./dist/constant/index.js"
|
|
72
|
+
"import": "./dist/constant/index.js",
|
|
73
|
+
"default": "./dist/constant/index.js"
|
|
55
74
|
},
|
|
56
75
|
"./node/apollo-server": {
|
|
57
76
|
"types": "./dist/node/apollo-server/index.d.ts",
|
|
58
|
-
"import": "./dist/node/apollo-server/index.js"
|
|
77
|
+
"import": "./dist/node/apollo-server/index.js",
|
|
78
|
+
"default": "./dist/node/apollo-server/index.js"
|
|
59
79
|
},
|
|
60
80
|
"./node/cli": {
|
|
61
81
|
"types": "./dist/node/cli/index.d.ts",
|
|
62
|
-
"import": "./dist/node/cli/index.js"
|
|
82
|
+
"import": "./dist/node/cli/index.js",
|
|
83
|
+
"default": "./dist/node/cli/index.js"
|
|
63
84
|
},
|
|
64
85
|
"./node/command": {
|
|
65
86
|
"types": "./dist/node/command/index.d.ts",
|
|
66
|
-
"import": "./dist/node/command/index.js"
|
|
87
|
+
"import": "./dist/node/command/index.js",
|
|
88
|
+
"default": "./dist/node/command/index.js"
|
|
67
89
|
},
|
|
68
90
|
"./node/express": {
|
|
69
91
|
"types": "./dist/node/express/index.d.ts",
|
|
70
|
-
"import": "./dist/node/express/index.js"
|
|
92
|
+
"import": "./dist/node/express/index.js",
|
|
93
|
+
"default": "./dist/node/express/index.js"
|
|
71
94
|
},
|
|
72
95
|
"./node/fs": {
|
|
73
96
|
"types": "./dist/node/fs/index.d.ts",
|
|
74
|
-
"import": "./dist/node/fs/index.js"
|
|
97
|
+
"import": "./dist/node/fs/index.js",
|
|
98
|
+
"default": "./dist/node/fs/index.js"
|
|
75
99
|
},
|
|
76
100
|
"./node/log": {
|
|
77
101
|
"types": "./dist/node/log/index.d.ts",
|
|
78
|
-
"import": "./dist/node/log/index.js"
|
|
102
|
+
"import": "./dist/node/log/index.js",
|
|
103
|
+
"default": "./dist/node/log/index.js"
|
|
79
104
|
},
|
|
80
105
|
"./node/mongo": {
|
|
81
106
|
"types": "./dist/node/mongo/index.d.ts",
|
|
82
|
-
"import": "./dist/node/mongo/index.js"
|
|
107
|
+
"import": "./dist/node/mongo/index.js",
|
|
108
|
+
"default": "./dist/node/mongo/index.js"
|
|
83
109
|
},
|
|
84
110
|
"./node/package": {
|
|
85
111
|
"types": "./dist/node/package/index.d.ts",
|
|
86
|
-
"import": "./dist/node/package/index.js"
|
|
112
|
+
"import": "./dist/node/package/index.js",
|
|
113
|
+
"default": "./dist/node/package/index.js"
|
|
87
114
|
},
|
|
88
115
|
"./node/path": {
|
|
89
116
|
"types": "./dist/node/path/index.d.ts",
|
|
90
|
-
"import": "./dist/node/path/index.js"
|
|
117
|
+
"import": "./dist/node/path/index.js",
|
|
118
|
+
"default": "./dist/node/path/index.js"
|
|
91
119
|
},
|
|
92
120
|
"./node/storage": {
|
|
93
121
|
"types": "./dist/node/storage/index.d.ts",
|
|
94
|
-
"import": "./dist/node/storage/index.js"
|
|
122
|
+
"import": "./dist/node/storage/index.js",
|
|
123
|
+
"default": "./dist/node/storage/index.js"
|
|
95
124
|
},
|
|
96
125
|
"./node/upload": {
|
|
97
126
|
"types": "./dist/node/upload/index.d.ts",
|
|
98
|
-
"import": "./dist/node/upload/index.js"
|
|
127
|
+
"import": "./dist/node/upload/index.js",
|
|
128
|
+
"default": "./dist/node/upload/index.js"
|
|
99
129
|
},
|
|
100
130
|
"./node/ws": {
|
|
101
131
|
"types": "./dist/node/ws/index.d.ts",
|
|
102
|
-
"import": "./dist/node/ws/index.js"
|
|
132
|
+
"import": "./dist/node/ws/index.js",
|
|
133
|
+
"default": "./dist/node/ws/index.js"
|
|
103
134
|
},
|
|
104
135
|
"./react/apollo-client": {
|
|
105
136
|
"types": "./dist/react/apollo-client/index.d.ts",
|
|
106
|
-
"import": "./dist/react/apollo-client/index.js"
|
|
137
|
+
"import": "./dist/react/apollo-client/index.js",
|
|
138
|
+
"default": "./dist/react/apollo-client/index.js"
|
|
107
139
|
},
|
|
108
140
|
"./react/apollo-client-nextjs": {
|
|
109
141
|
"types": "./dist/react/apollo-client-nextjs/index.d.ts",
|
|
110
|
-
"import": "./dist/react/apollo-client-nextjs/index.js"
|
|
142
|
+
"import": "./dist/react/apollo-client-nextjs/index.js",
|
|
143
|
+
"default": "./dist/react/apollo-client-nextjs/index.js"
|
|
111
144
|
},
|
|
112
145
|
"./react/apollo-client-nextjs/rsc": {
|
|
113
146
|
"types": "./dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts",
|
|
114
|
-
"import": "./dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js"
|
|
147
|
+
"import": "./dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js",
|
|
148
|
+
"default": "./dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js"
|
|
115
149
|
},
|
|
116
150
|
"./react/apollo-error": {
|
|
117
151
|
"types": "./dist/react/apollo-error/index.d.ts",
|
|
118
|
-
"import": "./dist/react/apollo-error/index.js"
|
|
152
|
+
"import": "./dist/react/apollo-error/index.js",
|
|
153
|
+
"default": "./dist/react/apollo-error/index.js"
|
|
119
154
|
},
|
|
120
155
|
"./react/i18next": {
|
|
121
156
|
"types": "./dist/react/i18next/index.d.ts",
|
|
122
|
-
"import": "./dist/react/i18next/index.js"
|
|
157
|
+
"import": "./dist/react/i18next/index.js",
|
|
158
|
+
"default": "./dist/react/i18next/index.js"
|
|
123
159
|
},
|
|
124
160
|
"./react/loading": {
|
|
125
161
|
"types": "./dist/react/loading/index.d.ts",
|
|
126
|
-
"import": "./dist/react/loading/index.js"
|
|
162
|
+
"import": "./dist/react/loading/index.js",
|
|
163
|
+
"default": "./dist/react/loading/index.js"
|
|
127
164
|
},
|
|
128
165
|
"./react/log": {
|
|
129
166
|
"types": "./dist/react/log/index.d.ts",
|
|
130
|
-
"import": "./dist/react/log/index.js"
|
|
167
|
+
"import": "./dist/react/log/index.js",
|
|
168
|
+
"default": "./dist/react/log/index.js"
|
|
131
169
|
},
|
|
132
170
|
"./react/next-intl": {
|
|
133
171
|
"types": "./dist/react/next-intl/index.d.ts",
|
|
134
|
-
"import": "./dist/react/next-intl/index.js"
|
|
172
|
+
"import": "./dist/react/next-intl/index.js",
|
|
173
|
+
"default": "./dist/react/next-intl/index.js"
|
|
135
174
|
},
|
|
136
175
|
"./react/storage": {
|
|
137
176
|
"types": "./dist/react/storage/index.d.ts",
|
|
138
|
-
"import": "./dist/react/storage/index.js"
|
|
177
|
+
"import": "./dist/react/storage/index.js",
|
|
178
|
+
"default": "./dist/react/storage/index.js"
|
|
139
179
|
},
|
|
140
180
|
"./react/toast": {
|
|
141
181
|
"types": "./dist/react/toast/index.d.ts",
|
|
142
|
-
"import": "./dist/react/toast/index.js"
|
|
182
|
+
"import": "./dist/react/toast/index.js",
|
|
183
|
+
"default": "./dist/react/toast/index.js"
|
|
143
184
|
},
|
|
144
185
|
"./react/userback": {
|
|
145
186
|
"types": "./dist/react/userback/index.d.ts",
|
|
146
|
-
"import": "./dist/react/userback/index.js"
|
|
187
|
+
"import": "./dist/react/userback/index.js",
|
|
188
|
+
"default": "./dist/react/userback/index.js"
|
|
147
189
|
},
|
|
148
190
|
"./typescript": {
|
|
149
191
|
"types": "./dist/typescript/index.d.ts",
|
|
150
|
-
"import": "./dist/typescript/index.js"
|
|
192
|
+
"import": "./dist/typescript/index.js",
|
|
193
|
+
"default": "./dist/typescript/index.js"
|
|
151
194
|
},
|
|
152
195
|
"./util": {
|
|
153
196
|
"types": "./dist/util/index.d.ts",
|
|
154
|
-
"import": "./dist/util/index.js"
|
|
197
|
+
"import": "./dist/util/index.js",
|
|
198
|
+
"default": "./dist/util/index.js"
|
|
155
199
|
},
|
|
156
200
|
"./style.css": {
|
|
157
|
-
"import": "./dist/style.css"
|
|
201
|
+
"import": "./dist/style.css",
|
|
202
|
+
"default": "./dist/style.css"
|
|
158
203
|
}
|
|
159
204
|
},
|
|
160
205
|
"bin": {
|
|
@@ -226,7 +271,7 @@
|
|
|
226
271
|
"localforage": "1.10.0",
|
|
227
272
|
"migrate-mongo": "14.0.7",
|
|
228
273
|
"mongodb": "7.1.0",
|
|
229
|
-
"mongoose": "9.3.
|
|
274
|
+
"mongoose": "9.3.1",
|
|
230
275
|
"mongoose-aggregate-paginate-v2": "1.1.4",
|
|
231
276
|
"mongoose-paginate-v2": "1.9.1",
|
|
232
277
|
"next-intl": "4.8.3",
|
|
@@ -236,7 +281,6 @@
|
|
|
236
281
|
"react-hot-toast": "2.6.0",
|
|
237
282
|
"react-i18next": "16.5.8",
|
|
238
283
|
"rxjs": "7.8.2",
|
|
239
|
-
"vite": "8.0.0",
|
|
240
284
|
"ws": "8.19.0",
|
|
241
285
|
"yargs": "18.0.0"
|
|
242
286
|
},
|
|
@@ -293,8 +337,7 @@
|
|
|
293
337
|
},
|
|
294
338
|
"pnpm": {
|
|
295
339
|
"overrides": {
|
|
296
|
-
"minimatch": ">=10.2.3"
|
|
297
|
-
"minimatch@__comment": "Pinned to fix transitive vulnerability CVE in older minimatch versions used by some deps"
|
|
340
|
+
"minimatch": ">=10.2.3"
|
|
298
341
|
}
|
|
299
342
|
}
|
|
300
343
|
}
|