verdaccio 6.7.0 → 6.7.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 (49) hide show
  1. package/build/api/debug/index.d.ts +3 -0
  2. package/build/api/endpoint/api/dist-tags.d.ts +4 -0
  3. package/build/api/endpoint/api/package.d.ts +5 -0
  4. package/build/api/endpoint/api/ping.d.ts +2 -0
  5. package/build/api/endpoint/api/publish.d.ts +26 -0
  6. package/build/api/endpoint/api/search.d.ts +1 -0
  7. package/build/api/endpoint/api/star.d.ts +4 -0
  8. package/build/api/endpoint/api/stars.d.ts +3 -0
  9. package/build/api/endpoint/api/user.d.ts +4 -0
  10. package/build/api/endpoint/api/v1/profile.d.ts +14 -0
  11. package/build/api/endpoint/api/v1/search.d.ts +5 -0
  12. package/build/api/endpoint/api/v1/token.d.ts +8 -0
  13. package/build/api/endpoint/api/whoami.d.ts +2 -0
  14. package/build/api/endpoint/index.d.ts +4 -0
  15. package/build/api/index.d.ts +4 -0
  16. package/build/api/index.js +1 -1
  17. package/build/api/middleware.d.ts +3 -0
  18. package/build/api/web/api/index.d.ts +2 -0
  19. package/build/api/web/api/package.d.ts +12 -0
  20. package/build/api/web/api/search.d.ts +5 -0
  21. package/build/api/web/api/user.d.ts +5 -0
  22. package/build/api/web/api/utils.d.ts +2 -0
  23. package/build/api/web/index.d.ts +9 -0
  24. package/build/index.d.ts +4 -0
  25. package/build/lib/auth-utils.d.ts +2 -0
  26. package/build/lib/bootstrap.d.ts +22 -0
  27. package/build/lib/cli/cli.d.ts +1 -0
  28. package/build/lib/cli/cli.js +1 -1
  29. package/build/lib/cli/commands/info.d.ts +5 -0
  30. package/build/lib/cli/commands/init.d.ts +9 -0
  31. package/build/lib/cli/commands/init.js +1 -1
  32. package/build/lib/cli/commands/version.d.ts +5 -0
  33. package/build/lib/cli/commands/version.js +1 -1
  34. package/build/lib/cli/utils.d.ts +4 -0
  35. package/build/lib/cli.d.ts +2 -0
  36. package/build/lib/config.d.ts +5 -0
  37. package/build/lib/constants.d.ts +25 -0
  38. package/build/lib/experiments.d.ts +1 -0
  39. package/build/lib/local-storage.d.ts +182 -0
  40. package/build/lib/logger/index.d.ts +6 -0
  41. package/build/lib/metadata-utils.d.ts +10 -0
  42. package/build/lib/run-server.d.ts +22 -0
  43. package/build/lib/storage-utils.d.ts +30 -0
  44. package/build/lib/storage.d.ts +136 -0
  45. package/build/lib/up-storage.d.ts +138 -0
  46. package/build/lib/uplink-util.d.ts +7 -0
  47. package/build/lib/utils.d.ts +68 -0
  48. package/package.json +19 -19
  49. package/vitest.setup.mjs +4 -0
@@ -0,0 +1,3 @@
1
+ import { Application } from 'express';
2
+ declare const _default: (app: Application, selfPath: string) => void;
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type Storage from '../../../lib/storage';
4
+ export default function (route: Router, auth: Auth, storage: Storage): void;
@@ -0,0 +1,5 @@
1
+ import type { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type { Config } from '@verdaccio/types';
4
+ import type Storage from '../../../lib/storage';
5
+ export default function (route: Router, auth: Auth, storage: Storage, config: Config): void;
@@ -0,0 +1,2 @@
1
+ import type { Router } from 'express';
2
+ export default function (route: Router): void;
@@ -0,0 +1,26 @@
1
+ import type { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type { Config } from '@verdaccio/types';
4
+ import type Storage from '../../../lib/storage';
5
+ import type { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '../../../types';
6
+ export default function publish(router: Router, auth: Auth, storage: Storage, config: Config): void;
7
+ /**
8
+ * Publish a package
9
+ */
10
+ export declare function publishPackage(storage: Storage, config: Config, auth: Auth): any;
11
+ /**
12
+ * un-publish a package
13
+ */
14
+ export declare function unPublishPackage(storage: Storage): (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) => void;
15
+ /**
16
+ * Delete tarball
17
+ */
18
+ export declare function removeTarball(storage: Storage): (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) => void;
19
+ /**
20
+ * Adds a new version
21
+ */
22
+ export declare function addVersion(storage: Storage): (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) => void;
23
+ /**
24
+ * uploadPackageTarball
25
+ */
26
+ export declare function uploadPackageTarball(storage: Storage): (req: $RequestExtend, res: $ResponseExtend, next: $NextFunctionVer) => void;
@@ -0,0 +1 @@
1
+ export default function (route: any, auth: any, storage: any): void;
@@ -0,0 +1,4 @@
1
+ import type { Response } from 'express';
2
+ import type Storage from '../../../lib/storage';
3
+ import type { $NextFunctionVer, $RequestExtend } from '../../../types';
4
+ export default function (storage: Storage): (req: $RequestExtend, res: Response, next: $NextFunctionVer) => void;
@@ -0,0 +1,3 @@
1
+ import type { Router } from 'express';
2
+ import type Storage from '../../../lib/storage';
3
+ export default function (route: Router, storage: Storage): void;
@@ -0,0 +1,4 @@
1
+ import type { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type { Config } from '@verdaccio/types';
4
+ export default function (route: Router, auth: Auth, config: Config): void;
@@ -0,0 +1,14 @@
1
+ import type { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type { ConfigYaml } from '@verdaccio/types';
4
+ export interface Profile {
5
+ tfa: boolean;
6
+ name: string;
7
+ email: string;
8
+ email_verified: boolean;
9
+ created: string;
10
+ updated: string;
11
+ cidr_whitelist: string[] | null;
12
+ fullname: string;
13
+ }
14
+ export default function (router: Router, auth: Auth, config: ConfigYaml): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Endpoint for npm search v1
3
+ * req: 'GET /-/v1/search?text=react&size=20&from=0&quality=0.65&popularity=0.98&maintenance=0.5'
4
+ */
5
+ export default function (route: any, auth: any, storage: any): void;
@@ -0,0 +1,8 @@
1
+ import type { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type { Config, Token } from '@verdaccio/types';
4
+ import type Storage from '../../../../lib/storage';
5
+ export type NormalizeToken = Token & {
6
+ created: string;
7
+ };
8
+ export default function (router: Router, auth: Auth, storage: Storage, config: Config): void;
@@ -0,0 +1,2 @@
1
+ import type { Router } from 'express';
2
+ export default function (route: Router): void;
@@ -0,0 +1,4 @@
1
+ import type { Auth } from '@verdaccio/auth';
2
+ import type { Config } from '@verdaccio/types';
3
+ import type Storage from '../../lib/storage';
4
+ export default function (config: Config, auth: Auth, storage: Storage): import("express-serve-static-core").Router;
@@ -0,0 +1,4 @@
1
+ import express from 'express';
2
+ import type { ConfigYaml } from '@verdaccio/types';
3
+ declare const _default: (configHash: ConfigYaml) => Promise<express.Application>;
4
+ export default _default;
@@ -24,7 +24,7 @@ var _endpoint = _interopRequireDefault(require("./endpoint"));
24
24
  var _middleware2 = require("./middleware");
25
25
  var _web = _interopRequireDefault(require("./web"));
26
26
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
- const version = "6.7.0" || 'dev';
27
+ const version = "6.7.2" || 'dev';
28
28
  const defineAPI = async function (config, storage) {
29
29
  const auth = new _auth.Auth(config, _logger.logger, {
30
30
  legacyMergeConfigs: true
@@ -0,0 +1,3 @@
1
+ import type { Config } from '@verdaccio/types';
2
+ import type { $RequestExtend, $ResponseExtend } from '../types';
3
+ export declare function serveFavicon(config: Config): (_req: $RequestExtend, res: $ResponseExtend) => void;
@@ -0,0 +1,2 @@
1
+ declare const _default: (auth: any, storage: any, config: any) => import("express-serve-static-core").Router;
2
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type { Config, Manifest } from '@verdaccio/types';
4
+ import type Storage from '../../../lib/storage';
5
+ export type PackcageExt = Manifest & {
6
+ author: any;
7
+ dist?: {
8
+ tarball: string;
9
+ };
10
+ };
11
+ declare function addPackageWebApi(storage: Storage, auth: Auth, config: Config): Router;
12
+ export default addPackageWebApi;
@@ -0,0 +1,5 @@
1
+ import { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type Storage from '../../../lib/storage';
4
+ declare function addSearchWebApi(storage: Storage, auth: Auth): Router;
5
+ export default addSearchWebApi;
@@ -0,0 +1,5 @@
1
+ import { Router } from 'express';
2
+ import type { Auth } from '@verdaccio/auth';
3
+ import type { Config } from '@verdaccio/types';
4
+ declare function addUserAuthApi(auth: Auth, config: Config): Router;
5
+ export default addUserAuthApi;
@@ -0,0 +1,2 @@
1
+ export declare function wrapPath(urlPath: string): string;
2
+ export declare function wrapSecPath(urlPath: string): string;
@@ -0,0 +1,9 @@
1
+ import type { RequestHandler } from 'express';
2
+ import { Router } from 'express';
3
+ export declare const PLUGIN_UI_PREFIX = "verdaccio-theme";
4
+ export declare const DEFAULT_PLUGIN_UI_THEME = "@verdaccio/ui-theme";
5
+ export declare function loadTheme(config: any): Promise<any>;
6
+ export declare function webAPIMiddleware(tokenMiddleware: RequestHandler, webEndpointsApi: RequestHandler): Router;
7
+ export declare function webMiddleware(config: any, middlewares: any, pluginOptions: any): any;
8
+ declare const _default: (config: any, auth: any, storage: any, logger: any) => Promise<import("express-serve-static-core").Router>;
9
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export { startVerdaccio as default, startVerdaccio } from './lib/bootstrap';
2
+ export { runServer } from './lib/run-server';
3
+ export { ConfigBuilder, parseConfigFile, getDefaultConfig, Config } from '@verdaccio/config';
4
+ export { fileUtils, errorUtils, cryptoUtils, pkgUtils } from '@verdaccio/core';
@@ -0,0 +1,2 @@
1
+ import { Config, Security } from '@verdaccio/types';
2
+ export declare function getSecurity(config: Config): Security;
@@ -0,0 +1,22 @@
1
+ import { Application } from 'express';
2
+ import { Callback, ConfigYaml } from '@verdaccio/types';
3
+ /**
4
+ * Trigger the server after configuration has been loaded.
5
+ * @param {Object} config
6
+ * @param {Object} cliArguments
7
+ * @param {String} configPath
8
+ * @param {String} pkgVersion
9
+ * @param {String} pkgName
10
+ * @deprecated use runServer instead
11
+ */
12
+ declare function startVerdaccio(config: ConfigYaml, cliListen: string, configPath: string, pkgVersion: string, pkgName: string, callback: Callback): void;
13
+ /**
14
+ *
15
+ * @param webServer
16
+ * @param addr
17
+ * @param pkgName
18
+ * @param pkgVersion
19
+ * @deprecated use initServer instead
20
+ */
21
+ declare function listenDefaultCallback(webServer: Application, addr: any, pkgName: string, pkgVersion: string): void;
22
+ export { startVerdaccio, listenDefaultCallback };
@@ -0,0 +1 @@
1
+ export {};
@@ -5,7 +5,7 @@ var _info = require("./commands/info");
5
5
  var _init = require("./commands/init");
6
6
  var _version = require("./commands/version");
7
7
  var _utils = require("./utils");
8
- const pkgVersion = "6.7.0" || 'dev';
8
+ const pkgVersion = "6.7.2" || 'dev';
9
9
  if (process.getuid && process.getuid() === 0) {
10
10
  process.emitWarning(`Verdaccio doesn't need superuser privileges. don't run it under root`);
11
11
  }
@@ -0,0 +1,5 @@
1
+ import { Command } from 'clipanion';
2
+ export declare class InfoCommand extends Command {
3
+ static paths: string[][];
4
+ execute(): Promise<void>;
5
+ }
@@ -0,0 +1,9 @@
1
+ import { Command } from 'clipanion';
2
+ export declare const DEFAULT_PROCESS_NAME: string;
3
+ export declare class InitCommand extends Command {
4
+ static paths: never[][];
5
+ listen: string | undefined;
6
+ static usage: import("clipanion").Usage;
7
+ config: string | undefined;
8
+ execute(): Promise<void>;
9
+ }
@@ -13,7 +13,7 @@ var _runServer = require("../../run-server");
13
13
  var _utils = require("../../utils");
14
14
  var _utils2 = require("../utils");
15
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- const pkgVersion = "6.7.0" || 'dev';
16
+ const pkgVersion = "6.7.2" || 'dev';
17
17
  const pkgName = 'verdaccio';
18
18
  const DEFAULT_PROCESS_NAME = exports.DEFAULT_PROCESS_NAME = 'verdaccio';
19
19
  class InitCommand extends _clipanion.Command {
@@ -0,0 +1,5 @@
1
+ import { Command } from 'clipanion';
2
+ export declare class VersionCommand extends Command {
3
+ static paths: string[][];
4
+ execute(): Promise<void>;
5
+ }
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.VersionCommand = void 0;
7
7
  var _clipanion = require("clipanion");
8
- const pkgVersion = "6.7.0" || 'dev';
8
+ const pkgVersion = "6.7.2" || 'dev';
9
9
  class VersionCommand extends _clipanion.Command {
10
10
  static paths = [[`--version`], [`-v`]];
11
11
  async execute() {
@@ -0,0 +1,4 @@
1
+ export declare const MIN_NODE_VERSION = "18";
2
+ export declare const RECOMMENDED_NODE_VERSION = "22";
3
+ export declare function isVersionValid(version: any): boolean;
4
+ export declare function isVersionRecommended(version: any): boolean;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './cli/cli';
@@ -0,0 +1,5 @@
1
+ import { Config as ConfigCore } from '@verdaccio/config';
2
+ declare class Config extends ConfigCore {
3
+ constructor(config: any);
4
+ }
5
+ export default Config;
@@ -0,0 +1,25 @@
1
+ export { API_ERROR, API_MESSAGE, HTTP_STATUS, HEADERS, HEADER_TYPE, CHARACTER_ENCODING, TOKEN_BASIC, TOKEN_BEARER, SUPPORT_ERRORS, APP_ERROR, DEFAULT_PROTOCOL, DEFAULT_DOMAIN, } from '@verdaccio/core';
2
+ export { ROLES, PACKAGE_ACCESS } from '@verdaccio/utils';
3
+ export declare const TIME_EXPIRATION_24H = "24h";
4
+ export declare const TIME_EXPIRATION_1H = "1h";
5
+ export declare const DIST_TAGS = "dist-tags";
6
+ export declare const LATEST = "latest";
7
+ export declare const USERS = "users";
8
+ export declare const DEFAULT_MIN_LIMIT_PASSWORD = 3;
9
+ export declare const keyPem = "verdaccio-key.pem";
10
+ export declare const certPem = "verdaccio-cert.pem";
11
+ export declare const csrPem = "verdaccio-csr.pem";
12
+ export declare const ERROR_CODE: {
13
+ token_required: string;
14
+ };
15
+ export declare const DEFAULT_REGISTRY = "https://registry.npmjs.org";
16
+ export declare const DEFAULT_UPLINK = "npmjs";
17
+ export declare const DEFAULT_NO_README = "ERROR: No README data found!";
18
+ export declare const MODULE_NOT_FOUND = "MODULE_NOT_FOUND";
19
+ export declare const WEB_TITLE = "Verdaccio";
20
+ export declare const STORAGE: {
21
+ PACKAGE_FILE_NAME: string;
22
+ FILE_EXIST_ERROR: string;
23
+ NO_SUCH_FILE_ERROR: string;
24
+ DEFAULT_REVISION: string;
25
+ };
@@ -0,0 +1 @@
1
+ export declare function displayExperimentsInfoBox(flags: any): any;
@@ -0,0 +1,182 @@
1
+ import { ReadTarball, UploadTarball } from '@verdaccio/streams';
2
+ import { Callback, Config, Logger, Manifest, MergeTags, Token, TokenFilter, Version } from '@verdaccio/types';
3
+ import { StoragePluginLegacy } from '../../types/custom';
4
+ import { StringValue } from '../types';
5
+ export type StoragePlugin = StoragePluginLegacy<Config> | any;
6
+ /**
7
+ * Implements Storage interface (same for storage.js, local-storage.js, up-storage.js).
8
+ */
9
+ declare class LocalStorage {
10
+ config: Config;
11
+ storagePlugin: StoragePlugin;
12
+ logger: Logger;
13
+ constructor(config: Config, logger: Logger, localStorage: StoragePlugin);
14
+ addPackage(name: string, pkg: Manifest, callback: Callback): void;
15
+ /**
16
+ * Remove package.
17
+ * @param {*} name
18
+ * @param {*} callback
19
+ * @return {Function}
20
+ */
21
+ removePackage(name: string, callback: Callback): void;
22
+ /**
23
+ * Synchronize remote package info with the local one
24
+ * @param {*} name
25
+ * @param {*} packageInfo
26
+ * @param {*} callback
27
+ */
28
+ updateVersions(name: string, packageInfo: Manifest, callback: Callback): void;
29
+ /**
30
+ * Add a new version to a previous local package.
31
+ * @param {*} name
32
+ * @param {*} version
33
+ * @param {*} metadata
34
+ * @param {*} tag
35
+ * @param {*} callback
36
+ */
37
+ addVersion(name: string, version: string, metadata: Version, tag: StringValue, callback: Callback): void;
38
+ /**
39
+ * Merge a new list of tags for a local packages with the existing one.
40
+ * @param {*} pkgName
41
+ * @param {*} tags
42
+ * @param {*} callback
43
+ */
44
+ mergeTags(pkgName: string, tags: MergeTags, callback: Callback): void;
45
+ /**
46
+ * Return version not found
47
+ * @return {String}
48
+ * @private
49
+ */
50
+ private _getVersionNotFound;
51
+ /**
52
+ * Return file no available
53
+ * @return {String}
54
+ * @private
55
+ */
56
+ private _getFileNotAvailable;
57
+ /**
58
+ * Update the package metadata, tags and attachments (tarballs).
59
+ * Note: Currently supports unpublishing and deprecation.
60
+ * @param {*} name
61
+ * @param {*} incomingPkg
62
+ * @param {*} revision
63
+ * @param {*} callback
64
+ * @return {Function}
65
+ */
66
+ changePackage(name: string, incomingPkg: Manifest, revision: string | void, callback: Callback): void;
67
+ /**
68
+ * Remove a tarball.
69
+ * @param {*} name
70
+ * @param {*} filename
71
+ * @param {*} revision
72
+ * @param {*} callback
73
+ */
74
+ removeTarball(name: string, filename: string, revision: string, callback: Callback): void;
75
+ /**
76
+ * Add a tarball.
77
+ * @param {String} name
78
+ * @param {String} filename
79
+ * @return {Stream}
80
+ */
81
+ addTarball(name: string, filename: string): UploadTarball;
82
+ /**
83
+ * Get a tarball.
84
+ * @param {*} name
85
+ * @param {*} filename
86
+ * @return {ReadTarball}
87
+ */
88
+ getTarball(name: string, filename: string): ReadTarball;
89
+ /**
90
+ * Return a stream that emits a read failure.
91
+ * @private
92
+ * @return {ReadTarball}
93
+ */
94
+ private _createFailureStreamResponse;
95
+ /**
96
+ * Return a stream that emits the tarball data
97
+ * @param {Object} storage
98
+ * @param {String} filename
99
+ * @private
100
+ * @return {ReadTarball}
101
+ */
102
+ private _streamSuccessReadTarBall;
103
+ /**
104
+ * Retrieve a package by name.
105
+ * @param {*} name
106
+ * @param {*} callback
107
+ * @return {Function}
108
+ */
109
+ getPackageMetadata(name: string, callback?: Callback): void;
110
+ getPackageMetadataAsync(name: string): Promise<Manifest>;
111
+ updateVersionsAsync(name: string, packageInfo: Manifest): Promise<Manifest>;
112
+ /**
113
+ * Search a local package.
114
+ * @param {*} startKey
115
+ * @param {*} options
116
+ * @return {Function}
117
+ */
118
+ search(startKey: string, options: any): ReadTarball;
119
+ /**
120
+ * Retrieve a wrapper that provide access to the package location.
121
+ * @param {Object} pkgName package name.
122
+ * @return {Object}
123
+ */
124
+ private _getLocalStorage;
125
+ /**
126
+ * Read a json file from storage.
127
+ * @param {Object} storage
128
+ * @param {Function} callback
129
+ */
130
+ private _readPackage;
131
+ /**
132
+ * Walks through each package and calls `on_package` on them.
133
+ * @param {*} onPackage
134
+ * @param {*} onEnd
135
+ */
136
+ private _searchEachPackage;
137
+ /**
138
+ * Retrieve either a previous created local package or a boilerplate.
139
+ * @param {*} pkgName
140
+ * @param {*} callback
141
+ * @return {Function}
142
+ */
143
+ private _readCreatePackage;
144
+ private _createNewPackage;
145
+ /**
146
+ * Handle internal error
147
+ * @param {*} err
148
+ * @param {*} file
149
+ * @param {*} message
150
+ * @return {Object} Error instance
151
+ */
152
+ private _internalError;
153
+ /**
154
+ * @param {*} name package name
155
+ * @param {*} updateHandler function(package, cb) - update function
156
+ * @param {*} callback callback that gets invoked after it's all updated
157
+ * @return {Function}
158
+ */
159
+ private _updatePackage;
160
+ /**
161
+ * Update the revision (_rev) string for a package.
162
+ * @param {*} name
163
+ * @param {*} json
164
+ * @param {*} callback
165
+ * @return {Function}
166
+ */
167
+ private _writePackage;
168
+ private _setDefaultRevision;
169
+ private _deleteAttachments;
170
+ /**
171
+ * Ensure the dist file remains as the same protocol
172
+ * @param {Object} hash metadata
173
+ * @param {String} upLinkKey registry key
174
+ * @private
175
+ */
176
+ private _updateUplinkToRemoteProtocol;
177
+ getSecret(config: Config): Promise<string>;
178
+ saveToken(token: Token): Promise<any>;
179
+ deleteToken(user: string, tokenKey: string): Promise<any>;
180
+ readTokens(filter: TokenFilter): Promise<Token[]>;
181
+ }
182
+ export default LocalStorage;
@@ -0,0 +1,6 @@
1
+ import { setup as setupModule } from '@verdaccio/logger';
2
+ import { Logger } from '@verdaccio/types';
3
+ declare let logger: Logger;
4
+ type SetupModuleOptions = Parameters<typeof setupModule>[0];
5
+ export declare function setup(options: SetupModuleOptions): void;
6
+ export { logger };
@@ -0,0 +1,10 @@
1
+ import { Package } from '@verdaccio/types';
2
+ /**
3
+ * Function gets a local info and an info from uplinks and tries to merge it
4
+ exported for unit tests only.
5
+ * @param {*} local
6
+ * @param {*} up
7
+ * @param {*} config
8
+ * @static
9
+ */
10
+ export declare function mergeVersions(local: Package, up: Package): void;
@@ -0,0 +1,22 @@
1
+ import { ConfigYaml } from '@verdaccio/types';
2
+ /**
3
+ * Exposes a server factory to be instantiated programmatically.
4
+ *
5
+ const app = await runServer(); // default configuration
6
+ const app = await runServer('./config/config.yaml');
7
+ const app = await runServer({ configuration });
8
+ app.listen(4000, (event) => {
9
+ // do something
10
+ });
11
+ * @param config
12
+ */
13
+ export declare function runServer(config?: string | ConfigYaml, options?: {
14
+ listenArg?: string;
15
+ }): Promise<any>;
16
+ /**
17
+ * Return a native HTTP/HTTPS server instance
18
+ * @param config
19
+ * @param addr
20
+ * @param app
21
+ */
22
+ export declare function createServerFactory(config: ConfigYaml, addr: any, app: any): any;
@@ -0,0 +1,30 @@
1
+ import { AbbreviatedManifest, Manifest, Version } from '@verdaccio/types';
2
+ import LocalStorage from './local-storage';
3
+ export declare function generatePackageTemplate(name: string): Manifest;
4
+ /**
5
+ * Normalize package properties, tags, revision id.
6
+ * @param {Object} pkg package reference.
7
+ */
8
+ export declare function normalizePackage(pkg: Manifest): Manifest;
9
+ export declare function generateRevision(rev: string): string;
10
+ export declare function getLatestReadme(pkg: Manifest): string;
11
+ export declare function cleanUpReadme(version: Version): Version;
12
+ export declare const WHITELIST: string[];
13
+ export declare function cleanUpLinksRef(keepUpLinkData: boolean, result: Manifest): Manifest;
14
+ /**
15
+ * Check whether a package it is already a local package
16
+ * @param {*} name
17
+ * @param {*} localStorage
18
+ */
19
+ export declare function checkPackageLocal(name: string, localStorage: LocalStorage): Promise<void>;
20
+ export declare function publishPackage(name: string, metadata: any, localStorage: LocalStorage): Promise<void>;
21
+ export declare function checkPackageRemote(name: string, isAllowPublishOffline: boolean, syncMetadata: any): Promise<void>;
22
+ export declare function mergeUplinkTimeIntoLocal(cacheManifest: Manifest, remoteManifest: Manifest): any;
23
+ export declare function prepareSearchPackage(data: Manifest, time: unknown): any;
24
+ /**
25
+ * Check whether the package metadta has enough data to be published
26
+ * @param pkg metadata
27
+ */
28
+ export declare function isPublishablePackage(pkg: Manifest): boolean;
29
+ export declare function hasInstallScript(version: Version): boolean;
30
+ export declare function convertAbbreviatedManifest(manifest: Manifest): AbbreviatedManifest;
@@ -0,0 +1,136 @@
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;
@@ -0,0 +1,138 @@
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;
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,68 @@
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verdaccio",
3
- "version": "6.7.0",
3
+ "version": "6.7.2",
4
4
  "description": "A lightweight private npm proxy registry",
5
5
  "author": {
6
6
  "name": "Verdaccio Maintainers",
@@ -20,22 +20,22 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@cypress/request": "3.0.10",
23
- "@verdaccio/auth": "8.0.1",
24
- "@verdaccio/config": "8.1.0",
25
- "@verdaccio/core": "8.1.0",
26
- "@verdaccio/hooks": "8.0.1",
27
- "@verdaccio/loaders": "8.0.1",
28
- "@verdaccio/local-storage-legacy": "11.3.1",
29
- "@verdaccio/logger": "8.0.1",
30
- "@verdaccio/middleware": "8.0.1",
31
- "@verdaccio/package-filter": "13.0.1",
32
- "@verdaccio/search-indexer": "8.0.0",
33
- "@verdaccio/signature": "8.0.1",
34
- "@verdaccio/streams": "10.2.3",
35
- "@verdaccio/tarball": "13.0.1",
23
+ "@verdaccio/auth": "8.0.2",
24
+ "@verdaccio/config": "8.1.1",
25
+ "@verdaccio/core": "8.1.1",
26
+ "@verdaccio/hooks": "8.0.2",
27
+ "@verdaccio/loaders": "8.0.2",
28
+ "@verdaccio/local-storage-legacy": "11.3.3",
29
+ "@verdaccio/logger": "8.0.2",
30
+ "@verdaccio/middleware": "8.0.2",
31
+ "@verdaccio/package-filter": "13.0.2",
32
+ "@verdaccio/search-indexer": "8.0.2",
33
+ "@verdaccio/signature": "8.0.2",
34
+ "@verdaccio/streams": "10.2.5",
35
+ "@verdaccio/tarball": "13.0.2",
36
36
  "@verdaccio/ui-theme": "9.0.0-next-9.14",
37
- "@verdaccio/url": "13.0.1",
38
- "@verdaccio/utils": "8.1.1",
37
+ "@verdaccio/url": "13.0.2",
38
+ "@verdaccio/utils": "8.1.2",
39
39
  "JSONStream": "1.3.5",
40
40
  "async": "3.2.6",
41
41
  "clipanion": "4.0.0-rc.4",
@@ -48,8 +48,8 @@
48
48
  "lru-cache": "7.18.3",
49
49
  "mime": "3.0.0",
50
50
  "semver": "7.8.0",
51
- "verdaccio-audit": "13.0.1",
52
- "verdaccio-htpasswd": "13.0.1"
51
+ "verdaccio-audit": "13.0.2",
52
+ "verdaccio-htpasswd": "13.0.2"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@babel/cli": "7.28.6",
@@ -159,5 +159,5 @@
159
159
  "url": "https://opencollective.com/verdaccio",
160
160
  "logo": "https://opencollective.com/verdaccio/logo.txt"
161
161
  },
162
- "packageManager": "yarn@4.14.1"
162
+ "packageManager": "yarn@4.15.0"
163
163
  }
@@ -0,0 +1,4 @@
1
+ import nock from 'nock';
2
+
3
+ nock.disableNetConnect();
4
+ nock.enableNetConnect((host) => host.startsWith('127.0.0.1') || host.startsWith('localhost'));