Merge branch 'develop' of github.com:Budibase/budibase into feature/test-image

This commit is contained in:
mike12345567 2023-01-10 18:49:07 +00:00
commit d347b8015b
55 changed files with 4167 additions and 2459 deletions

View File

@ -67,16 +67,24 @@ jobs:
uses: azure/setup-helm@v1
id: helm-install
# due to helm repo index issue: https://github.com/helm/helm/issues/7363
# we need to create new package in a different dir, merge the index and move the package back
- name: Build and release helm chart
run: |
git config user.name "Budibase Helm Bot"
git config user.email "<>"
git reset --hard
git pull
helm package charts/budibase --version "$RELEASE_VERSION" --app-version "$RELEASE_VERSION"
mkdir sync
echo "Packaging chart to sync dir"
helm package charts/budibase --version "$RELEASE_VERSION" --app-version "$RELEASE_VERSION" --destination sync
echo "Packaging successful"
git checkout gh-pages
mv *.tgz docs
helm repo index docs
echo "Indexing helm repo"
helm repo index --merge docs/index.yaml sync
mv -f sync/* docs
rm -rf sync
echo "Pushing new helm release"
git add -A
git commit -m "Helm Release: ${{ env.RELEASE_VERSION }}"
git push

View File

@ -17,7 +17,7 @@ version: 0.0.0
appVersion: 0.0.0
dependencies:
- name: couchdb
version: 3.6.1
version: 3.3.4
repository: https://apache.github.io/couchdb-helm
condition: services.couchdb.enabled
- name: ingress-nginx

View File

@ -4,9 +4,6 @@ metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.21.0 (992df58d8)
{{ if .Values.globals.logAnnotations }}
{{ toYaml .Values.globals.logAnnotations | indent 4 }}
{{ end }}
creationTimestamp: null
labels:
io.kompose.service: app-service
@ -23,6 +20,9 @@ spec:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.21.0 (992df58d8)
{{ if .Values.services.apps.annotations }}
{{- toYaml .Values.services.apps.annotations | indent 8 -}}
{{ end }}
creationTimestamp: null
labels:
io.kompose.service: app-service

View File

@ -4,9 +4,6 @@ metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.21.0 (992df58d8)
{{ if .Values.globals.logAnnotations }}
{{ toYaml .Values.globals.logAnnotations | indent 4 }}
{{ end }}
creationTimestamp: null
labels:
app.kubernetes.io/name: budibase-proxy
@ -23,6 +20,9 @@ spec:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.21.0 (992df58d8)
{{ if .Values.services.proxy.annotations }}
{{- toYaml .Values.services.proxy.annotations | indent 8 -}}
{{ end }}
creationTimestamp: null
labels:
app.kubernetes.io/name: budibase-proxy

View File

@ -4,9 +4,6 @@ metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.21.0 (992df58d8)
{{ if .Values.globals.logAnnotations }}
{{ toYaml .Values.globals.logAnnotations | indent 4 }}
{{ end }}
creationTimestamp: null
labels:
io.kompose.service: worker-service
@ -24,6 +21,9 @@ spec:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.21.0 (992df58d8)
{{ if .Values.services.worker.annotations }}
{{- toYaml .Values.services.worker.annotations | indent 8 -}}
{{ end }}
creationTimestamp: null
labels:
io.kompose.service: worker-service

View File

@ -22,12 +22,6 @@ serviceAccount:
podAnnotations: {}
# logAnnotations:
# co.elastic.logs/multiline.type: pattern
# co.elastic.logs/multiline.pattern: '^[[:space:]]'
# co.elastic.logs/multiline.negate: false
# co.elastic.logs/multiline.match: after
podSecurityContext:
{}
# fsGroup: 2000
@ -130,6 +124,10 @@ services:
minio: 'http://minio-service.{{ .Release.Namespace }}.svc.{{ .Values.services.dns }}:{{ .Values.services.objectStore.port }}'
couchdb: 'http://{{ .Release.Name }}-svc-couchdb:{{ .Values.services.couchdb.port }}'
resources: {}
# annotations:
# co.elastic.logs/module: nginx
# co.elastic.logs/fileset.stdout: access
# co.elastic.logs/fileset.stderr: error
apps:
port: 4002
@ -137,11 +135,20 @@ services:
logLevel: info
resources: {}
# nodeDebug: "" # set the value of NODE_DEBUG
# annotations:
# co.elastic.logs/multiline.type: pattern
# co.elastic.logs/multiline.pattern: '^[[:space:]]'
# co.elastic.logs/multiline.negate: false
# co.elastic.logs/multiline.match: after
worker:
port: 4003
replicaCount: 1
resources: {}
# annotations:
# co.elastic.logs/multiline.type: pattern
# co.elastic.logs/multiline.pattern: '^[[:space:]]'
# co.elastic.logs/multiline.negate: false
# co.elastic.logs/multiline.match: after
couchdb:
enabled: true

File diff suppressed because it is too large Load Diff

View File

@ -76,7 +76,7 @@ mkdir -p ${DATA_DIR}/minio
chown -R couchdb:couchdb ${DATA_DIR}/couch
redis-server --requirepass $REDIS_PASSWORD > /dev/stdout 2>&1 &
/bbcouch-runner.sh &
/minio/minio server ${DATA_DIR}/minio > /dev/stdout 2>&1 &
/minio/minio server --console-address ":9001" ${DATA_DIR}/minio > /dev/stdout 2>&1 &
/etc/init.d/nginx restart
if [[ ! -z "${CUSTOM_DOMAIN}" ]]; then
# Add monthly cron job to renew certbot certificate

View File

@ -1,5 +1,5 @@
{
"version": "2.2.10-alpha.12",
"version": "2.2.12-alpha.5",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -45,8 +45,8 @@
"dev:server": "yarn run kill-server && lerna run --parallel dev:builder --concurrency 1 --scope @budibase/backend-core --scope @budibase/worker --scope @budibase/server",
"test": "lerna run test && yarn test:pro",
"test:pro": "bash scripts/pro/test.sh",
"lint:eslint": "eslint packages",
"lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\"",
"lint:eslint": "eslint packages && eslint qa-core",
"lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --check \"qa-core/**/*.{js,ts,svelte}\"",
"lint": "yarn run lint:eslint && yarn run lint:prettier",
"lint:fix:eslint": "eslint --fix packages qa-core",
"lint:fix:prettier": "prettier --write \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --write \"qa-core/**/*.{js,ts,svelte}\"",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.2.10-alpha.12",
"version": "2.2.12-alpha.5",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -23,7 +23,7 @@
},
"dependencies": {
"@budibase/nano": "10.1.1",
"@budibase/types": "2.2.10-alpha.12",
"@budibase/types": "2.2.12-alpha.5",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0",

View File

@ -329,9 +329,9 @@ export const deleteFile = async (bucketName: string, filepath: string) => {
await makeSureBucketExists(objectStore, bucketName)
const params = {
Bucket: bucketName,
Key: filepath,
Key: sanitizeKey(filepath),
}
return objectStore.deleteObject(params)
return objectStore.deleteObject(params).promise()
}
export const deleteFiles = async (bucketName: string, filepaths: string[]) => {
@ -340,7 +340,7 @@ export const deleteFiles = async (bucketName: string, filepaths: string[]) => {
const params = {
Bucket: bucketName,
Delete: {
Objects: filepaths.map((path: any) => ({ Key: path })),
Objects: filepaths.map((path: any) => ({ Key: sanitizeKey(path) })),
},
}
return objectStore.deleteObjects(params).promise()

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ import filterTests from "../../support/filterTests"
const interact = require('../../support/interact')
filterTests(["smoke", "all"], () => {
context("Account Portals", () => {
xcontext("Account Portals", () => {
const bbUserEmail = "bbuser@test.com"
@ -44,7 +44,7 @@ filterTests(["smoke", "all"], () => {
//cy.logoutNoAppGrid()
})
it("should verify Standard Portal", () => {
xit("should verify Standard Portal", () => {
// Development access should be disabled (Admin access is already disabled)
cy.login()
cy.setUserRole("bbuser", "App User")

View File

@ -3,14 +3,14 @@ import { APP_TABLE_APP_NAME, DEPLOY_SUCCESS_MODAL } from "../support/interact";
const interact = require('../support/interact')
filterTests(['all'], () => {
context("Publish Application Workflow", () => {
xcontext("Publish Application Workflow", () => {
before(() => {
cy.login()
cy.deleteAllApps()
cy.createApp("Cypress Tests", false)
})
it("Should reflect the unpublished status correctly", () => {
xit("Should reflect the unpublished status correctly", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
cy.get(interact.APP_TABLE_STATUS, { timeout: 3000 }).eq(0)
@ -28,7 +28,7 @@ filterTests(['all'], () => {
cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("not.exist")
})
it("Should publish an application and correctly reflect that", () => {
xit("Should publish an application and correctly reflect that", () => {
//Assuming the previous test was run and the unpublished app is open in edit mode.
cy.get(interact.TOPRIGHTNAV_BUTTON_SPECTRUM).contains("Publish").click({ force: true })
@ -70,7 +70,7 @@ filterTests(['all'], () => {
})
})
it("Should unpublish an application using the link and reflect the status change", () => {
xit("Should unpublish an application using the link and reflect the status change", () => {
//Assuming the previous test app exists and is published
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
@ -96,7 +96,8 @@ filterTests(['all'], () => {
cy.get(interact.UNPUBLISH_MODAL).should("be.visible")
.within(() => {
cy.get(interact.CONFIRM_WRAP_BUTTON).click({ force: true }
)})
)
})
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 6000 })
cy.wait(500)

View File

@ -2,7 +2,7 @@ import filterTests from "../support/filterTests"
const interact = require('../support/interact')
filterTests(['smoke', 'all'], () => {
context("Create a View", () => {
xcontext("Create a View", () => {
before(() => {
cy.login()
cy.createTestApp()
@ -20,7 +20,7 @@ filterTests(['smoke', 'all'], () => {
cy.addRow(["Teachers", 36, 3])
})
it("creates a view", () => {
xit("creates a view", () => {
cy.contains("Create view").click()
cy.get(interact.MODAL_INNER_WRAPPER).within(() => {
cy.get("input").type("Test View")
@ -38,7 +38,7 @@ filterTests(['smoke', 'all'], () => {
})
})
it("filters the view by age over 10", () => {
xit("filters the view by age over 10", () => {
cy.contains("Filter").click()
cy.contains("Add Filter").click()
@ -58,7 +58,7 @@ filterTests(['smoke', 'all'], () => {
})
})
it("creates a stats calculation view based on age", () => {
xit("creates a stats calculation view based on age", () => {
cy.wait(1000)
cy.contains("Calculate").click()
cy.get(interact.MODAL_INNER_WRAPPER).within(() => {
@ -95,7 +95,7 @@ filterTests(['smoke', 'all'], () => {
})
})
it("groups the view by group", () => {
xit("groups the view by group", () => {
cy.contains("Group by").click()
cy.get(interact.MODAL_INNER_WRAPPER).within(() => {
cy.get(interact.SPECTRUM_PICKER_LABEL).eq(0).click()
@ -127,7 +127,7 @@ filterTests(['smoke', 'all'], () => {
})
})
it("renames a view", () => {
xit("renames a view", () => {
cy.contains(interact.NAV_ITEM, "Test View")
.find(".actions .icon.open-popover")
.click({ force: true })

View File

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

View File

@ -144,6 +144,11 @@
drawer.show()
}
const getQueryValue = queries => {
value = queries.find(q => q._id === value._id) || value
return value
}
const saveQueryParams = () => {
handleSelected({
...value,
@ -175,7 +180,7 @@
{/if}
<IntegrationQueryEditor
height={200}
query={value}
query={getQueryValue(queries)}
schema={fetchQueryDefinition(value)}
datasource={getQueryDatasource(value)}
editable={false}

View File

@ -117,10 +117,17 @@
)
}
const cleanUrl = inputUrl =>
url
?.replace(/(http)|(https)|[{}:]/g, "")
?.replaceAll(".", "_")
?.replaceAll("/", " ")
?.trim() || inputUrl
function checkQueryName(inputUrl = null) {
if (query && (!query.name || query.flags.urlName)) {
query.flags.urlName = true
query.name = url || inputUrl
query.name = cleanUrl(inputUrl)
}
}

View File

@ -105,6 +105,7 @@
{#if !query.fields.steps?.length}
<div class="controls">
<Button
disabled={!editable}
secondary
slot="buttons"
on:click={() => {
@ -131,6 +132,7 @@
{#if index > 0}
<ActionButton
quiet
disabled={!editable}
on:click={() => {
updateEditorsOnSwap(index, index - 1)
const target = query.fields.steps[index - 1].key
@ -144,6 +146,7 @@
{#if index < query.fields.steps.length - 1}
<ActionButton
quiet
disabled={!editable}
on:click={() => {
updateEditorsOnSwap(index, index + 1)
const target = query.fields.steps[index + 1].key
@ -156,6 +159,7 @@
{/if}
</div>
<ActionButton
disabled={!editable}
on:click={() => {
updateEditorsOnDelete(index)
query.fields.steps.splice(index, 1)
@ -169,6 +173,7 @@
<div class="fields">
<div class="block-field">
<Select
disabled={!editable}
value={step.key}
options={schema.steps.map(s => s.key)}
on:change={({ detail }) => {
@ -178,6 +183,7 @@
<Editor
bind:this={stepEditors[index]}
editorHeight={height / 2}
readOnly={!editable}
mode="json"
value={typeof step.value === "string"
? step.value
@ -194,9 +200,11 @@
<div class="separator" />
{#if index === query.fields.steps.length - 1}
<Icon
disabled={!editable}
hoverable
name="AddCircle"
size="S"
readOnly={!editable}
on:click={() => {
query.fields.steps = [
...query.fields.steps,

View File

@ -2,6 +2,11 @@
# yarn lockfile v1
"@adobe/spectrum-css-workflow-icons@1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@adobe/spectrum-css-workflow-icons/-/spectrum-css-workflow-icons-1.2.1.tgz#7e2cb3fcfb5c8b12d7275afafbb6ec44913551b4"
integrity sha512-uVgekyBXnOVkxp+CUssjN/gefARtudZC8duEn1vm0lBQFwGRZFlDEzU1QC+aIRWCrD1Z8OgRpmBYlSZ7QS003w==
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.16.0":
version "7.16.0"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.0.tgz#0dfc80309beec8411e65e706461c408b0bb9b431"
@ -915,6 +920,136 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/bbui@2.2.10-alpha.13":
version "2.2.10-alpha.13"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-2.2.10-alpha.13.tgz#42bf24c5df4cea74a69fba571423fcf4527f16fa"
integrity sha512-l6TYaqizIxjIonqgyYewsEvWK+H+xwKTrJrQTHSsw5MWxKY+MZoh+i+pUM5tQKwpG0Z6kg3iZSYvm0GUk3HGFw==
dependencies:
"@adobe/spectrum-css-workflow-icons" "1.2.1"
"@budibase/string-templates" "2.2.10-alpha.13"
"@spectrum-css/actionbutton" "1.0.1"
"@spectrum-css/actiongroup" "1.0.1"
"@spectrum-css/avatar" "3.0.2"
"@spectrum-css/button" "3.0.1"
"@spectrum-css/buttongroup" "3.0.2"
"@spectrum-css/checkbox" "3.0.2"
"@spectrum-css/dialog" "3.0.1"
"@spectrum-css/divider" "1.0.3"
"@spectrum-css/dropzone" "3.0.2"
"@spectrum-css/fieldgroup" "3.0.2"
"@spectrum-css/fieldlabel" "3.0.1"
"@spectrum-css/icon" "3.0.1"
"@spectrum-css/illustratedmessage" "3.0.2"
"@spectrum-css/inlinealert" "2.0.1"
"@spectrum-css/inputgroup" "3.0.2"
"@spectrum-css/label" "2.0.10"
"@spectrum-css/link" "3.1.1"
"@spectrum-css/menu" "3.0.1"
"@spectrum-css/modal" "3.0.1"
"@spectrum-css/pagination" "3.0.3"
"@spectrum-css/picker" "1.0.1"
"@spectrum-css/popover" "3.0.1"
"@spectrum-css/progressbar" "1.0.2"
"@spectrum-css/progresscircle" "1.0.2"
"@spectrum-css/radio" "3.0.2"
"@spectrum-css/search" "3.0.2"
"@spectrum-css/sidenav" "3.0.2"
"@spectrum-css/slider" "3.0.1"
"@spectrum-css/statuslight" "3.0.2"
"@spectrum-css/stepper" "3.0.3"
"@spectrum-css/switch" "1.0.2"
"@spectrum-css/table" "3.0.1"
"@spectrum-css/tabs" "3.2.12"
"@spectrum-css/tags" "3.0.2"
"@spectrum-css/textfield" "3.0.1"
"@spectrum-css/toast" "3.0.1"
"@spectrum-css/tooltip" "3.0.3"
"@spectrum-css/treeview" "3.0.2"
"@spectrum-css/typography" "3.0.1"
"@spectrum-css/underlay" "2.0.9"
"@spectrum-css/vars" "3.0.1"
dayjs "^1.10.4"
easymde "^2.16.1"
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
"@budibase/client@2.2.10-alpha.13":
version "2.2.10-alpha.13"
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-2.2.10-alpha.13.tgz#85983fa69b4079e56002e05428bcc832796ddd79"
integrity sha512-TsvIuy0RpjQ+SH7JYpqpdlPjinsv0fownpTlAIXxV/ig9GpS9wGtPIo9+ai45axtUcnAuvwFzNYLBF8j0NirvA==
dependencies:
"@budibase/bbui" "2.2.10-alpha.13"
"@budibase/frontend-core" "2.2.10-alpha.13"
"@budibase/string-templates" "2.2.10-alpha.13"
"@spectrum-css/button" "^3.0.3"
"@spectrum-css/card" "^3.0.3"
"@spectrum-css/divider" "^1.0.3"
"@spectrum-css/link" "^3.1.3"
"@spectrum-css/page" "^3.0.1"
"@spectrum-css/tag" "^3.1.4"
"@spectrum-css/typography" "^3.0.2"
"@spectrum-css/vars" "^3.0.1"
apexcharts "^3.22.1"
dayjs "^1.10.5"
downloadjs "1.4.7"
html5-qrcode "^2.2.1"
leaflet "^1.7.1"
regexparam "^1.3.0"
sanitize-html "^2.7.0"
screenfull "^6.0.1"
shortid "^2.2.15"
socket.io-client "^4.5.1"
svelte "^3.49.0"
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
svelte-spa-router "^3.0.5"
"@budibase/frontend-core@2.2.10-alpha.13":
version "2.2.10-alpha.13"
resolved "https://registry.yarnpkg.com/@budibase/frontend-core/-/frontend-core-2.2.10-alpha.13.tgz#b6f49e65532eee31a19a6991740c9f55220271a9"
integrity sha512-iXDtSec2VHbDFwLkXOm7L8oah1CDBd3rrNbEnkL/8FyAIeguLp5iSwojtTWZ+wn+ZRa7yLwQDdqXIGVkj1XahA==
dependencies:
"@budibase/bbui" "2.2.10-alpha.13"
lodash "^4.17.21"
svelte "^3.46.2"
"@budibase/handlebars-helpers@^0.11.8":
version "0.11.8"
resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.8.tgz#6953d29673a8c5c407e096c0a84890465c7ce841"
integrity sha512-ggWJUt0GqsHFAEup5tlWlcrmYML57nKhpNGGLzVsqXVYN8eVmf3xluYmmMe7fDYhQH0leSprrdEXmsdFQF3HAQ==
dependencies:
array-sort "^1.0.0"
define-property "^2.0.2"
extend-shallow "^3.0.2"
for-in "^1.0.2"
get-object "^0.2.0"
get-value "^3.0.1"
handlebars "^4.7.7"
handlebars-utils "^1.0.6"
has-value "^2.0.2"
helper-md "^0.2.2"
html-tag "^2.0.0"
is-even "^1.0.0"
is-glob "^4.0.1"
kind-of "^6.0.3"
micromatch "^3.1.5"
relative "^3.0.2"
striptags "^3.1.1"
to-gfm-code-block "^0.1.1"
year "^0.2.1"
"@budibase/string-templates@2.2.10-alpha.13":
version "2.2.10-alpha.13"
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-2.2.10-alpha.13.tgz#5b8c21542c0f9e7ec23ae266dbf7de30b45e82e2"
integrity sha512-RbFz9ARAqx/LrR74QTy/DuDRFkOsUkQh5sHpiecpmTSvGAXcS7NGDGSKQUaDrDP0pCtYrBD5mfEeFdD00YdYrQ==
dependencies:
"@budibase/handlebars-helpers" "^0.11.8"
dayjs "^1.10.4"
handlebars "^4.7.6"
handlebars-utils "^1.0.6"
lodash "^4.17.20"
vm2 "^3.9.4"
"@cnakazawa/watch@^1.0.3":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
@ -1356,6 +1491,130 @@
dependencies:
"@sinonjs/commons" "^1.7.0"
"@socket.io/component-emitter@~3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553"
integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==
"@spectrum-css/actionbutton@1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/actionbutton/-/actionbutton-1.0.1.tgz#9c75da37ea6915919fb574c74bd60dacc03b6577"
integrity sha512-AUqtyNabHF451Aj9i3xz82TxS5Z6k1dttA68/1hMeU9kbPCSS4P6Viw3vaRGs9CSspuR8xnnhDgrq+F+zMy2Hw==
"@spectrum-css/actiongroup@1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/actiongroup/-/actiongroup-1.0.1.tgz#b95b86e7af229e90fe1e70399d8d4b547b4bd31c"
integrity sha512-5Q6uMjzv5BFA2TwGASr/jAtJpTWl26fhWvgGY8kOA0RCSij35l+YJg/FPXf6Nnj2qCOl8DkNycjT9YXJ+bhyVA==
"@spectrum-css/avatar@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/avatar/-/avatar-3.0.2.tgz#4f1826223eae330e64b6d3cc899e9bc2e98dac95"
integrity sha512-wEczvSqxttTWSiL3cOvXV/RmGRwSkw2w6+slcHhnf0kb7ovymMM+9oz8vvEpEsSeo5u598bc+7ktrKFpAd6soQ==
"@spectrum-css/button@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/button/-/button-3.0.1.tgz#6db8c3e851baecd0f1c2d88fef37d49d01c6e643"
integrity sha512-YXrBtjIYisk4Vaxnp0RiE4gdElQX04P2mc4Pi2GlQ27dJKlHmufYcF+kAqGdtiyK5yjdN/vKRcC8y13aA4rusA==
"@spectrum-css/button@^3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@spectrum-css/button/-/button-3.0.3.tgz#2df1efaab6c7e0b3b06cb4b59e1eae59c7f1fc84"
integrity sha512-6CnLPqqtaU/PcSSIGeGRi0iFIIxIUByYLKFO6zn5NEUc12KQ28dJ4PLwB6WBa0L8vRoAGlnWWH2ZZweTijbXgg==
"@spectrum-css/buttongroup@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/buttongroup/-/buttongroup-3.0.2.tgz#fd3387973ca3131609e32112de42a1c0400a48d8"
integrity sha512-Wu7B4GJ/SAeVHz9SUGAkeIH8pLaZh4t+w2ykSKOPQIRuK2jCBoudkEClVxviNVwqekccf5XLFXg9GpYF1a3Uaw==
"@spectrum-css/card@^3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@spectrum-css/card/-/card-3.0.3.tgz#56b2e2da6b80c1583228baa279de7407383bfb6b"
integrity sha512-+oKLUI2a0QmQP9EzySeq/G4FpUkkdaDNbuEbqCj2IkPMc/2v/nwzsPhh1fj2UIghGAiiUwXfPpzax1e8fyhQUg==
"@spectrum-css/checkbox@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/checkbox/-/checkbox-3.0.2.tgz#53ca2fba0d9faa1fead10e7206eb1f6cdcfd6ddd"
integrity sha512-hPbGcnm7kJvJS4jp/P/bdaZvbyR1eIE9mteuZqcBgdmyp9m/k6+mW5jmsbtqb3Y4mMPWvOJFfz/sIvWJP0F0Zg==
"@spectrum-css/dialog@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/dialog/-/dialog-3.0.1.tgz#33aae036282159f6aa998848b8c0828640a9620a"
integrity sha512-hUFbRR6RGT63MNuP7wP+k9KU+uRuICsduMihskh700e+jiQ+Gsv53fBFDlB843FoZYlIXzFQXgtjMUC5a4Qibw==
"@spectrum-css/divider@1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@spectrum-css/divider/-/divider-1.0.3.tgz#639e2ebaa0834efa40f42397668bbd5c153ea385"
integrity sha512-Zy4Rn40w8UtzMh3wx/U9+CepSCpm1aOCGftHgWDub0XZuVTzh0c1WwyzTuLCx2Hf21z5VRGNiDh8bGEEzSbtNA==
dependencies:
"@spectrum-css/vars" "^3.0.2"
"@spectrum-css/divider@^1.0.3":
version "1.0.27"
resolved "https://registry.yarnpkg.com/@spectrum-css/divider/-/divider-1.0.27.tgz#435bf738a65b4eb15c899edf5c536bea22f2d679"
integrity sha512-hWKPHOEo9lkOGN5zecpVVwVxE3x0SJHQJKDNx1g0xs/P/AthAboK+L1c9Rq29czNfcQ2kUjumi4igzQzcqABMQ==
dependencies:
"@spectrum-css/vars" "^8.0.0"
"@spectrum-css/dropzone@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/dropzone/-/dropzone-3.0.2.tgz#34f137851054442b219fed7f32006b93fc5e0bcf"
integrity sha512-BuBBzm5re6lM0AWgd6V+mI5eEGnnmFEtcFiJBEn9jYNEQYgflFhvnERUt89jMX5WmspiecwI2JBWJFrtFsOzug==
"@spectrum-css/fieldgroup@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/fieldgroup/-/fieldgroup-3.0.2.tgz#1c1afd3c444d8650fefac275dc66a7a913933846"
integrity sha512-Vyw0kQJdLW18J6w4H+YAsoLntvkw5rXmW3CH5H3SDTXkBztxtHSSe3e106Nw5MoZxTfHlom6CxbYXYCTjQfqGw==
"@spectrum-css/fieldlabel@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/fieldlabel/-/fieldlabel-3.0.1.tgz#39f7c0f25cc2ff402afeff005341b0832f7c588c"
integrity sha512-LMfwrwIq8wEEvxFLobdLvXRwKrp8o9Fty4iJ9aYl2Rj1uXkfRd8qLz9HGZjLEE1OuJgoTBgamYABl7EvoA5PLw==
"@spectrum-css/icon@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/icon/-/icon-3.0.1.tgz#e300a6fc353c85c6b5d6e7a364408a940c31b177"
integrity sha512-cGFtIrcQ/7tthdkHK1npuEFiCdYVHLqwmLxghUYQw8Tb8KgJaw3OBO1tpjgsUizexNgu26BjVRIbGxNWuBXIHQ==
"@spectrum-css/illustratedmessage@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/illustratedmessage/-/illustratedmessage-3.0.2.tgz#6a480be98b027e050b086e7899e40d87adb0a8c0"
integrity sha512-dqnE8X27bGcO0HN8+dYx8O4o0dNNIAqeivOzDHhe2El+V4dTzMrNIerF6G0NLm3GjVf6XliwmitsZK+K6FmbtA==
"@spectrum-css/inlinealert@2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/inlinealert/-/inlinealert-2.0.1.tgz#7521f88f6c845806403cc7d925773c7414e204a2"
integrity sha512-Xy5RCOwgurqUXuGQCsEDUduDd5408bmEpmFg+feynG7VFUgLFZWBeylSENB/OqjlFtO76PHXNVdHkhDscPIHTA==
"@spectrum-css/inputgroup@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/inputgroup/-/inputgroup-3.0.2.tgz#f1b13603832cbd22394f3d898af13203961f8691"
integrity sha512-O0G3Lw9gxsh8gTLQWIAKkN1O8cWhjpEUl+oR1PguIKFni72uNr2ikU9piOwy/r0gJG2Q/TVs6hAshoAAkmsSzw==
"@spectrum-css/label@2.0.10":
version "2.0.10"
resolved "https://registry.yarnpkg.com/@spectrum-css/label/-/label-2.0.10.tgz#2368651d7636a19385b5d300cdf6272db1916001"
integrity sha512-xCbtEiQkZIlLdWFikuw7ifDCC21DOC/KMgVrrVJHXFc4KRQe9LTZSqmGF3tovm+CSq1adE59mYoTbojVQ9YuEQ==
"@spectrum-css/link@3.1.1":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/link/-/link-3.1.1.tgz#cb526a2e10b50ef5a7ae29cca7272e2610d597eb"
integrity sha512-Bi88lRhTY7g6nM/ryW1yY4Cji211ZYNtRxkxbV7n2lPvwMAAQtyx0qVD3ru4kTGj/FFVvmPR3XiOE10K13HSNA==
"@spectrum-css/link@^3.1.3":
version "3.1.23"
resolved "https://registry.yarnpkg.com/@spectrum-css/link/-/link-3.1.23.tgz#9d9ff64c41366edbfdb19d04a5deec88bf2ea8fd"
integrity sha512-CAJQGnGTrTtR4tF1L94ou9Y+c4vnx9d5rWhb3AMzKb2Focqz02xSkTyaCCH7OM/3CwD8TCLOMANon8LcRpGAjA==
"@spectrum-css/menu@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/menu/-/menu-3.0.1.tgz#2a376f991acc24e12ec892bb6b9db2650fc41fbe"
integrity sha512-Qjg0+1O0eC89sb/bRFq2AGnQ8XqhVy23TUXHyffNM8qdcMssnlny3QmhzjURCZKvx/Y5UytCpzhedPQqSpQwZg==
"@spectrum-css/modal@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/modal/-/modal-3.0.1.tgz#613a6b83d0330a4d38db41a98090800751c56d8d"
integrity sha512-F7D99F3cjDGT9DM9sogx/p49jrNYT7a1J6TUoqV73wUf+0gP+dTsskBOo9jB8VbUE+POQPjiDLB+SWLp6iBB+w==
"@spectrum-css/page@^3.0.1":
version "3.0.8"
resolved "https://registry.yarnpkg.com/@spectrum-css/page/-/page-3.0.8.tgz#001efa9e4c10095df9b2b37cf7d7d6eb60140190"
@ -1363,7 +1622,127 @@
dependencies:
"@spectrum-css/vars" "^4.3.0"
"@spectrum-css/vars@^3.0.1":
"@spectrum-css/pagination@3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@spectrum-css/pagination/-/pagination-3.0.3.tgz#b204c3ada384c4af751a354bc428346d82eeea65"
integrity sha512-OJ/v9GeNXJOZ9Yr9LDBYPrR2NCiLOWP9wANT/a5sqFuugRnQbn/HYMnRp9TBxwpDY6ihaPo0T/wi7kLiAJFdDw==
"@spectrum-css/picker@1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/picker/-/picker-1.0.1.tgz#98991198576d26bd14160824e7b6f3c278ff930b"
integrity sha512-Rv4/UBOdNW1gs7WVBCJnPD5VFly8MqP++psDX6kcugUIcfJy0GC3acvElotmKRlCDk8Qxks2W2A0jKeSgphTmA==
"@spectrum-css/popover@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/popover/-/popover-3.0.1.tgz#5863c1efc53f98f9aba2de9186666780041303fc"
integrity sha512-LmOSj/yCwQQ9iGmCYnHiJsJR/HfPiGqI1Jl7pkKxBOCxYBMS/5+ans9vfCN2Qnd0eK7WSbfPg72S6mjye7db2Q==
"@spectrum-css/progressbar@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/progressbar/-/progressbar-1.0.2.tgz#b5a59432517f9ae6dad49d9504691bc5ac42b424"
integrity sha512-+jExeBLtVCqo3BqtFq5WCtZ028Dzk+oUnX6y4z6ZamKPqOyOELOtFnhYnyhyRndQOqYwKUTXx9zsaWA/lpJOHw==
"@spectrum-css/progresscircle@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/progresscircle/-/progresscircle-1.0.2.tgz#258ea9170fb70f795edda03e38a61d93bef4487c"
integrity sha512-JLULpyzjIY95lzlWR1yE1gv4l1K6p+scQ+edmuZZUHBzwM3pUtkvHJmUlA9TYdResUYW6Uka60VRdY6lZ8gnFQ==
"@spectrum-css/radio@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/radio/-/radio-3.0.2.tgz#9c1386894920bbed604e4e174fbbd45d9d762152"
integrity sha512-0TDdzC9omNXnpKHEXNuuGeXdNh4x8jvTKVUqMRLb7vY4hY94hAdt6X01NBqka+jzK35HxGzpDdPADAz62yZLPQ==
"@spectrum-css/search@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/search/-/search-3.0.2.tgz#70e93e321032d40b399498b2324e3b70e050551e"
integrity sha512-3UbT8yZmNOwrZxq+CUmumE+26ZySZ8OoKNM6U20SLMPLgdx6MrRugVE88r3Bl0sJ0RZX/5bU8nausdiHeX+Jlw==
"@spectrum-css/sidenav@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/sidenav/-/sidenav-3.0.2.tgz#9d70f408d588ee79c69857751010333671f32713"
integrity sha512-YpIdH/F0jEICYmoduGrnkTmxwJq1kfKxEp0wOs+ZkQOsvKMv1an7nyhsfOKCQqcGNfYzJ9mJAk7/u5+vsxHa8g==
"@spectrum-css/slider@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/slider/-/slider-3.0.1.tgz#5281e6f47eb5a4fd3d1816c138bf66d01d7f2e49"
integrity sha512-DI2dtMRnQuDM1miVzl3SGyR1khUEKnwdXfO5EHDFwkC3yav43F5QogkfjmjFmWWobMVovdJlAuiaaJ/IHejD0Q==
"@spectrum-css/statuslight@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/statuslight/-/statuslight-3.0.2.tgz#dc54b6cd113413dcdb909c486b5d7bae60db65c5"
integrity sha512-xodB8g8vGJH20XmUj9ZsPlM1jHrGeRbvmVXkz0q7YvQrYAhim8pP3W+XKKZAletPFAuu8cmUOc6SWn6i4X4z6w==
"@spectrum-css/stepper@3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@spectrum-css/stepper/-/stepper-3.0.3.tgz#ae89846886431e3edeee060207b8f81540f73a34"
integrity sha512-prAD61ImlOTs9b6PfB3cB08x4lAfxtvnW+RZiTYky0E8GgZdrc/MfCkL5/oqQaIQUtyQv/3Lb7ELAf/0K8QTXw==
"@spectrum-css/switch@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/switch/-/switch-1.0.2.tgz#f0b4c69271964573e02b08e90998096e49e1de44"
integrity sha512-zqmHpgWPNg1gEwdUNFYV3CBX5JaeALfIqcJIxE0FLZqr9d1C4+oLE0ItIFzt1bwr4bFAOmkEpvtiY+amluzGxQ==
"@spectrum-css/table@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/table/-/table-3.0.1.tgz#753e0e2498082c0c36b9600828516aff3ac338cd"
integrity sha512-XQ+srMTv9hK1H0nctWUtqyzitmvyb5TNR+7mjAmKRdkBRSTQQSipDhenxZp72ekzMtMoSYZVZ77kgo0Iw3Fpug==
"@spectrum-css/tabs@3.2.12":
version "3.2.12"
resolved "https://registry.yarnpkg.com/@spectrum-css/tabs/-/tabs-3.2.12.tgz#9b08f23d5aa881b3441af7757800c7173e5685ff"
integrity sha512-rPFUW9SSW4+3/UJ3UrtY2/l3sQvlqB1fqxHLPDjgykvbfrnMejcCTNV4ZrFNHXpE/6+kGnk+yVViSPtWGwJzkA==
"@spectrum-css/tag@^3.1.4":
version "3.3.15"
resolved "https://registry.yarnpkg.com/@spectrum-css/tag/-/tag-3.3.15.tgz#971184fd8cb977b85a529f808313851863123278"
integrity sha512-pF6Wh61Z7hmAy20twIlpjdDuivYj6UPtWIzK7giyJKr/qcn20BjVN2ChIeFB1N+vBamJdLsuQOewv4AJ3+LZ2Q==
"@spectrum-css/tags@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/tags/-/tags-3.0.2.tgz#5bf35fb79c97cd9344de485bd4626ad5b9f07757"
integrity sha512-HbvMk+QHvCDD1/ScvSErpKROcpAbXuMD4Hl/Gz/1A1lQ0fJ/CJeCq/MMsL7zjK1nlItU/ySu8r8KIuRF+6F8SQ==
"@spectrum-css/textfield@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/textfield/-/textfield-3.0.1.tgz#e875b8e37817378ad08fc4af7d53026df38911e5"
integrity sha512-MUV5q87CVxbkNdSNoxGrFbgyKc51ft/WWf3aVEoPdPw5yBnXqFe1w1YmAit5zYDOOhhs58sCLAlUcCMlOpkgrA==
"@spectrum-css/toast@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/toast/-/toast-3.0.1.tgz#36f62ea05302761e59b9d53e05f6c04423861796"
integrity sha512-jov++S358BrN2tmMfaoYk1N6u9HojgeuQk61keXrK2m3VE5/n94x7Lg3kIPeSWO0odyDfBlMqT9jacbRey3QTg==
"@spectrum-css/tooltip@3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@spectrum-css/tooltip/-/tooltip-3.0.3.tgz#26b8ca3b3d30e29630244d85eb4fc11d0c841281"
integrity sha512-ztRF7WW1FzyNavXBRc+80z67UoOrY9wl3cMYsVD3MpDnyxdzP8cjza1pCcolKBaFqRTcQKkxKw3GWtGICRKR5A==
"@spectrum-css/treeview@3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/treeview/-/treeview-3.0.2.tgz#d54d8f17290babb1c885f5d9355e225421beb0d2"
integrity sha512-foO7UBJv1JMFaKgDPVt8jBghZSVbqhXR8TaGaxHSnMubv7ygmKkc1AITrWC2STILCn84ju2vchOohMZfW6sYwg==
"@spectrum-css/typography@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/typography/-/typography-3.0.1.tgz#957dafd9b18c314fa37a88b549042ba2175f5b3f"
integrity sha512-XyR68K2rIZX3u4j7HhMLOqLVHDJZcapp3XUqgYMzMWccBFleA0qPxKpfRWqVIA5DzTMSIw0wEcZPYKWFZ2e6dA==
"@spectrum-css/typography@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/typography/-/typography-3.0.2.tgz#ea3ca0a60e18064527819d48c8c4364cab4fcd38"
integrity sha512-5ZOLmQe0edzsDMyhghUd4hBb5uxGsFrxzf+WasfcUw9klSfTsRZ09n1BsaaWbgrLjlMQ+EEHS46v5VNo0Ms2CA==
"@spectrum-css/underlay@2.0.9":
version "2.0.9"
resolved "https://registry.yarnpkg.com/@spectrum-css/underlay/-/underlay-2.0.9.tgz#fc10f971d1325cc844b727e6260f7217844060e8"
integrity sha512-X86xd0PG4QobmUyXA90BFGnyygaI8kW64dA4ysf4z0cOvUWjNbAAl3a/DB/WRyrnp63Zqv83T/cgNbetagTbWg==
"@spectrum-css/vars@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/vars/-/vars-3.0.1.tgz#561fd69098f896a647242dd8d6108af603bfa31e"
integrity sha512-l4oRcCOqInChYXZN6OQhpe3isk6l4OE6Ys8cgdlsiKp53suNoQxyyd9p/eGRbCjZgH3xQ8nK0t4DHa7QYC0S6w==
"@spectrum-css/vars@^3.0.1", "@spectrum-css/vars@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@spectrum-css/vars/-/vars-3.0.2.tgz#ea9062c3c98dfc6ba59e5df14a03025ad8969999"
integrity sha512-vzS9KqYXot4J3AEER/u618MXWAS+IoMvYMNrOoscKiLLKYQWenaueakUWulFonToPd/9vIpqtdbwxznqrK5qDw==
@ -1484,6 +1863,18 @@
dependencies:
"@babel/types" "^7.3.0"
"@types/codemirror@^5.60.4":
version "5.60.6"
resolved "https://registry.yarnpkg.com/@types/codemirror/-/codemirror-5.60.6.tgz#0511ed51d087ad2a2eedb6111fc74e739c4549f6"
integrity sha512-JIDPSvkYRlcv/2F0erqD+de2ni/Mz6FJMEGb0vwF6ByQOcHIKfiEfwrO4d6dSRwYeHyNUMpGjev0PyjX2M0XWw==
dependencies:
"@types/tern" "*"
"@types/estree@*":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2"
integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==
"@types/estree@0.0.39":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
@ -1538,6 +1929,11 @@
jest-diff "^27.0.0"
pretty-format "^27.0.0"
"@types/marked@^4.0.7":
version "4.0.8"
resolved "https://registry.yarnpkg.com/@types/marked/-/marked-4.0.8.tgz#b316887ab3499d0a8f4c70b7bd8508f92d477955"
integrity sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw==
"@types/minimatch@*":
version "3.0.5"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
@ -2223,6 +2619,11 @@ codemirror@^5.59.0:
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.63.3.tgz#97042a242027fe0c87c09b36bc01931d37b76527"
integrity sha512-1C+LELr+5grgJYqwZKqxrcbPsHFHapVaVAloBsFBASbpLnQqLw1U8yXJ3gT5D+rhxIiSpo+kTqN+hQ+9ialIXw==
codemirror@^5.63.1:
version "5.65.11"
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.65.11.tgz#c818edc3274788c008f636520c5490a1f7009b4f"
integrity sha512-Gp62g2eKSCHYt10axmGhKq3WoJSvVpvhXmowNq7pZdRVowwtvBR/hi2LSP5srtctKkRT33T6/n8Kv1UGp7JW4A==
collect-v8-coverage@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59"
@ -2490,6 +2891,11 @@ dayjs@^1.10.4:
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468"
integrity sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==
dayjs@^1.10.5:
version "1.11.7"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2"
integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==
dayjs@^1.11.2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.2.tgz#fa0f5223ef0d6724b3d8327134890cfe3d72fbe5"
@ -2619,6 +3025,20 @@ dom-accessibility-api@^0.5.6:
resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.10.tgz#caa6d08f60388d0bb4539dd75fe458a9a1d0014c"
integrity sha512-Xu9mD0UjrJisTmv7lmVSDMagQcU9R5hwAbxsaAE/35XPnPLJobbuREfV/rraiSaEj/UOvgrzQs66zyTWTlyd+g==
dom-serializer@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-2.0.0.tgz#e41b802e1eedf9f6cae183ce5e622d789d7d8e53"
integrity sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==
dependencies:
domelementtype "^2.3.0"
domhandler "^5.0.2"
entities "^4.2.0"
domelementtype@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d"
integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==
domexception@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304"
@ -2626,6 +3046,22 @@ domexception@^2.0.1:
dependencies:
webidl-conversions "^5.0.0"
domhandler@^5.0.1, domhandler@^5.0.2:
version "5.0.3"
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-5.0.3.tgz#cc385f7f751f1d1fc650c21374804254538c7d31"
integrity sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==
dependencies:
domelementtype "^2.3.0"
domutils@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-3.0.1.tgz#696b3875238338cb186b6c0612bd4901c89a4f1c"
integrity sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==
dependencies:
dom-serializer "^2.0.0"
domelementtype "^2.3.0"
domhandler "^5.0.1"
dotenv@^8.2.0:
version "8.6.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
@ -2678,6 +3114,16 @@ enquirer@^2.3.6:
dependencies:
ansi-colors "^4.1.1"
ent@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d"
integrity sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==
entities@^4.2.0, entities@^4.3.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/entities/-/entities-4.4.0.tgz#97bdaba170339446495e653cfd2db78962900174"
integrity sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==
error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
@ -3432,6 +3878,29 @@ html-escaper@^2.0.0:
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
html-tag@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/html-tag/-/html-tag-2.0.0.tgz#36c3bc8d816fd30b570d5764a497a641640c2fed"
integrity sha512-XxzooSo6oBoxBEUazgjdXj7VwTn/iSTSZzTYKzYY6I916tkaYzypHxy+pbVU1h+0UQ9JlVf5XkNQyxOAiiQO1g==
dependencies:
is-self-closing "^1.0.1"
kind-of "^6.0.0"
html5-qrcode@^2.2.1:
version "2.3.4"
resolved "https://registry.yarnpkg.com/html5-qrcode/-/html5-qrcode-2.3.4.tgz#7e2b4575a23b10ff5e26d2bf147c8027c1ece389"
integrity sha512-VPZrOTG8XR9HmIAhSSiGtJVPErZxKy/DuGc9cPQLburCWZEbvxQGJP9y4K4P+8vdalLtYB/vM5YP1BdWQKZ8jQ==
htmlparser2@^8.0.0:
version "8.0.1"
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-8.0.1.tgz#abaa985474fcefe269bc761a779b544d7196d010"
integrity sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==
dependencies:
domelementtype "^2.3.0"
domhandler "^5.0.2"
domutils "^3.0.1"
entities "^4.3.0"
http-proxy-agent@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a"
@ -4279,17 +4748,10 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
json5@^2.1.2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3"
integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==
dependencies:
minimist "^1.2.5"
json5@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
json5@^2.1.2, json5@^2.2.1:
version "2.2.3"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
jsonfile@^4.0.0:
version "4.0.0"
@ -4320,7 +4782,7 @@ jsprim@^2.0.2:
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=
integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==
dependencies:
is-buffer "^1.1.5"
@ -4529,6 +4991,11 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"
marked@^4.1.0:
version "4.2.5"
resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.5.tgz#979813dfc1252cc123a79b71b095759a32f42a5d"
integrity sha512-jPueVhumq7idETHkb203WDD4fMA3yV9emQ5vLwop58lu8bTclMghBWcYAavlDqIEMaisADinV1TooIFCfqOsYQ==
merge-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
@ -5009,6 +5476,15 @@ posix-character-classes@^0.1.0:
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
postcss@^8.3.11:
version "8.4.20"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.20.tgz#64c52f509644cecad8567e949f4081d98349dc56"
integrity sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==
dependencies:
nanoid "^3.3.4"
picocolors "^1.0.0"
source-map-js "^1.0.2"
postcss@^8.4.16:
version "8.4.16"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.16.tgz#33a1d675fac39941f5f445db0de4db2b6e01d43c"
@ -5413,6 +5889,18 @@ sane@^4.0.3:
minimist "^1.1.1"
walker "~1.0.5"
sanitize-html@^2.7.0:
version "2.8.1"
resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-2.8.1.tgz#319c4fdba67e1edf35b1fd6d9362210044826d47"
integrity sha512-qK5neD0SaMxGwVv5txOYv05huC3o6ZAA4h5+7nJJgWMNFUNRjcjLO6FpwAtKzfKCZ0jrG6xTk6eVFskbvOGblg==
dependencies:
deepmerge "^4.2.2"
escape-string-regexp "^4.0.0"
htmlparser2 "^8.0.0"
is-plain-object "^5.0.0"
parse-srcset "^1.0.2"
postcss "^8.3.11"
saxes@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d"
@ -5818,6 +6306,23 @@ svelte-portal@0.1.0:
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-0.1.0.tgz#cc2821cc84b05ed5814e0218dcdfcbebc53c1742"
integrity sha512-kef+ksXVKun224mRxat+DdO4C+cGHla+fEcZfnBAvoZocwiaceOfhf5azHYOPXSSB1igWVFTEOF3CDENPnuWxg==
svelte-portal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-1.0.0.tgz#36a47c5578b1a4d9b4dc60fa32a904640ec4cdd3"
integrity sha512-nHf+DS/jZ6jjnZSleBMSaZua9JlG5rZv9lOGKgJuaZStfevtjIlUJrkLc3vbV8QdBvPPVmvcjTlazAzfKu0v3Q==
svelte-spa-router@^3.0.5:
version "3.3.0"
resolved "https://registry.yarnpkg.com/svelte-spa-router/-/svelte-spa-router-3.3.0.tgz#2fc0967a49dc361dfe4d38dddad6e662eed5b42c"
integrity sha512-cwRNe7cxD43sCvSfEeaKiNZg3FCizGxeMcf7CPiWRP3jKXjEma3vxyyuDtPOam6nWbVxl9TNM3hlE/i87ZlqcQ==
dependencies:
regexparam "2.0.1"
svelte@^3.46.2, svelte@^3.49.0:
version "3.55.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.55.0.tgz#29cb958750a23e751309a6535ccd811fcabc9038"
integrity sha512-uGu2FVMlOuey4JoKHKrpZFkoYyj0VLjJdz47zX5+gVK5odxHM40RVhar9/iK2YFRVxvfg9FkhfVlR0sjeIrOiA==
svelte@^3.48.0:
version "3.49.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.49.0.tgz#5baee3c672306de1070c3b7888fc2204e36a4029"
@ -6185,6 +6690,14 @@ vite@^3.0.8:
optionalDependencies:
fsevents "~2.3.2"
vm2@^3.9.4:
version "3.9.13"
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.13.tgz#774a1a3d73b9b90b1aa45bcc5f25e349f2eef649"
integrity sha512-0rvxpB8P8Shm4wX2EKOiMp7H2zq+HUE/UwodY0pCZXs9IffIKZq6vUti5OgkVCTakKo9e/fgO4X1fkwfjWxE3Q==
dependencies:
acorn "^8.7.0"
acorn-walk "^8.2.0"
w3c-hr-time@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.2.10-alpha.12",
"version": "2.2.12-alpha.5",
"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.2.10-alpha.12",
"@budibase/string-templates": "2.2.10-alpha.12",
"@budibase/types": "2.2.10-alpha.12",
"@budibase/backend-core": "2.2.12-alpha.5",
"@budibase/string-templates": "2.2.12-alpha.5",
"@budibase/types": "2.2.12-alpha.5",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View File

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

View File

@ -61,7 +61,7 @@
if (messageHandler) {
messageHandler(message)
} else {
console.warning("Unknown event type", message?.data?.type)
console.warn("Unknown event type", message?.data?.type)
}
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.2.10-alpha.12",
"version": "2.2.12-alpha.5",
"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.2.10-alpha.12",
"version": "2.2.12-alpha.5",
"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.2.10-alpha.12",
"@budibase/client": "2.2.10-alpha.12",
"@budibase/pro": "2.2.10-alpha.12",
"@budibase/string-templates": "2.2.10-alpha.12",
"@budibase/types": "2.2.10-alpha.12",
"@budibase/backend-core": "2.2.12-alpha.5",
"@budibase/client": "2.2.12-alpha.5",
"@budibase/pro": "2.2.12-alpha.5",
"@budibase/string-templates": "2.2.12-alpha.5",
"@budibase/types": "2.2.12-alpha.5",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View File

@ -1,5 +1,5 @@
const setup = require("./utilities")
const { events, constants, db } = require("@budibase/backend-core")
const { events, constants } = require("@budibase/backend-core")
describe("/static", () => {
let request = setup.getRequest()

View File

@ -151,6 +151,9 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
) {
return field.string()
}
if (field.type === "BIT" && field.length === 1) {
return field.buffer()?.[0]
}
return next()
},
}

View File

@ -1,17 +1,16 @@
import { db as dbCore, objectStore } from "@budibase/backend-core"
import { Database } from "@budibase/types"
import { Database, Row } from "@budibase/types"
import { getAutomationParams, TABLE_ROW_PREFIX } from "../../../db/utils"
import { budibaseTempDir } from "../../../utilities/budibaseDir"
import { DB_EXPORT_FILE, GLOBAL_DB_EXPORT_FILE } from "./constants"
import { downloadTemplate } from "../../../utilities/fileSystem"
import { FieldTypes, ObjectStoreBuckets } from "../../../constants"
import { ObjectStoreBuckets } from "../../../constants"
import { join } from "path"
import fs from "fs"
import sdk from "../../"
import {
Automation,
AutomationTriggerStepId,
CouchFindOptions,
RowAttachment,
} from "@budibase/types"
const uuid = require("uuid/v4")
@ -25,54 +24,45 @@ type TemplateType = {
key?: string
}
async function updateAttachmentColumns(prodAppId: string, db: Database) {
// iterate through attachment documents and update them
const tables = await sdk.tables.getAllInternalTables(db)
for (let table of tables) {
const attachmentCols: string[] = []
for (let [key, column] of Object.entries(table.schema)) {
if (column.type === FieldTypes.ATTACHMENT) {
attachmentCols.push(key)
}
}
// no attachment columns, nothing to do
if (attachmentCols.length === 0) {
continue
}
// use the CouchDB Mango query API to lookup rows that have attachments
const params: CouchFindOptions = {
selector: {
_id: {
$regex: `^${TABLE_ROW_PREFIX}`,
},
},
}
attachmentCols.forEach(col => (params.selector[col] = { $exists: true }))
const { rows } = await dbCore.directCouchFind(db.name, params)
for (let row of rows) {
for (let column of attachmentCols) {
if (!Array.isArray(row[column])) {
continue
}
row[column] = row[column].map((attachment: RowAttachment) => {
// Key looks like: appId/attachments/file.csv
function rewriteAttachmentUrl(appId: string, attachment: RowAttachment) {
// URL looks like: /prod-budi-app-assets/appId/attachments/file.csv
const urlParts = attachment.key.split("/")
// remove the app ID
urlParts.shift()
// add new app ID
urlParts.unshift(prodAppId)
urlParts.unshift(appId)
const key = urlParts.join("/")
return {
...attachment,
key,
url: "", // calculated on retrieval using key
}
})
}
export async function updateAttachmentColumns(prodAppId: string, db: Database) {
// iterate through attachment documents and update them
const tables = await sdk.tables.getAllInternalTables(db)
let updatedRows: Row[] = []
for (let table of tables) {
const { rows, columns } = await sdk.rows.getRowsWithAttachments(
db.name,
table
)
updatedRows = updatedRows.concat(
rows.map(row => {
for (let column of columns) {
if (Array.isArray(row[column])) {
row[column] = row[column].map((attachment: RowAttachment) =>
rewriteAttachmentUrl(prodAppId, attachment)
)
}
}
return row
})
)
}
// write back the updated attachments
await db.bulkDocs(rows)
}
await db.bulkDocs(updatedRows)
}
async function updateAutomations(prodAppId: string, db: Database) {

View File

@ -0,0 +1,60 @@
import { CouchFindOptions, Table, Row } from "@budibase/types"
import { db as dbCore } from "@budibase/backend-core"
import { DocumentType, SEPARATOR } from "../../../db/utils"
import { FieldTypes } from "../../../constants"
// default limit - seems to work well for performance
export const FIND_LIMIT = 25
function generateAttachmentFindParams(
tableId: string,
attachmentCols: string[],
bookmark: null | string
) {
const params: CouchFindOptions = {
selector: {
_id: {
$regex: `^${DocumentType.ROW}${SEPARATOR}${tableId}`,
},
},
limit: FIND_LIMIT,
}
attachmentCols.forEach(col => (params.selector[col] = { $exists: true }))
if (bookmark) {
params.bookmark = bookmark
}
return params
}
export async function getRowsWithAttachments(appId: string, table: Table) {
// iterate through attachment documents and update them
const db = dbCore.getDB(appId)
const attachmentCols: string[] = []
for (let [key, column] of Object.entries(table.schema)) {
if (column.type === FieldTypes.ATTACHMENT) {
attachmentCols.push(key)
}
}
// no attachment columns, nothing to do
if (attachmentCols.length === 0) {
return { rows: [], columns: [] }
}
let bookmark: null | string = null,
rowsLength = 0,
rowList: Row[] = []
do {
const params = generateAttachmentFindParams(
table._id!,
attachmentCols,
bookmark
)
// use the CouchDB Mango query API to lookup rows that have attachments
const resp = await dbCore.directCouchFind(db.name, params)
bookmark = resp.bookmark
rowsLength = resp.rows.length
const rows = resp.rows
rowList = rowList.concat(rows)
} while (rowsLength === FIND_LIMIT)
// write back the updated attachments
return { rows: rowList, columns: attachmentCols }
}

View File

@ -0,0 +1,7 @@
import * as attachments from "./attachments"
import * as rows from "./rows"
export default {
...attachments,
...rows,
}

View File

@ -0,0 +1,18 @@
import { db as dbCore, context } from "@budibase/backend-core"
import { Database, Row } from "@budibase/types"
import { getRowParams } from "../../../db/utils"
export async function getAllInternalRows(appId?: string) {
let db: Database
if (appId) {
db = dbCore.getDB(appId)
} else {
db = context.getAppDB()
}
const response = await db.allDocs(
getRowParams(null, null, {
include_docs: true,
})
)
return response.rows.map(row => row.doc) as Row[]
}

View File

@ -2,6 +2,7 @@ import { default as backups } from "./app/backups"
import { default as tables } from "./app/tables"
import { default as automations } from "./app/automations"
import { default as applications } from "./app/applications"
import { default as rows } from "./app/rows"
import { default as users } from "./users"
const sdk = {
@ -9,6 +10,7 @@ const sdk = {
tables,
automations,
applications,
rows,
users,
}

View File

@ -0,0 +1,76 @@
import newid from "../../db/newid"
const attachment = {
size: 73479,
name: "2022-12-14 11_11_44-.png",
url: "/prod-budi-app-assets/app_bbb/attachments/a.png",
extension: "png",
key: "app_bbb/attachments/a.png",
}
const row = {
_id: "ro_ta_aaa",
photo: [attachment],
otherCol: "string",
}
const table = {
_id: "ta_aaa",
name: "photos",
schema: {
photo: {
type: "attachment",
name: "photo",
},
otherCol: {
type: "string",
name: "otherCol",
},
},
}
jest.mock("@budibase/backend-core", () => {
const core = jest.requireActual("@budibase/backend-core")
return {
...core,
db: {
...core.db,
directCouchFind: jest.fn(),
},
}
})
import { db as dbCore } from "@budibase/backend-core"
import sdk from "../index"
describe("should be able to re-write attachment URLs", () => {
it("it should update URLs on a number of rows over the limit", async () => {
const db = dbCore.getDB("app_aaa")
await db.put(table)
const limit = 30
let rows = []
for (let i = 0; i < limit; i++) {
const rowToWrite = {
...row,
_id: `${row._id}_${newid()}`,
}
const { rev } = await db.put(rowToWrite)
rows.push({
...rowToWrite,
_rev: rev,
})
}
dbCore.directCouchFind
// @ts-ignore
.mockReturnValueOnce({ rows: rows.slice(0, 25), bookmark: "aaa" })
.mockReturnValueOnce({ rows: rows.slice(25, limit), bookmark: "bbb" })
await sdk.backups.updateAttachmentColumns(db.name, db)
const finalRows = await sdk.rows.getAllInternalRows(db.name)
for (let rowToCheck of finalRows) {
expect(rowToCheck.otherCol).toBe(row.otherCol)
expect(rowToCheck.photo[0].url).toBe("")
expect(rowToCheck.photo[0].key).toBe(`${db.name}/attachments/a.png`)
}
})
})

View File

@ -419,7 +419,7 @@ class Orchestrator {
// Delete the step after the loop step as it's irrelevant, since information is included
// in the loop step
if (wasLoopStep) {
if (wasLoopStep && !loopStep) {
this._context.steps.splice(loopStepNumber + 1, 1)
wasLoopStep = false
}
@ -438,8 +438,8 @@ class Orchestrator {
})
this._context.steps[loopStepNumber] = tempOutput
loopSteps = undefined
wasLoopStep = true
loopSteps = []
}
}

View File

@ -1278,13 +1278,13 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.2.10-alpha.12":
version "2.2.10-alpha.12"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.10-alpha.12.tgz#57fbd4633b8475745f9d0bb968d24b173759aea3"
integrity sha512-gmx4DFO9s2yVlJPkWxOmicDDhIJhKjPM9+OhW1B8uBRCWhR4LMOFeM72fbSykgkzqlTFYinab8M6yiU40ko5Kg==
"@budibase/backend-core@2.2.12-alpha.5":
version "2.2.12-alpha.5"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.5.tgz#9e0f6b290a46f66a9cb982554d0c04212191426f"
integrity sha512-7BfgmF7j9rxbQiS0Kr1HRBok1zoZBGw/erN9wWSDsCIeubPnN897XkyMVSXmRwQnzOyKJBRklWriJWE00GDiHw==
dependencies:
"@budibase/nano" "10.1.1"
"@budibase/types" "2.2.10-alpha.12"
"@budibase/types" "2.2.12-alpha.5"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@ -1378,13 +1378,13 @@
qs "^6.11.0"
tough-cookie "^4.1.2"
"@budibase/pro@2.2.10-alpha.12":
version "2.2.10-alpha.12"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.10-alpha.12.tgz#ab356f6964faaff72289c170ee85468411c92c64"
integrity sha512-jSOlgbGEg1l1e0x/4Q7TqZSm1O58IDnupHJHiH9/zIORmxFNrC3jFczJT5NjbiZp4LEViObudzQyRCe9+6OYoQ==
"@budibase/pro@2.2.12-alpha.5":
version "2.2.12-alpha.5"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.5.tgz#c911ae3b5bcf915ccd9b084201f6f255342a220c"
integrity sha512-CWZEiq4k0vD0T9uWx3LQb3e3Vb1vHhtxNI8MRvJ56AWm1nvVYyHzU02QltWsZiuhiyrwLrtQjWbtfrEXc+5bwQ==
dependencies:
"@budibase/backend-core" "2.2.10-alpha.12"
"@budibase/types" "2.2.10-alpha.12"
"@budibase/backend-core" "2.2.12-alpha.5"
"@budibase/types" "2.2.12-alpha.5"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
@ -1409,10 +1409,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/types@2.2.10-alpha.12":
version "2.2.10-alpha.12"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.10-alpha.12.tgz#c400c8f5601314b2906029643b613870385b8608"
integrity sha512-Yb9vjr+WSRXZ90qAj7vXR4XzIpjOjgB/9GDWTR9XDn1Ul996RSar0J2e6Yla1D7As4ok7bV3aumT7At+Wk+4pw==
"@budibase/types@2.2.12-alpha.5":
version "2.2.12-alpha.5"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.5.tgz#f86f952f2be959014bc43a724423dc6ae2db5bc2"
integrity sha512-R+8YUIIrVWTMovpTByRQCGEFxnHUjNC2kVqgwL/AAxl9W7gUqYFC9Jl2XZqGRJFIifGYYp57Xvvt2XArV88WWA==
"@bull-board/api@3.7.0":
version "3.7.0"
@ -10428,9 +10428,9 @@ ltgt@2.2.1, ltgt@^2.1.2, ltgt@~2.2.0:
integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA==
luxon@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.0.1.tgz#6901111d10ad06fd267ad4e4128a84bef8a77299"
integrity sha512-hF3kv0e5gwHQZKz4wtm4c+inDtyc7elkanAsBq+fundaCdUBNJB1dHEGUZIM6SfSBUlbVFduPwEtNjFK8wLtcw==
version "3.2.1"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.2.1.tgz#14f1af209188ad61212578ea7e3d518d18cee45f"
integrity sha512-QrwPArQCNLAKGO/C+ZIilgIuDnEnKx5QYODdDtbFaxzsbZcc/a7WFq7MhsVYgRlwawLtvOUESTlfJ+hc/USqPg==
make-dir@^1.0.0:
version "1.3.0"

View File

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

View File

@ -2874,11 +2874,9 @@ json-parse-even-better-errors@^2.3.0:
integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==
json5@^2.1.2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3"
integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==
dependencies:
minimist "^1.2.5"
version "2.2.3"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.1.0, kind-of@^3.2.0:
version "3.2.2"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.2.10-alpha.12",
"version": "2.2.12-alpha.5",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -522,9 +522,9 @@ inherits@2, inherits@2.0.4:
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
json5@*:
version "2.2.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
version "2.2.3"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
koa-body@4.2.0:
version "4.2.0"

View File

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

View File

@ -475,13 +475,13 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.2.10-alpha.12":
version "2.2.10-alpha.12"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.10-alpha.12.tgz#57fbd4633b8475745f9d0bb968d24b173759aea3"
integrity sha512-gmx4DFO9s2yVlJPkWxOmicDDhIJhKjPM9+OhW1B8uBRCWhR4LMOFeM72fbSykgkzqlTFYinab8M6yiU40ko5Kg==
"@budibase/backend-core@2.2.12-alpha.5":
version "2.2.12-alpha.5"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.5.tgz#9e0f6b290a46f66a9cb982554d0c04212191426f"
integrity sha512-7BfgmF7j9rxbQiS0Kr1HRBok1zoZBGw/erN9wWSDsCIeubPnN897XkyMVSXmRwQnzOyKJBRklWriJWE00GDiHw==
dependencies:
"@budibase/nano" "10.1.1"
"@budibase/types" "2.2.10-alpha.12"
"@budibase/types" "2.2.12-alpha.5"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@ -525,23 +525,23 @@
qs "^6.11.0"
tough-cookie "^4.1.2"
"@budibase/pro@2.2.10-alpha.12":
version "2.2.10-alpha.12"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.10-alpha.12.tgz#ab356f6964faaff72289c170ee85468411c92c64"
integrity sha512-jSOlgbGEg1l1e0x/4Q7TqZSm1O58IDnupHJHiH9/zIORmxFNrC3jFczJT5NjbiZp4LEViObudzQyRCe9+6OYoQ==
"@budibase/pro@2.2.12-alpha.5":
version "2.2.12-alpha.5"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.5.tgz#c911ae3b5bcf915ccd9b084201f6f255342a220c"
integrity sha512-CWZEiq4k0vD0T9uWx3LQb3e3Vb1vHhtxNI8MRvJ56AWm1nvVYyHzU02QltWsZiuhiyrwLrtQjWbtfrEXc+5bwQ==
dependencies:
"@budibase/backend-core" "2.2.10-alpha.12"
"@budibase/types" "2.2.10-alpha.12"
"@budibase/backend-core" "2.2.12-alpha.5"
"@budibase/types" "2.2.12-alpha.5"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
jsonwebtoken "8.5.1"
node-fetch "^2.6.1"
"@budibase/types@2.2.10-alpha.12":
version "2.2.10-alpha.12"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.10-alpha.12.tgz#c400c8f5601314b2906029643b613870385b8608"
integrity sha512-Yb9vjr+WSRXZ90qAj7vXR4XzIpjOjgB/9GDWTR9XDn1Ul996RSar0J2e6Yla1D7As4ok7bV3aumT7At+Wk+4pw==
"@budibase/types@2.2.12-alpha.5":
version "2.2.12-alpha.5"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.5.tgz#f86f952f2be959014bc43a724423dc6ae2db5bc2"
integrity sha512-R+8YUIIrVWTMovpTByRQCGEFxnHUjNC2kVqgwL/AAxl9W7gUqYFC9Jl2XZqGRJFIifGYYp57Xvvt2XArV88WWA==
"@cspotcode/source-map-support@^0.8.0":
version "0.8.1"

View File

@ -1,3 +1,6 @@
## Checklist
- [ ] I have searched budibase discussions and github issues to check if my issue already exists
## Description
_Describe the problem or feature in addition to a link to the relevant github issues._

View File

@ -26,7 +26,10 @@ export default class TestConfiguration<T> {
}
async loginAsAdmin() {
await this.auth.login(<string>process.env.BB_ADMIN_USER_EMAIL, <string>process.env.BB_ADMIN_USER_PASSWORD)
await this.auth.login(
<string>process.env.BB_ADMIN_USER_EMAIL,
<string>process.env.BB_ADMIN_USER_PASSWORD
)
}
async login(email: string, password: string) {

View File

@ -38,8 +38,8 @@ export default class UserManagementApi {
const body = {
create: {
users: userList,
groups: []
}
groups: [],
},
}
const response = await this.api.post(`/global/users/bulk`, { body })
const json = await response.json()
@ -52,10 +52,8 @@ export default class UserManagementApi {
async deleteMultiple(userId: string[]): Promise<[Response, responseMessage]> {
const body = {
delete: {
userIds: [
userId
]
}
userIds: [userId],
},
}
const response = await this.api.post(`/global/users/bulk`, { body })
const json = await response.json()

View File

@ -13,13 +13,12 @@ export const generateApp = (
// Applications type doesn't work here, save to add useTemplate parameter?
export const appFromTemplate = (): any => {
return ({
return {
name: generator.word(),
url: `/${generator.word()}`,
useTemplate: "true",
templateName: "Near Miss Register",
templateKey: "app/near-miss-register",
templateFile: undefined,
})
}
}

View File

@ -1,79 +1,81 @@
import generator from "../../generator";
import { User } from "@budibase/types";
import generator from "../../generator"
import { User } from "@budibase/types"
const generateDeveloper = (): Partial<User> => {
const randomId = generator.guid();
return ({
const randomId = generator.guid()
return {
email: `pedro+${randomId}@budibase.com`,
password: randomId,
roles: {},
forceResetPassword: true,
builder: {
global: true
global: true,
},
}
})
}
const generateAdmin = (): Partial<User> => {
const randomId = generator.guid();
return ({
const randomId = generator.guid()
return {
email: `pedro+${randomId}@budibase.com`,
password: randomId,
roles: {},
forceResetPassword: true,
admin: {
global: true
global: true,
},
builder: {
global: true
global: true,
},
}
})
}
const generateAppUser = (): Partial<User> => {
const randomId = generator.guid();
return ({
const randomId = generator.guid()
return {
email: `pedro+${randomId}@budibase.com`,
password: randomId,
roles: {},
forceResetPassword: true,
admin: {
global: false
global: false,
},
builder: {
global: false
global: false,
},
}
})
}
export const generateInviteUser = (): Object[] => {
const randomId = generator.guid();
return [{
const randomId = generator.guid()
return [
{
email: `pedro+${randomId}@budibase.com`,
userInfo: {
userGroups: []
}
}]
userGroups: [],
},
},
]
}
export const generateUser = (amount: number = 1, role?: string): Partial<User>[] => {
const userList: Partial<User>[] = [];
export const generateUser = (
amount: number = 1,
role?: string
): Partial<User>[] => {
const userList: Partial<User>[] = []
for (let i = 0; i < amount; i++) {
switch (role) {
case "admin":
userList.push(generateAdmin());
break;
userList.push(generateAdmin())
break
case "developer":
userList.push(generateDeveloper());
break;
userList.push(generateDeveloper())
break
case "appUser":
userList.push(generateAppUser());
break;
userList.push(generateAppUser())
break
default:
userList.push(generateAppUser());
break;
userList.push(generateAppUser())
break
}
}
return userList

View File

@ -2,7 +2,10 @@ import TestConfiguration from "../../../config/internal-api/TestConfiguration"
import { Application } from "@budibase/server/api/controllers/public/mapping/types"
import { db } from "@budibase/backend-core"
import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
import { generateApp, appFromTemplate } from "../../../config/internal-api/fixtures/applications"
import {
generateApp,
appFromTemplate,
} from "../../../config/internal-api/fixtures/applications"
import generator from "../../../config/generator"
import generateScreen from "../../../config/internal-api/fixtures/screens"
@ -18,7 +21,6 @@ describe("Internal API - Application creation, update, publish and delete", () =
await config.afterAll()
})
it("Get applications without applications", async () => {
await config.applications.fetchEmptyAppList()
})

View File

@ -1,7 +1,10 @@
import TestConfiguration from "../../../config/internal-api/TestConfiguration"
import { App } from "@budibase/types"
import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
import { generateApp, appFromTemplate } from "../../../config/internal-api/fixtures/applications"
import {
generateApp,
appFromTemplate,
} from "../../../config/internal-api/fixtures/applications"
import { Screen } from "@budibase/types"
import generateScreen from "../../../config/internal-api/fixtures/screens"

View File

@ -1,10 +1,16 @@
import TestConfiguration from "../../../config/internal-api/TestConfiguration"
import { Application } from "@budibase/server/api/controllers/public/mapping/types"
import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient"
import { generateApp, appFromTemplate } from "../../../config/internal-api/fixtures/applications"
import {
generateApp,
appFromTemplate,
} from "../../../config/internal-api/fixtures/applications"
import { generateUser } from "../../../config/internal-api/fixtures/userManagement"
import { User } from "@budibase/types"
import { generateNewColumnForTable, generateTable } from "../../../config/internal-api/fixtures/table"
import {
generateNewColumnForTable,
generateTable,
} from "../../../config/internal-api/fixtures/table"
import generateScreen from "../../../config/internal-api/fixtures/screens"
import { db } from "@budibase/backend-core"
@ -25,31 +31,37 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] = await config.users.addMultiple(
appUser
)
const app = await config.applications.create(appFromTemplate())
config.applications.api.appId = app.appId
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
roles: {
[<string>app.appId]: "BASIC",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[<string>app.appId]).toBeDefined()
expect(changedUserInfoJson.roles[<string>app.appId]).toEqual("BASIC")
})
it("Add ADMIN user to app", async () => {
const adminUser = generateUser(1, "admin")
expect(adminUser[0].builder?.global).toEqual(true)
expect(adminUser[0].admin?.global).toEqual(true)
const [createUserResponse, createUserJson] = await config.users.addMultiple(adminUser)
const [createUserResponse, createUserJson] = await config.users.addMultiple(
adminUser
)
//const app = await config.applications.create(generateApp())
//config.applications.api.appId = app.appId
@ -57,16 +69,19 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const app = await config.applications.create(appFromTemplate())
config.applications.api.appId = app.appId
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
roles: {
[<string>app.appId]: "ADMIN",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[<string>app.appId]).toBeDefined()
expect(changedUserInfoJson.roles[<string>app.appId]).toEqual("ADMIN")
@ -75,31 +90,34 @@ describe("Internal API - App Specific Roles & Permissions", () => {
// check published app renders
config.applications.api.appId = db.getProdAppID(app.appId!)
await config.applications.canRender()
})
it("Add POWER user to app", async () => {
const powerUser = generateUser(1, 'developer')
const powerUser = generateUser(1, "developer")
expect(powerUser[0].builder?.global).toEqual(true)
const [createUserResponse, createUserJson] = await config.users.addMultiple(powerUser)
const [createUserResponse, createUserJson] = await config.users.addMultiple(
powerUser
)
const app = await config.applications.create(generateApp())
config.applications.api.appId = app.appId
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
roles: {
[<string>app.appId]: "POWER",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[<string>app.appId]).toBeDefined()
expect(changedUserInfoJson.roles[<string>app.appId]).toEqual("POWER")
})
describe("Check Access for default roles", () => {
@ -107,21 +125,25 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
const app = await config.applications.create(generateApp())
config.applications.api.appId = app.appId
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
roles: {
[<string>app.appId]: "BASIC",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[<string>app.appId]).toBeDefined()
expect(changedUserInfoJson.roles[<string>app.appId]).toEqual("BASIC")
@ -130,37 +152,43 @@ describe("Internal API - App Specific Roles & Permissions", () => {
)
await config.login(<string>appUser[0].email, <string>appUser[0].password)
const newColumn = generateNewColumnForTable(createdTableData)
await config.tables.forbiddenSave(
newColumn)
await config.tables.forbiddenSave(newColumn)
await config.tables.forbiddenSave(generateTable())
})
it("Check Table access for developer", async () => {
const developer = generateUser(1, 'developer')
const developer = generateUser(1, "developer")
expect(developer[0].builder?.global).toEqual(true)
const [createUserResponse, createUserJson] = await config.users.addMultiple(developer)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(developer)
const app = await config.applications.create(generateApp())
config.applications.api.appId = app.appId
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
roles: {
[<string>app.appId]: "POWER",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[<string>app.appId]).toBeDefined()
expect(changedUserInfoJson.roles[<string>app.appId]).toEqual("POWER")
const [createdTableResponse, createdTableData] = await config.tables.save(
generateTable()
)
await config.login(<string>developer[0].email, <string>developer[0].password)
await config.login(
<string>developer[0].email,
<string>developer[0].password
)
const newColumn = generateNewColumnForTable(createdTableData)
const [addColumnResponse, addColumnData] = await config.tables.save(
newColumn,
@ -172,25 +200,32 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const adminUser = generateUser(1, "admin")
expect(adminUser[0].builder?.global).toEqual(true)
expect(adminUser[0].admin?.global).toEqual(true)
const [createUserResponse, createUserJson] = await config.users.addMultiple(adminUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(adminUser)
const app = await config.applications.create(generateApp())
config.applications.api.appId = app.appId
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
roles: {
[<string>app.appId]: "ADMIN",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[<string>app.appId]).toBeDefined()
expect(changedUserInfoJson.roles[<string>app.appId]).toEqual("ADMIN")
await config.login(<string>adminUser[0].email, <string>adminUser[0].password)
await config.login(
<string>adminUser[0].email,
<string>adminUser[0].password
)
const [createdTableResponse, createdTableData] = await config.tables.save(
generateTable()
)
@ -208,14 +243,17 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
config.applications.api.appId = app.appId
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -223,11 +261,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: "BASIC",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual("BASIC")
@ -236,7 +275,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -245,7 +285,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(1)
expect(appPackageJson.screens[0].routing.roleId).toEqual("BASIC")
@ -256,14 +297,17 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
config.applications.api.appId = app.appId
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -271,11 +315,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: "POWER",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual("POWER")
@ -284,7 +329,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -293,7 +339,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(2)
})
@ -303,14 +350,17 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
config.applications.api.appId = app.appId
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -318,11 +368,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: "ADMIN",
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual("ADMIN")
@ -331,7 +382,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -340,7 +392,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(3)
})
@ -351,7 +404,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
@ -361,14 +415,15 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const role = {
inherits: "BASIC",
permissionId: "public",
name: "level 1"
name: "level 1",
}
const [createRoleResponse, createRoleJson] = await config.users.createRole(role)
const [createRoleResponse, createRoleJson] =
await config.users.createRole(role)
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -376,11 +431,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: createRoleJson._id,
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id)
@ -389,7 +445,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -398,15 +455,18 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(1)
})
it("Custom role access for level 2 permissions", async () => {// Set up user
it("Custom role access for level 2 permissions", async () => {
// Set up user
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
@ -416,14 +476,15 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const role = {
inherits: "BASIC",
permissionId: "read_only",
name: "level 2"
name: "level 2",
}
const [createRoleResponse, createRoleJson] = await config.users.createRole(role)
const [createRoleResponse, createRoleJson] =
await config.users.createRole(role)
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -431,11 +492,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: createRoleJson._id,
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id)
@ -444,7 +506,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -453,7 +516,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(1)
})
@ -461,7 +525,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
@ -471,14 +536,15 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const role = {
inherits: "BASIC",
permissionId: "write",
name: "level 3"
name: "level 3",
}
const [createRoleResponse, createRoleJson] = await config.users.createRole(role)
const [createRoleResponse, createRoleJson] =
await config.users.createRole(role)
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -486,11 +552,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: createRoleJson._id,
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id)
@ -499,7 +566,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -508,7 +576,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(1)
})
@ -516,7 +585,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
@ -526,14 +596,15 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const role = {
inherits: "BASIC",
permissionId: "power",
name: "level 4"
name: "level 4",
}
const [createRoleResponse, createRoleJson] = await config.users.createRole(role)
const [createRoleResponse, createRoleJson] =
await config.users.createRole(role)
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -541,11 +612,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: createRoleJson._id,
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id)
@ -554,7 +626,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -563,7 +636,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(1)
})
@ -571,7 +645,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const appUser = generateUser()
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser)
const [createUserResponse, createUserJson] =
await config.users.addMultiple(appUser)
// Create App
const app = await config.applications.create(generateApp())
@ -581,14 +656,15 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const role = {
inherits: "BASIC",
permissionId: "admin",
name: "level 5"
name: "level 5",
}
const [createRoleResponse, createRoleJson] = await config.users.createRole(role)
const [createRoleResponse, createRoleJson] =
await config.users.createRole(role)
// Update user roles
const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
createUserJson.created.successful[0]._id
)
const prodAppId = db.getProdAppID(app.appId!)
// Roles must always be set with prod appID
@ -596,11 +672,12 @@ describe("Internal API - App Specific Roles & Permissions", () => {
...userInfoJson,
roles: {
[prodAppId]: createRoleJson._id,
}
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(createUserJson.created.successful[0]._id)
expect(changedUserInfoJson.roles[prodAppId]).toBeDefined()
expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id)
@ -609,7 +686,8 @@ describe("Internal API - App Specific Roles & Permissions", () => {
await config.screen.create(generateScreen("ADMIN"))
await config.applications.publish(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] = await config.applications.getAppPackage(<string>app.appId)
const [firstappPackageResponse, firstappPackageJson] =
await config.applications.getAppPackage(<string>app.appId)
expect(firstappPackageJson.screens).toBeDefined()
expect(firstappPackageJson.screens.length).toEqual(3)
@ -618,10 +696,10 @@ describe("Internal API - App Specific Roles & Permissions", () => {
const [selfInfoResponse, selfInfoJson] = await config.users.getSelf()
// fetch app package
const [appPackageResponse, appPackageJson] = await config.applications.getAppPackage(app.appId!)
const [appPackageResponse, appPackageJson] =
await config.applications.getAppPackage(app.appId!)
expect(appPackageJson.screens).toBeDefined()
expect(appPackageJson.screens.length).toEqual(1)
})
})
})

View File

@ -36,9 +36,6 @@ describe("Internal API - User Management & Permissions", () => {
const [allUsersResponse, allUsersJson] = await config.users.getAll()
expect(allUsersJson.length).toBeGreaterThan(0)
})
it("Delete User", async () => {
@ -55,11 +52,12 @@ describe("Internal API - User Management & Permissions", () => {
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [userResponse, userJson] = await config.users.addMultiple(appUser)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(userJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
userJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
password: "newPassword"
password: "newPassword",
}
await config.users.forcePasswordReset(body)
})
@ -69,22 +67,22 @@ describe("Internal API - User Management & Permissions", () => {
expect(appUser[0].builder?.global).toEqual(false)
expect(appUser[0].admin?.global).toEqual(false)
const [userResponse, userJson] = await config.users.addMultiple(appUser)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(userJson.created.successful[0]._id)
const [userInfoResponse, userInfoJson] = await config.users.getInfo(
userJson.created.successful[0]._id
)
const body: User = {
...userInfoJson,
firstName: "newFirstName",
lastName: "newLastName",
builder: {
global: true
}
global: true,
},
}
await config.users.updateInfo(body)
const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(userJson.created.successful[0]._id)
const [changedUserInfoResponse, changedUserInfoJson] =
await config.users.getInfo(userJson.created.successful[0]._id)
expect(changedUserInfoJson.builder?.global).toBeDefined()
expect(changedUserInfoJson.builder?.global).toEqual(true)
})
})

View File

@ -73,15 +73,15 @@ describe("Public API - /applications endpoints", () => {
})
it("POST - unpublish an unpublished application", async () => {
const [response] = await config.applications.unpublish(
config.context._id
)
const [response] = await config.applications.unpublish(config.context._id)
expect(response).toHaveStatusCode(400)
})
it("DELETE - delete a published application and the dev application", async () => {
await config.applications.publish(config.context._id)
const [response, deletion] = await config.applications.delete(config.context._id)
const [response, deletion] = await config.applications.delete(
config.context._id
)
expect(response).toHaveStatusCode(200)
expect(deletion._id).toEqual(config.context._id)