verdaccio 6.6.0 → 6.6.2

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +2722 -0
  2. package/build/api/index.js +1 -1
  3. package/build/lib/cli/cli.js +1 -1
  4. package/build/lib/cli/commands/init.js +1 -1
  5. package/build/lib/cli/commands/version.js +1 -1
  6. package/build/types/index.js +6 -0
  7. package/package.json +11 -5
  8. package/security.txt +0 -2
  9. package/build/api/debug/index.d.ts +0 -3
  10. package/build/api/endpoint/api/dist-tags.d.ts +0 -4
  11. package/build/api/endpoint/api/package.d.ts +0 -5
  12. package/build/api/endpoint/api/ping.d.ts +0 -2
  13. package/build/api/endpoint/api/publish.d.ts +0 -26
  14. package/build/api/endpoint/api/search.d.ts +0 -1
  15. package/build/api/endpoint/api/star.d.ts +0 -4
  16. package/build/api/endpoint/api/stars.d.ts +0 -3
  17. package/build/api/endpoint/api/user.d.ts +0 -4
  18. package/build/api/endpoint/api/v1/profile.d.ts +0 -14
  19. package/build/api/endpoint/api/v1/search.d.ts +0 -5
  20. package/build/api/endpoint/api/v1/token.d.ts +0 -8
  21. package/build/api/endpoint/api/whoami.d.ts +0 -2
  22. package/build/api/endpoint/index.d.ts +0 -4
  23. package/build/api/index.d.ts +0 -4
  24. package/build/api/middleware.d.ts +0 -3
  25. package/build/api/web/api/index.d.ts +0 -2
  26. package/build/api/web/api/package.d.ts +0 -12
  27. package/build/api/web/api/search.d.ts +0 -5
  28. package/build/api/web/api/user.d.ts +0 -5
  29. package/build/api/web/api/utils.d.ts +0 -2
  30. package/build/api/web/index.d.ts +0 -9
  31. package/build/index.d.ts +0 -4
  32. package/build/lib/auth-utils.d.ts +0 -2
  33. package/build/lib/bootstrap.d.ts +0 -22
  34. package/build/lib/cli/cli.d.ts +0 -1
  35. package/build/lib/cli/commands/info.d.ts +0 -5
  36. package/build/lib/cli/commands/init.d.ts +0 -9
  37. package/build/lib/cli/commands/version.d.ts +0 -5
  38. package/build/lib/cli/utils.d.ts +0 -2
  39. package/build/lib/cli.d.ts +0 -2
  40. package/build/lib/config.d.ts +0 -5
  41. package/build/lib/constants.d.ts +0 -25
  42. package/build/lib/experiments.d.ts +0 -1
  43. package/build/lib/local-storage.d.ts +0 -182
  44. package/build/lib/logger/index.d.ts +0 -6
  45. package/build/lib/metadata-utils.d.ts +0 -10
  46. package/build/lib/run-server.d.ts +0 -22
  47. package/build/lib/storage-utils.d.ts +0 -30
  48. package/build/lib/storage.d.ts +0 -136
  49. package/build/lib/up-storage.d.ts +0 -138
  50. package/build/lib/uplink-util.d.ts +0 -7
  51. package/build/lib/utils.d.ts +0 -68
@@ -1,136 +0,0 @@
1
- import { ReadTarball } from '@verdaccio/streams';
2
- import { Callback, Config, Logger, Manifest, MergeTags, Version, Versions } from '@verdaccio/types';
3
- import { Token, TokenFilter } from '@verdaccio/types';
4
- import { IPluginFilters, ISyncUplinks, StringValue } from '../types';
5
- import LocalStorage from './local-storage';
6
- import ProxyStorage from './up-storage';
7
- declare class Storage {
8
- localStorage: LocalStorage;
9
- config: Config;
10
- logger: Logger;
11
- uplinks: Record<string, ProxyStorage>;
12
- filters: IPluginFilters | undefined;
13
- constructor(config: Config);
14
- init(config: Config, filters?: IPluginFilters): Promise<void>;
15
- private loadStorage;
16
- private loadStorePlugin;
17
- /**
18
- * Add a {name} package to a system
19
- Function checks if package with the same name is available from uplinks.
20
- If it isn't, we create package locally
21
- Used storages: local (write) && uplinks
22
- */
23
- addPackage(name: string, metadata: any, callback: any): Promise<void>;
24
- private _isAllowPublishOffline;
25
- readTokens(filter: TokenFilter): Promise<Token[]>;
26
- saveToken(token: Token): Promise<void>;
27
- deleteToken(user: string, tokenKey: string): Promise<any>;
28
- /**
29
- * Add a new version of package {name} to a system
30
- Used storages: local (write)
31
- */
32
- addVersion(name: string, version: string, metadata: Version, tag: StringValue, callback: Callback): void;
33
- /**
34
- * Tags a package version with a provided tag
35
- Used storages: local (write)
36
- */
37
- mergeTags(name: string, tagHash: MergeTags, callback: Callback): void;
38
- /**
39
- * Change an existing package (i.e. unpublish one version)
40
- Function changes a package info from local storage and all uplinks with write access./
41
- Used storages: local (write)
42
- */
43
- changePackage(name: string, metadata: Manifest, revision: string, callback: Callback): void;
44
- /**
45
- * Remove a package from a system
46
- Function removes a package from local storage
47
- Used storages: local (write)
48
- */
49
- removePackage(name: string, callback: Callback): void;
50
- /**
51
- Remove a tarball from a system
52
- Function removes a tarball from local storage.
53
- Tarball in question should not be linked to in any existing
54
- versions, i.e. package version should be unpublished first.
55
- Used storage: local (write)
56
- */
57
- removeTarball(name: string, filename: string, revision: string, callback: Callback): void;
58
- /**
59
- * Upload a tarball for {name} package
60
- Function is synchronous and returns a WritableStream
61
- Used storages: local (write)
62
- */
63
- addTarball(name: string, filename: string): import("@verdaccio/streams").UploadTarball;
64
- hasLocalTarball(name: string, filename: string): Promise<boolean>;
65
- /**
66
- Get a tarball from a storage for {name} package
67
- Function is synchronous and returns a ReadableStream
68
- Function tries to read tarball locally, if it fails then it reads package
69
- information in order to figure out where we can get this tarball from
70
- Used storages: local || uplink (just one)
71
- */
72
- getTarball(name: string, filename: string): ReadTarball;
73
- /**
74
- Retrieve a package metadata for {name} package
75
- Function invokes localStorage.getPackage and uplink.get_package for every
76
- uplink with proxy_access rights against {name} and combines results
77
- into one json object
78
- Used storages: local && uplink (proxy_access)
79
-
80
- * @param {object} options
81
- * @property {string} options.name Package Name
82
- * @property {object} options.req Express `req` object
83
- * @property {boolean} options.keepUpLinkData keep up link info in package meta, last update, etc.
84
- * @property {function} options.callback Callback for receive data
85
- */
86
- getPackage(options: any): void;
87
- /**
88
- Retrieve remote and local packages more recent than {startkey}
89
- Function streams all packages from all uplinks first, and then
90
- local packages.
91
- Note that local packages could override registry ones just because
92
- they appear in JSON last. That's a trade-off we make to avoid
93
- memory issues.
94
- Used storages: local && uplink (proxy_access)
95
- * @param {*} startkey
96
- * @param {*} options
97
- * @return {Stream}
98
- */
99
- search(startkey: string, options: any): any;
100
- /**
101
- * Retrieve only private local packages
102
- * @param {*} callback
103
- */
104
- getLocalDatabase(callback: Callback): void;
105
- /**
106
- * Read each local package name, apply filters, and collect the latest version.
107
- */
108
- private _collectLocalPackages;
109
- /**
110
- * Function fetches package metadata from uplinks and synchronizes it with local data
111
- if package is available locally, it MUST be provided in pkginfo
112
- returns callback(err, result, uplink_errors)
113
- */
114
- _syncUplinksMetadata(name: string, packageInfo: Manifest, options: ISyncUplinks, callback: Callback): void;
115
- /**
116
- * Apply all configured filter plugins to a package manifest sequentially.
117
- * Each filter's output is passed as input to the next filter.
118
- * Returns the filtered manifest and any errors that occurred.
119
- */
120
- private _applyFilters;
121
- /**
122
- * Check if a tarball should be served based on filter plugins, using only
123
- * local metadata. Returns true (defer) when the version isn't cached locally
124
- * — the uplink-sync path in getTarball re-checks filters after sync, which
125
- * avoids a redundant uplink round-trip and double filter application.
126
- */
127
- private _isTarballAllowedByFilters;
128
- /**
129
- * Set a hidden value for each version.
130
- * @param {Array} versions list of version
131
- * @param {String} upLink uplink name
132
- * @private
133
- */
134
- _updateVersionsHiddenUpLink(versions: Versions, upLink: ProxyStorage): void;
135
- }
136
- export default Storage;
@@ -1,138 +0,0 @@
1
- import { ReadTarball } from '@verdaccio/streams';
2
- import { Callback, Config, Logger, UpLinkConf } from '@verdaccio/types';
3
- /**
4
- * Implements Storage interface
5
- * (same for storage.js, local-storage.js, up-storage.js)
6
- */
7
- declare class ProxyStorage {
8
- config: UpLinkConf;
9
- failed_requests: number;
10
- userAgent: string;
11
- ca: string | void;
12
- logger: Logger;
13
- server_id: string;
14
- url: any;
15
- maxage: number;
16
- timeout: number;
17
- max_fails: number;
18
- fail_timeout: number;
19
- agent_options: any;
20
- upname: string;
21
- proxy: string | void;
22
- last_request_time: number | null;
23
- strict_ssl: boolean;
24
- /**
25
- * Constructor
26
- * @param {*} config
27
- * @param {*} mainConfig
28
- */
29
- constructor(config: UpLinkConf, mainConfig: Config);
30
- /**
31
- * Fetch an asset.
32
- * @param {*} options
33
- * @param {*} cb
34
- * @return {Request}
35
- */
36
- private request;
37
- /**
38
- * Set default headers.
39
- * @param {Object} options
40
- * @return {Object}
41
- * @private
42
- */
43
- private _setHeaders;
44
- /**
45
- * Validate configuration auth and assign Header authorization
46
- * @param {Object} headers
47
- * @return {Object}
48
- * @private
49
- */
50
- private _setAuth;
51
- /**
52
- * @param {string} message
53
- * @throws {Error}
54
- * @private
55
- */
56
- private _throwErrorAuth;
57
- /**
58
- * Assign Header authorization with type authentication
59
- * @param {Object} headers
60
- * @param {string} type
61
- * @param {string} token
62
- * @private
63
- */
64
- private _setHeaderAuthorization;
65
- /**
66
- * It will add or override specified headers from config file.
67
- *
68
- * Eg:
69
- *
70
- * uplinks:
71
- npmjs:
72
- url: https://registry.npmjs.org/
73
- headers:
74
- Accept: "application/vnd.npm.install-v2+json; q=1.0"
75
- verdaccio-staging:
76
- url: https://mycompany.com/npm
77
- headers:
78
- Accept: "application/json"
79
- authorization: "Basic YourBase64EncodedCredentials=="
80
-
81
- * @param {Object} headers
82
- * @private
83
- */
84
- private _overrideWithUpLinkConfigHeaders;
85
- /**
86
- * Determine whether can fetch from the provided URL
87
- * @param {*} url
88
- * @return {Boolean}
89
- */
90
- isUplinkValid(url: string): boolean;
91
- /**
92
- * Get a remote package metadata
93
- * @param {*} name package name
94
- * @param {*} options request options, eg: eTag.
95
- * @param {*} callback
96
- */
97
- getRemoteMetadata(name: string, options: any, callback: Callback): void;
98
- /**
99
- * Fetch a tarball from the uplink.
100
- * @param {String} url
101
- * @return {Stream}
102
- */
103
- fetchTarball(url: string): ReadTarball;
104
- /**
105
- * Perform a stream search.
106
- * @param {*} options request options
107
- * @return {Stream}
108
- */
109
- search(options: any): any;
110
- /**
111
- * Add proxy headers.
112
- * FIXME: object mutations, it should return an new object
113
- * @param {*} req the http request
114
- * @param {*} headers the request headers
115
- */
116
- private _addProxyHeaders;
117
- /**
118
- * Check whether the remote host is available.
119
- * @param {*} alive
120
- * @return {Boolean}
121
- */
122
- private _statusCheck;
123
- /**
124
- * If the request failure.
125
- * @return {boolean}
126
- * @private
127
- */
128
- private _ifRequestFailure;
129
- /**
130
- * Set up a proxy.
131
- * @param {*} hostname
132
- * @param {*} config
133
- * @param {*} mainconfig
134
- * @param {*} isHTTPS
135
- */
136
- private _setupProxy;
137
- }
138
- export default ProxyStorage;
@@ -1,7 +0,0 @@
1
- import { Config, Versions } from '@verdaccio/types';
2
- import ProxyStorage from './up-storage';
3
- /**
4
- * Set up the Up Storage for each link.
5
- */
6
- export declare function setupUpLinks(config: Config): Record<string, ProxyStorage>;
7
- export declare function updateVersionsHiddenUpLink(versions: Versions, upLink: any): void;
@@ -1,68 +0,0 @@
1
- import { parseConfigFile } from '@verdaccio/config';
2
- import { errorUtils, validationUtils } from '@verdaccio/core';
3
- import { ConfigYaml, StringValue } from '@verdaccio/types';
4
- import { Config, Manifest, Version } from '@verdaccio/types';
5
- import { buildToken as buildTokenUtil } from '@verdaccio/utils';
6
- export declare function initLogger(logConfig: ConfigYaml): void;
7
- export declare function addScope(scope: string, packageName: string): string;
8
- /**
9
- * Check whether an element is an Object
10
- * @param {*} obj the element
11
- * @return {Boolean}
12
- */
13
- export declare const isObject: typeof validationUtils.isObject;
14
- /**
15
- * @deprecated not used un v6
16
- */
17
- export declare function isObjectOrArray(obj: any): boolean;
18
- export declare function tagVersion(data: Manifest, version: string, tag: StringValue): boolean;
19
- /**
20
- * Gets version from a package object taking into account semver weirdness.
21
- * @return {String} return the semantic version of a package
22
- */
23
- export declare function getVersion(pkg: Manifest, version: any): Version | void;
24
- /**
25
- * Flatten arrays of tags.
26
- * @param {*} data
27
- */
28
- export declare function normalizeDistTags(pkg: Manifest): void;
29
- /**
30
- * Parse an internal string to number
31
- * @param {*} interval
32
- * @return {Number}
33
- */
34
- export declare function parseInterval(interval: any): number;
35
- export declare const ErrorCode: {
36
- getConflict: typeof errorUtils.getConflict;
37
- getBadData: typeof errorUtils.getBadData;
38
- getBadRequest: typeof errorUtils.getBadRequest;
39
- getInternalError: typeof errorUtils.getInternalError;
40
- getUnauthorized: typeof errorUtils.getUnauthorized;
41
- getForbidden: typeof errorUtils.getForbidden;
42
- getServiceUnavailable: typeof errorUtils.getServiceUnavailable;
43
- getNotFound: typeof errorUtils.getNotFound;
44
- getCode: typeof errorUtils.getCode;
45
- };
46
- export declare function sortByName(packages: any[], orderAscending?: boolean | void): string[];
47
- export declare function deleteProperties(propertiesToDelete: string[], objectItem: any): any;
48
- /**
49
- * parse package readme - markdown/ascii
50
- * @param {String} packageName name of package
51
- * @param {String} readme package readme
52
-
53
- * @return {String} converted html template
54
- */
55
- export declare function parseReadme(packageName: string, readme: string): string | void;
56
- export declare function encodeScopedUri(packageName: any): string;
57
- export declare function hasDiffOneKey(versions: any): boolean;
58
- export declare function isVersionValid(packageMeta: any, packageVersion: any): boolean;
59
- export declare function isRelatedToDeprecation(pkgInfo: Manifest): boolean;
60
- export declare const resolveConfigPath: (storageLocation: string, file: string) => string;
61
- export declare function logHTTPSWarning(storageLocation: any): void;
62
- export declare function hasLogin(config: Config): boolean;
63
- /**
64
- * Check whether any version in a package manifest has a tarball URL
65
- * that matches the given filename.
66
- */
67
- export declare function hasTarball(pkg: Manifest, filename: string): boolean;
68
- export { buildTokenUtil as buildToken, parseConfigFile };