@platform/http.types
Advanced tools
Comparing version 0.2.42 to 0.2.48
import { t, Observable } from './common'; | ||
export declare type HttpCors = 'cors' | 'no-cors' | 'same-origin'; | ||
export declare type HttpCreate = (options?: IHttpCreateOptions) => IHttp; | ||
export declare type IHttpCreateOptions = IHttpOptions & { | ||
export declare type HttpCreate = (options?: HttpCreateOptions) => Http; | ||
export declare type HttpCreateOptions = HttpOptions & { | ||
fetch?: t.HttpFetch; | ||
}; | ||
export declare type IHttpOptions = { | ||
headers?: t.IHttpHeaders; | ||
export declare type HttpOptions = { | ||
headers?: t.HttpHeaders; | ||
mode?: HttpCors; | ||
}; | ||
export declare type IHttp = IHttpMethods & { | ||
export declare type Http = HttpMethods & { | ||
create: HttpCreate; | ||
headers: t.IHttpHeaders; | ||
headers: t.HttpHeaders; | ||
events$: Observable<t.HttpEvent>; | ||
before$: Observable<t.IHttpBefore>; | ||
after$: Observable<t.IHttpAfter>; | ||
before$: Observable<t.HttpBefore>; | ||
after$: Observable<t.HttpAfter>; | ||
}; | ||
export declare type IHttpMethods = { | ||
head(url: string, options?: IHttpOptions): Promise<t.IHttpResponse>; | ||
get(url: string, options?: IHttpOptions): Promise<t.IHttpResponse>; | ||
put(url: string, data?: any, options?: IHttpOptions): Promise<t.IHttpResponse>; | ||
post(url: string, data?: any, options?: IHttpOptions): Promise<t.IHttpResponse>; | ||
patch(url: string, data?: any, options?: IHttpOptions): Promise<t.IHttpResponse>; | ||
delete(url: string, data?: any, options?: IHttpOptions): Promise<t.IHttpResponse>; | ||
export declare type HttpMethods = { | ||
head(url: string, options?: HttpOptions): Promise<t.HttpResponse>; | ||
get(url: string, options?: HttpOptions): Promise<t.HttpResponse>; | ||
put(url: string, data?: any, options?: HttpOptions): Promise<t.HttpResponse>; | ||
post(url: string, data?: any, options?: HttpOptions): Promise<t.HttpResponse>; | ||
patch(url: string, data?: any, options?: HttpOptions): Promise<t.HttpResponse>; | ||
delete(url: string, data?: any, options?: HttpOptions): Promise<t.HttpResponse>; | ||
}; |
@@ -5,5 +5,6 @@ export * from './types.client'; | ||
export * from './types.payload'; | ||
export * from './types.auth'; | ||
export declare type HttpMethod = 'HEAD' | 'GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH' | 'OPTIONS'; | ||
export declare type IHttpHeaders = { | ||
export declare type HttpHeaders = { | ||
[key: string]: string; | ||
}; |
import { t, IDuration } from './common'; | ||
export declare type HttpRespondInput = t.IHttpRespondPayload | (() => t.IHttpRespondPayload) | (() => Promise<t.IHttpRespondPayload>); | ||
export declare type IHttpModify = { | ||
export declare type HttpRespondInput = t.HttpRespondPayload | (() => t.HttpRespondPayload) | (() => Promise<t.HttpRespondPayload>); | ||
export declare type HttpModify = { | ||
header(key: string, value: string): void; | ||
headers: { | ||
merge(headers: t.IHttpHeaders): void; | ||
replace(headers: t.IHttpHeaders): void; | ||
merge(headers: t.HttpHeaders): void; | ||
replace(headers: t.HttpHeaders): void; | ||
}; | ||
}; | ||
export declare type HttpEvent = IHttpBeforeEvent | IHttpAfterEvent; | ||
export declare type IHttpBeforeEvent = { | ||
export declare type HttpEvent = HttpBeforeEvent | HttpAfterEvent; | ||
export declare type HttpBeforeEvent = { | ||
type: 'HTTP/before'; | ||
payload: IHttpBefore; | ||
payload: HttpBefore; | ||
}; | ||
export declare type IHttpBefore = { | ||
export declare type HttpBefore = { | ||
uid: string; | ||
@@ -20,12 +20,12 @@ method: t.HttpMethod; | ||
data?: any; | ||
headers: t.IHttpHeaders; | ||
headers: t.HttpHeaders; | ||
isModified: boolean; | ||
modify: t.IHttpModify; | ||
modify: t.HttpModify; | ||
respond(payload: HttpRespondInput): void; | ||
}; | ||
export declare type IHttpAfterEvent = { | ||
export declare type HttpAfterEvent = { | ||
type: 'HTTP/after'; | ||
payload: IHttpAfter; | ||
payload: HttpAfter; | ||
}; | ||
export declare type IHttpAfter = { | ||
export declare type HttpAfter = { | ||
uid: string; | ||
@@ -36,4 +36,4 @@ method: t.HttpMethod; | ||
status: number; | ||
response: t.IHttpResponse; | ||
response: t.HttpResponse; | ||
elapsed: IDuration; | ||
}; |
import { t, Json } from './common'; | ||
export declare type HttpFetch = (req: t.IHttpRequestPayload) => Promise<t.IHttpFetchResponse>; | ||
export declare type IHttpFetchResponse = { | ||
export declare type HttpFetch = (req: t.HttpRequestPayload) => Promise<t.HttpFetchResponse>; | ||
export declare type HttpFetchResponse = { | ||
status: number; | ||
@@ -5,0 +5,0 @@ statusText?: string; |
@@ -8,1 +8,2 @@ "use strict"; | ||
tslib_1.__exportStar(require("./types.payload"), exports); | ||
tslib_1.__exportStar(require("./types.auth"), exports); |
import { t, Json } from './common'; | ||
export declare type IHttpRequestPayload = { | ||
declare type O = Record<string, unknown>; | ||
export declare type HttpRequestPayload = { | ||
url: string; | ||
method: t.HttpMethod; | ||
mode?: t.HttpCors; | ||
headers?: t.IHttpHeaders; | ||
data?: Record<string, unknown> | string; | ||
headers?: t.HttpHeaders; | ||
data?: O | string; | ||
}; | ||
export declare type IHttpResponse = { | ||
export declare type HttpResponse = { | ||
ok: boolean; | ||
status: number; | ||
statusText: string; | ||
headers: t.IHttpHeaders; | ||
contentType: IHttpContentType; | ||
headers: t.HttpHeaders; | ||
contentType: HttpContentType; | ||
body?: ReadableStream<Uint8Array>; | ||
@@ -19,16 +20,18 @@ text: string; | ||
}; | ||
export declare type IHttpContentType = { | ||
export declare type HttpContentType = { | ||
mime: string; | ||
is: { | ||
json: boolean; | ||
text: boolean; | ||
binary: boolean; | ||
}; | ||
is: HttpContentTypeIs; | ||
toString(): string; | ||
}; | ||
export declare type IHttpRespondPayload = { | ||
export declare type HttpContentTypeIs = { | ||
json: boolean; | ||
text: boolean; | ||
binary: boolean; | ||
}; | ||
export declare type HttpRespondPayload = { | ||
status: number; | ||
statusText?: string; | ||
headers?: t.IHttpHeaders; | ||
data?: ReadableStream<Uint8Array> | Record<string, unknown> | string; | ||
headers?: t.HttpHeaders; | ||
data?: ReadableStream<Uint8Array> | O | string; | ||
}; | ||
export {}; |
{ | ||
"name": "@platform/http.types", | ||
"version": "0.2.42", | ||
"version": "0.2.48", | ||
"description": "Types for the @platform/http library.", | ||
@@ -15,8 +15,8 @@ "main": "lib/index", | ||
"dependencies": { | ||
"@platform/libs": "0.2.10", | ||
"@platform/types": "0.5.21" | ||
"@platform/libs": "0.2.11", | ||
"@platform/types": "0.5.22" | ||
}, | ||
"devDependencies": { | ||
"@platform/test": "0.2.6", | ||
"@platform/ts": "4.1.13" | ||
"@platform/test": "0.2.7", | ||
"@platform/ts": "4.1.19" | ||
}, | ||
@@ -23,0 +23,0 @@ "files": [ |
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
6696
18
157
+ Added@platform/libs@0.2.11(transitive)
+ Added@platform/types@0.5.22(transitive)
+ Added@types/ramda@0.27.44(transitive)
+ Addedrxjs@7.2.0(transitive)
- Removed@platform/libs@0.2.10(transitive)
- Removed@platform/types@0.5.21(transitive)
- Removed@types/ramda@0.27.40(transitive)
- Removedrxjs@7.0.0-rc.3(transitive)
Updated@platform/libs@0.2.11
Updated@platform/types@0.5.22