From 29424e59c06cfd13163d1b4b9880db613b545221 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 14 Jan 2021 17:02:05 +0000 Subject: [PATCH] Linting. --- .../builder/src/builderStore/store/hosting.js | 4 +- .../AutomationBuilder/BlockList.svelte | 5 ++- .../automation/SetupPanel/SchemaSetup.svelte | 14 +++---- .../deploy/DeploymentHistory.svelte | 3 +- .../components/settings/tabs/General.svelte | 19 ++++++--- .../components/start/CreateAppModal.svelte | 4 +- .../EventsEditor/EventEditorModal.svelte | 26 +++++++----- .../EventsEditor/actions/SaveFields.svelte | 20 ++++++--- .../actions/TriggerAutomation.svelte | 41 +++++++++---------- packages/worker/src/db/index.js | 5 ++- packages/worker/src/middleware/check-key.js | 3 +- 11 files changed, 84 insertions(+), 60 deletions(-) diff --git a/packages/builder/src/builderStore/store/hosting.js b/packages/builder/src/builderStore/store/hosting.js index d265eeddff..f180d4157a 100644 --- a/packages/builder/src/builderStore/store/hosting.js +++ b/packages/builder/src/builderStore/store/hosting.js @@ -1,5 +1,5 @@ import { writable } from "svelte/store" -import api, {get} from "../api" +import api, { get } from "../api" const INITIAL_HOSTING_UI_STATE = { hostingInfo: {}, @@ -45,7 +45,7 @@ export const getHostingStore = () => { return state }) return deployments - } + }, } return store } diff --git a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte b/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte index 5ea1d64e51..e00fb92e27 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte @@ -50,7 +50,10 @@ function addBlockToAutomation(stepId, blockDefinition) { const newBlock = $automationStore.selectedAutomation.constructBlock( - selectedTab, stepId, blockDefinition) + selectedTab, + stepId, + blockDefinition + ) automationStore.actions.addBlockToAutomation(newBlock) closePopover() if (stepId === "WEBHOOK") { diff --git a/packages/builder/src/components/automation/SetupPanel/SchemaSetup.svelte b/packages/builder/src/components/automation/SetupPanel/SchemaSetup.svelte index 51c105e9f4..8855fb6895 100644 --- a/packages/builder/src/components/automation/SetupPanel/SchemaSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/SchemaSetup.svelte @@ -36,9 +36,7 @@
-
- -
+
{#each fieldsArray as field}
@@ -57,13 +55,11 @@ - removeField(field.name)} /> - -
{/each} -
diff --git a/packages/builder/src/components/deploy/DeploymentHistory.svelte b/packages/builder/src/components/deploy/DeploymentHistory.svelte index e65ddf80cf..8061e08ed1 100644 --- a/packages/builder/src/components/deploy/DeploymentHistory.svelte +++ b/packages/builder/src/components/deploy/DeploymentHistory.svelte @@ -36,7 +36,8 @@ let errorReason let poll let deployments = [] - let urlComponent = $hostingStore.hostingInfo.type === "self" ? $store.url : `/${appId}` + let urlComponent = + $hostingStore.hostingInfo.type === "self" ? $store.url : `/${appId}` let deploymentUrl = `${$hostingStore.appUrl}${urlComponent}` const formatDate = (date, format) => diff --git a/packages/builder/src/components/settings/tabs/General.svelte b/packages/builder/src/components/settings/tabs/General.svelte index 3852f7dc8d..314b1923ea 100644 --- a/packages/builder/src/components/settings/tabs/General.svelte +++ b/packages/builder/src/components/settings/tabs/General.svelte @@ -2,7 +2,7 @@ import { Input, TextArea } from "@budibase/bbui" import { store, hostingStore } from "builderStore" import api from "builderStore/api" - import {object, string} from "yup" + import { object, string } from "yup" import { onMount } from "svelte" import { get } from "svelte/store" @@ -47,7 +47,8 @@ } onMount(async () => { - const nameError = "Your application must have a name.", urlError = "Your application must have a URL." + const nameError = "Your application must have a name.", + urlError = "Your application must have a URL." let hostingInfo = await hostingStore.actions.fetch() if (hostingInfo.type === "self") { await hostingStore.actions.fetchDeployedApps() @@ -55,8 +56,16 @@ const existingAppUrls = get(hostingStore).deployedAppUrls existingAppNames.splice(existingAppNames.indexOf(get(store).name), 1) existingAppUrls.splice(existingAppUrls.indexOf(get(store).url), 1) - nameValidation = { name: string().required(nameError).notOneOf(existingAppNames) } - urlValidation = { url: string().required(urlError).notOneOf(existingAppUrls) } + nameValidation = { + name: string() + .required(nameError) + .notOneOf(existingAppNames), + } + urlValidation = { + url: string() + .required(urlError) + .notOneOf(existingAppUrls), + } } else { nameValidation = { name: string.required(nameError) } } @@ -71,7 +80,7 @@ bind:value={$store.name} bind:error={nameError} label="App Name" /> - {#if $hostingStore.hostingInfo.type === "self"} + {#if $hostingStore.hostingInfo.type === 'self'} updateApplication({ url: e.detail })} thin diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index b35638dc9e..1e93892f86 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -84,7 +84,9 @@ if (hostingInfo.type === "self") { await hostingStore.actions.fetchDeployedApps() const existingAppNames = svelteGet(hostingStore).deployedAppNames - infoValidation.applicationName = string().required("Your application must have a name.").notOneOf(existingAppNames) + infoValidation.applicationName = string() + .required("Your application must have a name.") + .notOneOf(existingAppNames) isApiKeyValid = true steps = [buildStep(Info), buildStep(User)] validationSchemas = [infoValidation, userValidation] diff --git a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte index d92ebed33e..ac976317ec 100644 --- a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte +++ b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte @@ -47,32 +47,36 @@ await createAutomation(action.parameters) } } - dispatch("change", actions) + dispatch("change", actions) } - // called by the parent modal when actions are saved + // called by the parent modal when actions are saved const createAutomation = async parameters => { if (parameters.automationId || !parameters.newAutomationName) return - await automationStore.actions.create({name: parameters.newAutomationName}) + await automationStore.actions.create({ name: parameters.newAutomationName }) const appActionDefinition = $automationStore.blockDefinitions.TRIGGER.APP const newBlock = $automationStore.selectedAutomation.constructBlock( - "TRIGGER", "APP", appActionDefinition) - + "TRIGGER", + "APP", + appActionDefinition + ) newBlock.inputs = { - fields: Object.entries(parameters.fields).reduce((fields, [key, value]) => { - fields[key] = value.type - return fields - }, {}) + fields: Object.entries(parameters.fields).reduce( + (fields, [key, value]) => { + fields[key] = value.type + return fields + }, + {} + ), } automationStore.actions.addBlockToAutomation(newBlock) - await automationStore.actions.save( - $automationStore.selectedAutomation) + await automationStore.actions.save($automationStore.selectedAutomation) parameters.automationId = $automationStore.selectedAutomation.automation._id delete parameters.newAutomationName diff --git a/packages/builder/src/components/userInterface/EventsEditor/actions/SaveFields.svelte b/packages/builder/src/components/userInterface/EventsEditor/actions/SaveFields.svelte index 71d0ddf17f..221b41f199 100644 --- a/packages/builder/src/components/userInterface/EventsEditor/actions/SaveFields.svelte +++ b/packages/builder/src/components/userInterface/EventsEditor/actions/SaveFields.svelte @@ -1,6 +1,13 @@
-
- - - + disabled={!hasAutomations} /> +
- - - - + disabled={!hasAutomations} /> +
- {#if newOrExisting=== "existing"} - {/each} {:else} - + {/if} -
diff --git a/packages/worker/src/db/index.js b/packages/worker/src/db/index.js index 9095682172..24bbb55092 100644 --- a/packages/worker/src/db/index.js +++ b/packages/worker/src/db/index.js @@ -5,7 +5,8 @@ const { join } = require("path") const { homedir } = require("os") // level option is purely for testing (development) -const COUCH_DB_URL = env.COUCH_DB_URL || `leveldb://${join(homedir(), ".budibase")}/.data/` +const COUCH_DB_URL = + env.COUCH_DB_URL || `leveldb://${join(homedir(), ".budibase")}/.data/` const Pouch = PouchDB.defaults({ prefix: COUCH_DB_URL, @@ -13,4 +14,4 @@ const Pouch = PouchDB.defaults({ allDbs(Pouch) -module.exports = Pouch \ No newline at end of file +module.exports = Pouch diff --git a/packages/worker/src/middleware/check-key.js b/packages/worker/src/middleware/check-key.js index 762cb1ae45..03d54a9dd6 100644 --- a/packages/worker/src/middleware/check-key.js +++ b/packages/worker/src/middleware/check-key.js @@ -2,8 +2,7 @@ const env = require("../environment") module.exports = async (ctx, next) => { const selfHostKey = - ctx.request.headers["x-budibase-auth"] || - ctx.request.body.selfHostKey + ctx.request.headers["x-budibase-auth"] || ctx.request.body.selfHostKey if (!selfHostKey || env.SELF_HOST_KEY !== selfHostKey) { ctx.throw(401, "Request unauthorised") } else {