@alexfalconflores/safe-fetch 1.0.0 → 1.0.2
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.mts +2 -1
- package/dist/index.js +4 -2
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ interface RequestInitExt extends Omit<RequestInit, "headers"> {
|
|
|
5
5
|
headers?: HeadersType;
|
|
6
6
|
}
|
|
7
7
|
declare function Join(separator?: string, ...args: (string | number | (string | number)[])[]): string;
|
|
8
|
+
declare const toHeaders: (headers: HeadersType | Headers) => Headers;
|
|
8
9
|
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD" | "CONNECT" | (string & {});
|
|
9
10
|
type ContentType = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain" | "text/html" | "text/css" | "text/javascript" | "text/xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "audio/mpeg" | "audio/wav" | "video/mp4" | "application/pdf" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/octet-stream" | "application/javascript" | "application/graphql" | "application/yaml" | "application/zip" | (string & {});
|
|
10
11
|
type AuthorizationType = `Bearer ${string}` | `Basic ${string}` | `Digest ${string}` | `ApiKey ${string}` | `OAuth oauth_consumer_key="${string}", oauth_token="${string}", oauth_signature="${string}"` | `Hawk id="${string}", ts="${string}", nonce="${string}", mac="${string}"` | `AWS4-HMAC-SHA256 Credential=${string}, SignedHeaders=${string}, Signature=${string}` | (string & {});
|
|
@@ -50,4 +51,4 @@ type HeadersType = {
|
|
|
50
51
|
[key: string]: string | undefined;
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
export { type AcceptEncodingType, type AcceptLanguageType, type AcceptType, type AccessControlAllowHeadersType, type AccessControlAllowMethodsType, type AccessControlAllowOriginType, type AuthorizationType, type CacheControlType, type ContentEncodingType, type ContentLanguageType, type ContentType, type ETagType, type HeadersType, type HostType, type HttpMethod, Join, type OriginType, type RefererType, type RequestInitExt, type UserAgentType, safeFetch as default, safeFetch };
|
|
54
|
+
export { type AcceptEncodingType, type AcceptLanguageType, type AcceptType, type AccessControlAllowHeadersType, type AccessControlAllowMethodsType, type AccessControlAllowOriginType, type AuthorizationType, type CacheControlType, type ContentEncodingType, type ContentLanguageType, type ContentType, type ETagType, type HeadersType, type HostType, type HttpMethod, Join, type OriginType, type RefererType, type RequestInitExt, type UserAgentType, safeFetch as default, safeFetch, toHeaders };
|
package/dist/index.js
CHANGED
|
@@ -68,7 +68,8 @@ var index_exports = {};
|
|
|
68
68
|
__export(index_exports, {
|
|
69
69
|
Join: () => Join,
|
|
70
70
|
default: () => index_default,
|
|
71
|
-
safeFetch: () => safeFetch
|
|
71
|
+
safeFetch: () => safeFetch,
|
|
72
|
+
toHeaders: () => toHeaders
|
|
72
73
|
});
|
|
73
74
|
module.exports = __toCommonJS(index_exports);
|
|
74
75
|
function safeFetch(url, init) {
|
|
@@ -105,6 +106,7 @@ var toHeaders = (headers) => {
|
|
|
105
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
106
107
|
0 && (module.exports = {
|
|
107
108
|
Join,
|
|
108
|
-
safeFetch
|
|
109
|
+
safeFetch,
|
|
110
|
+
toHeaders
|
|
109
111
|
});
|
|
110
112
|
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -38,7 +38,7 @@ export function Join(
|
|
|
38
38
|
return args.flat().join(separator);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const toHeaders = (headers: HeadersType | Headers): Headers => {
|
|
41
|
+
export const toHeaders = (headers: HeadersType | Headers): Headers => {
|
|
42
42
|
if (headers instanceof Headers) return headers;
|
|
43
43
|
return new Headers(
|
|
44
44
|
Object.entries(headers).reduce<[string, string][]>((acc, [key, value]) => {
|