@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.
- package/package.json +19 -5
- package/dist/ai.d.ts +0 -37
- package/dist/analytics.d.ts +0 -36
- package/dist/api.d.ts +0 -26
- package/dist/app.d.ts +0 -28
- package/dist/attributes.d.ts +0 -1
- package/dist/auth.d.ts +0 -56
- package/dist/auto-imports.d.ts +0 -8
- package/dist/binary.d.ts +0 -11
- package/dist/cache.d.ts +0 -88
- package/dist/cdn.d.ts +0 -4
- package/dist/chat.d.ts +0 -69
- package/dist/cli.d.ts +0 -316
- package/dist/cloud.d.ts +0 -366
- package/dist/cms.d.ts +0 -12
- package/dist/commerce.d.ts +0 -14
- package/dist/components.d.ts +0 -9
- package/dist/configure.d.ts +0 -12
- package/dist/cors.d.ts +0 -47
- package/dist/cron-jobs.d.ts +0 -61
- package/dist/dashboard.d.ts +0 -108
- package/dist/database.d.ts +0 -76
- package/dist/dependencies.d.ts +0 -17
- package/dist/deploy.d.ts +0 -16
- package/dist/dns.d.ts +0 -362
- package/dist/docs.d.ts +0 -23
- package/dist/email.d.ts +0 -207
- package/dist/env.d.ts +0 -1
- package/dist/errors.d.ts +0 -84
- package/dist/events.d.ts +0 -31
- package/dist/exit-code.d.ts +0 -10
- package/dist/file-systems.d.ts +0 -60
- package/dist/git.d.ts +0 -60
- package/dist/hashing.d.ts +0 -57
- package/dist/helpers.d.ts +0 -1
- package/dist/i18n.d.ts +0 -65
- package/dist/index.d.ts +0 -79
- package/dist/index.js +0 -2
- package/dist/library.d.ts +0 -799
- package/dist/logging.d.ts +0 -15
- package/dist/manifest.d.ts +0 -9
- package/dist/marketing.d.ts +0 -12
- package/dist/model-dashboard-augmentation.d.ts +0 -8
- package/dist/model-names.d.ts +0 -1
- package/dist/model.d.ts +0 -256
- package/dist/monitoring.d.ts +0 -12
- package/dist/notifications.d.ts +0 -126
- package/dist/oauth.d.ts +0 -290
- package/dist/pages.d.ts +0 -10
- package/dist/payments.d.ts +0 -322
- package/dist/phone.d.ts +0 -65
- package/dist/ports.d.ts +0 -20
- package/dist/promise.d.ts +0 -1
- package/dist/push.d.ts +0 -108
- package/dist/queue.d.ts +0 -312
- package/dist/reactivity.d.ts +0 -1
- package/dist/realtime.d.ts +0 -443
- package/dist/request.d.ts +0 -265
- package/dist/response.d.ts +0 -15
- package/dist/router.d.ts +0 -105
- package/dist/saas.d.ts +0 -32
- package/dist/scheduler.d.ts +0 -1
- package/dist/search-engine.d.ts +0 -129
- package/dist/security.d.ts +0 -18
- package/dist/server.d.ts +0 -16
- package/dist/services.d.ts +0 -149
- package/dist/settings-config.d.ts +0 -9
- package/dist/sms.d.ts +0 -144
- package/dist/stack-extensions.d.ts +0 -137
- package/dist/stacks.d.ts +0 -45
- package/dist/storage.d.ts +0 -104
- package/dist/table-names.d.ts +0 -1
- package/dist/tables.d.ts +0 -34
- package/dist/team.d.ts +0 -7
- package/dist/ui.d.ts +0 -55
- package/dist/utils.d.ts +0 -39
- package/src/ai.ts +0 -41
- package/src/analytics.ts +0 -58
- package/src/api.ts +0 -77
- package/src/app.ts +0 -189
- package/src/attributes.ts +0 -5
- package/src/auth.ts +0 -161
- package/src/auto-imports.ts +0 -8
- package/src/binary.ts +0 -13
- package/src/cache.ts +0 -325
- package/src/cdn.ts +0 -17
- package/src/chat.ts +0 -193
- package/src/cli.ts +0 -445
- package/src/cloud.ts +0 -381
- package/src/cms.ts +0 -14
- package/src/commerce.ts +0 -18
- package/src/components.ts +0 -62
- package/src/configure.ts +0 -13
- package/src/cors.ts +0 -86
- package/src/cron-jobs.ts +0 -146
- package/src/dashboard.ts +0 -218
- package/src/database.ts +0 -117
- package/src/dependencies.ts +0 -69
- package/src/deploy.ts +0 -17
- package/src/dns.ts +0 -470
- package/src/docs.ts +0 -27
- package/src/email.ts +0 -511
- package/src/env.ts +0 -1
- package/src/errors.ts +0 -110
- package/src/events.ts +0 -37
- package/src/exit-code.ts +0 -10
- package/src/file-systems.ts +0 -70
- package/src/git.ts +0 -133
- package/src/hashing.ts +0 -127
- package/src/helpers.ts +0 -9
- package/src/i18n.ts +0 -121
- package/src/index.ts +0 -80
- package/src/library.ts +0 -911
- package/src/logging.ts +0 -62
- package/src/manifest.ts +0 -9
- package/src/marketing.ts +0 -14
- package/src/model-dashboard-augmentation.ts +0 -51
- package/src/model-names.ts +0 -1
- package/src/model.ts +0 -353
- package/src/monitoring.ts +0 -14
- package/src/native.ts +0 -0
- package/src/notifications.ts +0 -153
- package/src/oauth.ts +0 -488
- package/src/pages.ts +0 -10
- package/src/payments.ts +0 -440
- package/src/phone.ts +0 -78
- package/src/ports.ts +0 -20
- package/src/promise.ts +0 -1
- package/src/push.ts +0 -143
- package/src/queue.ts +0 -413
- package/src/reactivity.ts +0 -1
- package/src/realtime.ts +0 -584
- package/src/request.ts +0 -541
- package/src/response.ts +0 -16
- package/src/router.ts +0 -124
- package/src/saas.ts +0 -33
- package/src/scheduler.ts +0 -1
- package/src/search-engine.ts +0 -251
- package/src/security.ts +0 -23
- package/src/server.ts +0 -16
- package/src/services.ts +0 -211
- package/src/settings-config.ts +0 -10
- package/src/sms.ts +0 -265
- package/src/stack-extensions.ts +0 -184
- package/src/stacks.ts +0 -339
- package/src/storage.ts +0 -173
- package/src/table-names.ts +0 -1
- package/src/tables.ts +0 -57
- package/src/team.ts +0 -8
- package/src/ui.ts +0 -197
- package/src/utils.ts +0 -46
package/src/app.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
export type AppEnvType = 'local' | 'dev' | 'stage' | 'prod' | 'testing' | string
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* **Application Options**
|
|
5
|
-
*
|
|
6
|
-
* This configuration defines all of your application options. Because Stacks is fully-typed,
|
|
7
|
-
* you may hover any of the options below and the definitions will be provided. In case
|
|
8
|
-
* you have any questions, feel free to reach out via Discord or GitHub Discussions.
|
|
9
|
-
*/
|
|
10
|
-
export interface AppOptions {
|
|
11
|
-
/**
|
|
12
|
-
* **Application Name**
|
|
13
|
-
*
|
|
14
|
-
* This value is the name of your application. This value is used when the
|
|
15
|
-
* framework needs to place the application's name in a log or any
|
|
16
|
-
* other location as required by the application or its packages.
|
|
17
|
-
*
|
|
18
|
-
* @default string "Stacks"
|
|
19
|
-
*/
|
|
20
|
-
name: string
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* **Application Description**
|
|
24
|
-
*
|
|
25
|
-
* This value is the description of your application. This value is used when the
|
|
26
|
-
* framework generates meta tags for the frontend.
|
|
27
|
-
*/
|
|
28
|
-
description: string
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* **Application Environment**
|
|
32
|
-
*
|
|
33
|
-
* This value determines the "environment" your application is currently
|
|
34
|
-
* running in. This may determine how you prefer to configure various
|
|
35
|
-
* services the application utilizes. Set this in your ".env" file
|
|
36
|
-
*
|
|
37
|
-
* @default "local"
|
|
38
|
-
*/
|
|
39
|
-
env: AppEnvType
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* **Application URL**
|
|
43
|
-
*
|
|
44
|
-
* This URL is used by the console to properly generate URLs when using
|
|
45
|
-
* the Buddy command line tool. You should set this to the root of
|
|
46
|
-
* your application so that it is used when running Buddy tasks.
|
|
47
|
-
*
|
|
48
|
-
* @default string "stacks.localhost"
|
|
49
|
-
* @example "my-project.test"
|
|
50
|
-
*/
|
|
51
|
-
url: string
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* **Redirect URLs**
|
|
55
|
-
*
|
|
56
|
-
* A Redirect URL is a URL that permanently redirects to the Application URL.
|
|
57
|
-
* This is useful for when you have multiple domains that you want to redirect
|
|
58
|
-
* to your application. You can set this to a string or an array of strings.
|
|
59
|
-
*
|
|
60
|
-
* @default []
|
|
61
|
-
* @example "['stacksjs.com', 'stacksjs.dev']"
|
|
62
|
-
*/
|
|
63
|
-
redirectUrls: string | string[]
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* **Application Debug Mode**
|
|
67
|
-
*
|
|
68
|
-
* When your application is in debug mode, detailed error messages with
|
|
69
|
-
* stack traces will be shown on every error that occurs within your
|
|
70
|
-
* application. If disabled, a simple generic error page is shown.
|
|
71
|
-
*
|
|
72
|
-
* @default true
|
|
73
|
-
*/
|
|
74
|
-
debug: boolean
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* **Maintenance Mode**
|
|
78
|
-
*
|
|
79
|
-
* When your application is in maintenance mode, a simple maintenance
|
|
80
|
-
* page will be shown on every request into your application.
|
|
81
|
-
*
|
|
82
|
-
* @default false
|
|
83
|
-
*/
|
|
84
|
-
maintenanceMode: boolean
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* **Coming Soon Mode**
|
|
88
|
-
*
|
|
89
|
-
* When enabled, public web requests can render a launch screen while
|
|
90
|
-
* optionally allowing preview access through a secret bypass.
|
|
91
|
-
*
|
|
92
|
-
* @default false
|
|
93
|
-
*/
|
|
94
|
-
comingSoonMode?: boolean
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* **Coming Soon Secret**
|
|
98
|
-
*
|
|
99
|
-
* Optional preview token used to bypass coming soon mode.
|
|
100
|
-
*/
|
|
101
|
-
comingSoonSecret?: string
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* **Encryption Key**
|
|
105
|
-
*
|
|
106
|
-
* This key is used by the Stacks encrypter service and should be set to
|
|
107
|
-
* a random, 32 character string, otherwise these encrypted strings will
|
|
108
|
-
* not be safe. Please do this before deploying an application!
|
|
109
|
-
*/
|
|
110
|
-
key: string
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* **Application Timezone**
|
|
114
|
-
*
|
|
115
|
-
* Here you may specify the default timezone for your application, which
|
|
116
|
-
* will be used by Stacks and date-time functions. We have gone ahead
|
|
117
|
-
* and set this to a sensible default for you out of the box.
|
|
118
|
-
*
|
|
119
|
-
* @default string "UTC"
|
|
120
|
-
*/
|
|
121
|
-
timezone: string
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* **Application Locale Configuration**
|
|
125
|
-
*
|
|
126
|
-
* The application locale determines the default locale that will be used
|
|
127
|
-
* by the translation service provider. You are free to set this value
|
|
128
|
-
* to any of the locales which will be supported by the application.
|
|
129
|
-
*
|
|
130
|
-
* @default string "en"
|
|
131
|
-
* @example
|
|
132
|
-
* de // ./lang/de.yml needs to be present for this
|
|
133
|
-
*/
|
|
134
|
-
locale: string
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* **Application Fallback Locale**
|
|
138
|
-
*
|
|
139
|
-
* The fallback locale determines the locale to use when the current one
|
|
140
|
-
* is not available. You may change the value to correspond to any of
|
|
141
|
-
* the language folders that are provided through your application.
|
|
142
|
-
*
|
|
143
|
-
* @default string "en"
|
|
144
|
-
*/
|
|
145
|
-
fallbackLocale: 'en'
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* **Cipher**
|
|
149
|
-
*
|
|
150
|
-
* Description WIP.
|
|
151
|
-
*
|
|
152
|
-
* @default string "aes-256-cbc"
|
|
153
|
-
*/
|
|
154
|
-
cipher: string
|
|
155
|
-
|
|
156
|
-
// inspect: <InspectOptions>{},
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* **Documentation Mode**
|
|
160
|
-
*
|
|
161
|
-
* $appUrl becomes your Documentation URL.
|
|
162
|
-
*
|
|
163
|
-
* @default false
|
|
164
|
-
*/
|
|
165
|
-
docMode: boolean
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* **Primary Brand Color**
|
|
169
|
-
*
|
|
170
|
-
* The primary color used for branding in emails and UI components.
|
|
171
|
-
* Should be a valid CSS color value (hex, rgb, etc.)
|
|
172
|
-
*
|
|
173
|
-
* @default "#3b82f6"
|
|
174
|
-
* @example "#3b82f6"
|
|
175
|
-
*/
|
|
176
|
-
primaryColor: string
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* **Support Email**
|
|
180
|
-
*
|
|
181
|
-
* The email address users should contact for support.
|
|
182
|
-
* Used in transactional emails and error messages.
|
|
183
|
-
*
|
|
184
|
-
* @example "support@example.com"
|
|
185
|
-
*/
|
|
186
|
-
supportEmail: string
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export type AppConfig = Partial<AppOptions>
|
package/src/attributes.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Project-generated `Attributes` interface lives at
|
|
2
|
-
// `storage/framework/types/attributes.ts` (one big union of every model's
|
|
3
|
-
// fillable column). Re-export type-only so Bun's runtime resolver doesn't
|
|
4
|
-
// try to load the file from the shipped `@stacksjs/types` package.
|
|
5
|
-
export type * from '../../../types/attributes'
|
package/src/auth.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
export interface AuthOptions {
|
|
2
|
-
/**
|
|
3
|
-
* Top-level feature gate. When `false`, the auth feature is inert at boot
|
|
4
|
-
* (no token/password-reset/email-verification flows wired up). Missing or
|
|
5
|
-
* `true` means auth is on.
|
|
6
|
-
*/
|
|
7
|
-
enabled?: boolean
|
|
8
|
-
/** Optional deploy-target gate, e.g. `['production']`. */
|
|
9
|
-
env?: string[]
|
|
10
|
-
/**
|
|
11
|
-
* The default authentication guard to use
|
|
12
|
-
*/
|
|
13
|
-
default: string
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The authentication guards available
|
|
17
|
-
*/
|
|
18
|
-
guards: {
|
|
19
|
-
[key: string]: {
|
|
20
|
-
/**
|
|
21
|
-
* The authentication driver to use
|
|
22
|
-
*/
|
|
23
|
-
driver: 'session' | 'token'
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The authentication provider to use
|
|
27
|
-
*/
|
|
28
|
-
provider: string
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The authentication providers available
|
|
34
|
-
*/
|
|
35
|
-
providers: {
|
|
36
|
-
[key: string]: {
|
|
37
|
-
/**
|
|
38
|
-
* The database driver to use
|
|
39
|
-
*/
|
|
40
|
-
driver: 'database'
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The database table to use
|
|
44
|
-
*/
|
|
45
|
-
table: string
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The username field used for authentication
|
|
51
|
-
*/
|
|
52
|
-
username: string
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The password field used for authentication
|
|
56
|
-
*/
|
|
57
|
-
password: string
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The access-token expiry time in milliseconds. Defaults to 1 hour —
|
|
61
|
-
* the matching refresh token below covers the longer-lived window.
|
|
62
|
-
*/
|
|
63
|
-
tokenExpiry: number
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The refresh-token expiry time in milliseconds. Defaults to 30 days.
|
|
67
|
-
* Refresh tokens are single-use and rotate on every refresh exchange.
|
|
68
|
-
*/
|
|
69
|
-
refreshTokenExpiry?: number
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The token rotation time in hours
|
|
73
|
-
*/
|
|
74
|
-
tokenRotation: number
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The token abilities that are granted by default
|
|
78
|
-
*/
|
|
79
|
-
defaultAbilities: string[]
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* The token name used when creating new tokens
|
|
83
|
-
*/
|
|
84
|
-
defaultTokenName: string
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Password reset configuration
|
|
88
|
-
*/
|
|
89
|
-
passwordReset: {
|
|
90
|
-
/**
|
|
91
|
-
* Token expiration time in minutes
|
|
92
|
-
* @default 60
|
|
93
|
-
*/
|
|
94
|
-
expire: number
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Throttle time in seconds between password reset requests
|
|
98
|
-
* @default 60
|
|
99
|
-
*/
|
|
100
|
-
throttle: number
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Reset-link URL template. Supports `{token}` and `{email}`
|
|
104
|
-
* placeholders. Absolute templates (`https://…`) are used as-is;
|
|
105
|
-
* path templates are prefixed with the app URL. Lets apps whose
|
|
106
|
-
* reset page lives on a custom route reuse `passwordResets().sendEmail()`
|
|
107
|
-
* instead of hand-rolling the send.
|
|
108
|
-
* @default '/password/reset/{token}?email={email}'
|
|
109
|
-
*/
|
|
110
|
-
url?: string
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Email verification configuration
|
|
115
|
-
*/
|
|
116
|
-
emailVerification?: {
|
|
117
|
-
/**
|
|
118
|
-
* Token expiration time in minutes
|
|
119
|
-
* @default 60
|
|
120
|
-
*/
|
|
121
|
-
expire?: number
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Verification-link URL template. Supports `{id}` and `{token}`
|
|
125
|
-
* placeholders. Absolute templates (`https://…`) are used as-is;
|
|
126
|
-
* path templates are prefixed with the app URL. Lets apps whose
|
|
127
|
-
* verify page lives on a custom route reuse `sendVerificationEmail()`
|
|
128
|
-
* instead of hand-rolling the send.
|
|
129
|
-
* @default '/verify-email/{id}/{token}'
|
|
130
|
-
*/
|
|
131
|
-
url?: string
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export type AuthConfig = Partial<AuthOptions>
|
|
136
|
-
|
|
137
|
-
export interface AuthInstance {
|
|
138
|
-
guard: string
|
|
139
|
-
provider: string
|
|
140
|
-
user?: any
|
|
141
|
-
token?: string
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export type GuardType = 'session' | 'token'
|
|
145
|
-
export type ProviderType = 'database'
|
|
146
|
-
|
|
147
|
-
export interface AuthDriver {
|
|
148
|
-
attempt: (credentials: any) => Promise<boolean>
|
|
149
|
-
validate: (token: string) => Promise<boolean>
|
|
150
|
-
login: (credentials: any) => Promise<{ token: string } | null>
|
|
151
|
-
logout: () => Promise<void>
|
|
152
|
-
user: () => Promise<any>
|
|
153
|
-
token: () => string | null
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export interface Authenticatable {
|
|
157
|
-
getAuthIdentifier: () => any
|
|
158
|
-
getAuthPassword: () => string
|
|
159
|
-
getRememberToken: () => string
|
|
160
|
-
setRememberToken: (token: string) => void
|
|
161
|
-
}
|
package/src/auto-imports.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// `unplugin-auto-import` isn't a runtime dependency of @stacksjs/types — we
|
|
2
|
-
// only re-publish its option shape so users get autocomplete in user-land
|
|
3
|
-
// configs. The local type intentionally mirrors the upstream `Options`
|
|
4
|
-
// surface as an open record; if/when this package adopts unplugin-auto-import
|
|
5
|
-
// as a real dependency, swap this for `import type { Options }` from there.
|
|
6
|
-
export interface AutoImportsOptions {
|
|
7
|
-
[key: string]: unknown
|
|
8
|
-
}
|
package/src/binary.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Binary/CLI Options used in `./config/cli.ts`.
|
|
3
|
-
*/
|
|
4
|
-
export interface BinaryOptions {
|
|
5
|
-
name: string
|
|
6
|
-
command: string
|
|
7
|
-
description: string
|
|
8
|
-
source: string
|
|
9
|
-
deploy: boolean
|
|
10
|
-
// path: string // TODO: add this for a configurable path where the commands are located
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type BinaryConfig = Partial<BinaryOptions>
|
package/src/cache.ts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Options - Configuration for the caching system
|
|
3
|
-
*/
|
|
4
|
-
export interface CacheOptions {
|
|
5
|
-
/**
|
|
6
|
-
* **Cache Driver**
|
|
7
|
-
*
|
|
8
|
-
* The cache driver that will be used by your application to store
|
|
9
|
-
* cached data. Supports 'memory', 'redis', and 'singlestore' drivers.
|
|
10
|
-
*
|
|
11
|
-
* The 'singlestore' driver persists cache entries in a SingleStore
|
|
12
|
-
* rowstore table (with epoch-based TTL) — useful when you want a single
|
|
13
|
-
* SingleStore cluster to back both your primary data and your cache.
|
|
14
|
-
*
|
|
15
|
-
* @default "memory"
|
|
16
|
-
*/
|
|
17
|
-
driver: 'memory' | 'redis' | 'singlestore'
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* **Cache Prefix**
|
|
21
|
-
*
|
|
22
|
-
* The prefix used when storing items in the cache. Useful when
|
|
23
|
-
* multiple applications share the same cache driver.
|
|
24
|
-
*
|
|
25
|
-
* @default "stacks"
|
|
26
|
-
*/
|
|
27
|
-
prefix: string
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* **Cache TTL**
|
|
31
|
-
*
|
|
32
|
-
* Default time to live for items stored in the cache (in seconds).
|
|
33
|
-
* Use 0 for no expiration.
|
|
34
|
-
*
|
|
35
|
-
* @default 3600
|
|
36
|
-
*/
|
|
37
|
-
ttl: number
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* **Max Keys**
|
|
41
|
-
*
|
|
42
|
-
* Maximum number of keys to store in the cache.
|
|
43
|
-
* Use -1 for unlimited.
|
|
44
|
-
*
|
|
45
|
-
* @default -1
|
|
46
|
-
*/
|
|
47
|
-
maxKeys?: number
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* **Use Clones**
|
|
51
|
-
*
|
|
52
|
-
* Whether to clone values when getting/setting.
|
|
53
|
-
* Disable for better performance with immutable data.
|
|
54
|
-
*
|
|
55
|
-
* @default true
|
|
56
|
-
*/
|
|
57
|
-
useClones?: boolean
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* **Driver-specific configurations**
|
|
61
|
-
*/
|
|
62
|
-
drivers: {
|
|
63
|
-
redis?: {
|
|
64
|
-
/**
|
|
65
|
-
* Redis connection URL
|
|
66
|
-
* @example "redis://localhost:6379"
|
|
67
|
-
*/
|
|
68
|
-
url?: string
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Redis Host
|
|
72
|
-
* @default "localhost"
|
|
73
|
-
*/
|
|
74
|
-
host: string
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Redis Port
|
|
78
|
-
* @default 6379
|
|
79
|
-
*/
|
|
80
|
-
port: number
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Redis Username
|
|
84
|
-
*/
|
|
85
|
-
username?: string
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Redis Password
|
|
89
|
-
*/
|
|
90
|
-
password?: string
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Redis Database number
|
|
94
|
-
* @default 0
|
|
95
|
-
*/
|
|
96
|
-
database?: number
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Enable TLS
|
|
100
|
-
* @default false
|
|
101
|
-
*/
|
|
102
|
-
tls?: boolean
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
memory?: {
|
|
106
|
-
/**
|
|
107
|
-
* Maximum number of keys
|
|
108
|
-
* @default -1
|
|
109
|
-
*/
|
|
110
|
-
maxKeys?: number
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Check period for expired keys (in seconds)
|
|
114
|
-
* @default 600
|
|
115
|
-
*/
|
|
116
|
-
checkPeriod?: number
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Delete keys on expire
|
|
120
|
-
* @default true
|
|
121
|
-
*/
|
|
122
|
-
deleteOnExpire?: boolean
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
singlestore?: {
|
|
126
|
-
/**
|
|
127
|
-
* SingleStore host (MySQL wire protocol)
|
|
128
|
-
* @default "127.0.0.1"
|
|
129
|
-
*/
|
|
130
|
-
host?: string
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* SingleStore port
|
|
134
|
-
* @default 3306
|
|
135
|
-
*/
|
|
136
|
-
port?: number
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* SingleStore username
|
|
140
|
-
* @default "root"
|
|
141
|
-
*/
|
|
142
|
-
username?: string
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* SingleStore password
|
|
146
|
-
*/
|
|
147
|
-
password?: string
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Database that holds the cache table
|
|
151
|
-
* @default "stacks"
|
|
152
|
-
*/
|
|
153
|
-
database?: string
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Table used to store cache entries
|
|
157
|
-
* @default "stacks_cache"
|
|
158
|
-
*/
|
|
159
|
-
table?: string
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Enable TLS (required by managed SingleStore / Helios)
|
|
163
|
-
* @default false
|
|
164
|
-
*/
|
|
165
|
-
ssl?: boolean
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export type CacheConfig = Partial<CacheOptions>
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Cache Driver Interface - Defines the API for all cache implementations
|
|
174
|
-
*/
|
|
175
|
-
export interface CacheDriver {
|
|
176
|
-
/**
|
|
177
|
-
* Get a cached value
|
|
178
|
-
*/
|
|
179
|
-
get: <T>(key: string) => Promise<T | undefined>
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Get multiple cached values
|
|
183
|
-
*/
|
|
184
|
-
mget: <T>(keys: string[]) => Promise<Record<string, T>>
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Set a cached value with optional TTL (in seconds)
|
|
188
|
-
*/
|
|
189
|
-
set: <T>(key: string, value: T, ttl?: number) => Promise<boolean>
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Set multiple cached values
|
|
193
|
-
*/
|
|
194
|
-
mset: <T>(entries: Array<{ key: string, value: T, ttl?: number }>) => Promise<boolean>
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Set a cached value that never expires
|
|
198
|
-
*/
|
|
199
|
-
setForever: <T>(key: string, value: T) => Promise<boolean>
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Get a value or set it if not cached
|
|
203
|
-
*/
|
|
204
|
-
getOrSet: <T>(key: string, fetcher: () => T | Promise<T>, ttl?: number) => Promise<T>
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Delete one or more keys
|
|
208
|
-
*/
|
|
209
|
-
del: (keys: string | string[]) => Promise<number>
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Check if a key exists
|
|
213
|
-
*/
|
|
214
|
-
has: (key: string) => Promise<boolean>
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Check if a key is missing
|
|
218
|
-
*/
|
|
219
|
-
missing: (key: string) => Promise<boolean>
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Delete a single key (alias for del)
|
|
223
|
-
*/
|
|
224
|
-
remove: (key: string) => Promise<void>
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Delete multiple keys
|
|
228
|
-
*/
|
|
229
|
-
deleteMany: (keys: string[]) => Promise<number>
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Clear all cached values
|
|
233
|
-
*/
|
|
234
|
-
clear: () => Promise<void>
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Clear all cached values (alias for clear)
|
|
238
|
-
*/
|
|
239
|
-
flush: () => Promise<void>
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Get all keys matching a pattern
|
|
243
|
-
*/
|
|
244
|
-
keys: (pattern?: string) => Promise<string[]>
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Get the TTL of a key (in seconds)
|
|
248
|
-
*/
|
|
249
|
-
getTtl: (key: string) => Promise<number | undefined>
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Set/update the TTL of a key
|
|
253
|
-
*/
|
|
254
|
-
ttl: (key: string, ttl: number) => Promise<boolean>
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Get a value and delete it atomically
|
|
258
|
-
*/
|
|
259
|
-
take: <T>(key: string) => Promise<T | undefined>
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Get a cached value or compute and store it (Laravel-style).
|
|
263
|
-
* TTL comes before callback (Laravel convention).
|
|
264
|
-
*/
|
|
265
|
-
remember: <T>(key: string, ttl: number, callback: () => T | Promise<T>) => Promise<T>
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Get a cached value or compute and store it forever (no expiration).
|
|
269
|
-
*/
|
|
270
|
-
rememberForever: <T>(key: string, callback: () => T | Promise<T>) => Promise<T>
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Get cache statistics
|
|
274
|
-
*/
|
|
275
|
-
getStats: () => Promise<CacheStats>
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Close the cache connection
|
|
279
|
-
*/
|
|
280
|
-
close: () => Promise<void>
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Disconnect from the cache (alias for close)
|
|
284
|
-
*/
|
|
285
|
-
disconnect: () => Promise<void>
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Tag-aware writes. The returned scope mirrors the cache API but
|
|
289
|
-
* indexes every write under the supplied tag(s) so a single
|
|
290
|
-
* `flush()` can invalidate cascading entries together.
|
|
291
|
-
*
|
|
292
|
-
* @example
|
|
293
|
-
* ```ts
|
|
294
|
-
* await cache.tags(['user:42']).put('user:42:feed', payload, 300)
|
|
295
|
-
* await cache.tags(['user:42']).flush()
|
|
296
|
-
* ```
|
|
297
|
-
*/
|
|
298
|
-
tags?: (tags: readonly string[]) => TaggedCacheScope
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Returned by `cache.tags(tags)`. Tag-scoped writes/reads with a
|
|
303
|
-
* cascading `flush()`.
|
|
304
|
-
*/
|
|
305
|
-
export interface TaggedCacheScope {
|
|
306
|
-
put: <T>(key: string, value: T, ttl?: number) => Promise<boolean>
|
|
307
|
-
set: <T>(key: string, value: T, ttl?: number) => Promise<boolean>
|
|
308
|
-
setForever: <T>(key: string, value: T) => Promise<boolean>
|
|
309
|
-
remember: <T>(key: string, ttl: number, callback: () => T | Promise<T>) => Promise<T>
|
|
310
|
-
rememberForever: <T>(key: string, callback: () => T | Promise<T>) => Promise<T>
|
|
311
|
-
get: <T>(key: string) => Promise<T | undefined>
|
|
312
|
-
has: (key: string) => Promise<boolean>
|
|
313
|
-
flush: () => Promise<number>
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Cache Statistics
|
|
318
|
-
*/
|
|
319
|
-
export interface CacheStats {
|
|
320
|
-
hits: number
|
|
321
|
-
misses: number
|
|
322
|
-
keys: number
|
|
323
|
-
size?: number
|
|
324
|
-
hitRate?: number
|
|
325
|
-
}
|
package/src/cdn.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface CdnOptions {
|
|
2
|
-
/**
|
|
3
|
-
* **CDN Driver**
|
|
4
|
-
*
|
|
5
|
-
* This value determines the default CDN driver that will be used when interacting with the
|
|
6
|
-
* CDN service. This value may be overridden when interacting with the CDN service.
|
|
7
|
-
*
|
|
8
|
-
* @default "cloudfront"
|
|
9
|
-
* @example "cloudfront"
|
|
10
|
-
* @example "fastly" wip
|
|
11
|
-
*
|
|
12
|
-
* @see https://stacks.js.org/docs/cdn
|
|
13
|
-
*/
|
|
14
|
-
driver: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type CdnConfig = Partial<CdnOptions>
|