Compare commits

..

5 Commits

Author SHA1 Message Date
Rıdvan Akca
176d056aed feat(asana): add find project action 2024-06-07 12:30:01 +02:00
Rıdvan Akca
0526ec5b06 feat(asana): add create project action 2024-06-07 12:28:14 +02:00
Rıdvan Akca
061a9c6947 feat(asana): add create task action 2024-06-07 11:39:38 +02:00
Rıdvan Akca
ab307cdee0 feat(asana): add new projects trigger 2024-06-05 11:18:52 +02:00
Rıdvan Akca
9d5dac1701 feat(asana): add asana integration 2024-06-05 10:17:36 +02:00
867 changed files with 23878 additions and 43301 deletions

View File

@@ -5,11 +5,8 @@ BACKEND_PORT=3000
WEB_PORT=3001
echo "Configuring backend environment variables..."
cd packages/backend
rm -rf .env
echo "
PORT=$BACKEND_PORT
WEB_APP_URL=http://localhost:$WEB_PORT
@@ -24,34 +21,23 @@ WEBHOOK_SECRET_KEY=sample_webhook_secret_key
APP_SECRET_KEY=sample_app_secret_key
REDIS_HOST=redis
SERVE_WEB_APP_SEPARATELY=true" >> .env
echo "Installing backend dependencies..."
yarn
cd $CURRENT_DIR
echo "Configuring web environment variables..."
cd packages/web
rm -rf .env
echo "
PORT=$WEB_PORT
REACT_APP_BACKEND_URL=http://localhost:$BACKEND_PORT
" >> .env
echo "Installing web dependencies..."
yarn
cd $CURRENT_DIR
echo "Installing and linking dependencies..."
yarn
yarn lerna bootstrap
echo "Migrating database..."
cd packages/backend
yarn db:migrate
yarn db:seed:user

View File

@@ -1,52 +0,0 @@
name: release-tag
on:
push:
branches:
- 'main'
jobs:
release-image:
runs-on: ubuntu-latest
env:
DOCKER_ORG: groot
DOCKER_LATEST: latest
RUNNER_TOOL_CACHE: /toolcache
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with: # replace it with your local IP
config-inline: |
[registry."git.send.nrw"]
http = true
insecure = true
- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: git.send.nrw # replace it with your local IP
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./docker
file: ./docker/Dockerfile.compose
entrypoint: ./docker/compose-entrypoint.sh
platforms: |
linux/amd64
push: true
tags: | # replace it with your local IP and tags
git.send.nrw/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
git.send.nrw/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}

View File

@@ -41,11 +41,8 @@ jobs:
with:
node-version: 18
- name: Install dependencies
run: yarn
working-directory: packages/backend
run: cd packages/backend && yarn
- name: Copy .env-example.test file to .env.test
run: cp .env-example.test .env.test
working-directory: packages/backend
run: cd packages/backend && cp .env-example.test .env.test
- name: Run tests
run: yarn test:coverage
working-directory: packages/backend
run: cd packages/backend && yarn test

View File

@@ -18,13 +18,11 @@ jobs:
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: packages/backend/yarn.lock
cache-dependency-path: yarn.lock
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- run: yarn --frozen-lockfile
working-directory: packages/backend
- run: yarn lint
working-directory: packages/backend
- run: cd packages/backend && yarn lint
- run: echo "🍏 This job's status is ${{ job.status }}."
start-backend-server:
runs-on: ubuntu-latest
@@ -37,13 +35,11 @@ jobs:
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: packages/backend/yarn.lock
cache-dependency-path: yarn.lock
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- run: yarn --frozen-lockfile
working-directory: packages/backend
- run: yarn start
working-directory: packages/backend
- run: yarn --frozen-lockfile && yarn lerna bootstrap
- run: cd packages/backend && yarn start
env:
ENCRYPTION_KEY: sample_encryption_key
WEBHOOK_SECRET_KEY: sample_webhook_secret_key
@@ -59,13 +55,11 @@ jobs:
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: packages/backend/yarn.lock
cache-dependency-path: yarn.lock
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- run: yarn --frozen-lockfile
working-directory: packages/backend
- run: yarn start:worker
working-directory: packages/backend
- run: yarn --frozen-lockfile && yarn lerna bootstrap
- run: cd packages/backend && yarn start:worker
env:
ENCRYPTION_KEY: sample_encryption_key
WEBHOOK_SECRET_KEY: sample_webhook_secret_key
@@ -81,13 +75,11 @@ jobs:
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: packages/web/yarn.lock
cache-dependency-path: yarn.lock
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- run: yarn --frozen-lockfile
working-directory: packages/web
- run: yarn build
working-directory: packages/web
- run: yarn --frozen-lockfile && yarn lerna bootstrap
- run: cd packages/web && yarn build
env:
CI: false
- run: echo "🍏 This job's status is ${{ job.status }}."

View File

@@ -3,13 +3,12 @@ on:
push:
branches:
- main
# TODO: Add pull request after optimizing the total excecution time of the test suite.
# pull_request:
# paths:
# - 'packages/backend/**'
# - 'packages/e2e-tests/**'
# - 'packages/web/**'
# - '!packages/backend/src/apps/**'
pull_request:
paths:
- 'packages/backend/**'
- 'packages/e2e-tests/**'
- 'packages/web/**'
- '!packages/backend/src/apps/**'
workflow_dispatch:
env:
@@ -59,27 +58,22 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install web dependencies
run: yarn
working-directory: ./packages/web
- name: Install backend dependencies
run: yarn
working-directory: ./packages/backend
- name: Install e2e-tests dependencies
run: yarn
working-directory: ./packages/e2e-tests
- name: Install dependencies
run: yarn && yarn lerna bootstrap
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
working-directory: ./packages/e2e-tests
- name: Build Automatisch web
run: yarn build
working-directory: ./packages/web
run: yarn build
env:
# Keep this until we clean up warnings in build processes
CI: false
- name: Migrate database
working-directory: ./packages/backend
run: yarn db:migrate
- name: Seed user
working-directory: ./packages/backend
run: yarn db:seed:user &
- name: Install certutils
run: sudo apt install -y libnss3-tools
- name: Install mkcert

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)

View File

@@ -1,7 +1,10 @@
version: '3.9'
services:
main:
image: git.send.nrw/groot/automatisch:latest
build:
context: ./docker
dockerfile: Dockerfile.compose
entrypoint: /compose-entrypoint.sh
ports:
- '3000:3000'
depends_on:
@@ -25,7 +28,10 @@ services:
volumes:
- automatisch_storage:/automatisch/storage
worker:
image: git.send.nrw/groot/automatisch:latest
build:
context: ./docker
dockerfile: Dockerfile.compose
entrypoint: /compose-entrypoint.sh
depends_on:
- main
environment:

View File

@@ -1,22 +1,20 @@
# syntax=docker/dockerfile:1
FROM node:18-alpine
ENV PORT=3000
ENV PORT 3000
RUN \
apk --no-cache add --virtual build-dependencies python3 build-base git make g++
apk --no-cache add --virtual build-dependencies python3 build-base git
WORKDIR /automatisch
# copy the app, note .dockerignore
COPY . /automatisch
RUN cd packages/web && yarn
RUN yarn
RUN cd packages/web && yarn build
RUN cd packages/backend && yarn --production
RUN \
rm -rf /usr/local/share/.cache/ && \
apk del build-dependencies

13
lerna.json Normal file
View File

@@ -0,0 +1,13 @@
{
"packages": [
"packages/*"
],
"version": "0.10.0",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"add": {
"exact": true
}
}
}

32
package.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "@automatisch/root",
"license": "See LICENSE file",
"private": true,
"scripts": {
"start": "lerna run --stream --parallel --scope=@*/{web,backend} dev",
"start:web": "lerna run --stream --scope=@*/web dev",
"start:backend": "lerna run --stream --scope=@*/backend dev",
"build:docs": "cd ./packages/docs && yarn install && yarn build"
},
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/babel-loader",
"**/webpack",
"**/@automatisch/web",
"**/ajv"
]
},
"devDependencies": {
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"lerna": "^4.0.0",
"prettier": "^2.5.1"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -10,7 +10,7 @@ import process from 'process';
async function fetchAdminRole() {
const role = await Role.query()
.where({
name: 'Admin',
key: 'admin',
})
.limit(1)
.first();

View File

@@ -1,6 +1,6 @@
import { knexSnakeCaseMappers } from 'objection';
import appConfig from './src/config/app.js';
import path, { join } from 'path';
import path from 'path';
import { fileURLToPath } from 'url';
const fileExtension = 'js';
@@ -20,12 +20,12 @@ const knexConfig = {
searchPath: [appConfig.postgresSchema],
pool: { min: 0, max: 20 },
migrations: {
directory: join(__dirname, '/src/db/migrations'),
directory: __dirname + '/src/db/migrations',
extension: fileExtension,
loadExtensions: [`.${fileExtension}`],
},
seeds: {
directory: join(__dirname, '/src/db/seeds'),
directory: __dirname + '/src/db/seeds',
},
...(appConfig.isTest ? knexSnakeCaseMappers() : {}),
};

View File

@@ -5,14 +5,12 @@
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
"type": "module",
"scripts": {
"dev": "nodemon --exec node src/server.js",
"worker": "nodemon --exec node src/worker.js",
"dev": "nodemon --watch 'src/**/*.js' --exec 'node' src/server.js",
"worker": "nodemon --watch 'src/**/*.js' --exec 'node' src/worker.js",
"start": "node src/server.js",
"start:worker": "node src/worker.js",
"pretest": "APP_ENV=test node ./test/setup/prepare-test-env.js",
"test": "APP_ENV=test vitest run",
"test:watch": "APP_ENV=test vitest watch",
"test:coverage": "yarn test --coverage",
"lint": "eslint .",
"db:create": "node ./bin/database/create.js",
"db:seed:user": "node ./bin/database/seed-user.js",
@@ -24,7 +22,8 @@
"dependencies": {
"@bull-board/express": "^3.10.1",
"@casl/ability": "^6.5.0",
"@faker-js/faker": "^9.2.0",
"@graphql-tools/graphql-file-loader": "^7.3.4",
"@graphql-tools/load": "^7.5.2",
"@node-saml/passport-saml": "^4.0.4",
"@rudderstack/rudder-sdk-node": "^1.1.2",
"@sentry/node": "^7.42.0",
@@ -38,18 +37,18 @@
"crypto-js": "^4.1.1",
"debug": "~2.6.9",
"dotenv": "^10.0.0",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"express": "~4.18.2",
"express-async-errors": "^3.1.1",
"express-async-handler": "^1.2.0",
"express-basic-auth": "^1.2.1",
"express-graphql": "^0.12.0",
"fast-xml-parser": "^4.0.11",
"graphql-middleware": "^6.1.15",
"graphql-shield": "^7.5.0",
"graphql-tools": "^8.2.0",
"handlebars": "^4.7.7",
"http-errors": "~1.6.3",
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.1",
"isolated-vm": "^5.0.1",
"jsonwebtoken": "^9.0.0",
"knex": "^2.4.0",
"libphonenumber-js": "^1.10.48",
@@ -66,7 +65,6 @@
"pg": "^8.7.1",
"php-serialize": "^4.0.2",
"pluralize": "^8.0.0",
"prettier": "^2.5.1",
"raw-body": "^2.5.2",
"showdown": "^2.1.0",
"uuid": "^9.0.1",
@@ -98,19 +96,12 @@
"url": "https://github.com/automatisch/automatisch/issues"
},
"devDependencies": {
"@vitest/coverage-v8": "^2.1.5",
"node-gyp": "^10.1.0",
"nodemon": "^2.0.13",
"supertest": "^6.3.3",
"vitest": "^2.1.5"
"vitest": "^1.1.3"
},
"publishConfig": {
"access": "public"
},
"nodemonConfig": {
"watch": [
"src/"
],
"ext": "js"
}
}

View File

@@ -1,6 +1,5 @@
import createError from 'http-errors';
import express from 'express';
import 'express-async-errors';
import cors from 'cors';
import appConfig from './config/app.js';

View File

@@ -12,7 +12,7 @@ export default defineApp({
apiBaseUrl: 'https://api.airtable.com',
iconUrl: '{BASE_URL}/apps/airtable/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/airtable/connection',
primaryColor: '#FFBF00',
primaryColor: 'FFBF00',
supportsConnections: true,
beforeRequest: [addAuthHeader],
auth,

View File

@@ -12,7 +12,7 @@ export default defineApp({
apiBaseUrl: 'https://cloud.appwrite.io',
iconUrl: '{BASE_URL}/apps/appwrite/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/appwrite/connection',
primaryColor: '#FD366E',
primaryColor: 'FD366E',
supportsConnections: true,
beforeRequest: [setBaseUrl, addAuthHeader],
auth,

View File

@@ -0,0 +1,216 @@
import defineAction from '../../../../helpers/define-action.js';
import omitBy from 'lodash/omitBy.js';
import isEmpty from 'lodash/isEmpty.js';
export default defineAction({
name: 'Create project',
key: 'createProject',
description: 'Creates a new project.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Team',
key: 'teamId',
type: 'dropdown',
required: false,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listTeams',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Due date',
key: 'dueDate',
type: 'string',
required: false,
description: 'Example due on: 2019-09-15',
variables: true,
},
{
label: 'Name',
key: 'name',
type: 'string',
required: true,
description: '',
variables: true,
},
{
label: 'Notes',
key: 'notes',
type: 'string',
required: true,
description: 'You can format the notes using html.',
variables: true,
},
{
label: 'Is the notes rich text?',
key: 'richText',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{
label: 'No',
value: 'false',
},
{
label: 'Yes',
value: 'true',
},
],
},
{
label: 'Default View',
key: 'defaultView',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{
label: 'List',
value: 'list',
},
{
label: 'Board',
value: 'board',
},
{
label: 'Calendar',
value: 'calendar',
},
{
label: 'Timeline',
value: 'timeline',
},
],
},
{
label: 'Owner',
key: 'ownerId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listUsers',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Followers',
key: 'followerIds',
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Follower',
key: 'followerId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listUsers',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
],
},
],
async run($) {
const {
workspaceId,
teamId,
dueDate,
name,
notes,
richText,
defaultView,
ownerId,
followerIds,
} = $.step.parameters;
const allFollowers = followerIds
.map((followerId) => followerId.followerId)
.filter(Boolean);
const data = {
workspace: workspaceId,
team: teamId,
due_on: dueDate,
name,
default_view: defaultView,
owner: ownerId,
followers: allFollowers,
};
if (richText === 'true') {
data.html_notes = notes;
} else {
data.notes = notes;
}
const filteredData = omitBy(data, isEmpty);
const response = await $.http.post('/1.0/projects', { data: filteredData });
$.setActionItem({
raw: response.data,
});
},
});

View File

@@ -0,0 +1,312 @@
import defineAction from '../../../../helpers/define-action.js';
import omitBy from 'lodash/omitBy.js';
import isEmpty from 'lodash/isEmpty.js';
export default defineAction({
name: 'Create task',
key: 'createTask',
description: 'Creates a new task.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Project',
key: 'projectId',
type: 'dropdown',
required: false,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listProjects',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Section',
key: 'sectionId',
type: 'dropdown',
required: false,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSections',
},
{
name: 'parameters.projectId',
value: '{parameters.projectId}',
},
],
},
},
{
label: 'Due date type',
key: 'dueDateType',
type: 'dropdown',
required: false,
description: "If not filled in, 'Date & time' will be assumed.",
options: [
{
label: 'Date & time',
value: 'at',
},
{
label: 'Date only',
value: 'on',
},
],
},
{
label: 'Due date (date & time)',
key: 'dueDate',
type: 'string',
required: false,
description:
'Example due at: 2019-09-15T02:06:58.147Z, example due on: 2019-09-15',
variables: true,
},
{
label: 'Name',
key: 'name',
type: 'string',
required: false,
description: '',
variables: true,
},
{
label: 'Description',
key: 'description',
type: 'string',
required: false,
description: 'You can format the description using html.',
variables: true,
},
{
label: 'Is the description rich text?',
key: 'richText',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{
label: 'No',
value: 'false',
},
{
label: 'Yes',
value: 'true',
},
],
},
{
label: 'Mark Task as complete?',
key: 'taskCompleted',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{
label: 'No',
value: 'false',
},
{
label: 'Yes',
value: 'true',
},
],
},
{
label: 'Mark Task as liked?',
key: 'taskLiked',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{
label: 'No',
value: 'false',
},
{
label: 'Yes',
value: 'true',
},
],
},
{
label: 'Assignee',
key: 'assigneeId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listUsers',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Followers',
key: 'followerIds',
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Follower',
key: 'followerId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listUsers',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
],
},
{
label: 'Tags',
key: 'tagIds',
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Tag',
key: 'tagId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listTags',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
],
},
],
async run($) {
const {
workspaceId,
projectId,
sectionId,
dueDateType,
dueDate,
name,
description,
richText,
taskCompleted,
taskLiked,
assigneeId,
followerIds,
tagIds,
} = $.step.parameters;
const allFollowers = followerIds
.map((followerId) => followerId.followerId)
.filter(Boolean);
const allTags = tagIds.map((tagId) => tagId.tagId).filter(Boolean);
const data = {
name,
completed: taskCompleted,
liked: taskLiked,
assignee: assigneeId,
assignee_section: sectionId,
followers: allFollowers,
projects: projectId,
tags: allTags,
workspace: workspaceId,
};
if (richText === 'true') {
data.html_notes = description;
} else {
data.notes = description;
}
if (dueDateType === 'on') {
data.due_on = dueDate;
} else {
data.due_at = dueDate;
}
const filteredData = omitBy(data, isEmpty);
const response = await $.http.post('/1.0/tasks', { data: filteredData });
$.setActionItem({
raw: response.data,
});
},
});

View File

@@ -0,0 +1,49 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Find project',
key: 'findProject',
description: 'Finds an existing project.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Name',
key: 'name',
type: 'string',
required: true,
description: '',
variables: true,
},
],
async run($) {
const { workspaceId, name } = $.step.parameters;
const { data } = await $.http.get(
`/1.0/workspaces/${workspaceId}/projects`
);
const project = data.data.find((project) => project.name === name);
$.setActionItem({
raw: project,
});
},
});

View File

@@ -0,0 +1,5 @@
import createProject from './create-project/index.js';
import createTask from './create-task/index.js';
import findProject from './find-project/index.js';
export default [createProject, createTask, findProject];

View File

@@ -0,0 +1,8 @@
<svg width="555" height="110" viewBox="0 0 555 110" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M541.011 83.513C541.347 87.339 544.407 92.209 549.709 92.209H552.811C554.014 92.209 555 91.2232 555 90.0197V21.7948H554.986C554.923 20.6454 553.974 19.7248 552.811 19.7248H543.199C542.036 19.7248 541.087 20.6454 541.023 21.7948H541.011V27.3385C535.122 20.0789 525.836 17.0657 516.525 17.0657C495.359 17.0657 478.202 34.2365 478.202 55.419C478.202 76.6027 495.359 93.7741 516.525 93.7741V93.7759C525.836 93.7759 535.983 90.1606 541.01 83.5042L541.011 83.513V83.513ZM516.562 80.3509C503.101 80.3509 492.188 69.1896 492.188 55.4192C492.188 41.6511 503.101 30.4892 516.562 30.4892C530.022 30.4892 540.934 41.6511 540.934 55.4192C540.934 69.1896 530.022 80.3509 516.562 80.3509V80.3509Z" fill="#690031"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M466.05 85.8589L466.045 50.5554H466.046C466.046 30.655 453.501 17.2299 433.497 17.2299C423.947 17.2299 416.119 22.7561 413.355 27.5032C412.757 23.7913 410.788 19.8896 404.681 19.8896H401.569C400.365 19.8896 399.382 20.876 399.382 22.0795V83.6835C399.382 83.6853 399.382 83.69 399.382 83.6929V90.3102H399.394C399.457 91.4579 400.408 92.3796 401.57 92.3796H411.182C411.33 92.3796 411.474 92.3621 411.613 92.3347C411.677 92.3225 411.736 92.2975 411.798 92.28C411.869 92.2579 411.944 92.241 412.012 92.213C412.097 92.1775 412.175 92.1298 412.255 92.0855C412.294 92.0617 412.334 92.0448 412.372 92.0197C412.468 91.958 412.556 91.8835 412.641 91.8072C412.655 91.7932 412.672 91.7839 412.686 91.7711C412.781 91.6785 412.868 91.5766 412.946 91.4707C412.946 91.4689 412.946 91.4689 412.946 91.4689C413.187 91.1382 413.333 90.7399 413.357 90.3102H413.369V50.0081C413.369 39.3201 422.028 30.655 432.709 30.655C443.389 30.655 452.047 39.3201 452.047 50.0081L452.056 83.6952L452.058 83.6835C452.058 83.7132 452.063 83.7441 452.063 83.7761V90.3102H452.076C452.139 91.4579 453.089 92.3796 454.251 92.3796H463.864C464.012 92.3796 464.156 92.3621 464.295 92.3347C464.352 92.3243 464.404 92.3015 464.46 92.2858C464.538 92.2631 464.619 92.2433 464.695 92.213C464.773 92.1804 464.845 92.135 464.92 92.0931C464.965 92.0675 465.013 92.0489 465.056 92.0197C465.145 91.9615 465.226 91.8911 465.306 91.8212C465.326 91.8026 465.349 91.7886 465.368 91.7694C465.459 91.6814 465.54 91.5865 465.615 91.487C465.62 91.4794 465.626 91.4736 465.632 91.466C465.868 91.1382 466.013 90.7428 466.038 90.3161C466.038 90.3131 466.039 90.3102 466.039 90.3102H466.052V85.86L466.05 85.8589" fill="#690031"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M365.94 83.5127C366.276 87.3387 369.336 92.2088 374.638 92.2088H377.74C378.943 92.2088 379.927 91.223 379.927 90.0195V21.7945H379.915C379.852 20.6452 378.901 19.7246 377.74 19.7246H368.128C366.965 19.7246 366.016 20.6452 365.951 21.7945H365.94V27.3382C360.05 20.0786 350.764 17.0654 341.453 17.0654C320.288 17.0654 303.131 34.2362 303.131 55.4188C303.131 76.6025 320.288 93.7739 341.453 93.7739V93.7756C350.764 93.7756 360.912 90.1604 365.939 83.504L365.94 83.5127V83.5127ZM341.49 80.3506C328.03 80.3506 317.117 69.1893 317.117 55.4189C317.117 41.6509 328.03 30.489 341.49 30.489C354.952 30.489 365.862 41.6509 365.862 55.4189C365.862 69.1893 354.952 80.3506 341.49 80.3506V80.3506Z" fill="#690031"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M246.284 73.7415C252.702 78.1905 259.706 80.3513 266.437 80.3513C272.85 80.3513 279.479 77.0242 279.479 71.2337C279.479 63.5024 265.033 62.2995 255.957 59.2124C246.88 56.1252 239.061 49.7437 239.061 39.4092C239.061 23.5956 253.14 17.0645 266.281 17.0645C274.607 17.0645 283.198 19.8121 288.767 23.7482C290.686 25.2027 289.517 26.8726 289.517 26.8726L284.201 34.4716C283.603 35.3276 282.559 36.067 281.059 35.1407C279.559 34.2149 274.298 30.4884 266.281 30.4884C258.263 30.4884 253.434 34.1939 253.434 38.7868C253.434 44.2943 259.711 46.0266 267.063 47.9038C279.875 51.36 293.852 55.5144 293.852 71.2337C293.852 85.1665 280.829 93.777 266.437 93.777C255.53 93.777 246.244 90.6654 238.456 84.9459C236.834 83.3208 237.967 81.8121 237.967 81.8121L243.257 74.2515C244.334 72.8378 245.691 73.331 246.284 73.7415" fill="#690031"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M209.331 83.5127C209.668 87.3387 212.728 92.2088 218.03 92.2088H221.132C222.334 92.2088 223.32 91.223 223.32 90.0195V21.7945H223.307C223.244 20.6452 222.294 19.7246 221.132 19.7246H211.519C210.357 19.7246 209.408 20.6452 209.343 21.7945H209.331V27.3382C203.442 20.0786 194.156 17.0654 184.845 17.0654C163.68 17.0654 146.522 34.2362 146.522 55.4188C146.522 76.6025 163.68 93.7739 184.845 93.7739V93.7756C194.156 93.7756 204.304 90.1604 209.33 83.504L209.331 83.5127V83.5127ZM184.883 80.3506C171.422 80.3506 160.509 69.1893 160.509 55.4189C160.509 41.6509 171.422 30.489 184.883 30.489C198.343 30.489 209.255 41.6509 209.255 55.4189C209.255 69.1893 198.343 80.3506 184.883 80.3506V80.3506Z" fill="#690031"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M92.794 58.0274C78.5507 58.0274 67.0041 69.5741 67.0041 83.8185C67.0041 98.0618 78.5507 109.608 92.794 109.608C107.037 109.608 118.584 98.0618 118.584 83.8185C118.584 69.5741 107.037 58.0274 92.794 58.0274V58.0274ZM25.7899 58.0298C11.5466 58.0298 0 69.5741 0 83.8186C0 98.0618 11.5466 109.608 25.7899 109.608C40.0338 109.608 51.581 98.0618 51.581 83.8186C51.581 69.5741 40.0338 58.0298 25.7899 58.0298V58.0298ZM85.0815 25.7894C85.0815 40.0338 73.5354 51.5816 59.2921 51.5816C45.0483 51.5816 33.5022 40.0338 33.5022 25.7894C33.5022 11.5478 45.0483 0 59.2921 0C73.5354 0 85.0815 11.5478 85.0815 25.7894V25.7894Z" fill="#FF584A"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -1,18 +1,22 @@
import { URLSearchParams } from 'url';
import crypto from 'crypto';
export default async function generateAuthUrl($) {
const oauthRedirectUrlField = $.app.auth.fields.find(
(field) => field.key == 'oAuthRedirectUrl'
);
const redirectUri = oauthRedirectUrlField.value;
const state = Math.random().toString();
const state = crypto.randomBytes(100).toString('base64url');
const searchParams = new URLSearchParams({
client_id: $.auth.data.clientId,
redirect_uri: redirectUri,
response_type: 'code',
//scope: authScope.join(' '),
state,
});
const url = `https://app.clickup.com/api?${searchParams.toString()}`;
const url = `https://app.asana.com/-/oauth_authorize?${searchParams.toString()}`;
await $.auth.set({
url,

View File

@@ -1,5 +1,6 @@
import generateAuthUrl from './generate-auth-url.js';
import verifyCredentials from './verify-credentials.js';
import refreshToken from './refresh-token.js';
import isStillVerified from './is-still-verified.js';
export default {
@@ -10,10 +11,10 @@ export default {
type: 'string',
required: true,
readOnly: true,
value: '{WEB_APP_URL}/app/mailchimp/connections/add',
value: '{WEB_APP_URL}/app/asana/connections/add',
placeholder: null,
description:
'When asked to input a redirect URL in Mailchimp, enter the URL above.',
'When asked to input a redirect URL in Asana, enter the URL above.',
clickToCopy: true,
},
{
@@ -43,4 +44,5 @@ export default {
generateAuthUrl,
verifyCredentials,
isStillVerified,
refreshToken,
};

View File

@@ -2,7 +2,7 @@ import getCurrentUser from '../common/get-current-user.js';
const isStillVerified = async ($) => {
const currentUser = await getCurrentUser($);
return !!currentUser.id;
return !!currentUser.data.email;
};
export default isStillVerified;

View File

@@ -0,0 +1,37 @@
import { URLSearchParams } from 'node:url';
const refreshToken = async ($) => {
const oauthRedirectUrlField = $.app.auth.fields.find(
(field) => field.key == 'oAuthRedirectUrl'
);
const redirectUri = oauthRedirectUrlField.value;
const params = new URLSearchParams({
client_id: $.auth.data.clientId,
client_secret: $.auth.data.clientSecret,
redirect_uri: redirectUri,
grant_type: 'refresh_token',
refresh_token: $.auth.data.refreshToken,
});
const { data } = await $.http.post(
'https://app.asana.com/-/oauth_token',
params.toString(),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
additionalProperties: {
skipAddingAuthHeader: true,
},
}
);
await $.auth.set({
accessToken: data.access_token,
expiresIn: data.expires_in,
tokenType: data.token_type,
});
};
export default refreshToken;

View File

@@ -0,0 +1,39 @@
const verifyCredentials = async ($) => {
if ($.auth.data.originalState !== $.auth.data.state) {
throw new Error("The 'state' parameter does not match.");
}
const oauthRedirectUrlField = $.app.auth.fields.find(
(field) => field.key == 'oAuthRedirectUrl'
);
const redirectUri = oauthRedirectUrlField.value;
const { data } = await $.http.post(
'https://app.asana.com/-/oauth_token',
{
client_id: $.auth.data.clientId,
client_secret: $.auth.data.clientSecret,
code: $.auth.data.code,
grant_type: 'authorization_code',
redirect_uri: redirectUri,
},
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
}
);
await $.auth.set({
accessToken: data.access_token,
tokenType: data.token_type,
clientId: $.auth.data.clientId,
clientSecret: $.auth.data.clientSecret,
scope: $.auth.data.scope,
id: data.data.id,
gid: data.data.gid,
expiresIn: data.expires_in,
refreshToken: data.refresh_token,
screenName: `${data.data.name} - ${data.data.email}`,
});
};
export default verifyCredentials;

View File

@@ -1,4 +1,7 @@
const addAuthHeader = ($, requestConfig) => {
if (requestConfig.additionalProperties?.skipAddingAuthHeader)
return requestConfig;
if ($.auth.data?.accessToken) {
requestConfig.headers.Authorization = `${$.auth.data.tokenType} ${$.auth.data.accessToken}`;
}

View File

@@ -1,6 +1,7 @@
const getCurrentUser = async ($) => {
const response = await $.http.get('/user');
const currentUser = response.data.content;
const { data: currentUser } = await $.http.get(
`/1.0/users/${$.auth.data.gid}`
);
return currentUser;
};

View File

@@ -0,0 +1,15 @@
import listProjects from './list-projects/index.js';
import listSections from './list-sections/index.js';
import listTags from './list-tags/index.js';
import listTeams from './list-teams/index.js';
import listUsers from './list-users/index.js';
import listWorkspaces from './list-workspaces/index.js';
export default [
listProjects,
listSections,
listTags,
listTeams,
listUsers,
listWorkspaces,
];

View File

@@ -0,0 +1,42 @@
export default {
name: 'List projects',
key: 'listProjects',
async run($) {
const projects = {
data: [],
};
const workspaceId = $.step.parameters.workspaceId;
if (!workspaceId) {
return projects;
}
const params = {
limit: 100,
offset: undefined,
workspace: workspaceId,
};
do {
const {
data: { data, next_page },
} = await $.http.get('/1.0/projects', {
params,
});
params.offset = next_page?.offset;
if (data) {
for (const project of data) {
projects.data.push({
value: project.gid,
name: project.name,
});
}
}
} while (params.offset);
return projects;
},
};

View File

@@ -0,0 +1,41 @@
export default {
name: 'List sections',
key: 'listSections',
async run($) {
const sections = {
data: [],
};
const projectId = $.step.parameters.projectId;
if (!projectId) {
return sections;
}
const params = {
limit: 100,
offset: undefined,
};
do {
const {
data: { data, next_page },
} = await $.http.get(`/1.0/projects/${projectId}/sections`, {
params,
});
params.offset = next_page?.offset;
if (data) {
for (const section of data) {
sections.data.push({
value: section.gid,
name: section.name,
});
}
}
} while (params.offset);
return sections;
},
};

View File

@@ -0,0 +1,42 @@
export default {
name: 'List tags',
key: 'listTags',
async run($) {
const tags = {
data: [],
};
const workspaceId = $.step.parameters.workspaceId;
if (!workspaceId) {
return workspaceId;
}
const params = {
limit: 100,
offset: undefined,
workspace: workspaceId,
};
do {
const {
data: { data, next_page },
} = await $.http.get('/1.0/tags', {
params,
});
params.offset = next_page?.offset;
if (data) {
for (const tag of data) {
tags.data.push({
value: tag.gid,
name: tag.name,
});
}
}
} while (params.offset);
return tags;
},
};

View File

@@ -0,0 +1,42 @@
export default {
name: 'List teams',
key: 'listTeams',
async run($) {
const teams = {
data: [],
};
const workspaceId = $.step.parameters.workspaceId;
if (!workspaceId) {
return workspaceId;
}
const params = {
limit: 100,
offset: undefined,
workspace: workspaceId,
};
do {
const {
data: { data, next_page },
} = await $.http.get('/1.0/teams', {
params,
});
params.offset = next_page?.offset;
if (data) {
for (const team of data) {
teams.data.push({
value: team.gid,
name: team.name,
});
}
}
} while (params.offset);
return teams;
},
};

View File

@@ -0,0 +1,42 @@
export default {
name: 'List users',
key: 'listUsers',
async run($) {
const users = {
data: [],
};
const workspaceId = $.step.parameters.workspaceId;
if (!workspaceId) {
return workspaceId;
}
const params = {
limit: 100,
offset: undefined,
workspace: workspaceId,
};
do {
const {
data: { data, next_page },
} = await $.http.get('/1.0/users', {
params,
});
params.offset = next_page?.offset;
if (data) {
for (const user of data) {
users.data.push({
value: user.gid,
name: user.name,
});
}
}
} while (params.offset);
return users;
},
};

View File

@@ -0,0 +1,34 @@
export default {
name: 'List workspaces',
key: 'listWorkspaces',
async run($) {
const workspaces = {
data: [],
};
const params = {
limit: 100,
offset: undefined,
};
do {
const {
data: { data, next_page },
} = await $.http.get('/1.0/workspaces', { params });
params.offset = next_page?.offset;
if (data) {
for (const workspace of data) {
workspaces.data.push({
value: workspace.gid,
name: workspace.name,
});
}
}
} while (params.offset);
return workspaces;
},
};

View File

@@ -1,24 +1,22 @@
import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header.js';
import auth from './auth/index.js';
import triggers from './triggers/index.js';
import dynamicData from './dynamic-data/index.js';
import triggers from './triggers/index.js';
import actions from './actions/index.js';
import dynamicFields from './dynamic-fields/index.js';
export default defineApp({
name: 'ClickUp',
key: 'clickup',
baseUrl: 'https://clickup.com',
apiBaseUrl: 'https://api.clickup.com/api',
iconUrl: '{BASE_URL}/apps/clickup/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/clickup/connection',
primaryColor: '#FD71AF',
name: 'Asana',
key: 'asana',
baseUrl: 'https://asana.com',
apiBaseUrl: 'https://app.asana.com/api',
iconUrl: '{BASE_URL}/apps/asana/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/asana/connection',
primaryColor: '690031',
supportsConnections: true,
beforeRequest: [addAuthHeader],
auth,
triggers,
dynamicData,
triggers,
actions,
dynamicFields,
});

View File

@@ -0,0 +1,3 @@
import newProjects from './new-projects/index.js';
export default [newProjects];

View File

@@ -0,0 +1,59 @@
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New projects',
key: 'newProjects',
pollInterval: 15,
description: 'Triggers when a new project is created.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
],
async run($) {
const workspaceId = $.step.parameters.workspaceId;
const params = {
limit: 100,
offset: undefined,
workspace: workspaceId,
};
do {
const {
data: { data, next_page },
} = await $.http.get('/1.0/projects', {
params,
});
params.offset = next_page?.offset;
if (data) {
for (const project of data) {
$.pushTriggerItem({
raw: project,
meta: {
internalId: project.gid,
},
});
}
}
} while (params.offset);
},
});

View File

@@ -12,7 +12,7 @@ export default defineApp({
apiBaseUrl: '',
iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/azure-openai/connection',
primaryColor: '#000000',
primaryColor: '000000',
supportsConnections: true,
beforeRequest: [setBaseUrl, addAuthHeader],
auth,

View File

@@ -7,7 +7,7 @@ export default defineAction({
'Creates an attachment of a specified object by given parent ID.',
arguments: [
{
label: 'Template Data',
label: 'Templete Data',
key: 'templateData',
type: 'string',
required: true,

View File

@@ -11,7 +11,7 @@ export default defineApp({
supportsConnections: true,
baseUrl: 'https://carbone.io',
apiBaseUrl: 'https://api.carbone.io',
primaryColor: '#6f42c1',
primaryColor: '6f42c1',
beforeRequest: [addAuthHeader],
auth,
actions,

View File

@@ -1,72 +0,0 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create folder',
key: 'createFolder',
description: 'Creates a new folder.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Space',
key: 'spaceId',
type: 'dropdown',
required: true,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSpaces',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Folder Name',
key: 'folderName',
type: 'string',
required: true,
description: '',
variables: true,
},
],
async run($) {
const { spaceId, folderName } = $.step.parameters;
const body = {
name: folderName,
};
const { data } = await $.http.post(`/v2/space/${spaceId}/folder`, body);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,135 +0,0 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create list',
key: 'createList',
description: 'Creates a new list.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Space',
key: 'spaceId',
type: 'dropdown',
required: true,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSpaces',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Folder',
key: 'folderId',
type: 'dropdown',
required: true,
dependsOn: ['parameters.spaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listFolders',
},
{
name: 'parameters.spaceId',
value: '{parameters.spaceId}',
},
],
},
},
{
label: 'List Name',
key: 'listName',
type: 'string',
required: true,
description: '',
variables: true,
},
{
label: 'List Info',
key: 'listInfo',
type: 'string',
required: false,
description: '',
variables: true,
},
{
label: 'Priority',
key: 'priority',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{ label: 'Urgent', value: 1 },
{ label: 'High', value: 2 },
{ label: 'Normal', value: 3 },
{ label: 'Low', value: 4 },
],
},
{
label: 'Due Date',
key: 'dueDate',
type: 'string',
required: false,
description: 'format: integer <int64>',
variables: true,
},
],
async run($) {
const { folderId, listName, listInfo, priority, dueDate } =
$.step.parameters;
const body = {
name: listName,
content: listInfo,
};
if (priority) {
body.priority = priority;
}
if (dueDate) {
body.due_date = dueDate;
}
const { data } = await $.http.post(`/v2/folder/${folderId}/list`, body);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,294 +0,0 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create task',
key: 'createTask',
description: 'Creates a new task.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Space',
key: 'spaceId',
type: 'dropdown',
required: true,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSpaces',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Folder',
key: 'folderId',
type: 'dropdown',
required: true,
dependsOn: ['parameters.spaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listFolders',
},
{
name: 'parameters.spaceId',
value: '{parameters.spaceId}',
},
],
},
},
{
label: 'List',
key: 'listId',
type: 'dropdown',
required: true,
dependsOn: ['parameters.folderId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listLists',
},
{
name: 'parameters.folderId',
value: '{parameters.folderId}',
},
],
},
},
{
label: 'Task Name',
key: 'taskName',
type: 'string',
required: true,
description: '',
variables: true,
},
{
label: 'Task Description',
key: 'taskDescription',
type: 'string',
required: false,
description: '',
variables: true,
},
{
label: 'Markdown Content',
key: 'markdownContent',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{ label: 'False', value: 'false' },
{ label: 'True', value: 'true' },
],
},
{
label: 'Assignees',
key: 'assigneeIds',
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Assignee',
key: 'assigneeId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.listId'],
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listAssignees',
},
{
name: 'parameters.listId',
value: '{parameters.listId}',
},
],
},
},
],
},
{
label: 'Task Status',
key: 'taskStatus',
type: 'dropdown',
required: false,
dependsOn: ['parameters.listId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listStatuses',
},
{
name: 'parameters.listId',
value: '{parameters.listId}',
},
],
},
},
{
label: 'Tags',
key: 'tagIds',
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'tag',
key: 'tagId',
type: 'dropdown',
required: false,
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listTags',
},
],
},
},
],
},
{
label: 'Priority',
key: 'priority',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{ label: 'Urgent', value: 1 },
{ label: 'High', value: 2 },
{ label: 'Normal', value: 3 },
{ label: 'Low', value: 4 },
],
},
{
label: 'Due Date',
key: 'dueDate',
type: 'string',
required: false,
description: 'format: integer <int64>',
variables: true,
},
{
label: 'Start Date',
key: 'startDate',
type: 'string',
required: false,
description: 'format: integer <int64>',
variables: true,
},
],
async run($) {
const {
listId,
taskName,
taskDescription,
markdownContent,
assigneeIds,
taskStatus,
tagIds,
priority,
dueDate,
startDate,
} = $.step.parameters;
const tags = tagIds.map((tag) => tag.tagId);
const assignees = assigneeIds.map((assignee) =>
Number(assignee.assigneeId)
);
const body = {
name: taskName,
};
if (assignees.length) {
body.assignees = assignees;
}
if (taskStatus) {
body.status = taskStatus;
}
if (tags.length) {
body.tags = tags;
}
if (priority) {
body.priority = priority;
}
if (dueDate) {
body.due_date = dueDate;
}
if (startDate) {
body.start_date = startDate;
}
if (markdownContent) {
body.markdown_description = taskDescription;
} else {
body.description = taskDescription;
}
const { data } = await $.http.post(`/v2/list/${listId}/task`, body);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,82 +0,0 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Find task by id',
key: 'findTaskById',
description: 'Finds a task using id.',
arguments: [
{
label: 'Task ID',
key: 'taskId',
type: 'string',
required: true,
description: '',
variables: true,
},
{
label: 'Use Custom ID',
key: 'useCustomId',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{
label: 'True',
value: true,
},
{
label: 'False',
value: false,
},
],
additionalFields: {
type: 'query',
name: 'getDynamicFields',
arguments: [
{
name: 'key',
value: 'listFieldsWhenUsingCustomId',
},
{
name: 'parameters.useCustomId',
value: '{parameters.useCustomId}',
},
],
},
},
{
label: 'Include Subtasks?',
key: 'includeSubtasks',
type: 'dropdown',
required: false,
description: '',
variables: true,
options: [
{
label: 'True',
value: true,
},
{
label: 'False',
value: false,
},
],
},
],
async run($) {
const { taskId, useCustomId, includeSubtasks } = $.step.parameters;
const params = {
custom_task_ids: useCustomId || false,
include_subtasks: includeSubtasks,
};
const { data } = await $.http.get(`/v2/task/${taskId}`, { params });
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,6 +0,0 @@
import createFolder from './create-folder/index.js';
import createList from './create-list/index.js';
import createTask from './create-task/index.js';
import findTaskById from './find-task-by-id/index.js';
export default [createFolder, createList, createTask, findTaskById];

View File

@@ -1,27 +0,0 @@
<svg width="185" height="185" viewBox="0 0 185 185" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_d)">
<rect x="30" y="20" width="125" height="125" rx="62.5" fill="white"/>
<rect x="30" y="20" width="125" height="125" rx="62.5" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M55.8789 105.714L69.3974 95.3593C76.5762 104.732 84.1998 109.051 92.6948 109.051C101.143 109.051 108.557 104.781 115.414 95.4832L129.119 105.59C119.232 118.996 106.932 126.079 92.6948 126.079C78.5049 126.079 66.0907 119.046 55.8789 105.714Z" fill="url(#paint0_linear)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M92.6491 60.7078L68.5883 81.4406L57.4727 68.5407L92.6969 38.1885L127.647 68.5644L116.477 81.417L92.6491 60.7078Z" fill="url(#paint1_linear)"/>
</g>
<defs>
<filter id="filter0_d" x="0" y="0" width="185" height="185" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
<feOffset dy="10"/>
<feGaussianBlur stdDeviation="15"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.0627451 0 0 0 0 0.117647 0 0 0 0 0.211765 0 0 0 0.1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
</filter>
<linearGradient id="paint0_linear" x1="55.8789" y1="116.251" x2="129.119" y2="116.251" gradientUnits="userSpaceOnUse">
<stop stop-color="#8930FD"/>
<stop offset="1" stop-color="#49CCF9"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="57.4727" y1="67.6025" x2="127.647" y2="67.6025" gradientUnits="userSpaceOnUse">
<stop stop-color="#FF02F0"/>
<stop offset="1" stop-color="#FFC800"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,46 +0,0 @@
import generateAuthUrl from './generate-auth-url.js';
import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified.js';
export default {
fields: [
{
key: 'oAuthRedirectUrl',
label: 'OAuth Redirect URL',
type: 'string',
required: true,
readOnly: true,
value: '{WEB_APP_URL}/app/clickup/connections/add',
placeholder: null,
description:
'When asked to input a redirect URL in ClickUp, enter the URL above.',
clickToCopy: true,
},
{
key: 'clientId',
label: 'Client ID',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description: null,
clickToCopy: false,
},
{
key: 'clientSecret',
label: 'Client Secret',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description: null,
clickToCopy: false,
},
],
generateAuthUrl,
verifyCredentials,
isStillVerified,
};

View File

@@ -1,31 +0,0 @@
import getCurrentUser from '../common/get-current-user.js';
const verifyCredentials = async ($) => {
if ($.auth.data.originalState !== $.auth.data.state) {
throw new Error(`The 'state' parameter does not match.`);
}
const { data } = await $.http.post('/v2/oauth/token', {
client_id: $.auth.data.clientId,
client_secret: $.auth.data.clientSecret,
code: $.auth.data.code,
});
await $.auth.set({
accessToken: data.access_token,
tokenType: data.token_type,
});
const currentUser = await getCurrentUser($);
const screenName = [currentUser.username, currentUser.email]
.filter(Boolean)
.join(' @ ');
await $.auth.set({
clientId: $.auth.data.clientId,
clientSecret: $.auth.data.clientSecret,
screenName,
});
};
export default verifyCredentials;

View File

@@ -1,6 +0,0 @@
const getCurrentUser = async ($) => {
const { data } = await $.http.get('/v2/user');
return data.user;
};
export default getCurrentUser;

View File

@@ -1,19 +0,0 @@
import listAssignees from './list-assignees/index.js';
import listFolders from './list-folders/index.js';
import listLists from './list-lists/index.js';
import listSpaces from './list-spaces/index.js';
import listStatuses from './list-statuses/index.js';
import listTags from './list-tags/index.js';
import listTasks from './list-tasks/index.js';
import listWorkspaces from './list-workspaces/index.js';
export default [
listAssignees,
listFolders,
listLists,
listSpaces,
listStatuses,
listTags,
listTasks,
listWorkspaces,
];

View File

@@ -1,28 +0,0 @@
export default {
name: 'List assignees',
key: 'listAssignees',
async run($) {
const assignees = {
data: [],
};
const listId = $.step.parameters.listId;
if (!listId) {
return assignees;
}
const { data } = await $.http.get(`/v2/list/${listId}/member`);
if (data.members) {
for (const member of data.members) {
assignees.data.push({
value: member.id,
name: member.username,
});
}
}
return assignees;
},
};

View File

@@ -1,28 +0,0 @@
export default {
name: 'List folders',
key: 'listFolders',
async run($) {
const folders = {
data: [],
};
const spaceId = $.step.parameters.spaceId;
if (!spaceId) {
return folders;
}
const { data } = await $.http.get(`/v2/space/${spaceId}/folder`);
if (data.folders) {
for (const folder of data.folders) {
folders.data.push({
value: folder.id,
name: folder.name,
});
}
}
return folders;
},
};

View File

@@ -1,28 +0,0 @@
export default {
name: 'List lists',
key: 'listLists',
async run($) {
const lists = {
data: [],
};
const folderId = $.step.parameters.folderId;
if (!folderId) {
return lists;
}
const { data } = await $.http.get(`/v2/folder/${folderId}/list`);
if (data.lists) {
for (const list of data.lists) {
lists.data.push({
value: list.id,
name: list.name,
});
}
}
return lists;
},
};

View File

@@ -1,28 +0,0 @@
export default {
name: 'List spaces',
key: 'listSpaces',
async run($) {
const spaces = {
data: [],
};
const workspaceId = $.step.parameters.workspaceId;
if (!workspaceId) {
return spaces;
}
const { data } = await $.http.get(`/v2/team/${workspaceId}/space`);
if (data.spaces) {
for (const space of data.spaces) {
spaces.data.push({
value: space.id,
name: space.name,
});
}
}
return spaces;
},
};

View File

@@ -1,28 +0,0 @@
export default {
name: 'List statuses',
key: 'listStatuses',
async run($) {
const statuses = {
data: [],
};
const listId = $.step.parameters.listId;
if (!listId) {
return statuses;
}
const { data } = await $.http.get(`/v2/list/${listId}`);
if (data.statuses) {
for (const status of data.statuses) {
statuses.data.push({
value: status.status,
name: status.status,
});
}
}
return statuses;
},
};

View File

@@ -1,28 +0,0 @@
export default {
name: 'List tags',
key: 'listTags',
async run($) {
const tags = {
data: [],
};
const spaceId = $.step.parameters.spaceId;
if (!spaceId) {
return spaceId;
}
const { data } = await $.http.get(`v2/space/${spaceId}/tag`);
if (data.tags) {
for (const tag of data.tags) {
tags.data.push({
value: tag.name,
name: tag.name,
});
}
}
return tags;
},
};

View File

@@ -1,41 +0,0 @@
export default {
name: 'List tasks',
key: 'listTasks',
async run($) {
const tasks = {
data: [],
};
const listId = $.step.parameters.listId;
let next = false;
if (!listId) {
return tasks;
}
const params = {
order_by: 'created',
reverse: true,
};
do {
const { data } = await $.http.get(`/v2/list/${listId}/task`, { params });
if (data.last_page) {
next = false;
} else {
next = true;
}
if (data.tasks) {
for (const task of data.tasks) {
tasks.data.push({
value: task.id,
name: task.name,
});
}
}
} while (next);
return tasks;
},
};

View File

@@ -1,23 +0,0 @@
export default {
name: 'List workspaces',
key: 'listWorkspaces',
async run($) {
const workspaces = {
data: [],
};
const { data } = await $.http.get('/v2/team');
if (data.teams) {
for (const workspace of data.teams) {
workspaces.data.push({
value: workspace.id,
name: workspace.name,
});
}
}
return workspaces;
},
};

View File

@@ -1,3 +0,0 @@
import useCustomId from './use-custom-id/index.js';
export default [useCustomId];

View File

@@ -1,29 +0,0 @@
export default {
name: 'List workspaces when using custom id',
key: 'listFieldsWhenUsingCustomId',
async run($) {
if ($.step.parameters.useCustomId) {
return [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
];
}
},
};

View File

@@ -1,6 +0,0 @@
import newFolders from './new-folders/index.js';
import newLists from './new-lists/index.js';
import newTasks from './new-tasks/index.js';
import updatedTask from './updated-task/index.js';
export default [newFolders, newLists, newTasks, updatedTask];

View File

@@ -1,105 +0,0 @@
import Crypto from 'crypto';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New folders',
key: 'newFolder',
type: 'webhook',
description: 'Triggers when a new folder is created.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Space',
key: 'spaceId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSpaces',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
],
async run($) {
const dataItem = {
raw: $.request.body,
meta: {
internalId: $.request.body.folder_id,
},
};
$.pushTriggerItem(dataItem);
},
async testRun($) {
const sampleEventData = {
event: 'folderCreated',
folder_id: '90180382912',
webhook_id: Crypto.randomUUID(),
};
const dataItem = {
raw: sampleEventData,
meta: {
internalId: '',
},
};
$.pushTriggerItem(dataItem);
},
async registerHook($) {
const { workspaceId, spaceId } = $.step.parameters;
const payload = {
name: $.flow.id,
endpoint: $.webhookUrl,
events: ['folderCreated'],
};
if (spaceId) {
payload.space_id = spaceId;
}
const { data } = await $.http.post(
`/v2/team/${workspaceId}/webhook`,
payload
);
await $.flow.setRemoteWebhookId(data.id);
},
async unregisterHook($) {
await $.http.delete(`/v2/webhook/${$.flow.remoteWebhookId}`);
},
});

View File

@@ -1,129 +0,0 @@
import Crypto from 'crypto';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New lists',
key: 'newLists',
type: 'webhook',
description: 'Triggers when a new list is created.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Space',
key: 'spaceId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSpaces',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Folder',
key: 'folderId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.spaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listFolders',
},
{
name: 'parameters.spaceId',
value: '{parameters.spaceId}',
},
],
},
},
],
async run($) {
const dataItem = {
raw: $.request.body,
meta: {
internalId: $.request.body.list_id,
},
};
$.pushTriggerItem(dataItem);
},
async testRun($) {
const sampleEventData = {
event: 'listCreated',
list_id: '901800588812',
webhook_id: Crypto.randomUUID(),
};
const dataItem = {
raw: sampleEventData,
meta: {
internalId: sampleEventData.webhook_id,
},
};
$.pushTriggerItem(dataItem);
},
async registerHook($) {
const { workspaceId, spaceId, folderId } = $.step.parameters;
const payload = {
name: $.flow.id,
endpoint: $.webhookUrl,
events: ['listCreated'],
space_id: spaceId,
};
if (folderId) {
payload.folder_id = folderId;
}
const { data } = await $.http.post(
`/v2/team/${workspaceId}/webhook`,
payload
);
await $.flow.setRemoteWebhookId(data.id);
},
async unregisterHook($) {
await $.http.delete(`/v2/webhook/${$.flow.remoteWebhookId}`);
},
});

View File

@@ -1,186 +0,0 @@
import Crypto from 'crypto';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New tasks',
key: 'newTasks',
type: 'webhook',
description: 'Triggers when a new task is created.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Space',
key: 'spaceId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSpaces',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Folder',
key: 'folderId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.spaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listFolders',
},
{
name: 'parameters.spaceId',
value: '{parameters.spaceId}',
},
],
},
},
{
label: 'List',
key: 'listId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.folderId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listLists',
},
{
name: 'parameters.folderId',
value: '{parameters.folderId}',
},
],
},
},
{
label: 'Task',
key: 'taskId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.listId'],
description:
'Choose an optional task to determine when this flow should be activated. In this scenario, only subtasks will initiate this flow.',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listTasks',
},
{
name: 'parameters.listId',
value: '{parameters.listId}',
},
],
},
},
],
async run($) {
const dataItem = {
raw: $.request.body,
meta: {
internalId: $.request.body.task_id,
},
};
$.pushTriggerItem(dataItem);
},
async testRun($) {
const sampleEventData = {
event: 'taskCreated',
task_id: '86enn7pg7',
webhook_id: Crypto.randomUUID(),
history_items: [],
};
const dataItem = {
raw: sampleEventData,
meta: {
internalId: sampleEventData.webhook_id,
},
};
$.pushTriggerItem(dataItem);
},
async registerHook($) {
const { workspaceId, spaceId, folderId, listId, taskId } =
$.step.parameters;
const payload = {
name: $.flow.id,
endpoint: $.webhookUrl,
events: ['taskCreated'],
space_id: spaceId,
};
if (folderId) {
payload.folder_id = folderId;
}
if (listId) {
payload.list_id = listId;
}
if (taskId) {
payload.task_id = taskId;
}
const { data } = await $.http.post(
`/v2/team/${workspaceId}/webhook`,
payload
);
await $.flow.setRemoteWebhookId(data.id);
},
async unregisterHook($) {
await $.http.delete(`/v2/webhook/${$.flow.remoteWebhookId}`);
},
});

View File

@@ -1,172 +0,0 @@
import Crypto from 'crypto';
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'Updated task',
key: 'updatedTask',
type: 'webhook',
description: 'Triggers when a task is updated.',
arguments: [
{
label: 'Workspace',
key: 'workspaceId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listWorkspaces',
},
],
},
},
{
label: 'Space',
key: 'spaceId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.workspaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listSpaces',
},
{
name: 'parameters.workspaceId',
value: '{parameters.workspaceId}',
},
],
},
},
{
label: 'Folder',
key: 'folderId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.spaceId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listFolders',
},
{
name: 'parameters.spaceId',
value: '{parameters.spaceId}',
},
],
},
},
{
label: 'List',
key: 'listId',
type: 'dropdown',
required: false,
dependsOn: ['parameters.folderId'],
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listLists',
},
{
name: 'parameters.folderId',
value: '{parameters.folderId}',
},
],
},
},
{
label: 'What Changed?',
key: 'whatChanged',
type: 'dropdown',
required: false,
variables: true,
options: [
{ label: 'Status', value: 'taskStatusUpdated' },
{ label: 'Assignee Added', value: 'taskAssigneeUpdated' },
{ label: 'Priority', value: 'taskPriorityUpdated' },
{ label: 'Tag Added', value: 'taskTagUpdated' },
],
},
],
async run($) {
const dataItem = {
raw: $.request.body,
meta: {
internalId: Crypto.randomUUID(),
},
};
$.pushTriggerItem(dataItem);
},
async testRun($) {
const sampleEventData = {
event: 'taskUpdated',
task_id: '86enn7pg7',
webhook_id: Crypto.randomUUID(),
history_items: [],
};
const dataItem = {
raw: sampleEventData,
meta: {
internalId: sampleEventData.webhook_id,
},
};
$.pushTriggerItem(dataItem);
},
async registerHook($) {
const { workspaceId, spaceId, folderId, listId, whatChanged } =
$.step.parameters;
const payload = {
name: $.flow.id,
endpoint: $.webhookUrl,
space_id: spaceId,
};
payload.events = [whatChanged || 'taskUpdated'];
if (folderId) {
payload.folder_id = folderId;
}
if (listId) {
payload.list_id = listId;
}
const { data } = await $.http.post(
`/v2/team/${workspaceId}/webhook`,
payload
);
await $.flow.setRemoteWebhookId(data.id);
},
async unregisterHook($) {
await $.http.delete(`/v2/webhook/${$.flow.remoteWebhookId}`);
},
});

View File

@@ -1,3 +0,0 @@
import runJavascript from './run-javascript/index.js';
export default [runJavascript];

View File

@@ -1,84 +0,0 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Run Javascript',
key: 'runJavascript',
description:
'Run browser Javascript code. You can not use NodeJS specific features and npm packages.',
arguments: [
{
label: 'Inputs',
key: 'inputs',
type: 'dynamic',
required: false,
description:
'To be able to use data from previous steps, you need to expose them as input entries. You can access these input values in your code by using the `inputs` argument.',
value: [
{
key: '',
value: '',
},
],
fields: [
{
label: 'Key',
key: 'key',
type: 'string',
required: true,
variables: true,
},
{
label: 'Value',
key: 'value',
type: 'string',
required: true,
variables: true,
valueType: 'parse',
},
],
},
{
label: 'Code Snippet',
key: 'codeSnippet',
type: 'code',
required: true,
variables: false,
value:
'const code = async (inputs) => { \n // E.g. if you have an input called username,\n // you can access its value by calling inputs.username\n // Return value will be used as output of this step.\n\n return true;\n};',
},
],
async run($) {
const { inputs = [], codeSnippet } = $.step.parameters;
const objectifiedInput = {};
for (const input of inputs) {
if (input.key) {
objectifiedInput[input.key] = input.value;
}
}
const ivm = (await import('isolated-vm')).default;
const isolate = new ivm.Isolate({ memoryLimit: 128 });
try {
const context = await isolate.createContext();
await context.global.set(
'inputs',
new ivm.ExternalCopy(objectifiedInput).copyInto()
);
const compiledCodeSnippet = await isolate.compileScript(
`${codeSnippet}; code(inputs);`
);
const codeFunction = await compiledCodeSnippet.run(context, {
reference: true,
promise: true,
});
$.setActionItem({ raw: { output: await codeFunction.copy() } });
} finally {
isolate.dispose();
}
},
});

View File

@@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="800px" height="800px" viewBox="0 0 512 512">
<polyline points="160 368 32 256 160 144" style="fill:none;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/>
<polyline points="352 368 480 256 352 144" style="fill:none;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/>
<line x1="304" y1="96" x2="208" y2="416" style="fill:none;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/>
</svg>

Before

Width:  |  Height:  |  Size: 519 B

View File

@@ -1,14 +0,0 @@
import defineApp from '../../helpers/define-app.js';
import actions from './actions/index.js';
export default defineApp({
name: 'Code',
key: 'code',
baseUrl: '',
apiBaseUrl: '',
iconUrl: '{BASE_URL}/apps/code/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/code/connection',
primaryColor: '#000000',
supportsConnections: false,
actions,
});

View File

@@ -1,64 +0,0 @@
import { createHmac } from 'node:crypto';
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create HMAC',
key: 'createHmac',
description: 'Create a Hash-based Message Authentication Code (HMAC) using the specified algorithm, secret key, and message.',
arguments: [
{
label: 'Algorithm',
key: 'algorithm',
type: 'dropdown',
required: true,
value: 'sha256',
description: 'Specifies the cryptographic hash function to use for HMAC generation.',
options: [
{ label: 'SHA-256', value: 'sha256' },
],
variables: true,
},
{
label: 'Message',
key: 'message',
type: 'string',
required: true,
description: 'The input message to be hashed. This is the value that will be processed to generate the HMAC.',
variables: true,
},
{
label: 'Secret Key',
key: 'secretKey',
type: 'string',
required: true,
description: 'The secret key used to create the HMAC.',
variables: true,
},
{
label: 'Output Encoding',
key: 'outputEncoding',
type: 'dropdown',
required: true,
value: 'hex',
description: 'Specifies the encoding format for the HMAC digest output.',
options: [
{ label: 'base64', value: 'base64' },
{ label: 'base64url', value: 'base64url' },
{ label: 'hex', value: 'hex' },
],
variables: true,
},
],
async run($) {
const hash = createHmac($.step.parameters.algorithm, $.step.parameters.secretKey)
.update($.step.parameters.message)
.digest($.step.parameters.outputEncoding);
$.setActionItem({
raw: {
hash
},
});
},
});

View File

@@ -1,65 +0,0 @@
import crypto from 'node:crypto';
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create Signature',
key: 'createSignature',
description: 'Create a digital signature using the specified algorithm, secret key, and message.',
arguments: [
{
label: 'Algorithm',
key: 'algorithm',
type: 'dropdown',
required: true,
value: 'RSA-SHA256',
description: 'Specifies the cryptographic hash function to use for HMAC generation.',
options: [
{ label: 'RSA-SHA256', value: 'RSA-SHA256' },
],
variables: true,
},
{
label: 'Message',
key: 'message',
type: 'string',
required: true,
description: 'The input message to be signed.',
variables: true,
},
{
label: 'Private Key',
key: 'privateKey',
type: 'string',
required: true,
description: 'The RSA private key in PEM format used for signing.',
variables: true,
},
{
label: 'Output Encoding',
key: 'outputEncoding',
type: 'dropdown',
required: true,
value: 'hex',
description: 'Specifies the encoding format for the digital signature output. This determines how the generated signature will be represented as a string.',
options: [
{ label: 'base64', value: 'base64' },
{ label: 'base64url', value: 'base64url' },
{ label: 'hex', value: 'hex' },
],
variables: true,
},
],
async run($) {
const signer = crypto.createSign($.step.parameters.algorithm);
signer.update($.step.parameters.message);
signer.end();
const signature = signer.sign($.step.parameters.privateKey, $.step.parameters.outputEncoding);
$.setActionItem({
raw: {
signature
},
});
},
});

View File

@@ -1,4 +0,0 @@
import createHmac from './create-hmac/index.js';
import createRsaSha256Signature from './create-rsa-sha256-signature/index.js';
export default [createHmac, createRsaSha256Signature];

View File

@@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="100pt" height="100pt" version="1.1" viewBox="0 0 100 100">
<path d="m66.012 33h-3.0117v-11c0-7.1719-5.8281-13-13-13s-13 5.8281-13 13v11h-3.0117c-2.75 0-4.9883 2.2383-4.9883 4.9883v28.012c0 2.75 2.2383 4.9883 4.9883 4.9883h32.012c2.75 0 4.9883-2.2383 4.9883-4.9883v-28.012c0.011719-2.75-2.2266-4.9883-4.9766-4.9883zm-27.012-11c0-6.0703 4.9297-11 11-11s11 4.9297 11 11v11h-22zm30 44.012c0 1.6484-1.3398 2.9883-2.9883 2.9883h-32.023c-1.6484 0-2.9883-1.3398-2.9883-2.9883v-28.023c0-1.6484 1.3398-2.9883 2.9883-2.9883h32.023c1.6484 0 2.9883 1.3398 2.9883 2.9883zm-18 9.9883v14c0 0.55078-0.44922 1-1 1s-1-0.44922-1-1v-14c0-0.55078 0.44922-1 1-1s1 0.44922 1 1zm20 8c0 0.55078-0.44922 1-1 1h-8c-0.55078 0-1-0.44922-1-1v-8c0-0.55078 0.44922-1 1-1s1 0.44922 1 1v7h7c0.55078 0 1 0.44922 1 1zm-32-8v8c0 0.55078-0.44922 1-1 1h-8c-0.55078 0-1-0.44922-1-1s0.44922-1 1-1h7v-7c0-0.55078 0.44922-1 1-1s1 0.44922 1 1zm-14-26c0 0.55078-0.44922 1-1 1h-14c-0.55078 0-1-0.44922-1-1s0.44922-1 1-1h14c0.55078 0 1 0.44922 1 1zm0-12c0 0.55078-0.44922 1-1 1h-8c-0.55078 0-1-0.44922-1-1v-8c0-0.55078 0.44922-1 1-1s1 0.44922 1 1v7h7c0.55078 0 1 0.44922 1 1zm0 24c0 0.55078-0.44922 1-1 1h-7v7c0 0.55078-0.44922 1-1 1s-1-0.44922-1-1v-8c0-0.55078 0.44922-1 1-1h8c0.55078 0 1 0.44922 1 1zm66-12c0 0.55078-0.44922 1-1 1h-14c-0.55078 0-1-0.44922-1-1s0.44922-1 1-1h14c0.55078 0 1 0.44922 1 1zm-16-12c0-0.55078 0.44922-1 1-1h7v-7c0-0.55078 0.44922-1 1-1s1 0.44922 1 1v8c0 0.55078-0.44922 1-1 1h-8c-0.55078 0-1-0.44922-1-1zm10 24v8c0 0.55078-0.44922 1-1 1s-1-0.44922-1-1v-7h-7c-0.55078 0-1-0.44922-1-1s0.44922-1 1-1h8c0.55078 0 1 0.44922 1 1zm-35-17c-2.7617 0-5 2.2383-5 5 0 2.4102 1.7188 4.4297 4 4.8984v5.1016c0 0.55078 0.44922 1 1 1s1-0.44922 1-1v-5.1016c2.2812-0.46094 4-2.4805 4-4.8984 0-2.7617-2.2383-5-5-5zm0 8c-1.6484 0-3-1.3516-3-3s1.3516-3 3-3 3 1.3516 3 3-1.3516 3-3 3z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,14 +0,0 @@
import defineApp from '../../helpers/define-app.js';
import actions from './actions/index.js';
export default defineApp({
name: 'Cryptography',
key: 'cryptography',
iconUrl: '{BASE_URL}/apps/cryptography/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/cryptography/connection',
supportsConnections: false,
baseUrl: '',
apiBaseUrl: '',
primaryColor: '#001F52',
actions,
});

View File

@@ -9,6 +9,6 @@ export default defineApp({
supportsConnections: false,
baseUrl: '',
apiBaseUrl: '',
primaryColor: '#001F52',
primaryColor: '001F52',
actions,
});

View File

@@ -11,7 +11,7 @@ export default defineApp({
supportsConnections: true,
baseUrl: 'https://deepl.com',
apiBaseUrl: 'https://api.deepl.com',
primaryColor: '#0d2d45',
primaryColor: '0d2d45',
beforeRequest: [addAuthHeader],
auth,
actions,

View File

@@ -9,6 +9,6 @@ export default defineApp({
supportsConnections: false,
baseUrl: '',
apiBaseUrl: '',
primaryColor: '#001F52',
primaryColor: '001F52',
actions,
});

View File

@@ -14,7 +14,7 @@ export default defineApp({
supportsConnections: true,
baseUrl: 'https://discord.com',
apiBaseUrl: 'https://discord.com/api',
primaryColor: '#5865f2',
primaryColor: '5865f2',
beforeRequest: [addAuthHeader],
auth,
dynamicData,

View File

@@ -11,7 +11,7 @@ export default defineApp({
apiBaseUrl: 'https://disqus.com/api',
iconUrl: '{BASE_URL}/apps/disqus/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/disqus/connection',
primaryColor: '#2E9FFF',
primaryColor: '2E9FFF',
supportsConnections: true,
beforeRequest: [addAuthHeader],
auth,

View File

@@ -11,7 +11,7 @@ export default defineApp({
supportsConnections: true,
baseUrl: 'https://dropbox.com',
apiBaseUrl: 'https://api.dropboxapi.com',
primaryColor: '#0061ff',
primaryColor: '0061ff',
beforeRequest: [addAuthHeader],
auth,
actions,

View File

@@ -9,6 +9,6 @@ export default defineApp({
supportsConnections: false,
baseUrl: '',
apiBaseUrl: '',
primaryColor: '#001F52',
primaryColor: '001F52',
actions,
});

View File

@@ -10,7 +10,7 @@ export default defineApp({
iconUrl: '{BASE_URL}/apps/flickr/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/flickr/connection',
docUrl: 'https://automatisch.io/docs/flickr',
primaryColor: '#000000',
primaryColor: '000000',
supportsConnections: true,
baseUrl: 'https://www.flickr.com/',
apiBaseUrl: 'https://www.flickr.com/services',

View File

@@ -11,7 +11,7 @@ export default defineApp({
supportsConnections: true,
baseUrl: 'https://flowers-software.com',
apiBaseUrl: 'https://webapp.flowers-software.com/api',
primaryColor: '#02AFC7',
primaryColor: '02AFC7',
beforeRequest: [addAuthHeader],
auth,
triggers,

View File

@@ -1,10 +1,8 @@
import defineAction from '../../../../helpers/define-action.js';
import formatDateTime from './transformers/format-date-time.js';
import getCurrentTimestamp from './transformers/get-current-timestamp.js';
const transformers = {
formatDateTime,
getCurrentTimestamp,
};
export default defineAction({
@@ -18,16 +16,7 @@ export default defineAction({
type: 'dropdown',
required: true,
variables: true,
options: [
{
label: 'Get current timestamp',
value: 'getCurrentTimestamp',
},
{
label: 'Format Date / Time',
value: 'formatDateTime',
},
],
options: [{ label: 'Format Date / Time', value: 'formatDateTime' }],
additionalFields: {
type: 'query',
name: 'getDynamicFields',

View File

@@ -1,5 +0,0 @@
const getCurrentTimestamp = () => {
return Date.now();
};
export default getCurrentTimestamp;

View File

@@ -14,8 +14,6 @@ import stringToBase64 from './transformers/string-to-base64.js';
import encodeUri from './transformers/encode-uri.js';
import trimWhitespace from './transformers/trim-whitespace.js';
import useDefaultValue from './transformers/use-default-value.js';
import parseStringifiedJson from './transformers/parse-stringified-json.js';
import createUuid from './transformers/create-uuid.js';
const transformers = {
base64ToString,
@@ -32,8 +30,6 @@ const transformers = {
encodeUri,
trimWhitespace,
useDefaultValue,
parseStringifiedJson,
createUuid,
};
export default defineAction({
@@ -51,21 +47,19 @@ export default defineAction({
options: [
{ label: 'Base64 to String', value: 'base64ToString' },
{ label: 'Capitalize', value: 'capitalize' },
{ label: 'Convert HTML to Markdown', value: 'htmlToMarkdown' },
{ label: 'Convert Markdown to HTML', value: 'markdownToHtml' },
{ label: 'Create UUID', value: 'createUuid' },
{ label: 'Encode URI', value: 'encodeUri' },
{
label: 'Encode URI Component',
value: 'encodeUriComponent',
},
{ label: 'Convert HTML to Markdown', value: 'htmlToMarkdown' },
{ label: 'Convert Markdown to HTML', value: 'markdownToHtml' },
{ label: 'Extract Email Address', value: 'extractEmailAddress' },
{ label: 'Extract Number', value: 'extractNumber' },
{ label: 'Lowercase', value: 'lowercase' },
{ label: 'Parse stringified JSON', value: 'parseStringifiedJson' },
{ label: 'Pluralize', value: 'pluralize' },
{ label: 'Replace', value: 'replace' },
{ label: 'String to Base64', value: 'stringToBase64' },
{ label: 'Encode URI', value: 'encodeUri' },
{ label: 'Trim Whitespace', value: 'trimWhitespace' },
{ label: 'Use Default Value', value: 'useDefaultValue' },
],

View File

@@ -1,7 +0,0 @@
import { v4 as uuidv4 } from 'uuid';
const createUuidV4 = () => {
return uuidv4();
};
export default createUuidV4;

View File

@@ -1,7 +0,0 @@
const parseStringifiedJson = ($) => {
const input = $.step.parameters.input;
return JSON.parse(input);
};
export default parseStringifiedJson;

View File

@@ -1,26 +1,8 @@
const replace = ($) => {
const input = $.step.parameters.input;
const find = $.step.parameters.find;
const replace = $.step.parameters.replace;
const useRegex = $.step.parameters.useRegex;
if (useRegex) {
const ignoreCase = $.step.parameters.ignoreCase;
const flags = [ignoreCase && 'i', 'g'].filter(Boolean).join('');
const timeoutId = setTimeout(() => {
$.execution.exit();
}, 100);
const regex = new RegExp(find, flags);
const replacedValue = input.replaceAll(regex, replace);
clearTimeout(timeoutId);
return replacedValue;
}
return input.replaceAll(find, replace);
};

View File

@@ -1,4 +1,3 @@
import listTransformOptions from './list-transform-options/index.js';
import listReplaceRegexOptions from './list-replace-regex-options/index.js';
export default [listTransformOptions, listReplaceRegexOptions];
export default [listTransformOptions];

View File

@@ -1,23 +0,0 @@
export default {
name: 'List replace regex options',
key: 'listReplaceRegexOptions',
async run($) {
if (!$.step.parameters.useRegex) return [];
return [
{
label: 'Ignore case',
key: 'ignoreCase',
type: 'dropdown',
required: true,
description: 'Ignore case sensitivity.',
variables: true,
options: [
{ label: 'Yes', value: true },
{ label: 'No', value: false },
],
},
];
},
};

View File

@@ -12,7 +12,6 @@ import stringToBase64 from './text/string-to-base64.js';
import encodeUri from './text/encode-uri.js';
import trimWhitespace from './text/trim-whitespace.js';
import useDefaultValue from './text/use-default-value.js';
import parseStringifiedJson from './text/parse-stringified-json.js';
import performMathOperation from './numbers/perform-math-operation.js';
import randomNumber from './numbers/random-number.js';
import formatNumber from './numbers/format-number.js';
@@ -39,7 +38,6 @@ const options = {
formatNumber,
formatPhoneNumber,
formatDateTime,
parseStringifiedJson,
};
export default {

View File

@@ -1,12 +0,0 @@
const useDefaultValue = [
{
label: 'Input',
key: 'input',
type: 'string',
required: true,
description: 'Stringified JSON you want to parse.',
variables: true,
},
];
export default useDefaultValue;

View File

@@ -23,33 +23,6 @@ const replace = [
description: 'Text that will replace the found text.',
variables: true,
},
{
label: 'Use Regular Expression',
key: 'useRegex',
type: 'dropdown',
required: true,
description: 'Use regex to search values.',
variables: true,
value: false,
options: [
{ label: 'Yes', value: true },
{ label: 'No', value: false },
],
additionalFields: {
type: 'query',
name: 'getDynamicFields',
arguments: [
{
name: 'key',
value: 'listReplaceRegexOptions',
},
{
name: 'parameters.useRegex',
value: '{parameters.useRegex}',
},
],
},
},
];
export default replace;

View File

@@ -10,7 +10,7 @@ export default defineApp({
supportsConnections: false,
baseUrl: '',
apiBaseUrl: '',
primaryColor: '#001F52',
primaryColor: '001F52',
actions,
dynamicFields,
});

View File

@@ -11,7 +11,7 @@ export default defineApp({
apiBaseUrl: '',
iconUrl: '{BASE_URL}/apps/ghost/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/ghost/connection',
primaryColor: '#15171A',
primaryColor: '15171A',
supportsConnections: true,
beforeRequest: [setBaseUrl, addAuthHeader],
auth,

View File

@@ -10,7 +10,7 @@ export default defineAction({
label: 'Repo',
key: 'repo',
type: 'dropdown',
required: true,
required: false,
variables: true,
source: {
type: 'query',

View File

@@ -12,7 +12,7 @@ export default defineApp({
apiBaseUrl: 'https://api.github.com',
iconUrl: '{BASE_URL}/apps/github/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/github/connection',
primaryColor: '#000000',
primaryColor: '000000',
supportsConnections: true,
beforeRequest: [addAuthHeader],
auth,

View File

@@ -12,7 +12,7 @@ export default defineApp({
apiBaseUrl: 'https://gitlab.com',
iconUrl: '{BASE_URL}/apps/gitlab/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/gitlab/connection',
primaryColor: '#FC6D26',
primaryColor: 'FC6D26',
supportsConnections: true,
beforeRequest: [setBaseUrl, addAuthHeader],
auth,

Some files were not shown because too many files have changed in this diff Show More