@2060.io/vs-agent-nestjs-client 1.2.1-dev.3

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 +169 -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 +64 -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 +277 -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 +8 -0
  40. package/build/index.js +25 -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 +94 -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 +49 -0
@@ -0,0 +1,277 @@
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 vs_agent_client_1 = require("@2060.io/vs-agent-client");
18
+ const vs_agent_model_1 = require("@2060.io/vs-agent-model");
19
+ const core_1 = require("@credo-ts/core");
20
+ const common_1 = require("@nestjs/common");
21
+ const typeorm_1 = require("@nestjs/typeorm");
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, entityManager) {
28
+ var _a;
29
+ this.credentialRepository = credentialRepository;
30
+ this.revocationRepository = revocationRepository;
31
+ this.options = options;
32
+ this.entityManager = entityManager;
33
+ this.logger = new common_1.Logger(CredentialService_1.name);
34
+ if (!options.url)
35
+ throw new Error(`For this module to be used the value url must be added`);
36
+ this.url = options.url;
37
+ this.apiVersion = (_a = options.version) !== null && _a !== void 0 ? _a : vs_agent_client_1.ApiVersion.V1;
38
+ this.apiClient = new vs_agent_client_1.ApiClient(this.url, this.apiVersion);
39
+ this.logger.debug(`Initialized with url: ${this.url}, version: ${this.apiVersion}`);
40
+ }
41
+ /**
42
+ * Creates and initializes a credential type (credential definition) with optional revocation registry support.
43
+ *
44
+ * This method specifically handles the creation of credential types/definitions, which serve as templates
45
+ * for issuing actual credentials.
46
+ *
47
+ * When revocation support is enabled:
48
+ * - Two default revocation registries will be created
49
+ * - This ensures continuity if one registry reaches capacity
50
+ *
51
+ * @param attributes - List of attributes that credentials of this type will support
52
+ * @param options.name - Name identifier for the credential type
53
+ * @param options.version - Version of the credential type
54
+ * @param options.supportRevocation - Whether credentials can be revoked
55
+ * @param options.maximumCredentialNumber - Maximum number of credentials that can be issued
56
+ *
57
+ * @returns Promise<void> - Resolves when the credential type and revocation registries are created
58
+ */
59
+ async createType(name, version, attributes, options = {}) {
60
+ const { supportRevocation, maximumCredentialNumber } = options;
61
+ const credentialTypes = await this.apiClient.credentialTypes.getAll();
62
+ const credentialType = credentialTypes.find(credType => credType.name === name && credType.version === version);
63
+ if (!credentialType) {
64
+ const credentialType = await this.apiClient.credentialTypes.create({
65
+ id: core_1.utils.uuid(),
66
+ name,
67
+ version,
68
+ attributes,
69
+ supportRevocation,
70
+ });
71
+ if (supportRevocation) {
72
+ // Both records are created to handle multiple credentials
73
+ await this.createRevocationRegistry(credentialType.id, maximumCredentialNumber);
74
+ await this.createRevocationRegistry(credentialType.id, maximumCredentialNumber);
75
+ }
76
+ }
77
+ }
78
+ /**
79
+ * Sends a credential issuance to the specified connection using the provided claims.
80
+ * This method initiates the issuance process by sending claims as part of a credential
81
+ * to the recipient identified by the connection ID.
82
+ *
83
+ * @param {string} connectionId - The unique identifier of the connection to which the credential
84
+ * will be issued. This represents the recipient of the credential.
85
+ *
86
+ * @param {Claim[]} claims - An array of claims representing the data to be included in the credential.
87
+ * Each claim has a `name` (key) and a `value` (data). Example:
88
+ * ```javascript
89
+ * const claims = [
90
+ * { name: "email", value: "john.doe@example.com" },
91
+ * { name: "name", value: "John Doe" }
92
+ * ];
93
+ * ```
94
+ *
95
+ * @param {object} [options] - Additional options for credential issuance.
96
+ *
97
+ * ### Options
98
+ * - `refId` (optional, `string`): A unique identifier for the credential. If provided:
99
+ * - When `revokeIfAlreadyIssued` is set to `true`, any existing credential with the same `refId`
100
+ * will be revoked, ensuring the credential is unique.
101
+ * - If `revokeIfAlreadyIssued` is set to `false` (default), multiple credentials with the same `refId` can exist
102
+ * - Used for managing unique credentials like official documents.
103
+ * - Hashed in the database for security.
104
+ * - `credentialDefinitionId` (optional, `string`): Specifies the ID of the credential definition to use.
105
+ * - If not provided, the first available credential definition is used.
106
+ * - `revokeIfAlreadyIssued` (optional, `boolean`): Whether automatic revocation is enabled (default false)
107
+ *
108
+ * @returns {Promise<void>} A promise that resolves when the credential issuance is successfully sent.
109
+ * If an error occurs during the process, the promise will be rejected with the relevant error message.
110
+ *
111
+ */
112
+ async issue(connectionId, claims, options) {
113
+ var _a, _b, _c, _d, _e, _f;
114
+ const { revokeIfAlreadyIssued = false } = options !== null && options !== void 0 ? options : {};
115
+ const refIdHash = (options === null || options === void 0 ? void 0 : options.refId) ? this.hash(options.refId) : null;
116
+ // Find a specific credential type based on provided definition ID or default to first available
117
+ const credentialTypes = await this.apiClient.credentialTypes.getAll();
118
+ const credentialType = (_a = credentialTypes.find(credType => credType.id === (options === null || options === void 0 ? void 0 : options.credentialDefinitionId))) !== null && _a !== void 0 ? _a : credentialTypes[0];
119
+ if (!credentialType) {
120
+ throw new Error('No credential definitions found. Please configure a credential using the create method before proceeding.');
121
+ }
122
+ const { id: credentialDefinitionId, revocationSupported } = credentialType;
123
+ // If existing credentials are found and revocation is requested, revoke all of them
124
+ const creds = await this.credentialRepository.find({
125
+ where: Object.assign({ status: types_1.CredentialStatus.ACCEPTED }, (refIdHash ? { refIdHash } : {})),
126
+ });
127
+ if (creds && revokeIfAlreadyIssued) {
128
+ for (const cred of creds) {
129
+ await this.revoke(connectionId, cred.threadId);
130
+ }
131
+ }
132
+ // Begin a transaction to save new credentials and handle revocation logic if supported
133
+ const cred = await this.entityManager.transaction(async (transaction) => {
134
+ if (!revocationSupported) {
135
+ return await transaction.save(credential_entity_1.CredentialEntity, Object.assign({ connectionId }, (refIdHash ? { refIdHash } : {})));
136
+ }
137
+ // Find last issued credential in revocation registry or create a new registry if none exists
138
+ let lastCred = await transaction
139
+ .createQueryBuilder(revocation_registry_entity_1.RevocationRegistryEntity, 'registry')
140
+ .where('registry.currentIndex != registry.maximumCredentialNumber')
141
+ .andWhere('registry.credentialDefinitionId = :credentialDefinitionId', { credentialDefinitionId })
142
+ .orderBy('registry.currentIndex', 'DESC')
143
+ .setLock('pessimistic_write') // Lock row for safe concurrent access
144
+ .getOne();
145
+ // Create new registry if none found
146
+ if (!lastCred)
147
+ lastCred = await this.createRevocationRegistry(credentialDefinitionId);
148
+ await transaction.save(revocation_registry_entity_1.RevocationRegistryEntity, lastCred);
149
+ return await transaction.save(credential_entity_1.CredentialEntity, Object.assign({ connectionId, revocationRegistryIndex: lastCred.currentIndex, revocationRegistry: lastCred }, (refIdHash ? { refIdHash } : {})));
150
+ });
151
+ // Send a message containing the newly issued credential details via API client
152
+ const thread = await this.apiClient.messages.send(new vs_agent_model_1.CredentialIssuanceMessage({
153
+ connectionId,
154
+ credentialDefinitionId,
155
+ revocationRegistryDefinitionId: (_b = cred.revocationRegistry) === null || _b === void 0 ? void 0 : _b.revocationDefinitionId,
156
+ revocationRegistryIndex: (_c = cred.revocationRegistry) === null || _c === void 0 ? void 0 : _c.currentIndex,
157
+ claims: claims,
158
+ }));
159
+ cred.threadId = thread.id;
160
+ cred.status = types_1.CredentialStatus.OFFERED;
161
+ await this.credentialRepository.save(cred);
162
+ if (cred.revocationRegistry) {
163
+ cred.revocationRegistry.currentIndex += 1;
164
+ this.revocationRepository.save(cred.revocationRegistry);
165
+ // Check if maximum capacity has been reached and create a new revocation registry if necessary
166
+ if (((_d = cred.revocationRegistry) === null || _d === void 0 ? void 0 : _d.currentIndex) === ((_e = cred.revocationRegistry) === null || _e === void 0 ? void 0 : _e.maximumCredentialNumber)) {
167
+ const revRegistry = await this.createRevocationRegistry(credentialDefinitionId, (_f = cred.revocationRegistry) === null || _f === void 0 ? void 0 : _f.maximumCredentialNumber);
168
+ this.logger.log(`Revocation registry successfully created with ID ${revRegistry}`);
169
+ }
170
+ }
171
+ this.logger.debug('sendCredential with claims: ' + JSON.stringify(claims));
172
+ }
173
+ /**
174
+ * Accepts a credential by associating it with the provided thread ID.
175
+ * @param connectionId - The connection ID associated with the credential.
176
+ * @param threadId - The thread ID to link with the credential.
177
+ * @throws Error if no credential is found with the specified connection ID.
178
+ */
179
+ async handleAcceptance(threadId) {
180
+ const cred = await this.credentialRepository.findOne({
181
+ where: {
182
+ threadId,
183
+ status: types_1.CredentialStatus.OFFERED,
184
+ },
185
+ order: { createdTs: 'DESC' },
186
+ });
187
+ if (!cred)
188
+ throw new Error(`Credential not found with threadId: ${threadId}`);
189
+ cred.status = types_1.CredentialStatus.ACCEPTED;
190
+ await this.credentialRepository.save(cred);
191
+ }
192
+ /**
193
+ * Rejected a credential by associating it with the provided thread ID.
194
+ * @param connectionId - The connection ID associated with the credential.
195
+ * @param threadId - The thread ID to link with the credential.
196
+ * @throws Error if no credential is found with the specified connection ID.
197
+ */
198
+ async handleRejection(threadId) {
199
+ const cred = await this.credentialRepository.findOne({
200
+ where: {
201
+ threadId,
202
+ status: types_1.CredentialStatus.OFFERED,
203
+ },
204
+ order: { createdTs: 'DESC' },
205
+ });
206
+ if (!cred)
207
+ throw new Error(`Credential with threadId ${threadId} not found.`);
208
+ cred.status = types_1.CredentialStatus.REJECTED;
209
+ await this.credentialRepository.save(cred);
210
+ }
211
+ /**
212
+ * Revokes a credential associated with the provided thread ID.
213
+ * @param connectionId - The connection ID to send the revoke. (Search by connection ID if no thread ID)
214
+ * @param threadId - (Optional) The thread ID linked to the credential to revoke.
215
+ * @throws Error if no credential is found with the specified thread ID or connection ID, or if the credential has no connection ID.
216
+ */
217
+ async revoke(connectionId, threadId) {
218
+ var _a, _b;
219
+ // Define search options based on whether a thread ID is provided
220
+ const options = threadId
221
+ ? { where: { threadId, status: types_1.CredentialStatus.ACCEPTED } }
222
+ : {
223
+ where: { connectionId, status: types_1.CredentialStatus.ACCEPTED, threadId: (0, typeorm_2.Not)((0, typeorm_2.IsNull)()) },
224
+ order: { createdTs: 'DESC' },
225
+ };
226
+ const cred = await this.credentialRepository.findOne(options);
227
+ if (!cred)
228
+ throw new Error(`Credential not found with threadId "${threadId}" or connectionId "${connectionId}".`);
229
+ // Save the updated credential back to the repository with the new status 'revoked'
230
+ cred.status = types_1.CredentialStatus.REVOKED;
231
+ await this.credentialRepository.save(cred);
232
+ const credentialTypes = await this.apiClient.credentialTypes.getAll();
233
+ 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];
234
+ // If revocation is not supported for this credential type, return
235
+ if (!credentialType.revocationSupported) {
236
+ this.logger.warn(`Credential definition ${(_b = cred.revocationRegistry) === null || _b === void 0 ? void 0 : _b.credentialDefinitionId} does not support revocation.`);
237
+ return;
238
+ }
239
+ // Send a revocation message using the API client
240
+ await this.apiClient.messages.send(new vs_agent_model_1.CredentialRevocationMessage({
241
+ connectionId,
242
+ threadId: cred === null || cred === void 0 ? void 0 : cred.threadId,
243
+ }));
244
+ this.logger.log(`Credential revoked: ${cred.id}`);
245
+ }
246
+ // private methods
247
+ // Method to create a revocation registry for a given credential definition
248
+ async createRevocationRegistry(credentialDefinitionId, maximumCredentialNumber = 1000) {
249
+ const revocationDefinitionId = await this.apiClient.revocationRegistries.create({
250
+ credentialDefinitionId,
251
+ maximumCredentialNumber,
252
+ });
253
+ // Check if the revocation definition ID was successfully created
254
+ if (!revocationDefinitionId)
255
+ throw new Error(`Unable to create a new revocation registry for CredentialDefinitionId: ${credentialDefinitionId}`);
256
+ const revocationRegistry = await this.revocationRepository.save({
257
+ credentialDefinitionId,
258
+ revocationDefinitionId,
259
+ currentIndex: 0,
260
+ maximumCredentialNumber,
261
+ });
262
+ return revocationRegistry;
263
+ }
264
+ hash(value) {
265
+ return Buffer.from(new core_1.Sha256().hash(value)).toString('hex');
266
+ }
267
+ };
268
+ exports.CredentialService = CredentialService;
269
+ exports.CredentialService = CredentialService = CredentialService_1 = __decorate([
270
+ (0, common_1.Injectable)(),
271
+ __param(0, (0, typeorm_1.InjectRepository)(credential_entity_1.CredentialEntity)),
272
+ __param(1, (0, typeorm_1.InjectRepository)(revocation_registry_entity_1.RevocationRegistryEntity)),
273
+ __param(2, (0, common_1.Inject)('GLOBAL_MODULE_OPTIONS')),
274
+ __metadata("design:paramtypes", [typeorm_2.Repository,
275
+ typeorm_2.Repository, Object, typeorm_2.EntityManager])
276
+ ], CredentialService);
277
+ //# 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,8DAAgE;AAChE,4DAAuG;AACvG,yCAA8C;AAC9C,2CAA2D;AAC3D,6CAAkD;AAClD,qCAAgF;AAEhF,oCAA8D;AAE9D,2DAAsD;AACtD,6EAAuE;AAGhE,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAQ5B,YAEE,oBAAmE,EAEnE,oBAA2E,EAC1C,OAAkC,EAClD,aAA4B;;QAJ5B,yBAAoB,GAApB,oBAAoB,CAA8B;QAElD,yBAAoB,GAApB,oBAAoB,CAAsC;QAClC,YAAO,GAAP,OAAO,CAAmB;QAClD,kBAAa,GAAb,aAAa,CAAe;QAb9B,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAA;QAe1D,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,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;QAEzD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,IAAI,CAAC,GAAG,cAAc,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IACrF,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,UAAU,CACd,IAAY,EACZ,OAAe,EACf,UAAoB,EACpB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C,KAAa;QACxB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,aAAM,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC9D,CAAC;CACF,CAAA;AA9TY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAUR,WAAA,IAAA,0BAAgB,EAAC,oCAAgB,CAAC,CAAA;IAElC,WAAA,IAAA,0BAAgB,EAAC,qDAAwB,CAAC,CAAA;IAE1C,WAAA,IAAA,eAAM,EAAC,uBAAuB,CAAC,CAAA;qCAHO,oBAAU;QAEV,oBAAU,UAEjB,uBAAa;GAdpC,iBAAiB,CA8T7B"}
@@ -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,8 @@
1
+ export * from '@2060.io/vs-agent-client';
2
+ export * from '@2060.io/vs-agent-model';
3
+ export * from './app.module';
4
+ export * from './connections';
5
+ export * from './credentials';
6
+ export * from './interfaces';
7
+ export * from './messages';
8
+ export * from './types';
package/build/index.js ADDED
@@ -0,0 +1,25 @@
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("@2060.io/vs-agent-client"), exports);
18
+ __exportStar(require("@2060.io/vs-agent-model"), exports);
19
+ __exportStar(require("./app.module"), exports);
20
+ __exportStar(require("./connections"), exports);
21
+ __exportStar(require("./credentials"), exports);
22
+ __exportStar(require("./interfaces"), exports);
23
+ __exportStar(require("./messages"), exports);
24
+ __exportStar(require("./types"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AACxC,0DAAuC;AACvC,+CAA4B;AAC5B,gDAA6B;AAC7B,gDAA6B;AAC7B,+CAA4B;AAC5B,6CAA0B;AAC1B,0CAAuB"}
@@ -0,0 +1,32 @@
1
+ import { BaseMessage } from '@2060.io/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 { StatEnum } from '@2060.io/vs-agent-model';
2
+ import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
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
+ }