App backfill (wip)
This commit is contained in:
parent
11ea9d90e3
commit
1f56d31ebb
|
@ -36,8 +36,8 @@
|
||||||
"kill-server": "kill-port 4001 4002",
|
"kill-server": "kill-port 4001 4002",
|
||||||
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
||||||
"dev": "yarn run kill-all && lerna link && lerna run --parallel dev:builder --concurrency 1",
|
"dev": "yarn run kill-all && lerna link && lerna run --parallel dev:builder --concurrency 1",
|
||||||
"dev:noserver": "yarn run kill-builder && lerna link && lerna run dev:stack:up && lerna run --parallel dev:builder --concurrency 1 --ignore @budibase/server --ignore @budibase/worker",
|
"dev:noserver": "yarn run kill-builder && lerna link && lerna run dev:stack:up && lerna run --parallel dev:builder --concurrency 1 --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker",
|
||||||
"dev:server": "yarn run kill-server && lerna run --parallel dev:builder --concurrency 1 --scope @budibase/worker --scope @budibase/server",
|
"dev:server": "yarn run kill-server && lerna run --parallel dev:builder --concurrency 1 --scope @budibase/backend-core --scope @budibase/worker --scope @budibase/server",
|
||||||
"test": "lerna run test",
|
"test": "lerna run test",
|
||||||
"lint:eslint": "eslint packages",
|
"lint:eslint": "eslint packages",
|
||||||
"lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\"",
|
"lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\"",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rimraf dist/ && tsc -p tsconfig.build.json",
|
"build": "rimraf dist/ && tsc -p tsconfig.build.json",
|
||||||
"dev:builder": "rimraf dist/ && tsc -p tsconfig.build.json --watch",
|
"dev:builder": "rimraf dist/ && tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watchAll"
|
"test:watch": "jest --watchAll"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,32 +1,24 @@
|
||||||
const PosthogClient = require("./posthog")
|
import PosthogClient from "./PosthogClient"
|
||||||
const env = require("../environment")
|
import env from "../environment"
|
||||||
const { getTenantId } = require("../context")
|
import { getTenantId } from "../context"
|
||||||
|
import { Account, Hosting, Event, IdentityType } from "@budibase/types"
|
||||||
const IdentityType = {
|
|
||||||
TENANT: "tenant",
|
|
||||||
USER: "user",
|
|
||||||
ACCOUNT: "account",
|
|
||||||
}
|
|
||||||
|
|
||||||
const Hosting = {
|
|
||||||
CLOUD: "cloud",
|
|
||||||
SELF: "self",
|
|
||||||
}
|
|
||||||
|
|
||||||
class Analytics {
|
class Analytics {
|
||||||
|
isEnabled: boolean
|
||||||
|
posthog: PosthogClient | undefined
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// check enabled before init
|
// check enabled before init
|
||||||
this.isEnabled = !!(!env.SELF_HOSTED && env.ENABLE_ANALYTICS)
|
this.isEnabled = !!env.ENABLE_ANALYTICS // TODO: use db flag instead
|
||||||
if (!this.isEnabled) return
|
if (!this.isEnabled) return
|
||||||
|
this.posthog = new PosthogClient(env.POSTHOG_TOKEN)
|
||||||
this.posthog = new PosthogClient(process.env.POSTHOG_TOKEN)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enabled() {
|
enabled() {
|
||||||
return this.isEnabled
|
return this.isEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
identify(type, id, hosting) {
|
identify(type: IdentityType, id: string, hosting?: Hosting) {
|
||||||
if (!this.isEnabled) return
|
if (!this.isEnabled) return
|
||||||
const tenantId = getTenantId()
|
const tenantId = getTenantId()
|
||||||
if (!hosting) {
|
if (!hosting) {
|
||||||
|
@ -35,12 +27,12 @@ class Analytics {
|
||||||
const properties = {
|
const properties = {
|
||||||
type,
|
type,
|
||||||
hosting,
|
hosting,
|
||||||
tenant: tenantId,
|
tenantId,
|
||||||
}
|
}
|
||||||
this.posthog.identify(id, properties)
|
this.posthog!.identify(id, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
identifyUser(userId) {
|
identifyUser(userId: string) {
|
||||||
this.identify(IdentityType.USER, userId)
|
this.identify(IdentityType.USER, userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,23 +46,23 @@ class Analytics {
|
||||||
this.identify(IdentityType.TENANT, distinctId)
|
this.identify(IdentityType.TENANT, distinctId)
|
||||||
}
|
}
|
||||||
|
|
||||||
identifyAccount(account) {
|
identifyAccount(account: Account) {
|
||||||
const distinctId = account.accountId
|
const distinctId = account.accountId
|
||||||
const hosting = account.hosting
|
const hosting = account.hosting
|
||||||
this.identify(IdentityType.ACCOUNT, distinctId, hosting)
|
this.identify(IdentityType.ACCOUNT, distinctId, hosting)
|
||||||
}
|
}
|
||||||
|
|
||||||
captureEvent(eventName, properties) {
|
captureEvent(event: Event, properties: any) {
|
||||||
if (!this.isEnabled) return
|
if (!this.isEnabled) return
|
||||||
// TODO: get the user id from context
|
// TODO: get the user id from context
|
||||||
const userId = "TESTING_USER_ID"
|
const userId = "TESTING_USER_ID"
|
||||||
this.posthog.capture(userId, eventName, properties)
|
this.posthog!.capture(userId, event, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown() {
|
shutdown() {
|
||||||
if (!this.isEnabled) return
|
if (!this.isEnabled) return
|
||||||
this.posthog.shutdown()
|
this.posthog!.shutdown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Analytics
|
export default Analytics
|
|
@ -0,0 +1,27 @@
|
||||||
|
import PostHog from "posthog-node"
|
||||||
|
import { Event } from "@budibase/types"
|
||||||
|
|
||||||
|
class PosthogClient {
|
||||||
|
posthog: PostHog
|
||||||
|
|
||||||
|
constructor(token: string | undefined) {
|
||||||
|
if (!token) {
|
||||||
|
throw new Error("Posthog token is not defined")
|
||||||
|
}
|
||||||
|
this.posthog = new PostHog(token)
|
||||||
|
}
|
||||||
|
|
||||||
|
identify(distinctId: string, properties: any) {
|
||||||
|
this.posthog.identify({ distinctId, properties })
|
||||||
|
}
|
||||||
|
|
||||||
|
capture(userId: string, event: Event, properties: any) {
|
||||||
|
this.posthog.capture({ distinctId: userId, event, properties })
|
||||||
|
}
|
||||||
|
|
||||||
|
shutdown() {
|
||||||
|
this.posthog.shutdown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PosthogClient
|
|
@ -1,4 +0,0 @@
|
||||||
const Analytics = require("./analytics")
|
|
||||||
|
|
||||||
const analytics = new Analytics()
|
|
||||||
module.exports = analytics
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import Analytics from "./Analytics"
|
||||||
|
|
||||||
|
const analytics = new Analytics()
|
||||||
|
export default analytics
|
|
@ -1,21 +0,0 @@
|
||||||
const PostHog = require("posthog-node")
|
|
||||||
|
|
||||||
class PosthogClient {
|
|
||||||
constructor(token) {
|
|
||||||
this.posthog = new PostHog(token)
|
|
||||||
}
|
|
||||||
|
|
||||||
identify(distinctId, properties) {
|
|
||||||
this.posthog.identify({ distinctId, properties })
|
|
||||||
}
|
|
||||||
|
|
||||||
capture(userId, event, properties) {
|
|
||||||
this.posthog.capture({ distinctId: userId, event, properties })
|
|
||||||
}
|
|
||||||
|
|
||||||
shutdown() {
|
|
||||||
this.posthog.shutdown()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = PosthogClient
|
|
|
@ -1,16 +1,17 @@
|
||||||
import { getTenantId } from "../context"
|
import { getTenantId } from "../context"
|
||||||
import { captureEvent } from "../analytics"
|
import analytics from "../analytics"
|
||||||
|
import { Event } from "@budibase/types"
|
||||||
|
|
||||||
const logEvent = messsage => {
|
const logEvent = (messsage: string) => {
|
||||||
const tenantId = getTenantId()
|
const tenantId = getTenantId()
|
||||||
const userId = getTenantId() // TODO
|
const userId = getTenantId() // TODO
|
||||||
console.log(`[audit] [tenant=${tenantId}] [user=${userId}] ${messsage}`)
|
console.log(`[audit] [tenant=${tenantId}] [user=${userId}] ${messsage}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const processEvent = (event, properties) => {
|
export const processEvent = (event: Event, properties: any) => {
|
||||||
// logging
|
// logging
|
||||||
logEvent(event)
|
logEvent(event)
|
||||||
|
|
||||||
// analytics
|
// analytics
|
||||||
captureEvent(event, properties)
|
analytics.captureEvent(event, properties)
|
||||||
}
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import { Events, Account } from "@budibase/types"
|
import { Event, Account } from "@budibase/types"
|
||||||
|
|
||||||
export function created(account: Account) {
|
export function created(account: Account) {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.ACCOUNT_CREATED, properties)
|
processEvent(Event.ACCOUNT_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(account: Account) {
|
export function deleted(account: Account) {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.ACCOUNT_DELETED, properties)
|
processEvent(Event.ACCOUNT_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function verified(account: Account) {
|
export function verified(account: Account) {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.ACCOUNT_VERIFIED, properties)
|
processEvent(Event.ACCOUNT_VERIFIED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
App,
|
App,
|
||||||
AppCreatedEvent,
|
AppCreatedEvent,
|
||||||
AppUpdatedEvent,
|
AppUpdatedEvent,
|
||||||
|
@ -17,57 +17,57 @@ import {
|
||||||
|
|
||||||
export function created(app: App) {
|
export function created(app: App) {
|
||||||
const properties: AppCreatedEvent = {}
|
const properties: AppCreatedEvent = {}
|
||||||
processEvent(Events.APP_CREATED, properties)
|
processEvent(Event.APP_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updated(app: App) {
|
export function updated(app: App) {
|
||||||
const properties: AppUpdatedEvent = {}
|
const properties: AppUpdatedEvent = {}
|
||||||
processEvent(Events.APP_UPDATED, properties)
|
processEvent(Event.APP_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(app: App) {
|
export function deleted(app: App) {
|
||||||
const properties: AppDeletedEvent = {}
|
const properties: AppDeletedEvent = {}
|
||||||
processEvent(Events.APP_DELETED, properties)
|
processEvent(Event.APP_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function published(app: App) {
|
export function published(app: App) {
|
||||||
const properties: AppPublishedEvent = {}
|
const properties: AppPublishedEvent = {}
|
||||||
processEvent(Events.APP_PUBLISHED, properties)
|
processEvent(Event.APP_PUBLISHED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unpublished(app: App) {
|
export function unpublished(app: App) {
|
||||||
const properties: AppUnpublishedEvent = {}
|
const properties: AppUnpublishedEvent = {}
|
||||||
processEvent(Events.APP_UNPUBLISHED, properties)
|
processEvent(Event.APP_UNPUBLISHED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fileImported(app: App) {
|
export function fileImported(app: App) {
|
||||||
const properties: AppFileImportedEvent = {}
|
const properties: AppFileImportedEvent = {}
|
||||||
processEvent(Events.APP_FILE_IMPORTED, properties)
|
processEvent(Event.APP_FILE_IMPORTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function templateImported(templateKey: string) {
|
export function templateImported(templateKey: string) {
|
||||||
const properties: AppTemplateImportedEvent = {
|
const properties: AppTemplateImportedEvent = {
|
||||||
templateKey,
|
templateKey,
|
||||||
}
|
}
|
||||||
processEvent(Events.APP_TEMPLATE_IMPORTED, properties)
|
processEvent(Event.APP_TEMPLATE_IMPORTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function versionUpdated(app: App) {
|
export function versionUpdated(app: App) {
|
||||||
const properties: AppVersionUpdatedEvent = {}
|
const properties: AppVersionUpdatedEvent = {}
|
||||||
processEvent(Events.APP_VERSION_UPDATED, properties)
|
processEvent(Event.APP_VERSION_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function versionReverted(app: App) {
|
export function versionReverted(app: App) {
|
||||||
const properties: AppVersionRevertedEvent = {}
|
const properties: AppVersionRevertedEvent = {}
|
||||||
processEvent(Events.APP_VERSION_REVERTED, properties)
|
processEvent(Event.APP_VERSION_REVERTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reverted(app: App) {
|
export function reverted(app: App) {
|
||||||
const properties: AppRevertedEvent = {}
|
const properties: AppRevertedEvent = {}
|
||||||
processEvent(Events.APP_REVERTED, properties)
|
processEvent(Event.APP_REVERTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function exported(app: App) {
|
export function exported(app: App) {
|
||||||
const properties: AppExportedEvent = {}
|
const properties: AppExportedEvent = {}
|
||||||
processEvent(Events.APP_EXPORTED, properties)
|
processEvent(Event.APP_EXPORTED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
LoginEvent,
|
LoginEvent,
|
||||||
LoginSource,
|
LoginSource,
|
||||||
LogoutEvent,
|
LogoutEvent,
|
||||||
|
@ -15,38 +15,38 @@ export function login(source: LoginSource) {
|
||||||
const properties: LoginEvent = {
|
const properties: LoginEvent = {
|
||||||
source,
|
source,
|
||||||
}
|
}
|
||||||
processEvent(Events.AUTH_LOGIN, properties)
|
processEvent(Event.AUTH_LOGIN, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logout() {
|
export function logout() {
|
||||||
const properties: LogoutEvent = {}
|
const properties: LogoutEvent = {}
|
||||||
processEvent(Events.AUTH_LOGOUT, properties)
|
processEvent(Event.AUTH_LOGOUT, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SSOCreated(type: SSOType) {
|
export function SSOCreated(type: SSOType) {
|
||||||
const properties: SSOCreatedEvent = {
|
const properties: SSOCreatedEvent = {
|
||||||
type,
|
type,
|
||||||
}
|
}
|
||||||
processEvent(Events.AUTH_SSO_CREATED, properties)
|
processEvent(Event.AUTH_SSO_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SSOUpdated(type: SSOType) {
|
export function SSOUpdated(type: SSOType) {
|
||||||
const properties: SSOUpdatedEvent = {
|
const properties: SSOUpdatedEvent = {
|
||||||
type,
|
type,
|
||||||
}
|
}
|
||||||
processEvent(Events.AUTH_SSO_UPDATED, properties)
|
processEvent(Event.AUTH_SSO_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SSOActivated(type: SSOType) {
|
export function SSOActivated(type: SSOType) {
|
||||||
const properties: SSOActivatedEvent = {
|
const properties: SSOActivatedEvent = {
|
||||||
type,
|
type,
|
||||||
}
|
}
|
||||||
processEvent(Events.AUTH_SSO_ACTIVATED, properties)
|
processEvent(Event.AUTH_SSO_ACTIVATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SSODeactivated(type: SSOType) {
|
export function SSODeactivated(type: SSOType) {
|
||||||
const properties: SSODeactivatedEvent = {
|
const properties: SSODeactivatedEvent = {
|
||||||
type,
|
type,
|
||||||
}
|
}
|
||||||
processEvent(Events.AUTH_SSO_DEACTIVATED, properties)
|
processEvent(Event.AUTH_SSO_DEACTIVATED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Automation,
|
Automation,
|
||||||
Events,
|
Event,
|
||||||
AutomationStep,
|
AutomationStep,
|
||||||
AutomationTrigger,
|
AutomationTrigger,
|
||||||
AutomationCreatedEvent,
|
AutomationCreatedEvent,
|
||||||
|
@ -14,17 +14,17 @@ import {
|
||||||
|
|
||||||
export function created(automation: Automation) {
|
export function created(automation: Automation) {
|
||||||
const properties: AutomationCreatedEvent = {}
|
const properties: AutomationCreatedEvent = {}
|
||||||
processEvent(Events.AUTOMATION_CREATED, properties)
|
processEvent(Event.AUTOMATION_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(automation: Automation) {
|
export function deleted(automation: Automation) {
|
||||||
const properties: AutomationDeletedEvent = {}
|
const properties: AutomationDeletedEvent = {}
|
||||||
processEvent(Events.AUTOMATION_DELETED, properties)
|
processEvent(Event.AUTOMATION_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function tested(automation: Automation) {
|
export function tested(automation: Automation) {
|
||||||
const properties: AutomationTestedEvent = {}
|
const properties: AutomationTestedEvent = {}
|
||||||
processEvent(Events.AUTOMATION_TESTED, properties)
|
processEvent(Event.AUTOMATION_TESTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -35,12 +35,12 @@ export function tested(automation: Automation) {
|
||||||
|
|
||||||
export function stepCreated(automation: Automation, step: AutomationStep) {
|
export function stepCreated(automation: Automation, step: AutomationStep) {
|
||||||
const properties: AutomationStepCreatedEvent = {}
|
const properties: AutomationStepCreatedEvent = {}
|
||||||
processEvent(Events.AUTOMATION_STEP_CREATED, properties)
|
processEvent(Event.AUTOMATION_STEP_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stepDeleted(automation: Automation, step: AutomationStep) {
|
export function stepDeleted(automation: Automation, step: AutomationStep) {
|
||||||
const properties: AutomationStepDeletedEvent = {}
|
const properties: AutomationStepDeletedEvent = {}
|
||||||
processEvent(Events.AUTOMATION_STEP_DELETED, properties)
|
processEvent(Event.AUTOMATION_STEP_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function triggerUpdated(
|
export function triggerUpdated(
|
||||||
|
@ -48,5 +48,5 @@ export function triggerUpdated(
|
||||||
trigger: AutomationTrigger
|
trigger: AutomationTrigger
|
||||||
) {
|
) {
|
||||||
const properties: AutomationTriggerUpdatedEvent = {}
|
const properties: AutomationTriggerUpdatedEvent = {}
|
||||||
processEvent(Events.AUTOMATION_TRIGGER_UPDATED, properties)
|
processEvent(Event.AUTOMATION_TRIGGER_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
Datasource,
|
Datasource,
|
||||||
DatasourceCreatedEvent,
|
DatasourceCreatedEvent,
|
||||||
DatasourceUpdatedEvent,
|
DatasourceUpdatedEvent,
|
||||||
|
@ -9,15 +9,15 @@ import {
|
||||||
|
|
||||||
export function created(datasource: Datasource) {
|
export function created(datasource: Datasource) {
|
||||||
const properties: DatasourceCreatedEvent = {}
|
const properties: DatasourceCreatedEvent = {}
|
||||||
processEvent(Events.DATASOURCE_CREATED, properties)
|
processEvent(Event.DATASOURCE_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updated(datasource: Datasource) {
|
export function updated(datasource: Datasource) {
|
||||||
const properties: DatasourceUpdatedEvent = {}
|
const properties: DatasourceUpdatedEvent = {}
|
||||||
processEvent(Events.DATASOURCE_UPDATED, properties)
|
processEvent(Event.DATASOURCE_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(datasource: Datasource) {
|
export function deleted(datasource: Datasource) {
|
||||||
const properties: DatasourceDeletedEvent = {}
|
const properties: DatasourceDeletedEvent = {}
|
||||||
processEvent(Events.DATASOURCE_DELETED, properties)
|
processEvent(Event.DATASOURCE_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
SMTPConfig,
|
SMTPConfig,
|
||||||
SMTPCreatedEvent,
|
SMTPCreatedEvent,
|
||||||
SMTPUpdatedEvent,
|
SMTPUpdatedEvent,
|
||||||
|
@ -8,10 +8,10 @@ import {
|
||||||
|
|
||||||
export function SMTPCreated(config: SMTPConfig) {
|
export function SMTPCreated(config: SMTPConfig) {
|
||||||
const properties: SMTPCreatedEvent = {}
|
const properties: SMTPCreatedEvent = {}
|
||||||
processEvent(Events.EMAIL_SMTP_CREATED, properties)
|
processEvent(Event.EMAIL_SMTP_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SMTPUpdated(config: SMTPConfig) {
|
export function SMTPUpdated(config: SMTPConfig) {
|
||||||
const properties: SMTPUpdatedEvent = {}
|
const properties: SMTPUpdatedEvent = {}
|
||||||
processEvent(Events.EMAIL_SMTP_UPDATED, properties)
|
processEvent(Event.EMAIL_SMTP_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
Layout,
|
Layout,
|
||||||
LayoutCreatedEvent,
|
LayoutCreatedEvent,
|
||||||
LayoutDeletedEvent,
|
LayoutDeletedEvent,
|
||||||
|
@ -8,10 +8,10 @@ import {
|
||||||
|
|
||||||
export function created(layout: Layout) {
|
export function created(layout: Layout) {
|
||||||
const properties: LayoutCreatedEvent = {}
|
const properties: LayoutCreatedEvent = {}
|
||||||
processEvent(Events.LAYOUT_CREATED, properties)
|
processEvent(Event.LAYOUT_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(layout: Layout) {
|
export function deleted(layout: Layout) {
|
||||||
const properties: LayoutDeletedEvent = {}
|
const properties: LayoutDeletedEvent = {}
|
||||||
processEvent(Events.LAYOUT_DELETED, properties)
|
processEvent(Event.LAYOUT_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
License,
|
License,
|
||||||
LicenseActivatedEvent,
|
LicenseActivatedEvent,
|
||||||
LicenseDowngradedEvent,
|
LicenseDowngradedEvent,
|
||||||
|
@ -12,25 +12,25 @@ import {
|
||||||
// TODO
|
// TODO
|
||||||
export function updgraded(license: License) {
|
export function updgraded(license: License) {
|
||||||
const properties: LicenseUpgradedEvent = {}
|
const properties: LicenseUpgradedEvent = {}
|
||||||
processEvent(Events.LICENSE_UPGRADED, properties)
|
processEvent(Event.LICENSE_UPGRADED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
export function downgraded(license: License) {
|
export function downgraded(license: License) {
|
||||||
const properties: LicenseDowngradedEvent = {}
|
const properties: LicenseDowngradedEvent = {}
|
||||||
processEvent(Events.LICENSE_DOWNGRADED, properties)
|
processEvent(Event.LICENSE_DOWNGRADED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
export function updated(license: License) {
|
export function updated(license: License) {
|
||||||
const properties: LicenseUpdatedEvent = {}
|
const properties: LicenseUpdatedEvent = {}
|
||||||
processEvent(Events.LICENSE_UPDATED, properties)
|
processEvent(Event.LICENSE_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
export function activated(license: License) {
|
export function activated(license: License) {
|
||||||
const properties: LicenseActivatedEvent = {}
|
const properties: LicenseActivatedEvent = {}
|
||||||
processEvent(Events.LICENSE_ACTIVATED, properties)
|
processEvent(Event.LICENSE_ACTIVATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -39,5 +39,5 @@ export function quotaExceeded(quotaName: string, value: number) {
|
||||||
name: quotaName,
|
name: quotaName,
|
||||||
value,
|
value,
|
||||||
}
|
}
|
||||||
processEvent(Events.LICENSE_QUOTA_EXCEEDED, properties)
|
processEvent(Event.LICENSE_QUOTA_EXCEEDED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import { Events, VersionCheckedEvent } from "@budibase/types"
|
import { Event, VersionCheckedEvent } from "@budibase/types"
|
||||||
|
|
||||||
export function nameUpdated() {
|
export function nameUpdated() {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.ORG_NAME_UPDATED, properties)
|
processEvent(Event.ORG_NAME_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logoUpdated() {
|
export function logoUpdated() {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.ORG_LOGO_UPDATED, properties)
|
processEvent(Event.ORG_LOGO_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function platformURLUpdated() {
|
export function platformURLUpdated() {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.ORG_PLATFORM_URL_UPDATED, properties)
|
processEvent(Event.ORG_PLATFORM_URL_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function versionChecked(version: number) {
|
export function versionChecked(version: number) {
|
||||||
const properties: VersionCheckedEvent = {
|
const properties: VersionCheckedEvent = {
|
||||||
version,
|
version,
|
||||||
}
|
}
|
||||||
processEvent(Events.UPDATE_VERSION_CHECKED, properties)
|
processEvent(Event.UPDATE_VERSION_CHECKED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
export function analyticsOptOut() {
|
export function analyticsOptOut() {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.ANALYTICS_OPT_OUT, properties)
|
processEvent(Event.ANALYTICS_OPT_OUT, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
Datasource,
|
Datasource,
|
||||||
Query,
|
Query,
|
||||||
QueryCreatedEvent,
|
QueryCreatedEvent,
|
||||||
|
@ -14,17 +14,17 @@ import {
|
||||||
|
|
||||||
export const created = (datasource: Datasource, query: Query) => {
|
export const created = (datasource: Datasource, query: Query) => {
|
||||||
const properties: QueryCreatedEvent = {}
|
const properties: QueryCreatedEvent = {}
|
||||||
processEvent(Events.QUERY_CREATED, properties)
|
processEvent(Event.QUERY_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const updated = (datasource: Datasource, query: Query) => {
|
export const updated = (datasource: Datasource, query: Query) => {
|
||||||
const properties: QueryUpdatedEvent = {}
|
const properties: QueryUpdatedEvent = {}
|
||||||
processEvent(Events.QUERY_UPDATED, properties)
|
processEvent(Event.QUERY_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleted = (datasource: Datasource, query: Query) => {
|
export const deleted = (datasource: Datasource, query: Query) => {
|
||||||
const properties: QueryDeletedEvent = {}
|
const properties: QueryDeletedEvent = {}
|
||||||
processEvent(Events.QUERY_DELETED, properties)
|
processEvent(Event.QUERY_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const imported = (
|
export const imported = (
|
||||||
|
@ -33,7 +33,7 @@ export const imported = (
|
||||||
count: any
|
count: any
|
||||||
) => {
|
) => {
|
||||||
const properties: QueryImportedEvent = {}
|
const properties: QueryImportedEvent = {}
|
||||||
processEvent(Events.QUERY_IMPORT, properties)
|
processEvent(Event.QUERY_IMPORT, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -44,5 +44,5 @@ export const imported = (
|
||||||
|
|
||||||
export const previewed = (datasource: Datasource) => {
|
export const previewed = (datasource: Datasource) => {
|
||||||
const properties: QueryPreviewedEvent = {}
|
const properties: QueryPreviewedEvent = {}
|
||||||
processEvent(Events.QUERY_PREVIEWED, properties)
|
processEvent(Event.QUERY_PREVIEWED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
Role,
|
Role,
|
||||||
RoleAssignedEvent,
|
RoleAssignedEvent,
|
||||||
RoleCreatedEvent,
|
RoleCreatedEvent,
|
||||||
|
@ -14,25 +14,25 @@ import {
|
||||||
|
|
||||||
export function created(role: Role) {
|
export function created(role: Role) {
|
||||||
const properties: RoleCreatedEvent = {}
|
const properties: RoleCreatedEvent = {}
|
||||||
processEvent(Events.ROLE_CREATED, properties)
|
processEvent(Event.ROLE_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updated(role: Role) {
|
export function updated(role: Role) {
|
||||||
const properties: RoleUpdatedEvent = {}
|
const properties: RoleUpdatedEvent = {}
|
||||||
processEvent(Events.ROLE_UPDATED, properties)
|
processEvent(Event.ROLE_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(role: Role) {
|
export function deleted(role: Role) {
|
||||||
const properties: RoleDeletedEvent = {}
|
const properties: RoleDeletedEvent = {}
|
||||||
processEvent(Events.ROLE_DELETED, properties)
|
processEvent(Event.ROLE_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assigned(user: User, role: Role) {
|
export function assigned(user: User, role: Role) {
|
||||||
const properties: RoleAssignedEvent = {}
|
const properties: RoleAssignedEvent = {}
|
||||||
processEvent(Events.ROLE_ASSIGNED, properties)
|
processEvent(Event.ROLE_ASSIGNED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unassigned(user: User, role: Role) {
|
export function unassigned(user: User, role: Role) {
|
||||||
const properties: RoleUnassignedEvent = {}
|
const properties: RoleUnassignedEvent = {}
|
||||||
processEvent(Events.ROLE_UNASSIGNED, properties)
|
processEvent(Event.ROLE_UNASSIGNED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
RowImportedEvent,
|
RowImportedEvent,
|
||||||
RowImportFormat,
|
RowImportFormat,
|
||||||
Table,
|
Table,
|
||||||
|
@ -19,5 +19,5 @@ export const imported = (
|
||||||
count: number
|
count: number
|
||||||
) => {
|
) => {
|
||||||
const properties: RowImportedEvent = {}
|
const properties: RowImportedEvent = {}
|
||||||
processEvent(Events.ROW_IMPORT, properties)
|
processEvent(Event.ROW_IMPORT, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
Screen,
|
Screen,
|
||||||
ScreenCreatedEvent,
|
ScreenCreatedEvent,
|
||||||
ScreenDeletedEvent,
|
ScreenDeletedEvent,
|
||||||
|
@ -8,10 +8,10 @@ import {
|
||||||
|
|
||||||
export function created(screen: Screen) {
|
export function created(screen: Screen) {
|
||||||
const properties: ScreenCreatedEvent = {}
|
const properties: ScreenCreatedEvent = {}
|
||||||
processEvent(Events.SCREEN_CREATED, properties)
|
processEvent(Event.SCREEN_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(screen: Screen) {
|
export function deleted(screen: Screen) {
|
||||||
const properties: ScreenDeletedEvent = {}
|
const properties: ScreenDeletedEvent = {}
|
||||||
processEvent(Events.SCREEN_DELETED, properties)
|
processEvent(Event.SCREEN_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
App,
|
App,
|
||||||
BuilderServedEvent,
|
BuilderServedEvent,
|
||||||
Events,
|
Event,
|
||||||
AppPreviewServedEvent,
|
AppPreviewServedEvent,
|
||||||
AppServedEvent,
|
AppServedEvent,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
@ -11,15 +11,15 @@ import {
|
||||||
|
|
||||||
export function servedBuilder(version: number) {
|
export function servedBuilder(version: number) {
|
||||||
const properties: BuilderServedEvent = {}
|
const properties: BuilderServedEvent = {}
|
||||||
processEvent(Events.SERVED_BUILDER, properties)
|
processEvent(Event.SERVED_BUILDER, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function servedApp(app: App) {
|
export function servedApp(app: App) {
|
||||||
const properties: AppServedEvent = {}
|
const properties: AppServedEvent = {}
|
||||||
processEvent(Events.SERVED_APP, properties)
|
processEvent(Event.SERVED_APP, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function servedAppPreview(app: App) {
|
export function servedAppPreview(app: App) {
|
||||||
const properties: AppPreviewServedEvent = {}
|
const properties: AppPreviewServedEvent = {}
|
||||||
processEvent(Events.SERVED_APP_PREVIEW, properties)
|
processEvent(Event.SERVED_APP_PREVIEW, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
TableExportFormat,
|
TableExportFormat,
|
||||||
TableImportFormat,
|
TableImportFormat,
|
||||||
Table,
|
Table,
|
||||||
|
@ -15,31 +15,31 @@ import {
|
||||||
|
|
||||||
export function created(table: Table) {
|
export function created(table: Table) {
|
||||||
const properties: TableCreatedEvent = {}
|
const properties: TableCreatedEvent = {}
|
||||||
processEvent(Events.TABLE_CREATED, properties)
|
processEvent(Event.TABLE_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updated(table: Table) {
|
export function updated(table: Table) {
|
||||||
const properties: TableUpdatedEvent = {}
|
const properties: TableUpdatedEvent = {}
|
||||||
processEvent(Events.TABLE_UPDATED, properties)
|
processEvent(Event.TABLE_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(table: Table) {
|
export function deleted(table: Table) {
|
||||||
const properties: TableDeletedEvent = {}
|
const properties: TableDeletedEvent = {}
|
||||||
processEvent(Events.TABLE_DELETED, properties)
|
processEvent(Event.TABLE_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function exported(table: Table, format: TableExportFormat) {
|
export function exported(table: Table, format: TableExportFormat) {
|
||||||
const properties: TableExportedEvent = {}
|
const properties: TableExportedEvent = {}
|
||||||
processEvent(Events.TABLE_EXPORTED, properties)
|
processEvent(Event.TABLE_EXPORTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function imported(table: Table, format: TableImportFormat) {
|
export function imported(table: Table, format: TableImportFormat) {
|
||||||
const properties: TableImportedEvent = {}
|
const properties: TableImportedEvent = {}
|
||||||
processEvent(Events.TABLE_IMPORTED, properties)
|
processEvent(Event.TABLE_IMPORTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
export function permissionUpdated() {
|
export function permissionUpdated() {
|
||||||
const properties = {}
|
const properties = {}
|
||||||
processEvent(Events.TABLE_PERMISSION_UPDATED, properties)
|
processEvent(Event.TABLE_PERMISSION_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
User,
|
User,
|
||||||
UserCreatedEvent,
|
UserCreatedEvent,
|
||||||
UserDeletedEvent,
|
UserDeletedEvent,
|
||||||
|
@ -19,71 +19,71 @@ import {
|
||||||
|
|
||||||
export function created(user: User) {
|
export function created(user: User) {
|
||||||
const properties: UserCreatedEvent = {}
|
const properties: UserCreatedEvent = {}
|
||||||
processEvent(Events.USER_CREATED, properties)
|
processEvent(Event.USER_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updated(user: User) {
|
export function updated(user: User) {
|
||||||
const properties: UserUpdatedEvent = {}
|
const properties: UserUpdatedEvent = {}
|
||||||
processEvent(Events.USER_UPDATED, properties)
|
processEvent(Event.USER_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted(user: User) {
|
export function deleted(user: User) {
|
||||||
const properties: UserDeletedEvent = {}
|
const properties: UserDeletedEvent = {}
|
||||||
processEvent(Events.USER_DELETED, properties)
|
processEvent(Event.USER_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PERMISSIONS
|
// PERMISSIONS
|
||||||
|
|
||||||
export function permissionAdminAssigned(user: User) {
|
export function permissionAdminAssigned(user: User) {
|
||||||
const properties: UserPermissionAssignedEvent = {}
|
const properties: UserPermissionAssignedEvent = {}
|
||||||
processEvent(Events.USER_PERMISSION_ADMIN_ASSIGNED, properties)
|
processEvent(Event.USER_PERMISSION_ADMIN_ASSIGNED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function permissionAdminRemoved(user: User) {
|
export function permissionAdminRemoved(user: User) {
|
||||||
const properties: UserPermissionRemovedEvent = {}
|
const properties: UserPermissionRemovedEvent = {}
|
||||||
processEvent(Events.USER_PERMISSION_ADMIN_REMOVED, properties)
|
processEvent(Event.USER_PERMISSION_ADMIN_REMOVED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function permissionBuilderAssigned(user: User) {
|
export function permissionBuilderAssigned(user: User) {
|
||||||
const properties: UserPermissionAssignedEvent = {}
|
const properties: UserPermissionAssignedEvent = {}
|
||||||
processEvent(Events.USER_PERMISSION_BUILDER_ASSIGNED, properties)
|
processEvent(Event.USER_PERMISSION_BUILDER_ASSIGNED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function permissionBuilderRemoved(user: User) {
|
export function permissionBuilderRemoved(user: User) {
|
||||||
const properties: UserPermissionRemovedEvent = {}
|
const properties: UserPermissionRemovedEvent = {}
|
||||||
processEvent(Events.USER_PERMISSION_BUILDER_REMOVED, properties)
|
processEvent(Event.USER_PERMISSION_BUILDER_REMOVED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// INVITE
|
// INVITE
|
||||||
|
|
||||||
export function invited(userInfo: any) {
|
export function invited(userInfo: any) {
|
||||||
const properties: UserInvitedEvent = {}
|
const properties: UserInvitedEvent = {}
|
||||||
processEvent(Events.USER_INVITED, properties)
|
processEvent(Event.USER_INVITED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function inviteAccepted(user: User) {
|
export function inviteAccepted(user: User) {
|
||||||
const properties: UserInviteAcceptedEvent = {}
|
const properties: UserInviteAcceptedEvent = {}
|
||||||
processEvent(Events.USER_INVITED_ACCEPTED, properties)
|
processEvent(Event.USER_INVITED_ACCEPTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PASSWORD
|
// PASSWORD
|
||||||
|
|
||||||
export function passwordForceReset(user: User) {
|
export function passwordForceReset(user: User) {
|
||||||
const properties: UserPasswordForceResetEvent = {}
|
const properties: UserPasswordForceResetEvent = {}
|
||||||
processEvent(Events.USER_PASSWORD_FORCE_RESET, properties)
|
processEvent(Event.USER_PASSWORD_FORCE_RESET, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function passwordUpdated(user: User) {
|
export function passwordUpdated(user: User) {
|
||||||
const properties: UserPasswordUpdatedEvent = {}
|
const properties: UserPasswordUpdatedEvent = {}
|
||||||
processEvent(Events.USER_PASSWORD_UPDATED, properties)
|
processEvent(Event.USER_PASSWORD_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function passwordResetRequested(user: User) {
|
export function passwordResetRequested(user: User) {
|
||||||
const properties: UserPasswordResetRequestedEvent = {}
|
const properties: UserPasswordResetRequestedEvent = {}
|
||||||
processEvent(Events.USER_PASSWORD_RESET_REQUESTED, properties)
|
processEvent(Event.USER_PASSWORD_RESET_REQUESTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function passwordReset(user: User) {
|
export function passwordReset(user: User) {
|
||||||
const properties: UserPasswordResetEvent = {}
|
const properties: UserPasswordResetEvent = {}
|
||||||
processEvent(Events.USER_PASSWORD_RESET, properties)
|
processEvent(Event.USER_PASSWORD_RESET, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { processEvent } from "../events"
|
import { processEvent } from "../events"
|
||||||
import {
|
import {
|
||||||
Events,
|
Event,
|
||||||
ViewCalculationCreatedEvent,
|
ViewCalculationCreatedEvent,
|
||||||
ViewCalculationDeletedEvent,
|
ViewCalculationDeletedEvent,
|
||||||
ViewCalculationUpdatedEvent,
|
ViewCalculationUpdatedEvent,
|
||||||
|
@ -20,50 +20,50 @@ import {
|
||||||
|
|
||||||
export function created(view: View) {
|
export function created(view: View) {
|
||||||
const properties: ViewCreatedEvent = {}
|
const properties: ViewCreatedEvent = {}
|
||||||
processEvent(Events.VIEW_CREATED, properties)
|
processEvent(Event.VIEW_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updated(view: View) {
|
export function updated(view: View) {
|
||||||
const properties: ViewUpdatedEvent = {}
|
const properties: ViewUpdatedEvent = {}
|
||||||
processEvent(Events.VIEW_UPDATED, properties)
|
processEvent(Event.VIEW_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleted() {
|
export function deleted() {
|
||||||
const properties: ViewDeletedEvent = {}
|
const properties: ViewDeletedEvent = {}
|
||||||
processEvent(Events.VIEW_DELETED, properties)
|
processEvent(Event.VIEW_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function exported(table: Table, format: TableExportFormat) {
|
export function exported(table: Table, format: TableExportFormat) {
|
||||||
const properties: ViewExportedEvent = {}
|
const properties: ViewExportedEvent = {}
|
||||||
processEvent(Events.VIEW_EXPORTED, properties)
|
processEvent(Event.VIEW_EXPORTED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterCreated() {
|
export function filterCreated() {
|
||||||
const properties: ViewFilterCreatedEvent = {}
|
const properties: ViewFilterCreatedEvent = {}
|
||||||
processEvent(Events.VIEW_FILTER_CREATED, properties)
|
processEvent(Event.VIEW_FILTER_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterUpdated() {
|
export function filterUpdated() {
|
||||||
const properties: ViewFilterUpdatedEvent = {}
|
const properties: ViewFilterUpdatedEvent = {}
|
||||||
processEvent(Events.VIEW_FILTER_UPDATED, properties)
|
processEvent(Event.VIEW_FILTER_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterDeleted() {
|
export function filterDeleted() {
|
||||||
const properties: ViewFilterDeletedEvent = {}
|
const properties: ViewFilterDeletedEvent = {}
|
||||||
processEvent(Events.VIEW_FILTER_DELETED, properties)
|
processEvent(Event.VIEW_FILTER_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculationCreated() {
|
export function calculationCreated() {
|
||||||
const properties: ViewCalculationCreatedEvent = {}
|
const properties: ViewCalculationCreatedEvent = {}
|
||||||
processEvent(Events.VIEW_CALCULATION_CREATED, properties)
|
processEvent(Event.VIEW_CALCULATION_CREATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculationUpdated() {
|
export function calculationUpdated() {
|
||||||
const properties: ViewCalculationUpdatedEvent = {}
|
const properties: ViewCalculationUpdatedEvent = {}
|
||||||
processEvent(Events.VIEW_CALCULATION_UPDATED, properties)
|
processEvent(Event.VIEW_CALCULATION_UPDATED, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculationDeleted() {
|
export function calculationDeleted() {
|
||||||
const properties: ViewCalculationDeletedEvent = {}
|
const properties: ViewCalculationDeletedEvent = {}
|
||||||
processEvent(Events.VIEW_CALCULATION_DELETED, properties)
|
processEvent(Event.VIEW_CALCULATION_DELETED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,23 @@ import db from "./db"
|
||||||
import errors from "./errors"
|
import errors from "./errors"
|
||||||
import * as events from "./events"
|
import * as events from "./events"
|
||||||
import * as migrations from "./migrations"
|
import * as migrations from "./migrations"
|
||||||
|
import * as users from "./users"
|
||||||
|
import env from "./environment"
|
||||||
|
import accounts from "./cloud/accounts"
|
||||||
|
import tenancy from "./tenancy"
|
||||||
|
import featureFlags from "./featureFlags"
|
||||||
|
import analytics from "./analytics"
|
||||||
|
import sessions from "./security/sessions"
|
||||||
|
import deprovisioning from "./context/deprovision"
|
||||||
|
|
||||||
|
// outer packages
|
||||||
|
import dbPkg from "../db"
|
||||||
|
import redis from "../redis"
|
||||||
|
import objectStore from "../objectStore"
|
||||||
|
import utils from "../utils"
|
||||||
|
import cache from "../cache"
|
||||||
|
import auth from "../auth"
|
||||||
|
import constants from "../constants"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
init(opts: any = {}) {
|
init(opts: any = {}) {
|
||||||
|
@ -9,24 +26,24 @@ export = {
|
||||||
},
|
},
|
||||||
// some default exports from the library, however these ideally shouldn't
|
// some default exports from the library, however these ideally shouldn't
|
||||||
// be used, instead the syntax require("@budibase/backend-core/db") should be used
|
// be used, instead the syntax require("@budibase/backend-core/db") should be used
|
||||||
StaticDatabases: require("./db/utils").StaticDatabases,
|
StaticDatabases: dbPkg.StaticDatabases,
|
||||||
db: require("../db"),
|
db: dbPkg,
|
||||||
redis: require("../redis"),
|
redis,
|
||||||
objectStore: require("../objectStore"),
|
objectStore,
|
||||||
utils: require("../utils"),
|
utils,
|
||||||
users: require("./users"),
|
users,
|
||||||
cache: require("../cache"),
|
cache,
|
||||||
auth: require("../auth"),
|
auth,
|
||||||
constants: require("../constants"),
|
constants,
|
||||||
migrations,
|
migrations,
|
||||||
errors,
|
errors,
|
||||||
...errors.errors,
|
...errors.errors,
|
||||||
env: require("./environment"),
|
env,
|
||||||
accounts: require("./cloud/accounts"),
|
accounts,
|
||||||
tenancy: require("./tenancy"),
|
tenancy,
|
||||||
featureFlags: require("./featureFlags"),
|
featureFlags,
|
||||||
events,
|
events,
|
||||||
analytics: require("./analytics"),
|
analytics,
|
||||||
sessions: require("./security/sessions"),
|
sessions,
|
||||||
deprovisioning: require("./context/deprovision"),
|
deprovisioning,
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ process.on("SIGTERM", () => {
|
||||||
|
|
||||||
// run migrations on startup if not done via http
|
// run migrations on startup if not done via http
|
||||||
// not recommended in a clustered environment
|
// not recommended in a clustered environment
|
||||||
if (!env.HTTP_MIGRATIONS) {
|
if (!env.HTTP_MIGRATIONS && !env.isTest()) {
|
||||||
migrations.migrate().catch(err => {
|
migrations.migrate().catch(err => {
|
||||||
console.error("Error performing migrations. Exiting.\n", err)
|
console.error("Error performing migrations. Exiting.\n", err)
|
||||||
shutdown()
|
shutdown()
|
||||||
|
|
|
@ -8,4 +8,6 @@ import * as app from "./app/app"
|
||||||
* Backfill app events.
|
* Backfill app events.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const run = async (db: any) => {}
|
export const run = async (appDb: any) => {
|
||||||
|
await app.backfill(appDb)
|
||||||
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
export const backfillAppCreated = () => {}
|
import { events, db } from "@budibase/backend-core"
|
||||||
|
import { App } from "@budibase/types"
|
||||||
|
|
||||||
export const backfillAppPublished = () => {}
|
export const backfill = async (appDb: any) => {
|
||||||
|
const app: App = await appDb.get(db.DocumentTypes.APP_METADATA)
|
||||||
// APP_CREATED = "app:created",
|
if (db.isDevAppID(app.appId)) {
|
||||||
// APP_PUBLISHED = "app:published",
|
events.app.created(app)
|
||||||
|
}
|
||||||
// Maybe
|
if (db.isProdAppID(app.appId)) {
|
||||||
// APP_TEMPLATE_IMPORTED = "app:template:imported",
|
events.app.published(app)
|
||||||
// APP_FILE_IMPORTED = "app:file:imported",
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import * as syncPublishedApps from "../usageQuotas/syncPublishedApps"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date:
|
* Date:
|
||||||
* May 2022
|
* May 2022
|
|
@ -0,0 +1,2 @@
|
||||||
|
export * as app from "./app"
|
||||||
|
export * as global from "./global"
|
|
@ -6,6 +6,7 @@ import * as quota1 from "./functions/quotas1"
|
||||||
import * as appUrls from "./functions/appUrls"
|
import * as appUrls from "./functions/appUrls"
|
||||||
import * as developerQuota from "./functions/developerQuota"
|
import * as developerQuota from "./functions/developerQuota"
|
||||||
import * as publishedAppsQuota from "./functions/publishedAppsQuota"
|
import * as publishedAppsQuota from "./functions/publishedAppsQuota"
|
||||||
|
import * as backfill from "./functions/backfill"
|
||||||
|
|
||||||
export interface Migration {
|
export interface Migration {
|
||||||
type: string
|
type: string
|
||||||
|
@ -59,13 +60,14 @@ export const MIGRATIONS: Migration[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: migrations.MIGRATION_TYPES.GLOBAL,
|
type: migrations.MIGRATION_TYPES.GLOBAL,
|
||||||
name: "event_backfill",
|
name: "event_global_backfill",
|
||||||
fn: publishedAppsQuota.run,
|
fn: backfill.global.run,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: migrations.MIGRATION_TYPES.APP,
|
type: migrations.MIGRATION_TYPES.APP,
|
||||||
name: "event_app_backfill",
|
name: "event_app_backfill",
|
||||||
fn: publishedAppsQuota.run,
|
opts: { all: true },
|
||||||
|
fn: backfill.app.run,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
export enum Hosting {
|
||||||
|
CLOUD = "cloud",
|
||||||
|
SELF = "self",
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "./hosting"
|
|
@ -1 +1,6 @@
|
||||||
export interface Account {}
|
import { Hosting } from "../../core"
|
||||||
|
|
||||||
|
export interface Account {
|
||||||
|
accountId: string
|
||||||
|
hosting: Hosting
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum Events {
|
export enum Event {
|
||||||
// USER
|
// USER
|
||||||
USER_CREATED = "user:created",
|
USER_CREATED = "user:created",
|
||||||
USER_UPDATED = "user:updated",
|
USER_UPDATED = "user:updated",
|
||||||
|
@ -140,6 +140,12 @@ export enum Events {
|
||||||
ACCOUNT_VERIFIED = "account:verified",
|
ACCOUNT_VERIFIED = "account:verified",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum IdentityType {
|
||||||
|
TENANT = "tenant",
|
||||||
|
USER = "user",
|
||||||
|
ACCOUNT = "account",
|
||||||
|
}
|
||||||
|
|
||||||
export type RowImportFormat = "csv"
|
export type RowImportFormat = "csv"
|
||||||
export type TableExportFormat = "json" | "csv"
|
export type TableExportFormat = "json" | "csv"
|
||||||
export type TableImportFormat = "csv"
|
export type TableImportFormat = "csv"
|
|
@ -3,7 +3,7 @@ export * from "./auth"
|
||||||
export * from "./automation"
|
export * from "./automation"
|
||||||
export * from "./config"
|
export * from "./config"
|
||||||
export * from "./datasource"
|
export * from "./datasource"
|
||||||
export * from "./events"
|
export * from "./event"
|
||||||
export * from "./layout"
|
export * from "./layout"
|
||||||
export * from "./license"
|
export * from "./license"
|
||||||
export * from "./org"
|
export * from "./org"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
export * from "./documents"
|
export * from "./documents"
|
||||||
export * from "./events"
|
export * from "./events"
|
||||||
export * from "./licensing"
|
export * from "./licensing"
|
||||||
|
export * from "./core"
|
||||||
|
|
Loading…
Reference in New Issue