@tinycloud/sdk-services 3.0.0-beta.8 → 3.0.0
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 +11 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/kv/index.cjs +11 -10
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.js +11 -10
- package/dist/kv/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1478,7 +1478,7 @@ var KVService = class extends BaseService {
|
|
|
1478
1478
|
*/
|
|
1479
1479
|
getFullPath(key, prefixOverride) {
|
|
1480
1480
|
const prefix = prefixOverride ?? this._config.prefix ?? "";
|
|
1481
|
-
return prefix ? `${prefix}/${key}` : key;
|
|
1481
|
+
return prefix ? key === "" ? prefix : `${prefix}/${key}` : key;
|
|
1482
1482
|
}
|
|
1483
1483
|
/**
|
|
1484
1484
|
* Get the host URL.
|
|
@@ -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(
|