@devmoods/express-extras 0.47.3 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/config.d.ts +38 -0
  2. package/dist/{src/config.js → config.js} +5 -15
  3. package/package.json +1 -1
  4. package/dist/src/config.d.ts +0 -38
  5. /package/dist/{src/__tests__ → __tests__}/__migrations__/1_a.d.ts +0 -0
  6. /package/dist/{src/__tests__ → __tests__}/__migrations__/1_a.js +0 -0
  7. /package/dist/{src/auth → auth}/emailAndPassword.d.ts +0 -0
  8. /package/dist/{src/auth → auth}/emailAndPassword.js +0 -0
  9. /package/dist/{src/auth → auth}/errors.d.ts +0 -0
  10. /package/dist/{src/auth → auth}/errors.js +0 -0
  11. /package/dist/{src/auth → auth}/passwordless.d.ts +0 -0
  12. /package/dist/{src/auth → auth}/passwordless.js +0 -0
  13. /package/dist/{src/auth → auth}/token.d.ts +0 -0
  14. /package/dist/{src/auth → auth}/token.js +0 -0
  15. /package/dist/{src/auth → auth}/types.d.ts +0 -0
  16. /package/dist/{src/auth → auth}/types.js +0 -0
  17. /package/dist/{src/auth.d.ts → auth.d.ts} +0 -0
  18. /package/dist/{src/auth.js → auth.js} +0 -0
  19. /package/dist/{src/cache.d.ts → cache.d.ts} +0 -0
  20. /package/dist/{src/cache.js → cache.js} +0 -0
  21. /package/dist/{src/cli.d.ts → cli.d.ts} +0 -0
  22. /package/dist/{src/cli.js → cli.js} +0 -0
  23. /package/dist/{src/context.d.ts → context.d.ts} +0 -0
  24. /package/dist/{src/context.js → context.js} +0 -0
  25. /package/dist/{src/csrf.d.ts → csrf.d.ts} +0 -0
  26. /package/dist/{src/csrf.js → csrf.js} +0 -0
  27. /package/dist/{src/email.d.ts → email.d.ts} +0 -0
  28. /package/dist/{src/email.js → email.js} +0 -0
  29. /package/dist/{src/errors.d.ts → errors.d.ts} +0 -0
  30. /package/dist/{src/errors.js → errors.js} +0 -0
  31. /package/dist/{src/faktory.d.ts → faktory.d.ts} +0 -0
  32. /package/dist/{src/faktory.js → faktory.js} +0 -0
  33. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  34. /package/dist/{src/index.js → index.js} +0 -0
  35. /package/dist/{src/listen.d.ts → listen.d.ts} +0 -0
  36. /package/dist/{src/listen.js → listen.js} +0 -0
  37. /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
  38. /package/dist/{src/logger.js → logger.js} +0 -0
  39. /package/dist/{src/manage.d.ts → manage.d.ts} +0 -0
  40. /package/dist/{src/manage.js → manage.js} +0 -0
  41. /package/dist/{src/middleware.d.ts → middleware.d.ts} +0 -0
  42. /package/dist/{src/middleware.js → middleware.js} +0 -0
  43. /package/dist/{src/migrate.d.ts → migrate.d.ts} +0 -0
  44. /package/dist/{src/migrate.js → migrate.js} +0 -0
  45. /package/dist/{src/postgres.d.ts → postgres.d.ts} +0 -0
  46. /package/dist/{src/postgres.js → postgres.js} +0 -0
  47. /package/dist/{src/redis.d.ts → redis.d.ts} +0 -0
  48. /package/dist/{src/redis.js → redis.js} +0 -0
  49. /package/dist/{src/routes.d.ts → routes.d.ts} +0 -0
  50. /package/dist/{src/routes.js → routes.js} +0 -0
  51. /package/dist/{src/sentry.d.ts → sentry.d.ts} +0 -0
  52. /package/dist/{src/sentry.js → sentry.js} +0 -0
  53. /package/dist/{src/setupTests.d.ts → setupTests.d.ts} +0 -0
  54. /package/dist/{src/setupTests.js → setupTests.js} +0 -0
  55. /package/dist/{src/slack.d.ts → slack.d.ts} +0 -0
  56. /package/dist/{src/slack.js → slack.js} +0 -0
  57. /package/dist/{src/utils.d.ts → utils.d.ts} +0 -0
  58. /package/dist/{src/utils.js → utils.js} +0 -0
  59. /package/dist/{src/validate.d.ts → validate.d.ts} +0 -0
  60. /package/dist/{src/validate.js → validate.js} +0 -0
  61. /package/dist/{src/vite → vite}/defineViteConfig.d.ts +0 -0
  62. /package/dist/{src/vite → vite}/defineViteConfig.js +0 -0
  63. /package/dist/{src/vite → vite}/ssr.d.ts +0 -0
  64. /package/dist/{src/vite → vite}/ssr.js +0 -0
  65. /package/dist/{src/vite → vite}/types.d.ts +0 -0
  66. /package/dist/{src/vite → vite}/types.js +0 -0
  67. /package/dist/{src/vite.d.ts → vite.d.ts} +0 -0
  68. /package/dist/{src/vite.js → vite.js} +0 -0
  69. /package/dist/{src/webapi.d.ts → webapi.d.ts} +0 -0
  70. /package/dist/{src/webapi.js → webapi.js} +0 -0
@@ -0,0 +1,38 @@
1
+ export declare const config: {
2
+ value: {
3
+ CI: boolean;
4
+ PORT: number;
5
+ AUTH_TOKEN_EXPIRES_IN: number;
6
+ AUTH_TEMP_TOKEN_EXPIRES_IN: number;
7
+ AUTH_SECRET: string;
8
+ REDIS_URL: string;
9
+ POSTGRES_URL: string;
10
+ SENTRY_DSN: string;
11
+ LOG_LEVEL: string;
12
+ LOG_SQL: boolean;
13
+ NODE_ENV: string;
14
+ CSRF_SECRET: string;
15
+ READINESS_PERIOD_MS: number;
16
+ GRACE_PERIOD_MS: number;
17
+ SLACK_WEBHOOK_URL: string;
18
+ };
19
+ };
20
+ export declare function extendConfig<T extends Record<string, unknown>>(appConfig: T): {
21
+ value: {
22
+ CI: boolean;
23
+ PORT: number;
24
+ AUTH_TOKEN_EXPIRES_IN: number;
25
+ AUTH_TEMP_TOKEN_EXPIRES_IN: number;
26
+ AUTH_SECRET: string;
27
+ REDIS_URL: string;
28
+ POSTGRES_URL: string;
29
+ SENTRY_DSN: string;
30
+ LOG_LEVEL: string;
31
+ LOG_SQL: boolean;
32
+ NODE_ENV: string;
33
+ CSRF_SECRET: string;
34
+ READINESS_PERIOD_MS: number;
35
+ GRACE_PERIOD_MS: number;
36
+ SLACK_WEBHOOK_URL: string;
37
+ } & T;
38
+ };
@@ -1,15 +1,8 @@
1
1
  import { readEnv } from './utils.js';
2
2
  function lazy(fn) {
3
3
  return { value: fn() };
4
- // return {
5
- // get value() {
6
- // const value = fn();
7
- // Object.defineProperty(this, 'value', { value });
8
- // return value;
9
- // },
10
- // };
11
4
  }
12
- const baseConfig = () => ({
5
+ const baseConfig = {
13
6
  CI: readEnv.boolean('CI', false),
14
7
  PORT: readEnv.number('PORT', 0),
15
8
  AUTH_TOKEN_EXPIRES_IN: readEnv.number('AUTH_TOKEN_EXPIRES', 3600 * 24 * 30), // 30 days
@@ -25,11 +18,8 @@ const baseConfig = () => ({
25
18
  READINESS_PERIOD_MS: readEnv.number('READINESS_PERIOD_MS', 0),
26
19
  GRACE_PERIOD_MS: readEnv.number('GRACE_PERIOD_MS', 20000),
27
20
  SLACK_WEBHOOK_URL: readEnv('SLACK_WEBHOOK_URL', ''),
28
- });
29
- export const config = {
30
- ...lazy(baseConfig),
31
- extend: (appConfig) => {
32
- const base = config.value;
33
- return lazy(() => ({ ...base, ...appConfig }));
34
- },
35
21
  };
22
+ export const config = lazy(() => baseConfig);
23
+ export function extendConfig(appConfig) {
24
+ return lazy(() => Object.assign(baseConfig, appConfig));
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devmoods/express-extras",
3
- "version": "0.47.3",
3
+ "version": "0.48.0",
4
4
  "description": "Kubernetes-ready utilities for rapid Node.js application development",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,38 +0,0 @@
1
- export declare const config: {
2
- extend: <T extends Record<string, unknown>>(appConfig: T) => {
3
- value: {
4
- CI: boolean;
5
- PORT: number;
6
- AUTH_TOKEN_EXPIRES_IN: number;
7
- AUTH_TEMP_TOKEN_EXPIRES_IN: number;
8
- AUTH_SECRET: string;
9
- REDIS_URL: string;
10
- POSTGRES_URL: string;
11
- SENTRY_DSN: string;
12
- LOG_LEVEL: string;
13
- LOG_SQL: boolean;
14
- NODE_ENV: string;
15
- CSRF_SECRET: string;
16
- READINESS_PERIOD_MS: number;
17
- GRACE_PERIOD_MS: number;
18
- SLACK_WEBHOOK_URL: string;
19
- } & T;
20
- };
21
- value: {
22
- CI: boolean;
23
- PORT: number;
24
- AUTH_TOKEN_EXPIRES_IN: number;
25
- AUTH_TEMP_TOKEN_EXPIRES_IN: number;
26
- AUTH_SECRET: string;
27
- REDIS_URL: string;
28
- POSTGRES_URL: string;
29
- SENTRY_DSN: string;
30
- LOG_LEVEL: string;
31
- LOG_SQL: boolean;
32
- NODE_ENV: string;
33
- CSRF_SECRET: string;
34
- READINESS_PERIOD_MS: number;
35
- GRACE_PERIOD_MS: number;
36
- SLACK_WEBHOOK_URL: string;
37
- };
38
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes