@platform/http.types
Advanced tools
Comparing version 0.1.12 to 0.2.0
@@ -1,4 +0,5 @@ | ||
/// <reference types="node" /> | ||
import { Observable } from 'rxjs'; | ||
import { Json, IDuration } from '@platform/types'; | ||
export * from './types.client'; | ||
export * from './types.events'; | ||
export * from './types.req'; | ||
export * from './types.res'; | ||
export declare type HttpMethod = 'HEAD' | 'GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH' | 'OPTIONS'; | ||
@@ -8,85 +9,1 @@ export declare type IHttpHeaders = { | ||
}; | ||
export declare type IHttpResponse = { | ||
ok: boolean; | ||
status: number; | ||
statusText: string; | ||
headers: IHttpHeaders; | ||
contentType: IHttpContentType; | ||
body?: ReadableStream<Uint8Array>; | ||
text: string; | ||
json: Json; | ||
}; | ||
export declare type IHttpContentType = { | ||
value: string; | ||
is: { | ||
json: boolean; | ||
text: boolean; | ||
binary: boolean; | ||
}; | ||
}; | ||
export declare type HttpMode = 'cors' | 'no-cors' | 'same-origin'; | ||
export declare type HttpOptions = { | ||
headers?: IHttpHeaders; | ||
mode?: HttpMode; | ||
}; | ||
export declare type HttpCreate = (options?: HttpOptions) => IHttp; | ||
export declare type IHttp = IHttpMethods & { | ||
create: HttpCreate; | ||
headers: IHttpHeaders; | ||
events$: Observable<HttpEvent>; | ||
before$: Observable<IHttpBefore>; | ||
after$: Observable<IHttpAfter>; | ||
}; | ||
export declare type IHttpMethods = { | ||
head(url: string, options?: HttpOptions): Promise<IHttpResponse>; | ||
get(url: string, options?: HttpOptions): Promise<IHttpResponse>; | ||
put(url: string, data?: any, options?: HttpOptions): Promise<IHttpResponse>; | ||
post(url: string, data?: any, options?: HttpOptions): Promise<IHttpResponse>; | ||
patch(url: string, data?: any, options?: HttpOptions): Promise<IHttpResponse>; | ||
delete(url: string, data?: any, options?: HttpOptions): Promise<IHttpResponse>; | ||
}; | ||
export declare type HttpRespondMethod = (payload: HttpRespondMethodArg) => void; | ||
export declare type HttpRespondMethodArg = HttpRespondPayload | (() => HttpRespondPayload) | (() => Promise<HttpRespondPayload>); | ||
export declare type HttpRespondPayload = { | ||
status: number; | ||
statusText?: string; | ||
headers?: IHttpHeaders; | ||
data?: object; | ||
}; | ||
export declare type IHttpResponseLike = { | ||
ok: boolean; | ||
status: number; | ||
statusText: string; | ||
headers: Headers; | ||
body: ReadableStream<Uint8Array> | null; | ||
text(): Promise<string>; | ||
}; | ||
export declare type HttpEvent = IHttpBeforeEvent | IHttpAfterEvent; | ||
export declare type IHttpBeforeEvent = { | ||
type: 'HTTP/before'; | ||
payload: IHttpBefore; | ||
}; | ||
export declare type IHttpBefore = { | ||
eid: string; | ||
method: HttpMethod; | ||
url: string; | ||
data?: any; | ||
headers: IHttpHeaders; | ||
isModified: boolean; | ||
modify(args: { | ||
data?: any | Buffer; | ||
headers?: IHttpHeaders; | ||
}): void; | ||
respond: HttpRespondMethod; | ||
}; | ||
export declare type IHttpAfterEvent = { | ||
type: 'HTTP/after'; | ||
payload: IHttpAfter; | ||
}; | ||
export declare type IHttpAfter = { | ||
eid: string; | ||
method: HttpMethod; | ||
url: string; | ||
response: IHttpResponse; | ||
elapsed: IDuration; | ||
}; |
{ | ||
"name": "@platform/http.types", | ||
"version": "0.1.12", | ||
"version": "0.2.0", | ||
"description": "Types for the @platform/http library.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
5513
23
126
1