@stacksjs/config 0.75.515 → 0.75.519
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/capabilities.js +1 -1
- package/dist/defaults.js +2 -2
- package/dist/discovered-resources.js +1 -1
- package/dist/features.js +1 -1
- package/dist/helpers.js +1 -1
- package/dist/overrides.js +3 -3
- package/dist/plain-env.js +1 -1
- package/dist/request-context.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/validators.js +1 -1
- package/dist/views.js +1 -1
- package/package.json +8 -8
package/dist/capabilities.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const REMOTE_TOPOLOGIES=new Set(["client-server","managed-service","managed-object-storage","mysql-behind-vtgate","smtp-server","worker-and-redis","hetzner-vm-systemd-rpx","ssh-box-systemd-rpx"]);export function isRemoteTopology(topology){return REMOTE_TOPOLOGIES.has(topology)}export const capabilityRegistry=[{category:"database",name:"sqlite",status:"supported",implementation:"storage/framework/core/database/src/drivers/sqlite.ts",testEvidence:["storage/framework/core/database/tests/integration.test.ts","storage/framework/core/database/tests/sqlite-tx-serialization.test.ts"],topology:"embedded",prerequisites:["Bun SQLite"],limitations:[]},{category:"database",name:"mysql",status:"supported",implementation:"storage/framework/core/database/src/drivers/mysql.ts",testEvidence:["storage/framework/core/database/tests/integration.test.ts","storage/framework/core/database/tests/affected-rows.test.ts","storage/framework/core/database/tests/ensure-database-sessions.test.ts","storage/framework/core/auth/tests/session-refresh-mysql.test.ts"],topology:"client-server",prerequisites:["MySQL 26.7 service"],limitations:["The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on MySQL. Regenerate them against MySQL (`buddy generate:migrations`) before migrating."],liveServiceContract:{service:"mysql",version:"26.7.0",workflow:".github/workflows/ci.yml"}},{category:"database",name:"singlestore",status:"experimental",implementation:"storage/framework/core/database/src/drivers/mysql.ts",testEvidence:[],topology:"client-server",prerequisites:["SingleStore service"],limitations:["MySQL wire compatibility exists, but a dedicated conformance matrix is not published."]},{category:"database",name:"vitess",status:"experimental",implementation:"storage/framework/core/database/src/drivers/mysql.ts",testEvidence:["storage/framework/core/database/tests/vitess-constraints.test.ts"],topology:"mysql-behind-vtgate",prerequisites:["A Vitess cluster reachable at vtgate"],limitations:["No live cluster in CI; the retained evidence covers unsharded and sharded DDL profiles plus VSchema generation, not a round trip through vtgate.","Set DB_VITESS_SHARDED=true for a sharded keyspace; those keyspaces reject cross-shard foreign keys and AUTO_INCREMENT, so use application-generated IDs and a VSchema.","Schema changes on sharded keyspaces should go through Vitess online DDL.","A transaction spanning shards is best-effort or two-phase, not the single-node ACID the ORM assumes."]},{category:"database",name:"postgres",status:"supported",implementation:"storage/framework/core/database/src/drivers/postgres.ts",testEvidence:["storage/framework/core/database/tests/postgres-pivot-timestamptz.test.ts","storage/framework/core/database/tests/postgres-transaction-scope.test.ts","storage/framework/core/database/tests/affected-rows.test.ts","storage/framework/core/database/tests/ensure-database-sessions.test.ts"],topology:"client-server",prerequisites:["PostgreSQL 17 service"],limitations:["The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on PostgreSQL. Regenerate them against PostgreSQL (`buddy generate:migrations`) before migrating."],liveServiceContract:{service:"postgres",version:"17.11",workflow:".github/workflows/ci.yml"}},{category:"database",name:"turso",aliases:["libsql"],status:"experimental",implementation:"storage/framework/core/database/src/dialect.ts",testEvidence:["storage/framework/core/database/tests/turso.test.ts"],topology:"managed-service",prerequisites:["A Turso database (TURSO_DATABASE_URL, TURSO_AUTH_TOKEN), or a local libSQL server from `turso dev` / sqld"],limitations:["Proven against a local sqld 0.24.32 (turso CLI 1.0.33 `turso dev`), not a hosted Turso database, and no libSQL service runs in CI yet, so the retained evidence skips its live half there.","SQLite SQL over Hrana HTTP: each statement outside a transaction is one request, and a transaction holds one server stream for its duration.","sqld refuses VACUUM, ATTACH, temporary tables and every PRAGMA except the read-only ones and foreign_keys.","Embedded replicas are not supported; the connection is always remote.","Inside transaction(), write through the tx handle: model writes use their own connection, as on PostgreSQL and MySQL, and wait while the transaction holds the write lock.","Scheduler onOneServer() locks stay per-host, as they are on SQLite.","`buddy db:backup` does not dump a Turso database; rely on Turso's own point-in-time restore."]},{category:"database",name:"dynamodb",status:"unsupported",implementation:"storage/framework/core/database/src/drivers/dynamodb.ts",testEvidence:[],topology:"managed-service",prerequisites:["DynamoDB"],limitations:["DynamoDB helpers are not an ORM SQL driver and cannot be selected as database.default."]},{category:"queue",name:"sync",status:"supported",implementation:"storage/framework/core/queue/src/job.ts",testEvidence:["storage/framework/core/queue/tests/jobs.test.ts"],topology:"inline",prerequisites:[],limitations:["Not durable."]},{category:"queue",name:"database",status:"supported",implementation:"storage/framework/core/queue/src/job.ts",testEvidence:["storage/framework/core/queue/tests/integration.test.ts","storage/framework/core/queue/tests/failure-path-correctness.test.ts"],topology:"worker-and-embedded-sqlite",prerequisites:["Bun SQLite for the retained CI contract"],limitations:["Other SQL providers require their own provider evidence."]},{category:"queue",name:"redis",status:"supported",implementation:"storage/framework/core/queue/src/drivers/redis.ts",testEvidence:["storage/framework/core/queue/tests/redis-contract.test.ts"],topology:"worker-and-redis",prerequisites:["Redis 8.8 service"],limitations:["The retained contract covers queue persistence operations; horizontal scaling and distributed-lock extensions require separate evidence."],liveServiceContract:{service:"redis",version:"8.8.0",workflow:".github/workflows/ci.yml"}},{category:"queue",name:"sqs",status:"unsupported",implementation:null,testEvidence:[],topology:"managed-service",prerequisites:["AWS SQS"],limitations:["Configuration shape is reserved; dispatch fails loudly."]},{category:"queue",name:"memory",status:"unsupported",implementation:null,testEvidence:[],topology:"in-process",prerequisites:[],limitations:["Reserved driver name; dispatch fails loudly."]},{category:"queue",name:"beanstalkd",status:"unsupported",implementation:null,testEvidence:[],topology:"client-server",prerequisites:["Beanstalkd service"],limitations:["Reserved driver name; dispatch fails loudly."]},{category:"cache",name:"memory",status:"supported",implementation:"storage/framework/core/cache/src/drivers/index.ts",testEvidence:["storage/framework/core/cache/tests/Memory.test.ts","storage/framework/core/cache/tests/ttl.test.ts"],topology:"in-process",prerequisites:[],limitations:["Not shared across processes."]},{category:"cache",name:"sqlite",status:"supported",implementation:"storage/framework/core/cache/src/drivers/sqlite.ts",testEvidence:["storage/framework/core/cache/tests/sqlite-cache.test.ts","storage/framework/core/cache/tests/sqlite-concurrent-open.test.ts","storage/framework/core/cache/tests/tag-index-processes.test.ts"],topology:"embedded",prerequisites:["Bun SQLite and a writable persistent file"],limitations:["Values must be JSON-serializable. Retain the SQLite file across deploys. Stampede protection is process-local; this is not a distributed cache."]},{category:"cache",name:"redis",status:"supported",implementation:"storage/framework/core/cache/src/drivers/index.ts",testEvidence:["storage/framework/core/cache/tests/redis-contract.test.ts","storage/framework/core/cache/tests/redis-config-connection.test.ts","storage/framework/core/cache/tests/redis-namespaces.test.ts"],topology:"client-server",prerequisites:["Redis 8.8 service"],limitations:["The retained contract covers core cache and TTL operations, a connection built from host and port, and namespace isolation from the queue and realtime; TLS/authenticated deployments require separate provider evidence."],liveServiceContract:{service:"redis",version:"8.8.0",workflow:".github/workflows/ci.yml"}},{category:"cache",name:"singlestore",status:"experimental",implementation:"storage/framework/core/cache/src/drivers/singlestore.ts",testEvidence:[],topology:"client-server",prerequisites:["SingleStore service"],limitations:["No dedicated CI service matrix."]},{category:"storage",name:"local",status:"supported",implementation:"storage/framework/core/storage/src/adapters/local.ts",testEvidence:["storage/framework/core/storage/tests/localStorage.test.ts","storage/framework/core/storage/tests/deep-integration.test.ts"],topology:"local-filesystem",prerequisites:[],limitations:[]},{category:"storage",name:"memory",status:"supported",implementation:"storage/framework/core/storage/src/adapters/memory.ts",testEvidence:["storage/framework/core/storage/tests/memoryAdapter.test.ts"],topology:"in-process",prerequisites:[],limitations:["Not persistent."]},{category:"storage",name:"s3",status:"partial",implementation:"storage/framework/core/storage/src/adapters/s3.ts",testEvidence:["storage/framework/core/storage/tests/s3-presigned-post.test.ts"],topology:"managed-object-storage",prerequisites:["S3-compatible service and credentials"],limitations:["CI covers request construction but not a live provider round trip."]},{category:"storage",name:"bun",status:"partial",implementation:"storage/framework/core/storage/src/adapters/bun.ts",testEvidence:["storage/framework/core/storage/tests/bunAdapter.test.ts"],topology:"local-filesystem",prerequisites:["Bun runtime"],limitations:["Adapter-specific feature parity is not fully reported."]},{category:"storage",name:"azure",status:"partial",implementation:"storage/framework/core/storage/src/adapters/azure.ts",testEvidence:["storage/framework/core/storage/tests/azure-adapter.test.ts","storage/framework/core/storage/tests/azure-signing.test.ts"],topology:"managed-object-storage",prerequisites:["An Azure storage account, a container, and an account key or SAS token"],limitations:["CI covers Shared Key and service-SAS signing plus request construction, not a live container round trip.","Visibility is a container property on Azure, so changeVisibility() refuses rather than silently doing nothing; a per-object grant is signedUrl().","ensureConfiguredBuckets provisions S3 buckets only, so the container must exist before the disk is used."]},{category:"mail",name:"log",status:"supported",implementation:"storage/framework/core/email/src/drivers/log.ts",testEvidence:["storage/framework/core/email/tests/email.test.ts"],topology:"local-file",prerequisites:[],limitations:["Development/testing transport only."]},{category:"mail",name:"capture",status:"supported",implementation:"storage/framework/core/email/src/drivers/capture.ts",testEvidence:["storage/framework/core/email/tests/email.test.ts"],topology:"in-process",prerequisites:[],limitations:["Testing transport only."]},...["smtp","ses","sendgrid","mailgun","mailtrap"].map((name)=>({category:"mail",name,status:"partial",implementation:`storage/framework/core/email/src/drivers/${name}.ts`,testEvidence:["storage/framework/core/email/tests/driver-credentials.test.ts"],topology:name==="smtp"?"smtp-server":"managed-service",prerequisites:[`${name} credentials`],limitations:["CI validates configuration and request behavior without a live delivery assertion."]})),{category:"realtime",name:"websocket",status:"supported",implementation:"storage/framework/core/realtime/src/server-instance.ts",testEvidence:["storage/framework/core/realtime/tests/ws-auth.test.ts","storage/framework/core/realtime/tests/websocket-options.test.ts"],topology:"single-process-websocket",prerequisites:["Bun server"],limitations:["Scale-out requires an application-provided fan-out layer."]},{category:"deploy",name:"ts-cloud-hetzner",status:"experimental",implementation:"storage/framework/core/buddy/src/commands/deploy.ts",testEvidence:["storage/framework/core/buddy/tests/deploy-ssh-target.test.ts"],topology:"hetzner-vm-systemd-rpx",prerequisites:["@stacksjs/ts-cloud","Hetzner credentials","SSH key"],limitations:["Live provider evidence and rollback conformance are not yet retained in the protocol report."]},{category:"deploy",name:"ts-cloud-ssh",status:"experimental",implementation:"storage/framework/core/buddy/src/commands/deploy-ssh-target.ts",testEvidence:["storage/framework/core/buddy/tests/deploy-ssh-target.test.ts"],topology:"ssh-box-systemd-rpx",prerequisites:["@stacksjs/ts-cloud with the ssh driver","A 64-bit Debian or Ubuntu host reachable over SSH","Passwordless sudo when deploying as a non-root user"],limitations:["DNS, TLS issuance, CDN and mail reconciliation are skipped for a host on a private address.","One app host per project; multi-host ssh fleets are not supported.","No live hardware evidence is retained in CI."]}];export function capabilityDrivers(category){return capabilityRegistry.filter((driver)=>driver.category===category)}export function findCapability(category,name){return capabilityRegistry.find((driver)=>driver.category===category&&(driver.name===name||driver.aliases?.includes(name)===!0))}export function assertCapabilityAvailable(category,name){const capability=findCapability(category,name);if(!capability){const known=capabilityDrivers(category).map((driver)=>driver.name).join(", ");throw Error(`[config] Unknown ${category} driver "${name}". Known drivers: ${known}`)}if(capability.status==="unsupported")throw Error(`[config] ${category} driver "${name}" is unsupported: ${capability.limitations.join(" ")}`);return capability}
|
|
1
|
+
export const REMOTE_TOPOLOGIES=new Set(["client-server","managed-service","managed-object-storage","mysql-behind-vtgate","smtp-server","worker-and-redis","hetzner-vm-systemd-rpx","ssh-box-systemd-rpx"]);export function isRemoteTopology(topology){return REMOTE_TOPOLOGIES.has(topology)}export const capabilityRegistry=[{category:"database",name:"sqlite",status:"supported",implementation:"storage/framework/core/database/src/drivers/sqlite.ts",testEvidence:["storage/framework/core/database/tests/integration.test.ts","storage/framework/core/database/tests/sqlite-tx-serialization.test.ts"],topology:"embedded",prerequisites:["Bun SQLite"],limitations:[]},{category:"database",name:"mysql",status:"supported",implementation:"storage/framework/core/database/src/drivers/mysql.ts",testEvidence:["storage/framework/core/database/tests/integration.test.ts","storage/framework/core/database/tests/affected-rows.test.ts","storage/framework/core/database/tests/ensure-database-sessions.test.ts","storage/framework/core/auth/tests/session-refresh-mysql.test.ts"],topology:"client-server",prerequisites:["MySQL 26.7 service"],limitations:["The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on MySQL. Regenerate them against MySQL (`buddy generate:migrations`) before migrating."],liveServiceContract:{service:"mysql",version:"26.7.0",workflow:".github/workflows/ci.yml"}},{category:"database",name:"singlestore",status:"experimental",implementation:"storage/framework/core/database/src/drivers/mysql.ts",testEvidence:[],topology:"client-server",prerequisites:["SingleStore service"],limitations:["MySQL wire compatibility exists, but a dedicated conformance matrix is not published."]},{category:"database",name:"vitess",status:"experimental",implementation:"storage/framework/core/database/src/drivers/mysql.ts",testEvidence:["storage/framework/core/database/tests/vitess-constraints.test.ts"],topology:"mysql-behind-vtgate",prerequisites:["A Vitess cluster reachable at vtgate"],limitations:["No live cluster in CI; the retained evidence covers unsharded and sharded DDL profiles plus VSchema generation, not a round trip through vtgate.","Set DB_VITESS_SHARDED=true for a sharded keyspace; those keyspaces reject cross-shard foreign keys and AUTO_INCREMENT, so use application-generated IDs and a VSchema.","Schema changes on sharded keyspaces should go through Vitess online DDL.","A transaction spanning shards is best-effort or two-phase, not the single-node ACID the ORM assumes."]},{category:"database",name:"postgres",status:"supported",implementation:"storage/framework/core/database/src/drivers/postgres.ts",testEvidence:["storage/framework/core/database/tests/postgres-pivot-timestamptz.test.ts","storage/framework/core/database/tests/postgres-transaction-scope.test.ts","storage/framework/core/database/tests/affected-rows.test.ts","storage/framework/core/database/tests/ensure-database-sessions.test.ts"],topology:"client-server",prerequisites:["PostgreSQL 17 service"],limitations:["The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on PostgreSQL. Regenerate them against PostgreSQL (`buddy generate:migrations`) before migrating."],liveServiceContract:{service:"postgres",version:"17.11",workflow:".github/workflows/ci.yml"}},{category:"database",name:"turso",aliases:["libsql"],status:"experimental",implementation:"storage/framework/core/database/src/dialect.ts",testEvidence:["storage/framework/core/database/tests/turso.test.ts"],topology:"managed-service",prerequisites:["A Turso database (TURSO_DATABASE_URL, TURSO_AUTH_TOKEN), or a local libSQL server from `turso dev` / sqld"],limitations:["Proven against a local sqld 0.24.32 (turso CLI 1.0.33 `turso dev`), not a hosted Turso database, and no libSQL service runs in CI yet, so the retained evidence skips its live half there.","SQLite SQL over Hrana HTTP: each statement outside a transaction is one request, and a transaction holds one server stream for its duration.","sqld refuses VACUUM, ATTACH, temporary tables and every PRAGMA except the read-only ones and foreign_keys.","Embedded replicas are not supported; the connection is always remote.","Inside transaction(), write through the tx handle: model writes use their own connection, as on PostgreSQL and MySQL, and wait while the transaction holds the write lock.","Scheduler onOneServer() locks stay per-host, as they are on SQLite.","`buddy db:backup` does not dump a Turso database; rely on Turso's own point-in-time restore."]},{category:"database",name:"dynamodb",status:"unsupported",implementation:"storage/framework/core/database/src/drivers/dynamodb.ts",testEvidence:[],topology:"managed-service",prerequisites:["DynamoDB"],limitations:["DynamoDB helpers are not an ORM SQL driver and cannot be selected as database.default."]},{category:"queue",name:"sync",status:"supported",implementation:"storage/framework/core/queue/src/job.ts",testEvidence:["storage/framework/core/queue/tests/jobs.test.ts"],topology:"inline",prerequisites:[],limitations:["Not durable."]},{category:"queue",name:"database",status:"supported",implementation:"storage/framework/core/queue/src/job.ts",testEvidence:["storage/framework/core/queue/tests/integration.test.ts","storage/framework/core/queue/tests/failure-path-correctness.test.ts"],topology:"worker-and-embedded-sqlite",prerequisites:["Bun SQLite for the retained CI contract"],limitations:["Other SQL providers require their own provider evidence."]},{category:"queue",name:"redis",status:"supported",implementation:"storage/framework/core/queue/src/drivers/redis.ts",testEvidence:["storage/framework/core/queue/tests/redis-contract.test.ts"],topology:"worker-and-redis",prerequisites:["Redis 8.8 service"],limitations:["The retained contract covers queue persistence operations; horizontal scaling and distributed-lock extensions require separate evidence."],liveServiceContract:{service:"redis",version:"8.8.0",workflow:".github/workflows/ci.yml"}},{category:"queue",name:"sqs",status:"unsupported",implementation:null,testEvidence:[],topology:"managed-service",prerequisites:["AWS SQS"],limitations:["Configuration shape is reserved; dispatch fails loudly."]},{category:"queue",name:"memory",status:"unsupported",implementation:null,testEvidence:[],topology:"in-process",prerequisites:[],limitations:["Reserved driver name; dispatch fails loudly."]},{category:"queue",name:"beanstalkd",status:"unsupported",implementation:null,testEvidence:[],topology:"client-server",prerequisites:["Beanstalkd service"],limitations:["Reserved driver name; dispatch fails loudly."]},{category:"cache",name:"memory",status:"supported",implementation:"storage/framework/core/cache/src/drivers/index.ts",testEvidence:["storage/framework/core/cache/tests/Memory.test.ts","storage/framework/core/cache/tests/ttl.test.ts"],topology:"in-process",prerequisites:[],limitations:["Not shared across processes."]},{category:"cache",name:"sqlite",status:"supported",implementation:"storage/framework/core/cache/src/drivers/sqlite.ts",testEvidence:["storage/framework/core/cache/tests/sqlite-cache.test.ts","storage/framework/core/cache/tests/sqlite-concurrent-open.test.ts","storage/framework/core/cache/tests/tag-index-processes.test.ts"],topology:"embedded",prerequisites:["Bun SQLite and a writable persistent file"],limitations:["Values must be JSON-serializable. Retain the SQLite file across deploys. Stampede protection is process-local; this is not a distributed cache."]},{category:"cache",name:"redis",status:"supported",implementation:"storage/framework/core/cache/src/drivers/index.ts",testEvidence:["storage/framework/core/cache/tests/redis-contract.test.ts","storage/framework/core/cache/tests/redis-config-connection.test.ts","storage/framework/core/cache/tests/redis-namespaces.test.ts"],topology:"client-server",prerequisites:["Redis 8.8 service"],limitations:["The retained contract covers core cache and TTL operations, a connection built from host and port, and namespace isolation from the queue and realtime; TLS/authenticated deployments require separate provider evidence."],liveServiceContract:{service:"redis",version:"8.8.0",workflow:".github/workflows/ci.yml"}},{category:"cache",name:"singlestore",status:"experimental",implementation:"storage/framework/core/cache/src/drivers/singlestore.ts",testEvidence:[],topology:"client-server",prerequisites:["SingleStore service"],limitations:["No dedicated CI service matrix."]},{category:"storage",name:"local",status:"supported",implementation:"storage/framework/core/storage/src/adapters/local.ts",testEvidence:["storage/framework/core/storage/tests/localStorage.test.ts","storage/framework/core/storage/tests/deep-integration.test.ts"],topology:"local-filesystem",prerequisites:[],limitations:[]},{category:"storage",name:"memory",status:"supported",implementation:"storage/framework/core/storage/src/adapters/memory.ts",testEvidence:["storage/framework/core/storage/tests/memoryAdapter.test.ts"],topology:"in-process",prerequisites:[],limitations:["Not persistent."]},{category:"storage",name:"s3",status:"partial",implementation:"storage/framework/core/storage/src/adapters/s3.ts",testEvidence:["storage/framework/core/storage/tests/s3-presigned-post.test.ts"],topology:"managed-object-storage",prerequisites:["S3-compatible service and credentials"],limitations:["CI covers request construction but not a live provider round trip."]},{category:"storage",name:"bun",status:"partial",implementation:"storage/framework/core/storage/src/adapters/bun.ts",testEvidence:["storage/framework/core/storage/tests/bunAdapter.test.ts"],topology:"local-filesystem",prerequisites:["Bun runtime"],limitations:["Adapter-specific feature parity is not fully reported."]},{category:"storage",name:"azure",status:"partial",implementation:"storage/framework/core/storage/src/adapters/azure.ts",testEvidence:["storage/framework/core/storage/tests/azure-adapter.test.ts","storage/framework/core/storage/tests/azure-signing.test.ts"],topology:"managed-object-storage",prerequisites:["An Azure storage account, a container, and an account key or SAS token"],limitations:["CI covers Shared Key and service-SAS signing plus request construction, not a live container round trip.","Visibility is a container property on Azure, so changeVisibility() refuses rather than silently doing nothing; a per-object grant is signedUrl().","ensureConfiguredBuckets provisions S3 buckets only, so the container must exist before the disk is used."]},{category:"mail",name:"log",status:"supported",implementation:"storage/framework/core/email/src/drivers/log.ts",testEvidence:["storage/framework/core/email/tests/email.test.ts"],topology:"local-file",prerequisites:[],limitations:["Development/testing transport only."]},{category:"mail",name:"capture",status:"supported",implementation:"storage/framework/core/email/src/drivers/capture.ts",testEvidence:["storage/framework/core/email/tests/email.test.ts"],topology:"in-process",prerequisites:[],limitations:["Testing transport only."]},...["smtp","ses","sendgrid","mailgun","mailtrap"].map((name)=>({category:"mail",name,status:"partial",implementation:`storage/framework/core/email/src/drivers/${name}.ts`,testEvidence:["storage/framework/core/email/tests/driver-credentials.test.ts"],topology:name==="smtp"?"smtp-server":"managed-service",prerequisites:[`${name} credentials`],limitations:["CI validates configuration and request behavior without a live delivery assertion."]})),{category:"realtime",name:"websocket",status:"supported",implementation:"storage/framework/core/realtime/src/server-instance.ts",testEvidence:["storage/framework/core/realtime/tests/ws-auth.test.ts","storage/framework/core/realtime/tests/websocket-options.test.ts"],topology:"single-process-websocket",prerequisites:["Bun server"],limitations:["Scale-out requires an application-provided fan-out layer."]},{category:"deploy",name:"ts-cloud-hetzner",status:"experimental",implementation:"storage/framework/core/buddy/src/commands/deploy.ts",testEvidence:["storage/framework/core/buddy/tests/deploy-ssh-target.test.ts"],topology:"hetzner-vm-systemd-rpx",prerequisites:["@stacksjs/ts-cloud","Hetzner credentials","SSH key"],limitations:["Live provider evidence and rollback conformance are not yet retained in the protocol report."]},{category:"deploy",name:"ts-cloud-ssh",status:"experimental",implementation:"storage/framework/core/buddy/src/commands/deploy-ssh-target.ts",testEvidence:["storage/framework/core/buddy/tests/deploy-ssh-target.test.ts"],topology:"ssh-box-systemd-rpx",prerequisites:["@stacksjs/ts-cloud with the ssh driver","A 64-bit Debian or Ubuntu host reachable over SSH","Passwordless sudo when deploying as a non-root user"],limitations:["DNS, TLS issuance, CDN and mail reconciliation are skipped for a host on a private address.","One app host per project; multi-host ssh fleets are not supported.","No live hardware evidence is retained in CI."]}];export function capabilityDrivers(category){return capabilityRegistry.filter((driver)=>driver.category===category)}export function findCapability(category,name){return capabilityRegistry.find((driver)=>driver.category===category&&(driver.name===name||driver.aliases?.includes(name)===true))}export function assertCapabilityAvailable(category,name){const capability=findCapability(category,name);if(!capability){const known=capabilityDrivers(category).map((driver)=>driver.name).join(", ");throw new Error(`[config] Unknown ${category} driver "${name}". Known drivers: ${known}`)}if(capability.status==="unsupported")throw new Error(`[config] ${category} driver "${name}" is unsupported: ${capability.limitations.join(" ")}`);return capability}
|
package/dist/defaults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import{commandsPath,projectPath,userDatabasePath}from"@stacksjs/path";import{plainEnv}from"./plain-env";export const FRAMEWORK_DEFAULTS={awsRegion:"us-east-1",timezone:"UTC",noReplyEmail:"no-reply@stacksjs.com",fallbackDomain:"stacks.localhost"};function deriveAppDefaults(){try{const pkgPath=projectPath("package.json");const pkg=require(pkgPath);const raw=(pkg.name??"").trim();if(!raw)return{name:"Stacks",url:"stacks.localhost"};const slug=raw.replace(/^@[^/]+\//,"").toLowerCase();const name=slug.replace(/[-_]+/g," ").replace(/(^|\s)\w/g,(c)=>c.toUpperCase());return{name,url:`${slug}.localhost`}}catch{return{name:"Stacks",url:"stacks.localhost"}}}const appDefaults=deriveAppDefaults();export const defaults={cms:{enabled:false},commerce:{enabled:false},marketing:{enabled:false},monitoring:{enabled:false},sites:{enabled:false},forms:{enabled:false},sms:{enabled:false,provider:"twilio",drivers:{}},ai:{deploy:false,models:["amazon.nova-lite-v1:0","amazon.titan-embed-text-v2:0","global.anthropic.claude-sonnet-5-5","global.anthropic.claude-haiku-4-5-20251001-v1:0"]},auth:{username:"email",password:"password",defaultTokenName:"auth-token",cookie:{name:"auth-token"},tokenExpiry:60*60*1000,refreshTokenExpiry:30*24*60*60*1000,defaultAbilities:["*"]},realtime:{driver:"pusher"},analytics:{driver:"analyticshq"},socials:{},app:{name:appDefaults.name,description:"A Stacks application.",env:"local",url:appDefaults.url,debug:true,key:"",timezone:FRAMEWORK_DEFAULTS.timezone,locale:"en",fallbackLocale:"en",cipher:"AES-256-CBC",docMode:false,redirectUrls:[],maintenanceMode:false,comingSoonMode:false,comingSoonSecret:""},cli:{name:"My Custom CLI",command:"my-custom-cli",description:"Stacks is a full-stack framework for TypeScript.",source:commandsPath(),deploy:false},cache:{driver:"memory",prefix:"stx",ttl:3600,maxKeys:-1,useClones:true,drivers:{redis:{host:"localhost",port:6379,username:"",password:"",database:0,tls:false},memory:{maxKeys:-1,checkPeriod:600,deleteOnExpire:true}}},featureFlags:{default:"memory",missing:"false",drivers:{memory:{cloneValues:true},database:{table:"feature_flags",autoCreate:false}}},cloud:{infrastructure:{type:"serverless",driver:"aws",environments:["production","staging","development"],firewall:{enabled:true,countryCodes:[],ipAddresses:[],queryString:[],httpHeaders:[],rateLimitPerMinute:1000,useIpReputationLists:true,useKnownBadInputsRuleSet:true},cdn:{allowedMethods:"GET_HEAD",cachedMethods:"GET_HEAD",minTtl:0,defaultTtl:86400,maxTtl:31536000,compress:true,priceClass:"PriceClass_All",originShieldRegion:FRAMEWORK_DEFAULTS.awsRegion,cookieBehavior:"none",allowList:{cookies:[],headers:[],queryStrings:[]},realtimeLogs:{enabled:true,samplingRate:2}},fileSystem:false,storage:{}},sites:{root:"",path:""}},dashboard:{sections:{library:{enabled:true},analytics:{enabled:true},management:{enabled:true},utilities:{enabled:true}}},database:{default:"sqlite",logging:false,connections:{sqlite:{database:plainEnv("DB_DATABASE_PATH")||userDatabasePath("stacks.sqlite"),prefix:""}},migrations:"migrations",migrationLocks:"migration_locks"},dns:{driver:"aws",a:[],aaaa:[],cname:[],mx:[],txt:[]},docs:{lang:"en-US",lastUpdated:true,deploy:false,themeConfig:{editLink:{pattern:"https://github.com/stacksjs/stacks/edit/main/docs/docs/:path",text:"Edit this page on GitHub"},footer:{message:"Released under the MIT License.",copyright:"Copyright © 2024-present Stacks.js, Inc."}}},email:{from:{name:"Stacks",address:FRAMEWORK_DEFAULTS.noReplyEmail},mailboxes:[],server:{enabled:true,scan:true}},errors:{messages:{string:"The {{ field }} field must be a string",email:"The {{ field }} field must be a valid email address",regex:"The {{ field }} field format is invalid",url:"The {{ field }} field must be a valid URL",activeUrl:"The {{ field }} field must be a valid URL",alpha:"The {{ field }} field must contain only letters",alphaNumeric:"The {{ field }} field must contain only letters and numbers",minLength:"The {{ field }} field must have at least {{ min }} characters",maxLength:"The {{ field }} field must not be greater than {{ max }} characters",fixedLength:"The {{ field }} field must be {{ size }} characters long",confirmed:"The {{ field }} field and {{ otherField }} field must be the same",endsWith:"The {{ field }} field must end with {{ substring }}",startsWith:"The {{ field }} field must start with {{ substring }}",sameAs:"The {{ field }} field and {{ otherField }} field must be the same",notSameAs:"The {{ field }} field and {{ otherField }} field must be different",in:"The selected {{ field }} is invalid",notIn:"The selected {{ field }} is invalid",ipAddress:"The {{ field }} field must be a valid IP address",uuid:"The {{ field }} field must be a valid UUID",ascii:"The {{ field }} field must only contain ASCII characters",creditCard:"The {{ field }} field must be a valid {{ providersList }} card number",hexCode:"The {{ field }} field must be a valid hex color code",iban:"The {{ field }} field must be a valid IBAN number",jwt:"The {{ field }} field must be a valid JWT token",coordinates:"The {{ field }} field must contain latitude and longitude coordinates",mobile:"The {{ field }} field must be a valid mobile phone number",passport:"The {{ field }} field must be a valid passport number",postalCode:"The {{ field }} field must be a valid postal code",boolean:"The value must be a boolean",number:"The {{ field }} field must be a number",min:"The {{ field }} field must be at least {{ min }}",max:"The {{ field }} field must not be greater than {{ max }}",range:"The {{ field }} field must be between {{ min }} and {{ max }}",positive:"The {{ field }} field must be positive",negative:"The {{ field }} field must be negative",decimal:"The {{ field }} field must have {{ digits }} decimal places",withoutDecimals:"The {{ field }} field must not have decimal places",date:"The {{ field }} field must be a datetime value","date.equals":"The {{ field }} field must be a date equal to {{ expectedValue }}","date.after":"The {{ field }} field must be a date after {{ expectedValue }}","date.before":"The {{ field }} field must be a date before {{ expectedValue }}","date.afterOrEqual":"The {{ field }} field must be a date after or equal to {{ expectedValue }}","date.beforeOrEqual":"The {{ field }} field must be a date before or equal to {{ expectedValue }}","date.sameAs":"The {{ field }} field and {{ otherField }} field must be the same","date.notSameAs":"The {{ field }} field and {{ otherField }} field must be different","date.afterField":"The {{ field }} field must be a date after {{ otherField }}",accepted:"The {{ field }} field must be accepted",enum:"The selected {{ field }} is invalid",literal:"The {{ field }} field must be {{ expectedValue }}",object:"The {{ field }} field must be an object",record:"The {{ field }} field must be an object","record.min":"The {{ field }} field must have at least {{ min }} items","record.maxLength":"The {{ field }} field must not have more than {{ max }} items","record.fixedLength":"The {{ field }} field must contain {{ size }} items",array:"The {{ field }} field must be an array","array.min":"The {{ field }} field must have at least {{ min }} items","array.maxLength":"The {{ field }} field must not have more than {{ max }} items","array.fixedLength":"The {{ field }} field must contain {{ size }} items",notEmpty:"The {{ field }} field must not be empty",distinct:"The {{ field }} field has duplicate values",tuple:"The {{ field }} field must be an array",union:"Invalid value provided for {{ field }} field",unionGroup:"Invalid value provided for {{ field }} field",unionOfTypes:"Invalid value provided for {{ field }} field"}},git:{hooks:{"pre-commit":"lint-staged"},scopes:["","ci","deps","dx","release","docs","test","core","actions","arrays","auth","build","cache","cli","cloud","collections","config","database","datetime","docs","errors","git","lint","modules","notifications","objects","path","realtime","router","buddy","security","server","storage","strings","tests","types","ui","utils"],messages:{type:"Select the type of change that you're committing:",scope:"Select the SCOPE of this change (optional):",customScope:"Select the SCOPE of this change:",subject:`Write a SHORT, IMPERATIVE tense description of the change:
|
|
2
2
|
`,body:`Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
3
3
|
`,breaking:`List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
4
4
|
`,footerPrefixesSelect:"Select the ISSUES type of the change list by this change (optional):",customFooterPrefixes:"Input ISSUES prefix:",footer:`List any ISSUES by this change. E.g.: #31, #34:
|
|
5
|
-
`,confirmCommit:"Are you sure you want to proceed with the commit above?"},types:[{value:"feat",name:"feat:
|
|
5
|
+
`,confirmCommit:"Are you sure you want to proceed with the commit above?"},types:[{value:"feat",name:"feat: ✨ A new feature",emoji:":sparkles:"},{value:"fix",name:"fix: \uD83D\uDC1B A bug fix",emoji:":bug:"},{value:"docs",name:"docs: \uD83D\uDCDD Documentation only changes",emoji:":memo:"},{value:"style",name:"style: \uD83D\uDC84 Changes that do not affect the meaning of the code",emoji:":lipstick:"},{value:"refactor",name:"refactor: ♻️ A code change that neither fixes a bug nor adds a feature",emoji:":recycle:"},{value:"perf",name:"perf: ⚡️ A code change that improves performance",emoji:":zap:"},{value:"test",name:"test: ✅ Adding missing tests or adjusting existing tests",emoji:":white_check_mark:"},{value:"build",name:"build: \uD83D\uDCE6️ Changes that affect the build system or external dependencies",emoji:":package:"},{value:"ci",name:"ci: \uD83C\uDFA1 Changes to our CI configuration files and scripts",emoji:":ferris_wheel:"},{value:"chore",name:"chore: \uD83D\uDD28 Other changes that don't modify src or test files",emoji:":hammer:"},{value:"revert",name:"revert: ⏪️ Reverts a previous commit",emoji:":rewind:"}]},hashing:{driver:"bcrypt",rehashOnLogin:true,bcrypt:{rounds:12},argon2:{memory:65536,time:2}},images:{social:{enabled:false,outputDir:"public/social",publicPath:"/social",presets:["og","square","portrait"]},appStore:{enabled:false,outputDir:"resources/app-store/screenshots"},appIcons:{enabled:false,outputDir:"resources/app-icons",platforms:["ios","macos"],faviconDir:"public"}},library:{name:"hello-world",owner:"@stacksjs",repository:"stacksjs/stacks",license:"MIT",author:"",contributors:[],defaultLanguage:"en",webComponents:{name:"hello-world-elements",description:"Your framework agnostic web component library description.",keywords:["custom-elements","web-components","library","framework-agnostic","typescript","javascript"],tags:[{name:["HelloWorld","AppHelloWorld"],description:"The Hello World custom element, built via this framework.",attributes:[{name:"greeting",description:"The greeting."}]}]},functions:{name:"hello-world-fx",description:"Your function library description.",keywords:["functions","composables","library","typescript","javascript"],shouldGenerateSourcemap:false,files:["counter","dark"]}},logging:{logsPath:"storage/logs/stacks.log",deploymentsPath:"storage/logs/deployments.log"},notification:{default:"email"},payment:{driver:"stripe"},server:{proxy:{}},ports:{frontend:3000,backend:3001,admin:3002,library:3003,desktop:3004,email:3005,docs:3006,inspect:3007,api:3008,systemTray:3009,database:3010},queue:{default:"sync",connections:{sync:{driver:"sync"},database:{driver:"database",table:"jobs",queue:"default",retryAfter:90},redis:{driver:"redis",queue:"default",retryAfter:90},sqs:{driver:"sqs",key:"",secret:"",prefix:"",suffix:"",queue:"default",region:FRAMEWORK_DEFAULTS.awsRegion}}},saas:{plans:[{productName:"Stacks Hobby",description:"All the Stacks features.",pricing:[{key:"stacks_hobby_monthly",price:3900,interval:"month",currency:"usd"},{key:"stacks_hobby_yearly",price:37900,interval:"year",currency:"usd"}],metadata:{createdBy:"admin",version:"1.0.0"}},{productName:"Stacks Pro",description:"All the Stacks features, including being able to invite team members.",pricing:[{key:"stacks_pro_monthly",price:5900,interval:"month",currency:"usd"},{key:"stacks_pro_yearly",price:57900,interval:"year",currency:"usd"}],metadata:{createdBy:"admin",version:"1.0.0"}}],webhook:{endpoint:"/webhooks/stripe",secret:""},currencies:["usd"],coupons:[{code:"SUMMER2024",amountOff:500,duration:"once"}],products:[{name:"Stacks Pro",description:"All the Stacks features.",images:["url_to_image"]}]},searchEngine:{driver:"opensearch"},security:{api:{rowScoping:"deny",models:"own"},rateLimit:{scale:1},firewall:{enabled:true,countryCodes:[],ipAddresses:[],queryString:[],httpHeaders:[],rateLimitPerMinute:1000,useIpReputationLists:true,useKnownBadInputsRuleSet:true}},services:{aws:{accountId:"",appId:"",apiKey:"",region:FRAMEWORK_DEFAULTS.awsRegion},algolia:{appId:"",apiKey:""},meilisearch:{appId:"",apiKey:""},stripe:{appId:"",apiKey:""}},filesystems:{driver:"local"},team:{name:"",members:{}},ui:{shortcuts:[["btn","inline-flex items-center px-4 py-2 ml-2 border border-transparent shadow-sm text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"]],safelist:"prose prose-sm m-auto text-left",trigger:":stx:",classPrefix:"stx-",reset:"tailwind",icons:["hugeicons"],fonts:{email:{title:"Mona",text:"Hubot"},desktop:{title:"Mona",text:"Hubot"},mobile:{title:"Mona",text:"Hubot"},web:{title:"Mona",text:"Hubot"}}}};export default defaults;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync,readFileSync}from"node:fs";import{isAbsolute,join}from"node:path";import{path}from"@stacksjs/path";const IMPLIED_DIRS={views:["resources/views"],models:["app/Models"],migrations:["database/migrations"],jobs:["app/Jobs"]};function readManifest(manifestPath){try{
|
|
1
|
+
import{existsSync,readFileSync}from"node:fs";import{isAbsolute,join}from"node:path";import{path}from"@stacksjs/path";const IMPLIED_DIRS={views:["resources/views"],models:["app/Models"],migrations:["database/migrations"],jobs:["app/Jobs"]};function readManifest(manifestPath){try{const parsed=JSON.parse(readFileSync(manifestPath,"utf8"));return parsed?.packages??{}}catch{return{}}}function resourceRoots(field,options={}){const manifestPath=options.manifestPath??path.storagePath("framework/discovered-packages.json");const projectRoot=options.projectRoot??path.projectPath();const exists=options.exists??existsSync;const roots=[];for(const[name,meta]of Object.entries(readManifest(manifestPath))){const declared=meta?.[field]??IMPLIED_DIRS[field];if(!declared)continue;const root=meta.root;if(!root||typeof root!=="string")continue;const base=isAbsolute(root)?root:join(projectRoot,root);for(const entry of Array.isArray(declared)?declared:[declared]){if(typeof entry!=="string"||!entry)continue;const cleaned=entry.replace(/^[/\\]+/,"");if(!cleaned||cleaned.split(/[/\\]/).includes(".."))continue;const dir=join(base,cleaned);if(exists(dir))roots.push({package:name,dir})}}return roots.sort((a,b)=>a.package.localeCompare(b.package))}export function packageMigrationRoots(options={}){return resourceRoots("migrations",options)}export function packageJobRoots(options={}){return resourceRoots("jobs",options)}export function packageComponentRoots(options={}){return resourceRoots("components",options)}export function packageViewRoots(options={}){return resourceRoots("views",options)}export function packageModelRoots(options={}){return resourceRoots("models",options)}
|
package/dist/features.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FEATURE_NAMES as INSTALLABLE_FEATURES}from"@stacksjs/features/names";import{config}from"./runtime";const FEATURE_NAMES=[...INSTALLABLE_FEATURES,"auth","email"]
|
|
1
|
+
import{FEATURE_NAMES as INSTALLABLE_FEATURES}from"@stacksjs/features/names";import{config}from"./runtime";const FEATURE_NAMES=[...INSTALLABLE_FEATURES,"auth","email"];const FEATURE_DEFAULTS={dashboard:true};const overrides=new Map;function configFor(name){const raw=config[name];return raw&&typeof raw==="object"?raw:undefined}function canonicalFeatures(){return process.env.STACKS_CANONICAL_FEATURES==="1"}export function feature(name){if(overrides.has(name))return overrides.get(name);if(canonicalFeatures()&&FEATURE_NAMES.includes(name))return true;const cfg=configFor(name);if(cfg){const enabledField=cfg.enabled;if(enabledField===false)return false;if(Array.isArray(cfg.env)&&cfg.env.length>0){const currentEnv=(config.app?.env??"").toString();if(!cfg.env.includes(currentEnv))return false}if(enabledField!==undefined)return!!enabledField;return true}return FEATURE_DEFAULTS[name]??false}export function enableFeature(name){overrides.set(name,true)}export function disableFeature(name){overrides.set(name,false)}export function resetFeature(name){overrides.delete(name)}export function listFeatures(){const out={};for(const name of FEATURE_NAMES)out[name]=feature(name);for(const name of overrides.keys())out[name]=feature(name);return out}
|
package/dist/helpers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{config}from"./runtime";export async function localUrl(options={}){const domain=options.domain??config.app.url??"stacks"
|
|
1
|
+
import{config}from"./runtime";export async function localUrl(options={}){const domain=options.domain??config.app.url??"stacks";const type=options.type??"frontend";const localhost=options.localhost??false;const https=options.https;const network=options.network;let url=domain.replace(/\.[^.]+$/,".localhost");async function tunnel(port){const{createLocalTunnel}=await import("@stacksjs/tunnel");return createLocalTunnel(port)}switch(type){case"frontend":if(network)return await tunnel(config.ports?.frontend||3000);if(localhost)return`http://localhost:${config.ports?.frontend}`;break;case"backend":if(network)return await tunnel(config.ports?.backend||3001);if(localhost)return`http://localhost:${config.ports?.backend}`;url=`api.${url}`;break;case"admin":if(network)return await tunnel(config.ports?.admin||3002);if(localhost)return`http://localhost:${config.ports?.admin}`;url=`admin.${url}`;break;case"library":if(network)return await tunnel(config.ports?.library||3003);if(localhost)return`http://localhost:${config.ports?.library}`;url=`libs.${url}`;break;case"email":if(network)return await tunnel(config.ports?.email||3005);if(localhost)return`http://localhost:${config.ports?.email}`;url=`email.${url}`;break;case"desktop":if(network)return await tunnel(config.ports?.desktop||3004);if(localhost)return`http://localhost:${config.ports?.desktop}`;url=`desktop.${url}`;break;case"docs":if(network)return await tunnel(config.ports?.docs||3006);if(localhost)return`http://localhost:${config.ports?.docs}`;url=`docs.${url}`;break;case"inspect":if(network)return await tunnel(config.ports?.inspect||3007);if(localhost)return`http://localhost:${config.ports?.inspect}`;url=`inspect.${url}`;break;default:if(localhost)return`http://localhost:${config.ports?.frontend}`}if(https)return`https://${url}`;return`http://${url}`}export function defineStacksConfig(config){return config}export function defineApp(config){return config}export function defineAuth(config){return config}export function defineCache(config){return config}export function defineCloud(config){return config}export function defineCdn(config){return config}export function defineChat(config){return config}export function defineCli(config){return config}export function defineDatabase(config){return config}export function defineDependencies(config){return config}export function defineDns(config){return config}export function defineEmailConfig(config){return config}export function defineEmail(config){return config}export function defineGit(config){return config}export function defineHashing(config){return config}export function defineImages(config){return config}export function defineLibrary(config){return config}export function defineNotification(config){return config}export function definePayment(config){return config}export function defineQueue(config){return config}export function defineSearchEngine(config){return config}export function defineSecurity(config){return config}export function defineServices(config){return config}export function defineSms(config){return config}export function defineStorage(config){return config}export function defineFilesystems(config){return config}export function defineFeatureFlags(config){return config}export function defineUi(config){return config}export{defineEvents}from"@stacksjs/events";
|
package/dist/overrides.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync}from"node:fs";import{resolve}from"node:path";import{pathToFileURL}from"node:url";import{defaults}from"./defaults";import{plainEnv}from"./plain-env";import{validateConfig}from"./validators";const skipConfigLoading=process.env.SKIP_CONFIG_LOADING==="true"
|
|
2
|
-
`);throw Error(`[config] ${issues.length} configuration issue(s) detected at boot:
|
|
1
|
+
import{existsSync}from"node:fs";import{resolve}from"node:path";import{pathToFileURL}from"node:url";import{defaults}from"./defaults";import{plainEnv}from"./plain-env";import{validateConfig}from"./validators";const skipConfigLoading=process.env.SKIP_CONFIG_LOADING==="true";const skipConfigValidation=process.env.SKIP_CONFIG_VALIDATION==="true";const OVERRIDES_KEY=Symbol.for("@stacksjs/config:overrides");const READY_KEY=Symbol.for("@stacksjs/config:overridesReady");export function defaultsForOverrides(){return{ai:{},analytics:{},app:{...defaults.app,name:plainEnv("APP_NAME")||defaults.app?.name||"Stacks",env:plainEnv("APP_ENV")||"production"},auth:{},cache:{},cli:{},cloud:{},cms:{},commerce:{},dashboard:{},database:{},dns:{},realtime:{},email:{},errors:{},featureFlags:{},git:{},hashing:{},images:{},library:{},logging:{},marketing:{},monitoring:{},notification:{},queue:{},payment:{},ports:{},saas:{},searchEngine:{},security:{},server:{},sites:{},forms:{},services:{},sms:{},socials:{},filesystems:{},team:{},ui:{}}}const globalScope=globalThis;const sharedOverrides=globalScope[OVERRIDES_KEY];export const overrides=sharedOverrides??(()=>{const created=defaultsForOverrides();globalScope[OVERRIDES_KEY]=created;return created})();const userConfigs=[["ai","ai"],["analytics","analytics"],["app","app"],["auth","auth"],["cache","cache"],["cli","cli"],["cloud","cloud"],["cms","cms"],["commerce","commerce"],["cors","cors"],["dashboard","dashboard"],["database","database"],["dns","dns"],["docs","docs"],["email","email"],["errors","errors"],["featureFlags","feature-flags"],["git","git"],["hashing","hashing"],["images","images"],["library","library"],["logging","logging"],["marketing","marketing"],["monitoring","monitoring"],["notification","notification"],["payment","payment"],["ports","ports"],["queue","queue"],["realtime","realtime"],["saas","saas"],["searchEngine","search-engine"],["security","security"],["sites","sites"],["forms","forms"],["server","server"],["services","services"],["sms","sms"],["socials","socials"],["filesystems","filesystems"],["team","team"],["ui","ui","stx"]];export function resolveUserConfigName(names,cwd=process.cwd()){const present=names.filter((candidate)=>existsSync(resolve(cwd,"config",`${candidate}.ts`)));if(present.length>1){console.warn(`[config] config/${present.join(".ts and config/")}.ts both exist and configure the same thing. `+`Using config/${present[0]}.ts; delete the other so every consumer agrees on one.`)}return present[0]??names[0]}export function userConfigUrl(name,cwd=process.cwd()){return pathToFileURL(resolve(cwd,"config",`${name}.ts`)).href}const sharedReady=globalScope[READY_KEY];export const overridesReady=sharedReady??(()=>{const promise=skipConfigLoading?Promise.resolve(overrides):Promise.all(userConfigs.map(async([key,...names])=>{const name=resolveUserConfigName(names);const modulePath=userConfigUrl(name);try{const mod=await import(modulePath);if(mod?.default!==undefined){overrides[key]=mod.default}}catch(err){const code=err?.code;const msg=err?.message??String(err);const isMissing=code==="ERR_MODULE_NOT_FOUND"||code==="MODULE_NOT_FOUND"||/Cannot find module/i.test(msg);if(!isMissing){console.warn(`[config] Failed to load ${String(key)} config from ${modulePath}: ${msg}`)}}})).then(()=>{if(!skipConfigValidation){const issues=validateConfig(overrides);if(issues.length>0){console.error("[config] Configuration issues detected:");for(const issue of issues){console.error(` • ${issue.path}: ${issue.message}`)}const summary=issues.map((i)=>` • ${i.path}: ${i.message}`).join(`
|
|
2
|
+
`);throw new Error(`[config] ${issues.length} configuration issue(s) detected at boot:
|
|
3
3
|
${summary}
|
|
4
|
-
Set SKIP_CONFIG_VALIDATION=true to bypass (e.g. when running migrations against partial config).`)}}return overrides});globalScope[READY_KEY]=promise;return promise})();export default overrides;
|
|
4
|
+
`+`Set SKIP_CONFIG_VALIDATION=true to bypass (e.g. when running migrations against partial config).`)}}return overrides});globalScope[READY_KEY]=promise;return promise})();export default overrides;
|
package/dist/plain-env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function isCiphertext(value){return typeof value==="string"&&(value.startsWith("encrypted:")||value.startsWith("enc:"))}export function plainEnv(key){const value=process.env[key];return isCiphertext(value)?
|
|
1
|
+
export function isCiphertext(value){return typeof value==="string"&&(value.startsWith("encrypted:")||value.startsWith("enc:"))}export function plainEnv(key){const value=process.env[key];return isCiphertext(value)?undefined:value}
|
package/dist/request-context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AsyncLocalStorage}from"node:async_hooks";export function parseCookieHeader(header){const out={};if(!header)return out;for(const part of header.split(";")){const trimmed=part.trim()
|
|
1
|
+
import{AsyncLocalStorage}from"node:async_hooks";export function parseCookieHeader(header){const out={};if(!header)return out;for(const part of header.split(";")){const trimmed=part.trim();const eq=trimmed.indexOf("=");if(eq===-1)continue;const key=trimmed.slice(0,eq).trim();if(!key)continue;const value=trimmed.slice(eq+1).trim();try{out[key]=decodeURIComponent(value)}catch{out[key]=value}}return out}export function createRequestContext(read){const snapshot=()=>read()??{};const searchOf=()=>{const direct=snapshot().search;if(direct)return direct;const url=snapshot().url??"";const mark=url.indexOf("?");return mark===-1?"":url.slice(mark)};return{cookie:(name)=>snapshot().cookies?.[name]??null,cookies:()=>snapshot().cookies??{},url:()=>snapshot().url??"",path:()=>{const direct=snapshot().path;if(direct)return direct;const url=snapshot().url??"";if(!url)return"";try{return new URL(url).pathname}catch{const mark=url.indexOf("?");return mark===-1?url:url.slice(0,mark)}},search:searchOf,query:()=>{const out={};const search=searchOf();if(!search)return out;new URLSearchParams(search.startsWith("?")?search.slice(1):search).forEach((value,key)=>{out[key]=value});return out},params:()=>snapshot().params??{},locale:()=>snapshot().locale??"en",ip:()=>snapshot().ip??"",host:()=>snapshot().host??"",site:()=>snapshot().site??null}}export function installRequestContext(read){const context=createRequestContext(read);globalThis.requestContext=context;return context}const SCOPE_STORAGE_KEY=Symbol.for("stacks.config.requestScope");const scopeStorage=globalThis[SCOPE_STORAGE_KEY]??=new AsyncLocalStorage;export function enterRequestScope(request){const url=new URL(request.url);const own={cookies:parseCookieHeader(request.headers.get("cookie")),url:request.url,path:url.pathname,search:url.search,host:request.headers.get("host")??url.host,site:null};scopeStorage.enterWith({own});return own}export function scopedRequestSnapshot(){const scope=scopeStorage.getStore();if(!scope)return;const{own,published}=scope;if(!published)return own;return{...own,...published,site:own.site??published.site??null}}const STX_SERVE_CONTEXT="__stxServeContext";export function scopeStxServeContext(){const existing=Object.getOwnPropertyDescriptor(globalThis,STX_SERVE_CONTEXT);if(existing?.get)return;let unscoped=existing?.value;Object.defineProperty(globalThis,STX_SERVE_CONTEXT,{configurable:true,enumerable:false,get:()=>{const scope=scopeStorage.getStore();return scope?scope.published:unscoped},set:(value)=>{const scope=scopeStorage.getStore();if(scope)scope.published=value;else unscoped=value}})}export function installRequestScope(){scopeStxServeContext();return installRequestContext(scopedRequestSnapshot)}export function useRequestEvent(){const context=globalThis.requestContext??createRequestContext(()=>{return});return{url:context.url(),path:context.path(),search:context.search(),query:context.query(),cookies:context.cookies(),params:context.params(),locale:context.locale(),ip:context.ip(),host:context.host(),site:context.site()}}
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defaults}from"./defaults";import{overrides,overridesReady}from"./overrides";function isPlainObject(value){if(typeof value!=="object"||value===null||Array.isArray(value))return
|
|
1
|
+
import{defaults}from"./defaults";import{overrides,overridesReady}from"./overrides";function isPlainObject(value){if(typeof value!=="object"||value===null||Array.isArray(value))return false;const proto=Object.getPrototypeOf(value);return proto===Object.prototype||proto===null}function overlay(base,over){const out={...base};for(const key of Object.keys(over)){const next=over[key];const prev=out[key];if(next===undefined)continue;out[key]=isPlainObject(prev)&&isPlainObject(next)?overlay(prev,next):next}return out}const mergedSections=new Map;function readMerged(prop){const o=overrides[prop];const d=defaults[prop];const hasOverride=o!==undefined&&(typeof o!=="object"||o===null||Object.keys(o).length>0);if(!hasOverride)return d;if(!isPlainObject(o)||!isPlainObject(d))return o;const cached=mergedSections.get(prop);if(cached&&cached.from===o)return cached.merged;const merged=overlay(d,o);mergedSections.set(prop,{from:o,merged});return merged}const proxyTarget=function configProxyTarget(){};export const config=new Proxy(proxyTarget,{get(_t,prop){return readMerged(prop)},set(_t,prop,value){overrides[prop]=value;return true},deleteProperty(_t,prop){delete overrides[prop];return true},has(_t,prop){return prop in overrides||prop in defaults},ownKeys(){return Array.from(new Set([...Object.keys(overrides),...Object.keys(defaults)]))},getOwnPropertyDescriptor(_t,prop){if(typeof prop!=="string")return;if(!(prop in overrides)&&!(prop in defaults))return;return{enumerable:true,configurable:true,writable:true,value:readMerged(prop)}},isExtensible(){return true},preventExtensions(){return false}});export async function awaitConfig(){await overridesReady;return config}const DB_READY=Symbol.for("@stacksjs/config:databaseReady");const globalScope=globalThis;export async function awaitDatabaseConfig(){await overridesReady;const deadline=Date.now()+5000;while(!globalScope[DB_READY]&&Date.now()<deadline){await new Promise((r)=>setTimeout(r,25))}if(!globalScope[DB_READY]){console.warn("[config] awaitDatabaseConfig() timed out - database driver did not signal readiness within 5s")}return config}export function markDatabaseReady(){globalScope[DB_READY]=true}export function getConfig(){return config}export let ai=config.ai;export let analytics=config.analytics;export let app=config.app;export let auth=config.auth;export let realtime=config.realtime;export let cache=config.cache;export let cloud=config.cloud;export let cli=config.cli;export let dashboard=config.dashboard;export let database=config.database;export let dns=config.dns;export let docs=config.docs;export let email=config.email;export let errors=config.errors;export let featureFlags=config.featureFlags;export let git=config.git;export let hashing=config.hashing;export let library=config.library;export let logging=config.logging;export let notification=config.notification;export let payment=config.payment;export let ports=config.ports;export let queue=config.queue;export let security=config.security;export let saas=config.saas;export let searchEngine=config.searchEngine;export let server=config.server;export let services=config.services;export let filesystems=config.filesystems;export let team=config.team;export let ui=config.ui;overridesReady.then(()=>{ai=config.ai;analytics=config.analytics;app=config.app;auth=config.auth;realtime=config.realtime;cache=config.cache;cloud=config.cloud;cli=config.cli;dashboard=config.dashboard;database=config.database;dns=config.dns;docs=config.docs;email=config.email;errors=config.errors;featureFlags=config.featureFlags;git=config.git;hashing=config.hashing;library=config.library;logging=config.logging;notification=config.notification;payment=config.payment;ports=config.ports;queue=config.queue;security=config.security;saas=config.saas;searchEngine=config.searchEngine;server=config.server;services=config.services;filesystems=config.filesystems;team=config.team;ui=config.ui}).catch(()=>{});export{defaults,overrides,overridesReady};export function determineAppEnv(){const env=config.app?.env;if(env==="local"||env==="development")return"dev";if(env==="staging")return"stage";if(env==="production")return"prod";if(!env)throw new Error("Couldn't determine app environment");return env}
|
package/dist/validators.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{capabilityDrivers,findCapability}from"./capabilities";import{isCiphertext}from"./plain-env";function isPlainObject(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function checkInteger(min,max){return(value,path)=>{if(value==null)return[];let num=null;if(typeof value==="number"&&Number.isInteger(value))num=value
|
|
1
|
+
import{capabilityDrivers,findCapability}from"./capabilities";import{isCiphertext}from"./plain-env";function isPlainObject(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function checkInteger(min,max){return(value,path)=>{if(value==null)return[];let num=null;if(typeof value==="number"&&Number.isInteger(value)){num=value}else if(typeof value==="string"&&/^-?\d+$/.test(value)){num=Number.parseInt(value,10)}if(num===null){return[{path,message:`expected integer, got ${typeof value} (${JSON.stringify(value)})`}]}if(num<min||num>max){return[{path,message:`expected integer in [${min}, ${max}], got ${num}`}]}return[]}}function checkOneOf(values){return(value,path)=>{if(value==null)return[];if(typeof value!=="string"||!values.includes(value)){return[{path,message:`expected one of [${values.join(", ")}], got ${JSON.stringify(value)}`}]}return[]}}function checkCapability(category){return(value,path)=>{if(value==null)return[];const drivers=capabilityDrivers(category);if(typeof value!=="string")return[{path,message:`expected ${category} driver name, got ${typeof value}`}];const capability=findCapability(category,value);if(!capability)return[{path,message:`unknown ${category} driver ${JSON.stringify(value)}; known drivers: [${drivers.map((driver)=>driver.name).join(", ")}]`}];if(capability.status==="unsupported")return[{path,message:`${category} driver ${JSON.stringify(value)} is unsupported: ${capability.limitations.join(" ")}`}];return[]}}function checkString(){return(value,path)=>{if(value==null)return[];return typeof value==="string"?[]:[{path,message:`expected string, got ${typeof value}`}]}}function checkBoolean(){return(value,path)=>{if(value==null)return[];return typeof value==="boolean"?[]:[{path,message:`expected boolean, got ${typeof value}`}]}}const PORT_CHECK=checkInteger(1,65535);const SCHEMA={app:{rules:{name:checkString(),env:checkOneOf(["local","development","staging","production","test"]),debug:checkBoolean(),url:checkString()}},ports:{rules:{frontend:PORT_CHECK,api:checkInteger(0,65535),admin:PORT_CHECK,docs:PORT_CHECK,systemTray:PORT_CHECK,desktop:PORT_CHECK}},database:{rules:{default:checkCapability("database")}},cache:{rules:{driver:checkCapability("cache")}},featureFlags:{rules:{default:checkOneOf(["memory","database"]),missing:checkOneOf(["false","throw"])}},queue:{rules:{default:checkCapability("queue")}},logging:{rules:{level:checkOneOf(["trace","debug","info","warn","error","fatal"])}},email:{rules:{default:checkCapability("mail")}}};export function validateConfig(config){const issues=[];for(const[section,schema]of Object.entries(SCHEMA)){const sectionValue=config[section];if(sectionValue==null)continue;if(!isPlainObject(sectionValue)){issues.push({path:section,message:`expected object, got ${typeof sectionValue}`});continue}for(const[field,check]of Object.entries(schema.rules)){const v=sectionValue[field];const path=`${section}.${field}`;if(isCiphertext(v)){issues.push({path,message:"value is still encrypted; no usable private key opened it, so config read the ciphertext. Set the matching DOTENV_PRIVATE_KEY_<ENV> or ship .env.keys, and read it through `env` from @stacksjs/env rather than process.env"});continue}issues.push(...check(v,path))}}return issues}export function reportConfigIssues(config){const issues=validateConfig(config);if(issues.length===0)return true;console.warn("[config] Configuration issues detected:");for(const issue of issues){console.warn(` • ${issue.path}: ${issue.message}`)}return false}
|
package/dist/views.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync}from"node:fs";import{join}from"node:path";import{packageViewRoots}from"./discovered-resources";export const DEFAULT_VIEW_ROUTE_BUNDLES={auth:["login.stx","register.stx","forgot-password.stx","password","auth"],dashboard:["cart.stx","checkout","orders","dashboard","feedback"]}
|
|
1
|
+
import{existsSync}from"node:fs";import{join}from"node:path";import{packageViewRoots}from"./discovered-resources";export const DEFAULT_VIEW_ROUTE_BUNDLES={auth:["login.stx","register.stx","forgot-password.stx","password","auth"],dashboard:["cart.stx","checkout","orders","dashboard","feedback"]};export const DEFAULT_VIEW_TEMPLATES=["cms"];export const DEFAULT_VIEWS_ALWAYS=["index.stx","coming-soon.stx","errors","emails"];export function withheldDefaultViews(mountedBundles){const withheld=[];for(const[bundle,views]of Object.entries(DEFAULT_VIEW_ROUTE_BUNDLES)){if(!mountedBundles.has(bundle))withheld.push(...views)}withheld.push(...DEFAULT_VIEW_TEMPLATES);return withheld}export function resolveViewPatterns(userViewsPath,defaultViewsPath,setting,exists=existsSync,packageViews=packageViewRoots({exists}),mountedBundles=new Set){const fromPackages=packageViews.map((root)=>root.dir);if(setting===undefined){const withheld=withheldDefaultViews(mountedBundles);return{patterns:[userViewsPath,defaultViewsPath,...fromPackages],missing:[],exclude:withheld.map((name)=>join(defaultViewsPath,name)),withheld}}if(setting===true)return{patterns:[userViewsPath,defaultViewsPath,...fromPackages],missing:[],exclude:[],withheld:[]};if(setting===false)return{patterns:[userViewsPath,...fromPackages],missing:[],exclude:[],withheld:[]};if(!Array.isArray(setting))return{patterns:[userViewsPath,defaultViewsPath,...fromPackages],missing:[],exclude:[],withheld:[]};const patterns=[userViewsPath];const missing=[];for(const name of setting){const cleaned=String(name).replace(/^[/\\]+/,"");if(!cleaned||cleaned.split(/[/\\]/).includes(".."))continue;const candidate=join(defaultViewsPath,cleaned);if(exists(candidate))patterns.push(candidate);else missing.push(cleaned)}patterns.push(...fromPackages);return{patterns,missing,exclude:[],withheld:[]}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/config",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.519",
|
|
6
6
|
"description": "The Stacks config helper methods.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"prepublishOnly": "bun run build"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@stacksjs/events": "0.75.
|
|
59
|
-
"@stacksjs/features": "0.75.
|
|
60
|
-
"@stacksjs/path": "0.75.
|
|
61
|
-
"@stacksjs/tunnel": "0.75.
|
|
58
|
+
"@stacksjs/events": "0.75.519",
|
|
59
|
+
"@stacksjs/features": "0.75.519",
|
|
60
|
+
"@stacksjs/path": "0.75.519",
|
|
61
|
+
"@stacksjs/tunnel": "0.75.519",
|
|
62
62
|
"ts-pantry": "^0.11.184"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@stacksjs/alias": "0.75.
|
|
66
|
-
"@stacksjs/env": "0.75.
|
|
67
|
-
"@stacksjs/types": "0.75.
|
|
65
|
+
"@stacksjs/alias": "0.75.519",
|
|
66
|
+
"@stacksjs/env": "0.75.519",
|
|
67
|
+
"@stacksjs/types": "0.75.519",
|
|
68
68
|
"better-dx": "^0.2.24"
|
|
69
69
|
}
|
|
70
70
|
}
|