@verdaccio/api 6.0.0-6-next.15 → 6.0.0-6-next.16

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/build/dist-tags.js +8 -8
  3. package/build/dist-tags.js.map +1 -1
  4. package/build/index.js +6 -0
  5. package/build/index.js.map +1 -1
  6. package/build/package.js +6 -6
  7. package/build/package.js.map +1 -1
  8. package/build/publish.js +18 -18
  9. package/build/publish.js.map +1 -1
  10. package/build/search.js +2 -2
  11. package/build/search.js.map +1 -1
  12. package/build/star.js +4 -4
  13. package/build/star.js.map +1 -1
  14. package/build/stars.js +3 -3
  15. package/build/stars.js.map +1 -1
  16. package/build/user.js +12 -12
  17. package/build/user.js.map +1 -1
  18. package/build/v1/profile.js +10 -10
  19. package/build/v1/profile.js.map +1 -1
  20. package/build/v1/search.js +14 -5
  21. package/build/v1/search.js.map +1 -1
  22. package/build/v1/token.js +12 -12
  23. package/build/v1/token.js.map +1 -1
  24. package/build/whoami.js +0 -1
  25. package/build/whoami.js.map +1 -1
  26. package/package.json +15 -14
  27. package/src/dist-tags.ts +8 -8
  28. package/src/index.ts +5 -0
  29. package/src/package.ts +3 -3
  30. package/src/publish.ts +11 -4
  31. package/src/search.ts +1 -1
  32. package/src/star.ts +1 -1
  33. package/src/stars.ts +1 -1
  34. package/src/user.ts +7 -7
  35. package/src/v1/profile.ts +7 -7
  36. package/src/v1/search.ts +11 -5
  37. package/src/v1/token.ts +11 -11
  38. package/src/whoami.ts +0 -1
  39. package/test/integration/_helper.ts +2 -1
  40. package/test/integration/package.spec.ts +1 -1
  41. package/test/integration/ping.spec.ts +1 -1
  42. package/test/integration/publish.spec.ts +3 -8
  43. package/test/integration/user.spec.ts +6 -8
  44. package/test/integration/whoami.spec.ts +1 -1
  45. package/test/unit/publish.spec.ts +3 -4
  46. package/tsconfig.json +0 -3
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ import { IAuth } from '@verdaccio/auth';
10
10
  import { Storage } from '@verdaccio/store';
11
11
  import { Config } from '@verdaccio/types';
12
12
  import bodyParser from 'body-parser';
13
+ import semver from 'semver';
13
14
 
14
15
  import whoami from './whoami';
15
16
  import ping from './ping';
@@ -23,6 +24,10 @@ import profile from './v1/profile';
23
24
  import token from './v1/token';
24
25
  import v1Search from './v1/search';
25
26
 
27
+ if (semver.lte(process.version, 'v15.0.0')) {
28
+ global.AbortController = require('abortcontroller-polyfill/dist/cjs-ponyfill').AbortController;
29
+ }
30
+
26
31
  export default function (config: Config, auth: IAuth, storage: Storage): Router {
27
32
  /* eslint new-cap:off */
28
33
  const app = express.Router();
package/src/package.ts CHANGED
@@ -3,8 +3,8 @@ import { Router } from 'express';
3
3
  import buildDebug from 'debug';
4
4
 
5
5
  import { allow } from '@verdaccio/middleware';
6
- import { getVersion, ErrorCode } from '@verdaccio/utils';
7
- import { HEADERS, DIST_TAGS, API_ERROR } from '@verdaccio/commons-api';
6
+ import { getVersion } from '@verdaccio/utils';
7
+ import { HEADERS, DIST_TAGS, API_ERROR, errorUtils } from '@verdaccio/core';
8
8
  import { Config, Package } from '@verdaccio/types';
9
9
  import { IAuth } from '@verdaccio/auth';
10
10
  import { Storage } from '@verdaccio/store';
@@ -80,7 +80,7 @@ export default function (route: Router, auth: IAuth, storage: Storage, config: C
80
80
  }
81
81
 
82
82
  debug('package version not found %o', queryVersion);
83
- return next(ErrorCode.getNotFound(`${API_ERROR.VERSION_NOT_EXIST}: ${queryVersion}`));
83
+ return next(errorUtils.getNotFound(`${API_ERROR.VERSION_NOT_EXIST}: ${queryVersion}`));
84
84
  };
85
85
 
86
86
  debug('get package name %o', name);
package/src/publish.ts CHANGED
@@ -4,8 +4,15 @@ import mime from 'mime';
4
4
  import { Router } from 'express';
5
5
  import buildDebug from 'debug';
6
6
 
7
- import { API_MESSAGE, HEADERS, DIST_TAGS, API_ERROR, HTTP_STATUS } from '@verdaccio/commons-api';
8
- import { validateMetadata, isObject, ErrorCode, hasDiffOneKey } from '@verdaccio/utils';
7
+ import {
8
+ API_MESSAGE,
9
+ HEADERS,
10
+ DIST_TAGS,
11
+ API_ERROR,
12
+ HTTP_STATUS,
13
+ errorUtils,
14
+ } from '@verdaccio/core';
15
+ import { validateMetadata, isObject, hasDiffOneKey } from '@verdaccio/utils';
9
16
  import { media, expectJson, allow } from '@verdaccio/middleware';
10
17
  import { notify } from '@verdaccio/hooks';
11
18
  import { Config, Callback, MergeTags, Version, Package, CallbackAction } from '@verdaccio/types';
@@ -224,7 +231,7 @@ export function publishPackage(storage: Storage, config: Config, auth: IAuth): a
224
231
  // if this happens in normal circumstances, report it as a bug
225
232
  debug('invalid body format');
226
233
  logger.info({ packageName }, `wrong package format on publish a package @{packageName}`);
227
- return next(ErrorCode.getBadRequest(API_ERROR.UNSUPORTED_REGISTRY_CALL));
234
+ return next(errorUtils.getBadRequest(API_ERROR.UNSUPORTED_REGISTRY_CALL));
228
235
  }
229
236
 
230
237
  if (error && error.status !== HTTP_STATUS.CONFLICT) {
@@ -322,7 +329,7 @@ export function publishPackage(storage: Storage, config: Config, auth: IAuth): a
322
329
  } catch (error: any) {
323
330
  debug('error on publish, bad package format %o', packageName);
324
331
  logger.error({ packageName }, 'error on publish, bad package data for @{packageName}');
325
- return next(ErrorCode.getBadData(API_ERROR.BAD_PACKAGE_DATA));
332
+ return next(errorUtils.getBadData(API_ERROR.BAD_PACKAGE_DATA));
326
333
  }
327
334
  };
328
335
  }
package/src/search.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HTTP_STATUS } from '@verdaccio/commons-api';
1
+ import { HTTP_STATUS } from '@verdaccio/core';
2
2
  import { logger } from '@verdaccio/logger';
3
3
 
4
4
  export default function (route): void {
package/src/star.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { USERS, HTTP_STATUS } from '@verdaccio/commons-api';
1
+ import { USERS, HTTP_STATUS } from '@verdaccio/core';
2
2
  import { Response } from 'express';
3
3
  import _ from 'lodash';
4
4
  import buildDebug from 'debug';
package/src/stars.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import { Response, Router } from 'express';
3
3
 
4
- import { USERS, HTTP_STATUS } from '@verdaccio/commons-api';
4
+ import { USERS, HTTP_STATUS } from '@verdaccio/core';
5
5
  import { Package } from '@verdaccio/types';
6
6
 
7
7
  import { Storage } from '@verdaccio/store';
package/src/user.ts CHANGED
@@ -2,14 +2,14 @@ import _ from 'lodash';
2
2
  import { Response, Router } from 'express';
3
3
  import buildDebug from 'debug';
4
4
 
5
- import { getAuthenticatedMessage, validatePassword, ErrorCode } from '@verdaccio/utils';
5
+ import { getAuthenticatedMessage, validatePassword } from '@verdaccio/utils';
6
6
  import { getApiToken } from '@verdaccio/auth';
7
7
  import { logger } from '@verdaccio/logger';
8
8
  import { createRemoteUser } from '@verdaccio/config';
9
9
 
10
10
  import { Config, RemoteUser } from '@verdaccio/types';
11
11
  import { IAuth } from '@verdaccio/auth';
12
- import { API_ERROR, API_MESSAGE, HTTP_STATUS } from '@verdaccio/commons-api';
12
+ import { API_ERROR, API_MESSAGE, HTTP_STATUS, errorUtils } from '@verdaccio/core';
13
13
  import { $RequestExtend, $NextFunctionVer } from '../types/custom';
14
14
 
15
15
  const debug = buildDebug('verdaccio:api:user');
@@ -47,7 +47,7 @@ export default function (route: Router, auth: IAuth, config: Config): void {
47
47
  'authenticating for user @{username} failed. Error: @{err.message}'
48
48
  );
49
49
  return next(
50
- ErrorCode.getCode(HTTP_STATUS.UNAUTHORIZED, API_ERROR.BAD_USERNAME_PASSWORD)
50
+ errorUtils.getCode(HTTP_STATUS.UNAUTHORIZED, API_ERROR.BAD_USERNAME_PASSWORD)
51
51
  );
52
52
  }
53
53
 
@@ -55,7 +55,7 @@ export default function (route: Router, auth: IAuth, config: Config): void {
55
55
  const token = await getApiToken(auth, config, restoredRemoteUser, password);
56
56
  debug('login: new token');
57
57
  if (!token) {
58
- return next(ErrorCode.getUnauthorized());
58
+ return next(errorUtils.getUnauthorized());
59
59
  }
60
60
 
61
61
  res.status(HTTP_STATUS.CREATED);
@@ -73,7 +73,7 @@ export default function (route: Router, auth: IAuth, config: Config): void {
73
73
  if (validatePassword(password) === false) {
74
74
  debug('adduser: invalid password');
75
75
  // eslint-disable-next-line new-cap
76
- return next(ErrorCode.getCode(HTTP_STATUS.BAD_REQUEST, API_ERROR.PASSWORD_SHORT()));
76
+ return next(errorUtils.getCode(HTTP_STATUS.BAD_REQUEST, API_ERROR.PASSWORD_SHORT()));
77
77
  }
78
78
 
79
79
  auth.add_user(name, password, async function (err, user): Promise<void> {
@@ -84,7 +84,7 @@ export default function (route: Router, auth: IAuth, config: Config): void {
84
84
  // and npm accepts only an 409 error.
85
85
  // So, changing status code here.
86
86
  return next(
87
- ErrorCode.getCode(err.status, err.message) || ErrorCode.getConflict(err.message)
87
+ errorUtils.getCode(err.status, err.message) || errorUtils.getConflict(err.message)
88
88
  );
89
89
  }
90
90
  return next(err);
@@ -94,7 +94,7 @@ export default function (route: Router, auth: IAuth, config: Config): void {
94
94
  name && password ? await getApiToken(auth, config, user, password) : undefined;
95
95
  debug('adduser: new token %o', token);
96
96
  if (!token) {
97
- return next(ErrorCode.getUnauthorized());
97
+ return next(errorUtils.getUnauthorized());
98
98
  }
99
99
 
100
100
  req.remote_user = user;
package/src/v1/profile.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import _ from 'lodash';
2
2
  import { Response, Router } from 'express';
3
3
 
4
- import { API_ERROR, APP_ERROR, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/commons-api';
5
- import { ErrorCode, validatePassword } from '@verdaccio/utils';
4
+ import { API_ERROR, APP_ERROR, HTTP_STATUS, SUPPORT_ERRORS, errorUtils } from '@verdaccio/core';
5
+ import { validatePassword } from '@verdaccio/utils';
6
6
  import { IAuth } from '@verdaccio/auth';
7
7
  import { $RequestExtend, $NextFunctionVer } from '../../types/custom';
8
8
 
@@ -61,7 +61,7 @@ export default function (route: Router, auth: IAuth): void {
61
61
  if (_.isNil(password) === false) {
62
62
  if (validatePassword(password.new) === false) {
63
63
  /* eslint new-cap:off */
64
- return next(ErrorCode.getCode(HTTP_STATUS.UNAUTHORIZED, API_ERROR.PASSWORD_SHORT()));
64
+ return next(errorUtils.getCode(HTTP_STATUS.UNAUTHORIZED, API_ERROR.PASSWORD_SHORT()));
65
65
  /* eslint new-cap:off */
66
66
  }
67
67
 
@@ -72,22 +72,22 @@ export default function (route: Router, auth: IAuth): void {
72
72
  (err, isUpdated): $NextFunctionVer => {
73
73
  if (_.isNull(err) === false) {
74
74
  return next(
75
- ErrorCode.getCode(err.status, err.message) || ErrorCode.getConflict(err.message)
75
+ errorUtils.getCode(err.status, err.message) || errorUtils.getConflict(err.message)
76
76
  );
77
77
  }
78
78
 
79
79
  if (isUpdated) {
80
80
  return next(buildProfile(req.remote_user.name));
81
81
  }
82
- return next(ErrorCode.getInternalError(API_ERROR.INTERNAL_SERVER_ERROR));
82
+ return next(errorUtils.getInternalError(API_ERROR.INTERNAL_SERVER_ERROR));
83
83
  }
84
84
  );
85
85
  } else if (_.isNil(tfa) === false) {
86
86
  return next(
87
- ErrorCode.getCode(HTTP_STATUS.SERVICE_UNAVAILABLE, SUPPORT_ERRORS.TFA_DISABLED)
87
+ errorUtils.getCode(HTTP_STATUS.SERVICE_UNAVAILABLE, SUPPORT_ERRORS.TFA_DISABLED)
88
88
  );
89
89
  } else {
90
- return next(ErrorCode.getCode(HTTP_STATUS.INTERNAL_ERROR, APP_ERROR.PROFILE_ERROR));
90
+ return next(errorUtils.getCode(HTTP_STATUS.INTERNAL_ERROR, APP_ERROR.PROFILE_ERROR));
91
91
  }
92
92
  }
93
93
  );
package/src/v1/search.ts CHANGED
@@ -2,8 +2,7 @@ import _ from 'lodash';
2
2
  import buildDebug from 'debug';
3
3
  import { logger } from '@verdaccio/logger';
4
4
  import { IAuth } from '@verdaccio/auth';
5
- import { searchUtils } from '@verdaccio/core';
6
- import { HTTP_STATUS } from '@verdaccio/commons-api';
5
+ import { HTTP_STATUS, searchUtils } from '@verdaccio/core';
7
6
  import { Storage } from '@verdaccio/store';
8
7
  import { Package } from '@verdaccio/types';
9
8
 
@@ -36,16 +35,23 @@ export default function (route, auth: IAuth, storage: Storage): void {
36
35
  }
37
36
 
38
37
  route.get('/-/v1/search', async (req, res, next) => {
39
- let [size, from] = ['size', 'from'].map((k) => req.query[k]);
38
+ const { query, url } = req;
39
+ let [size, from] = ['size', 'from'].map((k) => query[k]);
40
40
  let data;
41
+ const abort = new AbortController();
42
+
43
+ req.on('aborted', () => {
44
+ abort.abort();
45
+ });
41
46
 
42
47
  size = parseInt(size, 10) || 20;
43
48
  from = parseInt(from, 10) || 0;
44
49
 
45
50
  try {
46
51
  data = await storage.searchManager?.search({
47
- query: req.query,
48
- url: req.url,
52
+ query,
53
+ url,
54
+ abort,
49
55
  });
50
56
  debug('stream finish');
51
57
  const checkAccessPromises: searchUtils.SearchItemPkg[] = await Promise.all(
package/src/v1/token.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
- import { HTTP_STATUS, SUPPORT_ERRORS, getInternalError } from '@verdaccio/commons-api';
3
- import { ErrorCode, stringToMD5, mask } from '@verdaccio/utils';
2
+ import { errorUtils, HTTP_STATUS, SUPPORT_ERRORS } from '@verdaccio/core';
3
+ import { stringToMD5, mask } from '@verdaccio/utils';
4
4
  import { getApiToken } from '@verdaccio/auth';
5
5
  import { logger } from '@verdaccio/logger';
6
6
  import { Response, Router } from 'express';
@@ -43,10 +43,10 @@ export default function (route: Router, auth: IAuth, storage: Storage, config: C
43
43
  });
44
44
  } catch (error: any) {
45
45
  logger.error({ error: error.msg }, 'token list has failed: @{error}');
46
- return next(ErrorCode.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
46
+ return next(errorUtils.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
47
47
  }
48
48
  }
49
- return next(ErrorCode.getUnauthorized());
49
+ return next(errorUtils.getUnauthorized());
50
50
  }
51
51
  );
52
52
 
@@ -57,27 +57,27 @@ export default function (route: Router, auth: IAuth, storage: Storage, config: C
57
57
  const { name } = req.remote_user;
58
58
 
59
59
  if (!_.isBoolean(readonly) || !_.isArray(cidr_whitelist)) {
60
- return next(ErrorCode.getCode(HTTP_STATUS.BAD_DATA, SUPPORT_ERRORS.PARAMETERS_NOT_VALID));
60
+ return next(errorUtils.getCode(HTTP_STATUS.BAD_DATA, SUPPORT_ERRORS.PARAMETERS_NOT_VALID));
61
61
  }
62
62
 
63
63
  auth.authenticate(name, password, async (err, user: RemoteUser) => {
64
64
  if (err) {
65
65
  const errorCode = err.message ? HTTP_STATUS.UNAUTHORIZED : HTTP_STATUS.INTERNAL_ERROR;
66
- return next(ErrorCode.getCode(errorCode, err.message));
66
+ return next(errorUtils.getCode(errorCode, err.message));
67
67
  }
68
68
 
69
69
  req.remote_user = user;
70
70
 
71
71
  if (!_.isFunction(storage.saveToken)) {
72
72
  return next(
73
- ErrorCode.getCode(HTTP_STATUS.NOT_IMPLEMENTED, SUPPORT_ERRORS.STORAGE_NOT_IMPLEMENT)
73
+ errorUtils.getCode(HTTP_STATUS.NOT_IMPLEMENTED, SUPPORT_ERRORS.STORAGE_NOT_IMPLEMENT)
74
74
  );
75
75
  }
76
76
 
77
77
  try {
78
78
  const token = await getApiToken(auth, config, user, password);
79
79
  if (!token) {
80
- throw getInternalError();
80
+ throw errorUtils.getInternalError();
81
81
  }
82
82
 
83
83
  const key = stringToMD5(token);
@@ -113,7 +113,7 @@ export default function (route: Router, auth: IAuth, storage: Storage, config: C
113
113
  );
114
114
  } catch (error: any) {
115
115
  logger.error({ error: error.msg }, 'token creation has failed: @{error}');
116
- return next(ErrorCode.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
116
+ return next(errorUtils.getInternalError(error.message));
117
117
  }
118
118
  });
119
119
  }
@@ -135,10 +135,10 @@ export default function (route: Router, auth: IAuth, storage: Storage, config: C
135
135
  return next({});
136
136
  } catch (error: any) {
137
137
  logger.error({ error: error.msg }, 'token creation has failed: @{error}');
138
- return next(ErrorCode.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
138
+ return next(errorUtils.getCode(HTTP_STATUS.INTERNAL_ERROR, error.message));
139
139
  }
140
140
  }
141
- return next(ErrorCode.getUnauthorized());
141
+ return next(errorUtils.getUnauthorized());
142
142
  }
143
143
  );
144
144
  }
package/src/whoami.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Response, Router } from 'express';
2
2
  import buildDebug from 'debug';
3
3
  import { $RequestExtend, $NextFunctionVer } from '../types/custom';
4
- // import { getUnauthorized } from '@verdaccio/commons-api';
5
4
 
6
5
  const debug = buildDebug('verdaccio:api:user');
7
6
 
@@ -5,9 +5,10 @@ import bodyParser from 'body-parser';
5
5
 
6
6
  import { Config, parseConfigFile } from '@verdaccio/config';
7
7
  import { Storage } from '@verdaccio/store';
8
+ import { generatePackageMetadata } from '@verdaccio/helper';
8
9
  import { final, handleError, errorReportingMiddleware } from '@verdaccio/middleware';
9
10
  import { Auth, IAuth } from '@verdaccio/auth';
10
- import { HEADERS, HEADER_TYPE, HTTP_STATUS, generatePackageMetadata } from '@verdaccio/commons-api';
11
+ import { HEADERS, HEADER_TYPE, HTTP_STATUS } from '@verdaccio/core';
11
12
  import apiEndpoints from '../../src';
12
13
 
13
14
  const getConf = (conf) => {
@@ -1,6 +1,6 @@
1
1
  import supertest from 'supertest';
2
2
 
3
- import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/commons-api';
3
+ import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core';
4
4
  import { $ResponseExtend, $RequestExtend } from '../../types/custom';
5
5
  import { initializeServer, publishTaggedVersion, publishVersion } from './_helper';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import supertest from 'supertest';
2
2
 
3
- import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/commons-api';
3
+ import { HEADER_TYPE, HEADERS, HTTP_STATUS } from '@verdaccio/core';
4
4
  import { initializeServer } from './_helper';
5
5
 
6
6
  describe('ping', () => {
@@ -1,12 +1,7 @@
1
- import { HTTP_STATUS } from '@verdaccio/commons-api';
1
+ import { HTTP_STATUS } from '@verdaccio/core';
2
2
  import supertest from 'supertest';
3
- import {
4
- API_ERROR,
5
- API_MESSAGE,
6
- generatePackageMetadata,
7
- HEADER_TYPE,
8
- HEADERS,
9
- } from '@verdaccio/commons-api';
3
+ import { API_ERROR, API_MESSAGE, HEADER_TYPE, HEADERS } from '@verdaccio/core';
4
+ import { generatePackageMetadata } from '@verdaccio/helper';
10
5
  import { $ResponseExtend, $RequestExtend } from '../../types/custom';
11
6
  import { initializeServer, publishVersion } from './_helper';
12
7
 
@@ -2,15 +2,13 @@ import supertest from 'supertest';
2
2
  import _ from 'lodash';
3
3
 
4
4
  import {
5
- getBadRequest,
6
- getConflict,
7
- getUnauthorized,
5
+ errorUtils,
8
6
  HEADERS,
9
7
  HEADER_TYPE,
10
8
  API_MESSAGE,
11
9
  HTTP_STATUS,
12
10
  API_ERROR,
13
- } from '@verdaccio/commons-api';
11
+ } from '@verdaccio/core';
14
12
 
15
13
  import { $RequestExtend, $ResponseExtend } from '../../types/custom';
16
14
  import { initializeServer } from './_helper';
@@ -28,7 +26,7 @@ const mockAuthenticate = jest.fn(() => (_name, _password, callback): void => {
28
26
  });
29
27
 
30
28
  const mockAddUser = jest.fn(() => (_name, _password, callback): void => {
31
- return callback(getConflict(API_ERROR.USERNAME_ALREADY_REGISTERED));
29
+ return callback(errorUtils.getConflict(API_ERROR.USERNAME_ALREADY_REGISTERED));
32
30
  });
33
31
 
34
32
  jest.mock('@verdaccio/auth', () => ({
@@ -143,7 +141,7 @@ describe('user', () => {
143
141
  }
144
142
  );
145
143
  mockAddUser.mockImplementationOnce(() => (_name, _password, callback): void => {
146
- return callback(getBadRequest(API_ERROR.USERNAME_PASSWORD_REQUIRED));
144
+ return callback(errorUtils.getBadRequest(API_ERROR.USERNAME_PASSWORD_REQUIRED));
147
145
  });
148
146
  const credentialsShort = _.cloneDeep(credentials);
149
147
  delete credentialsShort.name;
@@ -208,7 +206,7 @@ describe('user', () => {
208
206
  }
209
207
  );
210
208
  mockAuthenticate.mockImplementationOnce(() => (_name, _password, callback): void => {
211
- return callback(getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
209
+ return callback(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
212
210
  });
213
211
  const credentialsShort = _.cloneDeep(credentials);
214
212
  credentialsShort.password = 'failPassword';
@@ -240,7 +238,7 @@ describe('user', () => {
240
238
  }
241
239
  );
242
240
  mockAuthenticate.mockImplementationOnce(() => (_name, _password, callback): void => {
243
- return callback(getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
241
+ return callback(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
244
242
  });
245
243
  const credentialsShort = _.cloneDeep(credentials);
246
244
  credentialsShort.password = 'failPassword';
@@ -1,6 +1,6 @@
1
1
  import supertest from 'supertest';
2
2
 
3
- import { HEADERS, HTTP_STATUS } from '@verdaccio/commons-api';
3
+ import { HEADERS, HTTP_STATUS } from '@verdaccio/core';
4
4
 
5
5
  import { $RequestExtend, $ResponseExtend } from '../../types/custom';
6
6
  import { initializeServer } from './_helper';
@@ -1,5 +1,4 @@
1
- import { HTTP_STATUS, API_ERROR } from '@verdaccio/commons-api';
2
- import { ErrorCode } from '@verdaccio/utils';
1
+ import { errorUtils, HTTP_STATUS, API_ERROR } from '@verdaccio/core';
3
2
  import {
4
3
  addVersion,
5
4
  uploadPackageTarball,
@@ -202,13 +201,13 @@ describe('Publish endpoints - un-publish package', () => {
202
201
  const storage = {
203
202
  removePackage(packageName) {
204
203
  expect(packageName).toEqual(req.params.package);
205
- return Promise.reject(ErrorCode.getInternalError());
204
+ return Promise.reject(errorUtils.getInternalError());
206
205
  },
207
206
  };
208
207
 
209
208
  // @ts-ignore
210
209
  await unPublishPackage(storage)(req, res, next);
211
- expect(next).toHaveBeenCalledWith(ErrorCode.getInternalError());
210
+ expect(next).toHaveBeenCalledWith(errorUtils.getInternalError());
212
211
  });
213
212
  });
214
213
 
package/tsconfig.json CHANGED
@@ -13,9 +13,6 @@
13
13
  {
14
14
  "path": "../config"
15
15
  },
16
- {
17
- "path": "../core/commons-api"
18
- },
19
16
  {
20
17
  "path": "../core/core"
21
18
  },