@pitcher/cli-scripts 2.2.1 → 2.2.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.
@@ -24,9 +24,13 @@ function isVersionAlreadyExistsError(e) {
24
24
  const err = e;
25
25
  if (err?.response?.status !== 400)
26
26
  return false;
27
- const data = err.response?.data;
28
- const text = typeof data === 'string' ? data : JSON.stringify(data ?? '');
29
- return /already exists/i.test(text);
27
+ // Only the version-release conflict — which the API reports in DRF
28
+ // `non_field_errors` — is a benign no-op. Don't scan the whole body: an
29
+ // unrelated 400 that merely mentions "already exists" (e.g. a field-level
30
+ // name/identifier conflict when creating a NEW app) is a real failure.
31
+ const nonField = err.response?.data?.non_field_errors;
32
+ const messages = Array.isArray(nonField) ? nonField : typeof nonField === 'string' ? [nonField] : [];
33
+ return messages.some((m) => typeof m === 'string' && /version .* already exists/i.test(m));
30
34
  }
31
35
  function buildVersion(now) {
32
36
  const year = now.getFullYear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pitcher/cli-scripts",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "The Pitcher CLI for various tasks in its ecosystem.",
5
5
  "author": "Pitcher AG",
6
6
  "license": "MIT",