@veramo/cli 5.0.1-next.13 → 5.0.1-next.14
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/build/lib/agentCreator.d.ts +1 -1
- package/build/lib/agentCreator.js +1 -1
- package/build/lib/objectCreator.d.ts +11 -9
- package/build/lib/objectCreator.d.ts.map +1 -1
- package/build/lib/objectCreator.js +10 -8
- package/build/lib/objectCreator.js.map +1 -1
- package/build/setup.d.ts +9 -1
- package/build/setup.d.ts.map +1 -1
- package/build/setup.js +22 -6
- package/build/setup.js.map +1 -1
- package/default/default.yml +24 -20
- package/package.json +25 -24
- package/src/__tests__/cli.test.ts +17 -10
- package/src/lib/agentCreator.ts +1 -1
- package/src/lib/objectCreator.ts +11 -9
- package/src/setup.ts +22 -6
|
@@ -6,7 +6,7 @@ import { TAgent, IPluginMethodMap } from '@veramo/core-types';
|
|
|
6
6
|
* @see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for details on
|
|
7
7
|
* the configuration options.
|
|
8
8
|
*
|
|
9
|
-
* @beta
|
|
9
|
+
* @beta - This API may change without a major version bump
|
|
10
10
|
*/
|
|
11
11
|
export declare function createAgentFromConfig<T extends IPluginMethodMap>(config: object): Promise<TAgent<T>>;
|
|
12
12
|
//# sourceMappingURL=agentCreator.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { createObjects } from './objectCreator.js';
|
|
|
6
6
|
* @see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for details on
|
|
7
7
|
* the configuration options.
|
|
8
8
|
*
|
|
9
|
-
* @beta
|
|
9
|
+
* @beta - This API may change without a major version bump
|
|
10
10
|
*/
|
|
11
11
|
export async function createAgentFromConfig(config) {
|
|
12
12
|
// @ts-ignore
|
|
@@ -8,30 +8,32 @@
|
|
|
8
8
|
*
|
|
9
9
|
* The config can contain references (`$ref`) to other objects within using JSON pointers.
|
|
10
10
|
* Example:
|
|
11
|
-
* ```
|
|
11
|
+
* ```json
|
|
12
12
|
* {
|
|
13
|
-
* rpcUrl: "http://localhost:8545",
|
|
14
|
-
* endpoint: {
|
|
15
|
-
* url: {
|
|
13
|
+
* "rpcUrl": "http://localhost:8545",
|
|
14
|
+
* "endpoint": {
|
|
15
|
+
* "url": {
|
|
16
16
|
* "$ref": "/rpcUrl"
|
|
17
17
|
* }
|
|
18
18
|
* }
|
|
19
19
|
* }
|
|
20
|
+
* ```
|
|
20
21
|
*
|
|
21
22
|
* The config object can also contain references to NPM modules using the `$require` property.
|
|
22
23
|
* Example:
|
|
23
|
-
* ```
|
|
24
|
+
* ```json
|
|
24
25
|
* {
|
|
25
|
-
* agent: {
|
|
26
|
+
* "agent": {
|
|
26
27
|
* "$require": "@veramo/core#Agent",
|
|
27
28
|
* "$args": {
|
|
28
|
-
* plugins: [
|
|
29
|
+
* "plugins": [
|
|
29
30
|
* { "$require": "@veramo/did-comm#DIDComm" },
|
|
30
31
|
* ]
|
|
31
32
|
* }
|
|
32
33
|
* }
|
|
33
34
|
* }
|
|
34
35
|
* ```
|
|
36
|
+
*
|
|
35
37
|
* Environment variables can also be specified using the `$env` property.
|
|
36
38
|
*
|
|
37
39
|
* @see Please see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
* @param config - The configuration object
|
|
41
43
|
* @param pointers - A map of JSON pointers to objects within that config that you wish to create
|
|
42
44
|
*
|
|
43
|
-
* @beta
|
|
45
|
+
* @beta - This API may change without a major version bump
|
|
44
46
|
*/
|
|
45
|
-
export declare function createObjects(config: object, pointers: Record<string, string>): Promise<any
|
|
47
|
+
export declare function createObjects(config: object, pointers: Record<string, string>): Promise<Record<string, any>>;
|
|
46
48
|
//# sourceMappingURL=objectCreator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectCreator.d.ts","sourceRoot":"","sources":["../../src/lib/objectCreator.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"objectCreator.d.ts","sourceRoot":"","sources":["../../src/lib/objectCreator.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAqGlH"}
|
|
@@ -11,30 +11,32 @@ import { resolve } from 'path';
|
|
|
11
11
|
*
|
|
12
12
|
* The config can contain references (`$ref`) to other objects within using JSON pointers.
|
|
13
13
|
* Example:
|
|
14
|
-
* ```
|
|
14
|
+
* ```json
|
|
15
15
|
* {
|
|
16
|
-
* rpcUrl: "http://localhost:8545",
|
|
17
|
-
* endpoint: {
|
|
18
|
-
* url: {
|
|
16
|
+
* "rpcUrl": "http://localhost:8545",
|
|
17
|
+
* "endpoint": {
|
|
18
|
+
* "url": {
|
|
19
19
|
* "$ref": "/rpcUrl"
|
|
20
20
|
* }
|
|
21
21
|
* }
|
|
22
22
|
* }
|
|
23
|
+
* ```
|
|
23
24
|
*
|
|
24
25
|
* The config object can also contain references to NPM modules using the `$require` property.
|
|
25
26
|
* Example:
|
|
26
|
-
* ```
|
|
27
|
+
* ```json
|
|
27
28
|
* {
|
|
28
|
-
* agent: {
|
|
29
|
+
* "agent": {
|
|
29
30
|
* "$require": "@veramo/core#Agent",
|
|
30
31
|
* "$args": {
|
|
31
|
-
* plugins: [
|
|
32
|
+
* "plugins": [
|
|
32
33
|
* { "$require": "@veramo/did-comm#DIDComm" },
|
|
33
34
|
* ]
|
|
34
35
|
* }
|
|
35
36
|
* }
|
|
36
37
|
* }
|
|
37
38
|
* ```
|
|
39
|
+
*
|
|
38
40
|
* Environment variables can also be specified using the `$env` property.
|
|
39
41
|
*
|
|
40
42
|
* @see Please see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for
|
|
@@ -43,7 +45,7 @@ import { resolve } from 'path';
|
|
|
43
45
|
* @param config - The configuration object
|
|
44
46
|
* @param pointers - A map of JSON pointers to objects within that config that you wish to create
|
|
45
47
|
*
|
|
46
|
-
* @beta
|
|
48
|
+
* @beta - This API may change without a major version bump
|
|
47
49
|
*/
|
|
48
50
|
export async function createObjects(config, pointers) {
|
|
49
51
|
const objects = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectCreator.js","sourceRoot":"","sources":["../../src/lib/objectCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B
|
|
1
|
+
{"version":3,"file":"objectCreator.js","sourceRoot":"","sources":["../../src/lib/objectCreator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc,EAAE,QAAgC;IAClF,MAAM,OAAO,GAAG,EAAE,CAAA;IAElB,KAAK,UAAU,WAAW,CAAC,KAAU;QACnC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,MAAM,QAAQ,GAAG,EAAE,CAAA;YACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,QAAQ,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;aACvC;YACD,OAAO,QAAQ,CAAA;SAChB;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE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AM,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACzC,IAAI,CAAC,YAAY;gBAAE,MAAM,KAAK,CAAC,qBAAqB,GAAG,OAAO,CAAC,CAAA;YAC/D,IAAI;gBACF,IAAI,MAAM,CAAA;gBACV,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE;oBAC5B,MAAM,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAA;iBAC9C;qBAAM,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;oBAC/B,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;iBAC3C;qBAAM;oBACL,MAAM,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,CAAA;iBACzC;gBACD,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;gBAC7B,OAAO,MAAM,CAAA;aACd;YAAC,OAAO,CAAM,EAAE;gBACf,MAAM,KAAK,CAAC,CAAC,CAAC,OAAO,GAAG,wCAAwC,GAAG,OAAO,CAAC,CAAA;aAC5E;SACF;IACH,CAAC;IAED,MAAM,MAAM,GAAQ,EAAE,CAAA;IACtB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QACvC,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAChC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;SACrD;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/build/setup.d.ts
CHANGED
|
@@ -2,7 +2,15 @@ import { ICredentialPlugin, IDataStore, IDataStoreORM, IDIDManager, IKeyManager,
|
|
|
2
2
|
import { ISelectiveDisclosure } from '@veramo/selective-disclosure';
|
|
3
3
|
import { IDIDComm } from '@veramo/did-comm';
|
|
4
4
|
import { IDIDDiscovery } from '@veramo/did-discovery';
|
|
5
|
-
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
/**
|
|
7
|
+
* Parses a yaml config file and returns a config object
|
|
8
|
+
* @param filePath
|
|
9
|
+
*/
|
|
10
|
+
export declare const getConfig: (filePath: fs.PathLike) => Promise<{
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
version?: number | undefined;
|
|
13
|
+
}>;
|
|
6
14
|
export type EnabledInterfaces = IDIDManager & IKeyManager & IDataStore & IDataStoreORM & IResolver & IMessageHandler & IDIDComm & ICredentialPlugin & ISelectiveDisclosure & IDIDDiscovery;
|
|
7
15
|
export type ConfiguredAgent = TAgent<EnabledInterfaces>;
|
|
8
16
|
export declare function getAgent(fileName: string): Promise<ConfiguredAgent>;
|
package/build/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,SAAS,EACT,MAAM,EACP,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,SAAS,EACT,MAAM,EACP,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAGrD,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB;;;GAGG;AACH,eAAO,MAAM,SAAS,aAAoB,GAAG,QAAQ;;;EA0BpD,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,GACzC,WAAW,GACX,UAAU,GACV,aAAa,GACb,SAAS,GACT,eAAe,GACf,QAAQ,GACR,iBAAiB,GACjB,oBAAoB,GACpB,aAAa,CAAA;AAEf,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA;AAEvD,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAOzE"}
|
package/build/setup.js
CHANGED
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
import yaml from 'yaml';
|
|
2
2
|
import { createAgentFromConfig } from './lib/agentCreator.js';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Parses a yaml config file and returns a config object
|
|
6
|
+
* @param filePath
|
|
7
|
+
*/
|
|
8
|
+
export const getConfig = async (filePath) => {
|
|
9
|
+
let fileContent;
|
|
10
|
+
// read file async
|
|
11
|
+
try {
|
|
12
|
+
fileContent = await fs.promises.readFile(filePath, 'utf8');
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
console.log('Config file not found: ' + filePath);
|
|
7
16
|
console.log('Use "veramo config create" to create one');
|
|
8
17
|
process.exit(1);
|
|
9
18
|
}
|
|
10
|
-
|
|
19
|
+
let config;
|
|
20
|
+
try {
|
|
21
|
+
config = yaml.parse(fileContent, { prettyErrors: true });
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error(`Unable to parse config file: ${e.message} ${e.linePos}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
11
27
|
if (config?.version != 3) {
|
|
12
|
-
console.
|
|
28
|
+
console.error('Unsupported configuration file version:', config.version);
|
|
13
29
|
process.exit(1);
|
|
14
30
|
}
|
|
15
31
|
return config;
|
|
16
32
|
};
|
|
17
33
|
export async function getAgent(fileName) {
|
|
18
34
|
try {
|
|
19
|
-
return await createAgentFromConfig(getConfig(fileName));
|
|
35
|
+
return await createAgentFromConfig(await getConfig(fileName));
|
|
20
36
|
}
|
|
21
37
|
catch (e) {
|
|
22
38
|
console.log('Unable to create agent from ' + fileName + '.', e.message);
|
package/build/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAcvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,MAAM,CAAC,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAcvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,QAAqB,EAAmD,EAAE;IACxG,IAAI,WAAmB,CAAA;IAEvB,kBAAkB;IAClB,IAAI;QACF,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;KAC3D;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,yBAAyB,GAAG,QAAQ,CAAC,CAAA;QACjD,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAA;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IAED,IAAI,MAAM,CAAA;IAEV,IAAI;QACF,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;KACzD;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IAED,IAAI,MAAM,EAAE,OAAO,IAAI,CAAC,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAeD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,QAAgB;IAC7C,IAAI;QACF,OAAO,MAAM,qBAAqB,CAAoB,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAA;KACjF;IAAC,OAAO,CAAM,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,8BAA8B,GAAG,QAAQ,GAAG,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;AACH,CAAC"}
|
package/default/default.yml
CHANGED
|
@@ -160,25 +160,24 @@ messageHandler:
|
|
|
160
160
|
didResolver:
|
|
161
161
|
$require: '@veramo/did-resolver#DIDResolverPlugin'
|
|
162
162
|
$args:
|
|
163
|
-
-
|
|
164
|
-
$
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
$ref: /universal-resolver
|
|
163
|
+
- ethr:
|
|
164
|
+
$ref: /ethr-did-resolver
|
|
165
|
+
web:
|
|
166
|
+
$ref: /web-did-resolver
|
|
167
|
+
key:
|
|
168
|
+
$ref: /did-key-resolver
|
|
169
|
+
pkh:
|
|
170
|
+
$require: '@veramo/did-provider-pkh?t=function&p=/pkh#getDidPkhResolver'
|
|
171
|
+
3:
|
|
172
|
+
$ref: /3id-did-resolver
|
|
173
|
+
elem:
|
|
174
|
+
$ref: /universal-resolver
|
|
175
|
+
io:
|
|
176
|
+
$ref: /universal-resolver
|
|
177
|
+
ion:
|
|
178
|
+
$ref: /universal-resolver
|
|
179
|
+
sov:
|
|
180
|
+
$ref: /universal-resolver
|
|
182
181
|
|
|
183
182
|
ethr-did-resolver:
|
|
184
183
|
$require: ethr-did-resolver?t=function&p=/ethr#getResolver
|
|
@@ -190,7 +189,7 @@ web-did-resolver:
|
|
|
190
189
|
|
|
191
190
|
ceramic:
|
|
192
191
|
$require: '@ceramicnetwork/http-client#CeramicClient'
|
|
193
|
-
$args:
|
|
192
|
+
$args:
|
|
194
193
|
- 'https://gateway.ceramic.network'
|
|
195
194
|
|
|
196
195
|
3id-did-resolver:
|
|
@@ -259,6 +258,11 @@ didManager:
|
|
|
259
258
|
$require: '@veramo/did-provider-key#KeyDIDProvider'
|
|
260
259
|
$args:
|
|
261
260
|
- defaultKms: local
|
|
261
|
+
did:pkh:
|
|
262
|
+
$require: '@veramo/did-provider-pkh#PkhDIDProvider'
|
|
263
|
+
$args:
|
|
264
|
+
- defaultKms: local
|
|
265
|
+
chainId: 1
|
|
262
266
|
|
|
263
267
|
didDiscovery:
|
|
264
268
|
$require: '@veramo/did-discovery#DIDDiscovery'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veramo/cli",
|
|
3
3
|
"description": "Veramo command line application.",
|
|
4
|
-
"version": "5.0.1-next.
|
|
4
|
+
"version": "5.0.1-next.14+19cccc1f",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./build/cli.d.ts",
|
|
@@ -40,28 +40,29 @@
|
|
|
40
40
|
"@transmute/credentials-context": "^0.7.0-unstable.79",
|
|
41
41
|
"@types/blessed": "^0.1.19",
|
|
42
42
|
"@types/swagger-ui-express": "^4.1.3",
|
|
43
|
-
"@veramo/core": "^5.0.1-next.
|
|
44
|
-
"@veramo/core-types": "^5.0.1-next.
|
|
45
|
-
"@veramo/credential-eip712": "^5.0.1-next.
|
|
46
|
-
"@veramo/credential-ld": "^5.0.1-next.
|
|
47
|
-
"@veramo/credential-w3c": "^5.0.1-next.
|
|
48
|
-
"@veramo/data-store": "^5.0.1-next.
|
|
49
|
-
"@veramo/did-comm": "^5.0.1-next.
|
|
50
|
-
"@veramo/did-discovery": "^5.0.1-next.
|
|
51
|
-
"@veramo/did-jwt": "^5.0.1-next.
|
|
52
|
-
"@veramo/did-manager": "^5.0.1-next.
|
|
53
|
-
"@veramo/did-provider-ethr": "^5.0.1-next.
|
|
54
|
-
"@veramo/did-provider-key": "^5.0.1-next.
|
|
55
|
-
"@veramo/did-provider-
|
|
56
|
-
"@veramo/did-
|
|
57
|
-
"@veramo/
|
|
58
|
-
"@veramo/
|
|
59
|
-
"@veramo/
|
|
60
|
-
"@veramo/
|
|
61
|
-
"@veramo/remote-
|
|
62
|
-
"@veramo/
|
|
63
|
-
"@veramo/
|
|
64
|
-
"@veramo/
|
|
43
|
+
"@veramo/core": "^5.0.1-next.14+19cccc1f",
|
|
44
|
+
"@veramo/core-types": "^5.0.1-next.14+19cccc1f",
|
|
45
|
+
"@veramo/credential-eip712": "^5.0.1-next.14+19cccc1f",
|
|
46
|
+
"@veramo/credential-ld": "^5.0.1-next.14+19cccc1f",
|
|
47
|
+
"@veramo/credential-w3c": "^5.0.1-next.14+19cccc1f",
|
|
48
|
+
"@veramo/data-store": "^5.0.1-next.14+19cccc1f",
|
|
49
|
+
"@veramo/did-comm": "^5.0.1-next.14+19cccc1f",
|
|
50
|
+
"@veramo/did-discovery": "^5.0.1-next.14+19cccc1f",
|
|
51
|
+
"@veramo/did-jwt": "^5.0.1-next.14+19cccc1f",
|
|
52
|
+
"@veramo/did-manager": "^5.0.1-next.14+19cccc1f",
|
|
53
|
+
"@veramo/did-provider-ethr": "^5.0.1-next.14+19cccc1f",
|
|
54
|
+
"@veramo/did-provider-key": "^5.0.1-next.14+19cccc1f",
|
|
55
|
+
"@veramo/did-provider-pkh": "^5.0.1-next.14+19cccc1f",
|
|
56
|
+
"@veramo/did-provider-web": "^5.0.1-next.14+19cccc1f",
|
|
57
|
+
"@veramo/did-resolver": "^5.0.1-next.14+19cccc1f",
|
|
58
|
+
"@veramo/key-manager": "^5.0.1-next.14+19cccc1f",
|
|
59
|
+
"@veramo/kms-local": "^5.0.1-next.14+19cccc1f",
|
|
60
|
+
"@veramo/message-handler": "^5.0.1-next.14+19cccc1f",
|
|
61
|
+
"@veramo/remote-client": "^5.0.1-next.14+19cccc1f",
|
|
62
|
+
"@veramo/remote-server": "^5.0.1-next.14+19cccc1f",
|
|
63
|
+
"@veramo/selective-disclosure": "^5.0.1-next.14+19cccc1f",
|
|
64
|
+
"@veramo/url-handler": "^5.0.1-next.14+19cccc1f",
|
|
65
|
+
"@veramo/utils": "^5.0.1-next.14+19cccc1f",
|
|
65
66
|
"blessed": "^0.1.81",
|
|
66
67
|
"commander": "^10.0.0",
|
|
67
68
|
"console-table-printer": "^2.10.0",
|
|
@@ -133,5 +134,5 @@
|
|
|
133
134
|
"node_modules",
|
|
134
135
|
"src"
|
|
135
136
|
],
|
|
136
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "19cccc1f394a63505fc40d57a7c1d26d21abc3e5"
|
|
137
138
|
}
|
|
@@ -3,8 +3,6 @@ import { jest } from '@jest/globals'
|
|
|
3
3
|
import { createObjects } from '../lib/objectCreator'
|
|
4
4
|
import { getConfig } from '../setup'
|
|
5
5
|
|
|
6
|
-
jest.useFakeTimers()
|
|
7
|
-
|
|
8
6
|
describe('cli version', () => {
|
|
9
7
|
const writeMock = jest.fn()
|
|
10
8
|
|
|
@@ -18,6 +16,22 @@ describe('cli version', () => {
|
|
|
18
16
|
jest.clearAllMocks()
|
|
19
17
|
})
|
|
20
18
|
|
|
19
|
+
it('should load the dbConnection', async () => {
|
|
20
|
+
const { dbConnection } = await createObjects(await getConfig('./packages/cli/default/default.yml'), {
|
|
21
|
+
dbConnection: '/dbConnection',
|
|
22
|
+
})
|
|
23
|
+
expect(dbConnection).toBeDefined()
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// this seems to fail because of an incompatibility between jest and the `multiformats@11` transitive dependency
|
|
27
|
+
it.skip('should load the agent', async () => {
|
|
28
|
+
const { agent } = await createObjects(await getConfig('./packages/cli/default/default.yml'), {
|
|
29
|
+
agent: '/agent',
|
|
30
|
+
})
|
|
31
|
+
expect(agent).toBeDefined()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
// this seems to fail because of some timing issues or an incompatibility with the `chalk` transitive dependency
|
|
21
35
|
it.skip('should list version number', async () => {
|
|
22
36
|
expect(() => {
|
|
23
37
|
// veramo.parse(['--version'], { from: 'user' })
|
|
@@ -25,14 +39,7 @@ describe('cli version', () => {
|
|
|
25
39
|
expect(writeMock).toHaveBeenCalledWith(expect.stringMatching(/^\d\.\d\.\d\n?$/))
|
|
26
40
|
})
|
|
27
41
|
|
|
28
|
-
|
|
29
|
-
// this seems to fail because of some timing issues or an incompatibility with the `chalk` transitive dependency
|
|
30
|
-
// all other tests that need to load the dbConnection fail similarly
|
|
31
|
-
const res = await createObjects(getConfig('./packages/cli/default/default.yml'), {
|
|
32
|
-
my: '/dbConnection',
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
|
|
42
|
+
// this seems to fail because of some timing issues or an incompatibility with the `chalk` transitive dependency
|
|
36
43
|
it.skip('should check the default config', async () => {
|
|
37
44
|
expect(() => {
|
|
38
45
|
// veramo.parse(['config', 'check', '-f', './packages/cli/default/default.yml'], { from: 'user' })
|
package/src/lib/agentCreator.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { createObjects } from './objectCreator.js'
|
|
|
8
8
|
* @see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for details on
|
|
9
9
|
* the configuration options.
|
|
10
10
|
*
|
|
11
|
-
* @beta
|
|
11
|
+
* @beta - This API may change without a major version bump
|
|
12
12
|
*/
|
|
13
13
|
export async function createAgentFromConfig<T extends IPluginMethodMap>(config: object): Promise<TAgent<T>> {
|
|
14
14
|
// @ts-ignore
|
package/src/lib/objectCreator.ts
CHANGED
|
@@ -12,30 +12,32 @@ import { resolve } from 'path'
|
|
|
12
12
|
*
|
|
13
13
|
* The config can contain references (`$ref`) to other objects within using JSON pointers.
|
|
14
14
|
* Example:
|
|
15
|
-
* ```
|
|
15
|
+
* ```json
|
|
16
16
|
* {
|
|
17
|
-
* rpcUrl: "http://localhost:8545",
|
|
18
|
-
* endpoint: {
|
|
19
|
-
* url: {
|
|
17
|
+
* "rpcUrl": "http://localhost:8545",
|
|
18
|
+
* "endpoint": {
|
|
19
|
+
* "url": {
|
|
20
20
|
* "$ref": "/rpcUrl"
|
|
21
21
|
* }
|
|
22
22
|
* }
|
|
23
23
|
* }
|
|
24
|
+
* ```
|
|
24
25
|
*
|
|
25
26
|
* The config object can also contain references to NPM modules using the `$require` property.
|
|
26
27
|
* Example:
|
|
27
|
-
* ```
|
|
28
|
+
* ```json
|
|
28
29
|
* {
|
|
29
|
-
* agent: {
|
|
30
|
+
* "agent": {
|
|
30
31
|
* "$require": "@veramo/core#Agent",
|
|
31
32
|
* "$args": {
|
|
32
|
-
* plugins: [
|
|
33
|
+
* "plugins": [
|
|
33
34
|
* { "$require": "@veramo/did-comm#DIDComm" },
|
|
34
35
|
* ]
|
|
35
36
|
* }
|
|
36
37
|
* }
|
|
37
38
|
* }
|
|
38
39
|
* ```
|
|
40
|
+
*
|
|
39
41
|
* Environment variables can also be specified using the `$env` property.
|
|
40
42
|
*
|
|
41
43
|
* @see Please see {@link https://veramo.io/docs/veramo_agent/configuration_internals | Configuration Internals} for
|
|
@@ -44,9 +46,9 @@ import { resolve } from 'path'
|
|
|
44
46
|
* @param config - The configuration object
|
|
45
47
|
* @param pointers - A map of JSON pointers to objects within that config that you wish to create
|
|
46
48
|
*
|
|
47
|
-
* @beta
|
|
49
|
+
* @beta - This API may change without a major version bump
|
|
48
50
|
*/
|
|
49
|
-
export async function createObjects(config: object, pointers: Record<string, string>): Promise<any
|
|
51
|
+
export async function createObjects(config: object, pointers: Record<string, string>): Promise<Record<string, any>> {
|
|
50
52
|
const objects = {}
|
|
51
53
|
|
|
52
54
|
async function resolveRefs(input: any): Promise<any> {
|
package/src/setup.ts
CHANGED
|
@@ -16,17 +16,33 @@ import { createAgentFromConfig } from './lib/agentCreator.js'
|
|
|
16
16
|
|
|
17
17
|
import fs from 'fs'
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Parses a yaml config file and returns a config object
|
|
21
|
+
* @param filePath
|
|
22
|
+
*/
|
|
23
|
+
export const getConfig = async (filePath: fs.PathLike): Promise<{ version?: number; [x: string]: any }> => {
|
|
24
|
+
let fileContent: string
|
|
25
|
+
|
|
26
|
+
// read file async
|
|
27
|
+
try {
|
|
28
|
+
fileContent = await fs.promises.readFile(filePath, 'utf8')
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.log('Config file not found: ' + filePath)
|
|
22
31
|
console.log('Use "veramo config create" to create one')
|
|
23
32
|
process.exit(1)
|
|
24
33
|
}
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
let config
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
config = yaml.parse(fileContent, { prettyErrors: true })
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.error(`Unable to parse config file: ${e.message} ${e.linePos}`)
|
|
41
|
+
process.exit(1)
|
|
42
|
+
}
|
|
27
43
|
|
|
28
44
|
if (config?.version != 3) {
|
|
29
|
-
console.
|
|
45
|
+
console.error('Unsupported configuration file version:', config.version)
|
|
30
46
|
process.exit(1)
|
|
31
47
|
}
|
|
32
48
|
return config
|
|
@@ -47,7 +63,7 @@ export type ConfiguredAgent = TAgent<EnabledInterfaces>
|
|
|
47
63
|
|
|
48
64
|
export async function getAgent(fileName: string): Promise<ConfiguredAgent> {
|
|
49
65
|
try {
|
|
50
|
-
return await createAgentFromConfig<EnabledInterfaces>(getConfig(fileName))
|
|
66
|
+
return await createAgentFromConfig<EnabledInterfaces>(await getConfig(fileName))
|
|
51
67
|
} catch (e: any) {
|
|
52
68
|
console.log('Unable to create agent from ' + fileName + '.', e.message)
|
|
53
69
|
process.exit(1)
|