Skip to content

Commit

Permalink
fix: typing too complex
Browse files Browse the repository at this point in the history
  • Loading branch information
openint-bot committed Dec 23, 2024
1 parent 43f79e8 commit 99edc1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion sdks/sdk-qbo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ export const qboSdkDef = {
}
},
}
return {...client, ...extension} as typeof client & typeof extension
Object.assign(client, extension)
return client as typeof client & typeof extension
},
} satisfies SdkDefinition<QBOSDKTypes>

Expand Down
25 changes: 13 additions & 12 deletions sdks/sdk-salesforce/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,24 @@ export type QueryResponse<T> = {
// TODO: Add handling for instanceUrl, apiVersion and auth tokens into this
export const salesforceSdkDef = {
types: {} as SalesforceSDKTypes,
defaultOptions: {}, // needed due to instance-specific server url in oasMeta
defaultOptions: {}, // needed due to instance-specific server url in oasMeta
// Cannot use the oasMeta because the serverUrl is going to be instance dependent
createClient: (ctx, options) => {
const client = ctx.createClient(options)
// TODO: Add typesafe handling of response from query just like supablue postgREST.js client
// @see https://github.com/supabase/postgrest-js?tab=readme-ov-file
/** NOTE: `SELECT *` is now allowed by Salesforce. Exact columns need to be specified */
function query<T = {[k: string]: any}>(query: string) {
return client
.request('GET', '/query', {params: {query: {q: query}}})
.then((r) => r.data as QueryResponse<T>)
}
return {
...client,
query,

const extension = {
// TODO: Add typesafe handling of response from query just like supablue postgREST.js client
// @see https://github.com/supabase/postgrest-js?tab=readme-ov-file
/** NOTE: `SELECT *` is now allowed by Salesforce. Exact columns need to be specified */
query<T = {[k: string]: any}>(query: string) {
return client
.request('GET', '/query', {params: {query: {q: query}}})
.then((r) => r.data as QueryResponse<T>)
},
// TODO: Add other api such as tooling / bulk etc.
}
Object.assign(client, extension)
return client as typeof client & typeof extension
},
} satisfies SdkDefinition<SalesforceSDKTypes>

Expand Down

0 comments on commit 99edc1c

Please sign in to comment.