@verana-labs/vs-agent-nestjs-client 2.0.0-dev.8 → 2.0.0-dev.81
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/README.md +61 -201
- package/build/app.module.js +26 -34
- package/build/app.module.js.map +1 -1
- package/build/connections/connection.entity.d.ts +4 -5
- package/build/connections/connection.entity.js +2 -10
- package/build/connections/connection.entity.js.map +1 -1
- package/build/connections/connection.repository.d.ts +6 -20
- package/build/connections/connection.repository.js +12 -40
- package/build/connections/connection.repository.js.map +1 -1
- package/build/connections/connection.service.d.ts +8 -17
- package/build/connections/connection.service.js +33 -54
- package/build/connections/connection.service.js.map +1 -1
- package/build/connections/index.d.ts +0 -2
- package/build/connections/index.js +0 -2
- package/build/connections/index.js.map +1 -1
- package/build/credentials/credential.entity.d.ts +1 -1
- package/build/credentials/credential.entity.js +1 -1
- package/build/credentials/credential.entity.js.map +1 -1
- package/build/credentials/credential.service.d.ts +22 -90
- package/build/credentials/credential.service.js +109 -204
- package/build/credentials/credential.service.js.map +1 -1
- package/build/credentials/index.d.ts +0 -1
- package/build/credentials/index.js +0 -1
- package/build/credentials/index.js.map +1 -1
- package/build/events.controller.d.ts +9 -0
- package/build/events.controller.js +47 -0
- package/build/events.controller.js.map +1 -0
- package/build/events.service.d.ts +12 -0
- package/build/events.service.js +80 -0
- package/build/events.service.js.map +1 -0
- package/build/index.d.ts +4 -3
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/build/interfaces.d.ts +2 -28
- package/build/jms/index.d.ts +1 -1
- package/build/jms/index.js +4 -1
- package/build/jms/index.js.map +1 -1
- package/build/jms/stats-producer.service.d.ts +3 -4
- package/build/jms/stats-producer.service.js +3 -4
- package/build/jms/stats-producer.service.js.map +1 -1
- package/build/tokens.d.ts +3 -0
- package/build/tokens.js +7 -0
- package/build/tokens.js.map +1 -0
- package/build/types.d.ts +25 -53
- package/build/types.js +7 -1
- package/build/types.js.map +1 -1
- package/package.json +3 -9
- package/build/connections/connection.controller.d.ts +0 -10
- package/build/connections/connection.controller.js +0 -65
- package/build/connections/connection.controller.js.map +0 -1
- package/build/connections/connection.module.d.ts +0 -5
- package/build/connections/connection.module.js +0 -44
- package/build/connections/connection.module.js.map +0 -1
- package/build/credentials/credential.module.d.ts +0 -5
- package/build/credentials/credential.module.js +0 -34
- package/build/credentials/credential.module.js.map +0 -1
- package/build/jms/stats.module.d.ts +0 -5
- package/build/jms/stats.module.js +0 -34
- package/build/jms/stats.module.js.map +0 -1
- package/build/messages/index.d.ts +0 -3
- package/build/messages/index.js +0 -20
- package/build/messages/index.js.map +0 -1
- package/build/messages/message.controller.d.ts +0 -13
- package/build/messages/message.controller.js +0 -95
- package/build/messages/message.controller.js.map +0 -1
- package/build/messages/message.module.d.ts +0 -5
- package/build/messages/message.module.js +0 -41
- package/build/messages/message.module.js.map +0 -1
- package/build/messages/message.service.d.ts +0 -19
- package/build/messages/message.service.js +0 -104
- package/build/messages/message.service.js.map +0 -1
|
@@ -1,95 +0,0 @@
|
|
|
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 MessageEventController_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.MessageEventController = void 0;
|
|
17
|
-
const common_1 = require("@nestjs/common");
|
|
18
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
19
|
-
const vs_agent_client_1 = require("@verana-labs/vs-agent-client");
|
|
20
|
-
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
21
|
-
const message_service_1 = require("./message.service");
|
|
22
|
-
let MessageEventController = MessageEventController_1 = class MessageEventController {
|
|
23
|
-
constructor(message) {
|
|
24
|
-
this.message = message;
|
|
25
|
-
this.logger = new common_1.Logger(MessageEventController_1.name);
|
|
26
|
-
}
|
|
27
|
-
async received(body) {
|
|
28
|
-
try {
|
|
29
|
-
this.logger.log(`messageReceived event: ${JSON.stringify(body)}`);
|
|
30
|
-
await this.message.received(body);
|
|
31
|
-
return { message: 'Message received updated successfully' };
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
vs_agent_client_1.HttpUtils.handleException(this.logger, error, 'Failed to received message state');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
async updated(body) {
|
|
38
|
-
try {
|
|
39
|
-
this.logger.log(`messageStateUpdated event: ${JSON.stringify(body)}`);
|
|
40
|
-
await this.message.updated();
|
|
41
|
-
return { message: 'Message state updated successfully' };
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
vs_agent_client_1.HttpUtils.handleException(this.logger, error, 'Failed to update message state');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
exports.MessageEventController = MessageEventController;
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, common_1.Post)(`/${vs_agent_model_1.EventType.MessageReceived}`),
|
|
51
|
-
(0, swagger_1.ApiOperation)({
|
|
52
|
-
summary: 'Handle the MessageReceived event',
|
|
53
|
-
description: 'Processes the MessageReceived event and updates the message state.',
|
|
54
|
-
}),
|
|
55
|
-
(0, swagger_1.ApiResponse)({
|
|
56
|
-
status: common_1.HttpStatus.OK,
|
|
57
|
-
description: 'Message received updated successfully.',
|
|
58
|
-
schema: {
|
|
59
|
-
example: { message: 'Message received updated successfully' },
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.BAD_REQUEST, description: 'Invalid input data.' }),
|
|
63
|
-
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.INTERNAL_SERVER_ERROR, description: 'Internal server error.' }),
|
|
64
|
-
__param(0, (0, common_1.Body)()),
|
|
65
|
-
__metadata("design:type", Function),
|
|
66
|
-
__metadata("design:paramtypes", [vs_agent_model_1.MessageReceived]),
|
|
67
|
-
__metadata("design:returntype", Promise)
|
|
68
|
-
], MessageEventController.prototype, "received", null);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, common_1.Post)(`/${vs_agent_model_1.EventType.MessageStateUpdated}`),
|
|
71
|
-
(0, swagger_1.ApiOperation)({
|
|
72
|
-
summary: 'Handle the MessageStateUpdated event',
|
|
73
|
-
description: 'Processes the MessageStateUpdated event and updates the message state.',
|
|
74
|
-
}),
|
|
75
|
-
(0, swagger_1.ApiResponse)({
|
|
76
|
-
status: common_1.HttpStatus.OK,
|
|
77
|
-
description: 'Message state updated successfully.',
|
|
78
|
-
schema: {
|
|
79
|
-
example: { message: 'Message state updated successfully' },
|
|
80
|
-
},
|
|
81
|
-
}),
|
|
82
|
-
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.BAD_REQUEST, description: 'Invalid input data.' }),
|
|
83
|
-
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.INTERNAL_SERVER_ERROR, description: 'Internal server error.' }),
|
|
84
|
-
__param(0, (0, common_1.Body)()),
|
|
85
|
-
__metadata("design:type", Function),
|
|
86
|
-
__metadata("design:paramtypes", [vs_agent_model_1.MessageStateUpdated]),
|
|
87
|
-
__metadata("design:returntype", Promise)
|
|
88
|
-
], MessageEventController.prototype, "updated", null);
|
|
89
|
-
exports.MessageEventController = MessageEventController = MessageEventController_1 = __decorate([
|
|
90
|
-
(0, swagger_1.ApiTags)('Message Event'),
|
|
91
|
-
(0, common_1.Controller)(),
|
|
92
|
-
__param(0, (0, common_1.Inject)(message_service_1.MessageEventService)),
|
|
93
|
-
__metadata("design:paramtypes", [message_service_1.MessageEventService])
|
|
94
|
-
], MessageEventController);
|
|
95
|
-
//# sourceMappingURL=message.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.controller.js","sourceRoot":"","sources":["../../src/messages/message.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAmF;AACnF,6CAAoE;AACpE,kEAAwD;AACxD,gEAA6F;AAE7F,uDAAuD;AAIhD,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAGjC,YAAyC,OAA6C;QAA5B,YAAO,GAAP,OAAO,CAAqB;QAFrE,WAAM,GAAG,IAAI,eAAM,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAA;IAEwB,CAAC;IAgBpF,AAAN,KAAK,CAAC,QAAQ,CAAS,IAAqB;QAC1C,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAEjE,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YACjC,OAAO,EAAE,OAAO,EAAE,uCAAuC,EAAE,CAAA;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,2BAAS,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,kCAAkC,CAAC,CAAA;QACnF,CAAC;IACH,CAAC;IAgBK,AAAN,KAAK,CAAC,OAAO,CAAS,IAAyB;QAC7C,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,G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O,EAAE,EAAE,OAAO,EAAE,oCAAoC,EAAE;SAC3D;KACF,CAAC;IACD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,mBAAU,CAAC,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACnF,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,mBAAU,CAAC,qBAAqB,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IAClF,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,oCAAmB;;qDAS9C;iCArDU,sBAAsB;IAFlC,IAAA,iBAAO,EAAC,eAAe,CAAC;IACxB,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,qCAAmB,CAAC,CAAA;qCAA2B,qCAAmB;GAH3E,sBAAsB,CAsDlC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
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 MessageEventModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.MessageEventModule = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const message_controller_1 = require("./message.controller");
|
|
13
|
-
const message_service_1 = require("./message.service");
|
|
14
|
-
let MessageEventModule = MessageEventModule_1 = class MessageEventModule {
|
|
15
|
-
static forRoot(options) {
|
|
16
|
-
if (!options.eventHandler) {
|
|
17
|
-
throw new Error('Event handler is required but not provided.');
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
module: MessageEventModule_1,
|
|
21
|
-
imports: options.imports,
|
|
22
|
-
controllers: [message_controller_1.MessageEventController],
|
|
23
|
-
providers: [
|
|
24
|
-
message_service_1.MessageEventService,
|
|
25
|
-
{
|
|
26
|
-
provide: 'GLOBAL_MODULE_OPTIONS',
|
|
27
|
-
useValue: options,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
provide: 'MESSAGE_EVENT',
|
|
31
|
-
useClass: options.eventHandler,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
exports.MessageEventModule = MessageEventModule;
|
|
38
|
-
exports.MessageEventModule = MessageEventModule = MessageEventModule_1 = __decorate([
|
|
39
|
-
(0, common_1.Module)({})
|
|
40
|
-
], MessageEventModule);
|
|
41
|
-
//# sourceMappingURL=message.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.module.js","sourceRoot":"","sources":["../../src/messages/message.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAsD;AAItD,6DAA6D;AAC7D,uDAAuD;AAGhD,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAC7B,MAAM,CAAC,OAAO,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAChE,CAAC;QACD,OAAO;YACL,MAAM,EAAE,oBAAkB;YAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,WAAW,EAAE,CAAC,2CAAsB,CAAC;YACrC,SAAS,EAAE;gBACT,qCAAmB;gBACnB;oBACE,OAAO,EAAE,uBAAuB;oBAChC,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,eAAe;oBACxB,QAAQ,EAAE,OAAO,CAAC,YAAY;iBAC/B;aACF;SACF,CAAA;IACH,CAAC;CACF,CAAA;AAtBY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,kBAAkB,CAsB9B"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { MessageReceived } from '@verana-labs/vs-agent-model';
|
|
2
|
-
import { ConnectionsEventService, ConnectionsRepository } from '../connections';
|
|
3
|
-
import { CredentialService } from '../credentials';
|
|
4
|
-
import { EventHandler } from '../interfaces';
|
|
5
|
-
import { MessageEventOptions } from '../types';
|
|
6
|
-
export declare class MessageEventService {
|
|
7
|
-
private options;
|
|
8
|
-
private eventHandler?;
|
|
9
|
-
private credentialService?;
|
|
10
|
-
private connectionRepository?;
|
|
11
|
-
private connectionsEventService?;
|
|
12
|
-
private readonly logger;
|
|
13
|
-
private readonly url;
|
|
14
|
-
private readonly version;
|
|
15
|
-
private readonly apiClient;
|
|
16
|
-
constructor(options: MessageEventOptions, eventHandler?: EventHandler | undefined, credentialService?: CredentialService | undefined, connectionRepository?: ConnectionsRepository | undefined, connectionsEventService?: ConnectionsEventService | undefined);
|
|
17
|
-
received(event: MessageReceived): Promise<void>;
|
|
18
|
-
updated(): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
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 MessageEventService_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.MessageEventService = void 0;
|
|
17
|
-
const credo_ts_didcomm_receipts_1 = require("@2060.io/credo-ts-didcomm-receipts");
|
|
18
|
-
const core_1 = require("@credo-ts/core");
|
|
19
|
-
const didcomm_1 = require("@credo-ts/didcomm");
|
|
20
|
-
const common_1 = require("@nestjs/common");
|
|
21
|
-
const vs_agent_client_1 = require("@verana-labs/vs-agent-client");
|
|
22
|
-
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
23
|
-
const connections_1 = require("../connections");
|
|
24
|
-
const credentials_1 = require("../credentials");
|
|
25
|
-
let MessageEventService = MessageEventService_1 = class MessageEventService {
|
|
26
|
-
constructor(options, eventHandler, credentialService, connectionRepository, connectionsEventService) {
|
|
27
|
-
var _a;
|
|
28
|
-
this.options = options;
|
|
29
|
-
this.eventHandler = eventHandler;
|
|
30
|
-
this.credentialService = credentialService;
|
|
31
|
-
this.connectionRepository = connectionRepository;
|
|
32
|
-
this.connectionsEventService = connectionsEventService;
|
|
33
|
-
this.logger = new common_1.Logger(MessageEventService_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.version = (_a = options.version) !== null && _a !== void 0 ? _a : vs_agent_client_1.ApiVersion.V1;
|
|
38
|
-
if (!credentialService)
|
|
39
|
-
this.logger.warn(`To handle credential events and their revocation, make sure to initialize the CredentialService.`);
|
|
40
|
-
this.apiClient = new vs_agent_client_1.ApiClient(this.url, this.version);
|
|
41
|
-
this.logger.debug(`Initialized with url: ${this.url}, version: ${this.version}`);
|
|
42
|
-
}
|
|
43
|
-
async received(event) {
|
|
44
|
-
var _a;
|
|
45
|
-
const message = event.message;
|
|
46
|
-
const body = new vs_agent_model_1.ReceiptsMessage({
|
|
47
|
-
connectionId: message.connectionId,
|
|
48
|
-
receipts: [
|
|
49
|
-
{
|
|
50
|
-
messageId: message.id,
|
|
51
|
-
state: credo_ts_didcomm_receipts_1.MessageState.Viewed,
|
|
52
|
-
timestamp: new Date(),
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
});
|
|
56
|
-
this.logger.debug(`messageReceived: sent receipts: ${JSON.stringify(body)}`);
|
|
57
|
-
await this.apiClient.messages.send(body);
|
|
58
|
-
if (this.eventHandler) {
|
|
59
|
-
if (message.type === vs_agent_model_1.CredentialReceptionMessage.type) {
|
|
60
|
-
try {
|
|
61
|
-
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.CredentialReceptionMessage);
|
|
62
|
-
const isCredentialDone = msg.state === didcomm_1.DidCommCredentialState.Done;
|
|
63
|
-
if (this.credentialService) {
|
|
64
|
-
if (!msg.threadId)
|
|
65
|
-
throw new Error('threadId is required for credential');
|
|
66
|
-
if (isCredentialDone)
|
|
67
|
-
await this.credentialService.handleAcceptance(msg.threadId);
|
|
68
|
-
else
|
|
69
|
-
await this.credentialService.handleRejection(msg.threadId);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
this.logger.error(`Cannot create the registry: ${error}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else if (this.connectionRepository &&
|
|
77
|
-
this.connectionsEventService &&
|
|
78
|
-
message.type === vs_agent_model_1.ProfileMessage.type) {
|
|
79
|
-
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.ProfileMessage);
|
|
80
|
-
await this.connectionRepository.updateUserProfile(msg.connectionId, Object.assign({}, msg));
|
|
81
|
-
await ((_a = this.connectionsEventService) === null || _a === void 0 ? void 0 : _a.handleNewConnection(msg.connectionId));
|
|
82
|
-
}
|
|
83
|
-
await this.eventHandler.inputMessage(message);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async updated() { }
|
|
87
|
-
};
|
|
88
|
-
exports.MessageEventService = MessageEventService;
|
|
89
|
-
exports.MessageEventService = MessageEventService = MessageEventService_1 = __decorate([
|
|
90
|
-
(0, common_1.Injectable)(),
|
|
91
|
-
__param(0, (0, common_1.Inject)('GLOBAL_MODULE_OPTIONS')),
|
|
92
|
-
__param(1, (0, common_1.Optional)()),
|
|
93
|
-
__param(1, (0, common_1.Inject)('MESSAGE_EVENT')),
|
|
94
|
-
__param(2, (0, common_1.Optional)()),
|
|
95
|
-
__param(2, (0, common_1.Inject)(credentials_1.CredentialService)),
|
|
96
|
-
__param(3, (0, common_1.Optional)()),
|
|
97
|
-
__param(3, (0, common_1.Inject)(connections_1.ConnectionsRepository)),
|
|
98
|
-
__param(4, (0, common_1.Optional)()),
|
|
99
|
-
__param(4, (0, common_1.Inject)(connections_1.ConnectionsEventService)),
|
|
100
|
-
__metadata("design:paramtypes", [Object, Object, credentials_1.CredentialService,
|
|
101
|
-
connections_1.ConnectionsRepository,
|
|
102
|
-
connections_1.ConnectionsEventService])
|
|
103
|
-
], MessageEventService);
|
|
104
|
-
//# sourceMappingURL=message.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.service.js","sourceRoot":"","sources":["../../src/messages/message.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kFAAiE;AACjE,yCAAgD;AAChD,+CAA0D;AAC1D,2CAAqE;AACrE,kEAAoE;AACpE,gEAKoC;AAEpC,gDAA+E;AAC/E,gDAAkD;AAK3C,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAM9B,YACmC,OAAoC,EAChC,YAAmC,EACjC,iBAA6C,EACzC,oBAAoD,EAClD,uBAAyD;;QAJ7D,YAAO,GAAP,OAAO,CAAqB;QACxB,iBAAY,GAA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