@stacksjs/config 0.70.87 → 0.70.88
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/package.json +3 -3
- package/dist/config.d.ts +0 -101
- package/dist/defaults.d.ts +0 -20
- package/dist/features.d.ts +0 -39
- package/dist/helpers.d.ts +0 -44
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -9
- package/dist/overrides.d.ts +0 -4
- package/dist/validators.d.ts +0 -19
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/config",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.88",
|
|
6
6
|
"description": "The Stacks config helper methods.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"ts-pantry": "^0.10.11"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@stacksjs/alias": "0.70.
|
|
56
|
+
"@stacksjs/alias": "0.70.88",
|
|
57
57
|
"better-dx": "^0.2.16",
|
|
58
|
-
"@stacksjs/types": "0.70.
|
|
58
|
+
"@stacksjs/types": "0.70.88",
|
|
59
59
|
"bunfig": "^0.15.11"
|
|
60
60
|
}
|
|
61
61
|
}
|
package/dist/config.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { defaults } from './defaults';
|
|
2
|
-
import { overrides, overridesReady } from './overrides';
|
|
3
|
-
import type { StacksOptions } from '@stacksjs/types';
|
|
4
|
-
/*.ts` file has loaded and the
|
|
5
|
-
* `overrides` instance has been mutated in place. Use this in code paths
|
|
6
|
-
* that *must* see the merged values — typically anything outside the
|
|
7
|
-
* normal request flow (e.g. CLI commands, top-level boot scripts) where
|
|
8
|
-
* the request hasn't yet hit a route handler that already awaited.
|
|
9
|
-
*
|
|
10
|
-
* Inside request handlers / routes you generally do *not* need to await
|
|
11
|
-
* this: the router's `serverResponse()` only fires after `importRoutes()`
|
|
12
|
-
* resolves, and `importRoutes()` indirectly awaits config (it reads
|
|
13
|
-
* `app/Routes.ts`, which imports config). So the proxy returns merged
|
|
14
|
-
* values for all "normal" request-time reads.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { config, awaitConfig } from '@stacksjs/config'
|
|
19
|
-
*
|
|
20
|
-
* // CLI / top-level script — config files may not be loaded yet
|
|
21
|
-
* await awaitConfig()
|
|
22
|
-
* console.log(config.ports.api) // guaranteed to be the user value
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function awaitConfig(): Promise<StacksOptions>;
|
|
26
|
-
/**
|
|
27
|
-
* Resolves once `database` config has been read by `@stacksjs/database`'s
|
|
28
|
-
* lazy initializer. Use it from boot scripts that need a live `db` handle
|
|
29
|
-
* before the request loop starts.
|
|
30
|
-
*
|
|
31
|
-
* Why a separate signal: `overridesReady` only signals that `~/config/database.ts`
|
|
32
|
-
* was *imported*, not that `@stacksjs/database` has actually wired up the
|
|
33
|
-
* connection. Calling `db.selectFrom(...)` immediately after `overridesReady`
|
|
34
|
-
* resolves can still race the connection setup. The database driver flips
|
|
35
|
-
* this signal to `true` once it has a working connection.
|
|
36
|
-
*/
|
|
37
|
-
export declare function awaitDatabaseConfig(): Promise<StacksOptions>;
|
|
38
|
-
/**
|
|
39
|
-
* Called by `@stacksjs/database` once the connection is live. Internal —
|
|
40
|
-
* users shouldn't need to invoke this directly.
|
|
41
|
-
*/
|
|
42
|
-
export declare function markDatabaseReady(): void;
|
|
43
|
-
export declare function getConfig(): StacksOptions;
|
|
44
|
-
export declare function determineAppEnv(): AppEnv;
|
|
45
|
-
export declare const config: StacksOptions;
|
|
46
|
-
// Per-section convenience exports.
|
|
47
|
-
//
|
|
48
|
-
// Caveat: these are *snapshots* taken at module-load time. ESM `export
|
|
49
|
-
// const x = expr` evaluates `expr` once and binds `x` to that result —
|
|
50
|
-
// there's no language-level way to make a named export re-evaluate
|
|
51
|
-
// per access. So `import { ports } from '@stacksjs/config'` returns
|
|
52
|
-
// whatever `config.ports` was when the config module first evaluated,
|
|
53
|
-
// which is *before* `overridesReady` resolves and the user's
|
|
54
|
-
// `config/*.ts` files land.
|
|
55
|
-
//
|
|
56
|
-
// These start as snapshots of the framework defaults (because the user's
|
|
57
|
-
// `config/*.ts` haven't loaded yet — see `overridesReady`). Once the
|
|
58
|
-
// async loader resolves we reassign each `let` binding so consumers of
|
|
59
|
-
// `import { ports } from '@stacksjs/config'` see the merged value.
|
|
60
|
-
//
|
|
61
|
-
// ESM live bindings make this work: when an exporting module reassigns
|
|
62
|
-
// a `let`-bound export, every importer immediately sees the new value
|
|
63
|
-
// (no re-import needed). The earlier `export const x = config.x` form
|
|
64
|
-
// captured the empty-default snapshot forever.
|
|
65
|
-
//
|
|
66
|
-
// Caveat: code that destructures (`const { ports } = config` or reads
|
|
67
|
-
// at the top of a function) before `overridesReady` resolves still
|
|
68
|
-
// gets the early snapshot. For correctness in that path, read off
|
|
69
|
-
// the `config` proxy: `config.ports.api` always pulls live.
|
|
70
|
-
export declare let ai: StacksOptions['ai'];
|
|
71
|
-
export declare let analytics: StacksOptions['analytics'];
|
|
72
|
-
export declare let app: StacksOptions['app'];
|
|
73
|
-
export declare let auth: StacksOptions['auth'];
|
|
74
|
-
export declare let realtime: StacksOptions['realtime'];
|
|
75
|
-
export declare let cache: StacksOptions['cache'];
|
|
76
|
-
export declare let cloud: StacksOptions['cloud'];
|
|
77
|
-
export declare let cli: StacksOptions['cli'];
|
|
78
|
-
export declare let dashboard: StacksOptions['dashboard'];
|
|
79
|
-
export declare let database: StacksOptions['database'];
|
|
80
|
-
export declare let dns: StacksOptions['dns'];
|
|
81
|
-
export declare let docs: StacksOptions['docs'];
|
|
82
|
-
export declare let email: StacksOptions['email'];
|
|
83
|
-
export declare let errors: StacksOptions['errors'];
|
|
84
|
-
export declare let git: StacksOptions['git'];
|
|
85
|
-
export declare let hashing: StacksOptions['hashing'];
|
|
86
|
-
export declare let library: StacksOptions['library'];
|
|
87
|
-
export declare let logging: StacksOptions['logging'];
|
|
88
|
-
export declare let notification: StacksOptions['notification'];
|
|
89
|
-
export declare let payment: StacksOptions['payment'];
|
|
90
|
-
export declare let ports: StacksOptions['ports'];
|
|
91
|
-
export declare let queue: StacksOptions['queue'];
|
|
92
|
-
export declare let security: StacksOptions['security'];
|
|
93
|
-
export declare let saas: StacksOptions['saas'];
|
|
94
|
-
export declare let searchEngine: StacksOptions['searchEngine'];
|
|
95
|
-
export declare let services: StacksOptions['services'];
|
|
96
|
-
export declare let filesystems: StacksOptions['filesystems'];
|
|
97
|
-
export declare let team: StacksOptions['team'];
|
|
98
|
-
export declare let ui: StacksOptions['ui'];
|
|
99
|
-
declare type AppEnv = 'dev' | 'stage' | 'prod' | string;
|
|
100
|
-
export * from './helpers';
|
|
101
|
-
export { defaults, overrides, overridesReady };
|
package/dist/defaults.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { StacksOptions } from '@stacksjs/types';
|
|
2
|
-
/**
|
|
3
|
-
* Framework-wide default scalars. Defining these as named constants
|
|
4
|
-
* (rather than re-spelling the literal in each config section) keeps
|
|
5
|
-
* "where do I change the default region?" answerable from a single
|
|
6
|
-
* line — the previous shape had `'us-east-1'` typed in 4+ places that
|
|
7
|
-
* could drift when a multi-region future lands.
|
|
8
|
-
*/
|
|
9
|
-
export declare const FRAMEWORK_DEFAULTS: {
|
|
10
|
-
/** Default AWS region for SES, S3, DynamoDB, CloudFront origin shield. */
|
|
11
|
-
awsRegion: 'us-east-1';
|
|
12
|
-
/** Default scheduler / job timezone. UTC keeps cron predictable across hosts. */
|
|
13
|
-
timezone: 'UTC';
|
|
14
|
-
/** No-reply address for transactional email (override via config.email.from). */
|
|
15
|
-
noReplyEmail: 'no-reply@stacksjs.com';
|
|
16
|
-
/** Default project domain shape for new scaffolds. */
|
|
17
|
-
fallbackDomain: 'stacks.localhost'
|
|
18
|
-
};
|
|
19
|
-
export declare const defaults: StacksOptions;
|
|
20
|
-
export default defaults;
|
package/dist/features.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Truthy when the named feature is enabled in the current environment.
|
|
3
|
-
*
|
|
4
|
-
* Resolution order (first match wins):
|
|
5
|
-
* 1. Runtime override via `enableFeature` / `disableFeature`
|
|
6
|
-
* 2. `config.<name>.enabled` — boolean or omitted
|
|
7
|
-
* - Optional `config.<name>.env: string[]` narrows the flag to specific
|
|
8
|
-
* deploy targets (compared against `config.app.env`)
|
|
9
|
-
* 3. Per-feature framework default (only `dashboard` defaults true)
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* if (feature('commerce')) {
|
|
14
|
-
* await loadCommerceRoutes()
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare function feature(name: string): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Force-enable a feature in the running process. Intended for tests and
|
|
21
|
-
* staged rollouts; production code should prefer config-file overrides.
|
|
22
|
-
*/
|
|
23
|
-
export declare function enableFeature(name: string): void;
|
|
24
|
-
/**
|
|
25
|
-
* Force-disable a feature in the running process.
|
|
26
|
-
*/
|
|
27
|
-
export declare function disableFeature(name: string): void;
|
|
28
|
-
/**
|
|
29
|
-
* Drop a runtime override and fall back to the config-driven value.
|
|
30
|
-
*/
|
|
31
|
-
export declare function resetFeature(name: string): void;
|
|
32
|
-
/**
|
|
33
|
-
* Snapshot of the live flag set — useful for `/__features` debug endpoints
|
|
34
|
-
* and CLI commands that print the active configuration. Iterates the known
|
|
35
|
-
* framework features plus any runtime overrides for ad-hoc flags.
|
|
36
|
-
*/
|
|
37
|
-
export declare function listFeatures(): Record<string, boolean>;
|
|
38
|
-
export type StacksFeature = | 'auth' | 'marketing' | 'cms' | 'commerce'
|
|
39
|
-
| 'dashboard' | 'monitoring' | 'realtime' | 'queue';
|
package/dist/helpers.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { config } from '.';
|
|
2
|
-
import type { AppConfig, CacheConfig, CdnConfig, ChatConfig, CliConfig, DatabaseConfig, DependenciesConfig, DnsConfig, EmailConfig, Events, FilesystemsConfig, GitConfig, HashingConfig, LibraryConfig, Model, NotificationConfig, PaymentConfig, QueueConfig, SearchEngineConfig, SecurityConfig, ServicesConfig, StacksConfig, StorageConfig, UiConfig } from '@stacksjs/types';
|
|
3
|
-
export declare function localUrl(options?: {
|
|
4
|
-
domain?: string
|
|
5
|
-
type?: LocalUrlType
|
|
6
|
-
network?: boolean
|
|
7
|
-
localhost?: boolean
|
|
8
|
-
https?: boolean
|
|
9
|
-
}): Promise<string>;
|
|
10
|
-
export declare function defineStacksConfig(config: StacksConfig): StacksConfig;
|
|
11
|
-
export declare function defineApp(config: AppConfig): AppConfig;
|
|
12
|
-
export declare function defineCache(config: CacheConfig): CacheConfig;
|
|
13
|
-
export declare function defineCdn(config: CdnConfig): CdnConfig;
|
|
14
|
-
export declare function defineChat(config: ChatConfig): ChatConfig;
|
|
15
|
-
export declare function defineCli(config: CliConfig): CliConfig;
|
|
16
|
-
export declare function defineDatabase(config: DatabaseConfig): DatabaseConfig;
|
|
17
|
-
export declare function defineDependencies(config: DependenciesConfig): DependenciesConfig;
|
|
18
|
-
export declare function defineDns(config: DnsConfig): DnsConfig;
|
|
19
|
-
export declare function defineEmailConfig(config: EmailConfig): EmailConfig;
|
|
20
|
-
export declare function defineEmail(config: EmailConfig): EmailConfig;
|
|
21
|
-
export declare function defineGit(config: GitConfig): GitConfig;
|
|
22
|
-
export declare function defineHashing(config: HashingConfig): HashingConfig;
|
|
23
|
-
export declare function defineLibrary(config: LibraryConfig): LibraryConfig;
|
|
24
|
-
export declare function defineNotification(config: NotificationConfig): NotificationConfig;
|
|
25
|
-
export declare function definePayment(config: PaymentConfig): PaymentConfig;
|
|
26
|
-
export declare function defineQueue(config: QueueConfig): QueueConfig;
|
|
27
|
-
export declare function defineSearchEngine(config: SearchEngineConfig): SearchEngineConfig;
|
|
28
|
-
export declare function defineSecurity(config: SecurityConfig): SecurityConfig;
|
|
29
|
-
export declare function defineServices(config: ServicesConfig): ServicesConfig;
|
|
30
|
-
export declare function defineSms(config: any): any;
|
|
31
|
-
export declare function defineStorage(config: StorageConfig): StorageConfig;
|
|
32
|
-
export declare function defineFilesystems(config: FilesystemsConfig): FilesystemsConfig;
|
|
33
|
-
export declare function defineUi(config: UiConfig): UiConfig;
|
|
34
|
-
export declare function defineModel(config: Model): Model;
|
|
35
|
-
export declare function defineEvents(config: Events): Events;
|
|
36
|
-
export type LocalUrlType = | 'frontend'
|
|
37
|
-
| 'backend'
|
|
38
|
-
| 'api'
|
|
39
|
-
| 'admin'
|
|
40
|
-
| 'library'
|
|
41
|
-
| 'email'
|
|
42
|
-
| 'docs'
|
|
43
|
-
| 'inspect'
|
|
44
|
-
| 'desktop';
|
package/dist/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// IMPORTANT: do NOT re-add `export * as config from './config'` here.
|
|
2
|
-
// That line creates a module-namespace object named `config` whose
|
|
3
|
-
// properties are non-configurable per the ESM spec (namespaces are sealed).
|
|
4
|
-
// Because `export *` is also exporting the real `config` proxy from
|
|
5
|
-
// `./config`, the namespace object would shadow the proxy under the
|
|
6
|
-
// `config` name — and consumers that did `import { config }` would get
|
|
7
|
-
// the sealed namespace, not the live proxy. The visible symptom: every
|
|
8
|
-
// `config.X` read returns whatever value the proxy's get trap produced
|
|
9
|
-
// the *first* time (typically defaults), and later mutations from
|
|
10
|
-
// `overridesReady` are silently ignored.
|
|
11
|
-
export * from './config';
|
|
12
|
-
export { FRAMEWORK_DEFAULTS } from './defaults';
|
|
13
|
-
export { validateConfig, reportConfigIssues, type ConfigValidationIssue } from './validators';
|
|
14
|
-
export { feature, enableFeature, disableFeature, resetFeature, listFeatures } from './features';
|
package/dist/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var M=import.meta.require;import{commandsPath as P,projectPath as C,userDatabasePath as S}from"@stacksjs/path";var B={awsRegion:"us-east-1",timezone:"UTC",noReplyEmail:"no-reply@stacksjs.com",fallbackDomain:"stacks.localhost"};function D(){try{let x=C("package.json"),G=(M(x).name??"").trim();if(!G)return{name:"Stacks",url:"stacks.localhost"};let z=G.replace(/^@[^/]+\//,"").toLowerCase();return{name:z.replace(/[-_]+/g," ").replace(/(^|\s)\w/g,(Q)=>Q.toUpperCase()),url:`${z}.localhost`}}catch{return{name:"Stacks",url:"stacks.localhost"}}}var H=D(),U={cms:{enabled:!1},commerce:{enabled:!1},marketing:{enabled:!1},monitoring:{enabled:!1},ai:{deploy:!1,models:["anthropic.claude-sonnet-4-20250514-v1:0","anthropic.claude-haiku-4-20250514-v1:0","anthropic.claude-3-5-sonnet-20241022-v2:0","amazon.titan-embed-text-v2:0","amazon.titan-text-premier-v1:0","amazon.titan-image-generator-v2:0","meta.llama3-1-70b-instruct-v1:0","meta.llama3-1-8b-instruct-v1:0"]},auth:{username:"email",password:"password",defaultTokenName:"auth-token",tokenExpiry:3600000,refreshTokenExpiry:2592000000,defaultAbilities:["*"]},realtime:{driver:"pusher"},analytics:{driver:void 0},app:{name:H.name,description:"A Stacks application.",env:"local",url:H.url,debug:!0,key:"",timezone:B.timezone,locale:"en",fallbackLocale:"en",cipher:"AES-256-CBC",docMode:!1,redirectUrls:[],maintenanceMode:!1,comingSoonMode:!1,comingSoonSecret:""},cli:{name:"My Custom CLI",command:"my-custom-cli",description:"Stacks is a full-stack framework for TypeScript.",source:P(),deploy:!1},cache:{driver:"memory",prefix:"stx",ttl:3600,maxKeys:-1,useClones:!0,drivers:{redis:{host:"localhost",port:6379,username:"",password:"",database:0,tls:!1},memory:{maxKeys:-1,checkPeriod:600,deleteOnExpire:!0}}},cloud:{infrastructure:{type:"serverless",driver:"aws",environments:["production","staging","development"],firewall:{enabled:!0,countryCodes:[],ipAddresses:[],queryString:[],httpHeaders:[],rateLimitPerMinute:1000,useIpReputationLists:!0,useKnownBadInputsRuleSet:!0},cdn:{allowedMethods:"GET_HEAD",cachedMethods:"GET_HEAD",minTtl:0,defaultTtl:86400,maxTtl:31536000,compress:!0,priceClass:"PriceClass_All",originShieldRegion:B.awsRegion,cookieBehavior:"none",allowList:{cookies:[],headers:[],queryStrings:[]},realtimeLogs:{enabled:!0,samplingRate:2}},fileSystem:!1,storage:{}},sites:{root:"",path:""}},dashboard:{sections:{library:{enabled:!0},content:{enabled:!0},commerce:{enabled:!0},marketing:{enabled:!0},analytics:{enabled:!0},management:{enabled:!0},utilities:{enabled:!0}}},database:{default:"sqlite",logging:!1,connections:{sqlite:{database:S("stacks.sqlite"),prefix:""}},migrations:"migrations",migrationLocks:"migration_locks"},dns:{driver:"aws",a:[],aaaa:[],cname:[],mx:[],txt:[]},docs:{lang:"en-US",title:"Stacks",description:"Rapid application, cloud & library framework.",lastUpdated:!0,deploy:!1,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 \xA9 2024-present Stacks.js, Inc."}}},email:{from:{name:"Stacks",address:B.noReplyEmail},mailboxes:[],server:{enabled:!0,scan:!0}},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","min(":"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","x-ray","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:
|
|
3
|
-
`,body:`Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
4
|
-
`,breaking:`List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
5
|
-
`,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:
|
|
6
|
-
`,confirmCommit:"Are you sure you want to proceed with the commit above?"},types:[{value:"feat",name:"feat: \u2728 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: \u267B\uFE0F A code change that neither fixes a bug nor adds a feature",emoji:":recycle:"},{value:"perf",name:"perf: \u26A1\uFE0F A code change that improves performance",emoji:":zap:"},{value:"test",name:"test: \u2705 Adding missing tests or adjusting existing tests",emoji:":white_check_mark:"},{value:"build",name:"build: \uD83D\uDCE6\uFE0F 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: \u23EA\uFE0F Reverts a previous commit",emoji:":rewind:"}]},hashing:{driver:"bcrypt",bcrypt:{rounds:12},argon2:{memory:65536,time:2}},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:!1,files:["counter","dark"]}},logging:{logsPath:"storage/logs/stacks.log",deploymentsPath:"storage/logs/deployments.log"},notification:{default:"email"},payment:{driver:"stripe"},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:B.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:{firewall:{enabled:!0,countryCodes:[],ipAddresses:[],queryString:[],httpHeaders:[],rateLimitPerMinute:1000,useIpReputationLists:!0,useKnownBadInputsRuleSet:!0}},services:{aws:{accountId:"",appId:"",apiKey:"",region:B.awsRegion},algolia:{appId:"",apiKey:""},meilisearch:{appId:"",apiKey:""},stripe:{appId:"",apiKey:""}},filesystems:{driver:"s3"},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"}}}};function m(x){return typeof x==="object"&&x!==null&&!Array.isArray(x)}function _(x,X){return(G,z)=>{if(G==null)return[];let J=null;if(typeof G==="number"&&Number.isInteger(G))J=G;else if(typeof G==="string"&&/^-?\d+$/.test(G))J=Number.parseInt(G,10);if(J===null)return[{path:z,message:`expected integer, got ${typeof G} (${JSON.stringify(G)})`}];if(J<x||J>X)return[{path:z,message:`expected integer in [${x}, ${X}], got ${J}`}];return[]}}function j(x){return(X,G)=>{if(X==null)return[];if(typeof X!=="string"||!x.includes(X))return[{path:G,message:`expected one of [${x.join(", ")}], got ${JSON.stringify(X)}`}];return[]}}function T(){return(x,X)=>{if(x==null)return[];return typeof x==="string"?[]:[{path:X,message:`expected string, got ${typeof x}`}]}}function O(){return(x,X)=>{if(x==null)return[];return typeof x==="boolean"?[]:[{path:X,message:`expected boolean, got ${typeof x}`}]}}var q=_(1,65535),R={app:{rules:{name:T(),env:j(["local","development","staging","production","test"]),debug:O(),url:T()}},ports:{rules:{frontend:q,api:q,admin:q,docs:q,systemTray:q,desktop:q}},database:{rules:{default:j(["sqlite","mysql","singlestore","postgres","dynamodb"])}},cache:{rules:{driver:j(["memory","redis","singlestore"])}},queue:{rules:{default:j(["sync","database","redis"])}},logging:{rules:{level:j(["trace","debug","info","warn","error","fatal"])}},email:{rules:{default:j(["ses","sendgrid","mailgun","mailtrap","smtp","log","capture"])}}};function w(x){let X=[];for(let[G,z]of Object.entries(R)){let J=x[G];if(J==null)continue;if(!m(J)){X.push({path:G,message:`expected object, got ${typeof J}`});continue}for(let[Q,I]of Object.entries(z.rules)){let Z=J[Q];X.push(...I(Z,`${G}.${Q}`))}}return X}var k=process.env.SKIP_CONFIG_LOADING==="true",E=process.env.SKIP_CONFIG_VALIDATION==="true",Y=Symbol.for("@stacksjs/config:overrides"),b=Symbol.for("@stacksjs/config:overridesReady");function h(){return{ai:{},analytics:{},app:{name:process.env.APP_NAME||"Stacks",env:process.env.APP_ENV||"production"},auth:{},cache:{},cli:{},cloud:{},cms:{},commerce:{},dashboard:{},database:{},dns:{},realtime:{},email:{},errors:{},git:{},hashing:{},library:{},logging:{},marketing:{},monitoring:{},notification:{},queue:{},payment:{},ports:{},saas:{},searchEngine:{},security:{},services:{},filesystems:{},team:{},ui:{}}}var W=globalThis,d=W[Y],$=d??(()=>{let x=h();return W[Y]=x,x})(),p=[["ai","~/config/ai"],["analytics","~/config/analytics"],["app","~/config/app"],["auth","~/config/auth"],["cache","~/config/cache"],["cli","~/config/cli"],["cloud","~/config/cloud"],["cms","~/config/cms"],["commerce","~/config/commerce"],["dashboard","~/config/dashboard"],["database","~/config/database"],["dns","~/config/dns"],["email","~/config/email"],["errors","~/config/errors"],["git","~/config/git"],["hashing","~/config/hashing"],["library","~/config/library"],["logging","~/config/logging"],["marketing","~/config/marketing"],["monitoring","~/config/monitoring"],["notification","~/config/notification"],["payment","~/config/payment"],["ports","~/config/ports"],["queue","~/config/queue"],["realtime","~/config/realtime"],["saas","~/config/saas"],["searchEngine","~/config/search-engine"],["security","~/config/security"],["services","~/config/services"],["filesystems","~/config/filesystems"],["team","~/config/team"],["ui","~/config/ui"]],t=W[b],F=t??(()=>{let x=k?Promise.resolve($):Promise.all(p.map(async([X,G])=>{try{let z=await import(G);if(z?.default!==void 0)$[X]=z.default}catch(z){let J=z?.code,Q=z?.message??String(z);if(!(J==="ERR_MODULE_NOT_FOUND"||J==="MODULE_NOT_FOUND"||/Cannot find module/i.test(Q)))console.warn(`[config] Failed to load ${String(X)} config from ${G}: ${Q}`)}})).then(()=>{if(!E){let X=w($);if(X.length>0){console.error("[config] Configuration issues detected:");for(let z of X)console.error(` \u2022 ${z.path}: ${z.message}`);let G=X.map((z)=>` \u2022 ${z.path}: ${z.message}`).join(`
|
|
7
|
-
`);throw Error(`[config] ${X.length} configuration issue(s) detected at boot:
|
|
8
|
-
${G}
|
|
9
|
-
Set SKIP_CONFIG_VALIDATION=true to bypass (e.g. when running migrations against partial config).`)}}return $});return W[b]=x,x})();async function Ax(x={}){let X=x.domain??N.app.url??"stacks",G=x.type??"frontend",z=x.localhost??!1,J=x.https,Q=x.network,I=X.replace(/\.[^.]+$/,".localhost");async function Z(A){let{createLocalTunnel:K}=await import("@stacksjs/tunnel");return K(A)}switch(G){case"frontend":if(Q)return await Z(N.ports?.frontend||3000);if(z)return`http://localhost:${N.ports?.frontend}`;break;case"backend":if(Q)return await Z(N.ports?.backend||3001);if(z)return`http://localhost:${N.ports?.backend}`;I=`api.${I}`;break;case"admin":if(Q)return await Z(N.ports?.admin||3002);if(z)return`http://localhost:${N.ports?.admin}`;I=`admin.${I}`;break;case"library":if(Q)return await Z(N.ports?.library||3003);if(z)return`http://localhost:${N.ports?.library}`;I=`libs.${I}`;break;case"email":if(Q)return await Z(N.ports?.email||3005);if(z)return`http://localhost:${N.ports?.email}`;I=`email.${I}`;break;case"desktop":if(Q)return await Z(N.ports?.desktop||3004);if(z)return`http://localhost:${N.ports?.desktop}`;I=`desktop.${I}`;break;case"docs":if(Q)return await Z(N.ports?.docs||3006);if(z)return`http://localhost:${N.ports?.docs}`;I=`docs.${I}`;break;case"inspect":if(Q)return await Z(N.ports?.inspect||3007);if(z)return`http://localhost:${N.ports?.inspect}`;I=`inspect.${I}`;break;default:if(z)return`http://localhost:${N.ports?.frontend}`}if(J)return`https://${I}`;return`http://${I}`}function Kx(x){return x}function Px(x){return x}function Cx(x){return x}function Sx(x){return x}function Dx(x){return x}function mx(x){return x}function _x(x){return x}function Ox(x){return x}function Rx(x){return x}function kx(x){return x}function Ex(x){return x}function hx(x){return x}function dx(x){return x}function px(x){return x}function tx(x){return x}function vx(x){return x}function rx(x){return x}function ux(x){return x}function sx(x){return x}function ax(x){return x}function lx(x){return x}function fx(x){return x}function gx(x){return x}function ex(x){return x}function cx(x){return x}function nx(x){return x}function y(x){let X=$[x];if(X!==void 0&&(typeof X!=="object"||Object.keys(X).length>0))return X;return U[x]}var v=function(){},N=new Proxy(v,{get(x,X){return y(X)},has(x,X){return X in $||X in U},ownKeys(){return Array.from(new Set([...Object.keys($),...Object.keys(U)]))},getOwnPropertyDescriptor(x,X){if(typeof X!=="string")return;if(!(X in $)&&!(X in U))return;return{enumerable:!0,configurable:!0,writable:!0,value:y(X)}},isExtensible(){return!0},preventExtensions(){return!1}});async function NN(){return await F,N}var L=Symbol.for("@stacksjs/config:databaseReady"),V=globalThis;async function XN(){await F;let x=Date.now()+5000;while(!V[L]&&Date.now()<x)await new Promise((X)=>setTimeout(X,25));if(!V[L])console.warn("[config] awaitDatabaseConfig() timed out \u2014 database driver did not signal readiness within 5s");return N}function zN(){V[L]=!0}function GN(){return N}var{ai:r,analytics:u,app:s,auth:a,realtime:l,cache:f,cloud:g,cli:e,dashboard:c,database:n,dns:i,docs:o,email:xx,errors:Nx,git:Xx,hashing:zx,library:Gx,logging:Ix,notification:Jx,payment:Qx,ports:Zx,queue:$x,security:jx,saas:qx,searchEngine:Bx,services:Ux,filesystems:Wx,team:Fx,ui:Mx}=N;F.then(()=>{r=N.ai,u=N.analytics,s=N.app,a=N.auth,l=N.realtime,f=N.cache,g=N.cloud,e=N.cli,c=N.dashboard,n=N.database,i=N.dns,o=N.docs,xx=N.email,Nx=N.errors,Xx=N.git,zx=N.hashing,Gx=N.library,Ix=N.logging,Jx=N.notification,Qx=N.payment,Zx=N.ports,$x=N.queue,jx=N.security,qx=N.saas,Bx=N.searchEngine,Ux=N.services,Wx=N.filesystems,Fx=N.team,Mx=N.ui}).catch(()=>{});function IN(){let x=N.app?.env;if(x==="local"||x==="development")return"dev";if(x==="staging")return"stage";if(x==="production")return"prod";if(!x)throw Error("Couldn't determine app environment");return x}export{UN as validateConfig,Mx as ui,Fx as team,Ux as services,jx as security,Bx as searchEngine,qx as saas,HN as resetFeature,WN as reportConfigIssues,l as realtime,$x as queue,Zx as ports,Qx as payment,F as overridesReady,$ as overrides,Jx as notification,zN as markDatabaseReady,Ix as logging,Ax as localUrl,TN as listFeatures,Gx as library,zx as hashing,Xx as git,GN as getConfig,Wx as filesystems,MN as feature,Nx as errors,LN as enableFeature,xx as email,o as docs,i as dns,VN as disableFeature,IN as determineAppEnv,ex as defineUi,fx as defineStorage,Kx as defineStacksConfig,lx as defineSms,ax as defineServices,sx as defineSecurity,ux as defineSearchEngine,rx as defineQueue,vx as definePayment,tx as defineNotification,cx as defineModel,px as defineLibrary,dx as defineHashing,hx as defineGit,gx as defineFilesystems,nx as defineEvents,kx as defineEmailConfig,Ex as defineEmail,Rx as defineDns,Ox as defineDependencies,_x as defineDatabase,mx as defineCli,Dx as defineChat,Sx as defineCdn,Cx as defineCache,Px as defineApp,U as defaults,n as database,c as dashboard,N as config,g as cloud,e as cli,f as cache,XN as awaitDatabaseConfig,NN as awaitConfig,a as auth,s as app,u as analytics,r as ai,qN as FRAMEWORK_DEFAULTS};
|
package/dist/overrides.d.ts
DELETED
package/dist/validators.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { StacksConfig } from '@stacksjs/types';
|
|
2
|
-
/**
|
|
3
|
-
* Validate a config snapshot. Returns the list of issues — caller decides
|
|
4
|
-
* whether to throw, log, or just print a summary. Returns an empty array
|
|
5
|
-
* when everything checks out.
|
|
6
|
-
*/
|
|
7
|
-
export declare function validateConfig(config: Partial<StacksConfig>): ConfigValidationIssue[];
|
|
8
|
-
/**
|
|
9
|
-
* Convenience: validate and pretty-print to stderr. Returns true when
|
|
10
|
-
* the config is clean. Used by the boot path so users see issues
|
|
11
|
-
* immediately on startup rather than digging into a stack trace later.
|
|
12
|
-
*/
|
|
13
|
-
export declare function reportConfigIssues(config: Partial<StacksConfig>): boolean;
|
|
14
|
-
export declare interface ConfigValidationIssue {
|
|
15
|
-
path: string
|
|
16
|
-
message: string
|
|
17
|
-
}
|
|
18
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
19
|
-
declare type Check = (value: unknown, path: string) => ConfigValidationIssue[];
|