@verdaccio/core 9.0.0-next-9.29 → 9.0.0-next-9.31
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/constants.js +1 -1
- package/build/constants.js.map +1 -1
- package/build/constants.mjs +1 -1
- package/build/constants.mjs.map +1 -1
- package/build/error-utils.d.ts +16 -5
- package/build/error-utils.js +23 -12
- package/build/error-utils.js.map +1 -1
- package/build/error-utils.mjs +23 -12
- package/build/error-utils.mjs.map +1 -1
- package/build/search-utils.d.ts +2 -21
- package/build/search-utils.js.map +1 -1
- package/build/search-utils.mjs.map +1 -1
- package/package.json +3 -3
package/build/constants.js
CHANGED
|
@@ -83,7 +83,7 @@ var HEADERS = {
|
|
|
83
83
|
ETAG: "ETag",
|
|
84
84
|
JSON_CHARSET: "application/json; charset=utf-8",
|
|
85
85
|
JSON_INSTALL_CHARSET: "application/vnd.npm.install-v1+json; charset=utf-8",
|
|
86
|
-
OCTET_STREAM: "application/octet-stream
|
|
86
|
+
OCTET_STREAM: "application/octet-stream",
|
|
87
87
|
TEXT_CHARSET: "text/plain; charset=utf-8",
|
|
88
88
|
JAVASCRIPT_CHARSET: "application/javascript; charset=utf-8",
|
|
89
89
|
WWW_AUTH: "WWW-Authenticate",
|
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\nexport const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\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
|
|
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\nexport const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\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',\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 /** 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 /** 202: The request has been accepted for processing, but the processing is not yet complete. */\n ACCEPTED: httpCodes.ACCEPTED,\n /** 204: The request succeeded and the response carries no body. */\n NO_CONTENT: httpCodes.NO_CONTENT,\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 /** 499: The request was aborted by the client. */\n CLIENT_CLOSED_REQUEST: 499,\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}`;\nexport const LOG_VERDACCIO_ABORT = `${LOG_STATUS_MESSAGE}, request aborted by client`;\nexport const LOG_REQUEST_MESSAGE = \"@{ip} requested '@{req.method} @{req.url}'\";\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;AAC9B,IAAa,eAAe;AAE5B,IAAa,cAAc;CACzB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,iBAAiB;CACjB,eAAe;AACjB;AAEA,IAAa,qBAAqB,EAChC,MAAM,OACR;AAGA,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;AACR;;;;AAKA,IAAa,cAAc;;CAEzB,IAAI,kBAAA,QAAU;;CAEd,SAAS,kBAAA,QAAU;;CAEnB,UAAU,kBAAA,QAAU;;CAEpB,YAAY,kBAAA,QAAU;;CAEtB,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,uBAAuB;;CAEvB,gBAAgB,kBAAA,QAAU;;CAE1B,iBAAiB,kBAAA,QAAU;;CAE3B,aAAa,kBAAA,QAAU;;CAEvB,qBAAqB,kBAAA,QAAU;;CAE/B,iBAAiB,kBAAA,QAAU;;CAE3B,eAAe;;CAEf,eAAe;AACjB;AAEA,IAAa,aAAa,EACxB,gBAAgB,oBAClB;AAEA,IAAa,cAAc;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,eAAe;CACf,kBAAkB;CAClB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,WAAW;CACX,IAAI;CACJ,YAAY;AACd;AAEA,IAAa,qBACX;AACF,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB;AAEnC,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;AACxB;AAEA,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;AACP;AAEA,IAAY,wBAAL,yBAAA,uBAAA;CACL,sBAAA,SAAA;CACA,sBAAA,UAAA;CACA,sBAAA,WAAA;CACA,sBAAA,YAAA;;AACF,EAAA,CAAA,CAAA;AAEA,IAAa,gBAAgB;AAC7B,IAAa,mBAAmB;AAEhC,IAAa,kBAAkB;CAC7B,gBAAgB;CAChB,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,OAAO;AACT;AAEA,IAAa,eAAe;AAC5B,IAAa,mBAAmB;AAChC,IAAa,iBAAiB"}
|
package/build/constants.mjs
CHANGED
|
@@ -82,7 +82,7 @@ var HEADERS = {
|
|
|
82
82
|
ETAG: "ETag",
|
|
83
83
|
JSON_CHARSET: "application/json; charset=utf-8",
|
|
84
84
|
JSON_INSTALL_CHARSET: "application/vnd.npm.install-v1+json; charset=utf-8",
|
|
85
|
-
OCTET_STREAM: "application/octet-stream
|
|
85
|
+
OCTET_STREAM: "application/octet-stream",
|
|
86
86
|
TEXT_CHARSET: "text/plain; charset=utf-8",
|
|
87
87
|
JAVASCRIPT_CHARSET: "application/javascript; charset=utf-8",
|
|
88
88
|
WWW_AUTH: "WWW-Authenticate",
|
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\nexport const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\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
|
|
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\nexport const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\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',\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 /** 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 /** 202: The request has been accepted for processing, but the processing is not yet complete. */\n ACCEPTED: httpCodes.ACCEPTED,\n /** 204: The request succeeded and the response carries no body. */\n NO_CONTENT: httpCodes.NO_CONTENT,\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 /** 499: The request was aborted by the client. */\n CLIENT_CLOSED_REQUEST: 499,\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}`;\nexport const LOG_VERDACCIO_ABORT = `${LOG_STATUS_MESSAGE}, request aborted by client`;\nexport const LOG_REQUEST_MESSAGE = \"@{ip} requested '@{req.method} @{req.url}'\";\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;AAC9B,IAAa,eAAe;AAE5B,IAAa,cAAc;CACzB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,iBAAiB;CACjB,eAAe;AACjB;AAEA,IAAa,qBAAqB,EAChC,MAAM,OACR;AAGA,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;AACR;;;;AAKA,IAAa,cAAc;;CAEzB,IAAI,UAAU;;CAEd,SAAS,UAAU;;CAEnB,UAAU,UAAU;;CAEpB,YAAY,UAAU;;CAEtB,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,uBAAuB;;CAEvB,gBAAgB,UAAU;;CAE1B,iBAAiB,UAAU;;CAE3B,aAAa,UAAU;;CAEvB,qBAAqB,UAAU;;CAE/B,iBAAiB,UAAU;;CAE3B,eAAe;;CAEf,eAAe;AACjB;AAEA,IAAa,aAAa,EACxB,gBAAgB,oBAClB;AAEA,IAAa,cAAc;CACzB,aAAa;CACb,aAAa;CACb,aAAa;CACb,eAAe;CACf,kBAAkB;CAClB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,WAAW;CACX,IAAI;CACJ,YAAY;AACd;AAEA,IAAa,qBACX;AACF,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB,GAAG,mBAAmB;AACzD,IAAa,sBAAsB;AAEnC,IAAa,QAAQ;CACnB,MAAM;CACN,KAAK;CACL,OAAO;CACP,YAAY;CACZ,gBAAgB;CAChB,iBAAiB;CACjB,sBAAsB;AACxB;AAEA,IAAa,iBAAiB;CAC5B,OAAO;CACP,KAAK;AACP;AAEA,IAAY,wBAAL,yBAAA,uBAAA;CACL,sBAAA,SAAA;CACA,sBAAA,UAAA;CACA,sBAAA,WAAA;CACA,sBAAA,YAAA;;AACF,EAAA,CAAA,CAAA;AAEA,IAAa,gBAAgB;AAC7B,IAAa,mBAAmB;AAEhC,IAAa,kBAAkB;CAC7B,gBAAgB;CAChB,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,OAAO;AACT;AAEA,IAAa,eAAe;AAC5B,IAAa,mBAAmB;AAChC,IAAa,iBAAiB"}
|
package/build/error-utils.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export declare const API_ERROR: {
|
|
|
37
37
|
USERNAME_PASSWORD_REQUIRED: string;
|
|
38
38
|
USERNAME_ALREADY_REGISTERED: string;
|
|
39
39
|
USERNAME_MISMATCH: string;
|
|
40
|
+
NO_CREDENTIALS_PROVIDED: string;
|
|
41
|
+
CAN_NOT_USE_THIS_FILENAME: string;
|
|
40
42
|
SESSION_ID_REQUIRED: string;
|
|
41
43
|
SESSION_ID_INVALID: string;
|
|
42
44
|
SESSION_TOKEN_EXPIRED: string;
|
|
@@ -55,12 +57,21 @@ export declare const APP_ERROR: {
|
|
|
55
57
|
export type VerdaccioError = HttpError & {
|
|
56
58
|
code: number;
|
|
57
59
|
};
|
|
60
|
+
/** 409 Conflict. Defaults to {@link API_ERROR.PACKAGE_EXIST}. */
|
|
58
61
|
export declare function getConflict(message?: string): VerdaccioError;
|
|
59
|
-
|
|
60
|
-
export declare function
|
|
61
|
-
|
|
62
|
+
/** 422 Unprocessable Entity. Defaults to {@link API_ERROR.BAD_DATA}. */
|
|
63
|
+
export declare function getBadData(message?: string): VerdaccioError;
|
|
64
|
+
/** 400 Bad Request. */
|
|
65
|
+
export declare function getBadRequest(message: string): VerdaccioError;
|
|
66
|
+
/** 500 Internal Server Error. Defaults to {@link API_ERROR.UNKNOWN_ERROR}. */
|
|
67
|
+
export declare function getInternalError(message?: string): VerdaccioError;
|
|
68
|
+
/** 401 Unauthorized. Defaults to {@link API_ERROR.NO_CREDENTIALS_PROVIDED}. */
|
|
62
69
|
export declare function getUnauthorized(message?: string): VerdaccioError;
|
|
70
|
+
/** 403 Forbidden. Defaults to {@link API_ERROR.CAN_NOT_USE_THIS_FILENAME}. */
|
|
63
71
|
export declare function getForbidden(message?: string): VerdaccioError;
|
|
72
|
+
/** 503 Service Unavailable. Defaults to {@link API_ERROR.RESOURCE_UNAVAILABLE}. */
|
|
64
73
|
export declare function getServiceUnavailable(message?: string): VerdaccioError;
|
|
65
|
-
|
|
66
|
-
export declare function
|
|
74
|
+
/** 404 Not Found. Defaults to {@link API_ERROR.NO_PACKAGE}. */
|
|
75
|
+
export declare function getNotFound(message?: string): VerdaccioError;
|
|
76
|
+
/** Returns an error with a custom HTTP status code. */
|
|
77
|
+
export declare function getCode(statusCode: number, message: string): VerdaccioError;
|
package/build/error-utils.js
CHANGED
|
@@ -55,6 +55,8 @@ var API_ERROR = {
|
|
|
55
55
|
USERNAME_PASSWORD_REQUIRED: "username and password is required",
|
|
56
56
|
USERNAME_ALREADY_REGISTERED: "username is already registered",
|
|
57
57
|
USERNAME_MISMATCH: "username does not match logged in user",
|
|
58
|
+
NO_CREDENTIALS_PROVIDED: "no credentials provided",
|
|
59
|
+
CAN_NOT_USE_THIS_FILENAME: "can't use this filename",
|
|
58
60
|
SESSION_ID_REQUIRED: "session id is required",
|
|
59
61
|
SESSION_ID_INVALID: "session id is invalid",
|
|
60
62
|
SESSION_TOKEN_EXPIRED: "session token expired"
|
|
@@ -75,32 +77,41 @@ function getError(code, message) {
|
|
|
75
77
|
httpError.code = code;
|
|
76
78
|
return httpError;
|
|
77
79
|
}
|
|
80
|
+
/** 409 Conflict. Defaults to {@link API_ERROR.PACKAGE_EXIST}. */
|
|
78
81
|
function getConflict(message = API_ERROR.PACKAGE_EXIST) {
|
|
79
82
|
return getError(require_constants.HTTP_STATUS.CONFLICT, message);
|
|
80
83
|
}
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
/** 422 Unprocessable Entity. Defaults to {@link API_ERROR.BAD_DATA}. */
|
|
85
|
+
function getBadData(message = API_ERROR.BAD_DATA) {
|
|
86
|
+
return getError(require_constants.HTTP_STATUS.BAD_DATA, message);
|
|
83
87
|
}
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
/** 400 Bad Request. */
|
|
89
|
+
function getBadRequest(message) {
|
|
90
|
+
return getError(require_constants.HTTP_STATUS.BAD_REQUEST, message);
|
|
86
91
|
}
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
/** 500 Internal Server Error. Defaults to {@link API_ERROR.UNKNOWN_ERROR}. */
|
|
93
|
+
function getInternalError(message = API_ERROR.UNKNOWN_ERROR) {
|
|
94
|
+
return getError(require_constants.HTTP_STATUS.INTERNAL_ERROR, message);
|
|
89
95
|
}
|
|
90
|
-
|
|
96
|
+
/** 401 Unauthorized. Defaults to {@link API_ERROR.NO_CREDENTIALS_PROVIDED}. */
|
|
97
|
+
function getUnauthorized(message = API_ERROR.NO_CREDENTIALS_PROVIDED) {
|
|
91
98
|
return getError(require_constants.HTTP_STATUS.UNAUTHORIZED, message);
|
|
92
99
|
}
|
|
93
|
-
|
|
100
|
+
/** 403 Forbidden. Defaults to {@link API_ERROR.CAN_NOT_USE_THIS_FILENAME}. */
|
|
101
|
+
function getForbidden(message = API_ERROR.CAN_NOT_USE_THIS_FILENAME) {
|
|
94
102
|
return getError(require_constants.HTTP_STATUS.FORBIDDEN, message);
|
|
95
103
|
}
|
|
104
|
+
/** 503 Service Unavailable. Defaults to {@link API_ERROR.RESOURCE_UNAVAILABLE}. */
|
|
96
105
|
function getServiceUnavailable(message = API_ERROR.RESOURCE_UNAVAILABLE) {
|
|
97
106
|
return getError(require_constants.HTTP_STATUS.SERVICE_UNAVAILABLE, message);
|
|
98
107
|
}
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
/** 404 Not Found. Defaults to {@link API_ERROR.NO_PACKAGE}. */
|
|
109
|
+
function getNotFound(message = API_ERROR.NO_PACKAGE) {
|
|
110
|
+
return getError(require_constants.HTTP_STATUS.NOT_FOUND, message);
|
|
101
111
|
}
|
|
102
|
-
|
|
103
|
-
|
|
112
|
+
/** Returns an error with a custom HTTP status code. */
|
|
113
|
+
function getCode(statusCode, message) {
|
|
114
|
+
return getError(statusCode, message);
|
|
104
115
|
}
|
|
105
116
|
//#endregion
|
|
106
117
|
exports.API_ERROR = API_ERROR;
|
package/build/error-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-utils.js","names":[],"sources":["../src/error-utils.ts"],"sourcesContent":["import type { HttpError } from 'http-errors';\nimport createError from 'http-errors';\n\nimport { HTTP_STATUS } from './constants';\n\nexport const API_ERROR = {\n PASSWORD_SHORT: 'The provided password does not pass the validation',\n MUST_BE_LOGGED: 'You must be logged in to publish packages.',\n PLUGIN_ERROR: 'bug in the auth plugin system',\n CONFIG_BAD_FORMAT: 'config file must be an object',\n BAD_USERNAME_PASSWORD: 'bad username/password, access denied',\n NO_PACKAGE: 'no such package available',\n PACKAGE_CANNOT_BE_ADDED: 'this package cannot be added',\n BAD_DATA: 'bad data',\n NOT_ALLOWED: 'not allowed to access package',\n NOT_ALLOWED_PUBLISH: 'not allowed to publish package',\n INTERNAL_SERVER_ERROR: 'internal server error',\n UNKNOWN_ERROR: 'unknown error',\n NOT_PACKAGE_UPLINK: 'package does not exist on uplink',\n UPLINK_OFFLINE_PUBLISH: 'one of the uplinks is down, refuse to publish',\n UPLINK_OFFLINE: 'uplink is offline',\n NOT_MODIFIED_NO_DATA: 'no data',\n CONTENT_MISMATCH: 'content length mismatch',\n NOT_FILE_UPLINK: \"file doesn't exist on uplink\",\n MAX_USERS_REACHED: 'maximum amount of users reached',\n VERSION_NOT_EXIST: \"this version doesn't exist\",\n NO_SUCH_FILE: 'no such file available',\n UNSUPORTED_REGISTRY_CALL: 'unsupported registry call',\n FILE_NOT_FOUND: 'File not found',\n REGISTRATION_DISABLED: 'user registration disabled',\n UNAUTHORIZED_ACCESS: 'unauthorized access',\n BAD_STATUS_CODE: 'bad status code',\n SERVER_TIME_OUT: 'looks like the server is taking to long to respond',\n PACKAGE_EXIST: 'this package is already present',\n BAD_AUTH_HEADER: 'bad authorization header',\n WEB_DISABLED: 'Web interface is disabled in the config file',\n DEPRECATED_BASIC_HEADER: 'basic authentication is deprecated, please use JWT instead',\n BAD_FORMAT_USER_GROUP: 'user groups is different than an array',\n RESOURCE_UNAVAILABLE: 'resource unavailable',\n BAD_PACKAGE_DATA: 'bad incoming package data',\n USERNAME_PASSWORD_REQUIRED: 'username and password is required',\n USERNAME_ALREADY_REGISTERED: 'username is already registered',\n USERNAME_MISMATCH: 'username does not match logged in user',\n SESSION_ID_REQUIRED: 'session id is required',\n SESSION_ID_INVALID: 'session id is invalid',\n SESSION_TOKEN_EXPIRED: 'session token expired',\n};\n\nexport const SUPPORT_ERRORS = {\n PLUGIN_MISSING_INTERFACE: 'the plugin does not provide implementation of the requested feature',\n TFA_DISABLED: 'the two-factor authentication is not yet supported',\n STORAGE_NOT_IMPLEMENT: 'the storage does not support token saving',\n PARAMETERS_NOT_VALID: 'the parameters are not valid',\n};\n\nexport const APP_ERROR = {\n CONFIG_NOT_VALID: 'CONFIG: it does not look like a valid config file',\n PROFILE_ERROR: 'profile unexpected error',\n PASSWORD_VALIDATION: 'not valid password',\n};\n\nexport type VerdaccioError = HttpError & { code: number };\n\nfunction getError(code: number, message: string): VerdaccioError {\n const httpError = createError(code, message);\n\n httpError.code = code;\n\n return httpError as VerdaccioError;\n}\n\nexport function getConflict(message
|
|
1
|
+
{"version":3,"file":"error-utils.js","names":[],"sources":["../src/error-utils.ts"],"sourcesContent":["import type { HttpError } from 'http-errors';\nimport createError from 'http-errors';\n\nimport { HTTP_STATUS } from './constants';\n\nexport const API_ERROR = {\n PASSWORD_SHORT: 'The provided password does not pass the validation',\n MUST_BE_LOGGED: 'You must be logged in to publish packages.',\n PLUGIN_ERROR: 'bug in the auth plugin system',\n CONFIG_BAD_FORMAT: 'config file must be an object',\n BAD_USERNAME_PASSWORD: 'bad username/password, access denied',\n NO_PACKAGE: 'no such package available',\n PACKAGE_CANNOT_BE_ADDED: 'this package cannot be added',\n BAD_DATA: 'bad data',\n NOT_ALLOWED: 'not allowed to access package',\n NOT_ALLOWED_PUBLISH: 'not allowed to publish package',\n INTERNAL_SERVER_ERROR: 'internal server error',\n UNKNOWN_ERROR: 'unknown error',\n NOT_PACKAGE_UPLINK: 'package does not exist on uplink',\n UPLINK_OFFLINE_PUBLISH: 'one of the uplinks is down, refuse to publish',\n UPLINK_OFFLINE: 'uplink is offline',\n NOT_MODIFIED_NO_DATA: 'no data',\n CONTENT_MISMATCH: 'content length mismatch',\n NOT_FILE_UPLINK: \"file doesn't exist on uplink\",\n MAX_USERS_REACHED: 'maximum amount of users reached',\n VERSION_NOT_EXIST: \"this version doesn't exist\",\n NO_SUCH_FILE: 'no such file available',\n UNSUPORTED_REGISTRY_CALL: 'unsupported registry call',\n FILE_NOT_FOUND: 'File not found',\n REGISTRATION_DISABLED: 'user registration disabled',\n UNAUTHORIZED_ACCESS: 'unauthorized access',\n BAD_STATUS_CODE: 'bad status code',\n SERVER_TIME_OUT: 'looks like the server is taking to long to respond',\n PACKAGE_EXIST: 'this package is already present',\n BAD_AUTH_HEADER: 'bad authorization header',\n WEB_DISABLED: 'Web interface is disabled in the config file',\n DEPRECATED_BASIC_HEADER: 'basic authentication is deprecated, please use JWT instead',\n BAD_FORMAT_USER_GROUP: 'user groups is different than an array',\n RESOURCE_UNAVAILABLE: 'resource unavailable',\n BAD_PACKAGE_DATA: 'bad incoming package data',\n USERNAME_PASSWORD_REQUIRED: 'username and password is required',\n USERNAME_ALREADY_REGISTERED: 'username is already registered',\n USERNAME_MISMATCH: 'username does not match logged in user',\n NO_CREDENTIALS_PROVIDED: 'no credentials provided',\n CAN_NOT_USE_THIS_FILENAME: \"can't use this filename\",\n SESSION_ID_REQUIRED: 'session id is required',\n SESSION_ID_INVALID: 'session id is invalid',\n SESSION_TOKEN_EXPIRED: 'session token expired',\n};\n\nexport const SUPPORT_ERRORS = {\n PLUGIN_MISSING_INTERFACE: 'the plugin does not provide implementation of the requested feature',\n TFA_DISABLED: 'the two-factor authentication is not yet supported',\n STORAGE_NOT_IMPLEMENT: 'the storage does not support token saving',\n PARAMETERS_NOT_VALID: 'the parameters are not valid',\n};\n\nexport const APP_ERROR = {\n CONFIG_NOT_VALID: 'CONFIG: it does not look like a valid config file',\n PROFILE_ERROR: 'profile unexpected error',\n PASSWORD_VALIDATION: 'not valid password',\n};\n\nexport type VerdaccioError = HttpError & { code: number };\n\nfunction getError(code: number, message: string): VerdaccioError {\n const httpError = createError(code, message);\n\n httpError.code = code;\n\n return httpError as VerdaccioError;\n}\n\n/** 409 Conflict. Defaults to {@link API_ERROR.PACKAGE_EXIST}. */\nexport function getConflict(message = API_ERROR.PACKAGE_EXIST): VerdaccioError {\n return getError(HTTP_STATUS.CONFLICT, message);\n}\n\n/** 422 Unprocessable Entity. Defaults to {@link API_ERROR.BAD_DATA}. */\nexport function getBadData(message = API_ERROR.BAD_DATA): VerdaccioError {\n return getError(HTTP_STATUS.BAD_DATA, message);\n}\n\n/** 400 Bad Request. */\nexport function getBadRequest(message: string): VerdaccioError {\n return getError(HTTP_STATUS.BAD_REQUEST, message);\n}\n\n/** 500 Internal Server Error. Defaults to {@link API_ERROR.UNKNOWN_ERROR}. */\nexport function getInternalError(message = API_ERROR.UNKNOWN_ERROR): VerdaccioError {\n return getError(HTTP_STATUS.INTERNAL_ERROR, message);\n}\n\n/** 401 Unauthorized. Defaults to {@link API_ERROR.NO_CREDENTIALS_PROVIDED}. */\nexport function getUnauthorized(message = API_ERROR.NO_CREDENTIALS_PROVIDED): VerdaccioError {\n return getError(HTTP_STATUS.UNAUTHORIZED, message);\n}\n\n/** 403 Forbidden. Defaults to {@link API_ERROR.CAN_NOT_USE_THIS_FILENAME}. */\nexport function getForbidden(message = API_ERROR.CAN_NOT_USE_THIS_FILENAME): VerdaccioError {\n return getError(HTTP_STATUS.FORBIDDEN, message);\n}\n\n/** 503 Service Unavailable. Defaults to {@link API_ERROR.RESOURCE_UNAVAILABLE}. */\nexport function getServiceUnavailable(message = API_ERROR.RESOURCE_UNAVAILABLE): VerdaccioError {\n return getError(HTTP_STATUS.SERVICE_UNAVAILABLE, message);\n}\n\n/** 404 Not Found. Defaults to {@link API_ERROR.NO_PACKAGE}. */\nexport function getNotFound(message = API_ERROR.NO_PACKAGE): VerdaccioError {\n return getError(HTTP_STATUS.NOT_FOUND, message);\n}\n\n/** Returns an error with a custom HTTP status code. */\nexport function getCode(statusCode: number, message: string): VerdaccioError {\n return getError(statusCode, message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,IAAa,YAAY;CACvB,gBAAgB;CAChB,gBAAgB;CAChB,cAAc;CACd,mBAAmB;CACnB,uBAAuB;CACvB,YAAY;CACZ,yBAAyB;CACzB,UAAU;CACV,aAAa;CACb,qBAAqB;CACrB,uBAAuB;CACvB,eAAe;CACf,oBAAoB;CACpB,wBAAwB;CACxB,gBAAgB;CAChB,sBAAsB;CACtB,kBAAkB;CAClB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,cAAc;CACd,0BAA0B;CAC1B,gBAAgB;CAChB,uBAAuB;CACvB,qBAAqB;CACrB,iBAAiB;CACjB,iBAAiB;CACjB,eAAe;CACf,iBAAiB;CACjB,cAAc;CACd,yBAAyB;CACzB,uBAAuB;CACvB,sBAAsB;CACtB,kBAAkB;CAClB,4BAA4B;CAC5B,6BAA6B;CAC7B,mBAAmB;CACnB,yBAAyB;CACzB,2BAA2B;CAC3B,qBAAqB;CACrB,oBAAoB;CACpB,uBAAuB;AACzB;AAEA,IAAa,iBAAiB;CAC5B,0BAA0B;CAC1B,cAAc;CACd,uBAAuB;CACvB,sBAAsB;AACxB;AAEA,IAAa,YAAY;CACvB,kBAAkB;CAClB,eAAe;CACf,qBAAqB;AACvB;AAIA,SAAS,SAAS,MAAc,SAAiC;CAC/D,MAAM,aAAA,GAAY,YAAA,QAAA,CAAY,MAAM,OAAO;CAE3C,UAAU,OAAO;CAEjB,OAAO;AACT;;AAGA,SAAgB,YAAY,UAAU,UAAU,eAA+B;CAC7E,OAAO,SAAS,kBAAA,YAAY,UAAU,OAAO;AAC/C;;AAGA,SAAgB,WAAW,UAAU,UAAU,UAA0B;CACvE,OAAO,SAAS,kBAAA,YAAY,UAAU,OAAO;AAC/C;;AAGA,SAAgB,cAAc,SAAiC;CAC7D,OAAO,SAAS,kBAAA,YAAY,aAAa,OAAO;AAClD;;AAGA,SAAgB,iBAAiB,UAAU,UAAU,eAA+B;CAClF,OAAO,SAAS,kBAAA,YAAY,gBAAgB,OAAO;AACrD;;AAGA,SAAgB,gBAAgB,UAAU,UAAU,yBAAyC;CAC3F,OAAO,SAAS,kBAAA,YAAY,cAAc,OAAO;AACnD;;AAGA,SAAgB,aAAa,UAAU,UAAU,2BAA2C;CAC1F,OAAO,SAAS,kBAAA,YAAY,WAAW,OAAO;AAChD;;AAGA,SAAgB,sBAAsB,UAAU,UAAU,sBAAsC;CAC9F,OAAO,SAAS,kBAAA,YAAY,qBAAqB,OAAO;AAC1D;;AAGA,SAAgB,YAAY,UAAU,UAAU,YAA4B;CAC1E,OAAO,SAAS,kBAAA,YAAY,WAAW,OAAO;AAChD;;AAGA,SAAgB,QAAQ,YAAoB,SAAiC;CAC3E,OAAO,SAAS,YAAY,OAAO;AACrC"}
|
package/build/error-utils.mjs
CHANGED
|
@@ -54,6 +54,8 @@ var API_ERROR = {
|
|
|
54
54
|
USERNAME_PASSWORD_REQUIRED: "username and password is required",
|
|
55
55
|
USERNAME_ALREADY_REGISTERED: "username is already registered",
|
|
56
56
|
USERNAME_MISMATCH: "username does not match logged in user",
|
|
57
|
+
NO_CREDENTIALS_PROVIDED: "no credentials provided",
|
|
58
|
+
CAN_NOT_USE_THIS_FILENAME: "can't use this filename",
|
|
57
59
|
SESSION_ID_REQUIRED: "session id is required",
|
|
58
60
|
SESSION_ID_INVALID: "session id is invalid",
|
|
59
61
|
SESSION_TOKEN_EXPIRED: "session token expired"
|
|
@@ -74,32 +76,41 @@ function getError(code, message) {
|
|
|
74
76
|
httpError.code = code;
|
|
75
77
|
return httpError;
|
|
76
78
|
}
|
|
79
|
+
/** 409 Conflict. Defaults to {@link API_ERROR.PACKAGE_EXIST}. */
|
|
77
80
|
function getConflict(message = API_ERROR.PACKAGE_EXIST) {
|
|
78
81
|
return getError(HTTP_STATUS.CONFLICT, message);
|
|
79
82
|
}
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
/** 422 Unprocessable Entity. Defaults to {@link API_ERROR.BAD_DATA}. */
|
|
84
|
+
function getBadData(message = API_ERROR.BAD_DATA) {
|
|
85
|
+
return getError(HTTP_STATUS.BAD_DATA, message);
|
|
82
86
|
}
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
/** 400 Bad Request. */
|
|
88
|
+
function getBadRequest(message) {
|
|
89
|
+
return getError(HTTP_STATUS.BAD_REQUEST, message);
|
|
85
90
|
}
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
/** 500 Internal Server Error. Defaults to {@link API_ERROR.UNKNOWN_ERROR}. */
|
|
92
|
+
function getInternalError(message = API_ERROR.UNKNOWN_ERROR) {
|
|
93
|
+
return getError(HTTP_STATUS.INTERNAL_ERROR, message);
|
|
88
94
|
}
|
|
89
|
-
|
|
95
|
+
/** 401 Unauthorized. Defaults to {@link API_ERROR.NO_CREDENTIALS_PROVIDED}. */
|
|
96
|
+
function getUnauthorized(message = API_ERROR.NO_CREDENTIALS_PROVIDED) {
|
|
90
97
|
return getError(HTTP_STATUS.UNAUTHORIZED, message);
|
|
91
98
|
}
|
|
92
|
-
|
|
99
|
+
/** 403 Forbidden. Defaults to {@link API_ERROR.CAN_NOT_USE_THIS_FILENAME}. */
|
|
100
|
+
function getForbidden(message = API_ERROR.CAN_NOT_USE_THIS_FILENAME) {
|
|
93
101
|
return getError(HTTP_STATUS.FORBIDDEN, message);
|
|
94
102
|
}
|
|
103
|
+
/** 503 Service Unavailable. Defaults to {@link API_ERROR.RESOURCE_UNAVAILABLE}. */
|
|
95
104
|
function getServiceUnavailable(message = API_ERROR.RESOURCE_UNAVAILABLE) {
|
|
96
105
|
return getError(HTTP_STATUS.SERVICE_UNAVAILABLE, message);
|
|
97
106
|
}
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
/** 404 Not Found. Defaults to {@link API_ERROR.NO_PACKAGE}. */
|
|
108
|
+
function getNotFound(message = API_ERROR.NO_PACKAGE) {
|
|
109
|
+
return getError(HTTP_STATUS.NOT_FOUND, message);
|
|
100
110
|
}
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
/** Returns an error with a custom HTTP status code. */
|
|
112
|
+
function getCode(statusCode, message) {
|
|
113
|
+
return getError(statusCode, message);
|
|
103
114
|
}
|
|
104
115
|
//#endregion
|
|
105
116
|
export { API_ERROR, APP_ERROR, SUPPORT_ERRORS, error_utils_exports, getBadData, getBadRequest, getCode, getConflict, getForbidden, getInternalError, getNotFound, getServiceUnavailable, getUnauthorized };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-utils.mjs","names":[],"sources":["../src/error-utils.ts"],"sourcesContent":["import type { HttpError } from 'http-errors';\nimport createError from 'http-errors';\n\nimport { HTTP_STATUS } from './constants';\n\nexport const API_ERROR = {\n PASSWORD_SHORT: 'The provided password does not pass the validation',\n MUST_BE_LOGGED: 'You must be logged in to publish packages.',\n PLUGIN_ERROR: 'bug in the auth plugin system',\n CONFIG_BAD_FORMAT: 'config file must be an object',\n BAD_USERNAME_PASSWORD: 'bad username/password, access denied',\n NO_PACKAGE: 'no such package available',\n PACKAGE_CANNOT_BE_ADDED: 'this package cannot be added',\n BAD_DATA: 'bad data',\n NOT_ALLOWED: 'not allowed to access package',\n NOT_ALLOWED_PUBLISH: 'not allowed to publish package',\n INTERNAL_SERVER_ERROR: 'internal server error',\n UNKNOWN_ERROR: 'unknown error',\n NOT_PACKAGE_UPLINK: 'package does not exist on uplink',\n UPLINK_OFFLINE_PUBLISH: 'one of the uplinks is down, refuse to publish',\n UPLINK_OFFLINE: 'uplink is offline',\n NOT_MODIFIED_NO_DATA: 'no data',\n CONTENT_MISMATCH: 'content length mismatch',\n NOT_FILE_UPLINK: \"file doesn't exist on uplink\",\n MAX_USERS_REACHED: 'maximum amount of users reached',\n VERSION_NOT_EXIST: \"this version doesn't exist\",\n NO_SUCH_FILE: 'no such file available',\n UNSUPORTED_REGISTRY_CALL: 'unsupported registry call',\n FILE_NOT_FOUND: 'File not found',\n REGISTRATION_DISABLED: 'user registration disabled',\n UNAUTHORIZED_ACCESS: 'unauthorized access',\n BAD_STATUS_CODE: 'bad status code',\n SERVER_TIME_OUT: 'looks like the server is taking to long to respond',\n PACKAGE_EXIST: 'this package is already present',\n BAD_AUTH_HEADER: 'bad authorization header',\n WEB_DISABLED: 'Web interface is disabled in the config file',\n DEPRECATED_BASIC_HEADER: 'basic authentication is deprecated, please use JWT instead',\n BAD_FORMAT_USER_GROUP: 'user groups is different than an array',\n RESOURCE_UNAVAILABLE: 'resource unavailable',\n BAD_PACKAGE_DATA: 'bad incoming package data',\n USERNAME_PASSWORD_REQUIRED: 'username and password is required',\n USERNAME_ALREADY_REGISTERED: 'username is already registered',\n USERNAME_MISMATCH: 'username does not match logged in user',\n SESSION_ID_REQUIRED: 'session id is required',\n SESSION_ID_INVALID: 'session id is invalid',\n SESSION_TOKEN_EXPIRED: 'session token expired',\n};\n\nexport const SUPPORT_ERRORS = {\n PLUGIN_MISSING_INTERFACE: 'the plugin does not provide implementation of the requested feature',\n TFA_DISABLED: 'the two-factor authentication is not yet supported',\n STORAGE_NOT_IMPLEMENT: 'the storage does not support token saving',\n PARAMETERS_NOT_VALID: 'the parameters are not valid',\n};\n\nexport const APP_ERROR = {\n CONFIG_NOT_VALID: 'CONFIG: it does not look like a valid config file',\n PROFILE_ERROR: 'profile unexpected error',\n PASSWORD_VALIDATION: 'not valid password',\n};\n\nexport type VerdaccioError = HttpError & { code: number };\n\nfunction getError(code: number, message: string): VerdaccioError {\n const httpError = createError(code, message);\n\n httpError.code = code;\n\n return httpError as VerdaccioError;\n}\n\nexport function getConflict(message
|
|
1
|
+
{"version":3,"file":"error-utils.mjs","names":[],"sources":["../src/error-utils.ts"],"sourcesContent":["import type { HttpError } from 'http-errors';\nimport createError from 'http-errors';\n\nimport { HTTP_STATUS } from './constants';\n\nexport const API_ERROR = {\n PASSWORD_SHORT: 'The provided password does not pass the validation',\n MUST_BE_LOGGED: 'You must be logged in to publish packages.',\n PLUGIN_ERROR: 'bug in the auth plugin system',\n CONFIG_BAD_FORMAT: 'config file must be an object',\n BAD_USERNAME_PASSWORD: 'bad username/password, access denied',\n NO_PACKAGE: 'no such package available',\n PACKAGE_CANNOT_BE_ADDED: 'this package cannot be added',\n BAD_DATA: 'bad data',\n NOT_ALLOWED: 'not allowed to access package',\n NOT_ALLOWED_PUBLISH: 'not allowed to publish package',\n INTERNAL_SERVER_ERROR: 'internal server error',\n UNKNOWN_ERROR: 'unknown error',\n NOT_PACKAGE_UPLINK: 'package does not exist on uplink',\n UPLINK_OFFLINE_PUBLISH: 'one of the uplinks is down, refuse to publish',\n UPLINK_OFFLINE: 'uplink is offline',\n NOT_MODIFIED_NO_DATA: 'no data',\n CONTENT_MISMATCH: 'content length mismatch',\n NOT_FILE_UPLINK: \"file doesn't exist on uplink\",\n MAX_USERS_REACHED: 'maximum amount of users reached',\n VERSION_NOT_EXIST: \"this version doesn't exist\",\n NO_SUCH_FILE: 'no such file available',\n UNSUPORTED_REGISTRY_CALL: 'unsupported registry call',\n FILE_NOT_FOUND: 'File not found',\n REGISTRATION_DISABLED: 'user registration disabled',\n UNAUTHORIZED_ACCESS: 'unauthorized access',\n BAD_STATUS_CODE: 'bad status code',\n SERVER_TIME_OUT: 'looks like the server is taking to long to respond',\n PACKAGE_EXIST: 'this package is already present',\n BAD_AUTH_HEADER: 'bad authorization header',\n WEB_DISABLED: 'Web interface is disabled in the config file',\n DEPRECATED_BASIC_HEADER: 'basic authentication is deprecated, please use JWT instead',\n BAD_FORMAT_USER_GROUP: 'user groups is different than an array',\n RESOURCE_UNAVAILABLE: 'resource unavailable',\n BAD_PACKAGE_DATA: 'bad incoming package data',\n USERNAME_PASSWORD_REQUIRED: 'username and password is required',\n USERNAME_ALREADY_REGISTERED: 'username is already registered',\n USERNAME_MISMATCH: 'username does not match logged in user',\n NO_CREDENTIALS_PROVIDED: 'no credentials provided',\n CAN_NOT_USE_THIS_FILENAME: \"can't use this filename\",\n SESSION_ID_REQUIRED: 'session id is required',\n SESSION_ID_INVALID: 'session id is invalid',\n SESSION_TOKEN_EXPIRED: 'session token expired',\n};\n\nexport const SUPPORT_ERRORS = {\n PLUGIN_MISSING_INTERFACE: 'the plugin does not provide implementation of the requested feature',\n TFA_DISABLED: 'the two-factor authentication is not yet supported',\n STORAGE_NOT_IMPLEMENT: 'the storage does not support token saving',\n PARAMETERS_NOT_VALID: 'the parameters are not valid',\n};\n\nexport const APP_ERROR = {\n CONFIG_NOT_VALID: 'CONFIG: it does not look like a valid config file',\n PROFILE_ERROR: 'profile unexpected error',\n PASSWORD_VALIDATION: 'not valid password',\n};\n\nexport type VerdaccioError = HttpError & { code: number };\n\nfunction getError(code: number, message: string): VerdaccioError {\n const httpError = createError(code, message);\n\n httpError.code = code;\n\n return httpError as VerdaccioError;\n}\n\n/** 409 Conflict. Defaults to {@link API_ERROR.PACKAGE_EXIST}. */\nexport function getConflict(message = API_ERROR.PACKAGE_EXIST): VerdaccioError {\n return getError(HTTP_STATUS.CONFLICT, message);\n}\n\n/** 422 Unprocessable Entity. Defaults to {@link API_ERROR.BAD_DATA}. */\nexport function getBadData(message = API_ERROR.BAD_DATA): VerdaccioError {\n return getError(HTTP_STATUS.BAD_DATA, message);\n}\n\n/** 400 Bad Request. */\nexport function getBadRequest(message: string): VerdaccioError {\n return getError(HTTP_STATUS.BAD_REQUEST, message);\n}\n\n/** 500 Internal Server Error. Defaults to {@link API_ERROR.UNKNOWN_ERROR}. */\nexport function getInternalError(message = API_ERROR.UNKNOWN_ERROR): VerdaccioError {\n return getError(HTTP_STATUS.INTERNAL_ERROR, message);\n}\n\n/** 401 Unauthorized. Defaults to {@link API_ERROR.NO_CREDENTIALS_PROVIDED}. */\nexport function getUnauthorized(message = API_ERROR.NO_CREDENTIALS_PROVIDED): VerdaccioError {\n return getError(HTTP_STATUS.UNAUTHORIZED, message);\n}\n\n/** 403 Forbidden. Defaults to {@link API_ERROR.CAN_NOT_USE_THIS_FILENAME}. */\nexport function getForbidden(message = API_ERROR.CAN_NOT_USE_THIS_FILENAME): VerdaccioError {\n return getError(HTTP_STATUS.FORBIDDEN, message);\n}\n\n/** 503 Service Unavailable. Defaults to {@link API_ERROR.RESOURCE_UNAVAILABLE}. */\nexport function getServiceUnavailable(message = API_ERROR.RESOURCE_UNAVAILABLE): VerdaccioError {\n return getError(HTTP_STATUS.SERVICE_UNAVAILABLE, message);\n}\n\n/** 404 Not Found. Defaults to {@link API_ERROR.NO_PACKAGE}. */\nexport function getNotFound(message = API_ERROR.NO_PACKAGE): VerdaccioError {\n return getError(HTTP_STATUS.NOT_FOUND, message);\n}\n\n/** Returns an error with a custom HTTP status code. */\nexport function getCode(statusCode: number, message: string): VerdaccioError {\n return getError(statusCode, message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,IAAa,YAAY;CACvB,gBAAgB;CAChB,gBAAgB;CAChB,cAAc;CACd,mBAAmB;CACnB,uBAAuB;CACvB,YAAY;CACZ,yBAAyB;CACzB,UAAU;CACV,aAAa;CACb,qBAAqB;CACrB,uBAAuB;CACvB,eAAe;CACf,oBAAoB;CACpB,wBAAwB;CACxB,gBAAgB;CAChB,sBAAsB;CACtB,kBAAkB;CAClB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,cAAc;CACd,0BAA0B;CAC1B,gBAAgB;CAChB,uBAAuB;CACvB,qBAAqB;CACrB,iBAAiB;CACjB,iBAAiB;CACjB,eAAe;CACf,iBAAiB;CACjB,cAAc;CACd,yBAAyB;CACzB,uBAAuB;CACvB,sBAAsB;CACtB,kBAAkB;CAClB,4BAA4B;CAC5B,6BAA6B;CAC7B,mBAAmB;CACnB,yBAAyB;CACzB,2BAA2B;CAC3B,qBAAqB;CACrB,oBAAoB;CACpB,uBAAuB;AACzB;AAEA,IAAa,iBAAiB;CAC5B,0BAA0B;CAC1B,cAAc;CACd,uBAAuB;CACvB,sBAAsB;AACxB;AAEA,IAAa,YAAY;CACvB,kBAAkB;CAClB,eAAe;CACf,qBAAqB;AACvB;AAIA,SAAS,SAAS,MAAc,SAAiC;CAC/D,MAAM,YAAY,YAAY,MAAM,OAAO;CAE3C,UAAU,OAAO;CAEjB,OAAO;AACT;;AAGA,SAAgB,YAAY,UAAU,UAAU,eAA+B;CAC7E,OAAO,SAAS,YAAY,UAAU,OAAO;AAC/C;;AAGA,SAAgB,WAAW,UAAU,UAAU,UAA0B;CACvE,OAAO,SAAS,YAAY,UAAU,OAAO;AAC/C;;AAGA,SAAgB,cAAc,SAAiC;CAC7D,OAAO,SAAS,YAAY,aAAa,OAAO;AAClD;;AAGA,SAAgB,iBAAiB,UAAU,UAAU,eAA+B;CAClF,OAAO,SAAS,YAAY,gBAAgB,OAAO;AACrD;;AAGA,SAAgB,gBAAgB,UAAU,UAAU,yBAAyC;CAC3F,OAAO,SAAS,YAAY,cAAc,OAAO;AACnD;;AAGA,SAAgB,aAAa,UAAU,UAAU,2BAA2C;CAC1F,OAAO,SAAS,YAAY,WAAW,OAAO;AAChD;;AAGA,SAAgB,sBAAsB,UAAU,UAAU,sBAAsC;CAC9F,OAAO,SAAS,YAAY,qBAAqB,OAAO;AAC1D;;AAGA,SAAgB,YAAY,UAAU,UAAU,YAA4B;CAC1E,OAAO,SAAS,YAAY,WAAW,OAAO;AAChD;;AAGA,SAAgB,QAAQ,YAAoB,SAAiC;CAC3E,OAAO,SAAS,YAAY,OAAO;AACrC"}
|
package/build/search-utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SearchPackageBody as _SearchPackageBody } from '@verdaccio/types';
|
|
1
2
|
export type SearchMetrics = {
|
|
2
3
|
quality: number;
|
|
3
4
|
popularity: number;
|
|
@@ -31,27 +32,7 @@ export type SearchResults = {
|
|
|
31
32
|
total: number;
|
|
32
33
|
time: string;
|
|
33
34
|
};
|
|
34
|
-
type
|
|
35
|
-
username: string;
|
|
36
|
-
email: string;
|
|
37
|
-
};
|
|
38
|
-
export type SearchPackageBody = {
|
|
39
|
-
name: string;
|
|
40
|
-
scope: string;
|
|
41
|
-
description: string;
|
|
42
|
-
author: string | PublisherMaintainer;
|
|
43
|
-
version: string;
|
|
44
|
-
keywords: string | string[] | undefined;
|
|
45
|
-
date: string;
|
|
46
|
-
links?: {
|
|
47
|
-
npm: string;
|
|
48
|
-
homepage?: string;
|
|
49
|
-
repository?: string;
|
|
50
|
-
bugs?: string;
|
|
51
|
-
};
|
|
52
|
-
publisher?: any;
|
|
53
|
-
maintainers?: PublisherMaintainer[];
|
|
54
|
-
};
|
|
35
|
+
export type SearchPackageBody = _SearchPackageBody;
|
|
55
36
|
export interface SearchPackageItem extends UnStable, PrivatePackage {
|
|
56
37
|
package: SearchPackageBody;
|
|
57
38
|
score: Score;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-utils.js","names":[],"sources":["../src/search-utils.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"search-utils.js","names":[],"sources":["../src/search-utils.ts"],"sourcesContent":["import type { SearchPackageBody as _SearchPackageBody } from '@verdaccio/types';\n\nexport type SearchMetrics = {\n quality: number;\n popularity: number;\n maintenance: number;\n};\nexport type UnStable = {\n flags?: {\n // if is false is not be included in search results (majority are stable)\n unstable?: boolean;\n };\n};\nexport type SearchItemPkg = {\n name: string;\n scoped?: string;\n path?: string;\n time?: number | Date;\n};\n\ntype PrivatePackage = {\n // note: prefixed to avoid external conflicts\n\n // the package is published as private\n verdaccioPrivate?: boolean;\n // if the package is not private but is cached\n verdaccioPkgCached?: boolean;\n};\n\nexport interface SearchItem extends UnStable, PrivatePackage {\n package: SearchItemPkg;\n score: Score;\n}\n\nexport type Score = {\n final: number;\n detail: SearchMetrics;\n};\n\nexport type SearchResults = {\n objects: SearchItemPkg[];\n total: number;\n time: string;\n};\n\nexport type SearchPackageBody = _SearchPackageBody;\n\nexport interface SearchPackageItem extends UnStable, PrivatePackage {\n package: SearchPackageBody;\n score: Score;\n searchScore?: number;\n}\n\nexport const UNSCOPED = 'unscoped';\n\nexport type SearchQuery = {\n text: string;\n size?: number;\n from?: number;\n} & SearchMetrics;\n"],"mappings":";;AAqDA,IAAa,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-utils.mjs","names":[],"sources":["../src/search-utils.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"search-utils.mjs","names":[],"sources":["../src/search-utils.ts"],"sourcesContent":["import type { SearchPackageBody as _SearchPackageBody } from '@verdaccio/types';\n\nexport type SearchMetrics = {\n quality: number;\n popularity: number;\n maintenance: number;\n};\nexport type UnStable = {\n flags?: {\n // if is false is not be included in search results (majority are stable)\n unstable?: boolean;\n };\n};\nexport type SearchItemPkg = {\n name: string;\n scoped?: string;\n path?: string;\n time?: number | Date;\n};\n\ntype PrivatePackage = {\n // note: prefixed to avoid external conflicts\n\n // the package is published as private\n verdaccioPrivate?: boolean;\n // if the package is not private but is cached\n verdaccioPkgCached?: boolean;\n};\n\nexport interface SearchItem extends UnStable, PrivatePackage {\n package: SearchItemPkg;\n score: Score;\n}\n\nexport type Score = {\n final: number;\n detail: SearchMetrics;\n};\n\nexport type SearchResults = {\n objects: SearchItemPkg[];\n total: number;\n time: string;\n};\n\nexport type SearchPackageBody = _SearchPackageBody;\n\nexport interface SearchPackageItem extends UnStable, PrivatePackage {\n package: SearchPackageBody;\n score: Score;\n searchScore?: number;\n}\n\nexport const UNSCOPED = 'unscoped';\n\nexport type SearchQuery = {\n text: string;\n size?: number;\n from?: number;\n} & SearchMetrics;\n"],"mappings":";;;AAqDA,IAAa,WAAW"}
|
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.31",
|
|
4
4
|
"description": "Verdaccio Core Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"private",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"semver": "7.8.5"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@verdaccio/types": "14.0.0-next-9.
|
|
45
|
+
"@verdaccio/types": "14.0.0-next-9.14",
|
|
46
46
|
"express": "5.2.1",
|
|
47
47
|
"rimraf": "6.1.3",
|
|
48
48
|
"typedoc": "0.28.14",
|
|
49
|
-
"vite": "8.2.
|
|
49
|
+
"vite": "8.2.2",
|
|
50
50
|
"vitest": "4.1.10"
|
|
51
51
|
},
|
|
52
52
|
"funding": {
|