@budibase/server 2.4.42 → 2.4.44-alpha.0
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/__mocks__/node-fetch.ts +6 -1
- package/builder/assets/{index.3d64bc07.js → index.6846a382.js} +385 -384
- package/builder/assets/index.7f9a008b.css +6 -0
- package/builder/index.html +7 -7
- package/dist/api/controllers/application.js +28 -24
- package/dist/api/controllers/public/metrics.js +113 -0
- package/dist/api/controllers/row/external.js +15 -0
- package/dist/api/controllers/row/utils.js +4 -3
- package/dist/api/controllers/static/index.js +84 -24
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +34 -11
- package/dist/api/controllers/table/utils.js +2 -4
- package/dist/api/routes/public/index.js +8 -0
- package/dist/api/routes/public/metrics.js +30 -0
- package/dist/app.js +1 -0
- package/dist/integrations/googlesheets.js +4 -0
- package/dist/integrations/redis.js +1 -1
- package/dist/middleware/currentapp.js +1 -27
- package/dist/package.json +12 -11
- package/dist/sdk/users/utils.js +11 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/app.js +1 -10
- package/dist/utilities/fileSystem/filesystem.js +0 -4
- package/dist/utilities/global.js +17 -7
- package/jest.config.ts +2 -0
- package/package.json +13 -12
- package/scripts/test.sh +6 -4
- package/specs/openapi.json +39 -0
- package/specs/openapi.yaml +169 -0
- package/specs/resources/application.ts +11 -0
- package/specs/resources/index.ts +2 -0
- package/specs/resources/metrics.ts +81 -0
- package/src/api/controllers/application.ts +20 -21
- package/src/api/controllers/component.ts +2 -2
- package/src/api/controllers/public/metrics.ts +251 -0
- package/src/api/controllers/row/external.ts +14 -0
- package/src/api/controllers/row/utils.ts +4 -3
- package/src/api/controllers/static/index.ts +69 -26
- package/src/api/controllers/static/templates/BudibaseApp.svelte +34 -11
- package/src/api/controllers/table/tests/utils.spec.ts +97 -0
- package/src/api/controllers/table/utils.ts +20 -12
- package/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap +48 -48
- package/src/api/routes/public/index.ts +10 -1
- package/src/api/routes/public/metrics.ts +28 -0
- package/src/api/routes/public/tests/metrics.spec.js +34 -0
- package/src/api/routes/tests/__snapshots__/datasource.spec.ts.snap +22 -22
- package/src/api/routes/tests/__snapshots__/view.spec.js.snap +5 -5
- package/src/api/routes/tests/appSync.spec.ts +31 -0
- package/src/api/routes/tests/internalSearch.spec.js +8 -7
- package/src/app.ts +2 -1
- package/src/automations/automationUtils.ts +1 -1
- package/src/automations/tests/automation.spec.ts +99 -0
- package/src/db/defaultData/datasource_bb_default.ts +1 -1
- package/src/definitions/openapi.ts +15 -0
- package/src/integration-test/postgres.spec.ts +46 -52
- package/src/integrations/googlesheets.ts +4 -0
- package/src/integrations/redis.ts +1 -1
- package/src/integrations/tests/googlesheets.spec.ts +13 -13
- package/src/integrations/tests/redis.spec.ts +9 -5
- package/src/middleware/currentapp.ts +3 -32
- package/src/middleware/tests/currentapp.spec.js +6 -42
- package/src/sdk/users/tests/utils.spec.ts +159 -0
- package/src/sdk/users/utils.ts +18 -7
- package/src/tests/jestEnv.ts +1 -0
- package/src/tests/jestSetup.ts +5 -1
- package/src/tests/utilities/TestConfiguration.ts +18 -19
- package/src/tests/utilities/structures.ts +13 -1
- package/src/utilities/fileSystem/app.ts +2 -9
- package/src/utilities/fileSystem/filesystem.ts +0 -4
- package/src/utilities/global.ts +21 -9
- package/src/utilities/rowProcessor/index.ts +1 -1
- package/builder/assets/favicon.e7fc7733.png +0 -0
- package/builder/assets/index.b0e3aca6.css +0 -6
- package/src/automations/tests/automation.spec.js +0 -84
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
jest.mock("../../threads/automation")
|
|
2
|
-
jest.mock("../../utilities/redis", () => ({
|
|
3
|
-
init: jest.fn(),
|
|
4
|
-
checkTestFlag: () => {
|
|
5
|
-
return false
|
|
6
|
-
},
|
|
7
|
-
}))
|
|
8
|
-
|
|
9
|
-
jest.spyOn(global.console, "error")
|
|
10
|
-
|
|
11
|
-
require("../../environment")
|
|
12
|
-
const automation = require("../index")
|
|
13
|
-
const thread = require("../../threads/automation")
|
|
14
|
-
const triggers = require("../triggers")
|
|
15
|
-
const { basicAutomation } = require("../../tests/utilities/structures")
|
|
16
|
-
const { wait } = require("../../utilities")
|
|
17
|
-
const { makePartial } = require("../../tests/utilities")
|
|
18
|
-
const { cleanInputValues } = require("../automationUtils")
|
|
19
|
-
const setup = require("./utilities")
|
|
20
|
-
|
|
21
|
-
describe("Run through some parts of the automations system", () => {
|
|
22
|
-
let config = setup.getConfig()
|
|
23
|
-
|
|
24
|
-
beforeAll(async () => {
|
|
25
|
-
await automation.init()
|
|
26
|
-
await config.init()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
afterAll(setup.afterAll)
|
|
30
|
-
|
|
31
|
-
it("should be able to init in builder", async () => {
|
|
32
|
-
await triggers.externalTrigger(basicAutomation(), { a: 1, appId: config.appId })
|
|
33
|
-
await wait(100)
|
|
34
|
-
expect(thread.execute).toHaveBeenCalled()
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it("should check coercion", async () => {
|
|
38
|
-
const table = await config.createTable()
|
|
39
|
-
const automation = basicAutomation()
|
|
40
|
-
automation.definition.trigger.inputs.tableId = table._id
|
|
41
|
-
automation.definition.trigger.stepId = "APP"
|
|
42
|
-
automation.definition.trigger.inputs.fields = { a: "number" }
|
|
43
|
-
await triggers.externalTrigger(automation, {
|
|
44
|
-
appId: config.getAppId(),
|
|
45
|
-
fields: {
|
|
46
|
-
a: "1"
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
await wait(100)
|
|
50
|
-
expect(thread.execute).toHaveBeenCalledWith(makePartial({
|
|
51
|
-
data: {
|
|
52
|
-
event: {
|
|
53
|
-
fields: {
|
|
54
|
-
a: 1
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}), expect.any(Function))
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it("should be able to clean inputs with the utilities", () => {
|
|
62
|
-
// can't clean without a schema
|
|
63
|
-
let output = cleanInputValues({a: "1"})
|
|
64
|
-
expect(output.a).toBe("1")
|
|
65
|
-
output = cleanInputValues({a: "1", b: "true", c: "false", d: 1, e: "help"}, {
|
|
66
|
-
properties: {
|
|
67
|
-
a: {
|
|
68
|
-
type: "number",
|
|
69
|
-
},
|
|
70
|
-
b: {
|
|
71
|
-
type: "boolean",
|
|
72
|
-
},
|
|
73
|
-
c: {
|
|
74
|
-
type: "boolean",
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
expect(output.a).toBe(1)
|
|
79
|
-
expect(output.b).toBe(true)
|
|
80
|
-
expect(output.c).toBe(false)
|
|
81
|
-
expect(output.d).toBe(1)
|
|
82
|
-
expect(output.e).toBe("help")
|
|
83
|
-
})
|
|
84
|
-
})
|