@tinycloud/sdk-services 3.0.0-beta.10 → 3.0.0-beta.14
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/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/kv/index.cjs +10 -9
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.js +10 -9
- package/dist/kv/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2104,16 +2104,17 @@ var KVService = class extends BaseService {
|
|
|
2104
2104
|
...options?.ifNoneMatch === void 0 ? {} : { "if-none-match": options.ifNoneMatch }
|
|
2105
2105
|
}
|
|
2106
2106
|
);
|
|
2107
|
+
if (response.status === 401 || response.status === 403) {
|
|
2108
|
+
const errorText = await response.text();
|
|
2109
|
+
const message = errorText.trim().length > 0 ? errorText : `Failed to put key "${key}": ${response.status} - ${response.statusText || "authorization failed"}`;
|
|
2110
|
+
const { resource, action: requiredAction } = parseAuthError(errorText);
|
|
2111
|
+
return err(authUnauthorizedError("kv", message, {
|
|
2112
|
+
status: response.status,
|
|
2113
|
+
...requiredAction && { requiredAction },
|
|
2114
|
+
...resource && { resource }
|
|
2115
|
+
}));
|
|
2116
|
+
}
|
|
2107
2117
|
if (!response.ok) {
|
|
2108
|
-
if (response.status === 401) {
|
|
2109
|
-
const errorText2 = await response.text();
|
|
2110
|
-
const { resource, action } = parseAuthError(errorText2);
|
|
2111
|
-
return err(authUnauthorizedError("kv", errorText2, {
|
|
2112
|
-
status: response.status,
|
|
2113
|
-
...action && { requiredAction: action },
|
|
2114
|
-
...resource && { resource }
|
|
2115
|
-
}));
|
|
2116
|
-
}
|
|
2117
2118
|
const errorText = await response.text();
|
|
2118
2119
|
if (response.status === 412) {
|
|
2119
2120
|
return err(serviceError(
|