@stacksjs/types 0.70.256 → 0.70.257
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/database.d.ts +56 -3
- package/dist/model.d.ts +23 -0
- package/package.json +3 -3
package/dist/database.d.ts
CHANGED
|
@@ -1,9 +1,50 @@
|
|
|
1
1
|
import type { SupportedDialect } from 'bun-query-builder';
|
|
2
|
+
/**
|
|
3
|
+
* Connection pool tuning.
|
|
4
|
+
*
|
|
5
|
+
* Every knob is optional — an omitted pool leaves the driver on its own
|
|
6
|
+
* defaults, which is correct for a single-server app that has never had to
|
|
7
|
+
* think about pooling. Ignored for SQLite, which is embedded and
|
|
8
|
+
* single-connection.
|
|
9
|
+
*/
|
|
10
|
+
export declare interface PoolOptions {
|
|
11
|
+
max?: number
|
|
12
|
+
min?: number
|
|
13
|
+
idleTimeoutMs?: number
|
|
14
|
+
acquireTimeoutMs?: number
|
|
15
|
+
maxLifetimeMs?: number
|
|
16
|
+
autoReconnect?: boolean
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A read replica of the connection it is declared on.
|
|
20
|
+
*
|
|
21
|
+
* Only `host` is required: port, credentials, and database name are
|
|
22
|
+
* inherited from the primary, because a replica is the same database on a
|
|
23
|
+
* different host. Requiring them per replica is how host lists drift out
|
|
24
|
+
* of sync with a rotated password.
|
|
25
|
+
*/
|
|
26
|
+
export declare interface ReplicaOptions {
|
|
27
|
+
host: string
|
|
28
|
+
port?: number
|
|
29
|
+
username?: string
|
|
30
|
+
password?: string
|
|
31
|
+
weight?: number
|
|
32
|
+
}
|
|
33
|
+
/** How reads are distributed across replicas. */
|
|
34
|
+
export declare interface ReadPolicyOptions {
|
|
35
|
+
autoRoute?: boolean
|
|
36
|
+
strategy?: 'round-robin' | 'weighted' | 'random'
|
|
37
|
+
}
|
|
38
|
+
/** Fields shared by every client-server connection. */
|
|
39
|
+
export declare interface NetworkedConnectionOptions {
|
|
40
|
+
pool?: PoolOptions
|
|
41
|
+
replicas?: ReplicaOptions[]
|
|
42
|
+
}
|
|
2
43
|
export declare interface DatabaseOptions {
|
|
3
44
|
default: SupportedDialect
|
|
4
45
|
logging?: boolean
|
|
5
46
|
connections: {
|
|
6
|
-
mysql?: {
|
|
47
|
+
mysql?: NetworkedConnectionOptions & {
|
|
7
48
|
url?: string
|
|
8
49
|
host?: string
|
|
9
50
|
port?: number
|
|
@@ -12,7 +53,17 @@ export declare interface DatabaseOptions {
|
|
|
12
53
|
password?: string
|
|
13
54
|
prefix?: string
|
|
14
55
|
}
|
|
15
|
-
singlestore?: {
|
|
56
|
+
singlestore?: NetworkedConnectionOptions & {
|
|
57
|
+
url?: string
|
|
58
|
+
host?: string
|
|
59
|
+
port?: number
|
|
60
|
+
name?: string
|
|
61
|
+
username?: string
|
|
62
|
+
password?: string
|
|
63
|
+
prefix?: string
|
|
64
|
+
ssl?: boolean
|
|
65
|
+
}
|
|
66
|
+
vitess?: NetworkedConnectionOptions & {
|
|
16
67
|
url?: string
|
|
17
68
|
host?: string
|
|
18
69
|
port?: number
|
|
@@ -21,6 +72,7 @@ export declare interface DatabaseOptions {
|
|
|
21
72
|
password?: string
|
|
22
73
|
prefix?: string
|
|
23
74
|
ssl?: boolean
|
|
75
|
+
tabletType?: 'primary' | 'replica' | 'rdonly'
|
|
24
76
|
}
|
|
25
77
|
sqlite: {
|
|
26
78
|
url?: string
|
|
@@ -34,7 +86,7 @@ export declare interface DatabaseOptions {
|
|
|
34
86
|
prefix?: string
|
|
35
87
|
endpoint?: string
|
|
36
88
|
}
|
|
37
|
-
postgres?: {
|
|
89
|
+
postgres?: NetworkedConnectionOptions & {
|
|
38
90
|
url?: string
|
|
39
91
|
host?: string
|
|
40
92
|
port?: number
|
|
@@ -46,6 +98,7 @@ export declare interface DatabaseOptions {
|
|
|
46
98
|
}
|
|
47
99
|
migrations: string
|
|
48
100
|
migrationLocks: string
|
|
101
|
+
reads?: ReadPolicyOptions
|
|
49
102
|
safety?: {
|
|
50
103
|
confirmMigrate?: boolean
|
|
51
104
|
migrateFresh?: 'allow' | 'confirm' | 'disabled'
|
package/dist/model.d.ts
CHANGED
|
@@ -128,6 +128,15 @@ export declare interface LikeableOptions {
|
|
|
128
128
|
table?: string
|
|
129
129
|
foreignKey?: string
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Per-model sharding declaration, read by `buddy generate:vschema`.
|
|
133
|
+
*/
|
|
134
|
+
export declare interface ShardingOptions {
|
|
135
|
+
column?: string
|
|
136
|
+
vindex?: VindexType
|
|
137
|
+
unsharded?: boolean
|
|
138
|
+
sequence?: string
|
|
139
|
+
}
|
|
131
140
|
export declare interface SeedOptions {
|
|
132
141
|
count: number
|
|
133
142
|
fixtures?: Array<Record<string, unknown>>
|
|
@@ -199,6 +208,7 @@ export declare interface ModelOptions extends Base {
|
|
|
199
208
|
billable?: boolean
|
|
200
209
|
useActivityLog?: boolean | ActivityLogOption
|
|
201
210
|
likeable?: boolean | LikeableOptions
|
|
211
|
+
sharding?: ShardingOptions
|
|
202
212
|
}
|
|
203
213
|
attributes?: AttributesElements
|
|
204
214
|
hasOne?: HasOne<ModelNames> | ModelNames[]
|
|
@@ -274,6 +284,19 @@ export type Model = Partial<ModelOptions>;
|
|
|
274
284
|
export type OnForeignKeyAction = 'cascade' | 'set null' | 'restrict' | 'no action';
|
|
275
285
|
export type BelongsToMany<T = string> = Array<BaseBelongsToMany<T> | T>
|
|
276
286
|
| Record<string, T | BelongsToManyConfig<T>>;
|
|
287
|
+
/**
|
|
288
|
+
* Vindex types a column vindex may use.
|
|
289
|
+
*
|
|
290
|
+
* A vindex is Vitess's index from a column value to a shard. `hash` is the
|
|
291
|
+
* general-purpose choice for integer keys and the default here; `xxhash`
|
|
292
|
+
* suits non-integer keys; `binary`/`binary_md5` and `unicode_loose_md5`
|
|
293
|
+
* apply to string keys where ordering or case-folding matters.
|
|
294
|
+
*/
|
|
295
|
+
export type VindexType = | 'hash'
|
|
296
|
+
| 'xxhash'
|
|
297
|
+
| 'binary'
|
|
298
|
+
| 'binary_md5'
|
|
299
|
+
| 'unicode_loose_md5';
|
|
277
300
|
declare type ActionPath = string;
|
|
278
301
|
declare type ActionName = string;
|
|
279
302
|
declare type Action = ActionPath | ActionName | undefined;
|
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.257",
|
|
5
5
|
"description": "The Stacks framework types.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@stacksjs/clapp": "^0.2.12",
|
|
54
54
|
"@stacksjs/stx": "^0.2.148",
|
|
55
55
|
"@stacksjs/ts-validation": "^0.5.0",
|
|
56
|
-
"bun-query-builder": "^0.2.
|
|
56
|
+
"bun-query-builder": "^0.2.6"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"meilisearch": "^0.59.0"
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@stacksjs/validation": "0.70.
|
|
67
|
+
"@stacksjs/validation": "0.70.257",
|
|
68
68
|
"better-dx": "^0.2.17",
|
|
69
69
|
"meilisearch": "^0.59.0"
|
|
70
70
|
},
|