chore: update action and trigger names

This commit is contained in:
Rıdvan Akca
2023-06-01 14:27:44 +03:00
committed by Ali BARIN
parent b43490dd76
commit 1ac423ba56
28 changed files with 94 additions and 89 deletions

View File

@@ -2,7 +2,7 @@ import qs from 'qs';
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action';
export default defineAction({ export default defineAction({
name: 'Translate Text', name: 'Translate text',
key: 'translateText', key: 'translateText',
description: 'Translates text from one language to another.', description: 'Translates text from one language to another.',
arguments: [ arguments: [

View File

@@ -1,7 +1,7 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action';
export default defineAction({ export default defineAction({
name: 'Delay For', name: 'Delay for',
key: 'delayFor', key: 'delayFor',
description: description:
'Delays the execution of the next action by a specified amount of time.', 'Delays the execution of the next action by a specified amount of time.',

View File

@@ -1,7 +1,7 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action';
export default defineAction({ export default defineAction({
name: 'Delay Until', name: 'Delay until',
key: 'delayUntil', key: 'delayUntil',
description: description:
'Delays the execution of the next action until a specified date.', 'Delays the execution of the next action until a specified date.',

View File

@@ -1,7 +1,7 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types'; import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default { export default {
name: 'List Folders', name: 'List folders',
key: 'listFolders', key: 'listFolders',
async run($: IGlobalVariable) { async run($: IGlobalVariable) {

View File

@@ -2,7 +2,7 @@ import defineTrigger from '../../../../helpers/define-trigger';
import newFilesInFolder from './new-files-in-folder'; import newFilesInFolder from './new-files-in-folder';
export default defineTrigger({ export default defineTrigger({
name: 'New Files in Folder', name: 'New files in folder',
key: 'newFilesInFolder', key: 'newFilesInFolder',
pollInterval: 15, pollInterval: 15,
description: description:

View File

@@ -2,7 +2,7 @@ import defineTrigger from '../../../../helpers/define-trigger';
import newFiles from './new-files'; import newFiles from './new-files';
export default defineTrigger({ export default defineTrigger({
name: 'New Files', name: 'New files',
key: 'newFiles', key: 'newFiles',
pollInterval: 15, pollInterval: 15,
description: 'Triggers when any new file is added (inside of any folder).', description: 'Triggers when any new file is added (inside of any folder).',

View File

@@ -2,7 +2,7 @@ import defineTrigger from '../../../../helpers/define-trigger';
import newFolders from './new-folders'; import newFolders from './new-folders';
export default defineTrigger({ export default defineTrigger({
name: 'New Folders', name: 'New folders',
key: 'newFolders', key: 'newFolders',
pollInterval: 15, pollInterval: 15,
description: description:

View File

@@ -2,7 +2,7 @@ import defineTrigger from '../../../../helpers/define-trigger';
import updatedFiles from './updated-files'; import updatedFiles from './updated-files';
export default defineTrigger({ export default defineTrigger({
name: 'Updated Files', name: 'Updated files',
key: 'updatedFiles', key: 'updatedFiles',
pollInterval: 15, pollInterval: 15,
description: description:

View File

@@ -2,7 +2,7 @@ import defineTrigger from '../../../../helpers/define-trigger';
import newFormResponses from './new-form-responses'; import newFormResponses from './new-form-responses';
export default defineTrigger({ export default defineTrigger({
name: 'New Form Responses', name: 'New form responses',
key: 'newFormResponses', key: 'newFormResponses',
pollInterval: 15, pollInterval: 15,
description: 'Triggers when a new form response is submitted.', description: 'Triggers when a new form response is submitted.',

View File

@@ -1,8 +1,8 @@
import defineTrigger from '../../../../helpers/define-trigger'; import defineTrigger from '../../../../helpers/define-trigger';
import newSpreadsheets from './new-spreadsheets' import newSpreadsheets from './new-spreadsheets';
export default defineTrigger({ export default defineTrigger({
name: 'New Spreadsheets', name: 'New spreadsheets',
key: 'newSpreadsheets', key: 'newSpreadsheets',
pollInterval: 15, pollInterval: 15,
description: 'Triggers when you create a new spreadsheet.', description: 'Triggers when you create a new spreadsheet.',
@@ -12,7 +12,8 @@ export default defineTrigger({
key: 'driveId', key: 'driveId',
type: 'dropdown' as const, type: 'dropdown' as const,
required: false, required: false,
description: 'The Google Drive where your spreadsheet resides. If nothing is selected, then your personal Google Drive will be used.', description:
'The Google Drive where your spreadsheet resides. If nothing is selected, then your personal Google Drive will be used.',
variables: false, variables: false,
source: { source: {
type: 'query', type: 'query',

View File

@@ -2,7 +2,7 @@ import defineTrigger from '../../../../helpers/define-trigger';
import newWorksheets from './new-worksheets'; import newWorksheets from './new-worksheets';
export default defineTrigger({ export default defineTrigger({
name: 'New Worksheets', name: 'New worksheets',
key: 'newWorksheets', key: 'newWorksheets',
pollInterval: 15, pollInterval: 15,
description: 'Triggers when you create a new worksheet in a spreadsheet.', description: 'Triggers when you create a new worksheet in a spreadsheet.',

View File

@@ -6,15 +6,17 @@ type TMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
type THeaderEntry = { type THeaderEntry = {
key: string; key: string;
value: string; value: string;
} };
type THeaderEntries = THeaderEntry[]; type THeaderEntries = THeaderEntry[];
function isPossiblyTextBased(contentType: string) { function isPossiblyTextBased(contentType: string) {
if (!contentType) return false; if (!contentType) return false;
return contentType.startsWith('application/json') return (
|| contentType.startsWith('text/'); contentType.startsWith('application/json') ||
contentType.startsWith('text/')
);
} }
function throwIfFileSizeExceedsLimit(contentLength: string) { function throwIfFileSizeExceedsLimit(contentLength: string) {
@@ -28,7 +30,7 @@ function throwIfFileSizeExceedsLimit(contentLength: string) {
} }
export default defineAction({ export default defineAction({
name: 'Custom Request', name: 'Custom request',
key: 'customRequest', key: 'customRequest',
description: 'Makes a custom HTTP request by providing raw details.', description: 'Makes a custom HTTP request by providing raw details.',
arguments: [ arguments: [
@@ -69,10 +71,12 @@ export default defineAction({
type: 'dynamic' as const, type: 'dynamic' as const,
required: false, required: false,
description: 'Add or remove headers as needed', description: 'Add or remove headers as needed',
value: [{ value: [
{
key: 'Content-Type', key: 'Content-Type',
value: 'application/json' value: 'application/json',
}], },
],
fields: [ fields: [
{ {
label: 'Key', label: 'Key',
@@ -89,9 +93,9 @@ export default defineAction({
required: true, required: true,
description: 'Header value', description: 'Header value',
variables: true, variables: true,
} },
], ],
} },
], ],
async run($) { async run($) {
@@ -100,30 +104,35 @@ export default defineAction({
const url = $.step.parameters.url as string; const url = $.step.parameters.url as string;
const headers = $.step.parameters.headers as THeaderEntries; const headers = $.step.parameters.headers as THeaderEntries;
const headersObject: Record<string, string> = headers.reduce((result, entry) => { const headersObject: Record<string, string> = headers.reduce(
(result, entry) => {
const key = entry.key?.toLowerCase(); const key = entry.key?.toLowerCase();
const value = entry.value; const value = entry.value;
if (key && value) { if (key && value) {
return { return {
...result, ...result,
[entry.key?.toLowerCase()]: entry.value [entry.key?.toLowerCase()]: entry.value,
} };
} }
return result; return result;
}, {}); },
{}
);
let contentType = headersObject['content-type']; let contentType = headersObject['content-type'];
// in case HEAD request is not supported by the URL // in case HEAD request is not supported by the URL
try { try {
const metadataResponse = await $.http.head(url, { headers: headersObject }); const metadataResponse = await $.http.head(url, {
headers: headersObject,
});
contentType = metadataResponse.headers['content-type']; contentType = metadataResponse.headers['content-type'];
throwIfFileSizeExceedsLimit(metadataResponse.headers['content-length']); throwIfFileSizeExceedsLimit(metadataResponse.headers['content-length']);
// eslint-disable-next-line no-empty // eslint-disable-next-line no-empty
} catch { } } catch {}
const requestData: AxiosRequestConfig = { const requestData: AxiosRequestConfig = {
url, url,

View File

@@ -1,12 +1,13 @@
import defineTrigger from "../../../../helpers/define-trigger"; import defineTrigger from '../../../../helpers/define-trigger';
import getBalanceTransactions from "./get-balance-transactions"; import getBalanceTransactions from './get-balance-transactions';
export default defineTrigger({ export default defineTrigger({
name: 'New Balance Transactions', name: 'New balance transactions',
key: 'newBalanceTransactions', key: 'newBalanceTransactions',
description: 'Triggers when a new transaction is processed (refund, payout, adjustment, ...)', description:
'Triggers when a new transaction is processed (refund, payout, adjustment, ...)',
pollInterval: 15, pollInterval: 15,
async run($) { async run($) {
await getBalanceTransactions($) await getBalanceTransactions($);
} },
}) });

View File

@@ -1,12 +1,13 @@
import defineTrigger from "../../../../helpers/define-trigger"; import defineTrigger from '../../../../helpers/define-trigger';
import getPayouts from "./get-payouts"; import getPayouts from './get-payouts';
export default defineTrigger({ export default defineTrigger({
name: 'New Payouts', name: 'New payouts',
key: 'newPayouts', key: 'newPayouts',
description: 'Triggers when a payout (Stripe <-> Bank account) has been updated', description:
'Triggers when a payout (Stripe <-> Bank account) has been updated',
pollInterval: 15, pollInterval: 15,
async run($) { async run($) {
await getPayouts($) await getPayouts($);
} },
}) });

View File

@@ -1,7 +1,7 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action';
export default defineAction({ export default defineAction({
name: 'Create Task', name: 'Create task',
key: 'createTask', key: 'createTask',
description: 'Creates a Task in Todoist', description: 'Creates a Task in Todoist',
arguments: [ arguments: [
@@ -59,8 +59,7 @@ export default defineAction({
type: 'string' as const, type: 'string' as const,
required: true, required: true,
variables: true, variables: true,
description: description: 'Task content, may be markdown. Example: "Foo"',
'Task content, may be markdown. Example: "Foo"',
}, },
{ {
label: 'Description', label: 'Description',
@@ -68,22 +67,16 @@ export default defineAction({
type: 'string' as const, type: 'string' as const,
required: false, required: false,
variables: true, variables: true,
description: description: 'Task description, may be markdown. Example: "Foo"',
'Task description, may be markdown. Example: "Foo"',
}, },
], ],
async run($) { async run($) {
const requestPath = `/tasks`; const requestPath = `/tasks`;
const { const { projectId, sectionId, labels, content, description } =
projectId, $.step.parameters;
sectionId,
labels,
content,
description
} = $.step.parameters;
const labelsArray = (labels as string).split(',') const labelsArray = (labels as string).split(',');
const payload = { const payload = {
content, content,
@@ -91,7 +84,7 @@ export default defineAction({
project_id: projectId || null, project_id: projectId || null,
labels: labelsArray || null, labels: labelsArray || null,
section_id: sectionId || null, section_id: sectionId || null,
} };
const response = await $.http.post(requestPath, payload); const response = await $.http.post(requestPath, payload);

View File

@@ -2,7 +2,7 @@ import defineTrigger from '../../../../helpers/define-trigger';
import getActiveTasks from './get-tasks'; import getActiveTasks from './get-tasks';
export default defineTrigger({ export default defineTrigger({
name: 'Get Active Tasks', name: 'Get active tasks',
key: 'getActiveTasks', key: 'getActiveTasks',
pollInterval: 15, pollInterval: 15,
description: 'Triggers when new Task(s) are found', description: 'Triggers when new Task(s) are found',

View File

@@ -1,7 +1,7 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action';
export default defineAction({ export default defineAction({
name: 'Create Tweet', name: 'Create tweet',
key: 'createTweet', key: 'createTweet',
description: 'Create a tweet.', description: 'Create a tweet.',
arguments: [ arguments: [

View File

@@ -1,7 +1,7 @@
--- ---
favicon: /favicons/deepl.svg favicon: /favicons/deepl.svg
items: items:
- name: Translate Text - name: Translate text
desc: Translates text from one language to another. desc: Translates text from one language to another.
--- ---

View File

@@ -1,9 +1,9 @@
--- ---
favicon: /favicons/delay.svg favicon: /favicons/delay.svg
items: items:
- name: Delay For - name: Delay for
desc: Delays the execution of the next action by a specified amount of time. desc: Delays the execution of the next action by a specified amount of time.
- name: Delay Until - name: Delay until
desc: Delays the execution of the next action until a specified date. desc: Delays the execution of the next action until a specified date.
--- ---

View File

@@ -1,14 +1,14 @@
--- ---
favicon: /favicons/google-drive.svg favicon: /favicons/google-drive.svg
items: items:
- name: New Files - name: New files
desc: Triggers when any new file is added (inside of any folder) desc: Triggers when any new file is added (inside of any folder)
- name: New Files in Folder - name: New files in folder
desc: Triggers when a new file is added directly to a specific folder (but not its subfolder) desc: Triggers when a new file is added directly to a specified folder (but not its subfolder)
- name: New Folders - name: New folders
desc: Triggers when a new folder is added directly to a specific folder (but not its subfolder) desc: Triggers when a new folder is added directly to a specified folder (but not its subfolder)
- name: Updated Files - name: Updated files
desc: Triggers when a file is updated in a specific folder (but not its subfolder) desc: Triggers when a file is updated in a specified folder (but not its subfolder)
--- ---
<script setup> <script setup>

View File

@@ -1,7 +1,7 @@
--- ---
favicon: /favicons/google-forms.svg favicon: /favicons/google-forms.svg
items: items:
- name: New Form Responses - name: New form responses
desc: Triggers when a new form response is submitted desc: Triggers when a new form response is submitted
--- ---

View File

@@ -1,9 +1,9 @@
--- ---
favicon: /favicons/google-sheets.svg favicon: /favicons/google-sheets.svg
items: items:
- name: New Spreadsheets - name: New spreadsheets
desc: Triggers when you create a new spreadsheet desc: Triggers when you create a new spreadsheet
- name: New Worksheets - name: New worksheets
desc: Triggers when you create a new worksheet in a spreadsheet desc: Triggers when you create a new worksheet in a spreadsheet
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
favicon: /favicons/http-request.svg favicon: /favicons/http-request.svg
items: items:
- name: Custom Request - name: Custom request
desc: Makes a custom HTTP request by providing raw details. desc: Makes a custom HTTP request by providing raw details.
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
favicon: /favicons/strava.svg favicon: /favicons/strava.svg
items: items:
- name: Create Totals and Stats Report - name: Create totals and stats report
desc: Creates a report with recent, year to date, and all time stats of your activities. desc: Creates a report with recent, year to date, and all time stats of your activities.
--- ---

View File

@@ -1,13 +1,13 @@
--- ---
favicon: /favicons/stripe.svg favicon: /favicons/stripe.svg
items: items:
- name: New Payouts - name: New payouts
desc: Triggers when stripe sent a payout to a third-party bank account or vice versa. desc: Triggers when stripe sent a payout to a third-party bank account or vice versa.
org: Stripe Documentation org: Stripe documentation
orgLink: https://stripe.com/docs/api/payouts/object orgLink: https://stripe.com/docs/api/payouts/object
- name: New Balance Transactions - name: New balance transactions
desc: Triggers when a fund has been moved through your stripe account. desc: Triggers when a fund has been moved through your stripe account.
org: Stripe Documentation org: Stripe documentation
orgLink: https://stripe.com/docs/api/balance_transactions/object orgLink: https://stripe.com/docs/api/balance_transactions/object
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
favicon: /favicons/todoist.svg favicon: /favicons/todoist.svg
items: items:
- name: Create Task - name: Create task
desc: Creates a task in Todoist. desc: Creates a task in Todoist.
--- ---

View File

@@ -1,7 +1,7 @@
--- ---
favicon: /favicons/todoist.svg favicon: /favicons/todoist.svg
items: items:
- name: Get Tasks - name: Get tasks
desc: Finds tasks in Todoist, optionally matching specified parameters. desc: Finds tasks in Todoist, optionally matching specified parameters.
--- ---

View File

@@ -1,9 +1,9 @@
--- ---
favicon: /favicons/twitter.svg favicon: /favicons/twitter.svg
items: items:
- name: Create Tweet - name: Create tweet
desc: Create a tweet. desc: Create a tweet.
- name: Search User - name: Search user
desc: Search a user. desc: Search a user.
--- ---