@budibase/backend-core 2.26.2 → 2.27.2

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.
@@ -21,7 +21,7 @@ export async function directCouchUrlCall({
21
21
  url: string
22
22
  cookie: string
23
23
  method: string
24
- body?: any
24
+ body?: Record<string, any>
25
25
  }) {
26
26
  const params: any = {
27
27
  method: method,
@@ -56,12 +56,17 @@ export class DDInstrumentedDatabase implements Database {
56
56
  })
57
57
  }
58
58
 
59
+ remove(idOrDoc: Document): Promise<DocumentDestroyResponse>
60
+ remove(idOrDoc: string, rev?: string): Promise<DocumentDestroyResponse>
59
61
  remove(
60
- id: string | Document,
61
- rev?: string | undefined
62
+ idOrDoc: string | Document,
63
+ rev?: string
62
64
  ): Promise<DocumentDestroyResponse> {
63
65
  return tracer.trace("db.remove", span => {
64
- span?.addTags({ db_name: this.name, doc_id: id })
66
+ span?.addTags({ db_name: this.name, doc_id: idOrDoc })
67
+ const isDocument = typeof idOrDoc === "object"
68
+ const id = isDocument ? idOrDoc._id! : idOrDoc
69
+ rev = isDocument ? idOrDoc._rev : rev
65
70
  return this.db.remove(id, rev)
66
71
  })
67
72
  }
@@ -160,4 +165,18 @@ export class DDInstrumentedDatabase implements Database {
160
165
  return this.db.sql(sql, parameters)
161
166
  })
162
167
  }
168
+
169
+ sqlPurgeDocument(docIds: string[] | string): Promise<void> {
170
+ return tracer.trace("db.sqlPurgeDocument", span => {
171
+ span?.addTags({ db_name: this.name })
172
+ return this.db.sqlPurgeDocument(docIds)
173
+ })
174
+ }
175
+
176
+ sqlDiskCleanup(): Promise<void> {
177
+ return tracer.trace("db.sqlDiskCleanup", span => {
178
+ span?.addTags({ db_name: this.name })
179
+ return this.db.sqlDiskCleanup()
180
+ })
181
+ }
163
182
  }
@@ -109,6 +109,7 @@ const environment = {
109
109
  API_ENCRYPTION_KEY: getAPIEncryptionKey(),
110
110
  COUCH_DB_URL: process.env.COUCH_DB_URL || "http://localhost:4005",
111
111
  COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL || "http://localhost:4006",
112
+ SQS_SEARCH_ENABLE: process.env.SQS_SEARCH_ENABLE,
112
113
  COUCH_DB_USERNAME: process.env.COUCH_DB_USER,
113
114
  COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,
114
115
  GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,
package/src/users/db.ts CHANGED
@@ -492,7 +492,7 @@ export class UserDB {
492
492
 
493
493
  await platform.users.removeUser(dbUser)
494
494
 
495
- await db.remove(userId, dbUser._rev)
495
+ await db.remove(userId, dbUser._rev!)
496
496
 
497
497
  const creatorsToDelete = (await isCreator(dbUser)) ? 1 : 0
498
498
  await UserDB.quotas.removeUsers(1, creatorsToDelete)