@dv4resi/dvss-backend-module-offering-im 0.0.22 → 0.0.24
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.d.ts +105 -35
- package/dist/index.js +613 -303
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -177,7 +177,7 @@ exports.IntegrationRequestLoggerService = class _IntegrationRequestLoggerService
|
|
|
177
177
|
integrationId: logData.integrationId,
|
|
178
178
|
method,
|
|
179
179
|
url,
|
|
180
|
-
headers,
|
|
180
|
+
headers: this.sanitizeHeaders(headers),
|
|
181
181
|
requestBody,
|
|
182
182
|
timestamp: logData.timestamp || /* @__PURE__ */ new Date()
|
|
183
183
|
});
|
|
@@ -232,6 +232,33 @@ exports.IntegrationRequestLoggerService = class _IntegrationRequestLoggerService
|
|
|
232
232
|
this.logRequest(logData);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Sanitize headers to remove sensitive information
|
|
237
|
+
*
|
|
238
|
+
* @param headers - The headers to sanitize
|
|
239
|
+
* @returns Sanitized headers
|
|
240
|
+
*/
|
|
241
|
+
sanitizeHeaders(headers) {
|
|
242
|
+
if (!headers) {
|
|
243
|
+
return void 0;
|
|
244
|
+
}
|
|
245
|
+
const sanitized = {
|
|
246
|
+
...headers
|
|
247
|
+
};
|
|
248
|
+
const sensitiveKeys = [
|
|
249
|
+
"authorization",
|
|
250
|
+
"api-key",
|
|
251
|
+
"apikey",
|
|
252
|
+
"x-api-key",
|
|
253
|
+
"cookie"
|
|
254
|
+
];
|
|
255
|
+
for (const key of Object.keys(sanitized)) {
|
|
256
|
+
if (sensitiveKeys.includes(key.toLowerCase())) {
|
|
257
|
+
sanitized[key] = "***REDACTED***";
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return sanitized;
|
|
261
|
+
}
|
|
235
262
|
};
|
|
236
263
|
exports.IntegrationRequestLoggerService = _ts_decorate5([
|
|
237
264
|
common.Injectable(),
|
|
@@ -329,7 +356,7 @@ exports.TrafficGatewayService = class TrafficGatewayService {
|
|
|
329
356
|
} catch (error) {
|
|
330
357
|
const duration = Date.now() - startTime;
|
|
331
358
|
const errorDetails = this.extractErrorDetails(error);
|
|
332
|
-
const baseUrl =
|
|
359
|
+
const baseUrl = request.baseUrl;
|
|
333
360
|
const fullUrl = this.constructFullUrl(baseUrl, request.url);
|
|
334
361
|
this.requestLogger.logError({
|
|
335
362
|
integrationId: integration.id,
|
|
@@ -527,7 +554,7 @@ exports.IntegrationLibsModule = _ts_decorate8([
|
|
|
527
554
|
// ../../packages/dvss-integration-libs/src/integration-traffic-router/constants/traffic-router.constant.ts
|
|
528
555
|
var TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY = "traffic-router-configuration-store";
|
|
529
556
|
|
|
530
|
-
// ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/auth/auth.base.ts
|
|
557
|
+
// ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/auth-management/auth.base.ts
|
|
531
558
|
var BaseAuth = class {
|
|
532
559
|
static {
|
|
533
560
|
__name(this, "BaseAuth");
|
|
@@ -556,6 +583,9 @@ var CREDIT_FILTER_BY_ENUM = /* @__PURE__ */ (function(CREDIT_FILTER_BY_ENUM2) {
|
|
|
556
583
|
// ../../packages/dvss-integration-libs/src/integration-operation-skeletons/models/capability-integration.model.ts
|
|
557
584
|
var INTEGRATION_PROVIDER_ENUM = /* @__PURE__ */ (function(INTEGRATION_PROVIDER_ENUM2) {
|
|
558
585
|
INTEGRATION_PROVIDER_ENUM2["TRYBE"] = "TRYBE";
|
|
586
|
+
INTEGRATION_PROVIDER_ENUM2["SUPREMA_BIOSTAR"] = "SUPREMA_BIOSTAR";
|
|
587
|
+
INTEGRATION_PROVIDER_ENUM2["SALTO_PRO"] = "SALTO_PRO";
|
|
588
|
+
INTEGRATION_PROVIDER_ENUM2["SCHINDLER"] = "SCHINDLER";
|
|
559
589
|
return INTEGRATION_PROVIDER_ENUM2;
|
|
560
590
|
})({});
|
|
561
591
|
|
|
@@ -818,6 +848,14 @@ exports.BaseIntegrationConfiguration = class BaseIntegrationConfiguration {
|
|
|
818
848
|
icon: updateData.icon,
|
|
819
849
|
config: configToUpdate,
|
|
820
850
|
parentId: updateData.parentId,
|
|
851
|
+
propertyId: updateData.propertyId,
|
|
852
|
+
capabilityId: updateData.capabilityId,
|
|
853
|
+
providerId: updateData.capabilityProviderId,
|
|
854
|
+
subcategory: updateData.subcategory,
|
|
855
|
+
capabilityIntegrationResourceId: updateData.capabilityIntegrationResourceId,
|
|
856
|
+
groupId: updateData.groupId,
|
|
857
|
+
status: updateData.status,
|
|
858
|
+
availableFor: updateData.availableFor,
|
|
821
859
|
updatedBy: loggedInUserId
|
|
822
860
|
};
|
|
823
861
|
return await this.integrationConfigurationDao.updateCapabilityIntegration({
|
|
@@ -1207,9 +1245,9 @@ var Table = class Table2 {
|
|
|
1207
1245
|
[IsDrizzleTable] = true;
|
|
1208
1246
|
/** @internal */
|
|
1209
1247
|
[ExtraConfigBuilder] = void 0;
|
|
1210
|
-
constructor(name,
|
|
1248
|
+
constructor(name, schema8, baseName) {
|
|
1211
1249
|
this[TableName] = this[OriginalName] = name;
|
|
1212
|
-
this[Schema] =
|
|
1250
|
+
this[Schema] = schema8;
|
|
1213
1251
|
this[BaseName] = baseName;
|
|
1214
1252
|
}
|
|
1215
1253
|
};
|
|
@@ -2185,11 +2223,11 @@ var View = class View2 {
|
|
|
2185
2223
|
static [entityKind] = "View";
|
|
2186
2224
|
/** @internal */
|
|
2187
2225
|
[ViewBaseConfig];
|
|
2188
|
-
constructor({ name: name2, schema:
|
|
2226
|
+
constructor({ name: name2, schema: schema8, selectedFields, query }) {
|
|
2189
2227
|
this[ViewBaseConfig] = {
|
|
2190
2228
|
name: name2,
|
|
2191
2229
|
originalName: name2,
|
|
2192
|
-
schema:
|
|
2230
|
+
schema: schema8,
|
|
2193
2231
|
selectedFields,
|
|
2194
2232
|
query,
|
|
2195
2233
|
isExisting: !query,
|
|
@@ -2545,7 +2583,9 @@ exports.IntegrationConfigurationDao = class IntegrationConfigurationDao2 {
|
|
|
2545
2583
|
*/
|
|
2546
2584
|
async updateCapabilityIntegration(input, loggedInUserId) {
|
|
2547
2585
|
try {
|
|
2548
|
-
this.logger.info(loggedInUserId, this.updateCapabilityIntegration.name, this.fileName, "Updating capability integration"
|
|
2586
|
+
this.logger.info(loggedInUserId, this.updateCapabilityIntegration.name, this.fileName, "Updating capability integration", {
|
|
2587
|
+
input
|
|
2588
|
+
});
|
|
2549
2589
|
const response = await this.conn.update(dvssBackendModuleDatastore.schema.capabilityIntegration).set({
|
|
2550
2590
|
...input.updateData
|
|
2551
2591
|
}).where(eq(dvssBackendModuleDatastore.schema.capabilityIntegration.id, input.id));
|
|
@@ -2791,6 +2831,198 @@ function _ts_param4(paramIndex, decorator) {
|
|
|
2791
2831
|
};
|
|
2792
2832
|
}
|
|
2793
2833
|
__name(_ts_param4, "_ts_param");
|
|
2834
|
+
exports.IntegrationSubcapabilityDao = class IntegrationSubcapabilityDao {
|
|
2835
|
+
static {
|
|
2836
|
+
__name(this, "IntegrationSubcapabilityDao");
|
|
2837
|
+
}
|
|
2838
|
+
conn;
|
|
2839
|
+
logger;
|
|
2840
|
+
fileName = "integration-subcapability.dao";
|
|
2841
|
+
constructor(conn, logger) {
|
|
2842
|
+
this.conn = conn;
|
|
2843
|
+
this.logger = logger;
|
|
2844
|
+
}
|
|
2845
|
+
/**
|
|
2846
|
+
* Returns subcapability id for given capabilityId and subcapability name.
|
|
2847
|
+
* Enforces uniqueness: if more than one active row is found, throws an error.
|
|
2848
|
+
* If no active row is found, returns undefined (caller decides how to handle).
|
|
2849
|
+
*/
|
|
2850
|
+
async getSubcapabilityId(input, loggedInUserId) {
|
|
2851
|
+
this.logger.info(loggedInUserId, this.getSubcapabilityId.name, this.fileName, "IntegrationSubcapabilityDao -> getSubcapabilityId called", {
|
|
2852
|
+
input
|
|
2853
|
+
});
|
|
2854
|
+
try {
|
|
2855
|
+
const rows = await this.conn.query.subcapability.findMany({
|
|
2856
|
+
where: and(eq(dvssBackendModuleDatastore.schema.subcapability.capabilityId, input.capabilityId), eq(dvssBackendModuleDatastore.schema.subcapability.name, input.name), isNull(dvssBackendModuleDatastore.schema.subcapability.deletedAt))
|
|
2857
|
+
});
|
|
2858
|
+
if (rows.length === 0) {
|
|
2859
|
+
this.logger.error(loggedInUserId, this.getSubcapabilityId.name, this.fileName, "Subcapability not found for given capabilityId and name", {
|
|
2860
|
+
input
|
|
2861
|
+
});
|
|
2862
|
+
return void 0;
|
|
2863
|
+
}
|
|
2864
|
+
return rows[0].id;
|
|
2865
|
+
} catch (error) {
|
|
2866
|
+
this.logger.error(loggedInUserId, this.getSubcapabilityId.name, this.fileName, "Error in getSubcapabilityId", error, {
|
|
2867
|
+
input
|
|
2868
|
+
});
|
|
2869
|
+
throw error;
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
};
|
|
2873
|
+
exports.IntegrationSubcapabilityDao = _ts_decorate13([
|
|
2874
|
+
common.Injectable(),
|
|
2875
|
+
_ts_param4(0, common.Inject(dvssBackendModuleDatastore.appConstants.DB_CONNECTION)),
|
|
2876
|
+
_ts_metadata10("design:type", Function),
|
|
2877
|
+
_ts_metadata10("design:paramtypes", [
|
|
2878
|
+
typeof MySql2Database === "undefined" ? Object : MySql2Database,
|
|
2879
|
+
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
2880
|
+
])
|
|
2881
|
+
], exports.IntegrationSubcapabilityDao);
|
|
2882
|
+
function _ts_decorate14(decorators, target, key, desc2) {
|
|
2883
|
+
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
2884
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
2885
|
+
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;
|
|
2886
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2887
|
+
}
|
|
2888
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
2889
|
+
function _ts_metadata11(k, v) {
|
|
2890
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2891
|
+
}
|
|
2892
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
2893
|
+
function _ts_param5(paramIndex, decorator) {
|
|
2894
|
+
return function(target, key) {
|
|
2895
|
+
decorator(target, key, paramIndex);
|
|
2896
|
+
};
|
|
2897
|
+
}
|
|
2898
|
+
__name(_ts_param5, "_ts_param");
|
|
2899
|
+
exports.IntegrationServiceCommunicationTopicDao = class IntegrationServiceCommunicationTopicDao {
|
|
2900
|
+
static {
|
|
2901
|
+
__name(this, "IntegrationServiceCommunicationTopicDao");
|
|
2902
|
+
}
|
|
2903
|
+
conn;
|
|
2904
|
+
logger;
|
|
2905
|
+
fileName = "integration-service-communication-topic.dao";
|
|
2906
|
+
constructor(conn, logger) {
|
|
2907
|
+
this.conn = conn;
|
|
2908
|
+
this.logger = logger;
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Upserts a service communication topic for a given deployment + capability/subcapability/operation.
|
|
2912
|
+
* If a matching topic exists (by deploymentId + capability + subcapability + subcapabilityOperation),
|
|
2913
|
+
* it will be updated; otherwise a new row will be inserted.
|
|
2914
|
+
*/
|
|
2915
|
+
async upsertTopic(input, loggedInUserId = dvssBackendModuleUtility.SYSTEM_USER_ID) {
|
|
2916
|
+
this.logger.info(loggedInUserId, this.upsertTopic.name, this.fileName, "IntegrationServiceCommunicationTopicDao -> upsertTopic called", {
|
|
2917
|
+
input
|
|
2918
|
+
});
|
|
2919
|
+
try {
|
|
2920
|
+
const existing = await this.conn.query.serviceCommunicationTopic.findFirst({
|
|
2921
|
+
where: and(
|
|
2922
|
+
eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.deploymentId, input.deploymentId),
|
|
2923
|
+
eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.projectId, input.projectId),
|
|
2924
|
+
isNull(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.deletedAt),
|
|
2925
|
+
...input.capability ? [
|
|
2926
|
+
eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.capability, input.capability)
|
|
2927
|
+
] : [],
|
|
2928
|
+
...input.subcapability ? [
|
|
2929
|
+
eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.subcapability, input.subcapability)
|
|
2930
|
+
] : [],
|
|
2931
|
+
eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.subcapabilityOperation, input.subcapabilityOperation),
|
|
2932
|
+
...input.capabilityIntegrationId ? [
|
|
2933
|
+
eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.capabilityIntegrationId, input.capabilityIntegrationId)
|
|
2934
|
+
] : []
|
|
2935
|
+
)
|
|
2936
|
+
});
|
|
2937
|
+
if (existing) {
|
|
2938
|
+
await this.conn.update(dvssBackendModuleDatastore.schema.serviceCommunicationTopic).set({
|
|
2939
|
+
topicType: input.topicType,
|
|
2940
|
+
topicName: input.topicName,
|
|
2941
|
+
isUniversal: input.isUniversal ?? existing.isUniversal,
|
|
2942
|
+
shouldPublish: input.shouldPublish ?? existing.shouldPublish,
|
|
2943
|
+
shouldSubscribe: input.shouldSubscribe ?? existing.shouldSubscribe,
|
|
2944
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
2945
|
+
updatedBy: loggedInUserId
|
|
2946
|
+
}).where(eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.id, existing.id));
|
|
2947
|
+
return {
|
|
2948
|
+
status: true
|
|
2949
|
+
};
|
|
2950
|
+
}
|
|
2951
|
+
await this.conn.insert(dvssBackendModuleDatastore.schema.serviceCommunicationTopic).values({
|
|
2952
|
+
projectId: input.projectId,
|
|
2953
|
+
propertyId: input.propertyId,
|
|
2954
|
+
deploymentId: input.deploymentId,
|
|
2955
|
+
capability: input.capability,
|
|
2956
|
+
subcapability: input.subcapability,
|
|
2957
|
+
subcapabilityOperation: input.subcapabilityOperation,
|
|
2958
|
+
topicType: input.topicType,
|
|
2959
|
+
topicName: input.topicName,
|
|
2960
|
+
isUniversal: input.isUniversal ?? false,
|
|
2961
|
+
shouldPublish: input.shouldPublish ?? false,
|
|
2962
|
+
shouldSubscribe: input.shouldSubscribe ?? true,
|
|
2963
|
+
createdBy: loggedInUserId,
|
|
2964
|
+
capabilityIntegrationId: input.capabilityIntegrationId
|
|
2965
|
+
});
|
|
2966
|
+
return {
|
|
2967
|
+
status: true
|
|
2968
|
+
};
|
|
2969
|
+
} catch (error) {
|
|
2970
|
+
this.logger.error(loggedInUserId, this.upsertTopic.name, this.fileName, "Error in upsertTopic", error, {
|
|
2971
|
+
input
|
|
2972
|
+
});
|
|
2973
|
+
throw error;
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Returns all service communication topics for a given integration.
|
|
2978
|
+
* NOTE: Currently filters by deploymentId using the provided integrationId;
|
|
2979
|
+
* once capabilityIntegrationId is available in the public typings, this can
|
|
2980
|
+
* be updated to filter by that column instead.
|
|
2981
|
+
*/
|
|
2982
|
+
async getServiceCommunicationTopics(integrationId, loggedInUserId = dvssBackendModuleUtility.SYSTEM_USER_ID) {
|
|
2983
|
+
this.logger.info(loggedInUserId, this.getServiceCommunicationTopics.name, this.fileName, "IntegrationServiceCommunicationTopicDao -> getServiceCommunicationTopics called", {
|
|
2984
|
+
integrationId
|
|
2985
|
+
});
|
|
2986
|
+
try {
|
|
2987
|
+
const topics = await this.conn.select({
|
|
2988
|
+
...getTableColumns(dvssBackendModuleDatastore.schema.serviceCommunicationTopic),
|
|
2989
|
+
subcapability: getTableColumns(dvssBackendModuleDatastore.schema.subcapability)
|
|
2990
|
+
}).from(dvssBackendModuleDatastore.schema.serviceCommunicationTopic).innerJoin(dvssBackendModuleDatastore.schema.subcapability, eq(dvssBackendModuleDatastore.schema.subcapability.id, dvssBackendModuleDatastore.schema.serviceCommunicationTopic.subcapability)).where(and(eq(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.capabilityIntegrationId, integrationId), isNull(dvssBackendModuleDatastore.schema.serviceCommunicationTopic.deletedAt)));
|
|
2991
|
+
return topics;
|
|
2992
|
+
} catch (error) {
|
|
2993
|
+
this.logger.error(loggedInUserId, this.getServiceCommunicationTopics.name, this.fileName, "Error in getServiceCommunicationTopics", error, {
|
|
2994
|
+
integrationId
|
|
2995
|
+
});
|
|
2996
|
+
throw error;
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
};
|
|
3000
|
+
exports.IntegrationServiceCommunicationTopicDao = _ts_decorate14([
|
|
3001
|
+
common.Injectable(),
|
|
3002
|
+
_ts_param5(0, common.Inject(dvssBackendModuleDatastore.appConstants.DB_CONNECTION)),
|
|
3003
|
+
_ts_metadata11("design:type", Function),
|
|
3004
|
+
_ts_metadata11("design:paramtypes", [
|
|
3005
|
+
typeof MySql2Database === "undefined" ? Object : MySql2Database,
|
|
3006
|
+
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
3007
|
+
])
|
|
3008
|
+
], exports.IntegrationServiceCommunicationTopicDao);
|
|
3009
|
+
function _ts_decorate15(decorators, target, key, desc2) {
|
|
3010
|
+
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3011
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3012
|
+
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;
|
|
3013
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3014
|
+
}
|
|
3015
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
3016
|
+
function _ts_metadata12(k, v) {
|
|
3017
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3018
|
+
}
|
|
3019
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
3020
|
+
function _ts_param6(paramIndex, decorator) {
|
|
3021
|
+
return function(target, key) {
|
|
3022
|
+
decorator(target, key, paramIndex);
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
__name(_ts_param6, "_ts_param");
|
|
2794
3026
|
exports.IntegrationResourceManagementDao = class IntegrationResourceManagementDao {
|
|
2795
3027
|
static {
|
|
2796
3028
|
__name(this, "IntegrationResourceManagementDao");
|
|
@@ -2952,32 +3184,32 @@ exports.IntegrationResourceManagementDao = class IntegrationResourceManagementDa
|
|
|
2952
3184
|
}
|
|
2953
3185
|
}
|
|
2954
3186
|
};
|
|
2955
|
-
exports.IntegrationResourceManagementDao =
|
|
3187
|
+
exports.IntegrationResourceManagementDao = _ts_decorate15([
|
|
2956
3188
|
common.Injectable(),
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3189
|
+
_ts_param6(0, common.Inject(dvssBackendModuleDatastore.appConstants.DB_CONNECTION)),
|
|
3190
|
+
_ts_metadata12("design:type", Function),
|
|
3191
|
+
_ts_metadata12("design:paramtypes", [
|
|
2960
3192
|
typeof MySql2Database === "undefined" ? Object : MySql2Database,
|
|
2961
3193
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
2962
3194
|
])
|
|
2963
3195
|
], exports.IntegrationResourceManagementDao);
|
|
2964
|
-
function
|
|
3196
|
+
function _ts_decorate16(decorators, target, key, desc2) {
|
|
2965
3197
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
2966
3198
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
2967
3199
|
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;
|
|
2968
3200
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2969
3201
|
}
|
|
2970
|
-
__name(
|
|
2971
|
-
function
|
|
3202
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
3203
|
+
function _ts_metadata13(k, v) {
|
|
2972
3204
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2973
3205
|
}
|
|
2974
|
-
__name(
|
|
2975
|
-
function
|
|
3206
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
3207
|
+
function _ts_param7(paramIndex, decorator) {
|
|
2976
3208
|
return function(target, key) {
|
|
2977
3209
|
decorator(target, key, paramIndex);
|
|
2978
3210
|
};
|
|
2979
3211
|
}
|
|
2980
|
-
__name(
|
|
3212
|
+
__name(_ts_param7, "_ts_param");
|
|
2981
3213
|
exports.IntegrationUserManagementDao = class IntegrationUserManagementDao {
|
|
2982
3214
|
static {
|
|
2983
3215
|
__name(this, "IntegrationUserManagementDao");
|
|
@@ -2987,25 +3219,134 @@ exports.IntegrationUserManagementDao = class IntegrationUserManagementDao {
|
|
|
2987
3219
|
this.conn = conn;
|
|
2988
3220
|
}
|
|
2989
3221
|
};
|
|
2990
|
-
exports.IntegrationUserManagementDao =
|
|
3222
|
+
exports.IntegrationUserManagementDao = _ts_decorate16([
|
|
2991
3223
|
common.Injectable(),
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
3224
|
+
_ts_param7(0, common.Inject(dvssBackendModuleDatastore.appConstants.DB_CONNECTION)),
|
|
3225
|
+
_ts_metadata13("design:type", Function),
|
|
3226
|
+
_ts_metadata13("design:paramtypes", [
|
|
2995
3227
|
typeof MySql2Database === "undefined" ? Object : MySql2Database
|
|
2996
3228
|
])
|
|
2997
3229
|
], exports.IntegrationUserManagementDao);
|
|
2998
|
-
function
|
|
3230
|
+
function _ts_decorate17(decorators, target, key, desc2) {
|
|
2999
3231
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3000
3232
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3001
3233
|
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;
|
|
3002
3234
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3003
3235
|
}
|
|
3004
|
-
__name(
|
|
3005
|
-
function
|
|
3236
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
3237
|
+
function _ts_metadata14(k, v) {
|
|
3006
3238
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3007
3239
|
}
|
|
3008
|
-
__name(
|
|
3240
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
3241
|
+
function _ts_param8(paramIndex, decorator) {
|
|
3242
|
+
return function(target, key) {
|
|
3243
|
+
decorator(target, key, paramIndex);
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
__name(_ts_param8, "_ts_param");
|
|
3247
|
+
exports.IntegrationOnpremDeploymentDao = class IntegrationOnpremDeploymentDao {
|
|
3248
|
+
static {
|
|
3249
|
+
__name(this, "IntegrationOnpremDeploymentDao");
|
|
3250
|
+
}
|
|
3251
|
+
conn;
|
|
3252
|
+
logger;
|
|
3253
|
+
fileName = "integration-onprem-deployment.dao";
|
|
3254
|
+
constructor(conn, logger) {
|
|
3255
|
+
this.conn = conn;
|
|
3256
|
+
this.logger = logger;
|
|
3257
|
+
}
|
|
3258
|
+
async addUpdateOnpremDeployment(input, loggedInUserId = dvssBackendModuleUtility.SYSTEM_USER_ID) {
|
|
3259
|
+
try {
|
|
3260
|
+
this.logger.info(loggedInUserId, this.addUpdateOnpremDeployment.name, this.fileName, `IntegrationOnpremDeploymentDao -> addUpdateOnpremDeployment called`, {
|
|
3261
|
+
input
|
|
3262
|
+
});
|
|
3263
|
+
const existingEntry = await this.conn.query.onPremDeployment.findFirst({
|
|
3264
|
+
where: and(eq(dvssBackendModuleDatastore.schema.onPremDeployment.projectId, input.projectId), eq(dvssBackendModuleDatastore.schema.onPremDeployment.capabilityIntegrationId, input.capabilityIntegrationId))
|
|
3265
|
+
});
|
|
3266
|
+
if (existingEntry) {
|
|
3267
|
+
await this.updateOnpremDeployment(existingEntry.id, input, loggedInUserId);
|
|
3268
|
+
return {
|
|
3269
|
+
status: true,
|
|
3270
|
+
id: existingEntry.id
|
|
3271
|
+
};
|
|
3272
|
+
}
|
|
3273
|
+
return this.addOnpremDeployment(input, loggedInUserId);
|
|
3274
|
+
} catch (error) {
|
|
3275
|
+
this.logger.error(loggedInUserId, this.addUpdateOnpremDeployment.name, this.fileName, "Error in addCapabilityIntegration", error, {
|
|
3276
|
+
input
|
|
3277
|
+
});
|
|
3278
|
+
throw error;
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
async addOnpremDeployment(input, loggedInUserId = dvssBackendModuleUtility.SYSTEM_USER_ID) {
|
|
3282
|
+
try {
|
|
3283
|
+
const [insertedResult] = await this.conn.insert(dvssBackendModuleDatastore.schema.onPremDeployment).values(input).$returningId();
|
|
3284
|
+
return {
|
|
3285
|
+
status: true,
|
|
3286
|
+
id: BigInt(insertedResult.id)
|
|
3287
|
+
};
|
|
3288
|
+
} catch (error) {
|
|
3289
|
+
this.logger.error(loggedInUserId, this.addOnpremDeployment.name, this.fileName, "Error in addOnpremDeployment", error, {
|
|
3290
|
+
input
|
|
3291
|
+
});
|
|
3292
|
+
throw error;
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
async updateOnpremDeployment(id, updateData, loggedInUserId = dvssBackendModuleUtility.SYSTEM_USER_ID) {
|
|
3296
|
+
try {
|
|
3297
|
+
const result = await this.conn.update(dvssBackendModuleDatastore.schema.onPremDeployment).set(updateData).where(eq(dvssBackendModuleDatastore.schema.onPremDeployment.id, id)).execute();
|
|
3298
|
+
return {
|
|
3299
|
+
status: result[0].affectedRows > 0,
|
|
3300
|
+
id
|
|
3301
|
+
};
|
|
3302
|
+
} catch (error) {
|
|
3303
|
+
this.logger.error(loggedInUserId, this.updateOnpremDeployment.name, this.fileName, "Error in updateOnpremDeployment", error, {
|
|
3304
|
+
id,
|
|
3305
|
+
updateData
|
|
3306
|
+
});
|
|
3307
|
+
throw error;
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
/**
|
|
3311
|
+
* Gets an on-prem deployment by capability integration id.
|
|
3312
|
+
* Used by Suprema integration to resolve deployment for a given integration.
|
|
3313
|
+
*/
|
|
3314
|
+
async getOnpremDeployment(input, loggedInUserId = dvssBackendModuleUtility.SYSTEM_USER_ID) {
|
|
3315
|
+
try {
|
|
3316
|
+
this.logger.info(loggedInUserId, this.getOnpremDeployment.name, this.fileName, "IntegrationOnpremDeploymentDao -> getOnpremDeployment called", {
|
|
3317
|
+
input
|
|
3318
|
+
});
|
|
3319
|
+
return await this.conn.query.onPremDeployment.findFirst({
|
|
3320
|
+
where: and(eq(dvssBackendModuleDatastore.schema.onPremDeployment.projectId, input.projectId), eq(dvssBackendModuleDatastore.schema.onPremDeployment.capabilityIntegrationId, input.integrationId), isNull(dvssBackendModuleDatastore.schema.onPremDeployment.deletedAt))
|
|
3321
|
+
});
|
|
3322
|
+
} catch (error) {
|
|
3323
|
+
this.logger.error(loggedInUserId, this.getOnpremDeployment.name, this.fileName, "Error in getOnpremDeployment", error, {
|
|
3324
|
+
input
|
|
3325
|
+
});
|
|
3326
|
+
throw error;
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
};
|
|
3330
|
+
exports.IntegrationOnpremDeploymentDao = _ts_decorate17([
|
|
3331
|
+
common.Injectable(),
|
|
3332
|
+
_ts_param8(0, common.Inject(dvssBackendModuleDatastore.appConstants.DB_CONNECTION)),
|
|
3333
|
+
_ts_metadata14("design:type", Function),
|
|
3334
|
+
_ts_metadata14("design:paramtypes", [
|
|
3335
|
+
typeof MySql2Database === "undefined" ? Object : MySql2Database,
|
|
3336
|
+
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
3337
|
+
])
|
|
3338
|
+
], exports.IntegrationOnpremDeploymentDao);
|
|
3339
|
+
function _ts_decorate18(decorators, target, key, desc2) {
|
|
3340
|
+
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3341
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3342
|
+
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;
|
|
3343
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3344
|
+
}
|
|
3345
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
3346
|
+
function _ts_metadata15(k, v) {
|
|
3347
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3348
|
+
}
|
|
3349
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
3009
3350
|
var AppService3 = class {
|
|
3010
3351
|
static {
|
|
3011
3352
|
__name(this, "AppService");
|
|
@@ -3020,24 +3361,24 @@ var AppService3 = class {
|
|
|
3020
3361
|
return "Hello World!";
|
|
3021
3362
|
}
|
|
3022
3363
|
};
|
|
3023
|
-
AppService3 =
|
|
3364
|
+
AppService3 = _ts_decorate18([
|
|
3024
3365
|
common.Injectable(),
|
|
3025
|
-
|
|
3026
|
-
|
|
3366
|
+
_ts_metadata15("design:type", Function),
|
|
3367
|
+
_ts_metadata15("design:paramtypes", [])
|
|
3027
3368
|
], AppService3);
|
|
3028
3369
|
|
|
3029
3370
|
// ../../packages/dvss-integration-trybe/src/app.controller.ts
|
|
3030
|
-
function
|
|
3371
|
+
function _ts_decorate19(decorators, target, key, desc2) {
|
|
3031
3372
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3032
3373
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3033
3374
|
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;
|
|
3034
3375
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3035
3376
|
}
|
|
3036
|
-
__name(
|
|
3037
|
-
function
|
|
3377
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
3378
|
+
function _ts_metadata16(k, v) {
|
|
3038
3379
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3039
3380
|
}
|
|
3040
|
-
__name(
|
|
3381
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
3041
3382
|
var AppController3 = class {
|
|
3042
3383
|
static {
|
|
3043
3384
|
__name(this, "AppController");
|
|
@@ -3050,43 +3391,101 @@ var AppController3 = class {
|
|
|
3050
3391
|
return this.appService.getHello();
|
|
3051
3392
|
}
|
|
3052
3393
|
};
|
|
3053
|
-
|
|
3394
|
+
_ts_decorate19([
|
|
3054
3395
|
common.Get("integration-trybe"),
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3396
|
+
_ts_metadata16("design:type", Function),
|
|
3397
|
+
_ts_metadata16("design:paramtypes", []),
|
|
3398
|
+
_ts_metadata16("design:returntype", String)
|
|
3058
3399
|
], AppController3.prototype, "getHello", null);
|
|
3059
|
-
AppController3 =
|
|
3400
|
+
AppController3 = _ts_decorate19([
|
|
3060
3401
|
common.Controller(),
|
|
3061
|
-
|
|
3062
|
-
|
|
3402
|
+
_ts_metadata16("design:type", Function),
|
|
3403
|
+
_ts_metadata16("design:paramtypes", [
|
|
3063
3404
|
typeof AppService3 === "undefined" ? Object : AppService3
|
|
3064
3405
|
])
|
|
3065
3406
|
], AppController3);
|
|
3066
|
-
function
|
|
3407
|
+
function _ts_decorate20(decorators, target, key, desc2) {
|
|
3067
3408
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3068
3409
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3069
3410
|
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;
|
|
3070
3411
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3071
3412
|
}
|
|
3072
|
-
__name(
|
|
3073
|
-
function
|
|
3413
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
3414
|
+
function _ts_metadata17(k, v) {
|
|
3074
3415
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3075
3416
|
}
|
|
3076
|
-
__name(
|
|
3417
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
3418
|
+
function _ts_param9(paramIndex, decorator) {
|
|
3419
|
+
return function(target, key) {
|
|
3420
|
+
decorator(target, key, paramIndex);
|
|
3421
|
+
};
|
|
3422
|
+
}
|
|
3423
|
+
__name(_ts_param9, "_ts_param");
|
|
3424
|
+
exports.TrybeApiClientService = class TrybeApiClientService {
|
|
3425
|
+
static {
|
|
3426
|
+
__name(this, "TrybeApiClientService");
|
|
3427
|
+
}
|
|
3428
|
+
trybeAuthService;
|
|
3429
|
+
trafficGatewayService;
|
|
3430
|
+
constructor(trybeAuthService, trafficGatewayService) {
|
|
3431
|
+
this.trybeAuthService = trybeAuthService;
|
|
3432
|
+
this.trafficGatewayService = trafficGatewayService;
|
|
3433
|
+
}
|
|
3434
|
+
/**
|
|
3435
|
+
* Validates the integration config and executes an API request via
|
|
3436
|
+
* TrafficGatewayService. BaseUrl and auth headers are applied automatically
|
|
3437
|
+
* from the validated config.
|
|
3438
|
+
*/
|
|
3439
|
+
async executeRequest(request, integration, loggedInUserId) {
|
|
3440
|
+
const validated = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
3441
|
+
return this.trafficGatewayService.executeIntegrationRequest({
|
|
3442
|
+
...request,
|
|
3443
|
+
baseUrl: validated.config.platformConfig.baseUrl,
|
|
3444
|
+
headers: validated.headers
|
|
3445
|
+
}, validated, loggedInUserId);
|
|
3446
|
+
}
|
|
3447
|
+
};
|
|
3448
|
+
exports.TrybeApiClientService = _ts_decorate20([
|
|
3449
|
+
common.Injectable(),
|
|
3450
|
+
_ts_param9(0, common.Inject(common.forwardRef(() => exports.TrybeAuthService))),
|
|
3451
|
+
_ts_metadata17("design:type", Function),
|
|
3452
|
+
_ts_metadata17("design:paramtypes", [
|
|
3453
|
+
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService,
|
|
3454
|
+
typeof exports.TrafficGatewayService === "undefined" ? Object : exports.TrafficGatewayService
|
|
3455
|
+
])
|
|
3456
|
+
], exports.TrybeApiClientService);
|
|
3457
|
+
|
|
3458
|
+
// ../../packages/dvss-integration-trybe/src/capabilities/customer-management/customer-management.service.ts
|
|
3459
|
+
function _ts_decorate21(decorators, target, key, desc2) {
|
|
3460
|
+
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3461
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3462
|
+
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;
|
|
3463
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3464
|
+
}
|
|
3465
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
3466
|
+
function _ts_metadata18(k, v) {
|
|
3467
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3468
|
+
}
|
|
3469
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
3470
|
+
function _ts_param10(paramIndex, decorator) {
|
|
3471
|
+
return function(target, key) {
|
|
3472
|
+
decorator(target, key, paramIndex);
|
|
3473
|
+
};
|
|
3474
|
+
}
|
|
3475
|
+
__name(_ts_param10, "_ts_param");
|
|
3077
3476
|
exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
3078
3477
|
static {
|
|
3079
3478
|
__name(this, "TrybeCustomerManagement");
|
|
3080
3479
|
}
|
|
3081
3480
|
logger;
|
|
3082
|
-
|
|
3481
|
+
trybeApiClientService;
|
|
3083
3482
|
fileName = "customer-management.service";
|
|
3084
3483
|
/**
|
|
3085
3484
|
* Creates an instance of the service
|
|
3086
3485
|
*/
|
|
3087
|
-
constructor(logger,
|
|
3486
|
+
constructor(logger, trybeApiClientService) {
|
|
3088
3487
|
this.logger = logger;
|
|
3089
|
-
this.
|
|
3488
|
+
this.trybeApiClientService = trybeApiClientService;
|
|
3090
3489
|
}
|
|
3091
3490
|
/**
|
|
3092
3491
|
* Create a new customer on Trybe (POST /customers/customers).
|
|
@@ -3097,11 +3496,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3097
3496
|
this.logger.info(loggedInUserId, this.createCustomer.name, this.fileName, `${_TrybeCustomerManagement.name} -> ${this.createCustomer.name} Called`, {
|
|
3098
3497
|
request
|
|
3099
3498
|
});
|
|
3100
|
-
const response = await this.
|
|
3499
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3101
3500
|
apiMethod: HTTP_METHOD.POST,
|
|
3102
3501
|
url: "/customers/customers",
|
|
3103
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3104
|
-
headers: integration.headers,
|
|
3105
3502
|
body: request
|
|
3106
3503
|
}, integration, loggedInUserId);
|
|
3107
3504
|
return response.data;
|
|
@@ -3120,11 +3517,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3120
3517
|
throw new Error("Either email or customerId is required to get a customer from Trybe");
|
|
3121
3518
|
}
|
|
3122
3519
|
if (request.customerId) {
|
|
3123
|
-
const response = await this.
|
|
3520
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3124
3521
|
apiMethod: HTTP_METHOD.GET,
|
|
3125
|
-
url: `/customers/customers/${request.customerId}
|
|
3126
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3127
|
-
headers: integration.headers
|
|
3522
|
+
url: `/customers/customers/${request.customerId}`
|
|
3128
3523
|
}, integration, loggedInUserId);
|
|
3129
3524
|
if (!response.data) {
|
|
3130
3525
|
return void 0;
|
|
@@ -3132,11 +3527,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3132
3527
|
return response.data;
|
|
3133
3528
|
}
|
|
3134
3529
|
if (request.email) {
|
|
3135
|
-
const response = await this.
|
|
3530
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3136
3531
|
apiMethod: HTTP_METHOD.GET,
|
|
3137
|
-
url: `/customers/customers/?email=${request.email}
|
|
3138
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3139
|
-
headers: integration.headers
|
|
3532
|
+
url: `/customers/customers/?email=${request.email}`
|
|
3140
3533
|
}, integration, loggedInUserId);
|
|
3141
3534
|
if (!response.data || !Array.isArray(response.data)) {
|
|
3142
3535
|
throw new dvssBackendModuleUtility.CustomException(dvssBackendModuleUtility.ERROR_NAMES.BAD_REQUEST, "Invalid Credentials");
|
|
@@ -3157,11 +3550,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3157
3550
|
customerId,
|
|
3158
3551
|
request
|
|
3159
3552
|
});
|
|
3160
|
-
const response = await this.
|
|
3553
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3161
3554
|
apiMethod: HTTP_METHOD.PUT,
|
|
3162
3555
|
url: `/customers/customers/${customerId}`,
|
|
3163
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3164
|
-
headers: integration.headers,
|
|
3165
3556
|
body: request
|
|
3166
3557
|
}, integration, loggedInUserId);
|
|
3167
3558
|
return response.data;
|
|
@@ -3174,11 +3565,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3174
3565
|
this.logger.info(loggedInUserId, this.deleteCustomer.name, this.fileName, `${_TrybeCustomerManagement.name} -> ${this.deleteCustomer.name} Called`, {
|
|
3175
3566
|
customerId
|
|
3176
3567
|
});
|
|
3177
|
-
await this.
|
|
3568
|
+
await this.trybeApiClientService.executeRequest({
|
|
3178
3569
|
apiMethod: HTTP_METHOD.DELETE,
|
|
3179
|
-
url: `/customers/customers/${customerId}
|
|
3180
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3181
|
-
headers: integration.headers
|
|
3570
|
+
url: `/customers/customers/${customerId}`
|
|
3182
3571
|
}, integration, loggedInUserId);
|
|
3183
3572
|
return {
|
|
3184
3573
|
status: true
|
|
@@ -3189,12 +3578,13 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3189
3578
|
}
|
|
3190
3579
|
}
|
|
3191
3580
|
};
|
|
3192
|
-
exports.TrybeCustomerManagement =
|
|
3581
|
+
exports.TrybeCustomerManagement = _ts_decorate21([
|
|
3193
3582
|
common.Injectable(),
|
|
3194
|
-
|
|
3195
|
-
|
|
3583
|
+
_ts_param10(1, common.Inject(common.forwardRef(() => exports.TrybeApiClientService))),
|
|
3584
|
+
_ts_metadata18("design:type", Function),
|
|
3585
|
+
_ts_metadata18("design:paramtypes", [
|
|
3196
3586
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3197
|
-
typeof exports.
|
|
3587
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService
|
|
3198
3588
|
])
|
|
3199
3589
|
], exports.TrybeCustomerManagement);
|
|
3200
3590
|
|
|
@@ -3209,18 +3599,18 @@ function isValidHttpUrl(urlString) {
|
|
|
3209
3599
|
}
|
|
3210
3600
|
__name(isValidHttpUrl, "isValidHttpUrl");
|
|
3211
3601
|
|
|
3212
|
-
// ../../packages/dvss-integration-trybe/src/capabilities/auth/auth.service.ts
|
|
3213
|
-
function
|
|
3602
|
+
// ../../packages/dvss-integration-trybe/src/capabilities/auth-management/auth.service.ts
|
|
3603
|
+
function _ts_decorate22(decorators, target, key, desc2) {
|
|
3214
3604
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3215
3605
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3216
3606
|
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;
|
|
3217
3607
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3218
3608
|
}
|
|
3219
|
-
__name(
|
|
3220
|
-
function
|
|
3609
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
3610
|
+
function _ts_metadata19(k, v) {
|
|
3221
3611
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3222
3612
|
}
|
|
3223
|
-
__name(
|
|
3613
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
3224
3614
|
exports.TrybeAuthService = class _TrybeAuthService {
|
|
3225
3615
|
static {
|
|
3226
3616
|
__name(this, "TrybeAuthService");
|
|
@@ -3318,10 +3708,10 @@ exports.TrybeAuthService = class _TrybeAuthService {
|
|
|
3318
3708
|
throw new Error("Method not implemented.");
|
|
3319
3709
|
}
|
|
3320
3710
|
};
|
|
3321
|
-
exports.TrybeAuthService =
|
|
3711
|
+
exports.TrybeAuthService = _ts_decorate22([
|
|
3322
3712
|
common.Injectable(),
|
|
3323
|
-
|
|
3324
|
-
|
|
3713
|
+
_ts_metadata19("design:type", Function),
|
|
3714
|
+
_ts_metadata19("design:paramtypes", [
|
|
3325
3715
|
typeof exports.TrybeCustomerManagement === "undefined" ? Object : exports.TrybeCustomerManagement,
|
|
3326
3716
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
3327
3717
|
])
|
|
@@ -3384,32 +3774,30 @@ function mapTrybeCreditsToSystem(res, integration) {
|
|
|
3384
3774
|
__name(mapTrybeCreditsToSystem, "mapTrybeCreditsToSystem");
|
|
3385
3775
|
|
|
3386
3776
|
// ../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.service.ts
|
|
3387
|
-
function
|
|
3777
|
+
function _ts_decorate23(decorators, target, key, desc2) {
|
|
3388
3778
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3389
3779
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3390
3780
|
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;
|
|
3391
3781
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3392
3782
|
}
|
|
3393
|
-
__name(
|
|
3394
|
-
function
|
|
3783
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
3784
|
+
function _ts_metadata20(k, v) {
|
|
3395
3785
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3396
3786
|
}
|
|
3397
|
-
__name(
|
|
3787
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
3398
3788
|
exports.TrybeCreditBooking = class _TrybeCreditBooking {
|
|
3399
3789
|
static {
|
|
3400
3790
|
__name(this, "TrybeCreditBooking");
|
|
3401
3791
|
}
|
|
3402
3792
|
logger;
|
|
3403
|
-
|
|
3404
|
-
trybeAuthService;
|
|
3793
|
+
trybeApiClientService;
|
|
3405
3794
|
fileName = "credit-booking.service";
|
|
3406
3795
|
/**
|
|
3407
3796
|
* Creates an instance of the service
|
|
3408
3797
|
*/
|
|
3409
|
-
constructor(logger,
|
|
3798
|
+
constructor(logger, trybeApiClientService) {
|
|
3410
3799
|
this.logger = logger;
|
|
3411
|
-
this.
|
|
3412
|
-
this.trybeAuthService = trybeAuthService;
|
|
3800
|
+
this.trybeApiClientService = trybeApiClientService;
|
|
3413
3801
|
}
|
|
3414
3802
|
/**
|
|
3415
3803
|
* Fetches customer credits from Trybe and returns system-format response
|
|
@@ -3420,7 +3808,6 @@ exports.TrybeCreditBooking = class _TrybeCreditBooking {
|
|
|
3420
3808
|
this.logger.info(loggedInUserId, this.fetchCustomerCredits.name, this.fileName, `${_TrybeCreditBooking.name} -> ${this.fetchCustomerCredits.name} Called`, {
|
|
3421
3809
|
request
|
|
3422
3810
|
});
|
|
3423
|
-
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
3424
3811
|
const query = new URLSearchParams();
|
|
3425
3812
|
const opts = request.options;
|
|
3426
3813
|
if (opts?.page != null) query.set("page", String(opts.page));
|
|
@@ -3443,22 +3830,19 @@ exports.TrybeCreditBooking = class _TrybeCreditBooking {
|
|
|
3443
3830
|
}
|
|
3444
3831
|
const queryString = query.toString();
|
|
3445
3832
|
const url = `/customers/customers/${request.customerId}/credits` + (queryString ? `?${queryString}` : "");
|
|
3446
|
-
const raw = await this.
|
|
3833
|
+
const raw = await this.trybeApiClientService.executeRequest({
|
|
3447
3834
|
apiMethod: HTTP_METHOD.GET,
|
|
3448
|
-
url
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
}, validatedIntegration, loggedInUserId);
|
|
3452
|
-
return mapTrybeCreditsToSystem(raw, validatedIntegration);
|
|
3835
|
+
url
|
|
3836
|
+
}, integration, loggedInUserId);
|
|
3837
|
+
return mapTrybeCreditsToSystem(raw, integration);
|
|
3453
3838
|
}
|
|
3454
3839
|
};
|
|
3455
|
-
exports.TrybeCreditBooking =
|
|
3840
|
+
exports.TrybeCreditBooking = _ts_decorate23([
|
|
3456
3841
|
common.Injectable(),
|
|
3457
|
-
|
|
3458
|
-
|
|
3842
|
+
_ts_metadata20("design:type", Function),
|
|
3843
|
+
_ts_metadata20("design:paramtypes", [
|
|
3459
3844
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3460
|
-
typeof exports.
|
|
3461
|
-
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService
|
|
3845
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService
|
|
3462
3846
|
])
|
|
3463
3847
|
], exports.TrybeCreditBooking);
|
|
3464
3848
|
|
|
@@ -3476,25 +3860,25 @@ function mapTrybeSiteResponseToSystem(response) {
|
|
|
3476
3860
|
__name(mapTrybeSiteResponseToSystem, "mapTrybeSiteResponseToSystem");
|
|
3477
3861
|
|
|
3478
3862
|
// ../../packages/dvss-integration-trybe/src/capabilities/integration-configuration/integration-configuration.service.ts
|
|
3479
|
-
function
|
|
3863
|
+
function _ts_decorate24(decorators, target, key, desc2) {
|
|
3480
3864
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3481
3865
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3482
3866
|
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;
|
|
3483
3867
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3484
3868
|
}
|
|
3485
|
-
__name(
|
|
3486
|
-
function
|
|
3869
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
3870
|
+
function _ts_metadata21(k, v) {
|
|
3487
3871
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3488
3872
|
}
|
|
3489
|
-
__name(
|
|
3873
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
3490
3874
|
exports.TrybeIntegrationConfigurationService = class TrybeIntegrationConfigurationService extends exports.BaseIntegrationConfiguration {
|
|
3491
3875
|
static {
|
|
3492
3876
|
__name(this, "TrybeIntegrationConfigurationService");
|
|
3493
3877
|
}
|
|
3878
|
+
trybeApiClientService;
|
|
3494
3879
|
trybeAuthService;
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
super(integrationConfigurationDao, commonValidationDatabaseService, logger), this.trybeAuthService = trybeAuthService, this.trafficGatewayService = trafficGatewayService;
|
|
3880
|
+
constructor(integrationConfigurationDao, commonValidationDatabaseService, logger, trybeApiClientService, trybeAuthService) {
|
|
3881
|
+
super(integrationConfigurationDao, commonValidationDatabaseService, logger), this.trybeApiClientService = trybeApiClientService, this.trybeAuthService = trybeAuthService;
|
|
3498
3882
|
}
|
|
3499
3883
|
/**
|
|
3500
3884
|
* Add capability integration: validate Trybe config, then configuredFor (offering), then delegate to base.
|
|
@@ -3538,24 +3922,22 @@ exports.TrybeIntegrationConfigurationService = class TrybeIntegrationConfigurati
|
|
|
3538
3922
|
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
3539
3923
|
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
3540
3924
|
const url = `/shop/sites/${siteId}`;
|
|
3541
|
-
const response = await this.
|
|
3925
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3542
3926
|
apiMethod: HTTP_METHOD.GET,
|
|
3543
|
-
url
|
|
3544
|
-
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
3545
|
-
headers: validatedIntegration.headers
|
|
3927
|
+
url
|
|
3546
3928
|
}, validatedIntegration, loggedInUserId);
|
|
3547
3929
|
return mapTrybeSiteResponseToSystem(response);
|
|
3548
3930
|
}
|
|
3549
3931
|
};
|
|
3550
|
-
exports.TrybeIntegrationConfigurationService =
|
|
3932
|
+
exports.TrybeIntegrationConfigurationService = _ts_decorate24([
|
|
3551
3933
|
common.Injectable(),
|
|
3552
|
-
|
|
3553
|
-
|
|
3934
|
+
_ts_metadata21("design:type", Function),
|
|
3935
|
+
_ts_metadata21("design:paramtypes", [
|
|
3554
3936
|
typeof exports.IntegrationConfigurationDao === "undefined" ? Object : exports.IntegrationConfigurationDao,
|
|
3555
3937
|
typeof dvssBackendModuleDatastore.CommonValidationDatabaseService === "undefined" ? Object : dvssBackendModuleDatastore.CommonValidationDatabaseService,
|
|
3556
3938
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3557
|
-
typeof exports.
|
|
3558
|
-
typeof exports.
|
|
3939
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService,
|
|
3940
|
+
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService
|
|
3559
3941
|
])
|
|
3560
3942
|
], exports.TrybeIntegrationConfigurationService);
|
|
3561
3943
|
|
|
@@ -3572,17 +3954,17 @@ var TRYBE_CATALOGING_BY_ENUM = /* @__PURE__ */ (function(TRYBE_CATALOGING_BY_ENU
|
|
|
3572
3954
|
})({});
|
|
3573
3955
|
|
|
3574
3956
|
// ../../packages/dvss-integration-trybe/src/capabilities/integration-resource-management/integration-resource-management.service.ts
|
|
3575
|
-
function
|
|
3957
|
+
function _ts_decorate25(decorators, target, key, desc2) {
|
|
3576
3958
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3577
3959
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3578
3960
|
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;
|
|
3579
3961
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3580
3962
|
}
|
|
3581
|
-
__name(
|
|
3582
|
-
function
|
|
3963
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
3964
|
+
function _ts_metadata22(k, v) {
|
|
3583
3965
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3584
3966
|
}
|
|
3585
|
-
__name(
|
|
3967
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
3586
3968
|
var OFFERING_INTEGRATION_MAPPING_ALREADY_EXISTS = "OFFERING_INTEGRATION_MAPPING_ALREADY_EXISTS";
|
|
3587
3969
|
var VALID_JOURNEY_VALUES = /* @__PURE__ */ new Set([
|
|
3588
3970
|
"SESSION",
|
|
@@ -3653,10 +4035,10 @@ exports.TrybeIntegrationResourceManagementService = class TrybeIntegrationResour
|
|
|
3653
4035
|
return await super.updateOfferingIntegrationResourceConfiguration(input, context);
|
|
3654
4036
|
}
|
|
3655
4037
|
};
|
|
3656
|
-
exports.TrybeIntegrationResourceManagementService =
|
|
4038
|
+
exports.TrybeIntegrationResourceManagementService = _ts_decorate25([
|
|
3657
4039
|
common.Injectable(),
|
|
3658
|
-
|
|
3659
|
-
|
|
4040
|
+
_ts_metadata22("design:type", Function),
|
|
4041
|
+
_ts_metadata22("design:paramtypes", [
|
|
3660
4042
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3661
4043
|
typeof exports.IntegrationResourceManagementDao === "undefined" ? Object : exports.IntegrationResourceManagementDao
|
|
3662
4044
|
])
|
|
@@ -3782,17 +4164,17 @@ function getSummaryLabelsInPropertyTimezone(timezone, summary) {
|
|
|
3782
4164
|
__name(getSummaryLabelsInPropertyTimezone, "getSummaryLabelsInPropertyTimezone");
|
|
3783
4165
|
|
|
3784
4166
|
// ../../packages/dvss-integration-trybe/src/utils/webhook/trybe-webhook-util.ts
|
|
3785
|
-
function
|
|
4167
|
+
function _ts_decorate26(decorators, target, key, desc2) {
|
|
3786
4168
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3787
4169
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3788
4170
|
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;
|
|
3789
4171
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3790
4172
|
}
|
|
3791
|
-
__name(
|
|
3792
|
-
function
|
|
4173
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
4174
|
+
function _ts_metadata23(k, v) {
|
|
3793
4175
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3794
4176
|
}
|
|
3795
|
-
__name(
|
|
4177
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
3796
4178
|
exports.TrybeWebhookUtilService = class TrybeWebhookUtilService {
|
|
3797
4179
|
static {
|
|
3798
4180
|
__name(this, "TrybeWebhookUtilService");
|
|
@@ -3984,10 +4366,10 @@ exports.TrybeWebhookUtilService = class TrybeWebhookUtilService {
|
|
|
3984
4366
|
}
|
|
3985
4367
|
}
|
|
3986
4368
|
};
|
|
3987
|
-
exports.TrybeWebhookUtilService =
|
|
4369
|
+
exports.TrybeWebhookUtilService = _ts_decorate26([
|
|
3988
4370
|
common.Injectable(),
|
|
3989
|
-
|
|
3990
|
-
|
|
4371
|
+
_ts_metadata23("design:type", Function),
|
|
4372
|
+
_ts_metadata23("design:paramtypes", [
|
|
3991
4373
|
typeof exports.IntegrationBookingDao === "undefined" ? Object : exports.IntegrationBookingDao,
|
|
3992
4374
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
3993
4375
|
])
|
|
@@ -4384,30 +4766,28 @@ function mapTrybeAppointmentAvailabilityToSystemResponse(slots) {
|
|
|
4384
4766
|
__name(mapTrybeAppointmentAvailabilityToSystemResponse, "mapTrybeAppointmentAvailabilityToSystemResponse");
|
|
4385
4767
|
|
|
4386
4768
|
// ../../packages/dvss-integration-trybe/src/capabilities/wellness/wellness-management.service.ts
|
|
4387
|
-
function
|
|
4769
|
+
function _ts_decorate27(decorators, target, key, desc2) {
|
|
4388
4770
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
4389
4771
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
4390
4772
|
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;
|
|
4391
4773
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4392
4774
|
}
|
|
4393
|
-
__name(
|
|
4394
|
-
function
|
|
4775
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
4776
|
+
function _ts_metadata24(k, v) {
|
|
4395
4777
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4396
4778
|
}
|
|
4397
|
-
__name(
|
|
4779
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
4398
4780
|
exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
4399
4781
|
static {
|
|
4400
4782
|
__name(this, "TrybeWellnessManagement");
|
|
4401
4783
|
}
|
|
4402
4784
|
logger;
|
|
4403
|
-
|
|
4404
|
-
trybeAuthService;
|
|
4785
|
+
trybeApiClientService;
|
|
4405
4786
|
integrationCommonDao;
|
|
4406
4787
|
fileName = "wellness-management.service";
|
|
4407
|
-
constructor(logger,
|
|
4788
|
+
constructor(logger, trybeApiClientService, integrationCommonDao) {
|
|
4408
4789
|
this.logger = logger;
|
|
4409
|
-
this.
|
|
4410
|
-
this.trybeAuthService = trybeAuthService;
|
|
4790
|
+
this.trybeApiClientService = trybeApiClientService;
|
|
4411
4791
|
this.integrationCommonDao = integrationCommonDao;
|
|
4412
4792
|
}
|
|
4413
4793
|
fetchWellnessAppointmentSession() {
|
|
@@ -4446,22 +4826,19 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4446
4826
|
async createOrder(request, integration, loggedInUserId) {
|
|
4447
4827
|
let orderId;
|
|
4448
4828
|
try {
|
|
4449
|
-
const
|
|
4450
|
-
const siteId = validated.config.integrationConfig.siteId;
|
|
4829
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4451
4830
|
const offering = await this.getOffering({
|
|
4452
4831
|
offeringId: request.bookableItems[0].externalId,
|
|
4453
4832
|
offeringType: request.bookableItems[0].type
|
|
4454
4833
|
}, integration, loggedInUserId);
|
|
4455
|
-
const res = await this.
|
|
4834
|
+
const res = await this.trybeApiClientService.executeRequest({
|
|
4456
4835
|
apiMethod: HTTP_METHOD.POST,
|
|
4457
4836
|
url: "/shop/orders",
|
|
4458
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4459
|
-
headers: validated.headers,
|
|
4460
4837
|
body: {
|
|
4461
4838
|
site_id: siteId,
|
|
4462
4839
|
status: "new"
|
|
4463
4840
|
}
|
|
4464
|
-
},
|
|
4841
|
+
}, integration, loggedInUserId);
|
|
4465
4842
|
orderId = res.data.id;
|
|
4466
4843
|
const items = [];
|
|
4467
4844
|
await this.addCustomerToOrder(orderId, request.customerId, integration, loggedInUserId);
|
|
@@ -4506,9 +4883,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4506
4883
|
orderReference: submitOrderResponse.data?.order_ref ?? order.meta.orderReference,
|
|
4507
4884
|
room: bookableItems.find((item) => item.booking_summary?.room?.id)?.booking_summary?.room,
|
|
4508
4885
|
total: (submitOrderResponse.data?.totals?.total ?? 0) / request.currencyMultiplier,
|
|
4509
|
-
subTotal: (submitOrderResponse.data?.totals?.subtotal ?? 0) / request.currencyMultiplier,
|
|
4510
|
-
totalTax: (submitOrderResponse.data?.
|
|
4511
|
-
discount: (submitOrderResponse.data?.discount_total ?? 0) / request.currencyMultiplier
|
|
4886
|
+
subTotal: ((submitOrderResponse.data?.totals?.subtotal ?? 0) - (submitOrderResponse.data?.totals?.exclusive_tax ?? 0)) / request.currencyMultiplier,
|
|
4887
|
+
totalTax: (submitOrderResponse.data?.taxes?.reduce((acc, tax) => acc + (tax.amount ?? 0), 0) ?? 0) / request.currencyMultiplier,
|
|
4888
|
+
discount: (submitOrderResponse.data?.discount_total ?? 0) / request.currencyMultiplier,
|
|
4889
|
+
serviceCharge: (submitOrderResponse.data?.service_charge?.amount ?? 0) / request.currencyMultiplier
|
|
4512
4890
|
},
|
|
4513
4891
|
items: bookableItems.map((bookableItem) => {
|
|
4514
4892
|
return {
|
|
@@ -4541,17 +4919,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4541
4919
|
orderId,
|
|
4542
4920
|
customerId
|
|
4543
4921
|
});
|
|
4544
|
-
|
|
4545
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
4922
|
+
await this.trybeApiClientService.executeRequest({
|
|
4546
4923
|
apiMethod: HTTP_METHOD.POST,
|
|
4547
4924
|
url: `/shop/orders/${orderId}/customer`,
|
|
4548
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4549
|
-
headers: validated.headers,
|
|
4550
4925
|
body: {
|
|
4551
4926
|
id: customerId,
|
|
4552
4927
|
source: "trybe"
|
|
4553
4928
|
}
|
|
4554
|
-
},
|
|
4929
|
+
}, integration, loggedInUserId);
|
|
4555
4930
|
this.logger.info(loggedInUserId, this.addCustomerToOrder.name, this.fileName, "Successfully added customer to Trybe order", {
|
|
4556
4931
|
orderId,
|
|
4557
4932
|
customerId
|
|
@@ -4561,13 +4936,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4561
4936
|
this.logger.info(loggedInUserId, this.getOrder.name, this.fileName, "Fetching Trybe order details", {
|
|
4562
4937
|
orderId
|
|
4563
4938
|
});
|
|
4564
|
-
const
|
|
4565
|
-
const res = await this.trafficGatewayService.executeIntegrationRequest({
|
|
4939
|
+
const res = await this.trybeApiClientService.executeRequest({
|
|
4566
4940
|
apiMethod: HTTP_METHOD.GET,
|
|
4567
|
-
url: `/shop/orders/${orderId}
|
|
4568
|
-
|
|
4569
|
-
headers: validated.headers
|
|
4570
|
-
}, validated, loggedInUserId);
|
|
4941
|
+
url: `/shop/orders/${orderId}`
|
|
4942
|
+
}, integration, loggedInUserId);
|
|
4571
4943
|
this.logger.info(loggedInUserId, this.getOrder.name, this.fileName, "Successfully fetched Trybe order details", {
|
|
4572
4944
|
orderId,
|
|
4573
4945
|
guestCount: res.data.guests.length
|
|
@@ -4602,7 +4974,6 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4602
4974
|
offeringId: request.item.offeringId,
|
|
4603
4975
|
offeringType: request.item.offeringType
|
|
4604
4976
|
});
|
|
4605
|
-
const validated = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
4606
4977
|
const { orderId, item } = request;
|
|
4607
4978
|
const offeringType = this.mapOfferingTypeToTrybeApi(item.offeringType);
|
|
4608
4979
|
let body;
|
|
@@ -4642,13 +5013,11 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4642
5013
|
guest_ids: item.guestIds
|
|
4643
5014
|
};
|
|
4644
5015
|
}
|
|
4645
|
-
const res = await this.
|
|
5016
|
+
const res = await this.trybeApiClientService.executeRequest({
|
|
4646
5017
|
apiMethod: HTTP_METHOD.POST,
|
|
4647
5018
|
url: `/shop/orders/${orderId}/items`,
|
|
4648
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4649
|
-
headers: validated.headers,
|
|
4650
5019
|
body
|
|
4651
|
-
},
|
|
5020
|
+
}, integration, loggedInUserId);
|
|
4652
5021
|
const data = res.data;
|
|
4653
5022
|
const result = {
|
|
4654
5023
|
name: data.booking_summary?.offering?.name ?? data.type_name ?? void 0,
|
|
@@ -4667,16 +5036,13 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4667
5036
|
orderId,
|
|
4668
5037
|
customerCreditId
|
|
4669
5038
|
});
|
|
4670
|
-
|
|
4671
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
5039
|
+
await this.trybeApiClientService.executeRequest({
|
|
4672
5040
|
apiMethod: HTTP_METHOD.POST,
|
|
4673
5041
|
url: `/shop/orders/${orderId}/customer-credits`,
|
|
4674
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4675
|
-
headers: validated.headers,
|
|
4676
5042
|
body: {
|
|
4677
5043
|
id: customerCreditId
|
|
4678
5044
|
}
|
|
4679
|
-
},
|
|
5045
|
+
}, integration, loggedInUserId);
|
|
4680
5046
|
this.logger.info(loggedInUserId, this.addCustomerCreditsToOrder.name, this.fileName, "Successfully added customer credits to Trybe order", {
|
|
4681
5047
|
orderId,
|
|
4682
5048
|
customerCreditId
|
|
@@ -4686,13 +5052,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4686
5052
|
this.logger.info(loggedInUserId, this.submitOrder.name, this.fileName, "Submitting Trybe order", {
|
|
4687
5053
|
orderId
|
|
4688
5054
|
});
|
|
4689
|
-
const
|
|
4690
|
-
const response = await this.trafficGatewayService.executeIntegrationRequest({
|
|
5055
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4691
5056
|
apiMethod: HTTP_METHOD.POST,
|
|
4692
|
-
url: `/shop/orders/${orderId}/submit
|
|
4693
|
-
|
|
4694
|
-
headers: validated.headers
|
|
4695
|
-
}, validated, loggedInUserId);
|
|
5057
|
+
url: `/shop/orders/${orderId}/submit`
|
|
5058
|
+
}, integration, loggedInUserId);
|
|
4696
5059
|
this.logger.info(loggedInUserId, this.submitOrder.name, this.fileName, "Successfully submitted Trybe order", {
|
|
4697
5060
|
orderId
|
|
4698
5061
|
});
|
|
@@ -4702,13 +5065,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4702
5065
|
this.logger.info(loggedInUserId, this.cancelOrder.name, this.fileName, "Cancelling Trybe order", {
|
|
4703
5066
|
orderId
|
|
4704
5067
|
});
|
|
4705
|
-
|
|
4706
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
5068
|
+
await this.trybeApiClientService.executeRequest({
|
|
4707
5069
|
apiMethod: HTTP_METHOD.POST,
|
|
4708
|
-
url: `/shop/orders/${orderId}/cancel
|
|
4709
|
-
|
|
4710
|
-
headers: validated.headers
|
|
4711
|
-
}, validated, loggedInUserId);
|
|
5070
|
+
url: `/shop/orders/${orderId}/cancel`
|
|
5071
|
+
}, integration, loggedInUserId);
|
|
4712
5072
|
this.logger.info(loggedInUserId, this.cancelOrder.name, this.fileName, "Successfully cancelled Trybe order", {
|
|
4713
5073
|
orderId
|
|
4714
5074
|
});
|
|
@@ -4742,7 +5102,6 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4742
5102
|
itemId,
|
|
4743
5103
|
offeringType: request.item.type
|
|
4744
5104
|
});
|
|
4745
|
-
const validated = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
4746
5105
|
const offeringType = this.mapOfferingTypeToTrybeApi(request.item.type);
|
|
4747
5106
|
let body;
|
|
4748
5107
|
if (offeringType === TRYBE_OFFERING_TYPE_API.APPOINTMENT) {
|
|
@@ -4772,13 +5131,11 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4772
5131
|
} else {
|
|
4773
5132
|
throw new Error("Course is not updatable");
|
|
4774
5133
|
}
|
|
4775
|
-
const response = await this.
|
|
5134
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4776
5135
|
apiMethod: HTTP_METHOD.PUT,
|
|
4777
5136
|
url: `/shop/orders/${orderId}/items/${itemId}`,
|
|
4778
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4779
|
-
headers: validated.headers,
|
|
4780
5137
|
body
|
|
4781
|
-
},
|
|
5138
|
+
}, integration, loggedInUserId);
|
|
4782
5139
|
this.logger.info(loggedInUserId, this.updateOrderItem.name, this.fileName, "Successfully updated Trybe order item", {
|
|
4783
5140
|
orderId,
|
|
4784
5141
|
itemId
|
|
@@ -4791,12 +5148,9 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4791
5148
|
amount: request.amount,
|
|
4792
5149
|
paymentTypeId: request.paymentTypeId
|
|
4793
5150
|
});
|
|
4794
|
-
|
|
4795
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
5151
|
+
await this.trybeApiClientService.executeRequest({
|
|
4796
5152
|
apiMethod: HTTP_METHOD.POST,
|
|
4797
5153
|
url: `/shop/orders/${request.orderId}/payments`,
|
|
4798
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4799
|
-
headers: validated.headers,
|
|
4800
5154
|
body: {
|
|
4801
5155
|
amount: request.amount,
|
|
4802
5156
|
processor: "manual",
|
|
@@ -4806,7 +5160,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4806
5160
|
payment_type_id: request.paymentTypeId
|
|
4807
5161
|
}
|
|
4808
5162
|
}
|
|
4809
|
-
},
|
|
5163
|
+
}, integration, loggedInUserId);
|
|
4810
5164
|
this.logger.info(loggedInUserId, this.addPaymentToOrder.name, this.fileName, "Successfully added payment to Trybe order", {
|
|
4811
5165
|
orderId: request.orderId,
|
|
4812
5166
|
amount: request.amount
|
|
@@ -4817,8 +5171,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4817
5171
|
request
|
|
4818
5172
|
});
|
|
4819
5173
|
try {
|
|
4820
|
-
const
|
|
4821
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5174
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4822
5175
|
if (request.shouldFetchAllAppointments && request.options?.page !== void 0) {
|
|
4823
5176
|
throw new Error("Pagination options are not supported when fetching all appointments.");
|
|
4824
5177
|
}
|
|
@@ -4831,18 +5184,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4831
5184
|
}
|
|
4832
5185
|
const queryString = query.toString();
|
|
4833
5186
|
const apiUrl = `/shop/appointment-types?site_id=${siteId}` + (request.practitionerIds && request.practitionerIds.length > 0 ? `&practitioner_id=${request.practitionerIds.join(",")}` : "") + (queryString ? `&${queryString}` : "");
|
|
4834
|
-
const firstPageResponse = await this.
|
|
5187
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
4835
5188
|
apiMethod: HTTP_METHOD.GET,
|
|
4836
|
-
url: apiUrl
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
}, validatedIntegration, loggedInUserId);
|
|
4840
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllAppointments, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5189
|
+
url: apiUrl
|
|
5190
|
+
}, integration, loggedInUserId);
|
|
5191
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllAppointments, (page) => this.trybeApiClientService.executeRequest({
|
|
4841
5192
|
apiMethod: HTTP_METHOD.GET,
|
|
4842
|
-
url: `${apiUrl}&page=${page}
|
|
4843
|
-
|
|
4844
|
-
headers: validatedIntegration.headers
|
|
4845
|
-
}, validatedIntegration, loggedInUserId));
|
|
5193
|
+
url: `${apiUrl}&page=${page}`
|
|
5194
|
+
}, integration, loggedInUserId));
|
|
4846
5195
|
this.logger.info(loggedInUserId, this.fetchAppointments.name, this.fileName, "Successfully fetched Trybe appointments", {
|
|
4847
5196
|
totalRecords: firstPageResponse.meta.total
|
|
4848
5197
|
});
|
|
@@ -4857,15 +5206,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4857
5206
|
request
|
|
4858
5207
|
});
|
|
4859
5208
|
try {
|
|
4860
|
-
const
|
|
4861
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5209
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4862
5210
|
const apiUrl = `/shop/appointment-types/${request.appointmentId}?site_id=${siteId}`;
|
|
4863
|
-
const response = await this.
|
|
5211
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4864
5212
|
apiMethod: HTTP_METHOD.GET,
|
|
4865
|
-
url: apiUrl
|
|
4866
|
-
|
|
4867
|
-
headers: validatedIntegration.headers
|
|
4868
|
-
}, validatedIntegration, loggedInUserId);
|
|
5213
|
+
url: apiUrl
|
|
5214
|
+
}, integration, loggedInUserId);
|
|
4869
5215
|
this.logger.info(loggedInUserId, this.fetchAppointments.name, this.fileName, "Successfully fetched Trybe appointments", {
|
|
4870
5216
|
appointmentId: request.appointmentId
|
|
4871
5217
|
});
|
|
@@ -4880,8 +5226,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4880
5226
|
request
|
|
4881
5227
|
});
|
|
4882
5228
|
try {
|
|
4883
|
-
const
|
|
4884
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5229
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4885
5230
|
if (request.shouldFetchAllSessions && request.options?.page !== void 0) {
|
|
4886
5231
|
throw new Error("Pagination options are not supported when fetching all sessions.");
|
|
4887
5232
|
}
|
|
@@ -4894,18 +5239,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4894
5239
|
}
|
|
4895
5240
|
const queryString = query.toString();
|
|
4896
5241
|
const apiUrl = `/shop/session-types?site_id=${siteId}` + (request.practitionerIds && request.practitionerIds.length > 0 ? `&practitioner_id=${request.practitionerIds.join(",")}` : "") + (queryString ? `&${queryString}` : "");
|
|
4897
|
-
const firstPageResponse = await this.
|
|
5242
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
4898
5243
|
apiMethod: HTTP_METHOD.GET,
|
|
4899
|
-
url: apiUrl
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
}, validatedIntegration, loggedInUserId);
|
|
4903
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllSessions, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5244
|
+
url: apiUrl
|
|
5245
|
+
}, integration, loggedInUserId);
|
|
5246
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllSessions, (page) => this.trybeApiClientService.executeRequest({
|
|
4904
5247
|
apiMethod: HTTP_METHOD.GET,
|
|
4905
|
-
url: `${apiUrl}&page=${page}
|
|
4906
|
-
|
|
4907
|
-
headers: validatedIntegration.headers
|
|
4908
|
-
}, validatedIntegration, loggedInUserId));
|
|
5248
|
+
url: `${apiUrl}&page=${page}`
|
|
5249
|
+
}, integration, loggedInUserId));
|
|
4909
5250
|
this.logger.info(loggedInUserId, this.fetchSessions.name, this.fileName, "Successfully fetched Trybe sessions", {
|
|
4910
5251
|
totalRecords: firstPageResponse.meta.total
|
|
4911
5252
|
});
|
|
@@ -4920,15 +5261,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4920
5261
|
request
|
|
4921
5262
|
});
|
|
4922
5263
|
try {
|
|
4923
|
-
const
|
|
4924
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5264
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4925
5265
|
const apiUrl = `/shop/session-types/${request.sessionId}?site_id=${siteId}`;
|
|
4926
|
-
return await this.
|
|
5266
|
+
return await this.trybeApiClientService.executeRequest({
|
|
4927
5267
|
apiMethod: HTTP_METHOD.GET,
|
|
4928
|
-
url: apiUrl
|
|
4929
|
-
|
|
4930
|
-
headers: validatedIntegration.headers
|
|
4931
|
-
}, validatedIntegration, loggedInUserId);
|
|
5268
|
+
url: apiUrl
|
|
5269
|
+
}, integration, loggedInUserId);
|
|
4932
5270
|
} catch (err) {
|
|
4933
5271
|
this.logger.error(loggedInUserId, this.fetchSession.name, this.fileName, "Error fetching Trybe session", err);
|
|
4934
5272
|
throw err;
|
|
@@ -4939,8 +5277,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4939
5277
|
request
|
|
4940
5278
|
});
|
|
4941
5279
|
try {
|
|
4942
|
-
const
|
|
4943
|
-
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
5280
|
+
const organisationId = integration.config?.integrationConfig?.organisationId;
|
|
4944
5281
|
if (request.shouldFetchAllCourses && request.options?.page !== void 0) {
|
|
4945
5282
|
throw new Error("Pagination options are not supported when fetching all courses.");
|
|
4946
5283
|
}
|
|
@@ -4953,18 +5290,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4953
5290
|
}
|
|
4954
5291
|
const queryString = query.toString();
|
|
4955
5292
|
const apiUrl = `/shop/course-types?organisation_id=${organisationId}` + (queryString ? `&${queryString}` : "");
|
|
4956
|
-
const firstPageResponse = await this.
|
|
5293
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
4957
5294
|
apiMethod: HTTP_METHOD.GET,
|
|
4958
|
-
url: apiUrl
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
}, validatedIntegration, loggedInUserId);
|
|
4962
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCourses, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5295
|
+
url: apiUrl
|
|
5296
|
+
}, integration, loggedInUserId);
|
|
5297
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCourses, (page) => this.trybeApiClientService.executeRequest({
|
|
4963
5298
|
apiMethod: HTTP_METHOD.GET,
|
|
4964
|
-
url: `${apiUrl}&page=${page}
|
|
4965
|
-
|
|
4966
|
-
headers: validatedIntegration.headers
|
|
4967
|
-
}, validatedIntegration, loggedInUserId));
|
|
5299
|
+
url: `${apiUrl}&page=${page}`
|
|
5300
|
+
}, integration, loggedInUserId));
|
|
4968
5301
|
this.logger.info(loggedInUserId, this.fetchCourses.name, this.fileName, "Successfully fetched Trybe courses", {
|
|
4969
5302
|
totalRecords: firstPageResponse.meta.total
|
|
4970
5303
|
});
|
|
@@ -4979,15 +5312,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4979
5312
|
request
|
|
4980
5313
|
});
|
|
4981
5314
|
try {
|
|
4982
|
-
const
|
|
4983
|
-
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
5315
|
+
const organisationId = integration.config?.integrationConfig?.organisationId;
|
|
4984
5316
|
const apiUrl = `/shop/course-types/${request.courseId}?organisation_id=${organisationId}`;
|
|
4985
|
-
const response = await this.
|
|
5317
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4986
5318
|
apiMethod: HTTP_METHOD.GET,
|
|
4987
|
-
url: apiUrl
|
|
4988
|
-
|
|
4989
|
-
headers: validatedIntegration.headers
|
|
4990
|
-
}, validatedIntegration, loggedInUserId);
|
|
5319
|
+
url: apiUrl
|
|
5320
|
+
}, integration, loggedInUserId);
|
|
4991
5321
|
this.logger.info(loggedInUserId, this.fetchCourse.name, this.fileName, "Successfully fetched Trybe course", {
|
|
4992
5322
|
courseId: request.courseId
|
|
4993
5323
|
});
|
|
@@ -5002,21 +5332,16 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5002
5332
|
request
|
|
5003
5333
|
});
|
|
5004
5334
|
try {
|
|
5005
|
-
const
|
|
5006
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5335
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
5007
5336
|
const apiUrl = `/shop/practitioners/?site_id=${siteId}`;
|
|
5008
|
-
const firstPageResponse = await this.
|
|
5337
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
5009
5338
|
apiMethod: HTTP_METHOD.GET,
|
|
5010
|
-
url: apiUrl
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
}, validatedIntegration, loggedInUserId);
|
|
5014
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllPractitioners, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5339
|
+
url: apiUrl
|
|
5340
|
+
}, integration, loggedInUserId);
|
|
5341
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllPractitioners, (page) => this.trybeApiClientService.executeRequest({
|
|
5015
5342
|
apiMethod: HTTP_METHOD.GET,
|
|
5016
|
-
url: `${apiUrl}&page=${page}
|
|
5017
|
-
|
|
5018
|
-
headers: validatedIntegration.headers
|
|
5019
|
-
}, validatedIntegration, loggedInUserId));
|
|
5343
|
+
url: `${apiUrl}&page=${page}`
|
|
5344
|
+
}, integration, loggedInUserId));
|
|
5020
5345
|
this.logger.info(loggedInUserId, this.fetchPractitioners.name, this.fileName, "Successfully fetched Trybe practitioners", {
|
|
5021
5346
|
totalRecords: firstPageResponse.meta.total
|
|
5022
5347
|
});
|
|
@@ -5031,8 +5356,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5031
5356
|
request
|
|
5032
5357
|
});
|
|
5033
5358
|
try {
|
|
5034
|
-
const
|
|
5035
|
-
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
5359
|
+
const organisationId = integration.config?.integrationConfig?.organisationId;
|
|
5036
5360
|
if (request.shouldFetchAllCategories && request.options?.page !== void 0) {
|
|
5037
5361
|
throw new Error("Pagination options are not supported when fetching all categories.");
|
|
5038
5362
|
}
|
|
@@ -5045,18 +5369,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5045
5369
|
}
|
|
5046
5370
|
const queryString = query.toString();
|
|
5047
5371
|
const apiUrl = `/shop/organisations/${organisationId}/categories` + (queryString ? `?${queryString}` : "");
|
|
5048
|
-
const firstPageResponse = await this.
|
|
5372
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
5049
5373
|
apiMethod: HTTP_METHOD.GET,
|
|
5050
|
-
url: apiUrl
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
}, validatedIntegration, loggedInUserId);
|
|
5054
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCategories, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5374
|
+
url: apiUrl
|
|
5375
|
+
}, integration, loggedInUserId);
|
|
5376
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCategories, (page) => this.trybeApiClientService.executeRequest({
|
|
5055
5377
|
apiMethod: HTTP_METHOD.GET,
|
|
5056
|
-
url: `${apiUrl}${apiUrl.includes("?") ? "&" : "?"}page=${page}
|
|
5057
|
-
|
|
5058
|
-
headers: validatedIntegration.headers
|
|
5059
|
-
}, validatedIntegration, loggedInUserId));
|
|
5378
|
+
url: `${apiUrl}${apiUrl.includes("?") ? "&" : "?"}page=${page}`
|
|
5379
|
+
}, integration, loggedInUserId));
|
|
5060
5380
|
this.logger.info(loggedInUserId, this.fetchCategories.name, this.fileName, "Successfully fetched Trybe categories", {
|
|
5061
5381
|
totalRecords: firstPageResponse.meta.total
|
|
5062
5382
|
});
|
|
@@ -5071,7 +5391,6 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5071
5391
|
request
|
|
5072
5392
|
});
|
|
5073
5393
|
try {
|
|
5074
|
-
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
5075
5394
|
const query = new URLSearchParams();
|
|
5076
5395
|
if (request.options?.page != null) {
|
|
5077
5396
|
query.set("page", String(request.options.page));
|
|
@@ -5081,12 +5400,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5081
5400
|
}
|
|
5082
5401
|
const queryString = query.toString();
|
|
5083
5402
|
const apiUrl = `/shop/coupon-codes/${request.couponCodeId}/offering-discounts` + (queryString ? `?${queryString}` : "");
|
|
5084
|
-
const response = await this.
|
|
5403
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
5085
5404
|
apiMethod: HTTP_METHOD.GET,
|
|
5086
|
-
url: apiUrl
|
|
5087
|
-
|
|
5088
|
-
headers: validatedIntegration.headers
|
|
5089
|
-
}, validatedIntegration, loggedInUserId);
|
|
5405
|
+
url: apiUrl
|
|
5406
|
+
}, integration, loggedInUserId);
|
|
5090
5407
|
this.logger.info(loggedInUserId, this.fetchBookableItemsFromCredit.name, this.fileName, "Successfully fetched bookable items from credit", {
|
|
5091
5408
|
couponCodeId: request.couponCodeId
|
|
5092
5409
|
});
|
|
@@ -5101,8 +5418,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5101
5418
|
request
|
|
5102
5419
|
});
|
|
5103
5420
|
try {
|
|
5104
|
-
const
|
|
5105
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5421
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
5106
5422
|
const finalTimezone = await this.integrationCommonDao.getTimezoneForRequest({
|
|
5107
5423
|
projectId: integration.projectId,
|
|
5108
5424
|
loggedInUserId
|
|
@@ -5115,12 +5431,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5115
5431
|
const formattedDateTimeFrom = formatDateForTrybe(request.dateTimeFrom, true, finalTimezone);
|
|
5116
5432
|
const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false, finalTimezone);
|
|
5117
5433
|
const apiUrl = `/shop/item-availability/sessions/${siteId}/${request.externalOfferingBookableItemId}?date_time_from=${encodeURIComponent(formattedDateTimeFrom)}&date_time_to=${encodeURIComponent(formattedDateTimeTo)}&offeringId=${request.externalOfferingBookableItemId}`;
|
|
5118
|
-
const response = await this.
|
|
5434
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
5119
5435
|
apiMethod: HTTP_METHOD.GET,
|
|
5120
|
-
url: apiUrl
|
|
5121
|
-
|
|
5122
|
-
headers: validatedIntegration.headers
|
|
5123
|
-
}, validatedIntegration, loggedInUserId);
|
|
5436
|
+
url: apiUrl
|
|
5437
|
+
}, integration, loggedInUserId);
|
|
5124
5438
|
this.logger.info(loggedInUserId, this.fetchSessionAvailabilityForOffering.name, this.fileName, "Successfully fetched session availability for offering", {
|
|
5125
5439
|
externalOfferingBookableItemId: request.externalOfferingBookableItemId
|
|
5126
5440
|
});
|
|
@@ -5135,8 +5449,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5135
5449
|
request
|
|
5136
5450
|
});
|
|
5137
5451
|
try {
|
|
5138
|
-
const
|
|
5139
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5452
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
5140
5453
|
const finalTimezone = await this.integrationCommonDao.getTimezoneForRequest({
|
|
5141
5454
|
projectId: integration.projectId,
|
|
5142
5455
|
loggedInUserId
|
|
@@ -5149,12 +5462,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5149
5462
|
const formattedDateTimeFrom = formatDateForTrybe(request.dateTimeFrom, true, finalTimezone);
|
|
5150
5463
|
const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false, finalTimezone);
|
|
5151
5464
|
const apiUrl = `/shop/item-availability/appointment-slots/${siteId}/${request.externalOfferingBookableItemId}?date_time_from=${encodeURIComponent(formattedDateTimeFrom)}&date_time_to=${encodeURIComponent(formattedDateTimeTo)}&OfferingID=${request.externalOfferingBookableItemId}`;
|
|
5152
|
-
const response = await this.
|
|
5465
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
5153
5466
|
apiMethod: HTTP_METHOD.GET,
|
|
5154
|
-
url: apiUrl
|
|
5155
|
-
|
|
5156
|
-
headers: validatedIntegration.headers
|
|
5157
|
-
}, validatedIntegration, loggedInUserId);
|
|
5467
|
+
url: apiUrl
|
|
5468
|
+
}, integration, loggedInUserId);
|
|
5158
5469
|
this.logger.info(loggedInUserId, this.fetchAppointmentAvailabilityForOffering.name, this.fileName, "Successfully fetched appointment availability for offering", {
|
|
5159
5470
|
externalOfferingBookableItemId: request.externalOfferingBookableItemId
|
|
5160
5471
|
});
|
|
@@ -5177,13 +5488,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5177
5488
|
}
|
|
5178
5489
|
}
|
|
5179
5490
|
};
|
|
5180
|
-
exports.TrybeWellnessManagement =
|
|
5491
|
+
exports.TrybeWellnessManagement = _ts_decorate27([
|
|
5181
5492
|
common.Injectable(),
|
|
5182
|
-
|
|
5183
|
-
|
|
5493
|
+
_ts_metadata24("design:type", Function),
|
|
5494
|
+
_ts_metadata24("design:paramtypes", [
|
|
5184
5495
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
5185
|
-
typeof exports.
|
|
5186
|
-
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService,
|
|
5496
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService,
|
|
5187
5497
|
typeof exports.IntegrationCommonDao === "undefined" ? Object : exports.IntegrationCommonDao
|
|
5188
5498
|
])
|
|
5189
5499
|
], exports.TrybeWellnessManagement);
|
|
@@ -5193,19 +5503,19 @@ dotenv.config({
|
|
|
5193
5503
|
});
|
|
5194
5504
|
|
|
5195
5505
|
// ../../packages/dvss-integration-trybe/src/app.module.ts
|
|
5196
|
-
function
|
|
5506
|
+
function _ts_decorate28(decorators, target, key, desc2) {
|
|
5197
5507
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
5198
5508
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
5199
5509
|
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;
|
|
5200
5510
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5201
5511
|
}
|
|
5202
|
-
__name(
|
|
5512
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
5203
5513
|
exports.IntegrationTrybeModule = class AppModule2 {
|
|
5204
5514
|
static {
|
|
5205
5515
|
__name(this, "AppModule");
|
|
5206
5516
|
}
|
|
5207
5517
|
};
|
|
5208
|
-
exports.IntegrationTrybeModule =
|
|
5518
|
+
exports.IntegrationTrybeModule = _ts_decorate28([
|
|
5209
5519
|
common.Module({
|
|
5210
5520
|
imports: [
|
|
5211
5521
|
// Load environment variables from root .env file
|
|
@@ -5224,6 +5534,7 @@ exports.IntegrationTrybeModule = _ts_decorate24([
|
|
|
5224
5534
|
providers: [
|
|
5225
5535
|
AppService3,
|
|
5226
5536
|
exports.TrybeAuthService,
|
|
5537
|
+
exports.TrybeApiClientService,
|
|
5227
5538
|
exports.TrybeCustomerManagement,
|
|
5228
5539
|
exports.TrybeCreditBooking,
|
|
5229
5540
|
exports.TrybeWellnessManagement,
|
|
@@ -5235,14 +5546,13 @@ exports.IntegrationTrybeModule = _ts_decorate24([
|
|
|
5235
5546
|
exports.IntegrationRequestLoggerService,
|
|
5236
5547
|
exports.RateLimiterService,
|
|
5237
5548
|
exports.TrafficGatewayService,
|
|
5238
|
-
exports.TrybeCustomerManagement,
|
|
5239
|
-
exports.TrybeAuthService,
|
|
5240
5549
|
exports.TrybeIntegrationConfigurationService,
|
|
5241
5550
|
exports.TrybeIntegrationResourceManagementService,
|
|
5242
5551
|
dvssBackendModuleDatastore.CommonValidationDatabaseService
|
|
5243
5552
|
],
|
|
5244
5553
|
exports: [
|
|
5245
5554
|
exports.TrybeAuthService,
|
|
5555
|
+
exports.TrybeApiClientService,
|
|
5246
5556
|
exports.TrybeCustomerManagement,
|
|
5247
5557
|
exports.TrybeCreditBooking,
|
|
5248
5558
|
exports.TrybeWellnessManagement,
|
|
@@ -5254,19 +5564,19 @@ exports.IntegrationTrybeModule = _ts_decorate24([
|
|
|
5254
5564
|
], exports.IntegrationTrybeModule);
|
|
5255
5565
|
|
|
5256
5566
|
// src/app.module.ts
|
|
5257
|
-
function
|
|
5567
|
+
function _ts_decorate29(decorators, target, key, desc2) {
|
|
5258
5568
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
5259
5569
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
5260
5570
|
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;
|
|
5261
5571
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5262
5572
|
}
|
|
5263
|
-
__name(
|
|
5573
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
5264
5574
|
exports.OfferingIntegrationManager = class AppModule3 {
|
|
5265
5575
|
static {
|
|
5266
5576
|
__name(this, "AppModule");
|
|
5267
5577
|
}
|
|
5268
5578
|
};
|
|
5269
|
-
exports.OfferingIntegrationManager =
|
|
5579
|
+
exports.OfferingIntegrationManager = _ts_decorate29([
|
|
5270
5580
|
common.Module({
|
|
5271
5581
|
imports: [
|
|
5272
5582
|
exports.IntegrationTrybeModule,
|