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