1 line
30 KiB
Plaintext
1 line
30 KiB
Plaintext
{"version":3,"file":"typertext.min.js","sources":["typertext.js"],"names":["Typertext","BaseException","message","code","custom","this","prototype","GetCode","GetMessage","GetCustom","GenericResponse","status","responseHeaderGetter","httpResponseCode","responseBody","headers","httpStatus","content","GetContent","GetContentType","GetHeader","name","GetHttpStatus","GetStatus","__extends","d","b","__","constructor","p","hasOwnProperty","Http","HttpException","_super","apply","arguments","HttpMethod","HttpProtocol","HttpRequest","Get","request","callback","RawRequest","Post","postData","method","Transport","TransportChooser","HttpResponse","call","HttpResponseStatus","HttpUrl","domain","protocol","path","queryString","port","isNaN","DefaultPort","indexOf","FromUrl","location","l","document","createElement","href","hostname","slice","pathname","DecodeQueryString","search","parseInt","substring","UrlDecodeString","EncodeQueryString","query","rs","UrlEncodeObject","length","data","temp","encodeURIComponent","returnValue","params","splitString","i","param","key","decodeURIComponent","input","separator","limit","chunks","split","ret","splice","push","join","ToString","Json","JsonException","JsonRequest","jsonContentType","jsonType","_this","response","JsonResponse","fromInvalidHttpResponse","fromHttpResponse","parseSuccess","httpResponse","window","parse","e","GetParseStatus","GenericTransport","ieLte9","isXdomain","isXprotocol","XDR","XHR","xdr","XDomainRequest","getHeader","toLowerCase","contentType","undefined","ontimeout","onerror","responseText","onload","onprogress","open","send","xhr","XMLHttpRequest","onreadystatechange","readyState","getResponseHeader","setRequestHeader"],"mappings":"AAAA,GAAIA,YACJ,SAAWA,GACP,GAAIC,GAAgB,WAChB,QAASA,GAAcC,EAASC,EAAMC,GAClCC,KAAKH,QAAUA,EACfG,KAAKF,KAAOA,EACZE,KAAKD,OAASA,EAalB,MAXAH,GAAcK,UAAUC,QAAU,WAC9B,MAAOF,MAAKF,MAGhBF,EAAcK,UAAUE,WAAa,WACjC,MAAOH,MAAKH,SAGhBD,EAAcK,UAAUG,UAAY,WAChC,MAAOJ,MAAKD,QAETH,IAEXD,GAAUC,cAAgBA,GAC3BD,YAAcA,cACjB,IAAIA,YACJ,aAEGA,Y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AI3E,EAAQL,EAASI,EAAUH,GACZ,mBAAbG,KAA4BA,MACf,mBAAbH,KAA4BA,EAAW,WAC9C,MAAO,QAEXR,EAAOgB,KAAK5C,KAAMwC,EAAQL,EAASI,EAAUH,EAE7C,IAAI6F,GAAM,GAAIC,eA4Bd,OA1BAD,GAAIE,mBAAqB,WACrB,GAAsB,GAAlBF,EAAIG,WAAiB,CACrB,GAAId,GAAY,SAAUtG,GACtB,MAAOiH,GAAII,kBAAkBrH,GAI7BoB,GADc,KAAd6F,EAAI3H,OACK,GAAIqC,GAAa,EAAiB2E,EAAWW,EAAI3H,OAAQ2H,EAAIL,cAC/DK,EAAI3H,QAAU,KAAO2H,EAAI3H,OAAS,IAChC,GAAIqC,GAAa,EAAqB2E,EAAWW,EAAI3H,OAAQ2H,EAAIL,cACnEK,EAAI3H,QAAU,KAAO2H,EAAI3H,OAAS,IAChC,GAAIqC,GAAa,EAAqB2E,EAAWW,EAAI3H,OAAQ2H,EAAIL,cAEjE,GAAIjF,GAAa,EAAsB2E,EAAWW,EAAI3H,OAAQ2H,EAAIL,iBAKvFK,EAAIP,UAAY,WACZtF,EAAS,GAAIO,GAAa,EAAiB,WACvC,MAAO,IACR,GAAI,MAGXsF,EAAIF,KAAKhG,EAAWS,GAASL,EAAQ0D,YAAY,GAEnC,GAAVrD,MACAyF,GAAID,QAIRC,EAAIK,iBAAiB,eAAgB,yCAErCL,GAAID,KAAKlF,EAAQ0B,gBAAgBjC,KAErC,MA7CApB,WAAUgG,EAAKvF,GA6CRuF,GACRxH,EAAU8C,UAAUqE,iBACvBrE,GAAU0E,IAAMA,GACjBxH,EAAU8C,YAAc9C,EAAU8C,cACrB9C,GAAU8C,WAC3B9C,YAAcA","sourcesContent":["var Typertext;\n(function (Typertext) {\n var BaseException = (function () {\n function BaseException(message, code, custom) {\n this.message = message;\n this.code = code;\n this.custom = custom;\n }\n BaseException.prototype.GetCode = function () {\n return this.code;\n };\n\n BaseException.prototype.GetMessage = function () {\n return this.message;\n };\n\n BaseException.prototype.GetCustom = function () {\n return this.custom;\n };\n return BaseException;\n })();\n Typertext.BaseException = BaseException;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n \n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n var GenericResponse = (function () {\n function GenericResponse(status, responseHeaderGetter, httpResponseCode, responseBody) {\n this.status = status;\n this.headers = responseHeaderGetter;\n this.httpStatus = httpResponseCode;\n this.content = responseBody;\n }\n GenericResponse.prototype.GetContent = function () {\n return this.content;\n };\n\n GenericResponse.prototype.GetContentType = function () {\n return this.GetHeader(\"Content-Type\");\n };\n\n GenericResponse.prototype.GetHeader = function (name) {\n return this.headers(name);\n };\n\n GenericResponse.prototype.GetHttpStatus = function () {\n return this.httpStatus;\n };\n\n GenericResponse.prototype.GetStatus = function () {\n return this.status;\n };\n return GenericResponse;\n })();\n Typertext.GenericResponse = GenericResponse;\n})(Typertext || (Typertext = {}));\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpException = (function (_super) {\n __extends(HttpException, _super);\n function HttpException() {\n _super.apply(this, arguments);\n }\n return HttpException;\n })(Typertext.BaseException);\n Http.HttpException = HttpException;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n (function (HttpMethod) {\n HttpMethod[HttpMethod[\"GET\"] = 0] = \"GET\";\n HttpMethod[HttpMethod[\"POST\"] = 1] = \"POST\";\n })(Http.HttpMethod || (Http.HttpMethod = {}));\n var HttpMethod = Http.HttpMethod;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n (function (HttpProtocol) {\n HttpProtocol[HttpProtocol[\"http\"] = 0] = \"http\";\n HttpProtocol[HttpProtocol[\"https\"] = 1] = \"https\";\n })(Http.HttpProtocol || (Http.HttpProtocol = {}));\n var HttpProtocol = Http.HttpProtocol;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpRequest = (function () {\n function HttpRequest() {\n }\n HttpRequest.prototype.Get = function (request, callback) {\n this.RawRequest(0 /* GET */, request, {}, callback);\n };\n\n HttpRequest.prototype.Post = function (request, postData, callback) {\n this.RawRequest(1 /* POST */, request, postData, callback);\n };\n\n HttpRequest.prototype.RawRequest = function (method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n }; }\n Typertext.Transport.TransportChooser.Transport(method, request, postData, callback);\n };\n return HttpRequest;\n })();\n Http.HttpRequest = HttpRequest;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpResponse = (function (_super) {\n __extends(HttpResponse, _super);\n function HttpResponse(status, responseHeaderGetter, httpResponseCode, responseBody) {\n _super.call(this, status, responseHeaderGetter, httpResponseCode, responseBody);\n }\n return HttpResponse;\n })(Typertext.GenericResponse);\n Http.HttpResponse = HttpResponse;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n (function (HttpResponseStatus) {\n HttpResponseStatus[HttpResponseStatus[\"success\"] = 0] = \"success\";\n HttpResponseStatus[HttpResponseStatus[\"serverError\"] = 1] = \"serverError\";\n HttpResponseStatus[HttpResponseStatus[\"clientError\"] = 2] = \"clientError\";\n HttpResponseStatus[HttpResponseStatus[\"responseError\"] = 3] = \"responseError\";\n HttpResponseStatus[HttpResponseStatus[\"unknownError\"] = 4] = \"unknownError\";\n HttpResponseStatus[HttpResponseStatus[\"timeout\"] = 5] = \"timeout\";\n })(Http.HttpResponseStatus || (Http.HttpResponseStatus = {}));\n var HttpResponseStatus = Http.HttpResponseStatus;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Http) {\n var HttpUrl = (function () {\n function HttpUrl(domain, protocol, path, queryString, port) {\n if (typeof protocol === \"undefined\") { protocol = 0 /* http */; }\n if (typeof path === \"undefined\") { path = \"/\"; }\n if (typeof queryString === \"undefined\") { queryString = {}; }\n if (typeof port === \"undefined\") { port = 0; }\n if (port < 1 || port > 65535 || isNaN(port)) {\n port = HttpUrl.DefaultPort(protocol);\n }\n\n if (path.indexOf(\"/\") != 0) {\n path = \"/\" + path;\n }\n\n this.domain = domain;\n this.protocol = protocol;\n this.path = path;\n this.queryString = queryString;\n this.port = port;\n }\n HttpUrl.DefaultPort = function (protocol) {\n switch (protocol) {\n case 0 /* http */:\n return 80;\n case 1 /* https */:\n return 443;\n default:\n return -1;\n }\n };\n\n HttpUrl.FromUrl = function (location) {\n var l = document.createElement(\"a\");\n l.href = location;\n return new HttpUrl(l.hostname, Typertext.Http.HttpProtocol[l.protocol.slice(0, -1)], l.pathname, HttpUrl.DecodeQueryString(l.search), parseInt(l.port));\n };\n\n HttpUrl.DecodeQueryString = function (queryString) {\n if (queryString.indexOf(\"?\") == 0) {\n queryString = queryString.substring(1);\n }\n\n return HttpUrl.UrlDecodeString(queryString);\n };\n\n HttpUrl.EncodeQueryString = function (query) {\n var rs = \"?\" + HttpUrl.UrlEncodeObject(query);\n return ((rs.length == 1) ? \"\" : rs);\n };\n\n HttpUrl.UrlEncodeObject = function (data) {\n var rs = \"\";\n var temp;\n\n for (temp in data) {\n rs += encodeURIComponent(temp) + \"=\" + encodeURIComponent(data[temp]) + \"&\";\n }\n\n return rs.slice(0, -1);\n };\n\n HttpUrl.UrlDecodeString = function (queryString) {\n var returnValue = {}, params = HttpUrl.splitString(queryString, \"&\");\n for (var i = 0; i < params.length; i++) {\n if (params[i] == \"\") {\n continue;\n }\n\n var param = HttpUrl.splitString(params[i], \"=\", 2);\n var key = decodeURIComponent(param[0]);\n if (param.length == 1) {\n returnValue[key] = \"\";\n continue;\n }\n\n returnValue[key] = decodeURIComponent(param[1]);\n }\n\n return returnValue;\n };\n\n HttpUrl.splitString = function (input, separator, limit) {\n if (typeof limit === \"undefined\") { limit = -1; }\n limit++;\n var chunks = input.split(separator);\n if (limit > 0 && chunks.length > limit) {\n var ret = chunks.splice(0, limit);\n ret.push(chunks.join(separator));\n return ret;\n }\n return chunks;\n };\n\n HttpUrl.prototype.ToString = function () {\n return Typertext.Http.HttpProtocol[this.protocol] + \"://\" + this.domain + ((this.port == HttpUrl.DefaultPort(this.protocol)) ? \"\" : \":\" + this.port) + this.path + HttpUrl.EncodeQueryString(this.queryString);\n };\n return HttpUrl;\n })();\n Http.HttpUrl = HttpUrl;\n })(Typertext.Http || (Typertext.Http = {}));\n var Http = Typertext.Http;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Json) {\n var JsonException = (function (_super) {\n __extends(JsonException, _super);\n function JsonException(message, code) {\n _super.call(this, message, code, null);\n }\n return JsonException;\n })(Typertext.BaseException);\n Json.JsonException = JsonException;\n })(Typertext.Json || (Typertext.Json = {}));\n var Json = Typertext.Json;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Json) {\n var HttpRequest = Typertext.Http.HttpRequest;\n\n var HttpMethod = Typertext.Http.HttpMethod;\n\n var JsonRequest = (function () {\n function JsonRequest(jsonContentType) {\n if (typeof jsonContentType === \"undefined\") { jsonContentType = \"application/json\"; }\n this.request = new HttpRequest();\n this.jsonType = jsonContentType;\n }\n JsonRequest.prototype.Get = function (request, callback) {\n this.RawRequest(0 /* GET */, request, {}, callback);\n };\n\n JsonRequest.prototype.Post = function (request, postData, callback) {\n this.RawRequest(1 /* POST */, request, postData, callback);\n };\n\n JsonRequest.prototype.RawRequest = function (method, request, postData, callback) {\n var _this = this;\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback != \"function\") {\n this.request.RawRequest(method, request, postData, function () {\n });\n return;\n }\n\n this.request.RawRequest(method, request, postData, function (response) {\n if (response.GetContentType() != _this.jsonType) {\n callback(Typertext.Json.JsonResponse.fromInvalidHttpResponse(response));\n return;\n }\n\n callback(Typertext.Json.JsonResponse.fromHttpResponse(response));\n });\n };\n return JsonRequest;\n })();\n Json.JsonRequest = JsonRequest;\n })(Typertext.Json || (Typertext.Json = {}));\n var Json = Typertext.Json;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Json) {\n var HttpResponseStatus = Typertext.Http.HttpResponseStatus;\n\n var JsonResponse = (function (_super) {\n __extends(JsonResponse, _super);\n function JsonResponse(status, responseHeaderGetter, httpResponseCode, responseBody, parseSuccess) {\n _super.call(this, status, responseHeaderGetter, httpResponseCode, responseBody);\n parseSuccess = !!parseSuccess || false;\n this.parseSuccess = parseSuccess;\n }\n JsonResponse.fromHttpResponse = function (httpResponse) {\n try {\n return new JsonResponse(httpResponse.GetStatus(), httpResponse.GetHeader, httpResponse.GetHttpStatus(), window[\"JSON\"].parse(httpResponse.GetContent()), true);\n } catch (e) {\n return new JsonResponse(httpResponse.GetStatus(), httpResponse.GetHeader, httpResponse.GetHttpStatus(), null);\n }\n };\n\n JsonResponse.fromInvalidHttpResponse = function (httpResponse) {\n return new JsonResponse(3 /* responseError */, httpResponse.GetHeader, httpResponse.GetHttpStatus());\n };\n\n JsonResponse.prototype.GetParseStatus = function () {\n return this.parseSuccess;\n };\n return JsonResponse;\n })(Typertext.GenericResponse);\n Json.JsonResponse = JsonResponse;\n })(Typertext.Json || (Typertext.Json = {}));\n var Json = Typertext.Json;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var GenericTransport = (function () {\n function GenericTransport(method, request, postData, callback) {\n }\n return GenericTransport;\n })();\n Transport.GenericTransport = GenericTransport;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var TransportChooser = (function () {\n function TransportChooser() {\n }\n TransportChooser.Transport = function (method, request, postData, callback) {\n var ieLte9 = false;\n var isXdomain = false;\n var isXprotocol = false;\n\n if (!ieLte9) {\n return new Typertext.Transport.XDR(method, request, postData, callback);\n } else if (isXdomain && !isXprotocol) {\n return new Typertext.Transport.XHR(method, request, postData, callback);\n }\n\n throw {};\n };\n return TransportChooser;\n })();\n Transport.TransportChooser = TransportChooser;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var HttpMethod = Typertext.Http.HttpMethod;\n var HttpUrl = Typertext.Http.HttpUrl;\n\n var HttpResponseStatus = Typertext.Http.HttpResponseStatus;\n var HttpResponse = Typertext.Http.HttpResponse;\n\n var XDR = (function (_super) {\n __extends(XDR, _super);\n function XDR(method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n return null;\n }; }\n _super.call(this, method, request, postData, callback);\n\n var xdr = new XDomainRequest();\n\n var getHeader = function (name) {\n if (name.toLowerCase() === \"content-type\") {\n return xdr.contentType;\n }\n return undefined;\n };\n\n xdr.ontimeout = function () {\n callback(new HttpResponse(5 /* timeout */, function (i) {\n return \"\";\n }, -1, \"\"));\n };\n\n xdr.onerror = function () {\n callback(new HttpResponse(4 /* unknownError */, getHeader, -1, xdr.responseText));\n };\n\n xdr.onload = function () {\n callback(new HttpResponse(0 /* success */, getHeader, 200, xdr.responseText));\n };\n\n xdr.onprogress = function () {\n return null;\n };\n\n xdr.open(HttpMethod[method], request.ToString());\n\n if (method == 0 /* GET */) {\n xdr.send();\n return;\n }\n\n xdr.send(HttpUrl.UrlEncodeObject(postData));\n }\n return XDR;\n })(Typertext.Transport.GenericTransport);\n Transport.XDR = XDR;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\nvar Typertext;\n(function (Typertext) {\n (function (Transport) {\n var HttpMethod = Typertext.Http.HttpMethod;\n var HttpUrl = Typertext.Http.HttpUrl;\n\n var HttpResponseStatus = Typertext.Http.HttpResponseStatus;\n var HttpResponse = Typertext.Http.HttpResponse;\n\n var XHR = (function (_super) {\n __extends(XHR, _super);\n function XHR(method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n return null;\n }; }\n _super.call(this, method, request, postData, callback);\n\n var xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState == 4) {\n var getHeader = function (name) {\n return xhr.getResponseHeader(name);\n };\n\n if (xhr.status == 200) {\n callback(new HttpResponse(0 /* success */, getHeader, xhr.status, xhr.responseText));\n } else if (xhr.status >= 400 && xhr.status < 500) {\n callback(new HttpResponse(2 /* clientError */, getHeader, xhr.status, xhr.responseText));\n } else if (xhr.status >= 500 && xhr.status < 600) {\n callback(new HttpResponse(1 /* serverError */, getHeader, xhr.status, xhr.responseText));\n } else {\n callback(new HttpResponse(4 /* unknownError */, getHeader, xhr.status, xhr.responseText));\n }\n }\n };\n\n xhr.ontimeout = function () {\n callback(new HttpResponse(5 /* timeout */, function (i) {\n return \"\";\n }, -1, \"\"));\n };\n\n xhr.open(HttpMethod[method], request.ToString(), true);\n\n if (method == 0 /* GET */) {\n xhr.send();\n return;\n }\n\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\n xhr.send(HttpUrl.UrlEncodeObject(postData));\n }\n return XHR;\n })(Typertext.Transport.GenericTransport);\n Transport.XHR = XHR;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\n//# sourceMappingURL=typertext.js.map\n"]} |