@singi-labs/sifa-sdk 0.18.15 → 0.18.17

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.
Files changed (49) hide show
  1. package/dist/{index-DIwi3bpk.d.cts → index-E2qQbMnv.d.cts} +10 -0
  2. package/dist/{index-DIwi3bpk.d.ts → index-E2qQbMnv.d.ts} +10 -0
  3. package/dist/index.cjs +187 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +90 -7
  6. package/dist/index.d.ts +90 -7
  7. package/dist/index.js +182 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/jsonld/index.d.cts +1 -1
  10. package/dist/jsonld/index.d.ts +1 -1
  11. package/dist/{network-map-CfAPUSb6.d.ts → network-map-BYdQF1tr.d.ts} +4 -4
  12. package/dist/{network-map-B2VRYlgb.d.cts → network-map-BdDqR9-B.d.cts} +4 -4
  13. package/dist/{org-C3e5hz3h.d.ts → org-BftCzySH.d.ts} +20 -3
  14. package/dist/{org-CLi7-wje.d.cts → org-DhAmipS-.d.cts} +20 -3
  15. package/dist/{profile-investment-CIG7Hy8g.d.cts → profile-investment-vmHROP_v.d.cts} +5 -0
  16. package/dist/{profile-investment-CIG7Hy8g.d.ts → profile-investment-vmHROP_v.d.ts} +5 -0
  17. package/dist/{profile-summary-B9EQmnC7.d.cts → profile-summary-BeiM3TmH.d.cts} +1 -1
  18. package/dist/{profile-summary-nbzILRkf.d.ts → profile-summary-CKAuwczF.d.ts} +1 -1
  19. package/dist/query/fetchers/index.cjs +22 -0
  20. package/dist/query/fetchers/index.cjs.map +1 -1
  21. package/dist/query/fetchers/index.d.cts +6 -6
  22. package/dist/query/fetchers/index.d.ts +6 -6
  23. package/dist/query/fetchers/index.js +21 -1
  24. package/dist/query/fetchers/index.js.map +1 -1
  25. package/dist/query/hooks/index.cjs +85 -24
  26. package/dist/query/hooks/index.cjs.map +1 -1
  27. package/dist/query/hooks/index.d.cts +5 -5
  28. package/dist/query/hooks/index.d.ts +5 -5
  29. package/dist/query/hooks/index.js +84 -25
  30. package/dist/query/hooks/index.js.map +1 -1
  31. package/dist/query/index.cjs +82 -23
  32. package/dist/query/index.cjs.map +1 -1
  33. package/dist/query/index.d.cts +8 -8
  34. package/dist/query/index.d.ts +8 -8
  35. package/dist/query/index.js +79 -24
  36. package/dist/query/index.js.map +1 -1
  37. package/dist/resume/index.d.cts +1 -1
  38. package/dist/resume/index.d.ts +1 -1
  39. package/dist/schemas/index.cjs +5 -0
  40. package/dist/schemas/index.cjs.map +1 -1
  41. package/dist/schemas/index.d.cts +1 -1
  42. package/dist/schemas/index.d.ts +1 -1
  43. package/dist/schemas/index.js +5 -0
  44. package/dist/schemas/index.js.map +1 -1
  45. package/dist/{types-XejLm3AA.d.cts → types-2qTC_DBy.d.cts} +6 -1
  46. package/dist/{types-DqVbTzXo.d.ts → types-CLrLfvXz.d.ts} +6 -1
  47. package/dist/{use-org-notification-emails-DHLosH0F.d.cts → use-org-notification-emails-CR2PDfjF.d.cts} +13 -4
  48. package/dist/{use-org-notification-emails-6VO57byN.d.ts → use-org-notification-emails-CxBtveF9.d.ts} +13 -4
  49. package/package.json +1 -1
@@ -89,6 +89,8 @@ interface ProfileEducation {
89
89
  startedAt?: string;
90
90
  endedAt?: string;
91
91
  hidden?: boolean;
92
+ /** User-flagged primary education entry, surfaced in the Highlights block. */
93
+ primary?: boolean;
92
94
  }
93
95
  interface ProfileSkill {
94
96
  rkey: string;
@@ -205,6 +207,8 @@ interface ProfileProject {
205
207
  /** AT-URI of the same record on another person's profile, when they keep one. */
206
208
  sameAs?: string;
207
209
  hidden?: boolean;
210
+ /** User-flagged primary project, surfaced in the Highlights block. Ongoing only. */
211
+ primary?: boolean;
208
212
  }
209
213
  interface PublicationContributor {
210
214
  name: string;
@@ -248,6 +252,8 @@ interface ProfilePublication {
248
252
  verifiedVia?: string;
249
253
  orcidPutCode?: number;
250
254
  hidden?: boolean;
255
+ /** User-flagged primary publication, surfaced in the Highlights block. */
256
+ primary?: boolean;
251
257
  orcidCorroborated?: boolean;
252
258
  pendingVerification?: boolean;
253
259
  appId?: string;
@@ -408,6 +414,8 @@ interface ProfileInvolvement {
408
414
  */
409
415
  legacy?: boolean;
410
416
  hidden?: boolean;
417
+ /** User-flagged primary involvement, surfaced in the Highlights block. Ongoing only. */
418
+ primary?: boolean;
411
419
  /** Other people named on this involvement, hydrated from the stored DIDs. */
412
420
  collaborators?: ProjectMemberCard[];
413
421
  /** AT-URI of the same involvement as recorded on another person's profile. */
@@ -551,6 +559,8 @@ interface ProfilePresentation {
551
559
  /** Resolved URL of the uploaded cover image, when present. */
552
560
  coverImageUrl?: string | null;
553
561
  hidden?: boolean;
562
+ /** User-flagged primary talk, surfaced in the Highlights block. Talks only, not sessions. */
563
+ primary?: boolean;
554
564
  deliveries?: ProfilePresentationDelivery[];
555
565
  }
556
566
  interface TrustStat {
@@ -89,6 +89,8 @@ interface ProfileEducation {
89
89
  startedAt?: string;
90
90
  endedAt?: string;
91
91
  hidden?: boolean;
92
+ /** User-flagged primary education entry, surfaced in the Highlights block. */
93
+ primary?: boolean;
92
94
  }
93
95
  interface ProfileSkill {
94
96
  rkey: string;
@@ -205,6 +207,8 @@ interface ProfileProject {
205
207
  /** AT-URI of the same record on another person's profile, when they keep one. */
206
208
  sameAs?: string;
207
209
  hidden?: boolean;
210
+ /** User-flagged primary project, surfaced in the Highlights block. Ongoing only. */
211
+ primary?: boolean;
208
212
  }
209
213
  interface PublicationContributor {
210
214
  name: string;
@@ -248,6 +252,8 @@ interface ProfilePublication {
248
252
  verifiedVia?: string;
249
253
  orcidPutCode?: number;
250
254
  hidden?: boolean;
255
+ /** User-flagged primary publication, surfaced in the Highlights block. */
256
+ primary?: boolean;
251
257
  orcidCorroborated?: boolean;
252
258
  pendingVerification?: boolean;
253
259
  appId?: string;
@@ -408,6 +414,8 @@ interface ProfileInvolvement {
408
414
  */
409
415
  legacy?: boolean;
410
416
  hidden?: boolean;
417
+ /** User-flagged primary involvement, surfaced in the Highlights block. Ongoing only. */
418
+ primary?: boolean;
411
419
  /** Other people named on this involvement, hydrated from the stored DIDs. */
412
420
  collaborators?: ProjectMemberCard[];
413
421
  /** AT-URI of the same involvement as recorded on another person's profile. */
@@ -551,6 +559,8 @@ interface ProfilePresentation {
551
559
  /** Resolved URL of the uploaded cover image, when present. */
552
560
  coverImageUrl?: string | null;
553
561
  hidden?: boolean;
562
+ /** User-flagged primary talk, surfaced in the Highlights block. Talks only, not sessions. */
563
+ primary?: boolean;
554
564
  deliveries?: ProfilePresentationDelivery[];
555
565
  }
556
566
  interface TrustStat {
package/dist/index.cjs CHANGED
@@ -5085,6 +5085,12 @@ function countFilledDimensions(input) {
5085
5085
  return n;
5086
5086
  }
5087
5087
 
5088
+ // src/logic/primary-item.ts
5089
+ function pickPrimaryFlagged(items, isEligible = () => true) {
5090
+ if (!items || items.length === 0) return void 0;
5091
+ return items.find((item) => item.primary === true && !item.hidden && isEligible(item));
5092
+ }
5093
+
5088
5094
  // src/logic/profile-summary.ts
5089
5095
  var DEFAULT_MAX_SKILLS = 5;
5090
5096
  function summarizeProfileView(view, options = {}) {
@@ -5406,6 +5412,175 @@ function groupInvolvementByHeading(items) {
5406
5412
  }
5407
5413
  return groups;
5408
5414
  }
5415
+
5416
+ // src/profile/highlights.ts
5417
+ function coPeopleLabel(people, self) {
5418
+ const names = (people ?? []).filter((p) => p.did !== self.did && (!p.handle || p.handle !== self.handle)).map((p) => p.displayName ?? p.name ?? p.handle).filter((n) => Boolean(n && n.trim()));
5419
+ return names.length ? `with ${names.join(", ")}` : void 0;
5420
+ }
5421
+ var EN_DASH = "\u2013";
5422
+ function visible(items) {
5423
+ return (items ?? []).filter((i) => !i.hidden);
5424
+ }
5425
+ function metaLine(parts) {
5426
+ const kept = parts.filter((p) => Boolean(p && p.trim()));
5427
+ return kept.length ? kept.join(" \xB7 ") : void 0;
5428
+ }
5429
+ function formatSpanDate(start, end) {
5430
+ if (start && !end) return `Since ${formatTimelineDate(start)}`;
5431
+ if (!start && !end) return void 0;
5432
+ if (!start) return formatTimelineDate(end);
5433
+ const a = formatTimelineDate(start);
5434
+ const b = formatTimelineDate(end);
5435
+ return a === b ? a : `${a} ${EN_DASH} ${b}`;
5436
+ }
5437
+ function formatSingleDate(date) {
5438
+ return date ? formatTimelineDate(date) : void 0;
5439
+ }
5440
+ var EVENT_DAY_FMT = new Intl.DateTimeFormat("en", {
5441
+ year: "numeric",
5442
+ month: "short",
5443
+ day: "numeric",
5444
+ timeZone: "UTC"
5445
+ });
5446
+ function formatEventDate(date) {
5447
+ if (!date) return void 0;
5448
+ if (date.length === 10) {
5449
+ const d = /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
5450
+ if (!Number.isNaN(d.getTime())) return EVENT_DAY_FMT.format(d);
5451
+ }
5452
+ return formatTimelineDate(date);
5453
+ }
5454
+ function pickTalk(presentations, deliveries, today, self) {
5455
+ const talkRkeys = new Set(presentations.map((p) => p.rkey));
5456
+ const occasions = [];
5457
+ for (const p of presentations) {
5458
+ const dated = visible(p.deliveries).filter((d) => d.date);
5459
+ if (!dated.length) continue;
5460
+ const date = dated.reduce((max, d) => d.date && d.date > max ? d.date : max, "");
5461
+ const delivery2 = dated.find((d) => d.date === date);
5462
+ if (!delivery2) continue;
5463
+ occasions.push({ date, title: p.title, delivery: delivery2, imageUrl: p.coverImageUrl ?? void 0 });
5464
+ }
5465
+ for (const d of deliveries) {
5466
+ const standalone = !d.presentationRkey || !talkRkeys.has(d.presentationRkey);
5467
+ if (!standalone || !d.date || d.hidden) continue;
5468
+ occasions.push({ date: d.date, title: d.title || d.eventName || "Talk", delivery: d });
5469
+ }
5470
+ if (!occasions.length) return void 0;
5471
+ const best = occasions.reduce((a, b) => b.date > a.date ? b : a);
5472
+ const { delivery } = best;
5473
+ return {
5474
+ section: "talk",
5475
+ href: "#presentations",
5476
+ title: best.title,
5477
+ meta: metaLine([
5478
+ delivery.eventName,
5479
+ delivery.location,
5480
+ getPresentationRoleLabel(delivery.role ?? void 0),
5481
+ getCalendarEventModeLabel(delivery.mode ?? void 0),
5482
+ coPeopleLabel(delivery.coSpeakers, self)
5483
+ ]),
5484
+ dateStr: formatEventDate(best.date),
5485
+ imageUrl: best.imageUrl,
5486
+ status: best.date > today ? "upcoming" : "recent"
5487
+ };
5488
+ }
5489
+ function buildProfileHighlights(profile, { today }) {
5490
+ const row1 = [];
5491
+ const row2 = [];
5492
+ const self = { did: profile.did, handle: profile.handle };
5493
+ const talk = pickTalk(
5494
+ visible(profile.presentations),
5495
+ visible(profile.presentationDeliveries),
5496
+ today,
5497
+ self
5498
+ );
5499
+ if (talk) row1.push(talk);
5500
+ const publication = sortByDateDesc(visible(profile.publications), singleDateExtractor)[0];
5501
+ if (publication) {
5502
+ const venue = publication.publicationName ?? publication.publisher;
5503
+ const coAuthors = coPeopleLabel(publication.contributors, self);
5504
+ const venueIsSelf = venue === profile.handle || !!profile.displayName && venue === profile.displayName && !coAuthors;
5505
+ row1.push({
5506
+ section: "publication",
5507
+ href: "#publications",
5508
+ title: publication.title,
5509
+ meta: metaLine([coAuthors, venue && !venueIsSelf ? venue : void 0, publication.subtitle]),
5510
+ dateStr: formatSingleDate(publication.date),
5511
+ imageUrl: publication.image ?? void 0,
5512
+ status: "recent"
5513
+ });
5514
+ }
5515
+ const positions = visible(profile.positions);
5516
+ const career = pickPrimaryPosition(positions) ?? sortByDateDesc(positions, lexiconDateExtractor)[0];
5517
+ if (career) {
5518
+ row2.push({
5519
+ section: "career",
5520
+ href: "#career",
5521
+ title: career.title,
5522
+ meta: metaLine([career.entityName ?? career.company]),
5523
+ dateStr: formatSpanDate(career.startedAt, career.endedAt),
5524
+ status: career.endedAt ? "recent" : "current"
5525
+ });
5526
+ }
5527
+ const education = sortByDateDesc(visible(profile.education), lexiconDateExtractor)[0];
5528
+ if (education) {
5529
+ const institution = education.entityName ?? education.institution;
5530
+ const title = education.degree || education.fieldOfStudy || institution || "Education";
5531
+ row2.push({
5532
+ section: "education",
5533
+ href: "#education",
5534
+ title,
5535
+ meta: metaLine([title === institution ? void 0 : institution]),
5536
+ dateStr: formatSpanDate(education.startedAt, education.endedAt),
5537
+ status: education.endedAt ? "recent" : "current"
5538
+ });
5539
+ } else {
5540
+ const course = visible(profile.courses)[0];
5541
+ if (course) {
5542
+ row2.push({
5543
+ section: "education",
5544
+ href: "#courses",
5545
+ title: course.name,
5546
+ meta: metaLine([course.entityName ?? course.institution]),
5547
+ dateStr: formatSingleDate(course.completedAt),
5548
+ status: "recent"
5549
+ });
5550
+ }
5551
+ }
5552
+ const ongoingProjects = visible(profile.projects).filter((p) => !p.endDate);
5553
+ const project = sortByDateDesc(ongoingProjects, dateRangeExtractor)[0];
5554
+ if (project) {
5555
+ row2.push({
5556
+ section: "project",
5557
+ href: "#projects",
5558
+ title: project.name,
5559
+ meta: coPeopleLabel(project.members, self),
5560
+ dateStr: formatSpanDate(project.startDate, project.endDate),
5561
+ status: "current"
5562
+ });
5563
+ }
5564
+ const ongoingInvolvement = visible(profile.involvement).filter((i) => !i.endedAt);
5565
+ const involvement = sortByDateDesc(ongoingInvolvement, lexiconDateExtractor)[0];
5566
+ if (involvement) {
5567
+ row2.push({
5568
+ section: "involvement",
5569
+ href: "#involvement",
5570
+ title: involvement.role || involvement.kind || "Involvement",
5571
+ meta: metaLine([
5572
+ involvement.entityName ?? involvement.upstream,
5573
+ coPeopleLabel(involvement.collaborators, self)
5574
+ ]),
5575
+ dateStr: formatSpanDate(involvement.startedAt, involvement.endedAt),
5576
+ status: "current"
5577
+ });
5578
+ }
5579
+ return { row1, row2 };
5580
+ }
5581
+ function shouldRenderHighlights(rows) {
5582
+ return rows.row1.length + rows.row2.length >= 2;
5583
+ }
5409
5584
  var BlobRefSchema = zod.z.object({
5410
5585
  $type: zod.z.literal("blob"),
5411
5586
  ref: zod.z.object({ $link: zod.z.string().min(1) }),
@@ -5687,6 +5862,7 @@ var ProfileEducationRecordSchema = zod.z.object({
5687
5862
  startedAt: partialDateSchema.optional(),
5688
5863
  endedAt: partialDateSchema.optional(),
5689
5864
  labels: selfLabelsSchema.optional(),
5865
+ isPrimary: zod.z.boolean().optional(),
5690
5866
  createdAt: datetimeSchema
5691
5867
  });
5692
5868
  var ProfileExternalAccountRecordSchema = zod.z.object({
@@ -5734,6 +5910,7 @@ var ProfileProjectRecordSchema = zod.z.object({
5734
5910
  startedAt: partialDateSchema.optional(),
5735
5911
  endedAt: partialDateSchema.optional(),
5736
5912
  labels: selfLabelsSchema.optional(),
5913
+ isPrimary: zod.z.boolean().optional(),
5737
5914
  createdAt: datetimeSchema
5738
5915
  });
5739
5916
 
@@ -5764,6 +5941,7 @@ var ProfileInvolvementRecordSchema = zod.z.object({
5764
5941
  labels: selfLabelsSchema.optional(),
5765
5942
  collaborators: zod.z.array(projectMemberRefSchema).max(50).optional(),
5766
5943
  sameAs: externalRecordRefSchema.optional(),
5944
+ isPrimary: zod.z.boolean().optional(),
5767
5945
  createdAt: datetimeSchema
5768
5946
  }).passthrough();
5769
5947
  var ProfileLanguageRecordSchema = zod.z.object({
@@ -5822,6 +6000,7 @@ var ProfilePresentationRecordSchema = zod.z.object({
5822
6000
  writeupRef: externalRecordRefSchema.optional(),
5823
6001
  // Optional uploaded cover image for the talk page.
5824
6002
  coverImage: BlobRefSchema.optional(),
6003
+ isPrimary: zod.z.boolean().optional(),
5825
6004
  createdAt: datetimeSchema
5826
6005
  });
5827
6006
  var communityAddressSchema = zod.z.object({
@@ -5866,6 +6045,7 @@ var ProfilePublicationRecordSchema = zod.z.object({
5866
6045
  description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
5867
6046
  authors: zod.z.array(PublicationAuthorSchema).max(50).optional(),
5868
6047
  publishedAt: partialDateSchema.optional(),
6048
+ isPrimary: zod.z.boolean().optional(),
5869
6049
  createdAt: datetimeSchema
5870
6050
  });
5871
6051
  var ProfileSelfRecordSchema = zod.z.object({
@@ -6227,7 +6407,7 @@ function describeSifaRecord(collection, value) {
6227
6407
  }
6228
6408
 
6229
6409
  // src/index.ts
6230
- var SIFA_SDK_VERSION = "0.18.15";
6410
+ var SIFA_SDK_VERSION = "0.18.17";
6231
6411
 
6232
6412
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
6233
6413
  exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
@@ -6344,6 +6524,7 @@ exports.actorShowsIdentity = actorShowsIdentity;
6344
6524
  exports.agentRefSchema = agentRefSchema;
6345
6525
  exports.atUriSchema = atUriSchema;
6346
6526
  exports.buildMetaDescription = buildMetaDescription;
6527
+ exports.buildProfileHighlights = buildProfileHighlights;
6347
6528
  exports.buildTalkSlug = buildTalkSlug;
6348
6529
  exports.categoryForApp = categoryForApp;
6349
6530
  exports.certDateExtractor = certDateExtractor;
@@ -6375,9 +6556,12 @@ exports.formatCompanyName = formatCompanyName;
6375
6556
  exports.formatDateRange = formatDateRange;
6376
6557
  exports.formatDisplayUrl = formatDisplayUrl;
6377
6558
  exports.formatDistanceToNow = formatDistanceToNow;
6559
+ exports.formatEventDate = formatEventDate;
6378
6560
  exports.formatLocation = formatLocation;
6379
6561
  exports.formatPresentationDuration = formatPresentationDuration;
6380
6562
  exports.formatRelativeTime = formatRelativeTime;
6563
+ exports.formatSingleDate = formatSingleDate;
6564
+ exports.formatSpanDate = formatSpanDate;
6381
6565
  exports.formatTimelineDate = formatTimelineDate;
6382
6566
  exports.getActivityTaxonomyVersion = getActivityTaxonomyVersion;
6383
6567
  exports.getActivityTier = getActivityTier;
@@ -6459,6 +6643,7 @@ exports.parsePresentationDuration = parsePresentationDuration;
6459
6643
  exports.parseTalkRkey = parseTalkRkey;
6460
6644
  exports.partialDateSchema = partialDateSchema;
6461
6645
  exports.pdsProviderFromApi = pdsProviderFromApi;
6646
+ exports.pickPrimaryFlagged = pickPrimaryFlagged;
6462
6647
  exports.pickPrimaryPosition = pickPrimaryPosition;
6463
6648
  exports.presentationCsvRowToRecord = presentationCsvRowToRecord;
6464
6649
  exports.presentationDeliveryCsvRowToRecord = presentationDeliveryCsvRowToRecord;
@@ -6481,6 +6666,7 @@ exports.sanitizeDisplayText = sanitizeDisplayText;
6481
6666
  exports.sanitizeHandleInput = sanitizeHandleInput;
6482
6667
  exports.searchResultDisambiguation = searchResultDisambiguation;
6483
6668
  exports.selfLabelsSchema = selfLabelsSchema;
6669
+ exports.shouldRenderHighlights = shouldRenderHighlights;
6484
6670
  exports.singleDateExtractor = singleDateExtractor;
6485
6671
  exports.skillRefSchema = skillRefSchema;
6486
6672
  exports.slugifyTitle = slugifyTitle;