@verdaccio/types 11.0.0-6-next.24 → 12.0.0-next-7.3

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 CHANGED
@@ -1,5 +1,424 @@
1
1
  # Change Log
2
2
 
3
+ ## 12.0.0-next-7.3
4
+
5
+ ### Minor Changes
6
+
7
+ - bd8703e: feat: add migrateToSecureLegacySignature and remove enhancedLegacySignature property
8
+
9
+ ## 12.0.0-next.2
10
+
11
+ ### Minor Changes
12
+
13
+ - f047cc8: refactor: auth with legacy sign support
14
+
15
+ ## 12.0.0-next.1
16
+
17
+ ### Major Changes
18
+
19
+ - e7ebccb61: update major dependencies, remove old nodejs support
20
+
21
+ ## 12.0.0-next.0
22
+
23
+ ### Major Changes
24
+
25
+ - feat!: bump to v7
26
+
27
+ ## 11.0.0
28
+
29
+ ### Major Changes
30
+
31
+ - 292c0a37f: feat!: replace deprecated request dependency by got
32
+
33
+ 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.
34
+
35
+ ## Notes
36
+
37
+ - Remove deprecated `request` by other `got`, retry improved, custom Agent ( got does not include it built-in)
38
+ - Remove `async` dependency from storage (used by core) it was linked with proxy somehow safe to remove now
39
+ - Refactor with promises instead callback wherever is possible
40
+ - ~Document the API~
41
+ - Improve testing, integration tests
42
+ - Bugfix
43
+ - Clean up old validations
44
+ - Improve performance
45
+
46
+ ## 💥 Breaking changes
47
+
48
+ - Plugin API methods were callbacks based are returning promises, this will break current storage plugins, check documentation for upgrade.
49
+ - 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));`
50
+ - `@verdaccio/streams` stream abort support is legacy is being deprecated removed
51
+ - Remove AWS and Google Cloud packages for future refactoring [#2574](https://github.com/verdaccio/verdaccio/pull/2574).
52
+
53
+ - a3a209b5e: feat: migrate to pino.js 8
54
+ - 459b6fa72: refactor: search v1 endpoint and local-database
55
+
56
+ - refactor search `api v1` endpoint, improve performance
57
+ - remove usage of `async` dependency https://github.com/verdaccio/verdaccio/issues/1225
58
+ - refactor method storage class
59
+ - create new module `core` to reduce the ammount of modules with utilities
60
+ - use `undici` instead `node-fetch`
61
+ - use `fastify` instead `express` for functional test
62
+
63
+ ### Breaking changes
64
+
65
+ - plugin storage API changes
66
+ - remove old search endpoint (return 404)
67
+ - filter local private packages at plugin level
68
+
69
+ 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.
70
+
71
+ ```ts
72
+ export interface IPluginStorage<T> extends IPlugin {
73
+ add(name: string): Promise<void>;
74
+ remove(name: string): Promise<void>;
75
+ get(): Promise<any>;
76
+ init(): Promise<void>;
77
+ getSecret(): Promise<string>;
78
+ setSecret(secret: string): Promise<any>;
79
+ getPackageStorage(packageInfo: string): IPackageStorage;
80
+ search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;
81
+ saveToken(token: Token): Promise<any>;
82
+ deleteToken(user: string, tokenKey: string): Promise<any>;
83
+ readTokens(filter: TokenFilter): Promise<Token[]>;
84
+ }
85
+ ```
86
+
87
+ - 9fc2e7961: feat(plugins): improve plugin loader
88
+
89
+ ### Changes
90
+
91
+ - Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
92
+ - Avoid config collisions https://github.com/verdaccio/verdaccio/issues/928
93
+ - https://github.com/verdaccio/verdaccio/issues/1394
94
+ - `config.plugins` plugin path validations
95
+ - Updated algorithm for plugin loader.
96
+ - improved documentation (included dev)
97
+
98
+ ## Features
99
+
100
+ - Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
101
+ - Custom prefix:
102
+
103
+ ```
104
+ // config.yaml
105
+ server:
106
+ pluginPrefix: mycompany
107
+ middleware:
108
+ audit:
109
+ foo: 1
110
+ ```
111
+
112
+ This configuration will look up for `mycompany-audit` instead `Verdaccio-audit`.
113
+
114
+ ## Breaking Changes
115
+
116
+ ### sinopia plugins
117
+
118
+ - `sinopia` fallback support is removed, but can be restored using `pluginPrefix`
119
+
120
+ ### plugin filter
121
+
122
+ - method rename `filter_metadata`->`filterMetadata`
123
+
124
+ ### Plugin constructor does not merge configs anymore https://github.com/verdaccio/verdaccio/issues/928
125
+
126
+ The plugin receives as first argument `config`, which represents the config of the plugin. Example:
127
+
128
+ ```
129
+ // config.yaml
130
+ auth:
131
+ plugin:
132
+ foo: 1
133
+ bar: 2
134
+
135
+ export class Plugin<T> {
136
+ public constructor(config: T, options: PluginOptions) {
137
+ console.log(config);
138
+ // {foo:1, bar: 2}
139
+ }
140
+ }
141
+ ```
142
+
143
+ - 794af76c5: Remove Node 12 support
144
+
145
+ - We need move to the new `undici` and does not support Node.js 12
146
+
147
+ - 10aeb4f13: feat!: experiments config renamed to flags
148
+
149
+ - The `experiments` configuration is renamed to `flags`. The functionality is exactly the same.
150
+
151
+ ```js
152
+ flags: token: false;
153
+ search: false;
154
+ ```
155
+
156
+ - The `self_path` property from the config file is being removed in favor of `config_file` full path.
157
+ - Refactor `config` module, better types and utilities
158
+
159
+ - e367c3f1e: - Replace signature handler for legacy tokens by removing deprecated crypto.createDecipher by createCipheriv
160
+
161
+ - Introduce environment variables for legacy tokens
162
+
163
+ ### Code Improvements
164
+
165
+ - Add debug library for improve developer experience
166
+
167
+ ### Breaking change
168
+
169
+ - The new signature invalidates all previous tokens generated by Verdaccio 4 or previous versions.
170
+ - The secret key must have 32 characters long.
171
+
172
+ ### New environment variables
173
+
174
+ - `VERDACCIO_LEGACY_ALGORITHM`: Allows to define the specific algorithm for the token signature which by default is `aes-256-ctr`
175
+ - `VERDACCIO_LEGACY_ENCRYPTION_KEY`: By default, the token stores in the database, but using this variable allows to get it from memory
176
+
177
+ - 999787974: feat(web): components for custom user interfaces
178
+
179
+ Provides a package that includes all components from the user interface, instead being embedded at the `@verdaccio/ui-theme` package.
180
+
181
+ ```
182
+ npm i -D @verdaccio/ui-components
183
+ ```
184
+
185
+ The package contains
186
+
187
+ - Components
188
+ - Providers
189
+ - Redux Storage
190
+ - Layouts (precomposed layouts ready to use)
191
+ - Custom Material Theme
192
+
193
+ The `@verdaccio/ui-theme` will consume this package and will use only those are need it.
194
+
195
+ > Prerequisites are using Redux, Material-UI and Translations with `i18next`.
196
+
197
+ Users could have their own Material UI theme and build custom layouts, adding new features without the need to modify the default project.
198
+
199
+ - 82cb0f2bf: feat!: config.logs throw an error, logging config not longer accept array or logs property
200
+
201
+ ### 💥 Breaking change
202
+
203
+ This is valid
204
+
205
+ ```yaml
206
+ log: { type: stdout, format: pretty, level: http }
207
+ ```
208
+
209
+ This is invalid
210
+
211
+ ```yaml
212
+ logs: { type: stdout, format: pretty, level: http }
213
+ ```
214
+
215
+ or
216
+
217
+ ```yaml
218
+ logs:
219
+ - [{ type: stdout, format: pretty, level: http }]
220
+ ```
221
+
222
+ - 000d43746: feat: upgrade to material ui 5
223
+ - 8f43bf17d: feat: node api new structure based on promise
224
+
225
+ ```js
226
+ import { runServer } from "@verdaccio/node-api";
227
+ // or
228
+ import { runServer } from "verdaccio";
229
+
230
+ const app = await runServer(); // default configuration
231
+ const app = await runServer("./config/config.yaml");
232
+ const app = await runServer({ configuration });
233
+ app.listen(4000, (event) => {
234
+ // do something
235
+ });
236
+ ```
237
+
238
+ ### Breaking Change
239
+
240
+ If you are using the node-api, the new structure is Promise based and less arguments.
241
+
242
+ ### Minor Changes
243
+
244
+ - 0da7031e7: allow disable login on ui and endpoints
245
+
246
+ To be able disable the login, set `login: false`, anything else would enable login. This flag will disable access via UI and web endpoints.
247
+
248
+ ```yml
249
+ web:
250
+ title: verdaccio
251
+ login: false
252
+ ```
253
+
254
+ - 974cd8c19: fix: startup messages improved and logs support on types
255
+ - ef88da3b4: feat: improve support for fs promises older nodejs
256
+ - 631abe1ac: feat: refactor logger
257
+ - b61f762d6: feat: add server rate limit protection to all request
258
+
259
+ To modify custom values, use the server settings property.
260
+
261
+ ```markdown
262
+ server:
263
+
264
+ ## https://www.npmjs.com/package/express-rate-limit#configuration-options
265
+
266
+ rateLimit:
267
+ windowMs: 1000
268
+ max: 10000
269
+ ```
270
+
271
+ The values are intended to be high, if you want to improve security of your server consider
272
+ using different values.
273
+
274
+ - d43894e8f: feat: rework web header for mobile, add new settings and raw manifest button
275
+
276
+ ### New set of variables to hide features
277
+
278
+ Add set of new variables that allow hide different parts of the UI, buttons, footer or download tarballs. _All are
279
+ enabled by default_.
280
+
281
+ ```yaml
282
+ # login: true <-- already exist but worth the reminder
283
+ # showInfo: true
284
+ # showSettings: true
285
+ # In combination with darkMode you can force specific theme
286
+ # showThemeSwitch: true
287
+ # showFooter: true
288
+ # showSearch: true
289
+ # showDownloadTarball: true
290
+ ```
291
+
292
+ > If you disable `showThemeSwitch` and force `darkMode: true` the local storage settings would be
293
+ > ignored and force all themes to the one in the configuration file.
294
+
295
+ Future could be extended to
296
+
297
+ ### Raw button to display manifest package
298
+
299
+ A new experimental feature (enabled by default), button named RAW to be able navigate on the package manifest directly on the ui, kudos to [react-json-view](https://www.npmjs.com/package/react-json-view) that allows an easy integration, not configurable yet until get more feedback.
300
+
301
+ ```yaml
302
+ showRaw: true
303
+ ```
304
+
305
+ #### Rework header buttons
306
+
307
+ - The header has been rework, the mobile was not looking broken.
308
+ - Removed info button in the header and moved to a dialog
309
+ - Info dialog now contains more information about the project, license and the aid content for Ukrania now is inside of the info modal.
310
+ - Separate settings and info to avoid collapse too much info (for mobile still need some work)
311
+
312
+ - 154b2ecd3: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
313
+ - aa763baec: feat: add typescript project references settings
314
+
315
+ 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.
316
+
317
+ It allows to navigate (IDE) trough the packages without need compile the packages.
318
+
319
+ 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).
320
+
321
+ - 16e38df8a: feat: trustProxy property
322
+ - dc571aabd: feat: add forceEnhancedLegacySignature
323
+ - 62c24b632: feat: add passwordValidationRegex property
324
+ - 5167bb528: feat: ui search support for remote, local and private packages
325
+
326
+ The command `npm search` search globally and return all matches, with this improvement the user interface
327
+ is powered with the same capabilities.
328
+
329
+ The UI also tag where is the origin the package with a tag, also provide the latest version and description of the package.
330
+
331
+ - 5cf041a1a: feat: add dist.signatures to core/types
332
+
333
+ 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"_
334
+
335
+ 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).
336
+
337
+ - 37274e4c8: feat: implement abbreviated manifest
338
+
339
+ Enable abbreviated manifest data by adding the header:
340
+
341
+ ```
342
+ curl -H "Accept: application/vnd.npm.install-v1+json" https://registry.npmjs.org/verdaccio
343
+ ```
344
+
345
+ It returns a filtered manifest, additionally includes the [time](https://github.com/pnpm/rfcs/pull/2) field by request.
346
+
347
+ Current support for packages managers:
348
+
349
+ - npm: yes
350
+ - pnpm: yes
351
+ - yarn classic: yes
352
+ - yarn modern (+2.x): [no](https://github.com/yarnpkg/berry/pull/3981#issuecomment-1076566096)
353
+
354
+ https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-metadata-format
355
+
356
+ - 45c03819e: refactor: render html middleware
357
+ - aecbd226d: web: allow ui hide package managers on sidebar
358
+
359
+ 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.
360
+
361
+ ```
362
+ web:
363
+ title: Verdaccio
364
+ sort_packages: asc
365
+ primary_color: #cccccc
366
+ pkgManagers:
367
+ - pnpm
368
+ - yarn
369
+ # - npm
370
+ ```
371
+
372
+ To disable all package managers, just define empty:
373
+
374
+ ```
375
+ web:
376
+ title: Verdaccio
377
+ sort_packages: asc
378
+ primary_color: #cccccc
379
+ pkgManagers:
380
+ ```
381
+
382
+ and the section would be hidden.
383
+
384
+ ### Patch Changes
385
+
386
+ - 351aeeaa8: fix(deps): @verdaccio/utils should be a prod dep of local-storage
387
+ - 7ef599cc4: fix: missing version on footer
388
+ - 19d272d10: fix: restore logger on init
389
+
390
+ Enable logger after parse configuration and log the very first step on startup phase.
391
+
392
+ ```bash
393
+ warn --- experiments are enabled, it is recommended do not use experiments in production comment out this section to disable it
394
+ info --- support for experiment [token] is disabled
395
+ info --- support for experiment [search] is disabled
396
+ (node:50831) Warning: config.logs is deprecated, rename configuration to "config.log"
397
+ (Use `node --trace-warnings ...` to show where the warning was created)
398
+ info --- http address http://localhost:4873/
399
+ info --- version: 6.0.0-6-next.11
400
+ info --- server started
401
+ ```
402
+
403
+ - a610ef26b: chore: add release step to private regisry on merge changeset pr
404
+ - 4fc21146a: fix: missing logo on header
405
+ - 34f0f1101: Enable prerelease mode with **changesets**
406
+ - 68ea21214: ESLint Warnings Fixed
407
+
408
+ Related to issue #1461
409
+
410
+ - max-len: most of the sensible max-len errors are fixed
411
+ - no-unused-vars: most of these types of errors are fixed by deleting not needed declarations
412
+ - @typescript-eslint/no-unused-vars: same as above
413
+
414
+ - b849128de: fix: handle upload scoped tarball
415
+
416
+ ## 11.0.0-6-next.25
417
+
418
+ ### Minor Changes
419
+
420
+ - 16e38df8: feat: trustProxy property
421
+
3
422
  ## 11.0.0-6-next.24
4
423
 
5
424
  ### Patch Changes
@@ -401,14 +820,14 @@
401
820
  - 5c5057fc: feat: node api new structure based on promise
402
821
 
403
822
  ```js
404
- import { runServer } from '@verdaccio/node-api';
823
+ import { runServer } from "@verdaccio/node-api";
405
824
  // or
406
- import { runServer } from 'verdaccio';
825
+ import { runServer } from "verdaccio";
407
826
 
408
827
  const app = await runServer(); // default configuration
409
- const app = await runServer('./config/config.yaml');
828
+ const app = await runServer("./config/config.yaml");
410
829
  const app = await runServer({ configuration });
411
- app.listen(4000, event => {
830
+ app.listen(4000, (event) => {
412
831
  // do something
413
832
  });
414
833
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/types",
3
- "version": "11.0.0-6-next.24",
3
+ "version": "12.0.0-next-7.3",
4
4
  "description": "verdaccio types definitions",
5
5
  "keywords": [
6
6
  "private",
@@ -17,7 +17,7 @@
17
17
  "license": "MIT",
18
18
  "homepage": "https://verdaccio.org",
19
19
  "engines": {
20
- "node": ">=12"
20
+ "node": ">=18"
21
21
  },
22
22
  "repository": {
23
23
  "type": "https",
@@ -30,10 +30,9 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "main": "build/types.d.ts",
34
- "types": "build/types.d.ts",
33
+ "main": "src/types.ts",
34
+ "types": "src/types.ts",
35
35
  "devDependencies": {
36
- "@types/node": "16.18.10",
37
36
  "typedoc": "0.23.25"
38
37
  },
39
38
  "typedoc": {
@@ -50,7 +49,6 @@
50
49
  "test": "pnpm type-check",
51
50
  "build:docs": "typedoc --options ./typedoc.json --tsconfig tsconfig.build.json",
52
51
  "type-check": "tsc --noEmit -p tsconfig.build.json",
53
- "build": "tsc --emitDeclarationOnly -p tsconfig.build.json"
54
- },
55
- "readme": "# @verdaccio/types\n\nTypeScript definitions for Verdaccio plugins and internal code.\n"
52
+ "build": "echo 0"
53
+ }
56
54
  }
@@ -18,9 +18,6 @@ export type LoggerLevel = 'http' | 'fatal' | 'warn' | 'info' | 'debug' | 'trace'
18
18
 
19
19
  export type LoggerConfigItem = {
20
20
  type?: LoggerType;
21
- /**
22
- * The format
23
- */
24
21
  format?: LoggerFormat;
25
22
  path?: string;
26
23
  level?: string;
@@ -101,6 +98,7 @@ export type CommonWebConf = {
101
98
  showFooter?: boolean;
102
99
  showThemeSwitch?: boolean;
103
100
  showDownloadTarball?: boolean;
101
+ hideDeprecatedVersions?: boolean;
104
102
  primaryColor: string;
105
103
  showRaw?: boolean;
106
104
  };
@@ -153,18 +151,29 @@ export interface JWTOptions {
153
151
  verify: JWTVerifyOptions;
154
152
  }
155
153
 
154
+ export type Algorithm =
155
+ | 'HS256'
156
+ | 'HS384'
157
+ | 'HS512'
158
+ | 'RS256'
159
+ | 'RS384'
160
+ | 'RS512'
161
+ | 'ES256'
162
+ | 'ES384'
163
+ | 'ES512'
164
+ | 'PS256'
165
+ | 'PS384'
166
+ | 'PS512'
167
+ | 'none';
168
+
156
169
  export interface JWTSignOptions {
157
- algorithm?: string;
158
- expiresIn?: string;
159
- notBefore?: string;
160
- ignoreExpiration?: boolean;
161
- maxAge?: string | number;
162
- clockTimestamp?: number;
170
+ algorithm?: Algorithm | undefined;
171
+ expiresIn?: string | number | undefined;
172
+ notBefore?: string | number | undefined;
163
173
  }
164
174
 
165
175
  export interface JWTVerifyOptions {
166
- algorithm?: string;
167
- expiresIn?: string;
176
+ algorithm?: Algorithm | undefined;
168
177
  notBefore?: string | number;
169
178
  ignoreExpiration?: boolean;
170
179
  maxAge?: string | number;
@@ -173,11 +182,14 @@ export interface JWTVerifyOptions {
173
182
 
174
183
  export interface APITokenOptions {
175
184
  legacy: boolean;
185
+ /**
186
+ * Temporary flag to allow migration to the new legacy signature
187
+ */
188
+ migrateToSecureLegacySignature: boolean;
176
189
  jwt?: JWTOptions;
177
190
  }
178
191
 
179
192
  export interface Security {
180
- enhancedLegacySignature?: boolean;
181
193
  web: JWTOptions;
182
194
  api: APITokenOptions;
183
195
  }
@@ -226,6 +238,8 @@ export type ServerSettingsConf = {
226
238
  */
227
239
  pluginPrefix?: string;
228
240
  passwordValidationRegex?: RegExp;
241
+ // docs on `trustProxy` can be found at: https://expressjs.com/en/guide/behind-proxies.html
242
+ trustProxy?: string;
229
243
  };
230
244
 
231
245
  /**
@@ -285,7 +299,7 @@ export interface Config extends Omit<ConfigYaml, 'packages' | 'security' | 'conf
285
299
  // security object defaults is added by the config file but optional in the yaml file
286
300
  security: Security;
287
301
  // @deprecated (pending adding the replacement)
288
- checkSecretKey(token: string): string;
302
+ checkSecretKey(token: string | void): string;
289
303
  getMatchedPackagesSpec(storage: string): PackageAccess | void;
290
304
  // TODO: verify how to handle this in the future
291
305
  [key: string]: any;
package/src/manifest.ts CHANGED
@@ -3,7 +3,7 @@ export interface PackageAccess {
3
3
  publish?: string[];
4
4
  proxy?: string[];
5
5
  access?: string[];
6
- unpublish: string[];
6
+ unpublish?: string[];
7
7
  }
8
8
 
9
9
  export interface PackageList {
@@ -89,6 +89,12 @@ export interface Tags {
89
89
  [key: string]: Version;
90
90
  }
91
91
 
92
+ export interface PeerDependenciesMeta {
93
+ [dependencyName: string]: {
94
+ optional?: boolean;
95
+ };
96
+ }
97
+
92
98
  export interface Version {
93
99
  name: string;
94
100
  version: string;
@@ -116,6 +122,7 @@ export interface Version {
116
122
  peerDependencies?: Dependencies;
117
123
  devDependencies?: Dependencies;
118
124
  optionalDependencies?: Dependencies;
125
+ peerDependenciesMeta?: PeerDependenciesMeta;
119
126
  bundleDependencies?: Dependencies;
120
127
  keywords?: string | string[];
121
128
  nodeVersion?: string;
@@ -127,6 +134,8 @@ export interface Version {
127
134
  funding?: { type: string; url: string };
128
135
  engines?: Engines;
129
136
  hasInstallScript?: boolean;
137
+ cpu?: string[];
138
+ os?: string[];
130
139
  }
131
140
 
132
141
  export interface Dependencies {
@@ -1,24 +0,0 @@
1
- /// <reference types="node" />
2
- export type Callback = Function;
3
- export type CallbackAction = (err: any | null) => void;
4
- export 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 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 type URLPrefix = {
22
- absolute: boolean;
23
- basePath: string;
24
- };
@@ -1,253 +0,0 @@
1
- import { PackageAccess, PackageList } from '@verdaccio/types/src/manifest';
2
- export 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 type LoggerType = 'stdout' | 'file';
13
- export type LoggerFormat = 'pretty' | 'pretty-timestamped' | 'json';
14
- export type LoggerLevel = 'http' | 'fatal' | 'warn' | 'info' | 'debug' | 'trace';
15
- export 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 type RateLimit = {
63
- windowMs?: number;
64
- max?: number;
65
- };
66
- export type FlagsConfig = {
67
- searchRemote?: boolean;
68
- changePassword?: boolean;
69
- };
70
- export type PackageManagers = 'pnpm' | 'yarn' | 'npm';
71
- export 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
- showInfo?: boolean;
84
- showSettings?: boolean;
85
- showSearch?: boolean;
86
- showFooter?: boolean;
87
- showThemeSwitch?: boolean;
88
- showDownloadTarball?: boolean;
89
- primaryColor: string;
90
- showRaw?: boolean;
91
- };
92
- /**
93
- * Options are passed to the index.html
94
- */
95
- export type TemplateUIOptions = {
96
- uri?: string;
97
- protocol?: string;
98
- host?: string;
99
- basename?: string;
100
- base: string;
101
- version?: string;
102
- flags: FlagsConfig;
103
- } & CommonWebConf;
104
- /**
105
- * Options on config.yaml for web
106
- */
107
- export type WebConf = {
108
- primary_color?: string;
109
- primaryColor?: string;
110
- enable?: boolean;
111
- scriptsHead?: string[];
112
- scriptsBodyAfter?: string[];
113
- scriptsbodyBefore?: string[];
114
- metaScripts?: string[];
115
- bodyBefore?: string[];
116
- bodyAfter?: string[];
117
- rateLimit?: RateLimit;
118
- html_cache?: boolean;
119
- } & CommonWebConf;
120
- export interface UpLinksConfList {
121
- [key: string]: UpLinkConf;
122
- }
123
- export interface AuthHtpasswd {
124
- file: string;
125
- max_users: number;
126
- }
127
- export type AuthConf = any | AuthHtpasswd;
128
- export interface JWTOptions {
129
- sign: JWTSignOptions;
130
- verify: JWTVerifyOptions;
131
- }
132
- export interface JWTSignOptions {
133
- algorithm?: string;
134
- expiresIn?: string;
135
- notBefore?: string;
136
- ignoreExpiration?: boolean;
137
- maxAge?: string | number;
138
- clockTimestamp?: number;
139
- }
140
- export interface JWTVerifyOptions {
141
- algorithm?: string;
142
- expiresIn?: string;
143
- notBefore?: string | number;
144
- ignoreExpiration?: boolean;
145
- maxAge?: string | number;
146
- clockTimestamp?: number;
147
- }
148
- export interface APITokenOptions {
149
- legacy: boolean;
150
- jwt?: JWTOptions;
151
- }
152
- export interface Security {
153
- enhancedLegacySignature?: boolean;
154
- web: JWTOptions;
155
- api: APITokenOptions;
156
- }
157
- export interface PublishOptions {
158
- allow_offline: boolean;
159
- }
160
- export interface ListenAddress {
161
- [key: string]: string;
162
- }
163
- export interface HttpsConfKeyCert {
164
- key: string;
165
- cert: string;
166
- ca?: string;
167
- }
168
- export interface HttpsConfPfx {
169
- pfx: string;
170
- passphrase?: string;
171
- }
172
- export type HttpsConf = HttpsConfKeyCert | HttpsConfPfx;
173
- export interface Notifications {
174
- method: string;
175
- packagePattern: RegExp;
176
- packagePatternFlags: string;
177
- endpoint: string;
178
- content: string;
179
- headers: Headers;
180
- }
181
- export type Notification = Notifications;
182
- export type ServerSettingsConf = {
183
- rateLimit: RateLimit;
184
- keepAliveTimeout?: number;
185
- /**
186
- * Plugins should be prefixed verdaccio-XXXXXX by default.
187
- * To override the default prefix, use this property without `-`
188
- * If you set pluginPrefix: acme, the packages to resolve will be
189
- * acme-XXXXXX
190
- */
191
- pluginPrefix?: string;
192
- passwordValidationRegex?: RegExp;
193
- };
194
- /**
195
- * YAML configuration file available options.
196
- */
197
- export interface ConfigYaml {
198
- _debug?: boolean;
199
- storage?: string | void;
200
- packages: PackageList;
201
- uplinks: UpLinksConfList;
202
- log?: LoggerConfItem;
203
- logs?: LoggerConfItem;
204
- web?: WebConf;
205
- auth?: AuthConf;
206
- security: Security;
207
- publish?: PublishOptions;
208
- store?: any;
209
- listen?: ListenAddress;
210
- https?: HttpsConf;
211
- user_agent?: string;
212
- http_proxy?: string;
213
- plugins?: string | void | null;
214
- https_proxy?: string;
215
- no_proxy?: string;
216
- max_body_size?: string;
217
- notifications?: Notifications;
218
- notify?: Notifications | Notifications[];
219
- middlewares?: any;
220
- filters?: any;
221
- url_prefix?: string;
222
- server?: ServerSettingsConf;
223
- flags?: FlagsConfig;
224
- experiments?: FlagsConfig;
225
- userRateLimit?: RateLimit;
226
- configPath?: string;
227
- i18n?: {
228
- web: string;
229
- };
230
- }
231
- /**
232
- * Configuration object with additional methods for configuration, includes yaml and internal medatada.
233
- * @interface Config
234
- * @extends {ConfigYaml}
235
- */
236
- export interface Config extends Omit<ConfigYaml, 'packages' | 'security' | 'configPath'> {
237
- server_id: string;
238
- secret: string;
239
- configPath: string;
240
- self_path?: string;
241
- packages: PackageList;
242
- security: Security;
243
- checkSecretKey(token: string): string;
244
- getMatchedPackagesSpec(storage: string): PackageAccess | void;
245
- [key: string]: any;
246
- }
247
- export interface AllowAccess {
248
- name: string;
249
- version?: string;
250
- tag?: string;
251
- }
252
- export interface AuthPackageAllow extends PackageAccess, AllowAccess {
253
- }
@@ -1,228 +0,0 @@
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
- directories?: any;
80
- dist: Dist;
81
- author: string | Author;
82
- main: string;
83
- homemage?: string;
84
- license?: string;
85
- readme: string;
86
- readmeFileName?: string;
87
- readmeFilename?: string;
88
- description: string;
89
- bin?: string;
90
- bugs?: any;
91
- files?: string[];
92
- gitHead?: string;
93
- maintainers?: Author[];
94
- contributors?: Author[];
95
- repository?: string | any;
96
- scripts?: any;
97
- homepage?: string;
98
- etag?: string;
99
- dependencies?: Dependencies;
100
- peerDependencies?: Dependencies;
101
- devDependencies?: Dependencies;
102
- optionalDependencies?: Dependencies;
103
- bundleDependencies?: Dependencies;
104
- keywords?: string | string[];
105
- nodeVersion?: string;
106
- _id: string;
107
- _npmVersion?: string;
108
- _npmUser: Author;
109
- _hasShrinkwrap?: boolean;
110
- deprecated?: string;
111
- funding?: {
112
- type: string;
113
- url: string;
114
- };
115
- engines?: Engines;
116
- hasInstallScript?: boolean;
117
- }
118
- export interface Dependencies {
119
- [key: string]: string;
120
- }
121
- export interface Engines {
122
- [key: string]: string;
123
- }
124
- export interface Versions {
125
- [key: string]: Version;
126
- }
127
- /**
128
- * @deprecated use Manifest instead
129
- */
130
- export interface Package {
131
- _id?: string;
132
- name: string;
133
- versions: Versions;
134
- 'dist-tags': GenericBody;
135
- time: GenericBody;
136
- readme?: string;
137
- users?: PackageUsers;
138
- _distfiles: DistFiles;
139
- _attachments: AttachMents;
140
- _uplinks: UpLinks;
141
- _rev: string;
142
- }
143
- /**
144
- * Represents upstream manifest from another registry
145
- */
146
- export interface FullRemoteManifest {
147
- _id?: string;
148
- _rev?: string;
149
- name: string;
150
- description?: string;
151
- 'dist-tags': GenericBody;
152
- time: GenericBody;
153
- versions: Versions;
154
- maintainers?: Author[];
155
- /** store the latest readme **/
156
- readme?: string;
157
- /** store star assigned to this packages by users */
158
- users?: PackageUsers;
159
- access?: any;
160
- bugs?: {
161
- url: string;
162
- };
163
- license?: string;
164
- homepage?: string;
165
- repository?: string | {
166
- type?: string;
167
- url: string;
168
- directory?: string;
169
- };
170
- keywords?: string[];
171
- author?: string | Author;
172
- }
173
- export interface Manifest extends FullRemoteManifest, PublishManifest {
174
- /**
175
- * store fast access to the dist url of an specific tarball, instead search version
176
- * by id, just the tarball id is faster.
177
- *
178
- * The _distfiles is created only when a package is being sync from an upstream.
179
- * also used to fetch tarballs from upstream, the private publish tarballs are not stored in
180
- * this object because they are not published in the upstream registry.
181
- */
182
- _distfiles: DistFiles;
183
- /**
184
- * Store access cache metadata, to avoid to fetch the same metadata multiple times.
185
- *
186
- * The key represents the uplink id which is composed of a etag and a fetched timestamp.
187
- *
188
- * The fetched timestamp is the time when the metadata was fetched, used to avoid to fetch the
189
- * same metadata until the metadata is older than the last fetch.
190
- */
191
- _uplinks: UpLinks;
192
- /**
193
- * store the revision of the manifest
194
- */
195
- _rev: string;
196
- }
197
- export type AbbreviatedVersion = Pick<Version, 'name' | 'version' | 'description' | 'dependencies' | 'devDependencies' | 'bin' | 'dist' | 'engines' | 'funding' | 'peerDependencies'>;
198
- export interface AbbreviatedVersions {
199
- [key: string]: AbbreviatedVersion;
200
- }
201
- /**
202
- *
203
- */
204
- export type AbbreviatedManifest = Pick<Manifest, 'name' | 'dist-tags' | 'time'> & {
205
- modified: string;
206
- versions: AbbreviatedVersions;
207
- };
208
- export interface PublishManifest {
209
- /**
210
- * The `_attachments` object has different usages:
211
- *
212
- * - When a package is published, it contains the tarball as an string, this string is used to be
213
- * converted as a tarball, usually attached to the package but not stored in the database.
214
- * - If user runs `npm star` the _attachments will be at the manifest body but empty.
215
- *
216
- * It has also an internal usage:
217
- *
218
- * - Used as a cache for the tarball, quick access to the tarball shasum, etc. Instead
219
- * iterate versions and find the right one, just using the tarball as a key which is what
220
- * the package manager sends to the registry.
221
- *
222
- * - A `_attachments` object is added every time a private tarball is published, upstream cached tarballs are
223
- * not being part of this object, only for published private packages.
224
- *
225
- * Note: This field is removed when the package is accesed through the web user interface.
226
- * */
227
- _attachments: AttachMents;
228
- }
@@ -1 +0,0 @@
1
- export * from '@verdaccio/types/src/plugins/storage';
@@ -1,37 +0,0 @@
1
- import { Callback, CallbackAction } from '@verdaccio/types/src/commons';
2
- import { Manifest, Token } from '@verdaccio/types/src/manifest';
3
- export type StorageList = string[];
4
- export interface ILocalStorage {
5
- add(name: string): void;
6
- remove(name: string): void;
7
- get(): StorageList;
8
- sync(): void;
9
- }
10
- export interface TokenFilter {
11
- user: string;
12
- }
13
- export interface ITokenActions {
14
- saveToken(token: Token): Promise<any>;
15
- deleteToken(user: string, tokenKey: string): Promise<any>;
16
- readTokens(filter: TokenFilter): Promise<Token[]>;
17
- }
18
- /**
19
- * This method expect return a Package object
20
- * eg:
21
- * {
22
- * name: string;
23
- * time: number;
24
- * ... and other props
25
- * }
26
- *
27
- * The `cb` callback object will be executed if:
28
- * - it might return object (truly)
29
- * - it might reutrn null
30
- */
31
- export type onSearchPackage = (item: Manifest, cb: CallbackAction) => void;
32
- export type onEndSearchPackage = (error?: any) => void;
33
- export type onValidatePackage = (name: string) => boolean;
34
- export type StorageUpdateCallback = (data: Manifest, cb: CallbackAction) => void;
35
- export type StorageWriteCallback = (name: string, json: Manifest, callback: Callback) => void;
36
- export type PackageTransformer = (pkg: Manifest) => Manifest;
37
- export type ReadPackageCallback = (err: any | null, data?: Manifest) => void;
package/build/search.d.ts DELETED
@@ -1,26 +0,0 @@
1
- export type PublisherMaintainer = {
2
- username: string;
3
- email: string;
4
- };
5
- export type SearchPackageBody = {
6
- name: string;
7
- scope: string;
8
- description: string;
9
- author: string | PublisherMaintainer;
10
- version: string;
11
- keywords: string | string[] | undefined;
12
- date: string;
13
- links?: {
14
- npm: string;
15
- homepage?: string;
16
- repository?: string;
17
- bugs?: string;
18
- };
19
- publisher?: any;
20
- maintainers?: PublisherMaintainer[];
21
- };
22
- export type SearchResultWeb = {
23
- name: string;
24
- version: string;
25
- description: string;
26
- };
package/build/types.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from '@verdaccio/types/src/plugins';
2
- export * from '@verdaccio/types/src/manifest';
3
- export * from '@verdaccio/types/src/search';
4
- export * from '@verdaccio/types/src/commons';
5
- export * from '@verdaccio/types/src/configuration';