forge-sql-orm 2.0.30 → 2.1.0
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 +1090 -81
- package/dist/ForgeSQLORM.js +1080 -60
- package/dist/ForgeSQLORM.js.map +1 -1
- package/dist/ForgeSQLORM.mjs +1063 -60
- 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 +104 -13
- package/dist/core/ForgeSQLORM.d.ts.map +1 -1
- package/dist/core/ForgeSQLQueryBuilder.d.ts +243 -15
- 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 +42 -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 +443 -34
- package/src/core/ForgeSQLQueryBuilder.ts +291 -20
- package/src/index.ts +1 -1
- package/src/lib/drizzle/extensions/additionalActions.ts +548 -0
- package/src/lib/drizzle/extensions/types.d.ts +68 -10
- package/src/utils/cacheContextUtils.ts +210 -0
- package/src/utils/cacheUtils.ts +403 -0
- package/src/utils/sqlUtils.ts +16 -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,47 @@
|
|
|
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, InsertAndEvictCacheType, SelectAliasedCacheableType, SelectAliasedDistinctCacheableType, SelectAliasedDistinctType, SelectAliasedType, UpdateAndEvictCacheType } from "..";
|
|
11
|
+
import { MySqlDeleteBase, MySqlInsertBuilder, MySqlUpdateBuilder } from "drizzle-orm/mysql-core/query-builders";
|
|
12
|
+
import { MySqlRemoteQueryResultHKT } from "drizzle-orm/mysql-proxy";
|
|
9
13
|
/**
|
|
10
14
|
* Core interface for ForgeSQL operations.
|
|
11
15
|
* Provides access to CRUD operations, schema-level SQL operations, and query analysis capabilities.
|
|
12
16
|
*
|
|
17
|
+
* This is the main interface that developers interact with when using ForgeSQL ORM.
|
|
18
|
+
* It combines query building capabilities with database operations and caching.
|
|
19
|
+
*
|
|
13
20
|
* @interface ForgeSqlOperation
|
|
14
21
|
* @extends {QueryBuilderForgeSql}
|
|
15
22
|
*/
|
|
16
23
|
export interface ForgeSqlOperation extends QueryBuilderForgeSql {
|
|
17
24
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
* @returns {CRUDForgeSQL} Interface for performing CRUD operations
|
|
25
|
+
* Creates a new query builder for the given entity.
|
|
26
|
+
* @returns {MySqlRemoteDatabase<Record<string, unknown>>} The Drizzle database instance for building queries
|
|
21
27
|
*/
|
|
22
|
-
|
|
28
|
+
getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown>> & {
|
|
29
|
+
selectAliased: SelectAliasedType;
|
|
30
|
+
selectAliasedDistinct: SelectAliasedDistinctType;
|
|
31
|
+
selectAliasedCacheable: SelectAliasedCacheableType;
|
|
32
|
+
selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
|
|
33
|
+
insertWithCacheContext: InsertAndEvictCacheType;
|
|
34
|
+
insertAndEvictCache: InsertAndEvictCacheType;
|
|
35
|
+
updateAndEvictCache: UpdateAndEvictCacheType;
|
|
36
|
+
updateWithCacheContext: UpdateAndEvictCacheType;
|
|
37
|
+
deleteAndEvictCache: DeleteAndEvictCacheType;
|
|
38
|
+
deleteWithCacheContext: DeleteAndEvictCacheType;
|
|
39
|
+
};
|
|
23
40
|
/**
|
|
24
41
|
* Provides modify (Create, Update, Delete) operations with optimistic locking support.
|
|
25
|
-
* @returns {
|
|
42
|
+
* @returns {VerioningModificationForgeSQL} Interface for performing CRUD operations
|
|
26
43
|
*/
|
|
27
|
-
|
|
44
|
+
modifyWithVersioning(): VerioningModificationForgeSQL;
|
|
28
45
|
/**
|
|
29
46
|
* Provides schema-level SQL fetch operations with type safety.
|
|
30
47
|
* @returns {SchemaSqlForgeSql} Interface for executing schema-bound SQL queries
|
|
@@ -35,11 +52,27 @@ export interface ForgeSqlOperation extends QueryBuilderForgeSql {
|
|
|
35
52
|
* @returns {SchemaAnalyzeForgeSql} Interface for analyzing query performance
|
|
36
53
|
*/
|
|
37
54
|
analyze(): SchemaAnalyzeForgeSql;
|
|
55
|
+
/**
|
|
56
|
+
* Provides schema-level SQL operations with optimistic locking/versioning and automatic cache eviction.
|
|
57
|
+
*
|
|
58
|
+
* This method returns operations that use `modifyWithVersioning()` internally, providing:
|
|
59
|
+
* - Optimistic locking support
|
|
60
|
+
* - Automatic version field management
|
|
61
|
+
* - Cache eviction after successful operations
|
|
62
|
+
*
|
|
63
|
+
* @returns {ForgeSQLCacheOperations} Interface for executing versioned SQL operations with cache management
|
|
64
|
+
*/
|
|
65
|
+
modifyWithVersioningAndEvictCache(): ForgeSQLCacheOperations;
|
|
38
66
|
}
|
|
39
67
|
/**
|
|
40
68
|
* Interface for Query Builder operations.
|
|
41
69
|
* Provides access to the underlying Drizzle ORM query builder with enhanced functionality.
|
|
42
70
|
*
|
|
71
|
+
* This interface extends Drizzle's query building capabilities with:
|
|
72
|
+
* - Field aliasing to prevent name collisions in joins
|
|
73
|
+
* - Caching support for select operations
|
|
74
|
+
* - Automatic cache eviction for modify operations
|
|
75
|
+
*
|
|
43
76
|
* @interface QueryBuilderForgeSql
|
|
44
77
|
*/
|
|
45
78
|
export interface QueryBuilderForgeSql {
|
|
@@ -47,7 +80,18 @@ export interface QueryBuilderForgeSql {
|
|
|
47
80
|
* Creates a new query builder for the given entity.
|
|
48
81
|
* @returns {MySqlRemoteDatabase<Record<string, unknown>>} The Drizzle database instance for building queries
|
|
49
82
|
*/
|
|
50
|
-
getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown
|
|
83
|
+
getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown>> & {
|
|
84
|
+
selectAliased: SelectAliasedType;
|
|
85
|
+
selectAliasedDistinct: SelectAliasedDistinctType;
|
|
86
|
+
selectAliasedCacheable: SelectAliasedCacheableType;
|
|
87
|
+
selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
|
|
88
|
+
insertWithCacheContext: InsertAndEvictCacheType;
|
|
89
|
+
insertAndEvictCache: InsertAndEvictCacheType;
|
|
90
|
+
updateAndEvictCache: UpdateAndEvictCacheType;
|
|
91
|
+
updateWithCacheContext: UpdateAndEvictCacheType;
|
|
92
|
+
deleteAndEvictCache: DeleteAndEvictCacheType;
|
|
93
|
+
deleteWithCacheContext: DeleteAndEvictCacheType;
|
|
94
|
+
};
|
|
51
95
|
/**
|
|
52
96
|
* Creates a select query with unique field aliases to prevent field name collisions in joins.
|
|
53
97
|
* This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
|
|
@@ -82,14 +126,187 @@ export interface QueryBuilderForgeSql {
|
|
|
82
126
|
* ```
|
|
83
127
|
*/
|
|
84
128
|
selectDistinct<TSelection extends SelectedFields>(fields: TSelection): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
129
|
+
/**
|
|
130
|
+
* Creates a cacheable select query with unique field aliases to prevent field name collisions in joins.
|
|
131
|
+
* This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
|
|
132
|
+
*
|
|
133
|
+
* @template TSelection - The type of the selected fields
|
|
134
|
+
* @param {TSelection} fields - Object containing the fields to select, with table schemas as values
|
|
135
|
+
* @param {number} cacheTTL - cache ttl optional default is 60 sec.
|
|
136
|
+
* @returns {MySqlSelectBuilder<TSelection, MySql2PreparedQueryHKT>} A select query builder with unique field aliases
|
|
137
|
+
* @throws {Error} If fields parameter is empty
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* await forgeSQL
|
|
141
|
+
* .selectCacheable({user: users, order: orders},60)
|
|
142
|
+
* .from(orders)
|
|
143
|
+
* .innerJoin(users, eq(orders.userId, users.id));
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
selectCacheable<TSelection extends SelectedFields>(fields: TSelection, cacheTTL?: number): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
147
|
+
/**
|
|
148
|
+
* Creates a cacheable distinct select query with unique field aliases to prevent field name collisions in joins.
|
|
149
|
+
* This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
|
|
150
|
+
*
|
|
151
|
+
* @template TSelection - The type of the selected fields
|
|
152
|
+
* @param {TSelection} fields - Object containing the fields to select, with table schemas as values
|
|
153
|
+
* @param {number} cacheTTL - cache ttl optional default is 60 sec.
|
|
154
|
+
* @returns {MySqlSelectBuilder<TSelection, MySql2PreparedQueryHKT>} A distinct select query builder with unique field aliases
|
|
155
|
+
* @throws {Error} If fields parameter is empty
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* await forgeSQL
|
|
159
|
+
* .selectDistinctCacheable({user: users, order: orders}, 60)
|
|
160
|
+
* .from(orders)
|
|
161
|
+
* .innerJoin(users, eq(orders.userId, users.id));
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
selectDistinctCacheable<TSelection extends SelectedFields>(fields: TSelection, cacheTTL?: number): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
165
|
+
/**
|
|
166
|
+
* Creates an insert query builder.
|
|
167
|
+
*
|
|
168
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
169
|
+
* For versioned inserts, use `modifyWithVersioning().insert()` or `modifyWithVersioningAndEvictCache().insert()` instead.
|
|
170
|
+
*
|
|
171
|
+
* @param table - The table to insert into
|
|
172
|
+
* @returns Insert query builder (no versioning, no cache management)
|
|
173
|
+
*/
|
|
174
|
+
insert<TTable extends MySqlTable>(table: TTable): MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
175
|
+
/**
|
|
176
|
+
* Creates an insert query builder that automatically evicts cache after execution.
|
|
177
|
+
*
|
|
178
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
179
|
+
* For versioned inserts, use `modifyWithVersioning().insert()` or `modifyWithVersioningAndEvictCache().insert()` instead.
|
|
180
|
+
*
|
|
181
|
+
* @param table - The table to insert into
|
|
182
|
+
* @returns Insert query builder with automatic cache eviction (no versioning)
|
|
183
|
+
*/
|
|
184
|
+
insertAndEvictCache<TTable extends MySqlTable>(table: TTable): MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
185
|
+
/**
|
|
186
|
+
* Creates an update query builder.
|
|
187
|
+
*
|
|
188
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
189
|
+
* For versioned updates, use `modifyWithVersioning().updateById()` or `modifyWithVersioningAndEvictCache().updateById()` instead.
|
|
190
|
+
*
|
|
191
|
+
* @param table - The table to update
|
|
192
|
+
* @returns Update query builder (no versioning, no cache management)
|
|
193
|
+
*/
|
|
194
|
+
update<TTable extends MySqlTable>(table: TTable): MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
195
|
+
/**
|
|
196
|
+
* Creates an update query builder that automatically evicts cache after execution.
|
|
197
|
+
*
|
|
198
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
199
|
+
* For versioned updates, use `modifyWithVersioning().updateById()` or `modifyWithVersioningAndEvictCache().updateById()` instead.
|
|
200
|
+
*
|
|
201
|
+
* @param table - The table to update
|
|
202
|
+
* @returns Update query builder with automatic cache eviction (no versioning)
|
|
203
|
+
*/
|
|
204
|
+
updateAndEvictCache<TTable extends MySqlTable>(table: TTable): MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
205
|
+
/**
|
|
206
|
+
* Creates a delete query builder.
|
|
207
|
+
*
|
|
208
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
209
|
+
* For versioned deletes, use `modifyWithVersioning().deleteById()` or `modifyWithVersioningAndEvictCache().deleteById()` instead.
|
|
210
|
+
*
|
|
211
|
+
* @param table - The table to delete from
|
|
212
|
+
* @returns Delete query builder (no versioning, no cache management)
|
|
213
|
+
*/
|
|
214
|
+
delete<TTable extends MySqlTable>(table: TTable): MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
215
|
+
/**
|
|
216
|
+
* Creates a delete query builder that automatically evicts cache after execution.
|
|
217
|
+
*
|
|
218
|
+
* ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
|
|
219
|
+
* For versioned deletes, use `modifyWithVersioning().deleteById()` or `modifyWithVersioningAndEvictCache().deleteById()` instead.
|
|
220
|
+
*
|
|
221
|
+
* @param table - The table to delete from
|
|
222
|
+
* @returns Delete query builder with automatic cache eviction (no versioning)
|
|
223
|
+
*/
|
|
224
|
+
deleteAndEvictCache<TTable extends MySqlTable>(table: TTable): MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
225
|
+
/**
|
|
226
|
+
* Executes operations within a cache context that collects cache eviction events.
|
|
227
|
+
* All clearCache calls within the context are collected and executed in batch at the end.
|
|
228
|
+
* Queries executed within this context will bypass cache for tables that were marked for clearing.
|
|
229
|
+
*
|
|
230
|
+
* @param cacheContext - Function containing operations that may trigger cache evictions
|
|
231
|
+
* @returns Promise that resolves when all operations and cache clearing are complete
|
|
232
|
+
*/
|
|
233
|
+
executeWithCacheContext(cacheContext: () => Promise<void>): Promise<void>;
|
|
234
|
+
/**
|
|
235
|
+
* Executes operations within a cache context and returns a value.
|
|
236
|
+
* All clearCache calls within the context are collected and executed in batch at the end.
|
|
237
|
+
* Queries executed within this context will bypass cache for tables that were marked for clearing.
|
|
238
|
+
*
|
|
239
|
+
* @param cacheContext - Function containing operations that may trigger cache evictions
|
|
240
|
+
* @returns Promise that resolves to the return value of the cacheContext function
|
|
241
|
+
*/
|
|
242
|
+
executeWithCacheContextAndReturnValue<T>(cacheContext: () => Promise<T>): Promise<T>;
|
|
243
|
+
/**
|
|
244
|
+
* Executes operations within a local cache context that provides in-memory caching for select queries.
|
|
245
|
+
* This is useful for optimizing queries within a single resolver or request scope.
|
|
246
|
+
*
|
|
247
|
+
* Local cache features:
|
|
248
|
+
* - Caches select query results in memory for the duration of the context
|
|
249
|
+
* - Automatically evicts cache when insert/update/delete operations are performed
|
|
250
|
+
* - Provides faster access to repeated queries within the same context
|
|
251
|
+
* - Does not persist across different requests or contexts
|
|
252
|
+
*
|
|
253
|
+
* @param cacheContext - Function containing operations that will benefit from local caching
|
|
254
|
+
* @returns Promise that resolves when all operations are complete
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* await forgeSQL.executeWithLocalContext(async () => {
|
|
259
|
+
* // First call - executes query and caches result
|
|
260
|
+
* const users = await forgeSQL.select({ id: users.id, name: users.name })
|
|
261
|
+
* .from(users).where(eq(users.active, true));
|
|
262
|
+
*
|
|
263
|
+
* // Second call - gets result from local cache (no database query)
|
|
264
|
+
* const cachedUsers = await forgeSQL.select({ id: users.id, name: users.name })
|
|
265
|
+
* .from(users).where(eq(users.active, true));
|
|
266
|
+
*
|
|
267
|
+
* // Insert operation - evicts local cache
|
|
268
|
+
* await forgeSQL.insert(users).values({ name: 'New User', active: true });
|
|
269
|
+
* });
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
executeWithLocalContext(cacheContext: () => Promise<void>): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Executes operations within a local cache context and returns a value.
|
|
275
|
+
* This is useful for optimizing queries within a single resolver or request scope.
|
|
276
|
+
*
|
|
277
|
+
* Local cache features:
|
|
278
|
+
* - Caches select query results in memory for the duration of the context
|
|
279
|
+
* - Automatically evicts cache when insert/update/delete operations are performed
|
|
280
|
+
* - Provides faster access to repeated queries within the same context
|
|
281
|
+
* - Does not persist across different requests or contexts
|
|
282
|
+
*
|
|
283
|
+
* @param cacheContext - Function containing operations that will benefit from local caching
|
|
284
|
+
* @returns Promise that resolves to the return value of the cacheContext function
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* const result = await forgeSQL.executeWithLocalCacheContextAndReturnValue(async () => {
|
|
289
|
+
* // First call - executes query and caches result
|
|
290
|
+
* const users = await forgeSQL.select({ id: users.id, name: users.name })
|
|
291
|
+
* .from(users).where(eq(users.active, true));
|
|
292
|
+
*
|
|
293
|
+
* // Second call - gets result from local cache (no database query)
|
|
294
|
+
* const cachedUsers = await forgeSQL.select({ id: users.id, name: users.name })
|
|
295
|
+
* .from(users).where(eq(users.active, true));
|
|
296
|
+
*
|
|
297
|
+
* return { users, cachedUsers };
|
|
298
|
+
* });
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
executeWithLocalCacheContextAndReturnValue<T>(cacheContext: () => Promise<T>): Promise<T>;
|
|
85
302
|
}
|
|
86
303
|
/**
|
|
87
304
|
* Interface for Modify (Create, Update, Delete) operations.
|
|
88
305
|
* Provides methods for basic database operations with support for optimistic locking.
|
|
89
306
|
*
|
|
90
|
-
* @interface
|
|
307
|
+
* @interface VerioningModificationForgeSQL
|
|
91
308
|
*/
|
|
92
|
-
export interface
|
|
309
|
+
export interface VerioningModificationForgeSQL {
|
|
93
310
|
/**
|
|
94
311
|
* Inserts multiple records into the database.
|
|
95
312
|
* @template T - The type of the table schema
|
|
@@ -139,6 +356,10 @@ export interface CRUDForgeSQL {
|
|
|
139
356
|
*/
|
|
140
357
|
updateFields<T extends AnyMySqlTable>(updateData: Partial<InferInsertModel<T>>, schema: T, where?: SQL<unknown>): Promise<number>;
|
|
141
358
|
}
|
|
359
|
+
export interface CacheForgeSQL extends VerioningModificationForgeSQL {
|
|
360
|
+
evictCache(tables: string[]): Promise<void>;
|
|
361
|
+
evictCacheEntities(tables: AnyMySqlTable[]): Promise<void>;
|
|
362
|
+
}
|
|
142
363
|
/**
|
|
143
364
|
* Interface for schema analysis operations.
|
|
144
365
|
* Provides methods for analyzing query performance and execution plans.
|
|
@@ -225,10 +446,11 @@ export interface SchemaSqlForgeSql {
|
|
|
225
446
|
executeRawSQL<T extends object | unknown>(query: string, params?: SqlParameters[]): Promise<T[]>;
|
|
226
447
|
/**
|
|
227
448
|
* Executes a raw SQL update query.
|
|
228
|
-
*
|
|
229
|
-
* @param
|
|
230
|
-
* @
|
|
231
|
-
* @
|
|
449
|
+
*
|
|
450
|
+
* @param query - The raw SQL update query
|
|
451
|
+
* @param params - Optional SQL parameters
|
|
452
|
+
* @returns Promise that resolves to the update response containing affected rows
|
|
453
|
+
* @throws Error if the update operation fails
|
|
232
454
|
*/
|
|
233
455
|
executeRawUpdateSQL(query: string, params?: unknown[]): Promise<UpdateQueryResponse>;
|
|
234
456
|
}
|
|
@@ -273,6 +495,12 @@ export interface ForgeSqlOrmOptions {
|
|
|
273
495
|
disableOptimisticLocking?: boolean;
|
|
274
496
|
/** SQL hints to be applied to queries */
|
|
275
497
|
hints?: SqlHints;
|
|
498
|
+
cacheTTL?: number;
|
|
499
|
+
cacheEntityName?: string;
|
|
500
|
+
cacheEntityQueryName?: string;
|
|
501
|
+
cacheWrapTable?: boolean;
|
|
502
|
+
cacheEntityExpirationName?: string;
|
|
503
|
+
cacheEntityDataName?: string;
|
|
276
504
|
/**
|
|
277
505
|
* Additional metadata for table configuration.
|
|
278
506
|
* 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,
|
|
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,EAClB,UAAU,EACX,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;AAE3D,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,kCAAkC,EAClC,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,IAAI,CAAC;AACZ,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,uCAAuC,CAAC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geDriver";
|
|
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,42 @@
|
|
|
1
|
+
import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT, MySqlRemoteQueryResultHKT } from "drizzle-orm/mysql-proxy";
|
|
2
|
+
import type { SelectedFields } from "drizzle-orm/mysql-core/query-builders/select.types";
|
|
3
|
+
import { ForgeSqlOrmOptions } from "../../..";
|
|
4
|
+
import { 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
|
+
export type SelectAliasedType = <TSelection extends SelectedFields>(fields: TSelection) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
8
|
+
export type SelectAliasedDistinctType = <TSelection extends SelectedFields>(fields: TSelection) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
9
|
+
export type SelectAliasedCacheableType = <TSelection extends SelectedFields>(fields: TSelection, cacheTtl?: number) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
10
|
+
export type SelectAliasedDistinctCacheableType = <TSelection extends SelectedFields>(fields: TSelection, cacheTtl?: number) => MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
|
|
11
|
+
export type InsertAndEvictCacheType = <TTable extends MySqlTable>(table: TTable) => MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
12
|
+
export type UpdateAndEvictCacheType = <TTable extends MySqlTable>(table: TTable) => MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
13
|
+
export type DeleteAndEvictCacheType = <TTable extends MySqlTable>(table: TTable) => MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
|
|
14
|
+
/**
|
|
15
|
+
* Patches a Drizzle database instance with additional methods for aliased selects and cache management.
|
|
16
|
+
*
|
|
17
|
+
* This function extends the database instance with:
|
|
18
|
+
* - selectAliased: Select with field aliasing support
|
|
19
|
+
* - selectAliasedDistinct: Select distinct with field aliasing support
|
|
20
|
+
* - selectAliasedCacheable: Select with field aliasing and caching
|
|
21
|
+
* - selectAliasedDistinctCacheable: Select distinct with field aliasing and caching
|
|
22
|
+
* - insertAndEvictCache: Insert operations that automatically evict cache
|
|
23
|
+
* - updateAndEvictCache: Update operations that automatically evict cache
|
|
24
|
+
* - deleteAndEvictCache: Delete operations that automatically evict cache
|
|
25
|
+
*
|
|
26
|
+
* @param db - The Drizzle database instance to patch
|
|
27
|
+
* @param options - Optional ForgeSQL ORM configuration
|
|
28
|
+
* @returns The patched database instance with additional methods
|
|
29
|
+
*/
|
|
30
|
+
export declare function patchDbWithSelectAliased(db: MySqlRemoteDatabase<any>, options?: ForgeSqlOrmOptions): MySqlRemoteDatabase<any> & {
|
|
31
|
+
selectAliased: SelectAliasedType;
|
|
32
|
+
selectAliasedDistinct: SelectAliasedDistinctType;
|
|
33
|
+
selectAliasedCacheable: SelectAliasedCacheableType;
|
|
34
|
+
selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
|
|
35
|
+
insertWithCacheContext: InsertAndEvictCacheType;
|
|
36
|
+
insertAndEvictCache: InsertAndEvictCacheType;
|
|
37
|
+
updateAndEvictCache: UpdateAndEvictCacheType;
|
|
38
|
+
updateWithCacheContext: UpdateAndEvictCacheType;
|
|
39
|
+
deleteAndEvictCache: DeleteAndEvictCacheType;
|
|
40
|
+
deleteWithCacheContext: DeleteAndEvictCacheType;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=additionalActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additionalActions.d.ts","sourceRoot":"","sources":["../../../../src/lib/drizzle/extensions/additionalActions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AACzF,OAAO,EAA4B,kBAAkB,EAA4B,MAAM,UAAU,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,uCAAuC,CAAC;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BAAiB,CAAC;IACjC,qBAAqB,EAAE,yBAAyB,CAAC;IACjD,sBAAsB,EAAE,0BAA0B,CAAC;IACnD,8BAA8B,EAAE,kCAAkC,CAAC;IACnE,sBAAsB,EAAE,uBAAuB,CAAC;IAChD,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,sBAAsB,EAAE,uBAAuB,CAAC;IAChD,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,sBAAsB,EAAE,uBAAuB,CAAC;CACjD,CAmFA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { AnyMySqlSelectQueryBuilder, AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
3
|
+
import { ForgeSqlOrmOptions } from "../core/ForgeSQLQueryBuilder";
|
|
4
|
+
import { MySqlSelectDynamic } from "drizzle-orm/mysql-core/query-builders/select.types";
|
|
5
|
+
/**
|
|
6
|
+
* Interface representing the cache application context.
|
|
7
|
+
* Stores information about tables that are being processed within a cache context.
|
|
8
|
+
*/
|
|
9
|
+
export interface CacheApplicationContext {
|
|
10
|
+
/** Set of table names (in lowercase) that are being processed within the cache context */
|
|
11
|
+
tables: Set<string>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Interface representing the local cache application context.
|
|
15
|
+
* Stores cached query results in memory for the duration of a local cache context.
|
|
16
|
+
*
|
|
17
|
+
* @interface LocalCacheApplicationContext
|
|
18
|
+
*/
|
|
19
|
+
export interface LocalCacheApplicationContext {
|
|
20
|
+
/**
|
|
21
|
+
* Cache object mapping query hash keys to cached results
|
|
22
|
+
* @property {Record<string, {sql: string, data: unknown[]}>} cache - Map of query keys to cached data
|
|
23
|
+
*/
|
|
24
|
+
cache: Record<string, {
|
|
25
|
+
sql: string;
|
|
26
|
+
data: unknown[];
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* AsyncLocalStorage instance for managing cache context across async operations.
|
|
31
|
+
* This allows tracking which tables are being processed within a cache context
|
|
32
|
+
* without explicitly passing context through function parameters.
|
|
33
|
+
*/
|
|
34
|
+
export declare const cacheApplicationContext: AsyncLocalStorage<CacheApplicationContext>;
|
|
35
|
+
/**
|
|
36
|
+
* AsyncLocalStorage instance for managing local cache context across async operations.
|
|
37
|
+
* This allows storing and retrieving cached query results within a local cache context
|
|
38
|
+
* without explicitly passing context through function parameters.
|
|
39
|
+
*/
|
|
40
|
+
export declare const localCacheApplicationContext: AsyncLocalStorage<LocalCacheApplicationContext>;
|
|
41
|
+
/**
|
|
42
|
+
* Saves a table name to the current cache context if one exists.
|
|
43
|
+
* This function is used to track which tables are being processed within
|
|
44
|
+
* a cache context for proper cache invalidation.
|
|
45
|
+
*
|
|
46
|
+
* @param table - The Drizzle table schema to track
|
|
47
|
+
* @returns Promise that resolves when the table is saved to context
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* await saveTableIfInsideCacheContext(usersTable);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function saveTableIfInsideCacheContext<T extends AnyMySqlTable>(table: T): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Saves a query result to the local cache context.
|
|
57
|
+
* This function stores query results in memory for the duration of the local cache context.
|
|
58
|
+
*
|
|
59
|
+
* @param query - The Drizzle query to cache
|
|
60
|
+
* @param rows - The query result data to cache
|
|
61
|
+
* @returns Promise that resolves when the data is saved to local cache
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const query = db.select({ id: users.id, name: users.name }).from(users);
|
|
66
|
+
* const results = await query.execute();
|
|
67
|
+
* await saveQueryLocalCacheQuery(query, results);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function saveQueryLocalCacheQuery<T extends MySqlSelectDynamic<AnyMySqlSelectQueryBuilder>>(query: T, rows: unknown[]): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Retrieves a query result from the local cache context.
|
|
73
|
+
* This function checks if a query result is already cached in memory.
|
|
74
|
+
*
|
|
75
|
+
* @param query - The Drizzle query to check for cached results
|
|
76
|
+
* @returns Promise that resolves to cached data if found, undefined otherwise
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const query = db.select({ id: users.id, name: users.name }).from(users);
|
|
81
|
+
* const cachedResult = await getQueryLocalCacheQuery(query);
|
|
82
|
+
* if (cachedResult) {
|
|
83
|
+
* return cachedResult; // Use cached data
|
|
84
|
+
* }
|
|
85
|
+
* // Execute query and cache result
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function getQueryLocalCacheQuery<T extends MySqlSelectDynamic<AnyMySqlSelectQueryBuilder>>(query: T): Promise<unknown[] | undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Evicts cached queries from the local cache context that involve the specified table.
|
|
91
|
+
* This function removes cached query results that contain the given table name.
|
|
92
|
+
*
|
|
93
|
+
* @param table - The Drizzle table schema to evict cache for
|
|
94
|
+
* @param options - ForgeSQL ORM options containing cache configuration
|
|
95
|
+
* @returns Promise that resolves when cache eviction is complete
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* // After inserting/updating/deleting from users table
|
|
100
|
+
* await evictLocalCacheQuery(usersTable, forgeSqlOptions);
|
|
101
|
+
* // All cached queries involving users table are now removed
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function evictLocalCacheQuery<T extends AnyMySqlTable>(table: T, options: ForgeSqlOrmOptions): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Checks if the given SQL query contains any tables that are currently being processed
|
|
107
|
+
* within a cache context. This is used to determine if cache should be bypassed
|
|
108
|
+
* for queries that affect tables being modified within the context.
|
|
109
|
+
*
|
|
110
|
+
* @param sql - The SQL query string to check
|
|
111
|
+
* @param options - ForgeSQL ORM options containing cache configuration
|
|
112
|
+
* @returns Promise that resolves to true if the SQL contains tables in cache context
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const shouldBypassCache = await isTableContainsTableInCacheContext(
|
|
117
|
+
* "SELECT * FROM users WHERE id = 1",
|
|
118
|
+
* forgeSqlOptions
|
|
119
|
+
* );
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function isTableContainsTableInCacheContext(sql: string, options: ForgeSqlOrmOptions): Promise<boolean>;
|
|
123
|
+
//# sourceMappingURL=cacheContextUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheContextUtils.d.ts","sourceRoot":"","sources":["../../src/utils/cacheContextUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAIxF;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,0FAA0F;IAC1F,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,KAAK,EAAE,MAAM,CACX,MAAM,EACN;QACE,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,OAAO,EAAE,CAAC;KACjB,CACF,CAAC;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,4CAAmD,CAAC;AAExF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,iDAAwD,CAAC;AAElG;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CAAC,CAAC,SAAS,aAAa,EACzE,KAAK,EAAE,CAAC,GACP,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,wBAAwB,CAC5C,CAAC,SAAS,kBAAkB,CAAC,0BAA0B,CAAC,EACxD,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAa1C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,uBAAuB,CAC3C,CAAC,SAAS,kBAAkB,CAAC,0BAA0B,CAAC,EACxD,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,CAa1C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAChE,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kCAAkC,CACtD,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAalB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Query } from "drizzle-orm";
|
|
2
|
+
import { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
3
|
+
import { ForgeSqlOrmOptions } from "../core/ForgeSQLQueryBuilder";
|
|
4
|
+
/**
|
|
5
|
+
* Generates a hash key for a query based on its SQL and parameters.
|
|
6
|
+
*
|
|
7
|
+
* @param query - The Drizzle query object
|
|
8
|
+
* @returns 32-character hexadecimal hash
|
|
9
|
+
*/
|
|
10
|
+
export declare function hashKey(query: Query): string;
|
|
11
|
+
/**
|
|
12
|
+
* Clears cache for a specific table.
|
|
13
|
+
* Uses cache context if available, otherwise clears immediately.
|
|
14
|
+
*
|
|
15
|
+
* @param schema - The table schema to clear cache for
|
|
16
|
+
* @param options - ForgeSQL ORM options
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearCache<T extends AnyMySqlTable>(schema: T, options: ForgeSqlOrmOptions): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Clears cache for multiple tables with retry logic and performance logging.
|
|
21
|
+
*
|
|
22
|
+
* @param tables - Array of table names to clear cache for
|
|
23
|
+
* @param options - ForgeSQL ORM options
|
|
24
|
+
* @returns Promise that resolves when cache clearing is complete
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearTablesCache(tables: string[], options: ForgeSqlOrmOptions): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Clears expired cache entries with retry logic and performance logging.
|
|
29
|
+
*
|
|
30
|
+
* @param options - ForgeSQL ORM options
|
|
31
|
+
* @returns Promise that resolves when expired cache clearing is complete
|
|
32
|
+
*/
|
|
33
|
+
export declare function clearExpiredCache(options: ForgeSqlOrmOptions): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves data from cache if it exists and is not expired.
|
|
36
|
+
*
|
|
37
|
+
* @param query - Query object with toSQL method
|
|
38
|
+
* @param options - ForgeSQL ORM options
|
|
39
|
+
* @returns Cached data if found and valid, undefined otherwise
|
|
40
|
+
*/
|
|
41
|
+
export declare function getFromCache<T>(query: {
|
|
42
|
+
toSQL: () => Query;
|
|
43
|
+
}, options: ForgeSqlOrmOptions): Promise<T | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Stores query results in cache with specified TTL.
|
|
46
|
+
*
|
|
47
|
+
* @param query - Query object with toSQL method
|
|
48
|
+
* @param options - ForgeSQL ORM options
|
|
49
|
+
* @param results - Data to cache
|
|
50
|
+
* @param cacheTtl - Time to live in seconds
|
|
51
|
+
* @returns Promise that resolves when data is stored in cache
|
|
52
|
+
*/
|
|
53
|
+
export declare function setCacheResult(query: {
|
|
54
|
+
toSQL: () => Query;
|
|
55
|
+
}, options: ForgeSqlOrmOptions, results: unknown, cacheTtl: number): Promise<void>;
|
|
56
|
+
//# sourceMappingURL=cacheUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheUtils.d.ts","sourceRoot":"","sources":["../../src/utils/cacheUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AA2ClE;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAK5C;AA+JD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,aAAa,EACtD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAmBf;AACD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlF;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,KAAK,CAAA;CAAE,EAC7B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAwCxB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,KAAK,CAAA;CAAE,EAC7B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CA2Cf"}
|
package/dist/utils/sqlUtils.d.ts
CHANGED
|
@@ -34,6 +34,14 @@ export interface MetadataInfo {
|
|
|
34
34
|
* @returns Date object
|
|
35
35
|
*/
|
|
36
36
|
export declare const parseDateTime: (value: string | Date, format: string) => Date;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to validate and format Date objects using DateTime
|
|
39
|
+
* @param value - Date object to validate and format
|
|
40
|
+
* @param format - DateTime format string
|
|
41
|
+
* @returns Formatted date string
|
|
42
|
+
* @throws Error if date is invalid
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatDateTime(value: Date, format: string): string;
|
|
37
45
|
/**
|
|
38
46
|
* Gets primary keys from the schema.
|
|
39
47
|
* @template T - The type of the table schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlUtils.d.ts","sourceRoot":"","sources":["../../src/utils/sqlUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0C,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,aAAa,EAAqB,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAIzF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,8BAA8B;IAC9B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,yCAAyC;IACzC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,oCAAoC;IACpC,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,oCAAoC;IACpC,WAAW,EAAE,iBA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