1
0
Fork 0
mirror of synced 2024-07-05 22:40:39 +12:00

Merge remote-tracking branch 'origin/master' into feat/automation-features

This commit is contained in:
Peter Clement 2024-01-04 16:45:26 +00:00
commit 724eacdc72
36 changed files with 976 additions and 169 deletions

View file

@ -38,10 +38,10 @@ jobs:
submodules: ${{ env.IS_OSS_CONTRIBUTOR == 'false' }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn
- run: yarn --frozen-lockfile
- run: yarn lint
@ -56,10 +56,10 @@ jobs:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
fetch-depth: 0
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn
- run: yarn --frozen-lockfile
@ -84,7 +84,7 @@ jobs:
with:
fetch-depth: 0
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: azure/setup-helm@v3
- run: cd charts/budibase && helm lint .
@ -98,10 +98,10 @@ jobs:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
fetch-depth: 0
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn
- run: yarn --frozen-lockfile
- name: Test
@ -122,10 +122,10 @@ jobs:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
fetch-depth: 0
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn
- run: yarn --frozen-lockfile
- name: Test worker
@ -146,10 +146,10 @@ jobs:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
fetch-depth: 0
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn
- run: yarn --frozen-lockfile
- name: Test server
@ -171,10 +171,10 @@ jobs:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
fetch-depth: 0
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn
- run: yarn --frozen-lockfile
- name: Test
@ -194,10 +194,10 @@ jobs:
submodules: ${{ env.IS_OSS_CONTRIBUTOR == 'false' }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
cache: yarn
- run: yarn --frozen-lockfile
- name: Build packages

2
.nvmrc
View file

@ -1 +1 @@
v18.17.0
v20.10.0

View file

@ -1,3 +1,3 @@
nodejs 18.17.0
nodejs 20.10.0
python 3.10.0
yarn 1.22.19

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

@ -90,7 +90,7 @@ Component libraries are collections of components as well as the definition of t
#### 1. Prerequisites
- NodeJS version `18.x.x`
- NodeJS version `20.x.x`
- Python version `3.x`
### Using asdf (recommended)

View file

@ -1,4 +1,4 @@
FROM node:18-slim as build
FROM node:20-slim as build
# install node-gyp dependencies
RUN apt-get update && apt-get install -y --no-install-recommends g++ make python3 jq
@ -42,7 +42,7 @@ COPY packages/string-templates packages/string-templates
FROM budibase/couchdb as runner
ARG TARGETARCH
ENV TARGETARCH $TARGETARCH
ENV NODE_MAJOR 18
ENV NODE_MAJOR 20
#TARGETBUILD can be set to single (for single docker image) or aas (for azure app service)
# e.g. docker build --build-arg TARGETBUILD=aas ....
ARG TARGETBUILD=single

View file

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

View file

@ -6,6 +6,7 @@
"@babel/eslint-parser": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@esbuild-plugins/tsconfig-paths": "^0.1.2",
"@types/node": "20.10.0",
"@typescript-eslint/parser": "6.9.0",
"esbuild": "^0.18.17",
"esbuild-node-externals": "^1.8.0",
@ -99,7 +100,7 @@
"@budibase/types": "0.0.0"
},
"engines": {
"node": ">=18.0.0 <19.0.0"
"node": ">=20.0.0 <21.0.0"
},
"dependencies": {}
}

@ -1 +1 @@
Subproject commit aca3c9b6b5170d35a255ceb89e57a21719f5ed29
Subproject commit b11e6b47370d9b77c63648b45929c86bfed6360c

View file

@ -65,7 +65,6 @@
"@types/cookies": "0.7.8",
"@types/jest": "29.5.5",
"@types/lodash": "4.14.200",
"@types/node": "18.17.0",
"@types/node-fetch": "2.6.4",
"@types/pouchdb": "6.4.0",
"@types/redlock": "4.0.3",

View file

@ -134,7 +134,7 @@ export async function doInContext(appId: string, task: any): Promise<any> {
}
export async function doInTenant<T>(
tenantId: string | null,
tenantId: string | undefined,
task: () => T
): Promise<T> {
// make sure default always selected in single tenancy

View file

@ -39,7 +39,7 @@ const ALL_STRATEGIES = Object.values(TenantResolutionStrategy)
export const getTenantIDFromCtx = (
ctx: BBContext,
opts: GetTenantIdOptions
): string | null => {
): string | undefined => {
// exit early if not multi-tenant
if (!isMultiTenant()) {
return DEFAULT_TENANT_ID
@ -144,5 +144,5 @@ export const getTenantIDFromCtx = (
ctx.throw(403, "Tenant id not set")
}
return null
return undefined
}

View file

@ -157,12 +157,12 @@ describe("getTenantIDFromCtx", () => {
TenantResolutionStrategy.PATH,
],
}
expect(getTenantIDFromCtx(ctx, mockOpts)).toBeNull()
expect(getTenantIDFromCtx(ctx, mockOpts)).toBeUndefined()
expect(ctx.throw).toBeCalledTimes(1)
expect(ctx.throw).toBeCalledWith(403, "Tenant id not set")
})
it("returns null if allowNoTenant is true", () => {
it("returns undefined if allowNoTenant is true", () => {
const ctx = createCtx({})
mockOpts = {
allowNoTenant: true,
@ -172,7 +172,7 @@ describe("getTenantIDFromCtx", () => {
TenantResolutionStrategy.PATH,
],
}
expect(getTenantIDFromCtx(ctx, mockOpts)).toBeNull()
expect(getTenantIDFromCtx(ctx, mockOpts)).toBeUndefined()
})
})

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

@ -31,8 +31,8 @@ export async function resolveAppUrl(ctx: Ctx) {
const appUrl = ctx.path.split("/")[2]
let possibleAppUrl = `/${appUrl.toLowerCase()}`
let tenantId: string | null = context.getTenantId()
if (env.MULTI_TENANCY) {
let tenantId: string | undefined = context.getTenantId()
if (!env.isDev() && env.MULTI_TENANCY) {
// always use the tenant id from the subdomain in multi tenancy
// this ensures the logged-in user tenant id doesn't overwrite
// e.g. in the case of viewing a public app while already logged-in to another tenant
@ -41,7 +41,7 @@ export async function resolveAppUrl(ctx: Ctx) {
})
}
// search prod apps for a url that matches
// search prod apps for an url that matches
const apps: App[] = await context.doInTenant(
tenantId,
() => getAllApps({ dev: false }) as Promise<App[]>

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

@ -41,7 +41,7 @@
<div class="filter-editor">
<ActionButton on:click={drawer.show}>{text}</ActionButton>
</div>
<Drawer bind:this={drawer} title="Filtering">
<Drawer bind:this={drawer} title="Filtering" on:drawerHide on:drawerShow>
<Button cta slot="buttons" on:click={saveFilter}>Save</Button>
<FilterDrawer
slot="body"

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

@ -32,4 +32,4 @@
$: schema = linkedTable?.schema
</script>
<FilterEditor on:change {...$$props} {schema} />
<FilterEditor on:change {...$$props} {schema} 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",

View file

@ -1,4 +1,4 @@
FROM node:18-slim
FROM node:20-slim
LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh"
LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh"

View file

@ -86,7 +86,7 @@
"lodash": "4.17.21",
"memorystream": "0.3.1",
"mongodb": "5.7",
"mssql": "9.1.1",
"mssql": "10.0.1",
"mysql2": "3.5.2",
"node-fetch": "2.6.7",
"object-sizeof": "2.6.1",
@ -121,8 +121,7 @@
"@types/koa": "2.13.4",
"@types/koa__router": "8.0.8",
"@types/lodash": "4.14.200",
"@types/mssql": "8.1.2",
"@types/node": "18.17.0",
"@types/mssql": "9.1.4",
"@types/node-fetch": "2.6.4",
"@types/oracledb": "5.2.2",
"@types/pg": "8.6.6",

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

@ -17,7 +17,6 @@
"devDependencies": {
"@budibase/nano": "10.1.4",
"@types/koa": "2.13.4",
"@types/node": "18.17.0",
"@types/pouchdb": "6.4.0",
"@types/redlock": "4.0.3",
"rimraf": "3.0.2",

View file

@ -1,4 +1,4 @@
FROM node:18-alpine
FROM node:20-alpine
LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh"
LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh"

View file

@ -79,7 +79,6 @@
"@types/koa": "2.13.4",
"@types/koa__router": "8.0.8",
"@types/lodash": "4.14.200",
"@types/node": "18.17.0",
"@types/node-fetch": "2.6.4",
"@types/server-destroy": "1.0.1",
"@types/supertest": "2.0.14",

View file

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

998
yarn.lock

File diff suppressed because it is too large Load diff