feat: Convert all app files to JS
This commit is contained in:
@@ -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,
|
@@ -0,0 +1,9 @@
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
|
||||
const isStillVerified = async ($) => {
|
||||
await verifyCredentials($);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
@@ -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;
|
@@ -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);
|
||||
|
@@ -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;
|
@@ -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;
|
@@ -0,0 +1,3 @@
|
||||
export default async function getWebhooks($) {
|
||||
return await $.http.get('/v2/public/api/webhooks');
|
||||
}
|
@@ -1,5 +0,0 @@
|
||||
import type { IGlobalVariable } from "@automatisch/types";
|
||||
|
||||
export default async function getWebhooks($: IGlobalVariable) {
|
||||
return await $.http.get('/v2/public/api/webhooks');
|
||||
}
|
@@ -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',
|
@@ -0,0 +1,3 @@
|
||||
import newActivity from './new-activity/index.js';
|
||||
|
||||
export default [newActivity];
|
@@ -1,3 +0,0 @@
|
||||
import newActivity from './new-activity';
|
||||
|
||||
export default [newActivity];
|
@@ -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,
|
Reference in New Issue
Block a user