diff --git a/packages/backend-core/src/events/processors/posthog/PosthogProcessor.ts b/packages/backend-core/src/events/processors/posthog/PosthogProcessor.ts index 687fe54256..4700b47be2 100644 --- a/packages/backend-core/src/events/processors/posthog/PosthogProcessor.ts +++ b/packages/backend-core/src/events/processors/posthog/PosthogProcessor.ts @@ -13,8 +13,6 @@ const EXCLUDED_EVENTS: Event[] = [ Event.ROLE_UPDATED, Event.DATASOURCE_UPDATED, Event.QUERY_UPDATED, - // Event.TABLE_UPDATED, - // Event.VIEW_UPDATED, Event.VIEW_FILTER_UPDATED, Event.VIEW_CALCULATION_UPDATED, Event.AUTOMATION_TRIGGER_UPDATED, diff --git a/packages/backend-core/src/events/publishers/view.ts b/packages/backend-core/src/events/publishers/view.ts index 6d107d58f3..3097ae4cfa 100644 --- a/packages/backend-core/src/events/publishers/view.ts +++ b/packages/backend-core/src/events/publishers/view.ts @@ -30,7 +30,6 @@ async function created(view: ViewV2, timestamp?: string | number) { } async function updated(newView: ViewV2) { - // // check whether any of the fields are different let viewJoins = 0 for (const key in newView.schema) { if (newView.schema[key]?.columns) { diff --git a/packages/server/src/api/controllers/view/views.ts b/packages/server/src/api/controllers/view/views.ts index f1aa219aca..9fdd808d38 100644 --- a/packages/server/src/api/controllers/view/views.ts +++ b/packages/server/src/api/controllers/view/views.ts @@ -65,27 +65,6 @@ export async function save(ctx: Ctx) { builderSocket?.emitTableUpdate(ctx, table) } -// export async function calculationEvents(existingView: View, newView: View) { -// const existingCalculation = existingView && existingView.calculation -// const newCalculation = newView && newView.calculation -// -// if (existingCalculation && !newCalculation) { -// await events.view.calculationDeleted(existingView) -// } -// -// if (!existingCalculation && newCalculation) { -// await events.view.calculationCreated(newView) -// } -// -// if ( -// existingCalculation && -// newCalculation && -// existingCalculation !== newCalculation -// ) { -// await events.view.calculationUpdated(newView) -// } -// } - export async function filterEvents(existingView: View, newView: View) { const hasExistingFilters = !!( existingView && diff --git a/packages/server/src/migrations/functions/backfill/app/tables.ts b/packages/server/src/migrations/functions/backfill/app/tables.ts index c6e46173dc..e8437bd529 100644 --- a/packages/server/src/migrations/functions/backfill/app/tables.ts +++ b/packages/server/src/migrations/functions/backfill/app/tables.ts @@ -7,24 +7,6 @@ export const backfill = async (appDb: Database, timestamp: string | number) => { for (const table of tables) { await events.table.created(table, timestamp) - - if (table.views) { - for (const view of Object.values(table.views)) { - if (sdk.views.isV2(view)) { - continue - } - - // await events.view.created(view, timestamp) - - if (view.calculation) { - await events.view.calculationCreated(view, timestamp) - } - - if (view.filters?.length) { - await events.view.filterCreated(view, timestamp) - } - } - } } return tables.length diff --git a/packages/server/src/sdk/app/views/external.ts b/packages/server/src/sdk/app/views/external.ts index 9016a3bd61..65e0ff410d 100644 --- a/packages/server/src/sdk/app/views/external.ts +++ b/packages/server/src/sdk/app/views/external.ts @@ -63,7 +63,7 @@ export async function create( export async function update( tableId: string, view: Readonly -): Promise<{ view: ViewV2; existingView: ViewV2 }> { +): Promise<{ view: Readonly; existingView: ViewV2 }> { const db = context.getAppDB() const { datasourceId, tableName } = breakExternalTableId(tableId) @@ -87,7 +87,7 @@ export async function update( delete views[existingView.name] views[view.name] = view await db.put(ds) - return { view, existingView } + return { view, existingView } as { view: ViewV2; existingView: ViewV2 } } export async function remove(viewId: string): Promise { diff --git a/packages/server/src/sdk/app/views/internal.ts b/packages/server/src/sdk/app/views/internal.ts index ec152abe54..4f7abad357 100644 --- a/packages/server/src/sdk/app/views/internal.ts +++ b/packages/server/src/sdk/app/views/internal.ts @@ -76,7 +76,7 @@ export async function update( delete table.views[existingView.name] table.views[view.name] = view await db.put(table) - return { view, existingView } + return { view, existingView } as { view: ViewV2; existingView: ViewV2 } } export async function remove(viewId: string): Promise {