@singi-labs/sifa-sdk 0.18.16 → 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.
- package/dist/index.cjs +175 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +171 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5412,6 +5412,175 @@ function groupInvolvementByHeading(items) {
|
|
|
5412
5412
|
}
|
|
5413
5413
|
return groups;
|
|
5414
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
|
+
}
|
|
5415
5584
|
var BlobRefSchema = zod.z.object({
|
|
5416
5585
|
$type: zod.z.literal("blob"),
|
|
5417
5586
|
ref: zod.z.object({ $link: zod.z.string().min(1) }),
|
|
@@ -6238,7 +6407,7 @@ function describeSifaRecord(collection, value) {
|
|
|
6238
6407
|
}
|
|
6239
6408
|
|
|
6240
6409
|
// src/index.ts
|
|
6241
|
-
var SIFA_SDK_VERSION = "0.18.
|
|
6410
|
+
var SIFA_SDK_VERSION = "0.18.17";
|
|
6242
6411
|
|
|
6243
6412
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
6244
6413
|
exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
|
|
@@ -6355,6 +6524,7 @@ exports.actorShowsIdentity = actorShowsIdentity;
|
|
|
6355
6524
|
exports.agentRefSchema = agentRefSchema;
|
|
6356
6525
|
exports.atUriSchema = atUriSchema;
|
|
6357
6526
|
exports.buildMetaDescription = buildMetaDescription;
|
|
6527
|
+
exports.buildProfileHighlights = buildProfileHighlights;
|
|
6358
6528
|
exports.buildTalkSlug = buildTalkSlug;
|
|
6359
6529
|
exports.categoryForApp = categoryForApp;
|
|
6360
6530
|
exports.certDateExtractor = certDateExtractor;
|
|
@@ -6386,9 +6556,12 @@ exports.formatCompanyName = formatCompanyName;
|
|
|
6386
6556
|
exports.formatDateRange = formatDateRange;
|
|
6387
6557
|
exports.formatDisplayUrl = formatDisplayUrl;
|
|
6388
6558
|
exports.formatDistanceToNow = formatDistanceToNow;
|
|
6559
|
+
exports.formatEventDate = formatEventDate;
|
|
6389
6560
|
exports.formatLocation = formatLocation;
|
|
6390
6561
|
exports.formatPresentationDuration = formatPresentationDuration;
|
|
6391
6562
|
exports.formatRelativeTime = formatRelativeTime;
|
|
6563
|
+
exports.formatSingleDate = formatSingleDate;
|
|
6564
|
+
exports.formatSpanDate = formatSpanDate;
|
|
6392
6565
|
exports.formatTimelineDate = formatTimelineDate;
|
|
6393
6566
|
exports.getActivityTaxonomyVersion = getActivityTaxonomyVersion;
|
|
6394
6567
|
exports.getActivityTier = getActivityTier;
|
|
@@ -6493,6 +6666,7 @@ exports.sanitizeDisplayText = sanitizeDisplayText;
|
|
|
6493
6666
|
exports.sanitizeHandleInput = sanitizeHandleInput;
|
|
6494
6667
|
exports.searchResultDisambiguation = searchResultDisambiguation;
|
|
6495
6668
|
exports.selfLabelsSchema = selfLabelsSchema;
|
|
6669
|
+
exports.shouldRenderHighlights = shouldRenderHighlights;
|
|
6496
6670
|
exports.singleDateExtractor = singleDateExtractor;
|
|
6497
6671
|
exports.skillRefSchema = skillRefSchema;
|
|
6498
6672
|
exports.slugifyTitle = slugifyTitle;
|