1
0
Fork 0
mirror of synced 2024-07-14 18:55:45 +12:00

Fixes based on server build so far.

This commit is contained in:
mike12345567 2022-11-26 15:10:41 +00:00
parent 90362b65c1
commit 658f12281d
50 changed files with 168 additions and 131 deletions

View file

@ -19,7 +19,7 @@ export async function created(
const properties: AutomationCreatedEvent = {
appId: automation.appId,
automationId: automation._id as string,
triggerId: automation.definition?.trigger?.id!,
triggerId: automation.definition?.trigger?.id,
triggerType: automation.definition?.trigger?.stepId,
}
await publishEvent(Event.AUTOMATION_CREATED, properties, timestamp)
@ -29,7 +29,7 @@ export async function triggerUpdated(automation: Automation) {
const properties: AutomationTriggerUpdatedEvent = {
appId: automation.appId,
automationId: automation._id as string,
triggerId: automation.definition?.trigger?.id!,
triggerId: automation.definition?.trigger?.id,
triggerType: automation.definition?.trigger?.stepId,
}
await publishEvent(Event.AUTOMATION_TRIGGER_UPDATED, properties)
@ -39,7 +39,7 @@ export async function deleted(automation: Automation) {
const properties: AutomationDeletedEvent = {
appId: automation.appId,
automationId: automation._id as string,
triggerId: automation.definition?.trigger?.id!,
triggerId: automation.definition?.trigger?.id,
triggerType: automation.definition?.trigger?.stepId,
}
await publishEvent(Event.AUTOMATION_DELETED, properties)
@ -49,7 +49,7 @@ export async function tested(automation: Automation) {
const properties: AutomationTestedEvent = {
appId: automation.appId,
automationId: automation._id as string,
triggerId: automation.definition?.trigger?.id!,
triggerId: automation.definition?.trigger?.id,
triggerType: automation.definition?.trigger?.stepId,
}
await publishEvent(Event.AUTOMATION_TESTED, properties)
@ -70,7 +70,7 @@ export async function stepCreated(
const properties: AutomationStepCreatedEvent = {
appId: automation.appId,
automationId: automation._id as string,
triggerId: automation.definition?.trigger?.id!,
triggerId: automation.definition?.trigger?.id,
triggerType: automation.definition?.trigger?.stepId,
stepId: step.id!,
stepType: step.stepId,
@ -85,7 +85,7 @@ export async function stepDeleted(
const properties: AutomationStepDeletedEvent = {
appId: automation.appId,
automationId: automation._id as string,
triggerId: automation.definition?.trigger?.id!,
triggerId: automation.definition?.trigger?.id,
triggerType: automation.definition?.trigger?.stepId,
stepId: step.id!,
stepType: step.stepId,

View file

@ -1,14 +0,0 @@
const { getDefinitions } = require("../../integrations")
exports.fetch = async function (ctx) {
ctx.status = 200
const defs = await getDefinitions()
ctx.body = defs
}
exports.find = async function (ctx) {
const defs = await getDefinitions()
ctx.status = 200
ctx.body = defs[ctx.params.type]
}

View file

@ -0,0 +1,13 @@
import { getDefinitions } from "../../integrations"
import { BBContext } from "@budibase/types"
export async function fetch(ctx: BBContext) {
ctx.status = 200
ctx.body = await getDefinitions()
}
export async function find(ctx: BBContext) {
const defs = await getDefinitions()
ctx.status = 200
ctx.body = defs[ctx.params.type]
}

View file

@ -1,13 +0,0 @@
const { migrate, MIGRATIONS } = require("../../migrations")
exports.migrate = async ctx => {
const options = ctx.request.body
// don't await as can take a while, just return
migrate(options)
ctx.status = 200
}
exports.fetchDefinitions = async ctx => {
ctx.body = MIGRATIONS
ctx.status = 200
}

View file

@ -0,0 +1,14 @@
import { migrate as migrationImpl, MIGRATIONS } from "../../migrations"
import { BBContext } from "@budibase/types"
export async function migrate(ctx: BBContext) {
const options = ctx.request.body
// don't await as can take a while, just return
migrationImpl(options)
ctx.status = 200
}
export async function fetchDefinitions(ctx: BBContext) {
ctx.body = MIGRATIONS
ctx.status = 200
}

View file

@ -209,12 +209,16 @@ module External {
}
class ExternalRequest {
private operation: Operation
private operation: DataSourceOperation
private tableId: string
private datasource: Datasource
private tables: { [key: string]: Table } = {}
constructor(operation: Operation, tableId: string, datasource: Datasource) {
constructor(
operation: DataSourceOperation,
tableId: string,
datasource: Datasource
) {
this.operation = operation
this.tableId = tableId
this.datasource = datasource

View file

@ -122,9 +122,9 @@ export async function finaliseRow(
const db = context.getAppDB()
row.type = "row"
// process the row before return, to include relationships
let enrichedRow = await outputProcessing(table, cloneDeep(row), {
let enrichedRow = (await outputProcessing(table, cloneDeep(row), {
squash: false,
})
})) as Row
// use enriched row to generate formulas for saving, specifically only use as context
row = processFormulas(table, row, {
dynamic: false,

View file

@ -14,7 +14,7 @@ import {
RelationshipTypes,
} from "../../../constants"
import { makeExternalQuery } from "../../../integrations/base/query"
import csvParser from "../../../utilities/csvParser"
import * as csvParser from "../../../utilities/csvParser"
import { handleRequest } from "../row/external"
import { events, context } from "@budibase/backend-core"
import {

View file

@ -1,6 +1,6 @@
import * as internal from "./internal"
import * as external from "./external"
import csvParser from "../../../utilities/csvParser"
import * as csvParser from "../../../utilities/csvParser"
import { isExternalTable, isSQL } from "../../../integrations/utils"
import { getDatasourceParams } from "../../../db/utils"
import { context, events } from "@budibase/backend-core"
@ -103,7 +103,10 @@ export async function validateCSVSchema(ctx: BBContext) {
if (tableId) {
existingTable = await sdk.tables.getTable(tableId)
}
let result = await csvParser.parse(csvString, schema)
let result: Record<string, any> | undefined = await csvParser.parse(
csvString,
schema
)
if (existingTable) {
result = csvParser.updateSchema({ schema: result, existingTable })
}

View file

@ -1,5 +1,5 @@
import { getWebhookParams } from "../../db/utils"
import triggers from "../../automations/triggers"
import * as triggers from "../../automations/triggers"
import { db as dbCore, context } from "@budibase/backend-core"
import {
Webhook,

View file

@ -37,7 +37,7 @@ router
// re-direct before any middlewares occur
.redirect("/", "/builder")
.use(
auth.buildAuthMiddleware(null, {
auth.buildAuthMiddleware([], {
publicAllowed: true,
})
)
@ -45,7 +45,7 @@ router
// the server can be public anywhere, so nowhere should throw errors
// if the tenancy has not been set, it'll have to be discovered at application layer
.use(
auth.buildTenancyMiddleware(null, null, {
auth.buildTenancyMiddleware([], [], {
noTenancyRequired: true,
})
)

View file

@ -1,5 +1,5 @@
import Router from "@koa/router"
import controller from "../controllers/integration"
import * as controller from "../controllers/integration"
import authorized from "../../middleware/authorized"
import { permissions } from "@budibase/backend-core"

View file

@ -10,7 +10,7 @@ if (process.env.ELASTIC_APM_ENABLED) {
}
import { ExtendableContext } from "koa"
import db from "./db"
import * as db from "./db"
db.init()
const Koa = require("koa")
const destroyable = require("server-destroy")

View file

@ -15,7 +15,7 @@ import * as delay from "./steps/delay"
import * as queryRow from "./steps/queryRows"
import * as loop from "./steps/loop"
import env from "../environment"
import { AutomationStep, AutomationStepInput } from "@budibase/types"
import { AutomationStepSchema, AutomationStepInput } from "@budibase/types"
const ACTION_IMPLS: Record<
string,
@ -38,7 +38,7 @@ const ACTION_IMPLS: Record<
zapier: zapier.run,
integromat: integromat.run,
}
export const ACTION_DEFINITIONS: Record<string, AutomationStep> = {
export const ACTION_DEFINITIONS: Record<string, AutomationStepSchema> = {
SEND_EMAIL_SMTP: sendSmtpEmail.definition,
CREATE_ROW: createRow.definition,
UPDATE_ROW: updateRow.definition,

View file

@ -1,14 +1,14 @@
import { execSync } from "child_process"
import { processStringSync } from "@budibase/string-templates"
import automationUtils from "../automationUtils"
import * as automationUtils from "../automationUtils"
import environment from "../../environment"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Bash Scripting",
tagline: "Execute a bash command",
icon: "JourneyEvent",

View file

@ -3,11 +3,11 @@ import { cleanUpRow, getError } from "../automationUtils"
import { buildCtx } from "./utils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Create Row",
tagline: "Create a {{inputs.enriched.table.name}} row",
icon: "TableRowAddBottom",

View file

@ -1,11 +1,11 @@
import { wait } from "../../utilities"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Delay",
icon: "Clock",
tagline: "Delay for {{inputs.time}} milliseconds",

View file

@ -3,11 +3,11 @@ import { buildCtx } from "./utils"
import { getError } from "../automationUtils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
description: "Delete a row from your database",
icon: "TableRowRemoveCenter",
name: "Delete Row",

View file

@ -2,14 +2,14 @@ import fetch from "node-fetch"
import { getFetchResponse } from "./utils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
const DEFAULT_USERNAME = "Budibase Automate"
const DEFAULT_AVATAR_URL = "https://i.imgur.com/a1cmTKM.png"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Discord Message",
tagline: "Send a message to a Discord server",
description: "Send a message to a Discord server",

View file

@ -1,13 +1,13 @@
import * as queryController from "../../api/controllers/query"
import { buildCtx } from "./utils"
import automationUtils from "../automationUtils"
import * as automationUtils from "../automationUtils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "External Data Connector",
tagline: "Execute Data Connector",
icon: "Data",

View file

@ -1,13 +1,13 @@
import * as scriptController from "../../api/controllers/script"
import { buildCtx } from "./utils"
import automationUtils from "../automationUtils"
import * as automationUtils from "../automationUtils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "JS Scripting",
tagline: "Execute JavaScript Code",
icon: "Code",

View file

@ -1,6 +1,6 @@
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
@ -18,7 +18,7 @@ export const PrettyFilterConditions = {
[FilterConditions.LESS_THAN]: "Less than",
}
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Condition",
tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
icon: "Branch2",

View file

@ -2,11 +2,11 @@ import fetch from "node-fetch"
import { getFetchResponse } from "./utils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Integromat Integration",
tagline: "Trigger an Integromat scenario",
description:

View file

@ -1,6 +1,6 @@
import { AutomationActionStepId, AutomationStep } from "@budibase/types"
import { AutomationActionStepId, AutomationStepSchema } from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Looping",
icon: "Reuse",
tagline: "Loop the block",

View file

@ -1,9 +1,9 @@
import fetch from "node-fetch"
import { getFetchResponse } from "./utils"
import automationUtils from "../automationUtils"
import * as automationUtils from "../automationUtils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
@ -21,7 +21,7 @@ const BODY_REQUESTS = [RequestType.POST, RequestType.PUT, RequestType.PATCH]
* NOTE: this functionality is deprecated - it no longer should be used.
*/
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
deprecated: true,
name: "Outgoing webhook",
tagline: "Send a {{inputs.requestMethod}} request",

View file

@ -2,10 +2,10 @@ import * as rowController from "../../api/controllers/row"
import * as tableController from "../../api/controllers/table"
import { FieldTypes } from "../../constants"
import { buildCtx } from "./utils"
import automationUtils from "../automationUtils"
import * as automationUtils from "../automationUtils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
SearchFilters,
Table,
@ -31,7 +31,7 @@ const EmptyFilterOptionPretty = {
[EmptyFilterOption.RETURN_NONE]: "Return no rows",
}
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
description: "Query rows from the database",
icon: "Search",
name: "Query rows",

View file

@ -1,12 +1,12 @@
import { sendSmtpEmail } from "../../utilities/workerRequests"
import automationUtils from "../automationUtils"
import * as automationUtils from "../automationUtils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
description: "Send an email using SMTP",
tagline: "Send SMTP email to {{inputs.to}}",
icon: "Email",

View file

@ -1,6 +1,6 @@
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
@ -10,7 +10,7 @@ import {
* GET/DELETE requests cannot handle body elements so they will not be sent if configured.
*/
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Backend log",
tagline: "Console log a value in the backend",
icon: "Monitoring",

View file

@ -2,11 +2,11 @@ import fetch from "node-fetch"
import { getFetchResponse } from "./utils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Slack Message",
tagline: "Send a message to Slack",
description: "Send a message to Slack",

View file

@ -1,13 +1,13 @@
import * as rowController from "../../api/controllers/row"
import automationUtils from "../automationUtils"
import * as automationUtils from "../automationUtils"
import { buildCtx } from "./utils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Update Row",
tagline: "Update a {{inputs.enriched.table.name}} row",
icon: "Refresh",

View file

@ -2,11 +2,11 @@ import fetch from "node-fetch"
import { getFetchResponse } from "./utils"
import {
AutomationActionStepId,
AutomationStep,
AutomationStepSchema,
AutomationStepInput,
} from "@budibase/types"
export const definition: AutomationStep = {
export const definition: AutomationStepSchema = {
name: "Zapier Webhook",
stepId: AutomationActionStepId.zapier,
type: "ACTION",

View file

@ -1,6 +1,9 @@
import { AutomationTrigger, AutomationTriggerStepId } from "@budibase/types"
import {
AutomationTriggerSchema,
AutomationTriggerStepId,
} from "@budibase/types"
export const definition: AutomationTrigger = {
export const definition: AutomationTriggerSchema = {
name: "App Action",
event: "app:trigger",
icon: "Apps",

View file

@ -1,6 +1,9 @@
import { AutomationTrigger, AutomationTriggerStepId } from "@budibase/types"
import {
AutomationTriggerSchema,
AutomationTriggerStepId,
} from "@budibase/types"
export const definition: AutomationTrigger = {
export const definition: AutomationTriggerSchema = {
name: "Cron Trigger",
event: "cron:trigger",
icon: "Clock",

View file

@ -1,9 +1,9 @@
import app from "./app"
import cron from "./cron"
import rowDeleted from "./rowDeleted"
import rowSaved from "./rowSaved"
import rowUpdated from "./rowUpdated"
import webhook from "./webhook"
import * as app from "./app"
import * as cron from "./cron"
import * as rowDeleted from "./rowDeleted"
import * as rowSaved from "./rowSaved"
import * as rowUpdated from "./rowUpdated"
import * as webhook from "./webhook"
export const definitions = {
ROW_SAVED: rowSaved.definition,

View file

@ -1,6 +1,9 @@
import { AutomationTrigger, AutomationTriggerStepId } from "@budibase/types"
import {
AutomationTriggerSchema,
AutomationTriggerStepId,
} from "@budibase/types"
export const definition: AutomationTrigger = {
export const definition: AutomationTriggerSchema = {
name: "Row Deleted",
event: "row:delete",
icon: "TableRowRemoveCenter",

View file

@ -1,6 +1,9 @@
import { AutomationTrigger, AutomationTriggerStepId } from "@budibase/types"
import {
AutomationTriggerSchema,
AutomationTriggerStepId,
} from "@budibase/types"
export const definition: AutomationTrigger = {
export const definition: AutomationTriggerSchema = {
name: "Row Created",
event: "row:save",
icon: "TableRowAddBottom",

View file

@ -1,6 +1,9 @@
import { AutomationTrigger, AutomationTriggerStepId } from "@budibase/types"
import {
AutomationTriggerSchema,
AutomationTriggerStepId,
} from "@budibase/types"
export const definition: AutomationTrigger = {
export const definition: AutomationTriggerSchema = {
name: "Row Updated",
event: "row:update",
icon: "Refresh",

View file

@ -1,6 +1,9 @@
import { AutomationTrigger, AutomationTriggerStepId } from "@budibase/types"
import {
AutomationTriggerSchema,
AutomationTriggerStepId,
} from "@budibase/types"
export const definition: AutomationTrigger = {
export const definition: AutomationTriggerSchema = {
name: "Webhook",
event: "web:trigger",
icon: "Send",

View file

@ -13,7 +13,7 @@ import {
} from "@budibase/types"
type LinkControllerOpts = {
tableId: string
tableId?: string
row?: Row
table?: Table
oldTable?: Table
@ -21,7 +21,7 @@ type LinkControllerOpts = {
class LinkController {
_db: Database
_tableId: string
_tableId?: string
_row?: Row
_table?: Table
_oldTable?: Table

View file

@ -100,7 +100,7 @@ async function getFullLinkedDocs(links: LinkDocumentValue[]) {
* row operations and the table for table operations.
*/
export async function updateLinks(args: {
tableId: string
tableId?: string
eventType: string
row?: Row
table?: Table

View file

@ -21,7 +21,7 @@ class BudibaseEmitter extends EventEmitter {
tableEmission({ emitter: this, eventName, appId, table })
}
emitPort(portNumber: number) {
emitPort(portNumber?: number | string) {
this.emit("internal:port", portNumber)
}
}

View file

@ -266,6 +266,7 @@ class GoogleSheetsIntegration implements DatasourcePlus {
this.deleteTable(json?.table?.name),
}
// @ts-ignore
const internalQueryMethod = handlers[json.endpoint.operation]
return await internalQueryMethod()

View file

@ -230,7 +230,7 @@ function shouldCopySpecialColumn(
const fetchedIsNumber =
!fetchedColumn || fetchedColumn.type === FieldTypes.NUMBER
return (
specialTypes.indexOf(column.type) !== -1 ||
specialTypes.indexOf(column.type as FieldTypes) !== -1 ||
(fetchedIsNumber && column.type === FieldTypes.BOOLEAN)
)
}
@ -292,7 +292,11 @@ export function finaliseExternalTables(
if (table.primary == null || table.primary.length === 0) {
errors[name] = BuildSchemaErrors.NO_KEY
continue
} else if (schemaFields.find(field => invalidColumns.includes(field))) {
} else if (
schemaFields.find(field =>
invalidColumns.includes(field as InvalidColumns)
)
) {
errors[name] = BuildSchemaErrors.INVALID_COLUMN
continue
}

View file

@ -13,11 +13,11 @@ import {
} from "@budibase/backend-core"
import fs from "fs"
import { watch } from "./watch"
import automations from "./automations"
import fileSystem from "./utilities/fileSystem"
import * as automations from "./automations"
import * as fileSystem from "./utilities/fileSystem"
import eventEmitter from "./events"
import * as migrations from "./migrations"
import bullboard from "./automations/bullboard"
import * as bullboard from "./automations/bullboard"
import * as pro from "@budibase/pro"
import * as api from "./api"
import sdk from "./sdk"

View file

@ -6,8 +6,8 @@ import {
disableCronById,
isErrorInOutput,
} from "../automations/utils"
import { default as actions } from "../automations/actions"
import { default as automationUtils } from "../automations/automationUtils"
import * as actions from "../automations/actions"
import * as automationUtils from "../automations/automationUtils"
import { default as AutomationEmitter } from "../events/AutomationEmitter"
import { generateAutomationMetadataID, isProdAppID } from "../db/utils"
import { definitions as triggerDefs } from "../automations/triggerInfo"
@ -335,7 +335,7 @@ class Orchestrator {
)) {
originalStepInput[key][innerKey][innerObject] =
automationUtils.substituteLoopStep(
innerValue,
innerValue as string,
`steps.${loopStepNumber}`
)
}

View file

@ -1,6 +1,6 @@
import { QueryVariable } from "./definitions"
import env from "../environment"
import db from "../db"
import * as db from "../db"
import { redis, db as dbCore } from "@budibase/backend-core"
const VARIABLE_TTL_SECONDS = 3600

View file

@ -8,7 +8,7 @@ type CsvParseOpts = {
csvString?: string
}
const VALIDATORS = {
const VALIDATORS: any = {
[FieldTypes.STRING]: () => true,
[FieldTypes.OPTIONS]: () => true,
[FieldTypes.BARCODEQR]: () => true,
@ -28,7 +28,7 @@ const VALIDATORS = {
},
}
const PARSERS = {
const PARSERS: any = {
[FieldTypes.NUMBER]: (attribute?: string) => {
if (!attribute) {
return attribute
@ -43,7 +43,7 @@ const PARSERS = {
},
}
export function parse(csvString: string, parsers: any) {
export function parse(csvString: string, parsers: any): Record<string, any> {
const result = csv().fromString(csvString)
const schema: Record<string, any> = {}
@ -89,7 +89,7 @@ export function updateSchema({
existingTable,
}: {
schema?: Record<string, any>
existingTable: Table
existingTable?: Table
}) {
if (!schema) {
return schema
@ -97,7 +97,7 @@ export function updateSchema({
const finalSchema: Record<string, FieldSchema> = {}
const schemaKeyMap: Record<string, any> = {}
Object.keys(schema).forEach(key => (schemaKeyMap[key.toLowerCase()] = key))
for (let [key, field] of Object.entries(existingTable.schema)) {
for (let [key, field] of Object.entries(existingTable?.schema || {})) {
const lcKey = key.toLowerCase()
const foundKey: string = schemaKeyMap[lcKey]
if (foundKey) {

View file

@ -1,4 +1,4 @@
import linkRows from "../../db/linkedRows"
import * as linkRows from "../../db/linkedRows"
import { FieldTypes, AutoFieldSubTypes } from "../../constants"
import { attachmentsRelativeURL } from "../index"
import { processFormulas, fixAutoColumnSubType } from "./utils"
@ -189,10 +189,10 @@ export async function outputProcessing(
wasArray = false
}
// attach any linked row information
let enriched = await linkRows.attachFullLinkedDocs(table, rows)
let enriched = await linkRows.attachFullLinkedDocs(table, rows as Row[])
// process formulas
enriched = processFormulas(table, enriched, { dynamic: true })
enriched = processFormulas(table, enriched, { dynamic: true }) as Row[]
// update the attachments URL depending on hosting
for (let [property, column] of Object.entries(table.schema)) {

View file

@ -4,7 +4,7 @@ import { FieldTypes } from "../../constants"
/**
* A map of how we convert various properties in rows to each other based on the row type.
*/
exports.TYPE_TRANSFORM_MAP = {
export const TYPE_TRANSFORM_MAP: any = {
[FieldTypes.LINK]: {
"": [],
[null]: [],

View file

@ -41,8 +41,7 @@ export interface Automation extends Document {
name: string
}
export interface AutomationStep {
id?: string
export interface AutomationStepSchema {
name: string
tagline: string
icon: string
@ -65,11 +64,19 @@ export interface AutomationStep {
}
}
export interface AutomationTrigger extends AutomationStep {
export interface AutomationStep extends AutomationStepSchema {
id: string
}
export interface AutomationTriggerSchema extends AutomationStepSchema {
event?: string
cronJobId?: string
}
export interface AutomationTrigger extends AutomationTriggerSchema {
id: string
}
export enum AutomationStatus {
SUCCESS = "success",
ERROR = "error",