@trops/dash-core 0.1.414 → 0.1.415
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/electron/index.js +42 -12
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +39 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +39 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -27105,7 +27105,13 @@ async function updateRegistryPackage$1(scope, name, updates) {
|
|
|
27105
27105
|
*/
|
|
27106
27106
|
async function deleteRegistryPackage$1(scope, name) {
|
|
27107
27107
|
const stored = getStoredToken$4();
|
|
27108
|
-
if (!stored)
|
|
27108
|
+
if (!stored) {
|
|
27109
|
+
return {
|
|
27110
|
+
success: false,
|
|
27111
|
+
error: "Not signed in to the registry.",
|
|
27112
|
+
status: 0,
|
|
27113
|
+
};
|
|
27114
|
+
}
|
|
27109
27115
|
|
|
27110
27116
|
try {
|
|
27111
27117
|
const response = await fetch(
|
|
@@ -27120,25 +27126,49 @@ async function deleteRegistryPackage$1(scope, name) {
|
|
|
27120
27126
|
|
|
27121
27127
|
if (response.status === 401) {
|
|
27122
27128
|
clearToken$2();
|
|
27123
|
-
return
|
|
27129
|
+
return {
|
|
27130
|
+
success: false,
|
|
27131
|
+
error: "Session expired. Sign in again and retry.",
|
|
27132
|
+
status: 401,
|
|
27133
|
+
};
|
|
27134
|
+
}
|
|
27135
|
+
|
|
27136
|
+
// Read body text once so we can either parse JSON on success or
|
|
27137
|
+
// surface the raw server error message on failure.
|
|
27138
|
+
const bodyText = await response.text().catch(() => "");
|
|
27139
|
+
|
|
27140
|
+
if (!response.ok) {
|
|
27141
|
+
let serverMsg = bodyText;
|
|
27142
|
+
try {
|
|
27143
|
+
const parsed = JSON.parse(bodyText);
|
|
27144
|
+
serverMsg = parsed?.error || parsed?.message || bodyText;
|
|
27145
|
+
} catch {
|
|
27146
|
+
// bodyText is already a plain string; use it as-is.
|
|
27147
|
+
}
|
|
27148
|
+
return {
|
|
27149
|
+
success: false,
|
|
27150
|
+
error:
|
|
27151
|
+
serverMsg ||
|
|
27152
|
+
`Registry returned ${response.status} ${response.statusText || ""}`.trim(),
|
|
27153
|
+
status: response.status,
|
|
27154
|
+
};
|
|
27124
27155
|
}
|
|
27125
|
-
if (!response.ok) return null;
|
|
27126
27156
|
|
|
27127
|
-
//
|
|
27128
|
-
|
|
27129
|
-
// swallowed it as a null result — the UI then skipped its "onDeleted"
|
|
27130
|
-
// refresh and looked like nothing happened. Handle 204 + unparseable
|
|
27131
|
-
// success responses as a successful delete.
|
|
27132
|
-
if (response.status === 204) {
|
|
27157
|
+
// Success path — 204 No Content is common; JSON is optional.
|
|
27158
|
+
if (response.status === 204 || !bodyText.trim()) {
|
|
27133
27159
|
return { success: true };
|
|
27134
27160
|
}
|
|
27135
27161
|
try {
|
|
27136
|
-
return
|
|
27162
|
+
return { success: true, ...JSON.parse(bodyText) };
|
|
27137
27163
|
} catch {
|
|
27138
27164
|
return { success: true };
|
|
27139
27165
|
}
|
|
27140
|
-
} catch {
|
|
27141
|
-
return
|
|
27166
|
+
} catch (err) {
|
|
27167
|
+
return {
|
|
27168
|
+
success: false,
|
|
27169
|
+
error: `Network error: ${err?.message || "unknown"}`,
|
|
27170
|
+
status: 0,
|
|
27171
|
+
};
|
|
27142
27172
|
}
|
|
27143
27173
|
}
|
|
27144
27174
|
|