@literate.ink/utilities
Advanced tools
Comparing version 1.0.0-10236787694.1 to 1.0.0-10237950153.1
@@ -0,1 +1,12 @@ | ||
interface HeadersLike { | ||
get(key: string): string | null; | ||
} | ||
/** | ||
* Extracts cookies from the "set-cookie" header of a response. | ||
*/ | ||
declare const getCookiesFromResponse: (response: Response) => string[]; | ||
/** | ||
* Extracts a header from a response. | ||
*/ | ||
declare const getHeaderFromResponse: (response: Response, item: string) => string | null; | ||
interface Request { | ||
@@ -7,3 +18,3 @@ url: string; | ||
/** Headers that should be appended to the request. */ | ||
headers: Array<[string, string]>; | ||
headers: Record<string, string> | Headers; | ||
redirect: "follow" | "manual"; | ||
@@ -14,3 +25,3 @@ } | ||
content: string; | ||
headers: Array<[string, string]>; | ||
headers: Record<string, string> | Headers | HeadersLike; | ||
} | ||
@@ -27,2 +38,2 @@ type Fetcher = (req: Request) => Promise<Response>; | ||
export { type Fetcher, type Request, type Response, defaultFetcher }; | ||
export { type Fetcher, type Request, type Response, defaultFetcher, getCookiesFromResponse, getHeaderFromResponse }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,c={};((e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})})(c,{defaultFetcher:()=>n}),module.exports=(e=c,((e,c,n,s)=>{if(c&&"object"==typeof c||"function"==typeof c)for(let u of o(c))a.call(e,u)||u===n||t(e,u,{get:()=>c[u],enumerable:!(s=r(c,u))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n=async e=>{const t={};e.headers.forEach((([e,r])=>{t[e]=r}));const r=await fetch(e.url,{headers:t,redirect:e.redirect,method:e.method,body:e.content}),o=[];return r.headers.forEach(((e,t)=>{o.push([t,e])})),{status:r.status,content:await r.text(),headers:o}};//# sourceMappingURL=index.js.map | ||
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,n={};((e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})})(n,{defaultFetcher:()=>u,getCookiesFromResponse:()=>c,getHeaderFromResponse:()=>i}),module.exports=(e=n,((e,n,a,c)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let i of o(n))s.call(e,i)||i===a||t(e,i,{get:()=>n[i],enumerable:!(c=r(n,i))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=require("set-cookie-parser"),c=e=>{const t=i(e,"set-cookie");return null===t?[]:(0,a.splitCookiesString)(t).map((e=>e.split(";")[0]))},i=(e,t)=>{const r=e.headers;return"function"==typeof r.get?r.get(t):r[t]},u=async e=>{const t=await fetch(e.url,{redirect:e.redirect,headers:e.headers,method:e.method,body:e.content});return{status:t.status,content:await t.text(),headers:t.headers}};//# sourceMappingURL=index.js.map |
{ | ||
"name": "@literate.ink/utilities", | ||
"version": "1.0.0-10236787694.1", | ||
"version": "1.0.0-10237950153.1", | ||
"description": "A general package containing utilities for helping building our libraries.", | ||
@@ -34,6 +34,10 @@ "private": false, | ||
"@types/node": "^20.14.14", | ||
"@types/set-cookie-parser": "^2.4.10", | ||
"terser": "^5.31.3", | ||
"tsup": "^8.2.4", | ||
"typescript": "^5.5.4" | ||
}, | ||
"dependencies": { | ||
"set-cookie-parser": "^2.7.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
11461
9
35
1
8
1
5
2
+ Addedset-cookie-parser@^2.7.0
+ Addedset-cookie-parser@2.7.1(transitive)