@singi-labs/sifa-sdk 0.11.19 → 0.11.21

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.
@@ -24,6 +24,14 @@ interface ProfilePosition {
24
24
  * independent positions (#159).
25
25
  */
26
26
  entityRef?: string;
27
+ /**
28
+ * Resolved current canonical name of the durably-linked company (#240),
29
+ * computed by the AppView at read time. Render this over `company` for a
30
+ * linked position, so a name correction reaches every linked profile without
31
+ * a PDS write. Absent for free-text or unresolved positions (fall back to
32
+ * `company`).
33
+ */
34
+ entityName?: string;
27
35
  title: string;
28
36
  description?: string;
29
37
  startedAt: string;
@@ -24,6 +24,14 @@ interface ProfilePosition {
24
24
  * independent positions (#159).
25
25
  */
26
26
  entityRef?: string;
27
+ /**
28
+ * Resolved current canonical name of the durably-linked company (#240),
29
+ * computed by the AppView at read time. Render this over `company` for a
30
+ * linked position, so a name correction reaches every linked profile without
31
+ * a PDS write. Absent for free-text or unresolved positions (fall back to
32
+ * `company`).
33
+ */
34
+ entityName?: string;
27
35
  title: string;
28
36
  description?: string;
29
37
  startedAt: string;
package/dist/index.cjs CHANGED
@@ -441,15 +441,19 @@ var EMPLOYMENT_TYPE_GROUPS = [
441
441
  { value: "id.sifa.defs#fellowship", label: "Fellowship" },
442
442
  { value: "id.sifa.defs#trainee", label: "Trainee" }
443
443
  ]
444
- },
445
- {
446
- label: "Other",
447
- items: [{ value: "id.sifa.defs#volunteer", label: "Volunteer" }]
448
444
  }
449
445
  ];
450
- var EMPLOYMENT_TYPE_LABELS = Object.fromEntries(
451
- EMPLOYMENT_TYPE_GROUPS.flatMap((g) => g.items).map((o) => [o.value, o.label])
452
- );
446
+ var EMPLOYMENT_TYPE_LABELS = {
447
+ ...Object.fromEntries(
448
+ EMPLOYMENT_TYPE_GROUPS.flatMap((g) => g.items).map((o) => [o.value, o.label])
449
+ ),
450
+ // `volunteer` is retained for legacy records but no longer offered in the
451
+ // editor dropdown. Volunteering is a distinct thing (no payroll, no formal
452
+ // role, no obligation) rather than a kind of employment, so it lives in the
453
+ // dedicated `id.sifa.profile.volunteering` section, not on the employment-type
454
+ // axis. Kept here so old positions still render a human label, not the raw NSID.
455
+ "id.sifa.defs#volunteer": "Volunteer"
456
+ };
453
457
  function getEmploymentTypeLabel(value) {
454
458
  if (!value) return void 0;
455
459
  return EMPLOYMENT_TYPE_LABELS[value] ?? value;
@@ -1461,6 +1465,13 @@ var SMALL_WORDS = /* @__PURE__ */ new Set([
1461
1465
  "le",
1462
1466
  "y"
1463
1467
  ]);
1468
+ function hasNonAsciiLetter(value) {
1469
+ for (const char of value) {
1470
+ const codePoint = char.codePointAt(0) ?? 0;
1471
+ if (codePoint > 127 && /\p{L}/u.test(char)) return true;
1472
+ }
1473
+ return false;
1474
+ }
1464
1475
  function capitalizeWord(word) {
1465
1476
  return word.replace(
1466
1477
  /^([^\p{L}\p{N}]*)(\p{L})/u,
@@ -1469,7 +1480,7 @@ function capitalizeWord(word) {
1469
1480
  }
1470
1481
  function formatCompanyName(name) {
1471
1482
  const trimmed = name.trim();
1472
- if (!trimmed || trimmed !== trimmed.toLowerCase()) return trimmed;
1483
+ if (!trimmed || hasNonAsciiLetter(trimmed) || trimmed !== trimmed.toLowerCase()) return trimmed;
1473
1484
  let seenWord = false;
1474
1485
  return trimmed.split(/(\s+)/).map((token) => {
1475
1486
  if (token.length === 0 || /^\s+$/.test(token)) return token;
@@ -1480,6 +1491,15 @@ function formatCompanyName(name) {
1480
1491
  }).join("");
1481
1492
  }
1482
1493
 
1494
+ // src/format/normalize-company-key.ts
1495
+ var COMBINING_MARKS = /[\u0300-\u036f]/g;
1496
+ function normalizeCompanyKey(name) {
1497
+ const trimmed = name.trim();
1498
+ if (!trimmed) return "";
1499
+ const caseFolded = trimmed.normalize("NFC").toLowerCase();
1500
+ return caseFolded.normalize("NFD").replace(COMBINING_MARKS, "").normalize("NFC");
1501
+ }
1502
+
1483
1503
  // src/format/format-time.ts
1484
1504
  function formatRelativeTime(dateString) {
1485
1505
  const date = new Date(dateString);
@@ -2879,7 +2899,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
2879
2899
  });
2880
2900
 
2881
2901
  // src/index.ts
2882
- var SIFA_SDK_VERSION = "0.11.19";
2902
+ var SIFA_SDK_VERSION = "0.11.21";
2883
2903
 
2884
2904
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
2885
2905
  exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
@@ -3021,6 +3041,7 @@ exports.limitCombiningMarks = limitCombiningMarks;
3021
3041
  exports.makeGraphFollowRecordSchema = makeGraphFollowRecordSchema;
3022
3042
  exports.maxGraphemes = maxGraphemes;
3023
3043
  exports.meetsContrastAA = meetsContrastAA;
3044
+ exports.normalizeCompanyKey = normalizeCompanyKey;
3024
3045
  exports.normalizeOpenTo = normalizeOpenTo;
3025
3046
  exports.normalizePlatformId = normalizePlatformId;
3026
3047
  exports.normalizePresentationMode = normalizePresentationMode;