@recursiv/sdk 0.7.50 → 0.7.51

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.
@@ -248,6 +248,8 @@ export interface HostedNostrIdentityProof {
248
248
  export type NativeNostrPrepareInput = {
249
249
  action: 'publish';
250
250
  content: string;
251
+ /** Your own post in this app (sdk.posts) that this note copies, so deleting it can offer this copy. */
252
+ crossPostOf?: string;
251
253
  } | {
252
254
  action: 'reply';
253
255
  content: string;
@@ -292,12 +294,27 @@ export interface SocialSourceRef {
292
294
  kind: 'actor' | 'post';
293
295
  nativeId: string;
294
296
  }
297
+ /**
298
+ * How a controlled source last looked when Minds observed it on its network: the latest public
299
+ * observation, not a copy saved with the control. Null when it was never observed or has aged out.
300
+ */
301
+ export interface SocialSourceControlDisplay {
302
+ handle: string | null;
303
+ displayName: string | null;
304
+ /** Null when the source, or a hidden post's author, is under an active app moderation action. */
305
+ avatarUrl: string | null;
306
+ /** A hidden post's text, at most 140 characters; null for accounts, deleted posts, and moderated posts or authors. */
307
+ excerpt: string | null;
308
+ observedAt: string;
309
+ }
295
310
  export interface SocialSourceControl {
296
311
  id: string;
297
312
  source: SocialSourceRef;
298
313
  control: 'block' | 'mute' | 'hide';
299
314
  scope: 'minds';
300
315
  createdAt: string;
316
+ /** Present on servers that label controls; null when the source has no recent observation. */
317
+ display?: SocialSourceControlDisplay | null;
301
318
  }
302
319
  export type SocialSourceControlChange = Omit<SocialSourceControl, 'id' | 'createdAt'> & {
303
320
  enabled: boolean;
@@ -377,6 +394,32 @@ export interface NativeFollowState extends NativeFollowReceipt {
377
394
  /** An earlier connection or another target profile has an unresolved attempt. Read again to reconcile; do not prepare a new write. */
378
395
  pendingActionBlocked: boolean;
379
396
  }
397
+ /** One connected account on the source's network, as the account lists describe it. */
398
+ export interface NativeFollowAccount {
399
+ id: string;
400
+ protocol: SocialSourceRef['protocol'];
401
+ nativeId: string;
402
+ handle: string;
403
+ serverUrl: string;
404
+ /** Includes `follow`/`unfollow` only when this account may follow here; otherwise offer a reconnect. */
405
+ capabilities: string[];
406
+ }
407
+ /** Every connected account's relationship with one source, from one read. */
408
+ export interface NativeFollowStates {
409
+ protocol: SocialSourceRef['protocol'];
410
+ nativeId: string;
411
+ /** False when native follows are off for this app; accounts are still listed, and no state is read. */
412
+ enabled: boolean;
413
+ accounts: Array<{
414
+ account: NativeFollowAccount;
415
+ /** Null when the account cannot follow, follows are off, or its read failed (see `error`). */
416
+ state: NativeFollowState | null;
417
+ error: {
418
+ code: string;
419
+ message: string;
420
+ } | null;
421
+ }>;
422
+ }
380
423
  export interface NativeFollowReview {
381
424
  id: string;
382
425
  clientMutationId: string;
@@ -624,6 +667,12 @@ export interface NativePostPrepareInput {
624
667
  protocol: 'bluesky';
625
668
  nativeId: string;
626
669
  };
670
+ /**
671
+ * Your own post in this app (sdk.posts, same app) that this publication copies. The server links
672
+ * them in the same write, so `nativePostHistory({ crossPostOf })` can list every copy when the post
673
+ * is deleted. Any other post answers not_found.
674
+ */
675
+ crossPostOf?: string;
627
676
  }
628
677
  export interface NativePostBatch {
629
678
  id: string;
@@ -643,14 +692,42 @@ export interface NativePostBatch {
643
692
  };
644
693
  }>;
645
694
  }
695
+ export interface NativeDelegatedPostHistoryItem {
696
+ id: string;
697
+ createdAt: string;
698
+ text: string;
699
+ textTruncated: boolean;
700
+ deliveries: Array<Omit<NativePostBatch['deliveries'][number], 'text' | 'wireText' | 'maxCharacters'>>;
701
+ /** The post in this app this publication copies, when it was prepared with crossPostOf. */
702
+ crossPostOf?: string;
703
+ }
704
+ /**
705
+ * An original Nostr note the member signed in this app. Reopen it with
706
+ * `getNativeNostrPost(identityId, eventId)` and delete it with the Nostr signing flow
707
+ * (`prepareNativeNostr(identityId, { action: 'delete', postId: eventId })`), not the
708
+ * delegated removal methods. `receipt.state` becomes 'deletion_requested' once a
709
+ * deletion request is confirmed on the relay.
710
+ */
711
+ export interface NativeNostrPostHistoryItem {
712
+ type: 'nostr';
713
+ id: string;
714
+ createdAt: string;
715
+ text: string;
716
+ textTruncated: boolean;
717
+ identityId: string;
718
+ pubkey: string;
719
+ relay: string;
720
+ eventId: string;
721
+ action: 'publish';
722
+ receipt: NativeNostrReceipt;
723
+ checkedAt: string | null;
724
+ lastReadBack: NativeNostrReceipt['readBack'];
725
+ /** The post in this app this note copies, when it was prepared with crossPostOf. */
726
+ crossPostOf?: string;
727
+ }
646
728
  export interface NativePostHistory {
647
- items: Array<{
648
- id: string;
649
- createdAt: string;
650
- text: string;
651
- textTruncated: boolean;
652
- deliveries: Array<Omit<NativePostBatch['deliveries'][number], 'text' | 'wireText' | 'maxCharacters'>>;
653
- }>;
729
+ /** Delegated Bluesky/ActivityPub posts and client-signed Nostr originals, newest first. */
730
+ items: Array<NativeDelegatedPostHistoryItem | NativeNostrPostHistoryItem>;
654
731
  cursor: string | null;
655
732
  }
656
733
  export interface NativeSocialCallbackInput {
@@ -712,6 +789,8 @@ export interface NativeNostrPrepared {
712
789
  relay: string;
713
790
  expiresAt: string;
714
791
  postId?: string;
792
+ /** The post in this app this note will be linked to on submit. */
793
+ crossPostOf?: string;
715
794
  parent?: {
716
795
  protocol: 'nostr';
717
796
  nativeId: string;
@@ -764,6 +843,21 @@ export interface NativeNostrReceipt {
764
843
  readBack: 'found' | 'absent' | 'unavailable';
765
844
  reason?: 'blocked' | 'rate_limited' | 'restricted' | 'invalid' | 'relay_error';
766
845
  }
846
+ /**
847
+ * Ask the app's own PDS to issue a Bluesky account. Only the label is sent: the
848
+ * app decides the domain (`alice` becomes `alice.pds.minds.com` on a test lane,
849
+ * `alice.minds.com` once handles move).
850
+ */
851
+ export interface CreateHostedIdentityInput {
852
+ protocol: 'atproto';
853
+ /** One lowercase label of 3 to 18 characters (the PDS's own bounds): letters, digits and inner hyphens. */
854
+ handle: string;
855
+ email: string;
856
+ }
857
+ /** The new identity, with the member's password: returned this once and stored nowhere. */
858
+ export interface CreatedHostedProtocolIdentity extends HostedProtocolIdentity {
859
+ password: string;
860
+ }
767
861
  export type ConnectHostedIdentityInput = {
768
862
  protocol: 'atproto';
769
863
  identifier: string; /** Prefer a native app password. Used once, never stored. */
@@ -940,6 +1034,16 @@ export interface SocialTrend {
940
1034
  /** A real image-bearing post from this topic, filtered by current source controls. */
941
1035
  preview?: SocialPost;
942
1036
  }
1037
+ /**
1038
+ * Present only on category pages of a feed the app's open-network source index serves (ActivityPub
1039
+ * and Nostr): the provider's posts come first, then posts the index judged into the category. The
1040
+ * page's `cursor` (it starts with `idx:`) carries both positions; pass it back unchanged like any other cursor.
1041
+ */
1042
+ export interface SocialTrendSourceIndex {
1043
+ /** Posts on this page that came from the index rather than the provider's ranking. */
1044
+ served: number;
1045
+ coverage: 'source_index';
1046
+ }
943
1047
  export type SocialTrends = SocialTrendProvenance & ({
944
1048
  kind: 'topics';
945
1049
  items: SocialTrend[];
@@ -948,6 +1052,10 @@ export type SocialTrends = SocialTrendProvenance & ({
948
1052
  kind: 'posts';
949
1053
  items: SocialPost[];
950
1054
  cursor: string | null;
1055
+ sourceIndex?: SocialTrendSourceIndex;
1056
+ safetyFilter?: {
1057
+ withheld: number;
1058
+ };
951
1059
  });
952
1060
  export interface SocialTrendFeed extends SocialTrendProvenance {
953
1061
  trend: SocialTrend;
@@ -1057,6 +1165,18 @@ export interface SocialRadarPosts {
1057
1165
  builtAt: string | null;
1058
1166
  items: SocialPost[];
1059
1167
  }
1168
+ /**
1169
+ * One radar story by id, with its social member posts.
1170
+ * `live`: on the current radar (`cluster` and `items` present). `aged_out`: on one of the last six
1171
+ * radars but not this one. `unknown`: not seen in that window (never existed, or aged out long ago).
1172
+ */
1173
+ export interface SocialRadarStory {
1174
+ id: string;
1175
+ builtAt: string | null;
1176
+ status: 'live' | 'aged_out' | 'unknown';
1177
+ cluster: SocialRadarCluster | null;
1178
+ items: SocialPost[];
1179
+ }
1060
1180
  /** Read options for callers that hold their own deadline, such as a discovery page. */
1061
1181
  export interface SocialReadOptions {
1062
1182
  retry?: boolean;
@@ -1155,6 +1275,14 @@ export declare class ProtocolsResource {
1155
1275
  }): Promise<SingleResponse<SocialTrendFeed>>;
1156
1276
  /** Breaking and viral stories clustered across outlets, open networks and Minds, through the same public-only app boundary. */
1157
1277
  getSharedRadar(projectId: string, params?: SocialRadarParams): Promise<SingleResponse<SocialRadar>>;
1278
+ /** One radar story's social member posts without a key, so a signed-out story card can show the posts it counts. */
1279
+ getSharedRadarPosts(projectId: string, params: {
1280
+ cluster: string;
1281
+ }): Promise<SingleResponse<SocialRadarPosts>>;
1282
+ /** One radar story by id with its posts, without a key: a story page or shared link in one call. */
1283
+ getSharedRadarStory(projectId: string, params: {
1284
+ cluster: string;
1285
+ }): Promise<SingleResponse<SocialRadarStory>>;
1158
1286
  publicNetworks(): Promise<SingleResponse<SocialNetwork[]>>;
1159
1287
  /** Query the live public network. It does not import users or posts. */
1160
1288
  searchPublicPosts(params: SearchPublicPostsParams): Promise<SingleResponse<SocialPostSearch>>;
@@ -1210,6 +1338,10 @@ export declare class ProtocolsResource {
1210
1338
  getPublicRadarPosts(params: {
1211
1339
  cluster: string;
1212
1340
  }, options?: SocialReadOptions): Promise<SingleResponse<SocialRadarPosts>>;
1341
+ /** One radar story by id with its posts under the app's own key; `status` tells an aged-out story from an unknown one. */
1342
+ getPublicRadarStory(params: {
1343
+ cluster: string;
1344
+ }, options?: SocialReadOptions): Promise<SingleResponse<SocialRadarStory>>;
1213
1345
  /** Provider-ranked public accounts with explicit provenance; served from the app's index when a fresh snapshot exists. */
1214
1346
  getPublicPopularProfiles(params: {
1215
1347
  protocol: string;
@@ -1218,6 +1350,12 @@ export declare class ProtocolsResource {
1218
1350
  }): Promise<SingleResponse<SocialPopularProfiles>>;
1219
1351
  /** Read this connected account's current native following; never infer it from a public count. */
1220
1352
  nativeFollowState(input: NativeFollowSourceInput): Promise<SingleResponse<NativeFollowState>>;
1353
+ /**
1354
+ * The viewer's connected accounts on a source's network and each one's follow state, in one read,
1355
+ * so a profile's Follow control is ready after one round trip instead of listing accounts first.
1356
+ * Resume any `pendingActionId` with `nativeFollowStatus`; never start a duplicate action.
1357
+ */
1358
+ nativeFollowStates(input: Omit<NativeFollowSourceInput, 'accountId'>): Promise<SingleResponse<NativeFollowStates>>;
1221
1359
  /** Prepare a follow/unfollow for explicit approval. Preserve the mutation ID after a lost response. */
1222
1360
  prepareNativeFollow(input: NativeFollowPrepareInput): Promise<SingleResponse<NativeFollowReview>>;
1223
1361
  /** Submit one approved action. Only Nostr supplies a public signed event. Automatic retries are disabled. */
@@ -1263,10 +1401,17 @@ export declare class ProtocolsResource {
1263
1401
  }>>;
1264
1402
  /** Read the signed-in owner's saved publication review and durable receipts. */
1265
1403
  nativePostStatus(id: string): Promise<SingleResponse<NativePostBatch>>;
1266
- /** Page the current app user's standalone publication history. This never sends. */
1404
+ /**
1405
+ * Page the current app user's standalone publication history. This never sends.
1406
+ * Items are delegated Bluesky/ActivityPub posts and client-signed Nostr originals (`type: 'nostr'`,
1407
+ * no `deliveries`); the server lists the Nostr ones only for clients that ask, as this method does.
1408
+ * With `crossPostOf`, only the network copies of that post in this app: delete each with
1409
+ * prepareNativePostRemoval/removeNativePost, or the Nostr signing flow for a `type: 'nostr'` item.
1410
+ */
1267
1411
  nativePostHistory(params?: {
1268
1412
  limit?: number;
1269
1413
  cursor?: string;
1414
+ crossPostOf?: string;
1270
1415
  }): Promise<SingleResponse<NativePostHistory>>;
1271
1416
  /** Review the current own posts before approving removal. */
1272
1417
  prepareNativePostRemoval(id: string, input: {
@@ -1325,11 +1470,17 @@ export declare class ProtocolsResource {
1325
1470
  nativeSocialAccounts(): Promise<SingleResponse<{
1326
1471
  enabled: boolean;
1327
1472
  accounts: NativeSocialAccount[];
1473
+ /** Protocols this app can connect with `redirect: 'native'`. Empty when no native callback is configured. */
1474
+ nativeRedirects?: NativeSocialProtocol[];
1328
1475
  }>>;
1329
- /** Private source controls in this app, with bounded pagination. */
1476
+ /**
1477
+ * Private source controls in this app, with bounded pagination. Pass `control` to list only
1478
+ * blocks, mutes or hidden posts; each item may carry a `display` label for the settings list.
1479
+ */
1330
1480
  sourceControls(params?: {
1331
1481
  limit?: number;
1332
1482
  cursor?: string;
1483
+ control?: SocialSourceControl['control'];
1333
1484
  }): Promise<SingleResponse<{
1334
1485
  enabled: boolean;
1335
1486
  items: SocialSourceControl[];
@@ -1356,13 +1507,22 @@ export declare class ProtocolsResource {
1356
1507
  existing: boolean;
1357
1508
  scope: 'minds';
1358
1509
  }>>;
1359
- /** Open the returned authorization URL in the user's browser; never submit passwords or tokens. */
1510
+ /**
1511
+ * Open the returned authorization URL in the user's browser; never submit passwords or tokens.
1512
+ * In a native app pass `redirect: 'native'` (when `nativeSocialAccounts().nativeRedirects` lists the
1513
+ * protocol) and open an in-app auth session on `callbackUrl`, e.g. expo-web-browser's
1514
+ * `openAuthSessionAsync(authorizationUrl, callbackUrl)`; then pass the returned `state`, `code`,
1515
+ * `iss` or `error` query values to `finishNativeSocialConnection`.
1516
+ */
1360
1517
  startNativeSocialConnection(input: {
1361
1518
  protocol: NativeSocialProtocol;
1362
1519
  identifier: string;
1520
+ redirect?: 'web' | 'native';
1363
1521
  }): Promise<SingleResponse<{
1364
1522
  protocol: NativeSocialProtocol;
1365
1523
  authorizationUrl: string;
1524
+ /** Where the provider returns: the app's web callback, or its operator-configured native callback. */
1525
+ callbackUrl: string;
1366
1526
  }>>;
1367
1527
  /** Complete a single-use callback with the same signed-in app user. Remove its query from browser history; do not log codes. */
1368
1528
  finishNativeSocialConnection(input: NativeSocialCallbackInput): Promise<SingleResponse<NativeSocialAccount>>;
@@ -1414,6 +1574,21 @@ export declare class ProtocolsResource {
1414
1574
  /** Request a short-lived, single-use proof bound to this app, account and relay. */
1415
1575
  hostedNostrChallenge(): Promise<SingleResponse<HostedNostrChallenge>>;
1416
1576
  connectHostedIdentity(input: ConnectHostedIdentityInput): Promise<SingleResponse<HostedProtocolIdentity>>;
1577
+ /**
1578
+ * Create a Bluesky account for the signed-in member on the app's own PDS.
1579
+ *
1580
+ * The response carries the member's password exactly once; show it to them and
1581
+ * keep it nowhere. The server either finishes the account or removes it again,
1582
+ * so a failure leaves nothing half made. Never retried automatically: a replay
1583
+ * after a lost response could not return the password a second time.
1584
+ *
1585
+ * Failures to expect: `handle_unavailable` (409, taken or reserved; choose
1586
+ * another), `identity_conflict` (409, the member already has one),
1587
+ * `creation_in_progress` (409), and the operator-side 503s
1588
+ * `handle_dns_unavailable`, `handle_unresolvable`, `handle_unverified` and
1589
+ * `hosted_server_unavailable`, which succeed unchanged once the operator is done.
1590
+ */
1591
+ createHostedIdentity(input: CreateHostedIdentityInput): Promise<SingleResponse<CreatedHostedProtocolIdentity>>;
1417
1592
  disconnectHostedIdentity(id: string): Promise<SingleResponse<{
1418
1593
  disconnected: true;
1419
1594
  }>>;
@@ -103,6 +103,14 @@ export class ProtocolsResource {
103
103
  getSharedRadar(projectId, params = {}) {
104
104
  return this.client.get(`/protocols/public/${encodeURIComponent(projectId)}/radar`, radarQuery(params));
105
105
  }
106
+ /** One radar story's social member posts without a key, so a signed-out story card can show the posts it counts. */
107
+ getSharedRadarPosts(projectId, params) {
108
+ return this.client.get(`/protocols/public/${encodeURIComponent(projectId)}/radar/posts`, { cluster: params.cluster });
109
+ }
110
+ /** One radar story by id with its posts, without a key: a story page or shared link in one call. */
111
+ getSharedRadarStory(projectId, params) {
112
+ return this.client.get(`/protocols/public/${encodeURIComponent(projectId)}/radar/story`, { cluster: params.cluster });
113
+ }
106
114
  publicNetworks() {
107
115
  return this.client.get('/protocols/social/networks');
108
116
  }
@@ -161,6 +169,10 @@ export class ProtocolsResource {
161
169
  getPublicRadarPosts(params, options) {
162
170
  return this.client.get('/protocols/social/radar/posts', { cluster: params.cluster }, ...readOptions(options));
163
171
  }
172
+ /** One radar story by id with its posts under the app's own key; `status` tells an aged-out story from an unknown one. */
173
+ getPublicRadarStory(params, options) {
174
+ return this.client.get('/protocols/social/radar/story', { cluster: params.cluster }, ...readOptions(options));
175
+ }
164
176
  /** Provider-ranked public accounts with explicit provenance; served from the app's index when a fresh snapshot exists. */
165
177
  getPublicPopularProfiles(params) {
166
178
  return this.client.get('/protocols/social/popular-profiles', { protocol: params.protocol, limit: params.limit, cursor: params.cursor });
@@ -169,6 +181,14 @@ export class ProtocolsResource {
169
181
  nativeFollowState(input) {
170
182
  return this.client.get('/protocols/social/follows/state', { accountId: input.accountId, protocol: input.protocol, nativeId: input.nativeId });
171
183
  }
184
+ /**
185
+ * The viewer's connected accounts on a source's network and each one's follow state, in one read,
186
+ * so a profile's Follow control is ready after one round trip instead of listing accounts first.
187
+ * Resume any `pendingActionId` with `nativeFollowStatus`; never start a duplicate action.
188
+ */
189
+ nativeFollowStates(input) {
190
+ return this.client.get('/protocols/social/follows/states', { protocol: input.protocol, nativeId: input.nativeId });
191
+ }
172
192
  /** Prepare a follow/unfollow for explicit approval. Preserve the mutation ID after a lost response. */
173
193
  prepareNativeFollow(input) {
174
194
  return this.client.post('/protocols/social/follows/prepare', { clientMutationId: input.clientMutationId, accountId: input.accountId,
@@ -236,7 +256,8 @@ export class ProtocolsResource {
236
256
  return this.client.post('/protocols/social/posts/prepare', { clientMutationId: input.clientMutationId,
237
257
  text: input.text, accountIds: input.accountIds,
238
258
  ...(input.quote ? { quote: { protocol: input.quote.protocol, nativeId: input.quote.nativeId } } : {}),
239
- ...(input.media !== undefined ? { media: nativeMediaInput(input.media) } : {}) }, { retry: false });
259
+ ...(input.media !== undefined ? { media: nativeMediaInput(input.media) } : {}),
260
+ ...(input.crossPostOf !== undefined ? { crossPostOf: input.crossPostOf } : {}) }, { retry: false });
240
261
  }
241
262
  /** Explicitly approve selected deliveries; never auto-retry an uncertain write. */
242
263
  submitNativePost(id, input) {
@@ -248,9 +269,16 @@ export class ProtocolsResource {
248
269
  hostedIdentityPath(id);
249
270
  return this.client.get(`/protocols/social/posts/${encodeURIComponent(id)}`);
250
271
  }
251
- /** Page the current app user's standalone publication history. This never sends. */
272
+ /**
273
+ * Page the current app user's standalone publication history. This never sends.
274
+ * Items are delegated Bluesky/ActivityPub posts and client-signed Nostr originals (`type: 'nostr'`,
275
+ * no `deliveries`); the server lists the Nostr ones only for clients that ask, as this method does.
276
+ * With `crossPostOf`, only the network copies of that post in this app: delete each with
277
+ * prepareNativePostRemoval/removeNativePost, or the Nostr signing flow for a `type: 'nostr'` item.
278
+ */
252
279
  nativePostHistory(params = {}) {
253
- return this.client.get('/protocols/social/posts', { limit: params.limit, cursor: params.cursor });
280
+ return this.client.get('/protocols/social/posts', { limit: params.limit, cursor: params.cursor,
281
+ ...(params.crossPostOf !== undefined ? { crossPostOf: params.crossPostOf } : {}), include: 'nostr' });
254
282
  }
255
283
  /** Review the current own posts before approving removal. */
256
284
  prepareNativePostRemoval(id, input) {
@@ -300,9 +328,13 @@ export class ProtocolsResource {
300
328
  nativeSocialAccounts() {
301
329
  return this.client.get('/protocols/social/accounts');
302
330
  }
303
- /** Private source controls in this app, with bounded pagination. */
331
+ /**
332
+ * Private source controls in this app, with bounded pagination. Pass `control` to list only
333
+ * blocks, mutes or hidden posts; each item may carry a `display` label for the settings list.
334
+ */
304
335
  sourceControls(params = {}) {
305
- return this.client.get('/protocols/social/controls', { limit: params.limit, cursor: params.cursor });
336
+ return this.client.get('/protocols/social/controls', { limit: params.limit, cursor: params.cursor,
337
+ ...(params.control ? { control: params.control } : {}) });
306
338
  }
307
339
  /** Block/mute an actor or hide a post in Minds. This does not impersonate a native network block. */
308
340
  async setSourceControl(input) {
@@ -328,9 +360,17 @@ export class ProtocolsResource {
328
360
  return this.client.post('/protocols/social/reports', { source: { protocol: input.source.protocol, kind: input.source.kind, nativeId: input.source.nativeId },
329
361
  readRef: input.readRef, ...(input.accountId ? { accountId: input.accountId } : {}), reason: input.reason, details: input.details, scope: input.scope }, { retry: false });
330
362
  }
331
- /** Open the returned authorization URL in the user's browser; never submit passwords or tokens. */
363
+ /**
364
+ * Open the returned authorization URL in the user's browser; never submit passwords or tokens.
365
+ * In a native app pass `redirect: 'native'` (when `nativeSocialAccounts().nativeRedirects` lists the
366
+ * protocol) and open an in-app auth session on `callbackUrl`, e.g. expo-web-browser's
367
+ * `openAuthSessionAsync(authorizationUrl, callbackUrl)`; then pass the returned `state`, `code`,
368
+ * `iss` or `error` query values to `finishNativeSocialConnection`.
369
+ */
332
370
  startNativeSocialConnection(input) {
333
- return this.client.post('/protocols/social/oauth/start', { protocol: input.protocol, identifier: input.identifier }, { retry: false });
371
+ return this.client.post('/protocols/social/oauth/start', { protocol: input.protocol, identifier: input.identifier,
372
+ // Only the choice between operator-configured callbacks is sent; a callback URL never is.
373
+ ...(input.redirect === 'native' ? { redirect: 'native' } : {}) }, { retry: false });
334
374
  }
335
375
  /** Complete a single-use callback with the same signed-in app user. Remove its query from browser history; do not log codes. */
336
376
  finishNativeSocialConnection(input) {
@@ -362,7 +402,8 @@ export class ProtocolsResource {
362
402
  /** Prepare an exact event for review. A timeout never automatically creates another signing request. */
363
403
  prepareNativeNostr(id, input) {
364
404
  hostedIdentityPath(id);
365
- const body = input.action === 'publish' ? { action: input.action, content: input.content }
405
+ const body = input.action === 'publish' ? { action: input.action, content: input.content,
406
+ ...(input.crossPostOf !== undefined ? { crossPostOf: input.crossPostOf } : {}) }
366
407
  : input.action === 'reply' ? { action: input.action, content: input.content, parentId: input.parentId }
367
408
  : input.action === 'linked_post' ? { action: input.action, content: input.content,
368
409
  source: { protocol: input.source.protocol, nativeId: input.source.nativeId,
@@ -425,6 +466,24 @@ export class ProtocolsResource {
425
466
  connectHostedIdentity(input) {
426
467
  return this.client.post('/protocols/identities', input);
427
468
  }
469
+ /**
470
+ * Create a Bluesky account for the signed-in member on the app's own PDS.
471
+ *
472
+ * The response carries the member's password exactly once; show it to them and
473
+ * keep it nowhere. The server either finishes the account or removes it again,
474
+ * so a failure leaves nothing half made. Never retried automatically: a replay
475
+ * after a lost response could not return the password a second time.
476
+ *
477
+ * Failures to expect: `handle_unavailable` (409, taken or reserved; choose
478
+ * another), `identity_conflict` (409, the member already has one),
479
+ * `creation_in_progress` (409), and the operator-side 503s
480
+ * `handle_dns_unavailable`, `handle_unresolvable`, `handle_unverified` and
481
+ * `hosted_server_unavailable`, which succeed unchanged once the operator is done.
482
+ */
483
+ createHostedIdentity(input) {
484
+ const { protocol, handle, email } = input;
485
+ return this.client.post('/protocols/identities/create', { protocol, handle, email }, { retry: false });
486
+ }
428
487
  async disconnectHostedIdentity(id) {
429
488
  return this.client.delete(hostedIdentityPath(id));
430
489
  }
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../client.js';
2
- import type { ChangePasswordInput, DeletionStatus, LoginHistoryEntry, PaginatedResponse, RequestEmailChangeInput, Session, SingleResponse, SuccessResponse, UpdateAppearanceInput, UpdateContentPreferencesInput, UpdateNotificationChannelsInput, UpdatePrivacyInput, UserPreferences } from '../types.js';
2
+ import type { ChangePasswordInput, ConfirmationCodePurpose, ConfirmationCodeSent, DeletionStatus, LoginHistoryEntry, PaginatedResponse, RequestEmailChangeInput, RevokeOtherSessionsInput, RevokeOtherSessionsResult, Session, SingleResponse, SuccessResponse, UpdateAppearanceInput, UpdateContentPreferencesInput, UpdateNotificationChannelsInput, UpdatePrivacyInput, UserPreferences } from '../types.js';
3
3
  export declare class SettingsResource {
4
4
  private client;
5
5
  constructor(client: HttpClient);
@@ -29,11 +29,33 @@ export declare class SettingsResource {
29
29
  listSessions(): Promise<SingleResponse<Session[]>>;
30
30
  /** Revoke a specific session */
31
31
  revokeSession(sessionId: string): Promise<SuccessResponse>;
32
- /** Revoke all sessions */
32
+ /**
33
+ * Revoke every session AND every API key of the account, including the key
34
+ * this client uses: after it resolves, this client is signed out too. For
35
+ * "sign out of all other devices", use `revokeOtherSessions`.
36
+ */
33
37
  revokeAllSessions(): Promise<SuccessResponse>;
38
+ /**
39
+ * Sign out of all other devices. Revokes every Better Auth session and the
40
+ * account's other API keys, and keeps this device: the calling key always
41
+ * survives, and so does the session named by `keep_session_token`. An
42
+ * app-bound key only revokes that app's keys.
43
+ */
44
+ revokeOtherSessions(input?: RevokeOtherSessionsInput): Promise<SingleResponse<RevokeOtherSessionsResult>>;
34
45
  /** Change password */
35
46
  changePassword(input: ChangePasswordInput): Promise<SuccessResponse>;
36
- /** Request email change */
47
+ /**
48
+ * Email a six-digit confirmation code to the account's current address.
49
+ * Only for accounts with no password (`profiles.me().has_password === false`);
50
+ * a password account answers `password_required`. Send the code as
51
+ * `email_code` to `requestEmailChange`, or as `emailCode` to the
52
+ * `auth.*TwoFactor` methods.
53
+ */
54
+ requestConfirmationCode(purpose: ConfirmationCodePurpose): Promise<SingleResponse<ConfirmationCodeSent>>;
55
+ /**
56
+ * Request email change. Confirm with `password`, or with `email_code` for an
57
+ * account that has no password.
58
+ */
37
59
  requestEmailChange(input: RequestEmailChangeInput): Promise<SingleResponse<{
38
60
  success: true;
39
61
  token?: string;
@@ -59,16 +59,42 @@ export class SettingsResource {
59
59
  revokeSession(sessionId) {
60
60
  return this.client.delete(`/settings/sessions/${sessionId}`);
61
61
  }
62
- /** Revoke all sessions */
62
+ /**
63
+ * Revoke every session AND every API key of the account, including the key
64
+ * this client uses: after it resolves, this client is signed out too. For
65
+ * "sign out of all other devices", use `revokeOtherSessions`.
66
+ */
63
67
  revokeAllSessions() {
64
68
  return this.client.delete('/settings/sessions');
65
69
  }
70
+ /**
71
+ * Sign out of all other devices. Revokes every Better Auth session and the
72
+ * account's other API keys, and keeps this device: the calling key always
73
+ * survives, and so does the session named by `keep_session_token`. An
74
+ * app-bound key only revokes that app's keys.
75
+ */
76
+ revokeOtherSessions(input = {}) {
77
+ return this.client.post('/settings/sessions/revoke-others', input);
78
+ }
66
79
  // ── Account Security ──
67
80
  /** Change password */
68
81
  changePassword(input) {
69
82
  return this.client.put('/settings/password', input);
70
83
  }
71
- /** Request email change */
84
+ /**
85
+ * Email a six-digit confirmation code to the account's current address.
86
+ * Only for accounts with no password (`profiles.me().has_password === false`);
87
+ * a password account answers `password_required`. Send the code as
88
+ * `email_code` to `requestEmailChange`, or as `emailCode` to the
89
+ * `auth.*TwoFactor` methods.
90
+ */
91
+ requestConfirmationCode(purpose) {
92
+ return this.client.post('/settings/confirmation-code', { purpose });
93
+ }
94
+ /**
95
+ * Request email change. Confirm with `password`, or with `email_code` for an
96
+ * account that has no password.
97
+ */
72
98
  requestEmailChange(input) {
73
99
  return this.client.post('/settings/email-change', input);
74
100
  }
@@ -27,6 +27,17 @@ export interface VideoPlaybackToken {
27
27
  token: string;
28
28
  expires: number;
29
29
  }
30
+ /** Whether the caller may publish video in this app, and how much storage is left. */
31
+ export interface VideoEntitlement {
32
+ allowed: boolean;
33
+ /** The caller's active app-subscription tier ('free' when none, canceled or past due). */
34
+ tier: string;
35
+ /** Why video is not allowed: a tier without video, or a used-up quota. */
36
+ reason?: 'tier' | 'quota';
37
+ quotaSeconds: number;
38
+ usedSeconds: number;
39
+ remainingSeconds: number;
40
+ }
30
41
  /**
31
42
  * Video primitive. Upload is gated by the caller's paid tier + storage quota
32
43
  * (so apps stay profitable); viewing is open with a signed playback URL.
@@ -34,6 +45,14 @@ export interface VideoPlaybackToken {
34
45
  export declare class VideoResource {
35
46
  private client;
36
47
  constructor(client: HttpClient);
48
+ /**
49
+ * The check `createUpload` runs, without starting an upload: lets a composer
50
+ * gate or explain video before the member picks a file. Needs an app-bound
51
+ * key with `uploads:write`.
52
+ */
53
+ entitlement(): Promise<{
54
+ data: VideoEntitlement;
55
+ }>;
37
56
  /** Begin an upload. Returns Bunny direct-upload creds + the playbackId to attach to a post. */
38
57
  createUpload(input?: {
39
58
  title?: string;
@@ -7,6 +7,14 @@ export class VideoResource {
7
7
  constructor(client) {
8
8
  this.client = client;
9
9
  }
10
+ /**
11
+ * The check `createUpload` runs, without starting an upload: lets a composer
12
+ * gate or explain video before the member picks a file. Needs an app-bound
13
+ * key with `uploads:write`.
14
+ */
15
+ entitlement() {
16
+ return this.client.get('/video/entitlement');
17
+ }
10
18
  /** Begin an upload. Returns Bunny direct-upload creds + the playbackId to attach to a post. */
11
19
  createUpload(input) {
12
20
  return this.client.post('/video/create-upload', input ?? {});
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../client.js';
2
- import type { SingleResponse } from '../types.js';
2
+ import type { PaginatedResponse, SingleResponse } from '../types.js';
3
3
  interface WalletInfo {
4
4
  configured: boolean;
5
5
  address: string | null;
@@ -37,6 +37,39 @@ export interface PayoutState {
37
37
  payouts_enabled: boolean;
38
38
  country: string | null;
39
39
  }
40
+ /** A wallet the user linked and (optionally) verified. */
41
+ export interface LinkedTokenWallet {
42
+ chain: string;
43
+ address: string;
44
+ verified_at: string | null;
45
+ }
46
+ /** The user's MINDS token balance from the off-chain ledger. */
47
+ export interface TokenBalance {
48
+ /** Signed wei as a decimal string: it exceeds Number.MAX_SAFE_INTEGER, never parse it as a number. */
49
+ offchain_wei: string;
50
+ /** The same balance in MINDS, rounded to 6 decimal places. Display only. */
51
+ offchain_minds: number;
52
+ /** How many off-chain ledger entries make up the balance. */
53
+ entries: number;
54
+ linked_wallets: LinkedTokenWallet[];
55
+ base_wallet_address: string | null;
56
+ }
57
+ /** One token ledger movement. */
58
+ export interface TokenLedgerEntry {
59
+ id: string;
60
+ category: string | null;
61
+ /** Signed wei as a decimal string. */
62
+ amount_wei: string;
63
+ amount_minds: number;
64
+ asset: string;
65
+ settlement: string;
66
+ tx_hash: string | null;
67
+ counterparty_user_id: string | null;
68
+ subject_type: string | null;
69
+ subject_id: string | null;
70
+ status: string;
71
+ occurred_at: string;
72
+ }
40
73
  export declare class WalletResource {
41
74
  private client;
42
75
  constructor(client: HttpClient);
@@ -44,6 +77,13 @@ export declare class WalletResource {
44
77
  getMyWallet(): Promise<SingleResponse<WalletInfo>>;
45
78
  /** Get wallet balance for the current user */
46
79
  getBalance(): Promise<SingleResponse<WalletBalance>>;
80
+ /** The current user's MINDS token balance (off-chain ledger) and linked wallets. */
81
+ getTokenBalance(): Promise<SingleResponse<TokenBalance>>;
82
+ /** The current user's token ledger, newest first (limit up to 200, default 50). */
83
+ getTokenLedger(params?: {
84
+ limit?: number;
85
+ offset?: number;
86
+ }): Promise<PaginatedResponse<TokenLedgerEntry>>;
47
87
  /** USD payout eligibility for the current app user (Stripe Connect). */
48
88
  getPayouts(): Promise<SingleResponse<PayoutState>>;
49
89
  /** Start or resume payout onboarding. Open the returned URL in a browser. */