forge-sql-orm 2.1.12 → 2.1.14
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 +922 -549
- package/dist/core/ForgeSQLAnalyseOperations.d.ts.map +1 -1
- package/dist/core/ForgeSQLAnalyseOperations.js +257 -0
- package/dist/core/ForgeSQLAnalyseOperations.js.map +1 -0
- package/dist/core/ForgeSQLCacheOperations.js +172 -0
- package/dist/core/ForgeSQLCacheOperations.js.map +1 -0
- package/dist/core/ForgeSQLCrudOperations.js +349 -0
- package/dist/core/ForgeSQLCrudOperations.js.map +1 -0
- package/dist/core/ForgeSQLORM.d.ts +29 -1
- package/dist/core/ForgeSQLORM.d.ts.map +1 -1
- package/dist/core/ForgeSQLORM.js +1252 -0
- package/dist/core/ForgeSQLORM.js.map +1 -0
- package/dist/core/ForgeSQLQueryBuilder.d.ts +179 -1
- package/dist/core/ForgeSQLQueryBuilder.d.ts.map +1 -1
- package/dist/core/ForgeSQLQueryBuilder.js +77 -0
- package/dist/core/ForgeSQLQueryBuilder.js.map +1 -0
- package/dist/core/ForgeSQLSelectOperations.js +81 -0
- package/dist/core/ForgeSQLSelectOperations.js.map +1 -0
- package/dist/core/Rovo.d.ts +116 -0
- package/dist/core/Rovo.d.ts.map +1 -0
- package/dist/core/Rovo.js +647 -0
- package/dist/core/Rovo.js.map +1 -0
- package/dist/core/SystemTables.js +258 -0
- package/dist/core/SystemTables.js.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/drizzle/extensions/additionalActions.d.ts.map +1 -1
- package/dist/lib/drizzle/extensions/additionalActions.js +527 -0
- package/dist/lib/drizzle/extensions/additionalActions.js.map +1 -0
- package/dist/utils/cacheContextUtils.d.ts.map +1 -1
- package/dist/utils/cacheContextUtils.js +198 -0
- package/dist/utils/cacheContextUtils.js.map +1 -0
- package/dist/utils/cacheUtils.d.ts.map +1 -1
- package/dist/utils/cacheUtils.js +383 -0
- package/dist/utils/cacheUtils.js.map +1 -0
- package/dist/utils/forgeDriver.d.ts.map +1 -1
- package/dist/utils/forgeDriver.js +139 -0
- package/dist/utils/forgeDriver.js.map +1 -0
- package/dist/utils/forgeDriverProxy.js +68 -0
- package/dist/utils/forgeDriverProxy.js.map +1 -0
- package/dist/utils/metadataContextUtils.d.ts.map +1 -1
- package/dist/utils/metadataContextUtils.js +26 -0
- package/dist/utils/metadataContextUtils.js.map +1 -0
- package/dist/utils/requestTypeContextUtils.js +10 -0
- package/dist/utils/requestTypeContextUtils.js.map +1 -0
- package/dist/utils/sqlHints.js +52 -0
- package/dist/utils/sqlHints.js.map +1 -0
- package/dist/utils/sqlUtils.d.ts.map +1 -1
- package/dist/utils/sqlUtils.js +590 -0
- package/dist/utils/sqlUtils.js.map +1 -0
- package/dist/webtriggers/applyMigrationsWebTrigger.js +77 -0
- package/dist/webtriggers/applyMigrationsWebTrigger.js.map +1 -0
- package/dist/webtriggers/clearCacheSchedulerTrigger.js +83 -0
- package/dist/webtriggers/clearCacheSchedulerTrigger.js.map +1 -0
- package/dist/webtriggers/dropMigrationWebTrigger.js +54 -0
- package/dist/webtriggers/dropMigrationWebTrigger.js.map +1 -0
- package/dist/webtriggers/dropTablesMigrationWebTrigger.js +54 -0
- package/dist/webtriggers/dropTablesMigrationWebTrigger.js.map +1 -0
- package/dist/webtriggers/fetchSchemaWebTrigger.js +82 -0
- package/dist/webtriggers/fetchSchemaWebTrigger.js.map +1 -0
- package/dist/webtriggers/index.js +40 -0
- package/dist/webtriggers/index.js.map +1 -0
- package/dist/webtriggers/slowQuerySchedulerTrigger.js +80 -0
- package/dist/webtriggers/slowQuerySchedulerTrigger.js.map +1 -0
- package/package.json +31 -25
- package/src/core/ForgeSQLAnalyseOperations.ts +3 -2
- package/src/core/ForgeSQLORM.ts +64 -0
- package/src/core/ForgeSQLQueryBuilder.ts +200 -1
- package/src/core/Rovo.ts +765 -0
- package/src/lib/drizzle/extensions/additionalActions.ts +11 -0
- package/src/utils/cacheContextUtils.ts +9 -6
- package/src/utils/cacheUtils.ts +6 -4
- package/src/utils/forgeDriver.ts +3 -7
- package/src/utils/metadataContextUtils.ts +1 -3
- package/src/utils/sqlUtils.ts +33 -34
- package/dist/ForgeSQLORM.js +0 -3922
- package/dist/ForgeSQLORM.js.map +0 -1
- package/dist/ForgeSQLORM.mjs +0 -3905
- package/dist/ForgeSQLORM.mjs.map +0 -1
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patchDbWithSelectAliased = patchDbWithSelectAliased;
|
|
4
|
+
const __1 = require("../../..");
|
|
5
|
+
const cacheUtils_1 = require("../../../utils/cacheUtils");
|
|
6
|
+
const cacheContextUtils_1 = require("../../../utils/cacheContextUtils");
|
|
7
|
+
const sql_1 = require("drizzle-orm/sql/sql");
|
|
8
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
9
|
+
/**
|
|
10
|
+
* Error codes that should not trigger cache clearing
|
|
11
|
+
*/
|
|
12
|
+
const NON_CACHE_CLEARING_ERROR_CODES = ["VALIDATION_ERROR", "CONSTRAINT_ERROR"];
|
|
13
|
+
/**
|
|
14
|
+
* Error codes that should trigger cache clearing
|
|
15
|
+
*/
|
|
16
|
+
const CACHE_CLEARING_ERROR_CODES = ["DEADLOCK", "LOCK_WAIT_TIMEOUT", "CONNECTION_ERROR"];
|
|
17
|
+
/**
|
|
18
|
+
* Error message patterns that should not trigger cache clearing
|
|
19
|
+
*/
|
|
20
|
+
const NON_CACHE_CLEARING_PATTERNS = [/validation/i, /constraint/i];
|
|
21
|
+
/**
|
|
22
|
+
* Error message patterns that should trigger cache clearing
|
|
23
|
+
*/
|
|
24
|
+
const CACHE_CLEARING_PATTERNS = [/timeout/i, /connection/i];
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// CACHE MANAGEMENT UTILITIES
|
|
27
|
+
// ============================================================================
|
|
28
|
+
/**
|
|
29
|
+
* Determines whether cache should be cleared based on the error type.
|
|
30
|
+
* Only clears cache for errors that might indicate data consistency issues.
|
|
31
|
+
*
|
|
32
|
+
* @param error - The error that occurred during query execution
|
|
33
|
+
* @returns true if cache should be cleared, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
function shouldClearCacheOnError(error) {
|
|
36
|
+
// Don't clear cache for client-side errors (validation, etc.)
|
|
37
|
+
if (error?.code && NON_CACHE_CLEARING_ERROR_CODES.includes(error.code)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (error?.message &&
|
|
41
|
+
NON_CACHE_CLEARING_PATTERNS.some((pattern) => pattern.test(error.message))) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
// Clear cache for database-level errors that might affect data consistency
|
|
45
|
+
if (error?.code && CACHE_CLEARING_ERROR_CODES.includes(error.code)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (error?.message && CACHE_CLEARING_PATTERNS.some((pattern) => pattern.test(error.message))) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
// For unknown errors, be conservative and clear cache
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Handles successful query execution with cache management.
|
|
56
|
+
*
|
|
57
|
+
* @param rows - Query result rows
|
|
58
|
+
* @param onfulfilled - Success callback
|
|
59
|
+
* @param table - The table being modified
|
|
60
|
+
* @param options - ForgeSQL ORM options
|
|
61
|
+
* @param isCached - Whether to clear cache immediately
|
|
62
|
+
* @returns Promise with result
|
|
63
|
+
*/
|
|
64
|
+
async function handleSuccessfulExecution(rows, onfulfilled, table, options, isCached) {
|
|
65
|
+
try {
|
|
66
|
+
await (0, cacheContextUtils_1.evictLocalCacheQuery)(table, options);
|
|
67
|
+
await (0, cacheContextUtils_1.saveTableIfInsideCacheContext)(table);
|
|
68
|
+
if (isCached && !cacheContextUtils_1.cacheApplicationContext.getStore()) {
|
|
69
|
+
await (0, cacheUtils_1.clearCache)(table, options);
|
|
70
|
+
}
|
|
71
|
+
const result = onfulfilled ? onfulfilled(rows) : rows;
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
// Only clear cache for certain types of errors
|
|
76
|
+
if (shouldClearCacheOnError(error)) {
|
|
77
|
+
await (0, cacheContextUtils_1.evictLocalCacheQuery)(table, options);
|
|
78
|
+
if (isCached) {
|
|
79
|
+
await (0, cacheUtils_1.clearCache)(table, options).catch((e) => {
|
|
80
|
+
// eslint-disable-next-line no-console
|
|
81
|
+
console.warn("Ignore cache clear errors", e);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
await (0, cacheContextUtils_1.saveTableIfInsideCacheContext)(table);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Handles function calls on the wrapped builder.
|
|
93
|
+
*
|
|
94
|
+
* @param value - The function to call
|
|
95
|
+
* @param target - The target object
|
|
96
|
+
* @param args - Function arguments
|
|
97
|
+
* @param table - The table being modified
|
|
98
|
+
* @param options - ForgeSQL ORM options
|
|
99
|
+
* @param isCached - Whether to clear cache immediately
|
|
100
|
+
* @returns Function result or wrapped builder
|
|
101
|
+
*/
|
|
102
|
+
function handleFunctionCall(value, target, args, table, options, isCached) {
|
|
103
|
+
const result = value.apply(target, args);
|
|
104
|
+
if (typeof result === "object" && result !== null && "execute" in result) {
|
|
105
|
+
return wrapCacheEvictBuilder(result, table, options, isCached);
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Wraps a query builder with cache eviction functionality.
|
|
111
|
+
* Automatically clears cache after successful execution of insert/update/delete operations.
|
|
112
|
+
*
|
|
113
|
+
* @param rawBuilder - The original query builder to wrap
|
|
114
|
+
* @param table - The table being modified (used for cache eviction)
|
|
115
|
+
* @param options - ForgeSQL ORM options including cache configuration
|
|
116
|
+
* @param isCached - Whether to clear cache immediately
|
|
117
|
+
* @returns Wrapped query builder with cache eviction
|
|
118
|
+
*/
|
|
119
|
+
const wrapCacheEvictBuilder = (rawBuilder, table, options, isCached) => {
|
|
120
|
+
return new Proxy(rawBuilder, {
|
|
121
|
+
get(target, prop, receiver) {
|
|
122
|
+
if (prop === "then") {
|
|
123
|
+
return (onfulfilled, onrejected) => target
|
|
124
|
+
.execute()
|
|
125
|
+
.then((rows) => handleSuccessfulExecution(rows, onfulfilled, table, options, isCached), onrejected);
|
|
126
|
+
}
|
|
127
|
+
const value = Reflect.get(target, prop, receiver);
|
|
128
|
+
if (typeof value === "function") {
|
|
129
|
+
return (...args) => handleFunctionCall(value, target, args, table, options, isCached);
|
|
130
|
+
}
|
|
131
|
+
return value;
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Creates an insert query builder that automatically evicts cache after execution.
|
|
137
|
+
*
|
|
138
|
+
* @param db - The database instance
|
|
139
|
+
* @param table - The table to insert into
|
|
140
|
+
* @param options - ForgeSQL ORM options
|
|
141
|
+
* @returns Insert query builder with cache eviction
|
|
142
|
+
*/
|
|
143
|
+
function insertAndEvictCacheBuilder(db, table, options, isCached) {
|
|
144
|
+
const builder = db.insert(table);
|
|
145
|
+
return wrapCacheEvictBuilder(builder, table, options, isCached);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Creates an update query builder that automatically evicts cache after execution.
|
|
149
|
+
*
|
|
150
|
+
* @param db - The database instance
|
|
151
|
+
* @param table - The table to update
|
|
152
|
+
* @param options - ForgeSQL ORM options
|
|
153
|
+
* @returns Update query builder with cache eviction
|
|
154
|
+
*/
|
|
155
|
+
function updateAndEvictCacheBuilder(db, table, options, isCached) {
|
|
156
|
+
const builder = db.update(table);
|
|
157
|
+
return wrapCacheEvictBuilder(builder, table, options, isCached);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Creates a delete query builder that automatically evicts cache after execution.
|
|
161
|
+
*
|
|
162
|
+
* @param db - The database instance
|
|
163
|
+
* @param table - The table to delete from
|
|
164
|
+
* @param options - ForgeSQL ORM options
|
|
165
|
+
* @returns Delete query builder with cache eviction
|
|
166
|
+
*/
|
|
167
|
+
function deleteAndEvictCacheBuilder(db, table, options, isCached) {
|
|
168
|
+
const builder = db.delete(table);
|
|
169
|
+
return wrapCacheEvictBuilder(builder, table, options, isCached);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Handles cached query execution with proper error handling.
|
|
173
|
+
*
|
|
174
|
+
* @param target - The query target
|
|
175
|
+
* @param options - ForgeSQL ORM options
|
|
176
|
+
* @param cacheTtl - Cache TTL
|
|
177
|
+
* @param selections - Field selections
|
|
178
|
+
* @param aliasMap - Field alias mapping
|
|
179
|
+
* @param onfulfilled - Success callback
|
|
180
|
+
* @param onrejected - Error callback
|
|
181
|
+
* @returns Promise with cached result
|
|
182
|
+
*/
|
|
183
|
+
async function handleCachedQuery(target, options, cacheTtl, selections, aliasMap, onfulfilled, onrejected) {
|
|
184
|
+
try {
|
|
185
|
+
const localCached = await (0, cacheContextUtils_1.getQueryLocalCacheQuery)(target, options);
|
|
186
|
+
if (localCached) {
|
|
187
|
+
return onfulfilled ? onfulfilled(localCached) : localCached;
|
|
188
|
+
}
|
|
189
|
+
const cacheResult = await (0, cacheUtils_1.getFromCache)(target, options);
|
|
190
|
+
if (cacheResult) {
|
|
191
|
+
return onfulfilled ? onfulfilled(cacheResult) : cacheResult;
|
|
192
|
+
}
|
|
193
|
+
const rows = await target.execute();
|
|
194
|
+
const transformed = (0, __1.applyFromDriverTransform)(rows, selections, aliasMap);
|
|
195
|
+
await (0, cacheContextUtils_1.saveQueryLocalCacheQuery)(target, transformed, options);
|
|
196
|
+
await (0, cacheUtils_1.setCacheResult)(target, options, transformed, cacheTtl).catch((cacheError) => {
|
|
197
|
+
// Log cache error but don't fail the query
|
|
198
|
+
// eslint-disable-next-line no-console
|
|
199
|
+
console.warn("Cache set error:", cacheError);
|
|
200
|
+
});
|
|
201
|
+
return onfulfilled ? onfulfilled(transformed) : transformed;
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
if (onrejected) {
|
|
205
|
+
return onrejected(error);
|
|
206
|
+
}
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Handles non-cached query execution.
|
|
212
|
+
*
|
|
213
|
+
* @param target - The query target
|
|
214
|
+
* @param options - ForgeSQL ORM options
|
|
215
|
+
* @param selections - Field selections
|
|
216
|
+
* @param aliasMap - Field alias mapping
|
|
217
|
+
* @param onfulfilled - Success callback
|
|
218
|
+
* @param onrejected - Error callback
|
|
219
|
+
* @returns Promise with transformed result
|
|
220
|
+
*/
|
|
221
|
+
async function handleNonCachedQuery(target, options, selections, aliasMap, onfulfilled, onrejected) {
|
|
222
|
+
try {
|
|
223
|
+
const localCached = await (0, cacheContextUtils_1.getQueryLocalCacheQuery)(target, options);
|
|
224
|
+
if (localCached) {
|
|
225
|
+
return onfulfilled ? onfulfilled(localCached) : localCached;
|
|
226
|
+
}
|
|
227
|
+
const rows = await target.execute();
|
|
228
|
+
const transformed = (0, __1.applyFromDriverTransform)(rows, selections, aliasMap);
|
|
229
|
+
await (0, cacheContextUtils_1.saveQueryLocalCacheQuery)(target, transformed, options);
|
|
230
|
+
return onfulfilled ? onfulfilled(transformed) : transformed;
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
if (onrejected) {
|
|
234
|
+
return onrejected(error);
|
|
235
|
+
}
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Creates a select query builder with field aliasing and optional caching support.
|
|
241
|
+
*
|
|
242
|
+
* @param db - The database instance
|
|
243
|
+
* @param fields - The fields to select with aliases
|
|
244
|
+
* @param selectFn - Function to create the base select query
|
|
245
|
+
* @param useCache - Whether to enable caching for this query
|
|
246
|
+
* @param options - ForgeSQL ORM options
|
|
247
|
+
* @param cacheTtl - Optional cache TTL override
|
|
248
|
+
* @returns Select query builder with aliasing and optional caching
|
|
249
|
+
*/
|
|
250
|
+
function createAliasedSelectBuilder(db, fields, selectFn, useCache, options, cacheTtl) {
|
|
251
|
+
const { selections, aliasMap } = (0, __1.mapSelectFieldsWithAlias)(fields);
|
|
252
|
+
const builder = selectFn(selections);
|
|
253
|
+
const wrapBuilder = (rawBuilder) => {
|
|
254
|
+
return new Proxy(rawBuilder, {
|
|
255
|
+
get(target, prop, receiver) {
|
|
256
|
+
if (prop === "execute") {
|
|
257
|
+
return async (...args) => {
|
|
258
|
+
const rows = await target.execute(...args);
|
|
259
|
+
return (0, __1.applyFromDriverTransform)(rows, selections, aliasMap);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
if (prop === "then") {
|
|
263
|
+
return (onfulfilled, onrejected) => {
|
|
264
|
+
if (useCache) {
|
|
265
|
+
const ttl = cacheTtl ?? options.cacheTTL ?? 120;
|
|
266
|
+
return handleCachedQuery(target, options, ttl, selections, aliasMap, onfulfilled, onrejected);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
return handleNonCachedQuery(target, options, selections, aliasMap, onfulfilled, onrejected);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
if (prop === "catch") {
|
|
274
|
+
return (onrejected) => receiver.then(undefined, onrejected);
|
|
275
|
+
}
|
|
276
|
+
if (prop === "finally") {
|
|
277
|
+
return (onfinally) => receiver.then((value) => Promise.resolve(value).finally(onfinally), (reason) => Promise.reject(reason).finally(onfinally));
|
|
278
|
+
}
|
|
279
|
+
const value = Reflect.get(target, prop, receiver);
|
|
280
|
+
if (typeof value === "function") {
|
|
281
|
+
return (...args) => {
|
|
282
|
+
const result = value.apply(target, args);
|
|
283
|
+
if (typeof result === "object" && result !== null && "execute" in result) {
|
|
284
|
+
return wrapBuilder(result);
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
return value;
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
return wrapBuilder(builder);
|
|
294
|
+
}
|
|
295
|
+
// ============================================================================
|
|
296
|
+
// CONFIGURATION AND CONSTANTS
|
|
297
|
+
// ============================================================================
|
|
298
|
+
/**
|
|
299
|
+
* Default options for ForgeSQL ORM
|
|
300
|
+
*/
|
|
301
|
+
const DEFAULT_OPTIONS = {
|
|
302
|
+
logRawSqlQuery: false,
|
|
303
|
+
disableOptimisticLocking: false,
|
|
304
|
+
cacheTTL: 120,
|
|
305
|
+
cacheWrapTable: true,
|
|
306
|
+
cacheEntityQueryName: "sql",
|
|
307
|
+
cacheEntityExpirationName: "expiration",
|
|
308
|
+
cacheEntityDataName: "data",
|
|
309
|
+
};
|
|
310
|
+
// ============================================================================
|
|
311
|
+
// QUERY BUILDER FACTORIES
|
|
312
|
+
// ============================================================================
|
|
313
|
+
/**
|
|
314
|
+
* Creates a raw SQL query executor with caching support
|
|
315
|
+
*/
|
|
316
|
+
function createRawQueryExecutor(db, options, useGlobalCache = false) {
|
|
317
|
+
return async function (query, cacheTtl) {
|
|
318
|
+
let sql;
|
|
319
|
+
if ((0, sql_1.isSQLWrapper)(query)) {
|
|
320
|
+
const dialect = db.dialect;
|
|
321
|
+
sql = dialect.sqlToQuery(query);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
sql = {
|
|
325
|
+
sql: query,
|
|
326
|
+
params: [],
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
// Check local cache first
|
|
330
|
+
const localCacheResult = await (0, cacheContextUtils_1.getQueryLocalCacheQuery)(sql, options);
|
|
331
|
+
if (localCacheResult) {
|
|
332
|
+
return localCacheResult;
|
|
333
|
+
}
|
|
334
|
+
// Check global cache if enabled
|
|
335
|
+
if (useGlobalCache) {
|
|
336
|
+
const cacheResult = await (0, cacheUtils_1.getFromCache)({ toSQL: () => sql }, options);
|
|
337
|
+
if (cacheResult) {
|
|
338
|
+
return cacheResult;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// Execute query
|
|
342
|
+
const results = await db.execute(query);
|
|
343
|
+
// Save to local cache
|
|
344
|
+
await (0, cacheContextUtils_1.saveQueryLocalCacheQuery)(sql, results, options);
|
|
345
|
+
// Save to global cache if enabled
|
|
346
|
+
if (useGlobalCache) {
|
|
347
|
+
await (0, cacheUtils_1.setCacheResult)({ toSQL: () => sql }, options, results, cacheTtl ?? options.cacheTTL ?? 120);
|
|
348
|
+
}
|
|
349
|
+
return results;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
// ============================================================================
|
|
353
|
+
// MAIN PATCH FUNCTION
|
|
354
|
+
// ============================================================================
|
|
355
|
+
/**
|
|
356
|
+
* Patches a Drizzle database instance with additional methods for aliased selects and cache management.
|
|
357
|
+
*
|
|
358
|
+
* This function extends the database instance with:
|
|
359
|
+
* - selectAliased: Select with field aliasing support
|
|
360
|
+
* - selectAliasedDistinct: Select distinct with field aliasing support
|
|
361
|
+
* - selectAliasedCacheable: Select with field aliasing and caching
|
|
362
|
+
* - selectAliasedDistinctCacheable: Select distinct with field aliasing and caching
|
|
363
|
+
* - insertAndEvictCache: Insert operations that automatically evict cache
|
|
364
|
+
* - updateAndEvictCache: Update operations that automatically evict cache
|
|
365
|
+
* - deleteAndEvictCache: Delete operations that automatically evict cache
|
|
366
|
+
*
|
|
367
|
+
* @param db - The Drizzle database instance to patch
|
|
368
|
+
* @param options - Optional ForgeSQL ORM configuration
|
|
369
|
+
* @returns The patched database instance with additional methods
|
|
370
|
+
*/
|
|
371
|
+
function patchDbWithSelectAliased(db, options) {
|
|
372
|
+
const newOptions = { ...DEFAULT_OPTIONS, ...options };
|
|
373
|
+
// ============================================================================
|
|
374
|
+
// SELECT METHODS WITH FIELD ALIASING
|
|
375
|
+
// ============================================================================
|
|
376
|
+
// Select aliased without cache
|
|
377
|
+
db.selectAliased = function (fields) {
|
|
378
|
+
return createAliasedSelectBuilder(db, fields, (selections) => db.select(selections), false, newOptions);
|
|
379
|
+
};
|
|
380
|
+
// Select aliased with cache
|
|
381
|
+
db.selectAliasedCacheable = function (fields, cacheTtl) {
|
|
382
|
+
return createAliasedSelectBuilder(db, fields, (selections) => db.select(selections), true, newOptions, cacheTtl);
|
|
383
|
+
};
|
|
384
|
+
// Select aliased distinct without cache
|
|
385
|
+
db.selectAliasedDistinct = function (fields) {
|
|
386
|
+
return createAliasedSelectBuilder(db, fields, (selections) => db.selectDistinct(selections), false, newOptions);
|
|
387
|
+
};
|
|
388
|
+
// Select aliased distinct with cache
|
|
389
|
+
db.selectAliasedDistinctCacheable = function (fields, cacheTtl) {
|
|
390
|
+
return createAliasedSelectBuilder(db, fields, (selections) => db.selectDistinct(selections), true, newOptions, cacheTtl);
|
|
391
|
+
};
|
|
392
|
+
// ============================================================================
|
|
393
|
+
// TABLE-BASED SELECT METHODS
|
|
394
|
+
// ============================================================================
|
|
395
|
+
/**
|
|
396
|
+
* Creates a select query builder for all columns from a table with field aliasing support.
|
|
397
|
+
* This is a convenience method that automatically selects all columns from the specified table.
|
|
398
|
+
*
|
|
399
|
+
* @param table - The table to select from
|
|
400
|
+
* @returns Select query builder with all table columns and field aliasing support
|
|
401
|
+
* @example
|
|
402
|
+
* ```typescript
|
|
403
|
+
* const users = await db.selectFrom(userTable).where(eq(userTable.id, 1));
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
db.selectFrom = function (table) {
|
|
407
|
+
return db.selectAliased((0, drizzle_orm_1.getTableColumns)(table)).from(table);
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* Creates a select query builder for all columns from a table with field aliasing and caching support.
|
|
411
|
+
* This is a convenience method that automatically selects all columns from the specified table with caching enabled.
|
|
412
|
+
*
|
|
413
|
+
* @param table - The table to select from
|
|
414
|
+
* @param cacheTtl - Optional cache TTL override (defaults to global cache TTL)
|
|
415
|
+
* @returns Select query builder with all table columns, field aliasing, and caching support
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const users = await db.selectFromCacheable(userTable, 300).where(eq(userTable.id, 1));
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
db.selectFromCacheable = function (table, cacheTtl) {
|
|
422
|
+
return db
|
|
423
|
+
.selectAliasedCacheable((0, drizzle_orm_1.getTableColumns)(table), cacheTtl)
|
|
424
|
+
.from(table);
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* Creates a select distinct query builder for all columns from a table with field aliasing support.
|
|
428
|
+
* This is a convenience method that automatically selects all distinct columns from the specified table.
|
|
429
|
+
*
|
|
430
|
+
* @param table - The table to select from
|
|
431
|
+
* @returns Select distinct query builder with all table columns and field aliasing support
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* const uniqueUsers = await db.selectDistinctFrom(userTable).where(eq(userTable.status, 'active'));
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
db.selectDistinctFrom = function (table) {
|
|
438
|
+
return db
|
|
439
|
+
.selectAliasedDistinct((0, drizzle_orm_1.getTableColumns)(table))
|
|
440
|
+
.from(table);
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Creates a select distinct query builder for all columns from a table with field aliasing and caching support.
|
|
444
|
+
* This is a convenience method that automatically selects all distinct columns from the specified table with caching enabled.
|
|
445
|
+
*
|
|
446
|
+
* @param table - The table to select from
|
|
447
|
+
* @param cacheTtl - Optional cache TTL override (defaults to global cache TTL)
|
|
448
|
+
* @returns Select distinct query builder with all table columns, field aliasing, and caching support
|
|
449
|
+
* @example
|
|
450
|
+
* ```typescript
|
|
451
|
+
* const uniqueUsers = await db.selectDistinctFromCacheable(userTable, 300).where(eq(userTable.status, 'active'));
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
db.selectDistinctFromCacheable = function (table, cacheTtl) {
|
|
455
|
+
return db
|
|
456
|
+
.selectAliasedDistinctCacheable((0, drizzle_orm_1.getTableColumns)(table), cacheTtl)
|
|
457
|
+
.from(table);
|
|
458
|
+
};
|
|
459
|
+
// ============================================================================
|
|
460
|
+
// CACHE-AWARE MODIFY OPERATIONS
|
|
461
|
+
// ============================================================================
|
|
462
|
+
// Insert with cache context support (participates in cache clearing when used within cache context)
|
|
463
|
+
db.insertWithCacheContext = function (table) {
|
|
464
|
+
return insertAndEvictCacheBuilder(db, table, newOptions, false);
|
|
465
|
+
};
|
|
466
|
+
// Insert with cache eviction
|
|
467
|
+
db.insertAndEvictCache = function (table) {
|
|
468
|
+
return insertAndEvictCacheBuilder(db, table, newOptions, true);
|
|
469
|
+
};
|
|
470
|
+
// Update with cache context support (participates in cache clearing when used within cache context)
|
|
471
|
+
db.updateWithCacheContext = function (table) {
|
|
472
|
+
return updateAndEvictCacheBuilder(db, table, newOptions, false);
|
|
473
|
+
};
|
|
474
|
+
// Update with cache eviction
|
|
475
|
+
db.updateAndEvictCache = function (table) {
|
|
476
|
+
return updateAndEvictCacheBuilder(db, table, newOptions, true);
|
|
477
|
+
};
|
|
478
|
+
// Delete with cache context support (participates in cache clearing when used within cache context)
|
|
479
|
+
db.deleteWithCacheContext = function (table) {
|
|
480
|
+
return deleteAndEvictCacheBuilder(db, table, newOptions, false);
|
|
481
|
+
};
|
|
482
|
+
// Delete with cache eviction
|
|
483
|
+
db.deleteAndEvictCache = function (table) {
|
|
484
|
+
return deleteAndEvictCacheBuilder(db, table, newOptions, true);
|
|
485
|
+
};
|
|
486
|
+
// ============================================================================
|
|
487
|
+
// RAW SQL QUERY EXECUTORS
|
|
488
|
+
// ============================================================================
|
|
489
|
+
/**
|
|
490
|
+
* Executes a raw SQL query with local cache support.
|
|
491
|
+
* This method provides local caching for raw SQL queries within the current invocation context.
|
|
492
|
+
* Results are cached locally and will be returned from cache on subsequent identical queries.
|
|
493
|
+
*
|
|
494
|
+
* @param query - The SQL query to execute (SQLWrapper or string)
|
|
495
|
+
* @returns Promise with query results
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* // Using SQLWrapper
|
|
499
|
+
* const result = await db.executeQuery(sql`SELECT * FROM users WHERE id = ${userId}`);
|
|
500
|
+
*
|
|
501
|
+
* // Using string
|
|
502
|
+
* const result = await db.executeQuery("SELECT * FROM users WHERE status = 'active'");
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
db.executeQuery = createRawQueryExecutor(db, newOptions, false);
|
|
506
|
+
/**
|
|
507
|
+
* Executes a raw SQL query with both local and global cache support.
|
|
508
|
+
* This method provides comprehensive caching for raw SQL queries:
|
|
509
|
+
* - Local cache: Within the current invocation context
|
|
510
|
+
* - Global cache: Cross-invocation caching using @forge/kvs
|
|
511
|
+
*
|
|
512
|
+
* @param query - The SQL query to execute (SQLWrapper or string)
|
|
513
|
+
* @param cacheTtl - Optional cache TTL override (defaults to global cache TTL)
|
|
514
|
+
* @returns Promise with query results
|
|
515
|
+
* @example
|
|
516
|
+
* ```typescript
|
|
517
|
+
* // Using SQLWrapper with custom TTL
|
|
518
|
+
* const result = await db.executeQueryCacheable(sql`SELECT * FROM users WHERE id = ${userId}`, 300);
|
|
519
|
+
*
|
|
520
|
+
* // Using string with default TTL
|
|
521
|
+
* const result = await db.executeQueryCacheable("SELECT * FROM users WHERE status = 'active'");
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
db.executeQueryCacheable = createRawQueryExecutor(db, newOptions, true);
|
|
525
|
+
return db;
|
|
526
|
+
}
|
|
527
|
+
//# sourceMappingURL=additionalActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additionalActions.js","sourceRoot":"","sources":["../../../../src/lib/drizzle/extensions/additionalActions.ts"],"names":[],"mappings":";;AAwtBA,4DAgZC;AAhmCD,gCAAkG;AAQlG,0DAAqF;AACrF,wEAM0C;AAC1C,6CAA+D;AAE/D,6C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