@bluecopa/core 0.1.64 → 0.1.65

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/dist/index.es.js CHANGED
@@ -12908,35 +12908,20 @@ function createReplication(collection, solutionId, tableName, primaryKeyField) {
12908
12908
  for (const row of changeRows) {
12909
12909
  const doc = row.newDocumentState;
12910
12910
  try {
12911
- let serverResponse;
12912
12911
  if (row.assumedMasterState == null) {
12913
12912
  const insertData = { ...doc };
12914
12913
  delete insertData[CHECKPOINT_FIELD];
12915
12914
  delete insertData._deleted;
12916
- serverResponse = await apiClient.post(`/input-table-v2/${solutionId}/rows/${tableName}`, insertData, {
12917
- headers: { Prefer: "return=representation" }
12918
- });
12915
+ await apiClient.post(`/input-table-v2/${solutionId}/rows/${tableName}`, insertData);
12919
12916
  } else {
12920
12917
  const updateData = { ...doc };
12921
12918
  delete updateData[primaryKeyField];
12922
12919
  delete updateData[CHECKPOINT_FIELD];
12923
12920
  delete updateData._deleted;
12924
- serverResponse = await apiClient.patch(`/input-table-v2/${solutionId}/rows/${tableName}`, updateData, {
12925
- params: { [primaryKeyField]: `eq.${doc[primaryKeyField]}` },
12926
- headers: { Prefer: "return=representation" }
12921
+ await apiClient.patch(`/input-table-v2/${solutionId}/rows/${tableName}`, updateData, {
12922
+ params: { [primaryKeyField]: `eq.${doc[primaryKeyField]}` }
12927
12923
  });
12928
12924
  }
12929
- const serverRow = Array.isArray(serverResponse == null ? void 0 : serverResponse.data) ? serverResponse.data[0] : serverResponse == null ? void 0 : serverResponse.data;
12930
- if (serverRow) {
12931
- const cleaned = stripNullsAndCoercePk(serverRow, primaryKeyField);
12932
- const localDoc = await collection.findOne(String(cleaned[primaryKeyField])).exec();
12933
- if (localDoc) {
12934
- const patch = { ...cleaned };
12935
- delete patch[primaryKeyField];
12936
- delete patch._deleted;
12937
- await localDoc.patch(patch);
12938
- }
12939
- }
12940
12925
  } catch (err) {
12941
12926
  const status = (_a = err == null ? void 0 : err.response) == null ? void 0 : _a.status;
12942
12927
  const pgCode = ((_c = (_b = err == null ? void 0 : err.response) == null ? void 0 : _b.data) == null ? void 0 : _c.code) ?? ((_f = (_e = (_d = err == null ? void 0 : err.response) == null ? void 0 : _d.data) == null ? void 0 : _e.data) == null ? void 0 : _f.code);
@@ -13061,7 +13046,7 @@ async function createCollectionInternal(key, solutionId, tableDef, workspaceId,
13061
13046
  const collectionConfig = {
13062
13047
  schema,
13063
13048
  conflictHandler: {
13064
- isEqual: (a, b) => a[CHECKPOINT_FIELD] === b[CHECKPOINT_FIELD],
13049
+ isEqual: (a, b) => JSON.stringify(a) === JSON.stringify(b),
13065
13050
  resolve: (i) => i.realMasterState
13066
13051
  // server wins
13067
13052
  }