@dv4resi/dvss-backend-module-offering-im 0.0.22 → 0.0.23
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 +606 -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,94 @@ 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
|
+
exports.TrybeApiClientService = class TrybeApiClientService {
|
|
3419
|
+
static {
|
|
3420
|
+
__name(this, "TrybeApiClientService");
|
|
3421
|
+
}
|
|
3422
|
+
trybeAuthService;
|
|
3423
|
+
trafficGatewayService;
|
|
3424
|
+
constructor(trybeAuthService, trafficGatewayService) {
|
|
3425
|
+
this.trybeAuthService = trybeAuthService;
|
|
3426
|
+
this.trafficGatewayService = trafficGatewayService;
|
|
3427
|
+
}
|
|
3428
|
+
/**
|
|
3429
|
+
* Validates the integration config and executes an API request via
|
|
3430
|
+
* TrafficGatewayService. BaseUrl and auth headers are applied automatically
|
|
3431
|
+
* from the validated config.
|
|
3432
|
+
*/
|
|
3433
|
+
async executeRequest(request, integration, loggedInUserId) {
|
|
3434
|
+
const validated = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
3435
|
+
return this.trafficGatewayService.executeIntegrationRequest({
|
|
3436
|
+
...request,
|
|
3437
|
+
baseUrl: validated.config.platformConfig.baseUrl,
|
|
3438
|
+
headers: validated.headers
|
|
3439
|
+
}, validated, loggedInUserId);
|
|
3440
|
+
}
|
|
3441
|
+
};
|
|
3442
|
+
exports.TrybeApiClientService = _ts_decorate20([
|
|
3443
|
+
common.Injectable(),
|
|
3444
|
+
_ts_metadata17("design:type", Function),
|
|
3445
|
+
_ts_metadata17("design:paramtypes", [
|
|
3446
|
+
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService,
|
|
3447
|
+
typeof exports.TrafficGatewayService === "undefined" ? Object : exports.TrafficGatewayService
|
|
3448
|
+
])
|
|
3449
|
+
], exports.TrybeApiClientService);
|
|
3450
|
+
|
|
3451
|
+
// ../../packages/dvss-integration-trybe/src/capabilities/customer-management/customer-management.service.ts
|
|
3452
|
+
function _ts_decorate21(decorators, target, key, desc2) {
|
|
3453
|
+
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3454
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3455
|
+
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;
|
|
3456
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3457
|
+
}
|
|
3458
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
3459
|
+
function _ts_metadata18(k, v) {
|
|
3460
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3461
|
+
}
|
|
3462
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
3463
|
+
function _ts_param9(paramIndex, decorator) {
|
|
3464
|
+
return function(target, key) {
|
|
3465
|
+
decorator(target, key, paramIndex);
|
|
3466
|
+
};
|
|
3467
|
+
}
|
|
3468
|
+
__name(_ts_param9, "_ts_param");
|
|
3077
3469
|
exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
3078
3470
|
static {
|
|
3079
3471
|
__name(this, "TrybeCustomerManagement");
|
|
3080
3472
|
}
|
|
3081
3473
|
logger;
|
|
3082
|
-
|
|
3474
|
+
trybeApiClientService;
|
|
3083
3475
|
fileName = "customer-management.service";
|
|
3084
3476
|
/**
|
|
3085
3477
|
* Creates an instance of the service
|
|
3086
3478
|
*/
|
|
3087
|
-
constructor(logger,
|
|
3479
|
+
constructor(logger, trybeApiClientService) {
|
|
3088
3480
|
this.logger = logger;
|
|
3089
|
-
this.
|
|
3481
|
+
this.trybeApiClientService = trybeApiClientService;
|
|
3090
3482
|
}
|
|
3091
3483
|
/**
|
|
3092
3484
|
* Create a new customer on Trybe (POST /customers/customers).
|
|
@@ -3097,11 +3489,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3097
3489
|
this.logger.info(loggedInUserId, this.createCustomer.name, this.fileName, `${_TrybeCustomerManagement.name} -> ${this.createCustomer.name} Called`, {
|
|
3098
3490
|
request
|
|
3099
3491
|
});
|
|
3100
|
-
const response = await this.
|
|
3492
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3101
3493
|
apiMethod: HTTP_METHOD.POST,
|
|
3102
3494
|
url: "/customers/customers",
|
|
3103
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3104
|
-
headers: integration.headers,
|
|
3105
3495
|
body: request
|
|
3106
3496
|
}, integration, loggedInUserId);
|
|
3107
3497
|
return response.data;
|
|
@@ -3120,11 +3510,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3120
3510
|
throw new Error("Either email or customerId is required to get a customer from Trybe");
|
|
3121
3511
|
}
|
|
3122
3512
|
if (request.customerId) {
|
|
3123
|
-
const response = await this.
|
|
3513
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3124
3514
|
apiMethod: HTTP_METHOD.GET,
|
|
3125
|
-
url: `/customers/customers/${request.customerId}
|
|
3126
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3127
|
-
headers: integration.headers
|
|
3515
|
+
url: `/customers/customers/${request.customerId}`
|
|
3128
3516
|
}, integration, loggedInUserId);
|
|
3129
3517
|
if (!response.data) {
|
|
3130
3518
|
return void 0;
|
|
@@ -3132,11 +3520,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3132
3520
|
return response.data;
|
|
3133
3521
|
}
|
|
3134
3522
|
if (request.email) {
|
|
3135
|
-
const response = await this.
|
|
3523
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3136
3524
|
apiMethod: HTTP_METHOD.GET,
|
|
3137
|
-
url: `/customers/customers/?email=${request.email}
|
|
3138
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3139
|
-
headers: integration.headers
|
|
3525
|
+
url: `/customers/customers/?email=${request.email}`
|
|
3140
3526
|
}, integration, loggedInUserId);
|
|
3141
3527
|
if (!response.data || !Array.isArray(response.data)) {
|
|
3142
3528
|
throw new dvssBackendModuleUtility.CustomException(dvssBackendModuleUtility.ERROR_NAMES.BAD_REQUEST, "Invalid Credentials");
|
|
@@ -3157,11 +3543,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3157
3543
|
customerId,
|
|
3158
3544
|
request
|
|
3159
3545
|
});
|
|
3160
|
-
const response = await this.
|
|
3546
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3161
3547
|
apiMethod: HTTP_METHOD.PUT,
|
|
3162
3548
|
url: `/customers/customers/${customerId}`,
|
|
3163
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3164
|
-
headers: integration.headers,
|
|
3165
3549
|
body: request
|
|
3166
3550
|
}, integration, loggedInUserId);
|
|
3167
3551
|
return response.data;
|
|
@@ -3174,11 +3558,9 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3174
3558
|
this.logger.info(loggedInUserId, this.deleteCustomer.name, this.fileName, `${_TrybeCustomerManagement.name} -> ${this.deleteCustomer.name} Called`, {
|
|
3175
3559
|
customerId
|
|
3176
3560
|
});
|
|
3177
|
-
await this.
|
|
3561
|
+
await this.trybeApiClientService.executeRequest({
|
|
3178
3562
|
apiMethod: HTTP_METHOD.DELETE,
|
|
3179
|
-
url: `/customers/customers/${customerId}
|
|
3180
|
-
baseUrl: integration.config.platformConfig.baseUrl,
|
|
3181
|
-
headers: integration.headers
|
|
3563
|
+
url: `/customers/customers/${customerId}`
|
|
3182
3564
|
}, integration, loggedInUserId);
|
|
3183
3565
|
return {
|
|
3184
3566
|
status: true
|
|
@@ -3189,12 +3571,13 @@ exports.TrybeCustomerManagement = class _TrybeCustomerManagement {
|
|
|
3189
3571
|
}
|
|
3190
3572
|
}
|
|
3191
3573
|
};
|
|
3192
|
-
exports.TrybeCustomerManagement =
|
|
3574
|
+
exports.TrybeCustomerManagement = _ts_decorate21([
|
|
3193
3575
|
common.Injectable(),
|
|
3194
|
-
|
|
3195
|
-
|
|
3576
|
+
_ts_param9(1, common.Inject(common.forwardRef(() => exports.TrybeApiClientService))),
|
|
3577
|
+
_ts_metadata18("design:type", Function),
|
|
3578
|
+
_ts_metadata18("design:paramtypes", [
|
|
3196
3579
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3197
|
-
typeof exports.
|
|
3580
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService
|
|
3198
3581
|
])
|
|
3199
3582
|
], exports.TrybeCustomerManagement);
|
|
3200
3583
|
|
|
@@ -3209,18 +3592,18 @@ function isValidHttpUrl(urlString) {
|
|
|
3209
3592
|
}
|
|
3210
3593
|
__name(isValidHttpUrl, "isValidHttpUrl");
|
|
3211
3594
|
|
|
3212
|
-
// ../../packages/dvss-integration-trybe/src/capabilities/auth/auth.service.ts
|
|
3213
|
-
function
|
|
3595
|
+
// ../../packages/dvss-integration-trybe/src/capabilities/auth-management/auth.service.ts
|
|
3596
|
+
function _ts_decorate22(decorators, target, key, desc2) {
|
|
3214
3597
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3215
3598
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3216
3599
|
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
3600
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3218
3601
|
}
|
|
3219
|
-
__name(
|
|
3220
|
-
function
|
|
3602
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
3603
|
+
function _ts_metadata19(k, v) {
|
|
3221
3604
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3222
3605
|
}
|
|
3223
|
-
__name(
|
|
3606
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
3224
3607
|
exports.TrybeAuthService = class _TrybeAuthService {
|
|
3225
3608
|
static {
|
|
3226
3609
|
__name(this, "TrybeAuthService");
|
|
@@ -3318,10 +3701,10 @@ exports.TrybeAuthService = class _TrybeAuthService {
|
|
|
3318
3701
|
throw new Error("Method not implemented.");
|
|
3319
3702
|
}
|
|
3320
3703
|
};
|
|
3321
|
-
exports.TrybeAuthService =
|
|
3704
|
+
exports.TrybeAuthService = _ts_decorate22([
|
|
3322
3705
|
common.Injectable(),
|
|
3323
|
-
|
|
3324
|
-
|
|
3706
|
+
_ts_metadata19("design:type", Function),
|
|
3707
|
+
_ts_metadata19("design:paramtypes", [
|
|
3325
3708
|
typeof exports.TrybeCustomerManagement === "undefined" ? Object : exports.TrybeCustomerManagement,
|
|
3326
3709
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
3327
3710
|
])
|
|
@@ -3384,32 +3767,30 @@ function mapTrybeCreditsToSystem(res, integration) {
|
|
|
3384
3767
|
__name(mapTrybeCreditsToSystem, "mapTrybeCreditsToSystem");
|
|
3385
3768
|
|
|
3386
3769
|
// ../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.service.ts
|
|
3387
|
-
function
|
|
3770
|
+
function _ts_decorate23(decorators, target, key, desc2) {
|
|
3388
3771
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3389
3772
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3390
3773
|
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
3774
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3392
3775
|
}
|
|
3393
|
-
__name(
|
|
3394
|
-
function
|
|
3776
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
3777
|
+
function _ts_metadata20(k, v) {
|
|
3395
3778
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3396
3779
|
}
|
|
3397
|
-
__name(
|
|
3780
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
3398
3781
|
exports.TrybeCreditBooking = class _TrybeCreditBooking {
|
|
3399
3782
|
static {
|
|
3400
3783
|
__name(this, "TrybeCreditBooking");
|
|
3401
3784
|
}
|
|
3402
3785
|
logger;
|
|
3403
|
-
|
|
3404
|
-
trybeAuthService;
|
|
3786
|
+
trybeApiClientService;
|
|
3405
3787
|
fileName = "credit-booking.service";
|
|
3406
3788
|
/**
|
|
3407
3789
|
* Creates an instance of the service
|
|
3408
3790
|
*/
|
|
3409
|
-
constructor(logger,
|
|
3791
|
+
constructor(logger, trybeApiClientService) {
|
|
3410
3792
|
this.logger = logger;
|
|
3411
|
-
this.
|
|
3412
|
-
this.trybeAuthService = trybeAuthService;
|
|
3793
|
+
this.trybeApiClientService = trybeApiClientService;
|
|
3413
3794
|
}
|
|
3414
3795
|
/**
|
|
3415
3796
|
* Fetches customer credits from Trybe and returns system-format response
|
|
@@ -3420,7 +3801,6 @@ exports.TrybeCreditBooking = class _TrybeCreditBooking {
|
|
|
3420
3801
|
this.logger.info(loggedInUserId, this.fetchCustomerCredits.name, this.fileName, `${_TrybeCreditBooking.name} -> ${this.fetchCustomerCredits.name} Called`, {
|
|
3421
3802
|
request
|
|
3422
3803
|
});
|
|
3423
|
-
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
3424
3804
|
const query = new URLSearchParams();
|
|
3425
3805
|
const opts = request.options;
|
|
3426
3806
|
if (opts?.page != null) query.set("page", String(opts.page));
|
|
@@ -3443,22 +3823,19 @@ exports.TrybeCreditBooking = class _TrybeCreditBooking {
|
|
|
3443
3823
|
}
|
|
3444
3824
|
const queryString = query.toString();
|
|
3445
3825
|
const url = `/customers/customers/${request.customerId}/credits` + (queryString ? `?${queryString}` : "");
|
|
3446
|
-
const raw = await this.
|
|
3826
|
+
const raw = await this.trybeApiClientService.executeRequest({
|
|
3447
3827
|
apiMethod: HTTP_METHOD.GET,
|
|
3448
|
-
url
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
}, validatedIntegration, loggedInUserId);
|
|
3452
|
-
return mapTrybeCreditsToSystem(raw, validatedIntegration);
|
|
3828
|
+
url
|
|
3829
|
+
}, integration, loggedInUserId);
|
|
3830
|
+
return mapTrybeCreditsToSystem(raw, integration);
|
|
3453
3831
|
}
|
|
3454
3832
|
};
|
|
3455
|
-
exports.TrybeCreditBooking =
|
|
3833
|
+
exports.TrybeCreditBooking = _ts_decorate23([
|
|
3456
3834
|
common.Injectable(),
|
|
3457
|
-
|
|
3458
|
-
|
|
3835
|
+
_ts_metadata20("design:type", Function),
|
|
3836
|
+
_ts_metadata20("design:paramtypes", [
|
|
3459
3837
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3460
|
-
typeof exports.
|
|
3461
|
-
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService
|
|
3838
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService
|
|
3462
3839
|
])
|
|
3463
3840
|
], exports.TrybeCreditBooking);
|
|
3464
3841
|
|
|
@@ -3476,25 +3853,25 @@ function mapTrybeSiteResponseToSystem(response) {
|
|
|
3476
3853
|
__name(mapTrybeSiteResponseToSystem, "mapTrybeSiteResponseToSystem");
|
|
3477
3854
|
|
|
3478
3855
|
// ../../packages/dvss-integration-trybe/src/capabilities/integration-configuration/integration-configuration.service.ts
|
|
3479
|
-
function
|
|
3856
|
+
function _ts_decorate24(decorators, target, key, desc2) {
|
|
3480
3857
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3481
3858
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3482
3859
|
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
3860
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3484
3861
|
}
|
|
3485
|
-
__name(
|
|
3486
|
-
function
|
|
3862
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
3863
|
+
function _ts_metadata21(k, v) {
|
|
3487
3864
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3488
3865
|
}
|
|
3489
|
-
__name(
|
|
3866
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
3490
3867
|
exports.TrybeIntegrationConfigurationService = class TrybeIntegrationConfigurationService extends exports.BaseIntegrationConfiguration {
|
|
3491
3868
|
static {
|
|
3492
3869
|
__name(this, "TrybeIntegrationConfigurationService");
|
|
3493
3870
|
}
|
|
3871
|
+
trybeApiClientService;
|
|
3494
3872
|
trybeAuthService;
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
super(integrationConfigurationDao, commonValidationDatabaseService, logger), this.trybeAuthService = trybeAuthService, this.trafficGatewayService = trafficGatewayService;
|
|
3873
|
+
constructor(integrationConfigurationDao, commonValidationDatabaseService, logger, trybeApiClientService, trybeAuthService) {
|
|
3874
|
+
super(integrationConfigurationDao, commonValidationDatabaseService, logger), this.trybeApiClientService = trybeApiClientService, this.trybeAuthService = trybeAuthService;
|
|
3498
3875
|
}
|
|
3499
3876
|
/**
|
|
3500
3877
|
* Add capability integration: validate Trybe config, then configuredFor (offering), then delegate to base.
|
|
@@ -3538,24 +3915,22 @@ exports.TrybeIntegrationConfigurationService = class TrybeIntegrationConfigurati
|
|
|
3538
3915
|
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
3539
3916
|
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
3540
3917
|
const url = `/shop/sites/${siteId}`;
|
|
3541
|
-
const response = await this.
|
|
3918
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
3542
3919
|
apiMethod: HTTP_METHOD.GET,
|
|
3543
|
-
url
|
|
3544
|
-
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
3545
|
-
headers: validatedIntegration.headers
|
|
3920
|
+
url
|
|
3546
3921
|
}, validatedIntegration, loggedInUserId);
|
|
3547
3922
|
return mapTrybeSiteResponseToSystem(response);
|
|
3548
3923
|
}
|
|
3549
3924
|
};
|
|
3550
|
-
exports.TrybeIntegrationConfigurationService =
|
|
3925
|
+
exports.TrybeIntegrationConfigurationService = _ts_decorate24([
|
|
3551
3926
|
common.Injectable(),
|
|
3552
|
-
|
|
3553
|
-
|
|
3927
|
+
_ts_metadata21("design:type", Function),
|
|
3928
|
+
_ts_metadata21("design:paramtypes", [
|
|
3554
3929
|
typeof exports.IntegrationConfigurationDao === "undefined" ? Object : exports.IntegrationConfigurationDao,
|
|
3555
3930
|
typeof dvssBackendModuleDatastore.CommonValidationDatabaseService === "undefined" ? Object : dvssBackendModuleDatastore.CommonValidationDatabaseService,
|
|
3556
3931
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3557
|
-
typeof exports.
|
|
3558
|
-
typeof exports.
|
|
3932
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService,
|
|
3933
|
+
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService
|
|
3559
3934
|
])
|
|
3560
3935
|
], exports.TrybeIntegrationConfigurationService);
|
|
3561
3936
|
|
|
@@ -3572,17 +3947,17 @@ var TRYBE_CATALOGING_BY_ENUM = /* @__PURE__ */ (function(TRYBE_CATALOGING_BY_ENU
|
|
|
3572
3947
|
})({});
|
|
3573
3948
|
|
|
3574
3949
|
// ../../packages/dvss-integration-trybe/src/capabilities/integration-resource-management/integration-resource-management.service.ts
|
|
3575
|
-
function
|
|
3950
|
+
function _ts_decorate25(decorators, target, key, desc2) {
|
|
3576
3951
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3577
3952
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3578
3953
|
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
3954
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3580
3955
|
}
|
|
3581
|
-
__name(
|
|
3582
|
-
function
|
|
3956
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
3957
|
+
function _ts_metadata22(k, v) {
|
|
3583
3958
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3584
3959
|
}
|
|
3585
|
-
__name(
|
|
3960
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
3586
3961
|
var OFFERING_INTEGRATION_MAPPING_ALREADY_EXISTS = "OFFERING_INTEGRATION_MAPPING_ALREADY_EXISTS";
|
|
3587
3962
|
var VALID_JOURNEY_VALUES = /* @__PURE__ */ new Set([
|
|
3588
3963
|
"SESSION",
|
|
@@ -3653,10 +4028,10 @@ exports.TrybeIntegrationResourceManagementService = class TrybeIntegrationResour
|
|
|
3653
4028
|
return await super.updateOfferingIntegrationResourceConfiguration(input, context);
|
|
3654
4029
|
}
|
|
3655
4030
|
};
|
|
3656
|
-
exports.TrybeIntegrationResourceManagementService =
|
|
4031
|
+
exports.TrybeIntegrationResourceManagementService = _ts_decorate25([
|
|
3657
4032
|
common.Injectable(),
|
|
3658
|
-
|
|
3659
|
-
|
|
4033
|
+
_ts_metadata22("design:type", Function),
|
|
4034
|
+
_ts_metadata22("design:paramtypes", [
|
|
3660
4035
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
3661
4036
|
typeof exports.IntegrationResourceManagementDao === "undefined" ? Object : exports.IntegrationResourceManagementDao
|
|
3662
4037
|
])
|
|
@@ -3782,17 +4157,17 @@ function getSummaryLabelsInPropertyTimezone(timezone, summary) {
|
|
|
3782
4157
|
__name(getSummaryLabelsInPropertyTimezone, "getSummaryLabelsInPropertyTimezone");
|
|
3783
4158
|
|
|
3784
4159
|
// ../../packages/dvss-integration-trybe/src/utils/webhook/trybe-webhook-util.ts
|
|
3785
|
-
function
|
|
4160
|
+
function _ts_decorate26(decorators, target, key, desc2) {
|
|
3786
4161
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
3787
4162
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
3788
4163
|
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
4164
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3790
4165
|
}
|
|
3791
|
-
__name(
|
|
3792
|
-
function
|
|
4166
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
4167
|
+
function _ts_metadata23(k, v) {
|
|
3793
4168
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3794
4169
|
}
|
|
3795
|
-
__name(
|
|
4170
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
3796
4171
|
exports.TrybeWebhookUtilService = class TrybeWebhookUtilService {
|
|
3797
4172
|
static {
|
|
3798
4173
|
__name(this, "TrybeWebhookUtilService");
|
|
@@ -3984,10 +4359,10 @@ exports.TrybeWebhookUtilService = class TrybeWebhookUtilService {
|
|
|
3984
4359
|
}
|
|
3985
4360
|
}
|
|
3986
4361
|
};
|
|
3987
|
-
exports.TrybeWebhookUtilService =
|
|
4362
|
+
exports.TrybeWebhookUtilService = _ts_decorate26([
|
|
3988
4363
|
common.Injectable(),
|
|
3989
|
-
|
|
3990
|
-
|
|
4364
|
+
_ts_metadata23("design:type", Function),
|
|
4365
|
+
_ts_metadata23("design:paramtypes", [
|
|
3991
4366
|
typeof exports.IntegrationBookingDao === "undefined" ? Object : exports.IntegrationBookingDao,
|
|
3992
4367
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService
|
|
3993
4368
|
])
|
|
@@ -4384,30 +4759,28 @@ function mapTrybeAppointmentAvailabilityToSystemResponse(slots) {
|
|
|
4384
4759
|
__name(mapTrybeAppointmentAvailabilityToSystemResponse, "mapTrybeAppointmentAvailabilityToSystemResponse");
|
|
4385
4760
|
|
|
4386
4761
|
// ../../packages/dvss-integration-trybe/src/capabilities/wellness/wellness-management.service.ts
|
|
4387
|
-
function
|
|
4762
|
+
function _ts_decorate27(decorators, target, key, desc2) {
|
|
4388
4763
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
4389
4764
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
4390
4765
|
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
4766
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4392
4767
|
}
|
|
4393
|
-
__name(
|
|
4394
|
-
function
|
|
4768
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
4769
|
+
function _ts_metadata24(k, v) {
|
|
4395
4770
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4396
4771
|
}
|
|
4397
|
-
__name(
|
|
4772
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
4398
4773
|
exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
4399
4774
|
static {
|
|
4400
4775
|
__name(this, "TrybeWellnessManagement");
|
|
4401
4776
|
}
|
|
4402
4777
|
logger;
|
|
4403
|
-
|
|
4404
|
-
trybeAuthService;
|
|
4778
|
+
trybeApiClientService;
|
|
4405
4779
|
integrationCommonDao;
|
|
4406
4780
|
fileName = "wellness-management.service";
|
|
4407
|
-
constructor(logger,
|
|
4781
|
+
constructor(logger, trybeApiClientService, integrationCommonDao) {
|
|
4408
4782
|
this.logger = logger;
|
|
4409
|
-
this.
|
|
4410
|
-
this.trybeAuthService = trybeAuthService;
|
|
4783
|
+
this.trybeApiClientService = trybeApiClientService;
|
|
4411
4784
|
this.integrationCommonDao = integrationCommonDao;
|
|
4412
4785
|
}
|
|
4413
4786
|
fetchWellnessAppointmentSession() {
|
|
@@ -4446,22 +4819,19 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4446
4819
|
async createOrder(request, integration, loggedInUserId) {
|
|
4447
4820
|
let orderId;
|
|
4448
4821
|
try {
|
|
4449
|
-
const
|
|
4450
|
-
const siteId = validated.config.integrationConfig.siteId;
|
|
4822
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4451
4823
|
const offering = await this.getOffering({
|
|
4452
4824
|
offeringId: request.bookableItems[0].externalId,
|
|
4453
4825
|
offeringType: request.bookableItems[0].type
|
|
4454
4826
|
}, integration, loggedInUserId);
|
|
4455
|
-
const res = await this.
|
|
4827
|
+
const res = await this.trybeApiClientService.executeRequest({
|
|
4456
4828
|
apiMethod: HTTP_METHOD.POST,
|
|
4457
4829
|
url: "/shop/orders",
|
|
4458
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4459
|
-
headers: validated.headers,
|
|
4460
4830
|
body: {
|
|
4461
4831
|
site_id: siteId,
|
|
4462
4832
|
status: "new"
|
|
4463
4833
|
}
|
|
4464
|
-
},
|
|
4834
|
+
}, integration, loggedInUserId);
|
|
4465
4835
|
orderId = res.data.id;
|
|
4466
4836
|
const items = [];
|
|
4467
4837
|
await this.addCustomerToOrder(orderId, request.customerId, integration, loggedInUserId);
|
|
@@ -4506,9 +4876,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4506
4876
|
orderReference: submitOrderResponse.data?.order_ref ?? order.meta.orderReference,
|
|
4507
4877
|
room: bookableItems.find((item) => item.booking_summary?.room?.id)?.booking_summary?.room,
|
|
4508
4878
|
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
|
|
4879
|
+
subTotal: ((submitOrderResponse.data?.totals?.subtotal ?? 0) - (submitOrderResponse.data?.totals?.exclusive_tax ?? 0)) / request.currencyMultiplier,
|
|
4880
|
+
totalTax: (submitOrderResponse.data?.taxes?.reduce((acc, tax) => acc + (tax.amount ?? 0), 0) ?? 0) / request.currencyMultiplier,
|
|
4881
|
+
discount: (submitOrderResponse.data?.discount_total ?? 0) / request.currencyMultiplier,
|
|
4882
|
+
serviceCharge: (submitOrderResponse.data?.service_charge?.amount ?? 0) / request.currencyMultiplier
|
|
4512
4883
|
},
|
|
4513
4884
|
items: bookableItems.map((bookableItem) => {
|
|
4514
4885
|
return {
|
|
@@ -4541,17 +4912,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4541
4912
|
orderId,
|
|
4542
4913
|
customerId
|
|
4543
4914
|
});
|
|
4544
|
-
|
|
4545
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
4915
|
+
await this.trybeApiClientService.executeRequest({
|
|
4546
4916
|
apiMethod: HTTP_METHOD.POST,
|
|
4547
4917
|
url: `/shop/orders/${orderId}/customer`,
|
|
4548
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4549
|
-
headers: validated.headers,
|
|
4550
4918
|
body: {
|
|
4551
4919
|
id: customerId,
|
|
4552
4920
|
source: "trybe"
|
|
4553
4921
|
}
|
|
4554
|
-
},
|
|
4922
|
+
}, integration, loggedInUserId);
|
|
4555
4923
|
this.logger.info(loggedInUserId, this.addCustomerToOrder.name, this.fileName, "Successfully added customer to Trybe order", {
|
|
4556
4924
|
orderId,
|
|
4557
4925
|
customerId
|
|
@@ -4561,13 +4929,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4561
4929
|
this.logger.info(loggedInUserId, this.getOrder.name, this.fileName, "Fetching Trybe order details", {
|
|
4562
4930
|
orderId
|
|
4563
4931
|
});
|
|
4564
|
-
const
|
|
4565
|
-
const res = await this.trafficGatewayService.executeIntegrationRequest({
|
|
4932
|
+
const res = await this.trybeApiClientService.executeRequest({
|
|
4566
4933
|
apiMethod: HTTP_METHOD.GET,
|
|
4567
|
-
url: `/shop/orders/${orderId}
|
|
4568
|
-
|
|
4569
|
-
headers: validated.headers
|
|
4570
|
-
}, validated, loggedInUserId);
|
|
4934
|
+
url: `/shop/orders/${orderId}`
|
|
4935
|
+
}, integration, loggedInUserId);
|
|
4571
4936
|
this.logger.info(loggedInUserId, this.getOrder.name, this.fileName, "Successfully fetched Trybe order details", {
|
|
4572
4937
|
orderId,
|
|
4573
4938
|
guestCount: res.data.guests.length
|
|
@@ -4602,7 +4967,6 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4602
4967
|
offeringId: request.item.offeringId,
|
|
4603
4968
|
offeringType: request.item.offeringType
|
|
4604
4969
|
});
|
|
4605
|
-
const validated = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
4606
4970
|
const { orderId, item } = request;
|
|
4607
4971
|
const offeringType = this.mapOfferingTypeToTrybeApi(item.offeringType);
|
|
4608
4972
|
let body;
|
|
@@ -4642,13 +5006,11 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4642
5006
|
guest_ids: item.guestIds
|
|
4643
5007
|
};
|
|
4644
5008
|
}
|
|
4645
|
-
const res = await this.
|
|
5009
|
+
const res = await this.trybeApiClientService.executeRequest({
|
|
4646
5010
|
apiMethod: HTTP_METHOD.POST,
|
|
4647
5011
|
url: `/shop/orders/${orderId}/items`,
|
|
4648
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4649
|
-
headers: validated.headers,
|
|
4650
5012
|
body
|
|
4651
|
-
},
|
|
5013
|
+
}, integration, loggedInUserId);
|
|
4652
5014
|
const data = res.data;
|
|
4653
5015
|
const result = {
|
|
4654
5016
|
name: data.booking_summary?.offering?.name ?? data.type_name ?? void 0,
|
|
@@ -4667,16 +5029,13 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4667
5029
|
orderId,
|
|
4668
5030
|
customerCreditId
|
|
4669
5031
|
});
|
|
4670
|
-
|
|
4671
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
5032
|
+
await this.trybeApiClientService.executeRequest({
|
|
4672
5033
|
apiMethod: HTTP_METHOD.POST,
|
|
4673
5034
|
url: `/shop/orders/${orderId}/customer-credits`,
|
|
4674
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4675
|
-
headers: validated.headers,
|
|
4676
5035
|
body: {
|
|
4677
5036
|
id: customerCreditId
|
|
4678
5037
|
}
|
|
4679
|
-
},
|
|
5038
|
+
}, integration, loggedInUserId);
|
|
4680
5039
|
this.logger.info(loggedInUserId, this.addCustomerCreditsToOrder.name, this.fileName, "Successfully added customer credits to Trybe order", {
|
|
4681
5040
|
orderId,
|
|
4682
5041
|
customerCreditId
|
|
@@ -4686,13 +5045,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4686
5045
|
this.logger.info(loggedInUserId, this.submitOrder.name, this.fileName, "Submitting Trybe order", {
|
|
4687
5046
|
orderId
|
|
4688
5047
|
});
|
|
4689
|
-
const
|
|
4690
|
-
const response = await this.trafficGatewayService.executeIntegrationRequest({
|
|
5048
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4691
5049
|
apiMethod: HTTP_METHOD.POST,
|
|
4692
|
-
url: `/shop/orders/${orderId}/submit
|
|
4693
|
-
|
|
4694
|
-
headers: validated.headers
|
|
4695
|
-
}, validated, loggedInUserId);
|
|
5050
|
+
url: `/shop/orders/${orderId}/submit`
|
|
5051
|
+
}, integration, loggedInUserId);
|
|
4696
5052
|
this.logger.info(loggedInUserId, this.submitOrder.name, this.fileName, "Successfully submitted Trybe order", {
|
|
4697
5053
|
orderId
|
|
4698
5054
|
});
|
|
@@ -4702,13 +5058,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4702
5058
|
this.logger.info(loggedInUserId, this.cancelOrder.name, this.fileName, "Cancelling Trybe order", {
|
|
4703
5059
|
orderId
|
|
4704
5060
|
});
|
|
4705
|
-
|
|
4706
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
5061
|
+
await this.trybeApiClientService.executeRequest({
|
|
4707
5062
|
apiMethod: HTTP_METHOD.POST,
|
|
4708
|
-
url: `/shop/orders/${orderId}/cancel
|
|
4709
|
-
|
|
4710
|
-
headers: validated.headers
|
|
4711
|
-
}, validated, loggedInUserId);
|
|
5063
|
+
url: `/shop/orders/${orderId}/cancel`
|
|
5064
|
+
}, integration, loggedInUserId);
|
|
4712
5065
|
this.logger.info(loggedInUserId, this.cancelOrder.name, this.fileName, "Successfully cancelled Trybe order", {
|
|
4713
5066
|
orderId
|
|
4714
5067
|
});
|
|
@@ -4742,7 +5095,6 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4742
5095
|
itemId,
|
|
4743
5096
|
offeringType: request.item.type
|
|
4744
5097
|
});
|
|
4745
|
-
const validated = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
4746
5098
|
const offeringType = this.mapOfferingTypeToTrybeApi(request.item.type);
|
|
4747
5099
|
let body;
|
|
4748
5100
|
if (offeringType === TRYBE_OFFERING_TYPE_API.APPOINTMENT) {
|
|
@@ -4772,13 +5124,11 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4772
5124
|
} else {
|
|
4773
5125
|
throw new Error("Course is not updatable");
|
|
4774
5126
|
}
|
|
4775
|
-
const response = await this.
|
|
5127
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4776
5128
|
apiMethod: HTTP_METHOD.PUT,
|
|
4777
5129
|
url: `/shop/orders/${orderId}/items/${itemId}`,
|
|
4778
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4779
|
-
headers: validated.headers,
|
|
4780
5130
|
body
|
|
4781
|
-
},
|
|
5131
|
+
}, integration, loggedInUserId);
|
|
4782
5132
|
this.logger.info(loggedInUserId, this.updateOrderItem.name, this.fileName, "Successfully updated Trybe order item", {
|
|
4783
5133
|
orderId,
|
|
4784
5134
|
itemId
|
|
@@ -4791,12 +5141,9 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4791
5141
|
amount: request.amount,
|
|
4792
5142
|
paymentTypeId: request.paymentTypeId
|
|
4793
5143
|
});
|
|
4794
|
-
|
|
4795
|
-
await this.trafficGatewayService.executeIntegrationRequest({
|
|
5144
|
+
await this.trybeApiClientService.executeRequest({
|
|
4796
5145
|
apiMethod: HTTP_METHOD.POST,
|
|
4797
5146
|
url: `/shop/orders/${request.orderId}/payments`,
|
|
4798
|
-
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4799
|
-
headers: validated.headers,
|
|
4800
5147
|
body: {
|
|
4801
5148
|
amount: request.amount,
|
|
4802
5149
|
processor: "manual",
|
|
@@ -4806,7 +5153,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4806
5153
|
payment_type_id: request.paymentTypeId
|
|
4807
5154
|
}
|
|
4808
5155
|
}
|
|
4809
|
-
},
|
|
5156
|
+
}, integration, loggedInUserId);
|
|
4810
5157
|
this.logger.info(loggedInUserId, this.addPaymentToOrder.name, this.fileName, "Successfully added payment to Trybe order", {
|
|
4811
5158
|
orderId: request.orderId,
|
|
4812
5159
|
amount: request.amount
|
|
@@ -4817,8 +5164,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4817
5164
|
request
|
|
4818
5165
|
});
|
|
4819
5166
|
try {
|
|
4820
|
-
const
|
|
4821
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5167
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4822
5168
|
if (request.shouldFetchAllAppointments && request.options?.page !== void 0) {
|
|
4823
5169
|
throw new Error("Pagination options are not supported when fetching all appointments.");
|
|
4824
5170
|
}
|
|
@@ -4831,18 +5177,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4831
5177
|
}
|
|
4832
5178
|
const queryString = query.toString();
|
|
4833
5179
|
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.
|
|
5180
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
4835
5181
|
apiMethod: HTTP_METHOD.GET,
|
|
4836
|
-
url: apiUrl
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
}, validatedIntegration, loggedInUserId);
|
|
4840
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllAppointments, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5182
|
+
url: apiUrl
|
|
5183
|
+
}, integration, loggedInUserId);
|
|
5184
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllAppointments, (page) => this.trybeApiClientService.executeRequest({
|
|
4841
5185
|
apiMethod: HTTP_METHOD.GET,
|
|
4842
|
-
url: `${apiUrl}&page=${page}
|
|
4843
|
-
|
|
4844
|
-
headers: validatedIntegration.headers
|
|
4845
|
-
}, validatedIntegration, loggedInUserId));
|
|
5186
|
+
url: `${apiUrl}&page=${page}`
|
|
5187
|
+
}, integration, loggedInUserId));
|
|
4846
5188
|
this.logger.info(loggedInUserId, this.fetchAppointments.name, this.fileName, "Successfully fetched Trybe appointments", {
|
|
4847
5189
|
totalRecords: firstPageResponse.meta.total
|
|
4848
5190
|
});
|
|
@@ -4857,15 +5199,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4857
5199
|
request
|
|
4858
5200
|
});
|
|
4859
5201
|
try {
|
|
4860
|
-
const
|
|
4861
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5202
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4862
5203
|
const apiUrl = `/shop/appointment-types/${request.appointmentId}?site_id=${siteId}`;
|
|
4863
|
-
const response = await this.
|
|
5204
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4864
5205
|
apiMethod: HTTP_METHOD.GET,
|
|
4865
|
-
url: apiUrl
|
|
4866
|
-
|
|
4867
|
-
headers: validatedIntegration.headers
|
|
4868
|
-
}, validatedIntegration, loggedInUserId);
|
|
5206
|
+
url: apiUrl
|
|
5207
|
+
}, integration, loggedInUserId);
|
|
4869
5208
|
this.logger.info(loggedInUserId, this.fetchAppointments.name, this.fileName, "Successfully fetched Trybe appointments", {
|
|
4870
5209
|
appointmentId: request.appointmentId
|
|
4871
5210
|
});
|
|
@@ -4880,8 +5219,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4880
5219
|
request
|
|
4881
5220
|
});
|
|
4882
5221
|
try {
|
|
4883
|
-
const
|
|
4884
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5222
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4885
5223
|
if (request.shouldFetchAllSessions && request.options?.page !== void 0) {
|
|
4886
5224
|
throw new Error("Pagination options are not supported when fetching all sessions.");
|
|
4887
5225
|
}
|
|
@@ -4894,18 +5232,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4894
5232
|
}
|
|
4895
5233
|
const queryString = query.toString();
|
|
4896
5234
|
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.
|
|
5235
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
4898
5236
|
apiMethod: HTTP_METHOD.GET,
|
|
4899
|
-
url: apiUrl
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
}, validatedIntegration, loggedInUserId);
|
|
4903
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllSessions, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5237
|
+
url: apiUrl
|
|
5238
|
+
}, integration, loggedInUserId);
|
|
5239
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllSessions, (page) => this.trybeApiClientService.executeRequest({
|
|
4904
5240
|
apiMethod: HTTP_METHOD.GET,
|
|
4905
|
-
url: `${apiUrl}&page=${page}
|
|
4906
|
-
|
|
4907
|
-
headers: validatedIntegration.headers
|
|
4908
|
-
}, validatedIntegration, loggedInUserId));
|
|
5241
|
+
url: `${apiUrl}&page=${page}`
|
|
5242
|
+
}, integration, loggedInUserId));
|
|
4909
5243
|
this.logger.info(loggedInUserId, this.fetchSessions.name, this.fileName, "Successfully fetched Trybe sessions", {
|
|
4910
5244
|
totalRecords: firstPageResponse.meta.total
|
|
4911
5245
|
});
|
|
@@ -4920,15 +5254,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4920
5254
|
request
|
|
4921
5255
|
});
|
|
4922
5256
|
try {
|
|
4923
|
-
const
|
|
4924
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5257
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
4925
5258
|
const apiUrl = `/shop/session-types/${request.sessionId}?site_id=${siteId}`;
|
|
4926
|
-
return await this.
|
|
5259
|
+
return await this.trybeApiClientService.executeRequest({
|
|
4927
5260
|
apiMethod: HTTP_METHOD.GET,
|
|
4928
|
-
url: apiUrl
|
|
4929
|
-
|
|
4930
|
-
headers: validatedIntegration.headers
|
|
4931
|
-
}, validatedIntegration, loggedInUserId);
|
|
5261
|
+
url: apiUrl
|
|
5262
|
+
}, integration, loggedInUserId);
|
|
4932
5263
|
} catch (err) {
|
|
4933
5264
|
this.logger.error(loggedInUserId, this.fetchSession.name, this.fileName, "Error fetching Trybe session", err);
|
|
4934
5265
|
throw err;
|
|
@@ -4939,8 +5270,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4939
5270
|
request
|
|
4940
5271
|
});
|
|
4941
5272
|
try {
|
|
4942
|
-
const
|
|
4943
|
-
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
5273
|
+
const organisationId = integration.config?.integrationConfig?.organisationId;
|
|
4944
5274
|
if (request.shouldFetchAllCourses && request.options?.page !== void 0) {
|
|
4945
5275
|
throw new Error("Pagination options are not supported when fetching all courses.");
|
|
4946
5276
|
}
|
|
@@ -4953,18 +5283,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4953
5283
|
}
|
|
4954
5284
|
const queryString = query.toString();
|
|
4955
5285
|
const apiUrl = `/shop/course-types?organisation_id=${organisationId}` + (queryString ? `&${queryString}` : "");
|
|
4956
|
-
const firstPageResponse = await this.
|
|
5286
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
4957
5287
|
apiMethod: HTTP_METHOD.GET,
|
|
4958
|
-
url: apiUrl
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
}, validatedIntegration, loggedInUserId);
|
|
4962
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCourses, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5288
|
+
url: apiUrl
|
|
5289
|
+
}, integration, loggedInUserId);
|
|
5290
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCourses, (page) => this.trybeApiClientService.executeRequest({
|
|
4963
5291
|
apiMethod: HTTP_METHOD.GET,
|
|
4964
|
-
url: `${apiUrl}&page=${page}
|
|
4965
|
-
|
|
4966
|
-
headers: validatedIntegration.headers
|
|
4967
|
-
}, validatedIntegration, loggedInUserId));
|
|
5292
|
+
url: `${apiUrl}&page=${page}`
|
|
5293
|
+
}, integration, loggedInUserId));
|
|
4968
5294
|
this.logger.info(loggedInUserId, this.fetchCourses.name, this.fileName, "Successfully fetched Trybe courses", {
|
|
4969
5295
|
totalRecords: firstPageResponse.meta.total
|
|
4970
5296
|
});
|
|
@@ -4979,15 +5305,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4979
5305
|
request
|
|
4980
5306
|
});
|
|
4981
5307
|
try {
|
|
4982
|
-
const
|
|
4983
|
-
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
5308
|
+
const organisationId = integration.config?.integrationConfig?.organisationId;
|
|
4984
5309
|
const apiUrl = `/shop/course-types/${request.courseId}?organisation_id=${organisationId}`;
|
|
4985
|
-
const response = await this.
|
|
5310
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
4986
5311
|
apiMethod: HTTP_METHOD.GET,
|
|
4987
|
-
url: apiUrl
|
|
4988
|
-
|
|
4989
|
-
headers: validatedIntegration.headers
|
|
4990
|
-
}, validatedIntegration, loggedInUserId);
|
|
5312
|
+
url: apiUrl
|
|
5313
|
+
}, integration, loggedInUserId);
|
|
4991
5314
|
this.logger.info(loggedInUserId, this.fetchCourse.name, this.fileName, "Successfully fetched Trybe course", {
|
|
4992
5315
|
courseId: request.courseId
|
|
4993
5316
|
});
|
|
@@ -5002,21 +5325,16 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5002
5325
|
request
|
|
5003
5326
|
});
|
|
5004
5327
|
try {
|
|
5005
|
-
const
|
|
5006
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5328
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
5007
5329
|
const apiUrl = `/shop/practitioners/?site_id=${siteId}`;
|
|
5008
|
-
const firstPageResponse = await this.
|
|
5330
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
5009
5331
|
apiMethod: HTTP_METHOD.GET,
|
|
5010
|
-
url: apiUrl
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
}, validatedIntegration, loggedInUserId);
|
|
5014
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllPractitioners, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5332
|
+
url: apiUrl
|
|
5333
|
+
}, integration, loggedInUserId);
|
|
5334
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllPractitioners, (page) => this.trybeApiClientService.executeRequest({
|
|
5015
5335
|
apiMethod: HTTP_METHOD.GET,
|
|
5016
|
-
url: `${apiUrl}&page=${page}
|
|
5017
|
-
|
|
5018
|
-
headers: validatedIntegration.headers
|
|
5019
|
-
}, validatedIntegration, loggedInUserId));
|
|
5336
|
+
url: `${apiUrl}&page=${page}`
|
|
5337
|
+
}, integration, loggedInUserId));
|
|
5020
5338
|
this.logger.info(loggedInUserId, this.fetchPractitioners.name, this.fileName, "Successfully fetched Trybe practitioners", {
|
|
5021
5339
|
totalRecords: firstPageResponse.meta.total
|
|
5022
5340
|
});
|
|
@@ -5031,8 +5349,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5031
5349
|
request
|
|
5032
5350
|
});
|
|
5033
5351
|
try {
|
|
5034
|
-
const
|
|
5035
|
-
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
5352
|
+
const organisationId = integration.config?.integrationConfig?.organisationId;
|
|
5036
5353
|
if (request.shouldFetchAllCategories && request.options?.page !== void 0) {
|
|
5037
5354
|
throw new Error("Pagination options are not supported when fetching all categories.");
|
|
5038
5355
|
}
|
|
@@ -5045,18 +5362,14 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5045
5362
|
}
|
|
5046
5363
|
const queryString = query.toString();
|
|
5047
5364
|
const apiUrl = `/shop/organisations/${organisationId}/categories` + (queryString ? `?${queryString}` : "");
|
|
5048
|
-
const firstPageResponse = await this.
|
|
5365
|
+
const firstPageResponse = await this.trybeApiClientService.executeRequest({
|
|
5049
5366
|
apiMethod: HTTP_METHOD.GET,
|
|
5050
|
-
url: apiUrl
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
}, validatedIntegration, loggedInUserId);
|
|
5054
|
-
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCategories, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
5367
|
+
url: apiUrl
|
|
5368
|
+
}, integration, loggedInUserId);
|
|
5369
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCategories, (page) => this.trybeApiClientService.executeRequest({
|
|
5055
5370
|
apiMethod: HTTP_METHOD.GET,
|
|
5056
|
-
url: `${apiUrl}${apiUrl.includes("?") ? "&" : "?"}page=${page}
|
|
5057
|
-
|
|
5058
|
-
headers: validatedIntegration.headers
|
|
5059
|
-
}, validatedIntegration, loggedInUserId));
|
|
5371
|
+
url: `${apiUrl}${apiUrl.includes("?") ? "&" : "?"}page=${page}`
|
|
5372
|
+
}, integration, loggedInUserId));
|
|
5060
5373
|
this.logger.info(loggedInUserId, this.fetchCategories.name, this.fileName, "Successfully fetched Trybe categories", {
|
|
5061
5374
|
totalRecords: firstPageResponse.meta.total
|
|
5062
5375
|
});
|
|
@@ -5071,7 +5384,6 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5071
5384
|
request
|
|
5072
5385
|
});
|
|
5073
5386
|
try {
|
|
5074
|
-
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
5075
5387
|
const query = new URLSearchParams();
|
|
5076
5388
|
if (request.options?.page != null) {
|
|
5077
5389
|
query.set("page", String(request.options.page));
|
|
@@ -5081,12 +5393,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5081
5393
|
}
|
|
5082
5394
|
const queryString = query.toString();
|
|
5083
5395
|
const apiUrl = `/shop/coupon-codes/${request.couponCodeId}/offering-discounts` + (queryString ? `?${queryString}` : "");
|
|
5084
|
-
const response = await this.
|
|
5396
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
5085
5397
|
apiMethod: HTTP_METHOD.GET,
|
|
5086
|
-
url: apiUrl
|
|
5087
|
-
|
|
5088
|
-
headers: validatedIntegration.headers
|
|
5089
|
-
}, validatedIntegration, loggedInUserId);
|
|
5398
|
+
url: apiUrl
|
|
5399
|
+
}, integration, loggedInUserId);
|
|
5090
5400
|
this.logger.info(loggedInUserId, this.fetchBookableItemsFromCredit.name, this.fileName, "Successfully fetched bookable items from credit", {
|
|
5091
5401
|
couponCodeId: request.couponCodeId
|
|
5092
5402
|
});
|
|
@@ -5101,8 +5411,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5101
5411
|
request
|
|
5102
5412
|
});
|
|
5103
5413
|
try {
|
|
5104
|
-
const
|
|
5105
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5414
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
5106
5415
|
const finalTimezone = await this.integrationCommonDao.getTimezoneForRequest({
|
|
5107
5416
|
projectId: integration.projectId,
|
|
5108
5417
|
loggedInUserId
|
|
@@ -5115,12 +5424,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5115
5424
|
const formattedDateTimeFrom = formatDateForTrybe(request.dateTimeFrom, true, finalTimezone);
|
|
5116
5425
|
const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false, finalTimezone);
|
|
5117
5426
|
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.
|
|
5427
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
5119
5428
|
apiMethod: HTTP_METHOD.GET,
|
|
5120
|
-
url: apiUrl
|
|
5121
|
-
|
|
5122
|
-
headers: validatedIntegration.headers
|
|
5123
|
-
}, validatedIntegration, loggedInUserId);
|
|
5429
|
+
url: apiUrl
|
|
5430
|
+
}, integration, loggedInUserId);
|
|
5124
5431
|
this.logger.info(loggedInUserId, this.fetchSessionAvailabilityForOffering.name, this.fileName, "Successfully fetched session availability for offering", {
|
|
5125
5432
|
externalOfferingBookableItemId: request.externalOfferingBookableItemId
|
|
5126
5433
|
});
|
|
@@ -5135,8 +5442,7 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5135
5442
|
request
|
|
5136
5443
|
});
|
|
5137
5444
|
try {
|
|
5138
|
-
const
|
|
5139
|
-
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
5445
|
+
const siteId = integration.config?.integrationConfig?.siteId;
|
|
5140
5446
|
const finalTimezone = await this.integrationCommonDao.getTimezoneForRequest({
|
|
5141
5447
|
projectId: integration.projectId,
|
|
5142
5448
|
loggedInUserId
|
|
@@ -5149,12 +5455,10 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5149
5455
|
const formattedDateTimeFrom = formatDateForTrybe(request.dateTimeFrom, true, finalTimezone);
|
|
5150
5456
|
const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false, finalTimezone);
|
|
5151
5457
|
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.
|
|
5458
|
+
const response = await this.trybeApiClientService.executeRequest({
|
|
5153
5459
|
apiMethod: HTTP_METHOD.GET,
|
|
5154
|
-
url: apiUrl
|
|
5155
|
-
|
|
5156
|
-
headers: validatedIntegration.headers
|
|
5157
|
-
}, validatedIntegration, loggedInUserId);
|
|
5460
|
+
url: apiUrl
|
|
5461
|
+
}, integration, loggedInUserId);
|
|
5158
5462
|
this.logger.info(loggedInUserId, this.fetchAppointmentAvailabilityForOffering.name, this.fileName, "Successfully fetched appointment availability for offering", {
|
|
5159
5463
|
externalOfferingBookableItemId: request.externalOfferingBookableItemId
|
|
5160
5464
|
});
|
|
@@ -5177,13 +5481,12 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
5177
5481
|
}
|
|
5178
5482
|
}
|
|
5179
5483
|
};
|
|
5180
|
-
exports.TrybeWellnessManagement =
|
|
5484
|
+
exports.TrybeWellnessManagement = _ts_decorate27([
|
|
5181
5485
|
common.Injectable(),
|
|
5182
|
-
|
|
5183
|
-
|
|
5486
|
+
_ts_metadata24("design:type", Function),
|
|
5487
|
+
_ts_metadata24("design:paramtypes", [
|
|
5184
5488
|
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
5185
|
-
typeof exports.
|
|
5186
|
-
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService,
|
|
5489
|
+
typeof exports.TrybeApiClientService === "undefined" ? Object : exports.TrybeApiClientService,
|
|
5187
5490
|
typeof exports.IntegrationCommonDao === "undefined" ? Object : exports.IntegrationCommonDao
|
|
5188
5491
|
])
|
|
5189
5492
|
], exports.TrybeWellnessManagement);
|
|
@@ -5193,19 +5496,19 @@ dotenv.config({
|
|
|
5193
5496
|
});
|
|
5194
5497
|
|
|
5195
5498
|
// ../../packages/dvss-integration-trybe/src/app.module.ts
|
|
5196
|
-
function
|
|
5499
|
+
function _ts_decorate28(decorators, target, key, desc2) {
|
|
5197
5500
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
5198
5501
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
5199
5502
|
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
5503
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5201
5504
|
}
|
|
5202
|
-
__name(
|
|
5505
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
5203
5506
|
exports.IntegrationTrybeModule = class AppModule2 {
|
|
5204
5507
|
static {
|
|
5205
5508
|
__name(this, "AppModule");
|
|
5206
5509
|
}
|
|
5207
5510
|
};
|
|
5208
|
-
exports.IntegrationTrybeModule =
|
|
5511
|
+
exports.IntegrationTrybeModule = _ts_decorate28([
|
|
5209
5512
|
common.Module({
|
|
5210
5513
|
imports: [
|
|
5211
5514
|
// Load environment variables from root .env file
|
|
@@ -5224,6 +5527,7 @@ exports.IntegrationTrybeModule = _ts_decorate24([
|
|
|
5224
5527
|
providers: [
|
|
5225
5528
|
AppService3,
|
|
5226
5529
|
exports.TrybeAuthService,
|
|
5530
|
+
exports.TrybeApiClientService,
|
|
5227
5531
|
exports.TrybeCustomerManagement,
|
|
5228
5532
|
exports.TrybeCreditBooking,
|
|
5229
5533
|
exports.TrybeWellnessManagement,
|
|
@@ -5235,14 +5539,13 @@ exports.IntegrationTrybeModule = _ts_decorate24([
|
|
|
5235
5539
|
exports.IntegrationRequestLoggerService,
|
|
5236
5540
|
exports.RateLimiterService,
|
|
5237
5541
|
exports.TrafficGatewayService,
|
|
5238
|
-
exports.TrybeCustomerManagement,
|
|
5239
|
-
exports.TrybeAuthService,
|
|
5240
5542
|
exports.TrybeIntegrationConfigurationService,
|
|
5241
5543
|
exports.TrybeIntegrationResourceManagementService,
|
|
5242
5544
|
dvssBackendModuleDatastore.CommonValidationDatabaseService
|
|
5243
5545
|
],
|
|
5244
5546
|
exports: [
|
|
5245
5547
|
exports.TrybeAuthService,
|
|
5548
|
+
exports.TrybeApiClientService,
|
|
5246
5549
|
exports.TrybeCustomerManagement,
|
|
5247
5550
|
exports.TrybeCreditBooking,
|
|
5248
5551
|
exports.TrybeWellnessManagement,
|
|
@@ -5254,19 +5557,19 @@ exports.IntegrationTrybeModule = _ts_decorate24([
|
|
|
5254
5557
|
], exports.IntegrationTrybeModule);
|
|
5255
5558
|
|
|
5256
5559
|
// src/app.module.ts
|
|
5257
|
-
function
|
|
5560
|
+
function _ts_decorate29(decorators, target, key, desc2) {
|
|
5258
5561
|
var c = arguments.length, r = c < 3 ? target : desc2 === null ? desc2 = Object.getOwnPropertyDescriptor(target, key) : desc2, d;
|
|
5259
5562
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc2);
|
|
5260
5563
|
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
5564
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5262
5565
|
}
|
|
5263
|
-
__name(
|
|
5566
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
5264
5567
|
exports.OfferingIntegrationManager = class AppModule3 {
|
|
5265
5568
|
static {
|
|
5266
5569
|
__name(this, "AppModule");
|
|
5267
5570
|
}
|
|
5268
5571
|
};
|
|
5269
|
-
exports.OfferingIntegrationManager =
|
|
5572
|
+
exports.OfferingIntegrationManager = _ts_decorate29([
|
|
5270
5573
|
common.Module({
|
|
5271
5574
|
imports: [
|
|
5272
5575
|
exports.IntegrationTrybeModule,
|