diff --git a/packages/auth/src/db/Replication.js b/packages/auth/src/db/Replication.js
index 9720776413..931bc3d496 100644
--- a/packages/auth/src/db/Replication.js
+++ b/packages/auth/src/db/Replication.js
@@ -31,7 +31,7 @@ class Replication {
* Two way replication operation, intended to be promise based.
* @param {Object} opts - PouchDB replication options
*/
- sync(opts) {
+ sync(opts = {}) {
this.replication = this.promisify(this.source.sync, opts)
return this.replication
}
@@ -40,7 +40,7 @@ class Replication {
* One way replication operation, intended to be promise based.
* @param {Object} opts - PouchDB replication options
*/
- replicate(opts) {
+ replicate(opts = {}) {
this.replication = this.promisify(this.source.replicate.to, opts)
return this.replication
}
@@ -61,8 +61,13 @@ class Replication {
})
}
+ /**
+ * Rollback the target DB back to the state of the source DB
+ */
async rollback() {
await this.target.destroy()
+ // Recreate the DB again
+ this.target = getDB(this.target.name)
await this.replicate()
}
diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js
index 44fe1da2db..c4849a6897 100644
--- a/packages/auth/src/db/utils.js
+++ b/packages/auth/src/db/utils.js
@@ -12,6 +12,9 @@ exports.StaticDatabases = {
GLOBAL: {
name: "global-db",
},
+ DEPLOYMENTS: {
+ name: "deployments",
+ },
}
const DocumentTypes = {
@@ -21,6 +24,7 @@ const DocumentTypes = {
TEMPLATE: "template",
APP: "app",
APP_DEV: "app_dev",
+ APP_METADATA: "app_metadata",
}
exports.DocumentTypes = DocumentTypes
diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js
index be553066b9..0d80065f2f 100644
--- a/packages/builder/src/builderStore/store/frontend.js
+++ b/packages/builder/src/builderStore/store/frontend.js
@@ -51,14 +51,14 @@ export const getFrontendStore = () => {
store.actions = {
initialise: async pkg => {
const { layouts, screens, application, clientLibPath } = pkg
- const components = await fetchComponentLibDefinitions(application._id)
+ const components = await fetchComponentLibDefinitions(application.appId)
store.update(state => ({
...state,
libraries: application.componentLibraries,
components,
name: application.name,
description: application.description,
- appId: application._id,
+ appId: application.appId,
url: application.url,
layouts,
screens,
diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte
new file mode 100644
index 0000000000..5fffa4cd55
--- /dev/null
+++ b/packages/builder/src/components/deploy/DeployModal.svelte
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+ The changes you have made will be published to the production version of the application.
+
+
diff --git a/packages/builder/src/components/deploy/RevertModal.svelte b/packages/builder/src/components/deploy/RevertModal.svelte
new file mode 100644
index 0000000000..7eaac42bbd
--- /dev/null
+++ b/packages/builder/src/components/deploy/RevertModal.svelte
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+ The changes you have made will be deleted and the application reverted back to its production state.
+
+
diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte
index 174ac585d4..7415e2568e 100644
--- a/packages/builder/src/components/start/AppCard.svelte
+++ b/packages/builder/src/components/start/AppCard.svelte
@@ -41,7 +41,7 @@
{/if}
{#if app.lockedBy && app.lockedBy?.email === $auth.user?.email}
-