@solidstarters/solid-core 1.2.119 → 1.2.120

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.119",
3
+ "version": "1.2.120",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,11 +65,20 @@ interface ImportMapping {
65
65
  fieldName: string; // The name of the field in the model metadata to which the imported field is mapped
66
66
  }
67
67
 
68
+ export enum ImportTransactionStatus {
69
+ draft = 'draft',
70
+ mapping_created = 'mapping_created',
71
+ import_started = 'import_started',
72
+ import_succeeded = 'import_succeeded',
73
+ import_failed = 'import_failed',
74
+ }
75
+
68
76
  export interface ImportSyncResult {
69
77
  status: string; // The status of the import transaction
70
78
  importedIds: Array<number>; // The IDs of the records created during the import
79
+ importedCount: number; // The number of records created during the import
80
+ failedCount: number; // The number of records that failed to import
71
81
  }
72
-
73
82
  interface ImportRecordsResult {
74
83
  ids: Array<number>; // The IDs of the records created during the import
75
84
  errorLogIds: Array<number>; // The IDs of the error log entries created during the import
@@ -261,11 +270,15 @@ export class ImportTransactionService extends CRUDService<ImportTransaction> {
261
270
  );
262
271
 
263
272
  // Update the import transaction status to 'completed'
264
- (errorLogIds.length > 0) ? importTransaction.status = 'import_failed' : importTransaction.status = 'import_succeeded'; //FIXME: We can probably have import_partially_failed status to differentiate
273
+ (errorLogIds.length > 0) ? importTransaction.status = ImportTransactionStatus.import_failed : importTransaction.status = ImportTransactionStatus.import_failed; //FIXME: We can probably have import_partially_failed status to differentiate
265
274
  // Save the import transaction
266
275
  await this.repo.save(importTransaction);
267
-
268
- return { status: importTransaction.status, importedIds: ids }; // Return the IDs of the created records
276
+ return {
277
+ status: importTransaction.status,
278
+ importedIds: ids, // The IDs of the records created during the import
279
+ importedCount: ids.length, // The number of records created during the import
280
+ failedCount: errorLogIds.length, // The number of records that failed to import
281
+ };
269
282
  }
270
283
 
271
284
  startImportAsync(importTransactionId: number): Promise<void> {
@@ -287,7 +300,7 @@ export class ImportTransactionService extends CRUDService<ImportTransaction> {
287
300
  // Create the headers for the export file
288
301
  const headers = [
289
302
  ...Object.keys(firstErrorLogEntry.rowData ? JSON.parse(firstErrorLogEntry.rowData) : {}), // Include all keys from the rowData JSON
290
- 'errorMessage', // Error message for the failed record
303
+ 'Error', // Error message for the failed record
291
304
  ];
292
305
 
293
306
 
@@ -315,7 +328,7 @@ export class ImportTransactionService extends CRUDService<ImportTransaction> {
315
328
  const rowData = entry.rowData ? JSON.parse(entry.rowData) : {};
316
329
  return {
317
330
  ...rowData, // Spread the row data into the record
318
- errorMessage: entry.errorMessage,
331
+ Error: entry.errorMessage,
319
332
  };
320
333
  });
321
334
  };