@verdaccio/types 11.0.0-6-next.12 → 11.0.0-6-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +13 -34
- package/build/commons.d.ts +24 -0
- package/build/configuration.d.ts +237 -0
- package/build/manifest.d.ts +201 -0
- package/build/plugins/auth.d.ts +21 -0
- package/build/plugins/commons.d.ts +11 -0
- package/build/plugins/filter.d.ts +5 -0
- package/build/plugins/index.d.ts +25 -0
- package/build/plugins/middleware.d.ts +5 -0
- package/build/plugins/storage.d.ts +80 -0
- package/build/plugins/theme.d.ts +0 -0
- package/build/search.d.ts +26 -0
- package/build/types.d.ts +5 -0
- package/package.json +21 -11
- package/src/commons.ts +37 -0
- package/src/configuration.ts +296 -0
- package/src/manifest.ts +217 -0
- package/src/plugins/auth.ts +22 -0
- package/src/plugins/commons.ts +15 -0
- package/src/plugins/filter.ts +6 -0
- package/src/plugins/index.ts +31 -0
- package/src/plugins/middleware.ts +8 -0
- package/src/plugins/storage.ts +95 -0
- package/src/plugins/theme.ts +0 -0
- package/src/search.ts +28 -0
- package/src/types.ts +5 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +9 -0
- package/typedoc.json +5 -0
- package/index.d.ts +0 -639
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.0.0-6-next.13
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 292c0a37: feat!: replace deprecated request dependency by got
|
|
8
|
+
|
|
9
|
+
This is a big refactoring of the core, fetching dependencies, improve code, more tests and better stability. This is essential for the next release, will take some time but would allow modularize more the core.
|
|
10
|
+
|
|
11
|
+
## Notes
|
|
12
|
+
|
|
13
|
+
- Remove deprecated `request` by other `got`, retry improved, custom Agent ( got does not include it built-in)
|
|
14
|
+
- Remove `async` dependency from storage (used by core) it was linked with proxy somehow safe to remove now
|
|
15
|
+
- Refactor with promises instead callback wherever is possible
|
|
16
|
+
- ~Document the API~
|
|
17
|
+
- Improve testing, integration tests
|
|
18
|
+
- Bugfix
|
|
19
|
+
- Clean up old validations
|
|
20
|
+
- Improve performance
|
|
21
|
+
|
|
22
|
+
## 💥 Breaking changes
|
|
23
|
+
|
|
24
|
+
- Plugin API methods were callbacks based are returning promises, this will break current storage plugins, check documentation for upgrade.
|
|
25
|
+
- Write Tarball, Read Tarball methods parameters change, a new set of options like `AbortController` signals are being provided to the `addAbortSignal` can be internally used with Streams when a request is aborted. eg: `addAbortSignal(signal, fs.createReadStream(pathName));`
|
|
26
|
+
- `@verdaccio/streams` stream abort support is legacy is being deprecated removed
|
|
27
|
+
- Remove AWS and Google Cloud packages for future refactoring [#2574](https://github.com/verdaccio/verdaccio/pull/2574).
|
|
28
|
+
|
|
29
|
+
- a3a209b5: feat: migrate to pino.js 8
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- 5cf041a1: feat: add dist.signatures to core/types
|
|
34
|
+
|
|
35
|
+
According to [`npm`](https://docs.npmjs.com/about-registry-signatures): _"Signatures are provided in the package's `packument` in each published version within the `dist` object"_
|
|
36
|
+
|
|
37
|
+
Here's an [example of a package version from the public npm registry with `dist.signatures`](https://registry.npmjs.org/light-cycle/1.4.3).
|
|
38
|
+
|
|
3
39
|
## 11.0.0-6-next.12
|
|
4
40
|
|
|
5
41
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @verdaccio/types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript definitions for Verdaccio plugins and internal code.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
//tsconfig.json
|
|
11
|
-
{
|
|
12
|
-
"compilerOptions": {
|
|
13
|
-
"target": "esnext",
|
|
14
|
-
"module": "commonjs",
|
|
15
|
-
"declaration": true,
|
|
16
|
-
"noImplicitAny": false,
|
|
17
|
-
"strict": true,
|
|
18
|
-
"outDir": "lib",
|
|
19
|
-
"allowSyntheticDefaultImports": true,
|
|
20
|
-
"esModuleInterop": true,
|
|
21
|
-
"typeRoots": [
|
|
22
|
-
"./node_modules/@verdaccio/types/lib/verdaccio",
|
|
23
|
-
"./node_modules/@types"
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
"include": [
|
|
27
|
-
"src/*.ts",
|
|
28
|
-
"types/*.d.ts"
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Imports
|
|
34
|
-
|
|
35
|
-
```
|
|
7
|
+
```ts
|
|
36
8
|
import type {ILocalData, LocalStorage, Logger, Config} from '@verdaccio/types';
|
|
37
9
|
|
|
38
|
-
|
|
39
|
-
|
|
10
|
+
class LocalData implements ILocalData {
|
|
40
11
|
path: string;
|
|
41
12
|
logger: Logger;
|
|
42
13
|
data: LocalStorage;
|
|
@@ -45,3 +16,11 @@ import type {ILocalData, LocalStorage, Logger, Config} from '@verdaccio/types';
|
|
|
45
16
|
...
|
|
46
17
|
}
|
|
47
18
|
```
|
|
19
|
+
|
|
20
|
+
### Run docs
|
|
21
|
+
|
|
22
|
+
Generate the package types documentation at `./docs` folder.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm build:docs
|
|
26
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare type Callback = Function;
|
|
3
|
+
export declare type CallbackAction = (err: any | null) => void;
|
|
4
|
+
export declare type CallbackError = (err: NodeJS.ErrnoException) => void;
|
|
5
|
+
export interface RemoteUser {
|
|
6
|
+
real_groups: string[];
|
|
7
|
+
groups: string[];
|
|
8
|
+
name: string | void;
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare type StringValue = string | void | null;
|
|
12
|
+
export interface HttpError extends Error {
|
|
13
|
+
status: number;
|
|
14
|
+
statusCode: number;
|
|
15
|
+
expose: boolean;
|
|
16
|
+
headers?: {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
export declare type URLPrefix = {
|
|
22
|
+
absolute: boolean;
|
|
23
|
+
basePath: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { PackageAccess, PackageList } from './manifest';
|
|
2
|
+
export declare type TypeToken = 'Bearer' | 'Basic';
|
|
3
|
+
export interface Logger {
|
|
4
|
+
child: (conf: any) => any;
|
|
5
|
+
debug: (conf: any, template?: string) => void;
|
|
6
|
+
error: (conf: any, template?: string) => void;
|
|
7
|
+
http: (conf: any, template?: string) => void;
|
|
8
|
+
trace: (conf: any, template?: string) => void;
|
|
9
|
+
warn: (conf: any, template?: string) => void;
|
|
10
|
+
info: (conf: any, template?: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare type LoggerType = 'stdout' | 'file';
|
|
13
|
+
export declare type LoggerFormat = 'pretty' | 'pretty-timestamped' | 'json';
|
|
14
|
+
export declare type LoggerLevel = 'http' | 'fatal' | 'warn' | 'info' | 'debug' | 'trace';
|
|
15
|
+
export declare type LoggerConfigItem = {
|
|
16
|
+
type?: LoggerType;
|
|
17
|
+
/**
|
|
18
|
+
* The format
|
|
19
|
+
*/
|
|
20
|
+
format?: LoggerFormat;
|
|
21
|
+
path?: string;
|
|
22
|
+
level?: string;
|
|
23
|
+
colors?: boolean;
|
|
24
|
+
async?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export interface ConfigWithHttps extends Config {
|
|
27
|
+
https: HttpsConf;
|
|
28
|
+
}
|
|
29
|
+
export interface PackageAccessYaml {
|
|
30
|
+
storage?: string;
|
|
31
|
+
publish?: string;
|
|
32
|
+
proxy?: string;
|
|
33
|
+
access?: string;
|
|
34
|
+
unpublish?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface LoggerConfItem {
|
|
37
|
+
type: LoggerType;
|
|
38
|
+
format: LoggerFormat;
|
|
39
|
+
level: LoggerLevel;
|
|
40
|
+
}
|
|
41
|
+
export interface Headers {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
}
|
|
44
|
+
export interface UpLinkTokenConf {
|
|
45
|
+
type: TypeToken;
|
|
46
|
+
token?: string;
|
|
47
|
+
token_env?: boolean | string;
|
|
48
|
+
}
|
|
49
|
+
export interface UpLinkConf {
|
|
50
|
+
url: string;
|
|
51
|
+
ca?: string;
|
|
52
|
+
cache?: boolean;
|
|
53
|
+
timeout?: string | void;
|
|
54
|
+
maxage?: string | void;
|
|
55
|
+
max_fails?: number | void;
|
|
56
|
+
fail_timeout?: string | void;
|
|
57
|
+
headers?: Headers;
|
|
58
|
+
auth?: UpLinkTokenConf;
|
|
59
|
+
strict_ssl?: boolean | void;
|
|
60
|
+
_autogenerated?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare type RateLimit = {
|
|
63
|
+
windowMs?: number;
|
|
64
|
+
max?: number;
|
|
65
|
+
};
|
|
66
|
+
export declare type FlagsConfig = {
|
|
67
|
+
searchRemote?: boolean;
|
|
68
|
+
changePassword?: boolean;
|
|
69
|
+
};
|
|
70
|
+
export declare type PackageManagers = 'pnpm' | 'yarn' | 'npm';
|
|
71
|
+
export declare type CommonWebConf = {
|
|
72
|
+
title?: string;
|
|
73
|
+
logo?: string;
|
|
74
|
+
favicon?: string;
|
|
75
|
+
gravatar?: boolean;
|
|
76
|
+
sort_packages?: string;
|
|
77
|
+
darkMode?: boolean;
|
|
78
|
+
url_prefix?: string;
|
|
79
|
+
language?: string;
|
|
80
|
+
login?: boolean;
|
|
81
|
+
scope?: string;
|
|
82
|
+
pkgManagers?: PackageManagers[];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Options are passed to the index.html
|
|
86
|
+
*/
|
|
87
|
+
export declare type TemplateUIOptions = {
|
|
88
|
+
uri?: string;
|
|
89
|
+
darkMode?: boolean;
|
|
90
|
+
protocol?: string;
|
|
91
|
+
host?: string;
|
|
92
|
+
basename?: string;
|
|
93
|
+
scope?: string;
|
|
94
|
+
showInfo?: boolean;
|
|
95
|
+
showSettings?: boolean;
|
|
96
|
+
showSearch?: boolean;
|
|
97
|
+
showFooter?: boolean;
|
|
98
|
+
showThemeSwitch?: boolean;
|
|
99
|
+
showDownloadTarball?: boolean;
|
|
100
|
+
showRaw?: boolean;
|
|
101
|
+
base: string;
|
|
102
|
+
primaryColor?: string;
|
|
103
|
+
version?: string;
|
|
104
|
+
logoURI?: string;
|
|
105
|
+
flags: FlagsConfig;
|
|
106
|
+
} & CommonWebConf;
|
|
107
|
+
/**
|
|
108
|
+
* Options on config.yaml for web
|
|
109
|
+
*/
|
|
110
|
+
export declare type WebConf = {
|
|
111
|
+
primary_color?: string;
|
|
112
|
+
enable?: boolean;
|
|
113
|
+
scriptsHead?: string[];
|
|
114
|
+
scriptsBodyAfter?: string[];
|
|
115
|
+
metaScripts?: string[];
|
|
116
|
+
bodyBefore?: string[];
|
|
117
|
+
bodyAfter?: string[];
|
|
118
|
+
} & CommonWebConf;
|
|
119
|
+
export interface UpLinksConfList {
|
|
120
|
+
[key: string]: UpLinkConf;
|
|
121
|
+
}
|
|
122
|
+
export interface AuthHtpasswd {
|
|
123
|
+
file: string;
|
|
124
|
+
max_users: number;
|
|
125
|
+
}
|
|
126
|
+
export declare type AuthConf = any | AuthHtpasswd;
|
|
127
|
+
export interface JWTOptions {
|
|
128
|
+
sign: JWTSignOptions;
|
|
129
|
+
verify: JWTVerifyOptions;
|
|
130
|
+
}
|
|
131
|
+
export interface JWTSignOptions {
|
|
132
|
+
algorithm?: string;
|
|
133
|
+
expiresIn?: string;
|
|
134
|
+
notBefore?: string;
|
|
135
|
+
ignoreExpiration?: boolean;
|
|
136
|
+
maxAge?: string | number;
|
|
137
|
+
clockTimestamp?: number;
|
|
138
|
+
}
|
|
139
|
+
export interface JWTVerifyOptions {
|
|
140
|
+
algorithm?: string;
|
|
141
|
+
expiresIn?: string;
|
|
142
|
+
notBefore?: string | number;
|
|
143
|
+
ignoreExpiration?: boolean;
|
|
144
|
+
maxAge?: string | number;
|
|
145
|
+
clockTimestamp?: number;
|
|
146
|
+
}
|
|
147
|
+
export interface APITokenOptions {
|
|
148
|
+
legacy: boolean;
|
|
149
|
+
jwt?: JWTOptions;
|
|
150
|
+
}
|
|
151
|
+
export interface Security {
|
|
152
|
+
web: JWTOptions;
|
|
153
|
+
api: APITokenOptions;
|
|
154
|
+
}
|
|
155
|
+
export interface PublishOptions {
|
|
156
|
+
allow_offline: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface ListenAddress {
|
|
159
|
+
[key: string]: string;
|
|
160
|
+
}
|
|
161
|
+
export interface HttpsConfKeyCert {
|
|
162
|
+
key: string;
|
|
163
|
+
cert: string;
|
|
164
|
+
ca?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface HttpsConfPfx {
|
|
167
|
+
pfx: string;
|
|
168
|
+
passphrase?: string;
|
|
169
|
+
}
|
|
170
|
+
export declare type HttpsConf = HttpsConfKeyCert | HttpsConfPfx;
|
|
171
|
+
export interface Notifications {
|
|
172
|
+
method: string;
|
|
173
|
+
packagePattern: RegExp;
|
|
174
|
+
packagePatternFlags: string;
|
|
175
|
+
endpoint: string;
|
|
176
|
+
content: string;
|
|
177
|
+
headers: Headers;
|
|
178
|
+
}
|
|
179
|
+
export declare type Notification = Notifications;
|
|
180
|
+
export declare type ServerSettingsConf = {
|
|
181
|
+
rateLimit: RateLimit;
|
|
182
|
+
keepAliveTimeout?: number;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* YAML configuration file available options.
|
|
186
|
+
*/
|
|
187
|
+
export interface ConfigYaml {
|
|
188
|
+
_debug?: boolean;
|
|
189
|
+
storage?: string | void;
|
|
190
|
+
packages: PackageList;
|
|
191
|
+
uplinks: UpLinksConfList;
|
|
192
|
+
log?: LoggerConfItem;
|
|
193
|
+
web?: WebConf;
|
|
194
|
+
auth?: AuthConf;
|
|
195
|
+
security: Security;
|
|
196
|
+
publish?: PublishOptions;
|
|
197
|
+
store?: any;
|
|
198
|
+
listen?: ListenAddress;
|
|
199
|
+
https?: HttpsConf;
|
|
200
|
+
http_proxy?: string;
|
|
201
|
+
plugins?: string | void;
|
|
202
|
+
https_proxy?: string;
|
|
203
|
+
no_proxy?: string;
|
|
204
|
+
max_body_size?: string;
|
|
205
|
+
notifications?: Notifications;
|
|
206
|
+
notify?: Notifications | Notifications[];
|
|
207
|
+
middlewares?: any;
|
|
208
|
+
filters?: any;
|
|
209
|
+
url_prefix?: string;
|
|
210
|
+
server?: ServerSettingsConf;
|
|
211
|
+
flags?: FlagsConfig;
|
|
212
|
+
config_path?: string;
|
|
213
|
+
configPath?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Configuration object with additonal methods for configuration, includes yaml and internal medatada.
|
|
217
|
+
* @interface Config
|
|
218
|
+
* @extends {ConfigYaml}
|
|
219
|
+
*/
|
|
220
|
+
export interface Config extends Omit<ConfigYaml, 'packages' | 'security' | 'configPath'> {
|
|
221
|
+
user_agent: string;
|
|
222
|
+
server_id: string;
|
|
223
|
+
secret: string;
|
|
224
|
+
configPath: string;
|
|
225
|
+
packages: PackageList;
|
|
226
|
+
security: Security;
|
|
227
|
+
checkSecretKey(token: string): string;
|
|
228
|
+
getMatchedPackagesSpec(storage: string): PackageAccess | void;
|
|
229
|
+
[key: string]: any;
|
|
230
|
+
}
|
|
231
|
+
export interface AllowAccess {
|
|
232
|
+
name: string;
|
|
233
|
+
version?: string;
|
|
234
|
+
tag?: string;
|
|
235
|
+
}
|
|
236
|
+
export interface AuthPackageAllow extends PackageAccess, AllowAccess {
|
|
237
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
export interface PackageAccess {
|
|
2
|
+
storage?: string;
|
|
3
|
+
publish?: string[];
|
|
4
|
+
proxy?: string[];
|
|
5
|
+
access?: string[];
|
|
6
|
+
unpublish: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface PackageList {
|
|
9
|
+
[key: string]: PackageAccess;
|
|
10
|
+
}
|
|
11
|
+
export interface MergeTags {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DistFile {
|
|
15
|
+
url: string;
|
|
16
|
+
sha: string;
|
|
17
|
+
registry?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DistFiles {
|
|
20
|
+
[key: string]: DistFile;
|
|
21
|
+
}
|
|
22
|
+
export interface Token {
|
|
23
|
+
user: string;
|
|
24
|
+
token: string;
|
|
25
|
+
key: string;
|
|
26
|
+
cidr?: string[];
|
|
27
|
+
readonly: boolean;
|
|
28
|
+
created: number | string;
|
|
29
|
+
updated?: number | string;
|
|
30
|
+
}
|
|
31
|
+
export interface AttachMents {
|
|
32
|
+
[key: string]: AttachMentsItem;
|
|
33
|
+
}
|
|
34
|
+
export interface AttachMentsItem {
|
|
35
|
+
content_type?: string;
|
|
36
|
+
data?: string;
|
|
37
|
+
length?: number;
|
|
38
|
+
shasum?: string;
|
|
39
|
+
version?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface GenericBody {
|
|
42
|
+
[key: string]: string;
|
|
43
|
+
}
|
|
44
|
+
export interface UpLinkMetadata {
|
|
45
|
+
etag: string;
|
|
46
|
+
fetched: number;
|
|
47
|
+
}
|
|
48
|
+
export interface UpLinks {
|
|
49
|
+
[key: string]: UpLinkMetadata;
|
|
50
|
+
}
|
|
51
|
+
export interface Signatures {
|
|
52
|
+
keyid: string;
|
|
53
|
+
sig: string;
|
|
54
|
+
}
|
|
55
|
+
export interface Dist {
|
|
56
|
+
'npm-signature'?: string;
|
|
57
|
+
signatures?: Signatures[];
|
|
58
|
+
fileCount?: number;
|
|
59
|
+
integrity?: string;
|
|
60
|
+
shasum: string;
|
|
61
|
+
unpackedSize?: number;
|
|
62
|
+
tarball: string;
|
|
63
|
+
}
|
|
64
|
+
export interface Author {
|
|
65
|
+
username?: string;
|
|
66
|
+
name: string;
|
|
67
|
+
email?: string;
|
|
68
|
+
url?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface PackageUsers {
|
|
71
|
+
[key: string]: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface Tags {
|
|
74
|
+
[key: string]: Version;
|
|
75
|
+
}
|
|
76
|
+
export interface Version {
|
|
77
|
+
name: string;
|
|
78
|
+
version: string;
|
|
79
|
+
devDependencies?: string;
|
|
80
|
+
directories?: any;
|
|
81
|
+
dist: Dist;
|
|
82
|
+
author: string | Author;
|
|
83
|
+
main: string;
|
|
84
|
+
homemage?: string;
|
|
85
|
+
license?: string;
|
|
86
|
+
readme: string;
|
|
87
|
+
readmeFileName?: string;
|
|
88
|
+
readmeFilename?: string;
|
|
89
|
+
description: string;
|
|
90
|
+
bin?: string;
|
|
91
|
+
bugs?: any;
|
|
92
|
+
files?: string[];
|
|
93
|
+
gitHead?: string;
|
|
94
|
+
maintainers?: Author[];
|
|
95
|
+
contributors?: Author[];
|
|
96
|
+
repository?: string | any;
|
|
97
|
+
scripts?: any;
|
|
98
|
+
homepage?: string;
|
|
99
|
+
etag?: string;
|
|
100
|
+
dependencies: any;
|
|
101
|
+
keywords?: string | string[];
|
|
102
|
+
nodeVersion?: string;
|
|
103
|
+
_id: string;
|
|
104
|
+
_npmVersion?: string;
|
|
105
|
+
_npmUser: Author;
|
|
106
|
+
_hasShrinkwrap?: boolean;
|
|
107
|
+
deprecated?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface Versions {
|
|
110
|
+
[key: string]: Version;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @deprecated use Manifest instead
|
|
114
|
+
*/
|
|
115
|
+
export interface Package {
|
|
116
|
+
_id?: string;
|
|
117
|
+
name: string;
|
|
118
|
+
versions: Versions;
|
|
119
|
+
'dist-tags': GenericBody;
|
|
120
|
+
time: GenericBody;
|
|
121
|
+
readme?: string;
|
|
122
|
+
users?: PackageUsers;
|
|
123
|
+
_distfiles: DistFiles;
|
|
124
|
+
_attachments: AttachMents;
|
|
125
|
+
_uplinks: UpLinks;
|
|
126
|
+
_rev: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Represents upstream manifest from another registry
|
|
130
|
+
*/
|
|
131
|
+
export interface FullRemoteManifest {
|
|
132
|
+
_id?: string;
|
|
133
|
+
_rev?: string;
|
|
134
|
+
name: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
'dist-tags': GenericBody;
|
|
137
|
+
time: GenericBody;
|
|
138
|
+
versions: Versions;
|
|
139
|
+
maintainers?: Author[];
|
|
140
|
+
/** store the latest readme **/
|
|
141
|
+
readme?: string;
|
|
142
|
+
/** store star assigned to this packages by users */
|
|
143
|
+
users?: PackageUsers;
|
|
144
|
+
access?: any;
|
|
145
|
+
bugs?: {
|
|
146
|
+
url: string;
|
|
147
|
+
};
|
|
148
|
+
license?: string;
|
|
149
|
+
homepage?: string;
|
|
150
|
+
repository?: string | {
|
|
151
|
+
type?: string;
|
|
152
|
+
url: string;
|
|
153
|
+
directory?: string;
|
|
154
|
+
};
|
|
155
|
+
keywords?: string[];
|
|
156
|
+
}
|
|
157
|
+
export interface Manifest extends FullRemoteManifest, PublishManifest {
|
|
158
|
+
/**
|
|
159
|
+
* store fast access to the dist url of an specific tarball, instead search version
|
|
160
|
+
* by id, just the tarball id is faster.
|
|
161
|
+
*
|
|
162
|
+
* The _distfiles is created only when a package is being sync from an upstream.
|
|
163
|
+
* also used to fetch tarballs from upstream, the private publish tarballs are not stored in
|
|
164
|
+
* this object because they are not published in the upstream registry.
|
|
165
|
+
*/
|
|
166
|
+
_distfiles: DistFiles;
|
|
167
|
+
/**
|
|
168
|
+
* Store access cache metadata, to avoid to fetch the same metadata multiple times.
|
|
169
|
+
*
|
|
170
|
+
* The key represents the uplink id which is composed of a etag and a fetched timestamp.
|
|
171
|
+
*
|
|
172
|
+
* The fetched timestamp is the time when the metadata was fetched, used to avoid to fetch the
|
|
173
|
+
* same metadata until the metadata is older than the last fetch.
|
|
174
|
+
*/
|
|
175
|
+
_uplinks: UpLinks;
|
|
176
|
+
/**
|
|
177
|
+
* store the revision of the manifest
|
|
178
|
+
*/
|
|
179
|
+
_rev: string;
|
|
180
|
+
}
|
|
181
|
+
export interface PublishManifest {
|
|
182
|
+
/**
|
|
183
|
+
* The `_attachments` object has different usages:
|
|
184
|
+
*
|
|
185
|
+
* - When a package is published, it contains the tarball as an string, this string is used to be
|
|
186
|
+
* converted as a tarball, usually attached to the package but not stored in the database.
|
|
187
|
+
* - If user runs `npm star` the _attachments will be at the manifest body but empty.
|
|
188
|
+
*
|
|
189
|
+
* It has also an internal usage:
|
|
190
|
+
*
|
|
191
|
+
* - Used as a cache for the tarball, quick access to the tarball shasum, etc. Instead
|
|
192
|
+
* iterate versions and find the right one, just using the tarball as a key which is what
|
|
193
|
+
* the package manager sends to the registry.
|
|
194
|
+
*
|
|
195
|
+
* - A `_attachments` object is added every time a private tarball is published, upstream cached tarballs are
|
|
196
|
+
* not being part of this object, only for published private packages.
|
|
197
|
+
*
|
|
198
|
+
* Note: This field is removed when the package is accesed through the web user interface.
|
|
199
|
+
* */
|
|
200
|
+
_attachments: AttachMents;
|
|
201
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Callback, HttpError, RemoteUser } from '../commons';
|
|
3
|
+
import { Config } from '../configuration';
|
|
4
|
+
export interface AuthPluginPackage {
|
|
5
|
+
packageName: string;
|
|
6
|
+
packageVersion?: string;
|
|
7
|
+
tag?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare type AuthError = HttpError & {
|
|
10
|
+
code: number;
|
|
11
|
+
};
|
|
12
|
+
export declare type AuthAccessCallback = (error: AuthError | null, access: boolean) => void;
|
|
13
|
+
export declare type AuthCallback = (error: AuthError | null, groups: string[] | false) => void;
|
|
14
|
+
export interface IBasicAuth<T> {
|
|
15
|
+
config: T & Config;
|
|
16
|
+
aesEncrypt(buf: Buffer): Buffer;
|
|
17
|
+
authenticate(user: string, password: string, cb: Callback): void;
|
|
18
|
+
changePassword(user: string, password: string, newPassword: string, cb: Callback): void;
|
|
19
|
+
allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;
|
|
20
|
+
add_user(user: string, password: string, cb: Callback): any;
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Config, Logger } from '../configuration';
|
|
2
|
+
export declare class Plugin<T> {
|
|
3
|
+
constructor(config: T, options: PluginOptions<T>);
|
|
4
|
+
}
|
|
5
|
+
export interface IPlugin<T> {
|
|
6
|
+
version?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginOptions<T> {
|
|
9
|
+
config: T & Config;
|
|
10
|
+
logger: Logger;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RemoteUser } from '../commons';
|
|
2
|
+
import { AllowAccess } from '../configuration';
|
|
3
|
+
import { PackageAccess } from '../manifest';
|
|
4
|
+
import { AuthAccessCallback, AuthCallback } from './auth';
|
|
5
|
+
import { IPlugin } from './commons';
|
|
6
|
+
export interface IPluginAuth<T> extends IPlugin<T> {
|
|
7
|
+
/**
|
|
8
|
+
* @param props user from Application component
|
|
9
|
+
*/
|
|
10
|
+
authenticate(user: string, password: string, cb: AuthCallback): void;
|
|
11
|
+
adduser?(user: string, password: string, cb: AuthCallback): void;
|
|
12
|
+
changePassword?(user: string, password: string, newPassword: string, cb: AuthCallback): void;
|
|
13
|
+
allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;
|
|
14
|
+
allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;
|
|
15
|
+
allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;
|
|
16
|
+
allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;
|
|
17
|
+
allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;
|
|
18
|
+
allow_unpublish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;
|
|
19
|
+
apiJWTmiddleware?(helpers: any): Function;
|
|
20
|
+
}
|
|
21
|
+
export * from './auth';
|
|
22
|
+
export * from './storage';
|
|
23
|
+
export * from './middleware';
|
|
24
|
+
export * from './commons';
|
|
25
|
+
export * from './filter';
|