@stacksjs/types 0.70.88 → 0.70.91
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/ai.d.ts +37 -0
- package/dist/analytics.d.ts +36 -0
- package/dist/api.d.ts +26 -0
- package/dist/app.d.ts +28 -0
- package/dist/attributes.d.ts +1 -0
- package/dist/auth.d.ts +62 -0
- package/dist/auto-imports.d.ts +8 -0
- package/dist/binary.d.ts +11 -0
- package/dist/cache.d.ts +88 -0
- package/dist/cdn.d.ts +4 -0
- package/dist/chat.d.ts +69 -0
- package/dist/cli.d.ts +316 -0
- package/dist/cloud.d.ts +366 -0
- package/dist/cms.d.ts +12 -0
- package/dist/commerce.d.ts +14 -0
- package/dist/components.d.ts +9 -0
- package/dist/configure.d.ts +12 -0
- package/dist/cors.d.ts +47 -0
- package/dist/cron-jobs.d.ts +61 -0
- package/dist/dashboard.d.ts +108 -0
- package/dist/database.d.ts +76 -0
- package/dist/dependencies.d.ts +17 -0
- package/dist/deploy.d.ts +16 -0
- package/dist/dns.d.ts +362 -0
- package/dist/docs.d.ts +23 -0
- package/dist/email.d.ts +207 -0
- package/dist/env.d.ts +1 -0
- package/dist/errors.d.ts +84 -0
- package/dist/events.d.ts +31 -0
- package/dist/exit-code.d.ts +10 -0
- package/dist/feature-flags.d.ts +17 -0
- package/dist/file-systems.d.ts +60 -0
- package/dist/git.d.ts +60 -0
- package/dist/hashing.d.ts +57 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/i18n.d.ts +65 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +2 -0
- package/dist/library.d.ts +799 -0
- package/dist/logging.d.ts +15 -0
- package/dist/manifest.d.ts +9 -0
- package/dist/marketing.d.ts +12 -0
- package/dist/model-dashboard-augmentation.d.ts +8 -0
- package/dist/model-names.d.ts +1 -0
- package/dist/model.d.ts +256 -0
- package/dist/monitoring.d.ts +12 -0
- package/dist/notifications.d.ts +126 -0
- package/dist/oauth.d.ts +290 -0
- package/dist/pages.d.ts +10 -0
- package/dist/payments.d.ts +322 -0
- package/dist/phone.d.ts +65 -0
- package/dist/ports.d.ts +20 -0
- package/dist/promise.d.ts +1 -0
- package/dist/push.d.ts +108 -0
- package/dist/queue.d.ts +312 -0
- package/dist/reactivity.d.ts +1 -0
- package/dist/realtime.d.ts +443 -0
- package/dist/request.d.ts +265 -0
- package/dist/response.d.ts +15 -0
- package/dist/router.d.ts +105 -0
- package/dist/saas.d.ts +32 -0
- package/dist/scheduler.d.ts +1 -0
- package/dist/search-engine.d.ts +129 -0
- package/dist/security.d.ts +18 -0
- package/dist/server.d.ts +16 -0
- package/dist/services.d.ts +149 -0
- package/dist/settings-config.d.ts +9 -0
- package/dist/sms.d.ts +144 -0
- package/dist/stack-extensions.d.ts +137 -0
- package/dist/stacks.d.ts +46 -0
- package/dist/storage.d.ts +104 -0
- package/dist/table-names.d.ts +1 -0
- package/dist/tables.d.ts +34 -0
- package/dist/team.d.ts +7 -0
- package/dist/ui.d.ts +55 -0
- package/dist/utils.d.ts +39 -0
- package/package.json +3 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare interface ResponseInstance {
|
|
2
|
+
json: (data: any, status?: number) => ResponseData
|
|
3
|
+
success: (data: any) => ResponseData
|
|
4
|
+
created: (data: any) => ResponseData
|
|
5
|
+
noContent: () => ResponseData
|
|
6
|
+
error: (message: string, status: number) => ResponseData
|
|
7
|
+
forbidden: (message: string) => ResponseData
|
|
8
|
+
unauthorized: (message: string) => ResponseData
|
|
9
|
+
notFound: (message: string) => ResponseData
|
|
10
|
+
}
|
|
11
|
+
export declare interface ResponseData {
|
|
12
|
+
status: number
|
|
13
|
+
headers: { [key: string]: string }
|
|
14
|
+
body: string
|
|
15
|
+
}
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Action } from '@stacksjs/actions';
|
|
2
|
+
import type { HttpMethod } from './request';
|
|
3
|
+
import type { ValidationType } from '@stacksjs/ts-validation';
|
|
4
|
+
export declare interface RequestData {
|
|
5
|
+
[key: string]: any
|
|
6
|
+
}
|
|
7
|
+
export declare interface ValidationField {
|
|
8
|
+
rule: ValidationType
|
|
9
|
+
message: Record<string, string>
|
|
10
|
+
}
|
|
11
|
+
export declare interface CustomAttributes {
|
|
12
|
+
[key: string]: ValidationField
|
|
13
|
+
}
|
|
14
|
+
export declare interface RouteParams { [key: string]: string | number }
|
|
15
|
+
export declare interface Route {
|
|
16
|
+
name: string
|
|
17
|
+
uri: string
|
|
18
|
+
url: string
|
|
19
|
+
path?: string
|
|
20
|
+
prefix?: string
|
|
21
|
+
method: HttpMethod
|
|
22
|
+
pattern: RegExp
|
|
23
|
+
callback: RouteCallback | ActionPath | Action | Promise<any>
|
|
24
|
+
paramNames: string[]
|
|
25
|
+
middleware?: string | string[]
|
|
26
|
+
statusCode?: StatusCode
|
|
27
|
+
}
|
|
28
|
+
export declare interface ServeOptions {
|
|
29
|
+
host?: string
|
|
30
|
+
port?: number
|
|
31
|
+
debug?: boolean
|
|
32
|
+
timezone?: string
|
|
33
|
+
}
|
|
34
|
+
export declare interface Options {
|
|
35
|
+
statusCode?: StatusCode
|
|
36
|
+
}
|
|
37
|
+
export declare interface MiddlewareOptions {
|
|
38
|
+
name: string
|
|
39
|
+
description?: string
|
|
40
|
+
priority: number
|
|
41
|
+
handle: (request: Request) => Promise<void> | void
|
|
42
|
+
}
|
|
43
|
+
export declare interface RouteParam { [key: string]: string | number }
|
|
44
|
+
export declare interface Middlewares {
|
|
45
|
+
logger: MiddlewareFn
|
|
46
|
+
auth: MiddlewareFn
|
|
47
|
+
[key: string]: MiddlewareFn
|
|
48
|
+
}
|
|
49
|
+
export declare interface RouteGroupOptions {
|
|
50
|
+
prefix?: string
|
|
51
|
+
middleware?: Route['middleware']
|
|
52
|
+
}
|
|
53
|
+
export declare interface RouterInterface {
|
|
54
|
+
get: (url: Route['url'], callback: Route['callback']) => this
|
|
55
|
+
post: (url: Route['url'], callback: Route['callback']) => this
|
|
56
|
+
view: (url: Route['url'], callback: Route['callback']) => this
|
|
57
|
+
redirect: (url: Route['url'], callback: Route['callback'], status?: RedirectCode) => this
|
|
58
|
+
delete: (url: Route['url'], callback: Route['callback']) => this
|
|
59
|
+
patch: (url: Route['url'], callback: Route['callback']) => this
|
|
60
|
+
put: (url: Route['url'], callback: Route['callback']) => this
|
|
61
|
+
email: (url: Route['url']) => Promise<this>
|
|
62
|
+
health: () => Promise<this>
|
|
63
|
+
job: (url: Route['url']) => Promise<this>
|
|
64
|
+
action: (url: Route['url']) => Promise<this>
|
|
65
|
+
group: (options: Prefix | RouteGroupOptions, callback: () => void) => this
|
|
66
|
+
name: (name: string) => this
|
|
67
|
+
middleware: (middleware: Route['middleware']) => this
|
|
68
|
+
getRoutes: () => Promise<Route[]>
|
|
69
|
+
}
|
|
70
|
+
export declare interface RouterInstance {
|
|
71
|
+
query: any
|
|
72
|
+
params: RouteParams
|
|
73
|
+
headers: any
|
|
74
|
+
addQuery: (url: URL) => void
|
|
75
|
+
addBodies: (params: any) => void
|
|
76
|
+
addParam: (param: RouteParam) => void
|
|
77
|
+
addHeaders: (headerParams: Headers) => void
|
|
78
|
+
get: <K extends string>(element: K, defaultValue?: K extends NumericField ? number : string) => K extends NumericField ? number : string
|
|
79
|
+
all: () => any
|
|
80
|
+
validate: (attributes?: CustomAttributes) => Promise<void>
|
|
81
|
+
has: (element: string) => boolean
|
|
82
|
+
isEmpty: () => boolean
|
|
83
|
+
extractParamsFromRoute: (routePattern: string, pathname: string) => void
|
|
84
|
+
header: (headerParam: string) => string | number | boolean | null
|
|
85
|
+
getHeaders: () => any
|
|
86
|
+
Header: (headerParam: string) => string | number | boolean | null
|
|
87
|
+
getParam: <T>(key: string) => T
|
|
88
|
+
route: (key: string) => number | string | null
|
|
89
|
+
bearerToken: () => string | null | RouterAuthToken
|
|
90
|
+
getParams: () => RouteParams
|
|
91
|
+
getParamAsInt: (key: string) => number | null
|
|
92
|
+
browser: () => string | null
|
|
93
|
+
ip: () => string | null
|
|
94
|
+
ipForRateLimit: () => string | null
|
|
95
|
+
}
|
|
96
|
+
declare type Request = any;
|
|
97
|
+
declare type ActionPath = string;
|
|
98
|
+
// need to refactor before, after, view to be a part of some other type
|
|
99
|
+
export type RouteCallback = ((_params?: Record<string, any>) => any | string | object) | ((req: any, res: any) => Promise<void>);
|
|
100
|
+
export type RouterAuthToken = `${number}:${number}:${string}`;
|
|
101
|
+
export type NumericField = 'id' | 'age' | 'count' | 'quantity' | 'amount' | 'price' | 'total' | 'score' | 'rating' | 'duration' | 'size' | 'weight' | 'height' | 'width' | 'length' | 'distance' | 'speed' | 'temperature' | 'volume' | 'capacity' | 'density' | 'pressure' | 'force' | 'energy' | 'power' | 'frequency' | 'voltage' | 'current' | 'resistance' | 'time' | 'date' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond' | 'microsecond' | 'nanosecond';
|
|
102
|
+
export type StatusCode = 200 | 201 | 202 | 204 | 301 | 302 | 304 | 400 | 401 | 403 | 404 | 500;
|
|
103
|
+
export type RedirectCode = Extract<StatusCode, 301 | 302>;
|
|
104
|
+
export type MiddlewareFn = (_request: Request) => Promise<void>;
|
|
105
|
+
declare type Prefix = string;
|
package/dist/saas.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare interface SaasOption {
|
|
2
|
+
plans: {
|
|
3
|
+
productName: string
|
|
4
|
+
description: string
|
|
5
|
+
pricing: {
|
|
6
|
+
key: string
|
|
7
|
+
price: number
|
|
8
|
+
interval?: 'day' | 'month' | 'week' | 'year'
|
|
9
|
+
currency: string
|
|
10
|
+
}[]
|
|
11
|
+
metadata: {
|
|
12
|
+
createdBy: string
|
|
13
|
+
version: string
|
|
14
|
+
}
|
|
15
|
+
}[]
|
|
16
|
+
webhook: {
|
|
17
|
+
endpoint: string
|
|
18
|
+
secret: string
|
|
19
|
+
}
|
|
20
|
+
currencies: string[]
|
|
21
|
+
coupons: {
|
|
22
|
+
code: string
|
|
23
|
+
amountOff: number
|
|
24
|
+
duration: 'once' | 'repeating' | 'forever'
|
|
25
|
+
}[]
|
|
26
|
+
products: {
|
|
27
|
+
name: string
|
|
28
|
+
description: string
|
|
29
|
+
images: string[]
|
|
30
|
+
}[]
|
|
31
|
+
}
|
|
32
|
+
export type SaasConfig = Partial<SaasOption>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { Schedule } from '@stacksjs/scheduler';
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
import type { MaybePromise } from '.';
|
|
3
|
+
export type {
|
|
4
|
+
EnqueuedTask,
|
|
5
|
+
Hits,
|
|
6
|
+
Index,
|
|
7
|
+
IndexesResults,
|
|
8
|
+
IndexOptions,
|
|
9
|
+
Meilisearch,
|
|
10
|
+
MeilisearchOptions,
|
|
11
|
+
RecordOptions,
|
|
12
|
+
SearchParams,
|
|
13
|
+
SearchResponse,
|
|
14
|
+
};
|
|
15
|
+
// type Search = any
|
|
16
|
+
// type Page = any
|
|
17
|
+
// type Pages = Page[]
|
|
18
|
+
// type Filter = any
|
|
19
|
+
// type Filters = Filter[]
|
|
20
|
+
// type Result = any
|
|
21
|
+
// type Results = Result[]
|
|
22
|
+
// type SearchFilter = any
|
|
23
|
+
// type SearchFilters = SearchFilter[]
|
|
24
|
+
// type Sorts = any
|
|
25
|
+
// type Sort = any
|
|
26
|
+
export declare interface SearchEngineOptions {
|
|
27
|
+
driver: 'meilisearch' | 'algolia' | 'opensearch' | 'typesense'
|
|
28
|
+
opensearch?: {
|
|
29
|
+
host: string
|
|
30
|
+
protocol: number
|
|
31
|
+
port: number
|
|
32
|
+
auth: string
|
|
33
|
+
}
|
|
34
|
+
meilisearch?: {
|
|
35
|
+
host: string
|
|
36
|
+
protocol?: number
|
|
37
|
+
port?: number
|
|
38
|
+
auth?: string
|
|
39
|
+
apiKey: string
|
|
40
|
+
}
|
|
41
|
+
algolia?: {
|
|
42
|
+
appId: string
|
|
43
|
+
apiKey: string
|
|
44
|
+
searchOnlyApiKey?: string
|
|
45
|
+
}
|
|
46
|
+
typesense?: {
|
|
47
|
+
host?: string
|
|
48
|
+
port?: number
|
|
49
|
+
protocol?: string
|
|
50
|
+
apiKey?: string
|
|
51
|
+
}
|
|
52
|
+
filters?: {
|
|
53
|
+
[key: string]: string
|
|
54
|
+
}
|
|
55
|
+
perPage?: number
|
|
56
|
+
}
|
|
57
|
+
export declare interface SearchEngineDriver {
|
|
58
|
+
client: () => Meilisearch
|
|
59
|
+
resetClient?: () => void
|
|
60
|
+
search: (index: string, params: any) => Promise<SearchResponse<Record<string, any>>>
|
|
61
|
+
createIndex: (name: string, options?: IndexOptions) => MaybePromise<EnqueuedTask>
|
|
62
|
+
getIndex: (name: string) => Promise<Index<Record<string, any>>>
|
|
63
|
+
addDocument: (indexName: string, params: any) => Promise<EnqueuedTask>
|
|
64
|
+
updateDocuments: (indexName: string, params: DocumentOptions[]) => Promise<EnqueuedTask>
|
|
65
|
+
updateDocument: (indexName: string, params: DocumentOptions) => Promise<EnqueuedTask>
|
|
66
|
+
addDocuments: (indexName: string, params: any[]) => Promise<EnqueuedTask>
|
|
67
|
+
getDocument: (indexName: string, id: number, fields: any) => Promise<EnqueuedTask>
|
|
68
|
+
deleteDocument: (indexName: string, id: number) => Promise<EnqueuedTask>
|
|
69
|
+
deleteDocuments: (indexName: string, filters: string | string[]) => Promise<EnqueuedTask>
|
|
70
|
+
updateIndex: (name: string, options: IndexOptions) => MaybePromise<EnqueuedTask>
|
|
71
|
+
deleteIndex: (name: string) => MaybePromise<EnqueuedTask>
|
|
72
|
+
listAllIndexes: () => MaybePromise<IndexesResults<Index[]>>
|
|
73
|
+
listAllIndices: () => MaybePromise<IndexesResults<Index[]>>
|
|
74
|
+
getFilterableAttributes: (index: string) => Promise<string[]>
|
|
75
|
+
updateFilterableAttributes: (index: string, filterableAttributes: string[] | null) => Promise<EnqueuedTask>
|
|
76
|
+
resetFilterableAttributes: (index: string) => Promise<EnqueuedTask>
|
|
77
|
+
updateSearchableAttributes: (index: string, searchableAttributes: string[] | null) => Promise<EnqueuedTask>
|
|
78
|
+
resetSearchableAttributes: (index: string) => Promise<EnqueuedTask>
|
|
79
|
+
getSearchableAttributes: (index: string) => Promise<string[]>
|
|
80
|
+
updateSortableAttributes: (index: string, sortableAttributes: string[] | null) => Promise<EnqueuedTask>
|
|
81
|
+
resetSortableAttributes: (index: string) => Promise<EnqueuedTask>
|
|
82
|
+
getSortableAttributes: (index: string) => Promise<string[]>
|
|
83
|
+
updateDisplayedAttributes: (index: string, displayedAttributes: string[] | null) => Promise<EnqueuedTask>
|
|
84
|
+
getDisplayedAttributes: (index: string) => Promise<string[]>
|
|
85
|
+
resetDisplayedAttributes: (index: string) => Promise<EnqueuedTask>
|
|
86
|
+
getSettings: (index: string) => Promise<Settings>
|
|
87
|
+
updateSettings: (index: string, settings: Settings) => Promise<EnqueuedTask>
|
|
88
|
+
resetSettings: (index: string) => Promise<EnqueuedTask>
|
|
89
|
+
getPagination: (index: string) => Promise<PaginationSettings>
|
|
90
|
+
updatePagination: (index: string, pagination: PaginationSettings) => Promise<EnqueuedTask>
|
|
91
|
+
resetPagination: (index: string) => Promise<EnqueuedTask>
|
|
92
|
+
getSynonyms: (index: string) => Promise<any>
|
|
93
|
+
updateSynonyms: (index: string, synonyms: Synonyms) => Promise<EnqueuedTask>
|
|
94
|
+
resetSynonyms: (index: string) => Promise<EnqueuedTask>
|
|
95
|
+
getRankingRules: (index: string) => Promise<string[]>
|
|
96
|
+
updateRankingRules: (index: string, rankingRules: string[] | null) => Promise<EnqueuedTask>
|
|
97
|
+
resetRankingRules: (index: string) => Promise<EnqueuedTask>
|
|
98
|
+
getDistinctAttribute: (index: string) => Promise<string | null>
|
|
99
|
+
updateDistinctAttribute: (index: string, distinctAttribute: string | null) => Promise<EnqueuedTask>
|
|
100
|
+
resetDistinctAttribute: (index: string) => Promise<EnqueuedTask>
|
|
101
|
+
getFaceting: (index: string) => Promise<Faceting>
|
|
102
|
+
updateFaceting: (index: string, faceting: Faceting) => Promise<EnqueuedTask>
|
|
103
|
+
resetFaceting: (index: string) => Promise<EnqueuedTask>
|
|
104
|
+
getTypoTolerance: (index: string) => Promise<TypoTolerance>
|
|
105
|
+
updateTypoTolerance: (index: string, typoTolerance: TypoTolerance | null) => Promise<EnqueuedTask>
|
|
106
|
+
resetTypoTolerance: (index: string) => Promise<EnqueuedTask>
|
|
107
|
+
getDictionary: (index: string) => Promise<Dictionary>
|
|
108
|
+
updateDictionary: (index: string, dictionary: Dictionary | null) => Promise<EnqueuedTask>
|
|
109
|
+
resetDictionary: (index: string) => Promise<EnqueuedTask>
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* This interface is used to unify the persisting of data to localStorage
|
|
113
|
+
*/
|
|
114
|
+
export declare interface SearchEngineStorage {
|
|
115
|
+
index?: string
|
|
116
|
+
results?: SearchResponse
|
|
117
|
+
hits?: Hits
|
|
118
|
+
perPage: number
|
|
119
|
+
currentPage: number
|
|
120
|
+
}
|
|
121
|
+
export declare interface SearchOptions {
|
|
122
|
+
displayable: string[]
|
|
123
|
+
searchable: string[]
|
|
124
|
+
sortable: string[]
|
|
125
|
+
filterable: string[]
|
|
126
|
+
options?: SearchEngineOptions
|
|
127
|
+
denormalize?: Record<string, string>
|
|
128
|
+
}
|
|
129
|
+
export type SearchEngineConfig = Partial<SearchEngineOptions>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CountryCode } from './cloud';
|
|
2
|
+
import type { DeepPartial } from './utils';
|
|
3
|
+
export declare interface FirewallOptions {
|
|
4
|
+
enabled: boolean
|
|
5
|
+
countryCodes: CountryCode[]
|
|
6
|
+
ipAddresses: string[]
|
|
7
|
+
queryString: string[]
|
|
8
|
+
httpHeaders: string[]
|
|
9
|
+
rateLimitPerMinute: number
|
|
10
|
+
useIpReputationLists: boolean
|
|
11
|
+
useKnownBadInputsRuleSet: boolean
|
|
12
|
+
}
|
|
13
|
+
export declare interface SecurityOptions {
|
|
14
|
+
driver: 'aws'
|
|
15
|
+
firewall: FirewallOptions
|
|
16
|
+
}
|
|
17
|
+
export type FirewallConfig = Partial<FirewallOptions>;
|
|
18
|
+
export type SecurityConfig = DeepPartial<SecurityOptions>;
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
export declare interface ServicesOptions {
|
|
2
|
+
algolia?: {
|
|
3
|
+
appId: string
|
|
4
|
+
apiKey: string
|
|
5
|
+
}
|
|
6
|
+
aws?: {
|
|
7
|
+
accountId: string
|
|
8
|
+
appId: string
|
|
9
|
+
apiKey: string
|
|
10
|
+
region: string
|
|
11
|
+
}
|
|
12
|
+
github?: {
|
|
13
|
+
clientId: string
|
|
14
|
+
clientSecret: string
|
|
15
|
+
redirectUrl: string
|
|
16
|
+
scopes?: string[]
|
|
17
|
+
}
|
|
18
|
+
google?: {
|
|
19
|
+
clientId: string
|
|
20
|
+
clientSecret: string
|
|
21
|
+
redirectUrl: string
|
|
22
|
+
scopes?: string[]
|
|
23
|
+
}
|
|
24
|
+
apple?: {
|
|
25
|
+
clientId: string
|
|
26
|
+
teamId: string
|
|
27
|
+
keyId: string
|
|
28
|
+
privateKey: string
|
|
29
|
+
redirectUrl: string
|
|
30
|
+
scopes?: string[]
|
|
31
|
+
}
|
|
32
|
+
facebook?: {
|
|
33
|
+
clientId: string
|
|
34
|
+
clientSecret: string
|
|
35
|
+
redirectUrl: string
|
|
36
|
+
scopes?: string[]
|
|
37
|
+
}
|
|
38
|
+
twitter?: {
|
|
39
|
+
clientId: string
|
|
40
|
+
clientSecret: string
|
|
41
|
+
redirectUrl: string
|
|
42
|
+
scopes?: string[]
|
|
43
|
+
}
|
|
44
|
+
godaddy?: {
|
|
45
|
+
apiKey: string
|
|
46
|
+
apiSecret: string
|
|
47
|
+
}
|
|
48
|
+
hetzner: {
|
|
49
|
+
appId: string
|
|
50
|
+
apiKey: string
|
|
51
|
+
}
|
|
52
|
+
digitalOcean: {
|
|
53
|
+
appId: string
|
|
54
|
+
apiKey: string
|
|
55
|
+
}
|
|
56
|
+
mailgun?: {
|
|
57
|
+
apiKey?: string
|
|
58
|
+
domain?: string
|
|
59
|
+
endpoint?: string
|
|
60
|
+
maxRetries?: number
|
|
61
|
+
retryTimeout?: number
|
|
62
|
+
}
|
|
63
|
+
mailtrap?: {
|
|
64
|
+
token: string
|
|
65
|
+
host: string
|
|
66
|
+
inboxId?: string | number
|
|
67
|
+
maxRetries?: number
|
|
68
|
+
retryTimeout?: number
|
|
69
|
+
}
|
|
70
|
+
meilisearch?: {
|
|
71
|
+
appId: string
|
|
72
|
+
apiKey: string
|
|
73
|
+
}
|
|
74
|
+
sendgrid?: {
|
|
75
|
+
apiKey?: string
|
|
76
|
+
maxRetries?: number
|
|
77
|
+
retryTimeout?: number
|
|
78
|
+
}
|
|
79
|
+
ses?: {
|
|
80
|
+
region: string
|
|
81
|
+
credentials: {
|
|
82
|
+
accessKeyId?: string
|
|
83
|
+
secretAccessKey?: string
|
|
84
|
+
}
|
|
85
|
+
maxRetries?: number
|
|
86
|
+
retryTimeout?: number
|
|
87
|
+
}
|
|
88
|
+
smtp?: {
|
|
89
|
+
host: string
|
|
90
|
+
port: number
|
|
91
|
+
username?: string
|
|
92
|
+
password?: string
|
|
93
|
+
encryption?: 'tls' | 'ssl' | null
|
|
94
|
+
maxRetries?: number
|
|
95
|
+
retryTimeout?: number
|
|
96
|
+
}
|
|
97
|
+
slack?: {
|
|
98
|
+
appId?: string
|
|
99
|
+
clientId?: string
|
|
100
|
+
secretKey?: string
|
|
101
|
+
webhookUrl?: string
|
|
102
|
+
botToken?: string
|
|
103
|
+
maxRetries?: number
|
|
104
|
+
retryTimeout?: number
|
|
105
|
+
}
|
|
106
|
+
discord?: {
|
|
107
|
+
webhookUrl?: string
|
|
108
|
+
botToken?: string
|
|
109
|
+
maxRetries?: number
|
|
110
|
+
retryTimeout?: number
|
|
111
|
+
}
|
|
112
|
+
teams?: {
|
|
113
|
+
webhookUrl?: string
|
|
114
|
+
maxRetries?: number
|
|
115
|
+
retryTimeout?: number
|
|
116
|
+
}
|
|
117
|
+
expo?: {
|
|
118
|
+
accessToken?: string
|
|
119
|
+
}
|
|
120
|
+
fcm?: {
|
|
121
|
+
serverKey?: string
|
|
122
|
+
projectId?: string
|
|
123
|
+
clientEmail?: string
|
|
124
|
+
privateKey?: string
|
|
125
|
+
}
|
|
126
|
+
openai?: {
|
|
127
|
+
apiKey?: string
|
|
128
|
+
model?: string
|
|
129
|
+
embeddingModel?: string
|
|
130
|
+
baseUrl?: string
|
|
131
|
+
}
|
|
132
|
+
anthropic?: {
|
|
133
|
+
apiKey?: string
|
|
134
|
+
model?: string
|
|
135
|
+
maxTokens?: number
|
|
136
|
+
}
|
|
137
|
+
ollama?: {
|
|
138
|
+
host?: string
|
|
139
|
+
model?: string
|
|
140
|
+
embeddingModel?: string
|
|
141
|
+
}
|
|
142
|
+
stripe?: {
|
|
143
|
+
secretKey?: string
|
|
144
|
+
publicKey?: string
|
|
145
|
+
webhookSecret?: string
|
|
146
|
+
apiVersion?: string
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export type ServicesConfig = Partial<ServicesOptions>;
|
package/dist/sms.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export declare interface SmsMessage {
|
|
2
|
+
to: string | string[]
|
|
3
|
+
body: string
|
|
4
|
+
from?: string
|
|
5
|
+
mediaUrls?: string[]
|
|
6
|
+
statusCallback?: string
|
|
7
|
+
options?: Record<string, unknown>
|
|
8
|
+
}
|
|
9
|
+
export declare interface SmsSendResult {
|
|
10
|
+
success: boolean
|
|
11
|
+
messageId?: string
|
|
12
|
+
status?: SmsStatus
|
|
13
|
+
to: string
|
|
14
|
+
error?: string
|
|
15
|
+
provider: SmsProvider
|
|
16
|
+
segments?: number
|
|
17
|
+
price?: number
|
|
18
|
+
currency?: string
|
|
19
|
+
}
|
|
20
|
+
export declare interface SmsStatusUpdate {
|
|
21
|
+
messageId: string
|
|
22
|
+
to: string
|
|
23
|
+
status: SmsStatus
|
|
24
|
+
timestamp: Date
|
|
25
|
+
errorCode?: string
|
|
26
|
+
errorMessage?: string
|
|
27
|
+
}
|
|
28
|
+
// =============================================================================
|
|
29
|
+
// Provider Configurations
|
|
30
|
+
// =============================================================================
|
|
31
|
+
export declare interface TwilioConfig {
|
|
32
|
+
accountSid: string
|
|
33
|
+
authToken: string
|
|
34
|
+
from?: string
|
|
35
|
+
messagingServiceSid?: string
|
|
36
|
+
statusCallback?: string
|
|
37
|
+
}
|
|
38
|
+
export declare interface VonageConfig {
|
|
39
|
+
apiKey: string
|
|
40
|
+
apiSecret: string
|
|
41
|
+
from?: string
|
|
42
|
+
applicationId?: string
|
|
43
|
+
privateKey?: string
|
|
44
|
+
}
|
|
45
|
+
export declare interface AwsSmsConfig {
|
|
46
|
+
region: string
|
|
47
|
+
accessKeyId?: string
|
|
48
|
+
secretAccessKey?: string
|
|
49
|
+
senderId?: string
|
|
50
|
+
originationNumber?: string
|
|
51
|
+
}
|
|
52
|
+
// =============================================================================
|
|
53
|
+
// SMS Options (Main Config)
|
|
54
|
+
// =============================================================================
|
|
55
|
+
export declare interface SmsTemplateConfig {
|
|
56
|
+
name: string
|
|
57
|
+
body: string
|
|
58
|
+
variables?: string[]
|
|
59
|
+
}
|
|
60
|
+
export declare interface SmsOptOutConfig {
|
|
61
|
+
enabled: boolean
|
|
62
|
+
keywords: string[]
|
|
63
|
+
}
|
|
64
|
+
export declare interface SmsTwoWayConfig {
|
|
65
|
+
enabled: boolean
|
|
66
|
+
webhookUrl?: string
|
|
67
|
+
snsTopicArn?: string
|
|
68
|
+
}
|
|
69
|
+
export declare interface SmsInboxConfig {
|
|
70
|
+
enabled: boolean
|
|
71
|
+
bucket: string
|
|
72
|
+
prefix?: string
|
|
73
|
+
retentionDays?: number
|
|
74
|
+
}
|
|
75
|
+
export declare interface SmsOptions {
|
|
76
|
+
enabled: boolean
|
|
77
|
+
provider: SmsProvider
|
|
78
|
+
from?: string
|
|
79
|
+
defaultCountryCode?: string
|
|
80
|
+
messageType?: 'TRANSACTIONAL' | 'PROMOTIONAL'
|
|
81
|
+
drivers: {
|
|
82
|
+
twilio?: TwilioConfig
|
|
83
|
+
vonage?: VonageConfig
|
|
84
|
+
pinpoint?: AwsSmsConfig
|
|
85
|
+
sns?: AwsSmsConfig
|
|
86
|
+
}
|
|
87
|
+
optOut?: SmsOptOutConfig
|
|
88
|
+
twoWay?: SmsTwoWayConfig
|
|
89
|
+
templates?: SmsTemplateConfig[]
|
|
90
|
+
inbox?: SmsInboxConfig
|
|
91
|
+
maxSpendPerMonth?: number
|
|
92
|
+
}
|
|
93
|
+
// =============================================================================
|
|
94
|
+
// SMS Driver Interface
|
|
95
|
+
// =============================================================================
|
|
96
|
+
export declare interface SmsDriver {
|
|
97
|
+
send(message: SmsMessage): Promise<SmsSendResult>
|
|
98
|
+
sendBulk(messages: SmsMessage[]): Promise<SmsSendResult[]>
|
|
99
|
+
getStatus?(messageId: string): Promise<SmsStatusUpdate>
|
|
100
|
+
verify?(phoneNumber: string): Promise<{ valid: boolean, carrier?: string, type?: string }>
|
|
101
|
+
getBalance?(): Promise<{ balance: number, currency: string }>
|
|
102
|
+
}
|
|
103
|
+
// =============================================================================
|
|
104
|
+
// Verification Types (for 2FA/OTP)
|
|
105
|
+
// =============================================================================
|
|
106
|
+
export declare interface VerificationRequest {
|
|
107
|
+
to: string
|
|
108
|
+
channel?: 'sms' | 'call' | 'whatsapp'
|
|
109
|
+
codeLength?: number
|
|
110
|
+
locale?: string
|
|
111
|
+
customMessage?: string
|
|
112
|
+
}
|
|
113
|
+
export declare interface VerificationResult {
|
|
114
|
+
success: boolean
|
|
115
|
+
verificationId?: string
|
|
116
|
+
status: 'pending' | 'approved' | 'denied' | 'expired'
|
|
117
|
+
error?: string
|
|
118
|
+
}
|
|
119
|
+
export declare interface VerificationCheckRequest {
|
|
120
|
+
verificationId?: string
|
|
121
|
+
to: string
|
|
122
|
+
code: string
|
|
123
|
+
}
|
|
124
|
+
export declare interface SmsVerificationDriver {
|
|
125
|
+
startVerification(request: VerificationRequest): Promise<VerificationResult>
|
|
126
|
+
checkVerification(request: VerificationCheckRequest): Promise<VerificationResult>
|
|
127
|
+
cancelVerification?(verificationId: string): Promise<boolean>
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* SMS Service Configuration Types
|
|
131
|
+
* Supports Twilio, Vonage, and AWS providers
|
|
132
|
+
*/
|
|
133
|
+
// =============================================================================
|
|
134
|
+
// Core SMS Types
|
|
135
|
+
// =============================================================================
|
|
136
|
+
export type SmsProvider = 'twilio' | 'vonage' | 'pinpoint' | 'sns';
|
|
137
|
+
export type SmsStatus = | 'queued'
|
|
138
|
+
| 'sending'
|
|
139
|
+
| 'sent'
|
|
140
|
+
| 'delivered'
|
|
141
|
+
| 'failed'
|
|
142
|
+
| 'undelivered'
|
|
143
|
+
| 'unknown';
|
|
144
|
+
export type SmsConfig = Partial<SmsOptions>;
|