@singi-labs/sifa-sdk 0.9.2 → 0.9.4

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.
@@ -207,6 +207,18 @@ interface Profile {
207
207
  did: string;
208
208
  handle: string;
209
209
  displayName?: string;
210
+ /**
211
+ * Given (first) name from `id.sifa.profile.self.givenName`. Schema.org
212
+ * `Person.givenName`. Optional; absent for users who haven't filled in
213
+ * structured name fields. Consumers wanting a rendered name should use
214
+ * `formatStructuredName(givenName, familyName) ?? displayName ?? handle`.
215
+ */
216
+ givenName?: string;
217
+ /**
218
+ * Family (last) name from `id.sifa.profile.self.familyName`. Schema.org
219
+ * `Person.familyName`. See `givenName` for fallback guidance.
220
+ */
221
+ familyName?: string;
210
222
  avatar?: string;
211
223
  pronouns?: string;
212
224
  headline?: string;
@@ -207,6 +207,18 @@ interface Profile {
207
207
  did: string;
208
208
  handle: string;
209
209
  displayName?: string;
210
+ /**
211
+ * Given (first) name from `id.sifa.profile.self.givenName`. Schema.org
212
+ * `Person.givenName`. Optional; absent for users who haven't filled in
213
+ * structured name fields. Consumers wanting a rendered name should use
214
+ * `formatStructuredName(givenName, familyName) ?? displayName ?? handle`.
215
+ */
216
+ givenName?: string;
217
+ /**
218
+ * Family (last) name from `id.sifa.profile.self.familyName`. Schema.org
219
+ * `Person.familyName`. See `givenName` for fallback guidance.
220
+ */
221
+ familyName?: string;
210
222
  avatar?: string;
211
223
  pronouns?: string;
212
224
  headline?: string;
package/dist/index.cjs CHANGED
@@ -693,6 +693,10 @@ function getWorkplaceTypeLabel(value) {
693
693
  var PLATFORM_LABELS = {
694
694
  bluesky: "Bluesky",
695
695
  github: "GitHub",
696
+ codeberg: "Codeberg",
697
+ gitlab: "GitLab",
698
+ forgejo: "Forgejo",
699
+ gitea: "Gitea",
696
700
  linkedin: "LinkedIn",
697
701
  youtube: "YouTube",
698
702
  twitter: "X (Twitter)",
@@ -957,6 +961,31 @@ function detectPdsProvider(handle) {
957
961
  return null;
958
962
  }
959
963
 
964
+ // src/format/text-sanitize.ts
965
+ var COMBINING_MARK = /\p{M}/u;
966
+ var BIDI_CONTROLS = /[‎‏‪-‮⁦-⁩]/gu;
967
+ function limitCombiningMarks(value, maxPerBase = 4) {
968
+ if (!value || !COMBINING_MARK.test(value)) return value;
969
+ let out = "";
970
+ let combiningRun = 0;
971
+ for (const char of value) {
972
+ if (/\p{M}/u.test(char)) {
973
+ if (combiningRun < maxPerBase) {
974
+ out += char;
975
+ combiningRun += 1;
976
+ }
977
+ } else {
978
+ out += char;
979
+ combiningRun = 0;
980
+ }
981
+ }
982
+ return out;
983
+ }
984
+ function sanitizeDisplayText(value, maxCombiningPerBase = 4) {
985
+ if (!value) return value;
986
+ return limitCombiningMarks(value.replace(BIDI_CONTROLS, ""), maxCombiningPerBase);
987
+ }
988
+
960
989
  // src/format/text-truncate.ts
961
990
  var ELLIPSIS = "\u2026";
962
991
  function truncateGraphemes(value, maxLen) {
@@ -1204,6 +1233,8 @@ var ProfileSelfRecordSchema = zod.z.object({
1204
1233
  headline: zod.z.string().refine(maxGraphemes(120)).max(1200).optional(),
1205
1234
  about: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
1206
1235
  industry: zod.z.string().refine(maxGraphemes(100)).max(1e3).optional(),
1236
+ givenName: zod.z.string().refine(maxGraphemes(64)).max(640).optional(),
1237
+ familyName: zod.z.string().refine(maxGraphemes(64)).max(640).optional(),
1207
1238
  location: zod.z.unknown().optional(),
1208
1239
  openTo: zod.z.array(zod.z.string()).max(10).optional(),
1209
1240
  preferredWorkplace: zod.z.array(zod.z.string()).max(3).optional(),
@@ -1229,7 +1260,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
1229
1260
  });
1230
1261
 
1231
1262
  // src/index.ts
1232
- var SIFA_SDK_VERSION = "0.9.2";
1263
+ var SIFA_SDK_VERSION = "0.9.4";
1233
1264
 
1234
1265
  exports.CATEGORY_LABELS = CATEGORY_LABELS;
1235
1266
  exports.CATEGORY_ORDER = CATEGORY_ORDER;
@@ -1298,6 +1329,7 @@ exports.isKnownPlatform = isKnownPlatform;
1298
1329
  exports.isValidRgbColor = isValidRgbColor;
1299
1330
  exports.languageTagSchema = languageTagSchema;
1300
1331
  exports.lexiconDateExtractor = lexiconDateExtractor;
1332
+ exports.limitCombiningMarks = limitCombiningMarks;
1301
1333
  exports.maxGraphemes = maxGraphemes;
1302
1334
  exports.meetsContrastAA = meetsContrastAA;
1303
1335
  exports.parseLocationString = parseLocationString;
@@ -1305,6 +1337,7 @@ exports.pdsProviderFromApi = pdsProviderFromApi;
1305
1337
  exports.profileToDimensionInputs = profileToDimensionInputs;
1306
1338
  exports.relativeLuminance = relativeLuminance;
1307
1339
  exports.rgbToString = rgbToString;
1340
+ exports.sanitizeDisplayText = sanitizeDisplayText;
1308
1341
  exports.sanitizeHandleInput = sanitizeHandleInput;
1309
1342
  exports.selfLabelsSchema = selfLabelsSchema;
1310
1343
  exports.singleDateExtractor = singleDateExtractor;