@learncard/credential-library 2.0.2 → 2.0.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.
@@ -1494,6 +1494,105 @@ var obv3EndorsementCredential = {
1494
1494
  }
1495
1495
  };
1496
1496
 
1497
+ // src/fixtures/obv3/rubric-aligned-badge.ts
1498
+ import { UnsignedAchievementCredentialValidator as UnsignedAchievementCredentialValidator7 } from "@learncard/types";
1499
+ var RESULT_DESCRIPTION_ID = "urn:uuid:7cc1519e-87f4-4cae-b7a5-786ec15db769";
1500
+ var PROFICIENT_LEVEL_ID = "urn:uuid:eb753d86-9277-478d-b9c4-3d589c82aff8";
1501
+ var obv3RubricAlignedBadge = {
1502
+ id: "obv3/rubric-aligned-badge",
1503
+ name: "Rubric-Aligned OBv3 Badge",
1504
+ description: "Open Badges v3 credential with rubric levels, an achieved level, and a CTDL result alignment",
1505
+ spec: "obv3",
1506
+ profile: "badge",
1507
+ features: ["alignment", "results"],
1508
+ source: "synthetic",
1509
+ signed: false,
1510
+ validity: "valid",
1511
+ validator: UnsignedAchievementCredentialValidator7,
1512
+ tags: ["rubric", "open-skill-alignment"],
1513
+ credential: {
1514
+ "@context": [
1515
+ "https://www.w3.org/ns/credentials/v2",
1516
+ "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json"
1517
+ ],
1518
+ id: "urn:uuid:b3e5babd-f68e-4095-979d-3e910a444e73",
1519
+ type: ["VerifiableCredential", "OpenBadgeCredential"],
1520
+ name: "Applied Data Analysis",
1521
+ description: "Recognizes applied data analysis at the proficient rubric level.",
1522
+ issuer: {
1523
+ id: "did:example:issuer123",
1524
+ type: ["Profile"],
1525
+ name: "Example Skills Institute",
1526
+ url: "https://example.org"
1527
+ },
1528
+ validFrom: "2026-01-15T00:00:00Z",
1529
+ credentialSubject: {
1530
+ id: "did:example:learner456",
1531
+ type: ["AchievementSubject"],
1532
+ achievement: {
1533
+ id: "urn:uuid:e736a10c-aa36-466f-99af-e52440f32d8e",
1534
+ type: ["Achievement"],
1535
+ achievementType: "Badge",
1536
+ name: "Applied Data Analysis",
1537
+ description: "Analyze a real-world dataset and communicate supported conclusions.",
1538
+ criteria: {
1539
+ narrative: "Submit an analysis that meets at least the proficient rubric level."
1540
+ },
1541
+ resultDescription: [
1542
+ {
1543
+ id: RESULT_DESCRIPTION_ID,
1544
+ type: ["ResultDescription"],
1545
+ name: "Data Analysis Rubric",
1546
+ resultType: "RubricCriterionLevel",
1547
+ valueMin: "1",
1548
+ valueMax: "4",
1549
+ rubricCriterionLevel: [
1550
+ {
1551
+ id: "urn:uuid:a4993932-d453-4417-b5aa-52b1bc1ea80e",
1552
+ type: ["RubricCriterionLevel"],
1553
+ name: "Developing",
1554
+ level: "2",
1555
+ points: "2"
1556
+ },
1557
+ {
1558
+ id: PROFICIENT_LEVEL_ID,
1559
+ type: ["RubricCriterionLevel"],
1560
+ name: "Proficient",
1561
+ level: "3",
1562
+ points: "3"
1563
+ },
1564
+ {
1565
+ id: "urn:uuid:217fc04f-383b-48a0-a2e5-1cf1b016f7d4",
1566
+ type: ["RubricCriterionLevel"],
1567
+ name: "Advanced",
1568
+ level: "4",
1569
+ points: "4"
1570
+ }
1571
+ ],
1572
+ alignment: [
1573
+ {
1574
+ type: ["Alignment"],
1575
+ targetName: "Analyze data using appropriate methods",
1576
+ targetUrl: "https://credentialengineregistry.org/resources/ce-2f5dce8d-29ad-40cb-a9e1-5a5517ff79a7",
1577
+ targetType: "CTDL",
1578
+ targetFramework: "Credential Engine Registry"
1579
+ }
1580
+ ]
1581
+ }
1582
+ ]
1583
+ },
1584
+ result: [
1585
+ {
1586
+ type: ["Result"],
1587
+ resultDescription: RESULT_DESCRIPTION_ID,
1588
+ value: "3",
1589
+ achievedLevel: PROFICIENT_LEVEL_ID
1590
+ }
1591
+ ]
1592
+ }
1593
+ }
1594
+ };
1595
+
1497
1596
  // src/fixtures/clr/minimal.ts
1498
1597
  import { UnsignedClrCredentialValidator } from "@learncard/types";
1499
1598
  var clrMinimal = {
@@ -1991,7 +2090,7 @@ var clrUniversityTranscript = {
1991
2090
  };
1992
2091
 
1993
2092
  // src/fixtures/boost/basic.ts
1994
- import { UnsignedAchievementCredentialValidator as UnsignedAchievementCredentialValidator7 } from "@learncard/types";
2093
+ import { UnsignedAchievementCredentialValidator as UnsignedAchievementCredentialValidator8 } from "@learncard/types";
1995
2094
  var boostBasic = {
1996
2095
  id: "boost/basic",
1997
2096
  name: "Basic LearnCard Boost",
@@ -2002,7 +2101,7 @@ var boostBasic = {
2002
2101
  source: "synthetic",
2003
2102
  signed: false,
2004
2103
  validity: "valid",
2005
- validator: UnsignedAchievementCredentialValidator7,
2104
+ validator: UnsignedAchievementCredentialValidator8,
2006
2105
  tags: ["learncard", "boost"],
2007
2106
  credential: {
2008
2107
  "@context": [
@@ -2038,7 +2137,7 @@ var boostBasic = {
2038
2137
  };
2039
2138
 
2040
2139
  // src/fixtures/boost/boost-id.ts
2041
- import { UnsignedAchievementCredentialValidator as UnsignedAchievementCredentialValidator8 } from "@learncard/types";
2140
+ import { UnsignedAchievementCredentialValidator as UnsignedAchievementCredentialValidator9 } from "@learncard/types";
2042
2141
  var boostId = {
2043
2142
  id: "boost/boost-id",
2044
2143
  name: "LearnCard Boost ID",
@@ -2049,7 +2148,7 @@ var boostId = {
2049
2148
  source: "synthetic",
2050
2149
  signed: false,
2051
2150
  validity: "valid",
2052
- validator: UnsignedAchievementCredentialValidator8,
2151
+ validator: UnsignedAchievementCredentialValidator9,
2053
2152
  tags: ["learncard", "boost", "id"],
2054
2153
  credential: {
2055
2154
  "@context": [
@@ -2094,7 +2193,7 @@ var boostId = {
2094
2193
  };
2095
2194
 
2096
2195
  // src/fixtures/boost/with-skills.ts
2097
- import { UnsignedAchievementCredentialValidator as UnsignedAchievementCredentialValidator9 } from "@learncard/types";
2196
+ import { UnsignedAchievementCredentialValidator as UnsignedAchievementCredentialValidator10 } from "@learncard/types";
2098
2197
  var boostWithSkills = {
2099
2198
  id: "boost/with-skills",
2100
2199
  name: "LearnCard Boost with Skills",
@@ -2105,7 +2204,7 @@ var boostWithSkills = {
2105
2204
  source: "synthetic",
2106
2205
  signed: false,
2107
2206
  validity: "valid",
2108
- validator: UnsignedAchievementCredentialValidator9,
2207
+ validator: UnsignedAchievementCredentialValidator10,
2109
2208
  tags: ["learncard", "boost", "skills"],
2110
2209
  credential: {
2111
2210
  "@context": [
@@ -14241,6 +14340,7 @@ var clrCompetencyAligned = {
14241
14340
  // src/fixtures/clr/provisional-transcript.ts
14242
14341
  import { UnsignedClrCredentialValidator as UnsignedClrCredentialValidator3 } from "@learncard/types";
14243
14342
  var REFRESH_SERVICE_INLINE_CONTEXT = {
14343
+ partial: "https://purl.imsglobal.org/spec/clr/v2p0#partial",
14244
14344
  "LearnCardCredentialRefresh2026": "https://learncard.com/refresh#LearnCardCredentialRefresh2026",
14245
14345
  authorization: {
14246
14346
  "@id": "https://purl.imsglobal.org/spec/ob/v3p0#authorization",
@@ -14283,6 +14383,8 @@ var clrProvisionalTranscript = {
14283
14383
  name: "Ridgeview Community College \u2014 Office of the Registrar"
14284
14384
  },
14285
14385
  validFrom: "2026-01-15T00:00:00Z",
14386
+ validUntil: "2026-05-31T00:00:00Z",
14387
+ partial: true,
14286
14388
  refreshService: PLACEHOLDER_REFRESH_SERVICE,
14287
14389
  credentialSubject: {
14288
14390
  id: "did:example:student-ridgeview-042",
@@ -14303,7 +14405,8 @@ var clrProvisionalTranscript = {
14303
14405
  id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a49",
14304
14406
  type: ["ResultDescription"],
14305
14407
  name: "Course Status",
14306
- resultType: "RawScore"
14408
+ resultType: "Status",
14409
+ allowedValue: ["InProgress", "Provisional", "Completed"]
14307
14410
  }
14308
14411
  ]
14309
14412
  }
@@ -14357,6 +14460,8 @@ var buildFinalTranscriptVariant = /* @__PURE__ */ __name((provisional, options =
14357
14460
  final.name = "Final Official Transcript \u2014 Ridgeview Community College";
14358
14461
  final.description = "Final official transcript certified by the registrar. Supersedes the provisional record.";
14359
14462
  if (options.validFrom) final.validFrom = options.validFrom;
14463
+ delete final.validUntil;
14464
+ delete final.partial;
14360
14465
  const subject = final.credentialSubject;
14361
14466
  if (isRecord(subject) && Array.isArray(subject.verifiableCredential)) {
14362
14467
  subject.verifiableCredential = subject.verifiableCredential.map((nested) => {
@@ -14369,7 +14474,7 @@ var buildFinalTranscriptVariant = /* @__PURE__ */ __name((provisional, options =
14369
14474
  next.credentialSubject = {
14370
14475
  ...next.credentialSubject,
14371
14476
  result: next.credentialSubject.result.map(
14372
- (result) => isRecord(result) ? { ...result, status: "Completed", value: "A" } : result
14477
+ (result) => isRecord(result) ? { ...result, status: "Completed", value: "Completed" } : result
14373
14478
  )
14374
14479
  };
14375
14480
  }
@@ -22933,6 +23038,7 @@ var ALL_FIXTURES = [
22933
23038
  obv3StandaloneFullCourse,
22934
23039
  obv3K12Diploma,
22935
23040
  obv3EndorsementCredential,
23041
+ obv3RubricAlignedBadge,
22936
23042
  // CLR v2
22937
23043
  clrMinimal,
22938
23044
  clrMultiAchievement,
@@ -23183,6 +23289,7 @@ var patchSubject = /* @__PURE__ */ __name((subject, subjectDid) => {
23183
23289
  }
23184
23290
  return subject;
23185
23291
  }, "patchSubject");
23292
+ var FIXTURE_VALIDITY_MS = 180 * 24 * 60 * 60 * 1e3;
23186
23293
  var prepareFixture = /* @__PURE__ */ __name((fixture, options) => {
23187
23294
  if (isSdJwtVcFixture(fixture)) {
23188
23295
  throw new Error(
@@ -23219,6 +23326,17 @@ var prepareFixture = /* @__PURE__ */ __name((fixture, options) => {
23219
23326
  } else {
23220
23327
  credential.validUntil = validUntil;
23221
23328
  }
23329
+ } else {
23330
+ const from = new Date(
23331
+ credential.validFrom ?? credential.issuanceDate
23332
+ ).getTime();
23333
+ const baseline = Math.max(from, Date.now());
23334
+ for (const field of ["validUntil", "expirationDate"]) {
23335
+ const expiry = credential[field];
23336
+ if (typeof expiry === "string" && new Date(expiry).getTime() <= baseline) {
23337
+ credential[field] = new Date(baseline + FIXTURE_VALIDITY_MS).toISOString();
23338
+ }
23339
+ }
23222
23340
  }
23223
23341
  return credential;
23224
23342
  }, "prepareFixture");
@@ -23368,6 +23486,7 @@ export {
23368
23486
  obv3OneedtechFull,
23369
23487
  obv3PlugfestJff2,
23370
23488
  obv3ProfessionalCert,
23489
+ obv3RubricAlignedBadge,
23371
23490
  obv3StandaloneFullCourse,
23372
23491
  obv3WithAlignment,
23373
23492
  obv3WithEndorsement,