@memberjunction/sqlserver-dataprovider 2.75.0 → 2.77.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 CHANGED
@@ -136,6 +136,10 @@ if (deleteResult.Success) {
136
136
 
137
137
  ### Transaction Management
138
138
 
139
+ The SQL Server Data Provider supports comprehensive transaction management through both transaction groups and instance-level transactions.
140
+
141
+ #### Transaction Groups
142
+
139
143
  ```typescript
140
144
  import { SQLServerDataProvider } from '@memberjunction/sqlserver-dataprovider';
141
145
  import { SQLServerTransactionGroup } from '@memberjunction/sqlserver-dataprovider';
@@ -194,6 +198,48 @@ if (success) {
194
198
  }
195
199
  ```
196
200
 
201
+ #### Instance-Level Transactions (Multi-User Environments)
202
+
203
+ In multi-user server environments like MJServer, each request gets its own SQLServerDataProvider instance with isolated transaction state. This provides automatic transaction isolation without requiring transaction scope IDs:
204
+
205
+ ```typescript
206
+ // Each request gets its own provider instance
207
+ const dataProvider = new SQLServerDataProvider(connectionPool);
208
+ await dataProvider.Config(config);
209
+
210
+ try {
211
+ // Begin a transaction on this instance
212
+ await dataProvider.BeginTransaction();
213
+
214
+ // Perform operations - all use this instance's transaction
215
+ await dataProvider.Save(entity1, contextUser);
216
+ await dataProvider.Save(entity2, contextUser);
217
+
218
+ // Delete operations also participate in the transaction
219
+ await dataProvider.Delete(entity3, deleteOptions, contextUser);
220
+
221
+ // Commit the transaction
222
+ await dataProvider.CommitTransaction();
223
+ } catch (error) {
224
+ // Rollback on error
225
+ await dataProvider.RollbackTransaction();
226
+ throw error;
227
+ }
228
+ ```
229
+
230
+ **Key Features of Instance-Level Transactions:**
231
+ - Each provider instance maintains its own transaction state
232
+ - No transaction scope IDs needed - simpler API
233
+ - Automatic isolation between concurrent requests (each has its own instance)
234
+ - Supports nested transactions with SQL Server savepoints
235
+ - Used automatically by MJServer for all GraphQL mutations
236
+
237
+ **Best Practices for Multi-User Environments:**
238
+ 1. Create a new SQLServerDataProvider instance per request
239
+ 2. Configure with `ignoreExistingMetadata: false` to reuse cached metadata
240
+ 3. Let the instance be garbage collected after the request completes
241
+ 4. No need for explicit cleanup - transaction state is instance-scoped
242
+
197
243
  ### Running Views and Reports
198
244
 
199
245
  ```typescript
@@ -275,9 +321,11 @@ console.log('User permissions:', spResult);
275
321
 
276
322
  // Using RunQuery for pre-defined queries
277
323
  const queryParams: RunQueryParams = {
278
- QueryID: 'query-id-here', // or use QueryName
279
- // CategoryID: 'optional-category-id',
280
- // CategoryName: 'optional-category-name'
324
+ QueryID: 'query-id-here', // or use QueryName + Category identification
325
+ // Alternative: use QueryName with hierarchical CategoryPath
326
+ // QueryName: 'CalculateCost',
327
+ // CategoryPath: '/MJ/AI/Agents/' // Hierarchical path notation
328
+ // CategoryID: 'optional-direct-category-id',
281
329
  };
282
330
 
283
331
  const queryResult = await dataProvider.RunQuery(queryParams);
@@ -286,6 +334,19 @@ if (queryResult.Success) {
286
334
  console.log('Query results:', queryResult.Results);
287
335
  console.log('Execution time:', queryResult.ExecutionTime, 'ms');
288
336
  }
337
+
338
+ // Query lookup supports hierarchical category paths
339
+ // Example: Query with name "CalculateCost" in category hierarchy "MJ" -> "AI" -> "Agents"
340
+ const hierarchicalQueryParams: RunQueryParams = {
341
+ QueryName: 'CalculateCost',
342
+ CategoryPath: '/MJ/AI/Agents/' // Full hierarchical path with leading/trailing slashes
343
+ };
344
+
345
+ // The CategoryPath is parsed as a path where:
346
+ // - "/" separates category levels
347
+ // - Each segment is matched case-insensitively against category names
348
+ // - The path walks from root to leaf through the ParentID relationships
349
+ // - Falls back to simple category name matching for backward compatibility
289
350
  ```
290
351
 
291
352
  ### User Management and Caching
@@ -426,14 +487,32 @@ The main class that implements IEntityDataProvider, IMetadataProvider, IRunViewP
426
487
 
427
488
  Configuration class for the SQL Server provider.
428
489
 
490
+ #### Constructor Parameters
491
+
492
+ ```typescript
493
+ constructor(
494
+ connectionPool: sql.ConnectionPool,
495
+ MJCoreSchemaName?: string,
496
+ checkRefreshIntervalSeconds: number = 0,
497
+ includeSchemas?: string[],
498
+ excludeSchemas?: string[],
499
+ ignoreExistingMetadata: boolean = true
500
+ )
501
+ ```
502
+
429
503
  #### Properties
430
504
 
431
- - `DataSource: DataSource` - TypeORM DataSource instance
432
- - `CurrentUserEmail: string` - Email of the current user
505
+ - `ConnectionPool: sql.ConnectionPool` - SQL Server connection pool instance
433
506
  - `CheckRefreshIntervalSeconds: number` - Interval for checking metadata refresh (0 to disable)
434
507
  - `MJCoreSchemaName: string` - Schema name for MJ core tables (default: '__mj')
435
508
  - `IncludeSchemas?: string[]` - List of schemas to include
436
509
  - `ExcludeSchemas?: string[]` - List of schemas to exclude
510
+ - `IgnoreExistingMetadata: boolean` - Whether to ignore cached metadata and force a reload (default: true)
511
+
512
+ **Important Note on `ignoreExistingMetadata`:**
513
+ - Set to `false` in multi-user environments to reuse cached metadata across provider instances
514
+ - This significantly improves performance when creating provider instances per request
515
+ - The first instance loads metadata from the database, subsequent instances reuse it
437
516
 
438
517
  ### SQLServerTransactionGroup
439
518
 
@@ -15,7 +15,7 @@
15
15
  * In practice - this FILE will NOT exist in the entities library, we need to move to its own separate project
16
16
  * so it is only included by the consumer of the entities library if they want to use it.
17
17
  **************************************************************************************************************/
18
- import { BaseEntity, IEntityDataProvider, IMetadataProvider, IRunViewProvider, RunViewResult, EntityInfo, EntityFieldInfo, ApplicationInfo, RunViewParams, ProviderType, UserInfo, RecordChange, ILocalStorageProvider, AuditLogTypeInfo, AuthorizationInfo, TransactionGroupBase, EntitySaveOptions, RunReportParams, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, EntityRecordNameInput, EntityRecordNameResult, IRunReportProvider, RunReportResult, RecordDependency, RecordMergeRequest, RecordMergeResult, EntityDependency, IRunQueryProvider, RunQueryResult, RunQueryParams, PotentialDuplicateRequest, PotentialDuplicateResponse, CompositeKey, EntityDeleteOptions, DatasetItemResultType, DatabaseProviderBase, QueryInfo } from '@memberjunction/core';
18
+ import { BaseEntity, IEntityDataProvider, IMetadataProvider, IRunViewProvider, RunViewResult, EntityInfo, EntityFieldInfo, ApplicationInfo, RunViewParams, ProviderType, UserInfo, RecordChange, ILocalStorageProvider, AuditLogTypeInfo, AuthorizationInfo, TransactionGroupBase, EntitySaveOptions, RunReportParams, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, EntityRecordNameInput, EntityRecordNameResult, IRunReportProvider, RunReportResult, RecordDependency, RecordMergeRequest, RecordMergeResult, EntityDependency, IRunQueryProvider, RunQueryResult, RunQueryParams, PotentialDuplicateRequest, PotentialDuplicateResponse, CompositeKey, EntityDeleteOptions, EntityMergeOptions, DatasetItemResultType, DatabaseProviderBase, QueryInfo } from '@memberjunction/core';
19
19
  import { AuditLogEntity, EntityAIActionEntity, RecordMergeLogEntity, UserViewEntityExtended } from '@memberjunction/core-entities';
20
20
  import * as sql from 'mssql';
21
21
  import { Observable } from 'rxjs';
@@ -59,6 +59,7 @@ export declare class SQLServerDataProvider extends DatabaseProviderBase implemen
59
59
  /**
60
60
  * Observable that emits the current transaction state (true when active, false when not)
61
61
  * External code can subscribe to this to know when transactions start and end
62
+ *
62
63
  * @example
63
64
  * provider.transactionState$.subscribe(isActive => {
64
65
  * console.log('Transaction active:', isActive);
@@ -205,7 +206,27 @@ export declare class SQLServerDataProvider extends DatabaseProviderBase implemen
205
206
  RunReport(params: RunReportParams, contextUser?: UserInfo): Promise<RunReportResult>;
206
207
  /**************************************************************************/
207
208
  /**************************************************************************/
208
- protected findQuery(QueryID: string, QueryName: string, CategoryID: string, CategoryName: string, refreshMetadataIfNotFound?: boolean): Promise<QueryInfo | null>;
209
+ /**
210
+ * Resolves a hierarchical category path (e.g., "/MJ/AI/Agents/") to a CategoryID.
211
+ * The path is split by "/" and each segment is matched case-insensitively against
212
+ * category names, walking down the hierarchy from root to leaf.
213
+ *
214
+ * @param categoryPath The hierarchical category path (e.g., "/MJ/AI/Agents/")
215
+ * @returns The CategoryID if the path exists, null otherwise
216
+ */
217
+ private resolveCategoryPath;
218
+ /**
219
+ * Finds a query by ID or by Name+Category combination.
220
+ * Supports both direct CategoryID lookup and hierarchical CategoryPath path resolution.
221
+ *
222
+ * @param QueryID Unique identifier for the query
223
+ * @param QueryName Name of the query to find
224
+ * @param CategoryID Direct category ID for the query
225
+ * @param CategoryPath Hierarchical category path (e.g., "/MJ/AI/Agents/") or simple category name
226
+ * @param refreshMetadataIfNotFound Whether to refresh metadata if query is not found
227
+ * @returns The found QueryInfo or null if not found
228
+ */
229
+ protected findQuery(QueryID: string, QueryName: string, CategoryID: string, CategoryPath: string, refreshMetadataIfNotFound?: boolean): Promise<QueryInfo | null>;
209
230
  /**************************************************************************/
210
231
  /**************************************************************************/
211
232
  RunQuery(params: RunQueryParams, contextUser?: UserInfo): Promise<RunQueryResult>;
@@ -232,7 +253,7 @@ export declare class SQLServerDataProvider extends DatabaseProviderBase implemen
232
253
  runID: string;
233
254
  }>;
234
255
  protected createViewUserSearchSQL(entityInfo: EntityInfo, userSearchString: string): string;
235
- CreateAuditLogRecord(user: UserInfo, authorizationName: string | null, auditLogTypeName: string, status: string, details: string | null, entityId: string, recordId: any | null, auditLogDescription: string | null): Promise<AuditLogEntity>;
256
+ CreateAuditLogRecord(user: UserInfo, authorizationName: string | null, auditLogTypeName: string, status: string, details: string | null, entityId: string, recordId: any | null, auditLogDescription: string | null, saveOptions: EntitySaveOptions): Promise<AuditLogEntity>;
236
257
  protected CheckUserReadPermissions(entityName: string, contextUser: UserInfo): void;
237
258
  /**************************************************************************/
238
259
  /**************************************************************************/
@@ -263,7 +284,7 @@ export declare class SQLServerDataProvider extends DatabaseProviderBase implemen
263
284
  GetRecordDependencies(entityName: string, compositeKey: CompositeKey, contextUser?: UserInfo): Promise<RecordDependency[]>;
264
285
  protected GetRecordDependencyLinkSQL(dep: EntityDependency, entity: EntityInfo, relatedEntity: EntityInfo, CompositeKey: CompositeKey): string;
265
286
  GetRecordDuplicates(params: PotentialDuplicateRequest, contextUser?: UserInfo): Promise<PotentialDuplicateResponse>;
266
- MergeRecords(request: RecordMergeRequest, contextUser?: UserInfo): Promise<RecordMergeResult>;
287
+ MergeRecords(request: RecordMergeRequest, contextUser?: UserInfo, options?: EntityMergeOptions): Promise<RecordMergeResult>;
267
288
  protected StartMergeLogging(request: RecordMergeRequest, result: RecordMergeResult, contextUser: UserInfo): Promise<RecordMergeLogEntity>;
268
289
  protected CompleteMergeLogging(recordMergeLog: RecordMergeLogEntity, result: RecordMergeResult, contextUser?: UserInfo): Promise<void>;
269
290
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SQLServerDataProvider.d.ts","sourceRoot":"","sources":["../src/SQLServerDataProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;gHAIgH;AAEhH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAEhB,aAAa,EAEb,UAAU,EACV,eAAe,EACf,eAAe,EACf,aAAa,EAGb,YAAY,EACZ,QAAQ,EAER,YAAY,EAEZ,qBAAqB,EAErB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EAGpB,iBAAiB,EAEjB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EAEjB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EAEf,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EAEjB,gBAAgB,EAEhB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAE1B,YAAY,EACZ,mBAAmB,EAGnB,qBAAqB,EACrB,oBAAoB,EACpB,SAAS,EACV,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,cAAc,EAEd,oBAAoB,EAGpB,oBAAoB,EAEpB,sBAAsB,EAEvB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAmB,UAAU,EAAiD,MAAM,MAAM,CAAC;AA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AAO,CAAC,sBAAsB,EAAE,CAAC;IAc9G,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBzH,SAAS,CAAC,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,MAAM;IAwB3E,sBAAsB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIpE,4EAA4E;IAE5E,4EAA4E;IAC5E,SAAS,KAAK,QAAQ,IAAI,iBAAiB,CAE1C;CACF"}
@@ -88,6 +88,9 @@ async function executeSQLCore(query, parameters, context, options) {
88
88
  }
89
89
  try {
90
90
  // Create a new request object for this query
91
+ // Note: This looks redundant but is required for TypeScript type narrowing.
92
+ // The sql.Request constructor has overloads for ConnectionPool and Transaction,
93
+ // but TypeScript can't resolve the overload with a union type parameter.
91
94
  let request;
92
95
  if (connectionSource instanceof sql.Transaction) {
93
96
  request = new sql.Request(connectionSource);
@@ -153,6 +156,7 @@ async function executeSQLCore(query, parameters, context, options) {
153
156
  */
154
157
  class SQLServerDataProvider extends core_1.DatabaseProviderBase {
155
158
  _pool;
159
+ // Instance transaction properties
156
160
  _transaction;
157
161
  _transactionDepth = 0;
158
162
  _savepointCounter = 0;
@@ -175,6 +179,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
175
179
  /**
176
180
  * Observable that emits the current transaction state (true when active, false when not)
177
181
  * External code can subscribe to this to know when transactions start and end
182
+ *
178
183
  * @example
179
184
  * provider.transactionState$.subscribe(isActive => {
180
185
  * console.log('Transaction active:', isActive);
@@ -188,19 +193,20 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
188
193
  * 0 = no transaction, 1 = first level, 2+ = nested transactions
189
194
  */
190
195
  get transactionDepth() {
196
+ // Request-specific depth should be accessed via getTransactionContext
191
197
  return this._transactionDepth;
192
198
  }
193
199
  /**
194
200
  * Checks if we're currently in a transaction (at any depth)
195
201
  */
196
202
  get inTransaction() {
197
- return this._transactionDepth > 0;
203
+ return this.transactionDepth > 0;
198
204
  }
199
205
  /**
200
206
  * Checks if we're currently in a nested transaction (depth > 1)
201
207
  */
202
208
  get inNestedTransaction() {
203
- return this._transactionDepth > 1;
209
+ return this.transactionDepth > 1;
204
210
  }
205
211
  /**
206
212
  * Gets the current savepoint names in the stack (for debugging)
@@ -213,6 +219,8 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
213
219
  * Gets whether a transaction is currently active
214
220
  */
215
221
  get isTransactionActive() {
222
+ // Always return instance-level state
223
+ // Request-specific state should be accessed via getTransactionContext
216
224
  return this._transactionState$.value;
217
225
  }
218
226
  /**
@@ -229,7 +237,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
229
237
  */
230
238
  async Config(configData) {
231
239
  try {
232
- this._pool = configData.DataSource; // Now expects a ConnectionPool instead of DataSource
240
+ this._pool = configData.ConnectionPool; // Now expects a ConnectionPool instead of DataSource
233
241
  // Initialize the instance queue processor
234
242
  this.initializeQueueProcessor();
235
243
  return super.Config(configData); // now parent class can do it's config
@@ -514,7 +522,47 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
514
522
  /**************************************************************************/
515
523
  // END ---- IRunReportProvider
516
524
  /**************************************************************************/
517
- async findQuery(QueryID, QueryName, CategoryID, CategoryName, refreshMetadataIfNotFound = false) {
525
+ /**
526
+ * Resolves a hierarchical category path (e.g., "/MJ/AI/Agents/") to a CategoryID.
527
+ * The path is split by "/" and each segment is matched case-insensitively against
528
+ * category names, walking down the hierarchy from root to leaf.
529
+ *
530
+ * @param categoryPath The hierarchical category path (e.g., "/MJ/AI/Agents/")
531
+ * @returns The CategoryID if the path exists, null otherwise
532
+ */
533
+ resolveCategoryPath(categoryPath) {
534
+ if (!categoryPath)
535
+ return null;
536
+ // Split path and clean segments - remove empty strings from leading/trailing slashes
537
+ const segments = categoryPath.split('/')
538
+ .map(s => s.trim())
539
+ .filter(s => s.length > 0);
540
+ if (segments.length === 0)
541
+ return null;
542
+ // Walk down the hierarchy to find the target category
543
+ let currentCategory = null;
544
+ for (const segment of segments) {
545
+ const parentId = currentCategory?.ID || null;
546
+ currentCategory = this.QueryCategories.find(cat => cat.Name.trim().toLowerCase() === segment.toLowerCase() &&
547
+ cat.ParentID === parentId);
548
+ if (!currentCategory) {
549
+ return null; // Path not found
550
+ }
551
+ }
552
+ return currentCategory.ID;
553
+ }
554
+ /**
555
+ * Finds a query by ID or by Name+Category combination.
556
+ * Supports both direct CategoryID lookup and hierarchical CategoryPath path resolution.
557
+ *
558
+ * @param QueryID Unique identifier for the query
559
+ * @param QueryName Name of the query to find
560
+ * @param CategoryID Direct category ID for the query
561
+ * @param CategoryPath Hierarchical category path (e.g., "/MJ/AI/Agents/") or simple category name
562
+ * @param refreshMetadataIfNotFound Whether to refresh metadata if query is not found
563
+ * @returns The found QueryInfo or null if not found
564
+ */
565
+ async findQuery(QueryID, QueryName, CategoryID, CategoryPath, refreshMetadataIfNotFound = false) {
518
566
  // First, get the query metadata
519
567
  const queries = this.Queries.filter(q => {
520
568
  if (QueryID) {
@@ -525,8 +573,17 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
525
573
  if (CategoryID) {
526
574
  matches = matches && q.CategoryID.trim().toLowerCase() === CategoryID.trim().toLowerCase();
527
575
  }
528
- if (CategoryName) {
529
- matches = matches && q.Category.trim().toLowerCase() === CategoryName.trim().toLowerCase();
576
+ else if (CategoryPath) {
577
+ // New hierarchical path logic - try path resolution first, fall back to simple name match
578
+ const resolvedCategoryId = this.resolveCategoryPath(CategoryPath);
579
+ if (resolvedCategoryId) {
580
+ // Hierarchical path matched - use the resolved CategoryID
581
+ matches = matches && q.CategoryID === resolvedCategoryId;
582
+ }
583
+ else {
584
+ // Fall back to simple category name comparison for backward compatibility
585
+ matches = matches && q.Category.trim().toLowerCase() === CategoryPath.trim().toLowerCase();
586
+ }
530
587
  }
531
588
  return matches;
532
589
  }
@@ -536,7 +593,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
536
593
  if (refreshMetadataIfNotFound) {
537
594
  // If we didn't find the query, refresh metadata and try again
538
595
  await this.Refresh();
539
- return this.findQuery(QueryID, QueryName, CategoryID, CategoryName, false); // change the refresh flag to false so we don't loop infinitely
596
+ return this.findQuery(QueryID, QueryName, CategoryID, CategoryPath, false); // change the refresh flag to false so we don't loop infinitely
540
597
  }
541
598
  else {
542
599
  return null; // No query found and not refreshing metadata
@@ -556,10 +613,10 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
556
613
  if (params.CategoryID) {
557
614
  filter += ` AND CategoryID = '${params.CategoryID}'`;
558
615
  }
559
- if (params.CategoryName) {
560
- filter += ` AND Category = '${params.CategoryName}'`;
616
+ if (params.CategoryPath) {
617
+ filter += ` AND Category = '${params.CategoryPath}'`;
561
618
  }
562
- const query = await this.findQuery(params.QueryID, params.QueryName, params.CategoryID, params.CategoryName, true);
619
+ const query = await this.findQuery(params.QueryID, params.QueryName, params.CategoryID, params.CategoryPath, true);
563
620
  if (!query) {
564
621
  throw new Error('Query not found');
565
622
  }
@@ -878,7 +935,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
878
935
  Description: params.AuditLogDescription,
879
936
  RowCount: retData.length,
880
937
  SQL: viewSQL,
881
- }), entityInfo.ID, null, params.AuditLogDescription);
938
+ }), entityInfo.ID, null, params.AuditLogDescription, null);
882
939
  }
883
940
  return {
884
941
  RowCount: params.ResultType === 'count_only'
@@ -1089,7 +1146,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
1089
1146
  }
1090
1147
  return sUserSearchSQL;
1091
1148
  }
1092
- async CreateAuditLogRecord(user, authorizationName, auditLogTypeName, status, details, entityId, recordId, auditLogDescription) {
1149
+ async CreateAuditLogRecord(user, authorizationName, auditLogTypeName, status, details, entityId, recordId, auditLogDescription, saveOptions) {
1093
1150
  try {
1094
1151
  const authorization = authorizationName
1095
1152
  ? this.Authorizations.find((a) => a?.Name?.trim().toLowerCase() === authorizationName.trim().toLowerCase())
@@ -1115,7 +1172,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
1115
1172
  auditLog.Details = details;
1116
1173
  if (auditLogDescription)
1117
1174
  auditLog.Description = auditLogDescription;
1118
- if (await auditLog.Save())
1175
+ if (await auditLog.Save(saveOptions))
1119
1176
  return auditLog;
1120
1177
  else
1121
1178
  throw new Error(`Error saving audit log record`);
@@ -1375,7 +1432,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
1375
1432
  };
1376
1433
  return response;
1377
1434
  }
1378
- async MergeRecords(request, contextUser) {
1435
+ async MergeRecords(request, contextUser, options) {
1379
1436
  const e = this.Entities.find((e) => e.Name.trim().toLowerCase() === request.EntityName.trim().toLowerCase());
1380
1437
  if (!e || !e.AllowRecordMerge)
1381
1438
  throw new Error(`Entity ${request.EntityName} does not allow record merging, check the AllowRecordMerge property in the entity metadata`);
@@ -1803,13 +1860,18 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
1803
1860
  result = [entity.GetAll()]; // just return the entity as it was before the save as we are NOT saving anything as we are in replay mode
1804
1861
  }
1805
1862
  else {
1806
- // Execute SQL with optional simple SQL fallback for loggers
1807
- const rawResult = await this.ExecuteSQL(sSQL, null, {
1808
- isMutation: true,
1809
- description: `Save ${entity.EntityInfo.Name}`,
1810
- simpleSQLFallback: entity.EntityInfo.TrackRecordChanges ? sqlDetails.simpleSQL : undefined
1811
- }, user);
1812
- result = await this.ProcessEntityRows(rawResult, entity.EntityInfo);
1863
+ try {
1864
+ // Execute SQL with optional simple SQL fallback for loggers
1865
+ const rawResult = await this.ExecuteSQL(sSQL, null, {
1866
+ isMutation: true,
1867
+ description: `Save ${entity.EntityInfo.Name}`,
1868
+ simpleSQLFallback: entity.EntityInfo.TrackRecordChanges ? sqlDetails.simpleSQL : undefined
1869
+ }, user);
1870
+ result = await this.ProcessEntityRows(rawResult, entity.EntityInfo);
1871
+ }
1872
+ catch (e) {
1873
+ throw e; // rethrow
1874
+ }
1813
1875
  }
1814
1876
  this._bAllowRefresh = true; // allow refreshes now
1815
1877
  entityResult.EndedAt = new Date();
@@ -2272,7 +2334,6 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
2272
2334
  }
2273
2335
  async Delete(entity, options, user) {
2274
2336
  const result = new core_1.BaseEntityResult();
2275
- let startedTransaction = false; // tracking if we started a transaction or not, so we can commit/rollback as needed
2276
2337
  try {
2277
2338
  entity.RegisterTransactionPreprocessing();
2278
2339
  if (!options)
@@ -2345,9 +2406,6 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
2345
2406
  d = [entity.GetAll()]; // just return the entity as it was before the save as we are NOT saving anything as we are in replay mode
2346
2407
  }
2347
2408
  else {
2348
- // Execute SQL with optional simple SQL fallback for loggers
2349
- await this.BeginTransaction(); // we are NOT in a trans group, so we need to start a transaction
2350
- startedTransaction = true;
2351
2409
  d = await this.ExecuteSQL(sSQL, null, {
2352
2410
  isMutation: true,
2353
2411
  description: `Delete ${entity.EntityInfo.Name}`,
@@ -2362,6 +2420,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
2362
2420
  // was not found in the DB. This was the existing logic prior to the SP modifications in 2.68.0, just documenting
2363
2421
  // it here for clarity.
2364
2422
  result.Message = `Transaction failed to commit, record with primary key ${key.Name}=${key.Value} not found`;
2423
+ result.EndedAt = new Date();
2365
2424
  result.Success = false;
2366
2425
  return false;
2367
2426
  }
@@ -2369,19 +2428,10 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
2369
2428
  // Entity AI Actions and Actions - fired off async, NO await on purpose
2370
2429
  this.HandleEntityActions(entity, 'delete', false, user);
2371
2430
  this.HandleEntityAIActions(entity, 'delete', false, user);
2372
- if (startedTransaction) {
2373
- // if we started a transaction, we need to commit it
2374
- await this.CommitTransaction();
2375
- }
2376
2431
  result.EndedAt = new Date();
2377
2432
  return true;
2378
2433
  }
2379
2434
  else {
2380
- if (startedTransaction) {
2381
- // if we started a transaction, we need to rollback
2382
- startedTransaction = false;
2383
- await this.RollbackTransaction();
2384
- }
2385
2435
  result.Message = 'No result returned from SQL';
2386
2436
  result.EndedAt = new Date();
2387
2437
  return false;
@@ -2393,11 +2443,6 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
2393
2443
  result.Message = e.message;
2394
2444
  result.Success = false;
2395
2445
  result.EndedAt = new Date();
2396
- if (startedTransaction) {
2397
- // if we started a transaction, we need to rollback
2398
- startedTransaction = false;
2399
- await this.RollbackTransaction();
2400
- }
2401
2446
  return false;
2402
2447
  }
2403
2448
  }
@@ -2934,7 +2979,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
2934
2979
  transaction = connectionSource;
2935
2980
  }
2936
2981
  else if (!connectionSource) {
2937
- // Use our transaction if available
2982
+ // Use instance transaction
2938
2983
  transaction = this._transaction;
2939
2984
  }
2940
2985
  // Create the execution context
@@ -2942,7 +2987,9 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
2942
2987
  pool: this._pool,
2943
2988
  transaction: transaction,
2944
2989
  logSqlStatement: this._logSqlStatement.bind(this),
2945
- clearTransaction: () => { this._transaction = null; }
2990
+ clearTransaction: () => {
2991
+ this._transaction = null;
2992
+ }
2946
2993
  };
2947
2994
  // Convert logging options to internal format
2948
2995
  const options = loggingOptions ? {
@@ -3175,7 +3222,9 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
3175
3222
  pool: this._pool,
3176
3223
  transaction: this._transaction,
3177
3224
  logSqlStatement: this._logSqlStatement.bind(this),
3178
- clearTransaction: () => { this._transaction = null; }
3225
+ clearTransaction: () => {
3226
+ this._transaction = null;
3227
+ }
3179
3228
  };
3180
3229
  // Execute using instance method (which handles queue for transactions)
3181
3230
  const result = await this._internalExecuteSQLInstance(batchSQL, batchParameters, context, {
@@ -3332,7 +3381,6 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
3332
3381
  }
3333
3382
  else {
3334
3383
  // Nested transaction - just remove the savepoint from stack
3335
- // The savepoint remains valid in SQL Server until the outer transaction commits or rolls back
3336
3384
  this._savepointStack.pop();
3337
3385
  }
3338
3386
  }
@@ -3350,7 +3398,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
3350
3398
  throw new Error('Transaction depth mismatch - no transaction to rollback');
3351
3399
  }
3352
3400
  if (this._transactionDepth === 1) {
3353
- // Outermost transaction - use mssql Transaction object to rollback everything
3401
+ // Outermost transaction - rollback everything
3354
3402
  await this._transaction.rollback();
3355
3403
  this._transaction = null;
3356
3404
  this._transactionDepth = 0;
@@ -3359,7 +3407,7 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
3359
3407
  this._savepointCounter = 0;
3360
3408
  // Emit transaction state change
3361
3409
  this._transactionState$.next(false);
3362
- // Clear deferred tasks after rollback (don't process them)
3410
+ // Clear deferred tasks after rollback
3363
3411
  const deferredCount = this._deferredTasks.length;
3364
3412
  this._deferredTasks = [];
3365
3413
  if (deferredCount > 0) {
@@ -3367,24 +3415,20 @@ class SQLServerDataProvider extends core_1.DatabaseProviderBase {
3367
3415
  }
3368
3416
  }
3369
3417
  else {
3370
- // Nested transaction - rollback to the last savepoint
3418
+ // Nested transaction - rollback to savepoint
3371
3419
  const savepointName = this._savepointStack[this._savepointStack.length - 1];
3372
3420
  if (!savepointName) {
3373
3421
  throw new Error('Savepoint stack mismatch - no savepoint to rollback to');
3374
3422
  }
3375
- // Rollback to the savepoint (this preserves the outer transaction)
3376
- // Note: We use ROLLBACK TRANSACTION SavePointName (without TO) as per SQL Server syntax
3377
3423
  await this.ExecuteSQL(`ROLLBACK TRANSACTION ${savepointName}`, null, {
3378
3424
  description: `Rolling back to savepoint ${savepointName}`,
3379
3425
  ignoreLogging: true
3380
3426
  });
3381
- // Remove the savepoint from stack and decrement depth
3382
3427
  this._savepointStack.pop();
3383
3428
  this._transactionDepth--;
3384
3429
  }
3385
3430
  }
3386
3431
  catch (e) {
3387
- // On error in nested transaction, maintain state
3388
3432
  // On error in outer transaction, reset everything
3389
3433
  if (this._transactionDepth === 1 || !this._transaction) {
3390
3434
  this._transaction = null;