@learncard/lca-api-plugin 1.2.16 → 1.2.17

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/package.json CHANGED
@@ -1,64 +1,66 @@
1
1
  {
2
- "name": "@learncard/lca-api-plugin",
3
- "version": "1.2.16",
4
- "description": "",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/lca-api-plugin.esm.js",
8
- "exports": {
9
- ".": {
10
- "import": {
11
- "types": "./dist/index.d.ts",
12
- "default": "./dist/lca-api-plugin.esm.js"
13
- },
14
- "require": {
15
- "types": "./dist/index.d.cts",
16
- "default": "./dist/index.cjs"
17
- }
18
- }
19
- },
20
- "files": [
21
- "dist"
22
- ],
23
- "author": "WeLibrary, LLC (www.welibrary.io)",
24
- "license": "MIT",
25
- "homepage": "https://github.com/learningeconomy/LearnCard/tree/main/packages/plugins/lca-api-plugin/README.md",
26
- "repository": {
27
- "type": "git",
28
- "url": "https://github.com/learningeconomy/LearnCard"
29
- },
30
- "bugs": {
31
- "url": "https://github.com/learningeconomy/LearnCard/issues"
32
- },
33
- "devDependencies": {
34
- "@types/jest": "^29.2.2",
35
- "@types/node": "^17.0.31",
36
- "aqu": "0.4.3",
37
- "esbuild": "^0.27.1",
38
- "esbuild-jest": "^0.5.0",
39
- "esbuild-plugin-copy": "^1.3.0",
40
- "jest": "^29.3.0",
41
- "rimraf": "^3.0.2",
42
- "shx": "^0.3.4",
43
- "ts-jest": "^29.0.3"
44
- },
45
- "types": "./dist/index.d.ts",
46
- "dependencies": {
47
- "hex-lite": "^1.5.0",
48
- "isomorphic-fetch": "^3.0.0",
49
- "isomorphic-webcrypto": "^2.3.8",
50
- "pbkdf2-hmac": "^1.2.1",
51
- "@learncard/core": "9.4.24",
52
- "@learncard/didkit-plugin": "1.9.4",
53
- "@learncard/lca-api-client": "1.2.0",
54
- "@learncard/types": "5.17.4",
55
- "@learncard/init": "2.4.3"
56
- },
57
- "sideEffects": false,
58
- "scripts": {
59
- "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",
60
- "test": "jest",
61
- "test:watch": "jest --watch",
62
- "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
63
- }
64
- }
2
+ "name": "@learncard/lca-api-plugin",
3
+ "version": "1.2.17",
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": "workspace:*",
56
+ "@learncard/didkit-plugin": "workspace:*",
57
+ "@learncard/init": "workspace:*",
58
+ "@learncard/lca-api-client": "workspace:*",
59
+ "@learncard/types": "workspace:*",
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
+ }
@@ -0,0 +1,6 @@
1
+ declare module 'hex-lite' {
2
+ function toUint8Array(hex: string): Uint8Array;
3
+ function fromUint8Array(array: Uint8Array): string;
4
+ function toBuffer(hex: string): ArrayBuffer;
5
+ function fromBuffer(buffer: ArrayBuffer): string;
6
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './plugin';
3
+ export * from './learnCard';
@@ -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
+ };