@stacksjs/config 0.75.573 → 0.75.579

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/defaults.js CHANGED
@@ -2,4 +2,4 @@ import{commandsPath,projectPath,userDatabasePath}from"@stacksjs/path";import{pla
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: ✨ 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:""},bughq:{url:plainEnv("BUGHQ_HOST")||"https://bughq.org",key:plainEnv("BUGHQ_KEY")||undefined,readKey:plainEnv("BUGHQ_READ_KEY")||undefined,project:plainEnv("BUGHQ_PROJECT_ID")||undefined},loghq:{url:plainEnv("LOGHQ_BASE_URL")||"https://loghq.org",key:plainEnv("LOGHQ_KEY")||undefined,readKey:plainEnv("LOGHQ_READ_KEY")||undefined,project:plainEnv("LOGHQ_PROJECT_ID")||undefined},analyticshq:{url:plainEnv("ANALYTICSHQ_URL")||"https://analyticshq.org",readKey:plainEnv("ANALYTICSHQ_READ_KEY")||undefined,project:plainEnv("ANALYTICSHQ_SITE_ID")||undefined},statushq:{url:plainEnv("STATUSHQ_URL")||"https://statushq.org",key:plainEnv("STATUSHQ_KEY")||undefined,readKey:plainEnv("STATUSHQ_READ_KEY")||undefined},commshq:{url:plainEnv("COMMSHQ_URL")||"https://commshq.org",key:plainEnv("COMMSHQ_KEY")||undefined,readKey:plainEnv("COMMSHQ_READ_KEY")||undefined},reportshq:{url:plainEnv("REPORTSHQ_URL")||"https://reportshq.org",license:plainEnv("REPORTSHQ_LICENSE")||undefined}},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;
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:""},bughq:{url:plainEnv("BUGHQ_HOST")||"https://bughq.org",key:plainEnv("BUGHQ_KEY")||undefined,readKey:plainEnv("BUGHQ_READ_KEY")||undefined,project:plainEnv("BUGHQ_PROJECT_ID")||undefined},loghq:{url:plainEnv("LOGHQ_BASE_URL")||"https://loghq.org",key:plainEnv("LOGHQ_KEY")||undefined,readKey:plainEnv("LOGHQ_READ_KEY")||undefined,project:plainEnv("LOGHQ_PROJECT_ID")||undefined},analyticshq:{url:plainEnv("ANALYTICSHQ_URL")||"https://analyticshq.org",readKey:plainEnv("ANALYTICSHQ_READ_KEY")||undefined,project:plainEnv("ANALYTICSHQ_SITE_ID")||undefined},statushq:{url:plainEnv("STATUSHQ_URL")||"https://statushq.org",key:plainEnv("STATUSHQ_KEY")||undefined,readKey:plainEnv("STATUSHQ_READ_KEY")||undefined},supporthq:{url:plainEnv("SUPPORTHQ_URL")||"https://hq.support",key:plainEnv("SUPPORTHQ_KEY")||undefined,readKey:plainEnv("SUPPORTHQ_READ_KEY")||undefined,project:plainEnv("SUPPORTHQ_PROJECT_ID")||undefined,enabled:plainEnv("SUPPORTHQ_ENABLED")==="true",expose:[],messenger:{enabled:plainEnv("SUPPORTHQ_MESSENGER")==="true",loaderUrl:"https://hq.support/support.js",locale:"en"}},commshq:{url:plainEnv("COMMSHQ_URL")||"https://commshq.org",key:plainEnv("COMMSHQ_KEY")||undefined,readKey:plainEnv("COMMSHQ_READ_KEY")||undefined},reportshq:{url:plainEnv("REPORTSHQ_URL")||"https://reportshq.org",license:plainEnv("REPORTSHQ_LICENSE")||undefined}},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;
@@ -121,6 +121,7 @@ export declare interface RequestContextSnapshot {
121
121
  params?: Record<string, string>
122
122
  ip?: string
123
123
  host?: string
124
+ siteHost?: string
124
125
  site?: SiteSnapshot | null
125
126
  }
126
127
  /**
@@ -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();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()}}
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.siteHost?{...own,host:own.siteHost}:own;const merged={...own,...published,site:own.site??published.site??null};return own.siteHost?{...merged,host:own.siteHost}:merged}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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/config",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.573",
5
+ "version": "0.75.579",
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.573",
59
- "@stacksjs/features": "0.75.573",
60
- "@stacksjs/path": "0.75.573",
61
- "@stacksjs/tunnel": "0.75.573",
58
+ "@stacksjs/events": "0.75.579",
59
+ "@stacksjs/features": "0.75.579",
60
+ "@stacksjs/path": "0.75.579",
61
+ "@stacksjs/tunnel": "0.75.579",
62
62
  "ts-pantry": "^0.11.198"
63
63
  },
64
64
  "devDependencies": {
65
- "@stacksjs/alias": "0.75.573",
66
- "@stacksjs/env": "0.75.573",
67
- "@stacksjs/types": "0.75.573",
65
+ "@stacksjs/alias": "0.75.579",
66
+ "@stacksjs/env": "0.75.579",
67
+ "@stacksjs/types": "0.75.579",
68
68
  "better-dx": "^0.2.39"
69
69
  }
70
70
  }