feat: Convert all app files to JS
This commit is contained in:
@@ -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 = {
|
||||
3
packages/backend/src/apps/placetel/triggers/index.js
Normal file
3
packages/backend/src/apps/placetel/triggers/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import hungupCall from './hungup-call/index.js';
|
||||
|
||||
export default [hungupCall];
|
||||
@@ -1,3 +0,0 @@
|
||||
import hungupCall from './hungup-call';
|
||||
|
||||
export default [hungupCall];
|
||||
Reference in New Issue
Block a user