feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

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

View File

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

View File

@@ -1,10 +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,7 +1,6 @@
import { IGlobalVariable } from '@automatisch/types';
import getWebhooks from '../common/get-webhooks';
import getWebhooks from '../common/get-webhooks.js';
const verifyCredentials = async ($: IGlobalVariable) => {
const verifyCredentials = async ($) => {
const response = await getWebhooks($);
const successful = Array.isArray(response.data);

View File

@@ -0,0 +1,16 @@
const addAuthHeader = ($, requestConfig) => {
const { data } = $.auth;
if (data?.username && data.password && data.apiKey) {
requestConfig.headers['x-api-key'] = data.apiKey;
requestConfig.auth = {
username: data.username,
password: data.password,
};
}
return requestConfig;
};
export default addAuthHeader;

View File

@@ -1,18 +0,0 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const { data } = $.auth;
if (data?.username && data.password && data.apiKey) {
requestConfig.headers['x-api-key'] = data.apiKey as string;
requestConfig.auth = {
username: data.username as string,
password: data.password as string,
};
}
return requestConfig;
};
export default addAuthHeader;

View File

@@ -0,0 +1,3 @@
export default async function getWebhooks($) {
return await $.http.get('/v2/public/api/webhooks');
}

View File

@@ -1,5 +0,0 @@
import type { IGlobalVariable } from "@automatisch/types";
export default async function getWebhooks($: IGlobalVariable) {
return await $.http.get('/v2/public/api/webhooks');
}

View File

@@ -1,7 +1,7 @@
import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import triggers from './triggers';
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';
export default defineApp({
name: 'Flowers Software',

View File

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

View File

@@ -1,3 +0,0 @@
import newActivity from './new-activity';
export default [newActivity];

View File

@@ -1,7 +1,7 @@
import Crypto from 'crypto';
import isEmpty from 'lodash/isEmpty';
import defineTrigger from '../../../../helpers/define-trigger';
import webhookFilters from '../../common/webhook-filters';
import isEmpty from 'lodash/isEmpty.js';
import defineTrigger from '../../../../helpers/define-trigger.js';
import webhookFilters from '../../common/webhook-filters.js';
export default defineTrigger({
name: 'New activity',
@@ -12,7 +12,7 @@ export default defineTrigger({
{
label: 'Activity type',
key: 'filters',
type: 'dropdown' as const,
type: 'dropdown',
required: true,
description: 'Pick an activity type to receive events for.',
variables: false,