diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/index.js b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/index.js
deleted file mode 100644
index cca8ece484..0000000000
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/index.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import { store } from "builderStore"
-import { get } from "svelte/store"
-
-import NavigateTo from "./NavigateTo.svelte"
-import SaveRow from "./SaveRow.svelte"
-import DeleteRow from "./DeleteRow.svelte"
-import ExecuteQuery from "./ExecuteQuery.svelte"
-import TriggerAutomation from "./TriggerAutomation.svelte"
-import ValidateForm from "./ValidateForm.svelte"
-import LogOut from "./LogOut.svelte"
-import ClearForm from "./ClearForm.svelte"
-import CloseScreenModal from "./CloseScreenModal.svelte"
-import ChangeFormStep from "./ChangeFormStep.svelte"
-import UpdateStateStep from "./UpdateState.svelte"
-import RefreshDataProvider from "./RefreshDataProvider.svelte"
-
-// Defines which actions are available to configure in the front end.
-// Unfortunately the "name" property is used as the identifier so please don't
-// change them.
-// The client library removes any spaces when processing actions, so they can
-// be considered as camel case too.
-// There is technical debt here to sanitize all these and standardise them
-// across the packages but it's a breaking change to existing apps.
-export const getAvailableActions = () => {
- let actions = [
- {
- name: "Save Row",
- component: SaveRow,
- },
- {
- name: "Delete Row",
- component: DeleteRow,
- },
- {
- name: "Navigate To",
- component: NavigateTo,
- },
- {
- name: "Execute Query",
- component: ExecuteQuery,
- },
- {
- name: "Trigger Automation",
- component: TriggerAutomation,
- },
- {
- name: "Validate Form",
- component: ValidateForm,
- },
- {
- name: "Log Out",
- component: LogOut,
- },
- {
- name: "Clear Form",
- component: ClearForm,
- },
- {
- name: "Close Screen Modal",
- component: CloseScreenModal,
- },
- {
- name: "Change Form Step",
- component: ChangeFormStep,
- },
- {
- name: "Refresh Data Provider",
- component: RefreshDataProvider,
- },
- ]
-
- if (get(store).clientFeatures?.state) {
- actions.push({
- name: "Update State",
- component: UpdateStateStep,
- })
- }
-
- return actions
-}
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/index.js b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/index.js
deleted file mode 100644
index 8966c4ab26..0000000000
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import EventsEditor from "./EventPropertyControl.svelte"
-export default EventsEditor
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
index e30fd6d491..d9425c961d 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
@@ -21,7 +21,7 @@
export let panel = ClientBindingPanel
export let allowBindings = true
- const BannedTypes = ["link", "attachment", "formula"]
+ const BannedTypes = ["link", "attachment", "formula", "json", "jsonarray"]
$: fieldOptions = (schemaFields ?? [])
.filter(field => !BannedTypes.includes(field.type))
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FormFieldSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FormFieldSelect.svelte
index 5527941bd5..ba54de5478 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FormFieldSelect.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FormFieldSelect.svelte
@@ -5,7 +5,7 @@
getSchemaForDatasource,
} from "builderStore/dataBinding"
import { currentAsset } from "builderStore"
- import { findClosestMatchingComponent } from "builderStore/storeUtils"
+ import { findClosestMatchingComponent } from "builderStore/componentUtils"
export let componentInstance
export let value
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ResetFieldsButton.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ResetFieldsButton.svelte
index d5b82176ce..fa2a0d6088 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ResetFieldsButton.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ResetFieldsButton.svelte
@@ -1,7 +1,7 @@
+
+
+
+
diff --git a/packages/client/src/components/app/blocks/CardsBlock.svelte b/packages/client/src/components/app/blocks/CardsBlock.svelte
index 349dbf9074..301b440ab3 100644
--- a/packages/client/src/components/app/blocks/CardsBlock.svelte
+++ b/packages/client/src/components/app/blocks/CardsBlock.svelte
@@ -74,7 +74,7 @@
enrichedFilter.push({
field: column.name,
operator: column.type === "string" ? "string" : "equal",
- type: "string",
+ type: column.type === "string" ? "string" : "number",
valueType: "Binding",
value: `{{ [${formId}].[${column.name}] }}`,
})
diff --git a/packages/client/src/components/app/blocks/TableBlock.svelte b/packages/client/src/components/app/blocks/TableBlock.svelte
index f04885bf2a..936a8d1734 100644
--- a/packages/client/src/components/app/blocks/TableBlock.svelte
+++ b/packages/client/src/components/app/blocks/TableBlock.svelte
@@ -62,7 +62,7 @@
enrichedFilter.push({
field: column.name,
operator: column.type === "string" ? "string" : "equal",
- type: "string",
+ type: column.type === "string" ? "string" : "number",
valueType: "Binding",
value: `{{ ${safe(formId)}.${safe(column.name)} }}`,
})
diff --git a/packages/client/src/components/app/dynamic-filter/FilterModal.svelte b/packages/client/src/components/app/dynamic-filter/FilterModal.svelte
index 99b9a1a6f6..f303c69aaf 100644
--- a/packages/client/src/components/app/dynamic-filter/FilterModal.svelte
+++ b/packages/client/src/components/app/dynamic-filter/FilterModal.svelte
@@ -19,7 +19,7 @@
export let schemaFields
export let filters = []
- const BannedTypes = ["link", "attachment", "formula"]
+ const BannedTypes = ["link", "attachment", "formula", "json"]
$: fieldOptions = (schemaFields ?? [])
.filter(field => !BannedTypes.includes(field.type))
diff --git a/packages/client/src/components/app/forms/InnerForm.svelte b/packages/client/src/components/app/forms/InnerForm.svelte
index 7067d33e7d..47bc717d92 100644
--- a/packages/client/src/components/app/forms/InnerForm.svelte
+++ b/packages/client/src/components/app/forms/InnerForm.svelte
@@ -3,6 +3,8 @@
import { derived, get, writable } from "svelte/store"
import { createValidatorFromConstraints } from "./validation"
import { generateID } from "utils/helpers"
+ import { deepGet, deepSet } from "@budibase/bbui"
+ import { cloneDeep } from "lodash/fp"
export let dataSource
export let disabled = false
@@ -49,6 +51,20 @@
})
}
+ // Derive value of whole form
+ $: formValue = deriveFormValue(initialValues, $values, $enrichments)
+
+ // Create data context to provide
+ $: dataContext = {
+ ...formValue,
+
+ // These static values are prefixed to avoid clashes with actual columns
+ __value: formValue,
+ __valid: valid,
+ __currentStep: $currentStep,
+ __currentStepValid: $currentStepValid,
+ }
+
// Generates a derived store from an array of fields, comprised of a map of
// extracted values from the field array
const deriveFieldProperty = (fieldStores, getProp) => {
@@ -78,6 +94,35 @@
})
}
+ // Derive the overall form value and deeply set all field paths so that we
+ // can support things like JSON fields.
+ const deriveFormValue = (initialValues, values, enrichments) => {
+ let formValue = cloneDeep(initialValues || {})
+
+ // We need to sort the keys to avoid a JSON field overwriting a nested field
+ const sortedFields = Object.entries(values || {})
+ .map(([key, value]) => {
+ const field = getField(key)
+ return {
+ key,
+ value,
+ lastUpdate: get(field).fieldState?.lastUpdate || 0,
+ }
+ })
+ .sort((a, b) => {
+ return a.lastUpdate > b.lastUpdate
+ })
+
+ // Merge all values and enrichments into a single value
+ sortedFields.forEach(({ key, value }) => {
+ deepSet(formValue, key, value)
+ })
+ Object.entries(enrichments || {}).forEach(([key, value]) => {
+ deepSet(formValue, key, value)
+ })
+ return formValue
+ }
+
// Searches the field array for a certain field
const getField = name => {
return fields.find(field => get(field).name === name)
@@ -97,13 +142,20 @@
}
// If we've already registered this field then keep some existing state
- let initialValue = initialValues[field] ?? defaultValue
+ let initialValue = deepGet(initialValues, field) ?? defaultValue
let fieldId = `id-${generateID()}`
const existingField = getField(field)
if (existingField) {
const { fieldState } = get(existingField)
- initialValue = fieldState.value ?? initialValue
fieldId = fieldState.fieldId
+
+ // Use new default value if default value changed,
+ // otherwise use the current value if possible
+ if (defaultValue !== fieldState.defaultValue) {
+ initialValue = defaultValue
+ } else {
+ initialValue = fieldState.value ?? initialValue
+ }
}
// Auto columns are always disabled
@@ -130,6 +182,7 @@
disabled: disabled || fieldDisabled || isAutoColumn,
defaultValue,
validator,
+ lastUpdate: Date.now(),
},
fieldApi: makeFieldApi(field, defaultValue),
fieldSchema: schema?.[field] ?? {},
@@ -204,6 +257,7 @@
fieldInfo.update(state => {
state.fieldState.value = value
state.fieldState.error = error
+ state.fieldState.lastUpdate = Date.now()
return state
})
@@ -220,6 +274,7 @@
fieldInfo.update(state => {
state.fieldState.value = newValue
state.fieldState.error = null
+ state.fieldState.lastUpdate = Date.now()
return state
})
}
@@ -299,18 +354,6 @@
{ type: ActionTypes.ClearForm, callback: formApi.clear },
{ type: ActionTypes.ChangeFormStep, callback: formApi.changeStep },
]
-
- // Create data context to provide
- $: dataContext = {
- ...initialValues,
- ...$values,
- ...$enrichments,
-
- // These static values are prefixed to avoid clashes with actual columns
- __valid: valid,
- __currentStep: $currentStep,
- __currentStepValid: $currentStepValid,
- }
diff --git a/packages/client/src/components/app/forms/JSONField.svelte b/packages/client/src/components/app/forms/JSONField.svelte
new file mode 100644
index 0000000000..d38a41b430
--- /dev/null
+++ b/packages/client/src/components/app/forms/JSONField.svelte
@@ -0,0 +1,71 @@
+
+
+
+ {#if fieldState}
+
+ fieldApi.setValue(parseValue(e.detail))}
+ disabled={fieldState.disabled}
+ error={fieldState.error}
+ id={fieldState.fieldId}
+ {placeholder}
+ />
+
+ {/if}
+
+
+
diff --git a/packages/client/src/components/app/forms/LongFormField.svelte b/packages/client/src/components/app/forms/LongFormField.svelte
index 81ad42bbcb..a58e1fe76c 100644
--- a/packages/client/src/components/app/forms/LongFormField.svelte
+++ b/packages/client/src/components/app/forms/LongFormField.svelte
@@ -1,6 +1,7 @@
{#if fieldState}
- fieldApi.setValue(e.detail)}
- disabled={fieldState.disabled}
- error={fieldState.error}
- id={fieldState.fieldId}
- {placeholder}
- />
+
+ fieldApi.setValue(e.detail)}
+ disabled={fieldState.disabled}
+ error={fieldState.error}
+ id={fieldState.fieldId}
+ {placeholder}
+ />
+
{/if}
+
+
diff --git a/packages/client/src/components/app/forms/index.js b/packages/client/src/components/app/forms/index.js
index f554f601d4..ab1f7d20ed 100644
--- a/packages/client/src/components/app/forms/index.js
+++ b/packages/client/src/components/app/forms/index.js
@@ -11,3 +11,4 @@ export { default as attachmentfield } from "./AttachmentField.svelte"
export { default as relationshipfield } from "./RelationshipField.svelte"
export { default as passwordfield } from "./PasswordField.svelte"
export { default as formstep } from "./FormStep.svelte"
+export { default as jsonfield } from "./JSONField.svelte"
diff --git a/packages/client/src/components/app/forms/validation.js b/packages/client/src/components/app/forms/validation.js
index f461ab00c0..4e06a640e9 100644
--- a/packages/client/src/components/app/forms/validation.js
+++ b/packages/client/src/components/app/forms/validation.js
@@ -206,6 +206,7 @@ const parseType = (value, type) => {
return value
}
+ // Parse array, treating no elements as null
if (type === FieldTypes.ARRAY) {
if (!Array.isArray(value) || !value.length) {
return null
@@ -213,6 +214,12 @@ const parseType = (value, type) => {
return value
}
+ // For JSON we don't touch the value at all as we want to verify it in its
+ // raw form
+ if (type === FieldTypes.JSON) {
+ return value
+ }
+
// If some unknown type, treat as null to avoid breaking validators
return null
}
@@ -290,6 +297,19 @@ const notContainsHandler = (value, rule) => {
return !containsHandler(value, rule)
}
+// Evaluates a constraint that the value must be a valid json object
+const jsonHandler = value => {
+ if (typeof value !== "object" || Array.isArray(value)) {
+ return false
+ }
+ try {
+ JSON.parse(JSON.stringify(value))
+ return true
+ } catch (error) {
+ return false
+ }
+}
+
/**
* Map of constraint types to handlers.
*/
@@ -306,6 +326,7 @@ const handlerMap = {
notRegex: notRegexHandler,
contains: containsHandler,
notContains: notContainsHandler,
+ json: jsonHandler,
}
/**
diff --git a/packages/client/src/components/app/index.js b/packages/client/src/components/app/index.js
index f5d085e97b..ef0f96ce59 100644
--- a/packages/client/src/components/app/index.js
+++ b/packages/client/src/components/app/index.js
@@ -29,6 +29,7 @@ export { default as backgroundimage } from "./BackgroundImage.svelte"
export { default as daterangepicker } from "./DateRangePicker.svelte"
export { default as cardstat } from "./CardStat.svelte"
export { default as spectrumcard } from "./SpectrumCard.svelte"
+export { default as tag } from "./Tag.svelte"
export * from "./charts"
export * from "./forms"
export * from "./table"
diff --git a/packages/client/src/components/preview/Indicator.svelte b/packages/client/src/components/preview/Indicator.svelte
index b97204abbc..ee969e3395 100644
--- a/packages/client/src/components/preview/Indicator.svelte
+++ b/packages/client/src/components/preview/Indicator.svelte
@@ -24,6 +24,7 @@
class:flipped
class:line
style="top: {top}px; left: {left}px; width: {width}px; height: {height}px; --color: {color}; --zIndex: {zIndex};"
+ class:withText={!!text}
>
{#if text}
@@ -39,12 +40,12 @@
z-index: var(--zIndex);
border: 2px solid var(--color);
pointer-events: none;
- border-top-right-radius: 4px;
- border-top-left-radius: 0;
- border-bottom-left-radius: 4px;
- border-bottom-right-radius: 4px;
+ border-radius: 4px;
}
- .indicator.flipped {
+ .indicator.withText {
+ border-top-left-radius: 0;
+ }
+ .indicator.withText.flipped {
border-top-left-radius: 4px;
}
.indicator.line {
@@ -74,8 +75,7 @@
border-radius: 4px;
}
.text.flipped {
- border-top-left-radius: 4px;
- border-bottom-left-radius: 4px;
+ border-radius: 4px;
transform: translateY(0%);
top: -2px;
}
diff --git a/packages/client/src/constants.js b/packages/client/src/constants.js
index 740f279b36..9d20177b52 100644
--- a/packages/client/src/constants.js
+++ b/packages/client/src/constants.js
@@ -13,6 +13,7 @@ export const FieldTypes = {
ATTACHMENT: "attachment",
LINK: "link",
FORMULA: "formula",
+ JSON: "json",
}
export const UnsortableTypes = [
diff --git a/packages/client/src/stores/dataSource.js b/packages/client/src/stores/dataSource.js
index efec755b99..46ac0b6c86 100644
--- a/packages/client/src/stores/dataSource.js
+++ b/packages/client/src/stores/dataSource.js
@@ -61,7 +61,8 @@ export const createDataSourceStore = () => {
// Emit this as a window event, so parent screens which are iframing us in
// can also invalidate the same datasource
- if (get(routeStore).queryParams?.peek) {
+ const inModal = get(routeStore).queryParams?.peek
+ if (inModal) {
window.parent.postMessage({
type: "invalidate-datasource",
detail: { dataSourceId },
diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js
index 9c6ae73c1f..6b4dd4235a 100644
--- a/packages/client/src/utils/buttonActions.js
+++ b/packages/client/src/utils/buttonActions.js
@@ -8,20 +8,49 @@ import {
} from "stores"
import { saveRow, deleteRow, executeQuery, triggerAutomation } from "api"
import { ActionTypes } from "constants"
+import { enrichDataBindings } from "./enrichDataBinding"
+import { deepSet } from "@budibase/bbui"
const saveRowHandler = async (action, context) => {
const { fields, providerId, tableId } = action.parameters
+ let payload
if (providerId) {
- let draft = context[providerId]
+ payload = { ...context[providerId] }
+ } else {
+ payload = {}
+ }
+ if (fields) {
+ for (let [field, value] of Object.entries(fields)) {
+ deepSet(payload, field, value)
+ }
+ }
+ if (tableId) {
+ payload.tableId = tableId
+ }
+ const row = await saveRow(payload)
+ return {
+ row,
+ }
+}
+
+const duplicateRowHandler = async (action, context) => {
+ const { fields, providerId, tableId } = action.parameters
+ if (providerId) {
+ let payload = { ...context[providerId] }
if (fields) {
for (let [field, value] of Object.entries(fields)) {
- draft[field] = value
+ deepSet(payload, field, value)
}
}
if (tableId) {
- draft.tableId = tableId
+ payload.tableId = tableId
+ }
+ delete payload._id
+ delete payload._rev
+ const row = await saveRow(payload)
+ return {
+ row,
}
- await saveRow(draft)
}
}
@@ -46,11 +75,12 @@ const navigationHandler = action => {
const queryExecutionHandler = async action => {
const { datasourceId, queryId, queryParams } = action.parameters
- await executeQuery({
+ const result = await executeQuery({
datasourceId,
queryId,
parameters: queryParams,
})
+ return { result }
}
const executeActionHandler = async (
@@ -129,6 +159,7 @@ const updateStateHandler = action => {
const handlerMap = {
["Save Row"]: saveRowHandler,
+ ["Duplicate Row"]: duplicateRowHandler,
["Delete Row"]: deleteRowHandler,
["Navigate To"]: navigationHandler,
["Execute Query"]: queryExecutionHandler,
@@ -165,12 +196,27 @@ export const enrichButtonActions = (actions, context) => {
return actions
}
+ // Button context is built up as actions are executed.
+ // Inherit any previous button context which may have come from actions
+ // before a confirmable action since this breaks the chain.
+ let buttonContext = context.actions || []
+
const handlers = actions.map(def => handlerMap[def["##eventHandlerType"]])
return async () => {
for (let i = 0; i < handlers.length; i++) {
try {
- const action = actions[i]
- const callback = async () => handlers[i](action, context)
+ // Skip any non-existent action definitions
+ if (!handlers[i]) {
+ continue
+ }
+
+ // Built total context for this action
+ const totalContext = { ...context, actions: buttonContext }
+
+ // Get and enrich this button action with the total context
+ let action = actions[i]
+ action = enrichDataBindings(action, totalContext)
+ const callback = async () => handlers[i](action, totalContext)
// If this action is confirmable, show confirmation and await a
// callback to execute further actions
@@ -185,7 +231,15 @@ export const enrichButtonActions = (actions, context) => {
// then execute the rest of the actions in the chain
const result = await callback()
if (result !== false) {
- const next = enrichButtonActions(actions.slice(i + 1), context)
+ // Generate a new total context to pass into the next enrichment
+ buttonContext.push(result)
+ const newContext = { ...context, actions: buttonContext }
+
+ // Enrich and call the next button action
+ const next = enrichButtonActions(
+ actions.slice(i + 1),
+ newContext
+ )
await next()
}
}
@@ -201,6 +255,8 @@ export const enrichButtonActions = (actions, context) => {
const result = await callback()
if (result === false) {
return
+ } else {
+ buttonContext.push(result)
}
}
} catch (error) {
diff --git a/packages/client/src/utils/componentProps.js b/packages/client/src/utils/componentProps.js
index d600fdef04..b6b2cf7a99 100644
--- a/packages/client/src/utils/componentProps.js
+++ b/packages/client/src/utils/componentProps.js
@@ -32,35 +32,56 @@ export const enrichProps = (props, context) => {
data: context[context.closestComponentId],
}
- // Enrich all data bindings in top level props
- let enrichedProps = enrichDataBindings(props, totalContext)
-
- // Enrich click actions if they exist
- Object.keys(enrichedProps).forEach(prop => {
+ // We want to exclude any button actions from enrichment at this stage.
+ // Extract top level button action settings.
+ let normalProps = { ...props }
+ let actionProps = {}
+ Object.keys(normalProps).forEach(prop => {
if (prop?.toLowerCase().includes("onclick")) {
- enrichedProps[prop] = enrichButtonActions(
- enrichedProps[prop],
- totalContext
- )
+ actionProps[prop] = normalProps[prop]
+ delete normalProps[prop]
}
})
- // Enrich any click actions in conditions
- if (enrichedProps._conditions) {
- enrichedProps._conditions.forEach(condition => {
- if (condition.setting?.toLowerCase().includes("onclick")) {
- condition.settingValue = enrichButtonActions(
- condition.settingValue,
- totalContext
- )
+ // Handle conditional UI separately after normal settings
+ let conditions = normalProps._conditions
+ delete normalProps._conditions
- // If there is an onclick function in here then it won't be serialised
- // properly, and therefore will not be updated properly.
- // The solution to this is add a rand which will ensure diffs happen
- // every time.
- condition.rand = Math.random()
+ // Enrich all props except button actions
+ let enrichedProps = enrichDataBindings(normalProps, totalContext)
+
+ // Enrich button actions.
+ // Actions are enriched into a function at this stage, but actual data
+ // binding enrichment is done dynamically at runtime.
+ Object.keys(actionProps).forEach(prop => {
+ enrichedProps[prop] = enrichButtonActions(actionProps[prop], totalContext)
+ })
+
+ // Conditions
+ if (conditions?.length) {
+ let enrichedConditions = []
+ conditions.forEach(condition => {
+ if (condition.setting?.toLowerCase().includes("onclick")) {
+ // Copy and remove the setting value from the condition as it needs
+ // enriched separately
+ let toEnrich = { ...condition }
+ delete toEnrich.settingValue
+
+ // Join the condition back together
+ enrichedConditions.push({
+ ...enrichDataBindings(toEnrich, totalContext),
+ settingValue: enrichButtonActions(
+ condition.settingValue,
+ totalContext
+ ),
+ rand: Math.random(),
+ })
+ } else {
+ // Normal condition
+ enrichedConditions.push(enrichDataBindings(condition, totalContext))
}
})
+ enrichedProps._conditions = enrichedConditions
}
return enrichedProps
diff --git a/packages/client/src/utils/schema.js b/packages/client/src/utils/schema.js
index bea1f217b8..7122140744 100644
--- a/packages/client/src/utils/schema.js
+++ b/packages/client/src/utils/schema.js
@@ -1,3 +1,8 @@
+import {
+ convertJSONSchemaToTableSchema,
+ getJSONArrayDatasourceSchema,
+} from "builder/src/builderStore/jsonUtils"
+import { fetchTableDefinition } from "api"
import TableFetch from "./fetch/TableFetch.js"
import ViewFetch from "./fetch/ViewFetch.js"
import QueryFetch from "./fetch/QueryFetch.js"
@@ -7,16 +12,17 @@ import QueryFetch from "./fetch/QueryFetch.js"
*/
export const fetchDatasourceSchema = async datasource => {
const type = datasource?.type
+ let schema
// Nested providers should already have exposed their own schema
if (type === "provider") {
- return datasource.value?.schema
+ schema = datasource.value?.schema
}
// Field sources have their schema statically defined
if (type === "field") {
if (datasource.fieldType === "attachment") {
- return {
+ schema = {
url: {
type: "string",
},
@@ -25,7 +31,7 @@ export const fetchDatasourceSchema = async datasource => {
},
}
} else if (datasource.fieldType === "array") {
- return {
+ schema = {
value: {
type: "string",
},
@@ -33,7 +39,14 @@ export const fetchDatasourceSchema = async datasource => {
}
}
- // All normal datasource schema can use their corresponsing implementations
+ // JSON arrays need their table definitions fetched.
+ // We can then extract their schema as a subset of the table schema.
+ if (type === "jsonarray") {
+ const table = await fetchTableDefinition(datasource.tableId)
+ schema = getJSONArrayDatasourceSchema(table?.schema, datasource)
+ }
+
+ // All normal datasource schema can use their corresponding implementations
// in the data fetch classes
const handler = {
table: TableFetch,
@@ -43,7 +56,27 @@ export const fetchDatasourceSchema = async datasource => {
}[type]
if (handler) {
const definition = await handler.getDefinition(datasource)
- return handler.getSchema(datasource, definition)
+ schema = handler.getSchema(datasource, definition)
+ }
+
+ // Check for any JSON fields so we can add any top level properties
+ if (schema) {
+ let jsonAdditions = {}
+ Object.keys(schema).forEach(fieldKey => {
+ const fieldSchema = schema[fieldKey]
+ if (fieldSchema?.type === "json") {
+ const jsonSchema = convertJSONSchemaToTableSchema(fieldSchema, {
+ squashObjects: true,
+ })
+ Object.keys(jsonSchema).forEach(jsonKey => {
+ jsonAdditions[`${fieldKey}.${jsonKey}`] = {
+ type: jsonSchema[jsonKey].type,
+ nestedJSON: true,
+ }
+ })
+ }
+ })
+ return { ...schema, ...jsonAdditions }
}
return null
diff --git a/packages/client/yarn.lock b/packages/client/yarn.lock
index e57aed8eca..f61cc01f61 100644
--- a/packages/client/yarn.lock
+++ b/packages/client/yarn.lock
@@ -305,6 +305,11 @@
resolved "https://registry.yarnpkg.com/@spectrum-css/tabs/-/tabs-3.1.5.tgz#cc82e69c1fc721902345178231fb95d05938b983"
integrity sha512-UtfW8bA1quYnJM6v/lp6AVYGnQFkiUix2FHAf/4VHVrk4mh7ydtLiXS0IR3Kx+t/S8FWdSdSQHDZ8tHbY1ZLZg==
+"@spectrum-css/tag@^3.1.4":
+ version "3.1.4"
+ resolved "https://registry.yarnpkg.com/@spectrum-css/tag/-/tag-3.1.4.tgz#334384dd789ddf0562679cae62ef763883480ac5"
+ integrity sha512-9dYBMhCEkjy+p75XJIfCA2/zU4JAqsJrL7fkYIDXakS6/BzeVtIvAW/6JaIHtLIA9lrj0Sn4m+ZjceKnZNIv1w==
+
"@spectrum-css/tags@^3.0.2":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@spectrum-css/tags/-/tags-3.0.3.tgz#fc76d2735cdc442de91b7eb3bee49a928c0767ac"
diff --git a/packages/server/package.json b/packages/server/package.json
index 0d429fa3a6..d17cdc6339 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
- "version": "1.0.23",
+ "version": "1.0.27-alpha.1",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@@ -69,9 +69,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
- "@budibase/auth": "^1.0.23",
- "@budibase/client": "^1.0.23",
- "@budibase/string-templates": "^1.0.23",
+ "@apidevtools/swagger-parser": "^10.0.3",
+ "@budibase/auth": "^1.0.27-alpha.1",
+ "@budibase/client": "^1.0.27-alpha.1",
+ "@budibase/string-templates": "^1.0.27-alpha.1",
"@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0",
diff --git a/packages/server/src/api/controllers/row/utils.js b/packages/server/src/api/controllers/row/utils.js
index f7a4b13304..71b22375f7 100644
--- a/packages/server/src/api/controllers/row/utils.js
+++ b/packages/server/src/api/controllers/row/utils.js
@@ -50,10 +50,10 @@ exports.validate = async ({ appId, tableId, row, table }) => {
const errors = {}
for (let fieldName of Object.keys(table.schema)) {
const constraints = cloneDeep(table.schema[fieldName].constraints)
+ const type = table.schema[fieldName].type
// special case for options, need to always allow unselected (null)
if (
- table.schema[fieldName].type ===
- (FieldTypes.OPTIONS || FieldTypes.ARRAY) &&
+ (type === FieldTypes.OPTIONS || type === FieldTypes.ARRAY) &&
constraints.inclusion
) {
constraints.inclusion.push(null)
@@ -61,17 +61,20 @@ exports.validate = async ({ appId, tableId, row, table }) => {
let res
// Validate.js doesn't seem to handle array
- if (
- table.schema[fieldName].type === FieldTypes.ARRAY &&
- row[fieldName] &&
- row[fieldName].length
- ) {
+ if (type === FieldTypes.ARRAY && row[fieldName] && row[fieldName].length) {
row[fieldName].map(val => {
if (!constraints.inclusion.includes(val)) {
errors[fieldName] = "Field not in list"
}
})
- } else if (table.schema[fieldName].type === FieldTypes.FORMULA) {
+ } else if (type === FieldTypes.JSON && typeof row[fieldName] === "string") {
+ // this should only happen if there is an error
+ try {
+ JSON.parse(row[fieldName])
+ } catch (err) {
+ errors[fieldName] = [`Contains invalid JSON`]
+ }
+ } else if (type === FieldTypes.FORMULA) {
res = validateJs.single(
processStringSync(table.schema[fieldName].formula, row),
constraints
diff --git a/packages/server/src/utilities/rowProcessor/index.js b/packages/server/src/utilities/rowProcessor/index.js
index ea63c23f7d..860063f173 100644
--- a/packages/server/src/utilities/rowProcessor/index.js
+++ b/packages/server/src/utilities/rowProcessor/index.js
@@ -81,6 +81,18 @@ const TYPE_TRANSFORM_MAP = {
[FieldTypes.AUTO]: {
parse: () => undefined,
},
+ [FieldTypes.JSON]: {
+ parse: input => {
+ try {
+ if (input === "") {
+ return undefined
+ }
+ return JSON.parse(input)
+ } catch (err) {
+ return input
+ }
+ },
+ },
}
/**
diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock
index 0bf8969806..38d789b893 100644
--- a/packages/server/yarn.lock
+++ b/packages/server/yarn.lock
@@ -27,7 +27,7 @@
resolved "https://registry.yarnpkg.com/@apidevtools/swagger-methods/-/swagger-methods-3.0.2.tgz#b789a362e055b0340d04712eafe7027ddc1ac267"
integrity sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==
-"@apidevtools/swagger-parser@10.0.3":
+"@apidevtools/swagger-parser@10.0.3", "@apidevtools/swagger-parser@^10.0.3":
version "10.0.3"
resolved "https://registry.yarnpkg.com/@apidevtools/swagger-parser/-/swagger-parser-10.0.3.tgz#32057ae99487872c4dd96b314a1ab4b95d89eaf5"
integrity sha512-sNiLY51vZOmSPFZA5TF35KZ2HbgYklQnTSDnkghamzLb3EkNtcQnrBQEj5AOCxHpTtXpqMCRM1CrmV2rG6nw4g==
@@ -983,10 +983,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
-"@budibase/auth@^1.0.23":
- version "1.0.24"
- resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-1.0.24.tgz#69a015a7fe9dcc9ea9e471a7d76d2c0544de0b16"
- integrity sha512-pX+x+ib5X8s9ek4TZVmddRXlCE3kFmK5EH7Qk0Wmcn9tZwbaZy1XXd4qlJ7aFGSmvy1VNbz5AXIyRtliescaEQ==
+"@budibase/auth@^1.0.27-alpha.1":
+ version "1.0.33"
+ resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-1.0.33.tgz#bb0c527ebca852c001c7e163a9cdfce49984adab"
+ integrity sha512-CJcBspSB6B4UwXenGfzCiBh4wWPq9ZrRZm+Dqo774Yw7dfa/hHisfFiRAuz0vHxZl6AStLUsTBNynrzt7bs7Mg==
dependencies:
"@techpass/passport-openidconnect" "^0.3.0"
aws-sdk "^2.901.0"
@@ -1056,10 +1056,10 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
-"@budibase/bbui@^1.0.24":
- version "1.0.24"
- resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.0.24.tgz#15a976b500c4103bc3e94ed665c6c557bb6271bf"
- integrity sha512-4zr+fSChOelHDqNNM2OiWWbWOL57JGBVBx333GiMr2P7N0MoepjwHEp9MlITWl5mUfS8rxgWTC9mSSMpRdpSUQ==
+"@budibase/bbui@^1.0.33":
+ version "1.0.33"
+ resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.0.33.tgz#e815c4883dbc9d28d31900160fc74aafc81d02c1"
+ integrity sha512-2W3Ub8J8brSuhwtXhznszTa54cTyUdDNMFDCnRrHseaDV05XrSykdndXYyWi4XC+FveV82AdvSICxgd6alRGzg==
dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1"
@@ -1106,14 +1106,14 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
-"@budibase/client@^1.0.23":
- version "1.0.24"
- resolved "https://registry.yarnpkg.com/@budibase/client/-/client-1.0.24.tgz#69be5b66cc701c6018c816728975a076230c052a"
- integrity sha512-ppb+exifHCfuDGqs1cQ0kzc3wWaOGkVgq/8Rdb7R7BLIOKYkB67L3FvkqTl+39wrc32CpmzOXXQ73keE4l6P8Q==
+"@budibase/client@^1.0.27-alpha.1":
+ version "1.0.33"
+ resolved "https://registry.yarnpkg.com/@budibase/client/-/client-1.0.33.tgz#715aaaf15f13d9e40960fffea44002e817d8a569"
+ integrity sha512-4+xM/ZTI247JbJc1noQS58VFh8AqfuQK1ZUSZIowuol1TtDu5dLGN7BysUFUe0mJZoDB/L+cB1I//43XqaSWDw==
dependencies:
- "@budibase/bbui" "^1.0.24"
+ "@budibase/bbui" "^1.0.33"
"@budibase/standard-components" "^0.9.139"
- "@budibase/string-templates" "^1.0.24"
+ "@budibase/string-templates" "^1.0.33"
regexparam "^1.3.0"
shortid "^2.2.15"
svelte-spa-router "^3.0.5"
@@ -1163,10 +1163,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
-"@budibase/string-templates@^1.0.23", "@budibase/string-templates@^1.0.24":
- version "1.0.24"
- resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.24.tgz#8f317ff18159d8f8e36179de33252e019c85c267"
- integrity sha512-KAwyYxtm3Mrsm44MhchSxOtB8ucZ2JI93VPBQn0hjdzHtMuAkadtFNPZFeD3pKpCjDmI13XuW+BmJqCF3B0tYg==
+"@budibase/string-templates@^1.0.27-alpha.1", "@budibase/string-templates@^1.0.33":
+ version "1.0.33"
+ resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.33.tgz#7c39f0821d86ca1b26e8d5e7eca4256f24b09de0"
+ integrity sha512-uvDJvVtAaBcMKnVylWlzGk+CzPXH+TIKojGAfgjCqfcBsc9GlyCCBLtANe8osi9Bdr1SsKOW9Fi5u9FTToNMJw==
dependencies:
"@budibase/handlebars-helpers" "^0.11.7"
dayjs "^1.10.4"
@@ -3304,9 +3304,9 @@ aws-sdk@^2.767.0:
xml2js "0.4.19"
aws-sdk@^2.901.0:
- version "2.1046.0"
- resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1046.0.tgz#9147b0fa1c86acbebd1a061e951ab5012f4499d7"
- integrity sha512-ocwHclMXdIA+NWocUyvp9Ild3/zy2vr5mHp3mTyodf0WU5lzBE8PocCVLSWhMAXLxyia83xv2y5f5AzAcetbqA==
+ version "2.1049.0"
+ resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1049.0.tgz#8146dcdf3a1ab603e50ff961169ee8abc537d48e"
+ integrity sha512-+wls9iNlotMeoZepwgR0yPzXsjXzr2ijoi5ERmsPWfMTFMHkm6INndBtSkm6fpu/NZnl+7EaPPES2yhaqnhoJg==
dependencies:
buffer "4.9.2"
events "1.1.1"
diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json
index 7816c22830..d9dd0655bd 100644
--- a/packages/string-templates/package.json
+++ b/packages/string-templates/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
- "version": "1.0.23",
+ "version": "1.0.27-alpha.1",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",
diff --git a/packages/string-templates/src/helpers/javascript.js b/packages/string-templates/src/helpers/javascript.js
index 42e8a1508a..9231283e89 100644
--- a/packages/string-templates/src/helpers/javascript.js
+++ b/packages/string-templates/src/helpers/javascript.js
@@ -1,4 +1,5 @@
const { atob } = require("../utilities")
+const { cloneDeep } = require("lodash/fp")
// The method of executing JS scripts depends on the bundle being built.
// This setter is used in the entrypoint (either index.cjs or index.mjs).
@@ -38,8 +39,12 @@ module.exports.processJS = (handlebars, context) => {
// This is required to allow the final `return` statement to be valid.
const js = `function run(){${atob(handlebars)}};run();`
- // Our $ context function gets a value from context
- const sandboxContext = { $: path => getContextValue(path, context) }
+ // Our $ context function gets a value from context.
+ // We clone the context to avoid mutation in the binding affecting real
+ // app context.
+ const sandboxContext = {
+ $: path => getContextValue(path, cloneDeep(context)),
+ }
// Create a sandbox with out context and run the JS
return runJS(js, sandboxContext)
diff --git a/packages/string-templates/src/index.js b/packages/string-templates/src/index.js
index 2523b763ba..820b8da290 100644
--- a/packages/string-templates/src/index.js
+++ b/packages/string-templates/src/index.js
@@ -1,12 +1,13 @@
const handlebars = require("handlebars")
const { registerAll } = require("./helpers/index")
const processors = require("./processors")
-const { removeHandlebarsStatements, atob, btoa } = require("./utilities")
+const { atob, btoa } = require("./utilities")
const manifest = require("../manifest.json")
const hbsInstance = handlebars.create()
registerAll(hbsInstance)
const hbsInstanceNoHelpers = handlebars.create()
+const defaultOpts = { noHelpers: false }
/**
* utility function to check if the object is valid
@@ -28,11 +29,7 @@ function testObject(object) {
* @param {object} opts optional - specify some options for processing.
* @returns {Promise} The structure input, as fully updated as possible.
*/
-module.exports.processObject = async (
- object,
- context,
- opts = { noHelpers: false }
-) => {
+module.exports.processObject = async (object, context, opts) => {
testObject(object)
for (let key of Object.keys(object || {})) {
if (object[key] != null) {
@@ -63,11 +60,7 @@ module.exports.processObject = async (
* @param {object} opts optional - specify some options for processing.
* @returns {Promise} The enriched string, all templates should have been replaced if they can be.
*/
-module.exports.processString = async (
- string,
- context,
- opts = { noHelpers: false }
-) => {
+module.exports.processString = async (string, context, opts) => {
// TODO: carry out any async calls before carrying out async call
return module.exports.processStringSync(string, context, opts)
}
@@ -81,11 +74,7 @@ module.exports.processString = async (
* @param {object} opts optional - specify some options for processing.
* @returns {object|array} The structure input, as fully updated as possible.
*/
-module.exports.processObjectSync = (
- object,
- context,
- opts = { noHelpers: false }
-) => {
+module.exports.processObjectSync = (object, context, opts) => {
testObject(object)
for (let key of Object.keys(object || {})) {
let val = object[key]
@@ -106,26 +95,20 @@ module.exports.processObjectSync = (
* @param {object} opts optional - specify some options for processing.
* @returns {string} The enriched string, all templates should have been replaced if they can be.
*/
-module.exports.processStringSync = (
- string,
- context,
- opts = { noHelpers: false }
-) => {
- if (!exports.isValid(string)) {
- return string
- }
- // take a copy of input incase error
+module.exports.processStringSync = (string, context, opts) => {
+ opts = { ...defaultOpts, ...opts }
+
+ // take a copy of input in case of error
const input = string
if (typeof string !== "string") {
throw "Cannot process non-string types."
}
try {
- const noHelpers = opts && opts.noHelpers
// finalising adds a helper, can't do this with no helpers
- const shouldFinalise = !noHelpers
+ const shouldFinalise = !opts.noHelpers
string = processors.preprocess(string, shouldFinalise)
// this does not throw an error when template can't be fulfilled, have to try correct beforehand
- const instance = noHelpers ? hbsInstanceNoHelpers : hbsInstance
+ const instance = opts.noHelpers ? hbsInstanceNoHelpers : hbsInstance
const template = instance.compile(string, {
strict: false,
})
@@ -136,7 +119,7 @@ module.exports.processStringSync = (
})
)
} catch (err) {
- return removeHandlebarsStatements(input)
+ return input
}
}
@@ -155,7 +138,8 @@ module.exports.makePropSafe = property => {
* @param opts optional - specify some options for processing.
* @returns {boolean} Whether or not the input string is valid.
*/
-module.exports.isValid = (string, opts = { noHelpers: false }) => {
+module.exports.isValid = (string, opts) => {
+ opts = { ...defaultOpts, ...opts }
const validCases = [
"string",
"number",
@@ -169,7 +153,7 @@ module.exports.isValid = (string, opts = { noHelpers: false }) => {
// don't really need a real context to check if its valid
const context = {}
try {
- const instance = opts && opts.noHelpers ? hbsInstanceNoHelpers : hbsInstance
+ const instance = opts.noHelpers ? hbsInstanceNoHelpers : hbsInstance
instance.compile(processors.preprocess(string, false))(context)
return true
} catch (err) {
diff --git a/packages/string-templates/src/utilities.js b/packages/string-templates/src/utilities.js
index 50d770c6ea..645aca78ba 100644
--- a/packages/string-templates/src/utilities.js
+++ b/packages/string-templates/src/utilities.js
@@ -10,7 +10,10 @@ module.exports.swapStrings = (string, start, length, swap) => {
return string.slice(0, start) + swap + string.slice(start + length)
}
-module.exports.removeHandlebarsStatements = string => {
+module.exports.removeHandlebarsStatements = (
+ string,
+ replacement = "Invalid binding"
+) => {
let regexp = new RegExp(exports.FIND_HBS_REGEX)
let matches = string.match(regexp)
if (matches == null) {
@@ -18,7 +21,7 @@ module.exports.removeHandlebarsStatements = string => {
}
for (let match of matches) {
const idx = string.indexOf(match)
- string = exports.swapStrings(string, idx, match.length, "Invalid Binding")
+ string = exports.swapStrings(string, idx, match.length, replacement)
}
return string
}
diff --git a/packages/string-templates/test/helpers.spec.js b/packages/string-templates/test/helpers.spec.js
index 2cf9310638..b4179475fb 100644
--- a/packages/string-templates/test/helpers.spec.js
+++ b/packages/string-templates/test/helpers.spec.js
@@ -13,10 +13,14 @@ describe("test the custom helpers we have applied", () => {
describe("test that it can run without helpers", () => {
it("should be able to run without helpers", async () => {
- const output = await processString("{{ avg 1 1 1 }}", {}, { noHelpers: true })
+ const output = await processString(
+ "{{ avg 1 1 1 }}",
+ {},
+ { noHelpers: true }
+ )
const valid = await processString("{{ avg 1 1 1 }}", {})
expect(valid).toBe("1")
- expect(output).toBe("Invalid Binding")
+ expect(output).toBe("{{ avg 1 1 1 }}")
})
})
@@ -185,17 +189,22 @@ describe("test the date helpers", () => {
it("should test the timezone capabilities", async () => {
const date = new Date(1611577535000)
- const output = await processString("{{ date time 'HH-mm-ss Z' 'America/New_York' }}", {
- time: date.toUTCString(),
- })
- const formatted = new dayjs(date).tz("America/New_York").format("HH-mm-ss Z")
+ const output = await processString(
+ "{{ date time 'HH-mm-ss Z' 'America/New_York' }}",
+ {
+ time: date.toUTCString(),
+ }
+ )
+ const formatted = new dayjs(date)
+ .tz("America/New_York")
+ .format("HH-mm-ss Z")
expect(output).toBe(formatted)
})
it("should guess the users timezone when not specified", async () => {
const date = new Date()
const output = await processString("{{ date time 'Z' }}", {
- time: date.toUTCString()
+ time: date.toUTCString(),
})
const timezone = dayjs.tz.guess()
const offset = new dayjs(date).tz(timezone).format("Z")
@@ -307,12 +316,12 @@ describe("test the comparison helpers", () => {
describe("Test the object/array helper", () => {
it("should allow plucking from an array of objects", async () => {
const context = {
- items: [
- { price: 20 },
- { price: 30 },
- ]
+ items: [{ price: 20 }, { price: 30 }],
}
- const output = await processString("{{ literal ( sum ( pluck items 'price' ) ) }}", context)
+ const output = await processString(
+ "{{ literal ( sum ( pluck items 'price' ) ) }}",
+ context
+ )
expect(output).toBe(50)
})
@@ -442,15 +451,15 @@ describe("Cover a few complex use cases", () => {
it("should only invalidate a single string in an object", async () => {
const input = {
- dataProvider:"{{ literal [c670254c9e74e40518ee5becff53aa5be] }}",
- theme:"spectrum--lightest",
- showAutoColumns:false,
- quiet:true,
- size:"spectrum--medium",
- rowCount:8,
+ dataProvider: "{{ literal [c670254c9e74e40518ee5becff53aa5be] }}",
+ theme: "spectrum--lightest",
+ showAutoColumns: false,
+ quiet: true,
+ size: "spectrum--medium",
+ rowCount: 8,
}
const output = await processObject(input, tableJson)
- expect(output.dataProvider).not.toBe("Invalid Binding")
+ expect(output.dataProvider).not.toBe("Invalid binding")
})
it("should be able to handle external ids", async () => {
diff --git a/packages/worker/package.json b/packages/worker/package.json
index 86b4841af5..18cf155259 100644
--- a/packages/worker/package.json
+++ b/packages/worker/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
- "version": "1.0.23",
+ "version": "1.0.27-alpha.1",
"description": "Budibase background service",
"main": "src/index.js",
"repository": {
@@ -29,8 +29,8 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
- "@budibase/auth": "^1.0.23",
- "@budibase/string-templates": "^1.0.23",
+ "@budibase/auth": "^1.0.27-alpha.1",
+ "@budibase/string-templates": "^1.0.27-alpha.1",
"@koa/router": "^8.0.0",
"@sentry/node": "^6.0.0",
"@techpass/passport-openidconnect": "^0.3.0",
diff --git a/packages/worker/src/api/routes/tests/email.spec.js b/packages/worker/src/api/routes/tests/email.spec.js
index c8c93658f7..a66857249a 100644
--- a/packages/worker/src/api/routes/tests/email.spec.js
+++ b/packages/worker/src/api/routes/tests/email.spec.js
@@ -8,7 +8,7 @@ jest.mock("nodemailer")
const nodemailer = require("nodemailer")
nodemailer.createTransport.mockReturnValue({
sendMail: sendMailMock,
- verify: jest.fn()
+ verify: jest.fn(),
})
describe("/api/global/email", () => {
@@ -39,6 +39,6 @@ describe("/api/global/email", () => {
expect(sendMailMock).toHaveBeenCalled()
const emailCall = sendMailMock.mock.calls[0][0]
expect(emailCall.subject).toBe("Hello!")
- expect(emailCall.html).not.toContain("Invalid Binding")
+ expect(emailCall.html).not.toContain("Invalid binding")
})
-})
\ No newline at end of file
+})