@learncard/lca-api-plugin 2.0.0 → 2.0.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.
- package/dist/lca-api-plugin.cjs.development.cjs +5 -2
- package/dist/lca-api-plugin.cjs.development.cjs.map +2 -2
- package/dist/lca-api-plugin.cjs.production.min.cjs +4 -4
- package/dist/lca-api-plugin.cjs.production.min.cjs.map +3 -3
- package/dist/lca-api-plugin.esm.js +5 -2
- package/dist/lca-api-plugin.esm.js.map +2 -2
- package/dist/types.d.ts +13 -3
- package/package.json +9 -13
- package/src/plugin.ts +5 -2
- package/src/test/plugin-mode.test.ts +4 -3
- package/src/types.ts +4 -1
package/dist/types.d.ts
CHANGED
|
@@ -346,7 +346,12 @@ export declare const NotificationValidator: z.ZodObject<{
|
|
|
346
346
|
}, z.core.$strip>;
|
|
347
347
|
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
348
348
|
}, z.core.$strip>>;
|
|
349
|
-
metadata: z.ZodOptional<z.
|
|
349
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
350
|
+
connectionPrompt: z.ZodOptional<z.ZodObject<{
|
|
351
|
+
promptId: z.ZodString;
|
|
352
|
+
counterpartProfileId: z.ZodString;
|
|
353
|
+
}, z.core.$strip>>;
|
|
354
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
350
355
|
}, z.core.$loose>>;
|
|
351
356
|
sent: z.ZodOptional<z.ZodISODateTime>;
|
|
352
357
|
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -547,7 +552,12 @@ export declare const PaginatedNotificationsValidator: z.ZodObject<{
|
|
|
547
552
|
}, z.core.$strip>;
|
|
548
553
|
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
549
554
|
}, z.core.$strip>>;
|
|
550
|
-
metadata: z.ZodOptional<z.
|
|
555
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
556
|
+
connectionPrompt: z.ZodOptional<z.ZodObject<{
|
|
557
|
+
promptId: z.ZodString;
|
|
558
|
+
counterpartProfileId: z.ZodString;
|
|
559
|
+
}, z.core.$strip>>;
|
|
560
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
551
561
|
}, z.core.$loose>>;
|
|
552
562
|
sent: z.ZodOptional<z.ZodISODateTime>;
|
|
553
563
|
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -727,7 +737,7 @@ export type LCAPluginMethods = {
|
|
|
727
737
|
getSigningAuthorities: () => Promise<SigningAuthorityType[] | false>;
|
|
728
738
|
authorizeSigningAuthority: (name: string, authorization: SigningAuthorityAuthorization) => Promise<boolean>;
|
|
729
739
|
resetLCAClient: () => Promise<void>;
|
|
730
|
-
generateBoostInfo: (description: string) => Promise<{
|
|
740
|
+
generateBoostInfo: (description: string, locale?: string) => Promise<{
|
|
731
741
|
title: string;
|
|
732
742
|
description: string;
|
|
733
743
|
category: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learncard/lca-api-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"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",
|
|
27
|
-
"test": "
|
|
28
|
-
"test:watch": "
|
|
29
|
-
"test:coverage": "
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage"
|
|
30
30
|
},
|
|
31
31
|
"author": "WeLibrary, LLC (www.welibrary.io)",
|
|
32
32
|
"license": "MIT",
|
|
@@ -39,24 +39,20 @@
|
|
|
39
39
|
"url": "https://github.com/learningeconomy/LearnCard/issues"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/jest": "^29.2.2",
|
|
43
42
|
"@types/node": "^17.0.31",
|
|
44
43
|
"aqu": "0.4.3",
|
|
45
44
|
"esbuild": "^0.27.1",
|
|
46
|
-
"esbuild-jest": "^0.5.0",
|
|
47
45
|
"esbuild-plugin-copy": "^1.3.0",
|
|
48
|
-
"jest": "^29.3.0",
|
|
49
46
|
"rimraf": "^3.0.2",
|
|
50
|
-
"shx": "^0.3.4"
|
|
51
|
-
"ts-jest": "^29.0.3"
|
|
47
|
+
"shx": "^0.3.4"
|
|
52
48
|
},
|
|
53
49
|
"types": "./dist/index.d.ts",
|
|
54
50
|
"dependencies": {
|
|
55
|
-
"@learncard/core": "9.4.
|
|
56
|
-
"@learncard/didkit-plugin": "1.9.
|
|
57
|
-
"@learncard/init": "2.4.
|
|
51
|
+
"@learncard/core": "9.4.31",
|
|
52
|
+
"@learncard/didkit-plugin": "1.9.11",
|
|
53
|
+
"@learncard/init": "2.4.12",
|
|
58
54
|
"@learncard/lca-api-client": "1.2.4",
|
|
59
|
-
"@learncard/types": "5.18.
|
|
55
|
+
"@learncard/types": "5.18.2",
|
|
60
56
|
"hex-lite": "^1.5.0",
|
|
61
57
|
"isomorphic-fetch": "^3.0.0",
|
|
62
58
|
"isomorphic-webcrypto": "^2.3.8",
|
package/src/plugin.ts
CHANGED
|
@@ -200,11 +200,14 @@ export const getLCAPlugin = async (
|
|
|
200
200
|
client = await getNewClient(url, _learnCard);
|
|
201
201
|
learnCard = _learnCard;
|
|
202
202
|
},
|
|
203
|
-
generateBoostInfo: async (_learnCard, description) => {
|
|
203
|
+
generateBoostInfo: async (_learnCard, description, locale) => {
|
|
204
204
|
await initialized;
|
|
205
205
|
await updateLearnCard(_learnCard);
|
|
206
206
|
|
|
207
|
-
const result = await client.ai.generateBoostInfo.query({
|
|
207
|
+
const result = await client.ai.generateBoostInfo.query({
|
|
208
|
+
description,
|
|
209
|
+
locale,
|
|
210
|
+
});
|
|
208
211
|
|
|
209
212
|
return {
|
|
210
213
|
title: result.title,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
1
2
|
import { getClient } from '@learncard/lca-api-client';
|
|
2
3
|
|
|
3
4
|
import { getLCAPlugin } from '../plugin';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
vi.mock('@learncard/lca-api-client', () => ({ getClient: vi.fn() }));
|
|
6
7
|
|
|
7
|
-
const mockedGetClient =
|
|
8
|
+
const mockedGetClient = vi.mocked(getClient);
|
|
8
9
|
|
|
9
10
|
const learnCard = {
|
|
10
11
|
id: { did: () => 'did:key:z6MkTest' },
|
|
@@ -17,7 +18,7 @@ describe('getLCAPlugin', () => {
|
|
|
17
18
|
});
|
|
18
19
|
|
|
19
20
|
it('reports when initial setup falls back to offline mode', async () => {
|
|
20
|
-
const consoleError =
|
|
21
|
+
const consoleError = vi.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
21
22
|
|
|
22
23
|
try {
|
|
23
24
|
mockedGetClient.mockRejectedValueOnce(new Error('connection failed'));
|
package/src/types.ts
CHANGED
|
@@ -293,7 +293,10 @@ export type LCAPluginMethods = {
|
|
|
293
293
|
authorization: SigningAuthorityAuthorization
|
|
294
294
|
) => Promise<boolean>;
|
|
295
295
|
resetLCAClient: () => Promise<void>;
|
|
296
|
-
generateBoostInfo: (
|
|
296
|
+
generateBoostInfo: (
|
|
297
|
+
description: string,
|
|
298
|
+
locale?: string
|
|
299
|
+
) => Promise<{
|
|
297
300
|
title: string;
|
|
298
301
|
description: string;
|
|
299
302
|
category: string;
|