@basmilius/http-client 1.5.5 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/HttpAdapter.d.ts +3 -3
- package/dist/adapter/index.d.ts +1 -1
- package/dist/decorator/adapter.d.ts +2 -2
- package/dist/decorator/bound.d.ts +1 -1
- package/dist/decorator/debounce.d.ts +1 -1
- package/dist/decorator/dto/arrayProxy.d.ts +15 -15
- package/dist/decorator/dto/classProxy.d.ts +8 -8
- package/dist/decorator/dto/clone.d.ts +4 -4
- package/dist/decorator/dto/constant.d.ts +7 -7
- package/dist/decorator/dto/fill.d.ts +4 -4
- package/dist/decorator/dto/helper/areEqual.d.ts +4 -4
- package/dist/decorator/dto/helper/assertDto.d.ts +4 -4
- package/dist/decorator/dto/helper/circularProtect.d.ts +1 -1
- package/dist/decorator/dto/helper/cloneDto.d.ts +3 -3
- package/dist/decorator/dto/helper/executeIfDtoDirtyAndMarkClean.d.ts +7 -4
- package/dist/decorator/dto/helper/index.d.ts +17 -17
- package/dist/decorator/dto/helper/instance.d.ts +2 -2
- package/dist/decorator/dto/helper/isDto.d.ts +4 -4
- package/dist/decorator/dto/helper/isDtoClean.d.ts +3 -3
- package/dist/decorator/dto/helper/isDtoDirty.d.ts +3 -3
- package/dist/decorator/dto/helper/markDtoClean.d.ts +3 -3
- package/dist/decorator/dto/helper/markDtoDirty.d.ts +3 -3
- package/dist/decorator/dto/helper/relateDtoTo.d.ts +4 -4
- package/dist/decorator/dto/helper/relateValueTo.d.ts +4 -4
- package/dist/decorator/dto/helper/trackDto.d.ts +3 -3
- package/dist/decorator/dto/helper/triggerDto.d.ts +3 -4
- package/dist/decorator/dto/helper/unrelateDtoFrom.d.ts +4 -4
- package/dist/decorator/dto/helper/unrelateValueFrom.d.ts +4 -4
- package/dist/decorator/dto/index.d.ts +6 -6
- package/dist/decorator/dto/instanceProxy.d.ts +21 -21
- package/dist/decorator/dto/map.d.ts +2 -2
- package/dist/decorator/dto/refProxy.d.ts +30 -30
- package/dist/decorator/dto/serialize/deserialize.d.ts +1 -1
- package/dist/decorator/dto/serialize/deserializeArray.d.ts +1 -1
- package/dist/decorator/dto/serialize/deserializeDateTime.d.ts +3 -3
- package/dist/decorator/dto/serialize/deserializeDto.d.ts +3 -3
- package/dist/decorator/dto/serialize/deserializeObject.d.ts +1 -1
- package/dist/decorator/dto/serialize/deserializeUnknown.d.ts +1 -1
- package/dist/decorator/dto/serialize/index.d.ts +2 -2
- package/dist/decorator/dto/serialize/isSerializedDateTime.d.ts +2 -2
- package/dist/decorator/dto/serialize/isSerializedDto.d.ts +2 -2
- package/dist/decorator/dto/serialize/serialize.d.ts +1 -1
- package/dist/decorator/dto/serialize/serializeArray.d.ts +2 -2
- package/dist/decorator/dto/serialize/serializeDateTime.d.ts +3 -3
- package/dist/decorator/dto/serialize/serializeDto.d.ts +3 -3
- package/dist/decorator/dto/serialize/serializeObject.d.ts +1 -1
- package/dist/decorator/dto/serialize/serializeUnknown.d.ts +2 -2
- package/dist/decorator/dto/serialize/uuid.d.ts +1 -1
- package/dist/decorator/dto/symbols.d.ts +11 -11
- package/dist/decorator/dto/toJSON.d.ts +4 -4
- package/dist/decorator/index.d.ts +7 -7
- package/dist/dto/BlobResponse.d.ts +4 -4
- package/dist/dto/Paginated.d.ts +7 -7
- package/dist/dto/index.d.ts +2 -2
- package/dist/http/BaseResponse.d.ts +8 -8
- package/dist/http/BaseService.d.ts +3 -3
- package/dist/http/HttpClient.d.ts +8 -8
- package/dist/http/QueryString.d.ts +11 -12
- package/dist/http/RequestBuilder.d.ts +31 -28
- package/dist/http/RequestError.d.ts +7 -7
- package/dist/http/helpers.d.ts +1 -1
- package/dist/http/index.d.ts +7 -7
- package/dist/http-client.js +3638 -1
- package/dist/http-client.js.map +68 -5
- package/dist/index.d.ts +5 -5
- package/package.json +56 -57
- package/dist/decorator/dto/instance.d.ts +0 -31
- package/dist/decorator/dto/serialize/types.d.ts +0 -3
- package/dist/type/index.d.ts +0 -2
- package/dist/util/datetime.d.ts +0 -2
- package/dist/util/index.d.ts +0 -2
- package/dist/util/reflection.d.ts +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import adapter from
|
|
2
|
-
import bound from
|
|
3
|
-
import debounce from
|
|
4
|
-
import dto from
|
|
1
|
+
import adapter from "./adapter";
|
|
2
|
+
import bound from "./bound";
|
|
3
|
+
import debounce from "./debounce";
|
|
4
|
+
import dto from "./dto";
|
|
5
5
|
export { adapter, bound, debounce, dto };
|
|
6
|
-
export { assertDto, cloneDto, executeIfDtoDirtyAndMarkClean, isDto, isDtoClean, isDtoDirty, markDtoClean, markDtoDirty } from
|
|
7
|
-
export { deserialize, serialize } from
|
|
8
|
-
export type
|
|
6
|
+
export { assertDto, cloneDto, executeIfDtoDirtyAndMarkClean, isDto, isDtoClean, isDtoDirty, markDtoClean, markDtoDirty } from "./dto/helper";
|
|
7
|
+
export { deserialize, serialize } from "./dto/serialize";
|
|
8
|
+
export type { DtoInstance } from "./dto";
|
package/dist/dto/Paginated.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare class Paginated<T> {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
#private;
|
|
3
|
+
get items(): T[];
|
|
4
|
+
get page(): number;
|
|
5
|
+
get pageSize(): number;
|
|
6
|
+
get pages(): number;
|
|
7
|
+
get totalItems(): number;
|
|
8
|
+
constructor(items: T[], page: number, pageSize: number, pages: number, totalItems: number);
|
|
9
9
|
}
|
package/dist/dto/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { BlobResponse } from
|
|
2
|
-
export { Paginated } from
|
|
1
|
+
export { BlobResponse } from "./BlobResponse";
|
|
2
|
+
export { Paginated } from "./Paginated";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { HttpStatusCode } from
|
|
1
|
+
import type { HttpStatusCode } from "@/type";
|
|
2
2
|
export default class BaseResponse<T> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
#private;
|
|
4
|
+
get data(): T;
|
|
5
|
+
get headers(): Headers;
|
|
6
|
+
get ok(): boolean;
|
|
7
|
+
get response(): Response;
|
|
8
|
+
get statusCode(): HttpStatusCode;
|
|
9
|
+
constructor(data: T, response: Response);
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import HttpClient from
|
|
2
|
-
import RequestBuilder from
|
|
1
|
+
import HttpClient from "./HttpClient";
|
|
2
|
+
import RequestBuilder from "./RequestBuilder";
|
|
3
3
|
export default class BaseService {
|
|
4
|
-
|
|
4
|
+
protected request(path: string, client?: HttpClient): RequestBuilder;
|
|
5
5
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default class HttpClient {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
#private;
|
|
3
|
+
get authToken(): string | null;
|
|
4
|
+
set authToken(value: string | null);
|
|
5
|
+
get baseUrl(): string;
|
|
6
|
+
get dataField(): boolean;
|
|
7
|
+
constructor(authToken: string | null, baseUrl: string, dataField?: boolean);
|
|
8
|
+
static get instance(): HttpClient;
|
|
9
|
+
static register(client: HttpClient): void;
|
|
10
10
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
export default class QueryString {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
#private;
|
|
3
|
+
constructor();
|
|
4
|
+
build(): string;
|
|
5
|
+
append(name: string, value: QueryStringValue): QueryString;
|
|
6
|
+
appendArray(name: string, values: QueryStringValue[] | null): QueryString;
|
|
7
|
+
delete(name: string): QueryString;
|
|
8
|
+
get(name: string): string | null;
|
|
9
|
+
getAll(name: string): string[];
|
|
10
|
+
has(name: string): boolean;
|
|
11
|
+
set(name: string, value: QueryStringValue): QueryString;
|
|
12
|
+
static builder(): QueryString;
|
|
13
13
|
}
|
|
14
14
|
type QueryStringValue = boolean | number | string | null;
|
|
15
|
-
export {};
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { BlobResponse, Paginated } from
|
|
2
|
-
import type { HttpMethod, HttpStatusCode } from
|
|
3
|
-
import BaseResponse from
|
|
4
|
-
import HttpClient from
|
|
5
|
-
import type QueryString from
|
|
1
|
+
import { BlobResponse, Paginated } from "@/dto";
|
|
2
|
+
import type { HttpMethod, HttpStatusCode } from "@/type";
|
|
3
|
+
import BaseResponse from "./BaseResponse";
|
|
4
|
+
import HttpClient from "./HttpClient";
|
|
5
|
+
import type QueryString from "./QueryString";
|
|
6
6
|
export default class RequestBuilder {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
7
|
+
#private;
|
|
8
|
+
get client(): HttpClient;
|
|
9
|
+
get options(): RequestInit;
|
|
10
|
+
get path(): string;
|
|
11
|
+
set path(value: string);
|
|
12
|
+
get query(): QueryString | null;
|
|
13
|
+
set query(value: QueryString | null);
|
|
14
|
+
constructor(path: string, client?: HttpClient);
|
|
15
|
+
bearerToken(token?: string): RequestBuilder;
|
|
16
|
+
body(body: BodyInit | FormData | object | null, contentType?: string | null): RequestBuilder;
|
|
17
|
+
header(name: string, value: string): RequestBuilder;
|
|
18
|
+
method(method: HttpMethod): RequestBuilder;
|
|
19
|
+
queryString(queryString: QueryString): RequestBuilder;
|
|
20
|
+
fetch<TResult>(): Promise<TResult>;
|
|
21
|
+
fetchBlob(): Promise<BlobResponse>;
|
|
22
|
+
run<TResult extends {}>(): Promise<BaseResponse<TResult>>;
|
|
23
|
+
runAdapter<TResult extends {}>(adapterMethod: (item: object) => TResult): Promise<BaseResponse<TResult>>;
|
|
24
|
+
runArrayAdapter<TResult extends {}>(adapterMethod: (item: object) => TResult): Promise<BaseResponse<TResult[]>>;
|
|
25
|
+
runEmpty(): Promise<BaseResponse<never>>;
|
|
26
|
+
runPaginatedAdapter<TResult extends {}>(adapterMethod: (item: object) => TResult): Promise<BaseResponse<Paginated<TResult>>>;
|
|
27
|
+
runData<TResult>(): Promise<BaseResponse<TResult>>;
|
|
28
|
+
runDataKey<
|
|
29
|
+
TResult extends object,
|
|
30
|
+
TKey extends keyof TResult = keyof TResult
|
|
31
|
+
>(key: TKey): Promise<BaseResponse<TResult[TKey]>>;
|
|
32
|
+
runStatusCode(): Promise<HttpStatusCode>;
|
|
30
33
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { HttpStatusCode } from
|
|
1
|
+
import type { HttpStatusCode } from "@/type";
|
|
2
2
|
export default class RequestError {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
#private;
|
|
4
|
+
get code(): number;
|
|
5
|
+
get error(): string;
|
|
6
|
+
get errorDescription(): string;
|
|
7
|
+
get statusCode(): HttpStatusCode;
|
|
8
|
+
constructor(code: number, error: string, errorDescription: string, statusCode: HttpStatusCode);
|
|
9
9
|
}
|
package/dist/http/helpers.d.ts
CHANGED
package/dist/http/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import BaseResponse from
|
|
2
|
-
import BaseService from
|
|
3
|
-
import HttpClient from
|
|
4
|
-
import QueryString from
|
|
5
|
-
import RequestBuilder from
|
|
6
|
-
import RequestError from
|
|
1
|
+
import BaseResponse from "./BaseResponse";
|
|
2
|
+
import BaseService from "./BaseService";
|
|
3
|
+
import HttpClient from "./HttpClient";
|
|
4
|
+
import QueryString from "./QueryString";
|
|
5
|
+
import RequestBuilder from "./RequestBuilder";
|
|
6
|
+
import RequestError from "./RequestError";
|
|
7
7
|
export { BaseResponse, BaseService, HttpClient, QueryString, RequestBuilder, RequestError };
|
|
8
|
-
export { isRequestError, isUnsanctionedRequest } from
|
|
8
|
+
export { isRequestError, isUnsanctionedRequest } from "./helpers";
|