Skip to main content

Source Data Discover

Input/OutputData Type
InputStdSourceDataDiscoverInput
OutputStdSourceDataDiscoverOutput

Example StdSourceDataDiscoverInput

{
"queryInput": {
"query": "fetchAll",
"limit": 10
}
}

Example StdSourceDataDiscoverOutput

[
{
key: 'id',
label: 'Id',
subLabel: 'Airtable Base Id',
},
{
key: 'name',
label: 'Name',
subLabel: 'Airtable Source Table Name',
},
];

Description

Use the source data discover command to identify the types of data your source can return. Different sources can send different types of data to Identity Security Cloud. For example, one source may be able to send a list of the different languages it supports, while another may be able to send values describing source details normally sent through accounts and entitlements. You can use the source data discover command to discover these possibilities.

One typical use for the source data discover command is found in Identity Security Cloud customer forms for dropdown menus: they use the command to identify the additional source types their sources can provide to Identity Security Cloud and use that information to populate the dropdown menus.

To use this command, you must specify this value in the commands array: std:source-data:discover

This is a simple example of the source data discover command. It has been implemented to list two types of queries that the Airtable source can supply.

.stdSourceDataDiscover(async (context: Context, input: StdSourceDataDiscoverInput, res: Response<StdSourceDataDiscoverOutput>) => {
res.send([
{
key: 'id',
label: 'Id',
subLabel: 'Airtable Base Id'
},
{
key: 'name',
label: 'Name',
subLabel: 'Airtable Source Table Name'
}
])
})

You can optionally use input.queryInput.query to make the list searchable. One way you could do this is to import a tool like alasql and allow the user to implement a search on the dataset, as shown in this example:

.stdSourceDataDiscover(async (context: Context, input: StdSourceDataDiscoverInput, res: Response<StdSourceDataDiscoverOutput>) => {
const data = [
{
key: 'id',
label: 'Id',
subLabel: 'Airtable Base Id'
},
{
key: 'name',
label: 'Name',
subLabel: 'Airtable Source Table Name'
}
]

if (input.queryInput?.query) {
let result = alasql(`select * from ? where key like('%${input.queryInput?.query}%')`, [data] );
res.send(result)
} else {
res.send(data)
}
})

Now, if the source system sends a command like the following, they will only get fields that contain the name "name" back:

    "type": "std:source-data:discover",
"input": {
"sourceDataKey": "id",
"queryInput": {
"query": "name"
}
},