Skip to content

Commit 2e98a77

Browse files
committed
Replace request with isomorphic-unfetch
Signed-off-by: Jason Kim <[email protected]>
1 parent 743c66b commit 2e98a77

File tree

9 files changed

+283
-228
lines changed

9 files changed

+283
-228
lines changed

packages/openapi-to-graphql/lib/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openapi-to-graphql/lib/resolver_builder.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { ConnectOptions } from './types/options';
1+
import { ConnectOptions, RequestOptions } from './types/options';
22
import { Operation } from './types/operation';
33
import { ResolveFunction, SubscriptionIterator } from './types/graphql';
44
import { PreprocessingData } from './types/preprocessing_data';
5-
import * as NodeRequest from 'request';
65
declare type GetResolverParams = {
76
operation: Operation;
87
argsFromLink?: {
@@ -12,7 +11,7 @@ declare type GetResolverParams = {
1211
responseName?: string;
1312
data: PreprocessingData;
1413
baseUrl?: string;
15-
requestOptions?: NodeRequest.OptionsWithUrl;
14+
requestOptions?: RequestOptions;
1615
};
1716
declare type GetSubscribeParams = {
1817
operation: Operation;

packages/openapi-to-graphql/lib/resolver_builder.js

Lines changed: 43 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openapi-to-graphql/lib/resolver_builder.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/openapi-to-graphql/lib/types/options.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as NodeRequest from 'request';
21
import { ResolveFunction, ResolveObject, GraphQLOperationType } from './graphql';
32
/**
43
* Type definition of the options that users can pass to OpenAPI-to-GraphQL.
@@ -19,6 +18,9 @@ export declare type Report = {
1918
numMutationsCreated: number;
2019
numSubscriptionsCreated: number;
2120
};
21+
export declare type RequestOptions = {
22+
[key: string]: any;
23+
};
2224
export declare type ConnectOptions = {
2325
[key: string]: boolean | number | string;
2426
};
@@ -126,7 +128,7 @@ export declare type Options = {
126128
* calls to the API backend.
127129
* e.g. Setup the web proxy to use.
128130
*/
129-
requestOptions?: NodeRequest.OptionsWithUrl;
131+
requestOptions?: RequestOptions;
130132
/**
131133
* Allows to override or add options to the PubSub connect object used to make
132134
* publish/subscribe to the API backend.
@@ -329,7 +331,7 @@ export declare type InternalOptions = {
329331
* calls to the API backend.
330332
* e.g. Setup the web proxy to use.
331333
*/
332-
requestOptions?: NodeRequest.OptionsWithUrl;
334+
requestOptions?: RequestOptions;
333335
/**
334336
* Allows to override or add options to the PubSub connect object used to make
335337
* publish/subscribe to the API backend.

packages/openapi-to-graphql/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
"form-urlencoded": "^4.1.1",
7272
"graphql-subscriptions": "^1.1.0",
7373
"graphql-type-json": "^0.2.1",
74+
"isomorphic-unfetch": "^3.0.0",
7475
"jsonpath-plus": "^3.0.0",
7576
"oas-validator": "^3.1.0",
7677
"pluralize": "^8.0.0",
77-
"request": "^2.88.0",
7878
"swagger2openapi": "^5.1.0"
7979
},
8080
"peerDependencies": {

packages/openapi-to-graphql/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
Options,
3636
InternalOptions,
3737
Report,
38+
RequestOptions,
3839
ConnectOptions
3940
} from './types/options'
4041
import { Oas3, CallbackObject } from './types/oas3'
@@ -43,7 +44,6 @@ import { Args, Field, GraphQLOperationType } from './types/graphql'
4344
import { Operation } from './types/operation'
4445
import { PreprocessingData } from './types/preprocessing_data'
4546
import { GraphQLSchema, GraphQLObjectType } from 'graphql'
46-
import * as NodeRequest from 'request'
4747

4848
// Imports:
4949
import { getGraphQLType, getArgs } from './schema_builder'
@@ -600,7 +600,7 @@ function getFieldForOperation(
600600
operation: Operation,
601601
baseUrl: string,
602602
data: PreprocessingData,
603-
requestOptions: NodeRequest.OptionsWithUrl,
603+
requestOptions: RequestOptions,
604604
connectOptions: ConnectOptions
605605
): Field {
606606
// Create GraphQL Type for response:

0 commit comments

Comments
 (0)