@stacksjs/types 0.70.73 → 0.70.74

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/cli.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { BunFile } from 'bun';
2
2
  import type { Ports } from './ports';
3
3
  export type { ErrorLike, SpawnOptions, Subprocess, SyncSubprocess } from 'bun';
4
- export type { CAC as CLI } from 'cac';
4
+ export type { CLI } from '@stacksjs/clapp';
5
5
  export declare interface OutroOptions extends CliOptions {
6
6
  type?: 'success' | 'error' | 'warning' | 'info'
7
7
  startTime?: number
package/dist/email.d.ts CHANGED
@@ -108,7 +108,7 @@ export declare interface EmailOptions {
108
108
  charset: string
109
109
  server: EmailServerConfig
110
110
  notifications?: EmailNotificationsConfig
111
- default: 'log' | 'ses' | 'sendgrid' | 'mailgun' | 'mailtrap' | 'smtp'
111
+ default: 'log' | 'capture' | 'ses' | 'sendgrid' | 'mailgun' | 'mailtrap' | 'smtp'
112
112
  suppressionPolicy?: 'strict' | 'transactional-allowed' | 'off'
113
113
  unsubscribeRoute?: string
114
114
  }
package/dist/model.d.ts CHANGED
@@ -196,6 +196,8 @@ export declare interface ModelOptions extends Base {
196
196
  }
197
197
  }
198
198
  export declare interface Attribute {
199
+ type?: string
200
+ nullable?: boolean
199
201
  default?: string | number | boolean | Date
200
202
  unique?: boolean
201
203
  order?: number
package/dist/phone.d.ts CHANGED
@@ -40,6 +40,17 @@ export declare interface PhoneNotificationsConfig {
40
40
  missedCall?: PhoneNotificationConfig
41
41
  voicemail?: PhoneNotificationConfig
42
42
  }
43
+ export declare interface CallForwardingRule {
44
+ name: string
45
+ condition: CallForwardingCondition
46
+ forwardTo: string
47
+ ringTimeout: number
48
+ priority: number
49
+ }
50
+ export declare interface CallForwardingConfig {
51
+ enabled: boolean
52
+ rules: CallForwardingRule[]
53
+ }
43
54
  export declare interface PhoneOptions {
44
55
  enabled: boolean
45
56
  provider: 'connect'
@@ -47,6 +58,8 @@ export declare interface PhoneOptions {
47
58
  phoneNumbers: PhoneNumberConfig[]
48
59
  notifications: PhoneNotificationsConfig
49
60
  voicemail: VoicemailConfig
61
+ forwarding?: CallForwardingConfig
50
62
  businessHours?: BusinessHoursConfig
51
63
  }
64
+ export type CallForwardingCondition = 'always' | 'business_hours' | 'after_hours';
52
65
  export type PhoneConfig = Partial<PhoneOptions>;
package/dist/request.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { User } from '@stacksjs/orm';
2
2
  import type { AuthToken } from '@stacksjs/types';
3
3
  import type { Infer } from '@stacksjs/ts-validation';
4
- import type { ModelRow } from '@stacksjs/orm';
5
4
  import type { UploadedFile } from '@stacksjs/storage';
6
5
  declare interface RequestData {
7
6
  [key: string]: any
@@ -77,15 +76,17 @@ export declare interface RequestInstance<TFields extends Record<string, any> = R
77
76
  formBody?: any
78
77
  files: Record<string, File | File[]>
79
78
  cookies?: RequestCookies
80
- get: <K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]) => TFields[K]
81
- input: <K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]) => TFields[K]
79
+ get<K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]): TFields[K]
80
+ get<T = any>(key: string, defaultValue?: T): T
81
+ input<K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]): TFields[K]
82
+ input<T = any>(key: string, defaultValue?: T): T
82
83
  all: () => TFields
83
84
  only: <K extends keyof TFields & string>(keys: K[]) => Pick<TFields, K>
84
85
  except: <K extends keyof TFields & string>(keys: K[]) => Omit<TFields, K>
85
- has: (key: (keyof TFields & string) | (keyof TFields & string)[]) => boolean
86
- hasAny: (keys: (keyof TFields & string)[]) => boolean
87
- filled: (key: (keyof TFields & string) | (keyof TFields & string)[]) => boolean
88
- missing: (key: (keyof TFields & string) | (keyof TFields & string)[]) => boolean
86
+ has: (key: string | string[]) => boolean
87
+ hasAny: (keys: string[]) => boolean
88
+ filled: (key: string | string[]) => boolean
89
+ missing: (key: string | string[]) => boolean
89
90
  merge: (data: Partial<TFields>) => void
90
91
  keys: () => (keyof TFields & string)[]
91
92
  string: (key: keyof TFields & string, defaultValue?: string) => string
@@ -96,7 +97,7 @@ export declare interface RequestInstance<TFields extends Record<string, any> = R
96
97
  date: (key: keyof TFields & string, format?: string) => Date | null
97
98
  enum: <T extends Record<string, string | number>>(key: keyof TFields & string, enumType: T) => T[keyof T] | null
98
99
  collect: <T = unknown>(key: keyof TFields & string) => Collection<T>
99
- validate: (rules?: Record<string, string>, messages?: Record<string, string>) => Promise<TFields>
100
+ validate: (rules?: RequestValidationRules, messages?: Record<string, string>) => Promise<TFields>
100
101
  getValidated: () => TFields
101
102
  safe: () => SafeData<TFields>
102
103
  whenHas: <T>(key: keyof TFields & string, callback: (value: T) => void, defaultCallback?: () => void) => void
@@ -128,7 +129,10 @@ export declare interface RequestInstance<TFields extends Record<string, any> = R
128
129
  getMethod: () => HttpMethod
129
130
  user: () => Promise<UserJsonResponse | undefined>
130
131
  }
131
- declare type UserJsonResponse = ModelRow<typeof User>;
132
+ // Trait methods are attached dynamically by the Stacks model proxy. The
133
+ // open member bag reflects application-level traits that the framework's
134
+ // default User definition cannot know about ahead of time.
135
+ declare type UserJsonResponse = NonNullable<Awaited<ReturnType<typeof User.find>>> & Record<string, any>;
132
136
  /**
133
137
  * Loose route-param shape kept around for back-compat with code that
134
138
  * predates {@link RequestInstance}'s `TParams` generic. New code should
@@ -255,3 +259,7 @@ export type ActionRequest<TFields extends Record<string, any> = Record<string, a
255
259
  export type InferValidations<V extends Record<string, { rule: any }>> = {
256
260
  [K in keyof V]: Infer<V[K]['rule']>
257
261
  }
262
+ export type RequestValidationRules = Record<string, string | {
263
+ rule: { validate: (value: any) => any }
264
+ message?: string | Record<string, string>
265
+ }>;
@@ -1,4 +1,4 @@
1
- import type { Dictionary, DocumentOptions, EnqueuedTask, Faceting, Hits, Index, IndexesResults, IndexOptions, MeiliSearch, Settings as MeilisearchOptions, PaginationSettings, DocumentOptions as RecordOptions, SearchParams, SearchResponse, Settings, Synonyms, TypoTolerance } from 'meilisearch';
1
+ import type { Dictionary, DocumentOptions, EnqueuedTask, Faceting, Hits, Index, IndexesResults, IndexOptions, Meilisearch, Settings as MeilisearchOptions, PaginationSettings, DocumentOptions as RecordOptions, SearchParams, SearchResponse, Settings, Synonyms, TypoTolerance } from 'meilisearch';
2
2
  import type { MaybePromise } from '.';
3
3
  export type {
4
4
  EnqueuedTask,
@@ -6,7 +6,7 @@ export type {
6
6
  Index,
7
7
  IndexesResults,
8
8
  IndexOptions,
9
- MeiliSearch,
9
+ Meilisearch,
10
10
  MeilisearchOptions,
11
11
  RecordOptions,
12
12
  SearchParams,
@@ -55,7 +55,7 @@ export declare interface SearchEngineOptions {
55
55
  perPage?: number
56
56
  }
57
57
  export declare interface SearchEngineDriver {
58
- client: () => MeiliSearch
58
+ client: () => Meilisearch
59
59
  resetClient?: () => void
60
60
  search: (index: string, params: any) => Promise<SearchResponse<Record<string, any>>>
61
61
  createIndex: (name: string, options?: IndexOptions) => MaybePromise<EnqueuedTask>
package/dist/storage.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { Buffer } from 'node:buffer';
2
- import type { ReadableStream } from 'node:stream/web';
3
2
  /**
4
3
  * File stat entry information
5
4
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.70.73",
4
+ "version": "0.70.74",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -52,14 +52,16 @@
52
52
  "prepublishOnly": "bun run build"
53
53
  },
54
54
  "dependencies": {
55
- "@stacksjs/bunpress": "^0.1.11",
55
+ "@stacksjs/bunpress": "^0.1.12",
56
+ "@stacksjs/clapp": "^0.2.10",
56
57
  "@stacksjs/ts-validation": "^0.5.0",
57
- "bun-query-builder": "^0.1.38"
58
+ "bun-query-builder": "^0.1.47",
59
+ "meilisearch": "^0.59.0"
58
60
  },
59
61
  "devDependencies": {
60
- "@stacksjs/validation": "0.70.73",
62
+ "@stacksjs/validation": "0.70.74",
61
63
  "@types/bun": "^1.3.11",
62
- "typescript": "^5.9.3"
64
+ "typescript": "^7.0.2"
63
65
  },
64
66
  "sideEffects": false
65
67
  }
package/src/cli.ts CHANGED
@@ -442,4 +442,4 @@ export interface TypesOptions extends CliOptions {}
442
442
 
443
443
  export type LibEntryType = 'web-components' | 'functions' | 'all'
444
444
 
445
- export type { CAC as CLI } from 'cac'
445
+ export type { CLI } from '@stacksjs/clapp'
package/src/email.ts CHANGED
@@ -302,7 +302,7 @@ export interface EmailOptions {
302
302
  server: EmailServerConfig
303
303
  notifications?: EmailNotificationsConfig
304
304
 
305
- default: 'log' | 'ses' | 'sendgrid' | 'mailgun' | 'mailtrap' | 'smtp'
305
+ default: 'log' | 'capture' | 'ses' | 'sendgrid' | 'mailgun' | 'mailtrap' | 'smtp'
306
306
 
307
307
  /**
308
308
  * Suppression-list enforcement policy (stacksjs/stacks#1880).
package/src/model.ts CHANGED
@@ -252,6 +252,8 @@ export interface ModelOptions extends Base {
252
252
  }
253
253
 
254
254
  export interface Attribute {
255
+ type?: string
256
+ nullable?: boolean
255
257
  default?: string | number | boolean | Date
256
258
  unique?: boolean
257
259
  order?: number
package/src/phone.ts CHANGED
@@ -48,6 +48,21 @@ export interface PhoneNotificationsConfig {
48
48
  voicemail?: PhoneNotificationConfig
49
49
  }
50
50
 
51
+ export type CallForwardingCondition = 'always' | 'business_hours' | 'after_hours'
52
+
53
+ export interface CallForwardingRule {
54
+ name: string
55
+ condition: CallForwardingCondition
56
+ forwardTo: string
57
+ ringTimeout: number
58
+ priority: number
59
+ }
60
+
61
+ export interface CallForwardingConfig {
62
+ enabled: boolean
63
+ rules: CallForwardingRule[]
64
+ }
65
+
51
66
  export interface PhoneOptions {
52
67
  enabled: boolean
53
68
  provider: 'connect' // Amazon Connect
@@ -56,6 +71,7 @@ export interface PhoneOptions {
56
71
  phoneNumbers: PhoneNumberConfig[]
57
72
  notifications: PhoneNotificationsConfig
58
73
  voicemail: VoicemailConfig
74
+ forwarding?: CallForwardingConfig
59
75
  businessHours?: BusinessHoursConfig
60
76
  }
61
77
 
package/src/request.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { ModelRow } from '@stacksjs/orm'
2
1
  import { User } from '@stacksjs/orm'
3
2
  import type { UploadedFile } from '@stacksjs/storage'
4
3
  import type { AuthToken, RouteParam } from '@stacksjs/types'
@@ -7,7 +6,10 @@ import type { AuthToken, RouteParam } from '@stacksjs/types'
7
6
  // keeps this package free of a runtime ts-validation dependency.
8
7
  import type { Infer } from '@stacksjs/ts-validation'
9
8
 
10
- type UserJsonResponse = ModelRow<typeof User>
9
+ // Trait methods are attached dynamically by the Stacks model proxy. The
10
+ // open member bag reflects application-level traits that the framework's
11
+ // default User definition cannot know about ahead of time.
12
+ type UserJsonResponse = NonNullable<Awaited<ReturnType<typeof User.find>>> & Record<string, any>
11
13
 
12
14
  interface RequestData {
13
15
  [key: string]: any
@@ -218,6 +220,11 @@ export type InferValidations<V extends Record<string, { rule: any }>> = {
218
220
  [K in keyof V]: Infer<V[K]['rule']>
219
221
  }
220
222
 
223
+ export type RequestValidationRules = Record<string, string | {
224
+ rule: { validate: (value: any) => any }
225
+ message?: string | Record<string, string>
226
+ }>
227
+
221
228
  export interface RequestInstance<
222
229
  TFields extends Record<string, any> = Record<string, any>,
223
230
  TParams extends Record<string, string> = Record<string, string>,
@@ -267,12 +274,14 @@ export interface RequestInstance<
267
274
  * @example request.get('title') // returns string (when model-aware)
268
275
  * @example request.get('views', 0) // returns number with default
269
276
  */
270
- get: <K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]) => TFields[K]
277
+ get<K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]): TFields[K]
278
+ get<T = any>(key: string, defaultValue?: T): T
271
279
 
272
280
  /**
273
281
  * Alias for get() - Laravel compatibility
274
282
  */
275
- input: <K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]) => TFields[K]
283
+ input<K extends keyof TFields & string>(key: K, defaultValue?: TFields[K]): TFields[K]
284
+ input<T = any>(key: string, defaultValue?: T): T
276
285
 
277
286
  /**
278
287
  * Get all input data (typed to model fields when model-aware)
@@ -296,25 +305,25 @@ export interface RequestInstance<
296
305
  * @example request.has('title')
297
306
  * @example request.has(['title', 'views'])
298
307
  */
299
- has: (key: (keyof TFields & string) | (keyof TFields & string)[]) => boolean
308
+ has: (key: string | string[]) => boolean
300
309
 
301
310
  /**
302
311
  * Check if input has any of the specified keys
303
312
  * @example request.hasAny(['title', 'views'])
304
313
  */
305
- hasAny: (keys: (keyof TFields & string)[]) => boolean
314
+ hasAny: (keys: string[]) => boolean
306
315
 
307
316
  /**
308
317
  * Check if input is filled (present and not empty)
309
318
  * @example request.filled('title')
310
319
  */
311
- filled: (key: (keyof TFields & string) | (keyof TFields & string)[]) => boolean
320
+ filled: (key: string | string[]) => boolean
312
321
 
313
322
  /**
314
323
  * Check if input is missing
315
324
  * @example request.missing('title')
316
325
  */
317
- missing: (key: (keyof TFields & string) | (keyof TFields & string)[]) => boolean
326
+ missing: (key: string | string[]) => boolean
318
327
 
319
328
  /**
320
329
  * Merge additional data into input — accepts partial model fields
@@ -390,7 +399,7 @@ export interface RequestInstance<
390
399
  * @example await request.validate() // uses model rules
391
400
  * @example await request.validate({ name: 'required' }) // custom rules
392
401
  */
393
- validate: (rules?: Record<string, string>, messages?: Record<string, string>) => Promise<TFields>
402
+ validate: (rules?: RequestValidationRules, messages?: Record<string, string>) => Promise<TFields>
394
403
 
395
404
  /**
396
405
  * Get previously validated data, typed to model fields
@@ -7,7 +7,7 @@ import type {
7
7
  Index,
8
8
  IndexesResults,
9
9
  IndexOptions,
10
- MeiliSearch,
10
+ Meilisearch,
11
11
  Settings as MeilisearchOptions,
12
12
  PaginationSettings,
13
13
  DocumentOptions as RecordOptions,
@@ -85,7 +85,7 @@ export interface SearchEngineOptions {
85
85
  export type SearchEngineConfig = Partial<SearchEngineOptions>
86
86
 
87
87
  export interface SearchEngineDriver {
88
- client: () => MeiliSearch
88
+ client: () => Meilisearch
89
89
  resetClient?: () => void
90
90
 
91
91
  search: (index: string, params: any) => Promise<SearchResponse<Record<string, any>>>
@@ -243,7 +243,7 @@ export type {
243
243
  Index,
244
244
  IndexesResults,
245
245
  IndexOptions,
246
- MeiliSearch,
246
+ Meilisearch,
247
247
  MeilisearchOptions,
248
248
  RecordOptions,
249
249
  SearchParams,
package/src/storage.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { Buffer } from 'node:buffer'
2
- import type { ReadableStream } from 'node:stream/web'
3
2
 
4
3
  /**
5
4
  * File contents can be a string, Buffer, Uint8Array, or ReadableStream