@singi-labs/sifa-sdk 0.9.19 → 0.9.20

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.
Files changed (37) hide show
  1. package/dist/feed-DHTy7fUN.d.cts +254 -0
  2. package/dist/feed-DHTy7fUN.d.ts +254 -0
  3. package/dist/{index-DCpMh2Ny.d.cts → index-DYUYJxOs.d.cts} +1 -1
  4. package/dist/{index-DCpMh2Ny.d.ts → index-DYUYJxOs.d.ts} +1 -1
  5. package/dist/index.cjs +103 -2
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +4 -3
  8. package/dist/index.d.ts +4 -3
  9. package/dist/index.js +92 -3
  10. package/dist/index.js.map +1 -1
  11. package/dist/keys-D-vNPzXx.d.ts +1085 -0
  12. package/dist/keys-DRD79nDE.d.cts +1085 -0
  13. package/dist/query/fetchers/index.cjs +155 -1
  14. package/dist/query/fetchers/index.cjs.map +1 -1
  15. package/dist/query/fetchers/index.d.cts +6 -933
  16. package/dist/query/fetchers/index.d.ts +6 -933
  17. package/dist/query/fetchers/index.js +146 -2
  18. package/dist/query/fetchers/index.js.map +1 -1
  19. package/dist/query/hooks/index.cjs +2268 -0
  20. package/dist/query/hooks/index.cjs.map +1 -0
  21. package/dist/query/hooks/index.d.cts +479 -0
  22. package/dist/query/hooks/index.d.ts +479 -0
  23. package/dist/query/hooks/index.js +2178 -0
  24. package/dist/query/hooks/index.js.map +1 -0
  25. package/dist/query/index.cjs +340 -1
  26. package/dist/query/index.cjs.map +1 -1
  27. package/dist/query/index.d.cts +9 -352
  28. package/dist/query/index.d.ts +9 -352
  29. package/dist/query/index.js +322 -3
  30. package/dist/query/index.js.map +1 -1
  31. package/dist/schemas/index.cjs +102 -1
  32. package/dist/schemas/index.cjs.map +1 -1
  33. package/dist/schemas/index.d.cts +28 -2
  34. package/dist/schemas/index.d.ts +28 -2
  35. package/dist/schemas/index.js +91 -2
  36. package/dist/schemas/index.js.map +1 -1
  37. package/package.json +11 -1
@@ -0,0 +1,254 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Profile row shared across `/api/following`, `/api/profile/:handleOrDid/mutuals`,
5
+ * and `/api/me/bluesky-suggestions`. Matches the existing `FollowProfile` TS
6
+ * interface byte-for-byte but adds runtime validation for the SDK's pagination
7
+ * helpers and the upcoming `sifa-app` consumer (where we can't trust the wire).
8
+ *
9
+ * Per `sifa-api#674` PR body: mutuals + bluesky-suggestions reuse this shape
10
+ * exactly, so a single Zod schema covers all three endpoints.
11
+ */
12
+ declare const FollowProfileSchema: z.ZodObject<{
13
+ did: z.ZodString;
14
+ handle: z.ZodString;
15
+ displayName: z.ZodOptional<z.ZodString>;
16
+ headline: z.ZodOptional<z.ZodString>;
17
+ avatarUrl: z.ZodOptional<z.ZodString>;
18
+ source: z.ZodString;
19
+ claimed: z.ZodBoolean;
20
+ followedAt: z.ZodString;
21
+ blueskyVerified: z.ZodOptional<z.ZodBoolean>;
22
+ blueskyVerifiedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ }, z.core.$strip>;
24
+ type FollowProfileItem = z.infer<typeof FollowProfileSchema>;
25
+ /**
26
+ * Cursor-paginated page of {@link FollowProfileSchema} rows. Used by mutuals
27
+ * + bluesky-suggestions. The legacy `/api/following` endpoint uses a different
28
+ * wrapper key (`follows` instead of `items`) and is intentionally NOT covered
29
+ * by this schema.
30
+ */
31
+ declare const FollowProfilePageSchema: z.ZodObject<{
32
+ items: z.ZodArray<z.ZodObject<{
33
+ did: z.ZodString;
34
+ handle: z.ZodString;
35
+ displayName: z.ZodOptional<z.ZodString>;
36
+ headline: z.ZodOptional<z.ZodString>;
37
+ avatarUrl: z.ZodOptional<z.ZodString>;
38
+ source: z.ZodString;
39
+ claimed: z.ZodBoolean;
40
+ followedAt: z.ZodString;
41
+ blueskyVerified: z.ZodOptional<z.ZodBoolean>;
42
+ blueskyVerifiedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ }, z.core.$strip>>;
44
+ cursor: z.ZodNullable<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ type FollowProfilePage = z.infer<typeof FollowProfilePageSchema>;
47
+ /**
48
+ * Per-flag allowlist row returned by `GET /api/admin/feature-allowlists/:flag`.
49
+ * Mirrors the `feature_allowlists` table; `note` is optional free-form text.
50
+ */
51
+ declare const FeatureAllowlistEntrySchema: z.ZodObject<{
52
+ did: z.ZodString;
53
+ addedAt: z.ZodString;
54
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ }, z.core.$strip>;
56
+ type FeatureAllowlistEntry = z.infer<typeof FeatureAllowlistEntrySchema>;
57
+ /**
58
+ * Known feature flags accepted by the admin allowlist endpoints. Mirrors the
59
+ * server-side `FEATURE_FLAGS` const in `sifa-api`. Kept as a `const` tuple so
60
+ * consumers can `as const`-narrow when building UIs.
61
+ */
62
+ declare const FEATURE_FLAGS: readonly ["FEED_V5_ENABLED"];
63
+ type FeatureFlag = (typeof FEATURE_FLAGS)[number];
64
+
65
+ /**
66
+ * Feed item from `GET /api/following/feed`. Discriminated on `source`:
67
+ *
68
+ * - `sifa`: a Sifa-native event (e.g. profile update, endorsement).
69
+ * - `atmosphere`: a curated creation event from another ATproto app
70
+ * (Barazo post, etc.). Payload is the hydrated `app.bsky.embed.*#view`
71
+ * shape, NOT the raw record (per memory `sifa-hydrated-view-embed-types`).
72
+ *
73
+ * Both variants share `actor`, `indexedAt`, and `id` (the materialized
74
+ * `feed_events.id` row identifier, used in the cursor).
75
+ */
76
+ declare const FeedActorSchema: z.ZodObject<{
77
+ did: z.ZodString;
78
+ handle: z.ZodString;
79
+ displayName: z.ZodOptional<z.ZodString>;
80
+ avatarUrl: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strip>;
82
+ type FeedActor = z.infer<typeof FeedActorSchema>;
83
+ /**
84
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
85
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
86
+ * Stream are two distinct surfaces with different data paths (Barazo API
87
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
88
+ * types are no longer consumed. Scheduled for removal in next major bump.
89
+ */
90
+ declare const SifaFeedItemSchema: z.ZodObject<{
91
+ id: z.ZodString;
92
+ actor: z.ZodObject<{
93
+ did: z.ZodString;
94
+ handle: z.ZodString;
95
+ displayName: z.ZodOptional<z.ZodString>;
96
+ avatarUrl: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ indexedAt: z.ZodString;
99
+ eventType: z.ZodString;
100
+ source: z.ZodLiteral<"sifa">;
101
+ appId: z.ZodOptional<z.ZodLiteral<"sifa">>;
102
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
103
+ }, z.core.$strip>;
104
+ /**
105
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
106
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
107
+ * Stream are two distinct surfaces with different data paths (Barazo API
108
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
109
+ * types are no longer consumed. Scheduled for removal in next major bump.
110
+ */
111
+ type SifaFeedItem = z.infer<typeof SifaFeedItemSchema>;
112
+ /**
113
+ * ATmosphere feed item. `payload` is intentionally permissive: it carries
114
+ * a hydrated `app.bsky.embed.*#view` shape that varies by source app. The
115
+ * AppView resolves the hydration; clients render via the existing
116
+ * embed-view union (mirrors `sifa-web/src/components/stream/`).
117
+ *
118
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
119
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
120
+ * Stream are two distinct surfaces with different data paths (Barazo API
121
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
122
+ * types are no longer consumed. Scheduled for removal in next major bump.
123
+ */
124
+ declare const AtmosphereFeedItemSchema: z.ZodObject<{
125
+ id: z.ZodString;
126
+ actor: z.ZodObject<{
127
+ did: z.ZodString;
128
+ handle: z.ZodString;
129
+ displayName: z.ZodOptional<z.ZodString>;
130
+ avatarUrl: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strip>;
132
+ indexedAt: z.ZodString;
133
+ eventType: z.ZodString;
134
+ source: z.ZodLiteral<"atmosphere">;
135
+ appId: z.ZodString;
136
+ uri: z.ZodOptional<z.ZodString>;
137
+ cid: z.ZodOptional<z.ZodString>;
138
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
139
+ }, z.core.$strip>;
140
+ /**
141
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
142
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
143
+ * Stream are two distinct surfaces with different data paths (Barazo API
144
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
145
+ * types are no longer consumed. Scheduled for removal in next major bump.
146
+ */
147
+ type AtmosphereFeedItem = z.infer<typeof AtmosphereFeedItemSchema>;
148
+ /**
149
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
150
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
151
+ * Stream are two distinct surfaces with different data paths (Barazo API
152
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
153
+ * types are no longer consumed. Scheduled for removal in next major bump.
154
+ */
155
+ declare const FollowFeedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
156
+ id: z.ZodString;
157
+ actor: z.ZodObject<{
158
+ did: z.ZodString;
159
+ handle: z.ZodString;
160
+ displayName: z.ZodOptional<z.ZodString>;
161
+ avatarUrl: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>;
163
+ indexedAt: z.ZodString;
164
+ eventType: z.ZodString;
165
+ source: z.ZodLiteral<"sifa">;
166
+ appId: z.ZodOptional<z.ZodLiteral<"sifa">>;
167
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ id: z.ZodString;
170
+ actor: z.ZodObject<{
171
+ did: z.ZodString;
172
+ handle: z.ZodString;
173
+ displayName: z.ZodOptional<z.ZodString>;
174
+ avatarUrl: z.ZodOptional<z.ZodString>;
175
+ }, z.core.$strip>;
176
+ indexedAt: z.ZodString;
177
+ eventType: z.ZodString;
178
+ source: z.ZodLiteral<"atmosphere">;
179
+ appId: z.ZodString;
180
+ uri: z.ZodOptional<z.ZodString>;
181
+ cid: z.ZodOptional<z.ZodString>;
182
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
183
+ }, z.core.$strip>], "source">;
184
+ /**
185
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
186
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
187
+ * Stream are two distinct surfaces with different data paths (Barazo API
188
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
189
+ * types are no longer consumed. Scheduled for removal in next major bump.
190
+ */
191
+ type FollowFeedItem = z.infer<typeof FollowFeedItemSchema>;
192
+ /**
193
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
194
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
195
+ * Stream are two distinct surfaces with different data paths (Barazo API
196
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
197
+ * types are no longer consumed. Scheduled for removal in next major bump.
198
+ */
199
+ declare const FollowFeedPageSchema: z.ZodObject<{
200
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
201
+ id: z.ZodString;
202
+ actor: z.ZodObject<{
203
+ did: z.ZodString;
204
+ handle: z.ZodString;
205
+ displayName: z.ZodOptional<z.ZodString>;
206
+ avatarUrl: z.ZodOptional<z.ZodString>;
207
+ }, z.core.$strip>;
208
+ indexedAt: z.ZodString;
209
+ eventType: z.ZodString;
210
+ source: z.ZodLiteral<"sifa">;
211
+ appId: z.ZodOptional<z.ZodLiteral<"sifa">>;
212
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
213
+ }, z.core.$strip>, z.ZodObject<{
214
+ id: z.ZodString;
215
+ actor: z.ZodObject<{
216
+ did: z.ZodString;
217
+ handle: z.ZodString;
218
+ displayName: z.ZodOptional<z.ZodString>;
219
+ avatarUrl: z.ZodOptional<z.ZodString>;
220
+ }, z.core.$strip>;
221
+ indexedAt: z.ZodString;
222
+ eventType: z.ZodString;
223
+ source: z.ZodLiteral<"atmosphere">;
224
+ appId: z.ZodString;
225
+ uri: z.ZodOptional<z.ZodString>;
226
+ cid: z.ZodOptional<z.ZodString>;
227
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
228
+ }, z.core.$strip>], "source">>;
229
+ cursor: z.ZodNullable<z.ZodString>;
230
+ }, z.core.$strip>;
231
+ /**
232
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
233
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
234
+ * Stream are two distinct surfaces with different data paths (Barazo API
235
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
236
+ * types are no longer consumed. Scheduled for removal in next major bump.
237
+ */
238
+ type FollowFeedPage = z.infer<typeof FollowFeedPageSchema>;
239
+ /**
240
+ * Composite feed cursor `(indexedAt DESC, source, id)`. Encoded as a
241
+ * URL-safe base64 string so it survives `URLSearchParams` round-trips
242
+ * without further encoding. Decoupling encode/decode from the API call
243
+ * lets consumers persist cursors (e.g. for "jump-back-here" UX) and
244
+ * lets us unit-test the format.
245
+ */
246
+ interface FeedCursor {
247
+ indexedAt: string;
248
+ source: 'sifa' | 'atmosphere';
249
+ id: string;
250
+ }
251
+ declare function encodeFeedCursor(cursor: FeedCursor): string;
252
+ declare function decodeFeedCursor(encoded: string): FeedCursor;
253
+
254
+ export { type AtmosphereFeedItem as A, type FollowFeedPage as F, type SifaFeedItem as S, type FollowProfileItem as a, type FeatureAllowlistEntry as b, type FeatureFlag as c, AtmosphereFeedItemSchema as d, FEATURE_FLAGS as e, FeatureAllowlistEntrySchema as f, type FeedActor as g, FeedActorSchema as h, type FeedCursor as i, type FollowFeedItem as j, FollowFeedItemSchema as k, FollowFeedPageSchema as l, type FollowProfilePage as m, FollowProfilePageSchema as n, FollowProfileSchema as o, SifaFeedItemSchema as p, decodeFeedCursor as q, encodeFeedCursor as r };
@@ -0,0 +1,254 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Profile row shared across `/api/following`, `/api/profile/:handleOrDid/mutuals`,
5
+ * and `/api/me/bluesky-suggestions`. Matches the existing `FollowProfile` TS
6
+ * interface byte-for-byte but adds runtime validation for the SDK's pagination
7
+ * helpers and the upcoming `sifa-app` consumer (where we can't trust the wire).
8
+ *
9
+ * Per `sifa-api#674` PR body: mutuals + bluesky-suggestions reuse this shape
10
+ * exactly, so a single Zod schema covers all three endpoints.
11
+ */
12
+ declare const FollowProfileSchema: z.ZodObject<{
13
+ did: z.ZodString;
14
+ handle: z.ZodString;
15
+ displayName: z.ZodOptional<z.ZodString>;
16
+ headline: z.ZodOptional<z.ZodString>;
17
+ avatarUrl: z.ZodOptional<z.ZodString>;
18
+ source: z.ZodString;
19
+ claimed: z.ZodBoolean;
20
+ followedAt: z.ZodString;
21
+ blueskyVerified: z.ZodOptional<z.ZodBoolean>;
22
+ blueskyVerifiedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ }, z.core.$strip>;
24
+ type FollowProfileItem = z.infer<typeof FollowProfileSchema>;
25
+ /**
26
+ * Cursor-paginated page of {@link FollowProfileSchema} rows. Used by mutuals
27
+ * + bluesky-suggestions. The legacy `/api/following` endpoint uses a different
28
+ * wrapper key (`follows` instead of `items`) and is intentionally NOT covered
29
+ * by this schema.
30
+ */
31
+ declare const FollowProfilePageSchema: z.ZodObject<{
32
+ items: z.ZodArray<z.ZodObject<{
33
+ did: z.ZodString;
34
+ handle: z.ZodString;
35
+ displayName: z.ZodOptional<z.ZodString>;
36
+ headline: z.ZodOptional<z.ZodString>;
37
+ avatarUrl: z.ZodOptional<z.ZodString>;
38
+ source: z.ZodString;
39
+ claimed: z.ZodBoolean;
40
+ followedAt: z.ZodString;
41
+ blueskyVerified: z.ZodOptional<z.ZodBoolean>;
42
+ blueskyVerifiedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ }, z.core.$strip>>;
44
+ cursor: z.ZodNullable<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ type FollowProfilePage = z.infer<typeof FollowProfilePageSchema>;
47
+ /**
48
+ * Per-flag allowlist row returned by `GET /api/admin/feature-allowlists/:flag`.
49
+ * Mirrors the `feature_allowlists` table; `note` is optional free-form text.
50
+ */
51
+ declare const FeatureAllowlistEntrySchema: z.ZodObject<{
52
+ did: z.ZodString;
53
+ addedAt: z.ZodString;
54
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ }, z.core.$strip>;
56
+ type FeatureAllowlistEntry = z.infer<typeof FeatureAllowlistEntrySchema>;
57
+ /**
58
+ * Known feature flags accepted by the admin allowlist endpoints. Mirrors the
59
+ * server-side `FEATURE_FLAGS` const in `sifa-api`. Kept as a `const` tuple so
60
+ * consumers can `as const`-narrow when building UIs.
61
+ */
62
+ declare const FEATURE_FLAGS: readonly ["FEED_V5_ENABLED"];
63
+ type FeatureFlag = (typeof FEATURE_FLAGS)[number];
64
+
65
+ /**
66
+ * Feed item from `GET /api/following/feed`. Discriminated on `source`:
67
+ *
68
+ * - `sifa`: a Sifa-native event (e.g. profile update, endorsement).
69
+ * - `atmosphere`: a curated creation event from another ATproto app
70
+ * (Barazo post, etc.). Payload is the hydrated `app.bsky.embed.*#view`
71
+ * shape, NOT the raw record (per memory `sifa-hydrated-view-embed-types`).
72
+ *
73
+ * Both variants share `actor`, `indexedAt`, and `id` (the materialized
74
+ * `feed_events.id` row identifier, used in the cursor).
75
+ */
76
+ declare const FeedActorSchema: z.ZodObject<{
77
+ did: z.ZodString;
78
+ handle: z.ZodString;
79
+ displayName: z.ZodOptional<z.ZodString>;
80
+ avatarUrl: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strip>;
82
+ type FeedActor = z.infer<typeof FeedActorSchema>;
83
+ /**
84
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
85
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
86
+ * Stream are two distinct surfaces with different data paths (Barazo API
87
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
88
+ * types are no longer consumed. Scheduled for removal in next major bump.
89
+ */
90
+ declare const SifaFeedItemSchema: z.ZodObject<{
91
+ id: z.ZodString;
92
+ actor: z.ZodObject<{
93
+ did: z.ZodString;
94
+ handle: z.ZodString;
95
+ displayName: z.ZodOptional<z.ZodString>;
96
+ avatarUrl: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ indexedAt: z.ZodString;
99
+ eventType: z.ZodString;
100
+ source: z.ZodLiteral<"sifa">;
101
+ appId: z.ZodOptional<z.ZodLiteral<"sifa">>;
102
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
103
+ }, z.core.$strip>;
104
+ /**
105
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
106
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
107
+ * Stream are two distinct surfaces with different data paths (Barazo API
108
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
109
+ * types are no longer consumed. Scheduled for removal in next major bump.
110
+ */
111
+ type SifaFeedItem = z.infer<typeof SifaFeedItemSchema>;
112
+ /**
113
+ * ATmosphere feed item. `payload` is intentionally permissive: it carries
114
+ * a hydrated `app.bsky.embed.*#view` shape that varies by source app. The
115
+ * AppView resolves the hydration; clients render via the existing
116
+ * embed-view union (mirrors `sifa-web/src/components/stream/`).
117
+ *
118
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
119
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
120
+ * Stream are two distinct surfaces with different data paths (Barazo API
121
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
122
+ * types are no longer consumed. Scheduled for removal in next major bump.
123
+ */
124
+ declare const AtmosphereFeedItemSchema: z.ZodObject<{
125
+ id: z.ZodString;
126
+ actor: z.ZodObject<{
127
+ did: z.ZodString;
128
+ handle: z.ZodString;
129
+ displayName: z.ZodOptional<z.ZodString>;
130
+ avatarUrl: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strip>;
132
+ indexedAt: z.ZodString;
133
+ eventType: z.ZodString;
134
+ source: z.ZodLiteral<"atmosphere">;
135
+ appId: z.ZodString;
136
+ uri: z.ZodOptional<z.ZodString>;
137
+ cid: z.ZodOptional<z.ZodString>;
138
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
139
+ }, z.core.$strip>;
140
+ /**
141
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
142
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
143
+ * Stream are two distinct surfaces with different data paths (Barazo API
144
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
145
+ * types are no longer consumed. Scheduled for removal in next major bump.
146
+ */
147
+ type AtmosphereFeedItem = z.infer<typeof AtmosphereFeedItemSchema>;
148
+ /**
149
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
150
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
151
+ * Stream are two distinct surfaces with different data paths (Barazo API
152
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
153
+ * types are no longer consumed. Scheduled for removal in next major bump.
154
+ */
155
+ declare const FollowFeedItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
156
+ id: z.ZodString;
157
+ actor: z.ZodObject<{
158
+ did: z.ZodString;
159
+ handle: z.ZodString;
160
+ displayName: z.ZodOptional<z.ZodString>;
161
+ avatarUrl: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>;
163
+ indexedAt: z.ZodString;
164
+ eventType: z.ZodString;
165
+ source: z.ZodLiteral<"sifa">;
166
+ appId: z.ZodOptional<z.ZodLiteral<"sifa">>;
167
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ id: z.ZodString;
170
+ actor: z.ZodObject<{
171
+ did: z.ZodString;
172
+ handle: z.ZodString;
173
+ displayName: z.ZodOptional<z.ZodString>;
174
+ avatarUrl: z.ZodOptional<z.ZodString>;
175
+ }, z.core.$strip>;
176
+ indexedAt: z.ZodString;
177
+ eventType: z.ZodString;
178
+ source: z.ZodLiteral<"atmosphere">;
179
+ appId: z.ZodString;
180
+ uri: z.ZodOptional<z.ZodString>;
181
+ cid: z.ZodOptional<z.ZodString>;
182
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
183
+ }, z.core.$strip>], "source">;
184
+ /**
185
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
186
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
187
+ * Stream are two distinct surfaces with different data paths (Barazo API
188
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
189
+ * types are no longer consumed. Scheduled for removal in next major bump.
190
+ */
191
+ type FollowFeedItem = z.infer<typeof FollowFeedItemSchema>;
192
+ /**
193
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
194
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
195
+ * Stream are two distinct surfaces with different data paths (Barazo API
196
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
197
+ * types are no longer consumed. Scheduled for removal in next major bump.
198
+ */
199
+ declare const FollowFeedPageSchema: z.ZodObject<{
200
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
201
+ id: z.ZodString;
202
+ actor: z.ZodObject<{
203
+ did: z.ZodString;
204
+ handle: z.ZodString;
205
+ displayName: z.ZodOptional<z.ZodString>;
206
+ avatarUrl: z.ZodOptional<z.ZodString>;
207
+ }, z.core.$strip>;
208
+ indexedAt: z.ZodString;
209
+ eventType: z.ZodString;
210
+ source: z.ZodLiteral<"sifa">;
211
+ appId: z.ZodOptional<z.ZodLiteral<"sifa">>;
212
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
213
+ }, z.core.$strip>, z.ZodObject<{
214
+ id: z.ZodString;
215
+ actor: z.ZodObject<{
216
+ did: z.ZodString;
217
+ handle: z.ZodString;
218
+ displayName: z.ZodOptional<z.ZodString>;
219
+ avatarUrl: z.ZodOptional<z.ZodString>;
220
+ }, z.core.$strip>;
221
+ indexedAt: z.ZodString;
222
+ eventType: z.ZodString;
223
+ source: z.ZodLiteral<"atmosphere">;
224
+ appId: z.ZodString;
225
+ uri: z.ZodOptional<z.ZodString>;
226
+ cid: z.ZodOptional<z.ZodString>;
227
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
228
+ }, z.core.$strip>], "source">>;
229
+ cursor: z.ZodNullable<z.ZodString>;
230
+ }, z.core.$strip>;
231
+ /**
232
+ * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).
233
+ * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere
234
+ * Stream are two distinct surfaces with different data paths (Barazo API
235
+ * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed
236
+ * types are no longer consumed. Scheduled for removal in next major bump.
237
+ */
238
+ type FollowFeedPage = z.infer<typeof FollowFeedPageSchema>;
239
+ /**
240
+ * Composite feed cursor `(indexedAt DESC, source, id)`. Encoded as a
241
+ * URL-safe base64 string so it survives `URLSearchParams` round-trips
242
+ * without further encoding. Decoupling encode/decode from the API call
243
+ * lets consumers persist cursors (e.g. for "jump-back-here" UX) and
244
+ * lets us unit-test the format.
245
+ */
246
+ interface FeedCursor {
247
+ indexedAt: string;
248
+ source: 'sifa' | 'atmosphere';
249
+ id: string;
250
+ }
251
+ declare function encodeFeedCursor(cursor: FeedCursor): string;
252
+ declare function decodeFeedCursor(encoded: string): FeedCursor;
253
+
254
+ export { type AtmosphereFeedItem as A, type FollowFeedPage as F, type SifaFeedItem as S, type FollowProfileItem as a, type FeatureAllowlistEntry as b, type FeatureFlag as c, AtmosphereFeedItemSchema as d, FEATURE_FLAGS as e, FeatureAllowlistEntrySchema as f, type FeedActor as g, FeedActorSchema as h, type FeedCursor as i, type FollowFeedItem as j, FollowFeedItemSchema as k, FollowFeedPageSchema as l, type FollowProfilePage as m, FollowProfilePageSchema as n, FollowProfileSchema as o, SifaFeedItemSchema as p, decodeFeedCursor as q, encodeFeedCursor as r };
@@ -318,4 +318,4 @@ interface Profile {
318
318
  externalAccounts?: ExternalAccount[];
319
319
  }
320
320
 
321
- export type { ActiveApp as A, Endorsement as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillRef as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, EndorsementData as c, ExternalAccount as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillSuggestion as t };
321
+ export type { ActiveApp as A, ExternalAccount as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillSuggestion as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, Endorsement as c, EndorsementData as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillRef as t };
@@ -318,4 +318,4 @@ interface Profile {
318
318
  externalAccounts?: ExternalAccount[];
319
319
  }
320
320
 
321
- export type { ActiveApp as A, Endorsement as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillRef as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, EndorsementData as c, ExternalAccount as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillSuggestion as t };
321
+ export type { ActiveApp as A, ExternalAccount as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillSuggestion as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, Endorsement as c, EndorsementData as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillRef as t };
package/dist/index.cjs CHANGED
@@ -1754,8 +1754,97 @@ var EndorsementRecordSchema = zod.z.object({
1754
1754
  });
1755
1755
  var GraphFollowRecordSchema = zod.z.object({
1756
1756
  subject: didSchema,
1757
- createdAt: datetimeSchema
1757
+ createdAt: datetimeSchema,
1758
+ note: zod.z.string().refine(maxGraphemes(200), "note must be at most 200 graphemes").optional()
1759
+ });
1760
+ function makeGraphFollowRecordSchema(followerDid) {
1761
+ return GraphFollowRecordSchema.refine((record) => record.subject !== followerDid, {
1762
+ message: "Self-follow is not allowed",
1763
+ path: ["subject"]
1764
+ });
1765
+ }
1766
+ var FollowProfileSchema = zod.z.object({
1767
+ did: didSchema,
1768
+ handle: zod.z.string(),
1769
+ displayName: zod.z.string().optional(),
1770
+ headline: zod.z.string().optional(),
1771
+ avatarUrl: zod.z.string().optional(),
1772
+ source: zod.z.string(),
1773
+ claimed: zod.z.boolean(),
1774
+ followedAt: datetimeSchema,
1775
+ blueskyVerified: zod.z.boolean().optional(),
1776
+ blueskyVerifiedAt: datetimeSchema.nullable().optional()
1777
+ });
1778
+ var FollowProfilePageSchema = zod.z.object({
1779
+ items: zod.z.array(FollowProfileSchema),
1780
+ cursor: zod.z.string().nullable()
1781
+ });
1782
+ var FeatureAllowlistEntrySchema = zod.z.object({
1783
+ did: didSchema,
1784
+ addedAt: datetimeSchema,
1785
+ note: zod.z.string().nullable().optional()
1786
+ });
1787
+ var FEATURE_FLAGS = ["FEED_V5_ENABLED"];
1788
+ var FeedActorSchema = zod.z.object({
1789
+ did: didSchema,
1790
+ handle: zod.z.string(),
1791
+ displayName: zod.z.string().optional(),
1792
+ avatarUrl: zod.z.string().optional()
1793
+ });
1794
+ var FeedItemBaseSchema = zod.z.object({
1795
+ id: zod.z.string(),
1796
+ actor: FeedActorSchema,
1797
+ indexedAt: datetimeSchema,
1798
+ eventType: zod.z.string()
1799
+ });
1800
+ var SifaFeedItemSchema = FeedItemBaseSchema.extend({
1801
+ source: zod.z.literal("sifa"),
1802
+ appId: zod.z.literal("sifa").optional(),
1803
+ payload: zod.z.record(zod.z.string(), zod.z.unknown())
1758
1804
  });
1805
+ var AtmosphereFeedItemSchema = FeedItemBaseSchema.extend({
1806
+ source: zod.z.literal("atmosphere"),
1807
+ appId: zod.z.string(),
1808
+ uri: atUriSchema.optional(),
1809
+ cid: cidSchema.optional(),
1810
+ payload: zod.z.record(zod.z.string(), zod.z.unknown())
1811
+ });
1812
+ var FollowFeedItemSchema = zod.z.discriminatedUnion("source", [
1813
+ SifaFeedItemSchema,
1814
+ AtmosphereFeedItemSchema
1815
+ ]);
1816
+ var FollowFeedPageSchema = zod.z.object({
1817
+ items: zod.z.array(FollowFeedItemSchema),
1818
+ cursor: zod.z.string().nullable()
1819
+ });
1820
+ var FeedCursorSchema = zod.z.object({
1821
+ indexedAt: datetimeSchema,
1822
+ source: zod.z.union([zod.z.literal("sifa"), zod.z.literal("atmosphere")]),
1823
+ id: zod.z.string().min(1)
1824
+ });
1825
+ function toBase64Url(input) {
1826
+ const g = globalThis;
1827
+ const b64 = typeof g.btoa === "function" ? g.btoa(unescape(encodeURIComponent(input))) : g.Buffer.from(input, "utf-8").toString("base64");
1828
+ let end = b64.length;
1829
+ while (end > 0 && b64.charCodeAt(end - 1) === 61) end--;
1830
+ return b64.slice(0, end).replace(/\+/g, "-").replace(/\//g, "_");
1831
+ }
1832
+ function fromBase64Url(input) {
1833
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((input.length + 3) % 4);
1834
+ const g = globalThis;
1835
+ if (typeof g.atob === "function") {
1836
+ return decodeURIComponent(escape(g.atob(padded)));
1837
+ }
1838
+ return g.Buffer.from(padded, "base64").toString("utf-8");
1839
+ }
1840
+ function encodeFeedCursor(cursor) {
1841
+ return toBase64Url(JSON.stringify(cursor));
1842
+ }
1843
+ function decodeFeedCursor(encoded) {
1844
+ const json = fromBase64Url(encoded);
1845
+ const parsed2 = JSON.parse(json);
1846
+ return FeedCursorSchema.parse(parsed2);
1847
+ }
1759
1848
  var ProfileCertificationRecordSchema = zod.z.object({
1760
1849
  name: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3),
1761
1850
  authority: zod.z.string().refine(maxGraphemes(100)).max(1e3).optional(),
@@ -1877,11 +1966,12 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
1877
1966
  });
1878
1967
 
1879
1968
  // src/index.ts
1880
- var SIFA_SDK_VERSION = "0.9.19";
1969
+ var SIFA_SDK_VERSION = "0.9.20";
1881
1970
 
1882
1971
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
1883
1972
  exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
1884
1973
  exports.APP_URL_PATTERNS = APP_URL_PATTERNS;
1974
+ exports.AtmosphereFeedItemSchema = AtmosphereFeedItemSchema;
1885
1975
  exports.CATEGORY_LABELS = CATEGORY_LABELS;
1886
1976
  exports.CATEGORY_ORDER = CATEGORY_ORDER;
1887
1977
  exports.COLLECTION_TO_APP = COLLECTION_TO_APP;
@@ -1893,6 +1983,13 @@ exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
1893
1983
  exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
1894
1984
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
1895
1985
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
1986
+ exports.FEATURE_FLAGS = FEATURE_FLAGS;
1987
+ exports.FeatureAllowlistEntrySchema = FeatureAllowlistEntrySchema;
1988
+ exports.FeedActorSchema = FeedActorSchema;
1989
+ exports.FollowFeedItemSchema = FollowFeedItemSchema;
1990
+ exports.FollowFeedPageSchema = FollowFeedPageSchema;
1991
+ exports.FollowProfilePageSchema = FollowProfilePageSchema;
1992
+ exports.FollowProfileSchema = FollowProfileSchema;
1896
1993
  exports.GraphFollowRecordSchema = GraphFollowRecordSchema;
1897
1994
  exports.INDUSTRY_OPTIONS = INDUSTRY_OPTIONS;
1898
1995
  exports.MIN_SKILLS = MIN_SKILLS;
@@ -1914,6 +2011,7 @@ exports.ProfileVolunteeringRecordSchema = ProfileVolunteeringRecordSchema;
1914
2011
  exports.PublicationAuthorSchema = PublicationAuthorSchema;
1915
2012
  exports.SIFA_SDK_VERSION = SIFA_SDK_VERSION;
1916
2013
  exports.SKILL_CATEGORIES = SKILL_CATEGORIES;
2014
+ exports.SifaFeedItemSchema = SifaFeedItemSchema;
1917
2015
  exports.WORKPLACE_TYPE_LABELS = WORKPLACE_TYPE_LABELS;
1918
2016
  exports.WORKPLACE_TYPE_OPTIONS = WORKPLACE_TYPE_OPTIONS;
1919
2017
  exports.atUriSchema = atUriSchema;
@@ -1926,10 +2024,12 @@ exports.countFilledDimensions = countFilledDimensions;
1926
2024
  exports.countryCodeToFlag = countryCodeToFlag;
1927
2025
  exports.dateRangeExtractor = dateRangeExtractor;
1928
2026
  exports.datetimeSchema = datetimeSchema;
2027
+ exports.decodeFeedCursor = decodeFeedCursor;
1929
2028
  exports.dedupeSkills = dedupeSkills;
1930
2029
  exports.detectPdsProvider = detectPdsProvider;
1931
2030
  exports.didSchema = didSchema;
1932
2031
  exports.dimensionsFromInputs = dimensionsFromInputs;
2032
+ exports.encodeFeedCursor = encodeFeedCursor;
1933
2033
  exports.findIndustry = findIndustry;
1934
2034
  exports.formatDistanceToNow = formatDistanceToNow;
1935
2035
  exports.formatLocation = formatLocation;
@@ -1957,6 +2057,7 @@ exports.isVisibleActivityItem = isVisibleActivityItem;
1957
2057
  exports.languageTagSchema = languageTagSchema;
1958
2058
  exports.lexiconDateExtractor = lexiconDateExtractor;
1959
2059
  exports.limitCombiningMarks = limitCombiningMarks;
2060
+ exports.makeGraphFollowRecordSchema = makeGraphFollowRecordSchema;
1960
2061
  exports.maxGraphemes = maxGraphemes;
1961
2062
  exports.meetsContrastAA = meetsContrastAA;
1962
2063
  exports.parseLocationString = parseLocationString;