@stacksjs/types 0.70.85 → 0.70.87
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/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/logging.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Logging Options**
|
|
3
|
-
*
|
|
4
|
-
* This configuration defines all of your logging options. Because Stacks is fully-typed, you
|
|
5
|
-
* may hover any of the options below and the definitions will be provided. In case you
|
|
6
|
-
* have any questions, feel free to reach out via Discord or GitHub Discussions.
|
|
7
|
-
*/
|
|
8
|
-
export interface LoggingOptions {
|
|
9
|
-
/**
|
|
10
|
-
* **Log File Path**
|
|
11
|
-
*
|
|
12
|
-
* The path to the log file. This will be used to write logs to a file. If you do not want to
|
|
13
|
-
* write logs to a file, you may set this to `null`.
|
|
14
|
-
*
|
|
15
|
-
* @default 'storage/logs/console.log'
|
|
16
|
-
*/
|
|
17
|
-
logsPath: string
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* **Deployments Path**
|
|
21
|
-
*
|
|
22
|
-
* The path to the deployments folder. This will be used to write deployment logs to a file.
|
|
23
|
-
* If you do not want to write deployment logs to a file, you may set this to `null`.
|
|
24
|
-
*
|
|
25
|
-
* @default 'storage/logs/deployments.log'
|
|
26
|
-
*/
|
|
27
|
-
deploymentsPath: string
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* **Minimum Log Level**
|
|
31
|
-
*
|
|
32
|
-
* Messages below this level are suppressed. The `LOG_LEVEL` env var
|
|
33
|
-
* overrides this when set (stacksjs/stacks#1935).
|
|
34
|
-
*
|
|
35
|
-
* @default 'info'
|
|
36
|
-
*/
|
|
37
|
-
level?: 'debug' | 'info' | 'success' | 'warning' | 'error'
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* **Output Format**
|
|
41
|
-
*
|
|
42
|
-
* `'json'` for structured output (production), `'text'` for the
|
|
43
|
-
* human-readable dev view. The `LOG_FORMAT` env var overrides this;
|
|
44
|
-
* default is `'json'` in production, `'text'` otherwise.
|
|
45
|
-
*
|
|
46
|
-
* @default 'text'
|
|
47
|
-
*/
|
|
48
|
-
format?: 'json' | 'text'
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* **Write To File**
|
|
52
|
-
*
|
|
53
|
-
* Whether logs are persisted to `logsPath`'s directory as daily
|
|
54
|
-
* files. Set `false` for console-only output (e.g. when the platform
|
|
55
|
-
* captures stdout).
|
|
56
|
-
*
|
|
57
|
-
* @default true
|
|
58
|
-
*/
|
|
59
|
-
writeToFile?: boolean
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type LoggingConfig = Partial<LoggingOptions>
|
package/src/manifest.ts
DELETED
package/src/marketing.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Marketing Options**
|
|
3
|
-
*
|
|
4
|
-
* Top-level feature gate for the marketing bundle (`/api/email/subscribe`,
|
|
5
|
-
* `/api/contact`, Campaign / EmailList / SocialPost). Stays inert at boot
|
|
6
|
-
* when `enabled` is `false`.
|
|
7
|
-
*/
|
|
8
|
-
export interface MarketingOptions {
|
|
9
|
-
enabled?: boolean
|
|
10
|
-
/** Optional deploy-target gate, e.g. `['production']`. */
|
|
11
|
-
env?: string[]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type MarketingConfig = Partial<MarketingOptions>
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module augmentation that adds the Stacks-specific `dashboard` slot to
|
|
3
|
-
* bun-query-builder's `BrowserModelDefinition`.
|
|
4
|
-
*
|
|
5
|
-
* Why this lives here (Stacks, not bqb):
|
|
6
|
-
*
|
|
7
|
-
* The `dashboard` config is a Stacks framework concept — it influences
|
|
8
|
-
* how the model appears in `buddy dev --dashboard`'s sidebar. It has no
|
|
9
|
-
* meaning outside the dashboard surface, so adding it to bqb's core
|
|
10
|
-
* types would force every bqb consumer to carry weight they don't need.
|
|
11
|
-
*
|
|
12
|
-
* Declaration merging keeps the typing clean at every call site:
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* import { defineModel } from '@stacksjs/orm'
|
|
16
|
-
*
|
|
17
|
-
* defineModel({
|
|
18
|
-
* name: 'AuditLog',
|
|
19
|
-
* dashboard: { section: 'management', roles: ['admin'] }, // ← typed
|
|
20
|
-
* attributes: { … },
|
|
21
|
-
* })
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* Without this augmentation, the `dashboard` property would still pass
|
|
25
|
-
* (because bqb's `defineModel<TDef extends BrowserModelDefinition>` uses
|
|
26
|
-
* `extends`, which permits excess properties), but with no autocomplete
|
|
27
|
-
* and no shape validation. The augmentation gives both.
|
|
28
|
-
*
|
|
29
|
-
* Loading note: this file only declares types — no runtime effects. It
|
|
30
|
-
* must be reachable via `@stacksjs/types`' barrel so any package that
|
|
31
|
-
* already imports from `@stacksjs/types` picks up the augmentation in
|
|
32
|
-
* the same compilation. Re-exported from `index.ts`.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
import type { DashboardModelOptions } from './dashboard'
|
|
36
|
-
|
|
37
|
-
declare module 'bun-query-builder' {
|
|
38
|
-
interface BrowserModelDefinition {
|
|
39
|
-
/**
|
|
40
|
-
* Stacks dashboard sidebar configuration for this model.
|
|
41
|
-
* See {@link DashboardModelOptions} for the full shape.
|
|
42
|
-
*
|
|
43
|
-
* Omit to use defaults (model is shown under its auto-categorised
|
|
44
|
-
* section using `iconMap` + the model name).
|
|
45
|
-
*/
|
|
46
|
-
readonly dashboard?: DashboardModelOptions
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Re-export for `import type { DashboardModelOptions } from '@stacksjs/types'`.
|
|
51
|
-
export type { DashboardModelOptions }
|
package/src/model-names.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ModelNames = 'Tag' | 'PaymentProduct' | 'FailedJob' | 'SocialPost' | 'PaymentMethod' | 'Campaign' | 'PaymentTransaction' | 'Request' | 'Activity' | 'EmailList' | 'Notification' | 'Job' | 'Log' | 'Subscription' | 'Error' | 'Comment' | 'User' | 'Websocket' | 'Page' | 'Author' | 'Post' | 'PrintDevice' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'Receipt' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'Transaction' | 'LoyaltyPoint' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'Cart' | 'DeliveryRoute' | 'CartItem'
|
package/src/model.ts
DELETED
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import type { Faker } from '@stacksjs/faker'
|
|
2
|
-
import type { ValidationType } from '@stacksjs/ts-validation'
|
|
3
|
-
import type { ModelNames, TableNames } from '@stacksjs/types'
|
|
4
|
-
import type { DeepPartial } from '.'
|
|
5
|
-
import type { SearchOptions } from './search-engine'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Model definition type - compatible with bun-query-builder
|
|
9
|
-
*
|
|
10
|
-
* Models can be defined in app/Models/ (userland; overrides defaults by name)
|
|
11
|
-
* or storage/framework/defaults/app/Models/ (framework defaults), and are used
|
|
12
|
-
* to generate the ORM classes, migrations, and API routes.
|
|
13
|
-
*/
|
|
14
|
-
export type Model = Partial<ModelOptions>
|
|
15
|
-
|
|
16
|
-
export interface BaseRelation {
|
|
17
|
-
foreignKey?: string
|
|
18
|
-
relationName?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface Relation<T = string> extends BaseRelation {
|
|
22
|
-
model: T
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface HasOne<T = string> extends Array<Relation<T>> {}
|
|
26
|
-
|
|
27
|
-
export interface MorphTo {
|
|
28
|
-
name: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface MorphOne<T = string> extends BaseRelation {
|
|
32
|
-
model: T
|
|
33
|
-
morphName?: string
|
|
34
|
-
type?: string
|
|
35
|
-
id?: string
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface MorphMany<T = string> extends MorphOne<T> {}
|
|
39
|
-
|
|
40
|
-
export interface HasMany<T = string> extends Array<Relation<T>> {}
|
|
41
|
-
export interface BelongsTo<T = string> extends Array<Relation<T>> {}
|
|
42
|
-
|
|
43
|
-
export interface BelongsToMany<T = string> extends Array<BaseBelongsToMany<T> | T> {}
|
|
44
|
-
export interface HasOneThrough<T = string> extends Array<BaseHasOneThrough<T> | T> {}
|
|
45
|
-
|
|
46
|
-
export interface BaseBelongsToMany<T = string> {
|
|
47
|
-
model: T
|
|
48
|
-
firstForeignKey?: string
|
|
49
|
-
secondForeignKey?: string
|
|
50
|
-
pivotTable?: string
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface BaseHasOneThrough<T = string> {
|
|
54
|
-
model: T
|
|
55
|
-
through: T
|
|
56
|
-
foreignKey?: string
|
|
57
|
-
throughForeignKey?: string
|
|
58
|
-
relationName?: string
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface BaseHasManyThrough<T = string> {
|
|
62
|
-
model: T
|
|
63
|
-
through: T
|
|
64
|
-
foreignKey?: string
|
|
65
|
-
throughForeignKey?: string
|
|
66
|
-
relationName?: string
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface HasManyThrough<T = string> extends Array<BaseHasManyThrough<T> | T> {}
|
|
70
|
-
|
|
71
|
-
export interface MorphToMany<T = string> extends Array<T> {}
|
|
72
|
-
|
|
73
|
-
export interface MorphedByMany<T = string> extends Array<T> {}
|
|
74
|
-
|
|
75
|
-
export interface FieldArrayElement {
|
|
76
|
-
entity: string
|
|
77
|
-
charValue?: string | null
|
|
78
|
-
// Add other properties as needed
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface ModelElement {
|
|
82
|
-
field: string
|
|
83
|
-
default: string | number | boolean | Date | undefined | null
|
|
84
|
-
unique: boolean
|
|
85
|
-
fillable: boolean
|
|
86
|
-
hidden: boolean
|
|
87
|
-
required: boolean
|
|
88
|
-
fieldArray: FieldArrayElement | null
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface UserAuthOptions {
|
|
92
|
-
useTwoFactor?: boolean
|
|
93
|
-
usePasskey?: boolean
|
|
94
|
-
}
|
|
95
|
-
export interface LikeableOptions {
|
|
96
|
-
table?: string
|
|
97
|
-
foreignKey?: string
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
type ActionPath = string
|
|
101
|
-
type ActionName = string
|
|
102
|
-
type Action = ActionPath | ActionName | undefined
|
|
103
|
-
|
|
104
|
-
export type ApiRoutes = 'index' | 'show' | 'store' | 'update' | 'destroy'
|
|
105
|
-
|
|
106
|
-
export type SocialProviders = 'google' | 'github' | 'apple' | 'twitter' | 'facebook'
|
|
107
|
-
|
|
108
|
-
export interface SeedOptions {
|
|
109
|
-
count: number
|
|
110
|
-
/**
|
|
111
|
-
* Fixed rows merged over factory output for the first N entries (N = fixtures.length).
|
|
112
|
-
* Keys use model attribute names (camelCase); stored as snake_case columns.
|
|
113
|
-
*/
|
|
114
|
-
fixtures?: Array<Record<string, unknown>>
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
type LogAttribute = string
|
|
118
|
-
|
|
119
|
-
interface ActivityLogOption {
|
|
120
|
-
exclude: LogAttribute[]
|
|
121
|
-
include: LogAttribute[] // default to "*"
|
|
122
|
-
logOnly: LogAttribute[]
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface Relations {
|
|
126
|
-
hasOne: HasOne<ModelNames> | ModelNames[]
|
|
127
|
-
hasMany: HasMany<ModelNames> | ModelNames[]
|
|
128
|
-
belongsTo: BelongsTo<ModelNames> | ModelNames[]
|
|
129
|
-
belongsToMany: BelongsToMany<ModelNames> | ModelNames[]
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export type SocialOptions = SocialProviders[]
|
|
133
|
-
|
|
134
|
-
export interface ApiSettings {
|
|
135
|
-
uri: string
|
|
136
|
-
middleware: string[]
|
|
137
|
-
routes:
|
|
138
|
-
| {
|
|
139
|
-
[key in ApiRoutes]: Action
|
|
140
|
-
}
|
|
141
|
-
| string[]
|
|
142
|
-
openApi: boolean
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
type ApiOptions = DeepPartial<ApiSettings>
|
|
146
|
-
|
|
147
|
-
export interface TimestampOptions {
|
|
148
|
-
createdAt?: string // defaults to 'created_at'
|
|
149
|
-
updatedAt?: string
|
|
150
|
-
deletedAt?: string
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
interface ValidatorMessage {
|
|
154
|
-
[key: string]: string
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export interface SoftDeleteOptions {
|
|
158
|
-
deletedAt?: string // defaults to 'deleted_at' & can be used for localized tables
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface Base {}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Model.
|
|
165
|
-
*/
|
|
166
|
-
export interface ModelOptions extends Base {
|
|
167
|
-
/**
|
|
168
|
-
* The name of the model.
|
|
169
|
-
*
|
|
170
|
-
* @default string - The file name of the model.
|
|
171
|
-
*/
|
|
172
|
-
name: string // defaults to the file name of the model
|
|
173
|
-
description?: string // defaults to the file name of the model
|
|
174
|
-
table?: string // defaults to the lowercase, plural name of the model name (or the name of the model file)
|
|
175
|
-
primaryKey?: string // defaults to `id`
|
|
176
|
-
autoIncrement?: boolean // defaults to true
|
|
177
|
-
indexes?: CompositeIndex[]
|
|
178
|
-
dashboard?: {
|
|
179
|
-
highlight?: boolean | number // defaults to undefined
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
traits?: {
|
|
183
|
-
useUuid?: boolean // defaults to false
|
|
184
|
-
useTimestamps?: boolean | TimestampOptions // defaults to true
|
|
185
|
-
timestampable?: boolean | TimestampOptions // useTimestamps alias
|
|
186
|
-
useSoftDeletes?: boolean | SoftDeleteOptions // defaults to false
|
|
187
|
-
softDeletable?: boolean | SoftDeleteOptions // useSoftDeletes alias
|
|
188
|
-
categorizable?: boolean // defaults to false
|
|
189
|
-
taggable?: boolean // defaults to false
|
|
190
|
-
commentables?: boolean // defaults to false
|
|
191
|
-
useAuth?: boolean | UserAuthOptions // defaults to false
|
|
192
|
-
authenticatable?: boolean | UserAuthOptions // useAuth alias
|
|
193
|
-
/**
|
|
194
|
-
* @deprecated stacksjs/stacks#1929 — the `useSeeder` trait only
|
|
195
|
-
* existed to drive the auto-walker, which is removed from
|
|
196
|
-
* `./buddy seed` (stacksjs/stacks#1919). Seeding is now owned by
|
|
197
|
-
* class seeders: a `database/seeders/<Model>Seeder.ts` file calling
|
|
198
|
-
* `factory.generate(Model, { count })`. Run `./buddy seed:scaffold`
|
|
199
|
-
* to codemod existing traits into seeder files (and strip the
|
|
200
|
-
* trait). This field is scheduled for removal in the next major.
|
|
201
|
-
*/
|
|
202
|
-
useSeeder?: boolean | SeedOptions // defaults to a count of 10
|
|
203
|
-
/** @deprecated alias of {@link useSeeder} — see stacksjs/stacks#1929. */
|
|
204
|
-
seedable?: boolean | SeedOptions // useSeeder alias
|
|
205
|
-
useSearch?: boolean | SearchOptions // defaults to false
|
|
206
|
-
useSocials?: SocialOptions // defaults to false
|
|
207
|
-
searchable?: boolean | SearchOptions // useSearch alias
|
|
208
|
-
useApi?: ApiOptions | boolean
|
|
209
|
-
observe?: string[] | boolean
|
|
210
|
-
billable?: boolean
|
|
211
|
-
useActivityLog?: boolean | ActivityLogOption
|
|
212
|
-
|
|
213
|
-
likeable?: boolean | LikeableOptions
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
attributes?: AttributesElements
|
|
217
|
-
|
|
218
|
-
// relationships
|
|
219
|
-
hasOne?: HasOne<ModelNames> | ModelNames[]
|
|
220
|
-
|
|
221
|
-
hasMany?: HasMany<ModelNames> | ModelNames[]
|
|
222
|
-
|
|
223
|
-
belongsTo?: BelongsTo<ModelNames> | ModelNames[]
|
|
224
|
-
|
|
225
|
-
belongsToMany?: BelongsToMany<ModelNames> | ModelNames[]
|
|
226
|
-
|
|
227
|
-
hasOneThrough?: HasOneThrough<ModelNames> | ModelNames[]
|
|
228
|
-
|
|
229
|
-
hasManyThrough?: HasManyThrough<ModelNames> | ModelNames[]
|
|
230
|
-
|
|
231
|
-
morphOne?: MorphOne<ModelNames> | ModelNames
|
|
232
|
-
|
|
233
|
-
morphMany?: MorphMany<ModelNames>[] | ModelNames[]
|
|
234
|
-
|
|
235
|
-
morphTo?: MorphTo
|
|
236
|
-
|
|
237
|
-
morphToMany?: MorphToMany<ModelNames> | ModelNames[]
|
|
238
|
-
|
|
239
|
-
morphedByMany?: MorphedByMany<ModelNames> | ModelNames[]
|
|
240
|
-
|
|
241
|
-
scopes?: {
|
|
242
|
-
[key: string]: (value: any) => any
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
get?: {
|
|
246
|
-
[key: string]: (value: any) => any
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
set?: {
|
|
250
|
-
[key: string]: (value: any) => any
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export interface Attribute {
|
|
255
|
-
type?: string
|
|
256
|
-
nullable?: boolean
|
|
257
|
-
default?: string | number | boolean | Date
|
|
258
|
-
unique?: boolean
|
|
259
|
-
order?: number
|
|
260
|
-
hidden?: boolean
|
|
261
|
-
fillable?: boolean
|
|
262
|
-
guarded?: boolean
|
|
263
|
-
factory?: (faker: Faker) => any
|
|
264
|
-
validation: {
|
|
265
|
-
rule: ValidationType
|
|
266
|
-
message?: ValidatorMessage
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export interface CompositeIndex {
|
|
271
|
-
name: string
|
|
272
|
-
columns: string[]
|
|
273
|
-
/**
|
|
274
|
-
* Emit `UNIQUE` on the index — turns a multi-column index into a
|
|
275
|
-
* multi-column unique constraint. Combine with `where:` for a
|
|
276
|
-
* partial unique index (stacksjs/stacks#1943).
|
|
277
|
-
*
|
|
278
|
-
* @default false
|
|
279
|
-
*/
|
|
280
|
-
unique?: boolean
|
|
281
|
-
/**
|
|
282
|
-
* Partial-index `WHERE` clause as a raw SQL expression — e.g.
|
|
283
|
-
* `'user_id IS NOT NULL'`. Lets the constraint apply to a subset of
|
|
284
|
-
* rows; the canonical case is "prevent a logged-in user from flagging
|
|
285
|
-
* the same review twice, but allow anonymous flags (user_id NULL) to
|
|
286
|
-
* repeat" (stacksjs/stacks#1943). Emitted verbatim, so don't
|
|
287
|
-
* interpolate untrusted input.
|
|
288
|
-
*/
|
|
289
|
-
where?: string
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export interface AttributesElements {
|
|
293
|
-
[key: string]: Attribute
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
export interface RelationConfig {
|
|
297
|
-
relationship: string
|
|
298
|
-
model: string
|
|
299
|
-
table: TableNames
|
|
300
|
-
relationModel?: string
|
|
301
|
-
relationTable?: string
|
|
302
|
-
foreignKey: string
|
|
303
|
-
modelKey: string
|
|
304
|
-
pivotKey?: string
|
|
305
|
-
pivotForeign?: string
|
|
306
|
-
relationName?: string
|
|
307
|
-
throughModel?: string
|
|
308
|
-
throughForeignKey?: string
|
|
309
|
-
pivotTable: TableNames
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Helper to define a model with proper type inference.
|
|
314
|
-
* Compatible with bun-query-builder's defineModel pattern.
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* ```ts
|
|
318
|
-
* export default defineModel({
|
|
319
|
-
* name: 'User',
|
|
320
|
-
* table: 'users',
|
|
321
|
-
* primaryKey: 'id',
|
|
322
|
-
* attributes: {
|
|
323
|
-
* name: { validation: { rule: schema.string() } },
|
|
324
|
-
* email: { validation: { rule: schema.string().email() }, unique: true },
|
|
325
|
-
* },
|
|
326
|
-
* traits: {
|
|
327
|
-
* useTimestamps: true,
|
|
328
|
-
* useApi: true,
|
|
329
|
-
* },
|
|
330
|
-
* })
|
|
331
|
-
* ```
|
|
332
|
-
*/
|
|
333
|
-
export function defineModel<const T extends Model>(model: T): T {
|
|
334
|
-
return model
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Helper to define multiple models with proper type inference.
|
|
339
|
-
* Useful for building a typed database schema.
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* ```ts
|
|
343
|
-
* const models = defineModels({ User, Post, Comment })
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
export function defineModels<const T extends Record<string, Model>>(models: T): T {
|
|
347
|
-
return models
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Type alias for a collection of models
|
|
352
|
-
*/
|
|
353
|
-
export type ModelRecord = Record<string, Model>
|
package/src/monitoring.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Monitoring Options**
|
|
3
|
-
*
|
|
4
|
-
* Top-level feature gate for the monitoring bundle (Error model +
|
|
5
|
-
* error-tracking views and actions). Stays inert at boot when `enabled`
|
|
6
|
-
* is `false`.
|
|
7
|
-
*/
|
|
8
|
-
export interface MonitoringOptions {
|
|
9
|
-
enabled?: boolean
|
|
10
|
-
/** Optional deploy-target gate, e.g. `['production']`. */
|
|
11
|
-
env?: string[]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type MonitoringConfig = Partial<MonitoringOptions>
|
package/src/native.ts
DELETED
|
File without changes
|
package/src/notifications.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
export interface NotificationOptions {
|
|
2
|
-
default: 'email' | 'sms' | 'chat' | string
|
|
3
|
-
|
|
4
|
-
email: {
|
|
5
|
-
default:
|
|
6
|
-
| 'emailjs'
|
|
7
|
-
| 'mailgun'
|
|
8
|
-
| 'mailjet'
|
|
9
|
-
| 'mandrill'
|
|
10
|
-
| 'netcore'
|
|
11
|
-
| 'nodemailer'
|
|
12
|
-
| 'postmark'
|
|
13
|
-
| 'sendgrid'
|
|
14
|
-
| 'ses'
|
|
15
|
-
| string
|
|
16
|
-
|
|
17
|
-
from: {
|
|
18
|
-
name: string
|
|
19
|
-
address: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
drivers: {
|
|
23
|
-
smtp: {
|
|
24
|
-
host: string
|
|
25
|
-
port: number
|
|
26
|
-
secure: boolean
|
|
27
|
-
auth: {
|
|
28
|
-
user: string
|
|
29
|
-
pass: string
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
sendgrid: {
|
|
34
|
-
key: string
|
|
35
|
-
senderName: string
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
emailjs: {
|
|
39
|
-
host: string
|
|
40
|
-
user: string
|
|
41
|
-
password: string
|
|
42
|
-
port: number
|
|
43
|
-
secure: boolean
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
mailgun: {
|
|
47
|
-
key: string
|
|
48
|
-
domain: string
|
|
49
|
-
username: string
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
mailjet: {
|
|
53
|
-
key: string
|
|
54
|
-
secret: string
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
mandrill: {
|
|
58
|
-
key: string
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
netcore: {
|
|
62
|
-
key: string
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
nodemailer: {
|
|
66
|
-
host: string
|
|
67
|
-
user: string
|
|
68
|
-
password: string
|
|
69
|
-
port: number
|
|
70
|
-
secure: boolean
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
postmark: {
|
|
74
|
-
key: string
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
ses: {
|
|
78
|
-
region: string
|
|
79
|
-
key: string
|
|
80
|
-
secret: string
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
sms: {
|
|
86
|
-
default: 'twilio' | 'nexmo' | 'gupshup' | 'plivo' | 'sms77' | 'sns' | 'telnyx' | 'termii' | string
|
|
87
|
-
from: string
|
|
88
|
-
|
|
89
|
-
drivers: {
|
|
90
|
-
twilio: {
|
|
91
|
-
sid: string
|
|
92
|
-
authToken: string
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
nexmo: {
|
|
96
|
-
key: string
|
|
97
|
-
secret: string
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
gupshup: {
|
|
101
|
-
user: string
|
|
102
|
-
password: string
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
plivo: {
|
|
106
|
-
sid: string
|
|
107
|
-
authToken: string
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
sms77: {
|
|
111
|
-
key: string
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
sns: {
|
|
115
|
-
region: string
|
|
116
|
-
key: string
|
|
117
|
-
secret: string
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
telnyx: {
|
|
121
|
-
key: string
|
|
122
|
-
messageProfileId: string
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
termii: {
|
|
126
|
-
key: string
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
chat: {
|
|
132
|
-
default: 'slack' | 'msTeams' | 'discord' | string
|
|
133
|
-
from: string
|
|
134
|
-
|
|
135
|
-
drivers: {
|
|
136
|
-
slack?: {
|
|
137
|
-
appId: string
|
|
138
|
-
clientId: string
|
|
139
|
-
secret: string
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
msTeams?: {
|
|
143
|
-
appId: string
|
|
144
|
-
clientId: string
|
|
145
|
-
secret: string
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// discord?: {}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export type NotificationConfig = Partial<NotificationOptions>
|