@dv4resi/dvss-backend-module-offering-im 0.0.1 → 0.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,1164 @@
1
+ 'use strict';
2
+
3
+ var common = require('@nestjs/common');
4
+ var dotenv = require('dotenv');
5
+ var path = require('path');
6
+ var dvssBackendModuleUtility = require('@dv4resi/dvss-backend-module-utility');
7
+ var axios = require('@nestjs/axios');
8
+ var config = require('@nestjs/config');
9
+ var rxjs = require('rxjs');
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
+ function _ts_decorate(decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ 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;
17
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ }
19
+ __name(_ts_decorate, "_ts_decorate");
20
+ function _ts_metadata(k, v) {
21
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
+ }
23
+ __name(_ts_metadata, "_ts_metadata");
24
+ var AppService = class {
25
+ static {
26
+ __name(this, "AppService");
27
+ }
28
+ constructor() {
29
+ }
30
+ getHello() {
31
+ return "Hello World!";
32
+ }
33
+ };
34
+ AppService = _ts_decorate([
35
+ common.Injectable(),
36
+ _ts_metadata("design:type", Function),
37
+ _ts_metadata("design:paramtypes", [])
38
+ ], AppService);
39
+
40
+ // src/app.controller.ts
41
+ function _ts_decorate2(decorators, target, key, desc) {
42
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44
+ 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;
45
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
46
+ }
47
+ __name(_ts_decorate2, "_ts_decorate");
48
+ function _ts_metadata2(k, v) {
49
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
50
+ }
51
+ __name(_ts_metadata2, "_ts_metadata");
52
+ var AppController = class {
53
+ static {
54
+ __name(this, "AppController");
55
+ }
56
+ appService;
57
+ constructor(appService) {
58
+ this.appService = appService;
59
+ }
60
+ getHello() {
61
+ return this.appService.getHello();
62
+ }
63
+ };
64
+ _ts_decorate2([
65
+ common.Get("offering-im"),
66
+ _ts_metadata2("design:type", Function),
67
+ _ts_metadata2("design:paramtypes", []),
68
+ _ts_metadata2("design:returntype", String)
69
+ ], AppController.prototype, "getHello", null);
70
+ AppController = _ts_decorate2([
71
+ common.Controller(),
72
+ _ts_metadata2("design:type", Function),
73
+ _ts_metadata2("design:paramtypes", [
74
+ typeof AppService === "undefined" ? Object : AppService
75
+ ])
76
+ ], AppController);
77
+ var rootEnvPath = path.resolve(__dirname, "../../../.env");
78
+ dotenv.config({
79
+ path: rootEnvPath
80
+ });
81
+ function _ts_decorate3(decorators, target, key, desc) {
82
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
83
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
84
+ 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;
85
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
86
+ }
87
+ __name(_ts_decorate3, "_ts_decorate");
88
+ function _ts_metadata3(k, v) {
89
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
90
+ }
91
+ __name(_ts_metadata3, "_ts_metadata");
92
+ var AppService2 = class {
93
+ static {
94
+ __name(this, "AppService");
95
+ }
96
+ /**
97
+ * Creates an instance of the app service
98
+ */
99
+ constructor() {
100
+ }
101
+ getHello() {
102
+ console.log(`${this.constructor.name}::getHello`);
103
+ return "Hello World!";
104
+ }
105
+ };
106
+ AppService2 = _ts_decorate3([
107
+ common.Injectable(),
108
+ _ts_metadata3("design:type", Function),
109
+ _ts_metadata3("design:paramtypes", [])
110
+ ], AppService2);
111
+
112
+ // ../../packages/dvss-integration-trybe/src/app.controller.ts
113
+ function _ts_decorate4(decorators, target, key, desc) {
114
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
115
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
116
+ 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;
117
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
118
+ }
119
+ __name(_ts_decorate4, "_ts_decorate");
120
+ function _ts_metadata4(k, v) {
121
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
122
+ }
123
+ __name(_ts_metadata4, "_ts_metadata");
124
+ var AppController2 = class {
125
+ static {
126
+ __name(this, "AppController");
127
+ }
128
+ appService;
129
+ constructor(appService) {
130
+ this.appService = appService;
131
+ }
132
+ getHello() {
133
+ return this.appService.getHello();
134
+ }
135
+ };
136
+ _ts_decorate4([
137
+ common.Get("integration-trybe"),
138
+ _ts_metadata4("design:type", Function),
139
+ _ts_metadata4("design:paramtypes", []),
140
+ _ts_metadata4("design:returntype", String)
141
+ ], AppController2.prototype, "getHello", null);
142
+ AppController2 = _ts_decorate4([
143
+ common.Controller(),
144
+ _ts_metadata4("design:type", Function),
145
+ _ts_metadata4("design:paramtypes", [
146
+ typeof AppService2 === "undefined" ? Object : AppService2
147
+ ])
148
+ ], AppController2);
149
+ var rootEnvPath2 = path.resolve(__dirname, "../../../.env");
150
+ dotenv.config({
151
+ path: rootEnvPath2
152
+ });
153
+ function _ts_decorate5(decorators, target, key, desc) {
154
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
155
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
156
+ 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;
157
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
158
+ }
159
+ __name(_ts_decorate5, "_ts_decorate");
160
+ var AppService3 = class {
161
+ static {
162
+ __name(this, "AppService");
163
+ }
164
+ getHello() {
165
+ return "Hello World!";
166
+ }
167
+ };
168
+ AppService3 = _ts_decorate5([
169
+ common.Injectable()
170
+ ], AppService3);
171
+
172
+ // ../../packages/dvss-integration-libs/src/app.controller.ts
173
+ function _ts_decorate6(decorators, target, key, desc) {
174
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
175
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
176
+ 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;
177
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
178
+ }
179
+ __name(_ts_decorate6, "_ts_decorate");
180
+ function _ts_metadata5(k, v) {
181
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
182
+ }
183
+ __name(_ts_metadata5, "_ts_metadata");
184
+ var AppController3 = class {
185
+ static {
186
+ __name(this, "AppController");
187
+ }
188
+ appService;
189
+ constructor(appService) {
190
+ this.appService = appService;
191
+ }
192
+ getHello() {
193
+ return this.appService.getHello();
194
+ }
195
+ };
196
+ _ts_decorate6([
197
+ common.Get("integration-libs"),
198
+ _ts_metadata5("design:type", Function),
199
+ _ts_metadata5("design:paramtypes", []),
200
+ _ts_metadata5("design:returntype", String)
201
+ ], AppController3.prototype, "getHello", null);
202
+ AppController3 = _ts_decorate6([
203
+ common.Controller(),
204
+ _ts_metadata5("design:type", Function),
205
+ _ts_metadata5("design:paramtypes", [
206
+ typeof AppService3 === "undefined" ? Object : AppService3
207
+ ])
208
+ ], AppController3);
209
+ function _ts_decorate7(decorators, target, key, desc) {
210
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
211
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
212
+ 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;
213
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
214
+ }
215
+ __name(_ts_decorate7, "_ts_decorate");
216
+ function _ts_metadata6(k, v) {
217
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
218
+ }
219
+ __name(_ts_metadata6, "_ts_metadata");
220
+ var IntegrationRequestLoggerService = class _IntegrationRequestLoggerService {
221
+ static {
222
+ __name(this, "IntegrationRequestLoggerService");
223
+ }
224
+ logger;
225
+ className = _IntegrationRequestLoggerService.name;
226
+ constructor(logger) {
227
+ this.logger = logger;
228
+ }
229
+ /**
230
+ * Log integration request (before making the API call)
231
+ *
232
+ * @param logData - The request log data to be logged
233
+ */
234
+ logRequest(logData) {
235
+ const { loggedInUserId, method, url, headers, requestBody } = logData;
236
+ this.logger.info(loggedInUserId || dvssBackendModuleUtility.SYSTEM_USER_ID, this.logRequest.name, this.className, `Integration API Request: ${method} ${url}`, {
237
+ integrationId: logData.integrationId,
238
+ method,
239
+ url,
240
+ headers: this.sanitizeHeaders(headers),
241
+ requestBody,
242
+ timestamp: logData.timestamp || /* @__PURE__ */ new Date()
243
+ });
244
+ }
245
+ /**
246
+ * Log integration response (after successful API call)
247
+ *
248
+ * @param logData - The response log data to be logged
249
+ */
250
+ logResponse(logData) {
251
+ const { loggedInUserId, method, url, statusCode, duration, responseBody } = logData;
252
+ this.logger.info(loggedInUserId || dvssBackendModuleUtility.SYSTEM_USER_ID, this.logResponse.name, this.className, `Integration API Response: ${method} ${url} - ${statusCode} (${duration}ms)`, {
253
+ integrationId: logData.integrationId,
254
+ method,
255
+ url,
256
+ statusCode,
257
+ duration,
258
+ responseBody,
259
+ timestamp: logData.timestamp || /* @__PURE__ */ new Date()
260
+ });
261
+ }
262
+ /**
263
+ * Log integration error (after failed API call)
264
+ *
265
+ * @param logData - The error log data to be logged
266
+ */
267
+ logError(logData) {
268
+ const { loggedInUserId, method, url, statusCode, duration, error } = logData;
269
+ this.logger.error(loggedInUserId || dvssBackendModuleUtility.SYSTEM_USER_ID, this.logError.name, this.className, `Integration API Error: ${method} ${url} - ${statusCode || "N/A"} (${duration || 0}ms)`, {
270
+ integrationId: logData.integrationId,
271
+ method,
272
+ url,
273
+ statusCode,
274
+ duration,
275
+ error,
276
+ timestamp: logData.timestamp || /* @__PURE__ */ new Date()
277
+ });
278
+ }
279
+ /**
280
+ * Log integration request (legacy method for backward compatibility)
281
+ * This method determines whether to log as request, response, or error based on the logData
282
+ *
283
+ * @param logData - The request log data to be logged
284
+ */
285
+ logIntegrationRequest(logData) {
286
+ if (logData.error) {
287
+ this.logError(logData);
288
+ } else if (logData.statusCode && logData.responseBody !== void 0) {
289
+ this.logResponse(logData);
290
+ } else {
291
+ this.logRequest(logData);
292
+ }
293
+ }
294
+ /**
295
+ * Sanitize headers to remove sensitive information
296
+ *
297
+ * @param headers - The headers to sanitize
298
+ * @returns Sanitized headers
299
+ */
300
+ sanitizeHeaders(headers) {
301
+ if (!headers) {
302
+ return void 0;
303
+ }
304
+ const sanitized = {
305
+ ...headers
306
+ };
307
+ const sensitiveKeys = [
308
+ "authorization",
309
+ "api-key",
310
+ "apikey",
311
+ "x-api-key",
312
+ "cookie"
313
+ ];
314
+ for (const key of Object.keys(sanitized)) {
315
+ if (sensitiveKeys.includes(key.toLowerCase())) {
316
+ sanitized[key] = "***REDACTED***";
317
+ }
318
+ }
319
+ return sanitized;
320
+ }
321
+ };
322
+ IntegrationRequestLoggerService = _ts_decorate7([
323
+ common.Injectable(),
324
+ _ts_metadata6("design:type", Function),
325
+ _ts_metadata6("design:paramtypes", [
326
+ typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
327
+ ])
328
+ ], IntegrationRequestLoggerService);
329
+ function _ts_decorate8(decorators, target, key, desc) {
330
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
331
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
332
+ 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;
333
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
334
+ }
335
+ __name(_ts_decorate8, "_ts_decorate");
336
+ var RateLimiterService = class {
337
+ static {
338
+ __name(this, "RateLimiterService");
339
+ }
340
+ /**
341
+ * Validate and enforce rate limit
342
+ *
343
+ * @returns Promise resolving when the rate limit is validated and enforced
344
+ */
345
+ async validateAndEnforceRateLimit() {
346
+ }
347
+ };
348
+ RateLimiterService = _ts_decorate8([
349
+ common.Injectable()
350
+ ], RateLimiterService);
351
+
352
+ // ../../packages/dvss-integration-libs/src/integration-traffic-router/constants/http.constant.ts
353
+ var HTTP_METHOD = /* @__PURE__ */ (function(HTTP_METHOD2) {
354
+ HTTP_METHOD2["GET"] = "GET";
355
+ HTTP_METHOD2["POST"] = "POST";
356
+ HTTP_METHOD2["PUT"] = "PUT";
357
+ HTTP_METHOD2["DELETE"] = "DELETE";
358
+ HTTP_METHOD2["PATCH"] = "PATCH";
359
+ return HTTP_METHOD2;
360
+ })({});
361
+
362
+ // ../../packages/dvss-integration-libs/src/integration-traffic-router/gateway/traffic-gateway.service.ts
363
+ function _ts_decorate9(decorators, target, key, desc) {
364
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
365
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
366
+ 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;
367
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
368
+ }
369
+ __name(_ts_decorate9, "_ts_decorate");
370
+ function _ts_metadata7(k, v) {
371
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
372
+ }
373
+ __name(_ts_metadata7, "_ts_metadata");
374
+ exports.TrafficGatewayService = class TrafficGatewayService {
375
+ static {
376
+ __name(this, "TrafficGatewayService");
377
+ }
378
+ httpService;
379
+ requestLogger;
380
+ rateLimiter;
381
+ constructor(httpService, requestLogger, rateLimiter) {
382
+ this.httpService = httpService;
383
+ this.requestLogger = requestLogger;
384
+ this.rateLimiter = rateLimiter;
385
+ }
386
+ /**
387
+ * Execute a generic API call to a third-party integration
388
+ *
389
+ * @template TResponse - The expected response type
390
+ * @template TRequestBody - The request body type (optional)
391
+ * @param request - The API call request configuration
392
+ * @param integration - The integration configuration
393
+ * @param loggedInUserId - Optional user ID for logging purposes
394
+ * @param _context - Optional context for deriving rate limits and other settings (projectId, propertyId, etc.)
395
+ * @returns Promise resolving to the API response data
396
+ * @throws Error if the request fails or rate limit is exceeded
397
+ */
398
+ async executeIntegrationRequest(request, integration, loggedInUserId, _context) {
399
+ const startTime = Date.now();
400
+ try {
401
+ const headers = this.prepareHeaders(request);
402
+ const requestConfig = this.prepareRequestConfig(request, headers);
403
+ await this.rateLimiter.validateAndEnforceRateLimit();
404
+ const fullUrl = this.constructFullUrl(request.baseUrl, request.url);
405
+ const logData = {
406
+ integrationId: integration.id,
407
+ method: request.apiMethod,
408
+ url: fullUrl,
409
+ headers,
410
+ requestBody: request.body,
411
+ loggedInUserId,
412
+ timestamp: /* @__PURE__ */ new Date()
413
+ };
414
+ this.requestLogger.logRequest(logData);
415
+ const apiResponse = await this.executeHttpRequest(request, fullUrl, requestConfig);
416
+ const duration = Date.now() - startTime;
417
+ const responseData = apiResponse.data;
418
+ this.requestLogger.logResponse({
419
+ ...logData,
420
+ responseBody: responseData,
421
+ statusCode: apiResponse.status,
422
+ duration
423
+ });
424
+ return responseData;
425
+ } catch (error) {
426
+ const duration = Date.now() - startTime;
427
+ const errorDetails = this.extractErrorDetails(error);
428
+ const baseUrl = integration.config.platformConfig.baseUrl;
429
+ const fullUrl = this.constructFullUrl(baseUrl, request.url);
430
+ this.requestLogger.logError({
431
+ integrationId: integration.id,
432
+ method: request.apiMethod,
433
+ url: fullUrl,
434
+ headers: request.headers,
435
+ requestBody: request.body,
436
+ loggedInUserId,
437
+ timestamp: /* @__PURE__ */ new Date(),
438
+ error: errorDetails.message || String(error),
439
+ statusCode: errorDetails.statusCode,
440
+ duration
441
+ });
442
+ throw error;
443
+ }
444
+ }
445
+ /**
446
+ * Prepare headers for the API request
447
+ *
448
+ * @private
449
+ * @param request - The API call request configuration
450
+ * @param apiKey - The API key for authorization
451
+ * @returns Prepared headers object
452
+ */
453
+ prepareHeaders(request) {
454
+ request.headerType = request.headerType || "json";
455
+ const headers = {
456
+ ...request.headers || {}
457
+ };
458
+ if (!headers["Content-Type"] && request.headerType === "json" && (request.apiMethod === HTTP_METHOD.POST || request.apiMethod === HTTP_METHOD.PUT || request.apiMethod === HTTP_METHOD.PATCH)) {
459
+ headers["Content-Type"] = "application/json";
460
+ }
461
+ if (!headers["Accept"] && request.headerType === "json") {
462
+ headers["Accept"] = "application/json";
463
+ }
464
+ return headers;
465
+ }
466
+ /**
467
+ * Prepare request configuration object
468
+ *
469
+ * @private
470
+ * @param request - The API call request configuration
471
+ * @param headers - Prepared headers
472
+ * @returns Request configuration object
473
+ */
474
+ prepareRequestConfig(request, headers) {
475
+ const requestConfig = {
476
+ headers
477
+ };
478
+ if (request.responseType) {
479
+ requestConfig.responseType = request.responseType;
480
+ }
481
+ return requestConfig;
482
+ }
483
+ /**
484
+ * Construct full URL from base URL and request URL
485
+ * Handles trailing slashes properly
486
+ *
487
+ * @private
488
+ * @param baseUrl - The base URL from platform config
489
+ * @param requestUrl - The request URL path
490
+ * @returns Constructed full URL
491
+ */
492
+ constructFullUrl(baseUrl, requestUrl) {
493
+ const normalizedBaseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
494
+ const normalizedRequestUrl = requestUrl.startsWith("/") ? requestUrl : `/${requestUrl}`;
495
+ return `${normalizedBaseUrl}${normalizedRequestUrl}`;
496
+ }
497
+ /**
498
+ * Execute HTTP request based on the method
499
+ *
500
+ * @private
501
+ * @template TResponse - The expected response type
502
+ * @param request - The API call request configuration
503
+ * @param fullUrl - The full URL to make the request to
504
+ * @param requestConfig - The request configuration
505
+ * @returns Promise resolving to the HTTP response
506
+ * @throws Error if the HTTP method is unsupported
507
+ */
508
+ async executeHttpRequest(request, fullUrl, requestConfig) {
509
+ switch (request.apiMethod) {
510
+ case HTTP_METHOD.GET: {
511
+ return await rxjs.firstValueFrom(this.httpService.get(fullUrl, requestConfig));
512
+ }
513
+ case HTTP_METHOD.POST: {
514
+ return await rxjs.firstValueFrom(this.httpService.post(fullUrl, request.body, requestConfig));
515
+ }
516
+ case HTTP_METHOD.PUT: {
517
+ return await rxjs.firstValueFrom(this.httpService.put(fullUrl, request.body, requestConfig));
518
+ }
519
+ case HTTP_METHOD.PATCH: {
520
+ return await rxjs.firstValueFrom(this.httpService.patch(fullUrl, request.body, requestConfig));
521
+ }
522
+ case HTTP_METHOD.DELETE: {
523
+ return await rxjs.firstValueFrom(this.httpService.delete(fullUrl, requestConfig));
524
+ }
525
+ default: {
526
+ throw new Error(`Unsupported HTTP method: ${String(request.apiMethod)}`);
527
+ }
528
+ }
529
+ }
530
+ /**
531
+ * Extract error details from an error object
532
+ *
533
+ * @private
534
+ * @param error - The error object
535
+ * @returns Extracted error details
536
+ */
537
+ extractErrorDetails(error) {
538
+ const errorObject = error;
539
+ return {
540
+ message: errorObject.message,
541
+ statusCode: errorObject.status || errorObject.response?.status
542
+ };
543
+ }
544
+ };
545
+ exports.TrafficGatewayService = _ts_decorate9([
546
+ common.Injectable(),
547
+ _ts_metadata7("design:type", Function),
548
+ _ts_metadata7("design:paramtypes", [
549
+ typeof axios.HttpService === "undefined" ? Object : axios.HttpService,
550
+ typeof IntegrationRequestLoggerService === "undefined" ? Object : IntegrationRequestLoggerService,
551
+ typeof RateLimiterService === "undefined" ? Object : RateLimiterService
552
+ ])
553
+ ], exports.TrafficGatewayService);
554
+
555
+ // ../../packages/dvss-integration-libs/src/app.module.ts
556
+ function _ts_decorate10(decorators, target, key, desc) {
557
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
558
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
559
+ 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;
560
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
561
+ }
562
+ __name(_ts_decorate10, "_ts_decorate");
563
+ exports.IntegrationLibsModule = class AppModule {
564
+ static {
565
+ __name(this, "AppModule");
566
+ }
567
+ };
568
+ exports.IntegrationLibsModule = _ts_decorate10([
569
+ common.Module({
570
+ imports: [
571
+ // Load environment variables from root .env file
572
+ config.ConfigModule.forRoot({
573
+ envFilePath: path.resolve(__dirname, "../../../.env"),
574
+ isGlobal: true
575
+ }),
576
+ axios.HttpModule,
577
+ dvssBackendModuleUtility.LoggerModule
578
+ ],
579
+ controllers: [
580
+ AppController3
581
+ ],
582
+ providers: [
583
+ AppService3,
584
+ exports.TrafficGatewayService,
585
+ IntegrationRequestLoggerService,
586
+ RateLimiterService
587
+ ],
588
+ exports: [
589
+ exports.TrafficGatewayService,
590
+ IntegrationRequestLoggerService,
591
+ RateLimiterService
592
+ ]
593
+ })
594
+ ], exports.IntegrationLibsModule);
595
+
596
+ // ../../packages/dvss-integration-libs/src/integration-traffic-router/constants/traffic-router.constant.ts
597
+ var TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY = "traffic-router-configuration-store";
598
+
599
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/auth/auth.base.ts
600
+ var BaseAuth = class {
601
+ static {
602
+ __name(this, "BaseAuth");
603
+ }
604
+ };
605
+
606
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/wellness/appointment-booking.base.ts
607
+ var BaseWellnessAppointmentBooking = class {
608
+ static {
609
+ __name(this, "BaseWellnessAppointmentBooking");
610
+ }
611
+ };
612
+
613
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/credit-management/credit-booking.base.ts
614
+ var BaseCreditBooking = class {
615
+ static {
616
+ __name(this, "BaseCreditBooking");
617
+ }
618
+ };
619
+
620
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/customer-management/customer-management.base.ts
621
+ var BaseCustomerManagement = class {
622
+ static {
623
+ __name(this, "BaseCustomerManagement");
624
+ }
625
+ };
626
+
627
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/package-management/package-management.base.ts
628
+ var BasePackageManagement = class {
629
+ static {
630
+ __name(this, "BasePackageManagement");
631
+ }
632
+ };
633
+
634
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/contact-management.base.ts
635
+ var BaseAccountingContactManagement = class {
636
+ static {
637
+ __name(this, "BaseAccountingContactManagement");
638
+ }
639
+ };
640
+
641
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/credit-note-management.base.ts
642
+ var BaseAccountingCreditNoteManagement = class {
643
+ static {
644
+ __name(this, "BaseAccountingCreditNoteManagement");
645
+ }
646
+ };
647
+
648
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/customer-management.base.ts
649
+ var BaseAccountingCustomerManagement = class {
650
+ static {
651
+ __name(this, "BaseAccountingCustomerManagement");
652
+ }
653
+ };
654
+
655
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/customer-payment-management.base.ts
656
+ var BaseAccountingCustomerPaymentManagement = class {
657
+ static {
658
+ __name(this, "BaseAccountingCustomerPaymentManagement");
659
+ }
660
+ };
661
+
662
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/invoice-management.base.ts
663
+ var BaseAccountingInvoiceManagement = class {
664
+ static {
665
+ __name(this, "BaseAccountingInvoiceManagement");
666
+ }
667
+ };
668
+
669
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/loa-management.base.ts
670
+ var BaseAccountingLOAManagement = class {
671
+ static {
672
+ __name(this, "BaseAccountingLOAManagement");
673
+ }
674
+ };
675
+
676
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/tax-management.base.ts
677
+ var BaseAccountingTaxManagement = class {
678
+ static {
679
+ __name(this, "BaseAccountingTaxManagement");
680
+ }
681
+ };
682
+
683
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/payment.base.ts
684
+ var BasePayment = class {
685
+ static {
686
+ __name(this, "BasePayment");
687
+ }
688
+ };
689
+
690
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/payment-method-management.base.ts
691
+ var BasePaymentMethodManagement = class {
692
+ static {
693
+ __name(this, "BasePaymentMethodManagement");
694
+ }
695
+ };
696
+
697
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/user-management.base.ts
698
+ var BasePaymentUserManagement = class {
699
+ static {
700
+ __name(this, "BasePaymentUserManagement");
701
+ }
702
+ };
703
+
704
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/membership/subcapabilities/customer-management.base.ts
705
+ var BaseMembershipCustomerManagement = class {
706
+ static {
707
+ __name(this, "BaseMembershipCustomerManagement");
708
+ }
709
+ };
710
+
711
+ // ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/membership/subcapabilities/membership-management.base.ts
712
+ var BaseMembershipManagement = class {
713
+ static {
714
+ __name(this, "BaseMembershipManagement");
715
+ }
716
+ };
717
+
718
+ // ../../packages/dvss-integration-libs/src/integration-common-utils/models/credit-management.model.ts
719
+ var CREDIT_TYPE_ENUM = /* @__PURE__ */ (function(CREDIT_TYPE_ENUM2) {
720
+ CREDIT_TYPE_ENUM2["COUPON"] = "COUPON";
721
+ CREDIT_TYPE_ENUM2["AMOUNT"] = "AMOUNT";
722
+ return CREDIT_TYPE_ENUM2;
723
+ })({});
724
+ var CREDIT_STATUS_ENUM = /* @__PURE__ */ (function(CREDIT_STATUS_ENUM2) {
725
+ CREDIT_STATUS_ENUM2["ACTIVE"] = "ACTIVE";
726
+ CREDIT_STATUS_ENUM2["REDEEMED"] = "REDEEMED";
727
+ CREDIT_STATUS_ENUM2["EXPIRED"] = "EXPIRED";
728
+ CREDIT_STATUS_ENUM2["REVOKED"] = "REVOKED";
729
+ return CREDIT_STATUS_ENUM2;
730
+ })({});
731
+ var CREDIT_FILTER_BY_ENUM = /* @__PURE__ */ (function(CREDIT_FILTER_BY_ENUM2) {
732
+ CREDIT_FILTER_BY_ENUM2["TYPE"] = "TYPE";
733
+ CREDIT_FILTER_BY_ENUM2["STATUS"] = "STATUS";
734
+ return CREDIT_FILTER_BY_ENUM2;
735
+ })({});
736
+
737
+ // ../../packages/dvss-integration-libs/src/integration-common-utils/models/capability-integration.model.ts
738
+ var INTEGRATION_PROVIDER_ENUM = /* @__PURE__ */ (function(INTEGRATION_PROVIDER_ENUM2) {
739
+ INTEGRATION_PROVIDER_ENUM2["TRYBE"] = "TRYBE";
740
+ return INTEGRATION_PROVIDER_ENUM2;
741
+ })({});
742
+ function _ts_decorate11(decorators, target, key, desc) {
743
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
744
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
745
+ 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;
746
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
747
+ }
748
+ __name(_ts_decorate11, "_ts_decorate");
749
+ function _ts_metadata8(k, v) {
750
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
751
+ }
752
+ __name(_ts_metadata8, "_ts_metadata");
753
+ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
754
+ static {
755
+ __name(this, "TrybeCustomerManagement");
756
+ }
757
+ logger;
758
+ trafficGatewayService;
759
+ fileName = "customer-management.service";
760
+ /**
761
+ * Creates an instance of the service
762
+ */
763
+ constructor(logger, trafficGatewayService) {
764
+ this.logger = logger;
765
+ this.trafficGatewayService = trafficGatewayService;
766
+ }
767
+ /**
768
+ * Abstract method to create a new customer
769
+ * Must be implemented by concrete classes
770
+ *
771
+ * @returns Promise resolving when the customer is created
772
+ */
773
+ createCustomer() {
774
+ throw new Error("createCustomer not yet implemented");
775
+ }
776
+ /**
777
+ * Abstract method to search for wellness customers
778
+ * Must be implemented by concrete classes
779
+ *
780
+ * @returns Promise resolving when the search is completed
781
+ */
782
+ async searchCustomer(request, integration, loggedInUserId) {
783
+ this.logger.info(loggedInUserId, this.searchCustomer.name, this.fileName, `${_TrybeCustomerManagement.name} -> ${this.searchCustomer.name} Called`, {
784
+ request
785
+ });
786
+ if (!request.email && !request.customerId) {
787
+ throw new Error("Either email or customerId is required to get a customer from Trybe");
788
+ }
789
+ if (request.customerId) {
790
+ const response = await this.trafficGatewayService.executeIntegrationRequest({
791
+ apiMethod: HTTP_METHOD.GET,
792
+ url: `/customers/customers/${request.customerId}`,
793
+ baseUrl: integration.config.platformConfig.baseUrl,
794
+ headers: integration.headers
795
+ }, integration, loggedInUserId);
796
+ if (!response.data) {
797
+ return void 0;
798
+ }
799
+ return response.data;
800
+ }
801
+ if (request.email) {
802
+ const response = await this.trafficGatewayService.executeIntegrationRequest({
803
+ apiMethod: HTTP_METHOD.GET,
804
+ url: `/customers/customers/?email=${request.email}`,
805
+ baseUrl: integration.config.platformConfig.baseUrl,
806
+ headers: integration.headers
807
+ }, integration, loggedInUserId);
808
+ if (!response.data || response.data.length === 0) {
809
+ return void 0;
810
+ }
811
+ return response.data[0];
812
+ }
813
+ }
814
+ /**
815
+ * Abstract method to update an existing customer
816
+ * Must be implemented by concrete classes
817
+ *
818
+ * @returns Promise resolving when the customer is updated
819
+ */
820
+ updateCustomer() {
821
+ throw new Error("updateCustomer not yet implemented");
822
+ }
823
+ };
824
+ exports.TrybeCustomerManagement = _ts_decorate11([
825
+ common.Injectable(),
826
+ _ts_metadata8("design:type", Function),
827
+ _ts_metadata8("design:paramtypes", [
828
+ typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
829
+ typeof exports.TrafficGatewayService === "undefined" ? Object : exports.TrafficGatewayService
830
+ ])
831
+ ], exports.TrybeCustomerManagement);
832
+ function _ts_decorate12(decorators, target, key, desc) {
833
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
834
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
835
+ 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;
836
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
837
+ }
838
+ __name(_ts_decorate12, "_ts_decorate");
839
+ function _ts_metadata9(k, v) {
840
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
841
+ }
842
+ __name(_ts_metadata9, "_ts_metadata");
843
+ exports.TrybeAuthService = class _TrybeAuthService {
844
+ static {
845
+ __name(this, "TrybeAuthService");
846
+ }
847
+ trybeCustomerManagement;
848
+ logger;
849
+ fileName = "auth.service";
850
+ /**
851
+ * Creates an instance of the Trybe authentication service
852
+ */
853
+ constructor(trybeCustomerManagement, logger) {
854
+ this.trybeCustomerManagement = trybeCustomerManagement;
855
+ this.logger = logger;
856
+ }
857
+ /**
858
+ * Validates Trybe integration configuration
859
+ * Checks for required fields: apiKey, siteId, organisationId, and baseUrl
860
+ *
861
+ * @param config - Integration configuration object
862
+ * @param loggedInUserId - User ID for logging
863
+ * @returns Promise resolving to validated configuration
864
+ * @throws Error if config is invalid
865
+ */
866
+ validateConfig(integration, loggedInUserId) {
867
+ this.logger.info(loggedInUserId, this.validateConfig.name, this.fileName, `${_TrybeAuthService.name} -> ${this.validateConfig.name} Called`, {
868
+ integration
869
+ });
870
+ if (!integration.config) {
871
+ throw new Error("Integration configuration is missing");
872
+ }
873
+ const { config: config3 } = integration;
874
+ const integrationConfig = config3.integrationConfig || {};
875
+ const platformConfig = config3.platformConfig || {};
876
+ if (Object.keys(integrationConfig).length > 0) {
877
+ if (!integrationConfig.apiKey) {
878
+ throw new Error("Integration configuration is invalid: API Key not found");
879
+ } else if (!integrationConfig.siteId) {
880
+ throw new Error("Integration configuration is invalid: Site ID not found");
881
+ } else if (!integrationConfig.organisationId) {
882
+ throw new Error("Integration configuration is invalid: Organisation ID not found");
883
+ }
884
+ } else {
885
+ throw new Error("Integration configuration is invalid: Integration config is empty");
886
+ }
887
+ if (Object.keys(platformConfig).length > 0) {
888
+ if (!platformConfig.baseUrl) {
889
+ throw new Error("Platform configuration is invalid: Base URL not found");
890
+ }
891
+ } else {
892
+ throw new Error("Platform configuration is invalid: Platform config is empty");
893
+ }
894
+ const headers = {
895
+ Authorization: `Bearer ${integrationConfig.apiKey}`
896
+ };
897
+ return {
898
+ ...integration,
899
+ headers
900
+ };
901
+ }
902
+ /**
903
+ * Tests Trybe integration by making a test API call
904
+ * Uses a test customer lookup to verify credentials are valid
905
+ *
906
+ * @param integration - Integration object with configuration
907
+ * @param loggedInUserId - User ID for logging
908
+ * @returns Promise resolving when test is completed
909
+ * @throws Error if authentication fails or API call fails
910
+ */
911
+ async testIntegration(integration, loggedInUserId) {
912
+ this.logger.info(loggedInUserId, this.testIntegration.name, this.fileName, `${_TrybeAuthService.name} -> ${this.testIntegration.name} Called`, {
913
+ integration
914
+ });
915
+ const validatedIntegration = this.validateConfig(integration, loggedInUserId);
916
+ await this.trybeCustomerManagement.searchCustomer({
917
+ email: "test@integration.test"
918
+ }, validatedIntegration, loggedInUserId);
919
+ this.logger.info(loggedInUserId, this.testIntegration.name, this.fileName, "Trybe integration test successful. The credentials are valid.");
920
+ return true;
921
+ }
922
+ /**
923
+ * Fetches an access token from the Trybe integration provider.
924
+ *
925
+ * @param integration - Integration object with configuration
926
+ * @param loggedInUserId - User ID for logging
927
+ * @returns Promise resolving to the access token string
928
+ */
929
+ fetchAccessToken(integration, loggedInUserId) {
930
+ this.logger.info(loggedInUserId, this.fetchAccessToken.name, this.fileName, `${_TrybeAuthService.name} -> ${this.fetchAccessToken.name} Called`, {
931
+ integration
932
+ });
933
+ throw new Error("Method not implemented.");
934
+ }
935
+ };
936
+ exports.TrybeAuthService = _ts_decorate12([
937
+ common.Injectable(),
938
+ _ts_metadata9("design:type", Function),
939
+ _ts_metadata9("design:paramtypes", [
940
+ typeof exports.TrybeCustomerManagement === "undefined" ? Object : exports.TrybeCustomerManagement,
941
+ typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
942
+ ])
943
+ ], exports.TrybeAuthService);
944
+
945
+ // ../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.mapper.ts
946
+ function mapStatus(t) {
947
+ if (t.redeemed_at) return CREDIT_STATUS_ENUM.REDEEMED;
948
+ if (t.revoked_at) return CREDIT_STATUS_ENUM.REVOKED;
949
+ if (new Date(t.expires_at) < /* @__PURE__ */ new Date()) return CREDIT_STATUS_ENUM.EXPIRED;
950
+ return CREDIT_STATUS_ENUM.ACTIVE;
951
+ }
952
+ __name(mapStatus, "mapStatus");
953
+ function mapTrybeCreditsToSystem(res) {
954
+ const groups = /* @__PURE__ */ new Map();
955
+ for (const t of res.data) {
956
+ const key = `${t.coupon_name}|${t.issued_at}`;
957
+ const list = groups.get(key) ?? [];
958
+ list.push(t);
959
+ groups.set(key, list);
960
+ }
961
+ const records = [];
962
+ for (const [, items] of groups) {
963
+ const first = items[0];
964
+ const couponCodes = items.map((i) => i.coupon_code);
965
+ records.push({
966
+ name: first.coupon_name,
967
+ description: first.coupon_description ?? void 0,
968
+ type: CREDIT_TYPE_ENUM.COUPON,
969
+ status: mapStatus(first),
970
+ externalId: first.id,
971
+ expiresAt: new Date(first.expires_at),
972
+ expiresDate: first.expires_at.split("T")[0],
973
+ startsAt: new Date(first.issued_at),
974
+ startDate: first.issued_at.split("T")[0],
975
+ value: couponCodes[0],
976
+ meta: {
977
+ integrationDetails: {
978
+ customerId: first.customer_id,
979
+ membershipId: first.membership_id,
980
+ multiUse: first.multi_use === 1,
981
+ couponCodes,
982
+ redeemedAt: first.redeemed_at,
983
+ revokedAt: first.revoked_at
984
+ }
985
+ }
986
+ });
987
+ }
988
+ return {
989
+ totalCount: records.length,
990
+ records
991
+ };
992
+ }
993
+ __name(mapTrybeCreditsToSystem, "mapTrybeCreditsToSystem");
994
+
995
+ // ../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.service.ts
996
+ var TrybeCreditBooking = class _TrybeCreditBooking {
997
+ static {
998
+ __name(this, "TrybeCreditBooking");
999
+ }
1000
+ logger;
1001
+ trafficGatewayService;
1002
+ trybeAuthService;
1003
+ fileName = "credit-booking.service";
1004
+ /**
1005
+ * Creates an instance of the service
1006
+ */
1007
+ constructor(logger, trafficGatewayService, trybeAuthService) {
1008
+ this.logger = logger;
1009
+ this.trafficGatewayService = trafficGatewayService;
1010
+ this.trybeAuthService = trybeAuthService;
1011
+ }
1012
+ /**
1013
+ * Fetches customer credits from Trybe and returns system-format response
1014
+ *
1015
+ * @returns Promise resolving to the system customer credits response
1016
+ */
1017
+ async fetchCustomerCredits(request, integration, loggedInUserId) {
1018
+ this.logger.info(loggedInUserId, this.fetchCustomerCredits.name, this.fileName, `${_TrybeCreditBooking.name} -> ${this.fetchCustomerCredits.name} Called`, {
1019
+ request
1020
+ });
1021
+ const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
1022
+ const query = new URLSearchParams();
1023
+ const opts = request.options;
1024
+ if (opts?.page != null) query.set("page", String(opts.page));
1025
+ if (opts?.count != null) query.set("per_page", String(opts.count));
1026
+ const statusFilterValues = opts?.filters?.[0]?.by === CREDIT_FILTER_BY_ENUM.STATUS ? opts.filters[0].values : [];
1027
+ if (statusFilterValues.length) {
1028
+ if (statusFilterValues.includes(CREDIT_STATUS_ENUM.EXPIRED)) {
1029
+ query.set("expired", "true");
1030
+ }
1031
+ if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REDEEMED)) {
1032
+ query.set("redeemed", "true");
1033
+ }
1034
+ }
1035
+ const queryString = query.toString();
1036
+ const url = `/shop/customers/${request.customerId}/credits` + (queryString ? `?${queryString}` : "");
1037
+ const raw = await this.trafficGatewayService.executeIntegrationRequest({
1038
+ apiMethod: HTTP_METHOD.GET,
1039
+ url,
1040
+ baseUrl: validatedIntegration.config.platformConfig.baseUrl,
1041
+ headers: validatedIntegration.headers
1042
+ }, validatedIntegration, loggedInUserId);
1043
+ return mapTrybeCreditsToSystem(raw);
1044
+ }
1045
+ };
1046
+
1047
+ // ../../packages/dvss-integration-trybe/src/app.module.ts
1048
+ function _ts_decorate13(decorators, target, key, desc) {
1049
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1050
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1051
+ 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;
1052
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1053
+ }
1054
+ __name(_ts_decorate13, "_ts_decorate");
1055
+ exports.IntegrationTrybeModule = class AppModule2 {
1056
+ static {
1057
+ __name(this, "AppModule");
1058
+ }
1059
+ };
1060
+ exports.IntegrationTrybeModule = _ts_decorate13([
1061
+ common.Module({
1062
+ imports: [
1063
+ // Load environment variables from root .env file
1064
+ config.ConfigModule.forRoot({
1065
+ envFilePath: path.resolve(__dirname, "../../../.env"),
1066
+ isGlobal: true
1067
+ }),
1068
+ exports.IntegrationLibsModule,
1069
+ axios.HttpModule,
1070
+ dvssBackendModuleUtility.LoggerModule
1071
+ ],
1072
+ controllers: [
1073
+ AppController2
1074
+ ],
1075
+ providers: [
1076
+ AppService2,
1077
+ exports.TrybeAuthService,
1078
+ exports.TrybeCustomerManagement,
1079
+ TrybeCreditBooking
1080
+ ],
1081
+ exports: [
1082
+ exports.TrybeAuthService,
1083
+ exports.TrybeCustomerManagement,
1084
+ TrybeCreditBooking
1085
+ ]
1086
+ })
1087
+ ], exports.IntegrationTrybeModule);
1088
+
1089
+ // ../../packages/dvss-integration-trybe/src/capabilities/package-management/package-management.service.ts
1090
+ var TrybePackageManagement = class {
1091
+ static {
1092
+ __name(this, "TrybePackageManagement");
1093
+ }
1094
+ };
1095
+
1096
+ // ../../packages/dvss-integration-trybe/src/capabilities/wellness/appointment-booking.service.ts
1097
+ var TrybeWellnessAppointmentBooking = class extends BaseWellnessAppointmentBooking {
1098
+ static {
1099
+ __name(this, "TrybeWellnessAppointmentBooking");
1100
+ }
1101
+ };
1102
+
1103
+ // src/app.module.ts
1104
+ function _ts_decorate14(decorators, target, key, desc) {
1105
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1106
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1107
+ 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;
1108
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1109
+ }
1110
+ __name(_ts_decorate14, "_ts_decorate");
1111
+ exports.OfferingIntegrationManager = class AppModule3 {
1112
+ static {
1113
+ __name(this, "AppModule");
1114
+ }
1115
+ };
1116
+ exports.OfferingIntegrationManager = _ts_decorate14([
1117
+ common.Module({
1118
+ imports: [
1119
+ exports.IntegrationTrybeModule,
1120
+ exports.IntegrationLibsModule
1121
+ ],
1122
+ controllers: [
1123
+ AppController
1124
+ ],
1125
+ providers: [
1126
+ AppService,
1127
+ exports.IntegrationTrybeModule,
1128
+ exports.IntegrationLibsModule
1129
+ ],
1130
+ exports: [
1131
+ exports.IntegrationTrybeModule,
1132
+ exports.IntegrationLibsModule
1133
+ ]
1134
+ })
1135
+ ], exports.OfferingIntegrationManager);
1136
+
1137
+ exports.BaseAccountingContactManagement = BaseAccountingContactManagement;
1138
+ exports.BaseAccountingCreditNoteManagement = BaseAccountingCreditNoteManagement;
1139
+ exports.BaseAccountingCustomerManagement = BaseAccountingCustomerManagement;
1140
+ exports.BaseAccountingCustomerPaymentManagement = BaseAccountingCustomerPaymentManagement;
1141
+ exports.BaseAccountingInvoiceManagement = BaseAccountingInvoiceManagement;
1142
+ exports.BaseAccountingLOAManagement = BaseAccountingLOAManagement;
1143
+ exports.BaseAccountingTaxManagement = BaseAccountingTaxManagement;
1144
+ exports.BaseAuth = BaseAuth;
1145
+ exports.BaseCreditBooking = BaseCreditBooking;
1146
+ exports.BaseCustomerManagement = BaseCustomerManagement;
1147
+ exports.BaseMembershipCustomerManagement = BaseMembershipCustomerManagement;
1148
+ exports.BaseMembershipManagement = BaseMembershipManagement;
1149
+ exports.BasePackageManagement = BasePackageManagement;
1150
+ exports.BasePayment = BasePayment;
1151
+ exports.BasePaymentMethodManagement = BasePaymentMethodManagement;
1152
+ exports.BasePaymentUserManagement = BasePaymentUserManagement;
1153
+ exports.BaseWellnessAppointmentBooking = BaseWellnessAppointmentBooking;
1154
+ exports.CREDIT_FILTER_BY_ENUM = CREDIT_FILTER_BY_ENUM;
1155
+ exports.CREDIT_STATUS_ENUM = CREDIT_STATUS_ENUM;
1156
+ exports.CREDIT_TYPE_ENUM = CREDIT_TYPE_ENUM;
1157
+ exports.HTTP_METHOD = HTTP_METHOD;
1158
+ exports.INTEGRATION_PROVIDER_ENUM = INTEGRATION_PROVIDER_ENUM;
1159
+ exports.TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY = TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY;
1160
+ exports.TrybeCreditBooking = TrybeCreditBooking;
1161
+ exports.TrybePackageManagement = TrybePackageManagement;
1162
+ exports.TrybeWellnessAppointmentBooking = TrybeWellnessAppointmentBooking;
1163
+ //# sourceMappingURL=index.js.map
1164
+ //# sourceMappingURL=index.js.map