@verdaccio/web 8.1.0-next-8.16 → 8.1.0-next-8.17
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/build/api/package.js +1 -1
- package/build/api/package.js.map +1 -1
- package/build/index.js +1 -2
- package/build/index.js.map +1 -1
- package/package.json +13 -13
package/build/api/package.js
CHANGED
|
@@ -39,7 +39,7 @@ const getOrder = (order = 'asc') => {
|
|
|
39
39
|
};
|
|
40
40
|
const debug = (0, _debug.default)('verdaccio:web:api:package');
|
|
41
41
|
function addPackageWebApi(storage, auth, config) {
|
|
42
|
-
const isLoginEnabled = config
|
|
42
|
+
const isLoginEnabled = (0, _webUtils.hasLogin)(config);
|
|
43
43
|
const pkgRouter = (0, _express.Router)(); /* eslint new-cap: 0 */
|
|
44
44
|
const anonymousRemoteUser = (0, _config.createAnonymousRemoteUser)();
|
|
45
45
|
debug('initialized package web api');
|
package/build/api/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","names":["_debug","_interopRequireDefault","require","_express","_lodash","_config","_logger","_middleware","_tarball","_authorUtils","_webUtils","e","__esModule","default","getOrder","order","debug","buildDebug","addPackageWebApi","storage","auth","config","isLoginEnabled","
|
|
1
|
+
{"version":3,"file":"package.js","names":["_debug","_interopRequireDefault","require","_express","_lodash","_config","_logger","_middleware","_tarball","_authorUtils","_webUtils","e","__esModule","default","getOrder","order","debug","buildDebug","addPackageWebApi","storage","auth","config","isLoginEnabled","hasLogin","pkgRouter","Router","anonymousRemoteUser","createAnonymousRemoteUser","checkAllow","name","remoteUser","Promise","resolve","reject","remoteUserAccess","allow_access","packageName","err","allowed","processPackages","packages","req","permissions","packagesToProcess","slice","pkg","pkgCopy","author","formatAuthor","remote_user","web","avatar","generateGravatarUrl","email","gravatar","_","isNil","dist","isNull","tarball","getLocalRegistryTarballUri","protocol","headers","host","hostname","url_prefix","push","logger","error","get","WebUrls","packages_all","res","next","localPackages","getLocalDatabase","sort_packages","pkgs","sortByName","_default","exports"],"sources":["../../src/api/package.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { Router } from 'express';\nimport _ from 'lodash';\n\nimport { Auth } from '@verdaccio/auth';\nimport { createAnonymousRemoteUser } from '@verdaccio/config';\nimport { logger } from '@verdaccio/logger';\nimport { $NextFunctionVer, $RequestExtend, $ResponseExtend } from '@verdaccio/middleware';\nimport { WebUrls } from '@verdaccio/middleware';\nimport { Storage } from '@verdaccio/store';\nimport { getLocalRegistryTarballUri } from '@verdaccio/tarball';\nimport { Config, RemoteUser, Version } from '@verdaccio/types';\n\nimport { formatAuthor, generateGravatarUrl } from '../author-utils';\nimport { hasLogin, sortByName } from '../web-utils';\n\nexport { $RequestExtend, $ResponseExtend, $NextFunctionVer }; // Was required by other packages\n\nconst getOrder = (order = 'asc') => {\n return order === 'asc';\n};\n\nconst debug = buildDebug('verdaccio:web:api:package');\n\nfunction addPackageWebApi(storage: Storage, auth: Auth, config: Config): Router {\n const isLoginEnabled = hasLogin(config);\n const pkgRouter = Router(); /* eslint new-cap: 0 */\n const anonymousRemoteUser: RemoteUser = createAnonymousRemoteUser();\n\n debug('initialized package web api');\n const checkAllow = (name: string, remoteUser: RemoteUser): Promise<boolean> =>\n new Promise((resolve, reject): void => {\n debug('is login enabled: %o', isLoginEnabled);\n const remoteUserAccess = !isLoginEnabled ? anonymousRemoteUser : remoteUser;\n try {\n auth.allow_access({ packageName: name }, remoteUserAccess, (err, allowed): void => {\n if (err) {\n resolve(false);\n }\n return resolve(allowed as boolean);\n });\n } catch (err: any) {\n reject(err);\n }\n });\n\n async function processPackages(packages: Version[] = [], req): Promise<Version[]> {\n const permissions: Version[] = [];\n const packagesToProcess = packages.slice();\n debug('process packages %o', packagesToProcess);\n for (const pkg of packagesToProcess) {\n const pkgCopy = { ...pkg };\n pkgCopy.author = formatAuthor(pkg.author);\n try {\n if (await checkAllow(pkg.name, req.remote_user)) {\n if (config.web) {\n // @ts-ignore\n pkgCopy.author.avatar = generateGravatarUrl(pkgCopy.author.email, config.web.gravatar);\n }\n // convert any remote dist to a local reference\n // eg: if the dist points to npmjs, switch to localhost:4873/prefix/etc.tar.gz\n if (!_.isNil(pkgCopy.dist) && !_.isNull(pkgCopy.dist.tarball)) {\n pkgCopy.dist.tarball = getLocalRegistryTarballUri(\n pkgCopy.dist.tarball,\n pkg.name,\n { protocol: req.protocol, headers: req.headers as any, host: req.hostname },\n config?.url_prefix\n );\n }\n permissions.push(pkgCopy);\n }\n } catch (err: any) {\n debug('process packages error %o', err);\n logger.error(\n { name: pkg.name, error: err },\n 'permission process for @{name} has failed: @{error}'\n );\n throw err;\n }\n }\n\n return permissions;\n }\n\n // Get list of all visible package\n pkgRouter.get(\n WebUrls.packages_all,\n async function (\n req: $RequestExtend,\n res: $ResponseExtend,\n next: $NextFunctionVer\n ): Promise<void> {\n debug('hit package web api %o');\n\n try {\n const localPackages: Version[] = await storage.getLocalDatabase();\n\n const order = getOrder(config?.web?.sort_packages);\n debug('order %o', order);\n const pkgs = await processPackages(localPackages, req);\n next(sortByName(pkgs, order));\n } catch (error: any) {\n next(error);\n }\n }\n );\n\n return pkgRouter;\n}\n\nexport default addPackageWebApi;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAGA,IAAAM,QAAA,GAAAN,OAAA;AAGA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAAoD,SAAAD,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEU;;AAE9D,MAA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;EACAlB,SAAS,CAAC6C,GAAG,CACXC,mBAAO,CAACC,YAAY,EACpB,gBACE9B,GAAmB,EACnB+B,GAAoB,EACpBC,IAAsB,EACP;IACfzD,KAAK,CAAC,wBAAwB,CAAC;IAE/B,IAAI;MACF,MAAM0D,aAAwB,GAAG,MAAMvD,OAAO,CAACwD,gBAAgB,CAAC,CAAC;MAEjE,MAAM5D,KAAK,GAAGD,QAAQ,CAACO,MAAM,EAAE6B,GAAG,EAAE0B,aAAa,CAAC;MAClD5D,KAAK,CAAC,UAAU,EAAED,KAAK,CAAC;MACxB,MAAM8D,IAAI,GAAG,MAAMtC,eAAe,CAACmC,aAAa,EAAEjC,GAAG,CAAC;MACtDgC,IAAI,CAAC,IAAAK,oBAAU,EAACD,IAAI,EAAE9D,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC,OAAOqD,KAAU,EAAE;MACnBK,IAAI,CAACL,KAAK,CAAC;IACb;EACF,CACF,CAAC;EAED,OAAO5C,SAAS;AAClB;AAAC,IAAAuD,QAAA,GAAAC,OAAA,CAAAnE,OAAA,GAEcK,gBAAgB","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -43,6 +43,5 @@ Object.keys(_webUtils).forEach(function (key) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
function
|
|
47
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
46
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
48
47
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_middleware","_interopRequireWildcard","require","_authorUtils","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_webUtils","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_middleware","_interopRequireWildcard","require","_authorUtils","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_webUtils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor"],"sources":["../src/index.ts"],"sourcesContent":["export { default, DEFAULT_PLUGIN_UI_THEME } from './middleware';\nexport * from './author-utils';\nexport * from './web-utils';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAA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A0B,wBAAA,CAAAb,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAT,GAAA,IAAAS,CAAA,CAAAK,GAAA,IAAAN,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/web",
|
|
3
|
-
"version": "8.1.0-next-8.
|
|
3
|
+
"version": "8.1.0-next-8.17",
|
|
4
4
|
"description": "Verdaccio Web Middleware",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -28,28 +28,28 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@verdaccio/auth": "8.0.0-next-8.
|
|
32
|
-
"@verdaccio/config": "8.0.0-next-8.
|
|
33
|
-
"@verdaccio/core": "8.0.0-next-8.
|
|
31
|
+
"@verdaccio/auth": "8.0.0-next-8.17",
|
|
32
|
+
"@verdaccio/config": "8.0.0-next-8.17",
|
|
33
|
+
"@verdaccio/core": "8.0.0-next-8.17",
|
|
34
34
|
"@verdaccio/loaders": "8.0.0-next-8.7",
|
|
35
|
-
"@verdaccio/logger": "8.0.0-next-8.
|
|
36
|
-
"@verdaccio/middleware": "8.0.0-next-8.
|
|
37
|
-
"@verdaccio/store": "8.0.0-next-8.
|
|
38
|
-
"@verdaccio/tarball": "13.0.0-next-8.
|
|
39
|
-
"@verdaccio/url": "13.0.0-next-8.
|
|
40
|
-
"debug": "4.4.
|
|
35
|
+
"@verdaccio/logger": "8.0.0-next-8.17",
|
|
36
|
+
"@verdaccio/middleware": "8.0.0-next-8.17",
|
|
37
|
+
"@verdaccio/store": "8.0.0-next-8.17",
|
|
38
|
+
"@verdaccio/tarball": "13.0.0-next-8.17",
|
|
39
|
+
"@verdaccio/url": "13.0.0-next-8.17",
|
|
40
|
+
"debug": "4.4.1",
|
|
41
41
|
"express": "4.21.2",
|
|
42
42
|
"lodash": "4.17.21"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@verdaccio/api": "8.1.0-next-8.
|
|
45
|
+
"@verdaccio/api": "8.1.0-next-8.17",
|
|
46
46
|
"@verdaccio/test-helper": "4.0.0-next-8.5",
|
|
47
47
|
"@verdaccio/types": "13.0.0-next-8.6",
|
|
48
48
|
"jsdom": "26.1.0",
|
|
49
49
|
"node-html-parser": "4.1.5",
|
|
50
50
|
"supertest": "7.0.0",
|
|
51
|
-
"verdaccio-auth-memory": "13.0.0-next-8.
|
|
52
|
-
"verdaccio-memory": "13.0.0-next-8.
|
|
51
|
+
"verdaccio-auth-memory": "13.0.0-next-8.17",
|
|
52
|
+
"verdaccio-memory": "13.0.0-next-8.17"
|
|
53
53
|
},
|
|
54
54
|
"funding": {
|
|
55
55
|
"type": "opencollective",
|