@singi-labs/sifa-sdk 0.7.4 → 0.7.6

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProfileSkill, L as LocationValue, a as PdsProviderInfo } from './index-CpM21_Oy.js';
2
- export { A as ActiveApp, E as Endorsement, b as EndorsementData, c as ExternalAccount, d as ExternalAccountKeytraceClaim, F as FeedItem, e as LanguageProficiency, f as Profile, g as ProfileCertification, h as ProfileCourse, i as ProfileEducation, j as ProfileHonor, k as ProfileIndustry, l as ProfileLanguage, m as ProfileLocation, n as ProfileOverrideSource, o as ProfilePosition, p as ProfileProject, q as ProfilePublication, r as ProfileVolunteering, s as PublicationContributor, S as SkillRef, t as SkillSuggestion, T as TrustStat, V as VerifiedAccount } from './index-CpM21_Oy.js';
1
+ import { P as ProfileSkill, L as LocationValue, a as PdsProviderInfo } from './index-IxlRuFsK.js';
2
+ export { A as ActiveApp, E as Endorsement, b as EndorsementData, c as ExternalAccount, d as ExternalAccountKeytraceClaim, F as FeedItem, e as LanguageProficiency, f as Profile, g as ProfileCertification, h as ProfileCourse, i as ProfileEducation, j as ProfileHonor, k as ProfileIndustry, l as ProfileLanguage, m as ProfileLocation, n as ProfileOverrideSource, o as ProfilePosition, p as ProfileProject, q as ProfilePublication, r as ProfileVolunteering, s as PublicationContributor, S as SkillRef, t as SkillSuggestion, T as TrustStat, V as VerifiedAccount } from './index-IxlRuFsK.js';
3
3
  export { EndorsementConfirmationRecord, EndorsementConfirmationRecordSchema, EndorsementRecord, EndorsementRecordSchema, GraphFollowRecord, GraphFollowRecordSchema, ProfileCertificationRecord, ProfileCertificationRecordSchema, ProfileCourseRecord, ProfileCourseRecordSchema, ProfileEducationRecord, ProfileEducationRecordSchema, ProfileExternalAccountRecord, ProfileExternalAccountRecordSchema, ProfileHonorRecord, ProfileHonorRecordSchema, ProfileLanguageRecord, ProfileLanguageRecordSchema, ProfilePositionRecord, ProfilePositionRecordSchema, ProfileProjectRecord, ProfileProjectRecordSchema, ProfilePublicationRecord, ProfilePublicationRecordSchema, ProfileSelfRecord, ProfileSelfRecordSchema, ProfileSkillRecord, ProfileSkillRecordSchema, ProfileVolunteeringRecord, ProfileVolunteeringRecordSchema, PublicationAuthor, PublicationAuthorSchema, atUriSchema, cidSchema, datetimeSchema, didSchema, languageTagSchema, maxGraphemes, selfLabelsSchema, strongRefSchema, uriSchema } from './schemas/index.js';
4
4
  import 'zod';
5
5
 
@@ -253,6 +253,34 @@ declare function contrastRatio(color1: RgbColor, color2: RgbColor): number;
253
253
  */
254
254
  declare function meetsContrastAA(foreground: RgbColor, background: RgbColor): boolean;
255
255
 
256
+ /**
257
+ * Profile completeness scoring.
258
+ *
259
+ * Six binary signals, equal weight: headline filled, about filled, has at least
260
+ * one position, education, skill, certification.
261
+ *
262
+ * Score: integer 0..6. Percent: round(score / 6 * 100) -- discrete values
263
+ * {0, 17, 33, 50, 67, 83, 100}.
264
+ *
265
+ * Canonical source of truth for completeness scoring across Sifa clients.
266
+ * sifa-api computes the underlying `ProfileCompletion` shape inline (in SQL
267
+ * for admin-stats queries, in route handlers elsewhere) but defers scoring
268
+ * to this module.
269
+ */
270
+ declare const COMPLETENESS_MAX_SCORE = 6;
271
+ interface ProfileCompletion {
272
+ hasHeadline: boolean;
273
+ hasAbout: boolean;
274
+ positionCount: number;
275
+ educationCount: number;
276
+ skillCount: number;
277
+ certificationCount: number;
278
+ }
279
+ /** Pure-TS computation of the 0..6 score. */
280
+ declare function completenessScore(c: ProfileCompletion): number;
281
+ /** Completion as a rounded 0..100 integer percent (matches API serialisation). */
282
+ declare function completenessPercent(c: ProfileCompletion): number;
283
+
256
284
  /**
257
285
  * Sifa SDK -- public client library for the Sifa AppView on AT Protocol.
258
286
  *
@@ -262,4 +290,4 @@ declare function meetsContrastAA(foreground: RgbColor, background: RgbColor): bo
262
290
  */
263
291
  declare const SIFA_SDK_VERSION: string;
264
292
 
265
- export { CATEGORY_LABELS, CATEGORY_ORDER, CONTINENTS, COUNTRIES, type ContinentCode, INDUSTRY_OPTIONS, type IndustryOption, LocationValue, type MergedProfileSkill, PLATFORM_LABELS, PLATFORM_OPTIONS, type PdsProvider, PdsProviderInfo, type PlatformId, ProfileSkill, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, type SkillCategory, certDateExtractor, contrastRatio, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getFaviconUrl, getHandleStem, getIndustryLabelKey, getPdsDisplayName, getPlatformLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, lexiconDateExtractor, meetsContrastAA, parseLocationString, pdsProviderFromApi, relativeLuminance, rgbToString, sanitizeHandleInput, singleDateExtractor, sortByDateDesc, truncateGraphemes };
293
+ export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type ContinentCode, INDUSTRY_OPTIONS, type IndustryOption, LocationValue, type MergedProfileSkill, PLATFORM_LABELS, PLATFORM_OPTIONS, type PdsProvider, PdsProviderInfo, type PlatformId, type ProfileCompletion, ProfileSkill, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, type SkillCategory, certDateExtractor, completenessPercent, completenessScore, contrastRatio, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getFaviconUrl, getHandleStem, getIndustryLabelKey, getPdsDisplayName, getPlatformLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, lexiconDateExtractor, meetsContrastAA, parseLocationString, pdsProviderFromApi, relativeLuminance, rgbToString, sanitizeHandleInput, singleDateExtractor, sortByDateDesc, truncateGraphemes };
package/dist/index.js CHANGED
@@ -926,6 +926,22 @@ function contrastRatio(color1, color2) {
926
926
  function meetsContrastAA(foreground, background) {
927
927
  return contrastRatio(foreground, background) >= 4.5;
928
928
  }
929
+
930
+ // src/logic/profile-completeness.ts
931
+ var COMPLETENESS_MAX_SCORE = 6;
932
+ function completenessScore(c) {
933
+ let filled = 0;
934
+ if (c.hasHeadline) filled++;
935
+ if (c.hasAbout) filled++;
936
+ if (c.positionCount > 0) filled++;
937
+ if (c.educationCount > 0) filled++;
938
+ if (c.skillCount > 0) filled++;
939
+ if (c.certificationCount > 0) filled++;
940
+ return filled;
941
+ }
942
+ function completenessPercent(c) {
943
+ return Math.round(completenessScore(c) / COMPLETENESS_MAX_SCORE * 100);
944
+ }
929
945
  function maxGraphemes(max) {
930
946
  return (value) => {
931
947
  const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -1086,8 +1102,8 @@ var ProfileVolunteeringRecordSchema = z.object({
1086
1102
  });
1087
1103
 
1088
1104
  // src/index.ts
1089
- var SIFA_SDK_VERSION = "0.7.4";
1105
+ var SIFA_SDK_VERSION = "0.7.6";
1090
1106
 
1091
- export { CATEGORY_LABELS, CATEGORY_ORDER, CONTINENTS, COUNTRIES, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, PLATFORM_LABELS, PLATFORM_OPTIONS, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, atUriSchema, certDateExtractor, cidSchema, contrastRatio, countryCodeToFlag, dateRangeExtractor, datetimeSchema, dedupeSkills, detectPdsProvider, didSchema, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getFaviconUrl, getHandleStem, getIndustryLabelKey, getPdsDisplayName, getPlatformLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, languageTagSchema, lexiconDateExtractor, maxGraphemes, meetsContrastAA, parseLocationString, pdsProviderFromApi, relativeLuminance, rgbToString, sanitizeHandleInput, selfLabelsSchema, singleDateExtractor, sortByDateDesc, strongRefSchema, truncateGraphemes, uriSchema };
1107
+ export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, PLATFORM_LABELS, PLATFORM_OPTIONS, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, atUriSchema, certDateExtractor, cidSchema, completenessPercent, completenessScore, contrastRatio, countryCodeToFlag, dateRangeExtractor, datetimeSchema, dedupeSkills, detectPdsProvider, didSchema, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getFaviconUrl, getHandleStem, getIndustryLabelKey, getPdsDisplayName, getPlatformLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, languageTagSchema, lexiconDateExtractor, maxGraphemes, meetsContrastAA, parseLocationString, pdsProviderFromApi, relativeLuminance, rgbToString, sanitizeHandleInput, selfLabelsSchema, singleDateExtractor, sortByDateDesc, strongRefSchema, truncateGraphemes, uriSchema };
1092
1108
  //# sourceMappingURL=index.js.map
1093
1109
  //# sourceMappingURL=index.js.map