@adminforth/bulk-ai-flow 1.14.2 → 1.14.3

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/build.log CHANGED
@@ -13,5 +13,5 @@ custom/package-lock.json
13
13
  custom/package.json
14
14
  custom/tsconfig.json
15
15
 
16
- sent 74,104 bytes received 172 bytes 148,552.00 bytes/sec
16
+ sent 74,113 bytes received 172 bytes 148,570.00 bytes/sec
17
17
  total size is 73,472 speedup is 0.99
package/dist/index.js CHANGED
@@ -599,33 +599,14 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
599
599
  }
600
600
  }
601
601
  }
602
- try {
603
- const AuditLogPlugin = this.adminforth.getPluginByClassName('AuditLogPlugin');
604
- if (AuditLogPlugin) {
605
- for (const [key, value] of Object.entries(oldRecord)) {
606
- if (!(key in fieldsToUpdate[idx])) {
607
- delete oldRecord[key];
608
- }
609
- }
610
- const reorderedOldRecord = Object.keys(fieldsToUpdate[idx]).reduce((acc, key) => {
611
- if (key in oldRecord) {
612
- acc[key] = oldRecord[key];
613
- }
614
- return acc;
615
- }, {});
616
- AuditLogPlugin.logCustomAction({
617
- resourceId: this.resourceConfig.resourceId,
618
- recordId: ID,
619
- actionId: 'Bulk-ai-flow',
620
- oldData: reorderedOldRecord,
621
- data: fieldsToUpdate[idx],
622
- user: adminUser,
623
- headers: headers
624
- });
625
- }
626
- }
627
- catch (error) { }
628
- return this.adminforth.resource(this.resourceConfig.resourceId).update(ID, fieldsToUpdate[idx]);
602
+ const newRecord = Object.assign(Object.assign({}, oldRecord), fieldsToUpdate[idx]);
603
+ return this.adminforth.updateResourceRecord({
604
+ resource: this.resourceConfig,
605
+ recordId: ID,
606
+ oldRecord: oldRecord,
607
+ record: newRecord,
608
+ adminUser: adminUser,
609
+ });
629
610
  }));
630
611
  yield Promise.all(updates);
631
612
  return { ok: true };
package/index.ts CHANGED
@@ -625,36 +625,17 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
625
625
  }
626
626
  }
627
627
  }
628
- try {
629
- const AuditLogPlugin:any = this.adminforth.getPluginByClassName('AuditLogPlugin');
630
- if (AuditLogPlugin) {
631
-
632
- for (const [key, value] of Object.entries(oldRecord)) {
633
- if (!(key in fieldsToUpdate[idx])) {
634
- delete oldRecord[key];
635
- }
636
- }
637
-
638
- const reorderedOldRecord = Object.keys(fieldsToUpdate[idx]).reduce((acc, key) => {
639
- if (key in oldRecord) {
640
- acc[key] = oldRecord[key];
641
- }
642
- return acc;
643
- }, {} as Record<string, unknown>);
644
-
645
- AuditLogPlugin.logCustomAction({
646
- resourceId: this.resourceConfig.resourceId,
647
- recordId: ID,
648
- actionId: 'Bulk-ai-flow',
649
- oldData: reorderedOldRecord,
650
- data: fieldsToUpdate[idx],
651
- user: adminUser,
652
- headers: headers
653
- });
654
- }
655
- } catch (error) { }
656
-
657
- return this.adminforth.resource(this.resourceConfig.resourceId).update(ID, fieldsToUpdate[idx])
628
+ const newRecord = {
629
+ ...oldRecord,
630
+ ...fieldsToUpdate[idx]
631
+ };
632
+ return this.adminforth.updateResourceRecord({
633
+ resource: this.resourceConfig,
634
+ recordId: ID,
635
+ oldRecord: oldRecord,
636
+ record: newRecord,
637
+ adminUser: adminUser,
638
+ })
658
639
  });
659
640
  await Promise.all(updates);
660
641
  return { ok: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "1.14.2",
3
+ "version": "1.14.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },