@deboxsoft/module-core
Advanced tools
Comparing version 3.0.0-beta.6 to 3.0.0-beta.7
import nconf from 'nconf'; | ||
import { z as ConfigService } from './ConfigService-CApVwFCr.js'; | ||
import { z as ConfigService } from './ConfigService-CqJMT-s8.js'; | ||
import 'zod'; | ||
@@ -10,3 +10,18 @@ | ||
} | ||
declare const createConfig: ({ keyHome, fileKeys, defaultConfig }: ConfigOptions) => typeof nconf; | ||
/** | ||
* Creates a configuration object based on the provided options. | ||
* | ||
* @param {ConfigOptions} options - The options for creating the configuration. | ||
* @param {string} [options.keyHome="app_home"] - The key for the home directory. | ||
* @param {string[]} [options.fileKeys=["app"]] - The keys for the configuration files. | ||
* @param {Record<string, any>} [options.defaultConfig={}] - The default configuration. | ||
* @return {nconf.Provider} The configuration object. | ||
*/ | ||
declare const createConfig: ({ keyHome, fileKeys, defaultConfig }: ConfigOptions) => nconf.Provider; | ||
/** | ||
* Creates a configuration service based on the provided options. | ||
* | ||
* @param {ConfigOptions & { nconf?: typeof nconf }} opts - The options for creating the configuration service. | ||
* @return {ConfigService} The created configuration service. | ||
*/ | ||
declare const createConfigService: (opts?: ConfigOptions & { | ||
@@ -13,0 +28,0 @@ nconf?: typeof nconf; |
@@ -1,3 +0,3 @@ | ||
import { A as AppConfig } from './ConfigService-CApVwFCr.js'; | ||
export { k as AlternativeType, x as CONFIG_KEY, y as Callback, w as Config, z as ConfigService, s as CreateResponse, C as CreateResult, q as DataResponse, D as DataResult, o as Filter, m as FilterCondition, F as FilterOperators, I as ID, p as IdParams, J as Join, N as NestedPaths, e as PageCursorInfo, b as PageCursorParams, i as PageCursorParamsOutput, f as PageDefaultInfo, c as PageDefaultParams, j as PageDefaultParamsOutput, d as PageInfo, a as PageParams, h as Pagination, g as PaginationOptions, P as PaginationType, l as PropertyType, R as RegExpOrString, v as RemoveResponse, r as RemoveResult, n as RootFilterOperators, S as ServerApiConfig, u as UpdateResponse, U as UpdateResult, E as getConfig, B as getConfigService, t as transformDefaultPageInfo } from './ConfigService-CApVwFCr.js'; | ||
import { A as AppConfig } from './ConfigService-CqJMT-s8.js'; | ||
export { k as AlternativeType, x as CONFIG_KEY, y as Callback, w as Config, z as ConfigService, s as CreateResponse, C as CreateResult, q as DataResponse, D as DataResult, o as Filter, m as FilterCondition, F as FilterOperators, I as ID, p as IdParams, J as Join, N as NestedPaths, e as PageCursorInfo, b as PageCursorParams, i as PageCursorParamsOutput, f as PageDefaultInfo, c as PageDefaultParams, j as PageDefaultParamsOutput, d as PageInfo, a as PageParams, h as Pagination, g as PaginationOptions, P as PaginationType, l as PropertyType, R as RegExpOrString, v as RemoveResponse, r as RemoveResult, n as RootFilterOperators, S as ServerApiConfig, u as UpdateResponse, U as UpdateResult, E as getConfig, B as getConfigService, t as transformDefaultPageInfo } from './ConfigService-CqJMT-s8.js'; | ||
export { camelCase, capitalCase, constantCase, dotCase, kebabCase, noCase, pascalCase, pathCase, sentenceCase, snakeCase, trainCase } from 'change-case'; | ||
@@ -106,3 +106,17 @@ export { Base64 as base64 } from 'js-base64'; | ||
declare const LOGGER_KEY = "LOGGER"; | ||
/** | ||
* Retrieves the logger instance from the container if it exists, otherwise creates a new console logger. | ||
* | ||
* @return {Logger} The logger instance. | ||
*/ | ||
declare const getLogger: () => Logger; | ||
/** | ||
* Creates a console logger instance and stores it in the container. | ||
* | ||
* If a logger instance already exists in the container and the `refresh` parameter is `false`, | ||
* the existing logger instance is returned. Otherwise, a new logger instance is created. | ||
* | ||
* @param {boolean} refresh - Whether to refresh the logger instance in the container. Defaults to `false`. | ||
* @return {Logger} The created or retrieved logger instance. | ||
*/ | ||
declare const createLoggerConsole: (refresh?: boolean) => Logger; | ||
@@ -189,2 +203,8 @@ | ||
/** | ||
* Removes null and undefined values from an array. | ||
* | ||
* @param {Array} arr - The array to compact. | ||
* @return {Array} A new array with null and undefined values removed. | ||
*/ | ||
declare function compact<T extends any>(arr: (T | null | undefined)[]): T[]; | ||
@@ -200,2 +220,11 @@ | ||
}; | ||
/** | ||
* Returns a dayjs object with the specified timezone. | ||
* | ||
* @param {string | number | dayjs.Dayjs | Date} d - The date to be converted. | ||
* @param {Options} options - Options object containing format and timezone. | ||
* @param {string} options.format - The format of the date. | ||
* @param {string} options.timezone - The timezone to be used. Defaults to "Asia/Jakarta". | ||
* @return {dayjs.Dayjs} A dayjs object with the specified timezone. | ||
*/ | ||
declare function dayTimeZone(d?: string | number | dayjs.Dayjs | Date, { format, timezone }?: Options): dayjs.Dayjs; | ||
@@ -230,2 +259,8 @@ /** | ||
/** | ||
* Checks if a value is null or undefined. | ||
* | ||
* @param {any} value - the value to check | ||
* @return {boolean} true if the value is null or undefined, false otherwise | ||
*/ | ||
declare function isNil<T>(value: any): value is null | undefined; | ||
@@ -238,2 +273,8 @@ | ||
declare function isObject(val: any): boolean; | ||
/** | ||
* Checks if the given value is a plain object. | ||
* | ||
* @param {any} o - The value to be checked. | ||
* @return {boolean} Returns true if the value is a plain object, false otherwise. | ||
*/ | ||
declare function isPlainObject(o: any): boolean; | ||
@@ -253,5 +294,23 @@ | ||
declare function isString(value: any): any; | ||
/** | ||
* Checks if a string is blank, containing only whitespace characters. | ||
* | ||
* @param {any} str - the input string to check | ||
* @return {boolean} true if the string is blank, false otherwise | ||
*/ | ||
declare function isStringBlank(str: any): boolean; | ||
/** | ||
* Checks if the given value is a non-blank string. | ||
* | ||
* @param {any} value - The value to check. | ||
* @return {boolean} Returns true if the value is a non-blank string, otherwise false. | ||
*/ | ||
declare const isStringAndNotBlank: (value: any) => boolean; | ||
/** | ||
* Checks if the given value is undefined. | ||
* | ||
* @param {any} value - the value to be checked | ||
* @return {value is undefined} true if the value is undefined, false otherwise | ||
*/ | ||
declare function isUndefined<T>(value: any): value is undefined; | ||
@@ -265,2 +324,6 @@ | ||
/** | ||
* Maps the values of an object to a new object with the same keys. | ||
* | ||
*/ | ||
declare function mapValues<T extends object, MapperResult, Result = { | ||
@@ -270,6 +333,28 @@ [K in keyof T]: MapperResult; | ||
/** | ||
* Checks if two objects are equal. | ||
* | ||
* @param {any} x - The first object to compare. | ||
* @param {any} y - The second object to compare. | ||
* @return {boolean} True if the objects are equal, false otherwise. | ||
*/ | ||
declare function objectEquals(x: any, y: any): boolean; | ||
/** | ||
* Omits specified properties from an object. | ||
* | ||
* @param {object} obj - The object to omit properties from. | ||
* @param {string|string[]|function} props - The properties to omit. Can be a string, array of strings, or a function. | ||
* @param {function} [fn] - An optional function to filter properties. | ||
* @return {object} A new object with the specified properties omitted. | ||
*/ | ||
declare const omit: (obj: any, props: any, fn?: any) => any; | ||
/** | ||
* Returns a new object with all the key-value pairs from the input object that satisfy the predicate function. | ||
* | ||
* @param {T} object - The input object. | ||
* @param {(val: T[keyof T], key: keyof T) => boolean} predicate - The predicate function to determine which key-value pairs to include in the result. | ||
* @returns {Result} - The new object with the filtered key-value pairs. | ||
*/ | ||
declare function omitBy<T extends object, Result = Partial<{ | ||
@@ -308,3 +393,9 @@ [K in keyof T]: T[keyof T]; | ||
declare function urlJoin(...args: any[]): string; | ||
/** | ||
* Joins multiple URL components into a single URL string. | ||
* | ||
* @param {...string|string[]} args - URL components to join. Can be a single string, an array of strings, or multiple string arguments. | ||
* @return {string} The joined URL string. | ||
*/ | ||
declare function urlJoin(...args: (string | string[])[]): string; | ||
@@ -361,2 +452,8 @@ /** | ||
/** | ||
* Escapes special characters in a string to use in a regular expression. | ||
* | ||
* @param {string} input - The string to escape. | ||
* @return {string} The escaped string. | ||
*/ | ||
declare function escapeRegExp(input: any): any; | ||
@@ -368,3 +465,13 @@ | ||
constructor(chars?: string); | ||
/** | ||
* Returns the next letter combination based on the current state of the LetterIncrement instance. | ||
* | ||
* @return {string} The next letter combination as a string. | ||
*/ | ||
next(): string; | ||
/** | ||
* Increments the internal state of the LetterIncrement instance to generate the next letter combination. | ||
* | ||
* @return {void} No return value, modifies the internal state. | ||
*/ | ||
_increment(): void; | ||
@@ -434,3 +541,16 @@ [Symbol.iterator](): Generator<string, void, unknown>; | ||
}; | ||
/** | ||
* Checks if a given schema is of a specific Zod type. | ||
* | ||
* @param {object} schema - the schema to check | ||
* @param {keyof ZodTypes} typeName - the name of the Zod type to check against | ||
* @return {boolean} true if the schema is of the specified Zod type, false otherwise | ||
*/ | ||
declare function isZodType<TypeName extends keyof ZodTypes>(schema: object, typeName: TypeName): schema is ZodTypes[TypeName]; | ||
/** | ||
* Checks if the given schema is a Zod type. | ||
* | ||
* @param {object} schema - the schema to check | ||
* @return {boolean} true if the schema is a Zod type, false otherwise | ||
*/ | ||
declare function isAnyZodType(schema: object): schema is z.ZodType; | ||
@@ -437,0 +557,0 @@ |
@@ -94,11 +94,35 @@ import { Container } from './chunk-GPLVETAS.js'; | ||
const logger = { | ||
/** | ||
* Logs an error message at the 'fatal' level. | ||
* | ||
* @param {...any} args - The error message and any additional arguments to be logged. | ||
* @return {void} | ||
*/ | ||
fatal: (...args) => { | ||
console.error("fatal >>", ...args); | ||
}, | ||
/** | ||
* Logs an error message to the console. | ||
* | ||
* @param {...any} args - The error message and any additional arguments to be logged. | ||
* @return {void} | ||
*/ | ||
error: (...args) => { | ||
console.error(...args); | ||
}, | ||
/** | ||
* Logs an informational message. | ||
* | ||
* @param {...any} args - The message and any additional arguments to be logged. | ||
* @return {void} | ||
*/ | ||
info: (...args) => { | ||
console.log(...args); | ||
}, | ||
/** | ||
* Logs a trace message to the console. | ||
* | ||
* @param {...any} args - The message and any additional arguments to be logged. | ||
* @return {void} | ||
*/ | ||
trace: (...args) => { | ||
@@ -109,2 +133,8 @@ if (process.env.NODE_ENV !== "production") { | ||
}, | ||
/** | ||
* Logs a debug message to the console if the application is not running in production mode. | ||
* | ||
* @param {...any} args - The message and any additional arguments to be logged. | ||
* @return {void} | ||
*/ | ||
debug: (...args) => { | ||
@@ -115,2 +145,8 @@ if (process.env.NODE_ENV !== "production") { | ||
}, | ||
/** | ||
* Logs a warning message to the console. | ||
* | ||
* @param {...any} args - The warning message and any additional arguments to be logged. | ||
* @return {void} | ||
*/ | ||
warn: (...args) => { | ||
@@ -620,2 +656,7 @@ console.warn(...args); | ||
} | ||
/** | ||
* Returns the next letter combination based on the current state of the LetterIncrement instance. | ||
* | ||
* @return {string} The next letter combination as a string. | ||
*/ | ||
next() { | ||
@@ -629,2 +670,7 @@ const r = []; | ||
} | ||
/** | ||
* Increments the internal state of the LetterIncrement instance to generate the next letter combination. | ||
* | ||
* @return {void} No return value, modifies the internal state. | ||
*/ | ||
_increment() { | ||
@@ -631,0 +677,0 @@ for (let i = 0; i < this.nextId.length; i++) { |
{ | ||
"name": "@deboxsoft/module-core", | ||
"version": "3.0.0-beta.6", | ||
"version": "3.0.0-beta.7", | ||
"license": "SEE LICENSE IN LICENSE", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
Sorry, the diff of this file is too big to display
155311
4564