Skip to content

Commit

Permalink
chore: rename sdkLinks to fetchLinks
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Dec 20, 2023
1 parent 6ab3587 commit 3b0218e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions connectors/connector-qbo/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function initQBOSdk(options: QBOSDKTypes['options']) {
}

export const qboServer = {
newInstance: ({config, settings, sdkLinks}) => {
newInstance: ({config, settings, fetchLinks}) => {
const qbo = initQBOSdk({
envName: config.envName,
realmId: settings.oauth.connection_config.realmId,
Expand All @@ -24,7 +24,7 @@ export const qboServer = {
}
return next(req)
},
...sdkLinks,
...fetchLinks,
...defaultLinks,
],
accessToken: '', // Will use passthrough api for this..
Expand Down
6 changes: 3 additions & 3 deletions kits/cdk/connector.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Link} from '@opensdks/runtime'
import type {Link as FetchLink} from '@opensdks/runtime'
import type {MaybePromise, PathsOf} from '@usevenice/util'
import {R} from '@usevenice/util'
import type {z} from '@usevenice/zod'
Expand Down Expand Up @@ -277,8 +277,8 @@ export interface ConnectorServer<
newInstance?: (opts: {
config: T['_types']['connectorConfig']
settings: T['_types']['resourceSettings']
sdkLinks: Link[]
/** @deprecated, use sdkLinks instead for things like token refreshes or connection status update */
fetchLinks: FetchLink[]
/** @deprecated, use fetchLinks instead for things like token refreshes or connection status update */
onSettingsChange: (
newSettings: T['_types']['resourceSettings'],
) => MaybePromise<void>
Expand Down
2 changes: 1 addition & 1 deletion kits/vdk/new-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function proxyListRemoteRedux({
const instance = ctx.remote.connector.newInstance?.({
config: ctx.remote.config,
settings: ctx.remote.settings,
sdkLinks: ctx.remote.sdkLinks,
fetchLinks: ctx.remote.fetchLinks,
onSettingsChange: (settings) =>
ctx.services.metaLinks.patch('resource', ctx.remote.id, {settings}),
})
Expand Down
4 changes: 2 additions & 2 deletions packages/engine-backend/lib/nangoProxyLink.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Link} from '@opensdks/runtime'
import type {Link as FetchLink} from '@opensdks/runtime'
import {mergeHeaders, modifyRequest} from '@opensdks/runtime'

const kBaseUrlOverride = 'base-url-override'
Expand Down Expand Up @@ -26,7 +26,7 @@ export function nangoProxyLink(opts: {
baseUrlOverride?: string
/** `retries` header */
retries?: number
}): Link {
}): FetchLink {
const nangoHeaders = {
authorization: `Bearer ${opts.secretKey}`,
'connection-id': opts.connectionId,
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-backend/router/_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const remoteProcedure = protectedProcedure.use(async ({next, ctx}) => {
connectorName: resource.connectorName,
settings: resource.settings,
config: resource.connectorConfig.config,
sdkLinks: ctx.services.getSdkLinks(resource),
fetchLinks: ctx.services.getFetchLinks(resource),
},
},
})
Expand Down
4 changes: 2 additions & 2 deletions packages/engine-backend/router/resourceRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const resourceRouter = trpc.router({
const instance = ctx.remote.connector.newInstance?.({
config: ctx.remote.config,
settings: ctx.remote.settings,
sdkLinks: ctx.remote.sdkLinks,
fetchLinks: ctx.remote.fetchLinks,
onSettingsChange: () => {}, // not implemented
})
return await ctx.remote.connector.passthrough(instance, input)
Expand Down Expand Up @@ -267,7 +267,7 @@ export const resourceRouter = trpc.router({
instance: reso.connectorConfig.connector.newInstance?.({
config: reso.connectorConfig.config,
settings: reso.settings,
sdkLinks: ctx.services.getSdkLinks(reso),
fetchLinks: ctx.services.getFetchLinks(reso),
onSettingsChange: () => {},
}),
config: reso.connectorConfig.config,
Expand Down
6 changes: 3 additions & 3 deletions packages/engine-backend/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function makeServices({
metaService,
connectorMap,
})
function getSdkLinks(reso: _ResourceExpanded) {
function getFetchLinks(reso: _ResourceExpanded) {
return R.compact([
logLink(),
reso.connectorConfig.connector.metadata?.nangoProvider &&
Expand All @@ -37,8 +37,8 @@ export function makeServices({
metaLinks: dbService.metaLinks,
getPipelineExpandedOrFail: dbService.getPipelineExpandedOrFail,
getResourceExpandedOrFail: dbService.getResourceExpandedOrFail,
getSdkLinks,
getFetchLinks,
})

return {...dbService, ...syncService, getSdkLinks}
return {...dbService, ...syncService, getFetchLinks}
}
8 changes: 4 additions & 4 deletions packages/engine-backend/services/sync-service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Link as SdkLink} from '@opensdks/runtime'
import type {Link as FetchLink} from '@opensdks/runtime'
import type {
AnyEntityPayload,
Destination,
Expand Down Expand Up @@ -26,7 +26,7 @@ export function makeSyncService({
metaService,
getPipelineExpandedOrFail,
getResourceExpandedOrFail,
getSdkLinks,
getFetchLinks,
}: {
metaService: MetaService
metaLinks: ReturnType<typeof makeMetaLinks>
Expand All @@ -36,7 +36,7 @@ export function makeSyncService({
getResourceExpandedOrFail: ReturnType<
typeof makeDBService
>['getResourceExpandedOrFail']
getSdkLinks: (reso: _ResourceExpanded) => SdkLink[]
getFetchLinks: (reso: _ResourceExpanded) => FetchLink[]
}) {
async function ensurePipelinesForResource(resoId: Id['reso']) {
const pipelines = await metaService.findPipelines({resourceIds: [resoId]})
Expand Down Expand Up @@ -179,7 +179,7 @@ export function makeSyncService({
instance: src.connectorConfig.connector.newInstance?.({
config: src.connectorConfig.config,
settings: src.settings,
sdkLinks: getSdkLinks(src),
fetchLinks: getFetchLinks(src),
onSettingsChange: () => {},
}),
config: src.connectorConfig.config,
Expand Down
2 changes: 1 addition & 1 deletion packages/meta-service-airbyte/makeAirbyteConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function makeAirbyteConnector(connector: AnyConnectorImpl) {
instance: connector.newInstance?.({
config: config.config,
settings: config.settings,
sdkLinks: [], // TODO: Add fetchLinks when we need to actually impl this.
fetchLinks: [], // TODO: Add fetchLinks when we need to actually impl this.
onSettingsChange: () => {},
}),
state,
Expand Down

0 comments on commit 3b0218e

Please sign in to comment.