@verana-labs/vs-agent-nestjs-client 1.6.0

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.
Files changed (69) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +222 -0
  3. package/build/app.module.d.ts +5 -0
  4. package/build/app.module.js +61 -0
  5. package/build/app.module.js.map +1 -0
  6. package/build/connections/connection.controller.d.ts +10 -0
  7. package/build/connections/connection.controller.js +65 -0
  8. package/build/connections/connection.controller.js.map +1 -0
  9. package/build/connections/connection.entity.d.ts +10 -0
  10. package/build/connections/connection.entity.js +49 -0
  11. package/build/connections/connection.entity.js.map +1 -0
  12. package/build/connections/connection.module.d.ts +5 -0
  13. package/build/connections/connection.module.js +44 -0
  14. package/build/connections/connection.module.js.map +1 -0
  15. package/build/connections/connection.repository.d.ts +27 -0
  16. package/build/connections/connection.repository.js +87 -0
  17. package/build/connections/connection.repository.js.map +1 -0
  18. package/build/connections/connection.service.d.ts +23 -0
  19. package/build/connections/connection.service.js +86 -0
  20. package/build/connections/connection.service.js.map +1 -0
  21. package/build/connections/index.d.ts +5 -0
  22. package/build/connections/index.js +22 -0
  23. package/build/connections/index.js.map +1 -0
  24. package/build/credentials/credential.entity.d.ts +13 -0
  25. package/build/credentials/credential.entity.js +59 -0
  26. package/build/credentials/credential.entity.js.map +1 -0
  27. package/build/credentials/credential.module.d.ts +5 -0
  28. package/build/credentials/credential.module.js +34 -0
  29. package/build/credentials/credential.module.js.map +1 -0
  30. package/build/credentials/credential.service.d.ts +100 -0
  31. package/build/credentials/credential.service.js +290 -0
  32. package/build/credentials/credential.service.js.map +1 -0
  33. package/build/credentials/index.d.ts +4 -0
  34. package/build/credentials/index.js +21 -0
  35. package/build/credentials/index.js.map +1 -0
  36. package/build/credentials/revocation-registry.entity.d.ts +9 -0
  37. package/build/credentials/revocation-registry.entity.js +48 -0
  38. package/build/credentials/revocation-registry.entity.js.map +1 -0
  39. package/build/index.d.ts +9 -0
  40. package/build/index.js +26 -0
  41. package/build/index.js.map +1 -0
  42. package/build/interfaces.d.ts +32 -0
  43. package/build/interfaces.js +3 -0
  44. package/build/interfaces.js.map +1 -0
  45. package/build/jms/index.d.ts +2 -0
  46. package/build/jms/index.js +19 -0
  47. package/build/jms/index.js.map +1 -0
  48. package/build/jms/stats-producer.service.d.ts +41 -0
  49. package/build/jms/stats-producer.service.js +145 -0
  50. package/build/jms/stats-producer.service.js.map +1 -0
  51. package/build/jms/stats.module.d.ts +5 -0
  52. package/build/jms/stats.module.js +34 -0
  53. package/build/jms/stats.module.js.map +1 -0
  54. package/build/messages/index.d.ts +3 -0
  55. package/build/messages/index.js +20 -0
  56. package/build/messages/index.js.map +1 -0
  57. package/build/messages/message.controller.d.ts +13 -0
  58. package/build/messages/message.controller.js +95 -0
  59. package/build/messages/message.controller.js.map +1 -0
  60. package/build/messages/message.module.d.ts +5 -0
  61. package/build/messages/message.module.js +41 -0
  62. package/build/messages/message.module.js.map +1 -0
  63. package/build/messages/message.service.d.ts +19 -0
  64. package/build/messages/message.service.js +103 -0
  65. package/build/messages/message.service.js.map +1 -0
  66. package/build/types.d.ts +65 -0
  67. package/build/types.js +11 -0
  68. package/build/types.js.map +1 -0
  69. package/package.json +53 -0
@@ -0,0 +1,290 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var CredentialService_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.CredentialService = void 0;
17
+ const core_1 = require("@credo-ts/core");
18
+ const common_1 = require("@nestjs/common");
19
+ const typeorm_1 = require("@nestjs/typeorm");
20
+ const vs_agent_client_1 = require("@verana-labs/vs-agent-client");
21
+ const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
22
+ const typeorm_2 = require("typeorm");
23
+ const types_1 = require("../types");
24
+ const credential_entity_1 = require("./credential.entity");
25
+ const revocation_registry_entity_1 = require("./revocation-registry.entity");
26
+ let CredentialService = CredentialService_1 = class CredentialService {
27
+ constructor(credentialRepository, revocationRepository, options) {
28
+ var _a;
29
+ this.credentialRepository = credentialRepository;
30
+ this.revocationRepository = revocationRepository;
31
+ this.options = options;
32
+ this.logger = new common_1.Logger(CredentialService_1.name);
33
+ if (!options.url)
34
+ throw new Error(`For this module to be used the value url must be added`);
35
+ this.url = options.url;
36
+ this.apiVersion = (_a = options.version) !== null && _a !== void 0 ? _a : vs_agent_client_1.ApiVersion.V1;
37
+ this.apiClient = new vs_agent_client_1.ApiClient(this.url, this.apiVersion);
38
+ this.logger.debug(`Initialized with url: ${this.url}, version: ${this.apiVersion}`);
39
+ }
40
+ /**
41
+ * Creates and initializes a credential type (credential definition) with optional revocation registry support.
42
+ *
43
+ * This method specifically handles the creation of credential types/definitions, which serve as templates
44
+ * for issuing actual credentials.
45
+ *
46
+ * When revocation support is enabled:
47
+ * - Two default revocation registries will be created
48
+ * - This ensures continuity if one registry reaches capacity
49
+ *
50
+ * @param attributes - List of attributes that credentials of this type will support
51
+ * @param options.name - Name identifier for the credential type
52
+ * @param options.version - Version of the credential type
53
+ * @param options.supportRevocation - Whether credentials can be revoked
54
+ * @param options.maximumCredentialNumber - Maximum number of credentials that can be issued
55
+ *
56
+ * @returns Promise<void> - Resolves when the credential type and revocation registries are created
57
+ */
58
+ async createType(name, version, attributes, options = {}) {
59
+ const { supportRevocation, maximumCredentialNumber } = options;
60
+ const credentialTypes = await this.apiClient.credentialTypes.getAll();
61
+ const credentialType = credentialTypes.find(credType => credType.name === name && credType.version === version);
62
+ if (!credentialType) {
63
+ const credentialType = await this.apiClient.credentialTypes.create({
64
+ id: core_1.utils.uuid(),
65
+ name,
66
+ version,
67
+ attributes,
68
+ supportRevocation,
69
+ });
70
+ if (supportRevocation) {
71
+ // Both records are created to handle multiple credentials
72
+ await this.createRevocationRegistry(credentialType.id, maximumCredentialNumber);
73
+ await this.createRevocationRegistry(credentialType.id, maximumCredentialNumber);
74
+ }
75
+ }
76
+ }
77
+ /**
78
+ * Sends a credential issuance to the specified connection using the provided claims.
79
+ * This method initiates the issuance process by sending claims as part of a credential
80
+ * to the recipient identified by the connection ID.
81
+ *
82
+ * @param {string} connectionId - The unique identifier of the connection to which the credential
83
+ * will be issued. This represents the recipient of the credential.
84
+ *
85
+ * @param {Claim[]} claims - An array of claims representing the data to be included in the credential.
86
+ * Each claim has a `name` (key) and a `value` (data). Example:
87
+ * ```javascript
88
+ * const claims = [
89
+ * { name: "email", value: "john.doe@example.com" },
90
+ * { name: "name", value: "John Doe" }
91
+ * ];
92
+ * ```
93
+ *
94
+ * @param {object} [options] - Additional options for credential issuance.
95
+ *
96
+ * ### Options
97
+ * - `refId` (optional, `string`): A unique identifier for the credential. If provided:
98
+ * - When `revokeIfAlreadyIssued` is set to `true`, any existing credential with the same `refId`
99
+ * will be revoked, ensuring the credential is unique.
100
+ * - If `revokeIfAlreadyIssued` is set to `false` (default), multiple credentials with the same `refId` can exist
101
+ * - Used for managing unique credentials like official documents.
102
+ * - Hashed in the database for security.
103
+ * - `credentialDefinitionId` (optional, `string`): Specifies the ID of the credential definition to use.
104
+ * - If not provided, the first available credential definition is used.
105
+ * - `revokeIfAlreadyIssued` (optional, `boolean`): Whether automatic revocation is enabled (default false)
106
+ *
107
+ * @returns {Promise<void>} A promise that resolves when the credential issuance is successfully sent.
108
+ * If an error occurs during the process, the promise will be rejected with the relevant error message.
109
+ *
110
+ */
111
+ async issue(connectionId, claims, options) {
112
+ var _a, _b, _c, _d, _e, _f;
113
+ const { revokeIfAlreadyIssued = false, jsonSchemaCredentialId } = options !== null && options !== void 0 ? options : {};
114
+ const refIdHash = (options === null || options === void 0 ? void 0 : options.refId) ? this.hash(options.refId) : null;
115
+ if (jsonSchemaCredentialId) {
116
+ await this.apiClient.trustCredentials.issuance({
117
+ format: 'anoncreds',
118
+ jsonSchemaCredentialId,
119
+ claims,
120
+ });
121
+ }
122
+ // Select the appropriate credential type based on definition or schema
123
+ const credentialTypes = await this.apiClient.credentialTypes.getAll();
124
+ const credentialType = (_a = credentialTypes.find(type => (options === null || options === void 0 ? void 0 : options.credentialDefinitionId)
125
+ ? type.id === options.credentialDefinitionId
126
+ : type.relatedJsonSchemaCredentialId === jsonSchemaCredentialId)) !== null && _a !== void 0 ? _a : credentialTypes[0];
127
+ if (!credentialType) {
128
+ throw new Error('No credential definitions found. Please configure a credential using the create method before proceeding.');
129
+ }
130
+ const { id: credentialDefinitionId, revocationSupported } = credentialType;
131
+ // If existing credentials are found and revocation is requested, revoke all of them
132
+ const creds = await this.credentialRepository.find({
133
+ where: Object.assign({ status: types_1.CredentialStatus.ACCEPTED }, (refIdHash ? { refIdHash } : {})),
134
+ });
135
+ if (creds && revokeIfAlreadyIssued) {
136
+ for (const cred of creds) {
137
+ await this.revoke(connectionId, cred.threadId);
138
+ }
139
+ }
140
+ // Begin a transaction to save new credentials and handle revocation logic if supported
141
+ const cred = await this.credentialRepository.manager.transaction(async (transaction) => {
142
+ if (!revocationSupported) {
143
+ return await transaction.save(credential_entity_1.CredentialEntity, Object.assign({ connectionId }, (refIdHash ? { refIdHash } : {})));
144
+ }
145
+ // Find last issued credential in revocation registry or create a new registry if none exists
146
+ let lastCred = await transaction
147
+ .createQueryBuilder(revocation_registry_entity_1.RevocationRegistryEntity, 'registry')
148
+ .where('registry.currentIndex != registry.maximumCredentialNumber')
149
+ .andWhere('registry.credentialDefinitionId = :credentialDefinitionId', { credentialDefinitionId })
150
+ .orderBy('registry.currentIndex', 'DESC')
151
+ .setLock('pessimistic_write') // Lock row for safe concurrent access
152
+ .getOne();
153
+ // Create new registry if none found
154
+ if (!lastCred)
155
+ lastCred = await this.createRevocationRegistry(credentialDefinitionId);
156
+ await transaction.save(revocation_registry_entity_1.RevocationRegistryEntity, lastCred);
157
+ return await transaction.save(credential_entity_1.CredentialEntity, Object.assign({ connectionId, revocationRegistryIndex: lastCred.currentIndex, revocationRegistry: lastCred }, (refIdHash ? { refIdHash } : {})));
158
+ });
159
+ // Send a message containing the newly issued credential details via API client
160
+ const payload = new vs_agent_model_1.CredentialIssuanceMessage({
161
+ connectionId,
162
+ revocationRegistryDefinitionId: (_b = cred.revocationRegistry) === null || _b === void 0 ? void 0 : _b.revocationDefinitionId,
163
+ revocationRegistryIndex: (_c = cred.revocationRegistry) === null || _c === void 0 ? void 0 : _c.currentIndex,
164
+ claims: Object.entries(claims).map(([name, value]) => new vs_agent_model_1.Claim({ name, value: String(value) })),
165
+ });
166
+ if (jsonSchemaCredentialId)
167
+ payload.jsonSchemaCredentialId = jsonSchemaCredentialId;
168
+ else {
169
+ payload.credentialDefinitionId = credentialDefinitionId;
170
+ }
171
+ const thread = await this.apiClient.messages.send(payload);
172
+ cred.threadId = thread.id;
173
+ cred.status = types_1.CredentialStatus.OFFERED;
174
+ await this.credentialRepository.save(cred);
175
+ if (cred.revocationRegistry) {
176
+ cred.revocationRegistry.currentIndex += 1;
177
+ this.revocationRepository.save(cred.revocationRegistry);
178
+ // Check if maximum capacity has been reached and create a new revocation registry if necessary
179
+ if (((_d = cred.revocationRegistry) === null || _d === void 0 ? void 0 : _d.currentIndex) === ((_e = cred.revocationRegistry) === null || _e === void 0 ? void 0 : _e.maximumCredentialNumber)) {
180
+ const revRegistry = await this.createRevocationRegistry(credentialDefinitionId, (_f = cred.revocationRegistry) === null || _f === void 0 ? void 0 : _f.maximumCredentialNumber);
181
+ this.logger.log(`Revocation registry successfully created with ID ${revRegistry}`);
182
+ }
183
+ }
184
+ this.logger.debug('sendCredential with claims: ' + JSON.stringify(claims));
185
+ }
186
+ /**
187
+ * Accepts a credential by associating it with the provided thread ID.
188
+ * @param connectionId - The connection ID associated with the credential.
189
+ * @param threadId - The thread ID to link with the credential.
190
+ * @throws Error if no credential is found with the specified connection ID.
191
+ */
192
+ async handleAcceptance(threadId) {
193
+ const cred = await this.credentialRepository.findOne({
194
+ where: {
195
+ threadId,
196
+ status: types_1.CredentialStatus.OFFERED,
197
+ },
198
+ order: { createdTs: 'DESC' },
199
+ });
200
+ if (!cred)
201
+ throw new Error(`Credential not found with threadId: ${threadId}`);
202
+ cred.status = types_1.CredentialStatus.ACCEPTED;
203
+ await this.credentialRepository.save(cred);
204
+ }
205
+ /**
206
+ * Rejected a credential by associating it with the provided thread ID.
207
+ * @param connectionId - The connection ID associated with the credential.
208
+ * @param threadId - The thread ID to link with the credential.
209
+ * @throws Error if no credential is found with the specified connection ID.
210
+ */
211
+ async handleRejection(threadId) {
212
+ const cred = await this.credentialRepository.findOne({
213
+ where: {
214
+ threadId,
215
+ status: types_1.CredentialStatus.OFFERED,
216
+ },
217
+ order: { createdTs: 'DESC' },
218
+ });
219
+ if (!cred)
220
+ throw new Error(`Credential with threadId ${threadId} not found.`);
221
+ cred.status = types_1.CredentialStatus.REJECTED;
222
+ await this.credentialRepository.save(cred);
223
+ }
224
+ /**
225
+ * Revokes a credential associated with the provided thread ID.
226
+ * @param connectionId - The connection ID to send the revoke. (Search by connection ID if no thread ID)
227
+ * @param threadId - (Optional) The thread ID linked to the credential to revoke.
228
+ * @throws Error if no credential is found with the specified thread ID or connection ID, or if the credential has no connection ID.
229
+ */
230
+ async revoke(connectionId, threadId) {
231
+ var _a, _b;
232
+ // Define search options based on whether a thread ID is provided
233
+ const options = threadId
234
+ ? { where: { threadId, status: types_1.CredentialStatus.ACCEPTED } }
235
+ : {
236
+ where: { connectionId, status: types_1.CredentialStatus.ACCEPTED, threadId: (0, typeorm_2.Not)((0, typeorm_2.IsNull)()) },
237
+ order: { createdTs: 'DESC' },
238
+ };
239
+ const cred = await this.credentialRepository.findOne(options);
240
+ if (!cred)
241
+ throw new Error(`Credential not found with threadId "${threadId}" or connectionId "${connectionId}".`);
242
+ // Save the updated credential back to the repository with the new status 'revoked'
243
+ cred.status = types_1.CredentialStatus.REVOKED;
244
+ await this.credentialRepository.save(cred);
245
+ const credentialTypes = await this.apiClient.credentialTypes.getAll();
246
+ const credentialType = (_a = credentialTypes.find(credType => { var _a; return credType.id === ((_a = cred.revocationRegistry) === null || _a === void 0 ? void 0 : _a.credentialDefinitionId); })) !== null && _a !== void 0 ? _a : credentialTypes[0];
247
+ // If revocation is not supported for this credential type, return
248
+ if (!credentialType.revocationSupported) {
249
+ this.logger.warn(`Credential definition ${(_b = cred.revocationRegistry) === null || _b === void 0 ? void 0 : _b.credentialDefinitionId} does not support revocation.`);
250
+ return;
251
+ }
252
+ // Send a revocation message using the API client
253
+ await this.apiClient.messages.send(new vs_agent_model_1.CredentialRevocationMessage({
254
+ connectionId,
255
+ threadId: cred === null || cred === void 0 ? void 0 : cred.threadId,
256
+ }));
257
+ this.logger.log(`Credential revoked: ${cred.id}`);
258
+ }
259
+ // private methods
260
+ // Method to create a revocation registry for a given credential definition
261
+ async createRevocationRegistry(credentialDefinitionId, maximumCredentialNumber = 1000) {
262
+ const revocationDefinitionId = await this.apiClient.revocationRegistries.create({
263
+ credentialDefinitionId,
264
+ maximumCredentialNumber,
265
+ });
266
+ // Check if the revocation definition ID was successfully created
267
+ if (!revocationDefinitionId)
268
+ throw new Error(`Unable to create a new revocation registry for CredentialDefinitionId: ${credentialDefinitionId}`);
269
+ const revocationRegistry = await this.revocationRepository.save({
270
+ credentialDefinitionId,
271
+ revocationDefinitionId,
272
+ currentIndex: 0,
273
+ maximumCredentialNumber,
274
+ });
275
+ return revocationRegistry;
276
+ }
277
+ hash(value) {
278
+ return Buffer.from(new core_1.Sha256().hash(value)).toString('hex');
279
+ }
280
+ };
281
+ exports.CredentialService = CredentialService;
282
+ exports.CredentialService = CredentialService = CredentialService_1 = __decorate([
283
+ (0, common_1.Injectable)(),
284
+ __param(0, (0, typeorm_1.InjectRepository)(credential_entity_1.CredentialEntity)),
285
+ __param(1, (0, typeorm_1.InjectRepository)(revocation_registry_entity_1.RevocationRegistryEntity)),
286
+ __param(2, (0, common_1.Inject)('GLOBAL_MODULE_OPTIONS')),
287
+ __metadata("design:paramtypes", [typeorm_2.Repository,
288
+ typeorm_2.Repository, Object])
289
+ ], CredentialService);
290
+ //# sourceMappingURL=credential.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential.service.js","sourceRoot":"","sources":["../../src/credentials/credential.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAA0D;AAC1D,2CAA2D;AAC3D,6CAAkD;AAClD,kEAAoE;AACpE,gEAA2G;AAC3G,qCAAiE;AAEjE,oCAA8D;AAE9D,2DAAsD;AACtD,6EAAuE;AAGhE,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAQ5B,YAEE,oBAAmE,EAEnE,oBAA2E,EAC1C,OAAkC;;QAHlD,yBAAoB,GAApB,oBAAoB,CAA8B;QAElD,yBAAoB,GAApB,oBAAoB,CAAsC;QAClC,YAAO,GAAP,OAAO,CAAmB;QAZpD,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAA;QAc1D,IAAI,CAAC,OAAO,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC3F,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,4BAAU,CAAC,EAAE,CAAA;QAClD,IAAI,CAAC,SAAS,GAAG,IAAI,2BAAS,CAAC,IAA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C,qDAAwB,CAAC,CAAA;IAE1C,WAAA,IAAA,eAAM,EAAC,uBAAuB,CAAC,CAAA;qCAHO,oBAAU;QAEV,oBAAU;GAZxC,iBAAiB,CA6U7B"}
@@ -0,0 +1,4 @@
1
+ export * from './credential.entity';
2
+ export * from './credential.service';
3
+ export * from './credential.module';
4
+ export * from './revocation-registry.entity';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./credential.entity"), exports);
18
+ __exportStar(require("./credential.service"), exports);
19
+ __exportStar(require("./credential.module"), exports);
20
+ __exportStar(require("./revocation-registry.entity"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/credentials/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,uDAAoC;AACpC,sDAAmC;AACnC,+DAA4C"}
@@ -0,0 +1,9 @@
1
+ export declare class RevocationRegistryEntity {
2
+ id: string;
3
+ credentialDefinitionId: string;
4
+ revocationDefinitionId: string;
5
+ currentIndex: number;
6
+ maximumCredentialNumber: number;
7
+ createdTs?: Date;
8
+ updatedTs?: Date;
9
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RevocationRegistryEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let RevocationRegistryEntity = class RevocationRegistryEntity {
15
+ };
16
+ exports.RevocationRegistryEntity = RevocationRegistryEntity;
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
19
+ __metadata("design:type", String)
20
+ ], RevocationRegistryEntity.prototype, "id", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: false }),
23
+ __metadata("design:type", String)
24
+ ], RevocationRegistryEntity.prototype, "credentialDefinitionId", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)({ type: 'varchar', nullable: false }),
27
+ __metadata("design:type", String)
28
+ ], RevocationRegistryEntity.prototype, "revocationDefinitionId", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false, default: 0 }),
31
+ __metadata("design:type", Number)
32
+ ], RevocationRegistryEntity.prototype, "currentIndex", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false, default: 1000 }),
35
+ __metadata("design:type", Number)
36
+ ], RevocationRegistryEntity.prototype, "maximumCredentialNumber", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.CreateDateColumn)(),
39
+ __metadata("design:type", Date)
40
+ ], RevocationRegistryEntity.prototype, "createdTs", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.UpdateDateColumn)(),
43
+ __metadata("design:type", Date)
44
+ ], RevocationRegistryEntity.prototype, "updatedTs", void 0);
45
+ exports.RevocationRegistryEntity = RevocationRegistryEntity = __decorate([
46
+ (0, typeorm_1.Entity)('revocation_registries')
47
+ ], RevocationRegistryEntity);
48
+ //# sourceMappingURL=revocation-registry.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revocation-registry.entity.js","sourceRoot":"","sources":["../../src/credentials/revocation-registry.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoG;AAG7F,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAqBpC,CAAA;AArBY,4DAAwB;AAEnC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;oDACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;wEACd;AAG/B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;wEACd;AAG/B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACpC;AAGrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yEAC5B;AAGhC;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;2DAAA;AAGhB;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;2DAAA;mCApBL,wBAAwB;IADpC,IAAA,gBAAM,EAAC,uBAAuB,CAAC;GACnB,wBAAwB,CAqBpC"}
@@ -0,0 +1,9 @@
1
+ export * from '@verana-labs/vs-agent-client';
2
+ export * from '@verana-labs/vs-agent-model';
3
+ export * from './app.module';
4
+ export * from './connections';
5
+ export * from './credentials';
6
+ export * from './jms';
7
+ export * from './interfaces';
8
+ export * from './messages';
9
+ export * from './types';
package/build/index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@verana-labs/vs-agent-client"), exports);
18
+ __exportStar(require("@verana-labs/vs-agent-model"), exports);
19
+ __exportStar(require("./app.module"), exports);
20
+ __exportStar(require("./connections"), exports);
21
+ __exportStar(require("./credentials"), exports);
22
+ __exportStar(require("./jms"), exports);
23
+ __exportStar(require("./interfaces"), exports);
24
+ __exportStar(require("./messages"), exports);
25
+ __exportStar(require("./types"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,8DAA2C;AAC3C,+CAA4B;AAC5B,gDAA6B;AAC7B,gDAA6B;AAC7B,wCAAqB;AACrB,+CAA4B;AAC5B,6CAA0B;AAC1B,0CAAuB"}
@@ -0,0 +1,32 @@
1
+ import { BaseMessage } from '@verana-labs/vs-agent-model';
2
+ /**
3
+ * The EventHandler interface defines the blueprint for handling events
4
+ * in the main class, ensuring it implements the required methods for
5
+ * basic and proper functionality. Classes implementing this interface
6
+ * must handle connection updates and process input messages effectively.
7
+ */
8
+ export interface EventHandler {
9
+ /**
10
+ * Handles a new connection event, typically triggered when the connection
11
+ * state changes. This method can execute synchronously or asynchronously.
12
+ *
13
+ * @param event - An instance of ConnectionStateUpdated representing
14
+ * the updated connection state.
15
+ */
16
+ newConnection(connectionId: string): Promise<void> | void;
17
+ /**
18
+ * Handles a terminated connection event, typically triggered when the connection
19
+ * state changes. This method can execute synchronously or asynchronously.
20
+ *
21
+ * @param event - An instance of ConnectionStateUpdated representing
22
+ * the updated connection state.
23
+ */
24
+ closeConnection(connectionId: string): Promise<void> | void;
25
+ /**
26
+ * Processes an incoming message. This method allows for both synchronous
27
+ * and asynchronous handling of messages of type BaseMessage.
28
+ *
29
+ * @param message - An instance of BaseMessage containing the input message details.
30
+ */
31
+ inputMessage(message: BaseMessage): Promise<void> | void;
32
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './stats-producer.service';
2
+ export * from './stats.module';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./stats-producer.service"), exports);
18
+ __exportStar(require("./stats.module"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/jms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AACxC,iDAA8B"}
@@ -0,0 +1,41 @@
1
+ import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
2
+ import { StatEnum } from '@verana-labs/vs-agent-model';
3
+ import { StatEventOptions } from '../types';
4
+ export declare class StatProducerService implements OnModuleInit, OnModuleDestroy {
5
+ private options;
6
+ private readonly logger;
7
+ private connection;
8
+ private sender;
9
+ private container;
10
+ private readonly config;
11
+ /**
12
+ * Initializes the StatProducerService with default settings optimized for a local development environment.
13
+ * By default, it connects to a JMS broker running on `localhost` with predefined credentials.
14
+ *
15
+ * If custom options are provided through `GLOBAL_MODULE_OPTIONS`, they will override the defaults.
16
+ *
17
+ * @param options - Configuration options for the JMS connection.
18
+ */
19
+ constructor(options: StatEventOptions);
20
+ onModuleInit(): Promise<void>;
21
+ onModuleDestroy(): Promise<void>;
22
+ private connect;
23
+ private disconnect;
24
+ /**
25
+ * Sends a message of type `JMSTextMessage` as defined by the IBM MQ documentation:
26
+ * https://www.ibm.com/docs/en/ibm-mq/9.4?topic=messaging-jmstextmessage.
27
+ *
28
+ * The method spools statistical events to a messaging system. If the sender
29
+ * is not initialized, it attempts to reconnect. Each message contains the event
30
+ * details serialized as a JSON string and is sent to the configured messaging queue.
31
+ *
32
+ * @param statClass - A string or array of strings representing the class of the statistic(s).
33
+ * @param entityId - A unique identifier for the entity associated with the statistics.
34
+ * @param statEnums - An array of statistical enums to send.
35
+ * @param ts - The timestamp for the event (defaults to the current date and time).
36
+ * @param increment - The increment value for the statistic (defaults to 1).
37
+ * @throws If the sender cannot be initialized or if sending a message fails.
38
+ */
39
+ spool(statClass: string | string[], entityId: string, statEnums: StatEnum[], ts?: Date, increment?: number): Promise<void>;
40
+ spoolSingle(statClass: string, entityId: string, statEnum: StatEnum, ts?: Date, increment?: number): Promise<void>;
41
+ }