Updates to fix build.
This commit is contained in:
parent
6ac4669f0a
commit
ce1b626f68
|
@ -6,7 +6,7 @@ import {
|
|||
context,
|
||||
} from "@budibase/backend-core"
|
||||
import TestConfig from "../../tests/utilities/TestConfiguration"
|
||||
import structures from "../../tests/utilities/structures"
|
||||
import * as structures from "../../tests/utilities/structures"
|
||||
import { MIGRATIONS } from "../"
|
||||
import * as helpers from "./helpers"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ const controllers = require("./controllers")
|
|||
const supertest = require("supertest")
|
||||
const { cleanup } = require("../../utilities/fileSystem")
|
||||
const newid = require("../../db/newid")
|
||||
const { DocumentType, generateUserMetadataID } = require("../../db/utils")
|
||||
const { generateUserMetadataID } = require("../../db/utils")
|
||||
const { startup } = require("../../startup")
|
||||
|
||||
const GLOBAL_USER_ID = "us_uuid1"
|
||||
|
@ -360,7 +360,7 @@ class TestConfiguration {
|
|||
|
||||
return context.doInAppContext(prodAppId, async () => {
|
||||
const db = context.getProdAppDB()
|
||||
return await db.get(DocumentType.APP_METADATA)
|
||||
return await db.get(dbCore.DocumentType.APP_METADATA)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
module.exports = {
|
||||
table: require("../../api/controllers/table"),
|
||||
row: require("../../api/controllers/row"),
|
||||
role: require("../../api/controllers/role"),
|
||||
perms: require("../../api/controllers/permission"),
|
||||
view: require("../../api/controllers/view"),
|
||||
app: require("../../api/controllers/application"),
|
||||
user: require("../../api/controllers/user"),
|
||||
automation: require("../../api/controllers/automation"),
|
||||
datasource: require("../../api/controllers/datasource"),
|
||||
query: require("../../api/controllers/query"),
|
||||
screen: require("../../api/controllers/screen"),
|
||||
webhook: require("../../api/controllers/webhook"),
|
||||
layout: require("../../api/controllers/layout"),
|
||||
deploy: require("../../api/controllers/deploy"),
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
export * as table from "../../api/controllers/table"
|
||||
export * as row from "../../api/controllers/row"
|
||||
export * as role from "../../api/controllers/role"
|
||||
export * as perms from "../../api/controllers/permission"
|
||||
export * as view from "../../api/controllers/view"
|
||||
export * as app from "../../api/controllers/application"
|
||||
export * as user from "../../api/controllers/user"
|
||||
export * as automation from "../../api/controllers/automation"
|
||||
export * as datasource from "../../api/controllers/datasource"
|
||||
export * as query from "../../api/controllers/query"
|
||||
export * as screen from "../../api/controllers/screen"
|
||||
export * as webhook from "../../api/controllers/webhook"
|
||||
export * as layout from "../../api/controllers/layout"
|
||||
export * as deploy from "../../api/controllers/deploy"
|
|
@ -1,5 +1,5 @@
|
|||
exports.makePartial = obj => {
|
||||
const newObj = {}
|
||||
export function makePartial(obj: any) {
|
||||
const newObj: any = {}
|
||||
for (let key of Object.keys(obj)) {
|
||||
if (typeof obj[key] === "object") {
|
||||
newObj[key] = exports.makePartial(obj[key])
|
|
@ -1,13 +1,13 @@
|
|||
const { roles, permissions } = require("@budibase/backend-core")
|
||||
const { createHomeScreen } = require("../../constants/screens")
|
||||
const { EMPTY_LAYOUT } = require("../../constants/layouts")
|
||||
const { cloneDeep } = require("lodash/fp")
|
||||
import { roles, permissions } from "@budibase/backend-core"
|
||||
import { createHomeScreen } from "../../constants/screens"
|
||||
import { EMPTY_LAYOUT } from "../../constants/layouts"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import { TRIGGER_DEFINITIONS, ACTION_DEFINITIONS } from "../../automations"
|
||||
const { v4: uuidv4 } = require("uuid")
|
||||
const { TRIGGER_DEFINITIONS, ACTION_DEFINITIONS } = require("../../automations")
|
||||
|
||||
exports.TENANT_ID = "default"
|
||||
export const TENANT_ID = "default"
|
||||
|
||||
exports.basicTable = () => {
|
||||
export function basicTable() {
|
||||
return {
|
||||
name: "TestTable",
|
||||
type: "table",
|
||||
|
@ -29,16 +29,16 @@ exports.basicTable = () => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.basicView = tableId => {
|
||||
export function basicView(tableId: string) {
|
||||
return {
|
||||
tableId,
|
||||
name: "ViewTest",
|
||||
}
|
||||
}
|
||||
|
||||
exports.filterView = tableId => {
|
||||
export function filterView(tableId: string) {
|
||||
return {
|
||||
...this.basicView(tableId),
|
||||
...basicView(tableId),
|
||||
filters: [
|
||||
{
|
||||
value: 0,
|
||||
|
@ -49,56 +49,58 @@ exports.filterView = tableId => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.calculationView = tableId => {
|
||||
export function calculationView(tableId: string) {
|
||||
return {
|
||||
...this.basicView(tableId),
|
||||
...basicView(tableId),
|
||||
field: "count",
|
||||
calculation: "sum",
|
||||
}
|
||||
}
|
||||
|
||||
exports.view = tableId => {
|
||||
export function view(tableId: string) {
|
||||
return {
|
||||
...this.filterView(tableId),
|
||||
...this.calculationView(tableId),
|
||||
...filterView(tableId),
|
||||
...calculationView(tableId),
|
||||
}
|
||||
}
|
||||
|
||||
exports.automationStep = (actionDefinition = ACTION_DEFINITIONS.CREATE_ROW) => {
|
||||
export function automationStep(
|
||||
actionDefinition = ACTION_DEFINITIONS.CREATE_ROW
|
||||
) {
|
||||
return {
|
||||
id: uuidv4(),
|
||||
...actionDefinition,
|
||||
}
|
||||
}
|
||||
|
||||
exports.automationTrigger = (
|
||||
export function automationTrigger(
|
||||
triggerDefinition = TRIGGER_DEFINITIONS.ROW_SAVED
|
||||
) => {
|
||||
) {
|
||||
return {
|
||||
id: uuidv4(),
|
||||
...triggerDefinition,
|
||||
}
|
||||
}
|
||||
|
||||
exports.newAutomation = ({ steps, trigger } = {}) => {
|
||||
const automation = exports.basicAutomation()
|
||||
export function newAutomation({ steps, trigger }: any = {}) {
|
||||
const automation: any = basicAutomation()
|
||||
|
||||
if (trigger) {
|
||||
automation.definition.trigger = trigger
|
||||
} else {
|
||||
automation.definition.trigger = exports.automationTrigger()
|
||||
automation.definition.trigger = automationTrigger()
|
||||
}
|
||||
|
||||
if (steps) {
|
||||
automation.definition.steps = steps
|
||||
} else {
|
||||
automation.definition.steps = [exports.automationStep()]
|
||||
automation.definition.steps = [automationStep()]
|
||||
}
|
||||
|
||||
return automation
|
||||
}
|
||||
|
||||
exports.basicAutomation = () => {
|
||||
export function basicAutomation() {
|
||||
return {
|
||||
name: "My Automation",
|
||||
screenId: "kasdkfldsafkl",
|
||||
|
@ -114,7 +116,7 @@ exports.basicAutomation = () => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.basicRow = tableId => {
|
||||
export function basicRow(tableId: string) {
|
||||
return {
|
||||
name: "Test Contact",
|
||||
description: "original description",
|
||||
|
@ -122,15 +124,19 @@ exports.basicRow = tableId => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.basicLinkedRow = (tableId, linkedRowId, linkField = "link") => {
|
||||
export function basicLinkedRow(
|
||||
tableId: string,
|
||||
linkedRowId: string,
|
||||
linkField: string = "link"
|
||||
) {
|
||||
// this is based on the basic linked tables you get from the test configuration
|
||||
return {
|
||||
...exports.basicRow(tableId),
|
||||
...basicRow(tableId),
|
||||
[linkField]: [linkedRowId],
|
||||
}
|
||||
}
|
||||
|
||||
exports.basicRole = () => {
|
||||
export function basicRole() {
|
||||
return {
|
||||
name: "NewRole",
|
||||
inherits: roles.BUILTIN_ROLE_IDS.BASIC,
|
||||
|
@ -138,7 +144,7 @@ exports.basicRole = () => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.basicDatasource = () => {
|
||||
export function basicDatasource() {
|
||||
return {
|
||||
datasource: {
|
||||
type: "datasource",
|
||||
|
@ -149,7 +155,7 @@ exports.basicDatasource = () => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.basicQuery = datasourceId => {
|
||||
export function basicQuery(datasourceId: string) {
|
||||
return {
|
||||
datasourceId: datasourceId,
|
||||
name: "New Query",
|
||||
|
@ -160,7 +166,7 @@ exports.basicQuery = datasourceId => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.basicUser = role => {
|
||||
export function basicUser(role: string) {
|
||||
return {
|
||||
email: "bill@bill.com",
|
||||
password: "yeeooo",
|
||||
|
@ -168,15 +174,15 @@ exports.basicUser = role => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.basicScreen = () => {
|
||||
export function basicScreen() {
|
||||
return createHomeScreen()
|
||||
}
|
||||
|
||||
exports.basicLayout = () => {
|
||||
export function basicLayout() {
|
||||
return cloneDeep(EMPTY_LAYOUT)
|
||||
}
|
||||
|
||||
exports.basicWebhook = automationId => {
|
||||
export function basicWebhook(automationId: string) {
|
||||
return {
|
||||
live: true,
|
||||
name: "webhook",
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"allowJs": true,
|
||||
"module": "commonjs",
|
||||
"lib": ["es2020"],
|
||||
"strict": true,
|
||||
|
|
Loading…
Reference in New Issue