forked from tsai/budibase
67 changed files with 851 additions and 268 deletions
@ -0,0 +1,183 @@ |
|||||
|
import { UserPermissionAssignedEvent } from "./../../../types/src/events/user" |
||||
|
import { |
||||
|
Event, |
||||
|
BackfillMetadata, |
||||
|
CachedEvent, |
||||
|
SSOCreatedEvent, |
||||
|
AutomationCreatedEvent, |
||||
|
AutomationStepCreatedEvent, |
||||
|
DatasourceCreatedEvent, |
||||
|
LayoutCreatedEvent, |
||||
|
QueryCreatedEvent, |
||||
|
RoleCreatedEvent, |
||||
|
ScreenCreatedEvent, |
||||
|
TableCreatedEvent, |
||||
|
ViewCreatedEvent, |
||||
|
ViewCalculationCreatedEvent, |
||||
|
ViewFilterCreatedEvent, |
||||
|
AppPublishedEvent, |
||||
|
UserCreatedEvent, |
||||
|
RoleAssignedEvent, |
||||
|
RowsCreatedEvent, |
||||
|
} from "@budibase/types" |
||||
|
import * as context from "../context" |
||||
|
import { CacheKeys } from "../cache/generic" |
||||
|
import * as cache from "../cache/generic" |
||||
|
|
||||
|
// LIFECYCLE
|
||||
|
|
||||
|
export const start = async (events: Event[]) => { |
||||
|
const metadata: BackfillMetadata = { |
||||
|
eventWhitelist: events, |
||||
|
} |
||||
|
return saveBackfillMetadata(metadata) |
||||
|
} |
||||
|
|
||||
|
export const recordEvent = async (event: Event, properties: any) => { |
||||
|
const eventKey = getEventKey(event, properties) |
||||
|
// don't use a ttl - cleaned up by migration
|
||||
|
// don't use tenancy - already in the key
|
||||
|
await cache.store(eventKey, properties, undefined, { useTenancy: false }) |
||||
|
} |
||||
|
|
||||
|
export const end = async () => { |
||||
|
await deleteBackfillMetadata() |
||||
|
await clearEvents() |
||||
|
} |
||||
|
|
||||
|
// CRUD
|
||||
|
|
||||
|
const getBackfillMetadata = async (): Promise<BackfillMetadata | null> => { |
||||
|
return cache.get(CacheKeys.BACKFILL_METADATA) |
||||
|
} |
||||
|
|
||||
|
const saveBackfillMetadata = async ( |
||||
|
backfill: BackfillMetadata |
||||
|
): Promise<void> => { |
||||
|
// no TTL - deleted by backfill
|
||||
|
return cache.store(CacheKeys.BACKFILL_METADATA, backfill) |
||||
|
} |
||||
|
|
||||
|
const deleteBackfillMetadata = async (): Promise<void> => { |
||||
|
await cache.delete(CacheKeys.BACKFILL_METADATA) |
||||
|
} |
||||
|
|
||||
|
const clearEvents = async () => { |
||||
|
// wildcard
|
||||
|
const pattern = getEventKey() |
||||
|
const keys = await cache.keys(pattern) |
||||
|
|
||||
|
for (const key of keys) { |
||||
|
// delete each key
|
||||
|
// don't use tenancy, already in the key
|
||||
|
await cache.delete(key, { useTenancy: false }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// HELPERS
|
||||
|
|
||||
|
export const isBackfillingEvent = async (event: Event) => { |
||||
|
const backfill = await getBackfillMetadata() |
||||
|
const events = backfill?.eventWhitelist |
||||
|
if (events && events.includes(event)) { |
||||
|
return true |
||||
|
} else { |
||||
|
return false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export const isAlreadySent = async (event: Event, properties: any) => { |
||||
|
const eventKey = getEventKey(event, properties) |
||||
|
const cachedEvent: CachedEvent = await cache.get(eventKey, { |
||||
|
useTenancy: false, |
||||
|
}) |
||||
|
return !!cachedEvent |
||||
|
} |
||||
|
|
||||
|
const CUSTOM_PROPERTY_SUFFIX: any = { |
||||
|
// APP EVENTS
|
||||
|
[Event.AUTOMATION_CREATED]: (properties: AutomationCreatedEvent) => { |
||||
|
return properties.automationId |
||||
|
}, |
||||
|
[Event.AUTOMATION_STEP_CREATED]: (properties: AutomationStepCreatedEvent) => { |
||||
|
return properties.stepId |
||||
|
}, |
||||
|
[Event.DATASOURCE_CREATED]: (properties: DatasourceCreatedEvent) => { |
||||
|
return properties.datasourceId |
||||
|
}, |
||||
|
[Event.LAYOUT_CREATED]: (properties: LayoutCreatedEvent) => { |
||||
|
return properties.layoutId |
||||
|
}, |
||||
|
[Event.QUERY_CREATED]: (properties: QueryCreatedEvent) => { |
||||
|
return properties.queryId |
||||
|
}, |
||||
|
[Event.ROLE_CREATED]: (properties: RoleCreatedEvent) => { |
||||
|
return properties.roleId |
||||
|
}, |
||||
|
[Event.SCREEN_CREATED]: (properties: ScreenCreatedEvent) => { |
||||
|
return properties.screenId |
||||
|
}, |
||||
|
[Event.TABLE_CREATED]: (properties: TableCreatedEvent) => { |
||||
|
return properties.tableId |
||||
|
}, |
||||
|
[Event.VIEW_CREATED]: (properties: ViewCreatedEvent) => { |
||||
|
return properties.tableId // best uniqueness
|
||||
|
}, |
||||
|
[Event.VIEW_CALCULATION_CREATED]: ( |
||||
|
properties: ViewCalculationCreatedEvent |
||||
|
) => { |
||||
|
return properties.tableId // best uniqueness
|
||||
|
}, |
||||
|
[Event.VIEW_FILTER_CREATED]: (properties: ViewFilterCreatedEvent) => { |
||||
|
return properties.tableId // best uniqueness
|
||||
|
}, |
||||
|
[Event.APP_PUBLISHED]: (properties: AppPublishedEvent) => { |
||||
|
return properties.appId // best uniqueness
|
||||
|
}, |
||||
|
[Event.APP_PUBLISHED]: (properties: AppPublishedEvent) => { |
||||
|
return properties.appId // best uniqueness
|
||||
|
}, |
||||
|
// GLOBAL EVENTS
|
||||
|
[Event.AUTH_SSO_CREATED]: (properties: SSOCreatedEvent) => { |
||||
|
return properties.type |
||||
|
}, |
||||
|
[Event.AUTH_SSO_ACTIVATED]: (properties: SSOCreatedEvent) => { |
||||
|
return properties.type |
||||
|
}, |
||||
|
[Event.USER_CREATED]: (properties: UserCreatedEvent) => { |
||||
|
return properties.userId |
||||
|
}, |
||||
|
[Event.USER_PERMISSION_ADMIN_ASSIGNED]: ( |
||||
|
properties: UserPermissionAssignedEvent |
||||
|
) => { |
||||
|
return properties.userId |
||||
|
}, |
||||
|
[Event.USER_PERMISSION_BUILDER_ASSIGNED]: ( |
||||
|
properties: UserPermissionAssignedEvent |
||||
|
) => { |
||||
|
return properties.userId |
||||
|
}, |
||||
|
[Event.ROLE_ASSIGNED]: (properties: RoleAssignedEvent) => { |
||||
|
return `${properties.roleId}-${properties.userId}` |
||||
|
}, |
||||
|
} |
||||
|
|
||||
|
const getEventKey = (event?: Event, properties?: any) => { |
||||
|
let eventKey: string |
||||
|
|
||||
|
const tenantId = context.getTenantId() |
||||
|
if (event) { |
||||
|
eventKey = `${CacheKeys.EVENTS}:${tenantId}:${event}` |
||||
|
|
||||
|
// use some properties to make the key more unique
|
||||
|
const custom = CUSTOM_PROPERTY_SUFFIX[event] |
||||
|
const suffix = custom ? custom(properties) : undefined |
||||
|
if (suffix) { |
||||
|
eventKey = `${event}:${suffix}` |
||||
|
} |
||||
|
} else { |
||||
|
eventKey = `${CacheKeys.EVENTS}:${tenantId}:*` |
||||
|
} |
||||
|
|
||||
|
return eventKey |
||||
|
} |
||||
@ -1,20 +1,12 @@ |
|||||
import { publishEvent } from "../events" |
import { publishEvent } from "../events" |
||||
import { |
import { Event, SMTPCreatedEvent, SMTPUpdatedEvent } from "@budibase/types" |
||||
Event, |
|
||||
SMTPConfig, |
|
||||
SMTPCreatedEvent, |
|
||||
SMTPUpdatedEvent, |
|
||||
} from "@budibase/types" |
|
||||
|
|
||||
export async function SMTPCreated( |
export async function SMTPCreated(timestamp?: string | number) { |
||||
config: SMTPConfig, |
|
||||
timestamp?: string | number |
|
||||
) { |
|
||||
const properties: SMTPCreatedEvent = {} |
const properties: SMTPCreatedEvent = {} |
||||
await publishEvent(Event.EMAIL_SMTP_CREATED, properties, timestamp) |
await publishEvent(Event.EMAIL_SMTP_CREATED, properties, timestamp) |
||||
} |
} |
||||
|
|
||||
export async function SMTPUpdated(config: SMTPConfig) { |
export async function SMTPUpdated() { |
||||
const properties: SMTPUpdatedEvent = {} |
const properties: SMTPUpdatedEvent = {} |
||||
await publishEvent(Event.EMAIL_SMTP_UPDATED, properties) |
await publishEvent(Event.EMAIL_SMTP_UPDATED, properties) |
||||
} |
} |
||||
|
|||||
@ -1,7 +1,6 @@ |
|||||
const events = require("./events") |
require("./events") |
||||
const date = require("./date") |
const date = require("./date") |
||||
|
|
||||
module.exports = { |
module.exports = { |
||||
events, |
|
||||
date, |
date, |
||||
} |
} |
||||
|
|||||
@ -1,13 +1,17 @@ |
|||||
|
require("./utilities/TestConfiguration") |
||||
const { structures } = require("./utilities") |
const { structures } = require("./utilities") |
||||
const utils = require("../utils") |
const utils = require("../utils") |
||||
const events = require("../events") |
const events = require("../events") |
||||
|
const { doInTenant, DEFAULT_TENANT_ID }= require("../context") |
||||
|
|
||||
describe("utils", () => { |
describe("utils", () => { |
||||
describe("platformLogout", () => { |
describe("platformLogout", () => { |
||||
it("should call platform logout", async () => { |
it("should call platform logout", async () => { |
||||
const ctx = structures.koa.newContext() |
await doInTenant(DEFAULT_TENANT_ID, async () => { |
||||
await utils.platformLogout({ ctx, userId: "test" }) |
const ctx = structures.koa.newContext() |
||||
expect(events.auth.logout).toBeCalledTimes(1) |
await utils.platformLogout({ ctx, userId: "test" }) |
||||
|
expect(events.auth.logout).toBeCalledTimes(1) |
||||
|
}) |
||||
}) |
}) |
||||
}) |
}) |
||||
}) |
}) |
||||
@ -1,7 +1,8 @@ |
|||||
import { events } from "@budibase/backend-core" |
import { events } from "@budibase/backend-core" |
||||
|
|
||||
export const isEnabled = async (ctx: any) => { |
export const isEnabled = async (ctx: any) => { |
||||
|
const enabled = await events.analytics.enabled() |
||||
ctx.body = { |
ctx.body = { |
||||
enabled: events.analytics.enabled(), |
enabled, |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,3 +0,0 @@ |
|||||
const utils = require("@budibase/backend-core/testUtils") |
|
||||
const core = require("@budibase/backend-core") |
|
||||
core.events = utils.mocks.events |
|
||||
@ -1 +0,0 @@ |
|||||
require("./core") |
|
||||
@ -1,3 +1,6 @@ |
|||||
import { Document } from "../document" |
import { Document } from "../document" |
||||
|
|
||||
export interface Role extends Document {} |
export interface Role extends Document { |
||||
|
permissionId: string |
||||
|
inherits: string |
||||
|
} |
||||
|
|||||
@ -1,3 +1,9 @@ |
|||||
import { Document } from "../document" |
import { Document } from "../document" |
||||
|
|
||||
export interface Screen extends Document {} |
export interface Screen extends Document { |
||||
|
layoutId: string |
||||
|
routing: { |
||||
|
route: string |
||||
|
roleId: string |
||||
|
} |
||||
|
} |
||||
|
|||||
@ -1,13 +1,15 @@ |
|||||
export interface AccountCreatedEvent { |
import { BaseEvent } from "./event" |
||||
|
|
||||
|
export interface AccountCreatedEvent extends BaseEvent { |
||||
tenantId: string |
tenantId: string |
||||
registrationStep?: string |
registrationStep?: string |
||||
} |
} |
||||
|
|
||||
export interface AccountDeletedEvent { |
export interface AccountDeletedEvent extends BaseEvent { |
||||
tenantId: string |
tenantId: string |
||||
registrationStep?: string |
registrationStep?: string |
||||
} |
} |
||||
|
|
||||
export interface AccountVerifiedEvent { |
export interface AccountVerifiedEvent extends BaseEvent { |
||||
tenantId: string |
tenantId: string |
||||
} |
} |
||||
|
|||||
@ -1,50 +1,52 @@ |
|||||
export interface AppCreatedEvent { |
import { BaseEvent } from "./event" |
||||
|
|
||||
|
export interface AppCreatedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
version: string |
version: string |
||||
} |
} |
||||
|
|
||||
export interface AppUpdatedEvent { |
export interface AppUpdatedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
version: string |
version: string |
||||
} |
} |
||||
|
|
||||
export interface AppDeletedEvent { |
export interface AppDeletedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
} |
} |
||||
|
|
||||
export interface AppPublishedEvent { |
export interface AppPublishedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
} |
} |
||||
|
|
||||
export interface AppUnpublishedEvent { |
export interface AppUnpublishedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
} |
} |
||||
|
|
||||
export interface AppFileImportedEvent { |
export interface AppFileImportedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
} |
} |
||||
|
|
||||
export interface AppTemplateImportedEvent { |
export interface AppTemplateImportedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
templateKey: string |
templateKey: string |
||||
} |
} |
||||
|
|
||||
export interface AppVersionUpdatedEvent { |
export interface AppVersionUpdatedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
currentVersion: string |
currentVersion: string |
||||
updatedToVersion: string |
updatedToVersion: string |
||||
} |
} |
||||
|
|
||||
export interface AppVersionRevertedEvent { |
export interface AppVersionRevertedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
currentVersion: string |
currentVersion: string |
||||
revertedToVersion: string |
revertedToVersion: string |
||||
} |
} |
||||
|
|
||||
export interface AppRevertedEvent { |
export interface AppRevertedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
} |
} |
||||
|
|
||||
export interface AppExportedEvent { |
export interface AppExportedEvent extends BaseEvent { |
||||
appId: string |
appId: string |
||||
} |
} |
||||
|
|||||
@ -1,27 +1,29 @@ |
|||||
|
import { BaseEvent } from "./event" |
||||
|
|
||||
export type LoginSource = "local" | "google" | "oidc" | "google-internal" |
export type LoginSource = "local" | "google" | "oidc" | "google-internal" |
||||
export type SSOType = "oidc" | "google" |
export type SSOType = "oidc" | "google" |
||||
|
|
||||
export interface LoginEvent { |
export interface LoginEvent extends BaseEvent { |
||||
userId: string |
userId: string |
||||
source: LoginSource |
source: LoginSource |
||||
} |
} |
||||
|
|
||||
export interface LogoutEvent { |
export interface LogoutEvent extends BaseEvent { |
||||
userId: string |
userId: string |
||||
} |
} |
||||
|
|
||||
export interface SSOCreatedEvent { |
export interface SSOCreatedEvent extends BaseEvent { |
||||
type: SSOType |
type: SSOType |
||||
} |
} |
||||
|
|
||||
export interface SSOUpdatedEvent { |
export interface SSOUpdatedEvent extends BaseEvent { |
||||
type: SSOType |
type: SSOType |
||||
} |
} |
||||
|
|
||||
export interface SSOActivatedEvent { |
export interface SSOActivatedEvent extends BaseEvent { |
||||
type: SSOType |
type: SSOType |
||||
} |
} |
||||
|
|
||||
export interface SSODeactivatedEvent { |
export interface SSODeactivatedEvent extends BaseEvent { |
||||
type: SSOType |
type: SSOType |
||||
} |
} |
||||
|
|||||
@ -1,3 +0,0 @@ |
|||||
export interface SMTPCreatedEvent {} |
|
||||
|
|
||||
export interface SMTPUpdatedEvent {} |
|
||||
@ -1,14 +1,16 @@ |
|||||
export interface DatasourceCreatedEvent { |
import { BaseEvent } from "./event" |
||||
|
|
||||
|
export interface DatasourceCreatedEvent extends BaseEvent { |
||||
datasourceId: string |
datasourceId: string |
||||
source: string |
source: string |
||||
} |
} |
||||
|
|
||||
export interface DatasourceUpdatedEvent { |
export interface DatasourceUpdatedEvent extends BaseEvent { |
||||
datasourceId: string |
datasourceId: string |
||||
source: string |
source: string |
||||
} |
} |
||||
|
|
||||
export interface DatasourceDeletedEvent { |
export interface DatasourceDeletedEvent extends BaseEvent { |
||||
datasourceId: string |
datasourceId: string |
||||
source: string |
source: string |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,5 @@ |
|||||
|
import { BaseEvent } from "./event" |
||||
|
|
||||
|
export interface SMTPCreatedEvent extends BaseEvent {} |
||||
|
|
||||
|
export interface SMTPUpdatedEvent extends BaseEvent {} |
||||
@ -1,7 +1,9 @@ |
|||||
export interface LayoutCreatedEvent { |
import { BaseEvent } from "./event" |
||||
|
|
||||
|
export interface LayoutCreatedEvent extends BaseEvent { |
||||
layoutId: string |
layoutId: string |
||||
} |
} |
||||
|
|
||||
export interface LayoutDeletedEvent { |
export interface LayoutDeletedEvent extends BaseEvent { |
||||
layoutId: string |
layoutId: string |
||||
} |
} |
||||
|
|||||
@ -1,13 +1,40 @@ |
|||||
export interface QueryCreatedEvent {} |
import { BaseEvent } from "./event" |
||||
|
|
||||
export interface QueryUpdatedEvent {} |
export interface QueryCreatedEvent extends BaseEvent { |
||||
|
queryId: string |
||||
|
datasourceId: string |
||||
|
source: string |
||||
|
queryVerb: string |
||||
|
} |
||||
|
|
||||
export interface QueryDeletedEvent {} |
export interface QueryUpdatedEvent extends BaseEvent { |
||||
|
queryId: string |
||||
|
datasourceId: string |
||||
|
source: string |
||||
|
queryVerb: string |
||||
|
} |
||||
|
|
||||
export interface QueryImportedEvent {} |
export interface QueryDeletedEvent extends BaseEvent { |
||||
|
queryId: string |
||||
|
datasourceId: string |
||||
|
source: string |
||||
|
queryVerb: string |
||||
|
} |
||||
|
|
||||
export interface QueryPreviewedEvent {} |
export interface QueryImportedEvent extends BaseEvent { |
||||
|
datasourceId: string |
||||
|
source: string |
||||
|
count: number |
||||
|
importSource: string |
||||
|
} |
||||
|
|
||||
|
export interface QueryPreviewedEvent extends BaseEvent { |
||||
|
queryId?: string |
||||
|
datasourceId: string |
||||
|
source: string |
||||
|
queryVerb: string |
||||
|
} |
||||
|
|
||||
export interface QueriesRunEvent { |
export interface QueriesRunEvent extends BaseEvent { |
||||
count: number |
count: number |
||||
} |
} |
||||
|
|||||
@ -1,9 +1,29 @@ |
|||||
export interface RoleCreatedEvent {} |
import { BaseEvent } from "./event" |
||||
|
|
||||
export interface RoleUpdatedEvent {} |
export interface RoleCreatedEvent extends BaseEvent { |
||||
|
roleId: string |
||||
|
permissionId: string |
||||
|
inherits: string |
||||
|
} |
||||
|
|
||||
export interface RoleDeletedEvent {} |
export interface RoleUpdatedEvent extends BaseEvent { |
||||
|
roleId: string |
||||
|
permissionId: string |
||||
|
inherits: string |
||||
|
} |
||||
|
|
||||
export interface RoleAssignedEvent {} |
export interface RoleDeletedEvent extends BaseEvent { |
||||
|
roleId: string |
||||
|
permissionId: string |
||||
|
inherits: string |
||||
|
} |
||||
|
|
||||
export interface RoleUnassignedEvent {} |
export interface RoleAssignedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
roleId: string |
||||
|
} |
||||
|
|
||||
|
export interface RoleUnassignedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
roleId: string |
||||
|
} |
||||
|
|||||
@ -1,5 +1,11 @@ |
|||||
export interface RowsImportedEvent {} |
import { BaseEvent, RowImportFormat } from "./event" |
||||
|
|
||||
export interface RowsCreatedEvent { |
export interface RowsImportedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
format: RowImportFormat |
||||
|
count: number |
||||
|
} |
||||
|
|
||||
|
export interface RowsCreatedEvent extends BaseEvent { |
||||
count: number |
count: number |
||||
} |
} |
||||
|
|||||
@ -1,3 +1,13 @@ |
|||||
export interface ScreenCreatedEvent {} |
import { BaseEvent } from "./event" |
||||
|
|
||||
export interface ScreenDeletedEvent {} |
export interface ScreenCreatedEvent extends BaseEvent { |
||||
|
screenId: string |
||||
|
layoutId: string |
||||
|
roleId: string |
||||
|
} |
||||
|
|
||||
|
export interface ScreenDeletedEvent extends BaseEvent { |
||||
|
screenId: string |
||||
|
layoutId: string |
||||
|
roleId: string |
||||
|
} |
||||
|
|||||
@ -1,11 +1,11 @@ |
|||||
export interface BuilderServedEvent {} |
import { BaseEvent } from "./event" |
||||
|
|
||||
export interface AppServedEvent { |
export interface BuilderServedEvent extends BaseEvent {} |
||||
appId: string |
|
||||
|
export interface AppServedEvent extends BaseEvent { |
||||
appVersion: string |
appVersion: string |
||||
} |
} |
||||
|
|
||||
export interface AppPreviewServedEvent { |
export interface AppPreviewServedEvent extends BaseEvent { |
||||
appId: string |
|
||||
appVersion: string |
appVersion: string |
||||
} |
} |
||||
|
|||||
@ -1,9 +1,23 @@ |
|||||
export interface TableCreatedEvent {} |
import { BaseEvent, TableExportFormat, TableImportFormat } from "./event" |
||||
|
|
||||
export interface TableUpdatedEvent {} |
export interface TableCreatedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
} |
||||
|
|
||||
export interface TableDeletedEvent {} |
export interface TableUpdatedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
} |
||||
|
|
||||
export interface TableExportedEvent {} |
export interface TableDeletedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
} |
||||
|
|
||||
export interface TableImportedEvent {} |
export interface TableExportedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
format: TableExportFormat |
||||
|
} |
||||
|
|
||||
|
export interface TableImportedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
format: TableImportFormat |
||||
|
} |
||||
|
|||||
@ -1,21 +1,43 @@ |
|||||
export interface UserCreatedEvent {} |
import { BaseEvent } from "./event" |
||||
|
|
||||
export interface UserUpdatedEvent {} |
export interface UserCreatedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserDeletedEvent {} |
export interface UserUpdatedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserPermissionAssignedEvent {} |
export interface UserDeletedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserPermissionRemovedEvent {} |
export interface UserPermissionAssignedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserInvitedEvent {} |
export interface UserPermissionRemovedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserInviteAcceptedEvent {} |
export interface UserInvitedEvent extends BaseEvent {} |
||||
|
|
||||
export interface UserPasswordForceResetEvent {} |
export interface UserInviteAcceptedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserPasswordUpdatedEvent {} |
export interface UserPasswordForceResetEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserPasswordResetRequestedEvent {} |
export interface UserPasswordUpdatedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
export interface UserPasswordResetEvent {} |
export interface UserPasswordResetRequestedEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|
||||
|
export interface UserPasswordResetEvent extends BaseEvent { |
||||
|
userId: string |
||||
|
} |
||||
|
|||||
@ -1,8 +1,10 @@ |
|||||
export interface VersionCheckedEvent { |
import { BaseEvent } from "./event" |
||||
|
|
||||
|
export interface VersionCheckedEvent extends BaseEvent { |
||||
currentVersion: string |
currentVersion: string |
||||
} |
} |
||||
|
|
||||
export interface VersionChangeEvent { |
export interface VersionChangeEvent extends BaseEvent { |
||||
from: string |
from: string |
||||
to: string |
to: string |
||||
} |
} |
||||
|
|||||
@ -1,19 +1,46 @@ |
|||||
export interface ViewCreatedEvent {} |
import { ViewCalculation } from "../documents" |
||||
|
import { BaseEvent, TableExportFormat } from "./event" |
||||
export interface ViewUpdatedEvent {} |
|
||||
|
export interface ViewCreatedEvent extends BaseEvent { |
||||
export interface ViewDeletedEvent {} |
tableId: string |
||||
|
} |
||||
export interface ViewExportedEvent {} |
|
||||
|
export interface ViewUpdatedEvent extends BaseEvent { |
||||
export interface ViewFilterCreatedEvent {} |
tableId: string |
||||
|
} |
||||
export interface ViewFilterUpdatedEvent {} |
|
||||
|
export interface ViewDeletedEvent extends BaseEvent { |
||||
export interface ViewFilterDeletedEvent {} |
tableId: string |
||||
|
} |
||||
export interface ViewCalculationCreatedEvent {} |
|
||||
|
export interface ViewExportedEvent extends BaseEvent { |
||||
export interface ViewCalculationUpdatedEvent {} |
tableId: string |
||||
|
format: TableExportFormat |
||||
export interface ViewCalculationDeletedEvent {} |
} |
||||
|
|
||||
|
export interface ViewFilterCreatedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
} |
||||
|
|
||||
|
export interface ViewFilterUpdatedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
} |
||||
|
|
||||
|
export interface ViewFilterDeletedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
} |
||||
|
|
||||
|
export interface ViewCalculationCreatedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
calculation: ViewCalculation |
||||
|
} |
||||
|
|
||||
|
export interface ViewCalculationUpdatedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
calculation: ViewCalculation |
||||
|
} |
||||
|
|
||||
|
export interface ViewCalculationDeletedEvent extends BaseEvent { |
||||
|
tableId: string |
||||
|
calculation: ViewCalculation |
||||
|
} |
||||
|
|||||
@ -1,3 +0,0 @@ |
|||||
const utils = require("@budibase/backend-core/testUtils") |
|
||||
const core = require("@budibase/backend-core") |
|
||||
core.events = utils.mocks.events |
|
||||
Loading…
Reference in new issue