@h3ravel/config 1.4.3 → 1.4.4

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/index.cjs CHANGED
@@ -21,17 +21,75 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
 
23
23
  //#endregion
24
+ let __h3ravel_shared = require("@h3ravel/shared");
25
+ __h3ravel_shared = __toESM(__h3ravel_shared);
26
+ let node_fs_promises = require("node:fs/promises");
27
+ node_fs_promises = __toESM(node_fs_promises);
24
28
  let __h3ravel_core = require("@h3ravel/core");
25
29
  __h3ravel_core = __toESM(__h3ravel_core);
26
30
  let __h3ravel_support = require("@h3ravel/support");
27
31
  __h3ravel_support = __toESM(__h3ravel_support);
28
32
  let node_path = require("node:path");
29
33
  node_path = __toESM(node_path);
30
- let node_fs_promises = require("node:fs/promises");
31
- node_fs_promises = __toESM(node_fs_promises);
32
- let __h3ravel_shared = require("@h3ravel/shared");
33
- __h3ravel_shared = __toESM(__h3ravel_shared);
34
34
 
35
+ //#region src/Commands/ConfigPublishCommand.ts
36
+ var ConfigPublishCommand = class extends __h3ravel_core.ConsoleCommand {
37
+ /**
38
+ * The name and signature of the console command.
39
+ *
40
+ * @var string
41
+ */
42
+ signature = `config:publish
43
+ {name? : The name of the configuration file to publish}
44
+ {--all : Publish all configuration files}
45
+ {--force : Overwrite any existing configuration files}
46
+ `;
47
+ /**
48
+ * The console command description.
49
+ *
50
+ * @var string
51
+ */
52
+ description = "Publish configuration files to your application";
53
+ /**
54
+ * List available config files
55
+ */
56
+ configs = ["hashing"];
57
+ /**
58
+ * Create a new seeder class
59
+ */
60
+ async handle() {
61
+ if (this.option("all")) await Promise.all(this.configs.map((e) => this.publish(e)));
62
+ else {
63
+ const name = this.argument("name");
64
+ if (!name) __h3ravel_shared.Logger.error("ERORR: enter a configuration name or pass the --all flag to publish all available configurations.");
65
+ await this.publish(name);
66
+ }
67
+ }
68
+ /**
69
+ * Create a new seeder class
70
+ */
71
+ async publish(name) {
72
+ const force = this.option("force");
73
+ const path$1 = base_path(`src/config/${__h3ravel_support.Str.snake(name)}.ts`);
74
+ if (!force && await __h3ravel_shared.FileSystem.fileExists(path$1)) this.error(`ERORR: ${name} already exists`);
75
+ const dbPkgPath = __h3ravel_shared.FileSystem.findModulePkg("@h3ravel/config", this.kernel.cwd) ?? "";
76
+ const stubPath = node_path.default.join(dbPkgPath, this.getStubName(name));
77
+ if (!await __h3ravel_shared.FileSystem.fileExists(stubPath)) this.error(`ERORR: Config [${name}] does not exist`);
78
+ await (0, node_fs_promises.writeFile)(path$1, await (0, node_fs_promises.readFile)(stubPath, "utf-8"));
79
+ this.info(`INFO: Config ${__h3ravel_shared.Logger.log(`[${node_path.default.relative(process.cwd(), path$1)}]`, "bold", false)} published successfully.`);
80
+ }
81
+ /**
82
+ * Get the configuration file to publish
83
+ *
84
+ * @param name
85
+ * @returns
86
+ */
87
+ getStubName(name) {
88
+ return `dist/stubs/${name}.stub`;
89
+ }
90
+ };
91
+
92
+ //#endregion
35
93
  //#region src/ConfigRepository.ts
36
94
  var ConfigRepository = class {
37
95
  loaded = false;
@@ -127,10 +185,12 @@ var ConfigServiceProvider = class extends __h3ravel_core.ServiceProvider {
127
185
  this.app.make("http.app").use((e) => {
128
186
  repo.set("app.url", e.url.origin);
129
187
  });
188
+ this.commands([ConfigPublishCommand]);
130
189
  }
131
190
  };
132
191
 
133
192
  //#endregion
193
+ exports.ConfigPublishCommand = ConfigPublishCommand;
134
194
  exports.ConfigRepository = ConfigRepository;
135
195
  exports.ConfigServiceProvider = ConfigServiceProvider;
136
196
  exports.EnvLoader = EnvLoader;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["app: Application","path","_app: Application","EnvParser","ServiceProvider","key"],"sources":["../src/ConfigRepository.ts","../src/EnvLoader.ts","../src/Helpers.ts","../src/Providers/ConfigServiceProvider.ts"],"sourcesContent":["import { Application, Registerer } from '@h3ravel/core'\nimport type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\nimport { safeDot, setNested } from '@h3ravel/support'\n\nimport path from 'node:path'\nimport { readdir } from 'node:fs/promises'\n\nexport class ConfigRepository {\n private loaded: boolean = false\n private configs: Record<string, Record<string, any>> = {}\n\n constructor(protected app: Application) { }\n\n // get<X extends Record<string, any>> (): X\n // get<X extends Record<string, any>, T extends Extract<keyof X, string>> (key: T): X[T]\n\n /**\n * Get the defined configurations\n */\n get<X extends Record<string, any>> (): X\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(this.configs, key) ?? def\n }\n\n /**\n * Modify the defined configurations\n */\n set<T extends string> (key: T, value: any): void {\n setNested(this.configs, key, value)\n }\n\n async load () {\n if (!this.loaded) {\n\n const configPath = this.app.getPath('config')\n\n globalThis.env = this.app.make('env')\n Registerer.register(this.app)\n\n const files = (await readdir(configPath)).filter((e) => {\n return !e.includes('.d.ts') && !e.includes('.d.cts') && !e.includes('.map')\n })\n\n for (let i = 0; i < files.length; i++) {\n const configModule = await import(path.join(configPath, files[i]))\n const name = files[i].replaceAll(/\\.ts|\\.js/g, '')\n if (typeof configModule.default === 'function') {\n this.configs[name] = configModule.default(this.app)\n }\n }\n\n this.loaded = true\n }\n return this\n }\n}\n","import type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\n\nimport { Application } from '@h3ravel/core'\nimport { EnvParser } from '@h3ravel/shared'\nimport { safeDot } from '@h3ravel/support'\n\nexport class EnvLoader {\n constructor(protected _app: Application) { }\n\n /**\n * Get the defined environment vars\n */\n get<X extends NodeJS.ProcessEnv> (): X\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(EnvParser.parse(process.env), key) ?? def\n }\n}\n","export class Helpers {\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ConfigRepository, EnvLoader } from '..'\n\nimport { Bindings } from '@h3ravel/shared'\nimport { ServiceProvider } from '@h3ravel/core'\n\n/**\n * Loads configuration and environment files.\n * \n * Load .env and merge with config files.\n * Bind ConfigRepository to the container.\n * \n * Auto-Registered\n */\nexport class ConfigServiceProvider extends ServiceProvider {\n public static priority = 998\n // public static order = 'before:DatabaseServiceProvider';\n\n async register () {\n /**\n * Create singleton to load env\n */\n this.app.singleton('env', () => {\n const env = new EnvLoader(this.app).get\n globalThis.env = env\n return env\n })\n\n /**\n * Initialize the configuration through the repository\n */\n const repo = new ConfigRepository(this.app)\n await repo.load()\n\n /**\n * Create singleton to load configurations\n */\n this.app.singleton('config', () => {\n const config = {\n get: (key, def) => repo.get(key as any, def),\n set: repo.set\n } as Bindings['config']\n\n globalThis.config = ((key: string | Record<string, any>, def: any) => {\n if (!key || typeof key === 'string') {\n return config.get(key, def)\n }\n\n Object.entries(key).forEach(([key, value]) => {\n config.set(key, value)\n })\n }) as never\n\n return config\n })\n\n this.app.make('http.app').use(e => {\n repo.set('app.url', e.url.origin)\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAa,mBAAb,MAA8B;CAC1B,AAAQ,SAAkB;CAC1B,AAAQ,UAA+C,EAAE;CAEzD,YAAY,AAAUA,KAAkB;EAAlB;;CAUtB,IAAgE,KAAS,KAAgB;AACrF,wCAAe,KAAK,SAAS,IAAI,IAAI;;;;;CAMzC,IAAuB,KAAQ,OAAkB;AAC7C,mCAAU,KAAK,SAAS,KAAK,MAAM;;CAGvC,MAAM,OAAQ;AACV,MAAI,CAAC,KAAK,QAAQ;GAEd,MAAM,aAAa,KAAK,IAAI,QAAQ,SAAS;AAE7C,cAAW,MAAM,KAAK,IAAI,KAAK,MAAM;AACrC,6BAAW,SAAS,KAAK,IAAI;GAE7B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O;IACT;AAEF,OAAK,IAAI,KAAK,WAAW,CAAC,KAAI,MAAK;AAC/B,QAAK,IAAI,WAAW,EAAE,IAAI,OAAO;IACnC"}
1
+ {"version":3,"file":"index.cjs","names":["ConsoleCommand","path","Str","FileSystem","npath","Logger","app: Application","path","_app: Application","EnvParser","ServiceProvider","key"],"sources":["../src/Commands/ConfigPublishCommand.ts","../src/ConfigRepository.ts","../src/EnvLoader.ts","../src/Helpers.ts","../src/Providers/ConfigServiceProvider.ts"],"sourcesContent":["import { FileSystem, Logger } from '@h3ravel/shared'\nimport { readFile, writeFile } from 'node:fs/promises'\n\nimport { ConsoleCommand } from '@h3ravel/core'\nimport { Str } from '@h3ravel/support'\nimport npath from 'node:path'\n\nexport class ConfigPublishCommand extends ConsoleCommand {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `config:publish\n {name? : The name of the configuration file to publish}\n {--all : Publish all configuration files}\n {--force : Overwrite any existing configuration files}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Publish configuration files to your application'\n\n /**\n * List available config files\n */\n protected configs = [\n 'hashing'\n ] as const\n\n /**\n * Create a new seeder class\n */\n public async handle () {\n const all = this.option('all')\n if (all) {\n await Promise.all(this.configs.map(e => this.publish(e)))\n } else {\n const name = this.argument('name')\n if (!name) Logger.error('ERORR: enter a configuration name or pass the --all flag to publish all available configurations.')\n await this.publish(name)\n }\n }\n\n /**\n * Create a new seeder class\n */\n protected async publish (name: 'hashing') {\n const force = this.option('force')\n const path = base_path(`src/config/${Str.snake(name)}.ts`)\n\n // Check if the config already exists\n if (!force && await FileSystem.fileExists(path)) {\n this.error(`ERORR: ${name} already exists`)\n }\n\n const dbPkgPath = FileSystem.findModulePkg('@h3ravel/config', this.kernel.cwd) ?? ''\n const stubPath = npath.join(dbPkgPath, this.getStubName(name))\n\n // Check if the stub exists\n if (!await FileSystem.fileExists(stubPath)) {\n this.error(`ERORR: Config [${name}] does not exist`)\n }\n\n await writeFile(path, await readFile(stubPath, 'utf-8'))\n\n this.info(\n `INFO: Config ${Logger.log(`[${npath.relative(process.cwd(), path)}]`, 'bold', false)} published successfully.`\n )\n }\n\n /**\n * Get the configuration file to publish\n * \n * @param name \n * @returns \n */\n getStubName (name: 'hashing') {\n return `dist/stubs/${name}.stub`\n }\n}\n","import { Application, Registerer } from '@h3ravel/core'\nimport type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\nimport { safeDot, setNested } from '@h3ravel/support'\n\nimport path from 'node:path'\nimport { readdir } from 'node:fs/promises'\n\nexport class ConfigRepository {\n private loaded: boolean = false\n private configs: Record<string, Record<string, any>> = {}\n\n constructor(protected app: Application) { }\n\n // get<X extends Record<string, any>> (): X\n // get<X extends Record<string, any>, T extends Extract<keyof X, string>> (key: T): X[T]\n\n /**\n * Get the defined configurations\n */\n get<X extends Record<string, any>> (): X\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(this.configs, key) ?? def\n }\n\n /**\n * Modify the defined configurations\n */\n set<T extends string> (key: T, value: any): void {\n setNested(this.configs, key, value)\n }\n\n async load () {\n if (!this.loaded) {\n\n const configPath = this.app.getPath('config')\n\n globalThis.env = this.app.make('env')\n Registerer.register(this.app)\n\n const files = (await readdir(configPath)).filter((e) => {\n return !e.includes('.d.ts') && !e.includes('.d.cts') && !e.includes('.map')\n })\n\n for (let i = 0; i < files.length; i++) {\n const configModule = await import(path.join(configPath, files[i]))\n const name = files[i].replaceAll(/\\.ts|\\.js/g, '')\n if (typeof configModule.default === 'function') {\n this.configs[name] = configModule.default(this.app)\n }\n }\n\n this.loaded = true\n }\n return this\n }\n}\n","import type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\n\nimport { Application } from '@h3ravel/core'\nimport { EnvParser } from '@h3ravel/shared'\nimport { safeDot } from '@h3ravel/support'\n\nexport class EnvLoader {\n constructor(protected _app: Application) { }\n\n /**\n * Get the defined environment vars\n */\n get<X extends NodeJS.ProcessEnv> (): X\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(EnvParser.parse(process.env), key) ?? def\n }\n}\n","export class Helpers {\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ConfigRepository, EnvLoader } from '..'\n\nimport { Bindings } from '@h3ravel/shared'\nimport { ConfigPublishCommand } from '../Commands/ConfigPublishCommand'\nimport { ServiceProvider } from '@h3ravel/core'\n\n/**\n * Loads configuration and environment files.\n * \n * Load .env and merge with config files.\n * Bind ConfigRepository to the container.\n * \n * Auto-Registered\n */\nexport class ConfigServiceProvider extends ServiceProvider {\n public static priority = 998\n // public static order = 'before:DatabaseServiceProvider';\n\n async register () {\n /**\n * Create singleton to load env\n */\n this.app.singleton('env', () => {\n const env = new EnvLoader(this.app).get\n globalThis.env = env\n return env\n })\n\n /**\n * Initialize the configuration through the repository\n */\n const repo = new ConfigRepository(this.app)\n await repo.load()\n\n /**\n * Create singleton to load configurations\n */\n this.app.singleton('config', () => {\n const config = {\n get: (key, def) => repo.get(key as any, def),\n set: repo.set\n } as Bindings['config']\n\n globalThis.config = ((key: string | Record<string, any>, def: any) => {\n if (!key || typeof key === 'string') {\n return config.get(key, def)\n }\n\n Object.entries(key).forEach(([key, value]) => {\n config.set(key, value)\n })\n }) as never\n\n return config\n })\n\n this.app.make('http.app').use(e => {\n repo.set('app.url', e.url.origin)\n })\n\n this.commands([ConfigPublishCommand])\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAa,uBAAb,cAA0CA,8BAAe;;;;;;CAOrD,AAAU,YAAoB;;;;;;;;;;CAU9B,AAAU,cAAsB;;;;CAKhC,AAAU,UAAU,CAChB,UACH;;;;CAKD,MAAa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IAAI;AAG/B,WAAO,QAAQ,IAAI,CAAC,SAAS,CAACC,OAAK,WAAW;AAC1C,YAAO,IAAIA,OAAK,MAAM;MACxB;;AAGN,UAAO;IACT;AAEF,OAAK,IAAI,KAAK,WAAW,CAAC,KAAI,MAAK;AAC/B,QAAK,IAAI,WAAW,EAAE,IAAI,OAAO;IACnC;AAEF,OAAK,SAAS,CAAC,qBAAqB,CAAC"}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,42 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
- import { Application, ServiceProvider } from "@h3ravel/core";
2
+ import { Application, ConsoleCommand, ServiceProvider } from "@h3ravel/core";
3
3
  import { DotNestedKeys, DotNestedValue } from "@h3ravel/shared";
4
4
 
5
+ //#region src/Commands/ConfigPublishCommand.d.ts
6
+ declare class ConfigPublishCommand extends ConsoleCommand {
7
+ /**
8
+ * The name and signature of the console command.
9
+ *
10
+ * @var string
11
+ */
12
+ protected signature: string;
13
+ /**
14
+ * The console command description.
15
+ *
16
+ * @var string
17
+ */
18
+ protected description: string;
19
+ /**
20
+ * List available config files
21
+ */
22
+ protected configs: readonly ["hashing"];
23
+ /**
24
+ * Create a new seeder class
25
+ */
26
+ handle(): Promise<void>;
27
+ /**
28
+ * Create a new seeder class
29
+ */
30
+ protected publish(name: 'hashing'): Promise<void>;
31
+ /**
32
+ * Get the configuration file to publish
33
+ *
34
+ * @param name
35
+ * @returns
36
+ */
37
+ getStubName(name: 'hashing'): string;
38
+ }
39
+ //#endregion
5
40
  //#region src/ConfigRepository.d.ts
6
41
  declare class ConfigRepository {
7
42
  protected app: Application;
@@ -48,5 +83,5 @@ declare class ConfigServiceProvider extends ServiceProvider {
48
83
  register(): Promise<void>;
49
84
  }
50
85
  //#endregion
51
- export { ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
86
+ export { ConfigPublishCommand, ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
52
87
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,7 +1,42 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
- import { Application, ServiceProvider } from "@h3ravel/core";
3
2
  import { DotNestedKeys, DotNestedValue } from "@h3ravel/shared";
3
+ import { Application, ConsoleCommand, ServiceProvider } from "@h3ravel/core";
4
4
 
5
+ //#region src/Commands/ConfigPublishCommand.d.ts
6
+ declare class ConfigPublishCommand extends ConsoleCommand {
7
+ /**
8
+ * The name and signature of the console command.
9
+ *
10
+ * @var string
11
+ */
12
+ protected signature: string;
13
+ /**
14
+ * The console command description.
15
+ *
16
+ * @var string
17
+ */
18
+ protected description: string;
19
+ /**
20
+ * List available config files
21
+ */
22
+ protected configs: readonly ["hashing"];
23
+ /**
24
+ * Create a new seeder class
25
+ */
26
+ handle(): Promise<void>;
27
+ /**
28
+ * Create a new seeder class
29
+ */
30
+ protected publish(name: 'hashing'): Promise<void>;
31
+ /**
32
+ * Get the configuration file to publish
33
+ *
34
+ * @param name
35
+ * @returns
36
+ */
37
+ getStubName(name: 'hashing'): string;
38
+ }
39
+ //#endregion
5
40
  //#region src/ConfigRepository.d.ts
6
41
  declare class ConfigRepository {
7
42
  protected app: Application;
@@ -48,5 +83,5 @@ declare class ConfigServiceProvider extends ServiceProvider {
48
83
  register(): Promise<void>;
49
84
  }
50
85
  //#endregion
51
- export { ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
86
+ export { ConfigPublishCommand, ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
52
87
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,9 +1,67 @@
1
- import { Registerer, ServiceProvider } from "@h3ravel/core";
2
- import { safeDot, setNested } from "@h3ravel/support";
3
- import path from "node:path";
4
- import { readdir } from "node:fs/promises";
5
- import { EnvParser } from "@h3ravel/shared";
1
+ import { EnvParser, FileSystem, Logger } from "@h3ravel/shared";
2
+ import { readFile, readdir, writeFile } from "node:fs/promises";
3
+ import { ConsoleCommand, Registerer, ServiceProvider } from "@h3ravel/core";
4
+ import { Str, safeDot, setNested } from "@h3ravel/support";
5
+ import npath from "node:path";
6
6
 
7
+ //#region src/Commands/ConfigPublishCommand.ts
8
+ var ConfigPublishCommand = class extends ConsoleCommand {
9
+ /**
10
+ * The name and signature of the console command.
11
+ *
12
+ * @var string
13
+ */
14
+ signature = `config:publish
15
+ {name? : The name of the configuration file to publish}
16
+ {--all : Publish all configuration files}
17
+ {--force : Overwrite any existing configuration files}
18
+ `;
19
+ /**
20
+ * The console command description.
21
+ *
22
+ * @var string
23
+ */
24
+ description = "Publish configuration files to your application";
25
+ /**
26
+ * List available config files
27
+ */
28
+ configs = ["hashing"];
29
+ /**
30
+ * Create a new seeder class
31
+ */
32
+ async handle() {
33
+ if (this.option("all")) await Promise.all(this.configs.map((e) => this.publish(e)));
34
+ else {
35
+ const name = this.argument("name");
36
+ if (!name) Logger.error("ERORR: enter a configuration name or pass the --all flag to publish all available configurations.");
37
+ await this.publish(name);
38
+ }
39
+ }
40
+ /**
41
+ * Create a new seeder class
42
+ */
43
+ async publish(name) {
44
+ const force = this.option("force");
45
+ const path = base_path(`src/config/${Str.snake(name)}.ts`);
46
+ if (!force && await FileSystem.fileExists(path)) this.error(`ERORR: ${name} already exists`);
47
+ const dbPkgPath = FileSystem.findModulePkg("@h3ravel/config", this.kernel.cwd) ?? "";
48
+ const stubPath = npath.join(dbPkgPath, this.getStubName(name));
49
+ if (!await FileSystem.fileExists(stubPath)) this.error(`ERORR: Config [${name}] does not exist`);
50
+ await writeFile(path, await readFile(stubPath, "utf-8"));
51
+ this.info(`INFO: Config ${Logger.log(`[${npath.relative(process.cwd(), path)}]`, "bold", false)} published successfully.`);
52
+ }
53
+ /**
54
+ * Get the configuration file to publish
55
+ *
56
+ * @param name
57
+ * @returns
58
+ */
59
+ getStubName(name) {
60
+ return `dist/stubs/${name}.stub`;
61
+ }
62
+ };
63
+
64
+ //#endregion
7
65
  //#region src/ConfigRepository.ts
8
66
  var ConfigRepository = class {
9
67
  loaded = false;
@@ -29,7 +87,7 @@ var ConfigRepository = class {
29
87
  return !e.includes(".d.ts") && !e.includes(".d.cts") && !e.includes(".map");
30
88
  });
31
89
  for (let i = 0; i < files.length; i++) {
32
- const configModule = await import(path.join(configPath, files[i]));
90
+ const configModule = await import(npath.join(configPath, files[i]));
33
91
  const name = files[i].replaceAll(/\.ts|\.js/g, "");
34
92
  if (typeof configModule.default === "function") this.configs[name] = configModule.default(this.app);
35
93
  }
@@ -99,9 +157,10 @@ var ConfigServiceProvider = class extends ServiceProvider {
99
157
  this.app.make("http.app").use((e) => {
100
158
  repo.set("app.url", e.url.origin);
101
159
  });
160
+ this.commands([ConfigPublishCommand]);
102
161
  }
103
162
  };
104
163
 
105
164
  //#endregion
106
- export { ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
165
+ export { ConfigPublishCommand, ConfigRepository, ConfigServiceProvider, EnvLoader, Helpers };
107
166
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["app: Application","_app: Application","key"],"sources":["../src/ConfigRepository.ts","../src/EnvLoader.ts","../src/Helpers.ts","../src/Providers/ConfigServiceProvider.ts"],"sourcesContent":["import { Application, Registerer } from '@h3ravel/core'\nimport type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\nimport { safeDot, setNested } from '@h3ravel/support'\n\nimport path from 'node:path'\nimport { readdir } from 'node:fs/promises'\n\nexport class ConfigRepository {\n private loaded: boolean = false\n private configs: Record<string, Record<string, any>> = {}\n\n constructor(protected app: Application) { }\n\n // get<X extends Record<string, any>> (): X\n // get<X extends Record<string, any>, T extends Extract<keyof X, string>> (key: T): X[T]\n\n /**\n * Get the defined configurations\n */\n get<X extends Record<string, any>> (): X\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(this.configs, key) ?? def\n }\n\n /**\n * Modify the defined configurations\n */\n set<T extends string> (key: T, value: any): void {\n setNested(this.configs, key, value)\n }\n\n async load () {\n if (!this.loaded) {\n\n const configPath = this.app.getPath('config')\n\n globalThis.env = this.app.make('env')\n Registerer.register(this.app)\n\n const files = (await readdir(configPath)).filter((e) => {\n return !e.includes('.d.ts') && !e.includes('.d.cts') && !e.includes('.map')\n })\n\n for (let i = 0; i < files.length; i++) {\n const configModule = await import(path.join(configPath, files[i]))\n const name = files[i].replaceAll(/\\.ts|\\.js/g, '')\n if (typeof configModule.default === 'function') {\n this.configs[name] = configModule.default(this.app)\n }\n }\n\n this.loaded = true\n }\n return this\n }\n}\n","import type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\n\nimport { Application } from '@h3ravel/core'\nimport { EnvParser } from '@h3ravel/shared'\nimport { safeDot } from '@h3ravel/support'\n\nexport class EnvLoader {\n constructor(protected _app: Application) { }\n\n /**\n * Get the defined environment vars\n */\n get<X extends NodeJS.ProcessEnv> (): X\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(EnvParser.parse(process.env), key) ?? def\n }\n}\n","export class Helpers {\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ConfigRepository, EnvLoader } from '..'\n\nimport { Bindings } from '@h3ravel/shared'\nimport { ServiceProvider } from '@h3ravel/core'\n\n/**\n * Loads configuration and environment files.\n * \n * Load .env and merge with config files.\n * Bind ConfigRepository to the container.\n * \n * Auto-Registered\n */\nexport class ConfigServiceProvider extends ServiceProvider {\n public static priority = 998\n // public static order = 'before:DatabaseServiceProvider';\n\n async register () {\n /**\n * Create singleton to load env\n */\n this.app.singleton('env', () => {\n const env = new EnvLoader(this.app).get\n globalThis.env = env\n return env\n })\n\n /**\n * Initialize the configuration through the repository\n */\n const repo = new ConfigRepository(this.app)\n await repo.load()\n\n /**\n * Create singleton to load configurations\n */\n this.app.singleton('config', () => {\n const config = {\n get: (key, def) => repo.get(key as any, def),\n set: repo.set\n } as Bindings['config']\n\n globalThis.config = ((key: string | Record<string, any>, def: any) => {\n if (!key || typeof key === 'string') {\n return config.get(key, def)\n }\n\n Object.entries(key).forEach(([key, value]) => {\n config.set(key, value)\n })\n }) as never\n\n return config\n })\n\n this.app.make('http.app').use(e => {\n repo.set('app.url', e.url.origin)\n })\n }\n}\n"],"mappings":";;;;;;;AAOA,IAAa,mBAAb,MAA8B;CAC1B,AAAQ,SAAkB;CAC1B,AAAQ,UAA+C,EAAE;CAEzD,YAAY,AAAUA,KAAkB;EAAlB;;CAUtB,IAAgE,KAAS,KAAgB;AACrF,SAAO,QAAQ,KAAK,SAAS,IAAI,IAAI;;;;;CAMzC,IAAuB,KAAQ,OAAkB;AAC7C,YAAU,KAAK,SAAS,KAAK,MAAM;;CAGvC,MAAM,OAAQ;AACV,MAAI,CAAC,KAAK,QAAQ;GAEd,MAAM,aAAa,KAAK,IAAI,QAAQ,SAAS;AAE7C,cAAW,MAAM,KAAK,IAAI,KAAK,MAAM;AACrC,cAAW,SAAS,KAAK,IAAI;GAE7B,MAAM,SAAS,MAAM,QAAQ,WAAW,EAAE,QAAQ,MAAM;AACpD,WAAO,CAAC,EAAE,SAAS,QAAQ,IAAI,CAAC,EAAE,SAAS,SAAS,IAAI,CAAC,EAAE,SAAS,OAAO;KAC7E;AAEF,QAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;IACnC,MAAM,eAAe,MAAM,OAAO,KAAK,KAAK,YAAY,MAAM,GAAG;IACjE,MAAM,OAAO,MAAM,GAAG,WAAW,cAAc,GAAG;AAClD,QAAI,OAAO,aAAa,YAAY,WAChC,MAAK,QAAQ,QAAQ,aAAa,QAAQ,KAAK,IAAI;;AAI3D,QAAK,SAAS;;AAElB,SAAO;;;;;;AChDf,IAAa,YAAb,MAAuB;CACnB,YAAY,AAAUC,MAAmB;EAAnB;;CAOtB,IAA8D,KAAS,KAAgB;AACnF,SAAO,QAAQ,UAAU,MAAM,QAAQ,IAAI,EAAE,IAAI,IAAI;;;;;;ACf7D,IAAa,UAAb,MAAqB;;;;;;;;;;;;ACerB,IAAa,wBAAb,cAA2C,gBAAgB;CACvD,OAAc,WAAW;CAGzB,MAAM,WAAY;;;;AAId,OAAK,IAAI,UAAU,aAAa;GAC5B,MAAM,MAAM,IAAI,UAAU,KAAK,IAAI,CAAC;AACpC,cAAW,MAAM;AACjB,UAAO;IACT;;;;EAKF,MAAM,OAAO,IAAI,iBAAiB,KAAK,IAAI;AAC3C,QAAM,KAAK,MAAM;;;;AAKjB,OAAK,IAAI,UAAU,gBAAgB;GAC/B,MAAM,SAAS;IACX,MAAM,KAAK,QAAQ,KAAK,IAAI,KAAY,IAAI;IAC5C,KAAK,KAAK;IACb;AAED,cAAW,WAAW,KAAmC,QAAa;AAClE,QAAI,CAAC,OAAO,OAAO,QAAQ,SACvB,QAAO,OAAO,IAAI,KAAK,IAAI;AAG/B,WAAO,QAAQ,IAAI,CAAC,SAAS,CAACC,OAAK,WAAW;AAC1C,YAAO,IAAIA,OAAK,MAAM;MACxB;;AAGN,UAAO;IACT;AAEF,OAAK,IAAI,KAAK,WAAW,CAAC,KAAI,MAAK;AAC/B,QAAK,IAAI,WAAW,EAAE,IAAI,OAAO;IACnC"}
1
+ {"version":3,"file":"index.js","names":["app: Application","path","_app: Application","key"],"sources":["../src/Commands/ConfigPublishCommand.ts","../src/ConfigRepository.ts","../src/EnvLoader.ts","../src/Helpers.ts","../src/Providers/ConfigServiceProvider.ts"],"sourcesContent":["import { FileSystem, Logger } from '@h3ravel/shared'\nimport { readFile, writeFile } from 'node:fs/promises'\n\nimport { ConsoleCommand } from '@h3ravel/core'\nimport { Str } from '@h3ravel/support'\nimport npath from 'node:path'\n\nexport class ConfigPublishCommand extends ConsoleCommand {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `config:publish\n {name? : The name of the configuration file to publish}\n {--all : Publish all configuration files}\n {--force : Overwrite any existing configuration files}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Publish configuration files to your application'\n\n /**\n * List available config files\n */\n protected configs = [\n 'hashing'\n ] as const\n\n /**\n * Create a new seeder class\n */\n public async handle () {\n const all = this.option('all')\n if (all) {\n await Promise.all(this.configs.map(e => this.publish(e)))\n } else {\n const name = this.argument('name')\n if (!name) Logger.error('ERORR: enter a configuration name or pass the --all flag to publish all available configurations.')\n await this.publish(name)\n }\n }\n\n /**\n * Create a new seeder class\n */\n protected async publish (name: 'hashing') {\n const force = this.option('force')\n const path = base_path(`src/config/${Str.snake(name)}.ts`)\n\n // Check if the config already exists\n if (!force && await FileSystem.fileExists(path)) {\n this.error(`ERORR: ${name} already exists`)\n }\n\n const dbPkgPath = FileSystem.findModulePkg('@h3ravel/config', this.kernel.cwd) ?? ''\n const stubPath = npath.join(dbPkgPath, this.getStubName(name))\n\n // Check if the stub exists\n if (!await FileSystem.fileExists(stubPath)) {\n this.error(`ERORR: Config [${name}] does not exist`)\n }\n\n await writeFile(path, await readFile(stubPath, 'utf-8'))\n\n this.info(\n `INFO: Config ${Logger.log(`[${npath.relative(process.cwd(), path)}]`, 'bold', false)} published successfully.`\n )\n }\n\n /**\n * Get the configuration file to publish\n * \n * @param name \n * @returns \n */\n getStubName (name: 'hashing') {\n return `dist/stubs/${name}.stub`\n }\n}\n","import { Application, Registerer } from '@h3ravel/core'\nimport type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\nimport { safeDot, setNested } from '@h3ravel/support'\n\nimport path from 'node:path'\nimport { readdir } from 'node:fs/promises'\n\nexport class ConfigRepository {\n private loaded: boolean = false\n private configs: Record<string, Record<string, any>> = {}\n\n constructor(protected app: Application) { }\n\n // get<X extends Record<string, any>> (): X\n // get<X extends Record<string, any>, T extends Extract<keyof X, string>> (key: T): X[T]\n\n /**\n * Get the defined configurations\n */\n get<X extends Record<string, any>> (): X\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends Record<string, any>, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(this.configs, key) ?? def\n }\n\n /**\n * Modify the defined configurations\n */\n set<T extends string> (key: T, value: any): void {\n setNested(this.configs, key, value)\n }\n\n async load () {\n if (!this.loaded) {\n\n const configPath = this.app.getPath('config')\n\n globalThis.env = this.app.make('env')\n Registerer.register(this.app)\n\n const files = (await readdir(configPath)).filter((e) => {\n return !e.includes('.d.ts') && !e.includes('.d.cts') && !e.includes('.map')\n })\n\n for (let i = 0; i < files.length; i++) {\n const configModule = await import(path.join(configPath, files[i]))\n const name = files[i].replaceAll(/\\.ts|\\.js/g, '')\n if (typeof configModule.default === 'function') {\n this.configs[name] = configModule.default(this.app)\n }\n }\n\n this.loaded = true\n }\n return this\n }\n}\n","import type { DotNestedKeys, DotNestedValue } from '@h3ravel/shared'\n\nimport { Application } from '@h3ravel/core'\nimport { EnvParser } from '@h3ravel/shared'\nimport { safeDot } from '@h3ravel/support'\n\nexport class EnvLoader {\n constructor(protected _app: Application) { }\n\n /**\n * Get the defined environment vars\n */\n get<X extends NodeJS.ProcessEnv> (): X\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key: K, def?: any): DotNestedValue<X, K>\n get<X extends NodeJS.ProcessEnv, K extends DotNestedKeys<X>> (key?: K, def?: any): any {\n return safeDot(EnvParser.parse(process.env), key) ?? def\n }\n}\n","export class Helpers {\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ConfigRepository, EnvLoader } from '..'\n\nimport { Bindings } from '@h3ravel/shared'\nimport { ConfigPublishCommand } from '../Commands/ConfigPublishCommand'\nimport { ServiceProvider } from '@h3ravel/core'\n\n/**\n * Loads configuration and environment files.\n * \n * Load .env and merge with config files.\n * Bind ConfigRepository to the container.\n * \n * Auto-Registered\n */\nexport class ConfigServiceProvider extends ServiceProvider {\n public static priority = 998\n // public static order = 'before:DatabaseServiceProvider';\n\n async register () {\n /**\n * Create singleton to load env\n */\n this.app.singleton('env', () => {\n const env = new EnvLoader(this.app).get\n globalThis.env = env\n return env\n })\n\n /**\n * Initialize the configuration through the repository\n */\n const repo = new ConfigRepository(this.app)\n await repo.load()\n\n /**\n * Create singleton to load configurations\n */\n this.app.singleton('config', () => {\n const config = {\n get: (key, def) => repo.get(key as any, def),\n set: repo.set\n } as Bindings['config']\n\n globalThis.config = ((key: string | Record<string, any>, def: any) => {\n if (!key || typeof key === 'string') {\n return config.get(key, def)\n }\n\n Object.entries(key).forEach(([key, value]) => {\n config.set(key, value)\n })\n }) as never\n\n return config\n })\n\n this.app.make('http.app').use(e => {\n repo.set('app.url', e.url.origin)\n })\n\n this.commands([ConfigPublishCommand])\n }\n}\n"],"mappings":";;;;;;;AAOA,IAAa,uBAAb,cAA0C,eAAe;;;;;;CAOrD,AAAU,YAAoB;;;;;;;;;;CAU9B,AAAU,cAAsB;;;;CAKhC,AAAU,UAAU,CAChB,UACH;;;;CAKD,MAAa,SAAU;AAEnB,MADY,KAAK,OAAO,MAAM,CAE1B,OAAM,QAAQ,IAAI,KAAK,QAAQ,KAAI,MAAK,KAAK,QAAQ,EAAE,CAAC,CAAC;OACtD;GACH,MAAM,OAAO,KAAK,SAAS,OAAO;AAClC,OAAI,CAAC,KAAM,QAAO,MAAM,oGAAoG;AAC5H,SAAM,KAAK,QAAQ,KAAK;;;;;;CAOhC,MAAgB,QAAS,MAAiB;EACtC,MAAM,QAAQ,KAAK,OAAO,QAAQ;EAClC,MAAM,OAAO,UAAU,cAAc,IAAI,MAAM,KAAK,CAAC,KAAK;AAG1D,MAAI,CAAC,SAAS,MAAM,WAAW,WAAW,KAAK,CAC3C,MAAK,MAAM,UAAU,KAAK,iBAAiB;EAG/C,MAAM,YAAY,WAAW,cAAc,mBAAmB,KAAK,OAAO,IAAI,IAAI;EAClF,MAAM,WAAW,MAAM,KAAK,WAAW,KAAK,YAAY,KAAK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AY,AAAUC,MAAmB;EAAnB;;CAOtB,IAA8D,KAAS,KAAgB;AACnF,SAAO,QAAQ,UAAU,MAAM,QAAQ,IAAI,EAAE,IAAI,IAAI;;;;;;ACf7D,IAAa,UAAb,MAAqB;;;;;;;;;;;;ACgBrB,IAAa,wBAAb,cAA2C,gBAAgB;CACvD,OAAc,WAAW;CAGzB,MAAM,WAAY;;;;AAId,OAAK,IAAI,UAAU,aAAa;GAC5B,MAAM,MAAM,IAAI,UAAU,KAAK,IAAI,CAAC;AACpC,cAAW,MAAM;AACjB,UAAO;IACT;;;;EAKF,MAAM,OAAO,IAAI,iBAAiB,KAAK,IAAI;AAC3C,QAAM,KAAK,MAAM;;;;AAKjB,OAAK,IAAI,UAAU,gBAAgB;GAC/B,MAAM,SAAS;IACX,MAAM,KAAK,QAAQ,KAAK,IAAI,KAAY,IAAI;IAC5C,KAAK,KAAK;IACb;AAED,cAAW,WAAW,KAAmC,QAAa;AAClE,QAAI,CAAC,OAAO,OAAO,QAAQ,SACvB,QAAO,OAAO,IAAI,KAAK,IAAI;AAG/B,WAAO,QAAQ,IAAI,CAAC,SAAS,CAACC,OAAK,WAAW;AAC1C,YAAO,IAAIA,OAAK,MAAM;MACxB;;AAGN,UAAO;IACT;AAEF,OAAK,IAAI,KAAK,WAAW,CAAC,KAAI,MAAK;AAC/B,QAAK,IAAI,WAAW,EAAE,IAAI,OAAO;IACnC;AAEF,OAAK,SAAS,CAAC,qBAAqB,CAAC"}
@@ -0,0 +1,67 @@
1
+ export default () => {
2
+ return {
3
+
4
+ /*
5
+ |--------------------------------------------------------------------------
6
+ | Default Hash Driver
7
+ |--------------------------------------------------------------------------
8
+ |
9
+ | This option controls the default hash driver that will be used to hash
10
+ | passwords for your application. By default, the bcrypt algorithm is
11
+ | used; however, you remain free to modify this option if you wish.
12
+ |
13
+ | Supported: "bcrypt", "argon", "argon2id"
14
+ |
15
+ */
16
+
17
+ 'driver': env('HASH_DRIVER', 'bcrypt'),
18
+
19
+ /*
20
+ |--------------------------------------------------------------------------
21
+ | Bcrypt Options
22
+ |--------------------------------------------------------------------------
23
+ |
24
+ | Here you may specify the configuration options that should be used when
25
+ | passwords are hashed using the Bcrypt algorithm. This will allow you
26
+ | to control the amount of time it takes to hash the given password.
27
+ |
28
+ */
29
+
30
+ 'bcrypt': {
31
+ 'rounds': env('BCRYPT_ROUNDS', 12),
32
+ 'verify': env('HASH_VERIFY', true),
33
+ 'limit': env('BCRYPT_LIMIT', null),
34
+ },
35
+
36
+ /*
37
+ |--------------------------------------------------------------------------
38
+ | Argon Options
39
+ |--------------------------------------------------------------------------
40
+ |
41
+ | Here you may specify the configuration options that should be used when
42
+ | passwords are hashed using the Argon algorithm. These will allow you
43
+ | to control the amount of time it takes to hash the given password.
44
+ |
45
+ */
46
+
47
+ 'argon': {
48
+ 'memory': env('ARGON_MEMORY', 65536),
49
+ 'threads': env('ARGON_THREADS', 1),
50
+ 'time': env('ARGON_TIME', 4),
51
+ 'verify': env('HASH_VERIFY', true),
52
+ },
53
+
54
+ /*
55
+ |--------------------------------------------------------------------------
56
+ | Rehash On Login
57
+ |--------------------------------------------------------------------------
58
+ |
59
+ | Setting this option to true will tell Laravel to automatically rehash
60
+ | the user's password during login if the configured work factor for
61
+ | the algorithm has changed, allowing graceful upgrades of hashes.
62
+ |
63
+ */
64
+
65
+ 'rehash_on_login': true,
66
+ }
67
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/config",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Environment/config loading and management system for H3ravel.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -36,13 +36,13 @@
36
36
  "laravel"
37
37
  ],
38
38
  "dependencies": {
39
- "@h3ravel/shared": "^0.20.11",
40
- "@h3ravel/support": "^0.10.4"
39
+ "@h3ravel/shared": "^0.22.1",
40
+ "@h3ravel/support": "^0.14.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "tsx": "^4.20.5",
44
44
  "typescript": "^5.9.2",
45
- "@h3ravel/core": "^1.11.1"
45
+ "@h3ravel/core": "^1.15.0"
46
46
  },
47
47
  "scripts": {
48
48
  "barrel": "barrelsby --directory src --delete --singleQuotes",