@budibase/server 2.5.5-alpha.3 → 2.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.841e62d8.css → index.7f9a008b.css} +3 -3
- package/builder/assets/index.f493a2b3.js +1817 -0
- package/builder/index.html +2 -2
- package/dist/api/routes/index.js +0 -2
- package/dist/app.js +11 -2
- package/dist/elasticApm.js +14 -0
- package/dist/environment.js +1 -0
- package/dist/integrations/microsoftSqlServer.js +2 -5
- package/dist/integrations/mysql.js +3 -5
- package/dist/integrations/postgres.js +5 -7
- package/dist/integrations/redis.js +0 -7
- package/dist/integrations/rest.js +0 -4
- package/dist/migrations/functions/usageQuotas/syncApps.js +1 -1
- package/dist/migrations/functions/usageQuotas/syncRows.js +2 -1
- package/dist/package.json +12 -12
- package/dist/startup.js +27 -29
- package/dist/threads/automation.js +3 -14
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/scripts/dev/manage.js +0 -2
- package/scripts/integrations/mssql/data/entrypoint.sh +0 -1
- package/scripts/integrations/mssql/data/setup.sql +17 -17
- package/scripts/integrations/mysql/init.sql +1 -1
- package/scripts/integrations/postgres/init.sql +0 -1
- package/scripts/likeCypress.ts +35 -0
- package/src/api/routes/index.ts +0 -2
- package/src/api/routes/tests/automation.spec.js +2 -5
- package/src/api/routes/tests/user.spec.js +13 -61
- package/src/app.ts +13 -2
- package/src/elasticApm.ts +10 -0
- package/src/environment.ts +1 -0
- package/src/integrations/microsoftSqlServer.ts +2 -5
- package/src/integrations/mysql.ts +3 -5
- package/src/integrations/postgres.ts +5 -7
- package/src/integrations/redis.ts +0 -8
- package/src/integrations/rest.ts +0 -3
- package/src/migrations/functions/usageQuotas/syncApps.ts +1 -1
- package/src/migrations/functions/usageQuotas/syncRows.ts +3 -2
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -2
- package/src/startup.ts +33 -34
- package/src/tests/jestEnv.ts +1 -0
- package/src/tests/jestSetup.ts +1 -0
- package/src/tests/logging.ts +34 -0
- package/src/threads/automation.ts +4 -16
- package/builder/assets/index.c409c736.js +0 -1776
- package/dist/api/controllers/ops.js +0 -40
- package/dist/api/routes/ops.js +0 -52
- package/src/api/controllers/ops.ts +0 -32
- package/src/api/routes/ops.ts +0 -30
package/src/startup.ts
CHANGED
|
@@ -16,10 +16,13 @@ import * as bullboard from "./automations/bullboard"
|
|
|
16
16
|
import * as pro from "@budibase/pro"
|
|
17
17
|
import * as api from "./api"
|
|
18
18
|
import sdk from "./sdk"
|
|
19
|
+
const pino = require("koa-pino-logger")
|
|
19
20
|
|
|
20
21
|
let STARTUP_RAN = false
|
|
21
22
|
|
|
22
23
|
async function initRoutes(app: any) {
|
|
24
|
+
app.use(pino(logging.pinoSettings()))
|
|
25
|
+
|
|
23
26
|
if (!env.isTest()) {
|
|
24
27
|
const plugin = await bullboard.init()
|
|
25
28
|
app.use(plugin)
|
|
@@ -45,10 +48,8 @@ async function initPro() {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
function shutdown(server?: any) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
server.destroy()
|
|
51
|
-
}
|
|
51
|
+
server.close()
|
|
52
|
+
server.destroy()
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
export async function startup(app?: any, server?: any) {
|
|
@@ -71,39 +72,11 @@ export async function startup(app?: any, server?: any) {
|
|
|
71
72
|
await migrations.migrate()
|
|
72
73
|
} catch (e) {
|
|
73
74
|
logging.logAlert("Error performing migrations. Exiting.", e)
|
|
74
|
-
shutdown(
|
|
75
|
+
shutdown()
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
// monitor plugin directory if required
|
|
79
|
-
if (
|
|
80
|
-
env.SELF_HOSTED &&
|
|
81
|
-
!env.MULTI_TENANCY &&
|
|
82
|
-
env.PLUGINS_DIR &&
|
|
83
|
-
fs.existsSync(env.PLUGINS_DIR)
|
|
84
|
-
) {
|
|
85
|
-
watch()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// check for version updates
|
|
89
|
-
await installation.checkInstallVersion()
|
|
90
|
-
|
|
91
|
-
// get the references to the queue promises, don't await as
|
|
92
|
-
// they will never end, unless the processing stops
|
|
93
|
-
let queuePromises = []
|
|
94
|
-
// configure events to use the pro audit log write
|
|
95
|
-
// can't integrate directly into backend-core due to cyclic issues
|
|
96
|
-
queuePromises.push(events.processors.init(pro.sdk.auditLogs.write))
|
|
97
|
-
queuePromises.push(automations.init())
|
|
98
|
-
queuePromises.push(initPro())
|
|
99
|
-
if (app) {
|
|
100
|
-
// bring routes online as final step once everything ready
|
|
101
|
-
await initRoutes(app)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
79
|
// check and create admin user if required
|
|
105
|
-
// this must be run after the api has been initialised due to
|
|
106
|
-
// the app user sync
|
|
107
80
|
if (
|
|
108
81
|
env.SELF_HOSTED &&
|
|
109
82
|
!env.MULTI_TENANCY &&
|
|
@@ -130,8 +103,34 @@ export async function startup(app?: any, server?: any) {
|
|
|
130
103
|
)
|
|
131
104
|
} catch (e) {
|
|
132
105
|
logging.logAlert("Error creating initial admin user. Exiting.", e)
|
|
133
|
-
shutdown(
|
|
106
|
+
shutdown()
|
|
134
107
|
}
|
|
135
108
|
}
|
|
136
109
|
}
|
|
110
|
+
|
|
111
|
+
// monitor plugin directory if required
|
|
112
|
+
if (
|
|
113
|
+
env.SELF_HOSTED &&
|
|
114
|
+
!env.MULTI_TENANCY &&
|
|
115
|
+
env.PLUGINS_DIR &&
|
|
116
|
+
fs.existsSync(env.PLUGINS_DIR)
|
|
117
|
+
) {
|
|
118
|
+
watch()
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// check for version updates
|
|
122
|
+
await installation.checkInstallVersion()
|
|
123
|
+
|
|
124
|
+
// get the references to the queue promises, don't await as
|
|
125
|
+
// they will never end, unless the processing stops
|
|
126
|
+
let queuePromises = []
|
|
127
|
+
// configure events to use the pro audit log write
|
|
128
|
+
// can't integrate directly into backend-core due to cyclic issues
|
|
129
|
+
queuePromises.push(events.processors.init(pro.sdk.auditLogs.write))
|
|
130
|
+
queuePromises.push(automations.init())
|
|
131
|
+
queuePromises.push(initPro())
|
|
132
|
+
if (app) {
|
|
133
|
+
// bring routes online as final step once everything ready
|
|
134
|
+
await initRoutes(app)
|
|
135
|
+
}
|
|
137
136
|
}
|
package/src/tests/jestEnv.ts
CHANGED
|
@@ -6,6 +6,7 @@ process.env.MULTI_TENANCY = "1"
|
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
process.env.BUDIBASE_DIR = tmpdir("budibase-unittests")
|
|
8
8
|
process.env.LOG_LEVEL = process.env.LOG_LEVEL || "error"
|
|
9
|
+
process.env.ENABLE_4XX_HTTP_LOGGING = "0"
|
|
9
10
|
process.env.MOCK_REDIS = "1"
|
|
10
11
|
process.env.PLATFORM_URL = "http://localhost:10000"
|
|
11
12
|
process.env.REDIS_PASSWORD = "budibase"
|
package/src/tests/jestSetup.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export enum LogLevel {
|
|
2
|
+
TRACE = "trace",
|
|
3
|
+
DEBUG = "debug",
|
|
4
|
+
INFO = "info",
|
|
5
|
+
WARN = "warn",
|
|
6
|
+
ERROR = "error",
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const LOG_INDEX: { [key in LogLevel]: number } = {
|
|
10
|
+
[LogLevel.TRACE]: 1,
|
|
11
|
+
[LogLevel.DEBUG]: 2,
|
|
12
|
+
[LogLevel.INFO]: 3,
|
|
13
|
+
[LogLevel.WARN]: 4,
|
|
14
|
+
[LogLevel.ERROR]: 5,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const setIndex = LOG_INDEX[process.env.LOG_LEVEL as LogLevel]
|
|
18
|
+
|
|
19
|
+
if (setIndex > LOG_INDEX.trace) {
|
|
20
|
+
global.console.trace = jest.fn()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (setIndex > LOG_INDEX.debug) {
|
|
24
|
+
global.console.debug = jest.fn()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (setIndex > LOG_INDEX.info) {
|
|
28
|
+
global.console.info = jest.fn()
|
|
29
|
+
global.console.log = jest.fn()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (setIndex > LOG_INDEX.warn) {
|
|
33
|
+
global.console.warn = jest.fn()
|
|
34
|
+
}
|
|
@@ -34,8 +34,8 @@ const STOPPED_STATUS = { success: true, status: AutomationStatus.STOPPED }
|
|
|
34
34
|
|
|
35
35
|
function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
|
|
36
36
|
const binding = automationUtils.typecastForLooping(loopStep, input)
|
|
37
|
-
if (!binding) {
|
|
38
|
-
return
|
|
37
|
+
if (!loopStep || !binding) {
|
|
38
|
+
return 1
|
|
39
39
|
}
|
|
40
40
|
if (Array.isArray(binding)) {
|
|
41
41
|
return binding.length
|
|
@@ -43,7 +43,7 @@ function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
|
|
|
43
43
|
if (typeof binding === "string") {
|
|
44
44
|
return automationUtils.stringSplit(binding).length
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return 1
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -423,25 +423,13 @@ class Orchestrator {
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
if (loopStep && iterations === 0) {
|
|
427
|
-
loopStep = undefined
|
|
428
|
-
this.executionOutput.steps.splice(loopStepNumber + 1, 0, {
|
|
429
|
-
id: step.id,
|
|
430
|
-
stepId: step.stepId,
|
|
431
|
-
outputs: { status: AutomationStatus.NO_ITERATIONS, success: true },
|
|
432
|
-
inputs: {},
|
|
433
|
-
})
|
|
434
|
-
|
|
435
|
-
this._context.steps.splice(loopStepNumber, 1)
|
|
436
|
-
iterations = 1
|
|
437
|
-
}
|
|
438
|
-
|
|
439
426
|
// Delete the step after the loop step as it's irrelevant, since information is included
|
|
440
427
|
// in the loop step
|
|
441
428
|
if (wasLoopStep && !loopStep) {
|
|
442
429
|
this._context.steps.splice(loopStepNumber + 1, 1)
|
|
443
430
|
wasLoopStep = false
|
|
444
431
|
}
|
|
432
|
+
|
|
445
433
|
if (loopSteps && loopSteps.length) {
|
|
446
434
|
let tempOutput = {
|
|
447
435
|
success: true,
|