verdaccio-auth-memory 13.0.3 → 13.1.0
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/build/Memory.js +106 -142
- package/build/Memory.js.map +1 -1
- package/build/Memory.mjs +106 -0
- package/build/Memory.mjs.map +1 -0
- package/build/_virtual/_rolldown/runtime.js +23 -0
- package/build/index.js +10 -14
- package/build/index.js.map +1 -1
- package/build/index.mjs +7 -0
- package/build/index.mjs.map +1 -0
- package/package.json +36 -23
- package/build/types/index.js +0 -6
- package/build/types/index.js.map +0 -1
package/build/Memory.js
CHANGED
|
@@ -1,144 +1,108 @@
|
|
|
1
|
-
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
let debug = require("debug");
|
|
3
|
+
debug = require_runtime.__toESM(debug);
|
|
4
|
+
let _verdaccio_core = require("@verdaccio/core");
|
|
5
|
+
//#region src/Memory.ts
|
|
6
|
+
var debug$1 = (0, debug.default)("verdaccio:plugin:auth:memory:user");
|
|
7
|
+
var { Plugin } = _verdaccio_core.pluginUtils;
|
|
8
|
+
var Memory = class extends Plugin {
|
|
9
|
+
_logger;
|
|
10
|
+
_users;
|
|
11
|
+
_config;
|
|
12
|
+
_app_config;
|
|
13
|
+
constructor(config, appOptions) {
|
|
14
|
+
super(config, appOptions);
|
|
15
|
+
this._users = config.users || {};
|
|
16
|
+
this._config = config;
|
|
17
|
+
this._logger = appOptions.logger;
|
|
18
|
+
this._app_config = appOptions.config;
|
|
19
|
+
}
|
|
20
|
+
authenticate(user, password, cb) {
|
|
21
|
+
debug$1("authenticate %o:%o", user, password);
|
|
22
|
+
const userCredentials = this._users[user];
|
|
23
|
+
if (!userCredentials) {
|
|
24
|
+
debug$1("user %o does not exist", user);
|
|
25
|
+
return cb(null, false);
|
|
26
|
+
}
|
|
27
|
+
if (password !== userCredentials.password) {
|
|
28
|
+
const err = _verdaccio_core.errorUtils.getUnauthorized(_verdaccio_core.API_ERROR.BAD_USERNAME_PASSWORD);
|
|
29
|
+
debug$1("password invalid for: %o", user);
|
|
30
|
+
return cb(err);
|
|
31
|
+
}
|
|
32
|
+
debug$1("authentication succeed for %o", user);
|
|
33
|
+
return cb(null, [user]);
|
|
34
|
+
}
|
|
35
|
+
adduser(user, password, cb) {
|
|
36
|
+
if (this._users[user]) {
|
|
37
|
+
debug$1("user %o already exist", user);
|
|
38
|
+
return cb(null, true);
|
|
39
|
+
}
|
|
40
|
+
if (this._app_config.max_users) {
|
|
41
|
+
if (Object.keys(this._users).length >= this._app_config.max_users) {
|
|
42
|
+
const err = _verdaccio_core.errorUtils.getConflict(_verdaccio_core.API_ERROR.MAX_USERS_REACHED);
|
|
43
|
+
debug$1(_verdaccio_core.API_ERROR.MAX_USERS_REACHED);
|
|
44
|
+
return cb(err);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
this._users[user] = {
|
|
48
|
+
name: user,
|
|
49
|
+
password
|
|
50
|
+
};
|
|
51
|
+
debug$1("user added succeeded for %o", user);
|
|
52
|
+
cb(null, user);
|
|
53
|
+
}
|
|
54
|
+
changePassword(username, password, newPassword, cb) {
|
|
55
|
+
const user = this._users[username];
|
|
56
|
+
debug$1("init change password for %o", user?.name);
|
|
57
|
+
if (user && user.password === password) {
|
|
58
|
+
user.password = newPassword;
|
|
59
|
+
this._users[username] = user;
|
|
60
|
+
debug$1("user changed password succeeded for %o", user?.name);
|
|
61
|
+
cb(null, true);
|
|
62
|
+
} else {
|
|
63
|
+
const err = _verdaccio_core.errorUtils.getNotFound("user not found");
|
|
64
|
+
this._logger.debug({ user: username }, "change password user @{user} not found");
|
|
65
|
+
debug$1("change password user for %o not found", user?.name);
|
|
66
|
+
return cb(err);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
allow_access(user, pkg, cb) {
|
|
70
|
+
debug$1("allow access for %o", user);
|
|
71
|
+
if (pkg?.access?.includes("$all") || pkg?.access?.includes("$anonymous")) {
|
|
72
|
+
debug$1("%o has been granted access", user?.name);
|
|
73
|
+
return cb(null, true);
|
|
74
|
+
}
|
|
75
|
+
if (!user?.name) {
|
|
76
|
+
const err = _verdaccio_core.errorUtils.getForbidden("not allowed to access package");
|
|
77
|
+
this._logger.debug({ user: user.name }, "user: @{user} not allowed to access package");
|
|
78
|
+
debug$1("%o not allowed to access package err", user?.name, err.message);
|
|
79
|
+
return cb(err);
|
|
80
|
+
}
|
|
81
|
+
if (pkg?.access?.includes(user?.name) || pkg?.access?.includes("$authenticated")) {
|
|
82
|
+
debug$1("%o has been granted access", user?.name);
|
|
83
|
+
return cb(null, true);
|
|
84
|
+
}
|
|
85
|
+
const err = _verdaccio_core.errorUtils.getForbidden("not allowed to access package");
|
|
86
|
+
debug$1("%o not allowed to access package err", user?.name, err?.message);
|
|
87
|
+
return cb(err);
|
|
88
|
+
}
|
|
89
|
+
allow_publish(user, pkg, cb) {
|
|
90
|
+
if (pkg?.publish?.includes("$all") || pkg?.publish?.includes("$anonymous")) {
|
|
91
|
+
debug$1("%o has been granted to publish", user?.name);
|
|
92
|
+
return cb(null, true);
|
|
93
|
+
}
|
|
94
|
+
if (!user?.name) {
|
|
95
|
+
const err = _verdaccio_core.errorUtils.getForbidden("not allowed to publish package");
|
|
96
|
+
debug$1("%o not allowed to publish package err %o", user?.name, err.message);
|
|
97
|
+
return cb(err);
|
|
98
|
+
}
|
|
99
|
+
if (pkg?.publish?.includes(user.name) || pkg?.publish?.includes("$authenticated")) return cb(null, true);
|
|
100
|
+
const err = _verdaccio_core.errorUtils.getForbidden("not allowed to publish package");
|
|
101
|
+
debug$1("%o not allowed to publish package err %o", user?.name, err.message);
|
|
102
|
+
return cb(err);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
exports.default = Memory;
|
|
2
107
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
9
|
-
var _core = require("@verdaccio/core");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
13
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
18
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
19
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
21
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
22
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
23
|
-
var debug = (0, _debug["default"])('verdaccio:plugin:auth:memory:user');
|
|
24
|
-
var Plugin = _core.pluginUtils.Plugin;
|
|
25
|
-
var Memory = exports["default"] = /*#__PURE__*/function (_Plugin) {
|
|
26
|
-
function Memory(config, appOptions) {
|
|
27
|
-
var _this;
|
|
28
|
-
_classCallCheck(this, Memory);
|
|
29
|
-
_this = _callSuper(this, Memory, [config, appOptions]);
|
|
30
|
-
_this._users = config.users || {};
|
|
31
|
-
_this._config = config;
|
|
32
|
-
_this._logger = appOptions.logger;
|
|
33
|
-
_this._app_config = appOptions.config;
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
_inherits(Memory, _Plugin);
|
|
37
|
-
return _createClass(Memory, [{
|
|
38
|
-
key: "authenticate",
|
|
39
|
-
value: function authenticate(user, password, cb) {
|
|
40
|
-
debug('authenticate %o:%o', user, password);
|
|
41
|
-
var userCredentials = this._users[user];
|
|
42
|
-
if (!userCredentials) {
|
|
43
|
-
debug('user %o does not exist', user);
|
|
44
|
-
return cb(null, false);
|
|
45
|
-
}
|
|
46
|
-
if (password !== userCredentials.password) {
|
|
47
|
-
var err = _core.errorUtils.getUnauthorized(_core.API_ERROR.BAD_USERNAME_PASSWORD);
|
|
48
|
-
debug('password invalid for: %o', user);
|
|
49
|
-
return cb(err);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// authentication succeeded!
|
|
53
|
-
// return all usergroups this user has access to;
|
|
54
|
-
debug('authentication succeed for %o', user);
|
|
55
|
-
return cb(null, [user]);
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
key: "adduser",
|
|
59
|
-
value: function adduser(user, password, cb) {
|
|
60
|
-
if (this._users[user]) {
|
|
61
|
-
debug('user %o already exist', user);
|
|
62
|
-
return cb(null, true);
|
|
63
|
-
}
|
|
64
|
-
if (this._app_config.max_users) {
|
|
65
|
-
if (Object.keys(this._users).length >= this._app_config.max_users) {
|
|
66
|
-
var err = _core.errorUtils.getConflict(_core.API_ERROR.MAX_USERS_REACHED);
|
|
67
|
-
debug(_core.API_ERROR.MAX_USERS_REACHED);
|
|
68
|
-
return cb(err);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
this._users[user] = {
|
|
72
|
-
name: user,
|
|
73
|
-
password: password
|
|
74
|
-
};
|
|
75
|
-
debug('user added succeeded for %o', user);
|
|
76
|
-
cb(null, user);
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "changePassword",
|
|
80
|
-
value: function changePassword(username, password, newPassword, cb) {
|
|
81
|
-
var user = this._users[username];
|
|
82
|
-
debug('init change password for %o', user === null || user === void 0 ? void 0 : user.name);
|
|
83
|
-
if (user && user.password === password) {
|
|
84
|
-
user.password = newPassword;
|
|
85
|
-
this._users[username] = user;
|
|
86
|
-
debug('user changed password succeeded for %o', user === null || user === void 0 ? void 0 : user.name);
|
|
87
|
-
cb(null, true);
|
|
88
|
-
} else {
|
|
89
|
-
var err = _core.errorUtils.getNotFound('user not found');
|
|
90
|
-
this._logger.debug({
|
|
91
|
-
user: username
|
|
92
|
-
}, 'change password user @{user} not found');
|
|
93
|
-
debug('change password user for %o not found', user === null || user === void 0 ? void 0 : user.name);
|
|
94
|
-
return cb(err);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "allow_access",
|
|
99
|
-
value: function allow_access(user, pkg, cb) {
|
|
100
|
-
var _pkg$access, _pkg$access2, _pkg$access3, _pkg$access4;
|
|
101
|
-
debug('allow access for %o', user);
|
|
102
|
-
if (pkg !== null && pkg !== void 0 && (_pkg$access = pkg.access) !== null && _pkg$access !== void 0 && _pkg$access.includes('$all') || pkg !== null && pkg !== void 0 && (_pkg$access2 = pkg.access) !== null && _pkg$access2 !== void 0 && _pkg$access2.includes('$anonymous')) {
|
|
103
|
-
debug('%o has been granted access', user === null || user === void 0 ? void 0 : user.name);
|
|
104
|
-
return cb(null, true);
|
|
105
|
-
}
|
|
106
|
-
if (!(user !== null && user !== void 0 && user.name)) {
|
|
107
|
-
var _err = _core.errorUtils.getForbidden('not allowed to access package');
|
|
108
|
-
this._logger.debug({
|
|
109
|
-
user: user.name
|
|
110
|
-
}, 'user: @{user} not allowed to access package');
|
|
111
|
-
debug('%o not allowed to access package err', user === null || user === void 0 ? void 0 : user.name, _err.message);
|
|
112
|
-
return cb(_err);
|
|
113
|
-
}
|
|
114
|
-
if (pkg !== null && pkg !== void 0 && (_pkg$access3 = pkg.access) !== null && _pkg$access3 !== void 0 && _pkg$access3.includes(user === null || user === void 0 ? void 0 : user.name) || pkg !== null && pkg !== void 0 && (_pkg$access4 = pkg.access) !== null && _pkg$access4 !== void 0 && _pkg$access4.includes('$authenticated')) {
|
|
115
|
-
debug('%o has been granted access', user === null || user === void 0 ? void 0 : user.name);
|
|
116
|
-
return cb(null, true);
|
|
117
|
-
}
|
|
118
|
-
var err = _core.errorUtils.getForbidden('not allowed to access package');
|
|
119
|
-
debug('%o not allowed to access package err', user === null || user === void 0 ? void 0 : user.name, err === null || err === void 0 ? void 0 : err.message);
|
|
120
|
-
return cb(err);
|
|
121
|
-
}
|
|
122
|
-
}, {
|
|
123
|
-
key: "allow_publish",
|
|
124
|
-
value: function allow_publish(user, pkg, cb) {
|
|
125
|
-
var _pkg$publish, _pkg$publish2, _pkg$publish3, _pkg$publish4;
|
|
126
|
-
if (pkg !== null && pkg !== void 0 && (_pkg$publish = pkg.publish) !== null && _pkg$publish !== void 0 && _pkg$publish.includes('$all') || pkg !== null && pkg !== void 0 && (_pkg$publish2 = pkg.publish) !== null && _pkg$publish2 !== void 0 && _pkg$publish2.includes('$anonymous')) {
|
|
127
|
-
debug('%o has been granted to publish', user === null || user === void 0 ? void 0 : user.name);
|
|
128
|
-
return cb(null, true);
|
|
129
|
-
}
|
|
130
|
-
if (!(user !== null && user !== void 0 && user.name)) {
|
|
131
|
-
var _err2 = _core.errorUtils.getForbidden('not allowed to publish package');
|
|
132
|
-
debug('%o not allowed to publish package err %o', user === null || user === void 0 ? void 0 : user.name, _err2.message);
|
|
133
|
-
return cb(_err2);
|
|
134
|
-
}
|
|
135
|
-
if (pkg !== null && pkg !== void 0 && (_pkg$publish3 = pkg.publish) !== null && _pkg$publish3 !== void 0 && _pkg$publish3.includes(user.name) || pkg !== null && pkg !== void 0 && (_pkg$publish4 = pkg.publish) !== null && _pkg$publish4 !== void 0 && _pkg$publish4.includes('$authenticated')) {
|
|
136
|
-
return cb(null, true);
|
|
137
|
-
}
|
|
138
|
-
var err = _core.errorUtils.getForbidden('not allowed to publish package');
|
|
139
|
-
debug('%o not allowed to publish package err %o', user === null || user === void 0 ? void 0 : user.name, err.message);
|
|
140
|
-
return cb(err);
|
|
141
|
-
}
|
|
142
|
-
}]);
|
|
143
|
-
}(Plugin);
|
|
144
108
|
//# sourceMappingURL=Memory.js.map
|
package/build/Memory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Memory.js","names":["_debug","_interopRequireDefault","require","_core","e","__esModule","_classCallCheck","a","n","TypeError","_defineProperties","r","t","length","o","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","prototype","i","_toPrimitive","_typeof","Symbol","toPrimitive","call","String","Number","_callSuper","_getPrototypeOf","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","constructor","apply","_assertThisInitialized","ReferenceError","Boolean","valueOf","setPrototypeOf","getPrototypeOf","bind","__proto__","_inherits","create","value","_setPrototypeOf","debug","buildDebug","Plugin","pluginUtils","Memory","exports","_Plugin","config","appOptions","_this","_users","users","_config","_logger","logger","_app_config","authenticate","user","password","cb","userCredentials","err","errorUtils","getUnauthorized","API_ERROR","BAD_USERNAME_PASSWORD","adduser","max_users","keys","getConflict","MAX_USERS_REACHED","name","changePassword","username","newPassword","getNotFound","allow_access","pkg","_pkg$access","_pkg$access2","_pkg$access3","_pkg$access4","access","includes","getForbidden","message","allow_publish","_pkg$publish","_pkg$publish2","_pkg$publish3","_pkg$publish4","publish"],"sources":["../src/Memory.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nimport { API_ERROR, errorUtils, pluginUtils } from '@verdaccio/core';\nimport type { Config, Logger, PackageAccess, RemoteUser } from '@verdaccio/types';\n\nimport type { Users, VerdaccioMemoryConfig } from './types';\n\nconst debug = buildDebug('verdaccio:plugin:auth:memory:user');\n\nconst { Plugin } = pluginUtils;\n\nexport default class Memory\n extends Plugin<VerdaccioMemoryConfig>\n implements pluginUtils.Auth<VerdaccioMemoryConfig>\n{\n public _logger: Logger;\n public _users: Users;\n public _config: {};\n public _app_config: Config;\n\n public constructor(config: VerdaccioMemoryConfig, appOptions: pluginUtils.PluginOptions) {\n super(config, appOptions);\n this._users = config.users || {};\n this._config = config;\n this._logger = appOptions.logger;\n this._app_config = appOptions.config;\n }\n\n public authenticate(user: string, password: string, cb: pluginUtils.AuthCallback): void {\n debug('authenticate %o:%o', user, password);\n const userCredentials = this._users[user];\n\n if (!userCredentials) {\n debug('user %o does not exist', user);\n return cb(null, false);\n }\n\n if (password !== userCredentials.password) {\n const err = errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD);\n debug('password invalid for: %o', user);\n\n return cb(err);\n }\n\n // authentication succeeded!\n // return all usergroups this user has access to;\n debug('authentication succeed for %o', user);\n return cb(null, [user]);\n }\n\n public adduser(user: string, password: string, cb: pluginUtils.AuthUserCallback): void {\n if (this._users[user]) {\n debug('user %o already exist', user);\n return cb(null, true);\n }\n\n if (this._app_config.max_users) {\n if (Object.keys(this._users).length >= this._app_config.max_users) {\n const err = errorUtils.getConflict(API_ERROR.MAX_USERS_REACHED);\n debug(API_ERROR.MAX_USERS_REACHED);\n return cb(err);\n }\n }\n\n this._users[user] = { name: user, password: password };\n\n debug('user added succeeded for %o', user);\n cb(null, user);\n }\n\n public changePassword(\n username: string,\n password: string,\n newPassword: string,\n cb: pluginUtils.AuthChangePasswordCallback\n ): void {\n const user = this._users[username];\n debug('init change password for %o', user?.name);\n\n if (user && user.password === password) {\n user.password = newPassword;\n this._users[username] = user;\n debug('user changed password succeeded for %o', user?.name);\n cb(null, true);\n } else {\n const err = errorUtils.getNotFound('user not found');\n this._logger.debug({ user: username }, 'change password user @{user} not found');\n debug('change password user for %o not found', user?.name);\n return cb(err);\n }\n }\n\n public allow_access(user: RemoteUser, pkg: PackageAccess, cb: pluginUtils.AccessCallback): void {\n debug('allow access for %o', user);\n if (pkg?.access?.includes('$all') || pkg?.access?.includes('$anonymous')) {\n debug('%o has been granted access', user?.name);\n\n return cb(null, true);\n }\n\n if (!user?.name) {\n const err = errorUtils.getForbidden('not allowed to access package');\n this._logger.debug({ user: user.name }, 'user: @{user} not allowed to access package');\n debug('%o not allowed to access package err', user?.name, err.message);\n return cb(err);\n }\n\n if (pkg?.access?.includes(user?.name) || pkg?.access?.includes('$authenticated')) {\n debug('%o has been granted access', user?.name);\n return cb(null, true);\n }\n\n const err = errorUtils.getForbidden('not allowed to access package');\n debug('%o not allowed to access package err', user?.name, err?.message);\n return cb(err);\n }\n\n public allow_publish(\n user: RemoteUser,\n pkg: PackageAccess,\n cb: pluginUtils.AuthAccessCallback\n ): void {\n if (pkg?.publish?.includes('$all') || pkg?.publish?.includes('$anonymous')) {\n debug('%o has been granted to publish', user?.name);\n return cb(null, true);\n }\n\n if (!user?.name) {\n const err = errorUtils.getForbidden('not allowed to publish package');\n debug('%o not allowed to publish package err %o', user?.name, err.message);\n return cb(err);\n }\n\n if (pkg?.publish?.includes(user.name) || pkg?.publish?.includes('$authenticated')) {\n return cb(null, true);\n }\n\n const err = errorUtils.getForbidden('not allowed to publish package');\n debug('%o not allowed to publish package err %o', user?.name, err.message);\n\n return cb(err);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAAqE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,UAAAD,CAAA,YAAAC,CAAA,aAAAC,SAAA;AAAA,SAAAC,kBAAAN,CAAA,EAAAO,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAD,CAAA,CAAAE,MAAA,EAAAD,CAAA,UAAAE,CAAA,GAAAH,CAAA,CAAAC,CAAA,GAAAE,CAAA,CAAAC,UAAA,GAAAD,CAAA,CAAAC,UAAA,QAAAD,CAAA,CAAAE,YAAA,kBAAAF,CAAA,KAAAA,CAAA,CAAAG,QAAA,QAAAC,MAAA,CAAAC,cAAA,CAAAf,CAAA,EAAAgB,cAAA,CAAAN,CAAA,CAAAO,GAAA,GAAAP,CAAA;AAAA,SAAAQ,aAAAlB,CAAA,EAAAO,CAAA,EAAAC,CAAA,WAAAD,CAAA,IAAAD,iBAAA,CAAAN,CAAA,CAAAmB,SAAA,EAAAZ,CAAA,GAAAC,CAAA,IAAAF,iBAAA,CAAAN,CAAA,EAAAQ,CAAA,GAAAM,MAAA,CAAAC,cAAA,CAAAf,CAAA,iBAAAa,QAAA,SAAAb,CAAA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nD,OAAOZ,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;MACvB;MAEA,IAAI,EAACF,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEc,IAAI,GAAE;QACf,IAAMV,KAAG,GAAGC,gBAAU,CAACsB,YAAY,CAAC,gCAAgC,CAAC;QACrE5C,KAAK,CAAC,0CAA0C,EAAEiB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEc,IAAI,EAAEV,KAAG,CAACwB,OAAO,CAAC;QAC1E,OAAO1B,EAAE,CAACE,KAAG,CAAC;MAChB;MAEA,IAAIgB,GAAG,aAAHA,GAAG,gBAAAY,aAAA,GAAHZ,GAAG,CAAEc,OAAO,cAAAF,aAAA,eAAZA,aAAA,CAAcN,QAAQ,CAAC1B,IAAI,CAACc,IAAI,CAAC,IAAIM,GAAG,aAAHA,GAAG,gBAAAa,aAAA,GAAHb,GAAG,CAAEc,OAAO,cAAAD,aAAA,eAAZA,aAAA,CAAcP,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QACjF,OAAOxB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;MACvB;MAEA,IAAME,GAAG,GAAGC,gBAAU,CAACsB,YAAY,CAAC,gCAAgC,CAAC;MACrE5C,KAAK,CAAC,0CAA0C,EAAEiB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEc,IAAI,EAAEV,GAAG,CAACwB,OAAO,CAAC;MAE1E,OAAO1B,EAAE,CAACE,GAAG,CAAC;IAChB;EAAC;AAAA,EAjIOnB,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Memory.js","names":[],"sources":["../src/Memory.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nimport { API_ERROR, errorUtils, pluginUtils } from '@verdaccio/core';\nimport type { Config, Logger, PackageAccess, RemoteUser } from '@verdaccio/types';\n\nimport type { Users, VerdaccioMemoryConfig } from './types';\n\nconst debug = buildDebug('verdaccio:plugin:auth:memory:user');\n\nconst { Plugin } = pluginUtils;\n\nexport default class Memory\n extends Plugin<VerdaccioMemoryConfig>\n implements pluginUtils.Auth<VerdaccioMemoryConfig>\n{\n public _logger: Logger;\n public _users: Users;\n public _config: {};\n public _app_config: Config;\n\n public constructor(config: VerdaccioMemoryConfig, appOptions: pluginUtils.PluginOptions) {\n super(config, appOptions);\n this._users = config.users || {};\n this._config = config;\n this._logger = appOptions.logger;\n this._app_config = appOptions.config;\n }\n\n public authenticate(user: string, password: string, cb: pluginUtils.AuthCallback): void {\n debug('authenticate %o:%o', user, password);\n const userCredentials = this._users[user];\n\n if (!userCredentials) {\n debug('user %o does not exist', user);\n return cb(null, false);\n }\n\n if (password !== userCredentials.password) {\n const err = errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD);\n debug('password invalid for: %o', user);\n\n return cb(err);\n }\n\n // authentication succeeded!\n // return all usergroups this user has access to;\n debug('authentication succeed for %o', user);\n return cb(null, [user]);\n }\n\n public adduser(user: string, password: string, cb: pluginUtils.AuthUserCallback): void {\n if (this._users[user]) {\n debug('user %o already exist', user);\n return cb(null, true);\n }\n\n if (this._app_config.max_users) {\n if (Object.keys(this._users).length >= this._app_config.max_users) {\n const err = errorUtils.getConflict(API_ERROR.MAX_USERS_REACHED);\n debug(API_ERROR.MAX_USERS_REACHED);\n return cb(err);\n }\n }\n\n this._users[user] = { name: user, password: password };\n\n debug('user added succeeded for %o', user);\n cb(null, user);\n }\n\n public changePassword(\n username: string,\n password: string,\n newPassword: string,\n cb: pluginUtils.AuthChangePasswordCallback\n ): void {\n const user = this._users[username];\n debug('init change password for %o', user?.name);\n\n if (user && user.password === password) {\n user.password = newPassword;\n this._users[username] = user;\n debug('user changed password succeeded for %o', user?.name);\n cb(null, true);\n } else {\n const err = errorUtils.getNotFound('user not found');\n this._logger.debug({ user: username }, 'change password user @{user} not found');\n debug('change password user for %o not found', user?.name);\n return cb(err);\n }\n }\n\n public allow_access(user: RemoteUser, pkg: PackageAccess, cb: pluginUtils.AccessCallback): void {\n debug('allow access for %o', user);\n if (pkg?.access?.includes('$all') || pkg?.access?.includes('$anonymous')) {\n debug('%o has been granted access', user?.name);\n\n return cb(null, true);\n }\n\n if (!user?.name) {\n const err = errorUtils.getForbidden('not allowed to access package');\n this._logger.debug({ user: user.name }, 'user: @{user} not allowed to access package');\n debug('%o not allowed to access package err', user?.name, err.message);\n return cb(err);\n }\n\n if (pkg?.access?.includes(user?.name) || pkg?.access?.includes('$authenticated')) {\n debug('%o has been granted access', user?.name);\n return cb(null, true);\n }\n\n const err = errorUtils.getForbidden('not allowed to access package');\n debug('%o not allowed to access package err', user?.name, err?.message);\n return cb(err);\n }\n\n public allow_publish(\n user: RemoteUser,\n pkg: PackageAccess,\n cb: pluginUtils.AuthAccessCallback\n ): void {\n if (pkg?.publish?.includes('$all') || pkg?.publish?.includes('$anonymous')) {\n debug('%o has been granted to publish', user?.name);\n return cb(null, true);\n }\n\n if (!user?.name) {\n const err = errorUtils.getForbidden('not allowed to publish package');\n debug('%o not allowed to publish package err %o', user?.name, err.message);\n return cb(err);\n }\n\n if (pkg?.publish?.includes(user.name) || pkg?.publish?.includes('$authenticated')) {\n return cb(null, true);\n }\n\n const err = errorUtils.getForbidden('not allowed to publish package');\n debug('%o not allowed to publish package err %o', user?.name, err.message);\n\n return cb(err);\n }\n}\n"],"mappings":";;;;;AAOA,IAAM,WAAA,GAAA,MAAA,SAAmB,mCAAmC;AAE5D,IAAM,EAAE,WAAW,gBAAA;AAEnB,IAAqB,SAArB,cACU,OAEV;CACE;CACA;CACA;CACA;CAEA,YAAmB,QAA+B,YAAuC;EACvF,MAAM,QAAQ,UAAU;EACxB,KAAK,SAAS,OAAO,SAAS,CAAC;EAC/B,KAAK,UAAU;EACf,KAAK,UAAU,WAAW;EAC1B,KAAK,cAAc,WAAW;CAChC;CAEA,aAAoB,MAAc,UAAkB,IAAoC;EACtF,QAAM,sBAAsB,MAAM,QAAQ;EAC1C,MAAM,kBAAkB,KAAK,OAAO;EAEpC,IAAI,CAAC,iBA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
import { API_ERROR, errorUtils, pluginUtils } from "@verdaccio/core";
|
|
3
|
+
//#region src/Memory.ts
|
|
4
|
+
var debug = buildDebug("verdaccio:plugin:auth:memory:user");
|
|
5
|
+
var { Plugin } = pluginUtils;
|
|
6
|
+
var Memory = class extends Plugin {
|
|
7
|
+
_logger;
|
|
8
|
+
_users;
|
|
9
|
+
_config;
|
|
10
|
+
_app_config;
|
|
11
|
+
constructor(config, appOptions) {
|
|
12
|
+
super(config, appOptions);
|
|
13
|
+
this._users = config.users || {};
|
|
14
|
+
this._config = config;
|
|
15
|
+
this._logger = appOptions.logger;
|
|
16
|
+
this._app_config = appOptions.config;
|
|
17
|
+
}
|
|
18
|
+
authenticate(user, password, cb) {
|
|
19
|
+
debug("authenticate %o:%o", user, password);
|
|
20
|
+
const userCredentials = this._users[user];
|
|
21
|
+
if (!userCredentials) {
|
|
22
|
+
debug("user %o does not exist", user);
|
|
23
|
+
return cb(null, false);
|
|
24
|
+
}
|
|
25
|
+
if (password !== userCredentials.password) {
|
|
26
|
+
const err = errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD);
|
|
27
|
+
debug("password invalid for: %o", user);
|
|
28
|
+
return cb(err);
|
|
29
|
+
}
|
|
30
|
+
debug("authentication succeed for %o", user);
|
|
31
|
+
return cb(null, [user]);
|
|
32
|
+
}
|
|
33
|
+
adduser(user, password, cb) {
|
|
34
|
+
if (this._users[user]) {
|
|
35
|
+
debug("user %o already exist", user);
|
|
36
|
+
return cb(null, true);
|
|
37
|
+
}
|
|
38
|
+
if (this._app_config.max_users) {
|
|
39
|
+
if (Object.keys(this._users).length >= this._app_config.max_users) {
|
|
40
|
+
const err = errorUtils.getConflict(API_ERROR.MAX_USERS_REACHED);
|
|
41
|
+
debug(API_ERROR.MAX_USERS_REACHED);
|
|
42
|
+
return cb(err);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
this._users[user] = {
|
|
46
|
+
name: user,
|
|
47
|
+
password
|
|
48
|
+
};
|
|
49
|
+
debug("user added succeeded for %o", user);
|
|
50
|
+
cb(null, user);
|
|
51
|
+
}
|
|
52
|
+
changePassword(username, password, newPassword, cb) {
|
|
53
|
+
const user = this._users[username];
|
|
54
|
+
debug("init change password for %o", user?.name);
|
|
55
|
+
if (user && user.password === password) {
|
|
56
|
+
user.password = newPassword;
|
|
57
|
+
this._users[username] = user;
|
|
58
|
+
debug("user changed password succeeded for %o", user?.name);
|
|
59
|
+
cb(null, true);
|
|
60
|
+
} else {
|
|
61
|
+
const err = errorUtils.getNotFound("user not found");
|
|
62
|
+
this._logger.debug({ user: username }, "change password user @{user} not found");
|
|
63
|
+
debug("change password user for %o not found", user?.name);
|
|
64
|
+
return cb(err);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
allow_access(user, pkg, cb) {
|
|
68
|
+
debug("allow access for %o", user);
|
|
69
|
+
if (pkg?.access?.includes("$all") || pkg?.access?.includes("$anonymous")) {
|
|
70
|
+
debug("%o has been granted access", user?.name);
|
|
71
|
+
return cb(null, true);
|
|
72
|
+
}
|
|
73
|
+
if (!user?.name) {
|
|
74
|
+
const err = errorUtils.getForbidden("not allowed to access package");
|
|
75
|
+
this._logger.debug({ user: user.name }, "user: @{user} not allowed to access package");
|
|
76
|
+
debug("%o not allowed to access package err", user?.name, err.message);
|
|
77
|
+
return cb(err);
|
|
78
|
+
}
|
|
79
|
+
if (pkg?.access?.includes(user?.name) || pkg?.access?.includes("$authenticated")) {
|
|
80
|
+
debug("%o has been granted access", user?.name);
|
|
81
|
+
return cb(null, true);
|
|
82
|
+
}
|
|
83
|
+
const err = errorUtils.getForbidden("not allowed to access package");
|
|
84
|
+
debug("%o not allowed to access package err", user?.name, err?.message);
|
|
85
|
+
return cb(err);
|
|
86
|
+
}
|
|
87
|
+
allow_publish(user, pkg, cb) {
|
|
88
|
+
if (pkg?.publish?.includes("$all") || pkg?.publish?.includes("$anonymous")) {
|
|
89
|
+
debug("%o has been granted to publish", user?.name);
|
|
90
|
+
return cb(null, true);
|
|
91
|
+
}
|
|
92
|
+
if (!user?.name) {
|
|
93
|
+
const err = errorUtils.getForbidden("not allowed to publish package");
|
|
94
|
+
debug("%o not allowed to publish package err %o", user?.name, err.message);
|
|
95
|
+
return cb(err);
|
|
96
|
+
}
|
|
97
|
+
if (pkg?.publish?.includes(user.name) || pkg?.publish?.includes("$authenticated")) return cb(null, true);
|
|
98
|
+
const err = errorUtils.getForbidden("not allowed to publish package");
|
|
99
|
+
debug("%o not allowed to publish package err %o", user?.name, err.message);
|
|
100
|
+
return cb(err);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { Memory as default };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=Memory.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Memory.mjs","names":[],"sources":["../src/Memory.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nimport { API_ERROR, errorUtils, pluginUtils } from '@verdaccio/core';\nimport type { Config, Logger, PackageAccess, RemoteUser } from '@verdaccio/types';\n\nimport type { Users, VerdaccioMemoryConfig } from './types';\n\nconst debug = buildDebug('verdaccio:plugin:auth:memory:user');\n\nconst { Plugin } = pluginUtils;\n\nexport default class Memory\n extends Plugin<VerdaccioMemoryConfig>\n implements pluginUtils.Auth<VerdaccioMemoryConfig>\n{\n public _logger: Logger;\n public _users: Users;\n public _config: {};\n public _app_config: Config;\n\n public constructor(config: VerdaccioMemoryConfig, appOptions: pluginUtils.PluginOptions) {\n super(config, appOptions);\n this._users = config.users || {};\n this._config = config;\n this._logger = appOptions.logger;\n this._app_config = appOptions.config;\n }\n\n public authenticate(user: string, password: string, cb: pluginUtils.AuthCallback): void {\n debug('authenticate %o:%o', user, password);\n const userCredentials = this._users[user];\n\n if (!userCredentials) {\n debug('user %o does not exist', user);\n return cb(null, false);\n }\n\n if (password !== userCredentials.password) {\n const err = errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD);\n debug('password invalid for: %o', user);\n\n return cb(err);\n }\n\n // authentication succeeded!\n // return all usergroups this user has access to;\n debug('authentication succeed for %o', user);\n return cb(null, [user]);\n }\n\n public adduser(user: string, password: string, cb: pluginUtils.AuthUserCallback): void {\n if (this._users[user]) {\n debug('user %o already exist', user);\n return cb(null, true);\n }\n\n if (this._app_config.max_users) {\n if (Object.keys(this._users).length >= this._app_config.max_users) {\n const err = errorUtils.getConflict(API_ERROR.MAX_USERS_REACHED);\n debug(API_ERROR.MAX_USERS_REACHED);\n return cb(err);\n }\n }\n\n this._users[user] = { name: user, password: password };\n\n debug('user added succeeded for %o', user);\n cb(null, user);\n }\n\n public changePassword(\n username: string,\n password: string,\n newPassword: string,\n cb: pluginUtils.AuthChangePasswordCallback\n ): void {\n const user = this._users[username];\n debug('init change password for %o', user?.name);\n\n if (user && user.password === password) {\n user.password = newPassword;\n this._users[username] = user;\n debug('user changed password succeeded for %o', user?.name);\n cb(null, true);\n } else {\n const err = errorUtils.getNotFound('user not found');\n this._logger.debug({ user: username }, 'change password user @{user} not found');\n debug('change password user for %o not found', user?.name);\n return cb(err);\n }\n }\n\n public allow_access(user: RemoteUser, pkg: PackageAccess, cb: pluginUtils.AccessCallback): void {\n debug('allow access for %o', user);\n if (pkg?.access?.includes('$all') || pkg?.access?.includes('$anonymous')) {\n debug('%o has been granted access', user?.name);\n\n return cb(null, true);\n }\n\n if (!user?.name) {\n const err = errorUtils.getForbidden('not allowed to access package');\n this._logger.debug({ user: user.name }, 'user: @{user} not allowed to access package');\n debug('%o not allowed to access package err', user?.name, err.message);\n return cb(err);\n }\n\n if (pkg?.access?.includes(user?.name) || pkg?.access?.includes('$authenticated')) {\n debug('%o has been granted access', user?.name);\n return cb(null, true);\n }\n\n const err = errorUtils.getForbidden('not allowed to access package');\n debug('%o not allowed to access package err', user?.name, err?.message);\n return cb(err);\n }\n\n public allow_publish(\n user: RemoteUser,\n pkg: PackageAccess,\n cb: pluginUtils.AuthAccessCallback\n ): void {\n if (pkg?.publish?.includes('$all') || pkg?.publish?.includes('$anonymous')) {\n debug('%o has been granted to publish', user?.name);\n return cb(null, true);\n }\n\n if (!user?.name) {\n const err = errorUtils.getForbidden('not allowed to publish package');\n debug('%o not allowed to publish package err %o', user?.name, err.message);\n return cb(err);\n }\n\n if (pkg?.publish?.includes(user.name) || pkg?.publish?.includes('$authenticated')) {\n return cb(null, true);\n }\n\n const err = errorUtils.getForbidden('not allowed to publish package');\n debug('%o not allowed to publish package err %o', user?.name, err.message);\n\n return cb(err);\n }\n}\n"],"mappings":";;;AAOA,IAAM,QAAQ,WAAW,mCAAmC;AAE5D,IAAM,EAAE,WAAW;AAEnB,IAAqB,SAArB,cACU,OAEV;CACE;CACA;CACA;CACA;CAEA,YAAmB,QAA+B,YAAuC;EACvF,MAAM,QAAQ,UAAU;EACxB,KAAK,SAAS,OAAO,SAAS,CAAC;EAC/B,KAAK,UAAU;EACf,KAAK,UAAU,WAAW;EAC1B,KAAK,cAAc,WAAW;CAChC;CAEA,aAAoB,MAAc,UAAkB,IAAoC;EACtF,MAAM,sBAAsB,MAAM,QAAQ;EAC1C,MAAM,kBAAkB,KAAK,OAAO;EAEpC,IAAI,CAAC,iBAAiB;GACpB,MAAM,0BAA0B,IAAI;GACpC,OAAO,GAAG,MAAM,KAAK;EACvB;EAEA,IAAI,aAAa,gBAAgB,UAAU;GACzC,MAAM,MAAM,WAAW,gBAAgB,UAAU,qBAAqB;GACtE,MAAM,4BAA4B,IAAI;GAEtC,OAAO,GAAG,GAAG;EACf;EAIA,MAAM,iCAAiC,IAAI;EAC3C,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;CACxB;CAEA,QAAe,MAAc,UAAkB,IAAwC;EACrF,IAAI,KAAK,OAAO,OAAO;GACrB,MAAM,yBAAyB,IAAI;GACnC,OAAO,GAAG,MAAM,IAAI;EACtB;EAEA,IAAI,KAAK,YAAY;OACf,OAAO,KAAK,KAAK,MAAM,EAAE,UAAU,KAAK,YAAY,WAAW;I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MAAM,MAAM,KAAK,OAAO;EACtE,OAAO,GAAG,GAAG;CACf;CAEA,cACE,MACA,KACA,IACM;EACN,IAAI,KAAK,SAAS,SAAS,MAAM,KAAK,KAAK,SAAS,SAAS,YAAY,GAAG;GAC1E,MAAM,kCAAkC,MAAM,IAAI;GAClD,OAAO,GAAG,MAAM,IAAI;EACtB;EAEA,IAAI,CAAC,MAAM,MAAM;GACf,MAAM,MAAM,WAAW,aAAa,gCAAgC;GACpE,MAAM,4CAA4C,MAAM,MAAM,IAAI,OAAO;GACzE,OAAO,GAAG,GAAG;EACf;EAEA,IAAI,KAAK,SAAS,SAAS,KAAK,IAAI,KAAK,KAAK,SAAS,SAAS,gBAAgB,GAC9E,OAAO,GAAG,MAAM,IAAI;EAGtB,MAAM,MAAM,WAAW,aAAa,gCAAgC;EACpE,MAAM,4CAA4C,MAAM,MAAM,IAAI,OAAO;EAEzE,OAAO,GAAG,GAAG;CACf;AACF"}
|
|
@@ -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;
|
package/build/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Memory", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Memory["default"];
|
|
10
|
-
}
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
11
4
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
const require_Memory = require("./Memory.js");
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
var src_default = require_Memory.default;
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.Memory = require_Memory.default;
|
|
10
|
+
exports.default = src_default;
|
|
11
|
+
|
|
16
12
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import Memory from './Memory';\n\nexport { Memory };\n\nexport default Memory;\n"],"mappings":";;;;;;AAIA,IAAA,cAAe,eAAA"}
|
package/build/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import Memory from './Memory';\n\nexport { Memory };\n\nexport default Memory;\n"],"mappings":";;AAIA,IAAA,cAAe"}
|
package/package.json
CHANGED
|
@@ -1,54 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verdaccio-auth-memory",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "Auth plugin for Verdaccio that keeps users in memory",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"private",
|
|
7
|
-
"package",
|
|
8
|
-
"repository",
|
|
9
|
-
"registry",
|
|
10
6
|
"enterprise",
|
|
11
7
|
"modules",
|
|
8
|
+
"package",
|
|
9
|
+
"private",
|
|
12
10
|
"proxy",
|
|
11
|
+
"registry",
|
|
12
|
+
"repository",
|
|
13
13
|
"server",
|
|
14
14
|
"verdaccio"
|
|
15
15
|
],
|
|
16
|
-
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
17
|
-
"license": "MIT",
|
|
18
16
|
"homepage": "https://verdaccio.org",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/verdaccio/verdaccio/issues"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
19
22
|
"repository": {
|
|
20
23
|
"type": "https",
|
|
21
24
|
"url": "https://github.com/verdaccio/verdaccio",
|
|
22
25
|
"directory": "packages/plugins/auth-memory"
|
|
23
26
|
},
|
|
24
|
-
"
|
|
25
|
-
"
|
|
27
|
+
"funding": {
|
|
28
|
+
"type": "opencollective",
|
|
29
|
+
"url": "https://opencollective.com/verdaccio"
|
|
26
30
|
},
|
|
27
|
-
"main": "build/index.js",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
+
"main": "./build/index.js",
|
|
32
|
+
"module": "./build/index.mjs",
|
|
33
|
+
"types": "./build/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./build/index.d.ts",
|
|
38
|
+
"default": "./build/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./build/index.d.ts",
|
|
42
|
+
"default": "./build/index.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"./build/*": "./build/*"
|
|
31
46
|
},
|
|
32
47
|
"dependencies": {
|
|
33
|
-
"@verdaccio/core": "8.
|
|
48
|
+
"@verdaccio/core": "8.2.0",
|
|
34
49
|
"debug": "4.4.3"
|
|
35
50
|
},
|
|
36
51
|
"devDependencies": {
|
|
37
52
|
"@types/debug": "4.1.12",
|
|
38
|
-
"@verdaccio/config": "8.
|
|
39
|
-
"@verdaccio/types": "13.0.
|
|
53
|
+
"@verdaccio/config": "8.2.0",
|
|
54
|
+
"@verdaccio/types": "13.0.5",
|
|
55
|
+
"vite": "8.0.16"
|
|
40
56
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"url": "https://opencollective.com/verdaccio"
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=22"
|
|
44
59
|
},
|
|
45
60
|
"scripts": {
|
|
46
61
|
"clean": "rimraf ./build",
|
|
47
62
|
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
|
48
|
-
"build
|
|
49
|
-
"
|
|
50
|
-
"build": "pnpm run build:js && pnpm run build:types",
|
|
51
|
-
"watch": "pnpm build:js -- --watch",
|
|
63
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
64
|
+
"watch": "vite build --watch",
|
|
52
65
|
"test": "vitest run"
|
|
53
66
|
}
|
|
54
67
|
}
|
package/build/types/index.js
DELETED
package/build/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["export interface UserMemory {\n name: string;\n password: string;\n}\n\nexport interface Users {\n [key: string]: UserMemory;\n}\n\nexport interface VerdaccioMemoryConfig {\n max_users?: number;\n users: Users;\n}\n"],"mappings":"","ignoreList":[]}
|