@verdaccio/api 6.0.0-6-next.33 → 6.0.0-6-next.35
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 +38 -0
- package/build/dist-tags.js +2 -24
- package/build/dist-tags.js.map +1 -1
- package/build/index.js +14 -30
- package/build/index.js.map +1 -1
- package/build/package.js +3 -15
- package/build/package.js.map +1 -1
- package/build/ping.js +0 -1
- package/build/ping.js.map +1 -1
- package/build/publish.js +4 -19
- package/build/publish.js.map +1 -1
- package/build/search.js +0 -4
- package/build/search.js.map +1 -1
- package/build/stars.js +6 -8
- package/build/stars.js.map +1 -1
- package/build/user.js +7 -27
- package/build/user.js.map +1 -1
- package/build/v1/profile.js +0 -11
- package/build/v1/profile.js.map +1 -1
- package/build/v1/search.js +1 -13
- package/build/v1/search.js.map +1 -1
- package/build/v1/token.d.ts +1 -1
- package/build/v1/token.js +8 -35
- package/build/v1/token.js.map +1 -1
- package/build/whoami.js +0 -8
- package/build/whoami.js.map +1 -1
- package/package.json +11 -11
- package/src/dist-tags.ts +0 -20
- package/src/stars.ts +7 -5
- package/src/user.ts +10 -1
- package/src/v1/token.ts +2 -1
- package/test/integration/_helper.ts +42 -3
- package/test/integration/config/star.yaml +26 -0
- package/test/integration/publish.spec.ts +17 -48
- package/test/integration/star.spec.ts +73 -0
- package/types/custom.d.ts +1 -1
- package/build/star.d.ts +0 -4
- package/build/star.js +0 -90
- package/build/star.js.map +0 -1
- package/src/star.ts +0 -88
package/src/star.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import buildDebug from 'debug';
|
|
3
|
-
import { Response } from 'express';
|
|
4
|
-
import _ from 'lodash';
|
|
5
|
-
|
|
6
|
-
import { HTTP_STATUS, USERS } from '@verdaccio/core';
|
|
7
|
-
import { Storage } from '@verdaccio/store';
|
|
8
|
-
|
|
9
|
-
import { $NextFunctionVer, $RequestExtend } from '../types/custom';
|
|
10
|
-
|
|
11
|
-
const debug = buildDebug('verdaccio:api:publish:star');
|
|
12
|
-
|
|
13
|
-
export default function (
|
|
14
|
-
storage: Storage
|
|
15
|
-
): (req: $RequestExtend, res: Response, next: $NextFunctionVer) => void {
|
|
16
|
-
const validateInputs = (newUsers, localUsers, username, isStar): boolean => {
|
|
17
|
-
const isExistlocalUsers = _.isNil(localUsers[username]) === false;
|
|
18
|
-
if (isStar && isExistlocalUsers && localUsers[username]) {
|
|
19
|
-
return true;
|
|
20
|
-
} else if (!isStar && isExistlocalUsers) {
|
|
21
|
-
return false;
|
|
22
|
-
} else if (!isStar && !isExistlocalUsers) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return (req: $RequestExtend, res: Response, next: $NextFunctionVer): void => {
|
|
29
|
-
const name = req.params.package;
|
|
30
|
-
debug('starring a package for %o', name);
|
|
31
|
-
// const afterChangePackage = function (err?: Error) {
|
|
32
|
-
// if (err) {
|
|
33
|
-
// debug('error on update package for %o', name);
|
|
34
|
-
// return next(err);
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
// debug('succes update package for %o', name);
|
|
38
|
-
// res.status(HTTP_STATUS.OK);
|
|
39
|
-
// next({
|
|
40
|
-
// success: true,
|
|
41
|
-
// });
|
|
42
|
-
// };
|
|
43
|
-
|
|
44
|
-
debug('get package info package for %o', name);
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
// storage.getPackage({
|
|
47
|
-
// name,
|
|
48
|
-
// req,
|
|
49
|
-
// callback: function (err, info) {
|
|
50
|
-
// if (err) {
|
|
51
|
-
// debug('error on get package info package for %o', name);
|
|
52
|
-
// return next(err);
|
|
53
|
-
// }
|
|
54
|
-
// const newStarUser = req.body[USERS];
|
|
55
|
-
// const remoteUsername = req.remote_user.name;
|
|
56
|
-
// const localStarUsers = info[USERS];
|
|
57
|
-
// // Check is star or unstar
|
|
58
|
-
// const isStar = Object.keys(newStarUser).includes(remoteUsername);
|
|
59
|
-
// debug('is start? %o', isStar);
|
|
60
|
-
// if (
|
|
61
|
-
// _.isNil(localStarUsers) === false &&
|
|
62
|
-
// validateInputs(newStarUser, localStarUsers, remoteUsername, isStar)
|
|
63
|
-
// ) {
|
|
64
|
-
// return afterChangePackage();
|
|
65
|
-
// }
|
|
66
|
-
// const users = isStar
|
|
67
|
-
// ? {
|
|
68
|
-
// ...localStarUsers,
|
|
69
|
-
// [remoteUsername]: true,
|
|
70
|
-
// }
|
|
71
|
-
// : _.reduce(
|
|
72
|
-
// localStarUsers,
|
|
73
|
-
// (users, value, key) => {
|
|
74
|
-
// if (key !== remoteUsername) {
|
|
75
|
-
// users[key] = value;
|
|
76
|
-
// }
|
|
77
|
-
// return users;
|
|
78
|
-
// },
|
|
79
|
-
// {}
|
|
80
|
-
// );
|
|
81
|
-
// debug('update package for %o', name);
|
|
82
|
-
// storage.changePackage(name, { ...info, users }, req.body._rev, function (err) {
|
|
83
|
-
// afterChangePackage(err);
|
|
84
|
-
// });
|
|
85
|
-
// },
|
|
86
|
-
// });
|
|
87
|
-
};
|
|
88
|
-
}
|