@veramo/cli 4.0.1-next.8 → 4.0.1-unstable.4
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/bin/veramo.js +1 -1
- package/build/cli.d.ts +13 -13
- package/build/cli.d.ts.map +1 -1
- package/build/cli.js +19 -23
- package/build/cli.js.map +1 -1
- package/build/config.d.ts +1 -1
- package/build/config.d.ts.map +1 -1
- package/build/config.js +17 -27
- package/build/config.js.map +1 -1
- package/build/credential.js +34 -70
- package/build/credential.js.map +1 -1
- package/build/dev.js +40 -62
- package/build/dev.js.map +1 -1
- package/build/did.js +70 -84
- package/build/did.js.map +1 -1
- package/build/discover.js +9 -20
- package/build/discover.js.map +1 -1
- package/build/execute.js +16 -30
- package/build/execute.js.map +1 -1
- package/build/explore/credentials.d.ts +1 -1
- package/build/explore/credentials.d.ts.map +1 -1
- package/build/explore/credentials.js +19 -37
- package/build/explore/credentials.js.map +1 -1
- package/build/explore/index.js +9 -19
- package/build/explore/index.js.map +1 -1
- package/build/explore/main.d.ts +1 -1
- package/build/explore/main.d.ts.map +1 -1
- package/build/explore/main.js +24 -42
- package/build/explore/main.js.map +1 -1
- package/build/explore/managed-identifiers.d.ts +1 -1
- package/build/explore/managed-identifiers.d.ts.map +1 -1
- package/build/explore/managed-identifiers.js +14 -32
- package/build/explore/managed-identifiers.js.map +1 -1
- package/build/explore/messages.d.ts +1 -1
- package/build/explore/messages.d.ts.map +1 -1
- package/build/explore/messages.js +13 -31
- package/build/explore/messages.js.map +1 -1
- package/build/explore/presentations.d.ts +1 -1
- package/build/explore/presentations.d.ts.map +1 -1
- package/build/explore/presentations.js +19 -37
- package/build/explore/presentations.js.map +1 -1
- package/build/explore/styles.js +1 -4
- package/build/explore/styles.js.map +1 -1
- package/build/explore/utils.js +8 -17
- package/build/explore/utils.js.map +1 -1
- package/build/lib/agentCreator.d.ts +1 -1
- package/build/lib/agentCreator.d.ts.map +1 -1
- package/build/lib/agentCreator.js +3 -7
- package/build/lib/agentCreator.js.map +1 -1
- package/build/lib/objectCreator.d.ts +1 -1
- package/build/lib/objectCreator.d.ts.map +1 -1
- package/build/lib/objectCreator.js +22 -29
- package/build/lib/objectCreator.js.map +1 -1
- package/build/message.js +8 -19
- package/build/message.js.map +1 -1
- package/build/presentation.js +73 -98
- package/build/presentation.js.map +1 -1
- package/build/sdr.js +50 -68
- package/build/sdr.js.map +1 -1
- package/build/server.js +13 -25
- package/build/server.js.map +1 -1
- package/build/setup.d.ts +1 -2
- package/build/setup.d.ts.map +1 -1
- package/build/setup.js +8 -17
- package/build/setup.js.map +1 -1
- package/build/util.js +17 -32
- package/build/util.js.map +1 -1
- package/build/version.js +6 -5
- package/build/version.js.map +1 -1
- package/default/default.yml +1 -17
- package/package.json +29 -23
- package/src/cli.ts +15 -14
- package/src/config.ts +6 -5
- package/src/credential.ts +8 -8
- package/src/dev.ts +7 -3
- package/src/did.ts +12 -12
- package/src/discover.ts +2 -2
- package/src/execute.ts +5 -5
- package/src/explore/credentials.ts +3 -3
- package/src/explore/index.ts +5 -4
- package/src/explore/main.ts +6 -6
- package/src/explore/managed-identifiers.ts +3 -3
- package/src/explore/messages.ts +3 -3
- package/src/explore/presentations.ts +3 -3
- package/src/lib/agentCreator.ts +3 -3
- package/src/lib/objectCreator.ts +15 -15
- package/src/message.ts +3 -3
- package/src/presentation.ts +45 -32
- package/src/sdr.ts +5 -5
- package/src/server.ts +5 -3
- package/src/setup.ts +3 -5
- package/src/version.ts +4 -2
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/cli",
|
|
3
3
|
"description": "Veramo command line application.",
|
|
4
|
-
"version": "4.0.1-
|
|
4
|
+
"version": "4.0.1-unstable.4+a20894d6",
|
|
5
5
|
"main": "build/cli.js",
|
|
6
|
+
"exports": "./build/cli.js",
|
|
6
7
|
"types": "build/cli.d.ts",
|
|
7
8
|
"bin": {
|
|
8
9
|
"veramo": "bin/veramo.js"
|
|
@@ -14,28 +15,28 @@
|
|
|
14
15
|
"update-veramo-latest": "yarn add @veramo/core@latest @veramo/discovery@latest @veramo/remote-client@latest @veramo/remote-server@latest @veramo/did-provider-key@latest @veramo/did-resolver@latest @veramo/did-jwt@latest @veramo/credential-w3c@latest @veramo/did-provider-ethr@latest @veramo/did-provider-web@latest @veramo/did-comm@latest @veramo/kms-local@latest @veramo/selective-disclosure@latest @veramo/data-store@latest @veramo/key-manager@latest @veramo/message-handler@latest @veramo/did-manager@latest @veramo/url-handler@latest"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
|
-
"@microsoft/api-extractor": "7.
|
|
18
|
-
"@microsoft/api-extractor-model": "7.
|
|
18
|
+
"@microsoft/api-extractor": "7.30.0",
|
|
19
|
+
"@microsoft/api-extractor-model": "7.24.0",
|
|
19
20
|
"@types/blessed": "^0.1.17",
|
|
20
21
|
"@types/swagger-ui-express": "^4.1.3",
|
|
21
|
-
"@veramo/core": "^4.0.1-
|
|
22
|
-
"@veramo/credential-w3c": "^4.0.1-
|
|
23
|
-
"@veramo/data-store": "^4.0.1-
|
|
24
|
-
"@veramo/did-comm": "^4.0.1-
|
|
25
|
-
"@veramo/did-discovery": "^4.0.1-
|
|
26
|
-
"@veramo/did-jwt": "^4.0.1-
|
|
27
|
-
"@veramo/did-manager": "^4.0.1-
|
|
28
|
-
"@veramo/did-provider-ethr": "^4.0.1-
|
|
29
|
-
"@veramo/did-provider-key": "^4.0.1-
|
|
30
|
-
"@veramo/did-provider-web": "^4.0.1-
|
|
31
|
-
"@veramo/did-resolver": "^4.0.1-
|
|
32
|
-
"@veramo/key-manager": "^4.0.1-
|
|
33
|
-
"@veramo/kms-local": "^4.0.1-
|
|
34
|
-
"@veramo/message-handler": "^4.0.1-
|
|
35
|
-
"@veramo/remote-client": "^4.0.1-
|
|
36
|
-
"@veramo/remote-server": "^4.0.1-
|
|
37
|
-
"@veramo/selective-disclosure": "^4.0.1-
|
|
38
|
-
"@veramo/url-handler": "^4.0.1-
|
|
22
|
+
"@veramo/core": "^4.0.1-unstable.4+a20894d6",
|
|
23
|
+
"@veramo/credential-w3c": "^4.0.1-unstable.4+a20894d6",
|
|
24
|
+
"@veramo/data-store": "^4.0.1-unstable.4+a20894d6",
|
|
25
|
+
"@veramo/did-comm": "^4.0.1-unstable.4+a20894d6",
|
|
26
|
+
"@veramo/did-discovery": "^4.0.1-unstable.4+a20894d6",
|
|
27
|
+
"@veramo/did-jwt": "^4.0.1-unstable.4+a20894d6",
|
|
28
|
+
"@veramo/did-manager": "^4.0.1-unstable.4+a20894d6",
|
|
29
|
+
"@veramo/did-provider-ethr": "^4.0.1-unstable.4+a20894d6",
|
|
30
|
+
"@veramo/did-provider-key": "^4.0.1-unstable.4+a20894d6",
|
|
31
|
+
"@veramo/did-provider-web": "^4.0.1-unstable.4+a20894d6",
|
|
32
|
+
"@veramo/did-resolver": "^4.0.1-unstable.4+a20894d6",
|
|
33
|
+
"@veramo/key-manager": "^4.0.1-unstable.4+a20894d6",
|
|
34
|
+
"@veramo/kms-local": "^4.0.1-unstable.4+a20894d6",
|
|
35
|
+
"@veramo/message-handler": "^4.0.1-unstable.4+a20894d6",
|
|
36
|
+
"@veramo/remote-client": "^4.0.1-unstable.4+a20894d6",
|
|
37
|
+
"@veramo/remote-server": "^4.0.1-unstable.4+a20894d6",
|
|
38
|
+
"@veramo/selective-disclosure": "^4.0.1-unstable.4+a20894d6",
|
|
39
|
+
"@veramo/url-handler": "^4.0.1-unstable.4+a20894d6",
|
|
39
40
|
"blessed": "^0.1.81",
|
|
40
41
|
"commander": "^9.0.0",
|
|
41
42
|
"console-table-printer": "^2.10.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"debug": "^4.3.3",
|
|
46
47
|
"did-resolver": "^4.0.0",
|
|
47
48
|
"dotenv": "^16.0.0",
|
|
48
|
-
"ethr-did-resolver": "^6.1
|
|
49
|
+
"ethr-did-resolver": "^6.2.1",
|
|
49
50
|
"express": "^4.17.2",
|
|
50
51
|
"express-handlebars": "^6.0.2",
|
|
51
52
|
"fuzzy": "^0.1.3",
|
|
@@ -100,5 +101,10 @@
|
|
|
100
101
|
],
|
|
101
102
|
"license": "Apache-2.0",
|
|
102
103
|
"keywords": [],
|
|
103
|
-
"
|
|
104
|
+
"type": "module",
|
|
105
|
+
"moduleDirectories": [
|
|
106
|
+
"node_modules",
|
|
107
|
+
"src"
|
|
108
|
+
],
|
|
109
|
+
"gitHead": "a20894d60b23ab098391dd9d8ff6f96474081dc5"
|
|
104
110
|
}
|
package/src/cli.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { program } from 'commander'
|
|
2
2
|
import inquirer from 'inquirer'
|
|
3
|
+
import inquirer2 from 'inquirer-autocomplete-prompt'
|
|
3
4
|
|
|
4
|
-
inquirer.registerPrompt('autocomplete',
|
|
5
|
+
inquirer.registerPrompt('autocomplete', inquirer2)
|
|
5
6
|
|
|
6
|
-
import './did'
|
|
7
|
-
import './credential'
|
|
8
|
-
import './presentation'
|
|
9
|
-
import './explore'
|
|
10
|
-
import './sdr'
|
|
11
|
-
import './message'
|
|
12
|
-
import './discover'
|
|
13
|
-
import './version'
|
|
14
|
-
import './execute'
|
|
15
|
-
import './server'
|
|
16
|
-
import './setup'
|
|
17
|
-
import './config'
|
|
18
|
-
import './dev'
|
|
7
|
+
import './did.js'
|
|
8
|
+
import './credential.js'
|
|
9
|
+
import './presentation.js'
|
|
10
|
+
import './explore/index.js'
|
|
11
|
+
import './sdr.js'
|
|
12
|
+
import './message.js'
|
|
13
|
+
import './discover.js'
|
|
14
|
+
import './version.js'
|
|
15
|
+
import './execute.js'
|
|
16
|
+
import './server.js'
|
|
17
|
+
import './setup.js'
|
|
18
|
+
import './config.js'
|
|
19
|
+
import './dev.js'
|
|
19
20
|
|
|
20
21
|
if (!process.argv.slice(2).length) {
|
|
21
22
|
program.outputHelp()
|
package/src/config.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import 'cross-fetch/polyfill'
|
|
2
1
|
import { program } from 'commander'
|
|
3
2
|
import { SecretBox } from '@veramo/kms-local'
|
|
4
|
-
import { getAgent } from './setup'
|
|
3
|
+
import { getAgent } from './setup.js'
|
|
4
|
+
import fs from "fs"
|
|
5
|
+
import { dirname } from 'path'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
const
|
|
7
|
+
import * as url from 'url';
|
|
8
|
+
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
8
9
|
|
|
9
10
|
program.option('--config <path>', 'Configuration file', './agent.yml')
|
|
10
11
|
|
|
@@ -71,7 +72,7 @@ config
|
|
|
71
72
|
.option('-f, --filename <string>', 'Config file name', './agent.yml')
|
|
72
73
|
.option('-m, --method <string>', 'Check that a specific method is exposed by the agent.', 'execute')
|
|
73
74
|
.action(async (options) => {
|
|
74
|
-
const agent = getAgent(options.filename)
|
|
75
|
+
const agent = await getAgent(options.filename)
|
|
75
76
|
if (!agent) {
|
|
76
77
|
console.error(
|
|
77
78
|
'unknown error while creating the agent from your config. Consider running `veramo config create` to generate a new configuration file, or to manually compare differences.',
|
package/src/credential.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { getAgent } from './setup'
|
|
1
|
+
import { getAgent } from './setup.js'
|
|
2
2
|
import { program } from 'commander'
|
|
3
3
|
import inquirer from 'inquirer'
|
|
4
4
|
import qrcode from 'qrcode-terminal'
|
|
5
5
|
import * as fs from 'fs'
|
|
6
6
|
import * as json5 from 'json5'
|
|
7
|
-
import { readStdin } from './util'
|
|
7
|
+
import { readStdin } from './util.js'
|
|
8
8
|
import { CredentialPayload } from '@veramo/core'
|
|
9
|
-
|
|
10
|
-
const fuzzy = require('fuzzy')
|
|
9
|
+
import fuzzy from 'fuzzy'
|
|
11
10
|
|
|
12
11
|
const credential = program.command('credential').description('W3C Verifiable Credential')
|
|
13
12
|
|
|
@@ -18,7 +17,7 @@ credential
|
|
|
18
17
|
.option('-j, --json', 'Output in JSON')
|
|
19
18
|
.option('-q, --qrcode', 'Show qrcode')
|
|
20
19
|
.action(async (cmd) => {
|
|
21
|
-
const agent = getAgent(program.opts().config)
|
|
20
|
+
const agent = await getAgent(program.opts().config)
|
|
22
21
|
const identifiers = await agent.didManagerFind()
|
|
23
22
|
|
|
24
23
|
const knownDids = await agent.dataStoreORMGetIdentifiers()
|
|
@@ -110,7 +109,8 @@ credential
|
|
|
110
109
|
type: 'input',
|
|
111
110
|
name: 'id',
|
|
112
111
|
message: 'Credential status ID',
|
|
113
|
-
|
|
112
|
+
// TODO(nickreynolds): deploy
|
|
113
|
+
default: 'goerli:0x97fd27892cdcD035dAe1fe71235c636044B59348',
|
|
114
114
|
},
|
|
115
115
|
])
|
|
116
116
|
|
|
@@ -169,7 +169,7 @@ credential
|
|
|
169
169
|
.option('-f, --filename <string>', 'Optional. Read the credential from a file instead of stdin')
|
|
170
170
|
.option('-r, --raw <string>', 'Optional. Specify the credential as a parameter instead of file or stdin')
|
|
171
171
|
.action(async (options) => {
|
|
172
|
-
const agent = getAgent(program.opts().config)
|
|
172
|
+
const agent = await getAgent(program.opts().config)
|
|
173
173
|
let raw: string = ''
|
|
174
174
|
if (options.raw) {
|
|
175
175
|
raw = options.raw
|
|
@@ -205,7 +205,7 @@ credential
|
|
|
205
205
|
.command('output')
|
|
206
206
|
.description('Print W3C Verifiable Credential to stdout')
|
|
207
207
|
.action(async (cmd) => {
|
|
208
|
-
const agent = getAgent(program.opts().config)
|
|
208
|
+
const agent = await getAgent(program.opts().config)
|
|
209
209
|
|
|
210
210
|
const credentials = await agent.dataStoreORMGetVerifiableCredentials()
|
|
211
211
|
|
package/src/dev.ts
CHANGED
|
@@ -10,7 +10,10 @@ import { writeFileSync } from 'fs'
|
|
|
10
10
|
import { OpenAPIV3 } from 'openapi-types'
|
|
11
11
|
import { resolve } from 'path'
|
|
12
12
|
import * as TJS from 'ts-json-schema-generator'
|
|
13
|
-
|
|
13
|
+
import fs from 'fs'
|
|
14
|
+
|
|
15
|
+
import { createRequire } from "module";
|
|
16
|
+
const require = createRequire(import.meta.url);
|
|
14
17
|
|
|
15
18
|
interface Method {
|
|
16
19
|
packageName: string
|
|
@@ -90,7 +93,7 @@ dev
|
|
|
90
93
|
'./package.json',
|
|
91
94
|
)
|
|
92
95
|
|
|
93
|
-
.action(async (options) => {
|
|
96
|
+
.action(async (options: any) => {
|
|
94
97
|
const apiExtractorJsonPath: string = resolve(options.extractorConfig)
|
|
95
98
|
const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)
|
|
96
99
|
|
|
@@ -123,6 +126,7 @@ dev
|
|
|
123
126
|
path: resolve(entryFile),
|
|
124
127
|
encodeRefs: false,
|
|
125
128
|
additionalProperties: true,
|
|
129
|
+
skipTypeCheck: true,
|
|
126
130
|
})
|
|
127
131
|
|
|
128
132
|
const apiModel: ApiModel = new ApiModel()
|
|
@@ -177,7 +181,7 @@ dev
|
|
|
177
181
|
interfaces[pluginInterfaceName] = api
|
|
178
182
|
}
|
|
179
183
|
|
|
180
|
-
writeFileSync(resolve('./plugin.schema.json'), JSON.stringify(interfaces, null, 2))
|
|
184
|
+
writeFileSync(resolve('./src/plugin.schema.json'), JSON.stringify(interfaces, null, 2))
|
|
181
185
|
})
|
|
182
186
|
|
|
183
187
|
dev
|
package/src/did.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDIDManagerCreateArgs } from '@veramo/core'
|
|
2
|
-
import { getAgent } from './setup'
|
|
2
|
+
import { getAgent } from './setup.js'
|
|
3
3
|
import inquirer from 'inquirer'
|
|
4
4
|
import { program } from 'commander'
|
|
5
5
|
import { printTable } from 'console-table-printer'
|
|
@@ -10,7 +10,7 @@ did
|
|
|
10
10
|
.command('providers')
|
|
11
11
|
.description('list available identifier providers')
|
|
12
12
|
.action(async (cmd) => {
|
|
13
|
-
const agent = getAgent(program.opts().config)
|
|
13
|
+
const agent = await getAgent(program.opts().config)
|
|
14
14
|
|
|
15
15
|
const providers = await agent.didManagerGetProviders()
|
|
16
16
|
const list = providers.map((provider) => ({ provider }))
|
|
@@ -26,7 +26,7 @@ did
|
|
|
26
26
|
.command('list', { isDefault: true })
|
|
27
27
|
.description('list managed identifiers')
|
|
28
28
|
.action(async (cmd) => {
|
|
29
|
-
const agent = getAgent(program.opts().config)
|
|
29
|
+
const agent = await getAgent(program.opts().config)
|
|
30
30
|
|
|
31
31
|
const list = await agent.didManagerFind()
|
|
32
32
|
|
|
@@ -42,7 +42,7 @@ did
|
|
|
42
42
|
.command('create')
|
|
43
43
|
.description('create an identifier')
|
|
44
44
|
.action(async (cmd) => {
|
|
45
|
-
const agent = getAgent(program.opts().config)
|
|
45
|
+
const agent = await getAgent(program.opts().config)
|
|
46
46
|
|
|
47
47
|
try {
|
|
48
48
|
const providers = await agent.didManagerGetProviders()
|
|
@@ -80,7 +80,7 @@ did
|
|
|
80
80
|
.command('delete')
|
|
81
81
|
.description('delete an identifier')
|
|
82
82
|
.action(async (cmd) => {
|
|
83
|
-
const agent = getAgent(program.opts().config)
|
|
83
|
+
const agent = await getAgent(program.opts().config)
|
|
84
84
|
|
|
85
85
|
try {
|
|
86
86
|
const identifiers = await agent.didManagerFind()
|
|
@@ -107,7 +107,7 @@ did
|
|
|
107
107
|
.command('add-service')
|
|
108
108
|
.description('add a service endpoint to did document')
|
|
109
109
|
.action(async (cmd) => {
|
|
110
|
-
const agent = getAgent(program.opts().config)
|
|
110
|
+
const agent = await getAgent(program.opts().config)
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
113
|
const identifiers = await agent.didManagerFind()
|
|
@@ -155,7 +155,7 @@ did
|
|
|
155
155
|
.command('remove-service')
|
|
156
156
|
.description('remove a service endpoint from did document')
|
|
157
157
|
.action(async (cmd) => {
|
|
158
|
-
const agent = getAgent(program.opts().config)
|
|
158
|
+
const agent = await getAgent(program.opts().config)
|
|
159
159
|
|
|
160
160
|
try {
|
|
161
161
|
const identifiers = await agent.didManagerFind()
|
|
@@ -188,7 +188,7 @@ did
|
|
|
188
188
|
.command('add-key')
|
|
189
189
|
.description('create and add a public key to did document')
|
|
190
190
|
.action(async (cmd) => {
|
|
191
|
-
const agent = getAgent(program.opts().config)
|
|
191
|
+
const agent = await getAgent(program.opts().config)
|
|
192
192
|
|
|
193
193
|
try {
|
|
194
194
|
const identifiers = await agent.didManagerFind()
|
|
@@ -234,7 +234,7 @@ did
|
|
|
234
234
|
.command('remove-key')
|
|
235
235
|
.description('remove a key from did document')
|
|
236
236
|
.action(async (cmd) => {
|
|
237
|
-
const agent = getAgent(program.opts().config)
|
|
237
|
+
const agent = await getAgent(program.opts().config)
|
|
238
238
|
|
|
239
239
|
try {
|
|
240
240
|
const identifiers = await agent.didManagerFind()
|
|
@@ -267,7 +267,7 @@ did
|
|
|
267
267
|
.command('export')
|
|
268
268
|
.description('export an identifier')
|
|
269
269
|
.action(async (cmd) => {
|
|
270
|
-
const agent = getAgent(program.opts().config)
|
|
270
|
+
const agent = await getAgent(program.opts().config)
|
|
271
271
|
|
|
272
272
|
try {
|
|
273
273
|
const identifiers = await agent.didManagerFind()
|
|
@@ -295,7 +295,7 @@ did
|
|
|
295
295
|
.command('import')
|
|
296
296
|
.description('import an identifier')
|
|
297
297
|
.action(async (cmd) => {
|
|
298
|
-
const agent = getAgent(program.opts().config)
|
|
298
|
+
const agent = await getAgent(program.opts().config)
|
|
299
299
|
|
|
300
300
|
try {
|
|
301
301
|
const answers = await inquirer.prompt([
|
|
@@ -317,7 +317,7 @@ did
|
|
|
317
317
|
.command('resolve <didUrl>')
|
|
318
318
|
.description('Resolve DID Document')
|
|
319
319
|
.action(async (didUrl) => {
|
|
320
|
-
const agent = getAgent(program.opts().config)
|
|
320
|
+
const agent = await getAgent(program.opts().config)
|
|
321
321
|
try {
|
|
322
322
|
const ddo = await agent.resolveDid({ didUrl })
|
|
323
323
|
console.log(JSON.stringify(ddo, null, 2))
|
package/src/discover.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAgent } from './setup'
|
|
1
|
+
import { getAgent } from './setup.js'
|
|
2
2
|
import { program } from 'commander'
|
|
3
3
|
import { printTable } from 'console-table-printer'
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ discover
|
|
|
10
10
|
.option('-q, --query <string>', 'Query string')
|
|
11
11
|
|
|
12
12
|
.action(async (cmd) => {
|
|
13
|
-
const agent = getAgent(program.opts().config)
|
|
13
|
+
const agent = await getAgent(program.opts().config)
|
|
14
14
|
|
|
15
15
|
const response = await agent.discoverDid({ query: cmd.query })
|
|
16
16
|
const list: any = []
|
package/src/execute.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { program } from 'commander'
|
|
2
2
|
import inquirer from 'inquirer'
|
|
3
|
-
import { getAgent } from './setup'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { getAgent } from './setup.js'
|
|
4
|
+
import fs from 'fs'
|
|
5
|
+
import OasResolver from 'oas-resolver'
|
|
6
|
+
import fuzzy from 'fuzzy'
|
|
7
7
|
|
|
8
8
|
program
|
|
9
9
|
.command('execute')
|
|
@@ -12,7 +12,7 @@ program
|
|
|
12
12
|
.option('-a, --argsJSON <string>', 'Method arguments')
|
|
13
13
|
.option('-f, --argsFile <string>', 'Path to a file containing method arguments in a JSON string')
|
|
14
14
|
.action(async (options) => {
|
|
15
|
-
const agent = getAgent(program.opts().config)
|
|
15
|
+
const agent = await getAgent(program.opts().config)
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
18
|
let method = options.method
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { UniqueVerifiableCredential } from '@veramo/core'
|
|
3
|
-
import { shortDate, shortDid, copyToClipboard } from './utils'
|
|
4
|
-
import { ConfiguredAgent } from '../setup'
|
|
5
|
-
import { styles } from './styles'
|
|
3
|
+
import { shortDate, shortDid, copyToClipboard } from './utils.js'
|
|
4
|
+
import { ConfiguredAgent } from '../setup.js'
|
|
5
|
+
import { styles } from './styles.js'
|
|
6
6
|
import { asArray, extractIssuer } from '@veramo/utils'
|
|
7
7
|
|
|
8
8
|
export const getCredentialsTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
package/src/explore/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { getAgent } from '../setup'
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { getAgent } from '../setup.js'
|
|
2
|
+
import { Command } from 'commander'
|
|
3
|
+
const program = new Command();
|
|
4
|
+
import { renderMainScreen } from './main.js'
|
|
4
5
|
|
|
5
6
|
program
|
|
6
7
|
.command('explore')
|
|
7
8
|
.description('launch Verifiable Data explorer')
|
|
8
9
|
.action(async (cmd) => {
|
|
9
|
-
const agent = getAgent(program.opts().config)
|
|
10
|
+
const agent = await getAgent(program.opts().config)
|
|
10
11
|
await renderMainScreen(agent)
|
|
11
12
|
})
|
package/src/explore/main.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import blessed from 'blessed'
|
|
2
|
-
import { ConfiguredAgent } from '../setup'
|
|
3
|
-
import { styles } from './styles'
|
|
2
|
+
import { ConfiguredAgent } from '../setup.js'
|
|
3
|
+
import { styles } from './styles.js'
|
|
4
4
|
|
|
5
|
-
import { getManagedIdentifiersTable } from './managed-identifiers'
|
|
6
|
-
import { getMessagesTable } from './messages'
|
|
7
|
-
import { getCredentialsTable } from './credentials'
|
|
8
|
-
import { getPresentationsTable } from './presentations'
|
|
5
|
+
import { getManagedIdentifiersTable } from './managed-identifiers.js'
|
|
6
|
+
import { getMessagesTable } from './messages.js'
|
|
7
|
+
import { getCredentialsTable } from './credentials.js'
|
|
8
|
+
import { getPresentationsTable } from './presentations.js'
|
|
9
9
|
|
|
10
10
|
const defaultScreenTitle = 'Agent'
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { IIdentifier } from '@veramo/core'
|
|
3
|
-
import { copyToClipboard } from './utils'
|
|
4
|
-
import { ConfiguredAgent } from '../setup'
|
|
5
|
-
import { styles } from './styles'
|
|
3
|
+
import { copyToClipboard } from './utils.js'
|
|
4
|
+
import { ConfiguredAgent } from '../setup.js'
|
|
5
|
+
import { styles } from './styles.js'
|
|
6
6
|
|
|
7
7
|
export const getManagedIdentifiersTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
|
8
8
|
screen.title = 'Managed identifiers'
|
package/src/explore/messages.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { IMessage } from '@veramo/core'
|
|
3
|
-
import { shortDate, shortDid } from './utils'
|
|
4
|
-
import { ConfiguredAgent } from '../setup'
|
|
5
|
-
import { styles } from './styles'
|
|
3
|
+
import { shortDate, shortDid } from './utils.js'
|
|
4
|
+
import { ConfiguredAgent } from '../setup.js'
|
|
5
|
+
import { styles } from './styles.js'
|
|
6
6
|
|
|
7
7
|
export const getMessagesTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
|
8
8
|
screen.title = 'Messages'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import blessed, { Widgets } from 'blessed'
|
|
2
2
|
import { UniqueVerifiablePresentation } from '@veramo/core'
|
|
3
|
-
import { shortDate, shortDid, copyToClipboard } from './utils'
|
|
4
|
-
import { ConfiguredAgent } from '../setup'
|
|
5
|
-
import { styles } from './styles'
|
|
3
|
+
import { shortDate, shortDid, copyToClipboard } from './utils.js'
|
|
4
|
+
import { ConfiguredAgent } from '../setup.js'
|
|
5
|
+
import { styles } from './styles.js'
|
|
6
6
|
import { asArray } from '@veramo/utils'
|
|
7
7
|
|
|
8
8
|
export const getPresentationsTable = async (agent: ConfiguredAgent, screen: Widgets.Screen) => {
|
package/src/lib/agentCreator.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TAgent, IPluginMethodMap } from '@veramo/core'
|
|
2
|
-
import { createObjects } from './objectCreator'
|
|
2
|
+
import { createObjects } from './objectCreator.js'
|
|
3
3
|
|
|
4
|
-
export function createAgentFromConfig<T extends IPluginMethodMap>(config: object): TAgent<T
|
|
4
|
+
export async function createAgentFromConfig<T extends IPluginMethodMap>(config: object): Promise<TAgent<T>> {
|
|
5
5
|
//@ts-ignore
|
|
6
|
-
const { agent } = createObjects(config, { agent: '/agent' })
|
|
6
|
+
const { agent } = await createObjects(config, { agent: '/agent' })
|
|
7
7
|
return agent
|
|
8
8
|
}
|
package/src/lib/objectCreator.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { set, get } from 'jsonpointer'
|
|
2
2
|
import parse from 'url-parse'
|
|
3
|
-
|
|
3
|
+
import { resolve } from 'path'
|
|
4
4
|
|
|
5
|
-
export function createObjects(config: object, pointers: Record<string, string>): any {
|
|
5
|
+
export async function createObjects(config: object, pointers: Record<string, string>): Promise<any> {
|
|
6
6
|
const objects = {}
|
|
7
7
|
|
|
8
|
-
function resolveRefs(input: any): any {
|
|
8
|
+
async function resolveRefs(input: any): Promise<any> {
|
|
9
9
|
if (Array.isArray(input)) {
|
|
10
10
|
const resolved = []
|
|
11
11
|
for (const item of input) {
|
|
12
|
-
resolved.push(resolveRefs(item))
|
|
12
|
+
resolved.push(await resolveRefs(item))
|
|
13
13
|
}
|
|
14
14
|
return resolved
|
|
15
15
|
}
|
|
@@ -20,13 +20,13 @@ export function createObjects(config: object, pointers: Record<string, string>):
|
|
|
20
20
|
if (input.hasOwnProperty(property)) {
|
|
21
21
|
if (property === '$ref') {
|
|
22
22
|
const pointer = input[property]
|
|
23
|
-
return objectFromPointer(pointer)
|
|
23
|
+
return await objectFromPointer(pointer)
|
|
24
24
|
} else if (property === '$require') {
|
|
25
|
-
return objectFromConfig(input)
|
|
25
|
+
return await objectFromConfig(input)
|
|
26
26
|
} else if (property === '$env') {
|
|
27
27
|
return process.env[input[property]]
|
|
28
28
|
} else {
|
|
29
|
-
resolved[property] = resolveRefs(input[property])
|
|
29
|
+
resolved[property] = await resolveRefs(input[property])
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -36,7 +36,7 @@ export function createObjects(config: object, pointers: Record<string, string>):
|
|
|
36
36
|
return input
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function objectFromConfig(objectConfig: any) {
|
|
39
|
+
async function objectFromConfig(objectConfig: any) {
|
|
40
40
|
let object
|
|
41
41
|
// console.log('Requiring', objectConfig['$require'])
|
|
42
42
|
const parsed = parse(objectConfig['$require'], {}, true)
|
|
@@ -45,15 +45,15 @@ export function createObjects(config: object, pointers: Record<string, string>):
|
|
|
45
45
|
const type = parsed.query['t'] || 'class'
|
|
46
46
|
const pointer = parsed.query['p']
|
|
47
47
|
const args = objectConfig['$args']
|
|
48
|
-
// console.log({module, member, type, query: parsed.query})
|
|
48
|
+
// console.log({module, member, type, query: parsed.query, args, pointer})
|
|
49
49
|
|
|
50
50
|
if (module.slice(0, 2) === './') {
|
|
51
51
|
module = resolve(module)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const resolvedArgs = args !== undefined ? resolveRefs(args) : []
|
|
54
|
+
const resolvedArgs = args !== undefined ? await resolveRefs(args) : []
|
|
55
55
|
try {
|
|
56
|
-
let required = member ?
|
|
56
|
+
let required = member ? (await import(module))[member] : (await import(module)).default
|
|
57
57
|
if (type === 'class') {
|
|
58
58
|
object = new required(...resolvedArgs)
|
|
59
59
|
} else if (type === 'function') {
|
|
@@ -70,7 +70,7 @@ export function createObjects(config: object, pointers: Record<string, string>):
|
|
|
70
70
|
return object
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
function objectFromPointer(pointer: string) {
|
|
73
|
+
async function objectFromPointer(pointer: string) {
|
|
74
74
|
const existingObject = get(objects, pointer)
|
|
75
75
|
if (existingObject) {
|
|
76
76
|
// console.log('Existing', pointer)
|
|
@@ -82,11 +82,11 @@ export function createObjects(config: object, pointers: Record<string, string>):
|
|
|
82
82
|
try {
|
|
83
83
|
let object
|
|
84
84
|
if (objectConfig['$require']) {
|
|
85
|
-
object = objectFromConfig(objectConfig)
|
|
85
|
+
object = await objectFromConfig(objectConfig)
|
|
86
86
|
} else if (objectConfig['$env']) {
|
|
87
87
|
object = process.env[objectConfig['$env']]
|
|
88
88
|
} else {
|
|
89
|
-
object = resolveRefs(objectConfig)
|
|
89
|
+
object = await resolveRefs(objectConfig)
|
|
90
90
|
}
|
|
91
91
|
set(objects, pointer, object)
|
|
92
92
|
return object
|
|
@@ -99,7 +99,7 @@ export function createObjects(config: object, pointers: Record<string, string>):
|
|
|
99
99
|
const result: any = {}
|
|
100
100
|
for (const key of Object.keys(pointers)) {
|
|
101
101
|
if (pointers.hasOwnProperty(key)) {
|
|
102
|
-
result[key] = objectFromPointer(pointers[key])
|
|
102
|
+
result[key] = await objectFromPointer(pointers[key])
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
return result
|
package/src/message.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getAgent } from './setup'
|
|
1
|
+
import { getAgent } from './setup.js'
|
|
2
2
|
import { program } from 'commander'
|
|
3
|
-
|
|
3
|
+
import fs from 'fs'
|
|
4
4
|
|
|
5
5
|
const message = program.command('message').description('Messages')
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ message
|
|
|
12
12
|
.option('--save <boolean>', 'Save message', true)
|
|
13
13
|
|
|
14
14
|
.action(async (options) => {
|
|
15
|
-
const agent = getAgent(program.opts().config)
|
|
15
|
+
const agent = await getAgent(program.opts().config)
|
|
16
16
|
try {
|
|
17
17
|
let raw
|
|
18
18
|
|