2023-01-27 03:22:44 -08:00
|
|
|
import type { OptionsWithUri } from 'request';
|
2021-07-23 13:28:18 -07:00
|
|
|
|
2023-01-27 03:22:44 -08:00
|
|
|
import type { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
2021-07-23 13:28:18 -07:00
|
|
|
|
2023-01-27 03:22:44 -08:00
|
|
|
import type {
|
2021-07-23 13:28:18 -07:00
|
|
|
ICredentialDataDecryptedObject,
|
|
|
|
IDataObject,
|
|
|
|
INodeProperties,
|
|
|
|
IWebhookFunctions,
|
2023-02-27 19:39:43 -08:00
|
|
|
JsonObject,
|
2021-07-23 13:28:18 -07:00
|
|
|
} from 'n8n-workflow';
|
2023-01-27 03:22:44 -08:00
|
|
|
import { NodeApiError } from 'n8n-workflow';
|
2021-07-23 13:28:18 -07:00
|
|
|
|
2023-02-23 07:16:05 -08:00
|
|
|
import upperFirst from 'lodash.upperfirst';
|
2021-07-23 13:28:18 -07:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
import { createHash } from 'crypto';
|
2021-07-23 13:28:18 -07:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
export async function webexApiRequest(
|
|
|
|
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions,
|
|
|
|
method: string,
|
|
|
|
resource: string,
|
2022-12-02 06:25:21 -08:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
body: any = {},
|
|
|
|
qs: IDataObject = {},
|
|
|
|
uri?: string,
|
|
|
|
option: IDataObject = {},
|
|
|
|
): Promise<any> {
|
2021-07-23 13:28:18 -07:00
|
|
|
let options: OptionsWithUri = {
|
|
|
|
method,
|
|
|
|
body,
|
|
|
|
qs,
|
2023-01-19 04:37:19 -08:00
|
|
|
uri: uri || `https://webexapis.com/v1${resource}`,
|
2021-07-23 13:28:18 -07:00
|
|
|
json: true,
|
|
|
|
};
|
|
|
|
try {
|
|
|
|
if (Object.keys(option).length !== 0) {
|
|
|
|
options = Object.assign({}, options, option);
|
|
|
|
}
|
2023-02-27 19:39:43 -08:00
|
|
|
if (Object.keys(body as IDataObject).length === 0) {
|
2021-07-23 13:28:18 -07:00
|
|
|
delete options.body;
|
|
|
|
}
|
|
|
|
if (Object.keys(qs).length === 0) {
|
|
|
|
delete options.qs;
|
|
|
|
}
|
|
|
|
//@ts-ignore
|
2022-12-23 10:09:52 -08:00
|
|
|
return await this.helpers.requestOAuth2.call(this, 'ciscoWebexOAuth2Api', options, {
|
2022-08-01 13:47:55 -07:00
|
|
|
tokenType: 'Bearer',
|
|
|
|
});
|
2021-07-23 13:28:18 -07:00
|
|
|
} catch (error) {
|
2023-02-27 19:39:43 -08:00
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
2021-07-23 13:28:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
export async function webexApiRequestAllItems(
|
|
|
|
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
|
|
|
propertyName: string,
|
|
|
|
method: string,
|
|
|
|
endpoint: string,
|
2022-12-02 06:25:21 -08:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
body: any = {},
|
|
|
|
query: IDataObject = {},
|
|
|
|
options: IDataObject = {},
|
|
|
|
): Promise<any> {
|
2021-07-23 13:28:18 -07:00
|
|
|
const returnData: IDataObject[] = [];
|
|
|
|
|
|
|
|
let responseData;
|
|
|
|
let uri: string | undefined;
|
|
|
|
query.max = 100;
|
|
|
|
do {
|
2022-08-01 13:47:55 -07:00
|
|
|
responseData = await webexApiRequest.call(this, method, endpoint, body, query, uri, {
|
|
|
|
resolveWithFullResponse: true,
|
|
|
|
...options,
|
|
|
|
});
|
2021-07-23 13:28:18 -07:00
|
|
|
if (responseData.headers.link) {
|
2022-12-02 12:54:28 -08:00
|
|
|
uri = responseData.headers.link.split(';')[0].replace('<', '').replace('>', '');
|
2021-07-23 13:28:18 -07:00
|
|
|
}
|
2023-02-27 19:39:43 -08:00
|
|
|
returnData.push.apply(returnData, responseData.body[propertyName] as IDataObject[]);
|
2022-12-02 12:54:28 -08:00
|
|
|
} while (responseData.headers.link?.includes('rel="next"'));
|
2021-07-23 13:28:18 -07:00
|
|
|
return returnData;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getEvents() {
|
|
|
|
const resourceEvents: { [key: string]: string[] } = {
|
2022-08-01 13:47:55 -07:00
|
|
|
attachmentAction: ['created', 'deleted', 'updated', '*'],
|
|
|
|
membership: ['created', 'deleted', 'updated', '*'],
|
|
|
|
message: ['created', 'deleted', 'updated', '*'],
|
|
|
|
room: ['created', 'deleted', 'updated', '*'],
|
|
|
|
meeting: ['created', 'deleted', 'updated', 'started', 'ended', '*'],
|
|
|
|
recording: ['created', 'deleted', 'updated', '*'],
|
|
|
|
telephonyCall: ['created', 'deleted', 'updated'],
|
2021-07-23 13:28:18 -07:00
|
|
|
'*': ['created', 'updated', 'deleted', '*'],
|
|
|
|
};
|
|
|
|
|
|
|
|
const elements: INodeProperties[] = [];
|
|
|
|
|
|
|
|
for (const resource of Object.keys(resourceEvents)) {
|
|
|
|
elements.push({
|
|
|
|
displayName: 'Event',
|
|
|
|
name: 'event',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: [resource === '*' ? 'all' : resource],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
2022-08-01 13:47:55 -07:00
|
|
|
options: resourceEvents[resource].map((event) => ({
|
|
|
|
value: event === '*' ? 'all' : event,
|
|
|
|
name: upperFirst(event),
|
|
|
|
})),
|
2021-07-23 13:28:18 -07:00
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return elements;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function mapResource(event: string) {
|
2022-08-01 13:47:55 -07:00
|
|
|
return (
|
|
|
|
{
|
|
|
|
attachmentAction: 'attachmentActions',
|
|
|
|
membership: 'memberships',
|
|
|
|
message: 'messages',
|
|
|
|
room: 'rooms',
|
|
|
|
meeting: 'meetings',
|
|
|
|
recording: 'recordings',
|
|
|
|
telephonyCall: 'telephony_calls',
|
|
|
|
all: 'all',
|
|
|
|
} as { [key: string]: string }
|
|
|
|
)[event];
|
2021-07-23 13:28:18 -07:00
|
|
|
}
|
|
|
|
|
2023-01-13 09:11:56 -08:00
|
|
|
function removeEmptyProperties(rest: { [key: string]: any }) {
|
|
|
|
return Object.keys(rest)
|
|
|
|
.filter((k) => rest[k] !== '')
|
|
|
|
.reduce((a, k) => ({ ...a, [k]: rest[k] }), {});
|
|
|
|
}
|
|
|
|
|
2021-07-23 13:28:18 -07:00
|
|
|
export function getAttachemnts(attachements: IDataObject[]) {
|
|
|
|
const _attachments: IDataObject[] = [];
|
|
|
|
for (const attachment of attachements) {
|
|
|
|
const body: IDataObject[] = [];
|
|
|
|
const actions: IDataObject[] = [];
|
2022-08-01 13:47:55 -07:00
|
|
|
for (const element of ((attachment?.elementsUi as IDataObject)
|
|
|
|
.elementValues as IDataObject[]) || []) {
|
|
|
|
const { type, ...rest } = element as { type: string; [key: string]: any };
|
2021-07-23 13:28:18 -07:00
|
|
|
if (type.startsWith('input')) {
|
2022-08-01 13:47:55 -07:00
|
|
|
body.push({
|
|
|
|
type: `Input.${upperFirst(type.replace('input', ''))}`,
|
|
|
|
...removeEmptyProperties(rest),
|
|
|
|
});
|
2021-07-23 13:28:18 -07:00
|
|
|
} else {
|
|
|
|
body.push({ type: upperFirst(type), ...removeEmptyProperties(rest) });
|
|
|
|
}
|
|
|
|
}
|
2022-08-01 13:47:55 -07:00
|
|
|
for (const action of ((attachment?.actionsUi as IDataObject).actionValues as IDataObject[]) ||
|
|
|
|
[]) {
|
|
|
|
const { type, ...rest } = action as { type: string; [key: string]: any };
|
2021-07-23 13:28:18 -07:00
|
|
|
actions.push({ type: `Action.${upperFirst(type)}`, ...removeEmptyProperties(rest) });
|
|
|
|
}
|
|
|
|
_attachments.push({
|
|
|
|
contentType: 'application/vnd.microsoft.card.adaptive',
|
|
|
|
content: {
|
|
|
|
$schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
|
|
|
|
type: 'AdaptiveCard',
|
|
|
|
version: '1.2',
|
|
|
|
body,
|
|
|
|
actions,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return _attachments;
|
|
|
|
}
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export function getActionInheritedProperties(): INodeProperties[] {
|
2021-07-23 13:28:18 -07:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
displayName: 'Title',
|
|
|
|
name: 'title',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Label for button or link that represents this action',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Icon URL',
|
|
|
|
name: 'iconUrl',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Optional icon to be shown on the action in conjunction with the title. Supports data URI in version 1.2+.',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Style',
|
|
|
|
name: 'style',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Default',
|
|
|
|
value: 'default',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Positive',
|
|
|
|
value: 'positive',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Destructive',
|
|
|
|
value: 'destructive',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'default',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Controls the style of an Action, which influences how the action is displayed, spoken, etc',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export function getTextBlockProperties(): INodeProperties[] {
|
2021-07-23 13:28:18 -07:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
displayName: 'Text',
|
|
|
|
name: 'text',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
required: true,
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Text to display. A subset of markdown is supported (https://aka.ms/ACTextFeatures).',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Color',
|
|
|
|
name: 'color',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Accent',
|
|
|
|
value: 'accent',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Attention',
|
|
|
|
value: 'attention',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Dark',
|
|
|
|
value: 'dark',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Default',
|
|
|
|
value: 'default',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Good',
|
|
|
|
value: 'good',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Light',
|
|
|
|
value: 'light',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Warning',
|
|
|
|
value: 'warning',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'default',
|
|
|
|
description: 'Color of the TextBlock element',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Font Type',
|
|
|
|
name: 'fontType',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Default',
|
|
|
|
value: 'default',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Monospace',
|
|
|
|
value: 'monospace',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'default',
|
|
|
|
description: 'Type of font to use for rendering',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Horizontal Alignment',
|
|
|
|
name: 'horizontalAlignment',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Left',
|
|
|
|
value: 'left',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Center',
|
|
|
|
value: 'center',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Right',
|
|
|
|
value: 'right',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'left',
|
|
|
|
description: 'Controls the horizontal text alignment',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Is Subtle',
|
|
|
|
name: 'isSubtle',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: false,
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Whether to display text slightly toned down to appear less prominent',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Max Lines',
|
|
|
|
name: 'maxLines',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 1,
|
|
|
|
description: 'Specifies the maximum number of lines to display',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Size',
|
|
|
|
name: 'size',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Default',
|
|
|
|
value: 'default',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Extra Large',
|
|
|
|
value: 'extraLarge',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Large',
|
|
|
|
value: 'large',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Medium',
|
|
|
|
value: 'medium',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Small',
|
|
|
|
value: 'small',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'default',
|
|
|
|
description: 'Controls size of text',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Weight',
|
|
|
|
name: 'weight',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Default',
|
|
|
|
value: 'default',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Lighter',
|
|
|
|
value: 'lighter',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Bolder',
|
|
|
|
value: 'bolder',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'default',
|
|
|
|
description: 'Controls the weight of TextBlock elements',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Wrap',
|
|
|
|
name: 'wrap',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: true,
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Whether to allow text to wrap. Otherwise, text is clipped.',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Height',
|
|
|
|
name: 'height',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Auto',
|
|
|
|
value: 'auto',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Stretch',
|
|
|
|
value: 'stretch',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'auto',
|
|
|
|
description: 'Specifies the height of the element',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Separator',
|
|
|
|
name: 'separator',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Whether to draw a separating line at the top of the element',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Spacing',
|
|
|
|
name: 'spacing',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Default',
|
|
|
|
value: 'default',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Extra Large',
|
|
|
|
value: 'extraLarge',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'Large',
|
|
|
|
value: 'large',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Medium',
|
|
|
|
value: 'medium',
|
|
|
|
},
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
name: 'None',
|
|
|
|
value: 'none',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Padding',
|
|
|
|
value: 'padding',
|
|
|
|
},
|
2022-06-03 10:23:49 -07:00
|
|
|
{
|
|
|
|
name: 'Small',
|
|
|
|
value: 'small',
|
|
|
|
},
|
2021-07-23 13:28:18 -07:00
|
|
|
],
|
|
|
|
default: 'default',
|
|
|
|
description: 'Controls the amount of spacing between this element and the preceding element',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'A unique identifier associated with the item',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Is Visible',
|
|
|
|
name: 'isVisible',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['textBlock'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: true,
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Whether this item will be removed from the visual trees',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export function getInputTextProperties(): INodeProperties[] {
|
2021-07-23 13:28:18 -07:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
displayName: 'ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['inputText'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Unique identifier for the value. Used to identify collected input when the Submit action is performed.',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Is Multiline',
|
|
|
|
name: 'isMultiline',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['inputText'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: false,
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Whether to allow multiple lines of input',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Max Length',
|
|
|
|
name: 'maxLength',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['inputText'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: 1,
|
|
|
|
description: 'Hint of maximum length characters to collect (may be ignored by some clients)',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Placeholder',
|
|
|
|
name: 'placeholder',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['inputText'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-04-22 09:29:51 -07:00
|
|
|
description: 'Description of the input desired. Displayed when no text has been input.',
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Regex',
|
|
|
|
name: 'regex',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['inputText'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Regular expression indicating the required format of this text input',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Style',
|
|
|
|
name: 'style',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['inputText'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Text',
|
|
|
|
value: 'text',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Tel',
|
|
|
|
value: 'tel',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'URL',
|
|
|
|
value: 'url',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Email',
|
|
|
|
value: 'email',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'text',
|
|
|
|
description: 'Style hint for text input',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
type: ['inputText'],
|
2021-07-23 13:28:18 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'The initial value for this field',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getAutomaticSecret(credentials: ICredentialDataDecryptedObject) {
|
|
|
|
const data = `${credentials.clientId},${credentials.clientSecret}`;
|
|
|
|
return createHash('md5').update(data).digest('hex');
|
|
|
|
}
|