server tests in-memory and passing

This commit is contained in:
Michael Shanks 2020-05-14 15:12:30 +01:00
parent 1c1f891543
commit 18375a6d19
55 changed files with 969 additions and 598 deletions

View File

@ -16,8 +16,8 @@ export const getBackendUiStore = () => {
store.actions = { store.actions = {
database: { database: {
select: async db => { select: async db => {
const modelsResponse = await api.get(`/api/${db.id}/models`) const modelsResponse = await api.get(`/api/${db._id}/models`)
const viewsResponse = await api.get(`/api/${db.id}/views`) const viewsResponse = await api.get(`/api/${db._id}/views`)
const models = await modelsResponse.json() const models = await modelsResponse.json()
const views = await viewsResponse.json() const views = await viewsResponse.json()
store.update(state => { store.update(state => {
@ -37,7 +37,7 @@ export const getBackendUiStore = () => {
}), }),
view: record => view: record =>
store.update(state => { store.update(state => {
state.breadcrumbs = [state.selectedDatabase.name, record.id] state.breadcrumbs = [state.selectedDatabase.name, record._id]
return state return state
}), }),
select: record => select: record =>

View File

@ -354,7 +354,7 @@ const addChildComponent = store => (componentToAdd, presetName) => {
const presetProps = presetName ? component.presets[presetName] : {} const presetProps = presetName ? component.presets[presetName] : {}
const instanceId = get(backendUiStore).selectedDatabase.id; const instanceId = get(backendUiStore).selectedDatabase._id;
const newComponent = createProps(component, { const newComponent = createProps(component, {
...presetProps, ...presetProps,

View File

@ -46,7 +46,7 @@
async function selectRecord(record) { async function selectRecord(record) {
return await api.loadRecord(record.key, { return await api.loadRecord(record.key, {
appname: $store.appname, appname: $store.appname,
instanceId: $backendUiStore.selectedDatabase.id, instanceId: $backendUiStore.selectedDatabase._id,
}) })
} }
@ -60,7 +60,7 @@
let views = [] let views = []
let currentPage = 0 let currentPage = 0
$: instanceId = $backendUiStore.selectedDatabase.id $: instanceId = $backendUiStore.selectedDatabase._id
$: { $: {
if ($backendUiStore.selectedView) { if ($backendUiStore.selectedView) {

View File

@ -1,14 +1,13 @@
import api from "builderStore/api" import api from "builderStore/api"
export async function createUser(user, appId, instanceId) { export async function createUser(user, appId, instanceId) {
const CREATE_USER_URL = `/api/${appId}/${instanceId}/users` const CREATE_USER_URL = `/api/${instanceId}/users`
const response = await api.post(CREATE_USER_URL, user) const response = await api.post(CREATE_USER_URL, user)
const json = await response.json() return await response.json()
return json.user
} }
export async function createDatabase(clientId, appname, instanceName) { export async function createDatabase(appname, instanceName) {
const CREATE_DATABASE_URL = `/api/${clientId}/${appname}/instances` const CREATE_DATABASE_URL = `/api/${appname}/instances`
const response = await api.post(CREATE_DATABASE_URL, { const response = await api.post(CREATE_DATABASE_URL, {
name: instanceName, name: instanceName,
}) })

View File

@ -10,11 +10,10 @@
async function createDatabase() { async function createDatabase() {
const response = await api.createDatabase( const response = await api.createDatabase(
$store.clientId,
$store.appId, $store.appId,
databaseName databaseName
) )
store.createDatabaseForApp(response.instance) store.createDatabaseForApp(response)
onClosed() onClosed()
} }
</script> </script>

View File

@ -18,7 +18,7 @@
let fieldToEdit let fieldToEdit
$: modelFields = model.schema ? Object.entries(model.schema) : [] $: modelFields = model.schema ? Object.entries(model.schema) : []
$: instanceId = $backendUiStore.selectedDatabase.id $: instanceId = $backendUiStore.selectedDatabase._id
function editField() {} function editField() {}
@ -30,7 +30,7 @@
const SAVE_MODEL_URL = `/api/${instanceId}/models` const SAVE_MODEL_URL = `/api/${instanceId}/models`
const response = await api.post(SAVE_MODEL_URL, model) const response = await api.post(SAVE_MODEL_URL, model)
const newModel = await response.json() const newModel = await response.json()
backendUiStore.actions.models.create(newModel.model) backendUiStore.actions.models.create(newModel)
onClosed() onClosed()
} }
</script> </script>

View File

@ -18,7 +18,7 @@
let errors = [] let errors = []
let selectedModel let selectedModel
$: instanceId = $backendUiStore.selectedDatabase.id $: instanceId = $backendUiStore.selectedDatabase._id
$: modelSchema = $backendUiStore.selectedModel $: modelSchema = $backendUiStore.selectedModel
? Object.entries($backendUiStore.selectedModel.schema) ? Object.entries($backendUiStore.selectedModel.schema)

View File

@ -24,7 +24,7 @@
let currentSnippetEditor = SNIPPET_EDITORS.MAP let currentSnippetEditor = SNIPPET_EDITORS.MAP
$: instanceId = $backendUiStore.selectedDatabase.id $: instanceId = $backendUiStore.selectedDatabase._id
function deleteView() {} function deleteView() {}

View File

@ -9,7 +9,7 @@
let password let password
$: valid = username && password $: valid = username && password
$: instanceId = $backendUiStore.selectedDatabase.id $: instanceId = $backendUiStore.selectedDatabase._id
$: appId = $store.appId $: appId = $store.appId
async function createUser() { async function createUser() {

View File

@ -6,7 +6,7 @@
export let record export let record
export let onClosed export let onClosed
$: instanceId = $backendUiStore.selectedDatabase.id $: instanceId = $backendUiStore.selectedDatabase._id
</script> </script>
<section> <section>

View File

@ -46,7 +46,7 @@
</div> </div>
</div> </div>
<hr /> <hr />
{#if $backendUiStore.selectedDatabase.id} {#if $backendUiStore.selectedDatabase._id}
<div class="hierarchy"> <div class="hierarchy">
<div class="components-list-container"> <div class="components-list-container">
<div class="nav-group-header"> <div class="nav-group-header">

View File

@ -16,7 +16,7 @@
const response = await api.delete(DELETE_DATABASE_URL) const response = await api.delete(DELETE_DATABASE_URL)
store.update(state => { store.update(state => {
state.appInstances = state.appInstances.filter( state.appInstances = state.appInstances.filter(
db => db.id !== database.id db => db._id !== database._id
) )
return state return state
}) })
@ -28,14 +28,14 @@
{#each $store.appInstances as database} {#each $store.appInstances as database}
<li> <li>
<span class="icon"> <span class="icon">
{#if database.id === $backendUiStore.selectedDatabase.id} {#if database._id === $backendUiStore.selectedDatabase._id}
<CheckIcon /> <CheckIcon />
{/if} {/if}
</span> </span>
<button <button
class:active={database.id === $backendUiStore.selectedDatabase.id} class:active={database._id === $backendUiStore.selectedDatabase._id}
on:click={() => { on:click={() => {
$goto(`./database/${database.id}`), selectDatabase(database) $goto(`./database/${database._id}`), selectDatabase(database)
}}> }}>
{database.name} {database.name}
</button> </button>

View File

@ -12,7 +12,7 @@
$: currentAppInfo = { $: currentAppInfo = {
appname: $store.appname, appname: $store.appname,
instanceId: $backendUiStore.selectedDatabase.id, instanceId: $backendUiStore.selectedDatabase._id,
} }
async function fetchUsers() { async function fetchUsers() {
@ -33,7 +33,7 @@
{#each $backendUiStore.users as user} {#each $backendUiStore.users as user}
<li> <li>
<i class="ri-user-4-line" /> <i class="ri-user-4-line" />
<button class:active={user.id === $store.currentUserId}> <button class:active={user.username === $store.currentUserName}>
{user.name} {user.name}
</button> </button>
</li> </li>

View File

@ -40,7 +40,7 @@
</ActionButton> </ActionButton>
{/if} {/if}
</div> </div>
{#if $backendUiStore.selectedDatabase.id} {#if $backendUiStore.selectedDatabase._id}
<ModelDataTable {selectRecord} /> <ModelDataTable {selectRecord} />
{/if} {/if}

View File

@ -12,7 +12,7 @@
onMount(async () => { onMount(async () => {
if ($store.appInstances.length > 0) { if ($store.appInstances.length > 0) {
await selectDatabase($store.appInstances[0]) await selectDatabase($store.appInstances[0])
$goto(`./${$backendUiStore.selectedDatabase.id}`) $goto(`./${$backendUiStore.selectedDatabase._id}`)
} }
}) })
</script> </script>

View File

@ -12,7 +12,7 @@
onMount(async () => { onMount(async () => {
if ($store.appInstances.length > 0) { if ($store.appInstances.length > 0) {
await selectDatabase($store.appInstances[0]) await selectDatabase($store.appInstances[0])
$goto(`../${$backendUiStore.selectedDatabase.id}`) $goto(`../${$backendUiStore.selectedDatabase._id}`)
} }
}) })
</script> </script>

View File

@ -8,7 +8,7 @@
let promise = getApps() let promise = getApps()
async function getApps() { async function getApps() {
const res = await fetch(`/api/${$store.clientId}/applications`) const res = await fetch(`/api/applications`)
const json = await res.json() const json = await res.json()
if (res.ok) { if (res.ok) {

View File

@ -3,7 +3,7 @@ const { exists, readFile, writeFile, ensureDir } = require("fs-extra")
const chalk = require("chalk") const chalk = require("chalk")
const { serverFileName, xPlatHomeDir } = require("../../common") const { serverFileName, xPlatHomeDir } = require("../../common")
const { join } = require("path") const { join } = require("path")
const initialiseClientDb = require("@budibase/server/src/db/initialiseClientDb") const { create } = require("@budibase/server/src/db/clientDb")
const Sqrl = require("squirrelly") const Sqrl = require("squirrelly")
const uuid = require("uuid") const uuid = require("uuid")
const CouchDB = require("@budibase/server/src/db/client") const CouchDB = require("@budibase/server/src/db/client")
@ -68,8 +68,7 @@ const createClientDatabase = async opts => {
} }
} }
const db = new CouchDB(`client-${opts.clientId}`) await create(opts.clientId)
await initialiseClientDb(db)
} }
const createDevEnvFile = async opts => { const createDevEnvFile = async opts => {

View File

@ -5,6 +5,7 @@ module.exports = ({ dir }) => {
dir = xPlatHomeDir(dir) dir = xPlatHomeDir(dir)
process.env.BUDIBASE_DIR = resolve(dir) process.env.BUDIBASE_DIR = resolve(dir)
require("dotenv").config({ path: resolve(dir, ".env") }) require("dotenv").config({ path: resolve(dir, ".env") })
require("@budibase/server/src/app") require("@budibase/server/src/app")().then(() => {
console.log(`Budibase Builder running on port ${process.env.PORT}..`) console.log(`Budibase Builder running on port ${process.env.PORT}..`)
})
} }

View File

@ -2,10 +2,6 @@
# http://admin:password@localhost:5984 # http://admin:password@localhost:5984
COUCH_DB_URL={{couchDbUrl}} COUCH_DB_URL={{couchDbUrl}}
# local (PouchDB) - default for dev
# remote (CouchDB) - required couch db installation
DATABASE_TYPE={{database}}
# identifies a client database - i.e. group of apps # identifies a client database - i.e. group of apps
CLIENT_ID={{clientId}} CLIENT_ID={{clientId}}
@ -13,8 +9,7 @@ CLIENT_ID={{clientId}}
ADMIN_SECRET={{adminSecret}} ADMIN_SECRET={{adminSecret}}
# used to create cookie hashes # used to create cookie hashes
COOKIE_KEY_1={{cookieKey1}} JWT_SECRET={{cookieKey1}}
COOKIE_KEY_2={{cookieKey2}}
# port to run http server on # port to run http server on
PORT=4001 PORT=4001

View File

@ -11,38 +11,103 @@
"program": "${workspaceFolder}/src/index.js" "program": "${workspaceFolder}/src/index.js"
}, },
{ {
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"name": "Jest App Server", "name": "Jest - All",
"program": "${workspaceFolder}/node_modules/.bin/jest", "program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["apps", "--runInBand"], "args": [],
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen", "internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true, "disableOptimisticBPs": true,
"windows": { "windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest", "program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest Builder",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["builder", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Initialise Budibase",
"program": "yarn",
"args": ["run", "initialise"],
"console": "externalTerminal"
} }
},
{
"type": "node",
"request": "launch",
"name": "Jest - Users",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["user.spec", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest - Instances",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["instance.spec", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest - Records",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["record.spec", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest - Models",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["model.spec", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest - Views",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["view.spec", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest Builder",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["builder", "--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest-cli/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Initialise Budibase",
"program": "yarn",
"args": ["run", "initialise"],
"console": "externalTerminal"
}
] ]
} }

View File

@ -50,11 +50,13 @@
"eslint": "^6.8.0", "eslint": "^6.8.0",
"jest": "^24.8.0", "jest": "^24.8.0",
"nodemon": "^2.0.2", "nodemon": "^2.0.2",
"pouchdb-adapter-memory": "^7.2.1",
"server-destroy": "^1.0.1", "server-destroy": "^1.0.1",
"supertest": "^4.0.2" "supertest": "^4.0.2"
}, },
"jest": { "jest": {
"testEnvironment": "node" "testEnvironment": "node",
"setupFiles": ["./scripts/jestSetup.js"]
}, },
"gitHead": "b1f4f90927d9e494e513220ef060af28d2d42455" "gitHead": "b1f4f90927d9e494e513220ef060af28d2d42455"
} }

View File

@ -0,0 +1,11 @@
const { tmpdir } = require("os")
process.env.NODE_ENV = "jest"
process.env.JWT_SECRET = "test-jwtsecret"
process.env.CLIENT_ID = "test-client-id"
process.env.BUDIBASE_DIR = tmpdir("budibase-unittests")
process.env.ADMIN_SECRET = "test-admin-secret"
// makes the output of the tests messy
// but please temporarily enable for debugging :)
process.env.LOGGER = "off"

View File

@ -1,8 +1,10 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const { getPackageForBuilder } = require("../../utilities/builder") const { getPackageForBuilder } = require("../../utilities/builder")
const uuid = require("uuid")
const env = require("../../environment")
exports.fetch = async function(ctx) { exports.fetch = async function(ctx) {
const clientDb = new CouchDB(`client-${ctx.params.clientId}`) const clientDb = new CouchDB(`client-${env.CLIENT_ID}`)
const body = await clientDb.query("client/by_type", { const body = await clientDb.query("client/by_type", {
include_docs: true, include_docs: true,
key: ["app"], key: ["app"],
@ -12,14 +14,16 @@ exports.fetch = async function(ctx) {
} }
exports.fetchAppPackage = async function(ctx) { exports.fetchAppPackage = async function(ctx) {
const clientDb = new CouchDB(`client-${ctx.params.clientId}`) const clientDb = new CouchDB(`client-${env.CLIENT_ID}`)
const application = await clientDb.get(ctx.params.applicationId) const application = await clientDb.get(ctx.params.applicationId)
ctx.body = await getPackageForBuilder(ctx.config, application) ctx.body = await getPackageForBuilder(ctx.config, application)
} }
exports.create = async function(ctx) { exports.create = async function(ctx) {
const clientDb = new CouchDB(`client-${ctx.params.clientId}`) const clientDb = new CouchDB(`client-${env.CLIENT_ID}`)
const { id, rev } = await clientDb.post({
const newApplication = {
_id: uuid.v4().replace(/-/g, ""),
type: "app", type: "app",
instances: [], instances: [],
userInstanceMap: {}, userInstanceMap: {},
@ -28,11 +32,10 @@ exports.create = async function(ctx) {
"@budibase/materialdesign-components", "@budibase/materialdesign-components",
], ],
...ctx.request.body, ...ctx.request.body,
})
ctx.body = {
id,
rev,
message: `Application ${ctx.request.body.name} created successfully`,
} }
const { rev } = await clientDb.post(newApplication)
newApplication._rev = rev
ctx.body = newApplication
ctx.message = `Application ${ctx.request.body.name} created successfully`
} }

View File

@ -1,6 +1,7 @@
const jwt = require("jsonwebtoken") const jwt = require("jsonwebtoken")
const CouchDB = require("../../db") const CouchDB = require("../../db")
const bcrypt = require("../../utilities/bcrypt") const bcrypt = require("../../utilities/bcrypt")
const env = require("../../environment")
exports.authenticate = async ctx => { exports.authenticate = async ctx => {
const { username, password } = ctx.request.body const { username, password } = ctx.request.body
@ -13,7 +14,7 @@ exports.authenticate = async ctx => {
const appId = referer[3] const appId = referer[3]
// find the instance that the user is associated with // find the instance that the user is associated with
const db = new CouchDB(`client-${process.env.CLIENT_ID}`) const db = new CouchDB(`client-${env.CLIENT_ID}`)
const app = await db.get(appId) const app = await db.get(appId)
const instanceId = app.userInstanceMap[username] const instanceId = app.userInstanceMap[username]

View File

@ -1,36 +1,18 @@
const CouchDB = require("../../db") const { create, destroy } = require("../../db/clientDb")
const env = require("../../environment")
exports.getClientId = async function(ctx) { exports.getClientId = async function(ctx) {
ctx.body = process.env.CLIENT_ID ctx.body = env.CLIENT_ID
} }
exports.create = async function(ctx) { exports.create = async function(ctx) {
const clientId = `client-${ctx.request.body.clientId}` await create(env.CLIENT_ID)
const db = new CouchDB(clientId) ctx.status = 200
ctx.message = `Client Database ${env.CLIENT_ID} successfully provisioned.`
await db.put({
_id: "_design/client",
views: {
by_type: {
map: function(doc) {
emit([doc.type], doc._id)
}.toString(),
},
},
})
ctx.body = {
message: `Client Database ${clientId} successfully provisioned.`,
}
} }
exports.destroy = async function(ctx) { exports.destroy = async function(ctx) {
const dbId = `client-${ctx.params.clientId}` await destroy(env.CLIENT_ID)
ctx.status = 200
await new CouchDB(dbId).destroy() ctx.message = `Client Database ${env.CLIENT_ID} successfully deleted.`
ctx.body = {
status: 200,
message: `Client Database ${dbId} successfully deleted.`,
}
} }

View File

@ -1,10 +1,15 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const uuid = require("uuid") const uuid = require("uuid")
const env = require("../../environment")
const clientDatabaseId = clientId => `client-${clientId}`
exports.create = async function(ctx) { exports.create = async function(ctx) {
const instanceName = ctx.request.body.name const instanceName = ctx.request.body.name
const instanceId = `app_${ctx.params.applicationId.substring(6)}_inst_${uuid.v4()}` const uid = uuid.v4().replace(/-/g, "")
const { clientId, applicationId } = ctx.params const instanceId = `${ctx.params.applicationId.substring(0,7)}_${uid}`
const { applicationId } = ctx.params
const clientId = env.CLIENT_ID
const db = new CouchDB(instanceId) const db = new CouchDB(instanceId)
await db.put({ await db.put({
_id: "_design/database", _id: "_design/database",
@ -29,18 +34,15 @@ exports.create = async function(ctx) {
}) })
// Add the new instance under the app clientDB // Add the new instance under the app clientDB
const clientDatabaseId = `client-${clientId}` const clientDb = new CouchDB(clientDatabaseId(clientId))
const clientDb = new CouchDB(clientDatabaseId)
const budibaseApp = await clientDb.get(applicationId) const budibaseApp = await clientDb.get(applicationId)
const instance = { id: instanceId, name: instanceName } const instance = { _id: instanceId, name: instanceName }
budibaseApp.instances.push(instance) budibaseApp.instances.push(instance)
await clientDb.put(budibaseApp) await clientDb.put(budibaseApp)
ctx.body = { ctx.status = 200
message: `Instance Database ${instanceName} successfully provisioned.`, ctx.message = `Instance Database ${instanceName} successfully provisioned.`
status: 200, ctx.body = instance
instance,
}
} }
exports.destroy = async function(ctx) { exports.destroy = async function(ctx) {
@ -50,15 +52,13 @@ exports.destroy = async function(ctx) {
// remove instance from client application document // remove instance from client application document
const { metadata } = designDoc const { metadata } = designDoc
const clientDb = new CouchDB(metadata.clientId) const clientDb = new CouchDB(clientDatabaseId(metadata.clientId))
const budibaseApp = await clientDb.get(metadata.applicationId) const budibaseApp = await clientDb.get(metadata.applicationId)
budibaseApp.instances = budibaseApp.instances.filter( budibaseApp.instances = budibaseApp.instances.filter(
instance => instance !== ctx.params.instanceId instance => instance !== ctx.params.instanceId
) )
await clientDb.put(budibaseApp) await clientDb.put(budibaseApp)
ctx.body = { ctx.status = 200
message: `Instance Database ${ctx.params.instanceId} successfully destroyed.`, ctx.message = `Instance Database ${ctx.params.instanceId} successfully destroyed.`
status: 200,
}
} }

View File

@ -1,4 +1,5 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const uuid = require("uuid")
exports.fetch = async function(ctx) { exports.fetch = async function(ctx) {
const db = new CouchDB(ctx.params.instanceId) const db = new CouchDB(ctx.params.instanceId)
@ -11,17 +12,21 @@ exports.fetch = async function(ctx) {
exports.create = async function(ctx) { exports.create = async function(ctx) {
const db = new CouchDB(ctx.params.instanceId) const db = new CouchDB(ctx.params.instanceId)
const newModel = await db.post({ const newModel = {
type: "model", type: "model",
...ctx.request.body, ...ctx.request.body,
}) _id: uuid.v4().replace(/-/g, ""),
}
const result = await db.post(newModel)
newModel._rev = result.rev
const designDoc = await db.get("_design/database") const designDoc = await db.get("_design/database")
designDoc.views = { designDoc.views = {
...designDoc.views, ...designDoc.views,
[`all_${newModel.id}`]: { [`all_${newModel._id}`]: {
map: `function(doc) { map: `function(doc) {
if (doc.modelId === "${newModel.id}") { if (doc.modelId === "${newModel._id}") {
emit(doc[doc.key], doc._id); emit(doc[doc.key], doc._id);
} }
}`, }`,
@ -29,15 +34,9 @@ exports.create = async function(ctx) {
} }
await db.put(designDoc) await db.put(designDoc)
ctx.body = { ctx.status = 200
message: `Model ${ctx.request.body.name} created successfully.`, ctx.message = `Model ${ctx.request.body.name} created successfully.`
status: 200, ctx.body = newModel
model: {
_id: newModel.id,
_rev: newModel.rev,
...ctx.request.body,
},
}
} }
exports.update = async function(ctx) {} exports.update = async function(ctx) {}
@ -45,8 +44,8 @@ exports.update = async function(ctx) {}
exports.destroy = async function(ctx) { exports.destroy = async function(ctx) {
const db = new CouchDB(ctx.params.instanceId) const db = new CouchDB(ctx.params.instanceId)
const model = await db.remove(ctx.params.modelId, ctx.params.revId) await db.remove(ctx.params.modelId, ctx.params.revId)
const modelViewId = `all_${model.id}` const modelViewId = `all_${ctx.params.modelId}`
// Delete all records for that model // Delete all records for that model
const records = await db.query(`database/${modelViewId}`) const records = await db.query(`database/${modelViewId}`)
@ -59,8 +58,6 @@ exports.destroy = async function(ctx) {
delete designDoc.views[modelViewId] delete designDoc.views[modelViewId]
await db.put(designDoc) await db.put(designDoc)
ctx.body = { ctx.status = 200
message: `Model ${model.id} deleted.`, ctx.message = `Model ${ctx.params.modelId} deleted.`
status: 200,
}
} }

View File

@ -1,5 +1,6 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const Ajv = require("ajv") const Ajv = require("ajv")
const uuid = require("uuid")
const ajv = new Ajv() const ajv = new Ajv()
@ -7,6 +8,10 @@ exports.save = async function(ctx) {
const db = new CouchDB(ctx.params.instanceId) const db = new CouchDB(ctx.params.instanceId)
const record = ctx.request.body const record = ctx.request.body
if (!record._rev && !record._id) {
record._id = uuid.v4().replace(/-/, "")
}
// validation with ajv // validation with ajv
const model = await db.get(record.modelId) const model = await db.get(record.modelId)
const validate = ajv.compile({ const validate = ajv.compile({
@ -23,18 +28,15 @@ exports.save = async function(ctx) {
return return
} }
const existingRecord = record._id && (await db.get(record._id)) const existingRecord = record._rev && (await db.get(record._id))
if (existingRecord) { if (existingRecord) {
const response = await db.put({ ...record, _id: existingRecord._id }) const response = await db.put(record)
ctx.body = { record._rev = response.rev
message: `${model.name} updated successfully.`, record.type = "record"
status: 200, ctx.body = record
record: { ctx.status = 200
...record, ctx.message = `${model.name} updated successfully.`
...response,
},
}
return return
} }
@ -45,10 +47,7 @@ exports.save = async function(ctx) {
// record: record, // record: record,
// }) // })
ctx.body = { ctx.body = record
...record,
...response
}
ctx.status = 200 ctx.status = 200
ctx.message = `${model.name} created successfully` ctx.message = `${model.name} created successfully`
} }

View File

@ -1,5 +1,8 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const bcrypt = require("../../utilities/bcrypt") const bcrypt = require("../../utilities/bcrypt")
const env = require("../../environment")
const getUserId = userName => `user_${userName}`
exports.fetch = async function(ctx) { exports.fetch = async function(ctx) {
const database = new CouchDB(ctx.params.instanceId) const database = new CouchDB(ctx.params.instanceId)
@ -13,20 +16,22 @@ exports.fetch = async function(ctx) {
exports.create = async function(ctx) { exports.create = async function(ctx) {
const database = new CouchDB(ctx.params.instanceId) const database = new CouchDB(ctx.params.instanceId)
const appId = (await database.get("_design/database")).metadata.applicationId
const { username, password, name } = ctx.request.body 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({
_id: getUserId(username),
username, username,
password: await bcrypt.hash(password), password: await bcrypt.hash(password),
name, name: name || username,
type: "user", type: "user",
}) })
// the clientDB needs to store a map of users against the app // the clientDB needs to store a map of users against the app
const clientDb = new CouchDB(`client-${process.env.CLIENT_ID}`) const clientDb = new CouchDB(`client-${env.CLIENT_ID}`)
const app = await clientDb.get(ctx.params.appId) const app = await clientDb.get(appId)
app.userInstanceMap = { app.userInstanceMap = {
...app.userInstanceMap, ...app.userInstanceMap,
@ -34,24 +39,28 @@ exports.create = async function(ctx) {
} }
await clientDb.put(app) await clientDb.put(app)
ctx.status = 200
ctx.message = "User created successfully."
ctx.body = { ctx.body = {
user: { _rev: response.rev,
id: response.id, username,
rev: response.rev, name,
username,
name,
},
message: `User created successfully.`,
status: 200,
} }
} }
exports.destroy = async function(ctx) { 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) await database.destroy(getUserId(ctx.params.username))
ctx.message = `User ${ctx.params.username} deleted.`
ctx.status = 200
}
exports.find = async function(ctx) {
const database = new CouchDB(ctx.params.instanceId)
const user = await database.get(getUserId(ctx.params.username))
ctx.body = { ctx.body = {
...response, username: user.username,
message: `User deleted.`, name: user.name,
status: 200, _rev: user._rev,
} }
} }

View File

@ -24,23 +24,17 @@ const controller = {
}, },
create: async ctx => { create: async ctx => {
const db = new CouchDB(ctx.params.instanceId) const db = new CouchDB(ctx.params.instanceId)
const { name, ...viewDefinition } = ctx.request.body const newView = ctx.request.body
const designDoc = await db.get("_design/database") const designDoc = await db.get("_design/database")
designDoc.views = { designDoc.views = {
...designDoc.views, ...designDoc.views,
[name]: viewDefinition, [newView.name]: newView,
} }
const newView = await db.put(designDoc) await db.put(designDoc)
ctx.body = { ctx.body = newView
view: { ctx.message = `View ${newView.name} created successfully.`
...ctx.request.body,
...newView,
},
message: `View ${name} created successfully.`,
status: 200,
}
}, },
destroy: async ctx => { destroy: async ctx => {
const db = new CouchDB(ctx.params.instanceId) const db = new CouchDB(ctx.params.instanceId)

View File

@ -18,6 +18,7 @@ const {
} = require("./routes") } = require("./routes")
const router = new Router() const router = new Router()
const env = require("../environment")
router router
.use( .use(
@ -34,9 +35,9 @@ router
.use(async (ctx, next) => { .use(async (ctx, next) => {
ctx.config = { ctx.config = {
latestPackagesFolder: budibaseAppsDir(), latestPackagesFolder: budibaseAppsDir(),
jwtSecret: process.env.JWT_SECRET, jwtSecret: env.JWT_SECRET,
} }
ctx.isDev = process.env.NODE_ENV !== "production" ctx.isDev = env.NODE_ENV !== "production" && env.NODE_ENV !== "jest"
await next() await next()
}) })
.use(authenticated) .use(authenticated)
@ -46,7 +47,7 @@ router.use(async (ctx, next) => {
try { try {
await next() await next()
} catch (err) { } catch (err) {
console.trace(err) if (env.LOGGER !== "off") console.trace(err)
ctx.status = err.status || err.statusCode || 500 ctx.status = err.status || err.statusCode || 500
ctx.body = { ctx.body = {
message: err.message, message: err.message,

View File

@ -4,8 +4,8 @@ const controller = require("../controllers/application")
const router = Router() const router = Router()
router router
.get("/api/:clientId/applications", controller.fetch) .get("/api/applications", controller.fetch)
.get("/api/:clientId/:applicationId/appPackage", controller.fetchAppPackage) .get("/api/:applicationId/appPackage", controller.fetchAppPackage)
.post("/api/:clientId/applications", controller.create) .post("/api/applications", controller.create)
module.exports = router module.exports = router

View File

@ -1,11 +1,15 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/client") const controller = require("../controllers/client")
const env = require("../../environment")
const router = Router() const router = Router()
router router.get("/api/client/id", controller.getClientId)
.get("/api/client/id", controller.getClientId)
.post("/api/clients", controller.create) if (env.NODE_ENV === "jest") {
.delete("/api/clients/:clientId", controller.destroy) router
.post("/api/client", controller.create)
.delete("/api/client", controller.destroy)
}
module.exports = router module.exports = router

View File

@ -4,7 +4,7 @@ const controller = require("../controllers/instance")
const router = Router() const router = Router()
router router
.post("/api/:clientId/:applicationId/instances", controller.create) .post("/api/:applicationId/instances", controller.create)
.delete("/api/instances/:instanceId", controller.destroy) .delete("/api/instances/:instanceId", controller.destroy)
module.exports = router module.exports = router

View File

@ -1,35 +1,32 @@
const supertest = require("supertest"); const {
const app = require("../../../app"); createClientDatabase,
const { createClientDatabase, destroyDatabase } = require("./couchTestUtils"); supertest
} = require("./couchTestUtils")
const CLIENT_DB_ID = "client-testing";
describe("/applications", () => { describe("/applications", () => {
let request; let request
let server; let server
beforeAll(async () => { beforeAll(async () => {
server = app; ({ request, server } = await supertest())
request = supertest(server); await createClientDatabase(request)
await createClientDatabase();
}); });
afterAll(async () => { afterAll(async () => {
server.close(); server.close()
await destroyDatabase(CLIENT_DB_ID)
}) })
describe("create", () => { describe("create", () => {
it("returns a success message when the application is successfully created", done => { it("returns a success message when the application is successfully created", done => {
request request
.post("/api/testing/applications") .post("/api/applications")
.send({ name: "My App" }) .send({ name: "My App" })
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.end((err, res) => { .end((err, res) => {
expect(res.body.message).toEqual("Application My App created successfully"); expect(res.res.statusMessage).toEqual("Application My App created successfully")
expect(res.body._id).toBeDefined()
done(); done();
}); });
}) })

View File

@ -1,58 +1,48 @@
const supertest = require("supertest"); const {
const app = require("../../../app"); createClientDatabase,
const { createClientDatabase, destroyClientDatabase } = require("./couchTestUtils") destroyClientDatabase,
supertest,
} = require("./couchTestUtils")
const CLIENT_ID = "test-client-id"
const CLIENT_DB_ID = "client-testing";
describe("/clients", () => { describe("/clients", () => {
let request; let request;
let server; let server;
let db;
beforeAll(async () => { beforeEach(async () => {
server = app ({ request, server } = await supertest())
request = supertest(server);
}); });
afterAll(async () => { afterEach(async () => {
server.close(); server.close();
}) })
describe("create", () => { describe("create", () => {
afterEach(async () => {
await destroyClientDatabase();
});
it("returns a success message when the client database is successfully created", done => { it("returns a success message when the client database is successfully created", async () => {
request const res = await request
.post("/api/clients") .post("/api/client")
.send({ clientId: "testing" }) .send({ clientId: "testing" })
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/)
.expect(200) .expect(200)
.end((err, res) => {
expect(res.body.message).toEqual(`Client Database ${CLIENT_DB_ID} successfully provisioned.`); expect(res.res.statusMessage).toEqual(`Client Database ${process.env.CLIENT_ID} successfully provisioned.`);
done(); })
}); });
})
});
describe("destroy", () => { describe("destroy", () => {
beforeEach(async () => { beforeEach(async () => {
db = await createClientDatabase(); db = await createClientDatabase(request);
}); });
it("returns a success message when the client database is successfully destroyed", async done => { it("returns a success message when the client database is successfully destroyed", async () => {
request const res = await request
.delete(`/api/clients/testing`) .delete(`/api/client`)
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/)
.expect(200) .expect(200)
.end((err, res) => { expect(res.res.statusMessage).toEqual(`Client Database ${process.env.CLIENT_ID} successfully deleted.`);
expect(res.body.message).toEqual(`Client Database ${CLIENT_DB_ID} successfully deleted.`);
done(); })
}); });
})
});
}); });

View File

@ -1,8 +1,34 @@
const CouchDB = require("../../../db") const CouchDB = require("../../../db")
const CLIENT_DB_ID = "client-testing" const supertest = require("supertest")
const TEST_APP_ID = "test-app" const app = require("../../../app")
exports.createModel = async (instanceId, model) => { exports.supertest = async () => {
let request
let port = 4002
let started = false
let server
while (!started && port < 4020) {
try {
server = await app(port)
started = true
} catch (e) {
if (e.code === "EADDRINUSE") port = port + 1
else throw e
}
}
if (!started) throw Error("Application failed to start")
request = supertest(server)
return { request, server }
}
exports.defaultHeaders = {
Accept: "application/json",
Authorization: "Basic test-admin-secret",
}
exports.createModel = async (request, instanceId, model) => {
model = model || { model = model || {
name: "TestModel", name: "TestModel",
type: "model", type: "model",
@ -11,72 +37,60 @@ exports.createModel = async (instanceId, model) => {
name: { type: "string" }, name: { type: "string" },
}, },
} }
const db = new CouchDB(instanceId)
const response = await db.post(model)
const designDoc = await db.get("_design/database") const res = await request
designDoc.views = { .post(`/api/${instanceId}/models`)
...designDoc.views, .set(exports.defaultHeaders)
[`all_${response.id}`]: { .send(model)
map: `function(doc) { return res.body
if (doc.modelId === "${response.id}") {
emit(doc[doc.key], doc._id);
}
}`,
},
}
await db.put(designDoc)
return {
...response,
...model,
}
} }
exports.createClientDatabase = async () => { exports.createClientDatabase = async request => {
const db = new CouchDB(CLIENT_DB_ID) const res = await request
.post("/api/client")
await db.put({ .set(exports.defaultHeaders)
_id: "_design/client", .send({})
views: { return res.body
by_type: {
map: function(doc) {
emit([doc.type], doc._id)
},
}.toString(),
},
})
await db.put({
_id: TEST_APP_ID,
type: "app",
instances: [],
})
return db
} }
exports.destroyClientDatabase = async () => new CouchDB(CLIENT_DB_ID).destroy() exports.createApplication = async (request, name = "test_application") => {
const res = await request
.post("/api/applications")
.set(exports.defaultHeaders)
.send({
name,
})
return res.body
}
exports.createInstanceDatabase = async instanceId => { exports.destroyClientDatabase = async request => {
const db = new CouchDB(instanceId) await request
.delete(`/api/client`)
.set(exports.defaultHeaders)
.send({})
}
await db.put({ exports.createInstance = async (request, appId) => {
_id: "_design/database", const res = await request
metadata: { .post(`/api/${appId}/instances`)
clientId: CLIENT_DB_ID, .set(exports.defaultHeaders)
applicationId: TEST_APP_ID, .send({
}, name: "test-instance",
views: { })
by_type: { return res.body
map: function(doc) { }
emit([doc.type], doc._id)
}.toString(),
},
},
})
return db exports.createUser = async (
request,
instanceId,
username = "bill",
password = "bills_password"
) => {
const res = await request
.post(`/api/${instanceId}/users`)
.set(exports.defaultHeaders)
.send({ name: "Bill", username, password })
return res.body
} }
exports.insertDocument = async (databaseId, document) => { exports.insertDocument = async (databaseId, document) => {

View File

@ -1,22 +1,19 @@
const supertest = require("supertest");
const app = require("../../../app");
const { const {
createInstanceDatabase, createInstance,
createClientDatabase, createClientDatabase,
destroyClientDatabase createApplication,
supertest,
defaultHeaders
} = require("./couchTestUtils"); } = require("./couchTestUtils");
const TEST_INSTANCE_ID = "testing-123";
const TEST_APP_ID = "test-app";
describe("/instances", () => { describe("/instances", () => {
let request; let TEST_APP_ID;
let server; let server
let request
beforeAll(async () => { beforeAll(async () => {
server = app ({ request, server } = await supertest())
request = supertest(server); await createClientDatabase(request);
TEST_APP_ID = (await createApplication(request))._id
}); });
afterAll(async () => { afterAll(async () => {
@ -25,48 +22,30 @@ describe("/instances", () => {
describe("create", () => { describe("create", () => {
beforeEach(async () => { it("returns a success message when the instance database is successfully created", async () => {
clientDb = await createClientDatabase(); const res = await request
}); .post(`/api/${TEST_APP_ID}/instances`)
.send({ name: "test-instance" })
afterEach(async () => { .set(defaultHeaders)
await destroyClientDatabase();
});
it("returns a success message when the instance database is successfully created", done => {
request
.post(`/api/testing/${TEST_APP_ID}/instances`)
.send({ name: TEST_INSTANCE_ID })
.set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (err, res) => {
expect(res.body.message).toEqual("Instance Database testing-123 successfully provisioned."); expect(res.res.statusMessage).toEqual("Instance Database test-instance successfully provisioned.");
done(); expect(res.body._id).toBeDefined();
});
}) })
}); });
describe("destroy", () => { describe("destroy", () => {
beforeEach(async () => {
await createClientDatabase();
instanceDb = await createInstanceDatabase(TEST_INSTANCE_ID);
});
afterEach(async () => { it("returns a success message when the instance database is successfully deleted", async () => {
await destroyClientDatabase(); const instance = await createInstance(request, TEST_APP_ID);
}); const res = await request
.delete(`/api/instances/${instance._id}`)
it("returns a success message when the instance database is successfully deleted", done => { .set(defaultHeaders)
request
.delete(`/api/instances/${TEST_INSTANCE_ID}`)
.set("Accept", "application/json")
.expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (err, res) => {
expect(res.body.message).toEqual("Instance Database testing-123 successfully destroyed."); expect(res.res.statusMessage).toEqual(`Instance Database ${instance._id} successfully destroyed.`);
done(); })
}); });
})
});
}); });

View File

@ -1,17 +1,21 @@
const supertest = require("supertest"); const {
const app = require("../../../app"); createInstance,
const { createInstanceDatabase, createModel } = require("./couchTestUtils"); createModel,
supertest,
createClientDatabase,
const TEST_INSTANCE_ID = "testing-123"; createApplication
} = require("./couchTestUtils")
describe("/models", () => { describe("/models", () => {
let request; let request
let server; let server
let app
let instance
beforeAll(async () => { beforeAll(async () => {
server = app; ({ request, server } = await supertest())
request = supertest(server); await createClientDatabase(request)
app = await createApplication(request)
}); });
afterAll(async () => { afterAll(async () => {
@ -19,19 +23,14 @@ describe("/models", () => {
}) })
describe("create", () => { describe("create", () => {
let db;
beforeEach(async () => { beforeEach(async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID); instance = await createInstance(request, app._id);
});
afterEach(async () => {
await db.destroy();
}); });
it("returns a success message when the model is successfully created", done => { it("returns a success message when the model is successfully created", done => {
request request
.post(`/api/${TEST_INSTANCE_ID}/models`) .post(`/api/${instance._id}/models`)
.send({ .send({
name: "TestModel", name: "TestModel",
key: "name", key: "name",
@ -43,29 +42,24 @@ describe("/models", () => {
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (err, res) => { .end(async (err, res) => {
expect(res.body.message).toEqual("Model TestModel created successfully."); expect(res.res.statusMessage).toEqual("Model TestModel created successfully.");
expect(res.body.model.name).toEqual("TestModel"); expect(res.body.name).toEqual("TestModel");
done(); done();
}); });
}) })
}); });
describe("fetch", () => { describe("fetch", () => {
let testModel; let testModel
let db;
beforeEach(async () => { beforeEach(async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID); instance = await createInstance(request, app._id)
testModel = await createModel(TEST_INSTANCE_ID); testModel = await createModel(request, instance._id, testModel)
});
afterEach(async () => {
await db.destroy();
}); });
it("returns all the models for that instance in the response body", done => { it("returns all the models for that instance in the response body", done => {
request request
.get(`/api/${TEST_INSTANCE_ID}/models`) .get(`/api/${instance._id}/models`)
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
@ -80,25 +74,20 @@ describe("/models", () => {
describe("destroy", () => { describe("destroy", () => {
let testModel; let testModel;
let db;
beforeEach(async () => { beforeEach(async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID); instance = await createInstance(request, app._id)
testModel = await createModel(TEST_INSTANCE_ID); testModel = await createModel(request, instance._id, testModel)
});
afterEach(async () => {
await db.destroy();
}); });
it("returns a success response when a model is deleted.", done => { it("returns a success response when a model is deleted.", done => {
request request
.delete(`/api/${TEST_INSTANCE_ID}/models/${testModel.id}/${testModel.rev}`) .delete(`/api/${instance._id}/models/${testModel._id}/${testModel._rev}`)
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (_, res) => { .end(async (_, res) => {
expect(res.body.message).toEqual(`Model ${testModel.id} deleted.`); expect(res.res.statusMessage).toEqual(`Model ${testModel._id} deleted.`);
done(); done();
}); });
}) })

View File

@ -1,27 +1,23 @@
const supertest = require("supertest"); const {
const app = require("../../../app"); createApplication,
const { createInstanceDatabase, createModel } = require("./couchTestUtils"); createClientDatabase,
createInstance,
const TEST_INSTANCE_ID = "testing-123"; createModel,
supertest
const CONTACT_MODEL = { } = require("./couchTestUtils");
"name": "Contact",
"type": "model",
"key": "name",
"schema": {
"name": { "type": "string" },
"age": { "type": "number" }
}
};
describe("/records", () => { describe("/records", () => {
let request; let request
let server; let server
let db; let instance
let model
let record
let app
beforeAll(async () => { beforeAll(async () => {
server = app; ({ request, server } = await supertest())
request = supertest(server); await createClientDatabase(request)
app = await createApplication(request)
}); });
afterAll(async () => { afterAll(async () => {
@ -29,95 +25,94 @@ describe("/records", () => {
}) })
describe("save, load, update, delete", () => { describe("save, load, update, delete", () => {
let record;
let model;
beforeEach(async () => { beforeEach(async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID); instance = await createInstance(request, app._id)
model = await createModel(TEST_INSTANCE_ID, CONTACT_MODEL) model = await createModel(request, instance._id)
record = { record = {
name: "Test Contact", name: "Test Contact",
status: "new", status: "new",
modelId: model.id modelId: model._id
} }
}); })
afterEach(async () => { const createRecord = async r =>
await db.destroy(); await request
}); .post(`/api/${instance._id}/records`)
.send(r || record)
it("returns a success message when the record is created", done => {
request
.post(`/api/${TEST_INSTANCE_ID}/records`)
.send(record)
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (err, res) => {
expect(res.res.statusMessage).toEqual("Contact created successfully") it("returns a success message when the record is created", async () => {
expect(res.body.name).toEqual("Test Contact") const res = await createRecord()
expect(res.body._rev).toBeDefined() expect(res.res.statusMessage).toEqual(`${model.name} created successfully`)
done(); expect(res.body.name).toEqual("Test Contact")
}); expect(res.body._rev).toBeDefined()
}) })
it("updates a record successfully", async () => { it("updates a record successfully", async () => {
const existing = await db.post(record); const rec = await createRecord()
const existing = rec.body
const res = await request const res = await request
.post(`/api/${TEST_INSTANCE_ID}/records`) .post(`/api/${instance._id}/records`)
.send({ .send({
_id: existing.id, _id: existing._id,
_rev: existing.rev, _rev: existing._rev,
modelId: model.id, modelId: model._id,
name: "Updated Name", name: "Updated Name",
}) })
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
expect(res.body.message).toEqual("Contact updated successfully.") expect(res.res.statusMessage).toEqual(`${model.name} updated successfully.`)
expect(res.body.record.name).toEqual("Updated Name") expect(res.body.name).toEqual("Updated Name")
}) })
it("should load a record", async () => { it("should load a record", async () => {
const existing = await db.post(record); const rec = await createRecord()
const existing = rec.body
const res = await request const res = await request
.get(`/api/${TEST_INSTANCE_ID}/records/${existing.id}`) .get(`/api/${instance._id}/records/${existing._id}`)
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
expect(res.body).toEqual({ expect(res.body).toEqual({
...record, ...record,
_id: existing.id, _id: existing._id,
_rev: existing.rev _rev: existing._rev,
type: "record",
}) })
}) })
it("should list all records for given modelId", async () => { it("should list all records for given modelId", async () => {
const newRecord = { const newRecord = {
modelId: model.id, modelId: model._id,
name: "Second Contact", name: "Second Contact",
status: "new" status: "new"
} }
await createRecord()
await db.post(newRecord); await createRecord(newRecord)
const res = await request const res = await request
.get(`/api/${TEST_INSTANCE_ID}/all_${newRecord.modelId}/records`) .get(`/api/${instance._id}/all_${newRecord.modelId}/records`)
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
expect(res.body.length).toBe(1) expect(res.body.length).toBe(2)
expect(res.body[0].name).toEqual(newRecord.name); expect(res.body.find(r => r.name === newRecord.name)).toBeDefined()
expect(res.body.find(r => r.name === record.name)).toBeDefined()
}) })
it("load should return 404 when record does not exist", async () => { it("load should return 404 when record does not exist", async () => {
await createRecord()
await request await request
.get(`/api/${TEST_INSTANCE_ID}/records/not-a-valid-id`) .get(`/api/${instance._id}/records/not-a-valid-id`)
.set("Accept", "application/json") .set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(404) .expect(404)

View File

@ -1,75 +1,62 @@
const supertest = require("supertest");
const app = require("../../../app");
const { const {
createInstanceDatabase createClientDatabase,
} = require("./couchTestUtils"); createApplication,
createInstance,
supertest,
const TEST_INSTANCE_ID = "testing-123"; defaultHeaders,
const TEST_USER = { createUser,
name: "Dave" } = require("./couchTestUtils")
}
describe("/users", () => { describe("/users", () => {
let request; let request
let server; let server
let app
let instance
beforeAll(async () => { beforeAll(async () => {
server = app ({ request, server } = await supertest(server))
request = supertest(server); await createClientDatabase(request)
app = await createApplication(request)
});
beforeEach(async () => {
instance = await createInstance(request, app._id)
}); });
afterAll(async () => { afterAll(async () => {
server.close(); server.close();
}) })
describe("fetch", () => { describe("fetch", () => {
let db;
beforeEach(async () => { it("returns a list of users from an instance db", async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID); await createUser(request, instance._id, "brenda", "brendas_password")
}); await createUser(request, instance._id, "pam", "pam_password")
const res = await request
afterEach(async () => { .get(`/api/${instance._id}/users`)
await db.destroy(); .set(defaultHeaders)
});
it("returns a list of users from an instance db", done => {
request
.get(`/api/${TEST_INSTANCE_ID}/users`)
.set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (err, res) => {
const user = res.body[0]; expect(res.body.length).toBe(2)
expect(user.name).toEqual(TEST_USER.name); expect(res.body.find(u => u.username === "brenda")).toBeDefined()
done(); expect(res.body.find(u => u.username === "pam")).toBeDefined()
}); })
})
}); })
describe("create", () => { describe("create", () => {
let db;
beforeEach(async () => { it("returns a success message when a user is successfully created", async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID); const res = await request
}); .post(`/api/${instance._id}/users`)
.set(defaultHeaders)
afterEach(async () => { .send({ name: "Bill", username: "bill", password: "bills_password" })
await db.destroy();
});
it("returns a success message when a user is successfully created", done => {
request
.post(`/api/${TEST_INSTANCE_ID}/users`)
.send({ name: "Bill", username: "bill1", password: "password" })
.set("Accept", "application/json")
.expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (err, res) => { .expect('Content-Type', /json/)
expect(res.body.message).toEqual("User created successfully.");
done(); expect(res.res.statusMessage).toEqual("User created successfully.");
}); expect(res.body._id).toBeUndefined()
}) })
}); });
}); })

View File

@ -1,78 +1,73 @@
const supertest = require("supertest"); const {
const app = require("../../../app"); createClientDatabase,
const { createInstanceDatabase, createModel, destroyDatabase } = require("./couchTestUtils"); createApplication,
createInstance,
createModel,
const TEST_INSTANCE_ID = "testing-123"; supertest,
defaultHeaders
} = require("./couchTestUtils")
describe("/views", () => { describe("/views", () => {
let request; let request
let server; let server
let db; let app
let instance
let model
beforeAll(async () => { beforeAll(async () => {
server = app; ({ request, server } = await supertest())
request = supertest(server); await createClientDatabase(request)
}); app = await createApplication(request)
afterAll(async () => {
server.close();
}) })
beforeEach(async () => {
instance = await createInstance(request, app._id)
})
afterAll(async () => {
server.close()
})
const createView = async () =>
await request
.post(`/api/${instance._id}/views`)
.send({
name: "TestView",
map: `function(doc) {
if (doc.id) {
emit(doc.name, doc._id);
}
}`,
reduce: `function(keys, values) { }`
})
.set(defaultHeaders)
.expect('Content-Type', /json/)
.expect(200)
describe("create", () => { describe("create", () => {
beforeEach(async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID);
});
afterEach(async () => { it("returns a success message when the view is successfully created", async () => {
db && await db.destroy(); const res = await createView()
}); expect(res.res.statusMessage).toEqual("View TestView created successfully.");
expect(res.body.name).toEqual("TestView");
it("returns a success message when the view is successfully created", done => { })
request });
.post(`/api/${TEST_INSTANCE_ID}/views`)
.send({
name: "TestView",
map: `function(doc) {
if (doc.id) {
emit(doc.name, doc._id);
}
}`,
reduce: `function(keys, values) { }`
})
.set("Accept", "application/json")
.expect('Content-Type', /json/)
.expect(200)
.end(async (err, res) => {
expect(res.body.message).toEqual("View TestView created successfully.");
expect(res.body.id).toEqual("_design/database");
done();
});
})
});
describe("fetch", () => { describe("fetch", () => {
let db;
beforeEach(async () => { beforeEach(async () => {
db = await createInstanceDatabase(TEST_INSTANCE_ID); model = await createModel(request, instance._id);
await createModel(TEST_INSTANCE_ID);
}); });
afterEach(async () => { it("should only return custom views", async () => {
await db.destroy(); const view = await createView()
}); const res = await request
.get(`/api/${instance._id}/views`)
it("returns a list of all the views that exist in the instance database", done => { .set(defaultHeaders)
request
.get(`/api/${TEST_INSTANCE_ID}/views`)
.set("Accept", "application/json")
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200) .expect(200)
.end(async (_, res) => { expect(res.body.length).toBe(1)
expect(res.body.by_type).toBeDefined(); expect(res.body.find(v => v.name === view.body.name)).toBeDefined()
done(); })
}); });
})
});
}); });

View File

@ -5,7 +5,8 @@ const router = Router()
router router
.get("/api/:instanceId/users", controller.fetch) .get("/api/:instanceId/users", controller.fetch)
.post("/api/:appId/:instanceId/users", controller.create) .get("/api/:instanceId/users/:username", controller.find)
.delete("/api/:instanceId/users/:userId", controller.destroy) .post("/api/:instanceId/users", controller.create)
.delete("/api/:instanceId/users/:username", controller.destroy)
module.exports = router module.exports = router

View File

@ -2,14 +2,29 @@ const Koa = require("koa")
const logger = require("koa-logger") const logger = require("koa-logger")
const api = require("./api") const api = require("./api")
const koaBody = require("koa-body") const koaBody = require("koa-body")
const env = require("./environment")
const http = require("http")
const app = new Koa() const app = new Koa()
// set up top level koa middleware // set up top level koa middleware
app.use(koaBody({ multipart: true })) app.use(koaBody({ multipart: true }))
app.use(logger())
if (env.LOGGER !== "off") app.use(logger())
// api routes // api routes
app.use(api.routes()) app.use(api.routes())
module.exports = app.listen(process.env.PORT || 4001) module.exports = async port => {
const server = http.createServer(app.callback())
return new Promise((resolve, reject) => {
server.on("error", e => {
if (e.code === "EADDRINUSE") {
reject(e)
}
})
server.listen({ port }, () => {
resolve(server)
})
})
}

View File

@ -1,11 +1,16 @@
const PouchDB = require("pouchdb") const PouchDB = require("pouchdb")
const allDbs = require("pouchdb-all-dbs") const allDbs = require("pouchdb-all-dbs")
const { budibaseAppsDir } = require("../utilities/budibaseDir") const { budibaseAppsDir } = require("../utilities/budibaseDir")
const env = require("../environment")
const COUCH_DB_URL = process.env.COUCH_DB_URL || `leveldb://${budibaseAppsDir()}/` const COUCH_DB_URL = env.COUCH_DB_URL || `leveldb://${budibaseAppsDir()}/`
const isInMemory = env.NODE_ENV === "jest"
if (isInMemory) PouchDB.plugin(require("pouchdb-adapter-memory"))
const Pouch = PouchDB.defaults({ const Pouch = PouchDB.defaults({
prefix: COUCH_DB_URL, prefix: isInMemory ? undefined : COUCH_DB_URL,
adapter: isInMemory ? "memory" : undefined,
}) })
allDbs(Pouch) allDbs(Pouch)

View File

@ -0,0 +1,22 @@
const CouchDB = require("./client")
exports.create = async clientId => {
const dbId = `client-${clientId}`
const db = new CouchDB(dbId)
await db.put({
_id: "_design/client",
views: {
by_type: {
map: `function(doc) {
emit([doc.type], doc._id)
}`,
},
},
})
return db
}
exports.destroy = async function(clientId) {
const dbId = `client-${clientId}`
await new CouchDB(dbId).destroy()
}

View File

@ -1,13 +0,0 @@
module.exports = async db => {
const doc = await db.put({
_id: "_design/client",
views: {
by_type: {
map: `function(doc) {
emit([doc.type], doc._id)
}`,
},
},
})
console.log(doc)
}

View File

@ -0,0 +1,11 @@
module.exports = {
CLIENT_ID: process.env.CLIENT_ID,
NODE_ENV: process.env.NODE_ENV,
JWT_SECRET: process.env.JWT_SECRET,
BUDIBASE_DIR: process.env.BUDIBASE_DIR,
ADMIN_SECRET: process.env.ADMIN_SECRET,
PORT: process.env.PORT,
COUCH_DB_URL: process.env.COUCH_DB_URL,
SALT_ROUNDS: process.env.SALT_ROUNDS,
LOGGER: process.env.LOGGER,
}

View File

@ -1,10 +1,17 @@
const jwt = require("jsonwebtoken") const jwt = require("jsonwebtoken")
const STATUS_CODES = require("../utilities/statusCodes"); const STATUS_CODES = require("../utilities/statusCodes")
const env = require("../environment")
module.exports = async (ctx, next) => { module.exports = async (ctx, next) => {
if (ctx.isDev) { const authHeader = ctx.get("Authorization")
if (
authHeader &&
authHeader.startsWith("Basic") &&
authHeader.split(" ")[1] === env.ADMIN_SECRET
) {
ctx.isAuthenticated = true ctx.isAuthenticated = true
await next(); await next()
return return
} }

View File

@ -1,6 +1,7 @@
const bcrypt = require("bcryptjs") const bcrypt = require("bcryptjs")
const env = require("../environment")
const SALT_ROUNDS = process.env.SALT_ROUNDS || 10 const SALT_ROUNDS = env.SALT_ROUNDS || 10
exports.hash = async data => { exports.hash = async data => {
const salt = await bcrypt.genSalt(SALT_ROUNDS) const salt = await bcrypt.genSalt(SALT_ROUNDS)

View File

@ -1,8 +1,9 @@
const { join } = require("path") const { join } = require("path")
const { homedir, tmpdir } = require("os") const { homedir, tmpdir } = require("os")
const env = require("../environment")
module.exports.budibaseAppsDir = function() { module.exports.budibaseAppsDir = function() {
return process.env.BUDIBASE_DIR || join(homedir(), ".budibase") return env.BUDIBASE_DIR || join(homedir(), ".budibase")
} }
module.exports.budibaseTempDir = function() { module.exports.budibaseTempDir = function() {

View File

@ -9,6 +9,7 @@ const {
rmdir, rmdir,
} = require("fs-extra") } = require("fs-extra")
const { join, dirname, resolve } = require("path") const { join, dirname, resolve } = require("path")
const env = require("../../environment")
const buildPage = require("./buildPage") const buildPage = require("./buildPage")
const getPages = require("./getPages") const getPages = require("./getPages")
@ -31,7 +32,7 @@ module.exports.getPackageForBuilder = async (config, application) => {
application, application,
clientId: process.env.CLIENT_ID, clientId: env.CLIENT_ID,
} }
} }

View File

@ -194,6 +194,20 @@
lodash "^4.17.13" lodash "^4.17.13"
to-fast-properties "^2.0.0" 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": "@budibase/core@^0.0.32":
version "0.0.32" version "0.0.32"
resolved "https://registry.yarnpkg.com/@budibase/core/-/core-0.0.32.tgz#c5d9ab869c5e9596a1ac337aaf041e795b1cc7fa" resolved "https://registry.yarnpkg.com/@budibase/core/-/core-0.0.32.tgz#c5d9ab869c5e9596a1ac337aaf041e795b1cc7fa"
@ -550,6 +564,13 @@ abort-controller@3.0.0:
dependencies: dependencies:
event-target-shim "^5.0.0" event-target-shim "^5.0.0"
abstract-leveldown@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.4.1.tgz#b3bfedb884eb693a12775f0c55e9f0a420ccee64"
integrity sha1-s7/tuITraToSd18MVenwpCDM7mQ=
dependencies:
xtend "~4.0.0"
abstract-leveldown@^6.2.1: abstract-leveldown@^6.2.1:
version "6.3.0" version "6.3.0"
resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a"
@ -791,6 +812,11 @@ array-equal@^1.0.0:
resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93"
integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= 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: array-unique@^0.3.2:
version "0.3.2" version "0.3.2"
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
@ -858,6 +884,13 @@ atob@^2.1.2:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== 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: aws-sign2@~0.7.0:
version "0.7.0" version "0.7.0"
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
@ -1558,6 +1591,26 @@ decompress-response@^3.3.0:
dependencies: dependencies:
mimic-response "^1.0.0" 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: deep-equal@~1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"
@ -1862,7 +1915,7 @@ error-inject@^1.0.0:
resolved "https://registry.yarnpkg.com/error-inject/-/error-inject-1.0.0.tgz#e2b3d91b54aed672f309d950d154850fa11d4f37" resolved "https://registry.yarnpkg.com/error-inject/-/error-inject-1.0.0.tgz#e2b3d91b54aed672f309d950d154850fa11d4f37"
integrity sha1-4rPZG1Su1nLzCdlQ0VSFD6EdTzc= integrity sha1-4rPZG1Su1nLzCdlQ0VSFD6EdTzc=
es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5: es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.4, es-abstract@^1.17.5:
version "1.17.5" version "1.17.5"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9"
integrity sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg== integrity sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==
@ -1879,6 +1932,19 @@ es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5:
string.prototype.trimleft "^2.1.1" string.prototype.trimleft "^2.1.1"
string.prototype.trimright "^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: es-to-primitive@^1.2.1:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a"
@ -2847,11 +2913,21 @@ is-accessor-descriptor@^1.0.0:
dependencies: dependencies:
kind-of "^6.0.0" 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: is-arrayish@^0.2.1:
version "0.2.1" version "0.2.1"
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= 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: is-binary-path@~2.1.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
@ -2859,6 +2935,11 @@ is-binary-path@~2.1.0:
dependencies: dependencies:
binary-extensions "^2.0.0" 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: is-buffer@^1.1.5:
version "1.1.6" version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
@ -2895,7 +2976,7 @@ is-data-descriptor@^1.0.0:
dependencies: dependencies:
kind-of "^6.0.0" kind-of "^6.0.0"
is-date-object@^1.0.1: is-date-object@^1.0.1, is-date-object@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e"
integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==
@ -2970,11 +3051,21 @@ is-installed-globally@^0.3.1:
global-dirs "^2.0.1" global-dirs "^2.0.1"
is-path-inside "^3.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: is-npm@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d"
integrity sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig== 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: is-number@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195"
@ -3011,11 +3102,21 @@ is-regex@^1.0.5:
dependencies: dependencies:
has "^1.0.3" 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: is-stream@^1.1.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= 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: is-symbol@^1.0.2:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937"
@ -3032,11 +3133,31 @@ is-type-of@^1.0.0:
is-class-hotfix "~0.0.6" is-class-hotfix "~0.0.6"
isstream "~0.1.2" 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: is-typedarray@^1.0.0, is-typedarray@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= 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: is-windows@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
@ -3062,6 +3183,11 @@ isarray@1.0.0, isarray@~1.0.0:
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= 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==
isbinaryfile@^4.0.6: isbinaryfile@^4.0.6:
version "4.0.6" version "4.0.6"
resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.6.tgz#edcb62b224e2b4710830b67498c8e4e5a4d2610b" resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.6.tgz#edcb62b224e2b4710830b67498c8e4e5a4d2610b"
@ -4071,6 +4197,11 @@ ltgt@2.2.1, ltgt@^2.1.2:
resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5"
integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=
ltgt@~2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.1.3.tgz#10851a06d9964b971178441c23c9e52698eece34"
integrity sha1-EIUaBtmWS5cReEQcI8nlJpjuzjQ=
lunr@^2.3.5: lunr@^2.3.5:
version "2.3.8" version "2.3.8"
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.8.tgz#a8b89c31f30b5a044b97d2d28e2da191b6ba2072" resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.8.tgz#a8b89c31f30b5a044b97d2d28e2da191b6ba2072"
@ -4122,6 +4253,17 @@ media-typer@0.3.0:
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
memdown@1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/memdown/-/memdown-1.2.4.tgz#cd9a34aaf074d53445a271108eb4b8dd4ec0f27f"
integrity sha1-zZo0qvB01TRFonEQjrS43U7A8n8=
dependencies:
abstract-leveldown "2.4.1"
functional-red-black-tree "^1.0.1"
immediate "^3.2.3"
inherits "~2.0.1"
ltgt "~2.1.3"
merge-stream@^2.0.0: merge-stream@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
@ -4421,6 +4563,14 @@ object-inspect@^1.7.0:
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67"
integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== 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: object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.0.6, object-keys@^1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
@ -4687,6 +4837,47 @@ posix-character-classes@^0.1.0:
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
pouchdb-adapter-leveldb-core@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-adapter-leveldb-core/-/pouchdb-adapter-leveldb-core-7.2.1.tgz#71bf2a05755689e2b05e78e796003a18ebf65a69"
integrity sha512-kwNsaM1pYDVz6LG9z2/7Tfcuw5iZJ5u8IqzjxMAGCfurScMaF4e7IJnVWqAceWSiaCrp91DbCULhrl4SH8iTDg==
dependencies:
argsarray "0.0.1"
buffer-from "1.1.0"
double-ended-queue "2.1.0-0"
levelup "4.1.0"
pouchdb-adapter-utils "7.2.1"
pouchdb-binary-utils "7.2.1"
pouchdb-collections "7.2.1"
pouchdb-errors "7.2.1"
pouchdb-json "7.2.1"
pouchdb-md5 "7.2.1"
pouchdb-merge "7.2.1"
pouchdb-utils "7.2.1"
sublevel-pouchdb "7.2.1"
through2 "3.0.1"
pouchdb-adapter-memory@^7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-adapter-memory/-/pouchdb-adapter-memory-7.2.1.tgz#70341b54093b6bda3ab6e78482c8d00b906178e9"
integrity sha512-W4+9+xol95NIdDlk2KVxhv81QWRx/P4L9CPGdh7nqGtzuhVbvqMEqZN24XauIoBaaDy1LLkCyXMvChNt3GHBRQ==
dependencies:
memdown "1.2.4"
pouchdb-adapter-leveldb-core "7.2.1"
pouchdb-utils "7.2.1"
pouchdb-adapter-utils@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-adapter-utils/-/pouchdb-adapter-utils-7.2.1.tgz#d2583bc5c6bfcd6cf0d20acd54cb51683a196d37"
integrity sha512-asMAhH6mJRgz6JFEvaS/gMcfWR9pCM+DLPzzIN5vSAm8jUEaMApCONx86xhBwVgzAJ8aVzrG11J9D5iJlM7LSQ==
dependencies:
pouchdb-binary-utils "7.2.1"
pouchdb-collections "7.2.1"
pouchdb-errors "7.2.1"
pouchdb-md5 "7.2.1"
pouchdb-merge "7.2.1"
pouchdb-utils "7.2.1"
pouchdb-all-dbs@^1.0.2: pouchdb-all-dbs@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/pouchdb-all-dbs/-/pouchdb-all-dbs-1.0.2.tgz#8fa1aa4b01665e00e0da9c61bf6dbb99eca05d3c" resolved "https://registry.yarnpkg.com/pouchdb-all-dbs/-/pouchdb-all-dbs-1.0.2.tgz#8fa1aa4b01665e00e0da9c61bf6dbb99eca05d3c"
@ -4698,6 +4889,45 @@ pouchdb-all-dbs@^1.0.2:
pouchdb-promise "5.4.3" pouchdb-promise "5.4.3"
tiny-queue "^0.2.0" tiny-queue "^0.2.0"
pouchdb-binary-utils@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-binary-utils/-/pouchdb-binary-utils-7.2.1.tgz#ad23ed63d09699e7e6244f846b5cf07c6d9d4b8b"
integrity sha512-kbzOOYti/3d8s2bQY5EfJVd7c9E84q4oEpr1M8fOOHKnINZFteKkZQywD4roblUnew0Obyhvozif4LAr3CMZFg==
dependencies:
buffer-from "1.1.0"
pouchdb-collections@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-collections/-/pouchdb-collections-7.2.1.tgz#768c2c578b22eda9ac0c92a4b1106d18f3c113fb"
integrity sha512-cqe3GY3wDq2j59tnh+5ZV0bZj1O+YWiBz4qM7HEcgrEXnc29ADvXXPp71tmcpZUCR39bzLKyYtadAQu7FpOeOA==
pouchdb-errors@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-errors/-/pouchdb-errors-7.2.1.tgz#798f5279a0d363d6b93c97a1b65ee903f61af143"
integrity sha512-/tBP+eWY6a62UoZnJ6JJlNmbNpNS5FgVimkqwLMrFQkXpbJlhshYDeJ5PHR0W3Rlfc54GMZC7m4KhJt9kG/CkA==
dependencies:
inherits "2.0.4"
pouchdb-json@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-json/-/pouchdb-json-7.2.1.tgz#41836bdffed1d1b6207793f0b26bf771105c0c61"
integrity sha512-YGRX/qDl+iEX2vz23kzBtMoH0hpb9xASKnEGZPH76BTDq4RQ+eUOxyXU9E1fPdQhsq8+0pcEQN7VCnFEdQ7MUQ==
dependencies:
vuvuzela "1.0.3"
pouchdb-md5@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-md5/-/pouchdb-md5-7.2.1.tgz#2b057b148b3f31491d77c4dd6b6139af31b07f66"
integrity sha512-TJqGtNguctPiSai5b4+oTPi9oOcxSbNolkUtxRBxklf8kw+PNsDUi1H0DIFmA57n0qHCU19PXdbEVYlUhv/PAA==
dependencies:
pouchdb-binary-utils "7.2.1"
spark-md5 "3.0.0"
pouchdb-merge@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-merge/-/pouchdb-merge-7.2.1.tgz#d9301a4e92ccb14347ef8cc6a01caa63e3950fcd"
integrity sha512-TgxXPw1sZERwihoWSzLIdvn5MP1YKhYNaB0UuvYjboK+WUpCLh5WEeNTJi6WwUD9Yoc66QxP9D3qmfNEjd1BHQ==
pouchdb-promise@5.4.3: pouchdb-promise@5.4.3:
version "5.4.3" version "5.4.3"
resolved "https://registry.yarnpkg.com/pouchdb-promise/-/pouchdb-promise-5.4.3.tgz#331d670b1989d5a03f268811214f27f54150cb2b" resolved "https://registry.yarnpkg.com/pouchdb-promise/-/pouchdb-promise-5.4.3.tgz#331d670b1989d5a03f268811214f27f54150cb2b"
@ -4705,6 +4935,20 @@ pouchdb-promise@5.4.3:
dependencies: dependencies:
lie "3.0.4" lie "3.0.4"
pouchdb-utils@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb-utils/-/pouchdb-utils-7.2.1.tgz#5dec1c53c8ecba717e5762311e9a1def2d4ebf9c"
integrity sha512-ZInfRpKtJ2HwLz2Dv3NEona9khvGud0rWzvQGwUs1zoaOoSB5XxK3ui5s5fLpBrONgz0WcTB49msOUq4oAUzFg==
dependencies:
argsarray "0.0.1"
clone-buffer "1.0.0"
immediate "3.0.6"
inherits "2.0.4"
pouchdb-collections "7.2.1"
pouchdb-errors "7.2.1"
pouchdb-md5 "7.2.1"
uuid "3.3.3"
pouchdb@^7.2.1: pouchdb@^7.2.1:
version "7.2.1" version "7.2.1"
resolved "https://registry.yarnpkg.com/pouchdb/-/pouchdb-7.2.1.tgz#619e3d5c2463ddd94a4b1bf40d44408c46e9de79" resolved "https://registry.yarnpkg.com/pouchdb/-/pouchdb-7.2.1.tgz#619e3d5c2463ddd94a4b1bf40d44408c46e9de79"
@ -4971,6 +5215,19 @@ regex-not@^1.0.0, regex-not@^1.0.2:
extend-shallow "^3.0.2" extend-shallow "^3.0.2"
safe-regex "^1.1.0" 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==
regexpp@^2.0.1: regexpp@^2.0.1:
version "2.0.1" version "2.0.1"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f"
@ -5299,6 +5556,14 @@ shortid@^2.2.8:
dependencies: dependencies:
nanoid "^2.1.0" 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: signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
@ -5630,6 +5895,16 @@ strip-json-comments@~2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
sublevel-pouchdb@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/sublevel-pouchdb/-/sublevel-pouchdb-7.2.1.tgz#ce3ec06c91ee5afb5ab1bb7abbb905fd4dcc8c38"
integrity sha512-pliYcLDubhpe8ONw3P09CehULjuNopl6ybj6N0YudOg+FidqEYgJUgN/1n7ZqVrcXCDHws9g6lN1srlQta5/XQ==
dependencies:
inherits "2.0.4"
level-codec "9.0.1"
ltgt "2.2.1"
readable-stream "1.0.33"
sumchecker@^3.0.1: sumchecker@^3.0.1:
version "3.0.1" version "3.0.1"
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-3.0.1.tgz#6377e996795abb0b6d348e9b3e1dfb24345a8e42" resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-3.0.1.tgz#6377e996795abb0b6d348e9b3e1dfb24345a8e42"
@ -5682,6 +5957,11 @@ supports-color@^7.1.0:
dependencies: dependencies:
has-flag "^4.0.0" 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: symbol-tree@^3.2.2:
version "3.2.4" version "3.2.4"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
@ -6157,11 +6437,44 @@ whatwg-url@^7.0.0:
tr46 "^1.0.1" tr46 "^1.0.1"
webidl-conversions "^4.0.2" 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: which-module@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= 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: which@^1.2.9, which@^1.3.0:
version "1.3.1" version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"