forge-sql-orm 2.0.30 → 2.1.1
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/README.md +1410 -81
- package/dist/ForgeSQLORM.js +1456 -60
- package/dist/ForgeSQLORM.js.map +1 -1
- package/dist/ForgeSQLORM.mjs +1440 -61
- package/dist/ForgeSQLORM.mjs.map +1 -1
- package/dist/core/ForgeSQLAnalyseOperations.d.ts +1 -1
- package/dist/core/ForgeSQLAnalyseOperations.d.ts.map +1 -1
- package/dist/core/ForgeSQLCacheOperations.d.ts +119 -0
- package/dist/core/ForgeSQLCacheOperations.d.ts.map +1 -0
- package/dist/core/ForgeSQLCrudOperations.d.ts +38 -22
- package/dist/core/ForgeSQLCrudOperations.d.ts.map +1 -1
- package/dist/core/ForgeSQLORM.d.ts +248 -13
- package/dist/core/ForgeSQLORM.d.ts.map +1 -1
- package/dist/core/ForgeSQLQueryBuilder.d.ts +394 -19
- package/dist/core/ForgeSQLQueryBuilder.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/drizzle/extensions/additionalActions.d.ts +90 -0
- package/dist/lib/drizzle/extensions/additionalActions.d.ts.map +1 -0
- package/dist/utils/cacheContextUtils.d.ts +123 -0
- package/dist/utils/cacheContextUtils.d.ts.map +1 -0
- package/dist/utils/cacheUtils.d.ts +56 -0
- package/dist/utils/cacheUtils.d.ts.map +1 -0
- package/dist/utils/sqlUtils.d.ts +8 -0
- package/dist/utils/sqlUtils.d.ts.map +1 -1
- package/dist/webtriggers/clearCacheSchedulerTrigger.d.ts +46 -0
- package/dist/webtriggers/clearCacheSchedulerTrigger.d.ts.map +1 -0
- package/dist/webtriggers/index.d.ts +1 -0
- package/dist/webtriggers/index.d.ts.map +1 -1
- package/package.json +15 -12
- package/src/core/ForgeSQLAnalyseOperations.ts +1 -1
- package/src/core/ForgeSQLCacheOperations.ts +195 -0
- package/src/core/ForgeSQLCrudOperations.ts +49 -40
- package/src/core/ForgeSQLORM.ts +743 -34
- package/src/core/ForgeSQLQueryBuilder.ts +456 -20
- package/src/index.ts +1 -1
- package/src/lib/drizzle/extensions/additionalActions.ts +852 -0
- package/src/lib/drizzle/extensions/types.d.ts +99 -10
- package/src/utils/cacheContextUtils.ts +212 -0
- package/src/utils/cacheUtils.ts +403 -0
- package/src/utils/sqlUtils.ts +42 -0
- package/src/webtriggers/clearCacheSchedulerTrigger.ts +79 -0
- package/src/webtriggers/index.ts +1 -0
- package/dist/lib/drizzle/extensions/selectAliased.d.ts +0 -9
- package/dist/lib/drizzle/extensions/selectAliased.d.ts.map +0 -1
- package/src/lib/drizzle/extensions/selectAliased.ts +0 -72
|
@@ -1,30 +1,58 @@
|
|
|
1
1
|
import { UpdateQueryResponse } from "@forge/sql";
|
|
2
2
|
import { SqlParameters } from "@forge/sql/out/sql-statement";
|
|
3
|
-
import { AnyMySqlSelectQueryBuilder, AnyMySqlTable, MySqlSelectBuilder } from "drizzle-orm/mysql-core";
|
|
3
|
+
import { AnyMySqlSelectQueryBuilder, AnyMySqlTable, MySqlSelectBuilder, MySqlTable } from "drizzle-orm/mysql-core";
|
|
4
4
|
import { MySqlSelectDynamic, type SelectedFields } from "drizzle-orm/mysql-core/query-builders/select.types";
|
|
5
5
|
import { InferInsertModel, Query, SQL } from "drizzle-orm";
|
|
6
|
-
import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT } from "drizzle-orm/mysql-proxy
|
|
6
|
+
import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT } from "drizzle-orm/mysql-proxy";
|
|
7
7
|
import { SqlHints } from "../utils/sqlHints";
|
|
8
8
|
import { ClusterStatementRowCamelCase, ExplainAnalyzeRow, SlowQueryNormalized } from "./SystemTables";
|
|
9
|
+
import { ForgeSQLCacheOperations } from "./ForgeSQLCacheOperations";
|
|
10
|
+
import { DeleteAndEvictCacheType, ExecuteQuery, ExecuteQueryCacheable, InsertAndEvictCacheType, SelectAliasedCacheableType, SelectAliasedDistinctCacheableType, SelectAliasedDistinctType, SelectAliasedType, SelectAllDistinctFromAliasedType, SelectAllDistinctFromCacheableAliasedType, SelectAllFromAliasedType, SelectAllFromCacheableAliasedType, UpdateAndEvictCacheType } from "..";
|
|
11
|
+
import { MySqlDeleteBase, MySqlInsertBuilder, MySqlSelectBase, MySqlUpdateBuilder } from "drizzle-orm/mysql-core/query-builders";
|
|
12
|
+
import { MySqlRemoteQueryResultHKT } from "drizzle-orm/mysql-proxy";
|
|
13
|
+
import { GetSelectTableName, GetSelectTableSelection } from "drizzle-orm/query-builders/select.types";
|
|
14
|
+
import { SQLWrapper } from "drizzle-orm/sql/sql";
|
|
15
|
+
import type { MySqlQueryResultKind } from "drizzle-orm/mysql-core/session";
|
|
16
|
+
import type { WithBuilder } from "drizzle-orm/mysql-core/subquery";
|
|
17
|
+
import { WithSubquery } from "drizzle-orm/subquery";
|
|
9
18
|
/**
|
|
10
19
|
* Core interface for ForgeSQL operations.
|
|
11
20
|
* Provides access to CRUD operations, schema-level SQL operations, and query analysis capabilities.
|
|
12
21
|
*
|
|
22
|
+
* This is the main interface that developers interact with when using ForgeSQL ORM.
|
|
23
|
+
* It combines query building capabilities with database operations and caching.
|
|
24
|
+
*
|
|
13
25
|
* @interface ForgeSqlOperation
|
|
14
26
|
* @extends {QueryBuilderForgeSql}
|
|
15
27
|
*/
|
|
16
28
|
export interface ForgeSqlOperation extends QueryBuilderForgeSql {
|
|
17
29
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
* @returns {CRUDForgeSQL} Interface for performing CRUD operations
|
|
30
|
+
* Creates a new query builder for the given entity.
|
|
31
|
+
* @returns {MySqlRemoteDatabase<Record<string, unknown>>} The Drizzle database instance for building queries
|
|
21
32
|
*/
|
|
22
|
-
|
|
33
|
+
getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown>> & {
|
|
34
|
+
selectAliased: SelectAliasedType;
|
|
35
|
+
selectAliasedDistinct: SelectAliasedDistinctType;
|
|
36
|
+
executeQuery: ExecuteQuery;
|
|
37
|
+
selectAliasedCacheable: SelectAliasedCacheableType;
|
|
38
|
+
selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
|
|
39
|
+
executeQueryCacheable: ExecuteQueryCacheable;
|
|
40
|
+
insertWithCacheContext: InsertAndEvictCacheType;
|
|
41
|
+
insertAndEvictCache: InsertAndEvictCacheType;
|
|
42
|
+
updateAndEvictCache: UpdateAndEvictCacheType;
|
|
43
|
+
updateWithCacheContext: UpdateAndEvictCacheType;
|
|
44
|
+
deleteAndEvictCache: DeleteAndEvictCacheType;
|
|
45
|
+
deleteWithCacheContext: DeleteAndEvictCacheType;
|
|
46
|
+
selectFrom: SelectAllFromAliasedType;
|
|
47
|
+
selectDistinctFrom: SelectAllDistinctFromAliasedType;
|
|
48
|
+
selectFromCacheable: SelectAllFromCacheableAliasedType;
|
|
49
|
+
selectDistinctFromCacheable: SelectAllDistinctFromCacheableAliasedType;
|
|
50
|
+
};
|
|
23
51
|
/**
|
|
24
52
|
* Provides modify (Create, Update, Delete) operations with optimistic locking support.
|
|
25
|
-
* @returns {
|
|
53
|
+
* @returns {VerioningModificationForgeSQL} Interface for performing CRUD operations
|
|
26
54
|
*/
|
|
27
|
-
|
|
55
|
+
modifyWithVersioning(): VerioningModificationForgeSQL;
|
|
28
56
|
/**
|
|
29
57
|
* Provides schema-level SQL fetch operations with type safety.
|
|
30
58
|
* @returns {SchemaSqlForgeSql} Interface for executing schema-bound SQL queries
|
|
@@ -35,11 +63,27 @@ export interface ForgeSqlOperation extends QueryBuilderForgeSql {
|
|
|
35
63
|
* @returns {SchemaAnalyzeForgeSql} Interface for analyzing query performance
|
|
36
64
|
*/
|
|
37
65
|
analyze(): SchemaAnalyzeForgeSql;
|
|
66
|
+
/**
|
|
67
|
+
* Provides schema-level SQL operations with optimistic locking/versioning and automatic cache eviction.
|
|
68
|
+
*
|
|
69
|
+
* This method returns operations that use `modifyWithVersioning()` internally, providing:
|
|
70
|
+
* - Optimistic locking support
|
|
71
|
+
* - Automatic version field management
|
|
72
|
+
* - Cache eviction after successful operations
|
|
73
|
+
*
|
|
74
|
+
* @returns {ForgeSQLCacheOperations} Interface for executing versioned SQL operations with cache management
|
|
75
|
+
*/
|
|
76
|
+
modifyWithVersioningAndEvictCache(): ForgeSQLCacheOperations;
|
|
38
77
|
}
|
|
39
78
|
/**
|
|
40
79
|
* Interface for Query Builder operations.
|
|
41
80
|
* Provides access to the underlying Drizzle ORM query builder with enhanced functionality.
|
|
42
81
|
*
|
|
82
|
+
* This interface extends Drizzle's query building capabilities with:
|
|
83
|
+
* - Field aliasing to prevent name collisions in joins
|
|
84
|
+
* - Caching support for select operations
|
|
85
|
+
* - Automatic cache eviction for modify operations
|
|
86
|
+
*
|
|
43
87
|
* @interface QueryBuilderForgeSql
|
|
44
88
|
*/
|
|
45
89
|
export interface QueryBuilderForgeSql {
|
|
@@ -47,7 +91,20 @@ export interface QueryBuilderForgeSql {
|
|
|
47
91
|
* Creates a new query builder for the given entity.
|
|
48
92
|
* @returns {MySqlRemoteDatabase<Record<string, unknown>>} The Drizzle database instance for building queries
|
|
49
93
|
*/
|
|
50
|
-
getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown
|
|
94
|
+
getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown>> & {
|
|
95
|
+
selectAliased: SelectAliasedType;
|
|
96
|
+
selectAliasedDistinct: SelectAliasedDistinctType;
|
|
97
|
+
executeQuery: ExecuteQuery;
|
|
98
|
+
selectAliasedCacheable: SelectAliasedCacheableType;
|
|
99
|
+
selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
|
|
100
|
+
executeQueryCacheable: ExecuteQueryCacheable;
|
|
101
|
+
insertWithCacheContext: InsertAndEvictCacheType;
|
|
102
|
+
insertAndEvictCache: InsertAndEvictCacheType;
|
|
103
|
+
updateAndEvictCache: UpdateAndEvictCacheType;
|
|
104
|
+
updateWithCacheContext: UpdateAndEvictCacheType;
|
|
105
|
+
deleteAndEvictCache: DeleteAndEvictCacheType;
|
|
106
|
+
deleteWithCacheContext: DeleteAndEvictCacheType;
|
|
107
|
+
};
|
|
51
108
|
/**
|
|
52
109
|
* Creates a select query with unique field aliases to prevent field name collisions in joins.
|
|
53
110
|
* This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
|
|
@@ -66,30 +123,337 @@ export interface QueryBuilderForgeSql {
|
|
|
66
123
|
*/
|
|
67
124
|
select<TSelection extends SelectedFields>(fields: TSelection): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
68
125
|
/**
|
|
69
|
-
* Creates a
|
|
126
|
+
* Creates a select query builder for all columns from a table with field aliasing support.
|
|
127
|
+
* This is a convenience method that automatically selects all columns from the specified table.
|
|
128
|
+
*
|
|
129
|
+
* @template T - The type of the table
|
|
130
|
+
* @param table - The table to select from
|
|
131
|
+
* @returns Select query builder with all table columns and field aliasing support
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const users = await forgeSQL.selectFrom(userTable).where(eq(userTable.id, 1));
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
selectFrom<T extends MySqlTable>(table: T): MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
138
|
+
/**
|
|
139
|
+
* Creates a distinct select query with unique field aliases to prevent field name collisions in joins.
|
|
140
|
+
* This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
|
|
141
|
+
*
|
|
142
|
+
* @template TSelection - The type of the selected fields
|
|
143
|
+
* @param {TSelection} fields - Object containing the fields to select, with table schemas as values
|
|
144
|
+
* @returns {MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>} A distinct select query builder with unique field aliases
|
|
145
|
+
* @throws {Error} If fields parameter is empty
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* await forgeSQL
|
|
149
|
+
* .selectDistinct({user: users, order: orders})
|
|
150
|
+
* .from(orders)
|
|
151
|
+
* .innerJoin(users, eq(orders.userId, users.id));
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
selectDistinct<TSelection extends SelectedFields>(fields: TSelection): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
155
|
+
/**
|
|
156
|
+
* Creates a select distinct query builder for all columns from a table with field aliasing support.
|
|
157
|
+
* This is a convenience method that automatically selects all distinct columns from the specified table.
|
|
158
|
+
*
|
|
159
|
+
* @template T - The type of the table
|
|
160
|
+
* @param table - The table to select from
|
|
161
|
+
* @returns Select distinct query builder with all table columns and field aliasing support
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const uniqueUsers = await forgeSQL.selectDistinctFrom(userTable).where(eq(userTable.status, 'active'));
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
selectDistinctFrom<T extends MySqlTable>(table: T): MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
168
|
+
/**
|
|
169
|
+
* Creates a cacheable select query with unique field aliases to prevent field name collisions in joins.
|
|
70
170
|
* This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
|
|
71
171
|
*
|
|
72
172
|
* @template TSelection - The type of the selected fields
|
|
73
173
|
* @param {TSelection} fields - Object containing the fields to select, with table schemas as values
|
|
74
|
-
* @
|
|
174
|
+
* @param {number} cacheTTL - cache ttl optional default is 60 sec.
|
|
175
|
+
* @returns {MySqlSelectBuilder<TSelection, MySql2PreparedQueryHKT>} A select query builder with unique field aliases
|
|
75
176
|
* @throws {Error} If fields parameter is empty
|
|
76
177
|
* @example
|
|
77
178
|
* ```typescript
|
|
78
179
|
* await forgeSQL
|
|
79
|
-
* .
|
|
180
|
+
* .selectCacheable({user: users, order: orders},60)
|
|
80
181
|
* .from(orders)
|
|
81
182
|
* .innerJoin(users, eq(orders.userId, users.id));
|
|
82
183
|
* ```
|
|
83
184
|
*/
|
|
84
|
-
|
|
185
|
+
selectCacheable<TSelection extends SelectedFields>(fields: TSelection, cacheTTL?: number): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
186
|
+
/**
|
|
187
|
+
* Creates a cacheable select query builder for all columns from a table with field aliasing and caching support.
|
|
188
|
+
* This is a convenience method that automatically selects all columns from the specified table with caching enabled.
|
|
189
|
+
*
|
|
190
|
+
* @template T - The type of the table
|
|
191
|
+
* @param table - The table to select from
|
|
192
|
+
* @param cacheTTL - Optional cache TTL override (defaults to global cache TTL)
|
|
193
|
+
* @returns Select query builder with all table columns, field aliasing, and caching support
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const users = await forgeSQL.selectCacheableFrom(userTable, 300).where(eq(userTable.id, 1));
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
selectCacheableFrom<T extends MySqlTable>(table: T, cacheTTL?: number): MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
200
|
+
/**
|
|
201
|
+
* Creates a cacheable distinct select query with unique field aliases to prevent field name collisions in joins.
|
|
202
|
+
* This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
|
|
203
|
+
*
|
|
204
|
+
* @template TSelection - The type of the selected fields
|
|
205
|
+
* @param {TSelection} fields - Object containing the fields to select, with table schemas as values
|
|
206
|
+
* @param {number} cacheTTL - cache ttl optional default is 60 sec.
|
|
207
|
+
* @returns {MySqlSelectBuilder<TSelection, MySql2PreparedQueryHKT>} A distinct select query builder with unique field aliases
|
|
208
|
+
* @throws {Error} If fields parameter is empty
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* await forgeSQL
|
|
212
|
+
* .selectDistinctCacheable({user: users, order: orders}, 60)
|
|
213
|
+
* .from(orders)
|
|
214
|
+
* .innerJoin(users, eq(orders.userId, users.id));
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
selectDistinctCacheable<TSelection extends SelectedFields>(fields: TSelection, cacheTTL?: number): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
218
|
+
/**
|
|
219
|
+
* Creates a cacheable select distinct query builder for all columns from a table with field aliasing and caching support.
|
|
220
|
+
* This is a convenience method that automatically selects all distinct columns from the specified table with caching enabled.
|
|
221
|
+
*
|
|
222
|
+
* @template T - The type of the table
|
|
223
|
+
* @param table - The table to select from
|
|
224
|
+
* @param cacheTTL - Optional cache TTL override (defaults to global cache TTL)
|
|
225
|
+
* @returns Select distinct query builder with all table columns, field aliasing, and caching support
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
228
|
+
* const uniqueUsers = await forgeSQL.selectDistinctCacheableFrom(userTable, 300).where(eq(userTable.status, 'active'));
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
selectDistinctCacheableFrom<T extends MySqlTable>(table: T, cacheTTL?: number): MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
232
|
+
/**
|
|
233
|
+
* Creates an insert query builder.
|
|
234
|
+
*
|
|
235
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
236
|
+
* For versioned inserts, use `modifyWithVersioning().insert()` or `modifyWithVersioningAndEvictCache().insert()` instead.
|
|
237
|
+
*
|
|
238
|
+
* @param table - The table to insert into
|
|
239
|
+
* @returns Insert query builder (no versioning, no cache management)
|
|
240
|
+
*/
|
|
241
|
+
insert<TTable extends MySqlTable>(table: TTable): MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
242
|
+
/**
|
|
243
|
+
* Creates an insert query builder that automatically evicts cache after execution.
|
|
244
|
+
*
|
|
245
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
246
|
+
* For versioned inserts, use `modifyWithVersioning().insert()` or `modifyWithVersioningAndEvictCache().insert()` instead.
|
|
247
|
+
*
|
|
248
|
+
* @param table - The table to insert into
|
|
249
|
+
* @returns Insert query builder with automatic cache eviction (no versioning)
|
|
250
|
+
*/
|
|
251
|
+
insertAndEvictCache<TTable extends MySqlTable>(table: TTable): MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
252
|
+
/**
|
|
253
|
+
* Creates an update query builder.
|
|
254
|
+
*
|
|
255
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
256
|
+
* For versioned updates, use `modifyWithVersioning().updateById()` or `modifyWithVersioningAndEvictCache().updateById()` instead.
|
|
257
|
+
*
|
|
258
|
+
* @param table - The table to update
|
|
259
|
+
* @returns Update query builder (no versioning, no cache management)
|
|
260
|
+
*/
|
|
261
|
+
update<TTable extends MySqlTable>(table: TTable): MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
262
|
+
/**
|
|
263
|
+
* Creates an update query builder that automatically evicts cache after execution.
|
|
264
|
+
*
|
|
265
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
266
|
+
* For versioned updates, use `modifyWithVersioning().updateById()` or `modifyWithVersioningAndEvictCache().updateById()` instead.
|
|
267
|
+
*
|
|
268
|
+
* @param table - The table to update
|
|
269
|
+
* @returns Update query builder with automatic cache eviction (no versioning)
|
|
270
|
+
*/
|
|
271
|
+
updateAndEvictCache<TTable extends MySqlTable>(table: TTable): MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
272
|
+
/**
|
|
273
|
+
* Creates a delete query builder.
|
|
274
|
+
*
|
|
275
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
276
|
+
* For versioned deletes, use `modifyWithVersioning().deleteById()` or `modifyWithVersioningAndEvictCache().deleteById()` instead.
|
|
277
|
+
*
|
|
278
|
+
* @param table - The table to delete from
|
|
279
|
+
* @returns Delete query builder (no versioning, no cache management)
|
|
280
|
+
*/
|
|
281
|
+
delete<TTable extends MySqlTable>(table: TTable): MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
282
|
+
/**
|
|
283
|
+
* Creates a delete query builder that automatically evicts cache after execution.
|
|
284
|
+
*
|
|
285
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
286
|
+
* For versioned deletes, use `modifyWithVersioning().deleteById()` or `modifyWithVersioningAndEvictCache().deleteById()` instead.
|
|
287
|
+
*
|
|
288
|
+
* @param table - The table to delete from
|
|
289
|
+
* @returns Delete query builder with automatic cache eviction (no versioning)
|
|
290
|
+
*/
|
|
291
|
+
deleteAndEvictCache<TTable extends MySqlTable>(table: TTable): MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
292
|
+
/**
|
|
293
|
+
* Executes operations within a cache context that collects cache eviction events.
|
|
294
|
+
* All clearCache calls within the context are collected and executed in batch at the end.
|
|
295
|
+
* Queries executed within this context will bypass cache for tables that were marked for clearing.
|
|
296
|
+
*
|
|
297
|
+
* @param cacheContext - Function containing operations that may trigger cache evictions
|
|
298
|
+
* @returns Promise that resolves when all operations and cache clearing are complete
|
|
299
|
+
*/
|
|
300
|
+
executeWithCacheContext(cacheContext: () => Promise<void>): Promise<void>;
|
|
301
|
+
/**
|
|
302
|
+
* Executes operations within a cache context and returns a value.
|
|
303
|
+
* All clearCache calls within the context are collected and executed in batch at the end.
|
|
304
|
+
* Queries executed within this context will bypass cache for tables that were marked for clearing.
|
|
305
|
+
*
|
|
306
|
+
* @param cacheContext - Function containing operations that may trigger cache evictions
|
|
307
|
+
* @returns Promise that resolves to the return value of the cacheContext function
|
|
308
|
+
*/
|
|
309
|
+
executeWithCacheContextAndReturnValue<T>(cacheContext: () => Promise<T>): Promise<T>;
|
|
310
|
+
/**
|
|
311
|
+
* Executes operations within a local cache context that provides in-memory caching for select queries.
|
|
312
|
+
* This is useful for optimizing queries within a single resolver or request scope.
|
|
313
|
+
*
|
|
314
|
+
* Local cache features:
|
|
315
|
+
* - Caches select query results in memory for the duration of the context
|
|
316
|
+
* - Automatically evicts cache when insert/update/delete operations are performed
|
|
317
|
+
* - Provides faster access to repeated queries within the same context
|
|
318
|
+
* - Does not persist across different requests or contexts
|
|
319
|
+
*
|
|
320
|
+
* @param cacheContext - Function containing operations that will benefit from local caching
|
|
321
|
+
* @returns Promise that resolves when all operations are complete
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* await forgeSQL.executeWithLocalContext(async () => {
|
|
326
|
+
* // First call - executes query and caches result
|
|
327
|
+
* const users = await forgeSQL.select({ id: users.id, name: users.name })
|
|
328
|
+
* .from(users).where(eq(users.active, true));
|
|
329
|
+
*
|
|
330
|
+
* // Second call - gets result from local cache (no database query)
|
|
331
|
+
* const cachedUsers = await forgeSQL.select({ id: users.id, name: users.name })
|
|
332
|
+
* .from(users).where(eq(users.active, true));
|
|
333
|
+
*
|
|
334
|
+
* // Insert operation - evicts local cache
|
|
335
|
+
* await forgeSQL.insert(users).values({ name: 'New User', active: true });
|
|
336
|
+
* });
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
executeWithLocalContext(cacheContext: () => Promise<void>): Promise<void>;
|
|
340
|
+
/**
|
|
341
|
+
* Executes operations within a local cache context and returns a value.
|
|
342
|
+
* This is useful for optimizing queries within a single resolver or request scope.
|
|
343
|
+
*
|
|
344
|
+
* Local cache features:
|
|
345
|
+
* - Caches select query results in memory for the duration of the context
|
|
346
|
+
* - Automatically evicts cache when insert/update/delete operations are performed
|
|
347
|
+
* - Provides faster access to repeated queries within the same context
|
|
348
|
+
* - Does not persist across different requests or contexts
|
|
349
|
+
*
|
|
350
|
+
* @param cacheContext - Function containing operations that will benefit from local caching
|
|
351
|
+
* @returns Promise that resolves to the return value of the cacheContext function
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```typescript
|
|
355
|
+
* const result = await forgeSQL.executeWithLocalCacheContextAndReturnValue(async () => {
|
|
356
|
+
* // First call - executes query and caches result
|
|
357
|
+
* const users = await forgeSQL.select({ id: users.id, name: users.name })
|
|
358
|
+
* .from(users).where(eq(users.active, true));
|
|
359
|
+
*
|
|
360
|
+
* // Second call - gets result from local cache (no database query)
|
|
361
|
+
* const cachedUsers = await forgeSQL.select({ id: users.id, name: users.name })
|
|
362
|
+
* .from(users).where(eq(users.active, true));
|
|
363
|
+
*
|
|
364
|
+
* return { users, cachedUsers };
|
|
365
|
+
* });
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
executeWithLocalCacheContextAndReturnValue<T>(cacheContext: () => Promise<T>): Promise<T>;
|
|
369
|
+
/**
|
|
370
|
+
* Executes a raw SQL query with local cache support.
|
|
371
|
+
* This method provides local caching for raw SQL queries within the current invocation context.
|
|
372
|
+
* Results are cached locally and will be returned from cache on subsequent identical queries.
|
|
373
|
+
*
|
|
374
|
+
* @param query - The SQL query to execute (SQLWrapper or string)
|
|
375
|
+
* @returns Promise with query results
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* // Using SQLWrapper
|
|
379
|
+
* const result = await forgeSQL.execute(sql`SELECT * FROM users WHERE id = ${userId}`);
|
|
380
|
+
*
|
|
381
|
+
* // Using string
|
|
382
|
+
* const result = await forgeSQL.execute("SELECT * FROM users WHERE status = 'active'");
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
execute(query: SQLWrapper | string): Promise<MySqlQueryResultKind<MySqlRemoteQueryResultHKT, unknown>>;
|
|
386
|
+
/**
|
|
387
|
+
* Executes a raw SQL query with both local and global cache support.
|
|
388
|
+
* This method provides comprehensive caching for raw SQL queries:
|
|
389
|
+
* - Local cache: Within the current invocation context
|
|
390
|
+
* - Global cache: Cross-invocation caching using @forge/kvs
|
|
391
|
+
*
|
|
392
|
+
* @param query - The SQL query to execute (SQLWrapper or string)
|
|
393
|
+
* @param cacheTtl - Optional cache TTL override (defaults to global cache TTL)
|
|
394
|
+
* @returns Promise with query results
|
|
395
|
+
* @example
|
|
396
|
+
* ```typescript
|
|
397
|
+
* // Using SQLWrapper with custom TTL
|
|
398
|
+
* const result = await forgeSQL.executeCacheable(sql`SELECT * FROM users WHERE id = ${userId}`, 300);
|
|
399
|
+
*
|
|
400
|
+
* // Using string with default TTL
|
|
401
|
+
* const result = await forgeSQL.executeCacheable("SELECT * FROM users WHERE status = 'active'");
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
executeCacheable(query: SQLWrapper | string, cacheTtl?: number): Promise<MySqlQueryResultKind<MySqlRemoteQueryResultHKT, unknown>>;
|
|
405
|
+
/**
|
|
406
|
+
* Creates a Common Table Expression (CTE) builder for complex queries.
|
|
407
|
+
* CTEs allow you to define temporary named result sets that exist within the scope of a single query.
|
|
408
|
+
*
|
|
409
|
+
* @returns WithBuilder for creating CTEs
|
|
410
|
+
* @example
|
|
411
|
+
* ```typescript
|
|
412
|
+
* const withQuery = forgeSQL.$with('userStats').as(
|
|
413
|
+
* forgeSQL.select({ userId: users.id, count: sql<number>`count(*)` })
|
|
414
|
+
* .from(users)
|
|
415
|
+
* .groupBy(users.id)
|
|
416
|
+
* );
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
$with: WithBuilder;
|
|
420
|
+
/**
|
|
421
|
+
* Creates a query builder that uses Common Table Expressions (CTEs).
|
|
422
|
+
* CTEs allow you to define temporary named result sets that exist within the scope of a single query.
|
|
423
|
+
*
|
|
424
|
+
* @param queries - Array of CTE queries created with $with()
|
|
425
|
+
* @returns Query builder with CTE support
|
|
426
|
+
* @example
|
|
427
|
+
* ```typescript
|
|
428
|
+
* const withQuery = forgeSQL.$with('userStats').as(
|
|
429
|
+
* forgeSQL.select({ userId: users.id, count: sql<number>`count(*)` })
|
|
430
|
+
* .from(users)
|
|
431
|
+
* .groupBy(users.id)
|
|
432
|
+
* );
|
|
433
|
+
*
|
|
434
|
+
* const result = await forgeSQL.with(withQuery)
|
|
435
|
+
* .select({ userId: withQuery.userId, count: withQuery.count })
|
|
436
|
+
* .from(withQuery);
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
with(...queries: WithSubquery[]): {
|
|
440
|
+
select: {
|
|
441
|
+
(): MySqlSelectBuilder<undefined, MySqlRemotePreparedQueryHKT>;
|
|
442
|
+
<TSelection extends SelectedFields>(fields: TSelection): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
443
|
+
};
|
|
444
|
+
selectDistinct: {
|
|
445
|
+
(): MySqlSelectBuilder<undefined, MySqlRemotePreparedQueryHKT>;
|
|
446
|
+
<TSelection extends SelectedFields>(fields: TSelection): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
85
449
|
}
|
|
86
450
|
/**
|
|
87
451
|
* Interface for Modify (Create, Update, Delete) operations.
|
|
88
452
|
* Provides methods for basic database operations with support for optimistic locking.
|
|
89
453
|
*
|
|
90
|
-
* @interface
|
|
454
|
+
* @interface VerioningModificationForgeSQL
|
|
91
455
|
*/
|
|
92
|
-
export interface
|
|
456
|
+
export interface VerioningModificationForgeSQL {
|
|
93
457
|
/**
|
|
94
458
|
* Inserts multiple records into the database.
|
|
95
459
|
* @template T - The type of the table schema
|
|
@@ -139,6 +503,10 @@ export interface CRUDForgeSQL {
|
|
|
139
503
|
*/
|
|
140
504
|
updateFields<T extends AnyMySqlTable>(updateData: Partial<InferInsertModel<T>>, schema: T, where?: SQL<unknown>): Promise<number>;
|
|
141
505
|
}
|
|
506
|
+
export interface CacheForgeSQL extends VerioningModificationForgeSQL {
|
|
507
|
+
evictCache(tables: string[]): Promise<void>;
|
|
508
|
+
evictCacheEntities(tables: AnyMySqlTable[]): Promise<void>;
|
|
509
|
+
}
|
|
142
510
|
/**
|
|
143
511
|
* Interface for schema analysis operations.
|
|
144
512
|
* Provides methods for analyzing query performance and execution plans.
|
|
@@ -225,10 +593,11 @@ export interface SchemaSqlForgeSql {
|
|
|
225
593
|
executeRawSQL<T extends object | unknown>(query: string, params?: SqlParameters[]): Promise<T[]>;
|
|
226
594
|
/**
|
|
227
595
|
* Executes a raw SQL update query.
|
|
228
|
-
*
|
|
229
|
-
* @param
|
|
230
|
-
* @
|
|
231
|
-
* @
|
|
596
|
+
*
|
|
597
|
+
* @param query - The raw SQL update query
|
|
598
|
+
* @param params - Optional SQL parameters
|
|
599
|
+
* @returns Promise that resolves to the update response containing affected rows
|
|
600
|
+
* @throws Error if the update operation fails
|
|
232
601
|
*/
|
|
233
602
|
executeRawUpdateSQL(query: string, params?: unknown[]): Promise<UpdateQueryResponse>;
|
|
234
603
|
}
|
|
@@ -273,6 +642,12 @@ export interface ForgeSqlOrmOptions {
|
|
|
273
642
|
disableOptimisticLocking?: boolean;
|
|
274
643
|
/** SQL hints to be applied to queries */
|
|
275
644
|
hints?: SqlHints;
|
|
645
|
+
cacheTTL?: number;
|
|
646
|
+
cacheEntityName?: string;
|
|
647
|
+
cacheEntityQueryName?: string;
|
|
648
|
+
cacheWrapTable?: boolean;
|
|
649
|
+
cacheEntityExpirationName?: string;
|
|
650
|
+
cacheEntityDataName?: string;
|
|
276
651
|
/**
|
|
277
652
|
* Additional metadata for table configuration.
|
|
278
653
|
* Allows specifying table-specific settings and behaviors.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgeSQLQueryBuilder.d.ts","sourceRoot":"","sources":["../../src/core/ForgeSQLQueryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,aAAa,EAEb,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACpB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D;;;;OAIG;IACH,IAAI,IAAI,YAAY,CAAC;IAErB;;;OAGG;IACH,MAAM,IAAI,YAAY,CAAC;IAEvB;;;OAGG;IACH,KAAK,IAAI,iBAAiB,CAAC;IAE3B;;;OAGG;IACH,OAAO,IAAI,qBAAqB,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,sBAAsB,IAAI,mBAAmB,CAAC,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CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,4CAA4C;IAC5C,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,yCAAyC;IACzC,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;;;;;;;;;;;;OAgBG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAGX,MAAM;;;;;;;;;;iBAAN,MAAM;;;;;;;;;CAYzB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAGZ,MAAM;;;;;;;;;;iBAAN,MAAM;;;;;;;;;CAYzB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;iBAGP,MAAM;;;;;;;;;;iBAAN,MAAM;;;;;;;;;CAYzB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;iBAGP,MAAM;;;;;;;;;;iBAAN,MAAM;;;;;;;;;CAWzB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./core/ForgeSQLSelectOperations";
|
|
|
5
5
|
export * from "./utils/sqlUtils";
|
|
6
6
|
export * from "./utils/forgeDriver";
|
|
7
7
|
export * from "./webtriggers";
|
|
8
|
-
export * from "./lib/drizzle/extensions/
|
|
8
|
+
export * from "./lib/drizzle/extensions/additionalActions";
|
|
9
9
|
export * from "./core/SystemTables";
|
|
10
10
|
export default ForgeSQLORM;
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qBAAqB,CAAC;AAEpC,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT, MySqlRemoteQueryResultHKT } from "drizzle-orm/mysql-proxy";
|
|
2
|
+
import { SelectedFields } from "drizzle-orm/mysql-core/query-builders/select.types";
|
|
3
|
+
import { ForgeSqlOrmOptions } from "../../..";
|
|
4
|
+
import { MySqlSelectBase, MySqlSelectBuilder } from "drizzle-orm/mysql-core";
|
|
5
|
+
import type { MySqlTable } from "drizzle-orm/mysql-core/table";
|
|
6
|
+
import { MySqlDeleteBase, MySqlInsertBuilder, MySqlUpdateBuilder } from "drizzle-orm/mysql-core/query-builders";
|
|
7
|
+
import { SQLWrapper } from "drizzle-orm/sql/sql";
|
|
8
|
+
import type { MySqlQueryResultKind } from "drizzle-orm/mysql-core/session";
|
|
9
|
+
import type { GetSelectTableName, GetSelectTableSelection } from "drizzle-orm/query-builders/select.types";
|
|
10
|
+
/**
|
|
11
|
+
* Type for select queries with field aliasing
|
|
12
|
+
*/
|
|
13
|
+
export type SelectAliasedType = <TSelection extends SelectedFields>(fields: TSelection) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
14
|
+
/**
|
|
15
|
+
* Type for select distinct queries with field aliasing
|
|
16
|
+
*/
|
|
17
|
+
export type SelectAliasedDistinctType = <TSelection extends SelectedFields>(fields: TSelection) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
18
|
+
/**
|
|
19
|
+
* Type for select queries with field aliasing and caching
|
|
20
|
+
*/
|
|
21
|
+
export type SelectAliasedCacheableType = <TSelection extends SelectedFields>(fields: TSelection, cacheTtl?: number) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
22
|
+
/**
|
|
23
|
+
* Type for select distinct queries with field aliasing and caching
|
|
24
|
+
*/
|
|
25
|
+
export type SelectAliasedDistinctCacheableType = <TSelection extends SelectedFields>(fields: TSelection, cacheTtl?: number) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
26
|
+
/**
|
|
27
|
+
* Type for select queries from table with field aliasing
|
|
28
|
+
*/
|
|
29
|
+
export type SelectAllFromAliasedType = <T extends MySqlTable>(table: T) => MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
30
|
+
/**
|
|
31
|
+
* Type for select distinct queries from table with field aliasing
|
|
32
|
+
*/
|
|
33
|
+
export type SelectAllDistinctFromAliasedType = <T extends MySqlTable>(table: T) => MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
34
|
+
/**
|
|
35
|
+
* Type for select queries from table with field aliasing and caching
|
|
36
|
+
*/
|
|
37
|
+
export type SelectAllFromCacheableAliasedType = <T extends MySqlTable>(table: T, cacheTtl?: number) => MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
38
|
+
/**
|
|
39
|
+
* Type for select distinct queries from table with field aliasing and caching
|
|
40
|
+
*/
|
|
41
|
+
export type SelectAllDistinctFromCacheableAliasedType = <T extends MySqlTable>(table: T, cacheTtl?: number) => MySqlSelectBase<GetSelectTableName<T>, T["_"]["columns"] extends undefined ? GetSelectTableSelection<T> : T["_"]["columns"], T["_"]["columns"] extends undefined ? "single" : "partial", MySqlRemotePreparedQueryHKT, GetSelectTableName<T> extends string ? Record<string & GetSelectTableName<T>, "not-null"> : {}, false, never, any>;
|
|
42
|
+
/**
|
|
43
|
+
* Type for executing raw SQL queries with local cache
|
|
44
|
+
*/
|
|
45
|
+
export type ExecuteQuery = (query: SQLWrapper | string) => Promise<MySqlQueryResultKind<MySqlRemoteQueryResultHKT, unknown>>;
|
|
46
|
+
/**
|
|
47
|
+
* Type for executing raw SQL queries with local and global cache
|
|
48
|
+
*/
|
|
49
|
+
export type ExecuteQueryCacheable = (query: SQLWrapper | string, cacheTtl?: number) => Promise<MySqlQueryResultKind<MySqlRemoteQueryResultHKT, unknown>>;
|
|
50
|
+
/**
|
|
51
|
+
* Type for insert operations with cache eviction
|
|
52
|
+
*/
|
|
53
|
+
export type InsertAndEvictCacheType = <TTable extends MySqlTable>(table: TTable) => MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
54
|
+
/**
|
|
55
|
+
* Type for update operations with cache eviction
|
|
56
|
+
*/
|
|
57
|
+
export type UpdateAndEvictCacheType = <TTable extends MySqlTable>(table: TTable) => MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
58
|
+
/**
|
|
59
|
+
* Type for delete operations with cache eviction
|
|
60
|
+
*/
|
|
61
|
+
export type DeleteAndEvictCacheType = <TTable extends MySqlTable>(table: TTable) => MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
62
|
+
/**
|
|
63
|
+
* Patches a Drizzle database instance with additional methods for aliased selects and cache management.
|
|
64
|
+
*
|
|
65
|
+
* This function extends the database instance with:
|
|
66
|
+
* - selectAliased: Select with field aliasing support
|
|
67
|
+
* - selectAliasedDistinct: Select distinct with field aliasing support
|
|
68
|
+
* - selectAliasedCacheable: Select with field aliasing and caching
|
|
69
|
+
* - selectAliasedDistinctCacheable: Select distinct with field aliasing and caching
|
|
70
|
+
* - insertAndEvictCache: Insert operations that automatically evict cache
|
|
71
|
+
* - updateAndEvictCache: Update operations that automatically evict cache
|
|
72
|
+
* - deleteAndEvictCache: Delete operations that automatically evict cache
|
|
73
|
+
*
|
|
74
|
+
* @param db - The Drizzle database instance to patch
|
|
75
|
+
* @param options - Optional ForgeSQL ORM configuration
|
|
76
|
+
* @returns The patched database instance with additional methods
|
|
77
|
+
*/
|
|
78
|
+
export declare function patchDbWithSelectAliased(db: MySqlRemoteDatabase<any>, options?: ForgeSqlOrmOptions): MySqlRemoteDatabase<any> & {
|
|
79
|
+
selectAliased: SelectAliasedType;
|
|
80
|
+
selectAliasedDistinct: SelectAliasedDistinctType;
|
|
81
|
+
selectAliasedCacheable: SelectAliasedCacheableType;
|
|
82
|
+
selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
|
|
83
|
+
insertWithCacheContext: InsertAndEvictCacheType;
|
|
84
|
+
insertAndEvictCache: InsertAndEvictCacheType;
|
|
85
|
+
updateAndEvictCache: UpdateAndEvictCacheType;
|
|
86
|
+
updateWithCacheContext: UpdateAndEvictCacheType;
|
|
87
|
+
deleteAndEvictCache: DeleteAndEvictCacheType;
|
|
88
|
+
deleteWithCacheContext: DeleteAndEvictCacheType;
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=additionalActions.d.ts.map
|