@nurama/sdk 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.
@@ -4159,27 +4159,32 @@
4159
4159
  /**
4160
4160
  * Gets the options for the browser's passkey sign-in prompt. Pass them to the WebAuthn library
4161
4161
  * (`startAuthentication` in @simplewebauthn/browser), then send its result to `loginWithPasskey`.
4162
+ * @param origin - The web origin to sign in for, from a native app (which has no browser `Origin`); pass the
4163
+ * same one to `loginWithPasskey`. Browsers send their own and ignore this.
4162
4164
  * @returns Promise resolving to WebAuthn request options.
4163
4165
  */
4164
- async getPasskeyLoginOptions() {
4166
+ async getPasskeyLoginOptions(origin) {
4165
4167
  return client._request({
4166
4168
  endpoint: "/v1/auth/passkeys/login-options",
4167
4169
  method: "POST",
4168
- sendJWT: false
4170
+ sendJWT: false,
4171
+ ...origin ? { customHeaders: { Origin: origin } } : {}
4169
4172
  });
4170
4173
  },
4171
4174
  /**
4172
4175
  * Signs in with the browser's response to the passkey prompt and stores the tokens.
4173
4176
  * A passkey stands in for two-factor, so this never returns an MFA challenge.
4174
4177
  * @param credential - The WebAuthn library's AuthenticationResponseJSON.
4178
+ * @param origin - From a native app: the origin passed to `getPasskeyLoginOptions`.
4175
4179
  * @returns Promise resolving to the user and tokens.
4176
4180
  */
4177
- async loginWithPasskey(credential) {
4181
+ async loginWithPasskey(credential, origin) {
4178
4182
  const result = await client._request({
4179
4183
  endpoint: "/v1/auth/passkeys/login",
4180
4184
  method: "POST",
4181
4185
  body: { credential },
4182
- sendJWT: false
4186
+ sendJWT: false,
4187
+ ...origin ? { customHeaders: { Origin: origin } } : {}
4183
4188
  });
4184
4189
  client._setTokens(
4185
4190
  result.tokens.access.token,
@@ -4189,6 +4194,21 @@
4189
4194
  );
4190
4195
  return result;
4191
4196
  },
4197
+ /**
4198
+ * Signs the desktop app in with a passkey, from the browser. Stores nothing: the tokens wait behind the
4199
+ * returned one-time code, which the desktop app redeems with `exchangeOAuthCode(code, { codeVerifier })`.
4200
+ * @param credential - The WebAuthn library's AuthenticationResponseJSON.
4201
+ * @param handoff - The `state` and PKCE `codeChallenge` the desktop app made.
4202
+ * @returns Promise resolving to the one-time code.
4203
+ */
4204
+ async loginDesktopWithPasskey(credential, handoff) {
4205
+ return client._request({
4206
+ endpoint: "/v1/auth/passkeys/desktop-login",
4207
+ method: "POST",
4208
+ body: { credential, ...handoff },
4209
+ sendJWT: false
4210
+ });
4211
+ },
4192
4212
  /**
4193
4213
  * Gets the options for the browser's "create a passkey" prompt, after confirming who is asking.
4194
4214
  * @param proof - The password when the account has one, and a two-factor code when two-factor is on.
@@ -4333,11 +4353,17 @@
4333
4353
  sendJWT: true
4334
4354
  });
4335
4355
  },
4336
- async exchangeOAuthCode(code) {
4356
+ /**
4357
+ * Exchanges a one-time sign-in code for tokens and stores them.
4358
+ * @param code - The code from the sign-in redirect.
4359
+ * @param options.codeVerifier - The PKCE verifier, for a code made with a challenge.
4360
+ * @returns Promise resolving to the user and tokens, or a two-factor challenge.
4361
+ */
4362
+ async exchangeOAuthCode(code, { codeVerifier } = {}) {
4337
4363
  const result = await client._request({
4338
4364
  endpoint: "/v1/auth/oauth/exchange",
4339
4365
  method: "POST",
4340
- body: { code },
4366
+ body: { code, ...codeVerifier ? { codeVerifier } : {} },
4341
4367
  sendJWT: false
4342
4368
  // No authentication needed - the code is the proof
4343
4369
  });
@@ -5108,6 +5134,40 @@
5108
5134
  sendJWT: true
5109
5135
  });
5110
5136
  },
5137
+ /**
5138
+ * Gets where you had read up to in a project feed, and how many cards have
5139
+ * moved since. `lastReadAt` is null if you have never recorded a position,
5140
+ * and `unreadCount` is 0 then. Cards you are the actor on never count.
5141
+ * @param {string} projectId - The ID of the project.
5142
+ * @param {'creator' | 'reviewer'} visibility - Which feed to read.
5143
+ * @returns {Promise<ReadState>} Your reading position in that feed.
5144
+ */
5145
+ async getFeedReadState(projectId, visibility) {
5146
+ if (!projectId) throw new Error("projectId is required.");
5147
+ if (!visibility) throw new Error("visibility is required (creator or reviewer).");
5148
+ return client._request({
5149
+ method: "GET",
5150
+ endpoint: `/v1/projects/${projectId}/feed-events/${visibility}/read-state`,
5151
+ sendJWT: true
5152
+ });
5153
+ },
5154
+ /**
5155
+ * Marks a project feed as caught up. Pass `lastReadAt` (epoch ms) to catch
5156
+ * up to the newest card you had loaded; omit it to catch up to now. The
5157
+ * marker only moves forward and never past the present, so a stale value is
5158
+ * a no-op rather than an error.
5159
+ * @returns {Promise<ReadState>} Your updated reading position.
5160
+ */
5161
+ async markFeedCaughtUp(projectId, visibility, lastReadAt) {
5162
+ if (!projectId) throw new Error("projectId is required.");
5163
+ if (!visibility) throw new Error("visibility is required (creator or reviewer).");
5164
+ return client._request({
5165
+ method: "POST",
5166
+ endpoint: `/v1/projects/${projectId}/feed-events/${visibility}/read-state`,
5167
+ body: lastReadAt === void 0 ? {} : { lastReadAt },
5168
+ sendJWT: true
5169
+ });
5170
+ },
5111
5171
  // --- Folder Listing ---
5112
5172
  /**
5113
5173
  * Gets folders within a project with specified visibility.
@@ -7151,6 +7211,56 @@
7151
7211
  sendJWT: true
7152
7212
  });
7153
7213
  },
7214
+ /**
7215
+ * Gets unread state for every member chat you belong to — one row per chat,
7216
+ * carrying the chat's `lastMessageAt`, your `lastReadAt` and a `hasUnread`
7217
+ * flag. Compares timestamps rather than counting, so it costs the same
7218
+ * whether you have three chats or three hundred; for a count, read the
7219
+ * single-chat endpoint for the chat on screen.
7220
+ * @returns {Promise<{ results: MemberChatReadState[] }>} Unread state per member chat.
7221
+ */
7222
+ async getMemberChatReadStates() {
7223
+ return client._request({
7224
+ method: "GET",
7225
+ endpoint: `/v1/chats/member/read-state`,
7226
+ sendJWT: true
7227
+ });
7228
+ },
7229
+ /**
7230
+ * Gets where you had read up to in a member chat, and how many messages have
7231
+ * arrived since. `lastReadAt` is null if you have never recorded a position,
7232
+ * and `unreadCount` is 0 then. Your own messages never count.
7233
+ * @param {string} chatId - The ID of the member chat.
7234
+ * @returns {Promise<ReadState>} Your reading position in that chat.
7235
+ * @throws {Error} 'chatId is required.' when `chatId` is falsy.
7236
+ */
7237
+ async getMemberChatReadState(chatId) {
7238
+ if (!chatId) throw new Error("chatId is required.");
7239
+ return client._request({
7240
+ method: "GET",
7241
+ endpoint: `/v1/chats/member/${chatId}/read-state`,
7242
+ sendJWT: true
7243
+ });
7244
+ },
7245
+ /**
7246
+ * Marks a member chat as caught up. Pass `lastReadAt` (epoch ms) to catch up
7247
+ * to the newest message you had loaded; omit it to catch up to now. The
7248
+ * marker only moves forward and never past the present, so a stale value is
7249
+ * a no-op rather than an error.
7250
+ * @param {string} chatId - The ID of the member chat.
7251
+ * @param {number} [lastReadAt] - Epoch ms of the newest message you had loaded.
7252
+ * @returns {Promise<ReadState>} Your updated reading position.
7253
+ * @throws {Error} 'chatId is required.' when `chatId` is falsy.
7254
+ */
7255
+ async markMemberChatCaughtUp(chatId, lastReadAt) {
7256
+ if (!chatId) throw new Error("chatId is required.");
7257
+ return client._request({
7258
+ method: "POST",
7259
+ endpoint: `/v1/chats/member/${chatId}/read-state`,
7260
+ body: lastReadAt === void 0 ? {} : { lastReadAt },
7261
+ sendJWT: true
7262
+ });
7263
+ },
7154
7264
  /**
7155
7265
  * Creates an icon asset for a member chat and returns signed upload URLs for it.
7156
7266
  * Any existing icon is marked for deletion. The caller must be a member of the chat;
@@ -8987,30 +9097,28 @@
8987
9097
  });
8988
9098
  },
8989
9099
  /**
8990
- * Retrieves the count of unacknowledged tasks for the current user within a specific project.
8991
- * Requires authentication.
8992
- * @param {string} projectId - The ID of the project.
9100
+ * Retrieves the count of unacknowledged tasks for the current user within a specific project,
9101
+ * or across every project when none is given. Requires authentication.
9102
+ * @param {string} [projectId] - The ID of the project; omit for every project.
8993
9103
  * @returns {Promise<UnacknowledgedTaskCountResponse>} An object containing total, creator, and reviewer unacknowledged task counts.
8994
9104
  */
8995
9105
  async getUnacknowledgedTaskCount(projectId) {
8996
- if (!projectId) throw new Error("projectId is required.");
8997
9106
  return client._request({
8998
9107
  method: "GET",
8999
- endpoint: `/v1/tasks/unacknowledged/${projectId}`,
9108
+ endpoint: projectId ? `/v1/tasks/unacknowledged/${projectId}` : "/v1/tasks/unacknowledged",
9000
9109
  sendJWT: true
9001
9110
  });
9002
9111
  },
9003
9112
  /**
9004
9113
  * Acknowledge every unacknowledged mention-task the current user has in a
9005
- * project. Idempotent server-side.
9006
- * @param {string} projectId - The ID of the project.
9114
+ * project, or in every project when none is given. Idempotent server-side.
9115
+ * @param {string} [projectId] - The ID of the project; omit for every project.
9007
9116
  * @returns {Promise<AcknowledgeAllTasksResponse>} The number acknowledged and the remaining unacknowledged count.
9008
9117
  */
9009
9118
  async acknowledgeAllTasks(projectId) {
9010
- if (!projectId) throw new Error("projectId is required.");
9011
9119
  return client._request({
9012
9120
  method: "PUT",
9013
- endpoint: `/v1/tasks/acknowledge-all/${projectId}`,
9121
+ endpoint: projectId ? `/v1/tasks/acknowledge-all/${projectId}` : "/v1/tasks/acknowledge-all",
9014
9122
  sendJWT: true
9015
9123
  });
9016
9124
  },
@@ -9305,6 +9413,98 @@
9305
9413
  };
9306
9414
  }
9307
9415
 
9416
+ // src/routes/userFeed.ts
9417
+ function createUserFeedMethods(client) {
9418
+ return {
9419
+ /**
9420
+ * Gets one page of your feed, most recent first. Pass `category` for only
9421
+ * project activity or only action items; dismissed items are left out
9422
+ * unless `states` asks for them.
9423
+ * @returns {Promise<CursorPaginatedUserFeed>}
9424
+ */
9425
+ async getFeed(params) {
9426
+ return client._request({
9427
+ method: "GET",
9428
+ endpoint: "/v1/users/feed",
9429
+ params,
9430
+ sendJWT: true
9431
+ });
9432
+ },
9433
+ /**
9434
+ * Gets every badge the app shows: open action items, project activity since
9435
+ * you last caught up, and that activity broken down by project in
9436
+ * `byProject` — one row per project with something new, for the badge on
9437
+ * its icon. The two totals stop at 100.
9438
+ *
9439
+ * The totals and `byProject` move independently: the totals are measured
9440
+ * against your feed-wide marker, each `byProject` row against that
9441
+ * project's own. So catching up in the feed does not clear project badges,
9442
+ * and reading one project does not clear the feed's own count.
9443
+ * @returns {Promise<UserFeedSummary>}
9444
+ */
9445
+ async getSummary() {
9446
+ return client._request({
9447
+ method: "GET",
9448
+ endpoint: "/v1/users/feed/summary",
9449
+ sendJWT: true
9450
+ });
9451
+ },
9452
+ /**
9453
+ * Gets your reading position in your feed's project activity.
9454
+ * @returns {Promise<ReadState>}
9455
+ */
9456
+ async getReadState() {
9457
+ return client._request({
9458
+ method: "GET",
9459
+ endpoint: "/v1/users/feed/read-state",
9460
+ sendJWT: true
9461
+ });
9462
+ },
9463
+ /**
9464
+ * Marks your feed's project activity as caught up. Pass `lastReadAt`
9465
+ * (epoch ms) to catch up to the newest card you had loaded; omit it to
9466
+ * catch up to now. The marker only moves forward.
9467
+ * @returns {Promise<ReadState>}
9468
+ */
9469
+ async markCaughtUp(lastReadAt) {
9470
+ return client._request({
9471
+ method: "POST",
9472
+ endpoint: "/v1/users/feed/read-state",
9473
+ body: lastReadAt === void 0 ? {} : { lastReadAt },
9474
+ sendJWT: true
9475
+ });
9476
+ },
9477
+ /**
9478
+ * Clears one of your action items (`dismissed`), or brings a cleared one
9479
+ * back (`open`).
9480
+ * @returns {Promise<UserFeedEntry>} The updated item.
9481
+ */
9482
+ async setEntryState(entryId, state) {
9483
+ if (!entryId) throw new Error("entryId is required.");
9484
+ return client._request({
9485
+ method: "PATCH",
9486
+ endpoint: `/v1/users/feed/${entryId}`,
9487
+ body: { state },
9488
+ sendJWT: true
9489
+ });
9490
+ },
9491
+ /**
9492
+ * Clears every open action item up to `before` (epoch ms) — the newest one
9493
+ * you had loaded — so one that arrived since stays. Omit it to clear
9494
+ * everything open now.
9495
+ * @returns {Promise<{ dismissed: number }>}
9496
+ */
9497
+ async dismissAll(before) {
9498
+ return client._request({
9499
+ method: "POST",
9500
+ endpoint: "/v1/users/feed/dismiss",
9501
+ body: before === void 0 ? {} : { before },
9502
+ sendJWT: true
9503
+ });
9504
+ }
9505
+ };
9506
+ }
9507
+
9308
9508
  // src/routes/public.ts
9309
9509
  function createPublicMethods(client) {
9310
9510
  return {
@@ -11356,10 +11556,10 @@
11356
11556
 
11357
11557
  // src/version.ts
11358
11558
  var SDK_VERSION = {
11359
- version: "1.4.3",
11360
- buildTimestamp: "2026-10-14T13:35:12.378Z",
11361
- buildHash: "df74c9b4b055b19a9012e0c265c3b94f",
11362
- gitCommit: "b66adea",
11559
+ version: "1.4.5",
11560
+ buildTimestamp: "2026-10-29T06:59:31.498Z",
11561
+ buildHash: "b0bbfd265120e5fd826237cc63c5bf7d",
11562
+ gitCommit: "9307f8f",
11363
11563
  dirty: false
11364
11564
  };
11365
11565
 
@@ -11440,6 +11640,7 @@
11440
11640
  this.version = createVersionMethods(this);
11441
11641
  this.config = createConfigMethods(this);
11442
11642
  this.tag = createTagMethods(this);
11643
+ this.userFeed = createUserFeedMethods(this);
11443
11644
  this.public = createPublicMethods(this);
11444
11645
  this.settings = createSettingsMethods(this);
11445
11646
  this.device = createDeviceMethods(this);