From 6803d48b59460861784027222edede9ea49bb898 Mon Sep 17 00:00:00 2001 From: Alan Johnson Date: Thu, 16 Jan 2025 11:20:08 -0500 Subject: [PATCH] Move shared/utils/http.ts to utils package --- package-lock.json | 1 + .../server/lib/controllers/proxy.controller.ts | 14 ++------------ packages/shared/lib/index.ts | 1 - packages/shared/lib/sdk/sync.ts | 5 +++-- packages/shared/lib/services/proxy.service.ts | 3 +-- packages/{shared/lib/utils => utils/lib}/http.ts | 0 .../lib/utils => utils/lib}/http.unit.test.ts | 0 packages/utils/lib/index.ts | 1 + 8 files changed, 8 insertions(+), 17 deletions(-) rename packages/{shared/lib/utils => utils/lib}/http.ts (100%) rename packages/{shared/lib/utils => utils/lib}/http.unit.test.ts (100%) diff --git a/package-lock.json b/package-lock.json index b75c03cdfc7..7a5fca9dced 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36631,6 +36631,7 @@ } }, "packages/runner-sdk": { + "name": "@nangohq/runner-sdk", "version": "0.48.3", "dependencies": { "@nangohq/node": "0.48.3", diff --git a/packages/server/lib/controllers/proxy.controller.ts b/packages/server/lib/controllers/proxy.controller.ts index 730bed620b2..fec02eeadf7 100644 --- a/packages/server/lib/controllers/proxy.controller.ts +++ b/packages/server/lib/controllers/proxy.controller.ts @@ -9,18 +9,8 @@ import querystring from 'querystring'; import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'; import { backOff } from 'exponential-backoff'; import type { HTTP_METHOD, UserProvidedProxyConfiguration, InternalProxyConfiguration, ApplicationConstructedProxyConfiguration, File } from '@nangohq/shared'; -import { - LogActionEnum, - errorManager, - ErrorSourceEnum, - proxyService, - connectionService, - configService, - featureFlags, - redactHeaders, - redactURL -} from '@nangohq/shared'; -import { metrics, getLogger, axiosInstance as axios, getHeaders } from '@nangohq/utils'; +import { LogActionEnum, errorManager, ErrorSourceEnum, proxyService, connectionService, configService, featureFlags } from '@nangohq/shared'; +import { metrics, getLogger, axiosInstance as axios, getHeaders, redactHeaders, redactURL } from '@nangohq/utils'; import { flushLogsBuffer, logContextGetter } from '@nangohq/logs'; import { connectionRefreshFailed as connectionRefreshFailedHook, connectionRefreshSuccess as connectionRefreshSuccessHook } from '../hooks/hooks.js'; import type { LogContext } from '@nangohq/logs'; diff --git a/packages/shared/lib/index.ts b/packages/shared/lib/index.ts index f8b73de8a60..e7a27ed9ec1 100644 --- a/packages/shared/lib/index.ts +++ b/packages/shared/lib/index.ts @@ -43,7 +43,6 @@ export * from './clients/locking.js'; export * from './models/index.js'; export * from './utils/utils.js'; -export * from './utils/http.js'; export * from './utils/error.js'; export * from './constants.js'; diff --git a/packages/shared/lib/sdk/sync.ts b/packages/shared/lib/sdk/sync.ts index 030f63568e6..f794a97f7aa 100644 --- a/packages/shared/lib/sdk/sync.ts +++ b/packages/shared/lib/sdk/sync.ts @@ -16,14 +16,15 @@ import { MAX_LOG_PAYLOAD, stringifyAndTruncateValue, stringifyObject, - truncateJson + truncateJson, + redactHeaders, + redactURL } from '@nangohq/utils'; import type { ValidateDataError } from './dataValidation.js'; import { validateData } from './dataValidation.js'; import { NangoError } from '../utils/error.js'; import type { ApiEndUser, DBSyncConfig, DBTeam, GetPublicIntegration, MessageRowInsert, RunnerFlags } from '@nangohq/types'; import { getProvider } from '../services/providers.js'; -import { redactHeaders, redactURL } from '../utils/http.js'; const logger = getLogger('SDK'); diff --git a/packages/shared/lib/services/proxy.service.ts b/packages/shared/lib/services/proxy.service.ts index 89bce6bdbe5..44e0a12068f 100644 --- a/packages/shared/lib/services/proxy.service.ts +++ b/packages/shared/lib/services/proxy.service.ts @@ -2,7 +2,7 @@ import { isAxiosError } from 'axios'; import type { AxiosError, AxiosResponse, AxiosRequestConfig, ParamsSerializerOptions } from 'axios'; import OAuth from 'oauth-1.0a'; import * as crypto from 'node:crypto'; -import { axiosInstance as axios, SIGNATURE_METHOD } from '@nangohq/utils'; +import { axiosInstance as axios, SIGNATURE_METHOD, redactHeaders, redactURL } from '@nangohq/utils'; import { backOff } from 'exponential-backoff'; import FormData from 'form-data'; import type { TbaCredentials, ApiKeyCredentials, BasicApiCredentials, TableauCredentials } from '../models/Auth.js'; @@ -13,7 +13,6 @@ import { interpolateIfNeeded, connectionCopyWithParsedConnectionConfig, mapProxy import { NangoError } from '../utils/error.js'; import type { MessageRowInsert, RetryHeaderConfig } from '@nangohq/types'; import { getProvider } from './providers.js'; -import { redactHeaders, redactURL } from '../utils/http.js'; interface Logs { logs: MessageRowInsert[]; diff --git a/packages/shared/lib/utils/http.ts b/packages/utils/lib/http.ts similarity index 100% rename from packages/shared/lib/utils/http.ts rename to packages/utils/lib/http.ts diff --git a/packages/shared/lib/utils/http.unit.test.ts b/packages/utils/lib/http.unit.test.ts similarity index 100% rename from packages/shared/lib/utils/http.unit.test.ts rename to packages/utils/lib/http.unit.test.ts diff --git a/packages/utils/lib/index.ts b/packages/utils/lib/index.ts index 40a42169f24..d0cf0d5b08a 100644 --- a/packages/utils/lib/index.ts +++ b/packages/utils/lib/index.ts @@ -19,3 +19,4 @@ export * from './workflows.js'; export * from './axios.js'; export * from './auth.js'; export * from './once.js'; +export * from './http.js';