@torthu/jacketui-bring 0.0.2 → 0.1.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.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/response-pipe/arrayBuffer.d.ts +10 -0
- package/dist/response-pipe/arrayBuffer.js +17 -0
- package/dist/response-pipe/blob.d.ts +10 -0
- package/dist/response-pipe/blob.js +17 -0
- package/dist/response-pipe/bytes.d.ts +10 -0
- package/dist/response-pipe/bytes.js +17 -0
- package/dist/response-pipe/formData.d.ts +10 -0
- package/dist/response-pipe/formData.js +17 -0
- package/dist/response-pipe/index.d.ts +6 -0
- package/dist/response-pipe/index.js +6 -0
- package/dist/response-pipe/json.d.ts +10 -0
- package/dist/response-pipe/json.js +17 -0
- package/dist/response-pipe/text.d.ts +10 -0
- package/dist/response-pipe/text.js +17 -0
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/response-pipe/arrayBuffer.ts +18 -0
- package/src/response-pipe/blob.ts +18 -0
- package/src/response-pipe/bytes.ts +18 -0
- package/src/response-pipe/formData.ts +18 -0
- package/src/response-pipe/index.ts +6 -0
- package/src/response-pipe/json.ts +20 -0
- package/src/response-pipe/text.ts +18 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/backoff.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/backoff.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/body.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/body.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/cache.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/cache.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/cors.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/cors.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/credentials.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/credentials.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/header.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/header.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/index.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/index.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/integrity.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/integrity.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/jitter.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/jitter.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/jsonBody.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/jsonBody.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/keepalive.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/keepalive.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/method.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/method.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/priority.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/priority.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/redirect.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/redirect.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/referrer.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/referrer.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/referrerPolicy.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/referrerPolicy.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/retry.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/retry.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/shouldRetry.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/shouldRetry.js +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/timeout.d.ts +0 -0
- /package/dist/{pipe-helpers → request-builder-pipe}/timeout.js +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/backoff.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/body.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/cache.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/cors.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/credentials.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/header.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/index.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/integrity.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/jitter.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/jsonBody.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/keepalive.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/method.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/priority.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/redirect.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/referrer.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/referrerPolicy.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/retry.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/shouldRetry.ts +0 -0
- /package/src/{pipe-helpers → request-builder-pipe}/timeout.ts +0 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
/** arrayBuffer(result: Result<Response, BringError>)
|
|
4
|
+
*
|
|
5
|
+
* Utility function to await Response.arrayBuffer().
|
|
6
|
+
*
|
|
7
|
+
* @param result Result<Response, BringError>
|
|
8
|
+
* @returns Promise<Result<ArrayBuffer, BringError>>
|
|
9
|
+
*/
|
|
10
|
+
export declare const arrayBuffer: (result: Result<Response, BringError>) => Promise<import("@torthu/jacketui-core").Failure<BringError> | import("@torthu/jacketui-core").Success<ArrayBuffer>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { success } from "@torthu/jacketui-core";
|
|
2
|
+
/** arrayBuffer(result: Result<Response, BringError>)
|
|
3
|
+
*
|
|
4
|
+
* Utility function to await Response.arrayBuffer().
|
|
5
|
+
*
|
|
6
|
+
* @param result Result<Response, BringError>
|
|
7
|
+
* @returns Promise<Result<ArrayBuffer, BringError>>
|
|
8
|
+
*/
|
|
9
|
+
export const arrayBuffer = async (result) => {
|
|
10
|
+
if (result.ok) {
|
|
11
|
+
const res = await result.value.arrayBuffer();
|
|
12
|
+
return success(res);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
/** blob(result: Result<Response, BringError>)
|
|
4
|
+
*
|
|
5
|
+
* Utility function to await Response.blob().
|
|
6
|
+
*
|
|
7
|
+
* @param result Result<Response, BringError>
|
|
8
|
+
* @returns Promise<Result<Blob, BringError>>
|
|
9
|
+
*/
|
|
10
|
+
export declare const blob: (result: Result<Response, BringError>) => Promise<import("@torthu/jacketui-core").Failure<BringError> | import("@torthu/jacketui-core").Success<Blob>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { success } from "@torthu/jacketui-core";
|
|
2
|
+
/** blob(result: Result<Response, BringError>)
|
|
3
|
+
*
|
|
4
|
+
* Utility function to await Response.blob().
|
|
5
|
+
*
|
|
6
|
+
* @param result Result<Response, BringError>
|
|
7
|
+
* @returns Promise<Result<Blob, BringError>>
|
|
8
|
+
*/
|
|
9
|
+
export const blob = async (result) => {
|
|
10
|
+
if (result.ok) {
|
|
11
|
+
const res = await result.value.blob();
|
|
12
|
+
return success(res);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
/** bytes(result: Result<Response, BringError>)
|
|
4
|
+
*
|
|
5
|
+
* Utility function to await Response.bytes().
|
|
6
|
+
*
|
|
7
|
+
* @param result Result<Response, BringError>
|
|
8
|
+
* @returns Promise<Result<Uint8Array, BringError>>
|
|
9
|
+
*/
|
|
10
|
+
export declare const bytes: (result: Result<Response, BringError>) => Promise<import("@torthu/jacketui-core").Failure<BringError> | import("@torthu/jacketui-core").Success<Uint8Array<ArrayBufferLike>>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { success } from "@torthu/jacketui-core";
|
|
2
|
+
/** bytes(result: Result<Response, BringError>)
|
|
3
|
+
*
|
|
4
|
+
* Utility function to await Response.bytes().
|
|
5
|
+
*
|
|
6
|
+
* @param result Result<Response, BringError>
|
|
7
|
+
* @returns Promise<Result<Uint8Array, BringError>>
|
|
8
|
+
*/
|
|
9
|
+
export const bytes = async (result) => {
|
|
10
|
+
if (result.ok) {
|
|
11
|
+
const res = await result.value.bytes();
|
|
12
|
+
return success(res);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
/** formData(result: Result<Response, BringError>)
|
|
4
|
+
*
|
|
5
|
+
* Utility function to await Response.formData().
|
|
6
|
+
*
|
|
7
|
+
* @param result Result<Response, BringError>
|
|
8
|
+
* @returns Promise<Result<FormData, BringError>>
|
|
9
|
+
*/
|
|
10
|
+
export declare const formData: (result: Result<Response, BringError>) => Promise<import("@torthu/jacketui-core").Failure<BringError> | import("@torthu/jacketui-core").Success<FormData>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { success } from "@torthu/jacketui-core";
|
|
2
|
+
/** formData(result: Result<Response, BringError>)
|
|
3
|
+
*
|
|
4
|
+
* Utility function to await Response.formData().
|
|
5
|
+
*
|
|
6
|
+
* @param result Result<Response, BringError>
|
|
7
|
+
* @returns Promise<Result<FormData, BringError>>
|
|
8
|
+
*/
|
|
9
|
+
export const formData = async (result) => {
|
|
10
|
+
if (result.ok) {
|
|
11
|
+
const res = await result.value.formData();
|
|
12
|
+
return success(res);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
/** json(result: Result<Response, BringError>)
|
|
4
|
+
*
|
|
5
|
+
* Utility function to await Response.json().
|
|
6
|
+
*
|
|
7
|
+
* @param result Result<Response, BringError>
|
|
8
|
+
* @returns Promise<Result<T, BringError>>
|
|
9
|
+
*/
|
|
10
|
+
export declare const json: <T = unknown>(result: Result<Response, BringError>) => Promise<import("@torthu/jacketui-core").Failure<BringError> | import("@torthu/jacketui-core").Success<T>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { success } from "@torthu/jacketui-core";
|
|
2
|
+
/** json(result: Result<Response, BringError>)
|
|
3
|
+
*
|
|
4
|
+
* Utility function to await Response.json().
|
|
5
|
+
*
|
|
6
|
+
* @param result Result<Response, BringError>
|
|
7
|
+
* @returns Promise<Result<T, BringError>>
|
|
8
|
+
*/
|
|
9
|
+
export const json = async (result) => {
|
|
10
|
+
if (result.ok) {
|
|
11
|
+
const json = await result.value.json();
|
|
12
|
+
return success(json);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Result } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
/** text(result: Result<Response, BringError>)
|
|
4
|
+
*
|
|
5
|
+
* Utility function to await Response.text().
|
|
6
|
+
*
|
|
7
|
+
* @param result Result<Response, BringError>
|
|
8
|
+
* @returns Promise<Result<string, BringError>>
|
|
9
|
+
*/
|
|
10
|
+
export declare const text: (result: Result<Response, BringError>) => Promise<import("@torthu/jacketui-core").Failure<BringError> | import("@torthu/jacketui-core").Success<string>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { success } from "@torthu/jacketui-core";
|
|
2
|
+
/** text(result: Result<Response, BringError>)
|
|
3
|
+
*
|
|
4
|
+
* Utility function to await Response.text().
|
|
5
|
+
*
|
|
6
|
+
* @param result Result<Response, BringError>
|
|
7
|
+
* @returns Promise<Result<string, BringError>>
|
|
8
|
+
*/
|
|
9
|
+
export const text = async (result) => {
|
|
10
|
+
if (result.ok) {
|
|
11
|
+
const res = await result.value.text();
|
|
12
|
+
return success(res);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Result, success } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
|
|
4
|
+
/** arrayBuffer(result: Result<Response, BringError>)
|
|
5
|
+
*
|
|
6
|
+
* Utility function to await Response.arrayBuffer().
|
|
7
|
+
*
|
|
8
|
+
* @param result Result<Response, BringError>
|
|
9
|
+
* @returns Promise<Result<ArrayBuffer, BringError>>
|
|
10
|
+
*/
|
|
11
|
+
export const arrayBuffer = async (result: Result<Response, BringError>) => {
|
|
12
|
+
if (result.ok) {
|
|
13
|
+
const res = await result.value.arrayBuffer();
|
|
14
|
+
return success(res);
|
|
15
|
+
} else {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Result, success } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
|
|
4
|
+
/** blob(result: Result<Response, BringError>)
|
|
5
|
+
*
|
|
6
|
+
* Utility function to await Response.blob().
|
|
7
|
+
*
|
|
8
|
+
* @param result Result<Response, BringError>
|
|
9
|
+
* @returns Promise<Result<Blob, BringError>>
|
|
10
|
+
*/
|
|
11
|
+
export const blob = async (result: Result<Response, BringError>) => {
|
|
12
|
+
if (result.ok) {
|
|
13
|
+
const res = await result.value.blob();
|
|
14
|
+
return success(res);
|
|
15
|
+
} else {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Result, success } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
|
|
4
|
+
/** bytes(result: Result<Response, BringError>)
|
|
5
|
+
*
|
|
6
|
+
* Utility function to await Response.bytes().
|
|
7
|
+
*
|
|
8
|
+
* @param result Result<Response, BringError>
|
|
9
|
+
* @returns Promise<Result<Uint8Array, BringError>>
|
|
10
|
+
*/
|
|
11
|
+
export const bytes = async (result: Result<Response, BringError>) => {
|
|
12
|
+
if (result.ok) {
|
|
13
|
+
const res = await result.value.bytes();
|
|
14
|
+
return success(res);
|
|
15
|
+
} else {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Result, success } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
|
|
4
|
+
/** formData(result: Result<Response, BringError>)
|
|
5
|
+
*
|
|
6
|
+
* Utility function to await Response.formData().
|
|
7
|
+
*
|
|
8
|
+
* @param result Result<Response, BringError>
|
|
9
|
+
* @returns Promise<Result<FormData, BringError>>
|
|
10
|
+
*/
|
|
11
|
+
export const formData = async (result: Result<Response, BringError>) => {
|
|
12
|
+
if (result.ok) {
|
|
13
|
+
const res = await result.value.formData();
|
|
14
|
+
return success(res);
|
|
15
|
+
} else {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Result, success } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
|
|
4
|
+
/** json(result: Result<Response, BringError>)
|
|
5
|
+
*
|
|
6
|
+
* Utility function to await Response.json().
|
|
7
|
+
*
|
|
8
|
+
* @param result Result<Response, BringError>
|
|
9
|
+
* @returns Promise<Result<T, BringError>>
|
|
10
|
+
*/
|
|
11
|
+
export const json = async <T = unknown>(
|
|
12
|
+
result: Result<Response, BringError>
|
|
13
|
+
) => {
|
|
14
|
+
if (result.ok) {
|
|
15
|
+
const json = await result.value.json();
|
|
16
|
+
return success(json as T);
|
|
17
|
+
} else {
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Result, success } from "@torthu/jacketui-core";
|
|
2
|
+
import { BringError } from "../errors";
|
|
3
|
+
|
|
4
|
+
/** text(result: Result<Response, BringError>)
|
|
5
|
+
*
|
|
6
|
+
* Utility function to await Response.text().
|
|
7
|
+
*
|
|
8
|
+
* @param result Result<Response, BringError>
|
|
9
|
+
* @returns Promise<Result<string, BringError>>
|
|
10
|
+
*/
|
|
11
|
+
export const text = async (result: Result<Response, BringError>) => {
|
|
12
|
+
if (result.ok) {
|
|
13
|
+
const res = await result.value.text();
|
|
14
|
+
return success(res);
|
|
15
|
+
} else {
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|