@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.
@@ -163,3 +163,4 @@ export declare function migrateAuthTables(options?: { verbose?: boolean }): Prom
163
163
  */
164
164
  export declare const AUTH_TABLES: readonly string[];
165
165
  declare type SqlHelpers = ReturnType<typeof sqlHelpers>;
166
+ export {};
package/dist/column.d.ts CHANGED
@@ -15,3 +15,4 @@ export declare class Column {
15
15
  primary(): this;
16
16
  autoIncrement(): this;
17
17
  }
18
+ export {};
@@ -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;
@@ -82,3 +82,4 @@ export declare interface AwareTimestampColumn {
82
82
  table: string
83
83
  column: string
84
84
  }
85
+ export {};
@@ -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;
@@ -41,3 +41,4 @@ declare interface Range {
41
41
  }
42
42
  /** An attribute map, keyed by name, as a model definition carries it. */
43
43
  declare type AttributesWithRules = Record<string, { validation: { rule: ValidationType } } | undefined>;
44
+ export {};
@@ -52,3 +52,4 @@ export declare const USERS_GUARANTEED_COLUMNS: readonly string[];
52
52
  * without it, and several callers only have the classified operation.
53
53
  */
54
54
  declare type ColumnOp = Pick<MigrationOperation, 'kind' | 'table' | 'column'> & { sql?: string }
55
+ export {};
@@ -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
@@ -39,3 +39,4 @@ declare interface LockStatementRunner {
39
39
  unsafe: (sql: string, params?: unknown[]) => PromiseLike<unknown> | unknown
40
40
  }
41
41
  export type Dialect = 'sqlite' | 'mysql' | 'vitess' | 'postgres';
42
+ export {};
@@ -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?: unknown): string;
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?: unknown): string;
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?: unknown): string;
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;
@@ -102,3 +102,4 @@ export type NotificationTableName = typeof notificationTableNames[number];
102
102
  * against a table that exists and does nothing at all.
103
103
  */
104
104
  export type NotificationTablePreflightReason = 'no-create-statement' | 'referenced-before-create';
105
+ export {};
@@ -118,3 +118,4 @@ export declare interface PersistedQueryLogValues {
118
118
  bindings: string
119
119
  error?: string
120
120
  }
121
+ export {};
@@ -37,3 +37,4 @@ declare interface LogEvent {
37
37
  */
38
38
  // eslint-disable-next-line pickier/no-unused-vars
39
39
  declare type QueryTracker = (query: string, durationMs?: number, connection?: string) => void;
40
+ export {};
@@ -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 {};
@@ -71,3 +71,4 @@ declare interface AddColumnSafelyOptions {
71
71
  batchSize?: number
72
72
  }
73
73
  declare type Database = typeof db;
74
+ export {};
package/dist/table.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Column } from './column';
2
2
  export declare class Table {
3
+ private columns;
3
4
  increments(name: string): Column;
4
5
  string(name: string, varchar?: number): Column;
5
6
  timestamps(): void;
@@ -52,3 +52,4 @@ export declare function __pendingAfterCommitCount(): number;
52
52
  * are logged via `onError` if the scope supplied one.
53
53
  */
54
54
  declare type AfterCommitCallback = () => Promise<void> | void;
55
+ export {};
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
@@ -58,3 +58,4 @@ export declare interface UniqueAuditResult {
58
58
  skippedTables: string[]
59
59
  }
60
60
  declare type Dialect = 'sqlite' | 'mysql' | 'postgres' | 'other';
61
+ export {};
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
@@ -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.520",
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.520",
70
- "@stacksjs/env": "0.75.520",
71
- "@stacksjs/error-handling": "0.75.520",
72
- "@stacksjs/faker": "0.75.520",
73
- "@stacksjs/features": "0.75.520",
74
- "@stacksjs/logging": "0.75.520",
75
- "@stacksjs/model-meta": "0.75.520",
76
- "@stacksjs/path": "0.75.520",
77
- "@stacksjs/query-builder": "0.75.520",
78
- "@stacksjs/security": "0.75.520",
79
- "@stacksjs/storage": "0.75.520",
80
- "@stacksjs/strings": "0.75.520",
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.520",
87
- "@stacksjs/router": "0.75.520",
88
- "@stacksjs/utils": "0.75.520",
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
  }