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