@frui.ts/apiclient
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
@@ -1,2 +0,2 @@ | ||
import { IApiConnector } from "./types"; | ||
import type { IApiConnector } from "./types"; | ||
export declare type Middleware = (response: Response) => Response | PromiseLike<Response>; | ||
@@ -3,0 +3,0 @@ export declare type FetchFunction = (input: RequestInfo, init?: RequestInit) => Promise<Response>; |
@@ -58,3 +58,3 @@ "use strict"; | ||
function appendJsonHeader(params) { | ||
return __assign(__assign({}, params), { headers: __assign(__assign({}, (params || {}).headers), { "Content-Type": jsonContentType }) }); | ||
return __assign(__assign({}, params), { headers: __assign(__assign({}, (params !== null && params !== void 0 ? params : {}).headers), { "Content-Type": jsonContentType }) }); | ||
} | ||
@@ -90,3 +90,3 @@ exports.appendJsonHeader = appendJsonHeader; | ||
var _a, _b, _c; | ||
this.fetchFunction = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.fetchFunction) !== null && _a !== void 0 ? _a : helpers_1.bind(window.fetch, window); | ||
this.fetchFunction = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.fetchFunction) !== null && _a !== void 0 ? _a : (0, helpers_1.bind)(window.fetch, window); | ||
this.jsonSerializer = (_b = configuration === null || configuration === void 0 ? void 0 : configuration.jsonSerializer) !== null && _b !== void 0 ? _b : JSON.stringify; | ||
@@ -93,0 +93,0 @@ this.middleware = (_c = configuration === null || configuration === void 0 ? void 0 : configuration.middleware) !== null && _c !== void 0 ? _c : handleErrorStatusMiddleware; |
@@ -10,2 +10,4 @@ "use strict"; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
@@ -12,0 +14,0 @@ function __() { this.constructor = d; } |
@@ -1,3 +0,3 @@ | ||
import { StringifyOptions } from "query-string"; | ||
import { IApiConnector } from "./types"; | ||
import type { StringifiableRecord, StringifyOptions } from "query-string"; | ||
import type { IApiConnector } from "./types"; | ||
export declare const ContentTypes: { | ||
@@ -21,4 +21,4 @@ json: string; | ||
one(path: string, id?: any): this; | ||
get<T>(queryParams?: any): Promise<T>; | ||
getRaw(queryParams?: any): Promise<Response>; | ||
get<T>(queryParams?: StringifiableRecord): Promise<T>; | ||
getRaw(queryParams?: StringifiableRecord): Promise<Response>; | ||
post<T>(content: any): Promise<T>; | ||
@@ -35,4 +35,4 @@ postOnly(content: any): Promise<Response>; | ||
withBaseUrl(url: string): this; | ||
getQueryString(query: any, queryStringOptions?: StringifyOptions): string; | ||
appendQuery(url: string, query?: any, queryStringOptions?: StringifyOptions): string; | ||
getQueryString(query: StringifiableRecord, queryStringOptions?: StringifyOptions): string; | ||
appendQuery(url: string, query?: StringifiableRecord, queryStringOptions?: StringifyOptions): string; | ||
} |
@@ -21,3 +21,3 @@ "use strict"; | ||
function appendAcceptHeader(params, acceptContentType) { | ||
return __assign(__assign({}, params), { headers: __assign(__assign({}, (params || {}).headers), { Accept: acceptContentType }) }); | ||
return __assign(__assign({}, params), { headers: __assign(__assign({}, (params !== null && params !== void 0 ? params : {}).headers), { Accept: acceptContentType }) }); | ||
} | ||
@@ -116,3 +116,3 @@ exports.appendAcceptHeader = appendAcceptHeader; | ||
var _a; | ||
return query_string_1.stringify(query, (_a = queryStringOptions !== null && queryStringOptions !== void 0 ? queryStringOptions : this.queryStringOptions) !== null && _a !== void 0 ? _a : RestRequestBuilder.DefaultQueryStringOptions); | ||
return (0, query_string_1.stringify)(query, (_a = queryStringOptions !== null && queryStringOptions !== void 0 ? queryStringOptions : this.queryStringOptions) !== null && _a !== void 0 ? _a : RestRequestBuilder.DefaultQueryStringOptions); | ||
}; | ||
@@ -119,0 +119,0 @@ RestRequestBuilder.prototype.appendQuery = function (url, query, queryStringOptions) { |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.2", | ||
"description": "Frui.ts helpers for HTTP communication", | ||
@@ -36,6 +36,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@frui.ts/helpers": "^1.0.0-alpha.1", | ||
"@frui.ts/helpers": "^1.0.0-alpha.2", | ||
"query-string": "^6.13.7" | ||
}, | ||
"gitHead": "debcc8b7993b1b0708853dddb9d29dc2a5727477" | ||
"gitHead": "99546362efd91f923e743ed07477bb6ef0b1caa3" | ||
} |
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
40409
278
378