@stacksjs/database 0.75.520 → 0.75.524
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/auth-tables.d.ts +1 -0
- package/dist/column.d.ts +1 -0
- package/dist/database.d.ts +3 -0
- package/dist/datetime-columns.d.ts +1 -0
- package/dist/defaults.d.ts +12 -12
- package/dist/drivers/dynamodb.d.ts +24 -0
- package/dist/drivers/helpers.d.ts +1 -0
- package/dist/managed-columns.d.ts +1 -0
- package/dist/migration-ledger.d.ts +0 -4
- package/dist/migration-lock.d.ts +1 -0
- package/dist/migration-path.d.ts +4 -3
- package/dist/notification-tables.d.ts +1 -0
- package/dist/query-log-bindings.d.ts +1 -0
- package/dist/query-logger.d.ts +1 -0
- package/dist/rbac-tables.d.ts +1 -0
- package/dist/safe-migrations.d.ts +1 -0
- package/dist/table.d.ts +1 -0
- package/dist/transaction-context.d.ts +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/unique-audit.d.ts +1 -0
- package/dist/utils.d.ts +3 -3
- package/dist/uuid-columns.d.ts +1 -0
- package/package.json +16 -16
package/dist/auth-tables.d.ts
CHANGED
package/dist/column.d.ts
CHANGED
package/dist/database.d.ts
CHANGED
|
@@ -77,6 +77,9 @@ export declare interface DatabaseOptions {
|
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
export declare class Database {
|
|
80
|
+
private _queryBuilder;
|
|
81
|
+
private _options;
|
|
82
|
+
private _initialized;
|
|
80
83
|
constructor(options: DatabaseOptions);
|
|
81
84
|
get driver(): StacksDialect;
|
|
82
85
|
get connection(): DatabaseConnectionConfig;
|
package/dist/defaults.d.ts
CHANGED
|
@@ -14,26 +14,26 @@ export declare function getConnectionDefaults(driver: string, envProxy?: Record<
|
|
|
14
14
|
// ============================================================================
|
|
15
15
|
export declare const DB_HOST_DEFAULT: '127.0.0.1';
|
|
16
16
|
export declare const DB_PORTS: {
|
|
17
|
-
mysql: 3306;
|
|
18
|
-
postgres: 5432;
|
|
19
|
-
sqlite: 0
|
|
17
|
+
readonly mysql: 3306;
|
|
18
|
+
readonly postgres: 5432;
|
|
19
|
+
readonly sqlite: 0
|
|
20
20
|
};
|
|
21
21
|
export declare const DB_NAMES: {
|
|
22
|
-
default: 'stacks';
|
|
23
|
-
sqlitePath: 'database/stacks.sqlite';
|
|
24
|
-
sqliteTestingPath: 'database/stacks_testing.sqlite'
|
|
22
|
+
readonly default: 'stacks';
|
|
23
|
+
readonly sqlitePath: 'database/stacks.sqlite';
|
|
24
|
+
readonly sqliteTestingPath: 'database/stacks_testing.sqlite'
|
|
25
25
|
};
|
|
26
26
|
export declare const DB_USERS: {
|
|
27
|
-
mysql: 'root';
|
|
28
|
-
postgres: 'postgres';
|
|
29
|
-
sqlite: ''
|
|
27
|
+
readonly mysql: 'root';
|
|
28
|
+
readonly postgres: 'postgres';
|
|
29
|
+
readonly sqlite: ''
|
|
30
30
|
};
|
|
31
31
|
export declare const REDIS_DEFAULTS: {
|
|
32
|
-
host: 'localhost';
|
|
33
|
-
port: 6379
|
|
32
|
+
readonly host: 'localhost';
|
|
33
|
+
readonly port: 6379
|
|
34
34
|
};
|
|
35
35
|
export declare const AWS_DEFAULTS: {
|
|
36
|
-
region: 'us-east-1'
|
|
36
|
+
readonly region: 'us-east-1'
|
|
37
37
|
};
|
|
38
38
|
// ============================================================================
|
|
39
39
|
// CONNECTION CONFIG BUILDERS
|
|
@@ -149,6 +149,22 @@ export type DynamoItem = Record<string, DynamoAttributeValue>;
|
|
|
149
149
|
* Entity-centric query builder for DynamoDB
|
|
150
150
|
*/
|
|
151
151
|
export declare class EntityQueryBuilder<T = unknown> {
|
|
152
|
+
private client;
|
|
153
|
+
private tableName;
|
|
154
|
+
private pkAttribute;
|
|
155
|
+
private skAttribute;
|
|
156
|
+
private entityTypeAttr;
|
|
157
|
+
private delimiter;
|
|
158
|
+
private _entityType;
|
|
159
|
+
private _pkValue;
|
|
160
|
+
private _skCondition;
|
|
161
|
+
private _indexName;
|
|
162
|
+
private _projectionAttrs;
|
|
163
|
+
private _filterConditions;
|
|
164
|
+
private _limitValue;
|
|
165
|
+
private _scanForward;
|
|
166
|
+
private _consistentRead;
|
|
167
|
+
private _startKey;
|
|
152
168
|
constructor(client: DynamoSdkClient | undefined, tableName: string, config: { pkAttribute: string, skAttribute: string, entityTypeAttribute: string, keyDelimiter: string });
|
|
153
169
|
entity(entityType: string): this;
|
|
154
170
|
pk(value: string): this;
|
|
@@ -173,6 +189,14 @@ export declare class EntityQueryBuilder<T = unknown> {
|
|
|
173
189
|
* DynamoDB client with entity-centric API
|
|
174
190
|
*/
|
|
175
191
|
declare class DynamoClient {
|
|
192
|
+
private client;
|
|
193
|
+
private tableName;
|
|
194
|
+
private pkAttribute;
|
|
195
|
+
private skAttribute;
|
|
196
|
+
private entityTypeAttr;
|
|
197
|
+
private delimiter;
|
|
198
|
+
private entityMappings;
|
|
199
|
+
private _configured;
|
|
176
200
|
connection(config: DynamoConnectionConfig): this;
|
|
177
201
|
isConfigured(): boolean;
|
|
178
202
|
setClient(client: DynamoSdkClient): this;
|
|
@@ -155,10 +155,6 @@ export declare function reconcileMigrationLedger(options?: {
|
|
|
155
155
|
|
|
156
156
|
regenerated?: { removed: readonly string[], written: readonly string[] }
|
|
157
157
|
}): Promise<ReconcileResult>;
|
|
158
|
-
/** `["`[]?ident["`\]]?` — accepts every identifier quoting style in play. */
|
|
159
|
-
declare const IDENT: string;
|
|
160
|
-
declare const Q: (pattern: string) => RegExp;
|
|
161
|
-
declare const DML: string;
|
|
162
158
|
/**
|
|
163
159
|
* A schema change a migration makes that can be confirmed by looking at the
|
|
164
160
|
* live database. Deliberately narrow: only effects whose presence is
|
package/dist/migration-lock.d.ts
CHANGED
package/dist/migration-path.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
1
2
|
/**
|
|
2
3
|
* Select one immutable SQL corpus per dialect when a project targets more
|
|
3
4
|
* than one database engine. Existing single-dialect projects retain the flat
|
|
@@ -9,7 +10,7 @@ export declare function resolveMigrationDirectory(dialect: string, options?: {
|
|
|
9
10
|
configured?: string
|
|
10
11
|
snapshotDir?: string
|
|
11
12
|
}): string;
|
|
12
|
-
export declare function relativeMigrationDirectory(directory: string, cwd?:
|
|
13
|
+
export declare function relativeMigrationDirectory(directory: string, cwd?: ReturnType<typeof process.cwd>): string;
|
|
13
14
|
/**
|
|
14
15
|
* Where the model snapshot lives, as an absolute path.
|
|
15
16
|
*
|
|
@@ -23,7 +24,7 @@ export declare function relativeMigrationDirectory(directory: string, cwd?: unkn
|
|
|
23
24
|
* `DB_SNAPSHOT_PATH` points it at a shared directory that survives the release
|
|
24
25
|
* flip, mirroring `DB_MIGRATIONS_PATH` above. Absolute paths are honoured.
|
|
25
26
|
*/
|
|
26
|
-
export declare function resolveSnapshotDirectory(cwd?:
|
|
27
|
+
export declare function resolveSnapshotDirectory(cwd?: ReturnType<typeof process.cwd>): string;
|
|
27
28
|
/**
|
|
28
29
|
* The same directory, expressed the way bun-query-builder wants it.
|
|
29
30
|
*
|
|
@@ -34,6 +35,6 @@ export declare function resolveSnapshotDirectory(cwd?: unknown): string;
|
|
|
34
35
|
* exact failure this is meant to remove. Relativising it first makes the library's
|
|
35
36
|
* own join land where the operator asked, including via `..`.
|
|
36
37
|
*/
|
|
37
|
-
export declare function snapshotDirForQueryBuilder(cwd?:
|
|
38
|
+
export declare function snapshotDirForQueryBuilder(cwd?: ReturnType<typeof process.cwd>): string;
|
|
38
39
|
/** True when the snapshot directory is not the in-project default. */
|
|
39
40
|
export declare function snapshotDirectoryIsShared(): boolean;
|
package/dist/query-logger.d.ts
CHANGED
package/dist/rbac-tables.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export declare function rolePermissionsTableSql(sql: SqlHelpers): string;
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function migrateRbacTables(options?: { verbose?: boolean }): Promise<{ success: boolean, error?: string }>;
|
|
17
17
|
declare type SqlHelpers = ReturnType<typeof sqlHelpers>;
|
|
18
|
+
export {};
|
package/dist/table.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
export declare function sql(strings: TemplateStringsArray, ...values: unknown[]): Sql;
|
|
31
|
+
export declare namespace sql {
|
|
32
|
+
let raw: (value: string) => { raw: string };
|
|
33
|
+
let ref: (column: string) => { raw: string };
|
|
34
|
+
let literal: (value: unknown) => { raw: string };
|
|
35
|
+
}
|
|
31
36
|
/**
|
|
32
37
|
* Runtime implementation behind `db.fn`. bun-query-builder has no
|
|
33
38
|
* top-level `fn` accessor (its select pipeline consumes plain SQL
|
package/dist/unique-audit.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -128,9 +128,9 @@ export declare const QB_SNAPSHOT_DIR: 'storage/framework/database';
|
|
|
128
128
|
* this global filter would incorrectly scope every raw table query.
|
|
129
129
|
*/
|
|
130
130
|
export declare const RAW_QUERY_SOFT_DELETE_CONFIG: {
|
|
131
|
-
enabled: false;
|
|
132
|
-
column: 'deleted_at';
|
|
133
|
-
defaultFilter: true
|
|
131
|
+
readonly enabled: false;
|
|
132
|
+
readonly column: 'deleted_at';
|
|
133
|
+
readonly defaultFilter: true
|
|
134
134
|
};
|
|
135
135
|
/**
|
|
136
136
|
* Lazy query-builder facade. Own properties bypass the Proxy prototype while
|
package/dist/uuid-columns.d.ts
CHANGED
|
@@ -21,3 +21,4 @@ export declare function ensureUuidColumns(sql: SqlHelpers, options?: { verbose?:
|
|
|
21
21
|
/** Convenience wrapper resolving dialect helpers from `DB_CONNECTION`, for call sites that don't already have a `SqlHelpers` instance. */
|
|
22
22
|
export declare function ensureUuidColumnsForCurrentDriver(options?: { verbose?: boolean }): Promise<void>;
|
|
23
23
|
declare type SqlHelpers = ReturnType<typeof sqlHelpers>;
|
|
24
|
+
export {};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/database",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.524",
|
|
6
6
|
"description": "The Stacks database integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -66,26 +66,26 @@
|
|
|
66
66
|
"prepublishOnly": "bun run build"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@stacksjs/config": "0.75.
|
|
70
|
-
"@stacksjs/env": "0.75.
|
|
71
|
-
"@stacksjs/error-handling": "0.75.
|
|
72
|
-
"@stacksjs/faker": "0.75.
|
|
73
|
-
"@stacksjs/features": "0.75.
|
|
74
|
-
"@stacksjs/logging": "0.75.
|
|
75
|
-
"@stacksjs/model-meta": "0.75.
|
|
76
|
-
"@stacksjs/path": "0.75.
|
|
77
|
-
"@stacksjs/query-builder": "0.75.
|
|
78
|
-
"@stacksjs/security": "0.75.
|
|
79
|
-
"@stacksjs/storage": "0.75.
|
|
80
|
-
"@stacksjs/strings": "0.75.
|
|
69
|
+
"@stacksjs/config": "0.75.524",
|
|
70
|
+
"@stacksjs/env": "0.75.524",
|
|
71
|
+
"@stacksjs/error-handling": "0.75.524",
|
|
72
|
+
"@stacksjs/faker": "0.75.524",
|
|
73
|
+
"@stacksjs/features": "0.75.524",
|
|
74
|
+
"@stacksjs/logging": "0.75.524",
|
|
75
|
+
"@stacksjs/model-meta": "0.75.524",
|
|
76
|
+
"@stacksjs/path": "0.75.524",
|
|
77
|
+
"@stacksjs/query-builder": "0.75.524",
|
|
78
|
+
"@stacksjs/security": "0.75.524",
|
|
79
|
+
"@stacksjs/storage": "0.75.524",
|
|
80
|
+
"@stacksjs/strings": "0.75.524",
|
|
81
81
|
"@stacksjs/ts-validation": "^0.5.7",
|
|
82
82
|
"bun-query-builder": "^0.3.38",
|
|
83
83
|
"dynamodb-tooling": "^0.3.6"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@stacksjs/cli": "0.75.
|
|
87
|
-
"@stacksjs/router": "0.75.
|
|
88
|
-
"@stacksjs/utils": "0.75.
|
|
86
|
+
"@stacksjs/cli": "0.75.524",
|
|
87
|
+
"@stacksjs/router": "0.75.524",
|
|
88
|
+
"@stacksjs/utils": "0.75.524",
|
|
89
89
|
"better-dx": "^0.2.24"
|
|
90
90
|
}
|
|
91
91
|
}
|