@verdaccio/server 6.0.0-6-next.20 → 6.0.0-6-next.24
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 +110 -0
- package/build/debug/index.js.map +1 -1
- package/build/server.d.ts +1 -1
- package/build/server.js +16 -24
- package/build/server.js.map +1 -1
- package/package.json +20 -19
- package/src/debug/index.ts +2 -1
- package/src/server.ts +16 -21
- package/test/api/index.spec.ts +8 -15
- package/test/basic/index.spec.ts +2 -2
- package/test/jwt/index.spec.ts +8 -9
- package/test/package-access/index.spec.ts +5 -5
- package/test/profile/index.spec.ts +4 -5
- package/test/storage/index.spec.ts +5 -6
- package/test/token/index.spec.ts +10 -12
- package/test/web/index.spec.ts +3 -4
- package/types/custom.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,115 @@
|
|
|
1
1
|
# @verdaccio/server
|
|
2
2
|
|
|
3
|
+
## 6.0.0-6-next.24
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- a828271d: refactor: download manifest endpoint and integrate fastify
|
|
8
|
+
|
|
9
|
+
Much simpler API for fetching a package
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
const manifest = await storage.getPackageNext({
|
|
13
|
+
name,
|
|
14
|
+
uplinksLook: true,
|
|
15
|
+
req,
|
|
16
|
+
version: queryVersion,
|
|
17
|
+
requestOptions,
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
> not perfect, the `req` still is being passed to the proxy (this has to be refactored at proxy package) and then removed from here, in proxy we pass the request instance to the `request` library.
|
|
22
|
+
|
|
23
|
+
### Details
|
|
24
|
+
|
|
25
|
+
- `async/await` sugar for getPackage()
|
|
26
|
+
- Improve and reuse code between current implementation and new fastify endpoint (add scaffolding for request manifest)
|
|
27
|
+
- Improve performance
|
|
28
|
+
- Add new tests
|
|
29
|
+
|
|
30
|
+
### Breaking changes
|
|
31
|
+
|
|
32
|
+
All storage plugins will stop to work since the storage uses `getPackageNext` method which is Promise based, I won't replace this now because will force me to update all plugins, I'll follow up in another PR. Currently will throw http 500
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [a828271d]
|
|
37
|
+
- Updated dependencies [24b9be02]
|
|
38
|
+
- Updated dependencies [e75c0a3b]
|
|
39
|
+
- Updated dependencies [000d4374]
|
|
40
|
+
- Updated dependencies [b13a3fef]
|
|
41
|
+
- @verdaccio/api@6.0.0-6-next.19
|
|
42
|
+
- @verdaccio/store@6.0.0-6-next.17
|
|
43
|
+
- @verdaccio/utils@6.0.0-6-next.10
|
|
44
|
+
- @verdaccio/core@6.0.0-6-next.4
|
|
45
|
+
- @verdaccio/middleware@6.0.0-6-next.16
|
|
46
|
+
- verdaccio-audit@11.0.0-6-next.8
|
|
47
|
+
- @verdaccio/web@6.0.0-6-next.22
|
|
48
|
+
- @verdaccio/logger@6.0.0-6-next.8
|
|
49
|
+
- @verdaccio/auth@6.0.0-6-next.16
|
|
50
|
+
- @verdaccio/config@6.0.0-6-next.12
|
|
51
|
+
- @verdaccio/loaders@6.0.0-6-next.8
|
|
52
|
+
|
|
53
|
+
## 6.0.0-6-next.23
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [f86c31ed]
|
|
58
|
+
- Updated dependencies [20c9e43e]
|
|
59
|
+
- @verdaccio/store@6.0.0-6-next.16
|
|
60
|
+
- @verdaccio/utils@6.0.0-6-next.9
|
|
61
|
+
- @verdaccio/web@6.0.0-6-next.21
|
|
62
|
+
- @verdaccio/auth@6.0.0-6-next.15
|
|
63
|
+
- @verdaccio/api@6.0.0-6-next.18
|
|
64
|
+
- @verdaccio/config@6.0.0-6-next.11
|
|
65
|
+
- @verdaccio/middleware@6.0.0-6-next.15
|
|
66
|
+
- @verdaccio/loaders@6.0.0-6-next.7
|
|
67
|
+
|
|
68
|
+
## 6.0.0-6-next.22
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Updated dependencies [6c1eb021]
|
|
73
|
+
- @verdaccio/core@6.0.0-6-next.3
|
|
74
|
+
- @verdaccio/logger@6.0.0-6-next.7
|
|
75
|
+
- @verdaccio/api@6.0.0-6-next.17
|
|
76
|
+
- @verdaccio/auth@6.0.0-6-next.14
|
|
77
|
+
- @verdaccio/config@6.0.0-6-next.10
|
|
78
|
+
- @verdaccio/loaders@6.0.0-6-next.7
|
|
79
|
+
- @verdaccio/middleware@6.0.0-6-next.14
|
|
80
|
+
- @verdaccio/store@6.0.0-6-next.15
|
|
81
|
+
- @verdaccio/utils@6.0.0-6-next.8
|
|
82
|
+
- @verdaccio/web@6.0.0-6-next.20
|
|
83
|
+
|
|
84
|
+
## 6.0.0-6-next.21
|
|
85
|
+
|
|
86
|
+
### Major Changes
|
|
87
|
+
|
|
88
|
+
- 794af76c: Remove Node 12 support
|
|
89
|
+
|
|
90
|
+
- We need move to the new `undici` and does not support Node.js 12
|
|
91
|
+
|
|
92
|
+
### Minor Changes
|
|
93
|
+
|
|
94
|
+
- 154b2ecd: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [794af76c]
|
|
99
|
+
- Updated dependencies [b702ea36]
|
|
100
|
+
- Updated dependencies [154b2ecd]
|
|
101
|
+
- @verdaccio/api@6.0.0-6-next.16
|
|
102
|
+
- @verdaccio/auth@6.0.0-6-next.13
|
|
103
|
+
- @verdaccio/config@6.0.0-6-next.9
|
|
104
|
+
- @verdaccio/core@6.0.0-6-next.2
|
|
105
|
+
- @verdaccio/loaders@6.0.0-6-next.6
|
|
106
|
+
- @verdaccio/logger@6.0.0-6-next.6
|
|
107
|
+
- @verdaccio/middleware@6.0.0-6-next.13
|
|
108
|
+
- verdaccio-audit@11.0.0-6-next.7
|
|
109
|
+
- @verdaccio/store@6.0.0-6-next.14
|
|
110
|
+
- @verdaccio/utils@6.0.0-6-next.7
|
|
111
|
+
- @verdaccio/web@6.0.0-6-next.19
|
|
112
|
+
|
|
3
113
|
## 6.0.0-6-next.20
|
|
4
114
|
|
|
5
115
|
### Patch Changes
|
package/build/debug/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/debug/index.ts"],"names":["app","configPath","get","req","res","next","global","gc","pid","process","main","mainModule","filename","conf","mem","memoryUsage"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/debug/index.ts"],"names":["app","configPath","get","req","res","next","global","gc","pid","process","main","mainModule","filename","conf","mem","memoryUsage"],"mappings":";;;;;;;eAIe,CAACA,GAAD,EAAmBC,UAAnB,KAAgD;AAC7D;AACAD,EAAAA,GAAG,CAACE,GAAJ,CACE,WADF,EAEE,UAAUC,GAAV,EAA+BC,GAA/B,EAAqDC,IAArD,EAAmF;AACjF,QAAIC,MAAM,CAACC,EAAX,EAAe;AACbD,MAAAA,MAAM,CAACC,EAAP;AACD;;AAEDF,IAAAA,IAAI,CAAC;AACHG,MAAAA,GAAG,EAAEC,OAAO,CAACD,GADV;AAEH;AACAE,MAAAA,IAAI,EAAED,OAAO,CAACE,UAAR,CAAmBC,QAHtB;AAIHC,MAAAA,IAAI,EAAEZ,UAJH;AAKHa,MAAAA,GAAG,EAAEL,OAAO,CAACM,WAAR,EALF;AAMHR,MAAAA,EAAE,EAAED,MAAM,CAACC;AANR,KAAD,CAAJ;AAQD,GAfH;AAiBD,C","sourcesContent":["import { Application } from 'express';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../types/custom';\n\nexport default (app: Application, configPath: string): void => {\n // Hook for tests only\n app.get(\n '/-/_debug',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n if (global.gc) {\n global.gc();\n }\n\n next({\n pid: process.pid,\n // @ts-ignore\n main: process.mainModule.filename,\n conf: configPath,\n mem: process.memoryUsage(),\n gc: global.gc,\n });\n }\n );\n};\n"],"file":"index.js"}
|
package/build/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConfigRuntime } from '@verdaccio/types';
|
|
2
1
|
import { IBasicAuth } from '@verdaccio/auth';
|
|
3
2
|
import { Storage } from '@verdaccio/store';
|
|
3
|
+
import { ConfigRuntime } from '@verdaccio/types';
|
|
4
4
|
import { IPlugin } from '@verdaccio/types';
|
|
5
5
|
export interface IPluginMiddleware<T> extends IPlugin<T> {
|
|
6
6
|
register_middlewares(app: any, auth: IBasicAuth<T>, storage: Storage): void;
|
package/build/server.js
CHANGED
|
@@ -5,50 +5,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _compression = _interopRequireDefault(require("compression"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _cors = _interopRequireDefault(require("cors"));
|
|
11
11
|
|
|
12
12
|
var _debug = _interopRequireDefault(require("debug"));
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _cors = _interopRequireDefault(require("cors"));
|
|
14
|
+
var _express = _interopRequireDefault(require("express"));
|
|
17
15
|
|
|
18
16
|
var _expressRateLimit = _interopRequireDefault(require("express-rate-limit"));
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
21
19
|
|
|
22
|
-
var
|
|
20
|
+
var _verdaccioAudit = _interopRequireDefault(require("verdaccio-audit"));
|
|
23
21
|
|
|
24
22
|
var _api = _interopRequireDefault(require("@verdaccio/api"));
|
|
25
23
|
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
var _commonsApi = require("@verdaccio/commons-api");
|
|
24
|
+
var _auth = require("@verdaccio/auth");
|
|
29
25
|
|
|
30
26
|
var _config = require("@verdaccio/config");
|
|
31
27
|
|
|
32
|
-
var
|
|
28
|
+
var _core = require("@verdaccio/core");
|
|
33
29
|
|
|
34
|
-
var
|
|
30
|
+
var _loaders = require("@verdaccio/loaders");
|
|
35
31
|
|
|
36
32
|
var _logger = require("@verdaccio/logger");
|
|
37
33
|
|
|
38
34
|
var _middleware = require("@verdaccio/middleware");
|
|
39
35
|
|
|
40
|
-
var
|
|
36
|
+
var _store = require("@verdaccio/store");
|
|
37
|
+
|
|
38
|
+
var _web = _interopRequireDefault(require("@verdaccio/web"));
|
|
41
39
|
|
|
42
40
|
var _debug2 = _interopRequireDefault(require("./debug"));
|
|
43
41
|
|
|
44
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
43
|
|
|
46
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
47
|
-
|
|
48
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
49
|
-
|
|
50
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
51
|
-
|
|
52
44
|
const debug = (0, _debug.default)('verdaccio:server');
|
|
53
45
|
|
|
54
46
|
const defineAPI = function (config, storage) {
|
|
@@ -87,10 +79,10 @@ const defineAPI = function (config, storage) {
|
|
|
87
79
|
});
|
|
88
80
|
|
|
89
81
|
if (_lodash.default.isEmpty(plugins)) {
|
|
90
|
-
plugins.push(new _verdaccioAudit.default(
|
|
82
|
+
plugins.push(new _verdaccioAudit.default({ ...config,
|
|
91
83
|
enabled: true,
|
|
92
84
|
strict_ssl: true
|
|
93
|
-
}
|
|
85
|
+
}, {
|
|
94
86
|
config,
|
|
95
87
|
logger: _logger.logger
|
|
96
88
|
}));
|
|
@@ -107,17 +99,17 @@ const defineAPI = function (config, storage) {
|
|
|
107
99
|
app.use((0, _web.default)(config, auth, storage));
|
|
108
100
|
} else {
|
|
109
101
|
app.get('/', function (req, res, next) {
|
|
110
|
-
next(
|
|
102
|
+
next(_core.errorUtils.getNotFound(_core.API_ERROR.WEB_DISABLED));
|
|
111
103
|
});
|
|
112
104
|
} // Catch 404
|
|
113
105
|
|
|
114
106
|
|
|
115
107
|
app.get('/*', function (req, res, next) {
|
|
116
|
-
next(
|
|
108
|
+
next(_core.errorUtils.getNotFound(_core.API_ERROR.FILE_NOT_FOUND));
|
|
117
109
|
});
|
|
118
110
|
app.use(function (err, req, res, next) {
|
|
119
111
|
if (_lodash.default.isError(err)) {
|
|
120
|
-
if (err.code === 'ECONNABORT' && res.statusCode ===
|
|
112
|
+
if (err.code === 'ECONNABORT' && res.statusCode === _core.HTTP_STATUS.NOT_MODIFIED) {
|
|
121
113
|
return next();
|
|
122
114
|
}
|
|
123
115
|
|
package/build/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts"],"names":["debug","defineAPI","config","storage","auth","Auth","app","limiter","RateLimit","serverSettings","rateLimit","set","process","env","NODE_ENV","use","log","errorReportingMiddleware","req","res","next","setHeader","user_agent","get","url","_debug","config_path","plugin_params","logger","plugins","middlewares","plugin","register_middlewares","_","isEmpty","push","AuditMiddleware","enabled","strict_ssl","forEach","
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"names":["debug","defineAPI","config","storage","auth","Auth","app","limiter","RateLimit","serverSettings","rateLimit","set","process","env","NODE_ENV","use","log","errorReportingMiddleware","req","res","next","setHeader","user_agent","get","url","_debug","config_path","plugin_params","logger","plugins","middlewares","plugin","register_middlewares","_","isEmpty","push","AuditMiddleware","enabled","strict_ssl","forEach","errorUtils","getNotFound","API_ERROR","WEB_DISABLED","FILE_NOT_FOUND","err","isError","code","statusCode","HTTP_STATUS","NOT_MODIFIED","isFunction","locals","report_error","noop","final","configHash","AppConfig","cloneDeep","filters","filter_metadata","Storage","init","error","msg","Error"],"mappings":"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","sourcesContent":["import compression from 'compression';\nimport cors from 'cors';\nimport buildDebug from 'debug';\nimport express, { Application } from 'express';\nimport RateLimit from 'express-rate-limit';\nimport { HttpError } from 'http-errors';\nimport _ from 'lodash';\nimport AuditMiddleware from 'verdaccio-audit';\n\nimport apiEndpoint from '@verdaccio/api';\nimport { Auth, IBasicAuth } from '@verdaccio/auth';\nimport { Config as AppConfig } from '@verdaccio/config';\nimport { API_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core';\nimport { loadPlugin } from '@verdaccio/loaders';\nimport { logger } from '@verdaccio/logger';\nimport { errorReportingMiddleware, final, log } from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { ConfigRuntime } from '@verdaccio/types';\nimport { Config as IConfig, IPlugin, IPluginStorageFilter } from '@verdaccio/types';\nimport webMiddleware from '@verdaccio/web';\n\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';\nimport hookDebug from './debug';\n\nexport interface IPluginMiddleware<T> extends IPlugin<T> {\n register_middlewares(app: any, auth: IBasicAuth<T>, storage: Storage): void;\n}\n\nconst debug = buildDebug('verdaccio:server');\n\nconst defineAPI = function (config: IConfig, storage: Storage): any {\n const auth: Auth = new Auth(config);\n const app: Application = express();\n const limiter = new RateLimit(config.serverSettings.rateLimit);\n // run in production mode by default, just in case\n // it shouldn't make any difference anyway\n app.set('env', process.env.NODE_ENV || 'production');\n app.use(cors());\n app.use(limiter);\n\n // Router setup\n app.use(log);\n app.use(errorReportingMiddleware);\n app.use(function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n res.setHeader('X-Powered-By', config.user_agent);\n next();\n });\n\n app.use(compression());\n\n app.get(\n '/favicon.ico',\n function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer): void {\n req.url = '/-/static/favicon.png';\n next();\n }\n );\n\n // Hook for tests only\n if (config._debug) {\n hookDebug(app, config.config_path);\n }\n\n // register middleware plugins\n const plugin_params = {\n config: config,\n logger: logger,\n };\n\n const plugins: IPluginMiddleware<IConfig>[] = loadPlugin(\n config,\n config.middlewares,\n plugin_params,\n function (plugin: IPluginMiddleware<IConfig>) {\n return plugin.register_middlewares;\n }\n );\n\n if (_.isEmpty(plugins)) {\n plugins.push(\n new AuditMiddleware(\n { ...config, enabled: true, strict_ssl: true },\n { config, logger: logger }\n )\n );\n }\n\n plugins.forEach((plugin: IPluginMiddleware<IConfig>) => {\n plugin.register_middlewares(app, auth, storage);\n });\n\n // For npm request\n // @ts-ignore\n app.use(apiEndpoint(config, auth, storage));\n\n // For WebUI & WebUI API\n if (_.get(config, 'web.enable', true)) {\n app.use(webMiddleware(config, auth, storage));\n } else {\n app.get('/', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound(API_ERROR.WEB_DISABLED));\n });\n }\n\n // Catch 404\n app.get('/*', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {\n next(errorUtils.getNotFound(API_ERROR.FILE_NOT_FOUND));\n });\n\n app.use(function (\n err: HttpError,\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ) {\n if (_.isError(err)) {\n if (err.code === 'ECONNABORT' && res.statusCode === HTTP_STATUS.NOT_MODIFIED) {\n return next();\n }\n if (_.isFunction(res.locals.report_error) === false) {\n // in case of very early error this middleware may not be loaded before error is generated\n // fixing that\n errorReportingMiddleware(req, res, _.noop);\n }\n res.locals.report_error(err);\n } else {\n // Fall to Middleware.final\n return next(err);\n }\n });\n\n app.use(final);\n\n return app;\n};\n\nexport default (async function (configHash: ConfigRuntime): Promise<any> {\n debug('start server');\n const config: IConfig = new AppConfig(_.cloneDeep(configHash));\n // register middleware plugins\n const plugin_params = {\n config: config,\n logger: logger,\n };\n const filters = loadPlugin(\n config,\n config.filters || {},\n plugin_params,\n (plugin: IPluginStorageFilter<IConfig>) => plugin.filter_metadata\n );\n debug('loaded filter plugin');\n // @ts-ignore\n const storage: Storage = new Storage(config);\n try {\n // waits until init calls have been initialized\n debug('storage init start');\n await storage.init(config, filters);\n debug('storage init end');\n } catch (err: any) {\n logger.error({ error: err.msg }, 'storage has failed: @{error}');\n throw new Error(err);\n }\n return defineAPI(config, storage);\n});\n"],"file":"server.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/server",
|
|
3
|
-
"version": "6.0.0-6-next.
|
|
3
|
+
"version": "6.0.0-6-next.24",
|
|
4
4
|
"description": "server logic",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -26,33 +26,34 @@
|
|
|
26
26
|
"verdaccio"
|
|
27
27
|
],
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
29
|
+
"node": ">=14",
|
|
30
30
|
"npm": ">=6"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@verdaccio/api": "6.0.0-6-next.
|
|
34
|
-
"@verdaccio/auth": "6.0.0-6-next.
|
|
35
|
-
"@verdaccio/
|
|
36
|
-
"@verdaccio/config": "6.0.0-6-next.
|
|
37
|
-
"@verdaccio/loaders": "6.0.0-6-next.
|
|
38
|
-
"@verdaccio/logger": "6.0.0-6-next.
|
|
39
|
-
"@verdaccio/middleware": "6.0.0-6-next.
|
|
40
|
-
"@verdaccio/store": "6.0.0-6-next.
|
|
41
|
-
"@verdaccio/utils": "6.0.0-6-next.
|
|
42
|
-
"@verdaccio/web": "6.0.0-6-next.
|
|
43
|
-
"verdaccio-audit": "11.0.0-6-next.
|
|
33
|
+
"@verdaccio/api": "6.0.0-6-next.19",
|
|
34
|
+
"@verdaccio/auth": "6.0.0-6-next.16",
|
|
35
|
+
"@verdaccio/core": "6.0.0-6-next.4",
|
|
36
|
+
"@verdaccio/config": "6.0.0-6-next.12",
|
|
37
|
+
"@verdaccio/loaders": "6.0.0-6-next.8",
|
|
38
|
+
"@verdaccio/logger": "6.0.0-6-next.8",
|
|
39
|
+
"@verdaccio/middleware": "6.0.0-6-next.16",
|
|
40
|
+
"@verdaccio/store": "6.0.0-6-next.17",
|
|
41
|
+
"@verdaccio/utils": "6.0.0-6-next.10",
|
|
42
|
+
"@verdaccio/web": "6.0.0-6-next.22",
|
|
43
|
+
"verdaccio-audit": "11.0.0-6-next.8",
|
|
44
44
|
"compression": "1.7.4",
|
|
45
45
|
"cors": "2.8.5",
|
|
46
|
-
"debug": "4.3.
|
|
46
|
+
"debug": "4.3.3",
|
|
47
47
|
"express": "4.17.1",
|
|
48
48
|
"express-rate-limit": "5.3.0",
|
|
49
49
|
"lodash": "4.17.21"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/node": "16.
|
|
53
|
-
"@verdaccio/mock": "6.0.0-6-next.
|
|
54
|
-
"@verdaccio/proxy": "6.0.0-6-next.
|
|
55
|
-
"
|
|
52
|
+
"@types/node": "16.11.12",
|
|
53
|
+
"@verdaccio/mock": "6.0.0-6-next.13",
|
|
54
|
+
"@verdaccio/proxy": "6.0.0-6-next.16",
|
|
55
|
+
"@verdaccio/helper": "1.0.0",
|
|
56
|
+
"http-errors": "1.8.1",
|
|
56
57
|
"request": "2.87.0"
|
|
57
58
|
},
|
|
58
59
|
"funding": {
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
},
|
|
62
63
|
"scripts": {
|
|
63
64
|
"clean": "rimraf ./build",
|
|
64
|
-
"test": "cross-env NODE_ENV=test BABEL_ENV=test jest",
|
|
65
|
+
"test": "cross-env NODE_ENV=test BABEL_ENV=test jest --detectOpenHandles",
|
|
65
66
|
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
|
66
67
|
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
67
68
|
"watch": "pnpm build:js -- --watch",
|
package/src/debug/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Application } from 'express';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../types/custom';
|
|
3
4
|
|
|
4
5
|
export default (app: Application, configPath: string): void => {
|
|
5
6
|
// Hook for tests only
|
package/src/server.ts
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import express, { Application } from 'express';
|
|
3
|
-
import buildDebug from 'debug';
|
|
4
1
|
import compression from 'compression';
|
|
5
2
|
import cors from 'cors';
|
|
3
|
+
import buildDebug from 'debug';
|
|
4
|
+
import express, { Application } from 'express';
|
|
6
5
|
import RateLimit from 'express-rate-limit';
|
|
7
6
|
import { HttpError } from 'http-errors';
|
|
7
|
+
import _ from 'lodash';
|
|
8
|
+
import AuditMiddleware from 'verdaccio-audit';
|
|
8
9
|
|
|
9
|
-
import { loadPlugin } from '@verdaccio/loaders';
|
|
10
|
-
import { Auth } from '@verdaccio/auth';
|
|
11
10
|
import apiEndpoint from '@verdaccio/api';
|
|
12
|
-
import {
|
|
13
|
-
import { API_ERROR, HTTP_STATUS } from '@verdaccio/commons-api';
|
|
11
|
+
import { Auth, IBasicAuth } from '@verdaccio/auth';
|
|
14
12
|
import { Config as AppConfig } from '@verdaccio/config';
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
import { ConfigRuntime } from '@verdaccio/types';
|
|
18
|
-
|
|
19
|
-
import { IAuth, IBasicAuth } from '@verdaccio/auth';
|
|
20
|
-
import { Storage } from '@verdaccio/store';
|
|
13
|
+
import { API_ERROR, HTTP_STATUS, errorUtils } from '@verdaccio/core';
|
|
14
|
+
import { loadPlugin } from '@verdaccio/loaders';
|
|
21
15
|
import { logger } from '@verdaccio/logger';
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
import { Config as IConfig,
|
|
26
|
-
import
|
|
16
|
+
import { errorReportingMiddleware, final, log } from '@verdaccio/middleware';
|
|
17
|
+
import { Storage } from '@verdaccio/store';
|
|
18
|
+
import { ConfigRuntime } from '@verdaccio/types';
|
|
19
|
+
import { Config as IConfig, IPlugin, IPluginStorageFilter } from '@verdaccio/types';
|
|
20
|
+
import webMiddleware from '@verdaccio/web';
|
|
27
21
|
|
|
22
|
+
import { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../types/custom';
|
|
28
23
|
import hookDebug from './debug';
|
|
29
24
|
|
|
30
25
|
export interface IPluginMiddleware<T> extends IPlugin<T> {
|
|
@@ -34,7 +29,7 @@ export interface IPluginMiddleware<T> extends IPlugin<T> {
|
|
|
34
29
|
const debug = buildDebug('verdaccio:server');
|
|
35
30
|
|
|
36
31
|
const defineAPI = function (config: IConfig, storage: Storage): any {
|
|
37
|
-
const auth:
|
|
32
|
+
const auth: Auth = new Auth(config);
|
|
38
33
|
const app: Application = express();
|
|
39
34
|
const limiter = new RateLimit(config.serverSettings.rateLimit);
|
|
40
35
|
// run in production mode by default, just in case
|
|
@@ -103,13 +98,13 @@ const defineAPI = function (config: IConfig, storage: Storage): any {
|
|
|
103
98
|
app.use(webMiddleware(config, auth, storage));
|
|
104
99
|
} else {
|
|
105
100
|
app.get('/', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {
|
|
106
|
-
next(
|
|
101
|
+
next(errorUtils.getNotFound(API_ERROR.WEB_DISABLED));
|
|
107
102
|
});
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
// Catch 404
|
|
111
106
|
app.get('/*', function (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) {
|
|
112
|
-
next(
|
|
107
|
+
next(errorUtils.getNotFound(API_ERROR.FILE_NOT_FOUND));
|
|
113
108
|
});
|
|
114
109
|
|
|
115
110
|
app.use(function (
|
package/test/api/index.spec.ts
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import path from 'path';
|
|
2
3
|
import request from 'supertest';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
HEADERS,
|
|
7
|
-
HTTP_STATUS,
|
|
8
|
-
HEADER_TYPE,
|
|
9
|
-
API_MESSAGE,
|
|
10
|
-
TOKEN_BEARER,
|
|
11
|
-
} from '@verdaccio/commons-api';
|
|
12
|
-
import { buildToken } from '@verdaccio/utils';
|
|
13
|
-
import { setup, logger } from '@verdaccio/logger';
|
|
14
4
|
|
|
5
|
+
import { API_MESSAGE, HEADERS, HEADER_TYPE, HTTP_STATUS, TOKEN_BEARER } from '@verdaccio/core';
|
|
6
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
15
7
|
import { mockServer } from '@verdaccio/mock';
|
|
16
|
-
|
|
17
8
|
import {
|
|
18
|
-
configExample,
|
|
19
9
|
DOMAIN_SERVERS,
|
|
10
|
+
configExample,
|
|
11
|
+
generateRamdonStorage,
|
|
12
|
+
generateUnPublishURI,
|
|
20
13
|
getNewToken,
|
|
21
14
|
getPackage,
|
|
22
15
|
putPackage,
|
|
23
|
-
generateRamdonStorage,
|
|
24
16
|
verifyPackageVersionDoesExist,
|
|
25
|
-
generateUnPublishURI,
|
|
26
17
|
} from '@verdaccio/mock';
|
|
18
|
+
// import { generatePackageMetadata } from '@verdaccio/helper';
|
|
19
|
+
import { buildToken } from '@verdaccio/utils';
|
|
27
20
|
|
|
28
21
|
import endPointAPI from '../../src';
|
|
29
22
|
import publishMetadata from './helpers/publish-api';
|
package/test/basic/index.spec.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import express from 'express';
|
|
2
|
+
import path from 'path';
|
|
3
3
|
import request from 'request';
|
|
4
4
|
|
|
5
|
-
import { API_ERROR } from '@verdaccio/commons-api';
|
|
6
5
|
import { parseConfigFile } from '@verdaccio/config';
|
|
6
|
+
import { API_ERROR } from '@verdaccio/core';
|
|
7
7
|
import { setup } from '@verdaccio/logger';
|
|
8
8
|
|
|
9
9
|
import endPointAPI from '../../src';
|
package/test/jwt/index.spec.ts
CHANGED
|
@@ -2,24 +2,23 @@ import path from 'path';
|
|
|
2
2
|
import request from 'supertest';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
+
API_ERROR,
|
|
5
6
|
HEADERS,
|
|
6
|
-
HTTP_STATUS,
|
|
7
7
|
HEADER_TYPE,
|
|
8
|
-
|
|
8
|
+
HTTP_STATUS,
|
|
9
9
|
TOKEN_BASIC,
|
|
10
|
-
|
|
11
|
-
} from '@verdaccio/
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
TOKEN_BEARER,
|
|
11
|
+
} from '@verdaccio/core';
|
|
12
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
13
|
+
import { generateRamdonStorage, mockServer } from '@verdaccio/mock';
|
|
14
14
|
import {
|
|
15
|
-
configExample,
|
|
16
15
|
DOMAIN_SERVERS,
|
|
17
16
|
addUser,
|
|
17
|
+
configExample,
|
|
18
18
|
getPackage,
|
|
19
19
|
loginUserToken,
|
|
20
20
|
} from '@verdaccio/mock';
|
|
21
|
-
|
|
22
|
-
import { setup, logger } from '@verdaccio/logger';
|
|
21
|
+
import { buildToken, buildUserBuffer } from '@verdaccio/utils';
|
|
23
22
|
|
|
24
23
|
import endPointAPI from '../../src';
|
|
25
24
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import request from 'supertest';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { HEADERS, HTTP_STATUS } from '@verdaccio/core';
|
|
5
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
6
|
+
import { DOMAIN_SERVERS, configExample, generateRamdonStorage, mockServer } from '@verdaccio/mock';
|
|
5
7
|
|
|
6
|
-
setup([]);
|
|
7
|
-
|
|
8
|
-
import { HEADERS, HTTP_STATUS } from '@verdaccio/commons-api';
|
|
9
|
-
import { generateRamdonStorage, mockServer, configExample, DOMAIN_SERVERS } from '@verdaccio/mock';
|
|
10
8
|
import endPointAPI from '../../src';
|
|
11
9
|
|
|
10
|
+
setup([]);
|
|
11
|
+
|
|
12
12
|
describe('api with no limited access configuration', () => {
|
|
13
13
|
let app;
|
|
14
14
|
let mockRegistry;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import request from 'supertest';
|
|
3
3
|
|
|
4
|
+
import { API_ERROR, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/core';
|
|
5
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
4
6
|
import { mockServer } from '@verdaccio/mock';
|
|
5
|
-
import { API_ERROR, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/commons-api';
|
|
6
|
-
import { setup, logger } from '@verdaccio/logger';
|
|
7
|
-
|
|
8
7
|
import {
|
|
8
|
+
DOMAIN_SERVERS,
|
|
9
|
+
configExample,
|
|
9
10
|
generateRamdonStorage,
|
|
10
11
|
getNewToken,
|
|
11
12
|
getProfile,
|
|
12
13
|
postProfile,
|
|
13
|
-
configExample,
|
|
14
|
-
DOMAIN_SERVERS,
|
|
15
14
|
} from '@verdaccio/mock';
|
|
16
15
|
|
|
17
16
|
import endPointAPI from '../../src';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
3
|
import { Writable } from 'stream';
|
|
4
|
+
|
|
4
5
|
import { Config as AppConfig } from '@verdaccio/config';
|
|
6
|
+
import { API_ERROR, HTTP_STATUS } from '@verdaccio/core';
|
|
7
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
8
|
+
import { DOMAIN_SERVERS, configExample, generateRamdonStorage, mockServer } from '@verdaccio/mock';
|
|
5
9
|
import { Storage } from '@verdaccio/store';
|
|
6
|
-
|
|
7
10
|
import { Config } from '@verdaccio/types';
|
|
8
|
-
import { API_ERROR, HTTP_STATUS } from '@verdaccio/commons-api';
|
|
9
|
-
import { mockServer, configExample, DOMAIN_SERVERS, generateRamdonStorage } from '@verdaccio/mock';
|
|
10
|
-
|
|
11
|
-
import { setup, logger } from '@verdaccio/logger';
|
|
12
11
|
|
|
13
12
|
setup([]);
|
|
14
13
|
|
package/test/token/index.spec.ts
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import path from 'path';
|
|
2
3
|
import request from 'supertest';
|
|
3
|
-
import _ from 'lodash';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
API_ERROR,
|
|
6
7
|
HEADERS,
|
|
7
|
-
HTTP_STATUS,
|
|
8
8
|
HEADER_TYPE,
|
|
9
|
-
|
|
10
|
-
API_ERROR,
|
|
9
|
+
HTTP_STATUS,
|
|
11
10
|
SUPPORT_ERRORS,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import {
|
|
11
|
+
TOKEN_BEARER,
|
|
12
|
+
} from '@verdaccio/core';
|
|
13
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
15
14
|
import {
|
|
16
|
-
generateRamdonStorage,
|
|
17
15
|
DOMAIN_SERVERS,
|
|
18
|
-
mockServer,
|
|
19
|
-
getNewToken,
|
|
20
16
|
configExample,
|
|
17
|
+
generateRamdonStorage,
|
|
18
|
+
getNewToken,
|
|
19
|
+
mockServer,
|
|
21
20
|
} from '@verdaccio/mock';
|
|
22
|
-
|
|
23
|
-
import { setup, logger } from '@verdaccio/logger';
|
|
21
|
+
import { buildToken } from '@verdaccio/utils';
|
|
24
22
|
|
|
25
23
|
import endPointAPI from '../../src';
|
|
26
24
|
|
package/test/web/index.spec.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import request from 'supertest';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DIST_TAGS, HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
|
|
5
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
6
|
+
import { DOMAIN_SERVERS, configExample, generateRamdonStorage, mockServer } from '@verdaccio/mock';
|
|
5
7
|
|
|
6
|
-
import { mockServer, DOMAIN_SERVERS, configExample, generateRamdonStorage } from '@verdaccio/mock';
|
|
7
|
-
|
|
8
|
-
import { setup, logger } from '@verdaccio/logger';
|
|
9
8
|
import endPointAPI from '../../src';
|
|
10
9
|
import forbiddenPlace from './partials/forbidden-place';
|
|
11
10
|
import publishMetadata from './partials/publish-api';
|
package/types/custom.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Logger, RemoteUser } from '@verdaccio/types';
|
|
2
1
|
import { NextFunction, Request, Response } from 'express';
|
|
3
2
|
|
|
3
|
+
import { Logger, RemoteUser } from '@verdaccio/types';
|
|
4
|
+
|
|
4
5
|
export type $RequestExtend = Request & { remote_user?: any; log: Logger };
|
|
5
6
|
export type $ResponseExtend = Response & { cookies?: any };
|
|
6
7
|
export type $NextFunctionVer = NextFunction & any;
|