@singi-labs/sifa-sdk 0.9.3 → 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.
- package/dist/index.cjs +32 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -94,6 +94,10 @@ declare function getWorkplaceTypeLabel(value: string | undefined | null): string
|
|
|
94
94
|
declare const PLATFORM_LABELS: {
|
|
95
95
|
readonly bluesky: "Bluesky";
|
|
96
96
|
readonly github: "GitHub";
|
|
97
|
+
readonly codeberg: "Codeberg";
|
|
98
|
+
readonly gitlab: "GitLab";
|
|
99
|
+
readonly forgejo: "Forgejo";
|
|
100
|
+
readonly gitea: "Gitea";
|
|
97
101
|
readonly linkedin: "LinkedIn";
|
|
98
102
|
readonly youtube: "YouTube";
|
|
99
103
|
readonly twitter: "X (Twitter)";
|
|
@@ -259,6 +263,27 @@ declare function getDisplayLabel(displayName: string | undefined, handle: string
|
|
|
259
263
|
declare function getPdsDisplayName(providerName: string): string;
|
|
260
264
|
declare function detectPdsProvider(handle: string): PdsProvider | null;
|
|
261
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Limit runs of Unicode combining marks (`\p{M}`) to at most `maxPerBase`
|
|
268
|
+
* marks following any single base character. Defuses "Zalgo" text where
|
|
269
|
+
* dozens of stacked combining marks render outside the line box and bleed
|
|
270
|
+
* into neighbouring UI.
|
|
271
|
+
*
|
|
272
|
+
* `maxPerBase` defaults to 4 — high enough to preserve legitimate stacks
|
|
273
|
+
* in Thai, Arabic, Vietnamese, and IPA, low enough to neutralise the
|
|
274
|
+
* vertical-overflow attack vector.
|
|
275
|
+
*/
|
|
276
|
+
declare function limitCombiningMarks(value: string, maxPerBase?: number): string;
|
|
277
|
+
/**
|
|
278
|
+
* Sanitise untrusted display text from PDS records before rendering in UI:
|
|
279
|
+
* - strips bidi formatting controls (LRM/RLM/LRE/RLE/PDF/LRO/RLO/LRI/RLI/FSI/PDI)
|
|
280
|
+
* that can hijack reading order or crash `next/og` (see Satori LRM+emoji bug)
|
|
281
|
+
* - limits stacked combining marks (Zalgo defence)
|
|
282
|
+
*
|
|
283
|
+
* Preserves ZWJ (U+200D) so emoji sequences keep rendering.
|
|
284
|
+
*/
|
|
285
|
+
declare function sanitizeDisplayText(value: string, maxCombiningPerBase?: number): string;
|
|
286
|
+
|
|
262
287
|
/**
|
|
263
288
|
* Truncate a string to at most `maxLen` grapheme clusters, appending an
|
|
264
289
|
* ellipsis when the string was shortened. Grapheme-aware so it never splits
|
|
@@ -393,4 +418,4 @@ declare function countFilledDimensions(input: ProfileDimensionInputs | Profile):
|
|
|
393
418
|
*/
|
|
394
419
|
declare const SIFA_SDK_VERSION: string;
|
|
395
420
|
|
|
396
|
-
export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type ContinentCode, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, type EmploymentTypeGroup, type EmploymentTypeOption, INDUSTRY_OPTIONS, type IndustryOption, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, type PdsProvider, PdsProviderInfo, type PlatformId, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfileSkill, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, type SkillCategory, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, certDateExtractor, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, lexiconDateExtractor, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, rgbToString, sanitizeHandleInput, singleDateExtractor, sortByDateDesc, truncateGraphemes };
|
|
421
|
+
export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type ContinentCode, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, type EmploymentTypeGroup, type EmploymentTypeOption, INDUSTRY_OPTIONS, type IndustryOption, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, type PdsProvider, PdsProviderInfo, type PlatformId, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfileSkill, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, type SkillCategory, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, certDateExtractor, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, lexiconDateExtractor, limitCombiningMarks, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, rgbToString, sanitizeDisplayText, sanitizeHandleInput, singleDateExtractor, sortByDateDesc, truncateGraphemes };
|
package/dist/index.d.ts
CHANGED
|
@@ -94,6 +94,10 @@ declare function getWorkplaceTypeLabel(value: string | undefined | null): string
|
|
|
94
94
|
declare const PLATFORM_LABELS: {
|
|
95
95
|
readonly bluesky: "Bluesky";
|
|
96
96
|
readonly github: "GitHub";
|
|
97
|
+
readonly codeberg: "Codeberg";
|
|
98
|
+
readonly gitlab: "GitLab";
|
|
99
|
+
readonly forgejo: "Forgejo";
|
|
100
|
+
readonly gitea: "Gitea";
|
|
97
101
|
readonly linkedin: "LinkedIn";
|
|
98
102
|
readonly youtube: "YouTube";
|
|
99
103
|
readonly twitter: "X (Twitter)";
|
|
@@ -259,6 +263,27 @@ declare function getDisplayLabel(displayName: string | undefined, handle: string
|
|
|
259
263
|
declare function getPdsDisplayName(providerName: string): string;
|
|
260
264
|
declare function detectPdsProvider(handle: string): PdsProvider | null;
|
|
261
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Limit runs of Unicode combining marks (`\p{M}`) to at most `maxPerBase`
|
|
268
|
+
* marks following any single base character. Defuses "Zalgo" text where
|
|
269
|
+
* dozens of stacked combining marks render outside the line box and bleed
|
|
270
|
+
* into neighbouring UI.
|
|
271
|
+
*
|
|
272
|
+
* `maxPerBase` defaults to 4 — high enough to preserve legitimate stacks
|
|
273
|
+
* in Thai, Arabic, Vietnamese, and IPA, low enough to neutralise the
|
|
274
|
+
* vertical-overflow attack vector.
|
|
275
|
+
*/
|
|
276
|
+
declare function limitCombiningMarks(value: string, maxPerBase?: number): string;
|
|
277
|
+
/**
|
|
278
|
+
* Sanitise untrusted display text from PDS records before rendering in UI:
|
|
279
|
+
* - strips bidi formatting controls (LRM/RLM/LRE/RLE/PDF/LRO/RLO/LRI/RLI/FSI/PDI)
|
|
280
|
+
* that can hijack reading order or crash `next/og` (see Satori LRM+emoji bug)
|
|
281
|
+
* - limits stacked combining marks (Zalgo defence)
|
|
282
|
+
*
|
|
283
|
+
* Preserves ZWJ (U+200D) so emoji sequences keep rendering.
|
|
284
|
+
*/
|
|
285
|
+
declare function sanitizeDisplayText(value: string, maxCombiningPerBase?: number): string;
|
|
286
|
+
|
|
262
287
|
/**
|
|
263
288
|
* Truncate a string to at most `maxLen` grapheme clusters, appending an
|
|
264
289
|
* ellipsis when the string was shortened. Grapheme-aware so it never splits
|
|
@@ -393,4 +418,4 @@ declare function countFilledDimensions(input: ProfileDimensionInputs | Profile):
|
|
|
393
418
|
*/
|
|
394
419
|
declare const SIFA_SDK_VERSION: string;
|
|
395
420
|
|
|
396
|
-
export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type ContinentCode, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, type EmploymentTypeGroup, type EmploymentTypeOption, INDUSTRY_OPTIONS, type IndustryOption, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, type PdsProvider, PdsProviderInfo, type PlatformId, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfileSkill, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, type SkillCategory, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, certDateExtractor, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, lexiconDateExtractor, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, rgbToString, sanitizeHandleInput, singleDateExtractor, sortByDateDesc, truncateGraphemes };
|
|
421
|
+
export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type ContinentCode, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, type EmploymentTypeGroup, type EmploymentTypeOption, INDUSTRY_OPTIONS, type IndustryOption, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, type PdsProvider, PdsProviderInfo, type PlatformId, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfileSkill, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, type SkillCategory, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, certDateExtractor, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, lexiconDateExtractor, limitCombiningMarks, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, rgbToString, sanitizeDisplayText, sanitizeHandleInput, singleDateExtractor, sortByDateDesc, truncateGraphemes };
|
package/dist/index.js
CHANGED
|
@@ -691,6 +691,10 @@ function getWorkplaceTypeLabel(value) {
|
|
|
691
691
|
var PLATFORM_LABELS = {
|
|
692
692
|
bluesky: "Bluesky",
|
|
693
693
|
github: "GitHub",
|
|
694
|
+
codeberg: "Codeberg",
|
|
695
|
+
gitlab: "GitLab",
|
|
696
|
+
forgejo: "Forgejo",
|
|
697
|
+
gitea: "Gitea",
|
|
694
698
|
linkedin: "LinkedIn",
|
|
695
699
|
youtube: "YouTube",
|
|
696
700
|
twitter: "X (Twitter)",
|
|
@@ -955,6 +959,31 @@ function detectPdsProvider(handle) {
|
|
|
955
959
|
return null;
|
|
956
960
|
}
|
|
957
961
|
|
|
962
|
+
// src/format/text-sanitize.ts
|
|
963
|
+
var COMBINING_MARK = /\p{M}/u;
|
|
964
|
+
var BIDI_CONTROLS = /[--]/gu;
|
|
965
|
+
function limitCombiningMarks(value, maxPerBase = 4) {
|
|
966
|
+
if (!value || !COMBINING_MARK.test(value)) return value;
|
|
967
|
+
let out = "";
|
|
968
|
+
let combiningRun = 0;
|
|
969
|
+
for (const char of value) {
|
|
970
|
+
if (/\p{M}/u.test(char)) {
|
|
971
|
+
if (combiningRun < maxPerBase) {
|
|
972
|
+
out += char;
|
|
973
|
+
combiningRun += 1;
|
|
974
|
+
}
|
|
975
|
+
} else {
|
|
976
|
+
out += char;
|
|
977
|
+
combiningRun = 0;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return out;
|
|
981
|
+
}
|
|
982
|
+
function sanitizeDisplayText(value, maxCombiningPerBase = 4) {
|
|
983
|
+
if (!value) return value;
|
|
984
|
+
return limitCombiningMarks(value.replace(BIDI_CONTROLS, ""), maxCombiningPerBase);
|
|
985
|
+
}
|
|
986
|
+
|
|
958
987
|
// src/format/text-truncate.ts
|
|
959
988
|
var ELLIPSIS = "\u2026";
|
|
960
989
|
function truncateGraphemes(value, maxLen) {
|
|
@@ -1229,8 +1258,8 @@ var ProfileVolunteeringRecordSchema = z.object({
|
|
|
1229
1258
|
});
|
|
1230
1259
|
|
|
1231
1260
|
// src/index.ts
|
|
1232
|
-
var SIFA_SDK_VERSION = "0.9.
|
|
1261
|
+
var SIFA_SDK_VERSION = "0.9.4";
|
|
1233
1262
|
|
|
1234
|
-
export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, PLATFORM_LABELS, PLATFORM_OPTIONS, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, certDateExtractor, cidSchema, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, languageTagSchema, lexiconDateExtractor, maxGraphemes, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, rgbToString, sanitizeHandleInput, selfLabelsSchema, singleDateExtractor, sortByDateDesc, strongRefSchema, truncateGraphemes, uriSchema };
|
|
1263
|
+
export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, PLATFORM_LABELS, PLATFORM_OPTIONS, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, certDateExtractor, cidSchema, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, maxGraphemes, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, rgbToString, sanitizeDisplayText, sanitizeHandleInput, selfLabelsSchema, singleDateExtractor, sortByDateDesc, strongRefSchema, truncateGraphemes, uriSchema };
|
|
1235
1264
|
//# sourceMappingURL=index.js.map
|
|
1236
1265
|
//# sourceMappingURL=index.js.map
|