@controlfront/detect 0.0.4 → 0.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controlfront/detect",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -551,6 +551,14 @@ async function postBaselineDirect({
551
551
  }
552
552
  );
553
553
  if (!res.ok) {
554
+ // 409 duplicate means the baseline already exists for this commit — not an error
555
+ if (res.status === 409) {
556
+ const body = await res.json().catch(() => ({}));
557
+ if (body?.code === "duplicate") {
558
+ console.log("ℹ️ Baseline already exists for this commit — skipping (idempotent)");
559
+ return;
560
+ }
561
+ }
554
562
  const text = await res.text().catch(() => "");
555
563
  throw new Error(
556
564
  `Baseline sync failed: ${res.status} ${res.statusText} ${text}`
@@ -606,6 +614,14 @@ async function postSnapshotDirect({
606
614
  body: JSON.stringify(payload),
607
615
  });
608
616
  if (!res.ok) {
617
+ // 409 duplicate means the snapshot already exists for this commit — not an error
618
+ if (res.status === 409) {
619
+ const body = await res.json().catch(() => ({}));
620
+ if (body?.code === "duplicate") {
621
+ console.log("ℹ️ Snapshot already exists for this commit — skipping (idempotent)");
622
+ return;
623
+ }
624
+ }
609
625
  const text = await res.text().catch(() => "");
610
626
  throw new Error(
611
627
  `Snapshot sync failed: ${res.status} ${res.statusText} ${text}`