verdaccio-auth-memory 10.0.0 → 10.2.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/lib/{src/Memory.d.ts → Memory.d.ts} +12 -2
- package/lib/Memory.js +10 -19
- package/lib/Memory.js.map +1 -0
- package/lib/{src/index.d.ts → index.d.ts} +0 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -0
- package/package.json +14 -18
- package/CHANGELOG.md +0 -354
- package/lib/types/index.d.ts +0 -12
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { PluginOptions, Callback, PackageAccess, IPluginAuth, RemoteUser, Logger } from '@verdaccio/types';
|
|
2
|
-
|
|
1
|
+
import { Config, PluginOptions, Callback, PackageAccess, IPluginAuth, RemoteUser, Logger } from '@verdaccio/types';
|
|
2
|
+
export interface UserMemory {
|
|
3
|
+
name: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Users {
|
|
7
|
+
[key: string]: UserMemory;
|
|
8
|
+
}
|
|
9
|
+
export interface VerdaccioMemoryConfig extends Config {
|
|
10
|
+
max_users?: number;
|
|
11
|
+
users: Users;
|
|
12
|
+
}
|
|
3
13
|
export default class Memory implements IPluginAuth<VerdaccioMemoryConfig> {
|
|
4
14
|
_logger: Logger;
|
|
5
15
|
_users: Users;
|
package/lib/Memory.js
CHANGED
|
@@ -5,20 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
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; }
|
|
8
|
+
var _commonsApi = require("@verdaccio/commons-api");
|
|
11
9
|
|
|
12
10
|
class Memory {
|
|
13
11
|
constructor(config, appOptions) {
|
|
14
|
-
_defineProperty(this, "_logger", void 0);
|
|
15
|
-
|
|
16
|
-
_defineProperty(this, "_users", void 0);
|
|
17
|
-
|
|
18
|
-
_defineProperty(this, "_config", void 0);
|
|
19
|
-
|
|
20
|
-
_defineProperty(this, "_app_config", void 0);
|
|
21
|
-
|
|
22
12
|
this._users = config.users || {};
|
|
23
13
|
this._config = config;
|
|
24
14
|
this._logger = appOptions.logger;
|
|
@@ -37,7 +27,7 @@ class Memory {
|
|
|
37
27
|
}
|
|
38
28
|
|
|
39
29
|
if (password !== userCredentials.password) {
|
|
40
|
-
const err = (0,
|
|
30
|
+
const err = (0, _commonsApi.getUnauthorized)("i don't like your password");
|
|
41
31
|
|
|
42
32
|
this._logger.info({
|
|
43
33
|
user
|
|
@@ -66,7 +56,7 @@ class Memory {
|
|
|
66
56
|
|
|
67
57
|
if (this._app_config.max_users) {
|
|
68
58
|
if (Object.keys(this._users).length >= this._app_config.max_users) {
|
|
69
|
-
const err = (0,
|
|
59
|
+
const err = (0, _commonsApi.getConflict)('maximum amount of users reached');
|
|
70
60
|
return done(err);
|
|
71
61
|
}
|
|
72
62
|
}
|
|
@@ -100,7 +90,7 @@ class Memory {
|
|
|
100
90
|
|
|
101
91
|
cb(null, user);
|
|
102
92
|
} else {
|
|
103
|
-
const err = (0,
|
|
93
|
+
const err = (0, _commonsApi.getNotFound)('user not found');
|
|
104
94
|
|
|
105
95
|
this._logger.debug({
|
|
106
96
|
user: username
|
|
@@ -120,7 +110,7 @@ class Memory {
|
|
|
120
110
|
}
|
|
121
111
|
|
|
122
112
|
if (!user.name) {
|
|
123
|
-
const err = (0,
|
|
113
|
+
const err = (0, _commonsApi.getForbidden)('not allowed to access package');
|
|
124
114
|
|
|
125
115
|
this._logger.debug({
|
|
126
116
|
user: user.name
|
|
@@ -137,7 +127,7 @@ class Memory {
|
|
|
137
127
|
return cb(null, true);
|
|
138
128
|
}
|
|
139
129
|
|
|
140
|
-
const err = (0,
|
|
130
|
+
const err = (0, _commonsApi.getForbidden)('not allowed to access package');
|
|
141
131
|
|
|
142
132
|
this._logger.debug({
|
|
143
133
|
user: user.name
|
|
@@ -156,7 +146,7 @@ class Memory {
|
|
|
156
146
|
}
|
|
157
147
|
|
|
158
148
|
if (!user.name) {
|
|
159
|
-
const err = (0,
|
|
149
|
+
const err = (0, _commonsApi.getForbidden)('not allowed to publish package');
|
|
160
150
|
|
|
161
151
|
this._logger.debug({
|
|
162
152
|
user: user.name
|
|
@@ -169,7 +159,7 @@ class Memory {
|
|
|
169
159
|
return cb(null, true);
|
|
170
160
|
}
|
|
171
161
|
|
|
172
|
-
const err = (0,
|
|
162
|
+
const err = (0, _commonsApi.getForbidden)('not allowed to publish package');
|
|
173
163
|
|
|
174
164
|
this._logger.debug({
|
|
175
165
|
user: user.name
|
|
@@ -180,4 +170,5 @@ class Memory {
|
|
|
180
170
|
|
|
181
171
|
}
|
|
182
172
|
|
|
183
|
-
exports.default = Memory;
|
|
173
|
+
exports.default = Memory;
|
|
174
|
+
//# sourceMappingURL=Memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Memory.ts"],"names":["Memory","constructor","config","appOptions","_users","users","_config","_logger","logger","_app_config","authenticate","user","password","done","userCredentials","debug","err","info","adduser","max_users","Object","keys","length","name","changePassword","username","newPassword","cb","allow_access","pkg","access","includes","allow_publish","publish"],"mappings":";;;;;;;AACA;;AAiBe,MAAMA,MAAN,CAA2D;AAMjEC,EAAAA,WAAW,CAACC,MAAD,EAAgCC,UAAhC,EAAkF;AAClG,SAAKC,MAAL,GAAcF,MAAM,CAACG,KAAP,IAAgB,EAA9B;AACA,SAAKC,OAAL,GAAeJ,MAAf;AACA,SAAKK,OAAL,GAAeJ,UAAU,CAACK,MAA1B;AACA,SAAKC,WAAL,GAAmBN,UAAU,CAACD,MAA9B;AACD;;AAEMQ,EAAAA,YAAY,CAACC,IAAD,EAAeC,QAAf,EAAiCC,IAAjC,EAAuD;AACxE,UAAMC,eAAe,GAAG,KAAKV,MAAL,CAAYO,IAAZ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IAAI,EAAEA,IAAI,CAACY;AAAb,OAAnB,EAAwC,6DAAxC;;AACA,aAAOI,EAAE,CAAC,IAAD,EAAO,IAAP,CAAT;AACD;;AAED,QAAI,CAAChB,IAAI,CAACY,IAAV,EAAgB;AACd,YAAMP,GAAG,GAAG,8BAAa,gCAAb,CAAZ;;AACA,WAAKT,OAAL,CAAaQ,KAAb,CAAmB;AAAEJ,QAAAA,IAAI,EAAEA,IAAI,CAACY;AAAb,OAAnB,EAAwC,8CAAxC;;AAEA,aAAOI,EAAE,CAACX,GAAD,CAAT;AACD;;AAED,QAAKa,GAAG,CAACI,OAAJ,IAAeJ,GAAG,CAACI,OAAJ,CAAYF,QAAZ,CAAqBpB,IAAI,CAACY,IAA1B,CAAhB,IAAqDM,GAAG,CAACI,OAAJ,IAAeJ,GAAG,CAACI,OAAJ,CAAYF,QAAZ,CAAqB,gBAArB,CAAxE,EAAiH;AAC/G,aAAOJ,EAAE,CAAC,IAAD,EAAO,IAAP,CAAT;AACD;;AAED,UAAMX,GAAG,GAAG,8BAAa,gCAAb,CAAZ;;AACA,SAAKT,OAAL,CAAaQ,KAAb,CAAmB;AAAEJ,MAAAA,IAAI,EAAEA,IAAI,CAACY;AAAb,KAAnB,EAAwC,gEAAxC;;AAEA,WAAOI,EAAE,CAACX,GAAD,CAAT;AACD;;AArHuE","sourcesContent":["import { Config, PluginOptions, Callback, PackageAccess, IPluginAuth, RemoteUser, Logger } from '@verdaccio/types';\nimport { getConflict, getForbidden, getNotFound, getUnauthorized } from '@verdaccio/commons-api';\n\nexport interface UserMemory {\n name: string;\n password: string;\n}\n\nexport interface Users {\n [key: string]: UserMemory;\n}\n\nexport interface VerdaccioMemoryConfig extends Config {\n max_users?: number;\n users: Users;\n}\n\n\nexport default class Memory implements IPluginAuth<VerdaccioMemoryConfig> {\n public _logger: Logger;\n public _users: Users;\n public _config: {};\n public _app_config: VerdaccioMemoryConfig;\n\n public constructor(config: VerdaccioMemoryConfig, appOptions: PluginOptions<VerdaccioMemoryConfig>) {\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, done: Callback): void {\n const userCredentials = this._users[user];\n\n if (!userCredentials) {\n this._logger.debug({ user }, '[VerdaccioMemory] user @{user} does not exist');\n return done(null, false);\n }\n\n if (password !== userCredentials.password) {\n const err = getUnauthorized(\"i don't like your password\");\n this._logger.info({ user }, '[VerdaccioMemory] password invalid for: @{user}');\n\n return done(err);\n }\n\n // authentication succeeded!\n // return all usergroups this user has access to;\n this._logger.info({ user }, '[VerdaccioMemory] authentication succeeded for @{user}');\n return done(null, [user]);\n }\n\n public adduser(user: string, password: string, done: Callback): void {\n if (this._users[user]) {\n this._logger.debug({ user }, '[VerdaccioMemory] user @{user} already exist');\n return done(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 = getConflict('maximum amount of users reached');\n\n return done(err);\n }\n }\n\n this._users[user] = { name: user, password: password };\n\n this._logger.info({ user }, '[VerdaccioMemory] user added succeeded for @{user}');\n done(null, user);\n }\n\n public changePassword(username: string, password: string, newPassword: string, cb: Callback): void {\n const user: UserMemory = this._users[username];\n this._logger.debug({ user: username }, 'user: @{user} init change password');\n\n if (user && user.password === password) {\n user.password = newPassword;\n this._users[username] = user;\n\n this._logger.info({ user }, '[VerdaccioMemory] user changed password succeeded for @{user}');\n cb(null, user);\n } else {\n const err = getNotFound('user not found');\n this._logger.debug({ user: username }, 'change password user @{user} not found');\n\n return cb(err);\n }\n }\n\n public allow_access(user: RemoteUser, pkg: PackageAccess, cb: Callback): void {\n if ((pkg.access && pkg.access.includes('$all')) || (pkg.access && pkg.access.includes('$anonymous'))) {\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} has been granted access');\n\n return cb(null, true);\n }\n\n if (!user.name) {\n const err = getForbidden('not allowed to access package');\n this._logger.debug({ user: user.name }, 'user: @{user} not allowed to access package');\n return cb(err);\n }\n\n if ((pkg.access && pkg.access.includes(user.name)) || (pkg.access && pkg.access.includes('$authenticated'))) {\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} has been granted access');\n return cb(null, true);\n }\n\n const err = getForbidden('not allowed to access package');\n\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} not allowed to access package');\n return cb(err);\n }\n\n public allow_publish(user: RemoteUser, pkg: PackageAccess, cb: Callback): void {\n if ((pkg.publish && pkg.publish.includes('$all')) || (pkg.publish && pkg.publish.includes('$anonymous'))) {\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} has been granted to publish');\n return cb(null, true);\n }\n\n if (!user.name) {\n const err = getForbidden('not allowed to publish package');\n this._logger.debug({ user: user.name }, 'user: @{user} not allowed to publish package');\n\n return cb(err);\n }\n\n if ((pkg.publish && pkg.publish.includes(user.name)) || (pkg.publish && pkg.publish.includes('$authenticated'))) {\n return cb(null, true);\n }\n\n const err = getForbidden('not allowed to publish package');\n this._logger.debug({ user: user.name }, '[VerdaccioMemory] user: @{user} not allowed to publish package');\n\n return cb(err);\n }\n}\n"],"file":"Memory.js"}
|
|
File without changes
|
package/lib/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var _Memory = _interopRequireDefault(require("./Memory"));
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
18
|
var _default = _Memory.default;
|
|
19
|
-
exports.default = _default;
|
|
19
|
+
exports.default = _default;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["Memory"],"mappings":";;;;;;;;;;;;;AAAA;;;;eAIeA,e","sourcesContent":["import Memory from './Memory';\n\nexport { Memory };\n\nexport default Memory;\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verdaccio-auth-memory",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Auth plugin for Verdaccio that keeps users in memory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"verdaccio",
|
|
@@ -28,27 +28,23 @@
|
|
|
28
28
|
"node": ">=8"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@verdaccio/commons-api": "
|
|
31
|
+
"@verdaccio/commons-api": "10.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@verdaccio/
|
|
35
|
-
"@verdaccio/eslint-config": "^10.0.0",
|
|
36
|
-
"@verdaccio/types": "^10.0.0"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "npm run build:types && npm run build:js",
|
|
40
|
-
"build:js": "babel src/ --out-dir lib --extensions \".ts,.tsx\"",
|
|
41
|
-
"build:types": "tsc --emitDeclarationOnly",
|
|
42
|
-
"coverage:publish": "codecov --root=../../ -F plugins",
|
|
43
|
-
"lint": "eslint \"**/*.{js,ts}\"",
|
|
44
|
-
"lint:stage": "lint-staged",
|
|
45
|
-
"test": "jest",
|
|
46
|
-
"type-check": "tsc --noEmit",
|
|
47
|
-
"type-check:watch": "npm run type-check -- --watch"
|
|
34
|
+
"@verdaccio/types": "10.3.0"
|
|
48
35
|
},
|
|
49
36
|
"funding": {
|
|
50
37
|
"type": "opencollective",
|
|
51
38
|
"url": "https://opencollective.com/verdaccio"
|
|
52
39
|
},
|
|
53
|
-
"
|
|
54
|
-
|
|
40
|
+
"scripts": {
|
|
41
|
+
"clean": "rimraf ./build",
|
|
42
|
+
"test": "cross-env NODE_ENV=test BABEL_ENV=test jest",
|
|
43
|
+
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
|
44
|
+
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
|
|
45
|
+
"build:js": "babel src/ --out-dir lib/ --copy-files --extensions \".ts,.tsx\" --source-maps",
|
|
46
|
+
"watch": "pnpm build:js -- --watch",
|
|
47
|
+
"build": "pnpm run build:js && pnpm run build:types"
|
|
48
|
+
},
|
|
49
|
+
"readme": "# verdaccio-auth-memory\n[](https://app.fossa.io/projects/git%2Bgithub.com%2Fverdaccio%2Fverdaccio-auth-memory?ref=badge_shield)\n[](https://circleci.com/gh/ayusharma/verdaccio-auth-memory)\n[](https://codecov.io/gh/verdaccio/verdaccio-auth-memory)\n\n\nThis verdaccio auth plugin keeps the users in a memory plain object.\nThis means all sessions and users will disappear when you restart the verdaccio server.\n\nIf you want to use this piece of software, do it at your own risk. **This plugin is being used for unit testing**.\n\n## Installation\n\n```sh\n$ npm install -g verdaccio\n$ npm install -g verdaccio-auth-memory\n```\n\n## Config\n\nAdd to your `config.yaml`:\n\n```yaml\nauth:\n auth-memory:\n users:\n foo:\n name: foo\n password: s3cret\n bar:\n name: bar\n password: s3cret\n```\n\n## For plugin writers\n\nIt's called as:\n\n```js\nconst plugin = require('verdaccio-auth-memory');\n\nplugin(config, appConfig);\n```\n\nWhere:\n\n - config - module's own config\n - appOptions - collection of different internal verdaccio objects\n - appOptions.config - main config\n - appOptions.logger - logger\n\nThis should export four functions:\n\n - `adduser(user, password, cb)` Add new users\n\n It should respond with:\n - `cb(err)` in case of an error (error will be returned to user)\n - `cb(null, false)` in case registration is disabled (next auth plugin will be executed)\n - `cb(null, true)` in case user registered successfully\n\n It's useful to set `err.status` property to set http status code (e.g. `err.status = 403`).\n\n - `authenticate(user, password, cb)` Authenticate the user\n\n It should respond with:\n - `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)\n - `cb(null, false)` in case user not authenticated (next auth plugin will be executed)\n - `cb(null, [groups])` in case user is authenticated\n\n Groups is an array of all users/usergroups this user has access to. You should probably include username itself here.\n\n - `allow_access(user, pkg, cb)` Check whether the user has permissions to access a resource (package)\n\n It should respond with:\n - `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)\n - `cb(null, false)` in case user not allowed to access (next auth plugin will be executed)\n - `cb(null, true)` in case user is allowed to access\n\n - `allow_publish(user, pkg, cb)` Check whether the user has permissions to publish a resource (package)\n\n It should respond with:\n - `cb(err)` in case of a fatal error (error will be returned to user, keep those rare)\n - `cb(null, false)` in case user not allowed to publish (next auth plugin will be executed)\n - `cb(null, true)` in case user is allowed to publish\n\n\n\n## License\n[](https://app.fossa.io/projects/git%2Bgithub.com%2Fverdaccio%2Fverdaccio-auth-memory?ref=badge_large)\n"
|
|
50
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [10.0.0](https://github.com/verdaccio/monorepo/compare/v9.7.5...v10.0.0) (2021-03-29)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [9.7.2](https://github.com/verdaccio/monorepo/compare/v9.7.1...v9.7.2) (2020-07-20)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [9.7.1](https://github.com/verdaccio/monorepo/compare/v9.7.0...v9.7.1) (2020-07-10)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [9.7.0](https://github.com/verdaccio/monorepo/compare/v9.6.1...v9.7.0) (2020-06-24)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [9.6.1](https://github.com/verdaccio/monorepo/compare/v9.6.0...v9.6.1) (2020-06-07)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [9.5.0](https://github.com/verdaccio/monorepo/compare/v9.4.1...v9.5.0) (2020-05-02)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# [9.4.0](https://github.com/verdaccio/monorepo/compare/v9.3.4...v9.4.0) (2020-03-21)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## [9.3.2](https://github.com/verdaccio/monorepo/compare/v9.3.1...v9.3.2) (2020-03-08)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## [9.3.1](https://github.com/verdaccio/monorepo/compare/v9.3.0...v9.3.1) (2020-02-23)
|
|
71
|
-
|
|
72
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# [9.3.0](https://github.com/verdaccio/monorepo/compare/v9.2.0...v9.3.0) (2020-01-29)
|
|
79
|
-
|
|
80
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# [9.0.0](https://github.com/verdaccio/monorepo/compare/v8.5.3...v9.0.0) (2020-01-07)
|
|
87
|
-
|
|
88
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
## [8.5.2](https://github.com/verdaccio/monorepo/compare/v8.5.1...v8.5.2) (2019-12-25)
|
|
95
|
-
|
|
96
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## [8.5.1](https://github.com/verdaccio/monorepo/compare/v8.5.0...v8.5.1) (2019-12-24)
|
|
103
|
-
|
|
104
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
# [8.5.0](https://github.com/verdaccio/monorepo/compare/v8.4.2...v8.5.0) (2019-12-22)
|
|
111
|
-
|
|
112
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## [8.4.2](https://github.com/verdaccio/monorepo/compare/v8.4.1...v8.4.2) (2019-11-23)
|
|
119
|
-
|
|
120
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
## [8.4.1](https://github.com/verdaccio/monorepo/compare/v8.4.0...v8.4.1) (2019-11-22)
|
|
127
|
-
|
|
128
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
# [8.4.0](https://github.com/verdaccio/monorepo/compare/v8.3.0...v8.4.0) (2019-11-22)
|
|
135
|
-
|
|
136
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
# [8.3.0](https://github.com/verdaccio/monorepo/compare/v8.2.0...v8.3.0) (2019-10-27)
|
|
143
|
-
|
|
144
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
# [8.2.0](https://github.com/verdaccio/monorepo/compare/v8.2.0-next.0...v8.2.0) (2019-10-23)
|
|
151
|
-
|
|
152
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
# [8.2.0-next.0](https://github.com/verdaccio/monorepo/compare/v8.1.4...v8.2.0-next.0) (2019-10-08)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
### Bug Fixes
|
|
162
|
-
|
|
163
|
-
* fixed lint errors ([5e677f7](https://github.com/verdaccio/monorepo/commit/5e677f7))
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
## [8.1.2](https://github.com/verdaccio/monorepo/compare/v8.1.1...v8.1.2) (2019-09-29)
|
|
170
|
-
|
|
171
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
## [8.1.1](https://github.com/verdaccio/monorepo/compare/v8.1.0...v8.1.1) (2019-09-26)
|
|
178
|
-
|
|
179
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
# [8.1.0](https://github.com/verdaccio/monorepo/compare/v8.0.1-next.1...v8.1.0) (2019-09-07)
|
|
186
|
-
|
|
187
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
## [8.0.1-next.1](https://github.com/verdaccio/monorepo/compare/v8.0.1-next.0...v8.0.1-next.1) (2019-08-29)
|
|
194
|
-
|
|
195
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
## [8.0.1-next.0](https://github.com/verdaccio/monorepo/compare/v8.0.0...v8.0.1-next.0) (2019-08-29)
|
|
202
|
-
|
|
203
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
# [8.0.0](https://github.com/verdaccio/monorepo/compare/v8.0.0-next.4...v8.0.0) (2019-08-22)
|
|
210
|
-
|
|
211
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
# [8.0.0-next.4](https://github.com/verdaccio/monorepo/compare/v8.0.0-next.3...v8.0.0-next.4) (2019-08-18)
|
|
218
|
-
|
|
219
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
# [8.0.0-next.2](https://github.com/verdaccio/monorepo/compare/v8.0.0-next.1...v8.0.0-next.2) (2019-08-03)
|
|
226
|
-
|
|
227
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
# [8.0.0-next.1](https://github.com/verdaccio/monorepo/compare/v8.0.0-next.0...v8.0.0-next.1) (2019-08-01)
|
|
234
|
-
|
|
235
|
-
**Note:** Version bump only for package verdaccio-auth-memory
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
# [8.0.0-next.0](https://github.com/verdaccio/monorepo/compare/v2.0.0...v8.0.0-next.0) (2019-08-01)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
### Bug Fixes
|
|
245
|
-
|
|
246
|
-
* main file is correct routed ([245b115](https://github.com/verdaccio/monorepo/commit/245b115))
|
|
247
|
-
* remove source maps ([6ca4895](https://github.com/verdaccio/monorepo/commit/6ca4895))
|
|
248
|
-
* restore error messages ([5d241b6](https://github.com/verdaccio/monorepo/commit/5d241b6))
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
### Features
|
|
252
|
-
|
|
253
|
-
* add logging output for each action ([66f183c](https://github.com/verdaccio/monorepo/commit/66f183c))
|
|
254
|
-
* change password ([de0a341](https://github.com/verdaccio/monorepo/commit/de0a341))
|
|
255
|
-
* migrate to typescript BREAKING CHANGE: new compiler might bring issues ([13ebde2](https://github.com/verdaccio/monorepo/commit/13ebde2))
|
|
256
|
-
* **config:** allow set users ([e5326fd](https://github.com/verdaccio/monorepo/commit/e5326fd))
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
# Changelog
|
|
263
|
-
|
|
264
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
265
|
-
|
|
266
|
-
### [1.1.5](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.1.4...v1.1.5) (2019-07-15)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
### Bug Fixes
|
|
270
|
-
|
|
271
|
-
* restore error messages ([094da45](https://github.com/verdaccio/verdaccio-auth-memory/commit/094da45))
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
### [1.1.4](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.1.3...v1.1.4) (2019-07-15)
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
### Tests
|
|
279
|
-
|
|
280
|
-
* fix wrong string match ([d4d2e81](https://github.com/verdaccio/verdaccio-auth-memory/commit/d4d2e81))
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
### [1.1.3](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.1.2...v1.1.3) (2019-07-15)
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
### Build System
|
|
288
|
-
|
|
289
|
-
* update @verdaccio/commons-api@0.1.2 ([55f39a4](https://github.com/verdaccio/verdaccio-auth-memory/commit/55f39a4))
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
### [1.1.2](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.1.1...v1.1.2) (2019-07-15)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
### Build System
|
|
297
|
-
|
|
298
|
-
* build step before publish ([468ddbc](https://github.com/verdaccio/verdaccio-auth-memory/commit/468ddbc))
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
### [1.1.1](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.1.0...v1.1.1) (2019-07-12)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
### Build System
|
|
306
|
-
|
|
307
|
-
* fix unit test ([6d7b383](https://github.com/verdaccio/verdaccio-auth-memory/commit/6d7b383))
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
## [1.1.0](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.0.2...v1.1.0) (2019-07-12)
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
### Features
|
|
315
|
-
|
|
316
|
-
* add logging output for each action ([099f9aa](https://github.com/verdaccio/verdaccio-auth-memory/commit/099f9aa))
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
### [1.0.2](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.0.1...v1.0.2) (2019-07-12)
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
### Bug Fixes
|
|
324
|
-
|
|
325
|
-
* main file is correct routed ([722a615](https://github.com/verdaccio/verdaccio-auth-memory/commit/722a615))
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
### [1.0.1](https://github.com/verdaccio/verdaccio-auth-memory/compare/v1.0.0...v1.0.1) (2019-07-12)
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
### Bug Fixes
|
|
333
|
-
|
|
334
|
-
* remove source maps ([6f29a06](https://github.com/verdaccio/verdaccio-auth-memory/commit/6f29a06))
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
## [1.0.0](https://github.com/verdaccio/verdaccio-auth-memory/compare/v0.0.4...v1.0.0) (2019-07-12)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
### Build System
|
|
342
|
-
|
|
343
|
-
* add coverage build script ([4f25313](https://github.com/verdaccio/verdaccio-auth-memory/commit/4f25313))
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
### Features
|
|
347
|
-
|
|
348
|
-
* change password ([19d9838](https://github.com/verdaccio/verdaccio-auth-memory/commit/19d9838))
|
|
349
|
-
* migrate to typescript ([4c3b144](https://github.com/verdaccio/verdaccio-auth-memory/commit/4c3b144))
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
### BREAKING CHANGES
|
|
353
|
-
|
|
354
|
-
* new compiler might bring issues
|
package/lib/types/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Config } from '@verdaccio/types';
|
|
2
|
-
export interface UserMemory {
|
|
3
|
-
name: string;
|
|
4
|
-
password: string;
|
|
5
|
-
}
|
|
6
|
-
export interface Users {
|
|
7
|
-
[key: string]: UserMemory;
|
|
8
|
-
}
|
|
9
|
-
export interface VerdaccioMemoryConfig extends Config {
|
|
10
|
-
max_users?: number;
|
|
11
|
-
users: Users;
|
|
12
|
-
}
|