@zeniai/client-epic-state 5.0.41-betaRD1 → 5.0.41

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.
@@ -456,10 +456,7 @@ const tenant = (0, toolkit_1.createSlice)({
456
456
  const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
457
457
  if (existing != null) {
458
458
  existing.saveAPIKeyConnectionState = 'Completed';
459
- // Upsert by connection_name — replacing the whole array would wipe
460
- // sibling connectors in the same bucket (e.g. saving ChargeBee under
461
- // 'revenue' must not drop the HubSpot row that lives there too).
462
- replaceOrAppendConnectionByName(existing[action.payload.connectionType], (0, exports.toConnection)(action.payload.connectionPayload));
459
+ existing[action.payload.connectionType] = [(0, exports.toConnection)(action.payload.connectionPayload)];
463
460
  existing.saveAPIKeyConnectionError = undefined;
464
461
  }
465
462
  },
@@ -496,8 +493,7 @@ const tenant = (0, toolkit_1.createSlice)({
496
493
  const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
497
494
  if (existing != null) {
498
495
  existing.saveOAuthConnectionState = 'Completed';
499
- // See saveAPIKeyConnectionSuccess — upsert, do not replace.
500
- replaceOrAppendConnectionByName(existing[action.payload.connectionType], (0, exports.toConnection)(action.payload.connectionPayload));
496
+ existing[action.payload.connectionType] = [(0, exports.toConnection)(action.payload.connectionPayload)];
501
497
  existing.saveOAuthConnectionError = undefined;
502
498
  }
503
499
  },
@@ -849,15 +845,3 @@ const toConnection = (payload) => ({
849
845
  userId: payload.user_id,
850
846
  });
851
847
  exports.toConnection = toConnection;
852
- // Replace a Connection in a same-bucket array (e.g. revenue: [chargebee, hubspot])
853
- // matching by connectionName, or append if no match. Mutates the array — safe
854
- // inside an Immer draft, which is the only place this is called from.
855
- function replaceOrAppendConnectionByName(connections, incomingConnection) {
856
- const existingIndex = connections.findIndex((existingConnection) => existingConnection.connectionName === incomingConnection.connectionName);
857
- if (existingIndex === -1) {
858
- connections.push(incomingConnection);
859
- }
860
- else {
861
- connections[existingIndex] = incomingConnection;
862
- }
863
- }
@@ -445,10 +445,7 @@ const tenant = createSlice({
445
445
  const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
446
446
  if (existing != null) {
447
447
  existing.saveAPIKeyConnectionState = 'Completed';
448
- // Upsert by connection_name — replacing the whole array would wipe
449
- // sibling connectors in the same bucket (e.g. saving ChargeBee under
450
- // 'revenue' must not drop the HubSpot row that lives there too).
451
- replaceOrAppendConnectionByName(existing[action.payload.connectionType], toConnection(action.payload.connectionPayload));
448
+ existing[action.payload.connectionType] = [toConnection(action.payload.connectionPayload)];
452
449
  existing.saveAPIKeyConnectionError = undefined;
453
450
  }
454
451
  },
@@ -485,8 +482,7 @@ const tenant = createSlice({
485
482
  const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
486
483
  if (existing != null) {
487
484
  existing.saveOAuthConnectionState = 'Completed';
488
- // See saveAPIKeyConnectionSuccess — upsert, do not replace.
489
- replaceOrAppendConnectionByName(existing[action.payload.connectionType], toConnection(action.payload.connectionPayload));
485
+ existing[action.payload.connectionType] = [toConnection(action.payload.connectionPayload)];
490
486
  existing.saveOAuthConnectionError = undefined;
491
487
  }
492
488
  },
@@ -836,15 +832,3 @@ export const toConnection = (payload) => ({
836
832
  updateTime: date(payload.update_time),
837
833
  userId: payload.user_id,
838
834
  });
839
- // Replace a Connection in a same-bucket array (e.g. revenue: [chargebee, hubspot])
840
- // matching by connectionName, or append if no match. Mutates the array — safe
841
- // inside an Immer draft, which is the only place this is called from.
842
- function replaceOrAppendConnectionByName(connections, incomingConnection) {
843
- const existingIndex = connections.findIndex((existingConnection) => existingConnection.connectionName === incomingConnection.connectionName);
844
- if (existingIndex === -1) {
845
- connections.push(incomingConnection);
846
- }
847
- else {
848
- connections[existingIndex] = incomingConnection;
849
- }
850
- }