Some final updates to get tests passing again, issue with publisher tenant ID being the 'unique' format which cannot actually be used.

This commit is contained in:
mike12345567 2023-04-17 15:59:59 +01:00
parent b6f14a3f55
commit b4e6cbce7a
5 changed files with 11 additions and 2 deletions

View File

@ -65,6 +65,7 @@ const getCurrentIdentity = async (): Promise<Identity> => {
hosting,
installationId,
tenantId,
realTenantId: context.getTenantId(),
environment,
}
} else if (identityType === IdentityType.USER) {

View File

@ -20,7 +20,7 @@ export default class DocumentUpdateProcessor implements EventProcessor {
properties: any,
timestamp?: string | number
) {
const tenantId = identity.tenantId
const tenantId = identity.realTenantId
const docId = getDocumentId(event, properties)
if (!tenantId || !docId) {
return

View File

@ -2,8 +2,13 @@ import userGroupProcessor from "./syncUsers"
import { docUpdates } from "@budibase/backend-core"
export type UpdateCallback = (docId: string) => void
let started = false
export function init(updateCb?: UpdateCallback) {
if (started) {
return
}
const processors = [userGroupProcessor(updateCb)]
docUpdates.init(processors)
started = true
}

View File

@ -20,6 +20,8 @@ function updateCb(docId: string) {
}
}
init(updateCb)
function waitForUpdate(opts: { group?: boolean }) {
return new Promise<void>((resolve, reject) => {
const timeout = setTimeout(() => {
@ -35,7 +37,6 @@ function waitForUpdate(opts: { group?: boolean }) {
beforeAll(async () => {
app = await config.init("syncApp")
init(updateCb)
})
async function createUser(email: string, roles: UserRoles, builder?: boolean) {

View File

@ -46,6 +46,8 @@ export interface Identity {
environment: string
installationId?: string
tenantId?: string
// usable - no unique format
realTenantId?: string
hostInfo?: HostInfo
}