Removing pro from backend-core.

This commit is contained in:
mike12345567 2023-02-15 13:49:30 +00:00
parent 1ed4f4b8fe
commit c60b6da0ab
6 changed files with 30 additions and 16 deletions

View File

@ -25,7 +25,6 @@
"@budibase/nano": "10.1.1",
"@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.3.14-alpha.0",
"@budibase/pro": "2.3.14-alpha.0",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0",

View File

@ -1,10 +1,15 @@
import { Event, IdentityType } from "@budibase/types"
import { sdk } from "@budibase/pro"
import { Event, IdentityType, AuditLogFn } from "@budibase/types"
import { processors } from "./processors"
import identification from "./identification"
import { getAppId } from "../context"
import * as backfill from "./backfill"
let writeAuditLogs: AuditLogFn | undefined
export const initAuditLogs = (fn: AuditLogFn) => {
writeAuditLogs = fn
}
export const publishEvent = async (
event: Event,
properties: any,
@ -18,11 +23,13 @@ export const publishEvent = async (
if (!backfilling) {
// only audit log actual events, don't include backfills
const userId = identity.type === IdentityType.USER ? identity.id : undefined
await sdk.auditLogs.write(event, properties, {
userId,
timestamp,
appId: getAppId(),
})
if (writeAuditLogs) {
await writeAuditLogs(event, properties, {
userId,
timestamp,
appId: getAppId(),
})
}
await processors.processEvent(event, identity, properties, timestamp)
return
}

View File

@ -4,13 +4,11 @@
"composite": true,
"baseUrl": ".",
"paths": {
"@budibase/types": ["../types/src"],
"@budibase/pro": ["../../../budibase-pro/packages/pro/src"]
"@budibase/types": ["../types/src"]
}
},
"references": [
{ "path": "../types" },
{ "path": "../../../budibase-pro/packages/pro" }
{ "path": "../types" }
],
"exclude": [
"node_modules",

View File

@ -0,0 +1,13 @@
import { Event } from "./events"
export type AuditWriteOpts = {
appId?: string
timestamp?: string | number
userId?: string
}
export type AuditLogFn = (
event: Event,
metadata: any,
opts: AuditWriteOpts
) => Promise<any>

View File

@ -12,3 +12,4 @@ export * from "./db"
export * from "./middleware"
export * from "./featureFlag"
export * from "./environmentVariables"
export * from "./auditLogs"

View File

@ -53,10 +53,6 @@ if [ -d "../budibase-pro" ]; then
echo "Linking pro to server"
cd packages/server && yarn link '@budibase/pro'
cd -
echo "Linking pro to backend-core"
cd packages/backend-core && yarn link '@budibase/pro'
cd -
fi
if [ -d "../account-portal" ]; then