@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.
- package/dist/__tests__/docs-json.test.d.ts +2 -0
- package/dist/__tests__/docs-json.test.d.ts.map +1 -0
- package/dist/credential-library.cjs.development.js +145 -0
- package/dist/credential-library.cjs.development.js.map +4 -4
- package/dist/credential-library.cjs.production.min.js +1 -1
- package/dist/credential-library.cjs.production.min.js.map +4 -4
- package/dist/credential-library.esm.js +145 -0
- package/dist/credential-library.esm.js.map +4 -4
- package/dist/fixtures/clr/provisional-transcript.d.ts +38 -0
- package/dist/fixtures/clr/provisional-transcript.d.ts.map +1 -0
- package/dist/fixtures/index.d.ts +2 -1
- package/dist/fixtures/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/docs-json.test.ts +148 -0
- package/src/__tests__/issuance.test.ts +31 -1
- package/src/__tests__/registry.test.ts +61 -2
- package/src/fixtures/clr/provisional-transcript.ts +193 -0
- package/src/fixtures/index.ts +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-json.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/docs-json.test.ts"],"names":[],"mappings":""}
|
|
@@ -28,17 +28,20 @@ __export(index_exports, {
|
|
|
28
28
|
FIXTURE_KINDS: () => FIXTURE_KINDS,
|
|
29
29
|
FIXTURE_SOURCES: () => FIXTURE_SOURCES,
|
|
30
30
|
FIXTURE_VALIDITIES: () => FIXTURE_VALIDITIES,
|
|
31
|
+
REFRESH_SERVICE_INLINE_CONTEXT: () => REFRESH_SERVICE_INLINE_CONTEXT,
|
|
31
32
|
boostBasic: () => boostBasic,
|
|
32
33
|
boostCommunityAward: () => boostCommunityAward,
|
|
33
34
|
boostDelegate: () => boostDelegate,
|
|
34
35
|
boostId: () => boostId,
|
|
35
36
|
boostWithSkills: () => boostWithSkills,
|
|
37
|
+
buildFinalTranscriptVariant: () => buildFinalTranscriptVariant,
|
|
36
38
|
clrCompetencyAligned: () => clrCompetencyAligned,
|
|
37
39
|
clrDemoIsdDiplomaAssessments: () => clrDemoIsdDiplomaAssessments,
|
|
38
40
|
clrGreatPlainsFull: () => clrGreatPlainsFull,
|
|
39
41
|
clrMinimal: () => clrMinimal,
|
|
40
42
|
clrMultiAchievement: () => clrMultiAchievement,
|
|
41
43
|
clrNdStudentTranscript: () => clrNdStudentTranscript,
|
|
44
|
+
clrProvisionalTranscript: () => clrProvisionalTranscript,
|
|
42
45
|
clrUniversityTranscript: () => clrUniversityTranscript,
|
|
43
46
|
clrWestbridgeFull: () => clrWestbridgeFull,
|
|
44
47
|
findFixture: () => findFixture,
|
|
@@ -14326,6 +14329,147 @@ var clrCompetencyAligned = {
|
|
|
14326
14329
|
}
|
|
14327
14330
|
};
|
|
14328
14331
|
|
|
14332
|
+
// src/fixtures/clr/provisional-transcript.ts
|
|
14333
|
+
var import_types21 = require("@learncard/types");
|
|
14334
|
+
var REFRESH_SERVICE_INLINE_CONTEXT = {
|
|
14335
|
+
"LearnCardCredentialRefresh2026": "https://learncard.com/refresh#LearnCardCredentialRefresh2026",
|
|
14336
|
+
authorization: {
|
|
14337
|
+
"@id": "https://purl.imsglobal.org/spec/ob/v3p0#authorization",
|
|
14338
|
+
"@context": {
|
|
14339
|
+
LearnCardDIDAuth: "https://docs.learncard.com/definitions#LearnCardDIDAuth"
|
|
14340
|
+
}
|
|
14341
|
+
}
|
|
14342
|
+
};
|
|
14343
|
+
var PLACEHOLDER_REFRESH_SERVICE = {
|
|
14344
|
+
id: "https://refresh.example.com/refresh/placeholder",
|
|
14345
|
+
type: "LearnCardCredentialRefresh2026",
|
|
14346
|
+
authorization: { type: "LearnCardDIDAuth" }
|
|
14347
|
+
};
|
|
14348
|
+
var clrProvisionalTranscript = {
|
|
14349
|
+
id: "clr/provisional-transcript",
|
|
14350
|
+
name: "Provisional Transcript (Refreshable)",
|
|
14351
|
+
description: "A CLR v2 provisional transcript carrying a LearnCardCredentialRefresh2026 service. Paired with buildFinalTranscriptVariant, it demonstrates the managed provisional-to-final credential refresh flow.",
|
|
14352
|
+
spec: "clr-v2",
|
|
14353
|
+
profile: "learner-record",
|
|
14354
|
+
features: ["refresh-service", "results"],
|
|
14355
|
+
source: "synthetic",
|
|
14356
|
+
signed: false,
|
|
14357
|
+
validity: "valid",
|
|
14358
|
+
validator: import_types21.UnsignedClrCredentialValidator,
|
|
14359
|
+
tags: ["transcript", "provisional", "refresh", "clr", "managed-refresh"],
|
|
14360
|
+
credential: {
|
|
14361
|
+
"@context": [
|
|
14362
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
14363
|
+
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json",
|
|
14364
|
+
"https://purl.imsglobal.org/spec/clr/v2p0/context.json",
|
|
14365
|
+
REFRESH_SERVICE_INLINE_CONTEXT
|
|
14366
|
+
],
|
|
14367
|
+
id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a47",
|
|
14368
|
+
type: ["VerifiableCredential", "ClrCredential"],
|
|
14369
|
+
name: "Provisional Transcript \u2014 Ridgeview Community College",
|
|
14370
|
+
description: "Provisional record of courses completed to date. This transcript becomes final once the registrar certifies the completed term.",
|
|
14371
|
+
issuer: {
|
|
14372
|
+
id: "did:web:registrar.ridgeview-example.edu",
|
|
14373
|
+
type: ["Profile"],
|
|
14374
|
+
name: "Ridgeview Community College \u2014 Office of the Registrar"
|
|
14375
|
+
},
|
|
14376
|
+
validFrom: "2026-01-15T00:00:00Z",
|
|
14377
|
+
refreshService: PLACEHOLDER_REFRESH_SERVICE,
|
|
14378
|
+
credentialSubject: {
|
|
14379
|
+
id: "did:example:student-ridgeview-042",
|
|
14380
|
+
type: ["ClrSubject"],
|
|
14381
|
+
achievement: [
|
|
14382
|
+
{
|
|
14383
|
+
id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a48",
|
|
14384
|
+
type: ["Achievement"],
|
|
14385
|
+
achievementType: "Course",
|
|
14386
|
+
name: "BIO 150 \u2014 Principles of Biology",
|
|
14387
|
+
description: "Introductory biology covering cell structure, genetics, and evolution.",
|
|
14388
|
+
criteria: { narrative: "Complete all coursework and the final exam." },
|
|
14389
|
+
humanCode: "BIO-150",
|
|
14390
|
+
fieldOfStudy: "Biology",
|
|
14391
|
+
creditsAvailable: 4,
|
|
14392
|
+
resultDescription: [
|
|
14393
|
+
{
|
|
14394
|
+
id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a49",
|
|
14395
|
+
type: ["ResultDescription"],
|
|
14396
|
+
name: "Course Status",
|
|
14397
|
+
resultType: "RawScore"
|
|
14398
|
+
}
|
|
14399
|
+
]
|
|
14400
|
+
}
|
|
14401
|
+
],
|
|
14402
|
+
verifiableCredential: [
|
|
14403
|
+
{
|
|
14404
|
+
"@context": [
|
|
14405
|
+
"https://www.w3.org/ns/credentials/v2",
|
|
14406
|
+
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json"
|
|
14407
|
+
],
|
|
14408
|
+
id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a50",
|
|
14409
|
+
type: ["VerifiableCredential", "AchievementCredential"],
|
|
14410
|
+
name: "BIO 150 \u2014 Principles of Biology (In Progress)",
|
|
14411
|
+
issuer: {
|
|
14412
|
+
id: "did:web:registrar.ridgeview-example.edu",
|
|
14413
|
+
type: ["Profile"],
|
|
14414
|
+
name: "Ridgeview Community College"
|
|
14415
|
+
},
|
|
14416
|
+
validFrom: "2026-01-15T00:00:00Z",
|
|
14417
|
+
credentialSubject: {
|
|
14418
|
+
id: "did:example:student-ridgeview-042",
|
|
14419
|
+
type: ["AchievementSubject"],
|
|
14420
|
+
achievement: {
|
|
14421
|
+
id: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a48",
|
|
14422
|
+
type: ["Achievement"],
|
|
14423
|
+
achievementType: "Course",
|
|
14424
|
+
name: "BIO 150 \u2014 Principles of Biology",
|
|
14425
|
+
criteria: {
|
|
14426
|
+
narrative: "Complete all coursework and the final exam."
|
|
14427
|
+
},
|
|
14428
|
+
humanCode: "BIO-150",
|
|
14429
|
+
fieldOfStudy: "Biology",
|
|
14430
|
+
creditsAvailable: 4
|
|
14431
|
+
},
|
|
14432
|
+
result: [
|
|
14433
|
+
{
|
|
14434
|
+
type: ["Result"],
|
|
14435
|
+
resultDescription: "urn:uuid:7d2e9f41-3c58-4e21-9b6a-1f0c5d8e2a49",
|
|
14436
|
+
status: "InProgress"
|
|
14437
|
+
}
|
|
14438
|
+
]
|
|
14439
|
+
}
|
|
14440
|
+
}
|
|
14441
|
+
]
|
|
14442
|
+
}
|
|
14443
|
+
}
|
|
14444
|
+
};
|
|
14445
|
+
var buildFinalTranscriptVariant = /* @__PURE__ */ __name((provisional, options = {}) => {
|
|
14446
|
+
const isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null, "isRecord");
|
|
14447
|
+
const final = JSON.parse(JSON.stringify(provisional));
|
|
14448
|
+
final.name = "Final Official Transcript \u2014 Ridgeview Community College";
|
|
14449
|
+
final.description = "Final official transcript certified by the registrar. Supersedes the provisional record.";
|
|
14450
|
+
if (options.validFrom) final.validFrom = options.validFrom;
|
|
14451
|
+
const subject = final.credentialSubject;
|
|
14452
|
+
if (isRecord(subject) && Array.isArray(subject.verifiableCredential)) {
|
|
14453
|
+
subject.verifiableCredential = subject.verifiableCredential.map((nested) => {
|
|
14454
|
+
if (!isRecord(nested)) return nested;
|
|
14455
|
+
const next = { ...nested };
|
|
14456
|
+
if (typeof next.name === "string") {
|
|
14457
|
+
next.name = next.name.replace("(In Progress)", "(Completed)");
|
|
14458
|
+
}
|
|
14459
|
+
if (isRecord(next.credentialSubject) && Array.isArray(next.credentialSubject.result)) {
|
|
14460
|
+
next.credentialSubject = {
|
|
14461
|
+
...next.credentialSubject,
|
|
14462
|
+
result: next.credentialSubject.result.map(
|
|
14463
|
+
(result) => isRecord(result) ? { ...result, status: "Completed", value: "A" } : result
|
|
14464
|
+
)
|
|
14465
|
+
};
|
|
14466
|
+
}
|
|
14467
|
+
return next;
|
|
14468
|
+
});
|
|
14469
|
+
}
|
|
14470
|
+
return final;
|
|
14471
|
+
}, "buildFinalTranscriptVariant");
|
|
14472
|
+
|
|
14329
14473
|
// src/fixtures/clr/demo-isd-diploma-assessments.ts
|
|
14330
14474
|
var clrDemoIsdDiplomaAssessments = {
|
|
14331
14475
|
id: "clr/demo-isd-diploma-assessments",
|
|
@@ -22906,6 +23050,7 @@ var ALL_FIXTURES = [
|
|
|
22906
23050
|
clrGreatPlainsFull,
|
|
22907
23051
|
clrWestbridgeFull,
|
|
22908
23052
|
clrCompetencyAligned,
|
|
23053
|
+
clrProvisionalTranscript,
|
|
22909
23054
|
clrDemoIsdDiplomaAssessments,
|
|
22910
23055
|
// SD-JWT VC
|
|
22911
23056
|
sdJwtVcCourseCompletion
|