@stacksjs/database 0.70.87 → 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 +10 -10
- package/dist/auth-tables.d.ts +0 -60
- package/dist/class-seeder.d.ts +0 -65
- package/dist/custom/audits.d.ts +0 -16
- package/dist/custom/errors.d.ts +0 -1
- package/dist/custom/index.d.ts +0 -3
- package/dist/custom/jobs.d.ts +0 -3
- package/dist/database.d.ts +0 -89
- package/dist/defaults.d.ts +0 -48
- package/dist/driver-config.d.ts +0 -149
- package/dist/drivers/defaults/index.d.ts +0 -2
- package/dist/drivers/defaults/passwords.d.ts +0 -4
- package/dist/drivers/defaults/traits.d.ts +0 -33
- package/dist/drivers/dynamodb.d.ts +0 -200
- package/dist/drivers/helpers.d.ts +0 -35
- package/dist/drivers/index.d.ts +0 -16
- package/dist/drivers/mysql.d.ts +0 -7
- package/dist/drivers/postgres.d.ts +0 -7
- package/dist/drivers/sqlite.d.ts +0 -20
- package/dist/factory.d.ts +0 -41
- package/dist/fk-audit.d.ts +0 -101
- package/dist/index.d.ts +0 -149
- package/dist/index.js +0 -1263
- package/dist/migration-lock.d.ts +0 -23
- package/dist/migrations.d.ts +0 -76
- package/dist/notification-tables.d.ts +0 -20
- package/dist/query-logger.d.ts +0 -26
- package/dist/query-parser.d.ts +0 -4
- package/dist/rbac-tables.d.ts +0 -17
- package/dist/safe-migrations.d.ts +0 -72
- package/dist/seed-scaffold.d.ts +0 -34
- package/dist/seeder.d.ts +0 -116
- package/dist/sql-helpers.d.ts +0 -33
- package/dist/transaction-context.d.ts +0 -52
- package/dist/types.d.ts +0 -151
- package/dist/unique-audit.d.ts +0 -60
- package/dist/utils.d.ts +0 -189
- package/dist/uuid-columns.d.ts +0 -22
- package/dist/validators.d.ts +0 -26
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/database",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.88",
|
|
6
6
|
"description": "The Stacks database integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
"bun-query-builder": "^0.1.47"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@stacksjs/cli": "0.70.
|
|
62
|
-
"@stacksjs/config": "0.70.
|
|
63
|
-
"@stacksjs/logging": "0.70.
|
|
64
|
-
"@stacksjs/router": "0.70.
|
|
61
|
+
"@stacksjs/cli": "0.70.88",
|
|
62
|
+
"@stacksjs/config": "0.70.88",
|
|
63
|
+
"@stacksjs/logging": "0.70.88",
|
|
64
|
+
"@stacksjs/router": "0.70.88",
|
|
65
65
|
"better-dx": "^0.2.16",
|
|
66
|
-
"@stacksjs/path": "0.70.
|
|
67
|
-
"@stacksjs/query-builder": "0.70.
|
|
68
|
-
"@stacksjs/storage": "0.70.
|
|
69
|
-
"@stacksjs/strings": "0.70.
|
|
70
|
-
"@stacksjs/utils": "0.70.
|
|
66
|
+
"@stacksjs/path": "0.70.88",
|
|
67
|
+
"@stacksjs/query-builder": "0.70.88",
|
|
68
|
+
"@stacksjs/storage": "0.70.88",
|
|
69
|
+
"@stacksjs/strings": "0.70.88",
|
|
70
|
+
"@stacksjs/utils": "0.70.88"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/dist/auth-tables.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { sqlHelpers } from './sql-helpers';
|
|
2
|
-
/**
|
|
3
|
-
* Defensive ALTER guaranteeing `users.email_verified_at` — the column
|
|
4
|
-
* `verifyEmail()` writes and the `verified` middleware reads, but which
|
|
5
|
-
* no generated users migration ever creates (stacksjs/stacks#1948).
|
|
6
|
-
* Pure builder so tests can assert per-dialect DDL without a live DB.
|
|
7
|
-
*/
|
|
8
|
-
export declare function usersEmailVerifiedAtSql(sql: SqlHelpers): string;
|
|
9
|
-
/**
|
|
10
|
-
* Defensive ALTER guaranteeing `users.password_changed_at` — the column
|
|
11
|
-
* `resetPassword()` stamps and the token-validation paths read to bind a
|
|
12
|
-
* token's validity to the user's credential state (stacksjs/stacks#1957,
|
|
13
|
-
* a #1947 follow-up). No generated users migration creates it, so the
|
|
14
|
-
* same pure-builder + try/catch-swallow pattern as
|
|
15
|
-
* {@link usersEmailVerifiedAtSql} guarantees it from both schema paths.
|
|
16
|
-
*/
|
|
17
|
-
export declare function usersPasswordChangedAtSql(sql: SqlHelpers): string;
|
|
18
|
-
/**
|
|
19
|
-
* Defensive ALTER guaranteeing `users.two_factor_secret` and
|
|
20
|
-
* `users.two_factor_enabled` — storage/framework/core/auth/src/
|
|
21
|
-
* authenticator.ts's TOTP helpers (generateTwoFactorSecret,
|
|
22
|
-
* verifyTwoFactorCode) have existed since early in the framework's
|
|
23
|
-
* history, but nothing ever created the columns a caller would persist
|
|
24
|
-
* them to, or the `passkeys`/`webauthn_challenges` tables
|
|
25
|
-
* storage/framework/core/auth/src/passkey.ts's WebAuthn helpers
|
|
26
|
-
* unconditionally query against — every passkey/2FA call site was
|
|
27
|
-
* dead code pointed at tables that never existed on any install,
|
|
28
|
-
* `buddy new` included. Same defensive ALTER + swallow pattern as
|
|
29
|
-
* {@link usersEmailVerifiedAtSql}.
|
|
30
|
-
*/
|
|
31
|
-
export declare function usersTwoFactorColumnsSql(sql: SqlHelpers): string[];
|
|
32
|
-
/**
|
|
33
|
-
* Defensive ALTER guaranteeing `users.stripe_id` — the `billable`
|
|
34
|
-
* model trait's methods (createStripeCustomer/createOrGetStripeUser,
|
|
35
|
-
* used by `user.checkout(...)`) read and write this column
|
|
36
|
-
* unconditionally, but it's runtime-mixin-only (createBillableMethods
|
|
37
|
-
* in orm/define-model.ts, gated behind `traits.billable`): nothing in
|
|
38
|
-
* migration codegen ever creates the column itself, on any model, with
|
|
39
|
-
* or without the trait enabled. Every Stripe checkout call site was
|
|
40
|
-
* dead code pointed at a column that never existed, `buddy new`
|
|
41
|
-
* included — same shape as the passkeys/two_factor gap above (see
|
|
42
|
-
* stacksjs/status#1 Phase 9).
|
|
43
|
-
*/
|
|
44
|
-
export declare function usersStripeIdSql(): string;
|
|
45
|
-
/**
|
|
46
|
-
* Runs every `users` guarantee-column ALTER (email_verified_at,
|
|
47
|
-
* password_changed_at, two_factor_secret, two_factor_enabled,
|
|
48
|
-
* stripe_id), each independently try/catch-swallowed so one
|
|
49
|
-
* already-existing column (or a not-yet-existing `users` table) never
|
|
50
|
-
* skips the others. Exported so `buddy migrate`/`migrate:fresh` can
|
|
51
|
-
* call it a second time after the numbered model migrations run — see
|
|
52
|
-
* the call site in {@link migrateAuthTables} for why a single call
|
|
53
|
-
* isn't enough.
|
|
54
|
-
*/
|
|
55
|
-
export declare function ensureUsersAuthColumns(sql: SqlHelpers, options?: { verbose?: boolean }): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Create all authentication tables
|
|
58
|
-
*/
|
|
59
|
-
export declare function migrateAuthTables(options?: { verbose?: boolean }): Promise<{ success: boolean, error?: string }>;
|
|
60
|
-
declare type SqlHelpers = ReturnType<typeof sqlHelpers>;
|
package/dist/class-seeder.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Topologically sort seeders by their declared `dependencies`. Ties
|
|
3
|
-
* (and dependency-free seeders) come out in alphabetical order so the
|
|
4
|
-
* result is deterministic across filesystems and runs.
|
|
5
|
-
*
|
|
6
|
-
* Unknown dependency names are dropped from the graph with a warning —
|
|
7
|
-
* they may refer to model-factory seeders that ran earlier in the
|
|
8
|
-
* `buddy seed` pipeline, or be stale references from a rename. The run
|
|
9
|
-
* doesn't fail because of them.
|
|
10
|
-
*
|
|
11
|
-
* Cycles throw with the offending class names in the error message.
|
|
12
|
-
*
|
|
13
|
-
* Exported for testing.
|
|
14
|
-
*/
|
|
15
|
-
export declare function topoSortSeeders(seeders: Array<{ name: string, dependencies?: string[] }>): string[];
|
|
16
|
-
/*.ts`; an explicit `--class` filters to one.
|
|
17
|
-
*
|
|
18
|
-
* Ordering:
|
|
19
|
-
* 1. Files matching `*.ts` (excluding `_*.ts`) are imported.
|
|
20
|
-
* 2. If any seeder declares `dependencies`, the runnable set is
|
|
21
|
-
* topologically sorted (alphabetical tie-break).
|
|
22
|
-
* 3. Otherwise, the alphabetical order from `Array.sort()` wins —
|
|
23
|
-
* cheaper than the topo path and predictable across filesystems.
|
|
24
|
-
*
|
|
25
|
-
* Class-name filtering via `options.class` short-circuits both paths
|
|
26
|
-
* and runs only that one seeder. Cross-seeder dependencies are NOT
|
|
27
|
-
* resolved transitively in that mode — the caller takes responsibility
|
|
28
|
-
* for whatever prereqs are needed.
|
|
29
|
-
*
|
|
30
|
-
* See stacksjs/stacks#1855 for the original report of unsorted FS
|
|
31
|
-
* iteration producing zero-row seed runs.
|
|
32
|
-
*/
|
|
33
|
-
export declare function runClassSeeders(options?: RunOptions): Promise<{ ran: string[], skipped: string[] }>;
|
|
34
|
-
declare interface RunOptions {
|
|
35
|
-
class?: string
|
|
36
|
-
dir?: string
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Base class for class-based seeders. Subclass this and implement
|
|
40
|
-
* `async run()`. Seeders may call `this.call()` to invoke other
|
|
41
|
-
* seeders, mirroring Laravel's nested-seeder pattern.
|
|
42
|
-
*
|
|
43
|
-
* Cross-seeder ordering can be declared explicitly via `dependencies`:
|
|
44
|
-
*
|
|
45
|
-
* ```ts
|
|
46
|
-
* export default class JudgeSeeder extends Seeder {
|
|
47
|
-
* dependencies = ['CourtHouseSeeder']
|
|
48
|
-
* async run() { ... }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* The class name of each dependency is matched against the class names
|
|
53
|
-
* `runClassSeeders` discovered in the seeders directory. Unknown
|
|
54
|
-
* dependency names are warned about but don't fail the run (they may
|
|
55
|
-
* refer to a model-factory seeder run earlier in `buddy seed`).
|
|
56
|
-
*
|
|
57
|
-
* When no `dependencies` are declared, seeders run in alphabetical
|
|
58
|
-
* order — predictable across filesystems and good enough for projects
|
|
59
|
-
* that name seeders by data flow (CourtHouse → Judge → Review).
|
|
60
|
-
*/
|
|
61
|
-
export declare abstract class Seeder {
|
|
62
|
-
dependencies?: string[];
|
|
63
|
-
abstract run(): Promise<void> | void;
|
|
64
|
-
protected call(other: new () => Seeder): Promise<void>;
|
|
65
|
-
}
|
package/dist/custom/audits.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create the `model_audits` table used by the `useAudit` ORM trait.
|
|
3
|
-
*
|
|
4
|
-
* The trait writes one row per create/update/delete on any model that
|
|
5
|
-
* declares `traits: { useAudit: true }`. The schema is intentionally
|
|
6
|
-
* polymorphic — `auditable_type` + `auditable_id` rather than per-table
|
|
7
|
-
* audit columns — so adding the trait to a new model never requires a
|
|
8
|
-
* follow-up migration.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { createModelAuditsTable } from '@stacksjs/database'
|
|
13
|
-
* await createModelAuditsTable() // idempotent — checks before writing
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function createModelAuditsTable(): Promise<void>;
|
package/dist/custom/errors.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createErrorsTable(): Promise<void>;
|
package/dist/custom/index.d.ts
DELETED
package/dist/custom/jobs.d.ts
DELETED
package/dist/database.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { createQueryBuilder } from '@stacksjs/query-builder';
|
|
2
|
-
import type { QueryBuilderConfig, StacksDialect } from '@stacksjs/query-builder';
|
|
3
|
-
/**
|
|
4
|
-
* Create a database connection with the given options
|
|
5
|
-
*/
|
|
6
|
-
export declare function createDatabase(options: DatabaseOptions): Database;
|
|
7
|
-
/**
|
|
8
|
-
* Create a SQLite database connection
|
|
9
|
-
*/
|
|
10
|
-
export declare function createSqliteDatabase(database: string, options?: Partial<Omit<DatabaseOptions, 'driver' | 'connection'>>): Database;
|
|
11
|
-
/**
|
|
12
|
-
* Create a PostgreSQL database connection
|
|
13
|
-
*/
|
|
14
|
-
export declare function createPostgresDatabase(connection: DatabaseConnectionConfig, options?: Partial<Omit<DatabaseOptions, 'driver' | 'connection'>>): Database;
|
|
15
|
-
/**
|
|
16
|
-
* Create a MySQL database connection
|
|
17
|
-
*/
|
|
18
|
-
export declare function createMysqlDatabase(connection: DatabaseConnectionConfig, options?: Partial<Omit<DatabaseOptions, 'driver' | 'connection'>>): Database;
|
|
19
|
-
export declare interface DatabaseConnectionConfig {
|
|
20
|
-
database: string
|
|
21
|
-
host?: string
|
|
22
|
-
port?: number
|
|
23
|
-
username?: string
|
|
24
|
-
password?: string
|
|
25
|
-
url?: string
|
|
26
|
-
}
|
|
27
|
-
export declare interface DatabaseOptions {
|
|
28
|
-
driver: StacksDialect
|
|
29
|
-
connection: DatabaseConnectionConfig
|
|
30
|
-
verbose?: boolean
|
|
31
|
-
timestamps?: {
|
|
32
|
-
createdAt?: string
|
|
33
|
-
updatedAt?: string
|
|
34
|
-
defaultOrderColumn?: string
|
|
35
|
-
}
|
|
36
|
-
softDeletes?: {
|
|
37
|
-
enabled?: boolean
|
|
38
|
-
column?: string
|
|
39
|
-
defaultFilter?: boolean
|
|
40
|
-
}
|
|
41
|
-
hooks?: QueryBuilderConfig['hooks']
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Database class for managing database connections
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* // Initialize with SQLite
|
|
49
|
-
* const db = new Database({
|
|
50
|
-
* driver: 'sqlite',
|
|
51
|
-
* connection: { database: 'database/app.sqlite' }
|
|
52
|
-
* })
|
|
53
|
-
*
|
|
54
|
-
* // Initialize with PostgreSQL
|
|
55
|
-
* const db = new Database({
|
|
56
|
-
* driver: 'postgres',
|
|
57
|
-
* connection: {
|
|
58
|
-
* database: 'myapp',
|
|
59
|
-
* host: 'localhost',
|
|
60
|
-
* port: 5432,
|
|
61
|
-
* username: 'postgres',
|
|
62
|
-
* password: 'secret'
|
|
63
|
-
* }
|
|
64
|
-
* })
|
|
65
|
-
*
|
|
66
|
-
* // Use the query builder
|
|
67
|
-
* const users = await db.query.selectFrom('users').where('active', '=', true).get()
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export declare class Database {
|
|
71
|
-
constructor(options: DatabaseOptions);
|
|
72
|
-
get driver(): StacksDialect;
|
|
73
|
-
get connection(): DatabaseConnectionConfig;
|
|
74
|
-
get isInitialized(): boolean;
|
|
75
|
-
get query(): ReturnType<typeof createQueryBuilder>;
|
|
76
|
-
initialize(): void;
|
|
77
|
-
switchDriver(driver: StacksDialect, connection: DatabaseConnectionConfig): void;
|
|
78
|
-
close(): Promise<void>;
|
|
79
|
-
static fromConfig(config: {
|
|
80
|
-
default: StacksDialect
|
|
81
|
-
connections: {
|
|
82
|
-
sqlite?: { database: string }
|
|
83
|
-
mysql?: { name: string, host?: string, port?: number, username?: string, password?: string }
|
|
84
|
-
singlestore?: { name: string, host?: string, port?: number, username?: string, password?: string }
|
|
85
|
-
postgres?: { name: string, host?: string, port?: number, username?: string, password?: string }
|
|
86
|
-
}
|
|
87
|
-
}, env?: string): Database;
|
|
88
|
-
static fromEnv(): Database;
|
|
89
|
-
}
|
package/dist/defaults.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get default connection config for a given database driver.
|
|
3
|
-
* Reads from the typed env proxy so values are auto-coerced.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getConnectionDefaults(driver: string, envProxy?: Record<string, any>): ConnectionDefaults;
|
|
6
|
-
/**
|
|
7
|
-
* Database Defaults & Constants
|
|
8
|
-
*
|
|
9
|
-
* Centralizes all hardcoded default values for database connections
|
|
10
|
-
* so they are defined once and easily discoverable.
|
|
11
|
-
*/
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// HOST / PORT DEFAULTS
|
|
14
|
-
// ============================================================================
|
|
15
|
-
export declare const DB_HOST_DEFAULT: '127.0.0.1';
|
|
16
|
-
export declare const DB_PORTS: {
|
|
17
|
-
mysql: 3306;
|
|
18
|
-
postgres: 5432;
|
|
19
|
-
sqlite: 0
|
|
20
|
-
};
|
|
21
|
-
export declare const DB_NAMES: {
|
|
22
|
-
default: 'stacks';
|
|
23
|
-
sqlitePath: 'database/stacks.sqlite';
|
|
24
|
-
sqliteTestingPath: 'database/stacks_testing.sqlite'
|
|
25
|
-
};
|
|
26
|
-
export declare const DB_USERS: {
|
|
27
|
-
mysql: 'root';
|
|
28
|
-
postgres: 'postgres';
|
|
29
|
-
sqlite: ''
|
|
30
|
-
};
|
|
31
|
-
export declare const REDIS_DEFAULTS: {
|
|
32
|
-
host: 'localhost';
|
|
33
|
-
port: 6379
|
|
34
|
-
};
|
|
35
|
-
export declare const AWS_DEFAULTS: {
|
|
36
|
-
region: 'us-east-1'
|
|
37
|
-
};
|
|
38
|
-
// ============================================================================
|
|
39
|
-
// CONNECTION CONFIG BUILDERS
|
|
40
|
-
// ============================================================================
|
|
41
|
-
export declare interface ConnectionDefaults {
|
|
42
|
-
database: string
|
|
43
|
-
host?: string
|
|
44
|
-
port?: number
|
|
45
|
-
username?: string
|
|
46
|
-
password?: string
|
|
47
|
-
prefix?: string
|
|
48
|
-
}
|
package/dist/driver-config.d.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import type { StacksDialect } from '@stacksjs/query-builder';
|
|
2
|
-
/**
|
|
3
|
-
* Get the connection string for a given driver and configuration
|
|
4
|
-
*/
|
|
5
|
-
export declare function getConnectionString(driver: StacksDialect, config: DatabaseConnections[keyof DatabaseConnections]): string;
|
|
6
|
-
/**
|
|
7
|
-
* Validate driver configuration
|
|
8
|
-
*/
|
|
9
|
-
export declare function validateDriverConfig(driver: StacksDialect, config: DatabaseConnections[keyof DatabaseConnections]): { valid: boolean, errors: string[] };
|
|
10
|
-
/**
|
|
11
|
-
* Merge user configuration with defaults
|
|
12
|
-
*/
|
|
13
|
-
export declare function mergeWithDefaults<T extends keyof DatabaseConnections>(driver: T, config: Partial<DatabaseConnections[T]>): DatabaseConnections[T];
|
|
14
|
-
/**
|
|
15
|
-
* Get the appropriate configuration for a driver from environment variables
|
|
16
|
-
*/
|
|
17
|
-
export declare function getConfigFromEnv(driver: StacksDialect): DatabaseConnections[keyof DatabaseConnections];
|
|
18
|
-
/**
|
|
19
|
-
* Detect the best available driver based on environment
|
|
20
|
-
*/
|
|
21
|
-
export declare function detectDriver(): StacksDialect;
|
|
22
|
-
/**
|
|
23
|
-
* Default configuration values for each driver
|
|
24
|
-
* @defaultValue
|
|
25
|
-
* ```ts
|
|
26
|
-
* {
|
|
27
|
-
* sqlite: { database: 'database/stacks.sqlite', prefix: '' },
|
|
28
|
-
* mysql: {
|
|
29
|
-
* name: 'stacks',
|
|
30
|
-
* host: '127.0.0.1',
|
|
31
|
-
* port: 3306,
|
|
32
|
-
* username: 'root',
|
|
33
|
-
* password: '',
|
|
34
|
-
* prefix: '',
|
|
35
|
-
* charset: 'utf8mb4',
|
|
36
|
-
* collation: 'utf8mb4_unicode_ci'
|
|
37
|
-
* },
|
|
38
|
-
* singlestore: {
|
|
39
|
-
* name: 'stacks',
|
|
40
|
-
* host: '127.0.0.1',
|
|
41
|
-
* port: 3306,
|
|
42
|
-
* username: 'root',
|
|
43
|
-
* password: '',
|
|
44
|
-
* prefix: '',
|
|
45
|
-
* charset: 'utf8mb4',
|
|
46
|
-
* ssl: false
|
|
47
|
-
* },
|
|
48
|
-
* postgres: {
|
|
49
|
-
* name: 'stacks',
|
|
50
|
-
* host: '127.0.0.1',
|
|
51
|
-
* port: 5432,
|
|
52
|
-
* username: 'postgres',
|
|
53
|
-
* password: '',
|
|
54
|
-
* prefix: '',
|
|
55
|
-
* schema: 'public'
|
|
56
|
-
* }
|
|
57
|
-
* }
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export declare const driverDefaults: Record<StacksDialect, Partial<SqliteConfig | MysqlConfig | SinglestoreConfig | PostgresConfig | DynamoDbConfig>>;
|
|
61
|
-
/**
|
|
62
|
-
* SQLite specific configuration
|
|
63
|
-
*/
|
|
64
|
-
export declare interface SqliteConfig {
|
|
65
|
-
database: string
|
|
66
|
-
prefix?: string
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* MySQL specific configuration
|
|
70
|
-
*/
|
|
71
|
-
export declare interface MysqlConfig {
|
|
72
|
-
name: string
|
|
73
|
-
host?: string
|
|
74
|
-
port?: number
|
|
75
|
-
username?: string
|
|
76
|
-
password?: string
|
|
77
|
-
prefix?: string
|
|
78
|
-
charset?: string
|
|
79
|
-
collation?: string
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* SingleStore specific configuration.
|
|
83
|
-
*
|
|
84
|
-
* SingleStore (formerly MemSQL) speaks the MySQL wire protocol, so it shares
|
|
85
|
-
* MySQL's connection shape. It diverges only in DDL (distributed tables with
|
|
86
|
-
* SHARD KEY / SORT KEY, no foreign keys) — handled by the migration generator,
|
|
87
|
-
* not by the connection layer.
|
|
88
|
-
*/
|
|
89
|
-
export declare interface SinglestoreConfig {
|
|
90
|
-
name: string
|
|
91
|
-
host?: string
|
|
92
|
-
port?: number
|
|
93
|
-
username?: string
|
|
94
|
-
password?: string
|
|
95
|
-
prefix?: string
|
|
96
|
-
charset?: string
|
|
97
|
-
ssl?: boolean
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* PostgreSQL specific configuration
|
|
101
|
-
*/
|
|
102
|
-
export declare interface PostgresConfig {
|
|
103
|
-
name: string
|
|
104
|
-
host?: string
|
|
105
|
-
port?: number
|
|
106
|
-
username?: string
|
|
107
|
-
password?: string
|
|
108
|
-
prefix?: string
|
|
109
|
-
schema?: string
|
|
110
|
-
sslMode?: 'disable' | 'require' | 'verify-ca' | 'verify-full'
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* DynamoDB specific configuration
|
|
114
|
-
*/
|
|
115
|
-
export declare interface DynamoDbConfig {
|
|
116
|
-
key: string
|
|
117
|
-
secret: string
|
|
118
|
-
region?: string
|
|
119
|
-
prefix?: string
|
|
120
|
-
endpoint?: string
|
|
121
|
-
tableName?: string
|
|
122
|
-
singleTable?: {
|
|
123
|
-
enabled?: boolean
|
|
124
|
-
pkAttribute?: string
|
|
125
|
-
skAttribute?: string
|
|
126
|
-
entityTypeAttribute?: string
|
|
127
|
-
keyDelimiter?: string
|
|
128
|
-
gsiCount?: number
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* All database connections configuration
|
|
133
|
-
*/
|
|
134
|
-
export declare interface DatabaseConnections {
|
|
135
|
-
sqlite?: SqliteConfig
|
|
136
|
-
mysql?: MysqlConfig
|
|
137
|
-
singlestore?: SinglestoreConfig
|
|
138
|
-
postgres?: PostgresConfig
|
|
139
|
-
dynamodb?: DynamoDbConfig
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Full database configuration
|
|
143
|
-
*/
|
|
144
|
-
export declare interface FullDatabaseConfig {
|
|
145
|
-
default: StacksDialect
|
|
146
|
-
connections: DatabaseConnections
|
|
147
|
-
migrations?: string
|
|
148
|
-
migrationLocks?: string
|
|
149
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// bun-query-builder utilities are used via db.unsafe() for raw SQL
|
|
2
|
-
export declare function getTraitTables(): string[];
|
|
3
|
-
// SQLite/MySQL version
|
|
4
|
-
export declare function createPasskeyMigration(): Promise<void>;
|
|
5
|
-
// PostgreSQL version
|
|
6
|
-
export declare function createPostgresPasskeyMigration(): Promise<void>;
|
|
7
|
-
export declare function createTaggableTable(): Promise<void>;
|
|
8
|
-
export declare function createPostgresTagsTable(): Promise<void>;
|
|
9
|
-
// SQLite/MySQL version
|
|
10
|
-
export declare function createCategorizableTable(): Promise<void>;
|
|
11
|
-
// PostgreSQL version
|
|
12
|
-
export declare function createPostgresCategorizableTable(): Promise<void>;
|
|
13
|
-
// SQLite/MySQL version
|
|
14
|
-
export declare function createCommentablesTable(options?: {
|
|
15
|
-
requiresApproval?: boolean
|
|
16
|
-
reportable?: boolean
|
|
17
|
-
votable?: boolean
|
|
18
|
-
requiresAuth?: boolean
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
// PostgreSQL version
|
|
21
|
-
export declare function createPostgresCommentsTable(): Promise<void>;
|
|
22
|
-
export declare function dropCommonTables(): Promise<void>;
|
|
23
|
-
export declare function truncateMigrationTables(): Promise<void>;
|
|
24
|
-
export declare function dropMigrationTables(): Promise<void>;
|
|
25
|
-
export declare function createCommentUpvoteMigration(): Promise<void>;
|
|
26
|
-
export declare function createPostgresCommentUpvoteMigration(): Promise<void>;
|
|
27
|
-
export declare function createCommentablesPivotTable(): Promise<void>;
|
|
28
|
-
export declare function createPostgresCommentablesPivotTable(): Promise<void>;
|
|
29
|
-
export declare function createTaggablesTable(): Promise<void>;
|
|
30
|
-
export declare function createPostgresTaggablesTable(): Promise<void>;
|
|
31
|
-
export declare function createQueryLogsTable(): Promise<void>;
|
|
32
|
-
// PostgreSQL version
|
|
33
|
-
export declare function createPostgresQueryLogsTable(): Promise<void>;
|