@budibase/server 2.3.18-alpha.6 → 2.3.18-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.3.18-alpha.6",
4
+ "version": "2.3.18-alpha.8",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -43,11 +43,11 @@
43
43
  "license": "GPL-3.0",
44
44
  "dependencies": {
45
45
  "@apidevtools/swagger-parser": "10.0.3",
46
- "@budibase/backend-core": "2.3.18-alpha.6",
47
- "@budibase/client": "2.3.18-alpha.6",
48
- "@budibase/pro": "2.3.18-alpha.5",
49
- "@budibase/string-templates": "2.3.18-alpha.6",
50
- "@budibase/types": "2.3.18-alpha.6",
46
+ "@budibase/backend-core": "2.3.18-alpha.8",
47
+ "@budibase/client": "2.3.18-alpha.8",
48
+ "@budibase/pro": "2.3.18-alpha.7",
49
+ "@budibase/string-templates": "2.3.18-alpha.8",
50
+ "@budibase/types": "2.3.18-alpha.8",
51
51
  "@bull-board/api": "3.7.0",
52
52
  "@bull-board/koa": "3.9.4",
53
53
  "@elastic/elasticsearch": "7.10.0",
@@ -173,5 +173,5 @@
173
173
  "optionalDependencies": {
174
174
  "oracledb": "5.3.0"
175
175
  },
176
- "gitHead": "fd87b260e1b621eb7f6eb4c2b85e919ed50f9963"
176
+ "gitHead": "76d67319b05f0babeb4c26c40dafef7849233cf2"
177
177
  }
@@ -65,10 +65,14 @@ export async function create(ctx: BBContext) {
65
65
 
66
66
  // call through to update if already exists
67
67
  if (automation._id && automation._rev) {
68
- return update(ctx)
68
+ await update(ctx)
69
+ return
69
70
  }
70
71
 
71
- automation._id = generateAutomationID()
72
+ // Respect existing IDs if recreating a deleted automation
73
+ if (!automation._id) {
74
+ automation._id = generateAutomationID()
75
+ }
72
76
 
73
77
  automation.type = "automation"
74
78
  automation = cleanAutomationInputs(automation)
@@ -126,6 +130,13 @@ export async function update(ctx: BBContext) {
126
130
  const db = context.getAppDB()
127
131
  let automation = ctx.request.body
128
132
  automation.appId = ctx.appId
133
+
134
+ // Call through to create if it doesn't exist
135
+ if (!automation._id || !automation._rev) {
136
+ await create(ctx)
137
+ return
138
+ }
139
+
129
140
  const oldAutomation = await db.get(automation._id)
130
141
  automation = cleanAutomationInputs(automation)
131
142
  automation = await checkForWebhooks({
@@ -38,7 +38,7 @@ router
38
38
  "/api/automations",
39
39
  bodyResource("_id"),
40
40
  authorized(permissions.BUILDER),
41
- automationValidator(true),
41
+ automationValidator(false),
42
42
  controller.update
43
43
  )
44
44
  .post(