Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(reminders): split the Soup view into Active, Scheduled and Done (#5485)

Evan Hutnikbfa7fe6cb59f
diff --git a/.sqlx/query-5e3545ee71091d2c36af1c778680ca240d9d1dca7efcd636d30888b17caf6169.json b/.sqlx/query-8b7cb59a95d1bee743abfbcb698b032592260a338d3a36164dc97f75171c1f62.json
similarity index 76%
rename from .sqlx/query-5e3545ee71091d2c36af1c778680ca240d9d1dca7efcd636d30888b17caf6169.json
rename to .sqlx/query-8b7cb59a95d1bee743abfbcb698b032592260a338d3a36164dc97f75171c1f62.json
index 46eaf10ef0..e901084310 100644
--- a/.sqlx/query-5e3545ee71091d2c36af1c778680ca240d9d1dca7efcd636d30888b17caf6169.json
+++ b/.sqlx/query-8b7cb59a95d1bee743abfbcb698b032592260a338d3a36164dc97f75171c1f62.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n r.id,\n r.description,\n r.entity_type,\n r.entity_id,\n r.remind_at,\n r.cron,\n r.timezone,\n r.next_run_at,\n r.enabled,\n r.completed_at,\n r.created_at,\n r.updated_at,\n d.\"fileType\" as \"referenced_file_type?\",\n dst.sub_type::text as \"referenced_sub_type?\"\n FROM reminder r\n -- Resolve the referenced document in the same round trip: the block\n -- a reminder opens (and its icon) comes from the document's file\n -- type, and the client's icon path is synchronous. \"Document\".id is\n -- still TEXT while reminder.entity_id is a uuid, hence the cast.\n LEFT JOIN \"Document\" d\n ON r.entity_type = 'document'\n AND d.id = r.entity_id::text\n AND d.\"deletedAt\" IS NULL\n LEFT JOIN document_sub_type dst ON dst.document_id = d.id\n WHERE r.user_id = $1\n AND ($2::uuid[] IS NULL OR r.id = ANY($2))\n AND (\n $3::text[] IS NULL\n OR (\n r.entity_id IS NOT NULL\n AND r.entity_type || ':' || r.entity_id::text = ANY($3)\n )\n )\n AND ($4::bool IS NULL OR (r.completed_at IS NOT NULL) = $4)\n -- Descending to match Soup's global ordering, so the LIMIT keeps the\n -- same rows Soup would keep after merging every item type.\n ORDER BY r.next_run_at DESC, r.id DESC\n LIMIT $5\n ",
+ "query": "\n SELECT\n r.id,\n r.description,\n r.entity_type,\n r.entity_id,\n r.remind_at,\n r.cron,\n r.timezone,\n r.next_run_at,\n r.enabled,\n r.completed_at,\n r.created_at,\n r.updated_at,\n d.\"fileType\" as \"referenced_file_type?\",\n dst.sub_type::text as \"referenced_sub_type?\"\n FROM reminder r\n -- Resolve the referenced document in the same round trip: the block\n -- a reminder opens (and its icon) comes from the document's file\n -- type, and the client's icon path is synchronous. \"Document\".id is\n -- still TEXT while reminder.entity_id is a uuid, hence the cast.\n LEFT JOIN \"Document\" d\n ON r.entity_type = 'document'\n AND d.id = r.entity_id::text\n AND d.\"deletedAt\" IS NULL\n LEFT JOIN document_sub_type dst ON dst.document_id = d.id\n WHERE r.user_id = $1\n AND ($2::uuid[] IS NULL OR r.id = ANY($2))\n AND (\n $3::text[] IS NULL\n OR (\n r.entity_id IS NOT NULL\n AND r.entity_type || ':' || r.entity_id::text = ANY($3)\n )\n )\n AND ($4::bool IS NULL OR (r.completed_at IS NOT NULL) = $4)\n -- Due-ness is resolved against the database clock. The caller\n -- cannot pass a timestamp: it would land in the client's query\n -- cache key and change on every render.\n AND ($5::bool IS NULL OR (r.next_run_at <= now()) = $5)\n -- Order in whichever direction Soup will merge in, so the LIMIT\n -- keeps the same rows Soup would keep after merging every item\n -- type. The first two keys collapse to a constant NULL when $6 is\n -- false, leaving the descending pair to decide; when it is true\n -- they fully determine the order and the descending pair is inert.\n ORDER BY\n CASE WHEN $6::bool THEN r.next_run_at END ASC,\n CASE WHEN $6::bool THEN r.id END ASC,\n r.next_run_at DESC,\n r.id DESC\n LIMIT $7\n ",
"describe": {
"columns": [
{
@@ -80,6 +80,8 @@
"UuidArray",
"TextArray",
"Bool",
+ "Bool",
+ "Bool",
"Int8"
]
},
@@ -100,5 +102,5 @@
null
]
},
- "hash": "5e3545ee71091d2c36af1c778680ca240d9d1dca7efcd636d30888b17caf6169"
+ "hash": "8b7cb59a95d1bee743abfbcb698b032592260a338d3a36164dc97f75171c1f62"
}
diff --git a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
index 806afc2b02..8f03488eff 100644
--- a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
@@ -31,9 +31,11 @@ const VALID_MARK_DONE_LIST_VIEWS: `${ListView}-${string}`[] = [
'mail-noise',
'mail-shared',
// Completing a reminder is the whole point of the Reminders view: without
- // it the only way to clear one is to delete it.
- 'reminders-upcoming',
- 'reminders-all',
+ // it the only way to clear one is to delete it. Done is listed too so a
+ // reminder marked by mistake can be reopened from where it landed.
+ 'reminders-active',
+ 'reminders-scheduled',
+ 'reminders-done',
];
export const canExecuteMarkDoneOnView = (view: ListView, tabId: string) => {
diff --git a/apps/web/src/features/next-soup/actions/make-mark-not-done-action.ts b/apps/web/src/features/next-soup/actions/make-mark-not-done-action.ts
index e78d63921b..d6f1756957 100644
--- a/apps/web/src/features/next-soup/actions/make-mark-not-done-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-mark-not-done-action.ts
@@ -16,7 +16,7 @@ type MakeMarkNotDoneOptions = {
};
/**
- * Return completed reminders to the Upcoming tab. Kept off the email path:
+ * Return completed reminders to Active or Scheduled. Kept off the email path:
* none of its preconditions apply, and a reminder's not-done state is its own
* `completed` column rather than a notification override.
*/
diff --git a/apps/web/src/features/next-soup/filters/configs/entity.ts b/apps/web/src/features/next-soup/filters/configs/entity.ts
index 94c7e8e027..f3cdaafc3d 100644
--- a/apps/web/src/features/next-soup/filters/configs/entity.ts
+++ b/apps/web/src/features/next-soup/filters/configs/entity.ts
@@ -7,12 +7,14 @@ import {
crmCompanyActiveFilter as crmCompanyActivePredicate,
crmCompanyHiddenFilter as crmCompanyHiddenPredicate,
crmCompanyFilter as crmCompanyPredicate,
+ doneRemindersFilter as doneRemindersPredicate,
filesAndFolderFilter as filesAndFolderPredicate,
+ firedRemindersFilter as firedRemindersPredicate,
projectFilter as projectPredicate,
remindersFilter as remindersPredicate,
+ scheduledRemindersFilter as scheduledRemindersPredicate,
searchSupportedFilter as searchSupportedPredicate,
taskFilter as taskPredicate,
- upcomingRemindersFilter as upcomingRemindersPredicate,
} from '../predicates';
import { config, isAgent, isNotTask, NIL_UUID } from './base';
@@ -81,11 +83,40 @@ export const remindersFilter = config({
query: defineQueryFilters({ include: { includeReminders: true } }),
});
-export const upcomingRemindersFilter = config({
- id: 'reminders-upcoming',
- predicate: upcomingRemindersPredicate,
+// `reminderCompleted: false` is load-bearing beyond the filtering: it is what
+// `soupQueryExcludesDone` matches on (as `"comp":false`) to drop a reminder
+// from these views the moment it is marked done, rather than on the next
+// refetch. `reminderFired` is resolved server-side against the database clock
+// — a client timestamp would land in the query key and change every render.
+export const firedRemindersFilter = config({
+ id: 'reminders-fired',
+ predicate: firedRemindersPredicate,
query: defineQueryFilters({
- include: { includeReminders: true, reminderCompleted: false },
+ include: {
+ includeReminders: true,
+ reminderCompleted: false,
+ reminderFired: true,
+ },
+ }),
+});
+
+export const scheduledRemindersFilter = config({
+ id: 'reminders-scheduled',
+ predicate: scheduledRemindersPredicate,
+ query: defineQueryFilters({
+ include: {
+ includeReminders: true,
+ reminderCompleted: false,
+ reminderFired: false,
+ },
+ }),
+});
+
+export const doneRemindersFilter = config({
+ id: 'reminders-done',
+ predicate: doneRemindersPredicate,
+ query: defineQueryFilters({
+ include: { includeReminders: true, reminderCompleted: true },
}),
});
diff --git a/apps/web/src/features/next-soup/filters/configs/index.ts b/apps/web/src/features/next-soup/filters/configs/index.ts
index 52a7fb468d..a2bfc24ebf 100644
--- a/apps/web/src/features/next-soup/filters/configs/index.ts
+++ b/apps/web/src/features/next-soup/filters/configs/index.ts
@@ -33,13 +33,15 @@ import {
crmCompanyFilter,
crmCompanyHiddenFilter,
documentOrFileFilter,
+ doneRemindersFilter,
filesAndFolderFilter,
+ firedRemindersFilter,
foldersFilter,
inFolderFilter,
notTaskFilter,
remindersFilter,
+ scheduledRemindersFilter,
searchSupportedFilter,
- upcomingRemindersFilter,
} from './entity';
import { ENTITY_TYPE_FILTERS } from './entity-type';
import {
@@ -96,7 +98,9 @@ export const SOUP_FILTERS = [
emailAttachmentsFilter,
inFolderFilter,
remindersFilter,
- upcomingRemindersFilter,
+ firedRemindersFilter,
+ scheduledRemindersFilter,
+ doneRemindersFilter,
searchSupportedFilter,
...ENTITY_TYPE_FILTERS,
...TASK_STATUS_FILTERS,
diff --git a/apps/web/src/features/next-soup/filters/filter-store/compile.ts b/apps/web/src/features/next-soup/filters/filter-store/compile.ts
index e061cd52bd..0b1308e3a5 100644
--- a/apps/web/src/features/next-soup/filters/filter-store/compile.ts
+++ b/apps/web/src/features/next-soup/filters/filter-store/compile.ts
@@ -140,6 +140,7 @@ const FIELD_CONFIG: Record<
crmCompanyHidden: { target: 'ccf', field: 'hidden' },
reminderId: { target: 'remf', field: 'id' },
reminderCompleted: { target: 'remf', field: 'comp' },
+ reminderFired: { target: 'remf', field: 'fired' },
includeReminders: { target: 'remf', field: 'inc', unit: true },
};
diff --git a/apps/web/src/features/next-soup/filters/filter-store/types.ts b/apps/web/src/features/next-soup/filters/filter-store/types.ts
index 90764652ef..8d023e0564 100644
--- a/apps/web/src/features/next-soup/filters/filter-store/types.ts
+++ b/apps/web/src/features/next-soup/filters/filter-store/types.ts
@@ -101,6 +101,9 @@ export type ScalarFieldFilters = {
// Reminders are off by default in Soup; a view must opt in.
includeReminders?: boolean;
reminderCompleted?: boolean;
+ /** Whether the reminder has come due. Resolved against the server clock, so
+ * it stays out of the query cache key. */
+ reminderFired?: boolean;
documentCreatedAt?: DateRangeFilter;
documentUpdatedAt?: DateRangeFilter;
chatCreatedAt?: DateRangeFilter;
diff --git a/apps/web/src/features/next-soup/filters/predicates.ts b/apps/web/src/features/next-soup/filters/predicates.ts
index 704470dc76..53215921b7 100644
--- a/apps/web/src/features/next-soup/filters/predicates.ts
+++ b/apps/web/src/features/next-soup/filters/predicates.ts
@@ -146,14 +146,26 @@ export function remindersFilter(entity: EntityData): boolean {
}
/**
- * Reminders that have not fired yet.
+ * Reminders that have fired and are waiting on their owner.
*
- * `completedAt` alone is not enough: it means the owner has dealt with the
- * reminder, and firing deliberately does not set it — a reminder that has just
- * arrived is waiting on them, not finished. So a fired one would otherwise sit
- * in "Upcoming" until dismissed. The firing time is what makes it upcoming.
+ * `completedAt` means the owner has dealt with the reminder, and firing
+ * deliberately does not set it — so a fired one is outstanding, not finished.
+ * The `nextRunAt` test is what separates these from reminders that simply have
+ * not come due yet; those live in Scheduled.
*/
-export function upcomingRemindersFilter(entity: EntityData): boolean {
+export function firedRemindersFilter(entity: EntityData): boolean {
+ return (
+ entity.type === 'reminder' &&
+ !entity.completedAt &&
+ new Date(entity.nextRunAt).getTime() <= Date.now()
+ );
+}
+
+/**
+ * Reminders set for the future, which have not fired yet. Recurring reminders
+ * never complete, so between firings they sit here pointing at their next run.
+ */
+export function scheduledRemindersFilter(entity: EntityData): boolean {
return (
entity.type === 'reminder' &&
!entity.completedAt &&
@@ -161,6 +173,11 @@ export function upcomingRemindersFilter(entity: EntityData): boolean {
);
}
+/** Reminders the owner has marked as dealt with. */
+export function doneRemindersFilter(entity: EntityData): boolean {
+ return entity.type === 'reminder' && !!entity.completedAt;
+}
+
/**
* Entity types the search view supports. Mirrors the search preset's
* server-side exclusions (foreign entities + CRM) so entities that enter
diff --git a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts
index 309527e9ac..0d1ba65107 100644
--- a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts
+++ b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts
@@ -14,6 +14,7 @@ afterEach(() => {
});
import { compileToAst, queryStateFrom } from '../filters/filter-store/compile';
+import { VIEW_TAB_LISTS } from '../soup-view/tab-lists';
import { getViewPreset, VIEW_TAB_PRESETS } from './soup-filter-presets';
const mailTabs = Object.keys(VIEW_TAB_PRESETS.mail.tabs);
@@ -77,23 +78,59 @@ describe('reminders view presets', () => {
return compileToAst(queryStateFrom(preset.filters));
};
- it('defaults to the upcoming tab', () => {
- expect(VIEW_TAB_PRESETS.reminders.default).toBe('upcoming');
+ it('defaults to the active tab', () => {
+ expect(VIEW_TAB_PRESETS.reminders.default).toBe('active');
});
- it('asks for reminders that have not fired on the upcoming tab', () => {
- expect(astFor('upcoming').remf).toEqual({
- '&': [{ l: { comp: false } }, { l: 'inc' }],
+ // Active and Scheduled split on `fired` server-side rather than in a client
+ // predicate: they would otherwise share one `comp:false` query whose row
+ // limit is spent on whichever end the sort direction favours.
+ it('asks for fired, uncompleted reminders on the active tab', () => {
+ expect(astFor('active').remf).toEqual({
+ '&': [
+ { l: { comp: false } },
+ { '&': [{ l: { fired: true } }, { l: 'inc' }] },
+ ],
});
});
- it('asks for every reminder on the all tab', () => {
- expect(astFor('all').remf).toEqual({ l: 'inc' });
+ it('asks for not-yet-fired reminders on the scheduled tab', () => {
+ expect(astFor('scheduled').remf).toEqual({
+ '&': [
+ { l: { comp: false } },
+ { '&': [{ l: { fired: false } }, { l: 'inc' }] },
+ ],
+ });
+ });
+
+ it('asks for completed reminders on the done tab', () => {
+ expect(astFor('done').remf).toEqual({
+ '&': [{ l: { comp: true } }, { l: 'inc' }],
+ });
+ });
+
+ // `comp: false` is what `soupQueryExcludesDone` matches to drop a row
+ // optimistically when it is marked done; losing it regresses that silently.
+ it.each(['active', 'scheduled'])(
+ 'keeps the not-completed filter on the %s tab',
+ (tab) => {
+ expect(
+ JSON.stringify(getViewPreset('reminders', tab)?.filters)
+ ).toContain('reminderCompleted');
+ }
+ );
+
+ // Active is an inbox, so newest-fired first like every other feed. Scheduled
+ // points at future dates, where newest-first would mean furthest-away first.
+ it('reads only the scheduled tab soonest-first', () => {
+ expect(getViewPreset('reminders', 'active')?.sortDirection).toBeUndefined();
+ expect(getViewPreset('reminders', 'scheduled')?.sortDirection).toBe('asc');
+ expect(getViewPreset('reminders', 'done')?.sortDirection).toBeUndefined();
});
// defineQueryFilters NIL-excludes every target a query does not name, which
// is the only thing keeping other entity types out of this view.
- it.each(['upcoming', 'all'])(
+ it.each(['active', 'scheduled', 'done'])(
'excludes every other entity type on the %s tab',
(tab) => {
const ast = astFor(tab);
@@ -105,3 +142,36 @@ describe('reminders view presets', () => {
}
);
});
+
+// The tab bar's labels and the filter presets are two separate tables keyed by
+// the same ids, so a renamed tab can leave the UI showing the old one while the
+// new preset is unreachable. That is exactly what happened when Reminders went
+// from Upcoming/All to Active/Scheduled/Done.
+describe('tab lists and filter presets agree', () => {
+ const tabbedViews = Object.keys(
+ VIEW_TAB_LISTS
+ ) as (keyof typeof VIEW_TAB_LISTS)[];
+
+ it.each(tabbedViews)('every %s tab in the tab bar has a preset', (view) => {
+ const presetIds = Object.keys(VIEW_TAB_PRESETS[view].tabs);
+ for (const tab of VIEW_TAB_LISTS[view]) {
+ expect(presetIds, `${view}/${tab.value}`).toContain(tab.value);
+ }
+ });
+
+ it.each(tabbedViews)(
+ 'every %s preset is reachable from the tab bar',
+ (view) => {
+ const shownIds = VIEW_TAB_LISTS[view].map((tab) => tab.value);
+ for (const tabId of Object.keys(VIEW_TAB_PRESETS[view].tabs)) {
+ expect(shownIds, `${view}/${tabId}`).toContain(tabId);
+ }
+ }
+ );
+
+ it.each(tabbedViews)('the %s default tab is one of its tabs', (view) => {
+ expect(VIEW_TAB_LISTS[view].map((tab) => tab.value)).toContain(
+ VIEW_TAB_PRESETS[view].default
+ );
+ });
+});
diff --git a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
index 84039482f6..db050d5530 100644
--- a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
+++ b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
@@ -25,6 +25,11 @@ type SoupFiltersPreset = {
* `entity_type`, `project`, or `property:<definition-id>`).
*/
groupBy?: string;
+ /**
+ * Direction to order the server page in. Defaults to `desc` when absent,
+ * matching every feed that reads newest-first.
+ */
+ sortDirection?: 'asc' | 'desc';
};
// Tab preset configuration types
@@ -496,21 +501,43 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
// NIL-excludes every target this query does not reference — makes the view
// reminders-only. Soup already orders them by when they fire.
reminders: {
- default: 'upcoming',
+ default: 'active',
tabs: {
- // Not yet fired. Recurring reminders never complete, so they stay here
- // across firings, which is what "upcoming" should mean for them.
- upcoming: () => ({
+ // Fired and waiting on you — an inbox, so newest arrival on top like
+ // every other feed. `reminderFired` is a server filter rather than a
+ // client one for a reason: both this tab and Scheduled would otherwise
+ // share one `comp:false` query, and the page limit would be spent on
+ // whichever end the sort direction favours, so a user with a hundred
+ // future reminders could open Active on an empty list.
+ active: () => ({
+ filters: defineQueryFilters({
+ include: {
+ includeReminders: true,
+ reminderCompleted: false,
+ reminderFired: true,
+ },
+ }),
+ clientFilters: { and: ['reminders-fired'] },
+ }),
+ // Not due yet. Soonest first: "newest first" on a future date means
+ // furthest away first, which puts December above tomorrow.
+ scheduled: () => ({
filters: defineQueryFilters({
- include: { includeReminders: true, reminderCompleted: false },
+ include: {
+ includeReminders: true,
+ reminderCompleted: false,
+ reminderFired: false,
+ },
}),
- clientFilters: { and: ['reminders-upcoming'] },
+ clientFilters: { and: ['reminders-scheduled'] },
+ sortDirection: 'asc',
}),
- all: () => ({
+ // Dealt with. Most-recently-due first, like every other archive view.
+ done: () => ({
filters: defineQueryFilters({
- include: { includeReminders: true },
+ include: { includeReminders: true, reminderCompleted: true },
}),
- clientFilters: { and: ['reminders'] },
+ clientFilters: { and: ['reminders-done'] },
}),
},
},
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
index ca263b5763..8ddc4c4b82 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
@@ -24,7 +24,10 @@ import {
type Query,
type QueryStore,
} from '@app/features/next-soup/filters/filter-store/query-store';
-import { VIEW_TAB_PRESETS } from '@app/features/next-soup/sidebar/soup-filter-presets';
+import {
+ getViewPreset,
+ VIEW_TAB_PRESETS,
+} from '@app/features/next-soup/sidebar/soup-filter-presets';
import { createGroupedSoupQueries } from '@app/features/next-soup/soup-view/create-grouped-soup-queries';
import { createSearchState } from '@app/features/next-soup/soup-view/create-search-state';
import {
@@ -76,6 +79,7 @@ import type { SoupParams } from '@queries/soup/items';
import { useSoupAstItemsQuery } from '@queries/soup/items';
import { soupKeys } from '@queries/soup/keys';
import { mapApiSoupItemToEntity } from '@queries/soup/transform-utils';
+import { useIsTeamAdmin } from '@queries/team/teams';
import type { SoupApiItem } from '@service-storage/generated/schemas';
import { makePersisted } from '@solid-primitives/storage';
import {
@@ -244,6 +248,21 @@ const persistedQueryFor = (
return isQueryState(saved) ? saved : saved[tabId];
};
+/** Resolve a remembered tab id against the view's current tabs.
+ *
+ * Persisted ids outlive the tabs themselves: renaming a tab would otherwise
+ * restore the view onto an id no preset resolves, leaving it on a tab that no
+ * longer exists with no filters applied. Anything unrecognised falls back to
+ * the view's default.
+ */
+const resolveTabId = (
+ view: ListView,
+ remembered: string | undefined
+): string => {
+ const config = VIEW_TAB_PRESETS[view];
+ return remembered && remembered in config.tabs ? remembered : config.default;
+};
+
const persistedPredicatesFor = (
view: ListView,
tabId: string
@@ -298,21 +317,6 @@ export const SoupViewContextProvider: FlowComponent<
return isListViewID(content.id) ? content.id : undefined;
});
- const soupParams = createMemo(() => {
- const sortId = soup.sort.active()[0]?.id ?? 'updated_at';
-
- // Client-only sorts (priority, status) fall back to created_at for the API
- const sortMethod = VALID_API_SORT_METHODS.includes(sortId as ApiSortMethod)
- ? (sortId as ApiSortMethod)
- : 'created_at';
-
- return {
- // Mail views use a smaller page size
- limit: activeListView() === 'mail' ? 30 : 100,
- sort_method: sortMethod,
- };
- });
-
const initialEntryState = panel.handle.currentEntryState();
const initialEntryQuery = initialEntryState?.['search.filters'] as
| Query
@@ -322,11 +326,13 @@ export const SoupViewContextProvider: FlowComponent<
| undefined;
const initialView = activeListView();
const initialTab = initialView
- ? ((initialEntryState?.['soup.tab'] as string | undefined) ??
- (filterPersistenceEnabled()
- ? persistedActiveTabs()[initialView]
- : undefined) ??
- VIEW_TAB_PRESETS[initialView].default)
+ ? resolveTabId(
+ initialView,
+ (initialEntryState?.['soup.tab'] as string | undefined) ??
+ (filterPersistenceEnabled()
+ ? persistedActiveTabs()[initialView]
+ : undefined)
+ )
: undefined;
const initialPersistedQuery =
filterPersistenceEnabled() && initialView && initialTab
@@ -656,6 +662,37 @@ export const SoupViewContextProvider: FlowComponent<
const notificationSource = useGlobalNotificationSource();
const userId = useUserId();
+ const isTeamAdmin = useIsTeamAdmin();
+
+ // Sits below `activeTab`/`userId` because the page direction comes from the
+ // active tab's preset, which some views resolve against user context.
+ const soupParams = createMemo(() => {
+ const sortId = soup.sort.active()[0]?.id ?? 'updated_at';
+
+ // Client-only sorts (priority, status) fall back to created_at for the API
+ const sortMethod = VALID_API_SORT_METHODS.includes(sortId as ApiSortMethod)
+ ? (sortId as ApiSortMethod)
+ : 'created_at';
+
+ const view = activeListView();
+ // The direction belongs to what the tab means — Reminders' Active list
+ // reads soonest-first — not to the sort method, so the preset owns it.
+ // Omitted when absent so the server default (desc) applies and the query
+ // keys of every existing view stay byte-identical.
+ const sortDirection = view
+ ? getViewPreset(view, activeTab(), {
+ userId: userId(),
+ isTeamAdmin: isTeamAdmin(),
+ })?.sortDirection
+ : undefined;
+
+ return {
+ // Mail views use a smaller page size
+ limit: view === 'mail' ? 30 : 100,
+ sort_method: sortMethod,
+ ...(sortDirection ? { sort_direction: sortDirection } : {}),
+ };
+ });
// Active deal-stage set (team-customized when present). Drives the
// Customers view's stage grouping, stage filter and group labels.
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
index 8ff8f545d3..68df04c7de 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
@@ -17,6 +17,10 @@ import {
type SoupViewMode,
useSoupView,
} from '@app/features/next-soup/soup-view/soup-view-context';
+import {
+ type TabbedListView,
+ VIEW_TAB_LISTS,
+} from '@app/features/next-soup/soup-view/tab-lists';
import { PillTabs } from '@components/app/mobile/PillTabs';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import type { TabItem } from '@core/component/Tabs';
@@ -26,74 +30,6 @@ import { useUserContext } from '@core/context/user';
import { useIsTeamAdmin } from '@queries/team/teams';
import { batch, createMemo, For, Match, Show, Switch } from 'solid-js';
-/** Views that have tab definitions. Shared between VIEW_TAB_LISTS and VIEW_TAB_PRESETS. */
-export type TabbedListView = Extract<
- ListView,
- | 'inbox'
- | 'agents'
- | 'mail'
- | 'documents'
- | 'tasks'
- | 'channels'
- | 'calls'
- | 'folders'
- | 'reminders'
->;
-
-/** Tab definitions for each list view. */
-export const VIEW_TAB_LISTS: Record<TabbedListView, TabItem[]> = {
- inbox: [
- { value: 'signal', label: 'Signal' },
- { value: 'noise', label: 'Noise' },
- { value: 'all', label: 'All' },
- ],
- agents: [
- { value: 'owned', label: 'Owned' },
- { value: 'running', label: 'Running' },
- { value: 'shared', label: 'Shared' },
- { value: 'automations', label: 'Automations' },
- ],
- mail: [
- { value: 'important', label: 'Signal' },
- { value: 'noise', label: 'Noise' },
- { value: 'sent', label: 'Sent' },
- { value: 'calendar', label: 'Calendar' },
- { value: 'drafts', label: 'Drafts' },
- { value: 'shared', label: 'Shared' },
- { value: 'all', label: 'All' },
- ],
- documents: [
- { value: 'owned', label: 'Owned' },
- { value: 'shared', label: 'Shared' },
- { value: 'attachments', label: 'Attachments' },
- { value: 'folders', label: 'Folders' },
- { value: 'all', label: 'All' },
- ],
- tasks: [
- { value: 'assigned-to-me', label: 'Assigned' },
- { value: 'created-by-me', label: 'Created' },
- { value: 'all', label: 'All' },
- ],
- channels: [
- { value: 'recent', label: 'Recent' },
- { value: 'people', label: 'People' },
- { value: 'teams', label: 'Teams' },
- ],
- calls: [
- { value: 'all', label: 'All' },
- { value: 'missed', label: 'Missed' },
- { value: 'unattended', label: 'Unattended' },
- ],
- folders: [
- { value: 'owned', label: 'Owned' },
- { value: 'all', label: 'All' },
- ],
- reminders: [
- { value: 'upcoming', label: 'Upcoming' },
- { value: 'all', label: 'All' },
- ],
-};
-
const useCurrentListView = () => {
const panel = useSplitPanelOrThrow();
@@ -385,3 +321,5 @@ const MobileViewTabs = (props: { view: TabbedListView }) => {
/>
);
};
+
+export { type TabbedListView, VIEW_TAB_LISTS };
diff --git a/apps/web/src/features/next-soup/soup-view/tab-lists.ts b/apps/web/src/features/next-soup/soup-view/tab-lists.ts
new file mode 100644
index 0000000000..1f47535a09
--- /dev/null
+++ b/apps/web/src/features/next-soup/soup-view/tab-lists.ts
@@ -0,0 +1,71 @@
+import type { ListView } from '@app/constants/list-views';
+import type { TabItem } from '@core/component/Tabs';
+
+/** Views that have tab definitions. Shared between VIEW_TAB_LISTS and VIEW_TAB_PRESETS. */
+export type TabbedListView = Extract<
+ ListView,
+ | 'inbox'
+ | 'agents'
+ | 'mail'
+ | 'documents'
+ | 'tasks'
+ | 'channels'
+ | 'calls'
+ | 'folders'
+ | 'reminders'
+>;
+
+/** Tab definitions for each list view. */
+export const VIEW_TAB_LISTS: Record<TabbedListView, TabItem[]> = {
+ inbox: [
+ { value: 'signal', label: 'Signal' },
+ { value: 'noise', label: 'Noise' },
+ { value: 'all', label: 'All' },
+ ],
+ agents: [
+ { value: 'owned', label: 'Owned' },
+ { value: 'running', label: 'Running' },
+ { value: 'shared', label: 'Shared' },
+ { value: 'automations', label: 'Automations' },
+ ],
+ mail: [
+ { value: 'important', label: 'Signal' },
+ { value: 'noise', label: 'Noise' },
+ { value: 'sent', label: 'Sent' },
+ { value: 'calendar', label: 'Calendar' },
+ { value: 'drafts', label: 'Drafts' },
+ { value: 'shared', label: 'Shared' },
+ { value: 'all', label: 'All' },
+ ],
+ documents: [
+ { value: 'owned', label: 'Owned' },
+ { value: 'shared', label: 'Shared' },
+ { value: 'attachments', label: 'Attachments' },
+ { value: 'folders', label: 'Folders' },
+ { value: 'all', label: 'All' },
+ ],
+ tasks: [
+ { value: 'assigned-to-me', label: 'Assigned' },
+ { value: 'created-by-me', label: 'Created' },
+ { value: 'all', label: 'All' },
+ ],
+ channels: [
+ { value: 'recent', label: 'Recent' },
+ { value: 'people', label: 'People' },
+ { value: 'teams', label: 'Teams' },
+ ],
+ calls: [
+ { value: 'all', label: 'All' },
+ { value: 'missed', label: 'Missed' },
+ { value: 'unattended', label: 'Unattended' },
+ ],
+ folders: [
+ { value: 'owned', label: 'Owned' },
+ { value: 'all', label: 'All' },
+ ],
+ reminders: [
+ { value: 'active', label: 'Active' },
+ { value: 'scheduled', label: 'Scheduled' },
+ { value: 'done', label: 'Done' },
+ ],
+};
diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.ts
index b16203bc8a..7bec6025c6 100644
--- a/apps/web/src/features/next-soup/utils.ts
+++ b/apps/web/src/features/next-soup/utils.ts
@@ -1111,9 +1111,9 @@ export function resolveMarkEntitiesDoneVariables(args: {
scopeChannelNotificationsToEntity = false,
} = args;
const emailIds = entities.filter((e) => e.type === 'email').map((e) => e.id);
- // A reminder's done state is its own column, not its notification's: an
- // upcoming reminder has no notification to mark, and the Reminders view
- // filters on the column.
+ // A reminder's done state is its own column, not its notification's: a
+ // reminder that has not fired yet has no notification to mark, and the
+ // Reminders view filters on the column.
const reminderIds = entities
.filter((e) => e.type === 'reminder')
.map((e) => e.id);
@@ -1248,9 +1248,9 @@ export function applyEntitiesDoneOptimistic(args: {
frecency_score: getSoupEntityById(id)?.frecency_score ?? 0,
})
);
- // Stamping `completedAt` is what drops a reminder out of the Upcoming
- // tab, which requires `!entity.completedAt` — so this takes effect before
- // any refetch, whether or not the reminder had already fired.
+ // Stamping `completedAt` is what drops a reminder out of the Active and
+ // Scheduled tabs, both of which require `!entity.completedAt` — so this
+ // takes effect before any refetch, whether or not it had already fired.
reminderRowTxns = reminderIds.map((id) =>
optimisticUpdateSoupEntity({
tag: 'reminder',
@@ -1307,8 +1307,8 @@ export function applyEntitiesNotDoneOptimistic(args: {
reminderIds?: string[];
}): { rollback: () => void } {
const { emailIds, notificationIds, reminderIds = [] } = args;
- // Clearing `completedAt` is what returns a reminder to the Upcoming tab,
- // whose predicate is `!entity.completedAt`.
+ // Clearing `completedAt` is what returns a reminder to Active or Scheduled
+ // (whichever its `nextRunAt` puts it in); both predicates require it unset.
const reminderRowTxns = reminderIds.map((id) =>
optimisticUpdateSoupEntity({
tag: 'reminder',
diff --git a/apps/web/src/lib/queries/soup/graphql/ast.ts b/apps/web/src/lib/queries/soup/graphql/ast.ts
index 2b0613bed9..261fe59b17 100644
--- a/apps/web/src/lib/queries/soup/graphql/ast.ts
+++ b/apps/web/src/lib/queries/soup/graphql/ast.ts
@@ -473,6 +473,19 @@ function mapPropertiesLiteral(literal: unknown): GraphqlPropertiesLiteralInput {
unsupported('expected property value so or er');
}
+function mapSortDirection(
+ sortDirection: SoupParams['sort_direction']
+): GraphqlSoupInitialInput['sortDirection'] {
+ switch (sortDirection) {
+ case 'asc':
+ return 'ASC';
+ case 'desc':
+ return 'DESC';
+ case undefined:
+ return undefined;
+ }
+}
+
function mapSortMethod(
sortMethod: SoupParams['sort_method']
): GraphqlSoupInitialInput['sortMethod'] {
@@ -574,12 +587,17 @@ export function makeGraphqlSoupInput(args: {
assertGraphqlCompatibleBody(body);
const emailView = mapEmailView(body.emailView);
+ // The cursor does not carry the direction, so the continuation has to
+ // re-send it or page two comes back in the opposite order.
+ const sortDirection = mapSortDirection(args.params.sort_direction);
+
if (args.cursor != null) {
return {
continuation: {
cursor: args.cursor,
expand: true,
emailView,
+ sortDirection,
},
};
}
@@ -589,6 +607,7 @@ export function makeGraphqlSoupInput(args: {
limit: args.params.limit ?? undefined,
expand: true,
sortMethod: mapSortMethod(args.params.sort_method),
+ sortDirection,
emailView,
filters: makeGraphqlFilters(body),
},
diff --git a/apps/web/src/lib/queries/soup/normalized-cache/operations.ts b/apps/web/src/lib/queries/soup/normalized-cache/operations.ts
index a632fe7334..0f8d2073ff 100644
--- a/apps/web/src/lib/queries/soup/normalized-cache/operations.ts
+++ b/apps/web/src/lib/queries/soup/normalized-cache/operations.ts
@@ -364,8 +364,8 @@ function soupQueryExcludesDone(key: QueryKey): boolean {
serialized.includes('"nd":false') ||
// Reminders carry their done state on themselves rather than on a
// notification, so `reminderCompleted` — compiled to `remf.comp` — is the
- // shape the Reminders "Upcoming" view filters on. Without it, marking a
- // reminder done left the row sitting there until the next refetch.
+ // shape the Reminders Active and Scheduled tabs filter on. Without it,
+ // marking a reminder done left the row sitting there until the refetch.
serialized.includes('"comp":false')
);
}
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/index.ts b/apps/web/src/lib/service-clients/service-search/generated/models/index.ts
index c3eb9459c7..9c97ffb467 100644
--- a/apps/web/src/lib/service-clients/service-search/generated/models/index.ts
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/index.ts
@@ -207,6 +207,7 @@ export * from './propertyValueOneOfThreeType';
export * from './propertyValueOneOfType';
export * from './reminderFilters';
export * from './reminderFiltersCompleted';
+export * from './reminderFiltersFired';
export * from './searchHighlight';
export * from './searchHighlightName';
export * from './searchHighlightSender';
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/reminderFilters.ts b/apps/web/src/lib/service-clients/service-search/generated/models/reminderFilters.ts
index 9838962958..d590275cdf 100644
--- a/apps/web/src/lib/service-clients/service-search/generated/models/reminderFilters.ts
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/reminderFilters.ts
@@ -5,15 +5,24 @@
* OpenAPI spec version: 0.1.0
*/
import type { ReminderFiltersCompleted } from './reminderFiltersCompleted';
+import type { ReminderFiltersFired } from './reminderFiltersFired';
/**
* Filters for reminders.
*/
export interface ReminderFilters {
- /** Filter on whether the reminder has already fired. `None` returns both. */
+ /** Filter on whether the owner has marked the reminder done. `None` returns
+both. */
completed?: ReminderFiltersCompleted;
/** Restrict to reminders attached to these entities, each `"{type}:{id}"`. */
entities?: string[];
+ /** Filter on whether the reminder's next run has come due, i.e. it has
+fired and is awaiting its owner. `None` returns both.
+
+Evaluated server-side against the database clock rather than a
+timestamp supplied by the caller: a timestamp would land in the query
+cache key and change on every render. */
+ fired?: ReminderFiltersFired;
/** Reminder ids to filter by. Empty to include all of the caller's reminders. */
ids?: string[];
/** Opt this query into reminders at all. Reminders are off by default —
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/reminderFiltersCompleted.ts b/apps/web/src/lib/service-clients/service-search/generated/models/reminderFiltersCompleted.ts
index 0283bdbdb1..b719566c38 100644
--- a/apps/web/src/lib/service-clients/service-search/generated/models/reminderFiltersCompleted.ts
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/reminderFiltersCompleted.ts
@@ -6,6 +6,7 @@
*/
/**
- * Filter on whether the reminder has already fired. `None` returns both.
+ * Filter on whether the owner has marked the reminder done. `None` returns
+both.
*/
export type ReminderFiltersCompleted = boolean | null;
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/reminderFiltersFired.ts b/apps/web/src/lib/service-clients/service-search/generated/models/reminderFiltersFired.ts
new file mode 100644
index 0000000000..1e92c9b924
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/reminderFiltersFired.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * search_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Filter on whether the reminder's next run has come due, i.e. it has
+fired and is awaiting its owner. `None` returns both.
+
+Evaluated server-side against the database clock rather than a
+timestamp supplied by the caller: a timestamp would land in the query
+cache key and change on every render.
+ */
+export type ReminderFiltersFired = boolean | null;
diff --git a/apps/web/src/lib/service-clients/service-search/openapi.json b/apps/web/src/lib/service-clients/service-search/openapi.json
index b669d6a13c..b4e27a579e 100644
--- a/apps/web/src/lib/service-clients/service-search/openapi.json
+++ b/apps/web/src/lib/service-clients/service-search/openapi.json
@@ -2854,7 +2854,7 @@
"properties": {
"completed": {
"type": ["boolean", "null"],
- "description": "Filter on whether the reminder has already fired. `None` returns both."
+ "description": "Filter on whether the owner has marked the reminder done. `None` returns\nboth."
},
"entities": {
"type": "array",
@@ -2863,6 +2863,10 @@
},
"description": "Restrict to reminders attached to these entities, each `\"{type}:{id}\"`."
},
+ "fired": {
+ "type": ["boolean", "null"],
+ "description": "Filter on whether the reminder's next run has come due, i.e. it has\nfired and is awaiting its owner. `None` returns both.\n\nEvaluated server-side against the database clock rather than a\ntimestamp supplied by the caller: a timestamp would land in the query\ncache key and change on every render."
+ },
"ids": {
"type": "array",
"items": {
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/getItemsSoupParams.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/getItemsSoupParams.ts
index 0e898485a2..dd773dc304 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/getItemsSoupParams.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/getItemsSoupParams.ts
@@ -5,6 +5,7 @@
* OpenAPI spec version: 0.1.0
*/
import type { SoupApiSort } from './soupApiSort';
+import type { SoupApiSortDirection } from './soupApiSortDirection';
export type GetItemsSoupParams = {
/**
@@ -20,6 +21,17 @@ export type GetItemsSoupParams = {
* Sort method. Options are viewed_at, created_at, updated_at, viewed_updated. Defaults to viewed_at.
*/
sort_method?: SoupApiSort;
+ /**
+ * Sort direction. Options are asc, desc. Defaults to desc.
+
+Re-send this with every page: it is not carried in the cursor.
+
+Applies to the timestamp sort methods only. `asc` combined with
+`frecency` is rejected rather than ignored: frecency pages are ordered
+by relevance score and the cursor comparison assumes descending, so
+there is no ascending frecency order to give.
+ */
+ sort_direction?: SoupApiSortDirection;
/**
* Base64 encoded cursor value.
*/
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
index aea50b8e80..0984c781b4 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
@@ -738,6 +738,7 @@ export * from './notificationFiltersSeen';
export * from './params';
export * from './paramsExpand';
export * from './paramsLimit';
+export * from './paramsSortDirection';
export * from './paramsSortMethod';
export * from './participantRole';
export * from './patchChannelRequest';
@@ -888,6 +889,7 @@ export * from './reminderEntityId';
export * from './reminderEntityType';
export * from './reminderFilters';
export * from './reminderFiltersCompleted';
+export * from './reminderFiltersFired';
export * from './reminderSchedule';
export * from './reminderScheduleOneOf';
export * from './reminderScheduleOneOfThree';
@@ -944,6 +946,7 @@ export * from './simpleMention';
export * from './soupApiItem';
export * from './soupApiItemAllOf';
export * from './soupApiSort';
+export * from './soupApiSortDirection';
export * from './soupAttachment';
export * from './soupAttachmentContentId';
export * from './soupAttachmentFilename';
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/params.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/params.ts
index 3f49dbde80..c19b68db3c 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/params.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/params.ts
@@ -6,6 +6,7 @@
*/
import type { ParamsExpand } from './paramsExpand';
import type { ParamsLimit } from './paramsLimit';
+import type { ParamsSortDirection } from './paramsSortDirection';
import type { ParamsSortMethod } from './paramsSortMethod';
/**
@@ -19,5 +20,6 @@ export interface Params {
* @minimum 0
*/
limit?: ParamsLimit;
+ sort_direction?: ParamsSortDirection;
sort_method?: ParamsSortMethod;
}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/paramsSortDirection.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/paramsSortDirection.ts
new file mode 100644
index 0000000000..de3fdfc434
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/paramsSortDirection.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SoupApiSortDirection } from './soupApiSortDirection';
+
+export type ParamsSortDirection = null | SoupApiSortDirection;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFilters.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFilters.ts
index 1083328139..f1b85ee6b4 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFilters.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFilters.ts
@@ -5,15 +5,24 @@
* OpenAPI spec version: 0.1.0
*/
import type { ReminderFiltersCompleted } from './reminderFiltersCompleted';
+import type { ReminderFiltersFired } from './reminderFiltersFired';
/**
* Filters for reminders.
*/
export interface ReminderFilters {
- /** Filter on whether the reminder has already fired. `None` returns both. */
+ /** Filter on whether the owner has marked the reminder done. `None` returns
+both. */
completed?: ReminderFiltersCompleted;
/** Restrict to reminders attached to these entities, each `"{type}:{id}"`. */
entities?: string[];
+ /** Filter on whether the reminder's next run has come due, i.e. it has
+fired and is awaiting its owner. `None` returns both.
+
+Evaluated server-side against the database clock rather than a
+timestamp supplied by the caller: a timestamp would land in the query
+cache key and change on every render. */
+ fired?: ReminderFiltersFired;
/** Reminder ids to filter by. Empty to include all of the caller's reminders. */
ids?: string[];
/** Opt this query into reminders at all. Reminders are off by default —
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFiltersCompleted.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFiltersCompleted.ts
index a0c81e4096..4ddf77ef3b 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFiltersCompleted.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFiltersCompleted.ts
@@ -6,6 +6,7 @@
*/
/**
- * Filter on whether the reminder has already fired. `None` returns both.
+ * Filter on whether the owner has marked the reminder done. `None` returns
+both.
*/
export type ReminderFiltersCompleted = boolean | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFiltersFired.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFiltersFired.ts
new file mode 100644
index 0000000000..943c406dad
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/reminderFiltersFired.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Filter on whether the reminder's next run has come due, i.e. it has
+fired and is awaiting its owner. `None` returns both.
+
+Evaluated server-side against the database clock rather than a
+timestamp supplied by the caller: a timestamp would land in the query
+cache key and change on every render.
+ */
+export type ReminderFiltersFired = boolean | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupApiSortDirection.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupApiSortDirection.ts
new file mode 100644
index 0000000000..b6f19ac3ff
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupApiSortDirection.ts
@@ -0,0 +1,18 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Sort direction accepted by non-grouped soup API endpoints.
+ */
+export type SoupApiSortDirection =
+ (typeof SoupApiSortDirection)[keyof typeof SoupApiSortDirection];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SoupApiSortDirection = {
+ asc: 'asc',
+ desc: 'desc',
+} as const;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
index 47b3cc2633..8bd2a63531 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
@@ -7764,6 +7764,12 @@ export const getItemsSoupQueryParams = zod.object({
.describe(
'Sort method. Options are viewed_at, created_at, updated_at, viewed_updated. Defaults to viewed_at.'
),
+ sort_direction: zod
+ .enum(['asc', 'desc'])
+ .optional()
+ .describe(
+ 'Sort direction. Options are asc, desc. Defaults to desc.\n\nRe-send this with every page: it is not carried in the cursor.\n\nApplies to the timestamp sort methods only. `asc` combined with\n`frecency` is rejected rather than ignored: frecency pages are ordered\nby relevance score and the cursor comparison assumes descending, so\nthere is no ascending frecency order to give.'
+ ),
cursor: zod.string().optional().describe('Base64 encoded cursor value.'),
});
@@ -11290,7 +11296,7 @@ export const postItemsSoupBody = zod
.boolean()
.nullish()
.describe(
- 'Filter on whether the reminder has already fired. `None` returns both.'
+ 'Filter on whether the owner has marked the reminder done. `None` returns\nboth.'
),
entities: zod
.array(zod.string())
@@ -11298,6 +11304,12 @@ export const postItemsSoupBody = zod
.describe(
'Restrict to reminders attached to these entities, each `\"{type}:{id}\"`.'
),
+ fired: zod
+ .boolean()
+ .nullish()
+ .describe(
+ "Filter on whether the reminder's next run has come due, i.e. it has\nfired and is awaiting its owner. `None` returns both.\n\nEvaluated server-side against the database clock rather than a\ntimestamp supplied by the caller: a timestamp would land in the query\ncache key and change on every render."
+ ),
ids: zod
.array(zod.string())
.optional()
@@ -11339,6 +11351,16 @@ export const postItemsSoupBody = zod
.describe(
'Limit the number of items returned. Defaults to 20. Max 500.'
),
+ sort_direction: zod
+ .union([
+ zod.null(),
+ zod
+ .enum(['asc', 'desc'])
+ .describe(
+ 'Sort direction accepted by non-grouped soup API endpoints.'
+ ),
+ ])
+ .optional(),
sort_method: zod
.union([
zod.null(),
@@ -14410,6 +14432,16 @@ export const postItemsSoupAstBody = zod
.describe(
'Limit the number of items returned. Defaults to 20. Max 500.'
),
+ sort_direction: zod
+ .union([
+ zod.null(),
+ zod
+ .enum(['asc', 'desc'])
+ .describe(
+ 'Sort direction accepted by non-grouped soup API endpoints.'
+ ),
+ ])
+ .optional(),
sort_method: zod
.union([
zod.null(),
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
index cd37f8bb5a..dc1ee38c3f 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
@@ -756,13 +756,15 @@ export type GraphqlReminderExpr =
/** GraphQL input representing the reminder literal. */
export type GraphqlReminderLiteral =
- { /** Whether the reminder has already fired. */
- completed: boolean; entity?: never; id?: never; include?: never; }
+ { /** Whether the owner has marked the reminder done. */
+ completed: boolean; entity?: never; fired?: never; id?: never; include?: never; }
| { completed?: never; /** The referenced entity, as `"{type}:{id}"`. */
- entity: string; id?: never; include?: never; }
- | { completed?: never; entity?: never; /** The id option. */
+ entity: string; fired?: never; id?: never; include?: never; }
+ | { completed?: never; entity?: never; /** Whether the reminder has come due and is awaiting its owner. */
+ fired: boolean; id?: never; include?: never; }
+ | { completed?: never; entity?: never; fired?: never; /** The id option. */
id: string | number; include?: never; }
- | { completed?: never; entity?: never; id?: never; /**
+ | { completed?: never; entity?: never; fired?: never; id?: never; /**
* Opt this query into reminders at all. Reminders are off by default, so
* without this (or an `id`/`entity`) Soup omits them entirely — a filter
* of only `completed` would otherwise silently match nothing. Must be
@@ -822,6 +824,13 @@ export type GraphqlSimpleSortMethod =
/** Sort by viewed timestamp, falling back to updated timestamp. */
| 'VIEWED_UPDATED';
+/** Direction a Soup page is ordered in. */
+export type GraphqlSortDirection =
+ /** Oldest, or soonest-firing, first. */
+ | 'ASC'
+ /** Newest first. */
+ | 'DESC';
+
/** GraphQL representation of Soup entity types. */
export type GraphqlSoupEntityType =
/** Calendar event entity. */
@@ -929,6 +938,13 @@ export type SoupContinuationInput = {
emailView?: GraphqlEmailView | null | undefined;
/** Whether to return expanded Soup items. Defaults to true. */
expand?: boolean | null | undefined;
+ /**
+ * Direction to order the page in. Defaults to DESC.
+ *
+ * The cursor does not carry it, so re-send whatever the initial query
+ * used or the continuation flips order mid-list.
+ */
+ sortDirection?: GraphqlSortDirection | null | undefined;
};
/** Input for starting a Soup query. */
@@ -941,6 +957,8 @@ export type SoupInitialInput = {
filters?: GraphqlEntityFilterAst | null | undefined;
/** Maximum number of items to return. Defaults to 20, max 500. */
limit?: number | null | undefined;
+ /** Direction to order the page in. Defaults to DESC. */
+ sortDirection?: GraphqlSortDirection | null | undefined;
/**
* Simple timestamp sort. Defaults to VIEWED_AT. Frecency is intentionally
* not supported by this initial GraphQL adapter.
diff --git a/apps/web/src/lib/service-clients/service-storage/openapi.json b/apps/web/src/lib/service-clients/service-storage/openapi.json
index 879bc430eb..3d6b191fa9 100644
--- a/apps/web/src/lib/service-clients/service-storage/openapi.json
+++ b/apps/web/src/lib/service-clients/service-storage/openapi.json
@@ -8291,6 +8291,15 @@
"$ref": "#/components/schemas/SoupApiSort"
}
},
+ {
+ "name": "sort_direction",
+ "in": "query",
+ "description": "Sort direction. Options are asc, desc. Defaults to desc.\n\nRe-send this with every page: it is not carried in the cursor.\n\nApplies to the timestamp sort methods only. `asc` combined with\n`frecency` is rejected rather than ignored: frecency pages are ordered\nby relevance score and the cursor comparison assumes descending, so\nthere is no ascending frecency order to give.",
+ "required": false,
+ "schema": {
+ "$ref": "#/components/schemas/SoupApiSortDirection"
+ }
+ },
{
"name": "cursor",
"in": "query",
@@ -19510,6 +19519,17 @@
"description": "Limit the number of items returned. Defaults to 20. Max 500.",
"minimum": 0
},
+ "sort_direction": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/SoupApiSortDirection",
+ "description": "Sort direction. Options are asc, desc. Defaults to desc.\n\nRe-send this with every page: it is not carried in the cursor.\n\nApplies to the timestamp sort methods only. `asc` combined with\n`frecency` is rejected rather than ignored: frecency pages are ordered\nby relevance score and the cursor comparison assumes descending, so\nthere is no ascending frecency order to give."
+ }
+ ]
+ },
"sort_method": {
"oneOf": [
{
@@ -20999,7 +21019,7 @@
"properties": {
"completed": {
"type": ["boolean", "null"],
- "description": "Filter on whether the reminder has already fired. `None` returns both."
+ "description": "Filter on whether the owner has marked the reminder done. `None` returns\nboth."
},
"entities": {
"type": "array",
@@ -21008,6 +21028,10 @@
},
"description": "Restrict to reminders attached to these entities, each `\"{type}:{id}\"`."
},
+ "fired": {
+ "type": ["boolean", "null"],
+ "description": "Filter on whether the reminder's next run has come due, i.e. it has\nfired and is awaiting its owner. `None` returns both.\n\nEvaluated server-side against the database clock rather than a\ntimestamp supplied by the caller: a timestamp would land in the query\ncache key and change on every render."
+ },
"ids": {
"type": "array",
"items": {
@@ -21539,6 +21563,11 @@
"frecency"
]
},
+ "SoupApiSortDirection": {
+ "type": "string",
+ "description": "Sort direction accepted by non-grouped soup API endpoints.",
+ "enum": ["asc", "desc"]
+ },
"SoupAttachment": {
"type": "object",
"description": "An email attachment as displayed in Soup.",
diff --git a/crates/graphql_soup/src/inputs.rs b/crates/graphql_soup/src/inputs.rs
index b0740a6354..e4edecf809 100644
--- a/crates/graphql_soup/src/inputs.rs
+++ b/crates/graphql_soup/src/inputs.rs
@@ -30,7 +30,9 @@ use macro_user_id::{cowlike::CowLike, email::EmailStr, user_id::MacroUserIdStr};
use model_file_type::FileType;
use models_grouping::{GroupByField, GroupingConfig};
use models_pagination::{Base64Str, CursorWithValAndFilter, Query, SimpleSortMethod};
-use soup::domain::models::{GroupedSortRequest, SoupQuery, SoupRequest, SoupType};
+use soup::domain::models::{
+ GroupedSortRequest, SoupQuery, SoupRequest, SoupSortDirection, SoupType,
+};
use uuid::Uuid;
/// Input for `Query.soup`.
@@ -56,6 +58,8 @@ pub struct SoupInitialInput {
email_view: Option<GraphqlEmailView>,
/// AST-shaped filters applied to each Soup entity type.
filters: Option<GraphqlEntityFilterAst>,
+ /// Direction to order the page in. Defaults to DESC.
+ sort_direction: Option<GraphqlSortDirection>,
}
/// Input for continuing a Soup query.
@@ -67,6 +71,30 @@ pub struct SoupContinuationInput {
expand: Option<bool>,
/// Email preview view used when hydrating email Soup items.
email_view: Option<GraphqlEmailView>,
+ /// Direction to order the page in. Defaults to DESC.
+ ///
+ /// The cursor does not carry it, so re-send whatever the initial query
+ /// used or the continuation flips order mid-list.
+ sort_direction: Option<GraphqlSortDirection>,
+}
+
+/// Direction a Soup page is ordered in.
+#[derive(async_graphql::Enum, Copy, Clone, Eq, PartialEq)]
+pub enum GraphqlSortDirection {
+ /// Oldest, or soonest-firing, first.
+ Asc,
+ /// Newest first.
+ Desc,
+}
+
+impl GraphqlSortDirection {
+ /// Convert this value into the domain representation.
+ fn into_model(self) -> SoupSortDirection {
+ match self {
+ GraphqlSortDirection::Asc => SoupSortDirection::Asc,
+ GraphqlSortDirection::Desc => SoupSortDirection::Desc,
+ }
+ }
}
/// Input for `Query.groupSoup`.
@@ -280,6 +308,7 @@ impl SoupInitialInput {
soup_type: soup_type(self.expand),
limit: self.limit.unwrap_or(20).min(500),
cursor: SoupQuery::new_sort_simple(sort, filter),
+ sort_direction: sort_direction(self.sort_direction),
user: macro_user_id,
email_preview_view: email_preview_view(self.email_view)?,
link_ids,
@@ -305,6 +334,7 @@ impl SoupContinuationInput {
soup_type: soup_type(self.expand),
limit,
cursor: SoupQuery::new_cursor_simple(cursor),
+ sort_direction: sort_direction(self.sort_direction),
user: macro_user_id,
email_preview_view: email_preview_view(self.email_view)?,
link_ids,
@@ -312,6 +342,13 @@ impl SoupContinuationInput {
}
}
+/// Convert the optional GraphQL sort direction into the domain representation.
+fn sort_direction(direction: Option<GraphqlSortDirection>) -> SoupSortDirection {
+ direction
+ .map(GraphqlSortDirection::into_model)
+ .unwrap_or_default()
+}
+
/// Convert the optional GraphQL expansion flag into the domain representation.
fn soup_type(expand: Option<bool>) -> SoupType {
match expand {
@@ -1087,8 +1124,10 @@ enum GraphqlReminderLiteral {
Id(ID),
/// The referenced entity, as `"{type}:{id}"`.
Entity(String),
- /// Whether the reminder has already fired.
+ /// Whether the owner has marked the reminder done.
Completed(bool),
+ /// Whether the reminder has come due and is awaiting its owner.
+ Fired(bool),
}
impl IntoFilterExpr<ReminderLiteral> for GraphqlReminderLiteral {
@@ -1106,6 +1145,7 @@ impl IntoFilterExpr<ReminderLiteral> for GraphqlReminderLiteral {
Self::Id(id) => ReminderLiteral::Id(parse_id(id, "id")?),
Self::Entity(entity) => ReminderLiteral::Entity(entity),
Self::Completed(completed) => ReminderLiteral::Completed(completed),
+ Self::Fired(fired) => ReminderLiteral::Fired(fired),
};
Ok(Expr::val(literal))
}
diff --git a/crates/graphql_soup/src/inputs/tests.rs b/crates/graphql_soup/src/inputs/tests.rs
index cda6174545..76ce2c9175 100644
--- a/crates/graphql_soup/src/inputs/tests.rs
+++ b/crates/graphql_soup/src/inputs/tests.rs
@@ -20,6 +20,7 @@ fn maps_email_view_to_soup_request() {
sort_method: None,
email_view: Some(GraphqlEmailView::Sent),
filters: None,
+ sort_direction: None,
}))
.into_request(test_macro_user_id(), vec![])
.unwrap();
@@ -35,6 +36,7 @@ fn defaults_email_view_to_inbox() {
sort_method: None,
email_view: None,
filters: None,
+ sort_direction: None,
}))
.into_request(test_macro_user_id(), vec![])
.unwrap();
@@ -57,6 +59,7 @@ fn maps_soup_cursor_continuation() {
cursor: cursor.to_string(),
expand: Some(false),
email_view: Some(GraphqlEmailView::Sent),
+ sort_direction: None,
})
.into_request(test_macro_user_id(), vec![])
.unwrap();
diff --git a/crates/graphql_soup/src/loaders.rs b/crates/graphql_soup/src/loaders.rs
index ba7bdd2006..f6073c08ef 100644
--- a/crates/graphql_soup/src/loaders.rs
+++ b/crates/graphql_soup/src/loaders.rs
@@ -38,7 +38,7 @@ use rootcause::{
markers::{Cloneable, Dynamic},
};
use soup::domain::{
- models::{SoupQuery, SoupRequest, SoupType},
+ models::{SoupQuery, SoupRequest, SoupSortDirection, SoupType},
ports::SoupService,
};
use uuid::Uuid;
@@ -136,6 +136,8 @@ where
soup_type: SoupType::Expanded,
limit,
cursor: SoupQuery::new_sort_simple(SimpleSortMethod::UpdatedAt, filter),
+ // Batch entity load — order is irrelevant, the caller re-keys by id.
+ sort_direction: SoupSortDirection::default(),
user: user_id.clone(),
email_preview_view: PreviewView::StandardLabel(PreviewViewStandardLabel::All),
link_ids,
diff --git a/crates/item_filters/src/ast/reminder.rs b/crates/item_filters/src/ast/reminder.rs
index cd6a08db4a..60c50e537f 100644
--- a/crates/item_filters/src/ast/reminder.rs
+++ b/crates/item_filters/src/ast/reminder.rs
@@ -21,9 +21,12 @@ pub enum ReminderLiteral {
/// Filter to reminders attached to this entity, as `"{type}:{id}"`.
#[serde(rename = "ent")]
Entity(String),
- /// Filter by whether the reminder has already fired.
+ /// Filter by whether the owner has marked the reminder done.
#[serde(rename = "comp")]
Completed(bool),
+ /// Filter by whether the reminder has come due and is awaiting its owner.
+ #[serde(rename = "fired")]
+ Fired(bool),
}
impl ExpandFrame<ReminderLiteral> for ReminderFilters {
@@ -37,6 +40,7 @@ impl ExpandFrame<ReminderLiteral> for ReminderFilters {
ids,
entities,
completed,
+ fired,
} = filter_request;
let include = include.then_some(Expr::val(ReminderLiteral::Include));
@@ -52,7 +56,9 @@ impl ExpandFrame<ReminderLiteral> for ReminderFilters {
let completed = completed.map(|c| Expr::val(ReminderLiteral::Completed(c)));
- Ok([include, ids, entities, completed]
+ let fired = fired.map(|f| Expr::val(ReminderLiteral::Fired(f)));
+
+ Ok([include, ids, entities, completed, fired]
.into_iter()
.fold_with(Expr::and))
}
diff --git a/crates/item_filters/src/lib.rs b/crates/item_filters/src/lib.rs
index b958e9ac88..726bc38d37 100644
--- a/crates/item_filters/src/lib.rs
+++ b/crates/item_filters/src/lib.rs
@@ -419,9 +419,18 @@ pub struct ReminderFilters {
/// Restrict to reminders attached to these entities, each `"{type}:{id}"`.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub entities: Vec<String>,
- /// Filter on whether the reminder has already fired. `None` returns both.
+ /// Filter on whether the owner has marked the reminder done. `None` returns
+ /// both.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub completed: Option<bool>,
+ /// Filter on whether the reminder's next run has come due, i.e. it has
+ /// fired and is awaiting its owner. `None` returns both.
+ ///
+ /// Evaluated server-side against the database clock rather than a
+ /// timestamp supplied by the caller: a timestamp would land in the query
+ /// cache key and change on every render.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub fired: Option<bool>,
}
impl IsEmpty for ReminderFilters {
@@ -431,8 +440,9 @@ impl IsEmpty for ReminderFilters {
ids,
entities,
completed,
+ fired,
} = self;
- !include && ids.is_empty() && entities.is_empty() && completed.is_none()
+ !include && ids.is_empty() && entities.is_empty() && completed.is_none() && fired.is_none()
}
}
diff --git a/crates/reminders/src/domain/models.rs b/crates/reminders/src/domain/models.rs
index 92c4dccd11..1b35abe568 100644
--- a/crates/reminders/src/domain/models.rs
+++ b/crates/reminders/src/domain/models.rs
@@ -244,6 +244,42 @@ pub struct ReminderForSoup {
pub reference: Option<ReminderReference>,
}
+/// Which end of the `next_run_at` ordering the Soup feed wants.
+///
+/// This picks the rows, not just their display order: the read is bounded by a
+/// limit with no cursor, so asking for the wrong end silently returns a
+/// different set of reminders.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
+pub enum SoupOrder {
+ /// Soonest `next_run_at` first — overdue and imminent reminders.
+ SoonestFirst,
+ /// Latest `next_run_at` first, matching Soup's usual newest-first feeds.
+ #[default]
+ LatestFirst,
+}
+
+/// One Soup read of a user's reminders.
+///
+/// Bundled rather than passed positionally: the filters are four `Option`s and
+/// slices in a row, where a transposed pair type-checks and silently returns
+/// the wrong rows.
+#[derive(Debug, Clone, Copy)]
+pub struct SoupReminderQuery<'a> {
+ /// Restrict to these reminder ids. Empty means no constraint.
+ pub ids: &'a [Uuid],
+ /// Restrict to reminders attached to these entities, each `"{type}:{id}"`.
+ /// Empty means no constraint.
+ pub entities: &'a [String],
+ /// Filter on whether the owner marked it done. `None` returns both.
+ pub completed: Option<bool>,
+ /// Filter on whether it has come due. `None` returns both.
+ pub fired: Option<bool>,
+ /// Which end of the `next_run_at` ordering `limit` rows come from.
+ pub order: SoupOrder,
+ /// Upper bound on rows returned.
+ pub limit: i64,
+}
+
/// The caller's reminders, soonest firing first.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]
diff --git a/crates/reminders/src/domain/ports.rs b/crates/reminders/src/domain/ports.rs
index 513fd7af51..7e9c855de3 100644
--- a/crates/reminders/src/domain/ports.rs
+++ b/crates/reminders/src/domain/ports.rs
@@ -8,7 +8,7 @@ use uuid::Uuid;
use crate::domain::models::{
CreateReminder, DeliveryOutcome, DueFiring, DueReminder, NewReminder, Reminder, ReminderBatch,
ReminderDispatchMessage, ReminderError, ReminderFilter, ReminderForSoup, ReminderPage,
- ReminderPatch, ReminderUpdate, SweepSummary,
+ ReminderPatch, ReminderUpdate, SoupReminderQuery, SweepSummary,
};
/// Source of the current time.
@@ -67,22 +67,26 @@ pub trait RemindersRepo: Send + Sync + 'static {
) -> impl Future<Output = Result<ReminderBatch, Self::Err>> + Send;
/// Read at most `limit` of the user's reminders for the Soup feed, ordered
- /// by `next_run_at` descending to match Soup's global ordering.
+ /// by `next_run_at` in `order`'s direction.
+ ///
+ /// `query.order` must match the direction Soup will merge in. There is no cursor
+ /// here, so it selects which `limit` reminders come back, not merely how
+ /// they are arranged: an ascending view served by a descending read gets
+ /// the furthest-future reminders and never sees an overdue one.
///
/// Deliberately separate from [`RemindersRepo::list_reminders`]: Soup pages
- /// on its own cursor and sorts descending, whereas the CRUD list keysets
- /// ascending on `(next_run_at, created_at, id)`. As in
- /// [`RemindersRepo::list_reminders`], an undecodable row is skipped rather
- /// than failing the whole read.
+ /// on its own cursor, whereas the CRUD list keysets ascending on
+ /// `(next_run_at, created_at, id)`. As in [`RemindersRepo::list_reminders`],
+ /// an undecodable row is skipped rather than failing the whole read.
+ ///
+ /// `query.fired` selects on whether `next_run_at` has come due, evaluated against
+ /// the database clock so the caller need not agree with it on the time.
///
/// An empty `ids`/`entities` slice means "no constraint", not "match none".
fn list_reminders_for_soup(
&self,
user_id: &MacroUserIdStr<'_>,
- ids: &[Uuid],
- entities: &[String],
- completed: Option<bool>,
- limit: i64,
+ query: SoupReminderQuery<'_>,
) -> impl Future<Output = Result<Vec<ReminderForSoup>, Self::Err>> + Send;
/// Apply `update` to one of the user's reminders, returning the new state.
@@ -286,10 +290,12 @@ pub trait RemindersService: Send + Sync + 'static {
filter: ReminderFilter,
) -> impl Future<Output = Result<ReminderPage, ReminderError>> + Send;
- /// List the user's reminders for the Soup feed.
+ /// List the user's reminders for the Soup feed, ordered by `order`.
///
- /// Soup owns pagination and ordering across every item type, so this
- /// returns a plain bounded slice rather than a [`ReminderPage`].
+ /// Soup owns pagination across every item type, so this returns a plain
+ /// bounded slice rather than a [`ReminderPage`]. It does not own ordering:
+ /// the bound is applied here, so `order` decides which reminders Soup gets
+ /// to merge.
///
/// Unlike the single-reminder methods this takes a user id rather than a
/// receipt: Soup reads many reminders at once, so there is no one entity
@@ -297,10 +303,7 @@ pub trait RemindersService: Send + Sync + 'static {
fn list_reminders_for_soup(
&self,
user_id: &MacroUserIdStr<'_>,
- ids: &[Uuid],
- entities: &[String],
- completed: Option<bool>,
- limit: i64,
+ query: SoupReminderQuery<'_>,
) -> impl Future<Output = Result<Vec<ReminderForSoup>, ReminderError>> + Send;
/// Modify the reminder the receipt was minted for.
diff --git a/crates/reminders/src/domain/service.rs b/crates/reminders/src/domain/service.rs
index 1b9f45315a..99d96cdd2f 100644
--- a/crates/reminders/src/domain/service.rs
+++ b/crates/reminders/src/domain/service.rs
@@ -14,7 +14,7 @@ use uuid::Uuid;
use crate::domain::models::{
CreateReminder, MAX_DESCRIPTION_LEN, NewReminder, Reminder, ReminderBatch, ReminderCursor,
ReminderError, ReminderFilter, ReminderForSoup, ReminderPage, ReminderPatch, ReminderSchedule,
- ReminderUpdate, ScheduleUpdate,
+ ReminderUpdate, ScheduleUpdate, SoupReminderQuery,
};
use crate::domain::ports::{Clock, RemindersRepo, RemindersService, SystemClock};
@@ -290,15 +290,12 @@ where
async fn list_reminders_for_soup(
&self,
user_id: &MacroUserIdStr<'_>,
- ids: &[Uuid],
- entities: &[String],
- completed: Option<bool>,
- limit: i64,
+ query: SoupReminderQuery<'_>,
) -> Result<Vec<ReminderForSoup>, ReminderError> {
// No re-probing on undecodable rows: Soup merges many item types and
// owns its own pagination, so a short slice is not a short page.
self.repo
- .list_reminders_for_soup(user_id, ids, entities, completed, limit)
+ .list_reminders_for_soup(user_id, query)
.await
.map_err(|e| rootcause::Report::new(e).into_dynamic())
.map_err(ReminderError::from)
@@ -402,10 +399,7 @@ impl RemindersService for NoOpRemindersService {
async fn list_reminders_for_soup(
&self,
_user_id: &MacroUserIdStr<'_>,
- _ids: &[Uuid],
- _entities: &[String],
- _completed: Option<bool>,
- _limit: i64,
+ _query: SoupReminderQuery<'_>,
) -> Result<Vec<ReminderForSoup>, ReminderError> {
Ok(Vec::new())
}
diff --git a/crates/reminders/src/domain/service/test.rs b/crates/reminders/src/domain/service/test.rs
index cb3a2f7c57..d9b8939aaa 100644
--- a/crates/reminders/src/domain/service/test.rs
+++ b/crates/reminders/src/domain/service/test.rs
@@ -1,6 +1,6 @@
use std::sync::{Arc, Mutex};
-use chrono::{Duration, TimeZone};
+use chrono::{Duration, TimeZone, Utc};
use chrono_tz::America::New_York;
use entity_access::domain::models::{
AccessLevel, AnyEntityPermission, Entity as AccessEntity, EntityAccessReceipt,
@@ -10,7 +10,8 @@ use model_entity::EntityType;
use super::*;
use crate::domain::models::{
- MAX_PAGE_SIZE, ReminderCron, ReminderForSoup, RemindersList, entity_token,
+ MAX_PAGE_SIZE, ReminderCron, ReminderForSoup, RemindersList, SoupOrder, SoupReminderQuery,
+ entity_token,
};
const USER_A: &str = "macro|[email protected]";
@@ -292,11 +293,16 @@ impl RemindersRepo for FakeRemindersRepo {
async fn list_reminders_for_soup(
&self,
user_id: &MacroUserIdStr<'_>,
- ids: &[Uuid],
- entities: &[String],
- completed: Option<bool>,
- limit: i64,
+ query: SoupReminderQuery<'_>,
) -> Result<Vec<ReminderForSoup>, Self::Err> {
+ let SoupReminderQuery {
+ ids,
+ entities,
+ completed,
+ fired,
+ order,
+ limit,
+ } = query;
self.check_failing()?;
let mut found: Vec<Reminder> = self
.rows()
@@ -314,10 +320,23 @@ impl RemindersRepo for FakeRemindersRepo {
Some(completed) => reminder.completed_at.is_some() == completed,
None => true,
})
+ .filter(|reminder| match fired {
+ Some(fired) => (reminder.next_run_at <= Utc::now()) == fired,
+ None => true,
+ })
.filter(|reminder| !self.is_unreadable(reminder.id))
.collect();
- // Descending, as the SQL adapter returns.
- found.sort_by_key(|reminder| std::cmp::Reverse((reminder.next_run_at, reminder.id)));
+ // Order and then bound, as the SQL adapter does — the bound is what
+ // makes the direction select rows rather than merely arrange them.
+ match order {
+ SoupOrder::SoonestFirst => {
+ found.sort_by_key(|reminder| (reminder.next_run_at, reminder.id));
+ }
+ SoupOrder::LatestFirst => {
+ found
+ .sort_by_key(|reminder| std::cmp::Reverse((reminder.next_run_at, reminder.id)));
+ }
+ }
found.truncate(limit.max(0) as usize);
// The fake has no documents to resolve against.
Ok(found
diff --git a/crates/reminders/src/inbound/axum_router/test.rs b/crates/reminders/src/inbound/axum_router/test.rs
index 468b8e9e41..2903f963fa 100644
--- a/crates/reminders/src/inbound/axum_router/test.rs
+++ b/crates/reminders/src/inbound/axum_router/test.rs
@@ -20,7 +20,7 @@ use tower::ServiceExt;
use uuid::Uuid;
use super::*;
-use crate::domain::models::{ReminderCursor, ReminderForSoup, ReminderPage};
+use crate::domain::models::{ReminderCursor, ReminderForSoup, ReminderPage, SoupReminderQuery};
const USER_ID: &str = "macro|[email protected]";
const VALID_JWT: &str = "valid";
@@ -380,10 +380,7 @@ impl RemindersService for FakeRemindersService {
async fn list_reminders_for_soup(
&self,
_user_id: &MacroUserIdStr<'_>,
- _ids: &[Uuid],
- _entities: &[String],
- _completed: Option<bool>,
- _limit: i64,
+ _query: SoupReminderQuery<'_>,
) -> Result<Vec<ReminderForSoup>, ReminderError> {
self.fail_if_configured()?;
Ok(vec![ReminderForSoup {
diff --git a/crates/reminders/src/outbound/pg_reminders_repo.rs b/crates/reminders/src/outbound/pg_reminders_repo.rs
index 0ec7258358..760d962333 100644
--- a/crates/reminders/src/outbound/pg_reminders_repo.rs
+++ b/crates/reminders/src/outbound/pg_reminders_repo.rs
@@ -16,7 +16,7 @@ use uuid::Uuid;
use crate::domain::models::{
DueFiring, DueReminder, InvalidCron, NewReminder, Reminder, ReminderBatch, ReminderCron,
ReminderCursor, ReminderFilter, ReminderForSoup, ReminderReference, ReminderSchedule,
- ReminderUpdate,
+ ReminderUpdate, SoupOrder, SoupReminderQuery,
};
use crate::domain::ports::{ReminderDispatchRepo, RemindersRepo};
@@ -410,15 +410,21 @@ impl RemindersRepo for PgRemindersRepo {
async fn list_reminders_for_soup(
&self,
user_id: &MacroUserIdStr<'_>,
- ids: &[Uuid],
- entities: &[String],
- completed: Option<bool>,
- limit: i64,
+ query: SoupReminderQuery<'_>,
) -> Result<Vec<ReminderForSoup>, Self::Err> {
+ let SoupReminderQuery {
+ ids,
+ entities,
+ completed,
+ fired,
+ order,
+ limit,
+ } = query;
// Empty means "no constraint", so bind NULL rather than an empty array
// — `= ANY('{}')` matches nothing.
let ids = (!ids.is_empty()).then_some(ids);
let entities = (!entities.is_empty()).then_some(entities);
+ let soonest_first = matches!(order, SoupOrder::SoonestFirst);
let rows = sqlx::query!(
r#"
@@ -457,15 +463,28 @@ impl RemindersRepo for PgRemindersRepo {
)
)
AND ($4::bool IS NULL OR (r.completed_at IS NOT NULL) = $4)
- -- Descending to match Soup's global ordering, so the LIMIT keeps the
- -- same rows Soup would keep after merging every item type.
- ORDER BY r.next_run_at DESC, r.id DESC
- LIMIT $5
+ -- Due-ness is resolved against the database clock. The caller
+ -- cannot pass a timestamp: it would land in the client's query
+ -- cache key and change on every render.
+ AND ($5::bool IS NULL OR (r.next_run_at <= now()) = $5)
+ -- Order in whichever direction Soup will merge in, so the LIMIT
+ -- keeps the same rows Soup would keep after merging every item
+ -- type. The first two keys collapse to a constant NULL when $6 is
+ -- false, leaving the descending pair to decide; when it is true
+ -- they fully determine the order and the descending pair is inert.
+ ORDER BY
+ CASE WHEN $6::bool THEN r.next_run_at END ASC,
+ CASE WHEN $6::bool THEN r.id END ASC,
+ r.next_run_at DESC,
+ r.id DESC
+ LIMIT $7
"#,
user_id.as_ref(),
ids as Option<&[Uuid]>,
entities as Option<&[String]>,
completed,
+ fired,
+ soonest_first,
limit,
)
.fetch_all(&self.pool)
diff --git a/crates/reminders/src/outbound/pg_reminders_repo/test.rs b/crates/reminders/src/outbound/pg_reminders_repo/test.rs
index 2bcf4d3775..0a53097550 100644
--- a/crates/reminders/src/outbound/pg_reminders_repo/test.rs
+++ b/crates/reminders/src/outbound/pg_reminders_repo/test.rs
@@ -6,7 +6,9 @@ use model_entity::EntityType;
use sqlx::PgPool;
use super::*;
-use crate::domain::models::{ReminderCursor, ScheduleUpdate, entity_token};
+use crate::domain::models::{
+ ReminderCursor, ScheduleUpdate, SoupOrder, SoupReminderQuery, entity_token,
+};
const USER_A: &str = "macro|[email protected]";
const USER_B: &str = "macro|[email protected]";
@@ -36,6 +38,19 @@ fn recurring() -> ReminderSchedule {
}
}
+/// A Soup read with no filters, newest first. Spread over it to vary one field:
+/// `SoupReminderQuery { completed: Some(false), ..soup_query(100) }`.
+fn soup_query(limit: i64) -> SoupReminderQuery<'static> {
+ SoupReminderQuery {
+ ids: &[],
+ entities: &[],
+ completed: None,
+ fired: None,
+ order: SoupOrder::LatestFirst,
+ limit,
+ }
+}
+
fn new_reminder(description: &str, schedule: ReminderSchedule) -> NewReminder {
let next_run_at = schedule
.next_run_after(at(2026, 1, 1, 0))
@@ -1618,7 +1633,7 @@ async fn soup_list_returns_the_users_reminders_newest_firing_first(pool: PgPool)
.expect("insert");
let found = repo
- .list_reminders_for_soup(&user(USER_A), &[], &[], None, 100)
+ .list_reminders_for_soup(&user(USER_A), soup_query(100))
.await
.expect("soup list should succeed");
@@ -1630,6 +1645,138 @@ async fn soup_list_returns_the_users_reminders_newest_firing_first(pool: PgPool)
assert_eq!(descriptions, vec!["later", "soon"]);
}
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn soup_list_soonest_first_reverses_the_order(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ let repo = PgRemindersRepo::new(pool);
+
+ for (description, day) in [("soon", 1), ("middle", 15), ("later", 28)] {
+ repo.create_reminder(
+ &user(USER_A),
+ &new_reminder(description, once_at(at(2026, 8, day, 14))),
+ )
+ .await
+ .expect("insert");
+ }
+
+ let found = repo
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ order: SoupOrder::SoonestFirst,
+ ..soup_query(100)
+ },
+ )
+ .await
+ .expect("soup list should succeed");
+
+ let descriptions: Vec<&str> = found
+ .iter()
+ .map(|r| r.reminder.description.as_str())
+ .collect();
+ assert_eq!(descriptions, vec!["soon", "middle", "later"]);
+}
+
+/// The direction picks the rows, not just their order: there is no cursor
+/// here, so a bounded read in the wrong direction returns a different set.
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn soup_list_takes_the_limit_from_the_ordered_end(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ let repo = PgRemindersRepo::new(pool);
+
+ for (description, day) in [("soon", 1), ("middle", 15), ("later", 28)] {
+ repo.create_reminder(
+ &user(USER_A),
+ &new_reminder(description, once_at(at(2026, 8, day, 14))),
+ )
+ .await
+ .expect("insert");
+ }
+
+ let soonest = repo
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ order: SoupOrder::SoonestFirst,
+ ..soup_query(1)
+ },
+ )
+ .await
+ .expect("soup list should succeed");
+ assert_eq!(soonest.len(), 1);
+ assert_eq!(soonest[0].reminder.description, "soon");
+
+ let latest = repo
+ .list_reminders_for_soup(&user(USER_A), soup_query(1))
+ .await
+ .expect("soup list should succeed");
+ assert_eq!(latest.len(), 1);
+ assert_eq!(latest[0].reminder.description, "later");
+}
+
+/// `fired` is what separates the Active tab from Scheduled, and it has to be
+/// applied in SQL: both tabs are otherwise the same `completed = false` query,
+/// so the row limit would be spent on whichever end the sort favours.
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn soup_list_filters_on_whether_the_reminder_has_come_due(pool: PgPool) {
+ insert_user(&pool, USER_A).await;
+ let repo = PgRemindersRepo::new(pool);
+
+ repo.create_reminder(
+ &user(USER_A),
+ &new_reminder("already fired", once_at(at(2026, 3, 1, 9))),
+ )
+ .await
+ .expect("insert");
+ repo.create_reminder(
+ &user(USER_A),
+ &new_reminder("not yet", once_at(at(2099, 1, 1, 9))),
+ )
+ .await
+ .expect("insert");
+
+ let fired = repo
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ completed: Some(false),
+ fired: Some(true),
+ ..soup_query(100)
+ },
+ )
+ .await
+ .expect("soup list should succeed");
+ assert_eq!(fired.len(), 1);
+ assert_eq!(fired[0].reminder.description, "already fired");
+
+ let scheduled = repo
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ completed: Some(false),
+ fired: Some(false),
+ order: SoupOrder::SoonestFirst,
+ ..soup_query(100)
+ },
+ )
+ .await
+ .expect("soup list should succeed");
+ assert_eq!(scheduled.len(), 1);
+ assert_eq!(scheduled[0].reminder.description, "not yet");
+
+ let both = repo
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ completed: Some(false),
+ ..soup_query(100)
+ },
+ )
+ .await
+ .expect("soup list should succeed");
+ assert_eq!(both.len(), 2);
+}
+
#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
async fn soup_list_filters_by_id(pool: PgPool) {
insert_user(&pool, USER_A).await;
@@ -1650,7 +1797,13 @@ async fn soup_list_filters_by_id(pool: PgPool) {
.expect("insert");
let found = repo
- .list_reminders_for_soup(&user(USER_A), &[wanted.id], &[], None, 100)
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ ids: &[wanted.id],
+ ..soup_query(100)
+ },
+ )
.await
.expect("soup list should succeed");
@@ -1691,10 +1844,10 @@ async fn soup_list_filters_by_entity_token(pool: PgPool) {
let found = repo
.list_reminders_for_soup(
&user(USER_A),
- &[],
- &[entity_token(&EntityType::Document.with_entity_str(DOC_1))],
- None,
- 100,
+ SoupReminderQuery {
+ entities: &[entity_token(&EntityType::Document.with_entity_str(DOC_1))],
+ ..soup_query(100)
+ },
)
.await
.expect("soup list should succeed");
@@ -1729,14 +1882,26 @@ async fn soup_list_filters_on_completion(pool: PgPool) {
.expect("complete should update");
let pending = repo
- .list_reminders_for_soup(&user(USER_A), &[], &[], Some(false), 100)
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ completed: Some(false),
+ ..soup_query(100)
+ },
+ )
.await
.expect("soup list should succeed");
assert_eq!(pending.len(), 1);
assert_eq!(pending[0].reminder.description, "pending");
let completed = repo
- .list_reminders_for_soup(&user(USER_A), &[], &[], Some(true), 100)
+ .list_reminders_for_soup(
+ &user(USER_A),
+ SoupReminderQuery {
+ completed: Some(true),
+ ..soup_query(100)
+ },
+ )
.await
.expect("soup list should succeed");
assert_eq!(completed.len(), 1);
@@ -1744,7 +1909,7 @@ async fn soup_list_filters_on_completion(pool: PgPool) {
// `None` means "no constraint", so both come back.
let both = repo
- .list_reminders_for_soup(&user(USER_A), &[], &[], None, 100)
+ .list_reminders_for_soup(&user(USER_A), soup_query(100))
.await
.expect("soup list should succeed");
assert_eq!(both.len(), 2);
@@ -1883,7 +2048,7 @@ async fn soup_list_resolves_the_referenced_documents_file_type(pool: PgPool) {
.expect("insert");
let found = repo
- .list_reminders_for_soup(&user(USER_A), &[], &[], None, 100)
+ .list_reminders_for_soup(&user(USER_A), soup_query(100))
.await
.expect("soup list should succeed");
@@ -1911,7 +2076,7 @@ async fn soup_list_has_no_reference_for_a_standalone_reminder(pool: PgPool) {
.expect("insert");
let found = repo
- .list_reminders_for_soup(&user(USER_A), &[], &[], None, 100)
+ .list_reminders_for_soup(&user(USER_A), soup_query(100))
.await
.expect("soup list should succeed");
diff --git a/crates/soup/src/domain/models.rs b/crates/soup/src/domain/models.rs
index 78b3de171e..4a105be836 100644
--- a/crates/soup/src/domain/models.rs
+++ b/crates/soup/src/domain/models.rs
@@ -36,11 +36,26 @@ use models_pagination::{Cursor, CursorWithValAndFilter, Frecency, Query, SimpleS
use models_soup::SoupProperty;
use models_soup::item::SoupItem;
use non_empty::IsEmpty;
+use reminders::domain::models::SoupOrder;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use thiserror::Error;
use uuid::Uuid;
+/// Direction the merged Soup page is ordered in.
+///
+/// Deliberately Soup's own type rather than one borrowed from the paginator:
+/// `Paginator` already exposes `sort_asc`/`sort_desc`, so this only has to name
+/// the choice, and doing it here keeps the shared pagination crate untouched.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
+pub enum SoupSortDirection {
+ /// Smallest sort value first — oldest, or soonest for a future timestamp.
+ Asc,
+ /// Largest sort value first. What every view but Scheduled reminders wants.
+ #[default]
+ Desc,
+}
+
/// Controls whether soup items should include expanded nested data.
#[derive(Debug, Clone, Copy)]
pub enum SoupType {
@@ -235,6 +250,20 @@ pub struct SoupRequest<T> {
pub limit: u16,
/// Initial query or pagination cursor to execute.
pub cursor: SoupQuery<T>,
+ /// Direction the merged page is ordered in. Defaults to descending, which
+ /// is what every feed but reminders wants.
+ ///
+ /// One choice per request: the paginator sorts the whole merged page, so
+ /// this cannot differ per entity type within a single feed. It is a
+ /// sibling of the cursor rather than part of it because clients re-send
+ /// the request params on every page, which keeps the cursor format alone.
+ ///
+ /// Only the [`SoupQuery::Simple`] branch honours this. Frecency pages come
+ /// back ordered by relevance score and never have the merged sort applied,
+ /// so there is no ascending frecency order to produce — the REST adapter
+ /// rejects that combination rather than letting it read as supported, and
+ /// the GraphQL adapter cannot express frecency at all.
+ pub sort_direction: SoupSortDirection,
/// User whose soup should be queried.
pub user: MacroUserIdStr<'static>,
/// Email preview view used when hydrating email soup items.
@@ -257,6 +286,7 @@ impl IntoSoupReqAst for SoupRequest<EntityFilters> {
soup_type,
limit,
cursor,
+ sort_direction,
user,
email_preview_view,
link_ids,
@@ -266,6 +296,7 @@ impl IntoSoupReqAst for SoupRequest<EntityFilters> {
soup_type,
limit,
cursor: cursor.into_ast()?,
+ sort_direction,
user,
email_preview_view,
link_ids,
@@ -279,6 +310,7 @@ impl IntoSoupReqAst for SoupRequest<EntityFilterAst> {
soup_type,
limit,
cursor,
+ sort_direction,
user,
email_preview_view,
link_ids,
@@ -288,6 +320,7 @@ impl IntoSoupReqAst for SoupRequest<EntityFilterAst> {
soup_type,
limit,
cursor: cursor.map(|f| if f.is_empty() { None } else { Some(f) }),
+ sort_direction,
user,
email_preview_view,
link_ids,
@@ -550,6 +583,11 @@ impl SoupRequest<Option<EntityFilterAst>> {
reminder_ids: extract.ids,
entities: extract.entities,
completed: extract.completed,
+ fired: extract.fired,
+ order: match self.sort_direction {
+ SoupSortDirection::Asc => SoupOrder::SoonestFirst,
+ SoupSortDirection::Desc => SoupOrder::LatestFirst,
+ },
limit,
})
}
@@ -804,8 +842,13 @@ pub struct GetRemindersRequest<'a> {
/// Filter to reminders attached to these entities, each `"{type}:{id}"`.
/// Empty = no entity constraint.
pub entities: Vec<String>,
- /// Filter on whether the reminder has fired. `None` returns both.
+ /// Filter on whether the owner marked the reminder done. `None` returns both.
pub completed: Option<bool>,
+ /// Filter on whether the reminder has come due. `None` returns both.
+ pub fired: Option<bool>,
+ /// Which end of the `next_run_at` ordering to take `limit` rows from.
+ /// Mirrors the request's sort direction so the leg and the merge agree.
+ pub order: SoupOrder,
/// Upper bound on rows returned — the soup paginator re-slices.
pub limit: i64,
}
@@ -817,6 +860,7 @@ pub(crate) struct ReminderFilterExtract {
pub(crate) ids: Vec<Uuid>,
pub(crate) entities: Vec<String>,
pub(crate) completed: Option<bool>,
+ pub(crate) fired: Option<bool>,
}
impl ReminderFilterExtract {
@@ -828,8 +872,8 @@ impl ReminderFilterExtract {
}
/// Walks a `ReminderLiteral` AST collecting ids, entity tokens, and a single
-/// `Completed(bool)` constraint. Returns `false` (fail closed) on `Not(_)`, on
-/// conflicting `Completed` literals, and on an `Or` branch that is not a pure
+/// single `Completed(bool)`/`Fired(bool)` constraint. Returns `false` (fail
+/// closed) on `Not(_)`, on conflicting literals, and on an `Or` branch that is not a pure
/// id/entity sub-tree — the same shape restrictions as the CRM extractor, for
/// the same reason: a flat extract cannot represent those set semantics.
fn extract_reminder_filter(expr: &Expr<ReminderLiteral>, out: &mut ReminderFilterExtract) -> bool {
@@ -853,6 +897,13 @@ fn extract_reminder_filter(expr: &Expr<ReminderLiteral>, out: &mut ReminderFilte
true
}
},
+ Expr::Literal(ReminderLiteral::Fired(b)) => match out.fired {
+ Some(prev) if prev != *b => false,
+ _ => {
+ out.fired = Some(*b);
+ true
+ }
+ },
Expr::And(a, b) => extract_reminder_filter(a, out) && extract_reminder_filter(b, out),
Expr::Or(a, b) => {
// The repo ANDs `ids` against `entities`, so an `Or` spanning both
@@ -868,7 +919,8 @@ fn extract_reminder_filter(expr: &Expr<ReminderLiteral>, out: &mut ReminderFilte
}
/// Helper for [`extract_reminder_filter`]: an `Or` branch must be a pure
-/// id/entity sub-tree — a `Completed`, `And`, or `Not` inside fails closed.
+/// id/entity sub-tree — a `Completed`, `Fired`, `And`, or `Not` inside fails
+/// closed.
fn reminder_or_is_sets_only(expr: &Expr<ReminderLiteral>, out: &mut ReminderFilterExtract) -> bool {
match expr {
Expr::Literal(ReminderLiteral::Id(id)) => {
diff --git a/crates/soup/src/domain/service.rs b/crates/soup/src/domain/service.rs
index 45a474997b..d8505326b8 100644
--- a/crates/soup/src/domain/service.rs
+++ b/crates/soup/src/domain/service.rs
@@ -2,8 +2,8 @@ use crate::domain::{
models::{
AdvancedSortParams, EnrichedSoupItem, FrecencyQueryInner, GetCrmCompaniesRequest,
GetRemindersRequest, GroupedSortRequest, IntoSoupReqAst, SimpleQueryInner, SimpleSortQuery,
- SimpleSortRequest, SoupErr, SoupPropertiesField, SoupQuery, SoupRequest, SoupType,
- grouping::ItemGroupingInfo,
+ SimpleSortRequest, SoupErr, SoupPropertiesField, SoupQuery, SoupRequest, SoupSortDirection,
+ SoupType, grouping::ItemGroupingInfo,
},
ports::{SoupOutput, SoupRepo, SoupService},
};
@@ -50,7 +50,7 @@ use models_soup::{
item::SoupItem,
reminder::SoupReminder,
};
-use reminders::domain::ports::RemindersService;
+use reminders::domain::{models::SoupReminderQuery, ports::RemindersService};
use serde::Serialize;
use std::cmp::Ordering;
use uuid::Uuid;
@@ -522,12 +522,24 @@ where
reminder_ids,
entities,
completed,
+ fired,
+ order,
limit,
} = req;
let items: Vec<SoupItem<()>> = self
.reminders_service
- .list_reminders_for_soup(&user_id, &reminder_ids, &entities, completed, limit)
+ .list_reminders_for_soup(
+ &user_id,
+ SoupReminderQuery {
+ ids: &reminder_ids,
+ entities: &entities,
+ completed,
+ fired,
+ order,
+ limit,
+ },
+ )
.await
.map_err(|err| {
tracing::error!(error = ?err, "reminder soup request failed");
@@ -817,6 +829,7 @@ where
let comms_thread_request = req.build_comms_thread_request();
let call_request = req.build_call_request();
let reminder_request = req.build_reminder_request(limit.into());
+ let sort_direction = req.sort_direction;
match req.cursor {
SoupQuery::Simple(SimpleQueryInner(cursor)) => {
@@ -863,7 +876,7 @@ where
foreign_entity_soup_fut,
);
- let page = main_soup?
+ let paginator = main_soup?
.chain(email_soup?)
.chain(comms_soup?)
.chain(comms_thread_soup?)
@@ -872,9 +885,13 @@ where
.chain(reminder_soup?)
.chain(foreign_entity_soup?)
.paginate_on(limit.into(), sort_method)
- .filter_on(entity_filter)
- .sort_desc()
- .into_page();
+ .filter_on(entity_filter);
+
+ let page = match sort_direction {
+ SoupSortDirection::Asc => paginator.sort_asc(),
+ SoupSortDirection::Desc => paginator.sort_desc(),
+ }
+ .into_page();
Ok(Either::Left(page))
}
diff --git a/crates/soup/src/domain/service/tests.rs b/crates/soup/src/domain/service/tests.rs
index 38e757d349..55229a5804 100644
--- a/crates/soup/src/domain/service/tests.rs
+++ b/crates/soup/src/domain/service/tests.rs
@@ -624,6 +624,7 @@ async fn simple_soup_includes_channel_threads() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -685,6 +686,7 @@ async fn simple_soup_includes_call_records() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -738,6 +740,7 @@ async fn simple_soup_uses_channel_thread_filters_without_touching_channel_filter
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -807,6 +810,7 @@ async fn simple_soup_includes_foreign_entities() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -889,6 +893,7 @@ async fn frecency_soup_does_not_query_foreign_entities() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -936,6 +941,7 @@ async fn team_receipt_contributes_team_foreign_entity_source_id() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -997,6 +1003,7 @@ async fn crm_filters_without_team_receipt_are_rejected() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1044,6 +1051,7 @@ async fn foreign_entity_filter_suppresses_non_matching_foreign_entities() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1116,6 +1124,7 @@ async fn it_should_not_query_frecency() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1178,6 +1187,7 @@ async fn properties_are_populated_once_after_pagination() {
)
.get_user_soup_with_properties(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1252,6 +1262,7 @@ async fn frecency_is_populated_once_after_pagination() {
)
.get_user_soup_with_frecency(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1321,6 +1332,7 @@ async fn properties_and_frecency_are_composed_after_pagination() {
)
.get_user_soup_with_properties_and_frecency(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1486,6 +1498,7 @@ async fn it_should_query_frecency() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1571,6 +1584,7 @@ async fn it_should_sort_frecency_descending() {
)
.get_user_soup_with_frecency(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1670,6 +1684,7 @@ async fn frecency_should_fallback() {
)
.get_user_soup_with_frecency(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1753,6 +1768,7 @@ async fn frecency_should_paginate() {
)
.get_user_soup_with_frecency(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1838,6 +1854,7 @@ async fn frecency_should_resume_cursor() {
)
.get_user_soup_with_frecency(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -1939,6 +1956,7 @@ async fn frecency_fallback_cursor_should_resume() {
)
.get_user_soup_with_frecency(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -2013,6 +2031,7 @@ async fn cursor_should_return_simple_sort() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -2086,6 +2105,7 @@ async fn cursor_should_return_frecency() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -2146,6 +2166,7 @@ async fn it_should_return_is_completed_true_for_completed_tasks() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -2196,6 +2217,7 @@ async fn it_should_return_is_completed_false_for_incomplete_tasks() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -2246,6 +2268,7 @@ async fn it_should_return_is_completed_none_for_non_tasks() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -2308,6 +2331,7 @@ async fn it_should_preserve_is_completed_for_mixed_items() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
@@ -2392,6 +2416,7 @@ async fn it_should_preserve_is_completed_in_by_ids_queries() {
)
.get_user_soup(
SoupRequest {
+ sort_direction: SoupSortDirection::default(),
email_preview_view: PreviewView::StandardLabel(
email::domain::models::PreviewViewStandardLabel::Inbox,
),
diff --git a/crates/soup/src/inbound/axum_router.rs b/crates/soup/src/inbound/axum_router.rs
index f9ac49497b..af7f2b1213 100644
--- a/crates/soup/src/inbound/axum_router.rs
+++ b/crates/soup/src/inbound/axum_router.rs
@@ -1,7 +1,7 @@
use crate::domain::{
models::{
EnrichedSoupItem, FrecencyQueryInner, GroupedSortRequest, IntoSoupReqAst, SimpleQueryInner,
- SoupErr, SoupItemWithProperties, SoupQuery, SoupRequest, SoupType,
+ SoupErr, SoupItemWithProperties, SoupQuery, SoupRequest, SoupSortDirection, SoupType,
grouping::{GroupMeta, build_grouped_response},
},
ports::SoupService,
@@ -85,6 +85,35 @@ pub struct Params {
/// Sort method. Options are viewed_at, created_at, updated_at, viewed_updated. Defaults to viewed_at.
#[serde(default)]
sort_method: Option<SoupApiSort>,
+ /// Sort direction. Options are asc, desc. Defaults to desc.
+ ///
+ /// Re-send this with every page: it is not carried in the cursor.
+ ///
+ /// Applies to the timestamp sort methods only. `asc` combined with
+ /// `frecency` is rejected rather than ignored: frecency pages are ordered
+ /// by relevance score and the cursor comparison assumes descending, so
+ /// there is no ascending frecency order to give.
+ #[serde(default)]
+ sort_direction: Option<SoupApiSortDirection>,
+}
+
+/// Sort direction accepted by non-grouped soup API endpoints.
+#[derive(Debug, Clone, Copy, Deserialize, utoipa::ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum SoupApiSortDirection {
+ /// Oldest, or soonest-firing, first.
+ Asc,
+ /// Newest first.
+ Desc,
+}
+
+impl From<SoupApiSortDirection> for SoupSortDirection {
+ fn from(value: SoupApiSortDirection) -> Self {
+ match value {
+ SoupApiSortDirection::Asc => SoupSortDirection::Asc,
+ SoupApiSortDirection::Desc => SoupSortDirection::Desc,
+ }
+ }
}
/// Sort options accepted by non-grouped soup API endpoints.
@@ -497,6 +526,8 @@ where
R: Clone + Serialize + Send,
{
let user_for_favorites = macro_user_id.copied().into_owned();
+ let sort_direction: SoupSortDirection =
+ params.sort_direction.map(Into::into).unwrap_or_default();
let create_fallback = move || -> SoupQuery<R> {
let params_sort = params
.sort_method
@@ -519,6 +550,15 @@ where
.unwrap_or_else(create_fallback),
};
+ // Frecency pages are ordered by relevance score, and that branch never
+ // applies the merged sort the direction would flip. Rejecting beats
+ // accepting the parameter and silently doing nothing with it. Checked
+ // against the resolved query so a frecency *cursor* is caught too, not
+ // just an initial request naming the method.
+ if sort_direction == SoupSortDirection::Asc && matches!(cursor, SoupQuery::Frecency(_)) {
+ return Err(SoupHandlerErr::AscendingFrecencyUnsupported);
+ }
+
// CRM authorization (team membership for CRM scope, admin/owner
// role for hidden companies) is enforced by the soup domain and
// CRM service from the receipt itself; the router just forwards
@@ -533,6 +573,7 @@ where
},
limit: params.limit.unwrap_or(20),
cursor,
+ sort_direction,
user: macro_user_id,
email_preview_view: email_view,
link_ids,
@@ -705,6 +746,9 @@ pub enum SoupHandlerErr {
/// Hidden CRM company query was requested without admin privileges.
#[error("Querying hidden CRM companies requires admin/owner team role")]
CrmAdminRequired,
+ /// Ascending order was requested for a frecency-sorted query.
+ #[error("sort_direction=asc is not supported with sort_method=frecency")]
+ AscendingFrecencyUnsupported,
}
impl From<SoupErr> for SoupHandlerErr {
@@ -721,7 +765,9 @@ impl From<SoupErr> for SoupHandlerErr {
impl IntoResponse for SoupHandlerErr {
fn into_response(self) -> axum::response::Response {
let status_code = match &self {
- SoupHandlerErr::ExpandErr(_) | SoupHandlerErr::Expand => StatusCode::BAD_REQUEST,
+ SoupHandlerErr::ExpandErr(_)
+ | SoupHandlerErr::Expand
+ | SoupHandlerErr::AscendingFrecencyUnsupported => StatusCode::BAD_REQUEST,
SoupHandlerErr::CrmScopeForbidden | SoupHandlerErr::CrmAdminRequired => {
StatusCode::FORBIDDEN
}
@@ -1153,6 +1199,7 @@ impl IntoSoupReqAst for SoupRequest<ApiEntityFilterAst> {
soup_type,
limit,
cursor,
+ sort_direction,
user,
email_preview_view,
link_ids,
@@ -1173,6 +1220,7 @@ impl IntoSoupReqAst for SoupRequest<ApiEntityFilterAst> {
soup_type,
limit,
cursor,
+ sort_direction,
user,
email_preview_view,
link_ids,
diff --git a/crates/soup/src/inbound/axum_router/tests.rs b/crates/soup/src/inbound/axum_router/tests.rs
index b5ef44a348..1b9bcbad00 100644
--- a/crates/soup/src/inbound/axum_router/tests.rs
+++ b/crates/soup/src/inbound/axum_router/tests.rs
@@ -33,8 +33,8 @@ use crate::{
domain::{
models::{
EnrichedSoupItem, FrecencyQueryInner, GroupedSortRequest, IntoSoupReqAst,
- SimpleQueryInner, SoupErr, SoupPropertiesField, SoupQuery, SoupRequest, SoupType,
- grouping::ItemGroupingInfo,
+ SimpleQueryInner, SoupErr, SoupPropertiesField, SoupQuery, SoupRequest,
+ SoupSortDirection, SoupType, grouping::ItemGroupingInfo,
},
ports::{SoupOutput, SoupService},
},
@@ -1644,6 +1644,7 @@ fn ast_endpoint_email_crm_domains_stamps_scope_and_ands_into_tree() {
});
let api: ApiEntityFilterAst = serde_json::from_value(js).unwrap();
let req = SoupRequest {
+ sort_direction: SoupSortDirection::default(),
soup_type: SoupType::Expanded,
limit: 20,
cursor: SoupQuery::Simple(SimpleQueryInner(Query::Sort(
@@ -1672,6 +1673,7 @@ fn ast_endpoint_email_crm_addresses_stamps_scope() {
});
let api: ApiEntityFilterAst = serde_json::from_value(js).unwrap();
let req = SoupRequest {
+ sort_direction: SoupSortDirection::default(),
soup_type: SoupType::Expanded,
limit: 20,
cursor: SoupQuery::Simple(SimpleQueryInner(Query::Sort(
@@ -1700,6 +1702,7 @@ fn ast_endpoint_email_crm_both_lists_rejected() {
});
let api: ApiEntityFilterAst = serde_json::from_value(js).unwrap();
let req = SoupRequest {
+ sort_direction: SoupSortDirection::default(),
soup_type: SoupType::Expanded,
limit: 20,
cursor: SoupQuery::Simple(SimpleQueryInner(Query::Sort(
@@ -1721,6 +1724,7 @@ fn ast_endpoint_empty_crm_lists_leaves_scope_none() {
});
let api: ApiEntityFilterAst = serde_json::from_value(js).unwrap();
let req = SoupRequest {
+ sort_direction: SoupSortDirection::default(),
soup_type: SoupType::Expanded,
limit: 20,
cursor: SoupQuery::Simple(SimpleQueryInner(Query::Sort(
@@ -1755,6 +1759,7 @@ fn ast_endpoint_crm_ands_with_existing_freeform_ef() {
});
let api: ApiEntityFilterAst = serde_json::from_value(js).unwrap();
let req = SoupRequest {
+ sort_direction: SoupSortDirection::default(),
soup_type: SoupType::Expanded,
limit: 20,
cursor: SoupQuery::Simple(SimpleQueryInner(Query::Sort(
@@ -1831,6 +1836,7 @@ fn ast_endpoint_crm_domains_are_lowercased_in_scope() {
});
let api: ApiEntityFilterAst = serde_json::from_value(js).unwrap();
let req = SoupRequest {
+ sort_direction: SoupSortDirection::default(),
soup_type: SoupType::Expanded,
limit: 20,
cursor: SoupQuery::Simple(SimpleQueryInner(Query::Sort(
@@ -1849,3 +1855,63 @@ fn ast_endpoint_crm_domains_are_lowercased_in_scope() {
let scope = ast.email_filter.crm_scope.as_ref().expect("scope set");
assert!(matches!(scope, CrmScope::Domains(d) if d == &vec!["acme.com".to_string()]));
}
+
+/// Ascending frecency has no meaning — the frecency branch orders by relevance
+/// score and never applies the merged sort a direction would flip. Rejecting
+/// keeps the parameter honest rather than accepting it and doing nothing.
+#[tokio::test]
+async fn ascending_frecency_is_rejected() {
+ let request = authenticated_request()
+ .uri("/soup/ast")
+ .method(Method::POST)
+ .header("content-type", "application/json")
+ .body(axum::body::Body::from(
+ serde_json::to_vec(&json!({
+ "sort_method": "frecency",
+ "sort_direction": "asc"
+ }))
+ .unwrap(),
+ ))
+ .unwrap();
+
+ let (status, body) = send_json(mock_router(), request).await;
+ assert_eq!(status, StatusCode::BAD_REQUEST);
+ assert_eq!(
+ body,
+ json!({
+ "message": "sort_direction=asc is not supported with sort_method=frecency"
+ })
+ );
+}
+
+/// The descending default must still reach the service — the guard is scoped to
+/// the one unsupported combination, not to frecency as a whole.
+#[tokio::test]
+async fn descending_frecency_is_accepted() {
+ let soup = MockSoup::new();
+ let inner_counter = soup.called.clone();
+ let router: Router = mock_router_with(
+ soup,
+ MockEmailLinkResult {
+ get_link_result: Arc::new(|| Ok(None)),
+ },
+ );
+
+ let request = authenticated_request()
+ .uri("/soup/ast")
+ .method(Method::POST)
+ .header("content-type", "application/json")
+ .body(axum::body::Body::from(
+ serde_json::to_vec(&json!({ "sort_method": "frecency" })).unwrap(),
+ ))
+ .unwrap();
+
+ let response = router.oneshot(request).await.unwrap();
+
+ // The mock service always errors, so the 500 is the harness rather than the
+ // guard — pinned instead of loosely asserting "not 400" so a genuine
+ // regression to some other status is caught. Reaching the service at all is
+ // the actual claim: the guard let this combination through.
+ assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR);
+ assert_eq!(inner_counter.lock().unwrap().len(), 1);
+}
diff --git a/crates/soup/src/inbound/toolset/list_entities.rs b/crates/soup/src/inbound/toolset/list_entities.rs
index a48024a5cd..c92dbefa5b 100644
--- a/crates/soup/src/inbound/toolset/list_entities.rs
+++ b/crates/soup/src/inbound/toolset/list_entities.rs
@@ -1,7 +1,9 @@
//! ListEntities tool for browsing workspace items.
use crate::domain::{
- models::{EnrichedSoupItem, SoupPropertiesField, SoupQuery, SoupRequest, SoupType},
+ models::{
+ EnrichedSoupItem, SoupPropertiesField, SoupQuery, SoupRequest, SoupSortDirection, SoupType,
+ },
ports::SoupService,
};
use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
@@ -759,6 +761,8 @@ where
soup_type: SoupType::Expanded,
limit,
cursor: SoupQuery::new_sort_simple(sort_method, filters),
+ // The tool has no ascending mode; newest first as before.
+ sort_direction: SoupSortDirection::default(),
user: request_context.user_id.clone(),
email_preview_view,
link_ids,
diff --git a/packages/sdk/generated/search/types.gen.ts b/packages/sdk/generated/search/types.gen.ts
index 4bbadf214d..f0be4a4fdb 100644
--- a/packages/sdk/generated/search/types.gen.ts
+++ b/packages/sdk/generated/search/types.gen.ts
@@ -1443,13 +1443,23 @@ export type PropertyValue = {
*/
export type ReminderFilters = {
/**
- * Filter on whether the reminder has already fired. `None` returns both.
+ * Filter on whether the owner has marked the reminder done. `None` returns
+ * both.
*/
completed?: boolean | null;
/**
* Restrict to reminders attached to these entities, each `"{type}:{id}"`.
*/
entities?: Array<string>;
+ /**
+ * Filter on whether the reminder's next run has come due, i.e. it has
+ * fired and is awaiting its owner. `None` returns both.
+ *
+ * Evaluated server-side against the database clock rather than a
+ * timestamp supplied by the caller: a timestamp would land in the query
+ * cache key and change on every render.
+ */
+ fired?: boolean | null;
/**
* Reminder ids to filter by. Empty to include all of the caller's reminders.
*/
diff --git a/packages/sdk/generated/storage/index.ts b/packages/sdk/generated/storage/index.ts
index 9e05b93cf4..771b02c4fb 100644
--- a/packages/sdk/generated/storage/index.ts
+++ b/packages/sdk/generated/storage/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { type Options, Sdk } from './sdk.gen';
-export type { AccessLevel, Activity, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Anchor, AnchorId, AnchorRequest, AnchorResponse, AnnotationIncrementalUpdate, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelContextMessage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelMessage, ApiChannelMessageKind, ApiChannelMessagesPage, ApiChannelParticipant, ApiChannelWithLatest, ApiCountedReaction, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiMessageAttachment, ApiMessageSender, ApiMessageSenderType, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, ApiResolvedChannelMessage, ApiThreadInfo, ApiThreadReply, AttendeeResponseStatus, BasicDocument, BasicDocumentSubType, BomPart, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelEventAttachment, ChannelFilters, ChannelJoinCodeResponse, ChannelMentionedMetadata, ChannelMessage, ChannelMessageAttachmentCreatedMetadata, ChannelMessageAttachmentRemovedMetadata, ChannelMessageDeletedMetadata, ChannelMessageFilters, ChannelMessagePatchedMetadata, ChannelMessagePostedMetadata, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClientOptions, CloudStorageItemType, Comment, CommentThread, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCommentData, CreateCommentError, CreateCommentErrors, CreateCommentRequest, CreateCommentResponse, CreateCommentResponse2, CreateCommentResponses, CreateCrmCommentData, CreateCrmCommentError, CreateCrmCommentErrors, CreateCrmCommentRequest, CreateCrmCommentResponse, CreateCrmCommentResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateReminderData, CreateReminderError, CreateReminderErrors, CreateReminderRequest, CreateReminderResponse, CreateReminderResponses, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmComment, CrmCommentEntityType, CrmCommentThread, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmTeamSettingsResponse, CrmThread, CustomSpeakerAssignment, DataType, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorInfo, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelResponse, DeleteChannelResponses, DeleteCommentData, DeleteCommentError, DeleteCommentErrors, DeleteCommentRequest, DeleteCommentResponse, DeleteCommentResponse2, DeleteCommentResponses, DeleteCrmCommentData, DeleteCrmCommentError, DeleteCrmCommentErrors, DeleteCrmCommentResponse, DeleteCrmCommentResponses, DeleteCrmCommentResult, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteMessageData, DeleteMessageError, DeleteMessageErrors, DeleteMessageQuery, DeleteMessageResponse, DeleteMessageResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderError, DeleteReminderErrors, DeleteReminderResponse, DeleteReminderResponses, DeleteThreadInfo, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentTeamShareResponse, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditCommentData, EditCommentError, EditCommentErrors, EditCommentRequest, EditCommentResponse, EditCommentResponse2, EditCommentResponses, EditCrmCommentData, EditCrmCommentError, EditCrmCommentErrors, EditCrmCommentRequest, EditCrmCommentResponse, EditCrmCommentResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmptyResponse, EntityFilters, EntityPermission, EntityPermissionResponse, EntityReference, EntityType, ErrorResponse, EventStatus, EventTime, EventTransparency, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileSystemNodeWithIds, FileType, FileTypeUpdate, FolderItem, ForeignEntity, ForeignEntityFilters, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActivitiesResponse, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelMessagesData, GetChannelMessagesError, GetChannelMessagesErrors, GetChannelMessagesResponse, GetChannelMessagesResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentCommentsData, GetDocumentCommentsError, GetDocumentCommentsErrors, GetDocumentCommentsResponse, GetDocumentCommentsResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetMessageWithContextData, GetMessageWithContextError, GetMessageWithContextErrors, GetMessageWithContextResponse, GetMessageWithContextResponse2, GetMessageWithContextResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetRecentActivityHandlerData, GetRecentActivityHandlerError, GetRecentActivityHandlerErrors, GetRecentActivityHandlerResponse, GetRecentActivityHandlerResponses, GetReminderData, GetReminderError, GetReminderErrors, GetReminderResponse, GetReminderResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetThreadRepliesData, GetThreadRepliesError, GetThreadRepliesErrors, GetThreadRepliesResponse, GetThreadRepliesResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubPullRequest, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestsResponse, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, InteractionReason, Item, ItemWithUserAccessLevel, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, LatestMessage, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListCrmCommentsData, ListCrmCommentsError, ListCrmCommentsErrors, ListCrmCommentsResponse, ListCrmCommentsResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListRemindersData, ListRemindersError, ListRemindersErrors, ListRemindersResponse, ListRemindersResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, Mentions, NewChannelAttachment, NotificationFilters, Params, ParticipantRole, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageData, PatchMessageError, PatchMessageErrors, PatchMessageRequest, PatchMessageResponse, PatchMessageResponses, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfAnchorRequest, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PdfPlaceableCommentAnchorRequest, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostChannelMessagesData, PostChannelMessagesError, PostChannelMessagesErrors, PostChannelMessagesResponse, PostChannelMessagesResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessageData, PostMessageError, PostMessageErrors, PostMessageRequest, PostMessageResponse, PostMessageResponse2, PostMessageResponses, PostReactionData, PostReactionError, PostReactionErrors, PostReactionRequest, PostReactionResponse, PostReactionResponses, PostSoupAstRequest, PostSoupRequest, PostTypingData, PostTypingError, PostTypingErrors, PostTypingRequest, PostTypingResponse, PostTypingResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresignedUrl, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyFilter, PropertyInput, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, ReactionAction, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, Reminder, ReminderFilters, ReminderSchedule, RemindersList, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ResolveChannelMessageData, ResolveChannelMessageError, ResolveChannelMessageErrors, ResolveChannelMessageResponse, ResolveChannelMessageResponses, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, S3ObjectInfo, SaveBomPart, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetPropertyValue, SharedEmailFilter, SharePermissionV2, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SoupApiItem, SoupApiSort, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmDomain, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupReminderReference, SoupReminderSchedule, SoupReminderSoupPropertiesField, SoupThreadInfo, SoupThreadReply, StarterDocumentsResponse, String, SuccessResponse, SyncServiceVersionId, TagFilterMode, TaskFilters, TeamRole, Thread, ThreadResponse, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TranscriptSegmentRequest, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingAction, UnthreadedPdfUuidRequest, UpdateChannelSharePermission, UpdateCrmTeamSettingsRequest, UpdateOperation, UpdateReminderData, UpdateReminderError, UpdateReminderErrors, UpdateReminderRequest, UpdateReminderResponse, UpdateReminderResponses, UpdateSharePermissionRequestV2, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserActivitiesResponse, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, View, ViewPatch, ViewsResponse, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
+export type { AccessLevel, Activity, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Anchor, AnchorId, AnchorRequest, AnchorResponse, AnnotationIncrementalUpdate, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelContextMessage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelMessage, ApiChannelMessageKind, ApiChannelMessagesPage, ApiChannelParticipant, ApiChannelWithLatest, ApiCountedReaction, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiMessageAttachment, ApiMessageSender, ApiMessageSenderType, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, ApiResolvedChannelMessage, ApiThreadInfo, ApiThreadReply, AttendeeResponseStatus, BasicDocument, BasicDocumentSubType, BomPart, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelEventAttachment, ChannelFilters, ChannelJoinCodeResponse, ChannelMentionedMetadata, ChannelMessage, ChannelMessageAttachmentCreatedMetadata, ChannelMessageAttachmentRemovedMetadata, ChannelMessageDeletedMetadata, ChannelMessageFilters, ChannelMessagePatchedMetadata, ChannelMessagePostedMetadata, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClientOptions, CloudStorageItemType, Comment, CommentThread, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCommentData, CreateCommentError, CreateCommentErrors, CreateCommentRequest, CreateCommentResponse, CreateCommentResponse2, CreateCommentResponses, CreateCrmCommentData, CreateCrmCommentError, CreateCrmCommentErrors, CreateCrmCommentRequest, CreateCrmCommentResponse, CreateCrmCommentResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateReminderData, CreateReminderError, CreateReminderErrors, CreateReminderRequest, CreateReminderResponse, CreateReminderResponses, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmComment, CrmCommentEntityType, CrmCommentThread, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmTeamSettingsResponse, CrmThread, CustomSpeakerAssignment, DataType, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorInfo, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelResponse, DeleteChannelResponses, DeleteCommentData, DeleteCommentError, DeleteCommentErrors, DeleteCommentRequest, DeleteCommentResponse, DeleteCommentResponse2, DeleteCommentResponses, DeleteCrmCommentData, DeleteCrmCommentError, DeleteCrmCommentErrors, DeleteCrmCommentResponse, DeleteCrmCommentResponses, DeleteCrmCommentResult, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteMessageData, DeleteMessageError, DeleteMessageErrors, DeleteMessageQuery, DeleteMessageResponse, DeleteMessageResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteReminderData, DeleteReminderError, DeleteReminderErrors, DeleteReminderResponse, DeleteReminderResponses, DeleteThreadInfo, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentTeamShareResponse, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditCommentData, EditCommentError, EditCommentErrors, EditCommentRequest, EditCommentResponse, EditCommentResponse2, EditCommentResponses, EditCrmCommentData, EditCrmCommentError, EditCrmCommentErrors, EditCrmCommentRequest, EditCrmCommentResponse, EditCrmCommentResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmptyResponse, EntityFilters, EntityPermission, EntityPermissionResponse, EntityReference, EntityType, ErrorResponse, EventStatus, EventTime, EventTransparency, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileSystemNodeWithIds, FileType, FileTypeUpdate, FolderItem, ForeignEntity, ForeignEntityFilters, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActivitiesResponse, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelMessagesData, GetChannelMessagesError, GetChannelMessagesErrors, GetChannelMessagesResponse, GetChannelMessagesResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentCommentsData, GetDocumentCommentsError, GetDocumentCommentsErrors, GetDocumentCommentsResponse, GetDocumentCommentsResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetMessageWithContextData, GetMessageWithContextError, GetMessageWithContextErrors, GetMessageWithContextResponse, GetMessageWithContextResponse2, GetMessageWithContextResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetRecentActivityHandlerData, GetRecentActivityHandlerError, GetRecentActivityHandlerErrors, GetRecentActivityHandlerResponse, GetRecentActivityHandlerResponses, GetReminderData, GetReminderError, GetReminderErrors, GetReminderResponse, GetReminderResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetThreadRepliesData, GetThreadRepliesError, GetThreadRepliesErrors, GetThreadRepliesResponse, GetThreadRepliesResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubPullRequest, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestsResponse, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InstallSyncData, InstallSyncErrors, InteractionReason, Item, ItemWithUserAccessLevel, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, LatestMessage, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListCrmCommentsData, ListCrmCommentsError, ListCrmCommentsErrors, ListCrmCommentsResponse, ListCrmCommentsResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListRemindersData, ListRemindersError, ListRemindersErrors, ListRemindersResponse, ListRemindersResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, Mentions, NewChannelAttachment, NotificationFilters, Params, ParticipantRole, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageData, PatchMessageError, PatchMessageErrors, PatchMessageRequest, PatchMessageResponse, PatchMessageResponses, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfAnchorRequest, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PdfPlaceableCommentAnchorRequest, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostChannelMessagesData, PostChannelMessagesError, PostChannelMessagesErrors, PostChannelMessagesResponse, PostChannelMessagesResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessageData, PostMessageError, PostMessageErrors, PostMessageRequest, PostMessageResponse, PostMessageResponse2, PostMessageResponses, PostReactionData, PostReactionError, PostReactionErrors, PostReactionRequest, PostReactionResponse, PostReactionResponses, PostSoupAstRequest, PostSoupRequest, PostTypingData, PostTypingError, PostTypingErrors, PostTypingRequest, PostTypingResponse, PostTypingResponses, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresignedUrl, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyFilter, PropertyInput, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, ReactionAction, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, Reminder, ReminderFilters, ReminderSchedule, RemindersList, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ResolveChannelMessageData, ResolveChannelMessageError, ResolveChannelMessageErrors, ResolveChannelMessageResponse, ResolveChannelMessageResponses, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, S3ObjectInfo, SaveBomPart, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetPropertyValue, SharedEmailFilter, SharePermissionV2, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SoupApiItem, SoupApiSort, SoupApiSortDirection, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmDomain, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupReminderReference, SoupReminderSchedule, SoupReminderSoupPropertiesField, SoupThreadInfo, SoupThreadReply, StarterDocumentsResponse, String, SuccessResponse, SyncServiceVersionId, TagFilterMode, TaskFilters, TeamRole, Thread, ThreadResponse, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TranscriptSegmentRequest, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingAction, UnthreadedPdfUuidRequest, UpdateChannelSharePermission, UpdateCrmTeamSettingsRequest, UpdateOperation, UpdateReminderData, UpdateReminderError, UpdateReminderErrors, UpdateReminderRequest, UpdateReminderResponse, UpdateReminderResponses, UpdateSharePermissionRequestV2, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserActivitiesResponse, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, View, ViewPatch, ViewsResponse, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
diff --git a/packages/sdk/generated/storage/types.gen.ts b/packages/sdk/generated/storage/types.gen.ts
index 19c32b00f7..d6747f19b7 100644
--- a/packages/sdk/generated/storage/types.gen.ts
+++ b/packages/sdk/generated/storage/types.gen.ts
@@ -5434,6 +5434,7 @@ export type Params = {
* Limit the number of items returned. Defaults to 20. Max 500.
*/
limit?: number | null;
+ sort_direction?: null | SoupApiSortDirection;
sort_method?: null | SoupApiSort;
};
@@ -6124,13 +6125,23 @@ export type Reminder = {
*/
export type ReminderFilters = {
/**
- * Filter on whether the reminder has already fired. `None` returns both.
+ * Filter on whether the owner has marked the reminder done. `None` returns
+ * both.
*/
completed?: boolean | null;
/**
* Restrict to reminders attached to these entities, each `"{type}:{id}"`.
*/
entities?: Array<string>;
+ /**
+ * Filter on whether the reminder's next run has come due, i.e. it has
+ * fired and is awaiting its owner. `None` returns both.
+ *
+ * Evaluated server-side against the database clock rather than a
+ * timestamp supplied by the caller: a timestamp would land in the query
+ * cache key and change on every render.
+ */
+ fired?: boolean | null;
/**
* Reminder ids to filter by. Empty to include all of the caller's reminders.
*/
@@ -6471,6 +6482,11 @@ export type SoupApiItem = SoupItem & {
*/
export type SoupApiSort = 'viewed_at' | 'created_at' | 'updated_at' | 'viewed_updated' | 'frecency';
+/**
+ * Sort direction accepted by non-grouped soup API endpoints.
+ */
+export type SoupApiSortDirection = 'asc' | 'desc';
+
/**
* An email attachment as displayed in Soup.
*/
@@ -11453,6 +11469,17 @@ export type GetItemsSoupData = {
* Sort method. Options are viewed_at, created_at, updated_at, viewed_updated. Defaults to viewed_at.
*/
sort_method?: SoupApiSort;
+ /**
+ * Sort direction. Options are asc, desc. Defaults to desc.
+ *
+ * Re-send this with every page: it is not carried in the cursor.
+ *
+ * Applies to the timestamp sort methods only. `asc` combined with
+ * `frecency` is rejected rather than ignored: frecency pages are ordered
+ * by relevance score and the cursor comparison assumes descending, so
+ * there is no ascending frecency order to give.
+ */
+ sort_direction?: SoupApiSortDirection;
/**
* Base64 encoded cursor value.
*/
diff --git a/packages/sdk/specs/search.json b/packages/sdk/specs/search.json
index b669d6a13c..b4e27a579e 100644
--- a/packages/sdk/specs/search.json
+++ b/packages/sdk/specs/search.json
@@ -2854,7 +2854,7 @@
"properties": {
"completed": {
"type": ["boolean", "null"],
- "description": "Filter on whether the reminder has already fired. `None` returns both."
+ "description": "Filter on whether the owner has marked the reminder done. `None` returns\nboth."
},
"entities": {
"type": "array",
@@ -2863,6 +2863,10 @@
},
"description": "Restrict to reminders attached to these entities, each `\"{type}:{id}\"`."
},
+ "fired": {
+ "type": ["boolean", "null"],
+ "description": "Filter on whether the reminder's next run has come due, i.e. it has\nfired and is awaiting its owner. `None` returns both.\n\nEvaluated server-side against the database clock rather than a\ntimestamp supplied by the caller: a timestamp would land in the query\ncache key and change on every render."
+ },
"ids": {
"type": "array",
"items": {
diff --git a/packages/sdk/specs/storage.json b/packages/sdk/specs/storage.json
index 879bc430eb..3d6b191fa9 100644
--- a/packages/sdk/specs/storage.json
+++ b/packages/sdk/specs/storage.json
@@ -8291,6 +8291,15 @@
"$ref": "#/components/schemas/SoupApiSort"
}
},
+ {
+ "name": "sort_direction",
+ "in": "query",
+ "description": "Sort direction. Options are asc, desc. Defaults to desc.\n\nRe-send this with every page: it is not carried in the cursor.\n\nApplies to the timestamp sort methods only. `asc` combined with\n`frecency` is rejected rather than ignored: frecency pages are ordered\nby relevance score and the cursor comparison assumes descending, so\nthere is no ascending frecency order to give.",
+ "required": false,
+ "schema": {
+ "$ref": "#/components/schemas/SoupApiSortDirection"
+ }
+ },
{
"name": "cursor",
"in": "query",
@@ -19510,6 +19519,17 @@
"description": "Limit the number of items returned. Defaults to 20. Max 500.",
"minimum": 0
},
+ "sort_direction": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/SoupApiSortDirection",
+ "description": "Sort direction. Options are asc, desc. Defaults to desc.\n\nRe-send this with every page: it is not carried in the cursor.\n\nApplies to the timestamp sort methods only. `asc` combined with\n`frecency` is rejected rather than ignored: frecency pages are ordered\nby relevance score and the cursor comparison assumes descending, so\nthere is no ascending frecency order to give."
+ }
+ ]
+ },
"sort_method": {
"oneOf": [
{
@@ -20999,7 +21019,7 @@
"properties": {
"completed": {
"type": ["boolean", "null"],
- "description": "Filter on whether the reminder has already fired. `None` returns both."
+ "description": "Filter on whether the owner has marked the reminder done. `None` returns\nboth."
},
"entities": {
"type": "array",
@@ -21008,6 +21028,10 @@
},
"description": "Restrict to reminders attached to these entities, each `\"{type}:{id}\"`."
},
+ "fired": {
+ "type": ["boolean", "null"],
+ "description": "Filter on whether the reminder's next run has come due, i.e. it has\nfired and is awaiting its owner. `None` returns both.\n\nEvaluated server-side against the database clock rather than a\ntimestamp supplied by the caller: a timestamp would land in the query\ncache key and change on every render."
+ },
"ids": {
"type": "array",
"items": {
@@ -21539,6 +21563,11 @@
"frecency"
]
},
+ "SoupApiSortDirection": {
+ "type": "string",
+ "description": "Sort direction accepted by non-grouped soup API endpoints.",
+ "enum": ["asc", "desc"]
+ },
"SoupAttachment": {
"type": "object",
"description": "An email attachment as displayed in Soup.",
diff --git a/static_assets/schema.graphql b/static_assets/schema.graphql
index 96e76657ad..957ea55afa 100644
--- a/static_assets/schema.graphql
+++ b/static_assets/schema.graphql
@@ -1946,9 +1946,13 @@ input GraphqlReminderLiteral @oneOf {
"""
entity: String
"""
- Whether the reminder has already fired.
+ Whether the owner has marked the reminder done.
"""
completed: Boolean
+ """
+ Whether the reminder has come due and is awaiting its owner.
+ """
+ fired: Boolean
}
"""
@@ -2089,6 +2093,20 @@ type GraphqlSnippetSubType {
nothing: Boolean!
}
+"""
+Direction a Soup page is ordered in.
+"""
+enum GraphqlSortDirection {
+ """
+ Oldest, or soonest-firing, first.
+ """
+ ASC
+ """
+ Newest first.
+ """
+ DESC
+}
+
"""
GraphQL representation of a Soup group bin.
"""
@@ -3927,6 +3945,13 @@ input SoupContinuationInput {
Email preview view used when hydrating email Soup items.
"""
emailView: GraphqlEmailView
+ """
+ Direction to order the page in. Defaults to DESC.
+
+ The cursor does not carry it, so re-send whatever the initial query
+ used or the continuation flips order mid-list.
+ """
+ sortDirection: GraphqlSortDirection
}
"""
@@ -3954,6 +3979,10 @@ input SoupInitialInput {
AST-shaped filters applied to each Soup entity type.
"""
filters: GraphqlEntityFilterAst
+ """
+ Direction to order the page in. Defaults to DESC.
+ """
+ sortDirection: GraphqlSortDirection
}
"""