@deboxsoft/module-core
Advanced tools
Comparing version 2.6.15 to 2.6.16
@@ -433,14 +433,16 @@ import { z, ZodType } from 'zod'; | ||
interface AppConfig { | ||
baseUrl: string; | ||
port: number; | ||
resourcePath: string; | ||
declare type Config<C = Record<string, any>> = C; | ||
interface ServerApiConfig { | ||
host: string; | ||
port: string; | ||
apiPublicPath: string; | ||
apiSecurePath: string; | ||
wsPath: string; | ||
avatarPath: string; | ||
avatarUploadPath: string; | ||
wsPath?: string; | ||
secure?: boolean; | ||
} | ||
declare type Config = { | ||
interface AppConfig { | ||
host: string; | ||
port: number; | ||
} | ||
declare type ConfigService = { | ||
getAll: () => Record<string, any>; | ||
@@ -450,6 +452,5 @@ get<R = any>(key: string, defaultValue?: R): R; | ||
}; | ||
declare const CONFIG_KEY = "CONFIG"; | ||
declare const getConfig: () => Config; | ||
declare const getAppConfig: () => AppConfig | Config; | ||
declare const getConfigService: () => ConfigService; | ||
declare const getConfig: <C = unknown>(key: string) => C; | ||
@@ -631,2 +632,2 @@ interface LogFn { | ||
export { AlternativeType, AppConfig, CONFIG_KEY, Config, Container, CreateDataResponse, DataResponse, DateSchema, DbxError, DbxErrorOptions, Filter, FilterCondition, FilterOperators, ID, IdParams, IdSchema, Join, LOGGER_KEY, Logger, MakeSchemaResponse, ModuleConfig, NestedPaths, NotificationType, PageCursorInfo, PageCursorParams, PageCursorParamsOutput, PageDefaultInfo, PageDefaultParams, PageDefaultParamsOutput, PageInfo, PageParams, Pagination, PaginationOptions, PaginationType, PropertyType, RangeDate, RangeDateSchema, RegExpOrString, RemoveDataResponse, RootFilterOperators, TimeStampSchema, UpdateDataResponse, clamp, cloneDeep, createLoggerConsole, dayTimeZone, debounce, getAppConfig, getConfig, getLogger, getRangeDate, isEmpty, isObject, isPlainObject, isString, isStringAndNotBlank, isStringBlank, kindOf, makeSchemaResponse, omit, pickBy, pull, throttle, transformDefaultPageInfo }; | ||
export { AlternativeType, AppConfig, CONFIG_KEY, Config, ConfigService, Container, CreateDataResponse, DataResponse, DateSchema, DbxError, DbxErrorOptions, Filter, FilterCondition, FilterOperators, ID, IdParams, IdSchema, Join, LOGGER_KEY, Logger, MakeSchemaResponse, ModuleConfig, NestedPaths, NotificationType, PageCursorInfo, PageCursorParams, PageCursorParamsOutput, PageDefaultInfo, PageDefaultParams, PageDefaultParamsOutput, PageInfo, PageParams, Pagination, PaginationOptions, PaginationType, PropertyType, RangeDate, RangeDateSchema, RegExpOrString, RemoveDataResponse, RootFilterOperators, ServerApiConfig, TimeStampSchema, UpdateDataResponse, clamp, cloneDeep, createLoggerConsole, dayTimeZone, debounce, getConfig, getConfigService, getLogger, getRangeDate, isEmpty, isObject, isPlainObject, isString, isStringAndNotBlank, isStringBlank, kindOf, makeSchemaResponse, omit, pickBy, pull, throttle, transformDefaultPageInfo }; |
@@ -47,4 +47,4 @@ var __defProp = Object.defineProperty; | ||
debounce: () => debounce, | ||
getAppConfig: () => getAppConfig, | ||
getConfig: () => getConfig, | ||
getConfigService: () => getConfigService, | ||
getLogger: () => getLogger, | ||
@@ -256,23 +256,8 @@ getRangeDate: () => getRangeDate, | ||
// src/config/AppConfig.ts | ||
var AppConfigDefault = { | ||
baseUrl: "localhost", | ||
port: 4e3, | ||
resourcePath: "resources", | ||
apiPublicPath: "api", | ||
apiSecurePath: "apis", | ||
wsPath: "ws", | ||
avatarPath: "avatar", | ||
avatarUploadPath: "upload/avatar" | ||
}; | ||
// src/config/index.ts | ||
var CONFIG_KEY = "CONFIG"; | ||
var getConfig = () => Container.get(CONFIG_KEY); | ||
var getAppConfig = () => { | ||
const config = getConfig(); | ||
if (typeof config.get === "function") { | ||
return getConfig().get("app") || AppConfigDefault; | ||
} | ||
return config || AppConfigDefault; | ||
var getConfigService = () => Container.get(CONFIG_KEY); | ||
var getConfig = (key) => { | ||
const config = getConfigService(); | ||
return getConfigService().get(key); | ||
}; | ||
@@ -765,4 +750,4 @@ | ||
debounce, | ||
getAppConfig, | ||
getConfig, | ||
getConfigService, | ||
getLogger, | ||
@@ -769,0 +754,0 @@ getRangeDate, |
{ | ||
"name": "@deboxsoft/module-core", | ||
"version": "2.6.15", | ||
"version": "2.6.16", | ||
"license": "SEE LICENSE IN LICENSE", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71316
2121