@learncard/lca-api-plugin 1.2.16 → 1.2.18
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/README.md +3 -1
- package/dist/lca-api-plugin.cjs.development.cjs +82 -82
- package/dist/lca-api-plugin.cjs.development.cjs.map +1 -1
- package/dist/lca-api-plugin.cjs.production.min.cjs.map +1 -1
- package/dist/lca-api-plugin.esm.js +82 -82
- package/dist/lca-api-plugin.esm.js.map +1 -1
- package/package.json +65 -63
- package/src/global.d.ts +6 -0
- package/src/index.ts +3 -0
- package/src/learnCard.ts +26 -0
- package/src/plugin.ts +721 -0
- package/src/test/index.test.d.ts +1 -0
- package/src/test/index.test.ts +38 -0
- package/src/types.ts +396 -0
package/package.json
CHANGED
|
@@ -1,64 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
2
|
+
"name": "@learncard/lca-api-plugin",
|
|
3
|
+
"version": "1.2.18",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/lca-api-plugin.esm.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"development": "./src/index.ts",
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/lca-api-plugin.esm.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
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": "jest",
|
|
28
|
+
"test:watch": "jest --watch",
|
|
29
|
+
"test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
|
|
30
|
+
},
|
|
31
|
+
"author": "WeLibrary, LLC (www.welibrary.io)",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"homepage": "https://github.com/learningeconomy/LearnCard/tree/main/packages/plugins/lca-api-plugin/README.md",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/learningeconomy/LearnCard"
|
|
37
|
+
},
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/learningeconomy/LearnCard/issues"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/jest": "^29.2.2",
|
|
43
|
+
"@types/node": "^17.0.31",
|
|
44
|
+
"aqu": "0.4.3",
|
|
45
|
+
"esbuild": "^0.27.1",
|
|
46
|
+
"esbuild-jest": "^0.5.0",
|
|
47
|
+
"esbuild-plugin-copy": "^1.3.0",
|
|
48
|
+
"jest": "^29.3.0",
|
|
49
|
+
"rimraf": "^3.0.2",
|
|
50
|
+
"shx": "^0.3.4",
|
|
51
|
+
"ts-jest": "^29.0.3"
|
|
52
|
+
},
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@learncard/core": "9.4.26",
|
|
56
|
+
"@learncard/didkit-plugin": "1.9.6",
|
|
57
|
+
"@learncard/init": "2.4.5",
|
|
58
|
+
"@learncard/lca-api-client": "1.2.2",
|
|
59
|
+
"@learncard/types": "5.17.5",
|
|
60
|
+
"hex-lite": "^1.5.0",
|
|
61
|
+
"isomorphic-fetch": "^3.0.0",
|
|
62
|
+
"isomorphic-webcrypto": "^2.3.8",
|
|
63
|
+
"pbkdf2-hmac": "^1.2.1"
|
|
64
|
+
},
|
|
65
|
+
"sideEffects": false
|
|
66
|
+
}
|
package/src/global.d.ts
ADDED
package/src/index.ts
ADDED
package/src/learnCard.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AddPlugin } from '@learncard/core';
|
|
2
|
+
import { initLearnCard, LearnCardFromSeed, NetworkLearnCardFromSeed } from '@learncard/init';
|
|
3
|
+
|
|
4
|
+
import { getLCAPlugin } from './plugin';
|
|
5
|
+
import { LCAPlugin } from './types';
|
|
6
|
+
|
|
7
|
+
export type LCALearnCard = AddPlugin<NetworkLearnCardFromSeed['returnValue'], LCAPlugin>;
|
|
8
|
+
|
|
9
|
+
export const initLCALearnCard = async (
|
|
10
|
+
_config: LearnCardFromSeed['args'] & {
|
|
11
|
+
lcaAPI?: string;
|
|
12
|
+
seed: string;
|
|
13
|
+
network?: string;
|
|
14
|
+
trustedBoostRegistry?: string;
|
|
15
|
+
}
|
|
16
|
+
): Promise<LCALearnCard> => {
|
|
17
|
+
const { lcaAPI = 'https://api.learncard.app/trpc', network = true, ...config } = _config;
|
|
18
|
+
|
|
19
|
+
const networkLearnCard = await initLearnCard({ ...config, network });
|
|
20
|
+
|
|
21
|
+
// The below any is unnecessary in terms of type safety, but TS likes to throw an error about
|
|
22
|
+
// type instantiation being too deep (or "possibly infinite") if we don't cast to any 🤦
|
|
23
|
+
//
|
|
24
|
+
// See https://github.com/microsoft/TypeScript/issues/34933
|
|
25
|
+
return networkLearnCard.addPlugin(await getLCAPlugin(networkLearnCard, lcaAPI)) as any;
|
|
26
|
+
};
|