@singi-labs/sifa-sdk 0.12.84 → 0.12.86
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-D0qELxvf.d.cts → index-jNyd5QP7.d.cts} +6 -0
- package/dist/{index-D0qELxvf.d.ts → index-jNyd5QP7.d.ts} +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jsonld/index.d.cts +1 -1
- package/dist/jsonld/index.d.ts +1 -1
- package/dist/{network-map-C5AnjGcV.d.ts → network-map-GfIVEYpr.d.ts} +4 -4
- package/dist/{network-map-CkRrVFJD.d.cts → network-map-y6U7m-hX.d.cts} +4 -4
- package/dist/{org-Be8tayoD.d.cts → org-ClDqS3CM.d.cts} +18 -3
- package/dist/{org-B2Y54EHg.d.ts → org-GlACA06R.d.ts} +18 -3
- package/dist/{profile-summary-Fieyfzzf.d.ts → profile-summary-8fapqzHv.d.ts} +1 -1
- package/dist/{profile-summary-CIkWTi6K.d.cts → profile-summary-DY78IoL9.d.cts} +1 -1
- package/dist/publishing/index.cjs +40 -0
- package/dist/publishing/index.cjs.map +1 -1
- package/dist/publishing/index.d.cts +58 -1
- package/dist/publishing/index.d.ts +58 -1
- package/dist/publishing/index.js +38 -1
- package/dist/publishing/index.js.map +1 -1
- package/dist/query/fetchers/index.cjs +30 -0
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +6 -6
- package/dist/query/fetchers/index.d.ts +6 -6
- package/dist/query/fetchers/index.js +29 -1
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +62 -0
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.d.cts +5 -5
- package/dist/query/hooks/index.d.ts +5 -5
- package/dist/query/hooks/index.js +61 -1
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/index.cjs +64 -0
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +8 -8
- package/dist/query/index.d.ts +8 -8
- package/dist/query/index.js +61 -1
- package/dist/query/index.js.map +1 -1
- package/dist/{types-ClxJ0I98.d.ts → types-8JaS6abh.d.ts} +1 -1
- package/dist/{types-BEei3kVS.d.cts → types-8wAWvS-T.d.cts} +1 -1
- package/dist/{use-org-notification-emails-BdglyA2S.d.cts → use-org-notification-emails-B-oGiDHo.d.cts} +11 -4
- package/dist/{use-org-notification-emails-1ZD4ycgg.d.ts → use-org-notification-emails-DGzW9MH6.d.ts} +11 -4
- package/package.json +1 -1
package/dist/jsonld/index.d.cts
CHANGED
package/dist/jsonld/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as Profile, d as ProfilePosition, S as SkillRef } from './index-
|
|
2
|
-
import { S as SifaApiConfig, A as ApiFetchOptions, C as CreateResult, W as WriteResult } from './org-
|
|
3
|
-
import { n as ProfileView } from './types-
|
|
4
|
-
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-
|
|
1
|
+
import { c as Profile, d as ProfilePosition, S as SkillRef } from './index-jNyd5QP7.js';
|
|
2
|
+
import { S as SifaApiConfig, A as ApiFetchOptions, C as CreateResult, W as WriteResult } from './org-GlACA06R.js';
|
|
3
|
+
import { n as ProfileView } from './types-8JaS6abh.js';
|
|
4
|
+
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-8fapqzHv.js';
|
|
5
5
|
import { j as EntitySearchResponse, E as EntitySearchResult, d as EntityMintDomainResponse, h as EntityResolveDomainResponse, m as EntitySelectRequest, o as EntitySelectResponse } from './feed-BMm9Pkew.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as Profile, d as ProfilePosition, S as SkillRef } from './index-
|
|
2
|
-
import { S as SifaApiConfig, A as ApiFetchOptions, C as CreateResult, W as WriteResult } from './org-
|
|
3
|
-
import { n as ProfileView } from './types-
|
|
4
|
-
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-
|
|
1
|
+
import { c as Profile, d as ProfilePosition, S as SkillRef } from './index-jNyd5QP7.cjs';
|
|
2
|
+
import { S as SifaApiConfig, A as ApiFetchOptions, C as CreateResult, W as WriteResult } from './org-ClDqS3CM.cjs';
|
|
3
|
+
import { n as ProfileView } from './types-8wAWvS-T.cjs';
|
|
4
|
+
import { S as SummarizeProfileViewOptions, P as ProfileSummary } from './profile-summary-DY78IoL9.cjs';
|
|
5
5
|
import { j as EntitySearchResponse, E as EntitySearchResult, d as EntityMintDomainResponse, h as EntityResolveDomainResponse, m as EntitySelectRequest, o as EntitySelectResponse } from './feed-BMm9Pkew.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as ExternalAccount, Q as SkillSuggestion } from './index-
|
|
1
|
+
import { p as ExternalAccount, Q as SkillSuggestion } from './index-jNyd5QP7.cjs';
|
|
2
2
|
import { y as FollowFeedPage, B as FollowProfileItem, q as FeatureAllowlistEntry, s as FeatureFlag } from './feed-BMm9Pkew.cjs';
|
|
3
|
-
import { b as ActivityLabel, t as RepoDeleteResult, w as RepoInventory } from './types-
|
|
3
|
+
import { b as ActivityLabel, t as RepoDeleteResult, w as RepoInventory } from './types-8wAWvS-T.cjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { d as OrgNotificationEmailRequestInput, b as OrgDomainChallengeRequestInput, O as OrgClaimRequestInput, a as OrgProfileUpdateRequestInput, c as OrgDomainVerifyRequestInput } from './org-settings-CZ_tmAYl.cjs';
|
|
6
6
|
|
|
@@ -192,6 +192,21 @@ interface UploadAvatarResult extends WriteResult {
|
|
|
192
192
|
declare function uploadAvatar(config: SifaApiConfig, file: Blob, options?: ApiFetchOptions): Promise<UploadAvatarResult>;
|
|
193
193
|
/** Delete the authenticated user's avatar override (revert to PDS avatar). */
|
|
194
194
|
declare function deleteAvatarOverride(config: SifaApiConfig, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
195
|
+
/** Extended result for {@link uploadNamePronunciationAudio}. */
|
|
196
|
+
interface UploadPronunciationAudioResult extends WriteResult {
|
|
197
|
+
/** Publicly accessible URL of the newly uploaded audio clip. */
|
|
198
|
+
url?: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Upload a name-pronunciation audio clip via `multipart/form-data`. Pass a
|
|
202
|
+
* `File` (browser) or any `Blob` (Expo, node). The SDK leaves `Content-Type`
|
|
203
|
+
* unset so the runtime sets the multipart boundary automatically.
|
|
204
|
+
*
|
|
205
|
+
* Never throws -- inspect `result.success` and `result.url`.
|
|
206
|
+
*/
|
|
207
|
+
declare function uploadNamePronunciationAudio(config: SifaApiConfig, file: Blob, options?: ApiFetchOptions): Promise<UploadPronunciationAudioResult>;
|
|
208
|
+
/** Delete the name-pronunciation audio clip from the user's profile. */
|
|
209
|
+
declare function deleteNamePronunciationAudio(config: SifaApiConfig, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
195
210
|
|
|
196
211
|
/**
|
|
197
212
|
* Create a new `id.sifa.profile.skill` record on the authenticated
|
|
@@ -1660,4 +1675,4 @@ declare function addOrgNotificationEmail(config: SifaApiConfig, body: OrgNotific
|
|
|
1660
1675
|
*/
|
|
1661
1676
|
declare function removeOrgNotificationEmail(config: SifaApiConfig, body: OrgNotificationEmailRequestInput, options?: Omit<ApiFetchOptions, 'method' | 'body'>): Promise<WriteResult & Partial<OrgNotificationEmailRemoveResult>>;
|
|
1662
1677
|
|
|
1663
|
-
export { type ListFeatureAllowlistOptions as $, type ApiFetchOptions as A, type BulkHideProfileItemInput as B, type CreateResult as C, type DeleteAccountResult as D, type EndorsementInput as E, type FeatureAllowlistResponse as F, type FetchReactionStatusOptions as G, type FetchSuggestionsOptions as H, type FilterOptions as I, type FollowListPage as J, type FollowProfile as K, type FollowProfilePageResponse as L, type FollowUserResult as M, type FollowingResponse as N, type GetAdminReviewQueuesOptions as O, type GithubPullRequest as P, type GivenConfirmation as Q, HIDDEN_ITEM_SOURCES as R, type SifaApiConfig as S, HIDDEN_ITEM_TYPES as T, type HeatmapDay as U, type HeatmapResponse as V, type WriteResult as W, type HiddenApp as X, type HiddenItemSource as Y, type HiddenItemType as Z, type HideProfileItemInput as _, type ConfirmEndorsementInput as a,
|
|
1678
|
+
export { type ListFeatureAllowlistOptions as $, type ApiFetchOptions as A, type BulkHideProfileItemInput as B, type CreateResult as C, type DeleteAccountResult as D, type EndorsementInput as E, type FeatureAllowlistResponse as F, type FetchReactionStatusOptions as G, type FetchSuggestionsOptions as H, type FilterOptions as I, type FollowListPage as J, type FollowProfile as K, type FollowProfilePageResponse as L, type FollowUserResult as M, type FollowingResponse as N, type GetAdminReviewQueuesOptions as O, type GithubPullRequest as P, type GivenConfirmation as Q, HIDDEN_ITEM_SOURCES as R, type SifaApiConfig as S, HIDDEN_ITEM_TYPES as T, type HeatmapDay as U, type HeatmapResponse as V, type WriteResult as W, type HiddenApp as X, type HiddenItemSource as Y, type HiddenItemType as Z, type HideProfileItemInput as _, type ConfirmEndorsementInput as a, createEndorsement as a$, type MyGithubPullRequestsResponse as a0, type OrgClaimBinding as a1, type OrgClaimResult as a2, type OrgDomainChallengeResult as a3, type OrgDomainVerifyResult as a4, type OrgNotificationEmailAddResult as a5, type OrgNotificationEmailRemoveResult as a6, type OrgProfileEcho as a7, type OrgProfileUpdateResult as a8, type PdsWipeOutcome as a9, type SifaQueryKey as aA, type SimilarProfile as aB, type SkillSearchResult as aC, type StatsResponse as aD, type SubCategoryBulkResult as aE, type SuggestionProfile as aF, type SuggestionsResponse as aG, type UpdateProfileOverrideInput as aH, type UpdateProfileSelfInput as aI, type UploadAvatarResult as aJ, type UploadPronunciationAudioResult as aK, type VerifyExternalAccountResult as aL, type WipePreview as aM, addFeatureAllowlist as aN, addOrgNotificationEmail as aO, apiFetch as aP, apiFetchOrNull as aQ, apiWrite as aR, apiWriteCreate as aS, bulkHideProfileItems as aT, bulkHideStandardPublications as aU, bulkUnhideProfileItems as aV, bulkUnhideStandardPublications as aW, castRoadmapVote as aX, checkAppAccount as aY, confirmEndorsement as aZ, createConfirmation as a_, type PendingConfirmation as aa, type PendingConfirmationsPage as ab, type ProfileIndustryInput as ac, type ProfileLocationAddress as ad, type ProfileLocationInput as ae, type ProfileSearchResult as af, type ProfileSelfLocation as ag, QUOTED_POSTS_BATCH_MAX as ah, type QuotedPostAuthor as ai, type QuotedPostImage as aj, type QuotedPostResult as ak, type QuotedPostView as al, type ReactionError as am, type ReactionResult as an, type ReactionStatus as ao, type RefreshOrcidPublicationsResult as ap, type RefreshPdsResult as aq, type RepoDeleteInput as ar, type ResetProfileResult as as, type ResolveQuotedPostsOptions as at, type RoadmapVoteError as au, type RoadmapVoteResult as av, type RoadmapVoter as aw, type RoadmapVotesResponse as ax, type SearchFilters as ay, type SearchResponse as az, type ConfirmEndorsementResult as b, unhideProfileItem as b$, createExternalAccount as b0, createProfileLocation as b1, createReaction as b2, createSkill as b3, deleteAccount as b4, deleteAvatarOverride as b5, deleteExternalAccount as b6, deleteNamePronunciationAudio as b7, deleteProfileLocation as b8, deleteReaction as b9, followUser as bA, getAdminReviewQueues as bB, getBlueskySuggestions as bC, getFollowers as bD, getFollowing as bE, getFollowingFeed as bF, getMutuals as bG, hideOrcidPublication as bH, hideProfileItem as bI, hideSifaPublication as bJ, hideStandardPublication as bK, listFeatureAllowlist as bL, refreshOrcidPublications as bM, refreshPds as bN, removeFeatureAllowlist as bO, removeOrgNotificationEmail as bP, repoExportUrl as bQ, requestOrgDomainChallenge as bR, resetProfile as bS, resolveQuotedPosts as bT, retractRoadmapVote as bU, revokeConfirmation as bV, searchSkills as bW, setExternalAccountPrimary as bX, submitOrgClaim as bY, unfollowUser as bZ, unhideOrcidPublication as b_, deleteRepoRecords as ba, deleteSkill as bb, dismissConfirmation as bc, fetchActivityFeed as bd, fetchActivityTeaser as be, fetchAppsRegistry as bf, fetchExternalAccounts as bg, fetchFeaturedProfile as bh, fetchFollowing as bi, fetchGivenConfirmations as bj, fetchHeatmapData as bk, fetchHiddenApps as bl, fetchMyGithubPullRequests as bm, fetchMyRoadmapVotes as bn, fetchPendingConfirmations as bo, fetchReactionStatus as bp, fetchRepoInventory as bq, fetchRoadmapVotes as br, fetchSearchFilters as bs, fetchSearchProfiles as bt, fetchSimilarProfiles as bu, fetchSkillSuggestions as bv, fetchStats as bw, fetchSuggestionCount as bx, fetchSuggestions as by, fetchWipePreview as bz, type AccountCheckResult as c, unhideSifaPublication as c0, unhideStandardPublication as c1, unsetExternalAccountPrimary as c2, updateExternalAccount as c3, updateOrgProfile as c4, updateProfileLocation as c5, updateProfileOverride as c6, updateProfileSelf as c7, updateSkill as c8, updateSkillSubCategories as c9, uploadAvatar as ca, uploadNamePronunciationAudio as cb, verifyExternalAccount as cc, verifyOrgDomain as cd, type CompanySearchFilters as ce, type CompanySearchResponse as cf, type CompanySearchResult as cg, fetchSearchCompanies as ch, type ActivityFeedResponse as d, type ActivityItem as e, type ActivityItemLinkHealth as f, type ActivityTeaserResponse as g, type AdminReviewQueues as h, ApiError as i, type AppRegistryEntry as j, type CastRoadmapVoteResult as k, type CheckAppAccountOptions as l, type ConfirmationInput as m, type ConfirmationSubjectInput as n, type CreateExternalAccountResult as o, type ExternalAccountInput as p, type FeaturedProfile as q, type FetchActivityFeedOptions as r, sifaQueryKeys as s, type FetchActivityTeaserOptions as t, type FetchFollowListOptions as u, type FetchFollowProfilePageOptions as v, type FetchFollowingFeedOptions as w, type FetchHiddenAppsOptions as x, type FetchMyGithubPullRequestsOptions as y, type FetchMyRoadmapVotesOptions as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as ExternalAccount, Q as SkillSuggestion } from './index-
|
|
1
|
+
import { p as ExternalAccount, Q as SkillSuggestion } from './index-jNyd5QP7.js';
|
|
2
2
|
import { y as FollowFeedPage, B as FollowProfileItem, q as FeatureAllowlistEntry, s as FeatureFlag } from './feed-BMm9Pkew.js';
|
|
3
|
-
import { b as ActivityLabel, t as RepoDeleteResult, w as RepoInventory } from './types-
|
|
3
|
+
import { b as ActivityLabel, t as RepoDeleteResult, w as RepoInventory } from './types-8JaS6abh.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { d as OrgNotificationEmailRequestInput, b as OrgDomainChallengeRequestInput, O as OrgClaimRequestInput, a as OrgProfileUpdateRequestInput, c as OrgDomainVerifyRequestInput } from './org-settings-CZ_tmAYl.js';
|
|
6
6
|
|
|
@@ -192,6 +192,21 @@ interface UploadAvatarResult extends WriteResult {
|
|
|
192
192
|
declare function uploadAvatar(config: SifaApiConfig, file: Blob, options?: ApiFetchOptions): Promise<UploadAvatarResult>;
|
|
193
193
|
/** Delete the authenticated user's avatar override (revert to PDS avatar). */
|
|
194
194
|
declare function deleteAvatarOverride(config: SifaApiConfig, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
195
|
+
/** Extended result for {@link uploadNamePronunciationAudio}. */
|
|
196
|
+
interface UploadPronunciationAudioResult extends WriteResult {
|
|
197
|
+
/** Publicly accessible URL of the newly uploaded audio clip. */
|
|
198
|
+
url?: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Upload a name-pronunciation audio clip via `multipart/form-data`. Pass a
|
|
202
|
+
* `File` (browser) or any `Blob` (Expo, node). The SDK leaves `Content-Type`
|
|
203
|
+
* unset so the runtime sets the multipart boundary automatically.
|
|
204
|
+
*
|
|
205
|
+
* Never throws -- inspect `result.success` and `result.url`.
|
|
206
|
+
*/
|
|
207
|
+
declare function uploadNamePronunciationAudio(config: SifaApiConfig, file: Blob, options?: ApiFetchOptions): Promise<UploadPronunciationAudioResult>;
|
|
208
|
+
/** Delete the name-pronunciation audio clip from the user's profile. */
|
|
209
|
+
declare function deleteNamePronunciationAudio(config: SifaApiConfig, options?: ApiFetchOptions): Promise<WriteResult>;
|
|
195
210
|
|
|
196
211
|
/**
|
|
197
212
|
* Create a new `id.sifa.profile.skill` record on the authenticated
|
|
@@ -1660,4 +1675,4 @@ declare function addOrgNotificationEmail(config: SifaApiConfig, body: OrgNotific
|
|
|
1660
1675
|
*/
|
|
1661
1676
|
declare function removeOrgNotificationEmail(config: SifaApiConfig, body: OrgNotificationEmailRequestInput, options?: Omit<ApiFetchOptions, 'method' | 'body'>): Promise<WriteResult & Partial<OrgNotificationEmailRemoveResult>>;
|
|
1662
1677
|
|
|
1663
|
-
export { type ListFeatureAllowlistOptions as $, type ApiFetchOptions as A, type BulkHideProfileItemInput as B, type CreateResult as C, type DeleteAccountResult as D, type EndorsementInput as E, type FeatureAllowlistResponse as F, type FetchReactionStatusOptions as G, type FetchSuggestionsOptions as H, type FilterOptions as I, type FollowListPage as J, type FollowProfile as K, type FollowProfilePageResponse as L, type FollowUserResult as M, type FollowingResponse as N, type GetAdminReviewQueuesOptions as O, type GithubPullRequest as P, type GivenConfirmation as Q, HIDDEN_ITEM_SOURCES as R, type SifaApiConfig as S, HIDDEN_ITEM_TYPES as T, type HeatmapDay as U, type HeatmapResponse as V, type WriteResult as W, type HiddenApp as X, type HiddenItemSource as Y, type HiddenItemType as Z, type HideProfileItemInput as _, type ConfirmEndorsementInput as a,
|
|
1678
|
+
export { type ListFeatureAllowlistOptions as $, type ApiFetchOptions as A, type BulkHideProfileItemInput as B, type CreateResult as C, type DeleteAccountResult as D, type EndorsementInput as E, type FeatureAllowlistResponse as F, type FetchReactionStatusOptions as G, type FetchSuggestionsOptions as H, type FilterOptions as I, type FollowListPage as J, type FollowProfile as K, type FollowProfilePageResponse as L, type FollowUserResult as M, type FollowingResponse as N, type GetAdminReviewQueuesOptions as O, type GithubPullRequest as P, type GivenConfirmation as Q, HIDDEN_ITEM_SOURCES as R, type SifaApiConfig as S, HIDDEN_ITEM_TYPES as T, type HeatmapDay as U, type HeatmapResponse as V, type WriteResult as W, type HiddenApp as X, type HiddenItemSource as Y, type HiddenItemType as Z, type HideProfileItemInput as _, type ConfirmEndorsementInput as a, createEndorsement as a$, type MyGithubPullRequestsResponse as a0, type OrgClaimBinding as a1, type OrgClaimResult as a2, type OrgDomainChallengeResult as a3, type OrgDomainVerifyResult as a4, type OrgNotificationEmailAddResult as a5, type OrgNotificationEmailRemoveResult as a6, type OrgProfileEcho as a7, type OrgProfileUpdateResult as a8, type PdsWipeOutcome as a9, type SifaQueryKey as aA, type SimilarProfile as aB, type SkillSearchResult as aC, type StatsResponse as aD, type SubCategoryBulkResult as aE, type SuggestionProfile as aF, type SuggestionsResponse as aG, type UpdateProfileOverrideInput as aH, type UpdateProfileSelfInput as aI, type UploadAvatarResult as aJ, type UploadPronunciationAudioResult as aK, type VerifyExternalAccountResult as aL, type WipePreview as aM, addFeatureAllowlist as aN, addOrgNotificationEmail as aO, apiFetch as aP, apiFetchOrNull as aQ, apiWrite as aR, apiWriteCreate as aS, bulkHideProfileItems as aT, bulkHideStandardPublications as aU, bulkUnhideProfileItems as aV, bulkUnhideStandardPublications as aW, castRoadmapVote as aX, checkAppAccount as aY, confirmEndorsement as aZ, createConfirmation as a_, type PendingConfirmation as aa, type PendingConfirmationsPage as ab, type ProfileIndustryInput as ac, type ProfileLocationAddress as ad, type ProfileLocationInput as ae, type ProfileSearchResult as af, type ProfileSelfLocation as ag, QUOTED_POSTS_BATCH_MAX as ah, type QuotedPostAuthor as ai, type QuotedPostImage as aj, type QuotedPostResult as ak, type QuotedPostView as al, type ReactionError as am, type ReactionResult as an, type ReactionStatus as ao, type RefreshOrcidPublicationsResult as ap, type RefreshPdsResult as aq, type RepoDeleteInput as ar, type ResetProfileResult as as, type ResolveQuotedPostsOptions as at, type RoadmapVoteError as au, type RoadmapVoteResult as av, type RoadmapVoter as aw, type RoadmapVotesResponse as ax, type SearchFilters as ay, type SearchResponse as az, type ConfirmEndorsementResult as b, unhideProfileItem as b$, createExternalAccount as b0, createProfileLocation as b1, createReaction as b2, createSkill as b3, deleteAccount as b4, deleteAvatarOverride as b5, deleteExternalAccount as b6, deleteNamePronunciationAudio as b7, deleteProfileLocation as b8, deleteReaction as b9, followUser as bA, getAdminReviewQueues as bB, getBlueskySuggestions as bC, getFollowers as bD, getFollowing as bE, getFollowingFeed as bF, getMutuals as bG, hideOrcidPublication as bH, hideProfileItem as bI, hideSifaPublication as bJ, hideStandardPublication as bK, listFeatureAllowlist as bL, refreshOrcidPublications as bM, refreshPds as bN, removeFeatureAllowlist as bO, removeOrgNotificationEmail as bP, repoExportUrl as bQ, requestOrgDomainChallenge as bR, resetProfile as bS, resolveQuotedPosts as bT, retractRoadmapVote as bU, revokeConfirmation as bV, searchSkills as bW, setExternalAccountPrimary as bX, submitOrgClaim as bY, unfollowUser as bZ, unhideOrcidPublication as b_, deleteRepoRecords as ba, deleteSkill as bb, dismissConfirmation as bc, fetchActivityFeed as bd, fetchActivityTeaser as be, fetchAppsRegistry as bf, fetchExternalAccounts as bg, fetchFeaturedProfile as bh, fetchFollowing as bi, fetchGivenConfirmations as bj, fetchHeatmapData as bk, fetchHiddenApps as bl, fetchMyGithubPullRequests as bm, fetchMyRoadmapVotes as bn, fetchPendingConfirmations as bo, fetchReactionStatus as bp, fetchRepoInventory as bq, fetchRoadmapVotes as br, fetchSearchFilters as bs, fetchSearchProfiles as bt, fetchSimilarProfiles as bu, fetchSkillSuggestions as bv, fetchStats as bw, fetchSuggestionCount as bx, fetchSuggestions as by, fetchWipePreview as bz, type AccountCheckResult as c, unhideSifaPublication as c0, unhideStandardPublication as c1, unsetExternalAccountPrimary as c2, updateExternalAccount as c3, updateOrgProfile as c4, updateProfileLocation as c5, updateProfileOverride as c6, updateProfileSelf as c7, updateSkill as c8, updateSkillSubCategories as c9, uploadAvatar as ca, uploadNamePronunciationAudio as cb, verifyExternalAccount as cc, verifyOrgDomain as cd, type CompanySearchFilters as ce, type CompanySearchResponse as cf, type CompanySearchResult as cg, fetchSearchCompanies as ch, type ActivityFeedResponse as d, type ActivityItem as e, type ActivityItemLinkHealth as f, type ActivityTeaserResponse as g, type AdminReviewQueues as h, ApiError as i, type AppRegistryEntry as j, type CastRoadmapVoteResult as k, type CheckAppAccountOptions as l, type ConfirmationInput as m, type ConfirmationSubjectInput as n, type CreateExternalAccountResult as o, type ExternalAccountInput as p, type FeaturedProfile as q, type FetchActivityFeedOptions as r, sifaQueryKeys as s, type FetchActivityTeaserOptions as t, type FetchFollowListOptions as u, type FetchFollowProfilePageOptions as v, type FetchFollowingFeedOptions as w, type FetchHiddenAppsOptions as x, type FetchMyGithubPullRequestsOptions as y, type FetchMyRoadmapVotesOptions as z };
|
|
@@ -120,6 +120,43 @@ function matchPublisherByUri(uri) {
|
|
|
120
120
|
return matchPublisherByHost(hostFromUri(uri));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
// src/publishing/linkblog.ts
|
|
124
|
+
var SKYREADER_LINKBLOG_MARKER_URL = "https://skyreader.app/linkblog";
|
|
125
|
+
function isRecord(value) {
|
|
126
|
+
return typeof value === "object" && value !== null;
|
|
127
|
+
}
|
|
128
|
+
function hasLinkblogMarker(record) {
|
|
129
|
+
const marker = record.skyreaderLinkblog;
|
|
130
|
+
return typeof marker === "string" && marker.length > 0;
|
|
131
|
+
}
|
|
132
|
+
function hostOf(uri) {
|
|
133
|
+
try {
|
|
134
|
+
return new URL(uri).host.toLowerCase();
|
|
135
|
+
} catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function isLinkblogPublication(record) {
|
|
140
|
+
return isRecord(record) && hasLinkblogMarker(record);
|
|
141
|
+
}
|
|
142
|
+
function isLinkblogShareDocument(record, opts = {}) {
|
|
143
|
+
if (!isRecord(record)) return false;
|
|
144
|
+
if (hasLinkblogMarker(record)) return true;
|
|
145
|
+
if (opts.publicationIsLinkblog === true) return true;
|
|
146
|
+
const links = record.links;
|
|
147
|
+
if (!Array.isArray(links)) return false;
|
|
148
|
+
const pubHost = opts.publicationHost?.toLowerCase();
|
|
149
|
+
for (const link of links) {
|
|
150
|
+
if (!isRecord(link) || typeof link.rel !== "string") continue;
|
|
151
|
+
if (link.rel === "repost") return true;
|
|
152
|
+
if (link.rel === "related" && pubHost && typeof link.uri === "string") {
|
|
153
|
+
const linkHost = hostOf(link.uri);
|
|
154
|
+
if (linkHost && linkHost !== pubHost) return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
123
160
|
// src/publishing/types.ts
|
|
124
161
|
var STANDARD_SITE_PUBLICATION_NSID = "site.standard.publication";
|
|
125
162
|
var STANDARD_SITE_DOCUMENT_NSID = "site.standard.document";
|
|
@@ -144,6 +181,7 @@ function hasStandardSiteAssociatedRef(refs) {
|
|
|
144
181
|
}
|
|
145
182
|
|
|
146
183
|
exports.BasicThemeSchema = BasicThemeSchema;
|
|
184
|
+
exports.SKYREADER_LINKBLOG_MARKER_URL = SKYREADER_LINKBLOG_MARKER_URL;
|
|
147
185
|
exports.STANDARD_SITE_AUTH_SOCIAL_NSID = STANDARD_SITE_AUTH_SOCIAL_NSID;
|
|
148
186
|
exports.STANDARD_SITE_DOCUMENT_NSID = STANDARD_SITE_DOCUMENT_NSID;
|
|
149
187
|
exports.STANDARD_SITE_PUBLICATION_NSID = STANDARD_SITE_PUBLICATION_NSID;
|
|
@@ -156,6 +194,8 @@ exports.StandardSiteRecommendRecordSchema = StandardSiteRecommendRecordSchema;
|
|
|
156
194
|
exports.StandardSiteSubscriptionRecordSchema = StandardSiteSubscriptionRecordSchema;
|
|
157
195
|
exports.hasStandardSiteAssociatedRef = hasStandardSiteAssociatedRef;
|
|
158
196
|
exports.hostMatches = hostMatches;
|
|
197
|
+
exports.isLinkblogPublication = isLinkblogPublication;
|
|
198
|
+
exports.isLinkblogShareDocument = isLinkblogShareDocument;
|
|
159
199
|
exports.isStandardSiteAtUri = isStandardSiteAtUri;
|
|
160
200
|
exports.matchPublisherByHost = matchPublisherByHost;
|
|
161
201
|
exports.matchPublisherByUri = matchPublisherByUri;
|
|
@@ -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,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;AAWjCA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,mCAAmC,mDAAmD;AAGxF,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;AAQ6BA,MAAE,MAAA,CAAO;AAA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AA,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/**\n * Freeform calendar date for user-facing profile dates (start/end, issued,\n * completed, awarded, published, etc.). Accepts a bare year, year-month,\n * year-month-day, or a full datetime (so a legacy record's RFC-3339 date maps\n * through on backfill without loss). NOT strict `datetime` -- users typically\n * remember only month/year, and LinkedIn-importer writes carry partial dates,\n * so the lexicons document these as freeform `YYYY-MM` / `YYYY-MM-DD`. Record\n * metadata like `createdAt` stays on `datetimeSchema`.\n */\nexport const partialDateSchema = z\n .string()\n .regex(/^\\d{4}(-\\d{2}(-\\d{2}(T.+)?)?)?$/, 'Expected YYYY, YYYY-MM, YYYY-MM-DD, or a datetime');\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 an `id.sifa.profile.skill` record by AT-URI. Mirrors\n * `id.sifa.defs#skillRef`, which carries no CID at all: skills are mutable\n * records in the same user's repo, so the reference resolves live and tracks\n * edits to the target.\n */\nexport const skillRefSchema = z.object({\n uri: atUriSchema,\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"]}
|
|
1
|
+
{"version":3,"sources":["../../src/schemas/shared.ts","../../src/publishing/schemas.ts","../../src/publishing/registry.ts","../../src/publishing/linkblog.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;AAWjCA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,mCAAmC,mDAAmD;AAGxF,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,K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Q,QAAA,EAAU,OAAO,IAAA;AAGlC,IAAA,IAAI,KAAK,GAAA,KAAQ,SAAA,IAAa,WAAW,OAAO,IAAA,CAAK,QAAQ,QAAA,EAAU;AACrE,MAAA,MAAM,QAAA,GAAW,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA;AAChC,MAAA,IAAI,QAAA,IAAY,QAAA,KAAa,OAAA,EAAS,OAAO,IAAA;AAAA,IAC/C;AAAA,EACF;AAEA,EAAA,OAAO,KAAA;AACT;;;ACrEO,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/**\n * Freeform calendar date for user-facing profile dates (start/end, issued,\n * completed, awarded, published, etc.). Accepts a bare year, year-month,\n * year-month-day, or a full datetime (so a legacy record's RFC-3339 date maps\n * through on backfill without loss). NOT strict `datetime` -- users typically\n * remember only month/year, and LinkedIn-importer writes carry partial dates,\n * so the lexicons document these as freeform `YYYY-MM` / `YYYY-MM-DD`. Record\n * metadata like `createdAt` stays on `datetimeSchema`.\n */\nexport const partialDateSchema = z\n .string()\n .regex(/^\\d{4}(-\\d{2}(-\\d{2}(T.+)?)?)?$/, 'Expected YYYY, YYYY-MM, YYYY-MM-DD, or a datetime');\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 an `id.sifa.profile.skill` record by AT-URI. Mirrors\n * `id.sifa.defs#skillRef`, which carries no CID at all: skills are mutable\n * records in the same user's repo, so the reference resolves live and tracks\n * edits to the target.\n */\nexport const skillRefSchema = z.object({\n uri: atUriSchema,\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","/**\n * Linkblog-share detection for the Standard.site document family.\n *\n * A \"linkblog\" (e.g. Skyreader) writes a `site.standard.document` to the\n * user's PDS for every *external* article they share. Those documents are\n * valid Standard.site posts, so they surface in Sifa's activity stream and\n * profile portfolio as if the user authored them — but the user only shared\n * someone else's writing (sifa-workspace#351).\n *\n * These predicates identify such shares so callers can exclude them, while\n * leaving genuinely authored Standard.site posts (Leaflet, pckt, Offprint\n * essays) untouched.\n *\n * Signals, most to least reliable:\n * 1. The Skyreader provenance marker on the document (`skyreaderLinkblog`).\n * 2. The document's parent publication is itself a linkblog (the marker\n * lives on the publication even when older documents lack their own).\n * Callers resolve the publication and pass `publicationIsLinkblog`.\n * 3. A `links` entry with `rel: \"repost\"` — a quote-reshare, inherently\n * not the user's own writing.\n * 4. Heuristic: a `links` entry with `rel: \"related\"` pointing to an\n * external host different from the document's own publication host —\n * the document's subject is an off-site article. Only applied when the\n * caller supplies the resolved `publicationHost`, so an authored post\n * that merely cites an external resource is never hidden on a guess.\n */\n\n/**\n * Discovery marker Skyreader stamps on every linkblog publication and on\n * link-share documents. Value is a fixed URL, not a per-user value.\n */\nexport const SKYREADER_LINKBLOG_MARKER_URL = 'https://skyreader.app/linkblog';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/** A non-empty `skyreaderLinkblog` marker field. */\nfunction hasLinkblogMarker(record: Record<string, unknown>): boolean {\n const marker = record.skyreaderLinkblog;\n return typeof marker === 'string' && marker.length > 0;\n}\n\nfunction hostOf(uri: string): string | null {\n try {\n return new URL(uri).host.toLowerCase();\n } catch {\n return null;\n }\n}\n\n/**\n * True when a `site.standard.publication` record is a linkblog rather than an\n * authored publication — i.e. it carries the Skyreader provenance marker.\n */\nexport function isLinkblogPublication(record: unknown): boolean {\n return isRecord(record) && hasLinkblogMarker(record);\n}\n\nexport interface LinkblogShareOptions {\n /**\n * True when the document's parent publication has been resolved and is\n * itself a linkblog (see {@link isLinkblogPublication}). Catches shares\n * whose document predates the per-document marker.\n */\n publicationIsLinkblog?: boolean;\n /**\n * Resolved host of the document's parent publication, enabling the\n * external-subject heuristic. Omit when the publication (hence its host)\n * could not be resolved — the heuristic then stays off.\n */\n publicationHost?: string;\n}\n\n/**\n * True when a `site.standard.document` is a shared/linkblogged external\n * article rather than the user's own writing. See the module comment for the\n * signal order.\n */\nexport function isLinkblogShareDocument(record: unknown, opts: LinkblogShareOptions = {}): boolean {\n if (!isRecord(record)) return false;\n\n // 1. Provenance marker on the document itself.\n if (hasLinkblogMarker(record)) return true;\n\n // 2. Parent publication is a linkblog (caller-resolved).\n if (opts.publicationIsLinkblog === true) return true;\n\n const links = record.links;\n if (!Array.isArray(links)) return false;\n\n const pubHost = opts.publicationHost?.toLowerCase();\n for (const link of links) {\n if (!isRecord(link) || typeof link.rel !== 'string') continue;\n\n // 3. Reshare of another record.\n if (link.rel === 'repost') return true;\n\n // 4. External-subject heuristic (only with a known publication host).\n if (link.rel === 'related' && pubHost && typeof link.uri === 'string') {\n const linkHost = hostOf(link.uri);\n if (linkHost && linkHost !== pubHost) return true;\n }\n }\n\n return false;\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"]}
|
|
@@ -189,6 +189,63 @@ declare function matchPublisherByHost(host: string | null | undefined): Publishe
|
|
|
189
189
|
*/
|
|
190
190
|
declare function matchPublisherByUri(uri: string | undefined | null): Publisher | null;
|
|
191
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Linkblog-share detection for the Standard.site document family.
|
|
194
|
+
*
|
|
195
|
+
* A "linkblog" (e.g. Skyreader) writes a `site.standard.document` to the
|
|
196
|
+
* user's PDS for every *external* article they share. Those documents are
|
|
197
|
+
* valid Standard.site posts, so they surface in Sifa's activity stream and
|
|
198
|
+
* profile portfolio as if the user authored them — but the user only shared
|
|
199
|
+
* someone else's writing (sifa-workspace#351).
|
|
200
|
+
*
|
|
201
|
+
* These predicates identify such shares so callers can exclude them, while
|
|
202
|
+
* leaving genuinely authored Standard.site posts (Leaflet, pckt, Offprint
|
|
203
|
+
* essays) untouched.
|
|
204
|
+
*
|
|
205
|
+
* Signals, most to least reliable:
|
|
206
|
+
* 1. The Skyreader provenance marker on the document (`skyreaderLinkblog`).
|
|
207
|
+
* 2. The document's parent publication is itself a linkblog (the marker
|
|
208
|
+
* lives on the publication even when older documents lack their own).
|
|
209
|
+
* Callers resolve the publication and pass `publicationIsLinkblog`.
|
|
210
|
+
* 3. A `links` entry with `rel: "repost"` — a quote-reshare, inherently
|
|
211
|
+
* not the user's own writing.
|
|
212
|
+
* 4. Heuristic: a `links` entry with `rel: "related"` pointing to an
|
|
213
|
+
* external host different from the document's own publication host —
|
|
214
|
+
* the document's subject is an off-site article. Only applied when the
|
|
215
|
+
* caller supplies the resolved `publicationHost`, so an authored post
|
|
216
|
+
* that merely cites an external resource is never hidden on a guess.
|
|
217
|
+
*/
|
|
218
|
+
/**
|
|
219
|
+
* Discovery marker Skyreader stamps on every linkblog publication and on
|
|
220
|
+
* link-share documents. Value is a fixed URL, not a per-user value.
|
|
221
|
+
*/
|
|
222
|
+
declare const SKYREADER_LINKBLOG_MARKER_URL = "https://skyreader.app/linkblog";
|
|
223
|
+
/**
|
|
224
|
+
* True when a `site.standard.publication` record is a linkblog rather than an
|
|
225
|
+
* authored publication — i.e. it carries the Skyreader provenance marker.
|
|
226
|
+
*/
|
|
227
|
+
declare function isLinkblogPublication(record: unknown): boolean;
|
|
228
|
+
interface LinkblogShareOptions {
|
|
229
|
+
/**
|
|
230
|
+
* True when the document's parent publication has been resolved and is
|
|
231
|
+
* itself a linkblog (see {@link isLinkblogPublication}). Catches shares
|
|
232
|
+
* whose document predates the per-document marker.
|
|
233
|
+
*/
|
|
234
|
+
publicationIsLinkblog?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Resolved host of the document's parent publication, enabling the
|
|
237
|
+
* external-subject heuristic. Omit when the publication (hence its host)
|
|
238
|
+
* could not be resolved — the heuristic then stays off.
|
|
239
|
+
*/
|
|
240
|
+
publicationHost?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* True when a `site.standard.document` is a shared/linkblogged external
|
|
244
|
+
* article rather than the user's own writing. See the module comment for the
|
|
245
|
+
* signal order.
|
|
246
|
+
*/
|
|
247
|
+
declare function isLinkblogShareDocument(record: unknown, opts?: LinkblogShareOptions): boolean;
|
|
248
|
+
|
|
192
249
|
/**
|
|
193
250
|
* Publication metadata embedded in the augmented activity view by
|
|
194
251
|
* sifa-api when an external link card matches an indexed publication.
|
|
@@ -250,4 +307,4 @@ declare function hasStandardSiteAssociatedRef(refs: {
|
|
|
250
307
|
uri: string;
|
|
251
308
|
}[] | undefined): boolean;
|
|
252
309
|
|
|
253
|
-
export { type BasicTheme, BasicThemeSchema, type PublicationSource, type Publisher, type RgbColor, STANDARD_SITE_AUTH_SOCIAL_NSID, STANDARD_SITE_DOCUMENT_NSID, STANDARD_SITE_PUBLICATION_NSID, STANDARD_SITE_PUBLISHERS, STANDARD_SITE_RECOMMEND_NSID, STANDARD_SITE_SUBSCRIPTION_NSID, type StandardSiteDocumentRecord, StandardSiteDocumentRecordSchema, type StandardSiteEmbedView, type StandardSitePublicationRecord, StandardSitePublicationRecordSchema, type StandardSiteRecommendRecord, StandardSiteRecommendRecordSchema, type StandardSiteSubscriptionRecord, StandardSiteSubscriptionRecordSchema, hasStandardSiteAssociatedRef, hostMatches, isStandardSiteAtUri, matchPublisherByHost, matchPublisherByUri };
|
|
310
|
+
export { type BasicTheme, BasicThemeSchema, type LinkblogShareOptions, type PublicationSource, type Publisher, type RgbColor, SKYREADER_LINKBLOG_MARKER_URL, STANDARD_SITE_AUTH_SOCIAL_NSID, STANDARD_SITE_DOCUMENT_NSID, STANDARD_SITE_PUBLICATION_NSID, STANDARD_SITE_PUBLISHERS, STANDARD_SITE_RECOMMEND_NSID, STANDARD_SITE_SUBSCRIPTION_NSID, type StandardSiteDocumentRecord, StandardSiteDocumentRecordSchema, type StandardSiteEmbedView, type StandardSitePublicationRecord, StandardSitePublicationRecordSchema, type StandardSiteRecommendRecord, StandardSiteRecommendRecordSchema, type StandardSiteSubscriptionRecord, StandardSiteSubscriptionRecordSchema, hasStandardSiteAssociatedRef, hostMatches, isLinkblogPublication, isLinkblogShareDocument, isStandardSiteAtUri, matchPublisherByHost, matchPublisherByUri };
|
|
@@ -189,6 +189,63 @@ declare function matchPublisherByHost(host: string | null | undefined): Publishe
|
|
|
189
189
|
*/
|
|
190
190
|
declare function matchPublisherByUri(uri: string | undefined | null): Publisher | null;
|
|
191
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Linkblog-share detection for the Standard.site document family.
|
|
194
|
+
*
|
|
195
|
+
* A "linkblog" (e.g. Skyreader) writes a `site.standard.document` to the
|
|
196
|
+
* user's PDS for every *external* article they share. Those documents are
|
|
197
|
+
* valid Standard.site posts, so they surface in Sifa's activity stream and
|
|
198
|
+
* profile portfolio as if the user authored them — but the user only shared
|
|
199
|
+
* someone else's writing (sifa-workspace#351).
|
|
200
|
+
*
|
|
201
|
+
* These predicates identify such shares so callers can exclude them, while
|
|
202
|
+
* leaving genuinely authored Standard.site posts (Leaflet, pckt, Offprint
|
|
203
|
+
* essays) untouched.
|
|
204
|
+
*
|
|
205
|
+
* Signals, most to least reliable:
|
|
206
|
+
* 1. The Skyreader provenance marker on the document (`skyreaderLinkblog`).
|
|
207
|
+
* 2. The document's parent publication is itself a linkblog (the marker
|
|
208
|
+
* lives on the publication even when older documents lack their own).
|
|
209
|
+
* Callers resolve the publication and pass `publicationIsLinkblog`.
|
|
210
|
+
* 3. A `links` entry with `rel: "repost"` — a quote-reshare, inherently
|
|
211
|
+
* not the user's own writing.
|
|
212
|
+
* 4. Heuristic: a `links` entry with `rel: "related"` pointing to an
|
|
213
|
+
* external host different from the document's own publication host —
|
|
214
|
+
* the document's subject is an off-site article. Only applied when the
|
|
215
|
+
* caller supplies the resolved `publicationHost`, so an authored post
|
|
216
|
+
* that merely cites an external resource is never hidden on a guess.
|
|
217
|
+
*/
|
|
218
|
+
/**
|
|
219
|
+
* Discovery marker Skyreader stamps on every linkblog publication and on
|
|
220
|
+
* link-share documents. Value is a fixed URL, not a per-user value.
|
|
221
|
+
*/
|
|
222
|
+
declare const SKYREADER_LINKBLOG_MARKER_URL = "https://skyreader.app/linkblog";
|
|
223
|
+
/**
|
|
224
|
+
* True when a `site.standard.publication` record is a linkblog rather than an
|
|
225
|
+
* authored publication — i.e. it carries the Skyreader provenance marker.
|
|
226
|
+
*/
|
|
227
|
+
declare function isLinkblogPublication(record: unknown): boolean;
|
|
228
|
+
interface LinkblogShareOptions {
|
|
229
|
+
/**
|
|
230
|
+
* True when the document's parent publication has been resolved and is
|
|
231
|
+
* itself a linkblog (see {@link isLinkblogPublication}). Catches shares
|
|
232
|
+
* whose document predates the per-document marker.
|
|
233
|
+
*/
|
|
234
|
+
publicationIsLinkblog?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Resolved host of the document's parent publication, enabling the
|
|
237
|
+
* external-subject heuristic. Omit when the publication (hence its host)
|
|
238
|
+
* could not be resolved — the heuristic then stays off.
|
|
239
|
+
*/
|
|
240
|
+
publicationHost?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* True when a `site.standard.document` is a shared/linkblogged external
|
|
244
|
+
* article rather than the user's own writing. See the module comment for the
|
|
245
|
+
* signal order.
|
|
246
|
+
*/
|
|
247
|
+
declare function isLinkblogShareDocument(record: unknown, opts?: LinkblogShareOptions): boolean;
|
|
248
|
+
|
|
192
249
|
/**
|
|
193
250
|
* Publication metadata embedded in the augmented activity view by
|
|
194
251
|
* sifa-api when an external link card matches an indexed publication.
|
|
@@ -250,4 +307,4 @@ declare function hasStandardSiteAssociatedRef(refs: {
|
|
|
250
307
|
uri: string;
|
|
251
308
|
}[] | undefined): boolean;
|
|
252
309
|
|
|
253
|
-
export { type BasicTheme, BasicThemeSchema, type PublicationSource, type Publisher, type RgbColor, STANDARD_SITE_AUTH_SOCIAL_NSID, STANDARD_SITE_DOCUMENT_NSID, STANDARD_SITE_PUBLICATION_NSID, STANDARD_SITE_PUBLISHERS, STANDARD_SITE_RECOMMEND_NSID, STANDARD_SITE_SUBSCRIPTION_NSID, type StandardSiteDocumentRecord, StandardSiteDocumentRecordSchema, type StandardSiteEmbedView, type StandardSitePublicationRecord, StandardSitePublicationRecordSchema, type StandardSiteRecommendRecord, StandardSiteRecommendRecordSchema, type StandardSiteSubscriptionRecord, StandardSiteSubscriptionRecordSchema, hasStandardSiteAssociatedRef, hostMatches, isStandardSiteAtUri, matchPublisherByHost, matchPublisherByUri };
|
|
310
|
+
export { type BasicTheme, BasicThemeSchema, type LinkblogShareOptions, type PublicationSource, type Publisher, type RgbColor, SKYREADER_LINKBLOG_MARKER_URL, STANDARD_SITE_AUTH_SOCIAL_NSID, STANDARD_SITE_DOCUMENT_NSID, STANDARD_SITE_PUBLICATION_NSID, STANDARD_SITE_PUBLISHERS, STANDARD_SITE_RECOMMEND_NSID, STANDARD_SITE_SUBSCRIPTION_NSID, type StandardSiteDocumentRecord, StandardSiteDocumentRecordSchema, type StandardSiteEmbedView, type StandardSitePublicationRecord, StandardSitePublicationRecordSchema, type StandardSiteRecommendRecord, StandardSiteRecommendRecordSchema, type StandardSiteSubscriptionRecord, StandardSiteSubscriptionRecordSchema, hasStandardSiteAssociatedRef, hostMatches, isLinkblogPublication, isLinkblogShareDocument, isStandardSiteAtUri, matchPublisherByHost, matchPublisherByUri };
|
package/dist/publishing/index.js
CHANGED
|
@@ -118,6 +118,43 @@ function matchPublisherByUri(uri) {
|
|
|
118
118
|
return matchPublisherByHost(hostFromUri(uri));
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// src/publishing/linkblog.ts
|
|
122
|
+
var SKYREADER_LINKBLOG_MARKER_URL = "https://skyreader.app/linkblog";
|
|
123
|
+
function isRecord(value) {
|
|
124
|
+
return typeof value === "object" && value !== null;
|
|
125
|
+
}
|
|
126
|
+
function hasLinkblogMarker(record) {
|
|
127
|
+
const marker = record.skyreaderLinkblog;
|
|
128
|
+
return typeof marker === "string" && marker.length > 0;
|
|
129
|
+
}
|
|
130
|
+
function hostOf(uri) {
|
|
131
|
+
try {
|
|
132
|
+
return new URL(uri).host.toLowerCase();
|
|
133
|
+
} catch {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function isLinkblogPublication(record) {
|
|
138
|
+
return isRecord(record) && hasLinkblogMarker(record);
|
|
139
|
+
}
|
|
140
|
+
function isLinkblogShareDocument(record, opts = {}) {
|
|
141
|
+
if (!isRecord(record)) return false;
|
|
142
|
+
if (hasLinkblogMarker(record)) return true;
|
|
143
|
+
if (opts.publicationIsLinkblog === true) return true;
|
|
144
|
+
const links = record.links;
|
|
145
|
+
if (!Array.isArray(links)) return false;
|
|
146
|
+
const pubHost = opts.publicationHost?.toLowerCase();
|
|
147
|
+
for (const link of links) {
|
|
148
|
+
if (!isRecord(link) || typeof link.rel !== "string") continue;
|
|
149
|
+
if (link.rel === "repost") return true;
|
|
150
|
+
if (link.rel === "related" && pubHost && typeof link.uri === "string") {
|
|
151
|
+
const linkHost = hostOf(link.uri);
|
|
152
|
+
if (linkHost && linkHost !== pubHost) return true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
|
|
121
158
|
// src/publishing/types.ts
|
|
122
159
|
var STANDARD_SITE_PUBLICATION_NSID = "site.standard.publication";
|
|
123
160
|
var STANDARD_SITE_DOCUMENT_NSID = "site.standard.document";
|
|
@@ -141,6 +178,6 @@ function hasStandardSiteAssociatedRef(refs) {
|
|
|
141
178
|
return refs.some((r) => isStandardSiteAtUri(r.uri));
|
|
142
179
|
}
|
|
143
180
|
|
|
144
|
-
export { BasicThemeSchema, STANDARD_SITE_AUTH_SOCIAL_NSID, STANDARD_SITE_DOCUMENT_NSID, STANDARD_SITE_PUBLICATION_NSID, STANDARD_SITE_PUBLISHERS, STANDARD_SITE_RECOMMEND_NSID, STANDARD_SITE_SUBSCRIPTION_NSID, StandardSiteDocumentRecordSchema, StandardSitePublicationRecordSchema, StandardSiteRecommendRecordSchema, StandardSiteSubscriptionRecordSchema, hasStandardSiteAssociatedRef, hostMatches, isStandardSiteAtUri, matchPublisherByHost, matchPublisherByUri };
|
|
181
|
+
export { BasicThemeSchema, SKYREADER_LINKBLOG_MARKER_URL, STANDARD_SITE_AUTH_SOCIAL_NSID, STANDARD_SITE_DOCUMENT_NSID, STANDARD_SITE_PUBLICATION_NSID, STANDARD_SITE_PUBLISHERS, STANDARD_SITE_RECOMMEND_NSID, STANDARD_SITE_SUBSCRIPTION_NSID, StandardSiteDocumentRecordSchema, StandardSitePublicationRecordSchema, StandardSiteRecommendRecordSchema, StandardSiteSubscriptionRecordSchema, hasStandardSiteAssociatedRef, hostMatches, isLinkblogPublication, isLinkblogShareDocument, isStandardSiteAtUri, matchPublisherByHost, matchPublisherByUri };
|
|
145
182
|
//# sourceMappingURL=index.js.map
|
|
146
183
|
//# sourceMappingURL=index.js.map
|