@qiwi/substrate-types
Advanced tools
Comparing version 1.24.0 to 1.25.0
@@ -0,1 +1,16 @@ | ||
# @qiwi/substrate-types [1.25.0](https://github.com/qiwi/substrate/compare/@qiwi/substrate-types@1.24.0...@qiwi/substrate-types@1.25.0) (2020-02-11) | ||
### Bug Fixes | ||
* **types:** fix IFetch generics, IHttpClient improvements ([be00410](https://github.com/qiwi/substrate/commit/be004108eaad11e3a252532aeb590258a2bda209)) | ||
* **types:** let HttpReqPerform 2-3 args be optional ([d46ec8a](https://github.com/qiwi/substrate/commit/d46ec8a90ff401c2444ff9d6e176d6627fc37e3b)) | ||
### Features | ||
* **types:** add IHttpFetcher ([aaa1dcd](https://github.com/qiwi/substrate/commit/aaa1dcd4707895aaf0606b8762747b9f0a8b38e1)), closes [#5](https://github.com/qiwi/substrate/issues/5) | ||
* **types:** separate IHttpClient and IFetch, add IHttpRequestProvider ([f80dd51](https://github.com/qiwi/substrate/commit/f80dd51ba2128283c18ef544e44c20fb71335939)) | ||
* add IHttpClient and test with axios ([0757e4b](https://github.com/qiwi/substrate/commit/0757e4bbe60266b68711a4e8de6ae45a5b5ced45)) | ||
# @qiwi/substrate-types [1.24.0](https://github.com/qiwi/substrate/compare/@qiwi/substrate-types@1.23.0...@qiwi/substrate-types@1.24.0) (2020-01-20) | ||
@@ -2,0 +17,0 @@ |
{ | ||
"name": "@qiwi/substrate-types", | ||
"version": "1.24.0", | ||
"version": "1.25.0", | ||
"main": "target/es5/index.js", | ||
@@ -41,10 +41,12 @@ "source": "target/ts/index.ts", | ||
"devDependencies": { | ||
"@qiwi/uniconfig": "^3.2.2", | ||
"@qiwi/uniconfig": "^3.3.0", | ||
"@types/axios": "^0.14.0", | ||
"@types/bluebird": "^3.5.29", | ||
"@types/config": "^0.0.36", | ||
"@types/jest": "^24.9.0", | ||
"@types/jest": "^25.1.2", | ||
"@types/lodash": "^4.14.149", | ||
"@types/node": "^13.1.8", | ||
"@types/parsimmon": "^1.10.0", | ||
"@types/node": "^13.7.0", | ||
"@types/parsimmon": "^1.10.1", | ||
"@types/underscore": "^1.9.4", | ||
"axios": "^0.19.2", | ||
"bluebird": "^3.7.2", | ||
@@ -61,6 +63,7 @@ "conf": "^6.2.0", | ||
"ts-to-flow": "^0.0.3", | ||
"typedoc": "0.16.9", | ||
"typedoc-plugin-external-module-name": "3.0.0", | ||
"typescript": "3.7.5", | ||
"underscore": "^1.9.2", | ||
"typedoc": "0.15.8", | ||
"typedoc-plugin-external-module-name": "3.0.0" | ||
"cross-fetch": "^3.0.4" | ||
}, | ||
@@ -67,0 +70,0 @@ "dependencies": {}, |
@@ -25,1 +25,2 @@ /** @module @qiwi/substrate-types */ | ||
export { IPool as Pool, IPooledObject as PooledObject, IPooledObjectFactory as PooledObjectFactory, IPooledObjectStatus as PooledObjectStatus } from './IPool'; | ||
export { IHttpClient as HttpClient, IFetch as Fetch, IHttpRequestProvider as HttpRequestProvider, HttpMethod } from './IHttpClient'; |
@@ -25,1 +25,2 @@ /** @module @qiwi/substrate-types */ | ||
export { IPool, IPooledObject, IPooledObjectFactory, IPooledObjectStatus } from './IPool'; | ||
export { IHttpClient, IFetch, IHttpRequestProvider, HttpMethod } from './IHttpClient'; |
@@ -25,1 +25,2 @@ /** @module @qiwi/substrate-types */ | ||
export { IPool as Pool, IPooledObject as PooledObject, IPooledObjectFactory as PooledObjectFactory, IPooledObjectStatus as PooledObjectStatus } from './IPool'; | ||
export { IHttpClient as HttpClient, IFetch as Fetch, IHttpRequestProvider as HttpRequestProvider, HttpMethod } from './IHttpClient'; |
@@ -25,1 +25,2 @@ /** @module @qiwi/substrate-types */ | ||
export { IPool, IPooledObject, IPooledObjectFactory, IPooledObjectStatus } from './IPool'; | ||
export { IHttpClient, IFetch, IHttpRequestProvider, HttpMethod } from './IHttpClient'; |
@@ -48,1 +48,7 @@ /** @module @qiwi/substrate-types */ | ||
} from './IPool' | ||
export { | ||
IHttpClient as HttpClient, | ||
IFetch as Fetch, | ||
IHttpRequestProvider as HttpRequestProvider, | ||
HttpMethod | ||
} from './IHttpClient' |
@@ -48,1 +48,7 @@ /** @module @qiwi/substrate-types */ | ||
} from './IPool' | ||
export { | ||
IHttpClient, | ||
IFetch, | ||
IHttpRequestProvider, | ||
HttpMethod | ||
} from './IHttpClient' |
@@ -78,2 +78,76 @@ declare module '@qiwi/substrate-types/target/es5/IAnyMap' { | ||
} | ||
declare module '@qiwi/substrate-types/target/es5/IPromise' { | ||
/** @qiwi/substrate-types */ | ||
/** */ | ||
import { IConstructor } from '@qiwi/substrate-types/target/es5/IConstructor'; | ||
export type TPromiseExecutor<TValue = any, TReason = any> = (resolve: (value: TValue) => void, reject: (reason: TReason) => void) => void; | ||
export interface IPromiseConstructor<TValue = any, TReason = any> extends IConstructor<IPromise<TValue, TReason>> { | ||
new (executor: TPromiseExecutor<TValue>): IPromise<TValue, TReason>; | ||
all: (values: Iterable<IPromise<TValue, TReason>>) => IPromise<TValue[], TReason>; | ||
race: (values: Iterable<IPromise<TValue, TReason>>) => IPromise<TValue, TReason>; | ||
reject: (reason?: TReason) => IPromise<TValue, TReason>; | ||
resolve: (value?: TValue) => IPromise<TValue, TReason>; | ||
} | ||
export interface IPromise<TValue = any, TReason = any> { | ||
then: (onSuccess?: (value: TValue) => any, onReject?: (reason: TReason) => any) => IPromise; | ||
catch: (onReject: (reason: TReason) => any) => IPromise; | ||
finally: (onFinally: () => any) => IPromise; | ||
readonly [Symbol.toStringTag]: string; | ||
} | ||
export const IPromise: PromiseConstructor; | ||
} | ||
declare module '@qiwi/substrate-types/target/es5/IHttpClient' { | ||
import { IPromise } from '@qiwi/substrate-types/target/es5/IPromise'; | ||
export const enum HttpMethod { | ||
GET = "GET", | ||
DELETE = "DELETE", | ||
HEAD = "HEAD", | ||
OPTIONS = "OPTIONS", | ||
POST = "POST", | ||
PUT = "PUT", | ||
PATCH = "PATCH" | ||
} | ||
export type IHttpRequestProvider = IFetch | IHttpClient; | ||
export type IHttpHeaders = Record<string, any>; | ||
export interface IHttpResponse<D = any> { | ||
status: number; | ||
statusText: string; | ||
headers: IHttpHeaders; | ||
data: D; | ||
} | ||
export interface IFetchResponse<D = any> { | ||
status: number; | ||
statusText: string; | ||
headers: any; | ||
json(): IPromise<D>; | ||
body: any; | ||
} | ||
interface IHttpRequest { | ||
url?: string; | ||
method?: HttpMethod; | ||
headers?: IHttpHeaders; | ||
params?: any; | ||
body?: any; | ||
data?: any; | ||
} | ||
export interface IFetch<Req extends IHttpRequest = IHttpRequest, Res extends IFetchResponse = IFetchResponse> { | ||
<D = any>(url: string, req?: Req): IPromise<Omit<Res, 'json'> & IFetchResponse<D>>; | ||
} | ||
export interface IHttpReqPerform<Req = IHttpRequest, Res = IHttpResponse> { | ||
<D = any>(url: string, body?: any, req?: Req): IPromise<Omit<Res, 'data'> & IHttpResponse<D>>; | ||
<D = any>(url: string, req?: Req): IPromise<Omit<Res, 'data'> & IHttpResponse<D>>; | ||
} | ||
export interface IHttpClient<Req extends IHttpRequest = IHttpRequest, Res extends IHttpResponse = IHttpResponse> { | ||
<D = any>(req: Req): IPromise<Omit<Res, 'data'> & IHttpResponse<D>>; | ||
<D = any>(url: string, req?: Req): IPromise<Omit<Res, 'data'> & IHttpResponse<D>>; | ||
get: IHttpReqPerform<Req, Res>; | ||
post: IHttpReqPerform<Req, Res>; | ||
put: IHttpReqPerform<Req, Res>; | ||
patch: IHttpReqPerform<Req, Res>; | ||
head: IHttpReqPerform<Req, Res>; | ||
delete: IHttpReqPerform<Req, Res>; | ||
options: IHttpReqPerform<Req, Res>; | ||
} | ||
export {}; | ||
} | ||
declare module '@qiwi/substrate-types/target/es5/IIterable' { | ||
@@ -194,22 +268,2 @@ /** @qiwi/substrate-types */ | ||
} | ||
declare module '@qiwi/substrate-types/target/es5/IPromise' { | ||
/** @qiwi/substrate-types */ | ||
/** */ | ||
import { IConstructor } from '@qiwi/substrate-types/target/es5/IConstructor'; | ||
export type TPromiseExecutor<TValue = any, TReason = any> = (resolve: (value: TValue) => void, reject: (reason: TReason) => void) => void; | ||
export interface IPromiseConstructor<TValue = any, TReason = any> extends IConstructor<IPromise<TValue, TReason>> { | ||
new (executor: TPromiseExecutor<TValue>): IPromise<TValue, TReason>; | ||
all: (values: Iterable<IPromise<TValue, TReason>>) => IPromise<TValue[], TReason>; | ||
race: (values: Iterable<IPromise<TValue, TReason>>) => IPromise<TValue, TReason>; | ||
reject: (reason?: TReason) => IPromise<TValue, TReason>; | ||
resolve: (value?: TValue) => IPromise<TValue, TReason>; | ||
} | ||
export interface IPromise<TValue = any, TReason = any> { | ||
then: (onSuccess?: (value: TValue) => any, onReject?: (reason: TReason) => any) => IPromise; | ||
catch: (onReject: (reason: TReason) => any) => IPromise; | ||
finally: (onFinally: () => any) => IPromise; | ||
readonly [Symbol.toStringTag]: string; | ||
} | ||
export const IPromise: PromiseConstructor; | ||
} | ||
declare module '@qiwi/substrate-types/target/es5/IStorage' { | ||
@@ -276,2 +330,3 @@ /** @qiwi/substrate-types */ | ||
export { IPool, IPooledObject, IPooledObjectFactory, IPooledObjectStatus } from '@qiwi/substrate-types/target/es5/IPool'; | ||
export { IHttpClient, IFetch, IHttpRequestProvider, HttpMethod } from '@qiwi/substrate-types/target/es5/IHttpClient'; | ||
} | ||
@@ -332,2 +387,3 @@ declare module '@qiwi/substrate-types/target/es5/IPool' { | ||
export { IPool as Pool, IPooledObject as PooledObject, IPooledObjectFactory as PooledObjectFactory, IPooledObjectStatus as PooledObjectStatus } from '@qiwi/substrate-types/target/es5/IPool'; | ||
export { IHttpClient as HttpClient, IFetch as Fetch, IHttpRequestProvider as HttpRequestProvider, HttpMethod } from '@qiwi/substrate-types/target/es5/IHttpClient'; | ||
} | ||
@@ -334,0 +390,0 @@ declare module '@qiwi/substrate-types/target/es5/helpers' { |
@@ -126,2 +126,107 @@ /** | ||
declare module "@qiwi/substrate-types/target/es5/IPromise" { | ||
import type { IConstructor } from "@qiwi/substrate-types/target/es5/IConstructor"; | ||
declare export type TPromiseExecutor<TValue = any, TReason = any> = ( | ||
resolve: (value: TValue) => void, | ||
reject: (reason: TReason) => void | ||
) => void; | ||
declare export type IPromiseConstructor<TValue = any, TReason = any> = { | ||
new(executor: TPromiseExecutor<TValue>): IPromise<TValue, TReason>, | ||
all: ( | ||
values: Iterable<IPromise<TValue, TReason>> | ||
) => IPromise<TValue[], TReason>, | ||
race: ( | ||
values: Iterable<IPromise<TValue, TReason>> | ||
) => IPromise<TValue, TReason>, | ||
reject: (reason?: TReason) => IPromise<TValue, TReason>, | ||
resolve: (value?: TValue) => IPromise<TValue, TReason>, | ||
... | ||
} & IConstructor<IPromise<TValue, TReason>>; | ||
declare export interface IPromise<TValue = any, TReason = any> { | ||
then: ( | ||
onSuccess?: (value: TValue) => any, | ||
onReject?: (reason: TReason) => any | ||
) => IPromise<>; | ||
catch: (onReject: (reason: TReason) => any) => IPromise<>; | ||
finally: (onFinally: () => any) => IPromise<>; | ||
+[typeof Symbol.toStringTag]: string; | ||
} | ||
declare export var IPromise: PromiseConstructor; | ||
} | ||
declare module "@qiwi/substrate-types/target/es5/IHttpClient" { | ||
import type { IPromise } from "@qiwi/substrate-types/target/es5/IPromise"; | ||
declare export var HttpMethod: {| | ||
+GET: "GET", // "GET" | ||
+DELETE: "DELETE", // "DELETE" | ||
+HEAD: "HEAD", // "HEAD" | ||
+OPTIONS: "OPTIONS", // "OPTIONS" | ||
+POST: "POST", // "POST" | ||
+PUT: "PUT", // "PUT" | ||
+PATCH: "PATCH" // "PATCH" | ||
|}; | ||
declare export type IHttpRequestProvider = IFetch<> | IHttpClient<>; | ||
declare export type IHttpHeaders = { [key: string]: any, ... }; | ||
declare export interface IHttpResponse<D = any> { | ||
status: number; | ||
statusText: string; | ||
headers: IHttpHeaders; | ||
data: D; | ||
} | ||
declare export interface IFetchResponse<D = any> { | ||
status: number; | ||
statusText: string; | ||
headers: any; | ||
json(): IPromise<D>; | ||
body: any; | ||
} | ||
declare interface IHttpRequest { | ||
url?: string; | ||
method?: $Values<typeof HttpMethod>; | ||
headers?: IHttpHeaders; | ||
params?: any; | ||
body?: any; | ||
data?: any; | ||
} | ||
declare export interface IFetch< | ||
Req: IHttpRequest = IHttpRequest, | ||
Res: IFetchResponse<> = IFetchResponse<> | ||
> { | ||
<D>( | ||
url: string, | ||
req?: Req | ||
): IPromise<Omit<Res, "json"> & IFetchResponse<D>>; | ||
} | ||
declare export interface IHttpReqPerform< | ||
Req = IHttpRequest, | ||
Res = IHttpResponse<> | ||
> { | ||
<D>( | ||
url: string, | ||
body?: any, | ||
req?: Req | ||
): IPromise<Omit<Res, "data"> & IHttpResponse<D>>; | ||
<D>(url: string, req?: Req): IPromise<Omit<Res, "data"> & IHttpResponse<D>>; | ||
} | ||
declare export interface IHttpClient< | ||
Req: IHttpRequest = IHttpRequest, | ||
Res: IHttpResponse<> = IHttpResponse<> | ||
> { | ||
<D>(req: Req): IPromise<Omit<Res, "data"> & IHttpResponse<D>>; | ||
<D>(url: string, req?: Req): IPromise<Omit<Res, "data"> & IHttpResponse<D>>; | ||
get: IHttpReqPerform<Req, Res>; | ||
post: IHttpReqPerform<Req, Res>; | ||
put: IHttpReqPerform<Req, Res>; | ||
patch: IHttpReqPerform<Req, Res>; | ||
head: IHttpReqPerform<Req, Res>; | ||
delete: IHttpReqPerform<Req, Res>; | ||
options: IHttpReqPerform<Req, Res>; | ||
} | ||
declare export {}; | ||
} | ||
declare module "@qiwi/substrate-types/target/es5/IIterable" { | ||
@@ -300,34 +405,2 @@ /** | ||
declare module "@qiwi/substrate-types/target/es5/IPromise" { | ||
import type { IConstructor } from "@qiwi/substrate-types/target/es5/IConstructor"; | ||
declare export type TPromiseExecutor<TValue = any, TReason = any> = ( | ||
resolve: (value: TValue) => void, | ||
reject: (reason: TReason) => void | ||
) => void; | ||
declare export type IPromiseConstructor<TValue = any, TReason = any> = { | ||
new(executor: TPromiseExecutor<TValue>): IPromise<TValue, TReason>, | ||
all: ( | ||
values: Iterable<IPromise<TValue, TReason>> | ||
) => IPromise<TValue[], TReason>, | ||
race: ( | ||
values: Iterable<IPromise<TValue, TReason>> | ||
) => IPromise<TValue, TReason>, | ||
reject: (reason?: TReason) => IPromise<TValue, TReason>, | ||
resolve: (value?: TValue) => IPromise<TValue, TReason>, | ||
... | ||
} & IConstructor<IPromise<TValue, TReason>>; | ||
declare export interface IPromise<TValue = any, TReason = any> { | ||
then: ( | ||
onSuccess?: (value: TValue) => any, | ||
onReject?: (reason: TReason) => any | ||
) => IPromise<>; | ||
catch: (onReject: (reason: TReason) => any) => IPromise<>; | ||
finally: (onFinally: () => any) => IPromise<>; | ||
+[typeof Symbol.toStringTag]: string; | ||
} | ||
declare export var IPromise: PromiseConstructor; | ||
} | ||
declare module "@qiwi/substrate-types/target/es5/IStorage" { | ||
@@ -451,2 +524,9 @@ /** | ||
} from "@qiwi/substrate-types/target/es5/IPool"; | ||
declare export { | ||
IHttpClient, | ||
IFetch, | ||
IHttpRequestProvider, | ||
HttpMethod | ||
} from "@qiwi/substrate-types/target/es5/IHttpClient"; | ||
} | ||
@@ -552,2 +632,9 @@ | ||
} from "@qiwi/substrate-types/target/es5/IPool"; | ||
declare export { | ||
IHttpClient as HttpClient, | ||
IFetch as Fetch, | ||
IHttpRequestProvider as HttpRequestProvider, | ||
HttpMethod | ||
} from "@qiwi/substrate-types/target/es5/IHttpClient"; | ||
} | ||
@@ -554,0 +641,0 @@ |
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
106243
194
2284
26