@singi-labs/sifa-sdk 0.12.0 → 0.12.2

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.js CHANGED
@@ -1705,6 +1705,25 @@ function formatPresentationDuration(duration) {
1705
1705
  return `${minMinutes} min`;
1706
1706
  }
1707
1707
 
1708
+ // src/format/timeline.ts
1709
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
1710
+ function formatTimelineDate(dateStr) {
1711
+ if (dateStr.length === 4) return dateStr;
1712
+ const [year, month] = dateStr.split("-");
1713
+ if (!month) return year ?? dateStr;
1714
+ const idx = parseInt(month, 10) - 1;
1715
+ return `${MONTHS[idx]} ${year}`;
1716
+ }
1717
+ function formatDateRange(start, end, showPresent = true) {
1718
+ if (!start && !end) return "";
1719
+ if (!start) return end ? formatTimelineDate(end) : "";
1720
+ const formattedStart = formatTimelineDate(start);
1721
+ if (!end) return showPresent ? `${formattedStart} - Present` : formattedStart;
1722
+ const formattedEnd = formatTimelineDate(end);
1723
+ if (formattedStart === formattedEnd) return formattedStart;
1724
+ return `${formattedStart} - ${formattedEnd}`;
1725
+ }
1726
+
1708
1727
  // src/format/summarize-deliveries.ts
1709
1728
  var CANCELLED_STATUS = "community.lexicon.calendar.event#cancelled";
1710
1729
  var KEYNOTE_ROLE = "id.sifa.defs#keynote";
@@ -2766,6 +2785,184 @@ function classifyEntityRef(entityRef) {
2766
2785
  function isLinked(entityRef) {
2767
2786
  return classifyEntityRef(entityRef) !== "unlinked";
2768
2787
  }
2788
+
2789
+ // src/profile/section-model.ts
2790
+ var SECTION_GROUPS = [
2791
+ { id: "overview", labelKey: "groupOverview" },
2792
+ { id: "experience", labelKey: "groupExperience" },
2793
+ { id: "qualifications", labelKey: "groupQualifications" },
2794
+ { id: "more", labelKey: "groupMore" }
2795
+ ];
2796
+ var ALL_SECTIONS = [
2797
+ { id: "about", labelKey: "about", ns: "profile", group: "overview" },
2798
+ { id: "career", labelKey: "career", ns: "sections", group: "experience" },
2799
+ { id: "skills", labelKey: "skills", ns: "sections", group: "experience" },
2800
+ { id: "projects", labelKey: "projects", ns: "sections", group: "experience" },
2801
+ {
2802
+ id: "presentations",
2803
+ labelKey: "talksAndSessions",
2804
+ ns: "sections",
2805
+ group: "experience"
2806
+ },
2807
+ {
2808
+ id: "publications",
2809
+ labelKey: "publications",
2810
+ ns: "sections",
2811
+ group: "experience"
2812
+ },
2813
+ {
2814
+ id: "credentials",
2815
+ labelKey: "credentials",
2816
+ ns: "sections",
2817
+ group: "qualifications"
2818
+ },
2819
+ {
2820
+ id: "education",
2821
+ labelKey: "education",
2822
+ ns: "sections",
2823
+ group: "qualifications"
2824
+ },
2825
+ { id: "courses", labelKey: "courses", ns: "sections", group: "qualifications" },
2826
+ { id: "awards", labelKey: "awards", ns: "sections", group: "more" },
2827
+ { id: "involvement", labelKey: "involvement", ns: "sections", group: "more" },
2828
+ { id: "languages", labelKey: "languages", ns: "sections", group: "more" },
2829
+ {
2830
+ id: "other-profiles",
2831
+ labelKey: "otherProfiles",
2832
+ ns: "sections",
2833
+ group: "more"
2834
+ }
2835
+ ];
2836
+ function isSectionPopulated(profile, id) {
2837
+ switch (id) {
2838
+ case "about":
2839
+ return Boolean(profile.about && profile.headline);
2840
+ case "career":
2841
+ return Boolean(profile.positions?.length);
2842
+ case "education":
2843
+ return Boolean(profile.education?.length);
2844
+ case "courses":
2845
+ return Boolean(profile.courses?.length);
2846
+ case "skills":
2847
+ return Boolean(profile.skills?.length);
2848
+ case "projects":
2849
+ return Boolean(profile.projects?.length);
2850
+ case "credentials":
2851
+ return Boolean(profile.certifications?.length);
2852
+ case "publications":
2853
+ return Boolean(profile.publications?.length);
2854
+ case "presentations":
2855
+ return Boolean(profile.presentations?.length) || Boolean(profile.presentationDeliveries?.length);
2856
+ case "involvement":
2857
+ return Boolean(profile.involvement?.length);
2858
+ case "awards":
2859
+ return Boolean(profile.honors?.length);
2860
+ case "languages":
2861
+ return Boolean(profile.languages?.length);
2862
+ case "other-profiles":
2863
+ return Boolean(profile.externalAccounts?.length);
2864
+ default:
2865
+ return false;
2866
+ }
2867
+ }
2868
+ function getVisibleSectionIds(profile, isOwnProfile) {
2869
+ return ALL_SECTIONS.map((s) => s.id).filter(
2870
+ (id) => isOwnProfile || isSectionPopulated(profile, id)
2871
+ );
2872
+ }
2873
+ function filterHidden(items) {
2874
+ return (items ?? []).filter((i) => !i.hidden);
2875
+ }
2876
+ function visibleItems(items, isOwnProfile) {
2877
+ return isOwnProfile ? items ?? [] : filterHidden(items);
2878
+ }
2879
+ var SECTION_LABELS = {
2880
+ about: "About",
2881
+ career: "Career",
2882
+ skills: "Skills",
2883
+ projects: "Projects",
2884
+ presentations: "Talks & sessions",
2885
+ publications: "Publications",
2886
+ credentials: "Credentials",
2887
+ education: "Education",
2888
+ courses: "Courses",
2889
+ awards: "Awards",
2890
+ involvement: "Involvement",
2891
+ languages: "Languages",
2892
+ "other-profiles": "Links"
2893
+ };
2894
+
2895
+ // src/profile/range-sort.ts
2896
+ var hasValue = (date) => !!date;
2897
+ function sortByActiveDateRange(items) {
2898
+ return sortByDateDesc(items, (p) => ({
2899
+ startDate: p.startDate,
2900
+ endDate: p.endDate,
2901
+ current: !hasValue(p.endDate) && hasValue(p.startDate)
2902
+ }));
2903
+ }
2904
+
2905
+ // src/profile/language-sort.ts
2906
+ var PROFICIENCY_RANK = {
2907
+ native: 5,
2908
+ full_professional: 4,
2909
+ professional_working: 3,
2910
+ limited_working: 2,
2911
+ elementary: 1
2912
+ };
2913
+ function rank(proficiency) {
2914
+ if (!proficiency) return 0;
2915
+ return PROFICIENCY_RANK[proficiency] ?? 0;
2916
+ }
2917
+ function sortLanguagesByProficiency(items) {
2918
+ return [...items].sort((a, b) => {
2919
+ const diff = rank(b.proficiency) - rank(a.proficiency);
2920
+ if (diff !== 0) return diff;
2921
+ return (a.language ?? "").localeCompare(b.language ?? "");
2922
+ });
2923
+ }
2924
+
2925
+ // src/profile/section-sorts.ts
2926
+ function hoistPrimary(positions) {
2927
+ const idx = positions.findIndex((p) => p.primary && !p.endedAt);
2928
+ if (idx <= 0) return positions;
2929
+ const primary = positions[idx];
2930
+ return [primary, ...positions.slice(0, idx), ...positions.slice(idx + 1)];
2931
+ }
2932
+ var sortPositions = (items) => hoistPrimary(sortByDateDesc(items, lexiconDateExtractor));
2933
+ var sortEducation = (items) => sortByDateDesc(items, lexiconDateExtractor);
2934
+ var sortProjects = (items) => sortByActiveDateRange(items);
2935
+ var sortPublications = (items) => sortByDateDesc(items, singleDateExtractor);
2936
+ var sortCertifications = (items) => sortByDateDesc(items, certDateExtractor);
2937
+ var sortHonors = (items) => sortByDateDesc(items, singleDateExtractor);
2938
+ var sortLanguages = (items) => sortLanguagesByProficiency(items);
2939
+
2940
+ // src/profile/involvement-grouping.ts
2941
+ var INVOLVEMENT_HEADING_ORDER = [
2942
+ "Open Source",
2943
+ "Community",
2944
+ "Volunteering",
2945
+ "Civic",
2946
+ "Other"
2947
+ ];
2948
+ function groupInvolvementByHeading(items) {
2949
+ const byHeading = /* @__PURE__ */ new Map();
2950
+ for (const item of items) {
2951
+ const heading = getInvolvementKindHeading(item.kind);
2952
+ const bucket = byHeading.get(heading) ?? [];
2953
+ bucket.push(item);
2954
+ byHeading.set(heading, bucket);
2955
+ }
2956
+ const recency = (i) => i.endedAt ?? i.startedAt ?? "";
2957
+ const groups = [];
2958
+ for (const heading of INVOLVEMENT_HEADING_ORDER) {
2959
+ const bucket = byHeading.get(heading);
2960
+ if (!bucket?.length) continue;
2961
+ const sorted = [...bucket].sort((a, b) => recency(b).localeCompare(recency(a)));
2962
+ groups.push({ heading, items: sorted });
2963
+ }
2964
+ return groups;
2965
+ }
2769
2966
  function maxGraphemes(max) {
2770
2967
  return (value) => {
2771
2968
  const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -3167,8 +3364,8 @@ var ProfileVolunteeringRecordSchema = z.object({
3167
3364
  });
3168
3365
 
3169
3366
  // src/index.ts
3170
- var SIFA_SDK_VERSION = "0.12.0";
3367
+ var SIFA_SDK_VERSION = "0.12.2";
3171
3368
 
3172
- export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, ADULT_CONTENT_LABELS, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, ARTIFACT_LINK_KIND_LABELS, ARTIFACT_LINK_KIND_OPTIONS, ArtifactLinkSchema, AtmosphereFeedItemSchema, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, EntityImportSearchResponseSchema, EntityMintDomainResponseSchema, EntityResolveDomainRequestSchema, EntityResolveDomainResponseSchema, EntitySearchResponseSchema, EntitySearchResultSchema, EntitySelectRequestSchema, EntitySelectResponseSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, INVOLVEMENT_KIND_HEADINGS, INVOLVEMENT_KIND_LABELS, INVOLVEMENT_KIND_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PROFILE_INVOLVEMENT_NSID, PUBLISHERS, PresentationDurationSchema, PresentationLinkSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileInvolvementRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfilePresentationDeliveryRecordSchema, ProfilePresentationRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, SifaFeedItemSchema, VERIFICATION_PROVIDERS, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, categoryForApp, certDateExtractor, cidSchema, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, decodeFeedCursor, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, durationFromMinutes, encodeFeedCursor, entityDisambiguationLabel, entityResultKey, externalRecordRefSchema, findIndustry, formatCompanyName, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getArtifactLinkKindLabel, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getInvolvementKindHeading, getInvolvementKindLabel, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getVerificationProvider, getWorkplaceTypeLabel, groupSkillsByCategory, hasAdultContent, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isKnownVerificationProvider, isLinked, isPseudoEmployer, isValidRgbColor, isVisibleActivityItem, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, looksLikeDomain, makeGraphFollowRecordSchema, maxGraphemes, meetsContrastAA, normalizeCompanyKey, normalizeLegalForm, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, partialDateSchema, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, primaryVerification, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, resolveVerifierProvider, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, selfLabelsSchema, singleDateExtractor, sortByDateDesc, stripHtmlToText, strongRefSchema, summarizePresentationDeliveries, truncateGraphemes, uriSchema };
3369
+ export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, ADULT_CONTENT_LABELS, ALL_SECTIONS, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, ARTIFACT_LINK_KIND_LABELS, ARTIFACT_LINK_KIND_OPTIONS, ArtifactLinkSchema, AtmosphereFeedItemSchema, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, EntityImportSearchResponseSchema, EntityMintDomainResponseSchema, EntityResolveDomainRequestSchema, EntityResolveDomainResponseSchema, EntitySearchResponseSchema, EntitySearchResultSchema, EntitySelectRequestSchema, EntitySelectResponseSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, INVOLVEMENT_HEADING_ORDER, INVOLVEMENT_KIND_HEADINGS, INVOLVEMENT_KIND_LABELS, INVOLVEMENT_KIND_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PROFILE_INVOLVEMENT_NSID, PUBLISHERS, PresentationDurationSchema, PresentationLinkSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileInvolvementRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfilePresentationDeliveryRecordSchema, ProfilePresentationRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SECTION_GROUPS, SECTION_LABELS, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, SifaFeedItemSchema, VERIFICATION_PROVIDERS, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, categoryForApp, certDateExtractor, cidSchema, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, decodeFeedCursor, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, durationFromMinutes, encodeFeedCursor, entityDisambiguationLabel, entityResultKey, externalRecordRefSchema, filterHidden, findIndustry, formatCompanyName, formatDateRange, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, formatTimelineDate, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getArtifactLinkKindLabel, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getInvolvementKindHeading, getInvolvementKindLabel, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getVerificationProvider, getVisibleSectionIds, getWorkplaceTypeLabel, groupInvolvementByHeading, groupSkillsByCategory, hasAdultContent, hoistPrimary, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isKnownVerificationProvider, isLinked, isPseudoEmployer, isSectionPopulated, isValidRgbColor, isVisibleActivityItem, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, looksLikeDomain, makeGraphFollowRecordSchema, maxGraphemes, meetsContrastAA, normalizeCompanyKey, normalizeLegalForm, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, partialDateSchema, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, primaryVerification, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, resolveVerifierProvider, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, selfLabelsSchema, singleDateExtractor, sortByActiveDateRange, sortByDateDesc, sortCertifications, sortEducation, sortHonors, sortLanguages, sortLanguagesByProficiency, sortPositions, sortProjects, sortPublications, stripHtmlToText, strongRefSchema, summarizePresentationDeliveries, truncateGraphemes, uriSchema, visibleItems };
3173
3370
  //# sourceMappingURL=index.js.map
3174
3371
  //# sourceMappingURL=index.js.map