@pnpm/registry-access.client 1100.1.15 → 1100.1.17

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,24 @@
1
1
  # @pnpm/registry-access.client
2
2
 
3
+ ## 1100.1.17
4
+
5
+ ### Patch Changes
6
+
7
+ - `pnpm unpublish` now completes the two-factor authentication a registry asks for instead of failing with `ERR_PNPM_UNAUTHORIZED` while logged in. A 401 that is an OTP challenge starts the web-based authentication flow, or prompts for a classic one-time password. The obtained password is reused by every request of the run [#14464](https://github.com/pnpm/pnpm/issues/14464).
8
+
9
+ - Updated dependencies:
10
+ - @pnpm/error@1100.1.4
11
+ - @pnpm/network.fetch@1100.1.15
12
+ - @pnpm/network.web-auth@1101.6.0
13
+
14
+ ## 1100.1.16
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies:
19
+ - @pnpm/network.fetch@1100.1.14
20
+ - @pnpm/network.web-auth@1101.5.0
21
+
3
22
  ## 1100.1.15
4
23
 
5
24
  ### Patch Changes
package/lib/setDistTag.js CHANGED
@@ -17,34 +17,14 @@ export async function setDistTag(opts) {
17
17
  if (response.ok)
18
18
  return;
19
19
  const body = await response.text();
20
+ const action = `set dist-tag "${opts.distTag}" on`;
20
21
  if (response.status === 401) {
21
- throw parseAuthError(body, opts.distTag);
22
+ throw SyntheticOtpError.fromUnauthorizedBody(body) ??
23
+ new PnpmError('UNAUTHORIZED', `You must be logged in to ${action} packages. ${body}`);
22
24
  }
23
- const action = `set dist-tag "${opts.distTag}" on`;
24
25
  if (response.status === 403) {
25
26
  throw new PnpmError('FORBIDDEN', `You do not have permission to ${action} this package. ${body}`);
26
27
  }
27
28
  throw new PnpmError('REGISTRY_ERROR', `Failed to ${action} package: ${response.status} ${response.statusText}. ${body}`);
28
29
  }
29
- function parseAuthError(body, distTag) {
30
- const parsed = tryParseJson(body);
31
- if (parsed != null && typeof parsed === 'object' && 'authUrl' in parsed && 'doneUrl' in parsed) {
32
- return new SyntheticOtpError({
33
- authUrl: typeof parsed.authUrl === 'string' ? parsed.authUrl : undefined,
34
- doneUrl: typeof parsed.doneUrl === 'string' ? parsed.doneUrl : undefined,
35
- });
36
- }
37
- if (/one-time pass/i.test(body)) {
38
- return new SyntheticOtpError(undefined);
39
- }
40
- return new PnpmError('UNAUTHORIZED', `You must be logged in to set dist-tag "${distTag}" on packages. ${body}`);
41
- }
42
- function tryParseJson(body) {
43
- try {
44
- return JSON.parse(body);
45
- }
46
- catch {
47
- return undefined;
48
- }
49
- }
50
30
  //# sourceMappingURL=setDistTag.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/registry-access.client",
3
- "version": "1100.1.15",
3
+ "version": "1100.1.17",
4
4
  "description": "Low-level helpers for npm-registry HTTP endpoints (PUT dist-tag, PUT user, etc.)",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -27,13 +27,13 @@
27
27
  "!*.map"
28
28
  ],
29
29
  "dependencies": {
30
- "@pnpm/error": "1100.1.3",
31
- "@pnpm/network.fetch": "1100.1.13",
32
- "@pnpm/network.web-auth": "1101.4.3",
30
+ "@pnpm/error": "1100.1.4",
31
+ "@pnpm/network.fetch": "1100.1.15",
32
+ "@pnpm/network.web-auth": "1101.6.0",
33
33
  "@pnpm/npm-package-arg": "^2.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@pnpm/registry-access.client": "1100.1.15"
36
+ "@pnpm/registry-access.client": "1100.1.17"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22.13"