Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@platform/http.types

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platform/http.types - npm Package Compare versions

Comparing version 0.1.12 to 0.2.0

lib/common.d.ts

91

lib/types.d.ts

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc