@zthun/webigail-http 4.0.1 → 4.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/request/http-request.mts","../src/result/http-code-client.mts","../src/result/http-code-informational-response.mts","../src/result/http-code-redirection.mts","../src/result/http-code-server.mts","../src/result/http-code-success.mts","../src/result/http-code.mts","../src/result/http-result.mts","../src/service/http-service-mock.mts","../src/util/body-init.mts","../src/util/content-type.mts","../src/service/http-service.mts"],"sourcesContent":["/**\n * Represents an available method for an http invocation.\n */\nexport enum ZHttpMethod {\n /**\n * GET\n *\n * Used for reads\n */\n Get = \"GET\",\n\n /**\n * PUT\n *\n * Used for updates and can combine creates.\n */\n Put = \"PUT\",\n\n /**\n * POST\n *\n * Use for create.\n */\n Post = \"POST\",\n\n /**\n * DELETE.\n *\n * Used for....delete..duh.\n */\n Delete = \"DELETE\",\n\n /**\n * PATCH.\n *\n * Used for updates but only\n * partials of objects.\n */\n Patch = \"PATCH\",\n\n /**\n * OPTIONS\n *\n * Used to retrieve the available methods and\n * accessors for a single api. Normally used\n * by the browser.\n */\n Options = \"OPTIONS\",\n\n /**\n * HEAD\n *\n * Used for metadata.\n */\n Head = \"HEAD\",\n}\n\n/**\n * Represents a http request.\n */\nexport interface IZHttpRequest<TBody = any> {\n /**\n * The method, or verb, to invoke the request with.\n */\n method: ZHttpMethod;\n\n /**\n * The url to target.\n */\n url: string;\n\n /**\n * The post body.\n *\n * Only should really be used for POST style\n * calls which accept a body.\n */\n body?: TBody;\n\n /**\n * Request headers.\n */\n headers?: Record<string, string>;\n\n /**\n * The timeout before the rest method fails\n */\n timeout?: number;\n}\n\n/**\n * Represents a builder for an http request.\n */\nexport class ZHttpRequestBuilder<TBody = any> {\n private _request: IZHttpRequest<TBody>;\n\n /**\n * Duplicates a request, keeping it's structure intact.\n *\n * The underlying headers will be duplicated, but everything\n * else will be a shallow copy to preserve the body in the\n * case that it is a blob or other binary structure.\n *\n * @param other -\n * The request to duplicate.\n *\n * @returns\n * The duplicated object.\n */\n public static duplicate<TBody>(\n other: IZHttpRequest<TBody>,\n ): IZHttpRequest<TBody> {\n return { ...other, headers: structuredClone(other.headers) };\n }\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this._request = {\n method: ZHttpMethod.Get,\n url: \"\",\n };\n }\n\n /**\n * Sets the method.\n *\n * @param method -\n * The method to set.\n * @param body -\n * The post, put, or patch body.\n *\n * @returns\n * This object.\n */\n private _method(method: ZHttpMethod, body?: TBody): this {\n this._request.method = method;\n\n this._request.body = body;\n\n if (this._request.body === undefined) {\n delete this._request.body;\n }\n return this;\n }\n\n /**\n * Constructs a get request.\n *\n * @returns\n * This object.\n */\n public get: () => this = this._method.bind(this, ZHttpMethod.Get);\n\n /**\n * Constructs a post request.\n *\n * @returns\n * This object.\n */\n public post: (body?: TBody) => this = this._method.bind(\n this,\n ZHttpMethod.Post,\n );\n\n /**\n * Constructs a put request.\n *\n * @returns\n * This object.\n */\n public put: (body?: TBody) => this = this._method.bind(this, ZHttpMethod.Put);\n\n /**\n * Constructs a delete request.\n *\n * @returns\n * This object.\n */\n public delete: () => this = this._method.bind(this, ZHttpMethod.Delete);\n\n /**\n * Constructs a patch request.\n *\n * @returns\n * This object.\n */\n public patch: (body?: TBody) => this = this._method.bind(\n this,\n ZHttpMethod.Patch,\n );\n\n /**\n * Constructs a options request.\n *\n * @returns\n * This object.\n */\n public options: () => this = this._method.bind(this, ZHttpMethod.Options);\n\n /**\n * Constructs a head request.\n *\n * @returns\n * This object.\n */\n public head: () => this = this._method.bind(this, ZHttpMethod.Head);\n\n /**\n * Sets the url to make the request from.\n *\n * @param url -\n * The url to make the request to.\n *\n * @returns\n * This object.\n */\n public url(url: string): this {\n this._request.url = url;\n return this;\n }\n\n /**\n * Sets the timeout for the url.\n *\n * @param ms -\n * The total number of milliseconds to wait.\n *\n * @returns\n * The object.\n */\n public timeout(ms: number): this {\n this._request.timeout = ms;\n return this;\n }\n\n /**\n * Sets the headers.\n *\n * @param headers -\n * The headers to set.\n *\n * @returns\n * This object.\n */\n public headers(headers: Record<string, string>): this {\n this._request.headers = headers;\n return this;\n }\n\n /**\n * Sets an individual header.\n *\n * @param key -\n * The header key to set.\n * @param value -\n * The value to set.\n *\n * @returns\n * This object.\n */\n public header(key: string, value: string | number | boolean | null): this {\n this._request.headers = this._request.headers || {};\n\n if (value == null) {\n delete this._request.headers[key];\n } else {\n this._request.headers[key] = `${value}`;\n }\n\n return this;\n }\n\n /**\n * Copies other to this object.\n *\n * @param other -\n * The request to copy.\n *\n * @returns\n * This object.\n */\n public copy(other: IZHttpRequest): this {\n this._request = ZHttpRequestBuilder.duplicate(other);\n return this;\n }\n\n /**\n * Returns the constructed request.\n *\n * @returns\n * The constructed request.\n */\n public build(): IZHttpRequest {\n return ZHttpRequestBuilder.duplicate(this._request);\n }\n}\n","/**\n * This class of status code is intended for situations in which the error seems to have been caused by the client.\n *\n * Except when responding to a HEAD request, the server should include an entity containing an explanation\n * of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable\n * to any request method. User agents should display any included entity to the user.\n */\nexport enum ZHttpCodeClient {\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, size too large, invalid request message framing,\n * or deceptive request routing).\n */\n BadRequest = 400,\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed\n * or has not yet been provided.\n *\n * The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401\n * semantically means \"unauthenticated\",[35] i.e. the user does not have the necessary credentials.\n *\n * Note: Some sites issue HTTP 401 when an IP address is banned from the website (usually the website domain)\n * and that specific address is refused permission to access a website.\n */\n Unauthorized = 401,\n /**\n * Reserved for future use.\n *\n * The original intention was that this code might be used as part of some form of digital cash or\n * micro-payment scheme, as proposed for example by GNU Taler, but that has not yet happened, and\n * this code is not usually used. Google Developers API uses this status if a particular developer\n * has exceeded the daily limit on requests\n */\n PaymentRequired = 402,\n /**\n * The request was valid, but the server is refusing action.\n *\n * The user might not have the necessary permissions for a resource, or may need an account of some sort.\n */\n Forbidden = 403,\n /**\n * The requested resource could not be found but may be available in the future.\n *\n * Subsequent requests by the client are permissible.\n */\n NotFound = 404,\n /**\n * A request method is not supported for the requested resource; for example, a GET\n * request on a form that requires data to be presented via POST, or a PUT request on\n * a read-only resource.\n */\n MethodNotAllowed = 405,\n /**\n * The requested resource is capable of generating only content not acceptable according\n * to the Accept headers sent in the request.\n */\n NotAcceptable = 406,\n /**\n * The client must first authenticate itself with the proxy.\n */\n ProxyAuthenticationRequired = 407,\n /**\n * The server timed out waiting for the request.\n *\n * According to HTTP specifications: \"The client did not produce a request within the\n * time that the server was prepared to wait. The client MAY repeat the request without\n * modifications at any later time.\n */\n RequestTimeout = 408,\n /**\n * Indicates that the request could not be processed because of conflict in the request, such\n * as an edit conflict between multiple simultaneous updates.\n */\n Conflict = 409,\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n *\n * This should be used when a resource has been intentionally removed and the resource should be\n * purged. Upon receiving a 410 status code, the client should not request the resource in the\n * future. Clients such as search engines should remove the resource from their indices. Most use\n * cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may\n * be used instead.\n */\n Gone = 410,\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LengthRequired = 411,\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PreconditionFailed = 412,\n /**\n * The request is larger than the server is willing or able to process. Previously called\n * \"Request Entity Too Large\".\n */\n PayloadTooLarge = 413,\n /**\n * The URI provided was too long for the server to process.\n *\n * Often the result of too much data being encoded as a query-string of\n * a GET request, in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n URITooLong = 414,\n /**\n * The request entity has a media type which the server or resource does not support.\n *\n * For example, the client uploads an image as image/svg+xml, but the server requires that\n * images use a different format.\n */\n UnsupportedMediaType = 415,\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n *\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RangeNotSatisfiable = 416,\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n ExpectationFailed = 417,\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper\n * Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers.\n *\n * The RFC specifies this code should be returned by teapots requested to brew coffee. This HTTP\n * status is used as an Easter egg in some websites, including Google.com.\n */\n ImATeapot = 418,\n /**\n * The request was directed at a server that is not able to produce a response[53] (for example because of connection reuse).\n */\n MisdirectedRequest = 421,\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UnProcessableEntity = 422,\n /**\n * The resource that is being accessed is locked.\n */\n Locked = 423,\n /**\n * The request failed because it depended on another request and that request failed.\n */\n FailedDependency = 424,\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UpgradeRequired = 426,\n /**\n * The origin server requires the request to be conditional.\n *\n * Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it,\n * and PUTs it back to the server, when meanwhile a third party has modified the state on the server,\n * leading to a conflict.\n */\n PreconditionRequired = 428,\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TooManyRequests = 429,\n /**\n * The server is unwilling to process the request because either an individual header field, or all the\n * header fields collectively, are too large.[\n */\n RequestHeaderFieldsTooLarge = 431,\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources that includes the\n * requested resource.\n *\n * The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UnavailableForLegalReasons = 451,\n}\n\n/**\n * English friendly names of the codes.\n */\nexport const ZHttpCodeClientNames: Record<ZHttpCodeClient, string> = {\n [ZHttpCodeClient.BadRequest]: \"Bad Request\",\n [ZHttpCodeClient.Unauthorized]: \"Unauthorized\",\n [ZHttpCodeClient.PaymentRequired]: \"Payment Required\",\n [ZHttpCodeClient.Forbidden]: \"Forbidden\",\n [ZHttpCodeClient.NotFound]: \"Not Found\",\n [ZHttpCodeClient.MethodNotAllowed]: \"Method not Allowed\",\n [ZHttpCodeClient.NotAcceptable]: \"Not Acceptable\",\n [ZHttpCodeClient.ProxyAuthenticationRequired]:\n \"Proxy Authentication Required\",\n [ZHttpCodeClient.RequestTimeout]: \"Request Timeout\",\n [ZHttpCodeClient.Conflict]: \"Conflict\",\n [ZHttpCodeClient.Gone]: \"Gone\",\n [ZHttpCodeClient.LengthRequired]: \"Length Required\",\n [ZHttpCodeClient.PreconditionFailed]: \"Precondition Failed\",\n [ZHttpCodeClient.PayloadTooLarge]: \"Payload Too Large\",\n [ZHttpCodeClient.URITooLong]: \"URI Too Long\",\n [ZHttpCodeClient.UnsupportedMediaType]: \"Unsupported Media Type\",\n [ZHttpCodeClient.RangeNotSatisfiable]: \"Range Not Satisfiable\",\n [ZHttpCodeClient.ExpectationFailed]: \"Expectation Failed\",\n [ZHttpCodeClient.ImATeapot]: \"I am a Teapot\",\n [ZHttpCodeClient.MisdirectedRequest]: \"Misdirected Requested\",\n [ZHttpCodeClient.UnProcessableEntity]: \"Entity Not Processable\",\n [ZHttpCodeClient.Locked]: \"Locked\",\n [ZHttpCodeClient.FailedDependency]: \"Failed Dependency\",\n [ZHttpCodeClient.UpgradeRequired]: \"Upgrade Required\",\n [ZHttpCodeClient.PreconditionRequired]: \"Precondition Required\",\n [ZHttpCodeClient.TooManyRequests]: \"Too Many Requests\",\n [ZHttpCodeClient.RequestHeaderFieldsTooLarge]:\n \"Request Header Fields Too Large\",\n [ZHttpCodeClient.UnavailableForLegalReasons]: \"Unavailable for Legal Reasons\",\n};\n\n/**\n * English friendly descriptions of HttpClientCodes\n */\nexport const ZHttpCodeClientDescriptions: Record<ZHttpCodeClient, string> = {\n [ZHttpCodeClient.BadRequest]: \"A bad request was sent.\",\n [ZHttpCodeClient.Unauthorized]:\n \"You are not authenticated and cannot view this content.\",\n [ZHttpCodeClient.PaymentRequired]: \"Payment is required\",\n [ZHttpCodeClient.Forbidden]: \"You are not authorized to view this content.\",\n [ZHttpCodeClient.NotFound]:\n \"The resource you are looking for could not be found.\",\n [ZHttpCodeClient.MethodNotAllowed]:\n \"The requested operation was not allowed.\",\n [ZHttpCodeClient.NotAcceptable]:\n \"The requested resource is not capable of generating the content for you.\",\n [ZHttpCodeClient.ProxyAuthenticationRequired]:\n \"You must first authenticate your self with the proxy.\",\n [ZHttpCodeClient.RequestTimeout]:\n \"The server timed out waiting for a request. Please try again.\",\n [ZHttpCodeClient.Conflict]:\n \"There was a conflict with request. Try something else.\",\n [ZHttpCodeClient.Gone]: \"The resource you requested is no longer available.\",\n [ZHttpCodeClient.LengthRequired]:\n \"Your request did not specify the length of its content, which is required by the requested resource.\",\n [ZHttpCodeClient.PreconditionFailed]:\n \"The server did not meet the requirements that was required to meet the request.\",\n [ZHttpCodeClient.PayloadTooLarge]:\n \"The request is too large and the server cannot handle it.\",\n [ZHttpCodeClient.URITooLong]:\n \"The URI provided was too long for the server to process.\",\n [ZHttpCodeClient.UnsupportedMediaType]:\n \"The media type requested is not supported by the server.\",\n [ZHttpCodeClient.RangeNotSatisfiable]:\n \"A portion of the file was requested by the server cannot supply said portion.\",\n [ZHttpCodeClient.ExpectationFailed]:\n \"The server cannot meet the requirements of the expectation made of it.\",\n [ZHttpCodeClient.ImATeapot]:\n \"Short and stout. Here is my handle, here is my spout. When I get all steamed up, hear me shout. Tip me over and pour me out!\",\n [ZHttpCodeClient.MisdirectedRequest]:\n \"The request was directed at the server, but the server cannot produce a response.\",\n [ZHttpCodeClient.UnProcessableEntity]:\n \"The request was well-formed but was unable to be followed due to semantic errors.\",\n [ZHttpCodeClient.Locked]: \"The resource that is being accessed is locked.\",\n [ZHttpCodeClient.FailedDependency]:\n \"The request failed because it depended on another request and that request failed.\",\n [ZHttpCodeClient.UpgradeRequired]:\n \"The client needs to switch to a different protocol.\",\n [ZHttpCodeClient.PreconditionRequired]:\n \"The origin server requires the request to be conditional.\",\n [ZHttpCodeClient.TooManyRequests]:\n \"The user has sent too many requests in a given amount of time.\",\n [ZHttpCodeClient.RequestHeaderFieldsTooLarge]:\n \"The request cannot be processed because the collective header fields are too large.\",\n [ZHttpCodeClient.UnavailableForLegalReasons]: \"Call your lawyer!\",\n};\n","/**\n * An informational response indicates that the request was received and understood.\n *\n * It is issued on a provisional basis while request processing continues. It alerts the\n * client to wait for a final response. The message consists only of the status line and\n * optional header fields, and is terminated by an empty line. As the HTTP/1.0 standard\n * did not define any 1xx status codes, servers must not[note 1] send a 1xx response to\n * an HTTP/1.0 compliant client except under experimental conditions.[4]\n */\nexport enum ZHttpCodeInformationalResponse {\n /**\n * The server has received the request headers and the client should proceed to send the\n * request body (in the case of a request for which a body needs to be sent; for example, a\n * POST request).\n *\n * Sending a large request body to a server after a request has been rejected\n * for inappropriate headers would be inefficient. To have a server check the request's headers,\n * a client must send Expect: 100-continue as a header in its initial request and receive a 100 Continue status\n * code in response before sending the body. If the client receives an error code such as 403 (Forbidden) or 405\n * (Method Not Allowed) then it shouldn't send the request's body. The response 417 Expectation Failed indicates\n * that the request should be repeated without the Expect header as it indicates that the server doesn't support\n * expectations (this is the case, for example, of HTTP/1.0 servers).\n */\n Continue = 100,\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SwitchingProtocols = 101,\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to\n * complete the request. This code indicates that the server has received and is processing the request,\n * but no response is available yet. This prevents the client from timing out and assuming the request was lost.\n */\n Processing = 102,\n /**\n * Used to return some response headers before final HTTP message.\n */\n EarlyHints = 103,\n}\n\n/**\n * English friendly names of the codes.\n */\nexport const ZHttpCodeInformationalResponseNames: Record<\n ZHttpCodeInformationalResponse,\n string\n> = {\n [ZHttpCodeInformationalResponse.Continue]: \"Continue\",\n [ZHttpCodeInformationalResponse.SwitchingProtocols]: \"Switching Protocols\",\n [ZHttpCodeInformationalResponse.Processing]: \"Processing\",\n [ZHttpCodeInformationalResponse.EarlyHints]: \"Early Hints\",\n};\n\n/**\n * English friendly descriptions of the codes.\n */\nexport const ZHttpCodeInformationalResponseDescriptions: Record<\n ZHttpCodeInformationalResponse,\n string\n> = {\n [ZHttpCodeInformationalResponse.Continue]:\n \"The client should continue to send the request body.\",\n [ZHttpCodeInformationalResponse.SwitchingProtocols]:\n \"The requestor has asked the server to switch protocols and the server has agreed to do so.\",\n [ZHttpCodeInformationalResponse.Processing]:\n \"The server has received and is processing the request, but a response is not available yet.\",\n [ZHttpCodeInformationalResponse.EarlyHints]:\n \"There are some early response headers available for you before the final message.\",\n};\n","/**\n * This class of status code indicates the client must take additional action to complete the request.\n *\n * Many of these status codes are used in URL redirection. A user agent may carry out the additional\n * action with no user interaction only if the method used in the second request is GET or HEAD.\n * A user agent may automatically redirect a request. A user agent should detect and intervene\n * to prevent cyclical redirects.\n */\nexport enum ZHttpCodeRedirection {\n /**\n * Indicates multiple options for the resource from which the client may choose\n * (via agent-driven content negotiation).\n *\n * For example, this code could be used to present multiple video format options, to\n * list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MultipleChoices = 300,\n /**\n * This and all future requests should be directed to the given URI.\n */\n MovedPermanently = 301,\n /**\n * Tells the client to look at (browse to) another url. 302 has been superseded by 303 and 307.\n * This is an example of industry practice contradicting the standard. The HTTP/1.0 specification (RFC 1945)\n * required the client to perform a temporary redirect (the original describing phrase was \"Moved Temporarily\"),\n * [22] but popular browsers implemented 302 with the functionality of a 303 See Other. Therefore, HTTP/1.1\n * added status codes 303 and 307 to distinguish between the two behaviors.[23] However, some Web applications\n * and frameworks use the 302 status code as if it were the 303.\n */\n Found = 302,\n /**\n * The response to the request can be found under another URI using the GET method.\n *\n * When received in response to a POST (or PUT/DELETE), the client should presume\n * that the server has received the data and should issue a new GET request to\n * the given URI.\n */\n SeeOther = 303,\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers\n * If-Modified-Since or If-None-Match. In such case, there is no need to retransmit the resource since\n * the client still has a previously-downloaded copy.\n */\n NotModified = 304,\n /**\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n *\n * Many HTTP clients (such as Mozilla[27] and Internet Explorer) do not correctly handle responses with\n * this status code, primarily for security reasons.\n */\n UseProxy = 305,\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\n */\n SwitchProxy = 306,\n /**\n * In this case, the request should be repeated with another URI; however, future requests\n * should still use the original URI.\n *\n * In contrast to how 302 was historically implemented, the request method is not allowed to be\n * changed when reissuing the original request. For example, a POST request should be repeated using\n * another POST request.\n */\n TemporaryRedirect = 307,\n /**\n * The request and all future requests should be repeated using another URI.\n *\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PermanentRedirect = 308,\n}\n\n/**\n * English friendly names of the redirection codes.\n */\nexport const ZHttpCodeRedirectionNames: Record<ZHttpCodeRedirection, string> = {\n [ZHttpCodeRedirection.MultipleChoices]: \"Multiple Choices\",\n [ZHttpCodeRedirection.MovedPermanently]: \"Moved Permanently\",\n [ZHttpCodeRedirection.Found]: \"Found\",\n [ZHttpCodeRedirection.SeeOther]: \"See Other\",\n [ZHttpCodeRedirection.NotModified]: \"Not Modified\",\n [ZHttpCodeRedirection.UseProxy]: \"Use Proxy\",\n [ZHttpCodeRedirection.SwitchProxy]: \"Switch Proxy\",\n [ZHttpCodeRedirection.TemporaryRedirect]: \"Temporary Redirect\",\n [ZHttpCodeRedirection.PermanentRedirect]: \"Permanent Redirect\",\n};\n\n/**\n * English friendly descriptions of the redirection codes.\n */\nexport const ZHttpCodeRedirectionDescriptions: Record<\n ZHttpCodeRedirection,\n string\n> = {\n [ZHttpCodeRedirection.MultipleChoices]:\n \"Indicates multiple options for the resource from which the client may choose.\",\n [ZHttpCodeRedirection.MovedPermanently]:\n \"This and all future requests should be directed to the given URI.\",\n [ZHttpCodeRedirection.Found]: \"Tells the client to look at another url\",\n [ZHttpCodeRedirection.SeeOther]:\n \"The response to the request can be found under another URI using the GET method.\",\n [ZHttpCodeRedirection.NotModified]:\n \"Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\",\n [ZHttpCodeRedirection.UseProxy]:\n \"The requested resource is available only through a proxy, the address for which is provided in the response.\",\n [ZHttpCodeRedirection.SwitchProxy]:\n 'No longer used. Originally meant \"Subsequent requests should use the specified proxy.',\n [ZHttpCodeRedirection.TemporaryRedirect]:\n \"In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\",\n [ZHttpCodeRedirection.PermanentRedirect]:\n \"The request and all future requests should be repeated using another URI.\",\n};\n","/**\n * The server failed to fulfil a request.\n *\n * Response status codes beginning with the digit \"5\" indicate\n * cases in which the server is aware that it has encountered an\n * error or is otherwise incapable of performing the request. Except\n * when responding to a HEAD request, the server should include an entity\n * containing an explanation of the error situation, and indicate whether it\n * is a temporary or permanent condition. Likewise, user agents should\n * display any included entity to the user. These response codes are applicable\n * to any request method.\n */\nexport enum ZHttpCodeServer {\n /**\n * A generic error message, given when an unexpected condition was encountered\n * and no more specific message is suitable.\n */\n InternalServerError = 500,\n /**\n * The server either does not recognize the request method, or it lacks the ability to\n * fulfil the request. Usually this implies future availability (e.g., a new feature of\n * a web-service API).\n */\n NotImplemented = 501,\n /**\n * The server was acting as a gateway or proxy and received an invalid response\n * from the upstream server.\n */\n BadGateway = 502,\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n ServiceUnavailable = 503,\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from\n * the upstream server.\n */\n GatewayTimeout = 504,\n /**\n * The server does not support the HTTP protocol version used in the request.\n */\n HttpVersionNotSupported = 505,\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VariantAlsoNegotiates = 506,\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n InsufficientStorage = 507,\n /**\n * The server detected an infinite loop while processing the request.\n */\n LoopDetected = 508,\n /**\n * Further extensions to the request are required for the server to fulfil it.\n */\n NotExtended = 510,\n /**\n * The client needs to authenticate to gain network access. Intended for use by\n * intercepting proxies used to control access to the network.\n */\n NetworkAuthenticationRequired = 511,\n}\n\n/**\n * English friendly names of the server codes.\n */\nexport const ZHttpCodeServerNames: Record<ZHttpCodeServer, string> = {\n [ZHttpCodeServer.InternalServerError]: \"Internal Server Error\",\n [ZHttpCodeServer.NotImplemented]: \"Not Implemented\",\n [ZHttpCodeServer.BadGateway]: \"Bad Gateway\",\n [ZHttpCodeServer.ServiceUnavailable]: \"Service Unavailable\",\n [ZHttpCodeServer.GatewayTimeout]: \"Gateway Timeout\",\n [ZHttpCodeServer.HttpVersionNotSupported]: \"HTTP Version Not Supported\",\n [ZHttpCodeServer.VariantAlsoNegotiates]: \"Variant Also Negotiates\",\n [ZHttpCodeServer.InsufficientStorage]: \"Insufficient Storage\",\n [ZHttpCodeServer.LoopDetected]: \"Loop Detected\",\n [ZHttpCodeServer.NotExtended]: \"Not Extended\",\n [ZHttpCodeServer.NetworkAuthenticationRequired]:\n \"Network Authentication Required\",\n};\n\n/**\n * English friendly names of the server codes.\n */\nexport const ZHttpCodeServerDescriptions: Record<ZHttpCodeServer, string> = {\n [ZHttpCodeServer.InternalServerError]:\n \"An unexpected condition was encountered on the server.\",\n [ZHttpCodeServer.NotImplemented]:\n \"The server either does not recognize the request method, or it lacks the ability to fulfil the request. Usually this implies future availability (e.g., a new feature of a web-service API).\",\n [ZHttpCodeServer.BadGateway]:\n \" The server was acting as a gateway or proxy and received an invalid response from the upstream server.\",\n [ZHttpCodeServer.ServiceUnavailable]:\n \"The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.\",\n [ZHttpCodeServer.GatewayTimeout]:\n \"The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\",\n [ZHttpCodeServer.HttpVersionNotSupported]:\n \"The server does not support the HTTP protocol version used in the request.\",\n [ZHttpCodeServer.VariantAlsoNegotiates]:\n \" Transparent content negotiation for the request results in a circular reference.\",\n [ZHttpCodeServer.InsufficientStorage]:\n \"The server is unable to store the representation needed to complete the request.\",\n [ZHttpCodeServer.LoopDetected]:\n \"The server detected an infinite loop while processing the request.\",\n [ZHttpCodeServer.NotExtended]:\n \"Further extensions to the request are required for the server to fulfil it.\",\n [ZHttpCodeServer.NetworkAuthenticationRequired]:\n \"The client needs to authenticate to gain network access.\",\n};\n","/**\n * This class of status codes indicates the action requested by\n * the client was received, understood and accepted.\n */\nexport enum ZHttpCodeSuccess {\n /**\n * Standard response for successful HTTP requests.\n *\n * The actual response will depend on the request method used. In a GET\n * request, the response will contain an entity corresponding to the\n * requested resource. In a POST request, the response will contain an\n * entity describing or containing the result of the action.\n */\n OK = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n Created = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n *\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n Accepted = 202,\n\n /**\n * The server is a transforming proxy (e.g. a Web accelerator) that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NonAuthoritativeInformation = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NoContent = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n *\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n ResetContent = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header\n * sent by the client.\n *\n * The range header is used by HTTP clients to enable resuming of interrupted downloads, or\n * split a download into multiple simultaneous streams.\n */\n PartialContent = 206,\n\n /**\n * The message body that follows is by default an XML message and can contain a number of separate\n * response codes, depending on how many sub-requests were made.\n */\n MultiStatus = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the\n * response, and are not being included again.\n */\n AlreadyReported = 208,\n\n /**\n * The server has fulfilled a request for the resource, and the response is a representation of the result\n * of one or more instance-manipulations applied to the current instance.\n */\n IMUsed = 226,\n}\n\n/**\n * Friendly english names of success codes.\n */\nexport const ZHttpCodeSuccessNames: Record<ZHttpCodeSuccess, string> = {\n [ZHttpCodeSuccess.OK]: \"OK\",\n [ZHttpCodeSuccess.Created]: \"Created\",\n [ZHttpCodeSuccess.Accepted]: \"Accepted\",\n [ZHttpCodeSuccess.NonAuthoritativeInformation]:\n \"Non-Authoritative Information\",\n [ZHttpCodeSuccess.NoContent]: \"No Content\",\n [ZHttpCodeSuccess.ResetContent]: \"Reset Content\",\n [ZHttpCodeSuccess.PartialContent]: \"Partial Content\",\n [ZHttpCodeSuccess.MultiStatus]: \"Multi Status\",\n [ZHttpCodeSuccess.AlreadyReported]: \"Already Reported\",\n [ZHttpCodeSuccess.IMUsed]: \"IM Used\",\n};\n\n/**\n * Friendly english descriptions of success codes.\n */\nexport const ZHttpCodeSuccessDescriptions: Record<ZHttpCodeSuccess, string> = {\n [ZHttpCodeSuccess.OK]: \"The request was successful.\",\n [ZHttpCodeSuccess.Created]:\n \"The request has been fulfilled, resulting in the creation of a new resource.\",\n [ZHttpCodeSuccess.Accepted]:\n \"The request has been accepted for processing, but the processing has not been completed.\",\n [ZHttpCodeSuccess.NonAuthoritativeInformation]:\n \"The server is a transforming proxy that received an OK from its origin,but is returning a modified version of the response.\",\n [ZHttpCodeSuccess.NoContent]:\n \"The server successfully processed the request and is not returning any content.\",\n [ZHttpCodeSuccess.ResetContent]:\n \"The server successfully processed the request, but is not returning any content. The document view must be refreshed.\",\n [ZHttpCodeSuccess.PartialContent]:\n \"he server is delivering only part of the resource due to a range header sent by the client.\",\n [ZHttpCodeSuccess.MultiStatus]:\n \"The message body that follows is by default an XML message and can contain a number of separate response codes, depending on how many sub-requests were made.\",\n [ZHttpCodeSuccess.AlreadyReported]:\n \"The members of a DAV binding have already been enumerated in a preceding part of the response, and are not being included again.\",\n [ZHttpCodeSuccess.IMUsed]:\n \"The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\",\n};\n","import type { ZHttpCodeClient } from \"./http-code-client.mjs\";\nimport {\n ZHttpCodeClientDescriptions,\n ZHttpCodeClientNames,\n} from \"./http-code-client.mjs\";\nimport type { ZHttpCodeInformationalResponse } from \"./http-code-informational-response.mjs\";\nimport {\n ZHttpCodeInformationalResponseDescriptions,\n ZHttpCodeInformationalResponseNames,\n} from \"./http-code-informational-response.mjs\";\nimport type { ZHttpCodeRedirection } from \"./http-code-redirection.mjs\";\nimport {\n ZHttpCodeRedirectionDescriptions,\n ZHttpCodeRedirectionNames,\n} from \"./http-code-redirection.mjs\";\nimport type { ZHttpCodeServer } from \"./http-code-server.mjs\";\nimport {\n ZHttpCodeServerDescriptions,\n ZHttpCodeServerNames,\n} from \"./http-code-server.mjs\";\nimport type { ZHttpCodeSuccess } from \"./http-code-success.mjs\";\nimport {\n ZHttpCodeSuccessDescriptions,\n ZHttpCodeSuccessNames,\n} from \"./http-code-success.mjs\";\n\n/**\n * Represents a category of http code.\n */\nexport type ZHttpCode =\n | ZHttpCodeInformationalResponse\n | ZHttpCodeSuccess\n | ZHttpCodeRedirection\n | ZHttpCodeClient\n | ZHttpCodeServer;\n\n/**\n * Represents the category name for an http code.\n */\nexport enum ZHttpCodeCategory {\n /**\n * Error codes 100-199.\n */\n InformationalResponse = \"Informational Response\",\n /**\n * Error codes 200-299.\n */\n Success = \"Success\",\n /**\n * Error codes 300-399.\n */\n Redirection = \"Redirection\",\n /**\n * Error codes 400-499.\n */\n Client = \"Client Error\",\n /**\n * Error codes 500-599.\n */\n Server = \"Server Error\",\n}\n\n/**\n * Represents a classification of severity for a code.\n */\nexport enum ZHttpCodeSeverity {\n /**\n * Covers information response (100-199) and redirection codes (300-399).\n */\n Info = \"info\",\n /**\n * Covers the success codes (200-299)\n */\n Success = \"success\",\n /**\n * Covers client errors (400-499).\n */\n Warning = \"warning\",\n /**\n * Covers server errors (500-599).\n */\n Error = \"error\",\n}\n\n/**\n * Gets the english friendly name of a code.\n *\n * @param code -\n * The code to retrieve the name for.\n *\n * @returns\n * The english friendly name of a code.\n */\nexport function getHttpCodeName(code: ZHttpCode): string {\n return (\n ZHttpCodeInformationalResponseNames[code] ||\n ZHttpCodeSuccessNames[code] ||\n ZHttpCodeRedirectionNames[code] ||\n ZHttpCodeClientNames[code] ||\n ZHttpCodeServerNames[code]\n );\n}\n\n/**\n * Gets the english friendly description of a code.\n *\n * @param code -\n * The code to retrieve the description for.\n *\n * @returns\n * The english friendly description of a code.\n */\nexport function getHttpCodeDescription(code: ZHttpCode) {\n return (\n ZHttpCodeInformationalResponseDescriptions[code] ||\n ZHttpCodeSuccessDescriptions[code] ||\n ZHttpCodeRedirectionDescriptions[code] ||\n ZHttpCodeClientDescriptions[code] ||\n ZHttpCodeServerDescriptions[code]\n );\n}\n\n/**\n * Gets the severity of a code.\n *\n * @param code -\n * The severity of a code.\n *\n * @returns\n * The severity of a code.\n */\nexport function getHttpCodeSeverity(code: ZHttpCode): ZHttpCodeSeverity {\n if (code >= 200 && code < 300) {\n return ZHttpCodeSeverity.Success;\n }\n\n if (code >= 400 && code < 500) {\n return ZHttpCodeSeverity.Warning;\n }\n\n if (code >= 500) {\n return ZHttpCodeSeverity.Error;\n }\n\n return ZHttpCodeSeverity.Info;\n}\n\n/**\n * Gets the category of a code.\n *\n * @param code -\n * The category of a code.\n *\n * @returns\n * The code category.\n */\nexport function getHttpCodeCategory(code: ZHttpCode): ZHttpCodeCategory {\n if (code >= 100 && code < 200) {\n return ZHttpCodeCategory.InformationalResponse;\n }\n\n if (code >= 200 && code < 300) {\n return ZHttpCodeCategory.Success;\n }\n\n if (code >= 300 && code < 400) {\n return ZHttpCodeCategory.Redirection;\n }\n\n if (code >= 400 && code < 500) {\n return ZHttpCodeCategory.Client;\n }\n\n return ZHttpCodeCategory.Server;\n}\n","import { ZHttpCodeSuccess } from \"./http-code-success.mjs\";\nimport type { ZHttpCode } from \"./http-code.mjs\";\n\n/**\n * Represents a result from an http request.\n */\nexport interface IZHttpResult<TResult = any> {\n /**\n * The status code.\n */\n status: ZHttpCode;\n\n /**\n * The set of headers that was returned.\n */\n headers: Record<string, any>;\n\n /**\n * The actual body result of the invocation.\n */\n data: TResult;\n}\n\n/**\n * Represents a builder for an IZHttpResult class.\n */\nexport class ZHttpResultBuilder<TData = any> {\n private _result: IZHttpResult<TData>;\n\n /**\n * Initializes a new instance of this object.\n *\n * @param data -\n * The data result.\n */\n public constructor(data: TData) {\n this._result = {\n status: ZHttpCodeSuccess.OK,\n headers: {},\n data,\n };\n }\n\n /**\n * Sets the data.\n *\n * @param data -\n * The data to set.\n *\n * @returns\n * This object.\n */\n public data(data: TData): this {\n this._result.data = data;\n return this;\n }\n\n /**\n * Sets the status code and the english description.\n *\n * @param code -\n * The code to set.\n *\n * @returns\n * This object.\n */\n public status(code: ZHttpCode): this {\n this._result.status = code;\n return this;\n }\n\n /**\n * Sets the return headers.\n *\n * @param headers -\n * The headers to set.\n *\n * @returns\n * This object.\n */\n public headers(headers: Record<string, any> = {}): this {\n this._result.headers = headers;\n return this;\n }\n\n /**\n * Returns the built up result.\n *\n * @returns\n * A shallow copy of the built up result.\n */\n public build(): IZHttpResult {\n return { ...this._result };\n }\n}\n","import type { IZHttpRequest, ZHttpMethod } from \"../request/http-request.mjs\";\nimport { ZHttpCodeClient } from \"../result/http-code-client.mjs\";\nimport type { IZHttpResult } from \"../result/http-result.mjs\";\nimport { ZHttpResultBuilder } from \"../result/http-result.mjs\";\nimport type { IZHttpService } from \"./http-service.mjs\";\n\n/**\n * Represents a mock http service that can be useful for demos,\n * testing, and pre-api implementations.\n */\nexport class ZHttpServiceMock implements IZHttpService {\n private _mapping: {\n [endpoint: string]: {\n [verb: string]: (\n req: IZHttpRequest,\n ) => IZHttpResult | Promise<IZHttpResult>;\n };\n } = {};\n\n /**\n * Sets the result of a given endpoint.\n *\n * @param endpoint -\n * The endpoint to set.\n * @param verb -\n * The endpoint verb to respond to.\n * @param invoke -\n * The result method. If this is falsy, then the endpoint is removed.\n */\n public set<TResult = any>(\n endpoint: string,\n verb: ZHttpMethod,\n invoke:\n | IZHttpResult<TResult>\n | ((\n req: IZHttpRequest,\n ) => IZHttpResult<TResult> | Promise<IZHttpResult<TResult>>),\n ) {\n this._mapping[endpoint] = this._mapping[endpoint] || {};\n this._mapping[endpoint][verb] =\n typeof invoke === \"function\" ? invoke : () => invoke;\n }\n\n /**\n * Invokes the request given the allowed api implementations.\n *\n * @param req -\n * The request that has been made.\n *\n * @returns\n * A promise that resolves with the given result if the status code is less than 400.\n * Any status code above 400 will result in a rejected promise.\n */\n public async request<TResult = any, TBody = any>(\n req: IZHttpRequest<TBody>,\n ): Promise<IZHttpResult<TResult>> {\n const endpointConfig = this._mapping[req.url];\n const result = endpointConfig?.[req.method];\n\n if (result == null) {\n const notFound = new ZHttpResultBuilder(null)\n .status(ZHttpCodeClient.NotFound)\n .build();\n return Promise.reject(notFound);\n }\n\n const errorThreshold = 400;\n const intermediate = await result(req);\n return +intermediate.status < errorThreshold\n ? Promise.resolve(intermediate)\n : Promise.reject(intermediate);\n }\n}\n","/**\n * A method that determines if an object conforms to a Request BodyInit shape.\n *\n * See the BodyInit interface for more information about the possible\n * shapes.\n *\n * @param obj -\n * The object to test.\n *\n * @returns\n * True if obj is a BodyInit shape, false otherwise.\n */\nexport function isBodyInit(obj: any): obj is BodyInit {\n return (\n obj == null ||\n typeof obj === \"string\" ||\n obj instanceof Blob ||\n obj instanceof ArrayBuffer ||\n ArrayBuffer.isView(obj) ||\n obj instanceof FormData ||\n obj instanceof URLSearchParams ||\n obj instanceof ReadableStream\n );\n}\n\n/**\n * A helper method that converts an object to a BodyInit.\n *\n * If obj is not a BodyInit supported object, then it will\n * simply be converted to JSON.\n *\n * @param obj -\n * The object to convert.\n *\n * @returns\n * Obj as a body init serialization. If obj is not\n * compatible with a BodyInit shape, then it is converted\n * to JSON.\n */\nexport function toBodyInit(obj: any): BodyInit {\n return isBodyInit(obj) ? obj : JSON.stringify(obj);\n}\n","/**\n * A helper method that takes an HTTP Fetch Response and converts the body data based on its\n * content type.\n *\n * This will favor a blob as the default type.\n */\nexport function fromContentType(res: Response): Promise<any> {\n const contentType = res.headers.get(\"content-type\");\n\n if (\n contentType?.startsWith(\"application/json\") ||\n contentType?.endsWith(\"+json\")\n ) {\n return res.json();\n }\n\n if (contentType?.startsWith(\"multipart/form-data\")) {\n return res.formData();\n }\n\n if (contentType?.startsWith(\"text\") || contentType?.endsWith(\"+xml\")) {\n return res.text();\n }\n\n return res.blob();\n}\n","import fetch from \"cross-fetch\";\n\nimport type { IZHttpRequest } from \"../request/http-request.mjs\";\nimport { ZHttpCodeClient } from \"../result/http-code-client.mjs\";\nimport { ZHttpCodeServer } from \"../result/http-code-server.mjs\";\nimport type { IZHttpResult } from \"../result/http-result.mjs\";\nimport { ZHttpResultBuilder } from \"../result/http-result.mjs\";\nimport { isBodyInit } from \"../util/body-init.mjs\";\nimport { fromContentType } from \"../util/content-type.mjs\";\n\n/**\n * Represents a service that makes http invocations.\n */\nexport interface IZHttpService {\n /**\n * Makes the request.\n *\n * @param req -\n * The request object to make.\n *\n * @returns\n * A promise that resolves the request if a 200 code is returned, or\n * rejects if a 400 or 500 code is returned. The request is\n * rerouted if a 300 code is returned.\n */\n request<TResult = any, TBody = any>(\n req: IZHttpRequest<TBody>,\n ): Promise<IZHttpResult<TResult>>;\n}\n\n/**\n * Represents an axios based implementation of the http service.\n */\nexport class ZHttpService implements IZHttpService {\n /**\n * Invokes the request with a real http service.\n *\n * @param req -\n * The request information to make.\n */\n public async request<TResult = any, TBody = any>(\n req: IZHttpRequest<TBody>,\n ): Promise<IZHttpResult<TResult>> {\n try {\n const res = await fetch(req.url, {\n method: req.method,\n body: isBodyInit(req.body) ? req.body : JSON.stringify(req.body),\n headers: req.headers,\n redirect: \"follow\",\n });\n\n const data = await fromContentType(res);\n const result = new ZHttpResultBuilder(data)\n .headers(res.headers)\n .status(res.status)\n .build();\n return res.ok ? Promise.resolve(result) : Promise.reject(result);\n } catch (e) {\n let result = new ZHttpResultBuilder(e.message)\n .headers()\n .status(ZHttpCodeServer.InternalServerError);\n\n if (e.code === \"ENOTFOUND\") {\n // The request was made, but some DNS lookup failed.\n result = result.status(ZHttpCodeClient.NotFound);\n }\n\n return Promise.reject(result.build());\n }\n }\n}\n"],"names":["ZHttpMethod","ZHttpCodeClient","ZHttpCodeInformationalResponse","ZHttpCodeRedirection","ZHttpCodeServer","ZHttpCodeSuccess","ZHttpCodeCategory","ZHttpCodeSeverity"],"mappings":";;;AAGY,IAAA,gCAAAA,iBAAL;AAMLA,eAAA,KAAM,IAAA;AAONA,eAAA,KAAM,IAAA;AAONA,eAAA,MAAO,IAAA;AAOPA,eAAA,QAAS,IAAA;AAQTA,eAAA,OAAQ,IAAA;AASRA,eAAA,SAAU,IAAA;AAOVA,eAAA,MAAO,IAAA;AAnDGA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AA0FL,MAAM,oBAAiC;AAAA;AAAA;AAAA;AAAA,EAyBrC,cAAc;AAmCrB,SAAO,MAAkB,KAAK,QAAQ;AAAA,MAAK;AAAA,MAAM;AAAA;AAAA,IAAe;AAQzD,SAAA,OAA+B,KAAK,QAAQ;AAAA,MACjD;AAAA,MACA;AAAA;AAAA,IACF;AAQA,SAAO,MAA8B,KAAK,QAAQ;AAAA,MAAK;AAAA,MAAM;AAAA;AAAA,IAAe;AAQ5E,SAAO,SAAqB,KAAK,QAAQ;AAAA,MAAK;AAAA,MAAM;AAAA;AAAA,IAAkB;AAQ/D,SAAA,QAAgC,KAAK,QAAQ;AAAA,MAClD;AAAA,MACA;AAAA;AAAA,IACF;AAQA,SAAO,UAAsB,KAAK,QAAQ;AAAA,MAAK;AAAA,MAAM;AAAA;AAAA,IAAmB;AAQxE,SAAO,OAAmB,KAAK,QAAQ;AAAA,MAAK;AAAA,MAAM;AAAA;AAAA,IAAgB;AAxFhE,SAAK,WAAW;AAAA,MACd,QAAQ;AAAA,MACR,KAAK;AAAA,IACP;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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Q,IAAI,OAAO,EACnB,OAAO,IAAI,MAAM,EACjB,MAAM;AACF,aAAA,IAAI,KAAK,QAAQ,QAAQ,MAAM,IAAI,QAAQ,OAAO,MAAM;AAAA,aACxD,GAAG;AACN,UAAA,SAAS,IAAI,mBAAmB,EAAE,OAAO,EAC1C,UACA,OAAO,gBAAgB,mBAAmB;AAEzC,UAAA,EAAE,SAAS,aAAa;AAEjB,iBAAA,OAAO,OAAO,gBAAgB,QAAQ;AAAA,MAAA;AAGjD,aAAO,QAAQ,OAAO,OAAO,MAAA,CAAO;AAAA,IAAA;AAAA,EACtC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/request/http-request.mts","../src/result/http-code-client.mts","../src/result/http-code-informational-response.mts","../src/result/http-code-redirection.mts","../src/result/http-code-server.mts","../src/result/http-code-success.mts","../src/result/http-code.mts","../src/result/http-result.mts","../src/service/http-service-mock.mts","../src/util/body-init.mts","../src/util/content-type.mts","../src/service/http-service.mts"],"sourcesContent":["import { ZMimeTypeApplication } from \"@zthun/webigail-url\";\n\n/**\n * Represents an available method for an http invocation.\n */\nexport enum ZHttpMethod {\n /**\n * GET\n *\n * Used for reads\n */\n Get = \"GET\",\n\n /**\n * PUT\n *\n * Used for updates and can combine creates.\n */\n Put = \"PUT\",\n\n /**\n * POST\n *\n * Use for create.\n */\n Post = \"POST\",\n\n /**\n * DELETE.\n *\n * Used for....delete..duh.\n */\n Delete = \"DELETE\",\n\n /**\n * PATCH.\n *\n * Used for updates but only\n * partials of objects.\n */\n Patch = \"PATCH\",\n\n /**\n * OPTIONS\n *\n * Used to retrieve the available methods and\n * accessors for a single api. Normally used\n * by the browser.\n */\n Options = \"OPTIONS\",\n\n /**\n * HEAD\n *\n * Used for metadata.\n */\n Head = \"HEAD\",\n}\n\n/**\n * Represents a http request.\n */\nexport interface IZHttpRequest<TBody = any> {\n /**\n * The method, or verb, to invoke the request with.\n */\n method: ZHttpMethod;\n\n /**\n * The url to target.\n */\n url: string;\n\n /**\n * The post body.\n *\n * Only should really be used for POST style\n * calls which accept a body.\n */\n body?: TBody;\n\n /**\n * Request headers.\n */\n headers?: Record<string, string>;\n\n /**\n * The timeout before the rest method fails\n */\n timeout?: number;\n}\n\n/**\n * Represents a builder for an http request.\n */\nexport class ZHttpRequestBuilder<TBody = any> {\n private _request: IZHttpRequest<TBody>;\n\n /**\n * Duplicates a request, keeping it's structure intact.\n *\n * The underlying headers will be duplicated, but everything\n * else will be a shallow copy to preserve the body in the\n * case that it is a blob or other binary structure.\n *\n * @param other -\n * The request to duplicate.\n *\n * @returns\n * The duplicated object.\n */\n public static duplicate<TBody>(\n other: IZHttpRequest<TBody>,\n ): IZHttpRequest<TBody> {\n return { ...other, headers: structuredClone(other.headers) };\n }\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this._request = {\n method: ZHttpMethod.Get,\n url: \"\",\n };\n }\n\n /**\n * Sets the method.\n *\n * @param method -\n * The method to set.\n * @param body -\n * The post, put, or patch body.\n *\n * @returns\n * This object.\n */\n private _method(method: ZHttpMethod, body?: TBody): this {\n this._request.method = method;\n\n this._request.body = body;\n\n if (this._request.body === undefined) {\n delete this._request.body;\n }\n return this;\n }\n\n /**\n * Constructs a get request.\n *\n * @returns\n * This object.\n */\n public get() {\n return this._method(ZHttpMethod.Get);\n }\n\n /**\n * Constructs a post request.\n *\n * @returns\n * This object.\n */\n public post(body?: TBody) {\n return this._method(ZHttpMethod.Post, body).json();\n }\n\n /**\n * Constructs a put request.\n *\n * @returns\n * This object.\n */\n public put(body?: TBody) {\n return this._method(ZHttpMethod.Put, body).json();\n }\n\n /**\n * Constructs a delete request.\n *\n * @returns\n * This object.\n */\n public delete() {\n return this._method(ZHttpMethod.Delete);\n }\n\n /**\n * Constructs a patch request.\n *\n * @returns\n * This object.\n */\n public patch(body?: TBody) {\n return this._method(ZHttpMethod.Patch, body).json();\n }\n\n /**\n * Constructs a options request.\n *\n * @returns\n * This object.\n */\n public options() {\n return this._method(ZHttpMethod.Options);\n }\n\n /**\n * Constructs a head request.\n *\n * @returns\n * This object.\n */\n public head() {\n return this._method(ZHttpMethod.Head);\n }\n\n /**\n * Sets the url to make the request from.\n *\n * @param url -\n * The url to make the request to.\n *\n * @returns\n * This object.\n */\n public url(url: string): this {\n this._request.url = url;\n return this;\n }\n\n /**\n * Sets the timeout for the url.\n *\n * @param ms -\n * The total number of milliseconds to wait.\n *\n * @returns\n * The object.\n */\n public timeout(ms: number): this {\n this._request.timeout = ms;\n return this;\n }\n\n /**\n * Sets the headers.\n *\n * @param headers -\n * The headers to set.\n *\n * @returns\n * This object.\n */\n public headers(headers: Record<string, string>): this {\n this._request.headers = headers;\n return this;\n }\n\n /**\n * Sets an individual header.\n *\n * @param key -\n * The header key to set.\n * @param value -\n * The value to set.\n *\n * @returns\n * This object.\n */\n public header(key: string, value: string | number | boolean | null): this {\n this._request.headers = this._request.headers || {};\n\n if (value == null) {\n delete this._request.headers[key];\n } else {\n this._request.headers[key] = `${value}`;\n }\n\n return this;\n }\n\n /**\n * Sets the content type header.\n *\n * @param type -\n * The content mime type.\n *\n * @returns\n * This object.\n */\n public content(type: string) {\n return this.header(\"Content-Type\", type);\n }\n\n /**\n * Sets the content type to json.\n *\n * @returns\n * This object.\n */\n public json = this.content.bind(this, ZMimeTypeApplication.JSON);\n\n /**\n * Copies other to this object.\n *\n * @param other -\n * The request to copy.\n *\n * @returns\n * This object.\n */\n public copy(other: IZHttpRequest): this {\n this._request = ZHttpRequestBuilder.duplicate(other);\n return this;\n }\n\n /**\n * Returns the constructed request.\n *\n * @returns\n * The constructed request.\n */\n public build(): IZHttpRequest {\n return ZHttpRequestBuilder.duplicate(this._request);\n }\n}\n","/**\n * This class of status code is intended for situations in which the error seems to have been caused by the client.\n *\n * Except when responding to a HEAD request, the server should include an entity containing an explanation\n * of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable\n * to any request method. User agents should display any included entity to the user.\n */\nexport enum ZHttpCodeClient {\n /**\n * The server cannot or will not process the request due to an apparent client error\n * (e.g., malformed request syntax, size too large, invalid request message framing,\n * or deceptive request routing).\n */\n BadRequest = 400,\n /**\n * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed\n * or has not yet been provided.\n *\n * The response must include a WWW-Authenticate header field containing a challenge applicable to the\n * requested resource. See Basic access authentication and Digest access authentication. 401\n * semantically means \"unauthenticated\",[35] i.e. the user does not have the necessary credentials.\n *\n * Note: Some sites issue HTTP 401 when an IP address is banned from the website (usually the website domain)\n * and that specific address is refused permission to access a website.\n */\n Unauthorized = 401,\n /**\n * Reserved for future use.\n *\n * The original intention was that this code might be used as part of some form of digital cash or\n * micro-payment scheme, as proposed for example by GNU Taler, but that has not yet happened, and\n * this code is not usually used. Google Developers API uses this status if a particular developer\n * has exceeded the daily limit on requests\n */\n PaymentRequired = 402,\n /**\n * The request was valid, but the server is refusing action.\n *\n * The user might not have the necessary permissions for a resource, or may need an account of some sort.\n */\n Forbidden = 403,\n /**\n * The requested resource could not be found but may be available in the future.\n *\n * Subsequent requests by the client are permissible.\n */\n NotFound = 404,\n /**\n * A request method is not supported for the requested resource; for example, a GET\n * request on a form that requires data to be presented via POST, or a PUT request on\n * a read-only resource.\n */\n MethodNotAllowed = 405,\n /**\n * The requested resource is capable of generating only content not acceptable according\n * to the Accept headers sent in the request.\n */\n NotAcceptable = 406,\n /**\n * The client must first authenticate itself with the proxy.\n */\n ProxyAuthenticationRequired = 407,\n /**\n * The server timed out waiting for the request.\n *\n * According to HTTP specifications: \"The client did not produce a request within the\n * time that the server was prepared to wait. The client MAY repeat the request without\n * modifications at any later time.\n */\n RequestTimeout = 408,\n /**\n * Indicates that the request could not be processed because of conflict in the request, such\n * as an edit conflict between multiple simultaneous updates.\n */\n Conflict = 409,\n /**\n * Indicates that the resource requested is no longer available and will not be available again.\n *\n * This should be used when a resource has been intentionally removed and the resource should be\n * purged. Upon receiving a 410 status code, the client should not request the resource in the\n * future. Clients such as search engines should remove the resource from their indices. Most use\n * cases do not require clients and search engines to purge the resource, and a \"404 Not Found\" may\n * be used instead.\n */\n Gone = 410,\n /**\n * The request did not specify the length of its content, which is required by the requested resource.\n */\n LengthRequired = 411,\n /**\n * The server does not meet one of the preconditions that the requester put on the request.\n */\n PreconditionFailed = 412,\n /**\n * The request is larger than the server is willing or able to process. Previously called\n * \"Request Entity Too Large\".\n */\n PayloadTooLarge = 413,\n /**\n * The URI provided was too long for the server to process.\n *\n * Often the result of too much data being encoded as a query-string of\n * a GET request, in which case it should be converted to a POST request.\n * Called \"Request-URI Too Long\" previously.\n */\n URITooLong = 414,\n /**\n * The request entity has a media type which the server or resource does not support.\n *\n * For example, the client uploads an image as image/svg+xml, but the server requires that\n * images use a different format.\n */\n UnsupportedMediaType = 415,\n /**\n * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.\n *\n * For example, if the client asked for a part of the file that lies beyond the end of the file.\n * Called \"Requested Range Not Satisfiable\" previously.\n */\n RangeNotSatisfiable = 416,\n /**\n * The server cannot meet the requirements of the Expect request-header field.\n */\n ExpectationFailed = 417,\n /**\n * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper\n * Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers.\n *\n * The RFC specifies this code should be returned by teapots requested to brew coffee. This HTTP\n * status is used as an Easter egg in some websites, including Google.com.\n */\n ImATeapot = 418,\n /**\n * The request was directed at a server that is not able to produce a response[53] (for example because of connection reuse).\n */\n MisdirectedRequest = 421,\n /**\n * The request was well-formed but was unable to be followed due to semantic errors.\n */\n UnProcessableEntity = 422,\n /**\n * The resource that is being accessed is locked.\n */\n Locked = 423,\n /**\n * The request failed because it depended on another request and that request failed.\n */\n FailedDependency = 424,\n /**\n * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.\n */\n UpgradeRequired = 426,\n /**\n * The origin server requires the request to be conditional.\n *\n * Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it,\n * and PUTs it back to the server, when meanwhile a third party has modified the state on the server,\n * leading to a conflict.\n */\n PreconditionRequired = 428,\n /**\n * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.\n */\n TooManyRequests = 429,\n /**\n * The server is unwilling to process the request because either an individual header field, or all the\n * header fields collectively, are too large.[\n */\n RequestHeaderFieldsTooLarge = 431,\n /**\n * A server operator has received a legal demand to deny access to a resource or to a set of resources that includes the\n * requested resource.\n *\n * The code 451 was chosen as a reference to the novel Fahrenheit 451.\n */\n UnavailableForLegalReasons = 451,\n}\n\n/**\n * English friendly names of the codes.\n */\nexport const ZHttpCodeClientNames: Record<ZHttpCodeClient, string> = {\n [ZHttpCodeClient.BadRequest]: \"Bad Request\",\n [ZHttpCodeClient.Unauthorized]: \"Unauthorized\",\n [ZHttpCodeClient.PaymentRequired]: \"Payment Required\",\n [ZHttpCodeClient.Forbidden]: \"Forbidden\",\n [ZHttpCodeClient.NotFound]: \"Not Found\",\n [ZHttpCodeClient.MethodNotAllowed]: \"Method not Allowed\",\n [ZHttpCodeClient.NotAcceptable]: \"Not Acceptable\",\n [ZHttpCodeClient.ProxyAuthenticationRequired]:\n \"Proxy Authentication Required\",\n [ZHttpCodeClient.RequestTimeout]: \"Request Timeout\",\n [ZHttpCodeClient.Conflict]: \"Conflict\",\n [ZHttpCodeClient.Gone]: \"Gone\",\n [ZHttpCodeClient.LengthRequired]: \"Length Required\",\n [ZHttpCodeClient.PreconditionFailed]: \"Precondition Failed\",\n [ZHttpCodeClient.PayloadTooLarge]: \"Payload Too Large\",\n [ZHttpCodeClient.URITooLong]: \"URI Too Long\",\n [ZHttpCodeClient.UnsupportedMediaType]: \"Unsupported Media Type\",\n [ZHttpCodeClient.RangeNotSatisfiable]: \"Range Not Satisfiable\",\n [ZHttpCodeClient.ExpectationFailed]: \"Expectation Failed\",\n [ZHttpCodeClient.ImATeapot]: \"I am a Teapot\",\n [ZHttpCodeClient.MisdirectedRequest]: \"Misdirected Requested\",\n [ZHttpCodeClient.UnProcessableEntity]: \"Entity Not Processable\",\n [ZHttpCodeClient.Locked]: \"Locked\",\n [ZHttpCodeClient.FailedDependency]: \"Failed Dependency\",\n [ZHttpCodeClient.UpgradeRequired]: \"Upgrade Required\",\n [ZHttpCodeClient.PreconditionRequired]: \"Precondition Required\",\n [ZHttpCodeClient.TooManyRequests]: \"Too Many Requests\",\n [ZHttpCodeClient.RequestHeaderFieldsTooLarge]:\n \"Request Header Fields Too Large\",\n [ZHttpCodeClient.UnavailableForLegalReasons]: \"Unavailable for Legal Reasons\",\n};\n\n/**\n * English friendly descriptions of HttpClientCodes\n */\nexport const ZHttpCodeClientDescriptions: Record<ZHttpCodeClient, string> = {\n [ZHttpCodeClient.BadRequest]: \"A bad request was sent.\",\n [ZHttpCodeClient.Unauthorized]:\n \"You are not authenticated and cannot view this content.\",\n [ZHttpCodeClient.PaymentRequired]: \"Payment is required\",\n [ZHttpCodeClient.Forbidden]: \"You are not authorized to view this content.\",\n [ZHttpCodeClient.NotFound]:\n \"The resource you are looking for could not be found.\",\n [ZHttpCodeClient.MethodNotAllowed]:\n \"The requested operation was not allowed.\",\n [ZHttpCodeClient.NotAcceptable]:\n \"The requested resource is not capable of generating the content for you.\",\n [ZHttpCodeClient.ProxyAuthenticationRequired]:\n \"You must first authenticate your self with the proxy.\",\n [ZHttpCodeClient.RequestTimeout]:\n \"The server timed out waiting for a request. Please try again.\",\n [ZHttpCodeClient.Conflict]:\n \"There was a conflict with request. Try something else.\",\n [ZHttpCodeClient.Gone]: \"The resource you requested is no longer available.\",\n [ZHttpCodeClient.LengthRequired]:\n \"Your request did not specify the length of its content, which is required by the requested resource.\",\n [ZHttpCodeClient.PreconditionFailed]:\n \"The server did not meet the requirements that was required to meet the request.\",\n [ZHttpCodeClient.PayloadTooLarge]:\n \"The request is too large and the server cannot handle it.\",\n [ZHttpCodeClient.URITooLong]:\n \"The URI provided was too long for the server to process.\",\n [ZHttpCodeClient.UnsupportedMediaType]:\n \"The media type requested is not supported by the server.\",\n [ZHttpCodeClient.RangeNotSatisfiable]:\n \"A portion of the file was requested by the server cannot supply said portion.\",\n [ZHttpCodeClient.ExpectationFailed]:\n \"The server cannot meet the requirements of the expectation made of it.\",\n [ZHttpCodeClient.ImATeapot]:\n \"Short and stout. Here is my handle, here is my spout. When I get all steamed up, hear me shout. Tip me over and pour me out!\",\n [ZHttpCodeClient.MisdirectedRequest]:\n \"The request was directed at the server, but the server cannot produce a response.\",\n [ZHttpCodeClient.UnProcessableEntity]:\n \"The request was well-formed but was unable to be followed due to semantic errors.\",\n [ZHttpCodeClient.Locked]: \"The resource that is being accessed is locked.\",\n [ZHttpCodeClient.FailedDependency]:\n \"The request failed because it depended on another request and that request failed.\",\n [ZHttpCodeClient.UpgradeRequired]:\n \"The client needs to switch to a different protocol.\",\n [ZHttpCodeClient.PreconditionRequired]:\n \"The origin server requires the request to be conditional.\",\n [ZHttpCodeClient.TooManyRequests]:\n \"The user has sent too many requests in a given amount of time.\",\n [ZHttpCodeClient.RequestHeaderFieldsTooLarge]:\n \"The request cannot be processed because the collective header fields are too large.\",\n [ZHttpCodeClient.UnavailableForLegalReasons]: \"Call your lawyer!\",\n};\n","/**\n * An informational response indicates that the request was received and understood.\n *\n * It is issued on a provisional basis while request processing continues. It alerts the\n * client to wait for a final response. The message consists only of the status line and\n * optional header fields, and is terminated by an empty line. As the HTTP/1.0 standard\n * did not define any 1xx status codes, servers must not[note 1] send a 1xx response to\n * an HTTP/1.0 compliant client except under experimental conditions.[4]\n */\nexport enum ZHttpCodeInformationalResponse {\n /**\n * The server has received the request headers and the client should proceed to send the\n * request body (in the case of a request for which a body needs to be sent; for example, a\n * POST request).\n *\n * Sending a large request body to a server after a request has been rejected\n * for inappropriate headers would be inefficient. To have a server check the request's headers,\n * a client must send Expect: 100-continue as a header in its initial request and receive a 100 Continue status\n * code in response before sending the body. If the client receives an error code such as 403 (Forbidden) or 405\n * (Method Not Allowed) then it shouldn't send the request's body. The response 417 Expectation Failed indicates\n * that the request should be repeated without the Expect header as it indicates that the server doesn't support\n * expectations (this is the case, for example, of HTTP/1.0 servers).\n */\n Continue = 100,\n /**\n * The requester has asked the server to switch protocols and the server has agreed to do so.\n */\n SwitchingProtocols = 101,\n /**\n * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to\n * complete the request. This code indicates that the server has received and is processing the request,\n * but no response is available yet. This prevents the client from timing out and assuming the request was lost.\n */\n Processing = 102,\n /**\n * Used to return some response headers before final HTTP message.\n */\n EarlyHints = 103,\n}\n\n/**\n * English friendly names of the codes.\n */\nexport const ZHttpCodeInformationalResponseNames: Record<\n ZHttpCodeInformationalResponse,\n string\n> = {\n [ZHttpCodeInformationalResponse.Continue]: \"Continue\",\n [ZHttpCodeInformationalResponse.SwitchingProtocols]: \"Switching Protocols\",\n [ZHttpCodeInformationalResponse.Processing]: \"Processing\",\n [ZHttpCodeInformationalResponse.EarlyHints]: \"Early Hints\",\n};\n\n/**\n * English friendly descriptions of the codes.\n */\nexport const ZHttpCodeInformationalResponseDescriptions: Record<\n ZHttpCodeInformationalResponse,\n string\n> = {\n [ZHttpCodeInformationalResponse.Continue]:\n \"The client should continue to send the request body.\",\n [ZHttpCodeInformationalResponse.SwitchingProtocols]:\n \"The requestor has asked the server to switch protocols and the server has agreed to do so.\",\n [ZHttpCodeInformationalResponse.Processing]:\n \"The server has received and is processing the request, but a response is not available yet.\",\n [ZHttpCodeInformationalResponse.EarlyHints]:\n \"There are some early response headers available for you before the final message.\",\n};\n","/**\n * This class of status code indicates the client must take additional action to complete the request.\n *\n * Many of these status codes are used in URL redirection. A user agent may carry out the additional\n * action with no user interaction only if the method used in the second request is GET or HEAD.\n * A user agent may automatically redirect a request. A user agent should detect and intervene\n * to prevent cyclical redirects.\n */\nexport enum ZHttpCodeRedirection {\n /**\n * Indicates multiple options for the resource from which the client may choose\n * (via agent-driven content negotiation).\n *\n * For example, this code could be used to present multiple video format options, to\n * list files with different filename extensions, or to suggest word-sense disambiguation.\n */\n MultipleChoices = 300,\n /**\n * This and all future requests should be directed to the given URI.\n */\n MovedPermanently = 301,\n /**\n * Tells the client to look at (browse to) another url. 302 has been superseded by 303 and 307.\n * This is an example of industry practice contradicting the standard. The HTTP/1.0 specification (RFC 1945)\n * required the client to perform a temporary redirect (the original describing phrase was \"Moved Temporarily\"),\n * [22] but popular browsers implemented 302 with the functionality of a 303 See Other. Therefore, HTTP/1.1\n * added status codes 303 and 307 to distinguish between the two behaviors.[23] However, some Web applications\n * and frameworks use the 302 status code as if it were the 303.\n */\n Found = 302,\n /**\n * The response to the request can be found under another URI using the GET method.\n *\n * When received in response to a POST (or PUT/DELETE), the client should presume\n * that the server has received the data and should issue a new GET request to\n * the given URI.\n */\n SeeOther = 303,\n /**\n * Indicates that the resource has not been modified since the version specified by the request headers\n * If-Modified-Since or If-None-Match. In such case, there is no need to retransmit the resource since\n * the client still has a previously-downloaded copy.\n */\n NotModified = 304,\n /**\n * The requested resource is available only through a proxy, the address for which is provided in the response.\n *\n * Many HTTP clients (such as Mozilla[27] and Internet Explorer) do not correctly handle responses with\n * this status code, primarily for security reasons.\n */\n UseProxy = 305,\n /**\n * No longer used. Originally meant \"Subsequent requests should use the specified proxy.\n */\n SwitchProxy = 306,\n /**\n * In this case, the request should be repeated with another URI; however, future requests\n * should still use the original URI.\n *\n * In contrast to how 302 was historically implemented, the request method is not allowed to be\n * changed when reissuing the original request. For example, a POST request should be repeated using\n * another POST request.\n */\n TemporaryRedirect = 307,\n /**\n * The request and all future requests should be repeated using another URI.\n *\n * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.\n * So, for example, submitting a form to a permanently redirected resource may continue smoothly.\n */\n PermanentRedirect = 308,\n}\n\n/**\n * English friendly names of the redirection codes.\n */\nexport const ZHttpCodeRedirectionNames: Record<ZHttpCodeRedirection, string> = {\n [ZHttpCodeRedirection.MultipleChoices]: \"Multiple Choices\",\n [ZHttpCodeRedirection.MovedPermanently]: \"Moved Permanently\",\n [ZHttpCodeRedirection.Found]: \"Found\",\n [ZHttpCodeRedirection.SeeOther]: \"See Other\",\n [ZHttpCodeRedirection.NotModified]: \"Not Modified\",\n [ZHttpCodeRedirection.UseProxy]: \"Use Proxy\",\n [ZHttpCodeRedirection.SwitchProxy]: \"Switch Proxy\",\n [ZHttpCodeRedirection.TemporaryRedirect]: \"Temporary Redirect\",\n [ZHttpCodeRedirection.PermanentRedirect]: \"Permanent Redirect\",\n};\n\n/**\n * English friendly descriptions of the redirection codes.\n */\nexport const ZHttpCodeRedirectionDescriptions: Record<\n ZHttpCodeRedirection,\n string\n> = {\n [ZHttpCodeRedirection.MultipleChoices]:\n \"Indicates multiple options for the resource from which the client may choose.\",\n [ZHttpCodeRedirection.MovedPermanently]:\n \"This and all future requests should be directed to the given URI.\",\n [ZHttpCodeRedirection.Found]: \"Tells the client to look at another url\",\n [ZHttpCodeRedirection.SeeOther]:\n \"The response to the request can be found under another URI using the GET method.\",\n [ZHttpCodeRedirection.NotModified]:\n \"Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.\",\n [ZHttpCodeRedirection.UseProxy]:\n \"The requested resource is available only through a proxy, the address for which is provided in the response.\",\n [ZHttpCodeRedirection.SwitchProxy]:\n 'No longer used. Originally meant \"Subsequent requests should use the specified proxy.',\n [ZHttpCodeRedirection.TemporaryRedirect]:\n \"In this case, the request should be repeated with another URI; however, future requests should still use the original URI.\",\n [ZHttpCodeRedirection.PermanentRedirect]:\n \"The request and all future requests should be repeated using another URI.\",\n};\n","/**\n * The server failed to fulfil a request.\n *\n * Response status codes beginning with the digit \"5\" indicate\n * cases in which the server is aware that it has encountered an\n * error or is otherwise incapable of performing the request. Except\n * when responding to a HEAD request, the server should include an entity\n * containing an explanation of the error situation, and indicate whether it\n * is a temporary or permanent condition. Likewise, user agents should\n * display any included entity to the user. These response codes are applicable\n * to any request method.\n */\nexport enum ZHttpCodeServer {\n /**\n * A generic error message, given when an unexpected condition was encountered\n * and no more specific message is suitable.\n */\n InternalServerError = 500,\n /**\n * The server either does not recognize the request method, or it lacks the ability to\n * fulfil the request. Usually this implies future availability (e.g., a new feature of\n * a web-service API).\n */\n NotImplemented = 501,\n /**\n * The server was acting as a gateway or proxy and received an invalid response\n * from the upstream server.\n */\n BadGateway = 502,\n /**\n * The server is currently unavailable (because it is overloaded or down for maintenance).\n * Generally, this is a temporary state.\n */\n ServiceUnavailable = 503,\n /**\n * The server was acting as a gateway or proxy and did not receive a timely response from\n * the upstream server.\n */\n GatewayTimeout = 504,\n /**\n * The server does not support the HTTP protocol version used in the request.\n */\n HttpVersionNotSupported = 505,\n /**\n * Transparent content negotiation for the request results in a circular reference.\n */\n VariantAlsoNegotiates = 506,\n /**\n * The server is unable to store the representation needed to complete the request.\n */\n InsufficientStorage = 507,\n /**\n * The server detected an infinite loop while processing the request.\n */\n LoopDetected = 508,\n /**\n * Further extensions to the request are required for the server to fulfil it.\n */\n NotExtended = 510,\n /**\n * The client needs to authenticate to gain network access. Intended for use by\n * intercepting proxies used to control access to the network.\n */\n NetworkAuthenticationRequired = 511,\n}\n\n/**\n * English friendly names of the server codes.\n */\nexport const ZHttpCodeServerNames: Record<ZHttpCodeServer, string> = {\n [ZHttpCodeServer.InternalServerError]: \"Internal Server Error\",\n [ZHttpCodeServer.NotImplemented]: \"Not Implemented\",\n [ZHttpCodeServer.BadGateway]: \"Bad Gateway\",\n [ZHttpCodeServer.ServiceUnavailable]: \"Service Unavailable\",\n [ZHttpCodeServer.GatewayTimeout]: \"Gateway Timeout\",\n [ZHttpCodeServer.HttpVersionNotSupported]: \"HTTP Version Not Supported\",\n [ZHttpCodeServer.VariantAlsoNegotiates]: \"Variant Also Negotiates\",\n [ZHttpCodeServer.InsufficientStorage]: \"Insufficient Storage\",\n [ZHttpCodeServer.LoopDetected]: \"Loop Detected\",\n [ZHttpCodeServer.NotExtended]: \"Not Extended\",\n [ZHttpCodeServer.NetworkAuthenticationRequired]:\n \"Network Authentication Required\",\n};\n\n/**\n * English friendly names of the server codes.\n */\nexport const ZHttpCodeServerDescriptions: Record<ZHttpCodeServer, string> = {\n [ZHttpCodeServer.InternalServerError]:\n \"An unexpected condition was encountered on the server.\",\n [ZHttpCodeServer.NotImplemented]:\n \"The server either does not recognize the request method, or it lacks the ability to fulfil the request. Usually this implies future availability (e.g., a new feature of a web-service API).\",\n [ZHttpCodeServer.BadGateway]:\n \" The server was acting as a gateway or proxy and received an invalid response from the upstream server.\",\n [ZHttpCodeServer.ServiceUnavailable]:\n \"The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.\",\n [ZHttpCodeServer.GatewayTimeout]:\n \"The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.\",\n [ZHttpCodeServer.HttpVersionNotSupported]:\n \"The server does not support the HTTP protocol version used in the request.\",\n [ZHttpCodeServer.VariantAlsoNegotiates]:\n \" Transparent content negotiation for the request results in a circular reference.\",\n [ZHttpCodeServer.InsufficientStorage]:\n \"The server is unable to store the representation needed to complete the request.\",\n [ZHttpCodeServer.LoopDetected]:\n \"The server detected an infinite loop while processing the request.\",\n [ZHttpCodeServer.NotExtended]:\n \"Further extensions to the request are required for the server to fulfil it.\",\n [ZHttpCodeServer.NetworkAuthenticationRequired]:\n \"The client needs to authenticate to gain network access.\",\n};\n","/**\n * This class of status codes indicates the action requested by\n * the client was received, understood and accepted.\n */\nexport enum ZHttpCodeSuccess {\n /**\n * Standard response for successful HTTP requests.\n *\n * The actual response will depend on the request method used. In a GET\n * request, the response will contain an entity corresponding to the\n * requested resource. In a POST request, the response will contain an\n * entity describing or containing the result of the action.\n */\n OK = 200,\n\n /**\n * The request has been fulfilled, resulting in the creation of a new resource.\n */\n Created = 201,\n\n /**\n * The request has been accepted for processing, but the processing has not been completed.\n *\n * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.\n */\n Accepted = 202,\n\n /**\n * The server is a transforming proxy (e.g. a Web accelerator) that received a 200 OK from its origin,\n * but is returning a modified version of the origin's response.\n */\n NonAuthoritativeInformation = 203,\n\n /**\n * The server successfully processed the request and is not returning any content.\n */\n NoContent = 204,\n\n /**\n * The server successfully processed the request, but is not returning any content.\n *\n * Unlike a 204 response, this response requires that the requester reset the document view.\n */\n ResetContent = 205,\n\n /**\n * The server is delivering only part of the resource (byte serving) due to a range header\n * sent by the client.\n *\n * The range header is used by HTTP clients to enable resuming of interrupted downloads, or\n * split a download into multiple simultaneous streams.\n */\n PartialContent = 206,\n\n /**\n * The message body that follows is by default an XML message and can contain a number of separate\n * response codes, depending on how many sub-requests were made.\n */\n MultiStatus = 207,\n\n /**\n * The members of a DAV binding have already been enumerated in a preceding part of the\n * response, and are not being included again.\n */\n AlreadyReported = 208,\n\n /**\n * The server has fulfilled a request for the resource, and the response is a representation of the result\n * of one or more instance-manipulations applied to the current instance.\n */\n IMUsed = 226,\n}\n\n/**\n * Friendly english names of success codes.\n */\nexport const ZHttpCodeSuccessNames: Record<ZHttpCodeSuccess, string> = {\n [ZHttpCodeSuccess.OK]: \"OK\",\n [ZHttpCodeSuccess.Created]: \"Created\",\n [ZHttpCodeSuccess.Accepted]: \"Accepted\",\n [ZHttpCodeSuccess.NonAuthoritativeInformation]:\n \"Non-Authoritative Information\",\n [ZHttpCodeSuccess.NoContent]: \"No Content\",\n [ZHttpCodeSuccess.ResetContent]: \"Reset Content\",\n [ZHttpCodeSuccess.PartialContent]: \"Partial Content\",\n [ZHttpCodeSuccess.MultiStatus]: \"Multi Status\",\n [ZHttpCodeSuccess.AlreadyReported]: \"Already Reported\",\n [ZHttpCodeSuccess.IMUsed]: \"IM Used\",\n};\n\n/**\n * Friendly english descriptions of success codes.\n */\nexport const ZHttpCodeSuccessDescriptions: Record<ZHttpCodeSuccess, string> = {\n [ZHttpCodeSuccess.OK]: \"The request was successful.\",\n [ZHttpCodeSuccess.Created]:\n \"The request has been fulfilled, resulting in the creation of a new resource.\",\n [ZHttpCodeSuccess.Accepted]:\n \"The request has been accepted for processing, but the processing has not been completed.\",\n [ZHttpCodeSuccess.NonAuthoritativeInformation]:\n \"The server is a transforming proxy that received an OK from its origin,but is returning a modified version of the response.\",\n [ZHttpCodeSuccess.NoContent]:\n \"The server successfully processed the request and is not returning any content.\",\n [ZHttpCodeSuccess.ResetContent]:\n \"The server successfully processed the request, but is not returning any content. The document view must be refreshed.\",\n [ZHttpCodeSuccess.PartialContent]:\n \"he server is delivering only part of the resource due to a range header sent by the client.\",\n [ZHttpCodeSuccess.MultiStatus]:\n \"The message body that follows is by default an XML message and can contain a number of separate response codes, depending on how many sub-requests were made.\",\n [ZHttpCodeSuccess.AlreadyReported]:\n \"The members of a DAV binding have already been enumerated in a preceding part of the response, and are not being included again.\",\n [ZHttpCodeSuccess.IMUsed]:\n \"The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.\",\n};\n","import type { ZHttpCodeClient } from \"./http-code-client.mjs\";\nimport {\n ZHttpCodeClientDescriptions,\n ZHttpCodeClientNames,\n} from \"./http-code-client.mjs\";\nimport type { ZHttpCodeInformationalResponse } from \"./http-code-informational-response.mjs\";\nimport {\n ZHttpCodeInformationalResponseDescriptions,\n ZHttpCodeInformationalResponseNames,\n} from \"./http-code-informational-response.mjs\";\nimport type { ZHttpCodeRedirection } from \"./http-code-redirection.mjs\";\nimport {\n ZHttpCodeRedirectionDescriptions,\n ZHttpCodeRedirectionNames,\n} from \"./http-code-redirection.mjs\";\nimport type { ZHttpCodeServer } from \"./http-code-server.mjs\";\nimport {\n ZHttpCodeServerDescriptions,\n ZHttpCodeServerNames,\n} from \"./http-code-server.mjs\";\nimport type { ZHttpCodeSuccess } from \"./http-code-success.mjs\";\nimport {\n ZHttpCodeSuccessDescriptions,\n ZHttpCodeSuccessNames,\n} from \"./http-code-success.mjs\";\n\n/**\n * Represents a category of http code.\n */\nexport type ZHttpCode =\n | ZHttpCodeInformationalResponse\n | ZHttpCodeSuccess\n | ZHttpCodeRedirection\n | ZHttpCodeClient\n | ZHttpCodeServer;\n\n/**\n * Represents the category name for an http code.\n */\nexport enum ZHttpCodeCategory {\n /**\n * Error codes 100-199.\n */\n InformationalResponse = \"Informational Response\",\n /**\n * Error codes 200-299.\n */\n Success = \"Success\",\n /**\n * Error codes 300-399.\n */\n Redirection = \"Redirection\",\n /**\n * Error codes 400-499.\n */\n Client = \"Client Error\",\n /**\n * Error codes 500-599.\n */\n Server = \"Server Error\",\n}\n\n/**\n * Represents a classification of severity for a code.\n */\nexport enum ZHttpCodeSeverity {\n /**\n * Covers information response (100-199) and redirection codes (300-399).\n */\n Info = \"info\",\n /**\n * Covers the success codes (200-299)\n */\n Success = \"success\",\n /**\n * Covers client errors (400-499).\n */\n Warning = \"warning\",\n /**\n * Covers server errors (500-599).\n */\n Error = \"error\",\n}\n\n/**\n * Gets the english friendly name of a code.\n *\n * @param code -\n * The code to retrieve the name for.\n *\n * @returns\n * The english friendly name of a code.\n */\nexport function getHttpCodeName(code: ZHttpCode): string {\n return (\n ZHttpCodeInformationalResponseNames[code] ||\n ZHttpCodeSuccessNames[code] ||\n ZHttpCodeRedirectionNames[code] ||\n ZHttpCodeClientNames[code] ||\n ZHttpCodeServerNames[code]\n );\n}\n\n/**\n * Gets the english friendly description of a code.\n *\n * @param code -\n * The code to retrieve the description for.\n *\n * @returns\n * The english friendly description of a code.\n */\nexport function getHttpCodeDescription(code: ZHttpCode) {\n return (\n ZHttpCodeInformationalResponseDescriptions[code] ||\n ZHttpCodeSuccessDescriptions[code] ||\n ZHttpCodeRedirectionDescriptions[code] ||\n ZHttpCodeClientDescriptions[code] ||\n ZHttpCodeServerDescriptions[code]\n );\n}\n\n/**\n * Gets the severity of a code.\n *\n * @param code -\n * The severity of a code.\n *\n * @returns\n * The severity of a code.\n */\nexport function getHttpCodeSeverity(code: ZHttpCode): ZHttpCodeSeverity {\n if (code >= 200 && code < 300) {\n return ZHttpCodeSeverity.Success;\n }\n\n if (code >= 400 && code < 500) {\n return ZHttpCodeSeverity.Warning;\n }\n\n if (code >= 500) {\n return ZHttpCodeSeverity.Error;\n }\n\n return ZHttpCodeSeverity.Info;\n}\n\n/**\n * Gets the category of a code.\n *\n * @param code -\n * The category of a code.\n *\n * @returns\n * The code category.\n */\nexport function getHttpCodeCategory(code: ZHttpCode): ZHttpCodeCategory {\n if (code >= 100 && code < 200) {\n return ZHttpCodeCategory.InformationalResponse;\n }\n\n if (code >= 200 && code < 300) {\n return ZHttpCodeCategory.Success;\n }\n\n if (code >= 300 && code < 400) {\n return ZHttpCodeCategory.Redirection;\n }\n\n if (code >= 400 && code < 500) {\n return ZHttpCodeCategory.Client;\n }\n\n return ZHttpCodeCategory.Server;\n}\n","import { ZHttpCodeSuccess } from \"./http-code-success.mjs\";\nimport type { ZHttpCode } from \"./http-code.mjs\";\n\n/**\n * Represents a result from an http request.\n */\nexport interface IZHttpResult<TResult = any> {\n /**\n * The status code.\n */\n status: ZHttpCode;\n\n /**\n * The set of headers that was returned.\n */\n headers: Record<string, any>;\n\n /**\n * The actual body result of the invocation.\n */\n data: TResult;\n}\n\n/**\n * Represents a builder for an IZHttpResult class.\n */\nexport class ZHttpResultBuilder<TData = any> {\n private _result: IZHttpResult<TData>;\n\n /**\n * Initializes a new instance of this object.\n *\n * @param data -\n * The data result.\n */\n public constructor(data: TData) {\n this._result = {\n status: ZHttpCodeSuccess.OK,\n headers: {},\n data,\n };\n }\n\n /**\n * Sets the data.\n *\n * @param data -\n * The data to set.\n *\n * @returns\n * This object.\n */\n public data(data: TData): this {\n this._result.data = data;\n return this;\n }\n\n /**\n * Sets the status code and the english description.\n *\n * @param code -\n * The code to set.\n *\n * @returns\n * This object.\n */\n public status(code: ZHttpCode): this {\n this._result.status = code;\n return this;\n }\n\n /**\n * Sets the return headers.\n *\n * @param headers -\n * The headers to set.\n *\n * @returns\n * This object.\n */\n public headers(headers: Record<string, any> = {}): this {\n this._result.headers = headers;\n return this;\n }\n\n /**\n * Returns the built up result.\n *\n * @returns\n * A shallow copy of the built up result.\n */\n public build(): IZHttpResult {\n return { ...this._result };\n }\n}\n","import type { IZHttpRequest, ZHttpMethod } from \"../request/http-request.mjs\";\nimport { ZHttpCodeClient } from \"../result/http-code-client.mjs\";\nimport type { IZHttpResult } from \"../result/http-result.mjs\";\nimport { ZHttpResultBuilder } from \"../result/http-result.mjs\";\nimport type { IZHttpService } from \"./http-service.mjs\";\n\n/**\n * Represents a mock http service that can be useful for demos,\n * testing, and pre-api implementations.\n */\nexport class ZHttpServiceMock implements IZHttpService {\n private _mapping: {\n [endpoint: string]: {\n [verb: string]: (\n req: IZHttpRequest,\n ) => IZHttpResult | Promise<IZHttpResult>;\n };\n } = {};\n\n /**\n * Sets the result of a given endpoint.\n *\n * @param endpoint -\n * The endpoint to set.\n * @param verb -\n * The endpoint verb to respond to.\n * @param invoke -\n * The result method. If this is falsy, then the endpoint is removed.\n */\n public set<TResult = any>(\n endpoint: string,\n verb: ZHttpMethod,\n invoke:\n | IZHttpResult<TResult>\n | ((\n req: IZHttpRequest,\n ) => IZHttpResult<TResult> | Promise<IZHttpResult<TResult>>),\n ) {\n this._mapping[endpoint] = this._mapping[endpoint] || {};\n this._mapping[endpoint][verb] =\n typeof invoke === \"function\" ? invoke : () => invoke;\n }\n\n /**\n * Invokes the request given the allowed api implementations.\n *\n * @param req -\n * The request that has been made.\n *\n * @returns\n * A promise that resolves with the given result if the status code is less than 400.\n * Any status code above 400 will result in a rejected promise.\n */\n public async request<TResult = any, TBody = any>(\n req: IZHttpRequest<TBody>,\n ): Promise<IZHttpResult<TResult>> {\n const endpointConfig = this._mapping[req.url];\n const result = endpointConfig?.[req.method];\n\n if (result == null) {\n const notFound = new ZHttpResultBuilder(null)\n .status(ZHttpCodeClient.NotFound)\n .build();\n return Promise.reject(notFound);\n }\n\n const errorThreshold = 400;\n const intermediate = await result(req);\n return +intermediate.status < errorThreshold\n ? Promise.resolve(intermediate)\n : Promise.reject(intermediate);\n }\n}\n","/**\n * A method that determines if an object conforms to a Request BodyInit shape.\n *\n * See the BodyInit interface for more information about the possible\n * shapes.\n *\n * @param obj -\n * The object to test.\n *\n * @returns\n * True if obj is a BodyInit shape, false otherwise.\n */\nexport function isBodyInit(obj: any): obj is BodyInit {\n return (\n obj == null ||\n typeof obj === \"string\" ||\n obj instanceof Blob ||\n obj instanceof ArrayBuffer ||\n ArrayBuffer.isView(obj) ||\n obj instanceof FormData ||\n obj instanceof URLSearchParams ||\n obj instanceof ReadableStream\n );\n}\n\n/**\n * A helper method that converts an object to a BodyInit.\n *\n * If obj is not a BodyInit supported object, then it will\n * simply be converted to JSON.\n *\n * @param obj -\n * The object to convert.\n *\n * @returns\n * Obj as a body init serialization. If obj is not\n * compatible with a BodyInit shape, then it is converted\n * to JSON.\n */\nexport function toBodyInit(obj: any): BodyInit {\n return isBodyInit(obj) ? obj : JSON.stringify(obj);\n}\n","/**\n * A helper method that takes an HTTP Fetch Response and converts the body data based on its\n * content type.\n *\n * This will favor a blob as the default type.\n */\nexport function fromContentType(res: Response): Promise<any> {\n const contentType = res.headers.get(\"content-type\");\n\n if (\n contentType?.startsWith(\"application/json\") ||\n contentType?.endsWith(\"+json\")\n ) {\n return res.json();\n }\n\n if (contentType?.startsWith(\"multipart/form-data\")) {\n return res.formData();\n }\n\n if (contentType?.startsWith(\"text\") || contentType?.endsWith(\"+xml\")) {\n return res.text();\n }\n\n return res.blob();\n}\n","import fetch from \"cross-fetch\";\n\nimport type { IZHttpRequest } from \"../request/http-request.mjs\";\nimport { ZHttpCodeClient } from \"../result/http-code-client.mjs\";\nimport { ZHttpCodeServer } from \"../result/http-code-server.mjs\";\nimport type { IZHttpResult } from \"../result/http-result.mjs\";\nimport { ZHttpResultBuilder } from \"../result/http-result.mjs\";\nimport { isBodyInit } from \"../util/body-init.mjs\";\nimport { fromContentType } from \"../util/content-type.mjs\";\n\n/**\n * Represents a service that makes http invocations.\n */\nexport interface IZHttpService {\n /**\n * Makes the request.\n *\n * @param req -\n * The request object to make.\n *\n * @returns\n * A promise that resolves the request if a 200 code is returned, or\n * rejects if a 400 or 500 code is returned. The request is\n * rerouted if a 300 code is returned.\n */\n request<TResult = any, TBody = any>(\n req: IZHttpRequest<TBody>,\n ): Promise<IZHttpResult<TResult>>;\n}\n\n/**\n * Represents an axios based implementation of the http service.\n */\nexport class ZHttpService implements IZHttpService {\n /**\n * Invokes the request with a real http service.\n *\n * @param req -\n * The request information to make.\n */\n public async request<TResult = any, TBody = any>(\n req: IZHttpRequest<TBody>,\n ): Promise<IZHttpResult<TResult>> {\n try {\n const res = await fetch(req.url, {\n method: req.method,\n body: isBodyInit(req.body) ? req.body : JSON.stringify(req.body),\n headers: req.headers,\n redirect: \"follow\",\n });\n\n const data = await fromContentType(res);\n const result = new ZHttpResultBuilder(data)\n .headers(res.headers)\n .status(res.status)\n .build();\n return res.ok ? Promise.resolve(result) : Promise.reject(result);\n } catch (e) {\n let result = new ZHttpResultBuilder(e.message)\n .headers()\n .status(ZHttpCodeServer.InternalServerError);\n\n if (e.code === \"ENOTFOUND\") {\n // The request was made, but some DNS lookup failed.\n result = result.status(ZHttpCodeClient.NotFound);\n }\n\n return Promise.reject(result.build());\n }\n }\n}\n"],"names":["ZHttpMethod","ZHttpRequestBuilder","_define_property","_request","json","content","bind","ZMimeTypeApplication","JSON","method","url","_method","body","undefined","get","post","put","delete","patch","options","head","timeout","ms","headers","header","key","value","type","copy","other","duplicate","build","structuredClone","ZHttpCodeClient","_obj","ZHttpCodeClientNames","_obj1","ZHttpCodeClientDescriptions","ZHttpCodeInformationalResponse","ZHttpCodeInformationalResponseNames","ZHttpCodeInformationalResponseDescriptions","ZHttpCodeRedirection","ZHttpCodeRedirectionNames","ZHttpCodeRedirectionDescriptions","ZHttpCodeServer","ZHttpCodeServerNames","ZHttpCodeServerDescriptions","ZHttpCodeSuccess","ZHttpCodeSuccessNames","ZHttpCodeSuccessDescriptions","ZHttpCodeCategory","ZHttpCodeSeverity","getHttpCodeName","code","getHttpCodeDescription","getHttpCodeSeverity","getHttpCodeCategory","ZHttpResultBuilder","data","_result","status","OK","ZHttpServiceMock","_mapping","set","endpoint","verb","invoke","request","req","endpointConfig","result","notFound","errorThreshold","intermediate","NotFound","Promise","reject","resolve","isBodyInit","obj","Blob","ArrayBuffer","isView","FormData","URLSearchParams","ReadableStream","toBodyInit","stringify","fromContentType","res","contentType","startsWith","endsWith","formData","text","blob","ZHttpService","e","fetch","redirect","ok","message","InternalServerError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;IAGO,IAAKA,WAAAA,iBAAAA,SAAAA,WAAAA,EAAAA;AACV;;;;AAIC,MAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAA;AAGD;;;;AAIC,MAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAA;AAGD;;;;AAIC,MAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAA;AAGD;;;;AAIC,MAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAA;AAGD;;;;;AAKC,MAAA,WAAA,CAAA,OAAA,CAAA,GAAA,OAAA;AAGD;;;;;;AAMC,MAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAA;AAGD;;;;AAIC,MAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAA;AAlDSA,IAAAA,OAAAA,WAAAA;AAoDX,CAAA,CAAA,EAAA;AAmCD;;IAGO,IAAMC,mBAAN,iBAAA,WAAA;AAAMA,IAAAA,SAAAA,mBAAAA,GAAAA;AAAAA,QAAAA,mBAAAA,CAAAA,IAAAA,EAAAA,mBAAAA,CAAAA;AACX,QAAAC,kBAAA,CAAA,IAAA,EAAQC,YAAR,MAAA,CAAA;AAyMA;;;;;MAMAD,kBAAA,CAAA,IAAA,EAAOE,MAAO,EAAA,IAAI,CAACC,OAAO,CAACC,IAAI,CAAC,IAAI,EAAEC,gCAAAA,CAAqBC,IAAI,CAAA,CAAA;QAtL7D,IAAI,CAACL,QAAQ,GAAG;YACdM,MAAM,EAAA,KAAA;YACNC,GAAK,EAAA;AACP,SAAA;;AA7BST,IAAAA,eAAAA,CA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