@budibase/server 1.3.15-alpha.0 → 1.3.16
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__/mongodb.ts +1 -1
- package/builder/assets/index.43e7aaa8.js +876 -0
- package/builder/assets/{index.f5c54dd2.css → index.a70e216a.css} +2 -2
- package/builder/assets/vendor.5e1fe644.css +1 -0
- package/builder/assets/vendor.67dbd8fa.js +248 -0
- package/builder/index.html +4 -2
- package/coverage/clover.xml +254 -296
- package/coverage/coverage-final.json +17 -17
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +13 -82
- package/coverage/lcov-report/api/controllers/datasource.js.html +20 -20
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +30 -30
- package/coverage/lcov-report/api/controllers/integration.js.html +6 -6
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +12 -204
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +12 -12
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +18 -18
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +20 -56
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +28 -28
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +12 -12
- package/coverage/lcov-report/middleware/currentapp.js.html +33 -33
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +2 -2
- package/coverage/lcov-report/utilities/budibaseDir.js.html +3 -3
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +16 -16
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +24 -24
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +2 -2
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +2 -2
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +445 -533
- package/dist/api/controllers/application.js +4 -5
- package/dist/api/controllers/component.js +1 -18
- package/dist/api/controllers/datasource.js +4 -4
- package/dist/api/controllers/integration.js +4 -4
- package/dist/api/controllers/row/ExternalRequest.js +3 -1
- package/dist/api/controllers/screen.js +2 -51
- package/dist/api/controllers/static/index.js +0 -1
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +0 -10
- package/dist/api/controllers/static/templates/preview.hbs +1 -3
- package/dist/api/routes/index.js +0 -2
- package/dist/app.js +0 -9
- package/dist/db/utils.js +1 -10
- package/dist/environment.js +2 -3
- package/dist/integrations/airtable.js +129 -126
- package/dist/integrations/arangodb.js +89 -86
- package/dist/integrations/base/query.js +2 -2
- package/dist/integrations/couchdb.js +83 -80
- package/dist/integrations/dynamodb.js +164 -161
- package/dist/integrations/elasticsearch.js +138 -135
- package/dist/integrations/firebase.js +157 -154
- package/dist/integrations/googlesheets.js +327 -323
- package/dist/integrations/index.js +51 -93
- package/dist/integrations/microsoftSqlServer.js +243 -240
- package/dist/integrations/mongodb.js +242 -239
- package/dist/integrations/mysql.js +219 -215
- package/dist/integrations/oracle.js +322 -318
- package/dist/integrations/postgres.js +265 -262
- package/dist/integrations/redis.js +139 -134
- package/dist/integrations/rest.js +292 -289
- package/dist/integrations/s3.js +64 -61
- package/dist/integrations/snowflake.js +86 -83
- package/dist/package.json +6 -8
- package/dist/threads/query.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +10 -66
- package/package.json +7 -9
- package/scripts/dev/manage.js +0 -1
- package/src/api/controllers/application.ts +1 -1
- package/src/api/controllers/component.js +2 -25
- package/src/api/controllers/datasource.js +4 -4
- package/src/api/controllers/integration.js +4 -4
- package/src/api/controllers/row/ExternalRequest.ts +4 -1
- package/src/api/controllers/screen.js +1 -65
- package/src/api/controllers/static/index.ts +0 -1
- package/src/api/controllers/static/templates/BudibaseApp.svelte +0 -10
- package/src/api/controllers/static/templates/preview.hbs +1 -3
- package/src/api/routes/index.ts +0 -2
- package/src/api/routes/tests/query.spec.js +25 -8
- package/src/app.ts +0 -12
- package/src/db/utils.js +0 -12
- package/src/environment.js +2 -3
- package/src/integrations/airtable.ts +118 -116
- package/src/integrations/arangodb.ts +89 -87
- package/src/integrations/base/query.ts +2 -2
- package/src/integrations/couchdb.ts +89 -83
- package/src/integrations/dynamodb.ts +175 -173
- package/src/integrations/elasticsearch.ts +122 -120
- package/src/integrations/firebase.ts +159 -157
- package/src/integrations/googlesheets.ts +338 -328
- package/src/integrations/index.ts +21 -59
- package/src/integrations/microsoftSqlServer.ts +251 -249
- package/src/integrations/mongodb.ts +258 -261
- package/src/integrations/mysql.ts +234 -229
- package/src/integrations/oracle.ts +380 -373
- package/src/integrations/postgres.ts +268 -264
- package/src/integrations/redis.ts +132 -128
- package/src/integrations/rest.ts +329 -324
- package/src/integrations/s3.ts +71 -68
- package/src/integrations/snowflake.ts +82 -80
- package/src/integrations/tests/{airtable.spec.ts → airtable.spec.js} +18 -21
- package/src/integrations/tests/{arangodb.spec.ts → arangodb.spec.js} +9 -12
- package/src/integrations/tests/{couchdb.spec.ts → couchdb.spec.js} +27 -33
- package/src/integrations/tests/{dynamodb.spec.ts → dynamodb.spec.js} +41 -45
- package/src/integrations/tests/{elasticsearch.spec.ts → elasticsearch.spec.js} +21 -22
- package/src/integrations/tests/{firebase.spec.ts → firebase.spec.js} +28 -33
- package/src/integrations/tests/{microsoftSqlServer.spec.ts → microsoftSqlServer.spec.js} +11 -12
- package/src/integrations/tests/{mongo.spec.ts → mongo.spec.js} +35 -46
- package/src/integrations/tests/{mysql.spec.ts → mysql.spec.js} +15 -17
- package/src/integrations/tests/{oracle.spec.ts → oracle.spec.js} +17 -19
- package/src/integrations/tests/{postgres.spec.ts → postgres.spec.js} +17 -19
- package/src/integrations/tests/{redis.spec.ts → redis.spec.js} +18 -27
- package/src/integrations/tests/{rest.spec.ts → rest.spec.js} +14 -22
- package/src/integrations/tests/{s3.spec.ts → s3.spec.js} +8 -10
- package/src/integrations/tests/{sql.spec.ts → sql.spec.js} +177 -228
- package/src/module.d.ts +0 -1
- package/src/threads/query.ts +2 -2
- package/src/utilities/fileSystem/index.js +9 -70
- package/builder/assets/index.b266d29f.js +0 -995
- package/dist/api/controllers/plugin.js +0 -119
- package/dist/api/routes/plugin.js +0 -38
- package/dist/watch.js +0 -77
- package/src/api/controllers/plugin.ts +0 -110
- package/src/api/routes/plugin.ts +0 -13
- package/src/watch.ts +0 -38
|
@@ -18,7 +18,6 @@ const {
|
|
|
18
18
|
deleteFiles,
|
|
19
19
|
} = require("./utilities")
|
|
20
20
|
const { updateClientLibrary } = require("./clientLibrary")
|
|
21
|
-
const { checkSlashesInUrl } = require("../")
|
|
22
21
|
const env = require("../../environment")
|
|
23
22
|
const {
|
|
24
23
|
USER_METDATA_PREFIX,
|
|
@@ -27,12 +26,9 @@ const {
|
|
|
27
26
|
} = require("../../db/utils")
|
|
28
27
|
const MemoryStream = require("memorystream")
|
|
29
28
|
const { getAppId } = require("@budibase/backend-core/context")
|
|
30
|
-
const tar = require("tar")
|
|
31
|
-
const fetch = require("node-fetch")
|
|
32
29
|
|
|
33
30
|
const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..")
|
|
34
31
|
const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules")
|
|
35
|
-
const DATASOURCE_PATH = join(budibaseTempDir(), "datasource")
|
|
36
32
|
|
|
37
33
|
/**
|
|
38
34
|
* The single stack system (Cloud and Builder) should not make use of the file system where possible,
|
|
@@ -48,7 +44,15 @@ const DATASOURCE_PATH = join(budibaseTempDir(), "datasource")
|
|
|
48
44
|
exports.init = () => {
|
|
49
45
|
const tempDir = budibaseTempDir()
|
|
50
46
|
if (!fs.existsSync(tempDir)) {
|
|
51
|
-
|
|
47
|
+
// some test cases fire this quickly enough that
|
|
48
|
+
// synchronous cases can end up here at the same time
|
|
49
|
+
try {
|
|
50
|
+
fs.mkdirSync(tempDir)
|
|
51
|
+
} catch (err) {
|
|
52
|
+
if (!err || err.code !== "EEXIST") {
|
|
53
|
+
throw err
|
|
54
|
+
}
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
const clientLibPath = join(budibaseTempDir(), "budibase-client.js")
|
|
54
58
|
if (env.isTest() && !fs.existsSync(clientLibPath)) {
|
|
@@ -103,13 +107,6 @@ exports.loadHandlebarsFile = path => {
|
|
|
103
107
|
return fs.readFileSync(path, "utf8")
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
/**
|
|
107
|
-
* Same as above just with a different name.
|
|
108
|
-
*/
|
|
109
|
-
exports.loadJSFile = (directory, name) => {
|
|
110
|
-
return fs.readFileSync(join(directory, name), "utf8")
|
|
111
|
-
}
|
|
112
|
-
|
|
113
110
|
/**
|
|
114
111
|
* When return a file from the API need to write the file to the system temporarily so we
|
|
115
112
|
* can create a read stream to send.
|
|
@@ -338,64 +335,6 @@ exports.cleanup = appIds => {
|
|
|
338
335
|
}
|
|
339
336
|
}
|
|
340
337
|
|
|
341
|
-
exports.extractPluginTarball = async file => {
|
|
342
|
-
if (!file.name.endsWith(".tar.gz")) {
|
|
343
|
-
throw new Error("Plugin must be compressed into a gzipped tarball.")
|
|
344
|
-
}
|
|
345
|
-
const path = join(budibaseTempDir(), file.name.split(".tar.gz")[0])
|
|
346
|
-
// remove old tmp directories automatically - don't combine
|
|
347
|
-
if (fs.existsSync(path)) {
|
|
348
|
-
fs.rmSync(path, { recursive: true, force: true })
|
|
349
|
-
}
|
|
350
|
-
fs.mkdirSync(path)
|
|
351
|
-
await tar.extract({
|
|
352
|
-
file: file.path,
|
|
353
|
-
C: path,
|
|
354
|
-
})
|
|
355
|
-
let metadata = {}
|
|
356
|
-
try {
|
|
357
|
-
const pkg = fs.readFileSync(join(path, "package.json"), "utf8")
|
|
358
|
-
const schema = fs.readFileSync(join(path, "schema.json"), "utf8")
|
|
359
|
-
metadata.schema = JSON.parse(schema)
|
|
360
|
-
metadata.package = JSON.parse(pkg)
|
|
361
|
-
} catch (err) {
|
|
362
|
-
throw new Error("Unable to process schema.json/package.json in plugin.")
|
|
363
|
-
}
|
|
364
|
-
return { metadata, directory: path }
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
exports.getDatasourcePlugin = async (name, url, hash) => {
|
|
368
|
-
if (!fs.existsSync(DATASOURCE_PATH)) {
|
|
369
|
-
fs.mkdirSync(DATASOURCE_PATH)
|
|
370
|
-
}
|
|
371
|
-
const filename = join(DATASOURCE_PATH, name)
|
|
372
|
-
const metadataName = `${filename}.bbmetadata`
|
|
373
|
-
if (fs.existsSync(filename)) {
|
|
374
|
-
const currentHash = fs.readFileSync(metadataName, "utf8")
|
|
375
|
-
// if hash is the same return the file, otherwise remove it and re-download
|
|
376
|
-
if (currentHash === hash) {
|
|
377
|
-
return require(filename)
|
|
378
|
-
} else {
|
|
379
|
-
console.log(`Updating plugin: ${name}`)
|
|
380
|
-
fs.unlinkSync(filename)
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
const fullUrl = checkSlashesInUrl(
|
|
384
|
-
`${env.MINIO_URL}/${ObjectStoreBuckets.PLUGINS}/${url}`
|
|
385
|
-
)
|
|
386
|
-
const response = await fetch(fullUrl)
|
|
387
|
-
if (response.status === 200) {
|
|
388
|
-
const content = await response.text()
|
|
389
|
-
fs.writeFileSync(filename, content)
|
|
390
|
-
fs.writeFileSync(metadataName, hash)
|
|
391
|
-
require(filename)
|
|
392
|
-
} else {
|
|
393
|
-
throw new Error(
|
|
394
|
-
`Unable to retrieve plugin - reason: ${await response.text()}`
|
|
395
|
-
)
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
338
|
/**
|
|
400
339
|
* Full function definition for below can be found in the utilities.
|
|
401
340
|
*/
|