@stacksjs/config 0.70.258 → 0.70.259
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 -42
- package/dist/config.js +1 -109
- package/dist/defaults.js +5 -628
- package/dist/features.js +1 -53
- package/dist/helpers.js +1 -156
- package/dist/index.js +1 -5
- package/dist/overrides.js +3 -120
- package/dist/validators.js +1 -135
- package/package.json +13 -6
package/dist/capabilities.js
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
export const capabilityRegistry = [
|
|
2
|
-
{ 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: [] },
|
|
3
|
-
{ category: "database", name: "mysql", status: "partial", implementation: "storage/framework/core/database/src/drivers/mysql.ts", testEvidence: ["storage/framework/core/database/tests/integration.test.ts"], topology: "client-server", prerequisites: ["MySQL service"], limitations: ["The default CI suite does not yet publish a dedicated dialect report.", "The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on MySQL. They must be regenerated against MySQL before migrating."] },
|
|
4
|
-
{ 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."] },
|
|
5
|
-
{ 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: "sharded-mysql-behind-vtgate", prerequisites: ["A Vitess cluster reachable at vtgate", "A VSchema (see `buddy generate:vschema`)"], limitations: ["No live cluster in CI; the retained evidence covers the DDL constraint profile and VSchema generation, not a round trip through vtgate.", "Sharded keyspaces reject foreign keys and AUTO_INCREMENT, so a corpus generated for plain MySQL will not migrate \u2014 regenerate it, and use `useUuid` for primary keys.", "Schema changes are expected to go through Vitess online DDL; `buddy migrate` applies DDL over the connection and is only appropriate for unsharded keyspaces.", "A transaction spanning shards is best-effort or two-phase, not the single-node ACID the ORM assumes."] },
|
|
6
|
-
{ category: "database", name: "postgres", status: "partial", implementation: "storage/framework/core/database/src/drivers/postgres.ts", testEvidence: ["storage/framework/core/database/tests/postgres-pivot-timestamptz.test.ts"], topology: "client-server", prerequisites: ["PostgreSQL service"], limitations: ["The default CI suite does not provision PostgreSQL.", "The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on PostgreSQL. They must be regenerated against PostgreSQL before migrating."] },
|
|
7
|
-
{ 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."] },
|
|
8
|
-
{ 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."] },
|
|
9
|
-
{ 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."] },
|
|
10
|
-
{ 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" } },
|
|
11
|
-
{ category: "queue", name: "sqs", status: "unsupported", implementation: null, testEvidence: [], topology: "managed-service", prerequisites: ["AWS SQS"], limitations: ["Configuration shape is reserved; dispatch fails loudly."] },
|
|
12
|
-
{ category: "queue", name: "memory", status: "unsupported", implementation: null, testEvidence: [], topology: "in-process", prerequisites: [], limitations: ["Reserved driver name; dispatch fails loudly."] },
|
|
13
|
-
{ category: "queue", name: "beanstalkd", status: "unsupported", implementation: null, testEvidence: [], topology: "client-server", prerequisites: ["Beanstalkd service"], limitations: ["Reserved driver name; dispatch fails loudly."] },
|
|
14
|
-
{ 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."] },
|
|
15
|
-
{ 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"], topology: "client-server", prerequisites: ["Redis 8.8 service"], limitations: ["The retained contract covers core cache and TTL operations; TLS/authenticated deployments require separate provider evidence."], liveServiceContract: { service: "redis", version: "8.8.0", workflow: ".github/workflows/ci.yml" } },
|
|
16
|
-
{ 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."] },
|
|
17
|
-
{ 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: [] },
|
|
18
|
-
{ 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."] },
|
|
19
|
-
{ 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."] },
|
|
20
|
-
{ 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."] },
|
|
21
|
-
{ 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."] },
|
|
22
|
-
{ 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."] },
|
|
23
|
-
...["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."] })),
|
|
24
|
-
{ category: "realtime", name: "websocket", status: "supported", implementation: "storage/framework/core/realtime/src/ws.ts", testEvidence: ["storage/framework/core/realtime/tests/ws-auth.test.ts", "storage/framework/core/realtime/tests/backpressure.test.ts"], topology: "single-process-websocket", prerequisites: ["Bun server"], limitations: ["Scale-out requires an application-provided fan-out layer."] },
|
|
25
|
-
{ category: "deploy", name: "ts-cloud-hetzner", status: "experimental", implementation: "storage/framework/core/buddy/src/commands/deploy.ts", testEvidence: [], 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."] }
|
|
26
|
-
];
|
|
27
|
-
export function capabilityDrivers(category) {
|
|
28
|
-
return capabilityRegistry.filter((driver) => driver.category === category);
|
|
29
|
-
}
|
|
30
|
-
export function findCapability(category, name) {
|
|
31
|
-
return capabilityRegistry.find((driver) => driver.category === category && driver.name === name);
|
|
32
|
-
}
|
|
33
|
-
export function assertCapabilityAvailable(category, name) {
|
|
34
|
-
const capability = findCapability(category, name);
|
|
35
|
-
if (!capability) {
|
|
36
|
-
const known = capabilityDrivers(category).map((driver) => driver.name).join(", ");
|
|
37
|
-
throw Error(`[config] Unknown ${category} driver "${name}". Known drivers: ${known}`);
|
|
38
|
-
}
|
|
39
|
-
if (capability.status === "unsupported")
|
|
40
|
-
throw Error(`[config] ${category} driver "${name}" is unsupported: ${capability.limitations.join(" ")}`);
|
|
41
|
-
return capability;
|
|
42
|
-
}
|
|
1
|
+
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:"partial",implementation:"storage/framework/core/database/src/drivers/mysql.ts",testEvidence:["storage/framework/core/database/tests/integration.test.ts"],topology:"client-server",prerequisites:["MySQL service"],limitations:["The default CI suite does not yet publish a dedicated dialect report.","The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on MySQL. They must be regenerated against MySQL before migrating."]},{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:"sharded-mysql-behind-vtgate",prerequisites:["A Vitess cluster reachable at vtgate","A VSchema (see `buddy generate:vschema`)"],limitations:["No live cluster in CI; the retained evidence covers the DDL constraint profile and VSchema generation, not a round trip through vtgate.","Sharded keyspaces reject foreign keys and AUTO_INCREMENT, so a corpus generated for plain MySQL will not migrate \u2014 regenerate it, and use `useUuid` for primary keys.","Schema changes are expected to go through Vitess online DDL; `buddy migrate` applies DDL over the connection and is only appropriate for unsharded keyspaces.","A transaction spanning shards is best-effort or two-phase, not the single-node ACID the ORM assumes."]},{category:"database",name:"postgres",status:"partial",implementation:"storage/framework/core/database/src/drivers/postgres.ts",testEvidence:["storage/framework/core/database/tests/postgres-pivot-timestamptz.test.ts"],topology:"client-server",prerequisites:["PostgreSQL service"],limitations:["The default CI suite does not provision PostgreSQL.","The migration files shipped under database/migrations are emitted for a single dialect (SQLite in the default template) and do not replay on PostgreSQL. They must be regenerated against PostgreSQL before migrating."]},{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:"redis",status:"supported",implementation:"storage/framework/core/cache/src/drivers/index.ts",testEvidence:["storage/framework/core/cache/tests/redis-contract.test.ts"],topology:"client-server",prerequisites:["Redis 8.8 service"],limitations:["The retained contract covers core cache and TTL operations; 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:"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/ws.ts",testEvidence:["storage/framework/core/realtime/tests/ws-auth.test.ts","storage/framework/core/realtime/tests/backpressure.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:[],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."]}];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)}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}
|
package/dist/config.js
CHANGED
|
@@ -1,109 +1 @@
|
|
|
1
|
-
import { defaults } from "./defaults";
|
|
2
|
-
import { overrides, overridesReady } from "./overrides";
|
|
3
|
-
function readMerged(prop) {
|
|
4
|
-
const o = overrides[prop];
|
|
5
|
-
if (o !== void 0 && (typeof o !== "object" || Object.keys(o).length > 0))
|
|
6
|
-
return o;
|
|
7
|
-
return defaults[prop];
|
|
8
|
-
}
|
|
9
|
-
const proxyTarget = function configProxyTarget() {};
|
|
10
|
-
export const config = new Proxy(proxyTarget, {
|
|
11
|
-
get(_t, prop) {
|
|
12
|
-
return readMerged(prop);
|
|
13
|
-
},
|
|
14
|
-
has(_t, prop) {
|
|
15
|
-
return prop in overrides || prop in defaults;
|
|
16
|
-
},
|
|
17
|
-
ownKeys() {
|
|
18
|
-
return Array.from(new Set([
|
|
19
|
-
...Object.keys(overrides),
|
|
20
|
-
...Object.keys(defaults)
|
|
21
|
-
]));
|
|
22
|
-
},
|
|
23
|
-
getOwnPropertyDescriptor(_t, prop) {
|
|
24
|
-
if (typeof prop !== "string")
|
|
25
|
-
return;
|
|
26
|
-
if (!(prop in overrides) && !(prop in defaults))
|
|
27
|
-
return;
|
|
28
|
-
return {
|
|
29
|
-
enumerable: !0,
|
|
30
|
-
configurable: !0,
|
|
31
|
-
writable: !0,
|
|
32
|
-
value: readMerged(prop)
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
isExtensible() {
|
|
36
|
-
return !0;
|
|
37
|
-
},
|
|
38
|
-
preventExtensions() {
|
|
39
|
-
return !1;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
export async function awaitConfig() {
|
|
43
|
-
await overridesReady;
|
|
44
|
-
return config;
|
|
45
|
-
}
|
|
46
|
-
const DB_READY = Symbol.for("@stacksjs/config:databaseReady"), globalScope = globalThis;
|
|
47
|
-
export async function awaitDatabaseConfig() {
|
|
48
|
-
await overridesReady;
|
|
49
|
-
const deadline = Date.now() + 5000;
|
|
50
|
-
while (!globalScope[DB_READY] && Date.now() < deadline)
|
|
51
|
-
await new Promise((r) => setTimeout(r, 25));
|
|
52
|
-
if (!globalScope[DB_READY])
|
|
53
|
-
console.warn("[config] awaitDatabaseConfig() timed out \u2014 database driver did not signal readiness within 5s");
|
|
54
|
-
return config;
|
|
55
|
-
}
|
|
56
|
-
export function markDatabaseReady() {
|
|
57
|
-
globalScope[DB_READY] = !0;
|
|
58
|
-
}
|
|
59
|
-
export function getConfig() {
|
|
60
|
-
return config;
|
|
61
|
-
}
|
|
62
|
-
export let { ai, analytics, app, auth, realtime, cache, cloud, cli, dashboard, database, dns, docs, email, errors, featureFlags, git, hashing, library, logging, notification, payment, ports, queue, security, saas, searchEngine, services, filesystems, team, ui } = config;
|
|
63
|
-
overridesReady.then(() => {
|
|
64
|
-
ai = config.ai;
|
|
65
|
-
analytics = config.analytics;
|
|
66
|
-
app = config.app;
|
|
67
|
-
auth = config.auth;
|
|
68
|
-
realtime = config.realtime;
|
|
69
|
-
cache = config.cache;
|
|
70
|
-
cloud = config.cloud;
|
|
71
|
-
cli = config.cli;
|
|
72
|
-
dashboard = config.dashboard;
|
|
73
|
-
database = config.database;
|
|
74
|
-
dns = config.dns;
|
|
75
|
-
docs = config.docs;
|
|
76
|
-
email = config.email;
|
|
77
|
-
errors = config.errors;
|
|
78
|
-
featureFlags = config.featureFlags;
|
|
79
|
-
git = config.git;
|
|
80
|
-
hashing = config.hashing;
|
|
81
|
-
library = config.library;
|
|
82
|
-
logging = config.logging;
|
|
83
|
-
notification = config.notification;
|
|
84
|
-
payment = config.payment;
|
|
85
|
-
ports = config.ports;
|
|
86
|
-
queue = config.queue;
|
|
87
|
-
security = config.security;
|
|
88
|
-
saas = config.saas;
|
|
89
|
-
searchEngine = config.searchEngine;
|
|
90
|
-
services = config.services;
|
|
91
|
-
filesystems = config.filesystems;
|
|
92
|
-
team = config.team;
|
|
93
|
-
ui = config.ui;
|
|
94
|
-
}).catch(() => {});
|
|
95
|
-
|
|
96
|
-
export * from "./helpers";
|
|
97
|
-
export { defaults, overrides, overridesReady };
|
|
98
|
-
export function determineAppEnv() {
|
|
99
|
-
const env = config.app?.env;
|
|
100
|
-
if (env === "local" || env === "development")
|
|
101
|
-
return "dev";
|
|
102
|
-
if (env === "staging")
|
|
103
|
-
return "stage";
|
|
104
|
-
if (env === "production")
|
|
105
|
-
return "prod";
|
|
106
|
-
if (!env)
|
|
107
|
-
throw Error("Couldn't determine app environment");
|
|
108
|
-
return env;
|
|
109
|
-
}
|
|
1
|
+
import{defaults}from"./defaults";import{overrides,overridesReady}from"./overrides";function readMerged(prop){const o=overrides[prop];if(o!==void 0&&(typeof o!=="object"||Object.keys(o).length>0))return o;return defaults[prop]}const proxyTarget=function configProxyTarget(){};export const config=new Proxy(proxyTarget,{get(_t,prop){return readMerged(prop)},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:!0,configurable:!0,writable:!0,value:readMerged(prop)}},isExtensible(){return!0},preventExtensions(){return!1}});export async function awaitConfig(){await overridesReady;return config}const DB_READY=Symbol.for("@stacksjs/config:databaseReady"),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 \u2014 database driver did not signal readiness within 5s");return config}export function markDatabaseReady(){globalScope[DB_READY]=!0}export function getConfig(){return config}export let{ai,analytics,app,auth,realtime,cache,cloud,cli,dashboard,database,dns,docs,email,errors,featureFlags,git,hashing,library,logging,notification,payment,ports,queue,security,saas,searchEngine,services,filesystems,team,ui}=config;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;services=config.services;filesystems=config.filesystems;team=config.team;ui=config.ui}).catch(()=>{});export*from"./helpers";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 Error("Couldn't determine app environment");return env}
|