Merge branch 'develop' of github.com:Budibase/budibase into frontend-core
This commit is contained in:
commit
04d53a709c
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/backend-core",
|
"name": "@budibase/backend-core",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"description": "Budibase backend core libraries used in server and worker",
|
"description": "Budibase backend core libraries used in server and worker",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -146,8 +146,9 @@ exports.getRole = async roleId => {
|
||||||
* Simple function to get all the roles based on the top level user role ID.
|
* Simple function to get all the roles based on the top level user role ID.
|
||||||
*/
|
*/
|
||||||
async function getAllUserRoles(userRoleId) {
|
async function getAllUserRoles(userRoleId) {
|
||||||
if (!userRoleId) {
|
// admins have access to all roles
|
||||||
return [BUILTIN_IDS.BASIC]
|
if (userRoleId === BUILTIN_IDS.ADMIN) {
|
||||||
|
return exports.getAllRoles()
|
||||||
}
|
}
|
||||||
let currentRole = await exports.getRole(userRoleId)
|
let currentRole = await exports.getRole(userRoleId)
|
||||||
let roles = currentRole ? [currentRole] : []
|
let roles = currentRole ? [currentRole] : []
|
||||||
|
|
|
@ -256,7 +256,7 @@ exports.saveUser = async (
|
||||||
exports.platformLogout = async ({ ctx, userId, keepActiveSession }) => {
|
exports.platformLogout = async ({ ctx, userId, keepActiveSession }) => {
|
||||||
if (!ctx) throw new Error("Koa context must be supplied to logout.")
|
if (!ctx) throw new Error("Koa context must be supplied to logout.")
|
||||||
|
|
||||||
const currentSession = this.getCookie(ctx, Cookies.Auth)
|
const currentSession = exports.getCookie(ctx, Cookies.Auth)
|
||||||
let sessions = await getUserSessions(userId)
|
let sessions = await getUserSessions(userId)
|
||||||
|
|
||||||
if (keepActiveSession) {
|
if (keepActiveSession) {
|
||||||
|
@ -265,8 +265,8 @@ exports.platformLogout = async ({ ctx, userId, keepActiveSession }) => {
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// clear cookies
|
// clear cookies
|
||||||
this.clearCookie(ctx, Cookies.Auth)
|
exports.clearCookie(ctx, Cookies.Auth)
|
||||||
this.clearCookie(ctx, Cookies.CurrentApp)
|
exports.clearCookie(ctx, Cookies.CurrentApp)
|
||||||
}
|
}
|
||||||
|
|
||||||
await invalidateSessions(
|
await invalidateSessions(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/bbui",
|
"name": "@budibase/bbui",
|
||||||
"description": "A UI solution used in the different Budibase projects.",
|
"description": "A UI solution used in the different Budibase projects.",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"module": "dist/bbui.es.js",
|
"module": "dist/bbui.es.js",
|
||||||
|
|
|
@ -8,10 +8,35 @@
|
||||||
copyToClipboard(value)
|
copyToClipboard(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipboard(value) {
|
const copyToClipboard = value => {
|
||||||
navigator.clipboard.writeText(value).then(() => {
|
return new Promise(res => {
|
||||||
notifications.success("Copied")
|
if (navigator.clipboard && window.isSecureContext) {
|
||||||
|
// Try using the clipboard API first
|
||||||
|
navigator.clipboard.writeText(value).then(res)
|
||||||
|
} else {
|
||||||
|
// Fall back to the textarea hack
|
||||||
|
let textArea = document.createElement("textarea")
|
||||||
|
textArea.value = value
|
||||||
|
textArea.style.position = "fixed"
|
||||||
|
textArea.style.left = "-9999px"
|
||||||
|
textArea.style.top = "-9999px"
|
||||||
|
document.body.appendChild(textArea)
|
||||||
|
textArea.focus()
|
||||||
|
textArea.select()
|
||||||
|
document.execCommand("copy")
|
||||||
|
textArea.remove()
|
||||||
|
res()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
notifications.success("Copied to clipboard")
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
notifications.error(
|
||||||
|
"Failed to copy to clipboard. Check the dev console for the value."
|
||||||
|
)
|
||||||
|
console.warn("Failed to copy the value", value)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -64,10 +64,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.49-alpha.9",
|
"@budibase/bbui": "^1.0.49-alpha.14",
|
||||||
"@budibase/client": "^1.0.49-alpha.9",
|
"@budibase/client": "^1.0.49-alpha.14",
|
||||||
"@budibase/frontend-core": "^1.0.49-alpha.9",
|
"@budibase/frontend-core": "^1.0.49-alpha.14",
|
||||||
"@budibase/string-templates": "^1.0.49-alpha.9",
|
"@budibase/string-templates": "^1.0.49-alpha.14",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
|
|
@ -64,6 +64,9 @@ export const getFrontendStore = () => {
|
||||||
const store = writable({ ...INITIAL_FRONTEND_STATE })
|
const store = writable({ ...INITIAL_FRONTEND_STATE })
|
||||||
|
|
||||||
store.actions = {
|
store.actions = {
|
||||||
|
reset: () => {
|
||||||
|
store.set({ ...INITIAL_FRONTEND_STATE })
|
||||||
|
},
|
||||||
initialise: async pkg => {
|
initialise: async pkg => {
|
||||||
const { layouts, screens, application, clientLibPath } = pkg
|
const { layouts, screens, application, clientLibPath } = pkg
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
import Logo from "assets/bb-emblem.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
import UpgradeModal from "components/upgrade/UpgradeModal.svelte"
|
import UpgradeModal from "components/upgrade/UpgradeModal.svelte"
|
||||||
import { onMount } from "svelte"
|
import { onMount, onDestroy } from "svelte"
|
||||||
|
|
||||||
export let application
|
export let application
|
||||||
|
|
||||||
|
@ -73,6 +73,10 @@
|
||||||
hasSynced = true
|
hasSynced = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
store.actions.reset()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#await promise}
|
{#await promise}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -1583,9 +1583,9 @@ simple-concat@^1.0.0:
|
||||||
integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==
|
integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==
|
||||||
|
|
||||||
simple-get@^3.0.3:
|
simple-get@^3.0.3:
|
||||||
version "3.1.0"
|
version "3.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3"
|
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.1.tgz#cc7ba77cfbe761036fbfce3d021af25fc5584d55"
|
||||||
integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==
|
integrity sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==
|
||||||
dependencies:
|
dependencies:
|
||||||
decompress-response "^4.2.0"
|
decompress-response "^4.2.0"
|
||||||
once "^1.3.1"
|
once "^1.3.1"
|
||||||
|
|
|
@ -2537,6 +2537,11 @@
|
||||||
"label": "Placeholder",
|
"label": "Placeholder",
|
||||||
"key": "placeholder"
|
"key": "placeholder"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "Default value",
|
||||||
|
"key": "defaultValue"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Autocomplete",
|
"label": "Autocomplete",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"module": "dist/budibase-client.js",
|
"module": "dist/budibase-client.js",
|
||||||
"main": "dist/budibase-client.js",
|
"main": "dist/budibase-client.js",
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.49-alpha.9",
|
"@budibase/bbui": "^1.0.49-alpha.14",
|
||||||
"@budibase/frontend-core": "^1.0.49-alpha.9",
|
"@budibase/frontend-core": "^1.0.49-alpha.14",
|
||||||
"@budibase/string-templates": "^1.0.49-alpha.9",
|
"@budibase/string-templates": "^1.0.49-alpha.14",
|
||||||
"regexparam": "^1.3.0",
|
"regexparam": "^1.3.0",
|
||||||
"rollup-plugin-polyfill-node": "^0.8.0",
|
"rollup-plugin-polyfill-node": "^0.8.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let validation
|
export let validation
|
||||||
export let autocomplete = false
|
export let autocomplete = false
|
||||||
|
export let defaultValue
|
||||||
|
|
||||||
let fieldState
|
let fieldState
|
||||||
let fieldApi
|
let fieldApi
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
$: singleValue = flatten(fieldState?.value)?.[0]
|
$: singleValue = flatten(fieldState?.value)?.[0]
|
||||||
$: multiValue = flatten(fieldState?.value) ?? []
|
$: multiValue = flatten(fieldState?.value) ?? []
|
||||||
$: component = multiselect ? CoreMultiselect : CoreSelect
|
$: component = multiselect ? CoreMultiselect : CoreSelect
|
||||||
|
$: expandedDefaultValue = expand(defaultValue)
|
||||||
|
|
||||||
const fetchTable = async id => {
|
const fetchTable = async id => {
|
||||||
if (id) {
|
if (id) {
|
||||||
|
@ -66,6 +68,16 @@
|
||||||
const multiHandler = e => {
|
const multiHandler = e => {
|
||||||
fieldApi.setValue(e.detail)
|
fieldApi.setValue(e.detail)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const expand = values => {
|
||||||
|
if (!values) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if (Array.isArray(values)) {
|
||||||
|
return values
|
||||||
|
}
|
||||||
|
return values.split(",").map(value => value.trim())
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
|
@ -73,11 +85,11 @@
|
||||||
{field}
|
{field}
|
||||||
{disabled}
|
{disabled}
|
||||||
{validation}
|
{validation}
|
||||||
|
defaultValue={expandedDefaultValue}
|
||||||
type={FieldTypes.LINK}
|
type={FieldTypes.LINK}
|
||||||
bind:fieldState
|
bind:fieldState
|
||||||
bind:fieldApi
|
bind:fieldApi
|
||||||
bind:fieldSchema
|
bind:fieldSchema
|
||||||
defaultValue={[]}
|
|
||||||
>
|
>
|
||||||
{#if fieldState}
|
{#if fieldState}
|
||||||
<svelte:component
|
<svelte:component
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/frontend-core",
|
"name": "@budibase/frontend-core",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"description": "Budibase frontend core libraries used in builder and client",
|
"description": "Budibase frontend core libraries used in builder and client",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.49-alpha.9",
|
"@budibase/bbui": "^1.0.49-alpha.14",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"svelte": "^3.46.2"
|
"svelte": "^3.46.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -70,9 +70,9 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/swagger-parser": "^10.0.3",
|
"@apidevtools/swagger-parser": "^10.0.3",
|
||||||
"@budibase/backend-core": "^1.0.49-alpha.9",
|
"@budibase/backend-core": "^1.0.49-alpha.14",
|
||||||
"@budibase/client": "^1.0.49-alpha.9",
|
"@budibase/client": "^1.0.49-alpha.14",
|
||||||
"@budibase/string-templates": "^1.0.49-alpha.9",
|
"@budibase/string-templates": "^1.0.49-alpha.14",
|
||||||
"@bull-board/api": "^3.7.0",
|
"@bull-board/api": "^3.7.0",
|
||||||
"@bull-board/koa": "^3.7.0",
|
"@bull-board/koa": "^3.7.0",
|
||||||
"@elastic/elasticsearch": "7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM mcr.microsoft.com/mssql/server
|
FROM mcr.microsoft.com/mssql/server:2017-latest
|
||||||
|
|
||||||
ENV ACCEPT_EULA=Y
|
ENV ACCEPT_EULA=Y
|
||||||
ENV SA_PASSWORD=Passw0rd
|
ENV SA_PASSWORD=Passw0rd
|
||||||
|
|
|
@ -48,7 +48,20 @@ INSERT tasks
|
||||||
VALUES
|
VALUES
|
||||||
('Processing', 1);
|
('Processing', 1);
|
||||||
|
|
||||||
INSERT people
|
INSERT INTO people (name, age)
|
||||||
(name, age)
|
VALUES ('Bob', '30'),
|
||||||
VALUES
|
('Bert', '10'),
|
||||||
('Bob', '30');
|
('Jack', '12'),
|
||||||
|
('Mike', '31'),
|
||||||
|
('Dave', '44'),
|
||||||
|
('Jim', '43'),
|
||||||
|
('Kerry', '32'),
|
||||||
|
('Julie', '12'),
|
||||||
|
('Kim', '55'),
|
||||||
|
('Andy', '33'),
|
||||||
|
('John', '22'),
|
||||||
|
('Ruth', '66'),
|
||||||
|
('Robert', '88'),
|
||||||
|
('Bobert', '99'),
|
||||||
|
('Jan', '22'),
|
||||||
|
('Megan', '11');
|
||||||
|
|
|
@ -16,7 +16,7 @@ const { clientLibraryPath } = require("../../../utilities")
|
||||||
const { upload } = require("../../../utilities/fileSystem")
|
const { upload } = require("../../../utilities/fileSystem")
|
||||||
const { attachmentsRelativeURL } = require("../../../utilities")
|
const { attachmentsRelativeURL } = require("../../../utilities")
|
||||||
const { DocumentTypes } = require("../../../db/utils")
|
const { DocumentTypes } = require("../../../db/utils")
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB, updateAppId } = require("@budibase/backend-core/context")
|
||||||
const AWS = require("aws-sdk")
|
const AWS = require("aws-sdk")
|
||||||
const AWS_REGION = env.AWS_REGION ? env.AWS_REGION : "eu-west-1"
|
const AWS_REGION = env.AWS_REGION ? env.AWS_REGION : "eu-west-1"
|
||||||
|
|
||||||
|
@ -49,11 +49,9 @@ async function getAppIdFromUrl(ctx) {
|
||||||
a => a.url && a.url.toLowerCase() === possibleAppUrl
|
a => a.url && a.url.toLowerCase() === possibleAppUrl
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
if (app && app.appId) {
|
const appId = app && app.appId ? app.appId : ctx.params.appId
|
||||||
return app.appId
|
updateAppId(appId)
|
||||||
} else {
|
return appId
|
||||||
return ctx.params.appId
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.serveBuilder = async function (ctx) {
|
exports.serveBuilder = async function (ctx) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ const {
|
||||||
dbExists,
|
dbExists,
|
||||||
} = require("@budibase/backend-core/db")
|
} = require("@budibase/backend-core/db")
|
||||||
const { UserStatus } = require("@budibase/backend-core/constants")
|
const { UserStatus } = require("@budibase/backend-core/constants")
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB, doInAppContext } = require("@budibase/backend-core/context")
|
||||||
|
|
||||||
async function rawMetadata() {
|
async function rawMetadata() {
|
||||||
const db = getAppDB()
|
const db = getAppDB()
|
||||||
|
@ -105,34 +105,36 @@ exports.syncUser = async function (ctx) {
|
||||||
if (!(await dbExists(appId))) {
|
if (!(await dbExists(appId))) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const db = getAppDB()
|
await doInAppContext(appId, async () => {
|
||||||
const metadataId = generateUserMetadataID(userId)
|
const db = getAppDB()
|
||||||
let metadata
|
const metadataId = generateUserMetadataID(userId)
|
||||||
try {
|
let metadata
|
||||||
metadata = await db.get(metadataId)
|
try {
|
||||||
} catch (err) {
|
metadata = await db.get(metadataId)
|
||||||
if (deleting) {
|
} catch (err) {
|
||||||
continue
|
if (deleting) {
|
||||||
}
|
return
|
||||||
metadata = {
|
|
||||||
tableId: InternalTables.USER_METADATA,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// assign the roleId for the metadata doc
|
|
||||||
if (roleId) {
|
|
||||||
metadata.roleId = roleId
|
|
||||||
}
|
|
||||||
let combined = !deleting
|
|
||||||
? combineMetadataAndUser(user, metadata)
|
|
||||||
: {
|
|
||||||
...metadata,
|
|
||||||
status: UserStatus.INACTIVE,
|
|
||||||
metadata: BUILTIN_ROLE_IDS.PUBLIC,
|
|
||||||
}
|
}
|
||||||
// if its null then there was no updates required
|
metadata = {
|
||||||
if (combined) {
|
tableId: InternalTables.USER_METADATA,
|
||||||
await db.put(combined)
|
}
|
||||||
}
|
}
|
||||||
|
// assign the roleId for the metadata doc
|
||||||
|
if (roleId) {
|
||||||
|
metadata.roleId = roleId
|
||||||
|
}
|
||||||
|
let combined = !deleting
|
||||||
|
? combineMetadataAndUser(user, metadata)
|
||||||
|
: {
|
||||||
|
...metadata,
|
||||||
|
status: UserStatus.INACTIVE,
|
||||||
|
metadata: BUILTIN_ROLE_IDS.PUBLIC,
|
||||||
|
}
|
||||||
|
// if its null then there was no updates required
|
||||||
|
if (combined) {
|
||||||
|
await db.put(combined)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
|
|
|
@ -166,15 +166,13 @@ class InternalBuilder {
|
||||||
|
|
||||||
addSorting(query: KnexQuery, json: QueryJson): KnexQuery {
|
addSorting(query: KnexQuery, json: QueryJson): KnexQuery {
|
||||||
let { sort, paginate } = json
|
let { sort, paginate } = json
|
||||||
if (!sort) {
|
|
||||||
return query
|
|
||||||
}
|
|
||||||
const table = json.meta?.table
|
const table = json.meta?.table
|
||||||
for (let [key, value] of Object.entries(sort)) {
|
if (sort) {
|
||||||
const direction = value === SortDirection.ASCENDING ? "asc" : "desc"
|
for (let [key, value] of Object.entries(sort)) {
|
||||||
query = query.orderBy(`${table?.name}.${key}`, direction)
|
const direction = value === SortDirection.ASCENDING ? "asc" : "desc"
|
||||||
}
|
query = query.orderBy(`${table?.name}.${key}`, direction)
|
||||||
if (this.client === SqlClients.MS_SQL && !sort && paginate?.limit) {
|
}
|
||||||
|
} else if (this.client === SqlClients.MS_SQL && paginate?.limit) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
query = query.orderBy(`${table?.name}.${table?.primary[0]}`)
|
query = query.orderBy(`${table?.name}.${table?.primary[0]}`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"description": "Handlebars wrapper for Budibase templating.",
|
"description": "Handlebars wrapper for Budibase templating.",
|
||||||
"main": "src/index.cjs",
|
"main": "src/index.cjs",
|
||||||
"module": "dist/bundle.mjs",
|
"module": "dist/bundle.mjs",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.49-alpha.9",
|
"version": "1.0.49-alpha.14",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -34,8 +34,8 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "^1.0.49-alpha.9",
|
"@budibase/backend-core": "^1.0.49-alpha.14",
|
||||||
"@budibase/string-templates": "^1.0.49-alpha.9",
|
"@budibase/string-templates": "^1.0.49-alpha.14",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"@sentry/node": "^6.0.0",
|
"@sentry/node": "^6.0.0",
|
||||||
"@techpass/passport-openidconnect": "^0.3.0",
|
"@techpass/passport-openidconnect": "^0.3.0",
|
||||||
|
|
Loading…
Reference in New Issue