{"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;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,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