@stacksjs/types 0.70.23 → 0.70.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/src/ai.d.ts +37 -0
  3. package/dist/src/analytics.d.ts +36 -0
  4. package/dist/src/api.d.ts +26 -0
  5. package/dist/src/app.d.ts +28 -0
  6. package/dist/src/attributes.d.ts +1 -0
  7. package/dist/src/auth.d.ts +49 -0
  8. package/dist/src/auto-imports.d.ts +8 -0
  9. package/dist/{binary.d.ts → src/binary.d.ts} +4 -1
  10. package/dist/src/cache.d.ts +79 -0
  11. package/dist/{cdn.d.ts → src/cdn.d.ts} +1 -1
  12. package/dist/{chat.d.ts → src/chat.d.ts} +29 -48
  13. package/dist/src/cli.d.ts +308 -0
  14. package/dist/{cloud.d.ts → src/cloud.d.ts} +81 -26
  15. package/dist/{components.d.ts → src/components.d.ts} +1 -4
  16. package/dist/{configure.d.ts → src/configure.d.ts} +1 -1
  17. package/dist/{cron-jobs.d.ts → src/cron-jobs.d.ts} +33 -37
  18. package/dist/src/dashboard.d.ts +33 -0
  19. package/dist/{database.d.ts → src/database.d.ts} +20 -12
  20. package/dist/src/dependencies.d.ts +17 -0
  21. package/dist/src/deploy.d.ts +16 -0
  22. package/dist/{dns.d.ts → src/dns.d.ts} +59 -59
  23. package/dist/src/docs.d.ts +23 -0
  24. package/dist/src/email.d.ts +201 -0
  25. package/dist/src/env.d.ts +1 -0
  26. package/dist/{errors.d.ts → src/errors.d.ts} +17 -24
  27. package/dist/src/events.d.ts +31 -0
  28. package/dist/src/exit-code.d.ts +10 -0
  29. package/dist/{file-systems.d.ts → src/file-systems.d.ts} +10 -6
  30. package/dist/{git.d.ts → src/git.d.ts} +9 -6
  31. package/dist/src/hashing.d.ts +57 -0
  32. package/dist/src/helpers.d.ts +1 -0
  33. package/dist/src/i18n.d.ts +65 -0
  34. package/dist/src/index.d.ts +70 -0
  35. package/dist/{library.d.ts → src/library.d.ts} +31 -33
  36. package/dist/src/logging.d.ts +12 -0
  37. package/dist/{manifest.d.ts → src/manifest.d.ts} +4 -1
  38. package/dist/src/model-names.d.ts +1 -0
  39. package/dist/src/model.d.ts +251 -0
  40. package/dist/{notifications.d.ts → src/notifications.d.ts} +1 -26
  41. package/dist/src/oauth.d.ts +290 -0
  42. package/dist/{pages.d.ts → src/pages.d.ts} +1 -1
  43. package/dist/src/payments.d.ts +322 -0
  44. package/dist/src/phone.d.ts +52 -0
  45. package/dist/src/ports.d.ts +20 -0
  46. package/dist/src/promise.d.ts +1 -0
  47. package/dist/src/push.d.ts +108 -0
  48. package/dist/src/queue.d.ts +310 -0
  49. package/dist/src/reactivity.d.ts +1 -0
  50. package/dist/src/realtime.d.ts +443 -0
  51. package/dist/src/request.d.ts +154 -0
  52. package/dist/{response.d.ts → src/response.d.ts} +1 -1
  53. package/dist/src/router.d.ts +105 -0
  54. package/dist/{saas.d.ts → src/saas.d.ts} +2 -2
  55. package/dist/src/scheduler.d.ts +1 -0
  56. package/dist/{search-engine.d.ts → src/search-engine.d.ts} +41 -45
  57. package/dist/{security.d.ts → src/security.d.ts} +4 -8
  58. package/dist/{server.d.ts → src/server.d.ts} +1 -1
  59. package/dist/src/services.d.ts +140 -0
  60. package/dist/{settings-config.d.ts → src/settings-config.d.ts} +1 -1
  61. package/dist/src/sms.d.ts +144 -0
  62. package/dist/src/stack-extensions.d.ts +137 -0
  63. package/dist/src/stacks.d.ts +40 -0
  64. package/dist/src/storage.d.ts +105 -0
  65. package/dist/src/table-names.d.ts +1 -0
  66. package/dist/src/tables.d.ts +34 -0
  67. package/dist/src/team.d.ts +7 -0
  68. package/dist/src/ui.d.ts +55 -0
  69. package/dist/src/utils.d.ts +39 -0
  70. package/package.json +13 -32
  71. package/src/ai.ts +20 -6
  72. package/src/analytics.ts +38 -1
  73. package/src/app.ts +38 -0
  74. package/src/attributes.ts +5 -1
  75. package/src/auth.ts +122 -0
  76. package/src/auto-imports.ts +8 -1
  77. package/src/cache.ts +226 -69
  78. package/src/chat.ts +0 -20
  79. package/src/cli.ts +24 -9
  80. package/src/cloud.ts +40 -1
  81. package/src/components.ts +3 -5
  82. package/src/cron-jobs.ts +1 -1
  83. package/src/dashboard.ts +40 -0
  84. package/src/database.ts +18 -2
  85. package/src/dns.ts +1 -1
  86. package/src/docs.ts +3 -3
  87. package/src/email.ts +303 -13
  88. package/src/errors.ts +2 -3
  89. package/src/events.ts +10 -5
  90. package/src/git.ts +3 -3
  91. package/src/hashing.ts +15 -19
  92. package/src/i18n.ts +105 -3
  93. package/src/index.ts +9 -5
  94. package/src/library.ts +0 -5
  95. package/src/model-names.ts +1 -1
  96. package/src/model.ts +87 -10
  97. package/src/oauth.ts +488 -0
  98. package/src/payments.ts +370 -27
  99. package/src/phone.ts +62 -0
  100. package/src/push.ts +107 -0
  101. package/src/queue.ts +386 -28
  102. package/src/reactivity.ts +1 -1
  103. package/src/realtime.ts +584 -0
  104. package/src/request.ts +344 -22
  105. package/src/router.ts +62 -4
  106. package/src/search-engine.ts +13 -13
  107. package/src/services.ts +100 -5
  108. package/src/sms.ts +263 -3
  109. package/src/stack-extensions.ts +184 -0
  110. package/src/stacks.ts +34 -4
  111. package/src/storage.ts +140 -6
  112. package/src/table-names.ts +1 -1
  113. package/src/ui.ts +20 -12
  114. package/src/utils.ts +1 -1
  115. package/dist/ai.d.ts +0 -20
  116. package/dist/analytics.d.ts +0 -13
  117. package/dist/api.d.ts +0 -26
  118. package/dist/app.d.ts +0 -32
  119. package/dist/attributes.d.ts +0 -1
  120. package/dist/auto-imports.d.ts +0 -1
  121. package/dist/build.d.ts +0 -2
  122. package/dist/cache.d.ts +0 -49
  123. package/dist/cli.d.ts +0 -310
  124. package/dist/dependencies.d.ts +0 -16
  125. package/dist/deploy.d.ts +0 -10
  126. package/dist/docs.d.ts +0 -26
  127. package/dist/email.d.ts +0 -107
  128. package/dist/events.d.ts +0 -5
  129. package/dist/exit-code.d.ts +0 -5
  130. package/dist/hashing.d.ts +0 -36
  131. package/dist/helpers.d.ts +0 -1
  132. package/dist/i18n.d.ts +0 -11
  133. package/dist/index.d.ts +0 -65
  134. package/dist/inspect.d.ts +0 -3
  135. package/dist/logging.d.ts +0 -6
  136. package/dist/model-names.d.ts +0 -1
  137. package/dist/model.d.ts +0 -232
  138. package/dist/payments.d.ts +0 -94
  139. package/dist/ports.d.ts +0 -13
  140. package/dist/promise.d.ts +0 -1
  141. package/dist/push.d.ts +0 -35
  142. package/dist/pwa.d.ts +0 -3
  143. package/dist/queue.d.ts +0 -45
  144. package/dist/reactivity.d.ts +0 -1
  145. package/dist/request.d.ts +0 -49
  146. package/dist/router.d.ts +0 -65
  147. package/dist/scheduler.d.ts +0 -1
  148. package/dist/services.d.ts +0 -81
  149. package/dist/ssg.d.ts +0 -3
  150. package/dist/stacks.d.ts +0 -54
  151. package/dist/storage.d.ts +0 -31
  152. package/dist/table-names.d.ts +0 -1
  153. package/dist/tables.d.ts +0 -34
  154. package/dist/team.d.ts +0 -8
  155. package/dist/ui.d.ts +0 -47
  156. package/dist/utils.d.ts +0 -27
  157. package/src/build.ts +0 -2
  158. package/src/inspect.ts +0 -10
  159. package/src/layout.ts +0 -8
  160. package/src/pwa.ts +0 -8
  161. package/src/ssg.ts +0 -3
package/src/sms.ts CHANGED
@@ -1,5 +1,265 @@
1
- // import type { ISmsOptions as SmsOptions } from '@novu/stateless'
1
+ /**
2
+ * SMS Service Configuration Types
3
+ * Supports Twilio, Vonage, and AWS providers
4
+ */
2
5
 
3
- // export type { SmsOptions }
6
+ // =============================================================================
7
+ // Core SMS Types
8
+ // =============================================================================
4
9
 
5
- // export type SmsConfig = SmsOptions
10
+ export type SmsProvider = 'twilio' | 'vonage' | 'pinpoint' | 'sns'
11
+
12
+ export interface SmsMessage {
13
+ /**
14
+ * Recipient phone number (E.164 format recommended)
15
+ */
16
+ to: string | string[]
17
+
18
+ /**
19
+ * Message body
20
+ */
21
+ body: string
22
+
23
+ /**
24
+ * Sender ID or phone number
25
+ */
26
+ from?: string
27
+
28
+ /**
29
+ * Optional media URLs (MMS)
30
+ */
31
+ mediaUrls?: string[]
32
+
33
+ /**
34
+ * Callback URL for status updates
35
+ */
36
+ statusCallback?: string
37
+
38
+ /**
39
+ * Additional provider-specific options
40
+ */
41
+ options?: Record<string, unknown>
42
+ }
43
+
44
+ export interface SmsSendResult {
45
+ success: boolean
46
+ messageId?: string
47
+ status?: SmsStatus
48
+ to: string
49
+ error?: string
50
+ provider: SmsProvider
51
+ segments?: number
52
+ price?: number
53
+ currency?: string
54
+ }
55
+
56
+ export type SmsStatus =
57
+ | 'queued'
58
+ | 'sending'
59
+ | 'sent'
60
+ | 'delivered'
61
+ | 'failed'
62
+ | 'undelivered'
63
+ | 'unknown'
64
+
65
+ export interface SmsStatusUpdate {
66
+ messageId: string
67
+ to: string
68
+ status: SmsStatus
69
+ timestamp: Date
70
+ errorCode?: string
71
+ errorMessage?: string
72
+ }
73
+
74
+ // =============================================================================
75
+ // Provider Configurations
76
+ // =============================================================================
77
+
78
+ export interface TwilioConfig {
79
+ accountSid: string
80
+ authToken: string
81
+ from?: string
82
+ messagingServiceSid?: string
83
+ statusCallback?: string
84
+ }
85
+
86
+ export interface VonageConfig {
87
+ apiKey: string
88
+ apiSecret: string
89
+ from?: string
90
+ applicationId?: string
91
+ privateKey?: string
92
+ }
93
+
94
+ export interface AwsSmsConfig {
95
+ region: string
96
+ accessKeyId?: string
97
+ secretAccessKey?: string
98
+ senderId?: string
99
+ originationNumber?: string
100
+ }
101
+
102
+ // =============================================================================
103
+ // SMS Options (Main Config)
104
+ // =============================================================================
105
+
106
+ export interface SmsTemplateConfig {
107
+ name: string
108
+ body: string
109
+ variables?: string[]
110
+ }
111
+
112
+ export interface SmsOptOutConfig {
113
+ enabled: boolean
114
+ keywords: string[]
115
+ }
116
+
117
+ export interface SmsTwoWayConfig {
118
+ enabled: boolean
119
+ webhookUrl?: string
120
+ snsTopicArn?: string
121
+ }
122
+
123
+ export interface SmsInboxConfig {
124
+ enabled: boolean
125
+ bucket: string
126
+ prefix?: string
127
+ retentionDays?: number
128
+ }
129
+
130
+ export interface SmsOptions {
131
+ /**
132
+ * Enable SMS functionality
133
+ */
134
+ enabled: boolean
135
+
136
+ /**
137
+ * Default SMS provider
138
+ */
139
+ provider: SmsProvider
140
+
141
+ /**
142
+ * Default sender ID or phone number
143
+ */
144
+ from?: string
145
+
146
+ /**
147
+ * Default country code for phone number formatting
148
+ */
149
+ defaultCountryCode?: string
150
+
151
+ /**
152
+ * Message type (affects pricing and delivery)
153
+ */
154
+ messageType?: 'TRANSACTIONAL' | 'PROMOTIONAL'
155
+
156
+ /**
157
+ * Provider-specific configurations
158
+ */
159
+ drivers: {
160
+ twilio?: TwilioConfig
161
+ vonage?: VonageConfig
162
+ pinpoint?: AwsSmsConfig
163
+ sns?: AwsSmsConfig
164
+ }
165
+
166
+ /**
167
+ * Opt-out handling configuration
168
+ */
169
+ optOut?: SmsOptOutConfig
170
+
171
+ /**
172
+ * Two-way messaging configuration
173
+ */
174
+ twoWay?: SmsTwoWayConfig
175
+
176
+ /**
177
+ * Message templates
178
+ */
179
+ templates?: SmsTemplateConfig[]
180
+
181
+ /**
182
+ * Inbox configuration for storing received messages
183
+ */
184
+ inbox?: SmsInboxConfig
185
+
186
+ /**
187
+ * Max monthly spend limit
188
+ */
189
+ maxSpendPerMonth?: number
190
+ }
191
+
192
+ export type SmsConfig = Partial<SmsOptions>
193
+
194
+ // =============================================================================
195
+ // SMS Driver Interface
196
+ // =============================================================================
197
+
198
+ export interface SmsDriver {
199
+ /**
200
+ * Send an SMS message
201
+ */
202
+ send(message: SmsMessage): Promise<SmsSendResult>
203
+
204
+ /**
205
+ * Send multiple SMS messages
206
+ */
207
+ sendBulk(messages: SmsMessage[]): Promise<SmsSendResult[]>
208
+
209
+ /**
210
+ * Get message status
211
+ */
212
+ getStatus?(messageId: string): Promise<SmsStatusUpdate>
213
+
214
+ /**
215
+ * Verify a phone number
216
+ */
217
+ verify?(phoneNumber: string): Promise<{ valid: boolean, carrier?: string, type?: string }>
218
+
219
+ /**
220
+ * Get account balance/usage
221
+ */
222
+ getBalance?(): Promise<{ balance: number, currency: string }>
223
+ }
224
+
225
+ // =============================================================================
226
+ // Verification Types (for 2FA/OTP)
227
+ // =============================================================================
228
+
229
+ export interface VerificationRequest {
230
+ to: string
231
+ channel?: 'sms' | 'call' | 'whatsapp'
232
+ codeLength?: number
233
+ locale?: string
234
+ customMessage?: string
235
+ }
236
+
237
+ export interface VerificationResult {
238
+ success: boolean
239
+ verificationId?: string
240
+ status: 'pending' | 'approved' | 'denied' | 'expired'
241
+ error?: string
242
+ }
243
+
244
+ export interface VerificationCheckRequest {
245
+ verificationId?: string
246
+ to: string
247
+ code: string
248
+ }
249
+
250
+ export interface SmsVerificationDriver {
251
+ /**
252
+ * Start a verification (send OTP)
253
+ */
254
+ startVerification(request: VerificationRequest): Promise<VerificationResult>
255
+
256
+ /**
257
+ * Check a verification code
258
+ */
259
+ checkVerification(request: VerificationCheckRequest): Promise<VerificationResult>
260
+
261
+ /**
262
+ * Cancel a pending verification
263
+ */
264
+ cancelVerification?(verificationId: string): Promise<boolean>
265
+ }
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Known top-level directories in a Stacks project that a stack extension can provide.
3
+ * Uses `(string & {})` to allow custom directories while still providing autocomplete.
4
+ */
5
+ export type StackDirectory =
6
+ | 'app'
7
+ | 'config'
8
+ | 'database'
9
+ | 'resources'
10
+ | 'routes'
11
+ | 'public'
12
+ | 'locales'
13
+ | 'docs'
14
+ | (string & {})
15
+
16
+ // ─── Stack Extensions Registry ──────────────────────────────────────────────
17
+ //
18
+ // This is the central registry of known stack extensions. Third-party authors
19
+ // can submit a PR to add their stack here. Once merged, all Stacks users get
20
+ // autocomplete and type safety for the new stack name.
21
+ //
22
+ // To add your stack, add a new entry below following the pattern:
23
+ // 'your-stack-name': { package: '@your-org/your-stack', description: '...' },
24
+ //
25
+ // Requirements for PRs:
26
+ // - The package must be published to npm
27
+ // - The package.json must contain a valid `stacks` field with a `name`
28
+ // - The description should be concise (under 80 chars)
29
+ // ─────────────────────────────────────────────────────────────────────────────
30
+
31
+ interface StackRegistryEntry {
32
+ /** The npm package name */
33
+ package: string
34
+ /** A short description of what this stack provides */
35
+ description: string
36
+ /** GitHub repository (e.g. 'stacksjs/blog-stack') */
37
+ github?: string
38
+ }
39
+
40
+ /**
41
+ * The central registry of known stack extensions.
42
+ *
43
+ * Third-party stack authors: submit a PR to add your stack here.
44
+ * Once merged, all Stacks users will get autocomplete for your stack name.
45
+ */
46
+ export const stackExtensionRegistry = {
47
+ // ── Community Stacks ────────────────────────────────────────────────────
48
+ // Add your stack here via PR! Follow the pattern:
49
+ // 'your-stack': { package: '@your-org/your-stack', description: 'What it does' },
50
+ //
51
+ // Once merged, all Stacks users get autocomplete for your stack name.
52
+ } as const satisfies Record<string, StackRegistryEntry>
53
+
54
+ /**
55
+ * All known stack extension names, derived from the registry.
56
+ * Uses `(string & {})` to also accept any custom/unregistered stack name.
57
+ */
58
+ export type KnownStackName = keyof typeof stackExtensionRegistry | (string & {})
59
+
60
+ /**
61
+ * Metadata for a stack extension, defined in the `stacks` field of a stack's package.json.
62
+ *
63
+ * @example
64
+ * ```json
65
+ * {
66
+ * "name": "@stacksjs/blog",
67
+ * "stacks": {
68
+ * "name": "blog",
69
+ * "description": "Blog functionality for Stacks",
70
+ * "directories": ["app", "config", "database", "resources"]
71
+ * }
72
+ * }
73
+ * ```
74
+ */
75
+ export interface StackMeta {
76
+ /** Short identifier for the stack (e.g. 'blog', 'commerce') */
77
+ name: KnownStackName
78
+ /** Human-readable description of what this stack provides */
79
+ description?: string
80
+ /** Semver version of the stack */
81
+ version?: string
82
+ /** Which top-level directories this stack provides. Defaults to all known directories if omitted. */
83
+ directories?: StackDirectory[]
84
+ /** Lifecycle hooks that run during install/uninstall */
85
+ hooks?: {
86
+ preInstall?: string
87
+ postInstall?: string
88
+ preUninstall?: string
89
+ postUninstall?: string
90
+ }
91
+ }
92
+
93
+ export type ConflictStrategy = 'skip' | 'overwrite' | 'backup'
94
+
95
+ /** Tracks a single installed stack in the lock file */
96
+ export interface StackManifestEntry {
97
+ /** The npm package name (e.g. '@stacksjs/blog') */
98
+ packageName: string
99
+ /** The stack's short name */
100
+ name: string
101
+ /** Installed version */
102
+ version: string
103
+ /** ISO timestamp of when this stack was installed */
104
+ installedAt: string
105
+ /** All files that were copied into the project, relative to project root */
106
+ files: string[]
107
+ /** Files that were skipped due to conflicts */
108
+ skipped: string[]
109
+ /** The conflict strategy used during this install */
110
+ conflictStrategy: ConflictStrategy
111
+ }
112
+
113
+ /** The stacks.lock.json file format */
114
+ export interface StackLock {
115
+ version: 1
116
+ generatedAt: string
117
+ stacks: Record<string, StackManifestEntry>
118
+ }
119
+
120
+ export interface StackInstallOptions {
121
+ /** The stack name or package name to install */
122
+ name: KnownStackName
123
+ /** How to handle file conflicts. Defaults to 'skip'. */
124
+ conflict?: ConflictStrategy
125
+ /** Force overwrite all files (shorthand for conflict: 'overwrite') */
126
+ force?: boolean
127
+ /** Show what would happen without making changes */
128
+ dryRun?: boolean
129
+ /** Enable verbose output */
130
+ verbose?: boolean
131
+ }
132
+
133
+ export interface StackUninstallOptions {
134
+ /** The stack name or package name to uninstall */
135
+ name: KnownStackName
136
+ /** Force removal even if files were modified after install */
137
+ force?: boolean
138
+ /** Enable verbose output */
139
+ verbose?: boolean
140
+ }
141
+
142
+ /** Display format for the `stack:list` command */
143
+ export interface StackListEntry {
144
+ name: string
145
+ packageName: string
146
+ version: string
147
+ description?: string
148
+ installed: boolean
149
+ installedAt?: string
150
+ fileCount?: number
151
+ }
152
+
153
+ /**
154
+ * A stack extension entry in the registry (`config/stacks.ts`).
155
+ *
156
+ * Can be either:
157
+ * - A string (the stack name or package name)
158
+ * - A full object with name, URL, and GitHub repository
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * export default [
163
+ * 'blog', // shorthand — autocomplete from registry
164
+ * '@stacksjs/commerce', // scoped package shorthand
165
+ * { name: 'analytics', github: 'stacksjs/analytics-stack' },
166
+ * ] satisfies StackExtensionRegistry
167
+ * ```
168
+ */
169
+ export interface StackExtensionEntry {
170
+ /** The stack name or package name */
171
+ name: KnownStackName
172
+ /** The stack's website URL */
173
+ url?: string
174
+ /** GitHub repository (e.g. 'stacksjs/blog-stack') */
175
+ github?: string
176
+ /** npm package name if different from the name */
177
+ package?: string
178
+ }
179
+
180
+ /**
181
+ * The registry type for `config/stacks.ts`.
182
+ * Accepts both string shorthands and full objects.
183
+ */
184
+ export type StackExtensionRegistry = (KnownStackName | StackExtensionEntry)[]
package/src/stacks.ts CHANGED
@@ -2,14 +2,17 @@ import type {
2
2
  AiConfig,
3
3
  AnalyticsConfig,
4
4
  AppConfig,
5
+ AuthConfig,
5
6
  BinaryConfig,
6
7
  CacheConfig,
7
8
  CloudConfig,
9
+ DashboardConfig,
8
10
  DatabaseConfig,
9
11
  DnsConfig,
10
12
  DocsConfig,
11
13
  EmailConfig,
12
14
  ErrorConfig,
15
+ FilesystemsConfig,
13
16
  GitConfig,
14
17
  HashingConfig,
15
18
  LibraryConfig,
@@ -18,11 +21,11 @@ import type {
18
21
  PaymentConfig,
19
22
  Ports,
20
23
  QueueConfig,
24
+ RealtimeConfig,
21
25
  SaasConfig,
22
26
  SearchEngineConfig,
23
27
  SecurityConfig,
24
28
  ServicesConfig,
25
- StorageConfig,
26
29
  Team,
27
30
  UiConfig,
28
31
  } from '.'
@@ -55,6 +58,24 @@ export interface StacksOptions {
55
58
  */
56
59
  app: AppConfig
57
60
 
61
+ /**
62
+ * **Auth Options**
63
+ *
64
+ * This configuration defines all of your Auth options. Because Stacks is fully-typed, you
65
+ * may hover any of the options below and the definitions will be provided. In case
66
+ * you have any questions, feel free to reach out via Discord or GitHub Discussions.
67
+ */
68
+ auth: AuthConfig
69
+
70
+ /**
71
+ * **Realtime Options**
72
+ *
73
+ * This configuration defines all of your Realtime options. Because Stacks is fully-typed,
74
+ * you may hover any of the options below and the definitions will be provided. In case
75
+ * you have any questions, feel free to reach out via Discord or GitHub Discussions.
76
+ */
77
+ realtime: RealtimeConfig
78
+
58
79
  /**
59
80
  * **Cache Options**
60
81
  *
@@ -82,6 +103,15 @@ export interface StacksOptions {
82
103
  */
83
104
  cloud: CloudConfig
84
105
 
106
+ /**
107
+ * **Dashboard Options**
108
+ *
109
+ * Controls which sections render in the `buddy dev --dashboard` sidebar.
110
+ * Set per-section `enabled` flags to `false` to hide a section that this
111
+ * project doesn't use (e.g. `commerce.enabled: false`).
112
+ */
113
+ dashboard: DashboardConfig
114
+
85
115
  /**
86
116
  * **Database Options**
87
117
  *
@@ -236,13 +266,13 @@ export interface StacksOptions {
236
266
  services: ServicesConfig
237
267
 
238
268
  /**
239
- * **Storage Options**
269
+ * **Filesystems Options**
240
270
  *
241
- * This configuration defines all of your Storage options. Because Stacks is fully-typed,
271
+ * This configuration defines all of your Filesystem options. Because Stacks is fully-typed,
242
272
  * you may hover any of the options below and the definitions will be provided. In case
243
273
  * you have any questions, feel free to reach out via Discord or GitHub Discussions.
244
274
  */
245
- storage: StorageConfig
275
+ filesystems: FilesystemsConfig
246
276
 
247
277
  /**
248
278
  * **Team Members**
package/src/storage.ts CHANGED
@@ -1,5 +1,71 @@
1
- import type { ChecksumOptions, DirectoryListing, FileContents, MimeTypeOptions, PublicUrlOptions, StatEntry, TemporaryUrlOptions } from '@flystorage/file-storage'
2
1
  import type { Buffer } from 'node:buffer'
2
+ import type { ReadableStream } from 'node:stream/web'
3
+
4
+ /**
5
+ * File contents can be a string, Buffer, Uint8Array, or ReadableStream
6
+ */
7
+ export type FileContents = string | Buffer | Uint8Array | ReadableStream
8
+
9
+ /**
10
+ * Visibility options for files
11
+ */
12
+ export type Visibility = 'public' | 'private'
13
+
14
+ /**
15
+ * File stat entry information
16
+ */
17
+ export interface StatEntry {
18
+ path: string
19
+ type: 'file' | 'directory'
20
+ visibility: Visibility
21
+ size: number
22
+ lastModified: number
23
+ mimeType?: string
24
+ metadata?: Record<string, any>
25
+ }
26
+
27
+ /**
28
+ * Directory listing entry
29
+ */
30
+ export interface DirectoryEntry {
31
+ path: string
32
+ type: 'file' | 'directory'
33
+ }
34
+
35
+ /**
36
+ * Directory listing iterator
37
+ */
38
+ export interface DirectoryListing extends AsyncIterable<DirectoryEntry> {
39
+ [Symbol.asyncIterator](): AsyncIterator<DirectoryEntry>
40
+ }
41
+
42
+ /**
43
+ * Options for generating public URLs
44
+ */
45
+ export interface PublicUrlOptions {
46
+ domain?: string
47
+ }
48
+
49
+ /**
50
+ * Options for generating temporary URLs
51
+ */
52
+ export interface TemporaryUrlOptions {
53
+ expiresIn: number | Date
54
+ }
55
+
56
+ /**
57
+ * Checksum algorithm options
58
+ */
59
+ export interface ChecksumOptions {
60
+ algorithm?: 'md5' | 'sha1' | 'sha256'
61
+ }
62
+
63
+ /**
64
+ * MIME type detection options
65
+ */
66
+ export interface MimeTypeOptions {
67
+ useExtension?: boolean
68
+ }
3
69
 
4
70
  export interface StorageOptions {
5
71
  /**
@@ -7,18 +73,86 @@ export interface StorageOptions {
7
73
  *
8
74
  * The storage driver to utilize.
9
75
  *
10
- * @default string 's3'
11
- * @see https://stacksjs.org/docs/storage
76
+ * @default 'local'
77
+ * @see https://stacksjs.com/docs/storage
78
+ */
79
+ driver: 's3' | 'efs' | 'local' | 'bun' | 'memory'
80
+
81
+ /**
82
+ * **Root Directory**
83
+ *
84
+ * Root directory for local and bun drivers.
85
+ *
86
+ * @default process.cwd()
87
+ */
88
+ root?: string
89
+
90
+ /**
91
+ * **S3 Configuration**
92
+ */
93
+ s3?: {
94
+ /**
95
+ * S3 bucket name
96
+ */
97
+ bucket: string
98
+
99
+ /**
100
+ * S3 region
101
+ *
102
+ * @default 'us-east-1'
103
+ */
104
+ region?: string
105
+
106
+ /**
107
+ * Key prefix for all S3 objects
108
+ */
109
+ prefix?: string
110
+
111
+ /**
112
+ * AWS credentials
113
+ */
114
+ credentials?: {
115
+ accessKeyId: string
116
+ secretAccessKey: string
117
+ }
118
+
119
+ /**
120
+ * Custom endpoint (for S3-compatible services)
121
+ */
122
+ endpoint?: string
123
+ }
124
+
125
+ /**
126
+ * **Public URL Configuration**
127
+ */
128
+ publicUrl?: {
129
+ /**
130
+ * Domain for public URLs
131
+ *
132
+ * @default 'http://localhost'
133
+ */
134
+ domain?: string
135
+ }
136
+
137
+ /**
138
+ * **Default Visibility**
139
+ *
140
+ * @default 'private'
12
141
  */
13
- driver: 's3' | 'efs' | 'local'
142
+ defaultVisibility?: Visibility
14
143
  }
15
144
 
16
145
  export type StorageConfig = Partial<StorageOptions>
17
146
 
147
+ /**
148
+ * Filesystem configuration (Laravel-style alias)
149
+ */
150
+ export type FilesystemsConfig = StorageConfig
151
+
18
152
  export interface StorageDriver {
19
153
  list: (path: string, options?: any) => DirectoryListing
20
- changeVisibility: (path: string, visibility: string) => Promise<void>
21
- visibility: (path: string) => Promise<string>
154
+ changeVisibility: (path: string, visibility: Visibility) => Promise<void>
155
+ visibility: (path: string) => Promise<Visibility>
22
156
  fileExists: (path: string) => Promise<boolean>
23
157
  directoryExists: (path: string) => Promise<boolean>
24
158
  publicUrl: (path: string, options: PublicUrlOptions) => Promise<string>
@@ -1 +1 @@
1
- export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'print_devices' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'receipts' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'transactions' | 'loyalty_points' | 'product_items' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'delivery_routes' | 'failed_jobs' | 'payment_methods' | 'payment_transactions' | 'requests' | 'jobs' | 'subscriptions' | 'payment_products' | 'errors'
1
+ export type TableNames = 'tags' | 'taggables' | 'categorizables' | 'comments' | 'commentables' | 'commentable_upvotes' | 'passkeys' | 'password_resets' | 'query_logs' | 'migrations' | 'tags' | 'payment_products' | 'failed_jobs' | 'social_posts' | 'payment_methods' | 'campaigns' | 'payment_transactions' | 'requests' | 'activities' | 'email_lists' | 'notifications' | 'jobs' | 'logs' | 'subscriptions' | 'errors' | 'comments' | 'users' | 'websockets' | 'pages' | 'authors' | 'posts' | 'print_devices' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'receipts' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'transactions' | 'loyalty_points' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'carts' | 'delivery_routes' | 'cart_items' | 'subscribers' | 'subscriber_emails'