dt-common-device 11.2.1 → 12.0.1
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/dist/chronicle/Cronicle.service.d.ts +6 -2
- package/dist/chronicle/Cronicle.service.js +19 -2
- package/dist/chronicle/ICronicle.interface.d.ts +1 -0
- package/dist/constants/ConnectionProviders.d.ts +0 -1
- package/dist/constants/ConnectionProviders.js +0 -1
- package/dist/entities/accessGroup/AccessGroup.repository.d.ts +2 -1
- package/dist/entities/accessGroup/AccessGroup.repository.js +4 -1
- package/dist/entities/accessGroup/AccessGroup.service.d.ts +2 -1
- package/dist/entities/accessGroup/AccessGroup.service.js +4 -3
- package/dist/entities/admin/Admin.repository.d.ts +1 -2
- package/dist/entities/admin/Admin.repository.js +19 -15
- package/dist/entities/admin/Admin.service.d.ts +1 -1
- package/dist/entities/admin/Admin.service.js +2 -2
- package/dist/entities/connection/Connection.repository.d.ts +1 -0
- package/dist/entities/connection/Connection.repository.js +22 -0
- package/dist/entities/connection/Connection.service.d.ts +1 -0
- package/dist/entities/connection/Connection.service.js +3 -0
- package/dist/entities/guest/Guest.repository.d.ts +1 -1
- package/dist/entities/guest/Guest.repository.js +5 -2
- package/dist/entities/guest/Guest.service.d.ts +1 -1
- package/dist/entities/guest/Guest.service.js +4 -1
- package/dist/entities/schedules/Schedule.repository.d.ts +1 -1
- package/dist/entities/schedules/Schedule.repository.js +5 -2
- package/dist/entities/schedules/Schedule.service.d.ts +1 -1
- package/dist/entities/schedules/Schedule.service.js +4 -1
- package/dist/entities/user/User.repository.js +4 -1
- package/dist/entities/user/User.service.d.ts +1 -1
- package/dist/entities/user/User.service.js +4 -1
- package/dist/entities/zone/Zone.service.js +4 -1
- package/dist/issues/Issue.service.js +1 -1
- package/dist/queue/utils/rateLimit.utils.js +0 -6
- package/package.json +1 -1
- package/dist/admin/Admin.repository.d.ts +0 -7
- package/dist/admin/Admin.repository.js +0 -182
- package/dist/admin/Admin.service.d.ts +0 -5
- package/dist/admin/Admin.service.js +0 -17
- package/dist/admin/index.d.ts +0 -1
- package/dist/admin/index.js +0 -17
- package/dist/audit/AuditProperties.d.ts +0 -16
- package/dist/audit/AuditProperties.js +0 -2
- package/dist/chronicle/IChronicle.interface.d.ts +0 -14
- package/dist/chronicle/IChronicle.interface.js +0 -2
- package/dist/chronicle/chronicle.service.d.ts +0 -4
- package/dist/chronicle/chronicle.service.js +0 -44
- package/dist/connection/Connection.repository.d.ts +0 -8
- package/dist/connection/Connection.repository.js +0 -92
- package/dist/connection/Connection.service.d.ts +0 -8
- package/dist/connection/Connection.service.js +0 -32
- package/dist/connection/IConnection.d.ts +0 -28
- package/dist/connection/IConnection.js +0 -16
- package/dist/connection/index.d.ts +0 -2
- package/dist/connection/index.js +0 -18
- package/dist/copilotQueue/examples/CopilotQueue.example.d.ts +0 -37
- package/dist/copilotQueue/examples/CopilotQueue.example.js +0 -140
- package/dist/copilotQueue/examples/index.d.ts +0 -1
- package/dist/copilotQueue/examples/index.js +0 -17
- package/dist/device/cloud/entities/CloudConnection.d.ts +0 -6
- package/dist/device/cloud/entities/CloudConnection.js +0 -6
- package/dist/device/cloud/entities/CloudDevice.d.ts +0 -16
- package/dist/device/cloud/entities/CloudDevice.js +0 -26
- package/dist/device/cloud/entities/CloudDeviceService.d.ts +0 -5
- package/dist/device/cloud/entities/CloudDeviceService.js +0 -9
- package/dist/device/cloud/entities/DeviceFactory.d.ts +0 -7
- package/dist/device/cloud/entities/DeviceFactory.js +0 -80
- package/dist/device/cloud/entities/index.d.ts +0 -3
- package/dist/device/cloud/entities/index.js +0 -19
- package/dist/device/cloud/interface.d.ts +0 -101
- package/dist/device/cloud/interface.js +0 -3
- package/dist/device/cloud/interfaces/ICloudConnection.d.ts +0 -5
- package/dist/device/cloud/interfaces/ICloudConnection.js +0 -2
- package/dist/device/cloud/interfaces/ICloudDevice.d.ts +0 -9
- package/dist/device/cloud/interfaces/ICloudDevice.js +0 -2
- package/dist/device/cloud/interfaces/ICloudDeviceService.d.ts +0 -4
- package/dist/device/cloud/interfaces/ICloudDeviceService.js +0 -2
- package/dist/device/cloud/interfaces/IConnectionService.d.ts +0 -7
- package/dist/device/cloud/interfaces/IConnectionService.js +0 -2
- package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +0 -7
- package/dist/device/cloud/interfaces/IDeviceConnectionService.js +0 -3
- package/dist/device/cloud/interfaces/IDeviceFactory.d.ts +0 -4
- package/dist/device/cloud/interfaces/IDeviceFactory.js +0 -2
- package/dist/device/cloud/interfaces/IDeviceService.d.ts +0 -8
- package/dist/device/cloud/interfaces/IDeviceService.js +0 -2
- package/dist/device/cloud/interfaces/IDevicesService.d.ts +0 -9
- package/dist/device/cloud/interfaces/IDevicesService.js +0 -2
- package/dist/device/cloud/interfaces/IHubService.d.ts +0 -5
- package/dist/device/cloud/interfaces/IHubService.js +0 -2
- package/dist/device/cloud/interfaces/IRawDataTransformer.d.ts +0 -4
- package/dist/device/cloud/interfaces/IRawDataTransformer.js +0 -2
- package/dist/device/cloud/interfaces/IRawDevice.d.ts +0 -17
- package/dist/device/cloud/interfaces/IRawDevice.js +0 -11
- package/dist/device/cloud/interfaces/index.d.ts +0 -5
- package/dist/device/cloud/interfaces/index.js +0 -21
- package/dist/device/cloud/services/CloudDevice.service.d.ts +0 -5
- package/dist/device/cloud/services/CloudDevice.service.js +0 -9
- package/dist/device/cloud/services/Connection.service.d.ts +0 -8
- package/dist/device/cloud/services/Connection.service.js +0 -6
- package/dist/device/cloud/services/Device.service.d.ts +0 -39
- package/dist/device/cloud/services/Device.service.js +0 -9
- package/dist/device/cloud/services/DeviceCloudService.d.ts +0 -42
- package/dist/device/cloud/services/DeviceCloudService.js +0 -59
- package/dist/device/cloud/services/DeviceHub.service.d.ts +0 -3
- package/dist/device/cloud/services/DeviceHub.service.js +0 -6
- package/dist/device/cloud/services/Hub.service.d.ts +0 -25
- package/dist/device/cloud/services/Hub.service.js +0 -9
- package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +0 -38
- package/dist/device/cloud/services/SmartThingsDeviceService.js +0 -52
- package/dist/device/cloud/services/index.d.ts +0 -2
- package/dist/device/cloud/services/index.js +0 -18
- package/dist/device/cloud/types.d.ts +0 -52
- package/dist/device/cloud/types.js +0 -15
- package/dist/device/index.d.ts +0 -4
- package/dist/device/index.js +0 -20
- package/dist/device/local/entities/AlertBuilder.d.ts +0 -87
- package/dist/device/local/entities/AlertBuilder.example.d.ts +0 -11
- package/dist/device/local/entities/AlertBuilder.example.js +0 -117
- package/dist/device/local/entities/AlertBuilder.js +0 -179
- package/dist/device/local/entities/IssueBuilder.d.ts +0 -109
- package/dist/device/local/entities/IssueBuilder.example.d.ts +0 -16
- package/dist/device/local/entities/IssueBuilder.example.js +0 -196
- package/dist/device/local/entities/IssueBuilder.js +0 -237
- package/dist/device/local/entities/index.d.ts +0 -2
- package/dist/device/local/entities/index.js +0 -7
- package/dist/device/local/events/EventHandler.d.ts +0 -11
- package/dist/device/local/events/EventHandler.js +0 -86
- package/dist/device/local/events/Events.d.ts +0 -54
- package/dist/device/local/events/Events.js +0 -57
- package/dist/device/local/events/index.d.ts +0 -2
- package/dist/device/local/events/index.js +0 -7
- package/dist/device/local/handler/EventHandler.d.ts +0 -7
- package/dist/device/local/handler/EventHandler.js +0 -44
- package/dist/device/local/interface.d.ts +0 -0
- package/dist/device/local/interface.js +0 -1
- package/dist/device/local/interfaces/IConnection.d.ts +0 -26
- package/dist/device/local/interfaces/IConnection.js +0 -14
- package/dist/device/local/interfaces/IDevice.d.ts +0 -68
- package/dist/device/local/interfaces/IDevice.js +0 -10
- package/dist/device/local/interfaces/IDtDevice.d.ts +0 -16
- package/dist/device/local/interfaces/IDtDevice.js +0 -2
- package/dist/device/local/interfaces/IHub.d.ts +0 -46
- package/dist/device/local/interfaces/IHub.js +0 -2
- package/dist/device/local/interfaces/IProperty.d.ts +0 -29
- package/dist/device/local/interfaces/IProperty.js +0 -2
- package/dist/device/local/interfaces/ISchedule.d.ts +0 -25
- package/dist/device/local/interfaces/ISchedule.js +0 -2
- package/dist/device/local/interfaces/index.d.ts +0 -3
- package/dist/device/local/interfaces/index.js +0 -19
- package/dist/device/local/models/Alert.model.d.ts +0 -28
- package/dist/device/local/models/Alert.model.js +0 -222
- package/dist/device/local/models/Issue.model.d.ts +0 -28
- package/dist/device/local/models/Issue.model.js +0 -260
- package/dist/device/local/repository/Alert.repository.d.ts +0 -106
- package/dist/device/local/repository/Alert.repository.js +0 -374
- package/dist/device/local/repository/Connection.repository.d.ts +0 -8
- package/dist/device/local/repository/Connection.repository.js +0 -92
- package/dist/device/local/repository/Device.repository.d.ts +0 -30
- package/dist/device/local/repository/Device.repository.js +0 -325
- package/dist/device/local/repository/Hub.repository.d.ts +0 -13
- package/dist/device/local/repository/Hub.repository.js +0 -139
- package/dist/device/local/repository/Issue.repository.d.ts +0 -113
- package/dist/device/local/repository/Issue.repository.js +0 -401
- package/dist/device/local/repository/Property.repository.d.ts +0 -8
- package/dist/device/local/repository/Property.repository.js +0 -95
- package/dist/device/local/repository/Schedule.repository.d.ts +0 -9
- package/dist/device/local/repository/Schedule.repository.js +0 -109
- package/dist/device/local/services/Alert.service.d.ts +0 -137
- package/dist/device/local/services/Alert.service.js +0 -475
- package/dist/device/local/services/AlertService.example.d.ts +0 -55
- package/dist/device/local/services/AlertService.example.js +0 -148
- package/dist/device/local/services/Connection.service.d.ts +0 -8
- package/dist/device/local/services/Connection.service.js +0 -32
- package/dist/device/local/services/Device.service.d.ts +0 -40
- package/dist/device/local/services/Device.service.js +0 -391
- package/dist/device/local/services/DeviceHub.service.d.ts +0 -11
- package/dist/device/local/services/DeviceHub.service.js +0 -40
- package/dist/device/local/services/Hub.service.d.ts +0 -12
- package/dist/device/local/services/Hub.service.js +0 -107
- package/dist/device/local/services/Issue.service.d.ts +0 -168
- package/dist/device/local/services/Issue.service.js +0 -642
- package/dist/device/local/services/IssueService.example.d.ts +0 -68
- package/dist/device/local/services/IssueService.example.js +0 -177
- package/dist/device/local/services/Property.service.d.ts +0 -8
- package/dist/device/local/services/Property.service.js +0 -36
- package/dist/device/local/services/Schedule.service.d.ts +0 -9
- package/dist/device/local/services/Schedule.service.js +0 -26
- package/dist/device/local/services/index.d.ts +0 -3
- package/dist/device/local/services/index.js +0 -19
- package/dist/pms/IPms.d.ts +0 -6
- package/dist/pms/IPms.js +0 -10
- package/dist/pms/index.d.ts +0 -1
- package/dist/pms/index.js +0 -18
- package/dist/pms/webhookQueue/examples/index.d.ts +0 -2
- package/dist/pms/webhookQueue/examples/index.js +0 -18
- package/dist/pms/webhookQueue/examples/pms-integration.d.ts +0 -65
- package/dist/pms/webhookQueue/examples/pms-integration.js +0 -254
- package/dist/pms/webhookQueue/examples/usage.d.ts +0 -7
- package/dist/pms/webhookQueue/examples/usage.js +0 -175
- package/dist/pms/webhookQueue/index.d.ts +0 -3
- package/dist/pms/webhookQueue/index.js +0 -20
- package/dist/pms/webhookQueue/interfaces/IWebhookQueue.d.ts +0 -33
- package/dist/pms/webhookQueue/interfaces/IWebhookQueue.js +0 -2
- package/dist/pms/webhookQueue/interfaces/IWebhookWorker.d.ts +0 -38
- package/dist/pms/webhookQueue/interfaces/IWebhookWorker.js +0 -2
- package/dist/pms/webhookQueue/interfaces/index.d.ts +0 -1
- package/dist/pms/webhookQueue/interfaces/index.js +0 -17
- package/dist/pms/webhookQueue/services/WebhookQueueFactory.d.ts +0 -38
- package/dist/pms/webhookQueue/services/WebhookQueueFactory.js +0 -131
- package/dist/pms/webhookQueue/services/WebhookQueueIntegration.d.ts +0 -70
- package/dist/pms/webhookQueue/services/WebhookQueueIntegration.js +0 -207
- package/dist/pms/webhookQueue/services/WebhookQueueService.d.ts +0 -45
- package/dist/pms/webhookQueue/services/WebhookQueueService.js +0 -270
- package/dist/pms/webhookQueue/services/WebhookWorker.d.ts +0 -37
- package/dist/pms/webhookQueue/services/WebhookWorker.js +0 -201
- package/dist/pms/webhookQueue/services/index.d.ts +0 -1
- package/dist/pms/webhookQueue/services/index.js +0 -17
- package/dist/pms/webhookQueue/types/index.d.ts +0 -1
- package/dist/pms/webhookQueue/types/index.js +0 -17
- package/dist/pms/webhookQueue/types/webhook.types.d.ts +0 -39
- package/dist/pms/webhookQueue/types/webhook.types.js +0 -2
- package/dist/property/IProperty.d.ts +0 -29
- package/dist/property/IProperty.js +0 -2
- package/dist/property/Property.repository.d.ts +0 -8
- package/dist/property/Property.repository.js +0 -109
- package/dist/property/Property.service.d.ts +0 -8
- package/dist/property/Property.service.js +0 -124
- package/dist/property/index.d.ts +0 -2
- package/dist/property/index.js +0 -18
- package/dist/queue/interfaces/IHttpRequestJob.d.ts +0 -9
- package/dist/queue/interfaces/IHttpRequestJob.js +0 -2
- package/dist/types/alert.types.d.ts +0 -57
- package/dist/types/alert.types.js +0 -22
- package/dist/types/config.types.d.ts +0 -19
- package/dist/types/config.types.js +0 -2
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.js +0 -19
- package/dist/types/issue.types.d.ts +0 -90
- package/dist/types/issue.types.js +0 -40
- package/dist/utils/http-utils.d.ts +0 -13
- package/dist/utils/http-utils.js +0 -117
|
@@ -1,270 +0,0 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
19
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
20
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
21
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
22
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
23
|
-
var _, done = false;
|
|
24
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
25
|
-
var context = {};
|
|
26
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
27
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
28
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
29
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
30
|
-
if (kind === "accessor") {
|
|
31
|
-
if (result === void 0) continue;
|
|
32
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
33
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
34
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
35
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
36
|
-
}
|
|
37
|
-
else if (_ = accept(result)) {
|
|
38
|
-
if (kind === "field") initializers.unshift(_);
|
|
39
|
-
else descriptor[key] = _;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
43
|
-
done = true;
|
|
44
|
-
};
|
|
45
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
46
|
-
var useValue = arguments.length > 2;
|
|
47
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
48
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
49
|
-
}
|
|
50
|
-
return useValue ? value : void 0;
|
|
51
|
-
};
|
|
52
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
53
|
-
var ownKeys = function(o) {
|
|
54
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
55
|
-
var ar = [];
|
|
56
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
57
|
-
return ar;
|
|
58
|
-
};
|
|
59
|
-
return ownKeys(o);
|
|
60
|
-
};
|
|
61
|
-
return function (mod) {
|
|
62
|
-
if (mod && mod.__esModule) return mod;
|
|
63
|
-
var result = {};
|
|
64
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
65
|
-
__setModuleDefault(result, mod);
|
|
66
|
-
return result;
|
|
67
|
-
};
|
|
68
|
-
})();
|
|
69
|
-
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
70
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
71
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
72
|
-
};
|
|
73
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
|
-
exports.WebhookQueueService = void 0;
|
|
75
|
-
const typedi_1 = require("typedi");
|
|
76
|
-
const redis_1 = require("../../../db/redis");
|
|
77
|
-
let WebhookQueueService = (() => {
|
|
78
|
-
let _classDecorators = [(0, typedi_1.Service)()];
|
|
79
|
-
let _classDescriptor;
|
|
80
|
-
let _classExtraInitializers = [];
|
|
81
|
-
let _classThis;
|
|
82
|
-
var WebhookQueueService = _classThis = class {
|
|
83
|
-
constructor() {
|
|
84
|
-
this.webhookQueues = new Map(); // BullMQ Queue instances
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Generate queue name based on propertyId and pmsType
|
|
88
|
-
* Format: propertyId_pmsType_webhook
|
|
89
|
-
*/
|
|
90
|
-
generateQueueName(propertyId, pmsType) {
|
|
91
|
-
return `${propertyId}_${pmsType}_webhook`;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Add a webhook to the appropriate queue based on propertyId and pmsType
|
|
95
|
-
* Creates queue if it doesn't exist
|
|
96
|
-
*/
|
|
97
|
-
async addWebhookToQueue(propertyId, pmsType, webhookData, options) {
|
|
98
|
-
const queueName = this.generateQueueName(propertyId, pmsType);
|
|
99
|
-
// Get or create queue using the static method
|
|
100
|
-
const queue = await WebhookQueueService.getOrCreateQueue(queueName, this.webhookQueues);
|
|
101
|
-
// Add job to queue immediately with 5 minute TTL
|
|
102
|
-
const job = await queue.add("webhook-job", {
|
|
103
|
-
propertyId,
|
|
104
|
-
pmsType,
|
|
105
|
-
webhookData,
|
|
106
|
-
timestamp: new Date().toISOString(),
|
|
107
|
-
}, {
|
|
108
|
-
removeOnComplete: { age: 5 * 60 }, // Remove after 5 minutes
|
|
109
|
-
removeOnFail: { age: 5 * 60 }, // Remove failed jobs after 5 minutes
|
|
110
|
-
attempts: 1, // Only try once
|
|
111
|
-
});
|
|
112
|
-
return job.id;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Mark a webhook job as completed (processed successfully)
|
|
116
|
-
* Note: Jobs are now removed immediately when polled, so this method is for logging purposes
|
|
117
|
-
*/
|
|
118
|
-
async markWebhookCompleted(propertyId, pmsType, jobId) {
|
|
119
|
-
// Jobs are removed immediately when polled, so just log completion
|
|
120
|
-
console.log(`Webhook job ${jobId} marked as completed for ${propertyId}_${pmsType}`);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Mark a webhook job as failed
|
|
124
|
-
* Note: Jobs are now removed immediately when polled, so this method is for logging purposes
|
|
125
|
-
*/
|
|
126
|
-
async markWebhookFailed(propertyId, pmsType, jobId, error) {
|
|
127
|
-
// Jobs are removed immediately when polled, so just log failure
|
|
128
|
-
console.error(`Webhook job ${jobId} marked as failed for ${propertyId}_${pmsType}: ${error || "Unknown error"}`);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Poll available webhook from ANY available webhook queue in Redis
|
|
132
|
-
* This method will discover all queues in Redis and filter only webhook queues
|
|
133
|
-
*/
|
|
134
|
-
async pollWebhookFromQueues() {
|
|
135
|
-
try {
|
|
136
|
-
// Get all queue names from Redis (not just local Map)
|
|
137
|
-
const redisClient = (0, redis_1.getRedisClient)();
|
|
138
|
-
const queueKeys = await redisClient.keys("bull:*:id");
|
|
139
|
-
// Filter only webhook queues (PropertyId_pmsType_webhook pattern)
|
|
140
|
-
const webhookQueueKeys = queueKeys
|
|
141
|
-
.map((key) => key.replace("bull:", "").replace(":id", ""))
|
|
142
|
-
.filter((queueName) => {
|
|
143
|
-
const parts = queueName.split("_");
|
|
144
|
-
return parts.length === 3 && parts[2] === "webhook";
|
|
145
|
-
});
|
|
146
|
-
// Check each webhook queue for waiting jobs
|
|
147
|
-
for (const queueName of webhookQueueKeys) {
|
|
148
|
-
try {
|
|
149
|
-
// Create queue instance if not exists locally
|
|
150
|
-
if (!this.webhookQueues.has(queueName)) {
|
|
151
|
-
const { Queue } = await Promise.resolve().then(() => __importStar(require("bullmq")));
|
|
152
|
-
const queue = new Queue(queueName, {
|
|
153
|
-
connection: (0, redis_1.getRedisClient)(),
|
|
154
|
-
});
|
|
155
|
-
this.webhookQueues.set(queueName, queue);
|
|
156
|
-
}
|
|
157
|
-
const queue = this.webhookQueues.get(queueName);
|
|
158
|
-
// Get waiting jobs and take the first one
|
|
159
|
-
const waitingJobs = await queue.getWaiting(0, 1);
|
|
160
|
-
if (waitingJobs.length > 0) {
|
|
161
|
-
const job = waitingJobs[0];
|
|
162
|
-
// Remove the job from the queue to prevent duplicate processing
|
|
163
|
-
await job.remove();
|
|
164
|
-
// Extract propertyId and pmsType from queue name
|
|
165
|
-
const parts = queueName.split("_");
|
|
166
|
-
const propertyId = parts[0];
|
|
167
|
-
const pmsType = parts[1];
|
|
168
|
-
return {
|
|
169
|
-
jobId: job.id,
|
|
170
|
-
data: job.data,
|
|
171
|
-
propertyId,
|
|
172
|
-
pmsType,
|
|
173
|
-
queueName,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
catch (error) {
|
|
178
|
-
console.error(`Error checking queue ${queueName}:`, error);
|
|
179
|
-
continue; // Try next queue
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return null; // No jobs available in any webhook queue
|
|
183
|
-
}
|
|
184
|
-
catch (error) {
|
|
185
|
-
console.error("Error discovering queues from Redis:", error);
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Get all available webhook queue names from Redis
|
|
191
|
-
*/
|
|
192
|
-
async getAllQueueNames() {
|
|
193
|
-
try {
|
|
194
|
-
const redisClient = (0, redis_1.getRedisClient)();
|
|
195
|
-
const queueKeys = await redisClient.keys("bull:*:id");
|
|
196
|
-
// Filter only webhook queues (PropertyId_pmsType_webhook pattern)
|
|
197
|
-
return queueKeys
|
|
198
|
-
.map((key) => key.replace("bull:", "").replace(":id", ""))
|
|
199
|
-
.filter((queueName) => {
|
|
200
|
-
const parts = queueName.split("_");
|
|
201
|
-
return parts.length === 3 && parts[2] === "webhook";
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
console.error("Error getting queue names from Redis:", error);
|
|
206
|
-
return [];
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Get total waiting count across all webhook queues
|
|
211
|
-
*/
|
|
212
|
-
async getTotalWaitingCount() {
|
|
213
|
-
try {
|
|
214
|
-
const redisClient = (0, redis_1.getRedisClient)();
|
|
215
|
-
const queueKeys = await redisClient.keys("bull:*:id");
|
|
216
|
-
let totalCount = 0;
|
|
217
|
-
// Filter only webhook queues and count waiting jobs
|
|
218
|
-
for (const key of queueKeys) {
|
|
219
|
-
const queueName = key.replace("bull:", "").replace(":id", "");
|
|
220
|
-
const parts = queueName.split("_");
|
|
221
|
-
// Only count webhook queues
|
|
222
|
-
if (parts.length === 3 && parts[2] === "webhook") {
|
|
223
|
-
try {
|
|
224
|
-
// Create queue instance if not exists locally
|
|
225
|
-
if (!this.webhookQueues.has(queueName)) {
|
|
226
|
-
const { Queue } = await Promise.resolve().then(() => __importStar(require("bullmq")));
|
|
227
|
-
const queue = new Queue(queueName, {
|
|
228
|
-
connection: (0, redis_1.getRedisClient)(),
|
|
229
|
-
});
|
|
230
|
-
this.webhookQueues.set(queueName, queue);
|
|
231
|
-
}
|
|
232
|
-
const queue = this.webhookQueues.get(queueName);
|
|
233
|
-
const waitingJobs = await queue.getWaiting();
|
|
234
|
-
totalCount += waitingJobs.length;
|
|
235
|
-
}
|
|
236
|
-
catch (error) {
|
|
237
|
-
console.error(`Error getting count for queue ${queueName}:`, error);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return totalCount;
|
|
242
|
-
}
|
|
243
|
-
catch (error) {
|
|
244
|
-
console.error("Error getting total waiting count:", error);
|
|
245
|
-
return 0;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
static async getOrCreateQueue(queueKey, queues) {
|
|
249
|
-
if (queues.has(queueKey)) {
|
|
250
|
-
return queues.get(queueKey);
|
|
251
|
-
}
|
|
252
|
-
const { Queue } = await Promise.resolve().then(() => __importStar(require("bullmq")));
|
|
253
|
-
const queue = new Queue(queueKey, {
|
|
254
|
-
connection: (0, redis_1.getRedisClient)(),
|
|
255
|
-
});
|
|
256
|
-
queues.set(queueKey, queue);
|
|
257
|
-
return queue;
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
__setFunctionName(_classThis, "WebhookQueueService");
|
|
261
|
-
(() => {
|
|
262
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
263
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
264
|
-
WebhookQueueService = _classThis = _classDescriptor.value;
|
|
265
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
266
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
267
|
-
})();
|
|
268
|
-
return WebhookQueueService = _classThis;
|
|
269
|
-
})();
|
|
270
|
-
exports.WebhookQueueService = WebhookQueueService;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Worker } from "bullmq";
|
|
2
|
-
import { Redis } from "ioredis";
|
|
3
|
-
import { IWebhookWorker } from "../interfaces";
|
|
4
|
-
import { IWebhookJobData, IWebhookProcessingResult } from "../types/webhook.types";
|
|
5
|
-
export declare class WebhookWorker implements IWebhookWorker {
|
|
6
|
-
private worker;
|
|
7
|
-
private webhookProcessor;
|
|
8
|
-
private redisConnection;
|
|
9
|
-
private isRunning;
|
|
10
|
-
private processedJobs;
|
|
11
|
-
private failedJobs;
|
|
12
|
-
private lastProcessedAt?;
|
|
13
|
-
constructor(redisConnection: Redis);
|
|
14
|
-
startProcessing(queueName: string): Promise<void>;
|
|
15
|
-
stopProcessing(): Promise<void>;
|
|
16
|
-
processWebhookJob(jobData: IWebhookJobData): Promise<IWebhookProcessingResult>;
|
|
17
|
-
handleError(error: Error, jobData: IWebhookJobData): Promise<void>;
|
|
18
|
-
getWorkerStatus(): Promise<{
|
|
19
|
-
isRunning: boolean;
|
|
20
|
-
processedJobs: number;
|
|
21
|
-
failedJobs: number;
|
|
22
|
-
lastProcessedAt?: string;
|
|
23
|
-
}>;
|
|
24
|
-
setWebhookProcessor(processor: (webhookData: any, pmsType: string) => Promise<any>): void;
|
|
25
|
-
/**
|
|
26
|
-
* Get the underlying BullMQ worker instance
|
|
27
|
-
*/
|
|
28
|
-
getWorker(): Worker | null;
|
|
29
|
-
/**
|
|
30
|
-
* Check if the worker is currently processing
|
|
31
|
-
*/
|
|
32
|
-
isWorkerRunning(): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Reset worker statistics
|
|
35
|
-
*/
|
|
36
|
-
resetStats(): void;
|
|
37
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
28
|
-
};
|
|
29
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
-
var useValue = arguments.length > 2;
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
35
|
-
};
|
|
36
|
-
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.WebhookWorker = void 0;
|
|
42
|
-
const bullmq_1 = require("bullmq");
|
|
43
|
-
const typedi_1 = require("typedi");
|
|
44
|
-
let WebhookWorker = (() => {
|
|
45
|
-
let _classDecorators = [(0, typedi_1.Service)()];
|
|
46
|
-
let _classDescriptor;
|
|
47
|
-
let _classExtraInitializers = [];
|
|
48
|
-
let _classThis;
|
|
49
|
-
var WebhookWorker = _classThis = class {
|
|
50
|
-
constructor(redisConnection) {
|
|
51
|
-
this.worker = null;
|
|
52
|
-
this.webhookProcessor = null;
|
|
53
|
-
this.isRunning = false;
|
|
54
|
-
this.processedJobs = 0;
|
|
55
|
-
this.failedJobs = 0;
|
|
56
|
-
this.redisConnection = redisConnection;
|
|
57
|
-
}
|
|
58
|
-
async startProcessing(queueName) {
|
|
59
|
-
if (this.isRunning) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
this.worker = new bullmq_1.Worker(queueName, async (job) => {
|
|
63
|
-
try {
|
|
64
|
-
const startTime = Date.now();
|
|
65
|
-
const result = await this.processWebhookJob(job.data);
|
|
66
|
-
const processingTime = Date.now() - startTime;
|
|
67
|
-
this.processedJobs++;
|
|
68
|
-
this.lastProcessedAt = new Date().toISOString();
|
|
69
|
-
return {
|
|
70
|
-
...result,
|
|
71
|
-
processingTime,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
this.failedJobs++;
|
|
76
|
-
await this.handleError(error, job.data);
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
connection: this.redisConnection,
|
|
81
|
-
lockDuration: 300000, // 5 minutes lock duration
|
|
82
|
-
stalledInterval: 60000, // 1 minute stall check interval
|
|
83
|
-
concurrency: 1, // Process one webhook at a time per queue
|
|
84
|
-
});
|
|
85
|
-
// Set up event handlers
|
|
86
|
-
this.worker.on("completed", (job) => {
|
|
87
|
-
console.log(`[Webhook Worker] Job ${job.id} completed successfully for queue ${queueName}`);
|
|
88
|
-
});
|
|
89
|
-
this.worker.on("failed", (job, err) => {
|
|
90
|
-
if (job) {
|
|
91
|
-
console.error(`[Webhook Worker] Job ${job.id} failed for queue ${queueName} with error: ${err.message}`);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
console.error(`[Webhook Worker] Unknown job failed for queue ${queueName} with error: ${err.message}`);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
this.worker.on("error", (err) => {
|
|
98
|
-
console.error(`[Webhook Worker] Worker error for queue ${queueName}:`, err);
|
|
99
|
-
});
|
|
100
|
-
this.worker.on("stalled", (jobId) => {
|
|
101
|
-
console.warn(`[Webhook Worker] Job ${jobId} stalled in queue ${queueName}`);
|
|
102
|
-
});
|
|
103
|
-
this.isRunning = true;
|
|
104
|
-
console.log(`[Webhook Worker] Started processing queue: ${queueName}`);
|
|
105
|
-
}
|
|
106
|
-
async stopProcessing() {
|
|
107
|
-
if (!this.isRunning || !this.worker) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
await this.worker.close();
|
|
111
|
-
this.worker = null;
|
|
112
|
-
this.isRunning = false;
|
|
113
|
-
console.log("[Webhook Worker] Stopped processing");
|
|
114
|
-
}
|
|
115
|
-
async processWebhookJob(jobData) {
|
|
116
|
-
if (!this.webhookProcessor) {
|
|
117
|
-
throw new Error("Webhook processor not set");
|
|
118
|
-
}
|
|
119
|
-
try {
|
|
120
|
-
const startTime = Date.now();
|
|
121
|
-
// Process the webhook using the provided processor function
|
|
122
|
-
await this.webhookProcessor(jobData.webhookData, jobData.pmsType);
|
|
123
|
-
const processingTime = Date.now() - startTime;
|
|
124
|
-
return {
|
|
125
|
-
success: true,
|
|
126
|
-
propertyId: jobData.propertyId,
|
|
127
|
-
pmsType: jobData.pmsType,
|
|
128
|
-
timestamp: jobData.timestamp,
|
|
129
|
-
processingTime,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
const processingTime = Date.now() - Date.parse(jobData.timestamp);
|
|
134
|
-
return {
|
|
135
|
-
success: false,
|
|
136
|
-
propertyId: jobData.propertyId,
|
|
137
|
-
pmsType: jobData.pmsType,
|
|
138
|
-
timestamp: jobData.timestamp,
|
|
139
|
-
error: error.message,
|
|
140
|
-
processingTime,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
async handleError(error, jobData) {
|
|
145
|
-
console.error(`[Webhook Worker] Error processing webhook for property: ${jobData.propertyId}, PMS: ${jobData.pmsType}:`, error);
|
|
146
|
-
// Log additional context
|
|
147
|
-
console.error(`[Webhook Worker] Job data:`, {
|
|
148
|
-
propertyId: jobData.propertyId,
|
|
149
|
-
pmsType: jobData.pmsType,
|
|
150
|
-
timestamp: jobData.timestamp,
|
|
151
|
-
retryCount: jobData.retryCount,
|
|
152
|
-
});
|
|
153
|
-
// You can add additional error handling here:
|
|
154
|
-
// - Send to error monitoring service
|
|
155
|
-
// - Create error tickets
|
|
156
|
-
// - Notify administrators
|
|
157
|
-
// - Log to external logging service
|
|
158
|
-
}
|
|
159
|
-
async getWorkerStatus() {
|
|
160
|
-
return {
|
|
161
|
-
isRunning: this.isRunning,
|
|
162
|
-
processedJobs: this.processedJobs,
|
|
163
|
-
failedJobs: this.failedJobs,
|
|
164
|
-
lastProcessedAt: this.lastProcessedAt,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
setWebhookProcessor(processor) {
|
|
168
|
-
this.webhookProcessor = processor;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Get the underlying BullMQ worker instance
|
|
172
|
-
*/
|
|
173
|
-
getWorker() {
|
|
174
|
-
return this.worker;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Check if the worker is currently processing
|
|
178
|
-
*/
|
|
179
|
-
isWorkerRunning() {
|
|
180
|
-
return this.isRunning && this.worker !== null;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Reset worker statistics
|
|
184
|
-
*/
|
|
185
|
-
resetStats() {
|
|
186
|
-
this.processedJobs = 0;
|
|
187
|
-
this.failedJobs = 0;
|
|
188
|
-
this.lastProcessedAt = undefined;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
__setFunctionName(_classThis, "WebhookWorker");
|
|
192
|
-
(() => {
|
|
193
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
194
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
195
|
-
WebhookWorker = _classThis = _classDescriptor.value;
|
|
196
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
197
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
198
|
-
})();
|
|
199
|
-
return WebhookWorker = _classThis;
|
|
200
|
-
})();
|
|
201
|
-
exports.WebhookWorker = WebhookWorker;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./WebhookQueueService";
|
|
@@ -1,17 +0,0 @@
|
|
|
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("./WebhookQueueService"), exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./webhook.types";
|
|
@@ -1,17 +0,0 @@
|
|
|
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("./webhook.types"), exports);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export interface IWebhookJobData {
|
|
2
|
-
propertyId: string;
|
|
3
|
-
pmsType: string;
|
|
4
|
-
webhookData: any;
|
|
5
|
-
timestamp: string;
|
|
6
|
-
retryCount?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface IWebhookQueueConfig {
|
|
9
|
-
redisHost: string;
|
|
10
|
-
redisPort: number;
|
|
11
|
-
maxRetries?: number;
|
|
12
|
-
backoffDelay?: number;
|
|
13
|
-
jobTimeout?: number;
|
|
14
|
-
removeOnComplete?: {
|
|
15
|
-
age: number;
|
|
16
|
-
count: number;
|
|
17
|
-
};
|
|
18
|
-
removeOnFail?: {
|
|
19
|
-
age: number;
|
|
20
|
-
count: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface IWebhookQueueStatus {
|
|
24
|
-
waiting: number;
|
|
25
|
-
active: number;
|
|
26
|
-
completed: number;
|
|
27
|
-
failed: number;
|
|
28
|
-
delayed?: number;
|
|
29
|
-
}
|
|
30
|
-
export interface IWebhookQueueOptions {
|
|
31
|
-
priority?: number;
|
|
32
|
-
delay?: number;
|
|
33
|
-
attempts?: number;
|
|
34
|
-
backoff?: {
|
|
35
|
-
type: "exponential" | "fixed";
|
|
36
|
-
delay: number;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export type PMS_TYPE = "CLOUDBEDS" | "HOTELKEY" | "STAYNTOUCH";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export interface IProperty {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
apartment: string;
|
|
5
|
-
city: string;
|
|
6
|
-
country: string;
|
|
7
|
-
state: string;
|
|
8
|
-
street: string;
|
|
9
|
-
zipCode: string;
|
|
10
|
-
createdBy?: string;
|
|
11
|
-
isDeleted: boolean;
|
|
12
|
-
imageURL: string;
|
|
13
|
-
timezone: string;
|
|
14
|
-
officialName?: string;
|
|
15
|
-
sameAsOfficialName?: boolean;
|
|
16
|
-
phoneNumber?: string;
|
|
17
|
-
phoneNumberCountryCode?: string;
|
|
18
|
-
propertyKey?: string;
|
|
19
|
-
hubNetworkId?: string;
|
|
20
|
-
isTimeZoneOverridden: boolean;
|
|
21
|
-
createdAt: string;
|
|
22
|
-
updatedAt: string;
|
|
23
|
-
propertyBillingId?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface IPropertySettings {
|
|
26
|
-
id: string;
|
|
27
|
-
propertyId: string;
|
|
28
|
-
settings: Record<string, any>;
|
|
29
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IProperty, IPropertySettings } from "./IProperty";
|
|
2
|
-
export declare class PropertyRepository {
|
|
3
|
-
private readonly postgres;
|
|
4
|
-
constructor();
|
|
5
|
-
getPropertyPreferences(propertyId: string, keys?: string[]): Promise<IPropertySettings | null>;
|
|
6
|
-
getProperty(propertyId: string): Promise<IProperty | null>;
|
|
7
|
-
getAllProperties(): Promise<any[]>;
|
|
8
|
-
}
|