@verdaccio/core 9.0.0-next-9.4 → 9.0.0-next-9.6
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/README.md +10 -10
- package/build/constants.d.ts +2 -0
- package/build/constants.js +2 -0
- package/build/constants.js.map +1 -1
- package/build/constants.mjs +2 -0
- package/build/constants.mjs.map +1 -1
- package/build/crypto-utils.js +1 -1
- package/build/crypto-utils.js.map +1 -1
- package/build/crypto-utils.mjs +2 -2
- package/build/crypto-utils.mjs.map +1 -1
- package/build/plugin-utils.d.ts +20 -0
- package/build/plugin-utils.js +35 -1
- package/build/plugin-utils.js.map +1 -1
- package/build/plugin-utils.mjs +35 -1
- package/build/plugin-utils.mjs.map +1 -1
- package/build/warning-utils.js +10 -8
- package/build/warning-utils.js.map +1 -1
- package/build/warning-utils.mjs +3 -2
- package/build/warning-utils.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -29,16 +29,16 @@ If you want to report a security vulnerability, please follow the steps which we
|
|
|
29
29
|
|
|
30
30
|
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/verdaccio/contribute)]
|
|
31
31
|
|
|
32
|
-
[](https://opencollective.com/verdaccio/sponsor/0/website)
|
|
33
|
+
[](https://opencollective.com/verdaccio/sponsor/1/website)
|
|
34
|
+
[](https://opencollective.com/verdaccio/sponsor/2/website)
|
|
35
|
+
[](https://opencollective.com/verdaccio/sponsor/3/website)
|
|
36
|
+
[](https://opencollective.com/verdaccio/sponsor/4/website)
|
|
37
|
+
[](https://opencollective.com/verdaccio/sponsor/5/website)
|
|
38
|
+
[](https://opencollective.com/verdaccio/sponsor/6/website)
|
|
39
|
+
[](https://opencollective.com/verdaccio/sponsor/7/website)
|
|
40
|
+
[](https://opencollective.com/verdaccio/sponsor/8/website)
|
|
41
|
+
[](https://opencollective.com/verdaccio/sponsor/9/website)
|
|
42
42
|
|
|
43
43
|
## Open Collective Backers
|
|
44
44
|
|
package/build/constants.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare const HEADERS: {
|
|
|
32
32
|
TEXT_HTML: string;
|
|
33
33
|
AUTHORIZATION: string;
|
|
34
34
|
CACHE_CONTROL: string;
|
|
35
|
+
NO_CACHE: string;
|
|
35
36
|
RETRY_AFTER: string;
|
|
36
37
|
FORWARDED_PROTO: string;
|
|
37
38
|
FORWARDED_FOR: string;
|
|
@@ -49,6 +50,7 @@ export declare const HEADERS: {
|
|
|
49
50
|
JSON_INSTALL_CHARSET: string;
|
|
50
51
|
OCTET_STREAM: string;
|
|
51
52
|
TEXT_CHARSET: string;
|
|
53
|
+
JAVASCRIPT_CHARSET: string;
|
|
52
54
|
WWW_AUTH: string;
|
|
53
55
|
GZIP: string;
|
|
54
56
|
HOST: string;
|
package/build/constants.js
CHANGED
|
@@ -63,6 +63,7 @@ var HEADERS = {
|
|
|
63
63
|
TEXT_HTML: "text/html",
|
|
64
64
|
AUTHORIZATION: "authorization",
|
|
65
65
|
CACHE_CONTROL: "Cache-Control",
|
|
66
|
+
NO_CACHE: "no-cache, no-store",
|
|
66
67
|
RETRY_AFTER: "Retry-After",
|
|
67
68
|
FORWARDED_PROTO: "X-Forwarded-Proto",
|
|
68
69
|
FORWARDED_FOR: "X-Forwarded-For",
|
|
@@ -80,6 +81,7 @@ var HEADERS = {
|
|
|
80
81
|
JSON_INSTALL_CHARSET: "application/vnd.npm.install-v1+json; charset=utf-8",
|
|
81
82
|
OCTET_STREAM: "application/octet-stream; charset=utf-8",
|
|
82
83
|
TEXT_CHARSET: "text/plain; charset=utf-8",
|
|
84
|
+
JAVASCRIPT_CHARSET: "application/javascript; charset=utf-8",
|
|
83
85
|
WWW_AUTH: "WWW-Authenticate",
|
|
84
86
|
GZIP: "gzip",
|
|
85
87
|
HOST: "host"
|
package/build/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import httpCodes from 'http-status-codes';\n\nexport const DEFAULT_PASSWORD_VALIDATION = /.{3}$/;\nexport const TIME_EXPIRATION_24H = '24h';\nexport const TIME_EXPIRATION_1H = '1h';\nexport const DIST_TAGS = 'dist-tags';\nexport const LATEST = 'latest';\nexport const USERS = 'users';\nexport const MAINTAINERS = 'maintainers';\nexport const DEFAULT_USER = 'Anonymous'; // for display purposes\nexport const ANONYMOUS_USER = 'anonymous'; // for username purposes\n\nexport const HEADER_TYPE = {\n CONTENT_ENCODING: 'content-encoding',\n CONTENT_TYPE: 'content-type',\n CONTENT_LENGTH: 'content-length',\n ACCEPT_ENCODING: 'accept-encoding',\n AUTHORIZATION: 'authorization',\n};\n\nexport const CHARACTER_ENCODING = {\n UTF8: 'utf8',\n};\n\n// @deprecated use Bearer instead\nexport const TOKEN_BASIC = 'Basic';\nexport const TOKEN_BEARER = 'Bearer';\n\nexport const HEADERS = {\n ACCEPT: 'Accept',\n ACCEPT_ENCODING: 'Accept-Encoding',\n USER_AGENT: 'User-Agent',\n JSON: 'application/json',\n CONTENT_TYPE: 'Content-type',\n CONTENT_LENGTH: 'content-length',\n TEXT_PLAIN: 'text/plain',\n TEXT_PLAIN_UTF8: 'text/plain; charset=utf-8',\n TEXT_HTML_UTF8: 'text/html; charset=utf-8',\n TEXT_HTML: 'text/html',\n AUTHORIZATION: 'authorization',\n CACHE_CONTROL: 'Cache-Control',\n RETRY_AFTER: 'Retry-After',\n // only set with proxy that setup HTTPS\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto\n FORWARDED_PROTO: 'X-Forwarded-Proto',\n FORWARDED_FOR: 'X-Forwarded-For',\n FRAMES_OPTIONS: 'X-Frame-Options',\n CSP: 'Content-Security-Policy',\n CTO: 'X-Content-Type-Options',\n XSS: 'X-XSS-Protection',\n CLIENT: 'X-Client',\n POWERED_BY: 'X-Powered-By',\n RATELIMIT_LIMIT: 'X-RateLimit-Limit',\n RATELIMIT_REMAINING: 'X-RateLimit-Remaining',\n NONE_MATCH: 'If-None-Match',\n ETAG: 'ETag',\n JSON_CHARSET: 'application/json; charset=utf-8',\n JSON_INSTALL_CHARSET: 'application/vnd.npm.install-v1+json; charset=utf-8',\n OCTET_STREAM: 'application/octet-stream; charset=utf-8',\n TEXT_CHARSET: 'text/plain; charset=utf-8',\n WWW_AUTH: 'WWW-Authenticate',\n GZIP: 'gzip',\n HOST: 'host',\n};\n\n/**\n * HTTP status codes used throughout Verdaccio.\n */\nexport const HTTP_STATUS = {\n /** 202: The request has been accepted for processing, but the processing is not yet complete. */\n ACCEPTED: httpCodes.ACCEPTED,\n /** 200: Standard response for successful HTTP requests. */\n OK: httpCodes.OK,\n /** 201: The request has been fulfilled and resulted in a new resource being created. */\n CREATED: httpCodes.CREATED,\n /** 300: Indicates multiple options for the resource from which the client may choose. */\n MULTIPLE_CHOICES: httpCodes.MULTIPLE_CHOICES,\n /** 304: Indicates that the resource has not been modified since the last request. */\n NOT_MODIFIED: httpCodes.NOT_MODIFIED,\n /** 400: The server could not understand the request due to invalid syntax. */\n BAD_REQUEST: httpCodes.BAD_REQUEST,\n /** 401: The client must authenticate itself to get the requested response. */\n UNAUTHORIZED: httpCodes.UNAUTHORIZED,\n /** 403: The client does not have access rights to the content. */\n FORBIDDEN: httpCodes.FORBIDDEN,\n /** 404: The server can not find the requested resource. */\n NOT_FOUND: httpCodes.NOT_FOUND,\n /** 408: The server timed out waiting for the request. */\n REQUEST_TIMEOUT: httpCodes.REQUEST_TIMEOUT,\n /** 409: The request could not be completed due to a conflict with the current state of the resource. */\n CONFLICT: httpCodes.CONFLICT,\n /** 415: The media format of the requested data is not supported by the server. */\n UNSUPPORTED_MEDIA: httpCodes.UNSUPPORTED_MEDIA_TYPE,\n /** 422: The request was well-formed but was unable to be followed due to semantic errors. */\n BAD_DATA: httpCodes.UNPROCESSABLE_ENTITY,\n /** 500: The server has encountered a situation it doesn't know how to handle. */\n INTERNAL_ERROR: httpCodes.INTERNAL_SERVER_ERROR,\n /** 501: The request method is not supported by the server and cannot be handled. */\n NOT_IMPLEMENTED: httpCodes.NOT_IMPLEMENTED,\n /** 502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server. */\n BAD_GATEWAY: httpCodes.BAD_GATEWAY,\n /** 503: The server is not ready to handle the request. */\n SERVICE_UNAVAILABLE: httpCodes.SERVICE_UNAVAILABLE,\n /** 504: The server, while acting as a gateway or proxy, did not get a response in time from the upstream server. */\n GATEWAY_TIMEOUT: httpCodes.GATEWAY_TIMEOUT,\n /** 508: The server detected an infinite loop while processing the request. */\n LOOP_DETECTED: 508,\n /** 590: Custom Verdaccio code indicating the server cannot handle the request. */\n CANNOT_HANDLE: 590,\n};\n\nexport const ERROR_CODE = {\n token_required: 'token is required',\n};\n\nexport const API_MESSAGE = {\n PKG_CREATED: 'created new package',\n PKG_CHANGED: 'package changed',\n PKG_REMOVED: 'package removed',\n PKG_PUBLISHED: 'package published',\n TARBALL_UPLOADED: 'tarball uploaded successfully',\n TARBALL_REMOVED: 'tarball removed',\n TAG_UPDATED: 'tags updated',\n TAG_REMOVED: 'tag removed',\n TAG_ADDED: 'package tagged',\n OK: 'ok',\n LOGGED_OUT: 'Logged out',\n};\n\nexport const LOG_STATUS_MESSAGE =\n \"@{status}, user: @{user}(@{remoteIP}), req: '@{request.method} @{request.url}'\";\nexport const LOG_VERDACCIO_ERROR = `${LOG_STATUS_MESSAGE}, error: @{!error}`;\nexport const LOG_VERDACCIO_BYTES = `${LOG_STATUS_MESSAGE}, bytes: @{bytes.in}/@{bytes.out}`;\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 enum HtpasswdHashAlgorithm {\n md5 = 'md5',\n sha1 = 'sha1',\n crypt = 'crypt',\n bcrypt = 'bcrypt',\n}\n\nexport const PLUGIN_PREFIX = 'verdaccio';\nexport const PLUGIN_UI_PREFIX = 'verdaccio-theme';\n\nexport const PLUGIN_CATEGORY = {\n AUTHENTICATION: 'authentication',\n MIDDLEWARE: 'middleware',\n STORAGE: 'storage',\n FILTER: 'filter',\n THEME: 'theme',\n};\n\nexport const DEFAULT_PORT = '4873';\nexport const DEFAULT_PROTOCOL = 'http';\nexport const DEFAULT_DOMAIN = 'localhost';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,8BAA8B;AAG3C,IAAa,YAAY;AACzB,IAAa,SAAS;AACtB,IAAa,QAAQ;AACrB,IAAa,cAAc;AAC3B,IAAa,eAAe;AAC5B,IAAa,iBAAiB;AAE9B,IAAa,cAAc;CACzB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,iBAAiB;CACjB,eAAe;CAChB;AAED,IAAa,qBAAqB,EAChC,MAAM,QACP;AAGD,IAAa,cAAc;AAC3B,IAAa,eAAe;AAE5B,IAAa,UAAU;CACrB,QAAQ;CACR,iBAAiB;CACjB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,gBAAgB;CAChB,WAAW;CACX,eAAe;CACf,eAAe;CACf,aAAa;CAGb,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,KAAK;CACL,KAAK;CACL,KAAK;CACL,QAAQ;CACR,YAAY;CACZ,iBAAiB;CACjB,qBAAqB;CACrB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,sBAAsB;CACtB,cAAc;CACd,cAAc;CACd,UAAU;CACV,MAAM;CACN,MAAM;CACP;;;;AAKD,IAAa,cAAc;CAEzB,UAAU,kBAAA,QAAU;CAEpB,IAAI,kBAAA,QAAU;CAEd,SAAS,kBAAA,QAAU;CAEnB,kBAAkB,kBAAA,QAAU;CAE5B,cAAc,kBAAA,QAAU;CAExB,aAAa,kBAAA,QAAU;CAEvB,cAAc,kBAAA,QAAU;CAExB,WAAW,kBAAA,QAAU;CAErB,WAAW,kBAAA,QAAU;CAErB,iBAAiB,kBAAA,QAAU;CAE3B,UAAU,kBAAA,QAAU;CAEpB,mBAAmB,kBAAA,QAAU;CAE7B,UAAU,kBAAA,QAAU;CAEpB,gBAAgB,kBAAA,QAAU;CAE1B,iBAAiB,kBAAA,QAAU;CAE3B,aAAa,kBAAA,QAAU;CAEvB,qBAAqB,kBAAA,QAAU;CAE/B,iBAAiB,kBAAA,QAAU;CAE3B,eAAe;CAEf,eAAe;CAChB;AAED,IAAa,aAAa,EACxB,gBAAgB,qBACjB;AAED,IAAa,cAAc;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,eAAe;CACf,kBAAkB;CAClB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,WAAW;CACX,IAAI;CACJ,YAAY;CACb;AAED,IAAa,qBACX;AACF,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AAEzD,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;CACvB;AAED,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;CACN;AAED,IAAY,wBAAL,yBAAA,uBAAA;AACL,uBAAA,SAAA;AACA,uBAAA,UAAA;AACA,uBAAA,WAAA;AACA,uBAAA,YAAA;;KACD;AAED,IAAa,gBAAgB;AAC7B,IAAa,mBAAmB;AAEhC,IAAa,kBAAkB;CAC7B,gBAAgB;CAChB,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,OAAO;CACR;AAED,IAAa,eAAe;AAC5B,IAAa,mBAAmB;AAChC,IAAa,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import httpCodes from 'http-status-codes';\n\nexport const DEFAULT_PASSWORD_VALIDATION = /.{3}$/;\nexport const TIME_EXPIRATION_24H = '24h';\nexport const TIME_EXPIRATION_1H = '1h';\nexport const DIST_TAGS = 'dist-tags';\nexport const LATEST = 'latest';\nexport const USERS = 'users';\nexport const MAINTAINERS = 'maintainers';\nexport const DEFAULT_USER = 'Anonymous'; // for display purposes\nexport const ANONYMOUS_USER = 'anonymous'; // for username purposes\n\nexport const HEADER_TYPE = {\n CONTENT_ENCODING: 'content-encoding',\n CONTENT_TYPE: 'content-type',\n CONTENT_LENGTH: 'content-length',\n ACCEPT_ENCODING: 'accept-encoding',\n AUTHORIZATION: 'authorization',\n};\n\nexport const CHARACTER_ENCODING = {\n UTF8: 'utf8',\n};\n\n// @deprecated use Bearer instead\nexport const TOKEN_BASIC = 'Basic';\nexport const TOKEN_BEARER = 'Bearer';\n\nexport const HEADERS = {\n ACCEPT: 'Accept',\n ACCEPT_ENCODING: 'Accept-Encoding',\n USER_AGENT: 'User-Agent',\n JSON: 'application/json',\n CONTENT_TYPE: 'Content-type',\n CONTENT_LENGTH: 'content-length',\n TEXT_PLAIN: 'text/plain',\n TEXT_PLAIN_UTF8: 'text/plain; charset=utf-8',\n TEXT_HTML_UTF8: 'text/html; charset=utf-8',\n TEXT_HTML: 'text/html',\n AUTHORIZATION: 'authorization',\n CACHE_CONTROL: 'Cache-Control',\n NO_CACHE: 'no-cache, no-store',\n RETRY_AFTER: 'Retry-After',\n // only set with proxy that setup HTTPS\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto\n FORWARDED_PROTO: 'X-Forwarded-Proto',\n FORWARDED_FOR: 'X-Forwarded-For',\n FRAMES_OPTIONS: 'X-Frame-Options',\n CSP: 'Content-Security-Policy',\n CTO: 'X-Content-Type-Options',\n XSS: 'X-XSS-Protection',\n CLIENT: 'X-Client',\n POWERED_BY: 'X-Powered-By',\n RATELIMIT_LIMIT: 'X-RateLimit-Limit',\n RATELIMIT_REMAINING: 'X-RateLimit-Remaining',\n NONE_MATCH: 'If-None-Match',\n ETAG: 'ETag',\n JSON_CHARSET: 'application/json; charset=utf-8',\n JSON_INSTALL_CHARSET: 'application/vnd.npm.install-v1+json; charset=utf-8',\n OCTET_STREAM: 'application/octet-stream; charset=utf-8',\n TEXT_CHARSET: 'text/plain; charset=utf-8',\n JAVASCRIPT_CHARSET: 'application/javascript; charset=utf-8',\n WWW_AUTH: 'WWW-Authenticate',\n GZIP: 'gzip',\n HOST: 'host',\n};\n\n/**\n * HTTP status codes used throughout Verdaccio.\n */\nexport const HTTP_STATUS = {\n /** 202: The request has been accepted for processing, but the processing is not yet complete. */\n ACCEPTED: httpCodes.ACCEPTED,\n /** 200: Standard response for successful HTTP requests. */\n OK: httpCodes.OK,\n /** 201: The request has been fulfilled and resulted in a new resource being created. */\n CREATED: httpCodes.CREATED,\n /** 300: Indicates multiple options for the resource from which the client may choose. */\n MULTIPLE_CHOICES: httpCodes.MULTIPLE_CHOICES,\n /** 304: Indicates that the resource has not been modified since the last request. */\n NOT_MODIFIED: httpCodes.NOT_MODIFIED,\n /** 400: The server could not understand the request due to invalid syntax. */\n BAD_REQUEST: httpCodes.BAD_REQUEST,\n /** 401: The client must authenticate itself to get the requested response. */\n UNAUTHORIZED: httpCodes.UNAUTHORIZED,\n /** 403: The client does not have access rights to the content. */\n FORBIDDEN: httpCodes.FORBIDDEN,\n /** 404: The server can not find the requested resource. */\n NOT_FOUND: httpCodes.NOT_FOUND,\n /** 408: The server timed out waiting for the request. */\n REQUEST_TIMEOUT: httpCodes.REQUEST_TIMEOUT,\n /** 409: The request could not be completed due to a conflict with the current state of the resource. */\n CONFLICT: httpCodes.CONFLICT,\n /** 415: The media format of the requested data is not supported by the server. */\n UNSUPPORTED_MEDIA: httpCodes.UNSUPPORTED_MEDIA_TYPE,\n /** 422: The request was well-formed but was unable to be followed due to semantic errors. */\n BAD_DATA: httpCodes.UNPROCESSABLE_ENTITY,\n /** 500: The server has encountered a situation it doesn't know how to handle. */\n INTERNAL_ERROR: httpCodes.INTERNAL_SERVER_ERROR,\n /** 501: The request method is not supported by the server and cannot be handled. */\n NOT_IMPLEMENTED: httpCodes.NOT_IMPLEMENTED,\n /** 502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server. */\n BAD_GATEWAY: httpCodes.BAD_GATEWAY,\n /** 503: The server is not ready to handle the request. */\n SERVICE_UNAVAILABLE: httpCodes.SERVICE_UNAVAILABLE,\n /** 504: The server, while acting as a gateway or proxy, did not get a response in time from the upstream server. */\n GATEWAY_TIMEOUT: httpCodes.GATEWAY_TIMEOUT,\n /** 508: The server detected an infinite loop while processing the request. */\n LOOP_DETECTED: 508,\n /** 590: Custom Verdaccio code indicating the server cannot handle the request. */\n CANNOT_HANDLE: 590,\n};\n\nexport const ERROR_CODE = {\n token_required: 'token is required',\n};\n\nexport const API_MESSAGE = {\n PKG_CREATED: 'created new package',\n PKG_CHANGED: 'package changed',\n PKG_REMOVED: 'package removed',\n PKG_PUBLISHED: 'package published',\n TARBALL_UPLOADED: 'tarball uploaded successfully',\n TARBALL_REMOVED: 'tarball removed',\n TAG_UPDATED: 'tags updated',\n TAG_REMOVED: 'tag removed',\n TAG_ADDED: 'package tagged',\n OK: 'ok',\n LOGGED_OUT: 'Logged out',\n};\n\nexport const LOG_STATUS_MESSAGE =\n \"@{status}, user: @{user}(@{remoteIP}), req: '@{request.method} @{request.url}'\";\nexport const LOG_VERDACCIO_ERROR = `${LOG_STATUS_MESSAGE}, error: @{!error}`;\nexport const LOG_VERDACCIO_BYTES = `${LOG_STATUS_MESSAGE}, bytes: @{bytes.in}/@{bytes.out}`;\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 enum HtpasswdHashAlgorithm {\n md5 = 'md5',\n sha1 = 'sha1',\n crypt = 'crypt',\n bcrypt = 'bcrypt',\n}\n\nexport const PLUGIN_PREFIX = 'verdaccio';\nexport const PLUGIN_UI_PREFIX = 'verdaccio-theme';\n\nexport const PLUGIN_CATEGORY = {\n AUTHENTICATION: 'authentication',\n MIDDLEWARE: 'middleware',\n STORAGE: 'storage',\n FILTER: 'filter',\n THEME: 'theme',\n};\n\nexport const DEFAULT_PORT = '4873';\nexport const DEFAULT_PROTOCOL = 'http';\nexport const DEFAULT_DOMAIN = 'localhost';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,8BAA8B;AAG3C,IAAa,YAAY;AACzB,IAAa,SAAS;AACtB,IAAa,QAAQ;AACrB,IAAa,cAAc;AAC3B,IAAa,eAAe;AAC5B,IAAa,iBAAiB;AAE9B,IAAa,cAAc;CACzB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,iBAAiB;CACjB,eAAe;CAChB;AAED,IAAa,qBAAqB,EAChC,MAAM,QACP;AAGD,IAAa,cAAc;AAC3B,IAAa,eAAe;AAE5B,IAAa,UAAU;CACrB,QAAQ;CACR,iBAAiB;CACjB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,gBAAgB;CAChB,WAAW;CACX,eAAe;CACf,eAAe;CACf,UAAU;CACV,aAAa;CAGb,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,KAAK;CACL,KAAK;CACL,KAAK;CACL,QAAQ;CACR,YAAY;CACZ,iBAAiB;CACjB,qBAAqB;CACrB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,sBAAsB;CACtB,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,UAAU;CACV,MAAM;CACN,MAAM;CACP;;;;AAKD,IAAa,cAAc;CAEzB,UAAU,kBAAA,QAAU;CAEpB,IAAI,kBAAA,QAAU;CAEd,SAAS,kBAAA,QAAU;CAEnB,kBAAkB,kBAAA,QAAU;CAE5B,cAAc,kBAAA,QAAU;CAExB,aAAa,kBAAA,QAAU;CAEvB,cAAc,kBAAA,QAAU;CAExB,WAAW,kBAAA,QAAU;CAErB,WAAW,kBAAA,QAAU;CAErB,iBAAiB,kBAAA,QAAU;CAE3B,UAAU,kBAAA,QAAU;CAEpB,mBAAmB,kBAAA,QAAU;CAE7B,UAAU,kBAAA,QAAU;CAEpB,gBAAgB,kBAAA,QAAU;CAE1B,iBAAiB,kBAAA,QAAU;CAE3B,aAAa,kBAAA,QAAU;CAEvB,qBAAqB,kBAAA,QAAU;CAE/B,iBAAiB,kBAAA,QAAU;CAE3B,eAAe;CAEf,eAAe;CAChB;AAED,IAAa,aAAa,EACxB,gBAAgB,qBACjB;AAED,IAAa,cAAc;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,eAAe;CACf,kBAAkB;CAClB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,WAAW;CACX,IAAI;CACJ,YAAY;CACb;AAED,IAAa,qBACX;AACF,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AAEzD,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;CACvB;AAED,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;CACN;AAED,IAAY,wBAAL,yBAAA,uBAAA;AACL,uBAAA,SAAA;AACA,uBAAA,UAAA;AACA,uBAAA,WAAA;AACA,uBAAA,YAAA;;KACD;AAED,IAAa,gBAAgB;AAC7B,IAAa,mBAAmB;AAEhC,IAAa,kBAAkB;CAC7B,gBAAgB;CAChB,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,OAAO;CACR;AAED,IAAa,eAAe;AAC5B,IAAa,mBAAmB;AAChC,IAAa,iBAAiB"}
|
package/build/constants.mjs
CHANGED
|
@@ -62,6 +62,7 @@ var HEADERS = {
|
|
|
62
62
|
TEXT_HTML: "text/html",
|
|
63
63
|
AUTHORIZATION: "authorization",
|
|
64
64
|
CACHE_CONTROL: "Cache-Control",
|
|
65
|
+
NO_CACHE: "no-cache, no-store",
|
|
65
66
|
RETRY_AFTER: "Retry-After",
|
|
66
67
|
FORWARDED_PROTO: "X-Forwarded-Proto",
|
|
67
68
|
FORWARDED_FOR: "X-Forwarded-For",
|
|
@@ -79,6 +80,7 @@ var HEADERS = {
|
|
|
79
80
|
JSON_INSTALL_CHARSET: "application/vnd.npm.install-v1+json; charset=utf-8",
|
|
80
81
|
OCTET_STREAM: "application/octet-stream; charset=utf-8",
|
|
81
82
|
TEXT_CHARSET: "text/plain; charset=utf-8",
|
|
83
|
+
JAVASCRIPT_CHARSET: "application/javascript; charset=utf-8",
|
|
82
84
|
WWW_AUTH: "WWW-Authenticate",
|
|
83
85
|
GZIP: "gzip",
|
|
84
86
|
HOST: "host"
|
package/build/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import httpCodes from 'http-status-codes';\n\nexport const DEFAULT_PASSWORD_VALIDATION = /.{3}$/;\nexport const TIME_EXPIRATION_24H = '24h';\nexport const TIME_EXPIRATION_1H = '1h';\nexport const DIST_TAGS = 'dist-tags';\nexport const LATEST = 'latest';\nexport const USERS = 'users';\nexport const MAINTAINERS = 'maintainers';\nexport const DEFAULT_USER = 'Anonymous'; // for display purposes\nexport const ANONYMOUS_USER = 'anonymous'; // for username purposes\n\nexport const HEADER_TYPE = {\n CONTENT_ENCODING: 'content-encoding',\n CONTENT_TYPE: 'content-type',\n CONTENT_LENGTH: 'content-length',\n ACCEPT_ENCODING: 'accept-encoding',\n AUTHORIZATION: 'authorization',\n};\n\nexport const CHARACTER_ENCODING = {\n UTF8: 'utf8',\n};\n\n// @deprecated use Bearer instead\nexport const TOKEN_BASIC = 'Basic';\nexport const TOKEN_BEARER = 'Bearer';\n\nexport const HEADERS = {\n ACCEPT: 'Accept',\n ACCEPT_ENCODING: 'Accept-Encoding',\n USER_AGENT: 'User-Agent',\n JSON: 'application/json',\n CONTENT_TYPE: 'Content-type',\n CONTENT_LENGTH: 'content-length',\n TEXT_PLAIN: 'text/plain',\n TEXT_PLAIN_UTF8: 'text/plain; charset=utf-8',\n TEXT_HTML_UTF8: 'text/html; charset=utf-8',\n TEXT_HTML: 'text/html',\n AUTHORIZATION: 'authorization',\n CACHE_CONTROL: 'Cache-Control',\n RETRY_AFTER: 'Retry-After',\n // only set with proxy that setup HTTPS\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto\n FORWARDED_PROTO: 'X-Forwarded-Proto',\n FORWARDED_FOR: 'X-Forwarded-For',\n FRAMES_OPTIONS: 'X-Frame-Options',\n CSP: 'Content-Security-Policy',\n CTO: 'X-Content-Type-Options',\n XSS: 'X-XSS-Protection',\n CLIENT: 'X-Client',\n POWERED_BY: 'X-Powered-By',\n RATELIMIT_LIMIT: 'X-RateLimit-Limit',\n RATELIMIT_REMAINING: 'X-RateLimit-Remaining',\n NONE_MATCH: 'If-None-Match',\n ETAG: 'ETag',\n JSON_CHARSET: 'application/json; charset=utf-8',\n JSON_INSTALL_CHARSET: 'application/vnd.npm.install-v1+json; charset=utf-8',\n OCTET_STREAM: 'application/octet-stream; charset=utf-8',\n TEXT_CHARSET: 'text/plain; charset=utf-8',\n WWW_AUTH: 'WWW-Authenticate',\n GZIP: 'gzip',\n HOST: 'host',\n};\n\n/**\n * HTTP status codes used throughout Verdaccio.\n */\nexport const HTTP_STATUS = {\n /** 202: The request has been accepted for processing, but the processing is not yet complete. */\n ACCEPTED: httpCodes.ACCEPTED,\n /** 200: Standard response for successful HTTP requests. */\n OK: httpCodes.OK,\n /** 201: The request has been fulfilled and resulted in a new resource being created. */\n CREATED: httpCodes.CREATED,\n /** 300: Indicates multiple options for the resource from which the client may choose. */\n MULTIPLE_CHOICES: httpCodes.MULTIPLE_CHOICES,\n /** 304: Indicates that the resource has not been modified since the last request. */\n NOT_MODIFIED: httpCodes.NOT_MODIFIED,\n /** 400: The server could not understand the request due to invalid syntax. */\n BAD_REQUEST: httpCodes.BAD_REQUEST,\n /** 401: The client must authenticate itself to get the requested response. */\n UNAUTHORIZED: httpCodes.UNAUTHORIZED,\n /** 403: The client does not have access rights to the content. */\n FORBIDDEN: httpCodes.FORBIDDEN,\n /** 404: The server can not find the requested resource. */\n NOT_FOUND: httpCodes.NOT_FOUND,\n /** 408: The server timed out waiting for the request. */\n REQUEST_TIMEOUT: httpCodes.REQUEST_TIMEOUT,\n /** 409: The request could not be completed due to a conflict with the current state of the resource. */\n CONFLICT: httpCodes.CONFLICT,\n /** 415: The media format of the requested data is not supported by the server. */\n UNSUPPORTED_MEDIA: httpCodes.UNSUPPORTED_MEDIA_TYPE,\n /** 422: The request was well-formed but was unable to be followed due to semantic errors. */\n BAD_DATA: httpCodes.UNPROCESSABLE_ENTITY,\n /** 500: The server has encountered a situation it doesn't know how to handle. */\n INTERNAL_ERROR: httpCodes.INTERNAL_SERVER_ERROR,\n /** 501: The request method is not supported by the server and cannot be handled. */\n NOT_IMPLEMENTED: httpCodes.NOT_IMPLEMENTED,\n /** 502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server. */\n BAD_GATEWAY: httpCodes.BAD_GATEWAY,\n /** 503: The server is not ready to handle the request. */\n SERVICE_UNAVAILABLE: httpCodes.SERVICE_UNAVAILABLE,\n /** 504: The server, while acting as a gateway or proxy, did not get a response in time from the upstream server. */\n GATEWAY_TIMEOUT: httpCodes.GATEWAY_TIMEOUT,\n /** 508: The server detected an infinite loop while processing the request. */\n LOOP_DETECTED: 508,\n /** 590: Custom Verdaccio code indicating the server cannot handle the request. */\n CANNOT_HANDLE: 590,\n};\n\nexport const ERROR_CODE = {\n token_required: 'token is required',\n};\n\nexport const API_MESSAGE = {\n PKG_CREATED: 'created new package',\n PKG_CHANGED: 'package changed',\n PKG_REMOVED: 'package removed',\n PKG_PUBLISHED: 'package published',\n TARBALL_UPLOADED: 'tarball uploaded successfully',\n TARBALL_REMOVED: 'tarball removed',\n TAG_UPDATED: 'tags updated',\n TAG_REMOVED: 'tag removed',\n TAG_ADDED: 'package tagged',\n OK: 'ok',\n LOGGED_OUT: 'Logged out',\n};\n\nexport const LOG_STATUS_MESSAGE =\n \"@{status}, user: @{user}(@{remoteIP}), req: '@{request.method} @{request.url}'\";\nexport const LOG_VERDACCIO_ERROR = `${LOG_STATUS_MESSAGE}, error: @{!error}`;\nexport const LOG_VERDACCIO_BYTES = `${LOG_STATUS_MESSAGE}, bytes: @{bytes.in}/@{bytes.out}`;\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 enum HtpasswdHashAlgorithm {\n md5 = 'md5',\n sha1 = 'sha1',\n crypt = 'crypt',\n bcrypt = 'bcrypt',\n}\n\nexport const PLUGIN_PREFIX = 'verdaccio';\nexport const PLUGIN_UI_PREFIX = 'verdaccio-theme';\n\nexport const PLUGIN_CATEGORY = {\n AUTHENTICATION: 'authentication',\n MIDDLEWARE: 'middleware',\n STORAGE: 'storage',\n FILTER: 'filter',\n THEME: 'theme',\n};\n\nexport const DEFAULT_PORT = '4873';\nexport const DEFAULT_PROTOCOL = 'http';\nexport const DEFAULT_DOMAIN = 'localhost';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,8BAA8B;AAG3C,IAAa,YAAY;AACzB,IAAa,SAAS;AACtB,IAAa,QAAQ;AACrB,IAAa,cAAc;AAC3B,IAAa,eAAe;AAC5B,IAAa,iBAAiB;AAE9B,IAAa,cAAc;CACzB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,iBAAiB;CACjB,eAAe;CAChB;AAED,IAAa,qBAAqB,EAChC,MAAM,QACP;AAGD,IAAa,cAAc;AAC3B,IAAa,eAAe;AAE5B,IAAa,UAAU;CACrB,QAAQ;CACR,iBAAiB;CACjB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,gBAAgB;CAChB,WAAW;CACX,eAAe;CACf,eAAe;CACf,aAAa;CAGb,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,KAAK;CACL,KAAK;CACL,KAAK;CACL,QAAQ;CACR,YAAY;CACZ,iBAAiB;CACjB,qBAAqB;CACrB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,sBAAsB;CACtB,cAAc;CACd,cAAc;CACd,UAAU;CACV,MAAM;CACN,MAAM;CACP;;;;AAKD,IAAa,cAAc;CAEzB,UAAU,UAAU;CAEpB,IAAI,UAAU;CAEd,SAAS,UAAU;CAEnB,kBAAkB,UAAU;CAE5B,cAAc,UAAU;CAExB,aAAa,UAAU;CAEvB,cAAc,UAAU;CAExB,WAAW,UAAU;CAErB,WAAW,UAAU;CAErB,iBAAiB,UAAU;CAE3B,UAAU,UAAU;CAEpB,mBAAmB,UAAU;CAE7B,UAAU,UAAU;CAEpB,gBAAgB,UAAU;CAE1B,iBAAiB,UAAU;CAE3B,aAAa,UAAU;CAEvB,qBAAqB,UAAU;CAE/B,iBAAiB,UAAU;CAE3B,eAAe;CAEf,eAAe;CAChB;AAED,IAAa,aAAa,EACxB,gBAAgB,qBACjB;AAED,IAAa,cAAc;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,eAAe;CACf,kBAAkB;CAClB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,WAAW;CACX,IAAI;CACJ,YAAY;CACb;AAED,IAAa,qBACX;AACF,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AAEzD,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;CACvB;AAED,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;CACN;AAED,IAAY,wBAAL,yBAAA,uBAAA;AACL,uBAAA,SAAA;AACA,uBAAA,UAAA;AACA,uBAAA,WAAA;AACA,uBAAA,YAAA;;KACD;AAED,IAAa,gBAAgB;AAC7B,IAAa,mBAAmB;AAEhC,IAAa,kBAAkB;CAC7B,gBAAgB;CAChB,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,OAAO;CACR;AAED,IAAa,eAAe;AAC5B,IAAa,mBAAmB;AAChC,IAAa,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import httpCodes from 'http-status-codes';\n\nexport const DEFAULT_PASSWORD_VALIDATION = /.{3}$/;\nexport const TIME_EXPIRATION_24H = '24h';\nexport const TIME_EXPIRATION_1H = '1h';\nexport const DIST_TAGS = 'dist-tags';\nexport const LATEST = 'latest';\nexport const USERS = 'users';\nexport const MAINTAINERS = 'maintainers';\nexport const DEFAULT_USER = 'Anonymous'; // for display purposes\nexport const ANONYMOUS_USER = 'anonymous'; // for username purposes\n\nexport const HEADER_TYPE = {\n CONTENT_ENCODING: 'content-encoding',\n CONTENT_TYPE: 'content-type',\n CONTENT_LENGTH: 'content-length',\n ACCEPT_ENCODING: 'accept-encoding',\n AUTHORIZATION: 'authorization',\n};\n\nexport const CHARACTER_ENCODING = {\n UTF8: 'utf8',\n};\n\n// @deprecated use Bearer instead\nexport const TOKEN_BASIC = 'Basic';\nexport const TOKEN_BEARER = 'Bearer';\n\nexport const HEADERS = {\n ACCEPT: 'Accept',\n ACCEPT_ENCODING: 'Accept-Encoding',\n USER_AGENT: 'User-Agent',\n JSON: 'application/json',\n CONTENT_TYPE: 'Content-type',\n CONTENT_LENGTH: 'content-length',\n TEXT_PLAIN: 'text/plain',\n TEXT_PLAIN_UTF8: 'text/plain; charset=utf-8',\n TEXT_HTML_UTF8: 'text/html; charset=utf-8',\n TEXT_HTML: 'text/html',\n AUTHORIZATION: 'authorization',\n CACHE_CONTROL: 'Cache-Control',\n NO_CACHE: 'no-cache, no-store',\n RETRY_AFTER: 'Retry-After',\n // only set with proxy that setup HTTPS\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto\n FORWARDED_PROTO: 'X-Forwarded-Proto',\n FORWARDED_FOR: 'X-Forwarded-For',\n FRAMES_OPTIONS: 'X-Frame-Options',\n CSP: 'Content-Security-Policy',\n CTO: 'X-Content-Type-Options',\n XSS: 'X-XSS-Protection',\n CLIENT: 'X-Client',\n POWERED_BY: 'X-Powered-By',\n RATELIMIT_LIMIT: 'X-RateLimit-Limit',\n RATELIMIT_REMAINING: 'X-RateLimit-Remaining',\n NONE_MATCH: 'If-None-Match',\n ETAG: 'ETag',\n JSON_CHARSET: 'application/json; charset=utf-8',\n JSON_INSTALL_CHARSET: 'application/vnd.npm.install-v1+json; charset=utf-8',\n OCTET_STREAM: 'application/octet-stream; charset=utf-8',\n TEXT_CHARSET: 'text/plain; charset=utf-8',\n JAVASCRIPT_CHARSET: 'application/javascript; charset=utf-8',\n WWW_AUTH: 'WWW-Authenticate',\n GZIP: 'gzip',\n HOST: 'host',\n};\n\n/**\n * HTTP status codes used throughout Verdaccio.\n */\nexport const HTTP_STATUS = {\n /** 202: The request has been accepted for processing, but the processing is not yet complete. */\n ACCEPTED: httpCodes.ACCEPTED,\n /** 200: Standard response for successful HTTP requests. */\n OK: httpCodes.OK,\n /** 201: The request has been fulfilled and resulted in a new resource being created. */\n CREATED: httpCodes.CREATED,\n /** 300: Indicates multiple options for the resource from which the client may choose. */\n MULTIPLE_CHOICES: httpCodes.MULTIPLE_CHOICES,\n /** 304: Indicates that the resource has not been modified since the last request. */\n NOT_MODIFIED: httpCodes.NOT_MODIFIED,\n /** 400: The server could not understand the request due to invalid syntax. */\n BAD_REQUEST: httpCodes.BAD_REQUEST,\n /** 401: The client must authenticate itself to get the requested response. */\n UNAUTHORIZED: httpCodes.UNAUTHORIZED,\n /** 403: The client does not have access rights to the content. */\n FORBIDDEN: httpCodes.FORBIDDEN,\n /** 404: The server can not find the requested resource. */\n NOT_FOUND: httpCodes.NOT_FOUND,\n /** 408: The server timed out waiting for the request. */\n REQUEST_TIMEOUT: httpCodes.REQUEST_TIMEOUT,\n /** 409: The request could not be completed due to a conflict with the current state of the resource. */\n CONFLICT: httpCodes.CONFLICT,\n /** 415: The media format of the requested data is not supported by the server. */\n UNSUPPORTED_MEDIA: httpCodes.UNSUPPORTED_MEDIA_TYPE,\n /** 422: The request was well-formed but was unable to be followed due to semantic errors. */\n BAD_DATA: httpCodes.UNPROCESSABLE_ENTITY,\n /** 500: The server has encountered a situation it doesn't know how to handle. */\n INTERNAL_ERROR: httpCodes.INTERNAL_SERVER_ERROR,\n /** 501: The request method is not supported by the server and cannot be handled. */\n NOT_IMPLEMENTED: httpCodes.NOT_IMPLEMENTED,\n /** 502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server. */\n BAD_GATEWAY: httpCodes.BAD_GATEWAY,\n /** 503: The server is not ready to handle the request. */\n SERVICE_UNAVAILABLE: httpCodes.SERVICE_UNAVAILABLE,\n /** 504: The server, while acting as a gateway or proxy, did not get a response in time from the upstream server. */\n GATEWAY_TIMEOUT: httpCodes.GATEWAY_TIMEOUT,\n /** 508: The server detected an infinite loop while processing the request. */\n LOOP_DETECTED: 508,\n /** 590: Custom Verdaccio code indicating the server cannot handle the request. */\n CANNOT_HANDLE: 590,\n};\n\nexport const ERROR_CODE = {\n token_required: 'token is required',\n};\n\nexport const API_MESSAGE = {\n PKG_CREATED: 'created new package',\n PKG_CHANGED: 'package changed',\n PKG_REMOVED: 'package removed',\n PKG_PUBLISHED: 'package published',\n TARBALL_UPLOADED: 'tarball uploaded successfully',\n TARBALL_REMOVED: 'tarball removed',\n TAG_UPDATED: 'tags updated',\n TAG_REMOVED: 'tag removed',\n TAG_ADDED: 'package tagged',\n OK: 'ok',\n LOGGED_OUT: 'Logged out',\n};\n\nexport const LOG_STATUS_MESSAGE =\n \"@{status}, user: @{user}(@{remoteIP}), req: '@{request.method} @{request.url}'\";\nexport const LOG_VERDACCIO_ERROR = `${LOG_STATUS_MESSAGE}, error: @{!error}`;\nexport const LOG_VERDACCIO_BYTES = `${LOG_STATUS_MESSAGE}, bytes: @{bytes.in}/@{bytes.out}`;\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 enum HtpasswdHashAlgorithm {\n md5 = 'md5',\n sha1 = 'sha1',\n crypt = 'crypt',\n bcrypt = 'bcrypt',\n}\n\nexport const PLUGIN_PREFIX = 'verdaccio';\nexport const PLUGIN_UI_PREFIX = 'verdaccio-theme';\n\nexport const PLUGIN_CATEGORY = {\n AUTHENTICATION: 'authentication',\n MIDDLEWARE: 'middleware',\n STORAGE: 'storage',\n FILTER: 'filter',\n THEME: 'theme',\n};\n\nexport const DEFAULT_PORT = '4873';\nexport const DEFAULT_PROTOCOL = 'http';\nexport const DEFAULT_DOMAIN = 'localhost';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,8BAA8B;AAG3C,IAAa,YAAY;AACzB,IAAa,SAAS;AACtB,IAAa,QAAQ;AACrB,IAAa,cAAc;AAC3B,IAAa,eAAe;AAC5B,IAAa,iBAAiB;AAE9B,IAAa,cAAc;CACzB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,iBAAiB;CACjB,eAAe;CAChB;AAED,IAAa,qBAAqB,EAChC,MAAM,QACP;AAGD,IAAa,cAAc;AAC3B,IAAa,eAAe;AAE5B,IAAa,UAAU;CACrB,QAAQ;CACR,iBAAiB;CACjB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,gBAAgB;CAChB,WAAW;CACX,eAAe;CACf,eAAe;CACf,UAAU;CACV,aAAa;CAGb,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,KAAK;CACL,KAAK;CACL,KAAK;CACL,QAAQ;CACR,YAAY;CACZ,iBAAiB;CACjB,qBAAqB;CACrB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,sBAAsB;CACtB,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,UAAU;CACV,MAAM;CACN,MAAM;CACP;;;;AAKD,IAAa,cAAc;CAEzB,UAAU,UAAU;CAEpB,IAAI,UAAU;CAEd,SAAS,UAAU;CAEnB,kBAAkB,UAAU;CAE5B,cAAc,UAAU;CAExB,aAAa,UAAU;CAEvB,cAAc,UAAU;CAExB,WAAW,UAAU;CAErB,WAAW,UAAU;CAErB,iBAAiB,UAAU;CAE3B,UAAU,UAAU;CAEpB,mBAAmB,UAAU;CAE7B,UAAU,UAAU;CAEpB,gBAAgB,UAAU;CAE1B,iBAAiB,UAAU;CAE3B,aAAa,UAAU;CAEvB,qBAAqB,UAAU;CAE/B,iBAAiB,UAAU;CAE3B,eAAe;CAEf,eAAe;CAChB;AAED,IAAa,aAAa,EACxB,gBAAgB,qBACjB;AAED,IAAa,cAAc;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,eAAe;CACf,kBAAkB;CAClB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,WAAW;CACX,IAAI;CACJ,YAAY;CACb;AAED,IAAa,qBACX;AACF,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AAEzD,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;CACvB;AAED,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;CACN;AAED,IAAY,wBAAL,yBAAA,uBAAA;AACL,uBAAA,SAAA;AACA,uBAAA,UAAA;AACA,uBAAA,WAAA;AACA,uBAAA,YAAA;;KACD;AAED,IAAa,gBAAgB;AAC7B,IAAa,mBAAmB;AAEhC,IAAa,kBAAkB;CAC7B,gBAAgB;CAChB,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,OAAO;CACR;AAED,IAAa,eAAe;AAC5B,IAAa,mBAAmB;AAChC,IAAa,iBAAiB"}
|
package/build/crypto-utils.js
CHANGED
|
@@ -23,7 +23,7 @@ function stringToMD5(data) {
|
|
|
23
23
|
return (0, node_crypto.createHash)("md5").update(data).digest("hex");
|
|
24
24
|
}
|
|
25
25
|
function generateRandomHexString(length = 8) {
|
|
26
|
-
return (0, node_crypto.
|
|
26
|
+
return (0, node_crypto.randomBytes)(length).toString("hex");
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* return a masquerade string with its first and last {charNum} and three dots in between.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-utils.js","names":[],"sources":["../src/crypto-utils.ts"],"sourcesContent":["import type { Hash } from 'node:crypto';\nimport { createHash,
|
|
1
|
+
{"version":3,"file":"crypto-utils.js","names":[],"sources":["../src/crypto-utils.ts"],"sourcesContent":["import type { Hash } from 'node:crypto';\nimport { createHash, randomBytes } from 'node:crypto';\n\nexport const defaultTarballHashAlgorithm = 'sha1';\n\nexport function createTarballHash(): Hash {\n return createHash(defaultTarballHashAlgorithm);\n}\n\n/**\n * Express doesn't do ETAGS with requests <= 1024b\n * we use md5 here, it works well on 1k+ bytes, but sucks with fewer data\n * could improve performance using crc32 after benchmarks.\n * @param {Object} data\n * @return {String}\n */\nexport function stringToMD5(data: Buffer | string): string {\n // @ts-ignore update method accepts Buffer or string\n return createHash('md5').update(data).digest('hex');\n}\n\nexport function generateRandomHexString(length = 8): string {\n return randomBytes(length).toString('hex');\n}\n\n/**\n * return a masquerade string with its first and last {charNum} and three dots in between.\n * @param {String} str\n * @param {Number} charNum\n * @returns {String}\n */\nexport function mask(str: string, charNum = 3): string {\n return `${str.slice(0, charNum)}...${str.slice(-charNum)}`;\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAa,8BAA8B;AAE3C,SAAgB,oBAA0B;AACxC,SAAA,GAAA,YAAA,YAAkB,4BAA4B;;;;;;;;;AAUhD,SAAgB,YAAY,MAA+B;AAEzD,SAAA,GAAA,YAAA,YAAkB,MAAM,CAAC,OAAO,KAAK,CAAC,OAAO,MAAM;;AAGrD,SAAgB,wBAAwB,SAAS,GAAW;AAC1D,SAAA,GAAA,YAAA,aAAmB,OAAO,CAAC,SAAS,MAAM;;;;;;;;AAS5C,SAAgB,KAAK,KAAa,UAAU,GAAW;AACrD,QAAO,GAAG,IAAI,MAAM,GAAG,QAAQ,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ"}
|
package/build/crypto-utils.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { createHash,
|
|
2
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
3
3
|
//#region src/crypto-utils.ts
|
|
4
4
|
var crypto_utils_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
createTarballHash: () => createTarballHash,
|
|
@@ -23,7 +23,7 @@ function stringToMD5(data) {
|
|
|
23
23
|
return createHash("md5").update(data).digest("hex");
|
|
24
24
|
}
|
|
25
25
|
function generateRandomHexString(length = 8) {
|
|
26
|
-
return
|
|
26
|
+
return randomBytes(length).toString("hex");
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* return a masquerade string with its first and last {charNum} and three dots in between.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-utils.mjs","names":[],"sources":["../src/crypto-utils.ts"],"sourcesContent":["import type { Hash } from 'node:crypto';\nimport { createHash,
|
|
1
|
+
{"version":3,"file":"crypto-utils.mjs","names":[],"sources":["../src/crypto-utils.ts"],"sourcesContent":["import type { Hash } from 'node:crypto';\nimport { createHash, randomBytes } from 'node:crypto';\n\nexport const defaultTarballHashAlgorithm = 'sha1';\n\nexport function createTarballHash(): Hash {\n return createHash(defaultTarballHashAlgorithm);\n}\n\n/**\n * Express doesn't do ETAGS with requests <= 1024b\n * we use md5 here, it works well on 1k+ bytes, but sucks with fewer data\n * could improve performance using crc32 after benchmarks.\n * @param {Object} data\n * @return {String}\n */\nexport function stringToMD5(data: Buffer | string): string {\n // @ts-ignore update method accepts Buffer or string\n return createHash('md5').update(data).digest('hex');\n}\n\nexport function generateRandomHexString(length = 8): string {\n return randomBytes(length).toString('hex');\n}\n\n/**\n * return a masquerade string with its first and last {charNum} and three dots in between.\n * @param {String} str\n * @param {Number} charNum\n * @returns {String}\n */\nexport function mask(str: string, charNum = 3): string {\n return `${str.slice(0, charNum)}...${str.slice(-charNum)}`;\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAa,8BAA8B;AAE3C,SAAgB,oBAA0B;AACxC,QAAO,WAAW,4BAA4B;;;;;;;;;AAUhD,SAAgB,YAAY,MAA+B;AAEzD,QAAO,WAAW,MAAM,CAAC,OAAO,KAAK,CAAC,OAAO,MAAM;;AAGrD,SAAgB,wBAAwB,SAAS,GAAW;AAC1D,QAAO,YAAY,OAAO,CAAC,SAAS,MAAM;;;;;;;;AAS5C,SAAgB,KAAK,KAAa,UAAU,GAAW;AACrD,QAAO,GAAG,IAAI,MAAM,GAAG,QAAQ,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ"}
|
package/build/plugin-utils.d.ts
CHANGED
|
@@ -154,3 +154,23 @@ export interface IBasicAuth {
|
|
|
154
154
|
export interface ManifestFilter<T> extends Plugin<T> {
|
|
155
155
|
filter_metadata(manifest: Manifest): Promise<Manifest>;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Sanity check for authentication plugins.
|
|
159
|
+
* A valid auth plugin must implement at least one of: authenticate, allow_access, allow_publish.
|
|
160
|
+
*/
|
|
161
|
+
export declare function authSanityCheck(plugin: Auth<unknown>): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Sanity check for storage plugins.
|
|
164
|
+
* A valid storage plugin must implement getPackageStorage.
|
|
165
|
+
*/
|
|
166
|
+
export declare function storageSanityCheck(plugin: Storage<unknown>): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Sanity check for middleware plugins.
|
|
169
|
+
* A valid middleware plugin must implement register_middlewares.
|
|
170
|
+
*/
|
|
171
|
+
export declare function middlewareSanityCheck(plugin: ExpressMiddleware<unknown, unknown, unknown>): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Sanity check for filter plugins.
|
|
174
|
+
* A valid filter plugin must implement filter_metadata.
|
|
175
|
+
*/
|
|
176
|
+
export declare function filterSanityCheck(plugin: ManifestFilter<unknown>): boolean;
|
package/build/plugin-utils.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
//#region src/plugin-utils.ts
|
|
2
|
-
var plugin_utils_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.js").__exportAll({
|
|
2
|
+
var plugin_utils_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.js").__exportAll({
|
|
3
|
+
Plugin: () => Plugin,
|
|
4
|
+
authSanityCheck: () => authSanityCheck,
|
|
5
|
+
filterSanityCheck: () => filterSanityCheck,
|
|
6
|
+
middlewareSanityCheck: () => middlewareSanityCheck,
|
|
7
|
+
storageSanityCheck: () => storageSanityCheck
|
|
8
|
+
});
|
|
3
9
|
/**
|
|
4
10
|
* Base Plugin Class
|
|
5
11
|
*
|
|
@@ -19,6 +25,34 @@ var Plugin = class Plugin {
|
|
|
19
25
|
return this.version;
|
|
20
26
|
}
|
|
21
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Sanity check for authentication plugins.
|
|
30
|
+
* A valid auth plugin must implement at least one of: authenticate, allow_access, allow_publish.
|
|
31
|
+
*/
|
|
32
|
+
function authSanityCheck(plugin) {
|
|
33
|
+
return typeof plugin.authenticate !== "undefined" || typeof plugin.allow_access !== "undefined" || typeof plugin.allow_publish !== "undefined";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sanity check for storage plugins.
|
|
37
|
+
* A valid storage plugin must implement getPackageStorage.
|
|
38
|
+
*/
|
|
39
|
+
function storageSanityCheck(plugin) {
|
|
40
|
+
return typeof plugin.getPackageStorage !== "undefined";
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sanity check for middleware plugins.
|
|
44
|
+
* A valid middleware plugin must implement register_middlewares.
|
|
45
|
+
*/
|
|
46
|
+
function middlewareSanityCheck(plugin) {
|
|
47
|
+
return typeof plugin.register_middlewares !== "undefined";
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sanity check for filter plugins.
|
|
51
|
+
* A valid filter plugin must implement filter_metadata.
|
|
52
|
+
*/
|
|
53
|
+
function filterSanityCheck(plugin) {
|
|
54
|
+
return typeof plugin.filter_metadata !== "undefined";
|
|
55
|
+
}
|
|
22
56
|
//#endregion
|
|
23
57
|
Object.defineProperty(exports, "plugin_utils_exports", {
|
|
24
58
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-utils.js","names":[],"sources":["../src/plugin-utils.ts"],"sourcesContent":["import type { Express, RequestHandler } from 'express';\nimport type { Readable, Writable } from 'node:stream';\n\nimport type {\n AllowAccess,\n Callback,\n Config,\n Logger,\n Manifest,\n PackageAccess,\n RemoteUser,\n Token,\n TokenFilter,\n} from '@verdaccio/types';\n\nimport type { VerdaccioError, searchUtils } from '.';\n\nexport interface PluginOptions {\n config: Config;\n logger: Logger;\n}\n\n/**\n * Base Plugin Class\n *\n * Set of utilities for developing plugins.\n */\nexport class Plugin<PluginConfig> {\n static version = 1;\n public readonly version: number;\n public readonly config: PluginConfig | unknown;\n public readonly options: PluginOptions;\n public constructor(config: PluginConfig, options: PluginOptions) {\n this.version = Plugin.version;\n this.config = config;\n this.options = options;\n }\n\n public getVersion() {\n return this.version;\n }\n}\n\n// --- STORAGE PLUGIN ---\n\n/**\n * Storage Handler\n *\n * Used in storage plugin for managing packages and tarballs.\n */\nexport interface StorageHandler {\n logger: Logger;\n deletePackage(fileName: string): Promise<void>;\n removePackage(packageName: string): Promise<void>;\n // next packages migration (this list is meant to replace the callback parent functions)\n updatePackage(\n packageName: string,\n handleUpdate: (manifest: Manifest) => Promise<Manifest>\n ): Promise<Manifest>;\n readPackage(packageName: string): Promise<Manifest>;\n savePackage(packageName: string, manifest: Manifest): Promise<void>;\n readTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Readable>;\n createPackage(packageName: string, manifest: Manifest): Promise<void>;\n writeTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Writable>;\n // verify if tarball exist in the storage\n hasTarball(fileName: string): Promise<boolean>;\n // verify if package exist in the storage\n hasPackage(packageName: string): Promise<boolean>;\n}\n\n/**\n * Storage Plugin interface\n *\n * https://verdaccio.org/docs/plugin-storage\n */\nexport interface Storage<PluginConfig> extends Plugin<PluginConfig> {\n add(packageName: string): Promise<void>;\n remove(packageName: string): Promise<void>;\n get(): Promise<string[]>;\n init(): Promise<void>;\n getSecret(): Promise<string>;\n setSecret(secret: string): Promise<any>;\n getPackageStorage(packageName: string): StorageHandler;\n search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;\n saveToken(token: Token): Promise<any>;\n deleteToken(user: string, tokenKey: string): Promise<any>;\n readTokens(filter: TokenFilter): Promise<Token[]>;\n}\n\n// --- MIDDLEWARE PLUGIN ---\n\n/**\n * Middleware Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-middleware\n *\n * This function allow add middleware to the application.\n *\n * ```ts\n * import express, { Request, Response } from 'express';\n * \n * class Middleware extends Plugin {\n * // instances of auth and storage are injected\n * register_middlewares(app, auth, storage) {\n * const router = express.Router();\n * router.post('/my-endpoint', (req: Request, res: Response): void => {\n res.status(200).end();\n });\n * }\n * }\n *\n * const [plugin] = await asyncLoadPlugin(...);\n * plugin.register_middlewares(app, auth, storage);\n * ```\n */\nexport interface ExpressMiddleware<PluginConfig, Storage, Auth> extends Plugin<PluginConfig> {\n register_middlewares(app: Express, auth: Auth, storage: Storage): void;\n}\n\n// --- AUTH PLUGIN ---\n\nexport type AuthCallback = (error: VerdaccioError | null, groups?: string[] | false) => void;\n\nexport type AuthAccessCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AuthUserCallback = (error: VerdaccioError | null, access?: boolean | string) => void;\nexport type AuthChangePasswordCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AccessCallback = (error: VerdaccioError | null, ok?: boolean) => void;\n\nexport interface AuthPluginPackage {\n packageName: string;\n packageVersion?: string;\n tag?: string;\n}\n\n/**\n * Authentication Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-auth\n */\nexport interface Auth<T> extends Plugin<T> {\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public authenticate(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // always return an array of users\n return done(null, [user]); \n * }\n * ```\n */\n authenticate(user: string, password: string, cb: AuthCallback): void;\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public adduser(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // return boolean\n return done(null, true); \n * }\n * ```\n */\n adduser?(user: string, password: string, cb: AuthUserCallback): void;\n changePassword?(\n user: string,\n password: string,\n newPassword: string,\n cb: AuthChangePasswordCallback\n ): void;\n allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;\n allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AccessCallback): void;\n allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AccessCallback): void;\n allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_unpublish?(\n user: RemoteUser,\n pkg: AllowAccess & PackageAccess,\n cb: AuthAccessCallback\n ): void;\n apiJWTmiddleware?(helpers: any): RequestHandler;\n}\n\nexport interface IBasicAuth {\n authenticate(user: string, password: string, cb: Callback): void;\n invalidateToken?(token: string): Promise<void>;\n changePassword(user: string, password: string, newPassword: string, cb: Callback): void;\n allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;\n add_user(user: string, password: string, cb: Callback): any;\n}\n\n// --- FILTER PLUGIN ---\n\n/**\n * Filter Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-filter\n */\nexport interface ManifestFilter<T> extends Plugin<T> {\n filter_metadata(manifest: Manifest): Promise<Manifest>;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-utils.js","names":[],"sources":["../src/plugin-utils.ts"],"sourcesContent":["import type { Express, RequestHandler } from 'express';\nimport type { Readable, Writable } from 'node:stream';\n\nimport type {\n AllowAccess,\n Callback,\n Config,\n Logger,\n Manifest,\n PackageAccess,\n RemoteUser,\n Token,\n TokenFilter,\n} from '@verdaccio/types';\n\nimport type { VerdaccioError, searchUtils } from '.';\n\nexport interface PluginOptions {\n config: Config;\n logger: Logger;\n}\n\n/**\n * Base Plugin Class\n *\n * Set of utilities for developing plugins.\n */\nexport class Plugin<PluginConfig> {\n static version = 1;\n public readonly version: number;\n public readonly config: PluginConfig | unknown;\n public readonly options: PluginOptions;\n public constructor(config: PluginConfig, options: PluginOptions) {\n this.version = Plugin.version;\n this.config = config;\n this.options = options;\n }\n\n public getVersion() {\n return this.version;\n }\n}\n\n// --- STORAGE PLUGIN ---\n\n/**\n * Storage Handler\n *\n * Used in storage plugin for managing packages and tarballs.\n */\nexport interface StorageHandler {\n logger: Logger;\n deletePackage(fileName: string): Promise<void>;\n removePackage(packageName: string): Promise<void>;\n // next packages migration (this list is meant to replace the callback parent functions)\n updatePackage(\n packageName: string,\n handleUpdate: (manifest: Manifest) => Promise<Manifest>\n ): Promise<Manifest>;\n readPackage(packageName: string): Promise<Manifest>;\n savePackage(packageName: string, manifest: Manifest): Promise<void>;\n readTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Readable>;\n createPackage(packageName: string, manifest: Manifest): Promise<void>;\n writeTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Writable>;\n // verify if tarball exist in the storage\n hasTarball(fileName: string): Promise<boolean>;\n // verify if package exist in the storage\n hasPackage(packageName: string): Promise<boolean>;\n}\n\n/**\n * Storage Plugin interface\n *\n * https://verdaccio.org/docs/plugin-storage\n */\nexport interface Storage<PluginConfig> extends Plugin<PluginConfig> {\n add(packageName: string): Promise<void>;\n remove(packageName: string): Promise<void>;\n get(): Promise<string[]>;\n init(): Promise<void>;\n getSecret(): Promise<string>;\n setSecret(secret: string): Promise<any>;\n getPackageStorage(packageName: string): StorageHandler;\n search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;\n saveToken(token: Token): Promise<any>;\n deleteToken(user: string, tokenKey: string): Promise<any>;\n readTokens(filter: TokenFilter): Promise<Token[]>;\n}\n\n// --- MIDDLEWARE PLUGIN ---\n\n/**\n * Middleware Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-middleware\n *\n * This function allow add middleware to the application.\n *\n * ```ts\n * import express, { Request, Response } from 'express';\n * \n * class Middleware extends Plugin {\n * // instances of auth and storage are injected\n * register_middlewares(app, auth, storage) {\n * const router = express.Router();\n * router.post('/my-endpoint', (req: Request, res: Response): void => {\n res.status(200).end();\n });\n * }\n * }\n *\n * const [plugin] = await asyncLoadPlugin(...);\n * plugin.register_middlewares(app, auth, storage);\n * ```\n */\nexport interface ExpressMiddleware<PluginConfig, Storage, Auth> extends Plugin<PluginConfig> {\n register_middlewares(app: Express, auth: Auth, storage: Storage): void;\n}\n\n// --- AUTH PLUGIN ---\n\nexport type AuthCallback = (error: VerdaccioError | null, groups?: string[] | false) => void;\n\nexport type AuthAccessCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AuthUserCallback = (error: VerdaccioError | null, access?: boolean | string) => void;\nexport type AuthChangePasswordCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AccessCallback = (error: VerdaccioError | null, ok?: boolean) => void;\n\nexport interface AuthPluginPackage {\n packageName: string;\n packageVersion?: string;\n tag?: string;\n}\n\n/**\n * Authentication Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-auth\n */\nexport interface Auth<T> extends Plugin<T> {\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public authenticate(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // always return an array of users\n return done(null, [user]); \n * }\n * ```\n */\n authenticate(user: string, password: string, cb: AuthCallback): void;\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public adduser(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // return boolean\n return done(null, true); \n * }\n * ```\n */\n adduser?(user: string, password: string, cb: AuthUserCallback): void;\n changePassword?(\n user: string,\n password: string,\n newPassword: string,\n cb: AuthChangePasswordCallback\n ): void;\n allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;\n allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AccessCallback): void;\n allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AccessCallback): void;\n allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_unpublish?(\n user: RemoteUser,\n pkg: AllowAccess & PackageAccess,\n cb: AuthAccessCallback\n ): void;\n apiJWTmiddleware?(helpers: any): RequestHandler;\n}\n\nexport interface IBasicAuth {\n authenticate(user: string, password: string, cb: Callback): void;\n invalidateToken?(token: string): Promise<void>;\n changePassword(user: string, password: string, newPassword: string, cb: Callback): void;\n allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;\n add_user(user: string, password: string, cb: Callback): any;\n}\n\n// --- FILTER PLUGIN ---\n\n/**\n * Filter Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-filter\n */\nexport interface ManifestFilter<T> extends Plugin<T> {\n filter_metadata(manifest: Manifest): Promise<Manifest>;\n}\n\n// --- SANITY CHECKS ---\n\n/**\n * Sanity check for authentication plugins.\n * A valid auth plugin must implement at least one of: authenticate, allow_access, allow_publish.\n */\nexport function authSanityCheck(plugin: Auth<unknown>): boolean {\n return (\n typeof plugin.authenticate !== 'undefined' ||\n typeof plugin.allow_access !== 'undefined' ||\n typeof plugin.allow_publish !== 'undefined'\n );\n}\n\n/**\n * Sanity check for storage plugins.\n * A valid storage plugin must implement getPackageStorage.\n */\nexport function storageSanityCheck(plugin: Storage<unknown>): boolean {\n return typeof plugin.getPackageStorage !== 'undefined';\n}\n\n/**\n * Sanity check for middleware plugins.\n * A valid middleware plugin must implement register_middlewares.\n */\nexport function middlewareSanityCheck(\n plugin: ExpressMiddleware<unknown, unknown, unknown>\n): boolean {\n return typeof plugin.register_middlewares !== 'undefined';\n}\n\n/**\n * Sanity check for filter plugins.\n * A valid filter plugin must implement filter_metadata.\n */\nexport function filterSanityCheck(plugin: ManifestFilter<unknown>): boolean {\n return typeof plugin.filter_metadata !== 'undefined';\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAa,SAAb,MAAa,OAAqB;CAChC,OAAO,UAAU;CACjB;CACA;CACA;CACA,YAAmB,QAAsB,SAAwB;AAC/D,OAAK,UAAU,OAAO;AACtB,OAAK,SAAS;AACd,OAAK,UAAU;;CAGjB,aAAoB;AAClB,SAAO,KAAK;;;;;;;AA6KhB,SAAgB,gBAAgB,QAAgC;AAC9D,QACE,OAAO,OAAO,iBAAiB,eAC/B,OAAO,OAAO,iBAAiB,eAC/B,OAAO,OAAO,kBAAkB;;;;;;AAQpC,SAAgB,mBAAmB,QAAmC;AACpE,QAAO,OAAO,OAAO,sBAAsB;;;;;;AAO7C,SAAgB,sBACd,QACS;AACT,QAAO,OAAO,OAAO,yBAAyB;;;;;;AAOhD,SAAgB,kBAAkB,QAA0C;AAC1E,QAAO,OAAO,OAAO,oBAAoB"}
|
package/build/plugin-utils.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
//#region src/plugin-utils.ts
|
|
3
|
-
var plugin_utils_exports = /* @__PURE__ */ __exportAll({
|
|
3
|
+
var plugin_utils_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
Plugin: () => Plugin,
|
|
5
|
+
authSanityCheck: () => authSanityCheck,
|
|
6
|
+
filterSanityCheck: () => filterSanityCheck,
|
|
7
|
+
middlewareSanityCheck: () => middlewareSanityCheck,
|
|
8
|
+
storageSanityCheck: () => storageSanityCheck
|
|
9
|
+
});
|
|
4
10
|
/**
|
|
5
11
|
* Base Plugin Class
|
|
6
12
|
*
|
|
@@ -20,6 +26,34 @@ var Plugin = class Plugin {
|
|
|
20
26
|
return this.version;
|
|
21
27
|
}
|
|
22
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Sanity check for authentication plugins.
|
|
31
|
+
* A valid auth plugin must implement at least one of: authenticate, allow_access, allow_publish.
|
|
32
|
+
*/
|
|
33
|
+
function authSanityCheck(plugin) {
|
|
34
|
+
return typeof plugin.authenticate !== "undefined" || typeof plugin.allow_access !== "undefined" || typeof plugin.allow_publish !== "undefined";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sanity check for storage plugins.
|
|
38
|
+
* A valid storage plugin must implement getPackageStorage.
|
|
39
|
+
*/
|
|
40
|
+
function storageSanityCheck(plugin) {
|
|
41
|
+
return typeof plugin.getPackageStorage !== "undefined";
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sanity check for middleware plugins.
|
|
45
|
+
* A valid middleware plugin must implement register_middlewares.
|
|
46
|
+
*/
|
|
47
|
+
function middlewareSanityCheck(plugin) {
|
|
48
|
+
return typeof plugin.register_middlewares !== "undefined";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Sanity check for filter plugins.
|
|
52
|
+
* A valid filter plugin must implement filter_metadata.
|
|
53
|
+
*/
|
|
54
|
+
function filterSanityCheck(plugin) {
|
|
55
|
+
return typeof plugin.filter_metadata !== "undefined";
|
|
56
|
+
}
|
|
23
57
|
//#endregion
|
|
24
58
|
export { plugin_utils_exports };
|
|
25
59
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-utils.mjs","names":[],"sources":["../src/plugin-utils.ts"],"sourcesContent":["import type { Express, RequestHandler } from 'express';\nimport type { Readable, Writable } from 'node:stream';\n\nimport type {\n AllowAccess,\n Callback,\n Config,\n Logger,\n Manifest,\n PackageAccess,\n RemoteUser,\n Token,\n TokenFilter,\n} from '@verdaccio/types';\n\nimport type { VerdaccioError, searchUtils } from '.';\n\nexport interface PluginOptions {\n config: Config;\n logger: Logger;\n}\n\n/**\n * Base Plugin Class\n *\n * Set of utilities for developing plugins.\n */\nexport class Plugin<PluginConfig> {\n static version = 1;\n public readonly version: number;\n public readonly config: PluginConfig | unknown;\n public readonly options: PluginOptions;\n public constructor(config: PluginConfig, options: PluginOptions) {\n this.version = Plugin.version;\n this.config = config;\n this.options = options;\n }\n\n public getVersion() {\n return this.version;\n }\n}\n\n// --- STORAGE PLUGIN ---\n\n/**\n * Storage Handler\n *\n * Used in storage plugin for managing packages and tarballs.\n */\nexport interface StorageHandler {\n logger: Logger;\n deletePackage(fileName: string): Promise<void>;\n removePackage(packageName: string): Promise<void>;\n // next packages migration (this list is meant to replace the callback parent functions)\n updatePackage(\n packageName: string,\n handleUpdate: (manifest: Manifest) => Promise<Manifest>\n ): Promise<Manifest>;\n readPackage(packageName: string): Promise<Manifest>;\n savePackage(packageName: string, manifest: Manifest): Promise<void>;\n readTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Readable>;\n createPackage(packageName: string, manifest: Manifest): Promise<void>;\n writeTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Writable>;\n // verify if tarball exist in the storage\n hasTarball(fileName: string): Promise<boolean>;\n // verify if package exist in the storage\n hasPackage(packageName: string): Promise<boolean>;\n}\n\n/**\n * Storage Plugin interface\n *\n * https://verdaccio.org/docs/plugin-storage\n */\nexport interface Storage<PluginConfig> extends Plugin<PluginConfig> {\n add(packageName: string): Promise<void>;\n remove(packageName: string): Promise<void>;\n get(): Promise<string[]>;\n init(): Promise<void>;\n getSecret(): Promise<string>;\n setSecret(secret: string): Promise<any>;\n getPackageStorage(packageName: string): StorageHandler;\n search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;\n saveToken(token: Token): Promise<any>;\n deleteToken(user: string, tokenKey: string): Promise<any>;\n readTokens(filter: TokenFilter): Promise<Token[]>;\n}\n\n// --- MIDDLEWARE PLUGIN ---\n\n/**\n * Middleware Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-middleware\n *\n * This function allow add middleware to the application.\n *\n * ```ts\n * import express, { Request, Response } from 'express';\n * \n * class Middleware extends Plugin {\n * // instances of auth and storage are injected\n * register_middlewares(app, auth, storage) {\n * const router = express.Router();\n * router.post('/my-endpoint', (req: Request, res: Response): void => {\n res.status(200).end();\n });\n * }\n * }\n *\n * const [plugin] = await asyncLoadPlugin(...);\n * plugin.register_middlewares(app, auth, storage);\n * ```\n */\nexport interface ExpressMiddleware<PluginConfig, Storage, Auth> extends Plugin<PluginConfig> {\n register_middlewares(app: Express, auth: Auth, storage: Storage): void;\n}\n\n// --- AUTH PLUGIN ---\n\nexport type AuthCallback = (error: VerdaccioError | null, groups?: string[] | false) => void;\n\nexport type AuthAccessCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AuthUserCallback = (error: VerdaccioError | null, access?: boolean | string) => void;\nexport type AuthChangePasswordCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AccessCallback = (error: VerdaccioError | null, ok?: boolean) => void;\n\nexport interface AuthPluginPackage {\n packageName: string;\n packageVersion?: string;\n tag?: string;\n}\n\n/**\n * Authentication Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-auth\n */\nexport interface Auth<T> extends Plugin<T> {\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public authenticate(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // always return an array of users\n return done(null, [user]); \n * }\n * ```\n */\n authenticate(user: string, password: string, cb: AuthCallback): void;\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public adduser(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // return boolean\n return done(null, true); \n * }\n * ```\n */\n adduser?(user: string, password: string, cb: AuthUserCallback): void;\n changePassword?(\n user: string,\n password: string,\n newPassword: string,\n cb: AuthChangePasswordCallback\n ): void;\n allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;\n allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AccessCallback): void;\n allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AccessCallback): void;\n allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_unpublish?(\n user: RemoteUser,\n pkg: AllowAccess & PackageAccess,\n cb: AuthAccessCallback\n ): void;\n apiJWTmiddleware?(helpers: any): RequestHandler;\n}\n\nexport interface IBasicAuth {\n authenticate(user: string, password: string, cb: Callback): void;\n invalidateToken?(token: string): Promise<void>;\n changePassword(user: string, password: string, newPassword: string, cb: Callback): void;\n allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;\n add_user(user: string, password: string, cb: Callback): any;\n}\n\n// --- FILTER PLUGIN ---\n\n/**\n * Filter Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-filter\n */\nexport interface ManifestFilter<T> extends Plugin<T> {\n filter_metadata(manifest: Manifest): Promise<Manifest>;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-utils.mjs","names":[],"sources":["../src/plugin-utils.ts"],"sourcesContent":["import type { Express, RequestHandler } from 'express';\nimport type { Readable, Writable } from 'node:stream';\n\nimport type {\n AllowAccess,\n Callback,\n Config,\n Logger,\n Manifest,\n PackageAccess,\n RemoteUser,\n Token,\n TokenFilter,\n} from '@verdaccio/types';\n\nimport type { VerdaccioError, searchUtils } from '.';\n\nexport interface PluginOptions {\n config: Config;\n logger: Logger;\n}\n\n/**\n * Base Plugin Class\n *\n * Set of utilities for developing plugins.\n */\nexport class Plugin<PluginConfig> {\n static version = 1;\n public readonly version: number;\n public readonly config: PluginConfig | unknown;\n public readonly options: PluginOptions;\n public constructor(config: PluginConfig, options: PluginOptions) {\n this.version = Plugin.version;\n this.config = config;\n this.options = options;\n }\n\n public getVersion() {\n return this.version;\n }\n}\n\n// --- STORAGE PLUGIN ---\n\n/**\n * Storage Handler\n *\n * Used in storage plugin for managing packages and tarballs.\n */\nexport interface StorageHandler {\n logger: Logger;\n deletePackage(fileName: string): Promise<void>;\n removePackage(packageName: string): Promise<void>;\n // next packages migration (this list is meant to replace the callback parent functions)\n updatePackage(\n packageName: string,\n handleUpdate: (manifest: Manifest) => Promise<Manifest>\n ): Promise<Manifest>;\n readPackage(packageName: string): Promise<Manifest>;\n savePackage(packageName: string, manifest: Manifest): Promise<void>;\n readTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Readable>;\n createPackage(packageName: string, manifest: Manifest): Promise<void>;\n writeTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Writable>;\n // verify if tarball exist in the storage\n hasTarball(fileName: string): Promise<boolean>;\n // verify if package exist in the storage\n hasPackage(packageName: string): Promise<boolean>;\n}\n\n/**\n * Storage Plugin interface\n *\n * https://verdaccio.org/docs/plugin-storage\n */\nexport interface Storage<PluginConfig> extends Plugin<PluginConfig> {\n add(packageName: string): Promise<void>;\n remove(packageName: string): Promise<void>;\n get(): Promise<string[]>;\n init(): Promise<void>;\n getSecret(): Promise<string>;\n setSecret(secret: string): Promise<any>;\n getPackageStorage(packageName: string): StorageHandler;\n search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;\n saveToken(token: Token): Promise<any>;\n deleteToken(user: string, tokenKey: string): Promise<any>;\n readTokens(filter: TokenFilter): Promise<Token[]>;\n}\n\n// --- MIDDLEWARE PLUGIN ---\n\n/**\n * Middleware Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-middleware\n *\n * This function allow add middleware to the application.\n *\n * ```ts\n * import express, { Request, Response } from 'express';\n * \n * class Middleware extends Plugin {\n * // instances of auth and storage are injected\n * register_middlewares(app, auth, storage) {\n * const router = express.Router();\n * router.post('/my-endpoint', (req: Request, res: Response): void => {\n res.status(200).end();\n });\n * }\n * }\n *\n * const [plugin] = await asyncLoadPlugin(...);\n * plugin.register_middlewares(app, auth, storage);\n * ```\n */\nexport interface ExpressMiddleware<PluginConfig, Storage, Auth> extends Plugin<PluginConfig> {\n register_middlewares(app: Express, auth: Auth, storage: Storage): void;\n}\n\n// --- AUTH PLUGIN ---\n\nexport type AuthCallback = (error: VerdaccioError | null, groups?: string[] | false) => void;\n\nexport type AuthAccessCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AuthUserCallback = (error: VerdaccioError | null, access?: boolean | string) => void;\nexport type AuthChangePasswordCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AccessCallback = (error: VerdaccioError | null, ok?: boolean) => void;\n\nexport interface AuthPluginPackage {\n packageName: string;\n packageVersion?: string;\n tag?: string;\n}\n\n/**\n * Authentication Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-auth\n */\nexport interface Auth<T> extends Plugin<T> {\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public authenticate(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // always return an array of users\n return done(null, [user]); \n * }\n * ```\n */\n authenticate(user: string, password: string, cb: AuthCallback): void;\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public adduser(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // return boolean\n return done(null, true); \n * }\n * ```\n */\n adduser?(user: string, password: string, cb: AuthUserCallback): void;\n changePassword?(\n user: string,\n password: string,\n newPassword: string,\n cb: AuthChangePasswordCallback\n ): void;\n allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;\n allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AccessCallback): void;\n allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AccessCallback): void;\n allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_unpublish?(\n user: RemoteUser,\n pkg: AllowAccess & PackageAccess,\n cb: AuthAccessCallback\n ): void;\n apiJWTmiddleware?(helpers: any): RequestHandler;\n}\n\nexport interface IBasicAuth {\n authenticate(user: string, password: string, cb: Callback): void;\n invalidateToken?(token: string): Promise<void>;\n changePassword(user: string, password: string, newPassword: string, cb: Callback): void;\n allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;\n add_user(user: string, password: string, cb: Callback): any;\n}\n\n// --- FILTER PLUGIN ---\n\n/**\n * Filter Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-filter\n */\nexport interface ManifestFilter<T> extends Plugin<T> {\n filter_metadata(manifest: Manifest): Promise<Manifest>;\n}\n\n// --- SANITY CHECKS ---\n\n/**\n * Sanity check for authentication plugins.\n * A valid auth plugin must implement at least one of: authenticate, allow_access, allow_publish.\n */\nexport function authSanityCheck(plugin: Auth<unknown>): boolean {\n return (\n typeof plugin.authenticate !== 'undefined' ||\n typeof plugin.allow_access !== 'undefined' ||\n typeof plugin.allow_publish !== 'undefined'\n );\n}\n\n/**\n * Sanity check for storage plugins.\n * A valid storage plugin must implement getPackageStorage.\n */\nexport function storageSanityCheck(plugin: Storage<unknown>): boolean {\n return typeof plugin.getPackageStorage !== 'undefined';\n}\n\n/**\n * Sanity check for middleware plugins.\n * A valid middleware plugin must implement register_middlewares.\n */\nexport function middlewareSanityCheck(\n plugin: ExpressMiddleware<unknown, unknown, unknown>\n): boolean {\n return typeof plugin.register_middlewares !== 'undefined';\n}\n\n/**\n * Sanity check for filter plugins.\n * A valid filter plugin must implement filter_metadata.\n */\nexport function filterSanityCheck(plugin: ManifestFilter<unknown>): boolean {\n return typeof plugin.filter_metadata !== 'undefined';\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAa,SAAb,MAAa,OAAqB;CAChC,OAAO,UAAU;CACjB;CACA;CACA;CACA,YAAmB,QAAsB,SAAwB;AAC/D,OAAK,UAAU,OAAO;AACtB,OAAK,SAAS;AACd,OAAK,UAAU;;CAGjB,aAAoB;AAClB,SAAO,KAAK;;;;;;;AA6KhB,SAAgB,gBAAgB,QAAgC;AAC9D,QACE,OAAO,OAAO,iBAAiB,eAC/B,OAAO,OAAO,iBAAiB,eAC/B,OAAO,OAAO,kBAAkB;;;;;;AAQpC,SAAgB,mBAAmB,QAAmC;AACpE,QAAO,OAAO,OAAO,sBAAsB;;;;;;AAO7C,SAAgB,sBACd,QACS;AACT,QAAO,OAAO,OAAO,yBAAyB;;;;;;AAOhD,SAAgB,kBAAkB,QAA0C;AAC1E,QAAO,OAAO,OAAO,oBAAoB"}
|
package/build/warning-utils.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
2
|
let process_warning = require("process-warning");
|
|
3
|
+
process_warning = require_runtime.__toESM(process_warning);
|
|
3
4
|
//#region src/warning-utils.ts
|
|
4
5
|
var warning_utils_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
5
6
|
Codes: () => Codes,
|
|
6
7
|
emit: () => emit
|
|
7
8
|
});
|
|
9
|
+
var { createDeprecation, createWarning } = process_warning.default;
|
|
8
10
|
var verdaccioWarning = "VerdaccioWarning";
|
|
9
11
|
var Codes = /* @__PURE__ */ function(Codes) {
|
|
10
12
|
Codes["VERWAR001"] = "VERWAR001";
|
|
@@ -17,38 +19,38 @@ var Codes = /* @__PURE__ */ function(Codes) {
|
|
|
17
19
|
return Codes;
|
|
18
20
|
}({});
|
|
19
21
|
var warnings = {};
|
|
20
|
-
warnings[Codes.VERWAR001] =
|
|
22
|
+
warnings[Codes.VERWAR001] = createWarning({
|
|
21
23
|
name: verdaccioWarning,
|
|
22
24
|
code: Codes.VERWAR001,
|
|
23
25
|
message: `Verdaccio doesn't need superuser privileges. don't run it under root`
|
|
24
26
|
});
|
|
25
|
-
warnings[Codes.VERWAR002] =
|
|
27
|
+
warnings[Codes.VERWAR002] = createWarning({
|
|
26
28
|
name: verdaccioWarning,
|
|
27
29
|
code: Codes.VERWAR002,
|
|
28
30
|
message: `The configuration property "logs" has been deprecated, please rename to "log" for future compatibility`
|
|
29
31
|
});
|
|
30
|
-
warnings[Codes.VERWAR003] =
|
|
32
|
+
warnings[Codes.VERWAR003] = createWarning({
|
|
31
33
|
name: verdaccioWarning,
|
|
32
34
|
code: Codes.VERWAR003,
|
|
33
35
|
message: "rotating-file type is not longer supported, consider use [logrotate] instead"
|
|
34
36
|
});
|
|
35
|
-
warnings[Codes.VERWAR004] =
|
|
37
|
+
warnings[Codes.VERWAR004] = createWarning({
|
|
36
38
|
name: verdaccioWarning,
|
|
37
39
|
code: Codes.VERWAR004,
|
|
38
40
|
message: `invalid address - %s, we expect a port (e.g. "4873"),
|
|
39
41
|
host:port (e.g. "localhost:4873") or full url '(e.g. "http://localhost:4873/")
|
|
40
|
-
https://verdaccio.org/docs/
|
|
42
|
+
https://verdaccio.org/docs/configuration#listen-port`
|
|
41
43
|
});
|
|
42
|
-
warnings[Codes.VERWAR006] =
|
|
44
|
+
warnings[Codes.VERWAR006] = createDeprecation({
|
|
43
45
|
code: Codes.VERWAR006,
|
|
44
46
|
message: "the auth plugin method \"add_user\" in the auth plugin is deprecated and will be removed in next major release, rename to \"adduser\""
|
|
45
47
|
});
|
|
46
|
-
warnings[Codes.VERWAR007] =
|
|
48
|
+
warnings[Codes.VERWAR007] = createDeprecation({
|
|
47
49
|
code: Codes.VERWAR007,
|
|
48
50
|
message: `the secret length is too long, it must be 32 characters long, please consider generate a new one
|
|
49
51
|
Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`
|
|
50
52
|
});
|
|
51
|
-
warnings[Codes.VERDEP003] =
|
|
53
|
+
warnings[Codes.VERDEP003] = createDeprecation({
|
|
52
54
|
code: Codes.VERDEP003,
|
|
53
55
|
message: "multiple addresses will be deprecated in the next major, only use one"
|
|
54
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warning-utils.js","names":[],"sources":["../src/warning-utils.ts"],"sourcesContent":["import { createDeprecation, createWarning }
|
|
1
|
+
{"version":3,"file":"warning-utils.js","names":[],"sources":["../src/warning-utils.ts"],"sourcesContent":["import processWarning from 'process-warning';\n\nconst { createDeprecation, createWarning } = processWarning;\n\nconst verdaccioWarning = 'VerdaccioWarning';\n\nexport enum Codes {\n VERWAR001 = 'VERWAR001',\n VERWAR002 = 'VERWAR002',\n VERWAR003 = 'VERWAR003',\n VERWAR004 = 'VERWAR004',\n // deprecation warnings\n VERDEP003 = 'VERDEP003',\n VERWAR006 = 'VERWAR006',\n VERWAR007 = 'VERWAR007',\n}\n\n/* general warnings */\n\nconst warnings: Record<string, (a?: any, b?: any, c?: any) => void> = {};\n\nwarnings[Codes.VERWAR001] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR001,\n message: `Verdaccio doesn't need superuser privileges. don't run it under root`,\n});\n\nwarnings[Codes.VERWAR002] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR002,\n message: `The configuration property \"logs\" has been deprecated, please rename to \"log\" for future compatibility`,\n});\n\nwarnings[Codes.VERWAR003] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR003,\n message: 'rotating-file type is not longer supported, consider use [logrotate] instead',\n});\n\nwarnings[Codes.VERWAR004] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR004,\n message: `invalid address - %s, we expect a port (e.g. \"4873\"),\nhost:port (e.g. \"localhost:4873\") or full url '(e.g. \"http://localhost:4873/\")\nhttps://verdaccio.org/docs/configuration#listen-port`,\n});\n\nwarnings[Codes.VERWAR006] = createDeprecation({\n code: Codes.VERWAR006,\n message:\n 'the auth plugin method \"add_user\" in the auth plugin is deprecated and will be removed in next major release, rename to \"adduser\"',\n});\n\nwarnings[Codes.VERWAR007] = createDeprecation({\n code: Codes.VERWAR007,\n message: `the secret length is too long, it must be 32 characters long, please consider generate a new one\n Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`,\n});\n\n/* deprecation warnings */\n\nwarnings[Codes.VERDEP003] = createDeprecation({\n code: Codes.VERDEP003,\n message: 'multiple addresses will be deprecated in the next major, only use one',\n});\n\nexport function emit(code: string, a?: string, b?: string, c?: string) {\n const warning = warnings[code];\n if (warning) {\n warning(a, b, c);\n }\n}\n"],"mappings":";;;;;;;;AAEA,IAAM,EAAE,mBAAmB,kBAAkB,gBAAA;AAE7C,IAAM,mBAAmB;AAEzB,IAAY,QAAL,yBAAA,OAAA;AACL,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;AAEA,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;;KACD;AAID,IAAM,WAAgE,EAAE;AAExE,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;;;CAGV,CAAC;AAEF,SAAS,MAAM,aAAa,kBAAkB;CAC5C,MAAM,MAAM;CACZ,SACE;CACH,CAAC;AAEF,SAAS,MAAM,aAAa,kBAAkB;CAC5C,MAAM,MAAM;CACZ,SAAS;;CAEV,CAAC;AAIF,SAAS,MAAM,aAAa,kBAAkB;CAC5C,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAgB,KAAK,MAAc,GAAY,GAAY,GAAY;CACrE,MAAM,UAAU,SAAS;AACzB,KAAI,QACF,SAAQ,GAAG,GAAG,EAAE"}
|
package/build/warning-utils.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import
|
|
2
|
+
import processWarning from "process-warning";
|
|
3
3
|
//#region src/warning-utils.ts
|
|
4
4
|
var warning_utils_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
Codes: () => Codes,
|
|
6
6
|
emit: () => emit
|
|
7
7
|
});
|
|
8
|
+
var { createDeprecation, createWarning } = processWarning;
|
|
8
9
|
var verdaccioWarning = "VerdaccioWarning";
|
|
9
10
|
var Codes = /* @__PURE__ */ function(Codes) {
|
|
10
11
|
Codes["VERWAR001"] = "VERWAR001";
|
|
@@ -37,7 +38,7 @@ warnings[Codes.VERWAR004] = createWarning({
|
|
|
37
38
|
code: Codes.VERWAR004,
|
|
38
39
|
message: `invalid address - %s, we expect a port (e.g. "4873"),
|
|
39
40
|
host:port (e.g. "localhost:4873") or full url '(e.g. "http://localhost:4873/")
|
|
40
|
-
https://verdaccio.org/docs/
|
|
41
|
+
https://verdaccio.org/docs/configuration#listen-port`
|
|
41
42
|
});
|
|
42
43
|
warnings[Codes.VERWAR006] = createDeprecation({
|
|
43
44
|
code: Codes.VERWAR006,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warning-utils.mjs","names":[],"sources":["../src/warning-utils.ts"],"sourcesContent":["import { createDeprecation, createWarning }
|
|
1
|
+
{"version":3,"file":"warning-utils.mjs","names":[],"sources":["../src/warning-utils.ts"],"sourcesContent":["import processWarning from 'process-warning';\n\nconst { createDeprecation, createWarning } = processWarning;\n\nconst verdaccioWarning = 'VerdaccioWarning';\n\nexport enum Codes {\n VERWAR001 = 'VERWAR001',\n VERWAR002 = 'VERWAR002',\n VERWAR003 = 'VERWAR003',\n VERWAR004 = 'VERWAR004',\n // deprecation warnings\n VERDEP003 = 'VERDEP003',\n VERWAR006 = 'VERWAR006',\n VERWAR007 = 'VERWAR007',\n}\n\n/* general warnings */\n\nconst warnings: Record<string, (a?: any, b?: any, c?: any) => void> = {};\n\nwarnings[Codes.VERWAR001] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR001,\n message: `Verdaccio doesn't need superuser privileges. don't run it under root`,\n});\n\nwarnings[Codes.VERWAR002] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR002,\n message: `The configuration property \"logs\" has been deprecated, please rename to \"log\" for future compatibility`,\n});\n\nwarnings[Codes.VERWAR003] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR003,\n message: 'rotating-file type is not longer supported, consider use [logrotate] instead',\n});\n\nwarnings[Codes.VERWAR004] = createWarning({\n name: verdaccioWarning,\n code: Codes.VERWAR004,\n message: `invalid address - %s, we expect a port (e.g. \"4873\"),\nhost:port (e.g. \"localhost:4873\") or full url '(e.g. \"http://localhost:4873/\")\nhttps://verdaccio.org/docs/configuration#listen-port`,\n});\n\nwarnings[Codes.VERWAR006] = createDeprecation({\n code: Codes.VERWAR006,\n message:\n 'the auth plugin method \"add_user\" in the auth plugin is deprecated and will be removed in next major release, rename to \"adduser\"',\n});\n\nwarnings[Codes.VERWAR007] = createDeprecation({\n code: Codes.VERWAR007,\n message: `the secret length is too long, it must be 32 characters long, please consider generate a new one\n Learn more at https://verdaccio.org/docs/configuration/#.verdaccio-db`,\n});\n\n/* deprecation warnings */\n\nwarnings[Codes.VERDEP003] = createDeprecation({\n code: Codes.VERDEP003,\n message: 'multiple addresses will be deprecated in the next major, only use one',\n});\n\nexport function emit(code: string, a?: string, b?: string, c?: string) {\n const warning = warnings[code];\n if (warning) {\n warning(a, b, c);\n }\n}\n"],"mappings":";;;;;;;AAEA,IAAM,EAAE,mBAAmB,kBAAkB;AAE7C,IAAM,mBAAmB;AAEzB,IAAY,QAAL,yBAAA,OAAA;AACL,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;AAEA,OAAA,eAAA;AACA,OAAA,eAAA;AACA,OAAA,eAAA;;KACD;AAID,IAAM,WAAgE,EAAE;AAExE,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAS,MAAM,aAAa,cAAc;CACxC,MAAM;CACN,MAAM,MAAM;CACZ,SAAS;;;CAGV,CAAC;AAEF,SAAS,MAAM,aAAa,kBAAkB;CAC5C,MAAM,MAAM;CACZ,SACE;CACH,CAAC;AAEF,SAAS,MAAM,aAAa,kBAAkB;CAC5C,MAAM,MAAM;CACZ,SAAS;;CAEV,CAAC;AAIF,SAAS,MAAM,aAAa,kBAAkB;CAC5C,MAAM,MAAM;CACZ,SAAS;CACV,CAAC;AAEF,SAAgB,KAAK,MAAc,GAAY,GAAY,GAAY;CACrE,MAAM,UAAU,SAAS;AACzB,KAAI,QACF,SAAQ,GAAG,GAAG,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/core",
|
|
3
|
-
"version": "9.0.0-next-9.
|
|
3
|
+
"version": "9.0.0-next-9.6",
|
|
4
4
|
"description": "Verdaccio Core Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"private",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"semver": "7.7.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@verdaccio/types": "14.0.0-next-9.
|
|
44
|
+
"@verdaccio/types": "14.0.0-next-9.3",
|
|
45
45
|
"express": "5.2.1",
|
|
46
46
|
"typedoc": "0.28.14",
|
|
47
|
-
"vitest": "
|
|
47
|
+
"vitest": "4.1.0"
|
|
48
48
|
},
|
|
49
49
|
"funding": {
|
|
50
50
|
"type": "opencollective",
|