@singi-labs/sifa-sdk 0.9.19 → 0.9.21

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 +132 -4
  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 +121 -5
  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
@@ -43,8 +43,97 @@ var EndorsementRecordSchema = zod.z.object({
43
43
  });
44
44
  var GraphFollowRecordSchema = zod.z.object({
45
45
  subject: didSchema,
46
- createdAt: datetimeSchema
46
+ createdAt: datetimeSchema,
47
+ note: zod.z.string().refine(maxGraphemes(200), "note must be at most 200 graphemes").optional()
48
+ });
49
+ function makeGraphFollowRecordSchema(followerDid) {
50
+ return GraphFollowRecordSchema.refine((record) => record.subject !== followerDid, {
51
+ message: "Self-follow is not allowed",
52
+ path: ["subject"]
53
+ });
54
+ }
55
+ var FollowProfileSchema = zod.z.object({
56
+ did: didSchema,
57
+ handle: zod.z.string(),
58
+ displayName: zod.z.string().optional(),
59
+ headline: zod.z.string().optional(),
60
+ avatarUrl: zod.z.string().optional(),
61
+ source: zod.z.string(),
62
+ claimed: zod.z.boolean(),
63
+ followedAt: datetimeSchema,
64
+ blueskyVerified: zod.z.boolean().optional(),
65
+ blueskyVerifiedAt: datetimeSchema.nullable().optional()
66
+ });
67
+ var FollowProfilePageSchema = zod.z.object({
68
+ items: zod.z.array(FollowProfileSchema),
69
+ cursor: zod.z.string().nullable()
70
+ });
71
+ var FeatureAllowlistEntrySchema = zod.z.object({
72
+ did: didSchema,
73
+ addedAt: datetimeSchema,
74
+ note: zod.z.string().nullable().optional()
75
+ });
76
+ var FEATURE_FLAGS = ["FEED_V5_ENABLED"];
77
+ var FeedActorSchema = zod.z.object({
78
+ did: didSchema,
79
+ handle: zod.z.string(),
80
+ displayName: zod.z.string().optional(),
81
+ avatarUrl: zod.z.string().optional()
82
+ });
83
+ var FeedItemBaseSchema = zod.z.object({
84
+ id: zod.z.string(),
85
+ actor: FeedActorSchema,
86
+ indexedAt: datetimeSchema,
87
+ eventType: zod.z.string()
88
+ });
89
+ var SifaFeedItemSchema = FeedItemBaseSchema.extend({
90
+ source: zod.z.literal("sifa"),
91
+ appId: zod.z.literal("sifa").optional(),
92
+ payload: zod.z.record(zod.z.string(), zod.z.unknown())
47
93
  });
94
+ var AtmosphereFeedItemSchema = FeedItemBaseSchema.extend({
95
+ source: zod.z.literal("atmosphere"),
96
+ appId: zod.z.string(),
97
+ uri: atUriSchema.optional(),
98
+ cid: cidSchema.optional(),
99
+ payload: zod.z.record(zod.z.string(), zod.z.unknown())
100
+ });
101
+ var FollowFeedItemSchema = zod.z.discriminatedUnion("source", [
102
+ SifaFeedItemSchema,
103
+ AtmosphereFeedItemSchema
104
+ ]);
105
+ var FollowFeedPageSchema = zod.z.object({
106
+ items: zod.z.array(FollowFeedItemSchema),
107
+ cursor: zod.z.string().nullable()
108
+ });
109
+ var FeedCursorSchema = zod.z.object({
110
+ indexedAt: datetimeSchema,
111
+ source: zod.z.union([zod.z.literal("sifa"), zod.z.literal("atmosphere")]),
112
+ id: zod.z.string().min(1)
113
+ });
114
+ function toBase64Url(input) {
115
+ const g = globalThis;
116
+ const b64 = typeof g.btoa === "function" ? g.btoa(unescape(encodeURIComponent(input))) : g.Buffer.from(input, "utf-8").toString("base64");
117
+ let end = b64.length;
118
+ while (end > 0 && b64.charCodeAt(end - 1) === 61) end--;
119
+ return b64.slice(0, end).replace(/\+/g, "-").replace(/\//g, "_");
120
+ }
121
+ function fromBase64Url(input) {
122
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((input.length + 3) % 4);
123
+ const g = globalThis;
124
+ if (typeof g.atob === "function") {
125
+ return decodeURIComponent(escape(g.atob(padded)));
126
+ }
127
+ return g.Buffer.from(padded, "base64").toString("utf-8");
128
+ }
129
+ function encodeFeedCursor(cursor) {
130
+ return toBase64Url(JSON.stringify(cursor));
131
+ }
132
+ function decodeFeedCursor(encoded) {
133
+ const json = fromBase64Url(encoded);
134
+ const parsed = JSON.parse(json);
135
+ return FeedCursorSchema.parse(parsed);
136
+ }
48
137
  var ProfileCertificationRecordSchema = zod.z.object({
49
138
  name: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3),
50
139
  authority: zod.z.string().refine(maxGraphemes(100)).max(1e3).optional(),
@@ -165,8 +254,16 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
165
254
  createdAt: datetimeSchema
166
255
  });
167
256
 
257
+ exports.AtmosphereFeedItemSchema = AtmosphereFeedItemSchema;
168
258
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
169
259
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
260
+ exports.FEATURE_FLAGS = FEATURE_FLAGS;
261
+ exports.FeatureAllowlistEntrySchema = FeatureAllowlistEntrySchema;
262
+ exports.FeedActorSchema = FeedActorSchema;
263
+ exports.FollowFeedItemSchema = FollowFeedItemSchema;
264
+ exports.FollowFeedPageSchema = FollowFeedPageSchema;
265
+ exports.FollowProfilePageSchema = FollowProfilePageSchema;
266
+ exports.FollowProfileSchema = FollowProfileSchema;
170
267
  exports.GraphFollowRecordSchema = GraphFollowRecordSchema;
171
268
  exports.ProfileCertificationRecordSchema = ProfileCertificationRecordSchema;
172
269
  exports.ProfileCourseRecordSchema = ProfileCourseRecordSchema;
@@ -181,11 +278,15 @@ exports.ProfileSelfRecordSchema = ProfileSelfRecordSchema;
181
278
  exports.ProfileSkillRecordSchema = ProfileSkillRecordSchema;
182
279
  exports.ProfileVolunteeringRecordSchema = ProfileVolunteeringRecordSchema;
183
280
  exports.PublicationAuthorSchema = PublicationAuthorSchema;
281
+ exports.SifaFeedItemSchema = SifaFeedItemSchema;
184
282
  exports.atUriSchema = atUriSchema;
185
283
  exports.cidSchema = cidSchema;
186
284
  exports.datetimeSchema = datetimeSchema;
285
+ exports.decodeFeedCursor = decodeFeedCursor;
187
286
  exports.didSchema = didSchema;
287
+ exports.encodeFeedCursor = encodeFeedCursor;
188
288
  exports.languageTagSchema = languageTagSchema;
289
+ exports.makeGraphFollowRecordSchema = makeGraphFollowRecordSchema;
189
290
  exports.maxGraphemes = maxGraphemes;
190
291
  exports.selfLabelsSchema = selfLabelsSchema;
191
292
  exports.strongRefSchema = strongRefSchema;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schemas/shared.ts","../../src/schemas/endorsement-confirmation.ts","../../src/schemas/endorsement.ts","../../src/schemas/graph-follow.ts","../../src/schemas/profile-certification.ts","../../src/schemas/profile-course.ts","../../src/schemas/profile-education.ts","../../src/schemas/profile-external-account.ts","../../src/schemas/profile-honor.ts","../../src/schemas/profile-language.ts","../../src/schemas/profile-position.ts","../../src/schemas/profile-project.ts","../../src/schemas/profile-publication.ts","../../src/schemas/profile-self.ts","../../src/schemas/profile-skill.ts","../../src/schemas/profile-volunteering.ts"],"names":["z"],"mappings":";;;;;AASO,SAAS,aAAa,GAAA,EAAa;AACxC,EAAA,OAAO,CAAC,KAAA,KAA2B;AACjC,IAAA,MAAM,SAAA,GAAY,IAAI,IAAA,CAAK,SAAA,CAAU,QAAW,EAAE,WAAA,EAAa,YAAY,CAAA;AAC3E,IAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,IAAA,KAAA,MAAW,CAAA,IAAK,SAAA,CAAU,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxC,MAAA,KAAA,EAAA;AACA,MAAA,IAAI,KAAA,GAAQ,KAAK,OAAO,KAAA;AAAA,IAC1B;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AACF;AAGO,IAAM,YAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,kCAAkC,aAAa;AAGlF,IAAM,cAAA,GAAiBA,MAAE,MAAA,EAAO,CAAE,SAAS,EAAE,MAAA,EAAQ,MAAM;AAG3D,IAAM,cAAcA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,mBAAmB,gBAAgB;AAGxE,IAAM,YAAYA,KAAA,CACtB,MAAA,EAAO,CACP,KAAA,CAAM,mDAAmD,aAAa;AAGlE,IAAM,oBAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,uCAAuC,6BAA6B;AAGtE,IAAM,SAAA,GAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAM7B,IAAM,eA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e,QAAA,EAAS;AAAA,EACjC,SAAA,EAAW;AACb,CAAC","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\n/**\n * Grapheme-aware refinement matching the AT Protocol lexicon `maxGraphemes`\n * constraint. JS strings are sequences of UTF-16 code units, but lexicon\n * `maxGraphemes` counts user-perceived characters (grapheme clusters), so\n * emoji sequences, regional indicators, ZWJ joins, and combining marks all\n * count as one unit each. We use `Intl.Segmenter` to enforce this correctly.\n */\nexport function maxGraphemes(max: number) {\n return (value: string): boolean => {\n const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n let count = 0;\n for (const _ of segmenter.segment(value)) {\n count++;\n if (count > max) return false;\n }\n return true;\n };\n}\n\n/** Decentralized identifier, AT Protocol `format: did`. */\nexport const didSchema = z.string().regex(/^did:[a-z]+:[a-zA-Z0-9._:%-]+$/, 'Invalid DID');\n\n/** RFC 3339 datetime with timezone offset, AT Protocol `format: datetime`. */\nexport const datetimeSchema = z.string().datetime({ offset: true });\n\n/** Generic AT-URI, AT Protocol `format: at-uri`. */\nexport const atUriSchema = z.string().regex(/^at:\\/\\/[^\\s]+$/, 'Invalid AT-URI');\n\n/** Content identifier, AT Protocol `format: cid`. Loose validation -- accepts CIDv0 and CIDv1. */\nexport const cidSchema = z\n .string()\n .regex(/^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[A-Za-z0-9+/=]+)$/, 'Invalid CID');\n\n/** BCP 47 language tag, AT Protocol `format: language`. */\nexport const languageTagSchema = z\n .string()\n .regex(/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/, 'Invalid BCP 47 language tag');\n\n/** Generic URI, AT Protocol `format: uri`. */\nexport const uriSchema = z.string().url();\n\n/**\n * StrongRef shape from `com.atproto.repo.strongRef` -- pins a record by both\n * AT-URI (identity) and CID (version).\n */\nexport const strongRefSchema = z.object({\n uri: atUriSchema,\n cid: cidSchema,\n});\n\n/**\n * Self-labels shape from `com.atproto.label.defs#selfLabels`. Modelled\n * permissively because clients rarely construct this directly; the AppView\n * handles label validation.\n */\nexport const selfLabelsSchema = z.object({\n $type: z.literal('com.atproto.label.defs#selfLabels').optional(),\n values: z.array(z.object({ val: z.string() })),\n});\n","import { z } from 'zod';\n\nimport { datetimeSchema, strongRefSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.endorsement.confirmation` records.\n * Lives in the endorsee's PDS to approve display of an endorsement.\n */\nexport const EndorsementConfirmationRecordSchema = z.object({\n endorsement: strongRefSchema,\n createdAt: datetimeSchema,\n});\n\nexport type EndorsementConfirmationRecord = z.infer<typeof EndorsementConfirmationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, strongRefSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.endorsement` records. Lives in the endorser's PDS;\n * the endorser identity is implicit (whoever owns the repository).\n */\nexport const EndorsementRecordSchema = z.object({\n subject: didSchema,\n skill: strongRefSchema,\n skillName: z.string().min(1).refine(maxGraphemes(64)).max(640),\n comment: z.string().refine(maxGraphemes(300)).max(3000).optional(),\n createdAt: datetimeSchema,\n});\n\nexport type EndorsementRecord = z.infer<typeof EndorsementRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.graph.follow` records.\n * One-way professional follow; lives in the follower's PDS.\n */\nexport const GraphFollowRecordSchema = z.object({\n subject: didSchema,\n createdAt: datetimeSchema,\n});\n\nexport type GraphFollowRecord = z.infer<typeof GraphFollowRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, selfLabelsSchema, uriSchema } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.certification` records. */\nexport const ProfileCertificationRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n authority: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n authorityDid: didSchema.optional(),\n credentialId: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n credentialUrl: uriSchema.optional(),\n issuedAt: datetimeSchema.optional(),\n expiresAt: datetimeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileCertificationRecord = z.infer<typeof ProfileCertificationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes, strongRefSchema } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.course` records. */\nexport const ProfileCourseRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(200)).max(2000),\n number: z.string().refine(maxGraphemes(50)).max(500).optional(),\n institution: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n education: strongRefSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileCourseRecord = z.infer<typeof ProfileCourseRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, selfLabelsSchema } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.education` records. */\nexport const ProfileEducationRecordSchema = z.object({\n institution: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n institutionDid: didSchema.optional(),\n degree: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n fieldOfStudy: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n grade: z.string().refine(maxGraphemes(50)).max(500).optional(),\n activities: z.string().refine(maxGraphemes(1000)).max(10000).optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n location: z.unknown().optional(),\n startedAt: datetimeSchema.optional(),\n endedAt: datetimeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileEducationRecord = z.infer<typeof ProfileEducationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes, uriSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.externalAccount` records.\n *\n * `platform` is advisory (`knownValues` in the lexicon) -- known values live\n * under `id.sifa.defs#platform*` but unknown values are accepted.\n */\nexport const ProfileExternalAccountRecordSchema = z.object({\n platform: z.string(),\n url: uriSchema,\n label: z.string().refine(maxGraphemes(64)).max(640).optional(),\n feedUrl: uriSchema.optional(),\n isPrimary: z.boolean().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileExternalAccountRecord = z.infer<typeof ProfileExternalAccountRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.honor` records. */\nexport const ProfileHonorRecordSchema = z.object({\n title: z.string().min(1).refine(maxGraphemes(200)).max(2000),\n issuer: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n issuerDid: didSchema.optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n awardedAt: datetimeSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileHonorRecord = z.infer<typeof ProfileHonorRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.language` records.\n *\n * `proficiency` is advisory (`knownValues` in the lexicon) -- known values\n * are the five-level LinkedIn-compatible scale under `id.sifa.defs#*`.\n */\nexport const ProfileLanguageRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(64)).max(640),\n proficiency: z.string().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileLanguageRecord = z.infer<typeof ProfileLanguageRecordSchema>;\n","import { z } from 'zod';\n\nimport {\n datetimeSchema,\n didSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n} from './shared.js';\n\n/** Zod schema for `id.sifa.profile.position` records. */\nexport const ProfilePositionRecordSchema = z.object({\n company: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n companyDid: didSchema.optional(),\n title: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n employmentType: z.string().optional(),\n workplaceType: z.string().optional(),\n location: z.unknown().optional(),\n startedAt: datetimeSchema,\n endedAt: datetimeSchema.optional(),\n skills: z.array(strongRefSchema).max(50).optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfilePositionRecord = z.infer<typeof ProfilePositionRecordSchema>;\n","import { z } from 'zod';\n\nimport {\n datetimeSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n uriSchema,\n} from './shared.js';\n\n/** Zod schema for `id.sifa.profile.project` records. */\nexport const ProfileProjectRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n url: uriSchema.optional(),\n position: strongRefSchema.optional(),\n startedAt: datetimeSchema.optional(),\n endedAt: datetimeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileProjectRecord = z.infer<typeof ProfileProjectRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, uriSchema } from './shared.js';\n\n/** Author shape from `id.sifa.profile.publication#author`. */\nexport const PublicationAuthorSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n did: didSchema.optional(),\n});\n\nexport type PublicationAuthor = z.infer<typeof PublicationAuthorSchema>;\n\n/** Zod schema for `id.sifa.profile.publication` records. */\nexport const ProfilePublicationRecordSchema = z.object({\n title: z.string().min(1).refine(maxGraphemes(200)).max(2000),\n publisher: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n url: uriSchema.optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n authors: z.array(PublicationAuthorSchema).max(50).optional(),\n publishedAt: datetimeSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfilePublicationRecord = z.infer<typeof ProfilePublicationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, languageTagSchema, maxGraphemes, selfLabelsSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.self` records. Singleton (record key `self`).\n *\n * `knownValues` on `openTo` and `preferredWorkplace` are advisory per the\n * lexicon spec -- unknown values are allowed, but documented options live\n * under the `id.sifa.defs#*` namespace.\n */\nexport const ProfileSelfRecordSchema = z.object({\n headline: z.string().refine(maxGraphemes(120)).max(1200).optional(),\n about: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n industry: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n givenName: z.string().refine(maxGraphemes(64)).max(640).optional(),\n familyName: z.string().refine(maxGraphemes(64)).max(640).optional(),\n location: z.unknown().optional(),\n openTo: z.array(z.string()).max(10).optional(),\n preferredWorkplace: z.array(z.string()).max(3).optional(),\n langs: z.array(languageTagSchema).max(3).optional(),\n labels: selfLabelsSchema.optional(),\n discoverable: z.boolean().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileSelfRecord = z.infer<typeof ProfileSelfRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.skill` records.\n *\n * `category` is advisory (`knownValues` in the lexicon) -- known values live\n * under `id.sifa.defs#*` but unknown values are accepted.\n */\nexport const ProfileSkillRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(64)).max(640),\n category: z.string().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileSkillRecord = z.infer<typeof ProfileSkillRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.volunteering` records. */\nexport const ProfileVolunteeringRecordSchema = z.object({\n organization: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n organizationDid: didSchema.optional(),\n role: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n cause: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n startedAt: datetimeSchema.optional(),\n endedAt: datetimeSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileVolunteeringRecord = z.infer<typeof ProfileVolunteeringRecordSchema>;\n"]}
1
+ {"version":3,"sources":["../../src/schemas/shared.ts","../../src/schemas/endorsement-confirmation.ts","../../src/schemas/endorsement.ts","../../src/schemas/graph-follow.ts","../../src/schemas/follow-profile.ts","../../src/schemas/feed.ts","../../src/schemas/profile-certification.ts","../../src/schemas/profile-course.ts","../../src/schemas/profile-education.ts","../../src/schemas/profile-external-account.ts","../../src/schemas/profile-honor.ts","../../src/schemas/profile-language.ts","../../src/schemas/profile-position.ts","../../src/schemas/profile-project.ts","../../src/schemas/profile-publication.ts","../../src/schemas/profile-self.ts","../../src/schemas/profile-skill.ts","../../src/schemas/profile-volunteering.ts"],"names":["z"],"mappings":";;;;;AASO,SAAS,aAAa,GAAA,EAAa;AACxC,EAAA,OAAO,CAAC,KAAA,KAA2B;AACjC,IAAA,MAAM,SAAA,GAAY,IAAI,IAAA,CAAK,SAAA,CAAU,QAAW,EAAE,WAAA,EAAa,YAAY,CAAA;AAC3E,IAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,IAAA,KAAA,MAAW,CAAA,IAAK,SAAA,CAAU,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxC,MAAA,KAAA,EAAA;AACA,MAAA,IAAI,KAAA,GAAQ,KAAK,OAAO,KAAA;AAAA,IAC1B;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AACF;AAGO,IAAM,YAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,kCAAkC,aAAa;AAGlF,IAAM,cAAA,GAAiBA,MAAE,MAAA,EAAO,CAAE,SAAS,EAAE,MAAA,EAAQ,MAAM;AAG3D,IAAM,cAAcA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,mBAAmB,gBAAgB;AAGxE,IAAM,YAAYA,KAAA,CACtB,MAAA,EAAO,CACP,KAAA,CAAM,mDAAmD,aAAa;AAGlE,IAAM,oBAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,uC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GAAG,CAAA;AAAA,EACxD,QAAA,EAAUA,KAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC9B,SAAA,EAAW;AACb,CAAC;ACTM,IAAM,+BAAA,GAAkCA,MAAE,MAAA,CAAO;AAAA,EACtD,YAAA,EAAcA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,MAAA,CAAO,YAAA,CAAa,GAAG,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EAClE,eAAA,EAAiB,UAAU,QAAA,EAAS;AAAA,EACpC,IAAA,EAAMA,KAAAA,CAAE,MAAA,EAAO,CAAE,MAAA,CAAO,YAAA,CAAa,GAAG,CAAC,CAAA,CAAE,GAAA,CAAI,GAAI,CAAA,CAAE,QAAA,EAAS;AAAA,EAC9D,KAAA,EAAOA,KAAAA,CAAE,MAAA,EAAO,CAAE,MAAA,CAAO,YAAA,CAAa,GAAG,CAAC,CAAA,CAAE,GAAA,CAAI,GAAI,CAAA,CAAE,QAAA,EAAS;AAAA,EAC/D,WAAA,EAAaA,KAAAA,CAAE,MAAA,EAAO,CAAE,MAAA,CAAO,YAAA,CAAa,GAAI,CAAC,CAAA,CAAE,GAAA,CAAI,GAAK,CAAA,CAAE,QAAA,EAAS;AAAA,EACvE,SAAA,EAAW,eAAe,QAAA,EAAS;AAAA,EACnC,OAAA,EAAS,eAAe,QAAA,EAAS;AAAA,EACjC,SAAA,EAAW;AACb,CAAC","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\n/**\n * Grapheme-aware refinement matching the AT Protocol lexicon `maxGraphemes`\n * constraint. JS strings are sequences of UTF-16 code units, but lexicon\n * `maxGraphemes` counts user-perceived characters (grapheme clusters), so\n * emoji sequences, regional indicators, ZWJ joins, and combining marks all\n * count as one unit each. We use `Intl.Segmenter` to enforce this correctly.\n */\nexport function maxGraphemes(max: number) {\n return (value: string): boolean => {\n const segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n let count = 0;\n for (const _ of segmenter.segment(value)) {\n count++;\n if (count > max) return false;\n }\n return true;\n };\n}\n\n/** Decentralized identifier, AT Protocol `format: did`. */\nexport const didSchema = z.string().regex(/^did:[a-z]+:[a-zA-Z0-9._:%-]+$/, 'Invalid DID');\n\n/** RFC 3339 datetime with timezone offset, AT Protocol `format: datetime`. */\nexport const datetimeSchema = z.string().datetime({ offset: true });\n\n/** Generic AT-URI, AT Protocol `format: at-uri`. */\nexport const atUriSchema = z.string().regex(/^at:\\/\\/[^\\s]+$/, 'Invalid AT-URI');\n\n/** Content identifier, AT Protocol `format: cid`. Loose validation -- accepts CIDv0 and CIDv1. */\nexport const cidSchema = z\n .string()\n .regex(/^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[A-Za-z0-9+/=]+)$/, 'Invalid CID');\n\n/** BCP 47 language tag, AT Protocol `format: language`. */\nexport const languageTagSchema = z\n .string()\n .regex(/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/, 'Invalid BCP 47 language tag');\n\n/** Generic URI, AT Protocol `format: uri`. */\nexport const uriSchema = z.string().url();\n\n/**\n * StrongRef shape from `com.atproto.repo.strongRef` -- pins a record by both\n * AT-URI (identity) and CID (version).\n */\nexport const strongRefSchema = z.object({\n uri: atUriSchema,\n cid: cidSchema,\n});\n\n/**\n * Self-labels shape from `com.atproto.label.defs#selfLabels`. Modelled\n * permissively because clients rarely construct this directly; the AppView\n * handles label validation.\n */\nexport const selfLabelsSchema = z.object({\n $type: z.literal('com.atproto.label.defs#selfLabels').optional(),\n values: z.array(z.object({ val: z.string() })),\n});\n","import { z } from 'zod';\n\nimport { datetimeSchema, strongRefSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.endorsement.confirmation` records.\n * Lives in the endorsee's PDS to approve display of an endorsement.\n */\nexport const EndorsementConfirmationRecordSchema = z.object({\n endorsement: strongRefSchema,\n createdAt: datetimeSchema,\n});\n\nexport type EndorsementConfirmationRecord = z.infer<typeof EndorsementConfirmationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, strongRefSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.endorsement` records. Lives in the endorser's PDS;\n * the endorser identity is implicit (whoever owns the repository).\n */\nexport const EndorsementRecordSchema = z.object({\n subject: didSchema,\n skill: strongRefSchema,\n skillName: z.string().min(1).refine(maxGraphemes(64)).max(640),\n comment: z.string().refine(maxGraphemes(300)).max(3000).optional(),\n createdAt: datetimeSchema,\n});\n\nexport type EndorsementRecord = z.infer<typeof EndorsementRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.graph.follow` records.\n *\n * One-way professional follow; the record lives in the follower's PDS. Per\n * iter-1 decisions (`plans/2026-06-01-in-sifa-follow-primitive.md`), this is\n * a **distinct** graph from `app.bsky.graph.follow`, not a superset — but\n * the required field shape (`subject` + `createdAt`) is intentionally\n * identical so generic Bluesky `listRecords` consumers get usable records.\n *\n * `note` is a Sifa addition: an optional reason for the follow (\"why I\n * followed\"). Capped at 200 graphemes to match other profile-flavored\n * lexicon fields.\n */\nexport const GraphFollowRecordSchema = z.object({\n subject: didSchema,\n createdAt: datetimeSchema,\n note: z.string().refine(maxGraphemes(200), 'note must be at most 200 graphemes').optional(),\n});\n\nexport type GraphFollowRecord = z.infer<typeof GraphFollowRecordSchema>;\n\n/**\n * Build a `GraphFollowRecordSchema` that rejects self-follow at the Zod\n * layer (CLAUDE.md mandatory standards #3 — input validation; sifa-api#673\n * E8 — defence in depth).\n *\n * Use this on the **client side** when constructing a new follow record\n * (the follower DID is the authenticated user). The plain\n * {@link GraphFollowRecordSchema} stays without the refine so firehose\n * consumers can validate records without context.\n */\nexport function makeGraphFollowRecordSchema(followerDid: string) {\n return GraphFollowRecordSchema.refine((record) => record.subject !== followerDid, {\n message: 'Self-follow is not allowed',\n path: ['subject'],\n });\n}\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema } from './shared.js';\n\n/**\n * Profile row shared across `/api/following`, `/api/profile/:handleOrDid/mutuals`,\n * and `/api/me/bluesky-suggestions`. Matches the existing `FollowProfile` TS\n * interface byte-for-byte but adds runtime validation for the SDK's pagination\n * helpers and the upcoming `sifa-app` consumer (where we can't trust the wire).\n *\n * Per `sifa-api#674` PR body: mutuals + bluesky-suggestions reuse this shape\n * exactly, so a single Zod schema covers all three endpoints.\n */\nexport const FollowProfileSchema = z.object({\n did: didSchema,\n handle: z.string(),\n displayName: z.string().optional(),\n headline: z.string().optional(),\n avatarUrl: z.string().optional(),\n source: z.string(),\n claimed: z.boolean(),\n followedAt: datetimeSchema,\n blueskyVerified: z.boolean().optional(),\n blueskyVerifiedAt: datetimeSchema.nullable().optional(),\n});\n\nexport type FollowProfileItem = z.infer<typeof FollowProfileSchema>;\n\n/**\n * Cursor-paginated page of {@link FollowProfileSchema} rows. Used by mutuals\n * + bluesky-suggestions. The legacy `/api/following` endpoint uses a different\n * wrapper key (`follows` instead of `items`) and is intentionally NOT covered\n * by this schema.\n */\nexport const FollowProfilePageSchema = z.object({\n items: z.array(FollowProfileSchema),\n cursor: z.string().nullable(),\n});\n\nexport type FollowProfilePage = z.infer<typeof FollowProfilePageSchema>;\n\n/**\n * Per-flag allowlist row returned by `GET /api/admin/feature-allowlists/:flag`.\n * Mirrors the `feature_allowlists` table; `note` is optional free-form text.\n */\nexport const FeatureAllowlistEntrySchema = z.object({\n did: didSchema,\n addedAt: datetimeSchema,\n note: z.string().nullable().optional(),\n});\n\nexport type FeatureAllowlistEntry = z.infer<typeof FeatureAllowlistEntrySchema>;\n\n/**\n * Known feature flags accepted by the admin allowlist endpoints. Mirrors the\n * server-side `FEATURE_FLAGS` const in `sifa-api`. Kept as a `const` tuple so\n * consumers can `as const`-narrow when building UIs.\n */\nexport const FEATURE_FLAGS = ['FEED_V5_ENABLED'] as const;\nexport type FeatureFlag = (typeof FEATURE_FLAGS)[number];\n","import { z } from 'zod';\n\nimport { atUriSchema, cidSchema, datetimeSchema, didSchema } from './shared.js';\n\n/**\n * Feed item from `GET /api/following/feed`. Discriminated on `source`:\n *\n * - `sifa`: a Sifa-native event (e.g. profile update, endorsement).\n * - `atmosphere`: a curated creation event from another ATproto app\n * (Barazo post, etc.). Payload is the hydrated `app.bsky.embed.*#view`\n * shape, NOT the raw record (per memory `sifa-hydrated-view-embed-types`).\n *\n * Both variants share `actor`, `indexedAt`, and `id` (the materialized\n * `feed_events.id` row identifier, used in the cursor).\n */\nexport const FeedActorSchema = z.object({\n did: didSchema,\n handle: z.string(),\n displayName: z.string().optional(),\n avatarUrl: z.string().optional(),\n});\n\nexport type FeedActor = z.infer<typeof FeedActorSchema>;\n\nconst FeedItemBaseSchema = z.object({\n id: z.string(),\n actor: FeedActorSchema,\n indexedAt: datetimeSchema,\n eventType: z.string(),\n});\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport const SifaFeedItemSchema = FeedItemBaseSchema.extend({\n source: z.literal('sifa'),\n appId: z.literal('sifa').optional(),\n payload: z.record(z.string(), z.unknown()),\n});\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport type SifaFeedItem = z.infer<typeof SifaFeedItemSchema>;\n\n/**\n * ATmosphere feed item. `payload` is intentionally permissive: it carries\n * a hydrated `app.bsky.embed.*#view` shape that varies by source app. The\n * AppView resolves the hydration; clients render via the existing\n * embed-view union (mirrors `sifa-web/src/components/stream/`).\n *\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport const AtmosphereFeedItemSchema = FeedItemBaseSchema.extend({\n source: z.literal('atmosphere'),\n appId: z.string(),\n uri: atUriSchema.optional(),\n cid: cidSchema.optional(),\n payload: z.record(z.string(), z.unknown()),\n});\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport type AtmosphereFeedItem = z.infer<typeof AtmosphereFeedItemSchema>;\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport const FollowFeedItemSchema = z.discriminatedUnion('source', [\n SifaFeedItemSchema,\n AtmosphereFeedItemSchema,\n]);\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport type FollowFeedItem = z.infer<typeof FollowFeedItemSchema>;\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport const FollowFeedPageSchema = z.object({\n items: z.array(FollowFeedItemSchema),\n cursor: z.string().nullable(),\n});\n\n/**\n * @deprecated The `/api/following/feed` surface was reverted (sifa-api#674).\n * Per `decisions/activity-data-strategy.md` the Sifa Timeline + ATmosphere\n * Stream are two distinct surfaces with different data paths (Barazo API\n * for Timeline, live PDS reads + Valkey for Stream). These collapsed feed\n * types are no longer consumed. Scheduled for removal in next major bump.\n */\nexport type FollowFeedPage = z.infer<typeof FollowFeedPageSchema>;\n\n/**\n * Composite feed cursor `(indexedAt DESC, source, id)`. Encoded as a\n * URL-safe base64 string so it survives `URLSearchParams` round-trips\n * without further encoding. Decoupling encode/decode from the API call\n * lets consumers persist cursors (e.g. for \"jump-back-here\" UX) and\n * lets us unit-test the format.\n */\nexport interface FeedCursor {\n indexedAt: string;\n source: 'sifa' | 'atmosphere';\n id: string;\n}\n\nconst FeedCursorSchema = z.object({\n indexedAt: datetimeSchema,\n source: z.union([z.literal('sifa'), z.literal('atmosphere')]),\n id: z.string().min(1),\n});\n\ninterface BufferLike {\n from: (input: string, encoding: 'utf-8' | 'base64') => { toString: (encoding: string) => string };\n}\n\ninterface Base64Global {\n btoa?: (input: string) => string;\n atob?: (input: string) => string;\n Buffer?: BufferLike;\n}\n\nfunction toBase64Url(input: string): string {\n const g = globalThis as unknown as Base64Global;\n const b64: string =\n typeof g.btoa === 'function'\n ? g.btoa(unescape(encodeURIComponent(input)))\n : (g.Buffer as BufferLike).from(input, 'utf-8').toString('base64');\n // Strip up to 2 trailing '=' (base64 padding). CodeQL flags `/=+$/` as a\n // polynomial regex on tainted input; we don't accept tainted input here,\n // but the deterministic loop sidesteps the alert.\n let end = b64.length;\n while (end > 0 && b64.charCodeAt(end - 1) === 61) end--;\n return b64.slice(0, end).replace(/\\+/g, '-').replace(/\\//g, '_');\n}\n\nfunction fromBase64Url(input: string): string {\n const padded = input.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((input.length + 3) % 4);\n const g = globalThis as unknown as Base64Global;\n if (typeof g.atob === 'function') {\n return decodeURIComponent(escape(g.atob(padded)));\n }\n return (g.Buffer as BufferLike).from(padded, 'base64').toString('utf-8');\n}\n\nexport function encodeFeedCursor(cursor: FeedCursor): string {\n return toBase64Url(JSON.stringify(cursor));\n}\n\nexport function decodeFeedCursor(encoded: string): FeedCursor {\n const json = fromBase64Url(encoded);\n const parsed: unknown = JSON.parse(json);\n return FeedCursorSchema.parse(parsed);\n}\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, selfLabelsSchema, uriSchema } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.certification` records. */\nexport const ProfileCertificationRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n authority: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n authorityDid: didSchema.optional(),\n credentialId: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n credentialUrl: uriSchema.optional(),\n issuedAt: datetimeSchema.optional(),\n expiresAt: datetimeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileCertificationRecord = z.infer<typeof ProfileCertificationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes, strongRefSchema } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.course` records. */\nexport const ProfileCourseRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(200)).max(2000),\n number: z.string().refine(maxGraphemes(50)).max(500).optional(),\n institution: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n education: strongRefSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileCourseRecord = z.infer<typeof ProfileCourseRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, selfLabelsSchema } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.education` records. */\nexport const ProfileEducationRecordSchema = z.object({\n institution: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n institutionDid: didSchema.optional(),\n degree: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n fieldOfStudy: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n grade: z.string().refine(maxGraphemes(50)).max(500).optional(),\n activities: z.string().refine(maxGraphemes(1000)).max(10000).optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n location: z.unknown().optional(),\n startedAt: datetimeSchema.optional(),\n endedAt: datetimeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileEducationRecord = z.infer<typeof ProfileEducationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes, uriSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.externalAccount` records.\n *\n * `platform` is advisory (`knownValues` in the lexicon) -- known values live\n * under `id.sifa.defs#platform*` but unknown values are accepted.\n */\nexport const ProfileExternalAccountRecordSchema = z.object({\n platform: z.string(),\n url: uriSchema,\n label: z.string().refine(maxGraphemes(64)).max(640).optional(),\n feedUrl: uriSchema.optional(),\n isPrimary: z.boolean().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileExternalAccountRecord = z.infer<typeof ProfileExternalAccountRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.honor` records. */\nexport const ProfileHonorRecordSchema = z.object({\n title: z.string().min(1).refine(maxGraphemes(200)).max(2000),\n issuer: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n issuerDid: didSchema.optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n awardedAt: datetimeSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileHonorRecord = z.infer<typeof ProfileHonorRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.language` records.\n *\n * `proficiency` is advisory (`knownValues` in the lexicon) -- known values\n * are the five-level LinkedIn-compatible scale under `id.sifa.defs#*`.\n */\nexport const ProfileLanguageRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(64)).max(640),\n proficiency: z.string().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileLanguageRecord = z.infer<typeof ProfileLanguageRecordSchema>;\n","import { z } from 'zod';\n\nimport {\n datetimeSchema,\n didSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n} from './shared.js';\n\n/** Zod schema for `id.sifa.profile.position` records. */\nexport const ProfilePositionRecordSchema = z.object({\n company: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n companyDid: didSchema.optional(),\n title: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n employmentType: z.string().optional(),\n workplaceType: z.string().optional(),\n location: z.unknown().optional(),\n startedAt: datetimeSchema,\n endedAt: datetimeSchema.optional(),\n skills: z.array(strongRefSchema).max(50).optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfilePositionRecord = z.infer<typeof ProfilePositionRecordSchema>;\n","import { z } from 'zod';\n\nimport {\n datetimeSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n uriSchema,\n} from './shared.js';\n\n/** Zod schema for `id.sifa.profile.project` records. */\nexport const ProfileProjectRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n url: uriSchema.optional(),\n position: strongRefSchema.optional(),\n startedAt: datetimeSchema.optional(),\n endedAt: datetimeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileProjectRecord = z.infer<typeof ProfileProjectRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes, uriSchema } from './shared.js';\n\n/** Author shape from `id.sifa.profile.publication#author`. */\nexport const PublicationAuthorSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n did: didSchema.optional(),\n});\n\nexport type PublicationAuthor = z.infer<typeof PublicationAuthorSchema>;\n\n/** Zod schema for `id.sifa.profile.publication` records. */\nexport const ProfilePublicationRecordSchema = z.object({\n title: z.string().min(1).refine(maxGraphemes(200)).max(2000),\n publisher: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n url: uriSchema.optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n authors: z.array(PublicationAuthorSchema).max(50).optional(),\n publishedAt: datetimeSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfilePublicationRecord = z.infer<typeof ProfilePublicationRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, languageTagSchema, maxGraphemes, selfLabelsSchema } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.self` records. Singleton (record key `self`).\n *\n * `knownValues` on `openTo` and `preferredWorkplace` are advisory per the\n * lexicon spec -- unknown values are allowed, but documented options live\n * under the `id.sifa.defs#*` namespace.\n */\nexport const ProfileSelfRecordSchema = z.object({\n headline: z.string().refine(maxGraphemes(120)).max(1200).optional(),\n about: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n industry: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n givenName: z.string().refine(maxGraphemes(64)).max(640).optional(),\n familyName: z.string().refine(maxGraphemes(64)).max(640).optional(),\n location: z.unknown().optional(),\n openTo: z.array(z.string()).max(10).optional(),\n preferredWorkplace: z.array(z.string()).max(3).optional(),\n langs: z.array(languageTagSchema).max(3).optional(),\n labels: selfLabelsSchema.optional(),\n discoverable: z.boolean().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileSelfRecord = z.infer<typeof ProfileSelfRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, maxGraphemes } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.skill` records.\n *\n * `category` is advisory (`knownValues` in the lexicon) -- known values live\n * under `id.sifa.defs#*` but unknown values are accepted.\n */\nexport const ProfileSkillRecordSchema = z.object({\n name: z.string().min(1).refine(maxGraphemes(64)).max(640),\n category: z.string().optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileSkillRecord = z.infer<typeof ProfileSkillRecordSchema>;\n","import { z } from 'zod';\n\nimport { datetimeSchema, didSchema, maxGraphemes } from './shared.js';\n\n/** Zod schema for `id.sifa.profile.volunteering` records. */\nexport const ProfileVolunteeringRecordSchema = z.object({\n organization: z.string().min(1).refine(maxGraphemes(100)).max(1000),\n organizationDid: didSchema.optional(),\n role: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n cause: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n startedAt: datetimeSchema.optional(),\n endedAt: datetimeSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfileVolunteeringRecord = z.infer<typeof ProfileVolunteeringRecordSchema>;\n"]}
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export { A as AtmosphereFeedItem, d as AtmosphereFeedItemSchema, e as FEATURE_FLAGS, b as FeatureAllowlistEntry, f as FeatureAllowlistEntrySchema, c as FeatureFlag, g as FeedActor, h as FeedActorSchema, i as FeedCursor, j as FollowFeedItem, k as FollowFeedItemSchema, F as FollowFeedPage, l as FollowFeedPageSchema, a as FollowProfileItem, m as FollowProfilePage, n as FollowProfilePageSchema, o as FollowProfileSchema, S as SifaFeedItem, p as SifaFeedItemSchema, q as decodeFeedCursor, r as encodeFeedCursor } from '../feed-DHTy7fUN.cjs';
2
3
 
3
4
  /**
4
5
  * Zod schema for `id.sifa.endorsement.confirmation` records.
@@ -31,13 +32,38 @@ type EndorsementRecord = z.infer<typeof EndorsementRecordSchema>;
31
32
 
32
33
  /**
33
34
  * Zod schema for `id.sifa.graph.follow` records.
34
- * One-way professional follow; lives in the follower's PDS.
35
+ *
36
+ * One-way professional follow; the record lives in the follower's PDS. Per
37
+ * iter-1 decisions (`plans/2026-06-01-in-sifa-follow-primitive.md`), this is
38
+ * a **distinct** graph from `app.bsky.graph.follow`, not a superset — but
39
+ * the required field shape (`subject` + `createdAt`) is intentionally
40
+ * identical so generic Bluesky `listRecords` consumers get usable records.
41
+ *
42
+ * `note` is a Sifa addition: an optional reason for the follow ("why I
43
+ * followed"). Capped at 200 graphemes to match other profile-flavored
44
+ * lexicon fields.
35
45
  */
36
46
  declare const GraphFollowRecordSchema: z.ZodObject<{
37
47
  subject: z.ZodString;
38
48
  createdAt: z.ZodString;
49
+ note: z.ZodOptional<z.ZodString>;
39
50
  }, z.core.$strip>;
40
51
  type GraphFollowRecord = z.infer<typeof GraphFollowRecordSchema>;
52
+ /**
53
+ * Build a `GraphFollowRecordSchema` that rejects self-follow at the Zod
54
+ * layer (CLAUDE.md mandatory standards #3 — input validation; sifa-api#673
55
+ * E8 — defence in depth).
56
+ *
57
+ * Use this on the **client side** when constructing a new follow record
58
+ * (the follower DID is the authenticated user). The plain
59
+ * {@link GraphFollowRecordSchema} stays without the refine so firehose
60
+ * consumers can validate records without context.
61
+ */
62
+ declare function makeGraphFollowRecordSchema(followerDid: string): z.ZodObject<{
63
+ subject: z.ZodString;
64
+ createdAt: z.ZodString;
65
+ note: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
41
67
 
42
68
  /** Zod schema for `id.sifa.profile.certification` records. */
43
69
  declare const ProfileCertificationRecordSchema: z.ZodObject<{
@@ -294,4 +320,4 @@ declare const selfLabelsSchema: z.ZodObject<{
294
320
  }, z.core.$strip>>;
295
321
  }, z.core.$strip>;
296
322
 
297
- export { type EndorsementConfirmationRecord, EndorsementConfirmationRecordSchema, type EndorsementRecord, EndorsementRecordSchema, type GraphFollowRecord, GraphFollowRecordSchema, type ProfileCertificationRecord, ProfileCertificationRecordSchema, type ProfileCourseRecord, ProfileCourseRecordSchema, type ProfileEducationRecord, ProfileEducationRecordSchema, type ProfileExternalAccountRecord, ProfileExternalAccountRecordSchema, type ProfileHonorRecord, ProfileHonorRecordSchema, type ProfileLanguageRecord, ProfileLanguageRecordSchema, type ProfilePositionRecord, ProfilePositionRecordSchema, type ProfileProjectRecord, ProfileProjectRecordSchema, type ProfilePublicationRecord, ProfilePublicationRecordSchema, type ProfileSelfRecord, ProfileSelfRecordSchema, type ProfileSkillRecord, ProfileSkillRecordSchema, type ProfileVolunteeringRecord, ProfileVolunteeringRecordSchema, type PublicationAuthor, PublicationAuthorSchema, atUriSchema, cidSchema, datetimeSchema, didSchema, languageTagSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema };
323
+ export { type EndorsementConfirmationRecord, EndorsementConfirmationRecordSchema, type EndorsementRecord, EndorsementRecordSchema, type GraphFollowRecord, GraphFollowRecordSchema, type ProfileCertificationRecord, ProfileCertificationRecordSchema, type ProfileCourseRecord, ProfileCourseRecordSchema, type ProfileEducationRecord, ProfileEducationRecordSchema, type ProfileExternalAccountRecord, ProfileExternalAccountRecordSchema, type ProfileHonorRecord, ProfileHonorRecordSchema, type ProfileLanguageRecord, ProfileLanguageRecordSchema, type ProfilePositionRecord, ProfilePositionRecordSchema, type ProfileProjectRecord, ProfileProjectRecordSchema, type ProfilePublicationRecord, ProfilePublicationRecordSchema, type ProfileSelfRecord, ProfileSelfRecordSchema, type ProfileSkillRecord, ProfileSkillRecordSchema, type ProfileVolunteeringRecord, ProfileVolunteeringRecordSchema, type PublicationAuthor, PublicationAuthorSchema, atUriSchema, cidSchema, datetimeSchema, didSchema, languageTagSchema, makeGraphFollowRecordSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema };
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export { A as AtmosphereFeedItem, d as AtmosphereFeedItemSchema, e as FEATURE_FLAGS, b as FeatureAllowlistEntry, f as FeatureAllowlistEntrySchema, c as FeatureFlag, g as FeedActor, h as FeedActorSchema, i as FeedCursor, j as FollowFeedItem, k as FollowFeedItemSchema, F as FollowFeedPage, l as FollowFeedPageSchema, a as FollowProfileItem, m as FollowProfilePage, n as FollowProfilePageSchema, o as FollowProfileSchema, S as SifaFeedItem, p as SifaFeedItemSchema, q as decodeFeedCursor, r as encodeFeedCursor } from '../feed-DHTy7fUN.js';
2
3
 
3
4
  /**
4
5
  * Zod schema for `id.sifa.endorsement.confirmation` records.
@@ -31,13 +32,38 @@ type EndorsementRecord = z.infer<typeof EndorsementRecordSchema>;
31
32
 
32
33
  /**
33
34
  * Zod schema for `id.sifa.graph.follow` records.
34
- * One-way professional follow; lives in the follower's PDS.
35
+ *
36
+ * One-way professional follow; the record lives in the follower's PDS. Per
37
+ * iter-1 decisions (`plans/2026-06-01-in-sifa-follow-primitive.md`), this is
38
+ * a **distinct** graph from `app.bsky.graph.follow`, not a superset — but
39
+ * the required field shape (`subject` + `createdAt`) is intentionally
40
+ * identical so generic Bluesky `listRecords` consumers get usable records.
41
+ *
42
+ * `note` is a Sifa addition: an optional reason for the follow ("why I
43
+ * followed"). Capped at 200 graphemes to match other profile-flavored
44
+ * lexicon fields.
35
45
  */
36
46
  declare const GraphFollowRecordSchema: z.ZodObject<{
37
47
  subject: z.ZodString;
38
48
  createdAt: z.ZodString;
49
+ note: z.ZodOptional<z.ZodString>;
39
50
  }, z.core.$strip>;
40
51
  type GraphFollowRecord = z.infer<typeof GraphFollowRecordSchema>;
52
+ /**
53
+ * Build a `GraphFollowRecordSchema` that rejects self-follow at the Zod
54
+ * layer (CLAUDE.md mandatory standards #3 — input validation; sifa-api#673
55
+ * E8 — defence in depth).
56
+ *
57
+ * Use this on the **client side** when constructing a new follow record
58
+ * (the follower DID is the authenticated user). The plain
59
+ * {@link GraphFollowRecordSchema} stays without the refine so firehose
60
+ * consumers can validate records without context.
61
+ */
62
+ declare function makeGraphFollowRecordSchema(followerDid: string): z.ZodObject<{
63
+ subject: z.ZodString;
64
+ createdAt: z.ZodString;
65
+ note: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
41
67
 
42
68
  /** Zod schema for `id.sifa.profile.certification` records. */
43
69
  declare const ProfileCertificationRecordSchema: z.ZodObject<{
@@ -294,4 +320,4 @@ declare const selfLabelsSchema: z.ZodObject<{
294
320
  }, z.core.$strip>>;
295
321
  }, z.core.$strip>;
296
322
 
297
- export { type EndorsementConfirmationRecord, EndorsementConfirmationRecordSchema, type EndorsementRecord, EndorsementRecordSchema, type GraphFollowRecord, GraphFollowRecordSchema, type ProfileCertificationRecord, ProfileCertificationRecordSchema, type ProfileCourseRecord, ProfileCourseRecordSchema, type ProfileEducationRecord, ProfileEducationRecordSchema, type ProfileExternalAccountRecord, ProfileExternalAccountRecordSchema, type ProfileHonorRecord, ProfileHonorRecordSchema, type ProfileLanguageRecord, ProfileLanguageRecordSchema, type ProfilePositionRecord, ProfilePositionRecordSchema, type ProfileProjectRecord, ProfileProjectRecordSchema, type ProfilePublicationRecord, ProfilePublicationRecordSchema, type ProfileSelfRecord, ProfileSelfRecordSchema, type ProfileSkillRecord, ProfileSkillRecordSchema, type ProfileVolunteeringRecord, ProfileVolunteeringRecordSchema, type PublicationAuthor, PublicationAuthorSchema, atUriSchema, cidSchema, datetimeSchema, didSchema, languageTagSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema };
323
+ export { type EndorsementConfirmationRecord, EndorsementConfirmationRecordSchema, type EndorsementRecord, EndorsementRecordSchema, type GraphFollowRecord, GraphFollowRecordSchema, type ProfileCertificationRecord, ProfileCertificationRecordSchema, type ProfileCourseRecord, ProfileCourseRecordSchema, type ProfileEducationRecord, ProfileEducationRecordSchema, type ProfileExternalAccountRecord, ProfileExternalAccountRecordSchema, type ProfileHonorRecord, ProfileHonorRecordSchema, type ProfileLanguageRecord, ProfileLanguageRecordSchema, type ProfilePositionRecord, ProfilePositionRecordSchema, type ProfileProjectRecord, ProfileProjectRecordSchema, type ProfilePublicationRecord, ProfilePublicationRecordSchema, type ProfileSelfRecord, ProfileSelfRecordSchema, type ProfileSkillRecord, ProfileSkillRecordSchema, type ProfileVolunteeringRecord, ProfileVolunteeringRecordSchema, type PublicationAuthor, PublicationAuthorSchema, atUriSchema, cidSchema, datetimeSchema, didSchema, languageTagSchema, makeGraphFollowRecordSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema };
@@ -41,8 +41,97 @@ var EndorsementRecordSchema = z.object({
41
41
  });
42
42
  var GraphFollowRecordSchema = z.object({
43
43
  subject: didSchema,
44
- createdAt: datetimeSchema
44
+ createdAt: datetimeSchema,
45
+ note: z.string().refine(maxGraphemes(200), "note must be at most 200 graphemes").optional()
46
+ });
47
+ function makeGraphFollowRecordSchema(followerDid) {
48
+ return GraphFollowRecordSchema.refine((record) => record.subject !== followerDid, {
49
+ message: "Self-follow is not allowed",
50
+ path: ["subject"]
51
+ });
52
+ }
53
+ var FollowProfileSchema = z.object({
54
+ did: didSchema,
55
+ handle: z.string(),
56
+ displayName: z.string().optional(),
57
+ headline: z.string().optional(),
58
+ avatarUrl: z.string().optional(),
59
+ source: z.string(),
60
+ claimed: z.boolean(),
61
+ followedAt: datetimeSchema,
62
+ blueskyVerified: z.boolean().optional(),
63
+ blueskyVerifiedAt: datetimeSchema.nullable().optional()
64
+ });
65
+ var FollowProfilePageSchema = z.object({
66
+ items: z.array(FollowProfileSchema),
67
+ cursor: z.string().nullable()
68
+ });
69
+ var FeatureAllowlistEntrySchema = z.object({
70
+ did: didSchema,
71
+ addedAt: datetimeSchema,
72
+ note: z.string().nullable().optional()
73
+ });
74
+ var FEATURE_FLAGS = ["FEED_V5_ENABLED"];
75
+ var FeedActorSchema = z.object({
76
+ did: didSchema,
77
+ handle: z.string(),
78
+ displayName: z.string().optional(),
79
+ avatarUrl: z.string().optional()
80
+ });
81
+ var FeedItemBaseSchema = z.object({
82
+ id: z.string(),
83
+ actor: FeedActorSchema,
84
+ indexedAt: datetimeSchema,
85
+ eventType: z.string()
86
+ });
87
+ var SifaFeedItemSchema = FeedItemBaseSchema.extend({
88
+ source: z.literal("sifa"),
89
+ appId: z.literal("sifa").optional(),
90
+ payload: z.record(z.string(), z.unknown())
45
91
  });
92
+ var AtmosphereFeedItemSchema = FeedItemBaseSchema.extend({
93
+ source: z.literal("atmosphere"),
94
+ appId: z.string(),
95
+ uri: atUriSchema.optional(),
96
+ cid: cidSchema.optional(),
97
+ payload: z.record(z.string(), z.unknown())
98
+ });
99
+ var FollowFeedItemSchema = z.discriminatedUnion("source", [
100
+ SifaFeedItemSchema,
101
+ AtmosphereFeedItemSchema
102
+ ]);
103
+ var FollowFeedPageSchema = z.object({
104
+ items: z.array(FollowFeedItemSchema),
105
+ cursor: z.string().nullable()
106
+ });
107
+ var FeedCursorSchema = z.object({
108
+ indexedAt: datetimeSchema,
109
+ source: z.union([z.literal("sifa"), z.literal("atmosphere")]),
110
+ id: z.string().min(1)
111
+ });
112
+ function toBase64Url(input) {
113
+ const g = globalThis;
114
+ const b64 = typeof g.btoa === "function" ? g.btoa(unescape(encodeURIComponent(input))) : g.Buffer.from(input, "utf-8").toString("base64");
115
+ let end = b64.length;
116
+ while (end > 0 && b64.charCodeAt(end - 1) === 61) end--;
117
+ return b64.slice(0, end).replace(/\+/g, "-").replace(/\//g, "_");
118
+ }
119
+ function fromBase64Url(input) {
120
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((input.length + 3) % 4);
121
+ const g = globalThis;
122
+ if (typeof g.atob === "function") {
123
+ return decodeURIComponent(escape(g.atob(padded)));
124
+ }
125
+ return g.Buffer.from(padded, "base64").toString("utf-8");
126
+ }
127
+ function encodeFeedCursor(cursor) {
128
+ return toBase64Url(JSON.stringify(cursor));
129
+ }
130
+ function decodeFeedCursor(encoded) {
131
+ const json = fromBase64Url(encoded);
132
+ const parsed = JSON.parse(json);
133
+ return FeedCursorSchema.parse(parsed);
134
+ }
46
135
  var ProfileCertificationRecordSchema = z.object({
47
136
  name: z.string().min(1).refine(maxGraphemes(100)).max(1e3),
48
137
  authority: z.string().refine(maxGraphemes(100)).max(1e3).optional(),
@@ -163,6 +252,6 @@ var ProfileVolunteeringRecordSchema = z.object({
163
252
  createdAt: datetimeSchema
164
253
  });
165
254
 
166
- export { EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, atUriSchema, cidSchema, datetimeSchema, didSchema, languageTagSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema };
255
+ export { AtmosphereFeedItemSchema, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SifaFeedItemSchema, atUriSchema, cidSchema, datetimeSchema, decodeFeedCursor, didSchema, encodeFeedCursor, languageTagSchema, makeGraphFollowRecordSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema };
167
256
  //# sourceMappingURL=index.js.map
168
257
  //# sourceMappingURL=index.js.map