fix(core): update

This commit is contained in:
Philipp Kunz 2018-06-14 22:48:50 +02:00
parent f0c74b1568
commit fe33cfdeaa
7 changed files with 20 additions and 13 deletions

6
dist/index.js vendored
View File

@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartrequest.plugins");
const smartrequest_request_1 = require("./smartrequest.request"); const smartrequest_request_1 = require("./smartrequest.request");
var smartrequest_request_2 = require("./smartrequest.request"); var smartrequest_request_2 = require("./smartrequest.request");
exports.request = smartrequest_request_2.request; exports.request = smartrequest_request_2.request;
@ -17,6 +18,7 @@ exports.get = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, fu
return response; return response;
}); });
exports.getBinary = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () { exports.getBinary = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () {
const done = plugins.smartq.defer();
const response = yield smartrequest_request_1.request(domainArg, optionsArg, true); const response = yield smartrequest_request_1.request(domainArg, optionsArg, true);
var data = []; var data = [];
response.on('data', function (chunk) { response.on('data', function (chunk) {
@ -27,7 +29,9 @@ exports.getBinary = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void
//of all of them together //of all of them together
const buffer = Buffer.concat(data); const buffer = Buffer.concat(data);
response.body = buffer.toString('base64'); response.body = buffer.toString('base64');
done.resolve();
}); });
yield done.promise;
return response; return response;
}); });
exports.post = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () { exports.post = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () {
@ -56,4 +60,4 @@ exports.del = (domainArg, optionsArg = {}) => __awaiter(this, void 0, void 0, fu
let response = yield smartrequest_request_1.request(domainArg, optionsArg); let response = yield smartrequest_request_1.request(domainArg, optionsArg);
return response; return response;
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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yxjQUFjLEVBQUUsa0JBQWtCO1NBQ25DLENBQUMsQ0FBQztLQUNKO0lBQ0QsSUFBSSxRQUFRLEdBQUcsTUFBTSw4QkFBTyxDQUFDLFNBQVMsRUFBRSxVQUFVLENBQUMsQ0FBQztJQUNwRCxPQUFPLFFBQVEsQ0FBQztBQUNsQixDQUFDLENBQUEsQ0FBQztBQUVTLFFBQUEsR0FBRyxHQUFHLENBQU8sU0FBaUIsRUFBRSxhQUE4QyxFQUFFLEVBQUUsRUFBRTtJQUM3RixVQUFVLENBQUMsTUFBTSxHQUFHLEtBQUssQ0FBQztJQUMxQixJQUFJLFFBQVEsR0FBRyxNQUFNLDhCQUFPLENBQUMsU0FBUyxFQUFFLFVBQVUsQ0FBQyxDQUFDO0lBQ3BELE9BQU8sUUFBUSxDQUFDO0FBQ2xCLENBQUMsQ0FBQSxDQUFDO0FBRVMsUUFBQSxHQUFHLEdBQUcsQ0FBTyxTQUFpQixFQUFFLGFBQThDLEVBQUUsRUFBRSxFQUFFO0lBQzdGLFVBQVUsQ0FBQyxNQUFNLEdBQUcsUUFBUSxDQUFDO0lBQzdCLElBQUksUUFBUSxHQUFHLE1BQU0sOEJBQU8sQ0FBQyxTQUFTLEVBQUUsVUFBVSxDQUFDLENBQUM7SUFDcEQsT0FBTyxRQUFRLENBQUM7QUFDbEIsQ0FBQyxDQUFBLENBQUMifQ==

View File

@ -1,5 +1,5 @@
import * as url from 'url'; import * as url from 'url';
import * as http from 'http'; import * as http from 'http';
import * as https from 'https'; import * as https from 'https';
import * as q from 'smartq'; import * as smartq from 'smartq';
export { url, http, https, q }; export { url, http, https, smartq };

View File

@ -6,6 +6,6 @@ const http = require("http");
exports.http = http; exports.http = http;
const https = require("https"); const https = require("https");
exports.https = https; exports.https = https;
const q = require("smartq"); const smartq = require("smartq");
exports.q = q; exports.smartq = smartq;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRyZXF1ZXN0LnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHJlcXVlc3QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJCQUEyQjtBQU1sQixrQkFBRztBQUxaLDZCQUE2QjtBQUtmLG9CQUFJO0FBSmxCLCtCQUErQjtBQUlYLHNCQUFLO0FBRnpCLDRCQUE0QjtBQUVELGNBQUMifQ== //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRyZXF1ZXN0LnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHJlcXVlc3QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJCQUEyQjtBQU1sQixrQkFBRztBQUxaLDZCQUE2QjtBQUtmLG9CQUFJO0FBSmxCLCtCQUErQjtBQUlYLHNCQUFLO0FBRnpCLGlDQUFpQztBQUVOLHdCQUFNIn0=

View File

@ -11,7 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartrequest.plugins"); const plugins = require("./smartrequest.plugins");
; ;
let buildResponse = (incomingMessageArg) => { let buildResponse = (incomingMessageArg) => {
let done = plugins.q.defer(); let done = plugins.smartq.defer();
// Continuously update stream with data // Continuously update stream with data
let body = ''; let body = '';
incomingMessageArg.on('data', function (chunkArg) { incomingMessageArg.on('data', function (chunkArg) {
@ -29,7 +29,7 @@ let buildResponse = (incomingMessageArg) => {
return done.promise; return done.promise;
}; };
exports.request = (domainArg, optionsArg = {}, streamArg = false) => __awaiter(this, void 0, void 0, function* () { exports.request = (domainArg, optionsArg = {}, streamArg = false) => __awaiter(this, void 0, void 0, function* () {
let done = plugins.q.defer(); let done = plugins.smartq.defer();
let parsedUrl; let parsedUrl;
if (domainArg) { if (domainArg) {
parsedUrl = plugins.url.parse(domainArg); parsedUrl = plugins.url.parse(domainArg);
@ -84,4 +84,4 @@ exports.request = (domainArg, optionsArg = {}, streamArg = false) => __awaiter(t
} }
return done.promise; return done.promise;
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRyZXF1ZXN0LnJlcXVlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHJlcXVlc3QucmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQ0Esa0RBQWtEO0FBT2pELENBQUM7QUFFRixJQUFJLGFBQWEsR0FBRyxDQUFDLGtCQUFtQyxFQUFvQyxFQUFFO0lBQzVGLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUEyQixDQUFDO0lBQ3RELHVDQUF1QztJQUN2QyxJQUFJLElBQUksR0FBRyxFQUFFLENBQUM7SUFDZCxrQkFBa0IsQ0FBQyxFQUFFLENBQUMsTUFBTSxFQUFFLFVBQVMsUUFBUTtRQUM3QyxJQUFJLElBQUksUUFBUSxDQUFDO0lBQ25CLENBQUMsQ0FBQyxDQUFDO0lBRUgsa0JBQWtCLENBQUMsRUFBRSxDQUFDLEtBQUssRUFBRTtRQUMzQixJQUFJO1lBQ0Qsa0JBQThDLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7U0FDekU7UUFBQyxPQUFPLEdBQUcsRUFBRTtZQUNYLGtCQUE4QyxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7U0FDN0Q7UUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLGtCQUE2QyxDQUFDLENBQUM7SUFDOUQsQ0FBQyxDQUFDLENBQUM7SUFDSCxPQUFPLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDdEIsQ0FBQyxDQUFDO0FBRVMsUUFBQSxPQUFPLEdBQUcsQ0FDbkIsU0FBaUIsRUF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dBQVcsS0FBSyxRQUFRLEVBQUU7Z0JBQzlDLFVBQVUsQ0FBQyxXQUFXLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxVQUFVLENBQUMsV0FBVyxDQUFDLENBQUM7YUFDakU7WUFDRCxPQUFPLENBQUMsS0FBSyxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsQ0FBQztTQUN2QztRQUNELE9BQU8sQ0FBQyxFQUFFLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQyxFQUFFO1lBQ3RCLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDbkIsQ0FBQyxDQUFDLENBQUM7UUFDSCxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUM7S0FDZjtTQUFNO1FBQ0wsTUFBTSxJQUFJLEtBQUssQ0FBQyx5QkFBeUIsU0FBUyxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7S0FDaEU7SUFDRCxPQUFPLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDdEIsQ0FBQyxDQUFBLENBQUMifQ==

View File

@ -15,6 +15,7 @@ export let get = async (domainArg: string, optionsArg: interfaces.ISmartRequestO
}; };
export let getBinary = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => { export let getBinary = async (domainArg: string, optionsArg: interfaces.ISmartRequestOptions = {}) => {
const done = plugins.smartq.defer();
const response = await request(domainArg, optionsArg, true); const response = await request(domainArg, optionsArg, true);
var data = []; var data = [];
@ -26,7 +27,9 @@ export let getBinary = async (domainArg: string, optionsArg: interfaces.ISmartRe
//of all of them together //of all of them together
const buffer = Buffer.concat(data); const buffer = Buffer.concat(data);
response.body = buffer.toString('base64'); response.body = buffer.toString('base64');
done.resolve();
}); });
await done.promise;
return response; return response;
} }

View File

@ -2,6 +2,6 @@ import * as url from 'url';
import * as http from 'http'; import * as http from 'http';
import * as https from 'https'; import * as https from 'https';
import * as q from 'smartq'; import * as smartq from 'smartq';
export { url, http, https, q }; export { url, http, https, smartq };

View File

@ -9,7 +9,7 @@ export interface extendedIncomingMessage extends IncomingMessage {
}; };
let buildResponse = (incomingMessageArg: IncomingMessage): Promise<extendedIncomingMessage> => { let buildResponse = (incomingMessageArg: IncomingMessage): Promise<extendedIncomingMessage> => {
let done = plugins.q.defer<extendedIncomingMessage>(); let done = plugins.smartq.defer<extendedIncomingMessage>();
// Continuously update stream with data // Continuously update stream with data
let body = ''; let body = '';
incomingMessageArg.on('data', function(chunkArg) { incomingMessageArg.on('data', function(chunkArg) {
@ -32,7 +32,7 @@ export let request = async (
optionsArg: interfaces.ISmartRequestOptions = {}, optionsArg: interfaces.ISmartRequestOptions = {},
streamArg: boolean = false streamArg: boolean = false
): Promise<extendedIncomingMessage> => { ): Promise<extendedIncomingMessage> => {
let done = plugins.q.defer<any>(); let done = plugins.smartq.defer<any>();
let parsedUrl: plugins.url.Url; let parsedUrl: plugins.url.Url;
if (domainArg) { if (domainArg) {
parsedUrl = plugins.url.parse(domainArg); parsedUrl = plugins.url.parse(domainArg);