@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 +1 -1
- package/dist/email.d.ts +1 -1
- package/dist/model.d.ts +2 -0
- package/dist/phone.d.ts +13 -0
- package/dist/request.d.ts +17 -9
- package/dist/search-engine.d.ts +3 -3
- package/dist/storage.d.ts +0 -1
- package/package.json +7 -5
- package/src/cli.ts +1 -1
- package/src/email.ts +1 -1
- package/src/model.ts +2 -0
- package/src/phone.ts +16 -0
- package/src/request.ts +18 -9
- package/src/search-engine.ts +3 -3
- package/src/storage.ts +0 -1
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 {
|
|
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
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
|
|
81
|
-
|
|
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:
|
|
86
|
-
hasAny: (keys:
|
|
87
|
-
filled: (key:
|
|
88
|
-
missing: (key:
|
|
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?:
|
|
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
|
-
|
|
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
|
+
}>;
|
package/dist/search-engine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Dictionary, DocumentOptions, EnqueuedTask, Faceting, Hits, Index, IndexesResults, IndexOptions,
|
|
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
|
-
|
|
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: () =>
|
|
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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/types",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
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.
|
|
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.
|
|
58
|
+
"bun-query-builder": "^0.1.47",
|
|
59
|
+
"meilisearch": "^0.59.0"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
|
-
"@stacksjs/validation": "0.70.
|
|
62
|
+
"@stacksjs/validation": "0.70.74",
|
|
61
63
|
"@types/bun": "^1.3.11",
|
|
62
|
-
"typescript": "^
|
|
64
|
+
"typescript": "^7.0.2"
|
|
63
65
|
},
|
|
64
66
|
"sideEffects": false
|
|
65
67
|
}
|
package/src/cli.ts
CHANGED
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
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
|
-
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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?:
|
|
402
|
+
validate: (rules?: RequestValidationRules, messages?: Record<string, string>) => Promise<TFields>
|
|
394
403
|
|
|
395
404
|
/**
|
|
396
405
|
* Get previously validated data, typed to model fields
|
package/src/search-engine.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
Index,
|
|
8
8
|
IndexesResults,
|
|
9
9
|
IndexOptions,
|
|
10
|
-
|
|
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: () =>
|
|
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
|
-
|
|
246
|
+
Meilisearch,
|
|
247
247
|
MeilisearchOptions,
|
|
248
248
|
RecordOptions,
|
|
249
249
|
SearchParams,
|