@nurama/types 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import { CursorPaginatedResult } from './pagination';
8
8
  * Every card is self-contained: `data` carries everything it renders, so a
9
9
  * page of the feed needs no further lookups.
10
10
  */
11
- export type FeedEventKind = 'upload' | 'assetChat' | 'publish' | 'submission' | 'public' | 'member' | 'task';
11
+ export type FeedEventKind = 'upload' | 'assetChat' | 'projectChat' | 'taskChat' | 'publish' | 'submission' | 'public' | 'member' | 'task';
12
12
  export type FeedVisibility = 'creator' | 'reviewer';
13
13
  /** The slice of an asset a card draws: name, type and thumbnail files. */
14
14
  export interface FeedEventAssetPreview {
@@ -52,6 +52,46 @@ export interface FeedEventAssetChatData {
52
52
  recentMessages: FeedEventChatMessage[];
53
53
  messageCount: number;
54
54
  }
55
+ /**
56
+ * `data` for project-chat cards. The same shape as an asset chat's minus the
57
+ * asset: the project's own chat is about the project, not about any one thing
58
+ * in it.
59
+ */
60
+ export interface FeedEventProjectChatData {
61
+ chatId: ObjectId;
62
+ /** The chat's own subject, where it has been given one. */
63
+ chatSubject: string | null;
64
+ participants: PublicUser[];
65
+ participantCount: number;
66
+ /** Oldest → newest, at most five. */
67
+ recentMessages: FeedEventChatMessage[];
68
+ messageCount: number;
69
+ }
70
+ /** The task a task-chat card is about, as the card draws it. */
71
+ export interface FeedEventTaskPreview {
72
+ id: ObjectId;
73
+ /** The project's task number (#12), when the task has one. */
74
+ number: number | null;
75
+ subject: string;
76
+ status: string;
77
+ /** The board it's on — opening the card deep-links there (`?task=<id>`). */
78
+ boardId: ObjectId | null;
79
+ /** The board's name — current as of the page load, not when the card was written. */
80
+ boardName: string | null;
81
+ }
82
+ /**
83
+ * `data` for task-chat cards: a discussion in a board task's own chat. The
84
+ * same shape as an asset chat's, about a task rather than an asset.
85
+ */
86
+ export interface FeedEventTaskChatData {
87
+ task: FeedEventTaskPreview;
88
+ chatId: ObjectId;
89
+ participants: PublicUser[];
90
+ participantCount: number;
91
+ /** Oldest → newest, at most five. */
92
+ recentMessages: FeedEventChatMessage[];
93
+ messageCount: number;
94
+ }
55
95
  export interface FeedEventSubmissionData extends FeedEventGroupData {
56
96
  submissionId: ObjectId;
57
97
  subject: string | null;
@@ -112,6 +152,8 @@ interface FeedEventBase {
112
152
  subjectKey: ObjectId | null;
113
153
  actorId: ObjectId | null;
114
154
  assetIds: ObjectId[];
155
+ /** Every task the card covers: a task card's rows, a task-chat card's task. */
156
+ taskIds: ObjectId[];
115
157
  mediaTypes: string[];
116
158
  searchText: string;
117
159
  reactions: FeedEventReaction[];
@@ -133,6 +175,12 @@ export type FeedEvent = (FeedEventBase & {
133
175
  }) | (FeedEventBase & {
134
176
  kind: 'assetChat';
135
177
  data: FeedEventAssetChatData;
178
+ }) | (FeedEventBase & {
179
+ kind: 'projectChat';
180
+ data: FeedEventProjectChatData;
181
+ }) | (FeedEventBase & {
182
+ kind: 'taskChat';
183
+ data: FeedEventTaskChatData;
136
184
  }) | (FeedEventBase & {
137
185
  kind: 'submission';
138
186
  data: FeedEventSubmissionData;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,8 @@ export * from './scratch';
29
29
  export * from './ai-revision';
30
30
  export * from './search';
31
31
  export * from './feed-event';
32
+ export * from './read-state';
33
+ export * from './user-feed';
32
34
  export * from './pagination';
33
35
  export * from './misc';
34
36
  export * from './config';
package/dist/index.js CHANGED
@@ -47,6 +47,8 @@ __exportStar(require("./scratch"), exports);
47
47
  __exportStar(require("./ai-revision"), exports);
48
48
  __exportStar(require("./search"), exports);
49
49
  __exportStar(require("./feed-event"), exports);
50
+ __exportStar(require("./read-state"), exports);
51
+ __exportStar(require("./user-feed"), exports);
50
52
  // Utility/Helper types
51
53
  __exportStar(require("./pagination"), exports);
52
54
  __exportStar(require("./misc"), exports);
@@ -0,0 +1,21 @@
1
+ /**
2
+ * How far one person has read through something whose activity is time-ordered.
3
+ *
4
+ * Generic: a project's event feed, a member chat, a list of highlights. The
5
+ * shape is the same whatever is being read, so one response type covers all of
6
+ * them.
7
+ *
8
+ * `lastReadAt` is a boundary on that resource's own activity time, not a pointer
9
+ * at the last thing read. In the feed it is compared against
10
+ * `FeedEvent.lastActivityAt`, which MOVES when a card gets new activity: a card
11
+ * you had read that someone comments on drops below the line and is new again.
12
+ */
13
+ export interface ReadState {
14
+ /** Epoch ms. Null when this person has never recorded a position here. */
15
+ lastReadAt: number | null;
16
+ /**
17
+ * Activity newer than `lastReadAt`, excluding anything this person is
18
+ * themselves the actor on. 0 when `lastReadAt` is null.
19
+ */
20
+ unreadCount: number;
21
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,194 @@
1
+ import { ObjectId } from './common';
2
+ import { PublicUser } from './user';
3
+ import { File } from './asset';
4
+ import { FeedEvent, FeedEventKind, FeedVisibility } from './feed-event';
5
+ import { CursorPaginatedResult } from './pagination';
6
+ /**
7
+ * User feed — one person's cross-project feed.
8
+ *
9
+ * Two categories of item:
10
+ * - `activity`: a project card. `event` is the card, loaded exactly as the
11
+ * project feed serves it.
12
+ * - `action`: something waiting on this person. `data` is its snapshot, and
13
+ * it settles itself (`state` → `done`) when the thing it asks for happens.
14
+ */
15
+ export type UserFeedCategory = 'activity' | 'action';
16
+ export type UserFeedActionKind = 'mention' | 'taskAssigned' | 'invite' | 'joinRequest' | 'convoLive';
17
+ export type UserFeedState = 'open' | 'done' | 'dismissed';
18
+ export interface UserFeedMentionData {
19
+ taskId: ObjectId;
20
+ messageId: ObjectId | null;
21
+ chatId: ObjectId | null;
22
+ topicType: string;
23
+ topicId: ObjectId;
24
+ visibility: string | null;
25
+ /** The message, cut short; `{{mention:<id>}}` tokens are left whole. */
26
+ excerpt: string;
27
+ }
28
+ export interface UserFeedTaskAssignedData {
29
+ taskId: ObjectId;
30
+ taskNumber: number | null;
31
+ subject: string;
32
+ status: string;
33
+ boardId: ObjectId;
34
+ boardName: string | null;
35
+ boardVisibility: FeedVisibility[];
36
+ }
37
+ export interface UserFeedInviteData {
38
+ inviteId: ObjectId;
39
+ resourceType: 'project' | 'workspace';
40
+ resourceId: ObjectId;
41
+ resourceName: string;
42
+ role: string;
43
+ /** Epoch ms. */
44
+ expires: number;
45
+ }
46
+ export interface UserFeedJoinRequestData {
47
+ requestId: ObjectId;
48
+ role: string;
49
+ additionalRoles: string[];
50
+ }
51
+ export interface UserFeedConvoLiveData {
52
+ convoId: ObjectId;
53
+ chatId: ObjectId;
54
+ chatType: string;
55
+ convoType: string;
56
+ subject: string | null;
57
+ }
58
+ /** A project's or workspace's logo: just the files needed to draw it. */
59
+ export interface UserFeedLogo {
60
+ id: ObjectId;
61
+ files: File[];
62
+ }
63
+ /** The project an item is in, as its header shows it. */
64
+ export interface UserFeedProject {
65
+ id: ObjectId;
66
+ workspaceId: ObjectId;
67
+ name: string;
68
+ slug: string | null;
69
+ color: string | null;
70
+ logo: UserFeedLogo | null;
71
+ }
72
+ export interface UserFeedWorkspace {
73
+ id: ObjectId;
74
+ name: string;
75
+ slug: string;
76
+ color: string | null;
77
+ logo: UserFeedLogo | null;
78
+ }
79
+ interface UserFeedEntryBase {
80
+ id: ObjectId;
81
+ /** Unique within one person's feed: the card id, or the task / invite / request / convo id. */
82
+ subjectKey: string;
83
+ state: UserFeedState;
84
+ workspaceId: ObjectId | null;
85
+ /** Null for an invite to a project the person is not in yet. */
86
+ projectId: ObjectId | null;
87
+ actorId: ObjectId | null;
88
+ /** Epoch ms. The feed's sort key. */
89
+ lastActivityAt: number;
90
+ createdAt: number;
91
+ resolvedAt: number | null;
92
+ project: UserFeedProject | null;
93
+ workspace: UserFeedWorkspace | null;
94
+ }
95
+ export type UserFeedActivityEntry = UserFeedEntryBase & {
96
+ category: 'activity';
97
+ kind: FeedEventKind;
98
+ visibility: FeedVisibility;
99
+ feedEventId: ObjectId;
100
+ data: null;
101
+ event: FeedEvent;
102
+ };
103
+ export type UserFeedActionEntry = UserFeedEntryBase & {
104
+ category: 'action';
105
+ visibility: '';
106
+ feedEventId: null;
107
+ /** Who caused it. */
108
+ actor: PublicUser | null;
109
+ } & ({
110
+ kind: 'mention';
111
+ data: UserFeedMentionData;
112
+ } | {
113
+ kind: 'taskAssigned';
114
+ data: UserFeedTaskAssignedData;
115
+ } | {
116
+ kind: 'invite';
117
+ data: UserFeedInviteData;
118
+ } | {
119
+ kind: 'joinRequest';
120
+ data: UserFeedJoinRequestData;
121
+ } | {
122
+ kind: 'convoLive';
123
+ data: UserFeedConvoLiveData;
124
+ });
125
+ export type UserFeedEntry = UserFeedActivityEntry | UserFeedActionEntry;
126
+ export interface ListUserFeedParams {
127
+ category?: UserFeedCategory;
128
+ /** Defaults to open and done. */
129
+ states?: UserFeedState[];
130
+ workspaceId?: ObjectId;
131
+ projectId?: ObjectId;
132
+ /**
133
+ * The project feed's filters, across every project. They narrow project
134
+ * cards only; any of them set leaves action items out.
135
+ */
136
+ kinds?: FeedEventKind[];
137
+ mediaTypes?: string[];
138
+ search?: string;
139
+ followedOnly?: boolean;
140
+ cursor?: string;
141
+ limit?: number;
142
+ }
143
+ export type CursorPaginatedUserFeed = CursorPaginatedResult & {
144
+ results: UserFeedEntry[];
145
+ };
146
+ /**
147
+ * One project's unread activity in your feed — the badge on its icon.
148
+ *
149
+ * Counted against that project's OWN read marker, not the feed-wide one, so
150
+ * opening a project clears its badge and leaves the rest alone. A project with
151
+ * nothing new is absent rather than zero, and one you have never opened reports
152
+ * nothing at all.
153
+ */
154
+ export interface UserFeedProjectUnread {
155
+ projectId: ObjectId;
156
+ /** Null for an item that belongs to no workspace. */
157
+ workspaceId: ObjectId | null;
158
+ /** Which side of the project the count came from — you follow one of the two. */
159
+ visibility: FeedVisibility;
160
+ unreadCount: number;
161
+ }
162
+ /** Every badge the app shows. `unread` stops at 100 — show "99+" past 99. */
163
+ export interface UserFeedSummary {
164
+ /** Items other people put in the feed since the read marker; answered or cleared ones don't count. */
165
+ unread: number;
166
+ /** Epoch ms, or null when no read position has been recorded. */
167
+ lastReadAt: number | null;
168
+ /**
169
+ * Per-project activity badges. Normally one row per project, since you follow
170
+ * one side of each; not capped, because each row is one icon's number.
171
+ */
172
+ byProject: UserFeedProjectUnread[];
173
+ }
174
+ /**
175
+ * The `userFeed` websocket event's `tokens.item`: what changed, named by
176
+ * `kind` + `subjectKey`, the same for everyone it is sent to.
177
+ */
178
+ export interface UserFeedChange {
179
+ change: 'placed' | 'state' | 'removed' | 'cleared';
180
+ category: UserFeedCategory;
181
+ kind?: FeedEventKind | UserFeedActionKind;
182
+ subjectKey?: string;
183
+ /** In place of `subjectKey` when several items of one kind changed state at once. */
184
+ subjectKeys?: string[];
185
+ state?: UserFeedState;
186
+ feedEventId?: ObjectId;
187
+ projectId?: ObjectId | null;
188
+ visibility?: FeedVisibility;
189
+ /** Epoch ms, for `placed`. */
190
+ lastActivityAt?: number;
191
+ /** Epoch ms, for `cleared`: every open action item at or before it was dismissed. */
192
+ before?: number;
193
+ }
194
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/user.d.ts CHANGED
@@ -189,6 +189,26 @@ export interface OAuthExchangeRequest {
189
189
  * Exchange code received from OAuth callback
190
190
  */
191
191
  code: string;
192
+ /**
193
+ * PKCE verifier, for a code made with a challenge (the desktop app's passkey sign-in)
194
+ */
195
+ codeVerifier?: string;
196
+ }
197
+ /**
198
+ * Signing the desktop app in with a passkey, sent from the browser: the passkey response plus the `state` and PKCE
199
+ * challenge the desktop app made.
200
+ */
201
+ export interface PasskeyDesktopLoginRequest {
202
+ credential: PasskeyCredentialResponse;
203
+ state: string;
204
+ /** base64url SHA-256 of the desktop app's code verifier (S256) */
205
+ codeChallenge: string;
206
+ }
207
+ /**
208
+ * The one-time code the browser hands to the desktop app, which redeems it with its verifier.
209
+ */
210
+ export interface PasskeyDesktopLoginResponse {
211
+ code: string;
192
212
  }
193
213
  /**
194
214
  * OAuth exchange response with user and tokens
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nurama/types",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Shared TypeScript types for the Nurama ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/feed-event.ts CHANGED
@@ -9,7 +9,16 @@ import { CursorPaginatedResult } from './pagination';
9
9
  * Every card is self-contained: `data` carries everything it renders, so a
10
10
  * page of the feed needs no further lookups.
11
11
  */
12
- export type FeedEventKind = 'upload' | 'assetChat' | 'publish' | 'submission' | 'public' | 'member' | 'task';
12
+ export type FeedEventKind =
13
+ | 'upload'
14
+ | 'assetChat'
15
+ | 'projectChat'
16
+ | 'taskChat'
17
+ | 'publish'
18
+ | 'submission'
19
+ | 'public'
20
+ | 'member'
21
+ | 'task';
13
22
 
14
23
  export type FeedVisibility = 'creator' | 'reviewer';
15
24
 
@@ -60,6 +69,49 @@ export interface FeedEventAssetChatData {
60
69
  messageCount: number;
61
70
  }
62
71
 
72
+ /**
73
+ * `data` for project-chat cards. The same shape as an asset chat's minus the
74
+ * asset: the project's own chat is about the project, not about any one thing
75
+ * in it.
76
+ */
77
+ export interface FeedEventProjectChatData {
78
+ chatId: ObjectId;
79
+ /** The chat's own subject, where it has been given one. */
80
+ chatSubject: string | null;
81
+ participants: PublicUser[];
82
+ participantCount: number;
83
+ /** Oldest → newest, at most five. */
84
+ recentMessages: FeedEventChatMessage[];
85
+ messageCount: number;
86
+ }
87
+
88
+ /** The task a task-chat card is about, as the card draws it. */
89
+ export interface FeedEventTaskPreview {
90
+ id: ObjectId;
91
+ /** The project's task number (#12), when the task has one. */
92
+ number: number | null;
93
+ subject: string;
94
+ status: string;
95
+ /** The board it's on — opening the card deep-links there (`?task=<id>`). */
96
+ boardId: ObjectId | null;
97
+ /** The board's name — current as of the page load, not when the card was written. */
98
+ boardName: string | null;
99
+ }
100
+
101
+ /**
102
+ * `data` for task-chat cards: a discussion in a board task's own chat. The
103
+ * same shape as an asset chat's, about a task rather than an asset.
104
+ */
105
+ export interface FeedEventTaskChatData {
106
+ task: FeedEventTaskPreview;
107
+ chatId: ObjectId;
108
+ participants: PublicUser[];
109
+ participantCount: number;
110
+ /** Oldest → newest, at most five. */
111
+ recentMessages: FeedEventChatMessage[];
112
+ messageCount: number;
113
+ }
114
+
63
115
  export interface FeedEventSubmissionData extends FeedEventGroupData {
64
116
  submissionId: ObjectId;
65
117
  subject: string | null;
@@ -118,6 +170,8 @@ interface FeedEventBase {
118
170
  subjectKey: ObjectId | null;
119
171
  actorId: ObjectId | null;
120
172
  assetIds: ObjectId[];
173
+ /** Every task the card covers: a task card's rows, a task-chat card's task. */
174
+ taskIds: ObjectId[];
121
175
  mediaTypes: string[];
122
176
  searchText: string;
123
177
  reactions: FeedEventReaction[];
@@ -137,6 +191,8 @@ interface FeedEventBase {
137
191
  export type FeedEvent =
138
192
  | (FeedEventBase & { kind: 'upload' | 'publish'; data: FeedEventGroupData })
139
193
  | (FeedEventBase & { kind: 'assetChat'; data: FeedEventAssetChatData })
194
+ | (FeedEventBase & { kind: 'projectChat'; data: FeedEventProjectChatData })
195
+ | (FeedEventBase & { kind: 'taskChat'; data: FeedEventTaskChatData })
140
196
  | (FeedEventBase & { kind: 'submission'; data: FeedEventSubmissionData })
141
197
  | (FeedEventBase & { kind: 'public'; data: FeedEventPublicData })
142
198
  | (FeedEventBase & { kind: 'member'; data: FeedEventMemberData })
package/src/index.ts CHANGED
@@ -32,6 +32,8 @@ export * from './scratch';
32
32
  export * from './ai-revision';
33
33
  export * from './search';
34
34
  export * from './feed-event';
35
+ export * from './read-state';
36
+ export * from './user-feed';
35
37
 
36
38
  // Utility/Helper types
37
39
  export * from './pagination';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * How far one person has read through something whose activity is time-ordered.
3
+ *
4
+ * Generic: a project's event feed, a member chat, a list of highlights. The
5
+ * shape is the same whatever is being read, so one response type covers all of
6
+ * them.
7
+ *
8
+ * `lastReadAt` is a boundary on that resource's own activity time, not a pointer
9
+ * at the last thing read. In the feed it is compared against
10
+ * `FeedEvent.lastActivityAt`, which MOVES when a card gets new activity: a card
11
+ * you had read that someone comments on drops below the line and is new again.
12
+ */
13
+ export interface ReadState {
14
+ /** Epoch ms. Null when this person has never recorded a position here. */
15
+ lastReadAt: number | null;
16
+ /**
17
+ * Activity newer than `lastReadAt`, excluding anything this person is
18
+ * themselves the actor on. 0 when `lastReadAt` is null.
19
+ */
20
+ unreadCount: number;
21
+ }
@@ -0,0 +1,204 @@
1
+ import { ObjectId } from './common';
2
+ import { PublicUser } from './user';
3
+ import { File } from './asset';
4
+ import { FeedEvent, FeedEventKind, FeedVisibility } from './feed-event';
5
+ import { CursorPaginatedResult } from './pagination';
6
+
7
+ /**
8
+ * User feed — one person's cross-project feed.
9
+ *
10
+ * Two categories of item:
11
+ * - `activity`: a project card. `event` is the card, loaded exactly as the
12
+ * project feed serves it.
13
+ * - `action`: something waiting on this person. `data` is its snapshot, and
14
+ * it settles itself (`state` → `done`) when the thing it asks for happens.
15
+ */
16
+ export type UserFeedCategory = 'activity' | 'action';
17
+
18
+ export type UserFeedActionKind = 'mention' | 'taskAssigned' | 'invite' | 'joinRequest' | 'convoLive';
19
+
20
+ export type UserFeedState = 'open' | 'done' | 'dismissed';
21
+
22
+ export interface UserFeedMentionData {
23
+ taskId: ObjectId;
24
+ messageId: ObjectId | null;
25
+ chatId: ObjectId | null;
26
+ topicType: string;
27
+ topicId: ObjectId;
28
+ visibility: string | null;
29
+ /** The message, cut short; `{{mention:<id>}}` tokens are left whole. */
30
+ excerpt: string;
31
+ }
32
+
33
+ export interface UserFeedTaskAssignedData {
34
+ taskId: ObjectId;
35
+ taskNumber: number | null;
36
+ subject: string;
37
+ status: string;
38
+ boardId: ObjectId;
39
+ boardName: string | null;
40
+ boardVisibility: FeedVisibility[];
41
+ }
42
+
43
+ export interface UserFeedInviteData {
44
+ inviteId: ObjectId;
45
+ resourceType: 'project' | 'workspace';
46
+ resourceId: ObjectId;
47
+ resourceName: string;
48
+ role: string;
49
+ /** Epoch ms. */
50
+ expires: number;
51
+ }
52
+
53
+ export interface UserFeedJoinRequestData {
54
+ requestId: ObjectId;
55
+ role: string;
56
+ additionalRoles: string[];
57
+ }
58
+
59
+ export interface UserFeedConvoLiveData {
60
+ convoId: ObjectId;
61
+ chatId: ObjectId;
62
+ chatType: string;
63
+ convoType: string;
64
+ subject: string | null;
65
+ }
66
+
67
+ /** A project's or workspace's logo: just the files needed to draw it. */
68
+ export interface UserFeedLogo {
69
+ id: ObjectId;
70
+ files: File[];
71
+ }
72
+
73
+ /** The project an item is in, as its header shows it. */
74
+ export interface UserFeedProject {
75
+ id: ObjectId;
76
+ workspaceId: ObjectId;
77
+ name: string;
78
+ slug: string | null;
79
+ color: string | null;
80
+ logo: UserFeedLogo | null;
81
+ }
82
+
83
+ export interface UserFeedWorkspace {
84
+ id: ObjectId;
85
+ name: string;
86
+ slug: string;
87
+ color: string | null;
88
+ logo: UserFeedLogo | null;
89
+ }
90
+
91
+ interface UserFeedEntryBase {
92
+ id: ObjectId;
93
+ /** Unique within one person's feed: the card id, or the task / invite / request / convo id. */
94
+ subjectKey: string;
95
+ state: UserFeedState;
96
+ workspaceId: ObjectId | null;
97
+ /** Null for an invite to a project the person is not in yet. */
98
+ projectId: ObjectId | null;
99
+ actorId: ObjectId | null;
100
+ /** Epoch ms. The feed's sort key. */
101
+ lastActivityAt: number;
102
+ createdAt: number;
103
+ resolvedAt: number | null;
104
+ project: UserFeedProject | null;
105
+ workspace: UserFeedWorkspace | null;
106
+ }
107
+
108
+ export type UserFeedActivityEntry = UserFeedEntryBase & {
109
+ category: 'activity';
110
+ kind: FeedEventKind;
111
+ visibility: FeedVisibility;
112
+ feedEventId: ObjectId;
113
+ data: null;
114
+ event: FeedEvent;
115
+ };
116
+
117
+ export type UserFeedActionEntry = UserFeedEntryBase & {
118
+ category: 'action';
119
+ visibility: '';
120
+ feedEventId: null;
121
+ /** Who caused it. */
122
+ actor: PublicUser | null;
123
+ } & (
124
+ | { kind: 'mention'; data: UserFeedMentionData }
125
+ | { kind: 'taskAssigned'; data: UserFeedTaskAssignedData }
126
+ | { kind: 'invite'; data: UserFeedInviteData }
127
+ | { kind: 'joinRequest'; data: UserFeedJoinRequestData }
128
+ | { kind: 'convoLive'; data: UserFeedConvoLiveData }
129
+ );
130
+
131
+ export type UserFeedEntry = UserFeedActivityEntry | UserFeedActionEntry;
132
+
133
+ export interface ListUserFeedParams {
134
+ category?: UserFeedCategory;
135
+ /** Defaults to open and done. */
136
+ states?: UserFeedState[];
137
+ workspaceId?: ObjectId;
138
+ projectId?: ObjectId;
139
+ /**
140
+ * The project feed's filters, across every project. They narrow project
141
+ * cards only; any of them set leaves action items out.
142
+ */
143
+ kinds?: FeedEventKind[];
144
+ mediaTypes?: string[];
145
+ search?: string;
146
+ followedOnly?: boolean;
147
+ cursor?: string;
148
+ limit?: number;
149
+ }
150
+
151
+ export type CursorPaginatedUserFeed = CursorPaginatedResult & {
152
+ results: UserFeedEntry[];
153
+ };
154
+
155
+ /**
156
+ * One project's unread activity in your feed — the badge on its icon.
157
+ *
158
+ * Counted against that project's OWN read marker, not the feed-wide one, so
159
+ * opening a project clears its badge and leaves the rest alone. A project with
160
+ * nothing new is absent rather than zero, and one you have never opened reports
161
+ * nothing at all.
162
+ */
163
+ export interface UserFeedProjectUnread {
164
+ projectId: ObjectId;
165
+ /** Null for an item that belongs to no workspace. */
166
+ workspaceId: ObjectId | null;
167
+ /** Which side of the project the count came from — you follow one of the two. */
168
+ visibility: FeedVisibility;
169
+ unreadCount: number;
170
+ }
171
+
172
+ /** Every badge the app shows. `unread` stops at 100 — show "99+" past 99. */
173
+ export interface UserFeedSummary {
174
+ /** Items other people put in the feed since the read marker; answered or cleared ones don't count. */
175
+ unread: number;
176
+ /** Epoch ms, or null when no read position has been recorded. */
177
+ lastReadAt: number | null;
178
+ /**
179
+ * Per-project activity badges. Normally one row per project, since you follow
180
+ * one side of each; not capped, because each row is one icon's number.
181
+ */
182
+ byProject: UserFeedProjectUnread[];
183
+ }
184
+
185
+ /**
186
+ * The `userFeed` websocket event's `tokens.item`: what changed, named by
187
+ * `kind` + `subjectKey`, the same for everyone it is sent to.
188
+ */
189
+ export interface UserFeedChange {
190
+ change: 'placed' | 'state' | 'removed' | 'cleared';
191
+ category: UserFeedCategory;
192
+ kind?: FeedEventKind | UserFeedActionKind;
193
+ subjectKey?: string;
194
+ /** In place of `subjectKey` when several items of one kind changed state at once. */
195
+ subjectKeys?: string[];
196
+ state?: UserFeedState;
197
+ feedEventId?: ObjectId;
198
+ projectId?: ObjectId | null;
199
+ visibility?: FeedVisibility;
200
+ /** Epoch ms, for `placed`. */
201
+ lastActivityAt?: number;
202
+ /** Epoch ms, for `cleared`: every open action item at or before it was dismissed. */
203
+ before?: number;
204
+ }
package/src/user.ts CHANGED
@@ -195,6 +195,28 @@ export interface OAuthExchangeRequest {
195
195
  * Exchange code received from OAuth callback
196
196
  */
197
197
  code: string;
198
+ /**
199
+ * PKCE verifier, for a code made with a challenge (the desktop app's passkey sign-in)
200
+ */
201
+ codeVerifier?: string;
202
+ }
203
+
204
+ /**
205
+ * Signing the desktop app in with a passkey, sent from the browser: the passkey response plus the `state` and PKCE
206
+ * challenge the desktop app made.
207
+ */
208
+ export interface PasskeyDesktopLoginRequest {
209
+ credential: PasskeyCredentialResponse;
210
+ state: string;
211
+ /** base64url SHA-256 of the desktop app's code verifier (S256) */
212
+ codeChallenge: string;
213
+ }
214
+
215
+ /**
216
+ * The one-time code the browser hands to the desktop app, which redeems it with its verifier.
217
+ */
218
+ export interface PasskeyDesktopLoginResponse {
219
+ code: string;
198
220
  }
199
221
 
200
222
  /**