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.
Files changed (46) hide show
  1. package/README.md +1090 -81
  2. package/dist/ForgeSQLORM.js +1080 -60
  3. package/dist/ForgeSQLORM.js.map +1 -1
  4. package/dist/ForgeSQLORM.mjs +1063 -60
  5. package/dist/ForgeSQLORM.mjs.map +1 -1
  6. package/dist/core/ForgeSQLAnalyseOperations.d.ts +1 -1
  7. package/dist/core/ForgeSQLAnalyseOperations.d.ts.map +1 -1
  8. package/dist/core/ForgeSQLCacheOperations.d.ts +119 -0
  9. package/dist/core/ForgeSQLCacheOperations.d.ts.map +1 -0
  10. package/dist/core/ForgeSQLCrudOperations.d.ts +38 -22
  11. package/dist/core/ForgeSQLCrudOperations.d.ts.map +1 -1
  12. package/dist/core/ForgeSQLORM.d.ts +104 -13
  13. package/dist/core/ForgeSQLORM.d.ts.map +1 -1
  14. package/dist/core/ForgeSQLQueryBuilder.d.ts +243 -15
  15. package/dist/core/ForgeSQLQueryBuilder.d.ts.map +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/lib/drizzle/extensions/additionalActions.d.ts +42 -0
  19. package/dist/lib/drizzle/extensions/additionalActions.d.ts.map +1 -0
  20. package/dist/utils/cacheContextUtils.d.ts +123 -0
  21. package/dist/utils/cacheContextUtils.d.ts.map +1 -0
  22. package/dist/utils/cacheUtils.d.ts +56 -0
  23. package/dist/utils/cacheUtils.d.ts.map +1 -0
  24. package/dist/utils/sqlUtils.d.ts +8 -0
  25. package/dist/utils/sqlUtils.d.ts.map +1 -1
  26. package/dist/webtriggers/clearCacheSchedulerTrigger.d.ts +46 -0
  27. package/dist/webtriggers/clearCacheSchedulerTrigger.d.ts.map +1 -0
  28. package/dist/webtriggers/index.d.ts +1 -0
  29. package/dist/webtriggers/index.d.ts.map +1 -1
  30. package/package.json +15 -12
  31. package/src/core/ForgeSQLAnalyseOperations.ts +1 -1
  32. package/src/core/ForgeSQLCacheOperations.ts +195 -0
  33. package/src/core/ForgeSQLCrudOperations.ts +49 -40
  34. package/src/core/ForgeSQLORM.ts +443 -34
  35. package/src/core/ForgeSQLQueryBuilder.ts +291 -20
  36. package/src/index.ts +1 -1
  37. package/src/lib/drizzle/extensions/additionalActions.ts +548 -0
  38. package/src/lib/drizzle/extensions/types.d.ts +68 -10
  39. package/src/utils/cacheContextUtils.ts +210 -0
  40. package/src/utils/cacheUtils.ts +403 -0
  41. package/src/utils/sqlUtils.ts +16 -0
  42. package/src/webtriggers/clearCacheSchedulerTrigger.ts +79 -0
  43. package/src/webtriggers/index.ts +1 -0
  44. package/dist/lib/drizzle/extensions/selectAliased.d.ts +0 -9
  45. package/dist/lib/drizzle/extensions/selectAliased.d.ts.map +0 -1
  46. package/src/lib/drizzle/extensions/selectAliased.ts +0 -72
@@ -5,42 +5,71 @@ import {
5
5
  AnyMySqlTable,
6
6
  customType,
7
7
  MySqlSelectBuilder,
8
+ MySqlTable,
8
9
  } from "drizzle-orm/mysql-core";
9
10
  import {
10
11
  MySqlSelectDynamic,
11
12
  type SelectedFields,
12
13
  } from "drizzle-orm/mysql-core/query-builders/select.types";
13
14
  import { InferInsertModel, Query, SQL } from "drizzle-orm";
14
- import { DateTime } from "luxon";
15
- import { parseDateTime } from "../utils/sqlUtils";
16
- import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT } from "drizzle-orm/mysql-proxy/index";
15
+ import { parseDateTime, formatDateTime } from "../utils/sqlUtils";
16
+ import { MySqlRemoteDatabase, MySqlRemotePreparedQueryHKT } from "drizzle-orm/mysql-proxy";
17
17
  import { SqlHints } from "../utils/sqlHints";
18
18
  import {
19
19
  ClusterStatementRowCamelCase,
20
20
  ExplainAnalyzeRow,
21
21
  SlowQueryNormalized,
22
22
  } from "./SystemTables";
23
+ import { ForgeSQLCacheOperations } from "./ForgeSQLCacheOperations";
24
+ import {
25
+ DeleteAndEvictCacheType,
26
+ InsertAndEvictCacheType,
27
+ SelectAliasedCacheableType,
28
+ SelectAliasedDistinctCacheableType,
29
+ SelectAliasedDistinctType,
30
+ SelectAliasedType,
31
+ UpdateAndEvictCacheType,
32
+ } from "..";
33
+ import {
34
+ MySqlDeleteBase,
35
+ MySqlInsertBuilder,
36
+ MySqlUpdateBuilder,
37
+ } from "drizzle-orm/mysql-core/query-builders";
38
+ import { MySqlRemoteQueryResultHKT } from "drizzle-orm/mysql-proxy";
23
39
 
24
40
  /**
25
41
  * Core interface for ForgeSQL operations.
26
42
  * Provides access to CRUD operations, schema-level SQL operations, and query analysis capabilities.
27
43
  *
44
+ * This is the main interface that developers interact with when using ForgeSQL ORM.
45
+ * It combines query building capabilities with database operations and caching.
46
+ *
28
47
  * @interface ForgeSqlOperation
29
48
  * @extends {QueryBuilderForgeSql}
30
49
  */
31
50
  export interface ForgeSqlOperation extends QueryBuilderForgeSql {
32
51
  /**
33
- * Provides CRUD (Create, Update, Delete) operations.
34
- * @deprecated Use modify() instead for better type safety and consistency
35
- * @returns {CRUDForgeSQL} Interface for performing CRUD operations
52
+ * Creates a new query builder for the given entity.
53
+ * @returns {MySqlRemoteDatabase<Record<string, unknown>>} The Drizzle database instance for building queries
36
54
  */
37
- crud(): CRUDForgeSQL;
55
+ getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown>> & {
56
+ selectAliased: SelectAliasedType;
57
+ selectAliasedDistinct: SelectAliasedDistinctType;
58
+ selectAliasedCacheable: SelectAliasedCacheableType;
59
+ selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
60
+ insertWithCacheContext: InsertAndEvictCacheType;
61
+ insertAndEvictCache: InsertAndEvictCacheType;
62
+ updateAndEvictCache: UpdateAndEvictCacheType;
63
+ updateWithCacheContext: UpdateAndEvictCacheType;
64
+ deleteAndEvictCache: DeleteAndEvictCacheType;
65
+ deleteWithCacheContext: DeleteAndEvictCacheType;
66
+ };
38
67
 
39
68
  /**
40
69
  * Provides modify (Create, Update, Delete) operations with optimistic locking support.
41
- * @returns {CRUDForgeSQL} Interface for performing CRUD operations
70
+ * @returns {VerioningModificationForgeSQL} Interface for performing CRUD operations
42
71
  */
43
- modify(): CRUDForgeSQL;
72
+ modifyWithVersioning(): VerioningModificationForgeSQL;
44
73
 
45
74
  /**
46
75
  * Provides schema-level SQL fetch operations with type safety.
@@ -53,12 +82,29 @@ export interface ForgeSqlOperation extends QueryBuilderForgeSql {
53
82
  * @returns {SchemaAnalyzeForgeSql} Interface for analyzing query performance
54
83
  */
55
84
  analyze(): SchemaAnalyzeForgeSql;
85
+
86
+ /**
87
+ * Provides schema-level SQL operations with optimistic locking/versioning and automatic cache eviction.
88
+ *
89
+ * This method returns operations that use `modifyWithVersioning()` internally, providing:
90
+ * - Optimistic locking support
91
+ * - Automatic version field management
92
+ * - Cache eviction after successful operations
93
+ *
94
+ * @returns {ForgeSQLCacheOperations} Interface for executing versioned SQL operations with cache management
95
+ */
96
+ modifyWithVersioningAndEvictCache(): ForgeSQLCacheOperations;
56
97
  }
57
98
 
58
99
  /**
59
100
  * Interface for Query Builder operations.
60
101
  * Provides access to the underlying Drizzle ORM query builder with enhanced functionality.
61
102
  *
103
+ * This interface extends Drizzle's query building capabilities with:
104
+ * - Field aliasing to prevent name collisions in joins
105
+ * - Caching support for select operations
106
+ * - Automatic cache eviction for modify operations
107
+ *
62
108
  * @interface QueryBuilderForgeSql
63
109
  */
64
110
  export interface QueryBuilderForgeSql {
@@ -66,7 +112,18 @@ export interface QueryBuilderForgeSql {
66
112
  * Creates a new query builder for the given entity.
67
113
  * @returns {MySqlRemoteDatabase<Record<string, unknown>>} The Drizzle database instance for building queries
68
114
  */
69
- getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown>>;
115
+ getDrizzleQueryBuilder(): MySqlRemoteDatabase<Record<string, unknown>> & {
116
+ selectAliased: SelectAliasedType;
117
+ selectAliasedDistinct: SelectAliasedDistinctType;
118
+ selectAliasedCacheable: SelectAliasedCacheableType;
119
+ selectAliasedDistinctCacheable: SelectAliasedDistinctCacheableType;
120
+ insertWithCacheContext: InsertAndEvictCacheType;
121
+ insertAndEvictCache: InsertAndEvictCacheType;
122
+ updateAndEvictCache: UpdateAndEvictCacheType;
123
+ updateWithCacheContext: UpdateAndEvictCacheType;
124
+ deleteAndEvictCache: DeleteAndEvictCacheType;
125
+ deleteWithCacheContext: DeleteAndEvictCacheType;
126
+ };
70
127
 
71
128
  /**
72
129
  * Creates a select query with unique field aliases to prevent field name collisions in joins.
@@ -107,15 +164,217 @@ export interface QueryBuilderForgeSql {
107
164
  selectDistinct<TSelection extends SelectedFields>(
108
165
  fields: TSelection,
109
166
  ): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
167
+
168
+ /**
169
+ * Creates a cacheable select query with unique field aliases to prevent field name collisions in joins.
170
+ * This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
171
+ *
172
+ * @template TSelection - The type of the selected fields
173
+ * @param {TSelection} fields - Object containing the fields to select, with table schemas as values
174
+ * @param {number} cacheTTL - cache ttl optional default is 60 sec.
175
+ * @returns {MySqlSelectBuilder<TSelection, MySql2PreparedQueryHKT>} A select query builder with unique field aliases
176
+ * @throws {Error} If fields parameter is empty
177
+ * @example
178
+ * ```typescript
179
+ * await forgeSQL
180
+ * .selectCacheable({user: users, order: orders},60)
181
+ * .from(orders)
182
+ * .innerJoin(users, eq(orders.userId, users.id));
183
+ * ```
184
+ */
185
+ selectCacheable<TSelection extends SelectedFields>(
186
+ fields: TSelection,
187
+ cacheTTL?: number,
188
+ ): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
189
+
190
+ /**
191
+ * Creates a cacheable distinct select query with unique field aliases to prevent field name collisions in joins.
192
+ * This is particularly useful when working with Atlassian Forge SQL, which collapses fields with the same name in joined tables.
193
+ *
194
+ * @template TSelection - The type of the selected fields
195
+ * @param {TSelection} fields - Object containing the fields to select, with table schemas as values
196
+ * @param {number} cacheTTL - cache ttl optional default is 60 sec.
197
+ * @returns {MySqlSelectBuilder<TSelection, MySql2PreparedQueryHKT>} A distinct select query builder with unique field aliases
198
+ * @throws {Error} If fields parameter is empty
199
+ * @example
200
+ * ```typescript
201
+ * await forgeSQL
202
+ * .selectDistinctCacheable({user: users, order: orders}, 60)
203
+ * .from(orders)
204
+ * .innerJoin(users, eq(orders.userId, users.id));
205
+ * ```
206
+ */
207
+ selectDistinctCacheable<TSelection extends SelectedFields>(
208
+ fields: TSelection,
209
+ cacheTTL?: number,
210
+ ): MySqlSelectBuilder<TSelection, MySqlRemotePreparedQueryHKT>;
211
+
212
+ /**
213
+ * Creates an insert query builder.
214
+ *
215
+ * ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
216
+ * For versioned inserts, use `modifyWithVersioning().insert()` or `modifyWithVersioningAndEvictCache().insert()` instead.
217
+ *
218
+ * @param table - The table to insert into
219
+ * @returns Insert query builder (no versioning, no cache management)
220
+ */
221
+ insert<TTable extends MySqlTable>(
222
+ table: TTable,
223
+ ): MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
224
+
225
+ /**
226
+ * Creates an insert query builder that automatically evicts cache after execution.
227
+ *
228
+ * ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
229
+ * For versioned inserts, use `modifyWithVersioning().insert()` or `modifyWithVersioningAndEvictCache().insert()` instead.
230
+ *
231
+ * @param table - The table to insert into
232
+ * @returns Insert query builder with automatic cache eviction (no versioning)
233
+ */
234
+ insertAndEvictCache<TTable extends MySqlTable>(
235
+ table: TTable,
236
+ ): MySqlInsertBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
237
+
238
+ /**
239
+ * Creates an update query builder.
240
+ *
241
+ * ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
242
+ * For versioned updates, use `modifyWithVersioning().updateById()` or `modifyWithVersioningAndEvictCache().updateById()` instead.
243
+ *
244
+ * @param table - The table to update
245
+ * @returns Update query builder (no versioning, no cache management)
246
+ */
247
+ update<TTable extends MySqlTable>(
248
+ table: TTable,
249
+ ): MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
250
+
251
+ /**
252
+ * Creates an update query builder that automatically evicts cache after execution.
253
+ *
254
+ * ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
255
+ * For versioned updates, use `modifyWithVersioning().updateById()` or `modifyWithVersioningAndEvictCache().updateById()` instead.
256
+ *
257
+ * @param table - The table to update
258
+ * @returns Update query builder with automatic cache eviction (no versioning)
259
+ */
260
+ updateAndEvictCache<TTable extends MySqlTable>(
261
+ table: TTable,
262
+ ): MySqlUpdateBuilder<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
263
+
264
+ /**
265
+ * Creates a delete query builder.
266
+ *
267
+ * ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
268
+ * For versioned deletes, use `modifyWithVersioning().deleteById()` or `modifyWithVersioningAndEvictCache().deleteById()` instead.
269
+ *
270
+ * @param table - The table to delete from
271
+ * @returns Delete query builder (no versioning, no cache management)
272
+ */
273
+ delete<TTable extends MySqlTable>(
274
+ table: TTable,
275
+ ): MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
276
+ /**
277
+ * Creates a delete query builder that automatically evicts cache after execution.
278
+ *
279
+ * ⚠️ **IMPORTANT**: This method does NOT support optimistic locking/versioning.
280
+ * For versioned deletes, use `modifyWithVersioning().deleteById()` or `modifyWithVersioningAndEvictCache().deleteById()` instead.
281
+ *
282
+ * @param table - The table to delete from
283
+ * @returns Delete query builder with automatic cache eviction (no versioning)
284
+ */
285
+ deleteAndEvictCache<TTable extends MySqlTable>(
286
+ table: TTable,
287
+ ): MySqlDeleteBase<TTable, MySqlRemoteQueryResultHKT, MySqlRemotePreparedQueryHKT>;
288
+
289
+ /**
290
+ * Executes operations within a cache context that collects cache eviction events.
291
+ * All clearCache calls within the context are collected and executed in batch at the end.
292
+ * Queries executed within this context will bypass cache for tables that were marked for clearing.
293
+ *
294
+ * @param cacheContext - Function containing operations that may trigger cache evictions
295
+ * @returns Promise that resolves when all operations and cache clearing are complete
296
+ */
297
+ executeWithCacheContext(cacheContext: () => Promise<void>): Promise<void>;
298
+
299
+ /**
300
+ * Executes operations within a cache context and returns a value.
301
+ * All clearCache calls within the context are collected and executed in batch at the end.
302
+ * Queries executed within this context will bypass cache for tables that were marked for clearing.
303
+ *
304
+ * @param cacheContext - Function containing operations that may trigger cache evictions
305
+ * @returns Promise that resolves to the return value of the cacheContext function
306
+ */
307
+ executeWithCacheContextAndReturnValue<T>(cacheContext: () => Promise<T>): Promise<T>;
308
+
309
+ /**
310
+ * Executes operations within a local cache context that provides in-memory caching for select queries.
311
+ * This is useful for optimizing queries within a single resolver or request scope.
312
+ *
313
+ * Local cache features:
314
+ * - Caches select query results in memory for the duration of the context
315
+ * - Automatically evicts cache when insert/update/delete operations are performed
316
+ * - Provides faster access to repeated queries within the same context
317
+ * - Does not persist across different requests or contexts
318
+ *
319
+ * @param cacheContext - Function containing operations that will benefit from local caching
320
+ * @returns Promise that resolves when all operations are complete
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * await forgeSQL.executeWithLocalContext(async () => {
325
+ * // First call - executes query and caches result
326
+ * const users = await forgeSQL.select({ id: users.id, name: users.name })
327
+ * .from(users).where(eq(users.active, true));
328
+ *
329
+ * // Second call - gets result from local cache (no database query)
330
+ * const cachedUsers = await forgeSQL.select({ id: users.id, name: users.name })
331
+ * .from(users).where(eq(users.active, true));
332
+ *
333
+ * // Insert operation - evicts local cache
334
+ * await forgeSQL.insert(users).values({ name: 'New User', active: true });
335
+ * });
336
+ * ```
337
+ */
338
+ executeWithLocalContext(cacheContext: () => Promise<void>): Promise<void>;
339
+
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>;
110
369
  }
111
370
 
112
371
  /**
113
372
  * Interface for Modify (Create, Update, Delete) operations.
114
373
  * Provides methods for basic database operations with support for optimistic locking.
115
374
  *
116
- * @interface CRUDForgeSQL
375
+ * @interface VerioningModificationForgeSQL
117
376
  */
118
- export interface CRUDForgeSQL {
377
+ export interface VerioningModificationForgeSQL {
119
378
  /**
120
379
  * Inserts multiple records into the database.
121
380
  * @template T - The type of the table schema
@@ -180,6 +439,11 @@ export interface CRUDForgeSQL {
180
439
  ): Promise<number>;
181
440
  }
182
441
 
442
+ export interface CacheForgeSQL extends VerioningModificationForgeSQL {
443
+ evictCache(tables: string[]): Promise<void>;
444
+ evictCacheEntities(tables: AnyMySqlTable[]): Promise<void>;
445
+ }
446
+
183
447
  /**
184
448
  * Interface for schema analysis operations.
185
449
  * Provides methods for analyzing query performance and execution plans.
@@ -283,10 +547,11 @@ export interface SchemaSqlForgeSql {
283
547
 
284
548
  /**
285
549
  * Executes a raw SQL update query.
286
- * @param {string} query - The raw SQL update query
287
- * @param {SqlParameters[]} [params] - Optional SQL parameters
288
- * @returns {Promise<UpdateQueryResponse>} The update response containing affected rows
289
- * @throws {Error} If the update operation fails
550
+ *
551
+ * @param query - The raw SQL update query
552
+ * @param params - Optional SQL parameters
553
+ * @returns Promise that resolves to the update response containing affected rows
554
+ * @throws Error if the update operation fails
290
555
  */
291
556
  executeRawUpdateSQL(query: string, params?: unknown[]): Promise<UpdateQueryResponse>;
292
557
  }
@@ -335,6 +600,12 @@ export interface ForgeSqlOrmOptions {
335
600
  disableOptimisticLocking?: boolean;
336
601
  /** SQL hints to be applied to queries */
337
602
  hints?: SqlHints;
603
+ cacheTTL?: number;
604
+ cacheEntityName?: string;
605
+ cacheEntityQueryName?: string;
606
+ cacheWrapTable?: boolean;
607
+ cacheEntityExpirationName?: string;
608
+ cacheEntityDataName?: string;
338
609
 
339
610
  /**
340
611
  * Additional metadata for table configuration.
@@ -371,7 +642,7 @@ export const forgeDateTimeString = customType<{
371
642
  return "datetime";
372
643
  },
373
644
  toDriver(value: Date) {
374
- return DateTime.fromJSDate(new Date(value)).toFormat("yyyy-LL-dd'T'HH:mm:ss.SSS");
645
+ return formatDateTime(value, "yyyy-LL-dd' 'HH:mm:ss.SSS");
375
646
  },
376
647
  fromDriver(value: unknown) {
377
648
  const format = "yyyy-LL-dd'T'HH:mm:ss.SSS";
@@ -394,7 +665,7 @@ export const forgeTimestampString = customType<{
394
665
  return "timestamp";
395
666
  },
396
667
  toDriver(value: Date) {
397
- return DateTime.fromJSDate(value).toFormat("yyyy-LL-dd'T'HH:mm:ss.SSS");
668
+ return formatDateTime(value, "yyyy-LL-dd' 'HH:mm:ss.SSS");
398
669
  },
399
670
  fromDriver(value: unknown) {
400
671
  const format = "yyyy-LL-dd'T'HH:mm:ss.SSS";
@@ -417,7 +688,7 @@ export const forgeDateString = customType<{
417
688
  return "date";
418
689
  },
419
690
  toDriver(value: Date) {
420
- return DateTime.fromJSDate(value).toFormat("yyyy-LL-dd");
691
+ return formatDateTime(value, "yyyy-LL-dd");
421
692
  },
422
693
  fromDriver(value: unknown) {
423
694
  const format = "yyyy-LL-dd";
@@ -440,7 +711,7 @@ export const forgeTimeString = customType<{
440
711
  return "time";
441
712
  },
442
713
  toDriver(value: Date) {
443
- return DateTime.fromJSDate(value).toFormat("HH:mm:ss.SSS");
714
+ return formatDateTime(value, "HH:mm:ss.SSS");
444
715
  },
445
716
  fromDriver(value: unknown) {
446
717
  return parseDateTime(value as string, "HH:mm:ss.SSS");
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ export * from "./core/ForgeSQLSelectOperations";
6
6
  export * from "./utils/sqlUtils";
7
7
  export * from "./utils/forgeDriver";
8
8
  export * from "./webtriggers";
9
- export * from "./lib/drizzle/extensions/selectAliased";
9
+ export * from "./lib/drizzle/extensions/additionalActions";
10
10
  export * from "./core/SystemTables";
11
11
 
12
12
  export default ForgeSQLORM;