@budibase/backend-core 2.13.4 → 2.13.6
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/dist/index.js +39 -23
- package/dist/index.js.map +4 -4
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/cache/appMetadata.js.map +1 -1
- package/dist/src/constants/db.d.ts +1 -3
- package/dist/src/constants/db.js.map +1 -1
- package/dist/src/context/Context.d.ts +1 -1
- package/dist/src/context/Context.js.map +1 -1
- package/dist/src/context/identity.d.ts +3 -3
- package/dist/src/context/mainContext.d.ts +7 -7
- package/dist/src/context/mainContext.js +3 -0
- package/dist/src/context/mainContext.js.map +1 -1
- package/dist/src/db/couch/DatabaseImpl.d.ts +3 -3
- package/dist/src/db/couch/DatabaseImpl.js +0 -3
- package/dist/src/db/couch/DatabaseImpl.js.map +1 -1
- package/dist/src/db/db.d.ts +3 -4
- package/dist/src/db/db.js +2 -14
- package/dist/src/db/db.js.map +1 -1
- package/dist/src/db/views.d.ts +7 -7
- package/dist/src/db/views.js +4 -5
- package/dist/src/db/views.js.map +1 -1
- package/dist/src/index.d.ts +8 -8
- package/dist/src/users/db.js +1 -1
- package/dist/src/users/db.js.map +1 -1
- package/dist/src/users/users.js.map +1 -1
- package/dist/src/utils/utils.d.ts +1 -0
- package/dist/src/utils/utils.js +16 -1
- package/dist/src/utils/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/cache/appMetadata.ts +1 -1
- package/src/constants/db.ts +1 -1
- package/src/context/Context.ts +1 -1
- package/src/context/mainContext.ts +13 -10
- package/src/db/couch/DatabaseImpl.ts +5 -6
- package/src/db/db.ts +3 -13
- package/src/db/views.ts +22 -23
- package/src/users/db.ts +4 -6
- package/src/users/users.ts +1 -1
- package/src/utils/tests/utils.spec.ts +13 -0
- package/src/utils/utils.ts +14 -0
package/src/users/users.ts
CHANGED
|
@@ -151,7 +151,7 @@ export const searchGlobalUsersByApp = async (
|
|
|
151
151
|
include_docs: true,
|
|
152
152
|
})
|
|
153
153
|
params.startkey = opts && opts.startkey ? opts.startkey : params.startkey
|
|
154
|
-
let response = await queryGlobalView(ViewName.USER_BY_APP, params)
|
|
154
|
+
let response = await queryGlobalView<User>(ViewName.USER_BY_APP, params)
|
|
155
155
|
|
|
156
156
|
if (!response) {
|
|
157
157
|
response = []
|
|
@@ -188,4 +188,17 @@ describe("utils", () => {
|
|
|
188
188
|
expectResult(false)
|
|
189
189
|
})
|
|
190
190
|
})
|
|
191
|
+
|
|
192
|
+
describe("hasCircularStructure", () => {
|
|
193
|
+
it("should detect a circular structure", () => {
|
|
194
|
+
const a: any = { b: "b" }
|
|
195
|
+
const b = { a }
|
|
196
|
+
a.b = b
|
|
197
|
+
expect(utils.hasCircularStructure(b)).toBe(true)
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
it("should allow none circular structures", () => {
|
|
201
|
+
expect(utils.hasCircularStructure({ a: "b" })).toBe(false)
|
|
202
|
+
})
|
|
203
|
+
})
|
|
191
204
|
})
|
package/src/utils/utils.ts
CHANGED
|
@@ -237,3 +237,17 @@ export function timeout(timeMs: number) {
|
|
|
237
237
|
export function isAudited(event: Event) {
|
|
238
238
|
return !!AuditedEventFriendlyName[event]
|
|
239
239
|
}
|
|
240
|
+
|
|
241
|
+
export function hasCircularStructure(json: any) {
|
|
242
|
+
if (typeof json !== "object") {
|
|
243
|
+
return false
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
JSON.stringify(json)
|
|
247
|
+
} catch (err) {
|
|
248
|
+
if (err instanceof Error && err?.message.includes("circular structure")) {
|
|
249
|
+
return true
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return false
|
|
253
|
+
}
|