diff --git a/packages/auth/src/db/Replication.js b/packages/auth/src/db/Replication.js
index 3a4f71a78e..9720776413 100644
--- a/packages/auth/src/db/Replication.js
+++ b/packages/auth/src/db/Replication.js
@@ -11,47 +11,9 @@ class Replication {
this.target = getDB(target)
}
- sync(opts) {
- return new Promise((resolve, reject) => {
- this.source
- .sync(this.target, opts)
- .on("change", function (info) {
- // handle change
- })
- .on("paused", function (err) {
- // replication paused (e.g. replication up to date, user went offline)
- })
- .on("active", function () {
- // replicate resumed (e.g. new changes replicating, user went back online)
- })
- .on("denied", function (err) {
- // a document failed to replicate (e.g. due to permissions)
- return reject(
- new Error(`Denied: Document failed to replicate ${err}`)
- )
- })
- .on("complete", function (info) {
- return resolve(info)
- })
- .on("error", function (err) {
- return reject(new Error(`Replication Error: ${err}`))
- })
- })
- }
-
- replicate() {
- return new Promise((resolve, reject) => {
- this.replication = this.source.replicate
- .to(this.target)
- // .on("change", function (info) {
- // // handle change
- // })
- // .on("paused", function (err) {
- // // replication paused (e.g. replication up to date, user went offline)
- // })
- // .on("active", function () {
- // // replicate resumed (e.g. new changes replicating, user went back online)
- // })
+ promisify(operation, opts = {}) {
+ return new Promise(resolve => {
+ operation(this.target, opts)
.on("denied", function (err) {
// a document failed to replicate (e.g. due to permissions)
throw new Error(`Denied: Document failed to replicate ${err}`)
@@ -65,6 +27,40 @@ class Replication {
})
}
+ /**
+ * Two way replication operation, intended to be promise based.
+ * @param {Object} opts - PouchDB replication options
+ */
+ sync(opts) {
+ this.replication = this.promisify(this.source.sync, opts)
+ return this.replication
+ }
+
+ /**
+ * One way replication operation, intended to be promise based.
+ * @param {Object} opts - PouchDB replication options
+ */
+ replicate(opts) {
+ this.replication = this.promisify(this.source.replicate.to, opts)
+ return this.replication
+ }
+
+ /**
+ * Set up an ongoing live sync between 2 CouchDB databases.
+ * @param {Object} opts - PouchDB replication options
+ */
+ subscribe(opts = {}) {
+ this.replication = this.source.replicate
+ .to(this.target, {
+ live: true,
+ retry: true,
+ ...opts,
+ })
+ .on("error", function (err) {
+ throw new Error(`Replication Error: ${err}`)
+ })
+ }
+
async rollback() {
await this.target.destroy()
await this.replicate()
diff --git a/packages/builder/src/components/settings/SettingsModal.svelte b/packages/builder/src/components/settings/SettingsModal.svelte
index 5563ad9fbd..f881720305 100644
--- a/packages/builder/src/components/settings/SettingsModal.svelte
+++ b/packages/builder/src/components/settings/SettingsModal.svelte
@@ -1,5 +1,5 @@
@@ -13,9 +13,9 @@
-
+
diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte
index a92c2eeb23..174ac585d4 100644
--- a/packages/builder/src/components/start/AppCard.svelte
+++ b/packages/builder/src/components/start/AppCard.svelte
@@ -18,6 +18,7 @@
export let openApp
export let deleteApp
export let releaseLock
+ export let deletable
@@ -34,9 +35,11 @@
-