verdaccio 7.0.0-beta.4 → 7.0.0-beta.6
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/bin/verdaccio +1 -1
- package/build/api/endpoint/api/dist-tags.d.ts +3 -3
- package/build/api/endpoint/api/package.d.ts +4 -4
- package/build/api/endpoint/api/ping.d.ts +1 -1
- package/build/api/endpoint/api/publish.d.ts +5 -5
- package/build/api/endpoint/api/star.d.ts +3 -3
- package/build/api/endpoint/api/stars.d.ts +2 -2
- package/build/api/endpoint/api/user.d.ts +3 -3
- package/build/api/endpoint/api/v1/profile.d.ts +3 -3
- package/build/api/endpoint/api/v1/token.d.ts +4 -4
- package/build/api/endpoint/api/whoami.d.ts +1 -1
- package/build/api/endpoint/index.d.ts +4 -4
- package/build/api/index.d.ts +2 -2
- package/build/api/middleware.d.ts +2 -2
- package/build/api/web/api/index.d.ts +2 -1
- package/build/api/web/api/package.d.ts +3 -3
- package/build/api/web/api/search.d.ts +2 -2
- package/build/api/web/api/user.d.ts +2 -2
- package/build/api/web/index.d.ts +2 -3
- package/build/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/build/cjs/api/debug/index.cjs +25 -0
- package/build/cjs/api/debug/index.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/dist-tags.cjs +62 -0
- package/build/cjs/api/endpoint/api/dist-tags.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/package.cjs +95 -0
- package/build/cjs/api/endpoint/api/package.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/ping.cjs +16 -0
- package/build/cjs/api/endpoint/api/ping.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/publish.cjs +279 -0
- package/build/cjs/api/endpoint/api/publish.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/search.cjs +64 -0
- package/build/cjs/api/endpoint/api/search.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/star.cjs +62 -0
- package/build/cjs/api/endpoint/api/star.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/stars.cjs +42 -0
- package/build/cjs/api/endpoint/api/stars.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/user.cjs +70 -0
- package/build/cjs/api/endpoint/api/user.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/v1/profile.cjs +52 -0
- package/build/cjs/api/endpoint/api/v1/profile.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/v1/search.cjs +150 -0
- package/build/cjs/api/endpoint/api/v1/search.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/v1/token.cjs +108 -0
- package/build/cjs/api/endpoint/api/v1/token.cjs.map +1 -0
- package/build/cjs/api/endpoint/api/whoami.cjs +16 -0
- package/build/cjs/api/endpoint/api/whoami.cjs.map +1 -0
- package/build/cjs/api/endpoint/index.cjs +54 -0
- package/build/cjs/api/endpoint/index.cjs.map +1 -0
- package/build/cjs/api/index.cjs +85 -0
- package/build/cjs/api/index.cjs.map +1 -0
- package/build/cjs/api/middleware.cjs +60 -0
- package/build/cjs/api/middleware.cjs.map +1 -0
- package/build/cjs/api/web/api/index.cjs +28 -0
- package/build/cjs/api/web/api/index.cjs.map +1 -0
- package/build/cjs/api/web/api/package.cjs +201 -0
- package/build/cjs/api/web/api/package.cjs.map +1 -0
- package/build/cjs/api/web/api/search.cjs +41 -0
- package/build/cjs/api/web/api/search.cjs.map +1 -0
- package/build/cjs/api/web/api/user.cjs +53 -0
- package/build/cjs/api/web/api/user.cjs.map +1 -0
- package/build/cjs/api/web/api/utils.cjs +13 -0
- package/build/cjs/api/web/api/utils.cjs.map +1 -0
- package/build/cjs/api/web/index.cjs +84 -0
- package/build/cjs/api/web/index.cjs.map +1 -0
- package/build/cjs/index.cjs +58 -0
- package/build/cjs/lib/auth-utils.cjs +14 -0
- package/build/cjs/lib/auth-utils.cjs.map +1 -0
- package/build/cjs/lib/auth.cjs +11 -0
- package/build/cjs/lib/auth.cjs.map +1 -0
- package/build/cjs/lib/cli/cli.cjs +26 -0
- package/build/cjs/lib/cli/cli.cjs.map +1 -0
- package/build/cjs/lib/cli/commands/info.cjs +35 -0
- package/build/cjs/lib/cli/commands/info.cjs.map +1 -0
- package/build/cjs/lib/cli/commands/init.cjs +99 -0
- package/build/cjs/lib/cli/commands/init.cjs.map +1 -0
- package/build/cjs/lib/cli/commands/version.cjs +16 -0
- package/build/cjs/lib/cli/commands/version.cjs.map +1 -0
- package/build/cjs/lib/cli/utils.cjs +14 -0
- package/build/cjs/lib/cli/utils.cjs.map +1 -0
- package/build/cjs/lib/cli.cjs +13 -0
- package/build/cjs/lib/cli.cjs.map +1 -0
- package/build/cjs/lib/config.cjs +21 -0
- package/build/cjs/lib/config.cjs.map +1 -0
- package/build/cjs/lib/constants.cjs +120 -0
- package/build/cjs/lib/constants.cjs.map +1 -0
- package/build/cjs/lib/experiments.cjs +22 -0
- package/build/cjs/lib/experiments.cjs.map +1 -0
- package/build/cjs/lib/local-storage.cjs +579 -0
- package/build/cjs/lib/local-storage.cjs.map +1 -0
- package/build/cjs/lib/logger/index.cjs +26 -0
- package/build/cjs/lib/logger/index.cjs.map +1 -0
- package/build/cjs/lib/metadata-utils.cjs +27 -0
- package/build/cjs/lib/metadata-utils.cjs.map +1 -0
- package/build/cjs/lib/run-server.cjs +91 -0
- package/build/cjs/lib/run-server.cjs.map +1 -0
- package/build/cjs/lib/storage-utils.cjs +232 -0
- package/build/cjs/lib/storage-utils.cjs.map +1 -0
- package/build/cjs/lib/storage.cjs +476 -0
- package/build/cjs/lib/storage.cjs.map +1 -0
- package/build/cjs/lib/up-storage.cjs +30 -0
- package/build/cjs/lib/uplink-util.cjs +15 -0
- package/build/cjs/lib/utils.cjs +207 -0
- package/build/cjs/lib/utils.cjs.map +1 -0
- package/build/cjs/types/index.cjs +1 -0
- package/build/esm/api/debug/index.mjs +19 -0
- package/build/esm/api/debug/index.mjs.map +1 -0
- package/build/esm/api/endpoint/api/dist-tags.mjs +55 -0
- package/build/esm/api/endpoint/api/dist-tags.mjs.map +1 -0
- package/build/esm/api/endpoint/api/package.mjs +89 -0
- package/build/esm/api/endpoint/api/package.mjs.map +1 -0
- package/build/esm/api/endpoint/api/ping.mjs +11 -0
- package/build/esm/api/endpoint/api/ping.mjs.map +1 -0
- package/build/esm/api/endpoint/api/publish.mjs +266 -0
- package/build/esm/api/endpoint/api/publish.mjs.map +1 -0
- package/build/esm/api/endpoint/api/search.mjs +58 -0
- package/build/esm/api/endpoint/api/search.mjs.map +1 -0
- package/build/esm/api/endpoint/api/star.mjs +54 -0
- package/build/esm/api/endpoint/api/star.mjs.map +1 -0
- package/build/esm/api/endpoint/api/stars.mjs +35 -0
- package/build/esm/api/endpoint/api/stars.mjs.map +1 -0
- package/build/esm/api/endpoint/api/user.mjs +63 -0
- package/build/esm/api/endpoint/api/user.mjs.map +1 -0
- package/build/esm/api/endpoint/api/v1/profile.mjs +46 -0
- package/build/esm/api/endpoint/api/v1/profile.mjs.map +1 -0
- package/build/esm/api/endpoint/api/v1/search.mjs +142 -0
- package/build/esm/api/endpoint/api/v1/search.mjs.map +1 -0
- package/build/esm/api/endpoint/api/v1/token.mjs +101 -0
- package/build/esm/api/endpoint/api/v1/token.mjs.map +1 -0
- package/build/esm/api/endpoint/api/whoami.mjs +11 -0
- package/build/esm/api/endpoint/api/whoami.mjs.map +1 -0
- package/build/esm/api/endpoint/index.mjs +48 -0
- package/build/esm/api/endpoint/index.mjs.map +1 -0
- package/build/esm/api/index.mjs +76 -0
- package/build/esm/api/index.mjs.map +1 -0
- package/build/esm/api/middleware.mjs +53 -0
- package/build/esm/api/middleware.mjs.map +1 -0
- package/build/esm/api/web/api/index.mjs +23 -0
- package/build/esm/api/web/api/index.mjs.map +1 -0
- package/build/esm/api/web/api/package.mjs +195 -0
- package/build/esm/api/web/api/package.mjs.map +1 -0
- package/build/esm/api/web/api/search.mjs +36 -0
- package/build/esm/api/web/api/search.mjs.map +1 -0
- package/build/esm/api/web/api/user.mjs +47 -0
- package/build/esm/api/web/api/user.mjs.map +1 -0
- package/build/esm/api/web/api/utils.mjs +11 -0
- package/build/esm/api/web/api/utils.mjs.map +1 -0
- package/build/esm/api/web/index.mjs +70 -0
- package/build/esm/api/web/index.mjs.map +1 -0
- package/build/esm/index.mjs +4 -0
- package/build/esm/lib/auth-utils.mjs +11 -0
- package/build/esm/lib/auth-utils.mjs.map +1 -0
- package/build/esm/lib/auth.mjs +7 -0
- package/build/esm/lib/auth.mjs.map +1 -0
- package/build/esm/lib/cli/cli.mjs +24 -0
- package/build/esm/lib/cli/cli.mjs.map +1 -0
- package/build/esm/lib/cli/commands/info.mjs +32 -0
- package/build/esm/lib/cli/commands/info.mjs.map +1 -0
- package/build/esm/lib/cli/commands/init.mjs +93 -0
- package/build/esm/lib/cli/commands/init.mjs.map +1 -0
- package/build/esm/lib/cli/commands/version.mjs +14 -0
- package/build/esm/lib/cli/commands/version.mjs.map +1 -0
- package/build/esm/lib/cli/utils.mjs +10 -0
- package/build/esm/lib/cli/utils.mjs.map +1 -0
- package/build/esm/lib/cli.mjs +12 -0
- package/build/esm/lib/cli.mjs.map +1 -0
- package/build/esm/lib/config.mjs +16 -0
- package/build/esm/lib/config.mjs.map +1 -0
- package/build/esm/lib/constants.mjs +29 -0
- package/build/esm/lib/constants.mjs.map +1 -0
- package/build/esm/lib/experiments.mjs +20 -0
- package/build/esm/lib/experiments.mjs.map +1 -0
- package/build/esm/lib/local-storage.mjs +571 -0
- package/build/esm/lib/local-storage.mjs.map +1 -0
- package/build/esm/lib/logger/index.mjs +17 -0
- package/build/esm/lib/logger/index.mjs.map +1 -0
- package/build/esm/lib/metadata-utils.mjs +23 -0
- package/build/esm/lib/metadata-utils.mjs.map +1 -0
- package/build/esm/lib/run-server.mjs +82 -0
- package/build/esm/lib/run-server.mjs.map +1 -0
- package/build/esm/lib/storage-utils.mjs +214 -0
- package/build/esm/lib/storage-utils.mjs.map +1 -0
- package/build/esm/lib/storage.mjs +465 -0
- package/build/esm/lib/storage.mjs.map +1 -0
- package/build/esm/lib/up-storage.mjs +2 -0
- package/build/esm/lib/uplink-util.mjs +2 -0
- package/build/esm/lib/utils.mjs +181 -0
- package/build/esm/lib/utils.mjs.map +1 -0
- package/build/esm/types/index.mjs +0 -0
- package/build/index.d.ts +1 -2
- package/build/lib/cli/commands/init.d.ts +1 -1
- package/build/lib/cli.d.ts +0 -2
- package/build/lib/constants.d.ts +13 -1
- package/build/lib/logger/index.d.ts +1 -1
- package/build/lib/storage-utils.d.ts +1 -1
- package/build/lib/storage.d.ts +5 -13
- package/build/lib/up-storage.d.ts +2 -138
- package/build/lib/uplink-util.d.ts +1 -7
- package/build/lib/utils.d.ts +5 -6
- package/build/types/index.d.ts +59 -0
- package/index.js +1 -1
- package/package.json +53 -61
- package/types/custom.d.ts +13 -0
- package/vite.config.ts +68 -0
- package/build/cjs/api/debug/index.js +0 -28
- package/build/cjs/api/endpoint/api/dist-tags.js +0 -77
- package/build/cjs/api/endpoint/api/package.js +0 -103
- package/build/cjs/api/endpoint/api/ping.js +0 -13
- package/build/cjs/api/endpoint/api/publish.js +0 -359
- package/build/cjs/api/endpoint/api/search.js +0 -107
- package/build/cjs/api/endpoint/api/star.js +0 -73
- package/build/cjs/api/endpoint/api/stars.js +0 -42
- package/build/cjs/api/endpoint/api/user.js +0 -84
- package/build/cjs/api/endpoint/api/v1/profile.js +0 -69
- package/build/cjs/api/endpoint/api/v1/search.js +0 -181
- package/build/cjs/api/endpoint/api/v1/token.js +0 -140
- package/build/cjs/api/endpoint/api/whoami.js +0 -15
- package/build/cjs/api/endpoint/index.js +0 -58
- package/build/cjs/api/index.js +0 -105
- package/build/cjs/api/middleware.js +0 -56
- package/build/cjs/api/web/api/index.js +0 -31
- package/build/cjs/api/web/api/package.js +0 -165
- package/build/cjs/api/web/api/search.js +0 -53
- package/build/cjs/api/web/api/user.js +0 -70
- package/build/cjs/api/web/api/utils.js +0 -14
- package/build/cjs/api/web/html/favicon.ico +0 -0
- package/build/cjs/api/web/index.js +0 -96
- package/build/cjs/index.js +0 -76
- package/build/cjs/lib/auth-utils.js +0 -16
- package/build/cjs/lib/auth.js +0 -9
- package/build/cjs/lib/bootstrap.js +0 -167
- package/build/cjs/lib/cli/cli.js +0 -26
- package/build/cjs/lib/cli/commands/info.js +0 -26
- package/build/cjs/lib/cli/commands/init.js +0 -78
- package/build/cjs/lib/cli/commands/version.js +0 -17
- package/build/cjs/lib/cli/utils.js +0 -14
- package/build/cjs/lib/cli.js +0 -16
- package/build/cjs/lib/config.js +0 -22
- package/build/cjs/lib/constants.js +0 -121
- package/build/cjs/lib/experiments.js +0 -29
- package/build/cjs/lib/local-storage.js +0 -740
- package/build/cjs/lib/logger/index.js +0 -21
- package/build/cjs/lib/metadata-utils.js +0 -39
- package/build/cjs/lib/run-server.js +0 -122
- package/build/cjs/lib/storage-utils.js +0 -282
- package/build/cjs/lib/storage.js +0 -615
- package/build/cjs/lib/up-storage.js +0 -605
- package/build/cjs/lib/uplink-util.js +0 -36
- package/build/cjs/lib/utils.js +0 -265
- package/build/cjs/package.json +0 -1
- package/build/esm/api/debug/index.js +0 -20
- package/build/esm/api/endpoint/api/dist-tags.js +0 -70
- package/build/esm/api/endpoint/api/package.js +0 -96
- package/build/esm/api/endpoint/api/ping.js +0 -7
- package/build/esm/api/endpoint/api/publish.js +0 -347
- package/build/esm/api/endpoint/api/search.js +0 -101
- package/build/esm/api/endpoint/api/star.js +0 -66
- package/build/esm/api/endpoint/api/stars.js +0 -35
- package/build/esm/api/endpoint/api/user.js +0 -77
- package/build/esm/api/endpoint/api/v1/profile.js +0 -62
- package/build/esm/api/endpoint/api/v1/search.js +0 -174
- package/build/esm/api/endpoint/api/v1/token.js +0 -133
- package/build/esm/api/endpoint/api/whoami.js +0 -9
- package/build/esm/api/endpoint/index.js +0 -51
- package/build/esm/api/index.js +0 -98
- package/build/esm/api/middleware.js +0 -49
- package/build/esm/api/web/api/index.js +0 -23
- package/build/esm/api/web/api/package.js +0 -158
- package/build/esm/api/web/api/search.js +0 -47
- package/build/esm/api/web/api/user.js +0 -63
- package/build/esm/api/web/api/utils.js +0 -7
- package/build/esm/api/web/html/favicon.ico +0 -0
- package/build/esm/api/web/index.js +0 -84
- package/build/esm/index.js +0 -5
- package/build/esm/lib/auth-utils.js +0 -9
- package/build/esm/lib/auth.js +0 -3
- package/build/esm/lib/bootstrap.js +0 -160
- package/build/esm/lib/cli/cli.js +0 -24
- package/build/esm/lib/cli/commands/info.js +0 -18
- package/build/esm/lib/cli/commands/init.js +0 -70
- package/build/esm/lib/cli/commands/version.js +0 -10
- package/build/esm/lib/cli/utils.js +0 -6
- package/build/esm/lib/cli.js +0 -13
- package/build/esm/lib/config.js +0 -16
- package/build/esm/lib/constants.js +0 -26
- package/build/esm/lib/experiments.js +0 -23
- package/build/esm/lib/local-storage.js +0 -734
- package/build/esm/lib/logger/index.js +0 -14
- package/build/esm/lib/metadata-utils.js +0 -32
- package/build/esm/lib/run-server.js +0 -114
- package/build/esm/lib/storage-utils.js +0 -261
- package/build/esm/lib/storage.js +0 -607
- package/build/esm/lib/up-storage.js +0 -598
- package/build/esm/lib/uplink-util.js +0 -28
- package/build/esm/lib/utils.js +0 -228
- package/build/esm/package.json +0 -1
- package/build/lib/bootstrap.d.ts +0 -22
package/bin/verdaccio
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { default as Auth } from '../../../lib/auth';
|
|
3
|
+
import { default as Storage } from '../../../lib/storage';
|
|
4
4
|
export default function (route: Router, auth: Auth, storage: Storage): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { Config } from '@verdaccio/types';
|
|
3
|
+
import { default as Auth } from '../../../lib/auth';
|
|
4
|
+
import { default as Storage } from '../../../lib/storage';
|
|
5
5
|
export default function (route: Router, auth: Auth, storage: Storage, config: Config): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
2
|
export default function (route: Router): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { Config } from '@verdaccio/types';
|
|
3
|
+
import { default as Auth } from '../../../lib/auth';
|
|
4
|
+
import { default as Storage } from '../../../lib/storage';
|
|
5
|
+
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../../types';
|
|
6
6
|
export default function publish(router: Router, auth: Auth, storage: Storage, config: Config): void;
|
|
7
7
|
/**
|
|
8
8
|
* Publish a package
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { default as Storage } from '../../../lib/storage';
|
|
3
|
+
import { $NextFunctionVer, $RequestExtend } from '../../../types';
|
|
4
4
|
export default function (storage: Storage): (req: $RequestExtend, res: Response, next: $NextFunctionVer) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { default as Storage } from '../../../lib/storage';
|
|
3
3
|
export default function (route: Router, storage: Storage): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { Config } from '@verdaccio/types';
|
|
3
|
+
import { default as Auth } from '../../../lib/auth';
|
|
4
4
|
export default function (route: Router, auth: Auth, config: Config): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { ConfigYaml } from '@verdaccio/types';
|
|
3
|
+
import { default as Auth } from '../../../../lib/auth';
|
|
4
4
|
export interface Profile {
|
|
5
5
|
tfa: boolean;
|
|
6
6
|
name: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { Config, Token } from '@verdaccio/types';
|
|
3
|
+
import { default as Auth } from '../../../../lib/auth';
|
|
4
|
+
import { default as Storage } from '../../../../lib/storage';
|
|
5
5
|
export type NormalizeToken = Token & {
|
|
6
6
|
created: string;
|
|
7
7
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Router } from 'express';
|
|
2
2
|
export default function (route: Router): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
export default function (config: Config, auth: Auth, storage: Storage):
|
|
1
|
+
import { Config } from '@verdaccio/types';
|
|
2
|
+
import { default as Auth } from '../../lib/auth';
|
|
3
|
+
import { default as Storage } from '../../lib/storage';
|
|
4
|
+
export default function (config: Config, auth: Auth, storage: Storage): any;
|
package/build/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
import
|
|
1
|
+
import { default as express } from 'express';
|
|
2
|
+
import { ConfigYaml } from '@verdaccio/types';
|
|
3
3
|
declare const _default: (configHash: ConfigYaml) => Promise<express.Application>;
|
|
4
4
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Config } from '@verdaccio/types';
|
|
2
|
+
import { $RequestExtend, $ResponseExtend } from '../types';
|
|
3
3
|
export declare function serveFavicon(config: Config): (_req: $RequestExtend, res: $ResponseExtend) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { Config, Manifest } from '@verdaccio/types';
|
|
3
|
+
import { default as Auth } from '../../../lib/auth';
|
|
4
|
+
import { default as Storage } from '../../../lib/storage';
|
|
5
5
|
export type PackcageExt = Manifest & {
|
|
6
6
|
author: any;
|
|
7
7
|
dist?: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { default as Auth } from '../../../lib/auth';
|
|
3
|
+
import { default as Storage } from '../../../lib/storage';
|
|
4
4
|
declare function addSearchWebApi(storage: Storage, auth: Auth): Router;
|
|
5
5
|
export default addSearchWebApi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { Config } from '@verdaccio/types';
|
|
3
|
+
import { default as Auth } from '../../../lib/auth';
|
|
4
4
|
declare function addUserAuthApi(auth: Auth, config: Config): Router;
|
|
5
5
|
export default addUserAuthApi;
|
package/build/api/web/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Router } from 'express';
|
|
1
|
+
import { RequestHandler, Router } from 'express';
|
|
3
2
|
export declare const PLUGIN_UI_PREFIX = "verdaccio-theme";
|
|
4
3
|
export declare const DEFAULT_PLUGIN_UI_THEME = "@verdaccio/ui-theme";
|
|
5
4
|
export declare function loadTheme(config: any): Promise<any>;
|
|
6
5
|
export declare function webAPIMiddleware(tokenMiddleware: RequestHandler, webEndpointsApi: RequestHandler): Router;
|
|
7
6
|
export declare function webMiddleware(config: any, middlewares: any, pluginOptions: any): any;
|
|
8
|
-
declare const _default: (config: any, auth: any, storage: any, logger: any) => Promise<
|
|
7
|
+
declare const _default: (config: any, auth: any, storage: any, logger: any) => Promise<Router>;
|
|
9
8
|
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
let lodash_es = require("lodash-es");
|
|
7
|
+
lodash_es = require_runtime.__toESM(lodash_es);
|
|
8
|
+
//#region src/api/debug/index.ts
|
|
9
|
+
var debug_default = (app, selfPath) => {
|
|
10
|
+
app.get("/-/_debug", function(req, res, next) {
|
|
11
|
+
const doGarbabeCollector = lodash_es.isNil(global.gc) === false;
|
|
12
|
+
if (doGarbabeCollector) global.gc();
|
|
13
|
+
next({
|
|
14
|
+
pid: process.pid,
|
|
15
|
+
main: process.mainModule.filename,
|
|
16
|
+
conf: selfPath,
|
|
17
|
+
mem: process.memoryUsage(),
|
|
18
|
+
gc: doGarbabeCollector
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.default = debug_default;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/api/debug/index.ts"],"sourcesContent":["import { Application } from 'express';\nimport * as _ from 'lodash-es';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../types';\n\nexport default (app: Application, selfPath: string): void => {\n // Hook for tests only\n app.get(\n '/-/_debug',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n const doGarbabeCollector = _.isNil(global.gc) === false;\n\n if (doGarbabeCollector) {\n // @ts-ignore\n global.gc();\n }\n\n next({\n pid: process.pid,\n // @ts-ignore\n main: process.mainModule.filename,\n conf: selfPath,\n mem: process.memoryUsage(),\n gc: doGarbabeCollector,\n });\n }\n );\n};\n"],"mappings":";;;;;;;;AAKA,IAAA,iBAAgB,KAAkB,aAA2B;AAE3D,KAAI,IACF,aACA,SAAU,KAAqB,KAAsB,MAA8B;EACjF,MAAM,qBAAqB,UAAE,MAAM,OAAO,GAAG,KAAK;AAElD,MAAI,mBAEF,QAAO,IAAI;AAGb,OAAK;GACH,KAAK,QAAQ;GAEb,MAAM,QAAQ,WAAW;GACzB,MAAM;GACN,KAAK,QAAQ,aAAa;GAC1B,IAAI;GACL,CAAC;GAEL"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
const require_lib_constants = require("../../../lib/constants.cjs");
|
|
7
|
+
const require_lib_logger_index = require("../../../lib/logger/index.cjs");
|
|
8
|
+
let lodash_es = require("lodash-es");
|
|
9
|
+
lodash_es = require_runtime.__toESM(lodash_es);
|
|
10
|
+
let _verdaccio_middleware = require("@verdaccio/middleware");
|
|
11
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
12
|
+
//#region src/api/endpoint/api/dist-tags.ts
|
|
13
|
+
function dist_tags_default(route, auth, storage) {
|
|
14
|
+
const can = (0, _verdaccio_middleware.allow)(auth, {
|
|
15
|
+
beforeAll: (params, message) => require_lib_logger_index.logger.trace(params, message),
|
|
16
|
+
afterAll: (params, message) => require_lib_logger_index.logger.trace(params, message)
|
|
17
|
+
});
|
|
18
|
+
const tag_package_version = function(req, res, next) {
|
|
19
|
+
if (lodash_es.isString(req.body) === false) return next("route");
|
|
20
|
+
const tags = {};
|
|
21
|
+
tags[req.params.tag] = req.body;
|
|
22
|
+
storage.mergeTags(req.params.package, tags, function(err) {
|
|
23
|
+
if (err) return next(err);
|
|
24
|
+
res.status(_verdaccio_core.HTTP_STATUS.CREATED);
|
|
25
|
+
return next({ ok: _verdaccio_core.API_MESSAGE.TAG_ADDED });
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
route.put(_verdaccio_middleware.DIST_TAGS_API_ENDPOINTS.tagging, can("publish"), (0, _verdaccio_middleware.media)("application/json"), tag_package_version);
|
|
29
|
+
route.post(_verdaccio_middleware.DIST_TAGS_API_ENDPOINTS.tagging_package, can("publish"), (0, _verdaccio_middleware.media)("application/json"), tag_package_version);
|
|
30
|
+
route.put(_verdaccio_middleware.DIST_TAGS_API_ENDPOINTS.tagging_package, can("publish"), (0, _verdaccio_middleware.media)("application/json"), tag_package_version);
|
|
31
|
+
route.delete(_verdaccio_middleware.DIST_TAGS_API_ENDPOINTS.tagging_package, can("publish"), function(req, res, next) {
|
|
32
|
+
const tags = {};
|
|
33
|
+
tags[req.params.tag] = null;
|
|
34
|
+
storage.mergeTags(req.params.package, tags, function(err) {
|
|
35
|
+
if (err) return next(err);
|
|
36
|
+
res.status(_verdaccio_core.HTTP_STATUS.CREATED);
|
|
37
|
+
return next({ ok: _verdaccio_core.API_MESSAGE.TAG_REMOVED });
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
route.get(_verdaccio_middleware.DIST_TAGS_API_ENDPOINTS.get_dist_tags, can("access"), function(req, res, next) {
|
|
41
|
+
storage.getPackage({
|
|
42
|
+
name: req.params.package,
|
|
43
|
+
uplinksLook: true,
|
|
44
|
+
req,
|
|
45
|
+
callback: function(err, info) {
|
|
46
|
+
if (err) return next(err);
|
|
47
|
+
next(info[require_lib_constants.DIST_TAGS]);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
route.post(_verdaccio_middleware.DIST_TAGS_API_ENDPOINTS.get_dist_tags, can("publish"), function(req, res, next) {
|
|
52
|
+
storage.mergeTags(req.params.package, req.body, function(err) {
|
|
53
|
+
if (err) return next(err);
|
|
54
|
+
res.status(_verdaccio_core.HTTP_STATUS.CREATED);
|
|
55
|
+
return next({ ok: _verdaccio_core.API_MESSAGE.TAG_UPDATED });
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.default = dist_tags_default;
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=dist-tags.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-tags.cjs","names":[],"sources":["../../../../../src/api/endpoint/api/dist-tags.ts"],"sourcesContent":["import type { Router } from 'express';\nimport * as _ from 'lodash-es';\n\nimport { DIST_TAGS_API_ENDPOINTS, allow, media } from '@verdaccio/middleware';\nimport type { Package } from '@verdaccio/types';\n\nimport type Auth from '../../../lib/auth';\nimport { API_MESSAGE, DIST_TAGS, HTTP_STATUS } from '../../../lib/constants';\nimport { logger } from '../../../lib/logger';\nimport type Storage from '../../../lib/storage';\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../../types';\n\nexport default function (route: Router, auth: Auth, storage: Storage): void {\n const can = allow(auth, {\n beforeAll: (params, message) => logger.trace(params, message),\n afterAll: (params, message) => logger.trace(params, message),\n });\n const tag_package_version = function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): $NextFunctionVer {\n if (_.isString(req.body) === false) {\n return next('route');\n }\n\n const tags = {};\n tags[req.params.tag] = req.body;\n storage.mergeTags(req.params.package, tags, function (err: Error): $NextFunctionVer {\n if (err) {\n return next(err);\n }\n res.status(HTTP_STATUS.CREATED);\n return next({ ok: API_MESSAGE.TAG_ADDED });\n });\n };\n\n // tagging a package\n route.put(\n DIST_TAGS_API_ENDPOINTS.tagging,\n can('publish'),\n media('application/json'),\n tag_package_version\n );\n\n route.post(\n DIST_TAGS_API_ENDPOINTS.tagging_package,\n can('publish'),\n media('application/json'),\n tag_package_version\n );\n\n route.put(\n DIST_TAGS_API_ENDPOINTS.tagging_package,\n can('publish'),\n media('application/json'),\n tag_package_version\n );\n\n route.delete(\n DIST_TAGS_API_ENDPOINTS.tagging_package,\n can('publish'),\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n const tags = {};\n tags[req.params.tag] = null;\n storage.mergeTags(req.params.package, tags, function (err: any): $NextFunctionVer {\n if (err) {\n return next(err);\n }\n res.status(HTTP_STATUS.CREATED);\n return next({\n ok: API_MESSAGE.TAG_REMOVED,\n });\n });\n }\n );\n\n route.get(\n DIST_TAGS_API_ENDPOINTS.get_dist_tags,\n can('access'),\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n storage.getPackage({\n name: req.params.package,\n uplinksLook: true,\n req,\n callback: function (err: any, info: Package): $NextFunctionVer {\n if (err) {\n return next(err);\n }\n\n next(info[DIST_TAGS]);\n },\n });\n }\n );\n\n route.post(\n DIST_TAGS_API_ENDPOINTS.get_dist_tags,\n can('publish'),\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n storage.mergeTags(req.params.package, req.body, function (err: any): $NextFunctionVer {\n if (err) {\n return next(err);\n }\n res.status(HTTP_STATUS.CREATED);\n return next({\n ok: API_MESSAGE.TAG_UPDATED,\n });\n });\n }\n );\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAA,kBAAyB,OAAe,MAAY,SAAwB;CAC1E,MAAM,OAAA,GAAA,sBAAA,OAAY,MAAM;EACtB,YAAY,QAAQ,YAAY,yBAAA,OAAO,MAAM,QAAQ,QAAQ;EAC7D,WAAW,QAAQ,YAAY,yBAAA,OAAO,MAAM,QAAQ,QAAQ;EAC7D,CAAC;CACF,MAAM,sBAAsB,SAC1B,KACA,KACA,MACkB;AAClB,MAAI,UAAE,SAAS,IAAI,KAAK,KAAK,MAC3B,QAAO,KAAK,QAAQ;EAGtB,MAAM,OAAO,EAAE;AACf,OAAK,IAAI,OAAO,OAAO,IAAI;AAC3B,UAAQ,UAAU,IAAI,OAAO,SAAS,MAAM,SAAU,KAA8B;AAClF,OAAI,IACF,QAAO,KAAK,IAAI;AAElB,OAAI,OAAO,gBAAA,YAAY,QAAQ;AAC/B,UAAO,KAAK,EAAE,IAAI,gBAAA,YAAY,WAAW,CAAC;IAC1C;;AAIJ,OAAM,IACJ,sBAAA,wBAAwB,SACxB,IAAI,UAAU,GAAA,GAAA,sBAAA,OACR,mBAAmB,EACzB,oBACD;AAED,OAAM,KACJ,sBAAA,wBAAwB,iBACxB,IAAI,UAAU,GAAA,GAAA,sBAAA,OACR,mBAAmB,EACzB,oBACD;AAED,OAAM,IACJ,sBAAA,wBAAwB,iBACxB,IAAI,UAAU,GAAA,GAAA,sBAAA,OACR,mBAAmB,EACzB,oBACD;AAED,OAAM,OACJ,sBAAA,wBAAwB,iBACxB,IAAI,UAAU,EACd,SAAU,KAAqB,KAAsB,MAA8B;EACjF,MAAM,OAAO,EAAE;AACf,OAAK,IAAI,OAAO,OAAO;AACvB,UAAQ,UAAU,IAAI,OAAO,SAAS,MAAM,SAAU,KAA4B;AAChF,OAAI,IACF,QAAO,KAAK,IAAI;AAElB,OAAI,OAAO,gBAAA,YAAY,QAAQ;AAC/B,UAAO,KAAK,EACV,IAAI,gBAAA,YAAY,aACjB,CAAC;IACF;GAEL;AAED,OAAM,IACJ,sBAAA,wBAAwB,eACxB,IAAI,SAAS,EACb,SAAU,KAAqB,KAAsB,MAA8B;AACjF,UAAQ,WAAW;GACjB,MAAM,IAAI,OAAO;GACjB,aAAa;GACb;GACA,UAAU,SAAU,KAAU,MAAiC;AAC7D,QAAI,IACF,QAAO,KAAK,IAAI;AAGlB,SAAK,KAAK,sBAAA,WAAW;;GAExB,CAAC;GAEL;AAED,OAAM,KACJ,sBAAA,wBAAwB,eACxB,IAAI,UAAU,EACd,SAAU,KAAqB,KAAsB,MAA8B;AACjF,UAAQ,UAAU,IAAI,OAAO,SAAS,IAAI,MAAM,SAAU,KAA4B;AACpF,OAAI,IACF,QAAO,KAAK,IAAI;AAElB,OAAI,OAAO,gBAAA,YAAY,QAAQ;AAC/B,UAAO,KAAK,EACV,IAAI,gBAAA,YAAY,aACjB,CAAC;IACF;GAEL"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
const require_lib_constants = require("../../../lib/constants.cjs");
|
|
7
|
+
const require_lib_logger_index = require("../../../lib/logger/index.cjs");
|
|
8
|
+
const require_lib_utils = require("../../../lib/utils.cjs");
|
|
9
|
+
let lodash_es = require("lodash-es");
|
|
10
|
+
lodash_es = require_runtime.__toESM(lodash_es);
|
|
11
|
+
let _verdaccio_middleware = require("@verdaccio/middleware");
|
|
12
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
13
|
+
let _verdaccio_tarball = require("@verdaccio/tarball");
|
|
14
|
+
//#region src/api/endpoint/api/package.ts
|
|
15
|
+
var downloadStream = (packageName, filename, storage, req, res) => {
|
|
16
|
+
const stream = storage.getTarball(packageName, filename);
|
|
17
|
+
stream.on("content-length", function(content) {
|
|
18
|
+
res.header("Content-Length", content);
|
|
19
|
+
});
|
|
20
|
+
stream.on("error", function(err) {
|
|
21
|
+
return res.locals.report_error(err);
|
|
22
|
+
});
|
|
23
|
+
res.header(_verdaccio_core.HEADERS.CONTENT_TYPE, _verdaccio_core.HEADERS.OCTET_STREAM);
|
|
24
|
+
stream.pipe(res);
|
|
25
|
+
};
|
|
26
|
+
var redirectOrDownloadStream = (packageName, filename, storage, req, res, config) => {
|
|
27
|
+
const tarballUrlRedirect = lodash_es.get(config, "experiments.tarball_url_redirect");
|
|
28
|
+
storage.hasLocalTarball(packageName, filename).then((hasLocalTarball) => {
|
|
29
|
+
if (hasLocalTarball) {
|
|
30
|
+
const context = {
|
|
31
|
+
packageName,
|
|
32
|
+
filename
|
|
33
|
+
};
|
|
34
|
+
const tarballUrl = typeof tarballUrlRedirect === "function" ? tarballUrlRedirect(context) : lodash_es.template(tarballUrlRedirect)(context);
|
|
35
|
+
res.redirect(tarballUrl);
|
|
36
|
+
} else downloadStream(packageName, filename, storage, req, res);
|
|
37
|
+
}).catch((err) => {
|
|
38
|
+
res.locals.report_error(err);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
function package_default(route, auth, storage, config) {
|
|
42
|
+
const can = (0, _verdaccio_middleware.allow)(auth, {
|
|
43
|
+
beforeAll: (params, message) => require_lib_logger_index.logger.trace(params, message),
|
|
44
|
+
afterAll: (params, message) => require_lib_logger_index.logger.trace(params, message)
|
|
45
|
+
});
|
|
46
|
+
route.get(_verdaccio_middleware.PACKAGE_API_ENDPOINTS.get_package_by_version, can("access"), function(req, res, next) {
|
|
47
|
+
const abbreviated = _verdaccio_core.stringUtils.getByQualityPriorityValue(req.get("Accept")) === "application/vnd.npm.install-v1+json";
|
|
48
|
+
const getPackageMetaCallback = function(err, metadata) {
|
|
49
|
+
if (err) return next(err);
|
|
50
|
+
metadata = (0, _verdaccio_tarball.convertDistRemoteToLocalTarballUrls)(metadata, {
|
|
51
|
+
protocol: req.protocol,
|
|
52
|
+
headers: req.headers,
|
|
53
|
+
host: req.hostname,
|
|
54
|
+
remoteAddress: req.socket.remoteAddress
|
|
55
|
+
}, config.url_prefix);
|
|
56
|
+
let queryVersion = req.params.version;
|
|
57
|
+
if (lodash_es.isNil(queryVersion)) {
|
|
58
|
+
if (abbreviated) res.setHeader(_verdaccio_core.HEADERS.CONTENT_TYPE, "application/vnd.npm.install-v1+json");
|
|
59
|
+
else res.setHeader(_verdaccio_core.HEADERS.CONTENT_TYPE, _verdaccio_core.HEADERS.JSON);
|
|
60
|
+
return next(metadata);
|
|
61
|
+
}
|
|
62
|
+
let version = require_lib_utils.getVersion(metadata, queryVersion);
|
|
63
|
+
if (lodash_es.isNil(version) === false) {
|
|
64
|
+
res.setHeader(_verdaccio_core.HEADERS.CONTENT_TYPE, _verdaccio_core.HEADERS.JSON);
|
|
65
|
+
return next(version);
|
|
66
|
+
}
|
|
67
|
+
if (lodash_es.isNil(metadata["dist-tags"]) === false) {
|
|
68
|
+
if (lodash_es.isNil(metadata["dist-tags"][queryVersion]) === false) {
|
|
69
|
+
queryVersion = metadata[require_lib_constants.DIST_TAGS][queryVersion];
|
|
70
|
+
version = require_lib_utils.getVersion(metadata, queryVersion);
|
|
71
|
+
if (lodash_es.isNil(version) === false) {
|
|
72
|
+
res.setHeader(_verdaccio_core.HEADERS.CONTENT_TYPE, _verdaccio_core.HEADERS.JSON);
|
|
73
|
+
return next(version);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return next(require_lib_utils.ErrorCode.getNotFound(`${_verdaccio_core.API_ERROR.VERSION_NOT_EXIST}: ${req.params.version}`));
|
|
78
|
+
};
|
|
79
|
+
storage.getPackage({
|
|
80
|
+
name: req.params.package,
|
|
81
|
+
uplinksLook: true,
|
|
82
|
+
req,
|
|
83
|
+
abbreviated,
|
|
84
|
+
callback: getPackageMetaCallback
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
route.get(_verdaccio_middleware.PACKAGE_API_ENDPOINTS.get_package_tarball, can("access"), function(req, res) {
|
|
88
|
+
if (lodash_es.get(config, "experiments.tarball_url_redirect") === void 0) downloadStream(req.params.package, req.params.filename, storage, req, res);
|
|
89
|
+
else redirectOrDownloadStream(req.params.package, req.params.filename, storage, req, res, config);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
exports.default = package_default;
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=package.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.cjs","names":[],"sources":["../../../../../src/api/endpoint/api/package.ts"],"sourcesContent":["import type { Router } from 'express';\nimport * as _ from 'lodash-es';\n\nimport { stringUtils } from '@verdaccio/core';\nimport { PACKAGE_API_ENDPOINTS, allow } from '@verdaccio/middleware';\nimport { convertDistRemoteToLocalTarballUrls } from '@verdaccio/tarball';\nimport type { Config, Manifest } from '@verdaccio/types';\n\nimport type Auth from '../../../lib/auth';\nimport { API_ERROR, DIST_TAGS, HEADERS } from '../../../lib/constants';\nimport { logger } from '../../../lib/logger';\nimport type Storage from '../../../lib/storage';\nimport { ErrorCode, getVersion } from '../../../lib/utils';\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../../types';\n\nconst downloadStream = (\n packageName: string,\n filename: string,\n storage: any,\n req: $RequestExtend,\n res: $ResponseExtend\n): void => {\n const stream = storage.getTarball(packageName, filename);\n\n stream.on('content-length', function (content): void {\n res.header('Content-Length', content);\n });\n\n stream.on('error', function (err): void {\n return res.locals.report_error(err);\n });\n\n res.header(HEADERS.CONTENT_TYPE, HEADERS.OCTET_STREAM);\n stream.pipe(res);\n};\n\nconst redirectOrDownloadStream = (\n packageName: string,\n filename: string,\n storage: any,\n req: $RequestExtend,\n res: $ResponseExtend,\n config: Config\n): void => {\n const tarballUrlRedirect = _.get(config, 'experiments.tarball_url_redirect');\n storage\n .hasLocalTarball(packageName, filename)\n .then((hasLocalTarball) => {\n if (hasLocalTarball) {\n const context = { packageName, filename };\n const tarballUrl =\n typeof tarballUrlRedirect === 'function'\n ? tarballUrlRedirect(context)\n : _.template(tarballUrlRedirect)(context);\n res.redirect(tarballUrl);\n } else {\n downloadStream(packageName, filename, storage, req, res);\n }\n })\n .catch((err) => {\n res.locals.report_error(err);\n });\n};\n\nexport default function (route: Router, auth: Auth, storage: Storage, config: Config): void {\n const can = allow(auth, {\n beforeAll: (params, message) => logger.trace(params, message),\n afterAll: (params, message) => logger.trace(params, message),\n });\n // TODO: anonymous user?\n route.get(\n PACKAGE_API_ENDPOINTS.get_package_by_version,\n can('access'),\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n const abbreviated =\n stringUtils.getByQualityPriorityValue(req.get('Accept')) ===\n 'application/vnd.npm.install-v1+json';\n const getPackageMetaCallback = function (err, metadata: Manifest): void {\n if (err) {\n return next(err);\n }\n metadata = convertDistRemoteToLocalTarballUrls(\n metadata,\n {\n protocol: req.protocol,\n headers: req.headers as any,\n host: req.hostname,\n remoteAddress: req.socket.remoteAddress,\n },\n config.url_prefix\n );\n\n let queryVersion = req.params.version;\n if (_.isNil(queryVersion)) {\n if (abbreviated) {\n res.setHeader(HEADERS.CONTENT_TYPE, 'application/vnd.npm.install-v1+json');\n } else {\n res.setHeader(HEADERS.CONTENT_TYPE, HEADERS.JSON);\n }\n\n return next(metadata);\n }\n\n let version = getVersion(metadata, queryVersion);\n if (_.isNil(version) === false) {\n res.setHeader(HEADERS.CONTENT_TYPE, HEADERS.JSON);\n return next(version);\n }\n\n if (_.isNil(metadata[DIST_TAGS]) === false) {\n if (_.isNil(metadata[DIST_TAGS][queryVersion]) === false) {\n queryVersion = metadata[DIST_TAGS][queryVersion];\n version = getVersion(metadata, queryVersion);\n if (_.isNil(version) === false) {\n res.setHeader(HEADERS.CONTENT_TYPE, HEADERS.JSON);\n return next(version);\n }\n }\n }\n return next(ErrorCode.getNotFound(`${API_ERROR.VERSION_NOT_EXIST}: ${req.params.version}`));\n };\n\n storage.getPackage({\n name: req.params.package,\n uplinksLook: true,\n req,\n abbreviated,\n callback: getPackageMetaCallback,\n });\n }\n );\n\n route.get(\n PACKAGE_API_ENDPOINTS.get_package_tarball,\n can('access'),\n function (req: $RequestExtend, res: $ResponseExtend): void {\n if (_.get(config, 'experiments.tarball_url_redirect') === undefined) {\n downloadStream(req.params.package, req.params.filename, storage, req, res);\n } else {\n redirectOrDownloadStream(\n req.params.package,\n req.params.filename,\n storage,\n req,\n res,\n config\n );\n }\n }\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
6
|
+
let _verdaccio_middleware = require("@verdaccio/middleware");
|
|
7
|
+
//#region src/api/endpoint/api/ping.ts
|
|
8
|
+
function ping_default(route) {
|
|
9
|
+
route.get(_verdaccio_middleware.PING_API_ENDPOINTS.ping, function(req, res, next) {
|
|
10
|
+
next({});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.default = ping_default;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=ping.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ping.cjs","names":[],"sources":["../../../../../src/api/endpoint/api/ping.ts"],"sourcesContent":["import type { Router } from 'express';\n\nimport { PING_API_ENDPOINTS } from '@verdaccio/middleware';\n\nimport type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../../types';\n\nexport default function (route: Router): void {\n route.get(\n PING_API_ENDPOINTS.ping,\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next({});\n }\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAA,aAAyB,OAAqB;AAC5C,OAAM,IACJ,sBAAA,mBAAmB,MACnB,SAAU,KAAqB,KAAsB,MAAwB;AAC3E,OAAK,EAAE,CAAC;GAEX"}
|