From 03391ef640823dd5a53bf4807236d0b3046ed82d Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 20 Mar 2017 14:47:25 -0700 Subject: [PATCH] Remove qajax (#15175) --- qajax/index.d.ts | 26 ----------------- qajax/qajax-tests.ts | 69 -------------------------------------------- qajax/tsconfig.json | 26 ----------------- 3 files changed, 121 deletions(-) delete mode 100644 qajax/index.d.ts delete mode 100644 qajax/qajax-tests.ts delete mode 100644 qajax/tsconfig.json diff --git a/qajax/index.d.ts b/qajax/index.d.ts deleted file mode 100644 index fcfbea6649..0000000000 --- a/qajax/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Type definitions for Qajax -// Project: https://github.com/gre/qajax -// Definitions by: Boltmade -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import * as Q from "q"; - -export = Qajax; -export as namespace Qajax; - -declare function Qajax(url : string) : Q.Promise; -declare function Qajax(options : any) : Q.Promise; -declare function Qajax(url : string, options : any) : Q.Promise; - -declare namespace Qajax { - export var defaults : any; - export function filterStatus(validStatus : number) : (xhr : XMLHttpRequest) => Q.Promise; - export function filterStatus(validStatus : (status : number) => boolean) : (xhr : XMLHttpRequest) => Q.Promise; - export function filterSuccess() : Q.Promise; - - export function toJSON(xhr : XMLHttpRequest) : Q.Promise; - - export function getJSON(url : string) : Q.Promise; - - export function serialize(paramsObj : any) : string; -} \ No newline at end of file diff --git a/qajax/qajax-tests.ts b/qajax/qajax-tests.ts deleted file mode 100644 index 6770270cf4..0000000000 --- a/qajax/qajax-tests.ts +++ /dev/null @@ -1,69 +0,0 @@ -import Qajax = require("qajax"); -import * as Q from 'q'; - -// Based on https://github.com/gre/qajax/blob/master/test/qajax.js - -function resetDefaults () { - Qajax.defaults.logs = true; - Qajax.defaults.timeout = 1000; - Qajax.defaults.method = "GET"; - Qajax.defaults.headers = {}; - Qajax.defaults.base = ""; -} - -var sample01url = "/test/dataset/sample01.json"; -var sample01json = [ - { "name": "Jerome", "age": 20 }, - { "name": "Gerard", "age": 30 }, - { "name": "Martine", "age": 43 } -]; - -var emptyUrl = "/test/dataset/empty"; - -function urlWithOptions (url : string, options : any) { - return url+"?"+Qajax.serialize(options); -} - -Qajax; -Qajax.filterStatus; -Qajax.filterSuccess; -Qajax.getJSON; -Qajax.serialize({ foo: 123, bar: "toto" }); -Qajax.getJSON(sample01url).then((res) => true, (err) => true); -Qajax(sample01url).then(Qajax.filterSuccess).then(Qajax.toJSON); -Qajax(emptyUrl, { params: { status: 404 } }).then(Qajax.filterSuccess).then(Qajax.toJSON); -Qajax({method: "POST", url: "/ECHO", data: "1234567890\nazerty\nuiopqsdfghjklm\nwxcvbn\n"}).then(Qajax.filterSuccess); -Qajax({method: "POST", url: "/ECHO", data: { foo: 123, bar: { value: 42 }, arr: [1, 2, 3] }}).then(Qajax.filterSuccess).then(Qajax.toJSON); -Qajax({ url: emptyUrl, params: { status: 201 } }).then(Qajax.filterStatus(200)); -Qajax({method: "POST", url: emptyUrl, params: { status: 500 }}).then(Qajax.filterSuccess).then(Qajax.toJSON); - -var cancellationD = Q.defer(); -var cancellation = cancellationD.promise; -Qajax({ cancellation: cancellation, url: urlWithOptions(emptyUrl, { latency: 400 }) }).then(Qajax.filterSuccess).then(Qajax.toJSON); - -Qajax.defaults.timeout = 200; -Qajax({method: "DELETE", url: sample01url, params: { latency: 500 }}); - -resetDefaults(); -Qajax({method: "POST", url: sample01url, params: { latency: 300 }, timeout: 2000}); - -Qajax.defaults.timeout = 200; -Qajax({method: "DELETE", url: sample01url, params: { latency: 500 }, timeout: 0}); - -resetDefaults(); -Qajax({headers: { "X-Hello": "world" }, method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON); -Qajax({headers: { "X-Hi": "world" }, method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON); -Qajax.defaults.headers = {"X-Foo": "bar"}; -Qajax({method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON); - -resetDefaults(); -Qajax("sample01.json", {base: "/test/dataset/"}).then(Qajax.filterSuccess).then(Qajax.toJSON); -Qajax.defaults.base = "/test/dataset/"; -Qajax("empty").then(Qajax.filterSuccess); - -resetDefaults(); -Qajax.defaults.method = "POST"; -Qajax("/ECHO", { data: "1234567890\nazerty\nuiopqsdfghjklm\nwxcvbn\n", responseType: "text/plain" }).then(Qajax.filterSuccess); - -resetDefaults(); -Qajax.getJSON(urlWithOptions(sample01url, { latency: 50 })).then((res) => true, (err) => true, () => true); diff --git a/qajax/tsconfig.json b/qajax/tsconfig.json deleted file mode 100644 index 17bb7d92b2..0000000000 --- a/qajax/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "paths": { - "q": [ "q/v0" ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "qajax-tests.ts" - ] -} \ No newline at end of file