Compare commits

...

85 Commits

Author SHA1 Message Date
Rıdvan Akca
77f84944c7 feat(better-stack): add acknowledge incident action 2024-01-16 12:37:41 +03:00
Rıdvan Akca
8a8be21d56 test: make better stack first when creating a connection 2024-01-16 12:37:06 +03:00
Rıdvan Akca
e5c4e18fd5 feat(better-stack): add better stack integration 2024-01-16 12:37:06 +03:00
Ömer Faruk Aydın
953c5a5b5b Merge pull request #1540 from automatisch/authentication-tests
feat: Add tests for authentication helper
2024-01-15 16:10:36 +01:00
Ömer Faruk Aydın
4313265c00 Merge pull request #1541 from automatisch/remove-cli-from
chore: Remove cli package from linter and build scripts
2024-01-15 16:10:24 +01:00
Faruk AYDIN
9405f267ba chore: Remove build:watch script 2024-01-15 16:06:28 +01:00
Faruk AYDIN
1d29238199 chore: Remove cli package from linter and build scripts 2024-01-15 15:33:21 +01:00
Faruk AYDIN
c5bf66f462 chore: Remove redundant import of authentication rule 2024-01-15 15:31:20 +01:00
Faruk AYDIN
e6180bdfaa chore: No need to export authentication options 2024-01-15 15:31:00 +01:00
Faruk AYDIN
55c391afc8 chore: Remove authentication cases from individual tests 2024-01-15 15:27:30 +01:00
Faruk AYDIN
782fa67320 feat: Add tests for authentication helper 2024-01-15 15:21:04 +01:00
Ömer Faruk Aydın
1e3ab75bb7 Merge pull request #1538 from automatisch/remove-types-package
chore: Remove types package
2024-01-15 13:57:01 +01:00
Faruk AYDIN
5f6dd12a73 chore: Remove types package from web dependencies 2024-01-15 13:41:54 +01:00
Faruk AYDIN
d18c06d2c4 chore: Remove types package 2024-01-15 13:37:58 +01:00
Ömer Faruk Aydın
baf99a9cfe Merge pull request #1537 from automatisch/web/types
chore: Use types from the web package
2024-01-15 13:37:43 +01:00
Faruk AYDIN
159931a6ea chore: Use types from the web package 2024-01-15 13:30:48 +01:00
Ömer Faruk Aydın
7831f2925b Merge pull request #1536 from automatisch/docs/remove-typescript
Use JS for the documentation examples
2024-01-15 13:17:48 +01:00
Faruk AYDIN
8fcb7840de docs: Convert code examples to JS 2024-01-15 13:13:48 +01:00
Faruk AYDIN
9ece9461dc docs: Convert all file imports to ES modules 2024-01-15 13:10:26 +01:00
Faruk AYDIN
b304acaaba docs: Use .js file extension 2024-01-15 13:02:06 +01:00
Faruk AYDIN
5a1960609a docs: Use JS highlighter instead of TS 2024-01-15 12:56:43 +01:00
Faruk AYDIN
476aa6e3aa docs: Remove imports of automatisch types 2024-01-15 12:55:55 +01:00
Ömer Faruk Aydın
aa76007fd0 Merge pull request #1533 from automatisch/remove-cli
chore: Remove cli package
2024-01-14 21:06:46 +01:00
Faruk AYDIN
17a8813c4b chore: Remove build step from CI for cli 2024-01-14 20:13:23 +01:00
Faruk AYDIN
fe79fc9003 chore: Remove cli package 2024-01-14 20:10:23 +01:00
Ömer Faruk Aydın
ac8649ac18 Merge pull request #1532 from automatisch/seed-user
fix: Exit process after creating seed user
2024-01-13 03:07:05 +01:00
Faruk AYDIN
817db026b1 fix: Exit process after creating database and user 2024-01-13 02:59:00 +01:00
Faruk AYDIN
01ef97949b feat: Convert migration file names if there is a table 2024-01-13 02:58:28 +01:00
Faruk AYDIN
9e151051a8 fix: Exit process after creating seed user 2024-01-13 02:55:42 +01:00
Ömer Faruk Aydın
0feab23eb6 Merge pull request #1531 from automatisch/dockerfile-cloud
fix: Remove redundant branch tag for dockerfile cloud
2024-01-12 18:12:48 +01:00
Faruk AYDIN
8957f83939 fix: Remove redundant branch tag for dockerfile cloud 2024-01-12 18:08:55 +01:00
Ömer Faruk Aydın
3bf2bc94f3 Merge pull request #1517 from automatisch/models-js
feat: Convert model files to JS
2024-01-12 18:05:44 +01:00
Faruk AYDIN
8c3d5f1f4b feat: Convert old TS migration names to JS names 2024-01-12 17:50:09 +01:00
Faruk AYDIN
124e6e0811 feat: Execute db:migrate and db:seed:user for main instance 2024-01-12 17:30:05 +01:00
Faruk AYDIN
54d9d17d14 chore: Make dockerfile cloud work with main branch 2024-01-12 17:24:29 +01:00
Faruk AYDIN
62bdb7fb6d fix: Import statements of removed subscription job 2024-01-12 16:44:56 +01:00
Faruk AYDIN
af6574fdf1 feat: Do not build web when it's a worker instance 2024-01-12 16:44:44 +01:00
Faruk AYDIN
115a993cd2 feat: Convert cloud dockerfile to work without build step 2024-01-12 16:33:58 +01:00
Faruk AYDIN
188b6c2fe5 chore: Remove @automatisch/web from backend package 2024-01-12 16:10:37 +01:00
Faruk AYDIN
99adb2ceda feat: Update node version to 18 for Dockerfiles 2024-01-12 15:17:09 +01:00
Faruk AYDIN
6344a3bcef feat: Remove jest from dev dependencies 2024-01-12 14:23:03 +01:00
Faruk AYDIN
f62c17de0b fix: Remove redundant only statement from backend tests 2024-01-12 14:22:19 +01:00
Faruk AYDIN
9d269b8111 chore: Change CI node version to 18 2024-01-12 14:19:29 +01:00
Faruk AYDIN
49b26a9640 chore: Remove tsconfig file for backend package 2024-01-12 14:15:39 +01:00
Faruk AYDIN
dddb79eeb2 chore: Remove ts-jest from dev dependencies 2024-01-12 14:14:30 +01:00
Faruk AYDIN
b0909ecb98 chore: Change main and files of backend package 2024-01-12 14:13:45 +01:00
Faruk AYDIN
ec63ce0532 chore: Remove sinon from dependencies 2024-01-12 14:13:26 +01:00
Faruk AYDIN
1eb03e3afb chore: Remove all dev dependencies for types 2024-01-12 14:10:58 +01:00
Faruk AYDIN
26d906f1b7 chore: Remove ts-node and ts-node-dev libraries 2024-01-12 14:09:00 +01:00
Faruk AYDIN
af9ceac0b4 feat: Use vitest instead of jest for ESM compatibility 2024-01-12 14:07:59 +01:00
Faruk AYDIN
911159a14f chore: Update NodeJS from 16.15 to 18.19 to use vitest 2024-01-11 19:37:00 +01:00
Faruk AYDIN
6a639e4ac9 chore: Use ES module path to import auth files 2024-01-09 12:51:41 +01:00
Faruk AYDIN
c4a6c86a69 feat: Make web app path static for the backend 2024-01-08 18:36:36 +01:00
Faruk AYDIN
d2bac9d8d1 chore: Adjust cli package to use JS for linter 2024-01-08 17:23:06 +01:00
Faruk AYDIN
758aa50550 feat: Change playwright test setup for the backend 2024-01-08 17:20:03 +01:00
Faruk AYDIN
1af887cee7 chore: Remove backend build step from cli build 2024-01-08 17:11:26 +01:00
Faruk AYDIN
34b115c694 feat: Convert cli files to JS 2024-01-08 17:08:20 +01:00
Faruk AYDIN
8e4935409f feat: Add start worker CI step for the backend package 2024-01-08 16:40:20 +01:00
Faruk AYDIN
ca32d221c4 fix: Remove redundant lerna bootstrap command 2024-01-08 16:35:04 +01:00
Faruk AYDIN
e2de1fe038 feat: Add webhook secret key to CI step 2024-01-08 16:26:25 +01:00
Faruk AYDIN
80179062db feat: Add sample encryption key to CI step 2024-01-08 16:15:47 +01:00
Faruk AYDIN
7143620d25 feat: Remove root files for worker, server, logger and database 2024-01-08 16:09:58 +01:00
Faruk AYDIN
a0e51e2a7e feat: Change CI configuration to start backend instead of build 2024-01-08 16:02:48 +01:00
Faruk AYDIN
53dbd01cb1 feat: Adjust start command to work without dist folder 2024-01-08 15:55:53 +01:00
Faruk AYDIN
3607c16fd1 chore: Remove build:watch script from backend 2024-01-08 15:55:29 +01:00
Faruk AYDIN
4dfdd01295 chore: Remove build and related scripts from backend 2024-01-08 15:54:32 +01:00
Faruk AYDIN
8983a3c581 chore: Remove types folder of the backend package 2024-01-08 15:53:41 +01:00
Faruk AYDIN
9cddef9108 fix: Adjust migrations folder for new JS structure 2024-01-08 14:49:30 +01:00
Faruk AYDIN
3dbea953a7 chore: Remove tsc command from build script 2024-01-08 14:49:14 +01:00
Faruk AYDIN
962bbc04b5 fix: Change require.resolve to work with ESM 2024-01-08 12:25:21 +01:00
Faruk AYDIN
0804026d74 fix: Correct dirname for the app config 2024-01-08 12:24:53 +01:00
Faruk AYDIN
879aa1f9f8 fix: Eslint offenses for JS files 2024-01-07 20:09:36 +01:00
Faruk AYDIN
9ffe2c14df chore: Exclude apps folder from type roots 2024-01-07 19:38:07 +01:00
Faruk AYDIN
f0d2f07193 feat: Convert package scripts to work with JS 2024-01-07 19:36:44 +01:00
Faruk AYDIN
ccf5928262 feat: Adjust eslint configuration to work with JS 2024-01-07 19:33:18 +01:00
Faruk AYDIN
b2f8634008 chore: Use ES modules for backend app 2024-01-05 19:08:04 +01:00
Faruk AYDIN
43dba351c3 feat: Convert all app files to JS 2024-01-05 17:44:21 +01:00
Faruk AYDIN
b95478b635 chore: Use imports as ES modules 2024-01-04 22:24:42 +01:00
Faruk AYDIN
523f8a8951 feat: Convert app, server, worker ts files to JS 2024-01-04 21:47:34 +01:00
Faruk AYDIN
0f71924d06 feat: Convert migration files to JS 2024-01-04 21:44:40 +01:00
Faruk AYDIN
6d1bfc0be0 fix: Remove response data types to get rid of ts errors 2024-01-04 21:17:15 +01:00
Faruk AYDIN
b0f53268f6 feat: Convert factories files to JS 2024-01-04 21:10:42 +01:00
Faruk AYDIN
75f5db23df feat: Conveert bin folder to use JS files 2024-01-04 21:07:19 +01:00
Faruk AYDIN
85141812d9 feat: Convert helpers to use JS files 2024-01-04 19:55:41 +01:00
Faruk AYDIN
8819ddefa7 feat: Convert model files to JS 2024-01-04 19:27:13 +01:00
1458 changed files with 9581 additions and 30248 deletions

View File

@@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '18'
cache: 'yarn' cache: 'yarn'
cache-dependency-path: yarn.lock cache-dependency-path: yarn.lock
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
@@ -24,7 +24,7 @@ jobs:
- run: yarn --frozen-lockfile - run: yarn --frozen-lockfile
- run: yarn lint - run: yarn lint
- run: echo "🍏 This job's status is ${{ job.status }}." - run: echo "🍏 This job's status is ${{ job.status }}."
build-backend: start-backend-server:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
@@ -33,13 +33,36 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '18'
cache: 'yarn' cache: 'yarn'
cache-dependency-path: yarn.lock cache-dependency-path: yarn.lock
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - 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: echo "🖥️ The workflow is now ready to test your code on the runner."
- run: yarn --frozen-lockfile && yarn lerna bootstrap - run: yarn --frozen-lockfile && yarn lerna bootstrap
- run: cd packages/backend && yarn build - run: cd packages/backend && yarn start
env:
ENCRYPTION_KEY: sample_encryption_key
WEBHOOK_SECRET_KEY: sample_webhook_secret_key
- run: echo "🍏 This job's status is ${{ job.status }}."
start-backend-worker:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
cache: 'yarn'
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 && yarn lerna bootstrap
- run: cd packages/backend && yarn start:worker
env:
ENCRYPTION_KEY: sample_encryption_key
WEBHOOK_SECRET_KEY: sample_webhook_secret_key
- run: echo "🍏 This job's status is ${{ job.status }}." - run: echo "🍏 This job's status is ${{ job.status }}."
build-web: build-web:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -50,7 +73,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '18'
cache: 'yarn' cache: 'yarn'
cache-dependency-path: yarn.lock cache-dependency-path: yarn.lock
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
@@ -60,21 +83,3 @@ jobs:
env: env:
CI: false CI: false
- run: echo "🍏 This job's status is ${{ job.status }}." - run: echo "🍏 This job's status is ${{ job.status }}."
build-cli:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'yarn'
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 && yarn lerna bootstrap
- run: cd packages/backend && yarn build
- run: cd packages/cli && yarn build
- run: echo "🍏 This job's status is ${{ job.status }}."

View File

@@ -63,13 +63,13 @@ jobs:
- name: Install Playwright Browsers - name: Install Playwright Browsers
run: yarn playwright install --with-deps run: yarn playwright install --with-deps
- name: Build Automatisch - name: Build Automatisch
run: yarn lerna run --scope=@*/{web,backend,cli} build run: yarn lerna run --scope=@*/{web,cli} build
env: env:
# Keep this until we clean up warnings in build processes # Keep this until we clean up warnings in build processes
CI: false CI: false
- name: Migrate database - name: Migrate database
working-directory: ./packages/backend working-directory: ./packages/backend
run: yarn db:migrate --migrations-directory ./dist/src/db/migrations run: yarn db:migrate
- name: Seed user - name: Seed user
working-directory: ./packages/backend working-directory: ./packages/backend
run: yarn db:seed:user & run: yarn db:seed:user &
@@ -96,7 +96,7 @@ jobs:
run: yarn start & run: yarn start &
working-directory: ./packages/backend working-directory: ./packages/backend
- name: Run Automatisch worker - name: Run Automatisch worker
run: node dist/src/worker.js & run: yarn start:worker &
working-directory: ./packages/backend working-directory: ./packages/backend
- name: Setup upterm session - name: Setup upterm session
if: false if: false

View File

@@ -1 +1 @@
16.15.0 18.19.0

2
.nvmrc
View File

@@ -1 +1 @@
16.15.0 18.19.0

View File

@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM node:16-alpine FROM node:18-alpine
WORKDIR /automatisch WORKDIR /automatisch
RUN \ RUN \

View File

@@ -1,17 +1,22 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM node:16-alpine FROM node:18-alpine
WORKDIR /automatisch
ENV PORT 3000 ENV PORT 3000
RUN ls -lna RUN \
apk --no-cache add --virtual build-dependencies python3 build-base git
# copy the app, note .dockerignore RUN git clone https://github.com/automatisch/automatisch.git
COPY . ./
RUN yarn WORKDIR /automatisch
RUN yarn lerna bootstrap
RUN yarn lerna run --scope=@*/{web,backend,cli} build RUN yarn install
RUN if [ "$WORKER" != "true" ]; then cd packages/web && yarn build; fi
RUN \
rm -rf /usr/local/share/.cache/ && \
apk del build-dependencies
COPY ./docker/entrypoint-cloud.sh /entrypoint-cloud.sh COPY ./docker/entrypoint-cloud.sh /entrypoint-cloud.sh

View File

@@ -2,8 +2,12 @@
set -e set -e
cd packages/backend
if [ -n "$WORKER" ]; then if [ -n "$WORKER" ]; then
yarn automatisch start-worker yarn start:worker
else else
yarn automatisch start yarn db:migrate
yarn db:seed:user
yarn start
fi fi

View File

@@ -6,8 +6,7 @@
"start": "lerna run --stream --parallel --scope=@*/{web,backend} dev", "start": "lerna run --stream --parallel --scope=@*/{web,backend} dev",
"start:web": "lerna run --stream --scope=@*/web dev", "start:web": "lerna run --stream --scope=@*/web dev",
"start:backend": "lerna run --stream --scope=@*/backend dev", "start:backend": "lerna run --stream --scope=@*/backend dev",
"lint": "lerna run --no-bail --stream --parallel --scope=@*/{web,backend,cli} lint", "lint": "lerna run --no-bail --stream --parallel --scope=@*/{web,backend} lint",
"build:watch": "lerna run --no-bail --stream --parallel --scope=@*/{web,backend,cli} build:watch",
"build:docs": "cd ./packages/docs && yarn install && yarn build" "build:docs": "cd ./packages/docs && yarn install && yarn build"
}, },
"workspaces": { "workspaces": {
@@ -18,7 +17,6 @@
"**/babel-loader", "**/babel-loader",
"**/webpack", "**/webpack",
"**/@automatisch/web", "**/@automatisch/web",
"**/@automatisch/types",
"**/ajv" "**/ajv"
] ]
}, },

View File

@@ -1,28 +0,0 @@
module.exports = {
root: true,
env: {
node: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
overrides: [
{
files: ['**/*.test.ts', '**/test/**/*.ts'],
rules: {
'@typescript-eslint/ban-ts-comment': ['off'],
'@typescript-eslint/no-explicit-any': ['off'],
},
},
{
files: ['**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': ['off'],
},
},
],
};

View File

@@ -0,0 +1,12 @@
{
"root": true,
"env": {
"node": true,
"es6": true
},
"extends": ["eslint:recommended", "prettier"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
}
}

View File

@@ -1,6 +1,6 @@
import { Client } from 'pg'; import pg from 'pg';
const client = new Client({ const client = new pg.Client({
host: 'localhost', host: 'localhost',
user: 'postgres', user: 'postgres',
port: 5432, port: 5432,

View File

@@ -0,0 +1,31 @@
import appConfig from '../../src/config/app.js';
import logger from '../../src/helpers/logger.js';
import '../../src/config/orm.js';
import { client as knex } from '../../src/config/database.js';
export const renameMigrationsAsJsFiles = async () => {
if (!appConfig.isDev) {
return;
}
try {
const tableExists = await knex.schema.hasTable('knex_migrations');
if (tableExists) {
await knex('knex_migrations')
.where('name', 'like', '%.ts')
.update({
name: knex.raw("REPLACE(name, '.ts', '.js')"),
});
logger.info(
`Migration file names with typescript renamed as JS file names!`
);
}
} catch (err) {
logger.error(err.message);
}
await knex.destroy();
};
renameMigrationsAsJsFiles();

View File

@@ -0,0 +1,3 @@
import { createDatabaseAndUser } from './utils.js';
createDatabaseAndUser();

View File

@@ -1,3 +0,0 @@
import { createDatabaseAndUser } from './utils';
createDatabaseAndUser();

View File

@@ -0,0 +1,3 @@
import { dropDatabase } from './utils.js';
dropDatabase();

View File

@@ -1,3 +0,0 @@
import { dropDatabase } from './utils';
dropDatabase();

View File

@@ -0,0 +1,3 @@
import { createUser } from './utils.js';
createUser();

View File

@@ -1,3 +0,0 @@
import { createUser } from './utils';
createUser();

View File

@@ -1,15 +1,15 @@
import appConfig from '../../src/config/app'; import appConfig from '../../src/config/app.js';
import logger from '../../src/helpers/logger'; import logger from '../../src/helpers/logger.js';
import client from './client'; import client from './client.js';
import User from '../../src/models/user'; import User from '../../src/models/user.js';
import Role from '../../src/models/role'; import Role from '../../src/models/role.js';
import '../../src/config/orm'; import '../../src/config/orm.js';
import process from 'process';
async function fetchAdminRole() { async function fetchAdminRole() {
const role = await Role const role = await Role.query()
.query()
.where({ .where({
key: 'admin' key: 'admin',
}) })
.limit(1) .limit(1)
.first(); .first();
@@ -41,12 +41,14 @@ export async function createUser(
logger.info('No need to seed a user.'); logger.info('No need to seed a user.');
} }
} catch (err) { } catch (err) {
if ((err as any).nativeError.code !== UNIQUE_VIOLATION_CODE) { if (err.nativeError.code !== UNIQUE_VIOLATION_CODE) {
throw err; throw err;
} }
logger.info(`User already exists: ${email}`); logger.info(`User already exists: ${email}`);
} }
process.exit(0);
} }
export const createDatabaseAndUser = async ( export const createDatabaseAndUser = async (
@@ -59,6 +61,7 @@ export const createDatabaseAndUser = async (
await grantPrivileges(database, user); await grantPrivileges(database, user);
await client.end(); await client.end();
process.exit(0);
}; };
export const createDatabase = async (database = appConfig.postgresDatabase) => { export const createDatabase = async (database = appConfig.postgresDatabase) => {
@@ -68,7 +71,7 @@ export const createDatabase = async (database = appConfig.postgresDatabase) => {
await client.query(`CREATE DATABASE ${database}`); await client.query(`CREATE DATABASE ${database}`);
logger.info(`Database: ${database} created!`); logger.info(`Database: ${database} created!`);
} catch (err) { } catch (err) {
if ((err as any).code !== DUPLICATE_DB_CODE) { if (err.code !== DUPLICATE_DB_CODE) {
throw err; throw err;
} }
@@ -85,7 +88,7 @@ export const createDatabaseUser = async (user = appConfig.postgresUsername) => {
return result; return result;
} catch (err) { } catch (err) {
if ((err as any).code !== DUPLICATE_OBJECT_CODE) { if (err.code !== DUPLICATE_OBJECT_CODE) {
throw err; throw err;
} }

View File

@@ -1 +0,0 @@
export * from './dist/bin/database/utils';

View File

@@ -1,2 +0,0 @@
/* eslint-disable */
module.exports = require('./dist/bin/database/utils');

View File

@@ -1 +0,0 @@
export * from './dist/src/config/database';

View File

@@ -1,2 +0,0 @@
/* eslint-disable */
module.exports = require('./dist/src/config/database');

View File

@@ -1,9 +0,0 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
setupFilesAfterEnv: ['./test/setup/global-hooks.ts'],
globalTeardown: './test/setup/global-teardown.ts',
collectCoverage: true,
collectCoverageFrom: ['src/graphql/queries/*.ts'],
};

View File

@@ -1,7 +1,10 @@
import { knexSnakeCaseMappers } from 'objection'; import { knexSnakeCaseMappers } from 'objection';
import appConfig from './src/config/app'; import appConfig from './src/config/app.js';
import path from 'path';
import { fileURLToPath } from 'url';
const fileExtension = appConfig.isDev || appConfig.isTest ? 'ts' : 'js'; const fileExtension = 'js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const knexConfig = { const knexConfig = {
client: 'pg', client: 'pg',

View File

@@ -1 +0,0 @@
export * from './dist/src/helpers/logger';

View File

@@ -1,2 +0,0 @@
/* eslint-disable */
module.exports = require('./dist/src/helpers/logger');

View File

@@ -3,27 +3,23 @@
"version": "0.10.0", "version": "0.10.0",
"license": "See LICENSE file", "license": "See LICENSE file",
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.", "description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
"type": "module",
"scripts": { "scripts": {
"dev": "ts-node-dev --watch 'src/graphql/schema.graphql' --exit-child src/server.ts", "dev": "nodemon --watch 'src/**/*.js' --exec 'node' src/server.js",
"worker": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/worker.ts", "worker": "nodemon --watch 'src/**/*.js' --exec 'node' src/worker.js",
"build": "tsc && yarn copy-statics", "start": "node src/server.js",
"build:watch": "nodemon --watch 'src/**/*.ts' --watch 'bin/**/*.ts' --exec yarn build --ext ts", "start:worker": "node src/worker.js",
"start": "node dist/src/server.js", "pretest": "APP_ENV=test node ./test/setup/prepare-test-env.js",
"pretest": "APP_ENV=test ts-node ./test/setup/prepare-test-env.ts", "test": "APP_ENV=test vitest run",
"test": "APP_ENV=test jest --verbose",
"lint": "eslint . --ignore-path ../../.eslintignore", "lint": "eslint . --ignore-path ../../.eslintignore",
"db:create": "ts-node ./bin/database/create.ts", "db:create": "node ./bin/database/create.js",
"db:seed:user": "ts-node ./bin/database/seed-user.ts", "db:seed:user": "node ./bin/database/seed-user.js",
"db:drop": "ts-node ./bin/database/drop.ts", "db:drop": "node ./bin/database/drop.js",
"db:migration:create": "knex migrate:make", "db:migration:create": "knex migrate:make",
"db:rollback": "knex migrate:rollback", "db:rollback": "knex migrate:rollback",
"db:migrate": "knex migrate:latest", "db:migrate": "node ./bin/database/convert-migrations.js && knex migrate:latest"
"copy-statics": "copyfiles src/**/*.{graphql,json,svg,hbs} dist",
"prepack": "yarn build",
"prebuild": "rm -rf ./dist"
}, },
"dependencies": { "dependencies": {
"@automatisch/web": "^0.10.0",
"@bull-board/express": "^3.10.1", "@bull-board/express": "^3.10.1",
"@casl/ability": "^6.5.0", "@casl/ability": "^6.5.0",
"@graphql-tools/graphql-file-loader": "^7.3.4", "@graphql-tools/graphql-file-loader": "^7.3.4",
@@ -32,10 +28,6 @@
"@rudderstack/rudder-sdk-node": "^1.1.2", "@rudderstack/rudder-sdk-node": "^1.1.2",
"@sentry/node": "^7.42.0", "@sentry/node": "^7.42.0",
"@sentry/tracing": "^7.42.0", "@sentry/tracing": "^7.42.0",
"@types/accounting": "^0.4.2",
"@types/luxon": "^2.3.1",
"@types/passport": "^1.0.12",
"@types/xmlrpc": "^1.3.7",
"accounting": "^0.4.1", "accounting": "^0.4.1",
"ajv-formats": "^2.1.1", "ajv-formats": "^2.1.1",
"axios": "1.6.0", "axios": "1.6.0",
@@ -87,26 +79,15 @@
} }
], ],
"homepage": "https://github.com/automatisch/automatisch#readme", "homepage": "https://github.com/automatisch/automatisch#readme",
"main": "dist/src/app", "main": "src/server",
"directories": { "directories": {
"bin": "bin", "bin": "bin",
"src": "src", "src": "src",
"test": "__tests__" "test": "__tests__"
}, },
"files": [ "files": [
"dist",
"bin", "bin",
"src", "src"
"server.js",
"server.d.ts",
"worker.js",
"worker.d.ts",
"logger.js",
"logger.d.ts",
"database.js",
"database.d.ts",
"database-utils.js",
"database-utils.d.ts"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
@@ -116,34 +97,9 @@
"url": "https://github.com/automatisch/automatisch/issues" "url": "https://github.com/automatisch/automatisch/issues"
}, },
"devDependencies": { "devDependencies": {
"@automatisch/types": "^0.10.0",
"@faker-js/faker": "^8.1.0",
"@types/bcrypt": "^5.0.0",
"@types/bull": "^3.15.8",
"@types/cors": "^2.8.12",
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.15",
"@types/http-errors": "^1.8.1",
"@types/jest": "^29.5.5",
"@types/jsonwebtoken": "^8.5.8",
"@types/lodash.get": "^4.4.6",
"@types/memory-cache": "^0.2.2",
"@types/morgan": "^1.9.3",
"@types/multer": "1.4.7",
"@types/node": "^16.10.2",
"@types/nodemailer": "^6.4.4",
"@types/pg": "^8.6.1",
"@types/pino": "^7.0.5",
"@types/pluralize": "^0.0.30",
"@types/showdown": "^2.0.1",
"@types/supertest": "^2.0.14",
"jest": "^29.7.0",
"nodemon": "^2.0.13", "nodemon": "^2.0.13",
"sinon": "^11.1.2",
"supertest": "^6.3.3", "supertest": "^6.3.3",
"ts-jest": "^29.1.1", "vitest": "^1.1.3"
"ts-node": "^10.2.1",
"ts-node-dev": "^1.1.8"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@@ -1 +0,0 @@
export * from './dist/src/server';

View File

@@ -1,2 +0,0 @@
/* eslint-disable */
module.exports = require('./dist/src/server.js');

View File

@@ -2,22 +2,21 @@ import createError from 'http-errors';
import express from 'express'; import express from 'express';
import cors from 'cors'; import cors from 'cors';
import { IRequest } from '@automatisch/types'; import appConfig from './config/app.js';
import appConfig from './config/app'; import corsOptions from './config/cors-options.js';
import corsOptions from './config/cors-options'; import morgan from './helpers/morgan.js';
import morgan from './helpers/morgan'; import * as Sentry from './helpers/sentry.ee.js';
import * as Sentry from './helpers/sentry.ee'; import appAssetsHandler from './helpers/app-assets-handler.js';
import appAssetsHandler from './helpers/app-assets-handler'; import webUIHandler from './helpers/web-ui-handler.js';
import webUIHandler from './helpers/web-ui-handler'; import errorHandler from './helpers/error-handler.js';
import errorHandler from './helpers/error-handler'; import './config/orm.js';
import './config/orm';
import { import {
createBullBoardHandler, createBullBoardHandler,
serverAdapter, serverAdapter,
} from './helpers/create-bull-board-handler'; } from './helpers/create-bull-board-handler.js';
import injectBullBoardHandler from './helpers/inject-bull-board-handler'; import injectBullBoardHandler from './helpers/inject-bull-board-handler.js';
import router from './routes'; import router from './routes/index.js';
import configurePassport from './helpers/passport'; import configurePassport from './helpers/passport.js';
createBullBoardHandler(serverAdapter); createBullBoardHandler(serverAdapter);
@@ -38,7 +37,7 @@ app.use(
express.json({ express.json({
limit: appConfig.requestBodySizeLimit, limit: appConfig.requestBodySizeLimit,
verify(req, res, buf) { verify(req, res, buf) {
(req as IRequest).rawBody = buf; req.rawBody = buf;
}, },
}) })
); );
@@ -47,7 +46,7 @@ app.use(
extended: true, extended: true,
limit: appConfig.requestBodySizeLimit, limit: appConfig.requestBodySizeLimit,
verify(req, res, buf) { verify(req, res, buf) {
(req as IRequest).rawBody = buf; req.rawBody = buf;
}, },
}) })
); );

View File

@@ -0,0 +1,3 @@
import sendPrompt from './send-prompt/index.js';
export default [sendPrompt];

View File

@@ -1,3 +0,0 @@
import sendPrompt from './send-prompt';
export default [sendPrompt];

View File

@@ -0,0 +1,97 @@
import defineAction from '../../../../helpers/define-action.js';
const castFloatOrUndefined = (value) => {
return value === '' ? undefined : parseFloat(value);
};
export default defineAction({
name: 'Send prompt',
key: 'sendPrompt',
description: 'Creates a completion for the provided prompt and parameters.',
arguments: [
{
label: 'Prompt',
key: 'prompt',
type: 'string',
required: true,
variables: true,
description: 'The text to analyze.',
},
{
label: 'Temperature',
key: 'temperature',
type: 'string',
required: false,
variables: true,
description:
'What sampling temperature to use, between 0 and 2. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or Top P but not both.',
},
{
label: 'Maximum tokens',
key: 'maxTokens',
type: 'string',
required: false,
variables: true,
description:
'The maximum number of tokens to generate in the completion.',
},
{
label: 'Stop Sequence',
key: 'stopSequence',
type: 'string',
required: false,
variables: true,
description:
'Single stop sequence where the API will stop generating further tokens. The returned text will not contain the stop sequence.',
},
{
label: 'Top P',
key: 'topP',
type: 'string',
required: false,
variables: true,
description:
'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.',
},
{
label: 'Frequency Penalty',
key: 'frequencyPenalty',
type: 'string',
required: false,
variables: true,
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.`,
},
{
label: 'Presence Penalty',
key: 'presencePenalty',
type: 'string',
required: false,
variables: true,
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.`,
},
],
async run($) {
const payload = {
model: $.step.parameters.model,
prompt: $.step.parameters.prompt,
temperature: castFloatOrUndefined($.step.parameters.temperature),
max_tokens: castFloatOrUndefined($.step.parameters.maxTokens),
stop: $.step.parameters.stopSequence || null,
top_p: castFloatOrUndefined($.step.parameters.topP),
frequency_penalty: castFloatOrUndefined(
$.step.parameters.frequencyPenalty
),
presence_penalty: castFloatOrUndefined($.step.parameters.presencePenalty),
};
const { data } = await $.http.post(
`/deployments/${$.auth.data.deploymentId}/completions`,
payload
);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,87 +0,0 @@
import defineAction from '../../../../helpers/define-action';
const castFloatOrUndefined = (value: string | null) => {
return value === '' ? undefined : parseFloat(value);
}
export default defineAction({
name: 'Send prompt',
key: 'sendPrompt',
description: 'Creates a completion for the provided prompt and parameters.',
arguments: [
{
label: 'Prompt',
key: 'prompt',
type: 'string' as const,
required: true,
variables: true,
description: 'The text to analyze.'
},
{
label: 'Temperature',
key: 'temperature',
type: 'string' as const,
required: false,
variables: true,
description: 'What sampling temperature to use, between 0 and 2. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or Top P but not both.'
},
{
label: 'Maximum tokens',
key: 'maxTokens',
type: 'string' as const,
required: false,
variables: true,
description: 'The maximum number of tokens to generate in the completion.'
},
{
label: 'Stop Sequence',
key: 'stopSequence',
type: 'string' as const,
required: false,
variables: true,
description: 'Single stop sequence where the API will stop generating further tokens. The returned text will not contain the stop sequence.'
},
{
label: 'Top P',
key: 'topP',
type: 'string' as const,
required: false,
variables: true,
description: 'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.'
},
{
label: 'Frequency Penalty',
key: 'frequencyPenalty',
type: 'string' as const,
required: false,
variables: true,
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.`
},
{
label: 'Presence Penalty',
key: 'presencePenalty',
type: 'string' as const,
required: false,
variables: true,
description: `Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.`
},
],
async run($) {
const payload = {
model: $.step.parameters.model as string,
prompt: $.step.parameters.prompt as string,
temperature: castFloatOrUndefined($.step.parameters.temperature as string),
max_tokens: castFloatOrUndefined($.step.parameters.maxTokens as string),
stop: ($.step.parameters.stopSequence as string || null),
top_p: castFloatOrUndefined($.step.parameters.topP as string),
frequency_penalty: castFloatOrUndefined($.step.parameters.frequencyPenalty as string),
presence_penalty: castFloatOrUndefined($.step.parameters.presencePenalty as string),
};
const { data } = await $.http.post(`/deployments/${$.auth.data.deploymentId}/completions`, payload);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,12 +1,12 @@
import verifyCredentials from './verify-credentials'; import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified'; import isStillVerified from './is-still-verified.js';
export default { export default {
fields: [ fields: [
{ {
key: 'screenName', key: 'screenName',
label: 'Screen Name', label: 'Screen Name',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -18,7 +18,7 @@ export default {
{ {
key: 'yourResourceName', key: 'yourResourceName',
label: 'Your Resource Name', label: 'Your Resource Name',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -30,7 +30,7 @@ export default {
{ {
key: 'deploymentId', key: 'deploymentId',
label: 'Deployment ID', label: 'Deployment ID',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -42,7 +42,7 @@ export default {
{ {
key: 'apiKey', key: 'apiKey',
label: 'API Key', label: 'API Key',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,

View File

@@ -0,0 +1,6 @@
const isStillVerified = async ($) => {
await $.http.get('/fine_tuning/jobs');
return true;
};
export default isStillVerified;

View File

@@ -1,8 +0,0 @@
import { IGlobalVariable } from '@automatisch/types';
const isStillVerified = async ($: IGlobalVariable) => {
await $.http.get('/fine_tuning/jobs');
return true;
};
export default isStillVerified;

View File

@@ -0,0 +1,5 @@
const verifyCredentials = async ($) => {
await $.http.get('/fine_tuning/jobs');
};
export default verifyCredentials;

View File

@@ -1,7 +0,0 @@
import { IGlobalVariable } from '@automatisch/types';
const verifyCredentials = async ($: IGlobalVariable) => {
await $.http.get('/fine_tuning/jobs');
};
export default verifyCredentials;

View File

@@ -0,0 +1,13 @@
const addAuthHeader = ($, requestConfig) => {
if ($.auth.data?.apiKey) {
requestConfig.headers['api-key'] = $.auth.data.apiKey;
}
requestConfig.params = {
'api-version': '2023-10-01-preview',
};
return requestConfig;
};
export default addAuthHeader;

View File

@@ -1,15 +0,0 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
if ($.auth.data?.apiKey) {
requestConfig.headers['api-key'] = $.auth.data.apiKey as string;
}
requestConfig.params = {
'api-version': '2023-10-01-preview'
}
return requestConfig;
};
export default addAuthHeader;

View File

@@ -0,0 +1,11 @@
const setBaseUrl = ($, requestConfig) => {
const yourResourceName = $.auth.data.yourResourceName;
if (yourResourceName) {
requestConfig.baseURL = `https://${yourResourceName}.openai.azure.com/openai`;
}
return requestConfig;
};
export default setBaseUrl;

View File

@@ -1,13 +0,0 @@
import { TBeforeRequest } from '@automatisch/types';
const setBaseUrl: TBeforeRequest = ($, requestConfig) => {
const yourResourceName = $.auth.data.yourResourceName as string;
if (yourResourceName) {
requestConfig.baseURL = `https://${yourResourceName}.openai.azure.com/openai`;
}
return requestConfig;
};
export default setBaseUrl;

View File

@@ -1,13 +1,14 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app.js';
import setBaseUrl from './common/set-base-url'; import setBaseUrl from './common/set-base-url.js';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header.js';
import auth from './auth'; import auth from './auth/index.js';
import actions from './actions'; import actions from './actions/index.js';
export default defineApp({ export default defineApp({
name: 'Azure OpenAI', name: 'Azure OpenAI',
key: 'azure-openai', key: 'azure-openai',
baseUrl: 'https://azure.microsoft.com/en-us/products/ai-services/openai-service', baseUrl:
'https://azure.microsoft.com/en-us/products/ai-services/openai-service',
apiBaseUrl: '', apiBaseUrl: '',
iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg', iconUrl: '{BASE_URL}/apps/azure-openai/assets/favicon.svg',
authDocUrl: 'https://automatisch.io/docs/apps/azure-openai/connection', authDocUrl: 'https://automatisch.io/docs/apps/azure-openai/connection',

View File

@@ -0,0 +1,43 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Acknowledge incident',
key: 'acknowledgeIncident',
description: 'Acknowledges an incident.',
arguments: [
{
label: 'Incident ID',
key: 'incidentId',
type: 'string',
required: true,
variables: true,
description:
'This serves as the incident ID that requires your acknowledgment.',
},
{
label: 'Acknowledged by',
key: 'acknowledgedBy',
type: 'string',
required: false,
variables: true,
description:
"This refers to the individual's name, email, or another form of identification that the person who acknowledged the incident has provided.",
},
],
async run($) {
const acknowledgedBy = $.step.parameters.acknowledgedBy;
const incidentId = $.step.parameters.incidentId;
const body = {
acknowledged_by: acknowledgedBy,
};
const response = await $.http.post(
`/v2/incidents/${incidentId}/acknowledge`,
body
);
$.setActionItem({ raw: response.data.data });
},
});

View File

@@ -0,0 +1,3 @@
import acknowledgeIncident from './acknowledge-incident/index.js';
export default [acknowledgeIncident];

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="200.000000pt" height="200.000000pt" viewBox="0 0 200.000000 200.000000"
preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,200.000000) scale(0.100000,-0.100000)"
fill="#000" stroke="none">
<path d="M0 1000 l0 -1000 1000 0 1000 0 0 1000 0 1000 -1000 0 -1000 0 0
-1000z m1162 460 c14 -11 113 -184 232 -408 228 -429 231 -439 175 -486 -35
-30 -30 -29 -140 -15 -89 12 -123 25 -152 56 -9 11 -72 147 -140 304 -113 263
-124 284 -149 287 -14 2 -29 10 -32 17 -8 21 67 214 94 242 28 29 78 30 112 3z
m-340 -148 c10 -10 72 -175 139 -367 114 -325 121 -351 108 -374 -8 -14 -27
-32 -41 -41 -25 -13 -34 -12 -126 18 -55 18 -111 43 -125 56 -19 17 -40 67
-76 182 -36 112 -58 164 -73 176 l-22 16 27 99 c63 224 66 232 95 248 31 17
69 12 94 -13z m-314 -219 c16 -15 26 -59 56 -243 42 -262 43 -285 17 -300 -11
-5 -24 -10 -30 -10 -19 0 -140 114 -150 141 -7 20 -4 76 10 191 10 90 19 171
19 181 0 18 33 57 49 57 5 0 18 -8 29 -17z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,33 @@
import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified.js';
export default {
fields: [
{
key: 'screenName',
label: 'Screen Name',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description:
'Screen name of your connection to be used on Automatisch UI.',
clickToCopy: false,
},
{
key: 'apiKey',
label: 'API Key',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description: 'Better Stack API key of your account.',
clickToCopy: false,
},
],
verifyCredentials,
isStillVerified,
};

View File

@@ -0,0 +1,8 @@
import verifyCredentials from './verify-credentials.js';
const isStillVerified = async ($) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -0,0 +1,10 @@
const verifyCredentials = async ($) => {
await $.http.get('/v2/metadata');
await $.auth.set({
screenName: $.auth.data.screenName,
apiKey: $.auth.data.apiKey,
});
};
export default verifyCredentials;

View File

@@ -1,6 +1,4 @@
import { TBeforeRequest } from '@automatisch/types'; const addAuthHeader = ($, requestConfig) => {
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
if ($.auth.data?.apiKey) { if ($.auth.data?.apiKey) {
requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`; requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`;
} }

View File

@@ -0,0 +1,18 @@
import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header.js';
import auth from './auth/index.js';
import actions from './actions/index.js';
export default defineApp({
name: 'Better Stack',
key: 'better-stack',
iconUrl: '{BASE_URL}/apps/better-stack/assets/favicon.svg',
authDocUrl: 'https://automatisch.io/docs/apps/better-stack/connection',
supportsConnections: true,
baseUrl: 'https://betterstack.com',
apiBaseUrl: 'https://uptime.betterstack.com/api',
primaryColor: '000000',
beforeRequest: [addAuthHeader],
auth,
actions,
});

View File

@@ -1,4 +1,4 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action.js';
export default defineAction({ export default defineAction({
name: 'Add Template', name: 'Add Template',
@@ -9,7 +9,7 @@ export default defineAction({
{ {
label: 'Templete Data', label: 'Templete Data',
key: 'templateData', key: 'templateData',
type: 'string' as const, type: 'string',
required: true, required: true,
variables: true, variables: true,
description: 'The content of your new Template in XML/HTML format.', description: 'The content of your new Template in XML/HTML format.',
@@ -17,7 +17,7 @@ export default defineAction({
], ],
async run($) { async run($) {
const templateData = $.step.parameters.templateData as string; const templateData = $.step.parameters.templateData;
const base64Data = Buffer.from(templateData).toString('base64'); const base64Data = Buffer.from(templateData).toString('base64');
const dataURI = `data:application/xml;base64,${base64Data}`; const dataURI = `data:application/xml;base64,${base64Data}`;

View File

@@ -0,0 +1,3 @@
import addTemplate from './add-template/index.js';
export default [addTemplate];

View File

@@ -1,3 +0,0 @@
import addTemplate from './add-template';
export default [addTemplate];

View File

@@ -1,12 +1,12 @@
import verifyCredentials from './verify-credentials'; import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified'; import isStillVerified from './is-still-verified.js';
export default { export default {
fields: [ fields: [
{ {
key: 'screenName', key: 'screenName',
label: 'Screen Name', label: 'Screen Name',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -18,7 +18,7 @@ export default {
{ {
key: 'apiKey', key: 'apiKey',
label: 'API Key', label: 'API Key',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,

View File

@@ -0,0 +1,8 @@
import verifyCredentials from './verify-credentials.js';
const isStillVerified = async ($) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,9 +0,0 @@
import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,6 +1,4 @@
import { IGlobalVariable } from '@automatisch/types'; const verifyCredentials = async ($) => {
const verifyCredentials = async ($: IGlobalVariable) => {
await $.http.get('/templates'); await $.http.get('/templates');
await $.auth.set({ await $.auth.set({

View File

@@ -1,6 +1,4 @@
import { TBeforeRequest } from '@automatisch/types'; const addAuthHeader = ($, requestConfig) => {
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
if ($.auth.data?.apiKey) { if ($.auth.data?.apiKey) {
requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`; requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`;
requestConfig.headers['carbone-version'] = '4'; requestConfig.headers['carbone-version'] = '4';

View File

@@ -1,7 +1,7 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header.js';
import auth from './auth'; import auth from './auth/index.js';
import actions from './actions'; import actions from './actions/index.js';
export default defineApp({ export default defineApp({
name: 'Carbone', name: 'Carbone',

View File

@@ -0,0 +1,3 @@
import translateText from './translate-text/index.js';
export default [translateText];

View File

@@ -1,3 +0,0 @@
import translateText from './translate-text';
export default [translateText];

View File

@@ -1,5 +1,5 @@
import qs from 'qs'; import qs from 'qs';
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action.js';
export default defineAction({ export default defineAction({
name: 'Translate text', name: 'Translate text',
@@ -9,7 +9,7 @@ export default defineAction({
{ {
label: 'Text', label: 'Text',
key: 'text', key: 'text',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'Text to be translated.', description: 'Text to be translated.',
variables: true, variables: true,
@@ -17,7 +17,7 @@ export default defineAction({
{ {
label: 'Target Language', label: 'Target Language',
key: 'targetLanguage', key: 'targetLanguage',
type: 'dropdown' as const, type: 'dropdown',
required: true, required: true,
description: 'Language to translate the text to.', description: 'Language to translate the text to.',
variables: true, variables: true,

View File

@@ -1,12 +1,12 @@
import verifyCredentials from './verify-credentials'; import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified'; import isStillVerified from './is-still-verified.js';
export default { export default {
fields: [ fields: [
{ {
key: 'screenName', key: 'screenName',
label: 'Screen Name', label: 'Screen Name',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -18,7 +18,7 @@ export default {
{ {
key: 'authenticationKey', key: 'authenticationKey',
label: 'Authentication Key', label: 'Authentication Key',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,

View File

@@ -0,0 +1,8 @@
import verifyCredentials from './verify-credentials.js';
const isStillVerified = async ($) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,9 +0,0 @@
import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -1,6 +1,4 @@
import { IGlobalVariable } from '@automatisch/types'; const verifyCredentials = async ($) => {
const verifyCredentials = async ($: IGlobalVariable) => {
await $.http.get('/v2/usage'); await $.http.get('/v2/usage');
await $.auth.set({ await $.auth.set({

View File

@@ -1,6 +1,4 @@
import { TBeforeRequest } from '@automatisch/types'; const addAuthHeader = ($, requestConfig) => {
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
if ($.auth.data?.authenticationKey) { if ($.auth.data?.authenticationKey) {
const authorizationHeader = `DeepL-Auth-Key ${$.auth.data.authenticationKey}`; const authorizationHeader = `DeepL-Auth-Key ${$.auth.data.authenticationKey}`;
requestConfig.headers.Authorization = authorizationHeader; requestConfig.headers.Authorization = authorizationHeader;

View File

@@ -1,7 +1,7 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header.js';
import auth from './auth'; import auth from './auth/index.js';
import actions from './actions'; import actions from './actions/index.js';
export default defineApp({ export default defineApp({
name: 'DeepL', name: 'DeepL',

View File

@@ -1,4 +1,4 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action.js';
export default defineAction({ export default defineAction({
name: 'Delay for', name: 'Delay for',
@@ -9,7 +9,7 @@ export default defineAction({
{ {
label: 'Delay for unit', label: 'Delay for unit',
key: 'delayForUnit', key: 'delayForUnit',
type: 'dropdown' as const, type: 'dropdown',
required: true, required: true,
value: null, value: null,
description: 'Delay for unit, e.g. minutes, hours, days, weeks.', description: 'Delay for unit, e.g. minutes, hours, days, weeks.',
@@ -36,7 +36,7 @@ export default defineAction({
{ {
label: 'Delay for value', label: 'Delay for value',
key: 'delayForValue', key: 'delayForValue',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'Delay for value, use a number, e.g. 1, 2, 3.', description: 'Delay for value, use a number, e.g. 1, 2, 3.',
variables: true, variables: true,

View File

@@ -1,4 +1,4 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action.js';
export default defineAction({ export default defineAction({
name: 'Delay until', name: 'Delay until',
@@ -9,7 +9,7 @@ export default defineAction({
{ {
label: 'Delay until (Date)', label: 'Delay until (Date)',
key: 'delayUntil', key: 'delayUntil',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'Delay until the date. E.g. 2022-12-18', description: 'Delay until the date. E.g. 2022-12-18',
variables: true, variables: true,

View File

@@ -0,0 +1,4 @@
import delayFor from './delay-for/index.js';
import delayUntil from './delay-until/index.js';
export default [delayFor, delayUntil];

View File

@@ -1,4 +0,0 @@
import delayFor from './delay-for';
import delayUntil from './delay-until';
export default [delayFor, delayUntil];

View File

@@ -1,5 +1,5 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app.js';
import actions from './actions'; import actions from './actions/index.js';
export default defineApp({ export default defineApp({
name: 'Delay', name: 'Delay',

View File

@@ -1,4 +1,4 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action.js';
export default defineAction({ export default defineAction({
name: 'Create a scheduled event', name: 'Create a scheduled event',
@@ -8,13 +8,13 @@ export default defineAction({
{ {
label: 'Type', label: 'Type',
key: 'entityType', key: 'entityType',
type: 'dropdown' as const, type: 'dropdown',
required: true, required: true,
variables: true, variables: true,
options: [ options: [
{ label: 'Stage channel', value: 1 }, { label: 'Stage channel', value: 1 },
{ label: 'Voice channel', value: 2 }, { label: 'Voice channel', value: 2 },
{ label: 'External', value: 3 } { label: 'External', value: 3 },
], ],
additionalFields: { additionalFields: {
type: 'query', type: 'query',
@@ -34,61 +34,47 @@ export default defineAction({
{ {
label: 'Name', label: 'Name',
key: 'name', key: 'name',
type: 'string' as const, type: 'string',
required: true, required: true,
variables: true, variables: true,
}, },
{ {
label: 'Description', label: 'Description',
key: 'description', key: 'description',
type: 'string' as const, type: 'string',
required: false, required: false,
variables: true, variables: true,
}, },
{ {
label: 'Image', label: 'Image',
key: 'image', key: 'image',
type: 'string' as const, type: 'string',
required: false, required: false,
description: 'Image as DataURI scheme [data:image/<jpeg/png/gif>;base64,BASE64_ENCODED_<JPEG/PNG/GIF>_IMAGE_DATA]', description:
'Image as DataURI scheme [data:image/<jpeg/png/gif>;base64,BASE64_ENCODED_<JPEG/PNG/GIF>_IMAGE_DATA]',
variables: true, variables: true,
}, },
], ],
async run($) { async run($) {
type entity_metadata = { const data = {
location: string channel_id: $.step.parameters.channel_id,
} name: $.step.parameters.name,
type guild_event = {
channel_id: number,
name: string,
privacy_level: number,
scheduled_start_time: string,
scheduled_end_time?: string,
description?: string,
entity_type?: number,
entity_metadata?: entity_metadata,
image?: string, //data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA
}
const data: guild_event = {
channel_id: $.step.parameters.channel_id as number,
name: $.step.parameters.name as string,
privacy_level: 2, privacy_level: 2,
scheduled_start_time: $.step.parameters.scheduledStartTime as string, scheduled_start_time: $.step.parameters.scheduledStartTime,
scheduled_end_time: $.step.parameters.scheduledEndTime as string, scheduled_end_time: $.step.parameters.scheduledEndTime,
description: $.step.parameters.description as string, description: $.step.parameters.description,
entity_type: $.step.parameters.entityType as number, entity_type: $.step.parameters.entityType,
image: $.step.parameters.image as string, image: $.step.parameters.image,
}; };
const isExternal = $.step.parameters.entityType === 3; const isExternal = $.step.parameters.entityType === 3;
if (isExternal) { if (isExternal) {
data.entity_metadata = { data.entity_metadata = {
location: $.step.parameters.location as string, location: $.step.parameters.location,
}; };
data.channel_id = null; data.channel_id = null;
} }

View File

@@ -0,0 +1,4 @@
import sendMessageToChannel from './send-message-to-channel/index.js';
import createScheduledEvent from './create-scheduled-event/index.js';
export default [sendMessageToChannel, createScheduledEvent];

View File

@@ -1,4 +0,0 @@
import sendMessageToChannel from './send-message-to-channel';
import createScheduledEvent from './create-scheduled-event';
export default [sendMessageToChannel, createScheduledEvent];

View File

@@ -1,4 +1,4 @@
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action.js';
export default defineAction({ export default defineAction({
name: 'Send a message to channel', name: 'Send a message to channel',
@@ -8,7 +8,7 @@ export default defineAction({
{ {
label: 'Channel', label: 'Channel',
key: 'channel', key: 'channel',
type: 'dropdown' as const, type: 'dropdown',
required: true, required: true,
description: 'Pick a channel to send the message to.', description: 'Pick a channel to send the message to.',
variables: true, variables: true,
@@ -26,7 +26,7 @@ export default defineAction({
{ {
label: 'Message text', label: 'Message text',
key: 'message', key: 'message',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'The content of your new message.', description: 'The content of your new message.',
variables: true, variables: true,
@@ -35,8 +35,9 @@ export default defineAction({
async run($) { async run($) {
const data = { const data = {
content: $.step.parameters.message as string, content: $.step.parameters.message,
}; };
const response = await $.http?.post( const response = await $.http?.post(
`/channels/${$.step.parameters.channel}/messages`, `/channels/${$.step.parameters.channel}/messages`,
data data

View File

@@ -1,15 +1,15 @@
import { IField, IGlobalVariable } from '@automatisch/types';
import { URLSearchParams } from 'url'; import { URLSearchParams } from 'url';
import scopes from '../common/scopes'; import scopes from '../common/scopes.js';
export default async function generateAuthUrl($: IGlobalVariable) { export default async function generateAuthUrl($) {
const oauthRedirectUrlField = $.app.auth.fields.find( const oauthRedirectUrlField = $.app.auth.fields.find(
(field: IField) => field.key == 'oAuthRedirectUrl' (field) => field.key == 'oAuthRedirectUrl'
); );
const callbackUrl = oauthRedirectUrlField.value as string;
const callbackUrl = oauthRedirectUrlField.value;
const searchParams = new URLSearchParams({ const searchParams = new URLSearchParams({
client_id: $.auth.data.consumerKey as string, client_id: $.auth.data.consumerKey,
redirect_uri: callbackUrl, redirect_uri: callbackUrl,
response_type: 'code', response_type: 'code',
permissions: '2146958591', permissions: '2146958591',

View File

@@ -1,13 +1,13 @@
import generateAuthUrl from './generate-auth-url'; import generateAuthUrl from './generate-auth-url.js';
import verifyCredentials from './verify-credentials'; import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified'; import isStillVerified from './is-still-verified.js';
export default { export default {
fields: [ fields: [
{ {
key: 'oAuthRedirectUrl', key: 'oAuthRedirectUrl',
label: 'OAuth Redirect URL', label: 'OAuth Redirect URL',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: true, readOnly: true,
value: '{WEB_APP_URL}/app/discord/connections/add', value: '{WEB_APP_URL}/app/discord/connections/add',
@@ -20,7 +20,7 @@ export default {
{ {
key: 'consumerKey', key: 'consumerKey',
label: 'Consumer Key', label: 'Consumer Key',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -32,7 +32,7 @@ export default {
{ {
key: 'consumerSecret', key: 'consumerSecret',
label: 'Consumer Secret', label: 'Consumer Secret',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,
@@ -44,7 +44,7 @@ export default {
{ {
key: 'botToken', key: 'botToken',
label: 'Bot token', label: 'Bot token',
type: 'string' as const, type: 'string',
required: true, required: true,
readOnly: false, readOnly: false,
value: null, value: null,

View File

@@ -0,0 +1,9 @@
import getCurrentUser from '../common/get-current-user.js';
const isStillVerified = async ($) => {
await getCurrentUser($);
return true;
};
export default isStillVerified;

View File

@@ -1,10 +0,0 @@
import { IGlobalVariable } from '@automatisch/types';
import getCurrentUser from '../common/get-current-user';
const isStillVerified = async ($: IGlobalVariable) => {
await getCurrentUser($);
return true;
};
export default isStillVerified;

View File

@@ -1,22 +1,24 @@
import { IGlobalVariable, IField } from '@automatisch/types';
import { URLSearchParams } from 'url'; import { URLSearchParams } from 'url';
import scopes from '../common/scopes'; import scopes from '../common/scopes.js';
import getCurrentUser from '../common/get-current-user'; import getCurrentUser from '../common/get-current-user.js';
const verifyCredentials = async ($: IGlobalVariable) => { const verifyCredentials = async ($) => {
const oauthRedirectUrlField = $.app.auth.fields.find( const oauthRedirectUrlField = $.app.auth.fields.find(
(field: IField) => field.key == 'oAuthRedirectUrl' (field) => field.key == 'oAuthRedirectUrl'
); );
const callbackUrl = oauthRedirectUrlField.value as string;
const callbackUrl = oauthRedirectUrlField.value;
const params = new URLSearchParams({ const params = new URLSearchParams({
client_id: $.auth.data.consumerKey as string, client_id: $.auth.data.consumerKey,
redirect_uri: callbackUrl, redirect_uri: callbackUrl,
response_type: 'code', response_type: 'code',
scope: scopes.join(' '), scope: scopes.join(' '),
client_secret: $.auth.data.consumerSecret as string, client_secret: $.auth.data.consumerSecret,
code: $.auth.data.code as string, code: $.auth.data.code,
grant_type: 'authorization_code', grant_type: 'authorization_code',
}); });
const { data: verifiedCredentials } = await $.http.post( const { data: verifiedCredentials } = await $.http.post(
'/oauth2/token', '/oauth2/token',
params.toString() params.toString()

View File

@@ -1,6 +1,4 @@
import { TBeforeRequest } from '@automatisch/types'; const addAuthHeader = ($, requestConfig) => {
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const { tokenType, botToken } = $.auth.data; const { tokenType, botToken } = $.auth.data;
if (tokenType && botToken) { if (tokenType && botToken) {
requestConfig.headers.Authorization = `Bot ${botToken}`; requestConfig.headers.Authorization = `Bot ${botToken}`;

View File

@@ -1,6 +1,4 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types'; const getCurrentUser = async ($) => {
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
const response = await $.http.get('/users/@me'); const response = await $.http.get('/users/@me');
const currentUser = response.data; const currentUser = response.data;

View File

@@ -0,0 +1,4 @@
import listChannels from './list-channels/index.js';
import listVoiceChannels from './list-voice-channels/index.js';
export default [listChannels, listVoiceChannels];

View File

@@ -1,4 +0,0 @@
import listChannels from './list-channels';
import listVoiceChannels from './list-voice-channels';
export default [listChannels, listVoiceChannels];

View File

@@ -1,14 +1,9 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default { export default {
name: 'List channels', name: 'List channels',
key: 'listChannels', key: 'listChannels',
async run($: IGlobalVariable) { async run($) {
const channels: { const channels = {
data: IJSONObject[];
error: IJSONObject | null;
} = {
data: [], data: [],
error: null, error: null,
}; };
@@ -18,11 +13,11 @@ export default {
); );
channels.data = response.data channels.data = response.data
.filter((channel: IJSONObject) => { .filter((channel) => {
// filter in text channels and announcement channels only // filter in text channels and announcement channels only
return channel.type === 0 || channel.type === 5; return channel.type === 0 || channel.type === 5;
}) })
.map((channel: IJSONObject) => { .map((channel) => {
return { return {
value: channel.id, value: channel.id,
name: channel.name, name: channel.name,

View File

@@ -1,14 +1,9 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default { export default {
name: 'List voice channels', name: 'List voice channels',
key: 'listVoiceChannels', key: 'listVoiceChannels',
async run($: IGlobalVariable) { async run($) {
const channels: { const channels = {
data: IJSONObject[];
error: IJSONObject | null;
} = {
data: [], data: [],
error: null, error: null,
}; };
@@ -18,11 +13,11 @@ export default {
); );
channels.data = response.data channels.data = response.data
.filter((channel: IJSONObject) => { .filter((channel) => {
// filter in voice and stage channels only // filter in voice and stage channels only
return channel.type === 2 || channel.type === 13; return channel.type === 2 || channel.type === 13;
}) })
.map((channel: IJSONObject) => { .map((channel) => {
return { return {
value: channel.id, value: channel.id,
name: channel.name, name: channel.name,

View File

@@ -1,3 +1,3 @@
import listExternalScheduledEventFields from './list-external-scheduled-event-fields'; import listExternalScheduledEventFields from './list-external-scheduled-event-fields/index.js';
export default [listExternalScheduledEventFields]; export default [listExternalScheduledEventFields];

View File

@@ -1,9 +1,8 @@
import { IGlobalVariable } from '@automatisch/types';
export default { export default {
name: 'List external scheduled event fields', name: 'List external scheduled event fields',
key: 'listExternalScheduledEventFields', key: 'listExternalScheduledEventFields',
async run($: IGlobalVariable) { async run($) {
const isExternal = $.step.parameters.entityType === 3; const isExternal = $.step.parameters.entityType === 3;
if (isExternal) { if (isExternal) {
@@ -11,15 +10,16 @@ export default {
{ {
label: 'Location', label: 'Location',
key: 'location', key: 'location',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL', description:
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
variables: true, variables: true,
}, },
{ {
label: 'Start-Time', label: 'Start-Time',
key: 'scheduledStartTime', key: 'scheduledStartTime',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'The time the event will start [ISO8601]', description: 'The time the event will start [ISO8601]',
variables: true, variables: true,
@@ -27,9 +27,10 @@ export default {
{ {
label: 'End-Time', label: 'End-Time',
key: 'scheduledEndTime', key: 'scheduledEndTime',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL', description:
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
variables: true, variables: true,
}, },
]; ];
@@ -39,9 +40,10 @@ export default {
{ {
label: 'Channel', label: 'Channel',
key: 'channel_id', key: 'channel_id',
type: 'dropdown' as const, type: 'dropdown',
required: true, required: true,
description: 'Pick a voice or stage channel to link the event to. This will be omitted if type is EXTERNAL', description:
'Pick a voice or stage channel to link the event to. This will be omitted if type is EXTERNAL',
variables: true, variables: true,
source: { source: {
type: 'query', type: 'query',
@@ -57,15 +59,16 @@ export default {
{ {
label: 'Location', label: 'Location',
key: 'location', key: 'location',
type: 'string' as const, type: 'string',
required: false, required: false,
description: 'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL', description:
'The location of the event (1-100 characters). This will be omitted if type is NOT EXTERNAL',
variables: true, variables: true,
}, },
{ {
label: 'Start-Time', label: 'Start-Time',
key: 'scheduledStartTime', key: 'scheduledStartTime',
type: 'string' as const, type: 'string',
required: true, required: true,
description: 'The time the event will start [ISO8601]', description: 'The time the event will start [ISO8601]',
variables: true, variables: true,
@@ -73,9 +76,10 @@ export default {
{ {
label: 'End-Time', label: 'End-Time',
key: 'scheduledEndTime', key: 'scheduledEndTime',
type: 'string' as const, type: 'string',
required: false, required: false,
description: 'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL', description:
'The time the event will end [ISO8601]. This will be omitted if type is NOT EXTERNAL',
variables: true, variables: true,
}, },
]; ];

View File

@@ -1,10 +1,10 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header.js';
import auth from './auth'; import auth from './auth/index.js';
import dynamicData from './dynamic-data'; import dynamicData from './dynamic-data/index.js';
import actions from './actions'; import actions from './actions/index.js';
import triggers from './triggers'; import triggers from './triggers/index.js';
import dynamicFields from './dynamic-fields'; import dynamicFields from './dynamic-fields/index.js';
export default defineApp({ export default defineApp({
name: 'Discord', name: 'Discord',

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