Skip to content

Commit

Permalink
Replace request with isomorphic-unfetch
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Kim <[email protected]>
  • Loading branch information
JsonKim committed Apr 26, 2020
1 parent 743c66b commit 2e98a77
Show file tree
Hide file tree
Showing 9 changed files with 283 additions and 228 deletions.
2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/index.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions packages/openapi-to-graphql/lib/resolver_builder.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ConnectOptions } from './types/options';
import { ConnectOptions, RequestOptions } from './types/options';
import { Operation } from './types/operation';
import { ResolveFunction, SubscriptionIterator } from './types/graphql';
import { PreprocessingData } from './types/preprocessing_data';
import * as NodeRequest from 'request';
declare type GetResolverParams = {
operation: Operation;
argsFromLink?: {
Expand All @@ -12,7 +11,7 @@ declare type GetResolverParams = {
responseName?: string;
data: PreprocessingData;
baseUrl?: string;
requestOptions?: NodeRequest.OptionsWithUrl;
requestOptions?: RequestOptions;
};
declare type GetSubscribeParams = {
operation: Operation;
Expand Down
61 changes: 43 additions & 18 deletions packages/openapi-to-graphql/lib/resolver_builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/resolver_builder.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions packages/openapi-to-graphql/lib/types/options.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as NodeRequest from 'request';
import { ResolveFunction, ResolveObject, GraphQLOperationType } from './graphql';
/**
* Type definition of the options that users can pass to OpenAPI-to-GraphQL.
Expand All @@ -19,6 +18,9 @@ export declare type Report = {
numMutationsCreated: number;
numSubscriptionsCreated: number;
};
export declare type RequestOptions = {
[key: string]: any;
};
export declare type ConnectOptions = {
[key: string]: boolean | number | string;
};
Expand Down Expand Up @@ -126,7 +128,7 @@ export declare type Options = {
* calls to the API backend.
* e.g. Setup the web proxy to use.
*/
requestOptions?: NodeRequest.OptionsWithUrl;
requestOptions?: RequestOptions;
/**
* Allows to override or add options to the PubSub connect object used to make
* publish/subscribe to the API backend.
Expand Down Expand Up @@ -329,7 +331,7 @@ export declare type InternalOptions = {
* calls to the API backend.
* e.g. Setup the web proxy to use.
*/
requestOptions?: NodeRequest.OptionsWithUrl;
requestOptions?: RequestOptions;
/**
* Allows to override or add options to the PubSub connect object used to make
* publish/subscribe to the API backend.
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
"form-urlencoded": "^4.1.1",
"graphql-subscriptions": "^1.1.0",
"graphql-type-json": "^0.2.1",
"isomorphic-unfetch": "^3.0.0",
"jsonpath-plus": "^3.0.0",
"oas-validator": "^3.1.0",
"pluralize": "^8.0.0",
"request": "^2.88.0",
"swagger2openapi": "^5.1.0"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/openapi-to-graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
Options,
InternalOptions,
Report,
RequestOptions,
ConnectOptions
} from './types/options'
import { Oas3, CallbackObject } from './types/oas3'
Expand All @@ -43,7 +44,6 @@ import { Args, Field, GraphQLOperationType } from './types/graphql'
import { Operation } from './types/operation'
import { PreprocessingData } from './types/preprocessing_data'
import { GraphQLSchema, GraphQLObjectType } from 'graphql'
import * as NodeRequest from 'request'

// Imports:
import { getGraphQLType, getArgs } from './schema_builder'
Expand Down Expand Up @@ -600,7 +600,7 @@ function getFieldForOperation(
operation: Operation,
baseUrl: string,
data: PreprocessingData,
requestOptions: NodeRequest.OptionsWithUrl,
requestOptions: RequestOptions,
connectOptions: ConnectOptions
): Field {
// Create GraphQL Type for response:
Expand Down
Loading

0 comments on commit 2e98a77

Please sign in to comment.