mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)
This commit is contained in:
@@ -2,7 +2,7 @@ import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
import type { IDataObject, JsonObject } from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
@@ -30,7 +30,7 @@ export async function googleApiRequest(
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
if (Object.keys(body).length === 0) {
|
||||
if (Object.keys(body as IDataObject).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function googleApiRequest(
|
||||
options,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function googleApiRequestAllItems(
|
||||
do {
|
||||
responseData = await googleApiRequest.call(this, method, endpoint, body, query, uri);
|
||||
query.pageToken = responseData.nextPageToken;
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
|
||||
} while (responseData.nextPageToken !== undefined && responseData.nextPageToken !== '');
|
||||
|
||||
return returnData;
|
||||
@@ -97,7 +97,7 @@ export function jsonToDocument(value: string | number | IDataObject | IDataObjec
|
||||
const obj = {};
|
||||
for (const o of Object.keys(value)) {
|
||||
//@ts-ignore
|
||||
obj[o] = jsonToDocument(value[o]);
|
||||
obj[o] = jsonToDocument(value[o] as IDataObject);
|
||||
}
|
||||
return { mapValue: { fields: obj } };
|
||||
}
|
||||
@@ -136,7 +136,7 @@ export function documentToJson(fields: IDataObject): IDataObject {
|
||||
return value as IDataObject;
|
||||
} else if ('mapValue' === key) {
|
||||
//@ts-ignore
|
||||
return documentToJson(value!.fields || {});
|
||||
return documentToJson((value!.fields as IDataObject) || {});
|
||||
} else if ('arrayValue' === key) {
|
||||
// @ts-ignore
|
||||
const list = value.values as IDataObject[];
|
||||
|
||||
@@ -130,7 +130,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
@@ -150,7 +150,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
// @ts-ignore
|
||||
if (item.json[column]) {
|
||||
// @ts-ignore
|
||||
document.fields[column] = jsonToDocument(item.json[column]);
|
||||
document.fields[column] = jsonToDocument(item.json[column] as IDataObject);
|
||||
} else {
|
||||
// @ts-ignore
|
||||
document.fields[column] = jsonToDocument(null);
|
||||
@@ -166,11 +166,11 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
responseData.id = (responseData.name as string).split('/').pop();
|
||||
|
||||
if (simple) {
|
||||
responseData = fullDocumentToJson(responseData);
|
||||
responseData = fullDocumentToJson(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
@@ -213,7 +213,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
@@ -256,7 +256,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
// @ts-ignore
|
||||
if (item.json.hasOwnProperty(column)) {
|
||||
// @ts-ignore
|
||||
document[column] = jsonToDocument(item.json[column]);
|
||||
document[column] = jsonToDocument(item.json[column] as IDataObject);
|
||||
} else {
|
||||
// @ts-ignore
|
||||
document[column] = jsonToDocument(null);
|
||||
@@ -288,7 +288,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
Object.assign(writeResults[i], items[i].json);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(writeResults[i]),
|
||||
this.helpers.returnJsonArray(writeResults[i] as IDataObject[]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
@@ -358,7 +358,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
@@ -395,7 +395,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function googleApiRequest(
|
||||
if (Object.keys(headers).length !== 0) {
|
||||
options.headers = Object.assign({}, options.headers, headers);
|
||||
}
|
||||
if (Object.keys(body).length === 0) {
|
||||
if (Object.keys(body as IDataObject).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export async function googleApiRequestAllItems(
|
||||
uri,
|
||||
);
|
||||
qs.pageToken = responseData.nextPageToken;
|
||||
returnData.push.apply(returnData, responseData[resource]);
|
||||
returnData.push.apply(returnData, responseData[resource] as IDataObject[]);
|
||||
} while (responseData.nextPageToken !== undefined && responseData.nextPageToken !== '');
|
||||
|
||||
return returnData;
|
||||
|
||||
@@ -7,6 +7,7 @@ import type {
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
@@ -217,7 +218,7 @@ export class GoogleFirebaseRealtimeDatabase implements INodeType {
|
||||
|
||||
if (responseData === null) {
|
||||
if (operation === 'get') {
|
||||
throw new NodeApiError(this.getNode(), responseData, {
|
||||
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
|
||||
message: 'Requested entity was not found.',
|
||||
});
|
||||
} else if (method === 'DELETE') {
|
||||
@@ -243,7 +244,7 @@ export class GoogleFirebaseRealtimeDatabase implements INodeType {
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
|
||||
Reference in New Issue
Block a user