Comparing version 0.11.0 to 0.11.1
@@ -6,2 +6,6 @@ All notable changes to this project will be documented in this file. | ||
## [0.11.1] - 2021-05-30 | ||
### Fixed | ||
- using some cache engines | ||
## [0.11.0] - 2021-05-30 | ||
@@ -12,2 +16,4 @@ ### Added | ||
- typings for download util | ||
### Changes | ||
- [BREAKING] download util arguments order | ||
@@ -14,0 +20,0 @@ ## [0.10.0] - 2021-05-09 |
@@ -121,3 +121,7 @@ "use strict"; | ||
} | ||
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, globalOptions), this._options), options), bodyOptions), { method: method, headers: Object.assign(Object.assign(Object.assign({}, globalHeaders), localHeaders), contentType) }); | ||
const opts = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, globalOptions), this._options), options), bodyOptions), { method: method, headers: Object.assign(Object.assign(Object.assign({}, globalHeaders), localHeaders), contentType) }); | ||
Object.defineProperty(opts, "toJSON", { | ||
value: () => ({ type: opts.type }), | ||
}); | ||
return opts; | ||
} | ||
@@ -314,5 +318,2 @@ _buildUrlBase(url, base) { | ||
} | ||
if (typeof value === "function") { | ||
return `[Function: ${value.name}]`; | ||
} | ||
return value; | ||
@@ -327,3 +328,3 @@ }, space); | ||
const headers = new light_isomorphic_fetch_1.Headers(all.headers); | ||
const request = new request_js_1.ApiRequest(all.request.url, Object.assign(Object.assign({}, all.request.options), { retryPolicy: helpers_js_1.createNoopFunctionFromString(all.request.options.retryPolicy), retryWaitPolicy: helpers_js_1.createNoopFunctionFromString(all.request.options.retryWaitPolicy) }), all.request.originalUrl, all.request.queryParams); | ||
const request = new request_js_1.ApiRequest(all.request.url, all.request.options, all.request.originalUrl, all.request.queryParams); | ||
const body = all.body; | ||
@@ -330,0 +331,0 @@ const rawBody = all.rawBody; |
declare const getJoinedUrl: (url: string | string[]) => string; | ||
declare const wait: (time: number) => Promise<unknown>; | ||
declare const createNoopFunctionFromString: (s: string) => () => undefined; | ||
export { getJoinedUrl, wait, createNoopFunctionFromString, }; | ||
export { getJoinedUrl, wait, }; | ||
//# sourceMappingURL=helpers.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createNoopFunctionFromString = exports.wait = exports.getJoinedUrl = void 0; | ||
exports.wait = exports.getJoinedUrl = void 0; | ||
const url_join_1 = __importDefault(require("url-join")); | ||
@@ -18,14 +18,2 @@ const getJoinedUrl = (url) => { | ||
exports.wait = wait; | ||
const FUNCTION_NAME_BEGIN_INDEX = 11; | ||
const FUNCTION_NAME_END_INDEX = -1; | ||
const getFunctionNameFromString = (s) => { | ||
return s.substring(FUNCTION_NAME_BEGIN_INDEX, s.length + (FUNCTION_NAME_END_INDEX - 1)); | ||
}; | ||
const createNoopFunctionFromString = (s) => { | ||
const name = getFunctionNameFromString(s); | ||
const fn = () => undefined; | ||
Object.defineProperty(fn, "name", { value: name }); | ||
return fn; | ||
}; | ||
exports.createNoopFunctionFromString = createNoopFunctionFromString; | ||
//# sourceMappingURL=helpers.js.map |
@@ -10,3 +10,3 @@ import f, { Headers } from "light-isomorphic-fetch"; | ||
import { contentTypeMap, RequestType } from "./const.js"; | ||
import { createNoopFunctionFromString, getJoinedUrl, wait } from "./helpers.js"; | ||
import { getJoinedUrl, wait } from "./helpers.js"; | ||
import { ApiRequest } from "./request/request.js"; | ||
@@ -97,3 +97,3 @@ const stringify = qs.stringify; | ||
} | ||
return { | ||
const opts = { | ||
...globalOptions, | ||
@@ -110,2 +110,6 @@ ...this._options, | ||
}; | ||
Object.defineProperty(opts, "toJSON", { | ||
value: () => ({ type: opts.type }), | ||
}); | ||
return opts; | ||
} | ||
@@ -308,5 +312,2 @@ _buildUrlBase(url, base) { | ||
} | ||
if (typeof value === "function") { | ||
return `[Function: ${value.name}]`; | ||
} | ||
return value; | ||
@@ -321,7 +322,3 @@ }, space); | ||
const headers = new Headers(all.headers); | ||
const request = new ApiRequest(all.request.url, { | ||
...all.request.options, | ||
retryPolicy: createNoopFunctionFromString(all.request.options.retryPolicy), | ||
retryWaitPolicy: createNoopFunctionFromString(all.request.options.retryWaitPolicy), | ||
}, all.request.originalUrl, all.request.queryParams); | ||
const request = new ApiRequest(all.request.url, all.request.options, all.request.originalUrl, all.request.queryParams); | ||
const body = all.body; | ||
@@ -328,0 +325,0 @@ const rawBody = all.rawBody; |
declare const getJoinedUrl: (url: string | string[]) => string; | ||
declare const wait: (time: number) => Promise<unknown>; | ||
declare const createNoopFunctionFromString: (s: string) => () => undefined; | ||
export { getJoinedUrl, wait, createNoopFunctionFromString, }; | ||
export { getJoinedUrl, wait, }; | ||
//# sourceMappingURL=helpers.d.ts.map |
@@ -9,14 +9,3 @@ import urlJoin from "url-join"; | ||
const wait = async (time) => new Promise(resolve => setTimeout(resolve, time)); | ||
const FUNCTION_NAME_BEGIN_INDEX = 11; | ||
const FUNCTION_NAME_END_INDEX = -1; | ||
const getFunctionNameFromString = (s) => { | ||
return s.substring(FUNCTION_NAME_BEGIN_INDEX, s.length + (FUNCTION_NAME_END_INDEX - 1)); | ||
}; | ||
const createNoopFunctionFromString = (s) => { | ||
const name = getFunctionNameFromString(s); | ||
const fn = () => undefined; | ||
Object.defineProperty(fn, "name", { value: name }); | ||
return fn; | ||
}; | ||
export { getJoinedUrl, wait, createNoopFunctionFromString, }; | ||
export { getJoinedUrl, wait, }; | ||
//# sourceMappingURL=helpers.js.map |
{ | ||
"name": "api-reach", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"repository": "git@github.com:dzek69/api-reach.git", | ||
@@ -47,2 +47,3 @@ "author": "Jacek Nowacki @dzek69 <git-public@dzek.eu>", | ||
"@dzek69/eslint-config-typescript": "^0.3.2", | ||
"@keyv/sqlite": "^2.0.2", | ||
"@types/keyv": "^3.1.1", | ||
@@ -49,0 +50,0 @@ "@types/node-fetch": "^2.5.8", |
@@ -37,3 +37,3 @@ /* eslint-disable max-lines */ | ||
import { contentTypeMap, RequestType } from "./const.js"; | ||
import { createNoopFunctionFromString, getJoinedUrl, wait } from "./helpers.js"; | ||
import { getJoinedUrl, wait } from "./helpers.js"; | ||
import { ApiRequest } from "./request/request.js"; | ||
@@ -146,3 +146,3 @@ | ||
return { // @todo filter only known options | ||
const opts = { // @todo filter only known options | ||
...globalOptions, | ||
@@ -159,2 +159,8 @@ ...this._options, | ||
}; | ||
Object.defineProperty(opts, "toJSON", { | ||
value: () => ({ type: opts.type }), | ||
}); | ||
return opts; | ||
} | ||
@@ -511,5 +517,2 @@ | ||
} | ||
if (typeof value === "function") { | ||
return `[Function: ${value.name}]`; | ||
} | ||
return value; | ||
@@ -530,9 +533,4 @@ }, space); | ||
all.request.url, | ||
{ | ||
...all.request.options, | ||
retryPolicy: createNoopFunctionFromString(all.request.options.retryPolicy) as unknown as () => boolean, | ||
retryWaitPolicy: createNoopFunctionFromString( | ||
all.request.options.retryWaitPolicy, | ||
) as unknown as () => number, | ||
}, | ||
// @TODO what to do with missing options after (de)serializing? types are different than runtime | ||
all.request.options, | ||
all.request.originalUrl, | ||
@@ -539,0 +537,0 @@ all.request.queryParams, |
@@ -13,20 +13,5 @@ import urlJoin from "url-join"; | ||
const FUNCTION_NAME_BEGIN_INDEX = 11; | ||
const FUNCTION_NAME_END_INDEX = -1; | ||
const getFunctionNameFromString = (s: string) => { | ||
return s.substring(FUNCTION_NAME_BEGIN_INDEX, s.length + (FUNCTION_NAME_END_INDEX - 1)); | ||
}; | ||
const createNoopFunctionFromString = (s: string) => { | ||
const name = getFunctionNameFromString(s); | ||
const fn = () => undefined; | ||
Object.defineProperty(fn, "name", { value: name }); | ||
return fn; | ||
}; | ||
export { | ||
getJoinedUrl, | ||
wait, | ||
createNoopFunctionFromString, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
748263
24
5796