replace whatwg-node/fetch with native fetch (#4110)

This commit is contained in:
Dotan Simha 2024-02-28 20:27:22 +02:00 committed by GitHub
parent 9a7cacea4c
commit b186496961
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 0 additions and 63 deletions

View file

@ -36,7 +36,6 @@
"@types/lodash": "4.14.202",
"@types/ms": "0.7.34",
"@types/object-hash": "3.0.6",
"@whatwg-node/fetch": "0.9.16",
"agentkeepalive": "4.5.0",
"bcryptjs": "2.4.3",
"dataloader": "2.2.2",

View file

@ -1,7 +1,6 @@
import { CONTEXT, Inject, Injectable, Scope } from 'graphql-modules';
import type { WebhooksApi } from '@hive/webhooks';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { HttpClient } from '../../../shared/providers/http-client';
import { Logger } from '../../../shared/providers/logger';
import type { WebhooksConfig } from '../tokens';

View file

@ -1,7 +1,6 @@
import { Inject, Injectable, Scope } from 'graphql-modules';
import type { StripeBillingApi, StripeBillingApiInput } from '@hive/stripe-billing';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { OrganizationSelector } from '../../../__generated__/types';
import { OrganizationBilling } from '../../../shared/entities';
import { Logger } from '../../shared/providers/logger';

View file

@ -2,7 +2,6 @@ import bcryptjs from 'bcryptjs';
import { Inject, Injectable, Scope } from 'graphql-modules';
import { z } from 'zod';
import { encodeCdnToken, generatePrivateKey } from '@hive/cdn-script/cdn-token';
import { crypto } from '@whatwg-node/fetch';
import { HiveError } from '../../../shared/errors';
import { isUUID } from '../../../shared/is-uuid';
import { AuthManager } from '../../auth/providers/auth-manager';

View file

@ -1,7 +1,6 @@
import { Inject, Injectable, Scope } from 'graphql-modules';
import type { AvailableRulesResponse, SchemaPolicyApi, SchemaPolicyApiInput } from '@hive/policy';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { sentry } from '../../../shared/sentry';
import { Logger } from '../../shared/providers/logger';
import type { SchemaPolicyServiceConfig } from './tokens';

View file

@ -1,7 +1,6 @@
import { Inject, Injectable, Scope } from 'graphql-modules';
import type { RateLimitApi, RateLimitApiInput } from '@hive/rate-limit';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { sentry } from '../../../shared/sentry';
import { Logger } from '../../shared/providers/logger';
import type { RateLimitServiceConfig } from './tokens';

View file

@ -1,7 +1,6 @@
import { CONTEXT, Inject, Injectable, Scope } from 'graphql-modules';
import type { ContractsInputType, SchemaBuilderApi } from '@hive/schema';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { Orchestrator, Project, ProjectType, SchemaObject } from '../../../../shared/entities';
import { sentry } from '../../../../shared/sentry';
import { Logger } from '../../../shared/providers/logger';

View file

@ -1,7 +1,6 @@
import { CONTEXT, Inject, Injectable, Scope } from 'graphql-modules';
import type { SchemaBuilderApi } from '@hive/schema';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { Orchestrator, ProjectType, SchemaObject } from '../../../../shared/entities';
import { sentry } from '../../../../shared/sentry';
import { Logger } from '../../../shared/providers/logger';

View file

@ -1,7 +1,6 @@
import { CONTEXT, Inject, Injectable, Scope } from 'graphql-modules';
import type { SchemaBuilderApi } from '@hive/schema';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { Orchestrator, ProjectType, SchemaObject } from '../../../../shared/entities';
import { sentry } from '../../../../shared/sentry';
import { Logger } from '../../../shared/providers/logger';

View file

@ -1,7 +1,6 @@
import { Inject, Injectable, InjectionToken, Optional } from 'graphql-modules';
import type { EmailsApi } from '@hive/emails';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
export const EMAILS_ENDPOINT = new InjectionToken<string>('EMAILS_ENDPOINT');

View file

@ -1,7 +1,6 @@
import { CONTEXT, Inject, Injectable, Scope } from 'graphql-modules';
import type { TokensApi } from '@hive/tokens';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import type { Token } from '../../../shared/entities';
import { HiveError } from '../../../shared/errors';
import { atomic } from '../../../shared/helpers';

View file

@ -1,7 +1,6 @@
import { Inject, Injectable, Scope } from 'graphql-modules';
import type { UsageEstimatorApi, UsageEstimatorApiInput } from '@hive/usage-estimator';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { sentry } from '../../../shared/sentry';
import { Logger } from '../../shared/providers/logger';
import type { UsageEstimationServiceConfig } from './tokens';

View file

@ -17,7 +17,6 @@
"@types/mjml": "4.7.1",
"@types/nodemailer": "6.4.14",
"@types/sendmail": "1.4.7",
"@whatwg-node/fetch": "0.9.16",
"bullmq": "5.3.3",
"copyfiles": "2.4.1",
"dotenv": "16.4.5",

View file

@ -1,6 +1,5 @@
import nodemailer from 'nodemailer';
import sm from 'sendmail';
import { fetch } from '@whatwg-node/fetch';
import type {
EmailProviderConfig,
MockEmailProviderConfig,

View file

@ -11,7 +11,6 @@
"@apollo/composition": "2.7.1",
"@apollo/federation-internals": "2.7.1",
"@graphql-hive/external-composition": "workspace:*",
"@whatwg-node/fetch": "0.9.16",
"@whatwg-node/server": "0.9.25",
"graphql": "16.8.1",
"lru-cache": "^7.17.0",

View file

@ -3,7 +3,6 @@ import LRU from 'lru-cache';
import { composeServices } from '@apollo/composition';
import { Supergraph } from '@apollo/federation-internals';
import { compose, signatureHeaderName, verifyRequest } from '@graphql-hive/external-composition';
import { Response } from '@whatwg-node/fetch';
import { createServerAdapter } from '@whatwg-node/server';
import { ResolvedEnv } from './environment';

View file

@ -15,7 +15,6 @@
"@sentry/node": "7.102.1",
"@sentry/tracing": "7.102.1",
"@trpc/server": "10.45.1",
"@whatwg-node/fetch": "0.9.16",
"ajv": "8.12.0",
"dotenv": "16.4.5",
"eslint": "8.57.0",

View file

@ -17,7 +17,6 @@
"@sentry/node": "7.102.1",
"@trpc/client": "10.45.1",
"@trpc/server": "10.45.1",
"@whatwg-node/fetch": "0.9.16",
"date-fns": "3.3.1",
"dotenv": "16.4.5",
"got": "14.2.0",

View file

@ -1,6 +1,5 @@
import type { EmailsApi } from '@hive/emails';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { env } from './environment';
export function createEmailScheduler(config?: { endpoint: string }) {

View file

@ -4,7 +4,6 @@ import { createStorage as createPostgreSQLStorage } from '@hive/storage';
import type { UsageEstimatorApi } from '@hive/usage-estimator';
import * as Sentry from '@sentry/node';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import type { RateLimitInput } from './api';
import { createEmailScheduler } from './emails';
import { rateLimitOperationsEventOrg } from './metrics';

View file

@ -20,7 +20,6 @@
"@trpc/server": "10.45.1",
"@types/async-retry": "1.4.8",
"@types/ioredis-mock": "8.2.5",
"@whatwg-node/fetch": "0.9.16",
"dotenv": "16.4.5",
"fast-json-stable-stringify": "2.1.0",
"fastify": "4.26.1",

View file

@ -31,7 +31,6 @@
"@sentry/node": "7.102.1",
"@swc/core": "1.4.2",
"@trpc/server": "10.45.1",
"@whatwg-node/fetch": "0.9.16",
"@whatwg-node/server": "0.9.25",
"dotenv": "16.4.5",
"fastify": "4.26.1",

View file

@ -29,7 +29,6 @@ import { useResponseCache } from '@graphql-yoga/plugin-response-cache';
import { HiveError, Registry, RegistryContext } from '@hive/api';
import { cleanRequestId } from '@hive/service-common';
import { runWithAsyncContext } from '@sentry/node';
import { fetch } from '@whatwg-node/fetch';
import { asyncStorage } from './async-storage';
import type { HiveConfig } from './environment';
import { useArmor } from './use-armor';

View file

@ -16,7 +16,6 @@
"@sentry/node": "7.102.1",
"@trpc/client": "10.45.1",
"@trpc/server": "10.45.1",
"@whatwg-node/fetch": "0.9.16",
"date-fns": "3.3.1",
"dotenv": "16.4.5",
"got": "14.2.0",

View file

@ -15,7 +15,6 @@
"@hive/service-common": "workspace:*",
"@sentry/node": "7.102.1",
"@trpc/server": "10.45.1",
"@whatwg-node/fetch": "0.9.16",
"dotenv": "16.4.5",
"got": "14.2.0",
"pino-pretty": "10.3.1",

View file

@ -16,7 +16,6 @@
"@sentry/node": "7.102.1",
"@trpc/client": "10.45.1",
"@trpc/server": "10.45.1",
"@whatwg-node/fetch": "0.9.16",
"ajv": "8.12.0",
"dotenv": "16.4.5",
"got": "14.2.0",

View file

@ -2,7 +2,6 @@ import LRU from 'tiny-lru';
import type { RateLimitApi, RateLimitApiInput, RateLimitApiOutput } from '@hive/rate-limit';
import { FastifyLoggerInstance } from '@hive/service-common';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
export function createUsageRateLimit(config: {
endpoint: string | null;

View file

@ -2,7 +2,6 @@ import LRU from 'tiny-lru';
import { FastifyLoggerInstance } from '@hive/service-common';
import type { TokensApi } from '@hive/tokens';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
import { fetch } from '@whatwg-node/fetch';
import { tokenCacheHits, tokenRequests } from './metrics';
export enum TokenStatus {

View file

@ -53,7 +53,6 @@
"@urql/core": "4.1.4",
"@urql/exchange-graphcache": "6.3.3",
"@urql/exchange-persisted": "4.1.0",
"@whatwg-node/fetch": "0.9.16",
"class-variance-authority": "0.7.0",
"clsx": "2.1.0",
"cmdk": "0.2.1",

View file

@ -616,9 +616,6 @@ importers:
'@types/object-hash':
specifier: 3.0.6
version: 3.0.6
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
agentkeepalive:
specifier: 4.5.0
version: 4.5.0
@ -796,9 +793,6 @@ importers:
'@types/sendmail':
specifier: 1.4.7
version: 1.4.7
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
bullmq:
specifier: 5.3.3
version: 5.3.3(patch_hash=kobtuuqaglbtaadx3jiqtahl3i)
@ -844,9 +838,6 @@ importers:
'@graphql-hive/external-composition':
specifier: workspace:*
version: link:../../../libraries/external-composition/dist
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
'@whatwg-node/server':
specifier: 0.9.25
version: 0.9.25
@ -877,9 +868,6 @@ importers:
'@trpc/server':
specifier: 10.45.1
version: 10.45.1
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
ajv:
specifier: 8.12.0
version: 8.12.0
@ -925,9 +913,6 @@ importers:
'@trpc/server':
specifier: 10.45.1
version: 10.45.1
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
date-fns:
specifier: 3.3.1
version: 3.3.1
@ -982,9 +967,6 @@ importers:
'@types/ioredis-mock':
specifier: 8.2.5
version: 8.2.5
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
dotenv:
specifier: 16.4.5
version: 16.4.5
@ -1081,9 +1063,6 @@ importers:
'@trpc/server':
specifier: 10.45.1
version: 10.45.1
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
'@whatwg-node/server':
specifier: 0.9.25
version: 0.9.25
@ -1229,9 +1208,6 @@ importers:
'@trpc/server':
specifier: 10.45.1
version: 10.45.1
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
date-fns:
specifier: 3.3.1
version: 3.3.1
@ -1322,9 +1298,6 @@ importers:
'@trpc/server':
specifier: 10.45.1
version: 10.45.1
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
ajv:
specifier: 8.12.0
version: 8.12.0
@ -1370,9 +1343,6 @@ importers:
'@trpc/server':
specifier: 10.45.1
version: 10.45.1
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
dotenv:
specifier: 16.4.5
version: 16.4.5
@ -1595,9 +1565,6 @@ importers:
'@urql/exchange-persisted':
specifier: 4.1.0
version: 4.1.0(graphql@16.8.1)
'@whatwg-node/fetch':
specifier: 0.9.16
version: 0.9.16
class-variance-authority:
specifier: 0.7.0
version: 0.7.0

View file

@ -1,6 +1,5 @@
import { buildSchema, parse } from 'graphql';
import { createHive } from '@graphql-hive/client';
import { fetch } from '@whatwg-node/fetch';
const isFederation = process.env.FEDERATION === '1';
const isSchemaReportingEnabled = process.env.SCHEMA_REPORTING !== '0';