mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(core): Revert rule @typescript-eslint/prefer-nullish-coalescing
This commit is contained in:
parent
9b032d68bc
commit
e667df783c
|
@ -29,6 +29,7 @@ module.exports = {
|
|||
'@typescript-eslint/restrict-template-expressions': 'off', //1152 errors, better to fix in separate PR
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
||||
},
|
||||
|
||||
overrides: [
|
||||
|
|
|
@ -32,7 +32,7 @@ export async function acuitySchedulingApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://acuityscheduling.com/api/v1${resource}`,
|
||||
uri: uri || `https://acuityscheduling.com/api/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ export async function affinityApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `${endpoint}${resource}`,
|
||||
uri: uri || `${endpoint}${resource}`,
|
||||
json: true,
|
||||
};
|
||||
if (!Object.keys(body).length) {
|
||||
|
|
|
@ -33,7 +33,7 @@ export async function agileCrmApiRequest(
|
|||
password: credentials.apiKey as string,
|
||||
},
|
||||
qs: query,
|
||||
uri: uri ?? `https://${credentials.subdomain}.agilecrm.com/dev/${endpoint}`,
|
||||
uri: uri || `https://${credentials.subdomain}.agilecrm.com/dev/${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
@ -113,7 +113,7 @@ export async function agileCrmApiRequestUpdate(
|
|||
username: credentials.email as string,
|
||||
password: credentials.apiKey as string,
|
||||
},
|
||||
uri: uri ?? baseUri,
|
||||
uri: uri || baseUri,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ export async function apiRequest(
|
|||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
query = query ?? {};
|
||||
query = query || {};
|
||||
|
||||
// For some reason for some endpoints the bearer auth does not work
|
||||
// and it returns 404 like for the /meta request. So we always send
|
||||
|
@ -46,7 +46,7 @@ export async function apiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `https://api.airtable.com/v0/${endpoint}`,
|
||||
uri: uri || `https://api.airtable.com/v0/${endpoint}`,
|
||||
useQuerystring: false,
|
||||
json: true,
|
||||
};
|
||||
|
|
|
@ -441,7 +441,7 @@ export class ApiTemplateIo implements INodeType {
|
|||
const fileName = responseData.download_url.split('/').pop();
|
||||
const binaryData = await this.helpers.prepareBinaryData(
|
||||
data,
|
||||
options.fileName ?? fileName,
|
||||
options.fileName || fileName,
|
||||
);
|
||||
responseData = {
|
||||
json: responseData,
|
||||
|
@ -525,7 +525,7 @@ export class ApiTemplateIo implements INodeType {
|
|||
const fileName = responseData.download_url.split('/').pop();
|
||||
const binaryData = await this.helpers.prepareBinaryData(
|
||||
imageData,
|
||||
options.fileName ?? fileName,
|
||||
options.fileName || fileName,
|
||||
);
|
||||
responseData = {
|
||||
json: responseData,
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function asanaApiRequest(
|
|||
method,
|
||||
body: { data: body },
|
||||
qs: query,
|
||||
url: uri ?? `https://app.asana.com/api/1.0${endpoint}`,
|
||||
url: uri || `https://app.asana.com/api/1.0${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function autopilotApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `${endpoint}${resource}`,
|
||||
uri: uri || `${endpoint}${resource}`,
|
||||
json: true,
|
||||
};
|
||||
if (!Object.keys(body).length) {
|
||||
|
|
|
@ -44,7 +44,7 @@ export async function awsApiRequest(
|
|||
const endpoint = new URL(getEndpointForService(service, credentials) + path);
|
||||
|
||||
// Sign AWS API request with the user credentials
|
||||
const signOpts = { headers: headers ?? {}, host: endpoint.host, method, path, body } as Request;
|
||||
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body } as Request;
|
||||
const securityHeaders = {
|
||||
accessKeyId: `${credentials.accessKeyId}`.trim(),
|
||||
secretAccessKey: `${credentials.secretAccessKey}`.trim(),
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function bannerbearApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `https://api.bannerbear.com/v2${resource}`,
|
||||
uri: uri || `https://api.bannerbear.com/v2${resource}`,
|
||||
json: true,
|
||||
};
|
||||
if (!Object.keys(body).length) {
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function bitbucketApiRequest(
|
|||
},
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api.bitbucket.org/2.0${resource}`,
|
||||
uri: uri || `https://api.bitbucket.org/2.0${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -25,7 +25,7 @@ export async function bitlyApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api-ssl.bitly.com/v4${resource}`,
|
||||
uri: uri || `https://api-ssl.bitly.com/v4${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -138,7 +138,7 @@ export async function loadResource(this: ILoadOptionsFunctions, resource: string
|
|||
|
||||
data.forEach(({ id, name, externalId }: { id: string; name: string; externalId?: string }) => {
|
||||
returnData.push({
|
||||
name: externalId ?? name ?? id,
|
||||
name: externalId || name || id,
|
||||
value: id,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function boxApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://api.box.com/2.0${resource}`,
|
||||
uri: uri || `https://api.box.com/2.0${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function brandfetchApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api.brandfetch.io/v1${resource}`,
|
||||
uri: uri || `https://api.brandfetch.io/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ export async function calendlyApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `${endpoint}${resource}`,
|
||||
uri: uri || `${endpoint}${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function circleciApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://circleci.com/api/v2${resource}`,
|
||||
uri: uri || `https://circleci.com/api/v2${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function webexApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://webexapis.com/v1${resource}`,
|
||||
uri: uri || `https://webexapis.com/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function citrixADCApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `${url.replace(new RegExp('/$'), '')}/nitro/v1${resource}`,
|
||||
uri: uri || `${url.replace(new RegExp('/$'), '')}/nitro/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function clearbitApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://${api}.clearbit.com${resource}`,
|
||||
uri: uri || `https://${api}.clearbit.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -32,7 +32,7 @@ export async function clickupApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api.clickup.com/api/v2${resource}`,
|
||||
uri: uri || `https://api.clickup.com/api/v2${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function cockpitApiRequest(
|
|||
token: credentials.accessToken,
|
||||
},
|
||||
body,
|
||||
uri: uri ?? `${credentials.url}/api${resource}`,
|
||||
uri: uri || `${credentials.url}/api${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ export async function codaApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://coda.io/apis/v1${resource}`,
|
||||
uri: uri || `https://coda.io/apis/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function coinGeckoApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://api.coingecko.com/api/v3${endpoint}`,
|
||||
uri: uri || `https://api.coingecko.com/api/v3${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -47,14 +47,14 @@ function compareItems(
|
|||
differentKeys.forEach((key) => {
|
||||
switch (resolve) {
|
||||
case 'preferInput1':
|
||||
different[key] = item1.json[key] ?? null;
|
||||
different[key] = item1.json[key] || null;
|
||||
break;
|
||||
case 'preferInput2':
|
||||
different[key] = item2.json[key] ?? null;
|
||||
different[key] = item2.json[key] || null;
|
||||
break;
|
||||
default:
|
||||
const input1 = item1.json[key] ?? null;
|
||||
const input2 = item2.json[key] ?? null;
|
||||
const input1 = item1.json[key] || null;
|
||||
const input2 = item2.json[key] || null;
|
||||
if (skipFields.includes(key)) {
|
||||
skipped[key] = { input1, input2 };
|
||||
} else {
|
||||
|
@ -89,7 +89,7 @@ function combineItems(
|
|||
if (disableDotNotation) {
|
||||
entry.json[field] = match.json[field];
|
||||
} else {
|
||||
const value = get(match.json, field) ?? null;
|
||||
const value = get(match.json, field) || null;
|
||||
set(entry, `json.${field}`, value);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function contentfulApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://${isPreview ? 'preview' : 'cdn'}.contentful.com${resource}`,
|
||||
uri: uri || `https://${isPreview ? 'preview' : 'cdn'}.contentful.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export async function convertKitApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api.convertkit.com/v3${endpoint}`,
|
||||
uri: uri || `https://api.convertkit.com/v3${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ export async function cortexApiRequest(
|
|||
headers: {},
|
||||
method,
|
||||
qs: query,
|
||||
uri: uri ?? `${credentials.host}/api${resource}`,
|
||||
uri: uri || `${credentials.host}/api${resource}`,
|
||||
body,
|
||||
json: true,
|
||||
};
|
||||
|
|
|
@ -430,7 +430,7 @@ export class DateTime implements INodeType {
|
|||
newDate = moment.unix(currentDate as unknown as number);
|
||||
} else {
|
||||
if (options.fromTimezone || options.toTimezone) {
|
||||
const fromTimezone = options.fromTimezone ?? workflowTimezone;
|
||||
const fromTimezone = options.fromTimezone || workflowTimezone;
|
||||
if (options.fromFormat) {
|
||||
newDate = moment.tz(
|
||||
currentDate,
|
||||
|
|
|
@ -25,7 +25,7 @@ export async function deepLApiRequest(
|
|||
method,
|
||||
form: body,
|
||||
qs,
|
||||
uri: uri ?? `${credentials.apiPlan === 'pro' ? proApiEndpoint : freeApiEndpoint}${resource}`,
|
||||
uri: uri || `${credentials.apiPlan === 'pro' ? proApiEndpoint : freeApiEndpoint}${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ export async function demioApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://my.demio.com/api/v1${resource}`,
|
||||
uri: uri || `https://my.demio.com/api/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ export async function dhlApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api-eu.dhl.com${path}`,
|
||||
uri: uri || `https://api-eu.dhl.com${path}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -19,7 +19,7 @@ export async function driftApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `https://driftapi.com${resource}`,
|
||||
uri: uri || `https://driftapi.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ export async function erpNextApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `${baseUrl}${resource}`,
|
||||
uri: uri || `${baseUrl}${resource}`,
|
||||
json: true,
|
||||
rejectUnauthorized: !credentials.allowUnauthorizedCerts,
|
||||
};
|
||||
|
|
|
@ -1239,7 +1239,7 @@ export class EditImage implements INodeType {
|
|||
// Combine the lines to a single string
|
||||
const renderText = lines.join('\n');
|
||||
|
||||
const font = options.font ?? operationData.font;
|
||||
const font = options.font || operationData.font;
|
||||
|
||||
if (font && font !== 'default') {
|
||||
gmInstance = gmInstance!.font(font as string);
|
||||
|
|
|
@ -447,7 +447,7 @@ export class ElasticSecurity implements INodeType {
|
|||
const body = {
|
||||
comment: this.getNodeParameter('comment', i),
|
||||
type: 'user',
|
||||
owner: additionalFields.owner ?? 'securitySolution',
|
||||
owner: additionalFields.owner || 'securitySolution',
|
||||
} as IDataObject;
|
||||
|
||||
const caseId = this.getNodeParameter('caseId', i);
|
||||
|
|
|
@ -193,7 +193,7 @@ export class EmailSend implements INodeType {
|
|||
continue;
|
||||
}
|
||||
attachments.push({
|
||||
filename: item.binary[propertyName].fileName ?? 'unknown',
|
||||
filename: item.binary[propertyName].fileName || 'unknown',
|
||||
content: await this.helpers.getBinaryDataBuffer(itemIndex, propertyName),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ export async function eventbriteApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://www.eventbriteapi.com/v3${resource}`,
|
||||
uri: uri || `https://www.eventbriteapi.com/v3${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -38,7 +38,7 @@ async function execPromise(command: string): Promise<IExecReturnData> {
|
|||
|
||||
resolve(returnData);
|
||||
}).on('exit', (code) => {
|
||||
returnData.exitCode = code ?? 0;
|
||||
returnData.exitCode = code || 0;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ export async function facebookApiRequest(
|
|||
qs,
|
||||
body,
|
||||
gzip: true,
|
||||
uri: uri ?? `https://graph.facebook.com/v8.0${resource}`,
|
||||
uri: uri || `https://graph.facebook.com/v8.0${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ export async function figmaApiRequest(
|
|||
headers: { 'X-FIGMA-TOKEN': credentials.accessToken },
|
||||
method,
|
||||
body,
|
||||
uri: uri ?? `https://api.figma.com${resource}`,
|
||||
uri: uri || `https://api.figma.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -24,7 +24,7 @@ export async function flowApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api.getflow.com/v2${resource}`,
|
||||
uri: uri || `https://api.getflow.com/v2${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -16,7 +16,7 @@ async function getToken(
|
|||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
credentials: IFormIoCredentials,
|
||||
) {
|
||||
const base = credentials.domain ?? 'https://formio.form.io';
|
||||
const base = credentials.domain || 'https://formio.form.io';
|
||||
const options = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -57,7 +57,7 @@ export async function formIoApiRequest(
|
|||
|
||||
const token = await getToken.call(this, credentials);
|
||||
|
||||
const base = credentials.domain ?? 'https://api.form.io';
|
||||
const base = credentials.domain || 'https://api.form.io';
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function freshdeskApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri ?? `https://${credentials.domain}.${endpoint}${resource}`,
|
||||
uri: uri || `https://${credentials.domain}.${endpoint}${resource}`,
|
||||
json: true,
|
||||
};
|
||||
if (!Object.keys(body).length) {
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function getresponseApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://api.getresponse.com/v3${resource}`,
|
||||
uri: uri || `https://api.getresponse.com/v3${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -244,7 +244,7 @@ export class GetResponse implements INodeType {
|
|||
}
|
||||
|
||||
if (qs.sortBy) {
|
||||
qs[`sort[${qs.sortBy}]`] = qs.sortOrder ?? 'ASC';
|
||||
qs[`sort[${qs.sortBy}]`] = qs.sortOrder || 'ASC';
|
||||
}
|
||||
|
||||
if (qs.exactMatch === true) {
|
||||
|
|
|
@ -37,7 +37,7 @@ export async function ghostApiRequest(
|
|||
const options: OptionsWithUri = {
|
||||
method,
|
||||
qs: query,
|
||||
uri: uri ?? `${credentials.url}/ghost/api/${version}${endpoint}`,
|
||||
uri: uri || `${credentials.url}/ghost/api/${version}${endpoint}`,
|
||||
body,
|
||||
json: true,
|
||||
};
|
||||
|
|
|
@ -291,7 +291,7 @@ export class Ghost implements INodeType {
|
|||
const post: IDataObject = {};
|
||||
|
||||
if (contentFormat === 'html') {
|
||||
post.html = updateFields.content ?? '';
|
||||
post.html = updateFields.content || '';
|
||||
qs.source = 'html';
|
||||
delete updateFields.content;
|
||||
} else {
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://analyticsreporting.googleapis.com${endpoint}`,
|
||||
uri: uri || `https://analyticsreporting.googleapis.com${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ async function getAccessToken(
|
|||
const signature = jwt.sign(
|
||||
{
|
||||
iss: credentials.email as string,
|
||||
sub: credentials.delegatedEmail ?? (credentials.email as string),
|
||||
sub: credentials.delegatedEmail || (credentials.email as string),
|
||||
scope: scopes.join(' '),
|
||||
aud: 'https://oauth2.googleapis.com/token',
|
||||
iat: now,
|
||||
|
@ -79,7 +79,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://bigquery.googleapis.com/bigquery${resource}`,
|
||||
uri: uri || `https://bigquery.googleapis.com/bigquery${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -31,7 +31,7 @@ async function getAccessToken(
|
|||
const signature = jwt.sign(
|
||||
{
|
||||
iss: credentials.email,
|
||||
sub: credentials.delegatedEmail ?? credentials.email,
|
||||
sub: credentials.delegatedEmail || credentials.email,
|
||||
scope: scopes.join(' '),
|
||||
aud: 'https://oauth2.googleapis.com/token',
|
||||
iat: now,
|
||||
|
@ -86,7 +86,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://www.googleapis.com/books/${resource}`,
|
||||
uri: uri || `https://www.googleapis.com/books/${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -29,7 +29,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://www.googleapis.com${resource}`,
|
||||
uri: uri || `https://www.googleapis.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -144,7 +144,7 @@ export class GoogleCalendar implements INodeType {
|
|||
const timeMin = this.getNodeParameter('timeMin', i) as string;
|
||||
const timeMax = this.getNodeParameter('timeMax', i) as string;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
const outputFormat = options.outputFormat ?? 'availability';
|
||||
const outputFormat = options.outputFormat || 'availability';
|
||||
const tz = this.getNodeParameter('options.timezone', i, '', {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
|
|
|
@ -41,7 +41,7 @@ export async function getAccessToken(
|
|||
const signature = jwt.sign(
|
||||
{
|
||||
iss: credentials.email,
|
||||
sub: credentials.delegatedEmail ?? credentials.email,
|
||||
sub: credentials.delegatedEmail || credentials.email,
|
||||
scope: scopes.join(' '),
|
||||
aud: 'https://oauth2.googleapis.com/token',
|
||||
iat: now,
|
||||
|
@ -92,7 +92,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://chat.googleapis.com${resource}`,
|
||||
uri: uri || `https://chat.googleapis.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://language.googleapis.com${endpoint}`,
|
||||
uri: uri || `https://language.googleapis.com${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -262,8 +262,8 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
|||
if (operation === 'analyzeSentiment') {
|
||||
const source = this.getNodeParameter('source', i) as string;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
const encodingType = (options.encodingType as string | undefined) ?? 'UTF16';
|
||||
const documentType = (options.documentType as string | undefined) ?? 'PLAIN_TEXT';
|
||||
const encodingType = (options.encodingType as string | undefined) || 'UTF16';
|
||||
const documentType = (options.documentType as string | undefined) || 'PLAIN_TEXT';
|
||||
|
||||
const body: IData = {
|
||||
document: {
|
||||
|
|
|
@ -21,7 +21,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://people.googleapis.com/v1${resource}`,
|
||||
uri: uri || `https://people.googleapis.com/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -35,7 +35,7 @@ async function getAccessToken(
|
|||
const signature = jwt.sign(
|
||||
{
|
||||
iss: credentials.email,
|
||||
sub: credentials.delegatedEmail ?? credentials.email,
|
||||
sub: credentials.delegatedEmail || credentials.email,
|
||||
scope: scopes.join(' '),
|
||||
aud: 'https://oauth2.googleapis.com/token',
|
||||
iat: now,
|
||||
|
@ -89,7 +89,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://docs.googleapis.com/v1${endpoint}`,
|
||||
uri: uri || `https://docs.googleapis.com/v1${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ async function getAccessToken(
|
|||
const signature = jwt.sign(
|
||||
{
|
||||
iss: credentials.email,
|
||||
sub: credentials.delegatedEmail ?? credentials.email,
|
||||
sub: credentials.delegatedEmail || credentials.email,
|
||||
scope: scopes.join(' '),
|
||||
aud: 'https://oauth2.googleapis.com/token',
|
||||
iat: now,
|
||||
|
@ -91,7 +91,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://www.googleapis.com${resource}`,
|
||||
uri: uri || `https://www.googleapis.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
@ -136,8 +136,8 @@ export async function googleApiRequestAllItems(
|
|||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
query.maxResults = query.maxResults ?? 100;
|
||||
query.pageSize = query.pageSize ?? 100;
|
||||
query.maxResults = query.maxResults || 100;
|
||||
query.pageSize = query.pageSize || 100;
|
||||
|
||||
do {
|
||||
responseData = await googleApiRequest.call(this, method, endpoint, body, query);
|
||||
|
|
|
@ -2652,7 +2652,7 @@ export class GoogleDrive implements INodeType {
|
|||
const body = {
|
||||
name,
|
||||
mimeType: 'application/vnd.google-apps.folder',
|
||||
parents: options.parents ?? [],
|
||||
parents: options.parents || [],
|
||||
};
|
||||
|
||||
const qs = {
|
||||
|
|
|
@ -25,7 +25,7 @@ export async function googleApiRequest(
|
|||
qsStringifyOptions: {
|
||||
arrayFormat: 'repeat',
|
||||
},
|
||||
uri: uri ?? `https://firestore.googleapis.com/v1/projects${resource}`,
|
||||
uri: uri || `https://firestore.googleapis.com/v1/projects${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
url: uri ?? `https://${projectId}.${region}/${resource}.json`,
|
||||
url: uri || `https://${projectId}.${region}/${resource}.json`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://www.googleapis.com/admin${resource}`,
|
||||
uri: uri || `https://www.googleapis.com/admin${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -116,7 +116,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://www.googleapis.com${endpoint}`,
|
||||
uri: uri || `https://www.googleapis.com${endpoint}`,
|
||||
qsStringifyOptions: {
|
||||
arrayFormat: 'repeat',
|
||||
},
|
||||
|
@ -528,7 +528,7 @@ export async function prepareEmailAttachments(
|
|||
}
|
||||
|
||||
attachmentsList.push({
|
||||
name: binaryData.fileName ?? 'unknown',
|
||||
name: binaryData.fileName || 'unknown',
|
||||
content: binaryDataBuffer,
|
||||
type: binaryData.mimeType,
|
||||
});
|
||||
|
|
|
@ -324,7 +324,7 @@ export class GmailV1 implements INodeType {
|
|||
binaryProperty,
|
||||
);
|
||||
attachmentsBinary.push({
|
||||
name: binaryData.fileName ?? 'unknown',
|
||||
name: binaryData.fileName || 'unknown',
|
||||
content: binaryDataBuffer,
|
||||
type: binaryData.mimeType,
|
||||
});
|
||||
|
@ -414,7 +414,7 @@ export class GmailV1 implements INodeType {
|
|||
binaryProperty,
|
||||
);
|
||||
attachmentsBinary.push({
|
||||
name: binaryData.fileName ?? 'unknown',
|
||||
name: binaryData.fileName || 'unknown',
|
||||
content: binaryDataBuffer,
|
||||
type: binaryData.mimeType,
|
||||
});
|
||||
|
@ -489,7 +489,7 @@ export class GmailV1 implements INodeType {
|
|||
const id = this.getNodeParameter('messageId', i);
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const format = additionalFields.format ?? 'resolved';
|
||||
const format = additionalFields.format || 'resolved';
|
||||
|
||||
if (format === 'resolved') {
|
||||
qs.format = 'raw';
|
||||
|
@ -557,7 +557,7 @@ export class GmailV1 implements INodeType {
|
|||
responseData = [];
|
||||
}
|
||||
|
||||
const format = additionalFields.format ?? 'resolved';
|
||||
const format = additionalFields.format || 'resolved';
|
||||
|
||||
if (format !== 'ids') {
|
||||
if (format === 'resolved') {
|
||||
|
@ -658,7 +658,7 @@ export class GmailV1 implements INodeType {
|
|||
binaryProperty,
|
||||
);
|
||||
attachmentsBinary.push({
|
||||
name: binaryData.fileName ?? 'unknown',
|
||||
name: binaryData.fileName || 'unknown',
|
||||
content: binaryDataBuffer,
|
||||
type: binaryData.mimeType,
|
||||
});
|
||||
|
@ -707,7 +707,7 @@ export class GmailV1 implements INodeType {
|
|||
const id = this.getNodeParameter('messageId', i);
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const format = additionalFields.format ?? 'resolved';
|
||||
const format = additionalFields.format || 'resolved';
|
||||
|
||||
if (format === 'resolved') {
|
||||
qs.format = 'raw';
|
||||
|
@ -785,7 +785,7 @@ export class GmailV1 implements INodeType {
|
|||
responseData = [];
|
||||
}
|
||||
|
||||
const format = additionalFields.format ?? 'resolved';
|
||||
const format = additionalFields.format || 'resolved';
|
||||
|
||||
if (format !== 'ids') {
|
||||
if (format === 'resolved') {
|
||||
|
|
|
@ -678,7 +678,7 @@ export class GmailV2 implements INodeType {
|
|||
const endpoint = `/gmail/v1/users/me/threads/${id}`;
|
||||
|
||||
const options = this.getNodeParameter('options', i);
|
||||
const onlyMessages = options.returnOnlyMessages ?? false;
|
||||
const onlyMessages = options.returnOnlyMessages || false;
|
||||
const qs: IDataObject = {};
|
||||
|
||||
const simple = this.getNodeParameter('simple', i) as boolean;
|
||||
|
|
|
@ -490,8 +490,8 @@ export class GoogleSheetsTrigger implements INodeType {
|
|||
}
|
||||
|
||||
const [rangeFrom, rangeTo] = range.split(':');
|
||||
const cellDataFrom = rangeFrom.match(/([a-zA-Z]{1,10})([0-9]{0,10})/) ?? [];
|
||||
const cellDataTo = rangeTo.match(/([a-zA-Z]{1,10})([0-9]{0,10})/) ?? [];
|
||||
const cellDataFrom = rangeFrom.match(/([a-zA-Z]{1,10})([0-9]{0,10})/) || [];
|
||||
const cellDataTo = rangeTo.match(/([a-zA-Z]{1,10})([0-9]{0,10})/) || [];
|
||||
|
||||
if (rangeDefinition === 'specifyRangeA1' && cellDataFrom[2] !== undefined) {
|
||||
keyRange = `${cellDataFrom[1]}${+cellDataFrom[2]}:${cellDataTo[1]}${+cellDataFrom[2]}`;
|
||||
|
@ -544,7 +544,7 @@ export class GoogleSheetsTrigger implements INodeType {
|
|||
return null;
|
||||
}
|
||||
|
||||
const addedRows = sheetData?.slice(workflowStaticData.lastIndexChecked as number) ?? [];
|
||||
const addedRows = sheetData?.slice(workflowStaticData.lastIndexChecked as number) || [];
|
||||
const returnData = arrayOfArraysToJson(addedRows, columns);
|
||||
|
||||
workflowStaticData.lastIndexChecked = sheetData.length;
|
||||
|
|
|
@ -39,7 +39,7 @@ export async function getAccessToken(
|
|||
const signature = jwt.sign(
|
||||
{
|
||||
iss: credentials.email,
|
||||
sub: credentials.delegatedEmail ?? credentials.email,
|
||||
sub: credentials.delegatedEmail || credentials.email,
|
||||
scope: scopes.join(' '),
|
||||
aud: 'https://oauth2.googleapis.com/token',
|
||||
iat: now,
|
||||
|
@ -94,7 +94,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://sheets.googleapis.com${resource}`,
|
||||
uri: uri || `https://sheets.googleapis.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -117,8 +117,8 @@ export class GoogleSheetsV1 implements INodeType {
|
|||
|
||||
const options = this.getNodeParameter('options', 0, {});
|
||||
|
||||
const valueInputMode = (options.valueInputMode ?? 'RAW') as ValueInputOption;
|
||||
const valueRenderMode = (options.valueRenderMode ?? 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
const valueInputMode = (options.valueInputMode || 'RAW') as ValueInputOption;
|
||||
const valueRenderMode = (options.valueRenderMode || 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
|
||||
if (operation === 'append') {
|
||||
// ----------------------------------
|
||||
|
@ -134,7 +134,7 @@ export class GoogleSheetsV1 implements INodeType {
|
|||
setData.push(item.json);
|
||||
});
|
||||
|
||||
const usePathForKeyRow = (options.usePathForKeyRow ?? false) as boolean;
|
||||
const usePathForKeyRow = (options.usePathForKeyRow || false) as boolean;
|
||||
|
||||
// Convert data into array format
|
||||
const _data = await sheet.appendSheetData(
|
||||
|
|
|
@ -172,7 +172,7 @@ export async function execute(
|
|||
|
||||
const options = this.getNodeParameter('options', 0, {});
|
||||
|
||||
const valueRenderMode = (options.valueRenderMode ?? 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
const valueRenderMode = (options.valueRenderMode || 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
|
||||
const locationDefineOption = (options.locationDefine as IDataObject)?.values as IDataObject;
|
||||
|
||||
|
|
|
@ -124,9 +124,9 @@ export async function execute(
|
|||
|
||||
const range = getRangeString(sheetName, dataLocationOnSheetOptions);
|
||||
|
||||
const valueRenderMode = (outputFormattingOption.general ??
|
||||
const valueRenderMode = (outputFormattingOption.general ||
|
||||
'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
const dateTimeRenderOption = (outputFormattingOption.date ?? 'FORMATTED_STRING') as string;
|
||||
const dateTimeRenderOption = (outputFormattingOption.date || 'FORMATTED_STRING') as string;
|
||||
|
||||
const sheetData = (await sheet.getData(
|
||||
range,
|
||||
|
|
|
@ -171,7 +171,7 @@ export async function execute(
|
|||
|
||||
const options = this.getNodeParameter('options', 0, {});
|
||||
|
||||
const valueRenderMode = (options.valueRenderMode ?? 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
const valueRenderMode = (options.valueRenderMode || 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
|
||||
const locationDefineOptions = (options.locationDefine as IDataObject)?.values as IDataObject;
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ export class GoogleSheet {
|
|||
// );
|
||||
|
||||
const lastRowWithData =
|
||||
lastRow ??
|
||||
lastRow ||
|
||||
(((await this.getData(range, 'UNFORMATTED_VALUE')) as string[][]) || []).length + 1;
|
||||
|
||||
const response = await this.updateRows(
|
||||
|
@ -403,10 +403,10 @@ export class GoogleSheet {
|
|||
columnValuesList = sheetData.slice(dataStartRowIndex - 1).map((row) => row[keyIndex]);
|
||||
} else {
|
||||
const decodedRange = this.getDecodedSheetRange(range);
|
||||
const startRowIndex = decodedRange.start?.row ?? dataStartRowIndex;
|
||||
const endRowIndex = decodedRange.end?.row ?? '';
|
||||
const startRowIndex = decodedRange.start?.row || dataStartRowIndex;
|
||||
const endRowIndex = decodedRange.end?.row || '';
|
||||
|
||||
const keyColumn = this.getColumnWithOffset(decodedRange.start?.column ?? 'A', keyIndex);
|
||||
const keyColumn = this.getColumnWithOffset(decodedRange.start?.column || 'A', keyIndex);
|
||||
const keyColumnRange = `${decodedRange.name}!${keyColumn}${startRowIndex}:${keyColumn}${endRowIndex}`;
|
||||
columnValuesList = await this.getData(keyColumnRange, valueRenderMode);
|
||||
}
|
||||
|
@ -446,9 +446,9 @@ export class GoogleSheet {
|
|||
) {
|
||||
const decodedRange = this.getDecodedSheetRange(range);
|
||||
// prettier-ignore
|
||||
const keyRowRange = `${decodedRange.name}!${decodedRange.start?.column ?? ''}${keyRowIndex + 1}:${decodedRange.end?.column ?? ''}${keyRowIndex + 1}`;
|
||||
const keyRowRange = `${decodedRange.name}!${decodedRange.start?.column || ''}${keyRowIndex + 1}:${decodedRange.end?.column || ''}${keyRowIndex + 1}`;
|
||||
|
||||
const sheetDatakeyRow = columnNamesList ?? (await this.getData(keyRowRange, valueRenderMode));
|
||||
const sheetDatakeyRow = columnNamesList || (await this.getData(keyRowRange, valueRenderMode));
|
||||
|
||||
if (sheetDatakeyRow === undefined) {
|
||||
throw new NodeOperationError(
|
||||
|
@ -469,7 +469,7 @@ export class GoogleSheet {
|
|||
}
|
||||
|
||||
const columnValues: Array<string | number> =
|
||||
columnValuesList ??
|
||||
columnValuesList ||
|
||||
(await this.getColumnValues(range, keyIndex, dataStartRowIndex, valueRenderMode));
|
||||
|
||||
const updateData: ISheetUpdateData[] = [];
|
||||
|
@ -527,7 +527,7 @@ export class GoogleSheet {
|
|||
// Property exists so add it to the data to update
|
||||
// Get the column name in which the property data can be found
|
||||
const columnToUpdate = this.getColumnWithOffset(
|
||||
decodedRange.start?.column ?? 'A',
|
||||
decodedRange.start?.column || 'A',
|
||||
columnNames.indexOf(name),
|
||||
);
|
||||
|
||||
|
@ -640,7 +640,7 @@ export class GoogleSheet {
|
|||
const decodedRange = this.getDecodedSheetRange(range);
|
||||
|
||||
const columnNamesRow =
|
||||
columnNamesList ??
|
||||
columnNamesList ||
|
||||
(await this.getData(
|
||||
`${decodedRange.name}!${keyRowIndex}:${keyRowIndex}`,
|
||||
'UNFORMATTED_VALUE',
|
||||
|
@ -704,7 +704,7 @@ export class GoogleSheet {
|
|||
}
|
||||
|
||||
private splitCellRange(cell: string, range: string): SheetCellDecoded {
|
||||
const cellData = cell.match(/([a-zA-Z]{1,10})([0-9]{0,10})/) ?? [];
|
||||
const cellData = cell.match(/([a-zA-Z]{1,10})([0-9]{0,10})/) || [];
|
||||
|
||||
if (cellData === null || cellData.length !== 3) {
|
||||
throw new NodeOperationError(
|
||||
|
|
|
@ -36,7 +36,7 @@ export async function getAccessToken(
|
|||
const signature = jwt.sign(
|
||||
{
|
||||
iss: credentials.email,
|
||||
sub: credentials.delegatedEmail ?? credentials.email,
|
||||
sub: credentials.delegatedEmail || credentials.email,
|
||||
scope: scopes.join(' '),
|
||||
aud: 'https://oauth2.googleapis.com/token',
|
||||
iat: now,
|
||||
|
@ -91,7 +91,7 @@ export async function apiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://sheets.googleapis.com${resource}`,
|
||||
uri: uri || `https://sheets.googleapis.com${resource}`,
|
||||
json: true,
|
||||
...option,
|
||||
};
|
||||
|
|
|
@ -542,7 +542,7 @@ export class GoogleSlides implements INodeType {
|
|||
return {
|
||||
replaceAllText: {
|
||||
replaceText: text.replaceText,
|
||||
pageObjectIds: text.pageObjectIds ?? [],
|
||||
pageObjectIds: text.pageObjectIds || [],
|
||||
containsText: {
|
||||
text: text.text,
|
||||
matchCase: text.matchCase,
|
||||
|
|
|
@ -20,7 +20,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://www.googleapis.com${resource}`,
|
||||
uri: uri || `https://www.googleapis.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://translation.googleapis.com${resource}`,
|
||||
uri: uri || `https://translation.googleapis.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -21,7 +21,7 @@ export async function googleApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://www.googleapis.com${resource}`,
|
||||
uri: uri || `https://www.googleapis.com${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -24,7 +24,7 @@ export async function gotifyApiRequest(
|
|||
},
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `${credentials.url}${path}`,
|
||||
uri: uri || `${credentials.url}${path}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -335,7 +335,7 @@ export class GraphQL implements INodeType {
|
|||
const responseFormat = this.getNodeParameter('responseFormat', 0) as string;
|
||||
const { parameter }: { parameter?: Array<{ name: string; value: string }> } =
|
||||
this.getNodeParameter('headerParametersUi', itemIndex, {}) as IDataObject;
|
||||
const headerParameters = (parameter ?? []).reduce(
|
||||
const headerParameters = (parameter || []).reduce(
|
||||
(result, item) => ({
|
||||
...result,
|
||||
[item.name]: item.value,
|
||||
|
|
|
@ -30,7 +30,7 @@ export async function gumroadApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api.gumroad.com/v2${resource}`,
|
||||
uri: uri || `https://api.gumroad.com/v2${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function harvestApiRequest(
|
|||
},
|
||||
method,
|
||||
body,
|
||||
uri: uri ?? `https://api.harvestapp.com/v2/${path}`,
|
||||
uri: uri || `https://api.harvestapp.com/v2/${path}`,
|
||||
qs,
|
||||
json: true,
|
||||
};
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function helpscoutApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://api.helpscout.net${resource}`,
|
||||
uri: uri || `https://api.helpscout.net${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -504,7 +504,7 @@ export class HelpScout implements INodeType {
|
|||
];
|
||||
if (binaryProperty) {
|
||||
return {
|
||||
fileName: binaryProperty.fileName ?? 'unknown',
|
||||
fileName: binaryProperty.fileName || 'unknown',
|
||||
data: binaryProperty.data,
|
||||
mimeType: binaryProperty.mimeType,
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@ export async function dueDatePreSendAction(
|
|||
);
|
||||
}
|
||||
const dueDate = dateToIsoSupressMillis(dueDateParam);
|
||||
requestOptions.body = (requestOptions.body ?? {}) as object;
|
||||
requestOptions.body = (requestOptions.body || {}) as object;
|
||||
Object.assign(requestOptions.body, { dueDate });
|
||||
return requestOptions;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export async function contactIdentifierPreSendAction(
|
|||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
requestOptions.body = (requestOptions.body ?? {}) as object;
|
||||
requestOptions.body = (requestOptions.body || {}) as object;
|
||||
let identifier = this.getNodeParameter('contactIdentifier', null) as string;
|
||||
if (!identifier) {
|
||||
const fields = this.getNodeParameter('updateFields') as { contactIdentifier: string };
|
||||
|
@ -93,7 +93,7 @@ export async function validEmailAndPhonePreSendAction(
|
|||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const body = (requestOptions.body ?? {}) as { email?: string; phone?: string };
|
||||
const body = (requestOptions.body || {}) as { email?: string; phone?: string };
|
||||
|
||||
if (body.email && !isEmailValid(body.email)) {
|
||||
const message = `email "${body.email}" has invalid format`;
|
||||
|
@ -112,7 +112,7 @@ export async function dateTimeToEpochPreSendAction(
|
|||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const qs = (requestOptions.qs ?? {}) as {
|
||||
const qs = (requestOptions.qs || {}) as {
|
||||
startDate?: string | number;
|
||||
endDate?: string | number;
|
||||
};
|
||||
|
@ -141,7 +141,7 @@ export async function highLevelApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://rest.gohighlevel.com/v1${resource}`,
|
||||
uri: uri || `https://rest.gohighlevel.com/v1${resource}`,
|
||||
json: true,
|
||||
};
|
||||
if (!Object.keys(body).length) {
|
||||
|
@ -158,14 +158,14 @@ export async function opportunityUpdatePreSendAction(
|
|||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const body = (requestOptions.body ?? {}) as { title?: string; status?: string };
|
||||
const body = (requestOptions.body || {}) as { title?: string; status?: string };
|
||||
if (!body.status || !body.title) {
|
||||
const pipelineId = this.getNodeParameter('pipelineId');
|
||||
const opportunityId = this.getNodeParameter('opportunityId');
|
||||
const resource = `/pipelines/${pipelineId}/opportunities/${opportunityId}`;
|
||||
const responseData = await highLevelApiRequest.call(this, 'GET', resource);
|
||||
body.status = body.status ?? responseData.status;
|
||||
body.title = body.title ?? responseData.name;
|
||||
body.status = body.status || responseData.status;
|
||||
body.title = body.title || responseData.name;
|
||||
requestOptions.body = body;
|
||||
}
|
||||
return requestOptions;
|
||||
|
@ -175,15 +175,15 @@ export async function taskUpdatePreSendAction(
|
|||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const body = (requestOptions.body ?? {}) as { title?: string; dueDate?: string };
|
||||
const body = (requestOptions.body || {}) as { title?: string; dueDate?: string };
|
||||
if (!body.title || !body.dueDate) {
|
||||
const contactId = this.getNodeParameter('contactId');
|
||||
const taskId = this.getNodeParameter('taskId');
|
||||
const resource = `/contacts/${contactId}/tasks/${taskId}`;
|
||||
const responseData = await highLevelApiRequest.call(this, 'GET', resource);
|
||||
body.title = body.title ?? responseData.title;
|
||||
body.title = body.title || responseData.title;
|
||||
// the api response dueDate has to be formatted or it will error on update
|
||||
body.dueDate = body.dueDate ?? dateToIsoSupressMillis(responseData.dueDate);
|
||||
body.dueDate = body.dueDate || dateToIsoSupressMillis(responseData.dueDate);
|
||||
requestOptions.body = body;
|
||||
}
|
||||
return requestOptions;
|
||||
|
@ -193,7 +193,7 @@ export async function splitTagsPreSendAction(
|
|||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const body = (requestOptions.body ?? {}) as IDataObject;
|
||||
const body = (requestOptions.body || {}) as IDataObject;
|
||||
if (body.tags) {
|
||||
if (Array.isArray(body.tags)) return requestOptions;
|
||||
body.tags = (body.tags as string).split(',').map((tag) => tag.trim());
|
||||
|
@ -215,7 +215,7 @@ export async function highLevelApiPagination(
|
|||
};
|
||||
const rootProperty = resourceMapping[resource];
|
||||
|
||||
requestData.options.qs = requestData.options.qs ?? {};
|
||||
requestData.options.qs = requestData.options.qs || {};
|
||||
if (returnAll) requestData.options.qs.limit = 100;
|
||||
|
||||
let responseTotal = 0;
|
||||
|
|
|
@ -79,7 +79,7 @@ export async function getHomeAssistantServices(
|
|||
for (const domainService of domainServices) {
|
||||
for (const [serviceID, value] of Object.entries(domainService.services)) {
|
||||
const serviceProperties = value as IDataObject;
|
||||
const serviceName = serviceProperties.description ?? serviceID;
|
||||
const serviceName = serviceProperties.description || serviceID;
|
||||
returnData.push({
|
||||
name: serviceName as string,
|
||||
value: serviceID,
|
||||
|
|
|
@ -24,7 +24,7 @@ const extractFunctions: {
|
|||
} = {
|
||||
attribute: ($: Cheerio, valueData: IValueData): string | undefined =>
|
||||
$.attr(valueData.attribute!),
|
||||
html: ($: Cheerio, _valueData: IValueData): string | undefined => $.html() ?? undefined,
|
||||
html: ($: Cheerio, _valueData: IValueData): string | undefined => $.html() || undefined,
|
||||
text: ($: Cheerio, _valueData: IValueData): string | undefined => $.text(),
|
||||
value: ($: Cheerio, _valueData: IValueData): string | undefined => $.val(),
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ export async function hubspotApiRequest(
|
|||
method,
|
||||
qs: query,
|
||||
headers: {},
|
||||
uri: uri ?? `https://api.hubapi.com${endpoint}`,
|
||||
uri: uri || `https://api.hubapi.com${endpoint}`,
|
||||
body,
|
||||
json: true,
|
||||
useQuerystring: true,
|
||||
|
@ -85,7 +85,7 @@ export async function hubspotApiRequestAllItems(
|
|||
|
||||
let responseData;
|
||||
|
||||
query.limit = query.limit ?? 250;
|
||||
query.limit = query.limit || 250;
|
||||
query.count = 100;
|
||||
body.limit = body.limit || 100;
|
||||
|
||||
|
|
|
@ -1412,8 +1412,8 @@ export class Hubspot implements INodeType {
|
|||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
const filtersGroupsUi = this.getNodeParameter('filterGroupsUi', i) as IDataObject;
|
||||
const sortBy = additionalFields.sortBy ?? 'createdate';
|
||||
const direction = additionalFields.direction ?? 'DESCENDING';
|
||||
const sortBy = additionalFields.sortBy || 'createdate';
|
||||
const direction = additionalFields.direction || 'DESCENDING';
|
||||
|
||||
const body: IDataObject = {
|
||||
sorts: [
|
||||
|
@ -2232,8 +2232,8 @@ export class Hubspot implements INodeType {
|
|||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
const filtersGroupsUi = this.getNodeParameter('filterGroupsUi', i) as IDataObject;
|
||||
const sortBy = additionalFields.sortBy ?? 'createdate';
|
||||
const direction = additionalFields.direction ?? 'DESCENDING';
|
||||
const sortBy = additionalFields.sortBy || 'createdate';
|
||||
const direction = additionalFields.direction || 'DESCENDING';
|
||||
|
||||
const body: IDataObject = {
|
||||
sorts: [
|
||||
|
|
|
@ -320,7 +320,7 @@ export class HubspotTrigger implements INodeType {
|
|||
let endpoint = `/webhooks/v3/${appId}/settings`;
|
||||
let body: IDataObject = {
|
||||
targetUrl: webhookUrl,
|
||||
maxConcurrentRequests: additionalFields.maxConcurrentRequests ?? 5,
|
||||
maxConcurrentRequests: additionalFields.maxConcurrentRequests || 5,
|
||||
};
|
||||
|
||||
await hubspotApiRequest.call(this, 'PUT', endpoint, body);
|
||||
|
|
|
@ -23,7 +23,7 @@ export async function hunterApiRequest(
|
|||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ?? `https://api.hunter.io/v2${resource}`,
|
||||
uri: uri || `https://api.hunter.io/v2${resource}`,
|
||||
json: true,
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
|
|
|
@ -324,13 +324,13 @@ export class If implements INodeType {
|
|||
[key: string]: (value1: NodeParameterValue, value2: NodeParameterValue) => boolean;
|
||||
} = {
|
||||
after: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 ?? 0) > (value2 ?? 0),
|
||||
(value1 || 0) > (value2 || 0),
|
||||
before: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 ?? 0) < (value2 ?? 0),
|
||||
(value1 || 0) < (value2 || 0),
|
||||
contains: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 ?? '').toString().includes((value2 ?? '').toString()),
|
||||
(value1 || '').toString().includes((value2 || '').toString()),
|
||||
notContains: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
!(value1 ?? '').toString().includes((value2 ?? '').toString()),
|
||||
!(value1 || '').toString().includes((value2 || '').toString()),
|
||||
endsWith: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 as string).endsWith(value2 as string),
|
||||
notEndsWith: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
|
@ -338,13 +338,13 @@ export class If implements INodeType {
|
|||
equal: (value1: NodeParameterValue, value2: NodeParameterValue) => value1 === value2,
|
||||
notEqual: (value1: NodeParameterValue, value2: NodeParameterValue) => value1 !== value2,
|
||||
larger: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 ?? 0) > (value2 ?? 0),
|
||||
(value1 || 0) > (value2 || 0),
|
||||
largerEqual: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 ?? 0) >= (value2 ?? 0),
|
||||
(value1 || 0) >= (value2 || 0),
|
||||
smaller: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 ?? 0) < (value2 ?? 0),
|
||||
(value1 || 0) < (value2 || 0),
|
||||
smallerEqual: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 ?? 0) <= (value2 ?? 0),
|
||||
(value1 || 0) <= (value2 || 0),
|
||||
startsWith: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
(value1 as string).startsWith(value2 as string),
|
||||
notStartsWith: (value1: NodeParameterValue, value2: NodeParameterValue) =>
|
||||
|
@ -364,32 +364,32 @@ export class If implements INodeType {
|
|||
(isDateObject(value1) && isDateInvalid(value1))
|
||||
),
|
||||
regex: (value1: NodeParameterValue, value2: NodeParameterValue) => {
|
||||
const regexMatch = (value2 ?? '').toString().match(new RegExp('^/(.*?)/([gimusy]*)$'));
|
||||
const regexMatch = (value2 || '').toString().match(new RegExp('^/(.*?)/([gimusy]*)$'));
|
||||
|
||||
let regex: RegExp;
|
||||
if (!regexMatch) {
|
||||
regex = new RegExp((value2 ?? '').toString());
|
||||
regex = new RegExp((value2 || '').toString());
|
||||
} else if (regexMatch.length === 1) {
|
||||
regex = new RegExp(regexMatch[1]);
|
||||
} else {
|
||||
regex = new RegExp(regexMatch[1], regexMatch[2]);
|
||||
}
|
||||
|
||||
return !!(value1 ?? '').toString().match(regex);
|
||||
return !!(value1 || '').toString().match(regex);
|
||||
},
|
||||
notRegex: (value1: NodeParameterValue, value2: NodeParameterValue) => {
|
||||
const regexMatch = (value2 ?? '').toString().match(new RegExp('^/(.*?)/([gimusy]*)$'));
|
||||
const regexMatch = (value2 || '').toString().match(new RegExp('^/(.*?)/([gimusy]*)$'));
|
||||
|
||||
let regex: RegExp;
|
||||
if (!regexMatch) {
|
||||
regex = new RegExp((value2 ?? '').toString());
|
||||
regex = new RegExp((value2 || '').toString());
|
||||
} else if (regexMatch.length === 1) {
|
||||
regex = new RegExp(regexMatch[1]);
|
||||
} else {
|
||||
regex = new RegExp(regexMatch[1], regexMatch[2]);
|
||||
}
|
||||
|
||||
return !(value1 ?? '').toString().match(regex);
|
||||
return !(value1 || '').toString().match(regex);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ export async function intercomApiRequest(
|
|||
headers: headerWithAuthentication,
|
||||
method,
|
||||
qs: query,
|
||||
uri: uri ?? `https://api.intercom.io${endpoint}`,
|
||||
uri: uri || `https://api.intercom.io${endpoint}`,
|
||||
body,
|
||||
json: true,
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ export async function invoiceNinjaApiRequest(
|
|||
const options: OptionsWithUri = {
|
||||
method,
|
||||
qs: query,
|
||||
uri: uri ?? `${baseUrl}/api/v1${endpoint}`,
|
||||
uri: uri || `${baseUrl}/api/v1${endpoint}`,
|
||||
body,
|
||||
json: true,
|
||||
};
|
||||
|
|
|
@ -198,7 +198,7 @@ export class InvoiceNinja implements INodeType {
|
|||
'/invoices',
|
||||
);
|
||||
for (const invoice of invoices) {
|
||||
const invoiceName = (invoice.invoice_number ?? invoice.number) as string;
|
||||
const invoiceName = (invoice.invoice_number || invoice.number) as string;
|
||||
const invoiceId = invoice.id as string;
|
||||
returnData.push({
|
||||
name: invoiceName,
|
||||
|
|
|
@ -24,7 +24,7 @@ export async function iterableApiRequest(
|
|||
method,
|
||||
body,
|
||||
qs,
|
||||
uri: uri ?? `https://api.iterable.com/api${resource}`,
|
||||
uri: uri || `https://api.iterable.com/api${resource}`,
|
||||
json: true,
|
||||
};
|
||||
try {
|
||||
|
|
|
@ -40,7 +40,7 @@ export async function jiraSoftwareCloudApiRequest(
|
|||
},
|
||||
method,
|
||||
qs: query,
|
||||
uri: uri ?? `${domain}/rest${endpoint}`,
|
||||
uri: uri || `${domain}/rest${endpoint}`,
|
||||
body,
|
||||
json: true,
|
||||
};
|
||||
|
|
|
@ -286,7 +286,7 @@ export class Jira implements INodeType {
|
|||
if (user.active) {
|
||||
activeUsers.push({
|
||||
name: user.displayName as string,
|
||||
value: (user.accountId ?? user.name) as string,
|
||||
value: (user.accountId || user.name) as string,
|
||||
});
|
||||
}
|
||||
return activeUsers;
|
||||
|
@ -684,7 +684,7 @@ export class Jira implements INodeType {
|
|||
qs.expand = additionalFields.expand as string;
|
||||
}
|
||||
if (simplifyOutput) {
|
||||
qs.expand = `${qs.expand ?? ''},names`;
|
||||
qs.expand = `${qs.expand || ''},names`;
|
||||
}
|
||||
if (additionalFields.properties) {
|
||||
qs.properties = additionalFields.properties as string;
|
||||
|
@ -702,7 +702,7 @@ export class Jira implements INodeType {
|
|||
|
||||
if (simplifyOutput) {
|
||||
// Use rendered fields if requested and available
|
||||
qs.expand = qs.expand ?? '';
|
||||
qs.expand = qs.expand || '';
|
||||
if (
|
||||
(qs.expand as string).toLowerCase().indexOf('renderedfields') !== -1 &&
|
||||
responseData.renderedFields &&
|
||||
|
|
|
@ -32,7 +32,7 @@ export async function jotformApiRequest(
|
|||
method,
|
||||
qs,
|
||||
form: body,
|
||||
uri: uri ?? `https://${credentials.apiDomain || 'api.jotform.com'}${resource}`,
|
||||
uri: uri || `https://${credentials.apiDomain || 'api.jotform.com'}${resource}`,
|
||||
json: true,
|
||||
};
|
||||
if (!Object.keys(body).length) {
|
||||
|
|
|
@ -248,7 +248,7 @@ export class KafkaTrigger implements INodeType {
|
|||
const headers: { [key: string]: string } = {};
|
||||
for (const key of Object.keys(message.headers)) {
|
||||
const header = message.headers[key];
|
||||
headers[key] = header?.toString('utf8') ?? '';
|
||||
headers[key] = header?.toString('utf8') || '';
|
||||
}
|
||||
|
||||
data.headers = headers;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue