@learncard/ler-rs-plugin 0.1.10 → 0.1.12
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.js → index.cjs} +2 -2
- package/dist/index.d.cts +3 -0
- package/dist/{ler-rs-plugin.cjs.development.js → ler-rs-plugin.cjs.development.cjs} +1 -1
- package/dist/{ler-rs-plugin.cjs.production.min.js → ler-rs-plugin.cjs.production.min.cjs} +1 -1
- package/package.json +19 -6
- /package/dist/{ler-rs-plugin.cjs.development.js.map → ler-rs-plugin.cjs.development.cjs.map} +0 -0
- /package/dist/{ler-rs-plugin.cjs.production.min.js.map → ler-rs-plugin.cjs.production.min.cjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
if (process.env.NODE_ENV === 'production') {
|
|
4
|
-
module.exports = require('./ler-rs-plugin.cjs.production.min.
|
|
4
|
+
module.exports = require('./ler-rs-plugin.cjs.production.min.cjs');
|
|
5
5
|
} else {
|
|
6
|
-
module.exports = require('./ler-rs-plugin.cjs.development.
|
|
6
|
+
module.exports = require('./ler-rs-plugin.cjs.development.cjs');
|
|
7
7
|
}
|
package/dist/index.d.cts
ADDED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var C=(r,t)=>h(r,"name",{value:t,configurable:!0});var k=(r,t)=>{for(var e in t)h(r,e,{get:t[e],enumerable:!0})},S=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!A.call(r,n)&&n!==e&&h(r,n,{get:()=>t[n],enumerable:!(s=w(t,n))||s.enumerable});return r};var _=r=>S(h({},"__esModule",{value:!0}),r);var Y={};k(Y,{LEGACY_LER_RS_TYPE_TOKEN:()=>P,LEGACY_LER_RS_TYPE_URI_V44:()=>y,LER_RS_CREDENTIAL_CONTEXT_V1:()=>x,LER_RS_CREDENTIAL_CONTEXT_V2:()=>m,LER_RS_TYPE_URI_V45:()=>R,LER_RS_VC_CONTEXT_V45:()=>N,TCP_CONTEXT_V1:()=>I,TCP_WRAPPER_TYPE:()=>v,getLerRsPlugin:()=>b});module.exports=_(Y);var x="https://www.w3.org/2018/credentials/v1",m="https://www.w3.org/ns/credentials/v2",N="http://schema.hropenstandards.org/4.5/recruiting/json/VerifiableCredentialLER-RSType.json",R="http://schema.hropenstandards.org/4.5/recruiting/json/LER-RSType.json",y="http://schema.hropenstandards.org/4.4/recruiting/json/ler-rs/LER-RSType.json",P="LERRS",I="https://ctx.learncard.com/tcp/1.0.0.json",v="TrustedCareerProfile";var V=C(r=>r.verifications?.length?r.verifications:r.verifiableCredential?[r.verifiableCredential]:[],"getItemVerifications"),D=C(r=>r==null?[]:Array.isArray(r)?r:[r],"toArray"),H={"@version":1.1,hrrec:"http://schema.hropenstandards.org/recruiting/","@vocab":"http://schema.hropenstandards.org/recruiting/"},L=C(r=>{if((Array.isArray(r.type)?r.type:[r.type]).some(a=>[P,y,R].includes(a)))return!0;let e=r.credentialSubject;if(!e)return!1;let s=e.type;if(typeof s=="string"&&[y,R].includes(s))return!0;let n=e.lerrsType?.type;return typeof n=="string"&&[y,R].includes(n)},"credentialHasLerRsType"),U=C(r=>r.map(t=>{let{narrative:e,descriptions:s,verifiableCredential:n,verifications:a,position:d,employer:f,start:c,end:g,current:i,...l}=t,p={...l};if(typeof i=="boolean"&&(p.current=i),f&&(p.organization={tradeName:f}),d||c||g||typeof i=="boolean"){let o={};d&&(o.title=d),c&&(o.start=c),g&&(o.end=g),typeof i=="boolean"&&(o.current=i),s?.length&&(o.descriptions=s),p.positionHistories=[o]}e&&(p.narrative=e),s?.length&&!p.positionHistories&&(p.descriptions=s);let u=V({verifiableCredential:n,verifications:a});return{...p,...u.length?{verifications:u}:{}}}),"buildEmploymentHistories"),M=C(r=>r.map(t=>{let{narrative:e,descriptions:s,verifiableCredential:n,verifications:a,institution:d,start:f,end:c,current:g,degree:i,specializations:l,...p}=t,u={...p};d&&(u.institution={name:d}),f&&(u.start=f),c&&(u.end=c),typeof g=="boolean"&&(u.current=g),s?.length&&(u.descriptions=s),(i||l)&&(u.educationDegrees=[{...i?{name:i}:{},...l?{specializations:l.map(E=>({name:E}))}:{}}]),e&&(u.narrative=e);let o=V({verifiableCredential:n,verifications:a});return{...u,...o.length?{verifications:o}:{}}}),"buildEducationAndLearnings"),j=C(r=>r.map(t=>{let{narrative:e,descriptions:s,start:n,end:a,effectiveTimePeriod:d,verifiableCredential:f,verifications:c,...g}=t,i={...g};e&&(i.narrative=e),s?.length&&(i.descriptions=s),(d||n||a)&&(i.effectiveTimePeriod={...d??{},...n?{validFrom:n}:{},...a?{validTo:a}:{}});let l=V({verifiableCredential:f,verifications:c});return{...i,...l.length?{verifications:l}:{}}}),"buildCertifications"),b=C(r=>({name:"LER-RS",displayName:"LER-RS",description:"Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials",methods:{createLerRecord:async(t,e)=>{let n=(e.learnCard??t).id.did(),a=new Date().toISOString(),d=crypto.randomUUID(),f={name:{given:e.person.givenName,family:e.person.familyName,formattedName:e.person.formattedName??`${e.person.givenName} ${e.person.familyName}`}},c=!!e.person.address?.formattedAddress||!!e.person.address?.line||!!e.person.address?.city||!!e.person.address?.postalCode||!!e.person.address?.countryCode,g=(e.person.web||[]).filter(o=>o?.url),i=(e.person.social||[]).filter(o=>o?.uri),l=e.person.email||e.person.phone||c||g.length>0||i.length>0?{...e.person.email?{email:[{address:e.person.email}]}:{},...e.person.phone?{phone:[{formattedNumber:e.person.phone}]}:{},...g.length?{web:g.map(o=>({url:o.url,name:o.name}))}:{},...i.length?{social:i.map(o=>({uri:o.uri,...o.name?{name:o.name}:{}}))}:{},...c?{address:[{...e.person.address?.formattedAddress?{formattedAddress:e.person.address.formattedAddress}:{},...e.person.address?.line?{line:e.person.address.line}:{},...e.person.address?.city?{city:e.person.address.city}:{},...e.person.address?.postalCode?{postalCode:e.person.address.postalCode}:{},...e.person.address?.countryCode?{countryCode:e.person.address.countryCode}:{}}]}:{}}:void 0,p={type:R,documentId:{value:d},person:f,...l?{communication:l}:{},skills:(e.skills||[]).map(o=>({name:o})),narratives:e.narratives,employmentHistories:e.workHistory?U(e.workHistory):void 0,educationAndLearnings:e.educationHistory?M(e.educationHistory):void 0,certifications:e.certifications?j(e.certifications):void 0,attachments:e.attachments},u={"@context":[m,H],id:`urn:uuid:${d}`,type:["VerifiableCredential",R],issuer:n,validFrom:a,credentialSubject:{id:e.person.id,...p}};return r.invoke.issueCredential(u,{proofPurpose:"assertionMethod"})},createLerPresentation:async(t,e)=>{let n=(e.learnCard??t).id.did();if(!e.credentials.length)throw new Error("createLerPresentation: credentials array must contain at least one credential");if(!e.credentials.some(L))throw new Error("createLerPresentation: credentials must include at least one LER-RS credential");let d={"@context":[m],type:["VerifiablePresentation"],holder:n,verifiableCredential:e.credentials.length===1?e.credentials[0]:e.credentials};return r.invoke.issuePresentation(d,{...e.domain?{domain:e.domain}:{},...e.challenge?{challenge:e.challenge}:{}})},verifyLerPresentation:async(t,{presentation:e,domain:s,challenge:n})=>{let a=await r.invoke.verifyPresentation(e,{...s?{domain:s}:{},...n?{challenge:n}:{}}),d={verified:a.errors.length===0,errors:a.errors.length?a.errors:void 0},f=[];if(typeof e!="string"){let c=e.holder,g=D(e.verifiableCredential);for(let i of g)try{let l=await r.invoke.verifyCredential(i),p=typeof i.issuer=="string"?i.issuer:i.issuer?.id,u=L(i)||!!c&&!!p&&p===c;f.push({credential:i,verified:l.errors.length===0,isSelfIssued:u,errors:l.errors.length?l.errors:void 0})}catch(l){f.push({credential:i,verified:!1,isSelfIssued:!1,errors:[l instanceof Error?l.message:"Unknown error verifying credential"]})}}return{verified:d.verified&&f.every(c=>c.verified||c.isSelfIssued),presentationResult:d,credentialResults:f}},createTcpWrapperVc:async(t,e)=>{let n=(e.learnCard??t).id.did(),a=e.issuanceDate??new Date().toISOString(),d=e.generatedAt??a,f=e.subjectDid??n;if(e.enableCoSign)throw new Error("createTcpWrapperVc: co-signing is not enabled in MVP");if(e.coSignerDid)throw new Error("createTcpWrapperVc: coSignerDid is reserved for future co-sign support");let g={"@context":[m,{"@version":1.1,id:"@id",type:"@type",TrustedCareerProfile:"https://ctx.learncard.com/tcp#TrustedCareerProfile",ResumePackage:"https://ctx.learncard.com/tcp#ResumePackage",pdfUrl:{"@id":"https://ctx.learncard.com/tcp#pdfUrl","@type":"@id"},pdfHash:"https://ctx.learncard.com/tcp#pdfHash",hashAlgorithm:"https://ctx.learncard.com/tcp#hashAlgorithm",includedCredentials:{"@id":"https://ctx.learncard.com/tcp#includedCredentials","@container":"@set"},category:"https://ctx.learncard.com/tcp#category",generatedAt:{"@id":"https://ctx.learncard.com/tcp#generatedAt","@type":"http://www.w3.org/2001/XMLSchema#dateTime"}}],type:["VerifiableCredential",v],id:e.wrapperId,issuer:n,validFrom:a,credentialSubject:{id:f,type:"ResumePackage",pdfUrl:e.pdfUrl,pdfHash:e.pdfHash,hashAlgorithm:"SHA-256",includedCredentials:e.includedCredentials,generatedAt:d}};return r.invoke.issueCredential(g,{proofPurpose:"assertionMethod"})}}}),"getLerRsPlugin");
|
|
2
|
-
//# sourceMappingURL=ler-rs-plugin.cjs.production.min.
|
|
2
|
+
//# sourceMappingURL=ler-rs-plugin.cjs.production.min.cjs.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learncard/ler-rs-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "LER-RS plugin for LearnCard: create, package, and verify Learning & Employment Record Resumes",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
6
7
|
"module": "./dist/ler-rs-plugin.esm.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/ler-rs-plugin.esm.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
7
20
|
"files": [
|
|
8
21
|
"dist"
|
|
9
22
|
],
|
|
@@ -31,12 +44,12 @@
|
|
|
31
44
|
},
|
|
32
45
|
"types": "./dist/index.d.ts",
|
|
33
46
|
"dependencies": {
|
|
34
|
-
"@learncard/core": "9.4.
|
|
35
|
-
"@learncard/
|
|
36
|
-
"@learncard/
|
|
47
|
+
"@learncard/core": "9.4.21",
|
|
48
|
+
"@learncard/vc-plugin": "1.5.1",
|
|
49
|
+
"@learncard/types": "5.17.1"
|
|
37
50
|
},
|
|
38
51
|
"scripts": {
|
|
39
|
-
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.
|
|
52
|
+
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
|
|
40
53
|
"test": "jest --passWithNoTests",
|
|
41
54
|
"test:watch": "jest --watch",
|
|
42
55
|
"test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
|
/package/dist/{ler-rs-plugin.cjs.development.js.map → ler-rs-plugin.cjs.development.cjs.map}
RENAMED
|
File without changes
|
/package/dist/{ler-rs-plugin.cjs.production.min.js.map → ler-rs-plugin.cjs.production.min.cjs.map}
RENAMED
|
File without changes
|