@verdaccio/config 6.0.0-6-next.7 → 6.0.0-6-next.11

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,82 @@
1
1
  # @verdaccio/config
2
2
 
3
+ ## 6.0.0-6-next.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [f86c31ed]
8
+ - @verdaccio/utils@6.0.0-6-next.9
9
+
10
+ ## 6.0.0-6-next.10
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [6c1eb021]
15
+ - @verdaccio/core@6.0.0-6-next.3
16
+ - @verdaccio/utils@6.0.0-6-next.8
17
+
18
+ ## 6.0.0-6-next.9
19
+
20
+ ### Major Changes
21
+
22
+ - 794af76c: Remove Node 12 support
23
+
24
+ - We need move to the new `undici` and does not support Node.js 12
25
+
26
+ ### Minor Changes
27
+
28
+ - 154b2ecd: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [794af76c]
33
+ - Updated dependencies [154b2ecd]
34
+ - @verdaccio/core@6.0.0-6-next.2
35
+ - @verdaccio/utils@6.0.0-6-next.7
36
+
37
+ ## 6.0.0-6-next.8
38
+
39
+ ### Major Changes
40
+
41
+ - 459b6fa7: refactor: search v1 endpoint and local-database
42
+
43
+ - refactor search `api v1` endpoint, improve performance
44
+ - remove usage of `async` dependency https://github.com/verdaccio/verdaccio/issues/1225
45
+ - refactor method storage class
46
+ - create new module `core` to reduce the ammount of modules with utilities
47
+ - use `undici` instead `node-fetch`
48
+ - use `fastify` instead `express` for functional test
49
+
50
+ ### Breaking changes
51
+
52
+ - plugin storage API changes
53
+ - remove old search endpoint (return 404)
54
+ - filter local private packages at plugin level
55
+
56
+ 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.
57
+
58
+ ```ts
59
+ export interface IPluginStorage<T> extends IPlugin {
60
+ add(name: string): Promise<void>;
61
+ remove(name: string): Promise<void>;
62
+ get(): Promise<any>;
63
+ init(): Promise<void>;
64
+ getSecret(): Promise<string>;
65
+ setSecret(secret: string): Promise<any>;
66
+ getPackageStorage(packageInfo: string): IPackageStorage;
67
+ search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;
68
+ saveToken(token: Token): Promise<any>;
69
+ deleteToken(user: string, tokenKey: string): Promise<any>;
70
+ readTokens(filter: TokenFilter): Promise<Token[]>;
71
+ }
72
+ ```
73
+
74
+ ### Patch Changes
75
+
76
+ - Updated dependencies [459b6fa7]
77
+ - @verdaccio/commons-api@11.0.0-6-next.4
78
+ - @verdaccio/utils@6.0.0-6-next.6
79
+
3
80
  ## 6.0.0-6-next.7
4
81
 
5
82
  ### Patch Changes
@@ -100,11 +100,6 @@ logs:
100
100
  # { type: file, path: verdaccio.log, level: http}
101
101
  # FIXME: this should be documented
102
102
  # More info about log rotation https://github.com/pinojs/pino/blob/master/docs/help.md#log-rotation
103
- flags:
104
- # support for npm token command
105
- token: false
106
- # support for the new v1 search endpoint, functional by incomplete read more on ticket 1732
107
- search: false
108
103
 
109
104
  # This affect the web and api (not developed yet)
110
105
  i18n:
@@ -3,18 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.readDefaultConfig = readDefaultConfig;
7
6
  exports.findConfigFile = findConfigFile;
7
+ exports.readDefaultConfig = readDefaultConfig;
8
8
 
9
- var _fs = _interopRequireDefault(require("fs"));
9
+ var _debug = _interopRequireDefault(require("debug"));
10
10
 
11
- var _path = _interopRequireDefault(require("path"));
11
+ var _fs = _interopRequireDefault(require("fs"));
12
12
 
13
13
  var _lodash = _interopRequireDefault(require("lodash"));
14
14
 
15
- var _debug = _interopRequireDefault(require("debug"));
15
+ var _path = _interopRequireDefault(require("path"));
16
16
 
17
- var _commonsApi = require("@verdaccio/commons-api");
17
+ var _core = require("@verdaccio/core");
18
18
 
19
19
  var _configUtils = require("./config-utils");
20
20
 
@@ -81,7 +81,7 @@ function readDefaultConfig() {
81
81
  } // @ts-ignore
82
82
 
83
83
 
84
- return _fs.default.readFileSync(pathDefaultConf, _commonsApi.CHARACTER_ENCODING.UTF8);
84
+ return _fs.default.readFileSync(pathDefaultConf, _core.CHARACTER_ENCODING.UTF8);
85
85
  }
86
86
 
87
87
  function createConfigFolder(configLocation) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config-path.ts"],"names":["CONFIG_FILE","XDG","WIN","WIN32","pkgJSON","name","debug","findConfigFile","configPath","path","resolve","configPaths","getConfigPaths","length","_","isEmpty","Error","primaryConf","find","configLocation","createConfigFile","head","createConfigFolder","defaultConfig","updateStorageLinks","readDefaultConfig","fs","writeFileSync","pathDefaultConf","__dirname","accessSync","constants","R_OK","TypeError","readFileSync","CHARACTER_ENCODING","UTF8","mkdirSync","dirname","recursive","type","dataDir","process","env","XDG_DATA_HOME","join","HOME","replace","listPaths","getXDGDirectory","getWindowsDirectory","getRelativeDefaultDirectory","getOldDirectory","reduce","acc","currentValue","push","xDGConfigPath","XDG_CONFIG_HOME","platform","APPDATA"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;AAEA,MAAMA,WAAW,GAAG,aAApB;AACA,MAAMC,GAAG,GAAG,KAAZ;AACA,MAAMC,GAAG,GAAG,KAAZ;AACA,MAAMC,KAAK,GAAG,OAAd,C,CACA;;AACA,MAAMC,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAE;AADQ,CAAhB;AASA,MAAMC,KAAK,GAAG,oBAAW,kBAAX,CAAd;AAEA;AACA;AACA;AACA;;AACA,SAASC,cAAT,CAAwBC,UAAxB,EAAqD;AACnD;AACA,MAAI,OAAOA,UAAP,KAAsB,WAA1B,EAAuC;AACrC,WAAOC,cAAKC,OAAL,CAAaF,UAAb,CAAP;AACD;;AAED,QAAMG,WAA6B,GAAGC,cAAc,EAApD;AACAN,EAAAA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cAAKoC,IAAL,CAAUH,OAAO,CAACC,GAAR,CAAYiB,OAAtB,EAA+BxD,OAAO,CAACC,IAAvC,EAA6CL,WAA7C,CAAb,CADD;AAELwC,MAAAA,IAAI,EAAEtC;AAFD,KAAP;AAID;AACF,CARD;AAUA;AACA;AACA;AACA;AACA;;;AACA,MAAMiD,2BAA2B,GAAG,MAAsB;AACxD,SAAO;AACL1C,IAAAA,IAAI,EAAEA,cAAKC,OAAL,CAAaD,cAAKoC,IAAL,CAAU,GAAV,EAAezC,OAAO,CAACC,IAAvB,EAA6BL,WAA7B,CAAb,CADD;AAELwC,IAAAA,IAAI,EAAE;AAFD,GAAP;AAID,CALD;AAOA;AACA;AACA;AACA;;;AACA,MAAMY,eAAe,GAAG,MAAsB;AAC5C,SAAO;AACL3C,IAAAA,IAAI,EAAEA,cAAKC,OAAL,CAAaD,cAAKoC,IAAL,CAAU,GAAV,EAAe7C,WAAf,CAAb,CADD;AAELwC,IAAAA,IAAI,EAAE;AAFD,GAAP;AAID,CALD","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport _ from 'lodash';\nimport buildDebug from 'debug';\n\nimport { CHARACTER_ENCODING } from '@verdaccio/commons-api';\nimport { folderExists, fileExists } from './config-utils';\n\nconst CONFIG_FILE = 'config.yaml';\nconst XDG = 'xdg';\nconst WIN = 'win';\nconst WIN32 = 'win32';\n// eslint-disable-next-line\nconst pkgJSON = {\n name: 'verdaccio',\n};\n\nexport type SetupDirectory = {\n path: string;\n type: string;\n};\n\nconst debug = buildDebug('verdaccio:config');\n\n/**\n * Find and get the first config file that match.\n * @return {String} the config file path\n */\nfunction findConfigFile(configPath?: string): string {\n // console.log(process.env);\n if (typeof configPath !== 'undefined') {\n return path.resolve(configPath);\n }\n\n const configPaths: SetupDirectory[] = getConfigPaths();\n debug('%o posible locations found', configPaths.length);\n if (_.isEmpty(configPaths)) {\n // this should never happens\n throw new Error('no configuration files can be processed');\n }\n\n // find the first location that already exist\n const primaryConf: SetupDirectory | void = _.find(configPaths, (configLocation: SetupDirectory) =>\n fileExists(configLocation.path)\n );\n\n if (typeof primaryConf !== 'undefined') {\n debug('previous location exist already %s', primaryConf?.path);\n return primaryConf.path;\n }\n\n // @ts-ignore\n return createConfigFile(_.head(configPaths)).path;\n}\n\nfunction createConfigFile(configLocation: SetupDirectory): SetupDirectory {\n createConfigFolder(configLocation);\n\n const defaultConfig = updateStorageLinks(configLocation, readDefaultConfig());\n\n fs.writeFileSync(configLocation.path, defaultConfig);\n\n return configLocation;\n}\n\nexport function readDefaultConfig(): Buffer {\n const pathDefaultConf: string = path.resolve(__dirname, 'conf/default.yaml');\n try {\n debug('default configuration file %s', pathDefaultConf);\n fs.accessSync(pathDefaultConf, fs.constants.R_OK);\n } catch {\n throw new TypeError('configuration file does not have enough permissions for reading');\n }\n // @ts-ignore\n return fs.readFileSync(pathDefaultConf, CHARACTER_ENCODING.UTF8);\n}\n\nfunction createConfigFolder(configLocation): void {\n fs.mkdirSync(path.dirname(configLocation.path), { recursive: true });\n debug(`Creating default config file in %o`, configLocation?.path);\n}\n\nfunction updateStorageLinks(configLocation, defaultConfig): string {\n if (configLocation.type !== XDG) {\n return defaultConfig;\n }\n\n // $XDG_DATA_HOME defines the base directory relative to which user specific data\n // files should be stored, If $XDG_DATA_HOME is either not set or empty, a default\n // equal to $HOME/.local/share should be used.\n let dataDir =\n process.env.XDG_DATA_HOME || path.join(process.env.HOME as string, '.local', 'share');\n if (folderExists(dataDir)) {\n debug(`previous storage located`);\n debug(`update storage links to %s`, dataDir);\n dataDir = path.resolve(path.join(dataDir, pkgJSON.name, 'storage'));\n return defaultConfig.replace(/^storage: .\\/storage$/m, `storage: ${dataDir}`);\n }\n debug(`could not find a previous storage location, skip override`);\n return defaultConfig;\n}\n\n/**\n * Return a list of configuration locations by platform.\n * @returns\n */\nfunction getConfigPaths(): SetupDirectory[] {\n const listPaths: (SetupDirectory | void)[] = [\n getXDGDirectory(),\n getWindowsDirectory(),\n getRelativeDefaultDirectory(),\n getOldDirectory(),\n ];\n\n return listPaths.reduce(function (acc, currentValue: SetupDirectory | void): SetupDirectory[] {\n if (typeof currentValue !== 'undefined') {\n debug('directory detected path %s for type %s', currentValue?.path, currentValue.type);\n acc.push(currentValue);\n }\n return acc;\n }, [] as SetupDirectory[]);\n}\n\n/**\n * Get XDG_CONFIG_HOME or HOME location (usually unix)\n * @returns\n */\nconst getXDGDirectory = (): SetupDirectory | void => {\n const xDGConfigPath =\n process.env.XDG_CONFIG_HOME || (process.env.HOME && path.join(process.env.HOME, '.config'));\n if (xDGConfigPath && folderExists(xDGConfigPath)) {\n debug('XDGConfig folder path %s', xDGConfigPath);\n return {\n path: path.join(xDGConfigPath, pkgJSON.name, CONFIG_FILE),\n type: XDG,\n };\n }\n};\n\n/**\n * Detect windows location, APPDATA\n * usually something like C:\\User\\<Build User>\\AppData\\Local\n * @returns\n */\nconst getWindowsDirectory = (): SetupDirectory | void => {\n if (process.platform === WIN32 && process.env.APPDATA && folderExists(process.env.APPDATA)) {\n debug('is windows appdata: %s', process.env.APPDATA);\n return {\n path: path.resolve(path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),\n type: WIN,\n };\n }\n};\n\n/**\n * Return relative directory, this is the default.\n * It will cretate config in your {currentLocation/verdaccio/config.yaml}\n * @returns\n */\nconst getRelativeDefaultDirectory = (): SetupDirectory => {\n return {\n path: path.resolve(path.join('.', pkgJSON.name, CONFIG_FILE)),\n type: 'def',\n };\n};\n\n/**\n * This should never happens, consider it DEPRECATED\n * @returns\n */\nconst getOldDirectory = (): SetupDirectory => {\n return {\n path: path.resolve(path.join('.', CONFIG_FILE)),\n type: 'old',\n };\n};\n\nexport { findConfigFile };\n"],"file":"config-path.js"}
1
+ {"version":3,"sources":["../src/config-path.ts"],"names":["CONFIG_FILE","XDG","WIN","WIN32","pkgJSON","name","debug","findConfigFile","configPath","path","resolve","configPaths","getConfigPaths","length","_","isEmpty","Error","primaryConf","find","configLocation","createConfigFile","head","createConfigFolder","defaultConfig","updateStorageLinks","readDefaultConfig","fs","writeFileSync","pathDefaultConf","__dirname","accessSync","constants","R_OK","TypeError","readFileSync","CHARACTER_ENCODING","UTF8","mkdirSync","dirname","recursive","type","dataDir","process","env","XDG_DATA_HOME","join","HOME","replace","listPaths","getXDGDirectory","getWindowsDirectory","getRelativeDefaultDirectory","getOldDirectory","reduce","acc","currentValue","push","xDGConfigPath","XDG_CONFIG_HOME","platform","APPDATA"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;;;AAEA,MAAMA,WAAW,GAAG,aAApB;AACA,MAAMC,GAAG,GAAG,KAAZ;AACA,MAAMC,GAAG,GAAG,KAAZ;AACA,MAAMC,KAAK,GAAG,OAAd,C,CACA;;AACA,MAAMC,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAE;AADQ,CAAhB;AASA,MAAMC,KAAK,GAAG,oBAAW,kBAAX,CAAd;AAEA;AACA;AACA;AACA;;AACA,SAASC,cAAT,CAAwBC,UAAxB,EAAqD;AACnD;AACA,MAAI,OAAOA,UAAP,KAAsB,WAA1B,EAAuC;AACrC,WAAOC,cAAKC,OAAL,CAAaF,UAAb,CAAP;AACD;;AAED,QAAMG,WAA6B,GAAGC,cAAc,EAApD;AACAN,EAAAA,KAAK,CAAC,4BAAD,EAA+BK,WAAW,CAACE,MAA3C,CAAL;;AACA,MAAIC,gBAAEC,OAAF,CAAUJ,WAAV,CAAJ,EAA4B;AAC1B;AACA,UAAM,IAAIK,KAAJ,CAAU,yCAAV,CAAN;AACD,GAXkD,CAanD;;;AACA,QAAMC,WAAkC,GAAGH,gBAAEI,IAAF,CAAOP,WAAP,EAAqBQ,cAAD,IAC7D,6BAAWA,cAAc,CAACV,IAA1B,CADyC,CAA3C;;AAIA,MAAI,OAAOQ,WAAP,KAAuB,WAA3B,EAAwC;AACtCX,IAAAA,KAAK,CAAC,oCAAD,EAAuCW,WAAvC,aAAuCA,WAAvC,uBAAuCA,WAAW,CAAER,IAApD,C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MAAMY,eAAe,GAAG,MAAsB;AAC5C,SAAO;AACL3C,IAAAA,IAAI,EAAEA,cAAKC,OAAL,CAAaD,cAAKoC,IAAL,CAAU,GAAV,EAAe7C,WAAf,CAAb,CADD;AAELwC,IAAAA,IAAI,EAAE;AAFD,GAAP;AAID,CALD","sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\nimport _ from 'lodash';\nimport path from 'path';\n\nimport { CHARACTER_ENCODING } from '@verdaccio/core';\n\nimport { fileExists, folderExists } from './config-utils';\n\nconst CONFIG_FILE = 'config.yaml';\nconst XDG = 'xdg';\nconst WIN = 'win';\nconst WIN32 = 'win32';\n// eslint-disable-next-line\nconst pkgJSON = {\n name: 'verdaccio',\n};\n\nexport type SetupDirectory = {\n path: string;\n type: string;\n};\n\nconst debug = buildDebug('verdaccio:config');\n\n/**\n * Find and get the first config file that match.\n * @return {String} the config file path\n */\nfunction findConfigFile(configPath?: string): string {\n // console.log(process.env);\n if (typeof configPath !== 'undefined') {\n return path.resolve(configPath);\n }\n\n const configPaths: SetupDirectory[] = getConfigPaths();\n debug('%o posible locations found', configPaths.length);\n if (_.isEmpty(configPaths)) {\n // this should never happens\n throw new Error('no configuration files can be processed');\n }\n\n // find the first location that already exist\n const primaryConf: SetupDirectory | void = _.find(configPaths, (configLocation: SetupDirectory) =>\n fileExists(configLocation.path)\n );\n\n if (typeof primaryConf !== 'undefined') {\n debug('previous location exist already %s', primaryConf?.path);\n return primaryConf.path;\n }\n\n // @ts-ignore\n return createConfigFile(_.head(configPaths)).path;\n}\n\nfunction createConfigFile(configLocation: SetupDirectory): SetupDirectory {\n createConfigFolder(configLocation);\n\n const defaultConfig = updateStorageLinks(configLocation, readDefaultConfig());\n\n fs.writeFileSync(configLocation.path, defaultConfig);\n\n return configLocation;\n}\n\nexport function readDefaultConfig(): Buffer {\n const pathDefaultConf: string = path.resolve(__dirname, 'conf/default.yaml');\n try {\n debug('default configuration file %s', pathDefaultConf);\n fs.accessSync(pathDefaultConf, fs.constants.R_OK);\n } catch {\n throw new TypeError('configuration file does not have enough permissions for reading');\n }\n // @ts-ignore\n return fs.readFileSync(pathDefaultConf, CHARACTER_ENCODING.UTF8);\n}\n\nfunction createConfigFolder(configLocation): void {\n fs.mkdirSync(path.dirname(configLocation.path), { recursive: true });\n debug(`Creating default config file in %o`, configLocation?.path);\n}\n\nfunction updateStorageLinks(configLocation, defaultConfig): string {\n if (configLocation.type !== XDG) {\n return defaultConfig;\n }\n\n // $XDG_DATA_HOME defines the base directory relative to which user specific data\n // files should be stored, If $XDG_DATA_HOME is either not set or empty, a default\n // equal to $HOME/.local/share should be used.\n let dataDir =\n process.env.XDG_DATA_HOME || path.join(process.env.HOME as string, '.local', 'share');\n if (folderExists(dataDir)) {\n debug(`previous storage located`);\n debug(`update storage links to %s`, dataDir);\n dataDir = path.resolve(path.join(dataDir, pkgJSON.name, 'storage'));\n return defaultConfig.replace(/^storage: .\\/storage$/m, `storage: ${dataDir}`);\n }\n debug(`could not find a previous storage location, skip override`);\n return defaultConfig;\n}\n\n/**\n * Return a list of configuration locations by platform.\n * @returns\n */\nfunction getConfigPaths(): SetupDirectory[] {\n const listPaths: (SetupDirectory | void)[] = [\n getXDGDirectory(),\n getWindowsDirectory(),\n getRelativeDefaultDirectory(),\n getOldDirectory(),\n ];\n\n return listPaths.reduce(function (acc, currentValue: SetupDirectory | void): SetupDirectory[] {\n if (typeof currentValue !== 'undefined') {\n debug('directory detected path %s for type %s', currentValue?.path, currentValue.type);\n acc.push(currentValue);\n }\n return acc;\n }, [] as SetupDirectory[]);\n}\n\n/**\n * Get XDG_CONFIG_HOME or HOME location (usually unix)\n * @returns\n */\nconst getXDGDirectory = (): SetupDirectory | void => {\n const xDGConfigPath =\n process.env.XDG_CONFIG_HOME || (process.env.HOME && path.join(process.env.HOME, '.config'));\n if (xDGConfigPath && folderExists(xDGConfigPath)) {\n debug('XDGConfig folder path %s', xDGConfigPath);\n return {\n path: path.join(xDGConfigPath, pkgJSON.name, CONFIG_FILE),\n type: XDG,\n };\n }\n};\n\n/**\n * Detect windows location, APPDATA\n * usually something like C:\\User\\<Build User>\\AppData\\Local\n * @returns\n */\nconst getWindowsDirectory = (): SetupDirectory | void => {\n if (process.platform === WIN32 && process.env.APPDATA && folderExists(process.env.APPDATA)) {\n debug('is windows appdata: %s', process.env.APPDATA);\n return {\n path: path.resolve(path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)),\n type: WIN,\n };\n }\n};\n\n/**\n * Return relative directory, this is the default.\n * It will cretate config in your {currentLocation/verdaccio/config.yaml}\n * @returns\n */\nconst getRelativeDefaultDirectory = (): SetupDirectory => {\n return {\n path: path.resolve(path.join('.', pkgJSON.name, CONFIG_FILE)),\n type: 'def',\n };\n};\n\n/**\n * This should never happens, consider it DEPRECATED\n * @returns\n */\nconst getOldDirectory = (): SetupDirectory => {\n return {\n path: path.resolve(path.join('.', CONFIG_FILE)),\n type: 'old',\n };\n};\n\nexport { findConfigFile };\n"],"file":"config-path.js"}
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.folderExists = folderExists;
7
6
  exports.fileExists = fileExists;
7
+ exports.folderExists = folderExists;
8
8
 
9
9
  var _fs = _interopRequireDefault(require("fs"));
10
10
 
package/build/config.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { PackageList, Config as AppConfig, ConfigRuntime, Security, PackageAccess, ServerSettingsConf, AuthConf } from '@verdaccio/types';
2
- export declare type MatchedPackage = PackageAccess | void;
1
+ import { Config as AppConfig, AuthConf, ConfigRuntime, PackageAccess, PackageList, Security, ServerSettingsConf } from '@verdaccio/types';
3
2
  export declare const WEB_TITLE = "Verdaccio";
4
3
  /**
5
4
  * Coordinates the application configuration
@@ -21,7 +20,7 @@ declare class Config implements AppConfig {
21
20
  /**
22
21
  * Check for package spec
23
22
  */
24
- getMatchedPackagesSpec(pkgName: string): MatchedPackage;
23
+ getMatchedPackagesSpec(pkgName: string): PackageAccess | void;
25
24
  /**
26
25
  * Store or create whether receive a secret key
27
26
  */
package/build/config.js CHANGED
@@ -3,30 +3,30 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Config = exports.WEB_TITLE = void 0;
6
+ exports.WEB_TITLE = exports.Config = void 0;
7
7
 
8
8
  var _assert = _interopRequireDefault(require("assert"));
9
9
 
10
+ var _debug = _interopRequireDefault(require("debug"));
11
+
10
12
  var _lodash = _interopRequireDefault(require("lodash"));
11
13
 
12
- var _debug = _interopRequireDefault(require("debug"));
14
+ var _core = require("@verdaccio/core");
13
15
 
14
16
  var _utils = require("@verdaccio/utils");
15
17
 
16
- var _commonsApi = require("@verdaccio/commons-api");
17
-
18
- var _token = require("./token");
18
+ var _agent = require("./agent");
19
19
 
20
20
  var _packageAccess = require("./package-access");
21
21
 
22
- var _uplinks = require("./uplinks");
23
-
24
22
  var _security = require("./security");
25
23
 
26
- var _agent = require("./agent");
27
-
28
24
  var _serverSettings = _interopRequireDefault(require("./serverSettings"));
29
25
 
26
+ var _token = require("./token");
27
+
28
+ var _uplinks = require("./uplinks");
29
+
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
31
 
32
32
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -87,7 +87,7 @@ class Config {
87
87
  } // some weird shell scripts are valid yaml files parsed as string
88
88
 
89
89
 
90
- (0, _assert.default)(_lodash.default.isObject(config), _commonsApi.APP_ERROR.CONFIG_NOT_VALID); // sanity check for strategic config properties
90
+ (0, _assert.default)(_lodash.default.isObject(config), _core.APP_ERROR.CONFIG_NOT_VALID); // sanity check for strategic config properties
91
91
 
92
92
  strategicConfigProps.forEach(function (x) {
93
93
  if (self[x] == null) {
@@ -116,7 +116,8 @@ class Config {
116
116
 
117
117
 
118
118
  getMatchedPackagesSpec(pkgName) {
119
- return (0, _packageAccess.getMatchedPackagesSpec)(pkgName, this.packages);
119
+ // TODO: remove this method and replace by library utils
120
+ return (0, _utils.getMatchedPackagesSpec)(pkgName, this.packages);
120
121
  }
121
122
  /**
122
123
  * Store or create whether receive a secret key
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts"],"names":["strategicConfigProps","allowedEnvConfig","debug","WEB_TITLE","Config","constructor","config","self","storage","process","env","VERDACCIO_STORAGE_PATH","config_path","plugins","security","_","merge","defaultSecurity","serverSettings","configProp","isNil","user_agent","isObject","APP_ERROR","CONFIG_NOT_VALID","forEach","x","uplinks","packages","envConf","toUpperCase","server_id","getMatchedPackagesSpec","pkgName","checkSecretKey","secret","isString","isEmpty"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,oBAAoB,GAAG,CAAC,SAAD,EAAY,UAAZ,CAA7B;AACA,MAAMC,gBAAgB,GAAG,CAAC,YAAD,EAAe,aAAf,EAA8B,UAA9B,CAAzB;AAIA,MAAMC,KAAK,GAAG,oBAAW,kBAAX,CAAd;AAEO,MAAMC,SAAS,GAAG,WAAlB;AAEP;AACA;AACA;;;;AACA,MAAMC,MAAN,CAAkC;AAYhC;AAGOC,EAAAA,WAAW,CAACC,MAAD,EAAwB;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACxC,UAAMC,IAAI,GAAG,IAAb;AACA,SAAKC,OAAL,GAAeC,OAAO,CAACC,GAAR,CAAYC,sBAAZ,IAAsCL,MAAM,CAACE,OAA5D;AACA,SAAKI,WAAL,GAAmBN,MAAM,CAACM,WAA1B;AACA,SAAKC,OAAL,GAAeP,MAAM,CAACO,OAAtB;AACA,SAAKC,QAAL,GAAgBC,gBAAEC,KAAF,CAAQC,yBAAR,EAAyBX,MAAM,CAACQ,QAAhC,CAAhB;AACA,SAAKI,c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L,GAAiB,oCAAwB,CAAxB,CAAjB;AACD;AACF;AAED;AACF;AACA;;;AACSC,EAAAA,sBAAsB,CAACC,OAAD,EAAkC;AAC7D,WAAO,2CAAuBA,OAAvB,EAAgC,KAAKL,QAArC,CAAP;AACD;AAED;AACF;AACA;;;AACSM,EAAAA,cAAc,CAACC,MAAD,EAA0B;AAC7CjC,IAAAA,KAAK,CAAC,kBAAD,CAAL;;AACA,QAAIa,gBAAEqB,QAAF,CAAWD,MAAX,KAAsBpB,gBAAEsB,OAAF,CAAUF,MAAV,MAAsB,KAAhD,EAAuD;AACrD,WAAKA,MAAL,GAAcA,MAAd;AACAjC,MAAAA,KAAK,CAAC,sBAAD,CAAL;AACA,aAAOiC,MAAP;AACD,KAN4C,CAO7C;AACA;;;AACAjC,IAAAA,KAAK,CAAC,oBAAD,CAAL;AACA,SAAKiC,MAAL,GAAc,qCAAd;AACA,WAAO,KAAKA,MAAZ;AACD;;AArF+B","sourcesContent":["import assert from 'assert';\nimport _ from 'lodash';\nimport buildDebug from 'debug';\n\nimport { generateRandomHexString, isObject } from '@verdaccio/utils';\nimport { APP_ERROR } from '@verdaccio/commons-api';\nimport {\n PackageList,\n Config as AppConfig,\n ConfigRuntime,\n Security,\n PackageAccess,\n ServerSettingsConf,\n AuthConf,\n} from '@verdaccio/types';\n\nimport { generateRandomSecretKey } from './token';\nimport { getMatchedPackagesSpec, normalisePackageAccess } from './package-access';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\nimport { defaultSecurity } from './security';\nimport { getUserAgent } from './agent';\nimport serverSettings from './serverSettings';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\n\nexport type MatchedPackage = PackageAccess | void;\n\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public server_id: string;\n public config_path: string;\n public storage: string | void;\n public plugins: string | void;\n public security: Security;\n public serverSettings: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n\n public constructor(config: ConfigRuntime) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n this.config_path = config.config_path;\n this.plugins = config.plugins;\n this.security = _.merge(defaultSecurity, config.security);\n this.serverSettings = serverSettings;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n // @ts-ignore\n if (_.isNil(this.user_agent)) {\n this.user_agent = getUserAgent();\n }\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(_.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = generateRandomHexString(6);\n }\n }\n\n /**\n * Check for package spec\n */\n public getMatchedPackagesSpec(pkgName: string): MatchedPackage {\n return getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Store or create whether receive a secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('check secret key');\n if (_.isString(secret) && _.isEmpty(secret) === false) {\n this.secret = secret;\n debug('reusing previous key');\n return secret;\n }\n // it generates a secret key\n // FUTURE: this might be an external secret key, perhaps within config file?\n debug('generate a new key');\n this.secret = generateRandomSecretKey();\n return this.secret;\n }\n}\n\nexport { Config };\n"],"file":"config.js"}
1
+ {"version":3,"sources":["../src/config.ts"],"names":["strategicConfigProps","allowedEnvConfig","debug","WEB_TITLE","Config","constructor","config","self","storage","process","env","VERDACCIO_STORAGE_PATH","config_path","plugins","security","_","merge","defaultSecurity","serverSettings","configProp","isNil","user_agent","isObject","APP_ERROR","CONFIG_NOT_VALID","forEach","x","uplinks","packages","envConf","toUpperCase","server_id","getMatchedPackagesSpec","pkgName","checkSecretKey","secret","isString","isEmpty"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAUA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,oBAAoB,GAAG,CAAC,SAAD,EAAY,UAAZ,CAA7B;AACA,MAAMC,gBAAgB,GAAG,CAAC,YAAD,EAAe,aAAf,EAA8B,UAA9B,CAAzB;AACA,MAAMC,KAAK,GAAG,oBAAW,kBAAX,CAAd;AAEO,MAAMC,SAAS,GAAG,WAAlB;AAEP;AACA;AACA;;;;AACA,MAAMC,MAAN,CAAkC;AAYhC;AAGOC,EAAAA,WAAW,CAACC,MAAD,EAAwB;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACxC,UAAMC,IAAI,GAAG,IAAb;AACA,SAAKC,OAAL,GAAeC,OAAO,CAACC,GAAR,CAAYC,sBAAZ,IAAsCL,MAAM,CAACE,OAA5D;AACA,SAAKI,WAAL,GAAmBN,MAAM,CAACM,WAA1B;AACA,SAAKC,OAAL,GAAeP,MAAM,CAACO,OAAtB;AACA,SAAKC,QAAL,GAAgBC,gBAAEC,KAAF,CAAQC,yBAAR,EAAyBX,MAAM,CAACQ,QAAhC,CAAhB;AACA,SAAKI,cAAL,GAAsBA,uBAAtB;;AAEA,SAAK,MAAMC,UAAX,IAAyBb,MAAzB,EAAiC;AAC/B,UAAIC,IAAI,CAACY,UAAD,CAAJ,IAAoB,IAAxB,EAA8B;AAC5BZ,QAAAA,IAAI,CAACY,UAAD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AED;AACF;AACA;;;AACSM,EAAAA,cAAc,CAACC,MAAD,EAA0B;AAC7CjC,IAAAA,KAAK,CAAC,kBAAD,CAAL;;AACA,QAAIa,gBAAEqB,QAAF,CAAWD,MAAX,KAAsBpB,gBAAEsB,OAAF,CAAUF,MAAV,MAAsB,KAAhD,EAAuD;AACrD,WAAKA,MAAL,GAAcA,MAAd;AACAjC,MAAAA,KAAK,CAAC,sBAAD,CAAL;AACA,aAAOiC,MAAP;AACD,KAN4C,CAO7C;AACA;;;AACAjC,IAAAA,KAAK,CAAC,oBAAD,CAAL;AACA,SAAKiC,MAAL,GAAc,qCAAd;AACA,WAAO,KAAKA,MAAZ;AACD;;AAtF+B","sourcesContent":["import assert from 'assert';\nimport buildDebug from 'debug';\nimport _ from 'lodash';\n\nimport { APP_ERROR } from '@verdaccio/core';\nimport {\n Config as AppConfig,\n AuthConf,\n ConfigRuntime,\n PackageAccess,\n PackageList,\n Security,\n ServerSettingsConf,\n} from '@verdaccio/types';\nimport { generateRandomHexString, getMatchedPackagesSpec, isObject } from '@verdaccio/utils';\n\nimport { getUserAgent } from './agent';\nimport { normalisePackageAccess } from './package-access';\nimport { defaultSecurity } from './security';\nimport serverSettings from './serverSettings';\nimport { generateRandomSecretKey } from './token';\nimport { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';\n\nconst strategicConfigProps = ['uplinks', 'packages'];\nconst allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];\nconst debug = buildDebug('verdaccio:config');\n\nexport const WEB_TITLE = 'Verdaccio';\n\n/**\n * Coordinates the application configuration\n */\nclass Config implements AppConfig {\n public user_agent: string;\n public uplinks: any;\n public packages: PackageList;\n public users: any;\n public auth: AuthConf;\n public server_id: string;\n public config_path: string;\n public storage: string | void;\n public plugins: string | void;\n public security: Security;\n public serverSettings: ServerSettingsConf;\n // @ts-ignore\n public secret: string;\n\n public constructor(config: ConfigRuntime) {\n const self = this;\n this.storage = process.env.VERDACCIO_STORAGE_PATH || config.storage;\n this.config_path = config.config_path;\n this.plugins = config.plugins;\n this.security = _.merge(defaultSecurity, config.security);\n this.serverSettings = serverSettings;\n\n for (const configProp in config) {\n if (self[configProp] == null) {\n self[configProp] = config[configProp];\n }\n }\n\n // @ts-ignore\n if (_.isNil(this.user_agent)) {\n this.user_agent = getUserAgent();\n }\n\n // some weird shell scripts are valid yaml files parsed as string\n assert(_.isObject(config), APP_ERROR.CONFIG_NOT_VALID);\n\n // sanity check for strategic config properties\n strategicConfigProps.forEach(function (x): void {\n if (self[x] == null) {\n self[x] = {};\n }\n\n assert(isObject(self[x]), `CONFIG: bad \"${x}\" value (object expected)`);\n });\n\n this.uplinks = sanityCheckUplinksProps(uplinkSanityCheck(this.uplinks));\n this.packages = normalisePackageAccess(self.packages);\n\n // loading these from ENV if aren't in config\n allowedEnvConfig.forEach((envConf): void => {\n if (!(envConf in self)) {\n self[envConf] = process.env[envConf] || process.env[envConf.toUpperCase()];\n }\n });\n\n // unique identifier of self server (or a cluster), used to avoid loops\n // @ts-ignore\n if (!this.server_id) {\n this.server_id = generateRandomHexString(6);\n }\n }\n\n /**\n * Check for package spec\n */\n public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {\n // TODO: remove this method and replace by library utils\n return getMatchedPackagesSpec(pkgName, this.packages);\n }\n\n /**\n * Store or create whether receive a secret key\n */\n public checkSecretKey(secret?: string): string {\n debug('check secret key');\n if (_.isString(secret) && _.isEmpty(secret) === false) {\n this.secret = secret;\n debug('reusing previous key');\n return secret;\n }\n // it generates a secret key\n // FUTURE: this might be an external secret key, perhaps within config file?\n debug('generate a new key');\n this.secret = generateRandomSecretKey();\n return this.secret;\n }\n}\n\nexport { Config };\n"],"file":"config.js"}
@@ -1,5 +1,4 @@
1
- import { PackageList, PackageAccess } from '@verdaccio/types';
2
- import { MatchedPackage } from './config';
1
+ import { PackageAccess } from '@verdaccio/types';
3
2
  export interface LegacyPackageList {
4
3
  [key: string]: PackageAccess;
5
4
  }
@@ -17,5 +16,4 @@ export declare const PACKAGE_ACCESS: {
17
16
  ALL: string;
18
17
  };
19
18
  export declare function normalizeUserList(groupsList: any): any;
20
- export declare function getMatchedPackagesSpec(pkgName: string, packages: PackageList): MatchedPackage;
21
19
  export declare function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList;
@@ -3,18 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.normalizeUserList = normalizeUserList;
7
- exports.getMatchedPackagesSpec = getMatchedPackagesSpec;
6
+ exports.ROLES = exports.PACKAGE_ACCESS = void 0;
8
7
  exports.normalisePackageAccess = normalisePackageAccess;
9
- exports.PACKAGE_ACCESS = exports.ROLES = void 0;
8
+ exports.normalizeUserList = normalizeUserList;
10
9
 
11
10
  var _assert = _interopRequireDefault(require("assert"));
12
11
 
13
12
  var _lodash = _interopRequireDefault(require("lodash"));
14
13
 
15
- var _minimatch = _interopRequireDefault(require("minimatch"));
16
-
17
- var _utils = require("@verdaccio/utils");
14
+ var _core = require("@verdaccio/core");
18
15
 
19
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
17
 
@@ -54,22 +51,12 @@ function normalizeUserList(groupsList) {
54
51
  } else if (Array.isArray(groupsList)) {
55
52
  result.push(groupsList);
56
53
  } else {
57
- throw _utils.ErrorCode.getInternalError('CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList));
54
+ throw _core.errorUtils.getInternalError('CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList));
58
55
  }
59
56
 
60
57
  return _lodash.default.flatten(result);
61
58
  }
62
59
 
63
- function getMatchedPackagesSpec(pkgName, packages) {
64
- for (const i in packages) {
65
- if (_minimatch.default.makeRe(i).exec(pkgName)) {
66
- return packages[i];
67
- }
68
- }
69
-
70
- return;
71
- }
72
-
73
60
  function normalisePackageAccess(packages) {
74
61
  const normalizedPkgs = _objectSpread({}, packages);
75
62
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/package-access.ts"],"names":["ROLES","$ALL","ALL","$AUTH","$ANONYMOUS","DEPRECATED_ALL","DEPRECATED_AUTH","DEPRECATED_ANONYMOUS","PACKAGE_ACCESS","SCOPE","normalizeUserList","groupsList","result","_","isNil","isString","groupsArray","split","push","Array","isArray","ErrorCode","getInternalError","JSON","stringify","flatten","getMatchedPackagesSpec","pkgName","packages","i","minimatch","makeRe","exec","normalisePackageAccess","normalizedPkgs","access","publish","unpublish","proxy","pkg","Object","prototype","hasOwnProperty","call","packageAccess","isInvalid","isObject","isUndefined"],"mappings":";;;;;;;;;;AAAA;;AACA;;AACA;;AAGA;;;;;;;;;;AAOO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,IAAI,EAAE,MADa;AAEnBC,EAAAA,GAAG,EAAE,KAFc;AAGnBC,EAAAA,KAAK,EAAE,gBAHY;AAInBC,EAAAA,UAAU,EAAE,YAJO;AAKnBC,EAAAA,cAAc,EAAE,MALG;AAMnBC,EAAAA,eAAe,EAAE,gBANE;AAOnBC,EAAAA,oBAAoB,EAAE;AAPH,CAAd;;AAUA,MAAMC,cAAc,GAAG;AAC5BC,EAAAA,KAAK,EAAE,MADqB;AAE5BP,EAAAA,GAAG,EAAE;AAFuB,CAAvB;;;AAKA,SAASQ,iBAAT,CAA2BC,UAA3B,EAAiD;AACtD,QAAMC,MAAa,GAAG,EAAtB;;AACA,MAAIC,gBAAEC,KAAF,CAAQH,UAAR,CAAJ,EAAyB;AACvB,WAAOC,MAAP;AACD,GAJqD,CAMtD;;;AACA,MAAIC,gBAAEE,QAAF,CAAWJ,UAAX,CAAJ,EAA4B;AAC1B,UAAMK,WAAW,GAAGL,UAAU,CAACM,KAAX,CAAiB,KAAjB,CAApB;AAEAL,IAAAA,MAAM,CAACM,IAAP,CAAYF,WAAZ;AACD,GAJD,MAIO,IAAIG,KAAK,CAACC,OAAN,CAAcT,UAAd,CAAJ,EAA+B;AACpCC,IAAAA,MAAM,CAACM,IAAP,CAAYP,UAAZ;AACD,GAFM,MA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D,MAAAA,cAAc,CAACK,GAAD,CAAd,CAAoBH,OAApB,GAA8B1B,iBAAiB,CAACkC,aAAa,CAACR,OAAf,CAA/C;AACAF,MAAAA,cAAc,CAACK,GAAD,CAAd,CAAoBD,KAApB,GAA4B5B,iBAAiB,CAACkC,aAAa,CAACN,KAAf,CAA7C,CAPuD,CAQvD;;AACAJ,MAAAA,cAAc,CAACK,GAAD,CAAd,CAAoBF,SAApB,GAAgCxB,gBAAEkC,WAAF,CAAcH,aAAa,CAACP,SAA5B,IAC5B,KAD4B,GAE5B3B,iBAAiB,CAACkC,aAAa,CAACP,SAAf,CAFrB;AAGD;AACF;;AAED,SAAOH,cAAP;AACD","sourcesContent":["import assert from 'assert';\nimport _ from 'lodash';\nimport minimatch from 'minimatch';\n\nimport { PackageList, PackageAccess } from '@verdaccio/types';\nimport { ErrorCode } from '@verdaccio/utils';\nimport { MatchedPackage } from './config';\n\nexport interface LegacyPackageList {\n [key: string]: PackageAccess;\n}\n\nexport const ROLES = {\n $ALL: '$all',\n ALL: 'all',\n $AUTH: '$authenticated',\n $ANONYMOUS: '$anonymous',\n DEPRECATED_ALL: '@all',\n DEPRECATED_AUTH: '@authenticated',\n DEPRECATED_ANONYMOUS: '@anonymous',\n};\n\nexport const PACKAGE_ACCESS = {\n SCOPE: '@*/*',\n ALL: '**',\n};\n\nexport function normalizeUserList(groupsList: any): any {\n const result: any[] = [];\n if (_.isNil(groupsList)) {\n return result;\n }\n\n // if it's a string, split it to array\n if (_.isString(groupsList)) {\n const groupsArray = groupsList.split(/\\s+/);\n\n result.push(groupsArray);\n } else if (Array.isArray(groupsList)) {\n result.push(groupsList);\n } else {\n throw ErrorCode.getInternalError(\n 'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)\n );\n }\n\n return _.flatten(result);\n}\n\nexport function getMatchedPackagesSpec(pkgName: string, packages: PackageList): MatchedPackage {\n for (const i in packages) {\n if (minimatch.makeRe(i).exec(pkgName)) {\n return packages[i];\n }\n }\n return;\n}\n\nexport function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {\n const normalizedPkgs: LegacyPackageList = { ...packages };\n if (_.isNil(normalizedPkgs['**'])) {\n normalizedPkgs['**'] = {\n access: [],\n publish: [],\n unpublish: [],\n proxy: [],\n };\n }\n\n for (const pkg in packages) {\n if (Object.prototype.hasOwnProperty.call(packages, pkg)) {\n const packageAccess = packages[pkg];\n const isInvalid = _.isObject(packageAccess) && _.isArray(packageAccess) === false;\n assert(isInvalid, `CONFIG: bad \"'${pkg}'\" package description (object expected)`);\n\n normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);\n normalizedPkgs[pkg].publish = normalizeUserList(packageAccess.publish);\n normalizedPkgs[pkg].proxy = normalizeUserList(packageAccess.proxy);\n // if unpublish is not defined, we set to false to fallback in publish access\n normalizedPkgs[pkg].unpublish = _.isUndefined(packageAccess.unpublish)\n ? false\n : normalizeUserList(packageAccess.unpublish);\n }\n }\n\n return normalizedPkgs;\n}\n"],"file":"package-access.js"}
1
+ {"version":3,"sources":["../src/package-access.ts"],"names":["ROLES","$ALL","ALL","$AUTH","$ANONYMOUS","DEPRECATED_ALL","DEPRECATED_AUTH","DEPRECATED_ANONYMOUS","PACKAGE_ACCESS","SCOPE","normalizeUserList","groupsList","result","_","isNil","isString","groupsArray","split","push","Array","isArray","errorUtils","getInternalError","JSON","stringify","flatten","normalisePackageAccess","packages","normalizedPkgs","access","publish","unpublish","proxy","pkg","Object","prototype","hasOwnProperty","call","packageAccess","isInvalid","isObject","isUndefined"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;AAOO,MAAMA,KAAK,GAAG;AACnBC,EAAAA,IAAI,EAAE,MADa;AAEnBC,EAAAA,GAAG,EAAE,KAFc;AAGnBC,EAAAA,KAAK,EAAE,gBAHY;AAInBC,EAAAA,UAAU,EAAE,YAJO;AAKnBC,EAAAA,cAAc,EAAE,MALG;AAMnBC,EAAAA,eAAe,EAAE,gBANE;AAOnBC,EAAA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CM,GAA/C,CAAJ,EAAyD;AACvD,YAAMK,aAAa,GAAGX,QAAQ,CAACM,GAAD,CAA9B;AACA,YAAMM,SAAS,GAAG1B,gBAAE2B,QAAF,CAAWF,aAAX,KAA6BzB,gBAAEO,OAAF,CAAUkB,aAAV,MAA6B,KAA5E;AACA,2BAAOC,SAAP,EAAmB,iBAAgBN,GAAI,0CAAvC;AAEAL,MAAAA,cAAc,CAACK,GAAD,CAAd,CAAoBJ,MAApB,GAA6BnB,iBAAiB,CAAC4B,aAAa,CAACT,MAAf,CAA9C;AACAD,MAAAA,cAAc,CAACK,GAAD,CAAd,CAAoBH,OAApB,GAA8BpB,iBAAiB,CAAC4B,aAAa,CAACR,OAAf,CAA/C;AACAF,MAAAA,cAAc,CAACK,GAAD,CAAd,CAAoBD,KAApB,GAA4BtB,iBAAiB,CAAC4B,aAAa,CAACN,KAAf,CAA7C,CAPuD,CAQvD;;AACAJ,MAAAA,cAAc,CAACK,GAAD,CAAd,CAAoBF,SAApB,GAAgClB,gBAAE4B,WAAF,CAAcH,aAAa,CAACP,SAA5B,IAC5B,KAD4B,GAE5BrB,iBAAiB,CAAC4B,aAAa,CAACP,SAAf,CAFrB;AAGD;AACF;;AAED,SAAOH,cAAP;AACD","sourcesContent":["import assert from 'assert';\nimport _ from 'lodash';\n\nimport { errorUtils } from '@verdaccio/core';\nimport { PackageAccess } from '@verdaccio/types';\n\nexport interface LegacyPackageList {\n [key: string]: PackageAccess;\n}\n\nexport const ROLES = {\n $ALL: '$all',\n ALL: 'all',\n $AUTH: '$authenticated',\n $ANONYMOUS: '$anonymous',\n DEPRECATED_ALL: '@all',\n DEPRECATED_AUTH: '@authenticated',\n DEPRECATED_ANONYMOUS: '@anonymous',\n};\n\nexport const PACKAGE_ACCESS = {\n SCOPE: '@*/*',\n ALL: '**',\n};\n\nexport function normalizeUserList(groupsList: any): any {\n const result: any[] = [];\n if (_.isNil(groupsList)) {\n return result;\n }\n\n // if it's a string, split it to array\n if (_.isString(groupsList)) {\n const groupsArray = groupsList.split(/\\s+/);\n\n result.push(groupsArray);\n } else if (Array.isArray(groupsList)) {\n result.push(groupsList);\n } else {\n throw errorUtils.getInternalError(\n 'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)\n );\n }\n\n return _.flatten(result);\n}\n\nexport function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {\n const normalizedPkgs: LegacyPackageList = { ...packages };\n if (_.isNil(normalizedPkgs['**'])) {\n normalizedPkgs['**'] = {\n access: [],\n publish: [],\n unpublish: [],\n proxy: [],\n };\n }\n\n for (const pkg in packages) {\n if (Object.prototype.hasOwnProperty.call(packages, pkg)) {\n const packageAccess = packages[pkg];\n const isInvalid = _.isObject(packageAccess) && _.isArray(packageAccess) === false;\n assert(isInvalid, `CONFIG: bad \"'${pkg}'\" package description (object expected)`);\n\n normalizedPkgs[pkg].access = normalizeUserList(packageAccess.access);\n normalizedPkgs[pkg].publish = normalizeUserList(packageAccess.publish);\n normalizedPkgs[pkg].proxy = normalizeUserList(packageAccess.proxy);\n // if unpublish is not defined, we set to false to fallback in publish access\n normalizedPkgs[pkg].unpublish = _.isUndefined(packageAccess.unpublish)\n ? false\n : normalizeUserList(packageAccess.unpublish);\n }\n }\n\n return normalizedPkgs;\n}\n"],"file":"package-access.js"}
package/build/parse.d.ts CHANGED
@@ -1,2 +1,6 @@
1
1
  import { ConfigRuntime } from '@verdaccio/types';
2
+ /**
3
+ * Parse a config file from yaml to JSON.
4
+ * @param configPath the absolute path of the configuration file
5
+ */
2
6
  export declare function parseConfigFile(configPath: string): ConfigRuntime;
package/build/parse.js CHANGED
@@ -9,16 +9,22 @@ var _fs = _interopRequireDefault(require("fs"));
9
9
 
10
10
  var _jsYaml = _interopRequireDefault(require("js-yaml"));
11
11
 
12
- var _commonsApi = require("@verdaccio/commons-api");
12
+ var _core = require("@verdaccio/core");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
+ /**
17
+ * Parse a config file from yaml to JSON.
18
+ * @param configPath the absolute path of the configuration file
19
+ */
16
20
  function parseConfigFile(configPath) {
17
21
  try {
18
22
  if (/\.ya?ml$/i.test(configPath)) {
19
23
  const yamlConfig = _jsYaml.default.safeLoad(_fs.default.readFileSync(configPath, 'utf8'));
20
24
 
21
25
  return Object.assign({}, yamlConfig, {
26
+ configPath,
27
+ // @deprecated use configPath instead
22
28
  config_path: configPath
23
29
  });
24
30
  }
@@ -26,14 +32,16 @@ function parseConfigFile(configPath) {
26
32
  const jsonConfig = require(configPath);
27
33
 
28
34
  return Object.assign({}, jsonConfig, {
35
+ configPath,
36
+ // @deprecated use configPath instead
29
37
  config_path: configPath
30
38
  });
31
39
  } catch (e) {
32
40
  if (e.code !== 'MODULE_NOT_FOUND') {
33
- e.message = _commonsApi.APP_ERROR.CONFIG_NOT_VALID;
41
+ e.message = _core.APP_ERROR.CONFIG_NOT_VALID;
34
42
  }
35
43
 
36
- throw new Error(e);
44
+ throw e;
37
45
  }
38
46
  }
39
47
  //# sourceMappingURL=parse.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/parse.ts"],"names":["parseConfigFile","configPath","test","yamlConfig","YAML","safeLoad","fs","readFileSync","Object","assign","config_path","jsonConfig","require","e","code","message","APP_ERROR","CONFIG_NOT_VALID","Error"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAGO,SAASA,eAAT,CAAyBC,UAAzB,EAA4D;AACjE,MAAI;AACF,QAAI,YAAYC,IAAZ,CAAiBD,UAAjB,CAAJ,EAAkC;AAChC,YAAME,UAAU,GAAGC,gBAAKC,QAAL,CAAcC,YAAGC,YAAH,CAAgBN,UAAhB,EAA4B,MAA5B,CAAd,CAAnB;;AACA,aAAOO,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBN,UAAlB,EAA8B;AACnCO,QAAAA,WAAW,EAAET;AADsB,OAA9B,CAAP;AAGD;;AAED,UAAMU,UAAU,GAAGC,OAAO,CAACX,UAAD,CAA1B;;AACA,WAAOO,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBE,UAAlB,EAA8B;AACnCD,MAAAA,WAAW,EAAET;AADsB,KAA9B,CAAP;AAGD,GAZD,CAYE,OAAOY,CAAP,EAAe;AACf,QAAIA,CAAC,CAACC,IAAF,KAAW,kBAAf,EAAmC;AACjCD,MAAAA,CAAC,CAACE,OAAF,GAAYC,sBAAUC,gBAAtB;AACD;;AAED,UAAM,IAAIC,KAAJ,CAAUL,CAAV,CAAN;AACD;AACF","sourcesContent":["import fs from 'fs';\nimport YAML from 'js-yaml';\nimport { APP_ERROR } from '@verdaccio/commons-api';\nimport { ConfigRuntime, ConfigYaml } from '@verdaccio/types';\n\nexport function parseConfigFile(configPath: string): ConfigRuntime {\n try {\n if (/\\.ya?ml$/i.test(configPath)) {\n const yamlConfig = YAML.safeLoad(fs.readFileSync(configPath, 'utf8')) as ConfigYaml;\n return Object.assign({}, yamlConfig, {\n config_path: configPath,\n });\n }\n\n const jsonConfig = require(configPath) as ConfigYaml;\n return Object.assign({}, jsonConfig, {\n config_path: configPath,\n });\n } catch (e: any) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n e.message = APP_ERROR.CONFIG_NOT_VALID;\n }\n\n throw new Error(e);\n }\n}\n"],"file":"parse.js"}
1
+ {"version":3,"sources":["../src/parse.ts"],"names":["parseConfigFile","configPath","test","yamlConfig","YAML","safeLoad","fs","readFileSync","Object","assign","config_path","jsonConfig","require","e","code","message","APP_ERROR","CONFIG_NOT_VALID"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;AAGA;AACA;AACA;AACA;AACO,SAASA,eAAT,CAAyBC,UAAzB,EAA4D;AACjE,MAAI;AACF,QAAI,YAAYC,IAAZ,CAAiBD,UAAjB,CAAJ,EAAkC;AAChC,YAAME,UAAU,GAAGC,gBAAKC,QAAL,CAAcC,YAAGC,YAAH,CAAgBN,UAAhB,EAA4B,MAA5B,CAAd,CAAnB;;AACA,aAAOO,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBN,UAAlB,EAA8B;AACnCF,QAAAA,UADmC;AAEnC;AACAS,QAAAA,WAAW,EAAET;AAHsB,OAA9B,CAAP;AAKD;;AAED,UAAMU,UAAU,GAAGC,OAAO,CAACX,UAAD,CAA1B;;AACA,WAAOO,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBE,UAAlB,EAA8B;AACnCV,MAAAA,UADmC;AAEnC;AACAS,MAAAA,WAAW,EAAET;AAHsB,KAA9B,CAAP;AAKD,GAhBD,CAgBE,OAAOY,CAAP,EAAe;AACf,QAAIA,CAAC,CAACC,IAAF,KAAW,kBAAf,EAAmC;AACjCD,MAAAA,CAAC,CAACE,OAAF,GAAYC,gBAAUC,gBAAtB;AACD;;AAED,UAAMJ,CAAN;AACD;AACF","sourcesContent":["import fs from 'fs';\nimport YAML from 'js-yaml';\n\nimport { APP_ERROR } from '@verdaccio/core';\nimport { ConfigRuntime, ConfigYaml } from '@verdaccio/types';\n\n/**\n * Parse a config file from yaml to JSON.\n * @param configPath the absolute path of the configuration file\n */\nexport function parseConfigFile(configPath: string): ConfigRuntime {\n try {\n if (/\\.ya?ml$/i.test(configPath)) {\n const yamlConfig = YAML.safeLoad(fs.readFileSync(configPath, 'utf8')) as ConfigYaml;\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n }\n\n const jsonConfig = require(configPath) as ConfigYaml;\n return Object.assign({}, jsonConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n e.message = APP_ERROR.CONFIG_NOT_VALID;\n }\n\n throw e;\n }\n}\n"],"file":"parse.js"}
package/build/token.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.generateRandomSecretKey = generateRandomSecretKey;
7
6
  exports.TOKEN_VALID_LENGTH = void 0;
7
+ exports.generateRandomSecretKey = generateRandomSecretKey;
8
8
 
9
9
  var _crypto = require("crypto");
10
10
 
@@ -3,8 +3,5 @@ export declare const DEFAULT_REGISTRY = "https://registry.npmjs.org";
3
3
  export declare const DEFAULT_UPLINK = "npmjs";
4
4
  export declare function uplinkSanityCheck(uplinks: UpLinksConfList, users?: any): UpLinksConfList;
5
5
  export declare function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList;
6
- /**
7
- * Check whether an uplink can proxy
8
- */
9
6
  export declare function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean;
10
7
  export declare function sanityCheckNames(item: string, users: any): any;
package/build/uplinks.js CHANGED
@@ -3,17 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.uplinkSanityCheck = uplinkSanityCheck;
7
- exports.sanityCheckUplinksProps = sanityCheckUplinksProps;
6
+ exports.DEFAULT_UPLINK = exports.DEFAULT_REGISTRY = void 0;
8
7
  exports.hasProxyTo = hasProxyTo;
9
8
  exports.sanityCheckNames = sanityCheckNames;
10
- exports.DEFAULT_UPLINK = exports.DEFAULT_REGISTRY = void 0;
9
+ exports.sanityCheckUplinksProps = sanityCheckUplinksProps;
10
+ exports.uplinkSanityCheck = uplinkSanityCheck;
11
11
 
12
12
  var _assert = _interopRequireDefault(require("assert"));
13
13
 
14
14
  var _lodash = _interopRequireDefault(require("lodash"));
15
15
 
16
- var _packageAccess = require("./package-access");
16
+ var _utils = require("@verdaccio/utils");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
@@ -60,13 +60,9 @@ function sanityCheckUplinksProps(configUpLinks) {
60
60
 
61
61
  return uplinks;
62
62
  }
63
- /**
64
- * Check whether an uplink can proxy
65
- */
66
-
67
63
 
68
64
  function hasProxyTo(pkg, upLink, packages) {
69
- const matchedPkg = (0, _packageAccess.getMatchedPackagesSpec)(pkg, packages);
65
+ const matchedPkg = (0, _utils.getMatchedPackagesSpec)(pkg, packages);
70
66
  const proxyList = typeof matchedPkg !== 'undefined' ? matchedPkg.proxy : [];
71
67
 
72
68
  if (proxyList) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/uplinks.ts"],"names":["DEFAULT_REGISTRY","DEFAULT_UPLINK","BLACKLIST","all","anonymous","undefined","owner","none","uplinkSanityCheck","uplinks","users","newUplinks","_","clone","newUsers","uplink","Object","prototype","hasOwnProperty","call","isNil","cache","sanityCheckNames","sanityCheckUplinksProps","configUpLinks","url","isString","replace","hasProxyTo","pkg","upLink","packages","matchedPkg","proxyList","proxy","some","curr","item","match"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AAEA;;;;AAGO,MAAMA,gBAAgB,GAAG,4BAAzB;;AACA,MAAMC,cAAc,GAAG,OAAvB;;AAEP,MAAMC,SAAS,GAAG;AAChBC,EAAAA,GAAG,EAAE,IADW;AAEhBC,EAAAA,SAAS,EAAE,IAFK;AAGhBC,EAAAA,SAAS,EAAE,IAHK;AAIhBC,EAAAA,KAAK,EAAE,IAJS;AAKhBC,EAAAA,IAAI,EAAE;AALU,CAAlB;;AAQO,SAASC,iBAAT,CACLC,OADK,EAELC,KAAU,GAAGR,SAFR,EAGY;AACjB,QAAMS,UAAU,GAAGC,gBAAEC,KAAF,CAAQJ,OAAR,CAAnB;;AACA,MAAIK,QAAQ,GAAGF,gBAAEC,KAAF,CAAQH,KAAR,CAAf;;AAEA,OAAK,MAAMK,MAAX,IAAqBJ,UAArB,EAAiC;AAC/B,QAAIK,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCR,UAArC,EAAiDI,MAAjD,CAAJ,EAA8D;AAC5D,UAAIH,gBAAEQ,KAAF,CAAQT,UAAU,CAACI,MAAD,CAAV,CAAmBM,KAA3B,CAAJ,EAAuC;AACrCV,QAAAA,UAAU,CAACI,MAAD,CAAV,CAAmBM,KAAnB,GAA2B,IAA3B;AACD;;AACDP,MAAAA,QAAQ,GAAG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A,IAAI,KAAK,WAHX,IAIEA,IAAI,KAAK,MALb,EAME,mCAAmCA,IANrC;AAQA,uBAAO,CAACA,IAAI,CAACC,KAAL,CAAW,IAAX,CAAR,EAA0B,kCAAkCD,IAA5D;AACA,uBAAOzB,gBAAEQ,KAAF,CAAQV,KAAK,CAAC2B,IAAD,CAAb,CAAP,EAA6B,oCAAoCA,IAAjE;AACA3B,EAAAA,KAAK,CAAC2B,IAAD,CAAL,GAAc,IAAd;AAEA,SAAO3B,KAAP;AACD","sourcesContent":["import assert from 'assert';\nimport { PackageList, UpLinksConfList } from '@verdaccio/types';\nimport _ from 'lodash';\n\nimport { getMatchedPackagesSpec } from './package-access';\nimport { MatchedPackage } from './config';\n\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\n\nconst BLACKLIST = {\n all: true,\n anonymous: true,\n undefined: true,\n owner: true,\n none: true,\n};\n\nexport function uplinkSanityCheck(\n uplinks: UpLinksConfList,\n users: any = BLACKLIST\n): UpLinksConfList {\n const newUplinks = _.clone(uplinks);\n let newUsers = _.clone(users);\n\n for (const uplink in newUplinks) {\n if (Object.prototype.hasOwnProperty.call(newUplinks, uplink)) {\n if (_.isNil(newUplinks[uplink].cache)) {\n newUplinks[uplink].cache = true;\n }\n newUsers = sanityCheckNames(uplink, newUsers);\n }\n }\n\n return newUplinks;\n}\n\nexport function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList {\n const uplinks = _.clone(configUpLinks);\n\n for (const uplink in uplinks) {\n if (Object.prototype.hasOwnProperty.call(uplinks, uplink)) {\n assert(uplinks[uplink].url, 'CONFIG: no url for uplink: ' + uplink);\n assert(_.isString(uplinks[uplink].url), 'CONFIG: wrong url format for uplink: ' + uplink);\n uplinks[uplink].url = uplinks[uplink].url.replace(/\\/$/, '');\n }\n }\n\n return uplinks;\n}\n\n/**\n * Check whether an uplink can proxy\n */\nexport function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {\n const matchedPkg: MatchedPackage = getMatchedPackagesSpec(pkg, packages);\n const proxyList = typeof matchedPkg !== 'undefined' ? matchedPkg.proxy : [];\n if (proxyList) {\n return proxyList.some((curr) => upLink === curr);\n }\n\n return false;\n}\n\nexport function sanityCheckNames(item: string, users: any): any {\n assert(\n item !== 'all' &&\n item !== 'owner' &&\n item !== 'anonymous' &&\n item !== 'undefined' &&\n item !== 'none',\n 'CONFIG: reserved uplink name: ' + item\n );\n assert(!item.match(/\\s/), 'CONFIG: invalid uplink name: ' + item);\n assert(_.isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);\n users[item] = true;\n\n return users;\n}\n"],"file":"uplinks.js"}
1
+ {"version":3,"sources":["../src/uplinks.ts"],"names":["DEFAULT_REGISTRY","DEFAULT_UPLINK","BLACKLIST","all","anonymous","undefined","owner","none","uplinkSanityCheck","uplinks","users","newUplinks","_","clone","newUsers","uplink","Object","prototype","hasOwnProperty","call","isNil","cache","sanityCheckNames","sanityCheckUplinksProps","configUpLinks","url","isString","replace","hasProxyTo","pkg","upLink","packages","matchedPkg","proxyList","proxy","some","curr","item","match"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAGA;;;;AAEO,MAAMA,gBAAgB,GAAG,4BAAzB;;AACA,MAAMC,cAAc,GAAG,OAAvB;;AAEP,MAAMC,SAAS,GAAG;AAChBC,EAAAA,GAAG,EAAE,IADW;AAEhBC,EAAAA,SAAS,EAAE,IAFK;AAGhBC,EAAAA,SAAS,EAAE,IAHK;AAIhBC,EAAAA,KAAK,EAAE,IAJS;AAKhBC,EAAAA,IAAI,EAAE;AALU,CAAlB;;AAQO,SAASC,iBAAT,CACLC,OADK,EAELC,KAAU,GAAGR,SAFR,EAGY;AACjB,QAAMS,UAAU,GAAGC,gBAAEC,KAAF,CAAQJ,OAAR,CAAnB;;AACA,MAAIK,QAAQ,GAAGF,gBAAEC,KAAF,CAAQH,KAAR,CAAf;;AAEA,OAAK,MAAMK,MAAX,IAAqBJ,U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A/C,GAAuD,EAAzE;;AACA,MAAID,SAAJ,EAAe;AACb,WAAOA,SAAS,CAACE,IAAV,CAAgBC,IAAD,IAAUN,MAAM,KAAKM,IAApC,CAAP;AACD;;AAED,SAAO,KAAP;AACD;;AAEM,SAASd,gBAAT,CAA0Be,IAA1B,EAAwC3B,KAAxC,EAAyD;AAC9D,uBACE2B,IAAI,KAAK,KAAT,IACEA,IAAI,KAAK,OADX,IAEEA,IAAI,KAAK,WAFX,IAGEA,IAAI,KAAK,WAHX,IAIEA,IAAI,KAAK,MALb,EAME,mCAAmCA,IANrC;AAQA,uBAAO,CAACA,IAAI,CAACC,KAAL,CAAW,IAAX,CAAR,EAA0B,kCAAkCD,IAA5D;AACA,uBAAOzB,gBAAEQ,KAAF,CAAQV,KAAK,CAAC2B,IAAD,CAAb,CAAP,EAA6B,oCAAoCA,IAAjE;AACA3B,EAAAA,KAAK,CAAC2B,IAAD,CAAL,GAAc,IAAd;AAEA,SAAO3B,KAAP;AACD","sourcesContent":["import assert from 'assert';\nimport _ from 'lodash';\n\nimport { PackageList, UpLinksConfList } from '@verdaccio/types';\nimport { getMatchedPackagesSpec } from '@verdaccio/utils';\n\nexport const DEFAULT_REGISTRY = 'https://registry.npmjs.org';\nexport const DEFAULT_UPLINK = 'npmjs';\n\nconst BLACKLIST = {\n all: true,\n anonymous: true,\n undefined: true,\n owner: true,\n none: true,\n};\n\nexport function uplinkSanityCheck(\n uplinks: UpLinksConfList,\n users: any = BLACKLIST\n): UpLinksConfList {\n const newUplinks = _.clone(uplinks);\n let newUsers = _.clone(users);\n\n for (const uplink in newUplinks) {\n if (Object.prototype.hasOwnProperty.call(newUplinks, uplink)) {\n if (_.isNil(newUplinks[uplink].cache)) {\n newUplinks[uplink].cache = true;\n }\n newUsers = sanityCheckNames(uplink, newUsers);\n }\n }\n\n return newUplinks;\n}\n\nexport function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinksConfList {\n const uplinks = _.clone(configUpLinks);\n\n for (const uplink in uplinks) {\n if (Object.prototype.hasOwnProperty.call(uplinks, uplink)) {\n assert(uplinks[uplink].url, 'CONFIG: no url for uplink: ' + uplink);\n assert(_.isString(uplinks[uplink].url), 'CONFIG: wrong url format for uplink: ' + uplink);\n uplinks[uplink].url = uplinks[uplink].url.replace(/\\/$/, '');\n }\n }\n\n return uplinks;\n}\n\nexport function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {\n const matchedPkg = getMatchedPackagesSpec(pkg, packages);\n const proxyList = typeof matchedPkg !== 'undefined' ? matchedPkg.proxy : [];\n if (proxyList) {\n return proxyList.some((curr) => upLink === curr);\n }\n\n return false;\n}\n\nexport function sanityCheckNames(item: string, users: any): any {\n assert(\n item !== 'all' &&\n item !== 'owner' &&\n item !== 'anonymous' &&\n item !== 'undefined' &&\n item !== 'none',\n 'CONFIG: reserved uplink name: ' + item\n );\n assert(!item.match(/\\s/), 'CONFIG: invalid uplink name: ' + item);\n assert(_.isNil(users[item]), 'CONFIG: duplicate uplink name: ' + item);\n users[item] = true;\n\n return users;\n}\n"],"file":"uplinks.js"}
package/build/user.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createRemoteUser = createRemoteUser;
7
6
  exports.createAnonymousRemoteUser = createAnonymousRemoteUser;
7
+ exports.createRemoteUser = createRemoteUser;
8
8
  exports.defaultNonLoggedUserRoles = exports.defaultLoggedUserRoles = void 0;
9
9
 
10
10
  var _packageAccess = require("./package-access");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/config",
3
- "version": "6.0.0-6-next.7",
3
+ "version": "6.0.0-6-next.11",
4
4
  "description": "logger",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -26,17 +26,17 @@
26
26
  "verdaccio"
27
27
  ],
28
28
  "engines": {
29
- "node": ">=10",
29
+ "node": ">=14",
30
30
  "npm": ">=6"
31
31
  },
32
32
  "dependencies": {
33
- "@verdaccio/commons-api": "11.0.0-alpha.3",
34
- "@verdaccio/utils": "6.0.0-6-next.5",
33
+ "@verdaccio/core": "6.0.0-6-next.3",
34
+ "@verdaccio/utils": "6.0.0-6-next.9",
35
35
  "debug": "4.3.2",
36
36
  "js-yaml": "3.14.1",
37
37
  "lodash": "4.17.21",
38
38
  "minimatch": "3.0.4",
39
- "yup": "0.32.9"
39
+ "yup": "0.32.11"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/minimatch": "3.0.5",
@@ -100,11 +100,6 @@ logs:
100
100
  # { type: file, path: verdaccio.log, level: http}
101
101
  # FIXME: this should be documented
102
102
  # More info about log rotation https://github.com/pinojs/pino/blob/master/docs/help.md#log-rotation
103
- flags:
104
- # support for npm token command
105
- token: false
106
- # support for the new v1 search endpoint, functional by incomplete read more on ticket 1732
107
- search: false
108
103
 
109
104
  # This affect the web and api (not developed yet)
110
105
  i18n:
@@ -1,10 +1,11 @@
1
+ import buildDebug from 'debug';
1
2
  import fs from 'fs';
2
- import path from 'path';
3
3
  import _ from 'lodash';
4
- import buildDebug from 'debug';
4
+ import path from 'path';
5
+
6
+ import { CHARACTER_ENCODING } from '@verdaccio/core';
5
7
 
6
- import { CHARACTER_ENCODING } from '@verdaccio/commons-api';
7
- import { folderExists, fileExists } from './config-utils';
8
+ import { fileExists, folderExists } from './config-utils';
8
9
 
9
10
  const CONFIG_FILE = 'config.yaml';
10
11
  const XDG = 'xdg';
package/src/config.ts CHANGED
@@ -1,31 +1,28 @@
1
1
  import assert from 'assert';
2
- import _ from 'lodash';
3
2
  import buildDebug from 'debug';
3
+ import _ from 'lodash';
4
4
 
5
- import { generateRandomHexString, isObject } from '@verdaccio/utils';
6
- import { APP_ERROR } from '@verdaccio/commons-api';
5
+ import { APP_ERROR } from '@verdaccio/core';
7
6
  import {
8
- PackageList,
9
7
  Config as AppConfig,
8
+ AuthConf,
10
9
  ConfigRuntime,
11
- Security,
12
10
  PackageAccess,
11
+ PackageList,
12
+ Security,
13
13
  ServerSettingsConf,
14
- AuthConf,
15
14
  } from '@verdaccio/types';
15
+ import { generateRandomHexString, getMatchedPackagesSpec, isObject } from '@verdaccio/utils';
16
16
 
17
- import { generateRandomSecretKey } from './token';
18
- import { getMatchedPackagesSpec, normalisePackageAccess } from './package-access';
19
- import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';
20
- import { defaultSecurity } from './security';
21
17
  import { getUserAgent } from './agent';
18
+ import { normalisePackageAccess } from './package-access';
19
+ import { defaultSecurity } from './security';
22
20
  import serverSettings from './serverSettings';
21
+ import { generateRandomSecretKey } from './token';
22
+ import { sanityCheckUplinksProps, uplinkSanityCheck } from './uplinks';
23
23
 
24
24
  const strategicConfigProps = ['uplinks', 'packages'];
25
25
  const allowedEnvConfig = ['http_proxy', 'https_proxy', 'no_proxy'];
26
-
27
- export type MatchedPackage = PackageAccess | void;
28
-
29
26
  const debug = buildDebug('verdaccio:config');
30
27
 
31
28
  export const WEB_TITLE = 'Verdaccio';
@@ -99,7 +96,8 @@ class Config implements AppConfig {
99
96
  /**
100
97
  * Check for package spec
101
98
  */
102
- public getMatchedPackagesSpec(pkgName: string): MatchedPackage {
99
+ public getMatchedPackagesSpec(pkgName: string): PackageAccess | void {
100
+ // TODO: remove this method and replace by library utils
103
101
  return getMatchedPackagesSpec(pkgName, this.packages);
104
102
  }
105
103
 
@@ -1,10 +1,8 @@
1
1
  import assert from 'assert';
2
2
  import _ from 'lodash';
3
- import minimatch from 'minimatch';
4
3
 
5
- import { PackageList, PackageAccess } from '@verdaccio/types';
6
- import { ErrorCode } from '@verdaccio/utils';
7
- import { MatchedPackage } from './config';
4
+ import { errorUtils } from '@verdaccio/core';
5
+ import { PackageAccess } from '@verdaccio/types';
8
6
 
9
7
  export interface LegacyPackageList {
10
8
  [key: string]: PackageAccess;
@@ -39,7 +37,7 @@ export function normalizeUserList(groupsList: any): any {
39
37
  } else if (Array.isArray(groupsList)) {
40
38
  result.push(groupsList);
41
39
  } else {
42
- throw ErrorCode.getInternalError(
40
+ throw errorUtils.getInternalError(
43
41
  'CONFIG: bad package acl (array or string expected): ' + JSON.stringify(groupsList)
44
42
  );
45
43
  }
@@ -47,15 +45,6 @@ export function normalizeUserList(groupsList: any): any {
47
45
  return _.flatten(result);
48
46
  }
49
47
 
50
- export function getMatchedPackagesSpec(pkgName: string, packages: PackageList): MatchedPackage {
51
- for (const i in packages) {
52
- if (minimatch.makeRe(i).exec(pkgName)) {
53
- return packages[i];
54
- }
55
- }
56
- return;
57
- }
58
-
59
48
  export function normalisePackageAccess(packages: LegacyPackageList): LegacyPackageList {
60
49
  const normalizedPkgs: LegacyPackageList = { ...packages };
61
50
  if (_.isNil(normalizedPkgs['**'])) {
package/src/parse.ts CHANGED
@@ -1,19 +1,28 @@
1
1
  import fs from 'fs';
2
2
  import YAML from 'js-yaml';
3
- import { APP_ERROR } from '@verdaccio/commons-api';
3
+
4
+ import { APP_ERROR } from '@verdaccio/core';
4
5
  import { ConfigRuntime, ConfigYaml } from '@verdaccio/types';
5
6
 
7
+ /**
8
+ * Parse a config file from yaml to JSON.
9
+ * @param configPath the absolute path of the configuration file
10
+ */
6
11
  export function parseConfigFile(configPath: string): ConfigRuntime {
7
12
  try {
8
13
  if (/\.ya?ml$/i.test(configPath)) {
9
14
  const yamlConfig = YAML.safeLoad(fs.readFileSync(configPath, 'utf8')) as ConfigYaml;
10
15
  return Object.assign({}, yamlConfig, {
16
+ configPath,
17
+ // @deprecated use configPath instead
11
18
  config_path: configPath,
12
19
  });
13
20
  }
14
21
 
15
22
  const jsonConfig = require(configPath) as ConfigYaml;
16
23
  return Object.assign({}, jsonConfig, {
24
+ configPath,
25
+ // @deprecated use configPath instead
17
26
  config_path: configPath,
18
27
  });
19
28
  } catch (e: any) {
@@ -21,6 +30,6 @@ export function parseConfigFile(configPath: string): ConfigRuntime {
21
30
  e.message = APP_ERROR.CONFIG_NOT_VALID;
22
31
  }
23
32
 
24
- throw new Error(e);
33
+ throw e;
25
34
  }
26
35
  }
package/src/uplinks.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import assert from 'assert';
2
- import { PackageList, UpLinksConfList } from '@verdaccio/types';
3
2
  import _ from 'lodash';
4
3
 
5
- import { getMatchedPackagesSpec } from './package-access';
6
- import { MatchedPackage } from './config';
4
+ import { PackageList, UpLinksConfList } from '@verdaccio/types';
5
+ import { getMatchedPackagesSpec } from '@verdaccio/utils';
7
6
 
8
7
  export const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
9
8
  export const DEFAULT_UPLINK = 'npmjs';
@@ -49,11 +48,8 @@ export function sanityCheckUplinksProps(configUpLinks: UpLinksConfList): UpLinks
49
48
  return uplinks;
50
49
  }
51
50
 
52
- /**
53
- * Check whether an uplink can proxy
54
- */
55
51
  export function hasProxyTo(pkg: string, upLink: string, packages: PackageList): boolean {
56
- const matchedPkg: MatchedPackage = getMatchedPackagesSpec(pkg, packages);
52
+ const matchedPkg = getMatchedPackagesSpec(pkg, packages);
57
53
  const proxyList = typeof matchedPkg !== 'undefined' ? matchedPkg.proxy : [];
58
54
  if (proxyList) {
59
55
  return proxyList.some((curr) => upLink === curr);
@@ -12,13 +12,13 @@ describe('Package access utilities', () => {
12
12
  test('parse invalid.json', () => {
13
13
  expect(function () {
14
14
  parseConfigFile(parseConfigurationFile('invalid.json'));
15
- }).toThrow(/Error/);
15
+ }).toThrow(/CONFIG: it does not look like a valid config file/);
16
16
  });
17
17
 
18
18
  test('parse not-exists.json', () => {
19
19
  expect(function () {
20
20
  parseConfigFile(parseConfigurationFile('not-exists.json'));
21
- }).toThrow(/Error/);
21
+ }).toThrow(/Cannot find module/);
22
22
  });
23
23
  });
24
24
 
@@ -32,13 +32,13 @@ describe('Package access utilities', () => {
32
32
  test('parse invalid.js', () => {
33
33
  expect(function () {
34
34
  parseConfigFile(parseConfigurationFile('invalid.js'));
35
- }).toThrow(/Error/);
35
+ }).toThrow(/CONFIG: it does not look like a valid config file/);
36
36
  });
37
37
 
38
38
  test('parse not-exists.js', () => {
39
39
  expect(function () {
40
40
  parseConfigFile(parseConfigurationFile('not-exists.js'));
41
- }).toThrow(/Error/);
41
+ }).toThrow(/Cannot find module/);
42
42
  });
43
43
  });
44
44
  });
@@ -1,4 +1,5 @@
1
1
  import os from 'os';
2
+
2
3
  import { findConfigFile } from '../src/config-path';
3
4
 
4
5
  const mockmkDir = jest.fn();
@@ -96,9 +97,9 @@ describe('config-path', () => {
96
97
  delete process.env.XDG_CONFIG_HOME;
97
98
  delete process.env.HOME;
98
99
  process.env.APPDATA = '/app/data/';
99
- expect(findConfigFile()).toEqual('D:\\app\\data\\verdaccio\\config.yaml');
100
- expect(mockwriteFile).toHaveBeenCalledWith('D:\\app\\data\\verdaccio\\config.yaml');
101
- expect(mockmkDir).toHaveBeenCalledWith('D:\\app\\data\\verdaccio');
100
+ expect(findConfigFile()).toMatch('\\app\\data\\verdaccio\\config.yaml');
101
+ expect(mockwriteFile).toHaveBeenCalled();
102
+ expect(mockmkDir).toHaveBeenCalled();
102
103
  });
103
104
  }
104
105
  });
@@ -1,14 +1,14 @@
1
- import path from 'path';
2
1
  import _ from 'lodash';
2
+ import path from 'path';
3
3
 
4
4
  import {
5
5
  Config,
6
6
  DEFAULT_REGISTRY,
7
7
  DEFAULT_UPLINK,
8
- defaultSecurity,
9
- parseConfigFile,
10
8
  ROLES,
11
9
  WEB_TITLE,
10
+ defaultSecurity,
11
+ parseConfigFile,
12
12
  } from '../src';
13
13
  import { parseConfigurationFile } from './utils';
14
14
 
@@ -1,11 +1,7 @@
1
1
  import _ from 'lodash';
2
2
 
3
- import {
4
- getMatchedPackagesSpec,
5
- normalisePackageAccess,
6
- PACKAGE_ACCESS,
7
- } from '../src/package-access';
8
3
  import { parseConfigFile } from '../src';
4
+ import { PACKAGE_ACCESS, normalisePackageAccess } from '../src/package-access';
9
5
  import { parseConfigurationFile } from './utils';
10
6
 
11
7
  describe('Package access utilities', () => {
@@ -127,30 +123,4 @@ describe('Package access utilities', () => {
127
123
  expect(_.isArray(all.publish)).toBeTruthy();
128
124
  });
129
125
  });
130
-
131
- describe('getMatchedPackagesSpec', () => {
132
- test('should test basic config', () => {
133
- const { packages } = parseConfigFile(parseConfigurationFile('pkgs-custom'));
134
- // @ts-expect-error
135
- expect(getMatchedPackagesSpec('react', packages).proxy).toMatch('facebook');
136
- // @ts-expect-error
137
- expect(getMatchedPackagesSpec('angular', packages).proxy).toMatch('google');
138
- // @ts-expect-error
139
- expect(getMatchedPackagesSpec('vue', packages).proxy).toMatch('npmjs');
140
- // @ts-expect-error
141
- expect(getMatchedPackagesSpec('@scope/vue', packages).proxy).toMatch('npmjs');
142
- });
143
-
144
- test('should test no ** wildcard on config', () => {
145
- const { packages } = parseConfigFile(parseConfigurationFile('pkgs-nosuper-wildcard-custom'));
146
- // @ts-expect-error
147
- expect(getMatchedPackagesSpec('react', packages).proxy).toMatch('facebook');
148
- // @ts-expect-error
149
- expect(getMatchedPackagesSpec('angular', packages).proxy).toMatch('google');
150
- // @ts-expect-error
151
- expect(getMatchedPackagesSpec('@fake/angular', packages).proxy).toMatch('npmjs');
152
- expect(getMatchedPackagesSpec('vue', packages)).toBeUndefined();
153
- expect(getMatchedPackagesSpec('@scope/vue', packages)).toBeUndefined();
154
- });
155
- });
156
126
  });
@@ -1,4 +1,4 @@
1
- import { generateRandomSecretKey, TOKEN_VALID_LENGTH } from '../src/token';
1
+ import { TOKEN_VALID_LENGTH, generateRandomSecretKey } from '../src/token';
2
2
 
3
3
  test('token test valid length', () => {
4
4
  const token = generateRandomSecretKey();
@@ -1,5 +1,5 @@
1
- import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks';
2
1
  import { normalisePackageAccess, parseConfigFile } from '../src';
2
+ import { hasProxyTo, sanityCheckUplinksProps, uplinkSanityCheck } from '../src/uplinks';
3
3
  import { parseConfigurationFile } from './utils';
4
4
 
5
5
  describe('Uplinks Utilities', () => {
@@ -1,5 +1,5 @@
1
+ import { ROLES, createAnonymousRemoteUser, createRemoteUser } from '../src';
1
2
  import { spliceURL } from '../src/string';
2
- import { createAnonymousRemoteUser, createRemoteUser, ROLES } from '../src';
3
3
 
4
4
  describe('spliceURL', () => {
5
5
  test('should splice two strings and generate a url', () => {
package/tsconfig.json CHANGED
@@ -7,9 +7,6 @@
7
7
  "include": ["src/**/*.ts"],
8
8
  "exclude": ["src/**/*.test.ts"],
9
9
  "references": [
10
- {
11
- "path": "../core/commons-api"
12
- },
13
10
  {
14
11
  "path": "../utils"
15
12
  }
@@ -1,13 +0,0 @@
1
- packages:
2
- 'react':
3
- access: admin
4
- publish: admin
5
- proxy: facebook
6
- 'angular':
7
- access: admin
8
- publish: admin
9
- proxy: google
10
- '@fake/*':
11
- access: $all
12
- publish: $authenticated
13
- proxy: npmjs