@singi-labs/sifa-sdk 0.19.44 → 0.19.45
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.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 +100 -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 +29 -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 +1 -1
- package/dist/index.js +675 -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.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 +31 -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.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.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
package/dist/query/index.js
CHANGED
|
@@ -1,3746 +1,687 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
// src/query/index.ts
|
|
2
|
+
import {
|
|
3
|
+
ApiError,
|
|
4
|
+
apiFetch,
|
|
5
|
+
apiFetchOrNull,
|
|
6
|
+
apiWrite,
|
|
7
|
+
apiWriteCreate
|
|
8
|
+
} from "./client.js";
|
|
9
|
+
import { SifaProvider, useSifaConfig } from "./config.js";
|
|
10
|
+
import { fetchAtFundLink, fetchProfile } from "./fetchers/profile.js";
|
|
11
|
+
import { fetchGetProfileView } from "./fetchers/get-profile-view.js";
|
|
12
|
+
import { fetchProfileSummary } from "./fetchers/profile-summary.js";
|
|
13
|
+
import {
|
|
14
|
+
deleteAvatarOverride,
|
|
15
|
+
deleteNamePronunciationAudio,
|
|
16
|
+
refreshPds,
|
|
17
|
+
updateProfileOverride,
|
|
18
|
+
updateProfileSelf,
|
|
19
|
+
uploadAvatar,
|
|
20
|
+
uploadNamePronunciationAudio
|
|
21
|
+
} from "./fetchers/profile-mutations.js";
|
|
22
|
+
import {
|
|
23
|
+
createPosition,
|
|
24
|
+
deletePosition,
|
|
25
|
+
linkSkillToPosition,
|
|
26
|
+
setPositionPrimary,
|
|
27
|
+
unlinkSkillFromPosition,
|
|
28
|
+
unsetPositionPrimary,
|
|
29
|
+
updatePosition
|
|
30
|
+
} from "./fetchers/positions.js";
|
|
31
|
+
import { createEducation, deleteEducation, updateEducation } from "./fetchers/education.js";
|
|
32
|
+
import {
|
|
33
|
+
setSectionPrimary,
|
|
34
|
+
unsetSectionPrimary
|
|
35
|
+
} from "./fetchers/section-primary.js";
|
|
36
|
+
import {
|
|
37
|
+
createSkill,
|
|
38
|
+
deleteSkill,
|
|
39
|
+
updateSkill,
|
|
40
|
+
updateSkillSubCategories
|
|
41
|
+
} from "./fetchers/skills.js";
|
|
42
|
+
import { createRecord, deleteRecord, updateRecord } from "./fetchers/records.js";
|
|
43
|
+
import {
|
|
44
|
+
createProfileLocation,
|
|
45
|
+
deleteProfileLocation,
|
|
46
|
+
updateProfileLocation
|
|
47
|
+
} from "./fetchers/profile-locations.js";
|
|
48
|
+
import {
|
|
49
|
+
createExternalAccount,
|
|
50
|
+
deleteExternalAccount,
|
|
51
|
+
fetchExternalAccounts,
|
|
52
|
+
setExternalAccountPrimary,
|
|
53
|
+
unsetExternalAccountPrimary,
|
|
54
|
+
updateExternalAccount,
|
|
55
|
+
verifyExternalAccount
|
|
56
|
+
} from "./fetchers/external-accounts.js";
|
|
57
|
+
import {
|
|
58
|
+
createEndorsement,
|
|
59
|
+
confirmEndorsement
|
|
60
|
+
} from "./fetchers/endorsements.js";
|
|
61
|
+
import {
|
|
62
|
+
fetchReceivedEndorsements
|
|
63
|
+
} from "./fetchers/received-endorsements.js";
|
|
64
|
+
import {
|
|
65
|
+
fetchReciprocityCandidate
|
|
66
|
+
} from "./fetchers/reciprocity.js";
|
|
67
|
+
import {
|
|
68
|
+
fetchPendingEndorsements,
|
|
69
|
+
dismissEndorsement
|
|
70
|
+
} from "./fetchers/endorsement-inbox.js";
|
|
71
|
+
import {
|
|
72
|
+
fetchPendingConfirmations,
|
|
73
|
+
fetchGivenConfirmations,
|
|
74
|
+
createConfirmation,
|
|
75
|
+
dismissConfirmation,
|
|
76
|
+
revokeConfirmation
|
|
77
|
+
} from "./fetchers/confirmations.js";
|
|
78
|
+
import {
|
|
79
|
+
fetchInboxCounts
|
|
80
|
+
} from "./fetchers/inbox.js";
|
|
81
|
+
import {
|
|
82
|
+
fetchUnlinkedPositions,
|
|
83
|
+
dismissUnlinkedPosition
|
|
84
|
+
} from "./fetchers/unlinked-positions.js";
|
|
85
|
+
import {
|
|
86
|
+
fetchProfileCompleteness,
|
|
87
|
+
PROFILE_COMPLETENESS_SIGNALS
|
|
88
|
+
} from "./fetchers/profile-completeness.js";
|
|
89
|
+
import { fetchResolveActor, fetchTypeaheadActors } from "./fetchers/actor.js";
|
|
90
|
+
import { hideKeytraceClaim, unhideKeytraceClaim } from "./fetchers/keytrace-claims.js";
|
|
91
|
+
import { revealMarqueDomain, unrevealMarqueDomain } from "./fetchers/marque-domains.js";
|
|
92
|
+
import {
|
|
93
|
+
bulkHideStandardPublications,
|
|
94
|
+
bulkUnhideStandardPublications,
|
|
95
|
+
hideOrcidPublication,
|
|
96
|
+
hideSifaPublication,
|
|
97
|
+
hideStandardPublication,
|
|
98
|
+
refreshOrcidPublications,
|
|
99
|
+
unhideOrcidPublication,
|
|
100
|
+
unhideSifaPublication,
|
|
101
|
+
unhideStandardPublication
|
|
102
|
+
} from "./fetchers/publications.js";
|
|
103
|
+
import {
|
|
104
|
+
bulkHideProfileItems,
|
|
105
|
+
bulkUnhideProfileItems,
|
|
106
|
+
hideProfileItem,
|
|
107
|
+
unhideProfileItem,
|
|
108
|
+
HIDDEN_ITEM_SOURCES,
|
|
109
|
+
HIDDEN_ITEM_TYPES
|
|
110
|
+
} from "./fetchers/profile-items-hide.js";
|
|
111
|
+
import {
|
|
112
|
+
fetchHiddenActivityItems,
|
|
113
|
+
hideActivityItem,
|
|
114
|
+
unhideActivityItem
|
|
115
|
+
} from "./fetchers/activity-items-hide.js";
|
|
116
|
+
import { fetchStats } from "./fetchers/stats.js";
|
|
117
|
+
import {
|
|
118
|
+
fetchAppsRegistry,
|
|
119
|
+
fetchHiddenApps
|
|
120
|
+
} from "./fetchers/apps.js";
|
|
121
|
+
import {
|
|
122
|
+
fetchAccounts,
|
|
123
|
+
switchAccount
|
|
124
|
+
} from "./fetchers/accounts.js";
|
|
125
|
+
import {
|
|
126
|
+
fetchSearchFilters,
|
|
127
|
+
fetchSearchProfiles,
|
|
128
|
+
fetchSkillSuggestions,
|
|
129
|
+
searchSkills
|
|
130
|
+
} from "./fetchers/search.js";
|
|
131
|
+
import {
|
|
132
|
+
fetchSpeakers,
|
|
133
|
+
fetchTalks
|
|
134
|
+
} from "./fetchers/speakers.js";
|
|
135
|
+
import {
|
|
136
|
+
fetchEntitySearch,
|
|
137
|
+
selectEntity,
|
|
138
|
+
importSearchEntities,
|
|
139
|
+
resolveEntityDomain,
|
|
140
|
+
mintEntityDomain
|
|
141
|
+
} from "./fetchers/entities.js";
|
|
142
|
+
import {
|
|
143
|
+
fetchFeaturedProfile,
|
|
144
|
+
fetchSimilarProfiles,
|
|
145
|
+
fetchSuggestionCount,
|
|
146
|
+
fetchSuggestions
|
|
147
|
+
} from "./fetchers/discovery.js";
|
|
148
|
+
import {
|
|
149
|
+
fetchFollowing,
|
|
150
|
+
followUser,
|
|
151
|
+
getFollowers,
|
|
152
|
+
getFollowing,
|
|
153
|
+
fetchFollowingFeed,
|
|
154
|
+
unfollowUser
|
|
155
|
+
} from "./fetchers/follow.js";
|
|
156
|
+
import {
|
|
157
|
+
getBlueskySuggestions,
|
|
158
|
+
getMutuals
|
|
159
|
+
} from "./fetchers/follow-extras.js";
|
|
160
|
+
import {
|
|
161
|
+
addFeatureAllowlist,
|
|
162
|
+
listFeatureAllowlist,
|
|
163
|
+
removeFeatureAllowlist
|
|
164
|
+
} from "./fetchers/admin-feature-allowlists.js";
|
|
165
|
+
import {
|
|
166
|
+
getAdminReviewQueues
|
|
167
|
+
} from "./fetchers/admin-review-queues.js";
|
|
168
|
+
import {
|
|
169
|
+
fetchActivityFeed,
|
|
170
|
+
fetchActivityTeaser,
|
|
171
|
+
fetchHeatmapData
|
|
172
|
+
} from "./fetchers/activity.js";
|
|
173
|
+
import {
|
|
174
|
+
fetchMyGithubPullRequests
|
|
175
|
+
} from "./fetchers/github-prs.js";
|
|
176
|
+
import {
|
|
177
|
+
fetchRpgStatus,
|
|
178
|
+
RpgItemStatusSchema,
|
|
179
|
+
RpgStatusResponseSchema
|
|
180
|
+
} from "./fetchers/rpg.js";
|
|
181
|
+
import { fetchEndorsementCount } from "./fetchers/endorsement.js";
|
|
182
|
+
import { fetchNetworkStreamCount } from "./fetchers/stream.js";
|
|
183
|
+
import {
|
|
184
|
+
checkAppAccount,
|
|
185
|
+
createReaction,
|
|
186
|
+
deleteReaction,
|
|
187
|
+
fetchReactionStatus
|
|
188
|
+
} from "./fetchers/reactions.js";
|
|
189
|
+
import {
|
|
190
|
+
QUOTED_POSTS_BATCH_MAX,
|
|
191
|
+
resolveQuotedPosts
|
|
192
|
+
} from "./fetchers/quoted-posts.js";
|
|
193
|
+
import {
|
|
194
|
+
castRoadmapVote,
|
|
195
|
+
fetchMyRoadmapVotes,
|
|
196
|
+
fetchRoadmapVotes,
|
|
197
|
+
retractRoadmapVote
|
|
198
|
+
} from "./fetchers/roadmap.js";
|
|
199
|
+
import {
|
|
200
|
+
deleteAccount,
|
|
201
|
+
fetchWipePreview,
|
|
202
|
+
resetProfile
|
|
203
|
+
} from "./fetchers/destructive.js";
|
|
204
|
+
import {
|
|
205
|
+
deleteRepoRecords,
|
|
206
|
+
fetchRepoInventory,
|
|
207
|
+
repoExportUrl
|
|
208
|
+
} from "./fetchers/repo-inventory.js";
|
|
209
|
+
import {
|
|
210
|
+
checkNetworkMapJobStatus,
|
|
211
|
+
fetchNetworkMap,
|
|
212
|
+
initiateNetworkMapGeneration,
|
|
213
|
+
isNetworkMapResponse
|
|
214
|
+
} from "./fetchers/network-map.js";
|
|
215
|
+
import { useAtFundLink, useProfile } from "./hooks/use-profile.js";
|
|
216
|
+
import { useGetProfileView } from "./hooks/use-get-profile-view.js";
|
|
217
|
+
import {
|
|
218
|
+
useDeleteAvatarOverride,
|
|
219
|
+
useDeleteNamePronunciationAudio,
|
|
220
|
+
useRefreshPds,
|
|
221
|
+
useUpdateProfileOverride,
|
|
222
|
+
useUpdateProfileSelf,
|
|
223
|
+
useUploadAvatar,
|
|
224
|
+
useUploadNamePronunciationAudio
|
|
225
|
+
} from "./hooks/use-profile-mutations.js";
|
|
226
|
+
import { useCreatePosition } from "./hooks/use-create-position.js";
|
|
227
|
+
import {
|
|
228
|
+
useDeletePosition,
|
|
229
|
+
useLinkSkillToPosition,
|
|
230
|
+
useSetPositionPrimary,
|
|
231
|
+
useUnlinkSkillFromPosition,
|
|
232
|
+
useUnsetPositionPrimary,
|
|
233
|
+
useUpdatePosition
|
|
234
|
+
} from "./hooks/use-position-mutations.js";
|
|
235
|
+
import {
|
|
236
|
+
useCreateEducation,
|
|
237
|
+
useDeleteEducation,
|
|
238
|
+
useUpdateEducation
|
|
239
|
+
} from "./hooks/use-education-mutations.js";
|
|
240
|
+
import {
|
|
241
|
+
useSetSectionPrimary,
|
|
242
|
+
useUnsetSectionPrimary
|
|
243
|
+
} from "./hooks/use-section-primary-mutations.js";
|
|
244
|
+
import {
|
|
245
|
+
useCreateSkill,
|
|
246
|
+
useDeleteSkill,
|
|
247
|
+
useUpdateSkill,
|
|
248
|
+
useUpdateSkillSubCategories
|
|
249
|
+
} from "./hooks/use-skill-mutations.js";
|
|
250
|
+
import {
|
|
251
|
+
useCreateRecord,
|
|
252
|
+
useDeleteRecord,
|
|
253
|
+
useUpdateRecord
|
|
254
|
+
} from "./hooks/use-record-mutations.js";
|
|
255
|
+
import {
|
|
256
|
+
useCreateProfileLocation,
|
|
257
|
+
useDeleteProfileLocation,
|
|
258
|
+
useUpdateProfileLocation
|
|
259
|
+
} from "./hooks/use-location-mutations.js";
|
|
260
|
+
import {
|
|
261
|
+
useCreateExternalAccount,
|
|
262
|
+
useDeleteExternalAccount,
|
|
263
|
+
useExternalAccounts,
|
|
264
|
+
useSetExternalAccountPrimary,
|
|
265
|
+
useUnsetExternalAccountPrimary,
|
|
266
|
+
useUpdateExternalAccount,
|
|
267
|
+
useVerifyExternalAccount
|
|
268
|
+
} from "./hooks/use-external-accounts.js";
|
|
269
|
+
import { useCreateEndorsement } from "./hooks/use-endorsement-mutations.js";
|
|
270
|
+
import { useReceivedEndorsements } from "./hooks/use-received-endorsements.js";
|
|
271
|
+
import { useReciprocityCandidate } from "./hooks/use-reciprocity.js";
|
|
272
|
+
import {
|
|
273
|
+
usePendingEndorsements,
|
|
274
|
+
useConfirmEndorsement,
|
|
275
|
+
useDismissEndorsement
|
|
276
|
+
} from "./hooks/use-endorsement-inbox.js";
|
|
277
|
+
import {
|
|
278
|
+
usePendingConfirmations,
|
|
279
|
+
useGivenConfirmations,
|
|
280
|
+
useCreateConfirmation,
|
|
281
|
+
useDismissConfirmation,
|
|
282
|
+
useRevokeConfirmation
|
|
283
|
+
} from "./hooks/use-confirmations.js";
|
|
284
|
+
import { useInboxCounts } from "./hooks/use-inbox.js";
|
|
285
|
+
import {
|
|
286
|
+
useUnlinkedPositions,
|
|
287
|
+
useDismissUnlinkedPosition
|
|
288
|
+
} from "./hooks/use-unlinked-positions.js";
|
|
289
|
+
import { useProfileCompleteness } from "./hooks/use-profile-completeness.js";
|
|
290
|
+
import { useHideKeytraceClaim, useUnhideKeytraceClaim } from "./hooks/use-keytrace-claims.js";
|
|
291
|
+
import { useRevealMarqueDomain, useUnrevealMarqueDomain } from "./hooks/use-marque-domains.js";
|
|
292
|
+
import {
|
|
293
|
+
useBulkHideStandardPublications,
|
|
294
|
+
useBulkUnhideStandardPublications,
|
|
295
|
+
useHideOrcidPublication,
|
|
296
|
+
useHideSifaPublication,
|
|
297
|
+
useHideStandardPublication,
|
|
298
|
+
useRefreshOrcidPublications,
|
|
299
|
+
useUnhideOrcidPublication,
|
|
300
|
+
useUnhideSifaPublication,
|
|
301
|
+
useUnhideStandardPublication
|
|
302
|
+
} from "./hooks/use-publication-mutations.js";
|
|
303
|
+
import {
|
|
304
|
+
useBulkHideProfileItems,
|
|
305
|
+
useBulkUnhideProfileItems,
|
|
306
|
+
useHideProfileItem,
|
|
307
|
+
useUnhideProfileItem
|
|
308
|
+
} from "./hooks/use-profile-items-hide.js";
|
|
309
|
+
import {
|
|
310
|
+
useHiddenActivityItems,
|
|
311
|
+
useHideActivityItem,
|
|
312
|
+
useUnhideActivityItem
|
|
313
|
+
} from "./hooks/use-activity-items-hide.js";
|
|
314
|
+
import { useStats } from "./hooks/use-stats.js";
|
|
315
|
+
import { useAppsRegistry, useHiddenApps } from "./hooks/use-apps.js";
|
|
316
|
+
import { useAccounts } from "./hooks/use-accounts.js";
|
|
317
|
+
import {
|
|
318
|
+
useCanonicalSkillSearch,
|
|
319
|
+
useSearchFilters,
|
|
320
|
+
useSearchProfiles,
|
|
321
|
+
useSkillSuggestions
|
|
322
|
+
} from "./hooks/use-search.js";
|
|
323
|
+
import {
|
|
324
|
+
useEntitySearch,
|
|
325
|
+
useSelectEntity,
|
|
326
|
+
useImportSearchEntities,
|
|
327
|
+
useResolveEntityDomain,
|
|
328
|
+
useMintEntityDomain,
|
|
329
|
+
useDebouncedValue
|
|
330
|
+
} from "./hooks/use-entity-search.js";
|
|
331
|
+
import {
|
|
332
|
+
useFeaturedProfile,
|
|
333
|
+
useSimilarProfiles,
|
|
334
|
+
useSuggestionCount,
|
|
335
|
+
useSuggestions
|
|
336
|
+
} from "./hooks/use-discovery.js";
|
|
337
|
+
import {
|
|
338
|
+
useFollow,
|
|
339
|
+
useFollowers,
|
|
340
|
+
useFollowing,
|
|
341
|
+
useFollowingFeed,
|
|
342
|
+
useFollowingList,
|
|
343
|
+
useUnfollow
|
|
344
|
+
} from "./hooks/use-follow.js";
|
|
345
|
+
import { useBlueskySuggestions, useMutuals } from "./hooks/use-follow-extras.js";
|
|
346
|
+
import {
|
|
347
|
+
useAddFeatureAllowlist,
|
|
348
|
+
useFeatureAllowlist,
|
|
349
|
+
useRemoveFeatureAllowlist
|
|
350
|
+
} from "./hooks/use-feature-allowlist.js";
|
|
351
|
+
import { useAdminReviewQueues } from "./hooks/use-admin-review-queues.js";
|
|
352
|
+
import { useActivityFeed, useActivityTeaser, useHeatmapData } from "./hooks/use-activity.js";
|
|
353
|
+
import {
|
|
354
|
+
useMyGithubPullRequests
|
|
355
|
+
} from "./hooks/use-github-prs.js";
|
|
356
|
+
import { useEndorsementCount } from "./hooks/use-endorsement.js";
|
|
357
|
+
import { useNetworkStreamCount } from "./hooks/use-stream.js";
|
|
358
|
+
import { useAppAccountCheck, useReactionStatus } from "./hooks/use-reactions.js";
|
|
359
|
+
import {
|
|
360
|
+
useCreateReaction,
|
|
361
|
+
useDeleteReaction
|
|
362
|
+
} from "./hooks/use-reaction-mutations.js";
|
|
363
|
+
import { useMyRoadmapVotes, useRoadmapVotes } from "./hooks/use-roadmap.js";
|
|
364
|
+
import { useCastRoadmapVote, useRetractRoadmapVote } from "./hooks/use-roadmap-mutations.js";
|
|
365
|
+
import { useDeleteAccount, useResetProfile, useWipePreview } from "./hooks/use-destructive.js";
|
|
366
|
+
import { useDeleteRepoRecords, useRepoInventory } from "./hooks/use-repo-inventory.js";
|
|
367
|
+
import {
|
|
368
|
+
fetchBskyContentLabelPrefs,
|
|
369
|
+
updateBskyContentLabelPrefs,
|
|
370
|
+
effectiveContentVisibility,
|
|
371
|
+
shouldGateAdultMedia
|
|
372
|
+
} from "./fetchers/bsky-preferences.js";
|
|
373
|
+
import {
|
|
374
|
+
useBskyContentLabelPrefs,
|
|
375
|
+
useUpdateBskyContentLabelPrefs
|
|
376
|
+
} from "./hooks/use-bsky-content-prefs.js";
|
|
377
|
+
import {
|
|
378
|
+
submitOrgClaim,
|
|
379
|
+
updateOrgProfile,
|
|
380
|
+
requestOrgDomainChallenge,
|
|
381
|
+
verifyOrgDomain,
|
|
382
|
+
addOrgNotificationEmail,
|
|
383
|
+
removeOrgNotificationEmail
|
|
384
|
+
} from "./fetchers/org.js";
|
|
385
|
+
import { useOrgProfile } from "./hooks/use-org-profile.js";
|
|
386
|
+
import { useOrgClaim } from "./hooks/use-org-claim.js";
|
|
387
|
+
import { useUpdateOrgProfile } from "./hooks/use-org-profile-settings.js";
|
|
388
|
+
import { useOrgDomainChallenge, useOrgDomainVerify } from "./hooks/use-org-domains.js";
|
|
389
|
+
import {
|
|
390
|
+
useAddOrgNotificationEmail,
|
|
391
|
+
useRemoveOrgNotificationEmail
|
|
392
|
+
} from "./hooks/use-org-notification-emails.js";
|
|
393
|
+
import { sifaQueryKeys } from "./keys.js";
|
|
394
|
+
export {
|
|
395
|
+
ApiError,
|
|
396
|
+
HIDDEN_ITEM_SOURCES,
|
|
397
|
+
HIDDEN_ITEM_TYPES,
|
|
398
|
+
PROFILE_COMPLETENESS_SIGNALS,
|
|
399
|
+
QUOTED_POSTS_BATCH_MAX,
|
|
400
|
+
RpgItemStatusSchema,
|
|
401
|
+
RpgStatusResponseSchema,
|
|
402
|
+
SifaProvider,
|
|
403
|
+
addFeatureAllowlist,
|
|
404
|
+
addOrgNotificationEmail,
|
|
405
|
+
apiFetch,
|
|
406
|
+
apiFetchOrNull,
|
|
407
|
+
apiWrite,
|
|
408
|
+
apiWriteCreate,
|
|
409
|
+
bulkHideProfileItems,
|
|
410
|
+
bulkHideStandardPublications,
|
|
411
|
+
bulkUnhideProfileItems,
|
|
412
|
+
bulkUnhideStandardPublications,
|
|
413
|
+
castRoadmapVote,
|
|
414
|
+
checkAppAccount,
|
|
415
|
+
checkNetworkMapJobStatus,
|
|
416
|
+
confirmEndorsement,
|
|
417
|
+
createConfirmation,
|
|
418
|
+
createEducation,
|
|
419
|
+
createEndorsement,
|
|
420
|
+
createExternalAccount,
|
|
421
|
+
createPosition,
|
|
422
|
+
createProfileLocation,
|
|
423
|
+
createReaction,
|
|
424
|
+
createRecord,
|
|
425
|
+
createSkill,
|
|
426
|
+
deleteAccount,
|
|
427
|
+
deleteAvatarOverride,
|
|
428
|
+
deleteEducation,
|
|
429
|
+
deleteExternalAccount,
|
|
430
|
+
deleteNamePronunciationAudio,
|
|
431
|
+
deletePosition,
|
|
432
|
+
deleteProfileLocation,
|
|
433
|
+
deleteReaction,
|
|
434
|
+
deleteRecord,
|
|
435
|
+
deleteRepoRecords,
|
|
436
|
+
deleteSkill,
|
|
437
|
+
dismissConfirmation,
|
|
438
|
+
dismissEndorsement,
|
|
439
|
+
dismissUnlinkedPosition,
|
|
440
|
+
effectiveContentVisibility,
|
|
441
|
+
fetchAccounts,
|
|
442
|
+
fetchActivityFeed,
|
|
443
|
+
fetchActivityTeaser,
|
|
444
|
+
fetchAppsRegistry,
|
|
445
|
+
fetchAtFundLink,
|
|
446
|
+
fetchBskyContentLabelPrefs,
|
|
447
|
+
fetchEndorsementCount,
|
|
448
|
+
fetchEntitySearch,
|
|
449
|
+
fetchExternalAccounts,
|
|
450
|
+
fetchFeaturedProfile,
|
|
451
|
+
fetchFollowing,
|
|
452
|
+
fetchFollowingFeed,
|
|
453
|
+
fetchGetProfileView,
|
|
454
|
+
fetchGivenConfirmations,
|
|
455
|
+
fetchHeatmapData,
|
|
456
|
+
fetchHiddenActivityItems,
|
|
457
|
+
fetchHiddenApps,
|
|
458
|
+
fetchInboxCounts,
|
|
459
|
+
fetchMyGithubPullRequests,
|
|
460
|
+
fetchMyRoadmapVotes,
|
|
461
|
+
fetchNetworkMap,
|
|
462
|
+
fetchNetworkStreamCount,
|
|
463
|
+
fetchPendingConfirmations,
|
|
464
|
+
fetchPendingEndorsements,
|
|
465
|
+
fetchProfile,
|
|
466
|
+
fetchProfileCompleteness,
|
|
467
|
+
fetchProfileSummary,
|
|
468
|
+
fetchReactionStatus,
|
|
469
|
+
fetchReceivedEndorsements,
|
|
470
|
+
fetchReciprocityCandidate,
|
|
471
|
+
fetchRepoInventory,
|
|
472
|
+
fetchResolveActor,
|
|
473
|
+
fetchRoadmapVotes,
|
|
474
|
+
fetchRpgStatus,
|
|
475
|
+
fetchSearchFilters,
|
|
476
|
+
fetchSearchProfiles,
|
|
477
|
+
fetchSimilarProfiles,
|
|
478
|
+
fetchSkillSuggestions,
|
|
479
|
+
fetchSpeakers,
|
|
480
|
+
fetchStats,
|
|
481
|
+
fetchSuggestionCount,
|
|
482
|
+
fetchSuggestions,
|
|
483
|
+
fetchTalks,
|
|
484
|
+
fetchTypeaheadActors,
|
|
485
|
+
fetchUnlinkedPositions,
|
|
486
|
+
fetchWipePreview,
|
|
487
|
+
followUser,
|
|
488
|
+
getAdminReviewQueues,
|
|
489
|
+
getBlueskySuggestions,
|
|
490
|
+
getFollowers,
|
|
491
|
+
getFollowing,
|
|
492
|
+
getMutuals,
|
|
493
|
+
hideActivityItem,
|
|
494
|
+
hideKeytraceClaim,
|
|
495
|
+
hideOrcidPublication,
|
|
496
|
+
hideProfileItem,
|
|
497
|
+
hideSifaPublication,
|
|
498
|
+
hideStandardPublication,
|
|
499
|
+
importSearchEntities,
|
|
500
|
+
initiateNetworkMapGeneration,
|
|
501
|
+
isNetworkMapResponse,
|
|
502
|
+
linkSkillToPosition,
|
|
503
|
+
listFeatureAllowlist,
|
|
504
|
+
mintEntityDomain,
|
|
505
|
+
refreshOrcidPublications,
|
|
506
|
+
refreshPds,
|
|
507
|
+
removeFeatureAllowlist,
|
|
508
|
+
removeOrgNotificationEmail,
|
|
509
|
+
repoExportUrl,
|
|
510
|
+
requestOrgDomainChallenge,
|
|
511
|
+
resetProfile,
|
|
512
|
+
resolveEntityDomain,
|
|
513
|
+
resolveQuotedPosts,
|
|
514
|
+
retractRoadmapVote,
|
|
515
|
+
revealMarqueDomain,
|
|
516
|
+
revokeConfirmation,
|
|
517
|
+
searchSkills,
|
|
518
|
+
selectEntity,
|
|
519
|
+
setExternalAccountPrimary,
|
|
520
|
+
setPositionPrimary,
|
|
521
|
+
setSectionPrimary,
|
|
522
|
+
shouldGateAdultMedia,
|
|
523
|
+
sifaQueryKeys,
|
|
524
|
+
submitOrgClaim,
|
|
525
|
+
switchAccount,
|
|
526
|
+
unfollowUser,
|
|
527
|
+
unhideActivityItem,
|
|
528
|
+
unhideKeytraceClaim,
|
|
529
|
+
unhideOrcidPublication,
|
|
530
|
+
unhideProfileItem,
|
|
531
|
+
unhideSifaPublication,
|
|
532
|
+
unhideStandardPublication,
|
|
533
|
+
unlinkSkillFromPosition,
|
|
534
|
+
unrevealMarqueDomain,
|
|
535
|
+
unsetExternalAccountPrimary,
|
|
536
|
+
unsetPositionPrimary,
|
|
537
|
+
unsetSectionPrimary,
|
|
538
|
+
updateBskyContentLabelPrefs,
|
|
539
|
+
updateEducation,
|
|
540
|
+
updateExternalAccount,
|
|
541
|
+
updateOrgProfile,
|
|
542
|
+
updatePosition,
|
|
543
|
+
updateProfileLocation,
|
|
544
|
+
updateProfileOverride,
|
|
545
|
+
updateProfileSelf,
|
|
546
|
+
updateRecord,
|
|
547
|
+
updateSkill,
|
|
548
|
+
updateSkillSubCategories,
|
|
549
|
+
uploadAvatar,
|
|
550
|
+
uploadNamePronunciationAudio,
|
|
551
|
+
useAccounts,
|
|
552
|
+
useActivityFeed,
|
|
553
|
+
useActivityTeaser,
|
|
554
|
+
useAddFeatureAllowlist,
|
|
555
|
+
useAddOrgNotificationEmail,
|
|
556
|
+
useAdminReviewQueues,
|
|
557
|
+
useAppAccountCheck,
|
|
558
|
+
useAppsRegistry,
|
|
559
|
+
useAtFundLink,
|
|
560
|
+
useBlueskySuggestions,
|
|
561
|
+
useBskyContentLabelPrefs,
|
|
562
|
+
useBulkHideProfileItems,
|
|
563
|
+
useBulkHideStandardPublications,
|
|
564
|
+
useBulkUnhideProfileItems,
|
|
565
|
+
useBulkUnhideStandardPublications,
|
|
566
|
+
useCanonicalSkillSearch,
|
|
567
|
+
useCastRoadmapVote,
|
|
568
|
+
useConfirmEndorsement,
|
|
569
|
+
useCreateConfirmation,
|
|
570
|
+
useCreateEducation,
|
|
571
|
+
useCreateEndorsement,
|
|
572
|
+
useCreateExternalAccount,
|
|
573
|
+
useCreatePosition,
|
|
574
|
+
useCreateProfileLocation,
|
|
575
|
+
useCreateReaction,
|
|
576
|
+
useCreateRecord,
|
|
577
|
+
useCreateSkill,
|
|
578
|
+
useDebouncedValue,
|
|
579
|
+
useDeleteAccount,
|
|
580
|
+
useDeleteAvatarOverride,
|
|
581
|
+
useDeleteEducation,
|
|
582
|
+
useDeleteExternalAccount,
|
|
583
|
+
useDeleteNamePronunciationAudio,
|
|
584
|
+
useDeletePosition,
|
|
585
|
+
useDeleteProfileLocation,
|
|
586
|
+
useDeleteReaction,
|
|
587
|
+
useDeleteRecord,
|
|
588
|
+
useDeleteRepoRecords,
|
|
589
|
+
useDeleteSkill,
|
|
590
|
+
useDismissConfirmation,
|
|
591
|
+
useDismissEndorsement,
|
|
592
|
+
useDismissUnlinkedPosition,
|
|
593
|
+
useEndorsementCount,
|
|
594
|
+
useEntitySearch,
|
|
595
|
+
useExternalAccounts,
|
|
596
|
+
useFeatureAllowlist,
|
|
597
|
+
useFeaturedProfile,
|
|
598
|
+
useFollow,
|
|
599
|
+
useFollowers,
|
|
600
|
+
useFollowing,
|
|
601
|
+
useFollowingFeed,
|
|
602
|
+
useFollowingList,
|
|
603
|
+
useGetProfileView,
|
|
604
|
+
useGivenConfirmations,
|
|
605
|
+
useHeatmapData,
|
|
606
|
+
useHiddenActivityItems,
|
|
607
|
+
useHiddenApps,
|
|
608
|
+
useHideActivityItem,
|
|
609
|
+
useHideKeytraceClaim,
|
|
610
|
+
useHideOrcidPublication,
|
|
611
|
+
useHideProfileItem,
|
|
612
|
+
useHideSifaPublication,
|
|
613
|
+
useHideStandardPublication,
|
|
614
|
+
useImportSearchEntities,
|
|
615
|
+
useInboxCounts,
|
|
616
|
+
useLinkSkillToPosition,
|
|
617
|
+
useMintEntityDomain,
|
|
618
|
+
useMutuals,
|
|
619
|
+
useMyGithubPullRequests,
|
|
620
|
+
useMyRoadmapVotes,
|
|
621
|
+
useNetworkStreamCount,
|
|
622
|
+
useOrgClaim,
|
|
623
|
+
useOrgDomainChallenge,
|
|
624
|
+
useOrgDomainVerify,
|
|
625
|
+
useOrgProfile,
|
|
626
|
+
usePendingConfirmations,
|
|
627
|
+
usePendingEndorsements,
|
|
628
|
+
useProfile,
|
|
629
|
+
useProfileCompleteness,
|
|
630
|
+
useReactionStatus,
|
|
631
|
+
useReceivedEndorsements,
|
|
632
|
+
useReciprocityCandidate,
|
|
633
|
+
useRefreshOrcidPublications,
|
|
634
|
+
useRefreshPds,
|
|
635
|
+
useRemoveFeatureAllowlist,
|
|
636
|
+
useRemoveOrgNotificationEmail,
|
|
637
|
+
useRepoInventory,
|
|
638
|
+
useResetProfile,
|
|
639
|
+
useResolveEntityDomain,
|
|
640
|
+
useRetractRoadmapVote,
|
|
641
|
+
useRevealMarqueDomain,
|
|
642
|
+
useRevokeConfirmation,
|
|
643
|
+
useRoadmapVotes,
|
|
644
|
+
useSearchFilters,
|
|
645
|
+
useSearchProfiles,
|
|
646
|
+
useSelectEntity,
|
|
647
|
+
useSetExternalAccountPrimary,
|
|
648
|
+
useSetPositionPrimary,
|
|
649
|
+
useSetSectionPrimary,
|
|
650
|
+
useSifaConfig,
|
|
651
|
+
useSimilarProfiles,
|
|
652
|
+
useSkillSuggestions,
|
|
653
|
+
useStats,
|
|
654
|
+
useSuggestionCount,
|
|
655
|
+
useSuggestions,
|
|
656
|
+
useUnfollow,
|
|
657
|
+
useUnhideActivityItem,
|
|
658
|
+
useUnhideKeytraceClaim,
|
|
659
|
+
useUnhideOrcidPublication,
|
|
660
|
+
useUnhideProfileItem,
|
|
661
|
+
useUnhideSifaPublication,
|
|
662
|
+
useUnhideStandardPublication,
|
|
663
|
+
useUnlinkSkillFromPosition,
|
|
664
|
+
useUnlinkedPositions,
|
|
665
|
+
useUnrevealMarqueDomain,
|
|
666
|
+
useUnsetExternalAccountPrimary,
|
|
667
|
+
useUnsetPositionPrimary,
|
|
668
|
+
useUnsetSectionPrimary,
|
|
669
|
+
useUpdateBskyContentLabelPrefs,
|
|
670
|
+
useUpdateEducation,
|
|
671
|
+
useUpdateExternalAccount,
|
|
672
|
+
useUpdateOrgProfile,
|
|
673
|
+
useUpdatePosition,
|
|
674
|
+
useUpdateProfileLocation,
|
|
675
|
+
useUpdateProfileOverride,
|
|
676
|
+
useUpdateProfileSelf,
|
|
677
|
+
useUpdateRecord,
|
|
678
|
+
useUpdateSkill,
|
|
679
|
+
useUpdateSkillSubCategories,
|
|
680
|
+
useUploadAvatar,
|
|
681
|
+
useUploadNamePronunciationAudio,
|
|
682
|
+
useVerifyExternalAccount,
|
|
683
|
+
useWipePreview,
|
|
684
|
+
verifyExternalAccount,
|
|
685
|
+
verifyOrgDomain
|
|
16
686
|
};
|
|
17
|
-
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
18
|
-
var MAX_RATE_LIMIT_RETRIES = 3;
|
|
19
|
-
var RATE_LIMIT_RETRY_CAP_SECONDS = 3;
|
|
20
|
-
function encodeIdentifier(value) {
|
|
21
|
-
let decoded = value;
|
|
22
|
-
try {
|
|
23
|
-
decoded = decodeURIComponent(value);
|
|
24
|
-
} catch {
|
|
25
|
-
}
|
|
26
|
-
return encodeURIComponent(decoded);
|
|
27
|
-
}
|
|
28
|
-
async function apiFetch(config, path, options = {}) {
|
|
29
|
-
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
30
|
-
const url = `${config.baseUrl}${path}`;
|
|
31
|
-
const maxRetries = options.retryOn429 ? MAX_RATE_LIMIT_RETRIES : 0;
|
|
32
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
33
|
-
const signal = options.signal ?? AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
34
|
-
const headers = { ...options.headers ?? {} };
|
|
35
|
-
let body;
|
|
36
|
-
if (options.body !== void 0) {
|
|
37
|
-
headers["Content-Type"] ??= "application/json";
|
|
38
|
-
body = JSON.stringify(options.body);
|
|
39
|
-
}
|
|
40
|
-
const init = {
|
|
41
|
-
method: options.method ?? "GET",
|
|
42
|
-
headers,
|
|
43
|
-
body,
|
|
44
|
-
signal,
|
|
45
|
-
credentials: options.credentials,
|
|
46
|
-
cache: options.cache,
|
|
47
|
-
...options.next ? { next: options.next } : {}
|
|
48
|
-
};
|
|
49
|
-
const res = await fetchFn(url, init);
|
|
50
|
-
if (res.status === 429 && attempt < maxRetries) {
|
|
51
|
-
const retryAfterRaw = res.headers.get("retry-after");
|
|
52
|
-
const retryAfter = retryAfterRaw ? Number.parseInt(retryAfterRaw, 10) : 2;
|
|
53
|
-
const waitSeconds = Math.min(
|
|
54
|
-
Number.isFinite(retryAfter) ? retryAfter : 2,
|
|
55
|
-
RATE_LIMIT_RETRY_CAP_SECONDS
|
|
56
|
-
);
|
|
57
|
-
await new Promise((r) => setTimeout(r, waitSeconds * 1e3));
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (!res.ok) {
|
|
61
|
-
let errBody;
|
|
62
|
-
try {
|
|
63
|
-
errBody = await res.json();
|
|
64
|
-
} catch {
|
|
65
|
-
try {
|
|
66
|
-
errBody = await res.text();
|
|
67
|
-
} catch {
|
|
68
|
-
errBody = void 0;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
throw new ApiError(`Sifa API ${res.status} on ${path}`, res.status, errBody);
|
|
72
|
-
}
|
|
73
|
-
if (res.status === 204 || res.status === 205) {
|
|
74
|
-
return void 0;
|
|
75
|
-
}
|
|
76
|
-
return await res.json();
|
|
77
|
-
}
|
|
78
|
-
throw new ApiError(`Sifa API exhausted retries on ${path}`, 429);
|
|
79
|
-
}
|
|
80
|
-
async function apiFetchOrNull(config, path, options = {}) {
|
|
81
|
-
try {
|
|
82
|
-
return await apiFetch(config, path, options);
|
|
83
|
-
} catch (e) {
|
|
84
|
-
if (e instanceof ApiError && e.status === 404) return null;
|
|
85
|
-
throw e;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function extractWriteError(data, status) {
|
|
89
|
-
const body = data ?? {};
|
|
90
|
-
return {
|
|
91
|
-
error: body.message ?? `Request failed (${status})`,
|
|
92
|
-
...body.pdsHost ? { pdsHost: body.pdsHost } : {}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
async function apiWrite(config, path, method, options = {}) {
|
|
96
|
-
try {
|
|
97
|
-
const data = await apiFetch(config, path, {
|
|
98
|
-
method,
|
|
99
|
-
credentials: "include",
|
|
100
|
-
...options
|
|
101
|
-
});
|
|
102
|
-
return { success: true, ...data ?? {} };
|
|
103
|
-
} catch (e) {
|
|
104
|
-
if (e instanceof ApiError) {
|
|
105
|
-
return { success: false, ...extractWriteError(e.body, e.status) };
|
|
106
|
-
}
|
|
107
|
-
return { success: false, error: "Network error" };
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function apiWriteCreate(config, path, body, options = {}) {
|
|
111
|
-
return apiWrite(config, path, "POST", {
|
|
112
|
-
body,
|
|
113
|
-
...options
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
var SifaConfigContext = createContext(null);
|
|
117
|
-
function SifaProvider({ config, children }) {
|
|
118
|
-
return /* @__PURE__ */ jsx(SifaConfigContext.Provider, { value: config, children });
|
|
119
|
-
}
|
|
120
|
-
function useSifaConfig() {
|
|
121
|
-
const ctx = useContext(SifaConfigContext);
|
|
122
|
-
if (!ctx) {
|
|
123
|
-
throw new Error(
|
|
124
|
-
"useSifaConfig must be used inside <SifaProvider>. Wrap your app once with <SifaProvider config={...}>."
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
return ctx;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// src/query/fetchers/profile.ts
|
|
131
|
-
function fetchProfile(config, handleOrDid, options = {}) {
|
|
132
|
-
const path = `/api/profile/${encodeIdentifier(handleOrDid)}`;
|
|
133
|
-
return apiFetchOrNull(config, path, {
|
|
134
|
-
retryOn429: true,
|
|
135
|
-
...options
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
async function fetchAtFundLink(config, did, options = {}) {
|
|
139
|
-
const path = `/api/profiles/${encodeIdentifier(did)}/at-fund-link`;
|
|
140
|
-
try {
|
|
141
|
-
const data = await apiFetch(config, path, {
|
|
142
|
-
next: { revalidate: 3600 },
|
|
143
|
-
timeoutMs: 5e3,
|
|
144
|
-
...options
|
|
145
|
-
});
|
|
146
|
-
return typeof data.url === "string" ? data.url : null;
|
|
147
|
-
} catch {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// src/query/fetchers/get-profile-view.ts
|
|
153
|
-
async function fetchGetProfileView(config, actor, options = {}) {
|
|
154
|
-
const path = `/xrpc/id.sifa.getProfileView?actor=${encodeIdentifier(actor)}`;
|
|
155
|
-
try {
|
|
156
|
-
return await apiFetch(config, path, { retryOn429: true, ...options });
|
|
157
|
-
} catch (e) {
|
|
158
|
-
if (e instanceof ApiError && e.status === 400 && typeof e.body === "object" && e.body !== null && e.body.error === "ProfileNotFound") {
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
throw e;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// src/logic/date-lookahead.ts
|
|
166
|
-
function isBeyondLookahead(value, months, now = /* @__PURE__ */ new Date()) {
|
|
167
|
-
const match = /^(\d{4})(?:-(\d{2}))?/.exec(value);
|
|
168
|
-
if (!match) return false;
|
|
169
|
-
const index = Number(match[1]) * 12 + (match[2] ? Number(match[2]) : 1);
|
|
170
|
-
const limit = now.getFullYear() * 12 + now.getMonth() + 1 + months;
|
|
171
|
-
return index > limit;
|
|
172
|
-
}
|
|
173
|
-
function isUpcomingStart(startedAt, now = /* @__PURE__ */ new Date()) {
|
|
174
|
-
return !!startedAt && isBeyondLookahead(startedAt, 0, now);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// src/logic/primary-position.ts
|
|
178
|
-
function pickPrimaryPosition(positions, now = /* @__PURE__ */ new Date()) {
|
|
179
|
-
if (!positions || positions.length === 0) return void 0;
|
|
180
|
-
const active = positions.filter(
|
|
181
|
-
(p) => !p.endedAt && !p.hidden && !isUpcomingStart(p.startedAt, now)
|
|
182
|
-
);
|
|
183
|
-
if (active.length === 0) return void 0;
|
|
184
|
-
const flagged = active.find((p) => p.primary === true);
|
|
185
|
-
if (flagged) return flagged;
|
|
186
|
-
return [...active].sort((a, b) => (b.startedAt ?? "").localeCompare(a.startedAt ?? ""))[0];
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// src/logic/profile-summary.ts
|
|
190
|
-
var DEFAULT_MAX_SKILLS = 5;
|
|
191
|
-
function summarizeProfileView(view, options = {}) {
|
|
192
|
-
const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);
|
|
193
|
-
const primary = pickPrimaryPosition(view.positions);
|
|
194
|
-
return {
|
|
195
|
-
did: view.did,
|
|
196
|
-
handle: view.handle,
|
|
197
|
-
displayName: view.displayName,
|
|
198
|
-
avatar: view.avatar,
|
|
199
|
-
pronouns: view.pronouns,
|
|
200
|
-
headline: view.headline,
|
|
201
|
-
currentTitle: primary?.title,
|
|
202
|
-
currentCompany: primary ? primary.entityName ?? primary.company : void 0,
|
|
203
|
-
topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),
|
|
204
|
-
claimed: view.claimed ?? false
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// src/query/fetchers/profile-summary.ts
|
|
209
|
-
async function fetchProfileSummary(config, actor, options = {}) {
|
|
210
|
-
const { maxSkills, ...fetchOptions } = options;
|
|
211
|
-
const view = await fetchGetProfileView(config, actor, fetchOptions);
|
|
212
|
-
return view ? summarizeProfileView(view, { maxSkills }) : null;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// src/query/fetchers/profile-mutations.ts
|
|
216
|
-
function updateProfileSelf(config, data, options = {}) {
|
|
217
|
-
return apiWrite(config, "/api/profile/self", "PUT", { body: data, ...options });
|
|
218
|
-
}
|
|
219
|
-
function updateProfileOverride(config, data, options = {}) {
|
|
220
|
-
return apiWrite(config, "/api/profile/override", "PUT", { body: data, ...options });
|
|
221
|
-
}
|
|
222
|
-
function refreshPds(config, options = {}) {
|
|
223
|
-
return apiWrite(
|
|
224
|
-
config,
|
|
225
|
-
"/api/profile/refresh-pds",
|
|
226
|
-
"POST",
|
|
227
|
-
options
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
async function uploadAvatar(config, file, options = {}) {
|
|
231
|
-
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
232
|
-
const url = `${config.baseUrl}/api/profile/avatar`;
|
|
233
|
-
const formData = new FormData();
|
|
234
|
-
formData.append("file", file);
|
|
235
|
-
try {
|
|
236
|
-
const res = await fetchFn(url, {
|
|
237
|
-
method: "POST",
|
|
238
|
-
credentials: options.credentials ?? "include",
|
|
239
|
-
body: formData,
|
|
240
|
-
signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 3e4),
|
|
241
|
-
headers: options.headers
|
|
242
|
-
});
|
|
243
|
-
if (!res.ok) {
|
|
244
|
-
const errBody = await res.json().catch(() => ({}));
|
|
245
|
-
const msg = errBody.message ?? `Request failed (${res.status})`;
|
|
246
|
-
const pdsHost = errBody.pdsHost;
|
|
247
|
-
return { success: false, error: msg, ...pdsHost ? { pdsHost } : {} };
|
|
248
|
-
}
|
|
249
|
-
const data = await res.json();
|
|
250
|
-
return { success: true, url: data.url };
|
|
251
|
-
} catch {
|
|
252
|
-
return { success: false, error: "Network error" };
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function deleteAvatarOverride(config, options = {}) {
|
|
256
|
-
return apiWrite(config, "/api/profile/avatar", "DELETE", options);
|
|
257
|
-
}
|
|
258
|
-
async function uploadNamePronunciationAudio(config, file, options = {}) {
|
|
259
|
-
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
260
|
-
const url = `${config.baseUrl}/api/profile/pronunciation-audio`;
|
|
261
|
-
const formData = new FormData();
|
|
262
|
-
formData.append("file", file);
|
|
263
|
-
try {
|
|
264
|
-
const res = await fetchFn(url, {
|
|
265
|
-
method: "POST",
|
|
266
|
-
credentials: options.credentials ?? "include",
|
|
267
|
-
body: formData,
|
|
268
|
-
signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 3e4),
|
|
269
|
-
headers: options.headers
|
|
270
|
-
});
|
|
271
|
-
if (!res.ok) {
|
|
272
|
-
const errBody = await res.json().catch(() => ({}));
|
|
273
|
-
const msg = errBody.message ?? `Request failed (${res.status})`;
|
|
274
|
-
const pdsHost = errBody.pdsHost;
|
|
275
|
-
return { success: false, error: msg, ...pdsHost ? { pdsHost } : {} };
|
|
276
|
-
}
|
|
277
|
-
const data = await res.json();
|
|
278
|
-
return { success: true, url: data.url };
|
|
279
|
-
} catch {
|
|
280
|
-
return { success: false, error: "Network error" };
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
function deleteNamePronunciationAudio(config, options = {}) {
|
|
284
|
-
return apiWrite(config, "/api/profile/pronunciation-audio", "DELETE", options);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// src/query/fetchers/positions.ts
|
|
288
|
-
function createPosition(config, data, options = {}) {
|
|
289
|
-
return apiWriteCreate(config, "/api/profile/position", data, options);
|
|
290
|
-
}
|
|
291
|
-
function updatePosition(config, rkey, data, options = {}) {
|
|
292
|
-
return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, "PUT", {
|
|
293
|
-
body: data,
|
|
294
|
-
...options
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
function deletePosition(config, rkey, options = {}) {
|
|
298
|
-
return apiWrite(config, `/api/profile/position/${encodeURIComponent(rkey)}`, "DELETE", options);
|
|
299
|
-
}
|
|
300
|
-
function setPositionPrimary(config, rkey, options = {}) {
|
|
301
|
-
return apiWrite(
|
|
302
|
-
config,
|
|
303
|
-
`/api/profile/position/${encodeURIComponent(rkey)}/primary`,
|
|
304
|
-
"PUT",
|
|
305
|
-
options
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
function unsetPositionPrimary(config, rkey, options = {}) {
|
|
309
|
-
return apiWrite(
|
|
310
|
-
config,
|
|
311
|
-
`/api/profile/position/${encodeURIComponent(rkey)}/primary`,
|
|
312
|
-
"DELETE",
|
|
313
|
-
options
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
function buildPositionPayload(position, skills) {
|
|
317
|
-
return {
|
|
318
|
-
company: position.company,
|
|
319
|
-
title: position.title,
|
|
320
|
-
description: position.description,
|
|
321
|
-
startedAt: position.startedAt,
|
|
322
|
-
endedAt: position.endedAt,
|
|
323
|
-
location: position.location ?? void 0,
|
|
324
|
-
// Carry the form-controlled optional fields the AppView merge would
|
|
325
|
-
// otherwise clear when absent from the PUT body. Omitting them here made
|
|
326
|
-
// every link/unlink strip employmentType, workplaceType, and entityRef
|
|
327
|
-
// off the position (id.sifa.profile.position#skills round-trip).
|
|
328
|
-
employmentType: position.employmentType,
|
|
329
|
-
workplaceType: position.workplaceType,
|
|
330
|
-
entityRef: position.entityRef,
|
|
331
|
-
skills
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
function linkSkillToPosition(config, position, skillRef, options = {}) {
|
|
335
|
-
const currentSkills = position.skills ?? [];
|
|
336
|
-
if (currentSkills.some((s) => s.uri === skillRef.uri)) {
|
|
337
|
-
return Promise.resolve({ success: true });
|
|
338
|
-
}
|
|
339
|
-
return updatePosition(
|
|
340
|
-
config,
|
|
341
|
-
position.rkey,
|
|
342
|
-
buildPositionPayload(position, [...currentSkills, skillRef]),
|
|
343
|
-
options
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
function unlinkSkillFromPosition(config, position, skillRef, options = {}) {
|
|
347
|
-
const remaining = (position.skills ?? []).filter((s) => s.uri !== skillRef.uri);
|
|
348
|
-
return updatePosition(config, position.rkey, buildPositionPayload(position, remaining), options);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// src/query/fetchers/education.ts
|
|
352
|
-
function createEducation(config, data, options = {}) {
|
|
353
|
-
return apiWriteCreate(config, "/api/profile/education", data, options);
|
|
354
|
-
}
|
|
355
|
-
function updateEducation(config, rkey, data, options = {}) {
|
|
356
|
-
return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, "PUT", {
|
|
357
|
-
body: data,
|
|
358
|
-
...options
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
function deleteEducation(config, rkey, options = {}) {
|
|
362
|
-
return apiWrite(config, `/api/profile/education/${encodeURIComponent(rkey)}`, "DELETE", options);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// src/query/fetchers/section-primary.ts
|
|
366
|
-
function setSectionPrimary(config, section, rkey, options = {}) {
|
|
367
|
-
return apiWrite(
|
|
368
|
-
config,
|
|
369
|
-
`/api/profile/${section}/${encodeURIComponent(rkey)}/primary`,
|
|
370
|
-
"PUT",
|
|
371
|
-
options
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
function unsetSectionPrimary(config, section, rkey, options = {}) {
|
|
375
|
-
return apiWrite(
|
|
376
|
-
config,
|
|
377
|
-
`/api/profile/${section}/${encodeURIComponent(rkey)}/primary`,
|
|
378
|
-
"DELETE",
|
|
379
|
-
options
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// src/query/fetchers/skills.ts
|
|
384
|
-
function createSkill(config, data, options = {}) {
|
|
385
|
-
return apiWriteCreate(config, "/api/profile/skill", data, options);
|
|
386
|
-
}
|
|
387
|
-
function updateSkill(config, rkey, data, options = {}) {
|
|
388
|
-
return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, "PUT", {
|
|
389
|
-
body: data,
|
|
390
|
-
...options
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
function updateSkillSubCategories(config, rkeys, subCategory, options = {}) {
|
|
394
|
-
return apiWrite(config, "/api/profile/skills/subcategory", "POST", {
|
|
395
|
-
body: { rkeys, subCategory },
|
|
396
|
-
...options
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
function deleteSkill(config, rkey, options = {}) {
|
|
400
|
-
return apiWrite(config, `/api/profile/skill/${encodeURIComponent(rkey)}`, "DELETE", options);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// src/query/fetchers/records.ts
|
|
404
|
-
function createRecord(config, collection, data, options = {}) {
|
|
405
|
-
return apiWriteCreate(
|
|
406
|
-
config,
|
|
407
|
-
`/api/profile/records/${encodeURIComponent(collection)}`,
|
|
408
|
-
data,
|
|
409
|
-
options
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
function updateRecord(config, collection, rkey, data, options = {}) {
|
|
413
|
-
const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;
|
|
414
|
-
return apiWrite(config, path, "PUT", { body: data, ...options });
|
|
415
|
-
}
|
|
416
|
-
function deleteRecord(config, collection, rkey, options = {}) {
|
|
417
|
-
const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;
|
|
418
|
-
return apiWrite(config, path, "DELETE", options);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// src/query/fetchers/profile-locations.ts
|
|
422
|
-
function createProfileLocation(config, data, options = {}) {
|
|
423
|
-
return apiWriteCreate(config, "/api/profile/location", data, options);
|
|
424
|
-
}
|
|
425
|
-
function updateProfileLocation(config, rkey, data, options = {}) {
|
|
426
|
-
return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, "PUT", {
|
|
427
|
-
body: data,
|
|
428
|
-
...options
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
function deleteProfileLocation(config, rkey, options = {}) {
|
|
432
|
-
return apiWrite(config, `/api/profile/location/${encodeURIComponent(rkey)}`, "DELETE", options);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// src/query/fetchers/external-accounts.ts
|
|
436
|
-
async function fetchExternalAccounts(config, handleOrDid, options = {}) {
|
|
437
|
-
const path = `/api/profile/${encodeIdentifier(handleOrDid)}/external-accounts`;
|
|
438
|
-
try {
|
|
439
|
-
const data = await apiFetch(config, path, {
|
|
440
|
-
credentials: "include",
|
|
441
|
-
...options
|
|
442
|
-
});
|
|
443
|
-
return data.accounts ?? [];
|
|
444
|
-
} catch {
|
|
445
|
-
return [];
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
function createExternalAccount(config, data, options = {}) {
|
|
449
|
-
return apiWrite(
|
|
450
|
-
config,
|
|
451
|
-
"/api/profile/external-accounts",
|
|
452
|
-
"POST",
|
|
453
|
-
{ body: data, ...options }
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
function updateExternalAccount(config, rkey, data, options = {}) {
|
|
457
|
-
return apiWrite(config, `/api/profile/external-accounts/${encodeURIComponent(rkey)}`, "PUT", {
|
|
458
|
-
body: data,
|
|
459
|
-
...options
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
function deleteExternalAccount(config, rkey, options = {}) {
|
|
463
|
-
return apiWrite(
|
|
464
|
-
config,
|
|
465
|
-
`/api/profile/external-accounts/${encodeURIComponent(rkey)}`,
|
|
466
|
-
"DELETE",
|
|
467
|
-
options
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
function setExternalAccountPrimary(config, rkey, options = {}) {
|
|
471
|
-
return apiWrite(
|
|
472
|
-
config,
|
|
473
|
-
`/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,
|
|
474
|
-
"PUT",
|
|
475
|
-
options
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
function unsetExternalAccountPrimary(config, rkey, options = {}) {
|
|
479
|
-
return apiWrite(
|
|
480
|
-
config,
|
|
481
|
-
`/api/profile/external-accounts/${encodeURIComponent(rkey)}/primary`,
|
|
482
|
-
"DELETE",
|
|
483
|
-
options
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
function verifyExternalAccount(config, rkey, options = {}) {
|
|
487
|
-
return apiWrite(
|
|
488
|
-
config,
|
|
489
|
-
`/api/profile/external-accounts/${encodeURIComponent(rkey)}/verify`,
|
|
490
|
-
"POST",
|
|
491
|
-
{ body: {}, ...options }
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// src/query/fetchers/endorsements.ts
|
|
496
|
-
function createEndorsement(config, data, options = {}) {
|
|
497
|
-
return apiWriteCreate(config, "/api/endorsement", data, options);
|
|
498
|
-
}
|
|
499
|
-
function confirmEndorsement(config, data, options = {}) {
|
|
500
|
-
return apiWriteCreate(
|
|
501
|
-
config,
|
|
502
|
-
"/api/endorsement/confirm",
|
|
503
|
-
data,
|
|
504
|
-
options
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// src/query/fetchers/received-endorsements.ts
|
|
509
|
-
async function fetchReceivedEndorsements(config, did, options = {}) {
|
|
510
|
-
const { limit, ...fetchOptions } = options;
|
|
511
|
-
const qs = limit ? `?limit=${limit}` : "";
|
|
512
|
-
try {
|
|
513
|
-
const data = await apiFetch(
|
|
514
|
-
config,
|
|
515
|
-
`/api/endorsement/${encodeIdentifier(did)}${qs}`,
|
|
516
|
-
{ cache: "no-store", timeoutMs: 5e3, ...fetchOptions }
|
|
517
|
-
);
|
|
518
|
-
return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };
|
|
519
|
-
} catch {
|
|
520
|
-
return { endorsements: [] };
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
// src/query/fetchers/reciprocity.ts
|
|
525
|
-
async function fetchReciprocityCandidate(config, options = {}) {
|
|
526
|
-
try {
|
|
527
|
-
const data = await apiFetch(
|
|
528
|
-
config,
|
|
529
|
-
"/api/endorsements/reciprocity-candidate",
|
|
530
|
-
{
|
|
531
|
-
cache: "no-store",
|
|
532
|
-
credentials: "include",
|
|
533
|
-
timeoutMs: 5e3,
|
|
534
|
-
...options
|
|
535
|
-
}
|
|
536
|
-
);
|
|
537
|
-
return data?.candidate ?? null;
|
|
538
|
-
} catch {
|
|
539
|
-
return null;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
// src/query/fetchers/endorsement-inbox.ts
|
|
544
|
-
var PENDING_ENDORSEMENTS_LXM = "id.sifa.endorsement.getPending";
|
|
545
|
-
async function fetchPendingEndorsements(config, options = {}) {
|
|
546
|
-
const { cookieHeader, ...rest } = options;
|
|
547
|
-
const headers = { ...rest.headers ?? {} };
|
|
548
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
549
|
-
if (config.getAuthToken) {
|
|
550
|
-
const token = await config.getAuthToken(PENDING_ENDORSEMENTS_LXM);
|
|
551
|
-
if (token) headers.Authorization = `Bearer ${token}`;
|
|
552
|
-
}
|
|
553
|
-
try {
|
|
554
|
-
const data = await apiFetch(config, "/api/endorsements/pending", {
|
|
555
|
-
cache: "no-store",
|
|
556
|
-
credentials: "include",
|
|
557
|
-
timeoutMs: 5e3,
|
|
558
|
-
...rest,
|
|
559
|
-
headers
|
|
560
|
-
});
|
|
561
|
-
return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };
|
|
562
|
-
} catch {
|
|
563
|
-
return { endorsements: [] };
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
function dismissEndorsement(config, data, options = {}) {
|
|
567
|
-
return apiWrite(config, "/api/endorsement/dismiss", "POST", { body: data, ...options });
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// src/query/fetchers/confirmations.ts
|
|
571
|
-
async function fetchPendingConfirmations(config, options = {}) {
|
|
572
|
-
const { cookieHeader, ...rest } = options;
|
|
573
|
-
const headers = { ...rest.headers ?? {} };
|
|
574
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
575
|
-
try {
|
|
576
|
-
const data = await apiFetch(config, "/api/confirmations/pending", {
|
|
577
|
-
cache: "no-store",
|
|
578
|
-
credentials: "include",
|
|
579
|
-
timeoutMs: 5e3,
|
|
580
|
-
...rest,
|
|
581
|
-
headers
|
|
582
|
-
});
|
|
583
|
-
return { confirmations: data?.confirmations ?? [], cursor: data?.cursor };
|
|
584
|
-
} catch {
|
|
585
|
-
return { confirmations: [] };
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
async function fetchGivenConfirmations(config, options = {}) {
|
|
589
|
-
const { cookieHeader, ...rest } = options;
|
|
590
|
-
const headers = { ...rest.headers ?? {} };
|
|
591
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
592
|
-
try {
|
|
593
|
-
const data = await apiFetch(
|
|
594
|
-
config,
|
|
595
|
-
"/api/confirmations/mine",
|
|
596
|
-
{ cache: "no-store", credentials: "include", timeoutMs: 5e3, ...rest, headers }
|
|
597
|
-
);
|
|
598
|
-
return { confirmations: data?.confirmations ?? [] };
|
|
599
|
-
} catch {
|
|
600
|
-
return { confirmations: [] };
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
function createConfirmation(config, data, options = {}) {
|
|
604
|
-
return apiWriteCreate(config, "/api/confirmation", data, options);
|
|
605
|
-
}
|
|
606
|
-
function dismissConfirmation(config, data, options = {}) {
|
|
607
|
-
return apiWrite(config, "/api/confirmation/dismiss", "POST", { body: data, ...options });
|
|
608
|
-
}
|
|
609
|
-
function revokeConfirmation(config, data, options = {}) {
|
|
610
|
-
return apiWrite(config, "/api/confirmation/revoke", "POST", { body: data, ...options });
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
// src/query/fetchers/inbox.ts
|
|
614
|
-
function toCount(value) {
|
|
615
|
-
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : 0;
|
|
616
|
-
}
|
|
617
|
-
async function fetchInboxCounts(config, options = {}) {
|
|
618
|
-
const { cookieHeader, ...rest } = options;
|
|
619
|
-
const headers = { ...rest.headers ?? {} };
|
|
620
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
621
|
-
try {
|
|
622
|
-
const data = await apiFetch(config, "/api/inbox/counts", {
|
|
623
|
-
cache: "no-store",
|
|
624
|
-
credentials: "include",
|
|
625
|
-
timeoutMs: 5e3,
|
|
626
|
-
...rest,
|
|
627
|
-
headers
|
|
628
|
-
});
|
|
629
|
-
return {
|
|
630
|
-
tasks: toCount(data?.tasks),
|
|
631
|
-
unreadNotifications: toCount(data?.unreadNotifications)
|
|
632
|
-
};
|
|
633
|
-
} catch {
|
|
634
|
-
return { tasks: 0, unreadNotifications: 0 };
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
// src/query/fetchers/unlinked-positions.ts
|
|
639
|
-
async function fetchUnlinkedPositions(config, options = {}) {
|
|
640
|
-
const { cookieHeader, ...rest } = options;
|
|
641
|
-
const headers = { ...rest.headers ?? {} };
|
|
642
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
643
|
-
try {
|
|
644
|
-
const data = await apiFetch(config, "/api/positions/unlinked", {
|
|
645
|
-
cache: "no-store",
|
|
646
|
-
credentials: "include",
|
|
647
|
-
timeoutMs: 5e3,
|
|
648
|
-
...rest,
|
|
649
|
-
headers
|
|
650
|
-
});
|
|
651
|
-
return { positions: Array.isArray(data?.positions) ? data.positions : [] };
|
|
652
|
-
} catch {
|
|
653
|
-
return { positions: [] };
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
function dismissUnlinkedPosition(config, data, options = {}) {
|
|
657
|
-
return apiWrite(config, "/api/positions/unlinked/dismiss", "POST", { body: data, ...options });
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// src/query/fetchers/profile-completeness.ts
|
|
661
|
-
var PROFILE_COMPLETENESS_SIGNALS = [
|
|
662
|
-
"headline",
|
|
663
|
-
"about",
|
|
664
|
-
"position",
|
|
665
|
-
"education",
|
|
666
|
-
"skill",
|
|
667
|
-
"certification"
|
|
668
|
-
];
|
|
669
|
-
async function fetchProfileCompleteness(config, options = {}) {
|
|
670
|
-
const { cookieHeader, ...rest } = options;
|
|
671
|
-
const headers = { ...rest.headers ?? {} };
|
|
672
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
673
|
-
const empty = {
|
|
674
|
-
complete: true,
|
|
675
|
-
score: PROFILE_COMPLETENESS_SIGNALS.length,
|
|
676
|
-
total: PROFILE_COMPLETENESS_SIGNALS.length,
|
|
677
|
-
missing: []
|
|
678
|
-
};
|
|
679
|
-
try {
|
|
680
|
-
const data = await apiFetch(config, "/api/profile/completeness", {
|
|
681
|
-
cache: "no-store",
|
|
682
|
-
credentials: "include",
|
|
683
|
-
timeoutMs: 5e3,
|
|
684
|
-
...rest,
|
|
685
|
-
headers
|
|
686
|
-
});
|
|
687
|
-
if (!data) return empty;
|
|
688
|
-
const missing = Array.isArray(data.missing) ? data.missing : [];
|
|
689
|
-
return {
|
|
690
|
-
complete: data.complete ?? missing.length === 0,
|
|
691
|
-
score: data.score ?? PROFILE_COMPLETENESS_SIGNALS.length - missing.length,
|
|
692
|
-
total: data.total ?? PROFILE_COMPLETENESS_SIGNALS.length,
|
|
693
|
-
missing
|
|
694
|
-
};
|
|
695
|
-
} catch {
|
|
696
|
-
return empty;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
// src/query/fetchers/actor.ts
|
|
701
|
-
async function fetchResolveActor(config, handleOrDid, options = {}) {
|
|
702
|
-
const q = handleOrDid.trim().replace(/^@/, "");
|
|
703
|
-
if (!q) return null;
|
|
704
|
-
return apiFetchOrNull(config, `/api/actor/resolve?q=${encodeURIComponent(q)}`, {
|
|
705
|
-
cache: "no-store",
|
|
706
|
-
...options
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
async function fetchTypeaheadActors(config, query, limit = 8, options = {}) {
|
|
710
|
-
const q = query.trim().replace(/^@/, "");
|
|
711
|
-
if (!q) return [];
|
|
712
|
-
const params = new URLSearchParams({ q, limit: String(limit) });
|
|
713
|
-
try {
|
|
714
|
-
const res = await apiFetch(
|
|
715
|
-
config,
|
|
716
|
-
`/api/actor/typeahead?${params.toString()}`,
|
|
717
|
-
{ cache: "no-store", ...options }
|
|
718
|
-
);
|
|
719
|
-
return res.actors ?? [];
|
|
720
|
-
} catch {
|
|
721
|
-
return [];
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// src/query/fetchers/keytrace-claims.ts
|
|
726
|
-
function hideKeytraceClaim(config, rkey, options = {}) {
|
|
727
|
-
return apiWrite(
|
|
728
|
-
config,
|
|
729
|
-
`/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,
|
|
730
|
-
"POST",
|
|
731
|
-
options
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
function unhideKeytraceClaim(config, rkey, options = {}) {
|
|
735
|
-
return apiWrite(
|
|
736
|
-
config,
|
|
737
|
-
`/api/profile/keytrace-claims/${encodeURIComponent(rkey)}/hide`,
|
|
738
|
-
"DELETE",
|
|
739
|
-
options
|
|
740
|
-
);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
// src/query/fetchers/marque-domains.ts
|
|
744
|
-
function revealMarqueDomain(config, domain, options = {}) {
|
|
745
|
-
return apiWrite(
|
|
746
|
-
config,
|
|
747
|
-
`/api/profile/marque-domains/${encodeURIComponent(domain)}/reveal`,
|
|
748
|
-
"POST",
|
|
749
|
-
options
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
function unrevealMarqueDomain(config, domain, options = {}) {
|
|
753
|
-
return apiWrite(
|
|
754
|
-
config,
|
|
755
|
-
`/api/profile/marque-domains/${encodeURIComponent(domain)}/reveal`,
|
|
756
|
-
"DELETE",
|
|
757
|
-
options
|
|
758
|
-
);
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
// src/query/fetchers/publications.ts
|
|
762
|
-
function hideOrcidPublication(config, putCode, options = {}) {
|
|
763
|
-
return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, "POST", options);
|
|
764
|
-
}
|
|
765
|
-
function unhideOrcidPublication(config, putCode, options = {}) {
|
|
766
|
-
return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, "DELETE", options);
|
|
767
|
-
}
|
|
768
|
-
function hideStandardPublication(config, uri, options = {}) {
|
|
769
|
-
return apiWrite(
|
|
770
|
-
config,
|
|
771
|
-
`/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,
|
|
772
|
-
"POST",
|
|
773
|
-
options
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
function unhideStandardPublication(config, uri, options = {}) {
|
|
777
|
-
return apiWrite(
|
|
778
|
-
config,
|
|
779
|
-
`/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,
|
|
780
|
-
"DELETE",
|
|
781
|
-
options
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
function bulkHideStandardPublications(config, uris, options = {}) {
|
|
785
|
-
return apiWrite(config, "/api/profile/standard-publications/bulk-hide", "POST", {
|
|
786
|
-
body: { uris },
|
|
787
|
-
...options
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
function bulkUnhideStandardPublications(config, uris, options = {}) {
|
|
791
|
-
return apiWrite(config, "/api/profile/standard-publications/bulk-hide", "DELETE", {
|
|
792
|
-
body: { uris },
|
|
793
|
-
...options
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
function hideSifaPublication(config, rkey, options = {}) {
|
|
797
|
-
return apiWrite(config, `/api/profile/publications/${rkey}/hide`, "POST", options);
|
|
798
|
-
}
|
|
799
|
-
function unhideSifaPublication(config, rkey, options = {}) {
|
|
800
|
-
return apiWrite(config, `/api/profile/publications/${rkey}/hide`, "DELETE", options);
|
|
801
|
-
}
|
|
802
|
-
async function refreshOrcidPublications(config, options = {}) {
|
|
803
|
-
const result = await apiWrite(
|
|
804
|
-
config,
|
|
805
|
-
"/api/profile/orcid-publications/refresh",
|
|
806
|
-
"POST",
|
|
807
|
-
{ body: {}, ...options }
|
|
808
|
-
);
|
|
809
|
-
if (result.success && result.error) {
|
|
810
|
-
return { success: false, error: result.error };
|
|
811
|
-
}
|
|
812
|
-
return result;
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
// src/query/fetchers/profile-items-hide.ts
|
|
816
|
-
var HIDDEN_ITEM_TYPES = [
|
|
817
|
-
"position",
|
|
818
|
-
"education",
|
|
819
|
-
"certification",
|
|
820
|
-
"project",
|
|
821
|
-
"volunteering",
|
|
822
|
-
"publication",
|
|
823
|
-
"course",
|
|
824
|
-
"honor",
|
|
825
|
-
"language",
|
|
826
|
-
"externalAccount"
|
|
827
|
-
];
|
|
828
|
-
var HIDDEN_ITEM_SOURCES = ["pds", "standard", "orcid"];
|
|
829
|
-
function hideProfileItem(config, input, options = {}) {
|
|
830
|
-
return apiWrite(config, "/api/profile/items/hide", "POST", { ...options, body: input });
|
|
831
|
-
}
|
|
832
|
-
function unhideProfileItem(config, input, options = {}) {
|
|
833
|
-
return apiWrite(config, "/api/profile/items/hide", "DELETE", { ...options, body: input });
|
|
834
|
-
}
|
|
835
|
-
function bulkHideProfileItems(config, input, options = {}) {
|
|
836
|
-
return apiWrite(config, "/api/profile/items/bulk-hide", "POST", { ...options, body: input });
|
|
837
|
-
}
|
|
838
|
-
function bulkUnhideProfileItems(config, input, options = {}) {
|
|
839
|
-
return apiWrite(config, "/api/profile/items/bulk-hide", "DELETE", { ...options, body: input });
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
// src/query/fetchers/activity-items-hide.ts
|
|
843
|
-
function hideActivityItem(config, input, options = {}) {
|
|
844
|
-
return apiWrite(config, "/api/activity/items/hide", "POST", { ...options, body: input });
|
|
845
|
-
}
|
|
846
|
-
function unhideActivityItem(config, input, options = {}) {
|
|
847
|
-
return apiWrite(config, "/api/activity/items/hide", "DELETE", { ...options, body: input });
|
|
848
|
-
}
|
|
849
|
-
async function fetchHiddenActivityItems(config, options = {}) {
|
|
850
|
-
const headers = { ...options.headers ?? {} };
|
|
851
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
852
|
-
try {
|
|
853
|
-
const data = await apiFetch(
|
|
854
|
-
config,
|
|
855
|
-
"/api/activity/hidden-items",
|
|
856
|
-
{ credentials: "include", ...options, headers }
|
|
857
|
-
);
|
|
858
|
-
return data.items;
|
|
859
|
-
} catch {
|
|
860
|
-
return [];
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
// src/query/fetchers/stats.ts
|
|
865
|
-
async function fetchStats(config, options = {}) {
|
|
866
|
-
try {
|
|
867
|
-
return await apiFetch(config, "/api/stats", {
|
|
868
|
-
next: { revalidate: 900 },
|
|
869
|
-
...options
|
|
870
|
-
});
|
|
871
|
-
} catch {
|
|
872
|
-
return null;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
// src/query/fetchers/apps.ts
|
|
877
|
-
async function fetchAppsRegistry(config, options = {}) {
|
|
878
|
-
try {
|
|
879
|
-
return await apiFetch(config, "/api/apps/registry", {
|
|
880
|
-
next: { revalidate: 86400 },
|
|
881
|
-
...options
|
|
882
|
-
});
|
|
883
|
-
} catch {
|
|
884
|
-
return [];
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
async function fetchHiddenApps(config, options = {}) {
|
|
888
|
-
const headers = { ...options.headers ?? {} };
|
|
889
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
890
|
-
try {
|
|
891
|
-
const data = await apiFetch(config, "/api/profile/hidden-apps", {
|
|
892
|
-
credentials: "include",
|
|
893
|
-
...options,
|
|
894
|
-
headers
|
|
895
|
-
});
|
|
896
|
-
return data.apps;
|
|
897
|
-
} catch {
|
|
898
|
-
return [];
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
// src/query/fetchers/accounts.ts
|
|
903
|
-
async function fetchAccounts(config, options = {}) {
|
|
904
|
-
const headers = { ...options.headers ?? {} };
|
|
905
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
906
|
-
try {
|
|
907
|
-
const data = await apiFetch(config, "/api/auth/accounts", {
|
|
908
|
-
credentials: "include",
|
|
909
|
-
...options,
|
|
910
|
-
headers
|
|
911
|
-
});
|
|
912
|
-
return data.accounts;
|
|
913
|
-
} catch {
|
|
914
|
-
return [];
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
async function switchAccount(config, did, options = {}) {
|
|
918
|
-
await apiFetch(config, "/oauth/switch", {
|
|
919
|
-
method: "POST",
|
|
920
|
-
body: { did },
|
|
921
|
-
credentials: "include",
|
|
922
|
-
...options
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
// src/query/fetchers/search.ts
|
|
927
|
-
var EMPTY_SEARCH = { profiles: [], total: 0, limit: 20, offset: 0 };
|
|
928
|
-
var EMPTY_FILTERS = { countries: [], industries: [], apps: [], openTo: [] };
|
|
929
|
-
async function fetchSearchProfiles(config, filters, options = {}) {
|
|
930
|
-
const params = new URLSearchParams();
|
|
931
|
-
if (filters.q) params.set("q", filters.q);
|
|
932
|
-
if (filters.skill) params.set("skill", filters.skill);
|
|
933
|
-
if (filters.country) params.set("country", filters.country);
|
|
934
|
-
if (filters.industry) params.set("industry", filters.industry);
|
|
935
|
-
if (filters.domain) params.set("domain", filters.domain);
|
|
936
|
-
if (filters.workplace) params.set("workplace", filters.workplace);
|
|
937
|
-
if (filters.app) params.set("app", filters.app);
|
|
938
|
-
if (filters.openTo && filters.openTo.length > 0) {
|
|
939
|
-
for (const token of filters.openTo) {
|
|
940
|
-
if (token) params.append("openTo", token);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
if (filters.limit !== void 0) params.set("limit", String(filters.limit));
|
|
944
|
-
if (params.size === 0) return EMPTY_SEARCH;
|
|
945
|
-
return apiFetch(config, `/api/search/profiles?${params.toString()}`, {
|
|
946
|
-
cache: "no-store",
|
|
947
|
-
...options
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
async function fetchSkillSuggestions(config, query, options = {}) {
|
|
951
|
-
if (!query.trim()) return [];
|
|
952
|
-
const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;
|
|
953
|
-
const data = await apiFetch(config, path, {
|
|
954
|
-
cache: "no-store",
|
|
955
|
-
...options
|
|
956
|
-
});
|
|
957
|
-
return data.skills ?? [];
|
|
958
|
-
}
|
|
959
|
-
async function fetchSearchFilters(config, options = {}) {
|
|
960
|
-
try {
|
|
961
|
-
return await apiFetch(config, "/api/search/filters", {
|
|
962
|
-
next: { revalidate: 300 },
|
|
963
|
-
...options
|
|
964
|
-
});
|
|
965
|
-
} catch {
|
|
966
|
-
return EMPTY_FILTERS;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
async function searchSkills(config, query, limit = 10, options = {}) {
|
|
970
|
-
if (!query.trim()) return [];
|
|
971
|
-
const path = `/api/skills/search?q=${encodeURIComponent(query)}&limit=${limit}`;
|
|
972
|
-
try {
|
|
973
|
-
const data = await apiFetch(config, path, {
|
|
974
|
-
cache: "no-store",
|
|
975
|
-
...options
|
|
976
|
-
});
|
|
977
|
-
return data.skills ?? [];
|
|
978
|
-
} catch {
|
|
979
|
-
return [];
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
// src/query/fetchers/speakers.ts
|
|
984
|
-
var EMPTY_SPEAKERS = { speakers: [] };
|
|
985
|
-
var EMPTY_TALKS = { talks: [] };
|
|
986
|
-
function buildParams(filters) {
|
|
987
|
-
const params = new URLSearchParams();
|
|
988
|
-
const topic = filters.topic?.trim();
|
|
989
|
-
if (topic) params.set("topic", topic);
|
|
990
|
-
if (filters.limit !== void 0) params.set("limit", String(filters.limit));
|
|
991
|
-
return params;
|
|
992
|
-
}
|
|
993
|
-
async function fetchSpeakers(config, filters = {}, options = {}) {
|
|
994
|
-
const params = buildParams(filters);
|
|
995
|
-
const query = params.toString();
|
|
996
|
-
const path = query ? `/api/speakers?${query}` : "/api/speakers";
|
|
997
|
-
try {
|
|
998
|
-
return await apiFetch(config, path, {
|
|
999
|
-
cache: "no-store",
|
|
1000
|
-
...options
|
|
1001
|
-
});
|
|
1002
|
-
} catch {
|
|
1003
|
-
return EMPTY_SPEAKERS;
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
async function fetchTalks(config, filters = {}, options = {}) {
|
|
1007
|
-
const params = buildParams(filters);
|
|
1008
|
-
const query = params.toString();
|
|
1009
|
-
const path = query ? `/api/talks?${query}` : "/api/talks";
|
|
1010
|
-
try {
|
|
1011
|
-
return await apiFetch(config, path, {
|
|
1012
|
-
cache: "no-store",
|
|
1013
|
-
...options
|
|
1014
|
-
});
|
|
1015
|
-
} catch {
|
|
1016
|
-
return EMPTY_TALKS;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
var httpUrlNullable = z.string().refine((s) => /^https?:\/\//i.test(s), { message: "must be an http(s) URL" }).nullable();
|
|
1020
|
-
var searchResultCommon = {
|
|
1021
|
-
kind: z.string(),
|
|
1022
|
-
name: z.string(),
|
|
1023
|
-
domain: z.string().nullable(),
|
|
1024
|
-
country: z.string().nullable(),
|
|
1025
|
-
logoUrl: httpUrlNullable,
|
|
1026
|
-
parentName: z.string().nullable()
|
|
1027
|
-
};
|
|
1028
|
-
var EntitySearchResultSchema = z.discriminatedUnion("source", [
|
|
1029
|
-
z.object({
|
|
1030
|
-
source: z.literal("entity"),
|
|
1031
|
-
entityId: z.number().int().positive(),
|
|
1032
|
-
...searchResultCommon
|
|
1033
|
-
}),
|
|
1034
|
-
z.object({
|
|
1035
|
-
source: z.literal("pdl"),
|
|
1036
|
-
pdlId: z.string().min(1),
|
|
1037
|
-
...searchResultCommon
|
|
1038
|
-
})
|
|
1039
|
-
]);
|
|
1040
|
-
var EntitySearchResponseSchema = z.object({
|
|
1041
|
-
results: z.array(EntitySearchResultSchema),
|
|
1042
|
-
hasMore: z.boolean()
|
|
1043
|
-
});
|
|
1044
|
-
z.object({
|
|
1045
|
-
entityId: z.number().int().positive().optional(),
|
|
1046
|
-
pdlId: z.string().min(1).optional()
|
|
1047
|
-
}).refine((v) => v.entityId != null !== (v.pdlId != null), {
|
|
1048
|
-
message: "exactly one of entityId or pdlId is required"
|
|
1049
|
-
});
|
|
1050
|
-
var EntitySelectResponseSchema = z.object({
|
|
1051
|
-
entityId: z.number().int().positive(),
|
|
1052
|
-
slug: z.string(),
|
|
1053
|
-
kind: z.string(),
|
|
1054
|
-
canonicalName: z.string(),
|
|
1055
|
-
domain: z.string().nullable(),
|
|
1056
|
-
/**
|
|
1057
|
-
* The entity's website, gated to sources trustworthy enough to prefill into a
|
|
1058
|
-
* record the user signs. Narrower than `domain`, which is a display value and
|
|
1059
|
-
* may come from a crawl. Null when the entity has no such source.
|
|
1060
|
-
*/
|
|
1061
|
-
website: httpUrlNullable.default(null),
|
|
1062
|
-
/** Which tier `website` came from. Crawled is never an accepted source. */
|
|
1063
|
-
websiteTier: z.enum(["org", "curated"]).nullable().default(null),
|
|
1064
|
-
entityRef: httpUrlNullable
|
|
1065
|
-
});
|
|
1066
|
-
var EntityImportSearchResponseSchema = z.object({
|
|
1067
|
-
results: z.array(EntitySearchResultSchema)
|
|
1068
|
-
});
|
|
1069
|
-
z.object({
|
|
1070
|
-
domain: z.string().min(1).max(253)
|
|
1071
|
-
});
|
|
1072
|
-
var EntityResolveDomainResponseSchema = z.object({
|
|
1073
|
-
results: z.array(EntitySearchResultSchema),
|
|
1074
|
-
canMint: z.boolean()
|
|
1075
|
-
});
|
|
1076
|
-
var EntityMintDomainResponseSchema = z.object({
|
|
1077
|
-
result: EntitySearchResultSchema,
|
|
1078
|
-
pending: z.boolean()
|
|
1079
|
-
});
|
|
1080
|
-
|
|
1081
|
-
// src/query/fetchers/entities.ts
|
|
1082
|
-
var EMPTY_SEARCH2 = { results: [], hasMore: false };
|
|
1083
|
-
async function fetchEntitySearch(config, query, limit, options = {}) {
|
|
1084
|
-
if (!query.trim()) return EMPTY_SEARCH2;
|
|
1085
|
-
const params = new URLSearchParams({ q: query });
|
|
1086
|
-
if (limit !== void 0) params.set("limit", String(limit));
|
|
1087
|
-
const data = await apiFetch(config, `/api/entities/search?${params.toString()}`, {
|
|
1088
|
-
cache: "no-store",
|
|
1089
|
-
...options
|
|
1090
|
-
});
|
|
1091
|
-
return EntitySearchResponseSchema.parse(data);
|
|
1092
|
-
}
|
|
1093
|
-
async function selectEntity(config, body, options = {}) {
|
|
1094
|
-
const data = await apiFetch(config, "/api/entities/select", {
|
|
1095
|
-
method: "POST",
|
|
1096
|
-
body,
|
|
1097
|
-
credentials: "include",
|
|
1098
|
-
...options
|
|
1099
|
-
});
|
|
1100
|
-
return EntitySelectResponseSchema.parse(data);
|
|
1101
|
-
}
|
|
1102
|
-
async function importSearchEntities(config, query, options = {}) {
|
|
1103
|
-
if (!query.trim()) return [];
|
|
1104
|
-
const data = await apiFetch(config, "/api/entities/import-search", {
|
|
1105
|
-
method: "POST",
|
|
1106
|
-
body: { q: query },
|
|
1107
|
-
credentials: "include",
|
|
1108
|
-
...options
|
|
1109
|
-
});
|
|
1110
|
-
return EntityImportSearchResponseSchema.parse(data).results;
|
|
1111
|
-
}
|
|
1112
|
-
async function resolveEntityDomain(config, domain, options = {}) {
|
|
1113
|
-
const data = await apiFetch(config, "/api/entities/resolve-domain", {
|
|
1114
|
-
method: "POST",
|
|
1115
|
-
body: { domain },
|
|
1116
|
-
credentials: "include",
|
|
1117
|
-
...options
|
|
1118
|
-
});
|
|
1119
|
-
return EntityResolveDomainResponseSchema.parse(data);
|
|
1120
|
-
}
|
|
1121
|
-
async function mintEntityDomain(config, domain, options = {}) {
|
|
1122
|
-
const data = await apiFetch(config, "/api/entities/mint-domain", {
|
|
1123
|
-
method: "POST",
|
|
1124
|
-
body: { domain },
|
|
1125
|
-
credentials: "include",
|
|
1126
|
-
...options
|
|
1127
|
-
});
|
|
1128
|
-
return EntityMintDomainResponseSchema.parse(data);
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
// src/query/fetchers/discovery.ts
|
|
1132
|
-
async function fetchSimilarProfiles(config, did, opts = {}) {
|
|
1133
|
-
const limit = opts.limit ?? 5;
|
|
1134
|
-
const path = `/api/discover/similar/${encodeIdentifier(did)}?limit=${limit}`;
|
|
1135
|
-
try {
|
|
1136
|
-
const data = await apiFetch(config, path, {
|
|
1137
|
-
next: { revalidate: 300 },
|
|
1138
|
-
timeoutMs: 5e3,
|
|
1139
|
-
...opts
|
|
1140
|
-
});
|
|
1141
|
-
return data.profiles ?? [];
|
|
1142
|
-
} catch {
|
|
1143
|
-
return [];
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
async function fetchSuggestions(config, opts = {}) {
|
|
1147
|
-
const params = new URLSearchParams();
|
|
1148
|
-
if (opts.source) params.set("source", opts.source);
|
|
1149
|
-
if (opts.includeDismissed) params.set("include_dismissed", "true");
|
|
1150
|
-
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
1151
|
-
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1152
|
-
const qs = params.toString();
|
|
1153
|
-
const headers = { ...opts.headers ?? {} };
|
|
1154
|
-
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
1155
|
-
try {
|
|
1156
|
-
return await apiFetch(config, `/api/suggestions${qs ? `?${qs}` : ""}`, {
|
|
1157
|
-
credentials: "include",
|
|
1158
|
-
cache: "no-store",
|
|
1159
|
-
timeoutMs: 8e3,
|
|
1160
|
-
...opts,
|
|
1161
|
-
headers
|
|
1162
|
-
});
|
|
1163
|
-
} catch {
|
|
1164
|
-
return { onSifa: [], notOnSifa: [] };
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
async function fetchSuggestionCount(config, since, options = {}) {
|
|
1168
|
-
const params = since ? `?since=${encodeURIComponent(since)}` : "";
|
|
1169
|
-
try {
|
|
1170
|
-
const data = await apiFetch(config, `/api/suggestions/count${params}`, {
|
|
1171
|
-
credentials: "include",
|
|
1172
|
-
cache: "no-store",
|
|
1173
|
-
...options
|
|
1174
|
-
});
|
|
1175
|
-
return data.count ?? 0;
|
|
1176
|
-
} catch {
|
|
1177
|
-
return 0;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
async function fetchFeaturedProfile(config, options = {}) {
|
|
1181
|
-
try {
|
|
1182
|
-
return await apiFetch(config, "/api/featured-profile", {
|
|
1183
|
-
next: { revalidate: 900 },
|
|
1184
|
-
...options
|
|
1185
|
-
});
|
|
1186
|
-
} catch {
|
|
1187
|
-
return null;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
// src/query/fetchers/follow.ts
|
|
1192
|
-
async function fetchFollowing(config, opts = {}) {
|
|
1193
|
-
const params = new URLSearchParams();
|
|
1194
|
-
if (opts.source) params.set("source", opts.source);
|
|
1195
|
-
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
1196
|
-
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1197
|
-
const qs = params.toString();
|
|
1198
|
-
try {
|
|
1199
|
-
return await apiFetch(config, `/api/following${qs ? `?${qs}` : ""}`, {
|
|
1200
|
-
credentials: "include",
|
|
1201
|
-
cache: "no-store",
|
|
1202
|
-
...opts
|
|
1203
|
-
});
|
|
1204
|
-
} catch {
|
|
1205
|
-
return { follows: [] };
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
function followUser(config, handle, opts = {}) {
|
|
1209
|
-
const { note, ...rest } = opts;
|
|
1210
|
-
return apiWrite(
|
|
1211
|
-
config,
|
|
1212
|
-
`/api/follow/${encodeIdentifier(handle)}`,
|
|
1213
|
-
"POST",
|
|
1214
|
-
{
|
|
1215
|
-
body: note !== void 0 ? { note } : void 0,
|
|
1216
|
-
...rest
|
|
1217
|
-
}
|
|
1218
|
-
);
|
|
1219
|
-
}
|
|
1220
|
-
function unfollowUser(config, handle, opts = {}) {
|
|
1221
|
-
return apiWrite(config, `/api/follow/${encodeIdentifier(handle)}`, "DELETE", opts);
|
|
1222
|
-
}
|
|
1223
|
-
function buildListPath(prefix, opts) {
|
|
1224
|
-
const params = new URLSearchParams();
|
|
1225
|
-
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
1226
|
-
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1227
|
-
const qs = params.toString();
|
|
1228
|
-
return `${prefix}${qs ? `?${qs}` : ""}`;
|
|
1229
|
-
}
|
|
1230
|
-
async function getFollowers(config, handle, opts = {}) {
|
|
1231
|
-
const headers = { ...opts.headers ?? {} };
|
|
1232
|
-
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
1233
|
-
try {
|
|
1234
|
-
const res = await apiFetch(
|
|
1235
|
-
config,
|
|
1236
|
-
buildListPath(`/api/profile/${encodeIdentifier(handle)}/followers`, opts),
|
|
1237
|
-
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
1238
|
-
);
|
|
1239
|
-
return { follows: res.follows, cursor: res.cursor ?? null };
|
|
1240
|
-
} catch {
|
|
1241
|
-
return { follows: [], cursor: null };
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
async function getFollowing(config, handle, opts = {}) {
|
|
1245
|
-
const headers = { ...opts.headers ?? {} };
|
|
1246
|
-
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
1247
|
-
try {
|
|
1248
|
-
const res = await apiFetch(
|
|
1249
|
-
config,
|
|
1250
|
-
buildListPath(`/api/profile/${encodeIdentifier(handle)}/following`, opts),
|
|
1251
|
-
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
1252
|
-
);
|
|
1253
|
-
return { follows: res.follows, cursor: res.cursor ?? null };
|
|
1254
|
-
} catch {
|
|
1255
|
-
return { follows: [], cursor: null };
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
var FOLLOWING_FEED_LXM = "id.sifa.feed.getFollowingFeed";
|
|
1259
|
-
async function fetchFollowingFeed(config, opts = {}) {
|
|
1260
|
-
const params = new URLSearchParams();
|
|
1261
|
-
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1262
|
-
if (opts.app) params.set("app", opts.app);
|
|
1263
|
-
else if (opts.includeBluesky) params.set("includeBluesky", "true");
|
|
1264
|
-
const qs = params.toString();
|
|
1265
|
-
const headers = { ...opts.headers ?? {} };
|
|
1266
|
-
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
1267
|
-
if (config.getAuthToken) {
|
|
1268
|
-
const token = await config.getAuthToken(FOLLOWING_FEED_LXM);
|
|
1269
|
-
if (token) headers.Authorization = `Bearer ${token}`;
|
|
1270
|
-
}
|
|
1271
|
-
try {
|
|
1272
|
-
return await apiFetch(
|
|
1273
|
-
config,
|
|
1274
|
-
`/api/following/feed${qs ? `?${qs}` : ""}`,
|
|
1275
|
-
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
1276
|
-
);
|
|
1277
|
-
} catch {
|
|
1278
|
-
return null;
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
// src/query/fetchers/follow-extras.ts
|
|
1283
|
-
function buildListPath2(prefix, opts) {
|
|
1284
|
-
const params = new URLSearchParams();
|
|
1285
|
-
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
1286
|
-
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1287
|
-
const qs = params.toString();
|
|
1288
|
-
return `${prefix}${qs ? `?${qs}` : ""}`;
|
|
1289
|
-
}
|
|
1290
|
-
async function fetchFollowProfilePage(config, path, opts) {
|
|
1291
|
-
const headers = { ...opts.headers ?? {} };
|
|
1292
|
-
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
1293
|
-
try {
|
|
1294
|
-
const res = await apiFetch(
|
|
1295
|
-
config,
|
|
1296
|
-
path,
|
|
1297
|
-
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
1298
|
-
);
|
|
1299
|
-
return { items: res.items ?? [], cursor: res.cursor ?? null };
|
|
1300
|
-
} catch {
|
|
1301
|
-
return { items: [], cursor: null };
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
async function getMutuals(config, handleOrDid, opts = {}) {
|
|
1305
|
-
return fetchFollowProfilePage(
|
|
1306
|
-
config,
|
|
1307
|
-
buildListPath2(`/api/profile/${encodeIdentifier(handleOrDid)}/mutuals`, opts),
|
|
1308
|
-
opts
|
|
1309
|
-
);
|
|
1310
|
-
}
|
|
1311
|
-
async function getBlueskySuggestions(config, opts = {}) {
|
|
1312
|
-
return fetchFollowProfilePage(config, buildListPath2("/api/me/bluesky-suggestions", opts), opts);
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
// src/query/fetchers/admin-feature-allowlists.ts
|
|
1316
|
-
async function listFeatureAllowlist(config, flag, opts = {}) {
|
|
1317
|
-
const headers = { ...opts.headers ?? {} };
|
|
1318
|
-
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
1319
|
-
try {
|
|
1320
|
-
const res = await apiFetch(
|
|
1321
|
-
config,
|
|
1322
|
-
`/api/admin/feature-allowlists/${encodeURIComponent(flag)}`,
|
|
1323
|
-
{ credentials: "include", cache: "no-store", ...opts, headers }
|
|
1324
|
-
);
|
|
1325
|
-
return { items: res.items ?? [] };
|
|
1326
|
-
} catch {
|
|
1327
|
-
return { items: [] };
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
function addFeatureAllowlist(config, flag, did, opts = {}) {
|
|
1331
|
-
const { note, ...rest } = opts;
|
|
1332
|
-
return apiWrite(config, `/api/admin/feature-allowlists/${encodeURIComponent(flag)}`, "POST", {
|
|
1333
|
-
body: note !== void 0 ? { did, note } : { did },
|
|
1334
|
-
...rest
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
function removeFeatureAllowlist(config, flag, did, opts = {}) {
|
|
1338
|
-
return apiWrite(
|
|
1339
|
-
config,
|
|
1340
|
-
`/api/admin/feature-allowlists/${encodeURIComponent(flag)}/${encodeIdentifier(did)}`,
|
|
1341
|
-
"DELETE",
|
|
1342
|
-
opts
|
|
1343
|
-
);
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
// src/query/fetchers/admin-review-queues.ts
|
|
1347
|
-
async function getAdminReviewQueues(config, opts = {}) {
|
|
1348
|
-
const headers = { ...opts.headers ?? {} };
|
|
1349
|
-
if (opts.cookieHeader) headers.cookie = opts.cookieHeader;
|
|
1350
|
-
const res = await apiFetch(config, "/api/admin/stats/review-queues", {
|
|
1351
|
-
credentials: "include",
|
|
1352
|
-
cache: "no-store",
|
|
1353
|
-
...opts,
|
|
1354
|
-
headers
|
|
1355
|
-
});
|
|
1356
|
-
const ideas = res.ideas ?? 0;
|
|
1357
|
-
const nameCorrections = res.nameCorrections ?? 0;
|
|
1358
|
-
const pendingCompanies = res.pendingCompanies ?? 0;
|
|
1359
|
-
const duplicateOrgs = res.duplicateOrgs ?? 0;
|
|
1360
|
-
return {
|
|
1361
|
-
ideas,
|
|
1362
|
-
nameCorrections,
|
|
1363
|
-
pendingCompanies,
|
|
1364
|
-
duplicateOrgs,
|
|
1365
|
-
// Derived rather than trusted so an API that predates the field still
|
|
1366
|
-
// yields a usable pill count.
|
|
1367
|
-
total: res.total ?? ideas + nameCorrections + pendingCompanies + duplicateOrgs,
|
|
1368
|
-
generatedAt: res.generatedAt ?? ""
|
|
1369
|
-
};
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
// src/query/fetchers/activity.ts
|
|
1373
|
-
async function fetchHeatmapData(config, handleOrDid, days, options = {}) {
|
|
1374
|
-
const path = `/api/activity/${encodeIdentifier(handleOrDid)}/heatmap?days=${days}`;
|
|
1375
|
-
try {
|
|
1376
|
-
return await apiFetch(config, path, {
|
|
1377
|
-
next: { revalidate: 900, tags: [`heatmap-${handleOrDid}`] },
|
|
1378
|
-
...options
|
|
1379
|
-
});
|
|
1380
|
-
} catch {
|
|
1381
|
-
return null;
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
async function fetchActivityTeaser(config, handleOrDid, options = {}) {
|
|
1385
|
-
const headers = { ...options.headers ?? {} };
|
|
1386
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
1387
|
-
try {
|
|
1388
|
-
return await apiFetch(
|
|
1389
|
-
config,
|
|
1390
|
-
`/api/activity/${encodeIdentifier(handleOrDid)}/teaser`,
|
|
1391
|
-
{
|
|
1392
|
-
credentials: "include",
|
|
1393
|
-
timeoutMs: 8e3,
|
|
1394
|
-
next: { revalidate: 300, tags: [`activity-teaser-${handleOrDid}`] },
|
|
1395
|
-
...options,
|
|
1396
|
-
headers
|
|
1397
|
-
}
|
|
1398
|
-
);
|
|
1399
|
-
} catch {
|
|
1400
|
-
return null;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
async function fetchActivityFeed(config, handleOrDid, options = {}) {
|
|
1404
|
-
const params = new URLSearchParams();
|
|
1405
|
-
if (options.category) params.set("category", options.category);
|
|
1406
|
-
if (options.limit) params.set("limit", String(options.limit));
|
|
1407
|
-
if (options.cursor) params.set("cursor", options.cursor);
|
|
1408
|
-
const qs = params.toString();
|
|
1409
|
-
const headers = { ...options.headers ?? {} };
|
|
1410
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
1411
|
-
try {
|
|
1412
|
-
return await apiFetch(
|
|
1413
|
-
config,
|
|
1414
|
-
`/api/activity/${encodeIdentifier(handleOrDid)}${qs ? `?${qs}` : ""}`,
|
|
1415
|
-
{
|
|
1416
|
-
credentials: "include",
|
|
1417
|
-
cache: "no-store",
|
|
1418
|
-
...options,
|
|
1419
|
-
headers
|
|
1420
|
-
}
|
|
1421
|
-
);
|
|
1422
|
-
} catch {
|
|
1423
|
-
return null;
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
var GithubPullRequestSchema = z.object({
|
|
1427
|
-
prNumber: z.number(),
|
|
1428
|
-
repoOwner: z.string(),
|
|
1429
|
-
repoName: z.string(),
|
|
1430
|
-
title: z.string(),
|
|
1431
|
-
url: z.string(),
|
|
1432
|
-
language: z.string().nullable(),
|
|
1433
|
-
additions: z.number(),
|
|
1434
|
-
deletions: z.number(),
|
|
1435
|
-
/** ISO 8601 merge timestamp. */
|
|
1436
|
-
mergedAt: z.string()
|
|
1437
|
-
});
|
|
1438
|
-
var MyGithubPullRequestsResponseSchema = z.object({
|
|
1439
|
-
items: z.array(GithubPullRequestSchema),
|
|
1440
|
-
hasMore: z.boolean()
|
|
1441
|
-
});
|
|
1442
|
-
async function fetchMyGithubPullRequests(config, options = {}) {
|
|
1443
|
-
const { limit, offset, cookieHeader, ...fetchOptions } = options;
|
|
1444
|
-
const params = new URLSearchParams();
|
|
1445
|
-
if (limit !== void 0) params.set("limit", String(limit));
|
|
1446
|
-
if (offset !== void 0) params.set("offset", String(offset));
|
|
1447
|
-
const qs = params.toString();
|
|
1448
|
-
const headers = { ...options.headers ?? {} };
|
|
1449
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1450
|
-
const data = await apiFetch(
|
|
1451
|
-
config,
|
|
1452
|
-
`/api/me/github/pull-requests${qs ? `?${qs}` : ""}`,
|
|
1453
|
-
{
|
|
1454
|
-
credentials: "include",
|
|
1455
|
-
cache: "no-store",
|
|
1456
|
-
...fetchOptions,
|
|
1457
|
-
headers
|
|
1458
|
-
}
|
|
1459
|
-
);
|
|
1460
|
-
return MyGithubPullRequestsResponseSchema.parse(data);
|
|
1461
|
-
}
|
|
1462
|
-
var RpgItemStatusSchema = z.object({
|
|
1463
|
-
id: z.string(),
|
|
1464
|
-
title: z.string(),
|
|
1465
|
-
description: z.string(),
|
|
1466
|
-
category: z.string(),
|
|
1467
|
-
earned: z.boolean(),
|
|
1468
|
-
state: z.enum(["locked", "earned", "given", "claimed"]),
|
|
1469
|
-
iconUrl: z.string().url().nullable()
|
|
1470
|
-
});
|
|
1471
|
-
var RpgStatusResponseSchema = z.object({
|
|
1472
|
-
hasCharacter: z.boolean(),
|
|
1473
|
-
/** True when the user granted the `repo:equipment.rpg.item` OAuth scope. */
|
|
1474
|
-
canWriteItems: z.boolean(),
|
|
1475
|
-
items: z.array(RpgItemStatusSchema)
|
|
1476
|
-
});
|
|
1477
|
-
async function fetchRpgStatus(config, options = {}) {
|
|
1478
|
-
const { cookieHeader, ...fetchOptions } = options;
|
|
1479
|
-
const headers = { ...options.headers ?? {} };
|
|
1480
|
-
if (cookieHeader) headers.cookie = cookieHeader;
|
|
1481
|
-
const data = await apiFetch(config, "/api/rpg/status", {
|
|
1482
|
-
credentials: "include",
|
|
1483
|
-
cache: "no-store",
|
|
1484
|
-
...fetchOptions,
|
|
1485
|
-
headers
|
|
1486
|
-
});
|
|
1487
|
-
return RpgStatusResponseSchema.parse(data);
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
// src/query/fetchers/endorsement.ts
|
|
1491
|
-
async function fetchEndorsementCount(config, did, options = {}) {
|
|
1492
|
-
const path = `/api/endorsement/${encodeIdentifier(did)}`;
|
|
1493
|
-
try {
|
|
1494
|
-
const data = await apiFetch(config, path, {
|
|
1495
|
-
cache: "no-store",
|
|
1496
|
-
timeoutMs: 5e3,
|
|
1497
|
-
...options
|
|
1498
|
-
});
|
|
1499
|
-
if (typeof data !== "object" || data === null || !("endorsements" in data)) {
|
|
1500
|
-
return 0;
|
|
1501
|
-
}
|
|
1502
|
-
const endorsements = data.endorsements;
|
|
1503
|
-
return Array.isArray(endorsements) ? endorsements.length : 0;
|
|
1504
|
-
} catch {
|
|
1505
|
-
return 0;
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
// src/query/fetchers/stream.ts
|
|
1510
|
-
async function fetchNetworkStreamCount(config, did, options = {}) {
|
|
1511
|
-
const headers = { ...options.headers ?? {} };
|
|
1512
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
1513
|
-
try {
|
|
1514
|
-
const data = await apiFetch(
|
|
1515
|
-
config,
|
|
1516
|
-
`/api/stream/network?did=${encodeIdentifier(did)}`,
|
|
1517
|
-
{
|
|
1518
|
-
cache: "no-store",
|
|
1519
|
-
timeoutMs: 5e3,
|
|
1520
|
-
...options.cookieHeader ? {} : { credentials: "include" },
|
|
1521
|
-
...options,
|
|
1522
|
-
headers
|
|
1523
|
-
}
|
|
1524
|
-
);
|
|
1525
|
-
if (typeof data !== "object" || data === null || !("items" in data)) {
|
|
1526
|
-
return 0;
|
|
1527
|
-
}
|
|
1528
|
-
const items = data.items;
|
|
1529
|
-
return Array.isArray(items) ? items.length : 0;
|
|
1530
|
-
} catch {
|
|
1531
|
-
return 0;
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
// src/query/fetchers/reactions.ts
|
|
1536
|
-
async function fetchReactionStatus(config, uris, options = {}) {
|
|
1537
|
-
if (uris.length === 0) return {};
|
|
1538
|
-
const headers = { ...options.headers ?? {} };
|
|
1539
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
1540
|
-
try {
|
|
1541
|
-
return await apiFetch(
|
|
1542
|
-
config,
|
|
1543
|
-
`/api/reactions/status?uris=${encodeURIComponent(uris.join(","))}`,
|
|
1544
|
-
{
|
|
1545
|
-
credentials: "include",
|
|
1546
|
-
...options,
|
|
1547
|
-
headers
|
|
1548
|
-
}
|
|
1549
|
-
);
|
|
1550
|
-
} catch {
|
|
1551
|
-
return null;
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
async function checkAppAccount(config, appId, options = {}) {
|
|
1555
|
-
const headers = { ...options.headers ?? {} };
|
|
1556
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
1557
|
-
try {
|
|
1558
|
-
return await apiFetch(
|
|
1559
|
-
config,
|
|
1560
|
-
`/api/reactions/account-check/${encodeURIComponent(appId)}`,
|
|
1561
|
-
{
|
|
1562
|
-
credentials: "include",
|
|
1563
|
-
...options,
|
|
1564
|
-
headers
|
|
1565
|
-
}
|
|
1566
|
-
);
|
|
1567
|
-
} catch {
|
|
1568
|
-
return null;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
async function createReaction(config, targetUri, appId, targetCid, options = {}) {
|
|
1572
|
-
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
1573
|
-
const url = `${config.baseUrl}/api/reactions`;
|
|
1574
|
-
try {
|
|
1575
|
-
const res = await fetchFn(url, {
|
|
1576
|
-
method: "POST",
|
|
1577
|
-
headers: { "Content-Type": "application/json", ...options.headers ?? {} },
|
|
1578
|
-
credentials: options.credentials ?? "include",
|
|
1579
|
-
body: JSON.stringify({ targetUri, appId, targetCid }),
|
|
1580
|
-
signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 1e4)
|
|
1581
|
-
});
|
|
1582
|
-
if (!res.ok) {
|
|
1583
|
-
if (res.status === 403) {
|
|
1584
|
-
try {
|
|
1585
|
-
const body = await res.json();
|
|
1586
|
-
if (body.error === "ScopeInsufficient") {
|
|
1587
|
-
return {
|
|
1588
|
-
ok: false,
|
|
1589
|
-
error: { type: "scope_insufficient", requiredScope: body.requiredScope }
|
|
1590
|
-
};
|
|
1591
|
-
}
|
|
1592
|
-
} catch {
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
return { ok: false, error: { type: "error" } };
|
|
1596
|
-
}
|
|
1597
|
-
const data = await res.json();
|
|
1598
|
-
return { ok: true, data };
|
|
1599
|
-
} catch {
|
|
1600
|
-
return { ok: false, error: { type: "error" } };
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
function deleteReaction(config, targetUri, appId, options = {}) {
|
|
1604
|
-
return apiWrite(config, "/api/reactions", "DELETE", {
|
|
1605
|
-
body: { targetUri, appId },
|
|
1606
|
-
...options
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
// src/query/fetchers/quoted-posts.ts
|
|
1611
|
-
var QUOTED_POSTS_BATCH_MAX = 20;
|
|
1612
|
-
async function resolveQuotedPosts(config, uris, options = {}) {
|
|
1613
|
-
if (uris.length === 0) return {};
|
|
1614
|
-
const unique = [...new Set(uris)];
|
|
1615
|
-
const batches = [];
|
|
1616
|
-
for (let i = 0; i < unique.length; i += QUOTED_POSTS_BATCH_MAX) {
|
|
1617
|
-
batches.push(unique.slice(i, i + QUOTED_POSTS_BATCH_MAX));
|
|
1618
|
-
}
|
|
1619
|
-
const headers = { ...options.headers ?? {} };
|
|
1620
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
1621
|
-
const results = {};
|
|
1622
|
-
await Promise.all(
|
|
1623
|
-
batches.map(async (batch) => {
|
|
1624
|
-
try {
|
|
1625
|
-
const data = await apiFetch(
|
|
1626
|
-
config,
|
|
1627
|
-
"/api/quoted-posts/resolve",
|
|
1628
|
-
{
|
|
1629
|
-
method: "POST",
|
|
1630
|
-
body: { uris: batch },
|
|
1631
|
-
credentials: "include",
|
|
1632
|
-
timeoutMs: 8e3,
|
|
1633
|
-
...options,
|
|
1634
|
-
headers
|
|
1635
|
-
}
|
|
1636
|
-
);
|
|
1637
|
-
Object.assign(results, data);
|
|
1638
|
-
} catch {
|
|
1639
|
-
}
|
|
1640
|
-
})
|
|
1641
|
-
);
|
|
1642
|
-
return results;
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
// src/query/fetchers/roadmap.ts
|
|
1646
|
-
async function fetchRoadmapVotes(config, options = {}) {
|
|
1647
|
-
try {
|
|
1648
|
-
return await apiFetch(config, "/api/roadmap/votes", {
|
|
1649
|
-
cache: "no-store",
|
|
1650
|
-
...options
|
|
1651
|
-
});
|
|
1652
|
-
} catch {
|
|
1653
|
-
return {};
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
async function fetchMyRoadmapVotes(config, options = {}) {
|
|
1657
|
-
const headers = { ...options.headers ?? {} };
|
|
1658
|
-
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
1659
|
-
try {
|
|
1660
|
-
const data = await apiFetch(config, "/api/roadmap/votes/me", {
|
|
1661
|
-
credentials: "include",
|
|
1662
|
-
...options,
|
|
1663
|
-
headers
|
|
1664
|
-
});
|
|
1665
|
-
return data.voted ?? [];
|
|
1666
|
-
} catch {
|
|
1667
|
-
return [];
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
async function castRoadmapVote(config, key, options = {}) {
|
|
1671
|
-
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
1672
|
-
const url = `${config.baseUrl}/api/roadmap/votes/${encodeURIComponent(key)}`;
|
|
1673
|
-
try {
|
|
1674
|
-
const res = await fetchFn(url, {
|
|
1675
|
-
method: "POST",
|
|
1676
|
-
// No body: the item key is in the URL. Do NOT declare a JSON content-type
|
|
1677
|
-
// for an empty body — Fastify rejects that with a 400 before the handler
|
|
1678
|
-
// runs. Only forward caller-provided headers.
|
|
1679
|
-
...options.headers ? { headers: options.headers } : {},
|
|
1680
|
-
credentials: options.credentials ?? "include",
|
|
1681
|
-
signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 1e4)
|
|
1682
|
-
});
|
|
1683
|
-
if (!res.ok) {
|
|
1684
|
-
if (res.status === 403) {
|
|
1685
|
-
try {
|
|
1686
|
-
const body = await res.json();
|
|
1687
|
-
if (body.error === "ScopeInsufficient") {
|
|
1688
|
-
return {
|
|
1689
|
-
ok: false,
|
|
1690
|
-
error: { type: "scope_insufficient", requiredScope: body.requiredScope }
|
|
1691
|
-
};
|
|
1692
|
-
}
|
|
1693
|
-
} catch {
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
return { ok: false, error: { type: "error" } };
|
|
1697
|
-
}
|
|
1698
|
-
const data = await res.json();
|
|
1699
|
-
return { ok: true, data };
|
|
1700
|
-
} catch {
|
|
1701
|
-
return { ok: false, error: { type: "error" } };
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
function retractRoadmapVote(config, key, options = {}) {
|
|
1705
|
-
return apiWrite(config, `/api/roadmap/votes/${encodeURIComponent(key)}`, "DELETE", options);
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
// src/query/fetchers/destructive.ts
|
|
1709
|
-
function fetchWipePreview(config, options = {}) {
|
|
1710
|
-
return apiFetch(config, "/api/profile/wipe-preview", {
|
|
1711
|
-
credentials: "include",
|
|
1712
|
-
...options
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
function resetProfile(config, deletePdsData, options = {}) {
|
|
1716
|
-
return apiWrite(config, "/api/profile/reset", "DELETE", {
|
|
1717
|
-
body: { deletePdsData },
|
|
1718
|
-
...options
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
function deleteAccount(config, deletePdsData, options = {}) {
|
|
1722
|
-
return apiWrite(
|
|
1723
|
-
config,
|
|
1724
|
-
"/api/profile/account",
|
|
1725
|
-
"DELETE",
|
|
1726
|
-
{
|
|
1727
|
-
body: { deletePdsData },
|
|
1728
|
-
...options
|
|
1729
|
-
}
|
|
1730
|
-
);
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
// src/query/fetchers/repo-inventory.ts
|
|
1734
|
-
function fetchRepoInventory(config, options = {}) {
|
|
1735
|
-
return apiFetch(config, "/api/me/repo-inventory", {
|
|
1736
|
-
credentials: "include",
|
|
1737
|
-
...options
|
|
1738
|
-
});
|
|
1739
|
-
}
|
|
1740
|
-
function deleteRepoRecords(config, input, options = {}) {
|
|
1741
|
-
return apiWrite(config, "/api/me/repo-delete", "POST", {
|
|
1742
|
-
body: input,
|
|
1743
|
-
...options
|
|
1744
|
-
});
|
|
1745
|
-
}
|
|
1746
|
-
function repoExportUrl(config) {
|
|
1747
|
-
return `${config.baseUrl}/api/me/repo-export`;
|
|
1748
|
-
}
|
|
1749
|
-
|
|
1750
|
-
// src/query/fetchers/network-map.ts
|
|
1751
|
-
function isNetworkMapResponse(value) {
|
|
1752
|
-
return "graph" in value;
|
|
1753
|
-
}
|
|
1754
|
-
async function initiateNetworkMapGeneration(config, options = {}) {
|
|
1755
|
-
return apiFetch(config, "/api/network-map/generate", {
|
|
1756
|
-
method: "POST",
|
|
1757
|
-
credentials: "include",
|
|
1758
|
-
...options
|
|
1759
|
-
});
|
|
1760
|
-
}
|
|
1761
|
-
async function checkNetworkMapJobStatus(config, jobId, options = {}) {
|
|
1762
|
-
return apiFetch(
|
|
1763
|
-
config,
|
|
1764
|
-
`/api/network-map/status/${encodeURIComponent(jobId)}`,
|
|
1765
|
-
{
|
|
1766
|
-
credentials: "include",
|
|
1767
|
-
...options
|
|
1768
|
-
}
|
|
1769
|
-
);
|
|
1770
|
-
}
|
|
1771
|
-
async function fetchNetworkMap(config, options = {}) {
|
|
1772
|
-
return apiFetchOrNull(config, "/api/network-map", {
|
|
1773
|
-
credentials: "include",
|
|
1774
|
-
cache: "no-store",
|
|
1775
|
-
...options
|
|
1776
|
-
});
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
// src/query/keys.ts
|
|
1780
|
-
var sifaQueryKeys = {
|
|
1781
|
-
all: () => ["sifa"],
|
|
1782
|
-
profile: {
|
|
1783
|
-
all: () => ["sifa", "profile"],
|
|
1784
|
-
byHandle: (handleOrDid) => ["sifa", "profile", handleOrDid],
|
|
1785
|
-
atFundLink: (did) => ["sifa", "profile", "at-fund-link", did],
|
|
1786
|
-
view: (actor) => ["sifa", "profile", "view", actor],
|
|
1787
|
-
externalAccounts: (handleOrDid) => ["sifa", "profile", "external-accounts", handleOrDid],
|
|
1788
|
-
// Session-scoped: the AppView reads the owner from the session cookie, so
|
|
1789
|
-
// there is only ever one completeness result per client.
|
|
1790
|
-
completeness: () => ["sifa", "profile", "completeness"]
|
|
1791
|
-
},
|
|
1792
|
-
position: {
|
|
1793
|
-
all: () => ["sifa", "position"],
|
|
1794
|
-
byOwner: (did) => ["sifa", "position", "by-owner", did],
|
|
1795
|
-
// Session-scoped: the AppView reads the owner from the session cookie.
|
|
1796
|
-
unlinked: () => ["sifa", "position", "unlinked"]
|
|
1797
|
-
},
|
|
1798
|
-
// Aggregate inbox counts for the header bell badge (session-scoped). The first
|
|
1799
|
-
// aggregate namespace: it fans in across confirmations, endorsements, drift,
|
|
1800
|
-
// unlinked positions and profile completeness on the server.
|
|
1801
|
-
inbox: {
|
|
1802
|
-
all: () => ["sifa", "inbox"],
|
|
1803
|
-
counts: () => ["sifa", "inbox", "counts"]
|
|
1804
|
-
},
|
|
1805
|
-
search: {
|
|
1806
|
-
all: () => ["sifa", "search"],
|
|
1807
|
-
profiles: (filters) => ["sifa", "search", "profiles", filters],
|
|
1808
|
-
companies: (filters) => ["sifa", "search", "companies", filters],
|
|
1809
|
-
skills: (query) => ["sifa", "search", "skills", query],
|
|
1810
|
-
canonicalSkills: (query, limit) => ["sifa", "search", "canonical-skills", query, limit],
|
|
1811
|
-
filters: () => ["sifa", "search", "filters"]
|
|
1812
|
-
},
|
|
1813
|
-
entity: {
|
|
1814
|
-
all: () => ["sifa", "entity"],
|
|
1815
|
-
search: (query, limit) => ["sifa", "entity", "search", query, limit]
|
|
1816
|
-
},
|
|
1817
|
-
discovery: {
|
|
1818
|
-
all: () => ["sifa", "discovery"],
|
|
1819
|
-
similar: (did, limit) => ["sifa", "discovery", "similar", did, limit],
|
|
1820
|
-
suggestions: (opts) => ["sifa", "discovery", "suggestions", opts],
|
|
1821
|
-
suggestionCount: (since) => ["sifa", "discovery", "suggestion-count", since ?? null],
|
|
1822
|
-
featured: () => ["sifa", "discovery", "featured"]
|
|
1823
|
-
},
|
|
1824
|
-
follow: {
|
|
1825
|
-
all: () => ["sifa", "follow"],
|
|
1826
|
-
following: (opts) => ["sifa", "follow", "following", opts],
|
|
1827
|
-
followers: (handle) => ["sifa", "follow", "followers", handle],
|
|
1828
|
-
followingOf: (handle) => ["sifa", "follow", "following-of", handle],
|
|
1829
|
-
feed: (opts) => ["sifa", "follow", "feed", opts],
|
|
1830
|
-
mutuals: (handle) => ["sifa", "follow", "mutuals", handle],
|
|
1831
|
-
blueskySuggestions: () => ["sifa", "follow", "bluesky-suggestions"]
|
|
1832
|
-
},
|
|
1833
|
-
admin: {
|
|
1834
|
-
all: () => ["sifa", "admin"],
|
|
1835
|
-
featureAllowlist: (flag) => ["sifa", "admin", "feature-allowlist", flag],
|
|
1836
|
-
reviewQueues: () => ["sifa", "admin", "review-queues"]
|
|
1837
|
-
},
|
|
1838
|
-
stats: {
|
|
1839
|
-
all: () => ["sifa", "stats"],
|
|
1840
|
-
homepage: () => ["sifa", "stats", "homepage"]
|
|
1841
|
-
},
|
|
1842
|
-
apps: {
|
|
1843
|
-
all: () => ["sifa", "apps"],
|
|
1844
|
-
registry: () => ["sifa", "apps", "registry"],
|
|
1845
|
-
hidden: () => ["sifa", "apps", "hidden"]
|
|
1846
|
-
},
|
|
1847
|
-
auth: {
|
|
1848
|
-
all: () => ["sifa", "auth"],
|
|
1849
|
-
// Session-scoped: the AppView reads the account list from the browser's
|
|
1850
|
-
// cookies, so there is only ever one list per client.
|
|
1851
|
-
accounts: () => ["sifa", "auth", "accounts"]
|
|
1852
|
-
},
|
|
1853
|
-
activity: {
|
|
1854
|
-
all: () => ["sifa", "activity"],
|
|
1855
|
-
heatmap: (handleOrDid, days) => ["sifa", "activity", "heatmap", handleOrDid, days],
|
|
1856
|
-
teaser: (handleOrDid) => ["sifa", "activity", "teaser", handleOrDid],
|
|
1857
|
-
feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts],
|
|
1858
|
-
// Session-scoped: the AppView reads the caller's own hides from their
|
|
1859
|
-
// cookie, so there is only ever one list per client.
|
|
1860
|
-
hiddenItems: () => ["sifa", "activity", "hidden-items"]
|
|
1861
|
-
},
|
|
1862
|
-
github: {
|
|
1863
|
-
all: () => ["sifa", "github"],
|
|
1864
|
-
myPullRequests: (opts) => ["sifa", "github", "my-pull-requests", opts]
|
|
1865
|
-
},
|
|
1866
|
-
endorsement: {
|
|
1867
|
-
all: () => ["sifa", "endorsement"],
|
|
1868
|
-
count: (did) => ["sifa", "endorsement", "count", did],
|
|
1869
|
-
// Scoped to the session rather than a DID -- the AppView reads the subject
|
|
1870
|
-
// from the session cookie, so there is only ever one inbox per client.
|
|
1871
|
-
pending: () => ["sifa", "endorsement", "pending"],
|
|
1872
|
-
// Also session-scoped: the AppView picks the candidate from the viewer's
|
|
1873
|
-
// own follows, dismissals and blocks.
|
|
1874
|
-
reciprocity: () => ["sifa", "endorsement", "reciprocity"],
|
|
1875
|
-
received: (did) => ["sifa", "endorsement", "received", did]
|
|
1876
|
-
},
|
|
1877
|
-
confirmation: {
|
|
1878
|
-
all: () => ["sifa", "confirmation"],
|
|
1879
|
-
// Scoped to the session for the same reason as the endorsement inbox: the
|
|
1880
|
-
// AppView reads the subject from the session cookie, so there is only ever
|
|
1881
|
-
// one inbox per client.
|
|
1882
|
-
pending: () => ["sifa", "confirmation", "pending"],
|
|
1883
|
-
/** Confirmations this session has given, for the withdraw surface. */
|
|
1884
|
-
given: () => ["sifa", "confirmation", "given"]
|
|
1885
|
-
},
|
|
1886
|
-
stream: {
|
|
1887
|
-
all: () => ["sifa", "stream"],
|
|
1888
|
-
networkCount: (did) => ["sifa", "stream", "network-count", did]
|
|
1889
|
-
},
|
|
1890
|
-
reactions: {
|
|
1891
|
-
all: () => ["sifa", "reactions"],
|
|
1892
|
-
status: (uris) => ["sifa", "reactions", "status", uris],
|
|
1893
|
-
accountCheck: (appId) => ["sifa", "reactions", "account-check", appId]
|
|
1894
|
-
},
|
|
1895
|
-
roadmap: {
|
|
1896
|
-
all: () => ["sifa", "roadmap"],
|
|
1897
|
-
votes: () => ["sifa", "roadmap", "votes"],
|
|
1898
|
-
myVotes: () => ["sifa", "roadmap", "my-votes"]
|
|
1899
|
-
},
|
|
1900
|
-
bskyPreferences: {
|
|
1901
|
-
all: () => ["sifa", "bsky-preferences"],
|
|
1902
|
-
contentLabels: () => ["sifa", "bsky-preferences", "content-labels"]
|
|
1903
|
-
},
|
|
1904
|
-
repoInventory: {
|
|
1905
|
-
all: () => ["sifa", "repo-inventory"],
|
|
1906
|
-
list: () => ["sifa", "repo-inventory", "list"]
|
|
1907
|
-
},
|
|
1908
|
-
destructive: {
|
|
1909
|
-
all: () => ["sifa", "destructive"],
|
|
1910
|
-
wipePreview: () => ["sifa", "destructive", "wipe-preview"]
|
|
1911
|
-
}
|
|
1912
|
-
};
|
|
1913
|
-
|
|
1914
|
-
// src/query/hooks/use-profile.ts
|
|
1915
|
-
function useProfile(handleOrDid, options) {
|
|
1916
|
-
const config = useSifaConfig();
|
|
1917
|
-
return useQuery({
|
|
1918
|
-
queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ""),
|
|
1919
|
-
queryFn: () => fetchProfile(config, handleOrDid ?? ""),
|
|
1920
|
-
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
1921
|
-
...options
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
function useAtFundLink(did, options) {
|
|
1925
|
-
const config = useSifaConfig();
|
|
1926
|
-
return useQuery({
|
|
1927
|
-
queryKey: sifaQueryKeys.profile.atFundLink(did ?? ""),
|
|
1928
|
-
queryFn: () => fetchAtFundLink(config, did ?? ""),
|
|
1929
|
-
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
1930
|
-
...options
|
|
1931
|
-
});
|
|
1932
|
-
}
|
|
1933
|
-
function useGetProfileView(actor, options) {
|
|
1934
|
-
const config = useSifaConfig();
|
|
1935
|
-
return useQuery({
|
|
1936
|
-
queryKey: sifaQueryKeys.profile.view(actor ?? ""),
|
|
1937
|
-
queryFn: () => fetchGetProfileView(config, actor ?? ""),
|
|
1938
|
-
enabled: Boolean(actor) && (options?.enabled ?? true),
|
|
1939
|
-
...options
|
|
1940
|
-
});
|
|
1941
|
-
}
|
|
1942
|
-
async function invalidateProfile(queryClient, ownerHandleOrDid) {
|
|
1943
|
-
await queryClient.invalidateQueries({
|
|
1944
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
1945
|
-
});
|
|
1946
|
-
}
|
|
1947
|
-
function useUpdateProfileSelf(ownerHandleOrDid, options) {
|
|
1948
|
-
const config = useSifaConfig();
|
|
1949
|
-
const queryClient = useQueryClient();
|
|
1950
|
-
return useMutation({
|
|
1951
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1952
|
-
// handler below and silently drop cache invalidation (#453).
|
|
1953
|
-
...options,
|
|
1954
|
-
mutationFn: (data) => updateProfileSelf(config, data),
|
|
1955
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1956
|
-
if (result.success) {
|
|
1957
|
-
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1958
|
-
}
|
|
1959
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1960
|
-
}
|
|
1961
|
-
});
|
|
1962
|
-
}
|
|
1963
|
-
function useUpdateProfileOverride(ownerHandleOrDid, options) {
|
|
1964
|
-
const config = useSifaConfig();
|
|
1965
|
-
const queryClient = useQueryClient();
|
|
1966
|
-
return useMutation({
|
|
1967
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1968
|
-
// handler below and silently drop cache invalidation (#453).
|
|
1969
|
-
...options,
|
|
1970
|
-
mutationFn: (data) => updateProfileOverride(config, data),
|
|
1971
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1972
|
-
if (result.success) {
|
|
1973
|
-
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1974
|
-
}
|
|
1975
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1976
|
-
}
|
|
1977
|
-
});
|
|
1978
|
-
}
|
|
1979
|
-
function useRefreshPds(ownerHandleOrDid, options) {
|
|
1980
|
-
const config = useSifaConfig();
|
|
1981
|
-
const queryClient = useQueryClient();
|
|
1982
|
-
return useMutation({
|
|
1983
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1984
|
-
// handler below and silently drop cache invalidation (#453).
|
|
1985
|
-
...options,
|
|
1986
|
-
mutationFn: () => refreshPds(config),
|
|
1987
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1988
|
-
if (result.success) {
|
|
1989
|
-
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1990
|
-
}
|
|
1991
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1992
|
-
}
|
|
1993
|
-
});
|
|
1994
|
-
}
|
|
1995
|
-
function useUploadAvatar(ownerHandleOrDid, options) {
|
|
1996
|
-
const config = useSifaConfig();
|
|
1997
|
-
const queryClient = useQueryClient();
|
|
1998
|
-
return useMutation({
|
|
1999
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2000
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2001
|
-
...options,
|
|
2002
|
-
mutationFn: (file) => uploadAvatar(config, file),
|
|
2003
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2004
|
-
if (result.success) {
|
|
2005
|
-
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
2006
|
-
}
|
|
2007
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2008
|
-
}
|
|
2009
|
-
});
|
|
2010
|
-
}
|
|
2011
|
-
function useDeleteAvatarOverride(ownerHandleOrDid, options) {
|
|
2012
|
-
const config = useSifaConfig();
|
|
2013
|
-
const queryClient = useQueryClient();
|
|
2014
|
-
return useMutation({
|
|
2015
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2016
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2017
|
-
...options,
|
|
2018
|
-
mutationFn: () => deleteAvatarOverride(config),
|
|
2019
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2020
|
-
if (result.success) {
|
|
2021
|
-
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
2022
|
-
}
|
|
2023
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2024
|
-
}
|
|
2025
|
-
});
|
|
2026
|
-
}
|
|
2027
|
-
function useUploadNamePronunciationAudio(ownerHandleOrDid, options) {
|
|
2028
|
-
const config = useSifaConfig();
|
|
2029
|
-
const queryClient = useQueryClient();
|
|
2030
|
-
return useMutation({
|
|
2031
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2032
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2033
|
-
...options,
|
|
2034
|
-
mutationFn: (file) => uploadNamePronunciationAudio(config, file),
|
|
2035
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2036
|
-
if (result.success) {
|
|
2037
|
-
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
2038
|
-
}
|
|
2039
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2040
|
-
}
|
|
2041
|
-
});
|
|
2042
|
-
}
|
|
2043
|
-
function useDeleteNamePronunciationAudio(ownerHandleOrDid, options) {
|
|
2044
|
-
const config = useSifaConfig();
|
|
2045
|
-
const queryClient = useQueryClient();
|
|
2046
|
-
return useMutation({
|
|
2047
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2048
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2049
|
-
...options,
|
|
2050
|
-
mutationFn: () => deleteNamePronunciationAudio(config),
|
|
2051
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2052
|
-
if (result.success) {
|
|
2053
|
-
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
2054
|
-
}
|
|
2055
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2056
|
-
}
|
|
2057
|
-
});
|
|
2058
|
-
}
|
|
2059
|
-
function useCreatePosition(ownerDid, options) {
|
|
2060
|
-
const config = useSifaConfig();
|
|
2061
|
-
const queryClient = useQueryClient();
|
|
2062
|
-
return useMutation({
|
|
2063
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2064
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2065
|
-
...options,
|
|
2066
|
-
mutationFn: (data) => createPosition(config, data),
|
|
2067
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2068
|
-
if (result.success) {
|
|
2069
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.profile.byHandle(ownerDid) });
|
|
2070
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.byOwner(ownerDid) });
|
|
2071
|
-
}
|
|
2072
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2073
|
-
}
|
|
2074
|
-
});
|
|
2075
|
-
}
|
|
2076
|
-
async function invalidatePositionCaches(queryClient, ownerHandleOrDid) {
|
|
2077
|
-
await queryClient.invalidateQueries({
|
|
2078
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2079
|
-
});
|
|
2080
|
-
await queryClient.invalidateQueries({
|
|
2081
|
-
queryKey: sifaQueryKeys.position.byOwner(ownerHandleOrDid)
|
|
2082
|
-
});
|
|
2083
|
-
}
|
|
2084
|
-
function useUpdatePosition(ownerHandleOrDid, options) {
|
|
2085
|
-
const config = useSifaConfig();
|
|
2086
|
-
const queryClient = useQueryClient();
|
|
2087
|
-
return useMutation({
|
|
2088
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2089
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2090
|
-
...options,
|
|
2091
|
-
mutationFn: ({ rkey, data }) => updatePosition(config, rkey, data),
|
|
2092
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2093
|
-
if (result.success) {
|
|
2094
|
-
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
2095
|
-
}
|
|
2096
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2097
|
-
}
|
|
2098
|
-
});
|
|
2099
|
-
}
|
|
2100
|
-
function useDeletePosition(ownerHandleOrDid, options) {
|
|
2101
|
-
const config = useSifaConfig();
|
|
2102
|
-
const queryClient = useQueryClient();
|
|
2103
|
-
return useMutation({
|
|
2104
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2105
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2106
|
-
...options,
|
|
2107
|
-
mutationFn: (rkey) => deletePosition(config, rkey),
|
|
2108
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2109
|
-
if (result.success) {
|
|
2110
|
-
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
2111
|
-
}
|
|
2112
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2113
|
-
}
|
|
2114
|
-
});
|
|
2115
|
-
}
|
|
2116
|
-
function useSetPositionPrimary(ownerHandleOrDid, options) {
|
|
2117
|
-
const config = useSifaConfig();
|
|
2118
|
-
const queryClient = useQueryClient();
|
|
2119
|
-
return useMutation({
|
|
2120
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2121
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2122
|
-
...options,
|
|
2123
|
-
mutationFn: (rkey) => setPositionPrimary(config, rkey),
|
|
2124
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2125
|
-
if (result.success) {
|
|
2126
|
-
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
2127
|
-
}
|
|
2128
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2129
|
-
}
|
|
2130
|
-
});
|
|
2131
|
-
}
|
|
2132
|
-
function useUnsetPositionPrimary(ownerHandleOrDid, options) {
|
|
2133
|
-
const config = useSifaConfig();
|
|
2134
|
-
const queryClient = useQueryClient();
|
|
2135
|
-
return useMutation({
|
|
2136
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2137
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2138
|
-
...options,
|
|
2139
|
-
mutationFn: (rkey) => unsetPositionPrimary(config, rkey),
|
|
2140
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2141
|
-
if (result.success) {
|
|
2142
|
-
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
2143
|
-
}
|
|
2144
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2145
|
-
}
|
|
2146
|
-
});
|
|
2147
|
-
}
|
|
2148
|
-
function useLinkSkillToPosition(ownerHandleOrDid, options) {
|
|
2149
|
-
const config = useSifaConfig();
|
|
2150
|
-
const queryClient = useQueryClient();
|
|
2151
|
-
return useMutation({
|
|
2152
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2153
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2154
|
-
...options,
|
|
2155
|
-
mutationFn: ({ position, skillRef }) => linkSkillToPosition(config, position, skillRef),
|
|
2156
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2157
|
-
if (result.success) {
|
|
2158
|
-
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
2159
|
-
}
|
|
2160
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2161
|
-
}
|
|
2162
|
-
});
|
|
2163
|
-
}
|
|
2164
|
-
function useUnlinkSkillFromPosition(ownerHandleOrDid, options) {
|
|
2165
|
-
const config = useSifaConfig();
|
|
2166
|
-
const queryClient = useQueryClient();
|
|
2167
|
-
return useMutation({
|
|
2168
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2169
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2170
|
-
...options,
|
|
2171
|
-
mutationFn: ({ position, skillRef }) => unlinkSkillFromPosition(config, position, skillRef),
|
|
2172
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2173
|
-
if (result.success) {
|
|
2174
|
-
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
2175
|
-
}
|
|
2176
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2177
|
-
}
|
|
2178
|
-
});
|
|
2179
|
-
}
|
|
2180
|
-
async function invalidateProfile2(queryClient, ownerHandleOrDid) {
|
|
2181
|
-
await queryClient.invalidateQueries({
|
|
2182
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2183
|
-
});
|
|
2184
|
-
}
|
|
2185
|
-
function useCreateEducation(ownerHandleOrDid, options) {
|
|
2186
|
-
const config = useSifaConfig();
|
|
2187
|
-
const queryClient = useQueryClient();
|
|
2188
|
-
return useMutation({
|
|
2189
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2190
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2191
|
-
...options,
|
|
2192
|
-
mutationFn: (data) => createEducation(config, data),
|
|
2193
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2194
|
-
if (result.success) {
|
|
2195
|
-
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
2196
|
-
}
|
|
2197
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2198
|
-
}
|
|
2199
|
-
});
|
|
2200
|
-
}
|
|
2201
|
-
function useUpdateEducation(ownerHandleOrDid, options) {
|
|
2202
|
-
const config = useSifaConfig();
|
|
2203
|
-
const queryClient = useQueryClient();
|
|
2204
|
-
return useMutation({
|
|
2205
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2206
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2207
|
-
...options,
|
|
2208
|
-
mutationFn: ({ rkey, data }) => updateEducation(config, rkey, data),
|
|
2209
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2210
|
-
if (result.success) {
|
|
2211
|
-
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
2212
|
-
}
|
|
2213
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2214
|
-
}
|
|
2215
|
-
});
|
|
2216
|
-
}
|
|
2217
|
-
function useDeleteEducation(ownerHandleOrDid, options) {
|
|
2218
|
-
const config = useSifaConfig();
|
|
2219
|
-
const queryClient = useQueryClient();
|
|
2220
|
-
return useMutation({
|
|
2221
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2222
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2223
|
-
...options,
|
|
2224
|
-
mutationFn: (rkey) => deleteEducation(config, rkey),
|
|
2225
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2226
|
-
if (result.success) {
|
|
2227
|
-
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
2228
|
-
}
|
|
2229
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
}
|
|
2233
|
-
async function invalidateProfile3(queryClient, ownerHandleOrDid) {
|
|
2234
|
-
await queryClient.invalidateQueries({
|
|
2235
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2236
|
-
});
|
|
2237
|
-
}
|
|
2238
|
-
function useSetSectionPrimary(section, ownerHandleOrDid, options) {
|
|
2239
|
-
const config = useSifaConfig();
|
|
2240
|
-
const queryClient = useQueryClient();
|
|
2241
|
-
return useMutation({
|
|
2242
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2243
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2244
|
-
...options,
|
|
2245
|
-
mutationFn: (rkey) => setSectionPrimary(config, section, rkey),
|
|
2246
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2247
|
-
if (result.success) {
|
|
2248
|
-
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
2249
|
-
}
|
|
2250
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2251
|
-
}
|
|
2252
|
-
});
|
|
2253
|
-
}
|
|
2254
|
-
function useUnsetSectionPrimary(section, ownerHandleOrDid, options) {
|
|
2255
|
-
const config = useSifaConfig();
|
|
2256
|
-
const queryClient = useQueryClient();
|
|
2257
|
-
return useMutation({
|
|
2258
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2259
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2260
|
-
...options,
|
|
2261
|
-
mutationFn: (rkey) => unsetSectionPrimary(config, section, rkey),
|
|
2262
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2263
|
-
if (result.success) {
|
|
2264
|
-
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
2265
|
-
}
|
|
2266
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2267
|
-
}
|
|
2268
|
-
});
|
|
2269
|
-
}
|
|
2270
|
-
async function invalidateProfile4(queryClient, ownerHandleOrDid) {
|
|
2271
|
-
await queryClient.invalidateQueries({
|
|
2272
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2273
|
-
});
|
|
2274
|
-
}
|
|
2275
|
-
function useCreateSkill(ownerHandleOrDid, options) {
|
|
2276
|
-
const config = useSifaConfig();
|
|
2277
|
-
const queryClient = useQueryClient();
|
|
2278
|
-
return useMutation({
|
|
2279
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2280
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2281
|
-
...options,
|
|
2282
|
-
mutationFn: (data) => createSkill(config, data),
|
|
2283
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2284
|
-
if (result.success) {
|
|
2285
|
-
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
2286
|
-
}
|
|
2287
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2288
|
-
}
|
|
2289
|
-
});
|
|
2290
|
-
}
|
|
2291
|
-
function useUpdateSkill(ownerHandleOrDid, options) {
|
|
2292
|
-
const config = useSifaConfig();
|
|
2293
|
-
const queryClient = useQueryClient();
|
|
2294
|
-
return useMutation({
|
|
2295
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2296
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2297
|
-
...options,
|
|
2298
|
-
mutationFn: ({ rkey, data }) => updateSkill(config, rkey, data),
|
|
2299
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2300
|
-
if (result.success) {
|
|
2301
|
-
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
2302
|
-
}
|
|
2303
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2304
|
-
}
|
|
2305
|
-
});
|
|
2306
|
-
}
|
|
2307
|
-
function useUpdateSkillSubCategories(ownerHandleOrDid, options) {
|
|
2308
|
-
const config = useSifaConfig();
|
|
2309
|
-
const queryClient = useQueryClient();
|
|
2310
|
-
return useMutation({
|
|
2311
|
-
mutationFn: ({ rkeys, subCategory }) => updateSkillSubCategories(config, rkeys, subCategory),
|
|
2312
|
-
// `...options` comes first so a caller-supplied onSuccess cannot replace the
|
|
2313
|
-
// wrapper below and silently skip profile invalidation; the wrapper calls it
|
|
2314
|
-
// instead. The older skill hooks in this file spread options last and still
|
|
2315
|
-
// carry that bug.
|
|
2316
|
-
...options,
|
|
2317
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2318
|
-
if (result.success) {
|
|
2319
|
-
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
2320
|
-
}
|
|
2321
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2322
|
-
}
|
|
2323
|
-
});
|
|
2324
|
-
}
|
|
2325
|
-
function useDeleteSkill(ownerHandleOrDid, options) {
|
|
2326
|
-
const config = useSifaConfig();
|
|
2327
|
-
const queryClient = useQueryClient();
|
|
2328
|
-
return useMutation({
|
|
2329
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2330
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2331
|
-
...options,
|
|
2332
|
-
mutationFn: (rkey) => deleteSkill(config, rkey),
|
|
2333
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2334
|
-
if (result.success) {
|
|
2335
|
-
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
2336
|
-
}
|
|
2337
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2338
|
-
}
|
|
2339
|
-
});
|
|
2340
|
-
}
|
|
2341
|
-
async function invalidateProfile5(queryClient, ownerHandleOrDid) {
|
|
2342
|
-
await queryClient.invalidateQueries({
|
|
2343
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2344
|
-
});
|
|
2345
|
-
}
|
|
2346
|
-
function useCreateRecord(ownerHandleOrDid, options) {
|
|
2347
|
-
const config = useSifaConfig();
|
|
2348
|
-
const queryClient = useQueryClient();
|
|
2349
|
-
return useMutation({
|
|
2350
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2351
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2352
|
-
...options,
|
|
2353
|
-
mutationFn: ({ collection, data }) => createRecord(config, collection, data),
|
|
2354
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2355
|
-
if (result.success) {
|
|
2356
|
-
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
2357
|
-
}
|
|
2358
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2359
|
-
}
|
|
2360
|
-
});
|
|
2361
|
-
}
|
|
2362
|
-
function useUpdateRecord(ownerHandleOrDid, options) {
|
|
2363
|
-
const config = useSifaConfig();
|
|
2364
|
-
const queryClient = useQueryClient();
|
|
2365
|
-
return useMutation({
|
|
2366
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2367
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2368
|
-
...options,
|
|
2369
|
-
mutationFn: ({ collection, rkey, data }) => updateRecord(config, collection, rkey, data),
|
|
2370
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2371
|
-
if (result.success) {
|
|
2372
|
-
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
2373
|
-
}
|
|
2374
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2375
|
-
}
|
|
2376
|
-
});
|
|
2377
|
-
}
|
|
2378
|
-
function useDeleteRecord(ownerHandleOrDid, options) {
|
|
2379
|
-
const config = useSifaConfig();
|
|
2380
|
-
const queryClient = useQueryClient();
|
|
2381
|
-
return useMutation({
|
|
2382
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2383
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2384
|
-
...options,
|
|
2385
|
-
mutationFn: ({ collection, rkey }) => deleteRecord(config, collection, rkey),
|
|
2386
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2387
|
-
if (result.success) {
|
|
2388
|
-
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
2389
|
-
}
|
|
2390
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2391
|
-
}
|
|
2392
|
-
});
|
|
2393
|
-
}
|
|
2394
|
-
async function invalidateProfile6(queryClient, ownerHandleOrDid) {
|
|
2395
|
-
await queryClient.invalidateQueries({
|
|
2396
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2397
|
-
});
|
|
2398
|
-
}
|
|
2399
|
-
function useCreateProfileLocation(ownerHandleOrDid, options) {
|
|
2400
|
-
const config = useSifaConfig();
|
|
2401
|
-
const queryClient = useQueryClient();
|
|
2402
|
-
return useMutation({
|
|
2403
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2404
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2405
|
-
...options,
|
|
2406
|
-
mutationFn: (data) => createProfileLocation(config, data),
|
|
2407
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2408
|
-
if (result.success) {
|
|
2409
|
-
await invalidateProfile6(queryClient, ownerHandleOrDid);
|
|
2410
|
-
}
|
|
2411
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2412
|
-
}
|
|
2413
|
-
});
|
|
2414
|
-
}
|
|
2415
|
-
function useUpdateProfileLocation(ownerHandleOrDid, options) {
|
|
2416
|
-
const config = useSifaConfig();
|
|
2417
|
-
const queryClient = useQueryClient();
|
|
2418
|
-
return useMutation({
|
|
2419
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2420
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2421
|
-
...options,
|
|
2422
|
-
mutationFn: ({ rkey, data }) => updateProfileLocation(config, rkey, data),
|
|
2423
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2424
|
-
if (result.success) {
|
|
2425
|
-
await invalidateProfile6(queryClient, ownerHandleOrDid);
|
|
2426
|
-
}
|
|
2427
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2428
|
-
}
|
|
2429
|
-
});
|
|
2430
|
-
}
|
|
2431
|
-
function useDeleteProfileLocation(ownerHandleOrDid, options) {
|
|
2432
|
-
const config = useSifaConfig();
|
|
2433
|
-
const queryClient = useQueryClient();
|
|
2434
|
-
return useMutation({
|
|
2435
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2436
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2437
|
-
...options,
|
|
2438
|
-
mutationFn: (rkey) => deleteProfileLocation(config, rkey),
|
|
2439
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2440
|
-
if (result.success) {
|
|
2441
|
-
await invalidateProfile6(queryClient, ownerHandleOrDid);
|
|
2442
|
-
}
|
|
2443
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2444
|
-
}
|
|
2445
|
-
});
|
|
2446
|
-
}
|
|
2447
|
-
async function invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid) {
|
|
2448
|
-
await queryClient.invalidateQueries({
|
|
2449
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2450
|
-
});
|
|
2451
|
-
await queryClient.invalidateQueries({
|
|
2452
|
-
queryKey: sifaQueryKeys.profile.externalAccounts(ownerHandleOrDid)
|
|
2453
|
-
});
|
|
2454
|
-
}
|
|
2455
|
-
function useExternalAccounts(handleOrDid, options) {
|
|
2456
|
-
const config = useSifaConfig();
|
|
2457
|
-
return useQuery({
|
|
2458
|
-
queryKey: sifaQueryKeys.profile.externalAccounts(handleOrDid ?? ""),
|
|
2459
|
-
queryFn: () => fetchExternalAccounts(config, handleOrDid ?? ""),
|
|
2460
|
-
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
2461
|
-
...options
|
|
2462
|
-
});
|
|
2463
|
-
}
|
|
2464
|
-
function useCreateExternalAccount(ownerHandleOrDid, options) {
|
|
2465
|
-
const config = useSifaConfig();
|
|
2466
|
-
const queryClient = useQueryClient();
|
|
2467
|
-
return useMutation({
|
|
2468
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2469
|
-
// one below and silently drop cache invalidation (#453).
|
|
2470
|
-
...options,
|
|
2471
|
-
mutationFn: (data) => createExternalAccount(config, data),
|
|
2472
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2473
|
-
if (result.success) {
|
|
2474
|
-
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2475
|
-
}
|
|
2476
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2477
|
-
}
|
|
2478
|
-
});
|
|
2479
|
-
}
|
|
2480
|
-
function useUpdateExternalAccount(ownerHandleOrDid, options) {
|
|
2481
|
-
const config = useSifaConfig();
|
|
2482
|
-
const queryClient = useQueryClient();
|
|
2483
|
-
return useMutation({
|
|
2484
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2485
|
-
// one below and silently drop cache invalidation (#453).
|
|
2486
|
-
...options,
|
|
2487
|
-
mutationFn: ({ rkey, data }) => updateExternalAccount(config, rkey, data),
|
|
2488
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2489
|
-
if (result.success) {
|
|
2490
|
-
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2491
|
-
}
|
|
2492
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2493
|
-
}
|
|
2494
|
-
});
|
|
2495
|
-
}
|
|
2496
|
-
function useDeleteExternalAccount(ownerHandleOrDid, options) {
|
|
2497
|
-
const config = useSifaConfig();
|
|
2498
|
-
const queryClient = useQueryClient();
|
|
2499
|
-
return useMutation({
|
|
2500
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2501
|
-
// one below and silently drop cache invalidation (#453).
|
|
2502
|
-
...options,
|
|
2503
|
-
mutationFn: (rkey) => deleteExternalAccount(config, rkey),
|
|
2504
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2505
|
-
if (result.success) {
|
|
2506
|
-
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2507
|
-
}
|
|
2508
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2509
|
-
}
|
|
2510
|
-
});
|
|
2511
|
-
}
|
|
2512
|
-
function useSetExternalAccountPrimary(ownerHandleOrDid, options) {
|
|
2513
|
-
const config = useSifaConfig();
|
|
2514
|
-
const queryClient = useQueryClient();
|
|
2515
|
-
return useMutation({
|
|
2516
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2517
|
-
// one below and silently drop cache invalidation (#453).
|
|
2518
|
-
...options,
|
|
2519
|
-
mutationFn: (rkey) => setExternalAccountPrimary(config, rkey),
|
|
2520
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2521
|
-
if (result.success) {
|
|
2522
|
-
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2523
|
-
}
|
|
2524
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2525
|
-
}
|
|
2526
|
-
});
|
|
2527
|
-
}
|
|
2528
|
-
function useUnsetExternalAccountPrimary(ownerHandleOrDid, options) {
|
|
2529
|
-
const config = useSifaConfig();
|
|
2530
|
-
const queryClient = useQueryClient();
|
|
2531
|
-
return useMutation({
|
|
2532
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2533
|
-
// one below and silently drop cache invalidation (#453).
|
|
2534
|
-
...options,
|
|
2535
|
-
mutationFn: (rkey) => unsetExternalAccountPrimary(config, rkey),
|
|
2536
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2537
|
-
if (result.success) {
|
|
2538
|
-
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2539
|
-
}
|
|
2540
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2541
|
-
}
|
|
2542
|
-
});
|
|
2543
|
-
}
|
|
2544
|
-
function useVerifyExternalAccount(ownerHandleOrDid, options) {
|
|
2545
|
-
const config = useSifaConfig();
|
|
2546
|
-
const queryClient = useQueryClient();
|
|
2547
|
-
return useMutation({
|
|
2548
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2549
|
-
// one below and silently drop cache invalidation (#453).
|
|
2550
|
-
...options,
|
|
2551
|
-
mutationFn: (rkey) => verifyExternalAccount(config, rkey),
|
|
2552
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2553
|
-
if (result.success) {
|
|
2554
|
-
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2555
|
-
}
|
|
2556
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2557
|
-
}
|
|
2558
|
-
});
|
|
2559
|
-
}
|
|
2560
|
-
function useCreateEndorsement(endorsedHandleOrDid, options) {
|
|
2561
|
-
const config = useSifaConfig();
|
|
2562
|
-
const queryClient = useQueryClient();
|
|
2563
|
-
return useMutation({
|
|
2564
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2565
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2566
|
-
...options,
|
|
2567
|
-
mutationFn: (data) => createEndorsement(config, data),
|
|
2568
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2569
|
-
if (result.success && endorsedHandleOrDid) {
|
|
2570
|
-
await queryClient.invalidateQueries({
|
|
2571
|
-
queryKey: sifaQueryKeys.profile.byHandle(endorsedHandleOrDid)
|
|
2572
|
-
});
|
|
2573
|
-
await queryClient.invalidateQueries({
|
|
2574
|
-
queryKey: sifaQueryKeys.endorsement.count(endorsedHandleOrDid)
|
|
2575
|
-
});
|
|
2576
|
-
}
|
|
2577
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2578
|
-
}
|
|
2579
|
-
});
|
|
2580
|
-
}
|
|
2581
|
-
function useReceivedEndorsements(did, options) {
|
|
2582
|
-
const config = useSifaConfig();
|
|
2583
|
-
const { limit, ...queryOptions } = options ?? {};
|
|
2584
|
-
return useQuery({
|
|
2585
|
-
queryKey: sifaQueryKeys.endorsement.received(did ?? ""),
|
|
2586
|
-
queryFn: () => fetchReceivedEndorsements(config, did ?? "", { limit }),
|
|
2587
|
-
enabled: Boolean(did) && (queryOptions.enabled ?? true),
|
|
2588
|
-
...queryOptions
|
|
2589
|
-
});
|
|
2590
|
-
}
|
|
2591
|
-
function useReciprocityCandidate(options) {
|
|
2592
|
-
const config = useSifaConfig();
|
|
2593
|
-
return useQuery({
|
|
2594
|
-
queryKey: sifaQueryKeys.endorsement.reciprocity(),
|
|
2595
|
-
queryFn: () => fetchReciprocityCandidate(config),
|
|
2596
|
-
...options
|
|
2597
|
-
});
|
|
2598
|
-
}
|
|
2599
|
-
function usePendingEndorsements(options) {
|
|
2600
|
-
const config = useSifaConfig();
|
|
2601
|
-
return useQuery({
|
|
2602
|
-
queryKey: sifaQueryKeys.endorsement.pending(),
|
|
2603
|
-
queryFn: () => fetchPendingEndorsements(config),
|
|
2604
|
-
...options
|
|
2605
|
-
});
|
|
2606
|
-
}
|
|
2607
|
-
function useConfirmEndorsement(subjectHandleOrDid, options) {
|
|
2608
|
-
const config = useSifaConfig();
|
|
2609
|
-
const queryClient = useQueryClient();
|
|
2610
|
-
return useMutation({
|
|
2611
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2612
|
-
// one below and silently drop cache invalidation (#453).
|
|
2613
|
-
...options,
|
|
2614
|
-
mutationFn: (data) => confirmEndorsement(config, data),
|
|
2615
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2616
|
-
if (result.success) {
|
|
2617
|
-
await queryClient.invalidateQueries({
|
|
2618
|
-
queryKey: sifaQueryKeys.endorsement.pending()
|
|
2619
|
-
});
|
|
2620
|
-
await queryClient.invalidateQueries({
|
|
2621
|
-
queryKey: sifaQueryKeys.inbox.counts()
|
|
2622
|
-
});
|
|
2623
|
-
if (subjectHandleOrDid) {
|
|
2624
|
-
await queryClient.invalidateQueries({
|
|
2625
|
-
queryKey: sifaQueryKeys.profile.byHandle(subjectHandleOrDid)
|
|
2626
|
-
});
|
|
2627
|
-
await queryClient.invalidateQueries({
|
|
2628
|
-
queryKey: sifaQueryKeys.endorsement.count(subjectHandleOrDid)
|
|
2629
|
-
});
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2633
|
-
}
|
|
2634
|
-
});
|
|
2635
|
-
}
|
|
2636
|
-
function useDismissEndorsement(options) {
|
|
2637
|
-
const config = useSifaConfig();
|
|
2638
|
-
const queryClient = useQueryClient();
|
|
2639
|
-
return useMutation({
|
|
2640
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2641
|
-
// one below and silently drop cache invalidation (#453).
|
|
2642
|
-
...options,
|
|
2643
|
-
mutationFn: (data) => dismissEndorsement(config, data),
|
|
2644
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2645
|
-
if (result.success) {
|
|
2646
|
-
await queryClient.invalidateQueries({
|
|
2647
|
-
queryKey: sifaQueryKeys.endorsement.pending()
|
|
2648
|
-
});
|
|
2649
|
-
await queryClient.invalidateQueries({
|
|
2650
|
-
queryKey: sifaQueryKeys.inbox.counts()
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2654
|
-
}
|
|
2655
|
-
});
|
|
2656
|
-
}
|
|
2657
|
-
function usePendingConfirmations(options) {
|
|
2658
|
-
const config = useSifaConfig();
|
|
2659
|
-
return useQuery({
|
|
2660
|
-
queryKey: sifaQueryKeys.confirmation.pending(),
|
|
2661
|
-
queryFn: () => fetchPendingConfirmations(config),
|
|
2662
|
-
...options
|
|
2663
|
-
});
|
|
2664
|
-
}
|
|
2665
|
-
function useGivenConfirmations(options) {
|
|
2666
|
-
const config = useSifaConfig();
|
|
2667
|
-
return useQuery({
|
|
2668
|
-
queryKey: sifaQueryKeys.confirmation.given(),
|
|
2669
|
-
queryFn: () => fetchGivenConfirmations(config),
|
|
2670
|
-
...options
|
|
2671
|
-
});
|
|
2672
|
-
}
|
|
2673
|
-
function useCreateConfirmation(claimerHandleOrDid, options) {
|
|
2674
|
-
const config = useSifaConfig();
|
|
2675
|
-
const queryClient = useQueryClient();
|
|
2676
|
-
return useMutation({
|
|
2677
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2678
|
-
// one below and silently drop cache invalidation (#453).
|
|
2679
|
-
...options,
|
|
2680
|
-
mutationFn: (data) => createConfirmation(config, data),
|
|
2681
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2682
|
-
if (result.success) {
|
|
2683
|
-
await queryClient.invalidateQueries({
|
|
2684
|
-
queryKey: sifaQueryKeys.confirmation.pending()
|
|
2685
|
-
});
|
|
2686
|
-
await queryClient.invalidateQueries({
|
|
2687
|
-
queryKey: sifaQueryKeys.confirmation.given()
|
|
2688
|
-
});
|
|
2689
|
-
await queryClient.invalidateQueries({
|
|
2690
|
-
queryKey: sifaQueryKeys.inbox.counts()
|
|
2691
|
-
});
|
|
2692
|
-
if (claimerHandleOrDid) {
|
|
2693
|
-
await queryClient.invalidateQueries({
|
|
2694
|
-
queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid)
|
|
2695
|
-
});
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2699
|
-
}
|
|
2700
|
-
});
|
|
2701
|
-
}
|
|
2702
|
-
function useDismissConfirmation(options) {
|
|
2703
|
-
const config = useSifaConfig();
|
|
2704
|
-
const queryClient = useQueryClient();
|
|
2705
|
-
return useMutation({
|
|
2706
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2707
|
-
// one below and silently drop cache invalidation (#453).
|
|
2708
|
-
...options,
|
|
2709
|
-
mutationFn: (data) => dismissConfirmation(config, data),
|
|
2710
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2711
|
-
if (result.success) {
|
|
2712
|
-
await queryClient.invalidateQueries({
|
|
2713
|
-
queryKey: sifaQueryKeys.confirmation.pending()
|
|
2714
|
-
});
|
|
2715
|
-
await queryClient.invalidateQueries({
|
|
2716
|
-
queryKey: sifaQueryKeys.inbox.counts()
|
|
2717
|
-
});
|
|
2718
|
-
}
|
|
2719
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2720
|
-
}
|
|
2721
|
-
});
|
|
2722
|
-
}
|
|
2723
|
-
function useRevokeConfirmation(claimerHandleOrDid, options) {
|
|
2724
|
-
const config = useSifaConfig();
|
|
2725
|
-
const queryClient = useQueryClient();
|
|
2726
|
-
return useMutation({
|
|
2727
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2728
|
-
// one below and silently drop cache invalidation (#453).
|
|
2729
|
-
...options,
|
|
2730
|
-
mutationFn: (data) => revokeConfirmation(config, data),
|
|
2731
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2732
|
-
if (result.success) {
|
|
2733
|
-
await queryClient.invalidateQueries({
|
|
2734
|
-
queryKey: sifaQueryKeys.confirmation.pending()
|
|
2735
|
-
});
|
|
2736
|
-
await queryClient.invalidateQueries({
|
|
2737
|
-
queryKey: sifaQueryKeys.confirmation.given()
|
|
2738
|
-
});
|
|
2739
|
-
await queryClient.invalidateQueries({
|
|
2740
|
-
queryKey: sifaQueryKeys.inbox.counts()
|
|
2741
|
-
});
|
|
2742
|
-
if (claimerHandleOrDid) {
|
|
2743
|
-
await queryClient.invalidateQueries({
|
|
2744
|
-
queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid)
|
|
2745
|
-
});
|
|
2746
|
-
}
|
|
2747
|
-
}
|
|
2748
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2749
|
-
}
|
|
2750
|
-
});
|
|
2751
|
-
}
|
|
2752
|
-
function useInboxCounts(options) {
|
|
2753
|
-
const config = useSifaConfig();
|
|
2754
|
-
return useQuery({
|
|
2755
|
-
queryKey: sifaQueryKeys.inbox.counts(),
|
|
2756
|
-
queryFn: () => fetchInboxCounts(config),
|
|
2757
|
-
...options
|
|
2758
|
-
});
|
|
2759
|
-
}
|
|
2760
|
-
function useUnlinkedPositions(options) {
|
|
2761
|
-
const config = useSifaConfig();
|
|
2762
|
-
return useQuery({
|
|
2763
|
-
queryKey: sifaQueryKeys.position.unlinked(),
|
|
2764
|
-
queryFn: () => fetchUnlinkedPositions(config),
|
|
2765
|
-
...options
|
|
2766
|
-
});
|
|
2767
|
-
}
|
|
2768
|
-
function useDismissUnlinkedPosition(options) {
|
|
2769
|
-
const config = useSifaConfig();
|
|
2770
|
-
const queryClient = useQueryClient();
|
|
2771
|
-
return useMutation({
|
|
2772
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2773
|
-
// one below and silently drop cache invalidation (#453).
|
|
2774
|
-
...options,
|
|
2775
|
-
mutationFn: (data) => dismissUnlinkedPosition(config, data),
|
|
2776
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2777
|
-
if (result.success) {
|
|
2778
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.unlinked() });
|
|
2779
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.inbox.counts() });
|
|
2780
|
-
}
|
|
2781
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2782
|
-
}
|
|
2783
|
-
});
|
|
2784
|
-
}
|
|
2785
|
-
function useProfileCompleteness(options) {
|
|
2786
|
-
const config = useSifaConfig();
|
|
2787
|
-
return useQuery({
|
|
2788
|
-
queryKey: sifaQueryKeys.profile.completeness(),
|
|
2789
|
-
queryFn: () => fetchProfileCompleteness(config),
|
|
2790
|
-
...options
|
|
2791
|
-
});
|
|
2792
|
-
}
|
|
2793
|
-
async function invalidateProfile7(queryClient, ownerHandleOrDid) {
|
|
2794
|
-
await queryClient.invalidateQueries({
|
|
2795
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2796
|
-
});
|
|
2797
|
-
}
|
|
2798
|
-
function useHideKeytraceClaim(ownerHandleOrDid, options) {
|
|
2799
|
-
const config = useSifaConfig();
|
|
2800
|
-
const queryClient = useQueryClient();
|
|
2801
|
-
return useMutation({
|
|
2802
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2803
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2804
|
-
...options,
|
|
2805
|
-
mutationFn: (rkey) => hideKeytraceClaim(config, rkey),
|
|
2806
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2807
|
-
if (result.success) {
|
|
2808
|
-
await invalidateProfile7(queryClient, ownerHandleOrDid);
|
|
2809
|
-
}
|
|
2810
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2811
|
-
}
|
|
2812
|
-
});
|
|
2813
|
-
}
|
|
2814
|
-
function useUnhideKeytraceClaim(ownerHandleOrDid, options) {
|
|
2815
|
-
const config = useSifaConfig();
|
|
2816
|
-
const queryClient = useQueryClient();
|
|
2817
|
-
return useMutation({
|
|
2818
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2819
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2820
|
-
...options,
|
|
2821
|
-
mutationFn: (rkey) => unhideKeytraceClaim(config, rkey),
|
|
2822
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2823
|
-
if (result.success) {
|
|
2824
|
-
await invalidateProfile7(queryClient, ownerHandleOrDid);
|
|
2825
|
-
}
|
|
2826
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2827
|
-
}
|
|
2828
|
-
});
|
|
2829
|
-
}
|
|
2830
|
-
async function invalidateProfile8(queryClient, ownerHandleOrDid) {
|
|
2831
|
-
await queryClient.invalidateQueries({
|
|
2832
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2833
|
-
});
|
|
2834
|
-
}
|
|
2835
|
-
function useRevealMarqueDomain(ownerHandleOrDid, options) {
|
|
2836
|
-
const config = useSifaConfig();
|
|
2837
|
-
const queryClient = useQueryClient();
|
|
2838
|
-
return useMutation({
|
|
2839
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2840
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2841
|
-
...options,
|
|
2842
|
-
mutationFn: (domain) => revealMarqueDomain(config, domain),
|
|
2843
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2844
|
-
if (result.success) {
|
|
2845
|
-
await invalidateProfile8(queryClient, ownerHandleOrDid);
|
|
2846
|
-
}
|
|
2847
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2848
|
-
}
|
|
2849
|
-
});
|
|
2850
|
-
}
|
|
2851
|
-
function useUnrevealMarqueDomain(ownerHandleOrDid, options) {
|
|
2852
|
-
const config = useSifaConfig();
|
|
2853
|
-
const queryClient = useQueryClient();
|
|
2854
|
-
return useMutation({
|
|
2855
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2856
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2857
|
-
...options,
|
|
2858
|
-
mutationFn: (domain) => unrevealMarqueDomain(config, domain),
|
|
2859
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2860
|
-
if (result.success) {
|
|
2861
|
-
await invalidateProfile8(queryClient, ownerHandleOrDid);
|
|
2862
|
-
}
|
|
2863
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2864
|
-
}
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
async function invalidateProfile9(queryClient, ownerHandleOrDid) {
|
|
2868
|
-
await queryClient.invalidateQueries({
|
|
2869
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2870
|
-
});
|
|
2871
|
-
}
|
|
2872
|
-
function makeWriteHook(fetcher) {
|
|
2873
|
-
return function useHook(ownerHandleOrDid, options) {
|
|
2874
|
-
const config = useSifaConfig();
|
|
2875
|
-
const queryClient = useQueryClient();
|
|
2876
|
-
return useMutation({
|
|
2877
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2878
|
-
// handler below and silently drop cache invalidation (#453).
|
|
2879
|
-
...options,
|
|
2880
|
-
mutationFn: (v) => fetcher(config, v),
|
|
2881
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2882
|
-
if (result.success) {
|
|
2883
|
-
await invalidateProfile9(queryClient, ownerHandleOrDid);
|
|
2884
|
-
}
|
|
2885
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2886
|
-
}
|
|
2887
|
-
});
|
|
2888
|
-
};
|
|
2889
|
-
}
|
|
2890
|
-
var useHideOrcidPublication = makeWriteHook(
|
|
2891
|
-
(config, putCode) => hideOrcidPublication(config, putCode)
|
|
2892
|
-
);
|
|
2893
|
-
var useUnhideOrcidPublication = makeWriteHook(
|
|
2894
|
-
(config, putCode) => unhideOrcidPublication(config, putCode)
|
|
2895
|
-
);
|
|
2896
|
-
var useHideStandardPublication = makeWriteHook(
|
|
2897
|
-
(config, uri) => hideStandardPublication(config, uri)
|
|
2898
|
-
);
|
|
2899
|
-
var useUnhideStandardPublication = makeWriteHook(
|
|
2900
|
-
(config, uri) => unhideStandardPublication(config, uri)
|
|
2901
|
-
);
|
|
2902
|
-
var useBulkHideStandardPublications = makeWriteHook(
|
|
2903
|
-
(config, uris) => bulkHideStandardPublications(config, uris)
|
|
2904
|
-
);
|
|
2905
|
-
var useBulkUnhideStandardPublications = makeWriteHook(
|
|
2906
|
-
(config, uris) => bulkUnhideStandardPublications(config, uris)
|
|
2907
|
-
);
|
|
2908
|
-
var useHideSifaPublication = makeWriteHook(
|
|
2909
|
-
(config, rkey) => hideSifaPublication(config, rkey)
|
|
2910
|
-
);
|
|
2911
|
-
var useUnhideSifaPublication = makeWriteHook(
|
|
2912
|
-
(config, rkey) => unhideSifaPublication(config, rkey)
|
|
2913
|
-
);
|
|
2914
|
-
function useRefreshOrcidPublications(ownerHandleOrDid, options) {
|
|
2915
|
-
const config = useSifaConfig();
|
|
2916
|
-
const queryClient = useQueryClient();
|
|
2917
|
-
return useMutation({
|
|
2918
|
-
mutationFn: () => refreshOrcidPublications(config),
|
|
2919
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2920
|
-
if (result.success) {
|
|
2921
|
-
await invalidateProfile9(queryClient, ownerHandleOrDid);
|
|
2922
|
-
}
|
|
2923
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2924
|
-
}
|
|
2925
|
-
});
|
|
2926
|
-
}
|
|
2927
|
-
async function invalidateProfile10(queryClient, ownerHandleOrDid) {
|
|
2928
|
-
await queryClient.invalidateQueries({
|
|
2929
|
-
queryKey: sifaQueryKeys.profile.byHandle(ownerHandleOrDid)
|
|
2930
|
-
});
|
|
2931
|
-
}
|
|
2932
|
-
function makeWriteHook2(fetcher) {
|
|
2933
|
-
return function useHook(ownerHandleOrDid, options) {
|
|
2934
|
-
const config = useSifaConfig();
|
|
2935
|
-
const queryClient = useQueryClient();
|
|
2936
|
-
return useMutation({
|
|
2937
|
-
mutationFn: (v) => fetcher(config, v),
|
|
2938
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2939
|
-
if (result.success) {
|
|
2940
|
-
await invalidateProfile10(queryClient, ownerHandleOrDid);
|
|
2941
|
-
}
|
|
2942
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2943
|
-
},
|
|
2944
|
-
...options
|
|
2945
|
-
});
|
|
2946
|
-
};
|
|
2947
|
-
}
|
|
2948
|
-
var useHideProfileItem = makeWriteHook2(
|
|
2949
|
-
(config, input) => hideProfileItem(config, input)
|
|
2950
|
-
);
|
|
2951
|
-
var useUnhideProfileItem = makeWriteHook2(
|
|
2952
|
-
(config, input) => unhideProfileItem(config, input)
|
|
2953
|
-
);
|
|
2954
|
-
var useBulkHideProfileItems = makeWriteHook2(
|
|
2955
|
-
(config, input) => bulkHideProfileItems(config, input)
|
|
2956
|
-
);
|
|
2957
|
-
var useBulkUnhideProfileItems = makeWriteHook2(
|
|
2958
|
-
(config, input) => bulkUnhideProfileItems(config, input)
|
|
2959
|
-
);
|
|
2960
|
-
function useHiddenActivityItems(options) {
|
|
2961
|
-
const config = useSifaConfig();
|
|
2962
|
-
return useQuery({
|
|
2963
|
-
queryKey: sifaQueryKeys.activity.hiddenItems(),
|
|
2964
|
-
queryFn: () => fetchHiddenActivityItems(config),
|
|
2965
|
-
...options
|
|
2966
|
-
});
|
|
2967
|
-
}
|
|
2968
|
-
function makeHideHook(fetcher) {
|
|
2969
|
-
return function useHook(options) {
|
|
2970
|
-
const config = useSifaConfig();
|
|
2971
|
-
const queryClient = useQueryClient();
|
|
2972
|
-
return useMutation({
|
|
2973
|
-
mutationFn: (v) => fetcher(config, v),
|
|
2974
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2975
|
-
if (result.success) {
|
|
2976
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.activity.all() });
|
|
2977
|
-
}
|
|
2978
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2979
|
-
},
|
|
2980
|
-
...options
|
|
2981
|
-
});
|
|
2982
|
-
};
|
|
2983
|
-
}
|
|
2984
|
-
var useHideActivityItem = makeHideHook(
|
|
2985
|
-
(config, input) => hideActivityItem(config, input)
|
|
2986
|
-
);
|
|
2987
|
-
var useUnhideActivityItem = makeHideHook(
|
|
2988
|
-
(config, input) => unhideActivityItem(config, input)
|
|
2989
|
-
);
|
|
2990
|
-
function useStats(options) {
|
|
2991
|
-
const config = useSifaConfig();
|
|
2992
|
-
return useQuery({
|
|
2993
|
-
queryKey: sifaQueryKeys.stats.homepage(),
|
|
2994
|
-
queryFn: () => fetchStats(config),
|
|
2995
|
-
...options
|
|
2996
|
-
});
|
|
2997
|
-
}
|
|
2998
|
-
function useAppsRegistry(options) {
|
|
2999
|
-
const config = useSifaConfig();
|
|
3000
|
-
return useQuery({
|
|
3001
|
-
queryKey: sifaQueryKeys.apps.registry(),
|
|
3002
|
-
queryFn: () => fetchAppsRegistry(config),
|
|
3003
|
-
...options
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
3006
|
-
function useHiddenApps(options) {
|
|
3007
|
-
const config = useSifaConfig();
|
|
3008
|
-
return useQuery({
|
|
3009
|
-
queryKey: sifaQueryKeys.apps.hidden(),
|
|
3010
|
-
queryFn: () => fetchHiddenApps(config),
|
|
3011
|
-
...options
|
|
3012
|
-
});
|
|
3013
|
-
}
|
|
3014
|
-
function useAccounts(options) {
|
|
3015
|
-
const config = useSifaConfig();
|
|
3016
|
-
return useQuery({
|
|
3017
|
-
queryKey: sifaQueryKeys.auth.accounts(),
|
|
3018
|
-
queryFn: () => fetchAccounts(config),
|
|
3019
|
-
...options
|
|
3020
|
-
});
|
|
3021
|
-
}
|
|
3022
|
-
function useSearchProfiles(filters, options) {
|
|
3023
|
-
const config = useSifaConfig();
|
|
3024
|
-
return useQuery({
|
|
3025
|
-
queryKey: sifaQueryKeys.search.profiles(filters),
|
|
3026
|
-
queryFn: () => fetchSearchProfiles(config, filters),
|
|
3027
|
-
...options
|
|
3028
|
-
});
|
|
3029
|
-
}
|
|
3030
|
-
function useSkillSuggestions(query, options) {
|
|
3031
|
-
const config = useSifaConfig();
|
|
3032
|
-
return useQuery({
|
|
3033
|
-
queryKey: sifaQueryKeys.search.skills(query),
|
|
3034
|
-
queryFn: () => fetchSkillSuggestions(config, query),
|
|
3035
|
-
enabled: query.trim().length > 0 && (options?.enabled ?? true),
|
|
3036
|
-
...options
|
|
3037
|
-
});
|
|
3038
|
-
}
|
|
3039
|
-
function useCanonicalSkillSearch(query, limit = 10, options) {
|
|
3040
|
-
const config = useSifaConfig();
|
|
3041
|
-
return useQuery({
|
|
3042
|
-
queryKey: sifaQueryKeys.search.canonicalSkills(query, limit),
|
|
3043
|
-
queryFn: () => searchSkills(config, query, limit),
|
|
3044
|
-
enabled: query.trim().length > 0 && (options?.enabled ?? true),
|
|
3045
|
-
...options
|
|
3046
|
-
});
|
|
3047
|
-
}
|
|
3048
|
-
function useSearchFilters(options) {
|
|
3049
|
-
const config = useSifaConfig();
|
|
3050
|
-
return useQuery({
|
|
3051
|
-
queryKey: sifaQueryKeys.search.filters(),
|
|
3052
|
-
queryFn: () => fetchSearchFilters(config),
|
|
3053
|
-
...options
|
|
3054
|
-
});
|
|
3055
|
-
}
|
|
3056
|
-
function useDebouncedValue(value, delayMs = 250) {
|
|
3057
|
-
const [debounced, setDebounced] = useState(value);
|
|
3058
|
-
useEffect(() => {
|
|
3059
|
-
const timer = setTimeout(() => setDebounced(value), delayMs);
|
|
3060
|
-
return () => clearTimeout(timer);
|
|
3061
|
-
}, [value, delayMs]);
|
|
3062
|
-
return debounced;
|
|
3063
|
-
}
|
|
3064
|
-
function useEntitySearch(query, opts = {}, queryOptions) {
|
|
3065
|
-
const config = useSifaConfig();
|
|
3066
|
-
const { limit = 5, debounceMs = 250, enabled = true } = opts;
|
|
3067
|
-
const debounced = useDebouncedValue(query.trim(), debounceMs);
|
|
3068
|
-
return useQuery({
|
|
3069
|
-
queryKey: sifaQueryKeys.entity.search(debounced, limit),
|
|
3070
|
-
queryFn: () => fetchEntitySearch(config, debounced, limit),
|
|
3071
|
-
enabled: enabled && debounced.length > 0,
|
|
3072
|
-
...queryOptions
|
|
3073
|
-
});
|
|
3074
|
-
}
|
|
3075
|
-
function useSelectEntity(options) {
|
|
3076
|
-
const config = useSifaConfig();
|
|
3077
|
-
return useMutation({
|
|
3078
|
-
mutationFn: (body) => selectEntity(config, body),
|
|
3079
|
-
...options
|
|
3080
|
-
});
|
|
3081
|
-
}
|
|
3082
|
-
function useImportSearchEntities(options) {
|
|
3083
|
-
const config = useSifaConfig();
|
|
3084
|
-
return useMutation({
|
|
3085
|
-
mutationFn: (query) => importSearchEntities(config, query),
|
|
3086
|
-
...options
|
|
3087
|
-
});
|
|
3088
|
-
}
|
|
3089
|
-
function useResolveEntityDomain(options) {
|
|
3090
|
-
const config = useSifaConfig();
|
|
3091
|
-
return useMutation({
|
|
3092
|
-
mutationFn: (domain) => resolveEntityDomain(config, domain),
|
|
3093
|
-
...options
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
|
-
function useMintEntityDomain(options) {
|
|
3097
|
-
const config = useSifaConfig();
|
|
3098
|
-
return useMutation({
|
|
3099
|
-
mutationFn: (domain) => mintEntityDomain(config, domain),
|
|
3100
|
-
...options
|
|
3101
|
-
});
|
|
3102
|
-
}
|
|
3103
|
-
function useSimilarProfiles(did, opts = {}, options) {
|
|
3104
|
-
const config = useSifaConfig();
|
|
3105
|
-
const limit = opts.limit ?? 5;
|
|
3106
|
-
return useQuery({
|
|
3107
|
-
queryKey: sifaQueryKeys.discovery.similar(did ?? "", limit),
|
|
3108
|
-
queryFn: () => fetchSimilarProfiles(config, did ?? "", { limit }),
|
|
3109
|
-
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
3110
|
-
...options
|
|
3111
|
-
});
|
|
3112
|
-
}
|
|
3113
|
-
function useSuggestions(opts = {}, options) {
|
|
3114
|
-
const config = useSifaConfig();
|
|
3115
|
-
return useQuery({
|
|
3116
|
-
queryKey: sifaQueryKeys.discovery.suggestions(opts),
|
|
3117
|
-
queryFn: () => fetchSuggestions(config, opts),
|
|
3118
|
-
...options
|
|
3119
|
-
});
|
|
3120
|
-
}
|
|
3121
|
-
function useSuggestionCount(since, options) {
|
|
3122
|
-
const config = useSifaConfig();
|
|
3123
|
-
return useQuery({
|
|
3124
|
-
queryKey: sifaQueryKeys.discovery.suggestionCount(since),
|
|
3125
|
-
queryFn: () => fetchSuggestionCount(config, since),
|
|
3126
|
-
...options
|
|
3127
|
-
});
|
|
3128
|
-
}
|
|
3129
|
-
function useFeaturedProfile(options) {
|
|
3130
|
-
const config = useSifaConfig();
|
|
3131
|
-
return useQuery({
|
|
3132
|
-
queryKey: sifaQueryKeys.discovery.featured(),
|
|
3133
|
-
queryFn: () => fetchFeaturedProfile(config),
|
|
3134
|
-
...options
|
|
3135
|
-
});
|
|
3136
|
-
}
|
|
3137
|
-
function useFollowing(opts = {}, options) {
|
|
3138
|
-
const config = useSifaConfig();
|
|
3139
|
-
return useQuery({
|
|
3140
|
-
queryKey: sifaQueryKeys.follow.following(opts),
|
|
3141
|
-
queryFn: () => fetchFollowing(config, opts),
|
|
3142
|
-
...options
|
|
3143
|
-
});
|
|
3144
|
-
}
|
|
3145
|
-
function useFollow(options) {
|
|
3146
|
-
const config = useSifaConfig();
|
|
3147
|
-
const queryClient = useQueryClient();
|
|
3148
|
-
return useMutation({
|
|
3149
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
3150
|
-
// one below and silently drop cache invalidation (#453).
|
|
3151
|
-
...options,
|
|
3152
|
-
mutationFn: ({ handle, note }) => followUser(config, handle, { note }),
|
|
3153
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3154
|
-
if (result.success) {
|
|
3155
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
3156
|
-
}
|
|
3157
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3158
|
-
},
|
|
3159
|
-
onError: async (error, variables, onMutateResult, context) => {
|
|
3160
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
3161
|
-
await options?.onError?.(error, variables, onMutateResult, context);
|
|
3162
|
-
}
|
|
3163
|
-
});
|
|
3164
|
-
}
|
|
3165
|
-
function useUnfollow(options) {
|
|
3166
|
-
const config = useSifaConfig();
|
|
3167
|
-
const queryClient = useQueryClient();
|
|
3168
|
-
return useMutation({
|
|
3169
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
3170
|
-
// one below and silently drop cache invalidation (#453).
|
|
3171
|
-
...options,
|
|
3172
|
-
mutationFn: ({ handle }) => unfollowUser(config, handle),
|
|
3173
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3174
|
-
if (result.success) {
|
|
3175
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
3176
|
-
}
|
|
3177
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3178
|
-
},
|
|
3179
|
-
onError: async (error, variables, onMutateResult, context) => {
|
|
3180
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
3181
|
-
await options?.onError?.(error, variables, onMutateResult, context);
|
|
3182
|
-
}
|
|
3183
|
-
});
|
|
3184
|
-
}
|
|
3185
|
-
function useFollowers(handle, opts = {}, options) {
|
|
3186
|
-
const config = useSifaConfig();
|
|
3187
|
-
return useInfiniteQuery({
|
|
3188
|
-
queryKey: sifaQueryKeys.follow.followers(handle),
|
|
3189
|
-
queryFn: ({ pageParam }) => getFollowers(config, handle, { ...opts, cursor: pageParam }),
|
|
3190
|
-
initialPageParam: void 0,
|
|
3191
|
-
getNextPageParam: (lastPage) => lastPage.cursor ?? void 0,
|
|
3192
|
-
enabled: handle.length > 0,
|
|
3193
|
-
...options
|
|
3194
|
-
});
|
|
3195
|
-
}
|
|
3196
|
-
function useFollowingList(handle, opts = {}, options) {
|
|
3197
|
-
const config = useSifaConfig();
|
|
3198
|
-
return useInfiniteQuery({
|
|
3199
|
-
queryKey: sifaQueryKeys.follow.followingOf(handle),
|
|
3200
|
-
queryFn: ({ pageParam }) => getFollowing(config, handle, { ...opts, cursor: pageParam }),
|
|
3201
|
-
initialPageParam: void 0,
|
|
3202
|
-
getNextPageParam: (lastPage) => lastPage.cursor ?? void 0,
|
|
3203
|
-
enabled: handle.length > 0,
|
|
3204
|
-
...options
|
|
3205
|
-
});
|
|
3206
|
-
}
|
|
3207
|
-
function useFollowingFeed(opts = {}, options) {
|
|
3208
|
-
const config = useSifaConfig();
|
|
3209
|
-
return useQuery({
|
|
3210
|
-
// `app` is part of the key: each source tab is its own cache entry, so
|
|
3211
|
-
// switching tabs does not serve the previous tab's items.
|
|
3212
|
-
queryKey: sifaQueryKeys.follow.feed({
|
|
3213
|
-
limit: opts.limit,
|
|
3214
|
-
includeBluesky: opts.includeBluesky,
|
|
3215
|
-
app: opts.app
|
|
3216
|
-
}),
|
|
3217
|
-
queryFn: () => fetchFollowingFeed(config, opts),
|
|
3218
|
-
...options
|
|
3219
|
-
});
|
|
3220
|
-
}
|
|
3221
|
-
function useMutuals(handleOrDid, opts = {}, options) {
|
|
3222
|
-
const config = useSifaConfig();
|
|
3223
|
-
return useInfiniteQuery({
|
|
3224
|
-
queryKey: sifaQueryKeys.follow.mutuals(handleOrDid),
|
|
3225
|
-
queryFn: ({ pageParam }) => getMutuals(config, handleOrDid, { ...opts, cursor: pageParam }),
|
|
3226
|
-
initialPageParam: void 0,
|
|
3227
|
-
getNextPageParam: (lastPage) => lastPage.cursor ?? void 0,
|
|
3228
|
-
enabled: handleOrDid.length > 0,
|
|
3229
|
-
...options
|
|
3230
|
-
});
|
|
3231
|
-
}
|
|
3232
|
-
function useBlueskySuggestions(opts = {}, options) {
|
|
3233
|
-
const config = useSifaConfig();
|
|
3234
|
-
return useInfiniteQuery({
|
|
3235
|
-
queryKey: sifaQueryKeys.follow.blueskySuggestions(),
|
|
3236
|
-
queryFn: ({ pageParam }) => getBlueskySuggestions(config, { ...opts, cursor: pageParam }),
|
|
3237
|
-
initialPageParam: void 0,
|
|
3238
|
-
getNextPageParam: (lastPage) => lastPage.cursor ?? void 0,
|
|
3239
|
-
...options
|
|
3240
|
-
});
|
|
3241
|
-
}
|
|
3242
|
-
function useFeatureAllowlist(flag, options) {
|
|
3243
|
-
const config = useSifaConfig();
|
|
3244
|
-
return useQuery({
|
|
3245
|
-
queryKey: sifaQueryKeys.admin.featureAllowlist(flag),
|
|
3246
|
-
queryFn: () => listFeatureAllowlist(config, flag),
|
|
3247
|
-
...options
|
|
3248
|
-
});
|
|
3249
|
-
}
|
|
3250
|
-
function useAddFeatureAllowlist(flag, options) {
|
|
3251
|
-
const config = useSifaConfig();
|
|
3252
|
-
const queryClient = useQueryClient();
|
|
3253
|
-
const key = sifaQueryKeys.admin.featureAllowlist(flag);
|
|
3254
|
-
return useMutation({
|
|
3255
|
-
mutationFn: ({ did, note }) => addFeatureAllowlist(config, flag, did, { note }),
|
|
3256
|
-
onMutate: async ({ did, note }) => {
|
|
3257
|
-
await queryClient.cancelQueries({ queryKey: key });
|
|
3258
|
-
const previous = queryClient.getQueryData(key);
|
|
3259
|
-
const optimisticEntry = {
|
|
3260
|
-
did,
|
|
3261
|
-
addedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3262
|
-
note: note ?? null
|
|
3263
|
-
};
|
|
3264
|
-
const next = previous ? { items: [optimisticEntry, ...previous.items.filter((e) => e.did !== did)] } : { items: [optimisticEntry] };
|
|
3265
|
-
queryClient.setQueryData(key, next);
|
|
3266
|
-
return { previous };
|
|
3267
|
-
},
|
|
3268
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3269
|
-
if (!result.success && onMutateResult?.previous) {
|
|
3270
|
-
queryClient.setQueryData(key, onMutateResult.previous);
|
|
3271
|
-
}
|
|
3272
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3273
|
-
},
|
|
3274
|
-
onError: async (error, variables, onMutateResult, context) => {
|
|
3275
|
-
if (onMutateResult?.previous) {
|
|
3276
|
-
queryClient.setQueryData(key, onMutateResult.previous);
|
|
3277
|
-
}
|
|
3278
|
-
await options?.onError?.(error, variables, onMutateResult, context);
|
|
3279
|
-
},
|
|
3280
|
-
onSettled: async (result, error, variables, onMutateResult, context) => {
|
|
3281
|
-
await queryClient.invalidateQueries({ queryKey: key });
|
|
3282
|
-
await options?.onSettled?.(result, error, variables, onMutateResult, context);
|
|
3283
|
-
},
|
|
3284
|
-
...options
|
|
3285
|
-
});
|
|
3286
|
-
}
|
|
3287
|
-
function useRemoveFeatureAllowlist(flag, options) {
|
|
3288
|
-
const config = useSifaConfig();
|
|
3289
|
-
const queryClient = useQueryClient();
|
|
3290
|
-
const key = sifaQueryKeys.admin.featureAllowlist(flag);
|
|
3291
|
-
return useMutation(
|
|
3292
|
-
{
|
|
3293
|
-
mutationFn: ({ did }) => removeFeatureAllowlist(config, flag, did),
|
|
3294
|
-
onMutate: async ({ did }) => {
|
|
3295
|
-
await queryClient.cancelQueries({ queryKey: key });
|
|
3296
|
-
const previous = queryClient.getQueryData(key);
|
|
3297
|
-
if (previous) {
|
|
3298
|
-
queryClient.setQueryData(key, {
|
|
3299
|
-
items: previous.items.filter((e) => e.did !== did)
|
|
3300
|
-
});
|
|
3301
|
-
}
|
|
3302
|
-
return { previous };
|
|
3303
|
-
},
|
|
3304
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3305
|
-
if (!result.success && onMutateResult?.previous) {
|
|
3306
|
-
queryClient.setQueryData(key, onMutateResult.previous);
|
|
3307
|
-
}
|
|
3308
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3309
|
-
},
|
|
3310
|
-
onError: async (error, variables, onMutateResult, context) => {
|
|
3311
|
-
if (onMutateResult?.previous) {
|
|
3312
|
-
queryClient.setQueryData(key, onMutateResult.previous);
|
|
3313
|
-
}
|
|
3314
|
-
await options?.onError?.(error, variables, onMutateResult, context);
|
|
3315
|
-
},
|
|
3316
|
-
onSettled: async (result, error, variables, onMutateResult, context) => {
|
|
3317
|
-
await queryClient.invalidateQueries({ queryKey: key });
|
|
3318
|
-
await options?.onSettled?.(result, error, variables, onMutateResult, context);
|
|
3319
|
-
},
|
|
3320
|
-
...options
|
|
3321
|
-
}
|
|
3322
|
-
);
|
|
3323
|
-
}
|
|
3324
|
-
var REVIEW_QUEUES_STALE_TIME_MS = 6e4;
|
|
3325
|
-
function useAdminReviewQueues(options) {
|
|
3326
|
-
const config = useSifaConfig();
|
|
3327
|
-
return useQuery({
|
|
3328
|
-
queryKey: sifaQueryKeys.admin.reviewQueues(),
|
|
3329
|
-
queryFn: () => getAdminReviewQueues(config),
|
|
3330
|
-
staleTime: REVIEW_QUEUES_STALE_TIME_MS,
|
|
3331
|
-
...options
|
|
3332
|
-
});
|
|
3333
|
-
}
|
|
3334
|
-
function useHeatmapData(handleOrDid, days, options) {
|
|
3335
|
-
const config = useSifaConfig();
|
|
3336
|
-
return useQuery({
|
|
3337
|
-
queryKey: sifaQueryKeys.activity.heatmap(handleOrDid ?? "", days),
|
|
3338
|
-
queryFn: () => fetchHeatmapData(config, handleOrDid ?? "", days),
|
|
3339
|
-
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
3340
|
-
...options
|
|
3341
|
-
});
|
|
3342
|
-
}
|
|
3343
|
-
function useActivityTeaser(handleOrDid, options) {
|
|
3344
|
-
const config = useSifaConfig();
|
|
3345
|
-
return useQuery({
|
|
3346
|
-
queryKey: sifaQueryKeys.activity.teaser(handleOrDid ?? ""),
|
|
3347
|
-
queryFn: () => fetchActivityTeaser(config, handleOrDid ?? ""),
|
|
3348
|
-
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
3349
|
-
...options
|
|
3350
|
-
});
|
|
3351
|
-
}
|
|
3352
|
-
function useActivityFeed(handleOrDid, opts = {}, options) {
|
|
3353
|
-
const config = useSifaConfig();
|
|
3354
|
-
return useQuery({
|
|
3355
|
-
queryKey: sifaQueryKeys.activity.feed(handleOrDid ?? "", opts),
|
|
3356
|
-
queryFn: () => fetchActivityFeed(config, handleOrDid ?? "", opts),
|
|
3357
|
-
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
3358
|
-
...options
|
|
3359
|
-
});
|
|
3360
|
-
}
|
|
3361
|
-
function useMyGithubPullRequests(params = {}, options) {
|
|
3362
|
-
const config = useSifaConfig();
|
|
3363
|
-
return useQuery({
|
|
3364
|
-
queryKey: sifaQueryKeys.github.myPullRequests(params),
|
|
3365
|
-
queryFn: () => fetchMyGithubPullRequests(config, params),
|
|
3366
|
-
...options
|
|
3367
|
-
});
|
|
3368
|
-
}
|
|
3369
|
-
function useEndorsementCount(did, options) {
|
|
3370
|
-
const config = useSifaConfig();
|
|
3371
|
-
return useQuery({
|
|
3372
|
-
queryKey: sifaQueryKeys.endorsement.count(did ?? ""),
|
|
3373
|
-
queryFn: () => fetchEndorsementCount(config, did ?? ""),
|
|
3374
|
-
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
3375
|
-
...options
|
|
3376
|
-
});
|
|
3377
|
-
}
|
|
3378
|
-
function useNetworkStreamCount(did, options) {
|
|
3379
|
-
const config = useSifaConfig();
|
|
3380
|
-
return useQuery({
|
|
3381
|
-
queryKey: sifaQueryKeys.stream.networkCount(did ?? ""),
|
|
3382
|
-
queryFn: () => fetchNetworkStreamCount(config, did ?? ""),
|
|
3383
|
-
enabled: Boolean(did) && (options?.enabled ?? true),
|
|
3384
|
-
...options
|
|
3385
|
-
});
|
|
3386
|
-
}
|
|
3387
|
-
function useReactionStatus(uris, options) {
|
|
3388
|
-
const config = useSifaConfig();
|
|
3389
|
-
return useQuery({
|
|
3390
|
-
queryKey: sifaQueryKeys.reactions.status(uris),
|
|
3391
|
-
queryFn: () => fetchReactionStatus(config, uris),
|
|
3392
|
-
...options
|
|
3393
|
-
});
|
|
3394
|
-
}
|
|
3395
|
-
function useAppAccountCheck(appId, options) {
|
|
3396
|
-
const config = useSifaConfig();
|
|
3397
|
-
return useQuery({
|
|
3398
|
-
queryKey: sifaQueryKeys.reactions.accountCheck(appId ?? ""),
|
|
3399
|
-
queryFn: () => checkAppAccount(config, appId ?? ""),
|
|
3400
|
-
enabled: Boolean(appId) && (options?.enabled ?? true),
|
|
3401
|
-
...options
|
|
3402
|
-
});
|
|
3403
|
-
}
|
|
3404
|
-
function useCreateReaction(options) {
|
|
3405
|
-
const config = useSifaConfig();
|
|
3406
|
-
const queryClient = useQueryClient();
|
|
3407
|
-
return useMutation({
|
|
3408
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3409
|
-
// handler below and silently drop cache invalidation (#453).
|
|
3410
|
-
...options,
|
|
3411
|
-
mutationFn: ({ targetUri, appId, targetCid }) => createReaction(config, targetUri, appId, targetCid),
|
|
3412
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3413
|
-
if (result.ok) {
|
|
3414
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });
|
|
3415
|
-
}
|
|
3416
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3417
|
-
}
|
|
3418
|
-
});
|
|
3419
|
-
}
|
|
3420
|
-
function useDeleteReaction(options) {
|
|
3421
|
-
const config = useSifaConfig();
|
|
3422
|
-
const queryClient = useQueryClient();
|
|
3423
|
-
return useMutation({
|
|
3424
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3425
|
-
// handler below and silently drop cache invalidation (#453).
|
|
3426
|
-
...options,
|
|
3427
|
-
mutationFn: ({ targetUri, appId }) => deleteReaction(config, targetUri, appId),
|
|
3428
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3429
|
-
if (result.success) {
|
|
3430
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });
|
|
3431
|
-
}
|
|
3432
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3433
|
-
}
|
|
3434
|
-
});
|
|
3435
|
-
}
|
|
3436
|
-
function useRoadmapVotes(options) {
|
|
3437
|
-
const config = useSifaConfig();
|
|
3438
|
-
return useQuery({
|
|
3439
|
-
queryKey: sifaQueryKeys.roadmap.votes(),
|
|
3440
|
-
queryFn: () => fetchRoadmapVotes(config),
|
|
3441
|
-
...options
|
|
3442
|
-
});
|
|
3443
|
-
}
|
|
3444
|
-
function useMyRoadmapVotes(options) {
|
|
3445
|
-
const config = useSifaConfig();
|
|
3446
|
-
return useQuery({
|
|
3447
|
-
queryKey: sifaQueryKeys.roadmap.myVotes(),
|
|
3448
|
-
queryFn: () => fetchMyRoadmapVotes(config),
|
|
3449
|
-
...options
|
|
3450
|
-
});
|
|
3451
|
-
}
|
|
3452
|
-
async function invalidateRoadmap(queryClient) {
|
|
3453
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.roadmap.all() });
|
|
3454
|
-
}
|
|
3455
|
-
function useCastRoadmapVote(options) {
|
|
3456
|
-
const config = useSifaConfig();
|
|
3457
|
-
const queryClient = useQueryClient();
|
|
3458
|
-
return useMutation({
|
|
3459
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3460
|
-
// handler below and silently drop cache invalidation (#453).
|
|
3461
|
-
...options,
|
|
3462
|
-
mutationFn: (key) => castRoadmapVote(config, key),
|
|
3463
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3464
|
-
if (result.ok) {
|
|
3465
|
-
await invalidateRoadmap(queryClient);
|
|
3466
|
-
}
|
|
3467
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3468
|
-
}
|
|
3469
|
-
});
|
|
3470
|
-
}
|
|
3471
|
-
function useRetractRoadmapVote(options) {
|
|
3472
|
-
const config = useSifaConfig();
|
|
3473
|
-
const queryClient = useQueryClient();
|
|
3474
|
-
return useMutation({
|
|
3475
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3476
|
-
// handler below and silently drop cache invalidation (#453).
|
|
3477
|
-
...options,
|
|
3478
|
-
mutationFn: (key) => retractRoadmapVote(config, key),
|
|
3479
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3480
|
-
if (result.success) {
|
|
3481
|
-
await invalidateRoadmap(queryClient);
|
|
3482
|
-
}
|
|
3483
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3484
|
-
}
|
|
3485
|
-
});
|
|
3486
|
-
}
|
|
3487
|
-
function useWipePreview(options) {
|
|
3488
|
-
const config = useSifaConfig();
|
|
3489
|
-
return useQuery({
|
|
3490
|
-
queryKey: sifaQueryKeys.destructive.wipePreview(),
|
|
3491
|
-
queryFn: () => fetchWipePreview(config),
|
|
3492
|
-
staleTime: 0,
|
|
3493
|
-
gcTime: 0,
|
|
3494
|
-
...options
|
|
3495
|
-
});
|
|
3496
|
-
}
|
|
3497
|
-
function useResetProfile(options) {
|
|
3498
|
-
const config = useSifaConfig();
|
|
3499
|
-
const queryClient = useQueryClient();
|
|
3500
|
-
return useMutation({
|
|
3501
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
3502
|
-
// one below and silently drop cache invalidation (#453).
|
|
3503
|
-
...options,
|
|
3504
|
-
mutationFn: (deletePdsData) => resetProfile(config, deletePdsData),
|
|
3505
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3506
|
-
if (result.success) {
|
|
3507
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });
|
|
3508
|
-
}
|
|
3509
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3510
|
-
}
|
|
3511
|
-
});
|
|
3512
|
-
}
|
|
3513
|
-
function useDeleteAccount(options) {
|
|
3514
|
-
const config = useSifaConfig();
|
|
3515
|
-
const queryClient = useQueryClient();
|
|
3516
|
-
return useMutation({
|
|
3517
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
3518
|
-
// one below and silently drop cache invalidation (#453).
|
|
3519
|
-
...options,
|
|
3520
|
-
mutationFn: (deletePdsData) => deleteAccount(config, deletePdsData),
|
|
3521
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3522
|
-
if (result.success) {
|
|
3523
|
-
queryClient.clear();
|
|
3524
|
-
}
|
|
3525
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3526
|
-
}
|
|
3527
|
-
});
|
|
3528
|
-
}
|
|
3529
|
-
function useRepoInventory(options) {
|
|
3530
|
-
const config = useSifaConfig();
|
|
3531
|
-
return useQuery({
|
|
3532
|
-
queryKey: sifaQueryKeys.repoInventory.list(),
|
|
3533
|
-
queryFn: () => fetchRepoInventory(config),
|
|
3534
|
-
staleTime: 0,
|
|
3535
|
-
gcTime: 0,
|
|
3536
|
-
...options
|
|
3537
|
-
});
|
|
3538
|
-
}
|
|
3539
|
-
function useDeleteRepoRecords(options) {
|
|
3540
|
-
const config = useSifaConfig();
|
|
3541
|
-
const queryClient = useQueryClient();
|
|
3542
|
-
return useMutation({
|
|
3543
|
-
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
3544
|
-
// one below and silently drop cache invalidation (#453).
|
|
3545
|
-
...options,
|
|
3546
|
-
mutationFn: (input) => deleteRepoRecords(config, input),
|
|
3547
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3548
|
-
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });
|
|
3549
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3550
|
-
}
|
|
3551
|
-
});
|
|
3552
|
-
}
|
|
3553
|
-
|
|
3554
|
-
// src/cards/adult-content.ts
|
|
3555
|
-
var ADULT_CONTENT_LABELS = ["porn", "sexual", "nudity", "graphic-media"];
|
|
3556
|
-
|
|
3557
|
-
// src/query/fetchers/bsky-preferences.ts
|
|
3558
|
-
async function fetchBskyContentLabelPrefs(config, options = {}) {
|
|
3559
|
-
const { onNeedsScope, ...fetchOptions } = options;
|
|
3560
|
-
try {
|
|
3561
|
-
const res = await apiFetch(
|
|
3562
|
-
config,
|
|
3563
|
-
"/api/bsky/preferences/content-labels",
|
|
3564
|
-
{ credentials: "include", ...fetchOptions }
|
|
3565
|
-
);
|
|
3566
|
-
return res.contentLabels;
|
|
3567
|
-
} catch (err) {
|
|
3568
|
-
if (err && typeof err === "object" && "status" in err && err.status === 403) {
|
|
3569
|
-
onNeedsScope?.();
|
|
3570
|
-
}
|
|
3571
|
-
return null;
|
|
3572
|
-
}
|
|
3573
|
-
}
|
|
3574
|
-
async function updateBskyContentLabelPrefs(config, body) {
|
|
3575
|
-
const result = await apiWrite(config, "/api/bsky/preferences/content-labels", "PUT", {
|
|
3576
|
-
headers: { "Content-Type": "application/json" },
|
|
3577
|
-
body: JSON.stringify(body)
|
|
3578
|
-
});
|
|
3579
|
-
return result;
|
|
3580
|
-
}
|
|
3581
|
-
function effectiveContentVisibility(label, prefs, isAuthenticated) {
|
|
3582
|
-
if (!isAuthenticated) return "hide";
|
|
3583
|
-
const value = prefs?.[label] ?? null;
|
|
3584
|
-
return value ?? "hide";
|
|
3585
|
-
}
|
|
3586
|
-
function shouldGateAdultMedia(labels, prefs, isAuthenticated) {
|
|
3587
|
-
if (!labels || labels.length === 0) return false;
|
|
3588
|
-
for (const label of labels) {
|
|
3589
|
-
if (label.neg) continue;
|
|
3590
|
-
if (!ADULT_CONTENT_LABELS.includes(label.val)) continue;
|
|
3591
|
-
const visibility = effectiveContentVisibility(
|
|
3592
|
-
label.val,
|
|
3593
|
-
prefs,
|
|
3594
|
-
isAuthenticated
|
|
3595
|
-
);
|
|
3596
|
-
if (visibility !== "ignore") return true;
|
|
3597
|
-
}
|
|
3598
|
-
return false;
|
|
3599
|
-
}
|
|
3600
|
-
function useBskyContentLabelPrefs(options) {
|
|
3601
|
-
const config = useSifaConfig();
|
|
3602
|
-
return useQuery({
|
|
3603
|
-
queryKey: sifaQueryKeys.bskyPreferences.contentLabels(),
|
|
3604
|
-
queryFn: () => fetchBskyContentLabelPrefs(config),
|
|
3605
|
-
// Prefs change rarely; long stale time keeps the gate snappy on
|
|
3606
|
-
// navigation. Invalidation after a write is explicit.
|
|
3607
|
-
staleTime: 5 * 6e4,
|
|
3608
|
-
...options
|
|
3609
|
-
});
|
|
3610
|
-
}
|
|
3611
|
-
function useUpdateBskyContentLabelPrefs() {
|
|
3612
|
-
const config = useSifaConfig();
|
|
3613
|
-
const queryClient = useQueryClient();
|
|
3614
|
-
return useMutation({
|
|
3615
|
-
mutationFn: (body) => updateBskyContentLabelPrefs(config, body),
|
|
3616
|
-
onSuccess: (result) => {
|
|
3617
|
-
if (result.success && result.contentLabels) {
|
|
3618
|
-
queryClient.setQueryData(
|
|
3619
|
-
sifaQueryKeys.bskyPreferences.contentLabels(),
|
|
3620
|
-
result.contentLabels
|
|
3621
|
-
);
|
|
3622
|
-
} else {
|
|
3623
|
-
void queryClient.invalidateQueries({
|
|
3624
|
-
queryKey: sifaQueryKeys.bskyPreferences.all()
|
|
3625
|
-
});
|
|
3626
|
-
}
|
|
3627
|
-
}
|
|
3628
|
-
});
|
|
3629
|
-
}
|
|
3630
|
-
|
|
3631
|
-
// src/query/fetchers/org.ts
|
|
3632
|
-
function submitOrgClaim(config, body, options = {}) {
|
|
3633
|
-
return apiWrite(config, "/api/org/claim", "POST", { body, ...options });
|
|
3634
|
-
}
|
|
3635
|
-
function updateOrgProfile(config, body, options = {}) {
|
|
3636
|
-
return apiWrite(config, "/api/org/profile", "PUT", {
|
|
3637
|
-
body,
|
|
3638
|
-
...options
|
|
3639
|
-
});
|
|
3640
|
-
}
|
|
3641
|
-
function requestOrgDomainChallenge(config, body, options = {}) {
|
|
3642
|
-
return apiWrite(config, "/api/org/domains/challenge", "POST", {
|
|
3643
|
-
body,
|
|
3644
|
-
...options
|
|
3645
|
-
});
|
|
3646
|
-
}
|
|
3647
|
-
function verifyOrgDomain(config, body, options = {}) {
|
|
3648
|
-
return apiWrite(config, "/api/org/domains/verify", "POST", {
|
|
3649
|
-
body,
|
|
3650
|
-
...options
|
|
3651
|
-
});
|
|
3652
|
-
}
|
|
3653
|
-
function addOrgNotificationEmail(config, body, options = {}) {
|
|
3654
|
-
return apiWrite(
|
|
3655
|
-
config,
|
|
3656
|
-
"/api/org/notification-emails",
|
|
3657
|
-
"POST",
|
|
3658
|
-
{ body, ...options }
|
|
3659
|
-
);
|
|
3660
|
-
}
|
|
3661
|
-
function removeOrgNotificationEmail(config, body, options = {}) {
|
|
3662
|
-
return apiWrite(
|
|
3663
|
-
config,
|
|
3664
|
-
"/api/org/notification-emails",
|
|
3665
|
-
"DELETE",
|
|
3666
|
-
{ body, ...options }
|
|
3667
|
-
);
|
|
3668
|
-
}
|
|
3669
|
-
function useOrgProfile(handleOrDid, options) {
|
|
3670
|
-
const config = useSifaConfig();
|
|
3671
|
-
return useQuery({
|
|
3672
|
-
queryKey: sifaQueryKeys.profile.byHandle(handleOrDid ?? ""),
|
|
3673
|
-
queryFn: () => fetchProfile(config, handleOrDid ?? ""),
|
|
3674
|
-
enabled: Boolean(handleOrDid) && (options?.enabled ?? true),
|
|
3675
|
-
select: (profile) => profile?.org ?? null,
|
|
3676
|
-
...options
|
|
3677
|
-
});
|
|
3678
|
-
}
|
|
3679
|
-
function useOrgClaim(handleOrDid, options) {
|
|
3680
|
-
const config = useSifaConfig();
|
|
3681
|
-
const queryClient = useQueryClient();
|
|
3682
|
-
return useMutation({
|
|
3683
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3684
|
-
// handler below and silently drop cache invalidation (#453).
|
|
3685
|
-
...options,
|
|
3686
|
-
mutationFn: (body) => submitOrgClaim(config, body),
|
|
3687
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3688
|
-
if (result.success && handleOrDid) {
|
|
3689
|
-
await queryClient.invalidateQueries({
|
|
3690
|
-
queryKey: sifaQueryKeys.profile.byHandle(handleOrDid)
|
|
3691
|
-
});
|
|
3692
|
-
}
|
|
3693
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3694
|
-
}
|
|
3695
|
-
});
|
|
3696
|
-
}
|
|
3697
|
-
function useUpdateOrgProfile(handleOrDid, options) {
|
|
3698
|
-
const config = useSifaConfig();
|
|
3699
|
-
const queryClient = useQueryClient();
|
|
3700
|
-
return useMutation({
|
|
3701
|
-
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3702
|
-
// handler below and silently drop cache invalidation (#453).
|
|
3703
|
-
...options,
|
|
3704
|
-
mutationFn: (body) => updateOrgProfile(config, body),
|
|
3705
|
-
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3706
|
-
if (result.success && handleOrDid) {
|
|
3707
|
-
await queryClient.invalidateQueries({
|
|
3708
|
-
queryKey: sifaQueryKeys.profile.byHandle(handleOrDid)
|
|
3709
|
-
});
|
|
3710
|
-
}
|
|
3711
|
-
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3712
|
-
}
|
|
3713
|
-
});
|
|
3714
|
-
}
|
|
3715
|
-
function useOrgDomainChallenge(options) {
|
|
3716
|
-
const config = useSifaConfig();
|
|
3717
|
-
return useMutation({
|
|
3718
|
-
mutationFn: (body) => requestOrgDomainChallenge(config, body),
|
|
3719
|
-
...options
|
|
3720
|
-
});
|
|
3721
|
-
}
|
|
3722
|
-
function useOrgDomainVerify(options) {
|
|
3723
|
-
const config = useSifaConfig();
|
|
3724
|
-
return useMutation({
|
|
3725
|
-
mutationFn: (body) => verifyOrgDomain(config, body),
|
|
3726
|
-
...options
|
|
3727
|
-
});
|
|
3728
|
-
}
|
|
3729
|
-
function useAddOrgNotificationEmail(options) {
|
|
3730
|
-
const config = useSifaConfig();
|
|
3731
|
-
return useMutation({
|
|
3732
|
-
mutationFn: (body) => addOrgNotificationEmail(config, body),
|
|
3733
|
-
...options
|
|
3734
|
-
});
|
|
3735
|
-
}
|
|
3736
|
-
function useRemoveOrgNotificationEmail(options) {
|
|
3737
|
-
const config = useSifaConfig();
|
|
3738
|
-
return useMutation({
|
|
3739
|
-
mutationFn: (body) => removeOrgNotificationEmail(config, body),
|
|
3740
|
-
...options
|
|
3741
|
-
});
|
|
3742
|
-
}
|
|
3743
|
-
|
|
3744
|
-
export { ApiError, HIDDEN_ITEM_SOURCES, HIDDEN_ITEM_TYPES, PROFILE_COMPLETENESS_SIGNALS, QUOTED_POSTS_BATCH_MAX, RpgItemStatusSchema, RpgStatusResponseSchema, SifaProvider, addFeatureAllowlist, addOrgNotificationEmail, apiFetch, apiFetchOrNull, apiWrite, apiWriteCreate, bulkHideProfileItems, bulkHideStandardPublications, bulkUnhideProfileItems, bulkUnhideStandardPublications, castRoadmapVote, checkAppAccount, checkNetworkMapJobStatus, confirmEndorsement, createConfirmation, createEducation, createEndorsement, createExternalAccount, createPosition, createProfileLocation, createReaction, createRecord, createSkill, deleteAccount, deleteAvatarOverride, deleteEducation, deleteExternalAccount, deleteNamePronunciationAudio, deletePosition, deleteProfileLocation, deleteReaction, deleteRecord, deleteRepoRecords, deleteSkill, dismissConfirmation, dismissEndorsement, dismissUnlinkedPosition, effectiveContentVisibility, fetchAccounts, fetchActivityFeed, fetchActivityTeaser, fetchAppsRegistry, fetchAtFundLink, fetchBskyContentLabelPrefs, fetchEndorsementCount, fetchEntitySearch, fetchExternalAccounts, fetchFeaturedProfile, fetchFollowing, fetchFollowingFeed, fetchGetProfileView, fetchGivenConfirmations, fetchHeatmapData, fetchHiddenActivityItems, fetchHiddenApps, fetchInboxCounts, fetchMyGithubPullRequests, fetchMyRoadmapVotes, fetchNetworkMap, fetchNetworkStreamCount, fetchPendingConfirmations, fetchPendingEndorsements, fetchProfile, fetchProfileCompleteness, fetchProfileSummary, fetchReactionStatus, fetchReceivedEndorsements, fetchReciprocityCandidate, fetchRepoInventory, fetchResolveActor, fetchRoadmapVotes, fetchRpgStatus, fetchSearchFilters, fetchSearchProfiles, fetchSimilarProfiles, fetchSkillSuggestions, fetchSpeakers, fetchStats, fetchSuggestionCount, fetchSuggestions, fetchTalks, fetchTypeaheadActors, fetchUnlinkedPositions, fetchWipePreview, followUser, getAdminReviewQueues, getBlueskySuggestions, getFollowers, getFollowing, getMutuals, hideActivityItem, hideKeytraceClaim, hideOrcidPublication, hideProfileItem, hideSifaPublication, hideStandardPublication, importSearchEntities, initiateNetworkMapGeneration, isNetworkMapResponse, linkSkillToPosition, listFeatureAllowlist, mintEntityDomain, refreshOrcidPublications, refreshPds, removeFeatureAllowlist, removeOrgNotificationEmail, repoExportUrl, requestOrgDomainChallenge, resetProfile, resolveEntityDomain, resolveQuotedPosts, retractRoadmapVote, revealMarqueDomain, revokeConfirmation, searchSkills, selectEntity, setExternalAccountPrimary, setPositionPrimary, setSectionPrimary, shouldGateAdultMedia, sifaQueryKeys, submitOrgClaim, switchAccount, unfollowUser, unhideActivityItem, unhideKeytraceClaim, unhideOrcidPublication, unhideProfileItem, unhideSifaPublication, unhideStandardPublication, unlinkSkillFromPosition, unrevealMarqueDomain, unsetExternalAccountPrimary, unsetPositionPrimary, unsetSectionPrimary, updateBskyContentLabelPrefs, updateEducation, updateExternalAccount, updateOrgProfile, updatePosition, updateProfileLocation, updateProfileOverride, updateProfileSelf, updateRecord, updateSkill, updateSkillSubCategories, uploadAvatar, uploadNamePronunciationAudio, useAccounts, useActivityFeed, useActivityTeaser, useAddFeatureAllowlist, useAddOrgNotificationEmail, useAdminReviewQueues, useAppAccountCheck, useAppsRegistry, useAtFundLink, useBlueskySuggestions, useBskyContentLabelPrefs, useBulkHideProfileItems, useBulkHideStandardPublications, useBulkUnhideProfileItems, useBulkUnhideStandardPublications, useCanonicalSkillSearch, useCastRoadmapVote, useConfirmEndorsement, useCreateConfirmation, useCreateEducation, useCreateEndorsement, useCreateExternalAccount, useCreatePosition, useCreateProfileLocation, useCreateReaction, useCreateRecord, useCreateSkill, useDebouncedValue, useDeleteAccount, useDeleteAvatarOverride, useDeleteEducation, useDeleteExternalAccount, useDeleteNamePronunciationAudio, useDeletePosition, useDeleteProfileLocation, useDeleteReaction, useDeleteRecord, useDeleteRepoRecords, useDeleteSkill, useDismissConfirmation, useDismissEndorsement, useDismissUnlinkedPosition, useEndorsementCount, useEntitySearch, useExternalAccounts, useFeatureAllowlist, useFeaturedProfile, useFollow, useFollowers, useFollowing, useFollowingFeed, useFollowingList, useGetProfileView, useGivenConfirmations, useHeatmapData, useHiddenActivityItems, useHiddenApps, useHideActivityItem, useHideKeytraceClaim, useHideOrcidPublication, useHideProfileItem, useHideSifaPublication, useHideStandardPublication, useImportSearchEntities, useInboxCounts, useLinkSkillToPosition, useMintEntityDomain, useMutuals, useMyGithubPullRequests, useMyRoadmapVotes, useNetworkStreamCount, useOrgClaim, useOrgDomainChallenge, useOrgDomainVerify, useOrgProfile, usePendingConfirmations, usePendingEndorsements, useProfile, useProfileCompleteness, useReactionStatus, useReceivedEndorsements, useReciprocityCandidate, useRefreshOrcidPublications, useRefreshPds, useRemoveFeatureAllowlist, useRemoveOrgNotificationEmail, useRepoInventory, useResetProfile, useResolveEntityDomain, useRetractRoadmapVote, useRevealMarqueDomain, useRevokeConfirmation, useRoadmapVotes, useSearchFilters, useSearchProfiles, useSelectEntity, useSetExternalAccountPrimary, useSetPositionPrimary, useSetSectionPrimary, useSifaConfig, useSimilarProfiles, useSkillSuggestions, useStats, useSuggestionCount, useSuggestions, useUnfollow, useUnhideActivityItem, useUnhideKeytraceClaim, useUnhideOrcidPublication, useUnhideProfileItem, useUnhideSifaPublication, useUnhideStandardPublication, useUnlinkSkillFromPosition, useUnlinkedPositions, useUnrevealMarqueDomain, useUnsetExternalAccountPrimary, useUnsetPositionPrimary, useUnsetSectionPrimary, useUpdateBskyContentLabelPrefs, useUpdateEducation, useUpdateExternalAccount, useUpdateOrgProfile, useUpdatePosition, useUpdateProfileLocation, useUpdateProfileOverride, useUpdateProfileSelf, useUpdateRecord, useUpdateSkill, useUpdateSkillSubCategories, useUploadAvatar, useUploadNamePronunciationAudio, useVerifyExternalAccount, useWipePreview, verifyExternalAccount, verifyOrgDomain };
|
|
3745
|
-
//# sourceMappingURL=index.js.map
|
|
3746
687
|
//# sourceMappingURL=index.js.map
|