@next-box/appsettings 0.0.0-stage → 0.0.2
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/LICENSE +21 -0
- package/README.md +182 -2
- package/bin/appsettings.mjs +7 -0
- package/dist/cjs/cli/cli/command.cjs +2 -0
- package/dist/cjs/cli/cli/command.cjs.map +1 -0
- package/dist/cjs/cli/cli/handler.cjs +2 -0
- package/dist/cjs/cli/cli/handler.cjs.map +1 -0
- package/dist/cjs/cli/cli/index.cjs +2 -0
- package/dist/cjs/cli/cli/index.cjs.map +1 -0
- package/dist/cjs/components/AppSettingsProvider.cjs +3 -0
- package/dist/cjs/components/AppSettingsProvider.cjs.map +1 -0
- package/dist/cjs/components/Setting.cjs +3 -0
- package/dist/cjs/components/Setting.cjs.map +1 -0
- package/dist/cjs/config/AppSettingsImplementation.cjs +2 -0
- package/dist/cjs/config/AppSettingsImplementation.cjs.map +1 -0
- package/dist/cjs/config/ConfigReader.cjs +2 -0
- package/dist/cjs/config/ConfigReader.cjs.map +1 -0
- package/dist/cjs/config/ConfigStore.cjs +2 -0
- package/dist/cjs/config/ConfigStore.cjs.map +1 -0
- package/dist/cjs/config/ScopedSettingsImplementation.cjs +2 -0
- package/dist/cjs/config/ScopedSettingsImplementation.cjs.map +1 -0
- package/dist/cjs/config/helpers/freezeDeep.cjs +2 -0
- package/dist/cjs/config/helpers/freezeDeep.cjs.map +1 -0
- package/dist/cjs/hooks/useAppSetting.cjs +2 -0
- package/dist/cjs/hooks/useAppSetting.cjs.map +1 -0
- package/dist/cjs/hooks/useAppSettings.cjs +2 -0
- package/dist/cjs/hooks/useAppSettings.cjs.map +1 -0
- package/dist/cjs/hooks/useAppSettingsContext.cjs +2 -0
- package/dist/cjs/hooks/useAppSettingsContext.cjs.map +1 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/server/config/ConfigMerger.cjs +2 -0
- package/dist/cjs/server/config/ConfigMerger.cjs.map +1 -0
- package/dist/cjs/server/config/ConfigValidator.cjs +2 -0
- package/dist/cjs/server/config/ConfigValidator.cjs.map +1 -0
- package/dist/cjs/server/config/createAppSettings.cjs +2 -0
- package/dist/cjs/server/config/createAppSettings.cjs.map +1 -0
- package/dist/cjs/server/server.cjs +2 -0
- package/dist/cjs/server/server.cjs.map +1 -0
- package/dist/cjs/server/sources/AppSettingsSource.cjs +2 -0
- package/dist/cjs/server/sources/AppSettingsSource.cjs.map +1 -0
- package/dist/cjs/server/sources/EnvironmentSource.cjs +2 -0
- package/dist/cjs/server/sources/EnvironmentSource.cjs.map +1 -0
- package/dist/cjs/server/sources/MemorySource.cjs +2 -0
- package/dist/cjs/server/sources/MemorySource.cjs.map +1 -0
- package/dist/cjs/server/sources/RemoteSource.cjs +2 -0
- package/dist/cjs/server/sources/RemoteSource.cjs.map +1 -0
- package/dist/cjs/server/sources/helpers/loadJson.cjs +2 -0
- package/dist/cjs/server/sources/helpers/loadJson.cjs.map +1 -0
- package/dist/esm/cli/cli/command.mjs +2 -0
- package/dist/esm/cli/cli/command.mjs.map +1 -0
- package/dist/esm/cli/cli/handler.mjs +2 -0
- package/dist/esm/cli/cli/handler.mjs.map +1 -0
- package/dist/esm/cli/cli/index.mjs +2 -0
- package/dist/esm/cli/cli/index.mjs.map +1 -0
- package/dist/esm/components/AppSettingsProvider.mjs +3 -0
- package/dist/esm/components/AppSettingsProvider.mjs.map +1 -0
- package/dist/esm/components/Setting.mjs +3 -0
- package/dist/esm/components/Setting.mjs.map +1 -0
- package/dist/esm/config/AppSettingsImplementation.mjs +2 -0
- package/dist/esm/config/AppSettingsImplementation.mjs.map +1 -0
- package/dist/esm/config/ConfigReader.mjs +2 -0
- package/dist/esm/config/ConfigReader.mjs.map +1 -0
- package/dist/esm/config/ConfigStore.mjs +2 -0
- package/dist/esm/config/ConfigStore.mjs.map +1 -0
- package/dist/esm/config/ScopedSettingsImplementation.mjs +2 -0
- package/dist/esm/config/ScopedSettingsImplementation.mjs.map +1 -0
- package/dist/esm/config/helpers/freezeDeep.mjs +2 -0
- package/dist/esm/config/helpers/freezeDeep.mjs.map +1 -0
- package/dist/esm/hooks/useAppSetting.mjs +2 -0
- package/dist/esm/hooks/useAppSetting.mjs.map +1 -0
- package/dist/esm/hooks/useAppSettings.mjs +2 -0
- package/dist/esm/hooks/useAppSettings.mjs.map +1 -0
- package/dist/esm/hooks/useAppSettingsContext.mjs +2 -0
- package/dist/esm/hooks/useAppSettingsContext.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/server/config/ConfigMerger.mjs +2 -0
- package/dist/esm/server/config/ConfigMerger.mjs.map +1 -0
- package/dist/esm/server/config/ConfigValidator.mjs +2 -0
- package/dist/esm/server/config/ConfigValidator.mjs.map +1 -0
- package/dist/esm/server/config/createAppSettings.mjs +2 -0
- package/dist/esm/server/config/createAppSettings.mjs.map +1 -0
- package/dist/esm/server/server.mjs +2 -0
- package/dist/esm/server/server.mjs.map +1 -0
- package/dist/esm/server/sources/AppSettingsSource.mjs +2 -0
- package/dist/esm/server/sources/AppSettingsSource.mjs.map +1 -0
- package/dist/esm/server/sources/EnvironmentSource.mjs +2 -0
- package/dist/esm/server/sources/EnvironmentSource.mjs.map +1 -0
- package/dist/esm/server/sources/MemorySource.mjs +2 -0
- package/dist/esm/server/sources/MemorySource.mjs.map +1 -0
- package/dist/esm/server/sources/RemoteSource.mjs +2 -0
- package/dist/esm/server/sources/RemoteSource.mjs.map +1 -0
- package/dist/esm/server/sources/helpers/loadJson.mjs +2 -0
- package/dist/esm/server/sources/helpers/loadJson.mjs.map +1 -0
- package/dist/production.analysis.txt +89 -0
- package/dist/types/cjs/__testUtils__/components/ErrorBoundary.d.cts +14 -0
- package/dist/types/cjs/__testUtils__/components/ErrorBoundary.d.cts.map +1 -0
- package/dist/types/cjs/cli/command.d.cts +7 -0
- package/dist/types/cjs/cli/command.d.cts.map +1 -0
- package/dist/types/cjs/cli/handler.d.cts +7 -0
- package/dist/types/cjs/cli/handler.d.cts.map +1 -0
- package/dist/types/cjs/cli/index.d.cts +2 -0
- package/dist/types/cjs/cli/index.d.cts.map +1 -0
- package/dist/types/cjs/components/AppSettingsProvider.d.cts +7 -0
- package/dist/types/cjs/components/AppSettingsProvider.d.cts.map +1 -0
- package/dist/types/cjs/components/Setting.d.cts +20 -0
- package/dist/types/cjs/components/Setting.d.cts.map +1 -0
- package/dist/types/cjs/config/AppSettingsImplementation.d.cts +15 -0
- package/dist/types/cjs/config/AppSettingsImplementation.d.cts.map +1 -0
- package/dist/types/cjs/config/ConfigMerger.d.cts +4 -0
- package/dist/types/cjs/config/ConfigMerger.d.cts.map +1 -0
- package/dist/types/cjs/config/ConfigReader.d.cts +14 -0
- package/dist/types/cjs/config/ConfigReader.d.cts.map +1 -0
- package/dist/types/cjs/config/ConfigStore.d.cts +6 -0
- package/dist/types/cjs/config/ConfigStore.d.cts.map +1 -0
- package/dist/types/cjs/config/ConfigValidator.d.cts +7 -0
- package/dist/types/cjs/config/ConfigValidator.d.cts.map +1 -0
- package/dist/types/cjs/config/ScopedSettingsImplementation.d.cts +13 -0
- package/dist/types/cjs/config/ScopedSettingsImplementation.d.cts.map +1 -0
- package/dist/types/cjs/config/createAppSettings.d.cts +3 -0
- package/dist/types/cjs/config/createAppSettings.d.cts.map +1 -0
- package/dist/types/cjs/config/helpers/freezeDeep.d.cts +2 -0
- package/dist/types/cjs/config/helpers/freezeDeep.d.cts.map +1 -0
- package/dist/types/cjs/hooks/useAppSetting.d.cts +6 -0
- package/dist/types/cjs/hooks/useAppSetting.d.cts.map +1 -0
- package/dist/types/cjs/hooks/useAppSettings.d.cts +6 -0
- package/dist/types/cjs/hooks/useAppSettings.d.cts.map +1 -0
- package/dist/types/cjs/hooks/useAppSettingsContext.d.cts +5 -0
- package/dist/types/cjs/hooks/useAppSettingsContext.d.cts.map +1 -0
- package/dist/types/cjs/index.d.cts +10 -0
- package/dist/types/cjs/index.d.cts.map +1 -0
- package/dist/types/cjs/server.d.cts +8 -0
- package/dist/types/cjs/server.d.cts.map +1 -0
- package/dist/types/cjs/sources/AppSettingsSource.d.cts +14 -0
- package/dist/types/cjs/sources/AppSettingsSource.d.cts.map +1 -0
- package/dist/types/cjs/sources/EnvironmentSource.d.cts +16 -0
- package/dist/types/cjs/sources/EnvironmentSource.d.cts.map +1 -0
- package/dist/types/cjs/sources/MemorySource.d.cts +12 -0
- package/dist/types/cjs/sources/MemorySource.d.cts.map +1 -0
- package/dist/types/cjs/sources/RemoteSource.d.cts +16 -0
- package/dist/types/cjs/sources/RemoteSource.d.cts.map +1 -0
- package/dist/types/cjs/sources/helpers/loadJson.d.cts +3 -0
- package/dist/types/cjs/sources/helpers/loadJson.d.cts.map +1 -0
- package/dist/types/cjs/types/AppSettings.types.d.cts +26 -0
- package/dist/types/cjs/types/AppSettings.types.d.cts.map +1 -0
- package/dist/types/cjs/types/Config.types.d.cts +12 -0
- package/dist/types/cjs/types/Config.types.d.cts.map +1 -0
- package/dist/types/cjs/types/Source.types.d.cts +5 -0
- package/dist/types/cjs/types/Source.types.d.cts.map +1 -0
- package/dist/types/esm/__testUtils__/components/ErrorBoundary.d.ts +14 -0
- package/dist/types/esm/__testUtils__/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/types/esm/cli/command.d.ts +7 -0
- package/dist/types/esm/cli/command.d.ts.map +1 -0
- package/dist/types/esm/cli/handler.d.ts +7 -0
- package/dist/types/esm/cli/handler.d.ts.map +1 -0
- package/dist/types/esm/cli/index.d.ts +2 -0
- package/dist/types/esm/cli/index.d.ts.map +1 -0
- package/dist/types/esm/components/AppSettingsProvider.d.ts +7 -0
- package/dist/types/esm/components/AppSettingsProvider.d.ts.map +1 -0
- package/dist/types/esm/components/Setting.d.ts +20 -0
- package/dist/types/esm/components/Setting.d.ts.map +1 -0
- package/dist/types/esm/config/AppSettingsImplementation.d.ts +15 -0
- package/dist/types/esm/config/AppSettingsImplementation.d.ts.map +1 -0
- package/dist/types/esm/config/ConfigMerger.d.ts +4 -0
- package/dist/types/esm/config/ConfigMerger.d.ts.map +1 -0
- package/dist/types/esm/config/ConfigReader.d.ts +14 -0
- package/dist/types/esm/config/ConfigReader.d.ts.map +1 -0
- package/dist/types/esm/config/ConfigStore.d.ts +6 -0
- package/dist/types/esm/config/ConfigStore.d.ts.map +1 -0
- package/dist/types/esm/config/ConfigValidator.d.ts +7 -0
- package/dist/types/esm/config/ConfigValidator.d.ts.map +1 -0
- package/dist/types/esm/config/ScopedSettingsImplementation.d.ts +13 -0
- package/dist/types/esm/config/ScopedSettingsImplementation.d.ts.map +1 -0
- package/dist/types/esm/config/createAppSettings.d.ts +3 -0
- package/dist/types/esm/config/createAppSettings.d.ts.map +1 -0
- package/dist/types/esm/config/helpers/freezeDeep.d.ts +2 -0
- package/dist/types/esm/config/helpers/freezeDeep.d.ts.map +1 -0
- package/dist/types/esm/hooks/useAppSetting.d.ts +6 -0
- package/dist/types/esm/hooks/useAppSetting.d.ts.map +1 -0
- package/dist/types/esm/hooks/useAppSettings.d.ts +6 -0
- package/dist/types/esm/hooks/useAppSettings.d.ts.map +1 -0
- package/dist/types/esm/hooks/useAppSettingsContext.d.ts +5 -0
- package/dist/types/esm/hooks/useAppSettingsContext.d.ts.map +1 -0
- package/dist/types/esm/index.d.ts +10 -0
- package/dist/types/esm/index.d.ts.map +1 -0
- package/dist/types/esm/server.d.ts +8 -0
- package/dist/types/esm/server.d.ts.map +1 -0
- package/dist/types/esm/sources/AppSettingsSource.d.ts +14 -0
- package/dist/types/esm/sources/AppSettingsSource.d.ts.map +1 -0
- package/dist/types/esm/sources/EnvironmentSource.d.ts +16 -0
- package/dist/types/esm/sources/EnvironmentSource.d.ts.map +1 -0
- package/dist/types/esm/sources/MemorySource.d.ts +12 -0
- package/dist/types/esm/sources/MemorySource.d.ts.map +1 -0
- package/dist/types/esm/sources/RemoteSource.d.ts +16 -0
- package/dist/types/esm/sources/RemoteSource.d.ts.map +1 -0
- package/dist/types/esm/sources/helpers/loadJson.d.ts +3 -0
- package/dist/types/esm/sources/helpers/loadJson.d.ts.map +1 -0
- package/dist/types/esm/types/AppSettings.types.d.ts +26 -0
- package/dist/types/esm/types/AppSettings.types.d.ts.map +1 -0
- package/dist/types/esm/types/Config.types.d.ts +12 -0
- package/dist/types/esm/types/Config.types.d.ts.map +1 -0
- package/dist/types/esm/types/Source.types.d.ts +5 -0
- package/dist/types/esm/types/Source.types.d.ts.map +1 -0
- package/dist/types/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +85 -3
- package/rollup.config.mjs +25 -0
- package/src/__testUtils__/AppSettingsSchema.d.ts +9 -0
- package/src/__testUtils__/components/ErrorBoundary.tsx +25 -0
- package/src/cli/command.test.ts +36 -0
- package/src/cli/command.ts +33 -0
- package/src/cli/handler.test.ts +61 -0
- package/src/cli/handler.ts +58 -0
- package/src/cli/index.test.ts +45 -0
- package/src/cli/index.ts +13 -0
- package/src/components/AppSettingsProvider.test.tsx +25 -0
- package/src/components/AppSettingsProvider.tsx +18 -0
- package/src/components/Setting.test.tsx +59 -0
- package/src/components/Setting.tsx +43 -0
- package/src/config/AppSettingsImplementation.test.ts +65 -0
- package/src/config/AppSettingsImplementation.ts +61 -0
- package/src/config/ConfigMerger.test.ts +44 -0
- package/src/config/ConfigMerger.ts +9 -0
- package/src/config/ConfigReader.test.ts +56 -0
- package/src/config/ConfigReader.ts +45 -0
- package/src/config/ConfigStore.test.ts +32 -0
- package/src/config/ConfigStore.ts +12 -0
- package/src/config/ConfigValidator.test.ts +30 -0
- package/src/config/ConfigValidator.ts +13 -0
- package/src/config/ScopedSettingsImplementation.test.ts +31 -0
- package/src/config/ScopedSettingsImplementation.ts +36 -0
- package/src/config/createAppSettings.test.ts +84 -0
- package/src/config/createAppSettings.ts +18 -0
- package/src/config/helpers/freezeDeep.test.ts +41 -0
- package/src/config/helpers/freezeDeep.ts +15 -0
- package/src/hooks/useAppSetting.test.tsx +37 -0
- package/src/hooks/useAppSetting.ts +14 -0
- package/src/hooks/useAppSettings.test.tsx +37 -0
- package/src/hooks/useAppSettings.ts +17 -0
- package/src/hooks/useAppSettingsContext.test.tsx +45 -0
- package/src/hooks/useAppSettingsContext.ts +17 -0
- package/src/index.ts +11 -0
- package/src/server.ts +7 -0
- package/src/sources/AppSettingsSource.test.ts +61 -0
- package/src/sources/AppSettingsSource.ts +30 -0
- package/src/sources/EnvironmentSource.test.ts +45 -0
- package/src/sources/EnvironmentSource.ts +87 -0
- package/src/sources/MemorySource.test.ts +31 -0
- package/src/sources/MemorySource.ts +21 -0
- package/src/sources/RemoteSource.test.ts +80 -0
- package/src/sources/RemoteSource.ts +50 -0
- package/src/sources/helpers/loadJson.test.ts +74 -0
- package/src/sources/helpers/loadJson.ts +29 -0
- package/src/types/AppSettings.types.test.ts +61 -0
- package/src/types/AppSettings.types.ts +30 -0
- package/src/types/Config.types.test.ts +36 -0
- package/src/types/Config.types.ts +27 -0
- package/src/types/Source.types.ts +4 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freezeDeep.mjs","sources":["../../../../src/config/helpers/freezeDeep.ts"],"sourcesContent":["import { isPlainObject } from 'remeda';\n\nexport const freezeDeep = <T>(value: T): T => {\n if ((isPlainObject(value) || Array.isArray(value)) && !Object.isFrozen(value)) {\n const values: unknown[] = Object.values(value);\n\n for (const entry of values) {\n freezeDeep(entry);\n }\n\n Object.freeze(value);\n }\n\n return value;\n};\n"],"names":["freezeDeep","value","isPlainObject","Array","isArray","Object","isFrozen","values","entry","freeze"],"mappings":"uCAEO,MAAMA,EAAiBC,IAC5B,IAAKC,EAAcD,IAAUE,MAAMC,QAAQH,MAAYI,OAAOC,SAASL,GAAQ,CAC7E,MAAMM,EAAoBF,OAAOE,OAAON,GAExC,IAAK,MAAMO,KAASD,EAClBP,EAAWQ,GAGbH,OAAOI,OAAOR,EAChB,CAEA,OAAOA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppSetting.mjs","sources":["../../../src/hooks/useAppSetting.ts"],"sourcesContent":["import { type Get } from 'type-fest';\nimport { type AppSettingsSchema } from '../index.ts';\nimport { type SettingPath } from '../types/Config.types.ts';\nimport { useAppSettingsContext } from './useAppSettingsContext.ts';\n\nexport function useAppSetting<P extends SettingPath<AppSettingsSchema>>(path: P): Get<AppSettingsSchema, P> | undefined;\nexport function useAppSetting<T extends object, P extends SettingPath<T>>(path: P): Get<T, P> | undefined;\n\n// Required for overloads\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\nexport function useAppSetting(path: string): unknown {\n const settings = useAppSettingsContext();\n return settings.read(path);\n}\n"],"names":["useAppSetting","path","useAppSettingsContext","read"],"mappings":"oEAUO,SAASA,EAAcC,GAE5B,OADiBC,IACDC,KAAKF,EACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppSettings.mjs","sources":["../../../src/hooks/useAppSettings.ts"],"sourcesContent":["import { type Get } from 'type-fest';\nimport { type SettingSectionPath } from '#types/Config.types.ts';\nimport { type AppSettingsSchema } from '../index.ts';\nimport { useAppSettingsContext } from './useAppSettingsContext.ts';\n\nexport function useAppSettings<P extends SettingSectionPath<AppSettingsSchema>>(\n path: P,\n): Get<AppSettingsSchema, P> | undefined;\n\nexport function useAppSettings<T extends object, P extends SettingSectionPath<T>>(path: P): Get<T, P> | undefined;\n\n// Required for overloads\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\nexport function useAppSettings(path: string): unknown {\n const settings = useAppSettingsContext();\n return settings.read(path);\n}\n"],"names":["useAppSettings","path","useAppSettingsContext","read"],"mappings":"oEAaO,SAASA,EAAeC,GAE7B,OADiBC,IACDC,KAAKF,EACvB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as t,use as e}from"react";const o=t(void 0),r=()=>{const t=e(o);if(!t||"object"!=typeof t)throw new Error("useAppSettingsContext must be used within an <AppSettingsProvider>.");return t};export{o as AppSettingsContext,r as useAppSettingsContext};
|
|
2
|
+
//# sourceMappingURL=useAppSettingsContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppSettingsContext.mjs","sources":["../../../src/hooks/useAppSettingsContext.ts"],"sourcesContent":["import { createContext, use } from 'react';\nimport { type InternalAppSettings } from '#types/AppSettings.types.ts';\nimport { type AppSettingsSchema } from '../index.ts';\n\nexport const AppSettingsContext = createContext<unknown>(undefined);\n\nexport const useAppSettingsContext = <T extends object = AppSettingsSchema>(): InternalAppSettings<T> => {\n const settings = use(AppSettingsContext);\n\n if (!settings || typeof settings !== 'object') {\n throw new Error('useAppSettingsContext must be used within an <AppSettingsProvider>.');\n }\n\n // Context is untyped because each provider supplies a different schema.\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n return settings as InternalAppSettings<T>;\n};\n"],"names":["AppSettingsContext","createContext","undefined","useAppSettingsContext","settings","use","Error"],"mappings":"+CAIO,MAAMA,EAAqBC,OAAuBC,GAE5CC,EAAwB,KACnC,MAAMC,EAAWC,EAAIL,GAErB,IAAKI,GAAgC,iBAAbA,EACtB,MAAM,IAAIE,MAAM,uEAKlB,OAAOF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigMerger.mjs","sources":["../../../../src/config/ConfigMerger.ts"],"sourcesContent":["import { mergeDeep } from 'remeda';\n\nexport class ConfigMerger {\n merge<T extends object>(first: T, ...configs: readonly T[]): T {\n // TypeScript cannot guarantee that merging arbitrary objects produces T\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n return configs.reduce((merged, config) => mergeDeep(merged, config) as T, first);\n }\n}\n"],"names":["ConfigMerger","merge","first","configs","reduce","merged","config","mergeDeep"],"mappings":"mCAEO,MAAMA,EACXC,KAAAA,CAAwBC,KAAaC,GAGnC,OAAOA,EAAQC,OAAO,CAACC,EAAQC,IAAWC,EAAUF,EAAQC,GAAcJ,EAC5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigValidator.mjs","sources":["../../../../src/config/ConfigValidator.ts"],"sourcesContent":["import { type ZodType, type output } from 'zod';\n\nexport class ConfigValidator<T extends ZodType> {\n private readonly schema: T;\n\n constructor(schema: T) {\n this.schema = schema;\n }\n\n validate(value: unknown): output<T> {\n return this.schema.parse(value);\n }\n}\n"],"names":["ConfigValidator","constructor","schema","this","validate","value","parse"],"mappings":"AAEO,MAAMA,EAGX,WAAAC,CAAYC,GACVC,KAAKD,OAASA,CAChB,CAEAE,QAAAA,CAASC,GACP,OAAOF,KAAKD,OAAOI,MAAMD,EAC3B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ConfigMerger as o}from"./ConfigMerger.mjs";import{ConfigValidator as r}from"./ConfigValidator.mjs";const e=async({defaults:e,schema:s,sources:t=[]})=>{const a=[];for(const o of t)a.push(await o.load());const n=(new o).merge(e,...a);return new r(s).validate(n)};export{e as createAppSettings};
|
|
2
|
+
//# sourceMappingURL=createAppSettings.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAppSettings.mjs","sources":["../../../../src/config/createAppSettings.ts"],"sourcesContent":["import { type CreateAppSettingsOptions } from '#types/AppSettings.types.ts';\nimport { ConfigMerger } from './ConfigMerger.ts';\nimport { ConfigValidator } from './ConfigValidator.ts';\n\nexport const createAppSettings = async <T extends object>({\n defaults,\n schema,\n sources = [],\n}: CreateAppSettingsOptions<T>): Promise<Readonly<T>> => {\n const loadedSources: Record<string, unknown>[] = [];\n\n for (const source of sources) {\n loadedSources.push(await source.load());\n }\n\n const merged = new ConfigMerger().merge(defaults, ...loadedSources);\n return new ConfigValidator(schema).validate(merged);\n};\n"],"names":["createAppSettings","async","defaults","schema","sources","loadedSources","source","push","load","merged","ConfigMerger","merge","ConfigValidator","validate"],"mappings":"0GAIO,MAAMA,EAAoBC,OAC/BC,WACAC,SACAC,UAAU,OAEV,MAAMC,EAA2C,GAEjD,IAAK,MAAMC,KAAUF,EACnBC,EAAcE,WAAWD,EAAOE,QAGlC,MAAMC,GAAS,IAAIC,GAAeC,MAAMT,KAAaG,GACrD,OAAO,IAAIO,EAAgBT,GAAQU,SAASJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{createAppSettings}from"./config/createAppSettings.mjs";export{AppSettingsSource}from"./sources/AppSettingsSource.mjs";export{EnvironmentSource}from"./sources/EnvironmentSource.mjs";export{RemoteSource}from"./sources/RemoteSource.mjs";export{MemorySource}from"./sources/MemorySource.mjs";
|
|
2
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{resolve as e}from"node:path";import{ConfigMerger as t}from"../config/ConfigMerger.mjs";import{loadJson as n}from"./helpers/loadJson.mjs";class o{constructor(e){this.directory=e.directory??process.cwd(),this.environment=e.environment??process.env.NODE_ENV??"development",this.name=e.name??`appsettings:${this.environment}`}async load(){const o=e(this.directory,"appsettings.json"),r=e(this.directory,`appsettings.${this.environment}.json`),s=await n(o,!1),i=await n(r,!0)??{};return(new t).merge(s,i)}}export{o as AppSettingsSource};
|
|
2
|
+
//# sourceMappingURL=AppSettingsSource.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppSettingsSource.mjs","sources":["../../../../src/sources/AppSettingsSource.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport { ConfigMerger } from '#config/ConfigMerger.ts';\nimport { loadJson } from '#sources/helpers/loadJson.ts';\nimport { type SettingsSource } from '../types/Source.types.ts';\n\nexport interface AppSettingsSourceOptions {\n directory?: string;\n environment?: string;\n name?: string;\n}\n\nexport class AppSettingsSource implements SettingsSource {\n private directory: string;\n private environment: string;\n public name: string;\n\n public constructor(options: AppSettingsSourceOptions) {\n this.directory = options.directory ?? process.cwd();\n this.environment = options.environment ?? process.env.NODE_ENV ?? 'development';\n this.name = options.name ?? `appsettings:${this.environment}`;\n }\n\n async load(): Promise<Record<string, unknown>> {\n const basePath = resolve(this.directory, 'appsettings.json');\n const environmentPath = resolve(this.directory, `appsettings.${this.environment}.json`);\n const base = await loadJson(basePath, false);\n const override = (await loadJson(environmentPath, true)) ?? {};\n return new ConfigMerger().merge(base, override);\n }\n}\n"],"names":["AppSettingsSource","constructor","options","this","directory","process","cwd","environment","env","NODE_ENV","name","load","basePath","resolve","environmentPath","base","loadJson","override","ConfigMerger","merge"],"mappings":"gJAWO,MAAMA,EAKX,WAAAC,CAAmBC,GACjBC,KAAKC,UAAYF,EAAQE,WAAaC,QAAQC,MAC9CH,KAAKI,YAAcL,EAAQK,aAAeF,QAAQG,IAAIC,UAAY,cAClEN,KAAKO,KAAOR,EAAQQ,MAAQ,eAAeP,KAAKI,aAClD,CAEA,UAAMI,GACJ,MAAMC,EAAWC,EAAQV,KAAKC,UAAW,oBACnCU,EAAkBD,EAAQV,KAAKC,UAAW,eAAeD,KAAKI,oBAC9DQ,QAAaC,EAASJ,GAAU,GAChCK,QAAkBD,EAASF,GAAiB,IAAU,CAAA,EAC5D,OAAO,IAAII,GAAeC,MAAMJ,EAAME,EACxC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{capitalize as e,isPlainObject as t}from"remeda";class i{constructor(t){this.normalizeSegment=t=>t.toLowerCase().split("_").filter(Boolean).map(t=>e(t)).join(""),this.envs=t.envs,this.prefix=t.prefix??"APP_",this.name=t.name??`environment:${this.prefix}`}parseEnvironmentValue(e){return"true"===e||"false"!==e&&(""!==e.trim()&&Number.isFinite(Number(e))?Number(e):e)}load(){const e={};for(const[i,n]of Object.entries(this.envs)){if(void 0===n||!i.startsWith(this.prefix))continue;const r=i.slice(this.prefix.length).split("__").filter(Boolean).map(e=>this.normalizeSegment(e)),s=r.pop();if(!s)continue;let o=e;for(const e of r){const i=o[e];t(i)||(o[e]={});const n=o[e];t(n)&&(o=n)}o[s]=this.parseEnvironmentValue(n)}return Promise.resolve(e)}}export{i as EnvironmentSource};
|
|
2
|
+
//# sourceMappingURL=EnvironmentSource.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnvironmentSource.mjs","sources":["../../../../src/sources/EnvironmentSource.ts"],"sourcesContent":["import { capitalize, isPlainObject } from 'remeda';\nimport { type SettingsSource } from '../types/Source.types.ts';\n\nexport interface EnvironmentSourceOptions {\n envs: Record<string, string | undefined>;\n name?: string;\n prefix?: string;\n}\n\nexport class EnvironmentSource implements SettingsSource {\n private readonly envs: Record<string, string | undefined>;\n private readonly prefix: string;\n\n private normalizeSegment = (value: string): string =>\n value\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .map(part => capitalize(part))\n .join('');\n\n public readonly name: string;\n\n public constructor(options: EnvironmentSourceOptions) {\n this.envs = options.envs;\n this.prefix = options.prefix ?? 'APP_';\n this.name = options.name ?? `environment:${this.prefix}`;\n }\n\n private parseEnvironmentValue(value: string): unknown {\n if (value === 'true') {\n return true;\n }\n\n if (value === 'false') {\n return false;\n }\n\n if (value.trim() !== '' && Number.isFinite(Number(value))) {\n return Number(value);\n }\n\n return value;\n }\n\n load(): Promise<Record<string, unknown>> {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(this.envs)) {\n if (value === undefined || !key.startsWith(this.prefix)) {\n continue;\n }\n\n const path = key\n .slice(this.prefix.length)\n .split('__')\n .filter(Boolean)\n .map(part => this.normalizeSegment(part));\n\n const leaf = path.pop();\n\n if (!leaf) {\n continue;\n }\n\n let current = result;\n\n for (const part of path) {\n const next = current[part];\n\n if (!isPlainObject(next)) {\n current[part] = {};\n }\n\n const currentPart = current[part];\n\n if (isPlainObject(currentPart)) {\n current = currentPart;\n }\n }\n\n current[leaf] = this.parseEnvironmentValue(value);\n }\n\n return Promise.resolve(result);\n }\n}\n"],"names":["EnvironmentSource","constructor","options","normalizeSegment","value","toLowerCase","split","filter","Boolean","map","part","capitalize","join","this","envs","prefix","name","parseEnvironmentValue","trim","Number","isFinite","load","result","key","Object","entries","undefined","startsWith","path","slice","length","leaf","pop","current","next","isPlainObject","currentPart","Promise","resolve"],"mappings":"uDASO,MAAMA,EAcX,WAAAC,CAAmBC,GAVXC,KAAAA,iBAAoBC,GAC1BA,EACGC,cACAC,MAAM,KACNC,OAAOC,SACPC,IAAIC,GAAQC,EAAWD,IACvBE,KAAK,IAKRC,KAAKC,KAAOZ,EAAQY,KACpBD,KAAKE,OAASb,EAAQa,QAAU,OAChCF,KAAKG,KAAOd,EAAQc,MAAQ,eAAeH,KAAKE,QAClD,CAEQE,qBAAAA,CAAsBb,GAC5B,MAAc,SAAVA,GAIU,UAAVA,IAIiB,KAAjBA,EAAMc,QAAiBC,OAAOC,SAASD,OAAOf,IACzCe,OAAOf,GAGTA,EACT,CAEAiB,IAAAA,GACE,MAAMC,EAAkC,CAAA,EAExC,IAAK,MAAOC,EAAKnB,KAAUoB,OAAOC,QAAQZ,KAAKC,MAAO,CACpD,QAAcY,IAAVtB,IAAwBmB,EAAII,WAAWd,KAAKE,QAC9C,SAGF,MAAMa,EAAOL,EACVM,MAAMhB,KAAKE,OAAOe,QAClBxB,MAAM,MACNC,OAAOC,SACPC,IAAIC,GAAQG,KAAKV,iBAAiBO,IAE/BqB,EAAOH,EAAKI,MAElB,IAAKD,EACH,SAGF,IAAIE,EAAUX,EAEd,IAAK,MAAMZ,KAAQkB,EAAM,CACvB,MAAMM,EAAOD,EAAQvB,GAEhByB,EAAcD,KACjBD,EAAQvB,GAAQ,CAAA,GAGlB,MAAM0B,EAAcH,EAAQvB,GAExByB,EAAcC,KAChBH,EAAUG,EAEd,CAEAH,EAAQF,GAAQlB,KAAKI,sBAAsBb,EAC7C,CAEA,OAAOiC,QAAQC,QAAQhB,EACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemorySource.mjs","sources":["../../../../src/sources/MemorySource.ts"],"sourcesContent":["import { clone } from 'remeda';\nimport { type SettingsSource } from '../types/Source.types.ts';\n\nexport interface MemorySourceOptions {\n name?: string;\n values: Record<string, unknown>;\n}\n\nexport class MemorySource implements SettingsSource {\n private readonly values: Record<string, unknown>;\n public readonly name: string;\n\n public constructor(options: MemorySourceOptions) {\n this.name = options.name ?? 'memory';\n this.values = options.values;\n }\n\n load(): Promise<Record<string, unknown>> {\n return Promise.resolve(clone(this.values));\n }\n}\n"],"names":["MemorySource","constructor","options","this","name","values","load","Promise","resolve","clone"],"mappings":"+BAQO,MAAMA,EAIX,WAAAC,CAAmBC,GACjBC,KAAKC,KAAOF,EAAQE,MAAQ,SAC5BD,KAAKE,OAASH,EAAQG,MACxB,CAEAC,IAAAA,GACE,OAAOC,QAAQC,QAAQC,EAAMN,KAAKE,QACpC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isObjectType as t,prop as e,stringToPath as r,isPlainObject as s}from"remeda";class o{constructor(t){this.fetch=t.fetch,this.url=t.url,this.name=t.name??`remote:${this.url}`,this.responsePath=t.responsePath}async load(){if("function"!=typeof this.fetch)throw new TypeError("RemoteSource requires fetch, which is unavailable in this runtime.");const o=await this.fetch(this.url);if(!o.ok)throw new Error(`Failed to load settings from "${this.url}": ${String(o.status)} ${o.statusText}`);let i=await o.json();if(this.responsePath&&!t(i))throw new Error(`Fetched value must be an object type if response path is provided, but was ${typeof i}.`);if(i=this.responsePath?e(i,...r(this.responsePath)):i,!s(i))throw new Error(`JSON settings from "${this.url}" must contain an object at the root.`);return i}}export{o as RemoteSource};
|
|
2
|
+
//# sourceMappingURL=RemoteSource.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteSource.mjs","sources":["../../../../src/sources/RemoteSource.ts"],"sourcesContent":["import { isObjectType, isPlainObject, prop, stringToPath } from 'remeda';\nimport { type SettingsSource } from '#types/Source.types.ts';\n\nexport interface RemoteSourceOptions {\n fetch: typeof globalThis.fetch;\n name?: string;\n responsePath?: string;\n url: string;\n}\n\nexport class RemoteSource implements SettingsSource {\n private fetch: typeof globalThis.fetch;\n private responsePath?: string;\n private url: string;\n public name: string;\n\n public constructor(options: RemoteSourceOptions) {\n this.fetch = options.fetch;\n this.url = options.url;\n this.name = options.name ?? `remote:${this.url}`;\n this.responsePath = options.responsePath;\n }\n\n async load(): Promise<Record<string, unknown>> {\n if (typeof this.fetch !== 'function') {\n throw new TypeError('RemoteSource requires fetch, which is unavailable in this runtime.');\n }\n\n const response = await this.fetch(this.url);\n\n if (!response.ok) {\n throw new Error(`Failed to load settings from \"${this.url}\": ${String(response.status)} ${response.statusText}`);\n }\n\n let value: unknown = await response.json();\n\n if (this.responsePath && !isObjectType(value)) {\n throw new Error(`Fetched value must be an object type if response path is provided, but was ${typeof value}.`);\n }\n\n // @ts-expect-error Unable to statically type string literal\n value = this.responsePath ? prop(value, ...stringToPath(this.responsePath)) : value;\n\n if (!isPlainObject(value)) {\n throw new Error(`JSON settings from \"${this.url}\" must contain an object at the root.`);\n }\n\n return value;\n }\n}\n"],"names":["RemoteSource","constructor","options","this","fetch","url","name","responsePath","load","TypeError","response","ok","Error","String","status","statusText","value","json","isObjectType","prop","stringToPath","isPlainObject"],"mappings":"qFAUO,MAAMA,EAMX,WAAAC,CAAmBC,GACjBC,KAAKC,MAAQF,EAAQE,MACrBD,KAAKE,IAAMH,EAAQG,IACnBF,KAAKG,KAAOJ,EAAQI,MAAQ,UAAUH,KAAKE,MAC3CF,KAAKI,aAAeL,EAAQK,YAC9B,CAEA,UAAMC,GACJ,GAA0B,mBAAfL,KAAKC,MACd,MAAM,IAAIK,UAAU,sEAGtB,MAAMC,QAAiBP,KAAKC,MAAMD,KAAKE,KAEvC,IAAKK,EAASC,GACZ,MAAM,IAAIC,MAAM,iCAAiCT,KAAKE,SAASQ,OAAOH,EAASI,WAAWJ,EAASK,cAGrG,IAAIC,QAAuBN,EAASO,OAEpC,GAAId,KAAKI,eAAiBW,EAAaF,GACrC,MAAM,IAAIJ,MAAM,qFAAqFI,MAMvG,GAFAA,EAAQb,KAAKI,aAAeY,EAAKH,KAAUI,EAAajB,KAAKI,eAAiBS,GAEzEK,EAAcL,GACjB,MAAM,IAAIJ,MAAM,uBAAuBT,KAAKE,4CAG9C,OAAOW,CACT"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{readFile as t}from"node:fs/promises";import{isPlainObject as o}from"remeda";async function r(r,e){let n;try{n=await t(r,"utf8")}catch(t){if(e&&"object"==typeof t&&null!==t&&"code"in t&&"ENOENT"===t.code)return;throw t}const c=JSON.parse(n);if(!o(c))throw new Error(`JSON settings from "${r}" must contain an object at the root.`);return c}export{r as loadJson};
|
|
2
|
+
//# sourceMappingURL=loadJson.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadJson.mjs","sources":["../../../../../src/sources/helpers/loadJson.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { isPlainObject } from 'remeda';\n\nexport function loadJson(path: string, isOptional: false): Promise<Record<string, unknown>>;\nexport function loadJson(path: string, isOptional: true): Promise<Record<string, unknown> | undefined>;\n\n// Required for overloads\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\nexport async function loadJson(path: string, isOptional: boolean): Promise<Record<string, unknown> | undefined> {\n let contents: string;\n\n try {\n contents = await readFile(path, 'utf8');\n } catch (error) {\n if (isOptional && typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT') {\n return undefined;\n }\n\n throw error;\n }\n\n const value: unknown = JSON.parse(contents);\n\n if (!isPlainObject(value)) {\n throw new Error(`JSON settings from \"${path}\" must contain an object at the root.`);\n }\n\n return value;\n}\n"],"names":["async","loadJson","path","isOptional","contents","readFile","error","code","value","JSON","parse","isPlainObject","Error"],"mappings":"mFAQOA,eAAeC,EAASC,EAAcC,GAC3C,IAAIC,EAEJ,IACEA,QAAiBC,EAASH,EAAM,OAClC,CAAE,MAAOI,GACP,GAAIH,GAA+B,iBAAVG,GAAgC,OAAVA,GAAkB,SAAUA,GAAwB,WAAfA,EAAMC,KACxF,OAGF,MAAMD,CACR,CAEA,MAAME,EAAiBC,KAAKC,MAAMN,GAElC,IAAKO,EAAcH,GACjB,MAAM,IAAII,MAAM,uBAAuBV,0CAGzC,OAAOM,CACT"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
-----------------------------
|
|
2
|
+
Rollup File Analysis
|
|
3
|
+
-----------------------------
|
|
4
|
+
bundle size: 5.215 KB
|
|
5
|
+
original size: 8.074 KB
|
|
6
|
+
code reduction: 35.41 %
|
|
7
|
+
module count: 9
|
|
8
|
+
|
|
9
|
+
███████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
10
|
+
file: /src/sources/EnvironmentSource.ts
|
|
11
|
+
bundle space: 31.1 %
|
|
12
|
+
rendered size: 1.622 KB
|
|
13
|
+
original size: 2.006 KB
|
|
14
|
+
code reduction: 19.14 %
|
|
15
|
+
dependents: 1
|
|
16
|
+
- /src/server.ts
|
|
17
|
+
|
|
18
|
+
███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
19
|
+
file: /src/sources/RemoteSource.ts
|
|
20
|
+
bundle space: 23.53 %
|
|
21
|
+
rendered size: 1.227 KB
|
|
22
|
+
original size: 1.605 KB
|
|
23
|
+
code reduction: 23.55 %
|
|
24
|
+
dependents: 1
|
|
25
|
+
- /src/server.ts
|
|
26
|
+
|
|
27
|
+
██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
28
|
+
file: /src/sources/AppSettingsSource.ts
|
|
29
|
+
bundle space: 13.5 %
|
|
30
|
+
rendered size: 704 Bytes
|
|
31
|
+
original size: 1.127 KB
|
|
32
|
+
code reduction: 37.53 %
|
|
33
|
+
dependents: 1
|
|
34
|
+
- /src/server.ts
|
|
35
|
+
|
|
36
|
+
██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
37
|
+
file: /src/sources/helpers/loadJson.ts
|
|
38
|
+
bundle space: 12 %
|
|
39
|
+
rendered size: 626 Bytes
|
|
40
|
+
original size: 945 Bytes
|
|
41
|
+
code reduction: 33.76 %
|
|
42
|
+
dependents: 1
|
|
43
|
+
- /src/sources/AppSettingsSource.ts
|
|
44
|
+
|
|
45
|
+
███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
46
|
+
file: /src/config/createAppSettings.ts
|
|
47
|
+
bundle space: 6.77 %
|
|
48
|
+
rendered size: 353 Bytes
|
|
49
|
+
original size: 610 Bytes
|
|
50
|
+
code reduction: 42.13 %
|
|
51
|
+
dependents: 1
|
|
52
|
+
- /src/server.ts
|
|
53
|
+
|
|
54
|
+
██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
55
|
+
file: /src/config/ConfigMerger.ts
|
|
56
|
+
bundle space: 5.98 %
|
|
57
|
+
rendered size: 312 Bytes
|
|
58
|
+
original size: 379 Bytes
|
|
59
|
+
code reduction: 17.68 %
|
|
60
|
+
dependents: 2
|
|
61
|
+
- /src/config/createAppSettings.ts
|
|
62
|
+
- /src/sources/AppSettingsSource.ts
|
|
63
|
+
|
|
64
|
+
██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
65
|
+
file: /src/sources/MemorySource.ts
|
|
66
|
+
bundle space: 4.14 %
|
|
67
|
+
rendered size: 216 Bytes
|
|
68
|
+
original size: 563 Bytes
|
|
69
|
+
code reduction: 61.63 %
|
|
70
|
+
dependents: 1
|
|
71
|
+
- /src/server.ts
|
|
72
|
+
|
|
73
|
+
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
74
|
+
file: /src/config/ConfigValidator.ts
|
|
75
|
+
bundle space: 2.97 %
|
|
76
|
+
rendered size: 155 Bytes
|
|
77
|
+
original size: 272 Bytes
|
|
78
|
+
code reduction: 43.01 %
|
|
79
|
+
dependents: 1
|
|
80
|
+
- /src/config/createAppSettings.ts
|
|
81
|
+
|
|
82
|
+
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
83
|
+
file: /src/server.ts
|
|
84
|
+
bundle space: 0 %
|
|
85
|
+
rendered size: 0 Byte
|
|
86
|
+
original size: 567 Bytes
|
|
87
|
+
code reduction: 100 %
|
|
88
|
+
dependents: 0
|
|
89
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, type ReactNode } from 'react';
|
|
2
|
+
export type ErrorBoundaryProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
type ErrorBoundaryState = {
|
|
6
|
+
error: Error | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
9
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
10
|
+
state: ErrorBoundaryState;
|
|
11
|
+
render(): ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ErrorBoundary.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.cts","sourceRoot":"","sources":["../../../../../src/__testUtils__/components/ErrorBoundary.ctsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;WACpE,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB;IAIxD,KAAK,EAAE,kBAAkB,CAAwB;IAEjD,MAAM,IAAI,SAAS;CAOpC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CommandBuilder } from 'yargs';
|
|
2
|
+
import { type GenerateTypesArguments } from '#cli/handler.cts';
|
|
3
|
+
export declare const builder: CommandBuilder<object, GenerateTypesArguments>;
|
|
4
|
+
export declare const command = "generate-types <schema> <output>";
|
|
5
|
+
export declare const describe = "Generate a declaration that types appsettings hooks from your schema.";
|
|
6
|
+
export { handler } from './handler.cts';
|
|
7
|
+
//# sourceMappingURL=command.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.cts","sourceRoot":"","sources":["../../../../src/cli/command.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,sBAAsB,CAuB7D,CAAC;AAEP,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAE1D,eAAO,MAAM,QAAQ,0EAA0E,CAAC;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.cts","sourceRoot":"","sources":["../../../../src/cli/handler.cts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,OAAO,GAAU,0BAA0B,sBAAsB,KAAG,OAAO,CAAC,IAAI,CAgC5F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/cli/index.cts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,IAAI,CAQtD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
export interface AppSettingsProviderProps<T extends object = object> {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
settings: Readonly<T>;
|
|
5
|
+
}
|
|
6
|
+
export declare const AppSettingsProvider: <T extends object>({ children, settings, }: AppSettingsProviderProps<T>) => ReactElement;
|
|
7
|
+
//# sourceMappingURL=AppSettingsProvider.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppSettingsProvider.d.cts","sourceRoot":"","sources":["../../../../src/components/AppSettingsProvider.ctsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAInE,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACjE,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,EAAE,yBAGnD,wBAAwB,CAAC,CAAC,CAAC,KAAG,YAGhC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type Get } from 'type-fest';
|
|
3
|
+
import { type AppSettingsSchema } from '../index.cts';
|
|
4
|
+
import { type SettingPath } from '../types/Config.types.cts';
|
|
5
|
+
export interface SettingProps<T extends object, P extends SettingPath<T>> {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
fallback?: ReactNode;
|
|
8
|
+
negate?: boolean;
|
|
9
|
+
path: P;
|
|
10
|
+
value: Get<T, P> | undefined | readonly (Get<T, P> | undefined)[];
|
|
11
|
+
}
|
|
12
|
+
export declare function Setting<P extends SettingPath<AppSettingsSchema>>(props: {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
fallback?: ReactNode;
|
|
15
|
+
negate?: boolean;
|
|
16
|
+
path: P;
|
|
17
|
+
value: Get<AppSettingsSchema, P> | undefined | readonly (Get<AppSettingsSchema, P> | undefined)[];
|
|
18
|
+
}): ReactNode;
|
|
19
|
+
export declare function Setting<T extends object, P extends SettingPath<T>>(props: SettingProps<T, P>): ReactNode;
|
|
20
|
+
//# sourceMappingURL=Setting.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Setting.d.cts","sourceRoot":"","sources":["../../../../src/components/Setting.ctsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC;IACtE,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;CACnE;AAUD,wBAAgB,OAAO,CAAC,CAAC,SAAS,WAAW,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE;IACvE,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;CACnG,GAAG,SAAS,CAAC;AAEd,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Get } from 'type-fest';
|
|
2
|
+
import { type InternalAppSettings, type ScopedSettings } from '#types/AppSettings.types.cts';
|
|
3
|
+
import { type SettingPath, type SettingSectionPath } from '#types/Config.types.cts';
|
|
4
|
+
export declare class AppSettingsImplementation<T extends object> implements InternalAppSettings<T> {
|
|
5
|
+
private readonly store;
|
|
6
|
+
constructor(settings: T);
|
|
7
|
+
get<P extends SettingPath<T>>(path: P): Get<T, P> | undefined;
|
|
8
|
+
read(path: string): unknown;
|
|
9
|
+
getAll(): Readonly<T>;
|
|
10
|
+
getOrThrow<P extends SettingPath<T>>(path: P): Get<T, P>;
|
|
11
|
+
getSection<P extends SettingSectionPath<T>>(path: P): Get<T, P> | undefined;
|
|
12
|
+
has(path: SettingPath<T> | SettingSectionPath<T>): boolean;
|
|
13
|
+
scope<P extends SettingSectionPath<T>>(path: P): ScopedSettings<Extract<Get<T, P>, object>>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AppSettingsImplementation.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppSettingsImplementation.d.cts","sourceRoot":"","sources":["../../../../src/config/AppSettingsImplementation.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAInF,qBAAa,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAE,YAAW,mBAAmB,CAAC,CAAC,CAAC;IACxF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;gBAE3B,QAAQ,EAAE,CAAC;IAIvB,GAAG,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS;IAK7D,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI3B,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC;IAIrB,UAAU,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAWxD,UAAU,CAAC,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS;IAK3E,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO;IAK1D,KAAK,CAAC,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;CAW5F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigMerger.d.cts","sourceRoot":"","sources":["../../../../src/config/ConfigMerger.cts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IACvB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC;CAK/D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Get } from 'type-fest';
|
|
2
|
+
import { type Path, type Scope, type ConfigReader as ZcbConfigReader } from 'zcb';
|
|
3
|
+
export declare class ConfigReader<T extends object> {
|
|
4
|
+
private reader;
|
|
5
|
+
private readonly config;
|
|
6
|
+
constructor(config: T);
|
|
7
|
+
private getAt;
|
|
8
|
+
get<P extends Path<T>>(path: P): Get<T, P>;
|
|
9
|
+
getSection<P extends Scope<T>>(path: P): Get<T, P>;
|
|
10
|
+
has(path: string): boolean;
|
|
11
|
+
read(path: string): unknown;
|
|
12
|
+
scope<P extends Scope<T>>(path: P): ZcbConfigReader<Get<T, P>>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ConfigReader.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigReader.d.cts","sourceRoot":"","sources":["../../../../src/config/ConfigReader.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,IAAI,eAAe,EAAsB,MAAM,KAAK,CAAC;AAEtG,qBAAa,YAAY,CAAC,CAAC,SAAS,MAAM;IACxC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAI;gBAEf,MAAM,EAAE,CAAC;IAKrB,OAAO,CAAC,KAAK;IAUN,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAI1C,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAMlD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI3B,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAGtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigStore.d.cts","sourceRoot":"","sources":["../../../../src/config/ConfigStore.cts"],"names":[],"mappings":"AAGA,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAc;IAEvB,WAAW,QAAO,QAAQ,CAAC,CAAC,CAAC,CAAkB;gBAE1C,OAAO,EAAE,CAAC;CAGvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigValidator.d.cts","sourceRoot":"","sources":["../../../../src/config/ConfigValidator.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,CAAC;AAEhD,qBAAa,eAAe,CAAC,CAAC,SAAS,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAI;gBAEf,MAAM,EAAE,CAAC;IAIrB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;CAGpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Get } from 'type-fest';
|
|
2
|
+
import { type ScopedSettings } from '#types/AppSettings.types.cts';
|
|
3
|
+
import { type SettingPath } from '#types/Config.types.cts';
|
|
4
|
+
export declare class ScopedSettingsImplementation<T extends object> implements ScopedSettings<T> {
|
|
5
|
+
private readonly reader;
|
|
6
|
+
private readonly section;
|
|
7
|
+
private readonly parentPath;
|
|
8
|
+
constructor(section: T, parentPath: string);
|
|
9
|
+
get<P extends SettingPath<T>>(path: P): Get<T, P> | undefined;
|
|
10
|
+
getAll(): Readonly<T>;
|
|
11
|
+
getOrThrow<P extends SettingPath<T>>(path: P): Get<T, P>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ScopedSettingsImplementation.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopedSettingsImplementation.d.cts","sourceRoot":"","sources":["../../../../src/config/ScopedSettingsImplementation.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,qBAAa,4BAA4B,CAAC,CAAC,SAAS,MAAM,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IACtF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAI;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM;IAM1C,GAAG,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS;IAK7D,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC;IAIrB,UAAU,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;CAUzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAppSettings.d.cts","sourceRoot":"","sources":["../../../../src/config/createAppSettings.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAI5E,eAAO,MAAM,iBAAiB,GAAU,CAAC,SAAS,MAAM,EAAE,gCAIvD,wBAAwB,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CASnD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freezeDeep.d.cts","sourceRoot":"","sources":["../../../../../src/config/helpers/freezeDeep.cts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,CAYxC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Get } from 'type-fest';
|
|
2
|
+
import { type AppSettingsSchema } from '../index.cts';
|
|
3
|
+
import { type SettingPath } from '../types/Config.types.cts';
|
|
4
|
+
export declare function useAppSetting<P extends SettingPath<AppSettingsSchema>>(path: P): Get<AppSettingsSchema, P> | undefined;
|
|
5
|
+
export declare function useAppSetting<T extends object, P extends SettingPath<T>>(path: P): Get<T, P> | undefined;
|
|
6
|
+
//# sourceMappingURL=useAppSetting.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppSetting.d.cts","sourceRoot":"","sources":["../../../../src/hooks/useAppSetting.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;AACxH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Get } from 'type-fest';
|
|
2
|
+
import { type SettingSectionPath } from '#types/Config.types.cts';
|
|
3
|
+
import { type AppSettingsSchema } from '../index.cts';
|
|
4
|
+
export declare function useAppSettings<P extends SettingSectionPath<AppSettingsSchema>>(path: P): Get<AppSettingsSchema, P> | undefined;
|
|
5
|
+
export declare function useAppSettings<T extends object, P extends SettingSectionPath<T>>(path: P): Get<T, P> | undefined;
|
|
6
|
+
//# sourceMappingURL=useAppSettings.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppSettings.d.cts","sourceRoot":"","sources":["../../../../src/hooks/useAppSettings.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,wBAAgB,cAAc,CAAC,CAAC,SAAS,kBAAkB,CAAC,iBAAiB,CAAC,EAC5E,IAAI,EAAE,CAAC,GACN,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;AAEzC,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type InternalAppSettings } from '#types/AppSettings.types.cts';
|
|
2
|
+
import { type AppSettingsSchema } from '../index.cts';
|
|
3
|
+
export declare const AppSettingsContext: import("react").Context<unknown>;
|
|
4
|
+
export declare const useAppSettingsContext: <T extends object = AppSettingsSchema>() => InternalAppSettings<T>;
|
|
5
|
+
//# sourceMappingURL=useAppSettingsContext.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppSettingsContext.d.cts","sourceRoot":"","sources":["../../../../src/hooks/useAppSettingsContext.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,kBAAkB,kCAAoC,CAAC;AAEpE,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,GAAG,iBAAiB,OAAK,mBAAmB,CAAC,CAAC,CAUnG,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { AppSettingsProvider } from '#components/AppSettingsProvider.ctsx';
|
|
2
|
+
export { Setting } from '#components/Setting.ctsx';
|
|
3
|
+
export { useAppSetting } from '#hooks/useAppSetting.cts';
|
|
4
|
+
export { useAppSettings } from '#hooks/useAppSettings.cts';
|
|
5
|
+
export type { AppSettings, ScopedSettings } from '#types/AppSettings.types.cts';
|
|
6
|
+
export type { SettingPath, SettingSectionPath, SettingValue } from '#types/Config.types.cts';
|
|
7
|
+
export interface AppSettingsSchema {
|
|
8
|
+
readonly __appSettingsSchema?: never;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/index.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG5F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC;CACtC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createAppSettings } from '#config/createAppSettings.cts';
|
|
2
|
+
export { AppSettingsSource, type AppSettingsSourceOptions } from '#sources/AppSettingsSource.cts';
|
|
3
|
+
export { EnvironmentSource, type EnvironmentSourceOptions } from '#sources/EnvironmentSource.cts';
|
|
4
|
+
export { RemoteSource, type RemoteSourceOptions } from '#sources/RemoteSource.cts';
|
|
5
|
+
export { MemorySource, type MemorySourceOptions } from '#sources/MemorySource.cts';
|
|
6
|
+
export { type CreateAppSettingsOptions } from '#types/AppSettings.types.cts';
|
|
7
|
+
export type { SettingsSource } from '#types/Source.types.cts';
|
|
8
|
+
//# sourceMappingURL=server.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.cts","sourceRoot":"","sources":["../../../src/server.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type SettingsSource } from '../types/Source.types.cts';
|
|
2
|
+
export interface AppSettingsSourceOptions {
|
|
3
|
+
directory?: string;
|
|
4
|
+
environment?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class AppSettingsSource implements SettingsSource {
|
|
8
|
+
private directory;
|
|
9
|
+
private environment;
|
|
10
|
+
name: string;
|
|
11
|
+
constructor(options: AppSettingsSourceOptions);
|
|
12
|
+
load(): Promise<Record<string, unknown>>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=AppSettingsSource.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppSettingsSource.d.cts","sourceRoot":"","sources":["../../../../src/sources/AppSettingsSource.cts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,iBAAkB,YAAW,cAAc;IACtD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IACrB,IAAI,EAAE,MAAM,CAAC;gBAED,OAAO,EAAE,wBAAwB;IAM9C,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAO/C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SettingsSource } from '../types/Source.types.cts';
|
|
2
|
+
export interface EnvironmentSourceOptions {
|
|
3
|
+
envs: Record<string, string | undefined>;
|
|
4
|
+
name?: string;
|
|
5
|
+
prefix?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class EnvironmentSource implements SettingsSource {
|
|
8
|
+
private readonly envs;
|
|
9
|
+
private readonly prefix;
|
|
10
|
+
private normalizeSegment;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
constructor(options: EnvironmentSourceOptions);
|
|
13
|
+
private parseEnvironmentValue;
|
|
14
|
+
load(): Promise<Record<string, unknown>>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=EnvironmentSource.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnvironmentSource.d.cts","sourceRoot":"","sources":["../../../../src/sources/EnvironmentSource.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,iBAAkB,YAAW,cAAc;IACtD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqC;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,OAAO,CAAC,gBAAgB,CAMV;IAEd,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,wBAAwB;IAMpD,OAAO,CAAC,qBAAqB;IAgB7B,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAyCzC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SettingsSource } from '../types/Source.types.cts';
|
|
2
|
+
export interface MemorySourceOptions {
|
|
3
|
+
name?: string;
|
|
4
|
+
values: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare class MemorySource implements SettingsSource {
|
|
7
|
+
private readonly values;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
constructor(options: MemorySourceOptions);
|
|
10
|
+
load(): Promise<Record<string, unknown>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=MemorySource.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemorySource.d.cts","sourceRoot":"","sources":["../../../../src/sources/MemorySource.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,qBAAa,YAAa,YAAW,cAAc;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,mBAAmB;IAK/C,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAGzC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SettingsSource } from '#types/Source.types.cts';
|
|
2
|
+
export interface RemoteSourceOptions {
|
|
3
|
+
fetch: typeof globalThis.fetch;
|
|
4
|
+
name?: string;
|
|
5
|
+
responsePath?: string;
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class RemoteSource implements SettingsSource {
|
|
9
|
+
private fetch;
|
|
10
|
+
private responsePath?;
|
|
11
|
+
private url;
|
|
12
|
+
name: string;
|
|
13
|
+
constructor(options: RemoteSourceOptions);
|
|
14
|
+
load(): Promise<Record<string, unknown>>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=RemoteSource.d.cts.map
|