@learncard/cli 3.3.176 → 3.3.177

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/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # @learncard/cli
2
2
 
3
+ ## 3.3.177
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1240](https://github.com/learningeconomy/LearnCard/pull/1240) [`3a05603c72d76020b43ec6bbd5e31b2b31c0fd2b`](https://github.com/learningeconomy/LearnCard/commit/3a05603c72d76020b43ec6bbd5e31b2b31c0fd2b) Thanks [@gerardopar](https://github.com/gerardopar)! - feat: [LC-1812][LC-1855] - Add Render Method Plugin + Render Method Toggle
8
+
9
+ Adds `@learncard/render-method-plugin` for attaching and reading W3C `renderMethod` entries on Verifiable Credentials. The plugin is registered as part of the default LearnCard wallet stack.
10
+
11
+ **Write side** (`wallet.invoke`): `attachRenderMethod`, `buildTemplateRenderMethod`.
12
+
13
+ **Read side** (`wallet.invoke` and direct imports):
14
+
15
+ - String-based sugar (most common case): `findTemplateRenderMethod(vc, suite | suites[])`, `findTemplateRenderMethods(vc, suite | suites[])`.
16
+ - Backward-compatible alias: `getSvgMustacheRenderMethod`.
17
+ - Predicate-based escape hatch: `findRenderMethod`, `findRenderMethods`.
18
+ - Raw access: `getRenderMethods` (unwraps `CertifiedBoostCredential`, normalizes object↔array).
19
+ - Data shaping: `buildRenderData(vc, renderProperty?)` (Mustache context with `vc` / `credential` / `credentialSubjects` aliases, RFC 6901 overlay).
20
+ - Exported type guards: `isTemplateRenderMethod`, `isSvgMustacheRenderMethod`.
21
+
22
+ The pure data-shaping helpers (Mustache context, JSON Pointer overlay, boost unwrapping) moved out of `apps/learn-card-app/src/helpers/renderMethod.helpers.ts` into the plugin; the app now only owns the SVG-specific render pipeline (Mustache hydration + DOMPurify sanitization + React display).
23
+
24
+ **`@learncard/types`**: `TemplateRenderMethodValidator` widened — `renderSuite` and `outputPreference.mediaType` are now `z.string()` (were `z.literal('svg-mustache')` and `z.literal('image/svg+xml')`). The literals couldn't express the W3C spec's openness to other suites/types and made the plugin's "future-extensible" read API contradictory. Backward-compatible: all existing literal values still validate.
25
+
26
+ Behavior:
27
+
28
+ - `attachRenderMethod` is **opt-in**: calling it without a config returns the VC unchanged. Pass `{ templateId: DEFAULT_TEMPLATE_ID }` or a custom `{ templateId | templateValue }` to actually attach a render method. This avoids polluting every issued credential's `@context` with the render-method JSON-LD context URL.
29
+ - `templateId` must be an `http://` or `https://` URL. Empty values, `javascript:`, `file:`, `data:` and other schemes are rejected at the plugin boundary.
30
+ - `templateValue` is URL-encoded into a `data:image/svg+xml,` URI. Empty or whitespace-only values are rejected.
31
+ - The `useRenderMethodEnabled` LaunchDarkly flag gates display only (the `RenderMethodDisplay` component, the `BoostDisplayStyleSelector`, the `getSvgMustacheRenderMethod` lookup). It does not gate the write path.
32
+
33
+ Known risk:
34
+
35
+ - The JSON-LD context URL (`https://digitalbazaar.github.io/vc-render-method-context/contexts/v2rc2.jsonld`) is a community-group draft, not a finalized W3C TR. VCs issued with this context depend on the URL remaining stable. Follow-up work will bundle the context locally and migrate to the W3C TR URL when published.
36
+
37
+ Types:
38
+
39
+ - `@learncard/types` adds `TemplateRenderMethod`, `RenderMethod`, and a top-level `renderMethod` field on `UnsignedVC`.
40
+ - `learn-card-base` extends `BespokeLearnCard` to include `RenderMethodPlugin`, making `wallet.invoke.attachRenderMethod` and `wallet.invoke.buildTemplateRenderMethod` type-safe across the codebase.
41
+
42
+ - Updated dependencies [[`3a05603c72d76020b43ec6bbd5e31b2b31c0fd2b`](https://github.com/learningeconomy/LearnCard/commit/3a05603c72d76020b43ec6bbd5e31b2b31c0fd2b), [`37439411ac68618fc27898ac4c0f48dbef4e424b`](https://github.com/learningeconomy/LearnCard/commit/37439411ac68618fc27898ac4c0f48dbef4e424b), [`37439411ac68618fc27898ac4c0f48dbef4e424b`](https://github.com/learningeconomy/LearnCard/commit/37439411ac68618fc27898ac4c0f48dbef4e424b)]:
43
+ - @learncard/types@5.16.0
44
+ - @learncard/render-method-plugin@2.0.0
45
+ - @learncard/init@2.3.19
46
+ - @learncard/core@9.4.19
47
+ - @learncard/didkit-plugin@1.8.10
48
+ - @learncard/learn-cloud-plugin@2.3.24
49
+ - @learncard/ler-rs-plugin@0.1.10
50
+ - @learncard/linked-claims-plugin@0.2.19
51
+ - @learncard/open-badge-v2-plugin@1.1.20
52
+ - @learncard/simple-signing-plugin@1.1.23
53
+
3
54
  ## 3.3.176
4
55
 
5
56
  ### Patch Changes
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ var figlet = require('figlet');
15
15
  var commander = require('commander');
16
16
  var clipboard = require('clipboardy');
17
17
  var lerRsPlugin = require('@learncard/ler-rs-plugin');
18
+ var renderMethodPlugin = require('@learncard/render-method-plugin');
18
19
  var crypto = require('crypto');
19
20
 
20
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -31,7 +32,7 @@ var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
31
32
  const generateRandomSeed = () => crypto__default["default"].randomBytes(32).toString("hex");
32
33
 
33
34
  var name = "@learncard/cli";
34
- var version = "3.3.176";
35
+ var version = "3.3.177";
35
36
  var description = "Command Line Interface for LearnCard";
36
37
  var main = "dist/index.js";
37
38
  var bin = "dist/index.js";
@@ -48,6 +49,7 @@ var dependencies = {
48
49
  "@learncard/learn-cloud-plugin": "workspace:*",
49
50
  "@learncard/ler-rs-plugin": "workspace:*",
50
51
  "@learncard/linked-claims-plugin": "workspace:*",
52
+ "@learncard/render-method-plugin": "workspace:*",
51
53
  "@learncard/open-badge-v2-plugin": "workspace:*",
52
54
  "@learncard/simple-signing-plugin": "workspace:*",
53
55
  "@learncard/types": "workspace:*",
@@ -148,6 +150,9 @@ commander.program.version(packageJson.version).argument("[seed]").action(async (
148
150
  globalThis.learnCard = await globalThis.learnCard.addPlugin(
149
151
  openBadgeV2Plugin.openBadgeV2Plugin(globalThis.learnCard)
150
152
  );
153
+ globalThis.learnCard = await globalThis.learnCard.addPlugin(
154
+ renderMethodPlugin.getRenderMethodPlugin(globalThis.learnCard)
155
+ );
151
156
  globalThis.types = types__default["default"];
152
157
  globalThis.getTestCache = core.getTestCache;
153
158
  globalThis.copy = copyFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/cli",
3
- "version": "3.3.176",
3
+ "version": "3.3.177",
4
4
  "description": "Command Line Interface for LearnCard",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/index.js",
@@ -15,15 +15,16 @@
15
15
  "pretty-repl": "^3.1.1",
16
16
  "rollup": "^2.80.0",
17
17
  "rollup-plugin-esbuild": "^4.9.1",
18
- "@learncard/didkit-plugin": "^1.8.9",
19
- "@learncard/init": "^2.3.18",
20
- "@learncard/learn-cloud-plugin": "2.3.23",
21
- "@learncard/ler-rs-plugin": "0.1.9",
22
- "@learncard/linked-claims-plugin": "0.2.18",
23
- "@learncard/open-badge-v2-plugin": "1.1.19",
24
- "@learncard/simple-signing-plugin": "1.1.22",
25
- "@learncard/types": "5.15.0",
26
- "@learncard/core": "9.4.18"
18
+ "@learncard/core": "9.4.19",
19
+ "@learncard/didkit-plugin": "^1.8.10",
20
+ "@learncard/init": "^2.3.19",
21
+ "@learncard/learn-cloud-plugin": "2.3.24",
22
+ "@learncard/linked-claims-plugin": "0.2.19",
23
+ "@learncard/ler-rs-plugin": "0.1.10",
24
+ "@learncard/render-method-plugin": "2.0.0",
25
+ "@learncard/open-badge-v2-plugin": "1.1.20",
26
+ "@learncard/simple-signing-plugin": "1.1.23",
27
+ "@learncard/types": "5.16.0"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/cors": "^2.8.12",
package/src/index.tsx CHANGED
@@ -14,6 +14,7 @@ import { program } from 'commander';
14
14
  import clipboard from 'clipboardy';
15
15
 
16
16
  import { getLerRsPlugin } from '@learncard/ler-rs-plugin';
17
+ import { getRenderMethodPlugin } from '@learncard/render-method-plugin';
17
18
 
18
19
  import { generateRandomSeed } from './random';
19
20
 
@@ -92,6 +93,11 @@ program
92
93
  openBadgeV2Plugin(globalThis.learnCard)
93
94
  );
94
95
 
96
+ // Add Render Method plugin for attaching W3C renderMethod to VCs
97
+ globalThis.learnCard = await globalThis.learnCard.addPlugin(
98
+ getRenderMethodPlugin(globalThis.learnCard)
99
+ );
100
+
95
101
  globalThis.types = types;
96
102
  globalThis.getTestCache = getTestCache;
97
103