@veramo/cli 4.3.0 → 4.3.1-next.10
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 +32 -69
- 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.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 +21 -28
- 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 +34 -71
- package/build/presentation.js.map +1 -1
- package/build/sdr.js +50 -68
- package/build/sdr.js.map +1 -1
- package/build/server.js +11 -25
- package/build/server.js.map +1 -1
- package/build/setup.d.ts +0 -1
- 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.d.ts.map +1 -1
- package/build/version.js +6 -5
- package/build/version.js.map +1 -1
- package/default/default.yml +1 -1
- package/package.json +37 -30
- package/src/cli.ts +15 -14
- package/src/config.ts +5 -4
- package/src/credential.ts +3 -3
- package/src/dev.ts +8 -3
- package/src/did.ts +1 -1
- package/src/discover.ts +1 -1
- package/src/execute.ts +4 -4
- package/src/explore/credentials.ts +3 -3
- package/src/explore/index.ts +4 -3
- 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 +1 -1
- package/src/lib/objectCreator.ts +14 -14
- package/src/message.ts +2 -2
- package/src/presentation.ts +2 -2
- package/src/sdr.ts +3 -3
- package/src/server.ts +3 -3
- package/src/setup.ts +2 -3
- package/src/version.ts +6 -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.3.
|
|
4
|
+
"version": "4.3.1-next.10+7dc201d1",
|
|
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,31 +15,32 @@
|
|
|
14
15
|
"update-veramo-latest": "pnpm 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 @veramo/credential-eip712@latest @veramo/utils@latest"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
|
-
"@microsoft/api-extractor": "^7.33.
|
|
18
|
-
"@microsoft/api-extractor-model": "^7.25.
|
|
18
|
+
"@microsoft/api-extractor": "^7.33.8",
|
|
19
|
+
"@microsoft/api-extractor-model": "^7.25.3",
|
|
20
|
+
"@transmute/credentials-context": "^0.7.0-unstable.79",
|
|
19
21
|
"@types/blessed": "^0.1.19",
|
|
20
22
|
"@types/swagger-ui-express": "^4.1.3",
|
|
21
|
-
"@veramo/core": "^4.3.
|
|
22
|
-
"@veramo/credential-eip712": "^4.3.
|
|
23
|
-
"@veramo/credential-ld": "^4.3.
|
|
24
|
-
"@veramo/credential-w3c": "^4.3.
|
|
25
|
-
"@veramo/data-store": "^4.3.
|
|
26
|
-
"@veramo/did-comm": "^4.3.
|
|
27
|
-
"@veramo/did-discovery": "^4.3.
|
|
28
|
-
"@veramo/did-jwt": "^4.3.
|
|
29
|
-
"@veramo/did-manager": "^4.3.
|
|
30
|
-
"@veramo/did-provider-ethr": "^4.3.
|
|
31
|
-
"@veramo/did-provider-key": "^4.3.
|
|
32
|
-
"@veramo/did-provider-web": "^4.3.
|
|
33
|
-
"@veramo/did-resolver": "^4.3.
|
|
34
|
-
"@veramo/key-manager": "^4.3.
|
|
35
|
-
"@veramo/kms-local": "^4.3.
|
|
36
|
-
"@veramo/message-handler": "^4.3.
|
|
37
|
-
"@veramo/remote-client": "^4.3.
|
|
38
|
-
"@veramo/remote-server": "^4.3.
|
|
39
|
-
"@veramo/selective-disclosure": "^4.3.
|
|
40
|
-
"@veramo/url-handler": "^4.3.
|
|
41
|
-
"@veramo/utils": "^4.3.
|
|
23
|
+
"@veramo/core": "^4.3.1-next.10+7dc201d1",
|
|
24
|
+
"@veramo/credential-eip712": "^4.3.1-next.10+7dc201d1",
|
|
25
|
+
"@veramo/credential-ld": "^4.3.1-next.10+7dc201d1",
|
|
26
|
+
"@veramo/credential-w3c": "^4.3.1-next.10+7dc201d1",
|
|
27
|
+
"@veramo/data-store": "^4.3.1-next.10+7dc201d1",
|
|
28
|
+
"@veramo/did-comm": "^4.3.1-next.10+7dc201d1",
|
|
29
|
+
"@veramo/did-discovery": "^4.3.1-next.10+7dc201d1",
|
|
30
|
+
"@veramo/did-jwt": "^4.3.1-next.10+7dc201d1",
|
|
31
|
+
"@veramo/did-manager": "^4.3.1-next.10+7dc201d1",
|
|
32
|
+
"@veramo/did-provider-ethr": "^4.3.1-next.10+7dc201d1",
|
|
33
|
+
"@veramo/did-provider-key": "^4.3.1-next.10+7dc201d1",
|
|
34
|
+
"@veramo/did-provider-web": "^4.3.1-next.10+7dc201d1",
|
|
35
|
+
"@veramo/did-resolver": "^4.3.1-next.10+7dc201d1",
|
|
36
|
+
"@veramo/key-manager": "^4.3.1-next.10+7dc201d1",
|
|
37
|
+
"@veramo/kms-local": "^4.3.1-next.10+7dc201d1",
|
|
38
|
+
"@veramo/message-handler": "^4.3.1-next.10+7dc201d1",
|
|
39
|
+
"@veramo/remote-client": "^4.3.1-next.10+7dc201d1",
|
|
40
|
+
"@veramo/remote-server": "^4.3.1-next.10+7dc201d1",
|
|
41
|
+
"@veramo/selective-disclosure": "^4.3.1-next.10+7dc201d1",
|
|
42
|
+
"@veramo/url-handler": "^4.3.1-next.10+7dc201d1",
|
|
43
|
+
"@veramo/utils": "^4.3.1-next.10+7dc201d1",
|
|
42
44
|
"blessed": "^0.1.81",
|
|
43
45
|
"commander": "^9.0.0",
|
|
44
46
|
"console-table-printer": "^2.10.0",
|
|
@@ -53,8 +55,8 @@
|
|
|
53
55
|
"express-handlebars": "^6.0.2",
|
|
54
56
|
"fuzzy": "^0.1.3",
|
|
55
57
|
"handlebars": "^4.7.6",
|
|
56
|
-
"inquirer": "^
|
|
57
|
-
"inquirer-autocomplete-prompt": "^
|
|
58
|
+
"inquirer": "^9.1.4",
|
|
59
|
+
"inquirer-autocomplete-prompt": "^3.0.0",
|
|
58
60
|
"json-schema": "^0.4.0",
|
|
59
61
|
"json5": "^2.2.0",
|
|
60
62
|
"jsonpointer": "^5.0.0",
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
"qrcode-terminal": "^0.12.0",
|
|
67
69
|
"sqlite3": "^5.0.8",
|
|
68
70
|
"swagger-ui-express": "^4.6.0",
|
|
69
|
-
"ts-json-schema-generator": "^1.
|
|
71
|
+
"ts-json-schema-generator": "^1.2.0",
|
|
70
72
|
"typeorm": "^0.3.10",
|
|
71
73
|
"url-parse": "^1.5.4",
|
|
72
74
|
"web-did-resolver": "^2.0.21",
|
|
@@ -76,8 +78,8 @@
|
|
|
76
78
|
"devDependencies": {
|
|
77
79
|
"@types/debug": "4.1.7",
|
|
78
80
|
"@types/express": "4.17.15",
|
|
79
|
-
"@types/inquirer": "
|
|
80
|
-
"@types/node-fetch": "
|
|
81
|
+
"@types/inquirer": "9.0.3",
|
|
82
|
+
"@types/node-fetch": "3.0.3",
|
|
81
83
|
"@types/passport-http-bearer": "1.0.37",
|
|
82
84
|
"@types/url-parse": "1.4.8",
|
|
83
85
|
"@types/ws": "8.5.4",
|
|
@@ -105,5 +107,10 @@
|
|
|
105
107
|
],
|
|
106
108
|
"license": "Apache-2.0",
|
|
107
109
|
"keywords": [],
|
|
108
|
-
"
|
|
110
|
+
"type": "module",
|
|
111
|
+
"moduleDirectories": [
|
|
112
|
+
"node_modules",
|
|
113
|
+
"src"
|
|
114
|
+
],
|
|
115
|
+
"gitHead": "7dc201d17bfbdcd5dd51b1e64a67ce203e844604"
|
|
109
116
|
}
|
package/src/cli.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { program } from 'commander'
|
|
2
2
|
import inquirer from 'inquirer'
|
|
3
|
+
import inquirerAutoPrompt from 'inquirer-autocomplete-prompt'
|
|
3
4
|
|
|
4
|
-
inquirer.registerPrompt('autocomplete',
|
|
5
|
+
inquirer.registerPrompt('autocomplete', inquirerAutoPrompt)
|
|
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
|
|
package/src/credential.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
9
|
|
|
10
|
-
|
|
10
|
+
import fuzzy from 'fuzzy'
|
|
11
11
|
|
|
12
12
|
const credential = program.command('credential').description('W3C Verifiable Credential')
|
|
13
13
|
|
package/src/dev.ts
CHANGED
|
@@ -10,7 +10,11 @@ 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 module from "module"
|
|
16
|
+
const requireCjs = module.createRequire(import.meta.url);
|
|
17
|
+
|
|
14
18
|
|
|
15
19
|
interface Method {
|
|
16
20
|
packageName: string
|
|
@@ -109,7 +113,7 @@ dev
|
|
|
109
113
|
process.exitCode = 1
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
const packageConfig =
|
|
116
|
+
const packageConfig = requireCjs(resolve(options.packageConfig))
|
|
113
117
|
const interfaces: any = {}
|
|
114
118
|
|
|
115
119
|
for (const pluginInterfaceName in packageConfig?.veramo?.pluginInterfaces) {
|
|
@@ -125,6 +129,7 @@ dev
|
|
|
125
129
|
path: resolve(entryFile),
|
|
126
130
|
encodeRefs: false,
|
|
127
131
|
additionalProperties: true,
|
|
132
|
+
skipTypeCheck: true
|
|
128
133
|
})
|
|
129
134
|
|
|
130
135
|
const apiModel: ApiModel = new ApiModel()
|
|
@@ -179,7 +184,7 @@ dev
|
|
|
179
184
|
interfaces[pluginInterfaceName] = api
|
|
180
185
|
}
|
|
181
186
|
|
|
182
|
-
writeFileSync(resolve('./plugin.schema.json'), JSON.stringify(interfaces, null, 2))
|
|
187
|
+
writeFileSync(resolve('./src/plugin.schema.json'), JSON.stringify(interfaces, null, 2))
|
|
183
188
|
})
|
|
184
189
|
|
|
185
190
|
dev
|
package/src/did.ts
CHANGED
package/src/discover.ts
CHANGED
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')
|
|
@@ -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,6 +1,7 @@
|
|
|
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')
|
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,5 +1,5 @@
|
|
|
1
1
|
import { TAgent, IPluginMethodMap } from '@veramo/core'
|
|
2
|
-
import { createObjects } from './objectCreator'
|
|
2
|
+
import { createObjects } from './objectCreator.js'
|
|
3
3
|
|
|
4
4
|
export function createAgentFromConfig<T extends IPluginMethodMap>(config: object): TAgent<T> {
|
|
5
5
|
//@ts-ignore
|
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): Promise<any> {
|
|
40
40
|
let object
|
|
41
41
|
// console.log('Requiring', objectConfig['$require'])
|
|
42
42
|
const parsed = parse(objectConfig['$require'], {}, true)
|
|
@@ -51,9 +51,9 @@ export function createObjects(config: object, pointers: Record<string, string>):
|
|
|
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))
|
|
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
package/src/presentation.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
import { readStdin } from './util'
|
|
5
|
+
import { readStdin } from './util.js'
|
|
6
6
|
import * as fs from 'fs'
|
|
7
7
|
import * as json5 from 'json5'
|
|
8
8
|
import { extractIssuer } from '@veramo/utils'
|
package/src/sdr.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ICredentialRequestInput } from '@veramo/selective-disclosure'
|
|
2
|
-
import { getAgent } from './setup'
|
|
2
|
+
import { getAgent } from './setup.js'
|
|
3
3
|
import { program } from 'commander'
|
|
4
4
|
import inquirer from 'inquirer'
|
|
5
5
|
import qrcode from 'qrcode-terminal'
|
|
6
|
-
import { shortDate, shortDid } from './explore/utils'
|
|
6
|
+
import { shortDate, shortDid } from './explore/utils.js'
|
|
7
7
|
import { VerifiableCredential } from '@veramo/core'
|
|
8
8
|
import { asArray, extractIssuer } from '@veramo/utils'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
import fuzzy from 'fuzzy'
|
|
11
11
|
|
|
12
12
|
const sdr = program.command('sdr').description('Selective Disclosure Request')
|
|
13
13
|
|
package/src/server.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import express from 'express'
|
|
2
2
|
import { program } from 'commander'
|
|
3
|
-
import { getConfig } from './setup'
|
|
4
|
-
import { createObjects } from './lib/objectCreator'
|
|
3
|
+
import { getConfig } from './setup.js'
|
|
4
|
+
import { createObjects } from './lib/objectCreator.js'
|
|
5
5
|
|
|
6
6
|
program
|
|
7
7
|
.command('server')
|
|
@@ -13,7 +13,7 @@ program
|
|
|
13
13
|
let server: any
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
const config = createObjects(getConfig(program.opts().config), { server: '/server' })
|
|
16
|
+
const config = await createObjects(getConfig(program.opts().config), { server: '/server' })
|
|
17
17
|
server = config.server
|
|
18
18
|
} catch (e: any) {
|
|
19
19
|
console.log(e.message)
|
package/src/setup.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'cross-fetch/polyfill'
|
|
2
1
|
import yaml from 'yaml'
|
|
3
2
|
import {
|
|
4
3
|
ICredentialPlugin,
|
|
@@ -13,9 +12,9 @@ import {
|
|
|
13
12
|
import { ISelectiveDisclosure } from '@veramo/selective-disclosure'
|
|
14
13
|
import { IDIDComm } from '@veramo/did-comm'
|
|
15
14
|
import { IDIDDiscovery } from '@veramo/did-discovery'
|
|
16
|
-
import { createAgentFromConfig } from './lib/agentCreator'
|
|
15
|
+
import { createAgentFromConfig } from './lib/agentCreator.js'
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
import fs from 'fs'
|
|
19
18
|
|
|
20
19
|
export const getConfig = (fileName: string): any => {
|
|
21
20
|
if (!fs.existsSync(fileName)) {
|
package/src/version.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { program } from 'commander'
|
|
2
|
-
|
|
3
|
-
const
|
|
2
|
+
import module from "module";
|
|
3
|
+
const requireCjs = module.createRequire(import.meta.url);
|
|
4
|
+
const data = requireCjs("../package.json");
|
|
5
|
+
const { version } = data
|
|
4
6
|
|
|
5
7
|
program.version(version, '-v, --version')
|
|
8
|
+
|
|
9
|
+
export {}
|