Removing pro from backend-core.
This commit is contained in:
parent
a190bd3da7
commit
91df9ffbc1
|
@ -25,7 +25,6 @@
|
||||||
"@budibase/nano": "10.1.1",
|
"@budibase/nano": "10.1.1",
|
||||||
"@budibase/pouchdb-replication-stream": "1.2.10",
|
"@budibase/pouchdb-replication-stream": "1.2.10",
|
||||||
"@budibase/types": "2.3.14-alpha.0",
|
"@budibase/types": "2.3.14-alpha.0",
|
||||||
"@budibase/pro": "2.3.14-alpha.0",
|
|
||||||
"@shopify/jest-koa-mocks": "5.0.1",
|
"@shopify/jest-koa-mocks": "5.0.1",
|
||||||
"@techpass/passport-openidconnect": "0.3.2",
|
"@techpass/passport-openidconnect": "0.3.2",
|
||||||
"aws-cloudfront-sign": "2.2.0",
|
"aws-cloudfront-sign": "2.2.0",
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
import { Event, IdentityType } from "@budibase/types"
|
import { Event, IdentityType, AuditLogFn } from "@budibase/types"
|
||||||
import { sdk } from "@budibase/pro"
|
|
||||||
import { processors } from "./processors"
|
import { processors } from "./processors"
|
||||||
import identification from "./identification"
|
import identification from "./identification"
|
||||||
import { getAppId } from "../context"
|
import { getAppId } from "../context"
|
||||||
import * as backfill from "./backfill"
|
import * as backfill from "./backfill"
|
||||||
|
|
||||||
|
let writeAuditLogs: AuditLogFn | undefined
|
||||||
|
|
||||||
|
export const initAuditLogs = (fn: AuditLogFn) => {
|
||||||
|
writeAuditLogs = fn
|
||||||
|
}
|
||||||
|
|
||||||
export const publishEvent = async (
|
export const publishEvent = async (
|
||||||
event: Event,
|
event: Event,
|
||||||
properties: any,
|
properties: any,
|
||||||
|
@ -18,11 +23,13 @@ export const publishEvent = async (
|
||||||
if (!backfilling) {
|
if (!backfilling) {
|
||||||
// only audit log actual events, don't include backfills
|
// only audit log actual events, don't include backfills
|
||||||
const userId = identity.type === IdentityType.USER ? identity.id : undefined
|
const userId = identity.type === IdentityType.USER ? identity.id : undefined
|
||||||
await sdk.auditLogs.write(event, properties, {
|
if (writeAuditLogs) {
|
||||||
userId,
|
await writeAuditLogs(event, properties, {
|
||||||
timestamp,
|
userId,
|
||||||
appId: getAppId(),
|
timestamp,
|
||||||
})
|
appId: getAppId(),
|
||||||
|
})
|
||||||
|
}
|
||||||
await processors.processEvent(event, identity, properties, timestamp)
|
await processors.processEvent(event, identity, properties, timestamp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,11 @@
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@budibase/types": ["../types/src"],
|
"@budibase/types": ["../types/src"]
|
||||||
"@budibase/pro": ["../../../budibase-pro/packages/pro/src"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../types" },
|
{ "path": "../types" }
|
||||||
{ "path": "../../../budibase-pro/packages/pro" }
|
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|
|
@ -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>
|
|
@ -12,3 +12,4 @@ export * from "./db"
|
||||||
export * from "./middleware"
|
export * from "./middleware"
|
||||||
export * from "./featureFlag"
|
export * from "./featureFlag"
|
||||||
export * from "./environmentVariables"
|
export * from "./environmentVariables"
|
||||||
|
export * from "./auditLogs"
|
||||||
|
|
|
@ -53,10 +53,6 @@ if [ -d "../budibase-pro" ]; then
|
||||||
echo "Linking pro to server"
|
echo "Linking pro to server"
|
||||||
cd packages/server && yarn link '@budibase/pro'
|
cd packages/server && yarn link '@budibase/pro'
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
echo "Linking pro to backend-core"
|
|
||||||
cd packages/backend-core && yarn link '@budibase/pro'
|
|
||||||
cd -
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "../account-portal" ]; then
|
if [ -d "../account-portal" ]; then
|
||||||
|
|
Loading…
Reference in New Issue