@verdaccio/proxy 7.0.0-next-7.11 → 7.0.0-next-7.12
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 +8 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +11 -0
- package/build/index.js.map +1 -1
- package/build/uplink-util.d.ts +10 -0
- package/build/uplink-util.js +42 -0
- package/build/uplink-util.js.map +1 -0
- package/jest.config.js +3 -3
- package/package.json +5 -5
- package/src/index.ts +1 -0
- package/src/uplink-util.ts +42 -0
package/CHANGELOG.md
CHANGED
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -14,4 +14,15 @@ Object.keys(_proxy).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
var _uplinkUtil = require("./uplink-util");
|
|
18
|
+
Object.keys(_uplinkUtil).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _uplinkUtil[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _uplinkUtil[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
17
28
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_proxy","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../src/index.ts"],"sourcesContent":["export * from './proxy';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_proxy","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_uplinkUtil"],"sources":["../src/index.ts"],"sourcesContent":["export * from './proxy';\nexport * from './uplink-util';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,WAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,WAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,WAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Config, Logger, Manifest } from '@verdaccio/types';
|
|
2
|
+
import { IProxy } from './index';
|
|
3
|
+
export interface ProxyInstanceList {
|
|
4
|
+
[key: string]: IProxy;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Set up uplinks for each proxy configuration.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setupUpLinks(config: Config, logger: Logger): ProxyInstanceList;
|
|
10
|
+
export declare function updateVersionsHiddenUpLinkNext(manifest: Manifest, upLink: IProxy): Manifest;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setupUpLinks = setupUpLinks;
|
|
7
|
+
exports.updateVersionsHiddenUpLinkNext = updateVersionsHiddenUpLinkNext;
|
|
8
|
+
var _index = require("./index");
|
|
9
|
+
/**
|
|
10
|
+
* Set up uplinks for each proxy configuration.
|
|
11
|
+
*/
|
|
12
|
+
function setupUpLinks(config, logger) {
|
|
13
|
+
const uplinks = {};
|
|
14
|
+
for (const uplinkName in config.uplinks) {
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(config.uplinks, uplinkName)) {
|
|
16
|
+
// instance for each up-link definition
|
|
17
|
+
const proxy = new _index.ProxyStorage(config.uplinks[uplinkName], config, logger);
|
|
18
|
+
// TODO: review this can be inside ProxyStorage
|
|
19
|
+
proxy.upname = uplinkName;
|
|
20
|
+
uplinks[uplinkName] = proxy;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return uplinks;
|
|
24
|
+
}
|
|
25
|
+
function updateVersionsHiddenUpLinkNext(manifest, upLink) {
|
|
26
|
+
const {
|
|
27
|
+
versions
|
|
28
|
+
} = manifest;
|
|
29
|
+
const versionsList = Object.keys(versions);
|
|
30
|
+
if (versionsList.length === 0) {
|
|
31
|
+
return manifest;
|
|
32
|
+
}
|
|
33
|
+
for (const version of versionsList) {
|
|
34
|
+
// holds a "hidden" value to be used by the package storage.
|
|
35
|
+
versions[version][Symbol.for('__verdaccio_uplink')] = upLink.upname;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...manifest,
|
|
39
|
+
versions
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=uplink-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uplink-util.js","names":["_index","require","setupUpLinks","config","logger","uplinks","uplinkName","Object","prototype","hasOwnProperty","call","proxy","ProxyStorage","upname","updateVersionsHiddenUpLinkNext","manifest","upLink","versions","versionsList","keys","length","version","Symbol","for"],"sources":["../src/uplink-util.ts"],"sourcesContent":["import { Config, Logger, Manifest } from '@verdaccio/types';\n\nimport { IProxy, ProxyStorage } from './index';\n\nexport interface ProxyInstanceList {\n [key: string]: IProxy;\n}\n\n/**\n * Set up uplinks for each proxy configuration.\n */\nexport function setupUpLinks(config: Config, logger: Logger): ProxyInstanceList {\n const uplinks: ProxyInstanceList = {};\n\n for (const uplinkName in config.uplinks) {\n if (Object.prototype.hasOwnProperty.call(config.uplinks, uplinkName)) {\n // instance for each up-link definition\n const proxy: IProxy = new ProxyStorage(config.uplinks[uplinkName], config, logger);\n // TODO: review this can be inside ProxyStorage\n proxy.upname = uplinkName;\n\n uplinks[uplinkName] = proxy;\n }\n }\n\n return uplinks;\n}\n\nexport function updateVersionsHiddenUpLinkNext(manifest: Manifest, upLink: IProxy): Manifest {\n const { versions } = manifest;\n const versionsList = Object.keys(versions);\n if (versionsList.length === 0) {\n return manifest;\n }\n\n for (const version of versionsList) {\n // holds a \"hidden\" value to be used by the package storage.\n versions[version][Symbol.for('__verdaccio_uplink')] = upLink.upname;\n }\n\n return { ...manifest, versions };\n}\n"],"mappings":";;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAMA;AACA;AACA;AACO,SAASC,YAAYA,CAACC,MAAc,EAAEC,MAAc,EAAqB;EAC9E,MAAMC,OAA0B,GAAG,CAAC,CAAC;EAErC,KAAK,MAAMC,UAAU,IAAIH,MAAM,CAACE,OAAO,EAAE;IACvC,IAAIE,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,MAAM,CAACE,OAAO,EAAEC,UAAU,CAAC,EAAE;MACpE;MACA,MAAMK,KAAa,GAAG,IAAIC,mBAAY,CAACT,MAAM,CAACE,OAAO,CAACC,UAAU,CAAC,EAAEH,MAAM,EAAEC,MAAM,CAAC;MAClF;MACAO,KAAK,CAACE,MAAM,GAAGP,UAAU;MAEzBD,OAAO,CAACC,UAAU,CAAC,GAAGK,KAAK;IAC7B;EACF;EAEA,OAAON,OAAO;AAChB;AAEO,SAASS,8BAA8BA,CAACC,QAAkB,EAAEC,MAAc,EAAY;EAC3F,MAAM;IAAEC;EAAS,CAAC,GAAGF,QAAQ;EAC7B,MAAMG,YAAY,GAAGX,MAAM,CAACY,IAAI,CAACF,QAAQ,CAAC;EAC1C,IAAIC,YAAY,CAACE,MAAM,KAAK,CAAC,EAAE;IAC7B,OAAOL,QAAQ;EACjB;EAEA,KAAK,MAAMM,OAAO,IAAIH,YAAY,EAAE;IAClC;IACAD,QAAQ,CAACI,OAAO,CAAC,CAACC,MAAM,CAACC,GAAG,CAAC,oBAAoB,CAAC,CAAC,GAAGP,MAAM,CAACH,MAAM;EACrE;EAEA,OAAO;IAAE,GAAGE,QAAQ;IAAEE;EAAS,CAAC;AAClC"}
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/proxy",
|
|
3
|
-
"version": "7.0.0-next-7.
|
|
3
|
+
"version": "7.0.0-next-7.12",
|
|
4
4
|
"description": "verdaccio proxy fetcher",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"node": ">=18"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@verdaccio/config": "7.0.0-next-7.
|
|
33
|
-
"@verdaccio/core": "7.0.0-next-7.
|
|
34
|
-
"@verdaccio/utils": "7.0.0-next-7.
|
|
32
|
+
"@verdaccio/config": "7.0.0-next-7.12",
|
|
33
|
+
"@verdaccio/core": "7.0.0-next-7.12",
|
|
34
|
+
"@verdaccio/utils": "7.0.0-next-7.12",
|
|
35
35
|
"JSONStream": "1.3.5",
|
|
36
36
|
"debug": "4.3.4",
|
|
37
37
|
"got-cjs": "12.5.4",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"lodash": "4.17.21"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@verdaccio/logger": "7.0.0-next-7.
|
|
42
|
+
"@verdaccio/logger": "7.0.0-next-7.12",
|
|
43
43
|
"@verdaccio/types": "12.0.0-next.2",
|
|
44
44
|
"get-stream": "^6.0.1",
|
|
45
45
|
"nock": "13.5.1",
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Config, Logger, Manifest } from '@verdaccio/types';
|
|
2
|
+
|
|
3
|
+
import { IProxy, ProxyStorage } from './index';
|
|
4
|
+
|
|
5
|
+
export interface ProxyInstanceList {
|
|
6
|
+
[key: string]: IProxy;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Set up uplinks for each proxy configuration.
|
|
11
|
+
*/
|
|
12
|
+
export function setupUpLinks(config: Config, logger: Logger): ProxyInstanceList {
|
|
13
|
+
const uplinks: ProxyInstanceList = {};
|
|
14
|
+
|
|
15
|
+
for (const uplinkName in config.uplinks) {
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(config.uplinks, uplinkName)) {
|
|
17
|
+
// instance for each up-link definition
|
|
18
|
+
const proxy: IProxy = new ProxyStorage(config.uplinks[uplinkName], config, logger);
|
|
19
|
+
// TODO: review this can be inside ProxyStorage
|
|
20
|
+
proxy.upname = uplinkName;
|
|
21
|
+
|
|
22
|
+
uplinks[uplinkName] = proxy;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return uplinks;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function updateVersionsHiddenUpLinkNext(manifest: Manifest, upLink: IProxy): Manifest {
|
|
30
|
+
const { versions } = manifest;
|
|
31
|
+
const versionsList = Object.keys(versions);
|
|
32
|
+
if (versionsList.length === 0) {
|
|
33
|
+
return manifest;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
for (const version of versionsList) {
|
|
37
|
+
// holds a "hidden" value to be used by the package storage.
|
|
38
|
+
versions[version][Symbol.for('__verdaccio_uplink')] = upLink.upname;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return { ...manifest, versions };
|
|
42
|
+
}
|