@singi-labs/sifa-sdk 0.12.21 → 0.12.23

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.
@@ -1,4 +1,4 @@
1
- import { E as ExternalAccount, S as SkillSuggestion, a as ActivityLabel } from './adult-content-C9gi0C_Q.js';
1
+ import { E as ExternalAccount, S as SkillSuggestion, a as ActivityLabel } from './adult-content-DdY7S5nN.js';
2
2
  import { F as FollowFeedPage, a as FollowProfileItem, b as FeatureAllowlistEntry, c as FeatureFlag } from './feed-D2ZV8Eaj.js';
3
3
  import { f as OrgNotificationEmailRequestInput, b as OrgDomainChallengeRequestInput, O as OrgClaimRequestInput, h as OrgProfileUpdateRequestInput, d as OrgDomainVerifyRequestInput } from './org-settings-CmaSX5ZI.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { E as ExternalAccount, S as SkillSuggestion, a as ActivityLabel } from './adult-content-C9gi0C_Q.cjs';
1
+ import { E as ExternalAccount, S as SkillSuggestion, a as ActivityLabel } from './adult-content-DdY7S5nN.cjs';
2
2
  import { F as FollowFeedPage, a as FollowProfileItem, b as FeatureAllowlistEntry, c as FeatureFlag } from './feed-D2ZV8Eaj.cjs';
3
3
  import { f as OrgNotificationEmailRequestInput, b as OrgDomainChallengeRequestInput, O as OrgClaimRequestInput, h as OrgProfileUpdateRequestInput, d as OrgDomainVerifyRequestInput } from './org-settings-CmaSX5ZI.cjs';
4
4
 
@@ -0,0 +1,39 @@
1
+ import { P as ProfileView } from './adult-content-DdY7S5nN.js';
2
+
3
+ /**
4
+ * Compact professional summary derived from a {@link ProfileView}.
5
+ *
6
+ * The full `id.sifa.getProfileView` payload carries every section (all
7
+ * positions, education, skills, publications, talks, and more). Third-party
8
+ * surfaces that only want to show "who is this, what do they do now" — a badge,
9
+ * a maintainer card, a byline — need a much smaller shape. This is that shape,
10
+ * derived with the same canonical rules the Sifa web app uses (see
11
+ * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.
12
+ *
13
+ * Pure and I/O-free: pass it a view you already fetched. For the fetch +
14
+ * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.
15
+ */
16
+
17
+ interface ProfileSummary {
18
+ did: string;
19
+ handle: string;
20
+ displayName?: string;
21
+ avatar?: string;
22
+ pronouns?: string;
23
+ headline?: string;
24
+ /** Title of the current primary role, if the person has an active position. */
25
+ currentTitle?: string;
26
+ /** Current employer: the resolved entity name when linked, else the free-text company. */
27
+ currentCompany?: string;
28
+ /** Skill names in the order the AppView returns them, capped by `maxSkills`. */
29
+ topSkills: string[];
30
+ /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */
31
+ claimed: boolean;
32
+ }
33
+ interface SummarizeProfileViewOptions {
34
+ /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */
35
+ maxSkills?: number;
36
+ }
37
+ declare function summarizeProfileView(view: ProfileView, options?: SummarizeProfileViewOptions): ProfileSummary;
38
+
39
+ export { type ProfileSummary as P, type SummarizeProfileViewOptions as S, summarizeProfileView as s };
@@ -0,0 +1,39 @@
1
+ import { P as ProfileView } from './adult-content-DdY7S5nN.cjs';
2
+
3
+ /**
4
+ * Compact professional summary derived from a {@link ProfileView}.
5
+ *
6
+ * The full `id.sifa.getProfileView` payload carries every section (all
7
+ * positions, education, skills, publications, talks, and more). Third-party
8
+ * surfaces that only want to show "who is this, what do they do now" — a badge,
9
+ * a maintainer card, a byline — need a much smaller shape. This is that shape,
10
+ * derived with the same canonical rules the Sifa web app uses (see
11
+ * {@link pickPrimaryPosition}) so an embedded summary matches the profile page.
12
+ *
13
+ * Pure and I/O-free: pass it a view you already fetched. For the fetch +
14
+ * summarize convenience, use `fetchProfileSummary` from `@singi-labs/sifa-sdk`.
15
+ */
16
+
17
+ interface ProfileSummary {
18
+ did: string;
19
+ handle: string;
20
+ displayName?: string;
21
+ avatar?: string;
22
+ pronouns?: string;
23
+ headline?: string;
24
+ /** Title of the current primary role, if the person has an active position. */
25
+ currentTitle?: string;
26
+ /** Current employer: the resolved entity name when linked, else the free-text company. */
27
+ currentCompany?: string;
28
+ /** Skill names in the order the AppView returns them, capped by `maxSkills`. */
29
+ topSkills: string[];
30
+ /** Whether the profile is claimed by its owner (vs an unclaimed placeholder). */
31
+ claimed: boolean;
32
+ }
33
+ interface SummarizeProfileViewOptions {
34
+ /** Maximum number of skills to include in `topSkills`. Default 5; negatives clamp to 0. */
35
+ maxSkills?: number;
36
+ }
37
+ declare function summarizeProfileView(view: ProfileView, options?: SummarizeProfileViewOptions): ProfileSummary;
38
+
39
+ export { type ProfileSummary as P, type SummarizeProfileViewOptions as S, summarizeProfileView as s };
@@ -1245,6 +1245,42 @@ function removeOrgNotificationEmail(config, body, options = {}) {
1245
1245
  );
1246
1246
  }
1247
1247
 
1248
+ // src/logic/primary-position.ts
1249
+ function pickPrimaryPosition(positions) {
1250
+ if (!positions || positions.length === 0) return void 0;
1251
+ const active = positions.filter((p) => !p.endedAt);
1252
+ if (active.length === 0) return void 0;
1253
+ const flagged = active.find((p) => p.primary === true);
1254
+ if (flagged) return flagged;
1255
+ return [...active].sort((a, b) => (b.startedAt ?? "").localeCompare(a.startedAt ?? ""))[0];
1256
+ }
1257
+
1258
+ // src/logic/profile-summary.ts
1259
+ var DEFAULT_MAX_SKILLS = 5;
1260
+ function summarizeProfileView(view, options = {}) {
1261
+ const limit = Math.max(0, options.maxSkills ?? DEFAULT_MAX_SKILLS);
1262
+ const primary = pickPrimaryPosition(view.positions);
1263
+ return {
1264
+ did: view.did,
1265
+ handle: view.handle,
1266
+ displayName: view.displayName,
1267
+ avatar: view.avatar,
1268
+ pronouns: view.pronouns,
1269
+ headline: view.headline,
1270
+ currentTitle: primary?.title,
1271
+ currentCompany: primary ? primary.entityName ?? primary.company : void 0,
1272
+ topSkills: (view.skills ?? []).slice(0, limit).map((s) => s.name),
1273
+ claimed: view.claimed ?? false
1274
+ };
1275
+ }
1276
+
1277
+ // src/query/fetchers/profile-summary.ts
1278
+ async function fetchProfileSummary(config, actor, options = {}) {
1279
+ const { maxSkills, ...fetchOptions } = options;
1280
+ const view = await fetchGetProfileView(config, actor, fetchOptions);
1281
+ return view ? summarizeProfileView(view, { maxSkills }) : null;
1282
+ }
1283
+
1248
1284
  // src/query/keys.ts
1249
1285
  var sifaQueryKeys = {
1250
1286
  all: () => ["sifa"],
@@ -1379,6 +1415,7 @@ exports.fetchMyRoadmapVotes = fetchMyRoadmapVotes;
1379
1415
  exports.fetchNetworkMap = fetchNetworkMap;
1380
1416
  exports.fetchNetworkStreamCount = fetchNetworkStreamCount;
1381
1417
  exports.fetchProfile = fetchProfile;
1418
+ exports.fetchProfileSummary = fetchProfileSummary;
1382
1419
  exports.fetchReactionStatus = fetchReactionStatus;
1383
1420
  exports.fetchRoadmapVotes = fetchRoadmapVotes;
1384
1421
  exports.fetchSearchFilters = fetchSearchFilters;