@plusscommunities/pluss-core-aws 2.0.25-beta.1 → 2.0.25-beta.2

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.
@@ -215,9 +215,17 @@ const propagateHqEdit = async (
215
215
  }
216
216
  propagated.Changed = moment.utc().unix();
217
217
 
218
+ // IMPORTANT: pass a fresh shallow copy per call. `editRef` synchronously
219
+ // mutates its `updates` argument (`updates[keyCol] = id` inside the Promise
220
+ // constructor) AFTER taking a `cloneDeep` snapshot. Across parallel
221
+ // `Promise.all(map(...))` invocations, iteration N's `cloneDeep` would
222
+ // capture iteration N-1's `RowId` mutation, then later overwrite copy N's
223
+ // `RowId` during the get-merge-put, writing copy N's content back to copy
224
+ // N-1's key (and leaving copy N's own row untouched). Per-call `{...propagated}`
225
+ // gives each invocation an isolated payload it can mutate safely.
218
226
  await Promise.all(
219
227
  copies.map((copy) =>
220
- editRef(tableName, "RowId", copy.RowId, propagated),
228
+ editRef(tableName, "RowId", copy.RowId, { ...propagated }),
221
229
  ),
222
230
  );
223
231
  return copies.length;
@@ -256,9 +264,13 @@ const cascadeHqRetract = async (hqSourceRow, tableName, options = {}) => {
256
264
  Deleted: true,
257
265
  Changed: moment.utc().unix(),
258
266
  };
267
+ // Per-call shallow copy — see propagateHqEdit for the editRef-mutation-race
268
+ // rationale. Even though `deletionUpdate` is tiny, the same RowId clobber
269
+ // happens here: under sharing, only the FIRST copy actually receives
270
+ // `Deleted: true`; subsequent writes land at the wrong RowId.
259
271
  await Promise.all(
260
272
  copies.map((copy) =>
261
- editRef(tableName, "RowId", copy.RowId, deletionUpdate),
273
+ editRef(tableName, "RowId", copy.RowId, { ...deletionUpdate }),
262
274
  ),
263
275
  );
264
276
  return copies.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-aws",
3
- "version": "2.0.25-beta.1",
3
+ "version": "2.0.25-beta.2",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "scripts": {
6
6
  "betapatch": "npm version prepatch --preid=beta",