Skip to content

Commit

Permalink
Remove flow from repo
Browse files Browse the repository at this point in the history
  • Loading branch information
joris974 committed Jan 3, 2025
1 parent 85dacab commit 16ac749
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 546 deletions.
17 changes: 8 additions & 9 deletions dist/ajax.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.appendParamToRemedyCorsBug = exports.checkUrlExistence = exports.sendBeacon = exports.ajaxFileDownload = exports.ajaxFormFileUpload = exports.ajaxFormCall = exports.ajaxJsonCall = exports.ajaxCall = void 0;
exports.ajaxCall = ajaxCall;
exports.ajaxJsonCall = ajaxJsonCall;
exports.ajaxFormCall = ajaxFormCall;
exports.ajaxFormFileUpload = ajaxFormFileUpload;
exports.ajaxFileDownload = ajaxFileDownload;
exports.sendBeacon = sendBeacon;
exports.checkUrlExistence = checkUrlExistence;
exports.appendParamToRemedyCorsBug = appendParamToRemedyCorsBug;
const maybe_1 = require("@freckle/maybe");
function ajaxCall(options) {
const { url, method, data, contentType, dataType, cache, xhrFields, timeout } = options;
Expand All @@ -15,7 +22,6 @@ function ajaxCall(options) {
.fail(reject);
});
}
exports.ajaxCall = ajaxCall;
function ajaxJsonCall(options) {
const { url, method, data, cache, xhrFields, timeout } = options;
// If we are not sending any data along with the request then there is no need to specify the contentType
Expand All @@ -26,15 +32,13 @@ function ajaxJsonCall(options) {
const dataType = 'json';
return ajaxCall({ url, method, data, contentType, dataType, cache, xhrFields, timeout });
}
exports.ajaxJsonCall = ajaxJsonCall;
function ajaxFormCall(options) {
const { url, method, data } = options;
const contentType = 'application/x-www-form-urlencoded';
const dataType = 'json';
const cache = false;
return ajaxCall({ url, method, data, contentType, dataType, cache });
}
exports.ajaxFormCall = ajaxFormCall;
function ajaxFormFileUpload(options) {
const { url, data, method, timeout } = options;
const timeoutParam = timeout !== null && timeout !== undefined ? { timeout } : {};
Expand All @@ -44,7 +48,6 @@ function ajaxFormFileUpload(options) {
.fail(reject);
});
}
exports.ajaxFormFileUpload = ajaxFormFileUpload;
function ajaxFileDownload(options) {
const { url, accept, defaultFilename } = options;
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -98,7 +101,6 @@ function ajaxFileDownload(options) {
request.send();
});
}
exports.ajaxFileDownload = ajaxFileDownload;
function contentDispositionFilename(mDisposition) {
return (0, maybe_1.mthen)(mDisposition, disposition => (0, maybe_1.mthen)(disposition.trim().match(/attachment; filename="(.*)"/), ([_ignore, filename]) => filename));
}
Expand All @@ -111,7 +113,6 @@ function sendBeacon(options) {
}
catch (e) { }
}
exports.sendBeacon = sendBeacon;
function checkUrlExistence(url) {
return new Promise(resolve => {
ajaxCall({
Expand All @@ -128,7 +129,6 @@ function checkUrlExistence(url) {
});
});
}
exports.checkUrlExistence = checkUrlExistence;
/**
* This hack gets around a Chrome caching bug wherein the audio request generated
* by the audio web api leads to chrome caching a response that does not contain
Expand All @@ -144,4 +144,3 @@ exports.checkUrlExistence = checkUrlExistence;
function appendParamToRemedyCorsBug(path) {
return path.includes('?') ? `${path}&via=xmlHttpRequest` : `${path}?via=xmlHttpRequest`;
}
exports.appendParamToRemedyCorsBug = appendParamToRemedyCorsBug;
99 changes: 0 additions & 99 deletions dist/ajax.js.flow

This file was deleted.

2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseLinkHeader = exports.toString = exports.fromString = exports.appendParamToRemedyCorsBug = exports.checkUrlExistence = exports.sendBeacon = exports.ajaxFileDownload = exports.ajaxFormFileUpload = exports.ajaxFormCall = exports.ajaxJsonCall = exports.ajaxCall = void 0;
exports.parseLinkHeader = exports.fromString = exports.appendParamToRemedyCorsBug = exports.checkUrlExistence = exports.sendBeacon = exports.ajaxFileDownload = exports.ajaxFormFileUpload = exports.ajaxFormCall = exports.ajaxJsonCall = exports.ajaxCall = void 0;
var ajax_1 = require("./ajax");
Object.defineProperty(exports, "ajaxCall", { enumerable: true, get: function () { return ajax_1.ajaxCall; } });
Object.defineProperty(exports, "ajaxJsonCall", { enumerable: true, get: function () { return ajax_1.ajaxJsonCall; } });
Expand Down
14 changes: 0 additions & 14 deletions dist/index.js.flow

This file was deleted.

7 changes: 3 additions & 4 deletions dist/link-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseLinkHeader = exports.toString = exports.fromString = void 0;
exports.fromString = fromString;
exports.toString = toString;
exports.parseLinkHeader = parseLinkHeader;
const isNil_1 = __importDefault(require("lodash/isNil"));
function fromString(linkUrl) {
return linkUrl;
}
exports.fromString = fromString;
function toString(linkUrl) {
return linkUrl;
}
exports.toString = toString;
/* Code Imported from https://gist.github.com/niallo/3109252
* Allows us to read the Link Header and transform it in a usable object
*/
Expand All @@ -36,7 +36,6 @@ function parseLinkHeader(linkHeader) {
});
return links;
}
exports.parseLinkHeader = parseLinkHeader;
const toLinkName = (rawName) => {
switch (rawName) {
case 'first':
Expand Down
10 changes: 0 additions & 10 deletions dist/link-header.js.flow

This file was deleted.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"url": "git+https://github.com/freckle/ajax-js.git"
},
"scripts": {
"build": "rm -r dist && tsc -d && node gen-flow.js",
"test": "jest && flow",
"build": "rm -r dist && tsc -d",
"test": "jest",
"format": "prettier --write 'src/**/*.ts'"
},
"dependencies": {
Expand All @@ -22,9 +22,6 @@
"@types/jest": "^29.5.12",
"@types/jquery": "^3.5.16",
"@types/lodash": "^4.14.191",
"cpy-cli": "5.0.0",
"flow-bin": "0.110.0",
"flowgen": "^1.17.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "^3.3.2",
Expand Down
Loading

0 comments on commit 16ac749

Please sign in to comment.