@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/kv/index.cjs
CHANGED
|
@@ -1133,16 +1133,17 @@ var KVService = class extends BaseService {
|
|
|
1133
1133
|
...options?.ifNoneMatch === void 0 ? {} : { "if-none-match": options.ifNoneMatch }
|
|
1134
1134
|
}
|
|
1135
1135
|
);
|
|
1136
|
+
if (response.status === 401 || response.status === 403) {
|
|
1137
|
+
const errorText = await response.text();
|
|
1138
|
+
const message = errorText.trim().length > 0 ? errorText : `Failed to put key "${key}": ${response.status} - ${response.statusText || "authorization failed"}`;
|
|
1139
|
+
const { resource, action: requiredAction } = parseAuthError(errorText);
|
|
1140
|
+
return err(authUnauthorizedError("kv", message, {
|
|
1141
|
+
status: response.status,
|
|
1142
|
+
...requiredAction && { requiredAction },
|
|
1143
|
+
...resource && { resource }
|
|
1144
|
+
}));
|
|
1145
|
+
}
|
|
1136
1146
|
if (!response.ok) {
|
|
1137
|
-
if (response.status === 401) {
|
|
1138
|
-
const errorText2 = await response.text();
|
|
1139
|
-
const { resource, action } = parseAuthError(errorText2);
|
|
1140
|
-
return err(authUnauthorizedError("kv", errorText2, {
|
|
1141
|
-
status: response.status,
|
|
1142
|
-
...action && { requiredAction: action },
|
|
1143
|
-
...resource && { resource }
|
|
1144
|
-
}));
|
|
1145
|
-
}
|
|
1146
1147
|
const errorText = await response.text();
|
|
1147
1148
|
if (response.status === 412) {
|
|
1148
1149
|
return err(serviceError(
|