@learncard/credential-library 2.0.1 → 2.0.2

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.
@@ -14238,6 +14238,147 @@ var clrCompetencyAligned = {
14238
14238
  }
14239
14239
  };
14240
14240
 
14241
+ // src/fixtures/clr/provisional-transcript.ts
14242
+ import { UnsignedClrCredentialValidator as UnsignedClrCredentialValidator3 } from "@learncard/types";
14243
+ var REFRESH_SERVICE_INLINE_CONTEXT = {
14244
+ "LearnCardCredentialRefresh2026": "https://learncard.com/refresh#LearnCardCredentialRefresh2026",
14245
+ authorization: {
14246
+ "@id": "https://purl.imsglobal.org/spec/ob/v3p0#authorization",
14247
+ "@context": {
14248
+ LearnCardDIDAuth: "https://docs.learncard.com/definitions#LearnCardDIDAuth"
14249
+ }
14250
+ }
14251
+ };
14252
+ var PLACEHOLDER_REFRESH_SERVICE = {
14253
+ id: "https://refresh.example.com/refresh/placeholder",
14254
+ type: "LearnCardCredentialRefresh2026",
14255
+ authorization: { type: "LearnCardDIDAuth" }
14256
+ };
14257
+ var clrProvisionalTranscript = {
14258
+ id: "clr/provisional-transcript",
14259
+ name: "Provisional Transcript (Refreshable)",
14260
+ description: "A CLR v2 provisional transcript carrying a LearnCardCredentialRefresh2026 service. Paired with buildFinalTranscriptVariant, it demonstrates the managed provisional-to-final credential refresh flow.",
14261
+ spec: "clr-v2",
14262
+ profile: "learner-record",
14263
+ features: ["refresh-service", "results"],
14264
+ source: "synthetic",
14265
+ signed: false,
14266
+ validity: "valid",
14267
+ validator: UnsignedClrCredentialValidator3,
14268
+ tags: ["transcript", "provisional", "refresh", "clr", "managed-refresh"],
14269
+ credential: {
14270
+ "@context": [
14271
+ "https://www.w3.org/ns/credentials/v2",
14272
+ "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json",
14273
+ "https://purl.imsglobal.org/spec/clr/v2p0/context.json",
14274
+ REFRESH_SERVICE_INLINE_CONTEXT
14275
+ ],
14276
+ id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a47",
14277
+ type: ["VerifiableCredential", "ClrCredential"],
14278
+ name: "Provisional Transcript \u2014 Ridgeview Community College",
14279
+ description: "Provisional record of courses completed to date. This transcript becomes final once the registrar certifies the completed term.",
14280
+ issuer: {
14281
+ id: "did:web:registrar.ridgeview-example.edu",
14282
+ type: ["Profile"],
14283
+ name: "Ridgeview Community College \u2014 Office of the Registrar"
14284
+ },
14285
+ validFrom: "2026-01-15T00:00:00Z",
14286
+ refreshService: PLACEHOLDER_REFRESH_SERVICE,
14287
+ credentialSubject: {
14288
+ id: "did:example:student-ridgeview-042",
14289
+ type: ["ClrSubject"],
14290
+ achievement: [
14291
+ {
14292
+ id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a48",
14293
+ type: ["Achievement"],
14294
+ achievementType: "Course",
14295
+ name: "BIO 150 \u2014 Principles of Biology",
14296
+ description: "Introductory biology covering cell structure, genetics, and evolution.",
14297
+ criteria: { narrative: "Complete all coursework and the final exam." },
14298
+ humanCode: "BIO-150",
14299
+ fieldOfStudy: "Biology",
14300
+ creditsAvailable: 4,
14301
+ resultDescription: [
14302
+ {
14303
+ id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a49",
14304
+ type: ["ResultDescription"],
14305
+ name: "Course Status",
14306
+ resultType: "RawScore"
14307
+ }
14308
+ ]
14309
+ }
14310
+ ],
14311
+ verifiableCredential: [
14312
+ {
14313
+ "@context": [
14314
+ "https://www.w3.org/ns/credentials/v2",
14315
+ "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json"
14316
+ ],
14317
+ id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a50",
14318
+ type: ["VerifiableCredential", "AchievementCredential"],
14319
+ name: "BIO 150 \u2014 Principles of Biology (In Progress)",
14320
+ issuer: {
14321
+ id: "did:web:registrar.ridgeview-example.edu",
14322
+ type: ["Profile"],
14323
+ name: "Ridgeview Community College"
14324
+ },
14325
+ validFrom: "2026-01-15T00:00:00Z",
14326
+ credentialSubject: {
14327
+ id: "did:example:student-ridgeview-042",
14328
+ type: ["AchievementSubject"],
14329
+ achievement: {
14330
+ id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a48",
14331
+ type: ["Achievement"],
14332
+ achievementType: "Course",
14333
+ name: "BIO 150 \u2014 Principles of Biology",
14334
+ criteria: {
14335
+ narrative: "Complete all coursework and the final exam."
14336
+ },
14337
+ humanCode: "BIO-150",
14338
+ fieldOfStudy: "Biology",
14339
+ creditsAvailable: 4
14340
+ },
14341
+ result: [
14342
+ {
14343
+ type: ["Result"],
14344
+ resultDescription: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a49",
14345
+ status: "InProgress"
14346
+ }
14347
+ ]
14348
+ }
14349
+ }
14350
+ ]
14351
+ }
14352
+ }
14353
+ };
14354
+ var buildFinalTranscriptVariant = /* @__PURE__ */ __name((provisional, options = {}) => {
14355
+ const isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null, "isRecord");
14356
+ const final = JSON.parse(JSON.stringify(provisional));
14357
+ final.name = "Final Official Transcript \u2014 Ridgeview Community College";
14358
+ final.description = "Final official transcript certified by the registrar. Supersedes the provisional record.";
14359
+ if (options.validFrom) final.validFrom = options.validFrom;
14360
+ const subject = final.credentialSubject;
14361
+ if (isRecord(subject) && Array.isArray(subject.verifiableCredential)) {
14362
+ subject.verifiableCredential = subject.verifiableCredential.map((nested) => {
14363
+ if (!isRecord(nested)) return nested;
14364
+ const next = { ...nested };
14365
+ if (typeof next.name === "string") {
14366
+ next.name = next.name.replace("(In Progress)", "(Completed)");
14367
+ }
14368
+ if (isRecord(next.credentialSubject) && Array.isArray(next.credentialSubject.result)) {
14369
+ next.credentialSubject = {
14370
+ ...next.credentialSubject,
14371
+ result: next.credentialSubject.result.map(
14372
+ (result) => isRecord(result) ? { ...result, status: "Completed", value: "A" } : result
14373
+ )
14374
+ };
14375
+ }
14376
+ return next;
14377
+ });
14378
+ }
14379
+ return final;
14380
+ }, "buildFinalTranscriptVariant");
14381
+
14241
14382
  // src/fixtures/clr/demo-isd-diploma-assessments.ts
14242
14383
  var clrDemoIsdDiplomaAssessments = {
14243
14384
  id: "clr/demo-isd-diploma-assessments",
@@ -22818,6 +22959,7 @@ var ALL_FIXTURES = [
22818
22959
  clrGreatPlainsFull,
22819
22960
  clrWestbridgeFull,
22820
22961
  clrCompetencyAligned,
22962
+ clrProvisionalTranscript,
22821
22963
  clrDemoIsdDiplomaAssessments,
22822
22964
  // SD-JWT VC
22823
22965
  sdJwtVcCourseCompletion
@@ -23186,17 +23328,20 @@ export {
23186
23328
  FIXTURE_KINDS,
23187
23329
  FIXTURE_SOURCES,
23188
23330
  FIXTURE_VALIDITIES,
23331
+ REFRESH_SERVICE_INLINE_CONTEXT,
23189
23332
  boostBasic,
23190
23333
  boostCommunityAward,
23191
23334
  boostDelegate,
23192
23335
  boostId,
23193
23336
  boostWithSkills,
23337
+ buildFinalTranscriptVariant,
23194
23338
  clrCompetencyAligned,
23195
23339
  clrDemoIsdDiplomaAssessments,
23196
23340
  clrGreatPlainsFull,
23197
23341
  clrMinimal,
23198
23342
  clrMultiAchievement,
23199
23343
  clrNdStudentTranscript,
23344
+ clrProvisionalTranscript,
23200
23345
  clrUniversityTranscript,
23201
23346
  clrWestbridgeFull,
23202
23347
  findFixture,