1
0
Fork 0
mirror of synced 2024-06-03 02:55:14 +12:00

Merge pull request #7685 from Budibase/fix/sept-various-fixes

Fix/sept various fixes
This commit is contained in:
Michael Drury 2022-09-12 12:16:31 +02:00 committed by GitHub
commit d79a9bfecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 275 additions and 94 deletions

View file

@ -1,4 +1,5 @@
import { dangerousGetDB, closeDB } from "."
import { DocumentType } from "./constants"
class Replication {
source: any
@ -53,6 +54,14 @@ class Replication {
return this.replication
}
appReplicateOpts() {
return {
filter: (doc: any) => {
return doc._id !== DocumentType.APP_METADATA
},
}
}
/**
* Rollback the target DB back to the state of the source DB
*/
@ -60,6 +69,7 @@ class Replication {
await this.target.destroy()
// Recreate the DB again
this.target = dangerousGetDB(this.target.name)
// take the opportunity to remove deleted tombstones
await this.replicate()
}

View file

@ -254,7 +254,16 @@ export async function getAllApps({ dev, all, idsOnly, efficient }: any = {}) {
return false
})
if (idsOnly) {
return appDbNames
const devAppIds = appDbNames.filter(appId => isDevAppID(appId))
const prodAppIds = appDbNames.filter(appId => !isDevAppID(appId))
switch (dev) {
case true:
return devAppIds
case false:
return prodAppIds
default:
return appDbNames
}
}
const appPromises = appDbNames.map((app: any) =>
// skip setup otherwise databases could be re-created

View file

@ -10,6 +10,7 @@
export let noHorizPadding = false
export let quiet = false
export let emphasized = false
export let onTop = false
export let size = "M"
let thisSelected = undefined
@ -75,6 +76,7 @@
bind:this={container}
class:spectrum-Tabs--quiet={quiet}
class:noHorizPadding
class:onTop
class:spectrum-Tabs--vertical={vertical}
class:spectrum-Tabs--horizontal={!vertical}
class="spectrum-Tabs spectrum-Tabs--size{size}"
@ -122,4 +124,7 @@
.noPadding {
margin: 0;
}
.onTop {
z-index: 100;
}
</style>

View file

@ -1,6 +1,7 @@
<script>
import { Button, Select, Input, Label } from "@budibase/bbui"
import { createEventDispatcher } from "svelte"
import { onMount, createEventDispatcher } from "svelte"
import { flags } from "stores/backend"
const dispatch = createEventDispatcher()
export let value
@ -29,11 +30,16 @@
label: "Every Night at Midnight",
value: "0 0 * * *",
},
{
label: "Every Budibase Reboot",
value: "@reboot",
},
]
onMount(() => {
if (!$flags.cloud) {
CRON_EXPRESSIONS.push({
label: "Every Budibase Reboot",
value: "@reboot",
})
}
})
</script>
<div class="block-field">

View file

@ -23,6 +23,7 @@
const dispatch = createEventDispatcher()
let bindingDrawer
let valid = true
let currentVal = value
$: readableValue = runtimeToReadableBinding(bindings, value)
$: tempValue = readableValue
@ -30,11 +31,17 @@
const saveBinding = () => {
onChange(tempValue)
onBlur()
bindingDrawer.hide()
}
const onChange = value => {
dispatch("change", readableToRuntimeBinding(bindings, value))
currentVal = readableToRuntimeBinding(bindings, value)
dispatch("change", currentVal)
}
const onBlur = () => {
dispatch("blur", currentVal)
}
</script>
@ -45,6 +52,7 @@
readonly={isJS}
value={isJS ? "(JavaScript function)" : readableValue}
on:change={event => onChange(event.detail)}
on:blur={onBlur}
{placeholder}
{updateOnChange}
/>

View file

@ -107,7 +107,7 @@
placeholder={keyPlaceholder}
readonly={readOnly}
bind:value={field.name}
on:change={changed}
on:blur={changed}
/>
{#if options}
<Select bind:value={field.value} on:change={changed} {options} />
@ -115,7 +115,10 @@
<DrawerBindableInput
{bindings}
placeholder="Value"
on:change={e => (field.value = e.detail)}
on:blur={e => {
field.value = e.detail
changed()
}}
disabled={readOnly}
value={field.value}
allowJS={false}
@ -127,7 +130,7 @@
placeholder={valuePlaceholder}
readonly={readOnly}
bind:value={field.value}
on:change={changed}
on:blur={changed}
/>
{/if}
{#if toggle}

View file

@ -1,16 +1,24 @@
<script>
import { ModalContent, Toggle } from "@budibase/bbui"
import { ModalContent, Toggle, Body } from "@budibase/bbui"
export let app
export let published
let excludeRows = false
$: title = published ? "Export published app" : "Export latest app"
$: confirmText = published ? "Export published" : "Export latest"
const exportApp = () => {
const id = app.deployed ? app.prodId : app.devId
const id = published ? app.prodId : app.devId
const appName = encodeURIComponent(app.name)
window.location = `/api/backups/export?appId=${id}&appname=${appName}&excludeRows=${excludeRows}`
}
</script>
<ModalContent title={"Export"} confirmText={"Export"} onConfirm={exportApp}>
<ModalContent {title} {confirmText} onConfirm={exportApp}>
<Body
>Apps can be exported with or without data that is within internal tables -
select this below.</Body
>
<Toggle text="Exclude Rows" bind:value={excludeRows} />
</ModalContent>

View file

@ -46,7 +46,7 @@ export function buildQueryString(obj) {
if (str !== "") {
str += "&"
}
str += `${key}=${value || ""}`
str += `${key}=${encodeURIComponent(value || "")}`
}
}
return str

View file

@ -28,25 +28,25 @@
import { onMount } from "svelte"
import restUtils from "helpers/data/utils"
import {
RestBodyTypes as bodyTypes,
SchemaTypeOptions,
PaginationLocations,
PaginationTypes,
RawRestBodyTypes,
RestBodyTypes as bodyTypes,
SchemaTypeOptions,
} from "constants/backend"
import JSONPreview from "components/integration/JSONPreview.svelte"
import AccessLevelSelect from "components/integration/AccessLevelSelect.svelte"
import DynamicVariableModal from "../../_components/DynamicVariableModal.svelte"
import Placeholder from "assets/bb-spaceship.svg"
import { cloneDeep } from "lodash/fp"
import { RawRestBodyTypes } from "constants/backend"
import {
getRestBindings,
toBindingsArray,
runtimeToReadableBinding,
readableToRuntimeBinding,
runtimeToReadableMap,
readableToRuntimeMap,
runtimeToReadableBinding,
runtimeToReadableMap,
toBindingsArray,
} from "builderStore/dataBinding"
let query, datasource
@ -95,7 +95,7 @@
$: runtimeUrlQueries = readableToRuntimeMap(mergedBindings, breakQs)
function getSelectedQuery() {
const cloneQuery = cloneDeep(
return cloneDeep(
$queries.list.find(q => q._id === $queries.selected) || {
datasourceId: $params.selectedDatasource,
parameters: [],
@ -107,7 +107,6 @@
queryVerb: "read",
}
)
return cloneQuery
}
function checkQueryName(inputUrl = null) {
@ -121,14 +120,15 @@
if (!base) {
return base
}
const qs = restUtils.buildQueryString(
let qs = restUtils.buildQueryString(
runtimeToReadableMap(mergedBindings, qsObj)
)
let newUrl = base
if (base.includes("?")) {
newUrl = base.split("?")[0]
const split = base.split("?")
newUrl = split[0]
}
return qs.length > 0 ? `${newUrl}?${qs}` : newUrl
return qs.length === 0 ? newUrl : `${newUrl}?${qs}`
}
function buildQuery() {
@ -314,6 +314,25 @@
}
}
const paramsChanged = evt => {
breakQs = {}
for (let param of evt.detail) {
breakQs[param.name] = param.value
}
}
const urlChanged = evt => {
breakQs = {}
const qs = evt.target.value.split("?")[1]
if (qs && qs.length > 0) {
const parts = qs.split("&")
for (let part of parts) {
const [key, value] = part.split("=")
breakQs[key] = value
}
}
}
onMount(async () => {
query = getSelectedQuery()
@ -426,7 +445,11 @@
/>
</div>
<div class="url">
<Input bind:value={url} placeholder="http://www.api.com/endpoint" />
<Input
on:blur={urlChanged}
bind:value={url}
placeholder="http://www.api.com/endpoint"
/>
</div>
<Button primary disabled={!url} on:click={runQuery}>Send</Button>
<Button
@ -456,13 +479,16 @@
/>
</Tab>
<Tab title="Params">
<KeyValueBuilder
bind:object={breakQs}
name="param"
headings
bindings={mergedBindings}
bindingDrawerLeft="260px"
/>
{#key breakQs}
<KeyValueBuilder
on:change={paramsChanged}
object={breakQs}
name="param"
headings
bindings={mergedBindings}
bindingDrawerLeft="260px"
/>
{/key}
</Tab>
<Tab title="Headers">
<KeyValueBuilder

View file

@ -15,7 +15,6 @@
import Spinner from "components/common/Spinner.svelte"
import CreateAppModal from "components/start/CreateAppModal.svelte"
import UpdateAppModal from "components/start/UpdateAppModal.svelte"
import ExportAppModal from "components/start/ExportAppModal.svelte"
import { store, automationStore } from "builderStore"
import { API } from "api"
@ -33,7 +32,6 @@
let selectedApp
let creationModal
let updatingModal
let exportModal
let creatingApp = false
let loaded = $apps?.length || $templates?.length
let searchTerm = ""
@ -407,10 +405,6 @@
<UpdateAppModal app={selectedApp} />
</Modal>
<Modal bind:this={exportModal} padding={false} width="600px">
<ExportAppModal app={selectedApp} />
</Modal>
<style>
.appTable {
border-top: var(--border-light);

View file

@ -16,6 +16,7 @@
MenuItem,
Icon,
Helpers,
Modal,
} from "@budibase/bbui"
import OverviewTab from "../_components/OverviewTab.svelte"
import SettingsTab from "../_components/SettingsTab.svelte"
@ -29,6 +30,7 @@
import EditableIcon from "components/common/EditableIcon.svelte"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import HistoryTab from "components/portal/overview/automation/HistoryTab.svelte"
import ExportAppModal from "components/start/ExportAppModal.svelte"
import { checkIncomingDeploymentStatus } from "components/deploy/utils"
import { onDestroy, onMount } from "svelte"
@ -38,7 +40,9 @@
let loaded = false
let deletionModal
let unpublishModal
let exportModal
let appName = ""
let published
// App
$: filteredApps = $apps.filter(app => app.devId === application)
@ -140,11 +144,9 @@
notifications.success("App ID copied to clipboard.")
}
const exportApp = (app, opts = { published: false }) => {
const appName = encodeURIComponent(app.name)
const id = opts?.published ? app.prodId : app.devId
// always export the development version
window.location = `/api/backups/export?appId=${id}&appname=${appName}`
const exportApp = opts => {
published = opts.published
exportModal.show()
}
const unpublishApp = app => {
@ -206,6 +208,10 @@
})
</script>
<Modal bind:this={exportModal} padding={false} width="600px">
<ExportAppModal app={selectedApp} {published} />
</Modal>
<span class="overview-wrap">
<Page wide noPadding>
{#await promise}
@ -269,14 +275,14 @@
<Icon hoverable name="More" />
</span>
<MenuItem
on:click={() => exportApp(selectedApp, { published: false })}
on:click={() => exportApp({ published: false })}
icon="DownloadFromCloud"
>
Export latest
</MenuItem>
{#if isPublished}
<MenuItem
on:click={() => exportApp(selectedApp, { published: true })}
on:click={() => exportApp({ published: true })}
icon="DownloadFromCloudOutline"
>
Export published

View file

@ -553,11 +553,7 @@ export const sync = async (ctx: any, next: any) => {
})
let error
try {
await replication.replicate({
filter: function (doc: any) {
return doc._id !== DocumentType.APP_METADATA
},
})
await replication.replicate(replication.appReplicateOpts())
} catch (err) {
error = err
} finally {

View file

@ -1,11 +1,12 @@
const { streamBackup } = require("../../utilities/fileSystem")
const { events, context } = require("@budibase/backend-core")
const { DocumentType } = require("../../db/utils")
const { isQsTrue } = require("../../utilities")
exports.exportAppDump = async function (ctx) {
let { appId, excludeRows } = ctx.query
const appName = decodeURI(ctx.query.appname)
excludeRows = excludeRows === "true"
excludeRows = isQsTrue(excludeRows)
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt`
ctx.attachment(backupIdentifier)
ctx.body = await streamBackup(appId, excludeRows)

View file

@ -15,6 +15,7 @@ import {
getAppId,
getAppDB,
getProdAppDB,
getDevAppDB,
} from "@budibase/backend-core/context"
import { quotas } from "@budibase/pro"
import { events } from "@budibase/backend-core"
@ -110,17 +111,29 @@ async function deployApp(deployment: any) {
target: productionAppId,
}
replication = new Replication(config)
const devDb = getDevAppDB()
console.log("Compacting development DB")
await devDb.compact()
console.log("Replication object created")
await replication.replicate()
await replication.replicate(replication.appReplicateOpts())
console.log("replication complete.. replacing app meta doc")
// app metadata is excluded as it is likely to be in conflict
// replicate the app metadata document manually
const db = getProdAppDB()
const appDoc = await db.get(DocumentType.APP_METADATA)
const appDoc = await devDb.get(DocumentType.APP_METADATA)
try {
const prodAppDoc = await db.get(DocumentType.APP_METADATA)
appDoc._rev = prodAppDoc._rev
} catch (err) {
delete appDoc._rev
}
// switch to production app ID
deployment.appUrl = appDoc.url
appDoc.appId = productionAppId
appDoc.instance._id = productionAppId
// remove automation errors if they exist
delete appDoc.automationErrors
await db.put(appDoc)
await appCache.invalidateAppMetadata(productionAppId)
console.log("New app doc written successfully.")

View file

@ -534,7 +534,7 @@ module External {
})
// this is the response from knex if no rows found
const rows = !response[0].read ? response : []
const storeTo = isMany ? field.throughFrom || linkPrimaryKey : manyKey
const storeTo = isMany ? field.throughFrom || linkPrimaryKey : fieldName
related[storeTo] = { rows, isMany, tableId }
}
return related

View file

@ -311,7 +311,7 @@ describe("/queries", () => {
"url": "string",
"value": "string"
})
expect(res.body.rows[0].url).toContain("doctype html")
expect(res.body.rows[0].url).toContain("doctype%20html")
})
it("check that it automatically retries on fail with cached dynamics", async () => {
@ -396,7 +396,7 @@ describe("/queries", () => {
"queryHdr": userDetails.firstName,
"secondHdr" : "1234"
})
expect(res.body.rows[0].url).toEqual("http://www.google.com?email=" + userDetails.email)
expect(res.body.rows[0].url).toEqual("http://www.google.com?email=" + userDetails.email.replace("@", "%40"))
})
it("should bind the current user to query parameters", async () => {
@ -413,7 +413,7 @@ describe("/queries", () => {
"testParam" : "1234"
})
expect(res.body.rows[0].url).toEqual("http://www.google.com?test=" + userDetails.email +
expect(res.body.rows[0].url).toEqual("http://www.google.com?test=" + userDetails.email.replace("@", "%40") +
"&testName=" + userDetails.firstName + "&testParam=1234")
})

View file

@ -1,16 +1,19 @@
const { processEvent } = require("./utils")
const { queue, shutdown } = require("./bullboard")
const { TRIGGER_DEFINITIONS } = require("./triggers")
const { TRIGGER_DEFINITIONS, rebootTrigger } = require("./triggers")
const { ACTION_DEFINITIONS } = require("./actions")
/**
* This module is built purely to kick off the worker farm and manage the inputs/outputs
*/
exports.init = function () {
exports.init = async function () {
// this promise will not complete
return queue.process(async job => {
const promise = queue.process(async job => {
await processEvent(job)
})
// on init we need to trigger any reboot automations
await rebootTrigger()
return promise
}
exports.getQueues = () => {

View file

@ -9,6 +9,7 @@ const { checkTestFlag } = require("../utilities/redis")
const utils = require("./utils")
const env = require("../environment")
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context")
const { getAllApps } = require("@budibase/backend-core/db")
const TRIGGER_DEFINITIONS = definitions
const JOB_OPTS = {
@ -16,24 +17,27 @@ const JOB_OPTS = {
removeOnFail: true,
}
async function getAllAutomations() {
const db = getAppDB()
let automations = await db.allDocs(
getAutomationParams(null, { include_docs: true })
)
return automations.rows.map(row => row.doc)
}
async function queueRelevantRowAutomations(event, eventType) {
if (event.appId == null) {
throw `No appId specified for ${eventType} - check event emitters.`
}
doInAppContext(event.appId, async () => {
const db = getAppDB()
let automations = await db.allDocs(
getAutomationParams(null, { include_docs: true })
)
let automations = await getAllAutomations()
// filter down to the correct event type
automations = automations.rows
.map(automation => automation.doc)
.filter(automation => {
const trigger = automation.definition.trigger
return trigger && trigger.event === eventType
})
automations = automations.filter(automation => {
const trigger = automation.definition.trigger
return trigger && trigger.event === eventType
})
for (let automation of automations) {
let automationDef = automation.definition
@ -110,4 +114,34 @@ exports.externalTrigger = async function (
}
}
exports.rebootTrigger = async () => {
// reboot cron option is only available on the main thread at
// startup and only usable in self host
if (env.isInThread() || !env.SELF_HOSTED) {
return
}
// iterate through all production apps, find the reboot crons
// and trigger events for them
const appIds = await getAllApps({ dev: false, idsOnly: true })
for (let prodAppId of appIds) {
await doInAppContext(prodAppId, async () => {
let automations = await getAllAutomations()
let rebootEvents = []
for (let automation of automations) {
if (utils.isRebootTrigger(automation)) {
const job = {
automation,
event: {
appId: prodAppId,
timestamp: Date.now(),
},
}
rebootEvents.push(queue.add(job, JOB_OPTS))
}
}
await Promise.all(rebootEvents)
})
}
}
exports.TRIGGER_DEFINITIONS = TRIGGER_DEFINITIONS

View file

@ -17,6 +17,7 @@ import { tenancy } from "@budibase/backend-core"
import { quotas } from "@budibase/pro"
import { Automation } from "@budibase/types"
const REBOOT_CRON = "@reboot"
const WH_STEP_ID = definitions.WEBHOOK.stepId
const CRON_STEP_ID = definitions.CRON.stepId
const Runner = new Thread(ThreadType.AUTOMATION)
@ -109,22 +110,33 @@ export async function clearMetadata() {
await db.bulkDocs(automationMetadata)
}
export function isCronTrigger(auto: Automation) {
return (
auto &&
auto.definition.trigger &&
auto.definition.trigger.stepId === CRON_STEP_ID
)
}
export function isRebootTrigger(auto: Automation) {
const trigger = auto ? auto.definition.trigger : null
return isCronTrigger(auto) && trigger?.inputs.cron === REBOOT_CRON
}
/**
* This function handles checking of any cron jobs that need to be enabled/updated.
* @param {string} appId The ID of the app in which we are checking for webhooks
* @param {object|undefined} automation The automation object to be updated.
*/
export async function enableCronTrigger(appId: any, automation: any) {
export async function enableCronTrigger(appId: any, automation: Automation) {
const trigger = automation ? automation.definition.trigger : null
function isCronTrigger(auto: any) {
return (
auto &&
auto.definition.trigger &&
auto.definition.trigger.stepId === CRON_STEP_ID
)
}
// need to create cron job
if (isCronTrigger(automation) && trigger?.inputs.cron) {
if (
isCronTrigger(automation) &&
!isRebootTrigger(automation) &&
trigger?.inputs.cron
) {
// make a job id rather than letting Bull decide, makes it easier to handle on way out
const jobId = `${appId}_cron_${newid()}`
const job: any = await queue.add(

View file

@ -14,6 +14,7 @@ import {
BearerAuthConfig,
} from "../definitions/datasource"
import { get } from "lodash"
import qs from "querystring"
const BodyTypes = {
NONE: "none",
@ -215,7 +216,8 @@ module RestModule {
}
}
const main = `${path}?${queryString}`
// make sure the query string is fully encoded
const main = `${path}?${qs.encode(qs.decode(queryString))}`
let complete = main
if (this.config.url && !main.startsWith("http")) {
complete = !this.config.url ? main : `${this.config.url}/${main}`

View file

@ -50,7 +50,7 @@ describe("REST Integration", () => {
name: "test",
}),
}
const response = await config.integration.create(query)
await config.integration.create(query)
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
method: "POST",
body: '{"name":"test"}',
@ -295,7 +295,7 @@ describe("REST Integration", () => {
}
await config.integration.read(query)
expect(fetch).toHaveBeenCalledWith(
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}&`,
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}`,
{
headers: {},
method: "GET",
@ -420,7 +420,7 @@ describe("REST Integration", () => {
}
const res = await config.integration.read(query)
expect(fetch).toHaveBeenCalledWith(
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}&`,
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}`,
{
headers: {},
method: "GET",
@ -528,5 +528,23 @@ describe("REST Integration", () => {
expect(sentData.get(sizeParam)).toEqual(sizeValue.toString())
expect(res.pagination.cursor).toEqual(123)
})
it("should encode query string correctly", async () => {
const query = {
path: "api",
queryString: "test=1 2",
headers: HEADERS,
bodyType: "json",
requestBody: JSON.stringify({
name: "test",
}),
}
await config.integration.create(query)
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1%202`, {
method: "POST",
body: '{"name":"test"}',
headers: HEADERS,
})
})
})
})

View file

@ -458,6 +458,9 @@ class Orchestrator {
export function execute(input: AutomationEvent, callback: WorkerCallback) {
const appId = input.data.event.appId
if (!appId) {
throw new Error("Unable to execute, event doesn't contain app ID.")
}
doInAppContext(appId, async () => {
const automationOrchestrator = new Orchestrator(
input.data.automation,
@ -475,6 +478,9 @@ export function execute(input: AutomationEvent, callback: WorkerCallback) {
export const removeStalled = async (input: AutomationEvent) => {
const appId = input.data.event.appId
if (!appId) {
throw new Error("Unable to execute, event doesn't contain app ID.")
}
await doInAppContext(appId, async () => {
const automationOrchestrator = new Orchestrator(
input.data.automation,

View file

@ -125,13 +125,13 @@ exports.defineFilter = excludeRows => {
* data or user relationships.
* @param {string} appId The app to backup
* @param {object} config Config to send to export DB
* @param {boolean} includeRows Flag to state whether the export should include data.
* @param {boolean} excludeRows Flag to state whether the export should include data.
* @returns {*} either a string or a stream of the backup
*/
const backupAppData = async (appId, config, includeRows) => {
const backupAppData = async (appId, config, excludeRows) => {
return await exports.exportDB(appId, {
...config,
filter: exports.defineFilter(includeRows),
filter: exports.defineFilter(excludeRows),
})
}
@ -148,11 +148,11 @@ exports.performBackup = async (appId, backupName) => {
/**
* Streams a backup of the database state for an app
* @param {string} appId The ID of the app which is to be backed up.
* @param {boolean} includeRows Flag to state whether the export should include data.
* @param {boolean} excludeRows Flag to state whether the export should include data.
* @returns {*} a readable stream of the backup which is written in real time
*/
exports.streamBackup = async (appId, includeRows) => {
return await backupAppData(appId, { stream: true }, includeRows)
exports.streamBackup = async (appId, excludeRows) => {
return await backupAppData(appId, { stream: true }, excludeRows)
}
/**

View file

@ -162,3 +162,11 @@ exports.convertBookmark = bookmark => {
}
return bookmark
}
exports.isQsTrue = param => {
if (typeof param === "string") {
return param.toLowerCase() === "true"
} else {
return param === true
}
}

View file

@ -76,7 +76,7 @@ exports.processDates = (table, rows) => {
if (schema.type !== FieldTypes.DATETIME) {
continue
}
if (!schema.ignoreTimezones) {
if (!schema.timeOnly && !schema.ignoreTimezones) {
datesWithTZ.push(column)
}
}

View file

@ -72,7 +72,8 @@ exports.getUniqueRows = async appIds => {
// ensure uniqueness on a per app pair basis
// this can't be done on all rows because app import results in
// duplicate row ids across apps
uniqueRows = uniqueRows.concat(...new Set(appRows))
// the array pre-concat is important to avoid stack overflow
uniqueRows = uniqueRows.concat([...new Set(appRows)])
}
return uniqueRows

View file

@ -272,6 +272,14 @@ describe("test the string helpers", () => {
)
expect(output).toBe("Hi!")
})
it("should allow use of the ellipsis helper", async () => {
const output = await processString(
"{{ ellipsis \"adfasdfasdfasf\" 7 }}",
{},
)
expect(output).toBe("adfasdf…")
})
})
describe("test the comparison helpers", () => {

View file

@ -25,6 +25,10 @@ export interface AutomationStep {
export interface AutomationTrigger {
id: string
stepId: string
inputs: {
[key: string]: any
}
cronJobId?: string
}
export enum AutomationStatus {