1
0
Fork 0
mirror of synced 2024-09-05 04:01:48 +12:00

Merge remote-tracking branch 'origin/develop' into feature/qr-barcode-reader

This commit is contained in:
Dean 2022-10-12 09:12:09 +01:00
commit f5edeb5ddc
22 changed files with 281 additions and 68 deletions

View file

@ -1,5 +1,5 @@
{
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"npmClient": "yarn",
"packages": [
"packages/*"

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -20,7 +20,7 @@
"test:watch": "jest --watchAll"
},
"dependencies": {
"@budibase/types": "2.0.24-alpha.3",
"@budibase/types": "2.0.24-alpha.4",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"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.0.24-alpha.3",
"@budibase/string-templates": "2.0.24-alpha.4",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -71,10 +71,10 @@
}
},
"dependencies": {
"@budibase/bbui": "2.0.24-alpha.3",
"@budibase/client": "2.0.24-alpha.3",
"@budibase/frontend-core": "2.0.24-alpha.3",
"@budibase/string-templates": "2.0.24-alpha.3",
"@budibase/bbui": "2.0.24-alpha.4",
"@budibase/client": "2.0.24-alpha.4",
"@budibase/frontend-core": "2.0.24-alpha.4",
"@budibase/string-templates": "2.0.24-alpha.4",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"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.0.24-alpha.3",
"@budibase/string-templates": "2.0.24-alpha.3",
"@budibase/types": "2.0.24-alpha.3",
"@budibase/backend-core": "2.0.24-alpha.4",
"@budibase/string-templates": "2.0.24-alpha.4",
"@budibase/types": "2.0.24-alpha.4",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"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.0.24-alpha.3",
"@budibase/frontend-core": "2.0.24-alpha.3",
"@budibase/string-templates": "2.0.24-alpha.3",
"@budibase/bbui": "2.0.24-alpha.4",
"@budibase/frontend-core": "2.0.24-alpha.4",
"@budibase/string-templates": "2.0.24-alpha.4",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View file

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "2.0.24-alpha.3",
"@budibase/bbui": "2.0.24-alpha.4",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -77,11 +77,11 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.0.24-alpha.3",
"@budibase/client": "2.0.24-alpha.3",
"@budibase/pro": "2.0.24-alpha.3",
"@budibase/string-templates": "2.0.24-alpha.3",
"@budibase/types": "2.0.24-alpha.3",
"@budibase/backend-core": "2.0.24-alpha.4",
"@budibase/client": "2.0.24-alpha.4",
"@budibase/pro": "2.0.24-alpha.4",
"@budibase/string-templates": "2.0.24-alpha.4",
"@budibase/types": "2.0.24-alpha.4",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View file

@ -103,7 +103,7 @@ exports.revert = async ctx => {
target: appId,
})
try {
if (!env.isCypress()) {
if (env.COUCH_DB_URL) {
// in-memory db stalls on rollback
await replication.rollback()
}

View file

@ -18,6 +18,7 @@ import { Table } from "@budibase/types"
import { quotas } from "@budibase/pro"
import { isEqual } from "lodash"
import { cloneDeep } from "lodash/fp"
import env from "../../../environment"
function checkAutoColumns(table: Table, oldTable: Table) {
if (!table.schema) {
@ -167,7 +168,7 @@ export async function destroy(ctx: any) {
await db.remove(tableToDelete)
// remove table search index
if (!isTest()) {
if (!isTest() || env.COUCH_DB_URL) {
const currentIndexes = await db.getIndexes()
const existingIndex = currentIndexes.indexes.find(
(existing: any) => existing.name === `search:${ctx.params.tableId}`

View file

@ -1094,12 +1094,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.0.24-alpha.3":
version "2.0.24-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.24-alpha.3.tgz#49a92082d1ca6bed0eb82519a6c02d7d14ead751"
integrity sha512-Zm/ddRDMzMuXCoEXZa0CzA/B1SnpQ+yjZCNAPH7Y4yYTIKfeE/DQ6COLlUixQxVMAUN1L5+GXML+px6fRigA5w==
"@budibase/backend-core@2.0.24-alpha.4":
version "2.0.24-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.24-alpha.4.tgz#e6ecb50ebf00e4ac263675bafacbd3feb47fabfc"
integrity sha512-d5tRjxllR3PAqk15wGRBag1HXFq5/ZeU6uN0Ohas/z4vGBNevyeTWdqW+bLVo1IBfyj5eLE+xghsjUDlpZsz2w==
dependencies:
"@budibase/types" "2.0.24-alpha.3"
"@budibase/types" "2.0.24-alpha.4"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -1180,13 +1180,13 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
"@budibase/pro@2.0.24-alpha.3":
version "2.0.24-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.24-alpha.3.tgz#16605029663b07d0e3bcf0c08893878b542b6752"
integrity sha512-gBdqJzvtEAMJkhB2YTAyVYKoCANA25F1wT/K7kQtTOy5LrjDmcXah7CZoetfZQGbsKxUYEAZwJzxLSXmIxvWmQ==
"@budibase/pro@2.0.24-alpha.4":
version "2.0.24-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.24-alpha.4.tgz#1bfe333961014cb305580ceb6195b93d7eeec1dc"
integrity sha512-lq2WNl3EpMRV35SJb0jQ1ojeqt02gMVk8GCQ7Qoj276Dstp6XK8nZGQtJQ6vvf4JWgxuC2DX3cctdpWNgoas8w==
dependencies:
"@budibase/backend-core" "2.0.24-alpha.3"
"@budibase/types" "2.0.24-alpha.3"
"@budibase/backend-core" "2.0.24-alpha.4"
"@budibase/types" "2.0.24-alpha.4"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
@ -1209,10 +1209,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/types@2.0.24-alpha.3":
version "2.0.24-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.24-alpha.3.tgz#84eec5f991a2cfaf48d968b07a075b343f847289"
integrity sha512-f9PhtqzmqPI76ITXttuvxsvqMUJtkrDYf/4MHlI2v5ssNL9r0C/hbQEXllff3L3JqViEHWxkKFmfvfnDTV8rRQ==
"@budibase/types@2.0.24-alpha.4":
version "2.0.24-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.24-alpha.4.tgz#1819aeb538bd4fae5e701b1823f86f7071304a24"
integrity sha512-oXxfo1Nkw41LyK6Kb0O0bHt+jZx+kmJX39VZGNej2xts5I0hx/DDZYV8ZSlXNoTQWLBm3ye3XKj/JBge7h8QzA==
"@bull-board/api@3.7.0":
version "3.7.0"

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "2.0.24-alpha.3",
"version": "2.0.24-alpha.4",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "2.0.24-alpha.3",
"@budibase/pro": "2.0.24-alpha.3",
"@budibase/string-templates": "2.0.24-alpha.3",
"@budibase/types": "2.0.24-alpha.3",
"@budibase/backend-core": "2.0.24-alpha.4",
"@budibase/pro": "2.0.24-alpha.4",
"@budibase/string-templates": "2.0.24-alpha.4",
"@budibase/types": "2.0.24-alpha.4",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",

View file

@ -291,12 +291,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.0.24-alpha.3":
version "2.0.24-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.24-alpha.3.tgz#49a92082d1ca6bed0eb82519a6c02d7d14ead751"
integrity sha512-Zm/ddRDMzMuXCoEXZa0CzA/B1SnpQ+yjZCNAPH7Y4yYTIKfeE/DQ6COLlUixQxVMAUN1L5+GXML+px6fRigA5w==
"@budibase/backend-core@2.0.24-alpha.4":
version "2.0.24-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.24-alpha.4.tgz#e6ecb50ebf00e4ac263675bafacbd3feb47fabfc"
integrity sha512-d5tRjxllR3PAqk15wGRBag1HXFq5/ZeU6uN0Ohas/z4vGBNevyeTWdqW+bLVo1IBfyj5eLE+xghsjUDlpZsz2w==
dependencies:
"@budibase/types" "2.0.24-alpha.3"
"@budibase/types" "2.0.24-alpha.4"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -327,21 +327,21 @@
uuid "8.3.2"
zlib "1.0.5"
"@budibase/pro@2.0.24-alpha.3":
version "2.0.24-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.24-alpha.3.tgz#16605029663b07d0e3bcf0c08893878b542b6752"
integrity sha512-gBdqJzvtEAMJkhB2YTAyVYKoCANA25F1wT/K7kQtTOy5LrjDmcXah7CZoetfZQGbsKxUYEAZwJzxLSXmIxvWmQ==
"@budibase/pro@2.0.24-alpha.4":
version "2.0.24-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.24-alpha.4.tgz#1bfe333961014cb305580ceb6195b93d7eeec1dc"
integrity sha512-lq2WNl3EpMRV35SJb0jQ1ojeqt02gMVk8GCQ7Qoj276Dstp6XK8nZGQtJQ6vvf4JWgxuC2DX3cctdpWNgoas8w==
dependencies:
"@budibase/backend-core" "2.0.24-alpha.3"
"@budibase/types" "2.0.24-alpha.3"
"@budibase/backend-core" "2.0.24-alpha.4"
"@budibase/types" "2.0.24-alpha.4"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
"@budibase/types@2.0.24-alpha.3":
version "2.0.24-alpha.3"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.24-alpha.3.tgz#84eec5f991a2cfaf48d968b07a075b343f847289"
integrity sha512-f9PhtqzmqPI76ITXttuvxsvqMUJtkrDYf/4MHlI2v5ssNL9r0C/hbQEXllff3L3JqViEHWxkKFmfvfnDTV8rRQ==
"@budibase/types@2.0.24-alpha.4":
version "2.0.24-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.24-alpha.4.tgz#1819aeb538bd4fae5e701b1823f86f7071304a24"
integrity sha512-oXxfo1Nkw41LyK6Kb0O0bHt+jZx+kmJX39VZGNej2xts5I0hx/DDZYV8ZSlXNoTQWLBm3ye3XKj/JBge7h8QzA==
"@cspotcode/source-map-consumer@0.8.0":
version "0.8.0"

View file

@ -3,6 +3,11 @@ import { App } from "@budibase/types"
import { Response } from "node-fetch"
import InternalAPIClient from "./InternalAPIClient"
import FormData from "form-data"
import { RouteConfig } from "../fixtures/types/routing"
import { AppPackageResponse } from "../fixtures/types/appPackage"
import { DeployConfig } from "../fixtures/types/deploy"
type messageResponse = { message: string }
export default class AppApi {
api: InternalAPIClient
@ -23,13 +28,13 @@ export default class AppApi {
return [response, Object.keys(json.routes).length > 0]
}
async getAppPackage(appId: string): Promise<[Response, any]> {
async getAppPackage(appId: string): Promise<[Response, AppPackageResponse]> {
const response = await this.api.get(`/applications/${appId}/appPackage`)
const json = await response.json()
return [response, json]
}
async publish(): Promise<[Response, string]> {
async publish(): Promise<[Response, DeployConfig]> {
const response = await this.api.post("/deploy")
const json = await response.json()
return [response, json]
@ -46,4 +51,47 @@ export default class AppApi {
const json = await response.json()
return [response, json.data]
}
async sync(appId: string): Promise<[Response, messageResponse]> {
const response = await this.api.post(`/applications/${appId}/sync`)
const json = await response.json()
return [response, json]
}
async updateClient(appId: string, body: any): Promise<[Response, Application]> {
const response = await this.api.put(`/applications/${appId}/client/update`, { body })
const json = await response.json()
return [response, json]
}
async revert(appId: string): Promise<[Response, messageResponse]> {
const response = await this.api.post(`/dev/${appId}/revert`)
const json = await response.json()
return [response, json]
}
async delete(appId: string): Promise<[Response, any]> {
const response = await this.api.del(`/applications/${appId}`)
const json = await response.json()
return [response, json]
}
async update(appId: string, body: any): Promise<[Response, Application]> {
const response = await this.api.put(`/applications/${appId}`, { body })
const json = await response.json()
return [response, json]
}
async addScreentoApp(body: any): Promise<[Response, Application]> {
const response = await this.api.post(`/screens`, { body })
const json = await response.json()
return [response, json]
}
async getRoutes(): Promise<[Response, RouteConfig]> {
const response = await this.api.get(`/routing`)
const json = await response.json()
return [response, json]
}
}

View file

@ -0,0 +1,34 @@
import generator from "../../generator"
const randomId = generator.guid()
const generateScreen = (): any => ({
showNavigation: true,
width: "Large",
props: {
_id: randomId,
_component: "@budibase/standard-components/container",
_styles: {
normal: {},
hover: {},
active: {},
selected: {},
},
_children: [],
_instanceName: "New Screen",
direction: "column",
hAlign: "stretch",
vAlign: "top",
size: "grow",
gap: "M",
},
routing: {
route: "/test",
roleId: "BASIC",
homeScreen: false,
},
name: randomId,
template: "createFromScratch",
})
export default generateScreen

View file

@ -0,0 +1,9 @@
import { Application } from "@budibase/server/api/controllers/public/mapping/types"
import { Layout } from "@budibase/types"
import { Screen } from "@budibase/types"
// Create type for getAppPackage response
export interface AppPackageResponse {
application: Partial<Application>,
layout: Layout,
screens: Screen[]
}

View file

@ -0,0 +1,6 @@
export interface DeployConfig {
appUrl: string,
status: string,
"_id": string
}

View file

@ -0,0 +1,17 @@
export interface RouteConfig {
routes: Record<string, Route>
}
export interface Route {
subpaths: Record<string, Subpath>
}
export interface Subpath {
screens: ScreenRouteConfig
}
export interface ScreenRouteConfig {
BASIC?: string
POWER?: string
ADMIN?: string
}

View file

@ -4,6 +4,7 @@ import { db } from "@budibase/backend-core"
import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
import generateApp from "../../../config/internal-api/fixtures/applications"
import generator from "../../../config/generator"
import generateScreen from "../../../config/internal-api/fixtures/screens"
describe("Internal API - /applications endpoints", () => {
const api = new InternalAPIClient()
@ -84,4 +85,101 @@ describe("Internal API - /applications endpoints", () => {
await config.applications.canRender()
expect(publishedAppRenders).toBe(true)
})
it("POST - Sync application before deployment", async () => {
const [response, app] = await config.applications.create(generateApp())
expect(response).toHaveStatusCode(200)
expect(app.appId).toBeDefined()
config.applications.api.appId = app.appId
const [syncResponse, sync] = await config.applications.sync(<string>app.appId)
expect(syncResponse).toHaveStatusCode(200)
expect(sync).toEqual({
message: "App sync not required, app not deployed."
})
})
it("POST - Sync application after deployment", async () => {
const [response, app] = await config.applications.create(generateApp())
expect(response).toHaveStatusCode(200)
expect(app.appId).toBeDefined()
config.applications.api.appId = app.appId
// publish app
await config.applications.publish()
const [syncResponse, sync] = await config.applications.sync(<string>app.appId)
expect(syncResponse).toHaveStatusCode(200)
expect(sync).toEqual({
message: "App sync completed successfully."
})
})
it("PUT - Update an application", async () => {
const [response, app] = await config.applications.create(generateApp())
expect(response).toHaveStatusCode(200)
expect(app.appId).toBeDefined()
config.applications.api.appId = app.appId
const [updateResponse, updatedApp] = await config.applications.update(<string>app.appId, {
name: generator.word(),
})
expect(updateResponse).toHaveStatusCode(200)
expect(updatedApp.name).not.toEqual(app.name)
})
it("POST - Revert Changes without changes", async () => {
const [response, app] = await config.applications.create(generateApp())
expect(response).toHaveStatusCode(200)
expect(app.appId).toBeDefined()
config.applications.api.appId = app.appId
const [revertResponse, revert] = await config.applications.revert(<string>app.appId)
expect(revertResponse).toHaveStatusCode(400)
expect(revert).toEqual({
message: "App has not yet been deployed",
status: 400
})
})
it("POST - Revert Changes", async () => {
const [response, app] = await config.applications.create(generateApp())
expect(response).toHaveStatusCode(200)
expect(app.appId).toBeDefined()
config.applications.api.appId = app.appId
// publish app
const [publishResponse, publish] = await config.applications.publish()
expect(publishResponse).toHaveStatusCode(200)
expect(publish.status).toEqual("SUCCESS")
// Change/add component to the app
const [screenResponse, screen] = await config.applications.addScreentoApp(generateScreen())
expect(screenResponse).toHaveStatusCode(200)
expect(screen._id).toBeDefined()
// // Revert the app to published state
const [revertResponse, revert] = await config.applications.revert(<string>app.appId)
expect(revertResponse).toHaveStatusCode(200)
expect(revert).toEqual({
message: "Reverted changes successfully."
})
// Check screen is removed
const [routesResponse, routes] = await config.applications.getRoutes()
expect(routesResponse).toHaveStatusCode(200)
expect(routes.routes["/test"]).toBeUndefined()
})
it("DELETE - Delete an application", async () => {
const [response, app] = await config.applications.create(generateApp())
expect(response).toHaveStatusCode(200)
expect(app.appId).toBeDefined()
const [deleteResponse] = await config.applications.delete(<string>app.appId)
expect(deleteResponse).toHaveStatusCode(200)
})
})