Skip to main content

Customized Operation

Overview

The customized operation customizer is a special customizer that can be embedded anywhere in the code and then called with the customizer. Because this customizer is not bound to a before or after operation, the identifier needs to be known to properly call it. This identifier should be available in the connector documentation.

Implementation in Customizer

Use this logic to implement the code:

    .customizedOperation('Operation Identifier', async (context: Context, input: any) => {
logger.info(`Running customized code.`)
return input
})

Implementation in Connector

You can add the following JavaScript anywhere in the code. The first parameter is the identifier, and the 'input' object can be any object that is mutated and returned.

const response = await context.customizedOperation('Operation Identifier', input);

Example implementation in the accound-read command:

export const connector = async () => {

// Get connector source config
const config = await readConfig()

// Use the vendor SDK, or implement own client as necessary, to initialize a client
const airtable = new AirtableClient(config)

return createConnector()
.stdAccountRead(async (context: Context, input: StdAccountReadInput, res: Response<StdAccountReadOutput>) => {
const account = await airtable.getAccount(input.key)
const response = await context.customizedOperation('AccountReadCustomization', account);
res.send(response.toStdAccountReadOutput())
})
...