@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.js CHANGED
@@ -1962,16 +1962,17 @@ var KVService = class extends BaseService {
1962
1962
  ...options?.ifNoneMatch === void 0 ? {} : { "if-none-match": options.ifNoneMatch }
1963
1963
  }
1964
1964
  );
1965
+ if (response.status === 401 || response.status === 403) {
1966
+ const errorText = await response.text();
1967
+ const message = errorText.trim().length > 0 ? errorText : `Failed to put key "${key}": ${response.status} - ${response.statusText || "authorization failed"}`;
1968
+ const { resource, action: requiredAction } = parseAuthError(errorText);
1969
+ return err(authUnauthorizedError("kv", message, {
1970
+ status: response.status,
1971
+ ...requiredAction && { requiredAction },
1972
+ ...resource && { resource }
1973
+ }));
1974
+ }
1965
1975
  if (!response.ok) {
1966
- if (response.status === 401) {
1967
- const errorText2 = await response.text();
1968
- const { resource, action } = parseAuthError(errorText2);
1969
- return err(authUnauthorizedError("kv", errorText2, {
1970
- status: response.status,
1971
- ...action && { requiredAction: action },
1972
- ...resource && { resource }
1973
- }));
1974
- }
1975
1976
  const errorText = await response.text();
1976
1977
  if (response.status === 412) {
1977
1978
  return err(serviceError(