@verdaccio/types 10.1.0 → 11.0.0-6-next.10
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/.eslintrc.json +10 -0
- package/CHANGELOG.md +214 -10
- package/README.md +1 -2
- package/index.d.ts +152 -103
- package/package.json +25 -14
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rules": {
|
|
3
|
+
"spaced-comment": 0,
|
|
4
|
+
"@typescript-eslint/adjacent-overload-signatures": "off",
|
|
5
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
6
|
+
"@typescript-eslint/interface-name-prefix": "off",
|
|
7
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
8
|
+
"@typescript-eslint/no-unused-vars": "off"
|
|
9
|
+
}
|
|
10
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,27 +1,231 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 11.0.0-6-next.10
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 000d4374: feat: upgrade to material ui 5
|
|
8
|
+
|
|
9
|
+
## 11.0.0-6-next.9
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 794af76c: Remove Node 12 support
|
|
14
|
+
|
|
15
|
+
- We need move to the new `undici` and does not support Node.js 12
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 154b2ecd: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
|
|
20
|
+
|
|
21
|
+
## 11.0.0-6-next.8
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- 459b6fa7: refactor: search v1 endpoint and local-database
|
|
26
|
+
|
|
27
|
+
- refactor search `api v1` endpoint, improve performance
|
|
28
|
+
- remove usage of `async` dependency https://github.com/verdaccio/verdaccio/issues/1225
|
|
29
|
+
- refactor method storage class
|
|
30
|
+
- create new module `core` to reduce the ammount of modules with utilities
|
|
31
|
+
- use `undici` instead `node-fetch`
|
|
32
|
+
- use `fastify` instead `express` for functional test
|
|
33
|
+
|
|
34
|
+
### Breaking changes
|
|
35
|
+
|
|
36
|
+
- plugin storage API changes
|
|
37
|
+
- remove old search endpoint (return 404)
|
|
38
|
+
- filter local private packages at plugin level
|
|
39
|
+
|
|
40
|
+
The storage api changes for methods `get`, `add`, `remove` as promise base. The `search` methods also changes and recieves a `query` object that contains all query params from the client.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
export interface IPluginStorage<T> extends IPlugin {
|
|
44
|
+
add(name: string): Promise<void>;
|
|
45
|
+
remove(name: string): Promise<void>;
|
|
46
|
+
get(): Promise<any>;
|
|
47
|
+
init(): Promise<void>;
|
|
48
|
+
getSecret(): Promise<string>;
|
|
49
|
+
setSecret(secret: string): Promise<any>;
|
|
50
|
+
getPackageStorage(packageInfo: string): IPackageStorage;
|
|
51
|
+
search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;
|
|
52
|
+
saveToken(token: Token): Promise<any>;
|
|
53
|
+
deleteToken(user: string, tokenKey: string): Promise<any>;
|
|
54
|
+
readTokens(filter: TokenFilter): Promise<Token[]>;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 11.0.0-6-next.7
|
|
4
59
|
|
|
5
60
|
### Minor Changes
|
|
6
61
|
|
|
7
|
-
-
|
|
62
|
+
- 0da7031e: allow disable login on ui and endpoints
|
|
8
63
|
|
|
9
|
-
|
|
64
|
+
To be able disable the login, set `login: false`, anything else would enable login. This flag will disable access via UI and web endpoints.
|
|
10
65
|
|
|
11
|
-
|
|
66
|
+
```yml
|
|
67
|
+
web:
|
|
68
|
+
title: verdaccio
|
|
69
|
+
login: false
|
|
70
|
+
```
|
|
12
71
|
|
|
13
|
-
##
|
|
72
|
+
## 11.0.0-6-next.6
|
|
73
|
+
|
|
74
|
+
### Minor Changes
|
|
75
|
+
|
|
76
|
+
- aecbd226: web: allow ui hide package managers on sidebar
|
|
77
|
+
|
|
78
|
+
If there is a package manager of preference over others, you can define the package managers to be displayed on the detail page and sidebar, just define in the `config.yaml` and web section the list of package managers to be displayed.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
web:
|
|
82
|
+
title: Verdaccio
|
|
83
|
+
sort_packages: asc
|
|
84
|
+
primary_color: #cccccc
|
|
85
|
+
pkgManagers:
|
|
86
|
+
- pnpm
|
|
87
|
+
- yarn
|
|
88
|
+
# - npm
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
To disable all package managers, just define empty:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
web:
|
|
95
|
+
title: Verdaccio
|
|
96
|
+
sort_packages: asc
|
|
97
|
+
primary_color: #cccccc
|
|
98
|
+
pkgManagers:
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
and the section would be hidden.
|
|
102
|
+
|
|
103
|
+
## 11.0.0-6-next.5
|
|
14
104
|
|
|
15
105
|
### Patch Changes
|
|
16
106
|
|
|
17
|
-
-
|
|
107
|
+
- 19d272d1: fix: restore logger on init
|
|
18
108
|
|
|
19
|
-
|
|
20
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
109
|
+
Enable logger after parse configuration and log the very first step on startup phase.
|
|
21
110
|
|
|
22
|
-
|
|
111
|
+
```bash
|
|
112
|
+
warn --- experiments are enabled, it is recommended do not use experiments in production comment out this section to disable it
|
|
113
|
+
info --- support for experiment [token] is disabled
|
|
114
|
+
info --- support for experiment [search] is disabled
|
|
115
|
+
(node:50831) Warning: config.logs is deprecated, rename configuration to "config.log"
|
|
116
|
+
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
117
|
+
info --- http address http://localhost:4873/
|
|
118
|
+
info --- version: 6.0.0-6-next.11
|
|
119
|
+
info --- server started
|
|
120
|
+
```
|
|
23
121
|
|
|
24
|
-
|
|
122
|
+
## 11.0.0-6-next.4
|
|
123
|
+
|
|
124
|
+
### Major Changes
|
|
125
|
+
|
|
126
|
+
- 5c5057fc: feat: node api new structure based on promise
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
import { runServer } from '@verdaccio/node-api';
|
|
130
|
+
// or
|
|
131
|
+
import { runServer } from 'verdaccio';
|
|
132
|
+
|
|
133
|
+
const app = await runServer(); // default configuration
|
|
134
|
+
const app = await runServer('./config/config.yaml');
|
|
135
|
+
const app = await runServer({ configuration });
|
|
136
|
+
app.listen(4000, event => {
|
|
137
|
+
// do something
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Breaking Change
|
|
142
|
+
|
|
143
|
+
If you are using the node-api, the new structure is Promise based and less arguments.
|
|
144
|
+
|
|
145
|
+
## 10.0.0-alpha.3
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- fecbb9be: chore: add release step to private regisry on merge changeset pr
|
|
150
|
+
|
|
151
|
+
## 10.0.0-alpha.2
|
|
152
|
+
|
|
153
|
+
### Minor Changes
|
|
154
|
+
|
|
155
|
+
- 54c58d1e: feat: add server rate limit protection to all request
|
|
156
|
+
|
|
157
|
+
To modify custom values, use the server settings property.
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+
server:
|
|
161
|
+
|
|
162
|
+
## https://www.npmjs.com/package/express-rate-limit#configuration-options
|
|
163
|
+
|
|
164
|
+
rateLimit:
|
|
165
|
+
windowMs: 1000
|
|
166
|
+
max: 10000
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The values are intended to be high, if you want to improve security of your server consider
|
|
170
|
+
using different values.
|
|
171
|
+
|
|
172
|
+
## 10.0.0-alpha.1
|
|
173
|
+
|
|
174
|
+
### Major Changes
|
|
175
|
+
|
|
176
|
+
- d87fa026: feat!: experiments config renamed to flags
|
|
177
|
+
|
|
178
|
+
- The `experiments` configuration is renamed to `flags`. The functionality is exactly the same.
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
flags: token: false;
|
|
182
|
+
search: false;
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
- The `self_path` property from the config file is being removed in favor of `config_file` full path.
|
|
186
|
+
- Refactor `config` module, better types and utilities
|
|
187
|
+
|
|
188
|
+
- da1ee9c8: - Replace signature handler for legacy tokens by removing deprecated crypto.createDecipher by createCipheriv
|
|
189
|
+
|
|
190
|
+
- Introduce environment variables for legacy tokens
|
|
191
|
+
|
|
192
|
+
### Code Improvements
|
|
193
|
+
|
|
194
|
+
- Add debug library for improve developer experience
|
|
195
|
+
|
|
196
|
+
### Breaking change
|
|
197
|
+
|
|
198
|
+
- The new signature invalidates all previous tokens generated by Verdaccio 4 or previous versions.
|
|
199
|
+
- The secret key must have 32 characters long.
|
|
200
|
+
|
|
201
|
+
### New environment variables
|
|
202
|
+
|
|
203
|
+
- `VERDACCIO_LEGACY_ALGORITHM`: Allows to define the specific algorithm for the token signature which by default is `aes-256-ctr`
|
|
204
|
+
- `VERDACCIO_LEGACY_ENCRYPTION_KEY`: By default, the token stores in the database, but using this variable allows to get it from memory
|
|
205
|
+
|
|
206
|
+
### Minor Changes
|
|
207
|
+
|
|
208
|
+
- 26b494cb: feat: add typescript project references settings
|
|
209
|
+
|
|
210
|
+
Reading https://ebaytech.berlin/optimizing-multi-package-apps-with-typescript-project-references-d5c57a3b4440 I realized I can use project references to solve the issue to pre-compile modules on develop mode.
|
|
211
|
+
|
|
212
|
+
It allows to navigate (IDE) trough the packages without need compile the packages.
|
|
213
|
+
|
|
214
|
+
Add two `tsconfig`, one using the previous existing configuration that is able to produce declaration files (`tsconfig.build`) and a new one `tsconfig` which is enables [_projects references_](https://www.typescriptlang.org/docs/handbook/project-references.html).
|
|
215
|
+
|
|
216
|
+
### Patch Changes
|
|
217
|
+
|
|
218
|
+
- b57b4338: Enable prerelease mode with **changesets**
|
|
219
|
+
- 31af0164: ESLint Warnings Fixed
|
|
220
|
+
|
|
221
|
+
Related to issue #1461
|
|
222
|
+
|
|
223
|
+
- max-len: most of the sensible max-len errors are fixed
|
|
224
|
+
- no-unused-vars: most of these types of errors are fixed by deleting not needed declarations
|
|
225
|
+
- @typescript-eslint/no-unused-vars: same as above
|
|
226
|
+
|
|
227
|
+
All notable changes to this project will be documented in this file.
|
|
228
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
25
229
|
|
|
26
230
|
## [9.7.2](https://github.com/verdaccio/monorepo/compare/v9.7.1...v9.7.2) (2020-07-20)
|
|
27
231
|
|
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Typescript definitions for verdaccio plugins and internal code
|
|
4
4
|
|
|
5
5
|
# Typescript
|
|
6
|
+
|
|
6
7
|
For usage with the library, the `tsconfig.json` should looks like this.
|
|
7
8
|
|
|
8
9
|
```
|
|
@@ -44,5 +45,3 @@ import type {ILocalData, LocalStorage, Logger, Config} from '@verdaccio/types';
|
|
|
44
45
|
...
|
|
45
46
|
}
|
|
46
47
|
```
|
|
47
|
-
|
|
48
|
-
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
3
2
|
import { PassThrough } from 'stream';
|
|
4
3
|
|
|
5
4
|
declare module '@verdaccio/types' {
|
|
@@ -9,13 +8,59 @@ declare module '@verdaccio/types' {
|
|
|
9
8
|
type Callback = Function;
|
|
10
9
|
// FIXME: err should be something flexible enough for any implementation
|
|
11
10
|
type CallbackAction = (err: any | null) => void;
|
|
12
|
-
type CallbackError = (err: NodeJS.ErrnoException) => void;
|
|
13
11
|
interface Author {
|
|
12
|
+
username?: string;
|
|
14
13
|
name: string;
|
|
15
14
|
email?: string;
|
|
16
15
|
url?: string;
|
|
17
16
|
}
|
|
18
17
|
|
|
18
|
+
type PackageManagers = 'pnpm' | 'yarn' | 'npm';
|
|
19
|
+
|
|
20
|
+
// FUTURE: WebConf and TemplateUIOptions should be merged .
|
|
21
|
+
type CommonWebConf = {
|
|
22
|
+
title?: string;
|
|
23
|
+
logo?: string;
|
|
24
|
+
favicon?: string;
|
|
25
|
+
gravatar?: boolean;
|
|
26
|
+
sort_packages?: string;
|
|
27
|
+
darkMode?: boolean;
|
|
28
|
+
url_prefix?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
login?: boolean;
|
|
31
|
+
scope?: string;
|
|
32
|
+
pkgManagers?: PackageManagers[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Options are passed to the index.html
|
|
37
|
+
*/
|
|
38
|
+
export type TemplateUIOptions = {
|
|
39
|
+
uri?: string;
|
|
40
|
+
darkMode?: boolean;
|
|
41
|
+
protocol?: string;
|
|
42
|
+
host?: string;
|
|
43
|
+
scope?: string;
|
|
44
|
+
base: string;
|
|
45
|
+
primaryColor?: string;
|
|
46
|
+
version?: string;
|
|
47
|
+
logoURI?: string;
|
|
48
|
+
} & CommonWebConf;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Options on config.yaml for web
|
|
52
|
+
*/
|
|
53
|
+
type WebConf = {
|
|
54
|
+
// FIXME: rename to primaryColor and move it to CommonWebConf
|
|
55
|
+
primary_color?: string;
|
|
56
|
+
enable?: boolean;
|
|
57
|
+
scriptsHead?: string[];
|
|
58
|
+
scriptsBodyAfter?: string[];
|
|
59
|
+
metaScripts?: string[];
|
|
60
|
+
bodyBefore?: string[];
|
|
61
|
+
bodyAfter?: string[];
|
|
62
|
+
} & CommonWebConf;
|
|
63
|
+
|
|
19
64
|
interface Dist {
|
|
20
65
|
integrity?: string;
|
|
21
66
|
shasum: string;
|
|
@@ -138,7 +183,7 @@ declare module '@verdaccio/types' {
|
|
|
138
183
|
name: string;
|
|
139
184
|
versions: Versions;
|
|
140
185
|
'dist-tags': GenericBody;
|
|
141
|
-
time
|
|
186
|
+
time: GenericBody;
|
|
142
187
|
readme?: string;
|
|
143
188
|
users?: PackageUsers;
|
|
144
189
|
_distfiles: DistFiles;
|
|
@@ -147,12 +192,12 @@ declare module '@verdaccio/types' {
|
|
|
147
192
|
_rev: string;
|
|
148
193
|
}
|
|
149
194
|
|
|
150
|
-
|
|
195
|
+
interface IUploadTarball extends PassThrough {
|
|
151
196
|
abort(): void;
|
|
152
197
|
done(): void;
|
|
153
198
|
}
|
|
154
199
|
|
|
155
|
-
|
|
200
|
+
interface IReadTarball extends PassThrough {
|
|
156
201
|
abort(): void;
|
|
157
202
|
}
|
|
158
203
|
|
|
@@ -187,8 +232,18 @@ declare module '@verdaccio/types' {
|
|
|
187
232
|
publish?: string[];
|
|
188
233
|
proxy?: string[];
|
|
189
234
|
access?: string[];
|
|
235
|
+
unpublish: string[];
|
|
190
236
|
}
|
|
191
237
|
|
|
238
|
+
// info passed to the auth plugin when a package is package is being published
|
|
239
|
+
interface AllowAccess {
|
|
240
|
+
name: string;
|
|
241
|
+
version?: string;
|
|
242
|
+
tag?: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
interface AuthPackageAllow extends PackageAccess, AllowAccess {}
|
|
246
|
+
|
|
192
247
|
interface PackageList {
|
|
193
248
|
[key: string]: PackageAccess;
|
|
194
249
|
}
|
|
@@ -218,6 +273,7 @@ declare module '@verdaccio/types' {
|
|
|
218
273
|
max_users: number;
|
|
219
274
|
}
|
|
220
275
|
|
|
276
|
+
// FUTURE: rename to Notification
|
|
221
277
|
interface Notifications {
|
|
222
278
|
method: string;
|
|
223
279
|
packagePattern: RegExp;
|
|
@@ -227,25 +283,7 @@ declare module '@verdaccio/types' {
|
|
|
227
283
|
headers: Headers;
|
|
228
284
|
}
|
|
229
285
|
|
|
230
|
-
|
|
231
|
-
storage: string;
|
|
232
|
-
plugins: string;
|
|
233
|
-
self_path: string;
|
|
234
|
-
packages: PackageList;
|
|
235
|
-
uplinks: UpLinksConfList;
|
|
236
|
-
logs: LoggerConf[];
|
|
237
|
-
web: WebConf;
|
|
238
|
-
auth: AuthConf;
|
|
239
|
-
publish?: PublishOptions;
|
|
240
|
-
url_prefix?: string;
|
|
241
|
-
listen?: ListenAddress;
|
|
242
|
-
https?: HttpsConf;
|
|
243
|
-
http_proxy?: string;
|
|
244
|
-
https_proxy?: string;
|
|
245
|
-
no_proxy?: string;
|
|
246
|
-
max_body_size?: string;
|
|
247
|
-
notifications: Notifications;
|
|
248
|
-
}
|
|
286
|
+
type Notification = Notifications;
|
|
249
287
|
|
|
250
288
|
interface Token {
|
|
251
289
|
user: string;
|
|
@@ -261,7 +299,6 @@ declare module '@verdaccio/types' {
|
|
|
261
299
|
user: string;
|
|
262
300
|
}
|
|
263
301
|
|
|
264
|
-
type SyncReturn = Error | void;
|
|
265
302
|
type IPackageStorage = ILocalPackageManager | void;
|
|
266
303
|
type IPackageStorageManager = ILocalPackageManager;
|
|
267
304
|
type IPluginStorage<T> = ILocalData<T>;
|
|
@@ -285,16 +322,6 @@ declare module '@verdaccio/types' {
|
|
|
285
322
|
interface ListenAddress {
|
|
286
323
|
[key: string]: string;
|
|
287
324
|
}
|
|
288
|
-
|
|
289
|
-
interface WebConf {
|
|
290
|
-
enable?: boolean;
|
|
291
|
-
title?: string;
|
|
292
|
-
logo?: string;
|
|
293
|
-
favicon?: string;
|
|
294
|
-
gravatar?: boolean;
|
|
295
|
-
sort_packages?: string;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
325
|
interface HttpsConfKeyCert {
|
|
299
326
|
key: string;
|
|
300
327
|
cert: string;
|
|
@@ -341,32 +368,71 @@ declare module '@verdaccio/types' {
|
|
|
341
368
|
api: APITokenOptions;
|
|
342
369
|
}
|
|
343
370
|
|
|
344
|
-
interface
|
|
345
|
-
|
|
346
|
-
|
|
371
|
+
interface ConfigFlags {
|
|
372
|
+
token?: boolean;
|
|
373
|
+
search?: boolean;
|
|
374
|
+
changePassword?: boolean;
|
|
375
|
+
}
|
|
376
|
+
export type RateLimit = {
|
|
377
|
+
windowMs: number;
|
|
378
|
+
max: number;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
export type ServerSettingsConf = {
|
|
382
|
+
// express-rate-limit settings
|
|
383
|
+
rateLimit: RateLimit;
|
|
384
|
+
keepAliveTimeout?: number;
|
|
385
|
+
// force http2 if https is defined
|
|
386
|
+
http2?: boolean;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
type URLPrefix = {
|
|
390
|
+
// if is false, it would be relative by default
|
|
391
|
+
absolute: boolean;
|
|
392
|
+
// base path
|
|
393
|
+
// eg: absolute: true, https://somedomain.com/xxx/
|
|
394
|
+
// eg: absolute: false, /xxx/ (default) if url_prefix is an string instead an object
|
|
395
|
+
basePath: string;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
interface ConfigYaml {
|
|
347
399
|
_debug?: boolean;
|
|
348
400
|
storage?: string | void;
|
|
349
|
-
plugins?: string | void;
|
|
350
|
-
secret: string;
|
|
351
|
-
self_path: string;
|
|
352
401
|
packages: PackageList;
|
|
353
402
|
uplinks: UpLinksConfList;
|
|
403
|
+
// @deprecated in favor of log
|
|
354
404
|
logs?: LoggerConf[];
|
|
405
|
+
log?: LoggerConf[];
|
|
355
406
|
web?: WebConf;
|
|
356
407
|
auth?: AuthConf;
|
|
357
408
|
security: Security;
|
|
358
409
|
publish?: PublishOptions;
|
|
359
|
-
url_prefix?: string;
|
|
360
410
|
store?: any;
|
|
361
411
|
listen?: ListenAddress;
|
|
362
412
|
https?: HttpsConf;
|
|
363
413
|
http_proxy?: string;
|
|
414
|
+
plugins?: string | void;
|
|
364
415
|
https_proxy?: string;
|
|
365
416
|
no_proxy?: string;
|
|
366
417
|
max_body_size?: string;
|
|
367
418
|
notifications?: Notifications;
|
|
419
|
+
notify?: Notifications | Notifications[];
|
|
368
420
|
middlewares?: any;
|
|
369
421
|
filters?: any;
|
|
422
|
+
url_prefix?: string;
|
|
423
|
+
server?: ServerSettingsConf;
|
|
424
|
+
flags?: ConfigFlags;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
interface ConfigRuntime extends ConfigYaml {
|
|
428
|
+
config_path: string;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
interface Config extends ConfigYaml, ConfigRuntime {
|
|
432
|
+
user_agent: string;
|
|
433
|
+
server_id: string;
|
|
434
|
+
secret: string;
|
|
435
|
+
// deprecated
|
|
370
436
|
checkSecretKey(token: string): string;
|
|
371
437
|
getMatchedPackagesSpec(storage: string): PackageAccess | void;
|
|
372
438
|
[key: string]: any;
|
|
@@ -376,41 +442,25 @@ declare module '@verdaccio/types' {
|
|
|
376
442
|
https: HttpsConf;
|
|
377
443
|
}
|
|
378
444
|
|
|
379
|
-
interface ITokenActions {
|
|
445
|
+
export interface ITokenActions {
|
|
380
446
|
saveToken(token: Token): Promise<any>;
|
|
381
447
|
deleteToken(user: string, tokenKey: string): Promise<any>;
|
|
382
448
|
readTokens(filter: TokenFilter): Promise<Token[]>;
|
|
383
449
|
}
|
|
384
450
|
|
|
385
451
|
/**
|
|
386
|
-
*
|
|
387
|
-
* eg:
|
|
388
|
-
* {
|
|
389
|
-
* name: string;
|
|
390
|
-
* time: number;
|
|
391
|
-
* ... and other props
|
|
392
|
-
* }
|
|
393
|
-
*
|
|
394
|
-
* The `cb` callback object will be executed if:
|
|
395
|
-
* - it might return object (truly)
|
|
396
|
-
* - it might reutrn null
|
|
452
|
+
* @deprecated use @verdaccio/core pluginUtils instead
|
|
397
453
|
*/
|
|
398
|
-
type onSearchPackage = (item: Package, cb: CallbackAction) => void;
|
|
399
|
-
// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };`
|
|
400
|
-
// but this type is on @verdaccio/commons-api and cannot be used here yet
|
|
401
|
-
type onEndSearchPackage = (error?: any) => void;
|
|
402
|
-
type onValidatePackage = (name: string) => boolean;
|
|
403
|
-
|
|
404
454
|
interface ILocalData<T> extends IPlugin<T>, ITokenActions {
|
|
405
455
|
logger: Logger;
|
|
406
456
|
config: T & Config;
|
|
407
|
-
add(name: string
|
|
408
|
-
remove(name: string
|
|
409
|
-
get(
|
|
457
|
+
add(name: string): Promise<void>;
|
|
458
|
+
remove(name: string): Promise<void>;
|
|
459
|
+
get(): Promise<any>;
|
|
460
|
+
init(): Promise<void>;
|
|
410
461
|
getSecret(): Promise<string>;
|
|
411
462
|
setSecret(secret: string): Promise<any>;
|
|
412
463
|
getPackageStorage(packageInfo: string): IPackageStorage;
|
|
413
|
-
search(onPackage: onSearchPackage, onEnd: onEndSearchPackage, validateName: onValidatePackage): void;
|
|
414
464
|
}
|
|
415
465
|
|
|
416
466
|
type StorageUpdateCallback = (data: Package, cb: CallbackAction) => void;
|
|
@@ -425,14 +475,14 @@ declare module '@verdaccio/types' {
|
|
|
425
475
|
readTarball(pkgName: string): IReadTarball;
|
|
426
476
|
readPackage(fileName: string, callback: ReadPackageCallback): void;
|
|
427
477
|
createPackage(pkgName: string, value: Package, cb: CallbackAction): void;
|
|
428
|
-
deletePackage(fileName: string
|
|
429
|
-
removePackage(
|
|
478
|
+
deletePackage(fileName: string): Promise<void>;
|
|
479
|
+
removePackage(): Promise<void>;
|
|
430
480
|
updatePackage(
|
|
431
481
|
pkgFileName: string,
|
|
432
482
|
updateHandler: StorageUpdateCallback,
|
|
433
483
|
onWrite: StorageWriteCallback,
|
|
434
484
|
transformPackage: PackageTransformer,
|
|
435
|
-
onEnd:
|
|
485
|
+
onEnd: Callback
|
|
436
486
|
): void;
|
|
437
487
|
savePackage(fileName: string, json: Package, callback: CallbackAction): void;
|
|
438
488
|
}
|
|
@@ -444,41 +494,30 @@ declare module '@verdaccio/types' {
|
|
|
444
494
|
}
|
|
445
495
|
|
|
446
496
|
interface StoragePackageActions extends TarballActions {
|
|
447
|
-
addVersion(
|
|
497
|
+
addVersion(
|
|
498
|
+
name: string,
|
|
499
|
+
version: string,
|
|
500
|
+
metadata: Version,
|
|
501
|
+
tag: StringValue,
|
|
502
|
+
callback: Callback
|
|
503
|
+
): void;
|
|
448
504
|
mergeTags(name: string, tags: MergeTags, callback: Callback): void;
|
|
449
505
|
removePackage(name: string, callback: Callback): void;
|
|
450
506
|
changePackage(name: string, metadata: Package, revision: string, callback: Callback): void;
|
|
451
507
|
}
|
|
452
508
|
|
|
453
|
-
|
|
454
|
-
config: T & Config;
|
|
455
|
-
logger: Logger;
|
|
456
|
-
init(config: T & Config, filters: any): Promise<any>;
|
|
457
|
-
addPackage(name: string, metadata: any, callback: Callback): Promise<any>;
|
|
458
|
-
getPackage(options: any): void;
|
|
459
|
-
search(startkey: string, options: any): IReadTarball;
|
|
460
|
-
getLocalDatabase(callback: Callback): void;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
interface IBasicStorage<T> extends StoragePackageActions {
|
|
464
|
-
addPackage(name: string, info: Package, callback: Callback): void;
|
|
465
|
-
updateVersions(name: string, packageInfo: Package, callback: Callback): void;
|
|
466
|
-
getPackageMetadata(name: string, callback: Callback): void;
|
|
467
|
-
search(startKey: string, options: any): IReadTarball;
|
|
468
|
-
getSecret(config: T & Config): Promise<any>;
|
|
469
|
-
}
|
|
470
|
-
|
|
509
|
+
// @deprecated use IBasicAuth from @verdaccio/auth
|
|
471
510
|
interface IBasicAuth<T> {
|
|
472
511
|
config: T & Config;
|
|
473
|
-
aesEncrypt(buf:
|
|
512
|
+
aesEncrypt(buf: string): string;
|
|
474
513
|
authenticate(user: string, password: string, cb: Callback): void;
|
|
475
514
|
changePassword(user: string, password: string, newPassword: string, cb: Callback): void;
|
|
476
515
|
allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;
|
|
477
516
|
add_user(user: string, password: string, cb: Callback): any;
|
|
478
517
|
}
|
|
479
518
|
|
|
480
|
-
|
|
481
|
-
|
|
519
|
+
export interface Plugin<T> {
|
|
520
|
+
new (config: T, options: PluginOptions<T>): T;
|
|
482
521
|
}
|
|
483
522
|
|
|
484
523
|
interface IPlugin<T> {
|
|
@@ -492,14 +531,9 @@ declare module '@verdaccio/types' {
|
|
|
492
531
|
logger: Logger;
|
|
493
532
|
}
|
|
494
533
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
tag?: string;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` instead of AuthError
|
|
502
|
-
// but this type is on @verdaccio/commons-api and cannot be used here yet (I don't know why)
|
|
534
|
+
// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };`
|
|
535
|
+
// instead of AuthError
|
|
536
|
+
// but this type is on @verdaccio/core and cannot be used here yet (I don't know why)
|
|
503
537
|
interface HttpError extends Error {
|
|
504
538
|
status: number;
|
|
505
539
|
statusCode: number;
|
|
@@ -518,20 +552,35 @@ declare module '@verdaccio/types' {
|
|
|
518
552
|
authenticate(user: string, password: string, cb: AuthCallback): void;
|
|
519
553
|
adduser?(user: string, password: string, cb: AuthCallback): void;
|
|
520
554
|
changePassword?(user: string, password: string, newPassword: string, cb: AuthCallback): void;
|
|
521
|
-
allow_publish?(user: RemoteUser, pkg: T &
|
|
555
|
+
allow_publish?(user: RemoteUser, pkg: T & AuthPackageAllow, cb: AuthAccessCallback): void;
|
|
522
556
|
allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;
|
|
523
|
-
allow_unpublish?(user: RemoteUser, pkg: T &
|
|
524
|
-
allow_publish?(
|
|
557
|
+
allow_unpublish?(user: RemoteUser, pkg: T & AuthPackageAllow, cb: AuthAccessCallback): void;
|
|
558
|
+
allow_publish?(
|
|
559
|
+
user: RemoteUser,
|
|
560
|
+
pkg: AllowAccess & PackageAccess,
|
|
561
|
+
cb: AuthAccessCallback
|
|
562
|
+
): void;
|
|
525
563
|
allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;
|
|
526
|
-
allow_unpublish?(
|
|
564
|
+
allow_unpublish?(
|
|
565
|
+
user: RemoteUser,
|
|
566
|
+
pkg: AllowAccess & PackageAccess,
|
|
567
|
+
cb: AuthAccessCallback
|
|
568
|
+
): void;
|
|
527
569
|
apiJWTmiddleware?(helpers: any): Function;
|
|
528
570
|
}
|
|
529
571
|
|
|
572
|
+
// @deprecated use @verdaccio/server
|
|
530
573
|
interface IPluginMiddleware<T> extends IPlugin<T> {
|
|
531
|
-
register_middlewares(app: any, auth: IBasicAuth<T>, storage:
|
|
574
|
+
register_middlewares(app: any, auth: IBasicAuth<T>, storage: any): void;
|
|
532
575
|
}
|
|
533
576
|
|
|
534
577
|
interface IPluginStorageFilter<T> extends IPlugin<T> {
|
|
535
578
|
filter_metadata(packageInfo: Package): Promise<Package>;
|
|
536
579
|
}
|
|
580
|
+
|
|
581
|
+
export type SearchResultWeb = {
|
|
582
|
+
name: string;
|
|
583
|
+
version: string;
|
|
584
|
+
description: string;
|
|
585
|
+
};
|
|
537
586
|
}
|
package/package.json
CHANGED
|
@@ -1,37 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-6-next.10",
|
|
4
4
|
"description": "verdaccio types definitions",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
6
|
+
"private",
|
|
7
|
+
"package",
|
|
8
|
+
"repository",
|
|
9
|
+
"registry",
|
|
10
|
+
"enterprise",
|
|
11
|
+
"modules",
|
|
12
|
+
"proxy",
|
|
13
|
+
"server",
|
|
14
|
+
"verdaccio"
|
|
9
15
|
],
|
|
10
16
|
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
11
17
|
"license": "MIT",
|
|
12
18
|
"homepage": "https://verdaccio.org",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=14",
|
|
21
|
+
"npm": ">=6"
|
|
22
|
+
},
|
|
13
23
|
"repository": {
|
|
14
|
-
"type": "
|
|
15
|
-
"url": "https://github.com/verdaccio/
|
|
16
|
-
"directory": "core/types"
|
|
24
|
+
"type": "https",
|
|
25
|
+
"url": "https://github.com/verdaccio/verdaccio",
|
|
26
|
+
"directory": "packages/core/types"
|
|
17
27
|
},
|
|
18
28
|
"bugs": {
|
|
19
|
-
"url": "https://github.com/verdaccio/
|
|
29
|
+
"url": "https://github.com/verdaccio/verdaccio/issues"
|
|
20
30
|
},
|
|
21
31
|
"publishConfig": {
|
|
22
32
|
"access": "public"
|
|
23
33
|
},
|
|
24
34
|
"main": "index.d.ts",
|
|
25
35
|
"types": "index.d.ts",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"test": "exit 0",
|
|
38
|
+
"build": "exit 0"
|
|
39
|
+
},
|
|
26
40
|
"devDependencies": {
|
|
27
|
-
"@types/node": "14.
|
|
41
|
+
"@types/node": "14.6.0",
|
|
42
|
+
"tsd": "0.18.0"
|
|
28
43
|
},
|
|
29
44
|
"funding": {
|
|
30
45
|
"type": "opencollective",
|
|
31
46
|
"url": "https://opencollective.com/verdaccio"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"test": "exit 0",
|
|
35
|
-
"build": "exit 0"
|
|
36
47
|
}
|
|
37
|
-
}
|
|
48
|
+
}
|