@singi-labs/sifa-sdk 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +117 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +103 -2
- package/dist/index.js.map +1 -1
- package/dist/publishing/index.cjs +4 -0
- package/dist/publishing/index.cjs.map +1 -1
- package/dist/publishing/index.js +4 -0
- package/dist/publishing/index.js.map +1 -1
- package/dist/schemas/index.cjs +49 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +86 -1
- package/dist/schemas/index.d.ts +86 -1
- package/dist/schemas/index.js +45 -1
- package/dist/schemas/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,10 @@ var strongRefSchema = zod.z.object({
|
|
|
24
24
|
uri: atUriSchema,
|
|
25
25
|
cid: cidSchema
|
|
26
26
|
});
|
|
27
|
+
zod.z.object({
|
|
28
|
+
uri: atUriSchema,
|
|
29
|
+
cid: cidSchema.optional()
|
|
30
|
+
});
|
|
27
31
|
var selfLabelsSchema = zod.z.object({
|
|
28
32
|
$type: zod.z.literal("com.atproto.label.defs#selfLabels").optional(),
|
|
29
33
|
values: zod.z.array(zod.z.object({ val: zod.z.string() }))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schemas/shared.ts","../../src/publishing/schemas.ts","../../src/publishing/registry.ts","../../src/publishing/types.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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,IAAA;AAAA,EACT;AACF;AAOO,SAAS,qBAAqB,IAAA,EAAmD;AACtF,EAAA,IAAI,CAAC,MAAM,OAAO,IAAA;AAClB,EAAA,MAAM,KAAA,GAAQ,KAAK,WAAA,EAAY;AAC/B,EAAA,OAAO,wBAAA,CAAyB,KAAK,CAAC,CAAA,KAAM,YAAY,KAAA,EAAO,CAAA,CAAE,IAAI,CAAC,CAAA,IAAK,IAAA;AAC7E;AAMO,SAAS,oBAAoB,GAAA,EAAkD;AACpF,EAAA,OAAO,oBAAA,CAAqB,WAAA,CAAY,GAAG,CAAC,CAAA;AAC9C;;;AC9BO,IAAM,8BAAA,GAAiC;AACvC,IAAM,2BAAA,GAA8B;AACpC,IAAM,+BAAA,GAAkC;AACxC,IAAM,4BAAA,GAA+B;AAQrC,IAAM,8BAAA,GAAiC;AAE9C,IAAM,cAAA,uBAAqB,GAAA,CAAY;AAAA,EACrC,8BAAA;AAAA,EACA,2BAAA;AAAA,EACA,+BAAA;AAAA,EACA;AACF,CAAC,CAAA;AAOM,SAAS,oBAAoB,GAAA,EAAsB;AACxD,EAAA,IAAI,CAAC,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AACrC,EAAA,MAAM,WAAW,GAAA,CAAI,KAAA,CAAM,QAAQ,MAAM,CAAA,CAAE,MAAM,GAAG,CAAA;AACpD,EAAA,MAAM,UAAA,GAAa,SAAS,CAAC,CAAA;AAC7B,EAAA,OAAO,UAAA,KAAe,MAAA,IAAa,cAAA,CAAe,GAAA,CAAI,UAAU,CAAA;AAClE;AAOO,SAAS,6BAA6B,IAAA,EAA8C;AACzF,EAAA,IAAI,CAAC,MAAM,OAAO,KAAA;AAClB,EAAA,OAAO,KAAK,IAAA,CAAK,CAAC,MAAM,mBAAA,CAAoB,CAAA,CAAE,GAAG,CAAC,CAAA;AACpD","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 {\n atUriSchema,\n datetimeSchema,\n didSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n uriSchema,\n} from '../schemas/shared.js';\n\n/**\n * Zod schemas mirroring the canonical Standard.site lexicons that Sifa\n * consumes when rendering publication embeds.\n *\n * Canonical lexicons live at:\n * DID: did:plc:re3ebnp5v7ffagz6rb6xfei4\n * PDS: https://auriporia.us-west.host.bsky.network\n * Collection: com.atproto.lexicon.schema\n *\n * Sifa does NOT own these lexicons; we vendor the validation shapes so\n * clients can parse augmented embeds and (in Phase 4) write subscription\n * records to viewers' PDSes. Re-check against the canonical PDS on each\n * SDK release to detect schema drift.\n */\n\nconst rgbColorSchema = z.object({\n r: z.number().int().min(0).max(255),\n g: z.number().int().min(0).max(255),\n b: z.number().int().min(0).max(255),\n});\n\nexport type RgbColor = z.infer<typeof rgbColorSchema>;\n\n/** site.standard.theme.basic */\nexport const BasicThemeSchema = z.object({\n background: rgbColorSchema,\n foreground: rgbColorSchema,\n accent: rgbColorSchema,\n accentForeground: rgbColorSchema,\n});\n\nexport type BasicTheme = z.infer<typeof BasicThemeSchema>;\n\nconst blobRefSchema = z\n .object({\n $type: z.string().optional(),\n ref: z.unknown(),\n mimeType: z.string().optional(),\n size: z.number().optional(),\n })\n .passthrough();\n\n/** site.standard.publication */\nexport const StandardSitePublicationRecordSchema = z\n .object({\n url: uriSchema,\n name: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n icon: blobRefSchema.optional(),\n basicTheme: BasicThemeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n preferences: z\n .object({\n showInDiscover: z.boolean().optional(),\n })\n .partial()\n .optional(),\n })\n .passthrough();\n\nexport type StandardSitePublicationRecord = z.infer<typeof StandardSitePublicationRecordSchema>;\n\nconst contributorSchema = z\n .object({\n did: didSchema,\n role: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n displayName: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n })\n .passthrough();\n\n/** site.standard.document */\nexport const StandardSiteDocumentRecordSchema = z\n .object({\n site: z.string().min(1),\n title: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n path: z.string().optional(),\n publishedAt: datetimeSchema,\n updatedAt: datetimeSchema.optional(),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n textContent: z.string().optional(),\n tags: z.array(z.string().refine(maxGraphemes(128)).max(1280)).optional(),\n coverImage: blobRefSchema.optional(),\n contributors: z.array(contributorSchema).optional(),\n bskyPostRef: strongRefSchema.optional(),\n labels: selfLabelsSchema.optional(),\n })\n .passthrough();\n\nexport type StandardSiteDocumentRecord = z.infer<typeof StandardSiteDocumentRecordSchema>;\n\n/**\n * site.standard.graph.subscription\n *\n * Authored by a viewer to declare a subscription to a publication. Used\n * by Phase 4 inline-subscribe path. Record key is a TID; the AT-URI\n * shape is `at://<viewer-did>/site.standard.graph.subscription/<rkey>`.\n */\nexport const StandardSiteSubscriptionRecordSchema = z.object({\n publication: atUriSchema,\n createdAt: datetimeSchema.optional(),\n});\n\nexport type StandardSiteSubscriptionRecord = z.infer<typeof StandardSiteSubscriptionRecordSchema>;\n\n/**\n * site.standard.graph.recommend\n *\n * Document-level \"like\" record. Same scope as subscription via the\n * site.standard.authSocial OAuth permission-set, so Phase 4 unlocks\n * inline likes alongside inline subscribes.\n */\nexport const StandardSiteRecommendRecordSchema = z.object({\n document: atUriSchema,\n createdAt: datetimeSchema,\n});\n\nexport type StandardSiteRecommendRecord = z.infer<typeof StandardSiteRecommendRecordSchema>;\n","/**\n * Publisher allowlist for the Standard.site rich embed.\n *\n * Mirrors `bluesky-social/social-app`\n * `src/components/Post/Embed/StandardSiteEmbed/publishers.ts`. The only\n * gate this provides is which publishers get the highlighted\n * \"Subscribe on {Publisher}\" CTA with a publisher icon vs the plain\n * \"View publication\" fallback — any Standard.site embed renders\n * regardless of allowlist membership.\n *\n * Sync policy: review additions against the upstream bsky list weekly;\n * Singi Labs reviews before merge.\n */\n\nexport interface Publisher {\n /** Lowercase host. Subdomains are matched via `hostMatches`. */\n host: string;\n /** Human-facing publisher name shown in CTA copy. */\n name: string;\n /**\n * Stable identifier used by clients to look up brand icons. The SDK\n * does not ship icon assets — sifa-web maintains them keyed by this\n * id so React Native vs web rendering can diverge.\n */\n iconKey: 'leaflet' | 'pckt' | 'offprint';\n}\n\nexport const STANDARD_SITE_PUBLISHERS: readonly Publisher[] = Object.freeze([\n { host: 'leaflet.pub', name: 'Leaflet', iconKey: 'leaflet' },\n { host: 'pckt.blog', name: 'pckt', iconKey: 'pckt' },\n { host: 'offprint.app', name: 'Offprint', iconKey: 'offprint' },\n]);\n\n/**\n * Returns true when `host` exactly matches `target` or is a subdomain of\n * it. Hosts are expected to be lowercase already.\n */\nexport function hostMatches(host: string, target: string): boolean {\n return host === target || host.endsWith('.' + target);\n}\n\nfunction hostFromUri(uri: string | undefined | null): string | null {\n if (!uri) return null;\n try {\n return new URL(uri).host.toLowerCase();\n } catch {\n return null;\n }\n}\n\n/**\n * Match a publisher by host. Returns the publisher when `host` is on the\n * allowlist (exact or subdomain match), null otherwise. Host should be\n * lowercase.\n */\nexport function matchPublisherByHost(host: string | null | undefined): Publisher | null {\n if (!host) return null;\n const lower = host.toLowerCase();\n return STANDARD_SITE_PUBLISHERS.find((p) => hostMatches(lower, p.host)) ?? null;\n}\n\n/**\n * Match a publisher by URI. Convenience wrapper around\n * `matchPublisherByHost` for callers that have a publication URL handy.\n */\nexport function matchPublisherByUri(uri: string | undefined | null): Publisher | null {\n return matchPublisherByHost(hostFromUri(uri));\n}\n","import type { BasicTheme } from './schemas.js';\n\n/**\n * Publication metadata embedded in the augmented activity view by\n * sifa-api when an external link card matches an indexed publication.\n *\n * `uri` is the publication's AT-URI (e.g.\n * `at://did:plc:abc/site.standard.publication/xyz`). `theme` carries\n * the publication's own colors when supplied — clients should apply a\n * WCAG min-contrast fallback before honoring them.\n *\n * `icon` is left as `unknown` here because its representation depends\n * on the surface: blob ref on the wire, CDN URL after resolution.\n */\nexport interface PublicationSource {\n uri: string;\n title: string;\n icon?: unknown;\n theme?: BasicTheme;\n}\n\n/**\n * Shape attached to activity items whose external link card URL matches\n * a Standard.site record. Mirrors the relevant fields of bsky's\n * `StandardSiteEmbed` view so a sifa-web renderer can be near-1:1.\n *\n * `associatedRefs` carries AT-URIs the client may use in Phase 4 to\n * query subscription state for the viewer.\n */\nexport interface StandardSiteEmbedView {\n uri: string;\n source: PublicationSource;\n associatedRefs: { uri: string }[];\n createdAt?: string;\n readingTime?: number;\n}\n\nexport const STANDARD_SITE_PUBLICATION_NSID = 'site.standard.publication' as const;\nexport const STANDARD_SITE_DOCUMENT_NSID = 'site.standard.document' as const;\nexport const STANDARD_SITE_SUBSCRIPTION_NSID = 'site.standard.graph.subscription' as const;\nexport const STANDARD_SITE_RECOMMEND_NSID = 'site.standard.graph.recommend' as const;\n\n/**\n * Pre-defined OAuth permission-set the consumer apps request to write\n * subscription + recommend records on behalf of the viewer. The actual\n * permission-set is published under\n * `at://did:plc:re3ebnp5v7ffagz6rb6xfei4/com.atproto.lexicon.schema/site.standard.authSocial`.\n */\nexport const STANDARD_SITE_AUTH_SOCIAL_NSID = 'site.standard.authSocial' as const;\n\nconst COLLECTION_SET = new Set<string>([\n STANDARD_SITE_PUBLICATION_NSID,\n STANDARD_SITE_DOCUMENT_NSID,\n STANDARD_SITE_SUBSCRIPTION_NSID,\n STANDARD_SITE_RECOMMEND_NSID,\n]);\n\n/**\n * True when the AT-URI's collection segment is a Standard.site\n * collection. Useful for detecting Standard.site embed augmentation on\n * arbitrary activity items.\n */\nexport function isStandardSiteAtUri(uri: string): boolean {\n if (!uri.startsWith('at://')) return false;\n const segments = uri.slice('at://'.length).split('/');\n const collection = segments[1];\n return collection !== undefined && COLLECTION_SET.has(collection);\n}\n\n/**\n * True when any `associatedRefs[].uri` is a Standard.site collection\n * AT-URI. The bsky client uses the same check to gate the\n * `StandardSiteEmbed` renderer.\n */\nexport function hasStandardSiteAssociatedRef(refs: { uri: string }[] | undefined): boolean {\n if (!refs) return false;\n return refs.some((r) => isStandardSiteAtUri(r.uri));\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/shared.ts","../../src/publishing/schemas.ts","../../src/publishing/registry.ts","../../src/publishing/types.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,CAAA;AAGlF,IAAM,cAAA,GAAiBA,MAAE,MAAA,EAAO,CAAE,SAAS,EAAE,MAAA,EAAQ,MAAM,CAAA;AAG3D,IAAM,cAAcA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,mBAAmB,gBAAgB,CAAA;AAGxE,IAAM,YAAYA,KAAA,CACtB,MAAA,EAAO,CACP,KAAA,CAAM,mDAAmD,aAAa,CAAA;AAGxCA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,uCAAuC,6BAA6B;AAGtE,IAAM,SAAA,GAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI;AAMjC,IAAM,eAAA,GAAkBA,MAAE,MAAA,CAAO;AAAA,EACtC,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK;AACP,CAAC,CAAA;AAQsCA,MAAE,MAAA,CAAO;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B;AACxD,EAAA,IAAI,CAAC,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AACrC,EAAA,MAAM,WAAW,GAAA,CAAI,KAAA,CAAM,QAAQ,MAAM,CAAA,CAAE,MAAM,GAAG,CAAA;AACpD,EAAA,MAAM,UAAA,GAAa,SAAS,CAAC,CAAA;AAC7B,EAAA,OAAO,UAAA,KAAe,MAAA,IAAa,cAAA,CAAe,GAAA,CAAI,UAAU,CAAA;AAClE;AAOO,SAAS,6BAA6B,IAAA,EAA8C;AACzF,EAAA,IAAI,CAAC,MAAM,OAAO,KAAA;AAClB,EAAA,OAAO,KAAK,IAAA,CAAK,CAAC,MAAM,mBAAA,CAAoB,CAAA,CAAE,GAAG,CAAC,CAAA;AACpD","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 * Reference to a record by AT-URI, with an optional CID. Mirrors\n * `id.sifa.defs#externalRecordRef`. Unlike a strongRef the CID is optional:\n * consumers resolve the AT-URI live so the reference tracks edits to the\n * target, and the CID is a best-effort integrity hint only.\n */\nexport const externalRecordRefSchema = z.object({\n uri: atUriSchema,\n cid: cidSchema.optional(),\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 {\n atUriSchema,\n datetimeSchema,\n didSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n uriSchema,\n} from '../schemas/shared.js';\n\n/**\n * Zod schemas mirroring the canonical Standard.site lexicons that Sifa\n * consumes when rendering publication embeds.\n *\n * Canonical lexicons live at:\n * DID: did:plc:re3ebnp5v7ffagz6rb6xfei4\n * PDS: https://auriporia.us-west.host.bsky.network\n * Collection: com.atproto.lexicon.schema\n *\n * Sifa does NOT own these lexicons; we vendor the validation shapes so\n * clients can parse augmented embeds and (in Phase 4) write subscription\n * records to viewers' PDSes. Re-check against the canonical PDS on each\n * SDK release to detect schema drift.\n */\n\nconst rgbColorSchema = z.object({\n r: z.number().int().min(0).max(255),\n g: z.number().int().min(0).max(255),\n b: z.number().int().min(0).max(255),\n});\n\nexport type RgbColor = z.infer<typeof rgbColorSchema>;\n\n/** site.standard.theme.basic */\nexport const BasicThemeSchema = z.object({\n background: rgbColorSchema,\n foreground: rgbColorSchema,\n accent: rgbColorSchema,\n accentForeground: rgbColorSchema,\n});\n\nexport type BasicTheme = z.infer<typeof BasicThemeSchema>;\n\nconst blobRefSchema = z\n .object({\n $type: z.string().optional(),\n ref: z.unknown(),\n mimeType: z.string().optional(),\n size: z.number().optional(),\n })\n .passthrough();\n\n/** site.standard.publication */\nexport const StandardSitePublicationRecordSchema = z\n .object({\n url: uriSchema,\n name: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n icon: blobRefSchema.optional(),\n basicTheme: BasicThemeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n preferences: z\n .object({\n showInDiscover: z.boolean().optional(),\n })\n .partial()\n .optional(),\n })\n .passthrough();\n\nexport type StandardSitePublicationRecord = z.infer<typeof StandardSitePublicationRecordSchema>;\n\nconst contributorSchema = z\n .object({\n did: didSchema,\n role: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n displayName: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n })\n .passthrough();\n\n/** site.standard.document */\nexport const StandardSiteDocumentRecordSchema = z\n .object({\n site: z.string().min(1),\n title: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n path: z.string().optional(),\n publishedAt: datetimeSchema,\n updatedAt: datetimeSchema.optional(),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n textContent: z.string().optional(),\n tags: z.array(z.string().refine(maxGraphemes(128)).max(1280)).optional(),\n coverImage: blobRefSchema.optional(),\n contributors: z.array(contributorSchema).optional(),\n bskyPostRef: strongRefSchema.optional(),\n labels: selfLabelsSchema.optional(),\n })\n .passthrough();\n\nexport type StandardSiteDocumentRecord = z.infer<typeof StandardSiteDocumentRecordSchema>;\n\n/**\n * site.standard.graph.subscription\n *\n * Authored by a viewer to declare a subscription to a publication. Used\n * by Phase 4 inline-subscribe path. Record key is a TID; the AT-URI\n * shape is `at://<viewer-did>/site.standard.graph.subscription/<rkey>`.\n */\nexport const StandardSiteSubscriptionRecordSchema = z.object({\n publication: atUriSchema,\n createdAt: datetimeSchema.optional(),\n});\n\nexport type StandardSiteSubscriptionRecord = z.infer<typeof StandardSiteSubscriptionRecordSchema>;\n\n/**\n * site.standard.graph.recommend\n *\n * Document-level \"like\" record. Same scope as subscription via the\n * site.standard.authSocial OAuth permission-set, so Phase 4 unlocks\n * inline likes alongside inline subscribes.\n */\nexport const StandardSiteRecommendRecordSchema = z.object({\n document: atUriSchema,\n createdAt: datetimeSchema,\n});\n\nexport type StandardSiteRecommendRecord = z.infer<typeof StandardSiteRecommendRecordSchema>;\n","/**\n * Publisher allowlist for the Standard.site rich embed.\n *\n * Mirrors `bluesky-social/social-app`\n * `src/components/Post/Embed/StandardSiteEmbed/publishers.ts`. The only\n * gate this provides is which publishers get the highlighted\n * \"Subscribe on {Publisher}\" CTA with a publisher icon vs the plain\n * \"View publication\" fallback — any Standard.site embed renders\n * regardless of allowlist membership.\n *\n * Sync policy: review additions against the upstream bsky list weekly;\n * Singi Labs reviews before merge.\n */\n\nexport interface Publisher {\n /** Lowercase host. Subdomains are matched via `hostMatches`. */\n host: string;\n /** Human-facing publisher name shown in CTA copy. */\n name: string;\n /**\n * Stable identifier used by clients to look up brand icons. The SDK\n * does not ship icon assets — sifa-web maintains them keyed by this\n * id so React Native vs web rendering can diverge.\n */\n iconKey: 'leaflet' | 'pckt' | 'offprint';\n}\n\nexport const STANDARD_SITE_PUBLISHERS: readonly Publisher[] = Object.freeze([\n { host: 'leaflet.pub', name: 'Leaflet', iconKey: 'leaflet' },\n { host: 'pckt.blog', name: 'pckt', iconKey: 'pckt' },\n { host: 'offprint.app', name: 'Offprint', iconKey: 'offprint' },\n]);\n\n/**\n * Returns true when `host` exactly matches `target` or is a subdomain of\n * it. Hosts are expected to be lowercase already.\n */\nexport function hostMatches(host: string, target: string): boolean {\n return host === target || host.endsWith('.' + target);\n}\n\nfunction hostFromUri(uri: string | undefined | null): string | null {\n if (!uri) return null;\n try {\n return new URL(uri).host.toLowerCase();\n } catch {\n return null;\n }\n}\n\n/**\n * Match a publisher by host. Returns the publisher when `host` is on the\n * allowlist (exact or subdomain match), null otherwise. Host should be\n * lowercase.\n */\nexport function matchPublisherByHost(host: string | null | undefined): Publisher | null {\n if (!host) return null;\n const lower = host.toLowerCase();\n return STANDARD_SITE_PUBLISHERS.find((p) => hostMatches(lower, p.host)) ?? null;\n}\n\n/**\n * Match a publisher by URI. Convenience wrapper around\n * `matchPublisherByHost` for callers that have a publication URL handy.\n */\nexport function matchPublisherByUri(uri: string | undefined | null): Publisher | null {\n return matchPublisherByHost(hostFromUri(uri));\n}\n","import type { BasicTheme } from './schemas.js';\n\n/**\n * Publication metadata embedded in the augmented activity view by\n * sifa-api when an external link card matches an indexed publication.\n *\n * `uri` is the publication's AT-URI (e.g.\n * `at://did:plc:abc/site.standard.publication/xyz`). `theme` carries\n * the publication's own colors when supplied — clients should apply a\n * WCAG min-contrast fallback before honoring them.\n *\n * `icon` is left as `unknown` here because its representation depends\n * on the surface: blob ref on the wire, CDN URL after resolution.\n */\nexport interface PublicationSource {\n uri: string;\n title: string;\n icon?: unknown;\n theme?: BasicTheme;\n}\n\n/**\n * Shape attached to activity items whose external link card URL matches\n * a Standard.site record. Mirrors the relevant fields of bsky's\n * `StandardSiteEmbed` view so a sifa-web renderer can be near-1:1.\n *\n * `associatedRefs` carries AT-URIs the client may use in Phase 4 to\n * query subscription state for the viewer.\n */\nexport interface StandardSiteEmbedView {\n uri: string;\n source: PublicationSource;\n associatedRefs: { uri: string }[];\n createdAt?: string;\n readingTime?: number;\n}\n\nexport const STANDARD_SITE_PUBLICATION_NSID = 'site.standard.publication' as const;\nexport const STANDARD_SITE_DOCUMENT_NSID = 'site.standard.document' as const;\nexport const STANDARD_SITE_SUBSCRIPTION_NSID = 'site.standard.graph.subscription' as const;\nexport const STANDARD_SITE_RECOMMEND_NSID = 'site.standard.graph.recommend' as const;\n\n/**\n * Pre-defined OAuth permission-set the consumer apps request to write\n * subscription + recommend records on behalf of the viewer. The actual\n * permission-set is published under\n * `at://did:plc:re3ebnp5v7ffagz6rb6xfei4/com.atproto.lexicon.schema/site.standard.authSocial`.\n */\nexport const STANDARD_SITE_AUTH_SOCIAL_NSID = 'site.standard.authSocial' as const;\n\nconst COLLECTION_SET = new Set<string>([\n STANDARD_SITE_PUBLICATION_NSID,\n STANDARD_SITE_DOCUMENT_NSID,\n STANDARD_SITE_SUBSCRIPTION_NSID,\n STANDARD_SITE_RECOMMEND_NSID,\n]);\n\n/**\n * True when the AT-URI's collection segment is a Standard.site\n * collection. Useful for detecting Standard.site embed augmentation on\n * arbitrary activity items.\n */\nexport function isStandardSiteAtUri(uri: string): boolean {\n if (!uri.startsWith('at://')) return false;\n const segments = uri.slice('at://'.length).split('/');\n const collection = segments[1];\n return collection !== undefined && COLLECTION_SET.has(collection);\n}\n\n/**\n * True when any `associatedRefs[].uri` is a Standard.site collection\n * AT-URI. The bsky client uses the same check to gate the\n * `StandardSiteEmbed` renderer.\n */\nexport function hasStandardSiteAssociatedRef(refs: { uri: string }[] | undefined): boolean {\n if (!refs) return false;\n return refs.some((r) => isStandardSiteAtUri(r.uri));\n}\n"]}
|
package/dist/publishing/index.js
CHANGED
|
@@ -22,6 +22,10 @@ var strongRefSchema = z.object({
|
|
|
22
22
|
uri: atUriSchema,
|
|
23
23
|
cid: cidSchema
|
|
24
24
|
});
|
|
25
|
+
z.object({
|
|
26
|
+
uri: atUriSchema,
|
|
27
|
+
cid: cidSchema.optional()
|
|
28
|
+
});
|
|
25
29
|
var selfLabelsSchema = z.object({
|
|
26
30
|
$type: z.literal("com.atproto.label.defs#selfLabels").optional(),
|
|
27
31
|
values: z.array(z.object({ val: z.string() }))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schemas/shared.ts","../../src/publishing/schemas.ts","../../src/publishing/registry.ts","../../src/publishing/types.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,YAAY,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,kCAAkC,aAAa,CAAA;AAGlF,IAAM,cAAA,GAAiB,EAAE,MAAA,EAAO,CAAE,SAAS,EAAE,MAAA,EAAQ,MAAM,CAAA;AAG3D,IAAM,cAAc,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,mBAAmB,gBAAgB,CAAA;AAGxE,IAAM,YAAY,CAAA,CACtB,MAAA,EAAO,CACP,KAAA,CAAM,mDAAmD,aAAa,CAAA;AAGxC,CAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,uCAAuC,6BAA6B;AAGtE,IAAM,SAAA,GAAY,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI;AAMjC,IAAM,eAAA,GAAkB,EAAE,MAAA,CAAO;AAAA,EACtC,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK;AACP,CAAC,CAAA;AAOM,IAAM,gBAAA,GAAmB,EAAE,MAAA,CAAO;AAAA,EACvC,KAAA,EAAO,CAAA,CAAE,OAAA,CAAQ,mCAAmC,EAAE,QAAA,EAAS;AAAA,EAC/D,MAAA,EAAQ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OAAO,UAAA,KAAe,MAAA,IAAa,cAAA,CAAe,GAAA,CAAI,UAAU,CAAA;AAClE;AAOO,SAAS,6BAA6B,IAAA,EAA8C;AACzF,EAAA,IAAI,CAAC,MAAM,OAAO,KAAA;AAClB,EAAA,OAAO,KAAK,IAAA,CAAK,CAAC,MAAM,mBAAA,CAAoB,CAAA,CAAE,GAAG,CAAC,CAAA;AACpD","file":"index.js","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 {\n atUriSchema,\n datetimeSchema,\n didSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n uriSchema,\n} from '../schemas/shared.js';\n\n/**\n * Zod schemas mirroring the canonical Standard.site lexicons that Sifa\n * consumes when rendering publication embeds.\n *\n * Canonical lexicons live at:\n * DID: did:plc:re3ebnp5v7ffagz6rb6xfei4\n * PDS: https://auriporia.us-west.host.bsky.network\n * Collection: com.atproto.lexicon.schema\n *\n * Sifa does NOT own these lexicons; we vendor the validation shapes so\n * clients can parse augmented embeds and (in Phase 4) write subscription\n * records to viewers' PDSes. Re-check against the canonical PDS on each\n * SDK release to detect schema drift.\n */\n\nconst rgbColorSchema = z.object({\n r: z.number().int().min(0).max(255),\n g: z.number().int().min(0).max(255),\n b: z.number().int().min(0).max(255),\n});\n\nexport type RgbColor = z.infer<typeof rgbColorSchema>;\n\n/** site.standard.theme.basic */\nexport const BasicThemeSchema = z.object({\n background: rgbColorSchema,\n foreground: rgbColorSchema,\n accent: rgbColorSchema,\n accentForeground: rgbColorSchema,\n});\n\nexport type BasicTheme = z.infer<typeof BasicThemeSchema>;\n\nconst blobRefSchema = z\n .object({\n $type: z.string().optional(),\n ref: z.unknown(),\n mimeType: z.string().optional(),\n size: z.number().optional(),\n })\n .passthrough();\n\n/** site.standard.publication */\nexport const StandardSitePublicationRecordSchema = z\n .object({\n url: uriSchema,\n name: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n icon: blobRefSchema.optional(),\n basicTheme: BasicThemeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n preferences: z\n .object({\n showInDiscover: z.boolean().optional(),\n })\n .partial()\n .optional(),\n })\n .passthrough();\n\nexport type StandardSitePublicationRecord = z.infer<typeof StandardSitePublicationRecordSchema>;\n\nconst contributorSchema = z\n .object({\n did: didSchema,\n role: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n displayName: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n })\n .passthrough();\n\n/** site.standard.document */\nexport const StandardSiteDocumentRecordSchema = z\n .object({\n site: z.string().min(1),\n title: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n path: z.string().optional(),\n publishedAt: datetimeSchema,\n updatedAt: datetimeSchema.optional(),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n textContent: z.string().optional(),\n tags: z.array(z.string().refine(maxGraphemes(128)).max(1280)).optional(),\n coverImage: blobRefSchema.optional(),\n contributors: z.array(contributorSchema).optional(),\n bskyPostRef: strongRefSchema.optional(),\n labels: selfLabelsSchema.optional(),\n })\n .passthrough();\n\nexport type StandardSiteDocumentRecord = z.infer<typeof StandardSiteDocumentRecordSchema>;\n\n/**\n * site.standard.graph.subscription\n *\n * Authored by a viewer to declare a subscription to a publication. Used\n * by Phase 4 inline-subscribe path. Record key is a TID; the AT-URI\n * shape is `at://<viewer-did>/site.standard.graph.subscription/<rkey>`.\n */\nexport const StandardSiteSubscriptionRecordSchema = z.object({\n publication: atUriSchema,\n createdAt: datetimeSchema.optional(),\n});\n\nexport type StandardSiteSubscriptionRecord = z.infer<typeof StandardSiteSubscriptionRecordSchema>;\n\n/**\n * site.standard.graph.recommend\n *\n * Document-level \"like\" record. Same scope as subscription via the\n * site.standard.authSocial OAuth permission-set, so Phase 4 unlocks\n * inline likes alongside inline subscribes.\n */\nexport const StandardSiteRecommendRecordSchema = z.object({\n document: atUriSchema,\n createdAt: datetimeSchema,\n});\n\nexport type StandardSiteRecommendRecord = z.infer<typeof StandardSiteRecommendRecordSchema>;\n","/**\n * Publisher allowlist for the Standard.site rich embed.\n *\n * Mirrors `bluesky-social/social-app`\n * `src/components/Post/Embed/StandardSiteEmbed/publishers.ts`. The only\n * gate this provides is which publishers get the highlighted\n * \"Subscribe on {Publisher}\" CTA with a publisher icon vs the plain\n * \"View publication\" fallback — any Standard.site embed renders\n * regardless of allowlist membership.\n *\n * Sync policy: review additions against the upstream bsky list weekly;\n * Singi Labs reviews before merge.\n */\n\nexport interface Publisher {\n /** Lowercase host. Subdomains are matched via `hostMatches`. */\n host: string;\n /** Human-facing publisher name shown in CTA copy. */\n name: string;\n /**\n * Stable identifier used by clients to look up brand icons. The SDK\n * does not ship icon assets — sifa-web maintains them keyed by this\n * id so React Native vs web rendering can diverge.\n */\n iconKey: 'leaflet' | 'pckt' | 'offprint';\n}\n\nexport const STANDARD_SITE_PUBLISHERS: readonly Publisher[] = Object.freeze([\n { host: 'leaflet.pub', name: 'Leaflet', iconKey: 'leaflet' },\n { host: 'pckt.blog', name: 'pckt', iconKey: 'pckt' },\n { host: 'offprint.app', name: 'Offprint', iconKey: 'offprint' },\n]);\n\n/**\n * Returns true when `host` exactly matches `target` or is a subdomain of\n * it. Hosts are expected to be lowercase already.\n */\nexport function hostMatches(host: string, target: string): boolean {\n return host === target || host.endsWith('.' + target);\n}\n\nfunction hostFromUri(uri: string | undefined | null): string | null {\n if (!uri) return null;\n try {\n return new URL(uri).host.toLowerCase();\n } catch {\n return null;\n }\n}\n\n/**\n * Match a publisher by host. Returns the publisher when `host` is on the\n * allowlist (exact or subdomain match), null otherwise. Host should be\n * lowercase.\n */\nexport function matchPublisherByHost(host: string | null | undefined): Publisher | null {\n if (!host) return null;\n const lower = host.toLowerCase();\n return STANDARD_SITE_PUBLISHERS.find((p) => hostMatches(lower, p.host)) ?? null;\n}\n\n/**\n * Match a publisher by URI. Convenience wrapper around\n * `matchPublisherByHost` for callers that have a publication URL handy.\n */\nexport function matchPublisherByUri(uri: string | undefined | null): Publisher | null {\n return matchPublisherByHost(hostFromUri(uri));\n}\n","import type { BasicTheme } from './schemas.js';\n\n/**\n * Publication metadata embedded in the augmented activity view by\n * sifa-api when an external link card matches an indexed publication.\n *\n * `uri` is the publication's AT-URI (e.g.\n * `at://did:plc:abc/site.standard.publication/xyz`). `theme` carries\n * the publication's own colors when supplied — clients should apply a\n * WCAG min-contrast fallback before honoring them.\n *\n * `icon` is left as `unknown` here because its representation depends\n * on the surface: blob ref on the wire, CDN URL after resolution.\n */\nexport interface PublicationSource {\n uri: string;\n title: string;\n icon?: unknown;\n theme?: BasicTheme;\n}\n\n/**\n * Shape attached to activity items whose external link card URL matches\n * a Standard.site record. Mirrors the relevant fields of bsky's\n * `StandardSiteEmbed` view so a sifa-web renderer can be near-1:1.\n *\n * `associatedRefs` carries AT-URIs the client may use in Phase 4 to\n * query subscription state for the viewer.\n */\nexport interface StandardSiteEmbedView {\n uri: string;\n source: PublicationSource;\n associatedRefs: { uri: string }[];\n createdAt?: string;\n readingTime?: number;\n}\n\nexport const STANDARD_SITE_PUBLICATION_NSID = 'site.standard.publication' as const;\nexport const STANDARD_SITE_DOCUMENT_NSID = 'site.standard.document' as const;\nexport const STANDARD_SITE_SUBSCRIPTION_NSID = 'site.standard.graph.subscription' as const;\nexport const STANDARD_SITE_RECOMMEND_NSID = 'site.standard.graph.recommend' as const;\n\n/**\n * Pre-defined OAuth permission-set the consumer apps request to write\n * subscription + recommend records on behalf of the viewer. The actual\n * permission-set is published under\n * `at://did:plc:re3ebnp5v7ffagz6rb6xfei4/com.atproto.lexicon.schema/site.standard.authSocial`.\n */\nexport const STANDARD_SITE_AUTH_SOCIAL_NSID = 'site.standard.authSocial' as const;\n\nconst COLLECTION_SET = new Set<string>([\n STANDARD_SITE_PUBLICATION_NSID,\n STANDARD_SITE_DOCUMENT_NSID,\n STANDARD_SITE_SUBSCRIPTION_NSID,\n STANDARD_SITE_RECOMMEND_NSID,\n]);\n\n/**\n * True when the AT-URI's collection segment is a Standard.site\n * collection. Useful for detecting Standard.site embed augmentation on\n * arbitrary activity items.\n */\nexport function isStandardSiteAtUri(uri: string): boolean {\n if (!uri.startsWith('at://')) return false;\n const segments = uri.slice('at://'.length).split('/');\n const collection = segments[1];\n return collection !== undefined && COLLECTION_SET.has(collection);\n}\n\n/**\n * True when any `associatedRefs[].uri` is a Standard.site collection\n * AT-URI. The bsky client uses the same check to gate the\n * `StandardSiteEmbed` renderer.\n */\nexport function hasStandardSiteAssociatedRef(refs: { uri: string }[] | undefined): boolean {\n if (!refs) return false;\n return refs.some((r) => isStandardSiteAtUri(r.uri));\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/shared.ts","../../src/publishing/schemas.ts","../../src/publishing/registry.ts","../../src/publishing/types.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,YAAY,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,kCAAkC,aAAa,CAAA;AAGlF,IAAM,cAAA,GAAiB,EAAE,MAAA,EAAO,CAAE,SAAS,EAAE,MAAA,EAAQ,MAAM,CAAA;AAG3D,IAAM,cAAc,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,mBAAmB,gBAAgB,CAAA;AAGxE,IAAM,YAAY,CAAA,CACtB,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,GAAG,CAAC,CAAA;AAC9C;;;AC9BO,IAAM,8BAAA,GAAiC;AACvC,IAAM,2BAAA,GAA8B;AACpC,IAAM,+BAAA,GAAkC;AACxC,IAAM,4BAAA,GAA+B;AAQrC,IAAM,8BAAA,GAAiC;AAE9C,IAAM,cAAA,uBAAqB,GAAA,CAAY;AAAA,EACrC,8BAAA;AAAA,EACA,2BAAA;AAAA,EACA,+BAAA;AAAA,EACA;AACF,CAAC,CAAA;AAOM,SAAS,oBAAoB,GAAA,EAAsB;AACxD,EAAA,IAAI,CAAC,GAAA,CAAI,UAAA,CAAW,OAAO,GAAG,OAAO,KAAA;AACrC,EAAA,MAAM,WAAW,GAAA,CAAI,KAAA,CAAM,QAAQ,MAAM,CAAA,CAAE,MAAM,GAAG,CAAA;AACpD,EAAA,MAAM,UAAA,GAAa,SAAS,CAAC,CAAA;AAC7B,EAAA,OAAO,UAAA,KAAe,MAAA,IAAa,cAAA,CAAe,GAAA,CAAI,UAAU,CAAA;AAClE;AAOO,SAAS,6BAA6B,IAAA,EAA8C;AACzF,EAAA,IAAI,CAAC,MAAM,OAAO,KAAA;AAClB,EAAA,OAAO,KAAK,IAAA,CAAK,CAAC,MAAM,mBAAA,CAAoB,CAAA,CAAE,GAAG,CAAC,CAAA;AACpD","file":"index.js","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 * Reference to a record by AT-URI, with an optional CID. Mirrors\n * `id.sifa.defs#externalRecordRef`. Unlike a strongRef the CID is optional:\n * consumers resolve the AT-URI live so the reference tracks edits to the\n * target, and the CID is a best-effort integrity hint only.\n */\nexport const externalRecordRefSchema = z.object({\n uri: atUriSchema,\n cid: cidSchema.optional(),\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 {\n atUriSchema,\n datetimeSchema,\n didSchema,\n maxGraphemes,\n selfLabelsSchema,\n strongRefSchema,\n uriSchema,\n} from '../schemas/shared.js';\n\n/**\n * Zod schemas mirroring the canonical Standard.site lexicons that Sifa\n * consumes when rendering publication embeds.\n *\n * Canonical lexicons live at:\n * DID: did:plc:re3ebnp5v7ffagz6rb6xfei4\n * PDS: https://auriporia.us-west.host.bsky.network\n * Collection: com.atproto.lexicon.schema\n *\n * Sifa does NOT own these lexicons; we vendor the validation shapes so\n * clients can parse augmented embeds and (in Phase 4) write subscription\n * records to viewers' PDSes. Re-check against the canonical PDS on each\n * SDK release to detect schema drift.\n */\n\nconst rgbColorSchema = z.object({\n r: z.number().int().min(0).max(255),\n g: z.number().int().min(0).max(255),\n b: z.number().int().min(0).max(255),\n});\n\nexport type RgbColor = z.infer<typeof rgbColorSchema>;\n\n/** site.standard.theme.basic */\nexport const BasicThemeSchema = z.object({\n background: rgbColorSchema,\n foreground: rgbColorSchema,\n accent: rgbColorSchema,\n accentForeground: rgbColorSchema,\n});\n\nexport type BasicTheme = z.infer<typeof BasicThemeSchema>;\n\nconst blobRefSchema = z\n .object({\n $type: z.string().optional(),\n ref: z.unknown(),\n mimeType: z.string().optional(),\n size: z.number().optional(),\n })\n .passthrough();\n\n/** site.standard.publication */\nexport const StandardSitePublicationRecordSchema = z\n .object({\n url: uriSchema,\n name: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n icon: blobRefSchema.optional(),\n basicTheme: BasicThemeSchema.optional(),\n labels: selfLabelsSchema.optional(),\n preferences: z\n .object({\n showInDiscover: z.boolean().optional(),\n })\n .partial()\n .optional(),\n })\n .passthrough();\n\nexport type StandardSitePublicationRecord = z.infer<typeof StandardSitePublicationRecordSchema>;\n\nconst contributorSchema = z\n .object({\n did: didSchema,\n role: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n displayName: z.string().refine(maxGraphemes(100)).max(1000).optional(),\n })\n .passthrough();\n\n/** site.standard.document */\nexport const StandardSiteDocumentRecordSchema = z\n .object({\n site: z.string().min(1),\n title: z.string().min(1).refine(maxGraphemes(500)).max(5000),\n path: z.string().optional(),\n publishedAt: datetimeSchema,\n updatedAt: datetimeSchema.optional(),\n description: z.string().refine(maxGraphemes(3000)).max(30000).optional(),\n textContent: z.string().optional(),\n tags: z.array(z.string().refine(maxGraphemes(128)).max(1280)).optional(),\n coverImage: blobRefSchema.optional(),\n contributors: z.array(contributorSchema).optional(),\n bskyPostRef: strongRefSchema.optional(),\n labels: selfLabelsSchema.optional(),\n })\n .passthrough();\n\nexport type StandardSiteDocumentRecord = z.infer<typeof StandardSiteDocumentRecordSchema>;\n\n/**\n * site.standard.graph.subscription\n *\n * Authored by a viewer to declare a subscription to a publication. Used\n * by Phase 4 inline-subscribe path. Record key is a TID; the AT-URI\n * shape is `at://<viewer-did>/site.standard.graph.subscription/<rkey>`.\n */\nexport const StandardSiteSubscriptionRecordSchema = z.object({\n publication: atUriSchema,\n createdAt: datetimeSchema.optional(),\n});\n\nexport type StandardSiteSubscriptionRecord = z.infer<typeof StandardSiteSubscriptionRecordSchema>;\n\n/**\n * site.standard.graph.recommend\n *\n * Document-level \"like\" record. Same scope as subscription via the\n * site.standard.authSocial OAuth permission-set, so Phase 4 unlocks\n * inline likes alongside inline subscribes.\n */\nexport const StandardSiteRecommendRecordSchema = z.object({\n document: atUriSchema,\n createdAt: datetimeSchema,\n});\n\nexport type StandardSiteRecommendRecord = z.infer<typeof StandardSiteRecommendRecordSchema>;\n","/**\n * Publisher allowlist for the Standard.site rich embed.\n *\n * Mirrors `bluesky-social/social-app`\n * `src/components/Post/Embed/StandardSiteEmbed/publishers.ts`. The only\n * gate this provides is which publishers get the highlighted\n * \"Subscribe on {Publisher}\" CTA with a publisher icon vs the plain\n * \"View publication\" fallback — any Standard.site embed renders\n * regardless of allowlist membership.\n *\n * Sync policy: review additions against the upstream bsky list weekly;\n * Singi Labs reviews before merge.\n */\n\nexport interface Publisher {\n /** Lowercase host. Subdomains are matched via `hostMatches`. */\n host: string;\n /** Human-facing publisher name shown in CTA copy. */\n name: string;\n /**\n * Stable identifier used by clients to look up brand icons. The SDK\n * does not ship icon assets — sifa-web maintains them keyed by this\n * id so React Native vs web rendering can diverge.\n */\n iconKey: 'leaflet' | 'pckt' | 'offprint';\n}\n\nexport const STANDARD_SITE_PUBLISHERS: readonly Publisher[] = Object.freeze([\n { host: 'leaflet.pub', name: 'Leaflet', iconKey: 'leaflet' },\n { host: 'pckt.blog', name: 'pckt', iconKey: 'pckt' },\n { host: 'offprint.app', name: 'Offprint', iconKey: 'offprint' },\n]);\n\n/**\n * Returns true when `host` exactly matches `target` or is a subdomain of\n * it. Hosts are expected to be lowercase already.\n */\nexport function hostMatches(host: string, target: string): boolean {\n return host === target || host.endsWith('.' + target);\n}\n\nfunction hostFromUri(uri: string | undefined | null): string | null {\n if (!uri) return null;\n try {\n return new URL(uri).host.toLowerCase();\n } catch {\n return null;\n }\n}\n\n/**\n * Match a publisher by host. Returns the publisher when `host` is on the\n * allowlist (exact or subdomain match), null otherwise. Host should be\n * lowercase.\n */\nexport function matchPublisherByHost(host: string | null | undefined): Publisher | null {\n if (!host) return null;\n const lower = host.toLowerCase();\n return STANDARD_SITE_PUBLISHERS.find((p) => hostMatches(lower, p.host)) ?? null;\n}\n\n/**\n * Match a publisher by URI. Convenience wrapper around\n * `matchPublisherByHost` for callers that have a publication URL handy.\n */\nexport function matchPublisherByUri(uri: string | undefined | null): Publisher | null {\n return matchPublisherByHost(hostFromUri(uri));\n}\n","import type { BasicTheme } from './schemas.js';\n\n/**\n * Publication metadata embedded in the augmented activity view by\n * sifa-api when an external link card matches an indexed publication.\n *\n * `uri` is the publication's AT-URI (e.g.\n * `at://did:plc:abc/site.standard.publication/xyz`). `theme` carries\n * the publication's own colors when supplied — clients should apply a\n * WCAG min-contrast fallback before honoring them.\n *\n * `icon` is left as `unknown` here because its representation depends\n * on the surface: blob ref on the wire, CDN URL after resolution.\n */\nexport interface PublicationSource {\n uri: string;\n title: string;\n icon?: unknown;\n theme?: BasicTheme;\n}\n\n/**\n * Shape attached to activity items whose external link card URL matches\n * a Standard.site record. Mirrors the relevant fields of bsky's\n * `StandardSiteEmbed` view so a sifa-web renderer can be near-1:1.\n *\n * `associatedRefs` carries AT-URIs the client may use in Phase 4 to\n * query subscription state for the viewer.\n */\nexport interface StandardSiteEmbedView {\n uri: string;\n source: PublicationSource;\n associatedRefs: { uri: string }[];\n createdAt?: string;\n readingTime?: number;\n}\n\nexport const STANDARD_SITE_PUBLICATION_NSID = 'site.standard.publication' as const;\nexport const STANDARD_SITE_DOCUMENT_NSID = 'site.standard.document' as const;\nexport const STANDARD_SITE_SUBSCRIPTION_NSID = 'site.standard.graph.subscription' as const;\nexport const STANDARD_SITE_RECOMMEND_NSID = 'site.standard.graph.recommend' as const;\n\n/**\n * Pre-defined OAuth permission-set the consumer apps request to write\n * subscription + recommend records on behalf of the viewer. The actual\n * permission-set is published under\n * `at://did:plc:re3ebnp5v7ffagz6rb6xfei4/com.atproto.lexicon.schema/site.standard.authSocial`.\n */\nexport const STANDARD_SITE_AUTH_SOCIAL_NSID = 'site.standard.authSocial' as const;\n\nconst COLLECTION_SET = new Set<string>([\n STANDARD_SITE_PUBLICATION_NSID,\n STANDARD_SITE_DOCUMENT_NSID,\n STANDARD_SITE_SUBSCRIPTION_NSID,\n STANDARD_SITE_RECOMMEND_NSID,\n]);\n\n/**\n * True when the AT-URI's collection segment is a Standard.site\n * collection. Useful for detecting Standard.site embed augmentation on\n * arbitrary activity items.\n */\nexport function isStandardSiteAtUri(uri: string): boolean {\n if (!uri.startsWith('at://')) return false;\n const segments = uri.slice('at://'.length).split('/');\n const collection = segments[1];\n return collection !== undefined && COLLECTION_SET.has(collection);\n}\n\n/**\n * True when any `associatedRefs[].uri` is a Standard.site collection\n * AT-URI. The bsky client uses the same check to gate the\n * `StandardSiteEmbed` renderer.\n */\nexport function hasStandardSiteAssociatedRef(refs: { uri: string }[] | undefined): boolean {\n if (!refs) return false;\n return refs.some((r) => isStandardSiteAtUri(r.uri));\n}\n"]}
|
package/dist/schemas/index.cjs
CHANGED
|
@@ -24,6 +24,10 @@ var strongRefSchema = zod.z.object({
|
|
|
24
24
|
uri: atUriSchema,
|
|
25
25
|
cid: cidSchema
|
|
26
26
|
});
|
|
27
|
+
var externalRecordRefSchema = zod.z.object({
|
|
28
|
+
uri: atUriSchema,
|
|
29
|
+
cid: cidSchema.optional()
|
|
30
|
+
});
|
|
27
31
|
var selfLabelsSchema = zod.z.object({
|
|
28
32
|
$type: zod.z.literal("com.atproto.label.defs#selfLabels").optional(),
|
|
29
33
|
values: zod.z.array(zod.z.object({ val: zod.z.string() }))
|
|
@@ -204,6 +208,46 @@ var ProfilePositionRecordSchema = zod.z.object({
|
|
|
204
208
|
labels: selfLabelsSchema.optional(),
|
|
205
209
|
createdAt: datetimeSchema
|
|
206
210
|
});
|
|
211
|
+
var PresentationDurationSchema = zod.z.object({
|
|
212
|
+
minMinutes: zod.z.number().int().min(1),
|
|
213
|
+
maxMinutes: zod.z.number().int().min(1).optional()
|
|
214
|
+
}).refine((d) => d.maxMinutes === void 0 || d.maxMinutes >= d.minMinutes, {
|
|
215
|
+
message: "maxMinutes must be greater than or equal to minMinutes",
|
|
216
|
+
path: ["maxMinutes"]
|
|
217
|
+
});
|
|
218
|
+
var PresentationLinkSchema = zod.z.object({
|
|
219
|
+
uri: uriSchema,
|
|
220
|
+
label: zod.z.string().refine(maxGraphemes(64)).max(640).optional(),
|
|
221
|
+
type: zod.z.string().optional()
|
|
222
|
+
});
|
|
223
|
+
var ProfilePresentationRecordSchema = zod.z.object({
|
|
224
|
+
title: zod.z.string().min(1).refine(maxGraphemes(300)).max(3e3),
|
|
225
|
+
description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
|
|
226
|
+
duration: PresentationDurationSchema.optional(),
|
|
227
|
+
intendedAudiences: zod.z.array(zod.z.string().refine(maxGraphemes(100)).max(1e3)).max(20).optional(),
|
|
228
|
+
links: zod.z.array(PresentationLinkSchema).max(20).optional(),
|
|
229
|
+
// Optional reference to a long-form write-up (pub.leaflet.document or
|
|
230
|
+
// site.standard.document). Plain at-uri + optional cid so it tracks edits.
|
|
231
|
+
writeupRef: externalRecordRefSchema.optional(),
|
|
232
|
+
createdAt: datetimeSchema
|
|
233
|
+
});
|
|
234
|
+
var ProfilePresentationDeliveryRecordSchema = zod.z.object({
|
|
235
|
+
// Optional reference to the id.sifa.profile.presentation delivered here.
|
|
236
|
+
presentationRef: externalRecordRefSchema.optional(),
|
|
237
|
+
// Fallback title used when there is no presentationRef.
|
|
238
|
+
title: zod.z.string().refine(maxGraphemes(300)).max(3e3).optional(),
|
|
239
|
+
role: zod.z.string().refine(maxGraphemes(64)).max(640).optional(),
|
|
240
|
+
eventName: zod.z.string().refine(maxGraphemes(300)).max(3e3).optional(),
|
|
241
|
+
// Calendar date as YYYY-MM-DD (day only).
|
|
242
|
+
date: zod.z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "date must be YYYY-MM-DD").optional(),
|
|
243
|
+
location: zod.z.string().refine(maxGraphemes(256)).max(2560).optional(),
|
|
244
|
+
mode: zod.z.string().optional(),
|
|
245
|
+
status: zod.z.string().optional(),
|
|
246
|
+
links: zod.z.array(PresentationLinkSchema).max(20).optional(),
|
|
247
|
+
// Optional reference to a community.lexicon.calendar.event for this occasion.
|
|
248
|
+
eventRef: externalRecordRefSchema.optional(),
|
|
249
|
+
createdAt: datetimeSchema
|
|
250
|
+
});
|
|
207
251
|
var ProfileProjectRecordSchema = zod.z.object({
|
|
208
252
|
name: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3),
|
|
209
253
|
description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
|
|
@@ -268,6 +312,8 @@ exports.FollowFeedPageSchema = FollowFeedPageSchema;
|
|
|
268
312
|
exports.FollowProfilePageSchema = FollowProfilePageSchema;
|
|
269
313
|
exports.FollowProfileSchema = FollowProfileSchema;
|
|
270
314
|
exports.GraphFollowRecordSchema = GraphFollowRecordSchema;
|
|
315
|
+
exports.PresentationDurationSchema = PresentationDurationSchema;
|
|
316
|
+
exports.PresentationLinkSchema = PresentationLinkSchema;
|
|
271
317
|
exports.ProfileCertificationRecordSchema = ProfileCertificationRecordSchema;
|
|
272
318
|
exports.ProfileCourseRecordSchema = ProfileCourseRecordSchema;
|
|
273
319
|
exports.ProfileEducationRecordSchema = ProfileEducationRecordSchema;
|
|
@@ -275,6 +321,8 @@ exports.ProfileExternalAccountRecordSchema = ProfileExternalAccountRecordSchema;
|
|
|
275
321
|
exports.ProfileHonorRecordSchema = ProfileHonorRecordSchema;
|
|
276
322
|
exports.ProfileLanguageRecordSchema = ProfileLanguageRecordSchema;
|
|
277
323
|
exports.ProfilePositionRecordSchema = ProfilePositionRecordSchema;
|
|
324
|
+
exports.ProfilePresentationDeliveryRecordSchema = ProfilePresentationDeliveryRecordSchema;
|
|
325
|
+
exports.ProfilePresentationRecordSchema = ProfilePresentationRecordSchema;
|
|
278
326
|
exports.ProfileProjectRecordSchema = ProfileProjectRecordSchema;
|
|
279
327
|
exports.ProfilePublicationRecordSchema = ProfilePublicationRecordSchema;
|
|
280
328
|
exports.ProfileSelfRecordSchema = ProfileSelfRecordSchema;
|
|
@@ -288,6 +336,7 @@ exports.datetimeSchema = datetimeSchema;
|
|
|
288
336
|
exports.decodeFeedCursor = decodeFeedCursor;
|
|
289
337
|
exports.didSchema = didSchema;
|
|
290
338
|
exports.encodeFeedCursor = encodeFeedCursor;
|
|
339
|
+
exports.externalRecordRefSchema = externalRecordRefSchema;
|
|
291
340
|
exports.languageTagSchema = languageTagSchema;
|
|
292
341
|
exports.makeGraphFollowRecordSchema = makeGraphFollowRecordSchema;
|
|
293
342
|
exports.maxGraphemes = maxGraphemes;
|
|
@@ -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/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,uCAAuC,6BAA6B;AAGtE,IAAM,SAAA,GAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAM7B,IAAM,eAAA,GAAkBA,MAAE,MAAA,CAAO;AAAA,EACtC,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK;AACP,CAAC;AAOM,IAAM,gBAAA,GAAmBA,MAAE,MAAA,CAAO;AAAA,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D,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 { atUriSchema, 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 // AT-URI of the associated id.sifa.profile.certification record. Plain\n // at-uri (not a strongRef) so the link tracks the live certification.\n credential: atUriSchema.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).optional(),\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-presentation.ts","../../src/schemas/profile-presentation-delivery.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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A,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 * Reference to a record by AT-URI, with an optional CID. Mirrors\n * `id.sifa.defs#externalRecordRef`. Unlike a strongRef the CID is optional:\n * consumers resolve the AT-URI live so the reference tracks edits to the\n * target, and the CID is a best-effort integrity hint only.\n */\nexport const externalRecordRefSchema = z.object({\n uri: atUriSchema,\n cid: cidSchema.optional(),\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 { atUriSchema, 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 // AT-URI of the associated id.sifa.profile.certification record. Plain\n // at-uri (not a strongRef) so the link tracks the live certification.\n credential: atUriSchema.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).optional(),\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 { datetimeSchema, externalRecordRefSchema, maxGraphemes, uriSchema } from './shared.js';\n\n/**\n * Duration of a presentation, in minutes. Mirrors\n * `id.sifa.profile.presentation#duration`: a fixed length (minMinutes only) or\n * a range (minMinutes to maxMinutes).\n */\nexport const PresentationDurationSchema = z\n .object({\n minMinutes: z.number().int().min(1),\n maxMinutes: z.number().int().min(1).optional(),\n })\n .refine((d) => d.maxMinutes === undefined || d.maxMinutes >= d.minMinutes, {\n message: 'maxMinutes must be greater than or equal to minMinutes',\n path: ['maxMinutes'],\n });\n\nexport type PresentationDuration = z.infer<typeof PresentationDurationSchema>;\n\n/**\n * A related link for a presentation or one of its deliveries. Mirrors\n * `id.sifa.defs#presentationLink`. `type` is an open enum (knownValues), so any\n * string is accepted.\n */\nexport const PresentationLinkSchema = z.object({\n uri: uriSchema,\n label: z.string().refine(maxGraphemes(64)).max(640).optional(),\n type: z.string().optional(),\n});\n\nexport type PresentationLink = z.infer<typeof PresentationLinkSchema>;\n\n/** Zod schema for `id.sifa.profile.presentation` records (the reusable content). */\nexport const ProfilePresentationRecordSchema = z.object({\n title: z.string().min(1).refine(maxGraphemes(300)).max(3000),\n description: z.string().refine(maxGraphemes(5000)).max(50000).optional(),\n duration: PresentationDurationSchema.optional(),\n intendedAudiences: z\n .array(z.string().refine(maxGraphemes(100)).max(1000))\n .max(20)\n .optional(),\n links: z.array(PresentationLinkSchema).max(20).optional(),\n // Optional reference to a long-form write-up (pub.leaflet.document or\n // site.standard.document). Plain at-uri + optional cid so it tracks edits.\n writeupRef: externalRecordRefSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfilePresentationRecord = z.infer<typeof ProfilePresentationRecordSchema>;\n","import { z } from 'zod';\n\nimport { PresentationLinkSchema } from './profile-presentation.js';\nimport { datetimeSchema, externalRecordRefSchema, maxGraphemes } from './shared.js';\n\n/**\n * Zod schema for `id.sifa.profile.presentationDelivery` records (one occasion\n * on which a presentation was delivered). Works standalone or linked to a\n * presentation and/or a calendar event. `role`, `mode`, and `status` are open\n * enums (knownValues); `mode`/`status` store the full\n * `community.lexicon.calendar.event` token.\n */\nexport const ProfilePresentationDeliveryRecordSchema = z.object({\n // Optional reference to the id.sifa.profile.presentation delivered here.\n presentationRef: externalRecordRefSchema.optional(),\n // Fallback title used when there is no presentationRef.\n title: z.string().refine(maxGraphemes(300)).max(3000).optional(),\n role: z.string().refine(maxGraphemes(64)).max(640).optional(),\n eventName: z.string().refine(maxGraphemes(300)).max(3000).optional(),\n // Calendar date as YYYY-MM-DD (day only).\n date: z\n .string()\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/, 'date must be YYYY-MM-DD')\n .optional(),\n location: z.string().refine(maxGraphemes(256)).max(2560).optional(),\n mode: z.string().optional(),\n status: z.string().optional(),\n links: z.array(PresentationLinkSchema).max(20).optional(),\n // Optional reference to a community.lexicon.calendar.event for this occasion.\n eventRef: externalRecordRefSchema.optional(),\n createdAt: datetimeSchema,\n});\n\nexport type ProfilePresentationDeliveryRecord = z.infer<\n typeof ProfilePresentationDeliveryRecordSchema\n>;\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"]}
|
package/dist/schemas/index.d.cts
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
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';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Duration of a presentation, in minutes. Mirrors
|
|
6
|
+
* `id.sifa.profile.presentation#duration`: a fixed length (minMinutes only) or
|
|
7
|
+
* a range (minMinutes to maxMinutes).
|
|
8
|
+
*/
|
|
9
|
+
declare const PresentationDurationSchema: z.ZodObject<{
|
|
10
|
+
minMinutes: z.ZodNumber;
|
|
11
|
+
maxMinutes: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
type PresentationDuration = z.infer<typeof PresentationDurationSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* A related link for a presentation or one of its deliveries. Mirrors
|
|
16
|
+
* `id.sifa.defs#presentationLink`. `type` is an open enum (knownValues), so any
|
|
17
|
+
* string is accepted.
|
|
18
|
+
*/
|
|
19
|
+
declare const PresentationLinkSchema: z.ZodObject<{
|
|
20
|
+
uri: z.ZodString;
|
|
21
|
+
label: z.ZodOptional<z.ZodString>;
|
|
22
|
+
type: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
type PresentationLink = z.infer<typeof PresentationLinkSchema>;
|
|
25
|
+
/** Zod schema for `id.sifa.profile.presentation` records (the reusable content). */
|
|
26
|
+
declare const ProfilePresentationRecordSchema: z.ZodObject<{
|
|
27
|
+
title: z.ZodString;
|
|
28
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
duration: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
minMinutes: z.ZodNumber;
|
|
31
|
+
maxMinutes: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
intendedAudiences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
35
|
+
uri: z.ZodString;
|
|
36
|
+
label: z.ZodOptional<z.ZodString>;
|
|
37
|
+
type: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>>>;
|
|
39
|
+
writeupRef: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
uri: z.ZodString;
|
|
41
|
+
cid: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
createdAt: z.ZodString;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
type ProfilePresentationRecord = z.infer<typeof ProfilePresentationRecordSchema>;
|
|
46
|
+
|
|
4
47
|
/**
|
|
5
48
|
* Zod schema for `id.sifa.endorsement.confirmation` records.
|
|
6
49
|
* Lives in the endorsee's PDS to approve display of an endorsement.
|
|
@@ -185,6 +228,38 @@ declare const ProfilePositionRecordSchema: z.ZodObject<{
|
|
|
185
228
|
}, z.core.$strip>;
|
|
186
229
|
type ProfilePositionRecord = z.infer<typeof ProfilePositionRecordSchema>;
|
|
187
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Zod schema for `id.sifa.profile.presentationDelivery` records (one occasion
|
|
233
|
+
* on which a presentation was delivered). Works standalone or linked to a
|
|
234
|
+
* presentation and/or a calendar event. `role`, `mode`, and `status` are open
|
|
235
|
+
* enums (knownValues); `mode`/`status` store the full
|
|
236
|
+
* `community.lexicon.calendar.event` token.
|
|
237
|
+
*/
|
|
238
|
+
declare const ProfilePresentationDeliveryRecordSchema: z.ZodObject<{
|
|
239
|
+
presentationRef: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
uri: z.ZodString;
|
|
241
|
+
cid: z.ZodOptional<z.ZodString>;
|
|
242
|
+
}, z.core.$strip>>;
|
|
243
|
+
title: z.ZodOptional<z.ZodString>;
|
|
244
|
+
role: z.ZodOptional<z.ZodString>;
|
|
245
|
+
eventName: z.ZodOptional<z.ZodString>;
|
|
246
|
+
date: z.ZodOptional<z.ZodString>;
|
|
247
|
+
location: z.ZodOptional<z.ZodString>;
|
|
248
|
+
mode: z.ZodOptional<z.ZodString>;
|
|
249
|
+
status: z.ZodOptional<z.ZodString>;
|
|
250
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
251
|
+
uri: z.ZodString;
|
|
252
|
+
label: z.ZodOptional<z.ZodString>;
|
|
253
|
+
type: z.ZodOptional<z.ZodString>;
|
|
254
|
+
}, z.core.$strip>>>;
|
|
255
|
+
eventRef: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
uri: z.ZodString;
|
|
257
|
+
cid: z.ZodOptional<z.ZodString>;
|
|
258
|
+
}, z.core.$strip>>;
|
|
259
|
+
createdAt: z.ZodString;
|
|
260
|
+
}, z.core.$strip>;
|
|
261
|
+
type ProfilePresentationDeliveryRecord = z.infer<typeof ProfilePresentationDeliveryRecordSchema>;
|
|
262
|
+
|
|
188
263
|
/** Zod schema for `id.sifa.profile.project` records. */
|
|
189
264
|
declare const ProfileProjectRecordSchema: z.ZodObject<{
|
|
190
265
|
name: z.ZodString;
|
|
@@ -309,6 +384,16 @@ declare const strongRefSchema: z.ZodObject<{
|
|
|
309
384
|
uri: z.ZodString;
|
|
310
385
|
cid: z.ZodString;
|
|
311
386
|
}, z.core.$strip>;
|
|
387
|
+
/**
|
|
388
|
+
* Reference to a record by AT-URI, with an optional CID. Mirrors
|
|
389
|
+
* `id.sifa.defs#externalRecordRef`. Unlike a strongRef the CID is optional:
|
|
390
|
+
* consumers resolve the AT-URI live so the reference tracks edits to the
|
|
391
|
+
* target, and the CID is a best-effort integrity hint only.
|
|
392
|
+
*/
|
|
393
|
+
declare const externalRecordRefSchema: z.ZodObject<{
|
|
394
|
+
uri: z.ZodString;
|
|
395
|
+
cid: z.ZodOptional<z.ZodString>;
|
|
396
|
+
}, z.core.$strip>;
|
|
312
397
|
/**
|
|
313
398
|
* Self-labels shape from `com.atproto.label.defs#selfLabels`. Modelled
|
|
314
399
|
* permissively because clients rarely construct this directly; the AppView
|
|
@@ -321,4 +406,4 @@ declare const selfLabelsSchema: z.ZodObject<{
|
|
|
321
406
|
}, z.core.$strip>>;
|
|
322
407
|
}, z.core.$strip>;
|
|
323
408
|
|
|
324
|
-
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 };
|
|
409
|
+
export { type EndorsementConfirmationRecord, EndorsementConfirmationRecordSchema, type EndorsementRecord, EndorsementRecordSchema, type GraphFollowRecord, GraphFollowRecordSchema, type PresentationDuration, PresentationDurationSchema, type PresentationLink, PresentationLinkSchema, type ProfileCertificationRecord, ProfileCertificationRecordSchema, type ProfileCourseRecord, ProfileCourseRecordSchema, type ProfileEducationRecord, ProfileEducationRecordSchema, type ProfileExternalAccountRecord, ProfileExternalAccountRecordSchema, type ProfileHonorRecord, ProfileHonorRecordSchema, type ProfileLanguageRecord, ProfileLanguageRecordSchema, type ProfilePositionRecord, ProfilePositionRecordSchema, type ProfilePresentationDeliveryRecord, ProfilePresentationDeliveryRecordSchema, type ProfilePresentationRecord, ProfilePresentationRecordSchema, type ProfileProjectRecord, ProfileProjectRecordSchema, type ProfilePublicationRecord, ProfilePublicationRecordSchema, type ProfileSelfRecord, ProfileSelfRecordSchema, type ProfileSkillRecord, ProfileSkillRecordSchema, type ProfileVolunteeringRecord, ProfileVolunteeringRecordSchema, type PublicationAuthor, PublicationAuthorSchema, atUriSchema, cidSchema, datetimeSchema, didSchema, externalRecordRefSchema, languageTagSchema, makeGraphFollowRecordSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema };
|