@singi-labs/sifa-sdk 0.19.44 → 0.19.46
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/atproto/index.js +9 -3
- package/dist/atproto/index.js.map +1 -1
- package/dist/badge/index.cjs.map +1 -1
- package/dist/badge/index.js +5 -141
- package/dist/badge/index.js.map +1 -1
- package/dist/cards/adult-content.js +14 -0
- package/dist/cards/adult-content.js.map +1 -0
- package/dist/cards/app-url-patterns.js +369 -0
- package/dist/cards/app-url-patterns.js.map +1 -0
- package/dist/cards/index.js +24 -0
- package/dist/cards/index.js.map +1 -0
- package/dist/cards/resolve-card-url.js +198 -0
- package/dist/cards/resolve-card-url.js.map +1 -0
- package/dist/cards/visibility.js +45 -0
- package/dist/cards/visibility.js.map +1 -0
- package/dist/flags/index.js +4 -3
- package/dist/flags/index.js.map +1 -1
- package/dist/format/collapse-contributors.js +19 -0
- package/dist/format/collapse-contributors.js.map +1 -0
- package/dist/format/company-name.js +61 -0
- package/dist/format/company-name.js.map +1 -0
- package/dist/format/compare-text.js +9 -0
- package/dist/format/compare-text.js.map +1 -0
- package/dist/format/doi.js +8 -0
- package/dist/format/doi.js.map +1 -0
- package/dist/format/embed.js +131 -0
- package/dist/format/embed.js.map +1 -0
- package/dist/format/endorsement-context.js +35 -0
- package/dist/format/endorsement-context.js.map +1 -0
- package/dist/format/format-display-url.js +42 -0
- package/dist/format/format-display-url.js.map +1 -0
- package/dist/format/format-duration.js +13 -0
- package/dist/format/format-duration.js.map +1 -0
- package/dist/format/format-time.js +30 -0
- package/dist/format/format-time.js.map +1 -0
- package/dist/format/handle-utils.js +19 -0
- package/dist/format/handle-utils.js.map +1 -0
- package/dist/format/index.js +106 -0
- package/dist/format/index.js.map +1 -0
- package/dist/format/location-segments.js +29 -0
- package/dist/format/location-segments.js.map +1 -0
- package/dist/format/location-utils.js +42 -0
- package/dist/format/location-utils.js.map +1 -0
- package/dist/format/meta-description.js +35 -0
- package/dist/format/meta-description.js.map +1 -0
- package/dist/format/normalize-company-key.js +12 -0
- package/dist/format/normalize-company-key.js.map +1 -0
- package/dist/format/normalize-legal-form.js +71 -0
- package/dist/format/normalize-legal-form.js.map +1 -0
- package/dist/format/pds-utils.js +73 -0
- package/dist/format/pds-utils.js.map +1 -0
- package/dist/format/sort-by-date.js +39 -0
- package/dist/format/sort-by-date.js.map +1 -0
- package/dist/format/summarize-deliveries.js +37 -0
- package/dist/format/summarize-deliveries.js.map +1 -0
- package/dist/format/talk-slug.js +21 -0
- package/dist/format/talk-slug.js.map +1 -0
- package/dist/format/text-sanitize.js +29 -0
- package/dist/format/text-sanitize.js.map +1 -0
- package/dist/format/text-truncate.js +14 -0
- package/dist/format/text-truncate.js.map +1 -0
- package/dist/format/time-utils.js +19 -0
- package/dist/format/time-utils.js.map +1 -0
- package/dist/format/timeline.js +33 -0
- package/dist/format/timeline.js.map +1 -0
- package/dist/format/wcag-contrast.js +34 -0
- package/dist/format/wcag-contrast.js.map +1 -0
- package/dist/import/index.js +22 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/presentation-csv.js +116 -0
- package/dist/import/presentation-csv.js.map +1 -0
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +677 -7086
- package/dist/index.js.map +1 -1
- package/dist/jev/index.js +18 -5
- package/dist/jev/index.js.map +1 -1
- package/dist/jsonld/index.cjs.map +1 -1
- package/dist/jsonld/index.js +30 -987
- package/dist/jsonld/index.js.map +1 -1
- package/dist/jsonld/profile.js +222 -0
- package/dist/jsonld/profile.js.map +1 -0
- package/dist/jsonld/terms.js +496 -0
- package/dist/jsonld/terms.js.map +1 -0
- package/dist/jsonld/url.js +17 -0
- package/dist/jsonld/url.js.map +1 -0
- package/dist/jsonld/works-graph.js +41 -0
- package/dist/jsonld/works-graph.js.map +1 -0
- package/dist/jsonld/works.js +178 -0
- package/dist/jsonld/works.js.map +1 -0
- package/dist/logic/actor-identity.js +8 -0
- package/dist/logic/actor-identity.js.map +1 -0
- package/dist/logic/agent-ref.js +24 -0
- package/dist/logic/agent-ref.js.map +1 -0
- package/dist/logic/company-page-indexable.js +23 -0
- package/dist/logic/company-page-indexable.js.map +1 -0
- package/dist/logic/date-lookahead.js +33 -0
- package/dist/logic/date-lookahead.js.map +1 -0
- package/dist/logic/domain-detect.js +43 -0
- package/dist/logic/domain-detect.js.map +1 -0
- package/dist/logic/entity-disambiguation.js +24 -0
- package/dist/logic/entity-disambiguation.js.map +1 -0
- package/dist/logic/entity-ref-anchor.js +33 -0
- package/dist/logic/entity-ref-anchor.js.map +1 -0
- package/dist/logic/index.js +91 -0
- package/dist/logic/index.js.map +1 -0
- package/dist/logic/org-floor.js +66 -0
- package/dist/logic/org-floor.js.map +1 -0
- package/dist/logic/primary-item.js +9 -0
- package/dist/logic/primary-item.js.map +1 -0
- package/dist/logic/primary-position.js +16 -0
- package/dist/logic/primary-position.js.map +1 -0
- package/dist/logic/profile-completeness.js +21 -0
- package/dist/logic/profile-completeness.js.map +1 -0
- package/dist/logic/profile-dimensions.js +50 -0
- package/dist/logic/profile-dimensions.js.map +1 -0
- package/dist/logic/profile-summary.js +23 -0
- package/dist/logic/profile-summary.js.map +1 -0
- package/dist/logic/pseudo-employer.js +34 -0
- package/dist/logic/pseudo-employer.js.map +1 -0
- package/dist/logic/recent-activity.js +10 -0
- package/dist/logic/recent-activity.js.map +1 -0
- package/dist/logic/self-app.js +10 -0
- package/dist/logic/self-app.js.map +1 -0
- package/dist/{org-BCrvebcf.d.ts → org-CxTEjjrm.d.ts} +1 -1
- package/dist/{org-settings-C73Sin5E.d.ts → org-settings-BShvhyFp.d.ts} +1 -1
- package/dist/profile/headline-role-dedupe.js +12 -0
- package/dist/profile/headline-role-dedupe.js.map +1 -0
- package/dist/profile/highlights.js +200 -0
- package/dist/profile/highlights.js.map +1 -0
- package/dist/profile/index.js +66 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/involvement-grouping.js +31 -0
- package/dist/profile/involvement-grouping.js.map +1 -0
- package/dist/profile/language-sort.js +24 -0
- package/dist/profile/language-sort.js.map +1 -0
- package/dist/profile/publication-versions.js +98 -0
- package/dist/profile/publication-versions.js.map +1 -0
- package/dist/profile/range-sort.js +14 -0
- package/dist/profile/range-sort.js.map +1 -0
- package/dist/profile/section-model.js +122 -0
- package/dist/profile/section-model.js.map +1 -0
- package/dist/profile/section-sorts.js +33 -0
- package/dist/profile/section-sorts.js.map +1 -0
- package/dist/publishers/index.js +16 -0
- package/dist/publishers/index.js.map +1 -0
- package/dist/publishers/registry.js +87 -0
- package/dist/publishers/registry.js.map +1 -0
- package/dist/publishing/index.js +46 -184
- package/dist/publishing/index.js.map +1 -1
- package/dist/publishing/linkblog.js +42 -0
- package/dist/publishing/linkblog.js.map +1 -0
- package/dist/publishing/registry.js +32 -0
- package/dist/publishing/registry.js.map +1 -0
- package/dist/publishing/schemas.js +74 -0
- package/dist/publishing/schemas.js.map +1 -0
- package/dist/publishing/types.js +32 -0
- package/dist/publishing/types.js.map +1 -0
- package/dist/query/client.js +119 -0
- package/dist/query/client.js.map +1 -0
- package/dist/query/config.js +23 -0
- package/dist/query/config.js.map +1 -0
- package/dist/query/fetchers/accounts.js +29 -0
- package/dist/query/fetchers/accounts.js.map +1 -0
- package/dist/query/fetchers/activity-items-hide.js +31 -0
- package/dist/query/fetchers/activity-items-hide.js.map +1 -0
- package/dist/query/fetchers/activity.js +61 -0
- package/dist/query/fetchers/activity.js.map +1 -0
- package/dist/query/fetchers/actor.js +30 -0
- package/dist/query/fetchers/actor.js.map +1 -0
- package/dist/query/fetchers/admin-feature-allowlists.js +41 -0
- package/dist/query/fetchers/admin-feature-allowlists.js.map +1 -0
- package/dist/query/fetchers/admin-review-queues.js +30 -0
- package/dist/query/fetchers/admin-review-queues.js.map +1 -0
- package/dist/query/fetchers/apps.js +31 -0
- package/dist/query/fetchers/apps.js.map +1 -0
- package/dist/query/fetchers/bsky-preferences.js +55 -0
- package/dist/query/fetchers/bsky-preferences.js.map +1 -0
- package/dist/query/fetchers/confirmations.js +55 -0
- package/dist/query/fetchers/confirmations.js.map +1 -0
- package/dist/query/fetchers/destructive.js +34 -0
- package/dist/query/fetchers/destructive.js.map +1 -0
- package/dist/query/fetchers/discovery.js +67 -0
- package/dist/query/fetchers/discovery.js.map +1 -0
- package/dist/query/fetchers/education.js +23 -0
- package/dist/query/fetchers/education.js.map +1 -0
- package/dist/query/fetchers/endorsement-inbox.js +36 -0
- package/dist/query/fetchers/endorsement-inbox.js.map +1 -0
- package/dist/query/fetchers/endorsement.js +23 -0
- package/dist/query/fetchers/endorsement.js.map +1 -0
- package/dist/query/fetchers/endorsements.js +20 -0
- package/dist/query/fetchers/endorsements.js.map +1 -0
- package/dist/query/fetchers/entities.js +65 -0
- package/dist/query/fetchers/entities.js.map +1 -0
- package/dist/query/fetchers/external-accounts.js +74 -0
- package/dist/query/fetchers/external-accounts.js.map +1 -0
- package/dist/query/fetchers/follow-extras.js +38 -0
- package/dist/query/fetchers/follow-extras.js.map +1 -0
- package/dist/query/fetchers/follow.js +105 -0
- package/dist/query/fetchers/follow.js.map +1 -0
- package/dist/query/fetchers/get-profile-view.js +21 -0
- package/dist/query/fetchers/get-profile-view.js.map +1 -0
- package/dist/query/fetchers/github-prs.js +45 -0
- package/dist/query/fetchers/github-prs.js.map +1 -0
- package/dist/query/fetchers/inbox.js +29 -0
- package/dist/query/fetchers/inbox.js.map +1 -0
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.ts +2 -2
- package/dist/query/fetchers/index.js +360 -2045
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/fetchers/investments.js +18 -0
- package/dist/query/fetchers/investments.js.map +1 -0
- package/dist/query/fetchers/keytrace-claims.js +23 -0
- package/dist/query/fetchers/keytrace-claims.js.map +1 -0
- package/dist/query/fetchers/marque-domains.js +23 -0
- package/dist/query/fetchers/marque-domains.js.map +1 -0
- package/dist/query/fetchers/network-map.js +36 -0
- package/dist/query/fetchers/network-map.js.map +1 -0
- package/dist/query/fetchers/org.js +48 -0
- package/dist/query/fetchers/org.js.map +1 -0
- package/dist/query/fetchers/positions.js +77 -0
- package/dist/query/fetchers/positions.js.map +1 -0
- package/dist/query/fetchers/profile-completeness.js +45 -0
- package/dist/query/fetchers/profile-completeness.js.map +1 -0
- package/dist/query/fetchers/profile-items-hide.js +36 -0
- package/dist/query/fetchers/profile-items-hide.js.map +1 -0
- package/dist/query/fetchers/profile-locations.js +23 -0
- package/dist/query/fetchers/profile-locations.js.map +1 -0
- package/dist/query/fetchers/profile-mutations.js +82 -0
- package/dist/query/fetchers/profile-mutations.js.map +1 -0
- package/dist/query/fetchers/profile-summary.js +14 -0
- package/dist/query/fetchers/profile-summary.js.map +1 -0
- package/dist/query/fetchers/profile.js +31 -0
- package/dist/query/fetchers/profile.js.map +1 -0
- package/dist/query/fetchers/publications.js +66 -0
- package/dist/query/fetchers/publications.js.map +1 -0
- package/dist/query/fetchers/quoted-posts.js +40 -0
- package/dist/query/fetchers/quoted-posts.js.map +1 -0
- package/dist/query/fetchers/reactions.js +85 -0
- package/dist/query/fetchers/reactions.js.map +1 -0
- package/dist/query/fetchers/received-endorsements.js +20 -0
- package/dist/query/fetchers/received-endorsements.js.map +1 -0
- package/dist/query/fetchers/reciprocity.js +23 -0
- package/dist/query/fetchers/reciprocity.js.map +1 -0
- package/dist/query/fetchers/records.js +27 -0
- package/dist/query/fetchers/records.js.map +1 -0
- package/dist/query/fetchers/repo-inventory.js +23 -0
- package/dist/query/fetchers/repo-inventory.js.map +1 -0
- package/dist/query/fetchers/roadmap.js +73 -0
- package/dist/query/fetchers/roadmap.js.map +1 -0
- package/dist/query/fetchers/rpg.js +36 -0
- package/dist/query/fetchers/rpg.js.map +1 -0
- package/dist/query/fetchers/search.js +78 -0
- package/dist/query/fetchers/search.js.map +1 -0
- package/dist/query/fetchers/section-primary.js +23 -0
- package/dist/query/fetchers/section-primary.js.map +1 -0
- package/dist/query/fetchers/skills.js +30 -0
- package/dist/query/fetchers/skills.js.map +1 -0
- package/dist/query/fetchers/speakers.js +42 -0
- package/dist/query/fetchers/speakers.js.map +1 -0
- package/dist/query/fetchers/stats.js +16 -0
- package/dist/query/fetchers/stats.js.map +1 -0
- package/dist/query/fetchers/stream.js +30 -0
- package/dist/query/fetchers/stream.js.map +1 -0
- package/dist/query/fetchers/unlinked-positions.js +30 -0
- package/dist/query/fetchers/unlinked-positions.js.map +1 -0
- package/dist/query/hooks/index.d.ts +3 -3
- package/dist/query/hooks/index.js +283 -3555
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/hooks/use-accounts.js +19 -0
- package/dist/query/hooks/use-accounts.js.map +1 -0
- package/dist/query/hooks/use-activity-items-hide.js +52 -0
- package/dist/query/hooks/use-activity-items-hide.js.map +1 -0
- package/dist/query/hooks/use-activity.js +44 -0
- package/dist/query/hooks/use-activity.js.map +1 -0
- package/dist/query/hooks/use-admin-review-queues.js +21 -0
- package/dist/query/hooks/use-admin-review-queues.js.map +1 -0
- package/dist/query/hooks/use-apps.js +31 -0
- package/dist/query/hooks/use-apps.js.map +1 -0
- package/dist/query/hooks/use-bsky-content-prefs.js +45 -0
- package/dist/query/hooks/use-bsky-content-prefs.js.map +1 -0
- package/dist/query/hooks/use-confirmations.js +121 -0
- package/dist/query/hooks/use-confirmations.js.map +1 -0
- package/dist/query/hooks/use-create-position.js +28 -0
- package/dist/query/hooks/use-create-position.js.map +1 -0
- package/dist/query/hooks/use-destructive.js +63 -0
- package/dist/query/hooks/use-destructive.js.map +1 -0
- package/dist/query/hooks/use-discovery.js +53 -0
- package/dist/query/hooks/use-discovery.js.map +1 -0
- package/dist/query/hooks/use-education-mutations.js +67 -0
- package/dist/query/hooks/use-education-mutations.js.map +1 -0
- package/dist/query/hooks/use-endorsement-inbox.js +80 -0
- package/dist/query/hooks/use-endorsement-inbox.js.map +1 -0
- package/dist/query/hooks/use-endorsement-mutations.js +33 -0
- package/dist/query/hooks/use-endorsement-mutations.js.map +1 -0
- package/dist/query/hooks/use-endorsement.js +20 -0
- package/dist/query/hooks/use-endorsement.js.map +1 -0
- package/dist/query/hooks/use-entity-search.js +73 -0
- package/dist/query/hooks/use-entity-search.js.map +1 -0
- package/dist/query/hooks/use-external-accounts.js +143 -0
- package/dist/query/hooks/use-external-accounts.js.map +1 -0
- package/dist/query/hooks/use-feature-allowlist.js +104 -0
- package/dist/query/hooks/use-feature-allowlist.js.map +1 -0
- package/dist/query/hooks/use-follow-extras.js +38 -0
- package/dist/query/hooks/use-follow-extras.js.map +1 -0
- package/dist/query/hooks/use-follow.js +113 -0
- package/dist/query/hooks/use-follow.js.map +1 -0
- package/dist/query/hooks/use-get-profile-view.js +20 -0
- package/dist/query/hooks/use-get-profile-view.js.map +1 -0
- package/dist/query/hooks/use-github-prs.js +21 -0
- package/dist/query/hooks/use-github-prs.js.map +1 -0
- package/dist/query/hooks/use-inbox.js +19 -0
- package/dist/query/hooks/use-inbox.js.map +1 -0
- package/dist/query/hooks/use-investment-mutations.js +65 -0
- package/dist/query/hooks/use-investment-mutations.js.map +1 -0
- package/dist/query/hooks/use-keytrace-claims.js +50 -0
- package/dist/query/hooks/use-keytrace-claims.js.map +1 -0
- package/dist/query/hooks/use-location-mutations.js +71 -0
- package/dist/query/hooks/use-location-mutations.js.map +1 -0
- package/dist/query/hooks/use-marque-domains.js +50 -0
- package/dist/query/hooks/use-marque-domains.js.map +1 -0
- package/dist/query/hooks/use-org-claim.js +29 -0
- package/dist/query/hooks/use-org-claim.js.map +1 -0
- package/dist/query/hooks/use-org-domains.js +28 -0
- package/dist/query/hooks/use-org-domains.js.map +1 -0
- package/dist/query/hooks/use-org-notification-emails.js +28 -0
- package/dist/query/hooks/use-org-notification-emails.js.map +1 -0
- package/dist/query/hooks/use-org-profile-settings.js +29 -0
- package/dist/query/hooks/use-org-profile-settings.js.map +1 -0
- package/dist/query/hooks/use-org-profile.js +21 -0
- package/dist/query/hooks/use-org-profile.js.map +1 -0
- package/dist/query/hooks/use-position-mutations.js +128 -0
- package/dist/query/hooks/use-position-mutations.js.map +1 -0
- package/dist/query/hooks/use-profile-completeness.js +21 -0
- package/dist/query/hooks/use-profile-completeness.js.map +1 -0
- package/dist/query/hooks/use-profile-items-hide.js +53 -0
- package/dist/query/hooks/use-profile-items-hide.js.map +1 -0
- package/dist/query/hooks/use-profile-mutations.js +143 -0
- package/dist/query/hooks/use-profile-mutations.js.map +1 -0
- package/dist/query/hooks/use-profile.js +30 -0
- package/dist/query/hooks/use-profile.js.map +1 -0
- package/dist/query/hooks/use-publication-mutations.js +90 -0
- package/dist/query/hooks/use-publication-mutations.js.map +1 -0
- package/dist/query/hooks/use-reaction-mutations.js +48 -0
- package/dist/query/hooks/use-reaction-mutations.js.map +1 -0
- package/dist/query/hooks/use-reactions.js +32 -0
- package/dist/query/hooks/use-reactions.js.map +1 -0
- package/dist/query/hooks/use-received-endorsements.js +23 -0
- package/dist/query/hooks/use-received-endorsements.js.map +1 -0
- package/dist/query/hooks/use-reciprocity.js +19 -0
- package/dist/query/hooks/use-reciprocity.js.map +1 -0
- package/dist/query/hooks/use-record-mutations.js +67 -0
- package/dist/query/hooks/use-record-mutations.js.map +1 -0
- package/dist/query/hooks/use-repo-inventory.js +43 -0
- package/dist/query/hooks/use-repo-inventory.js.map +1 -0
- package/dist/query/hooks/use-roadmap-mutations.js +51 -0
- package/dist/query/hooks/use-roadmap-mutations.js.map +1 -0
- package/dist/query/hooks/use-roadmap.js +31 -0
- package/dist/query/hooks/use-roadmap.js.map +1 -0
- package/dist/query/hooks/use-search.js +63 -0
- package/dist/query/hooks/use-search.js.map +1 -0
- package/dist/query/hooks/use-section-primary-mutations.js +53 -0
- package/dist/query/hooks/use-section-primary-mutations.js.map +1 -0
- package/dist/query/hooks/use-skill-mutations.js +91 -0
- package/dist/query/hooks/use-skill-mutations.js.map +1 -0
- package/dist/query/hooks/use-stats.js +19 -0
- package/dist/query/hooks/use-stats.js.map +1 -0
- package/dist/query/hooks/use-stream.js +20 -0
- package/dist/query/hooks/use-stream.js.map +1 -0
- package/dist/query/hooks/use-unlinked-positions.js +45 -0
- package/dist/query/hooks/use-unlinked-positions.js.map +1 -0
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.ts +4 -4
- package/dist/query/index.js +685 -3744
- package/dist/query/index.js.map +1 -1
- package/dist/query/keys.js +138 -0
- package/dist/query/keys.js.map +1 -0
- package/dist/repo/groups.js +81 -0
- package/dist/repo/groups.js.map +1 -0
- package/dist/repo/index.js +9 -0
- package/dist/repo/index.js.map +1 -0
- package/dist/repo/labels.js +121 -0
- package/dist/repo/labels.js.map +1 -0
- package/dist/repo/types.js +1 -0
- package/dist/repo/types.js.map +1 -0
- package/dist/resume/index.js +5 -179
- package/dist/resume/index.js.map +1 -1
- package/dist/resume/json-resume.js +153 -0
- package/dist/resume/json-resume.js.map +1 -0
- package/dist/roadmap/index.js +101 -0
- package/dist/roadmap/index.js.map +1 -0
- package/dist/rpg/catalog.js +101 -0
- package/dist/rpg/catalog.js.map +1 -0
- package/dist/rpg/index.js +13 -116
- package/dist/rpg/index.js.map +1 -1
- package/dist/rpg/unlocks.js +21 -0
- package/dist/rpg/unlocks.js.map +1 -0
- package/dist/schemas/blob-ref.js +12 -0
- package/dist/schemas/blob-ref.js.map +1 -0
- package/dist/schemas/confirmation.js +23 -0
- package/dist/schemas/confirmation.js.map +1 -0
- package/dist/schemas/endorsement-confirmation.js +18 -0
- package/dist/schemas/endorsement-confirmation.js.map +1 -0
- package/dist/schemas/endorsement.js +19 -0
- package/dist/schemas/endorsement.js.map +1 -0
- package/dist/schemas/entity.js +74 -0
- package/dist/schemas/entity.js.map +1 -0
- package/dist/schemas/feed.js +73 -0
- package/dist/schemas/feed.js.map +1 -0
- package/dist/schemas/follow-profile.js +32 -0
- package/dist/schemas/follow-profile.js.map +1 -0
- package/dist/schemas/graph-follow.js +19 -0
- package/dist/schemas/graph-follow.js.map +1 -0
- package/dist/schemas/index.js +164 -629
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/org-employment-attestation.js +28 -0
- package/dist/schemas/org-employment-attestation.js.map +1 -0
- package/dist/schemas/org-profile.js +64 -0
- package/dist/schemas/org-profile.js.map +1 -0
- package/dist/schemas/profile-certification.js +28 -0
- package/dist/schemas/profile-certification.js.map +1 -0
- package/dist/schemas/profile-course.js +32 -0
- package/dist/schemas/profile-course.js.map +1 -0
- package/dist/schemas/profile-education.js +33 -0
- package/dist/schemas/profile-education.js.map +1 -0
- package/dist/schemas/profile-external-account.js +15 -0
- package/dist/schemas/profile-external-account.js.map +1 -0
- package/dist/schemas/profile-honor.js +18 -0
- package/dist/schemas/profile-honor.js.map +1 -0
- package/dist/schemas/profile-investment.js +48 -0
- package/dist/schemas/profile-investment.js.map +1 -0
- package/dist/schemas/profile-involvement.js +47 -0
- package/dist/schemas/profile-involvement.js.map +1 -0
- package/dist/schemas/profile-language.js +12 -0
- package/dist/schemas/profile-language.js.map +1 -0
- package/dist/schemas/profile-position.js +42 -0
- package/dist/schemas/profile-position.js.map +1 -0
- package/dist/schemas/profile-presentation-delivery.js +38 -0
- package/dist/schemas/profile-presentation-delivery.js.map +1 -0
- package/dist/schemas/profile-presentation.js +36 -0
- package/dist/schemas/profile-presentation.js.map +1 -0
- package/dist/schemas/profile-project.js +48 -0
- package/dist/schemas/profile-project.js.map +1 -0
- package/dist/schemas/profile-publication.js +30 -0
- package/dist/schemas/profile-publication.js.map +1 -0
- package/dist/schemas/profile-self.js +22 -0
- package/dist/schemas/profile-self.js.map +1 -0
- package/dist/schemas/profile-skill.js +13 -0
- package/dist/schemas/profile-skill.js.map +1 -0
- package/dist/schemas/profile-volunteering.js +20 -0
- package/dist/schemas/profile-volunteering.js.map +1 -0
- package/dist/schemas/shared.js +56 -0
- package/dist/schemas/shared.js.map +1 -0
- package/dist/schemas/write/certification.js +16 -0
- package/dist/schemas/write/certification.js.map +1 -0
- package/dist/schemas/write/course.js +36 -0
- package/dist/schemas/write/course.js.map +1 -0
- package/dist/schemas/write/education.js +18 -0
- package/dist/schemas/write/education.js.map +1 -0
- package/dist/schemas/write/external-account.js +13 -0
- package/dist/schemas/write/external-account.js.map +1 -0
- package/dist/schemas/write/honor.js +14 -0
- package/dist/schemas/write/honor.js.map +1 -0
- package/dist/schemas/write/index.d.ts +1 -1
- package/dist/schemas/write/index.js +89 -593
- package/dist/schemas/write/index.js.map +1 -1
- package/dist/schemas/write/investment.js +32 -0
- package/dist/schemas/write/investment.js.map +1 -0
- package/dist/schemas/write/involvement.js +34 -0
- package/dist/schemas/write/involvement.js.map +1 -0
- package/dist/schemas/write/language.js +10 -0
- package/dist/schemas/write/language.js.map +1 -0
- package/dist/schemas/write/org-claim.js +56 -0
- package/dist/schemas/write/org-claim.js.map +1 -0
- package/dist/schemas/write/org-employment-attestation.js +19 -0
- package/dist/schemas/write/org-employment-attestation.js.map +1 -0
- package/dist/schemas/write/org-profile.js +54 -0
- package/dist/schemas/write/org-profile.js.map +1 -0
- package/dist/schemas/write/org-settings.js +81 -0
- package/dist/schemas/write/org-settings.js.map +1 -0
- package/dist/schemas/write/position.js +24 -0
- package/dist/schemas/write/position.js.map +1 -0
- package/dist/schemas/write/presentation-delivery.js +34 -0
- package/dist/schemas/write/presentation-delivery.js.map +1 -0
- package/dist/schemas/write/presentation.js +23 -0
- package/dist/schemas/write/presentation.js.map +1 -0
- package/dist/schemas/write/profile-location.js +21 -0
- package/dist/schemas/write/profile-location.js.map +1 -0
- package/dist/schemas/write/profile-self.js +27 -0
- package/dist/schemas/write/profile-self.js.map +1 -0
- package/dist/schemas/write/project.js +27 -0
- package/dist/schemas/write/project.js.map +1 -0
- package/dist/schemas/write/publication.js +41 -0
- package/dist/schemas/write/publication.js.map +1 -0
- package/dist/schemas/write/shared.js +96 -0
- package/dist/schemas/write/shared.js.map +1 -0
- package/dist/schemas/write/skill.js +18 -0
- package/dist/schemas/write/skill.js.map +1 -0
- package/dist/schemas/write/volunteering.js +16 -0
- package/dist/schemas/write/volunteering.js.map +1 -0
- package/dist/stream/activity-item.js +1 -0
- package/dist/stream/activity-item.js.map +1 -0
- package/dist/stream/index.js +49 -0
- package/dist/stream/index.js.map +1 -0
- package/dist/stream/stream-card-vm-schema.js +265 -0
- package/dist/stream/stream-card-vm-schema.js.map +1 -0
- package/dist/stream/stream-card-vm.js +1 -0
- package/dist/stream/stream-card-vm.js.map +1 -0
- package/dist/stream/to-stream-card-vm.js +793 -0
- package/dist/stream/to-stream-card-vm.js.map +1 -0
- package/dist/stream/two-tier.js +30 -0
- package/dist/stream/two-tier.js.map +1 -0
- package/dist/stream/verbs.js +120 -0
- package/dist/stream/verbs.js.map +1 -0
- package/dist/taxonomy/activity-tiers.js +956 -0
- package/dist/taxonomy/activity-tiers.js.map +1 -0
- package/dist/taxonomy/app-categories.js +42 -0
- package/dist/taxonomy/app-categories.js.map +1 -0
- package/dist/taxonomy/app-category-map.js +166 -0
- package/dist/taxonomy/app-category-map.js.map +1 -0
- package/dist/taxonomy/artifact-link-kind.js +29 -0
- package/dist/taxonomy/artifact-link-kind.js.map +1 -0
- package/dist/taxonomy/calendar-event.js +28 -0
- package/dist/taxonomy/calendar-event.js.map +1 -0
- package/dist/taxonomy/continents.js +215 -0
- package/dist/taxonomy/continents.js.map +1 -0
- package/dist/taxonomy/countries.js +203 -0
- package/dist/taxonomy/countries.js.map +1 -0
- package/dist/taxonomy/course-role.js +37 -0
- package/dist/taxonomy/course-role.js.map +1 -0
- package/dist/taxonomy/employment-type.js +82 -0
- package/dist/taxonomy/employment-type.js.map +1 -0
- package/dist/taxonomy/eqf-level.js +59 -0
- package/dist/taxonomy/eqf-level.js.map +1 -0
- package/dist/taxonomy/index.js +263 -0
- package/dist/taxonomy/index.js.map +1 -0
- package/dist/taxonomy/industry-taxonomy.js +281 -0
- package/dist/taxonomy/industry-taxonomy.js.map +1 -0
- package/dist/taxonomy/investment.js +54 -0
- package/dist/taxonomy/investment.js.map +1 -0
- package/dist/taxonomy/involvement-kind.js +30 -0
- package/dist/taxonomy/involvement-kind.js.map +1 -0
- package/dist/taxonomy/open-to.js +128 -0
- package/dist/taxonomy/open-to.js.map +1 -0
- package/dist/taxonomy/platforms.js +56 -0
- package/dist/taxonomy/platforms.js.map +1 -0
- package/dist/taxonomy/presentation-link-type.js +22 -0
- package/dist/taxonomy/presentation-link-type.js.map +1 -0
- package/dist/taxonomy/presentation-role.js +21 -0
- package/dist/taxonomy/presentation-role.js.map +1 -0
- package/dist/taxonomy/publication-type.js +54 -0
- package/dist/taxonomy/publication-type.js.map +1 -0
- package/dist/taxonomy/relational.js +25 -0
- package/dist/taxonomy/relational.js.map +1 -0
- package/dist/taxonomy/search-filter-defs.js +66 -0
- package/dist/taxonomy/search-filter-defs.js.map +1 -0
- package/dist/taxonomy/skill-categories.js +28 -0
- package/dist/taxonomy/skill-categories.js.map +1 -0
- package/dist/taxonomy/skill-display-groups.js +12 -0
- package/dist/taxonomy/skill-display-groups.js.map +1 -0
- package/dist/taxonomy/skill-grouping.js +90 -0
- package/dist/taxonomy/skill-grouping.js.map +1 -0
- package/dist/taxonomy/verification-providers.js +69 -0
- package/dist/taxonomy/verification-providers.js.map +1 -0
- package/dist/taxonomy/workplace-type.js +38 -0
- package/dist/taxonomy/workplace-type.js.map +1 -0
- package/dist/tokens/colors.js +11 -0
- package/dist/tokens/colors.js.map +1 -0
- package/dist/tokens/icons.js +15 -0
- package/dist/tokens/icons.js.map +1 -0
- package/dist/tokens/index.js +10 -39
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/typography.js +23 -0
- package/dist/tokens/typography.js.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/profile-view.js +1 -0
- package/dist/types/profile-view.js.map +1 -0
- package/dist/{use-org-notification-emails-0hjt-dEw.d.ts → use-org-notification-emails-CWWi1D8t.d.ts} +2 -2
- package/package.json +4 -3
|
@@ -0,0 +1,793 @@
|
|
|
1
|
+
// src/stream/to-stream-card-vm.ts
|
|
2
|
+
import { resolveCardUrl } from "../cards/resolve-card-url.js";
|
|
3
|
+
import { isVisibleActivityItem } from "../cards/visibility.js";
|
|
4
|
+
import { isValidRgbColor } from "../format/wcag-contrast.js";
|
|
5
|
+
import { matchPublisherByUri } from "../publishing/index.js";
|
|
6
|
+
import { getActivityTier } from "../taxonomy/activity-tiers.js";
|
|
7
|
+
import { verbForCollection } from "./verbs.js";
|
|
8
|
+
var DEFAULT_SOURCE_COLOR = "slate";
|
|
9
|
+
function asRecord(value) {
|
|
10
|
+
return value !== null && typeof value === "object" ? value : null;
|
|
11
|
+
}
|
|
12
|
+
function asNonEmptyString(value) {
|
|
13
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
14
|
+
}
|
|
15
|
+
function didFromUri(uri) {
|
|
16
|
+
const match = uri.match(/^at:\/\/(did:[^/]+)\//);
|
|
17
|
+
return match?.[1];
|
|
18
|
+
}
|
|
19
|
+
function blobCid(blob) {
|
|
20
|
+
const rec = asRecord(blob);
|
|
21
|
+
if (!rec) return void 0;
|
|
22
|
+
const ref = rec.ref;
|
|
23
|
+
if (typeof ref === "string") return ref;
|
|
24
|
+
const link = asRecord(ref)?.["$link"];
|
|
25
|
+
return typeof link === "string" ? link : void 0;
|
|
26
|
+
}
|
|
27
|
+
function aspectRatio(value) {
|
|
28
|
+
const rec = asRecord(value);
|
|
29
|
+
const width = rec?.width;
|
|
30
|
+
const height = rec?.height;
|
|
31
|
+
if (typeof width === "number" && typeof height === "number") return { width, height };
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
function asFiniteNumber(value) {
|
|
35
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
36
|
+
}
|
|
37
|
+
function looseBlobCid(value) {
|
|
38
|
+
const viaRef = blobCid(value);
|
|
39
|
+
if (viaRef) return viaRef;
|
|
40
|
+
const cid = asRecord(value)?.cid;
|
|
41
|
+
return typeof cid === "string" && cid.length > 0 ? cid : void 0;
|
|
42
|
+
}
|
|
43
|
+
function blobMedia(value, did, alt) {
|
|
44
|
+
const cid = looseBlobCid(value);
|
|
45
|
+
if (!cid) return void 0;
|
|
46
|
+
const media = { did, cid, alt };
|
|
47
|
+
const ratio = aspectRatio(asRecord(value)?.aspectRatio);
|
|
48
|
+
if (ratio) media.aspectRatio = ratio;
|
|
49
|
+
const mimeType = asNonEmptyString(asRecord(value)?.mimeType);
|
|
50
|
+
if (mimeType) media.mimeType = mimeType;
|
|
51
|
+
return media;
|
|
52
|
+
}
|
|
53
|
+
function hashSuffix(value) {
|
|
54
|
+
const i = value.lastIndexOf("#");
|
|
55
|
+
return i >= 0 ? value.slice(i) : "";
|
|
56
|
+
}
|
|
57
|
+
var WORDS_PER_MINUTE = 200;
|
|
58
|
+
function estimateReadingTime(text) {
|
|
59
|
+
if (!text) return void 0;
|
|
60
|
+
const words = text.trim().split(/\s+/).filter(Boolean).length;
|
|
61
|
+
if (words === 0) return void 0;
|
|
62
|
+
return Math.max(1, Math.round(words / WORDS_PER_MINUTE));
|
|
63
|
+
}
|
|
64
|
+
function beaconGeo(value) {
|
|
65
|
+
const rec = asRecord(value);
|
|
66
|
+
if (!rec) return void 0;
|
|
67
|
+
const { latitude, longitude } = rec;
|
|
68
|
+
const okType = (v) => typeof v === "string" || typeof v === "number";
|
|
69
|
+
if (!okType(latitude) || !okType(longitude)) return void 0;
|
|
70
|
+
const lat = Number(latitude);
|
|
71
|
+
const lng = Number(longitude);
|
|
72
|
+
if (!Number.isFinite(lat) || !Number.isFinite(lng)) return void 0;
|
|
73
|
+
return { latitude: lat, longitude: lng };
|
|
74
|
+
}
|
|
75
|
+
function beaconAddress(value) {
|
|
76
|
+
const rec = asRecord(value);
|
|
77
|
+
if (!rec) return void 0;
|
|
78
|
+
const address = {};
|
|
79
|
+
const name = asNonEmptyString(rec.name);
|
|
80
|
+
if (name) address.name = name;
|
|
81
|
+
const street = asNonEmptyString(rec.street);
|
|
82
|
+
if (street) address.street = street;
|
|
83
|
+
const locality = asNonEmptyString(rec.locality);
|
|
84
|
+
if (locality) address.locality = locality;
|
|
85
|
+
const region = asNonEmptyString(rec.region);
|
|
86
|
+
if (region) address.region = region;
|
|
87
|
+
const country = asNonEmptyString(rec.country);
|
|
88
|
+
if (country) address.country = country;
|
|
89
|
+
const postalCode = asNonEmptyString(rec.postalCode);
|
|
90
|
+
if (postalCode) address.postalCode = postalCode;
|
|
91
|
+
return Object.keys(address).length > 0 ? address : void 0;
|
|
92
|
+
}
|
|
93
|
+
function parseAuthors(value) {
|
|
94
|
+
if (typeof value !== "string") return [];
|
|
95
|
+
return value.split(" ").map((a) => a.trim()).filter((a) => a.length > 0);
|
|
96
|
+
}
|
|
97
|
+
function buildSource(item, options) {
|
|
98
|
+
return {
|
|
99
|
+
appId: item.appId,
|
|
100
|
+
label: item.appName,
|
|
101
|
+
color: options.resolveSourceColor?.(item.appId) ?? DEFAULT_SOURCE_COLOR
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function buildAuthor(item) {
|
|
105
|
+
const did = didFromUri(item.uri);
|
|
106
|
+
const handle = asNonEmptyString(item.authorHandle);
|
|
107
|
+
const displayName = asNonEmptyString(item.authorDisplayName);
|
|
108
|
+
const avatar = asNonEmptyString(item.authorAvatar);
|
|
109
|
+
if (!did && !handle && !displayName && !avatar) return void 0;
|
|
110
|
+
const author = {};
|
|
111
|
+
if (did) author.did = did;
|
|
112
|
+
if (handle) author.handle = handle;
|
|
113
|
+
if (displayName) author.displayName = displayName;
|
|
114
|
+
if (avatar) author.avatar = avatar;
|
|
115
|
+
return author;
|
|
116
|
+
}
|
|
117
|
+
var TITLE_BY_VERB = {
|
|
118
|
+
posted: () => "Posted",
|
|
119
|
+
reposted: () => "Reposted",
|
|
120
|
+
published: () => "Published",
|
|
121
|
+
presented: () => "Gave a presentation",
|
|
122
|
+
endorsed: () => "Wrote an endorsement",
|
|
123
|
+
joined: () => "Joined",
|
|
124
|
+
shipped: () => "Shipped",
|
|
125
|
+
reviewed: () => "Reviewed",
|
|
126
|
+
created: () => "Shared",
|
|
127
|
+
commented: (_label, hasSubject) => hasSubject ? "Commented on" : "Commented",
|
|
128
|
+
replied: (_label, hasSubject) => hasSubject ? "Replied to" : "Replied",
|
|
129
|
+
rsvped: (_label, hasSubject) => hasSubject ? "RSVP'd to" : "RSVP'd",
|
|
130
|
+
liked: () => "Liked",
|
|
131
|
+
followed: () => "Followed",
|
|
132
|
+
bookmarked: () => "Bookmarked",
|
|
133
|
+
registered: () => "Registered",
|
|
134
|
+
annotated: () => "Annotated",
|
|
135
|
+
streamed: () => "Streamed",
|
|
136
|
+
wrote: () => "Wrote",
|
|
137
|
+
wasAt: () => "Was at",
|
|
138
|
+
metWith: () => "Met with",
|
|
139
|
+
supported: () => "Supported",
|
|
140
|
+
verified: () => "Verified",
|
|
141
|
+
received: () => "Received",
|
|
142
|
+
styledCharacter: () => "Styled a character"
|
|
143
|
+
};
|
|
144
|
+
function buildTitle(verb, label, hasSubject) {
|
|
145
|
+
return TITLE_BY_VERB[verb](label, hasSubject);
|
|
146
|
+
}
|
|
147
|
+
function recordHasSubjectRef(record) {
|
|
148
|
+
if (!record) return false;
|
|
149
|
+
const subject = record.subject;
|
|
150
|
+
if (typeof subject === "string" && subject.startsWith("at://")) return true;
|
|
151
|
+
if (subject && typeof subject === "object") {
|
|
152
|
+
const uri = subject.uri;
|
|
153
|
+
if (typeof uri === "string" && uri.length > 0) return true;
|
|
154
|
+
}
|
|
155
|
+
const reply = record.reply;
|
|
156
|
+
if (reply && typeof reply === "object") {
|
|
157
|
+
for (const key of ["parent", "root"]) {
|
|
158
|
+
const ref = reply[key];
|
|
159
|
+
if (ref && typeof ref === "object" && typeof ref.uri === "string") return true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
function resolveSourceUrl(item, record) {
|
|
165
|
+
const authorDid = didFromUri(item.uri) ?? "";
|
|
166
|
+
const authorHandle = asNonEmptyString(item.authorHandle) ?? asNonEmptyString(record.handle);
|
|
167
|
+
const url = resolveCardUrl({
|
|
168
|
+
collection: item.collection,
|
|
169
|
+
record,
|
|
170
|
+
uri: item.uri,
|
|
171
|
+
rkey: item.rkey,
|
|
172
|
+
authorDid,
|
|
173
|
+
...authorHandle ? { authorHandle } : {}
|
|
174
|
+
});
|
|
175
|
+
return url && /^https?:\/\//i.test(url) ? url : void 0;
|
|
176
|
+
}
|
|
177
|
+
function readTheme(record) {
|
|
178
|
+
const theme = asRecord(record?.publicationTheme ?? record?.theme);
|
|
179
|
+
if (!theme) return void 0;
|
|
180
|
+
const { background, foreground, accent } = theme;
|
|
181
|
+
if (isValidRgbColor(background) && isValidRgbColor(foreground) && isValidRgbColor(accent)) {
|
|
182
|
+
return { background, foreground, accent };
|
|
183
|
+
}
|
|
184
|
+
return void 0;
|
|
185
|
+
}
|
|
186
|
+
function bskyImages(embed, did) {
|
|
187
|
+
const images = embed.images;
|
|
188
|
+
if (!Array.isArray(images)) return [];
|
|
189
|
+
const out = [];
|
|
190
|
+
for (const raw of images) {
|
|
191
|
+
const img = asRecord(raw);
|
|
192
|
+
if (!img) continue;
|
|
193
|
+
const alt = asNonEmptyString(img.alt) ?? "";
|
|
194
|
+
const ratio = aspectRatio(img.aspectRatio);
|
|
195
|
+
const resolvedUrl = asNonEmptyString(img.thumb) ?? asNonEmptyString(img.fullsize);
|
|
196
|
+
if (resolvedUrl) {
|
|
197
|
+
const media2 = { url: resolvedUrl, alt };
|
|
198
|
+
if (ratio) media2.aspectRatio = ratio;
|
|
199
|
+
out.push(media2);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const cid = blobCid(img.image);
|
|
203
|
+
if (!cid) continue;
|
|
204
|
+
const media = { did, cid, alt };
|
|
205
|
+
if (ratio) media.aspectRatio = ratio;
|
|
206
|
+
const mimeType = asNonEmptyString(asRecord(img.image)?.mimeType);
|
|
207
|
+
if (mimeType) media.mimeType = mimeType;
|
|
208
|
+
out.push(media);
|
|
209
|
+
}
|
|
210
|
+
return out;
|
|
211
|
+
}
|
|
212
|
+
function bskyExternal(embed) {
|
|
213
|
+
const external = asRecord(embed.external);
|
|
214
|
+
if (!external) return void 0;
|
|
215
|
+
const url = asNonEmptyString(external.uri);
|
|
216
|
+
if (!url) return void 0;
|
|
217
|
+
const link = { url };
|
|
218
|
+
const title = asNonEmptyString(external.title);
|
|
219
|
+
if (title) link.title = title;
|
|
220
|
+
const thumb = asNonEmptyString(external.thumb);
|
|
221
|
+
if (thumb) link.thumb = thumb;
|
|
222
|
+
return link;
|
|
223
|
+
}
|
|
224
|
+
function bskyEmbedContent(record, did) {
|
|
225
|
+
const embed = asRecord(record.embed);
|
|
226
|
+
if (!embed) return {};
|
|
227
|
+
const type = asNonEmptyString(embed["$type"]);
|
|
228
|
+
const isRecordWithMedia = type === "app.bsky.embed.recordWithMedia" || type === "app.bsky.embed.recordWithMedia#view";
|
|
229
|
+
const target = isRecordWithMedia ? asRecord(embed.media) : embed;
|
|
230
|
+
if (!target) return {};
|
|
231
|
+
if (Array.isArray(target.images)) {
|
|
232
|
+
const media = bskyImages(target, did);
|
|
233
|
+
return media.length > 0 ? { media } : {};
|
|
234
|
+
}
|
|
235
|
+
if (target.external != null) {
|
|
236
|
+
const externalLink = bskyExternal(target);
|
|
237
|
+
return externalLink ? { externalLink } : {};
|
|
238
|
+
}
|
|
239
|
+
return {};
|
|
240
|
+
}
|
|
241
|
+
function applyBskyPost(vm, item, record) {
|
|
242
|
+
if (!record) {
|
|
243
|
+
vm.body = { kind: "generic" };
|
|
244
|
+
return vm;
|
|
245
|
+
}
|
|
246
|
+
const did = didFromUri(item.uri);
|
|
247
|
+
const text = asNonEmptyString(record.text);
|
|
248
|
+
const { media, externalLink } = did ? bskyEmbedContent(record, did) : {};
|
|
249
|
+
if (media) vm.media = media;
|
|
250
|
+
if (externalLink) vm.externalLink = externalLink;
|
|
251
|
+
let body;
|
|
252
|
+
if (vm.media) body = text ? { kind: "media", text } : { kind: "media" };
|
|
253
|
+
else if (vm.externalLink) body = text ? { kind: "link", text } : { kind: "link" };
|
|
254
|
+
else if (text) body = { kind: "text", text };
|
|
255
|
+
else body = { kind: "generic" };
|
|
256
|
+
vm.body = body;
|
|
257
|
+
return vm;
|
|
258
|
+
}
|
|
259
|
+
function withGeneric(vm) {
|
|
260
|
+
vm.body = { kind: "generic" };
|
|
261
|
+
return vm;
|
|
262
|
+
}
|
|
263
|
+
function applyFediversePost(vm, record) {
|
|
264
|
+
const url = httpUrl(record.url);
|
|
265
|
+
if (url) vm.sourceUrl = url;
|
|
266
|
+
const text = asNonEmptyString(record.excerpt);
|
|
267
|
+
vm.body = text ? { kind: "text", text } : { kind: "generic" };
|
|
268
|
+
return vm;
|
|
269
|
+
}
|
|
270
|
+
function applyGithubPr(vm, record) {
|
|
271
|
+
const body = {
|
|
272
|
+
kind: "github-pr",
|
|
273
|
+
repoOwner: asNonEmptyString(record.repoOwner) ?? "",
|
|
274
|
+
repoName: asNonEmptyString(record.repoName) ?? "",
|
|
275
|
+
prNumber: asFiniteNumber(record.prNumber) ?? 0,
|
|
276
|
+
title: asNonEmptyString(record.title) ?? "",
|
|
277
|
+
additions: asFiniteNumber(record.additions) ?? 0,
|
|
278
|
+
deletions: asFiniteNumber(record.deletions) ?? 0
|
|
279
|
+
};
|
|
280
|
+
const url = asNonEmptyString(record.url);
|
|
281
|
+
if (url) body.url = url;
|
|
282
|
+
const language = asNonEmptyString(record.language);
|
|
283
|
+
if (language) body.language = language;
|
|
284
|
+
const mergedAt = asNonEmptyString(record.mergedAt);
|
|
285
|
+
if (mergedAt) body.mergedAt = mergedAt;
|
|
286
|
+
vm.body = body;
|
|
287
|
+
return vm;
|
|
288
|
+
}
|
|
289
|
+
function applyBook(vm, item, record) {
|
|
290
|
+
const title = asNonEmptyString(record.title) ?? "Untitled book";
|
|
291
|
+
const body = {
|
|
292
|
+
kind: "book",
|
|
293
|
+
title,
|
|
294
|
+
authors: parseAuthors(record.authors)
|
|
295
|
+
};
|
|
296
|
+
const stars = asFiniteNumber(record.stars);
|
|
297
|
+
if (stars !== void 0 && stars > 0) body.stars = stars;
|
|
298
|
+
const status = asNonEmptyString(record.status);
|
|
299
|
+
if (status) body.status = status;
|
|
300
|
+
const review = asNonEmptyString(
|
|
301
|
+
typeof record.review === "string" ? record.review.trim() : void 0
|
|
302
|
+
);
|
|
303
|
+
if (review) body.review = review;
|
|
304
|
+
vm.body = body;
|
|
305
|
+
const did = didFromUri(item.uri);
|
|
306
|
+
if (did) {
|
|
307
|
+
const cover = blobMedia(record.cover, did, `The cover of ${title}`);
|
|
308
|
+
if (cover) vm.media = [cover];
|
|
309
|
+
}
|
|
310
|
+
return vm;
|
|
311
|
+
}
|
|
312
|
+
function popfeedReviewKind(collection) {
|
|
313
|
+
if (collection.endsWith(".review")) return "review";
|
|
314
|
+
if (collection.endsWith(".post")) return "post";
|
|
315
|
+
if (collection.endsWith(".note")) return "note";
|
|
316
|
+
return "other";
|
|
317
|
+
}
|
|
318
|
+
function applyMediaReview(vm, item, record) {
|
|
319
|
+
const title = asNonEmptyString(record.title) ?? asNonEmptyString(record.name);
|
|
320
|
+
const body = {
|
|
321
|
+
kind: "media-review",
|
|
322
|
+
reviewKind: popfeedReviewKind(item.collection),
|
|
323
|
+
isRevisit: record.isRevisit === true
|
|
324
|
+
};
|
|
325
|
+
if (title) body.title = title;
|
|
326
|
+
const mediaType = asNonEmptyString(record.creativeWorkType);
|
|
327
|
+
if (mediaType) body.mediaType = mediaType;
|
|
328
|
+
const rating = asFiniteNumber(record.rating);
|
|
329
|
+
if (rating !== void 0) body.rating = rating;
|
|
330
|
+
const mainCredit = asNonEmptyString(record.mainCredit);
|
|
331
|
+
if (mainCredit) body.mainCredit = mainCredit;
|
|
332
|
+
const reviewText = asNonEmptyString(record.text);
|
|
333
|
+
if (reviewText) body.reviewText = reviewText;
|
|
334
|
+
vm.body = body;
|
|
335
|
+
const posterUrl = asNonEmptyString(record.posterUrl);
|
|
336
|
+
if (posterUrl) vm.media = [{ url: posterUrl, alt: title ? `${title} poster` : "" }];
|
|
337
|
+
return vm;
|
|
338
|
+
}
|
|
339
|
+
var RSVP_STATUS = {
|
|
340
|
+
"#going": "going",
|
|
341
|
+
"#interested": "interested",
|
|
342
|
+
"#notgoing": "notgoing"
|
|
343
|
+
};
|
|
344
|
+
var RSVP_MODE = {
|
|
345
|
+
"#inperson": "inperson",
|
|
346
|
+
"#virtual": "virtual",
|
|
347
|
+
"#hybrid": "hybrid"
|
|
348
|
+
};
|
|
349
|
+
function applyEventRsvp(vm, record) {
|
|
350
|
+
const status = asNonEmptyString(record.status);
|
|
351
|
+
const body = {
|
|
352
|
+
kind: "event-rsvp",
|
|
353
|
+
rsvpStatus: (status ? RSVP_STATUS[hashSuffix(status)] : void 0) ?? "unknown"
|
|
354
|
+
};
|
|
355
|
+
const meta = asRecord(record.eventMeta);
|
|
356
|
+
if (meta) {
|
|
357
|
+
const eventName = asNonEmptyString(meta.name);
|
|
358
|
+
if (eventName) body.eventName = eventName;
|
|
359
|
+
const startsAt = asNonEmptyString(meta.startsAt);
|
|
360
|
+
if (startsAt) body.startsAt = startsAt;
|
|
361
|
+
const endsAt = asNonEmptyString(meta.endsAt);
|
|
362
|
+
if (endsAt) body.endsAt = endsAt;
|
|
363
|
+
const mode = asNonEmptyString(meta.mode);
|
|
364
|
+
const modeEnum = mode ? RSVP_MODE[hashSuffix(mode)] : void 0;
|
|
365
|
+
if (modeEnum) body.mode = modeEnum;
|
|
366
|
+
const locationName = asNonEmptyString(meta.locationName);
|
|
367
|
+
if (locationName) body.locationName = locationName;
|
|
368
|
+
const locationLocality = asNonEmptyString(meta.locationLocality);
|
|
369
|
+
if (locationLocality) body.locationLocality = locationLocality;
|
|
370
|
+
const locationCountry = asNonEmptyString(meta.locationCountry);
|
|
371
|
+
if (locationCountry) body.locationCountry = locationCountry;
|
|
372
|
+
}
|
|
373
|
+
vm.body = body;
|
|
374
|
+
const eventUri = nonBlankString(asRecord(record.subject)?.uri);
|
|
375
|
+
if (eventUri) {
|
|
376
|
+
vm.subject = {
|
|
377
|
+
kind: "record",
|
|
378
|
+
uri: eventUri,
|
|
379
|
+
...body.eventName ? { title: body.eventName } : {}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
return vm;
|
|
383
|
+
}
|
|
384
|
+
function applyKeytraceVerification(vm, record) {
|
|
385
|
+
const identity = asRecord(record.identity) ?? {};
|
|
386
|
+
const subject = asNonEmptyString(identity.subject);
|
|
387
|
+
const displayName = asNonEmptyString(identity.displayName);
|
|
388
|
+
const body = {
|
|
389
|
+
kind: "verification",
|
|
390
|
+
platform: asNonEmptyString(record.type) ?? "unknown",
|
|
391
|
+
verified: record.status === "verified"
|
|
392
|
+
};
|
|
393
|
+
const subjectLabel = displayName ?? subject;
|
|
394
|
+
if (subjectLabel) body.subjectLabel = subjectLabel;
|
|
395
|
+
const profileUrl = asNonEmptyString(identity.profileUrl);
|
|
396
|
+
if (profileUrl) body.profileUrl = profileUrl;
|
|
397
|
+
vm.body = body;
|
|
398
|
+
const accountLabel = subjectLabel ?? asNonEmptyString(record.type);
|
|
399
|
+
if (accountLabel) {
|
|
400
|
+
vm.subject = {
|
|
401
|
+
kind: "record",
|
|
402
|
+
uri: "",
|
|
403
|
+
title: accountLabel,
|
|
404
|
+
...profileUrl ? { url: profileUrl } : {}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
return vm;
|
|
408
|
+
}
|
|
409
|
+
function applyBskyVerification(vm, record) {
|
|
410
|
+
const handle = asNonEmptyString(record.handle);
|
|
411
|
+
const displayName = asNonEmptyString(record.displayName);
|
|
412
|
+
const body = {
|
|
413
|
+
kind: "verification",
|
|
414
|
+
platform: "bluesky",
|
|
415
|
+
verified: true
|
|
416
|
+
};
|
|
417
|
+
const subjectLabel = displayName ?? handle;
|
|
418
|
+
if (subjectLabel) body.subjectLabel = subjectLabel;
|
|
419
|
+
if (handle) body.handle = handle;
|
|
420
|
+
vm.body = body;
|
|
421
|
+
return vm;
|
|
422
|
+
}
|
|
423
|
+
function applyMembership(vm, record) {
|
|
424
|
+
const body = { kind: "membership" };
|
|
425
|
+
const communityUri = asNonEmptyString(record.community);
|
|
426
|
+
if (communityUri) body.communityUri = communityUri;
|
|
427
|
+
const meta = asRecord(record.communityMeta);
|
|
428
|
+
const communityName = meta ? asNonEmptyString(meta.name) : void 0;
|
|
429
|
+
if (communityName) body.communityName = communityName;
|
|
430
|
+
const description = meta ? asNonEmptyString(meta.description) : void 0;
|
|
431
|
+
if (description) body.description = description;
|
|
432
|
+
vm.body = body;
|
|
433
|
+
if (meta) {
|
|
434
|
+
const ownerDid = asNonEmptyString(meta.ownerDid) ?? (communityUri ? didFromUri(communityUri) : void 0);
|
|
435
|
+
if (ownerDid) {
|
|
436
|
+
const picture = blobMedia(meta.picture, ownerDid, communityName ?? "");
|
|
437
|
+
if (picture) vm.media = [picture];
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return vm;
|
|
441
|
+
}
|
|
442
|
+
function applyLocation(vm, record) {
|
|
443
|
+
const body = { kind: "location" };
|
|
444
|
+
const venueName = asNonEmptyString(record.venueName);
|
|
445
|
+
if (venueName) body.venueName = venueName;
|
|
446
|
+
const shout = asNonEmptyString(record.shout);
|
|
447
|
+
if (shout) body.shout = shout;
|
|
448
|
+
const address = beaconAddress(record.addressDetails);
|
|
449
|
+
if (address) body.address = address;
|
|
450
|
+
const geo = beaconGeo(record.location);
|
|
451
|
+
if (geo) body.geo = geo;
|
|
452
|
+
vm.body = body;
|
|
453
|
+
return vm;
|
|
454
|
+
}
|
|
455
|
+
function applyTravel(vm, record) {
|
|
456
|
+
const body = { kind: "travel" };
|
|
457
|
+
const origin = asNonEmptyString(record.originTransportCode);
|
|
458
|
+
if (origin) body.origin = origin;
|
|
459
|
+
const destination = asNonEmptyString(record.destinationTransportCode);
|
|
460
|
+
if (destination) body.destination = destination;
|
|
461
|
+
const transportation = asNonEmptyString(record.transportation);
|
|
462
|
+
if (transportation) body.transportation = transportation;
|
|
463
|
+
const carrier = asNonEmptyString(record.carrier);
|
|
464
|
+
if (carrier) body.carrier = carrier;
|
|
465
|
+
const carrierCode = asNonEmptyString(record.carrierCode);
|
|
466
|
+
if (carrierCode) body.carrierCode = carrierCode;
|
|
467
|
+
const startDate = asNonEmptyString(record.startDate);
|
|
468
|
+
if (startDate) body.startDate = startDate;
|
|
469
|
+
const endDate = asNonEmptyString(record.endDate);
|
|
470
|
+
if (endDate) body.endDate = endDate;
|
|
471
|
+
vm.body = body;
|
|
472
|
+
return vm;
|
|
473
|
+
}
|
|
474
|
+
function applyStandardSite(vm, record) {
|
|
475
|
+
const body = { kind: "standard-site" };
|
|
476
|
+
const title = asNonEmptyString(record.title);
|
|
477
|
+
if (title) body.title = title;
|
|
478
|
+
const description = asNonEmptyString(record.description);
|
|
479
|
+
if (description) body.description = description;
|
|
480
|
+
const siteUrl = asNonEmptyString(record.siteUrl);
|
|
481
|
+
if (siteUrl) {
|
|
482
|
+
body.siteUrl = siteUrl;
|
|
483
|
+
const publisherName = matchPublisherByUri(siteUrl)?.name;
|
|
484
|
+
if (publisherName) body.publisherName = publisherName;
|
|
485
|
+
}
|
|
486
|
+
const path = asNonEmptyString(record.path);
|
|
487
|
+
if (path) body.path = path;
|
|
488
|
+
const icon = asNonEmptyString(record.publicationIcon);
|
|
489
|
+
if (icon) body.icon = icon;
|
|
490
|
+
const coverImageUrl = asNonEmptyString(record.coverImageUrl);
|
|
491
|
+
if (coverImageUrl) body.coverImageUrl = coverImageUrl;
|
|
492
|
+
const readingTime = estimateReadingTime(asNonEmptyString(record.textContent));
|
|
493
|
+
if (readingTime !== void 0) body.readingTime = readingTime;
|
|
494
|
+
const publishedAt = asNonEmptyString(record.publishedAt);
|
|
495
|
+
if (publishedAt) body.publishedAt = publishedAt;
|
|
496
|
+
vm.body = body;
|
|
497
|
+
return vm;
|
|
498
|
+
}
|
|
499
|
+
function applyYouAndMe(vm, record, item) {
|
|
500
|
+
const did = asNonEmptyString(record.subject);
|
|
501
|
+
if (did) vm.subject = withResolvedSubjectMeta({ kind: "person", did }, item);
|
|
502
|
+
vm.body = { kind: "generic" };
|
|
503
|
+
return vm;
|
|
504
|
+
}
|
|
505
|
+
function applyAsqAnswer(vm, record) {
|
|
506
|
+
const uri = asNonEmptyString(asRecord(record.subject)?.uri);
|
|
507
|
+
if (uri) vm.subject = { kind: "record", uri };
|
|
508
|
+
vm.body = { kind: "generic" };
|
|
509
|
+
return vm;
|
|
510
|
+
}
|
|
511
|
+
function nonBlankString(value) {
|
|
512
|
+
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
513
|
+
}
|
|
514
|
+
function readBodyField(value) {
|
|
515
|
+
const direct = nonBlankString(value);
|
|
516
|
+
if (direct) return direct;
|
|
517
|
+
return nonBlankString(asRecord(value)?.value);
|
|
518
|
+
}
|
|
519
|
+
function httpUrl(value) {
|
|
520
|
+
return typeof value === "string" && /^https?:\/\//i.test(value) ? value : void 0;
|
|
521
|
+
}
|
|
522
|
+
var GENERIC_TEXT_ORDER = [
|
|
523
|
+
"text",
|
|
524
|
+
"title",
|
|
525
|
+
"name",
|
|
526
|
+
"description",
|
|
527
|
+
"content",
|
|
528
|
+
"excerpt",
|
|
529
|
+
"body",
|
|
530
|
+
"message",
|
|
531
|
+
"note",
|
|
532
|
+
"caption",
|
|
533
|
+
"summary",
|
|
534
|
+
"domain",
|
|
535
|
+
"status"
|
|
536
|
+
];
|
|
537
|
+
function genericText(collection, record) {
|
|
538
|
+
if (collection === "social.passports.fiftyStates.visit") {
|
|
539
|
+
return nonBlankString(record.city);
|
|
540
|
+
}
|
|
541
|
+
for (const field of GENERIC_TEXT_ORDER) {
|
|
542
|
+
if (field === "body") {
|
|
543
|
+
const body = readBodyField(record.body);
|
|
544
|
+
if (body) return body;
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
const value = nonBlankString(record[field]);
|
|
548
|
+
if (value) return value;
|
|
549
|
+
}
|
|
550
|
+
return void 0;
|
|
551
|
+
}
|
|
552
|
+
function genericTags(record) {
|
|
553
|
+
const tags = record.tags;
|
|
554
|
+
if (!Array.isArray(tags)) return void 0;
|
|
555
|
+
const out = tags.filter((t) => typeof t === "string" && t.length > 0);
|
|
556
|
+
return out.length > 0 ? out : void 0;
|
|
557
|
+
}
|
|
558
|
+
function genericMedia(record, did, alt) {
|
|
559
|
+
const fromArray = (raw) => {
|
|
560
|
+
const img = asRecord(raw);
|
|
561
|
+
if (!img) return void 0;
|
|
562
|
+
return blobMedia(img.image ?? raw, did, asNonEmptyString(img.alt) ?? alt);
|
|
563
|
+
};
|
|
564
|
+
const images = record.images;
|
|
565
|
+
if (Array.isArray(images)) {
|
|
566
|
+
const out = images.map(fromArray).filter((m) => m !== void 0);
|
|
567
|
+
if (out.length > 0) return out;
|
|
568
|
+
}
|
|
569
|
+
const embed = asRecord(record.embed);
|
|
570
|
+
if (embed && Array.isArray(embed.images)) {
|
|
571
|
+
const out = embed.images.map(fromArray).filter((m) => m !== void 0);
|
|
572
|
+
if (out.length > 0) return out;
|
|
573
|
+
}
|
|
574
|
+
const single = blobMedia(record.image, did, alt) ?? blobMedia(record.thumbnail, did, alt) ?? blobMedia(record.thumb, did, alt) ?? blobMedia(record.photo, did, alt) ?? (embed ? blobMedia(embed.thumbnail, did, alt) : void 0);
|
|
575
|
+
if (single) return [single];
|
|
576
|
+
const coverCid = asRecord(record.galleryMeta)?.coverPhotoCid;
|
|
577
|
+
if (typeof coverCid === "string" && coverCid.length > 0) {
|
|
578
|
+
return [{ did, cid: coverCid, alt }];
|
|
579
|
+
}
|
|
580
|
+
return [];
|
|
581
|
+
}
|
|
582
|
+
function genericExternalLink(record) {
|
|
583
|
+
const embed = asRecord(record.embed);
|
|
584
|
+
if (embed) {
|
|
585
|
+
const fromEmbed = bskyExternal(embed);
|
|
586
|
+
if (fromEmbed) return fromEmbed;
|
|
587
|
+
}
|
|
588
|
+
const url = httpUrl(record.source) ?? httpUrl(record.subject) ?? httpUrl(record.url);
|
|
589
|
+
return url ? { url } : void 0;
|
|
590
|
+
}
|
|
591
|
+
function genericSubject(record) {
|
|
592
|
+
const subject = record.subject;
|
|
593
|
+
if (typeof subject === "string") {
|
|
594
|
+
if (subject.startsWith("at://")) return { kind: "record", uri: subject };
|
|
595
|
+
if (subject.startsWith("did:")) return { kind: "person", did: subject };
|
|
596
|
+
return void 0;
|
|
597
|
+
}
|
|
598
|
+
const uri = nonBlankString(asRecord(subject)?.uri);
|
|
599
|
+
if (uri && uri.startsWith("at://")) return { kind: "record", uri };
|
|
600
|
+
const parentUri = nonBlankString(asRecord(asRecord(record.reply)?.parent)?.uri);
|
|
601
|
+
if (parentUri && parentUri.startsWith("at://")) return { kind: "record", uri: parentUri };
|
|
602
|
+
const target = asRecord(record.target);
|
|
603
|
+
if (target) {
|
|
604
|
+
const source = httpUrl(target.source);
|
|
605
|
+
if (source) {
|
|
606
|
+
const title = nonBlankString(target.title);
|
|
607
|
+
return { kind: "record", uri: source, ...title ? { title } : {}, url: source };
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return void 0;
|
|
611
|
+
}
|
|
612
|
+
function withResolvedSubjectMeta(subject, item) {
|
|
613
|
+
if (subject.kind === "person") {
|
|
614
|
+
const handle = nonBlankString(item.subjectHandle) ?? subject.handle;
|
|
615
|
+
const displayName = nonBlankString(item.subjectDisplayName) ?? subject.displayName;
|
|
616
|
+
return {
|
|
617
|
+
...subject,
|
|
618
|
+
...handle ? { handle } : {},
|
|
619
|
+
...displayName ? { displayName } : {}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
if (subject.kind !== "record") return subject;
|
|
623
|
+
const title = nonBlankString(item.subjectTitle) ?? subject.title;
|
|
624
|
+
const url = nonBlankString(item.subjectUrl);
|
|
625
|
+
return { ...subject, ...title ? { title } : {}, ...url ? { url } : {} };
|
|
626
|
+
}
|
|
627
|
+
function parseFacetFeature(features) {
|
|
628
|
+
for (const raw of features) {
|
|
629
|
+
const feat = asRecord(raw);
|
|
630
|
+
if (!feat) continue;
|
|
631
|
+
const type = asNonEmptyString(feat["$type"]) ?? "";
|
|
632
|
+
const uri = asNonEmptyString(feat.uri);
|
|
633
|
+
const did = asNonEmptyString(feat.did);
|
|
634
|
+
const tag = asNonEmptyString(feat.tag);
|
|
635
|
+
if (type.endsWith("#link") && uri) return { link: uri };
|
|
636
|
+
if (type.endsWith("#mention") && did) return { mention: did };
|
|
637
|
+
if (type.endsWith("#tag") && tag) return { tag };
|
|
638
|
+
if (uri) return { link: uri };
|
|
639
|
+
if (did) return { mention: did };
|
|
640
|
+
if (tag) return { tag };
|
|
641
|
+
}
|
|
642
|
+
return void 0;
|
|
643
|
+
}
|
|
644
|
+
function genericRichSegments(text, record) {
|
|
645
|
+
const facets = record.facets;
|
|
646
|
+
if (!Array.isArray(facets)) return void 0;
|
|
647
|
+
const parsed = [];
|
|
648
|
+
for (const raw of facets) {
|
|
649
|
+
const facet = asRecord(raw);
|
|
650
|
+
const index = asRecord(facet?.index);
|
|
651
|
+
const start = asFiniteNumber(index?.byteStart);
|
|
652
|
+
const end = asFiniteNumber(index?.byteEnd);
|
|
653
|
+
if (start === void 0 || end === void 0 || start < 0 || end <= start) continue;
|
|
654
|
+
const features = facet?.features;
|
|
655
|
+
if (!Array.isArray(features)) continue;
|
|
656
|
+
const feature = parseFacetFeature(features);
|
|
657
|
+
if (!feature) continue;
|
|
658
|
+
parsed.push({ start, end, ...feature });
|
|
659
|
+
}
|
|
660
|
+
if (parsed.length === 0) return void 0;
|
|
661
|
+
const bytes = new TextEncoder().encode(text);
|
|
662
|
+
const decoder = new TextDecoder();
|
|
663
|
+
parsed.sort((a, b) => a.start - b.start);
|
|
664
|
+
const segments = [];
|
|
665
|
+
let cursor = 0;
|
|
666
|
+
for (const span of parsed) {
|
|
667
|
+
if (span.start < cursor || span.start > bytes.length) continue;
|
|
668
|
+
const end = Math.min(span.end, bytes.length);
|
|
669
|
+
if (span.start > cursor) {
|
|
670
|
+
const plain = decoder.decode(bytes.slice(cursor, span.start));
|
|
671
|
+
if (plain) segments.push({ text: plain });
|
|
672
|
+
}
|
|
673
|
+
const seg = { text: decoder.decode(bytes.slice(span.start, end)) };
|
|
674
|
+
if (span.link) seg.link = span.link;
|
|
675
|
+
if (span.mention) seg.mention = span.mention;
|
|
676
|
+
if (span.tag) seg.tag = span.tag;
|
|
677
|
+
segments.push(seg);
|
|
678
|
+
cursor = end;
|
|
679
|
+
}
|
|
680
|
+
if (cursor < bytes.length) {
|
|
681
|
+
const rest = decoder.decode(bytes.slice(cursor));
|
|
682
|
+
if (rest) segments.push({ text: rest });
|
|
683
|
+
}
|
|
684
|
+
return segments.some((s) => s.link ?? s.mention ?? s.tag) ? segments : void 0;
|
|
685
|
+
}
|
|
686
|
+
function applyGeneric(vm, item, record) {
|
|
687
|
+
if (!record) return withGeneric(vm);
|
|
688
|
+
const text = genericText(item.collection, record);
|
|
689
|
+
const tags = genericTags(record);
|
|
690
|
+
const did = didFromUri(item.uri);
|
|
691
|
+
if (did) {
|
|
692
|
+
const media = genericMedia(record, did, text ?? "");
|
|
693
|
+
if (media.length > 0) vm.media = media;
|
|
694
|
+
}
|
|
695
|
+
const externalLink = genericExternalLink(record);
|
|
696
|
+
if (externalLink) vm.externalLink = externalLink;
|
|
697
|
+
if (!vm.subject) {
|
|
698
|
+
const subject = genericSubject(record);
|
|
699
|
+
if (subject) vm.subject = withResolvedSubjectMeta(subject, item);
|
|
700
|
+
}
|
|
701
|
+
let body;
|
|
702
|
+
if (text) {
|
|
703
|
+
body = { kind: "text", text };
|
|
704
|
+
const richSegments = genericRichSegments(text, record);
|
|
705
|
+
if (richSegments) body.richSegments = richSegments;
|
|
706
|
+
if (tags) body.tags = tags;
|
|
707
|
+
} else if (vm.media) {
|
|
708
|
+
body = { kind: "media" };
|
|
709
|
+
if (tags) body.tags = tags;
|
|
710
|
+
} else if (vm.externalLink) {
|
|
711
|
+
body = { kind: "link" };
|
|
712
|
+
if (tags) body.tags = tags;
|
|
713
|
+
} else {
|
|
714
|
+
body = { kind: "generic" };
|
|
715
|
+
if (tags) body.tags = tags;
|
|
716
|
+
}
|
|
717
|
+
vm.body = body;
|
|
718
|
+
return vm;
|
|
719
|
+
}
|
|
720
|
+
function toStreamCardVM(item, options = {}) {
|
|
721
|
+
const verb = verbForCollection(item.collection);
|
|
722
|
+
const source = buildSource(item, options);
|
|
723
|
+
const record = asRecord(item.record);
|
|
724
|
+
const timestamp = (record ? asNonEmptyString(record.createdAt) : void 0) ?? item.indexedAt;
|
|
725
|
+
const vm = {
|
|
726
|
+
uri: item.uri,
|
|
727
|
+
cid: item.cid,
|
|
728
|
+
verb,
|
|
729
|
+
source,
|
|
730
|
+
tier: getActivityTier(item.collection),
|
|
731
|
+
timestamp,
|
|
732
|
+
title: buildTitle(verb, source.label, recordHasSubjectRef(record))
|
|
733
|
+
};
|
|
734
|
+
const author = buildAuthor(item);
|
|
735
|
+
if (author) vm.author = author;
|
|
736
|
+
const theme = readTheme(record);
|
|
737
|
+
if (theme) vm.theme = theme;
|
|
738
|
+
if (record) {
|
|
739
|
+
const sourceUrl = resolveSourceUrl(item, record);
|
|
740
|
+
if (sourceUrl) vm.sourceUrl = sourceUrl;
|
|
741
|
+
}
|
|
742
|
+
if (item.hypercertDetails) vm.hypercertDetails = item.hypercertDetails;
|
|
743
|
+
if (item.certifiedDetails) vm.certifiedDetails = item.certifiedDetails;
|
|
744
|
+
if (item.subject) {
|
|
745
|
+
vm.subject = { kind: "post", post: toStreamCardVM(item.subject, options) };
|
|
746
|
+
}
|
|
747
|
+
switch (item.collection) {
|
|
748
|
+
case "app.bsky.feed.post":
|
|
749
|
+
return applyBskyPost(vm, item, record);
|
|
750
|
+
case "github.pull_request":
|
|
751
|
+
return record ? applyGithubPr(vm, record) : withGeneric(vm);
|
|
752
|
+
case "buzz.bookhive.book":
|
|
753
|
+
return record ? applyBook(vm, item, record) : withGeneric(vm);
|
|
754
|
+
case "community.lexicon.calendar.rsvp":
|
|
755
|
+
return record ? applyEventRsvp(vm, record) : withGeneric(vm);
|
|
756
|
+
case "dev.keytrace.claim":
|
|
757
|
+
return record ? applyKeytraceVerification(vm, record) : withGeneric(vm);
|
|
758
|
+
case "app.bsky.graph.verification":
|
|
759
|
+
return record ? applyBskyVerification(vm, record) : withGeneric(vm);
|
|
760
|
+
case "social.colibri.membership":
|
|
761
|
+
return record ? applyMembership(vm, record) : withGeneric(vm);
|
|
762
|
+
case "app.beaconbits.beacon":
|
|
763
|
+
return record ? applyLocation(vm, record) : withGeneric(vm);
|
|
764
|
+
case "social.passports.travel.leg":
|
|
765
|
+
return record ? applyTravel(vm, record) : withGeneric(vm);
|
|
766
|
+
case "site.standard.document":
|
|
767
|
+
return record ? applyStandardSite(vm, record) : withGeneric(vm);
|
|
768
|
+
case "at.youandme.connection":
|
|
769
|
+
return record ? applyYouAndMe(vm, record, item) : withGeneric(vm);
|
|
770
|
+
case "fyi.asq.answer":
|
|
771
|
+
return record ? applyAsqAnswer(vm, record) : withGeneric(vm);
|
|
772
|
+
case "fediverse.post":
|
|
773
|
+
return record ? applyFediversePost(vm, record) : withGeneric(vm);
|
|
774
|
+
}
|
|
775
|
+
if (record && item.collection.startsWith("social.popfeed.feed.")) {
|
|
776
|
+
return applyMediaReview(vm, item, record);
|
|
777
|
+
}
|
|
778
|
+
return applyGeneric(vm, item, record);
|
|
779
|
+
}
|
|
780
|
+
function toStreamCardVMs(items, options = {}) {
|
|
781
|
+
const out = [];
|
|
782
|
+
for (const item of items) {
|
|
783
|
+
if (isVisibleActivityItem(item.collection, item.record)) {
|
|
784
|
+
out.push(toStreamCardVM(item, options));
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
return out;
|
|
788
|
+
}
|
|
789
|
+
export {
|
|
790
|
+
toStreamCardVM,
|
|
791
|
+
toStreamCardVMs
|
|
792
|
+
};
|
|
793
|
+
//# sourceMappingURL=to-stream-card-vm.js.map
|