File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -262,9 +262,9 @@ export const connectionRouter = trpc.router({
262
262
. output ( z . object ( { } ) )
263
263
. mutation ( async ( { input : { id : connId , ...opts } , ctx} ) => {
264
264
if ( ctx . viewer . role === 'customer' ) {
265
- await ctx . services . getConnectionOrFail ( connId )
265
+ await ctx . services . getConnectionOrFail ( connId , true )
266
266
}
267
- const conn = await ctx . asOrgIfNeeded . getConnectionExpandedOrFail ( connId )
267
+ const conn = await ctx . asOrgIfNeeded . getConnectionExpandedOrFail ( connId , true )
268
268
const { settings, connectorConfig : ccfg } = conn
269
269
if ( ! opts ?. skipRevoke ) {
270
270
await ccfg . connector . revokeConnection ?.(
Original file line number Diff line number Diff line change @@ -184,15 +184,18 @@ export function makeDBService({
184
184
}
185
185
return zRaw . integration . parse ( ins )
186
186
} )
187
- const getConnectionOrFail = ( id : Id [ 'conn' ] ) =>
187
+ const getConnectionOrFail = ( id : Id [ 'conn' ] , skipValidation = false ) =>
188
188
metaService . tables . connection . get ( id ) . then ( ( conn ) => {
189
189
if ( ! conn ) {
190
190
throw new TRPCError ( {
191
191
code : 'NOT_FOUND' ,
192
192
message : `conn not found: ${ id } ` ,
193
193
} )
194
194
}
195
- return zRaw . connection . parse ( conn )
195
+ if ( ! skipValidation ) {
196
+ return zRaw . connection . parse ( conn )
197
+ }
198
+ return conn
196
199
} )
197
200
const getPipelineOrFail = ( id : Id [ 'pipe' ] ) =>
198
201
metaService . tables . pipeline . get ( id ) . then ( ( pipe ) => {
@@ -205,15 +208,16 @@ export function makeDBService({
205
208
return zRaw . pipeline . parse ( pipe )
206
209
} )
207
210
208
- const getConnectionExpandedOrFail = ( id : Id [ 'conn' ] ) =>
211
+ const getConnectionExpandedOrFail = ( id : Id [ 'conn' ] , skipValidation = false ) =>
209
212
getConnectionOrFail ( id ) . then ( async ( conn ) => {
210
213
const connectorConfig = await getConnectorConfigOrFail (
211
214
conn . connectorConfigId ,
212
215
)
213
- const settings : { } =
214
- connectorConfig . connector . schemas . connectionSettings ?. parse (
215
- conn . settings ,
216
- )
216
+ const settings : { } = skipValidation
217
+ ? conn . settings
218
+ : connectorConfig . connector . schemas . connectionSettings ?. parse (
219
+ conn . settings ,
220
+ )
217
221
const integration = conn . integrationId
218
222
? await getIntegrationOrFail ( conn . integrationId )
219
223
: undefined
You can’t perform that action at this time.
0 commit comments