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

@apollo/datasource-rest

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/datasource-rest - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export { RESTDataSource, RequestOptions, AugmentedRequest, } from './RESTDataSource';
export { RESTDataSource, RequestOptions, AugmentedRequest, DataSourceFetchResult, DataSourceConfig, GetRequest, PatchRequest, PostRequest, PutRequest, DeleteRequest, HeadRequest, RequestWithoutBody, RequestWithBody, DataSourceRequest, } from './RESTDataSource';
//# sourceMappingURL=index.d.ts.map

@@ -23,8 +23,20 @@ /// <reference types="node" />

}
export type RequestWithoutBody = HeadRequest | GetRequest;
export interface RequestWithBody extends Omit<RequestOptions, 'body'> {
method?: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
interface WithBody extends Omit<RequestOptions, 'body'> {
body?: FetcherRequestInit['body'] | object;
}
type DataSourceRequest = RequestWithoutBody | RequestWithBody;
export interface PostRequest extends WithBody {
method?: 'POST';
}
export interface PutRequest extends WithBody {
method?: 'PUT';
}
export interface PatchRequest extends WithBody {
method?: 'PATCH';
}
export interface DeleteRequest extends WithBody {
method?: 'DELETE';
}
export type RequestWithoutBody = HeadRequest | GetRequest;
export type RequestWithBody = PostRequest | PutRequest | PatchRequest | DeleteRequest;
export type DataSourceRequest = RequestWithoutBody | RequestWithBody;
export type AugmentedRequest = (Omit<WithRequired<RequestWithoutBody, 'headers'>, 'params'> | Omit<WithRequired<RequestWithBody, 'headers'>, 'params'>) & {

@@ -92,6 +104,6 @@ params: URLSearchParams;

protected get<TResult = any>(path: string, request?: GetRequest): Promise<TResult>;
protected post<TResult = any>(path: string, request?: RequestWithBody): Promise<TResult>;
protected patch<TResult = any>(path: string, request?: RequestWithBody): Promise<TResult>;
protected put<TResult = any>(path: string, request?: RequestWithBody): Promise<TResult>;
protected delete<TResult = any>(path: string, request?: RequestWithBody): Promise<TResult>;
protected post<TResult = any>(path: string, request?: PostRequest): Promise<TResult>;
protected patch<TResult = any>(path: string, request?: PatchRequest): Promise<TResult>;
protected put<TResult = any>(path: string, request?: PutRequest): Promise<TResult>;
protected delete<TResult = any>(path: string, request?: DeleteRequest): Promise<TResult>;
private urlSearchParamsFromRecord;

@@ -98,0 +110,0 @@ fetch<TResult>(path: string, incomingRequest?: DataSourceRequest): Promise<DataSourceFetchResult<TResult>>;

{
"name": "@apollo/datasource-rest",
"description": "REST DataSource for Apollo Server v4",
"version": "5.0.0",
"version": "5.0.1",
"author": "Apollo <packages@apollographql.com>",

@@ -23,3 +23,2 @@ "license": "MIT",

"clean": "git clean -dfqX",
"install-with-npm-8.5": "npm i -g npm@^8.5.0 && npm i",
"prepack": "npm run build",

@@ -26,0 +25,0 @@ "prettier-check": "prettier --check .",

@@ -5,2 +5,13 @@ export {

AugmentedRequest,
DataSourceFetchResult,
DataSourceConfig,
GetRequest,
PatchRequest,
PostRequest,
PutRequest,
DeleteRequest,
HeadRequest,
RequestWithoutBody,
RequestWithBody,
DataSourceRequest,
} from './RESTDataSource';

@@ -63,11 +63,32 @@ import type {

export type RequestWithoutBody = HeadRequest | GetRequest;
export interface RequestWithBody extends Omit<RequestOptions, 'body'> {
method?: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
interface WithBody extends Omit<RequestOptions, 'body'> {
body?: FetcherRequestInit['body'] | object;
}
type DataSourceRequest = RequestWithoutBody | RequestWithBody;
export interface PostRequest extends WithBody {
method?: 'POST';
}
export interface PutRequest extends WithBody {
method?: 'PUT';
}
export interface PatchRequest extends WithBody {
method?: 'PATCH';
}
export interface DeleteRequest extends WithBody {
method?: 'DELETE';
}
export type RequestWithoutBody = HeadRequest | GetRequest;
export type RequestWithBody =
| PostRequest
| PutRequest
| PatchRequest
| DeleteRequest;
export type DataSourceRequest = RequestWithoutBody | RequestWithBody;
// While tempting, this union can't be reduced / factored out to just

@@ -370,3 +391,3 @@ // Omit<WithRequired<RequestWithBody | RequestWithBody, 'headers'>, 'params'> & { params: URLSearchParams }

path: string,
request?: RequestWithBody,
request?: PostRequest,
): Promise<TResult> {

@@ -383,3 +404,3 @@ return (

path: string,
request?: RequestWithBody,
request?: PatchRequest,
): Promise<TResult> {

@@ -396,3 +417,3 @@ return (

path: string,
request?: RequestWithBody,
request?: PutRequest,
): Promise<TResult> {

@@ -409,3 +430,3 @@ return (

path: string,
request?: RequestWithBody,
request?: DeleteRequest,
): Promise<TResult> {

@@ -412,0 +433,0 @@ return (

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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