mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(Linear Node): Fix issue with data not always being returned (#9273)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -52,20 +52,30 @@ export function capitalizeFirstLetter(data: string) {
|
|||||||
export async function linearApiRequestAllItems(
|
export async function linearApiRequestAllItems(
|
||||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||||
propertyName: string,
|
propertyName: string,
|
||||||
|
|
||||||
body: any = {},
|
body: any = {},
|
||||||
|
limit?: number,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
let responseData;
|
let responseData;
|
||||||
body.variables.first = 50;
|
body.variables.first = limit && limit < 50 ? limit : 50;
|
||||||
body.variables.after = null;
|
body.variables.after = null;
|
||||||
|
|
||||||
|
const propertyPath = propertyName.split('.');
|
||||||
|
const nodesPath = [...propertyPath, 'nodes'];
|
||||||
|
const endCursorPath = [...propertyPath, 'pageInfo', 'endCursor'];
|
||||||
|
const hasNextPagePath = [...propertyPath, 'pageInfo', 'hasNextPage'];
|
||||||
|
|
||||||
do {
|
do {
|
||||||
responseData = await linearApiRequest.call(this, body);
|
responseData = await linearApiRequest.call(this, body);
|
||||||
returnData.push.apply(returnData, get(responseData, [propertyName, 'nodes']) as IDataObject[]);
|
const nodes = get(responseData, nodesPath) as IDataObject[];
|
||||||
body.variables.after = get(responseData, [propertyName, 'pageInfo', 'endCursor']);
|
returnData.push(...nodes);
|
||||||
} while (get(responseData, [propertyName, 'pageInfo', 'hasNextPage']));
|
body.variables.after = get(responseData, endCursorPath);
|
||||||
|
if (limit && returnData.length >= limit) {
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
} while (get(responseData, hasNextPagePath));
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,6 @@ export const issueFields: INodeProperties[] = [
|
|||||||
default: 50,
|
default: 50,
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
minValue: 1,
|
minValue: 1,
|
||||||
maxValue: 300,
|
|
||||||
},
|
},
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
|
|||||||
@@ -272,9 +272,7 @@ export class Linear implements INodeType {
|
|||||||
responseData = await linearApiRequestAllItems.call(this, 'data.issues', body);
|
responseData = await linearApiRequestAllItems.call(this, 'data.issues', body);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', 0);
|
const limit = this.getNodeParameter('limit', 0);
|
||||||
body.variables.first = limit;
|
responseData = await linearApiRequestAllItems.call(this, 'data.issues', body, limit);
|
||||||
responseData = await linearApiRequest.call(this, body);
|
|
||||||
responseData = responseData.data.issues.nodes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (operation === 'update') {
|
if (operation === 'update') {
|
||||||
|
|||||||
Reference in New Issue
Block a user