@singi-labs/sifa-sdk 0.19.44 → 0.19.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atproto/index.js +9 -3
- package/dist/atproto/index.js.map +1 -1
- package/dist/badge/index.cjs.map +1 -1
- package/dist/badge/index.js +5 -141
- package/dist/badge/index.js.map +1 -1
- package/dist/cards/adult-content.js +14 -0
- package/dist/cards/adult-content.js.map +1 -0
- package/dist/cards/app-url-patterns.js +369 -0
- package/dist/cards/app-url-patterns.js.map +1 -0
- package/dist/cards/index.js +24 -0
- package/dist/cards/index.js.map +1 -0
- package/dist/cards/resolve-card-url.js +198 -0
- package/dist/cards/resolve-card-url.js.map +1 -0
- package/dist/cards/visibility.js +45 -0
- package/dist/cards/visibility.js.map +1 -0
- package/dist/flags/index.js +4 -3
- package/dist/flags/index.js.map +1 -1
- package/dist/format/collapse-contributors.js +19 -0
- package/dist/format/collapse-contributors.js.map +1 -0
- package/dist/format/company-name.js +61 -0
- package/dist/format/company-name.js.map +1 -0
- package/dist/format/compare-text.js +9 -0
- package/dist/format/compare-text.js.map +1 -0
- package/dist/format/doi.js +8 -0
- package/dist/format/doi.js.map +1 -0
- package/dist/format/embed.js +131 -0
- package/dist/format/embed.js.map +1 -0
- package/dist/format/endorsement-context.js +35 -0
- package/dist/format/endorsement-context.js.map +1 -0
- package/dist/format/format-display-url.js +42 -0
- package/dist/format/format-display-url.js.map +1 -0
- package/dist/format/format-duration.js +13 -0
- package/dist/format/format-duration.js.map +1 -0
- package/dist/format/format-time.js +30 -0
- package/dist/format/format-time.js.map +1 -0
- package/dist/format/handle-utils.js +19 -0
- package/dist/format/handle-utils.js.map +1 -0
- package/dist/format/index.js +106 -0
- package/dist/format/index.js.map +1 -0
- package/dist/format/location-segments.js +29 -0
- package/dist/format/location-segments.js.map +1 -0
- package/dist/format/location-utils.js +42 -0
- package/dist/format/location-utils.js.map +1 -0
- package/dist/format/meta-description.js +35 -0
- package/dist/format/meta-description.js.map +1 -0
- package/dist/format/normalize-company-key.js +12 -0
- package/dist/format/normalize-company-key.js.map +1 -0
- package/dist/format/normalize-legal-form.js +71 -0
- package/dist/format/normalize-legal-form.js.map +1 -0
- package/dist/format/pds-utils.js +73 -0
- package/dist/format/pds-utils.js.map +1 -0
- package/dist/format/sort-by-date.js +39 -0
- package/dist/format/sort-by-date.js.map +1 -0
- package/dist/format/summarize-deliveries.js +37 -0
- package/dist/format/summarize-deliveries.js.map +1 -0
- package/dist/format/talk-slug.js +21 -0
- package/dist/format/talk-slug.js.map +1 -0
- package/dist/format/text-sanitize.js +29 -0
- package/dist/format/text-sanitize.js.map +1 -0
- package/dist/format/text-truncate.js +14 -0
- package/dist/format/text-truncate.js.map +1 -0
- package/dist/format/time-utils.js +19 -0
- package/dist/format/time-utils.js.map +1 -0
- package/dist/format/timeline.js +33 -0
- package/dist/format/timeline.js.map +1 -0
- package/dist/format/wcag-contrast.js +34 -0
- package/dist/format/wcag-contrast.js.map +1 -0
- package/dist/import/index.js +22 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/presentation-csv.js +116 -0
- package/dist/import/presentation-csv.js.map +1 -0
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +677 -7086
- package/dist/index.js.map +1 -1
- package/dist/jev/index.js +18 -5
- package/dist/jev/index.js.map +1 -1
- package/dist/jsonld/index.cjs.map +1 -1
- package/dist/jsonld/index.js +30 -987
- package/dist/jsonld/index.js.map +1 -1
- package/dist/jsonld/profile.js +222 -0
- package/dist/jsonld/profile.js.map +1 -0
- package/dist/jsonld/terms.js +496 -0
- package/dist/jsonld/terms.js.map +1 -0
- package/dist/jsonld/url.js +17 -0
- package/dist/jsonld/url.js.map +1 -0
- package/dist/jsonld/works-graph.js +41 -0
- package/dist/jsonld/works-graph.js.map +1 -0
- package/dist/jsonld/works.js +178 -0
- package/dist/jsonld/works.js.map +1 -0
- package/dist/logic/actor-identity.js +8 -0
- package/dist/logic/actor-identity.js.map +1 -0
- package/dist/logic/agent-ref.js +24 -0
- package/dist/logic/agent-ref.js.map +1 -0
- package/dist/logic/company-page-indexable.js +23 -0
- package/dist/logic/company-page-indexable.js.map +1 -0
- package/dist/logic/date-lookahead.js +33 -0
- package/dist/logic/date-lookahead.js.map +1 -0
- package/dist/logic/domain-detect.js +43 -0
- package/dist/logic/domain-detect.js.map +1 -0
- package/dist/logic/entity-disambiguation.js +24 -0
- package/dist/logic/entity-disambiguation.js.map +1 -0
- package/dist/logic/entity-ref-anchor.js +33 -0
- package/dist/logic/entity-ref-anchor.js.map +1 -0
- package/dist/logic/index.js +91 -0
- package/dist/logic/index.js.map +1 -0
- package/dist/logic/org-floor.js +66 -0
- package/dist/logic/org-floor.js.map +1 -0
- package/dist/logic/primary-item.js +9 -0
- package/dist/logic/primary-item.js.map +1 -0
- package/dist/logic/primary-position.js +16 -0
- package/dist/logic/primary-position.js.map +1 -0
- package/dist/logic/profile-completeness.js +21 -0
- package/dist/logic/profile-completeness.js.map +1 -0
- package/dist/logic/profile-dimensions.js +50 -0
- package/dist/logic/profile-dimensions.js.map +1 -0
- package/dist/logic/profile-summary.js +23 -0
- package/dist/logic/profile-summary.js.map +1 -0
- package/dist/logic/pseudo-employer.js +34 -0
- package/dist/logic/pseudo-employer.js.map +1 -0
- package/dist/logic/recent-activity.js +10 -0
- package/dist/logic/recent-activity.js.map +1 -0
- package/dist/logic/self-app.js +10 -0
- package/dist/logic/self-app.js.map +1 -0
- package/dist/{org-BCrvebcf.d.ts → org-CxTEjjrm.d.ts} +1 -1
- package/dist/{org-settings-C73Sin5E.d.ts → org-settings-BShvhyFp.d.ts} +1 -1
- package/dist/profile/headline-role-dedupe.js +12 -0
- package/dist/profile/headline-role-dedupe.js.map +1 -0
- package/dist/profile/highlights.js +200 -0
- package/dist/profile/highlights.js.map +1 -0
- package/dist/profile/index.js +66 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/involvement-grouping.js +31 -0
- package/dist/profile/involvement-grouping.js.map +1 -0
- package/dist/profile/language-sort.js +24 -0
- package/dist/profile/language-sort.js.map +1 -0
- package/dist/profile/publication-versions.js +98 -0
- package/dist/profile/publication-versions.js.map +1 -0
- package/dist/profile/range-sort.js +14 -0
- package/dist/profile/range-sort.js.map +1 -0
- package/dist/profile/section-model.js +122 -0
- package/dist/profile/section-model.js.map +1 -0
- package/dist/profile/section-sorts.js +33 -0
- package/dist/profile/section-sorts.js.map +1 -0
- package/dist/publishers/index.js +16 -0
- package/dist/publishers/index.js.map +1 -0
- package/dist/publishers/registry.js +87 -0
- package/dist/publishers/registry.js.map +1 -0
- package/dist/publishing/index.js +46 -184
- package/dist/publishing/index.js.map +1 -1
- package/dist/publishing/linkblog.js +42 -0
- package/dist/publishing/linkblog.js.map +1 -0
- package/dist/publishing/registry.js +32 -0
- package/dist/publishing/registry.js.map +1 -0
- package/dist/publishing/schemas.js +74 -0
- package/dist/publishing/schemas.js.map +1 -0
- package/dist/publishing/types.js +32 -0
- package/dist/publishing/types.js.map +1 -0
- package/dist/query/client.js +119 -0
- package/dist/query/client.js.map +1 -0
- package/dist/query/config.js +23 -0
- package/dist/query/config.js.map +1 -0
- package/dist/query/fetchers/accounts.js +29 -0
- package/dist/query/fetchers/accounts.js.map +1 -0
- package/dist/query/fetchers/activity-items-hide.js +31 -0
- package/dist/query/fetchers/activity-items-hide.js.map +1 -0
- package/dist/query/fetchers/activity.js +61 -0
- package/dist/query/fetchers/activity.js.map +1 -0
- package/dist/query/fetchers/actor.js +30 -0
- package/dist/query/fetchers/actor.js.map +1 -0
- package/dist/query/fetchers/admin-feature-allowlists.js +41 -0
- package/dist/query/fetchers/admin-feature-allowlists.js.map +1 -0
- package/dist/query/fetchers/admin-review-queues.js +30 -0
- package/dist/query/fetchers/admin-review-queues.js.map +1 -0
- package/dist/query/fetchers/apps.js +31 -0
- package/dist/query/fetchers/apps.js.map +1 -0
- package/dist/query/fetchers/bsky-preferences.js +55 -0
- package/dist/query/fetchers/bsky-preferences.js.map +1 -0
- package/dist/query/fetchers/confirmations.js +55 -0
- package/dist/query/fetchers/confirmations.js.map +1 -0
- package/dist/query/fetchers/destructive.js +34 -0
- package/dist/query/fetchers/destructive.js.map +1 -0
- package/dist/query/fetchers/discovery.js +67 -0
- package/dist/query/fetchers/discovery.js.map +1 -0
- package/dist/query/fetchers/education.js +23 -0
- package/dist/query/fetchers/education.js.map +1 -0
- package/dist/query/fetchers/endorsement-inbox.js +36 -0
- package/dist/query/fetchers/endorsement-inbox.js.map +1 -0
- package/dist/query/fetchers/endorsement.js +23 -0
- package/dist/query/fetchers/endorsement.js.map +1 -0
- package/dist/query/fetchers/endorsements.js +20 -0
- package/dist/query/fetchers/endorsements.js.map +1 -0
- package/dist/query/fetchers/entities.js +65 -0
- package/dist/query/fetchers/entities.js.map +1 -0
- package/dist/query/fetchers/external-accounts.js +74 -0
- package/dist/query/fetchers/external-accounts.js.map +1 -0
- package/dist/query/fetchers/follow-extras.js +38 -0
- package/dist/query/fetchers/follow-extras.js.map +1 -0
- package/dist/query/fetchers/follow.js +105 -0
- package/dist/query/fetchers/follow.js.map +1 -0
- package/dist/query/fetchers/get-profile-view.js +21 -0
- package/dist/query/fetchers/get-profile-view.js.map +1 -0
- package/dist/query/fetchers/github-prs.js +45 -0
- package/dist/query/fetchers/github-prs.js.map +1 -0
- package/dist/query/fetchers/inbox.js +29 -0
- package/dist/query/fetchers/inbox.js.map +1 -0
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.ts +2 -2
- package/dist/query/fetchers/index.js +360 -2045
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/fetchers/investments.js +18 -0
- package/dist/query/fetchers/investments.js.map +1 -0
- package/dist/query/fetchers/keytrace-claims.js +23 -0
- package/dist/query/fetchers/keytrace-claims.js.map +1 -0
- package/dist/query/fetchers/marque-domains.js +23 -0
- package/dist/query/fetchers/marque-domains.js.map +1 -0
- package/dist/query/fetchers/network-map.js +36 -0
- package/dist/query/fetchers/network-map.js.map +1 -0
- package/dist/query/fetchers/org.js +48 -0
- package/dist/query/fetchers/org.js.map +1 -0
- package/dist/query/fetchers/positions.js +77 -0
- package/dist/query/fetchers/positions.js.map +1 -0
- package/dist/query/fetchers/profile-completeness.js +45 -0
- package/dist/query/fetchers/profile-completeness.js.map +1 -0
- package/dist/query/fetchers/profile-items-hide.js +36 -0
- package/dist/query/fetchers/profile-items-hide.js.map +1 -0
- package/dist/query/fetchers/profile-locations.js +23 -0
- package/dist/query/fetchers/profile-locations.js.map +1 -0
- package/dist/query/fetchers/profile-mutations.js +82 -0
- package/dist/query/fetchers/profile-mutations.js.map +1 -0
- package/dist/query/fetchers/profile-summary.js +14 -0
- package/dist/query/fetchers/profile-summary.js.map +1 -0
- package/dist/query/fetchers/profile.js +31 -0
- package/dist/query/fetchers/profile.js.map +1 -0
- package/dist/query/fetchers/publications.js +66 -0
- package/dist/query/fetchers/publications.js.map +1 -0
- package/dist/query/fetchers/quoted-posts.js +40 -0
- package/dist/query/fetchers/quoted-posts.js.map +1 -0
- package/dist/query/fetchers/reactions.js +85 -0
- package/dist/query/fetchers/reactions.js.map +1 -0
- package/dist/query/fetchers/received-endorsements.js +20 -0
- package/dist/query/fetchers/received-endorsements.js.map +1 -0
- package/dist/query/fetchers/reciprocity.js +23 -0
- package/dist/query/fetchers/reciprocity.js.map +1 -0
- package/dist/query/fetchers/records.js +27 -0
- package/dist/query/fetchers/records.js.map +1 -0
- package/dist/query/fetchers/repo-inventory.js +23 -0
- package/dist/query/fetchers/repo-inventory.js.map +1 -0
- package/dist/query/fetchers/roadmap.js +73 -0
- package/dist/query/fetchers/roadmap.js.map +1 -0
- package/dist/query/fetchers/rpg.js +36 -0
- package/dist/query/fetchers/rpg.js.map +1 -0
- package/dist/query/fetchers/search.js +78 -0
- package/dist/query/fetchers/search.js.map +1 -0
- package/dist/query/fetchers/section-primary.js +23 -0
- package/dist/query/fetchers/section-primary.js.map +1 -0
- package/dist/query/fetchers/skills.js +30 -0
- package/dist/query/fetchers/skills.js.map +1 -0
- package/dist/query/fetchers/speakers.js +42 -0
- package/dist/query/fetchers/speakers.js.map +1 -0
- package/dist/query/fetchers/stats.js +16 -0
- package/dist/query/fetchers/stats.js.map +1 -0
- package/dist/query/fetchers/stream.js +30 -0
- package/dist/query/fetchers/stream.js.map +1 -0
- package/dist/query/fetchers/unlinked-positions.js +30 -0
- package/dist/query/fetchers/unlinked-positions.js.map +1 -0
- package/dist/query/hooks/index.d.ts +3 -3
- package/dist/query/hooks/index.js +283 -3555
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/hooks/use-accounts.js +19 -0
- package/dist/query/hooks/use-accounts.js.map +1 -0
- package/dist/query/hooks/use-activity-items-hide.js +52 -0
- package/dist/query/hooks/use-activity-items-hide.js.map +1 -0
- package/dist/query/hooks/use-activity.js +44 -0
- package/dist/query/hooks/use-activity.js.map +1 -0
- package/dist/query/hooks/use-admin-review-queues.js +21 -0
- package/dist/query/hooks/use-admin-review-queues.js.map +1 -0
- package/dist/query/hooks/use-apps.js +31 -0
- package/dist/query/hooks/use-apps.js.map +1 -0
- package/dist/query/hooks/use-bsky-content-prefs.js +45 -0
- package/dist/query/hooks/use-bsky-content-prefs.js.map +1 -0
- package/dist/query/hooks/use-confirmations.js +121 -0
- package/dist/query/hooks/use-confirmations.js.map +1 -0
- package/dist/query/hooks/use-create-position.js +28 -0
- package/dist/query/hooks/use-create-position.js.map +1 -0
- package/dist/query/hooks/use-destructive.js +63 -0
- package/dist/query/hooks/use-destructive.js.map +1 -0
- package/dist/query/hooks/use-discovery.js +53 -0
- package/dist/query/hooks/use-discovery.js.map +1 -0
- package/dist/query/hooks/use-education-mutations.js +67 -0
- package/dist/query/hooks/use-education-mutations.js.map +1 -0
- package/dist/query/hooks/use-endorsement-inbox.js +80 -0
- package/dist/query/hooks/use-endorsement-inbox.js.map +1 -0
- package/dist/query/hooks/use-endorsement-mutations.js +33 -0
- package/dist/query/hooks/use-endorsement-mutations.js.map +1 -0
- package/dist/query/hooks/use-endorsement.js +20 -0
- package/dist/query/hooks/use-endorsement.js.map +1 -0
- package/dist/query/hooks/use-entity-search.js +73 -0
- package/dist/query/hooks/use-entity-search.js.map +1 -0
- package/dist/query/hooks/use-external-accounts.js +143 -0
- package/dist/query/hooks/use-external-accounts.js.map +1 -0
- package/dist/query/hooks/use-feature-allowlist.js +104 -0
- package/dist/query/hooks/use-feature-allowlist.js.map +1 -0
- package/dist/query/hooks/use-follow-extras.js +38 -0
- package/dist/query/hooks/use-follow-extras.js.map +1 -0
- package/dist/query/hooks/use-follow.js +113 -0
- package/dist/query/hooks/use-follow.js.map +1 -0
- package/dist/query/hooks/use-get-profile-view.js +20 -0
- package/dist/query/hooks/use-get-profile-view.js.map +1 -0
- package/dist/query/hooks/use-github-prs.js +21 -0
- package/dist/query/hooks/use-github-prs.js.map +1 -0
- package/dist/query/hooks/use-inbox.js +19 -0
- package/dist/query/hooks/use-inbox.js.map +1 -0
- package/dist/query/hooks/use-investment-mutations.js +65 -0
- package/dist/query/hooks/use-investment-mutations.js.map +1 -0
- package/dist/query/hooks/use-keytrace-claims.js +50 -0
- package/dist/query/hooks/use-keytrace-claims.js.map +1 -0
- package/dist/query/hooks/use-location-mutations.js +71 -0
- package/dist/query/hooks/use-location-mutations.js.map +1 -0
- package/dist/query/hooks/use-marque-domains.js +50 -0
- package/dist/query/hooks/use-marque-domains.js.map +1 -0
- package/dist/query/hooks/use-org-claim.js +29 -0
- package/dist/query/hooks/use-org-claim.js.map +1 -0
- package/dist/query/hooks/use-org-domains.js +28 -0
- package/dist/query/hooks/use-org-domains.js.map +1 -0
- package/dist/query/hooks/use-org-notification-emails.js +28 -0
- package/dist/query/hooks/use-org-notification-emails.js.map +1 -0
- package/dist/query/hooks/use-org-profile-settings.js +29 -0
- package/dist/query/hooks/use-org-profile-settings.js.map +1 -0
- package/dist/query/hooks/use-org-profile.js +21 -0
- package/dist/query/hooks/use-org-profile.js.map +1 -0
- package/dist/query/hooks/use-position-mutations.js +128 -0
- package/dist/query/hooks/use-position-mutations.js.map +1 -0
- package/dist/query/hooks/use-profile-completeness.js +21 -0
- package/dist/query/hooks/use-profile-completeness.js.map +1 -0
- package/dist/query/hooks/use-profile-items-hide.js +53 -0
- package/dist/query/hooks/use-profile-items-hide.js.map +1 -0
- package/dist/query/hooks/use-profile-mutations.js +143 -0
- package/dist/query/hooks/use-profile-mutations.js.map +1 -0
- package/dist/query/hooks/use-profile.js +30 -0
- package/dist/query/hooks/use-profile.js.map +1 -0
- package/dist/query/hooks/use-publication-mutations.js +90 -0
- package/dist/query/hooks/use-publication-mutations.js.map +1 -0
- package/dist/query/hooks/use-reaction-mutations.js +48 -0
- package/dist/query/hooks/use-reaction-mutations.js.map +1 -0
- package/dist/query/hooks/use-reactions.js +32 -0
- package/dist/query/hooks/use-reactions.js.map +1 -0
- package/dist/query/hooks/use-received-endorsements.js +23 -0
- package/dist/query/hooks/use-received-endorsements.js.map +1 -0
- package/dist/query/hooks/use-reciprocity.js +19 -0
- package/dist/query/hooks/use-reciprocity.js.map +1 -0
- package/dist/query/hooks/use-record-mutations.js +67 -0
- package/dist/query/hooks/use-record-mutations.js.map +1 -0
- package/dist/query/hooks/use-repo-inventory.js +43 -0
- package/dist/query/hooks/use-repo-inventory.js.map +1 -0
- package/dist/query/hooks/use-roadmap-mutations.js +51 -0
- package/dist/query/hooks/use-roadmap-mutations.js.map +1 -0
- package/dist/query/hooks/use-roadmap.js +31 -0
- package/dist/query/hooks/use-roadmap.js.map +1 -0
- package/dist/query/hooks/use-search.js +63 -0
- package/dist/query/hooks/use-search.js.map +1 -0
- package/dist/query/hooks/use-section-primary-mutations.js +53 -0
- package/dist/query/hooks/use-section-primary-mutations.js.map +1 -0
- package/dist/query/hooks/use-skill-mutations.js +91 -0
- package/dist/query/hooks/use-skill-mutations.js.map +1 -0
- package/dist/query/hooks/use-stats.js +19 -0
- package/dist/query/hooks/use-stats.js.map +1 -0
- package/dist/query/hooks/use-stream.js +20 -0
- package/dist/query/hooks/use-stream.js.map +1 -0
- package/dist/query/hooks/use-unlinked-positions.js +45 -0
- package/dist/query/hooks/use-unlinked-positions.js.map +1 -0
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.ts +4 -4
- package/dist/query/index.js +685 -3744
- package/dist/query/index.js.map +1 -1
- package/dist/query/keys.js +138 -0
- package/dist/query/keys.js.map +1 -0
- package/dist/repo/groups.js +81 -0
- package/dist/repo/groups.js.map +1 -0
- package/dist/repo/index.js +9 -0
- package/dist/repo/index.js.map +1 -0
- package/dist/repo/labels.js +121 -0
- package/dist/repo/labels.js.map +1 -0
- package/dist/repo/types.js +1 -0
- package/dist/repo/types.js.map +1 -0
- package/dist/resume/index.js +5 -179
- package/dist/resume/index.js.map +1 -1
- package/dist/resume/json-resume.js +153 -0
- package/dist/resume/json-resume.js.map +1 -0
- package/dist/roadmap/index.js +101 -0
- package/dist/roadmap/index.js.map +1 -0
- package/dist/rpg/catalog.js +101 -0
- package/dist/rpg/catalog.js.map +1 -0
- package/dist/rpg/index.js +13 -116
- package/dist/rpg/index.js.map +1 -1
- package/dist/rpg/unlocks.js +21 -0
- package/dist/rpg/unlocks.js.map +1 -0
- package/dist/schemas/blob-ref.js +12 -0
- package/dist/schemas/blob-ref.js.map +1 -0
- package/dist/schemas/confirmation.js +23 -0
- package/dist/schemas/confirmation.js.map +1 -0
- package/dist/schemas/endorsement-confirmation.js +18 -0
- package/dist/schemas/endorsement-confirmation.js.map +1 -0
- package/dist/schemas/endorsement.js +19 -0
- package/dist/schemas/endorsement.js.map +1 -0
- package/dist/schemas/entity.js +74 -0
- package/dist/schemas/entity.js.map +1 -0
- package/dist/schemas/feed.js +73 -0
- package/dist/schemas/feed.js.map +1 -0
- package/dist/schemas/follow-profile.js +32 -0
- package/dist/schemas/follow-profile.js.map +1 -0
- package/dist/schemas/graph-follow.js +19 -0
- package/dist/schemas/graph-follow.js.map +1 -0
- package/dist/schemas/index.js +164 -629
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/org-employment-attestation.js +28 -0
- package/dist/schemas/org-employment-attestation.js.map +1 -0
- package/dist/schemas/org-profile.js +64 -0
- package/dist/schemas/org-profile.js.map +1 -0
- package/dist/schemas/profile-certification.js +28 -0
- package/dist/schemas/profile-certification.js.map +1 -0
- package/dist/schemas/profile-course.js +32 -0
- package/dist/schemas/profile-course.js.map +1 -0
- package/dist/schemas/profile-education.js +33 -0
- package/dist/schemas/profile-education.js.map +1 -0
- package/dist/schemas/profile-external-account.js +15 -0
- package/dist/schemas/profile-external-account.js.map +1 -0
- package/dist/schemas/profile-honor.js +18 -0
- package/dist/schemas/profile-honor.js.map +1 -0
- package/dist/schemas/profile-investment.js +48 -0
- package/dist/schemas/profile-investment.js.map +1 -0
- package/dist/schemas/profile-involvement.js +47 -0
- package/dist/schemas/profile-involvement.js.map +1 -0
- package/dist/schemas/profile-language.js +12 -0
- package/dist/schemas/profile-language.js.map +1 -0
- package/dist/schemas/profile-position.js +42 -0
- package/dist/schemas/profile-position.js.map +1 -0
- package/dist/schemas/profile-presentation-delivery.js +38 -0
- package/dist/schemas/profile-presentation-delivery.js.map +1 -0
- package/dist/schemas/profile-presentation.js +36 -0
- package/dist/schemas/profile-presentation.js.map +1 -0
- package/dist/schemas/profile-project.js +48 -0
- package/dist/schemas/profile-project.js.map +1 -0
- package/dist/schemas/profile-publication.js +30 -0
- package/dist/schemas/profile-publication.js.map +1 -0
- package/dist/schemas/profile-self.js +22 -0
- package/dist/schemas/profile-self.js.map +1 -0
- package/dist/schemas/profile-skill.js +13 -0
- package/dist/schemas/profile-skill.js.map +1 -0
- package/dist/schemas/profile-volunteering.js +20 -0
- package/dist/schemas/profile-volunteering.js.map +1 -0
- package/dist/schemas/shared.js +56 -0
- package/dist/schemas/shared.js.map +1 -0
- package/dist/schemas/write/certification.js +16 -0
- package/dist/schemas/write/certification.js.map +1 -0
- package/dist/schemas/write/course.js +36 -0
- package/dist/schemas/write/course.js.map +1 -0
- package/dist/schemas/write/education.js +18 -0
- package/dist/schemas/write/education.js.map +1 -0
- package/dist/schemas/write/external-account.js +13 -0
- package/dist/schemas/write/external-account.js.map +1 -0
- package/dist/schemas/write/honor.js +14 -0
- package/dist/schemas/write/honor.js.map +1 -0
- package/dist/schemas/write/index.d.ts +1 -1
- package/dist/schemas/write/index.js +89 -593
- package/dist/schemas/write/index.js.map +1 -1
- package/dist/schemas/write/investment.js +32 -0
- package/dist/schemas/write/investment.js.map +1 -0
- package/dist/schemas/write/involvement.js +34 -0
- package/dist/schemas/write/involvement.js.map +1 -0
- package/dist/schemas/write/language.js +10 -0
- package/dist/schemas/write/language.js.map +1 -0
- package/dist/schemas/write/org-claim.js +56 -0
- package/dist/schemas/write/org-claim.js.map +1 -0
- package/dist/schemas/write/org-employment-attestation.js +19 -0
- package/dist/schemas/write/org-employment-attestation.js.map +1 -0
- package/dist/schemas/write/org-profile.js +54 -0
- package/dist/schemas/write/org-profile.js.map +1 -0
- package/dist/schemas/write/org-settings.js +81 -0
- package/dist/schemas/write/org-settings.js.map +1 -0
- package/dist/schemas/write/position.js +24 -0
- package/dist/schemas/write/position.js.map +1 -0
- package/dist/schemas/write/presentation-delivery.js +34 -0
- package/dist/schemas/write/presentation-delivery.js.map +1 -0
- package/dist/schemas/write/presentation.js +23 -0
- package/dist/schemas/write/presentation.js.map +1 -0
- package/dist/schemas/write/profile-location.js +21 -0
- package/dist/schemas/write/profile-location.js.map +1 -0
- package/dist/schemas/write/profile-self.js +27 -0
- package/dist/schemas/write/profile-self.js.map +1 -0
- package/dist/schemas/write/project.js +27 -0
- package/dist/schemas/write/project.js.map +1 -0
- package/dist/schemas/write/publication.js +41 -0
- package/dist/schemas/write/publication.js.map +1 -0
- package/dist/schemas/write/shared.js +96 -0
- package/dist/schemas/write/shared.js.map +1 -0
- package/dist/schemas/write/skill.js +18 -0
- package/dist/schemas/write/skill.js.map +1 -0
- package/dist/schemas/write/volunteering.js +16 -0
- package/dist/schemas/write/volunteering.js.map +1 -0
- package/dist/stream/activity-item.js +1 -0
- package/dist/stream/activity-item.js.map +1 -0
- package/dist/stream/index.js +49 -0
- package/dist/stream/index.js.map +1 -0
- package/dist/stream/stream-card-vm-schema.js +265 -0
- package/dist/stream/stream-card-vm-schema.js.map +1 -0
- package/dist/stream/stream-card-vm.js +1 -0
- package/dist/stream/stream-card-vm.js.map +1 -0
- package/dist/stream/to-stream-card-vm.js +793 -0
- package/dist/stream/to-stream-card-vm.js.map +1 -0
- package/dist/stream/two-tier.js +30 -0
- package/dist/stream/two-tier.js.map +1 -0
- package/dist/stream/verbs.js +120 -0
- package/dist/stream/verbs.js.map +1 -0
- package/dist/taxonomy/activity-tiers.js +956 -0
- package/dist/taxonomy/activity-tiers.js.map +1 -0
- package/dist/taxonomy/app-categories.js +42 -0
- package/dist/taxonomy/app-categories.js.map +1 -0
- package/dist/taxonomy/app-category-map.js +166 -0
- package/dist/taxonomy/app-category-map.js.map +1 -0
- package/dist/taxonomy/artifact-link-kind.js +29 -0
- package/dist/taxonomy/artifact-link-kind.js.map +1 -0
- package/dist/taxonomy/calendar-event.js +28 -0
- package/dist/taxonomy/calendar-event.js.map +1 -0
- package/dist/taxonomy/continents.js +215 -0
- package/dist/taxonomy/continents.js.map +1 -0
- package/dist/taxonomy/countries.js +203 -0
- package/dist/taxonomy/countries.js.map +1 -0
- package/dist/taxonomy/course-role.js +37 -0
- package/dist/taxonomy/course-role.js.map +1 -0
- package/dist/taxonomy/employment-type.js +82 -0
- package/dist/taxonomy/employment-type.js.map +1 -0
- package/dist/taxonomy/eqf-level.js +59 -0
- package/dist/taxonomy/eqf-level.js.map +1 -0
- package/dist/taxonomy/index.js +263 -0
- package/dist/taxonomy/index.js.map +1 -0
- package/dist/taxonomy/industry-taxonomy.js +281 -0
- package/dist/taxonomy/industry-taxonomy.js.map +1 -0
- package/dist/taxonomy/investment.js +54 -0
- package/dist/taxonomy/investment.js.map +1 -0
- package/dist/taxonomy/involvement-kind.js +30 -0
- package/dist/taxonomy/involvement-kind.js.map +1 -0
- package/dist/taxonomy/open-to.js +128 -0
- package/dist/taxonomy/open-to.js.map +1 -0
- package/dist/taxonomy/platforms.js +56 -0
- package/dist/taxonomy/platforms.js.map +1 -0
- package/dist/taxonomy/presentation-link-type.js +22 -0
- package/dist/taxonomy/presentation-link-type.js.map +1 -0
- package/dist/taxonomy/presentation-role.js +21 -0
- package/dist/taxonomy/presentation-role.js.map +1 -0
- package/dist/taxonomy/publication-type.js +54 -0
- package/dist/taxonomy/publication-type.js.map +1 -0
- package/dist/taxonomy/relational.js +25 -0
- package/dist/taxonomy/relational.js.map +1 -0
- package/dist/taxonomy/search-filter-defs.js +66 -0
- package/dist/taxonomy/search-filter-defs.js.map +1 -0
- package/dist/taxonomy/skill-categories.js +28 -0
- package/dist/taxonomy/skill-categories.js.map +1 -0
- package/dist/taxonomy/skill-display-groups.js +12 -0
- package/dist/taxonomy/skill-display-groups.js.map +1 -0
- package/dist/taxonomy/skill-grouping.js +90 -0
- package/dist/taxonomy/skill-grouping.js.map +1 -0
- package/dist/taxonomy/verification-providers.js +69 -0
- package/dist/taxonomy/verification-providers.js.map +1 -0
- package/dist/taxonomy/workplace-type.js +38 -0
- package/dist/taxonomy/workplace-type.js.map +1 -0
- package/dist/tokens/colors.js +11 -0
- package/dist/tokens/colors.js.map +1 -0
- package/dist/tokens/icons.js +15 -0
- package/dist/tokens/icons.js.map +1 -0
- package/dist/tokens/index.js +10 -39
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/typography.js +23 -0
- package/dist/tokens/typography.js.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/profile-view.js +1 -0
- package/dist/types/profile-view.js.map +1 -0
- package/dist/{use-org-notification-emails-0hjt-dEw.d.ts → use-org-notification-emails-CWWi1D8t.d.ts} +2 -2
- package/package.json +4 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// src/query/fetchers/publications.ts
|
|
2
|
+
import { apiWrite } from "../client.js";
|
|
3
|
+
function hideOrcidPublication(config, putCode, options = {}) {
|
|
4
|
+
return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, "POST", options);
|
|
5
|
+
}
|
|
6
|
+
function unhideOrcidPublication(config, putCode, options = {}) {
|
|
7
|
+
return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, "DELETE", options);
|
|
8
|
+
}
|
|
9
|
+
function hideStandardPublication(config, uri, options = {}) {
|
|
10
|
+
return apiWrite(
|
|
11
|
+
config,
|
|
12
|
+
`/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,
|
|
13
|
+
"POST",
|
|
14
|
+
options
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function unhideStandardPublication(config, uri, options = {}) {
|
|
18
|
+
return apiWrite(
|
|
19
|
+
config,
|
|
20
|
+
`/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,
|
|
21
|
+
"DELETE",
|
|
22
|
+
options
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function bulkHideStandardPublications(config, uris, options = {}) {
|
|
26
|
+
return apiWrite(config, "/api/profile/standard-publications/bulk-hide", "POST", {
|
|
27
|
+
body: { uris },
|
|
28
|
+
...options
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function bulkUnhideStandardPublications(config, uris, options = {}) {
|
|
32
|
+
return apiWrite(config, "/api/profile/standard-publications/bulk-hide", "DELETE", {
|
|
33
|
+
body: { uris },
|
|
34
|
+
...options
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function hideSifaPublication(config, rkey, options = {}) {
|
|
38
|
+
return apiWrite(config, `/api/profile/publications/${rkey}/hide`, "POST", options);
|
|
39
|
+
}
|
|
40
|
+
function unhideSifaPublication(config, rkey, options = {}) {
|
|
41
|
+
return apiWrite(config, `/api/profile/publications/${rkey}/hide`, "DELETE", options);
|
|
42
|
+
}
|
|
43
|
+
async function refreshOrcidPublications(config, options = {}) {
|
|
44
|
+
const result = await apiWrite(
|
|
45
|
+
config,
|
|
46
|
+
"/api/profile/orcid-publications/refresh",
|
|
47
|
+
"POST",
|
|
48
|
+
{ body: {}, ...options }
|
|
49
|
+
);
|
|
50
|
+
if (result.success && result.error) {
|
|
51
|
+
return { success: false, error: result.error };
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
bulkHideStandardPublications,
|
|
57
|
+
bulkUnhideStandardPublications,
|
|
58
|
+
hideOrcidPublication,
|
|
59
|
+
hideSifaPublication,
|
|
60
|
+
hideStandardPublication,
|
|
61
|
+
refreshOrcidPublications,
|
|
62
|
+
unhideOrcidPublication,
|
|
63
|
+
unhideSifaPublication,
|
|
64
|
+
unhideStandardPublication
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=publications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/publications.ts"],"sourcesContent":["import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/** Extended result for {@link refreshOrcidPublications}. */\nexport interface RefreshOrcidPublicationsResult extends WriteResult {\n added?: number;\n removed?: number;\n}\n\n/**\n * Hide an ORCID-imported publication from the user's profile. The\n * `putCode` is the ORCID-side identifier; the underlying record stays\n * in the index, only its display is suppressed.\n */\nexport function hideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden ORCID publication. */\nexport function unhideOrcidPublication(\n config: SifaApiConfig,\n putCode: number,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/orcid-publications/${putCode}/hide`, 'DELETE', options);\n}\n\n/** Hide a standard (auto-imported) publication by its AT URI. */\nexport function hideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'POST',\n options,\n );\n}\n\n/** Restore a previously-hidden standard publication. */\nexport function unhideStandardPublication(\n config: SifaApiConfig,\n uri: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/standard-publications/${encodeURIComponent(uri)}/hide`,\n 'DELETE',\n options,\n );\n}\n\n/** Bulk-hide standard publications by AT URI list. */\nexport function bulkHideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'POST', {\n body: { uris },\n ...options,\n });\n}\n\n/** Bulk-unhide standard publications by AT URI list. */\nexport function bulkUnhideStandardPublications(\n config: SifaApiConfig,\n uris: string[],\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/profile/standard-publications/bulk-hide', 'DELETE', {\n body: { uris },\n ...options,\n });\n}\n\n/** Hide an `id.sifa.profile.publication` (user-authored publication record). */\nexport function hideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'POST', options);\n}\n\n/** Restore a previously-hidden Sifa publication. */\nexport function unhideSifaPublication(\n config: SifaApiConfig,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/profile/publications/${rkey}/hide`, 'DELETE', options);\n}\n\n/**\n * Re-pull the authenticated user's ORCID publications. Returns counts\n * of added and removed records. The server returns `{ error: '...' }`\n * inline (not via HTTP status) on quota / linkage failures; the SDK\n * folds that into `{ success: false, error }` to keep the contract\n * consistent with other mutations.\n */\nexport async function refreshOrcidPublications(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RefreshOrcidPublicationsResult> {\n const result = await apiWrite<{ added?: number; removed?: number; error?: string }>(\n config,\n '/api/profile/orcid-publications/refresh',\n 'POST',\n { body: {}, ...options },\n );\n if (result.success && result.error) {\n return { success: false, error: result.error };\n }\n return result;\n}\n"],"mappings":";AAAA,SAAS,gBAA4E;AAa9E,SAAS,qBACd,QACA,SACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,mCAAmC,OAAO,SAAS,QAAQ,OAAO;AAC5F;AAGO,SAAS,uBACd,QACA,SACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,mCAAmC,OAAO,SAAS,UAAU,OAAO;AAC9F;AAGO,SAAS,wBACd,QACA,KACA,UAA2B,CAAC,GACN;AACtB,SAAO;AAAA,IACL;AAAA,IACA,sCAAsC,mBAAmB,GAAG,CAAC;AAAA,IAC7D;AAAA,IACA;AAAA,EACF;AACF;AAGO,SAAS,0BACd,QACA,KACA,UAA2B,CAAC,GACN;AACtB,SAAO;AAAA,IACL;AAAA,IACA,sCAAsC,mBAAmB,GAAG,CAAC;AAAA,IAC7D;AAAA,IACA;AAAA,EACF;AACF;AAGO,SAAS,6BACd,QACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,gDAAgD,QAAQ;AAAA,IAC9E,MAAM,EAAE,KAAK;AAAA,IACb,GAAG;AAAA,EACL,CAAC;AACH;AAGO,SAAS,+BACd,QACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,gDAAgD,UAAU;AAAA,IAChF,MAAM,EAAE,KAAK;AAAA,IACb,GAAG;AAAA,EACL,CAAC;AACH;AAGO,SAAS,oBACd,QACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,6BAA6B,IAAI,SAAS,QAAQ,OAAO;AACnF;AAGO,SAAS,sBACd,QACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,6BAA6B,IAAI,SAAS,UAAU,OAAO;AACrF;AASA,eAAsB,yBACpB,QACA,UAA2B,CAAC,GACa;AACzC,QAAM,SAAS,MAAM;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA,EAAE,MAAM,CAAC,GAAG,GAAG,QAAQ;AAAA,EACzB;AACA,MAAI,OAAO,WAAW,OAAO,OAAO;AAClC,WAAO,EAAE,SAAS,OAAO,OAAO,OAAO,MAAM;AAAA,EAC/C;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/query/fetchers/quoted-posts.ts
|
|
2
|
+
import { apiFetch } from "../client.js";
|
|
3
|
+
var QUOTED_POSTS_BATCH_MAX = 20;
|
|
4
|
+
async function resolveQuotedPosts(config, uris, options = {}) {
|
|
5
|
+
if (uris.length === 0) return {};
|
|
6
|
+
const unique = [...new Set(uris)];
|
|
7
|
+
const batches = [];
|
|
8
|
+
for (let i = 0; i < unique.length; i += QUOTED_POSTS_BATCH_MAX) {
|
|
9
|
+
batches.push(unique.slice(i, i + QUOTED_POSTS_BATCH_MAX));
|
|
10
|
+
}
|
|
11
|
+
const headers = { ...options.headers ?? {} };
|
|
12
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
13
|
+
const results = {};
|
|
14
|
+
await Promise.all(
|
|
15
|
+
batches.map(async (batch) => {
|
|
16
|
+
try {
|
|
17
|
+
const data = await apiFetch(
|
|
18
|
+
config,
|
|
19
|
+
"/api/quoted-posts/resolve",
|
|
20
|
+
{
|
|
21
|
+
method: "POST",
|
|
22
|
+
body: { uris: batch },
|
|
23
|
+
credentials: "include",
|
|
24
|
+
timeoutMs: 8e3,
|
|
25
|
+
...options,
|
|
26
|
+
headers
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
Object.assign(results, data);
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
return results;
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
QUOTED_POSTS_BATCH_MAX,
|
|
38
|
+
resolveQuotedPosts
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=quoted-posts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/quoted-posts.ts"],"sourcesContent":["import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface QuotedPostAuthor {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n}\n\nexport interface QuotedPostImage {\n thumb: string;\n fullsize: string;\n alt?: string;\n}\n\nexport interface QuotedPostView {\n uri: string;\n cid: string;\n author: QuotedPostAuthor;\n text: string;\n createdAt: string;\n images?: QuotedPostImage[];\n}\n\nexport type QuotedPostResult =\n | { status: 'ok'; record: QuotedPostView }\n | { status: 'deleted'; uri: string }\n | { status: 'unavailable'; uri: string };\n\n/** Max URIs per request to `POST /api/quoted-posts/resolve` (mirrors server cap). */\nexport const QUOTED_POSTS_BATCH_MAX = 20;\n\nexport interface ResolveQuotedPostsOptions extends ApiFetchOptions {\n /** Cookie header for Next.js RSC server-side calls; ignored in browsers. */\n cookieHeader?: string;\n}\n\n/**\n * Resolve a batch of AT-URIs to their quoted-post snapshots via the Sifa AppView.\n *\n * Auto-deduplicates input URIs and splits requests into chunks of\n * {@link QUOTED_POSTS_BATCH_MAX} so callers can pass an arbitrary-length array.\n * Each chunk is fired in parallel. The server caches results in Valkey, so\n * repeated calls for the same URI are cheap.\n *\n * Returns a map of `uri -> QuotedPostResult`. URIs that fail (network error,\n * non-2xx, or the server omitting them) are absent from the map; the caller\n * should render a skeleton or tombstone for those.\n */\nexport async function resolveQuotedPosts(\n config: SifaApiConfig,\n uris: string[],\n options: ResolveQuotedPostsOptions = {},\n): Promise<Record<string, QuotedPostResult>> {\n if (uris.length === 0) return {};\n\n const unique = [...new Set(uris)];\n const batches: string[][] = [];\n for (let i = 0; i < unique.length; i += QUOTED_POSTS_BATCH_MAX) {\n batches.push(unique.slice(i, i + QUOTED_POSTS_BATCH_MAX));\n }\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n const results: Record<string, QuotedPostResult> = {};\n await Promise.all(\n batches.map(async (batch) => {\n try {\n const data = await apiFetch<Record<string, QuotedPostResult>>(\n config,\n '/api/quoted-posts/resolve',\n {\n method: 'POST',\n body: { uris: batch },\n credentials: 'include',\n timeoutMs: 8000,\n ...options,\n headers,\n },\n );\n Object.assign(results, data);\n } catch {\n // Leave failed URIs absent so the consumer can render a fallback.\n }\n }),\n );\n\n return results;\n}\n"],"mappings":";AAAA,SAAS,gBAA0D;AA8B5D,IAAM,yBAAyB;AAmBtC,eAAsB,mBACpB,QACA,MACA,UAAqC,CAAC,GACK;AAC3C,MAAI,KAAK,WAAW,EAAG,QAAO,CAAC;AAE/B,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC;AAChC,QAAM,UAAsB,CAAC;AAC7B,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,wBAAwB;AAC9D,YAAQ,KAAK,OAAO,MAAM,GAAG,IAAI,sBAAsB,CAAC;AAAA,EAC1D;AAEA,QAAM,UAAkC,EAAE,GAAI,QAAQ,WAAW,CAAC,EAAG;AACrE,MAAI,QAAQ,aAAc,SAAQ,SAAS,QAAQ;AAEnD,QAAM,UAA4C,CAAC;AACnD,QAAM,QAAQ;AAAA,IACZ,QAAQ,IAAI,OAAO,UAAU;AAC3B,UAAI;AACF,cAAM,OAAO,MAAM;AAAA,UACjB;AAAA,UACA;AAAA,UACA;AAAA,YACE,QAAQ;AAAA,YACR,MAAM,EAAE,MAAM,MAAM;AAAA,YACpB,aAAa;AAAA,YACb,WAAW;AAAA,YACX,GAAG;AAAA,YACH;AAAA,UACF;AAAA,QACF;AACA,eAAO,OAAO,SAAS,IAAI;AAAA,MAC7B,QAAQ;AAAA,MAER;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// src/query/fetchers/reactions.ts
|
|
2
|
+
import {
|
|
3
|
+
apiFetch,
|
|
4
|
+
apiWrite
|
|
5
|
+
} from "../client.js";
|
|
6
|
+
async function fetchReactionStatus(config, uris, options = {}) {
|
|
7
|
+
if (uris.length === 0) return {};
|
|
8
|
+
const headers = { ...options.headers ?? {} };
|
|
9
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
10
|
+
try {
|
|
11
|
+
return await apiFetch(
|
|
12
|
+
config,
|
|
13
|
+
`/api/reactions/status?uris=${encodeURIComponent(uris.join(","))}`,
|
|
14
|
+
{
|
|
15
|
+
credentials: "include",
|
|
16
|
+
...options,
|
|
17
|
+
headers
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function checkAppAccount(config, appId, options = {}) {
|
|
25
|
+
const headers = { ...options.headers ?? {} };
|
|
26
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
27
|
+
try {
|
|
28
|
+
return await apiFetch(
|
|
29
|
+
config,
|
|
30
|
+
`/api/reactions/account-check/${encodeURIComponent(appId)}`,
|
|
31
|
+
{
|
|
32
|
+
credentials: "include",
|
|
33
|
+
...options,
|
|
34
|
+
headers
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function createReaction(config, targetUri, appId, targetCid, options = {}) {
|
|
42
|
+
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
43
|
+
const url = `${config.baseUrl}/api/reactions`;
|
|
44
|
+
try {
|
|
45
|
+
const res = await fetchFn(url, {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: { "Content-Type": "application/json", ...options.headers ?? {} },
|
|
48
|
+
credentials: options.credentials ?? "include",
|
|
49
|
+
body: JSON.stringify({ targetUri, appId, targetCid }),
|
|
50
|
+
signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 1e4)
|
|
51
|
+
});
|
|
52
|
+
if (!res.ok) {
|
|
53
|
+
if (res.status === 403) {
|
|
54
|
+
try {
|
|
55
|
+
const body = await res.json();
|
|
56
|
+
if (body.error === "ScopeInsufficient") {
|
|
57
|
+
return {
|
|
58
|
+
ok: false,
|
|
59
|
+
error: { type: "scope_insufficient", requiredScope: body.requiredScope }
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { ok: false, error: { type: "error" } };
|
|
66
|
+
}
|
|
67
|
+
const data = await res.json();
|
|
68
|
+
return { ok: true, data };
|
|
69
|
+
} catch {
|
|
70
|
+
return { ok: false, error: { type: "error" } };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function deleteReaction(config, targetUri, appId, options = {}) {
|
|
74
|
+
return apiWrite(config, "/api/reactions", "DELETE", {
|
|
75
|
+
body: { targetUri, appId },
|
|
76
|
+
...options
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
checkAppAccount,
|
|
81
|
+
createReaction,
|
|
82
|
+
deleteReaction,
|
|
83
|
+
fetchReactionStatus
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=reactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/reactions.ts"],"sourcesContent":["import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Per-URI reaction state for the authenticated viewer. */\nexport interface ReactionStatus {\n reacted: boolean;\n rkey?: string;\n collection?: string;\n}\n\n/** Result of checking whether the authenticated viewer has an account on a given app. */\nexport interface AccountCheckResult {\n hasAccount: boolean;\n appName: string;\n appUrl: string;\n}\n\nexport interface FetchReactionStatusOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Batch-look up reaction status for multiple URIs. Returns `{}` for an\n * empty input list (no network call) and `null` on any error.\n */\nexport async function fetchReactionStatus(\n config: SifaApiConfig,\n uris: string[],\n options: FetchReactionStatusOptions = {},\n): Promise<Record<string, ReactionStatus> | null> {\n if (uris.length === 0) return {};\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<Record<string, ReactionStatus>>(\n config,\n `/api/reactions/status?uris=${encodeURIComponent(uris.join(','))}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\nexport interface CheckAppAccountOptions extends ApiFetchOptions {\n cookieHeader?: string;\n}\n\n/**\n * Check whether the authenticated viewer has an account on a given app.\n * Returns `null` on any error.\n */\nexport async function checkAppAccount(\n config: SifaApiConfig,\n appId: string,\n options: CheckAppAccountOptions = {},\n): Promise<AccountCheckResult | null> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n return await apiFetch<AccountCheckResult>(\n config,\n `/api/reactions/account-check/${encodeURIComponent(appId)}`,\n {\n credentials: 'include',\n ...options,\n headers,\n },\n );\n } catch {\n return null;\n }\n}\n\n/** Result of a successful {@link createReaction}. */\nexport interface ReactionResult {\n uri: string;\n rkey: string;\n}\n\n/** Structured error returned by {@link createReaction} on failure. */\nexport interface ReactionError {\n type: 'scope_insufficient' | 'error';\n /** When `type === 'scope_insufficient'`, the lexicon scope the user must re-authorize for. */\n requiredScope?: string;\n}\n\n/**\n * Create a reaction (like / star) on a target ATproto record.\n *\n * Returns a discriminated-union result instead of the generic\n * {@link WriteResult} shape because reactions have a distinct\n * \"scope insufficient\" failure that callers handle differently from\n * other errors (it triggers an OAuth scope-upgrade flow rather than\n * an error toast).\n *\n * Never throws.\n */\nexport async function createReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n targetCid?: string,\n options: ApiFetchOptions = {},\n): Promise<{ ok: true; data: ReactionResult } | { ok: false; error: ReactionError }> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/reactions`;\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...(options.headers ?? {}) },\n credentials: options.credentials ?? 'include',\n body: JSON.stringify({ targetUri, appId, targetCid }),\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 10_000),\n });\n\n if (!res.ok) {\n if (res.status === 403) {\n try {\n const body = (await res.json()) as { error?: string; requiredScope?: string };\n if (body.error === 'ScopeInsufficient') {\n return {\n ok: false,\n error: { type: 'scope_insufficient', requiredScope: body.requiredScope },\n };\n }\n } catch {\n // Fall through to generic error\n }\n }\n return { ok: false, error: { type: 'error' } };\n }\n\n const data = (await res.json()) as ReactionResult;\n return { ok: true, data };\n } catch {\n return { ok: false, error: { type: 'error' } };\n }\n}\n\n/**\n * Delete a reaction (like / star) on a target ATproto record. Returns\n * `{ success: true }` on 2xx, `{ success: false, error }` on failure.\n */\nexport function deleteReaction(\n config: SifaApiConfig,\n targetUri: string,\n appId: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, '/api/reactions', 'DELETE', {\n body: { targetUri, appId },\n ...options,\n });\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AA6BP,eAAsB,oBACpB,QACA,MACA,UAAsC,CAAC,GACS;AAChD,MAAI,KAAK,WAAW,EAAG,QAAO,CAAC;AAE/B,QAAM,UAAkC,EAAE,GAAI,QAAQ,WAAW,CAAC,EAAG;AACrE,MAAI,QAAQ,aAAc,SAAQ,SAAS,QAAQ;AAEnD,MAAI;AACF,WAAO,MAAM;AAAA,MACX;AAAA,MACA,8BAA8B,mBAAmB,KAAK,KAAK,GAAG,CAAC,CAAC;AAAA,MAChE;AAAA,QACE,aAAa;AAAA,QACb,GAAG;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAUA,eAAsB,gBACpB,QACA,OACA,UAAkC,CAAC,GACC;AACpC,QAAM,UAAkC,EAAE,GAAI,QAAQ,WAAW,CAAC,EAAG;AACrE,MAAI,QAAQ,aAAc,SAAQ,SAAS,QAAQ;AAEnD,MAAI;AACF,WAAO,MAAM;AAAA,MACX;AAAA,MACA,gCAAgC,mBAAmB,KAAK,CAAC;AAAA,MACzD;AAAA,QACE,aAAa;AAAA,QACb,GAAG;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AA0BA,eAAsB,eACpB,QACA,WACA,OACA,WACA,UAA2B,CAAC,GACuD;AACnF,QAAM,UAAU,OAAO,SAAS,WAAW;AAC3C,QAAM,MAAM,GAAG,OAAO,OAAO;AAE7B,MAAI;AACF,UAAM,MAAM,MAAM,QAAQ,KAAK;AAAA,MAC7B,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,oBAAoB,GAAI,QAAQ,WAAW,CAAC,EAAG;AAAA,MAC1E,aAAa,QAAQ,eAAe;AAAA,MACpC,MAAM,KAAK,UAAU,EAAE,WAAW,OAAO,UAAU,CAAC;AAAA,MACpD,QAAQ,QAAQ,UAAU,YAAY,QAAQ,QAAQ,aAAa,GAAM;AAAA,IAC3E,CAAC;AAED,QAAI,CAAC,IAAI,IAAI;AACX,UAAI,IAAI,WAAW,KAAK;AACtB,YAAI;AACF,gBAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,cAAI,KAAK,UAAU,qBAAqB;AACtC,mBAAO;AAAA,cACL,IAAI;AAAA,cACJ,OAAO,EAAE,MAAM,sBAAsB,eAAe,KAAK,cAAc;AAAA,YACzE;AAAA,UACF;AAAA,QACF,QAAQ;AAAA,QAER;AAAA,MACF;AACA,aAAO,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,QAAQ,EAAE;AAAA,IAC/C;AAEA,UAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,WAAO,EAAE,IAAI,MAAM,KAAK;AAAA,EAC1B,QAAQ;AACN,WAAO,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,QAAQ,EAAE;AAAA,EAC/C;AACF;AAMO,SAAS,eACd,QACA,WACA,OACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,kBAAkB,UAAU;AAAA,IAClD,MAAM,EAAE,WAAW,MAAM;AAAA,IACzB,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/query/fetchers/received-endorsements.ts
|
|
2
|
+
import { encodeIdentifier, apiFetch } from "../client.js";
|
|
3
|
+
async function fetchReceivedEndorsements(config, did, options = {}) {
|
|
4
|
+
const { limit, ...fetchOptions } = options;
|
|
5
|
+
const qs = limit ? `?limit=${limit}` : "";
|
|
6
|
+
try {
|
|
7
|
+
const data = await apiFetch(
|
|
8
|
+
config,
|
|
9
|
+
`/api/endorsement/${encodeIdentifier(did)}${qs}`,
|
|
10
|
+
{ cache: "no-store", timeoutMs: 5e3, ...fetchOptions }
|
|
11
|
+
);
|
|
12
|
+
return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };
|
|
13
|
+
} catch {
|
|
14
|
+
return { endorsements: [] };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
fetchReceivedEndorsements
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=received-endorsements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/received-endorsements.ts"],"sourcesContent":["import { encodeIdentifier, apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface ReceivedEndorsement {\n endorserDid: string;\n /** Absent when the endorser has no Sifa profile yet. */\n endorserHandle?: string;\n endorserDisplayName?: string;\n endorserAvatar?: string;\n skillUri?: string;\n skillCid?: string;\n skillName: string;\n comment?: string;\n createdAt: string;\n}\n\nexport interface ReceivedEndorsementsPage {\n endorsements: ReceivedEndorsement[];\n cursor?: string;\n}\n\n/**\n * Confirmed endorsements a DID has received, newest first.\n *\n * Only confirmed ones exist here: the AppView inner-joins against the\n * confirmation records, so an endorsement the subject has not accepted is\n * absent rather than pending. Public -- no credentials needed.\n *\n * Returns an empty page on failure so a surface that merely decorates a page\n * cannot break it.\n */\nexport async function fetchReceivedEndorsements(\n config: SifaApiConfig,\n did: string,\n options: { limit?: number } & ApiFetchOptions = {},\n): Promise<ReceivedEndorsementsPage> {\n const { limit, ...fetchOptions } = options;\n const qs = limit ? `?limit=${limit}` : '';\n try {\n const data = await apiFetch<ReceivedEndorsementsPage>(\n config,\n `/api/endorsement/${encodeIdentifier(did)}${qs}`,\n { cache: 'no-store', timeoutMs: 5000, ...fetchOptions },\n );\n return { endorsements: data?.endorsements ?? [], cursor: data?.cursor };\n } catch {\n return { endorsements: [] };\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,gBAA0D;AA8BrF,eAAsB,0BACpB,QACA,KACA,UAAgD,CAAC,GACd;AACnC,QAAM,EAAE,OAAO,GAAG,aAAa,IAAI;AACnC,QAAM,KAAK,QAAQ,UAAU,KAAK,KAAK;AACvC,MAAI;AACF,UAAM,OAAO,MAAM;AAAA,MACjB;AAAA,MACA,oBAAoB,iBAAiB,GAAG,CAAC,GAAG,EAAE;AAAA,MAC9C,EAAE,OAAO,YAAY,WAAW,KAAM,GAAG,aAAa;AAAA,IACxD;AACA,WAAO,EAAE,cAAc,MAAM,gBAAgB,CAAC,GAAG,QAAQ,MAAM,OAAO;AAAA,EACxE,QAAQ;AACN,WAAO,EAAE,cAAc,CAAC,EAAE;AAAA,EAC5B;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/query/fetchers/reciprocity.ts
|
|
2
|
+
import { apiFetch } from "../client.js";
|
|
3
|
+
async function fetchReciprocityCandidate(config, options = {}) {
|
|
4
|
+
try {
|
|
5
|
+
const data = await apiFetch(
|
|
6
|
+
config,
|
|
7
|
+
"/api/endorsements/reciprocity-candidate",
|
|
8
|
+
{
|
|
9
|
+
cache: "no-store",
|
|
10
|
+
credentials: "include",
|
|
11
|
+
timeoutMs: 5e3,
|
|
12
|
+
...options
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
return data?.candidate ?? null;
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
fetchReciprocityCandidate
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=reciprocity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/reciprocity.ts"],"sourcesContent":["import { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\nexport interface ReciprocitySkill {\n name: string;\n uri: string;\n /** Absent until the firehose indexes the skill; the AppView resolves it. */\n cid?: string;\n}\n\nexport interface ReciprocityCandidate {\n did: string;\n handle: string;\n displayName?: string;\n avatar?: string;\n skills: ReciprocitySkill[];\n}\n\n/**\n * Someone the signed-in user follows on Sifa whose skills they could endorse.\n *\n * The AppView picks: it filters people already dismissed and anyone blocked,\n * requires at least one skill, and rotates the choice every twelve hours so\n * the same person is not offered indefinitely.\n *\n * `null` means there is nobody left to suggest -- a real state, not an error.\n * Failures also yield `null` so a broken suggestion never breaks the homepage.\n */\nexport async function fetchReciprocityCandidate(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<ReciprocityCandidate | null> {\n try {\n const data = await apiFetch<{ candidate: ReciprocityCandidate | null }>(\n config,\n '/api/endorsements/reciprocity-candidate',\n {\n cache: 'no-store',\n credentials: 'include',\n timeoutMs: 5000,\n ...options,\n },\n );\n return data?.candidate ?? null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,gBAA0D;AA2BnE,eAAsB,0BACpB,QACA,UAA2B,CAAC,GACU;AACtC,MAAI;AACF,UAAM,OAAO,MAAM;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,aAAa;AAAA,QACb,WAAW;AAAA,QACX,GAAG;AAAA,MACL;AAAA,IACF;AACA,WAAO,MAAM,aAAa;AAAA,EAC5B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/query/fetchers/records.ts
|
|
2
|
+
import {
|
|
3
|
+
apiWrite,
|
|
4
|
+
apiWriteCreate
|
|
5
|
+
} from "../client.js";
|
|
6
|
+
function createRecord(config, collection, data, options = {}) {
|
|
7
|
+
return apiWriteCreate(
|
|
8
|
+
config,
|
|
9
|
+
`/api/profile/records/${encodeURIComponent(collection)}`,
|
|
10
|
+
data,
|
|
11
|
+
options
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
function updateRecord(config, collection, rkey, data, options = {}) {
|
|
15
|
+
const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;
|
|
16
|
+
return apiWrite(config, path, "PUT", { body: data, ...options });
|
|
17
|
+
}
|
|
18
|
+
function deleteRecord(config, collection, rkey, options = {}) {
|
|
19
|
+
const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;
|
|
20
|
+
return apiWrite(config, path, "DELETE", options);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
createRecord,
|
|
24
|
+
deleteRecord,
|
|
25
|
+
updateRecord
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/records.ts"],"sourcesContent":["import {\n apiWrite,\n apiWriteCreate,\n type ApiFetchOptions,\n type CreateResult,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/**\n * Generic record-create escape hatch. Most callers should prefer the\n * dedicated section helpers (`createPosition`, `createEducation`, etc.)\n * which take typed payloads and ship matching hooks. Use this when the\n * lexicon doesn't yet have a dedicated endpoint (certifications,\n * projects, publications, volunteering, honors, languages, courses).\n *\n * `collection` is a `id.sifa.profile.*` collection NSID. Routes to\n * `POST /api/profile/records/<collection>`.\n */\nexport function createRecord(\n config: SifaApiConfig,\n collection: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<CreateResult> {\n return apiWriteCreate(\n config,\n `/api/profile/records/${encodeURIComponent(collection)}`,\n data,\n options,\n );\n}\n\n/** Generic record-update escape hatch. See {@link createRecord}. */\nexport function updateRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n data: Record<string, unknown>,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'PUT', { body: data, ...options });\n}\n\n/** Generic record-delete escape hatch. See {@link createRecord}. */\nexport function deleteRecord(\n config: SifaApiConfig,\n collection: string,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n const path = `/api/profile/records/${encodeURIComponent(collection)}/${encodeURIComponent(rkey)}`;\n return apiWrite(config, path, 'DELETE', options);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAKK;AAYA,SAAS,aACd,QACA,YACA,MACA,UAA2B,CAAC,GACL;AACvB,SAAO;AAAA,IACL;AAAA,IACA,wBAAwB,mBAAmB,UAAU,CAAC;AAAA,IACtD;AAAA,IACA;AAAA,EACF;AACF;AAGO,SAAS,aACd,QACA,YACA,MACA,MACA,UAA2B,CAAC,GACN;AACtB,QAAM,OAAO,wBAAwB,mBAAmB,UAAU,CAAC,IAAI,mBAAmB,IAAI,CAAC;AAC/F,SAAO,SAAS,QAAQ,MAAM,OAAO,EAAE,MAAM,MAAM,GAAG,QAAQ,CAAC;AACjE;AAGO,SAAS,aACd,QACA,YACA,MACA,UAA2B,CAAC,GACN;AACtB,QAAM,OAAO,wBAAwB,mBAAmB,UAAU,CAAC,IAAI,mBAAmB,IAAI,CAAC;AAC/F,SAAO,SAAS,QAAQ,MAAM,UAAU,OAAO;AACjD;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/query/fetchers/repo-inventory.ts
|
|
2
|
+
import { apiFetch, apiWrite } from "../client.js";
|
|
3
|
+
function fetchRepoInventory(config, options = {}) {
|
|
4
|
+
return apiFetch(config, "/api/me/repo-inventory", {
|
|
5
|
+
credentials: "include",
|
|
6
|
+
...options
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function deleteRepoRecords(config, input, options = {}) {
|
|
10
|
+
return apiWrite(config, "/api/me/repo-delete", "POST", {
|
|
11
|
+
body: input,
|
|
12
|
+
...options
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function repoExportUrl(config) {
|
|
16
|
+
return `${config.baseUrl}/api/me/repo-export`;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
deleteRepoRecords,
|
|
20
|
+
fetchRepoInventory,
|
|
21
|
+
repoExportUrl
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=repo-inventory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/repo-inventory.ts"],"sourcesContent":["import type { RepoDeleteResult, RepoInventory } from '../../repo/types.js';\nimport { apiFetch, apiWrite, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/**\n * Read what the user's PDS actually holds under id.sifa.*.\n *\n * A failure is not flattened into an empty inventory. Zero records reads as\n * \"Sifa has stored nothing about you\", and a request that never arrived must\n * not be allowed to say that. Let it throw.\n */\nexport function fetchRepoInventory(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RepoInventory> {\n return apiFetch<RepoInventory>(config, '/api/me/repo-inventory', {\n credentials: 'include',\n ...options,\n });\n}\n\nexport interface RepoDeleteInput {\n collection: string;\n /** The records to remove. Omit and set `all` to remove the whole collection. */\n rkeys?: string[];\n /**\n * Remove every record in the collection, including ones written between the\n * inventory read and this call. A UI offering \"delete all of X\" must send\n * this rather than the rkeys it happened to see, or a record created in\n * between silently survives a delete the user believes was complete.\n */\n all?: boolean;\n}\n\n/**\n * Delete records from the user's own repo.\n *\n * The returned `success` means the request was accepted, NOT that the records\n * are gone: read `results` for that, per record. `needsScopeUpgrade` means\n * nothing was attempted and the user has to grant the scope first.\n *\n * Destructive and not undoable -- a deleted record's CID cannot be restored.\n * The server enforces the id.sifa.* boundary and the session check; the SDK\n * adds no confirmation step, so wrap call sites in one.\n */\nexport function deleteRepoRecords(\n config: SifaApiConfig,\n input: RepoDeleteInput,\n options: ApiFetchOptions = {},\n): Promise<RepoDeleteResult & { success: boolean; error?: string }> {\n return apiWrite<RepoDeleteResult>(config, '/api/me/repo-delete', 'POST', {\n body: input,\n ...options,\n });\n}\n\n/**\n * URL of the raw-record download.\n *\n * A URL rather than a fetcher: the response is a file the browser saves, and\n * routing it through fetch would buffer the whole repo in memory to hand it\n * straight back to a download anchor.\n */\nexport function repoExportUrl(config: SifaApiConfig): string {\n return `${config.baseUrl}/api/me/repo-export`;\n}\n"],"mappings":";AACA,SAAS,UAAU,gBAA0D;AAStE,SAAS,mBACd,QACA,UAA2B,CAAC,GACJ;AACxB,SAAO,SAAwB,QAAQ,0BAA0B;AAAA,IAC/D,aAAa;AAAA,IACb,GAAG;AAAA,EACL,CAAC;AACH;AA0BO,SAAS,kBACd,QACA,OACA,UAA2B,CAAC,GACsC;AAClE,SAAO,SAA2B,QAAQ,uBAAuB,QAAQ;AAAA,IACvE,MAAM;AAAA,IACN,GAAG;AAAA,EACL,CAAC;AACH;AASO,SAAS,cAAc,QAA+B;AAC3D,SAAO,GAAG,OAAO,OAAO;AAC1B;","names":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// src/query/fetchers/roadmap.ts
|
|
2
|
+
import {
|
|
3
|
+
apiFetch,
|
|
4
|
+
apiWrite
|
|
5
|
+
} from "../client.js";
|
|
6
|
+
async function fetchRoadmapVotes(config, options = {}) {
|
|
7
|
+
try {
|
|
8
|
+
return await apiFetch(config, "/api/roadmap/votes", {
|
|
9
|
+
cache: "no-store",
|
|
10
|
+
...options
|
|
11
|
+
});
|
|
12
|
+
} catch {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function fetchMyRoadmapVotes(config, options = {}) {
|
|
17
|
+
const headers = { ...options.headers ?? {} };
|
|
18
|
+
if (options.cookieHeader) headers.cookie = options.cookieHeader;
|
|
19
|
+
try {
|
|
20
|
+
const data = await apiFetch(config, "/api/roadmap/votes/me", {
|
|
21
|
+
credentials: "include",
|
|
22
|
+
...options,
|
|
23
|
+
headers
|
|
24
|
+
});
|
|
25
|
+
return data.voted ?? [];
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function castRoadmapVote(config, key, options = {}) {
|
|
31
|
+
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
32
|
+
const url = `${config.baseUrl}/api/roadmap/votes/${encodeURIComponent(key)}`;
|
|
33
|
+
try {
|
|
34
|
+
const res = await fetchFn(url, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
// No body: the item key is in the URL. Do NOT declare a JSON content-type
|
|
37
|
+
// for an empty body — Fastify rejects that with a 400 before the handler
|
|
38
|
+
// runs. Only forward caller-provided headers.
|
|
39
|
+
...options.headers ? { headers: options.headers } : {},
|
|
40
|
+
credentials: options.credentials ?? "include",
|
|
41
|
+
signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 1e4)
|
|
42
|
+
});
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
if (res.status === 403) {
|
|
45
|
+
try {
|
|
46
|
+
const body = await res.json();
|
|
47
|
+
if (body.error === "ScopeInsufficient") {
|
|
48
|
+
return {
|
|
49
|
+
ok: false,
|
|
50
|
+
error: { type: "scope_insufficient", requiredScope: body.requiredScope }
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { ok: false, error: { type: "error" } };
|
|
57
|
+
}
|
|
58
|
+
const data = await res.json();
|
|
59
|
+
return { ok: true, data };
|
|
60
|
+
} catch {
|
|
61
|
+
return { ok: false, error: { type: "error" } };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function retractRoadmapVote(config, key, options = {}) {
|
|
65
|
+
return apiWrite(config, `/api/roadmap/votes/${encodeURIComponent(key)}`, "DELETE", options);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
castRoadmapVote,
|
|
69
|
+
fetchMyRoadmapVotes,
|
|
70
|
+
fetchRoadmapVotes,
|
|
71
|
+
retractRoadmapVote
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=roadmap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/roadmap.ts"],"sourcesContent":["import {\n apiFetch,\n apiWrite,\n type ApiFetchOptions,\n type SifaApiConfig,\n type WriteResult,\n} from '../client.js';\n\n/** Voter on a roadmap item. */\nexport interface RoadmapVoter {\n did: string;\n avatarUrl?: string;\n}\n\n/** Map of item key -> vote tally and voter list. */\nexport type RoadmapVotesResponse = Record<string, { count: number; voters: RoadmapVoter[] }>;\n\n/**\n * Public roadmap vote tallies, keyed by item. Returns `{}` on any error.\n */\nexport async function fetchRoadmapVotes(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<RoadmapVotesResponse> {\n try {\n return await apiFetch<RoadmapVotesResponse>(config, '/api/roadmap/votes', {\n cache: 'no-store',\n ...options,\n });\n } catch {\n return {};\n }\n}\n\nexport interface FetchMyRoadmapVotesOptions extends ApiFetchOptions {\n /**\n * Pass the caller's `Cookie` header on Next.js RSC server-side calls.\n * Required for authenticated server fetches because `credentials: 'include'`\n * does not propagate browser cookies in RSC.\n */\n cookieHeader?: string;\n}\n\n/**\n * Roadmap items the authenticated user has voted on. Returns `[]` on any\n * error or when the response payload is shaped unexpectedly.\n */\nexport async function fetchMyRoadmapVotes(\n config: SifaApiConfig,\n options: FetchMyRoadmapVotesOptions = {},\n): Promise<string[]> {\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (options.cookieHeader) headers.cookie = options.cookieHeader;\n\n try {\n const data = await apiFetch<{ voted?: string[] }>(config, '/api/roadmap/votes/me', {\n credentials: 'include',\n ...options,\n headers,\n });\n return data.voted ?? [];\n } catch {\n return [];\n }\n}\n\n/** Result of a successful {@link castRoadmapVote} -- the created upvote record. */\nexport interface RoadmapVoteResult {\n uri: string;\n rkey: string;\n}\n\n/** Structured error returned by {@link castRoadmapVote} on failure. */\nexport interface RoadmapVoteError {\n type: 'scope_insufficient' | 'error';\n /**\n * When `type === 'scope_insufficient'`, the lexicon collection the user must\n * re-authorize for (e.g. `app.userinput.upvote`). sifa-web maps this to an\n * OAuth scope-upgrade flow (`/oauth/reauth?scope=repo:<collection>`).\n */\n requiredScope?: string;\n}\n\n/**\n * Discriminated-union result of {@link castRoadmapVote}. Exported so the\n * `useCastRoadmapVote` hook and SDK consumers can type mutation handlers\n * against a single source of truth.\n */\nexport type CastRoadmapVoteResult =\n { ok: true; data: RoadmapVoteResult } | { ok: false; error: RoadmapVoteError };\n\n/**\n * Cast a vote on a roadmap item by its key.\n *\n * Writes an `app.userinput.upvote` record into the viewer's PDS (server-side,\n * via their OAuth session). Returns a discriminated-union result rather than\n * the generic {@link WriteResult} because a first-time voter's PDS grant may\n * not yet include the `app.userinput.upvote` collection: the AppView responds\n * 403 `ScopeInsufficient`, which the caller handles by triggering an OAuth\n * scope upgrade rather than showing an error. Mirrors {@link createReaction}.\n *\n * Never throws.\n */\nexport async function castRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<CastRoadmapVoteResult> {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const url = `${config.baseUrl}/api/roadmap/votes/${encodeURIComponent(key)}`;\n\n try {\n const res = await fetchFn(url, {\n method: 'POST',\n // No body: the item key is in the URL. Do NOT declare a JSON content-type\n // for an empty body — Fastify rejects that with a 400 before the handler\n // runs. Only forward caller-provided headers.\n ...(options.headers ? { headers: options.headers } : {}),\n credentials: options.credentials ?? 'include',\n signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 10_000),\n });\n\n if (!res.ok) {\n if (res.status === 403) {\n try {\n const body = (await res.json()) as { error?: string; requiredScope?: string };\n if (body.error === 'ScopeInsufficient') {\n return {\n ok: false,\n error: { type: 'scope_insufficient', requiredScope: body.requiredScope },\n };\n }\n } catch {\n // Fall through to generic error.\n }\n }\n return { ok: false, error: { type: 'error' } };\n }\n\n const data = (await res.json()) as RoadmapVoteResult;\n return { ok: true, data };\n } catch {\n return { ok: false, error: { type: 'error' } };\n }\n}\n\n/** Retract a previously-cast roadmap vote. */\nexport function retractRoadmapVote(\n config: SifaApiConfig,\n key: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(config, `/api/roadmap/votes/${encodeURIComponent(key)}`, 'DELETE', options);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAcP,eAAsB,kBACpB,QACA,UAA2B,CAAC,GACG;AAC/B,MAAI;AACF,WAAO,MAAM,SAA+B,QAAQ,sBAAsB;AAAA,MACxE,OAAO;AAAA,MACP,GAAG;AAAA,IACL,CAAC;AAAA,EACH,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAeA,eAAsB,oBACpB,QACA,UAAsC,CAAC,GACpB;AACnB,QAAM,UAAkC,EAAE,GAAI,QAAQ,WAAW,CAAC,EAAG;AACrE,MAAI,QAAQ,aAAc,SAAQ,SAAS,QAAQ;AAEnD,MAAI;AACF,UAAM,OAAO,MAAM,SAA+B,QAAQ,yBAAyB;AAAA,MACjF,aAAa;AAAA,MACb,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AACD,WAAO,KAAK,SAAS,CAAC;AAAA,EACxB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAuCA,eAAsB,gBACpB,QACA,KACA,UAA2B,CAAC,GACI;AAChC,QAAM,UAAU,OAAO,SAAS,WAAW;AAC3C,QAAM,MAAM,GAAG,OAAO,OAAO,sBAAsB,mBAAmB,GAAG,CAAC;AAE1E,MAAI;AACF,UAAM,MAAM,MAAM,QAAQ,KAAK;AAAA,MAC7B,QAAQ;AAAA;AAAA;AAAA;AAAA,MAIR,GAAI,QAAQ,UAAU,EAAE,SAAS,QAAQ,QAAQ,IAAI,CAAC;AAAA,MACtD,aAAa,QAAQ,eAAe;AAAA,MACpC,QAAQ,QAAQ,UAAU,YAAY,QAAQ,QAAQ,aAAa,GAAM;AAAA,IAC3E,CAAC;AAED,QAAI,CAAC,IAAI,IAAI;AACX,UAAI,IAAI,WAAW,KAAK;AACtB,YAAI;AACF,gBAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,cAAI,KAAK,UAAU,qBAAqB;AACtC,mBAAO;AAAA,cACL,IAAI;AAAA,cACJ,OAAO,EAAE,MAAM,sBAAsB,eAAe,KAAK,cAAc;AAAA,YACzE;AAAA,UACF;AAAA,QACF,QAAQ;AAAA,QAER;AAAA,MACF;AACA,aAAO,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,QAAQ,EAAE;AAAA,IAC/C;AAEA,UAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,WAAO,EAAE,IAAI,MAAM,KAAK;AAAA,EAC1B,QAAQ;AACN,WAAO,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,QAAQ,EAAE;AAAA,EAC/C;AACF;AAGO,SAAS,mBACd,QACA,KACA,UAA2B,CAAC,GACN;AACtB,SAAO,SAAS,QAAQ,sBAAsB,mBAAmB,GAAG,CAAC,IAAI,UAAU,OAAO;AAC5F;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/query/fetchers/rpg.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { apiFetch } from "../client.js";
|
|
4
|
+
var RpgItemStatusSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
description: z.string(),
|
|
8
|
+
category: z.string(),
|
|
9
|
+
earned: z.boolean(),
|
|
10
|
+
state: z.enum(["locked", "earned", "given", "claimed"]),
|
|
11
|
+
iconUrl: z.string().url().nullable()
|
|
12
|
+
});
|
|
13
|
+
var RpgStatusResponseSchema = z.object({
|
|
14
|
+
hasCharacter: z.boolean(),
|
|
15
|
+
/** True when the user granted the `repo:equipment.rpg.item` OAuth scope. */
|
|
16
|
+
canWriteItems: z.boolean(),
|
|
17
|
+
items: z.array(RpgItemStatusSchema)
|
|
18
|
+
});
|
|
19
|
+
async function fetchRpgStatus(config, options = {}) {
|
|
20
|
+
const { cookieHeader, ...fetchOptions } = options;
|
|
21
|
+
const headers = { ...options.headers ?? {} };
|
|
22
|
+
if (cookieHeader) headers.cookie = cookieHeader;
|
|
23
|
+
const data = await apiFetch(config, "/api/rpg/status", {
|
|
24
|
+
credentials: "include",
|
|
25
|
+
cache: "no-store",
|
|
26
|
+
...fetchOptions,
|
|
27
|
+
headers
|
|
28
|
+
});
|
|
29
|
+
return RpgStatusResponseSchema.parse(data);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
RpgItemStatusSchema,
|
|
33
|
+
RpgStatusResponseSchema,
|
|
34
|
+
fetchRpgStatus
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=rpg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/rpg.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** One rpg.actor item and the viewer's progress on it, as served by `GET /api/rpg/status`. */\nexport const RpgItemStatusSchema = z.object({\n id: z.string(),\n title: z.string(),\n description: z.string(),\n category: z.string(),\n earned: z.boolean(),\n state: z.enum(['locked', 'earned', 'given', 'claimed']),\n iconUrl: z.string().url().nullable(),\n});\nexport type RpgItemStatus = z.infer<typeof RpgItemStatusSchema>;\n\nexport const RpgStatusResponseSchema = z.object({\n hasCharacter: z.boolean(),\n /** True when the user granted the `repo:equipment.rpg.item` OAuth scope. */\n canWriteItems: z.boolean(),\n items: z.array(RpgItemStatusSchema),\n});\nexport type RpgStatusResponse = z.infer<typeof RpgStatusResponseSchema>;\n\nexport interface FetchRpgStatusOptions extends ApiFetchOptions {\n /** Forwarded as the `cookie` header for server-side (SSR) calls. */\n cookieHeader?: string;\n}\n\n/**\n * Fetch the authenticated viewer's rpg.actor item status. Auth-scoped: relies\n * on the session cookie (`credentials: 'include'`).\n */\nexport async function fetchRpgStatus(\n config: SifaApiConfig,\n options: FetchRpgStatusOptions = {},\n): Promise<RpgStatusResponse> {\n const { cookieHeader, ...fetchOptions } = options;\n\n const headers: Record<string, string> = { ...(options.headers ?? {}) };\n if (cookieHeader) headers.cookie = cookieHeader;\n\n const data = await apiFetch<unknown>(config, '/api/rpg/status', {\n credentials: 'include',\n cache: 'no-store',\n ...fetchOptions,\n headers,\n });\n\n return RpgStatusResponseSchema.parse(data);\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAElB,SAAS,gBAA0D;AAG5D,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,IAAI,EAAE,OAAO;AAAA,EACb,OAAO,EAAE,OAAO;AAAA,EAChB,aAAa,EAAE,OAAO;AAAA,EACtB,UAAU,EAAE,OAAO;AAAA,EACnB,QAAQ,EAAE,QAAQ;AAAA,EAClB,OAAO,EAAE,KAAK,CAAC,UAAU,UAAU,SAAS,SAAS,CAAC;AAAA,EACtD,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACrC,CAAC;AAGM,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,cAAc,EAAE,QAAQ;AAAA;AAAA,EAExB,eAAe,EAAE,QAAQ;AAAA,EACzB,OAAO,EAAE,MAAM,mBAAmB;AACpC,CAAC;AAYD,eAAsB,eACpB,QACA,UAAiC,CAAC,GACN;AAC5B,QAAM,EAAE,cAAc,GAAG,aAAa,IAAI;AAE1C,QAAM,UAAkC,EAAE,GAAI,QAAQ,WAAW,CAAC,EAAG;AACrE,MAAI,aAAc,SAAQ,SAAS;AAEnC,QAAM,OAAO,MAAM,SAAkB,QAAQ,mBAAmB;AAAA,IAC9D,aAAa;AAAA,IACb,OAAO;AAAA,IACP,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AAED,SAAO,wBAAwB,MAAM,IAAI;AAC3C;","names":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// src/query/fetchers/search.ts
|
|
2
|
+
import { apiFetch } from "../client.js";
|
|
3
|
+
var EMPTY_SEARCH = { profiles: [], total: 0, limit: 20, offset: 0 };
|
|
4
|
+
var EMPTY_FILTERS = { countries: [], industries: [], apps: [], openTo: [] };
|
|
5
|
+
var EMPTY_COMPANY_SEARCH = { results: [], hasMore: false };
|
|
6
|
+
async function fetchSearchProfiles(config, filters, options = {}) {
|
|
7
|
+
const params = new URLSearchParams();
|
|
8
|
+
if (filters.q) params.set("q", filters.q);
|
|
9
|
+
if (filters.skill) params.set("skill", filters.skill);
|
|
10
|
+
if (filters.country) params.set("country", filters.country);
|
|
11
|
+
if (filters.industry) params.set("industry", filters.industry);
|
|
12
|
+
if (filters.domain) params.set("domain", filters.domain);
|
|
13
|
+
if (filters.workplace) params.set("workplace", filters.workplace);
|
|
14
|
+
if (filters.app) params.set("app", filters.app);
|
|
15
|
+
if (filters.openTo && filters.openTo.length > 0) {
|
|
16
|
+
for (const token of filters.openTo) {
|
|
17
|
+
if (token) params.append("openTo", token);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (filters.limit !== void 0) params.set("limit", String(filters.limit));
|
|
21
|
+
if (params.size === 0) return EMPTY_SEARCH;
|
|
22
|
+
return apiFetch(config, `/api/search/profiles?${params.toString()}`, {
|
|
23
|
+
cache: "no-store",
|
|
24
|
+
...options
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function fetchSearchCompanies(config, filters, options = {}) {
|
|
28
|
+
const q = filters.q?.trim();
|
|
29
|
+
if (!q) return EMPTY_COMPANY_SEARCH;
|
|
30
|
+
const params = new URLSearchParams({ q });
|
|
31
|
+
if (filters.country) params.set("country", filters.country);
|
|
32
|
+
if (filters.industry) params.set("industry", filters.industry);
|
|
33
|
+
if (filters.limit !== void 0) params.set("limit", String(filters.limit));
|
|
34
|
+
return apiFetch(config, `/api/search/companies?${params.toString()}`, {
|
|
35
|
+
cache: "no-store",
|
|
36
|
+
...options
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function fetchSkillSuggestions(config, query, options = {}) {
|
|
40
|
+
if (!query.trim()) return [];
|
|
41
|
+
const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;
|
|
42
|
+
const data = await apiFetch(config, path, {
|
|
43
|
+
cache: "no-store",
|
|
44
|
+
...options
|
|
45
|
+
});
|
|
46
|
+
return data.skills ?? [];
|
|
47
|
+
}
|
|
48
|
+
async function fetchSearchFilters(config, options = {}) {
|
|
49
|
+
try {
|
|
50
|
+
return await apiFetch(config, "/api/search/filters", {
|
|
51
|
+
next: { revalidate: 300 },
|
|
52
|
+
...options
|
|
53
|
+
});
|
|
54
|
+
} catch {
|
|
55
|
+
return EMPTY_FILTERS;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function searchSkills(config, query, limit = 10, options = {}) {
|
|
59
|
+
if (!query.trim()) return [];
|
|
60
|
+
const path = `/api/skills/search?q=${encodeURIComponent(query)}&limit=${limit}`;
|
|
61
|
+
try {
|
|
62
|
+
const data = await apiFetch(config, path, {
|
|
63
|
+
cache: "no-store",
|
|
64
|
+
...options
|
|
65
|
+
});
|
|
66
|
+
return data.skills ?? [];
|
|
67
|
+
} catch {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
fetchSearchCompanies,
|
|
73
|
+
fetchSearchFilters,
|
|
74
|
+
fetchSearchProfiles,
|
|
75
|
+
fetchSkillSuggestions,
|
|
76
|
+
searchSkills
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/search.ts"],"sourcesContent":["import type { SkillSuggestion } from '../../types/index.js';\nimport { apiFetch, type ApiFetchOptions, type SifaApiConfig } from '../client.js';\n\n/** Profile entry returned by the search endpoint. */\nexport interface ProfileSearchResult {\n did?: string;\n handle: string;\n displayName?: string;\n headline?: string;\n avatar?: string;\n about?: string;\n currentRole?: string;\n currentCompany?: string;\n industry?: string;\n domain?: string;\n countryCode?: string;\n locationCountry?: string;\n preferredWorkplace?: string[];\n claimed?: boolean;\n blueskyVerified?: boolean;\n blueskyVerifiedAt?: string | null;\n}\n\nexport interface SearchFilters {\n q?: string;\n skill?: string;\n country?: string;\n industry?: string;\n domain?: string;\n workplace?: string;\n app?: string;\n /**\n * Open-to filter. Values are short tokens (e.g. \"fullTime\", \"mentor\",\n * \"collab\") matching `OPEN_TO_OPTIONS[].token` from the taxonomy. The\n * API expands tokens to lex values server-side. Multiple tokens are\n * OR-combined (profile matches if any selected token is set).\n */\n openTo?: string[];\n limit?: number;\n}\n\nexport interface SearchResponse {\n profiles: ProfileSearchResult[];\n total: number;\n limit: number;\n offset: number;\n}\n\n/** Skill typeahead suggestion. */\nexport interface SkillSearchResult {\n name: string;\n slug: string;\n category: string;\n userCount: number;\n}\n\nexport interface FilterOptions {\n countries: { countryCode: string; country: string; count: number }[];\n industries: { industry: string; count: number }[];\n apps: { appId: string; count: number }[];\n /**\n * Distribution of openTo selections across indexed profiles. Each entry\n * maps a short token (see {@link SearchFilters.openTo}) to the number of\n * profiles that have it set. Omitted from older API responses; treat\n * absence as \"no data\" rather than \"all zero\".\n */\n openTo?: { token: string; count: number }[];\n}\n\n/** Company entry returned by company search (workspace#299). */\nexport interface CompanySearchResult {\n /** Immutable catalogue id; the durable `/c/{publicId}` link. */\n publicId: string;\n name: string;\n domain: string | null;\n country: string | null;\n industry: string | null;\n logoUrl: string | null;\n employeeCount: number | null;\n}\n\nexport interface CompanySearchFilters {\n q?: string;\n /** ISO 3166-1 alpha-2. */\n country?: string;\n industry?: string;\n limit?: number;\n}\n\nexport interface CompanySearchResponse {\n results: CompanySearchResult[];\n hasMore: boolean;\n}\n\nconst EMPTY_SEARCH: SearchResponse = { profiles: [], total: 0, limit: 20, offset: 0 };\nconst EMPTY_FILTERS: FilterOptions = { countries: [], industries: [], apps: [], openTo: [] };\nconst EMPTY_COMPANY_SEARCH: CompanySearchResponse = { results: [], hasMore: false };\n\n/**\n * Search profiles by free-text query and optional filters. Returns an\n * empty result set when no filters are provided (matching sifa-web's\n * \"no input, no fetch\" behavior).\n */\nexport async function fetchSearchProfiles(\n config: SifaApiConfig,\n filters: SearchFilters,\n options: ApiFetchOptions = {},\n): Promise<SearchResponse> {\n const params = new URLSearchParams();\n if (filters.q) params.set('q', filters.q);\n if (filters.skill) params.set('skill', filters.skill);\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.domain) params.set('domain', filters.domain);\n if (filters.workplace) params.set('workplace', filters.workplace);\n if (filters.app) params.set('app', filters.app);\n if (filters.openTo && filters.openTo.length > 0) {\n for (const token of filters.openTo) {\n if (token) params.append('openTo', token);\n }\n }\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n if (params.size === 0) return EMPTY_SEARCH;\n\n return apiFetch<SearchResponse>(config, `/api/search/profiles?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Company search over the entity catalogue (workspace#299).\n *\n * A category of its own rather than part of profile search: the two rank\n * differently and carry different filters, and a slow category should not hold\n * up the rest of a blended results page.\n *\n * An empty query returns nothing without a network call. The API rejects a\n * blank `q` rather than scanning ~200k rows, so asking would only spend a round\n * trip to be told no.\n */\nexport async function fetchSearchCompanies(\n config: SifaApiConfig,\n filters: CompanySearchFilters,\n options: ApiFetchOptions = {},\n): Promise<CompanySearchResponse> {\n const q = filters.q?.trim();\n if (!q) return EMPTY_COMPANY_SEARCH;\n\n const params = new URLSearchParams({ q });\n if (filters.country) params.set('country', filters.country);\n if (filters.industry) params.set('industry', filters.industry);\n if (filters.limit !== undefined) params.set('limit', String(filters.limit));\n\n return apiFetch<CompanySearchResponse>(config, `/api/search/companies?${params.toString()}`, {\n cache: 'no-store',\n ...options,\n });\n}\n\n/**\n * Skill typeahead. Returns up to 8 matches for the given prefix. Empty\n * input returns an empty array without hitting the server.\n */\nexport async function fetchSkillSuggestions(\n config: SifaApiConfig,\n query: string,\n options: ApiFetchOptions = {},\n): Promise<SkillSearchResult[]> {\n if (!query.trim()) return [];\n const path = `/api/search/skills?q=${encodeURIComponent(query)}&limit=8`;\n const data = await apiFetch<{ skills?: SkillSearchResult[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n}\n\n/** Available filter facets (countries, industries, apps) for search UI. */\nexport async function fetchSearchFilters(\n config: SifaApiConfig,\n options: ApiFetchOptions = {},\n): Promise<FilterOptions> {\n try {\n return await apiFetch<FilterOptions>(config, '/api/search/filters', {\n next: { revalidate: 300 },\n ...options,\n });\n } catch {\n return EMPTY_FILTERS;\n }\n}\n\n/**\n * Canonical-skill search backing the position-editor and similar\n * skill-pickers. Hits `/api/skills/search` (the canonical-skills DB\n * lookup) which is distinct from {@link fetchSkillSuggestions}'s\n * `/api/search/skills` (the profile-skill typeahead).\n *\n * Returns `[]` on empty input (no network call) or any error.\n */\nexport async function searchSkills(\n config: SifaApiConfig,\n query: string,\n limit = 10,\n options: ApiFetchOptions = {},\n): Promise<SkillSuggestion[]> {\n if (!query.trim()) return [];\n const path = `/api/skills/search?q=${encodeURIComponent(query)}&limit=${limit}`;\n try {\n const data = await apiFetch<{ skills?: SkillSuggestion[] }>(config, path, {\n cache: 'no-store',\n ...options,\n });\n return data.skills ?? [];\n } catch {\n return [];\n }\n}\n"],"mappings":";AACA,SAAS,gBAA0D;AA6FnE,IAAM,eAA+B,EAAE,UAAU,CAAC,GAAG,OAAO,GAAG,OAAO,IAAI,QAAQ,EAAE;AACpF,IAAM,gBAA+B,EAAE,WAAW,CAAC,GAAG,YAAY,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE;AAC3F,IAAM,uBAA8C,EAAE,SAAS,CAAC,GAAG,SAAS,MAAM;AAOlF,eAAsB,oBACpB,QACA,SACA,UAA2B,CAAC,GACH;AACzB,QAAM,SAAS,IAAI,gBAAgB;AACnC,MAAI,QAAQ,EAAG,QAAO,IAAI,KAAK,QAAQ,CAAC;AACxC,MAAI,QAAQ,MAAO,QAAO,IAAI,SAAS,QAAQ,KAAK;AACpD,MAAI,QAAQ,QAAS,QAAO,IAAI,WAAW,QAAQ,OAAO;AAC1D,MAAI,QAAQ,SAAU,QAAO,IAAI,YAAY,QAAQ,QAAQ;AAC7D,MAAI,QAAQ,OAAQ,QAAO,IAAI,UAAU,QAAQ,MAAM;AACvD,MAAI,QAAQ,UAAW,QAAO,IAAI,aAAa,QAAQ,SAAS;AAChE,MAAI,QAAQ,IAAK,QAAO,IAAI,OAAO,QAAQ,GAAG;AAC9C,MAAI,QAAQ,UAAU,QAAQ,OAAO,SAAS,GAAG;AAC/C,eAAW,SAAS,QAAQ,QAAQ;AAClC,UAAI,MAAO,QAAO,OAAO,UAAU,KAAK;AAAA,IAC1C;AAAA,EACF;AACA,MAAI,QAAQ,UAAU,OAAW,QAAO,IAAI,SAAS,OAAO,QAAQ,KAAK,CAAC;AAE1E,MAAI,OAAO,SAAS,EAAG,QAAO;AAE9B,SAAO,SAAyB,QAAQ,wBAAwB,OAAO,SAAS,CAAC,IAAI;AAAA,IACnF,OAAO;AAAA,IACP,GAAG;AAAA,EACL,CAAC;AACH;AAaA,eAAsB,qBACpB,QACA,SACA,UAA2B,CAAC,GACI;AAChC,QAAM,IAAI,QAAQ,GAAG,KAAK;AAC1B,MAAI,CAAC,EAAG,QAAO;AAEf,QAAM,SAAS,IAAI,gBAAgB,EAAE,EAAE,CAAC;AACxC,MAAI,QAAQ,QAAS,QAAO,IAAI,WAAW,QAAQ,OAAO;AAC1D,MAAI,QAAQ,SAAU,QAAO,IAAI,YAAY,QAAQ,QAAQ;AAC7D,MAAI,QAAQ,UAAU,OAAW,QAAO,IAAI,SAAS,OAAO,QAAQ,KAAK,CAAC;AAE1E,SAAO,SAAgC,QAAQ,yBAAyB,OAAO,SAAS,CAAC,IAAI;AAAA,IAC3F,OAAO;AAAA,IACP,GAAG;AAAA,EACL,CAAC;AACH;AAMA,eAAsB,sBACpB,QACA,OACA,UAA2B,CAAC,GACE;AAC9B,MAAI,CAAC,MAAM,KAAK,EAAG,QAAO,CAAC;AAC3B,QAAM,OAAO,wBAAwB,mBAAmB,KAAK,CAAC;AAC9D,QAAM,OAAO,MAAM,SAA2C,QAAQ,MAAM;AAAA,IAC1E,OAAO;AAAA,IACP,GAAG;AAAA,EACL,CAAC;AACD,SAAO,KAAK,UAAU,CAAC;AACzB;AAGA,eAAsB,mBACpB,QACA,UAA2B,CAAC,GACJ;AACxB,MAAI;AACF,WAAO,MAAM,SAAwB,QAAQ,uBAAuB;AAAA,MAClE,MAAM,EAAE,YAAY,IAAI;AAAA,MACxB,GAAG;AAAA,IACL,CAAC;AAAA,EACH,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAUA,eAAsB,aACpB,QACA,OACA,QAAQ,IACR,UAA2B,CAAC,GACA;AAC5B,MAAI,CAAC,MAAM,KAAK,EAAG,QAAO,CAAC;AAC3B,QAAM,OAAO,wBAAwB,mBAAmB,KAAK,CAAC,UAAU,KAAK;AAC7E,MAAI;AACF,UAAM,OAAO,MAAM,SAAyC,QAAQ,MAAM;AAAA,MACxE,OAAO;AAAA,MACP,GAAG;AAAA,IACL,CAAC;AACD,WAAO,KAAK,UAAU,CAAC;AAAA,EACzB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/query/fetchers/section-primary.ts
|
|
2
|
+
import { apiWrite } from "../client.js";
|
|
3
|
+
function setSectionPrimary(config, section, rkey, options = {}) {
|
|
4
|
+
return apiWrite(
|
|
5
|
+
config,
|
|
6
|
+
`/api/profile/${section}/${encodeURIComponent(rkey)}/primary`,
|
|
7
|
+
"PUT",
|
|
8
|
+
options
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
function unsetSectionPrimary(config, section, rkey, options = {}) {
|
|
12
|
+
return apiWrite(
|
|
13
|
+
config,
|
|
14
|
+
`/api/profile/${section}/${encodeURIComponent(rkey)}/primary`,
|
|
15
|
+
"DELETE",
|
|
16
|
+
options
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
setSectionPrimary,
|
|
21
|
+
unsetSectionPrimary
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=section-primary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/query/fetchers/section-primary.ts"],"sourcesContent":["import { apiWrite, type ApiFetchOptions, type SifaApiConfig, type WriteResult } from '../client.js';\n\n/**\n * Profile sections that support a user-chosen primary item feeding the Highlights\n * block. `position` is excluded: it predates this and keeps its own dedicated\n * endpoint (`setPositionPrimary` / `unsetPositionPrimary` in `positions.ts`).\n */\nexport type PrimarySection =\n 'education' | 'publication' | 'presentation' | 'involvement' | 'project';\n\n/**\n * Mark a section record as the user's primary item for that section. The AppView\n * flips `isPrimary` on the record via the user's OAuth session, clears the flag on\n * any sibling in the same section, and enforces the per-section eligibility rule.\n *\n * Never throws: inspect `result.success` and use `result.error` for UI messaging.\n */\nexport function setSectionPrimary(\n config: SifaApiConfig,\n section: PrimarySection,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/${section}/${encodeURIComponent(rkey)}/primary`,\n 'PUT',\n options,\n );\n}\n\n/** Clear the primary flag on a section record. */\nexport function unsetSectionPrimary(\n config: SifaApiConfig,\n section: PrimarySection,\n rkey: string,\n options: ApiFetchOptions = {},\n): Promise<WriteResult> {\n return apiWrite(\n config,\n `/api/profile/${section}/${encodeURIComponent(rkey)}/primary`,\n 'DELETE',\n options,\n );\n}\n"],"mappings":";AAAA,SAAS,gBAA4E;AAiB9E,SAAS,kBACd,QACA,SACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO;AAAA,IACL;AAAA,IACA,gBAAgB,OAAO,IAAI,mBAAmB,IAAI,CAAC;AAAA,IACnD;AAAA,IACA;AAAA,EACF;AACF;AAGO,SAAS,oBACd,QACA,SACA,MACA,UAA2B,CAAC,GACN;AACtB,SAAO;AAAA,IACL;AAAA,IACA,gBAAgB,OAAO,IAAI,mBAAmB,IAAI,CAAC;AAAA,IACnD;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|