@stacksjs/types 0.70.86 → 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.
Files changed (151) hide show
  1. package/package.json +19 -5
  2. package/dist/ai.d.ts +0 -37
  3. package/dist/analytics.d.ts +0 -36
  4. package/dist/api.d.ts +0 -26
  5. package/dist/app.d.ts +0 -28
  6. package/dist/attributes.d.ts +0 -1
  7. package/dist/auth.d.ts +0 -56
  8. package/dist/auto-imports.d.ts +0 -8
  9. package/dist/binary.d.ts +0 -11
  10. package/dist/cache.d.ts +0 -88
  11. package/dist/cdn.d.ts +0 -4
  12. package/dist/chat.d.ts +0 -69
  13. package/dist/cli.d.ts +0 -316
  14. package/dist/cloud.d.ts +0 -366
  15. package/dist/cms.d.ts +0 -12
  16. package/dist/commerce.d.ts +0 -14
  17. package/dist/components.d.ts +0 -9
  18. package/dist/configure.d.ts +0 -12
  19. package/dist/cors.d.ts +0 -47
  20. package/dist/cron-jobs.d.ts +0 -61
  21. package/dist/dashboard.d.ts +0 -108
  22. package/dist/database.d.ts +0 -76
  23. package/dist/dependencies.d.ts +0 -17
  24. package/dist/deploy.d.ts +0 -16
  25. package/dist/dns.d.ts +0 -362
  26. package/dist/docs.d.ts +0 -23
  27. package/dist/email.d.ts +0 -207
  28. package/dist/env.d.ts +0 -1
  29. package/dist/errors.d.ts +0 -84
  30. package/dist/events.d.ts +0 -31
  31. package/dist/exit-code.d.ts +0 -10
  32. package/dist/file-systems.d.ts +0 -60
  33. package/dist/git.d.ts +0 -60
  34. package/dist/hashing.d.ts +0 -57
  35. package/dist/helpers.d.ts +0 -1
  36. package/dist/i18n.d.ts +0 -65
  37. package/dist/index.d.ts +0 -79
  38. package/dist/index.js +0 -2
  39. package/dist/library.d.ts +0 -799
  40. package/dist/logging.d.ts +0 -15
  41. package/dist/manifest.d.ts +0 -9
  42. package/dist/marketing.d.ts +0 -12
  43. package/dist/model-dashboard-augmentation.d.ts +0 -8
  44. package/dist/model-names.d.ts +0 -1
  45. package/dist/model.d.ts +0 -256
  46. package/dist/monitoring.d.ts +0 -12
  47. package/dist/notifications.d.ts +0 -126
  48. package/dist/oauth.d.ts +0 -290
  49. package/dist/pages.d.ts +0 -10
  50. package/dist/payments.d.ts +0 -322
  51. package/dist/phone.d.ts +0 -65
  52. package/dist/ports.d.ts +0 -20
  53. package/dist/promise.d.ts +0 -1
  54. package/dist/push.d.ts +0 -108
  55. package/dist/queue.d.ts +0 -312
  56. package/dist/reactivity.d.ts +0 -1
  57. package/dist/realtime.d.ts +0 -443
  58. package/dist/request.d.ts +0 -265
  59. package/dist/response.d.ts +0 -15
  60. package/dist/router.d.ts +0 -105
  61. package/dist/saas.d.ts +0 -32
  62. package/dist/scheduler.d.ts +0 -1
  63. package/dist/search-engine.d.ts +0 -129
  64. package/dist/security.d.ts +0 -18
  65. package/dist/server.d.ts +0 -16
  66. package/dist/services.d.ts +0 -149
  67. package/dist/settings-config.d.ts +0 -9
  68. package/dist/sms.d.ts +0 -144
  69. package/dist/stack-extensions.d.ts +0 -137
  70. package/dist/stacks.d.ts +0 -45
  71. package/dist/storage.d.ts +0 -104
  72. package/dist/table-names.d.ts +0 -1
  73. package/dist/tables.d.ts +0 -34
  74. package/dist/team.d.ts +0 -7
  75. package/dist/ui.d.ts +0 -55
  76. package/dist/utils.d.ts +0 -39
  77. package/src/ai.ts +0 -41
  78. package/src/analytics.ts +0 -58
  79. package/src/api.ts +0 -77
  80. package/src/app.ts +0 -189
  81. package/src/attributes.ts +0 -5
  82. package/src/auth.ts +0 -161
  83. package/src/auto-imports.ts +0 -8
  84. package/src/binary.ts +0 -13
  85. package/src/cache.ts +0 -325
  86. package/src/cdn.ts +0 -17
  87. package/src/chat.ts +0 -193
  88. package/src/cli.ts +0 -445
  89. package/src/cloud.ts +0 -381
  90. package/src/cms.ts +0 -14
  91. package/src/commerce.ts +0 -18
  92. package/src/components.ts +0 -62
  93. package/src/configure.ts +0 -13
  94. package/src/cors.ts +0 -86
  95. package/src/cron-jobs.ts +0 -146
  96. package/src/dashboard.ts +0 -218
  97. package/src/database.ts +0 -117
  98. package/src/dependencies.ts +0 -69
  99. package/src/deploy.ts +0 -17
  100. package/src/dns.ts +0 -470
  101. package/src/docs.ts +0 -27
  102. package/src/email.ts +0 -511
  103. package/src/env.ts +0 -1
  104. package/src/errors.ts +0 -110
  105. package/src/events.ts +0 -37
  106. package/src/exit-code.ts +0 -10
  107. package/src/file-systems.ts +0 -70
  108. package/src/git.ts +0 -133
  109. package/src/hashing.ts +0 -127
  110. package/src/helpers.ts +0 -9
  111. package/src/i18n.ts +0 -121
  112. package/src/index.ts +0 -80
  113. package/src/library.ts +0 -911
  114. package/src/logging.ts +0 -62
  115. package/src/manifest.ts +0 -9
  116. package/src/marketing.ts +0 -14
  117. package/src/model-dashboard-augmentation.ts +0 -51
  118. package/src/model-names.ts +0 -1
  119. package/src/model.ts +0 -353
  120. package/src/monitoring.ts +0 -14
  121. package/src/native.ts +0 -0
  122. package/src/notifications.ts +0 -153
  123. package/src/oauth.ts +0 -488
  124. package/src/pages.ts +0 -10
  125. package/src/payments.ts +0 -440
  126. package/src/phone.ts +0 -78
  127. package/src/ports.ts +0 -20
  128. package/src/promise.ts +0 -1
  129. package/src/push.ts +0 -143
  130. package/src/queue.ts +0 -413
  131. package/src/reactivity.ts +0 -1
  132. package/src/realtime.ts +0 -584
  133. package/src/request.ts +0 -541
  134. package/src/response.ts +0 -16
  135. package/src/router.ts +0 -124
  136. package/src/saas.ts +0 -33
  137. package/src/scheduler.ts +0 -1
  138. package/src/search-engine.ts +0 -251
  139. package/src/security.ts +0 -23
  140. package/src/server.ts +0 -16
  141. package/src/services.ts +0 -211
  142. package/src/settings-config.ts +0 -10
  143. package/src/sms.ts +0 -265
  144. package/src/stack-extensions.ts +0 -184
  145. package/src/stacks.ts +0 -339
  146. package/src/storage.ts +0 -173
  147. package/src/table-names.ts +0 -1
  148. package/src/tables.ts +0 -57
  149. package/src/team.ts +0 -8
  150. package/src/ui.ts +0 -197
  151. package/src/utils.ts +0 -46
package/src/oauth.ts DELETED
@@ -1,488 +0,0 @@
1
- /**
2
- * OAuth & Token Types
3
- *
4
- * Comprehensive type definitions for OAuth 2.0 authentication,
5
- * personal access tokens, and related functionality.
6
- *
7
- * This module provides type-safe interfaces for:
8
- * - Access tokens (JWT-like tokens for API authentication)
9
- * - Refresh tokens (for obtaining new access tokens)
10
- * - OAuth clients (applications authorized to request tokens)
11
- * - Database row types (for raw database queries)
12
- * - Token creation and validation results
13
- */
14
-
15
- // ============================================================================
16
- // BRANDED TYPES
17
- // ============================================================================
18
-
19
- /**
20
- * Branded type for authentication tokens.
21
- * Using a branded type ensures tokens are not accidentally confused with regular strings.
22
- *
23
- * @example
24
- * ```typescript
25
- * const token: AuthToken = 'abc123' as AuthToken
26
- * // or use createAuthToken helper
27
- * ```
28
- */
29
- export type AuthToken = string & { readonly __brand: 'AuthToken' }
30
-
31
- /**
32
- * Branded type for refresh tokens.
33
- * Distinct from AuthToken to prevent accidental misuse.
34
- */
35
- export type RefreshTokenString = string & { readonly __brand: 'RefreshToken' }
36
-
37
- /**
38
- * Branded type for OAuth client secrets.
39
- */
40
- export type ClientSecret = string & { readonly __brand: 'ClientSecret' }
41
-
42
- /**
43
- * Branded type for hashed token values stored in database.
44
- */
45
- export type HashedToken = string & { readonly __brand: 'HashedToken' }
46
-
47
- // ============================================================================
48
- // TOKEN SCOPE TYPES
49
- // ============================================================================
50
-
51
- /**
52
- * Common OAuth scopes/abilities.
53
- * Use these predefined scopes or define custom ones.
54
- */
55
- export type CommonScope =
56
- | '*' // Wildcard - all permissions
57
- | 'read'
58
- | 'write'
59
- | 'delete'
60
- | 'admin'
61
- | 'user:read'
62
- | 'user:write'
63
- | 'posts:read'
64
- | 'posts:write'
65
- | 'posts:delete'
66
-
67
- /**
68
- * Token scope - can be common scopes or custom string scopes.
69
- */
70
- export type TokenScope = CommonScope | (string & {})
71
-
72
- /**
73
- * Array of token scopes/abilities.
74
- */
75
- export type TokenScopes = TokenScope[]
76
-
77
- // ============================================================================
78
- // ACCESS TOKEN TYPES
79
- // ============================================================================
80
-
81
- /**
82
- * Access token entity with full metadata.
83
- * Represents a token after being retrieved from the database.
84
- */
85
- export interface AccessToken {
86
- /** Unique token identifier */
87
- readonly id: number
88
- /** ID of the user this token belongs to */
89
- readonly userId: number
90
- /** ID of the OAuth client that issued this token */
91
- readonly clientId: number
92
- /** Human-readable name for the token */
93
- readonly name: string
94
- /** Array of scopes/abilities granted to this token */
95
- readonly scopes: TokenScopes
96
- /** Whether the token has been revoked */
97
- readonly revoked: boolean
98
- /** When the token expires (null = never expires) */
99
- readonly expiresAt: Date | null
100
- /** When the token was created */
101
- readonly createdAt: Date
102
- /** When the token was last updated */
103
- readonly updatedAt: Date
104
- }
105
-
106
- /**
107
- * Personal access token with additional metadata.
108
- * Extended version used in the Auth class.
109
- */
110
- export interface PersonalAccessToken extends AccessToken {
111
- /** Abilities is an alias for scopes */
112
- readonly abilities: TokenScopes
113
- /** The plain text token (only available immediately after creation) */
114
- readonly plainTextToken?: AuthToken
115
- }
116
-
117
- /**
118
- * Mutable version of AccessToken for internal use.
119
- */
120
- export interface MutableAccessToken {
121
- id: number
122
- userId: number
123
- clientId: number
124
- name: string
125
- scopes: TokenScopes
126
- revoked: boolean
127
- expiresAt: Date | null
128
- createdAt: Date
129
- updatedAt: Date
130
- }
131
-
132
- // ============================================================================
133
- // REFRESH TOKEN TYPES
134
- // ============================================================================
135
-
136
- /**
137
- * Refresh token entity for obtaining new access tokens.
138
- */
139
- export interface RefreshToken {
140
- /** Unique refresh token identifier */
141
- readonly id: number
142
- /** ID of the associated access token */
143
- readonly accessTokenId: number
144
- /** Whether the refresh token has been revoked */
145
- readonly revoked: boolean
146
- /** When the refresh token expires */
147
- readonly expiresAt: Date | null
148
- /** When the refresh token was created */
149
- readonly createdAt: Date
150
- }
151
-
152
- // ============================================================================
153
- // OAUTH CLIENT TYPES
154
- // ============================================================================
155
-
156
- /**
157
- * OAuth client types for different authentication flows.
158
- */
159
- export type OAuthClientType = 'personal_access' | 'password' | 'authorization_code' | 'client_credentials'
160
-
161
- /**
162
- * OAuth client entity representing an authorized application.
163
- */
164
- export interface OAuthClient {
165
- /** Unique client identifier */
166
- readonly id: number
167
- /** Client name */
168
- readonly name: string
169
- /** Client secret (hashed in database) */
170
- readonly secret: ClientSecret | string
171
- /** Authentication provider */
172
- readonly provider: string | null
173
- /** OAuth redirect URI */
174
- readonly redirect: string
175
- /** Whether this is a personal access client */
176
- readonly personalAccessClient: boolean
177
- /** Whether this is a password grant client */
178
- readonly passwordClient: boolean
179
- /** Whether the client has been revoked */
180
- readonly revoked: boolean
181
- /** When the client was created */
182
- readonly createdAt: Date
183
- /** When the client was last updated */
184
- readonly updatedAt: Date | null
185
- }
186
-
187
- // ============================================================================
188
- // DATABASE ROW TYPES
189
- // ============================================================================
190
-
191
- /**
192
- * Raw database row for oauth_access_tokens table.
193
- * Use this when working with raw SQL queries.
194
- */
195
- export interface OAuthAccessTokenRow {
196
- id: number
197
- user_id: number
198
- oauth_client_id: number
199
- token: string
200
- name: string | null
201
- scopes: string | null
202
- revoked: boolean | number
203
- expires_at: string | null
204
- created_at: string | null
205
- updated_at: string | null
206
- }
207
-
208
- /**
209
- * Raw database row for oauth_refresh_tokens table.
210
- */
211
- export interface OAuthRefreshTokenRow {
212
- id: number
213
- access_token_id: number
214
- token: string
215
- revoked: boolean | number
216
- expires_at: string | null
217
- created_at: string | null
218
- }
219
-
220
- /**
221
- * Raw database row for oauth_clients table.
222
- */
223
- export interface OAuthClientRow {
224
- id: number
225
- name: string
226
- secret: string
227
- provider: string | null
228
- redirect: string
229
- personal_access_client: boolean | number
230
- password_client: boolean | number
231
- revoked: boolean | number
232
- created_at: string | null
233
- updated_at: string | null
234
- }
235
-
236
- // ============================================================================
237
- // TOKEN CREATION TYPES
238
- // ============================================================================
239
-
240
- /**
241
- * Options for creating a new token.
242
- */
243
- export interface TokenCreateOptions {
244
- /** Human-readable name for the token */
245
- name?: string
246
- /** Scopes/abilities to grant to the token */
247
- abilities?: TokenScopes
248
- /** Alternative name for abilities */
249
- scopes?: TokenScopes
250
- /** When the token should expire */
251
- expiresAt?: Date
252
- /** Token expiry in minutes (alternative to expiresAt) */
253
- expiresInMinutes?: number
254
- /** Whether to create a refresh token */
255
- withRefreshToken?: boolean
256
- /** Refresh token expiry in days */
257
- refreshExpiresInDays?: number
258
- }
259
-
260
- /**
261
- * Result returned when creating a personal access token.
262
- */
263
- export interface PersonalAccessTokenResult {
264
- /** The created access token entity */
265
- readonly accessToken: AccessToken
266
- /** The plain text token - SAVE THIS, it won't be shown again */
267
- readonly plainTextToken: AuthToken | string
268
- /** The plain text refresh token (if requested) */
269
- readonly refreshToken?: RefreshTokenString | string
270
- /** Token expiry in seconds (for OAuth2 compatibility) */
271
- readonly expiresIn: number
272
- }
273
-
274
- /**
275
- * Result returned when creating a token via the Auth class.
276
- */
277
- export interface NewAccessToken {
278
- /** The created access token entity */
279
- readonly accessToken: PersonalAccessToken
280
- /** The plain text token */
281
- readonly plainTextToken: AuthToken
282
- /**
283
- * Plain text refresh token paired with the access token. Single-use:
284
- * exchanging it for a new access token also rotates this refresh
285
- * value. Omitted when the caller passed `withRefreshToken: false`.
286
- */
287
- readonly refreshToken?: string
288
- /** Access-token expiry in seconds (OAuth2 `expires_in` shape) */
289
- readonly expiresIn?: number
290
- }
291
-
292
- /**
293
- * Result returned when refreshing a token.
294
- */
295
- export interface RefreshTokenResult {
296
- /** The new access token entity */
297
- readonly accessToken: AccessToken
298
- /** The new plain text access token */
299
- readonly plainTextToken: AuthToken | string
300
- /** The new plain text refresh token */
301
- readonly refreshToken: RefreshTokenString | string
302
- /** Token expiry in seconds */
303
- readonly expiresIn: number
304
- }
305
-
306
- // ============================================================================
307
- // OAUTH CLIENT CREATION TYPES
308
- // ============================================================================
309
-
310
- /**
311
- * Options for creating a new OAuth client.
312
- */
313
- export interface CreateClientOptions {
314
- /** Client name */
315
- name: string
316
- /** OAuth redirect URI */
317
- redirect: string
318
- /** User ID who owns this client */
319
- userId?: number
320
- /** Whether this is a personal access client */
321
- personalAccessClient?: boolean
322
- /** Whether this is a password grant client */
323
- passwordClient?: boolean
324
- /** Authentication provider */
325
- provider?: string
326
- }
327
-
328
- /**
329
- * Result returned when creating a new OAuth client.
330
- */
331
- export interface CreateClientResult {
332
- /** The created client entity */
333
- readonly client: OAuthClient
334
- /** The plain text client secret - SAVE THIS, it won't be shown again */
335
- readonly plainTextSecret: ClientSecret | string
336
- }
337
-
338
- // ============================================================================
339
- // TOKEN VALIDATION TYPES
340
- // ============================================================================
341
-
342
- /**
343
- * Result of token validation.
344
- */
345
- export interface TokenValidationResult {
346
- /** Whether the token is valid */
347
- readonly valid: boolean
348
- /** The access token if valid */
349
- readonly token?: AccessToken
350
- /** Error message if invalid */
351
- readonly error?: string
352
- /** Whether the token was rotated */
353
- readonly rotated?: boolean
354
- /** New token if rotated */
355
- readonly newToken?: AuthToken
356
- }
357
-
358
- /**
359
- * Token payload extracted from JWT-like tokens.
360
- */
361
- export interface TokenPayload {
362
- /** Subject (user ID) */
363
- readonly sub: number
364
- /** Issued at timestamp */
365
- readonly iat: number
366
- /** Expiration timestamp */
367
- readonly exp: number
368
- /** JWT ID */
369
- readonly jti: string
370
- }
371
-
372
- // ============================================================================
373
- // AUTHENTICATION CREDENTIALS
374
- // ============================================================================
375
-
376
- /**
377
- * User credentials for authentication.
378
- */
379
- export interface AuthCredentials {
380
- /** User's email address */
381
- email?: string
382
- /** User's password */
383
- password?: string
384
- /** Additional credential fields (for custom auth) */
385
- [key: string]: string | undefined
386
- }
387
-
388
- /**
389
- * Login result containing user and token.
390
- */
391
- export interface LoginResult<TUser = unknown> {
392
- /** The authenticated user */
393
- readonly user: TUser
394
- /** The authentication token */
395
- readonly token: AuthToken
396
- }
397
-
398
- // ============================================================================
399
- // DATABASE DRIVER TYPES
400
- // ============================================================================
401
-
402
- /**
403
- * Supported database drivers for OAuth tables.
404
- */
405
- export type DatabaseDriver = 'postgres' | 'mysql' | 'sqlite'
406
-
407
- /**
408
- * SQL syntax configuration based on database driver.
409
- */
410
- export interface DatabaseSqlSyntax {
411
- /** Current timestamp function */
412
- readonly now: string
413
- /** Boolean true value */
414
- readonly boolTrue: string
415
- /** Boolean false value */
416
- readonly boolFalse: string
417
- /** Auto-increment keyword */
418
- readonly autoIncrement: string
419
- /** Primary key syntax */
420
- readonly primaryKey: string
421
- /** Parameter placeholder function */
422
- readonly param: (index: number) => string
423
- }
424
-
425
- // ============================================================================
426
- // TYPE GUARDS
427
- // ============================================================================
428
-
429
- /**
430
- * Type guard to check if a value is an AccessToken.
431
- */
432
- export function isAccessToken(value: unknown): value is AccessToken {
433
- return (
434
- typeof value === 'object'
435
- && value !== null
436
- && 'id' in value
437
- && 'userId' in value
438
- && 'clientId' in value
439
- && 'scopes' in value
440
- )
441
- }
442
-
443
- /**
444
- * Type guard to check if a value is a PersonalAccessToken.
445
- */
446
- export function isPersonalAccessToken(value: unknown): value is PersonalAccessToken {
447
- return isAccessToken(value) && 'abilities' in value
448
- }
449
-
450
- /**
451
- * Type guard to check if a value is an OAuthClient.
452
- */
453
- export function isOAuthClient(value: unknown): value is OAuthClient {
454
- return (
455
- typeof value === 'object'
456
- && value !== null
457
- && 'id' in value
458
- && 'name' in value
459
- && 'secret' in value
460
- && 'redirect' in value
461
- )
462
- }
463
-
464
- // ============================================================================
465
- // UTILITY TYPES
466
- // ============================================================================
467
-
468
- /**
469
- * Make specific properties of a type optional.
470
- */
471
- export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
472
-
473
- /**
474
- * Make specific properties of a type required.
475
- */
476
- export type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>
477
-
478
- /**
479
- * Extract the user type from a generic context.
480
- */
481
- export type ExtractUser<T> = T extends { user: infer U } ? U : never
482
-
483
- /**
484
- * Token with user attached.
485
- */
486
- export interface TokenWithUser<TUser = unknown> extends AccessToken {
487
- readonly user: TUser
488
- }
package/src/pages.ts DELETED
@@ -1,10 +0,0 @@
1
- export interface PagesOption {
2
- onboarding: {
3
- path: string
4
- pages: string[]
5
- }
6
- settings: {
7
- path: string
8
- pages: string[]
9
- }
10
- }