Merge branch 'master' of github.com:budibase/budibase into sql-security
This commit is contained in:
commit
00bdd6fc00
|
@ -10,6 +10,7 @@ import {
|
||||||
DatabaseQueryOpts,
|
DatabaseQueryOpts,
|
||||||
DBError,
|
DBError,
|
||||||
Document,
|
Document,
|
||||||
|
FeatureFlag,
|
||||||
isDocument,
|
isDocument,
|
||||||
RowResponse,
|
RowResponse,
|
||||||
RowValue,
|
RowValue,
|
||||||
|
@ -456,7 +457,7 @@ export class DatabaseImpl implements Database {
|
||||||
|
|
||||||
async destroy() {
|
async destroy() {
|
||||||
if (
|
if (
|
||||||
(await flags.isEnabled("SQS")) &&
|
(await flags.isEnabled(FeatureFlag.SQS)) &&
|
||||||
(await this.exists(SQLITE_DESIGN_DOC_ID))
|
(await this.exists(SQLITE_DESIGN_DOC_ID))
|
||||||
) {
|
) {
|
||||||
// delete the design document, then run the cleanup operation
|
// delete the design document, then run the cleanup operation
|
||||||
|
|
|
@ -267,12 +267,13 @@ export class FlagSet<V extends Flag<any>, T extends { [key: string]: V }> {
|
||||||
// All of the machinery in this file is to make sure that flags have their
|
// All of the machinery in this file is to make sure that flags have their
|
||||||
// default values set correctly and their types flow through the system.
|
// default values set correctly and their types flow through the system.
|
||||||
export const flags = new FlagSet({
|
export const flags = new FlagSet({
|
||||||
DEFAULT_VALUES: Flag.boolean(env.isDev()),
|
[FeatureFlag.DEFAULT_VALUES]: Flag.boolean(env.isDev()),
|
||||||
AUTOMATION_BRANCHING: Flag.boolean(env.isDev()),
|
[FeatureFlag.AUTOMATION_BRANCHING]: Flag.boolean(env.isDev()),
|
||||||
SQS: Flag.boolean(true),
|
[FeatureFlag.SQS]: Flag.boolean(true),
|
||||||
[FeatureFlag.AI_CUSTOM_CONFIGS]: Flag.boolean(env.isDev()),
|
[FeatureFlag.AI_CUSTOM_CONFIGS]: Flag.boolean(env.isDev()),
|
||||||
[FeatureFlag.ENRICHED_RELATIONSHIPS]: Flag.boolean(env.isDev()),
|
[FeatureFlag.ENRICHED_RELATIONSHIPS]: Flag.boolean(env.isDev()),
|
||||||
[FeatureFlag.TABLES_DEFAULT_ADMIN]: Flag.boolean(env.isDev()),
|
[FeatureFlag.TABLES_DEFAULT_ADMIN]: Flag.boolean(env.isDev()),
|
||||||
|
[FeatureFlag.BUDIBASE_AI]: Flag.boolean(env.isDev()),
|
||||||
})
|
})
|
||||||
|
|
||||||
type UnwrapPromise<T> = T extends Promise<infer U> ? U : T
|
type UnwrapPromise<T> = T extends Promise<infer U> ? U : T
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{
|
{
|
||||||
"name": "Layout",
|
"name": "Layout",
|
||||||
"icon": "ClassicGridView",
|
"icon": "ClassicGridView",
|
||||||
"children": ["container", "section", "sidepanel", "modal"]
|
"children": ["container", "sidepanel", "modal"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Data",
|
"name": "Data",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
import Placeholder from "./Placeholder.svelte"
|
import Placeholder from "../Placeholder.svelte"
|
||||||
|
|
||||||
const { styleable, builderStore } = getContext("sdk")
|
const { styleable, builderStore } = getContext("sdk")
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext, setContext } from "svelte"
|
import { getContext, setContext } from "svelte"
|
||||||
import Section from "../Section.svelte"
|
import Section from "../deprecated/Section.svelte"
|
||||||
|
|
||||||
export let labelPosition = "above"
|
export let labelPosition = "above"
|
||||||
export let type = "oneColumn"
|
export let type = "oneColumn"
|
||||||
|
|
|
@ -14,7 +14,6 @@ export { default as Placeholder } from "./Placeholder.svelte"
|
||||||
|
|
||||||
// User facing components
|
// User facing components
|
||||||
export { default as container } from "./container/Container.svelte"
|
export { default as container } from "./container/Container.svelte"
|
||||||
export { default as section } from "./Section.svelte"
|
|
||||||
export { default as dataprovider } from "./DataProvider.svelte"
|
export { default as dataprovider } from "./DataProvider.svelte"
|
||||||
export { default as divider } from "./Divider.svelte"
|
export { default as divider } from "./Divider.svelte"
|
||||||
export { default as screenslot } from "./ScreenSlot.svelte"
|
export { default as screenslot } from "./ScreenSlot.svelte"
|
||||||
|
@ -50,3 +49,4 @@ export { default as navigation } from "./deprecated/Navigation.svelte"
|
||||||
export { default as cardhorizontal } from "./deprecated/CardHorizontal.svelte"
|
export { default as cardhorizontal } from "./deprecated/CardHorizontal.svelte"
|
||||||
export { default as stackedlist } from "./deprecated/StackedList.svelte"
|
export { default as stackedlist } from "./deprecated/StackedList.svelte"
|
||||||
export { default as card } from "./deprecated/Card.svelte"
|
export { default as card } from "./deprecated/Card.svelte"
|
||||||
|
export { default as section } from "./deprecated/Section.svelte"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit fc4c7f4925139af078480217965c3d6338dc0a7f
|
Subproject commit 297fdc937e9c650b4964fc1a942b60022b195865
|
|
@ -1,34 +1,35 @@
|
||||||
import { parse, isSchema, isRows } from "../../../utilities/schema"
|
import { isRows, isSchema, parse } from "../../../utilities/schema"
|
||||||
import { getRowParams, generateRowID, InternalTables } from "../../../db/utils"
|
import { generateRowID, getRowParams, InternalTables } from "../../../db/utils"
|
||||||
import isEqual from "lodash/isEqual"
|
import isEqual from "lodash/isEqual"
|
||||||
import {
|
import {
|
||||||
GOOGLE_SHEETS_PRIMARY_KEY,
|
|
||||||
USERS_TABLE_SCHEMA,
|
|
||||||
SwitchableTypes,
|
|
||||||
CanSwitchTypes,
|
CanSwitchTypes,
|
||||||
|
GOOGLE_SHEETS_PRIMARY_KEY,
|
||||||
|
SwitchableTypes,
|
||||||
|
USERS_TABLE_SCHEMA,
|
||||||
} from "../../../constants"
|
} from "../../../constants"
|
||||||
import {
|
import {
|
||||||
inputProcessing,
|
|
||||||
AttachmentCleanup,
|
AttachmentCleanup,
|
||||||
|
inputProcessing,
|
||||||
} from "../../../utilities/rowProcessor"
|
} from "../../../utilities/rowProcessor"
|
||||||
import { getViews, saveView } from "../view/utils"
|
import { getViews, saveView } from "../view/utils"
|
||||||
import viewTemplate from "../view/viewBuilder"
|
import viewTemplate from "../view/viewBuilder"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import { quotas } from "@budibase/pro"
|
import { quotas } from "@budibase/pro"
|
||||||
import { events, context, features } from "@budibase/backend-core"
|
import { context, events, features } from "@budibase/backend-core"
|
||||||
import {
|
import {
|
||||||
AutoFieldSubType,
|
AutoFieldSubType,
|
||||||
|
Database,
|
||||||
Datasource,
|
Datasource,
|
||||||
|
FeatureFlag,
|
||||||
|
FieldSchema,
|
||||||
|
FieldType,
|
||||||
|
NumberFieldMetadata,
|
||||||
|
RelationshipFieldMetadata,
|
||||||
|
RenameColumn,
|
||||||
Row,
|
Row,
|
||||||
SourceName,
|
SourceName,
|
||||||
Table,
|
Table,
|
||||||
Database,
|
|
||||||
RenameColumn,
|
|
||||||
NumberFieldMetadata,
|
|
||||||
FieldSchema,
|
|
||||||
View,
|
View,
|
||||||
RelationshipFieldMetadata,
|
|
||||||
FieldType,
|
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import sdk from "../../../sdk"
|
import sdk from "../../../sdk"
|
||||||
import env from "../../../environment"
|
import env from "../../../environment"
|
||||||
|
@ -329,7 +330,7 @@ class TableSaveFunctions {
|
||||||
importRows: this.importRows,
|
importRows: this.importRows,
|
||||||
userId: this.userId,
|
userId: this.userId,
|
||||||
})
|
})
|
||||||
if (await features.flags.isEnabled("SQS")) {
|
if (await features.flags.isEnabled(FeatureFlag.SQS)) {
|
||||||
await sdk.tables.sqs.addTable(table)
|
await sdk.tables.sqs.addTable(table)
|
||||||
}
|
}
|
||||||
return table
|
return table
|
||||||
|
@ -523,7 +524,7 @@ export async function internalTableCleanup(table: Table, rows?: Row[]) {
|
||||||
if (rows) {
|
if (rows) {
|
||||||
await AttachmentCleanup.tableDelete(table, rows)
|
await AttachmentCleanup.tableDelete(table, rows)
|
||||||
}
|
}
|
||||||
if (await features.flags.isEnabled("SQS")) {
|
if (await features.flags.isEnabled(FeatureFlag.SQS)) {
|
||||||
await sdk.tables.sqs.removeTable(table)
|
await sdk.tables.sqs.removeTable(table)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import {
|
||||||
Hosting,
|
Hosting,
|
||||||
ActionImplementation,
|
ActionImplementation,
|
||||||
AutomationStepDefinition,
|
AutomationStepDefinition,
|
||||||
|
FeatureFlag,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import sdk from "../sdk"
|
import sdk from "../sdk"
|
||||||
import { getAutomationPlugin } from "../utilities/fileSystem"
|
import { getAutomationPlugin } from "../utilities/fileSystem"
|
||||||
|
@ -100,7 +101,7 @@ if (env.SELF_HOSTED) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getActionDefinitions() {
|
export async function getActionDefinitions() {
|
||||||
if (await features.flags.isEnabled("AUTOMATION_BRANCHING")) {
|
if (await features.flags.isEnabled(FeatureFlag.AUTOMATION_BRANCHING)) {
|
||||||
BUILTIN_ACTION_DEFINITIONS["BRANCH"] = branch.definition
|
BUILTIN_ACTION_DEFINITIONS["BRANCH"] = branch.definition
|
||||||
}
|
}
|
||||||
const actionDefinitions = BUILTIN_ACTION_DEFINITIONS
|
const actionDefinitions = BUILTIN_ACTION_DEFINITIONS
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
EmptyFilterOption,
|
EmptyFilterOption,
|
||||||
|
FeatureFlag,
|
||||||
LegacyFilter,
|
LegacyFilter,
|
||||||
LogicalOperator,
|
LogicalOperator,
|
||||||
Row,
|
Row,
|
||||||
|
@ -101,7 +102,7 @@ export async function search(
|
||||||
viewQuery = checkFilters(table, viewQuery)
|
viewQuery = checkFilters(table, viewQuery)
|
||||||
delete viewQuery?.onEmptyFilter
|
delete viewQuery?.onEmptyFilter
|
||||||
|
|
||||||
const sqsEnabled = await features.flags.isEnabled("SQS")
|
const sqsEnabled = await features.flags.isEnabled(FeatureFlag.SQS)
|
||||||
const supportsLogicalOperators =
|
const supportsLogicalOperators =
|
||||||
isExternalTableID(view.tableId) || sqsEnabled
|
isExternalTableID(view.tableId) || sqsEnabled
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ export async function search(
|
||||||
if (isExternalTable) {
|
if (isExternalTable) {
|
||||||
span?.addTags({ searchType: "external" })
|
span?.addTags({ searchType: "external" })
|
||||||
result = await external.search(options, source)
|
result = await external.search(options, source)
|
||||||
} else if (await features.flags.isEnabled("SQS")) {
|
} else if (await features.flags.isEnabled(FeatureFlag.SQS)) {
|
||||||
span?.addTags({ searchType: "sqs" })
|
span?.addTags({ searchType: "sqs" })
|
||||||
result = await internal.sqs.search(options, source)
|
result = await internal.sqs.search(options, source)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
TableResponse,
|
TableResponse,
|
||||||
TableSourceType,
|
TableSourceType,
|
||||||
TableViewsResponse,
|
TableViewsResponse,
|
||||||
|
FeatureFlag,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import datasources from "../datasources"
|
import datasources from "../datasources"
|
||||||
import sdk from "../../../sdk"
|
import sdk from "../../../sdk"
|
||||||
|
@ -39,7 +40,7 @@ export async function processTable(table: Table): Promise<Table> {
|
||||||
sourceId: table.sourceId || INTERNAL_TABLE_SOURCE_ID,
|
sourceId: table.sourceId || INTERNAL_TABLE_SOURCE_ID,
|
||||||
sourceType: TableSourceType.INTERNAL,
|
sourceType: TableSourceType.INTERNAL,
|
||||||
}
|
}
|
||||||
const sqsEnabled = await features.flags.isEnabled("SQS")
|
const sqsEnabled = await features.flags.isEnabled(FeatureFlag.SQS)
|
||||||
if (sqsEnabled) {
|
if (sqsEnabled) {
|
||||||
processed.sql = true
|
processed.sql = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {
|
||||||
Table,
|
Table,
|
||||||
User,
|
User,
|
||||||
ViewV2,
|
ViewV2,
|
||||||
|
FeatureFlag,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import {
|
import {
|
||||||
|
@ -417,7 +418,7 @@ export async function coreOutputProcessing(
|
||||||
|
|
||||||
// remove null properties to match internal API
|
// remove null properties to match internal API
|
||||||
const isExternal = isExternalTableID(table._id!)
|
const isExternal = isExternalTableID(table._id!)
|
||||||
if (isExternal || (await features.flags.isEnabled("SQS"))) {
|
if (isExternal || (await features.flags.isEnabled(FeatureFlag.SQS))) {
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
for (const key of Object.keys(row)) {
|
for (const key of Object.keys(row)) {
|
||||||
if (row[key] === null) {
|
if (row[key] === null) {
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
export enum FeatureFlag {
|
export enum FeatureFlag {
|
||||||
PER_CREATOR_PER_USER_PRICE = "PER_CREATOR_PER_USER_PRICE",
|
PER_CREATOR_PER_USER_PRICE = "PER_CREATOR_PER_USER_PRICE",
|
||||||
PER_CREATOR_PER_USER_PRICE_ALERT = "PER_CREATOR_PER_USER_PRICE_ALERT",
|
PER_CREATOR_PER_USER_PRICE_ALERT = "PER_CREATOR_PER_USER_PRICE_ALERT",
|
||||||
|
AUTOMATION_BRANCHING = "AUTOMATION_BRANCHING",
|
||||||
|
SQS = "SQS",
|
||||||
AI_CUSTOM_CONFIGS = "AI_CUSTOM_CONFIGS",
|
AI_CUSTOM_CONFIGS = "AI_CUSTOM_CONFIGS",
|
||||||
|
DEFAULT_VALUES = "DEFAULT_VALUES",
|
||||||
ENRICHED_RELATIONSHIPS = "ENRICHED_RELATIONSHIPS",
|
ENRICHED_RELATIONSHIPS = "ENRICHED_RELATIONSHIPS",
|
||||||
TABLES_DEFAULT_ADMIN = "TABLES_DEFAULT_ADMIN",
|
TABLES_DEFAULT_ADMIN = "TABLES_DEFAULT_ADMIN",
|
||||||
|
BUDIBASE_AI = "BUDIBASE_AI",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TenantFeatureFlags {
|
export interface TenantFeatureFlags {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Ctx, MaintenanceType } from "@budibase/types"
|
import { Ctx, MaintenanceType, FeatureFlag } from "@budibase/types"
|
||||||
import env from "../../../environment"
|
import env from "../../../environment"
|
||||||
import { env as coreEnv, db as dbCore, features } from "@budibase/backend-core"
|
import { env as coreEnv, db as dbCore, features } from "@budibase/backend-core"
|
||||||
import nodeFetch from "node-fetch"
|
import nodeFetch from "node-fetch"
|
||||||
|
@ -29,7 +29,10 @@ async function isSqsAvailable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function isSqsMissing() {
|
async function isSqsMissing() {
|
||||||
return (await features.flags.isEnabled("SQS")) && !(await isSqsAvailable())
|
return (
|
||||||
|
(await features.flags.isEnabled(FeatureFlag.SQS)) &&
|
||||||
|
!(await isSqsAvailable())
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetch = async (ctx: Ctx) => {
|
export const fetch = async (ctx: Ctx) => {
|
||||||
|
|
Loading…
Reference in New Issue