Merge branch 'feature/audit-logs' of github.com:Budibase/budibase into feature/audit-logs
This commit is contained in:
commit
00388c4b04
|
@ -55,7 +55,7 @@ http {
|
|||
set $csp_style "style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.googleapis.com https://rsms.me https://maxcdn.bootstrapcdn.com";
|
||||
set $csp_object "object-src 'none'";
|
||||
set $csp_base_uri "base-uri 'self'";
|
||||
set $csp_connect "connect-src 'self' https://*.budibase.net https://api-iam.intercom.io https://api-iam.intercom.io https://api-ping.intercom.io https://app.posthog.com wss://nexus-websocket-a.intercom.io wss://nexus-websocket-b.intercom.io https://nexus-websocket-a.intercom.io https://nexus-websocket-b.intercom.io https://uploads.intercomcdn.com https://uploads.intercomusercontent.com https://*.s3.amazonaws.com https://*.s3.us-east-2.amazonaws.com https://*.s3.us-east-1.amazonaws.com https://*.s3.us-west-1.amazonaws.com https://*.s3.us-west-2.amazonaws.com https://*.s3.af-south-1.amazonaws.com https://*.s3.ap-east-1.amazonaws.com https://*.s3.ap-southeast-3.amazonaws.com https://*.s3.ap-south-1.amazonaws.com https://*.s3.ap-northeast-3.amazonaws.com https://*.s3.ap-northeast-2.amazonaws.com https://*.s3.ap-southeast-1.amazonaws.com https://*.s3.ap-southeast-2.amazonaws.com https://*.s3.ap-northeast-1.amazonaws.com https://*.s3.ca-central-1.amazonaws.com https://*.s3.cn-north-1.amazonaws.com https://*.s3.cn-northwest-1.amazonaws.com https://*.s3.eu-central-1.amazonaws.com https://*.s3.eu-west-1.amazonaws.com https://*.s3.eu-west-2.amazonaws.com https://*.s3.eu-south-1.amazonaws.com https://*.s3.eu-west-3.amazonaws.com https://*.s3.eu-north-1.amazonaws.com https://*.s3.sa-east-1.amazonaws.com https://*.s3.me-south-1.amazonaws.com https://*.s3.us-gov-east-1.amazonaws.com https://*.s3.us-gov-west-1.amazonaws.com";
|
||||
set $csp_connect "connect-src 'self' https://*.budibase.net https://api-iam.intercom.io https://api-iam.intercom.io https://api-ping.intercom.io https://app.posthog.com wss://nexus-websocket-a.intercom.io wss://nexus-websocket-b.intercom.io https://nexus-websocket-a.intercom.io https://nexus-websocket-b.intercom.io https://uploads.intercomcdn.com https://uploads.intercomusercontent.com https://*.s3.amazonaws.com https://*.s3.us-east-2.amazonaws.com https://*.s3.us-east-1.amazonaws.com https://*.s3.us-west-1.amazonaws.com https://*.s3.us-west-2.amazonaws.com https://*.s3.af-south-1.amazonaws.com https://*.s3.ap-east-1.amazonaws.com https://*.s3.ap-southeast-3.amazonaws.com https://*.s3.ap-south-1.amazonaws.com https://*.s3.ap-northeast-3.amazonaws.com https://*.s3.ap-northeast-2.amazonaws.com https://*.s3.ap-southeast-1.amazonaws.com https://*.s3.ap-southeast-2.amazonaws.com https://*.s3.ap-northeast-1.amazonaws.com https://*.s3.ca-central-1.amazonaws.com https://*.s3.cn-north-1.amazonaws.com https://*.s3.cn-northwest-1.amazonaws.com https://*.s3.eu-central-1.amazonaws.com https://*.s3.eu-west-1.amazonaws.com https://*.s3.eu-west-2.amazonaws.com https://*.s3.eu-south-1.amazonaws.com https://*.s3.eu-west-3.amazonaws.com https://*.s3.eu-north-1.amazonaws.com https://*.s3.sa-east-1.amazonaws.com https://*.s3.me-south-1.amazonaws.com https://*.s3.us-gov-east-1.amazonaws.com https://*.s3.us-gov-west-1.amazonaws.com https://api.github.com";
|
||||
set $csp_font "font-src 'self' data: https://cdn.jsdelivr.net https://fonts.gstatic.com https://rsms.me https://maxcdn.bootstrapcdn.com https://js.intercomcdn.com https://fonts.intercomcdn.com";
|
||||
set $csp_frame "frame-src 'self' https:";
|
||||
set $csp_img "img-src http: https: data: blob:";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/backend-core",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Budibase backend core libraries used in server and worker",
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
|
@ -24,7 +24,7 @@
|
|||
"dependencies": {
|
||||
"@budibase/nano": "10.1.1",
|
||||
"@budibase/pouchdb-replication-stream": "1.2.10",
|
||||
"@budibase/types": "2.3.2-alpha.3",
|
||||
"@budibase/types": "2.3.11-alpha.0",
|
||||
"@shopify/jest-koa-mocks": "5.0.1",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
"aws-cloudfront-sign": "2.2.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/bbui",
|
||||
"description": "A UI solution used in the different Budibase projects.",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"module": "dist/bbui.es.js",
|
||||
|
@ -38,7 +38,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@adobe/spectrum-css-workflow-icons": "1.2.1",
|
||||
"@budibase/string-templates": "2.3.2-alpha.3",
|
||||
"@budibase/string-templates": "2.3.11-alpha.0",
|
||||
"@spectrum-css/accordion": "3.0.24",
|
||||
"@spectrum-css/actionbutton": "1.0.1",
|
||||
"@spectrum-css/actiongroup": "1.0.1",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { createEventDispatcher, onMount } from "svelte"
|
||||
import FancyField from "./FancyField.svelte"
|
||||
import FancyFieldLabel from "./FancyFieldLabel.svelte"
|
||||
import { fade } from "svelte/transition"
|
||||
|
@ -14,8 +14,11 @@
|
|||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let ref
|
||||
let focused = false
|
||||
$: placeholder = !focused && !value
|
||||
let autofilled = false
|
||||
|
||||
$: placeholder = !autofilled && !focused && !value
|
||||
|
||||
const onChange = e => {
|
||||
const newValue = e.target.value
|
||||
|
@ -25,6 +28,27 @@
|
|||
error = validate(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
// Start watching for autofill every 100ms
|
||||
const interval = setInterval(() => {
|
||||
autofilled = ref?.matches(":-webkit-autofill")
|
||||
if (autofilled) {
|
||||
clearInterval(interval)
|
||||
}
|
||||
}, 100)
|
||||
|
||||
// Give up after 2 seconds and assume autofill has not been used
|
||||
const timeout = setTimeout(() => {
|
||||
clearInterval(interval)
|
||||
}, 2000)
|
||||
|
||||
// Cleanup
|
||||
return () => {
|
||||
clearInterval(interval)
|
||||
clearTimeout(timeout)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<FancyField {error} {value} {validate} {disabled} {focused}>
|
||||
|
@ -39,6 +63,7 @@
|
|||
on:focus={() => (focused = true)}
|
||||
on:blur={() => (focused = false)}
|
||||
class:placeholder
|
||||
bind:this={ref}
|
||||
/>
|
||||
{#if suffix && !placeholder}
|
||||
<div in:fade|local={{ duration: 130 }} class="suffix">{suffix}</div>
|
||||
|
@ -74,4 +99,11 @@
|
|||
line-height: 17px;
|
||||
font-family: var(--font-sans);
|
||||
}
|
||||
input:-webkit-autofill {
|
||||
border-radius: 2px;
|
||||
-webkit-box-shadow: 0 0 0 100px var(--spectrum-global-color-gray-300) inset;
|
||||
-webkit-text-fill-color: var(--spectrum-global-color-gray-900);
|
||||
transition: -webkit-box-shadow 130ms 200ms, background-color 0s 86400s;
|
||||
padding: 3px 8px 4px 8px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
export let quiet = false
|
||||
export let align
|
||||
export let autofocus = false
|
||||
export let autocomplete = null
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
|
@ -103,6 +104,7 @@
|
|||
class="spectrum-Textfield-input"
|
||||
style={align ? `text-align: ${align};` : ""}
|
||||
inputmode={type === "number" ? "decimal" : "text"}
|
||||
{autocomplete}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
export let updateOnChange = true
|
||||
export let quiet = false
|
||||
export let autofocus
|
||||
export let autocomplete
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const onChange = e => {
|
||||
|
@ -33,6 +34,7 @@
|
|||
{type}
|
||||
{quiet}
|
||||
{autofocus}
|
||||
{autocomplete}
|
||||
on:change={onChange}
|
||||
on:click
|
||||
on:input
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/builder",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"license": "GPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
@ -58,10 +58,10 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "2.3.2-alpha.3",
|
||||
"@budibase/client": "2.3.2-alpha.3",
|
||||
"@budibase/frontend-core": "2.3.2-alpha.3",
|
||||
"@budibase/string-templates": "2.3.2-alpha.3",
|
||||
"@budibase/bbui": "2.3.11-alpha.0",
|
||||
"@budibase/client": "2.3.11-alpha.0",
|
||||
"@budibase/frontend-core": "2.3.11-alpha.0",
|
||||
"@budibase/string-templates": "2.3.11-alpha.0",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.2.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
||||
|
|
|
@ -75,16 +75,20 @@
|
|||
editableColumn.constraints.presence = { allowEmpty: false }
|
||||
}
|
||||
|
||||
$: if (field && !savingColumn) {
|
||||
editableColumn = cloneDeep(field)
|
||||
originalName = editableColumn.name ? editableColumn.name + "" : null
|
||||
linkEditDisabled = originalName != null
|
||||
isCreating = originalName == null
|
||||
primaryDisplay =
|
||||
$tables.selected.primaryDisplay == null ||
|
||||
$tables.selected.primaryDisplay === editableColumn.name
|
||||
const initialiseField = (field, savingColumn) => {
|
||||
if (field && !savingColumn) {
|
||||
editableColumn = cloneDeep(field)
|
||||
originalName = editableColumn.name ? editableColumn.name + "" : null
|
||||
linkEditDisabled = originalName != null
|
||||
isCreating = originalName == null
|
||||
primaryDisplay =
|
||||
$tables.selected.primaryDisplay == null ||
|
||||
$tables.selected.primaryDisplay === editableColumn.name
|
||||
}
|
||||
}
|
||||
|
||||
$: initialiseField(field, savingColumn)
|
||||
|
||||
$: checkConstraints(editableColumn)
|
||||
$: required = !!editableColumn?.constraints?.presence || primaryDisplay
|
||||
$: uneditable =
|
||||
|
@ -583,7 +587,12 @@
|
|||
title="Formula"
|
||||
label="Formula"
|
||||
value={editableColumn.formula}
|
||||
on:change={e => (editableColumn.formula = e.detail)}
|
||||
on:change={e => {
|
||||
editableColumn = {
|
||||
...editableColumn,
|
||||
formula: e.detail,
|
||||
}
|
||||
}}
|
||||
bindings={getBindings({ table })}
|
||||
allowJS
|
||||
/>
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
}
|
||||
}}
|
||||
value={productionValue}
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -83,6 +84,7 @@
|
|||
disabled={useProductionValue}
|
||||
label="Value"
|
||||
value={useProductionValue ? productionValue : developmentValue}
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
<Checkbox bind:value={useProductionValue} text="Use production value" />
|
||||
</div>
|
||||
|
|
|
@ -62,6 +62,7 @@ const getTours = () => {
|
|||
id: TOUR_STEP_KEYS.BUILDER_APP_PUBLISH,
|
||||
title: "Publish",
|
||||
layout: OnboardingPublish,
|
||||
route: "/builder/app/:application/design",
|
||||
query: ".toprightnav #builder-app-publish-button",
|
||||
onLoad: () => {
|
||||
tourEvent(TOUR_STEP_KEYS.BUILDER_APP_PUBLISH)
|
||||
|
|
|
@ -147,8 +147,8 @@
|
|||
options: setting.options || [],
|
||||
|
||||
// Number fields
|
||||
min: setting.min || null,
|
||||
max: setting.max || null,
|
||||
min: setting.min ?? null,
|
||||
max: setting.max ?? null,
|
||||
}}
|
||||
{bindings}
|
||||
{componentBindings}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/cli",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||
"main": "src/index.js",
|
||||
"bin": {
|
||||
|
@ -26,9 +26,9 @@
|
|||
"outputPath": "build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "2.3.2-alpha.3",
|
||||
"@budibase/string-templates": "2.3.2-alpha.3",
|
||||
"@budibase/types": "2.3.2-alpha.3",
|
||||
"@budibase/backend-core": "2.3.11-alpha.0",
|
||||
"@budibase/string-templates": "2.3.11-alpha.0",
|
||||
"@budibase/types": "2.3.11-alpha.0",
|
||||
"axios": "0.21.2",
|
||||
"chalk": "4.1.0",
|
||||
"cli-progress": "3.11.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/client",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"license": "MPL-2.0",
|
||||
"module": "dist/budibase-client.js",
|
||||
"main": "dist/budibase-client.js",
|
||||
|
@ -19,9 +19,9 @@
|
|||
"dev:builder": "rollup -cw"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "2.3.2-alpha.3",
|
||||
"@budibase/frontend-core": "2.3.2-alpha.3",
|
||||
"@budibase/string-templates": "2.3.2-alpha.3",
|
||||
"@budibase/bbui": "2.3.11-alpha.0",
|
||||
"@budibase/frontend-core": "2.3.11-alpha.0",
|
||||
"@budibase/string-templates": "2.3.11-alpha.0",
|
||||
"@spectrum-css/button": "^3.0.3",
|
||||
"@spectrum-css/card": "^3.0.3",
|
||||
"@spectrum-css/divider": "^1.0.3",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@budibase/frontend-core",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Budibase frontend core libraries used in builder and client",
|
||||
"author": "Budibase",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "2.3.2-alpha.3",
|
||||
"@budibase/bbui": "2.3.11-alpha.0",
|
||||
"lodash": "^4.17.21",
|
||||
"svelte": "^3.46.2"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/sdk",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Budibase Public API SDK",
|
||||
"author": "Budibase",
|
||||
"license": "MPL-2.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/server",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Budibase Web Server",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -43,11 +43,11 @@
|
|||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@apidevtools/swagger-parser": "10.0.3",
|
||||
"@budibase/backend-core": "2.3.2-alpha.3",
|
||||
"@budibase/client": "2.3.2-alpha.3",
|
||||
"@budibase/pro": "2.3.2-alpha.3",
|
||||
"@budibase/string-templates": "2.3.2-alpha.3",
|
||||
"@budibase/types": "2.3.2-alpha.3",
|
||||
"@budibase/backend-core": "2.3.11-alpha.0",
|
||||
"@budibase/client": "2.3.11-alpha.0",
|
||||
"@budibase/pro": "2.3.11-alpha.0",
|
||||
"@budibase/string-templates": "2.3.11-alpha.0",
|
||||
"@budibase/types": "2.3.11-alpha.0",
|
||||
"@bull-board/api": "3.7.0",
|
||||
"@bull-board/koa": "3.9.4",
|
||||
"@elastic/elasticsearch": "7.10.0",
|
||||
|
|
|
@ -191,7 +191,7 @@ export async function validate(ctx: BBContext) {
|
|||
}
|
||||
|
||||
export async function exportRows(ctx: BBContext) {
|
||||
const { datasourceId } = breakExternalTableId(ctx.params.tableId)
|
||||
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId)
|
||||
const format = ctx.query.format
|
||||
const { columns } = ctx.request.body
|
||||
const datasource = await sdk.datasources.get(datasourceId!)
|
||||
|
@ -227,7 +227,9 @@ export async function exportRows(ctx: BBContext) {
|
|||
rows = result.rows
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
if (!tableName) {
|
||||
ctx.throw(400, "Could not find table name.")
|
||||
}
|
||||
let schema = datasource.entities[tableName].schema
|
||||
let exportRows = cleanExportRows(rows, schema, format, columns)
|
||||
|
||||
|
|
|
@ -104,7 +104,6 @@ export function importToRows(data: any, table: any, user: any = {}) {
|
|||
const processed: any = inputProcessing(user, table, row, {
|
||||
noAutoRelationships: true,
|
||||
})
|
||||
table = processed.table
|
||||
row = processed.row
|
||||
|
||||
let fieldName: any
|
||||
|
@ -113,6 +112,7 @@ export function importToRows(data: any, table: any, user: any = {}) {
|
|||
// check whether the options need to be updated for inclusion as part of the data import
|
||||
if (
|
||||
schema.type === FieldTypes.OPTIONS &&
|
||||
row[fieldName] &&
|
||||
(!schema.constraints.inclusion ||
|
||||
schema.constraints.inclusion.indexOf(row[fieldName]) === -1)
|
||||
) {
|
||||
|
@ -120,6 +120,7 @@ export function importToRows(data: any, table: any, user: any = {}) {
|
|||
...schema.constraints.inclusion,
|
||||
row[fieldName],
|
||||
]
|
||||
schema.constraints.inclusion.sort()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { roles } = require("@budibase/backend-core")
|
||||
const { roles, utils } = require("@budibase/backend-core")
|
||||
const { checkPermissionsEndpoint } = require("./utilities/TestFunctions")
|
||||
const setup = require("./utilities")
|
||||
const { BUILTIN_ROLE_IDS } = roles
|
||||
|
@ -28,8 +28,8 @@ describe("/users", () => {
|
|||
|
||||
describe("fetch", () => {
|
||||
it("returns a list of users from an instance db", async () => {
|
||||
await config.createUser("uuidx")
|
||||
await config.createUser("uuidy")
|
||||
await config.createUser({ id: "uuidx" })
|
||||
await config.createUser({ id: "uuidy" })
|
||||
const res = await request
|
||||
.get(`/api/users/metadata`)
|
||||
.set(config.defaultHeaders())
|
||||
|
@ -56,7 +56,7 @@ describe("/users", () => {
|
|||
|
||||
describe("update", () => {
|
||||
it("should be able to update the user", async () => {
|
||||
const user = await config.createUser()
|
||||
const user = await config.createUser({ id: `us_update${Math.random()}` })
|
||||
user.roleId = BUILTIN_ROLE_IDS.BASIC
|
||||
const res = await request
|
||||
.put(`/api/users/metadata`)
|
||||
|
@ -180,14 +180,11 @@ describe("/users", () => {
|
|||
const app1 = await config.createApp('App 1')
|
||||
const app2 = await config.createApp('App 2')
|
||||
|
||||
let user = await config.createUser(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
true,
|
||||
{ [app1.appId]: 'ADMIN' })
|
||||
let user = await config.createUser({
|
||||
builder: false,
|
||||
admin: true,
|
||||
roles: { [app1.appId]: 'ADMIN' }
|
||||
})
|
||||
let res = await request
|
||||
.post(`/api/users/metadata/sync/${user._id}`)
|
||||
.set(config.defaultHeaders())
|
||||
|
|
|
@ -67,6 +67,15 @@ if (
|
|||
INTEGRATIONS[SourceName.ORACLE] = oracle.integration
|
||||
}
|
||||
|
||||
export async function getDefinition(source: SourceName): Promise<Integration> {
|
||||
// check if its integrated, faster
|
||||
if (DEFINITIONS[source]) {
|
||||
return DEFINITIONS[source]
|
||||
}
|
||||
const allDefinitions = await getDefinitions()
|
||||
return allDefinitions[source]
|
||||
}
|
||||
|
||||
export async function getDefinitions() {
|
||||
const pluginSchemas: { [key: string]: Integration } = {}
|
||||
if (env.SELF_HOSTED) {
|
||||
|
|
|
@ -26,7 +26,7 @@ interface MSSQLConfig {
|
|||
user: string
|
||||
password: string
|
||||
server: string
|
||||
port: number
|
||||
port: number | string
|
||||
database: string
|
||||
schema: string
|
||||
encrypt?: boolean
|
||||
|
|
|
@ -93,24 +93,16 @@ describe("migrations", () => {
|
|||
await clearMigrations()
|
||||
const appId = config.prodAppId
|
||||
const roles = { [appId]: "role_12345" }
|
||||
await config.createUser(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
true,
|
||||
roles
|
||||
) // admin only
|
||||
await config.createUser(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
roles
|
||||
) // non admin non builder
|
||||
await config.createUser({
|
||||
builder: false,
|
||||
admin: true,
|
||||
roles,
|
||||
}) // admin only
|
||||
await config.createUser({
|
||||
builder: false,
|
||||
admin: false,
|
||||
roles,
|
||||
}) // non admin non builder
|
||||
await config.createTable()
|
||||
await config.createRow()
|
||||
await config.createRow()
|
||||
|
|
|
@ -3,6 +3,7 @@ import { findHBSBlocks, processObjectSync } from "@budibase/string-templates"
|
|||
import {
|
||||
Datasource,
|
||||
DatasourceFieldType,
|
||||
Integration,
|
||||
PASSWORD_REPLACEMENT,
|
||||
RestAuthConfig,
|
||||
RestAuthType,
|
||||
|
@ -11,16 +12,38 @@ import {
|
|||
} from "@budibase/types"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import { getEnvironmentVariables } from "../../utils"
|
||||
import { getDefinitions } from "../../../integrations"
|
||||
import { getDefinitions, getDefinition } from "../../../integrations"
|
||||
|
||||
const ENV_VAR_PREFIX = "env."
|
||||
|
||||
export function checkDatasourceTypes(schema: Integration, config: any) {
|
||||
for (let key of Object.keys(config)) {
|
||||
if (!schema.datasource[key]) {
|
||||
continue
|
||||
}
|
||||
const type = schema.datasource[key].type
|
||||
if (
|
||||
type === DatasourceFieldType.NUMBER &&
|
||||
typeof config[key] === "string"
|
||||
) {
|
||||
config[key] = parseFloat(config[key])
|
||||
}
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
async function enrichDatasourceWithValues(datasource: Datasource) {
|
||||
const cloned = cloneDeep(datasource)
|
||||
const env = await getEnvironmentVariables()
|
||||
const processed = processObjectSync(cloned, { env }, { onlyFound: true })
|
||||
const processed = processObjectSync(
|
||||
cloned,
|
||||
{ env },
|
||||
{ onlyFound: true }
|
||||
) as Datasource
|
||||
const definition = await getDefinition(processed.source)
|
||||
processed.config = checkDatasourceTypes(definition, processed.config)
|
||||
return {
|
||||
datasource: processed as Datasource,
|
||||
datasource: processed,
|
||||
envVars: env as Record<string, string>,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,14 +275,24 @@ class TestConfiguration {
|
|||
}
|
||||
|
||||
async createUser(
|
||||
id = null,
|
||||
firstName = this.defaultUserValues.firstName,
|
||||
lastName = this.defaultUserValues.lastName,
|
||||
email = this.defaultUserValues.email,
|
||||
builder = true,
|
||||
admin = false,
|
||||
roles = {}
|
||||
user: {
|
||||
id?: string
|
||||
firstName?: string
|
||||
lastName?: string
|
||||
email?: string
|
||||
builder?: boolean
|
||||
admin?: boolean
|
||||
roles?: any
|
||||
} = {}
|
||||
) {
|
||||
let { id, firstName, lastName, email, builder, admin, roles } = user
|
||||
firstName = firstName || this.defaultUserValues.firstName
|
||||
lastName = lastName || this.defaultUserValues.lastName
|
||||
email = email || this.defaultUserValues.email
|
||||
roles = roles || {}
|
||||
if (builder == null) {
|
||||
builder = true
|
||||
}
|
||||
const globalId = !id ? `us_${Math.random()}` : `us_${id}`
|
||||
const resp = await this.globalUser({
|
||||
id: globalId,
|
||||
|
|
|
@ -464,13 +464,17 @@ export function execute(job: Job, callback: WorkerCallback) {
|
|||
throw new Error("Unable to execute, event doesn't contain app ID.")
|
||||
}
|
||||
return context.doInAppContext(appId, async () => {
|
||||
const automationOrchestrator = new Orchestrator(job)
|
||||
try {
|
||||
const response = await automationOrchestrator.execute()
|
||||
callback(null, response)
|
||||
} catch (err) {
|
||||
callback(err)
|
||||
}
|
||||
const envVars = await sdkUtils.getEnvironmentVariables()
|
||||
// put into automation thread for whole context
|
||||
await context.doInEnvironmentContext(envVars, async () => {
|
||||
const automationOrchestrator = new Orchestrator(job)
|
||||
try {
|
||||
const response = await automationOrchestrator.execute()
|
||||
callback(null, response)
|
||||
} catch (err) {
|
||||
callback(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -480,11 +484,7 @@ export const removeStalled = async (job: Job) => {
|
|||
throw new Error("Unable to execute, event doesn't contain app ID.")
|
||||
}
|
||||
await context.doInAppContext(appId, async () => {
|
||||
const envVars = await sdkUtils.getEnvironmentVariables()
|
||||
// put into automation thread for whole context
|
||||
await context.doInEnvironmentContext(envVars, async () => {
|
||||
const automationOrchestrator = new Orchestrator(job)
|
||||
await automationOrchestrator.stopCron("stalled")
|
||||
})
|
||||
const automationOrchestrator = new Orchestrator(job)
|
||||
await automationOrchestrator.stopCron("stalled")
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1278,14 +1278,14 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@budibase/backend-core@2.3.2-alpha.3":
|
||||
version "2.3.2-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.3.2-alpha.3.tgz#798782018e5e4e1076d56bfc50cec01f48d73f5c"
|
||||
integrity sha512-S5yXD8YWSrxGv89Z4y3dYnbRTUZFlNVXuE6rtin4JesORi6TmverZ0DmerxD6+bTm57WraaQ+UBIKXgug3fZ+g==
|
||||
"@budibase/backend-core@2.3.11-alpha.0":
|
||||
version "2.3.11-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.3.11-alpha.0.tgz#361e30139a1a26d023902c6bdb4fdcac2610b69f"
|
||||
integrity sha512-hlaeTkYsSJJYIwwqL3LJ7Pxzq0tOgSjQ38+nFiBPIzjkDSaV0UPwi0rZAZq/kPvaT7AKdTEcf8tn1wiui/VkYA==
|
||||
dependencies:
|
||||
"@budibase/nano" "10.1.1"
|
||||
"@budibase/pouchdb-replication-stream" "1.2.10"
|
||||
"@budibase/types" "2.3.2-alpha.3"
|
||||
"@budibase/types" "2.3.11-alpha.0"
|
||||
"@shopify/jest-koa-mocks" "5.0.1"
|
||||
"@techpass/passport-openidconnect" "0.3.2"
|
||||
aws-cloudfront-sign "2.2.0"
|
||||
|
@ -1392,13 +1392,13 @@
|
|||
pouchdb-promise "^6.0.4"
|
||||
through2 "^2.0.0"
|
||||
|
||||
"@budibase/pro@2.3.2-alpha.3":
|
||||
version "2.3.2-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.3.2-alpha.3.tgz#e16d60721aab59f226fcbc69d749a52875357345"
|
||||
integrity sha512-/AyS3WtzTyXYAxuzSkRHS8PWSH9Ug/e3iXN4TcawZXOnYYh6UatLQBvds13IZNtCppqx/Gicaq21Jo9939oGcQ==
|
||||
"@budibase/pro@2.3.11-alpha.0":
|
||||
version "2.3.11-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.3.11-alpha.0.tgz#b59edba2c04e2a490f3d9246cd328d8dd3213295"
|
||||
integrity sha512-z7tLgRKYKm1psNZGdRErQT8tV+vSj9hXJkD/H/uFxsJ3IQkjWbcFP5FUBPads5RnvCtqOfYu8OpRHCJfNNBoCA==
|
||||
dependencies:
|
||||
"@budibase/backend-core" "2.3.2-alpha.3"
|
||||
"@budibase/types" "2.3.2-alpha.3"
|
||||
"@budibase/backend-core" "2.3.11-alpha.0"
|
||||
"@budibase/types" "2.3.11-alpha.0"
|
||||
"@koa/router" "8.0.8"
|
||||
bull "4.10.1"
|
||||
joi "17.6.0"
|
||||
|
@ -1424,10 +1424,10 @@
|
|||
svelte-apexcharts "^1.0.2"
|
||||
svelte-flatpickr "^3.1.0"
|
||||
|
||||
"@budibase/types@2.3.2-alpha.3":
|
||||
version "2.3.2-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.3.2-alpha.3.tgz#619c31f355786bdccc1553bcacd6274518ab9435"
|
||||
integrity sha512-eA0NdLEpE/2QwMPoP16bpyN7mqw85YxRzNYmjoqsiSNrQmuFc3uA1XuDoxRYB2f6WCEh0VaOXzYaOQvGctzDvw==
|
||||
"@budibase/types@2.3.11-alpha.0":
|
||||
version "2.3.11-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.3.11-alpha.0.tgz#55cdcef6fb30c79e9d7d90ae8789e4f0cc6a2b63"
|
||||
integrity sha512-SFW9vManFRJ45bgMW7wkDiNxiQQfAME8HOmSqCHKDC0OPzsDydygIl7BNeF/domFvCXxDD3NPu7HC2JXMlV6cw==
|
||||
|
||||
"@bull-board/api@3.7.0":
|
||||
version "3.7.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/string-templates",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Handlebars wrapper for Budibase templating.",
|
||||
"main": "src/index.cjs",
|
||||
"module": "dist/bundle.mjs",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/types",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Budibase types",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/worker",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "2.3.2-alpha.3",
|
||||
"version": "2.3.11-alpha.0",
|
||||
"description": "Budibase background service",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -36,10 +36,10 @@
|
|||
"author": "Budibase",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "2.3.2-alpha.3",
|
||||
"@budibase/pro": "2.3.2-alpha.3",
|
||||
"@budibase/string-templates": "2.3.2-alpha.3",
|
||||
"@budibase/types": "2.3.2-alpha.3",
|
||||
"@budibase/backend-core": "2.3.11-alpha.0",
|
||||
"@budibase/pro": "2.3.11-alpha.0",
|
||||
"@budibase/string-templates": "2.3.11-alpha.0",
|
||||
"@budibase/types": "2.3.11-alpha.0",
|
||||
"@koa/router": "8.0.8",
|
||||
"@sentry/node": "6.17.7",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
|
|
|
@ -475,14 +475,14 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@budibase/backend-core@2.3.2-alpha.3":
|
||||
version "2.3.2-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.3.2-alpha.3.tgz#798782018e5e4e1076d56bfc50cec01f48d73f5c"
|
||||
integrity sha512-S5yXD8YWSrxGv89Z4y3dYnbRTUZFlNVXuE6rtin4JesORi6TmverZ0DmerxD6+bTm57WraaQ+UBIKXgug3fZ+g==
|
||||
"@budibase/backend-core@2.3.11-alpha.0":
|
||||
version "2.3.11-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.3.11-alpha.0.tgz#361e30139a1a26d023902c6bdb4fdcac2610b69f"
|
||||
integrity sha512-hlaeTkYsSJJYIwwqL3LJ7Pxzq0tOgSjQ38+nFiBPIzjkDSaV0UPwi0rZAZq/kPvaT7AKdTEcf8tn1wiui/VkYA==
|
||||
dependencies:
|
||||
"@budibase/nano" "10.1.1"
|
||||
"@budibase/pouchdb-replication-stream" "1.2.10"
|
||||
"@budibase/types" "2.3.2-alpha.3"
|
||||
"@budibase/types" "2.3.11-alpha.0"
|
||||
"@shopify/jest-koa-mocks" "5.0.1"
|
||||
"@techpass/passport-openidconnect" "0.3.2"
|
||||
aws-cloudfront-sign "2.2.0"
|
||||
|
@ -539,13 +539,13 @@
|
|||
pouchdb-promise "^6.0.4"
|
||||
through2 "^2.0.0"
|
||||
|
||||
"@budibase/pro@2.3.2-alpha.3":
|
||||
version "2.3.2-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.3.2-alpha.3.tgz#e16d60721aab59f226fcbc69d749a52875357345"
|
||||
integrity sha512-/AyS3WtzTyXYAxuzSkRHS8PWSH9Ug/e3iXN4TcawZXOnYYh6UatLQBvds13IZNtCppqx/Gicaq21Jo9939oGcQ==
|
||||
"@budibase/pro@2.3.11-alpha.0":
|
||||
version "2.3.11-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.3.11-alpha.0.tgz#b59edba2c04e2a490f3d9246cd328d8dd3213295"
|
||||
integrity sha512-z7tLgRKYKm1psNZGdRErQT8tV+vSj9hXJkD/H/uFxsJ3IQkjWbcFP5FUBPads5RnvCtqOfYu8OpRHCJfNNBoCA==
|
||||
dependencies:
|
||||
"@budibase/backend-core" "2.3.2-alpha.3"
|
||||
"@budibase/types" "2.3.2-alpha.3"
|
||||
"@budibase/backend-core" "2.3.11-alpha.0"
|
||||
"@budibase/types" "2.3.11-alpha.0"
|
||||
"@koa/router" "8.0.8"
|
||||
bull "4.10.1"
|
||||
joi "17.6.0"
|
||||
|
@ -553,10 +553,10 @@
|
|||
lru-cache "^7.14.1"
|
||||
node-fetch "^2.6.1"
|
||||
|
||||
"@budibase/types@2.3.2-alpha.3":
|
||||
version "2.3.2-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.3.2-alpha.3.tgz#619c31f355786bdccc1553bcacd6274518ab9435"
|
||||
integrity sha512-eA0NdLEpE/2QwMPoP16bpyN7mqw85YxRzNYmjoqsiSNrQmuFc3uA1XuDoxRYB2f6WCEh0VaOXzYaOQvGctzDvw==
|
||||
"@budibase/types@2.3.11-alpha.0":
|
||||
version "2.3.11-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.3.11-alpha.0.tgz#55cdcef6fb30c79e9d7d90ae8789e4f0cc6a2b63"
|
||||
integrity sha512-SFW9vManFRJ45bgMW7wkDiNxiQQfAME8HOmSqCHKDC0OPzsDydygIl7BNeF/domFvCXxDD3NPu7HC2JXMlV6cw==
|
||||
|
||||
"@cspotcode/source-map-support@^0.8.0":
|
||||
version "0.8.1"
|
||||
|
|
Loading…
Reference in New Issue