1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00

Merge branch 'master' into budi-7859-docker-compose-up-1-errors-decoding-error-decoding-command

This commit is contained in:
Michael Drury 2024-01-04 18:33:31 +00:00 committed by GitHub
commit f8965a437f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 149 additions and 889 deletions

View file

@ -252,4 +252,10 @@ spec:
{{ end }}
restartPolicy: Always
serviceAccountName: ""
{{ if .Values.services.apps.ndots }}
dnsConfig:
options:
- name: ndots
value: {{ .Values.services.apps.ndots | quote }}
{{ end }}
status: {}

View file

@ -227,6 +227,7 @@ spec:
resources:
{{- toYaml . | nindent 10 }}
{{ end }}
{{ if .Values.services.automationWorkers.command }}
command:
{{- toYaml .Values.services.automationWorkers.command | nindent 10 }}
{{ end }}
@ -251,6 +252,11 @@ spec:
{{ end }}
restartPolicy: Always
serviceAccountName: ""
{{ if .Values.services.automationWorkers.command }}}
{{ if .Values.services.automationWorkers.ndots }}
dnsConfig:
options:
- name: ndots
value: {{ .Values.services.automationWorkers.ndots | quote }}
{{ end }}
status: {}
{{- end }}

View file

@ -109,4 +109,10 @@ spec:
{{- toYaml .Values.services.proxy.args | nindent 8 }}
{{ end }}
volumes:
{{ if .Values.services.proxy.ndots }}
dnsConfig:
options:
- name: ndots
value: {{ .Values.services.proxy.ndots | quote }}
{{ end }}
status: {}

View file

@ -238,4 +238,10 @@ spec:
{{ end }}
restartPolicy: Always
serviceAccountName: ""
{{ if .Values.services.worker.ndots }}
dnsConfig:
options:
- name: ndots
value: {{ .Values.services.worker.ndots | quote }}
{{ end }}
status: {}

View file

@ -1,5 +1,5 @@
{
"version": "2.14.0",
"version": "2.14.2",
"npmClient": "yarn",
"packages": [
"packages/*",

View file

@ -2,7 +2,6 @@ import Redlock from "redlock"
import { getLockClient } from "./init"
import { LockOptions, LockType } from "@budibase/types"
import * as context from "../context"
import { logWarn } from "../logging"
import { utils } from "@budibase/shared-core"
import { Duration } from "../utils"

View file

@ -50,7 +50,7 @@ export class ExecutionTimeTracker {
return this.totalTimeMs
}
private checkLimit() {
checkLimit() {
if (this.totalTimeMs > this.limitMs) {
throw new ExecutionTimeoutError(
`Execution time limit of ${this.limitMs}ms exceeded: ${this.totalTimeMs}ms`

View file

@ -53,6 +53,7 @@
export let value = ""
export let placeholder = null
export let autocompleteEnabled = true
export let autofocus = false
// Export a function to expose caret position
export const getCaretPosition = () => {
@ -241,6 +242,12 @@
})
}
$: {
if (autofocus && isEditorInitialised) {
editor.focus()
}
}
$: editorHeight = typeof height === "number" ? `${height}px` : height
// Init when all elements are ready

View file

@ -45,6 +45,7 @@
export let valid
export let allowJS = false
export let allowHelpers = true
export let autofocusEditor = false
const drawerActions = getContext("drawer-actions")
const bindingDrawerActions = getContext("binding-drawer-actions")
@ -199,6 +200,7 @@
]}
placeholder=""
height="100%"
autofocus={autofocusEditor}
/>
</div>
<div class="binding-footer">
@ -301,6 +303,7 @@
bind:getCaretPosition
bind:insertAtPos
height="100%"
autofocus={autofocusEditor}
/>
</div>
<div class="binding-footer">

View file

@ -6,6 +6,7 @@
export let value = ""
export let allowJS = false
export let allowHelpers = true
export let autofocusEditor = false
$: enrichedBindings = enrichBindings(bindings)
@ -27,5 +28,6 @@
{value}
{allowJS}
{allowHelpers}
{autofocusEditor}
on:change
/>

View file

@ -44,7 +44,11 @@
})
const onChange = value => {
if (type === "link" && value && hasValidLinks(value)) {
if (
(type === "link" || type === "bb_reference") &&
value &&
hasValidLinks(value)
) {
currentVal = value.split(",")
} else if (type === "array" && value && hasValidOptions(value)) {
currentVal = value.split(",")
@ -95,6 +99,7 @@
date: isValidDate,
datetime: isValidDate,
link: hasValidLinks,
bb_reference: hasValidLinks,
array: hasValidOptions,
longform: value => !isJSBinding(value),
json: value => !isJSBinding(value),

View file

@ -25,7 +25,6 @@
</script>
<div class="options-wrap">
<div />
<div><ActionButton on:click={drawer.show}>Define Options</ActionButton></div>
</div>
<Drawer bind:this={drawer} title="Options" on:drawerHide on:drawerShow>

View file

@ -64,6 +64,7 @@
on:change={event => (tempValue = event.detail)}
allowJS
{bindings}
autofocusEditor={true}
/>
</Drawer>
{/key}

View file

@ -3295,6 +3295,7 @@
},
{
"type": "options",
"label": "Custom options",
"key": "customOptions",
"dependsOn": {
"setting": "optionsSource",
@ -3502,6 +3503,7 @@
},
{
"type": "options",
"label": "Custom options",
"key": "customOptions",
"dependsOn": {
"setting": "optionsSource",

@ -1 +1 @@
Subproject commit dc2b1b22e7f9bac705746bf1fb72c817db043fa3
Subproject commit b1c10c2daf808d103724c324256cbff67f33fb46

View file

@ -161,11 +161,8 @@ export async function preview(ctx: UserCtx) {
auth: { ...authConfigCtx },
},
}
const runFn = () => Runner.run(inputs)
const { rows, keys, info, extra } = await quotas.addQuery<any>(runFn, {
datasourceId: datasource._id,
})
const { rows, keys, info, extra } = (await Runner.run(inputs)) as any
const schemaFields: any = {}
if (rows?.length > 0) {
for (let key of [...new Set(keys)] as string[]) {
@ -259,14 +256,8 @@ async function execute(
},
schema: query.schema,
}
const runFn = () => Runner.run(inputs)
const { rows, pagination, extra, info } = await quotas.addQuery<any>(
runFn,
{
datasourceId: datasource._id,
}
)
const { rows, pagination, extra, info } = (await Runner.run(inputs)) as any
// remove the raw from execution incase transformer being used to hide data
if (extra?.raw) {
delete extra.raw

View file

@ -4,20 +4,20 @@ import * as external from "./external"
import { isExternalTableID } from "../../../integrations/utils"
import {
Ctx,
UserCtx,
DeleteRowRequest,
DeleteRow,
DeleteRowRequest,
DeleteRows,
Row,
PatchRowRequest,
PatchRowResponse,
SearchRowResponse,
SearchRowRequest,
SearchParams,
GetRowResponse,
ValidateResponse,
ExportRowsRequest,
ExportRowsResponse,
GetRowResponse,
PatchRowRequest,
PatchRowResponse,
Row,
SearchParams,
SearchRowRequest,
SearchRowResponse,
UserCtx,
ValidateResponse,
} from "@budibase/types"
import * as utils from "./utils"
import { gridSocket } from "../../../websockets"
@ -25,8 +25,8 @@ import { addRev } from "../public/utils"
import { fixRow } from "../public/rows"
import sdk from "../../../sdk"
import * as exporters from "../view/exporters"
import { apiFileReturn } from "../../../utilities/fileSystem"
import { Format } from "../view/exporters"
import { apiFileReturn } from "../../../utilities/fileSystem"
export * as views from "./views"
@ -49,12 +49,7 @@ export async function patch(
return save(ctx)
}
try {
const { row, table } = await quotas.addQuery(
() => pickApi(tableId).patch(ctx),
{
datasourceId: tableId,
}
)
const { row, table } = await pickApi(tableId).patch(ctx)
if (!row) {
ctx.throw(404, "Row not found")
}
@ -84,12 +79,7 @@ export const save = async (ctx: UserCtx<Row, Row>) => {
return patch(ctx as UserCtx<PatchRowRequest, PatchRowResponse>)
}
const { row, table, squashed } = await quotas.addRow(() =>
quotas.addQuery(
() => sdk.rows.save(tableId, ctx.request.body, ctx.user?._id),
{
datasourceId: tableId,
}
)
sdk.rows.save(tableId, ctx.request.body, ctx.user?._id)
)
ctx.status = 200
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:save`, appId, row, table)
@ -105,31 +95,21 @@ export async function fetchView(ctx: any) {
const { calculation, group, field } = ctx.query
ctx.body = await quotas.addQuery(
() =>
sdk.rows.fetchView(tableId, viewName, {
calculation,
group: calculation ? group : null,
field,
}),
{
datasourceId: tableId,
}
)
ctx.body = await sdk.rows.fetchView(tableId, viewName, {
calculation,
group: calculation ? group : null,
field,
})
}
export async function fetch(ctx: any) {
const tableId = utils.getTableId(ctx)
ctx.body = await quotas.addQuery(() => sdk.rows.fetch(tableId), {
datasourceId: tableId,
})
ctx.body = await sdk.rows.fetch(tableId)
}
export async function find(ctx: UserCtx<void, GetRowResponse>) {
const tableId = utils.getTableId(ctx)
ctx.body = await quotas.addQuery(() => pickApi(tableId).find(ctx), {
datasourceId: tableId,
})
ctx.body = await pickApi(tableId).find(ctx)
}
function isDeleteRows(input: any): input is DeleteRows {
@ -160,15 +140,9 @@ async function deleteRows(ctx: UserCtx<DeleteRowRequest>) {
let deleteRequest = ctx.request.body as DeleteRows
const rowDeletes: Row[] = await processDeleteRowsRequest(ctx)
deleteRequest.rows = rowDeletes
deleteRequest.rows = await processDeleteRowsRequest(ctx)
const { rows } = await quotas.addQuery(
() => pickApi(tableId).bulkDestroy(ctx),
{
datasourceId: tableId,
}
)
const { rows } = await pickApi(tableId).bulkDestroy(ctx)
await quotas.removeRows(rows.length)
for (let row of rows) {
@ -183,9 +157,7 @@ async function deleteRow(ctx: UserCtx<DeleteRowRequest>) {
const appId = ctx.appId
const tableId = utils.getTableId(ctx)
const resp = await quotas.addQuery(() => pickApi(tableId).destroy(ctx), {
datasourceId: tableId,
})
const resp = await pickApi(tableId).destroy(ctx)
await quotas.removeRow()
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, resp.row)
@ -223,9 +195,7 @@ export async function search(ctx: Ctx<SearchRowRequest, SearchRowResponse>) {
}
ctx.status = 200
ctx.body = await quotas.addQuery(() => sdk.rows.search(searchParams), {
datasourceId: tableId,
})
ctx.body = await sdk.rows.search(searchParams)
}
export async function validate(ctx: Ctx<Row, ValidateResponse>) {
@ -243,12 +213,7 @@ export async function validate(ctx: Ctx<Row, ValidateResponse>) {
export async function fetchEnrichedRow(ctx: any) {
const tableId = utils.getTableId(ctx)
ctx.body = await quotas.addQuery(
() => pickApi(tableId).fetchEnrichedRow(ctx),
{
datasourceId: tableId,
}
)
ctx.body = await pickApi(tableId).fetchEnrichedRow(ctx)
}
export const exportRows = async (
@ -268,22 +233,15 @@ export const exportRows = async (
)
}
ctx.body = await quotas.addQuery(
async () => {
const { fileName, content } = await sdk.rows.exportRows({
tableId,
format: format as Format,
rowIds: rows,
columns,
query,
sort,
sortOrder,
})
ctx.attachment(fileName)
return apiFileReturn(content)
},
{
datasourceId: tableId,
}
)
const { fileName, content } = await sdk.rows.exportRows({
tableId,
format: format as Format,
rowIds: rows,
columns,
query,
sort,
sortOrder,
})
ctx.attachment(fileName)
ctx.body = apiFileReturn(content)
}

View file

@ -68,10 +68,7 @@ export async function searchView(
paginate: body.paginate,
}
const result = await quotas.addQuery(() => sdk.rows.search(searchOptions), {
datasourceId: view.tableId,
})
const result = await sdk.rows.search(searchOptions)
result.rows.forEach(r => (r._viewId = view.id))
ctx.body = result
}

View file

@ -132,11 +132,6 @@ describe.each([
expect(usage).toBe(expected)
}
const assertQueryUsage = async (expected: number) => {
const usage = await getQueryUsage()
expect(usage).toBe(expected)
}
const defaultRowFields = isInternal
? {
type: "row",
@ -181,7 +176,6 @@ describe.each([
expect(res.body.name).toEqual("Test Contact")
expect(res.body._rev).toBeDefined()
await assertRowUsage(rowUsage + 1)
await assertQueryUsage(queryUsage + 1)
})
it("Increment row autoId per create row request", async () => {
@ -232,7 +226,6 @@ describe.each([
}
await assertRowUsage(rowUsage + ids.length)
await assertQueryUsage(queryUsage + ids.length)
})
it("updates a row successfully", async () => {
@ -249,7 +242,6 @@ describe.each([
expect(res.name).toEqual("Updated Name")
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage + 1)
})
it("should load a row", async () => {
@ -262,7 +254,6 @@ describe.each([
...existing,
...defaultRowFields,
})
await assertQueryUsage(queryUsage + 1)
})
it("should list all rows for given tableId", async () => {
@ -284,7 +275,6 @@ describe.each([
expect(res.length).toBe(2)
expect(res.find((r: Row) => r.name === newRow.name)).toBeDefined()
expect(res.find((r: Row) => r.name === firstRow.name)).toBeDefined()
await assertQueryUsage(queryUsage + 1)
})
it("load should return 404 when row does not exist", async () => {
@ -294,7 +284,6 @@ describe.each([
await config.api.row.get(tableId, "1234567", {
expectStatus: 404,
})
await assertQueryUsage(queryUsage) // no change
})
isInternal &&
@ -558,7 +547,6 @@ describe.each([
expect(savedRow.body.description).toEqual(existing.description)
expect(savedRow.body.name).toEqual("Updated Name")
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage + 2) // account for the second load
})
it("should throw an error when given improper types", async () => {
@ -578,7 +566,6 @@ describe.each([
)
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage)
})
it("should not overwrite links if those links are not set", async () => {
@ -668,7 +655,6 @@ describe.each([
const res = await config.api.row.delete(table._id!, [createdRow])
expect(res.body[0]._id).toEqual(createdRow._id)
await assertRowUsage(rowUsage - 1)
await assertQueryUsage(queryUsage + 1)
})
})
@ -687,7 +673,6 @@ describe.each([
expect(res.valid).toBe(true)
expect(Object.keys(res.errors)).toEqual([])
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage)
})
it("should errors on invalid row", async () => {
@ -705,7 +690,6 @@ describe.each([
expect(Object.keys(res.errors)).toEqual([])
}
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage)
})
})
@ -726,7 +710,6 @@ describe.each([
expect(res.body.length).toEqual(2)
await loadRow(row1._id!, table._id!, 404)
await assertRowUsage(rowUsage - 2)
await assertQueryUsage(queryUsage + 1)
})
it("should be able to delete a variety of row set types", async () => {
@ -747,7 +730,6 @@ describe.each([
expect(res.body.length).toEqual(3)
await loadRow(row1._id!, table._id!, 404)
await assertRowUsage(rowUsage - 3)
await assertQueryUsage(queryUsage + 1)
})
it("should accept a valid row object and delete the row", async () => {
@ -760,7 +742,6 @@ describe.each([
expect(res.body.id).toEqual(row1._id)
await loadRow(row1._id!, table._id!, 404)
await assertRowUsage(rowUsage - 1)
await assertQueryUsage(queryUsage + 1)
})
it("Should ignore malformed/invalid delete requests", async () => {
@ -787,7 +768,6 @@ describe.each([
expect(res3.body.message).toEqual("Invalid delete rows request")
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage)
})
})
@ -808,7 +788,6 @@ describe.each([
expect(res.body.length).toEqual(1)
expect(res.body[0]._id).toEqual(row._id)
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage + 1)
})
it("should throw an error if view doesn't exist", async () => {
@ -818,7 +797,6 @@ describe.each([
await config.api.legacyView.get("derp", { expectStatus: 404 })
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage)
})
it("should be able to run on a view", async () => {
@ -837,7 +815,6 @@ describe.each([
expect(res.body[0]._id).toEqual(row._id)
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage + 1)
})
})
@ -910,7 +887,6 @@ describe.each([
expect(resEnriched.body.link[0].name).toBe("Test Contact")
expect(resEnriched.body.link[0].description).toBe("original description")
await assertRowUsage(rowUsage)
await assertQueryUsage(queryUsage + 2)
})
})
@ -1129,7 +1105,6 @@ describe.each([
await config.api.row.delete(view.id, [createdRow])
await assertRowUsage(rowUsage - 1)
await assertQueryUsage(queryUsage + 1)
await config.api.row.get(tableId, createdRow._id!, {
expectStatus: 404,
@ -1157,7 +1132,6 @@ describe.each([
await config.api.row.delete(view.id, [rows[0], rows[2]])
await assertRowUsage(rowUsage - 2)
await assertQueryUsage(queryUsage + 1)
await config.api.row.get(tableId, rows[0]._id!, {
expectStatus: 404,

View file

@ -305,8 +305,8 @@ export function shouldCopySpecialColumn(
}
/**
* Looks for columns which need to be copied over into the new table definitions, like relationships
* and options types.
* Looks for columns which need to be copied over into the new table definitions, like relationships,
* options types and views.
* @param tableName The name of the table which is being checked.
* @param table The specific table which is being checked.
* @param entities All the tables that existed before - the old table definitions.
@ -325,6 +325,9 @@ function copyExistingPropsOver(
if (entities[tableName]?.created) {
table.created = entities[tableName]?.created
}
table.views = entities[tableName].views
const existingTableSchema = entities[tableName].schema
for (let key in existingTableSchema) {
if (!existingTableSchema.hasOwnProperty(key)) {

View file

@ -18,13 +18,16 @@ export function init() {
bbCtx.jsExecutionTracker =
timers.ExecutionTimeTracker.withLimit(perRequestLimit)
}
track = bbCtx.jsExecutionTracker.track.bind(bbCtx.jsExecutionTracker)
span?.addTags({
js: {
limitMS: bbCtx.jsExecutionTracker.limitMs,
elapsedMS: bbCtx.jsExecutionTracker.elapsedMS,
},
})
// We call checkLimit() here to prevent paying the cost of creating
// a new VM context below when we don't need to.
bbCtx.jsExecutionTracker.checkLimit()
track = bbCtx.jsExecutionTracker.track.bind(bbCtx.jsExecutionTracker)
}
}

View file

@ -4,6 +4,9 @@
"composite": true,
"baseUrl": "."
},
"ts-node": {
"require": ["tsconfig-paths/register"]
},
"include": ["src/**/*", "__mocks__/**/*"],
"exclude": ["node_modules", "dist"]
}

809
yarn.lock

File diff suppressed because it is too large Load diff