diff --git a/packages/backend-core/src/events/publishers/index.ts b/packages/backend-core/src/events/publishers/index.ts index 9c92b80499..aaec62f979 100644 --- a/packages/backend-core/src/events/publishers/index.ts +++ b/packages/backend-core/src/events/publishers/index.ts @@ -23,3 +23,4 @@ export { default as plugin } from "./plugin" export { default as backup } from "./backup" export { default as environmentVariable } from "./environmentVariable" export { default as auditLog } from "./auditLog" +export { default as rowAction } from "./rowAction" diff --git a/packages/backend-core/src/events/publishers/rowAction.ts b/packages/backend-core/src/events/publishers/rowAction.ts new file mode 100644 index 0000000000..5adfd22d2d --- /dev/null +++ b/packages/backend-core/src/events/publishers/rowAction.ts @@ -0,0 +1,13 @@ +import { publishEvent } from "../events" +import { Event, RowActionCreatedEvent } from "@budibase/types" + +async function created( + rowAction: RowActionCreatedEvent, + timestamp?: string | number +) { + await publishEvent(Event.TABLE_CREATED, rowAction, timestamp) +} + +export default { + created, +} diff --git a/packages/backend-core/src/events/publishers/view.ts b/packages/backend-core/src/events/publishers/view.ts index ccbf960b04..0ec8f67485 100644 --- a/packages/backend-core/src/events/publishers/view.ts +++ b/packages/backend-core/src/events/publishers/view.ts @@ -11,7 +11,7 @@ import { ViewFilterDeletedEvent, ViewFilterUpdatedEvent, ViewUpdatedEvent, - View, + ViewV2, ViewCalculation, Table, TableExportFormat, @@ -19,9 +19,10 @@ import { /* eslint-disable */ -async function created(view: View, timestamp?: string | number) { +async function created(view: Partial, timestamp?: string | number) { const properties: ViewCreatedEvent = { - tableId: view.tableId, + name: view.name, + type: view.type, } await publishEvent(Event.VIEW_CREATED, properties, timestamp) } diff --git a/packages/server/src/api/controllers/rowAction/crud.ts b/packages/server/src/api/controllers/rowAction/crud.ts index 3baaff6fcc..525fcabcfc 100644 --- a/packages/server/src/api/controllers/rowAction/crud.ts +++ b/packages/server/src/api/controllers/rowAction/crud.ts @@ -6,6 +6,7 @@ import { RowActionResponse, RowActionsResponse, } from "@budibase/types" +import { events } from "@budibase/backend-core" import sdk from "../../../sdk" async function getTable(ctx: Ctx) { @@ -59,6 +60,8 @@ export async function create( name: ctx.request.body.name, }) + await events.rowAction.created(createdAction) + ctx.body = { tableId, id: createdAction.id, diff --git a/packages/server/src/api/controllers/view/viewsV2.ts b/packages/server/src/api/controllers/view/viewsV2.ts index 986764a697..46c44ed577 100644 --- a/packages/server/src/api/controllers/view/viewsV2.ts +++ b/packages/server/src/api/controllers/view/viewsV2.ts @@ -16,6 +16,7 @@ import { CountDistinctCalculationFieldMetadata, CountCalculationFieldMetadata, } from "@budibase/types" +import { events } from "@budibase/backend-core" import { builderSocket, gridSocket } from "../../../websockets" import { helpers } from "@budibase/shared-core" @@ -149,6 +150,9 @@ export async function create(ctx: Ctx) { primaryDisplay: view.primaryDisplay, } const result = await sdk.views.create(tableId, parsedView) + + await events.view.created(view) + ctx.status = 201 ctx.body = { data: result, diff --git a/packages/types/src/sdk/events/index.ts b/packages/types/src/sdk/events/index.ts index 043e62faa4..7a067fd202 100644 --- a/packages/types/src/sdk/events/index.ts +++ b/packages/types/src/sdk/events/index.ts @@ -24,3 +24,4 @@ export * from "./plugin" export * from "./backup" export * from "./environmentVariable" export * from "./auditLog" +export * from "./rowAction" diff --git a/packages/types/src/sdk/events/rowAction.ts b/packages/types/src/sdk/events/rowAction.ts new file mode 100644 index 0000000000..924f11cf76 --- /dev/null +++ b/packages/types/src/sdk/events/rowAction.ts @@ -0,0 +1,6 @@ +import { BaseEvent } from "./event" + +export interface RowActionCreatedEvent extends BaseEvent { + name: string + automationId: string +} diff --git a/packages/types/src/sdk/events/view.ts b/packages/types/src/sdk/events/view.ts index 452094d2f4..84fcb0facc 100644 --- a/packages/types/src/sdk/events/view.ts +++ b/packages/types/src/sdk/events/view.ts @@ -1,8 +1,11 @@ -import { ViewCalculation } from "../../documents" +import { ViewCalculation, ViewV2Schema, ViewV2Type } from "../../documents" import { BaseEvent, TableExportFormat } from "./event" +import { LegacyFilter, SortOrder, SortType, UISearchFilter } from "../../api" +import { SearchFilters } from "../search" export interface ViewCreatedEvent extends BaseEvent { - tableId: string + name: string + type?: ViewV2Type } export interface ViewUpdatedEvent extends BaseEvent {