@singi-labs/sifa-sdk 0.19.39 → 0.19.41

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.
@@ -57,6 +57,13 @@ var term_mappings_default = {
57
57
  match: "closeMatch",
58
58
  terms: ["schema:hasCredential", "bibo:degree"]
59
59
  },
60
+ {
61
+ lexicon: "id.sifa.profile.education",
62
+ field: "eqfLevel",
63
+ match: "closeMatch",
64
+ terms: ["schema:educationalLevel"],
65
+ note: "EQF is the value anchor."
66
+ },
60
67
  {
61
68
  lexicon: "id.sifa.profile.education",
62
69
  field: "fieldOfStudy",
@@ -302,6 +309,12 @@ var term_mappings_default = {
302
309
  match: "exactMatch",
303
310
  terms: ["dcterms:publisher", "schema:publisher"]
304
311
  },
312
+ {
313
+ lexicon: "id.sifa.profile.publication",
314
+ field: "relatedIdentifiers",
315
+ match: "closeMatch",
316
+ terms: ["dcterms:relation"]
317
+ },
305
318
  {
306
319
  lexicon: "id.sifa.profile.publication",
307
320
  field: "subtitle",
@@ -497,6 +510,28 @@ function filterHidden(items) {
497
510
  return (items ?? []).filter((i) => !i.hidden);
498
511
  }
499
512
 
513
+ // src/taxonomy/eqf-level.ts
514
+ var EQF_LEVEL_OPTIONS = [
515
+ { value: 1, label: "Primary education" },
516
+ { value: 2, label: "Lower secondary" },
517
+ { value: 3, label: "Vocational or partial upper secondary" },
518
+ { value: 4, label: "Upper secondary" },
519
+ { value: 5, label: "Associate or short-cycle degree" },
520
+ { value: 6, label: "Bachelor" },
521
+ { value: 7, label: "Master" },
522
+ { value: 8, label: "Doctorate" }
523
+ ];
524
+ var EQF_LEVEL_LABELS = Object.fromEntries(
525
+ EQF_LEVEL_OPTIONS.map((o) => [o.value, o.label])
526
+ );
527
+ function readEqfLevel(value) {
528
+ return Number.isInteger(value) && value >= 1 && value <= 8 ? value : void 0;
529
+ }
530
+ function getEqfLevelLabel(level) {
531
+ const valid = readEqfLevel(level);
532
+ return valid === void 0 ? void 0 : EQF_LEVEL_LABELS[valid];
533
+ }
534
+
500
535
  // src/jsonld/url.ts
501
536
  var DEFAULT_BASE_URL = "https://sifa.id";
502
537
  function normaliseBaseUrl(baseUrl) {
@@ -512,6 +547,17 @@ function profileUrl(baseUrl, handle) {
512
547
  // src/jsonld/profile.ts
513
548
  var MAX_KNOWS_ABOUT = 20;
514
549
  var MEANINGFUL_TEXT_RE = /[\p{L}\p{N}]/u;
550
+ var EQF_TERM_SET = "https://europass.europa.eu/en/europass-digital-tools/european-qualifications-framework";
551
+ function educationalLevel(eqfLevel) {
552
+ const level = readEqfLevel(eqfLevel);
553
+ if (level === void 0) return void 0;
554
+ return {
555
+ "@type": "DefinedTerm",
556
+ name: getEqfLevelLabel(level),
557
+ termCode: String(level),
558
+ inDefinedTermSet: EQF_TERM_SET
559
+ };
560
+ }
515
561
  var identity = (input) => input;
516
562
  function hasMeaningfulText(value) {
517
563
  return typeof value === "string" && MEANINGFUL_TEXT_RE.test(value);
@@ -561,10 +607,11 @@ function buildPersonJsonLd(profile, options = {}) {
561
607
  const knowsAbout = rankKnowsAbout(profile.skills, s);
562
608
  const sameAs = buildSameAs(profile);
563
609
  const hasCredential = [
564
- ...visible(profile.education).filter((e) => e.degree).map((e) => ({
610
+ ...visible(profile.education).map((e) => ({ e, level: educationalLevel(e.eqfLevel) })).filter(({ e, level }) => e.degree || level).map(({ e, level }) => ({
565
611
  "@type": "EducationalOccupationalCredential",
566
612
  credentialCategory: "degree",
567
- name: [e.degree, e.fieldOfStudy].filter(Boolean).join(" "),
613
+ name: e.degree ? [e.degree, e.fieldOfStudy].filter(Boolean).join(" ") : level.name,
614
+ ...level && { educationalLevel: level },
568
615
  ...e.institution && {
569
616
  recognizedBy: { "@type": "EducationalOrganization", name: s(e.institution) }
570
617
  }