@recursiv/sdk 0.7.17 → 0.7.19

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.
package/dist/index.d.ts CHANGED
@@ -189,7 +189,7 @@ export type { UploadMediaInput, UploadUrlInput, UploadUrlResult } from './resour
189
189
  export { WalletResource } from './resources/wallet.js';
190
190
  export { ProtocolsResource } from './resources/protocols.js';
191
191
  export { PROTOCOL_ADAPTER_MATURITIES, PROTOCOL_CAPABILITY_OPERATIONS, PROTOCOL_CAPABILITY_STATUSES, } from './resources/protocols.js';
192
- export type { HostedProtocolConnections, ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
192
+ export type { SocialProfile, SocialSubscription, SocialProfilePage, SocialPost, SocialAuthorFeed, SearchPublicProfilesParams, HostedProtocolConnections, HostedProtocol, HostedProtocolIdentity, HostedNostrChallenge, HostedNostrIdentityProof, HostedPostPreview, ConnectHostedIdentityInput, PreviewHostedPostInput, PublishHostedPostInput, ListProtocolCandidatesParams, ProtocolAdapterMaturity, ProtocolAdapterMetadata, ProtocolCandidateListResponse, ProtocolCandidatePageMeta, ProtocolCapabilityOperation, ProtocolCapabilityStatus, ProtocolCollectionStatus, ProtocolQuarantinedCandidate, ProtocolRefreshResult, ProtocolSettings, ProtocolSettingsUpdateResult, UpdateSettingsInput as UpdateProtocolSettingsInput, } from './resources/protocols.js';
193
193
  export { InboxResource } from './resources/inbox.js';
194
194
  export { NetworkResource } from './resources/network.js';
195
195
  export { SimulatorResource } from './resources/simulator.js';
@@ -129,13 +129,168 @@ export interface HostedProtocolConnections {
129
129
  url: string;
130
130
  }[];
131
131
  }
132
+ export type HostedProtocol = 'atproto' | 'activitypub' | 'nostr';
133
+ export interface HostedProtocolIdentity {
134
+ id: string;
135
+ protocol: HostedProtocol;
136
+ serverUrl: string;
137
+ nativeId: string;
138
+ handle: string;
139
+ profileUrl: string | null;
140
+ verifiedAt: string;
141
+ createdAt: string;
142
+ }
143
+ export interface HostedNostrChallenge {
144
+ expiresAt: string;
145
+ /** Sign using a NIP-07 signer; never publish this kind-22242 event. */
146
+ event: {
147
+ kind: 22242;
148
+ content: string;
149
+ created_at: number;
150
+ tags: string[][];
151
+ };
152
+ }
153
+ export interface HostedNostrIdentityProof {
154
+ id: string;
155
+ pubkey: string;
156
+ sig: string;
157
+ kind: number;
158
+ content: string;
159
+ created_at: number;
160
+ tags: string[][];
161
+ }
162
+ export type ConnectHostedIdentityInput = {
163
+ protocol: 'atproto';
164
+ identifier: string; /** Prefer a native app password. Used once, never stored. */
165
+ password: string;
166
+ } | {
167
+ protocol: 'activitypub'; /** Native read:accounts/read:statuses token. Used once, never stored. */
168
+ accessToken: string;
169
+ } | {
170
+ protocol: 'nostr';
171
+ event: HostedNostrIdentityProof;
172
+ };
173
+ export interface PreviewHostedPostInput {
174
+ /** AT URI, GoToSocial status ID, or Nostr event ID. Never a fetch URL. */
175
+ nativePostId: string;
176
+ /** Required for ActivityPub reads; verified as the connected owner each time. */
177
+ accessToken?: string;
178
+ }
179
+ export interface HostedPostPreview {
180
+ identityId: string;
181
+ protocol: HostedProtocol;
182
+ externalId: string;
183
+ externalUrl: string;
184
+ content: string;
185
+ publishedAt: string;
186
+ isNsfw: boolean;
187
+ sourceVisibility: 'public' | 'unlisted';
188
+ contentHash: string;
189
+ }
190
+ export interface PublishHostedPostInput extends PreviewHostedPostInput {
191
+ contentHash: string;
192
+ /** Explicitly publish the previewed text publicly in this app. */
193
+ publishPublicly: true;
194
+ }
195
+ /** Public source identity, independent of any local Minds user or handle. */
196
+ export interface SocialProfile {
197
+ protocol: string;
198
+ nativeId: string;
199
+ handle: string;
200
+ displayName: string;
201
+ description: string;
202
+ profileUrl: string;
203
+ avatarUrl: string | null;
204
+ followersCount: number | null;
205
+ followingCount: number | null;
206
+ postsCount: number | null;
207
+ subscription: SocialSubscription | null;
208
+ }
209
+ export interface SocialSubscription {
210
+ id: string;
211
+ protocol: string;
212
+ nativeId: string;
213
+ /** Private reading subscription in this app; not a native-network follow. */
214
+ kind: 'minds_feed';
215
+ createdAt: string;
216
+ }
217
+ export interface SearchPublicProfilesParams {
218
+ protocol: string;
219
+ query: string;
220
+ limit?: number;
221
+ cursor?: string;
222
+ }
223
+ export interface SocialProfilePage {
224
+ items: SocialProfile[];
225
+ cursor: string | null;
226
+ }
227
+ /** Public source data read on demand; never a canonical Minds post ID. */
228
+ export interface SocialPost {
229
+ protocol: string;
230
+ nativeId: string;
231
+ sourceUrl: string;
232
+ author: Omit<SocialProfile, 'subscription'>;
233
+ text: string;
234
+ createdAt: string;
235
+ replyCount: number;
236
+ likeCount: number;
237
+ repostCount: number;
238
+ media: Array<{
239
+ type: 'image';
240
+ url: string;
241
+ alt: string;
242
+ }>;
243
+ hasAdditionalContent: boolean;
244
+ }
245
+ export interface SocialAuthorFeed {
246
+ items: SocialPost[];
247
+ cursor: string | null;
248
+ coverage: 'original_posts';
249
+ }
132
250
  export declare class ProtocolsResource {
133
251
  private client;
134
252
  constructor(client: HttpClient);
253
+ /** Query the live public network. It does not import users or posts. */
254
+ searchPublicProfiles(params: SearchPublicProfilesParams): Promise<SingleResponse<SocialProfilePage>>;
255
+ getPublicProfile(protocol: string, actor: string): Promise<SingleResponse<SocialProfile>>;
256
+ getPublicAuthorFeed(params: {
257
+ protocol: string;
258
+ actor: string;
259
+ limit?: number;
260
+ cursor?: string;
261
+ }): Promise<SingleResponse<SocialAuthorFeed>>;
262
+ listSubscriptions(): Promise<SingleResponse<SocialSubscription[]>>;
263
+ /** Save a private reading subscription after resolving the immutable native ID. */
264
+ subscribeToProfile(input: {
265
+ protocol: string;
266
+ nativeId: string;
267
+ kind: 'minds_feed';
268
+ }): Promise<SingleResponse<SocialSubscription>>;
269
+ unsubscribeFromProfile(id: string): Promise<SingleResponse<{
270
+ deleted: true;
271
+ }>>;
135
272
  /** List adapters with truthful capability, maturity, and limitation metadata. */
136
273
  list(): Promise<SingleResponse<ProtocolAdapterMetadata[]>>;
137
274
  /** Configured addresses for the current app. Does not attest runtime or account readiness. */
138
275
  hostedServers(): Promise<SingleResponse<HostedProtocolConnections>>;
276
+ /** Private connections belonging only to the signed-in person in the key's app. */
277
+ hostedIdentities(): Promise<SingleResponse<Array<HostedProtocolIdentity & {
278
+ configured: boolean;
279
+ }>>>;
280
+ /** Request a short-lived, single-use proof bound to this app, account and relay. */
281
+ hostedNostrChallenge(): Promise<SingleResponse<HostedNostrChallenge>>;
282
+ connectHostedIdentity(input: ConnectHostedIdentityInput): Promise<SingleResponse<HostedProtocolIdentity>>;
283
+ disconnectHostedIdentity(id: string): Promise<SingleResponse<{
284
+ disconnected: true;
285
+ }>>;
286
+ /** Preview one owned native text post. Does not create a Minds post. */
287
+ previewHostedPost(id: string, input: PreviewHostedPostInput): Promise<SingleResponse<HostedPostPreview>>;
288
+ /** Refetch/recheck the preview and create one canonical, scoped app post. */
289
+ publishHostedPost(id: string, input: PublishHostedPostInput): Promise<SingleResponse<{
290
+ postId: string;
291
+ protocol: HostedProtocol;
292
+ externalId: string;
293
+ }>>;
139
294
  /** Get project-scoped unpublished candidate status (admin) */
140
295
  status(): Promise<SingleResponse<ProtocolCollectionStatus[]>>;
141
296
  /**
@@ -28,11 +28,44 @@ export const PROTOCOL_ADAPTER_MATURITIES = Object.freeze([
28
28
  'beta',
29
29
  'stable',
30
30
  ]);
31
+ function hostedIdentityPath(id) {
32
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)) {
33
+ throw new ValidationError({ type: 'validation_error', code: 'invalid_identity_id', message: 'A valid hosted identity connection ID is required' });
34
+ }
35
+ return `/protocols/identities/${encodeURIComponent(id)}`;
36
+ }
31
37
  export class ProtocolsResource {
32
38
  client;
33
39
  constructor(client) {
34
40
  this.client = client;
35
41
  }
42
+ /** Query the live public network. It does not import users or posts. */
43
+ searchPublicProfiles(params) {
44
+ return this.client.get('/protocols/social/profiles', {
45
+ protocol: params.protocol, query: params.query, limit: params.limit, cursor: params.cursor,
46
+ });
47
+ }
48
+ getPublicProfile(protocol, actor) {
49
+ return this.client.get('/protocols/social/profile', { protocol, actor });
50
+ }
51
+ getPublicAuthorFeed(params) {
52
+ return this.client.get('/protocols/social/author-feed', {
53
+ protocol: params.protocol, actor: params.actor, limit: params.limit, cursor: params.cursor,
54
+ });
55
+ }
56
+ listSubscriptions() {
57
+ return this.client.get('/protocols/social/subscriptions');
58
+ }
59
+ /** Save a private reading subscription after resolving the immutable native ID. */
60
+ subscribeToProfile(input) {
61
+ return this.client.post('/protocols/social/subscriptions', input);
62
+ }
63
+ unsubscribeFromProfile(id) {
64
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)) {
65
+ throw new ValidationError({ type: 'validation_error', code: 'invalid_subscription_id', message: 'A valid subscription ID is required' });
66
+ }
67
+ return this.client.delete(`/protocols/social/subscriptions/${encodeURIComponent(id)}`);
68
+ }
36
69
  /** List adapters with truthful capability, maturity, and limitation metadata. */
37
70
  list() {
38
71
  return this.client.get('/protocols');
@@ -41,6 +74,28 @@ export class ProtocolsResource {
41
74
  hostedServers() {
42
75
  return this.client.get('/protocols/servers');
43
76
  }
77
+ /** Private connections belonging only to the signed-in person in the key's app. */
78
+ hostedIdentities() {
79
+ return this.client.get('/protocols/identities');
80
+ }
81
+ /** Request a short-lived, single-use proof bound to this app, account and relay. */
82
+ hostedNostrChallenge() {
83
+ return this.client.post('/protocols/nostr-challenge', {});
84
+ }
85
+ connectHostedIdentity(input) {
86
+ return this.client.post('/protocols/identities', input);
87
+ }
88
+ async disconnectHostedIdentity(id) {
89
+ return this.client.delete(hostedIdentityPath(id));
90
+ }
91
+ /** Preview one owned native text post. Does not create a Minds post. */
92
+ async previewHostedPost(id, input) {
93
+ return this.client.post(`${hostedIdentityPath(id)}/posts/preview`, input);
94
+ }
95
+ /** Refetch/recheck the preview and create one canonical, scoped app post. */
96
+ async publishHostedPost(id, input) {
97
+ return this.client.post(`${hostedIdentityPath(id)}/posts`, input);
98
+ }
44
99
  /** Get project-scoped unpublished candidate status (admin) */
45
100
  status() {
46
101
  return this.client.get('/protocols/status');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recursiv/sdk",
3
- "version": "0.7.17",
3
+ "version": "0.7.19",
4
4
  "description": "TypeScript SDK for the Recursiv API",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "type": "module",