@sphereon/ssi-sdk.resource-resolver 0.30.2-unstable.18 → 0.30.2-unstable.19
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 +72 -0
- package/package.json +4 -4
package/README.md
CHANGED
@@ -12,6 +12,78 @@
|
|
12
12
|
|
13
13
|
---
|
14
14
|
|
15
|
+
A Veramo resource resolver plugin. This plugin has the option to cache resources and fetch them from a storage.
|
16
|
+
|
17
|
+
## Available functions
|
18
|
+
|
19
|
+
- resourceResolve
|
20
|
+
- resourceClearAllResources
|
21
|
+
- resourceDefaultStoreId
|
22
|
+
- resourceDefaultNamespace
|
23
|
+
- resourceDefaultTtl
|
24
|
+
-
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```typescript
|
28
|
+
import { ResourceResolver } from '@sphereon/ssi-sdk.resource-resolver'
|
29
|
+
import { KeyValueStoreEntity, kvStoreMigrations, KeyValueStore } from '@sphereon/ssi-sdk.kv-store-temp'
|
30
|
+
|
31
|
+
const dbConnection = createConnection({
|
32
|
+
type: 'react-native',
|
33
|
+
database: 'app.sqlite',
|
34
|
+
location: 'default',
|
35
|
+
logging: false,
|
36
|
+
synchronize: false,
|
37
|
+
migrationsRun: true,
|
38
|
+
migrations: kvStoreMigrations,
|
39
|
+
entities: [KeyValueStoreEntity],
|
40
|
+
})
|
41
|
+
|
42
|
+
const agent = createAgent<IContactManager>({
|
43
|
+
plugins: [
|
44
|
+
new ResourceResolver({
|
45
|
+
resourceStores: new KeyValueStore({
|
46
|
+
store: new KeyValueTypeORMStoreAdapter({ dbConnection })
|
47
|
+
}),
|
48
|
+
}),
|
49
|
+
],
|
50
|
+
})
|
51
|
+
```
|
52
|
+
|
53
|
+
### Resolve a resource:
|
54
|
+
|
55
|
+
```typescript
|
56
|
+
const response = await agent.resourceResolve({
|
57
|
+
input: 'https://example.com/example_resource.jpg',
|
58
|
+
resourceType: 'example_type',
|
59
|
+
})
|
60
|
+
```
|
61
|
+
|
62
|
+
### Clear all resources:
|
63
|
+
|
64
|
+
```typescript
|
65
|
+
const storeId = '3c0e6c59-fe47-433c-a3d2-ad18b9c83517'
|
66
|
+
const result = await agent.resourceClearAllResources({ storeId })
|
67
|
+
```
|
68
|
+
|
69
|
+
### Get default store id:
|
70
|
+
|
71
|
+
```typescript
|
72
|
+
const result = await agent.resourceDefaultStoreId()
|
73
|
+
```
|
74
|
+
|
75
|
+
### Get default namespace:
|
76
|
+
|
77
|
+
```typescript
|
78
|
+
const result = await agent.resourceDefaultNamespace()
|
79
|
+
```
|
80
|
+
|
81
|
+
### Get default ttl:
|
82
|
+
|
83
|
+
```typescript
|
84
|
+
const result = await agent.resourceDefaultTtl()
|
85
|
+
```
|
86
|
+
|
15
87
|
## Installation
|
16
88
|
|
17
89
|
```shell
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sphereon/ssi-sdk.resource-resolver",
|
3
|
-
"version": "0.30.2-unstable.
|
3
|
+
"version": "0.30.2-unstable.19+17aad525",
|
4
4
|
"source": "src/index.ts",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -14,14 +14,14 @@
|
|
14
14
|
"build:clean": "tsc --build --clean && tsc --build"
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
|
-
"@sphereon/ssi-sdk.kv-store-temp": "0.30.2-unstable.
|
17
|
+
"@sphereon/ssi-sdk.kv-store-temp": "0.30.2-unstable.19+17aad525",
|
18
18
|
"cross-fetch": "^3.1.8",
|
19
19
|
"debug": "^4.3.5",
|
20
20
|
"typeorm": "^0.3.20",
|
21
21
|
"uint8arrays": "^3.1.1"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
|
-
"@sphereon/ssi-sdk.agent-config": "0.30.2-unstable.
|
24
|
+
"@sphereon/ssi-sdk.agent-config": "0.30.2-unstable.19+17aad525",
|
25
25
|
"@veramo/remote-client": "4.2.0",
|
26
26
|
"@veramo/remote-server": "4.2.0",
|
27
27
|
"nock": "^13.5.4",
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"Resource Management",
|
49
49
|
"Caching"
|
50
50
|
],
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "17aad525f38b31f85f9fbc1fa1f8370888d9f829"
|
52
52
|
}
|