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,6 +1,6 @@
import Crypto from 'crypto';
import { IJSONObject } from '@automatisch/types';
import defineTrigger from '../../../../helpers/define-trigger';
import defineTrigger from '../../../../helpers/define-trigger.js';
import getRawBody from 'raw-body';
export default defineTrigger({
@@ -12,14 +12,14 @@ export default defineTrigger({
{
label: 'Types',
key: 'types',
type: 'dynamic' as const,
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Type',
key: 'type',
type: 'dropdown' as const,
type: 'dropdown',
required: true,
description:
'Filter events by type. If the types are not specified, all types will be notified.',
@@ -41,14 +41,14 @@ export default defineTrigger({
{
label: 'Numbers',
key: 'numbers',
type: 'dynamic' as const,
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Number',
key: 'number',
type: 'dropdown' as const,
type: 'dropdown',
required: true,
description:
'Filter events by number. If the numbers are not specified, all numbers will be notified.',
@@ -76,9 +76,7 @@ export default defineTrigger({
const jsonRequestBody = JSON.parse(stringBody);
let types = ($.step.parameters.types as IJSONObject[]).map(
(type) => type.type
);
let types = $.step.parameters.types.map((type) => type.type);
if (types.length === 0) {
types = ['all'];
@@ -97,9 +95,7 @@ export default defineTrigger({
},
async testRun($) {
const types = ($.step.parameters.types as IJSONObject[]).map(
(type) => type.type
);
const types = $.step.parameters.types.map((type) => type.type);
const sampleEventData = {
type: types[0] || 'missed',
@@ -123,8 +119,8 @@ export default defineTrigger({
},
async registerHook($) {
const numbers = ($.step.parameters.numbers as IJSONObject[])
.map((number: IJSONObject) => number.number)
const numbers = $.step.parameters.numbers
.map((number) => number.number)
.filter(Boolean);
const subscriptionPayload = {

View File

@@ -0,0 +1,3 @@
import hungupCall from './hungup-call/index.js';
export default [hungupCall];

View File

@@ -1,3 +0,0 @@
import hungupCall from './hungup-call';
export default [hungupCall];