const metadata = {
  event: "customer_accounts.user.deleted",
  persistent: false,
  id: "customer_accounts:query-index-reindex-deleted"
};
async function handle(payload, ctx) {
  const userId = typeof payload?.id === "string" ? payload.id : null;
  const tenantId = typeof payload?.tenantId === "string" ? payload.tenantId : null;
  if (!userId || !tenantId) return;
  let bus = null;
  try {
    bus = ctx.resolve("eventBus");
  } catch {
    bus = null;
  }
  if (!bus) return;
  await bus.emitEvent(
    "query_index.delete_one",
    {
      entityType: "customer_accounts:customer_user",
      recordId: userId,
      organizationId: payload.organizationId ?? null,
      tenantId
    },
    {
      tenantId,
      organizationId: payload.organizationId ?? null
    }
  ).catch(() => void 0);
}
export {
  handle as default,
  metadata
};
//# sourceMappingURL=search-reindex-deleted.js.map
