From 4df82a0507d4f0074ef160b1221840ce8c5decb9 Mon Sep 17 00:00:00 2001 From: Kegan Myers Date: Fri, 11 Apr 2014 13:51:54 -0500 Subject: [PATCH] Begin adding support for XDR requests --- build/typertext.d.ts | 20 +++ build/typertext.js | 148 +++++++++++++++----- build/typertext.js.map | 2 +- build/typertext.min.js | 2 +- build/typertext.min.js.map | 2 +- lib/Typertext/Http/HttpRequest.ts | 54 +------ lib/Typertext/Transport/GenericTransport.ts | 10 ++ lib/Typertext/Transport/TransportChooser.ts | 17 +++ lib/Typertext/Transport/XDR.ts | 13 ++ lib/Typertext/Transport/XHR.ts | 67 +++++++++ 10 files changed, 241 insertions(+), 94 deletions(-) create mode 100644 lib/Typertext/Transport/GenericTransport.ts create mode 100644 lib/Typertext/Transport/TransportChooser.ts create mode 100644 lib/Typertext/Transport/XDR.ts create mode 100644 lib/Typertext/Transport/XHR.ts diff --git a/build/typertext.d.ts b/build/typertext.d.ts index 2ea0f0b..8748fd8 100644 --- a/build/typertext.d.ts +++ b/build/typertext.d.ts @@ -139,3 +139,23 @@ declare module Typertext.Json { interface JsonResponseHandler extends GenericResponseHandler { } } +declare module Typertext.Transport { + interface GenericTransport { + RawRequest(method: Http.HttpMethod, request: Http.HttpUrl, postData: Http.HttpPostData, callback: Http.HttpResponseHandler): void; + } +} +declare module Typertext.Transport { + class TransportChooser { + static GetTransport(method: Http.HttpMethod, request: Http.HttpUrl): GenericTransport; + } +} +declare module Typertext.Transport { + class XDR implements GenericTransport { + public RawRequest(method: Http.HttpMethod, request: Http.HttpUrl, postData?: Http.HttpPostData, callback?: Http.HttpResponseHandler): void; + } +} +declare module Typertext.Transport { + class XHR implements GenericTransport { + public RawRequest(method: Http.HttpMethod, request: Http.HttpUrl, postData?: Http.HttpPostData, callback?: Http.HttpResponseHandler): void; + } +} diff --git a/build/typertext.js b/build/typertext.js index 429ab0b..ab4b4d8 100644 --- a/build/typertext.js +++ b/build/typertext.js @@ -117,44 +117,7 @@ var Typertext; if (typeof postData === "undefined") { postData = {}; } if (typeof callback === "undefined") { callback = function (c) { }; } - var noop = function (i) { - return ""; - }; - - var xhr = new XMLHttpRequest(); - - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - var getHeader = function (name) { - return xhr.getResponseHeader(name); - }; - - if (xhr.status == 200) { - callback(new Typertext.Http.HttpResponse(0 /* success */, getHeader, xhr.status, xhr.responseText)); - } else if (xhr.status >= 400 && xhr.status < 500) { - callback(new Typertext.Http.HttpResponse(2 /* clientError */, getHeader, xhr.status, xhr.responseText)); - } else if (xhr.status >= 500 && xhr.status < 600) { - callback(new Typertext.Http.HttpResponse(1 /* serverError */, getHeader, xhr.status, xhr.responseText)); - } else { - callback(new Typertext.Http.HttpResponse(4 /* unknownError */, getHeader, xhr.status, xhr.responseText)); - } - } - }; - - xhr.ontimeout = function () { - callback(new Typertext.Http.HttpResponse(5 /* timeout */, noop, -1, "")); - }; - - xhr.open(Typertext.Http.HttpMethod[method], request.ToString(), true); - - if (method == 0 /* GET */) { - xhr.send(); - return; - } - - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - - xhr.send(Typertext.Http.HttpUrl.UrlEncodeObject(postData)); + Typertext.Transport.TransportChooser.GetTransport(method, request).RawRequest(method, request, postData, callback); }; return HttpRequest; })(); @@ -388,4 +351,113 @@ var Typertext; })(Typertext.Json || (Typertext.Json = {})); var Json = Typertext.Json; })(Typertext || (Typertext = {})); +var Typertext; +(function (Typertext) { + (function (Transport) { + })(Typertext.Transport || (Typertext.Transport = {})); + var Transport = Typertext.Transport; +})(Typertext || (Typertext = {})); +var Typertext; +(function (Typertext) { + (function (Transport) { + var TransportChooser = (function () { + function TransportChooser() { + } + TransportChooser.GetTransport = function (method, request) { + var ieLte9 = false; + var isXdomain = false; + var isXprotocol = false; + + if (!ieLte9) { + return new Typertext.Transport.XDR(); + } else if (isXdomain && !isXprotocol) { + return new Typertext.Transport.XHR(); + } + + throw {}; + }; + return TransportChooser; + })(); + Transport.TransportChooser = TransportChooser; + })(Typertext.Transport || (Typertext.Transport = {})); + var Transport = Typertext.Transport; +})(Typertext || (Typertext = {})); +var Typertext; +(function (Typertext) { + (function (Transport) { + var XDR = (function () { + function XDR() { + } + XDR.prototype.RawRequest = function (method, request, postData, callback) { + if (typeof postData === "undefined") { postData = {}; } + if (typeof callback === "undefined") { callback = function (c) { + }; } + }; + return XDR; + })(); + Transport.XDR = XDR; + })(Typertext.Transport || (Typertext.Transport = {})); + var Transport = Typertext.Transport; +})(Typertext || (Typertext = {})); +var Typertext; +(function (Typertext) { + (function (Transport) { + var HttpMethod = Typertext.Http.HttpMethod; + var HttpUrl = Typertext.Http.HttpUrl; + + var HttpResponseStatus = Typertext.Http.HttpResponseStatus; + var HttpResponse = Typertext.Http.HttpResponse; + + var XHR = (function () { + function XHR() { + } + XHR.prototype.RawRequest = function (method, request, postData, callback) { + if (typeof postData === "undefined") { postData = {}; } + if (typeof callback === "undefined") { callback = function (c) { + }; } + var noop = function (i) { + return ""; + }; + + var xhr = new XMLHttpRequest(); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + var getHeader = function (name) { + return xhr.getResponseHeader(name); + }; + + if (xhr.status == 200) { + callback(new HttpResponse(0 /* success */, getHeader, xhr.status, xhr.responseText)); + } else if (xhr.status >= 400 && xhr.status < 500) { + callback(new HttpResponse(2 /* clientError */, getHeader, xhr.status, xhr.responseText)); + } else if (xhr.status >= 500 && xhr.status < 600) { + callback(new HttpResponse(1 /* serverError */, getHeader, xhr.status, xhr.responseText)); + } else { + callback(new HttpResponse(4 /* unknownError */, getHeader, xhr.status, xhr.responseText)); + } + } + }; + + xhr.ontimeout = function () { + callback(new HttpResponse(5 /* timeout */, noop, -1, "")); + }; + + xhr.open(HttpMethod[method], request.ToString(), true); + + if (method == 0 /* GET */) { + xhr.send(); + return; + } + + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + + xhr.send(HttpUrl.UrlEncodeObject(postData)); + }; + return XHR; + })(); + Transport.XHR = XHR; + })(Typertext.Transport || (Typertext.Transport = {})); + var Transport = Typertext.Transport; +})(Typertext || (Typertext = {})); //# sourceMappingURL=typertext.js.map diff --git a/build/typertext.js.map b/build/typertext.js.map index c9b6faa..211612e 100644 --- a/build/typertext.js.map +++ b/build/typertext.js.map @@ -1 +1 @@ -{"version":3,"file":"typertext.js","sourceRoot":"","sources":["../lib/Typertext/BaseException.ts","../lib/Typertext/GenericRequest.ts","../lib/Typertext/GenericResponse.ts","../lib/Typertext/GenericResponseHandler.ts","../lib/Typertext/Http/HttpException.ts","../lib/Typertext/Http/HttpMethod.ts","../lib/Typertext/Http/HttpPostData.ts","../lib/Typertext/Http/HttpProtocol.ts","../lib/Typertext/Http/HttpQueryString.ts","../lib/Typertext/Http/HttpRequest.ts","../lib/Typertext/Http/HttpResponse.ts","../lib/Typertext/Http/HttpResponseHandler.ts","../lib/Typertext/Http/HttpResponseStatus.ts","../lib/Typertext/Http/HttpUrl.ts","../lib/Typertext/Json/JsonException.ts","../lib/Typertext/Json/JsonObject.ts","../lib/Typertext/Json/JsonRequest.ts","../lib/Typertext/Json/JsonResponse.ts","../lib/Typertext/Json/JsonResponseHandler.ts"],"names":["Typertext","Typertext.BaseException","Typertext.BaseException.constructor","Typertext.BaseException.GetCode","Typertext.BaseException.GetMessage","Typertext.BaseException.GetCustom","Typertext.GenericResponse","Typertext.GenericResponse.constructor","Typertext.GenericResponse.GetContent","Typertext.GenericResponse.GetContentType","Typertext.GenericResponse.GetHeader","Typertext.GenericResponse.GetHttpStatus","Typertext.GenericResponse.GetStatus","Typertext.Http","Typertext.Http.HttpException","Typertext.Http.HttpException.constructor","Typertext.Http.HttpMethod","Typertext.Http.HttpProtocol","Typertext.Http.HttpRequest","Typertext.Http.HttpRequest.constructor","Typertext.Http.HttpRequest.Get","Typertext.Http.HttpRequest.Post","Typertext.Http.HttpRequest.RawRequest","Typertext.Http.HttpResponse","Typertext.Http.HttpResponse.constructor","Typertext.Http.HttpResponseStatus","Typertext.Http.HttpUrl","Typertext.Http.HttpUrl.constructor","Typertext.Http.HttpUrl.DefaultPort","Typertext.Http.HttpUrl.FromUrl","Typertext.Http.HttpUrl.DecodeQueryString","Typertext.Http.HttpUrl.EncodeQueryString","Typertext.Http.HttpUrl.UrlEncodeObject","Typertext.Http.HttpUrl.UrlDecodeString","Typertext.Http.HttpUrl.splitString","Typertext.Http.HttpUrl.ToString","Typertext.Json","Typertext.Json.JsonException","Typertext.Json.JsonException.constructor","Typertext.Json.JsonRequest","Typertext.Json.JsonRequest.constructor","Typertext.Json.JsonRequest.Get","Typertext.Json.JsonRequest.Post","Typertext.Json.JsonRequest.RawRequest","Typertext.Json.JsonResponse","Typertext.Json.JsonResponse.constructor","Typertext.Json.JsonResponse.fromHttpResponse","Typertext.Json.JsonResponse.fromInvalidHttpResponse","Typertext.Json.JsonResponse.GetParseStatus"],"mappings":"AAKA,IAAO,SAAS;AA+Cf,CA/CD,UAAO,SAAS;IACZA;QAaIC,uBAAYA,OAAcA,EAAEA,IAAWA,EAAEA,MAAQA;YAC7CC,IAAIA,CAACA,OAAOA,GAAGA,OAAOA;YACtBA,IAAIA,CAACA,IAAIA,GAAGA,IAAIA;YAChBA,IAAIA,CAACA,MAAMA,GAAGA,MAAMA;QACxBA,CAACA;QAODD,kCAAAA;YACIE,OAAOA,IAAIA,CAACA,IAAIA;QACpBA,CAACA;;QAODF,qCAAAA;YACIG,OAAOA,IAAIA,CAACA,OAAOA;QACvBA,CAACA;;QAODH,oCAAAA;YACII,OAAOA,IAAIA,CAACA,MAAMA;QACtBA,CAACA;QACLJ,qBAACA;IAADA,CAACA,IAAAD;IA7CDA,wCA6CCA;AACLA,CAACA,iCAAA;AC/CD,IAAO,SAAS;AA6Cf,CA7CD,UAAO,SAAS;;AA6ChBA,CAACA,iCAAA;AC7CD,IAAO,SAAS;AAiFf,CAjFD,UAAO,SAAS;IAGZA;QAsBIM,yBAAYA,MAAyBA,EAAEA,oBAA4CA,EAAEA,gBAAwBA,EAAEA,YA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EAAEA,MAAMA,CAACA,MAAMA,CAACA,CAACA,KAAKA,CAACA,YAAYA,CAACA,UAAUA,CAACA,CAACA,CAACA,EAAEA,IAAIA,CAACA;iBACjKA,CAACA,OAAMA,CAACA,CAAEA;oBACPA,OAAOA,IAAIA,YAAYA,CAACA,YAAYA,CAACA,SAASA,CAACA,CAACA,EAAEA,YAAYA,CAACA,SAASA,EAAEA,YAAYA,CAACA,aAAaA,CAACA,CAACA,EAAEA,IAAIA,CAACA;iBAChHA;YACLA,CAACA;;YAQDF,uCAAAA,UAAsCA,YAAyBA;gBACvDG,OAAOA,IAAIA,YAAYA,CAACA,qBAAgCA,EAAEA,YAAYA,CAACA,SAASA,EAAEA,YAAYA,CAACA,aAAaA,CAACA,CAACA,CAACA;YACvHA,CAACA;;YA0BDH,wCAAAA;gBACII,OAAOA,IAAIA,CAACA,YAAYA;YAC5BA,CAACA;YACLJ,oBAACA;QAADA,CAACA,EA5DiCR,SAASA,CAACA,eAAeA,EA4D1DA;QA5DDA,iCA4DCA;IACLA,CAACA,2CAAApC;8BAAAA;AAADA,CAACA,iCAAA"} \ No newline at end of file +{"version":3,"file":"typertext.js","sourceRoot":"","sources":["../lib/Typertext/BaseException.ts","../lib/Typertext/GenericRequest.ts","../lib/Typertext/GenericResponse.ts","../lib/Typertext/GenericResponseHandler.ts","../lib/Typertext/Http/HttpException.ts","../lib/Typertext/Http/HttpMethod.ts","../lib/Typertext/Http/HttpPostData.ts","../lib/Typertext/Http/HttpProtocol.ts","../lib/Typertext/Http/HttpQueryString.ts","../lib/Typertext/Http/HttpRequest.ts","../lib/Typertext/Http/HttpResponse.ts","../lib/Typertext/Http/HttpResponseHandler.ts","../lib/Typertext/Http/HttpResponseStatus.ts","../lib/Typertext/Http/HttpUrl.ts","../lib/Typertext/Json/JsonException.ts","../lib/Typertext/Json/JsonObject.ts","../lib/Typertext/Json/JsonRequest.ts","../lib/Typertext/Json/JsonResponse.ts","../lib/Typertext/Json/JsonResponseHandler.ts","../lib/Typertext/Transport/GenericTransport.ts","../lib/Typertext/Transport/TransportChooser.ts","../lib/Typertext/Transport/XDR.ts","../lib/Typertext/Transport/XHR.ts"],"names":["Typertext","Typertext.BaseException","Typertext.BaseException.constructor","Typertext.BaseException.GetCode","Typertext.BaseException.GetMessage","Typertext.BaseException.GetCustom","Typertext.GenericResponse","Typertext.GenericResponse.constructor","Typertext.GenericResponse.GetContent","Typertext.GenericResponse.GetContentType","Typertext.GenericResponse.GetHeader","Typertext.GenericResponse.GetHttpStatus","Typertext.GenericResponse.GetStatus","Typertext.Http","Typertext.Http.HttpException","Typertext.Http.HttpException.constructor","Typertext.Http.HttpMethod","Typertext.Http.HttpProtocol","Typertext.Http.HttpRequest","Typertext.Http.HttpRequest.constructor","Typertext.Http.HttpRequest.Get","Typertext.Http.HttpRequest.Post","Typertext.Http.HttpRequest.RawRequest","Typertext.Http.HttpResponse","Typertext.Http.HttpResponse.constructor","Typertext.Http.HttpResponseStatus","Typertext.Http.HttpUrl","Typertext.Http.HttpUrl.constructor","Typertext.Http.HttpUrl.DefaultPort","Typertext.Http.HttpUrl.FromUrl","Typertext.Http.HttpUrl.DecodeQueryString","Typertext.Http.HttpUrl.EncodeQueryString","Typertext.Http.HttpUrl.UrlEncodeObject","Typertext.Http.HttpUrl.UrlDecodeString","Typertext.Http.HttpUrl.splitString","Typertext.Http.HttpUrl.ToString","Typertext.Json","Typertext.Json.JsonException","Typertext.Json.JsonException.constructor","Typertext.Json.JsonRequest","Typertext.Json.JsonRequest.constructor","Typertext.Json.JsonRequest.Get","Typertext.Json.JsonRequest.Post","Typertext.Json.JsonRequest.RawRequest","Typertext.Json.JsonResponse","Typertext.Json.JsonResponse.constructor","Typertext.Json.JsonResponse.fromHttpResponse","Typertext.Json.JsonResponse.fromInvalidHttpResponse","Typertext.Json.JsonResponse.GetParseStatus","Typertext.Transport","Typertext.Transport.TransportChooser","Typertext.Transport.TransportChooser.constructor","Typertext.Transport.TransportChooser.GetTransport","Typertext.Transport.XDR","Typertext.Transport.XDR.constructor","Typertext.Transport.XDR.RawRequest","Typertext.Transport.XHR","Typertext.Transport.XHR.constructor","Typertext.Transport.XHR.RawRequest"],"mappings":"AAKA,IAAO,SAAS;AA+Cf,CA/CD,UAAO,SAAS;IACZA;QAaIC,uBAAYA,OAAcA,EAAEA,IAAWA,EAAEA,MAAQA;YAC7CC,IAAIA,CAACA,OAAOA,GAAGA,OAAOA;YACtBA,IAAIA,CAACA,IAAIA,GAAGA,IAAIA;YAChBA,IAAIA,CAACA,MAAMA,GAAGA,MAAMA;QACxBA,CAACA;QAODD,kCAAAA;YACIE,OAAOA,IAAIA,CAACA,IAAIA;QACpBA,CAACA;;QAODF,qCAAAA;YACIG,OAAOA,IAAIA,CAACA,OAAOA;QACvBA,CAACA;;QAODH,oCAAAA;YACII,OAAOA,IAAIA,CAACA,MAAMA;QACtBA,CAACA;QACLJ,qBAACA;IAADA,CAACA,IAAAD;IA7CDA,wCA6CCA;AACLA,CAACA,iCAAA;AC/CD,IAAO,SAAS;AA6Cf,CA7CD,UAAO,SAAS;;AA6ChBA,CAACA,iCAAA;AC7CD,IAAO,SAAS;AAiFf,CAjFD,UAAO,SAAS;IAGZA;QAsBIM,yBAAYA,MAAyBA,EAAEA,oBAA4CA,EAAEA,gBAAwBA,EAAEA,YAAeA;YAC1HC,IAAIA,CAACA,MAAMA,GAAGA,MAAMA;YACpBA,IAAIA,CAACA,OAAOA,GAAGA,oBAAoBA;YACnCA,IAAIA,CAACA,UAAUA,GAAGA,gBAAgBA;YAClCA,IAAIA,CAACA,OAAOA,GAAGA,YAAYA;QAC/BA,CAACA;QAODD,uCAAAA;YACIE,OAAOA,IAAIA,CAACA,OAAOA;QACvBA,CAACA;;QAQDF,2CAAAA;YACIG,OAAOA,IAAIA,CAACA,SAASA,CAACA,cAAcA,CAACA;QACzCA,CAACA;;QAQDH,sCAAAA,UAAiBA,IAAWA;YACxBI,OAAOA,IAAIA,CAACA,OAAOA,CAACA,IAAIA,CAACA;QAC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,GAAGA,CAACA,MAAMA,EAAEA,GAAGA,CAACA,YAAYA,CAACA,CAACA;yBACtGA,KAAMA;4BAEHA,QAAQA,CAACA,IAAIA,YAAYA,CAACA,oBAA+BA,EAAEA,SAASA,EAAEA,GAAGA,CAACA,MAAMA,EAAEA,GAAGA,CAACA,YAAYA,CAACA,CAACA;yBACvGA;qBACJA;gBACLA,CAACA;;gBAGDA,GAAGA,CAACA,SAASA,GAAGA;oBAEZA,QAAQA,CAACA,IAAIA,YAAYA,CAACA,eAA0BA,EAAEA,IAAIA,EAAEA,CAACA,CAACA,EAAEA,EAAEA,CAACA,CAACA;gBACxEA,CAACA;;gBAGDA,GAAGA,CAACA,IAAIA,CAACA,UAAUA,CAACA,MAAMA,CAACA,EAAEA,OAAOA,CAACA,QAAQA,CAACA,CAACA,EAAEA,IAAIA,CAACA;;gBAGtDA,IAAIA,MAAMA,IAAIA,WAAcA,CAAEA;oBAE1BA,GAAGA,CAACA,IAAIA,CAACA,CAACA;oBACVA,MAAOA;iBACVA;;gBAGDA,GAAGA,CAACA,gBAAgBA,CAACA,cAAcA,EAAEA,mCAAmCA,CAACA;;gBAEzEA,GAAGA,CAACA,IAAIA,CAACA,OAAOA,CAACA,eAAeA,CAACA,QAAQA,CAACA,CAACA;YAC/CA,CAACA;YACLF,WAACA;QAADA,CAACA,IAAAP;QAzDDA,oBAyDCA;IACLA,CAACA,qDAAAjD;wCAAAA;AAADA,CAACA,iCAAA"} \ No newline at end of file diff --git a/build/typertext.min.js b/build/typertext.min.js index 5bba2ff..aec95b0 100644 --- a/build/typertext.min.js +++ b/build/typertext.min.js @@ -1,2 +1,2 @@ -var Typertext;!function(a){var b=function(){function a(a,b,c){this.message=a,this.code=b,this.custom=c}return a.prototype.GetCode=function(){return this.code},a.prototype.GetMessage=function(){return this.message},a.prototype.GetCustom=function(){return this.custom},a}();a.BaseException=b}(Typertext||(Typertext={}));var Typertext;!function(){}(Typertext||(Typertext={}));var Typertext;!function(a){var b=function(){function a(a,b,c,d){this.status=a,this.headers=b,this.httpStatus=c,this.content=d}return a.prototype.GetContent=function(){return this.content},a.prototype.GetContentType=function(){return this.GetHeader("Content-Type")},a.prototype.GetHeader=function(a){return this.headers(a)},a.prototype.GetHttpStatus=function(){return this.httpStatus},a.prototype.GetStatus=function(){return this.status},a}();a.GenericResponse=b}(Typertext||(Typertext={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Typertext;!function(a){!function(b){var c=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b}(a.BaseException);b.HttpException=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(a){!function(a){a[a.GET=0]="GET",a[a.POST=1]="POST"}(a.HttpMethod||(a.HttpMethod={}));a.HttpMethod}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(a){!function(a){a[a.http=0]="http",a[a.https=1]="https"}(a.HttpProtocol||(a.HttpProtocol={}));a.HttpProtocol}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(){function b(){}return b.prototype.Get=function(a,b){this.RawRequest(0,a,{},b)},b.prototype.Post=function(a,b,c){this.RawRequest(1,a,b,c)},b.prototype.RawRequest=function(b,c,d,e){"undefined"==typeof d&&(d={}),"undefined"==typeof e&&(e=function(){});var f=function(){return""},g=new XMLHttpRequest;return g.onreadystatechange=function(){if(4==g.readyState){var b=function(a){return g.getResponseHeader(a)};e(200==g.status?new a.Http.HttpResponse(0,b,g.status,g.responseText):g.status>=400&&g.status<500?new a.Http.HttpResponse(2,b,g.status,g.responseText):g.status>=500&&g.status<600?new a.Http.HttpResponse(1,b,g.status,g.responseText):new a.Http.HttpResponse(4,b,g.status,g.responseText))}},g.ontimeout=function(){e(new a.Http.HttpResponse(5,f,-1,""))},g.open(a.Http.HttpMethod[b],c.ToString(),!0),0==b?void g.send():(g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void g.send(a.Http.HttpUrl.UrlEncodeObject(d)))},b}();b.HttpRequest=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(a){function b(b,c,d,e){a.call(this,b,c,d,e)}return __extends(b,a),b}(a.GenericResponse);b.HttpResponse=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(a){!function(a){a[a.success=0]="success",a[a.serverError=1]="serverError",a[a.clientError=2]="clientError",a[a.responseError=3]="responseError",a[a.unknownError=4]="unknownError",a[a.timeout=5]="timeout"}(a.HttpResponseStatus||(a.HttpResponseStatus={}));a.HttpResponseStatus}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(){function b(a,c,d,e,f){"undefined"==typeof c&&(c=0),"undefined"==typeof d&&(d="/"),"undefined"==typeof e&&(e={}),"undefined"==typeof f&&(f=0),(1>f||f>65535||isNaN(f))&&(f=b.DefaultPort(c)),0!=d.indexOf("/")&&(d="/"+d),this.domain=a,this.protocol=c,this.path=d,this.queryString=e,this.port=f}return b.DefaultPort=function(a){switch(a){case 0:return 80;case 1:return 443;default:return-1}},b.FromUrl=function(c){var d=document.createElement("a");return d.href=c,new b(d.hostname,a.Http.HttpProtocol[d.protocol.slice(0,-1)],d.pathname,b.DecodeQueryString(d.search),parseInt(d.port))},b.DecodeQueryString=function(a){return 0==a.indexOf("?")&&(a=a.substring(1)),b.UrlDecodeString(a)},b.EncodeQueryString=function(a){var c="?"+b.UrlEncodeObject(a);return 1==c.length?"":c},b.UrlEncodeObject=function(a){var b,c="";for(b in a)c+=encodeURIComponent(b)+"="+encodeURIComponent(a[b])+"&";return c.slice(0,-1)},b.UrlDecodeString=function(a){for(var c={},d=b.splitString(a,"&"),e=0;e0&&d.length>c){var e=d.splice(0,c);return e.push(d.join(b)),e}return d},b.prototype.ToString=function(){return a.Http.HttpProtocol[this.protocol]+"://"+this.domain+(this.port==b.DefaultPort(this.protocol)?"":":"+this.port)+this.path+b.EncodeQueryString(this.queryString)},b}();b.HttpUrl=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(a){function b(b,c){a.call(this,b,c,null)}return __extends(b,a),b}(a.BaseException);b.JsonException=c}(a.Json||(a.Json={}));a.Json}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=a.Http.HttpRequest,d=(a.Http.HttpMethod,function(){function b(a){"undefined"==typeof a&&(a="application/json"),this.request=new c,this.jsonType=a}return b.prototype.Get=function(a,b){this.RawRequest(0,a,{},b)},b.prototype.Post=function(a,b,c){this.RawRequest(1,a,b,c)},b.prototype.RawRequest=function(b,c,d,e){var f=this;return"undefined"==typeof d&&(d={}),"function"!=typeof e?void this.request.RawRequest(b,c,d,function(){}):void this.request.RawRequest(b,c,d,function(b){return b.GetContentType()!=f.jsonType?void e(a.Json.JsonResponse.fromInvalidHttpResponse(b)):void e(a.Json.JsonResponse.fromHttpResponse(b))})},b}());b.JsonRequest=d}(a.Json||(a.Json={}));a.Json}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=(a.Http.HttpResponseStatus,function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e),f=!!f||!1,this.parseSuccess=f}return __extends(b,a),b.fromHttpResponse=function(a){try{return new b(a.GetStatus(),a.GetHeader,a.GetHttpStatus(),window.JSON.parse(a.GetContent()),!0)}catch(c){return new b(a.GetStatus(),a.GetHeader,a.GetHttpStatus(),null)}},b.fromInvalidHttpResponse=function(a){return new b(3,a.GetHeader,a.GetHttpStatus())},b.prototype.GetParseStatus=function(){return this.parseSuccess},b}(a.GenericResponse));b.JsonResponse=c}(a.Json||(a.Json={}));a.Json}(Typertext||(Typertext={})); +var Typertext;!function(a){var b=function(){function a(a,b,c){this.message=a,this.code=b,this.custom=c}return a.prototype.GetCode=function(){return this.code},a.prototype.GetMessage=function(){return this.message},a.prototype.GetCustom=function(){return this.custom},a}();a.BaseException=b}(Typertext||(Typertext={}));var Typertext;!function(){}(Typertext||(Typertext={}));var Typertext;!function(a){var b=function(){function a(a,b,c,d){this.status=a,this.headers=b,this.httpStatus=c,this.content=d}return a.prototype.GetContent=function(){return this.content},a.prototype.GetContentType=function(){return this.GetHeader("Content-Type")},a.prototype.GetHeader=function(a){return this.headers(a)},a.prototype.GetHttpStatus=function(){return this.httpStatus},a.prototype.GetStatus=function(){return this.status},a}();a.GenericResponse=b}(Typertext||(Typertext={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},Typertext;!function(a){!function(b){var c=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b}(a.BaseException);b.HttpException=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(a){!function(a){a[a.GET=0]="GET",a[a.POST=1]="POST"}(a.HttpMethod||(a.HttpMethod={}));a.HttpMethod}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(a){!function(a){a[a.http=0]="http",a[a.https=1]="https"}(a.HttpProtocol||(a.HttpProtocol={}));a.HttpProtocol}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(){function b(){}return b.prototype.Get=function(a,b){this.RawRequest(0,a,{},b)},b.prototype.Post=function(a,b,c){this.RawRequest(1,a,b,c)},b.prototype.RawRequest=function(b,c,d,e){"undefined"==typeof d&&(d={}),"undefined"==typeof e&&(e=function(){}),a.Transport.TransportChooser.GetTransport(b,c).RawRequest(b,c,d,e)},b}();b.HttpRequest=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(a){function b(b,c,d,e){a.call(this,b,c,d,e)}return __extends(b,a),b}(a.GenericResponse);b.HttpResponse=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(a){!function(a){a[a.success=0]="success",a[a.serverError=1]="serverError",a[a.clientError=2]="clientError",a[a.responseError=3]="responseError",a[a.unknownError=4]="unknownError",a[a.timeout=5]="timeout"}(a.HttpResponseStatus||(a.HttpResponseStatus={}));a.HttpResponseStatus}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(){function b(a,c,d,e,f){"undefined"==typeof c&&(c=0),"undefined"==typeof d&&(d="/"),"undefined"==typeof e&&(e={}),"undefined"==typeof f&&(f=0),(1>f||f>65535||isNaN(f))&&(f=b.DefaultPort(c)),0!=d.indexOf("/")&&(d="/"+d),this.domain=a,this.protocol=c,this.path=d,this.queryString=e,this.port=f}return b.DefaultPort=function(a){switch(a){case 0:return 80;case 1:return 443;default:return-1}},b.FromUrl=function(c){var d=document.createElement("a");return d.href=c,new b(d.hostname,a.Http.HttpProtocol[d.protocol.slice(0,-1)],d.pathname,b.DecodeQueryString(d.search),parseInt(d.port))},b.DecodeQueryString=function(a){return 0==a.indexOf("?")&&(a=a.substring(1)),b.UrlDecodeString(a)},b.EncodeQueryString=function(a){var c="?"+b.UrlEncodeObject(a);return 1==c.length?"":c},b.UrlEncodeObject=function(a){var b,c="";for(b in a)c+=encodeURIComponent(b)+"="+encodeURIComponent(a[b])+"&";return c.slice(0,-1)},b.UrlDecodeString=function(a){for(var c={},d=b.splitString(a,"&"),e=0;e0&&d.length>c){var e=d.splice(0,c);return e.push(d.join(b)),e}return d},b.prototype.ToString=function(){return a.Http.HttpProtocol[this.protocol]+"://"+this.domain+(this.port==b.DefaultPort(this.protocol)?"":":"+this.port)+this.path+b.EncodeQueryString(this.queryString)},b}();b.HttpUrl=c}(a.Http||(a.Http={}));a.Http}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(a){function b(b,c){a.call(this,b,c,null)}return __extends(b,a),b}(a.BaseException);b.JsonException=c}(a.Json||(a.Json={}));a.Json}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=a.Http.HttpRequest,d=(a.Http.HttpMethod,function(){function b(a){"undefined"==typeof a&&(a="application/json"),this.request=new c,this.jsonType=a}return b.prototype.Get=function(a,b){this.RawRequest(0,a,{},b)},b.prototype.Post=function(a,b,c){this.RawRequest(1,a,b,c)},b.prototype.RawRequest=function(b,c,d,e){var f=this;return"undefined"==typeof d&&(d={}),"function"!=typeof e?void this.request.RawRequest(b,c,d,function(){}):void this.request.RawRequest(b,c,d,function(b){return b.GetContentType()!=f.jsonType?void e(a.Json.JsonResponse.fromInvalidHttpResponse(b)):void e(a.Json.JsonResponse.fromHttpResponse(b))})},b}());b.JsonRequest=d}(a.Json||(a.Json={}));a.Json}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=(a.Http.HttpResponseStatus,function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e),f=!!f||!1,this.parseSuccess=f}return __extends(b,a),b.fromHttpResponse=function(a){try{return new b(a.GetStatus(),a.GetHeader,a.GetHttpStatus(),window.JSON.parse(a.GetContent()),!0)}catch(c){return new b(a.GetStatus(),a.GetHeader,a.GetHttpStatus(),null)}},b.fromInvalidHttpResponse=function(a){return new b(3,a.GetHeader,a.GetHttpStatus())},b.prototype.GetParseStatus=function(){return this.parseSuccess},b}(a.GenericResponse));b.JsonResponse=c}(a.Json||(a.Json={}));a.Json}(Typertext||(Typertext={}));var Typertext;!function(a){!function(){}(a.Transport||(a.Transport={}));a.Transport}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=function(){function b(){}return b.GetTransport=function(){var b=!1,c=!1,d=!1;if(!b)return new a.Transport.XDR;if(c&&!d)return new a.Transport.XHR;throw{}},b}();b.TransportChooser=c}(a.Transport||(a.Transport={}));a.Transport}(Typertext||(Typertext={}));var Typertext;!function(a){!function(a){var b=function(){function a(){}return a.prototype.RawRequest=function(a,b,c,d){"undefined"==typeof c&&(c={}),"undefined"==typeof d&&(d=function(){})},a}();a.XDR=b}(a.Transport||(a.Transport={}));a.Transport}(Typertext||(Typertext={}));var Typertext;!function(a){!function(b){var c=a.Http.HttpMethod,d=a.Http.HttpUrl,e=(a.Http.HttpResponseStatus,a.Http.HttpResponse),f=function(){function a(){}return a.prototype.RawRequest=function(a,b,f,g){"undefined"==typeof f&&(f={}),"undefined"==typeof g&&(g=function(){});var h=function(){return""},i=new XMLHttpRequest;return i.onreadystatechange=function(){if(4==i.readyState){var a=function(a){return i.getResponseHeader(a)};g(200==i.status?new e(0,a,i.status,i.responseText):i.status>=400&&i.status<500?new e(2,a,i.status,i.responseText):i.status>=500&&i.status<600?new e(1,a,i.status,i.responseText):new e(4,a,i.status,i.responseText))}},i.ontimeout=function(){g(new e(5,h,-1,""))},i.open(c[a],b.ToString(),!0),0==a?void i.send():(i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void i.send(d.UrlEncodeObject(f)))},a}();b.XHR=f}(a.Transport||(a.Transport={}));a.Transport}(Typertext||(Typertext={})); //# sourceMappingURL=typertext.min.js.map \ No newline at end of file diff --git a/build/typertext.min.js.map b/build/typertext.min.js.map index ed75a55..48465e1 100644 --- a/build/typertext.min.js.map +++ b/build/typertext.min.js.map @@ -1 +1 @@ -{"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","noop","xhr","XMLHttpRequest","onreadystatechange","readyState","getHeader","getResponseHeader","HttpResponse","responseText","ontimeout","open","ToString","send","setRequestHeader","HttpUrl","UrlEncodeObject","call","HttpResponseStatus","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","length","data","temp","encodeURIComponent","returnValue","params","splitString","i","param","key","decodeURIComponent","input","separator","limit","chunks","split","ret","splice","push","join","Json","JsonException","JsonRequest","jsonContentType","jsonType","_this","response","JsonResponse","fromInvalidHttpResponse","fromHttpResponse","parseSuccess","httpResponse","window","parse","e","GetParseStatus"],"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,YAAcA,cACjB,IAAIA,YACJ,SAAWA,GACP,GAAIU,GAAkB,WAClB,QAASA,GAAgBC,EAAQC,EAAsBC,EAAkBC,GACrET,KAAKM,OAASA,EACdN,KAAKU,QAAUH,EACfP,KAAKW,WAAaH,EAClBR,KAAKY,QAAUH,EAqBnB,MAnBAJ,GAAgBJ,UAAUY,WAAa,WACnC,MAAOb,MAAKY,SAGhBP,EAAgBJ,UAAUa,eAAiB,WACvC,MAAOd,MAAKe,UAAU,iBAG1BV,EAAgBJ,UAAUc,UAAY,SAAUC,GAC5C,MAAOhB,MAAKU,QAAQM,IAGxBX,EAAgBJ,UAAUgB,cAAgB,WACtC,MAAOjB,MAAKW,YAGhBN,EAAgBJ,UAAUiB,UAAY,WAClC,MAAOlB,MAAKM,QAETD,IAEXV,GAAUU,gBAAkBA,GAC7BV,YAAcA,cACjB,IAAIwB,WAAYnB,KAAKmB,WAAa,SAAUC,EAAGC,GAE3C,QAASC,KAAOtB,KAAKuB,YAAcH,EADnC,I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AAU6G,OAAS7G,EAAU6G,SACrB7G,GAAU6G,MACtB7G,YAAcA,cACjB,IAAIA,YACJ,SAAWA,IACP,SAAW6G,GACP,GAEIO,IAFqBpH,EAAU+B,KAAKgC,mBAErB,SAAW9B,GAE1B,QAASmF,GAAazG,EAAQC,EAAsBC,EAAkBC,EAAcyG,GAChFtF,EAAO6B,KAAKzD,KAAMM,EAAQC,EAAsBC,EAAkBC,GAClEyG,IAAiBA,IAAgB,EACjClH,KAAKkH,aAAeA,EAiBxB,MArBA/F,WAAU4F,EAAcnF,GAMxBmF,EAAaE,iBAAmB,SAAUE,GACtC,IACI,MAAO,IAAIJ,GAAaI,EAAajG,YAAaiG,EAAapG,UAAWoG,EAAalG,gBAAiBmG,OAAa,KAAEC,MAAMF,EAAatG,eAAe,GAC3J,MAAOyG,GACL,MAAO,IAAIP,GAAaI,EAAajG,YAAaiG,EAAapG,UAAWoG,EAAalG,gBAAiB,QAIhH8F,EAAaC,wBAA0B,SAAUG,GAC7C,MAAO,IAAIJ,GAAa,EAAuBI,EAAapG,UAAWoG,EAAalG,kBAGxF8F,EAAa9G,UAAUsH,eAAiB,WACpC,MAAOvH,MAAKkH,cAETH,GACRpH,EAAUU,iBACbmG,GAAKO,aAAeA,GACrBpH,EAAU6G,OAAS7G,EAAU6G,SACrB7G,GAAU6G,MACtB7G,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 var noop = function (i) {\n return \"\";\n };\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 Typertext.Http.HttpResponse(0 /* success */, getHeader, xhr.status, xhr.responseText));\n } else if (xhr.status >= 400 && xhr.status < 500) {\n callback(new Typertext.Http.HttpResponse(2 /* clientError */, getHeader, xhr.status, xhr.responseText));\n } else if (xhr.status >= 500 && xhr.status < 600) {\n callback(new Typertext.Http.HttpResponse(1 /* serverError */, getHeader, xhr.status, xhr.responseText));\n } else {\n callback(new Typertext.Http.HttpResponse(4 /* unknownError */, getHeader, xhr.status, xhr.responseText));\n }\n }\n };\n\n xhr.ontimeout = function () {\n callback(new Typertext.Http.HttpResponse(5 /* timeout */, noop, -1, \"\"));\n };\n\n xhr.open(Typertext.Http.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(Typertext.Http.HttpUrl.UrlEncodeObject(postData));\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 = {}));\n//# sourceMappingURL=typertext.js.map\n"]} \ No newline at end of file +{"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","GetTransport","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","ieLte9","isXdomain","isXprotocol","XDR","XHR","noop","xhr","XMLHttpRequest","onreadystatechange","readyState","getHeader","getResponseHeader","responseText","ontimeout","open","send","setRequestHeader"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cACnEN,EAAI/G,QAAU,KAAO+G,EAAI/G,OAAS,IAChC,GAAIsC,GAAa,EAAqB6E,EAAWJ,EAAI/G,OAAQ+G,EAAIM,cAEjE,GAAI/E,GAAa,EAAsB6E,EAAWJ,EAAI/G,OAAQ+G,EAAIM,iBAKvFN,EAAIO,UAAY,WACZxF,EAAS,GAAIQ,GAAa,EAAiBwE,EAAM,GAAI,MAGzDC,EAAIQ,KAAK9F,EAAWS,GAASL,EAAQ2D,YAAY,GAEnC,GAAVtD,MACA6E,GAAIS,QAIRT,EAAIU,iBAAiB,eAAgB,yCAErCV,GAAIS,KAAK/E,EAAQ0B,gBAAgBlC,MAE9B4E,IAEX1E,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.GetTransport(method, request).RawRequest(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 })(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.GetTransport = function (method, request) {\n var ieLte9 = false;\n var isXdomain = false;\n var isXprotocol = false;\n\n if (!ieLte9) {\n return new Typertext.Transport.XDR();\n } else if (isXdomain && !isXprotocol) {\n return new Typertext.Transport.XHR();\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 XDR = (function () {\n function XDR() {\n }\n XDR.prototype.RawRequest = function (method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n }; }\n };\n return XDR;\n })();\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 () {\n function XHR() {\n }\n XHR.prototype.RawRequest = function (method, request, postData, callback) {\n if (typeof postData === \"undefined\") { postData = {}; }\n if (typeof callback === \"undefined\") { callback = function (c) {\n }; }\n var noop = function (i) {\n return \"\";\n };\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 */, noop, -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 })();\n Transport.XHR = XHR;\n })(Typertext.Transport || (Typertext.Transport = {}));\n var Transport = Typertext.Transport;\n})(Typertext || (Typertext = {}));\n//# sourceMappingURL=typertext.js.map\n"]} \ No newline at end of file diff --git a/lib/Typertext/Http/HttpRequest.ts b/lib/Typertext/Http/HttpRequest.ts index cdc5f6f..748d778 100644 --- a/lib/Typertext/Http/HttpRequest.ts +++ b/lib/Typertext/Http/HttpRequest.ts @@ -52,59 +52,7 @@ module Typertext.Http { */ public RawRequest(method:HttpMethod, request:HttpUrl, postData:HttpPostData = {}, callback:HttpResponseHandler = (c)=> { }):void { - var noop = (i:string)=>{ - return ""; - }; - - //Create a XHR - var xhr = new XMLHttpRequest(); - - //And let us know when it does something - xhr.onreadystatechange = ()=> { - //If the request is complete - if (xhr.readyState == 4) { - //Prepare a getter for the header - var getHeader = (name:string):string => { - return xhr.getResponseHeader(name); - }; - - //Check the status - if (xhr.status == 200) { - //And either succeed - callback(new HttpResponse(HttpResponseStatus.success, getHeader, xhr.status, xhr.responseText)); - } else if (xhr.status >= 400 && xhr.status < 500) { - //Or fail miserably - callback(new HttpResponse(HttpResponseStatus.clientError, getHeader, xhr.status, xhr.responseText)); - } else if (xhr.status >= 500 && xhr.status < 600) { - //Again - callback(new HttpResponse(HttpResponseStatus.serverError, getHeader, xhr.status, xhr.responseText)); - } else { - //And again - callback(new HttpResponse(HttpResponseStatus.unknownError, getHeader, xhr.status, xhr.responseText)); - } - } - }; - - //Or if it times out - xhr.ontimeout = () => { - //And make a big deal of the failing - callback(new HttpResponse(HttpResponseStatus.timeout, noop, -1, "")); - }; - - //Now connect - xhr.open(HttpMethod[method], request.ToString(), true); - - //And either send - if (method == HttpMethod.GET) { - //A get request - xhr.send(); - return; - } - - //Or set the content-type - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - //And send the post-data to the server - xhr.send(HttpUrl.UrlEncodeObject(postData)); + Typertext.Transport.TransportChooser.GetTransport(method, request).RawRequest(method, request, postData, callback); } } } \ No newline at end of file diff --git a/lib/Typertext/Transport/GenericTransport.ts b/lib/Typertext/Transport/GenericTransport.ts new file mode 100644 index 0000000..bf6147e --- /dev/null +++ b/lib/Typertext/Transport/GenericTransport.ts @@ -0,0 +1,10 @@ +module Typertext.Transport { + import HttpMethod = Typertext.Http.HttpMethod; + import HttpUrl = Typertext.Http.HttpUrl; + import HttpPostData = Typertext.Http.HttpPostData; + import HttpResponseHandler = Typertext.Http.HttpResponseHandler; + + export interface GenericTransport { + RawRequest(method:HttpMethod, request:HttpUrl, postData:HttpPostData, callback:HttpResponseHandler):void; + } +} \ No newline at end of file diff --git a/lib/Typertext/Transport/TransportChooser.ts b/lib/Typertext/Transport/TransportChooser.ts new file mode 100644 index 0000000..a07d251 --- /dev/null +++ b/lib/Typertext/Transport/TransportChooser.ts @@ -0,0 +1,17 @@ +module Typertext.Transport { + export class TransportChooser { + static GetTransport(method:Typertext.Http.HttpMethod, request:Typertext.Http.HttpUrl):GenericTransport { + var ieLte9 = false; + var isXdomain = false; + var isXprotocol = false; + + if (!ieLte9) { + return new XDR(); + } else if (isXdomain && !isXprotocol) { + return new XHR(); + } + + throw {}; + } + } +} \ No newline at end of file diff --git a/lib/Typertext/Transport/XDR.ts b/lib/Typertext/Transport/XDR.ts new file mode 100644 index 0000000..b0958f1 --- /dev/null +++ b/lib/Typertext/Transport/XDR.ts @@ -0,0 +1,13 @@ +module Typertext.Transport { + import HttpMethod = Typertext.Http.HttpMethod; + import HttpUrl = Typertext.Http.HttpUrl; + import HttpPostData = Typertext.Http.HttpPostData; + import HttpResponseHandler = Typertext.Http.HttpResponseHandler; + + export class XDR implements GenericTransport { + RawRequest(method:HttpMethod, request:HttpUrl, postData:HttpPostData = {}, callback:HttpResponseHandler = (c)=> { + }):void { + + } + } +} \ No newline at end of file diff --git a/lib/Typertext/Transport/XHR.ts b/lib/Typertext/Transport/XHR.ts new file mode 100644 index 0000000..b9c8208 --- /dev/null +++ b/lib/Typertext/Transport/XHR.ts @@ -0,0 +1,67 @@ +module Typertext.Transport { + import HttpMethod = Typertext.Http.HttpMethod; + import HttpUrl = Typertext.Http.HttpUrl; + import HttpPostData = Typertext.Http.HttpPostData; + import HttpResponseHandler = Typertext.Http.HttpResponseHandler; + import HttpResponseStatus = Typertext.Http.HttpResponseStatus; + import HttpResponse = Typertext.Http.HttpResponse; + + export class XHR implements GenericTransport { + RawRequest(method:HttpMethod, request:HttpUrl, postData:HttpPostData = {}, callback:HttpResponseHandler = (c)=> { + }):void { + var noop = (i:string)=>{ + return ""; + }; + + //Create a XHR + var xhr = new XMLHttpRequest(); + + //And let us know when it does something + xhr.onreadystatechange = ()=> { + //If the request is complete + if (xhr.readyState == 4) { + //Prepare a getter for the header + var getHeader = (name:string):string => { + return xhr.getResponseHeader(name); + }; + + //Check the status + if (xhr.status == 200) { + //And either succeed + callback(new HttpResponse(HttpResponseStatus.success, getHeader, xhr.status, xhr.responseText)); + } else if (xhr.status >= 400 && xhr.status < 500) { + //Or fail miserably + callback(new HttpResponse(HttpResponseStatus.clientError, getHeader, xhr.status, xhr.responseText)); + } else if (xhr.status >= 500 && xhr.status < 600) { + //Again + callback(new HttpResponse(HttpResponseStatus.serverError, getHeader, xhr.status, xhr.responseText)); + } else { + //And again + callback(new HttpResponse(HttpResponseStatus.unknownError, getHeader, xhr.status, xhr.responseText)); + } + } + }; + + //Or if it times out + xhr.ontimeout = () => { + //And make a big deal of the failing + callback(new HttpResponse(HttpResponseStatus.timeout, noop, -1, "")); + }; + + //Now connect + xhr.open(HttpMethod[method], request.ToString(), true); + + //And either send + if (method == HttpMethod.GET) { + //A get request + xhr.send(); + return; + } + + //Or set the content-type + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + //And send the post-data to the server + xhr.send(HttpUrl.UrlEncodeObject(postData)); + } + } +} \ No newline at end of file