@xsai/shared 0.3.0-beta.4 → 0.3.0-beta.6
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.d.ts +4 -1
- package/dist/index.js +8 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -50,4 +50,7 @@ declare const responseCatch: (res: Response) => Promise<Response>;
|
|
|
50
50
|
|
|
51
51
|
declare const responseJSON: <T>(res: Response) => Promise<T>;
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
type TrampolineFn<T> = (() => Promise<TrampolineFn<T>> | TrampolineFn<T>) | Promise<T> | T;
|
|
54
|
+
declare const trampoline: <T>(fn: () => Promise<TrampolineFn<T>> | TrampolineFn<T>) => Promise<T>;
|
|
55
|
+
|
|
56
|
+
export { type CommonRequestOptions, type Fetch, type TrampolineFn, XSAIError, clean, objCamelToSnake, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake, trampoline };
|
package/dist/index.js
CHANGED
|
@@ -52,4 +52,11 @@ const responseJSON = async (res) => responseCatch(res).then(async (res2) => {
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
const trampoline = async (fn) => {
|
|
56
|
+
let result = await fn();
|
|
57
|
+
while (result instanceof Function)
|
|
58
|
+
result = await result();
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { XSAIError, clean, objCamelToSnake, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake, trampoline };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsai/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.0-beta.
|
|
4
|
+
"version": "0.3.0-beta.6",
|
|
5
5
|
"description": "extra-small AI SDK.",
|
|
6
6
|
"author": "Moeru AI",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
"files": [
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@moeru/std": "^0.1.0-beta.4"
|
|
33
|
+
},
|
|
31
34
|
"scripts": {
|
|
32
35
|
"build": "pkgroll"
|
|
33
36
|
},
|