@singi-labs/sifa-sdk 0.18.3 → 0.18.5
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 +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/{network-map-uK_eXNpt.d.ts → network-map-DZjcO7tM.d.ts} +1 -1
- package/dist/{network-map-Cjfb2sMK.d.cts → network-map-Ds3OR7eJ.d.cts} +1 -1
- package/dist/{org-OG2f8eXr.d.cts → org-DmtI6C4A.d.cts} +1 -1
- package/dist/{org-DCLIQlCd.d.ts → org-h8nhEeAJ.d.ts} +1 -1
- package/dist/{org-settings-B8e01iZx.d.cts → org-settings-CZ_tmAYl.d.cts} +1 -1
- package/dist/{org-settings-B8e01iZx.d.ts → org-settings-CZ_tmAYl.d.ts} +1 -1
- package/dist/query/fetchers/index.d.cts +4 -4
- package/dist/query/fetchers/index.d.ts +4 -4
- package/dist/query/hooks/index.d.cts +4 -4
- package/dist/query/hooks/index.d.ts +4 -4
- package/dist/query/index.d.cts +6 -6
- package/dist/query/index.d.ts +6 -6
- package/dist/resume/index.cjs +184 -0
- package/dist/resume/index.cjs.map +1 -0
- package/dist/resume/index.d.cts +163 -0
- package/dist/resume/index.d.ts +163 -0
- package/dist/resume/index.js +181 -0
- package/dist/resume/index.js.map +1 -0
- package/dist/schemas/write/index.d.cts +1 -1
- package/dist/schemas/write/index.d.ts +1 -1
- package/dist/{use-org-notification-emails-g6hHkpjM.d.cts → use-org-notification-emails-CkCQJhy8.d.cts} +2 -2
- package/dist/{use-org-notification-emails-DjI-_zSh.d.ts → use-org-notification-emails-Cz4cuTyg.d.ts} +2 -2
- package/package.json +11 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/format/pds-utils.ts","../../src/profile/section-model.ts","../../src/jsonld/url.ts","../../src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AW,OAAA,EAAS,cAAA;AAAe,GAC7C;AACF","file":"index.cjs","sourcesContent":["import type { PdsProviderInfo } from '../types/index.js';\n\nexport interface PdsProvider {\n name: string;\n profileUrl: string;\n host?: string;\n}\n\nconst BSKY_PROFILE_BASE = 'https://bsky.app/profile/';\n\nconst PDS_PROVIDERS: { suffix: string; name: string }[] = [\n { suffix: '.bsky.social', name: 'bluesky' },\n { suffix: '.blacksky.app', name: 'blacksky' },\n { suffix: '.eurosky.social', name: 'eurosky' },\n { suffix: '.northsky.social', name: 'northsky' },\n];\n\nconst KNOWN_PROVIDER_NAMES = new Set(PDS_PROVIDERS.map((p) => p.name));\n\nconst ICON_ONLY_PROVIDERS = new Set(['selfhosted-social', 'selfhosted']);\n\nexport function pdsProviderFromApi(\n apiProvider: PdsProviderInfo | null | undefined,\n handle: string,\n): PdsProvider | null {\n if (!apiProvider) return null;\n if (ICON_ONLY_PROVIDERS.has(apiProvider.name)) {\n return { name: apiProvider.name, profileUrl: '', host: apiProvider.host };\n }\n if (!KNOWN_PROVIDER_NAMES.has(apiProvider.name)) return null;\n return {\n name: apiProvider.name,\n profileUrl: `${BSKY_PROFILE_BASE}${handle}`,\n host: apiProvider.host,\n };\n}\n\nexport function getHandleStem(handle: string): string {\n const lower = handle.toLowerCase();\n for (const provider of PDS_PROVIDERS) {\n if (lower.endsWith(provider.suffix) && lower.length > provider.suffix.length) {\n return handle.slice(0, -provider.suffix.length);\n }\n }\n return handle;\n}\n\nexport function getDisplayLabel(displayName: string | undefined, handle: string): string {\n if (displayName) return displayName;\n return getHandleStem(handle);\n}\n\n/**\n * Combine optional structured name fields (`id.sifa.profile.self.givenName`,\n * `familyName`) into a single string in Schema.org `Person` order — given\n * before family. Returns `undefined` when both are absent so callers can\n * fall back to `displayName`. Whitespace-only inputs are treated as absent.\n * Does not impose cultural ordering: users whose preferred presentation\n * differs (e.g. Eastern name order) should set `displayName` accordingly,\n * which this helper deliberately does not consult.\n */\nexport function formatStructuredName(\n givenName: string | undefined,\n familyName: string | undefined,\n): string | undefined {\n const given = givenName?.trim();\n const family = familyName?.trim();\n if (given && family) return `${given} ${family}`;\n return given || family || undefined;\n}\n\nconst PDS_DISPLAY_NAMES: Record<string, string> = {\n bluesky: 'Bluesky',\n blacksky: 'BlackSky',\n eurosky: 'EuroSky',\n northsky: 'NorthSky',\n 'selfhosted-social': 'Self-hosted',\n selfhosted: 'Self-hosted',\n};\n\nexport function getPdsDisplayName(providerName: string): string {\n return PDS_DISPLAY_NAMES[providerName] ?? providerName;\n}\n\nexport function detectPdsProvider(handle: string): PdsProvider | null {\n const lower = handle.toLowerCase();\n for (const provider of PDS_PROVIDERS) {\n if (lower.endsWith(provider.suffix)) {\n return {\n name: provider.name,\n profileUrl: `${BSKY_PROFILE_BASE}${handle}`,\n };\n }\n }\n return null;\n}\n","/**\n * Shared, single-source-of-truth model for which profile sections render, in\n * what order, their nav grouping, and which items a given viewer may see.\n *\n * Every Sifa profile surface builds on this: the HTML profile page, the\n * Markdown / DOCX / print exports, and the standalone personal-site renderer.\n * Adding a section to {@link ALL_SECTIONS} makes it appear everywhere (the\n * exports drive presence + order from here, and {@link SECTION_LABELS} is an\n * exhaustive `Record<SectionId, string>`, so a new id is a compile error until\n * it has a label).\n *\n * The per-section sorts live in `./section-sorts.js`, built on the same SDK\n * date extractors the HTML section components use, so the surfaces cannot\n * diverge on ordering.\n */\n\nimport type { Profile } from '../types/index.js';\n\n/**\n * Side-nav groups, in display order. Each labels a contiguous run of sections\n * in {@link ALL_SECTIONS}. `labelKey` resolves against the consumer's `sections`\n * i18n namespace.\n */\nexport const SECTION_GROUPS = [\n { id: 'overview', labelKey: 'groupOverview' },\n { id: 'experience', labelKey: 'groupExperience' },\n { id: 'qualifications', labelKey: 'groupQualifications' },\n { id: 'more', labelKey: 'groupMore' },\n] as const;\n\nexport type SectionGroupId = (typeof SECTION_GROUPS)[number]['id'];\n\n/**\n * Profile body sections in render + nav order (evidence-first): identity and\n * activity lead, then living work (career, skills, projects, talks,\n * publications), then the formal record (credentials, education, courses), then\n * the rest. `ns` selects the consumer's i18n namespace for `labelKey`; `group`\n * ties the section to a {@link SECTION_GROUPS} header.\n */\nexport const ALL_SECTIONS = [\n { id: 'about', labelKey: 'about', ns: 'profile' as const, group: 'overview' as const },\n { id: 'career', labelKey: 'career', ns: 'sections' as const, group: 'experience' as const },\n { id: 'skills', labelKey: 'skills', ns: 'sections' as const, group: 'experience' as const },\n { id: 'projects', labelKey: 'projects', ns: 'sections' as const, group: 'experience' as const },\n {\n id: 'presentations',\n labelKey: 'talksAndSessions',\n ns: 'sections' as const,\n group: 'experience' as const,\n },\n {\n id: 'publications',\n labelKey: 'publications',\n ns: 'sections' as const,\n group: 'experience' as const,\n },\n {\n id: 'credentials',\n labelKey: 'credentials',\n ns: 'sections' as const,\n group: 'qualifications' as const,\n },\n {\n id: 'education',\n labelKey: 'education',\n ns: 'sections' as const,\n group: 'qualifications' as const,\n },\n { id: 'courses', labelKey: 'courses', ns: 'sections' as const, group: 'qualifications' as const },\n { id: 'awards', labelKey: 'awards', ns: 'sections' as const, group: 'more' as const },\n { id: 'involvement', labelKey: 'involvement', ns: 'sections' as const, group: 'more' as const },\n // Its own section rather than a group under involvement: that record is about\n // work contributed, this one about capital deployed.\n { id: 'investments', labelKey: 'investments', ns: 'sections' as const, group: 'more' as const },\n { id: 'languages', labelKey: 'languages', ns: 'sections' as const, group: 'more' as const },\n {\n id: 'other-profiles',\n labelKey: 'otherProfiles',\n ns: 'sections' as const,\n group: 'more' as const,\n },\n] as const;\n\n/** Every profile section id, in canonical render order. */\nexport type SectionId = (typeof ALL_SECTIONS)[number]['id'];\n\n/** Whether a section has content for a given profile (used to hide empty nav entries for visitors). */\nexport function isSectionPopulated(profile: Profile, id: string): boolean {\n switch (id) {\n case 'about':\n return Boolean(profile.about && profile.headline);\n case 'career':\n return Boolean(profile.positions?.length);\n case 'education':\n return Boolean(profile.education?.length);\n case 'courses':\n return Boolean(profile.courses?.length);\n case 'skills':\n return Boolean(profile.skills?.length);\n case 'projects':\n return Boolean(profile.projects?.length);\n case 'credentials':\n return Boolean(profile.certifications?.length);\n case 'publications':\n return Boolean(profile.publications?.length);\n case 'presentations':\n return (\n Boolean(profile.presentations?.length) || Boolean(profile.presentationDeliveries?.length)\n );\n case 'involvement':\n return Boolean(profile.involvement?.length);\n case 'investments':\n return Boolean(profile.investments?.length);\n case 'awards':\n return Boolean(profile.honors?.length);\n case 'languages':\n return Boolean(profile.languages?.length);\n case 'other-profiles':\n return Boolean(profile.externalAccounts?.length);\n default:\n return false;\n }\n}\n\n/**\n * The section ids a given viewer should see, in {@link ALL_SECTIONS} order.\n * Owners see every section; visitors only see populated ones.\n */\nexport function getVisibleSectionIds(profile: Profile, isOwnProfile: boolean): SectionId[] {\n return ALL_SECTIONS.map((s) => s.id).filter(\n (id) => isOwnProfile || isSectionPopulated(profile, id),\n );\n}\n\n/** Drop items the owner has hidden from visitors. */\nexport function filterHidden<T extends { hidden?: boolean }>(items: T[] | undefined): T[] {\n return (items ?? []).filter((i) => !i.hidden);\n}\n\n/**\n * Items visible to a given viewer: owners see their own hidden items, visitors\n * do not. Shared by every export format (markdown, docx, print) and the public\n * `.md` route so the hidden rule lives in one place.\n */\nexport function visibleItems<T extends { hidden?: boolean }>(\n items: T[] | undefined,\n isOwnProfile: boolean,\n): T[] {\n return isOwnProfile ? (items ?? []) : filterHidden(items);\n}\n\n/**\n * English heading text for each section, keyed by {@link SectionId} (e.g.\n * `other-profiles` renders as \"Links\"). Exhaustive `Record<SectionId, string>`:\n * adding a section to {@link ALL_SECTIONS} without a label here is a compile\n * error, so a section can never silently render without (or with a stale)\n * heading. Consumers with i18n resolve their own localized labels via\n * `labelKey`; this is the canonical English fallback used by the exports.\n */\nexport const SECTION_LABELS: Record<SectionId, string> = {\n about: 'About',\n career: 'Career',\n skills: 'Skills',\n projects: 'Projects',\n presentations: 'Talks & sessions',\n publications: 'Publications',\n credentials: 'Credentials',\n education: 'Education',\n courses: 'Courses',\n awards: 'Awards',\n involvement: 'Involvement',\n investments: 'Investments',\n languages: 'Languages',\n 'other-profiles': 'Links',\n};\n","/** Shared URL helpers for the JSON-LD emitters. */\n\nexport const DEFAULT_BASE_URL = 'https://sifa.id';\n\n/**\n * Drop trailing slashes from a caller-supplied base URL.\n *\n * Written as a scan rather than `replace(/\\/+$/, '')` on purpose: the regex\n * form is a polynomial-backtracking hazard on input the library does not\n * control (CodeQL js/polynomial-redos). This runs in linear time.\n */\nexport function normaliseBaseUrl(baseUrl: string | undefined): string {\n const value = baseUrl ?? DEFAULT_BASE_URL;\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 0x2f) end -= 1;\n return value.slice(0, end);\n}\n\nexport function profileUrl(baseUrl: string, handle: string): string {\n return `${baseUrl}/p/${handle}`;\n}\n","/**\n * JSON Resume v1.0.0 emitter for a Sifa profile.\n *\n * https://jsonresume.org/schema/\n *\n * One pure function, no fetching, no DOM, no framework -- the same shape as the\n * JSON-LD emitter next door, and for the same reason: sifa.id, page.sifa.id and\n * any future consumer should emit one document from one implementation.\n *\n * Why this format earns its place: it is the lingua franca of CV tooling, so\n * emitting it hands a user every JSON Resume theme, and the Typst CV templates\n * on Typst Universe, without Sifa writing a renderer for any of them.\n *\n * Fields Sifa holds that JSON Resume has no slot for -- endorsements,\n * confirmations, involvement, investments, presentations, courses -- are\n * dropped rather than smuggled into a nearby field. The loss is documented for\n * the user at the point of download.\n */\n\nimport { formatStructuredName } from '../format/pds-utils.js';\nimport { filterHidden } from '../profile/section-model.js';\nimport type {\n ExternalAccount,\n LanguageProficiency,\n LocationValue,\n ProfileCertification,\n ProfileEducation,\n ProfileHonor,\n ProfileLanguage,\n ProfilePosition,\n ProfileProject,\n ProfilePublication,\n ProfileSkill,\n ProfileVolunteering,\n} from '../types/index.js';\nimport { normaliseBaseUrl, profileUrl } from '../jsonld/url.js';\n\nexport type Sanitizer = (input: string) => string;\n\nexport interface JsonResumeOptions {\n /** Canonical origin for the profile URL. Defaults to `https://sifa.id`. */\n readonly baseUrl?: string;\n /** Applied to every user-authored string. Defaults to identity. */\n readonly sanitize?: Sanitizer;\n /**\n * Absolute URL of the profile this resume describes. Defaults to\n * `${baseUrl}/p/${handle}`. A personal site served from a custom domain is\n * not at that path.\n */\n readonly canonicalUrl?: string;\n}\n\n/**\n * The subset of `Profile` this emitter reads. Deliberately structural rather\n * than the full `Profile`, so a caller holding a partially hydrated profile --\n * or a test -- does not have to invent forty unrelated fields.\n */\nexport interface JsonResumeProfileInput {\n readonly handle: string;\n readonly displayName?: string;\n readonly givenName?: string;\n readonly familyName?: string;\n readonly avatar?: string;\n readonly headline?: string;\n readonly about?: string;\n readonly website?: string;\n readonly location?: LocationValue | null;\n readonly positions?: ProfilePosition[];\n readonly education?: ProfileEducation[];\n readonly skills?: ProfileSkill[];\n readonly certifications?: ProfileCertification[];\n readonly projects?: ProfileProject[];\n readonly publications?: ProfilePublication[];\n readonly volunteering?: ProfileVolunteering[];\n readonly honors?: ProfileHonor[];\n readonly languages?: ProfileLanguage[];\n readonly externalAccounts?: ExternalAccount[];\n}\n\nexport interface JsonResumeLocation {\n readonly city?: string;\n readonly region?: string;\n readonly countryCode?: string;\n readonly postalCode?: string;\n}\n\nexport interface JsonResumeProfileLink {\n readonly network: string;\n readonly username?: string;\n readonly url: string;\n}\n\nexport interface JsonResumeBasics {\n readonly name: string;\n readonly label?: string;\n readonly image?: string;\n readonly url?: string;\n readonly summary?: string;\n readonly location?: JsonResumeLocation;\n readonly profiles?: JsonResumeProfileLink[];\n}\n\nexport interface JsonResumeWork {\n readonly name?: string;\n readonly position: string;\n readonly summary?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeVolunteer {\n readonly organization: string;\n readonly position?: string;\n readonly summary?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeEducation {\n readonly institution: string;\n readonly area?: string;\n readonly studyType?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeAward {\n readonly title: string;\n readonly date?: string;\n readonly awarder?: string;\n readonly summary?: string;\n}\n\nexport interface JsonResumeCertificate {\n readonly name: string;\n readonly date?: string;\n readonly issuer?: string;\n readonly url?: string;\n}\n\nexport interface JsonResumePublication {\n readonly name: string;\n readonly publisher?: string;\n readonly releaseDate?: string;\n readonly url?: string;\n readonly summary?: string;\n}\n\nexport interface JsonResumeSkill {\n readonly name: string;\n}\n\nexport interface JsonResumeLanguage {\n readonly language: string;\n readonly fluency?: string;\n}\n\nexport interface JsonResumeProject {\n readonly name: string;\n readonly description?: string;\n readonly url?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeMeta {\n readonly canonical: string;\n readonly version: string;\n readonly lastModified?: string;\n}\n\nexport interface JsonResume {\n readonly basics?: JsonResumeBasics;\n readonly work?: JsonResumeWork[];\n readonly volunteer?: JsonResumeVolunteer[];\n readonly education?: JsonResumeEducation[];\n readonly awards?: JsonResumeAward[];\n readonly certificates?: JsonResumeCertificate[];\n readonly publications?: JsonResumePublication[];\n readonly skills?: JsonResumeSkill[];\n readonly languages?: JsonResumeLanguage[];\n readonly projects?: JsonResumeProject[];\n readonly meta?: JsonResumeMeta;\n}\n\n/** Schema version this emitter targets, as JSON Resume writes it in `meta`. */\nconst SCHEMA_VERSION = 'v1.0.0';\n\n/**\n * A date JSON Resume will accept: `YYYY`, `YYYY-MM` or `YYYY-MM-DD`. Sifa\n * stores RFC 3339 for some fields, and a full timestamp pasted into a CV\n * template renders as `2020-03-04T00:00:00.000Z` on the page.\n */\nconst RESUME_DATE_RE = /^(\\d{4})(-\\d{2})?(-\\d{2})?/;\n\nexport function toResumeDate(value: string | undefined): string | undefined {\n const trimmed = value?.trim();\n if (!trimmed) return undefined;\n const match = RESUME_DATE_RE.exec(trimmed);\n return match ? match[0] : undefined;\n}\n\n/**\n * JSON Resume's `fluency` is free text, so these are display labels rather\n * than a mapped vocabulary. Kept in one place so export and a future import\n * agree on the spelling.\n */\nconst FLUENCY_LABELS: Record<LanguageProficiency, string> = {\n elementary: 'Elementary',\n limited_working: 'Limited working',\n professional_working: 'Professional working',\n full_professional: 'Full professional',\n native: 'Native or bilingual',\n};\n\nconst identity: Sanitizer = (input) => input;\n\n/** Drops keys whose value is undefined, so the document carries no empty slots. */\nfunction compact<T extends object>(value: T): T {\n return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined)) as T;\n}\n\n/** Omits the key entirely when the mapped list came out empty. */\nfunction section<K extends string, T>(key: K, items: T[]): Record<K, T[]> | undefined {\n return items.length > 0 ? ({ [key]: items } as Record<K, T[]>) : undefined;\n}\n\nfunction mapLocation(\n location: LocationValue | null | undefined,\n s: Sanitizer,\n): JsonResumeLocation | undefined {\n if (!location) return undefined;\n const mapped = compact({\n city: text(location.locality ?? location.city, s),\n region: text(location.region, s),\n countryCode: text(location.countryCode, s),\n postalCode: text(location.postalCode, s),\n });\n return Object.keys(mapped).length > 0 ? mapped : undefined;\n}\n\n/** Trimmed, sanitised, and undefined when there is nothing left. */\nfunction text(value: string | undefined, s: Sanitizer): string | undefined {\n const trimmed = value?.trim();\n return trimmed ? s(trimmed) : undefined;\n}\n\n/**\n * The name to print for a linked organization. `entityName` is the AppView's\n * resolved current name and wins when present, matching how the profile itself\n * renders these.\n */\nfunction orgName(\n entityName: string | undefined,\n stored: string | undefined,\n s: Sanitizer,\n): string | undefined {\n return text(entityName, s) ?? text(stored, s);\n}\n\n/**\n * Build a JSON Resume v1.0.0 document from a Sifa profile.\n *\n * Hidden records are dropped. Keys are omitted rather than emitted empty, so a\n * profile with no publications produces a document with no `publications` key\n * instead of one a reader has to interpret.\n */\nexport function profileToJsonResume(\n profile: JsonResumeProfileInput,\n options: JsonResumeOptions = {},\n): JsonResume {\n const s = options.sanitize ?? identity;\n const baseUrl = normaliseBaseUrl(options.baseUrl);\n const canonical = options.canonicalUrl ?? profileUrl(baseUrl, profile.handle);\n\n const name =\n formatStructuredName(profile.givenName, profile.familyName) ??\n text(profile.displayName, s) ??\n profile.handle;\n\n const profiles = filterHidden(profile.externalAccounts).map((account) =>\n compact<JsonResumeProfileLink>({\n network: s(account.platform),\n username: text(account.label, s),\n url: account.url,\n }),\n );\n\n const basics = compact<JsonResumeBasics>({\n name,\n label: text(profile.headline, s),\n image: profile.avatar,\n url: text(profile.website, s) ?? canonical,\n summary: text(profile.about, s),\n location: mapLocation(profile.location, s),\n ...section('profiles', profiles),\n });\n\n const work = filterHidden(profile.positions).map((position) =>\n compact<JsonResumeWork>({\n name: orgName(position.entityName, position.company, s),\n position: s(position.title),\n summary: text(position.description, s),\n startDate: toResumeDate(position.startedAt),\n endDate: toResumeDate(position.endedAt),\n }),\n );\n\n const volunteer = filterHidden(profile.volunteering).map((entry) =>\n compact<JsonResumeVolunteer>({\n organization: orgName(entry.entityName, entry.organization, s) ?? '',\n position: text(entry.role, s),\n summary: text(entry.description, s),\n startDate: toResumeDate(entry.startDate),\n endDate: toResumeDate(entry.endDate),\n }),\n );\n\n const education = filterHidden(profile.education).map((entry) =>\n compact<JsonResumeEducation>({\n institution: orgName(entry.entityName, entry.institution, s) ?? '',\n area: text(entry.fieldOfStudy, s),\n studyType: text(entry.degree, s),\n startDate: toResumeDate(entry.startedAt),\n endDate: toResumeDate(entry.endedAt),\n }),\n );\n\n const awards = filterHidden(profile.honors).map((honor) =>\n compact<JsonResumeAward>({\n title: s(honor.title),\n date: toResumeDate(honor.date),\n awarder: orgName(honor.entityName, honor.issuer, s),\n summary: text(honor.description, s),\n }),\n );\n\n const certificates = filterHidden(profile.certifications).map((cert) =>\n compact<JsonResumeCertificate>({\n name: s(cert.name),\n date: toResumeDate(cert.issueDate),\n // `issuingOrg` is the deprecated read-view alias for `authority`; records\n // indexed before the rename carry only the alias.\n issuer: orgName(cert.entityName, cert.authority ?? cert.issuingOrg, s),\n url: text(cert.credentialUrl, s),\n }),\n );\n\n const publications = filterHidden(profile.publications).map((publication) =>\n compact<JsonResumePublication>({\n name: s(publication.title),\n publisher: text(publication.publisher, s),\n releaseDate: toResumeDate(publication.date),\n url: text(publication.url, s),\n summary: text(publication.description, s),\n }),\n );\n\n // One entry per skill rather than JSON Resume's grouped shape: Sifa stores one\n // record per skill, and keeping the two symmetric is what makes a round-trip\n // through a third-party editor safe. Category and endorsement counts have no\n // JSON Resume slot and are dropped. Skill records carry no `hidden` flag, so\n // there is nothing to filter here.\n const skills = (profile.skills ?? []).map((skill) => ({ name: s(skill.name) }));\n\n const languages = filterHidden(profile.languages).map((language) =>\n compact<JsonResumeLanguage>({\n language: s(language.language),\n fluency: language.proficiency ? FLUENCY_LABELS[language.proficiency] : undefined,\n }),\n );\n\n const projects = filterHidden(profile.projects).map((project) =>\n compact<JsonResumeProject>({\n name: s(project.name),\n description: text(project.description, s),\n url: text(project.url, s),\n startDate: toResumeDate(project.startDate),\n endDate: toResumeDate(project.endDate),\n }),\n );\n\n return {\n basics,\n ...section('work', work),\n ...section('volunteer', volunteer),\n ...section('education', education),\n ...section('awards', awards),\n ...section('certificates', certificates),\n ...section('publications', publications),\n ...section('skills', skills),\n ...section('languages', languages),\n ...section('projects', projects),\n meta: { canonical, version: SCHEMA_VERSION },\n };\n}\n"]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { L as LocationValue, d as ProfilePosition, f as ProfileEducation, P as ProfileSkill, e as ProfileCertification, i as ProfileProject, j as ProfilePublication, J as ProfileVolunteering, g as ProfileHonor, h as ProfileLanguage, p as ExternalAccount } from '../index-CTzpbW81.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSON Resume v1.0.0 emitter for a Sifa profile.
|
|
5
|
+
*
|
|
6
|
+
* https://jsonresume.org/schema/
|
|
7
|
+
*
|
|
8
|
+
* One pure function, no fetching, no DOM, no framework -- the same shape as the
|
|
9
|
+
* JSON-LD emitter next door, and for the same reason: sifa.id, page.sifa.id and
|
|
10
|
+
* any future consumer should emit one document from one implementation.
|
|
11
|
+
*
|
|
12
|
+
* Why this format earns its place: it is the lingua franca of CV tooling, so
|
|
13
|
+
* emitting it hands a user every JSON Resume theme, and the Typst CV templates
|
|
14
|
+
* on Typst Universe, without Sifa writing a renderer for any of them.
|
|
15
|
+
*
|
|
16
|
+
* Fields Sifa holds that JSON Resume has no slot for -- endorsements,
|
|
17
|
+
* confirmations, involvement, investments, presentations, courses -- are
|
|
18
|
+
* dropped rather than smuggled into a nearby field. The loss is documented for
|
|
19
|
+
* the user at the point of download.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
type Sanitizer = (input: string) => string;
|
|
23
|
+
interface JsonResumeOptions {
|
|
24
|
+
/** Canonical origin for the profile URL. Defaults to `https://sifa.id`. */
|
|
25
|
+
readonly baseUrl?: string;
|
|
26
|
+
/** Applied to every user-authored string. Defaults to identity. */
|
|
27
|
+
readonly sanitize?: Sanitizer;
|
|
28
|
+
/**
|
|
29
|
+
* Absolute URL of the profile this resume describes. Defaults to
|
|
30
|
+
* `${baseUrl}/p/${handle}`. A personal site served from a custom domain is
|
|
31
|
+
* not at that path.
|
|
32
|
+
*/
|
|
33
|
+
readonly canonicalUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The subset of `Profile` this emitter reads. Deliberately structural rather
|
|
37
|
+
* than the full `Profile`, so a caller holding a partially hydrated profile --
|
|
38
|
+
* or a test -- does not have to invent forty unrelated fields.
|
|
39
|
+
*/
|
|
40
|
+
interface JsonResumeProfileInput {
|
|
41
|
+
readonly handle: string;
|
|
42
|
+
readonly displayName?: string;
|
|
43
|
+
readonly givenName?: string;
|
|
44
|
+
readonly familyName?: string;
|
|
45
|
+
readonly avatar?: string;
|
|
46
|
+
readonly headline?: string;
|
|
47
|
+
readonly about?: string;
|
|
48
|
+
readonly website?: string;
|
|
49
|
+
readonly location?: LocationValue | null;
|
|
50
|
+
readonly positions?: ProfilePosition[];
|
|
51
|
+
readonly education?: ProfileEducation[];
|
|
52
|
+
readonly skills?: ProfileSkill[];
|
|
53
|
+
readonly certifications?: ProfileCertification[];
|
|
54
|
+
readonly projects?: ProfileProject[];
|
|
55
|
+
readonly publications?: ProfilePublication[];
|
|
56
|
+
readonly volunteering?: ProfileVolunteering[];
|
|
57
|
+
readonly honors?: ProfileHonor[];
|
|
58
|
+
readonly languages?: ProfileLanguage[];
|
|
59
|
+
readonly externalAccounts?: ExternalAccount[];
|
|
60
|
+
}
|
|
61
|
+
interface JsonResumeLocation {
|
|
62
|
+
readonly city?: string;
|
|
63
|
+
readonly region?: string;
|
|
64
|
+
readonly countryCode?: string;
|
|
65
|
+
readonly postalCode?: string;
|
|
66
|
+
}
|
|
67
|
+
interface JsonResumeProfileLink {
|
|
68
|
+
readonly network: string;
|
|
69
|
+
readonly username?: string;
|
|
70
|
+
readonly url: string;
|
|
71
|
+
}
|
|
72
|
+
interface JsonResumeBasics {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly label?: string;
|
|
75
|
+
readonly image?: string;
|
|
76
|
+
readonly url?: string;
|
|
77
|
+
readonly summary?: string;
|
|
78
|
+
readonly location?: JsonResumeLocation;
|
|
79
|
+
readonly profiles?: JsonResumeProfileLink[];
|
|
80
|
+
}
|
|
81
|
+
interface JsonResumeWork {
|
|
82
|
+
readonly name?: string;
|
|
83
|
+
readonly position: string;
|
|
84
|
+
readonly summary?: string;
|
|
85
|
+
readonly startDate?: string;
|
|
86
|
+
readonly endDate?: string;
|
|
87
|
+
}
|
|
88
|
+
interface JsonResumeVolunteer {
|
|
89
|
+
readonly organization: string;
|
|
90
|
+
readonly position?: string;
|
|
91
|
+
readonly summary?: string;
|
|
92
|
+
readonly startDate?: string;
|
|
93
|
+
readonly endDate?: string;
|
|
94
|
+
}
|
|
95
|
+
interface JsonResumeEducation {
|
|
96
|
+
readonly institution: string;
|
|
97
|
+
readonly area?: string;
|
|
98
|
+
readonly studyType?: string;
|
|
99
|
+
readonly startDate?: string;
|
|
100
|
+
readonly endDate?: string;
|
|
101
|
+
}
|
|
102
|
+
interface JsonResumeAward {
|
|
103
|
+
readonly title: string;
|
|
104
|
+
readonly date?: string;
|
|
105
|
+
readonly awarder?: string;
|
|
106
|
+
readonly summary?: string;
|
|
107
|
+
}
|
|
108
|
+
interface JsonResumeCertificate {
|
|
109
|
+
readonly name: string;
|
|
110
|
+
readonly date?: string;
|
|
111
|
+
readonly issuer?: string;
|
|
112
|
+
readonly url?: string;
|
|
113
|
+
}
|
|
114
|
+
interface JsonResumePublication {
|
|
115
|
+
readonly name: string;
|
|
116
|
+
readonly publisher?: string;
|
|
117
|
+
readonly releaseDate?: string;
|
|
118
|
+
readonly url?: string;
|
|
119
|
+
readonly summary?: string;
|
|
120
|
+
}
|
|
121
|
+
interface JsonResumeSkill {
|
|
122
|
+
readonly name: string;
|
|
123
|
+
}
|
|
124
|
+
interface JsonResumeLanguage {
|
|
125
|
+
readonly language: string;
|
|
126
|
+
readonly fluency?: string;
|
|
127
|
+
}
|
|
128
|
+
interface JsonResumeProject {
|
|
129
|
+
readonly name: string;
|
|
130
|
+
readonly description?: string;
|
|
131
|
+
readonly url?: string;
|
|
132
|
+
readonly startDate?: string;
|
|
133
|
+
readonly endDate?: string;
|
|
134
|
+
}
|
|
135
|
+
interface JsonResumeMeta {
|
|
136
|
+
readonly canonical: string;
|
|
137
|
+
readonly version: string;
|
|
138
|
+
readonly lastModified?: string;
|
|
139
|
+
}
|
|
140
|
+
interface JsonResume {
|
|
141
|
+
readonly basics?: JsonResumeBasics;
|
|
142
|
+
readonly work?: JsonResumeWork[];
|
|
143
|
+
readonly volunteer?: JsonResumeVolunteer[];
|
|
144
|
+
readonly education?: JsonResumeEducation[];
|
|
145
|
+
readonly awards?: JsonResumeAward[];
|
|
146
|
+
readonly certificates?: JsonResumeCertificate[];
|
|
147
|
+
readonly publications?: JsonResumePublication[];
|
|
148
|
+
readonly skills?: JsonResumeSkill[];
|
|
149
|
+
readonly languages?: JsonResumeLanguage[];
|
|
150
|
+
readonly projects?: JsonResumeProject[];
|
|
151
|
+
readonly meta?: JsonResumeMeta;
|
|
152
|
+
}
|
|
153
|
+
declare function toResumeDate(value: string | undefined): string | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Build a JSON Resume v1.0.0 document from a Sifa profile.
|
|
156
|
+
*
|
|
157
|
+
* Hidden records are dropped. Keys are omitted rather than emitted empty, so a
|
|
158
|
+
* profile with no publications produces a document with no `publications` key
|
|
159
|
+
* instead of one a reader has to interpret.
|
|
160
|
+
*/
|
|
161
|
+
declare function profileToJsonResume(profile: JsonResumeProfileInput, options?: JsonResumeOptions): JsonResume;
|
|
162
|
+
|
|
163
|
+
export { type JsonResume, type JsonResumeAward, type JsonResumeBasics, type JsonResumeCertificate, type JsonResumeEducation, type JsonResumeLanguage, type JsonResumeLocation, type JsonResumeMeta, type JsonResumeOptions, type JsonResumeProfileInput, type JsonResumeProfileLink, type JsonResumeProject, type JsonResumePublication, type JsonResumeSkill, type JsonResumeVolunteer, type JsonResumeWork, type Sanitizer, profileToJsonResume, toResumeDate };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { L as LocationValue, d as ProfilePosition, f as ProfileEducation, P as ProfileSkill, e as ProfileCertification, i as ProfileProject, j as ProfilePublication, J as ProfileVolunteering, g as ProfileHonor, h as ProfileLanguage, p as ExternalAccount } from '../index-CTzpbW81.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSON Resume v1.0.0 emitter for a Sifa profile.
|
|
5
|
+
*
|
|
6
|
+
* https://jsonresume.org/schema/
|
|
7
|
+
*
|
|
8
|
+
* One pure function, no fetching, no DOM, no framework -- the same shape as the
|
|
9
|
+
* JSON-LD emitter next door, and for the same reason: sifa.id, page.sifa.id and
|
|
10
|
+
* any future consumer should emit one document from one implementation.
|
|
11
|
+
*
|
|
12
|
+
* Why this format earns its place: it is the lingua franca of CV tooling, so
|
|
13
|
+
* emitting it hands a user every JSON Resume theme, and the Typst CV templates
|
|
14
|
+
* on Typst Universe, without Sifa writing a renderer for any of them.
|
|
15
|
+
*
|
|
16
|
+
* Fields Sifa holds that JSON Resume has no slot for -- endorsements,
|
|
17
|
+
* confirmations, involvement, investments, presentations, courses -- are
|
|
18
|
+
* dropped rather than smuggled into a nearby field. The loss is documented for
|
|
19
|
+
* the user at the point of download.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
type Sanitizer = (input: string) => string;
|
|
23
|
+
interface JsonResumeOptions {
|
|
24
|
+
/** Canonical origin for the profile URL. Defaults to `https://sifa.id`. */
|
|
25
|
+
readonly baseUrl?: string;
|
|
26
|
+
/** Applied to every user-authored string. Defaults to identity. */
|
|
27
|
+
readonly sanitize?: Sanitizer;
|
|
28
|
+
/**
|
|
29
|
+
* Absolute URL of the profile this resume describes. Defaults to
|
|
30
|
+
* `${baseUrl}/p/${handle}`. A personal site served from a custom domain is
|
|
31
|
+
* not at that path.
|
|
32
|
+
*/
|
|
33
|
+
readonly canonicalUrl?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The subset of `Profile` this emitter reads. Deliberately structural rather
|
|
37
|
+
* than the full `Profile`, so a caller holding a partially hydrated profile --
|
|
38
|
+
* or a test -- does not have to invent forty unrelated fields.
|
|
39
|
+
*/
|
|
40
|
+
interface JsonResumeProfileInput {
|
|
41
|
+
readonly handle: string;
|
|
42
|
+
readonly displayName?: string;
|
|
43
|
+
readonly givenName?: string;
|
|
44
|
+
readonly familyName?: string;
|
|
45
|
+
readonly avatar?: string;
|
|
46
|
+
readonly headline?: string;
|
|
47
|
+
readonly about?: string;
|
|
48
|
+
readonly website?: string;
|
|
49
|
+
readonly location?: LocationValue | null;
|
|
50
|
+
readonly positions?: ProfilePosition[];
|
|
51
|
+
readonly education?: ProfileEducation[];
|
|
52
|
+
readonly skills?: ProfileSkill[];
|
|
53
|
+
readonly certifications?: ProfileCertification[];
|
|
54
|
+
readonly projects?: ProfileProject[];
|
|
55
|
+
readonly publications?: ProfilePublication[];
|
|
56
|
+
readonly volunteering?: ProfileVolunteering[];
|
|
57
|
+
readonly honors?: ProfileHonor[];
|
|
58
|
+
readonly languages?: ProfileLanguage[];
|
|
59
|
+
readonly externalAccounts?: ExternalAccount[];
|
|
60
|
+
}
|
|
61
|
+
interface JsonResumeLocation {
|
|
62
|
+
readonly city?: string;
|
|
63
|
+
readonly region?: string;
|
|
64
|
+
readonly countryCode?: string;
|
|
65
|
+
readonly postalCode?: string;
|
|
66
|
+
}
|
|
67
|
+
interface JsonResumeProfileLink {
|
|
68
|
+
readonly network: string;
|
|
69
|
+
readonly username?: string;
|
|
70
|
+
readonly url: string;
|
|
71
|
+
}
|
|
72
|
+
interface JsonResumeBasics {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly label?: string;
|
|
75
|
+
readonly image?: string;
|
|
76
|
+
readonly url?: string;
|
|
77
|
+
readonly summary?: string;
|
|
78
|
+
readonly location?: JsonResumeLocation;
|
|
79
|
+
readonly profiles?: JsonResumeProfileLink[];
|
|
80
|
+
}
|
|
81
|
+
interface JsonResumeWork {
|
|
82
|
+
readonly name?: string;
|
|
83
|
+
readonly position: string;
|
|
84
|
+
readonly summary?: string;
|
|
85
|
+
readonly startDate?: string;
|
|
86
|
+
readonly endDate?: string;
|
|
87
|
+
}
|
|
88
|
+
interface JsonResumeVolunteer {
|
|
89
|
+
readonly organization: string;
|
|
90
|
+
readonly position?: string;
|
|
91
|
+
readonly summary?: string;
|
|
92
|
+
readonly startDate?: string;
|
|
93
|
+
readonly endDate?: string;
|
|
94
|
+
}
|
|
95
|
+
interface JsonResumeEducation {
|
|
96
|
+
readonly institution: string;
|
|
97
|
+
readonly area?: string;
|
|
98
|
+
readonly studyType?: string;
|
|
99
|
+
readonly startDate?: string;
|
|
100
|
+
readonly endDate?: string;
|
|
101
|
+
}
|
|
102
|
+
interface JsonResumeAward {
|
|
103
|
+
readonly title: string;
|
|
104
|
+
readonly date?: string;
|
|
105
|
+
readonly awarder?: string;
|
|
106
|
+
readonly summary?: string;
|
|
107
|
+
}
|
|
108
|
+
interface JsonResumeCertificate {
|
|
109
|
+
readonly name: string;
|
|
110
|
+
readonly date?: string;
|
|
111
|
+
readonly issuer?: string;
|
|
112
|
+
readonly url?: string;
|
|
113
|
+
}
|
|
114
|
+
interface JsonResumePublication {
|
|
115
|
+
readonly name: string;
|
|
116
|
+
readonly publisher?: string;
|
|
117
|
+
readonly releaseDate?: string;
|
|
118
|
+
readonly url?: string;
|
|
119
|
+
readonly summary?: string;
|
|
120
|
+
}
|
|
121
|
+
interface JsonResumeSkill {
|
|
122
|
+
readonly name: string;
|
|
123
|
+
}
|
|
124
|
+
interface JsonResumeLanguage {
|
|
125
|
+
readonly language: string;
|
|
126
|
+
readonly fluency?: string;
|
|
127
|
+
}
|
|
128
|
+
interface JsonResumeProject {
|
|
129
|
+
readonly name: string;
|
|
130
|
+
readonly description?: string;
|
|
131
|
+
readonly url?: string;
|
|
132
|
+
readonly startDate?: string;
|
|
133
|
+
readonly endDate?: string;
|
|
134
|
+
}
|
|
135
|
+
interface JsonResumeMeta {
|
|
136
|
+
readonly canonical: string;
|
|
137
|
+
readonly version: string;
|
|
138
|
+
readonly lastModified?: string;
|
|
139
|
+
}
|
|
140
|
+
interface JsonResume {
|
|
141
|
+
readonly basics?: JsonResumeBasics;
|
|
142
|
+
readonly work?: JsonResumeWork[];
|
|
143
|
+
readonly volunteer?: JsonResumeVolunteer[];
|
|
144
|
+
readonly education?: JsonResumeEducation[];
|
|
145
|
+
readonly awards?: JsonResumeAward[];
|
|
146
|
+
readonly certificates?: JsonResumeCertificate[];
|
|
147
|
+
readonly publications?: JsonResumePublication[];
|
|
148
|
+
readonly skills?: JsonResumeSkill[];
|
|
149
|
+
readonly languages?: JsonResumeLanguage[];
|
|
150
|
+
readonly projects?: JsonResumeProject[];
|
|
151
|
+
readonly meta?: JsonResumeMeta;
|
|
152
|
+
}
|
|
153
|
+
declare function toResumeDate(value: string | undefined): string | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Build a JSON Resume v1.0.0 document from a Sifa profile.
|
|
156
|
+
*
|
|
157
|
+
* Hidden records are dropped. Keys are omitted rather than emitted empty, so a
|
|
158
|
+
* profile with no publications produces a document with no `publications` key
|
|
159
|
+
* instead of one a reader has to interpret.
|
|
160
|
+
*/
|
|
161
|
+
declare function profileToJsonResume(profile: JsonResumeProfileInput, options?: JsonResumeOptions): JsonResume;
|
|
162
|
+
|
|
163
|
+
export { type JsonResume, type JsonResumeAward, type JsonResumeBasics, type JsonResumeCertificate, type JsonResumeEducation, type JsonResumeLanguage, type JsonResumeLocation, type JsonResumeMeta, type JsonResumeOptions, type JsonResumeProfileInput, type JsonResumeProfileLink, type JsonResumeProject, type JsonResumePublication, type JsonResumeSkill, type JsonResumeVolunteer, type JsonResumeWork, type Sanitizer, profileToJsonResume, toResumeDate };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// src/format/pds-utils.ts
|
|
2
|
+
var PDS_PROVIDERS = [
|
|
3
|
+
{ suffix: ".bsky.social", name: "bluesky" },
|
|
4
|
+
{ suffix: ".blacksky.app", name: "blacksky" },
|
|
5
|
+
{ suffix: ".eurosky.social", name: "eurosky" },
|
|
6
|
+
{ suffix: ".northsky.social", name: "northsky" }
|
|
7
|
+
];
|
|
8
|
+
new Set(PDS_PROVIDERS.map((p) => p.name));
|
|
9
|
+
function formatStructuredName(givenName, familyName) {
|
|
10
|
+
const given = givenName?.trim();
|
|
11
|
+
const family = familyName?.trim();
|
|
12
|
+
if (given && family) return `${given} ${family}`;
|
|
13
|
+
return given || family || void 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/profile/section-model.ts
|
|
17
|
+
function filterHidden(items) {
|
|
18
|
+
return (items ?? []).filter((i) => !i.hidden);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/jsonld/url.ts
|
|
22
|
+
var DEFAULT_BASE_URL = "https://sifa.id";
|
|
23
|
+
function normaliseBaseUrl(baseUrl) {
|
|
24
|
+
const value = baseUrl ?? DEFAULT_BASE_URL;
|
|
25
|
+
let end = value.length;
|
|
26
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
27
|
+
return value.slice(0, end);
|
|
28
|
+
}
|
|
29
|
+
function profileUrl(baseUrl, handle) {
|
|
30
|
+
return `${baseUrl}/p/${handle}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/resume/json-resume.ts
|
|
34
|
+
var SCHEMA_VERSION = "v1.0.0";
|
|
35
|
+
var RESUME_DATE_RE = /^(\d{4})(-\d{2})?(-\d{2})?/;
|
|
36
|
+
function toResumeDate(value) {
|
|
37
|
+
const trimmed = value?.trim();
|
|
38
|
+
if (!trimmed) return void 0;
|
|
39
|
+
const match = RESUME_DATE_RE.exec(trimmed);
|
|
40
|
+
return match ? match[0] : void 0;
|
|
41
|
+
}
|
|
42
|
+
var FLUENCY_LABELS = {
|
|
43
|
+
elementary: "Elementary",
|
|
44
|
+
limited_working: "Limited working",
|
|
45
|
+
professional_working: "Professional working",
|
|
46
|
+
full_professional: "Full professional",
|
|
47
|
+
native: "Native or bilingual"
|
|
48
|
+
};
|
|
49
|
+
var identity = (input) => input;
|
|
50
|
+
function compact(value) {
|
|
51
|
+
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
|
|
52
|
+
}
|
|
53
|
+
function section(key, items) {
|
|
54
|
+
return items.length > 0 ? { [key]: items } : void 0;
|
|
55
|
+
}
|
|
56
|
+
function mapLocation(location, s) {
|
|
57
|
+
if (!location) return void 0;
|
|
58
|
+
const mapped = compact({
|
|
59
|
+
city: text(location.locality ?? location.city, s),
|
|
60
|
+
region: text(location.region, s),
|
|
61
|
+
countryCode: text(location.countryCode, s),
|
|
62
|
+
postalCode: text(location.postalCode, s)
|
|
63
|
+
});
|
|
64
|
+
return Object.keys(mapped).length > 0 ? mapped : void 0;
|
|
65
|
+
}
|
|
66
|
+
function text(value, s) {
|
|
67
|
+
const trimmed = value?.trim();
|
|
68
|
+
return trimmed ? s(trimmed) : void 0;
|
|
69
|
+
}
|
|
70
|
+
function orgName(entityName, stored, s) {
|
|
71
|
+
return text(entityName, s) ?? text(stored, s);
|
|
72
|
+
}
|
|
73
|
+
function profileToJsonResume(profile, options = {}) {
|
|
74
|
+
const s = options.sanitize ?? identity;
|
|
75
|
+
const baseUrl = normaliseBaseUrl(options.baseUrl);
|
|
76
|
+
const canonical = options.canonicalUrl ?? profileUrl(baseUrl, profile.handle);
|
|
77
|
+
const name = formatStructuredName(profile.givenName, profile.familyName) ?? text(profile.displayName, s) ?? profile.handle;
|
|
78
|
+
const profiles = filterHidden(profile.externalAccounts).map(
|
|
79
|
+
(account) => compact({
|
|
80
|
+
network: s(account.platform),
|
|
81
|
+
username: text(account.label, s),
|
|
82
|
+
url: account.url
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
const basics = compact({
|
|
86
|
+
name,
|
|
87
|
+
label: text(profile.headline, s),
|
|
88
|
+
image: profile.avatar,
|
|
89
|
+
url: text(profile.website, s) ?? canonical,
|
|
90
|
+
summary: text(profile.about, s),
|
|
91
|
+
location: mapLocation(profile.location, s),
|
|
92
|
+
...section("profiles", profiles)
|
|
93
|
+
});
|
|
94
|
+
const work = filterHidden(profile.positions).map(
|
|
95
|
+
(position) => compact({
|
|
96
|
+
name: orgName(position.entityName, position.company, s),
|
|
97
|
+
position: s(position.title),
|
|
98
|
+
summary: text(position.description, s),
|
|
99
|
+
startDate: toResumeDate(position.startedAt),
|
|
100
|
+
endDate: toResumeDate(position.endedAt)
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
const volunteer = filterHidden(profile.volunteering).map(
|
|
104
|
+
(entry) => compact({
|
|
105
|
+
organization: orgName(entry.entityName, entry.organization, s) ?? "",
|
|
106
|
+
position: text(entry.role, s),
|
|
107
|
+
summary: text(entry.description, s),
|
|
108
|
+
startDate: toResumeDate(entry.startDate),
|
|
109
|
+
endDate: toResumeDate(entry.endDate)
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
const education = filterHidden(profile.education).map(
|
|
113
|
+
(entry) => compact({
|
|
114
|
+
institution: orgName(entry.entityName, entry.institution, s) ?? "",
|
|
115
|
+
area: text(entry.fieldOfStudy, s),
|
|
116
|
+
studyType: text(entry.degree, s),
|
|
117
|
+
startDate: toResumeDate(entry.startedAt),
|
|
118
|
+
endDate: toResumeDate(entry.endedAt)
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
const awards = filterHidden(profile.honors).map(
|
|
122
|
+
(honor) => compact({
|
|
123
|
+
title: s(honor.title),
|
|
124
|
+
date: toResumeDate(honor.date),
|
|
125
|
+
awarder: orgName(honor.entityName, honor.issuer, s),
|
|
126
|
+
summary: text(honor.description, s)
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
const certificates = filterHidden(profile.certifications).map(
|
|
130
|
+
(cert) => compact({
|
|
131
|
+
name: s(cert.name),
|
|
132
|
+
date: toResumeDate(cert.issueDate),
|
|
133
|
+
// `issuingOrg` is the deprecated read-view alias for `authority`; records
|
|
134
|
+
// indexed before the rename carry only the alias.
|
|
135
|
+
issuer: orgName(cert.entityName, cert.authority ?? cert.issuingOrg, s),
|
|
136
|
+
url: text(cert.credentialUrl, s)
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
const publications = filterHidden(profile.publications).map(
|
|
140
|
+
(publication) => compact({
|
|
141
|
+
name: s(publication.title),
|
|
142
|
+
publisher: text(publication.publisher, s),
|
|
143
|
+
releaseDate: toResumeDate(publication.date),
|
|
144
|
+
url: text(publication.url, s),
|
|
145
|
+
summary: text(publication.description, s)
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
const skills = (profile.skills ?? []).map((skill) => ({ name: s(skill.name) }));
|
|
149
|
+
const languages = filterHidden(profile.languages).map(
|
|
150
|
+
(language) => compact({
|
|
151
|
+
language: s(language.language),
|
|
152
|
+
fluency: language.proficiency ? FLUENCY_LABELS[language.proficiency] : void 0
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
const projects = filterHidden(profile.projects).map(
|
|
156
|
+
(project) => compact({
|
|
157
|
+
name: s(project.name),
|
|
158
|
+
description: text(project.description, s),
|
|
159
|
+
url: text(project.url, s),
|
|
160
|
+
startDate: toResumeDate(project.startDate),
|
|
161
|
+
endDate: toResumeDate(project.endDate)
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
return {
|
|
165
|
+
basics,
|
|
166
|
+
...section("work", work),
|
|
167
|
+
...section("volunteer", volunteer),
|
|
168
|
+
...section("education", education),
|
|
169
|
+
...section("awards", awards),
|
|
170
|
+
...section("certificates", certificates),
|
|
171
|
+
...section("publications", publications),
|
|
172
|
+
...section("skills", skills),
|
|
173
|
+
...section("languages", languages),
|
|
174
|
+
...section("projects", projects),
|
|
175
|
+
meta: { canonical, version: SCHEMA_VERSION }
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export { profileToJsonResume, toResumeDate };
|
|
180
|
+
//# sourceMappingURL=index.js.map
|
|
181
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/format/pds-utils.ts","../../src/profile/section-model.ts","../../src/jsonld/url.ts","../../src/resume/json-resume.ts"],"names":[],"mappings":";AAUA,IAAM,aAAA,GAAoD;AAAA,EACxD,EAAE,MAAA,EAAQ,cAAA,EAAgB,IAAA,EAAM,SAAA,EAAU;AAAA,EAC1C,EAAE,MAAA,EAAQ,eAAA,EAAiB,IAAA,EAAM,UAAA,EAAW;AAAA,EAC5C,EAAE,MAAA,EAAQ,iBAAA,EAAmB,IAAA,EAAM,SAAA,EAAU;AAAA,EAC7C,EAAE,MAAA,EAAQ,kBAAA,EAAoB,IAAA,EAAM,UAAA;AACtC,CAAA;AAE6B,IAAI,GAAA,CAAI,aAAA,CAAc,IAAI,CAAC,CAAA,KAAM,CAAA,CAAE,IAAI,CAAC;AA4C9D,SAAS,oBAAA,CACd,WACA,UAAA,EACoB;AACpB,EAAA,MAAM,KAAA,GAAQ,W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AC,CAAA;AAAA,MACxB,SAAA,EAAW,YAAA,CAAa,OAAA,CAAQ,SAAS,CAAA;AAAA,MACzC,OAAA,EAAS,YAAA,CAAa,OAAA,CAAQ,OAAO;AAAA,KACtC;AAAA,GACH;AAEA,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,GAAG,OAAA,CAAQ,MAAA,EAAQ,IAAI,CAAA;AAAA,IACvB,GAAG,OAAA,CAAQ,WAAA,EAAa,SAAS,CAAA;AAAA,IACjC,GAAG,OAAA,CAAQ,WAAA,EAAa,SAAS,CAAA;AAAA,IACjC,GAAG,OAAA,CAAQ,QAAA,EAAU,MAAM,CAAA;AAAA,IAC3B,GAAG,OAAA,CAAQ,cAAA,EAAgB,YAAY,CAAA;AAAA,IACvC,GAAG,OAAA,CAAQ,cAAA,EAAgB,YAAY,CAAA;AAAA,IACvC,GAAG,OAAA,CAAQ,QAAA,EAAU,MAAM,CAAA;AAAA,IAC3B,GAAG,OAAA,CAAQ,WAAA,EAAa,SAAS,CAAA;AAAA,IACjC,GAAG,OAAA,CAAQ,UAAA,EAAY,QAAQ,CAAA;AAAA,IAC/B,IAAA,EAAM,EAAE,SAAA,EAAW,OAAA,EAAS,cAAA;AAAe,GAC7C;AACF","file":"index.js","sourcesContent":["import type { PdsProviderInfo } from '../types/index.js';\n\nexport interface PdsProvider {\n name: string;\n profileUrl: string;\n host?: string;\n}\n\nconst BSKY_PROFILE_BASE = 'https://bsky.app/profile/';\n\nconst PDS_PROVIDERS: { suffix: string; name: string }[] = [\n { suffix: '.bsky.social', name: 'bluesky' },\n { suffix: '.blacksky.app', name: 'blacksky' },\n { suffix: '.eurosky.social', name: 'eurosky' },\n { suffix: '.northsky.social', name: 'northsky' },\n];\n\nconst KNOWN_PROVIDER_NAMES = new Set(PDS_PROVIDERS.map((p) => p.name));\n\nconst ICON_ONLY_PROVIDERS = new Set(['selfhosted-social', 'selfhosted']);\n\nexport function pdsProviderFromApi(\n apiProvider: PdsProviderInfo | null | undefined,\n handle: string,\n): PdsProvider | null {\n if (!apiProvider) return null;\n if (ICON_ONLY_PROVIDERS.has(apiProvider.name)) {\n return { name: apiProvider.name, profileUrl: '', host: apiProvider.host };\n }\n if (!KNOWN_PROVIDER_NAMES.has(apiProvider.name)) return null;\n return {\n name: apiProvider.name,\n profileUrl: `${BSKY_PROFILE_BASE}${handle}`,\n host: apiProvider.host,\n };\n}\n\nexport function getHandleStem(handle: string): string {\n const lower = handle.toLowerCase();\n for (const provider of PDS_PROVIDERS) {\n if (lower.endsWith(provider.suffix) && lower.length > provider.suffix.length) {\n return handle.slice(0, -provider.suffix.length);\n }\n }\n return handle;\n}\n\nexport function getDisplayLabel(displayName: string | undefined, handle: string): string {\n if (displayName) return displayName;\n return getHandleStem(handle);\n}\n\n/**\n * Combine optional structured name fields (`id.sifa.profile.self.givenName`,\n * `familyName`) into a single string in Schema.org `Person` order — given\n * before family. Returns `undefined` when both are absent so callers can\n * fall back to `displayName`. Whitespace-only inputs are treated as absent.\n * Does not impose cultural ordering: users whose preferred presentation\n * differs (e.g. Eastern name order) should set `displayName` accordingly,\n * which this helper deliberately does not consult.\n */\nexport function formatStructuredName(\n givenName: string | undefined,\n familyName: string | undefined,\n): string | undefined {\n const given = givenName?.trim();\n const family = familyName?.trim();\n if (given && family) return `${given} ${family}`;\n return given || family || undefined;\n}\n\nconst PDS_DISPLAY_NAMES: Record<string, string> = {\n bluesky: 'Bluesky',\n blacksky: 'BlackSky',\n eurosky: 'EuroSky',\n northsky: 'NorthSky',\n 'selfhosted-social': 'Self-hosted',\n selfhosted: 'Self-hosted',\n};\n\nexport function getPdsDisplayName(providerName: string): string {\n return PDS_DISPLAY_NAMES[providerName] ?? providerName;\n}\n\nexport function detectPdsProvider(handle: string): PdsProvider | null {\n const lower = handle.toLowerCase();\n for (const provider of PDS_PROVIDERS) {\n if (lower.endsWith(provider.suffix)) {\n return {\n name: provider.name,\n profileUrl: `${BSKY_PROFILE_BASE}${handle}`,\n };\n }\n }\n return null;\n}\n","/**\n * Shared, single-source-of-truth model for which profile sections render, in\n * what order, their nav grouping, and which items a given viewer may see.\n *\n * Every Sifa profile surface builds on this: the HTML profile page, the\n * Markdown / DOCX / print exports, and the standalone personal-site renderer.\n * Adding a section to {@link ALL_SECTIONS} makes it appear everywhere (the\n * exports drive presence + order from here, and {@link SECTION_LABELS} is an\n * exhaustive `Record<SectionId, string>`, so a new id is a compile error until\n * it has a label).\n *\n * The per-section sorts live in `./section-sorts.js`, built on the same SDK\n * date extractors the HTML section components use, so the surfaces cannot\n * diverge on ordering.\n */\n\nimport type { Profile } from '../types/index.js';\n\n/**\n * Side-nav groups, in display order. Each labels a contiguous run of sections\n * in {@link ALL_SECTIONS}. `labelKey` resolves against the consumer's `sections`\n * i18n namespace.\n */\nexport const SECTION_GROUPS = [\n { id: 'overview', labelKey: 'groupOverview' },\n { id: 'experience', labelKey: 'groupExperience' },\n { id: 'qualifications', labelKey: 'groupQualifications' },\n { id: 'more', labelKey: 'groupMore' },\n] as const;\n\nexport type SectionGroupId = (typeof SECTION_GROUPS)[number]['id'];\n\n/**\n * Profile body sections in render + nav order (evidence-first): identity and\n * activity lead, then living work (career, skills, projects, talks,\n * publications), then the formal record (credentials, education, courses), then\n * the rest. `ns` selects the consumer's i18n namespace for `labelKey`; `group`\n * ties the section to a {@link SECTION_GROUPS} header.\n */\nexport const ALL_SECTIONS = [\n { id: 'about', labelKey: 'about', ns: 'profile' as const, group: 'overview' as const },\n { id: 'career', labelKey: 'career', ns: 'sections' as const, group: 'experience' as const },\n { id: 'skills', labelKey: 'skills', ns: 'sections' as const, group: 'experience' as const },\n { id: 'projects', labelKey: 'projects', ns: 'sections' as const, group: 'experience' as const },\n {\n id: 'presentations',\n labelKey: 'talksAndSessions',\n ns: 'sections' as const,\n group: 'experience' as const,\n },\n {\n id: 'publications',\n labelKey: 'publications',\n ns: 'sections' as const,\n group: 'experience' as const,\n },\n {\n id: 'credentials',\n labelKey: 'credentials',\n ns: 'sections' as const,\n group: 'qualifications' as const,\n },\n {\n id: 'education',\n labelKey: 'education',\n ns: 'sections' as const,\n group: 'qualifications' as const,\n },\n { id: 'courses', labelKey: 'courses', ns: 'sections' as const, group: 'qualifications' as const },\n { id: 'awards', labelKey: 'awards', ns: 'sections' as const, group: 'more' as const },\n { id: 'involvement', labelKey: 'involvement', ns: 'sections' as const, group: 'more' as const },\n // Its own section rather than a group under involvement: that record is about\n // work contributed, this one about capital deployed.\n { id: 'investments', labelKey: 'investments', ns: 'sections' as const, group: 'more' as const },\n { id: 'languages', labelKey: 'languages', ns: 'sections' as const, group: 'more' as const },\n {\n id: 'other-profiles',\n labelKey: 'otherProfiles',\n ns: 'sections' as const,\n group: 'more' as const,\n },\n] as const;\n\n/** Every profile section id, in canonical render order. */\nexport type SectionId = (typeof ALL_SECTIONS)[number]['id'];\n\n/** Whether a section has content for a given profile (used to hide empty nav entries for visitors). */\nexport function isSectionPopulated(profile: Profile, id: string): boolean {\n switch (id) {\n case 'about':\n return Boolean(profile.about && profile.headline);\n case 'career':\n return Boolean(profile.positions?.length);\n case 'education':\n return Boolean(profile.education?.length);\n case 'courses':\n return Boolean(profile.courses?.length);\n case 'skills':\n return Boolean(profile.skills?.length);\n case 'projects':\n return Boolean(profile.projects?.length);\n case 'credentials':\n return Boolean(profile.certifications?.length);\n case 'publications':\n return Boolean(profile.publications?.length);\n case 'presentations':\n return (\n Boolean(profile.presentations?.length) || Boolean(profile.presentationDeliveries?.length)\n );\n case 'involvement':\n return Boolean(profile.involvement?.length);\n case 'investments':\n return Boolean(profile.investments?.length);\n case 'awards':\n return Boolean(profile.honors?.length);\n case 'languages':\n return Boolean(profile.languages?.length);\n case 'other-profiles':\n return Boolean(profile.externalAccounts?.length);\n default:\n return false;\n }\n}\n\n/**\n * The section ids a given viewer should see, in {@link ALL_SECTIONS} order.\n * Owners see every section; visitors only see populated ones.\n */\nexport function getVisibleSectionIds(profile: Profile, isOwnProfile: boolean): SectionId[] {\n return ALL_SECTIONS.map((s) => s.id).filter(\n (id) => isOwnProfile || isSectionPopulated(profile, id),\n );\n}\n\n/** Drop items the owner has hidden from visitors. */\nexport function filterHidden<T extends { hidden?: boolean }>(items: T[] | undefined): T[] {\n return (items ?? []).filter((i) => !i.hidden);\n}\n\n/**\n * Items visible to a given viewer: owners see their own hidden items, visitors\n * do not. Shared by every export format (markdown, docx, print) and the public\n * `.md` route so the hidden rule lives in one place.\n */\nexport function visibleItems<T extends { hidden?: boolean }>(\n items: T[] | undefined,\n isOwnProfile: boolean,\n): T[] {\n return isOwnProfile ? (items ?? []) : filterHidden(items);\n}\n\n/**\n * English heading text for each section, keyed by {@link SectionId} (e.g.\n * `other-profiles` renders as \"Links\"). Exhaustive `Record<SectionId, string>`:\n * adding a section to {@link ALL_SECTIONS} without a label here is a compile\n * error, so a section can never silently render without (or with a stale)\n * heading. Consumers with i18n resolve their own localized labels via\n * `labelKey`; this is the canonical English fallback used by the exports.\n */\nexport const SECTION_LABELS: Record<SectionId, string> = {\n about: 'About',\n career: 'Career',\n skills: 'Skills',\n projects: 'Projects',\n presentations: 'Talks & sessions',\n publications: 'Publications',\n credentials: 'Credentials',\n education: 'Education',\n courses: 'Courses',\n awards: 'Awards',\n involvement: 'Involvement',\n investments: 'Investments',\n languages: 'Languages',\n 'other-profiles': 'Links',\n};\n","/** Shared URL helpers for the JSON-LD emitters. */\n\nexport const DEFAULT_BASE_URL = 'https://sifa.id';\n\n/**\n * Drop trailing slashes from a caller-supplied base URL.\n *\n * Written as a scan rather than `replace(/\\/+$/, '')` on purpose: the regex\n * form is a polynomial-backtracking hazard on input the library does not\n * control (CodeQL js/polynomial-redos). This runs in linear time.\n */\nexport function normaliseBaseUrl(baseUrl: string | undefined): string {\n const value = baseUrl ?? DEFAULT_BASE_URL;\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 0x2f) end -= 1;\n return value.slice(0, end);\n}\n\nexport function profileUrl(baseUrl: string, handle: string): string {\n return `${baseUrl}/p/${handle}`;\n}\n","/**\n * JSON Resume v1.0.0 emitter for a Sifa profile.\n *\n * https://jsonresume.org/schema/\n *\n * One pure function, no fetching, no DOM, no framework -- the same shape as the\n * JSON-LD emitter next door, and for the same reason: sifa.id, page.sifa.id and\n * any future consumer should emit one document from one implementation.\n *\n * Why this format earns its place: it is the lingua franca of CV tooling, so\n * emitting it hands a user every JSON Resume theme, and the Typst CV templates\n * on Typst Universe, without Sifa writing a renderer for any of them.\n *\n * Fields Sifa holds that JSON Resume has no slot for -- endorsements,\n * confirmations, involvement, investments, presentations, courses -- are\n * dropped rather than smuggled into a nearby field. The loss is documented for\n * the user at the point of download.\n */\n\nimport { formatStructuredName } from '../format/pds-utils.js';\nimport { filterHidden } from '../profile/section-model.js';\nimport type {\n ExternalAccount,\n LanguageProficiency,\n LocationValue,\n ProfileCertification,\n ProfileEducation,\n ProfileHonor,\n ProfileLanguage,\n ProfilePosition,\n ProfileProject,\n ProfilePublication,\n ProfileSkill,\n ProfileVolunteering,\n} from '../types/index.js';\nimport { normaliseBaseUrl, profileUrl } from '../jsonld/url.js';\n\nexport type Sanitizer = (input: string) => string;\n\nexport interface JsonResumeOptions {\n /** Canonical origin for the profile URL. Defaults to `https://sifa.id`. */\n readonly baseUrl?: string;\n /** Applied to every user-authored string. Defaults to identity. */\n readonly sanitize?: Sanitizer;\n /**\n * Absolute URL of the profile this resume describes. Defaults to\n * `${baseUrl}/p/${handle}`. A personal site served from a custom domain is\n * not at that path.\n */\n readonly canonicalUrl?: string;\n}\n\n/**\n * The subset of `Profile` this emitter reads. Deliberately structural rather\n * than the full `Profile`, so a caller holding a partially hydrated profile --\n * or a test -- does not have to invent forty unrelated fields.\n */\nexport interface JsonResumeProfileInput {\n readonly handle: string;\n readonly displayName?: string;\n readonly givenName?: string;\n readonly familyName?: string;\n readonly avatar?: string;\n readonly headline?: string;\n readonly about?: string;\n readonly website?: string;\n readonly location?: LocationValue | null;\n readonly positions?: ProfilePosition[];\n readonly education?: ProfileEducation[];\n readonly skills?: ProfileSkill[];\n readonly certifications?: ProfileCertification[];\n readonly projects?: ProfileProject[];\n readonly publications?: ProfilePublication[];\n readonly volunteering?: ProfileVolunteering[];\n readonly honors?: ProfileHonor[];\n readonly languages?: ProfileLanguage[];\n readonly externalAccounts?: ExternalAccount[];\n}\n\nexport interface JsonResumeLocation {\n readonly city?: string;\n readonly region?: string;\n readonly countryCode?: string;\n readonly postalCode?: string;\n}\n\nexport interface JsonResumeProfileLink {\n readonly network: string;\n readonly username?: string;\n readonly url: string;\n}\n\nexport interface JsonResumeBasics {\n readonly name: string;\n readonly label?: string;\n readonly image?: string;\n readonly url?: string;\n readonly summary?: string;\n readonly location?: JsonResumeLocation;\n readonly profiles?: JsonResumeProfileLink[];\n}\n\nexport interface JsonResumeWork {\n readonly name?: string;\n readonly position: string;\n readonly summary?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeVolunteer {\n readonly organization: string;\n readonly position?: string;\n readonly summary?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeEducation {\n readonly institution: string;\n readonly area?: string;\n readonly studyType?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeAward {\n readonly title: string;\n readonly date?: string;\n readonly awarder?: string;\n readonly summary?: string;\n}\n\nexport interface JsonResumeCertificate {\n readonly name: string;\n readonly date?: string;\n readonly issuer?: string;\n readonly url?: string;\n}\n\nexport interface JsonResumePublication {\n readonly name: string;\n readonly publisher?: string;\n readonly releaseDate?: string;\n readonly url?: string;\n readonly summary?: string;\n}\n\nexport interface JsonResumeSkill {\n readonly name: string;\n}\n\nexport interface JsonResumeLanguage {\n readonly language: string;\n readonly fluency?: string;\n}\n\nexport interface JsonResumeProject {\n readonly name: string;\n readonly description?: string;\n readonly url?: string;\n readonly startDate?: string;\n readonly endDate?: string;\n}\n\nexport interface JsonResumeMeta {\n readonly canonical: string;\n readonly version: string;\n readonly lastModified?: string;\n}\n\nexport interface JsonResume {\n readonly basics?: JsonResumeBasics;\n readonly work?: JsonResumeWork[];\n readonly volunteer?: JsonResumeVolunteer[];\n readonly education?: JsonResumeEducation[];\n readonly awards?: JsonResumeAward[];\n readonly certificates?: JsonResumeCertificate[];\n readonly publications?: JsonResumePublication[];\n readonly skills?: JsonResumeSkill[];\n readonly languages?: JsonResumeLanguage[];\n readonly projects?: JsonResumeProject[];\n readonly meta?: JsonResumeMeta;\n}\n\n/** Schema version this emitter targets, as JSON Resume writes it in `meta`. */\nconst SCHEMA_VERSION = 'v1.0.0';\n\n/**\n * A date JSON Resume will accept: `YYYY`, `YYYY-MM` or `YYYY-MM-DD`. Sifa\n * stores RFC 3339 for some fields, and a full timestamp pasted into a CV\n * template renders as `2020-03-04T00:00:00.000Z` on the page.\n */\nconst RESUME_DATE_RE = /^(\\d{4})(-\\d{2})?(-\\d{2})?/;\n\nexport function toResumeDate(value: string | undefined): string | undefined {\n const trimmed = value?.trim();\n if (!trimmed) return undefined;\n const match = RESUME_DATE_RE.exec(trimmed);\n return match ? match[0] : undefined;\n}\n\n/**\n * JSON Resume's `fluency` is free text, so these are display labels rather\n * than a mapped vocabulary. Kept in one place so export and a future import\n * agree on the spelling.\n */\nconst FLUENCY_LABELS: Record<LanguageProficiency, string> = {\n elementary: 'Elementary',\n limited_working: 'Limited working',\n professional_working: 'Professional working',\n full_professional: 'Full professional',\n native: 'Native or bilingual',\n};\n\nconst identity: Sanitizer = (input) => input;\n\n/** Drops keys whose value is undefined, so the document carries no empty slots. */\nfunction compact<T extends object>(value: T): T {\n return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined)) as T;\n}\n\n/** Omits the key entirely when the mapped list came out empty. */\nfunction section<K extends string, T>(key: K, items: T[]): Record<K, T[]> | undefined {\n return items.length > 0 ? ({ [key]: items } as Record<K, T[]>) : undefined;\n}\n\nfunction mapLocation(\n location: LocationValue | null | undefined,\n s: Sanitizer,\n): JsonResumeLocation | undefined {\n if (!location) return undefined;\n const mapped = compact({\n city: text(location.locality ?? location.city, s),\n region: text(location.region, s),\n countryCode: text(location.countryCode, s),\n postalCode: text(location.postalCode, s),\n });\n return Object.keys(mapped).length > 0 ? mapped : undefined;\n}\n\n/** Trimmed, sanitised, and undefined when there is nothing left. */\nfunction text(value: string | undefined, s: Sanitizer): string | undefined {\n const trimmed = value?.trim();\n return trimmed ? s(trimmed) : undefined;\n}\n\n/**\n * The name to print for a linked organization. `entityName` is the AppView's\n * resolved current name and wins when present, matching how the profile itself\n * renders these.\n */\nfunction orgName(\n entityName: string | undefined,\n stored: string | undefined,\n s: Sanitizer,\n): string | undefined {\n return text(entityName, s) ?? text(stored, s);\n}\n\n/**\n * Build a JSON Resume v1.0.0 document from a Sifa profile.\n *\n * Hidden records are dropped. Keys are omitted rather than emitted empty, so a\n * profile with no publications produces a document with no `publications` key\n * instead of one a reader has to interpret.\n */\nexport function profileToJsonResume(\n profile: JsonResumeProfileInput,\n options: JsonResumeOptions = {},\n): JsonResume {\n const s = options.sanitize ?? identity;\n const baseUrl = normaliseBaseUrl(options.baseUrl);\n const canonical = options.canonicalUrl ?? profileUrl(baseUrl, profile.handle);\n\n const name =\n formatStructuredName(profile.givenName, profile.familyName) ??\n text(profile.displayName, s) ??\n profile.handle;\n\n const profiles = filterHidden(profile.externalAccounts).map((account) =>\n compact<JsonResumeProfileLink>({\n network: s(account.platform),\n username: text(account.label, s),\n url: account.url,\n }),\n );\n\n const basics = compact<JsonResumeBasics>({\n name,\n label: text(profile.headline, s),\n image: profile.avatar,\n url: text(profile.website, s) ?? canonical,\n summary: text(profile.about, s),\n location: mapLocation(profile.location, s),\n ...section('profiles', profiles),\n });\n\n const work = filterHidden(profile.positions).map((position) =>\n compact<JsonResumeWork>({\n name: orgName(position.entityName, position.company, s),\n position: s(position.title),\n summary: text(position.description, s),\n startDate: toResumeDate(position.startedAt),\n endDate: toResumeDate(position.endedAt),\n }),\n );\n\n const volunteer = filterHidden(profile.volunteering).map((entry) =>\n compact<JsonResumeVolunteer>({\n organization: orgName(entry.entityName, entry.organization, s) ?? '',\n position: text(entry.role, s),\n summary: text(entry.description, s),\n startDate: toResumeDate(entry.startDate),\n endDate: toResumeDate(entry.endDate),\n }),\n );\n\n const education = filterHidden(profile.education).map((entry) =>\n compact<JsonResumeEducation>({\n institution: orgName(entry.entityName, entry.institution, s) ?? '',\n area: text(entry.fieldOfStudy, s),\n studyType: text(entry.degree, s),\n startDate: toResumeDate(entry.startedAt),\n endDate: toResumeDate(entry.endedAt),\n }),\n );\n\n const awards = filterHidden(profile.honors).map((honor) =>\n compact<JsonResumeAward>({\n title: s(honor.title),\n date: toResumeDate(honor.date),\n awarder: orgName(honor.entityName, honor.issuer, s),\n summary: text(honor.description, s),\n }),\n );\n\n const certificates = filterHidden(profile.certifications).map((cert) =>\n compact<JsonResumeCertificate>({\n name: s(cert.name),\n date: toResumeDate(cert.issueDate),\n // `issuingOrg` is the deprecated read-view alias for `authority`; records\n // indexed before the rename carry only the alias.\n issuer: orgName(cert.entityName, cert.authority ?? cert.issuingOrg, s),\n url: text(cert.credentialUrl, s),\n }),\n );\n\n const publications = filterHidden(profile.publications).map((publication) =>\n compact<JsonResumePublication>({\n name: s(publication.title),\n publisher: text(publication.publisher, s),\n releaseDate: toResumeDate(publication.date),\n url: text(publication.url, s),\n summary: text(publication.description, s),\n }),\n );\n\n // One entry per skill rather than JSON Resume's grouped shape: Sifa stores one\n // record per skill, and keeping the two symmetric is what makes a round-trip\n // through a third-party editor safe. Category and endorsement counts have no\n // JSON Resume slot and are dropped. Skill records carry no `hidden` flag, so\n // there is nothing to filter here.\n const skills = (profile.skills ?? []).map((skill) => ({ name: s(skill.name) }));\n\n const languages = filterHidden(profile.languages).map((language) =>\n compact<JsonResumeLanguage>({\n language: s(language.language),\n fluency: language.proficiency ? FLUENCY_LABELS[language.proficiency] : undefined,\n }),\n );\n\n const projects = filterHidden(profile.projects).map((project) =>\n compact<JsonResumeProject>({\n name: s(project.name),\n description: text(project.description, s),\n url: text(project.url, s),\n startDate: toResumeDate(project.startDate),\n endDate: toResumeDate(project.endDate),\n }),\n );\n\n return {\n basics,\n ...section('work', work),\n ...section('volunteer', volunteer),\n ...section('education', education),\n ...section('awards', awards),\n ...section('certificates', certificates),\n ...section('publications', publications),\n ...section('skills', skills),\n ...section('languages', languages),\n ...section('projects', projects),\n meta: { canonical, version: SCHEMA_VERSION },\n };\n}\n"]}
|