@spfn/core 0.2.0-beta.3 → 0.2.0-beta.31

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 (66) hide show
  1. package/README.md +260 -1175
  2. package/dist/{boss-BO8ty33K.d.ts → boss-DI1r4kTS.d.ts} +24 -7
  3. package/dist/codegen/index.d.ts +55 -8
  4. package/dist/codegen/index.js +179 -5
  5. package/dist/codegen/index.js.map +1 -1
  6. package/dist/config/index.d.ts +204 -6
  7. package/dist/config/index.js +44 -11
  8. package/dist/config/index.js.map +1 -1
  9. package/dist/db/index.d.ts +24 -3
  10. package/dist/db/index.js +118 -45
  11. package/dist/db/index.js.map +1 -1
  12. package/dist/env/index.d.ts +83 -3
  13. package/dist/env/index.js +83 -15
  14. package/dist/env/index.js.map +1 -1
  15. package/dist/env/loader.d.ts +95 -0
  16. package/dist/env/loader.js +78 -0
  17. package/dist/env/loader.js.map +1 -0
  18. package/dist/event/index.d.ts +29 -70
  19. package/dist/event/index.js +15 -1
  20. package/dist/event/index.js.map +1 -1
  21. package/dist/event/sse/client.d.ts +157 -0
  22. package/dist/event/sse/client.js +169 -0
  23. package/dist/event/sse/client.js.map +1 -0
  24. package/dist/event/sse/index.d.ts +46 -0
  25. package/dist/event/sse/index.js +238 -0
  26. package/dist/event/sse/index.js.map +1 -0
  27. package/dist/job/index.d.ts +23 -8
  28. package/dist/job/index.js +108 -23
  29. package/dist/job/index.js.map +1 -1
  30. package/dist/logger/index.d.ts +5 -0
  31. package/dist/logger/index.js +9 -0
  32. package/dist/logger/index.js.map +1 -1
  33. package/dist/middleware/index.d.ts +23 -1
  34. package/dist/middleware/index.js +58 -5
  35. package/dist/middleware/index.js.map +1 -1
  36. package/dist/nextjs/index.d.ts +2 -2
  37. package/dist/nextjs/index.js +37 -5
  38. package/dist/nextjs/index.js.map +1 -1
  39. package/dist/nextjs/server.d.ts +44 -23
  40. package/dist/nextjs/server.js +87 -66
  41. package/dist/nextjs/server.js.map +1 -1
  42. package/dist/route/index.d.ts +168 -5
  43. package/dist/route/index.js +262 -17
  44. package/dist/route/index.js.map +1 -1
  45. package/dist/router-Di7ENoah.d.ts +151 -0
  46. package/dist/server/index.d.ts +316 -5
  47. package/dist/server/index.js +892 -200
  48. package/dist/server/index.js.map +1 -1
  49. package/dist/{types-BVxUIkcU.d.ts → types-7Mhoxnnt.d.ts} +68 -2
  50. package/dist/types-DAVwA-_7.d.ts +339 -0
  51. package/docs/cache.md +133 -0
  52. package/docs/codegen.md +74 -0
  53. package/docs/database.md +346 -0
  54. package/docs/entity.md +539 -0
  55. package/docs/env.md +499 -0
  56. package/docs/errors.md +319 -0
  57. package/docs/event.md +443 -0
  58. package/docs/file-upload.md +717 -0
  59. package/docs/job.md +131 -0
  60. package/docs/logger.md +108 -0
  61. package/docs/middleware.md +337 -0
  62. package/docs/nextjs.md +247 -0
  63. package/docs/repository.md +496 -0
  64. package/docs/route.md +497 -0
  65. package/docs/server.md +429 -0
  66. package/package.json +18 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/config/schema.ts","../../src/config/index.ts"],"names":[],"mappings":";;;AAsCO,IAAM,gBAAgB,eAAA,CAAgB;AAAA;AAAA;AAAA;AAAA,EAKzC,UAAU,OAAA,CAAQ,CAAC,SAAS,aAAA,EAAe,YAAA,EAAc,MAAM,CAAA,EAAY;AAAA,IACvE,WAAA,EAAa,6BAAA;AAAA,IACb,OAAA,EAAS;AAAA,GACZ,CAAA;AAAA;AAAA;AAAA;AAAA,EAMD,cAAc,SAAA,CAAU;AAAA,IACpB,WAAA,EAAa,iCAAA;AAAA,IACb,QAAA,EAAU,KAAA;AAAA,IACV,SAAA,EAAW,IAAA;AAAA,IACX,SAAA,EAAW,gBAAA;AAAA,IACX,QAAA,EAAU,CAAC,kDAAkD;AAAA,GAChE,CAAA;AAAA,EAED,oBAAoB,SAAA,CAAU;AAAA,IAC1B,WAAA,EAAa,6CAAA;AAAA,IACb,QAAA,EAAU,KAAA;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;AAAA;AAAA;AAAA;AAAA,EAKD,cAAc,MAAA,CAAO;AAAA,IACjB,WAAA,EAAa,sDAAA;AAAA,IACb,QAAA,EAAU,IAAA;AAAA,IACV,QAAA,EAAU,CAAC,uBAAA,EAAyB,sBAAsB;AAAA,GAC7D,CAAA;AAAA,EAED,cAAc,MAAA,CAAO;AAAA,IACjB,WAAA,EAAa,8DAAA;AAAA,IACb,QAAA,EAAU,KAAA;AAAA,IACV,QAAA,EAAU,CAAC,uBAAA,EAAyB,sBAAsB;AAAA,GAC7D;AACL,CAAC;;;ACvTM,IAAM,QAAA,GAAW,kBAAkB,aAAa;AAKhD,IAAM,GAAA,GAAM,SAAS,QAAA","file":"index.js","sourcesContent":["/**\n * Core Package Environment Variable Schema\n *\n * Centralized schema definition for all environment variables used in @spfn/core.\n * This provides type safety, validation, and documentation for environment configuration.\n *\n * @module config/schema\n */\n\nimport {\n defineEnvSchema,\n envEnum,\n envNumber,\n envBoolean,\n envUrl,\n envString,\n parsePostgresUrl,\n parseRedisUrl,\n} from '@spfn/core/env';\n\n/**\n * Core package environment variable schema\n *\n * Defines all environment variables with:\n * - Type information\n * - Default values\n * - Validation rules\n * - Documentation\n *\n * @example\n * ```typescript\n * import { coreEnvSchema } from '@spfn/core/config';\n *\n * // Access schema information\n * console.log(coreEnvSchema.DB_POOL_MAX.description);\n * console.log(coreEnvSchema.DB_POOL_MAX.default);\n * ```\n */\nexport const coreEnvSchema = defineEnvSchema({\n // ========================================================================\n // Core Environment\n // ========================================================================\n\n NODE_ENV: envEnum(['local', 'development', 'production', 'test'] as const, {\n description: 'Node.js runtime environment',\n default: 'local',\n }),\n\n // ========================================================================\n // Database - Connection\n // ========================================================================\n\n DATABASE_URL: envString({\n description: 'Primary database connection URL',\n required: false,\n sensitive: true,\n validator: parsePostgresUrl,\n examples: ['postgresql://user:password@localhost:5432/dbname'],\n }),\n\n DATABASE_WRITE_URL: envString({\n description: 'Write database URL (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parsePostgresUrl,\n examples: ['postgresql://user:password@master:5432/dbname'],\n }),\n\n DATABASE_READ_URL: envString({\n description: 'Read database URL (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parsePostgresUrl,\n examples: ['postgresql://user:password@replica:5432/dbname'],\n }),\n\n\n // ========================================================================\n // Database - Connection Pool\n // ========================================================================\n\n DB_POOL_MAX: envNumber({\n description: 'Maximum number of database connections in pool',\n default: 10,\n examples: [10, 20, 50],\n }),\n\n DB_POOL_IDLE_TIMEOUT: envNumber({\n description: 'Database connection idle timeout in seconds',\n default: 30,\n examples: [20, 30, 60],\n }),\n\n // ========================================================================\n // Database - Retry Configuration\n // ========================================================================\n\n DB_RETRY_MAX: envNumber({\n description: 'Maximum number of database connection retry attempts',\n default: 3,\n examples: [3, 5, 10],\n }),\n\n DB_RETRY_INITIAL_DELAY: envNumber({\n description: 'Initial delay between database retry attempts (milliseconds)',\n default: 100,\n examples: [50, 100, 200],\n }),\n\n DB_RETRY_MAX_DELAY: envNumber({\n description: 'Maximum delay cap for database retry attempts (milliseconds)',\n default: 10000,\n examples: [5000, 10000, 30000],\n }),\n\n DB_RETRY_FACTOR: envNumber({\n description: 'Exponential backoff factor for database retry delays',\n default: 2,\n examples: [2, 1.5, 3],\n }),\n\n // ========================================================================\n // Database - Health Check\n // ========================================================================\n\n DB_HEALTH_CHECK_ENABLED: envBoolean({\n description: 'Enable periodic database health checks',\n default: true,\n examples: [true, false],\n }),\n\n DB_HEALTH_CHECK_INTERVAL: envNumber({\n description: 'Database health check interval (milliseconds)',\n default: 60000,\n examples: [30000, 60000, 120000],\n }),\n\n DB_HEALTH_CHECK_RECONNECT: envBoolean({\n description: 'Reconnect to database on health check failure',\n default: true,\n examples: [true, false],\n }),\n\n DB_HEALTH_CHECK_MAX_RETRIES: envNumber({\n description: 'Maximum health check retry attempts before marking as failed',\n default: 3,\n examples: [3, 5, 10],\n }),\n\n DB_HEALTH_CHECK_RETRY_INTERVAL: envNumber({\n description: 'Interval between health check retry attempts (milliseconds)',\n default: 5000,\n examples: [5000, 10000, 15000],\n }),\n\n // ========================================================================\n // Database - Monitoring\n // ========================================================================\n\n DB_MONITORING_ENABLED: envBoolean({\n description: 'Enable database query performance monitoring',\n default: false,\n examples: [true, false],\n }),\n\n DB_MONITORING_SLOW_THRESHOLD: envNumber({\n description: 'Slow query threshold for monitoring (milliseconds)',\n default: 1000,\n examples: [500, 1000, 2000],\n }),\n\n DB_MONITORING_LOG_QUERIES: envBoolean({\n description: 'Log all database queries (not just slow queries)',\n default: false,\n examples: [true, false],\n }),\n\n // ========================================================================\n // Database - Transaction\n // ========================================================================\n\n TRANSACTION_TIMEOUT: envNumber({\n description: 'Transaction timeout in milliseconds',\n default: 30000,\n examples: [10000, 30000, 60000],\n }),\n\n // ========================================================================\n // Database - Development\n // ========================================================================\n\n DB_DEBUG_TRACE: envBoolean({\n description: 'Enable detailed debug tracing for database operations',\n default: false,\n examples: [true, false],\n }),\n\n // ========================================================================\n // Drizzle ORM\n // ========================================================================\n\n DRIZZLE_SCHEMA_PATH: envString({\n description: 'Path to Drizzle schema configuration',\n required: false,\n default: './src/server/entities/config.ts',\n examples: ['./src/db/schema.ts', './src/server/entities/config.ts'],\n }),\n\n DRIZZLE_OUT_DIR: envString({\n description: 'Output directory for Drizzle migrations',\n required: false,\n default: './drizzle',\n examples: ['./drizzle', './migrations'],\n }),\n\n // ========================================================================\n // Logger - Core\n // ========================================================================\n\n SPFN_LOG_LEVEL: envEnum(['debug', 'info', 'warn', 'error', 'fatal'] as const, {\n description: 'Minimum log level to output',\n default: 'info'\n }),\n\n // ========================================================================\n // Cache (Redis/Valkey)\n // ========================================================================\n\n CACHE_URL: envString({\n description: 'Single Redis/Valkey instance URL',\n required: false,\n sensitive: true,\n validator: parseRedisUrl,\n examples: ['redis://localhost:6379', 'rediss://secure.cache.com:6380'],\n }),\n\n CACHE_WRITE_URL: envString({\n description: 'Master Redis/Valkey URL for writes (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parseRedisUrl,\n examples: ['redis://master:6379'],\n }),\n\n CACHE_READ_URL: envString({\n description: 'Replica Redis/Valkey URL for reads (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parseRedisUrl,\n examples: ['redis://replica:6379'],\n }),\n\n CACHE_SENTINEL_HOSTS: envString({\n description: 'Comma-separated Redis Sentinel hosts',\n required: false,\n examples: ['sentinel1:26379,sentinel2:26379'],\n }),\n\n CACHE_CLUSTER_NODES: envString({\n description: 'Comma-separated Redis Cluster nodes',\n required: false,\n examples: ['node1:6379,node2:6379,node3:6379'],\n }),\n\n CACHE_MASTER_NAME: envString({\n description: 'Redis Sentinel master name',\n required: false,\n examples: ['mymaster'],\n }),\n\n CACHE_PASSWORD: envString({\n description: 'Redis/Valkey authentication password',\n required: false,\n sensitive: true,\n examples: ['your-redis-password'],\n }),\n\n CACHE_TLS_REJECT_UNAUTHORIZED: envBoolean({\n description: 'Verify TLS certificates for secure Redis connections',\n default: true,\n examples: [true, false],\n }),\n\n // ========================================================================\n // Server - Core\n // ========================================================================\n\n PORT: envNumber({\n description: 'Server port number',\n default: 4000,\n examples: [3000, 4000, 8080],\n }),\n\n HOST: envString({\n description: 'Server hostname',\n default: 'localhost',\n required: false,\n examples: ['localhost', '0.0.0.0', '127.0.0.1'],\n }),\n\n // ========================================================================\n // Server - Timeout\n // ========================================================================\n\n SERVER_TIMEOUT: envNumber({\n description: 'Request timeout in milliseconds',\n default: 120000,\n examples: [60000, 120000, 300000],\n }),\n\n SERVER_KEEPALIVE_TIMEOUT: envNumber({\n description: 'Keep-alive timeout in milliseconds',\n default: 65000,\n examples: [30000, 65000, 120000],\n }),\n\n SERVER_HEADERS_TIMEOUT: envNumber({\n description: 'Headers timeout in milliseconds',\n default: 60000,\n examples: [30000, 60000, 120000],\n }),\n\n SHUTDOWN_TIMEOUT: envNumber({\n description: 'Graceful shutdown timeout in milliseconds',\n default: 30000,\n examples: [10000, 30000, 60000],\n }),\n\n // ========================================================================\n // Next.js Client\n // ========================================================================\n SPFN_API_URL: envUrl({\n description: 'Next.js API URL (required for client-side API calls)',\n required: true,\n examples: ['http://localhost:3000', 'https://your-app.com'],\n }),\n\n SPFN_APP_URL: envUrl({\n description: 'Next.js application URL (required for server-side API calls)',\n required: false,\n examples: ['http://localhost:3000', 'https://your-app.com'],\n }),\n});","/**\n * Core Package Configuration\n *\n * @example\n * ```typescript\n * import { registry } from '@spfn/core/config';\n *\n * const env = registry.validate();\n * console.log(env.DB_POOL_MAX);\n * ```\n *\n * @module config\n */\n\nimport { createEnvRegistry } from '@spfn/core/env';\nimport { coreEnvSchema } from './schema';\n\n/**\n * Core environment schema\n */\nexport { coreEnvSchema as envSchema } from './schema';\n\n/**\n * Environment registry\n *\n * @example\n * ```typescript\n * // Reset for testing\n * registry.reset();\n * ```\n */\nexport const registry = createEnvRegistry(coreEnvSchema);\n\n/**\n * Validated environment configuration\n */\nexport const env = registry.validate();"]}
1
+ {"version":3,"sources":["../../src/config/schema.ts","../../src/config/index.ts"],"names":[],"mappings":";;;AAsCO,IAAM,gBAAgB,eAAA,CAAgB;AAAA;AAAA;AAAA;AAAA,EAKzC,QAAA,EAAU,QAAQ,CAAC,OAAA,EAAS,eAAe,SAAA,EAAW,YAAA,EAAc,MAAM,CAAA,EAAY;AAAA,IAClF,WAAA,EAAa,6BAAA;AAAA,IACb,OAAA,EAAS,OAAA;AAAA,IACT,MAAA,EAAQ;AAAA,GACX,CAAA;AAAA;AAAA;AAAA;AAAA,EAMD,cAAc,SAAA,CAAU;AAAA,IACpB,WAAA,EAAa,iCAAA;AAAA,IACb,QAAA,EAAU,KAAA;AAAA,IACV,SAAA,EAAW,IAAA;AAAA,IACX,SAAA,EAAW,gBAAA;AAAA,IACX,QAAA,EAAU,CAAC,kDAAkD;AAAA,GAChE,CAAA;AAAA,EAED,oBAAoB,SAAA,CAAU;AAAA,IAC1B,WAAA,EAAa,6CAAA;AAAA,IACb,QAAA,EAAU,KAAA;AAAA,IACV,SAAA,EAAW,IAAA;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AA,EAAU,CAAC,GAAA,EAAO,IAAA,EAAQ,IAAM;AAAA,GACnC;AACL,CAAC;;;AC/VM,IAAM,QAAA,GAAW,kBAAkB,aAAa;AAKhD,IAAM,GAAA,GAAM,SAAS,QAAA","file":"index.js","sourcesContent":["/**\n * Core Package Environment Variable Schema\n *\n * Centralized schema definition for all environment variables used in @spfn/core.\n * This provides type safety, validation, and documentation for environment configuration.\n *\n * @module config/schema\n */\n\nimport {\n defineEnvSchema,\n envEnum,\n envNumber,\n envBoolean,\n envUrl,\n envString,\n parsePostgresUrl,\n parseRedisUrl,\n} from '@spfn/core/env';\n\n/**\n * Core package environment variable schema\n *\n * Defines all environment variables with:\n * - Type information\n * - Default values\n * - Validation rules\n * - Documentation\n *\n * @example\n * ```typescript\n * import { coreEnvSchema } from '@spfn/core/config';\n *\n * // Access schema information\n * console.log(coreEnvSchema.DB_POOL_MAX.description);\n * console.log(coreEnvSchema.DB_POOL_MAX.default);\n * ```\n */\nexport const coreEnvSchema = defineEnvSchema({\n // ========================================================================\n // Core Environment\n // ========================================================================\n\n NODE_ENV: envEnum(['local', 'development', 'staging', 'production', 'test'] as const, {\n description: 'Node.js runtime environment',\n default: 'local',\n nextjs: true,\n }),\n\n // ========================================================================\n // Database - Connection\n // ========================================================================\n\n DATABASE_URL: envString({\n description: 'Primary database connection URL',\n required: false,\n sensitive: true,\n validator: parsePostgresUrl,\n examples: ['postgresql://user:password@localhost:5432/dbname'],\n }),\n\n DATABASE_WRITE_URL: envString({\n description: 'Write database URL (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parsePostgresUrl,\n examples: ['postgresql://user:password@master:5432/dbname'],\n }),\n\n DATABASE_READ_URL: envString({\n description: 'Read database URL (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parsePostgresUrl,\n examples: ['postgresql://user:password@replica:5432/dbname'],\n }),\n\n\n // ========================================================================\n // Database - Connection Pool\n // ========================================================================\n\n DB_POOL_MAX: envNumber({\n description: 'Maximum number of database connections in pool',\n default: 10,\n examples: [10, 20, 50],\n }),\n\n DB_POOL_IDLE_TIMEOUT: envNumber({\n description: 'Database connection idle timeout in seconds',\n default: 30,\n examples: [20, 30, 60],\n }),\n\n // ========================================================================\n // Database - Retry Configuration\n // ========================================================================\n\n DB_RETRY_MAX: envNumber({\n description: 'Maximum number of database connection retry attempts',\n default: 3,\n examples: [3, 5, 10],\n }),\n\n DB_RETRY_INITIAL_DELAY: envNumber({\n description: 'Initial delay between database retry attempts (milliseconds)',\n default: 100,\n examples: [50, 100, 200],\n }),\n\n DB_RETRY_MAX_DELAY: envNumber({\n description: 'Maximum delay cap for database retry attempts (milliseconds)',\n default: 10000,\n examples: [5000, 10000, 30000],\n }),\n\n DB_RETRY_FACTOR: envNumber({\n description: 'Exponential backoff factor for database retry delays',\n default: 2,\n examples: [2, 1.5, 3],\n }),\n\n // ========================================================================\n // Database - Health Check\n // ========================================================================\n\n DB_HEALTH_CHECK_ENABLED: envBoolean({\n description: 'Enable periodic database health checks',\n default: true,\n examples: [true, false],\n }),\n\n DB_HEALTH_CHECK_INTERVAL: envNumber({\n description: 'Database health check interval (milliseconds)',\n default: 60000,\n examples: [30000, 60000, 120000],\n }),\n\n DB_HEALTH_CHECK_RECONNECT: envBoolean({\n description: 'Reconnect to database on health check failure',\n default: true,\n examples: [true, false],\n }),\n\n DB_HEALTH_CHECK_MAX_RETRIES: envNumber({\n description: 'Maximum health check retry attempts before marking as failed',\n default: 3,\n examples: [3, 5, 10],\n }),\n\n DB_HEALTH_CHECK_RETRY_INTERVAL: envNumber({\n description: 'Interval between health check retry attempts (milliseconds)',\n default: 5000,\n examples: [5000, 10000, 15000],\n }),\n\n // ========================================================================\n // Database - Monitoring\n // ========================================================================\n\n DB_MONITORING_ENABLED: envBoolean({\n description: 'Enable database query performance monitoring',\n default: false,\n examples: [true, false],\n }),\n\n DB_MONITORING_SLOW_THRESHOLD: envNumber({\n description: 'Slow query threshold for monitoring (milliseconds)',\n default: 1000,\n examples: [500, 1000, 2000],\n }),\n\n DB_MONITORING_LOG_QUERIES: envBoolean({\n description: 'Log all database queries (not just slow queries)',\n default: false,\n examples: [true, false],\n }),\n\n // ========================================================================\n // Database - Transaction\n // ========================================================================\n\n TRANSACTION_TIMEOUT: envNumber({\n description: 'Transaction timeout in milliseconds',\n default: 30000,\n examples: [10000, 30000, 60000],\n }),\n\n // ========================================================================\n // Database - Development\n // ========================================================================\n\n DB_DEBUG_TRACE: envBoolean({\n description: 'Enable detailed debug tracing for database operations',\n default: false,\n examples: [true, false],\n }),\n\n // ========================================================================\n // Drizzle ORM\n // ========================================================================\n\n DRIZZLE_SCHEMA_PATH: envString({\n description: 'Path to Drizzle schema configuration',\n required: false,\n default: './src/server/entities/config.ts',\n examples: ['./src/db/schema.ts', './src/server/entities/config.ts'],\n }),\n\n DRIZZLE_OUT_DIR: envString({\n description: 'Output directory for Drizzle migrations',\n required: false,\n default: './drizzle',\n examples: ['./drizzle', './migrations'],\n }),\n\n // ========================================================================\n // Logger - Core\n // ========================================================================\n\n SPFN_LOG_LEVEL: envEnum(['debug', 'info', 'warn', 'error', 'fatal'] as const, {\n description: 'Minimum log level to output',\n default: 'info'\n }),\n\n // ========================================================================\n // Cache (Redis/Valkey)\n // ========================================================================\n\n CACHE_URL: envString({\n description: 'Single Redis/Valkey instance URL',\n required: false,\n sensitive: true,\n validator: parseRedisUrl,\n examples: ['redis://localhost:6379', 'rediss://secure.cache.com:6380'],\n }),\n\n CACHE_WRITE_URL: envString({\n description: 'Master Redis/Valkey URL for writes (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parseRedisUrl,\n examples: ['redis://master:6379'],\n }),\n\n CACHE_READ_URL: envString({\n description: 'Replica Redis/Valkey URL for reads (master-replica pattern)',\n required: false,\n sensitive: true,\n validator: parseRedisUrl,\n examples: ['redis://replica:6379'],\n }),\n\n CACHE_SENTINEL_HOSTS: envString({\n description: 'Comma-separated Redis Sentinel hosts',\n required: false,\n examples: ['sentinel1:26379,sentinel2:26379'],\n }),\n\n CACHE_CLUSTER_NODES: envString({\n description: 'Comma-separated Redis Cluster nodes',\n required: false,\n examples: ['node1:6379,node2:6379,node3:6379'],\n }),\n\n CACHE_MASTER_NAME: envString({\n description: 'Redis Sentinel master name',\n required: false,\n examples: ['mymaster'],\n }),\n\n CACHE_PASSWORD: envString({\n description: 'Redis/Valkey authentication password',\n required: false,\n sensitive: true,\n examples: ['your-redis-password'],\n }),\n\n CACHE_TLS_REJECT_UNAUTHORIZED: envBoolean({\n description: 'Verify TLS certificates for secure Redis connections',\n default: true,\n examples: [true, false],\n }),\n\n // ========================================================================\n // Server - Core\n // ========================================================================\n\n PORT: envNumber({\n description: 'Server port number',\n default: 4000,\n examples: [3000, 4000, 8080],\n }),\n\n HOST: envString({\n description: 'Server hostname',\n default: 'localhost',\n required: false,\n examples: ['localhost', '0.0.0.0', '127.0.0.1'],\n }),\n\n // ========================================================================\n // Server - Timeout\n // ========================================================================\n\n SERVER_TIMEOUT: envNumber({\n description: 'Request timeout in milliseconds',\n default: 120000,\n examples: [60000, 120000, 300000],\n }),\n\n SERVER_KEEPALIVE_TIMEOUT: envNumber({\n description: 'Keep-alive timeout in milliseconds',\n default: 65000,\n examples: [30000, 65000, 120000],\n }),\n\n SERVER_HEADERS_TIMEOUT: envNumber({\n description: 'Headers timeout in milliseconds',\n default: 60000,\n examples: [30000, 60000, 120000],\n }),\n\n SHUTDOWN_TIMEOUT: envNumber({\n description: 'Graceful shutdown timeout in milliseconds (must be less than k8s terminationGracePeriodSeconds minus preStop sleep, with safety margin)',\n default: 280000,\n examples: [30000, 120000, 280000],\n }),\n\n // ========================================================================\n // Fetch (Node.js undici) - outbound HTTP request timeout\n // ========================================================================\n\n FETCH_CONNECT_TIMEOUT: envNumber({\n description: 'Fetch TCP connection timeout in milliseconds (time to establish socket connection to upstream server)',\n default: 10000,\n examples: [5000, 10000, 30000],\n }),\n\n FETCH_HEADERS_TIMEOUT: envNumber({\n description: 'Fetch headers timeout in milliseconds (time to receive response headers after request sent)',\n default: 300000,\n examples: [120000, 300000, 600000],\n }),\n\n FETCH_BODY_TIMEOUT: envNumber({\n description: 'Fetch body timeout in milliseconds (time between body data chunks from upstream server)',\n default: 300000,\n examples: [120000, 300000, 600000],\n }),\n\n // ========================================================================\n // Next.js Integration\n // ========================================================================\n\n SPFN_API_URL: envUrl({\n description: 'SPFN API URL (used by Next.js to call backend)',\n required: true,\n nextjs: true,\n examples: ['http://localhost:8790', 'https://api.your-app.com'],\n }),\n\n NEXT_PUBLIC_SPFN_API_URL: envUrl({\n description: 'SPFN API URL (used by Next.js to call backend)',\n required: true,\n nextjs: true,\n examples: ['http://localhost:8790', 'https://api.your-app.com'],\n }),\n\n SPFN_APP_URL: envUrl({\n description: 'Next.js application URL (used by SPFN server)',\n required: false,\n nextjs: true,\n examples: ['http://localhost:3790', 'https://your-app.com'],\n }),\n\n RPC_PROXY_TIMEOUT: envNumber({\n description: 'RPC proxy request timeout in milliseconds (AbortController timeout for proxied requests to backend, should be shorter than FETCH_HEADERS_TIMEOUT)',\n default: 120000,\n nextjs: true,\n examples: [60000, 120000, 280000],\n }),\n});","/**\n * Core Package Configuration\n *\n * @example\n * ```typescript\n * import { registry } from '@spfn/core/config';\n *\n * const env = registry.validate();\n * console.log(env.DB_POOL_MAX);\n * ```\n *\n * @module config\n */\n\nimport { createEnvRegistry } from '@spfn/core/env';\nimport { coreEnvSchema } from './schema';\n\n/**\n * Core environment schema\n */\nexport { coreEnvSchema as envSchema } from './schema';\n\n/**\n * Environment registry\n *\n * @example\n * ```typescript\n * // Reset for testing\n * registry.reset();\n * ```\n */\nexport const registry = createEnvRegistry(coreEnvSchema);\n\n/**\n * Validated environment configuration\n */\nexport const env = registry.validate();"]}
@@ -376,6 +376,12 @@ interface DrizzleConfigOptions {
376
376
  packageFilter?: string;
377
377
  /** Expand glob patterns to actual file paths (useful for Drizzle Studio) */
378
378
  expandGlobs?: boolean;
379
+ /** PostgreSQL schema filter for push/introspect commands */
380
+ schemaFilter?: string[];
381
+ /** Auto-detect PostgreSQL schemas from entity files (requires expandGlobs: true) */
382
+ autoDetectSchemas?: boolean;
383
+ /** Migration prefix strategy (default: 'timestamp') */
384
+ migrationPrefix?: 'index' | 'timestamp' | 'unix' | 'none';
379
385
  }
380
386
  /**
381
387
  * Detect database dialect from connection URL
@@ -407,6 +413,21 @@ declare function getDrizzleConfig(options?: DrizzleConfigOptions): {
407
413
  dbCredentials: {
408
414
  url: string;
409
415
  };
416
+ migrations: {
417
+ prefix: "timestamp" | "none" | "index" | "unix";
418
+ };
419
+ schemaFilter?: undefined;
420
+ } | {
421
+ schema: string | string[];
422
+ out: string;
423
+ dialect: "postgresql" | "mysql" | "sqlite";
424
+ dbCredentials: {
425
+ url: string;
426
+ };
427
+ schemaFilter: string[] | undefined;
428
+ migrations: {
429
+ prefix: "timestamp" | "none" | "index" | "unix";
430
+ };
410
431
  };
411
432
  /**
412
433
  * Generate drizzle.config.ts file content
@@ -462,7 +483,7 @@ declare function timestamps(): {
462
483
  /**
463
484
  * Foreign key reference to another table
464
485
  *
465
- * Creates a bigserial column with cascade delete.
486
+ * Creates a bigint column with cascade delete.
466
487
  * Type-safe: ensures the reference points to a valid PostgreSQL column.
467
488
  *
468
489
  * @param name - Column name (e.g., 'author' creates 'author_id')
@@ -482,7 +503,7 @@ declare function timestamps(): {
482
503
  */
483
504
  declare function foreignKey<T extends PgColumn>(name: string, reference: () => T, options?: {
484
505
  onDelete?: 'cascade' | 'set null' | 'restrict' | 'no action';
485
- }): drizzle_orm.NotNull<drizzle_orm_pg_core.PgBigSerial53BuilderInitial<`${string}_id`>>;
506
+ }): drizzle_orm.NotNull<drizzle_orm_pg_core.PgBigInt53BuilderInitial<`${string}_id`>>;
486
507
  /**
487
508
  * Optional foreign key reference (nullable)
488
509
  *
@@ -502,7 +523,7 @@ declare function foreignKey<T extends PgColumn>(name: string, reference: () => T
502
523
  */
503
524
  declare function optionalForeignKey<T extends PgColumn>(name: string, reference: () => T, options?: {
504
525
  onDelete?: 'cascade' | 'set null' | 'restrict' | 'no action';
505
- }): drizzle_orm_pg_core.PgBigSerial53BuilderInitial<`${string}_id`>;
526
+ }): drizzle_orm_pg_core.PgBigInt53BuilderInitial<`${string}_id`>;
506
527
  /**
507
528
  * UUID primary key
508
529
  *
package/dist/db/index.js CHANGED
@@ -6,7 +6,7 @@ import { QueryError, ConnectionError, DeadlockError, TransactionError, Constrain
6
6
  import { parseNumber, parseBoolean } from '@spfn/core/env';
7
7
  import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
8
8
  import { join, dirname, basename } from 'path';
9
- import { bigserial, timestamp, uuid as uuid$1, text, jsonb, pgSchema } from 'drizzle-orm/pg-core';
9
+ import { bigserial, timestamp, bigint, uuid as uuid$1, text, jsonb, pgSchema } from 'drizzle-orm/pg-core';
10
10
  import { AsyncLocalStorage } from 'async_hooks';
11
11
  import { createMiddleware } from 'hono/factory';
12
12
  import { randomUUID } from 'crypto';
@@ -503,6 +503,8 @@ var setMonitoringConfig = (config) => {
503
503
  globalThis.__SPFN_DB_MONITORING__ = config;
504
504
  };
505
505
  var dbLogger3 = logger.child("@spfn/core:database");
506
+ var CLIENT_CLOSE_TIMEOUT = 5;
507
+ var isReconnecting = false;
506
508
  async function testDatabaseConnection(db) {
507
509
  await db.execute("SELECT 1");
508
510
  }
@@ -514,8 +516,13 @@ async function performHealthCheck(getDatabase2) {
514
516
  await testDatabaseConnection(read);
515
517
  }
516
518
  }
517
- async function reconnectAndRestore(options, closeDatabase2) {
518
- await closeDatabase2();
519
+ async function closeClient(client) {
520
+ try {
521
+ await client.end({ timeout: CLIENT_CLOSE_TIMEOUT });
522
+ } catch {
523
+ }
524
+ }
525
+ async function reconnectAndRestore(options) {
519
526
  const result = await createDatabaseFromEnv(options);
520
527
  if (!result.write) {
521
528
  return false;
@@ -524,15 +531,23 @@ async function reconnectAndRestore(options, closeDatabase2) {
524
531
  if (result.read && result.read !== result.write) {
525
532
  await testDatabaseConnection(result.read);
526
533
  }
534
+ const oldWriteClient = getWriteClient();
535
+ const oldReadClient = getReadClient();
527
536
  setWriteInstance(result.write);
528
537
  setReadInstance(result.read);
529
538
  setWriteClient(result.writeClient);
530
539
  setReadClient(result.readClient);
531
540
  const monConfig = buildMonitoringConfig(options?.monitoring);
532
541
  setMonitoringConfig(monConfig);
542
+ if (oldWriteClient) {
543
+ closeClient(oldWriteClient);
544
+ }
545
+ if (oldReadClient && oldReadClient !== oldWriteClient) {
546
+ closeClient(oldReadClient);
547
+ }
533
548
  return true;
534
549
  }
535
- function startHealthCheck(config, options, getDatabase2, closeDatabase2) {
550
+ function startHealthCheck(config, options, getDatabase2) {
536
551
  const healthCheck = getHealthCheckInterval();
537
552
  if (healthCheck) {
538
553
  dbLogger3.debug("Health check already running");
@@ -543,47 +558,56 @@ function startHealthCheck(config, options, getDatabase2, closeDatabase2) {
543
558
  reconnect: config.reconnect
544
559
  });
545
560
  const interval = setInterval(async () => {
561
+ if (isReconnecting) {
562
+ dbLogger3.debug("Health check skipped: reconnection in progress");
563
+ return;
564
+ }
546
565
  try {
547
566
  await performHealthCheck(getDatabase2);
548
567
  } catch (error) {
549
568
  const message = error instanceof Error ? error.message : "Unknown error";
550
569
  dbLogger3.error("Database health check failed", { error: message });
551
570
  if (config.reconnect) {
552
- await attemptReconnection(config, options, closeDatabase2);
571
+ await attemptReconnection(config, options);
553
572
  }
554
573
  }
555
574
  }, config.interval);
556
575
  setHealthCheckInterval(interval);
557
576
  }
558
- async function attemptReconnection(config, options, closeDatabase2) {
577
+ async function attemptReconnection(config, options) {
578
+ isReconnecting = true;
559
579
  dbLogger3.warn("Attempting database reconnection", {
560
580
  maxRetries: config.maxRetries,
561
581
  retryInterval: `${config.retryInterval}ms`
562
582
  });
563
- for (let attempt = 1; attempt <= config.maxRetries; attempt++) {
564
- try {
565
- dbLogger3.debug(`Reconnection attempt ${attempt}/${config.maxRetries}`);
566
- if (attempt > 1) {
567
- await new Promise((resolve) => setTimeout(resolve, config.retryInterval));
583
+ try {
584
+ for (let attempt = 1; attempt <= config.maxRetries; attempt++) {
585
+ try {
586
+ dbLogger3.debug(`Reconnection attempt ${attempt}/${config.maxRetries}`);
587
+ if (attempt > 1) {
588
+ await new Promise((resolve) => setTimeout(resolve, config.retryInterval));
589
+ }
590
+ const success = await reconnectAndRestore(options);
591
+ if (success) {
592
+ dbLogger3.info("Database reconnection successful", { attempt });
593
+ return;
594
+ } else {
595
+ dbLogger3.error(`Reconnection attempt ${attempt} failed: No write database instance created`);
596
+ }
597
+ } catch (error) {
598
+ const message = error instanceof Error ? error.message : "Unknown error";
599
+ dbLogger3.error(`Reconnection attempt ${attempt} failed`, {
600
+ error: message,
601
+ attempt,
602
+ maxRetries: config.maxRetries
603
+ });
568
604
  }
569
- const success = await reconnectAndRestore(options, closeDatabase2);
570
- if (success) {
571
- dbLogger3.info("Database reconnection successful", { attempt });
572
- return;
573
- } else {
574
- dbLogger3.error(`Reconnection attempt ${attempt} failed: No write database instance created`);
605
+ if (attempt === config.maxRetries) {
606
+ dbLogger3.error("Max reconnection attempts reached, will retry on next health check");
575
607
  }
576
- } catch (error) {
577
- const message = error instanceof Error ? error.message : "Unknown error";
578
- dbLogger3.error(`Reconnection attempt ${attempt} failed`, {
579
- error: message,
580
- attempt,
581
- maxRetries: config.maxRetries
582
- });
583
- }
584
- if (attempt === config.maxRetries) {
585
- dbLogger3.error("Max reconnection attempts reached, giving up");
586
608
  }
609
+ } finally {
610
+ isReconnecting = false;
587
611
  }
588
612
  }
589
613
  function stopHealthCheck() {
@@ -593,6 +617,7 @@ function stopHealthCheck() {
593
617
  setHealthCheckInterval(void 0);
594
618
  dbLogger3.info("Database health check stopped");
595
619
  }
620
+ isReconnecting = false;
596
621
  }
597
622
 
598
623
  // src/db/manager/manager.ts
@@ -742,7 +767,7 @@ async function initDatabase(options) {
742
767
  );
743
768
  const healthCheckConfig = buildHealthCheckConfig(options?.healthCheck);
744
769
  if (healthCheckConfig.enabled) {
745
- startHealthCheck(healthCheckConfig, options, getDatabase, closeDatabase);
770
+ startHealthCheck(healthCheckConfig, options, getDatabase);
746
771
  }
747
772
  const monConfig = buildMonitoringConfig(options?.monitoring);
748
773
  setMonitoringConfig(monConfig);
@@ -811,7 +836,7 @@ function getDatabaseInfo() {
811
836
  isReplica: !!(readInst && readInst !== writeInst)
812
837
  };
813
838
  }
814
- var INDEX_FILE_PATTERNS = [
839
+ var BARREL_FILE_PATTERNS = [
815
840
  "/index",
816
841
  "/index.ts",
817
842
  "/index.js",
@@ -819,11 +844,17 @@ var INDEX_FILE_PATTERNS = [
819
844
  "\\index",
820
845
  "\\index.ts",
821
846
  "\\index.js",
822
- "\\index.mjs"
847
+ "\\index.mjs",
848
+ "/config.ts",
849
+ "/config.js",
850
+ "/config.mjs",
851
+ "\\config.ts",
852
+ "\\config.js",
853
+ "\\config.mjs"
823
854
  ];
824
855
  var SUPPORTED_EXTENSIONS = [".ts", ".js", ".mjs"];
825
- function isIndexFile(filePath) {
826
- return INDEX_FILE_PATTERNS.some((pattern) => filePath.endsWith(pattern));
856
+ function isBarrelFile(filePath) {
857
+ return BARREL_FILE_PATTERNS.some((pattern) => filePath.endsWith(pattern));
827
858
  }
828
859
  function isAbsolutePath(path) {
829
860
  if (path.startsWith("/")) return true;
@@ -833,8 +864,8 @@ function hasSupportedExtension(filePath) {
833
864
  if (filePath.endsWith(".d.ts")) return false;
834
865
  return SUPPORTED_EXTENSIONS.some((ext) => filePath.endsWith(ext));
835
866
  }
836
- function filterIndexFiles(files) {
837
- return files.filter((file) => !isIndexFile(file));
867
+ function filterBarrelFiles(files) {
868
+ return files.filter((file) => !isBarrelFile(file));
838
869
  }
839
870
  function scanDirectoryRecursive(dir, extension) {
840
871
  const files = [];
@@ -880,6 +911,27 @@ function scanDirectorySingleLevel(dir, filePattern) {
880
911
  }
881
912
  return files;
882
913
  }
914
+ function detectSchemasFromFiles(files) {
915
+ const schemas = /* @__PURE__ */ new Set(["public"]);
916
+ const pgSchemaPattern = /pgSchema\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
917
+ const createSchemaPattern = /createSchema\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
918
+ for (const filePath of files) {
919
+ try {
920
+ const content = readFileSync(filePath, "utf-8");
921
+ let match;
922
+ while ((match = pgSchemaPattern.exec(content)) !== null) {
923
+ schemas.add(match[1]);
924
+ }
925
+ while ((match = createSchemaPattern.exec(content)) !== null) {
926
+ const packageName = match[1];
927
+ const schemaName = packageName.replace(/@/g, "").replace(/\//g, "_").replace(/-/g, "_");
928
+ schemas.add(schemaName);
929
+ }
930
+ } catch {
931
+ }
932
+ }
933
+ return Array.from(schemas);
934
+ }
883
935
  function expandGlobPattern(pattern) {
884
936
  if (!pattern.includes("*")) {
885
937
  return existsSync(pattern) ? [pattern] : [];
@@ -922,7 +974,7 @@ function discoverPackageSchemas(cwd) {
922
974
  for (const schema of packageSchemas) {
923
975
  const absolutePath = join(pkgPath, schema);
924
976
  const expandedFiles = expandGlobPattern(absolutePath);
925
- const schemaFiles = filterIndexFiles(expandedFiles);
977
+ const schemaFiles = filterBarrelFiles(expandedFiles);
926
978
  schemas.push(...schemaFiles);
927
979
  }
928
980
  }
@@ -984,28 +1036,45 @@ function getDrizzleConfig(options = {}) {
984
1036
  schema: schema2,
985
1037
  out,
986
1038
  dialect,
987
- dbCredentials: getDbCredentials(dialect, databaseUrl)
1039
+ dbCredentials: getDbCredentials(dialect, databaseUrl),
1040
+ migrations: {
1041
+ prefix: options.migrationPrefix ?? "timestamp"
1042
+ }
988
1043
  };
989
1044
  }
990
1045
  const userSchema = options.schema ?? "./src/server/entities/**/*.ts";
991
1046
  const userSchemas = Array.isArray(userSchema) ? userSchema : [userSchema];
992
1047
  const packageSchemas = options.disablePackageDiscovery ? [] : discoverPackageSchemas(options.cwd ?? process.cwd());
993
1048
  let allSchemas = [...userSchemas, ...packageSchemas];
1049
+ const cwd = options.cwd ?? process.cwd();
1050
+ let expandedFiles = [];
994
1051
  if (options.expandGlobs) {
995
- const expandedSchemas = [];
996
1052
  for (const schema2 of allSchemas) {
997
- const expanded = expandGlobPattern(schema2);
998
- const filtered = filterIndexFiles(expanded);
999
- expandedSchemas.push(...filtered);
1053
+ const absoluteSchema = isAbsolutePath(schema2) ? schema2 : join(cwd, schema2);
1054
+ const expanded = expandGlobPattern(absoluteSchema);
1055
+ const filtered = filterBarrelFiles(expanded);
1056
+ expandedFiles.push(...filtered);
1000
1057
  }
1001
- allSchemas = expandedSchemas;
1058
+ allSchemas = expandedFiles;
1002
1059
  }
1003
1060
  const schema = allSchemas.length === 1 ? allSchemas[0] : allSchemas;
1061
+ let schemaFilter;
1062
+ if (dialect === "postgresql") {
1063
+ if (options.schemaFilter) {
1064
+ schemaFilter = options.schemaFilter;
1065
+ } else if (options.autoDetectSchemas && expandedFiles.length > 0) {
1066
+ schemaFilter = detectSchemasFromFiles(expandedFiles);
1067
+ }
1068
+ }
1004
1069
  return {
1005
1070
  schema,
1006
1071
  out,
1007
1072
  dialect,
1008
- dbCredentials: getDbCredentials(dialect, databaseUrl)
1073
+ dbCredentials: getDbCredentials(dialect, databaseUrl),
1074
+ schemaFilter,
1075
+ migrations: {
1076
+ prefix: options.migrationPrefix ?? "timestamp"
1077
+ }
1009
1078
  };
1010
1079
  }
1011
1080
  function getDbCredentials(dialect, url) {
@@ -1032,13 +1101,17 @@ function generateDrizzleConfigFile(options = {}) {
1032
1101
  const schemaValue = Array.isArray(config.schema) ? `[
1033
1102
  ${config.schema.map((s) => `'${normalizeSchemaPath(s)}'`).join(",\n ")}
1034
1103
  ]` : `'${normalizeSchemaPath(config.schema)}'`;
1104
+ const schemaFilterLine = config.schemaFilter && config.schemaFilter.length > 0 ? `
1105
+ schemaFilter: ${JSON.stringify(config.schemaFilter)},` : "";
1106
+ const migrationsLine = config.migrations ? `
1107
+ migrations: ${JSON.stringify(config.migrations)},` : "";
1035
1108
  return `import { defineConfig } from 'drizzle-kit';
1036
1109
 
1037
1110
  export default defineConfig({
1038
1111
  schema: ${schemaValue},
1039
1112
  out: '${config.out}',
1040
1113
  dialect: '${config.dialect}',
1041
- dbCredentials: ${JSON.stringify(config.dbCredentials, null, 4)},
1114
+ dbCredentials: ${JSON.stringify(config.dbCredentials, null, 4)},${schemaFilterLine}${migrationsLine}
1042
1115
  });
1043
1116
  `;
1044
1117
  }
@@ -1052,10 +1125,10 @@ function timestamps() {
1052
1125
  };
1053
1126
  }
1054
1127
  function foreignKey(name, reference, options) {
1055
- return bigserial(`${name}_id`, { mode: "number" }).notNull().references(reference, { onDelete: options?.onDelete ?? "cascade" });
1128
+ return bigint(`${name}_id`, { mode: "number" }).notNull().references(reference, { onDelete: options?.onDelete ?? "cascade" });
1056
1129
  }
1057
1130
  function optionalForeignKey(name, reference, options) {
1058
- return bigserial(`${name}_id`, { mode: "number" }).references(reference, { onDelete: options?.onDelete ?? "set null" });
1131
+ return bigint(`${name}_id`, { mode: "number" }).references(reference, { onDelete: options?.onDelete ?? "set null" });
1059
1132
  }
1060
1133
  function uuid() {
1061
1134
  return uuid$1("id").defaultRandom().primaryKey();