Add options to sideload owner and vendors

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-02 10:54:10 +01:00
parent c26b0d8423
commit 85bff72e0e
8 changed files with 432 additions and 8 deletions

View File

@@ -46,6 +46,35 @@ export const description: INodeProperties[] = [
default: 50,
description: 'Max number of results to return',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['datum'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Include Owner',
name: 'includeOwner',
type: 'boolean',
default: false,
description: 'Whether to include owner details in the response',
},
{
displayName: 'Include Vendors',
name: 'includeVendors',
type: 'boolean',
default: false,
description: 'Whether to include vendors in the response',
},
],
},
];
export async function execute(
@@ -55,6 +84,29 @@ export async function execute(
const organizationId = this.getNodeParameter('organizationId', itemIndex) as string;
const returnAll = this.getNodeParameter('returnAll', itemIndex) as boolean;
const limit = this.getNodeParameter('limit', itemIndex, 50) as number;
const options = this.getNodeParameter('options', itemIndex, {}) as {
includeOwner?: boolean;
includeVendors?: boolean;
};
const ownerFragment = options.includeOwner
? `owner {
id
fullName
primaryEmailAddress
}`
: '';
const vendorsFragment = options.includeVendors
? `vendors(first: 100) {
edges {
node {
id
name
}
}
}`
: '';
const query = `
query GetData($organizationId: ID!, $first: Int, $after: CursorKey) {
@@ -66,6 +118,8 @@ export async function execute(
id
name
dataClassification
${ownerFragment}
${vendorsFragment}
createdAt
updatedAt
}
@@ -94,4 +148,3 @@ export async function execute(
pairedItem: { item: itemIndex },
};
}