@verana-labs/vs-agent-client 2.0.0-dev.64 → 2.0.0-dev.66

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.
@@ -1,33 +1,22 @@
1
- import { CredentialTypeService, InvitationService, MessageService, RevocationRegistryService, TrustCredentialService } from './services';
1
+ import { CredentialTypeService, DidcommInvitationsService, InvitationService, MessageService, RevocationRegistryService, TrustCredentialService } from './services';
2
2
  import { ApiVersion } from './types';
3
3
  /**
4
- * `ApiClient` class for easy access to the available endpoints in the Agent Service.
5
- * This class simplifies the interaction with the service by providing methods
6
- * that map the required data and allow straightforward use of the endpoints.
7
- *
8
- * Each method corresponds to an HTTP POST endpoint with a specified route
9
- * within the Express structure. The `ApiClient` class is designed to handle
10
- * events and make requests efficiently.
11
- *
12
- * Usage:
13
- * Extend `ApiClient` in your project and implement specific handlers to
14
- * interact with the available services like message sending and credential management.
4
+ * `ApiClient` gives access to the Admin API of a VS Agent.
15
5
  *
16
6
  * Example:
17
7
  *
18
- * // Initialize ApiClient with the base URL and version
19
8
  * const apiClient = new ApiClient('http://localhost', ApiVersion.V1)
20
- *
21
- * // Example to query available credentials
22
9
  * await apiClient.credentialTypes.getAll()
10
+ * await apiClient.messages.send(message)
11
+ * await apiClient.didcomm.invitations.send({ connectionId, label })
23
12
  *
24
- * // Example to send a message
25
- * apiClient.messages.send(message: BaseMessage)
26
- *
27
- * The `ApiClient` class provides easy methods for interacting with:
28
- * - `messages`: Send and manage messages.
29
- * - `credentialTypes`: Query and manage credential types.
30
- * - `revocationRegistries`: Query and manage the revocation registry for credential definitions.
13
+ * Services:
14
+ * - `messages`: send v1 messages.
15
+ * - `credentialTypes`: create, import, export and list credential types.
16
+ * - `revocationRegistries`: create and list revocation registries.
17
+ * - `invitations`: create invitation codes.
18
+ * - `trustCredentials`: issue and revoke Verifiable Trust credentials.
19
+ * - `didcomm`: v2 DIDComm modules. `didcomm.invitations` sends an invitation on a connection.
31
20
  */
32
21
  export declare class ApiClient {
33
22
  private baseURL;
@@ -37,5 +26,8 @@ export declare class ApiClient {
37
26
  readonly revocationRegistries: RevocationRegistryService;
38
27
  readonly invitations: InvitationService;
39
28
  readonly trustCredentials: TrustCredentialService;
29
+ readonly didcomm: {
30
+ invitations: DidcommInvitationsService;
31
+ };
40
32
  constructor(baseURL: string, version?: ApiVersion);
41
33
  }
@@ -5,33 +5,22 @@ exports.ApiClient = void 0;
5
5
  const services_1 = require("./services");
6
6
  const types_1 = require("./types");
7
7
  /**
8
- * `ApiClient` class for easy access to the available endpoints in the Agent Service.
9
- * This class simplifies the interaction with the service by providing methods
10
- * that map the required data and allow straightforward use of the endpoints.
11
- *
12
- * Each method corresponds to an HTTP POST endpoint with a specified route
13
- * within the Express structure. The `ApiClient` class is designed to handle
14
- * events and make requests efficiently.
15
- *
16
- * Usage:
17
- * Extend `ApiClient` in your project and implement specific handlers to
18
- * interact with the available services like message sending and credential management.
8
+ * `ApiClient` gives access to the Admin API of a VS Agent.
19
9
  *
20
10
  * Example:
21
11
  *
22
- * // Initialize ApiClient with the base URL and version
23
12
  * const apiClient = new ApiClient('http://localhost', ApiVersion.V1)
24
- *
25
- * // Example to query available credentials
26
13
  * await apiClient.credentialTypes.getAll()
14
+ * await apiClient.messages.send(message)
15
+ * await apiClient.didcomm.invitations.send({ connectionId, label })
27
16
  *
28
- * // Example to send a message
29
- * apiClient.messages.send(message: BaseMessage)
30
- *
31
- * The `ApiClient` class provides easy methods for interacting with:
32
- * - `messages`: Send and manage messages.
33
- * - `credentialTypes`: Query and manage credential types.
34
- * - `revocationRegistries`: Query and manage the revocation registry for credential definitions.
17
+ * Services:
18
+ * - `messages`: send v1 messages.
19
+ * - `credentialTypes`: create, import, export and list credential types.
20
+ * - `revocationRegistries`: create and list revocation registries.
21
+ * - `invitations`: create invitation codes.
22
+ * - `trustCredentials`: issue and revoke Verifiable Trust credentials.
23
+ * - `didcomm`: v2 DIDComm modules. `didcomm.invitations` sends an invitation on a connection.
35
24
  */
36
25
  class ApiClient {
37
26
  constructor(baseURL, version = types_1.ApiVersion.V1) {
@@ -42,6 +31,7 @@ class ApiClient {
42
31
  this.credentialTypes = new services_1.CredentialTypeService(baseURL, version);
43
32
  this.revocationRegistries = new services_1.RevocationRegistryService(baseURL, version);
44
33
  this.trustCredentials = new services_1.TrustCredentialService(baseURL, version);
34
+ this.didcomm = { invitations: new services_1.DidcommInvitationsService(baseURL) };
45
35
  }
46
36
  }
47
37
  exports.ApiClient = ApiClient;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiClient.js","sourceRoot":"","sources":["../src/ApiClient.ts"],"names":[],"mappings":";AAAA,mBAAmB;;;AAEnB,yCAMmB;AACnB,mCAAoC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,SAAS;IAOpB,YACU,OAAe,EACf,UAAsB,kBAAU,CAAC,EAAE;QADnC,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAA4B;QAE3C,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,yBAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,eAAe,GAAG,IAAI,gCAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClE,IAAI,CAAC,oBAAoB,GAAG,IAAI,oCAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC3E,IAAI,CAAC,gBAAgB,GAAG,IAAI,iCAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;CACF;AAjBD,8BAiBC"}
1
+ {"version":3,"file":"ApiClient.js","sourceRoot":"","sources":["../src/ApiClient.ts"],"names":[],"mappings":";AAAA,mBAAmB;;;AAEnB,yCAOmB;AACnB,mCAAoC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,SAAS;IAQpB,YACU,OAAe,EACf,UAAsB,kBAAU,CAAC,EAAE;QADnC,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAA4B;QAE3C,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,yBAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,eAAe,GAAG,IAAI,gCAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClE,IAAI,CAAC,oBAAoB,GAAG,IAAI,oCAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC3E,IAAI,CAAC,gBAAgB,GAAG,IAAI,iCAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACpE,IAAI,CAAC,OAAO,GAAG,EAAE,WAAW,EAAE,IAAI,oCAAyB,CAAC,OAAO,CAAC,EAAE,CAAA;IACxE,CAAC;CACF;AAnBD,8BAmBC"}
@@ -0,0 +1,10 @@
1
+ import { SendInvitationOptions, SendInvitationResult } from '@verana-labs/vs-agent-model';
2
+ /**
3
+ * `DidcommInvitationsService` sends an Out-of-Band invitation on a connection.
4
+ * The invitation opens a sub-connection to this agent or a referral to a different service.
5
+ */
6
+ export declare class DidcommInvitationsService {
7
+ private url;
8
+ constructor(baseURL: string);
9
+ send(options: SendInvitationOptions): Promise<SendInvitationResult>;
10
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DidcommInvitationsService = void 0;
4
+ const tslog_1 = require("tslog");
5
+ const logger = new tslog_1.Logger({
6
+ name: 'DidcommInvitationsService',
7
+ type: 'pretty',
8
+ prettyLogTemplate: '{{logLevelName}} [{{name}}]: ',
9
+ });
10
+ /**
11
+ * `DidcommInvitationsService` sends an Out-of-Band invitation on a connection.
12
+ * The invitation opens a sub-connection to this agent or a referral to a different service.
13
+ */
14
+ class DidcommInvitationsService {
15
+ constructor(baseURL) {
16
+ this.url = `${baseURL.replace(/\/$/, '')}/v2/didcomm/invitations`;
17
+ }
18
+ async send(options) {
19
+ logger.info(`send(): ${JSON.stringify(options)}`);
20
+ const response = await fetch(this.url, {
21
+ method: 'POST',
22
+ body: JSON.stringify(options),
23
+ headers: { accept: 'application/json', 'Content-Type': 'application/json' },
24
+ });
25
+ if (!response.ok)
26
+ throw new Error(`Cannot send invitation: status ${response.status}`);
27
+ return (await response.json());
28
+ }
29
+ }
30
+ exports.DidcommInvitationsService = DidcommInvitationsService;
31
+ //# sourceMappingURL=DidcommInvitationsService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DidcommInvitationsService.js","sourceRoot":"","sources":["../../src/services/DidcommInvitationsService.ts"],"names":[],"mappings":";;;AACA,iCAA8B;AAE9B,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC;IACxB,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,+BAA+B;CACnD,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAa,yBAAyB;IAGpC,YAAY,OAAe;QACzB,IAAI,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAA;IACnE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAA8B;QAC9C,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAEjD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACrC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC7B,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAC5E,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;QAEtF,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAyB,CAAA;IACxD,CAAC;CACF;AAnBD,8DAmBC"}
@@ -1,4 +1,5 @@
1
1
  export * from './CredentialTypeService';
2
+ export * from './DidcommInvitationsService';
2
3
  export * from './InvitationService';
3
4
  export * from './MessageService';
4
5
  export * from './RevocationRegistryService';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CredentialTypeService"), exports);
18
+ __exportStar(require("./DidcommInvitationsService"), exports);
18
19
  __exportStar(require("./InvitationService"), exports);
19
20
  __exportStar(require("./MessageService"), exports);
20
21
  __exportStar(require("./RevocationRegistryService"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,sDAAmC;AACnC,mDAAgC;AAChC,8DAA2C;AAC3C,2DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,8DAA2C;AAC3C,sDAAmC;AACnC,mDAAgC;AAChC,8DAA2C;AAC3C,2DAAwC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@verana-labs/vs-agent-client",
3
3
  "main": "build/index",
4
4
  "types": "build/index",
5
- "version": "2.0.0-dev.64",
5
+ "version": "2.0.0-dev.66",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/verana-labs/vs-agent"
@@ -19,7 +19,7 @@
19
19
  "class-validator": "0.14.1",
20
20
  "express": "^4.18.1",
21
21
  "tslog": "^4.8.2",
22
- "@verana-labs/vs-agent-model": "2.0.0-dev.64"
22
+ "@verana-labs/vs-agent-model": "2.0.0-dev.66"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@nestjs/common": "^10.0.0",