formatting + fixing builder tests
This commit is contained in:
parent
e55120bb62
commit
c255883aed
|
@ -9,14 +9,14 @@ import builtins from "rollup-plugin-node-builtins"
|
|||
import nodeglobals from "rollup-plugin-node-globals"
|
||||
import copy from "rollup-plugin-copy"
|
||||
import replace from "rollup-plugin-replace"
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
import json from "@rollup/plugin-json"
|
||||
|
||||
import path from "path"
|
||||
|
||||
const production = !process.env.ROLLUP_WATCH
|
||||
|
||||
const lodash_fp_exports = [
|
||||
"flow",
|
||||
"pipe",
|
||||
"union",
|
||||
"reduce",
|
||||
|
@ -121,7 +121,16 @@ const coreExternal = [
|
|||
]
|
||||
|
||||
const customResolver = resolve({
|
||||
extensions: [".mjs", ".js", ".jsx", ".json", ".sass", ".scss", ".svelte", ".css"]
|
||||
extensions: [
|
||||
".mjs",
|
||||
".js",
|
||||
".jsx",
|
||||
".json",
|
||||
".sass",
|
||||
".scss",
|
||||
".svelte",
|
||||
".css",
|
||||
],
|
||||
})
|
||||
const projectRootDir = path.resolve(__dirname)
|
||||
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
const apiCall = method => async (url, body) => {
|
||||
const jwt = localStorage.getItem("budibase:token");
|
||||
|
||||
const response = await fetch(url, {
|
||||
method: method,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${jwt}`
|
||||
},
|
||||
body: body && JSON.stringify(body),
|
||||
})
|
||||
|
@ -14,7 +11,7 @@ const apiCall = method => async (url, body) => {
|
|||
// throw new Error("Server Error");
|
||||
// }
|
||||
|
||||
return response;
|
||||
return response
|
||||
}
|
||||
|
||||
const post = apiCall("POST")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { pipe } from "components/common/core";
|
||||
import { pipe } from "components/common/core"
|
||||
import { filter, map, reduce, toPairs } from "lodash/fp"
|
||||
|
||||
const self = n => n
|
||||
|
@ -88,7 +88,7 @@ const css_map = {
|
|||
}
|
||||
|
||||
export const generate_rule = ([name, values]) =>
|
||||
`${css_map[name].name}: ${css_map[name].generate(values)} !important;`
|
||||
`${css_map[name].name}: ${css_map[name].generate(values)};`
|
||||
|
||||
const handle_grid = (acc, [name, value]) => {
|
||||
let tmp = []
|
||||
|
@ -113,9 +113,7 @@ const object_to_css_string = [
|
|||
export const generate_css = ({ layout, position }) => {
|
||||
let _layout = pipe(layout, object_to_css_string)
|
||||
if (_layout.length) {
|
||||
_layout += `\ndisplay: ${
|
||||
_layout.includes("flex") ? "flex" : "grid"
|
||||
} !important;`
|
||||
_layout += `\ndisplay: ${_layout.includes("flex") ? "flex" : "grid"};`
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -13,4 +13,4 @@ export const initialise = async () => {
|
|||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
* @param {string} appId - ID of the currently running app
|
||||
*/
|
||||
export const fetchComponentLibDefinitions = async (clientId, appId) => {
|
||||
const LIB_DEFINITION_URL = `/${clientId}/${appId}/components/definitions`;
|
||||
const LIB_DEFINITION_URL = `/${clientId}/${appId}/components/definitions`
|
||||
try {
|
||||
const libDefinitionResponse = await fetch(LIB_DEFINITION_URL);
|
||||
return await libDefinitionResponse.json();
|
||||
const libDefinitionResponse = await fetch(LIB_DEFINITION_URL)
|
||||
return await libDefinitionResponse.json()
|
||||
} catch (err) {
|
||||
console.error(`Error fetching component definitions for ${appId}`, err);
|
||||
console.error(`Error fetching component definitions for ${appId}`, err)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the JavaScript files for app component libraries and returns a map of their modules.
|
||||
|
@ -22,52 +22,10 @@ export const fetchComponentLibModules = async application => {
|
|||
const allLibraries = {}
|
||||
|
||||
for (let libraryName of application.componentLibraries) {
|
||||
const LIBRARY_URL = `/${application._id}/componentlibrary?library=${libraryName}`;
|
||||
const LIBRARY_URL = `/${application._id}/componentlibrary?library=${libraryName}`
|
||||
const libraryModule = await import(LIBRARY_URL)
|
||||
allLibraries[libraryName] = libraryModule
|
||||
}
|
||||
|
||||
return allLibraries
|
||||
}
|
||||
|
||||
// export const loadLibUrls = (appId, appPackage) => {
|
||||
// const allLibraries = []
|
||||
// for (let lib of libsFromPages(appPackage.pages)) {
|
||||
// const libUrl = makeLibraryUrl(appId, lib)
|
||||
// allLibraries.push({ libName: lib, importPath: libUrl })
|
||||
// }
|
||||
|
||||
// return allLibraries
|
||||
// }
|
||||
|
||||
// export const loadLib = async (appId, lib, allLibs) => {
|
||||
// allLibs[lib] = await import(makeLibraryUrl(appId, lib))
|
||||
// return allLibs
|
||||
// }
|
||||
|
||||
// export const makeLibraryUrl = (appId, lib) =>
|
||||
// `/_builder/${appId}/componentlibrary?lib=${encodeURI(lib)}`
|
||||
|
||||
// export const libsFromPages = pages =>
|
||||
// pipe(pages, [values, map(p => p.componentLibraries), flatten, uniq])
|
||||
|
||||
// export const libUrlsForPreview = (appPackage, pageName) => {
|
||||
// const resolve = path => {
|
||||
// let file = appPackage.components.libraryPaths[path]
|
||||
// if (file.startsWith("./")) file = file.substring(2)
|
||||
// if (file.startsWith("/")) file = file.substring(1)
|
||||
|
||||
// let newPath = path
|
||||
|
||||
// if (!newPath.startsWith("./") && !newPath.startsWith("/")) {
|
||||
// newPath = `/node_modules/${path}`
|
||||
// }
|
||||
|
||||
// return {
|
||||
// importPath: `/lib${newPath}/${file}`,
|
||||
// libName: path,
|
||||
// }
|
||||
// }
|
||||
|
||||
// return pipe([appPackage.pages[pageName]], [libsFromPages, map(resolve)])
|
||||
// }
|
||||
|
|
|
@ -24,10 +24,10 @@ export const getBackendUiStore = () => {
|
|||
state.selectedDatabase = db
|
||||
state.breadcrumbs = [db.name]
|
||||
state.models = models
|
||||
state.views = views;
|
||||
state.views = views
|
||||
return state
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
records: {
|
||||
delete: () =>
|
||||
|
@ -47,11 +47,12 @@ export const getBackendUiStore = () => {
|
|||
}),
|
||||
},
|
||||
models: {
|
||||
create: model => store.update(state => {
|
||||
state.models.push(model)
|
||||
state.models = state.models
|
||||
return state
|
||||
})
|
||||
create: model =>
|
||||
store.update(state => {
|
||||
state.models.push(model)
|
||||
state.models = state.models
|
||||
return state
|
||||
}),
|
||||
},
|
||||
views: {
|
||||
select: view =>
|
||||
|
@ -90,4 +91,4 @@ export const saveBackend = async state => {
|
|||
},
|
||||
accessLevels: state.accessLevels,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ import { pipe } from "components/common/core"
|
|||
import * as backendStoreActions from "./backend"
|
||||
import { writable, get } from "svelte/store"
|
||||
import api from "../api"
|
||||
import {
|
||||
DEFAULT_PAGES_OBJECT
|
||||
} from "../../constants";
|
||||
import { DEFAULT_PAGES_OBJECT } from "../../constants"
|
||||
import { getExactComponent } from "components/userInterface/pagesParsing/searchComponents"
|
||||
import { rename } from "components/userInterface/pagesParsing/renameScreen"
|
||||
import {
|
||||
|
@ -13,9 +11,9 @@ import {
|
|||
makePropsSafe,
|
||||
getBuiltin,
|
||||
} from "components/userInterface/pagesParsing/createProps"
|
||||
import {
|
||||
fetchComponentLibModules,
|
||||
fetchComponentLibDefinitions
|
||||
import {
|
||||
fetchComponentLibModules,
|
||||
fetchComponentLibDefinitions,
|
||||
} from "../loadComponentLibraries"
|
||||
import { buildCodeForScreens } from "../buildCodeForScreens"
|
||||
import { generate_screen_css } from "../generate_css"
|
||||
|
@ -39,7 +37,7 @@ export const getStore = () => {
|
|||
errors: [],
|
||||
hasAppPackage: false,
|
||||
libraries: null,
|
||||
appId: ""
|
||||
appId: "",
|
||||
}
|
||||
|
||||
const store = writable(initial)
|
||||
|
@ -82,10 +80,11 @@ export const getStore = () => {
|
|||
|
||||
export default getStore
|
||||
|
||||
const setPackage = (store, initial) => async (pkg) => {
|
||||
|
||||
const setPackage = (store, initial) => async pkg => {
|
||||
const [main_screens, unauth_screens] = await Promise.all([
|
||||
api.get(`/_builder/api/${pkg.application._id}/pages/main/screens`).then(r => r.json()),
|
||||
api
|
||||
.get(`/_builder/api/${pkg.application._id}/pages/main/screens`)
|
||||
.then(r => r.json()),
|
||||
api
|
||||
.get(`/_builder/api/${pkg.application._id}/pages/unauthenticated/screens`)
|
||||
.then(r => r.json()),
|
||||
|
@ -103,8 +102,10 @@ const setPackage = (store, initial) => async (pkg) => {
|
|||
}
|
||||
|
||||
initial.libraries = await fetchComponentLibModules(pkg.application)
|
||||
// TODO: Rename to componentDefinitions
|
||||
initial.components = await fetchComponentLibDefinitions(pkg.clientId, pkg.application._id);
|
||||
initial.components = await fetchComponentLibDefinitions(
|
||||
pkg.clientId,
|
||||
pkg.application._id
|
||||
)
|
||||
initial.appname = pkg.application.name
|
||||
initial.appId = pkg.application._id
|
||||
initial.pages = pkg.pages
|
||||
|
@ -129,10 +130,7 @@ const _saveScreen = async (store, s, screen) => {
|
|||
const currentPageScreens = s.pages[s.currentPageName]._screens
|
||||
|
||||
await api
|
||||
.post(
|
||||
`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`,
|
||||
screen
|
||||
)
|
||||
.post(`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`, screen)
|
||||
.then(() => {
|
||||
if (currentPageScreens.includes(screen)) return
|
||||
|
||||
|
@ -159,10 +157,7 @@ const _saveScreen = async (store, s, screen) => {
|
|||
|
||||
const _saveScreenApi = (screen, s) =>
|
||||
api
|
||||
.post(
|
||||
`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`,
|
||||
screen
|
||||
)
|
||||
.post(`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`, screen)
|
||||
.then(() => _savePage(s))
|
||||
|
||||
const createScreen = store => (screenName, route, layoutComponentName) => {
|
||||
|
@ -309,7 +304,7 @@ const setCurrentPage = store => pageName => {
|
|||
store.update(state => {
|
||||
const current_screens = state.pages[pageName]._screens
|
||||
|
||||
const currentPage = state.pages[pageName];
|
||||
const currentPage = state.pages[pageName]
|
||||
|
||||
state.currentFrontEndType = "page"
|
||||
state.currentPageName = pageName
|
||||
|
@ -486,7 +481,9 @@ const deleteComponent = store => componentName => {
|
|||
const parent = getParent(state.currentPreviewItem.props, componentName)
|
||||
|
||||
if (parent) {
|
||||
parent._children = parent._children.filter(component => component !== componentName)
|
||||
parent._children = parent._children.filter(
|
||||
component => component !== componentName
|
||||
)
|
||||
}
|
||||
|
||||
_saveCurrentPreviewItem(state)
|
||||
|
@ -549,11 +546,10 @@ const copyComponent = store => component => {
|
|||
}
|
||||
|
||||
const getPathToComponent = store => component => {
|
||||
|
||||
// Gets all the components to needed to construct a path.
|
||||
const tempStore = get(store)
|
||||
let pathComponents = []
|
||||
let parent = component;
|
||||
let parent = component
|
||||
let root = false
|
||||
while (!root) {
|
||||
parent = getParent(tempStore.currentPreviewItem.props, parent)
|
||||
|
@ -575,7 +571,7 @@ const getPathToComponent = store => component => {
|
|||
const IdList = allComponents.map(c => c._id)
|
||||
|
||||
// Construct ID Path:
|
||||
const path = IdList.join('/')
|
||||
const path = IdList.join("/")
|
||||
|
||||
return path
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
.button:hover {
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
filter:saturate(90%);
|
||||
filter: saturate(90%);
|
||||
}
|
||||
|
||||
.button:disabled {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
`,
|
||||
status,
|
||||
timeout: 100000
|
||||
timeout: 100000,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
width="100%"
|
||||
height="100%">
|
||||
<path fill="none" d="M0 0h24v24H0z"/>
|
||||
<path
|
||||
fill="rgba(0,3,51,1)"
|
||||
d="M12 14l-4-4h8z" />
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
width="100%"
|
||||
height="100%">
|
||||
<path fill="none" d="M0 0h24v24H0z" />
|
||||
<path fill="rgba(0,3,51,1)" d="M12 14l-4-4h8z" />
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 196 B |
|
@ -16,6 +16,10 @@
|
|||
<div class="uk-margin">
|
||||
<label class="uk-form-label">{label}</label>
|
||||
<div class="uk-form-controls">
|
||||
<input class="budibase__input" type="number" {value} on:change={inputChanged} />
|
||||
<input
|
||||
class="budibase__input"
|
||||
type="number"
|
||||
{value}
|
||||
on:change={inputChanged} />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import { flow } from "lodash/fp";
|
||||
import { flow } from "lodash/fp"
|
||||
|
||||
export const pipe = (arg, funcs) => flow(funcs)(arg)
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
import { eventHandlers } from "../../../../client/src/state/eventHandlers"
|
||||
import { writable } from "svelte/store"
|
||||
export { EVENT_TYPE_MEMBER_NAME } from "../../../../client/src/state/eventHandlers"
|
||||
import { createCoreApi } from "../../../../client/src/core"
|
||||
|
||||
export const allHandlers = (appDefinition, user) => {
|
||||
const coreApi = createCoreApi(appDefinition, user)
|
||||
appDefinition.hierarchy = coreApi.templateApi.constructHierarchy(
|
||||
appDefinition.hierarchy
|
||||
)
|
||||
export const allHandlers = user => {
|
||||
const store = writable({
|
||||
_bbuser: user,
|
||||
})
|
||||
|
||||
const handlersObj = eventHandlers(store, coreApi)
|
||||
const handlersArray = []
|
||||
for (let key in handlersObj) {
|
||||
handlersArray.push({ name: key, ...handlersObj[key] })
|
||||
}
|
||||
return handlersArray
|
||||
const handlersObj = eventHandlers(store)
|
||||
|
||||
const handlers = Object.keys(handlersObj).map(name => ({
|
||||
name,
|
||||
...handlersObj[name],
|
||||
}))
|
||||
|
||||
return handlers
|
||||
}
|
||||
|
|
|
@ -64,10 +64,14 @@
|
|||
|
||||
$: {
|
||||
if ($backendUiStore.selectedView) {
|
||||
api.fetchDataForView($backendUiStore.selectedView, instanceId).then(records => {
|
||||
data = records || []
|
||||
headers = Object.keys($backendUiStore.selectedModel.schema).filter(key => !INTERNAL_HEADERS.includes(key));
|
||||
})
|
||||
api
|
||||
.fetchDataForView($backendUiStore.selectedView, instanceId)
|
||||
.then(records => {
|
||||
data = records || []
|
||||
headers = Object.keys($backendUiStore.selectedModel.schema).filter(
|
||||
key => !INTERNAL_HEADERS.includes(key)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,9 +98,7 @@
|
|||
|
||||
<section>
|
||||
<div class="table-controls">
|
||||
<h2 class="title">
|
||||
{$backendUiStore.selectedModel.name}
|
||||
</h2>
|
||||
<h2 class="title">{$backendUiStore.selectedModel.name}</h2>
|
||||
</div>
|
||||
<table class="uk-table">
|
||||
<thead>
|
||||
|
|
|
@ -4,13 +4,13 @@ export async function createUser(user, appId, instanceId) {
|
|||
const CREATE_USER_URL = `/api/${appId}/${instanceId}/users`
|
||||
const response = await api.post(CREATE_USER_URL, user)
|
||||
const json = await response.json()
|
||||
return json.user;
|
||||
return json.user
|
||||
}
|
||||
|
||||
export async function createDatabase(clientId, appname, instanceName) {
|
||||
const CREATE_DATABASE_URL = `/api/${clientId}/${appname}/instances`
|
||||
const response = await api.post(CREATE_DATABASE_URL, {
|
||||
name: instanceName
|
||||
name: instanceName,
|
||||
})
|
||||
return await response.json()
|
||||
}
|
||||
|
@ -21,16 +21,10 @@ export async function deleteRecord(record, instanceId) {
|
|||
return response
|
||||
}
|
||||
|
||||
// export async function loadRecord(key, { appname, instanceId }) {
|
||||
// const LOAD_RECORDS_URL = `/_builder/instance/${appname}/${instanceId}/api/record${key}`
|
||||
// const response = await api.get(LOAD_RECORDS_URL)
|
||||
// return await response.json()
|
||||
// }
|
||||
|
||||
export async function saveRecord(record, instanceId) {
|
||||
const SAVE_RECORDS_URL = `/api/${instanceId}/records`
|
||||
const response = await api.post(SAVE_RECORDS_URL, record)
|
||||
|
||||
|
||||
return await response.json()
|
||||
}
|
||||
|
||||
|
@ -39,4 +33,4 @@ export async function fetchDataForView(viewName, instanceId) {
|
|||
|
||||
const response = await api.get(FETCH_RECORDS_URL)
|
||||
return await response.json()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,11 @@
|
|||
let databaseName
|
||||
|
||||
async function createDatabase() {
|
||||
const response = await api.createDatabase($store.clientId, $store.appId, databaseName)
|
||||
const response = await api.createDatabase(
|
||||
$store.clientId,
|
||||
$store.appId,
|
||||
databaseName
|
||||
)
|
||||
store.createDatabaseForApp(response.instance)
|
||||
onClosed()
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import FieldView from "./FieldView.svelte"
|
||||
import api from "builderStore/api"
|
||||
import { store, backendUiStore } from "builderStore"
|
||||
import { common, hierarchy } from "../../../../../../../core/src/"
|
||||
import { pipe } from "components/common/core"
|
||||
import ErrorsBox from "components/common/ErrorsBox.svelte"
|
||||
|
||||
|
@ -21,24 +20,18 @@
|
|||
$: modelFields = model.schema ? Object.entries(model.schema) : []
|
||||
$: instanceId = $backendUiStore.selectedDatabase.id
|
||||
|
||||
function editField() {
|
||||
function editField() {}
|
||||
|
||||
}
|
||||
function deleteField() {}
|
||||
|
||||
function deleteField() {
|
||||
|
||||
}
|
||||
|
||||
function onFinishedFieldEdit() {
|
||||
|
||||
}
|
||||
function onFinishedFieldEdit() {}
|
||||
|
||||
async function saveModel() {
|
||||
const SAVE_MODEL_URL = `/api/${instanceId}/models`
|
||||
const response = await api.post(SAVE_MODEL_URL, model)
|
||||
const newModel = await response.json()
|
||||
backendUiStore.actions.models.create(newModel.model)
|
||||
onClosed();
|
||||
onClosed()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -98,18 +91,15 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<div class="uk-margin">
|
||||
<ActionButton color="secondary" on:click={saveModel}>
|
||||
Save
|
||||
</ActionButton>
|
||||
<ActionButton color="secondary" on:click={saveModel}>Save</ActionButton>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<FieldView
|
||||
field={fieldToEdit}
|
||||
onFinished={onFinishedFieldEdit}
|
||||
schema={model.schema}
|
||||
goBack={() => showFieldView = false}
|
||||
/>
|
||||
schema={model.schema}
|
||||
goBack={() => (showFieldView = false)} />
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import ErrorsBox from "components/common/ErrorsBox.svelte"
|
||||
|
||||
const CLASS_NAME_MAP = {
|
||||
boolean: "uk-checkbox"
|
||||
boolean: "uk-checkbox",
|
||||
}
|
||||
|
||||
export let record = {}
|
||||
|
@ -55,7 +55,7 @@
|
|||
|
||||
backendUiStore.update(state => {
|
||||
state.selectedView = state.selectedView
|
||||
onClosed();
|
||||
onClosed()
|
||||
return state
|
||||
})
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
state.views = [...state.views, response.view]
|
||||
return state
|
||||
})
|
||||
onClosed();
|
||||
onClosed()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -71,9 +71,7 @@
|
|||
<CodeArea bind:text={view.reduce} label="Reduce" />
|
||||
{/if}
|
||||
|
||||
<ActionButton color="secondary" on:click={saveView}>
|
||||
Save
|
||||
</ActionButton>
|
||||
<ActionButton color="secondary" on:click={saveView}>Save</ActionButton>
|
||||
<ActionButton alert on:click={deleteView}>Delete</ActionButton>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
async function createUser() {
|
||||
const user = { name: username, username, password }
|
||||
const response = await api.createUser(user, appId, instanceId);
|
||||
const response = await api.createUser(user, appId, instanceId)
|
||||
backendUiStore.actions.users.create(response)
|
||||
onClosed()
|
||||
}
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
export let errors = []
|
||||
export let className = "uk-input"
|
||||
|
||||
let checked = type === "checkbox" ? value : false;
|
||||
let checked = type === "checkbox" ? value : false
|
||||
|
||||
const handleInput = event => {
|
||||
if (event.target.type === "checkbox") {
|
||||
value = event.target.checked;
|
||||
return;
|
||||
value = event.target.checked
|
||||
return
|
||||
}
|
||||
|
||||
if (event.target.type === "number") {
|
||||
value = parseInt(event.target.value);
|
||||
return;
|
||||
value = parseInt(event.target.value)
|
||||
return
|
||||
}
|
||||
|
||||
value = event.target.value;
|
||||
value = event.target.value
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -51,12 +51,13 @@
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
async function deleteModel(modelToDelete) {
|
||||
const DELETE_MODEL_URL = `/api/${instanceId}/models/${node._id}/${node._rev}`
|
||||
const response = await api.delete(DELETE_MODEL_URL)
|
||||
backendUiStore.update(state => {
|
||||
state.models = state.models.filter(model => model._id !== modelToDelete._id)
|
||||
state.models = state.models.filter(
|
||||
model => model._id !== modelToDelete._id
|
||||
)
|
||||
state.selectedView = {}
|
||||
return state
|
||||
})
|
||||
|
@ -83,11 +84,7 @@
|
|||
|
||||
<div class="hierarchy-items-container">
|
||||
{#each $backendUiStore.models as model}
|
||||
<HierarchyRow
|
||||
onSelect={selectModel}
|
||||
node={model}
|
||||
type="model"
|
||||
/>
|
||||
<HierarchyRow onSelect={selectModel} node={model} type="model" />
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -104,11 +101,7 @@
|
|||
|
||||
<div class="hierarchy-items-container">
|
||||
{#each $backendUiStore.views as view}
|
||||
<HierarchyRow
|
||||
onSelect={selectView}
|
||||
node={view}
|
||||
type="view"
|
||||
/>
|
||||
<HierarchyRow onSelect={selectView} node={view} type="view" />
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { store, backendUiStore } from "builderStore"
|
||||
import { map, join } from "lodash/fp"
|
||||
import iframeTemplate from "./iframeTemplate";
|
||||
import iframeTemplate from "./iframeTemplate"
|
||||
import { pipe } from "components/common/core"
|
||||
|
||||
let iframe
|
||||
|
@ -25,61 +25,71 @@
|
|||
)
|
||||
$: hasComponent = !!$store.currentPreviewItem
|
||||
$: {
|
||||
// Apply the CSS from the currently selected page and its screens
|
||||
const currentPage = $store.pages[$store.currentPageName];
|
||||
styles += currentPage._css;
|
||||
// Apply the CSS from the currently selected page and its screens
|
||||
const currentPage = $store.pages[$store.currentPageName]
|
||||
styles += currentPage._css
|
||||
for (let screen of currentPage._screens) {
|
||||
styles += screen._css;
|
||||
styles += screen._css
|
||||
}
|
||||
styles = styles
|
||||
}
|
||||
|
||||
$: stylesheetLinks = pipe(
|
||||
$store.pages.stylesheets,
|
||||
[map(s => `<link rel="stylesheet" href="${s}"/>`), join("\n")]
|
||||
)
|
||||
$: stylesheetLinks = pipe($store.pages.stylesheets, [
|
||||
map(s => `<link rel="stylesheet" href="${s}"/>`),
|
||||
join("\n"),
|
||||
])
|
||||
|
||||
$: screensExist = $store.currentPreviewItem._screens && $store.currentPreviewItem._screens.length > 0
|
||||
$: screensExist =
|
||||
$store.currentPreviewItem._screens &&
|
||||
$store.currentPreviewItem._screens.length > 0
|
||||
|
||||
$: frontendDefinition = {
|
||||
appId: $store.appId,
|
||||
libraries: Object.keys($store.libraries),
|
||||
page: $store.currentPreviewItem,
|
||||
screens: screensExist ? $store.currentPreviewItem._screens : [{
|
||||
name: "Screen Placeholder",
|
||||
route: "*",
|
||||
props: {
|
||||
_component: "@budibase/standard-components/container",
|
||||
type: "div",
|
||||
_children: [
|
||||
screens: screensExist
|
||||
? $store.currentPreviewItem._screens
|
||||
: [
|
||||
{
|
||||
_component: "@budibase/standard-components/container",
|
||||
_styles: { "position": {},"layout": {} },
|
||||
_id: "__screenslot__text",
|
||||
_code: "",
|
||||
className: "",
|
||||
onLoad: [],
|
||||
type: "div",
|
||||
_children: [{
|
||||
_component:"@budibase/standard-components/text",
|
||||
_styles: { "position": {}, "layout": {} },
|
||||
_id: "__screenslot__text_2",
|
||||
_code: "",
|
||||
text: "content",
|
||||
font: "",
|
||||
color: "",
|
||||
textAlign: "inline",
|
||||
verticalAlign: "inline",
|
||||
formattingTag: "none"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}],
|
||||
appRootPath: ""
|
||||
name: "Screen Placeholder",
|
||||
route: "*",
|
||||
props: {
|
||||
_component: "@budibase/standard-components/container",
|
||||
type: "div",
|
||||
_children: [
|
||||
{
|
||||
_component: "@budibase/standard-components/container",
|
||||
_styles: { position: {}, layout: {} },
|
||||
_id: "__screenslot__text",
|
||||
_code: "",
|
||||
className: "",
|
||||
onLoad: [],
|
||||
type: "div",
|
||||
_children: [
|
||||
{
|
||||
_component: "@budibase/standard-components/text",
|
||||
_styles: { position: {}, layout: {} },
|
||||
_id: "__screenslot__text_2",
|
||||
_code: "",
|
||||
text: "content",
|
||||
font: "",
|
||||
color: "",
|
||||
textAlign: "inline",
|
||||
verticalAlign: "inline",
|
||||
formattingTag: "none",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
appRootPath: "",
|
||||
}
|
||||
|
||||
$: selectedComponentId = $store.currentComponentInfo ? $store.currentComponentInfo._id : ""
|
||||
$: selectedComponentId = $store.currentComponentInfo
|
||||
? $store.currentComponentInfo._id
|
||||
: ""
|
||||
</script>
|
||||
|
||||
<div class="component-container">
|
||||
|
@ -93,7 +103,7 @@
|
|||
stylesheetLinks,
|
||||
selectedComponentId,
|
||||
frontendDefinition: JSON.stringify(frontendDefinition),
|
||||
currentPageFunctions: $store.currentPageFunctions
|
||||
currentPageFunctions: $store.currentPageFunctions,
|
||||
})} />
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
@ -3,13 +3,13 @@ export default ({
|
|||
stylesheetLinks,
|
||||
selectedComponentId,
|
||||
frontendDefinition,
|
||||
currentPageFunctions
|
||||
currentPageFunctions,
|
||||
}) => `<html>
|
||||
<head>
|
||||
${stylesheetLinks}
|
||||
|
||||
<style>
|
||||
${styles || ''}
|
||||
${styles || ""}
|
||||
|
||||
.pos-${selectedComponentId} {
|
||||
border: 2px solid #0055ff;
|
||||
|
@ -45,4 +45,4 @@ export default ({
|
|||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>`
|
||||
</html>`
|
||||
|
|
|
@ -1 +1 @@
|
|||
export { default } from "./CurrentItemPreview.svelte";
|
||||
export { default } from "./CurrentItemPreview.svelte"
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
|
||||
const isComponentSelected = (current, comp) => current === comp
|
||||
|
||||
$: _screens = pipe(
|
||||
screens,
|
||||
[map(c => ({ component: c, title: lastPartOfName(c) })), sortBy("title")]
|
||||
)
|
||||
$: _screens = pipe(screens, [
|
||||
map(c => ({ component: c, title: lastPartOfName(c) })),
|
||||
sortBy("title"),
|
||||
])
|
||||
|
||||
const isScreenSelected = component =>
|
||||
component.component &&
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { goto } from "@sveltech/routify"
|
||||
import { store } from "builderStore"
|
||||
import { last } from "lodash/fp"
|
||||
import { pipe } from "components/common/core";
|
||||
import { pipe } from "components/common/core"
|
||||
import {
|
||||
XCircleIcon,
|
||||
ChevronUpIcon,
|
||||
|
|
|
@ -33,11 +33,9 @@
|
|||
let selectedEvent = null
|
||||
|
||||
$: {
|
||||
const componentDefinition = components[component._component];
|
||||
const componentDefinition = components[component._component]
|
||||
events = Object.keys(componentDefinition.props)
|
||||
.filter(
|
||||
propName => componentDefinition.props[propName] === EVENT_TYPE
|
||||
)
|
||||
.filter(propName => componentDefinition.props[propName] === EVENT_TYPE)
|
||||
.map(propName => ({
|
||||
name: propName,
|
||||
handlers: component[propName] || [],
|
||||
|
|
|
@ -24,14 +24,7 @@
|
|||
let handlerType
|
||||
let parameters = []
|
||||
|
||||
$: eventOptions = allHandlers(
|
||||
{ hierarchy: $store.hierarchy },
|
||||
{}
|
||||
// userWithFullAccess({
|
||||
// hierarchy: $store.hierarchy,
|
||||
// actions: keyBy("name")($store.actions),
|
||||
// })
|
||||
)
|
||||
$: eventOptions = allHandlers()
|
||||
|
||||
$: {
|
||||
if (handler) {
|
||||
|
|
|
@ -26,10 +26,14 @@
|
|||
|
||||
let saveAttempted = false
|
||||
|
||||
$: layoutComponents = Object.values($store.components).filter(componentDefinition => componentDefinition.container)
|
||||
$: layoutComponents = Object.values($store.components).filter(
|
||||
componentDefinition => componentDefinition.container
|
||||
)
|
||||
|
||||
$: layoutComponent = layoutComponent
|
||||
? layoutComponents.find(component => component._component === layoutComponent._component)
|
||||
? layoutComponents.find(
|
||||
component => component._component === layoutComponent._component
|
||||
)
|
||||
: layoutComponents[0]
|
||||
|
||||
$: route = !route && $store.screens.length === 0 ? "*" : route
|
||||
|
@ -55,11 +59,15 @@
|
|||
}
|
||||
|
||||
const screenNameExists = name => {
|
||||
return $store.screens.some(screen => screen.name.toLowerCase() === name.toLowerCase());
|
||||
return $store.screens.some(
|
||||
screen => screen.name.toLowerCase() === name.toLowerCase()
|
||||
)
|
||||
}
|
||||
|
||||
const routeNameExists = route => {
|
||||
return $store.screens.some(screen => screen.route.toLowerCase() === route.toLowerCase());
|
||||
return $store.screens.some(
|
||||
screen => screen.route.toLowerCase() === route.toLowerCase()
|
||||
)
|
||||
}
|
||||
|
||||
const routeChanged = event => {
|
||||
|
|
|
@ -3,7 +3,15 @@
|
|||
// import { tick } from "svelte"
|
||||
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
||||
|
||||
import { last, sortBy, map, trimCharsStart, trimChars, join, compose } from "lodash/fp"
|
||||
import {
|
||||
last,
|
||||
sortBy,
|
||||
map,
|
||||
trimCharsStart,
|
||||
trimChars,
|
||||
join,
|
||||
compose,
|
||||
} from "lodash/fp"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
import { pipe } from "components/common/core"
|
||||
import { store } from "builderStore"
|
||||
|
@ -23,7 +31,7 @@
|
|||
|
||||
$: _layout = {
|
||||
component: layout,
|
||||
title: lastPartOfName(layout)
|
||||
title: lastPartOfName(layout),
|
||||
}
|
||||
|
||||
const isScreenSelected = component =>
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
$: page = $store.pages[$store.currentPageName]
|
||||
$: title = page.index.title
|
||||
$: components = pipe(
|
||||
$store.components,
|
||||
[filter(store => !isRootComponent($store)), concat([notSelectedComponent])]
|
||||
)
|
||||
$: components = pipe($store.components, [
|
||||
filter(store => !isRootComponent($store)),
|
||||
concat([notSelectedComponent]),
|
||||
])
|
||||
$: entryComponent = components[page.appBody] || notSelectedComponent
|
||||
|
||||
const save = () => {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<form on:submit|preventDefault class="uk-form-stacked form-root">
|
||||
{#if componentDef}
|
||||
{#each Object.entries(componentDef.props) as [prop_name, prop_def], index}
|
||||
{#if prop_def !== "event"}
|
||||
{#if prop_def !== 'event'}
|
||||
<div class="prop-container">
|
||||
<PropControl
|
||||
{setProp}
|
||||
|
|
|
@ -36,9 +36,9 @@ export const createProps = (componentDefinition, derivedFromProps) => {
|
|||
for (let propName in componentDefinition.props) {
|
||||
const parsedPropDef = parsePropDef(componentDefinition.props[propName])
|
||||
|
||||
if (parsedPropDef.error) {
|
||||
if (parsedPropDef.error) {
|
||||
errors.push({ propName, error: parsedPropDef.error })
|
||||
} else {
|
||||
} else {
|
||||
props[propName] = parsedPropDef
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { find, isUndefined, filter, some, includes } from "lodash/fp"
|
||||
import { pipe } from "components/common/core";
|
||||
import { pipe } from "components/common/core"
|
||||
|
||||
const normalString = s => (s || "").trim().toLowerCase()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { split, last } from "lodash/fp"
|
||||
import { pipe } from "components/common/core";
|
||||
import { pipe } from "components/common/core"
|
||||
|
||||
export const splitName = fullname => {
|
||||
const componentName = pipe(fullname, [split("/"), last])
|
||||
|
|
|
@ -1,99 +1,23 @@
|
|||
import {
|
||||
isString,
|
||||
isBoolean,
|
||||
isNumber,
|
||||
isArray,
|
||||
isPlainObject,
|
||||
every,
|
||||
} from "lodash/fp"
|
||||
|
||||
import { EVENT_TYPE_MEMBER_NAME } from "../../common/eventHandlers"
|
||||
|
||||
import {
|
||||
isBound,
|
||||
BB_STATE_BINDINGPATH,
|
||||
} from "@budibase/client/src/state/parseBinding"
|
||||
|
||||
// const defaultDef = typeName => () => ({
|
||||
// type: typeName,
|
||||
// required: false,
|
||||
// default: types[typeName].default,
|
||||
// options: typeName === "options" ? [] : undefined,
|
||||
// })
|
||||
|
||||
// const propType = (defaultValue, isOfType, defaultDefinition) => ({
|
||||
// isOfType,
|
||||
// default: defaultValue,
|
||||
// defaultDefinition,
|
||||
// })
|
||||
|
||||
// const expandSingleProp = propDef => {
|
||||
// const p = isString(propDef) ? types[propDef].defaultDefinition() : propDef
|
||||
|
||||
// if (!isString(propDef)) {
|
||||
// const def = types[propDef.type].defaultDefinition()
|
||||
// for (let p in def) {
|
||||
// if (propDef[p] === undefined) {
|
||||
// propDef[p] = def[p]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return p
|
||||
// }
|
||||
|
||||
// export const expandComponentDefinition = componentDefinition => {
|
||||
// const expandedProps = {}
|
||||
// const expandedComponent = { ...componentDefinition }
|
||||
|
||||
// for (let p in componentDefinition.props) {
|
||||
// expandedProps[p] = expandSingleProp(componentDefinition.props[p])
|
||||
// }
|
||||
|
||||
// expandedComponent.props = expandedProps
|
||||
|
||||
// if (expandedComponent.children !== false) {
|
||||
// expandedComponent.children = true
|
||||
// }
|
||||
|
||||
// return expandedComponent
|
||||
// }
|
||||
|
||||
// const isEvent = e =>
|
||||
// isPlainObject(e) &&
|
||||
// isString(e[EVENT_TYPE_MEMBER_NAME]) &&
|
||||
// isPlainObject(e.parameters)
|
||||
|
||||
// const isEventList = e => isArray(e) && every(isEvent)(e)
|
||||
|
||||
// const EMPTY_STATE = () => ({ [BB_STATE_BINDINGPATH]: "" });
|
||||
|
||||
// export const types = {
|
||||
// string: propType("", isString, defaultDef("string")),
|
||||
// bool: propType(false, isBoolean, defaultDef("bool")),
|
||||
// number: propType(0, isNumber, defaultDef("number")),
|
||||
// options: propType("", isString, defaultDef("options")),
|
||||
// asset: propType("", isString, defaultDef("asset")),
|
||||
// event: propType([], isEventList, defaultDef("event")),
|
||||
// // state: propType(EMPTY_STATE, isBound, defaultDef("state")),
|
||||
// }
|
||||
|
||||
|
||||
export const TYPE_MAP = {
|
||||
string: {
|
||||
default: ""
|
||||
default: "",
|
||||
},
|
||||
bool: {
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
number: {
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
options: {
|
||||
default: [],
|
||||
options: []
|
||||
options: [],
|
||||
},
|
||||
event: {
|
||||
default: [],
|
||||
}
|
||||
};
|
||||
},
|
||||
state: {
|
||||
default: {
|
||||
"##bbstate": "",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
export default {
|
||||
categories: [
|
||||
{
|
||||
name: 'Basic',
|
||||
name: "Basic",
|
||||
isCategory: true,
|
||||
children: [
|
||||
{
|
||||
_component: "##builtin/screenslot",
|
||||
name: 'Screenslot',
|
||||
description: 'This component is a placeholder for the rendering of a screen within a page.',
|
||||
icon: 'ri-crop-2-line',
|
||||
name: "Screenslot",
|
||||
description:
|
||||
"This component is a placeholder for the rendering of a screen within a page.",
|
||||
icon: "ri-crop-2-line",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/container",
|
||||
name: 'Container',
|
||||
description: 'This component contains things within itself',
|
||||
icon: 'ri-layout-row-fill',
|
||||
name: "Container",
|
||||
description: "This component contains things within itself",
|
||||
icon: "ri-layout-row-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: 'Text',
|
||||
description: 'This is a simple text component',
|
||||
icon: 'ri-t-box-fill',
|
||||
name: "Text",
|
||||
description: "This is a simple text component",
|
||||
icon: "ri-t-box-fill",
|
||||
commonProps: {},
|
||||
children: [
|
||||
{
|
||||
_component: '@budibase/standard-components/heading',
|
||||
name: 'Headline',
|
||||
_component: "@budibase/standard-components/heading",
|
||||
name: "Headline",
|
||||
description: "A component for displaying heading text",
|
||||
icon: "ri-heading",
|
||||
props: {
|
||||
|
@ -41,123 +42,128 @@ export default {
|
|||
},
|
||||
},
|
||||
{
|
||||
_component: '@budibase/standard-components/text',
|
||||
name: 'Paragraph',
|
||||
_component: "@budibase/standard-components/text",
|
||||
name: "Paragraph",
|
||||
description: "A component for displaying paragraph text.",
|
||||
icon: 'ri-paragraph',
|
||||
props: {}
|
||||
}
|
||||
]
|
||||
icon: "ri-paragraph",
|
||||
props: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Input',
|
||||
name: "Input",
|
||||
description: "These components handle user input.",
|
||||
icon: 'ri-edit-box-line',
|
||||
icon: "ri-edit-box-line",
|
||||
commonProps: {},
|
||||
children: [
|
||||
{
|
||||
_component: "@budibase/standard-components/input",
|
||||
name: "Textfield",
|
||||
description: "A textfield component that allows the user to input text.",
|
||||
icon: 'ri-edit-box-line',
|
||||
props: {}
|
||||
description:
|
||||
"A textfield component that allows the user to input text.",
|
||||
icon: "ri-edit-box-line",
|
||||
props: {},
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/checkbox",
|
||||
name: "Checkbox",
|
||||
description: "A selectable checkbox component",
|
||||
icon: 'ri-checkbox-line',
|
||||
props: {}
|
||||
icon: "ri-checkbox-line",
|
||||
props: {},
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/radiobutton",
|
||||
name: "Radiobutton",
|
||||
description: "A selectable radiobutton component",
|
||||
icon: 'ri-radio-button-line',
|
||||
props: {}
|
||||
icon: "ri-radio-button-line",
|
||||
props: {},
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/select",
|
||||
name: "Select",
|
||||
description: "A select component for choosing from different options",
|
||||
icon: 'ri-file-list-line',
|
||||
props: {}
|
||||
}
|
||||
]
|
||||
description:
|
||||
"A select component for choosing from different options",
|
||||
icon: "ri-file-list-line",
|
||||
props: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/button",
|
||||
name: 'Button',
|
||||
description: 'A basic html button that is ready for styling',
|
||||
icon: 'ri-radio-button-fill',
|
||||
name: "Button",
|
||||
description: "A basic html button that is ready for styling",
|
||||
icon: "ri-radio-button-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/icon",
|
||||
name: 'Icon',
|
||||
description: 'A basic component for displaying icons',
|
||||
icon: 'ri-sun-fill',
|
||||
name: "Icon",
|
||||
description: "A basic component for displaying icons",
|
||||
icon: "ri-sun-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/link",
|
||||
name: 'Link',
|
||||
description: 'A basic link component for internal and external links',
|
||||
icon: 'ri-link',
|
||||
name: "Link",
|
||||
description: "A basic link component for internal and external links",
|
||||
icon: "ri-link",
|
||||
commonProps: {},
|
||||
children: []
|
||||
}
|
||||
]
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Blocks',
|
||||
name: "Blocks",
|
||||
isCategory: true,
|
||||
children: [
|
||||
{
|
||||
_component: "@budibase/materialdesign-components/BasicCard",
|
||||
name: 'Card',
|
||||
description: 'A basic card component that can contain content and actions.',
|
||||
icon: 'ri-layout-bottom-line',
|
||||
name: "Card",
|
||||
description:
|
||||
"A basic card component that can contain content and actions.",
|
||||
icon: "ri-layout-bottom-line",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/login",
|
||||
name: 'Login',
|
||||
description: 'A component that automatically generates a login screen for your app.',
|
||||
icon: 'ri-login-box-fill',
|
||||
name: "Login",
|
||||
description:
|
||||
"A component that automatically generates a login screen for your app.",
|
||||
icon: "ri-login-box-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
name: "Navigation Bar",
|
||||
_component: "@budibase/standard-components/Navigation",
|
||||
description: "A component for handling the navigation within your app.",
|
||||
description:
|
||||
"A component for handling the navigation within your app.",
|
||||
icon: "ri-navigation-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
}
|
||||
]
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Data',
|
||||
name: "Data",
|
||||
isCategory: true,
|
||||
children: [
|
||||
{
|
||||
name: 'Table',
|
||||
name: "Table",
|
||||
_component: "@budibase/materialdesign-components/Datatable",
|
||||
description: 'A component that generates a table from your data.',
|
||||
icon: 'ri-archive-drawer-fill',
|
||||
description: "A component that generates a table from your data.",
|
||||
icon: "ri-archive-drawer-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/materialdesign-components/Form",
|
||||
name: 'Form',
|
||||
description: 'A component that generates a form from your data.',
|
||||
icon: 'ri-file-edit-fill',
|
||||
name: "Form",
|
||||
description: "A component that generates a form from your data.",
|
||||
icon: "ri-file-edit-fill",
|
||||
commonProps: {},
|
||||
component: "@budibase/materialdesign-components/Form",
|
||||
template: {
|
||||
|
@ -165,25 +171,25 @@ export default {
|
|||
description: "Form for saving a record",
|
||||
name: "@budibase/materialdesign-components/recordForm",
|
||||
},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/datatable",
|
||||
name: 'DataTable',
|
||||
description: 'A table for displaying data from the backend.',
|
||||
icon: 'ri-archive-drawer-fill',
|
||||
name: "DataTable",
|
||||
description: "A table for displaying data from the backend.",
|
||||
icon: "ri-archive-drawer-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
_component: "@budibase/standard-components/dataform",
|
||||
name: 'DataForm',
|
||||
description: 'Form stuff',
|
||||
icon: 'ri-file-edit-fill',
|
||||
name: "DataForm",
|
||||
description: "Form stuff",
|
||||
icon: "ri-file-edit-fill",
|
||||
commonProps: {},
|
||||
children: []
|
||||
children: [],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<span
|
||||
class:active={false}
|
||||
class="topnavitemright"
|
||||
on:click={() => location = `/${application}`}>
|
||||
on:click={() => (location = `/${application}`)}>
|
||||
<PreviewIcon />
|
||||
</span>
|
||||
</div>
|
||||
|
@ -72,7 +72,7 @@
|
|||
{:then}
|
||||
<slot />
|
||||
{:catch error}
|
||||
<p>Something went wrong: {error.message}</p>
|
||||
<p>Something went wrong: {error.message}</p>
|
||||
{/await}
|
||||
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
open(
|
||||
CreateEditRecordModal,
|
||||
{
|
||||
onClosed: close
|
||||
onClosed: close,
|
||||
},
|
||||
{ styleContent: { padding: "0" } }
|
||||
)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
// Find Component with ID and continue
|
||||
function findComponent(ids, children) {
|
||||
console.log(ids, children);
|
||||
// Setup stuff
|
||||
let componentToSelect
|
||||
let currentChildren = children
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<script>
|
||||
import { goto } from "@sveltech/routify"
|
||||
$goto("../page-layout")
|
||||
</script>
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { store } from "builderStore";
|
||||
import { store } from "builderStore"
|
||||
import AppList from "components/start/AppList.svelte"
|
||||
import { onMount } from "svelte"
|
||||
import IconButton from "components/common/IconButton.svelte"
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
import { componentDependencies } from "../src/components/userInterface/pagesParsing/findDependencies"
|
||||
import { componentsAndScreens } from "./testData"
|
||||
import { some, find } from "lodash/fp"
|
||||
|
||||
describe("component dependencies", () => {
|
||||
const contains = (result, name) => some(c => c.name === name)(result)
|
||||
|
||||
const get = (all, name) => find(c => c.name === name)(all)
|
||||
|
||||
it("should include component that inheirts", () => {
|
||||
const { components, screens } = componentsAndScreens()
|
||||
|
||||
const result = componentDependencies(
|
||||
{},
|
||||
screens,
|
||||
components,
|
||||
get([...components, ...screens], "budibase-components/TextBox")
|
||||
)
|
||||
|
||||
expect(contains(result.dependantComponents, "common/SmallTextbox")).toBe(
|
||||
true
|
||||
)
|
||||
})
|
||||
|
||||
it("should include components in page apbody", () => {
|
||||
const { components, screens } = componentsAndScreens()
|
||||
const pages = {
|
||||
main: {
|
||||
appBody: "PrimaryButton",
|
||||
},
|
||||
}
|
||||
|
||||
const result = componentDependencies(
|
||||
pages,
|
||||
screens,
|
||||
components,
|
||||
get([...components, ...screens], "PrimaryButton")
|
||||
)
|
||||
|
||||
expect(result.dependantPages).toEqual(["main"])
|
||||
})
|
||||
})
|
|
@ -5,6 +5,7 @@ import { stripStandardProps } from "./testData"
|
|||
|
||||
describe("createDefaultProps", () => {
|
||||
const getcomponent = () => ({
|
||||
_component: "some_component",
|
||||
name: "some_component",
|
||||
props: {
|
||||
fieldName: { type: "string", default: "something" },
|
||||
|
@ -21,7 +22,7 @@ describe("createDefaultProps", () => {
|
|||
expect(keys(props).length).toBe(3)
|
||||
})
|
||||
|
||||
it("should set component name", () => {
|
||||
it("should set component _component", () => {
|
||||
const { props, errors } = createProps(getcomponent())
|
||||
|
||||
expect(errors).toEqual([])
|
||||
|
@ -37,17 +38,6 @@ describe("createDefaultProps", () => {
|
|||
expect(errors.length).toEqual(1)
|
||||
})
|
||||
|
||||
it("should create a object with single blank string value, when no default", () => {
|
||||
const comp = getcomponent()
|
||||
comp.props.fieldName = { type: "string" }
|
||||
|
||||
const { props, errors } = createProps(comp)
|
||||
|
||||
expect(errors).toEqual([])
|
||||
expect(props.fieldName).toBeDefined()
|
||||
expect(props.fieldName).toBe("")
|
||||
})
|
||||
|
||||
it("should create a object with single blank string value, when prop definition is 'string' ", () => {
|
||||
const comp = getcomponent()
|
||||
comp.props.fieldName = "string"
|
||||
|
@ -181,16 +171,6 @@ describe("createDefaultProps", () => {
|
|||
expect(some(e => e.propName === "fieldLength")(errors)).toBeTruthy()
|
||||
})
|
||||
|
||||
it("should return error default value is not of declared type", () => {
|
||||
const comp = getcomponent()
|
||||
comp.props.fieldName = { type: "string", default: 1 }
|
||||
|
||||
const { errors } = createProps(comp)
|
||||
|
||||
expect(errors.length).toBe(1)
|
||||
expect(some(e => e.propName === "fieldName")(errors)).toBeTruthy()
|
||||
})
|
||||
|
||||
it("should merge in derived props", () => {
|
||||
const comp = getcomponent()
|
||||
comp.props.fieldName = "string"
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
import { expandComponentDefinition } from "../src/components/userInterface/pagesParsing/types"
|
||||
|
||||
const componentDef = () => ({
|
||||
name: "comp",
|
||||
props: {
|
||||
label: "string",
|
||||
width: { type: "number" },
|
||||
color: { type: "string", required: true },
|
||||
},
|
||||
})
|
||||
|
||||
describe("expandPropDefintion", () => {
|
||||
it("should expand property defined as string, into default for that type", () => {
|
||||
const result = expandComponentDefinition(componentDef())
|
||||
|
||||
expect(result.props.label.type).toBe("string")
|
||||
expect(result.props.label.required).toBe(false)
|
||||
})
|
||||
|
||||
it("should add members to property defined as object, when members do not exist", () => {
|
||||
const result = expandComponentDefinition(componentDef())
|
||||
expect(result.props.width.required).toBe(false)
|
||||
})
|
||||
|
||||
it("should not override existing memebers", () => {
|
||||
const result = expandComponentDefinition(componentDef())
|
||||
expect(result.props.color.required).toBe(true)
|
||||
})
|
||||
|
||||
it("should set children=true when not included", () => {
|
||||
const result = expandComponentDefinition(componentDef())
|
||||
expect(result.children).toBe(true)
|
||||
})
|
||||
|
||||
it("should not change children when specified", () => {
|
||||
const c = componentDef()
|
||||
c.children = false
|
||||
const result = expandComponentDefinition(c)
|
||||
expect(result.children).toBe(false)
|
||||
|
||||
c.children = true
|
||||
const result2 = expandComponentDefinition(c)
|
||||
expect(result2.children).toBe(true)
|
||||
})
|
||||
})
|
|
@ -1,30 +0,0 @@
|
|||
import { getNewScreen } from "../src/components/userInterface/pagesParsing/createProps"
|
||||
import { componentsAndScreens, stripStandardProps } from "./testData"
|
||||
|
||||
describe("geNewScreen", () => {
|
||||
it("should return correct props for screen", () => {
|
||||
const { components } = componentsAndScreens()
|
||||
const result = getNewScreen(
|
||||
components,
|
||||
"budibase-components/TextBox",
|
||||
"newscreen"
|
||||
)
|
||||
|
||||
expect(result.props._code).toBeDefined()
|
||||
expect(result.props._id).toBeDefined()
|
||||
expect(result.props._styles).toBeDefined()
|
||||
stripStandardProps(result.props)
|
||||
|
||||
const expectedProps = {
|
||||
_component: "budibase-components/TextBox",
|
||||
size: "",
|
||||
isPassword: false,
|
||||
placeholder: "",
|
||||
label: "",
|
||||
}
|
||||
|
||||
expect(result.props).toEqual(expectedProps)
|
||||
expect(result.name).toBe("newscreen")
|
||||
expect(result.url).toBeDefined()
|
||||
})
|
||||
})
|
|
@ -26,7 +26,8 @@ module.exports = {
|
|||
})
|
||||
yargs.positional("couchDbUrl", {
|
||||
type: "string",
|
||||
describe: "connection string for couch db, format: https://username:password@localhost:5984",
|
||||
describe:
|
||||
"connection string for couch db, format: https://username:password@localhost:5984",
|
||||
alias: "x",
|
||||
default: "",
|
||||
})
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
const { xPlatHomeDir } = require("../../common")
|
||||
const dotenv = require("dotenv")
|
||||
const createInstance = require("@budibase/server/api/controllers/instance").create
|
||||
const createApplication = require("@budibase/server/api/controllers/application").create
|
||||
const createInstance = require("@budibase/server/api/controllers/instance")
|
||||
.create
|
||||
const createApplication = require("@budibase/server/api/controllers/application")
|
||||
.create
|
||||
const { copy, readJSON, writeJSON, remove, exists } = require("fs-extra")
|
||||
const { resolve, join } = require("path")
|
||||
const chalk = require("chalk")
|
||||
|
@ -13,7 +15,7 @@ module.exports = opts => {
|
|||
}
|
||||
|
||||
const run = async opts => {
|
||||
console.log(opts);
|
||||
console.log(opts)
|
||||
try {
|
||||
opts.dir = xPlatHomeDir(opts.dir)
|
||||
process.chdir(opts.dir)
|
||||
|
@ -22,7 +24,7 @@ const run = async opts => {
|
|||
await createEmptyAppPackage(opts)
|
||||
exec(`cd ${join(opts.dir, opts.applicationId)} && npm install`)
|
||||
} catch (error) {
|
||||
console.error(chalk.red("Error creating new app", error));
|
||||
console.error(chalk.red("Error creating new app", error))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,4 +17,5 @@ module.exports.serverFileName = relativePath =>
|
|||
// return await buildAppContext(config, masterIsCreated)
|
||||
// }
|
||||
|
||||
module.exports.xPlatHomeDir = dir => dir.startsWith("~") ? join(homedir(), dir.substring(1)) : dir;
|
||||
module.exports.xPlatHomeDir = dir =>
|
||||
dir.startsWith("~") ? join(homedir(), dir.substring(1)) : dir
|
||||
|
|
|
@ -5,6 +5,7 @@ import nodeglobals from "rollup-plugin-node-globals"
|
|||
|
||||
const lodash_fp_exports = [
|
||||
"find",
|
||||
"compose",
|
||||
"isUndefined",
|
||||
"split",
|
||||
"max",
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
export { $ } from "../../../core/src/common"
|
|
@ -1,12 +0,0 @@
|
|||
export const createCoreApp = (backendDefinition, user) => {
|
||||
const app = {
|
||||
datastore: null,
|
||||
crypto: null,
|
||||
publish: () => {},
|
||||
hierarchy: backendDefinition.hierarchy,
|
||||
actions: backendDefinition.actions,
|
||||
user,
|
||||
}
|
||||
|
||||
return app
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
import { createCoreApp } from "./createCoreApp"
|
||||
import { getNew, getNewChild } from "../../../core/src/recordApi/getNew"
|
||||
import { constructHierarchy } from "../../../core/src/templateApi/createNodes"
|
||||
|
||||
export const createCoreApi = (backendDefinition, user) => {
|
||||
const app = createCoreApp(backendDefinition, user)
|
||||
|
||||
return {
|
||||
recordApi: {
|
||||
getNew: getNew(app),
|
||||
getNewChild: getNewChild(app),
|
||||
},
|
||||
|
||||
templateApi: {
|
||||
constructHierarchy,
|
||||
},
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import { writable } from "svelte/store"
|
||||
import { createCoreApi } from "./core"
|
||||
import { attachChildren } from "./render/attachChildren"
|
||||
import { createTreeNode } from "./render/prepareRenderComponent"
|
||||
import { screenRouter } from "./render/screenRouter"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import { createApp } from "./createApp"
|
||||
import { trimSlash } from "./common/trimSlash"
|
||||
import { builtins, builtinLibName } from "./render/builtinComponents"
|
||||
// import * as standardComponents from "../../standard-components/dist";
|
||||
// import * as materialDesignComponents from "../../materialdesign-components/dist";
|
||||
|
||||
/**
|
||||
* create a web application from static budibase definition files.
|
||||
|
@ -10,37 +7,43 @@ import { builtins, builtinLibName } from "./render/builtinComponents"
|
|||
*/
|
||||
export const loadBudibase = async opts => {
|
||||
const _window = (opts && opts.window) || window
|
||||
const _localStorage = (opts && opts.localStorage) || localStorage
|
||||
// const _localStorage = (opts && opts.localStorage) || localStorage
|
||||
|
||||
const frontendDefinition = _window["##BUDIBASE_FRONTEND_DEFINITION##"]
|
||||
const uiFunctions = _window["##BUDIBASE_FRONTEND_FUNCTIONS##"]
|
||||
|
||||
const userFromStorage = _localStorage.getItem("budibase:user")
|
||||
// TODO: Update
|
||||
const user = {}
|
||||
|
||||
const user = userFromStorage
|
||||
? JSON.parse(userFromStorage)
|
||||
: {
|
||||
name: "annonymous",
|
||||
permissions: [],
|
||||
isUser: false,
|
||||
temp: false,
|
||||
}
|
||||
// const userFromStorage = _localStorage.getItem("budibase:user")
|
||||
|
||||
let { appRootPath } = frontendDefinition;
|
||||
appRootPath = appRootPath === "" ? "" : "/" + trimSlash(appRootPath)
|
||||
// const user = userFromStorage
|
||||
// ? JSON.parse(userFromStorage)
|
||||
// : {
|
||||
// name: "annonymous",
|
||||
// permissions: [],
|
||||
// isUser: false,
|
||||
// temp: false,
|
||||
// }
|
||||
|
||||
// let { appRootPath } = frontendDefinition;
|
||||
// appRootPath = appRootPath === "" ? "" : "/" + trimSlash(appRootPatl)
|
||||
|
||||
const componentLibraryModules = {}
|
||||
|
||||
const componentLibraryModules = {};
|
||||
const libraries = frontendDefinition.libraries || [
|
||||
"@budibase/standard-components",
|
||||
"@budibase/materialdesign-components",
|
||||
];
|
||||
]
|
||||
|
||||
for (let library of libraries) {
|
||||
// fetch the JavaScript for the component libraries from the server
|
||||
// fetch the JavaScript for the component libraries from the server
|
||||
componentLibraryModules[library] = await import(
|
||||
`/${frontendDefinition.appId}/componentlibrary?library=${encodeURI(library)}`
|
||||
);
|
||||
};
|
||||
`/${frontendDefinition.appId}/componentlibrary?library=${encodeURI(
|
||||
library
|
||||
)}`
|
||||
)
|
||||
}
|
||||
|
||||
componentLibraryModules[builtinLibName] = builtins(_window)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { split, last } from "lodash/fp"
|
||||
import { $ } from "../core/common"
|
||||
import { prepareRenderComponent } from "./prepareRenderComponent"
|
||||
import { isScreenSlot } from "./builtinComponents"
|
||||
import deepEqual from "deep-equal"
|
||||
|
@ -77,7 +76,9 @@ export const attachChildren = initialiseOpts => (htmlElement, options) => {
|
|||
}
|
||||
|
||||
const splitName = fullname => {
|
||||
const componentName = $(fullname, [split("/"), last])
|
||||
const getComponentName = compose(last, split("/"))
|
||||
|
||||
const componentName = getComponentName(fullname)
|
||||
|
||||
const libName = fullname.substring(
|
||||
0,
|
||||
|
|
|
@ -44,7 +44,7 @@ export const screenRouter = (screens, onScreenSelected, appRootPath) => {
|
|||
storeInitial["##routeParams"] = params
|
||||
const store = writable(storeInitial)
|
||||
|
||||
const screenIndex = current !== -1 ? current : fallback;
|
||||
const screenIndex = current !== -1 ? current : fallback
|
||||
|
||||
onScreenSelected(screens[screenIndex], store, _url)
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import { getState } from "./getState"
|
|||
import { isArray, isUndefined } from "lodash/fp"
|
||||
|
||||
import { createApi } from "../api"
|
||||
import { getNewChildRecordToState, getNewRecordToState } from "./coreHandlers"
|
||||
|
||||
export const EVENT_TYPE_MEMBER_NAME = "##eventHandlerType"
|
||||
|
||||
|
@ -16,8 +15,8 @@ export const eventHandlers = (store, rootPath, routeTo) => {
|
|||
const setStateWithStore = (path, value) => setState(store, path, value)
|
||||
|
||||
let currentState
|
||||
store.subscribe(s => {
|
||||
currentState = s
|
||||
store.subscribe(state => {
|
||||
currentState = state
|
||||
})
|
||||
|
||||
const api = createApi({
|
||||
|
@ -33,17 +32,6 @@ export const eventHandlers = (store, rootPath, routeTo) => {
|
|||
"Load Record": handler(["recordKey", "statePath"], api.loadRecord),
|
||||
"List Records": handler(["indexKey", "statePath"], api.listRecords),
|
||||
"Save Record": handler(["statePath"], api.saveRecord),
|
||||
|
||||
// "Get New Child Record": handler(
|
||||
// ["recordKey", "collectionName", "childRecordType", "statePath"],
|
||||
// getNewChildRecordToState(coreApi, setStateWithStore)
|
||||
// ),
|
||||
|
||||
// "Get New Record": handler(
|
||||
// ["collectionKey", "childRecordType", "statePath"],
|
||||
// getNewRecordToState(coreApi, setStateWithStore)
|
||||
// ),
|
||||
|
||||
"Navigate To": handler(["url"], param => routeTo(param && param.url)),
|
||||
|
||||
Authenticate: handler(["username", "password"], api.authenticate),
|
||||
|
|
|
@ -27,13 +27,7 @@ export const load = async (page, screens, url, appRootPath) => {
|
|||
return { dom, app }
|
||||
}
|
||||
|
||||
const addWindowGlobals = (
|
||||
window,
|
||||
page,
|
||||
screens,
|
||||
appRootPath,
|
||||
uiFunctions
|
||||
) => {
|
||||
const addWindowGlobals = (window, page, screens, appRootPath, uiFunctions) => {
|
||||
window["##BUDIBASE_FRONTEND_DEFINITION##"] = {
|
||||
page,
|
||||
screens,
|
||||
|
|
|
@ -4,4 +4,4 @@ export { default as BasicCard } from "./BasicCard.svelte"
|
|||
export { default as CardBody } from "./CardBody.svelte"
|
||||
export { default as CardFooter } from "./CardFooter.svelte"
|
||||
export { default as CardHeader } from "./CardHeader.svelte"
|
||||
export { default as CardImage } from "./CardImage.svelte"
|
||||
export { default as CardImage } from "./CardImage.svelte"
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
export default class ClassBuilder {
|
||||
constructor(block, defaultIgnoreList) {
|
||||
this.block = `mdc-${block}`
|
||||
this.defaultIgnoreList = defaultIgnoreList //will be ignored when building custom classes
|
||||
this.defaultIgnoreList = defaultIgnoreList //will be ignored when building custom classes
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
handles both blocks and elementss (BEM MD Notation)
|
||||
params = {elementName: string, props: {modifiers{}, customs:{}, extras: []}}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
import { writable } from "svelte/store"
|
||||
|
||||
function createItemsStore(componentOnSelect, initialState = []) {
|
||||
const { subscribe, set, update } = writable(initialState)
|
||||
|
||||
function addItem(item) {
|
||||
update(items => {
|
||||
return [...items, item]
|
||||
})
|
||||
if (componentOnSelect) {
|
||||
componentOnSelect()
|
||||
}
|
||||
const { subscribe, set, update } = writable(initialState)
|
||||
|
||||
function addItem(item) {
|
||||
update(items => {
|
||||
return [...items, item]
|
||||
})
|
||||
if (componentOnSelect) {
|
||||
componentOnSelect()
|
||||
}
|
||||
}
|
||||
|
||||
function addSingleItem(item) {
|
||||
set([item])
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
const isDate = /^\d{1,2}\/\d{1,2}\/\d{4}$/
|
||||
if (isDate.test(value)) {
|
||||
const [year, month, day] = value.split("/").reverse()
|
||||
if (month > 0 && month <= 12 && (day > 0 && day <= 31)) {
|
||||
if (month > 0 && month <= 12 && day > 0 && day <= 31) {
|
||||
date = new Date(year, month - 1, day)
|
||||
navDate = date
|
||||
openCalendar(true)
|
||||
|
|
|
@ -22,7 +22,14 @@ export { Menu } from "./Menu"
|
|||
export { Select } from "./Select"
|
||||
export { DatePicker } from "./DatePicker"
|
||||
export { IconButton } from "./IconButton"
|
||||
export { Card, CardHeader, CardImage, CardBody, CardFooter, BasicCard } from "./Card"
|
||||
export {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardImage,
|
||||
CardBody,
|
||||
CardFooter,
|
||||
BasicCard,
|
||||
} from "./Card"
|
||||
export { Dialog, DialogHeader, DialogContent, DialogActions } from "./Dialog"
|
||||
export { Switch } from "./Switch"
|
||||
export { Slider } from "./Slider"
|
||||
|
|
|
@ -1,40 +1,38 @@
|
|||
const CouchDB = require("../../db");
|
||||
const {
|
||||
getPackageForBuilder,
|
||||
} = require("../../utilities/builder")
|
||||
const CouchDB = require("../../db")
|
||||
const { getPackageForBuilder } = require("../../utilities/builder")
|
||||
|
||||
exports.fetch = async function(ctx) {
|
||||
const clientDb = new CouchDB(`client-${ctx.params.clientId}`);
|
||||
const body = await clientDb.query("client/by_type", {
|
||||
const clientDb = new CouchDB(`client-${ctx.params.clientId}`)
|
||||
const body = await clientDb.query("client/by_type", {
|
||||
include_docs: true,
|
||||
key: ["app"]
|
||||
});
|
||||
key: ["app"],
|
||||
})
|
||||
|
||||
ctx.body = body.rows.map(row => row.doc);
|
||||
};
|
||||
ctx.body = body.rows.map(row => row.doc)
|
||||
}
|
||||
|
||||
exports.fetchAppPackage = async function(ctx) {
|
||||
const clientDb = new CouchDB(`client-${ctx.params.clientId}`);
|
||||
const application = await clientDb.get(ctx.params.applicationId);
|
||||
ctx.body = await getPackageForBuilder(ctx.config, application);
|
||||
const clientDb = new CouchDB(`client-${ctx.params.clientId}`)
|
||||
const application = await clientDb.get(ctx.params.applicationId)
|
||||
ctx.body = await getPackageForBuilder(ctx.config, application)
|
||||
}
|
||||
|
||||
exports.create = async function(ctx) {
|
||||
const clientDb = new CouchDB(`client-${ctx.params.clientId}`);
|
||||
const clientDb = new CouchDB(`client-${ctx.params.clientId}`)
|
||||
const { id, rev } = await clientDb.post({
|
||||
type: "app",
|
||||
instances: [],
|
||||
userInstanceMap: {},
|
||||
componentLibraries: [
|
||||
"@budibase/standard-components",
|
||||
"@budibase/materialdesign-components"
|
||||
"@budibase/materialdesign-components",
|
||||
],
|
||||
...ctx.request.body,
|
||||
});
|
||||
})
|
||||
|
||||
ctx.body = {
|
||||
id,
|
||||
rev,
|
||||
message: `Application ${ctx.request.body.name} created successfully`
|
||||
message: `Application ${ctx.request.body.name} created successfully`,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,56 +1,57 @@
|
|||
const jwt = require("jsonwebtoken");
|
||||
const CouchDB = require("../../db");
|
||||
const bcrypt = require("../../utilities/bcrypt");
|
||||
const jwt = require("jsonwebtoken")
|
||||
const CouchDB = require("../../db")
|
||||
const bcrypt = require("../../utilities/bcrypt")
|
||||
|
||||
exports.authenticate = async ctx => {
|
||||
const { username, password } = ctx.request.body;
|
||||
const { username, password } = ctx.request.body
|
||||
|
||||
if (!username) ctx.throw(400, "Username Required.");
|
||||
if (!password) ctx.throw(400, "Password Required");
|
||||
if (!username) ctx.throw(400, "Username Required.")
|
||||
if (!password) ctx.throw(400, "Password Required")
|
||||
|
||||
// TODO: Don't use this. It can't be relied on
|
||||
const referer = ctx.request.headers.referer.split("/");
|
||||
const appId = referer[3];
|
||||
const referer = ctx.request.headers.referer.split("/")
|
||||
const appId = referer[3]
|
||||
|
||||
// find the instance that the user is associated with
|
||||
const db = new CouchDB(`client-${process.env.CLIENT_ID}`);
|
||||
const app = await db.get(appId);
|
||||
const instanceId = app.userInstanceMap[username];
|
||||
// find the instance that the user is associated with
|
||||
const db = new CouchDB(`client-${process.env.CLIENT_ID}`)
|
||||
const app = await db.get(appId)
|
||||
const instanceId = app.userInstanceMap[username]
|
||||
|
||||
if (!instanceId) ctx.throw(500, "User is not associated with an instance of app", appId)
|
||||
if (!instanceId)
|
||||
ctx.throw(500, "User is not associated with an instance of app", appId)
|
||||
|
||||
// Check the user exists in the instance DB by username
|
||||
const instanceDb = new CouchDB(instanceId);
|
||||
const { rows } = await instanceDb.query("database/by_username", {
|
||||
const instanceDb = new CouchDB(instanceId)
|
||||
const { rows } = await instanceDb.query("database/by_username", {
|
||||
include_docs: true,
|
||||
username
|
||||
});
|
||||
username,
|
||||
})
|
||||
|
||||
if (rows.length === 0) ctx.throw(500, `User does not exist.`);
|
||||
if (rows.length === 0) ctx.throw(500, `User does not exist.`)
|
||||
|
||||
const dbUser = rows[0].doc;
|
||||
const dbUser = rows[0].doc
|
||||
|
||||
// authenticate
|
||||
if (await bcrypt.compare(password, dbUser.password)) {
|
||||
const payload = {
|
||||
userId: dbUser._id,
|
||||
accessLevel: "",
|
||||
instanceId: instanceId
|
||||
};
|
||||
const payload = {
|
||||
userId: dbUser._id,
|
||||
accessLevel: "",
|
||||
instanceId: instanceId,
|
||||
}
|
||||
|
||||
const token = jwt.sign(payload, ctx.config.jwtSecret, {
|
||||
expiresIn: "1 day"
|
||||
});
|
||||
expiresIn: "1 day",
|
||||
})
|
||||
|
||||
const ONE_DAY_FROM_NOW = new Date(Date.now() + (24 * 3600))
|
||||
|
||||
ctx.cookies.set('budibase:token', token, { expires: ONE_DAY_FROM_NOW });
|
||||
const ONE_DAY_FROM_NOW = new Date(Date.now() + 24 * 3600)
|
||||
|
||||
ctx.cookies.set("budibase:token", token, { expires: ONE_DAY_FROM_NOW })
|
||||
|
||||
ctx.body = {
|
||||
token,
|
||||
...dbUser
|
||||
};
|
||||
...dbUser,
|
||||
}
|
||||
} else {
|
||||
ctx.throw(401, "Invalid credentials.");
|
||||
ctx.throw(401, "Invalid credentials.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
const CouchDB = require("../../db");
|
||||
const CouchDB = require("../../db")
|
||||
|
||||
exports.getClientId = async function(ctx) {
|
||||
ctx.body = process.env.CLIENT_ID;
|
||||
};
|
||||
ctx.body = process.env.CLIENT_ID
|
||||
}
|
||||
|
||||
exports.create = async function(ctx) {
|
||||
const clientId = `client-${ctx.request.body.clientId}`;
|
||||
const db = new CouchDB(clientId);
|
||||
const clientId = `client-${ctx.request.body.clientId}`
|
||||
const db = new CouchDB(clientId)
|
||||
|
||||
await db.put({
|
||||
_id: "_design/client",
|
||||
views: {
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id);
|
||||
}.toString()
|
||||
}
|
||||
}
|
||||
});
|
||||
views: {
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id)
|
||||
}.toString(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
ctx.body = {
|
||||
message: `Client Database ${clientId} successfully provisioned.`
|
||||
message: `Client Database ${clientId} successfully provisioned.`,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.destroy = async function(ctx) {
|
||||
const dbId = `client-${ctx.params.clientId}`;
|
||||
const dbId = `client-${ctx.params.clientId}`
|
||||
|
||||
await new CouchDB(dbId).destroy();
|
||||
await new CouchDB(dbId).destroy()
|
||||
|
||||
ctx.body = {
|
||||
status: 200,
|
||||
message: `Client Database ${dbId} successfully deleted.`
|
||||
message: `Client Database ${dbId} successfully deleted.`,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,40 +1,51 @@
|
|||
const CouchDB = require("../../db");
|
||||
const { homedir } = require("os");
|
||||
const { resolve, join } = require("path");
|
||||
const CouchDB = require("../../db")
|
||||
const { homedir } = require("os")
|
||||
const { resolve, join } = require("path")
|
||||
|
||||
const isDev = process.env.NODE_ENV !== "production";
|
||||
const isDev = process.env.NODE_ENV !== "production"
|
||||
|
||||
exports.fetchAppComponentDefinitions = async function(ctx) {
|
||||
const db = new CouchDB(`client-${ctx.params.clientId}`);
|
||||
const db = new CouchDB(`client-${ctx.params.clientId}`)
|
||||
const app = await db.get(ctx.params.appId)
|
||||
|
||||
const componentDefinitions = app.componentLibraries.reduce((acc, componentLibrary) => {
|
||||
const componentDefinitions = app.componentLibraries.reduce(
|
||||
(acc, componentLibrary) => {
|
||||
let appDirectory = resolve(
|
||||
homedir(),
|
||||
".budibase",
|
||||
ctx.params.appId,
|
||||
"node_modules"
|
||||
)
|
||||
|
||||
let appDirectory = resolve(homedir(), ".budibase", ctx.params.appId, "node_modules");
|
||||
if (isDev) {
|
||||
appDirectory = "/tmp/.budibase"
|
||||
}
|
||||
|
||||
if (isDev) {
|
||||
appDirectory = "/tmp/.budibase";
|
||||
}
|
||||
const componentJson = require(join(
|
||||
appDirectory,
|
||||
componentLibrary,
|
||||
"components.json"
|
||||
))
|
||||
|
||||
const componentJson = require(join(appDirectory, componentLibrary, "components.json"));
|
||||
const result = {}
|
||||
|
||||
const result = {};
|
||||
// map over the components.json and add the library identifier as a key
|
||||
// button -> @budibase/standard-components/button
|
||||
for (key in componentJson) {
|
||||
const fullComponentName = `${componentLibrary}/${key}`
|
||||
result[fullComponentName] = {
|
||||
_component: fullComponentName,
|
||||
...componentJson[key],
|
||||
}
|
||||
}
|
||||
|
||||
// map over the components.json and add the library identifier as a key
|
||||
// button -> @budibase/standard-components/button
|
||||
for (key in componentJson) {
|
||||
const fullComponentName = `${componentLibrary}/${key}`;
|
||||
result[fullComponentName] = {
|
||||
_component: fullComponentName,
|
||||
...componentJson[key]
|
||||
}
|
||||
}
|
||||
return {
|
||||
...acc,
|
||||
...result,
|
||||
}
|
||||
},
|
||||
{}
|
||||
)
|
||||
|
||||
return {
|
||||
...acc,
|
||||
...result
|
||||
};
|
||||
}, {});
|
||||
|
||||
ctx.body = componentDefinitions;
|
||||
};
|
||||
ctx.body = componentDefinitions
|
||||
}
|
||||
|
|
|
@ -1,61 +1,63 @@
|
|||
const CouchDB = require("../../db");
|
||||
const CouchDB = require("../../db")
|
||||
|
||||
exports.create = async function(ctx) {
|
||||
const instanceName = ctx.request.body.name;
|
||||
const instanceName = ctx.request.body.name
|
||||
|
||||
const { clientId, applicationId } = ctx.params;
|
||||
const db = new CouchDB(instanceName);
|
||||
const { clientId, applicationId } = ctx.params
|
||||
const db = new CouchDB(instanceName)
|
||||
await db.put({
|
||||
_id: "_design/database",
|
||||
metadata: {
|
||||
clientId,
|
||||
applicationId
|
||||
applicationId,
|
||||
},
|
||||
views: {
|
||||
by_username: {
|
||||
map: function(doc) {
|
||||
views: {
|
||||
by_username: {
|
||||
map: function(doc) {
|
||||
if (doc.type === "user") {
|
||||
emit([doc.username], doc._id);
|
||||
emit([doc.username], doc._id)
|
||||
}
|
||||
}.toString()
|
||||
}.toString(),
|
||||
},
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id);
|
||||
}.toString()
|
||||
}
|
||||
}
|
||||
});
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id)
|
||||
}.toString(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// Add the new instance under the app clientDB
|
||||
const clientDatabaseId = `client-${clientId}`
|
||||
const clientDb = new CouchDB(clientDatabaseId);
|
||||
const budibaseApp = await clientDb.get(applicationId);
|
||||
const instance = { id: instanceName, name: instanceName };
|
||||
budibaseApp.instances.push(instance);
|
||||
await clientDb.put(budibaseApp);
|
||||
const clientDb = new CouchDB(clientDatabaseId)
|
||||
const budibaseApp = await clientDb.get(applicationId)
|
||||
const instance = { id: instanceName, name: instanceName }
|
||||
budibaseApp.instances.push(instance)
|
||||
await clientDb.put(budibaseApp)
|
||||
|
||||
ctx.body = {
|
||||
message: `Instance Database ${instanceName} successfully provisioned.`,
|
||||
status: 200,
|
||||
instance
|
||||
instance,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.destroy = async function(ctx) {
|
||||
const db = new CouchDB(ctx.params.instanceId);
|
||||
const designDoc = await db.get("_design/database");
|
||||
await db.destroy();
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
const designDoc = await db.get("_design/database")
|
||||
await db.destroy()
|
||||
|
||||
// remove instance from client application document
|
||||
const { metadata } = designDoc;
|
||||
const clientDb = new CouchDB(metadata.clientId);
|
||||
const budibaseApp = await clientDb.get(metadata.applicationId);
|
||||
budibaseApp.instances = budibaseApp.instances.filter(instance => instance !== ctx.params.instanceId);
|
||||
const updatedApp = await clientDb.put(budibaseApp);
|
||||
const { metadata } = designDoc
|
||||
const clientDb = new CouchDB(metadata.clientId)
|
||||
const budibaseApp = await clientDb.get(metadata.applicationId)
|
||||
budibaseApp.instances = budibaseApp.instances.filter(
|
||||
instance => instance !== ctx.params.instanceId
|
||||
)
|
||||
const updatedApp = await clientDb.put(budibaseApp)
|
||||
|
||||
ctx.body = {
|
||||
message: `Instance Database ${ctx.params.instanceId} successfully destroyed.`,
|
||||
status: 200
|
||||
status: 200,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
const CouchDB = require("../../db");
|
||||
const CouchDB = require("../../db")
|
||||
|
||||
exports.fetch = async function(ctx) {
|
||||
const db = new CouchDB(ctx.params.instanceId);
|
||||
const body = await db.query("database/by_type", {
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
const body = await db.query("database/by_type", {
|
||||
include_docs: true,
|
||||
key: ["model"]
|
||||
});
|
||||
ctx.body = body.rows.map(row => row.doc);
|
||||
key: ["model"],
|
||||
})
|
||||
ctx.body = body.rows.map(row => row.doc)
|
||||
}
|
||||
|
||||
exports.create = async function(ctx) {
|
||||
const db = new CouchDB(ctx.params.instanceId);
|
||||
const newModel = await db.post({
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
const newModel = await db.post({
|
||||
type: "model",
|
||||
...ctx.request.body
|
||||
});
|
||||
...ctx.request.body,
|
||||
})
|
||||
|
||||
const designDoc = await db.get("_design/database");
|
||||
const designDoc = await db.get("_design/database")
|
||||
designDoc.views = {
|
||||
...designDoc.views,
|
||||
[`all_${newModel.id}`]: {
|
||||
|
@ -24,10 +24,10 @@ exports.create = async function(ctx) {
|
|||
if (doc.modelId === "${newModel.id}") {
|
||||
emit(doc[doc.key], doc._id);
|
||||
}
|
||||
}`
|
||||
}
|
||||
};
|
||||
await db.put(designDoc);
|
||||
}`,
|
||||
},
|
||||
}
|
||||
await db.put(designDoc)
|
||||
|
||||
ctx.body = {
|
||||
message: `Model ${ctx.request.body.name} created successfully.`,
|
||||
|
@ -35,33 +35,32 @@ exports.create = async function(ctx) {
|
|||
model: {
|
||||
_id: newModel.id,
|
||||
_rev: newModel.rev,
|
||||
...ctx.request.body
|
||||
}
|
||||
...ctx.request.body,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
exports.update = async function(ctx) {
|
||||
}
|
||||
exports.update = async function(ctx) {}
|
||||
|
||||
exports.destroy = async function(ctx) {
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
|
||||
const model = await db.remove(ctx.params.modelId, ctx.params.revId);
|
||||
const model = await db.remove(ctx.params.modelId, ctx.params.revId)
|
||||
const modelViewId = `all_${model.id}`
|
||||
|
||||
// Delete all records for that model
|
||||
const records = await db.query(`database/${modelViewId}`);
|
||||
const records = await db.query(`database/${modelViewId}`)
|
||||
await db.bulkDocs(
|
||||
records.rows.map(record => ({ id: record.id, _deleted: true }))
|
||||
);
|
||||
)
|
||||
|
||||
// delete the "all" view
|
||||
const designDoc = await db.get("_design/database");
|
||||
delete designDoc.views[modelViewId];
|
||||
await db.put(designDoc);
|
||||
const designDoc = await db.get("_design/database")
|
||||
delete designDoc.views[modelViewId]
|
||||
await db.put(designDoc)
|
||||
|
||||
ctx.body = {
|
||||
message: `Model ${model.id} deleted.`,
|
||||
status: 200
|
||||
status: 200,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
const CouchDB = require("../../db");
|
||||
const Ajv = require("ajv");
|
||||
const CouchDB = require("../../db")
|
||||
const Ajv = require("ajv")
|
||||
|
||||
const ajv = new Ajv();
|
||||
const ajv = new Ajv()
|
||||
|
||||
exports.save = async function(ctx) {
|
||||
const db = new CouchDB(ctx.params.instanceId);
|
||||
const record = ctx.request.body;
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
const record = ctx.request.body
|
||||
|
||||
// validation with ajv
|
||||
const model = await db.get(record.modelId)
|
||||
const validate = ajv.compile({
|
||||
properties: model.schema
|
||||
});
|
||||
properties: model.schema,
|
||||
})
|
||||
const valid = validate(record)
|
||||
|
||||
if (!valid) {
|
||||
ctx.status = 400
|
||||
ctx.body = {
|
||||
status: 400,
|
||||
errors: validate.errors
|
||||
};
|
||||
return;
|
||||
errors: validate.errors,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const existingRecord = record._id && await db.get(record._id);
|
||||
const existingRecord = record._id && (await db.get(record._id))
|
||||
|
||||
if (existingRecord) {
|
||||
const response = await db.put({ ...record, _id: existingRecord._id });
|
||||
const response = await db.put({ ...record, _id: existingRecord._id })
|
||||
ctx.body = {
|
||||
message: `${model.name} updated successfully.`,
|
||||
status: 200,
|
||||
record: {
|
||||
...record,
|
||||
...response
|
||||
}
|
||||
...response,
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -52,13 +52,10 @@ exports.save = async function(ctx) {
|
|||
|
||||
exports.fetch = async function(ctx) {
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
const response = await db.query(
|
||||
`database/${ctx.params.viewName}`,
|
||||
{
|
||||
include_docs: true
|
||||
}
|
||||
)
|
||||
ctx.body = response.rows.map(row => row.doc);
|
||||
const response = await db.query(`database/${ctx.params.viewName}`, {
|
||||
include_docs: true,
|
||||
})
|
||||
ctx.body = response.rows.map(row => row.doc)
|
||||
}
|
||||
|
||||
exports.find = async function(ctx) {
|
||||
|
@ -67,7 +64,7 @@ exports.find = async function(ctx) {
|
|||
}
|
||||
|
||||
exports.destroy = async function(ctx) {
|
||||
const databaseId = ctx.params.instanceId;
|
||||
const databaseId = ctx.params.instanceId
|
||||
const db = new CouchDB(databaseId)
|
||||
ctx.body = await db.remove(ctx.params.recordId, ctx.params.revId);
|
||||
};
|
||||
ctx.body = await db.remove(ctx.params.recordId, ctx.params.revId)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const send = require("koa-send");
|
||||
const send = require("koa-send")
|
||||
const { resolve, join } = require("path")
|
||||
const { homedir } = require("os");
|
||||
const { homedir } = require("os")
|
||||
|
||||
exports.serveBuilder = async function(ctx) {
|
||||
let builderPath = resolve(process.cwd(), "builder")
|
||||
|
@ -12,12 +12,12 @@ exports.serveApp = async function(ctx) {
|
|||
// TODO: update homedir stuff to wherever budi is run
|
||||
// default to homedir
|
||||
const appPath = resolve(
|
||||
homedir(),
|
||||
".budibase",
|
||||
homedir(),
|
||||
".budibase",
|
||||
ctx.params.appId,
|
||||
"public",
|
||||
ctx.isAuthenticated ? "main" : "unauthenticated"
|
||||
);
|
||||
)
|
||||
|
||||
await send(ctx, ctx.file, { root: ctx.devPath || appPath })
|
||||
}
|
||||
|
@ -26,21 +26,21 @@ exports.serveComponentLibrary = async function(ctx) {
|
|||
// TODO: update homedir stuff to wherever budi is run
|
||||
// default to homedir
|
||||
let componentLibraryPath = resolve(
|
||||
homedir(),
|
||||
".budibase",
|
||||
ctx.params.appId,
|
||||
"node_modules",
|
||||
homedir(),
|
||||
".budibase",
|
||||
ctx.params.appId,
|
||||
"node_modules",
|
||||
decodeURI(ctx.query.library),
|
||||
"dist"
|
||||
);
|
||||
)
|
||||
|
||||
if (ctx.isDev) {
|
||||
componentLibraryPath = join(
|
||||
"/tmp",
|
||||
"/tmp",
|
||||
".budibase",
|
||||
decodeURI(ctx.query.library),
|
||||
"dist"
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
await send(ctx, "/index.js", { root: componentLibraryPath })
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
const CouchDB = require("../../db");
|
||||
const bcrypt = require("../../utilities/bcrypt");
|
||||
const CouchDB = require("../../db")
|
||||
const bcrypt = require("../../utilities/bcrypt")
|
||||
|
||||
exports.fetch = async function(ctx) {
|
||||
const database = new CouchDB(ctx.params.instanceId);
|
||||
const data = await database.query("database/by_type", {
|
||||
const database = new CouchDB(ctx.params.instanceId)
|
||||
const data = await database.query("database/by_type", {
|
||||
include_docs: true,
|
||||
key: ["user"]
|
||||
});
|
||||
key: ["user"],
|
||||
})
|
||||
|
||||
ctx.body = data.rows.map(row => row.doc);
|
||||
};
|
||||
ctx.body = data.rows.map(row => row.doc)
|
||||
}
|
||||
|
||||
exports.create = async function(ctx) {
|
||||
const database = new CouchDB(ctx.params.instanceId);
|
||||
const { username, password, name } = ctx.request.body;
|
||||
const database = new CouchDB(ctx.params.instanceId)
|
||||
const { username, password, name } = ctx.request.body
|
||||
|
||||
if (!username || !password) ctx.throw(400, "Username and Password Required.");
|
||||
if (!username || !password) ctx.throw(400, "Username and Password Required.")
|
||||
|
||||
const response = await database.post({
|
||||
const response = await database.post({
|
||||
username,
|
||||
password: await bcrypt.hash(password),
|
||||
name,
|
||||
type: "user"
|
||||
});
|
||||
name,
|
||||
type: "user",
|
||||
})
|
||||
|
||||
// the clientDB needs to store a map of users against the app
|
||||
const clientDb = new CouchDB(`client-${process.env.CLIENT_ID}`);
|
||||
const app = await clientDb.get(ctx.params.appId);
|
||||
const clientDb = new CouchDB(`client-${process.env.CLIENT_ID}`)
|
||||
const app = await clientDb.get(ctx.params.appId)
|
||||
|
||||
app.userInstanceMap = {
|
||||
...app.userInstanceMap,
|
||||
[username]: ctx.params.instanceId
|
||||
[username]: ctx.params.instanceId,
|
||||
}
|
||||
await clientDb.put(app);
|
||||
await clientDb.put(app)
|
||||
|
||||
ctx.body = {
|
||||
user: {
|
||||
id: response.id,
|
||||
rev: response.rev,
|
||||
username,
|
||||
name
|
||||
name,
|
||||
},
|
||||
message: `User created successfully.`,
|
||||
status: 200
|
||||
status: 200,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.destroy = async function(ctx) {
|
||||
const database = new CouchDB(ctx.params.instanceId);
|
||||
const database = new CouchDB(ctx.params.instanceId)
|
||||
const response = await database.destroy(ctx.params.userId)
|
||||
ctx.body = {
|
||||
...response,
|
||||
message: `User deleted.`,
|
||||
status: 200
|
||||
status: 200,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
const CouchDB = require("../../db");
|
||||
const CouchDB = require("../../db")
|
||||
|
||||
const controller = {
|
||||
query: async ctx => {
|
||||
|
||||
},
|
||||
query: async ctx => {},
|
||||
fetch: async ctx => {
|
||||
const db = new CouchDB(ctx.params.instanceId);
|
||||
const designDoc = await db.get("_design/database");
|
||||
const response = [];
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
const designDoc = await db.get("_design/database")
|
||||
const response = []
|
||||
|
||||
for (let name in designDoc.views) {
|
||||
if (!name.startsWith("all") && name !== "by_type" && name !== "by_username") {
|
||||
if (
|
||||
!name.startsWith("all") &&
|
||||
name !== "by_type" &&
|
||||
name !== "by_username"
|
||||
) {
|
||||
response.push({
|
||||
name,
|
||||
...designDoc.views[name]
|
||||
...designDoc.views[name],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -21,29 +23,29 @@ const controller = {
|
|||
ctx.body = response
|
||||
},
|
||||
create: async ctx => {
|
||||
const db = new CouchDB(ctx.params.instanceId);
|
||||
const { name, ...viewDefinition } = ctx.request.body;
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
const { name, ...viewDefinition } = ctx.request.body
|
||||
|
||||
const designDoc = await db.get("_design/database");
|
||||
const designDoc = await db.get("_design/database")
|
||||
designDoc.views = {
|
||||
...designDoc.views,
|
||||
[name]: viewDefinition
|
||||
};
|
||||
const newView = await db.put(designDoc);
|
||||
[name]: viewDefinition,
|
||||
}
|
||||
const newView = await db.put(designDoc)
|
||||
|
||||
ctx.body = {
|
||||
view: {
|
||||
...ctx.request.body,
|
||||
...newView
|
||||
...newView,
|
||||
},
|
||||
message: `View ${name} created successfully.`,
|
||||
status: 200,
|
||||
}
|
||||
},
|
||||
destroy: async ctx => {
|
||||
const db = new CouchDB(ctx.params.instanceId);
|
||||
const db = new CouchDB(ctx.params.instanceId)
|
||||
ctx.body = await db.destroy(ctx.params.userId)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = controller;
|
||||
module.exports = controller
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const authenticated = require("../middleware/authenticated");
|
||||
const compress = require("koa-compress");
|
||||
const zlib = require("zlib");
|
||||
const authenticated = require("../middleware/authenticated")
|
||||
const compress = require("koa-compress")
|
||||
const zlib = require("zlib")
|
||||
const { resolve } = require("path")
|
||||
const { homedir } = require("os")
|
||||
const {
|
||||
|
@ -15,83 +15,85 @@ const {
|
|||
modelRoutes,
|
||||
viewRoutes,
|
||||
staticRoutes,
|
||||
componentRoutes
|
||||
} = require("./routes");
|
||||
componentRoutes,
|
||||
} = require("./routes")
|
||||
|
||||
module.exports = app => {
|
||||
const router = new Router()
|
||||
|
||||
router
|
||||
.use(compress({
|
||||
threshold: 2048,
|
||||
gzip: {
|
||||
flush: zlib.Z_SYNC_FLUSH
|
||||
},
|
||||
deflate: {
|
||||
flush: zlib.Z_SYNC_FLUSH,
|
||||
}
|
||||
}))
|
||||
.use(async (ctx, next) => {
|
||||
.use(
|
||||
compress({
|
||||
threshold: 2048,
|
||||
gzip: {
|
||||
flush: zlib.Z_SYNC_FLUSH,
|
||||
},
|
||||
deflate: {
|
||||
flush: zlib.Z_SYNC_FLUSH,
|
||||
},
|
||||
})
|
||||
)
|
||||
.use(async (ctx, next) => {
|
||||
// TODO: temp dev middleware
|
||||
ctx.config = {
|
||||
ctx.config = {
|
||||
latestPackagesFolder: resolve(homedir(), ".budibase"),
|
||||
jwtSecret: "foo"
|
||||
jwtSecret: "foo",
|
||||
}
|
||||
ctx.isDev = process.env.NODE_ENV !== "production";
|
||||
await next();
|
||||
ctx.isDev = process.env.NODE_ENV !== "production"
|
||||
await next()
|
||||
})
|
||||
.use(authenticated);
|
||||
|
||||
.use(authenticated)
|
||||
|
||||
// error handling middleware
|
||||
router.use(async (ctx, next) => {
|
||||
try {
|
||||
await next();
|
||||
await next()
|
||||
} catch (err) {
|
||||
console.trace(err);
|
||||
ctx.status = err.status || err.statusCode || 500;
|
||||
console.trace(err)
|
||||
ctx.status = err.status || err.statusCode || 500
|
||||
ctx.body = {
|
||||
message: err.message,
|
||||
status: ctx.status
|
||||
};
|
||||
status: ctx.status,
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
router.use(authRoutes.routes());
|
||||
router.use(authRoutes.allowedMethods());
|
||||
router.use(authRoutes.routes())
|
||||
router.use(authRoutes.allowedMethods())
|
||||
|
||||
// authenticated routes
|
||||
router.use(viewRoutes.routes());
|
||||
router.use(viewRoutes.allowedMethods());
|
||||
router.use(viewRoutes.routes())
|
||||
router.use(viewRoutes.allowedMethods())
|
||||
|
||||
router.use(modelRoutes.routes());
|
||||
router.use(modelRoutes.allowedMethods());
|
||||
router.use(modelRoutes.routes())
|
||||
router.use(modelRoutes.allowedMethods())
|
||||
|
||||
router.use(userRoutes.routes());
|
||||
router.use(userRoutes.allowedMethods());
|
||||
router.use(userRoutes.routes())
|
||||
router.use(userRoutes.allowedMethods())
|
||||
|
||||
router.use(recordRoutes.routes());
|
||||
router.use(recordRoutes.allowedMethods());
|
||||
router.use(recordRoutes.routes())
|
||||
router.use(recordRoutes.allowedMethods())
|
||||
|
||||
router.use(instanceRoutes.routes());
|
||||
router.use(instanceRoutes.allowedMethods());
|
||||
router.use(instanceRoutes.routes())
|
||||
router.use(instanceRoutes.allowedMethods())
|
||||
// end auth routes
|
||||
|
||||
router.use(pageRoutes.routes());
|
||||
router.use(pageRoutes.allowedMethods());
|
||||
router.use(pageRoutes.routes())
|
||||
router.use(pageRoutes.allowedMethods())
|
||||
|
||||
router.use(applicationRoutes.routes());
|
||||
router.use(applicationRoutes.allowedMethods());
|
||||
router.use(applicationRoutes.routes())
|
||||
router.use(applicationRoutes.allowedMethods())
|
||||
|
||||
router.use(componentRoutes.routes());
|
||||
router.use(componentRoutes.allowedMethods());
|
||||
router.use(componentRoutes.routes())
|
||||
router.use(componentRoutes.allowedMethods())
|
||||
|
||||
router.use(clientRoutes.routes());
|
||||
router.use(clientRoutes.allowedMethods());
|
||||
router.use(clientRoutes.routes())
|
||||
router.use(clientRoutes.allowedMethods())
|
||||
|
||||
router.use(staticRoutes.routes());
|
||||
router.use(staticRoutes.allowedMethods());
|
||||
router.use(staticRoutes.routes())
|
||||
router.use(staticRoutes.allowedMethods())
|
||||
|
||||
router.redirect("/", "/_builder");
|
||||
router.redirect("/", "/_builder")
|
||||
|
||||
return router
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/application");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/application")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.get("/api/:clientId/applications", controller.fetch)
|
||||
.get("/api/:clientId/:applicationId/appPackage", controller.fetchAppPackage)
|
||||
.post("/api/:clientId/applications", controller.create);
|
||||
.post("/api/:clientId/applications", controller.create)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/auth");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/auth")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.post("/api/authenticate", controller.authenticate);
|
||||
router.post("/api/authenticate", controller.authenticate)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/client");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/client")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.get("/api/client/id", controller.getClientId)
|
||||
.post("/api/clients", controller.create)
|
||||
.delete("/api/clients/:clientId", controller.destroy);
|
||||
.delete("/api/clients/:clientId", controller.destroy)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/component");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/component")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.get("/:clientId/:appId/components/definitions", controller.fetchAppComponentDefinitions);
|
||||
router.get(
|
||||
"/:clientId/:appId/components/definitions",
|
||||
controller.fetchAppComponentDefinitions
|
||||
)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
const authRoutes = require("./auth");
|
||||
const pageRoutes = require("./pages");
|
||||
const userRoutes = require("./user");
|
||||
const recordRoutes = require("./record");
|
||||
const instanceRoutes = require("./instance");
|
||||
const clientRoutes = require("./client");
|
||||
const applicationRoutes = require("./application");
|
||||
const modelRoutes = require("./model");
|
||||
const viewRoutes = require("./view");
|
||||
const staticRoutes = require("./static");
|
||||
const componentRoutes = require("./component");
|
||||
const authRoutes = require("./auth")
|
||||
const pageRoutes = require("./pages")
|
||||
const userRoutes = require("./user")
|
||||
const recordRoutes = require("./record")
|
||||
const instanceRoutes = require("./instance")
|
||||
const clientRoutes = require("./client")
|
||||
const applicationRoutes = require("./application")
|
||||
const modelRoutes = require("./model")
|
||||
const viewRoutes = require("./view")
|
||||
const staticRoutes = require("./static")
|
||||
const componentRoutes = require("./component")
|
||||
|
||||
module.exports = {
|
||||
authRoutes,
|
||||
|
@ -21,5 +21,5 @@ module.exports = {
|
|||
modelRoutes,
|
||||
viewRoutes,
|
||||
staticRoutes,
|
||||
componentRoutes
|
||||
};
|
||||
componentRoutes,
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/instance");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/instance")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.post("/api/:clientId/:applicationId/instances", controller.create)
|
||||
.delete("/api/instances/:instanceId", controller.destroy);
|
||||
.delete("/api/instances/:instanceId", controller.destroy)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/model");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/model")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.get("/api/:instanceId/models", controller.fetch)
|
||||
.post("/api/:instanceId/models", controller.create)
|
||||
// .patch("/api/:instanceId/models", controller.update)
|
||||
.delete("/api/:instanceId/models/:modelId/:revId", controller.destroy);
|
||||
.delete("/api/:instanceId/models/:modelId/:revId", controller.destroy)
|
||||
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
const Router = require("@koa/router");
|
||||
const Router = require("@koa/router")
|
||||
const StatusCodes = require("../../utilities/statusCodes")
|
||||
const {
|
||||
listScreens,
|
||||
saveScreen,
|
||||
buildPage,
|
||||
renameScreen,
|
||||
deleteScreen
|
||||
deleteScreen,
|
||||
} = require("../../utilities/builder")
|
||||
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.post("/_builder/api/:appId/pages/:pageName", async ctx => {
|
||||
|
@ -30,44 +29,41 @@ router.get("/_builder/api/:appId/pages/:pagename/screens", async ctx => {
|
|||
ctx.response.status = StatusCodes.OK
|
||||
})
|
||||
|
||||
router
|
||||
.post("/_builder/api/:appId/pages/:pagename/screen", async ctx => {
|
||||
ctx.body = await saveScreen(
|
||||
ctx.config,
|
||||
ctx.params.appId,
|
||||
ctx.params.pagename,
|
||||
ctx.request.body
|
||||
)
|
||||
ctx.response.status = StatusCodes.OK
|
||||
})
|
||||
|
||||
router
|
||||
.patch("/_builder/api/:appname/pages/:pagename/screen", async ctx => {
|
||||
await renameScreen(
|
||||
ctx.config,
|
||||
ctx.params.appname,
|
||||
ctx.params.pagename,
|
||||
ctx.request.body.oldname,
|
||||
ctx.request.body.newname
|
||||
)
|
||||
ctx.response.status = StatusCodes.OK
|
||||
})
|
||||
|
||||
router
|
||||
.delete("/_builder/api/:appname/pages/:pagename/screen/*", async ctx => {
|
||||
const name = ctx.request.path.replace(
|
||||
`/_builder/api/${ctx.params.appname}/pages/${ctx.params.pagename}/screen/`,
|
||||
""
|
||||
)
|
||||
|
||||
await deleteScreen(
|
||||
ctx.config,
|
||||
ctx.params.appname,
|
||||
ctx.params.pagename,
|
||||
decodeURI(name)
|
||||
)
|
||||
|
||||
ctx.response.status = StatusCodes.OK
|
||||
router.post("/_builder/api/:appId/pages/:pagename/screen", async ctx => {
|
||||
ctx.body = await saveScreen(
|
||||
ctx.config,
|
||||
ctx.params.appId,
|
||||
ctx.params.pagename,
|
||||
ctx.request.body
|
||||
)
|
||||
ctx.response.status = StatusCodes.OK
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
router.patch("/_builder/api/:appname/pages/:pagename/screen", async ctx => {
|
||||
await renameScreen(
|
||||
ctx.config,
|
||||
ctx.params.appname,
|
||||
ctx.params.pagename,
|
||||
ctx.request.body.oldname,
|
||||
ctx.request.body.newname
|
||||
)
|
||||
ctx.response.status = StatusCodes.OK
|
||||
})
|
||||
|
||||
router.delete("/_builder/api/:appname/pages/:pagename/screen/*", async ctx => {
|
||||
const name = ctx.request.path.replace(
|
||||
`/_builder/api/${ctx.params.appname}/pages/${ctx.params.pagename}/screen/`,
|
||||
""
|
||||
)
|
||||
|
||||
await deleteScreen(
|
||||
ctx.config,
|
||||
ctx.params.appname,
|
||||
ctx.params.pagename,
|
||||
decodeURI(name)
|
||||
)
|
||||
|
||||
ctx.response.status = StatusCodes.OK
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/screen");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/screen")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.get("/api/:instanceId/screens", controller.fetch)
|
||||
.post("/api/:instanceId/screens", controller.save)
|
||||
.delete("/api/:instanceId/:screenId/:revId", controller.destroy);
|
||||
.delete("/api/:instanceId/:screenId/:revId", controller.destroy)
|
||||
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/static");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/static")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.param("file", async (file, ctx, next) => {
|
||||
ctx.file = file && file.includes(".") ? file : "index.html";
|
||||
ctx.file = file && file.includes(".") ? file : "index.html"
|
||||
|
||||
// Serving the client library from your local dir in dev
|
||||
if (ctx.isDev && ctx.file.startsWith("budibase-client")) {
|
||||
ctx.devPath = "/tmp/.budibase";
|
||||
ctx.devPath = "/tmp/.budibase"
|
||||
}
|
||||
|
||||
await next();
|
||||
await next()
|
||||
})
|
||||
.get("/_builder/:file*", controller.serveBuilder)
|
||||
.get("/:appId/componentlibrary", controller.serveComponentLibrary)
|
||||
.get("/:appId/:file*", controller.serveApp);
|
||||
.get("/:appId/:file*", controller.serveApp)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
const CouchDB = require("../../../db");
|
||||
const CLIENT_DB_ID = "client-testing";
|
||||
const TEST_APP_ID = "test-app";
|
||||
const CouchDB = require("../../../db")
|
||||
const CLIENT_DB_ID = "client-testing"
|
||||
const TEST_APP_ID = "test-app"
|
||||
|
||||
exports.createModel = async (instanceId, model) => {
|
||||
model = model || {
|
||||
"name": "TestModel",
|
||||
"type": "model",
|
||||
"key": "name",
|
||||
"schema": {
|
||||
"name": { "type": "string" }
|
||||
}
|
||||
name: "TestModel",
|
||||
type: "model",
|
||||
key: "name",
|
||||
schema: {
|
||||
name: { type: "string" },
|
||||
},
|
||||
}
|
||||
const db = new CouchDB(instanceId);
|
||||
const response = await db.post(model);
|
||||
const db = new CouchDB(instanceId)
|
||||
const response = await db.post(model)
|
||||
|
||||
const designDoc = await db.get("_design/database");
|
||||
const designDoc = await db.get("_design/database")
|
||||
designDoc.views = {
|
||||
...designDoc.views,
|
||||
[`all_${response.id}`]: {
|
||||
|
@ -22,66 +22,66 @@ exports.createModel = async (instanceId, model) => {
|
|||
if (doc.modelId === "${response.id}") {
|
||||
emit(doc[doc.key], doc._id);
|
||||
}
|
||||
}`
|
||||
}
|
||||
};
|
||||
await db.put(designDoc);
|
||||
}`,
|
||||
},
|
||||
}
|
||||
await db.put(designDoc)
|
||||
|
||||
return {
|
||||
...response,
|
||||
...model
|
||||
};
|
||||
}
|
||||
...model,
|
||||
}
|
||||
}
|
||||
|
||||
exports.createClientDatabase = async () => {
|
||||
const db = new CouchDB(CLIENT_DB_ID);
|
||||
const db = new CouchDB(CLIENT_DB_ID)
|
||||
|
||||
await db.put({
|
||||
_id: "_design/client",
|
||||
views: {
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id);
|
||||
}
|
||||
}.toString()
|
||||
}
|
||||
});
|
||||
views: {
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id)
|
||||
},
|
||||
}.toString(),
|
||||
},
|
||||
})
|
||||
|
||||
await db.put({
|
||||
_id: TEST_APP_ID,
|
||||
type: "app",
|
||||
instances: []
|
||||
});
|
||||
instances: [],
|
||||
})
|
||||
|
||||
return db;
|
||||
return db
|
||||
}
|
||||
|
||||
exports.destroyClientDatabase = async () => new CouchDB(CLIENT_DB_ID).destroy();
|
||||
exports.destroyClientDatabase = async () => new CouchDB(CLIENT_DB_ID).destroy()
|
||||
|
||||
exports.createInstanceDatabase = async instanceId => {
|
||||
const db = new CouchDB(instanceId);
|
||||
const db = new CouchDB(instanceId)
|
||||
|
||||
await db.put({
|
||||
_id: "_design/database",
|
||||
metadata: {
|
||||
clientId: CLIENT_DB_ID,
|
||||
applicationId: TEST_APP_ID
|
||||
applicationId: TEST_APP_ID,
|
||||
},
|
||||
views: {
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id);
|
||||
}.toString()
|
||||
}
|
||||
}
|
||||
});
|
||||
views: {
|
||||
by_type: {
|
||||
map: function(doc) {
|
||||
emit([doc.type], doc._id)
|
||||
}.toString(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return db;
|
||||
return db
|
||||
}
|
||||
|
||||
exports.insertDocument = async (databaseId, document) => {
|
||||
const { id, ...documentFields } = document;
|
||||
await new CouchDB(databaseId).put({ _id: id, ...documentFields });
|
||||
const { id, ...documentFields } = document
|
||||
await new CouchDB(databaseId).put({ _id: id, ...documentFields })
|
||||
}
|
||||
|
||||
exports.createSchema = async (request, instanceId, schema) => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/user");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/user")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.get("/api/:instanceId/users", controller.fetch)
|
||||
.post("/api/:appId/:instanceId/users", controller.create)
|
||||
.delete("/api/:instanceId/users/:userId", controller.destroy);
|
||||
.delete("/api/:instanceId/users/:userId", controller.destroy)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const Router = require("@koa/router");
|
||||
const controller = require("../controllers/view");
|
||||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/view")
|
||||
|
||||
const router = Router();
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.get("/api/:instanceId/views", controller.fetch)
|
||||
// .patch("/api/:databaseId/views", controller.update);
|
||||
// .delete("/api/:instanceId/views/:viewId/:revId", controller.destroy);
|
||||
.post("/api/:instanceId/views", controller.create);
|
||||
.post("/api/:instanceId/views", controller.create)
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const Koa = require("koa")
|
||||
const logger = require("koa-logger");
|
||||
const logger = require("koa-logger")
|
||||
const router = require("./api")
|
||||
const koaBody = require("koa-body")
|
||||
const app = new Koa()
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
const PouchDB = require("pouchdb")
|
||||
const allDbs = require("pouchdb-all-dbs")
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const os = require("os")
|
||||
const path = require("path")
|
||||
|
||||
const BUDIBASE_DIR = path.join(os.homedir(), ".budibase");
|
||||
const BUDIBASE_DIR = path.join(os.homedir(), ".budibase")
|
||||
|
||||
const COUCH_DB_URL = process.env.COUCH_DB_URL || `leveldb://${BUDIBASE_DIR}/`;
|
||||
const DATABASE_TYPE = process.env.DATABASE_TYPE || "couch";
|
||||
const COUCH_DB_URL = process.env.COUCH_DB_URL || `leveldb://${BUDIBASE_DIR}/`
|
||||
const DATABASE_TYPE = process.env.DATABASE_TYPE || "couch"
|
||||
|
||||
const Pouch = PouchDB.defaults({
|
||||
prefix: COUCH_DB_URL,
|
||||
});
|
||||
})
|
||||
|
||||
allDbs(Pouch);
|
||||
allDbs(Pouch)
|
||||
|
||||
module.exports = Pouch;
|
||||
module.exports = Pouch
|
||||
|
|
|
@ -8,6 +8,6 @@ module.exports = async db => {
|
|||
}`,
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(doc);
|
||||
})
|
||||
console.log(doc)
|
||||
}
|
||||
|
|
|
@ -8,4 +8,4 @@ async function startServer() {
|
|||
})
|
||||
}
|
||||
|
||||
startServer();
|
||||
startServer()
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
const jwt = require("jsonwebtoken");
|
||||
const jwt = require("jsonwebtoken")
|
||||
|
||||
module.exports = async (ctx, next) => {
|
||||
const token = ctx.cookies.get("budibase:token");
|
||||
console.log("TOKEN", token);
|
||||
const token = ctx.cookies.get("budibase:token")
|
||||
console.log("TOKEN", token)
|
||||
|
||||
if (!token) {
|
||||
ctx.isAuthenticated = false
|
||||
await next();
|
||||
return;
|
||||
};
|
||||
|
||||
try {
|
||||
ctx.jwtPayload = jwt.verify(token, ctx.config.jwtSecret);
|
||||
ctx.isAuthenticated = true;
|
||||
} catch (err) {
|
||||
ctx.throw(err.status || 403, err.text);
|
||||
await next()
|
||||
return
|
||||
}
|
||||
|
||||
await next();
|
||||
};
|
||||
try {
|
||||
ctx.jwtPayload = jwt.verify(token, ctx.config.jwtSecret)
|
||||
ctx.isAuthenticated = true
|
||||
} catch (err) {
|
||||
ctx.throw(err.status || 403, err.text)
|
||||
}
|
||||
|
||||
await next()
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const session = require("koa-session")
|
||||
|
||||
module.exports = (app) => {
|
||||
module.exports = app => {
|
||||
const sessionConfig = {
|
||||
key: "budi:sess" /** (string) cookie key (default is koa:sess) */,
|
||||
/** (number || 'session') maxAge in ms (default is 1 days) */
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
const bcrypt = require("bcryptjs");
|
||||
const bcrypt = require("bcryptjs")
|
||||
|
||||
const SALT_ROUNDS = process.env.SALT_ROUNDS || 10;
|
||||
const SALT_ROUNDS = process.env.SALT_ROUNDS || 10
|
||||
|
||||
exports.hash = async data => {
|
||||
const salt = await bcrypt.genSalt(SALT_ROUNDS);
|
||||
const result = await bcrypt.hash(data, salt);
|
||||
return result;
|
||||
};
|
||||
const salt = await bcrypt.genSalt(SALT_ROUNDS)
|
||||
const result = await bcrypt.hash(data, salt)
|
||||
return result
|
||||
}
|
||||
|
||||
exports.compare = async (data, encrypted) => await bcrypt.compare(data, encrypted);
|
||||
exports.compare = async (data, encrypted) =>
|
||||
await bcrypt.compare(data, encrypted)
|
||||
|
|
|
@ -22,7 +22,7 @@ const getAppDefinition = async appPath =>
|
|||
await readJSON(`${appPath}/appDefinition.json`)
|
||||
|
||||
module.exports.getPackageForBuilder = async (config, application) => {
|
||||
const appPath = resolve(config.latestPackagesFolder, application._id);
|
||||
const appPath = resolve(config.latestPackagesFolder, application._id)
|
||||
|
||||
const pages = await getPages(appPath)
|
||||
|
||||
|
@ -31,7 +31,7 @@ module.exports.getPackageForBuilder = async (config, application) => {
|
|||
|
||||
application,
|
||||
|
||||
clientId: process.env.CLIENT_ID
|
||||
clientId: process.env.CLIENT_ID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,4 +96,4 @@ module.exports.savePage = async (config, appname, pagename, page) => {
|
|||
})
|
||||
const appDefinition = await getAppDefinition(appPath)
|
||||
await buildPage(config, appname, appDefinition, pagename, page)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,20 +189,6 @@
|
|||
lodash "^4.17.13"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@budibase/client@^0.0.32":
|
||||
version "0.0.32"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.0.32.tgz#76d9f147563a0bf939eae7f32ce75b2a527ba496"
|
||||
integrity sha512-jmCCLn0CUoQbL6h623S5IqK6+GYLqX3WzUTZInSb1SCBOM3pI0eLP5HwTR6s7r42SfD0v9jTWRdyTnHiElNj8A==
|
||||
dependencies:
|
||||
"@nx-js/compiler-util" "^2.0.0"
|
||||
bcryptjs "^2.4.3"
|
||||
deep-equal "^2.0.1"
|
||||
lodash "^4.17.15"
|
||||
lunr "^2.3.5"
|
||||
regexparam "^1.3.0"
|
||||
shortid "^2.2.8"
|
||||
svelte "^3.9.2"
|
||||
|
||||
"@budibase/core@^0.0.32":
|
||||
version "0.0.32"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/core/-/core-0.0.32.tgz#c5d9ab869c5e9596a1ac337aaf041e795b1cc7fa"
|
||||
|
@ -690,11 +676,6 @@ array-equal@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93"
|
||||
integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=
|
||||
|
||||
array-filter@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83"
|
||||
integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=
|
||||
|
||||
array-unique@^0.3.2:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
|
||||
|
@ -747,13 +728,6 @@ atob@^2.1.2:
|
|||
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
|
||||
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
|
||||
|
||||
available-typed-arrays@^1.0.0, available-typed-arrays@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz#6b098ca9d8039079ee3f77f7b783c4480ba513f5"
|
||||
integrity sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==
|
||||
dependencies:
|
||||
array-filter "^1.0.0"
|
||||
|
||||
aws-sign2@~0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
|
||||
|
@ -1342,26 +1316,6 @@ decompress-response@^3.3.0:
|
|||
dependencies:
|
||||
mimic-response "^1.0.0"
|
||||
|
||||
deep-equal@^2.0.1:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.0.3.tgz#cad1c15277ad78a5c01c49c2dee0f54de8a6a7b0"
|
||||
integrity sha512-Spqdl4H+ky45I9ByyJtXteOm9CaIrPmnIPmOhrkKGNYWeDgCvJ8jNYVCTjChxW4FqGuZnLHADc8EKRMX6+CgvA==
|
||||
dependencies:
|
||||
es-abstract "^1.17.5"
|
||||
es-get-iterator "^1.1.0"
|
||||
is-arguments "^1.0.4"
|
||||
is-date-object "^1.0.2"
|
||||
is-regex "^1.0.5"
|
||||
isarray "^2.0.5"
|
||||
object-is "^1.1.2"
|
||||
object-keys "^1.1.1"
|
||||
object.assign "^4.1.0"
|
||||
regexp.prototype.flags "^1.3.0"
|
||||
side-channel "^1.0.2"
|
||||
which-boxed-primitive "^1.0.1"
|
||||
which-collection "^1.0.1"
|
||||
which-typed-array "^1.1.2"
|
||||
|
||||
deep-equal@~1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"
|
||||
|
@ -1582,7 +1536,7 @@ error-inject@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/error-inject/-/error-inject-1.0.0.tgz#e2b3d91b54aed672f309d950d154850fa11d4f37"
|
||||
integrity sha1-4rPZG1Su1nLzCdlQ0VSFD6EdTzc=
|
||||
|
||||
es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.4, es-abstract@^1.17.5:
|
||||
es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5:
|
||||
version "1.17.5"
|
||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9"
|
||||
integrity sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==
|
||||
|
@ -1599,19 +1553,6 @@ es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.4, es-abstrac
|
|||
string.prototype.trimleft "^2.1.1"
|
||||
string.prototype.trimright "^2.1.1"
|
||||
|
||||
es-get-iterator@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.0.tgz#bb98ad9d6d63b31aacdc8f89d5d0ee57bcb5b4c8"
|
||||
integrity sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==
|
||||
dependencies:
|
||||
es-abstract "^1.17.4"
|
||||
has-symbols "^1.0.1"
|
||||
is-arguments "^1.0.4"
|
||||
is-map "^2.0.1"
|
||||
is-set "^2.0.1"
|
||||
is-string "^1.0.5"
|
||||
isarray "^2.0.5"
|
||||
|
||||
es-to-primitive@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a"
|
||||
|
@ -2312,21 +2253,11 @@ is-accessor-descriptor@^1.0.0:
|
|||
dependencies:
|
||||
kind-of "^6.0.0"
|
||||
|
||||
is-arguments@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3"
|
||||
integrity sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==
|
||||
|
||||
is-arrayish@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
|
||||
integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=
|
||||
|
||||
is-bigint@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.0.tgz#73da8c33208d00f130e9b5e15d23eac9215601c4"
|
||||
integrity sha512-t5mGUXC/xRheCK431ylNiSkGGpBp8bHENBcENTkDT6ppwPzEVxNGZRvgvmOEfbWkFhA7D2GEuE2mmQTr78sl2g==
|
||||
|
||||
is-binary-path@~2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
|
||||
|
@ -2334,11 +2265,6 @@ is-binary-path@~2.1.0:
|
|||
dependencies:
|
||||
binary-extensions "^2.0.0"
|
||||
|
||||
is-boolean-object@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.1.tgz#10edc0900dd127697a92f6f9807c7617d68ac48e"
|
||||
integrity sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ==
|
||||
|
||||
is-buffer@^1.1.5:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
|
||||
|
@ -2375,7 +2301,7 @@ is-data-descriptor@^1.0.0:
|
|||
dependencies:
|
||||
kind-of "^6.0.0"
|
||||
|
||||
is-date-object@^1.0.1, is-date-object@^1.0.2:
|
||||
is-date-object@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e"
|
||||
integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==
|
||||
|
@ -2450,21 +2376,11 @@ is-installed-globally@^0.3.1:
|
|||
global-dirs "^2.0.1"
|
||||
is-path-inside "^3.0.1"
|
||||
|
||||
is-map@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.1.tgz#520dafc4307bb8ebc33b813de5ce7c9400d644a1"
|
||||
integrity sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==
|
||||
|
||||
is-npm@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d"
|
||||
integrity sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig==
|
||||
|
||||
is-number-object@^1.0.3:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197"
|
||||
integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==
|
||||
|
||||
is-number@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195"
|
||||
|
@ -2501,21 +2417,11 @@ is-regex@^1.0.5:
|
|||
dependencies:
|
||||
has "^1.0.3"
|
||||
|
||||
is-set@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.1.tgz#d1604afdab1724986d30091575f54945da7e5f43"
|
||||
integrity sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==
|
||||
|
||||
is-stream@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
|
||||
|
||||
is-string@^1.0.4, is-string@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6"
|
||||
integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==
|
||||
|
||||
is-symbol@^1.0.2:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937"
|
||||
|
@ -2532,31 +2438,11 @@ is-type-of@^1.0.0:
|
|||
is-class-hotfix "~0.0.6"
|
||||
isstream "~0.1.2"
|
||||
|
||||
is-typed-array@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.3.tgz#a4ff5a5e672e1a55f99c7f54e59597af5c1df04d"
|
||||
integrity sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ==
|
||||
dependencies:
|
||||
available-typed-arrays "^1.0.0"
|
||||
es-abstract "^1.17.4"
|
||||
foreach "^2.0.5"
|
||||
has-symbols "^1.0.1"
|
||||
|
||||
is-typedarray@^1.0.0, is-typedarray@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
|
||||
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
|
||||
|
||||
is-weakmap@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2"
|
||||
integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==
|
||||
|
||||
is-weakset@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.1.tgz#e9a0af88dbd751589f5e50d80f4c98b780884f83"
|
||||
integrity sha512-pi4vhbhVHGLxohUw7PhGsueT4vRGFoXhP7+RGN0jKIv9+8PWYCQTqtADngrxOm2g46hoH0+g8uZZBzMrvVGDmw==
|
||||
|
||||
is-windows@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
|
||||
|
@ -2582,11 +2468,6 @@ isarray@1.0.0, isarray@~1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
|
||||
|
||||
isarray@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723"
|
||||
integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
|
@ -3860,14 +3741,6 @@ object-inspect@^1.7.0:
|
|||
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67"
|
||||
integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==
|
||||
|
||||
object-is@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.2.tgz#c5d2e87ff9e119f78b7a088441519e2eec1573b6"
|
||||
integrity sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ==
|
||||
dependencies:
|
||||
define-properties "^1.1.3"
|
||||
es-abstract "^1.17.5"
|
||||
|
||||
object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.0.6, object-keys@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
|
||||
|
@ -4361,19 +4234,6 @@ regex-not@^1.0.0, regex-not@^1.0.2:
|
|||
extend-shallow "^3.0.2"
|
||||
safe-regex "^1.1.0"
|
||||
|
||||
regexp.prototype.flags@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75"
|
||||
integrity sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==
|
||||
dependencies:
|
||||
define-properties "^1.1.3"
|
||||
es-abstract "^1.17.0-next.1"
|
||||
|
||||
regexparam@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/regexparam/-/regexparam-1.3.0.tgz#2fe42c93e32a40eff6235d635e0ffa344b92965f"
|
||||
integrity sha512-6IQpFBv6e5vz1QAqI+V4k8P2e/3gRrqfCJ9FI+O1FLQTO+Uz6RXZEZOPmTJ6hlGj7gkERzY5BRCv09whKP96/g==
|
||||
|
||||
registry-auth-token@^4.0.0:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-4.1.1.tgz#40a33be1e82539460f94328b0f7f0f84c16d9479"
|
||||
|
@ -4629,14 +4489,6 @@ shortid@^2.2.8:
|
|||
dependencies:
|
||||
nanoid "^2.1.0"
|
||||
|
||||
side-channel@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.2.tgz#df5d1abadb4e4bf4af1cd8852bf132d2f7876947"
|
||||
integrity sha512-7rL9YlPHg7Ancea1S96Pa8/QWb4BtXL/TZvS6B8XFetGBeuhAsfmUspK6DokBeZ64+Kj9TCNRD/30pVz1BvQNA==
|
||||
dependencies:
|
||||
es-abstract "^1.17.0-next.1"
|
||||
object-inspect "^1.7.0"
|
||||
|
||||
signal-exit@^3.0.0, signal-exit@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
||||
|
@ -4976,11 +4828,6 @@ supports-color@^7.1.0:
|
|||
dependencies:
|
||||
has-flag "^4.0.0"
|
||||
|
||||
svelte@^3.9.2:
|
||||
version "3.22.2"
|
||||
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.22.2.tgz#06585244191bf7a112af2a0025610f33d77c3715"
|
||||
integrity sha512-DxumO0+vvHA6NSc2jtVty08I8lFI43q8P2zX6JxZL8J1kqK5NVjad6TRM/twhnWXC+QScnwkZ15O6X1aTsEKTA==
|
||||
|
||||
symbol-tree@^3.2.2:
|
||||
version "3.2.4"
|
||||
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
|
||||
|
@ -5384,44 +5231,11 @@ whatwg-url@^7.0.0:
|
|||
tr46 "^1.0.1"
|
||||
webidl-conversions "^4.0.2"
|
||||
|
||||
which-boxed-primitive@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz#cbe8f838ebe91ba2471bb69e9edbda67ab5a5ec1"
|
||||
integrity sha512-7BT4TwISdDGBgaemWU0N0OU7FeAEJ9Oo2P1PHRm/FCWoEi2VLWC9b6xvxAA3C/NMpxg3HXVgi0sMmGbNUbNepQ==
|
||||
dependencies:
|
||||
is-bigint "^1.0.0"
|
||||
is-boolean-object "^1.0.0"
|
||||
is-number-object "^1.0.3"
|
||||
is-string "^1.0.4"
|
||||
is-symbol "^1.0.2"
|
||||
|
||||
which-collection@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906"
|
||||
integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==
|
||||
dependencies:
|
||||
is-map "^2.0.1"
|
||||
is-set "^2.0.1"
|
||||
is-weakmap "^2.0.1"
|
||||
is-weakset "^2.0.1"
|
||||
|
||||
which-module@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||
|
||||
which-typed-array@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.2.tgz#e5f98e56bda93e3dac196b01d47c1156679c00b2"
|
||||
integrity sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ==
|
||||
dependencies:
|
||||
available-typed-arrays "^1.0.2"
|
||||
es-abstract "^1.17.5"
|
||||
foreach "^2.0.5"
|
||||
function-bind "^1.1.1"
|
||||
has-symbols "^1.0.1"
|
||||
is-typed-array "^1.1.3"
|
||||
|
||||
which@^1.2.9, which@^1.3.0:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { onMount } from "svelte"
|
||||
|
||||
export let _bb
|
||||
export let _viewName
|
||||
|
@ -7,7 +7,6 @@
|
|||
|
||||
let username
|
||||
let password
|
||||
|
||||
</script>
|
||||
|
||||
<form class="uk-form">
|
||||
|
@ -24,4 +23,5 @@
|
|||
</form>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue