@learncard/idx-plugin 1.0.0
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/LICENSE +21 -0
- package/README.md +140 -0
- package/dist/idx-plugin.cjs.development.js +65066 -0
- package/dist/idx-plugin.cjs.development.js.map +7 -0
- package/dist/idx-plugin.cjs.production.min.js +867 -0
- package/dist/idx-plugin.cjs.production.min.js.map +7 -0
- package/dist/idx-plugin.esm.js +65067 -0
- package/dist/idx-plugin.esm.js.map +7 -0
- package/dist/idx.d.ts +6 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -0
- package/dist/types.d.ts +53 -0
- package/package.json +48 -0
package/dist/idx.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LearnCard } from '@learncard/core';
|
|
2
|
+
import { IDXPlugin, IDXPluginDependentMethods, IDXArgs } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @group Plugins
|
|
5
|
+
*/
|
|
6
|
+
export declare const getIDXPlugin: (learnCard: LearnCard<any, 'read', IDXPluginDependentMethods>, { modelData, credentialAlias }: IDXArgs) => Promise<IDXPlugin>;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ModelAliases } from '@glazed/types';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { StreamID } from '@ceramicnetwork/streamid';
|
|
4
|
+
import { Plugin } from '@learncard/core';
|
|
5
|
+
import { VC, CredentialRecord } from '@learncard/types';
|
|
6
|
+
import { CeramicClient } from '@ceramicnetwork/http-client';
|
|
7
|
+
/** @group IDXPlugin */
|
|
8
|
+
export type IDXIndexObject<IDXMetadata extends Record<string, any>, Metadata extends Record<string, any>> = {
|
|
9
|
+
credentials: CredentialRecord<Metadata>[];
|
|
10
|
+
} & IDXMetadata;
|
|
11
|
+
/** @group IDXPlugin */
|
|
12
|
+
export type IDXArgs = {
|
|
13
|
+
modelData: ModelAliases;
|
|
14
|
+
credentialAlias: string;
|
|
15
|
+
};
|
|
16
|
+
/** @group IDXPlugin */
|
|
17
|
+
export type IDXPluginMethods = {
|
|
18
|
+
getCredentialsListFromIdx: <Metadata extends Record<string, any> = Record<never, never>>(alias?: string) => Promise<CredentialRecord<Metadata>[]>;
|
|
19
|
+
getVerifiableCredentialFromIdx: (id: string) => Promise<VC | undefined>;
|
|
20
|
+
getVerifiableCredentialsFromIdx: () => Promise<VC[]>;
|
|
21
|
+
addVerifiableCredentialInIdx: <Metadata extends Record<string, any> = Record<never, never>>(cred: CredentialRecord<Metadata>) => Promise<string>;
|
|
22
|
+
removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID>;
|
|
23
|
+
removeAllVerifiableCredentialsInIdx: () => Promise<StreamID>;
|
|
24
|
+
getIDXIndex: <IDXMetadata extends Record<string, any>, Metadata extends Record<string, any>>() => Promise<IDXIndexObject<IDXMetadata, Metadata> | null>;
|
|
25
|
+
setIDXIndex: <IDXMetadata extends Record<string, any>, Metadata extends Record<string, any>>(index: IDXIndexObject<IDXMetadata, Metadata>) => Promise<StreamID>;
|
|
26
|
+
};
|
|
27
|
+
/** @group IDXPlugin */
|
|
28
|
+
export type IDXPluginDependentMethods = {
|
|
29
|
+
getCeramicClient: () => CeramicClient;
|
|
30
|
+
};
|
|
31
|
+
/** @group IDXPlugin */
|
|
32
|
+
export type CredentialsList<Metadata extends Record<string, any> = Record<never, never>> = {
|
|
33
|
+
credentials: Array<CredentialRecord<Metadata>>;
|
|
34
|
+
};
|
|
35
|
+
/** @group IDXPlugin */
|
|
36
|
+
export declare const CredentialsListValidator: z.ZodType<CredentialsList>;
|
|
37
|
+
/** @group IDXPlugin */
|
|
38
|
+
export type IDXPlugin = Plugin<'IDX', 'index', IDXPluginMethods, 'read', IDXPluginDependentMethods>;
|
|
39
|
+
/** @group IDXPlugin */
|
|
40
|
+
export type BackwardsCompatIDXCredential<Metadata extends Record<string, any> = Record<never, never>> = {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
storageType?: 'ceramic';
|
|
45
|
+
} & Metadata;
|
|
46
|
+
/** @group IDXPlugin */
|
|
47
|
+
export declare const BackwardsCompatIDXCredentialValidator: z.ZodType<BackwardsCompatIDXCredential>;
|
|
48
|
+
/** @group IDXPlugin */
|
|
49
|
+
export type BackwardsCompatCredentialsList<Metadata extends Record<string, any> = Record<never, never>> = {
|
|
50
|
+
credentials: Array<CredentialRecord<Metadata> | BackwardsCompatIDXCredential<Metadata>>;
|
|
51
|
+
};
|
|
52
|
+
/** @group IDXPlugin */
|
|
53
|
+
export declare const BackwardsCompatCredentialsListValidator: z.ZodType<BackwardsCompatCredentialsList>;
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@learncard/idx-plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/idx-plugin.esm.js",
|
|
7
|
+
"private": false,
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"author": "Learning Economy Foundation (www.learningeconomy.io)",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/WeLibraryOS/LearnCard#readme",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/WeLibraryOS/LearnCard.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/WeLibraryOS/LearnCard/issues"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@glazed/types": "0.2.0",
|
|
23
|
+
"@types/jest": "^29.2.2",
|
|
24
|
+
"@types/node": "^17.0.31",
|
|
25
|
+
"aqu": "0.4.3",
|
|
26
|
+
"esbuild": "^0.14.38",
|
|
27
|
+
"esbuild-jest": "^0.5.0",
|
|
28
|
+
"esbuild-plugin-copy": "^1.3.0",
|
|
29
|
+
"jest": "^29.3.0",
|
|
30
|
+
"shx": "^0.3.4",
|
|
31
|
+
"ts-jest": "^29.0.3"
|
|
32
|
+
},
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@ceramicnetwork/http-client": "2.7.0",
|
|
36
|
+
"@ceramicnetwork/streamid": "2.7.0",
|
|
37
|
+
"@glazed/did-datastore": "0.3.2",
|
|
38
|
+
"@learncard/core": "9.0.0",
|
|
39
|
+
"@learncard/ceramic-plugin": "^1.0.0",
|
|
40
|
+
"@learncard/types": "5.3.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json",
|
|
44
|
+
"test": "jest --passWithNoTests",
|
|
45
|
+
"test:watch": "jest --watch",
|
|
46
|
+
"test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
|
|
47
|
+
}
|
|
48
|
+
}
|