@wrongstack/persistence 0.306.2 → 0.306.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.
Files changed (2) hide show
  1. package/dist/index.js +8 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -212,6 +212,13 @@ async function renameWithRetry(from, to) {
212
212
  } catch (error) {
213
213
  const code = error.code;
214
214
  let transient = code !== void 0 && TRANSIENT_RENAME_CODES.has(code);
215
+ if (transient) {
216
+ try {
217
+ const target = await fs.stat(to);
218
+ if (target.isDirectory()) transient = false;
219
+ } catch {
220
+ }
221
+ }
215
222
  if (code === "ENOENT") {
216
223
  try {
217
224
  await fs.stat(from);
@@ -223,7 +230,7 @@ async function renameWithRetry(from, to) {
223
230
  if (!transient || attempt === delays.length) {
224
231
  if (attempt === delays.length) {
225
232
  process.emitWarning(
226
- `Windows rename retries exhausted for '${from}' \u2192 '${to}' (code=${code}). Write skipped \u2014 the caller will retry on the next cycle.`,
233
+ `Windows rename retries exhausted for '${from}' \u2192 '${to}' (code=${code}). Atomic write failed; the original target was left untouched.`,
227
234
  { code: "WRONGSTACK_WIN32_RENAME_EXHAUSTED" }
228
235
  );
229
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/persistence",
3
- "version": "0.306.2",
3
+ "version": "0.306.3",
4
4
  "license": "MIT",
5
5
  "description": "Dependency-free filesystem persistence primitives shared across WrongStack packages.",
6
6
  "repository": {