@apollo/datasource-rest
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -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
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
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
103389
1552
1