@budibase/server 2.5.5 → 2.5.6-alpha.10

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.
Files changed (156) hide show
  1. package/builder/assets/index.5c1a6913.js +1776 -0
  2. package/builder/assets/index.c0265b74.css +6 -0
  3. package/builder/index.html +2 -2
  4. package/dist/api/controllers/automation.js +13 -7
  5. package/dist/api/controllers/ops.js +40 -0
  6. package/dist/api/controllers/plugin/index.js +6 -37
  7. package/dist/api/controllers/table/utils.js +2 -1
  8. package/dist/api/controllers/user.js +1 -83
  9. package/dist/api/routes/index.js +2 -0
  10. package/dist/api/routes/ops.js +52 -0
  11. package/dist/api/routes/user.js +0 -1
  12. package/dist/app.js +4 -13
  13. package/dist/automations/actions.js +32 -6
  14. package/dist/automations/index.js +3 -2
  15. package/dist/automations/steps/bash.js +6 -6
  16. package/dist/automations/steps/createRow.js +11 -11
  17. package/dist/automations/steps/delay.js +3 -3
  18. package/dist/automations/steps/deleteRow.js +8 -8
  19. package/dist/automations/steps/discord.js +8 -8
  20. package/dist/automations/steps/executeQuery.js +9 -9
  21. package/dist/automations/steps/executeScript.js +6 -6
  22. package/dist/automations/steps/filter.js +6 -6
  23. package/dist/automations/steps/integromat.js +10 -10
  24. package/dist/automations/steps/loop.js +9 -9
  25. package/dist/automations/steps/outgoingWebhook.js +10 -10
  26. package/dist/automations/steps/queryRows.js +14 -14
  27. package/dist/automations/steps/sendSmtpEmail.js +9 -9
  28. package/dist/automations/steps/serverLog.js +4 -4
  29. package/dist/automations/steps/slack.js +6 -6
  30. package/dist/automations/steps/updateRow.js +11 -11
  31. package/dist/automations/steps/zapier.js +9 -9
  32. package/dist/automations/triggerInfo/app.js +5 -5
  33. package/dist/automations/triggerInfo/cron.js +4 -4
  34. package/dist/automations/triggerInfo/rowDeleted.js +5 -5
  35. package/dist/automations/triggerInfo/rowSaved.js +7 -7
  36. package/dist/automations/triggerInfo/rowUpdated.js +7 -7
  37. package/dist/automations/triggerInfo/webhook.js +6 -6
  38. package/dist/environment.js +0 -1
  39. package/dist/events/docUpdates/index.js +17 -0
  40. package/dist/events/docUpdates/processors.js +18 -0
  41. package/dist/events/docUpdates/syncUsers.js +49 -0
  42. package/dist/events/index.js +3 -0
  43. package/dist/integrations/index.js +3 -3
  44. package/dist/integrations/microsoftSqlServer.js +5 -2
  45. package/dist/integrations/mysql.js +5 -3
  46. package/dist/integrations/postgres.js +7 -5
  47. package/dist/integrations/redis.js +7 -0
  48. package/dist/integrations/rest.js +4 -0
  49. package/dist/migrations/functions/usageQuotas/syncApps.js +1 -1
  50. package/dist/migrations/functions/usageQuotas/syncRows.js +1 -2
  51. package/dist/package.json +15 -15
  52. package/dist/sdk/app/applications/sync.js +117 -23
  53. package/dist/sdk/index.js +2 -0
  54. package/dist/sdk/plugins/index.js +27 -0
  55. package/dist/sdk/plugins/plugins.js +53 -0
  56. package/dist/sdk/users/utils.js +21 -4
  57. package/dist/startup.js +31 -28
  58. package/dist/threads/automation.js +16 -5
  59. package/dist/tsconfig.build.tsbuildinfo +1 -1
  60. package/dist/utilities/fileSystem/plugin.js +33 -23
  61. package/dist/utilities/global.js +17 -12
  62. package/dist/watch.js +2 -2
  63. package/dist/websockets/client.js +14 -0
  64. package/dist/websockets/grid.js +60 -0
  65. package/dist/websockets/index.js +17 -0
  66. package/dist/websockets/websocket.js +78 -0
  67. package/jest.config.ts +3 -3
  68. package/nodemon.json +7 -3
  69. package/package.json +16 -16
  70. package/scripts/dev/manage.js +2 -0
  71. package/scripts/integrations/mssql/data/entrypoint.sh +1 -0
  72. package/scripts/integrations/mssql/data/setup.sql +17 -17
  73. package/scripts/integrations/mysql/init.sql +1 -1
  74. package/scripts/integrations/postgres/init.sql +1 -0
  75. package/src/api/controllers/automation.ts +12 -6
  76. package/src/api/controllers/ops.ts +32 -0
  77. package/src/api/controllers/plugin/index.ts +8 -45
  78. package/src/api/controllers/row/internal.ts +9 -10
  79. package/src/api/controllers/row/utils.ts +2 -2
  80. package/src/api/controllers/table/utils.ts +2 -1
  81. package/src/api/controllers/user.ts +10 -96
  82. package/src/api/routes/index.ts +2 -0
  83. package/src/api/routes/ops.ts +30 -0
  84. package/src/api/routes/tests/automation.spec.js +7 -4
  85. package/src/api/routes/tests/user.spec.js +48 -37
  86. package/src/api/routes/user.ts +0 -5
  87. package/src/app.ts +4 -15
  88. package/src/automations/actions.ts +56 -24
  89. package/src/automations/index.ts +1 -1
  90. package/src/automations/steps/bash.ts +10 -7
  91. package/src/automations/steps/createRow.ts +15 -12
  92. package/src/automations/steps/delay.ts +6 -4
  93. package/src/automations/steps/deleteRow.ts +12 -9
  94. package/src/automations/steps/discord.ts +10 -8
  95. package/src/automations/steps/executeQuery.ts +13 -10
  96. package/src/automations/steps/executeScript.ts +10 -7
  97. package/src/automations/steps/filter.ts +8 -6
  98. package/src/automations/steps/integromat.ts +12 -10
  99. package/src/automations/steps/loop.ts +16 -10
  100. package/src/automations/steps/outgoingWebhook.ts +14 -11
  101. package/src/automations/steps/queryRows.ts +18 -15
  102. package/src/automations/steps/sendSmtpEmail.ts +11 -9
  103. package/src/automations/steps/serverLog.ts +6 -4
  104. package/src/automations/steps/slack.ts +8 -6
  105. package/src/automations/steps/updateRow.ts +15 -12
  106. package/src/automations/steps/zapier.ts +11 -9
  107. package/src/automations/tests/utilities/index.ts +2 -2
  108. package/src/automations/triggerInfo/app.ts +8 -5
  109. package/src/automations/triggerInfo/cron.ts +7 -4
  110. package/src/automations/triggerInfo/rowDeleted.ts +8 -5
  111. package/src/automations/triggerInfo/rowSaved.ts +10 -7
  112. package/src/automations/triggerInfo/rowUpdated.ts +10 -7
  113. package/src/automations/triggerInfo/webhook.ts +9 -6
  114. package/src/environment.ts +0 -1
  115. package/src/events/docUpdates/index.ts +1 -0
  116. package/src/events/docUpdates/processors.ts +14 -0
  117. package/src/events/docUpdates/syncUsers.ts +35 -0
  118. package/src/events/index.ts +1 -0
  119. package/src/integrations/index.ts +3 -3
  120. package/src/integrations/microsoftSqlServer.ts +5 -2
  121. package/src/integrations/mysql.ts +5 -3
  122. package/src/integrations/postgres.ts +7 -5
  123. package/src/integrations/redis.ts +8 -0
  124. package/src/integrations/rest.ts +3 -0
  125. package/src/migrations/functions/usageQuotas/syncApps.ts +1 -1
  126. package/src/migrations/functions/usageQuotas/syncRows.ts +2 -3
  127. package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -2
  128. package/src/sdk/app/applications/sync.ts +129 -22
  129. package/src/sdk/app/applications/tests/sync.spec.ts +137 -0
  130. package/src/sdk/index.ts +2 -0
  131. package/src/sdk/plugins/index.ts +5 -0
  132. package/src/sdk/plugins/plugins.ts +41 -0
  133. package/src/sdk/users/tests/utils.spec.ts +1 -32
  134. package/src/sdk/users/utils.ts +23 -5
  135. package/src/startup.ts +36 -34
  136. package/src/tests/jestEnv.ts +0 -1
  137. package/src/tests/jestSetup.ts +0 -1
  138. package/src/tests/utilities/TestConfiguration.ts +28 -0
  139. package/src/tests/utilities/structures.ts +25 -17
  140. package/src/threads/automation.ts +18 -6
  141. package/src/utilities/fileSystem/plugin.ts +13 -4
  142. package/src/utilities/global.ts +21 -16
  143. package/src/watch.ts +2 -2
  144. package/src/websockets/client.ts +11 -0
  145. package/src/websockets/grid.ts +55 -0
  146. package/src/websockets/index.ts +14 -0
  147. package/src/websockets/websocket.ts +83 -0
  148. package/tsconfig.json +1 -7
  149. package/builder/assets/index.7f9a008b.css +0 -6
  150. package/builder/assets/index.f493a2b3.js +0 -1817
  151. package/dist/elasticApm.js +0 -14
  152. package/dist/websocket.js +0 -22
  153. package/scripts/likeCypress.ts +0 -35
  154. package/src/elasticApm.ts +0 -10
  155. package/src/tests/logging.ts +0 -34
  156. package/src/websocket.ts +0 -26
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const elastic_apm_node_1 = __importDefault(require("elastic-apm-node"));
7
- // enable APM if configured
8
- if (process.env.ELASTIC_APM_ENABLED) {
9
- console.log("Starting elastic-apm-node");
10
- elastic_apm_node_1.default.start({
11
- serviceName: process.env.SERVICE,
12
- environment: process.env.BUDIBASE_ENVIRONMENT,
13
- });
14
- }
package/dist/websocket.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClientAppSocket = exports.initialise = void 0;
4
- const socket_io_1 = require("socket.io");
5
- class Websocket {
6
- constructor(server, path) {
7
- this.socketServer = new socket_io_1.Server(server, {
8
- path,
9
- });
10
- }
11
- // Emit an event to all sockets
12
- emit(event, payload) {
13
- this.socketServer.sockets.emit(event, payload);
14
- }
15
- }
16
- // Likely to be more socket instances in future
17
- let ClientAppSocket;
18
- exports.ClientAppSocket = ClientAppSocket;
19
- const initialise = (server) => {
20
- exports.ClientAppSocket = ClientAppSocket = new Websocket(server, "/socket/client");
21
- };
22
- exports.initialise = initialise;
@@ -1,35 +0,0 @@
1
- /******************************************************
2
- * This script just makes it easy to re-create *
3
- * a cypress like environment for testing the backend *
4
- ******************************************************/
5
- import path from "path"
6
- const tmpdir = path.join(require("os").tmpdir(), ".budibase")
7
-
8
- const SERVER_PORT = "4100"
9
- const WORKER_PORT = "4200"
10
-
11
- // @ts-ignore
12
- process.env.NODE_ENV = "cypress"
13
- process.env.ENABLE_ANALYTICS = "0"
14
- process.env.JWT_SECRET = "budibase"
15
- process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
16
- process.env.SELF_HOSTED = "1"
17
- process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/`
18
- process.env.MINIO_URL = `http://localhost:4004`
19
- process.env.MINIO_ACCESS_KEY = "budibase"
20
- process.env.MINIO_SECRET_KEY = "budibase"
21
- process.env.COUCH_DB_USER = "budibase"
22
- process.env.COUCH_DB_PASSWORD = "budibase"
23
- process.env.INTERNAL_API_KEY = "budibase"
24
- process.env.ALLOW_DEV_AUTOMATIONS = "1"
25
-
26
- // don't make this a variable or top level require
27
- // it will cause environment module to be loaded prematurely
28
-
29
- // override the port with the worker port temporarily
30
- process.env.PORT = WORKER_PORT
31
- const worker = require("../../worker/src/index")
32
-
33
- // override the port with the server port
34
- process.env.PORT = SERVER_PORT
35
- const server = require("../src/app")
package/src/elasticApm.ts DELETED
@@ -1,10 +0,0 @@
1
- import apm from "elastic-apm-node"
2
-
3
- // enable APM if configured
4
- if (process.env.ELASTIC_APM_ENABLED) {
5
- console.log("Starting elastic-apm-node")
6
- apm.start({
7
- serviceName: process.env.SERVICE,
8
- environment: process.env.BUDIBASE_ENVIRONMENT,
9
- })
10
- }
@@ -1,34 +0,0 @@
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
- }
package/src/websocket.ts DELETED
@@ -1,26 +0,0 @@
1
- import { Server } from "socket.io"
2
- import http from "http"
3
-
4
- class Websocket {
5
- socketServer: Server
6
-
7
- constructor(server: http.Server, path: string) {
8
- this.socketServer = new Server(server, {
9
- path,
10
- })
11
- }
12
-
13
- // Emit an event to all sockets
14
- emit(event: string, payload: any) {
15
- this.socketServer.sockets.emit(event, payload)
16
- }
17
- }
18
-
19
- // Likely to be more socket instances in future
20
- let ClientAppSocket: Websocket
21
-
22
- export const initialise = (server: http.Server) => {
23
- ClientAppSocket = new Websocket(server, "/socket/client")
24
- }
25
-
26
- export { ClientAppSocket }