🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@autometa/http

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@autometa/http - npm Package Compare versions

Comparing version
2.0.0-rc.1
to
2.0.0-rc.2
+25
-0
dist/http.d.ts

@@ -185,2 +185,10 @@ /// <reference types="node" />

/**
* Transforms the resolved response into another shape.
*
* The response has already been parsed and schema-validated before the
* transformer runs. This is a convenient way to project a response into
* a domain model while keeping type inference on the return value.
*/
transform<TResponse, TResult>(transformer: (response: HTTPResponse<TResponse>) => TResult | Promise<TResult>): HTTPTransformClient<TResponse, TResult>;
/**
* Sets a shared query parameter for all future requests.

@@ -302,1 +310,18 @@ */

}
declare class HTTPTransformClient<TResponse, TResult> {
private base;
private transform;
constructor(base: HTTP, transform: (response: HTTPResponse<TResponse>) => TResult | Promise<TResult>);
fetchWith(method: HTTPMethod | Lowercase<HTTPMethod>, options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
get(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
post(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
put(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
patch(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
delete(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
head(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
options(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
trace(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
connect(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
stream(options?: HTTPAdditionalOptions<unknown>): Promise<TResult>;
}
export {};

@@ -1129,2 +1129,12 @@ 'use strict';

}
/**
* Transforms the resolved response into another shape.
*
* The response has already been parsed and schema-validated before the
* transformer runs. This is a convenient way to project a response into
* a domain model while keeping type inference on the return value.
*/
transform(transformer) {
return new HTTPTransformClient(this, transformer);
}
sharedParam(name, value, ...rest) {

@@ -1523,2 +1533,52 @@ this.builder.param(name, toParamValue(value, rest));

var HTTP = _HTTP;
var HTTPTransformClient = class {
constructor(base, transform) {
this.base = base;
this.transform = transform;
}
async fetchWith(method, options) {
const response = await this.base.fetchWith(method, options);
return this.transform(response);
}
async get(options) {
const response = await this.base.get(options);
return this.transform(response);
}
async post(options) {
const response = await this.base.post(options);
return this.transform(response);
}
async put(options) {
const response = await this.base.put(options);
return this.transform(response);
}
async patch(options) {
const response = await this.base.patch(options);
return this.transform(response);
}
async delete(options) {
const response = await this.base.delete(options);
return this.transform(response);
}
async head(options) {
const response = await this.base.head(options);
return this.transform(response);
}
async options(options) {
const response = await this.base.options(options);
return this.transform(response);
}
async trace(options) {
const response = await this.base.trace(options);
return this.transform(response);
}
async connect(options) {
const response = await this.base.connect(options);
return this.transform(response);
}
async stream(options) {
const response = await this.base.stream(options);
return this.transform(response);
}
};
function mergeOptions2(base, overrides) {

@@ -1525,0 +1585,0 @@ if (!overrides) {

@@ -1127,2 +1127,12 @@ import { AutomationError } from '@autometa/errors';

}
/**
* Transforms the resolved response into another shape.
*
* The response has already been parsed and schema-validated before the
* transformer runs. This is a convenient way to project a response into
* a domain model while keeping type inference on the return value.
*/
transform(transformer) {
return new HTTPTransformClient(this, transformer);
}
sharedParam(name, value, ...rest) {

@@ -1521,2 +1531,52 @@ this.builder.param(name, toParamValue(value, rest));

var HTTP = _HTTP;
var HTTPTransformClient = class {
constructor(base, transform) {
this.base = base;
this.transform = transform;
}
async fetchWith(method, options) {
const response = await this.base.fetchWith(method, options);
return this.transform(response);
}
async get(options) {
const response = await this.base.get(options);
return this.transform(response);
}
async post(options) {
const response = await this.base.post(options);
return this.transform(response);
}
async put(options) {
const response = await this.base.put(options);
return this.transform(response);
}
async patch(options) {
const response = await this.base.patch(options);
return this.transform(response);
}
async delete(options) {
const response = await this.base.delete(options);
return this.transform(response);
}
async head(options) {
const response = await this.base.head(options);
return this.transform(response);
}
async options(options) {
const response = await this.base.options(options);
return this.transform(response);
}
async trace(options) {
const response = await this.base.trace(options);
return this.transform(response);
}
async connect(options) {
const response = await this.base.connect(options);
return this.transform(response);
}
async stream(options) {
const response = await this.base.stream(options);
return this.transform(response);
}
};
function mergeOptions2(base, overrides) {

@@ -1523,0 +1583,0 @@ if (!overrides) {

+5
-5
{
"name": "@autometa/http",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"description": "",

@@ -22,4 +22,4 @@ "type": "module",

"url-join-ts": "^1.0.5",
"@autometa/errors": "1.0.0-rc.1",
"@autometa/assertions": "1.0.0-rc.1",
"@autometa/errors": "1.0.0-rc.2",
"@autometa/assertions": "1.0.0-rc.2",
"@autometa/status-codes": "1.0.0-rc.1"

@@ -37,5 +37,5 @@ },

"vitest": "1.4.0",
"tsup-config": "0.1.0",
"tsconfig": "0.7.0",
"eslint-config-custom": "0.6.0",
"tsconfig": "0.7.0"
"tsup-config": "0.1.0"
},

@@ -42,0 +42,0 @@ "scripts": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display