hibp 15.2.0 → 15.2.1
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 15.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#569](https://github.com/wKovacs64/hibp/pull/569) [`a57fece`](https://github.com/wKovacs64/hibp/commit/a57fecef8a6c7fd82f0d8dfd5697efcd55d9d54e) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Fix preview publishing by adding `type` to the `repository` section of `package.json`. This is a package maintenance release only - no changes in the library itself.
|
|
8
|
+
|
|
3
9
|
## 15.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var w="hibp",P="15.2.
|
|
1
|
+
var w="hibp",P="15.2.1";async function g({baseUrl:e,endpoint:t,headers:r,timeoutMs:s,signal:n,userAgent:o,queryParams:a}){let i={headers:I(o,r),signal:v(s,n)},c=M(e,t,a);return fetch(c,i)}function M(e,t,r){let s=e.replace(/\/$/g,""),n=t.startsWith("/")?t:`/${t}`,o=new URL(`${s}${n}`);if(r)for(let[a,i]of Object.entries(r))o.searchParams.set(a,i);return o.toString()}function I(e,t){let r={...t};return e?r["User-Agent"]=e:typeof navigator>"u"&&(r["User-Agent"]=`${w} ${P}`),r}function v(e,t){let r=[];if(e&&r.push(AbortSignal.timeout(e)),t&&r.push(t),r.length!==0)return r.length===1?r[0]:AbortSignal.any(r)}var b={status:400,statusText:"Bad request \u2014 the account does not comply with an acceptable format."},S={status:401,body:`Your request to the API couldn't be authorised. Check you have the right value in the "hibp-api-key" header, refer to the documentation for more: https://haveibeenpwned.com/API/v3#Authorisation`},f={status:403,statusText:"Forbidden - access denied."};var U={status:404},x={headers:new Map([["retry-after","2"]]),status:429,body:{statusCode:429,message:"Rate limit is exceeded. Try again in 2 seconds."}};var d=class extends Error{retryAfterSeconds;constructor(t,r,s){super(r,s),this.name=this.constructor.name,this.retryAfterSeconds=typeof t=="string"?Number.parseInt(t,10):void 0}};function K(e){return`Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${e})`}async function m(e,t={}){let{apiKey:r,baseUrl:s="https://haveibeenpwned.com/api/v3",timeoutMs:n,signal:o,userAgent:a}=t,i={};r&&(i["HIBP-API-Key"]=r);let c=await g({baseUrl:s,endpoint:e,headers:i,timeoutMs:n,signal:o,userAgent:a});if(c.ok)return c.json();switch(c.status){case b.status:throw new Error(b.statusText);case S.status:{let p=await c.text();throw new Error(p)}case f.status:{let p=c.headers.get("cf-ray");throw p?new Error(K(p)):new Error(f.statusText)}case U.status:return null;case x.status:{let p=await c.json(),u=c.headers.get("retry-after");throw new d(u,p.message)}default:throw new Error(c.statusText)}}function C(e,t={}){return m(`/breach/${encodeURIComponent(e)}`,t)}function h(e,t={}){let{apiKey:r,domain:s,includeUnverified:n=!0,timeoutMs:o,signal:a,truncate:i=!0,baseUrl:c,userAgent:p}=t,u=`/breachedaccount/${encodeURIComponent(e)}?`,l=[];return s&&l.push(`domain=${encodeURIComponent(s)}`),n||l.push("includeUnverified=false"),i||l.push("truncateResponse=false"),m(`${u}${l.join("&")}`,{apiKey:r,baseUrl:c,timeoutMs:o,signal:a,userAgent:p})}function T(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/breacheddomain/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function F(e={}){let{domain:t,baseUrl:r,timeoutMs:s,signal:n,userAgent:o}=e,a="/breaches?",i=[];return t&&i.push(`domain=${encodeURIComponent(t)}`),m(`${a}${i.join("&")}`,{baseUrl:r,timeoutMs:s,signal:n,userAgent:o})}function $(e={}){return m("/dataclasses",e)}function j(e={}){return m("/latestbreach",e)}function y(e,t={}){return m(`/pasteaccount/${encodeURIComponent(e)}`,t)}var E={status:400,body:"The hash prefix was not in a valid format"};async function B(e,t={}){let{baseUrl:r="https://api.pwnedpasswords.com",timeoutMs:s,signal:n,userAgent:o,addPadding:a=!1,mode:i="sha1"}=t,c={};a&&(c["Add-Padding"]="true");let p=await g({baseUrl:r,endpoint:e,headers:c,timeoutMs:s,signal:n,userAgent:o,queryParams:{mode:i}});if(p.ok)return p.text();if(p.status===E.status){let u=await p.text();throw new Error(u)}throw new Error(p.statusText)}async function A(e,t={}){let{baseUrl:r,timeoutMs:s,signal:n,userAgent:o,addPadding:a=!1,mode:i="sha1"}=t;return(await B(`/range/${encodeURIComponent(e)}`,{baseUrl:r,timeoutMs:s,signal:n,userAgent:o,addPadding:a,mode:i})).split(`
|
|
2
2
|
`).filter(Boolean).reduce((u,l)=>{let[R,D]=l.split(":");return u[R]=Number.parseInt(D,10),u},{})}async function L(e,t={}){let[r,s]=await O(e);return(await A(r,t))[s]||0}async function O(e){if(typeof crypto=="object"&&crypto.subtle){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-1",t),n=Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("").toUpperCase();return[n.slice(0,5),n.slice(5)]}throw new Error("The Web Crypto API is not available in this environment.")}async function N(e,t={}){let{apiKey:r,domain:s,truncate:n=!0,baseUrl:o,timeoutMs:a,signal:i,userAgent:c}=t,[p,u]=await Promise.all([h(e,{apiKey:r,domain:s,truncate:n,baseUrl:o,timeoutMs:a,signal:i,userAgent:c}),/^.+@.+$/.test(e)?y(e,{apiKey:r,baseUrl:o,timeoutMs:a,signal:i,userAgent:c}):null]);return{breaches:p,pastes:u}}function _(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/stealerlogsbyemail/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function H(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/stealerlogsbyemaildomain/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function k(e,t={}){let{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a}=t,i=`/stealerlogsbywebsitedomain/${encodeURIComponent(e)}`;return m(i,{apiKey:r,baseUrl:s,timeoutMs:n,signal:o,userAgent:a})}function W(e={}){let{apiKey:t,baseUrl:r,timeoutMs:s,signal:n,userAgent:o}=e;return m("/subscribeddomains",{apiKey:t,baseUrl:r,timeoutMs:s,signal:n,userAgent:o})}async function q(e={}){return m("/subscription/status",e)}export{d as RateLimitError,C as breach,h as breachedAccount,T as breachedDomain,F as breaches,$ as dataClasses,j as latestBreach,y as pasteAccount,L as pwnedPassword,A as pwnedPasswordRange,N as search,_ as stealerLogsByEmail,H as stealerLogsByEmailDomain,k as stealerLogsByWebsiteDomain,W as subscribedDomains,q as subscriptionStatus};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const PACKAGE_NAME = "hibp";
|
|
2
|
-
export declare const PACKAGE_VERSION = "15.2.
|
|
2
|
+
export declare const PACKAGE_VERSION = "15.2.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hibp",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.1",
|
|
4
4
|
"description": "An unofficial TypeScript SDK for the 'Have I been pwned?' service.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"haveibeenpwned",
|
|
@@ -36,39 +36,12 @@
|
|
|
36
36
|
"MIGRATION.md"
|
|
37
37
|
],
|
|
38
38
|
"sideEffects": false,
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "run-s --silent build:package-info build:lib build:browser build:docs",
|
|
41
|
-
"build:package-info": "node --experimental-strip-types scripts/build-package-info.ts",
|
|
42
|
-
"build:lib": "tsc --project tsconfig.tsc.json",
|
|
43
|
-
"build:browser": "esbuild src/hibp.ts --minify --bundle --format=esm --platform=browser --tsconfig=tsconfig.esbuild.json --outfile=dist/browser/hibp.module.js",
|
|
44
|
-
"build:docs": "jsdoc2md --no-cache --files src/*.ts --configure jsdoc2md.json > API.md && node scripts/fix-api-docs.js",
|
|
45
|
-
"changeset": "changeset",
|
|
46
|
-
"changeset:version": "changeset version && npm install --package-lock-only",
|
|
47
|
-
"changeset:publish": "changeset publish",
|
|
48
|
-
"typecheck": "tsc --noEmit",
|
|
49
|
-
"clean": "rimraf dist coverage",
|
|
50
|
-
"format": "prettier --cache --write .",
|
|
51
|
-
"format:check": "prettier --cache --check .",
|
|
52
|
-
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
|
53
|
-
"prebuild": "npm run --silent clean",
|
|
54
|
-
"prepublishOnly": "npm run build",
|
|
55
|
-
"size": "bundlewatch --config .bundlewatch.config.json",
|
|
56
|
-
"pretest": "npm run --silent build:package-info",
|
|
57
|
-
"test": "vitest run",
|
|
58
|
-
"pretest:coverage": "npm run --silent build:package-info",
|
|
59
|
-
"test:coverage": "vitest run --coverage",
|
|
60
|
-
"pretest:browser:open": "run-s --silent build:package-info build:browser",
|
|
61
|
-
"test:browser:open": "playwright test --ui",
|
|
62
|
-
"pretest:browser:run": "run-s --silent build:package-info build:browser",
|
|
63
|
-
"test:browser:run": "playwright test",
|
|
64
|
-
"pretest:watch": "npm run --silent build:package-info",
|
|
65
|
-
"test:watch": "vitest watch"
|
|
66
|
-
},
|
|
67
39
|
"private": false,
|
|
68
40
|
"publishConfig": {
|
|
69
41
|
"access": "public"
|
|
70
42
|
},
|
|
71
43
|
"repository": {
|
|
44
|
+
"type": "git",
|
|
72
45
|
"url": "git+https://github.com/wKovacs64/hibp.git"
|
|
73
46
|
},
|
|
74
47
|
"bugs": {
|
|
@@ -88,24 +61,51 @@
|
|
|
88
61
|
"@changesets/cli": "2.29.8",
|
|
89
62
|
"@playwright/test": "1.57.0",
|
|
90
63
|
"@types/common-tags": "1.8.4",
|
|
91
|
-
"@types/node": "24.10.
|
|
92
|
-
"@vitest/coverage-v8": "4.0.
|
|
93
|
-
"@wkovacs64/eslint-config": "7.
|
|
94
|
-
"@wkovacs64/prettier-config": "4.2.
|
|
64
|
+
"@types/node": "24.10.7",
|
|
65
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
66
|
+
"@wkovacs64/eslint-config": "7.12.0",
|
|
67
|
+
"@wkovacs64/prettier-config": "4.2.3",
|
|
95
68
|
"bundlewatch": "0.4.1",
|
|
96
69
|
"common-tags": "1.8.2",
|
|
97
70
|
"cross-env": "10.1.0",
|
|
98
|
-
"esbuild": "0.27.
|
|
99
|
-
"eslint": "9.39.
|
|
71
|
+
"esbuild": "0.27.2",
|
|
72
|
+
"eslint": "9.39.2",
|
|
100
73
|
"jsdoc-babel": "0.5.0",
|
|
101
74
|
"jsdoc-to-markdown": "9.1.3",
|
|
102
|
-
"msw": "2.12.
|
|
75
|
+
"msw": "2.12.7",
|
|
103
76
|
"npm-run-all2": "8.0.4",
|
|
104
77
|
"pathe": "2.0.3",
|
|
105
|
-
"prettier": "3.7.
|
|
78
|
+
"prettier": "3.7.4",
|
|
106
79
|
"rimraf": "6.1.2",
|
|
107
80
|
"serve": "14.2.5",
|
|
108
81
|
"typescript": "5.9.3",
|
|
109
|
-
"vitest": "4.0.
|
|
82
|
+
"vitest": "4.0.16"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"build": "run-s --silent build:package-info build:lib build:browser build:docs",
|
|
86
|
+
"build:package-info": "node --experimental-strip-types scripts/build-package-info.ts",
|
|
87
|
+
"build:lib": "tsc --project tsconfig.tsc.json",
|
|
88
|
+
"build:browser": "esbuild src/hibp.ts --minify --bundle --format=esm --platform=browser --tsconfig=tsconfig.esbuild.json --outfile=dist/browser/hibp.module.js",
|
|
89
|
+
"build:docs": "jsdoc2md --no-cache --files src/*.ts --configure jsdoc2md.json > API.md && node scripts/fix-api-docs.js",
|
|
90
|
+
"changeset": "changeset",
|
|
91
|
+
"changeset:version": "changeset version && pnpm install",
|
|
92
|
+
"changeset:publish": "changeset publish",
|
|
93
|
+
"typecheck": "tsc --noEmit",
|
|
94
|
+
"clean": "rimraf dist coverage",
|
|
95
|
+
"format": "prettier --cache --write .",
|
|
96
|
+
"format:check": "prettier --cache --check .",
|
|
97
|
+
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
|
98
|
+
"prebuild": "pnpm run --silent clean",
|
|
99
|
+
"size": "bundlewatch --config .bundlewatch.config.json",
|
|
100
|
+
"pretest": "pnpm run --silent build:package-info",
|
|
101
|
+
"test": "vitest run",
|
|
102
|
+
"pretest:coverage": "pnpm run --silent build:package-info",
|
|
103
|
+
"test:coverage": "vitest run --coverage",
|
|
104
|
+
"pretest:browser:open": "pnpm run --silent build:package-info && pnpm run --silent build:browser",
|
|
105
|
+
"test:browser:open": "playwright test --ui",
|
|
106
|
+
"pretest:browser:run": "pnpm run --silent build:package-info && pnpm run --silent build:browser",
|
|
107
|
+
"test:browser:run": "playwright test",
|
|
108
|
+
"pretest:watch": "pnpm run --silent build:package-info",
|
|
109
|
+
"test:watch": "vitest watch"
|
|
110
110
|
}
|
|
111
|
-
}
|
|
111
|
+
}
|