@learncard/expiration-plugin 1.1.68 → 1.2.1

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.
@@ -19,29 +19,29 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
 
21
21
  // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
24
  expirationPlugin: () => expirationPlugin
25
25
  });
26
- module.exports = __toCommonJS(src_exports);
26
+ module.exports = __toCommonJS(index_exports);
27
27
  var expirationPlugin = /* @__PURE__ */ __name((learnCard) => ({
28
28
  name: "Expiration",
29
29
  displayName: "Expiration Extension",
30
30
  description: "Adds a check to make sure credentials aren't expired when verifying them",
31
31
  methods: {
32
- verifyCredential: async (_learnCard, credential, options) => {
32
+ verifyCredential: /* @__PURE__ */ __name(async (_learnCard, credential, options) => {
33
33
  const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);
34
- if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {
34
+ if (credential.expirationDate && /* @__PURE__ */ new Date() > new Date(credential.expirationDate)) {
35
35
  verificationCheck.errors.push("expiration error: Credential is expired");
36
- } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {
36
+ } else if (credential.validFrom && /* @__PURE__ */ new Date() < new Date(credential.validFrom)) {
37
37
  verificationCheck.errors.push("expiration error: Credential is not valid yet");
38
- } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {
38
+ } else if (credential.validUntil && /* @__PURE__ */ new Date() > new Date(credential.validUntil)) {
39
39
  verificationCheck.errors.push("expiration error: Credential is no longer valid");
40
40
  } else {
41
41
  verificationCheck.checks.push("expiration");
42
42
  }
43
43
  return verificationCheck;
44
- }
44
+ }, "verifyCredential")
45
45
  }
46
46
  }), "expirationPlugin");
47
47
  //# sourceMappingURL=expiration-plugin.cjs.development.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {\n verificationCheck.errors.push('expiration error: Credential is not valid yet');\n } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {\n verificationCheck.errors.push('expiration error: Credential is no longer valid');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,mBAAmB,wBAC5B,eACoB;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,IACL,kBAAkB,OAAO,YAAY,YAAY,YAAY;AACzD,YAAM,oBAAoB,MAAM,UAAU,OAAO,iBAAiB,YAAY,OAAO;AAErF,UAAI,WAAW,kBAAkB,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,GAAG;AAC/E,0BAAkB,OAAO,KAAK,yCAAyC;AAAA,MAC3E,WAAW,WAAW,aAAa,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,SAAS,GAAG;AAC5E,0BAAkB,OAAO,KAAK,+CAA+C;AAAA,MACjF,WAAW,WAAW,cAAc,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,UAAU,GAAG;AAC9E,0BAAkB,OAAO,KAAK,iDAAiD;AAAA,MACnF,OAAO;AACH,0BAAkB,OAAO,KAAK,YAAY;AAAA,MAC9C;AAEA,aAAO;AAAA,IACX;AAAA,EACJ;AACJ,IAvBgC;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,mBAAmB,wBAC5B,eACoB;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,IACL,kBAAkB,8BAAO,YAAY,YAAY,YAAY;AACzD,YAAM,oBAAoB,MAAM,UAAU,OAAO,iBAAiB,YAAY,OAAO;AAErF,UAAI,WAAW,kBAAkB,oBAAI,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,GAAG;AAC/E,0BAAkB,OAAO,KAAK,yCAAyC;AAAA,MAC3E,WAAW,WAAW,aAAa,oBAAI,KAAK,IAAI,IAAI,KAAK,WAAW,SAAS,GAAG;AAC5E,0BAAkB,OAAO,KAAK,+CAA+C;AAAA,MACjF,WAAW,WAAW,cAAc,oBAAI,KAAK,IAAI,IAAI,KAAK,WAAW,UAAU,GAAG;AAC9E,0BAAkB,OAAO,KAAK,iDAAiD;AAAA,MACnF,OAAO;AACH,0BAAkB,OAAO,KAAK,YAAY;AAAA,MAC9C;AAEA,aAAO;AAAA,IACX,GAdkB;AAAA,EAetB;AACJ,IAvBgC;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});var l=(r,e)=>{for(var i in e)o(r,i,{get:e[i],enumerable:!0})},d=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of p(e))!x.call(r,n)&&n!==i&&o(r,n,{get:()=>e[n],enumerable:!(a=s(e,n))||a.enumerable});return r};var m=r=>d(o({},"__esModule",{value:!0}),r);var v={};l(v,{expirationPlugin:()=>f});module.exports=m(v);var f=t(r=>({name:"Expiration",displayName:"Expiration Extension",description:"Adds a check to make sure credentials aren't expired when verifying them",methods:{verifyCredential:async(e,i,a)=>{let n=await r.invoke.verifyCredential(i,a);return i.expirationDate&&new Date>new Date(i.expirationDate)?n.errors.push("expiration error: Credential is expired"):i.validFrom&&new Date<new Date(i.validFrom)?n.errors.push("expiration error: Credential is not valid yet"):i.validUntil&&new Date>new Date(i.validUntil)?n.errors.push("expiration error: Credential is no longer valid"):n.checks.push("expiration"),n}}}),"expirationPlugin");
1
+ "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});var l=(r,e)=>{for(var i in e)o(r,i,{get:e[i],enumerable:!0})},d=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of p(e))!x.call(r,n)&&n!==i&&o(r,n,{get:()=>e[n],enumerable:!(a=s(e,n))||a.enumerable});return r};var m=r=>d(o({},"__esModule",{value:!0}),r);var v={};l(v,{expirationPlugin:()=>f});module.exports=m(v);var f=t(r=>({name:"Expiration",displayName:"Expiration Extension",description:"Adds a check to make sure credentials aren't expired when verifying them",methods:{verifyCredential:t(async(e,i,a)=>{let n=await r.invoke.verifyCredential(i,a);return i.expirationDate&&new Date>new Date(i.expirationDate)?n.errors.push("expiration error: Credential is expired"):i.validFrom&&new Date<new Date(i.validFrom)?n.errors.push("expiration error: Credential is not valid yet"):i.validUntil&&new Date>new Date(i.validUntil)?n.errors.push("expiration error: Credential is no longer valid"):n.checks.push("expiration"),n},"verifyCredential")}}),"expirationPlugin");
2
2
  //# sourceMappingURL=expiration-plugin.cjs.production.min.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {\n verificationCheck.errors.push('expiration error: Credential is not valid yet');\n } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {\n verificationCheck.errors.push('expiration error: Credential is no longer valid');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
- "mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GASO,IAAMI,EAAmBC,EAC5BC,IACoB,CACpB,KAAM,aACN,YAAa,uBACb,YAAa,2EACb,QAAS,CACL,iBAAkB,MAAOC,EAAYC,EAAYC,IAAY,CACzD,IAAMC,EAAoB,MAAMJ,EAAU,OAAO,iBAAiBE,EAAYC,CAAO,EAErF,OAAID,EAAW,gBAAkB,IAAI,KAAS,IAAI,KAAKA,EAAW,cAAc,EAC5EE,EAAkB,OAAO,KAAK,yCAAyC,EAChEF,EAAW,WAAa,IAAI,KAAS,IAAI,KAAKA,EAAW,SAAS,EACzEE,EAAkB,OAAO,KAAK,+CAA+C,EACtEF,EAAW,YAAc,IAAI,KAAS,IAAI,KAAKA,EAAW,UAAU,EAC3EE,EAAkB,OAAO,KAAK,iDAAiD,EAE/EA,EAAkB,OAAO,KAAK,YAAY,EAGvCA,CACX,CACJ,CACJ,GAvBgC",
6
- "names": ["src_exports", "__export", "expirationPlugin", "__toCommonJS", "expirationPlugin", "__name", "learnCard", "_learnCard", "credential", "options", "verificationCheck"]
5
+ "mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GASO,IAAMI,EAAmBC,EAC5BC,IACoB,CACpB,KAAM,aACN,YAAa,uBACb,YAAa,2EACb,QAAS,CACL,iBAAkBD,EAAA,MAAOE,EAAYC,EAAYC,IAAY,CACzD,IAAMC,EAAoB,MAAMJ,EAAU,OAAO,iBAAiBE,EAAYC,CAAO,EAErF,OAAID,EAAW,gBAAkB,IAAI,KAAS,IAAI,KAAKA,EAAW,cAAc,EAC5EE,EAAkB,OAAO,KAAK,yCAAyC,EAChEF,EAAW,WAAa,IAAI,KAAS,IAAI,KAAKA,EAAW,SAAS,EACzEE,EAAkB,OAAO,KAAK,+CAA+C,EACtEF,EAAW,YAAc,IAAI,KAAS,IAAI,KAAKA,EAAW,UAAU,EAC3EE,EAAkB,OAAO,KAAK,iDAAiD,EAE/EA,EAAkB,OAAO,KAAK,YAAY,EAGvCA,CACX,EAdkB,mBAetB,CACJ,GAvBgC",
6
+ "names": ["index_exports", "__export", "expirationPlugin", "__toCommonJS", "expirationPlugin", "__name", "learnCard", "_learnCard", "credential", "options", "verificationCheck"]
7
7
  }
@@ -7,19 +7,19 @@ var expirationPlugin = /* @__PURE__ */ __name((learnCard) => ({
7
7
  displayName: "Expiration Extension",
8
8
  description: "Adds a check to make sure credentials aren't expired when verifying them",
9
9
  methods: {
10
- verifyCredential: async (_learnCard, credential, options) => {
10
+ verifyCredential: /* @__PURE__ */ __name(async (_learnCard, credential, options) => {
11
11
  const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);
12
- if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {
12
+ if (credential.expirationDate && /* @__PURE__ */ new Date() > new Date(credential.expirationDate)) {
13
13
  verificationCheck.errors.push("expiration error: Credential is expired");
14
- } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {
14
+ } else if (credential.validFrom && /* @__PURE__ */ new Date() < new Date(credential.validFrom)) {
15
15
  verificationCheck.errors.push("expiration error: Credential is not valid yet");
16
- } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {
16
+ } else if (credential.validUntil && /* @__PURE__ */ new Date() > new Date(credential.validUntil)) {
17
17
  verificationCheck.errors.push("expiration error: Credential is no longer valid");
18
18
  } else {
19
19
  verificationCheck.checks.push("expiration");
20
20
  }
21
21
  return verificationCheck;
22
- }
22
+ }, "verifyCredential")
23
23
  }
24
24
  }), "expirationPlugin");
25
25
  export {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {\n verificationCheck.errors.push('expiration error: Credential is not valid yet');\n } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {\n verificationCheck.errors.push('expiration error: Credential is no longer valid');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
- "mappings": ";;;;AASO,IAAM,mBAAmB,wBAC5B,eACoB;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,IACL,kBAAkB,OAAO,YAAY,YAAY,YAAY;AACzD,YAAM,oBAA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6 @@
1
1
  {
2
2
  "name": "@learncard/expiration-plugin",
3
- "version": "1.1.68",
3
+ "version": "1.2.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/expiration-plugin.esm.js",
@@ -9,19 +9,19 @@
9
9
  ],
10
10
  "author": "Learning Economy Foundation (www.learningeconomy.io)",
11
11
  "license": "MIT",
12
- "homepage": "https://github.com/WeLibraryOS/LearnCard#readme",
12
+ "homepage": "https://github.com/learningeconomy/LearnCard/tree/main/packages/plugins/expiration/README.md",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/WeLibraryOS/LearnCard.git"
15
+ "url": "https://github.com/learningeconomy/LearnCard"
16
16
  },
17
17
  "bugs": {
18
- "url": "https://github.com/WeLibraryOS/LearnCard/issues"
18
+ "url": "https://github.com/learningeconomy/LearnCard/issues"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/jest": "^29.2.2",
22
22
  "@types/node": "^17.0.31",
23
23
  "aqu": "0.4.3",
24
- "esbuild": "^0.14.38",
24
+ "esbuild": "^0.27.1",
25
25
  "esbuild-jest": "^0.5.0",
26
26
  "esbuild-plugin-copy": "^1.3.0",
27
27
  "jest": "^29.3.0",
@@ -31,8 +31,8 @@
31
31
  "types": "./dist/index.d.ts",
32
32
  "dependencies": {
33
33
  "why-is-node-running": "^2.2.2",
34
- "@learncard/core": "9.3.44",
35
- "@learncard/vc-plugin": "^1.2.7"
34
+ "@learncard/core": "9.4.1",
35
+ "@learncard/vc-plugin": "^1.3.1"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json",