@plyaz/api 1.2.1 → 1.3.0
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/api/client/clientEventManager.d.ts +8 -2
- package/dist/api/client/clientEventManager.d.ts.map +1 -1
- package/dist/api/client/createApiClient.d.ts.map +1 -1
- package/dist/api/client/helpers/interceptors.d.ts +2 -2
- package/dist/api/client/helpers/interceptors.d.ts.map +1 -1
- package/dist/api/client/index.d.ts +2 -1
- package/dist/api/client/index.d.ts.map +1 -1
- package/dist/api/config/global.d.ts.map +1 -1
- package/dist/api/debugger/DebugReport.d.ts.map +1 -1
- package/dist/api/debugger/UnifiedDebugger.d.ts.map +1 -1
- package/dist/api/debugger/queue/DebuggerQueueManager.d.ts.map +1 -1
- package/dist/api/debugger/queue/OperationTracker.d.ts.map +1 -1
- package/dist/api/endpoints/campaigns.d.ts.map +1 -1
- package/dist/api/endpoints/index.d.ts +55 -0
- package/dist/api/endpoints/index.d.ts.map +1 -1
- package/dist/api/endpoints/infobip.d.ts +209 -0
- package/dist/api/endpoints/infobip.d.ts.map +1 -0
- package/dist/api/errors/adapter.d.ts +71 -0
- package/dist/api/errors/adapter.d.ts.map +1 -0
- package/dist/api/errors/index.d.ts +3 -15
- package/dist/api/errors/index.d.ts.map +1 -1
- package/dist/api/events/EventManager.d.ts.map +1 -1
- package/dist/api/events/factories/base.d.ts +11 -3
- package/dist/api/events/factories/base.d.ts.map +1 -1
- package/dist/api/events/factories/errors.d.ts +10 -10
- package/dist/api/events/factories/errors.d.ts.map +1 -1
- package/dist/api/events/queue/ConfigUpdateQueueManager.d.ts.map +1 -1
- package/dist/api/events/queue/EventQueueManager.d.ts.map +1 -1
- package/dist/api/headers/headerBuilder.d.ts.map +1 -1
- package/dist/api/hooks/factories/createApiMutation.d.ts +3 -3
- package/dist/api/hooks/factories/createApiMutation.d.ts.map +1 -1
- package/dist/api/hooks/factories/createApiQuery.d.ts +3 -3
- package/dist/api/hooks/factories/createApiQuery.d.ts.map +1 -1
- package/dist/api/hooks/index.d.ts +0 -1
- package/dist/api/hooks/index.d.ts.map +1 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/network/frameworks/express.d.ts.map +1 -1
- package/dist/api/network/frameworks/nestjs/decorators.d.ts +9 -1
- package/dist/api/network/frameworks/nestjs/decorators.d.ts.map +1 -1
- package/dist/api/network/frameworks/nestjs/enrichedHeadersGuard.d.ts.map +1 -1
- package/dist/api/network/frameworks/nestjs/enrichedHeadersInterceptor.d.ts.map +1 -1
- package/dist/api/network/networkConfigurationManager.d.ts.map +1 -1
- package/dist/api/network/status.d.ts +1 -4
- package/dist/api/network/status.d.ts.map +1 -1
- package/dist/api/performance/performanceMonitor.d.ts.map +1 -1
- package/dist/api/polling/index.d.ts +1 -1
- package/dist/api/polling/index.d.ts.map +1 -1
- package/dist/api/polling/strategies.d.ts +1 -5
- package/dist/api/polling/strategies.d.ts.map +1 -1
- package/dist/api/polling/utils.d.ts.map +1 -1
- package/dist/api/pubsub/index.d.ts.map +1 -1
- package/dist/api/pubsub/react.d.ts +6 -10
- package/dist/api/pubsub/react.d.ts.map +1 -1
- package/dist/api/queue/BaseOperationTracker.d.ts.map +1 -1
- package/dist/api/queue/EventQueueManager.d.ts.map +1 -1
- package/dist/api/queue/QueueOrchestrator.d.ts.map +1 -1
- package/dist/api/services/campaigns/GET/useCampaign.d.ts +1 -1
- package/dist/api/services/campaigns/GET/useCampaign.d.ts.map +1 -1
- package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts +1 -11
- package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts.map +1 -1
- package/dist/api/services/campaigns/GET/useCampaignStats.d.ts +1 -1
- package/dist/api/services/campaigns/GET/useCampaignStats.d.ts.map +1 -1
- package/dist/api/services/campaigns/GET/useCampaigns.d.ts +1 -1
- package/dist/api/services/campaigns/GET/useCampaigns.d.ts.map +1 -1
- package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts +1 -9
- package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts.map +1 -1
- package/dist/api/services/index.d.ts +1 -0
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/api/services/infobip/email/GET/fetchEmailLogs.d.ts +50 -0
- package/dist/api/services/infobip/email/GET/fetchEmailLogs.d.ts.map +1 -0
- package/dist/api/services/infobip/email/GET/fetchEmailReports.d.ts +44 -0
- package/dist/api/services/infobip/email/GET/fetchEmailReports.d.ts.map +1 -0
- package/dist/api/services/infobip/email/GET/fetchScheduledEmailStatuses.d.ts +28 -0
- package/dist/api/services/infobip/email/GET/fetchScheduledEmailStatuses.d.ts.map +1 -0
- package/dist/api/services/infobip/email/GET/fetchScheduledEmails.d.ts +27 -0
- package/dist/api/services/infobip/email/GET/fetchScheduledEmails.d.ts.map +1 -0
- package/dist/api/services/infobip/email/GET/fetchValidations.d.ts +60 -0
- package/dist/api/services/infobip/email/GET/fetchValidations.d.ts.map +1 -0
- package/dist/api/services/infobip/email/GET/index.d.ts +10 -0
- package/dist/api/services/infobip/email/GET/index.d.ts.map +1 -0
- package/dist/api/services/infobip/email/POST/bulkValidateEmails.d.ts +50 -0
- package/dist/api/services/infobip/email/POST/bulkValidateEmails.d.ts.map +1 -0
- package/dist/api/services/infobip/email/POST/index.d.ts +9 -0
- package/dist/api/services/infobip/email/POST/index.d.ts.map +1 -0
- package/dist/api/services/infobip/email/POST/sendAdvancedEmail.d.ts +67 -0
- package/dist/api/services/infobip/email/POST/sendAdvancedEmail.d.ts.map +1 -0
- package/dist/api/services/infobip/email/POST/sendEmail.d.ts +60 -0
- package/dist/api/services/infobip/email/POST/sendEmail.d.ts.map +1 -0
- package/dist/api/services/infobip/email/POST/validateEmail.d.ts +40 -0
- package/dist/api/services/infobip/email/POST/validateEmail.d.ts.map +1 -0
- package/dist/api/services/infobip/email/PUT/index.d.ts +7 -0
- package/dist/api/services/infobip/email/PUT/index.d.ts.map +1 -0
- package/dist/api/services/infobip/email/PUT/rescheduleEmails.d.ts +29 -0
- package/dist/api/services/infobip/email/PUT/rescheduleEmails.d.ts.map +1 -0
- package/dist/api/services/infobip/email/PUT/updateScheduledEmailStatuses.d.ts +36 -0
- package/dist/api/services/infobip/email/PUT/updateScheduledEmailStatuses.d.ts.map +1 -0
- package/dist/api/services/infobip/email/index.d.ts +8 -0
- package/dist/api/services/infobip/email/index.d.ts.map +1 -0
- package/dist/api/services/infobip/index.d.ts +6 -0
- package/dist/api/services/infobip/index.d.ts.map +1 -0
- package/dist/api/utils/index.d.ts +0 -3
- package/dist/api/utils/index.d.ts.map +1 -1
- package/dist/index.cjs +1309 -1392
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1225 -1350
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -5
- package/dist/api/errors/ApiPackageError.d.ts +0 -101
- package/dist/api/errors/ApiPackageError.d.ts.map +0 -1
- package/dist/api/errors/definitions.d.ts +0 -24
- package/dist/api/errors/definitions.d.ts.map +0 -1
- package/dist/api/errors/error-codes.d.ts +0 -116
- package/dist/api/errors/error-codes.d.ts.map +0 -1
- package/dist/api/errors/error-events.d.ts +0 -63
- package/dist/api/errors/error-events.d.ts.map +0 -1
- package/dist/api/errors/types-constants.d.ts +0 -64
- package/dist/api/errors/types-constants.d.ts.map +0 -1
- package/dist/api/hooks/types.d.ts +0 -82
- package/dist/api/hooks/types.d.ts.map +0 -1
- package/dist/api/utils/generation/correlation-id.d.ts +0 -206
- package/dist/api/utils/generation/correlation-id.d.ts.map +0 -1
- package/dist/api/utils/generation/id-generator.d.ts +0 -133
- package/dist/api/utils/generation/id-generator.d.ts.map +0 -1
- package/dist/api/utils/generation/request-id.d.ts +0 -106
- package/dist/api/utils/generation/request-id.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var types = require('@plyaz/types');
|
|
5
|
-
var api = require('@plyaz/types/api');
|
|
3
|
+
var errors$1 = require('@plyaz/errors');
|
|
6
4
|
var fetchff = require('fetchff');
|
|
5
|
+
var api = require('@plyaz/types/api');
|
|
6
|
+
var logger$1 = require('@plyaz/logger');
|
|
7
|
+
var types = require('@plyaz/types');
|
|
8
|
+
var config = require('@plyaz/config');
|
|
9
|
+
var errors = require('@plyaz/types/errors');
|
|
7
10
|
var async_hooks = require('async_hooks');
|
|
8
11
|
var common = require('@nestjs/common');
|
|
9
12
|
var rxjs = require('rxjs');
|
|
@@ -1007,302 +1010,6 @@ function applyPollingStrategy(strategy) {
|
|
|
1007
1010
|
return strategy;
|
|
1008
1011
|
}
|
|
1009
1012
|
__name(applyPollingStrategy, "applyPollingStrategy");
|
|
1010
|
-
var ERROR_DEFINITIONS = {
|
|
1011
|
-
// Authentication
|
|
1012
|
-
[api.API_ERROR_CODES.AUTH_UNAUTHORIZED]: {
|
|
1013
|
-
code: api.API_ERROR_CODES.AUTH_UNAUTHORIZED,
|
|
1014
|
-
status: config.HTTP_STATUS.UNAUTHORIZED,
|
|
1015
|
-
category: types.ERROR_CATEGORY.Authentication
|
|
1016
|
-
},
|
|
1017
|
-
[api.API_ERROR_CODES.AUTH_FORBIDDEN]: {
|
|
1018
|
-
code: api.API_ERROR_CODES.AUTH_FORBIDDEN,
|
|
1019
|
-
status: config.HTTP_STATUS.FORBIDDEN,
|
|
1020
|
-
category: types.ERROR_CATEGORY.Authorization
|
|
1021
|
-
},
|
|
1022
|
-
[api.API_ERROR_CODES.AUTH_TOKEN_EXPIRED]: {
|
|
1023
|
-
code: api.API_ERROR_CODES.AUTH_TOKEN_EXPIRED,
|
|
1024
|
-
status: config.HTTP_STATUS.UNAUTHORIZED,
|
|
1025
|
-
category: types.ERROR_CATEGORY.Authentication
|
|
1026
|
-
},
|
|
1027
|
-
[api.API_ERROR_CODES.AUTH_INVALID_CREDENTIALS]: {
|
|
1028
|
-
code: api.API_ERROR_CODES.AUTH_INVALID_CREDENTIALS,
|
|
1029
|
-
status: config.HTTP_STATUS.UNAUTHORIZED,
|
|
1030
|
-
category: types.ERROR_CATEGORY.Authentication
|
|
1031
|
-
},
|
|
1032
|
-
// Rate Limiting
|
|
1033
|
-
[api.API_ERROR_CODES.RATE_LIMIT_EXCEEDED]: {
|
|
1034
|
-
code: api.API_ERROR_CODES.RATE_LIMIT_EXCEEDED,
|
|
1035
|
-
status: config.HTTP_STATUS.TOO_MANY_REQUESTS,
|
|
1036
|
-
category: types.ERROR_CATEGORY.RateLimit
|
|
1037
|
-
},
|
|
1038
|
-
// Resource Errors
|
|
1039
|
-
[api.API_ERROR_CODES.RESOURCE_NOT_FOUND]: {
|
|
1040
|
-
code: api.API_ERROR_CODES.RESOURCE_NOT_FOUND,
|
|
1041
|
-
status: config.HTTP_STATUS.NOT_FOUND,
|
|
1042
|
-
category: types.ERROR_CATEGORY.NotFound
|
|
1043
|
-
},
|
|
1044
|
-
// System Errors
|
|
1045
|
-
[api.API_ERROR_CODES.INTERNAL_SERVER_ERROR]: {
|
|
1046
|
-
code: api.API_ERROR_CODES.INTERNAL_SERVER_ERROR,
|
|
1047
|
-
status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1048
|
-
category: types.ERROR_CATEGORY.Server
|
|
1049
|
-
},
|
|
1050
|
-
[api.API_ERROR_CODES.SERVICE_UNAVAILABLE]: {
|
|
1051
|
-
code: api.API_ERROR_CODES.SERVICE_UNAVAILABLE,
|
|
1052
|
-
status: config.HTTP_STATUS.SERVICE_UNAVAILABLE,
|
|
1053
|
-
category: types.ERROR_CATEGORY.Server
|
|
1054
|
-
},
|
|
1055
|
-
[api.API_ERROR_CODES.EXTERNAL_SERVICE_ERROR]: {
|
|
1056
|
-
code: api.API_ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
1057
|
-
status: config.HTTP_STATUS.BAD_GATEWAY,
|
|
1058
|
-
category: types.ERROR_CATEGORY.ExternalService
|
|
1059
|
-
},
|
|
1060
|
-
// Validation
|
|
1061
|
-
[api.API_ERROR_CODES.VALIDATION_ERROR]: {
|
|
1062
|
-
code: api.API_ERROR_CODES.VALIDATION_ERROR,
|
|
1063
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1064
|
-
category: types.ERROR_CATEGORY.Validation
|
|
1065
|
-
},
|
|
1066
|
-
[api.API_ERROR_CODES.VALIDATION_FAILED]: {
|
|
1067
|
-
code: api.API_ERROR_CODES.VALIDATION_FAILED,
|
|
1068
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1069
|
-
category: types.ERROR_CATEGORY.Validation
|
|
1070
|
-
},
|
|
1071
|
-
[api.API_ERROR_CODES.REQUIRED_FIELD_MISSING]: {
|
|
1072
|
-
code: api.API_ERROR_CODES.REQUIRED_FIELD_MISSING,
|
|
1073
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1074
|
-
category: types.ERROR_CATEGORY.Validation,
|
|
1075
|
-
fieldsLeft: ["field"]
|
|
1076
|
-
},
|
|
1077
|
-
[api.API_ERROR_CODES.INVALID_FORMAT]: {
|
|
1078
|
-
code: api.API_ERROR_CODES.INVALID_FORMAT,
|
|
1079
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1080
|
-
category: types.ERROR_CATEGORY.Validation
|
|
1081
|
-
},
|
|
1082
|
-
[api.API_ERROR_CODES.STRING_TOO_SHORT]: {
|
|
1083
|
-
code: api.API_ERROR_CODES.STRING_TOO_SHORT,
|
|
1084
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1085
|
-
category: types.ERROR_CATEGORY.Validation,
|
|
1086
|
-
fieldsLeft: ["field", "minLength"]
|
|
1087
|
-
},
|
|
1088
|
-
[api.API_ERROR_CODES.STRING_TOO_LONG]: {
|
|
1089
|
-
code: api.API_ERROR_CODES.STRING_TOO_LONG,
|
|
1090
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1091
|
-
category: types.ERROR_CATEGORY.Validation,
|
|
1092
|
-
fieldsLeft: ["field", "maxLength"]
|
|
1093
|
-
},
|
|
1094
|
-
// Request Errors
|
|
1095
|
-
[api.API_ERROR_CODES.REQUEST_TIMEOUT]: {
|
|
1096
|
-
code: api.API_ERROR_CODES.REQUEST_TIMEOUT,
|
|
1097
|
-
status: config.HTTP_STATUS.REQUEST_TIMEOUT,
|
|
1098
|
-
category: types.ERROR_CATEGORY.Timeout
|
|
1099
|
-
},
|
|
1100
|
-
[api.API_ERROR_CODES.REQUEST_ABORTED]: {
|
|
1101
|
-
code: api.API_ERROR_CODES.REQUEST_ABORTED,
|
|
1102
|
-
status: 0,
|
|
1103
|
-
// No HTTP status for aborted
|
|
1104
|
-
category: types.ERROR_CATEGORY.Client
|
|
1105
|
-
},
|
|
1106
|
-
[api.API_ERROR_CODES.REQUEST_INVALID_PARAMS]: {
|
|
1107
|
-
code: api.API_ERROR_CODES.REQUEST_INVALID_PARAMS,
|
|
1108
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1109
|
-
category: types.ERROR_CATEGORY.Client
|
|
1110
|
-
},
|
|
1111
|
-
[api.API_ERROR_CODES.REQUEST_PREPARATION_FAILED]: {
|
|
1112
|
-
code: api.API_ERROR_CODES.REQUEST_PREPARATION_FAILED,
|
|
1113
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1114
|
-
category: types.ERROR_CATEGORY.Client
|
|
1115
|
-
},
|
|
1116
|
-
// Response Errors
|
|
1117
|
-
[api.API_ERROR_CODES.RESPONSE_INVALID_FORMAT]: {
|
|
1118
|
-
code: api.API_ERROR_CODES.RESPONSE_INVALID_FORMAT,
|
|
1119
|
-
status: config.HTTP_STATUS.UNPROCESSABLE_ENTITY,
|
|
1120
|
-
category: types.ERROR_CATEGORY.Client
|
|
1121
|
-
},
|
|
1122
|
-
[api.API_ERROR_CODES.RESPONSE_PARSING_FAILED]: {
|
|
1123
|
-
code: api.API_ERROR_CODES.RESPONSE_PARSING_FAILED,
|
|
1124
|
-
status: config.HTTP_STATUS.UNPROCESSABLE_ENTITY,
|
|
1125
|
-
category: types.ERROR_CATEGORY.Client
|
|
1126
|
-
},
|
|
1127
|
-
// Network
|
|
1128
|
-
[api.API_ERROR_CODES.NETWORK_ERROR]: {
|
|
1129
|
-
code: api.API_ERROR_CODES.NETWORK_ERROR,
|
|
1130
|
-
status: config.HTTP_STATUS.BAD_GATEWAY,
|
|
1131
|
-
category: types.ERROR_CATEGORY.Network
|
|
1132
|
-
},
|
|
1133
|
-
[api.API_ERROR_CODES.NETWORK_TIMEOUT]: {
|
|
1134
|
-
code: api.API_ERROR_CODES.NETWORK_TIMEOUT,
|
|
1135
|
-
status: config.HTTP_STATUS.GATEWAY_TIMEOUT,
|
|
1136
|
-
category: types.ERROR_CATEGORY.Timeout
|
|
1137
|
-
},
|
|
1138
|
-
[api.API_ERROR_CODES.NETWORK_CONNECTION_FAILED]: {
|
|
1139
|
-
code: api.API_ERROR_CODES.NETWORK_CONNECTION_FAILED,
|
|
1140
|
-
status: 0,
|
|
1141
|
-
// No HTTP status for connection failure
|
|
1142
|
-
category: types.ERROR_CATEGORY.Network
|
|
1143
|
-
},
|
|
1144
|
-
[api.API_ERROR_CODES.NETWORK_OFFLINE]: {
|
|
1145
|
-
code: api.API_ERROR_CODES.NETWORK_OFFLINE,
|
|
1146
|
-
status: 0,
|
|
1147
|
-
// No HTTP status for offline
|
|
1148
|
-
category: types.ERROR_CATEGORY.Network
|
|
1149
|
-
},
|
|
1150
|
-
[api.API_ERROR_CODES.NETWORK_DNS_FAILED]: {
|
|
1151
|
-
code: api.API_ERROR_CODES.NETWORK_DNS_FAILED,
|
|
1152
|
-
status: 0,
|
|
1153
|
-
// No HTTP status for DNS failure
|
|
1154
|
-
category: types.ERROR_CATEGORY.Network
|
|
1155
|
-
},
|
|
1156
|
-
// Server
|
|
1157
|
-
[api.API_ERROR_CODES.SERVER_ERROR]: {
|
|
1158
|
-
code: api.API_ERROR_CODES.SERVER_ERROR,
|
|
1159
|
-
status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1160
|
-
category: types.ERROR_CATEGORY.Server
|
|
1161
|
-
},
|
|
1162
|
-
// Client
|
|
1163
|
-
[api.API_ERROR_CODES.CLIENT_ERROR]: {
|
|
1164
|
-
code: api.API_ERROR_CODES.CLIENT_ERROR,
|
|
1165
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1166
|
-
category: types.ERROR_CATEGORY.Client
|
|
1167
|
-
},
|
|
1168
|
-
[api.API_ERROR_CODES.CLIENT_CANCELLED]: {
|
|
1169
|
-
code: api.API_ERROR_CODES.CLIENT_CANCELLED,
|
|
1170
|
-
status: 0,
|
|
1171
|
-
// No HTTP status for cancelled
|
|
1172
|
-
category: types.ERROR_CATEGORY.Client
|
|
1173
|
-
},
|
|
1174
|
-
[api.API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED]: {
|
|
1175
|
-
code: api.API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED,
|
|
1176
|
-
status: 0,
|
|
1177
|
-
// No HTTP status for initialization failure
|
|
1178
|
-
category: types.ERROR_CATEGORY.Client
|
|
1179
|
-
},
|
|
1180
|
-
[api.API_ERROR_CODES.CLIENT_INVALID_CONFIG]: {
|
|
1181
|
-
code: api.API_ERROR_CODES.CLIENT_INVALID_CONFIG,
|
|
1182
|
-
status: 0,
|
|
1183
|
-
// No HTTP status for configuration errors
|
|
1184
|
-
category: types.ERROR_CATEGORY.Client
|
|
1185
|
-
},
|
|
1186
|
-
[api.API_ERROR_CODES.CLIENT_MISSING_BASE_URL]: {
|
|
1187
|
-
code: api.API_ERROR_CODES.CLIENT_MISSING_BASE_URL,
|
|
1188
|
-
status: 0,
|
|
1189
|
-
// No HTTP status for configuration errors
|
|
1190
|
-
category: types.ERROR_CATEGORY.Client
|
|
1191
|
-
},
|
|
1192
|
-
[api.API_ERROR_CODES.CONFIG_VALIDATION_FAILED]: {
|
|
1193
|
-
code: api.API_ERROR_CODES.CONFIG_VALIDATION_FAILED,
|
|
1194
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1195
|
-
category: types.ERROR_CATEGORY.Validation
|
|
1196
|
-
},
|
|
1197
|
-
[api.API_ERROR_CODES.HEADER_PROCESSING_FAILED]: {
|
|
1198
|
-
code: api.API_ERROR_CODES.HEADER_PROCESSING_FAILED,
|
|
1199
|
-
status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1200
|
-
category: types.ERROR_CATEGORY.Headers
|
|
1201
|
-
},
|
|
1202
|
-
[api.API_ERROR_CODES.NETWORK_OVERRIDE_FAILED]: {
|
|
1203
|
-
code: api.API_ERROR_CODES.NETWORK_OVERRIDE_FAILED,
|
|
1204
|
-
status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1205
|
-
category: types.ERROR_CATEGORY.Network
|
|
1206
|
-
},
|
|
1207
|
-
// Headers
|
|
1208
|
-
[api.API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED]: {
|
|
1209
|
-
code: api.API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED,
|
|
1210
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1211
|
-
category: types.ERROR_CATEGORY.Headers
|
|
1212
|
-
},
|
|
1213
|
-
[api.API_ERROR_CODES.HEADERS_VALIDATION_FAILED]: {
|
|
1214
|
-
code: api.API_ERROR_CODES.HEADERS_VALIDATION_FAILED,
|
|
1215
|
-
status: config.HTTP_STATUS.BAD_REQUEST,
|
|
1216
|
-
category: types.ERROR_CATEGORY.Headers
|
|
1217
|
-
},
|
|
1218
|
-
[api.API_ERROR_CODES.HEADERS_MERGE_CONFLICT]: {
|
|
1219
|
-
code: api.API_ERROR_CODES.HEADERS_MERGE_CONFLICT,
|
|
1220
|
-
status: config.HTTP_STATUS.CONFLICT,
|
|
1221
|
-
category: types.ERROR_CATEGORY.Headers
|
|
1222
|
-
},
|
|
1223
|
-
// Cache
|
|
1224
|
-
[api.API_ERROR_CODES.CACHE_STORAGE_FAILED]: {
|
|
1225
|
-
code: api.API_ERROR_CODES.CACHE_STORAGE_FAILED,
|
|
1226
|
-
status: 0,
|
|
1227
|
-
// No HTTP status for cache failures
|
|
1228
|
-
category: types.ERROR_CATEGORY.Cache
|
|
1229
|
-
},
|
|
1230
|
-
[api.API_ERROR_CODES.CACHE_RETRIEVAL_FAILED]: {
|
|
1231
|
-
code: api.API_ERROR_CODES.CACHE_RETRIEVAL_FAILED,
|
|
1232
|
-
status: 0,
|
|
1233
|
-
// No HTTP status for cache failures
|
|
1234
|
-
category: types.ERROR_CATEGORY.Cache
|
|
1235
|
-
},
|
|
1236
|
-
[api.API_ERROR_CODES.CACHE_INVALIDATION_FAILED]: {
|
|
1237
|
-
code: api.API_ERROR_CODES.CACHE_INVALIDATION_FAILED,
|
|
1238
|
-
status: 0,
|
|
1239
|
-
// No HTTP status for cache failures
|
|
1240
|
-
category: types.ERROR_CATEGORY.Cache
|
|
1241
|
-
},
|
|
1242
|
-
// Retry
|
|
1243
|
-
[api.API_ERROR_CODES.RETRY_EXHAUSTED]: {
|
|
1244
|
-
code: api.API_ERROR_CODES.RETRY_EXHAUSTED,
|
|
1245
|
-
status: config.HTTP_STATUS.SERVICE_UNAVAILABLE,
|
|
1246
|
-
category: types.ERROR_CATEGORY.Retry
|
|
1247
|
-
},
|
|
1248
|
-
[api.API_ERROR_CODES.RETRY_STRATEGY_INVALID]: {
|
|
1249
|
-
code: api.API_ERROR_CODES.RETRY_STRATEGY_INVALID,
|
|
1250
|
-
status: 0,
|
|
1251
|
-
// No HTTP status for strategy errors
|
|
1252
|
-
category: types.ERROR_CATEGORY.Retry
|
|
1253
|
-
},
|
|
1254
|
-
// Strategy
|
|
1255
|
-
[api.API_ERROR_CODES.STRATEGY_INVALID]: {
|
|
1256
|
-
code: api.API_ERROR_CODES.STRATEGY_INVALID,
|
|
1257
|
-
status: 0,
|
|
1258
|
-
// No HTTP status for strategy errors
|
|
1259
|
-
category: types.ERROR_CATEGORY.Strategy
|
|
1260
|
-
},
|
|
1261
|
-
[api.API_ERROR_CODES.STRATEGY_CONFLICT]: {
|
|
1262
|
-
code: api.API_ERROR_CODES.STRATEGY_CONFLICT,
|
|
1263
|
-
status: config.HTTP_STATUS.CONFLICT,
|
|
1264
|
-
category: types.ERROR_CATEGORY.Strategy
|
|
1265
|
-
},
|
|
1266
|
-
// Regional
|
|
1267
|
-
[api.API_ERROR_CODES.REGIONAL_PRESET_NOT_FOUND]: {
|
|
1268
|
-
code: api.API_ERROR_CODES.REGIONAL_PRESET_NOT_FOUND,
|
|
1269
|
-
status: 0,
|
|
1270
|
-
// No HTTP status for regional preset errors
|
|
1271
|
-
category: types.ERROR_CATEGORY.Regional
|
|
1272
|
-
},
|
|
1273
|
-
[api.API_ERROR_CODES.REGION_DETECTION_FAILED]: {
|
|
1274
|
-
code: api.API_ERROR_CODES.REGION_DETECTION_FAILED,
|
|
1275
|
-
status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1276
|
-
category: types.ERROR_CATEGORY.Regional
|
|
1277
|
-
},
|
|
1278
|
-
// Timeout
|
|
1279
|
-
[api.API_ERROR_CODES.TIMEOUT]: {
|
|
1280
|
-
code: api.API_ERROR_CODES.TIMEOUT,
|
|
1281
|
-
status: config.HTTP_STATUS.REQUEST_TIMEOUT,
|
|
1282
|
-
category: types.ERROR_CATEGORY.Timeout
|
|
1283
|
-
},
|
|
1284
|
-
// Unknown
|
|
1285
|
-
[api.API_ERROR_CODES.UNKNOWN_ERROR]: {
|
|
1286
|
-
code: api.API_ERROR_CODES.UNKNOWN_ERROR,
|
|
1287
|
-
status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1288
|
-
category: types.ERROR_CATEGORY.Unknown
|
|
1289
|
-
}
|
|
1290
|
-
};
|
|
1291
|
-
function getErrorDefinition(errorCode) {
|
|
1292
|
-
return ERROR_DEFINITIONS[errorCode];
|
|
1293
|
-
}
|
|
1294
|
-
__name(getErrorDefinition, "getErrorDefinition");
|
|
1295
|
-
function getErrorCodeByStatus(status) {
|
|
1296
|
-
const entry = Object.entries(ERROR_DEFINITIONS).find(
|
|
1297
|
-
([, definition]) => definition.status === status
|
|
1298
|
-
);
|
|
1299
|
-
return entry?.[0];
|
|
1300
|
-
}
|
|
1301
|
-
__name(getErrorCodeByStatus, "getErrorCodeByStatus");
|
|
1302
|
-
function getErrorCategory(errorCode) {
|
|
1303
|
-
return ERROR_DEFINITIONS[errorCode]?.category ?? types.ERROR_CATEGORY.Unknown;
|
|
1304
|
-
}
|
|
1305
|
-
__name(getErrorCategory, "getErrorCategory");
|
|
1306
1013
|
var BINARY_HEAP = {
|
|
1307
1014
|
/** Number of children per node in binary heap */
|
|
1308
1015
|
CHILDREN_PER_NODE: 2,
|
|
@@ -2029,8 +1736,6 @@ function removeCircularReferences(obj) {
|
|
|
2029
1736
|
}
|
|
2030
1737
|
}
|
|
2031
1738
|
__name(removeCircularReferences, "removeCircularReferences");
|
|
2032
|
-
|
|
2033
|
-
// src/api/utils/time.ts
|
|
2034
1739
|
var MS_IN_SECOND = 1e3;
|
|
2035
1740
|
var SECONDS_PER_MINUTE = 60;
|
|
2036
1741
|
var MINUTES_PER_HOUR = 60;
|
|
@@ -2575,13 +2280,13 @@ var BaseEventFactory = class {
|
|
|
2575
2280
|
constructor(namespace, emitter) {
|
|
2576
2281
|
this.namespace = namespace;
|
|
2577
2282
|
this.emitter = emitter;
|
|
2578
|
-
api.
|
|
2283
|
+
api.EVENT_SCOPES_WITH_TEMPORARY.forEach((scope) => {
|
|
2579
2284
|
this.scopedHandlers.set(scope, /* @__PURE__ */ new Map());
|
|
2580
2285
|
this.originalHandlers.set(scope, /* @__PURE__ */ new Map());
|
|
2581
2286
|
});
|
|
2582
2287
|
this.trackFactoryOperation("factory_initialized", {
|
|
2583
2288
|
namespace: this.namespace,
|
|
2584
|
-
scopesInitialized: api.
|
|
2289
|
+
scopesInitialized: api.EVENT_SCOPES_WITH_TEMPORARY.length,
|
|
2585
2290
|
emitterType: "EventEmitter"
|
|
2586
2291
|
});
|
|
2587
2292
|
}
|
|
@@ -2733,16 +2438,14 @@ var BaseEventFactory = class {
|
|
|
2733
2438
|
* - Non-scoped wildcards for backwards compatibility (e.g., headers:*)
|
|
2734
2439
|
*/
|
|
2735
2440
|
emitAcrossScopes(eventType, eventName, data, scopes) {
|
|
2736
|
-
const targetScopes = scopes ?? api.
|
|
2737
|
-
const
|
|
2738
|
-
(s) => s === "temporary" ? "request" : s
|
|
2739
|
-
);
|
|
2740
|
-
const scopeOrder = [...api.EVENT_SCOPES];
|
|
2441
|
+
const targetScopes = scopes ?? api.EVENT_SCOPES_WITH_TEMPORARY;
|
|
2442
|
+
const scopeOrder = [...api.EVENT_SCOPES_WITH_TEMPORARY];
|
|
2741
2443
|
for (const scope of scopeOrder) {
|
|
2742
|
-
if (
|
|
2743
|
-
const
|
|
2444
|
+
if (targetScopes.includes(scope)) {
|
|
2445
|
+
const emitScope = scope === "temporary" ? "request" : scope;
|
|
2446
|
+
const namespacedEvent = `${emitScope}:${eventType}:${eventName}`;
|
|
2744
2447
|
this.emitter.emit(namespacedEvent, data);
|
|
2745
|
-
const wildcardEvent = `${
|
|
2448
|
+
const wildcardEvent = `${emitScope}:${eventType}:*`;
|
|
2746
2449
|
const wildcardData2 = typeof data === "object" && data !== null ? { ...data, originalEvent: eventName } : { data, originalEvent: eventName };
|
|
2747
2450
|
this.emitter.emit(wildcardEvent, wildcardData2);
|
|
2748
2451
|
}
|
|
@@ -2940,6 +2643,52 @@ var BaseEventFactory = class {
|
|
|
2940
2643
|
});
|
|
2941
2644
|
return this.createHandlerUnsubscribe(scope, eventName, handler, unsubscribes);
|
|
2942
2645
|
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Remove a specific handler from a scoped event
|
|
2648
|
+
*
|
|
2649
|
+
* @param scope - The scope to remove from ('global', 'config', 'client', 'request')
|
|
2650
|
+
* @param eventName - The event name (e.g., 'validation', 'network', '*')
|
|
2651
|
+
* @param handler - The specific handler to remove (should be the original handler, not wrapped)
|
|
2652
|
+
*/
|
|
2653
|
+
removeScopedHandler(scope, eventName, handler) {
|
|
2654
|
+
const startTime = Date.now();
|
|
2655
|
+
const scopeMap = this.scopedHandlers.get(scope);
|
|
2656
|
+
const originalMap = this.originalHandlers.get(scope);
|
|
2657
|
+
if (!scopeMap || !originalMap) {
|
|
2658
|
+
return;
|
|
2659
|
+
}
|
|
2660
|
+
const handlers = scopeMap.get(eventName);
|
|
2661
|
+
const originals = originalMap.get(eventName);
|
|
2662
|
+
if (!handlers || !originals) {
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
const handlerAsUnknown = handler;
|
|
2666
|
+
const originalIndex = originals.indexOf(handlerAsUnknown);
|
|
2667
|
+
if (originalIndex === -1) {
|
|
2668
|
+
return;
|
|
2669
|
+
}
|
|
2670
|
+
const beforeCount = handlers.length;
|
|
2671
|
+
const wrappedHandler = handlers[originalIndex];
|
|
2672
|
+
handlers.splice(originalIndex, 1);
|
|
2673
|
+
originals.splice(originalIndex, 1);
|
|
2674
|
+
const scopedEventKey = `${scope}:${this.namespace}:${eventName}`;
|
|
2675
|
+
this.emitter.off(scopedEventKey, wrappedHandler);
|
|
2676
|
+
if (handlers.length === 0) {
|
|
2677
|
+
scopeMap.delete(eventName);
|
|
2678
|
+
originalMap.delete(eventName);
|
|
2679
|
+
} else {
|
|
2680
|
+
scopeMap.set(eventName, handlers);
|
|
2681
|
+
originalMap.set(eventName, originals);
|
|
2682
|
+
}
|
|
2683
|
+
this.trackFactoryOperation("specific_handler_removed", {
|
|
2684
|
+
scope,
|
|
2685
|
+
eventName,
|
|
2686
|
+
beforeHandlerCount: beforeCount,
|
|
2687
|
+
afterHandlerCount: handlers.length,
|
|
2688
|
+
eventDeleted: handlers.length === 0,
|
|
2689
|
+
removalTime: Date.now() - startTime
|
|
2690
|
+
});
|
|
2691
|
+
}
|
|
2943
2692
|
/**
|
|
2944
2693
|
* Remove all listeners for a scoped event
|
|
2945
2694
|
*
|
|
@@ -4688,13 +4437,13 @@ var HANDLER_SCOPES = {
|
|
|
4688
4437
|
REQUEST: "request"
|
|
4689
4438
|
// Request-level handlers (highest priority, per-request)
|
|
4690
4439
|
};
|
|
4691
|
-
var
|
|
4440
|
+
var EVENT_SCOPES = [
|
|
4692
4441
|
HANDLER_SCOPES.GLOBAL,
|
|
4693
4442
|
HANDLER_SCOPES.CONFIG,
|
|
4694
4443
|
HANDLER_SCOPES.CLIENT,
|
|
4695
4444
|
HANDLER_SCOPES.REQUEST
|
|
4696
4445
|
];
|
|
4697
|
-
var
|
|
4446
|
+
var EVENT_SCOPES_WITH_TEMPORARY2 = [...EVENT_SCOPES, "temporary"];
|
|
4698
4447
|
function createHandlerNamespace(eventType, scope) {
|
|
4699
4448
|
return `${HANDLER_SCOPES[scope]}:${eventType}`;
|
|
4700
4449
|
}
|
|
@@ -4886,6 +4635,7 @@ __name(getHandlerNamespaceForEvent, "getHandlerNamespaceForEvent");
|
|
|
4886
4635
|
|
|
4887
4636
|
// src/api/events/EventManager.ts
|
|
4888
4637
|
var SLOW_REQUEST_THRESHOLD_MS = 5e3;
|
|
4638
|
+
var logger = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.EVENT_MANAGER, transport: "console" });
|
|
4889
4639
|
var EventManager = class _EventManager extends BaseEventFactory {
|
|
4890
4640
|
static {
|
|
4891
4641
|
__name(this, "EventManager");
|
|
@@ -4903,7 +4653,7 @@ var EventManager = class _EventManager extends BaseEventFactory {
|
|
|
4903
4653
|
// DEFAULT: ALL scopes are active ['global', 'config', 'client', 'request']
|
|
4904
4654
|
// This means events are emitted to handlers at all scope levels by default
|
|
4905
4655
|
// Can be restricted by calling setEventScopes() with specific scopes
|
|
4906
|
-
eventScopes = [...
|
|
4656
|
+
eventScopes = [...EVENT_SCOPES];
|
|
4907
4657
|
currentEventScopes = this.eventScopes;
|
|
4908
4658
|
// Alias for compatibility
|
|
4909
4659
|
constructor() {
|
|
@@ -5079,9 +4829,10 @@ var EventManager = class _EventManager extends BaseEventFactory {
|
|
|
5079
4829
|
*/
|
|
5080
4830
|
setupDebugHandlers() {
|
|
5081
4831
|
this.on(DEBUG_EVENTS2.CONFIG_CONFLICT, (event) => {
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
4832
|
+
logger.debug("Config conflict detected", {
|
|
4833
|
+
conflictType: event.type,
|
|
4834
|
+
source: event.source
|
|
4835
|
+
});
|
|
5085
4836
|
});
|
|
5086
4837
|
}
|
|
5087
4838
|
/**
|
|
@@ -5375,6 +5126,7 @@ var eventManager = {
|
|
|
5375
5126
|
getEventStats: /* @__PURE__ */ __name(() => getEventManager().getEventStats(), "getEventStats"),
|
|
5376
5127
|
getActiveScopes: /* @__PURE__ */ __name(() => getEventManager().getActiveScopes(), "getActiveScopes")
|
|
5377
5128
|
};
|
|
5129
|
+
var logger2 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.EVENT_QUEUE, transport: "console" });
|
|
5378
5130
|
var EventQueueManager = class _EventQueueManager {
|
|
5379
5131
|
static {
|
|
5380
5132
|
__name(this, "EventQueueManager");
|
|
@@ -5476,7 +5228,11 @@ var EventQueueManager = class _EventQueueManager {
|
|
|
5476
5228
|
}
|
|
5477
5229
|
}
|
|
5478
5230
|
if (config.isDev) {
|
|
5479
|
-
|
|
5231
|
+
logger2.warn("Event processing failed", {
|
|
5232
|
+
eventType: event.eventType,
|
|
5233
|
+
eventName: event.eventName,
|
|
5234
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5235
|
+
});
|
|
5480
5236
|
}
|
|
5481
5237
|
}
|
|
5482
5238
|
}
|
|
@@ -7515,6 +7271,7 @@ function colorProgressBar(value, max2, width = DEFAULT_PROGRESS_BAR_WIDTH) {
|
|
|
7515
7271
|
return `[${bar}] ${percentText}`;
|
|
7516
7272
|
}
|
|
7517
7273
|
__name(colorProgressBar, "colorProgressBar");
|
|
7274
|
+
var logger3 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.DEBUG_REPORT, transport: "console" });
|
|
7518
7275
|
var DEBUG_REPORT_CONSTANTS = {
|
|
7519
7276
|
// Byte sizes
|
|
7520
7277
|
BYTES_PER_KB: 1024,
|
|
@@ -9260,24 +9017,26 @@ function logNetworkOverride(params) {
|
|
|
9260
9017
|
networkQuality,
|
|
9261
9018
|
duration
|
|
9262
9019
|
} = params;
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9020
|
+
logger3.group(`🔧 Network Config Override: ${property}`);
|
|
9021
|
+
logger3.info("Value changed", {
|
|
9022
|
+
from: originalValue,
|
|
9023
|
+
to: overrideValue
|
|
9024
|
+
});
|
|
9025
|
+
logger3.info("Source", { source });
|
|
9026
|
+
logger3.info("Reason", { reason });
|
|
9267
9027
|
if (networkQuality) {
|
|
9268
|
-
|
|
9028
|
+
logger3.info("Network Quality", { quality: networkQuality.toLowerCase() });
|
|
9269
9029
|
}
|
|
9270
9030
|
if (networkInfo?.saveData) {
|
|
9271
|
-
|
|
9031
|
+
logger3.info("Save-Data enabled");
|
|
9272
9032
|
}
|
|
9273
9033
|
if (duration) {
|
|
9274
|
-
|
|
9034
|
+
logger3.info("Duration", { ms: duration });
|
|
9275
9035
|
}
|
|
9276
|
-
|
|
9036
|
+
logger3.groupEnd();
|
|
9277
9037
|
}
|
|
9278
9038
|
__name(logNetworkOverride, "logNetworkOverride");
|
|
9279
|
-
|
|
9280
|
-
// src/api/debugger/UnifiedDebugger.ts
|
|
9039
|
+
var logger4 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.UNIFIED_DEBUGGER, transport: "console" });
|
|
9281
9040
|
var DEBUGGER_CONSTANTS = {
|
|
9282
9041
|
// Array/Division constants
|
|
9283
9042
|
HALF_DIVISOR: 2,
|
|
@@ -9463,7 +9222,10 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
9463
9222
|
}
|
|
9464
9223
|
}
|
|
9465
9224
|
);
|
|
9466
|
-
|
|
9225
|
+
logger4.warn("⚠️ Debugger tracking failed", {
|
|
9226
|
+
error: apiError.message,
|
|
9227
|
+
context: apiError.context
|
|
9228
|
+
});
|
|
9467
9229
|
}
|
|
9468
9230
|
/**
|
|
9469
9231
|
* Safe tracking helper that handles errors properly
|
|
@@ -9798,11 +9560,11 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
9798
9560
|
try {
|
|
9799
9561
|
const presetReport = this.getPresetChangeReport();
|
|
9800
9562
|
if (presetReport) {
|
|
9801
|
-
|
|
9802
|
-
|
|
9563
|
+
logger4.info(presetReport);
|
|
9564
|
+
logger4.info("");
|
|
9803
9565
|
}
|
|
9804
9566
|
const report = await generateComprehensiveReport();
|
|
9805
|
-
|
|
9567
|
+
logger4.info(formatReportForConsole(report));
|
|
9806
9568
|
} catch (err) {
|
|
9807
9569
|
const error = new ApiPackageError(
|
|
9808
9570
|
"Failed to generate debug report",
|
|
@@ -9810,7 +9572,9 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
9810
9572
|
api.API_ERROR_CODES.DEBUG_TRACKING_FAILED,
|
|
9811
9573
|
{ cause: err }
|
|
9812
9574
|
);
|
|
9813
|
-
|
|
9575
|
+
logger4.error("⚠️ Failed to generate debug report", {
|
|
9576
|
+
error: error.message
|
|
9577
|
+
});
|
|
9814
9578
|
throw error;
|
|
9815
9579
|
}
|
|
9816
9580
|
}
|
|
@@ -10127,11 +9891,11 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10127
9891
|
trigger: options.trigger,
|
|
10128
9892
|
timestamp
|
|
10129
9893
|
};
|
|
10130
|
-
if (this.enabled
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
9894
|
+
if (this.enabled) {
|
|
9895
|
+
logger4.group(`📋 Network preset applied: ${options.preset}`);
|
|
9896
|
+
logger4.info(`Quality: ${options.networkConditions.quality}`);
|
|
9897
|
+
logger4.info(`Trigger: ${options.trigger}`);
|
|
9898
|
+
logger4.groupEnd();
|
|
10135
9899
|
}
|
|
10136
9900
|
}
|
|
10137
9901
|
options.changes.forEach((change) => {
|
|
@@ -10193,8 +9957,8 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10193
9957
|
source: "networkPreset",
|
|
10194
9958
|
reason: options.trigger
|
|
10195
9959
|
});
|
|
10196
|
-
if (this.enabled
|
|
10197
|
-
|
|
9960
|
+
if (this.enabled) {
|
|
9961
|
+
logger4.info("🔄 Network config restored", { property });
|
|
10198
9962
|
}
|
|
10199
9963
|
this.addToHistory({
|
|
10200
9964
|
type: "network",
|
|
@@ -10221,16 +9985,16 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10221
9985
|
trigger: options.trigger,
|
|
10222
9986
|
timestamp: Date.now()
|
|
10223
9987
|
};
|
|
10224
|
-
if (this.enabled
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
9988
|
+
if (this.enabled) {
|
|
9989
|
+
logger4.group(`📋 Network preset applied: ${presetId}`);
|
|
9990
|
+
logger4.info(`Quality: ${options.networkQuality}`);
|
|
9991
|
+
logger4.info(`Trigger: ${options.trigger}`);
|
|
10228
9992
|
changes.forEach((change) => {
|
|
10229
9993
|
const prev = typeof change.previousValue === "string" ? `"${change.previousValue}"` : String(change.previousValue);
|
|
10230
9994
|
const next = typeof change.newValue === "string" ? `"${change.newValue}"` : String(change.newValue);
|
|
10231
|
-
|
|
9995
|
+
logger4.info(` ${change.property}: ${prev} → ${next}`);
|
|
10232
9996
|
});
|
|
10233
|
-
|
|
9997
|
+
logger4.groupEnd();
|
|
10234
9998
|
}
|
|
10235
9999
|
const configChanges = changes.reduce(
|
|
10236
10000
|
(acc, change) => {
|
|
@@ -10653,14 +10417,14 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10653
10417
|
*/
|
|
10654
10418
|
enableNetworkDebug() {
|
|
10655
10419
|
this.setEnabled(true);
|
|
10656
|
-
|
|
10420
|
+
logger4.info("🌐 Network configuration debugging enabled");
|
|
10657
10421
|
}
|
|
10658
10422
|
/**
|
|
10659
10423
|
* Disable network config debugging
|
|
10660
10424
|
*/
|
|
10661
10425
|
disableNetworkDebug() {
|
|
10662
10426
|
this.setEnabled(false);
|
|
10663
|
-
|
|
10427
|
+
logger4.info("🌐 Network configuration debugging disabled");
|
|
10664
10428
|
}
|
|
10665
10429
|
/**
|
|
10666
10430
|
* Clear network debug data
|
|
@@ -10669,8 +10433,8 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10669
10433
|
this.networkOverrides.clear();
|
|
10670
10434
|
this.history = [];
|
|
10671
10435
|
this.lastPresetChange = void 0;
|
|
10672
|
-
if (this.enabled
|
|
10673
|
-
|
|
10436
|
+
if (this.enabled) {
|
|
10437
|
+
logger4.info("🗑️ Network configuration debug data cleared");
|
|
10674
10438
|
}
|
|
10675
10439
|
this.getDebugFactory().emitNetworkDataCleared();
|
|
10676
10440
|
eventManager.debug.emitNetworkDataCleared();
|
|
@@ -10691,7 +10455,7 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10691
10455
|
duration: config.duration
|
|
10692
10456
|
});
|
|
10693
10457
|
if (this.enabled && config.trigger) {
|
|
10694
|
-
|
|
10458
|
+
logger4.info(`🌐 Network override triggered by ${config.trigger}`, {
|
|
10695
10459
|
property: config.property,
|
|
10696
10460
|
value: config.overrideValue,
|
|
10697
10461
|
reason: config.reason
|
|
@@ -11072,6 +10836,9 @@ function validateConfigUpdate(updates, options) {
|
|
|
11072
10836
|
};
|
|
11073
10837
|
}
|
|
11074
10838
|
__name(validateConfigUpdate, "validateConfigUpdate");
|
|
10839
|
+
new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.CONFIG_QUEUE, transport: "console" });
|
|
10840
|
+
new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.QUEUE_ORCHESTRATOR, transport: "console" });
|
|
10841
|
+
var logger7 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.OPERATION_TRACKER, transport: "console" });
|
|
11075
10842
|
var BaseOperationTracker = class {
|
|
11076
10843
|
constructor(queueName, priorityDetector, sourceDetector) {
|
|
11077
10844
|
this.queueName = queueName;
|
|
@@ -11136,7 +10903,10 @@ var BaseOperationTracker = class {
|
|
|
11136
10903
|
try {
|
|
11137
10904
|
await this.processor(op.data);
|
|
11138
10905
|
} catch (error) {
|
|
11139
|
-
|
|
10906
|
+
logger7.error("Failed to process operation", {
|
|
10907
|
+
queueName: this.queueName,
|
|
10908
|
+
error: error instanceof Error ? error.message : String(error)
|
|
10909
|
+
});
|
|
11140
10910
|
this.handleProcessingError(error, op.data);
|
|
11141
10911
|
}
|
|
11142
10912
|
}
|
|
@@ -11145,8 +10915,9 @@ var BaseOperationTracker = class {
|
|
|
11145
10915
|
*/
|
|
11146
10916
|
handleProcessingError(error, operation) {
|
|
11147
10917
|
if (config.isDev) {
|
|
11148
|
-
|
|
11149
|
-
|
|
10918
|
+
logger7.debug("Error processing operation", {
|
|
10919
|
+
queueName: this.queueName,
|
|
10920
|
+
error: error instanceof Error ? error.message : String(error),
|
|
11150
10921
|
operation: operation.operation,
|
|
11151
10922
|
event: operation.event
|
|
11152
10923
|
});
|
|
@@ -11225,6 +10996,14 @@ function createDefaultSourceDetector() {
|
|
|
11225
10996
|
};
|
|
11226
10997
|
}
|
|
11227
10998
|
__name(createDefaultSourceDetector, "createDefaultSourceDetector");
|
|
10999
|
+
new logger$1.ApiLogger({
|
|
11000
|
+
service: types.LOGGER_SERVICES.EVENT_QUEUE_MANAGER,
|
|
11001
|
+
transport: "console"
|
|
11002
|
+
});
|
|
11003
|
+
var logger9 = new logger$1.ApiLogger({
|
|
11004
|
+
service: types.LOGGER_SERVICES.DEBUGGER_QUEUE_MANAGER,
|
|
11005
|
+
transport: "console"
|
|
11006
|
+
});
|
|
11228
11007
|
var DebuggerQueueManager = class _DebuggerQueueManager {
|
|
11229
11008
|
static {
|
|
11230
11009
|
__name(this, "DebuggerQueueManager");
|
|
@@ -11296,7 +11075,9 @@ var DebuggerQueueManager = class _DebuggerQueueManager {
|
|
|
11296
11075
|
}
|
|
11297
11076
|
} catch (error) {
|
|
11298
11077
|
if (config.isDev) {
|
|
11299
|
-
|
|
11078
|
+
logger9.warn("Operation failed", {
|
|
11079
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11080
|
+
});
|
|
11300
11081
|
}
|
|
11301
11082
|
}
|
|
11302
11083
|
}
|
|
@@ -11389,6 +11170,7 @@ var DebuggerQueueManager = class _DebuggerQueueManager {
|
|
|
11389
11170
|
}
|
|
11390
11171
|
};
|
|
11391
11172
|
var MAX_RETRY_ATTEMPTS = 3;
|
|
11173
|
+
var logger10 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.OPERATION_TRACKER, transport: "console" });
|
|
11392
11174
|
var OperationTracker = class _OperationTracker extends BaseOperationTracker {
|
|
11393
11175
|
static {
|
|
11394
11176
|
__name(this, "OperationTracker");
|
|
@@ -11452,7 +11234,12 @@ var OperationTracker = class _OperationTracker extends BaseOperationTracker {
|
|
|
11452
11234
|
handleProcessingError(error, operation) {
|
|
11453
11235
|
const retryCount = operation.retryCount ?? 0;
|
|
11454
11236
|
if (operation.category === "debugging" && retryCount < MAX_RETRY_ATTEMPTS) {
|
|
11455
|
-
|
|
11237
|
+
logger10.warn("Retrying critical operation", {
|
|
11238
|
+
attempt: retryCount + 1,
|
|
11239
|
+
maxAttempts: MAX_RETRY_ATTEMPTS,
|
|
11240
|
+
operation: operation.operation,
|
|
11241
|
+
category: operation.category
|
|
11242
|
+
});
|
|
11456
11243
|
this.getQueue().add({
|
|
11457
11244
|
data: {
|
|
11458
11245
|
...operation,
|
|
@@ -11461,7 +11248,12 @@ var OperationTracker = class _OperationTracker extends BaseOperationTracker {
|
|
|
11461
11248
|
priority: api.PRIORITY_LEVEL.CRITICAL
|
|
11462
11249
|
});
|
|
11463
11250
|
} else {
|
|
11464
|
-
|
|
11251
|
+
logger10.error("Failed to process operation after retries", {
|
|
11252
|
+
operation: operation.operation,
|
|
11253
|
+
category: operation.category,
|
|
11254
|
+
retryCount,
|
|
11255
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11256
|
+
});
|
|
11465
11257
|
}
|
|
11466
11258
|
}
|
|
11467
11259
|
/**
|
|
@@ -11544,6 +11336,7 @@ var trackingQueue = {
|
|
|
11544
11336
|
return [];
|
|
11545
11337
|
}
|
|
11546
11338
|
};
|
|
11339
|
+
var logger11 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.PUB_SUB, transport: "console" });
|
|
11547
11340
|
var EVENT_CONSTANTS = {
|
|
11548
11341
|
/** Minimum event segments for scoped events (namespace:scope:event) */
|
|
11549
11342
|
MIN_SCOPED_SEGMENTS: 2,
|
|
@@ -11649,7 +11442,10 @@ function createEmitMethod(listeners, trackOperation) {
|
|
|
11649
11442
|
try {
|
|
11650
11443
|
callback(data);
|
|
11651
11444
|
} catch (error) {
|
|
11652
|
-
|
|
11445
|
+
logger11.error("Event listener failed", {
|
|
11446
|
+
event,
|
|
11447
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11448
|
+
});
|
|
11653
11449
|
}
|
|
11654
11450
|
});
|
|
11655
11451
|
listeners.forEach((callbacks, pattern) => {
|
|
@@ -11662,7 +11458,11 @@ function createEmitMethod(listeners, trackOperation) {
|
|
|
11662
11458
|
const wildcardData = typeof data === "object" && data !== null ? { ...data, originalEvent: event.split(":").pop() } : { data, originalEvent: event.split(":").pop() };
|
|
11663
11459
|
callback(wildcardData);
|
|
11664
11460
|
} catch (error) {
|
|
11665
|
-
|
|
11461
|
+
logger11.error("Wildcard listener failed", {
|
|
11462
|
+
event,
|
|
11463
|
+
pattern: prefix,
|
|
11464
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11465
|
+
});
|
|
11666
11466
|
}
|
|
11667
11467
|
});
|
|
11668
11468
|
}
|
|
@@ -11674,7 +11474,10 @@ function createEmitMethod(listeners, trackOperation) {
|
|
|
11674
11474
|
try {
|
|
11675
11475
|
callback(data);
|
|
11676
11476
|
} catch (error) {
|
|
11677
|
-
|
|
11477
|
+
logger11.error("Global wildcard listener failed", {
|
|
11478
|
+
event,
|
|
11479
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11480
|
+
});
|
|
11678
11481
|
}
|
|
11679
11482
|
});
|
|
11680
11483
|
}
|
|
@@ -11839,7 +11642,9 @@ function createEventEmitter() {
|
|
|
11839
11642
|
result = handlerResult;
|
|
11840
11643
|
}
|
|
11841
11644
|
} catch (error) {
|
|
11842
|
-
|
|
11645
|
+
logger11.warn("Handler in chain failed", {
|
|
11646
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11647
|
+
});
|
|
11843
11648
|
}
|
|
11844
11649
|
}
|
|
11845
11650
|
return result;
|
|
@@ -11909,858 +11714,239 @@ var EventHelpers = {
|
|
|
11909
11714
|
return namespace ? [`${namespace}:*`] : [];
|
|
11910
11715
|
}, "getMatchingWildcards")
|
|
11911
11716
|
};
|
|
11717
|
+
var API_ERROR_NAMESPACE = "api";
|
|
11718
|
+
var DEFAULT_TIMEOUT_MS2 = 3e4;
|
|
11912
11719
|
var DEFAULT_SERVER_ERROR_STATUS2 = 500;
|
|
11913
|
-
var
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11720
|
+
var SCOPE_MAP = {
|
|
11721
|
+
GLOBAL: "global",
|
|
11722
|
+
CONFIG: "config",
|
|
11723
|
+
CLIENT: "client",
|
|
11724
|
+
REQUEST: "request",
|
|
11725
|
+
TEMPORARY: "temporary"
|
|
11726
|
+
};
|
|
11727
|
+
function convertToApiEventScope(scope) {
|
|
11728
|
+
const mapped = SCOPE_MAP[scope];
|
|
11729
|
+
if (!mapped) {
|
|
11730
|
+
throw new Error(`Invalid EventScope: ${scope}`);
|
|
11922
11731
|
}
|
|
11923
|
-
return
|
|
11924
|
-
}
|
|
11925
|
-
__name(mapHandlerNameToEventName, "mapHandlerNameToEventName");
|
|
11926
|
-
function registerScopedHandlers(scope, handlers, options = {}) {
|
|
11927
|
-
Object.entries(handlers).forEach(([handlerName, handler]) => {
|
|
11928
|
-
if (handler) {
|
|
11929
|
-
const eventName = mapHandlerNameToEventName(handlerName);
|
|
11930
|
-
const wrappedHandler = /* @__PURE__ */ __name((event) => {
|
|
11931
|
-
const error = event?.data?.error ?? event;
|
|
11932
|
-
try {
|
|
11933
|
-
handler(error);
|
|
11934
|
-
} catch (err) {
|
|
11935
|
-
console.error("Error in error handler:", err);
|
|
11936
|
-
}
|
|
11937
|
-
}, "wrappedHandler");
|
|
11938
|
-
eventManager.errors.addScopedHandler(api.HANDLER_SCOPES[scope], eventName, wrappedHandler, {
|
|
11939
|
-
...options,
|
|
11940
|
-
originalHandler: handler
|
|
11941
|
-
});
|
|
11942
|
-
}
|
|
11943
|
-
});
|
|
11732
|
+
return mapped;
|
|
11944
11733
|
}
|
|
11945
|
-
__name(
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11734
|
+
__name(convertToApiEventScope, "convertToApiEventScope");
|
|
11735
|
+
var ApiPackageError = class extends errors$1.ApiPackageError {
|
|
11736
|
+
static {
|
|
11737
|
+
__name(this, "ApiPackageError");
|
|
11738
|
+
}
|
|
11739
|
+
};
|
|
11740
|
+
var apiErrorEventFactory = {
|
|
11741
|
+
addScopedHandler(scope, eventName, handler, options) {
|
|
11742
|
+
const eventScope = convertToApiEventScope(scope);
|
|
11743
|
+
eventManager.errors.addScopedHandler(eventScope, eventName, handler, options);
|
|
11744
|
+
},
|
|
11745
|
+
removeScopedHandler(scope, eventName, handler) {
|
|
11746
|
+
const apiScope = convertToApiEventScope(scope);
|
|
11747
|
+
if (!handler) {
|
|
11748
|
+
eventManager.errors.removeAllScopedListeners(apiScope, eventName);
|
|
11954
11749
|
} else {
|
|
11955
|
-
|
|
11956
|
-
handlerName = `on${camelCase.charAt(0).toUpperCase() + camelCase.slice(1)}Error`;
|
|
11750
|
+
eventManager.errors.removeScopedHandler(apiScope, eventName, handler);
|
|
11957
11751
|
}
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11752
|
+
},
|
|
11753
|
+
getOriginalScopedHandlers(scope) {
|
|
11754
|
+
const eventScope = convertToApiEventScope(scope);
|
|
11755
|
+
return eventManager.errors.getOriginalScopedHandlers(eventScope);
|
|
11756
|
+
},
|
|
11757
|
+
emit(eventName, data, options) {
|
|
11758
|
+
if (options?.scopes && options.scopes.length > 0) {
|
|
11759
|
+
options.scopes.forEach((scope) => {
|
|
11760
|
+
const apiScope = convertToApiEventScope(scope);
|
|
11761
|
+
const scopedEventKey = `${apiScope}:errors:${eventName}`;
|
|
11762
|
+
eventManager.errors.emit(scopedEventKey, data);
|
|
11763
|
+
});
|
|
11764
|
+
} else {
|
|
11765
|
+
eventManager.errors.emit(eventName, data);
|
|
11961
11766
|
}
|
|
11767
|
+
}
|
|
11768
|
+
};
|
|
11769
|
+
var isApiNamespaceRegistered = false;
|
|
11770
|
+
function ensureApiNamespaceRegistered() {
|
|
11771
|
+
if (isApiNamespaceRegistered) {
|
|
11772
|
+
return;
|
|
11773
|
+
}
|
|
11774
|
+
errors$1.registerEventFactory(API_ERROR_NAMESPACE, apiErrorEventFactory);
|
|
11775
|
+
errors$1.ApiPackageError.configure({
|
|
11776
|
+
namespace: API_ERROR_NAMESPACE,
|
|
11777
|
+
eventFactory: apiErrorEventFactory
|
|
11962
11778
|
});
|
|
11963
|
-
|
|
11779
|
+
isApiNamespaceRegistered = true;
|
|
11964
11780
|
}
|
|
11965
|
-
__name(
|
|
11781
|
+
__name(ensureApiNamespaceRegistered, "ensureApiNamespaceRegistered");
|
|
11782
|
+
ensureApiNamespaceRegistered();
|
|
11966
11783
|
function registerErrorHandler(eventType, handler, options = {}) {
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
try {
|
|
11972
|
-
handler(error);
|
|
11973
|
-
} catch (err) {
|
|
11974
|
-
console.error("Error in error handler:", err);
|
|
11975
|
-
}
|
|
11976
|
-
}, "wrappedHandler");
|
|
11977
|
-
return eventManager.errors.addScopedHandler(
|
|
11978
|
-
api.HANDLER_SCOPES[scope],
|
|
11979
|
-
type,
|
|
11980
|
-
wrappedHandler,
|
|
11981
|
-
{ strategy, originalHandler: handler }
|
|
11982
|
-
);
|
|
11784
|
+
return errors$1.registerErrorHandler(API_ERROR_NAMESPACE, eventType, handler, {
|
|
11785
|
+
...options,
|
|
11786
|
+
eventFactory: apiErrorEventFactory
|
|
11787
|
+
});
|
|
11983
11788
|
}
|
|
11984
11789
|
__name(registerErrorHandler, "registerErrorHandler");
|
|
11790
|
+
function registerErrorHandlers(handlers, options = {}) {
|
|
11791
|
+
const { scope = "GLOBAL", ...rest } = options;
|
|
11792
|
+
errors$1.registerScopedHandlers(API_ERROR_NAMESPACE, scope, handlers, {
|
|
11793
|
+
...rest,
|
|
11794
|
+
eventFactory: apiErrorEventFactory
|
|
11795
|
+
});
|
|
11796
|
+
}
|
|
11797
|
+
__name(registerErrorHandlers, "registerErrorHandlers");
|
|
11985
11798
|
function setErrorHandlers(handlers, scope = "GLOBAL") {
|
|
11986
|
-
|
|
11799
|
+
errors$1.setErrorHandlers(API_ERROR_NAMESPACE, handlers, scope, apiErrorEventFactory);
|
|
11987
11800
|
}
|
|
11988
11801
|
__name(setErrorHandlers, "setErrorHandlers");
|
|
11989
11802
|
function getErrorHandlers(scope = "GLOBAL") {
|
|
11990
|
-
return
|
|
11803
|
+
return errors$1.getErrorHandlers(API_ERROR_NAMESPACE, scope, apiErrorEventFactory);
|
|
11991
11804
|
}
|
|
11992
11805
|
__name(getErrorHandlers, "getErrorHandlers");
|
|
11993
|
-
function registerErrorHandlers(handlers, options = {}) {
|
|
11994
|
-
const { scope = "GLOBAL", strategy = "merge" } = options;
|
|
11995
|
-
registerScopedHandlers(scope, handlers, { strategy });
|
|
11996
|
-
}
|
|
11997
|
-
__name(registerErrorHandlers, "registerErrorHandlers");
|
|
11998
11806
|
function unregisterErrorHandlers(eventTypes, options = {}) {
|
|
11999
11807
|
const { scope = "GLOBAL" } = options;
|
|
12000
|
-
|
|
12001
|
-
if (!eventTypes) {
|
|
12002
|
-
eventManager.errors.clearScopedHandlers(scopeKey);
|
|
12003
|
-
} else {
|
|
12004
|
-
eventTypes.forEach((eventType) => {
|
|
12005
|
-
const type = typeof eventType === "string" && eventType.startsWith("errors:") ? getErrorEventType(eventType) : eventType;
|
|
12006
|
-
eventManager.errors.removeAllScopedListeners(scopeKey, type);
|
|
12007
|
-
});
|
|
12008
|
-
}
|
|
11808
|
+
errors$1.unregisterScopedHandlers(API_ERROR_NAMESPACE, scope, eventTypes, apiErrorEventFactory);
|
|
12009
11809
|
}
|
|
12010
11810
|
__name(unregisterErrorHandlers, "unregisterErrorHandlers");
|
|
12011
11811
|
function clearErrorHandlers(options = {}) {
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
eventManager.errors.clearScopedHandlers(scopeKey);
|
|
11812
|
+
errors$1.clearErrorHandlers(API_ERROR_NAMESPACE, {
|
|
11813
|
+
...options,
|
|
11814
|
+
eventFactory: apiErrorEventFactory
|
|
12016
11815
|
});
|
|
12017
11816
|
}
|
|
12018
11817
|
__name(clearErrorHandlers, "clearErrorHandlers");
|
|
12019
11818
|
function onceErrorHandler(eventType, handler, options = {}) {
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
const eventData = event;
|
|
12024
|
-
const error = eventData?.data?.error ?? event;
|
|
12025
|
-
handler(error);
|
|
11819
|
+
errors$1.registerOnceErrorHandler(API_ERROR_NAMESPACE, eventType, handler, {
|
|
11820
|
+
...options,
|
|
11821
|
+
eventFactory: apiErrorEventFactory
|
|
12026
11822
|
});
|
|
12027
11823
|
}
|
|
12028
11824
|
__name(onceErrorHandler, "onceErrorHandler");
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
});
|
|
12038
|
-
}, "network"),
|
|
12039
|
-
validation: /* @__PURE__ */ __name((error) => {
|
|
12040
|
-
eventManager.errors.emitValidationError({
|
|
12041
|
-
error,
|
|
12042
|
-
field: error.context?.field,
|
|
12043
|
-
value: error.context?.value,
|
|
12044
|
-
constraints: error.context?.constraints
|
|
12045
|
-
});
|
|
12046
|
-
}, "validation"),
|
|
12047
|
-
authentication: /* @__PURE__ */ __name((error) => {
|
|
12048
|
-
eventManager.errors.emitAuthenticationError(
|
|
12049
|
-
error,
|
|
12050
|
-
error.context?.realm,
|
|
12051
|
-
error.context?.scheme
|
|
12052
|
-
);
|
|
12053
|
-
}, "authentication"),
|
|
12054
|
-
rateLimit: /* @__PURE__ */ __name((error) => {
|
|
12055
|
-
eventManager.errors.emitRateLimitError({
|
|
12056
|
-
error,
|
|
12057
|
-
limit: error.context?.limit,
|
|
12058
|
-
remaining: error.context?.remaining,
|
|
12059
|
-
resetAt: error.context?.resetAt,
|
|
12060
|
-
retryAfter: error.context?.retryAfter
|
|
12061
|
-
});
|
|
12062
|
-
}, "rateLimit"),
|
|
12063
|
-
server: /* @__PURE__ */ __name((error) => {
|
|
12064
|
-
eventManager.errors.emitServerError({
|
|
12065
|
-
error,
|
|
12066
|
-
statusCode: error.statusCode ?? DEFAULT_SERVER_ERROR_STATUS2,
|
|
12067
|
-
serverMessage: error.context?.serverMessage,
|
|
12068
|
-
traceId: error.context?.traceId
|
|
12069
|
-
});
|
|
12070
|
-
}, "server"),
|
|
12071
|
-
timeout: /* @__PURE__ */ __name((error) => {
|
|
12072
|
-
eventManager.errors.emitTimeoutError({
|
|
12073
|
-
error,
|
|
12074
|
-
timeout: error.context?.timeoutMs || error.context?.timeout || 0,
|
|
12075
|
-
operation: error.context?.operation,
|
|
12076
|
-
url: error.context?.url
|
|
12077
|
-
});
|
|
12078
|
-
}, "timeout"),
|
|
12079
|
-
authorization: /* @__PURE__ */ __name((error) => {
|
|
12080
|
-
eventManager.errors.emitAuthorizationError({
|
|
12081
|
-
error,
|
|
12082
|
-
url: error.context?.url,
|
|
12083
|
-
method: error.context?.method,
|
|
12084
|
-
resource: void 0,
|
|
12085
|
-
permission: void 0
|
|
12086
|
-
});
|
|
12087
|
-
}, "authorization"),
|
|
12088
|
-
notFound: /* @__PURE__ */ __name((error) => {
|
|
12089
|
-
eventManager.errors.emitNotFoundError(error, error.context?.url, void 0);
|
|
12090
|
-
}, "notFound"),
|
|
12091
|
-
conflict: /* @__PURE__ */ __name((error) => {
|
|
12092
|
-
eventManager.errors.emitConflictError({
|
|
12093
|
-
error,
|
|
12094
|
-
conflictingResource: void 0,
|
|
12095
|
-
currentValue: void 0,
|
|
12096
|
-
attemptedValue: void 0
|
|
12097
|
-
});
|
|
12098
|
-
}, "conflict"),
|
|
12099
|
-
client: /* @__PURE__ */ __name((error) => {
|
|
12100
|
-
eventManager.errors.emitClientError({
|
|
12101
|
-
error,
|
|
12102
|
-
status: error.statusCode ?? DEFAULT_CLIENT_ERROR_STATUS,
|
|
12103
|
-
url: error.context?.url,
|
|
12104
|
-
method: error.context?.method
|
|
12105
|
-
});
|
|
12106
|
-
}, "client"),
|
|
12107
|
-
externalService: /* @__PURE__ */ __name((error) => {
|
|
12108
|
-
eventManager.errors.emitExternalServiceError({
|
|
12109
|
-
error,
|
|
12110
|
-
service: void 0,
|
|
12111
|
-
endpoint: error.context?.url,
|
|
12112
|
-
timeout: error.context?.timeout
|
|
12113
|
-
});
|
|
12114
|
-
}, "externalService"),
|
|
12115
|
-
cache: /* @__PURE__ */ __name((error) => {
|
|
12116
|
-
eventManager.errors.emitCacheError(
|
|
12117
|
-
error,
|
|
12118
|
-
error.context?.operation,
|
|
12119
|
-
error.context && "cacheKey" in error.context ? error.context.cacheKey : "unknown"
|
|
12120
|
-
);
|
|
12121
|
-
}, "cache"),
|
|
12122
|
-
headers: /* @__PURE__ */ __name((error) => {
|
|
12123
|
-
eventManager.errors.emitHeadersError(error, void 0, error.context?.operation);
|
|
12124
|
-
}, "headers"),
|
|
12125
|
-
retry: /* @__PURE__ */ __name((error) => {
|
|
12126
|
-
eventManager.errors.emitRetryError({
|
|
12127
|
-
error,
|
|
12128
|
-
attempts: void 0,
|
|
12129
|
-
maxAttempts: void 0,
|
|
12130
|
-
lastError: error.context?.originalError
|
|
12131
|
-
});
|
|
12132
|
-
}, "retry")
|
|
12133
|
-
};
|
|
12134
|
-
function getCategoryKey(category) {
|
|
12135
|
-
if (!category) {
|
|
12136
|
-
return "unknown";
|
|
12137
|
-
}
|
|
12138
|
-
return api.ERROR_CATEGORY_TO_EMITTER_KEY[category] || category.toLowerCase();
|
|
12139
|
-
}
|
|
12140
|
-
__name(getCategoryKey, "getCategoryKey");
|
|
12141
|
-
async function emitErrorEvent(error) {
|
|
12142
|
-
const categoryKey = getCategoryKey(error.category);
|
|
12143
|
-
const emitter = ERROR_EMITTERS[categoryKey];
|
|
12144
|
-
if (emitter) {
|
|
12145
|
-
emitter(error);
|
|
12146
|
-
} else {
|
|
12147
|
-
eventManager.errors.emitGenericError(error);
|
|
12148
|
-
}
|
|
12149
|
-
}
|
|
12150
|
-
__name(emitErrorEvent, "emitErrorEvent");
|
|
12151
|
-
|
|
12152
|
-
// src/api/utils/generation/id-generator.ts
|
|
12153
|
-
var ID_CONSTANTS = {
|
|
12154
|
-
RANDOM_START_INDEX: 2,
|
|
12155
|
-
DEFAULT_RANDOM_LENGTH: 8,
|
|
12156
|
-
MAX_PREFIX_LENGTH: 10,
|
|
12157
|
-
DEFAULT_RADIX: 36,
|
|
12158
|
-
TWO_PARTS: 2
|
|
12159
|
-
};
|
|
12160
|
-
var DEFAULT_OPTIONS = {
|
|
12161
|
-
prefix: "",
|
|
12162
|
-
suffix: "",
|
|
12163
|
-
useTimestamp: false,
|
|
12164
|
-
separator: "_",
|
|
12165
|
-
includeRandom: true,
|
|
12166
|
-
radix: ID_CONSTANTS.DEFAULT_RADIX,
|
|
12167
|
-
randomLength: ID_CONSTANTS.DEFAULT_RANDOM_LENGTH
|
|
12168
|
-
};
|
|
12169
|
-
function generateBaseId(options = {}) {
|
|
12170
|
-
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
12171
|
-
const components = [];
|
|
12172
|
-
if (opts.prefix) {
|
|
12173
|
-
components.push(opts.prefix);
|
|
12174
|
-
}
|
|
12175
|
-
if (opts.useTimestamp) {
|
|
12176
|
-
const timestamp = Date.now().toString(opts.radix);
|
|
12177
|
-
components.push(timestamp);
|
|
12178
|
-
if (opts.includeRandom) {
|
|
12179
|
-
const random = Math.random().toString(opts.radix).slice(
|
|
12180
|
-
ID_CONSTANTS.RANDOM_START_INDEX,
|
|
12181
|
-
ID_CONSTANTS.RANDOM_START_INDEX + opts.randomLength
|
|
12182
|
-
);
|
|
12183
|
-
components.push(random);
|
|
12184
|
-
}
|
|
12185
|
-
} else {
|
|
12186
|
-
components.push(generateUUID());
|
|
12187
|
-
}
|
|
12188
|
-
if (opts.suffix) {
|
|
12189
|
-
components.push(opts.suffix);
|
|
12190
|
-
}
|
|
12191
|
-
return components.join(opts.separator);
|
|
12192
|
-
}
|
|
12193
|
-
__name(generateBaseId, "generateBaseId");
|
|
12194
|
-
function generateContextualId(context, options = {}) {
|
|
12195
|
-
const baseId = generateBaseId(options);
|
|
12196
|
-
const contextParts = [];
|
|
12197
|
-
for (const [, value] of Object.entries(context)) {
|
|
12198
|
-
if (value !== void 0) {
|
|
12199
|
-
contextParts.push(String(value));
|
|
12200
|
-
}
|
|
12201
|
-
}
|
|
12202
|
-
if (contextParts.length > 0) {
|
|
12203
|
-
return `${contextParts.join(":")}:${baseId}`;
|
|
12204
|
-
}
|
|
12205
|
-
return baseId;
|
|
12206
|
-
}
|
|
12207
|
-
__name(generateContextualId, "generateContextualId");
|
|
12208
|
-
function extractFromLastSeparator(id, separator) {
|
|
12209
|
-
const lastIndex = id.lastIndexOf(separator);
|
|
12210
|
-
return lastIndex !== -1 ? id.substring(lastIndex + 1) : null;
|
|
12211
|
-
}
|
|
12212
|
-
__name(extractFromLastSeparator, "extractFromLastSeparator");
|
|
12213
|
-
function extractFromFirstSeparator(id, separator) {
|
|
12214
|
-
const firstIndex = id.indexOf(separator);
|
|
12215
|
-
return firstIndex !== -1 ? id.substring(0, firstIndex) : null;
|
|
12216
|
-
}
|
|
12217
|
-
__name(extractFromFirstSeparator, "extractFromFirstSeparator");
|
|
12218
|
-
function extractAfterPrefix(id, separator) {
|
|
12219
|
-
const firstIndex = id.indexOf(separator);
|
|
12220
|
-
if (firstIndex === -1 || separator !== "_") {
|
|
12221
|
-
return null;
|
|
12222
|
-
}
|
|
12223
|
-
const prefix = id.substring(0, firstIndex);
|
|
12224
|
-
const isShortAlphabeticPrefix = prefix.length <= ID_CONSTANTS.MAX_PREFIX_LENGTH && /^[a-z]+$/i.test(prefix);
|
|
12225
|
-
return isShortAlphabeticPrefix ? id.substring(firstIndex + 1) : null;
|
|
12226
|
-
}
|
|
12227
|
-
__name(extractAfterPrefix, "extractAfterPrefix");
|
|
12228
|
-
function extractWithUnderscoreSeparator(id, separator) {
|
|
12229
|
-
const afterPrefix = extractAfterPrefix(id, separator);
|
|
12230
|
-
if (afterPrefix) {
|
|
12231
|
-
return afterPrefix;
|
|
12232
|
-
}
|
|
12233
|
-
return extractFromLastSeparator(id, separator);
|
|
11825
|
+
function emitNetworkErrorEvent(error, context) {
|
|
11826
|
+
eventManager.errors.emitNetworkError({
|
|
11827
|
+
error,
|
|
11828
|
+
url: context?.url,
|
|
11829
|
+
method: context?.method,
|
|
11830
|
+
status: error.statusCode,
|
|
11831
|
+
retryable: error.retryable
|
|
11832
|
+
});
|
|
12234
11833
|
}
|
|
12235
|
-
__name(
|
|
12236
|
-
function
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
11834
|
+
__name(emitNetworkErrorEvent, "emitNetworkErrorEvent");
|
|
11835
|
+
function emitTimeoutErrorEvent(error, context) {
|
|
11836
|
+
eventManager.errors.emitTimeoutError({
|
|
11837
|
+
error,
|
|
11838
|
+
timeout: context?.timeout ?? context?.timeoutMs ?? DEFAULT_TIMEOUT_MS2,
|
|
11839
|
+
url: context?.url,
|
|
11840
|
+
operation: context?.operation
|
|
11841
|
+
});
|
|
12241
11842
|
}
|
|
12242
|
-
__name(
|
|
12243
|
-
function
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
11843
|
+
__name(emitTimeoutErrorEvent, "emitTimeoutErrorEvent");
|
|
11844
|
+
function emitServerErrorEvent(error, context) {
|
|
11845
|
+
eventManager.errors.emitServerError({
|
|
11846
|
+
error,
|
|
11847
|
+
statusCode: error.statusCode ?? DEFAULT_SERVER_ERROR_STATUS2,
|
|
11848
|
+
serverMessage: context?.serverMessage,
|
|
11849
|
+
traceId: context?.traceId
|
|
11850
|
+
});
|
|
12249
11851
|
}
|
|
12250
|
-
__name(
|
|
12251
|
-
function
|
|
12252
|
-
|
|
12253
|
-
|
|
11852
|
+
__name(emitServerErrorEvent, "emitServerErrorEvent");
|
|
11853
|
+
function emitAuthorizationErrorEvent(error, context) {
|
|
11854
|
+
eventManager.errors.emitAuthorizationError({
|
|
11855
|
+
error,
|
|
11856
|
+
url: context?.url,
|
|
11857
|
+
method: context?.method,
|
|
11858
|
+
resource: context?.resource,
|
|
11859
|
+
permission: context?.permission
|
|
11860
|
+
});
|
|
12254
11861
|
}
|
|
12255
|
-
__name(
|
|
12256
|
-
function
|
|
12257
|
-
|
|
12258
|
-
|
|
11862
|
+
__name(emitAuthorizationErrorEvent, "emitAuthorizationErrorEvent");
|
|
11863
|
+
function emitRateLimitErrorEvent(error, context) {
|
|
11864
|
+
eventManager.errors.emitRateLimitError({
|
|
11865
|
+
error,
|
|
11866
|
+
limit: context?.limit,
|
|
11867
|
+
remaining: context?.remaining,
|
|
11868
|
+
resetAt: context?.resetAt,
|
|
11869
|
+
retryAfter: context?.retryAfter
|
|
11870
|
+
});
|
|
12259
11871
|
}
|
|
12260
|
-
__name(
|
|
12261
|
-
function
|
|
12262
|
-
|
|
12263
|
-
|
|
11872
|
+
__name(emitRateLimitErrorEvent, "emitRateLimitErrorEvent");
|
|
11873
|
+
function emitValidationErrorEvent(error) {
|
|
11874
|
+
eventManager.errors.emitValidationError({
|
|
11875
|
+
error,
|
|
11876
|
+
field: void 0,
|
|
11877
|
+
value: void 0,
|
|
11878
|
+
constraints: void 0
|
|
11879
|
+
});
|
|
12264
11880
|
}
|
|
12265
|
-
__name(
|
|
12266
|
-
function
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
return !rejectList.includes(id);
|
|
11881
|
+
__name(emitValidationErrorEvent, "emitValidationErrorEvent");
|
|
11882
|
+
function emitAuthenticationErrorEvent(error, context) {
|
|
11883
|
+
eventManager.errors.emitAuthenticationError(
|
|
11884
|
+
error,
|
|
11885
|
+
context?.realm,
|
|
11886
|
+
context?.scheme
|
|
11887
|
+
);
|
|
12273
11888
|
}
|
|
12274
|
-
__name(
|
|
12275
|
-
function
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
11889
|
+
__name(emitAuthenticationErrorEvent, "emitAuthenticationErrorEvent");
|
|
11890
|
+
function emitNotFoundErrorEvent(error, context) {
|
|
11891
|
+
eventManager.errors.emitNotFoundError(error, context?.url);
|
|
11892
|
+
}
|
|
11893
|
+
__name(emitNotFoundErrorEvent, "emitNotFoundErrorEvent");
|
|
11894
|
+
var ERROR_CATEGORY_HANDLERS = {
|
|
11895
|
+
network: emitNetworkErrorEvent,
|
|
11896
|
+
validation: emitValidationErrorEvent,
|
|
11897
|
+
authentication: emitAuthenticationErrorEvent,
|
|
11898
|
+
authorization: emitAuthorizationErrorEvent,
|
|
11899
|
+
"rate.limit": emitRateLimitErrorEvent,
|
|
11900
|
+
timeout: emitTimeoutErrorEvent,
|
|
11901
|
+
"not.found": emitNotFoundErrorEvent,
|
|
11902
|
+
server: emitServerErrorEvent
|
|
11903
|
+
};
|
|
11904
|
+
function emitErrorEvent(error) {
|
|
11905
|
+
const context = error.context;
|
|
11906
|
+
const category = error.category?.toLowerCase();
|
|
11907
|
+
const handler = category ? ERROR_CATEGORY_HANDLERS[category] : void 0;
|
|
11908
|
+
if (handler) {
|
|
11909
|
+
handler(error, context);
|
|
11910
|
+
} else {
|
|
11911
|
+
eventManager.errors.emitGenericError(error);
|
|
12280
11912
|
}
|
|
12281
|
-
return null;
|
|
12282
|
-
}
|
|
12283
|
-
__name(checkPatterns, "checkPatterns");
|
|
12284
|
-
function isAnyPatternAllowed(options) {
|
|
12285
|
-
return !!(options.allowUuid ?? options.allowTimestamp ?? options.allowPrefix);
|
|
12286
|
-
}
|
|
12287
|
-
__name(isAnyPatternAllowed, "isAnyPatternAllowed");
|
|
12288
|
-
function checkIdPatterns(id, options) {
|
|
12289
|
-
const patterns = [
|
|
12290
|
-
{ check: isUuidPattern, allowed: options.allowUuid },
|
|
12291
|
-
{ check: isTimestampPattern, allowed: options.allowTimestamp },
|
|
12292
|
-
{ check: isPrefixedPattern, allowed: options.allowPrefix }
|
|
12293
|
-
];
|
|
12294
|
-
return checkPatterns(id, patterns);
|
|
12295
11913
|
}
|
|
12296
|
-
__name(
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
}
|
|
12302
|
-
return isAnyPatternAllowed(options) && isValidFallbackPattern(id);
|
|
11914
|
+
__name(emitErrorEvent, "emitErrorEvent");
|
|
11915
|
+
|
|
11916
|
+
// src/api/polling/utils.ts
|
|
11917
|
+
function isPollingActive(config) {
|
|
11918
|
+
return (config.interval ?? 0) > 0;
|
|
12303
11919
|
}
|
|
12304
|
-
__name(
|
|
12305
|
-
function
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
return false;
|
|
11920
|
+
__name(isPollingActive, "isPollingActive");
|
|
11921
|
+
function calculatePollingDuration(config) {
|
|
11922
|
+
if (!config.interval || !config.maxAttempts || config.maxAttempts <= 0) {
|
|
11923
|
+
return null;
|
|
12309
11924
|
}
|
|
12310
|
-
|
|
11925
|
+
const intervals = config.interval * config.maxAttempts;
|
|
11926
|
+
const delays = (config.delay ?? 0) * config.maxAttempts;
|
|
11927
|
+
return intervals + delays;
|
|
12311
11928
|
}
|
|
12312
|
-
__name(
|
|
12313
|
-
function
|
|
12314
|
-
|
|
12315
|
-
if (id.includes(":")) {
|
|
12316
|
-
const lastColonIndex = id.lastIndexOf(":");
|
|
11929
|
+
__name(calculatePollingDuration, "calculatePollingDuration");
|
|
11930
|
+
function getSSRSafePollingConfig(config) {
|
|
11931
|
+
if (!isBrowser()) {
|
|
12317
11932
|
return {
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
11933
|
+
...config,
|
|
11934
|
+
interval: 0,
|
|
11935
|
+
maxAttempts: 1
|
|
12321
11936
|
};
|
|
12322
11937
|
}
|
|
12323
|
-
|
|
12324
|
-
if (parts.length === 1) {
|
|
12325
|
-
return { core: id, full: id };
|
|
12326
|
-
}
|
|
12327
|
-
if (parts.length === ID_CONSTANTS.TWO_PARTS) {
|
|
12328
|
-
if (parts[0].length <= ID_CONSTANTS.MAX_PREFIX_LENGTH && /^[a-z]+$/i.test(parts[0])) {
|
|
12329
|
-
return { prefix: parts[0], core: parts[1], full: id };
|
|
12330
|
-
}
|
|
12331
|
-
return { core: parts[0], suffix: parts[1], full: id };
|
|
12332
|
-
}
|
|
12333
|
-
return {
|
|
12334
|
-
prefix: parts[0],
|
|
12335
|
-
core: parts.slice(1, -1).join(separator),
|
|
12336
|
-
suffix: parts[parts.length - 1],
|
|
12337
|
-
full: id
|
|
12338
|
-
};
|
|
11938
|
+
return config;
|
|
12339
11939
|
}
|
|
12340
|
-
__name(
|
|
12341
|
-
function
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
correlationGenerators.set(
|
|
12351
|
-
type,
|
|
12352
|
-
createIdGenerator({
|
|
12353
|
-
prefix: type,
|
|
12354
|
-
useTimestamp: true,
|
|
12355
|
-
includeRandom: true,
|
|
12356
|
-
radix: 36,
|
|
12357
|
-
randomLength: 8
|
|
12358
|
-
})
|
|
12359
|
-
);
|
|
12360
|
-
}
|
|
12361
|
-
return correlationGenerators.get(type);
|
|
12362
|
-
}
|
|
12363
|
-
__name(getCorrelationGenerator, "getCorrelationGenerator");
|
|
12364
|
-
function generateCorrelationId(type = api.CORRELATION_TYPE.GENERIC, options) {
|
|
12365
|
-
const generator = getCorrelationGenerator(type);
|
|
12366
|
-
return generator(options);
|
|
12367
|
-
}
|
|
12368
|
-
__name(generateCorrelationId, "generateCorrelationId");
|
|
12369
|
-
function generateContextualCorrelationId(context, type = api.CORRELATION_TYPE.GENERIC, options) {
|
|
12370
|
-
return generateContextualId(context, {
|
|
12371
|
-
prefix: type,
|
|
12372
|
-
useTimestamp: true,
|
|
12373
|
-
includeRandom: true,
|
|
12374
|
-
radix: 36,
|
|
12375
|
-
randomLength: 8,
|
|
12376
|
-
...options
|
|
12377
|
-
});
|
|
12378
|
-
}
|
|
12379
|
-
__name(generateContextualCorrelationId, "generateContextualCorrelationId");
|
|
12380
|
-
function generateNetworkCorrelationId(options) {
|
|
12381
|
-
return generateCorrelationId(api.CORRELATION_TYPE.NETWORK, options);
|
|
12382
|
-
}
|
|
12383
|
-
__name(generateNetworkCorrelationId, "generateNetworkCorrelationId");
|
|
12384
|
-
function generateApiCorrelationId(options) {
|
|
12385
|
-
return generateCorrelationId(api.CORRELATION_TYPE.API, options);
|
|
12386
|
-
}
|
|
12387
|
-
__name(generateApiCorrelationId, "generateApiCorrelationId");
|
|
12388
|
-
function generateSessionCorrelationId(options) {
|
|
12389
|
-
return generateCorrelationId(api.CORRELATION_TYPE.SESSION, options);
|
|
12390
|
-
}
|
|
12391
|
-
__name(generateSessionCorrelationId, "generateSessionCorrelationId");
|
|
12392
|
-
function generateTraceCorrelationId(options) {
|
|
12393
|
-
return generateCorrelationId(api.CORRELATION_TYPE.TRACE, options);
|
|
12394
|
-
}
|
|
12395
|
-
__name(generateTraceCorrelationId, "generateTraceCorrelationId");
|
|
12396
|
-
function extractBaseCorrelationId(contextualId) {
|
|
12397
|
-
let id = extractBaseId(contextualId, { separator: ":", extractLast: true });
|
|
12398
|
-
const prefixes = Object.values(api.CORRELATION_TYPE);
|
|
12399
|
-
for (const prefix of prefixes) {
|
|
12400
|
-
if (id.startsWith(`${prefix}_`)) {
|
|
12401
|
-
id = id.substring(prefix.length + 1);
|
|
12402
|
-
break;
|
|
12403
|
-
}
|
|
12404
|
-
}
|
|
12405
|
-
return id;
|
|
12406
|
-
}
|
|
12407
|
-
__name(extractBaseCorrelationId, "extractBaseCorrelationId");
|
|
12408
|
-
function extractCorrelationType(id) {
|
|
12409
|
-
let idToCheck = id;
|
|
12410
|
-
if (id.includes(":")) {
|
|
12411
|
-
const parts = id.split(":");
|
|
12412
|
-
idToCheck = parts[parts.length - 1];
|
|
12413
|
-
}
|
|
12414
|
-
const parsed = parseId(idToCheck, { separator: "_" });
|
|
12415
|
-
if (parsed.prefix) {
|
|
12416
|
-
const types = Object.values(api.CORRELATION_TYPE);
|
|
12417
|
-
if (types.includes(parsed.prefix)) {
|
|
12418
|
-
return parsed.prefix;
|
|
12419
|
-
}
|
|
12420
|
-
}
|
|
12421
|
-
return void 0;
|
|
12422
|
-
}
|
|
12423
|
-
__name(extractCorrelationType, "extractCorrelationType");
|
|
12424
|
-
function isValidCorrelationId(id) {
|
|
12425
|
-
let idToValidate = id;
|
|
12426
|
-
if (id.includes(":")) {
|
|
12427
|
-
const parts = id.split(":");
|
|
12428
|
-
idToValidate = parts[parts.length - 1];
|
|
12429
|
-
}
|
|
12430
|
-
return isValidId(idToValidate, {
|
|
12431
|
-
allowUuid: true,
|
|
12432
|
-
allowTimestamp: true,
|
|
12433
|
-
allowPrefix: true,
|
|
12434
|
-
minLength: 5
|
|
12435
|
-
});
|
|
12436
|
-
}
|
|
12437
|
-
__name(isValidCorrelationId, "isValidCorrelationId");
|
|
12438
|
-
function createCorrelationIdGenerator(type = api.CORRELATION_TYPE.GENERIC, defaultOptions = {}) {
|
|
12439
|
-
return createIdGenerator({
|
|
12440
|
-
prefix: type,
|
|
12441
|
-
useTimestamp: true,
|
|
12442
|
-
includeRandom: true,
|
|
12443
|
-
radix: 36,
|
|
12444
|
-
randomLength: 8,
|
|
12445
|
-
...defaultOptions
|
|
12446
|
-
});
|
|
12447
|
-
}
|
|
12448
|
-
__name(createCorrelationIdGenerator, "createCorrelationIdGenerator");
|
|
12449
|
-
function linkCorrelationIds(...ids) {
|
|
12450
|
-
return ids.join("->");
|
|
12451
|
-
}
|
|
12452
|
-
__name(linkCorrelationIds, "linkCorrelationIds");
|
|
12453
|
-
function extractLinkedCorrelationIds(linkedId) {
|
|
12454
|
-
return linkedId.split("->");
|
|
12455
|
-
}
|
|
12456
|
-
__name(extractLinkedCorrelationIds, "extractLinkedCorrelationIds");
|
|
12457
|
-
|
|
12458
|
-
// src/api/errors/ApiPackageError.ts
|
|
12459
|
-
var ApiPackageError = class _ApiPackageError extends Error {
|
|
12460
|
-
static {
|
|
12461
|
-
__name(this, "ApiPackageError");
|
|
12462
|
-
}
|
|
12463
|
-
statusCode;
|
|
12464
|
-
errorCode;
|
|
12465
|
-
message;
|
|
12466
|
-
errors;
|
|
12467
|
-
correlationId;
|
|
12468
|
-
timestamp;
|
|
12469
|
-
// Additional properties beyond ErrorResponse
|
|
12470
|
-
responseError;
|
|
12471
|
-
category;
|
|
12472
|
-
cause;
|
|
12473
|
-
context;
|
|
12474
|
-
// Store the original request/response data from fetchff (not Web API types)
|
|
12475
|
-
requestConfig;
|
|
12476
|
-
responseData;
|
|
12477
|
-
details;
|
|
12478
|
-
originalError;
|
|
12479
|
-
metadata;
|
|
12480
|
-
/**
|
|
12481
|
-
* Getter for code property (alias for errorCode)
|
|
12482
|
-
* Provides compatibility with standard error patterns
|
|
12483
|
-
*/
|
|
12484
|
-
get code() {
|
|
12485
|
-
return this.errorCode;
|
|
12486
|
-
}
|
|
12487
|
-
constructor(message, statusCode, errorCode = api.API_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
12488
|
-
super(message);
|
|
12489
|
-
this.name = "ApiPackageError";
|
|
12490
|
-
this.message = message;
|
|
12491
|
-
this.errorCode = errorCode;
|
|
12492
|
-
this.timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
12493
|
-
this.statusCode = this.resolveStatusCode(statusCode, errorCode);
|
|
12494
|
-
if (options) {
|
|
12495
|
-
this.errors = options.errors;
|
|
12496
|
-
this.correlationId = options.correlationId ?? generateApiCorrelationId();
|
|
12497
|
-
this.responseError = options.responseError;
|
|
12498
|
-
this.cause = options.cause;
|
|
12499
|
-
this.context = options.context;
|
|
12500
|
-
this.details = options.errors;
|
|
12501
|
-
this.originalError = options.cause;
|
|
12502
|
-
if (options.responseError) {
|
|
12503
|
-
this.requestConfig = options.responseError.request;
|
|
12504
|
-
this.responseData = options.responseError.response;
|
|
12505
|
-
}
|
|
12506
|
-
} else {
|
|
12507
|
-
this.correlationId = generateApiCorrelationId();
|
|
12508
|
-
}
|
|
12509
|
-
this.category = this.categorizeError();
|
|
12510
|
-
Object.setPrototypeOf(this, _ApiPackageError.prototype);
|
|
12511
|
-
this.emitEvent();
|
|
12512
|
-
}
|
|
12513
|
-
/**
|
|
12514
|
-
* Resolves the status code from the provided value or error definitions
|
|
12515
|
-
*/
|
|
12516
|
-
resolveStatusCode(statusCode, errorCode) {
|
|
12517
|
-
if (statusCode !== void 0) {
|
|
12518
|
-
return statusCode;
|
|
12519
|
-
}
|
|
12520
|
-
const definition = api.ERROR_DEFINITIONS[errorCode];
|
|
12521
|
-
if (definition?.status !== void 0) {
|
|
12522
|
-
return definition.status;
|
|
12523
|
-
}
|
|
12524
|
-
return config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12525
|
-
}
|
|
12526
|
-
/**
|
|
12527
|
-
* Emit error event for this error
|
|
12528
|
-
* Can be called with a specific client context or uses global handlers
|
|
12529
|
-
*/
|
|
12530
|
-
emitEvent() {
|
|
12531
|
-
void Promise.resolve().then(() => emitErrorEvent(this)).catch(() => {
|
|
12532
|
-
});
|
|
12533
|
-
}
|
|
12534
|
-
/**
|
|
12535
|
-
* Creates an ApiPackageError from a fetchff ResponseError
|
|
12536
|
-
*/
|
|
12537
|
-
static fromResponseError(responseError, config$1, clientContext) {
|
|
12538
|
-
const statusCode = responseError.status ?? config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12539
|
-
const message = responseError.message ?? "An error occurred";
|
|
12540
|
-
const code = this.determineErrorCode(responseError);
|
|
12541
|
-
return new _ApiPackageError(message, statusCode, code, {
|
|
12542
|
-
responseError,
|
|
12543
|
-
cause: responseError,
|
|
12544
|
-
clientContext,
|
|
12545
|
-
context: {
|
|
12546
|
-
url: config$1?.url ?? "",
|
|
12547
|
-
method: config$1?.method ?? "GET"
|
|
12548
|
-
}
|
|
12549
|
-
});
|
|
12550
|
-
}
|
|
12551
|
-
/**
|
|
12552
|
-
* Creates an ApiPackageError from a standard Error
|
|
12553
|
-
*/
|
|
12554
|
-
static fromError(error, statusCode, errorCode = api.API_ERROR_CODES.UNKNOWN_ERROR, context) {
|
|
12555
|
-
if (error instanceof _ApiPackageError) {
|
|
12556
|
-
return error;
|
|
12557
|
-
}
|
|
12558
|
-
const { code, status } = this.classifyError(error, errorCode, statusCode);
|
|
12559
|
-
return new _ApiPackageError(error.message, status, code, {
|
|
12560
|
-
cause: error,
|
|
12561
|
-
clientContext: context
|
|
12562
|
-
});
|
|
12563
|
-
}
|
|
12564
|
-
/**
|
|
12565
|
-
* Classifies an error and returns appropriate code and status
|
|
12566
|
-
*/
|
|
12567
|
-
static classifyError(error, defaultCode, defaultStatus) {
|
|
12568
|
-
if (error.name === "NetworkError" || error.message.includes("network")) {
|
|
12569
|
-
return { code: api.API_ERROR_CODES.NETWORK_ERROR, status: 0 };
|
|
12570
|
-
}
|
|
12571
|
-
if (error.name === "TimeoutError" || error.message.includes("timeout")) {
|
|
12572
|
-
return { code: api.API_ERROR_CODES.REQUEST_TIMEOUT, status: config.HTTP_STATUS.REQUEST_TIMEOUT };
|
|
12573
|
-
}
|
|
12574
|
-
if (error.name === "AbortError") {
|
|
12575
|
-
return { code: api.API_ERROR_CODES.REQUEST_ABORTED, status: 0 };
|
|
12576
|
-
}
|
|
12577
|
-
return { code: defaultCode, status: defaultStatus };
|
|
12578
|
-
}
|
|
12579
|
-
/**
|
|
12580
|
-
* Determines appropriate error code from ResponseError by looking up status in ERROR_DEFINITIONS
|
|
12581
|
-
*/
|
|
12582
|
-
static determineErrorCode(error) {
|
|
12583
|
-
if ("isCancelled" in error && error.isCancelled) {
|
|
12584
|
-
return api.API_ERROR_CODES.CLIENT_CANCELLED;
|
|
12585
|
-
}
|
|
12586
|
-
const status = error.status ?? 0;
|
|
12587
|
-
const errorCode = getErrorCodeByStatus(status);
|
|
12588
|
-
if (errorCode) {
|
|
12589
|
-
return errorCode;
|
|
12590
|
-
}
|
|
12591
|
-
return this.getGenericErrorCode(status);
|
|
12592
|
-
}
|
|
12593
|
-
/**
|
|
12594
|
-
* Gets a generic error code based on HTTP status range
|
|
12595
|
-
*/
|
|
12596
|
-
static getGenericErrorCode(status) {
|
|
12597
|
-
if (status === 0) {
|
|
12598
|
-
return api.API_ERROR_CODES.NETWORK_ERROR;
|
|
12599
|
-
}
|
|
12600
|
-
if (status >= config.HTTP_STATUS.BAD_REQUEST && status < config.HTTP_STATUS.INTERNAL_SERVER_ERROR) {
|
|
12601
|
-
return api.API_ERROR_CODES.CLIENT_ERROR;
|
|
12602
|
-
}
|
|
12603
|
-
if (status >= config.HTTP_STATUS.INTERNAL_SERVER_ERROR) {
|
|
12604
|
-
return api.API_ERROR_CODES.SERVER_ERROR;
|
|
12605
|
-
}
|
|
12606
|
-
return api.API_ERROR_CODES.UNKNOWN_ERROR;
|
|
12607
|
-
}
|
|
12608
|
-
/**
|
|
12609
|
-
* Gets the error category from ERROR_DEFINITIONS
|
|
12610
|
-
*/
|
|
12611
|
-
categorizeError() {
|
|
12612
|
-
const definition = api.ERROR_DEFINITIONS[this.errorCode];
|
|
12613
|
-
return definition?.category ?? types.ERROR_CATEGORY.Unknown;
|
|
12614
|
-
}
|
|
12615
|
-
/**
|
|
12616
|
-
* Checks if this is a specific category of error
|
|
12617
|
-
*/
|
|
12618
|
-
isAuthError() {
|
|
12619
|
-
return this.category === types.ERROR_CATEGORY.Authentication || this.category === types.ERROR_CATEGORY.Authorization;
|
|
12620
|
-
}
|
|
12621
|
-
isValidationError() {
|
|
12622
|
-
return this.category === types.ERROR_CATEGORY.Validation;
|
|
12623
|
-
}
|
|
12624
|
-
isNetworkError() {
|
|
12625
|
-
return this.category === types.ERROR_CATEGORY.Network;
|
|
12626
|
-
}
|
|
12627
|
-
isServerError() {
|
|
12628
|
-
return this.category === types.ERROR_CATEGORY.Server;
|
|
12629
|
-
}
|
|
12630
|
-
isClientError() {
|
|
12631
|
-
return this.statusCode >= config.HTTP_STATUS.BAD_REQUEST && this.statusCode < config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12632
|
-
}
|
|
12633
|
-
isRetryable() {
|
|
12634
|
-
return this.category === types.ERROR_CATEGORY.Network || this.category === types.ERROR_CATEGORY.Server || this.category === types.ERROR_CATEGORY.Timeout || this.statusCode === config.HTTP_STATUS.TOO_MANY_REQUESTS || // Rate limit
|
|
12635
|
-
this.statusCode >= config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12636
|
-
}
|
|
12637
|
-
/**
|
|
12638
|
-
* Converts to ErrorResponse format (as per task-020)
|
|
12639
|
-
*/
|
|
12640
|
-
toJSON() {
|
|
12641
|
-
return {
|
|
12642
|
-
statusCode: this.statusCode,
|
|
12643
|
-
errorCode: this.errorCode,
|
|
12644
|
-
message: this.message,
|
|
12645
|
-
errors: this.errors ?? [],
|
|
12646
|
-
correlationId: this.correlationId,
|
|
12647
|
-
timestamp: this.timestamp
|
|
12648
|
-
};
|
|
12649
|
-
}
|
|
12650
|
-
/**
|
|
12651
|
-
* Creates a string representation
|
|
12652
|
-
*/
|
|
12653
|
-
toString() {
|
|
12654
|
-
return `[${this.errorCode}] ${this.message} (Status: ${this.statusCode}, Category: ${this.category})`;
|
|
12655
|
-
}
|
|
12656
|
-
/**
|
|
12657
|
-
* Check if error is an ApiPackageError
|
|
12658
|
-
*/
|
|
12659
|
-
static isApiPackageError(error) {
|
|
12660
|
-
return error instanceof _ApiPackageError;
|
|
12661
|
-
}
|
|
12662
|
-
/**
|
|
12663
|
-
* Get user-friendly message for display
|
|
12664
|
-
*/
|
|
12665
|
-
getUserMessage() {
|
|
12666
|
-
const customMessage = this.getCustomUserMessage();
|
|
12667
|
-
if (customMessage) {
|
|
12668
|
-
return customMessage;
|
|
12669
|
-
}
|
|
12670
|
-
return this.getDefaultUserMessage();
|
|
12671
|
-
}
|
|
12672
|
-
/**
|
|
12673
|
-
* Gets custom user message from error details if available
|
|
12674
|
-
*/
|
|
12675
|
-
getCustomUserMessage() {
|
|
12676
|
-
if (!this.details?.length) {
|
|
12677
|
-
return null;
|
|
12678
|
-
}
|
|
12679
|
-
const userMessage = this.details.find((d) => d.field === "userMessage");
|
|
12680
|
-
return userMessage ? userMessage.message : null;
|
|
12681
|
-
}
|
|
12682
|
-
/**
|
|
12683
|
-
* Gets default user message based on error category
|
|
12684
|
-
*/
|
|
12685
|
-
getDefaultUserMessage() {
|
|
12686
|
-
const messages = {
|
|
12687
|
-
[types.ERROR_CATEGORY.Authentication]: "Authentication failed. Please check your credentials.",
|
|
12688
|
-
[types.ERROR_CATEGORY.Authorization]: "You do not have permission to perform this action.",
|
|
12689
|
-
[types.ERROR_CATEGORY.Validation]: "Please check your input and try again.",
|
|
12690
|
-
[types.ERROR_CATEGORY.NotFound]: "The requested resource was not found.",
|
|
12691
|
-
[types.ERROR_CATEGORY.RateLimit]: "Too many requests. Please try again later.",
|
|
12692
|
-
[types.ERROR_CATEGORY.Network]: "Network error. Please check your connection.",
|
|
12693
|
-
[types.ERROR_CATEGORY.Timeout]: "The request timed out. Please try again.",
|
|
12694
|
-
[types.ERROR_CATEGORY.Server]: "Server error. Please try again later.",
|
|
12695
|
-
[types.ERROR_CATEGORY.Client]: "Client error. Please check your request.",
|
|
12696
|
-
[types.ERROR_CATEGORY.Blockchain]: "Blockchain error. Please try again later.",
|
|
12697
|
-
[types.ERROR_CATEGORY.ExternalService]: "External service error. Please try again later.",
|
|
12698
|
-
[types.ERROR_CATEGORY.Conflict]: "Conflict detected. Please resolve and try again.",
|
|
12699
|
-
[types.ERROR_CATEGORY.Cache]: "Cache error. Please try again.",
|
|
12700
|
-
[types.ERROR_CATEGORY.Headers]: "Headers error. Please check your request headers.",
|
|
12701
|
-
[types.ERROR_CATEGORY.Retry]: "Retry limit exceeded. Please try again later.",
|
|
12702
|
-
[types.ERROR_CATEGORY.Strategy]: "Strategy error. Invalid configuration.",
|
|
12703
|
-
[types.ERROR_CATEGORY.Regional]: "Regional configuration error. Please check your region settings.",
|
|
12704
|
-
[types.ERROR_CATEGORY.Unknown]: "An unexpected error occurred. Please try again later."
|
|
12705
|
-
};
|
|
12706
|
-
return messages[this.category] ?? "An unexpected error occurred. Please try again later.";
|
|
12707
|
-
}
|
|
12708
|
-
};
|
|
12709
|
-
|
|
12710
|
-
// src/api/errors/error-codes.ts
|
|
12711
|
-
var API_ERROR_CODES6 = {
|
|
12712
|
-
// Client Configuration Errors
|
|
12713
|
-
CLIENT_INITIALIZATION_FAILED: "CLIENT_INITIALIZATION_FAILED",
|
|
12714
|
-
// Header Errors
|
|
12715
|
-
HEADERS_ENRICHMENT_FAILED: "HEADERS_ENRICHMENT_FAILED",
|
|
12716
|
-
// Polling Errors
|
|
12717
|
-
POLLING_TIMEOUT: "POLLING_TIMEOUT",
|
|
12718
|
-
POLLING_CANCELLED: "POLLING_CANCELLED"};
|
|
12719
|
-
var PACKAGE_STATUS_CODES3 = {
|
|
12720
|
-
// Internal system errors
|
|
12721
|
-
INITIALIZATION_FAILED: 1040,
|
|
12722
|
-
OPERATION_FAILED: 1041};
|
|
12723
|
-
|
|
12724
|
-
// src/api/errors/types-constants.ts
|
|
12725
|
-
var OPERATIONS3 = {
|
|
12726
|
-
ENRICHMENT: "enrichment",
|
|
12727
|
-
INITIALIZATION: "initialization",
|
|
12728
|
-
POLLING: "polling"};
|
|
12729
|
-
|
|
12730
|
-
// src/api/polling/utils.ts
|
|
12731
|
-
function isPollingActive(config) {
|
|
12732
|
-
return (config.interval ?? 0) > 0;
|
|
12733
|
-
}
|
|
12734
|
-
__name(isPollingActive, "isPollingActive");
|
|
12735
|
-
function calculatePollingDuration(config) {
|
|
12736
|
-
if (!config.interval || !config.maxAttempts || config.maxAttempts <= 0) {
|
|
12737
|
-
return null;
|
|
12738
|
-
}
|
|
12739
|
-
const intervals = config.interval * config.maxAttempts;
|
|
12740
|
-
const delays = (config.delay ?? 0) * config.maxAttempts;
|
|
12741
|
-
return intervals + delays;
|
|
12742
|
-
}
|
|
12743
|
-
__name(calculatePollingDuration, "calculatePollingDuration");
|
|
12744
|
-
function getSSRSafePollingConfig(config) {
|
|
12745
|
-
if (!isBrowser()) {
|
|
12746
|
-
return {
|
|
12747
|
-
...config,
|
|
12748
|
-
interval: 0,
|
|
12749
|
-
maxAttempts: 1
|
|
12750
|
-
};
|
|
12751
|
-
}
|
|
12752
|
-
return config;
|
|
12753
|
-
}
|
|
12754
|
-
__name(getSSRSafePollingConfig, "getSSRSafePollingConfig");
|
|
12755
|
-
function createProgressivePolling(options = {}) {
|
|
12756
|
-
const { baseInterval = 1e3, maxInterval = 3e4, multiplier = 1.5 } = options;
|
|
12757
|
-
return {
|
|
12758
|
-
interval: baseInterval,
|
|
12759
|
-
delay: 0,
|
|
12760
|
-
maxAttempts: -1,
|
|
12761
|
-
shouldStop: /* @__PURE__ */ __name((_response, attempt) => {
|
|
12762
|
-
return false;
|
|
12763
|
-
}, "shouldStop")
|
|
11940
|
+
__name(getSSRSafePollingConfig, "getSSRSafePollingConfig");
|
|
11941
|
+
function createProgressivePolling(options = {}) {
|
|
11942
|
+
const { baseInterval = 1e3, maxInterval = 3e4, multiplier = 1.5 } = options;
|
|
11943
|
+
return {
|
|
11944
|
+
interval: baseInterval,
|
|
11945
|
+
delay: 0,
|
|
11946
|
+
maxAttempts: -1,
|
|
11947
|
+
shouldStop: /* @__PURE__ */ __name((_response, attempt) => {
|
|
11948
|
+
return false;
|
|
11949
|
+
}, "shouldStop")
|
|
12764
11950
|
};
|
|
12765
11951
|
}
|
|
12766
11952
|
__name(createProgressivePolling, "createProgressivePolling");
|
|
@@ -12777,11 +11963,11 @@ function createConditionalPolling(options) {
|
|
|
12777
11963
|
if (options.errorCondition?.(response)) {
|
|
12778
11964
|
new ApiPackageError(
|
|
12779
11965
|
"polling.error_condition",
|
|
12780
|
-
|
|
12781
|
-
|
|
11966
|
+
errors.INTERNAL_STATUS_CODES.OPERATION_FAILED,
|
|
11967
|
+
errors.API_ERROR_CODES.POLLING_CANCELLED,
|
|
12782
11968
|
{
|
|
12783
11969
|
context: {
|
|
12784
|
-
operation:
|
|
11970
|
+
operation: errors.COMMON_OPERATIONS.POLLING,
|
|
12785
11971
|
reason: "Error condition met",
|
|
12786
11972
|
i18n: {
|
|
12787
11973
|
reason: "error_condition"
|
|
@@ -12796,11 +11982,11 @@ function createConditionalPolling(options) {
|
|
|
12796
11982
|
if (elapsed >= options.timeoutMs) {
|
|
12797
11983
|
new ApiPackageError(
|
|
12798
11984
|
"polling.timeout",
|
|
12799
|
-
|
|
12800
|
-
|
|
11985
|
+
errors.INTERNAL_STATUS_CODES.OPERATION_FAILED,
|
|
11986
|
+
errors.API_ERROR_CODES.POLLING_TIMEOUT,
|
|
12801
11987
|
{
|
|
12802
11988
|
context: {
|
|
12803
|
-
operation:
|
|
11989
|
+
operation: errors.COMMON_OPERATIONS.POLLING,
|
|
12804
11990
|
timeoutMs: options.timeoutMs,
|
|
12805
11991
|
elapsed,
|
|
12806
11992
|
i18n: {
|
|
@@ -13967,7 +13153,7 @@ function filterToFetchffProperties(config) {
|
|
|
13967
13153
|
maxPollingAttempts,
|
|
13968
13154
|
shouldStopPolling,
|
|
13969
13155
|
fetcher,
|
|
13970
|
-
logger,
|
|
13156
|
+
logger: logger19,
|
|
13971
13157
|
// Cache properties
|
|
13972
13158
|
cacheTime,
|
|
13973
13159
|
staleTime,
|
|
@@ -14060,7 +13246,7 @@ function filterToFetchffProperties(config) {
|
|
|
14060
13246
|
if (shouldStopPolling !== void 0 && shouldStopPolling !== null)
|
|
14061
13247
|
fetchffConfig.shouldStopPolling = shouldStopPolling;
|
|
14062
13248
|
if (fetcher !== void 0 && fetcher !== null) fetchffConfig.fetcher = fetcher;
|
|
14063
|
-
if (
|
|
13249
|
+
if (logger19 !== void 0 && logger19 !== null) fetchffConfig.logger = logger19;
|
|
14064
13250
|
if (cacheTime !== void 0) fetchffConfig.cacheTime = cacheTime;
|
|
14065
13251
|
if (staleTime !== void 0) fetchffConfig.staleTime = staleTime;
|
|
14066
13252
|
if (skipCache !== void 0) fetchffConfig.skipCache = skipCache;
|
|
@@ -14437,11 +13623,33 @@ function trackGlobalConfigUpdate(params) {
|
|
|
14437
13623
|
});
|
|
14438
13624
|
}
|
|
14439
13625
|
__name(trackGlobalConfigUpdate, "trackGlobalConfigUpdate");
|
|
13626
|
+
function handleGlobalErrorSystemConfig(errorConfig) {
|
|
13627
|
+
const alreadyInitialized = errors$1.isErrorSystemInitialized();
|
|
13628
|
+
if (alreadyInitialized) {
|
|
13629
|
+
if (errorConfig.locale) {
|
|
13630
|
+
errors$1.setErrorLocale(errorConfig.locale);
|
|
13631
|
+
}
|
|
13632
|
+
if (errorConfig.additionalCatalogs) {
|
|
13633
|
+
Object.entries(errorConfig.additionalCatalogs).forEach(([locale, catalog]) => {
|
|
13634
|
+
errors$1.addMessageCatalog(locale, catalog, true);
|
|
13635
|
+
});
|
|
13636
|
+
}
|
|
13637
|
+
} else {
|
|
13638
|
+
errors$1.initializeErrorSystem({
|
|
13639
|
+
defaultLocale: errorConfig.locale,
|
|
13640
|
+
additionalCatalogs: errorConfig.additionalCatalogs
|
|
13641
|
+
});
|
|
13642
|
+
}
|
|
13643
|
+
}
|
|
13644
|
+
__name(handleGlobalErrorSystemConfig, "handleGlobalErrorSystemConfig");
|
|
14440
13645
|
function setGlobalConfig(config) {
|
|
14441
13646
|
try {
|
|
14442
13647
|
const startTime = Date.now();
|
|
14443
13648
|
const currentConfig = globalApiConfig;
|
|
14444
13649
|
validateConfigObject(config);
|
|
13650
|
+
if (config.errors) {
|
|
13651
|
+
handleGlobalErrorSystemConfig(config.errors);
|
|
13652
|
+
}
|
|
14445
13653
|
const { merged: mergedConfig, entries: configEntries } = mergeGlobalConfig(
|
|
14446
13654
|
currentConfig,
|
|
14447
13655
|
config
|
|
@@ -14616,10 +13824,6 @@ var campaignEndpoints = {
|
|
|
14616
13824
|
createCampaign: {
|
|
14617
13825
|
url: "/campaigns",
|
|
14618
13826
|
method: "POST"
|
|
14619
|
-
// Example: Override global settings for this endpoint
|
|
14620
|
-
// cancellable: true, // Cancel previous create requests
|
|
14621
|
-
// timeout: 60000, // Longer timeout for creation
|
|
14622
|
-
// retry: { attempts: 1 } // Don't retry POST requests
|
|
14623
13827
|
},
|
|
14624
13828
|
updateCampaign: {
|
|
14625
13829
|
url: "/campaigns/:id",
|
|
@@ -14632,9 +13836,6 @@ var campaignEndpoints = {
|
|
|
14632
13836
|
getCampaignStats: {
|
|
14633
13837
|
url: "/campaigns/:id/stats",
|
|
14634
13838
|
method: "GET"
|
|
14635
|
-
// Example: Cache stats for longer
|
|
14636
|
-
// cacheTime: 600, // Cache for 10 minutes
|
|
14637
|
-
// staleTime: 1200 // Consider stale after 20 minutes
|
|
14638
13839
|
},
|
|
14639
13840
|
getCampaignParticipants: {
|
|
14640
13841
|
url: "/campaigns/:id/participants",
|
|
@@ -14712,13 +13913,263 @@ var pollingEndpoints = {
|
|
|
14712
13913
|
}
|
|
14713
13914
|
};
|
|
14714
13915
|
|
|
13916
|
+
// src/api/endpoints/infobip.ts
|
|
13917
|
+
var infobipEmailEndpoints = {
|
|
13918
|
+
// ========== Outbound Email ==========
|
|
13919
|
+
/**
|
|
13920
|
+
* POST /email/3/send - Send email (simple, with attachment support)
|
|
13921
|
+
* Multipart/form-data for attachments
|
|
13922
|
+
*/
|
|
13923
|
+
sendEmail: {
|
|
13924
|
+
url: "/email/3/send",
|
|
13925
|
+
method: "POST"
|
|
13926
|
+
},
|
|
13927
|
+
/**
|
|
13928
|
+
* POST /email/4/send - Send advanced email
|
|
13929
|
+
* JSON payload with full customization
|
|
13930
|
+
*/
|
|
13931
|
+
sendAdvancedEmail: {
|
|
13932
|
+
url: "/email/4/messages",
|
|
13933
|
+
method: "POST"
|
|
13934
|
+
},
|
|
13935
|
+
/**
|
|
13936
|
+
* POST /email/3/mime - Send email via MIME format
|
|
13937
|
+
*/
|
|
13938
|
+
sendEmailMime: {
|
|
13939
|
+
url: "/email/3/mime",
|
|
13940
|
+
method: "POST"
|
|
13941
|
+
},
|
|
13942
|
+
// ========== Email Validation ==========
|
|
13943
|
+
/**
|
|
13944
|
+
* POST /email/2/validation - Validate single email address
|
|
13945
|
+
*/
|
|
13946
|
+
validateEmail: {
|
|
13947
|
+
url: "/email/2/validation",
|
|
13948
|
+
method: "POST"
|
|
13949
|
+
},
|
|
13950
|
+
/**
|
|
13951
|
+
* POST /email/2/validations - Bulk validate email addresses
|
|
13952
|
+
* Returns 202 with validation request ID
|
|
13953
|
+
*/
|
|
13954
|
+
bulkValidateEmails: {
|
|
13955
|
+
url: "/email/2/validations",
|
|
13956
|
+
method: "POST"
|
|
13957
|
+
},
|
|
13958
|
+
/**
|
|
13959
|
+
* GET /email/2/validations - Get validation results
|
|
13960
|
+
* Retrieve bulk validation results with filtering
|
|
13961
|
+
*/
|
|
13962
|
+
getValidations: {
|
|
13963
|
+
url: "/email/2/validations",
|
|
13964
|
+
method: "GET",
|
|
13965
|
+
cacheTime: 30,
|
|
13966
|
+
staleTime: 60
|
|
13967
|
+
},
|
|
13968
|
+
// ========== Logs & Reports ==========
|
|
13969
|
+
/**
|
|
13970
|
+
* GET /email/1/reports - Get email delivery reports
|
|
13971
|
+
*/
|
|
13972
|
+
getEmailReports: {
|
|
13973
|
+
url: "/email/1/reports",
|
|
13974
|
+
method: "GET",
|
|
13975
|
+
cacheTime: 30,
|
|
13976
|
+
staleTime: 60
|
|
13977
|
+
},
|
|
13978
|
+
/**
|
|
13979
|
+
* GET /email/1/logs - Get email logs
|
|
13980
|
+
*/
|
|
13981
|
+
getEmailLogs: {
|
|
13982
|
+
url: "/email/1/logs",
|
|
13983
|
+
method: "GET",
|
|
13984
|
+
cacheTime: 60,
|
|
13985
|
+
staleTime: 120
|
|
13986
|
+
},
|
|
13987
|
+
// ========== Scheduled Messages (Bulk Operations) ==========
|
|
13988
|
+
/**
|
|
13989
|
+
* GET /email/1/bulks - Get scheduled email bulks
|
|
13990
|
+
*/
|
|
13991
|
+
getScheduledEmails: {
|
|
13992
|
+
url: "/email/1/bulks",
|
|
13993
|
+
method: "GET"
|
|
13994
|
+
},
|
|
13995
|
+
/**
|
|
13996
|
+
* GET /email/1/bulks/status - Get scheduled email statuses
|
|
13997
|
+
*/
|
|
13998
|
+
getScheduledEmailStatuses: {
|
|
13999
|
+
url: "/email/1/bulks/status",
|
|
14000
|
+
method: "GET"
|
|
14001
|
+
},
|
|
14002
|
+
/**
|
|
14003
|
+
* PUT /email/1/bulks - Reschedule emails
|
|
14004
|
+
*/
|
|
14005
|
+
rescheduleEmails: {
|
|
14006
|
+
url: "/email/1/bulks",
|
|
14007
|
+
method: "PUT"
|
|
14008
|
+
},
|
|
14009
|
+
/**
|
|
14010
|
+
* PUT /email/1/bulks/status - Update scheduled email statuses
|
|
14011
|
+
*/
|
|
14012
|
+
updateScheduledEmailStatuses: {
|
|
14013
|
+
url: "/email/1/bulks/status",
|
|
14014
|
+
method: "PUT"
|
|
14015
|
+
}
|
|
14016
|
+
};
|
|
14017
|
+
var infobipEndpoints = {
|
|
14018
|
+
...infobipEmailEndpoints
|
|
14019
|
+
};
|
|
14020
|
+
|
|
14715
14021
|
// src/api/endpoints/utils.ts
|
|
14716
14022
|
function getEndpointUrl(name) {
|
|
14717
14023
|
return endpoints[name].url;
|
|
14718
14024
|
}
|
|
14719
14025
|
__name(getEndpointUrl, "getEndpointUrl");
|
|
14026
|
+
function getAllEndpointUrls() {
|
|
14027
|
+
const urls = {};
|
|
14028
|
+
Object.entries(endpoints).forEach(([name, config]) => {
|
|
14029
|
+
urls[name] = config.url;
|
|
14030
|
+
});
|
|
14031
|
+
return urls;
|
|
14032
|
+
}
|
|
14033
|
+
__name(getAllEndpointUrls, "getAllEndpointUrls");
|
|
14034
|
+
function hasEndpoint(name) {
|
|
14035
|
+
return name in endpoints;
|
|
14036
|
+
}
|
|
14037
|
+
__name(hasEndpoint, "hasEndpoint");
|
|
14038
|
+
function getEndpointConfig(name) {
|
|
14039
|
+
return endpoints[name];
|
|
14040
|
+
}
|
|
14041
|
+
__name(getEndpointConfig, "getEndpointConfig");
|
|
14042
|
+
function buildEndpointUrl(endpoint, pathParams) {
|
|
14043
|
+
let url = getEndpointUrl(endpoint);
|
|
14044
|
+
if (pathParams) {
|
|
14045
|
+
Object.entries(pathParams).forEach(([key, value]) => {
|
|
14046
|
+
url = url.replace(`:${key}`, String(value));
|
|
14047
|
+
});
|
|
14048
|
+
}
|
|
14049
|
+
return url;
|
|
14050
|
+
}
|
|
14051
|
+
__name(buildEndpointUrl, "buildEndpointUrl");
|
|
14052
|
+
function getEndpointParams(endpoint) {
|
|
14053
|
+
const url = getEndpointUrl(endpoint);
|
|
14054
|
+
const matches = url.match(/:(\w+)/g);
|
|
14055
|
+
return matches ? matches.map((m) => m.substring(1)) : [];
|
|
14056
|
+
}
|
|
14057
|
+
__name(getEndpointParams, "getEndpointParams");
|
|
14058
|
+
function hasPathParams(endpoint) {
|
|
14059
|
+
return getEndpointUrl(endpoint).includes(":");
|
|
14060
|
+
}
|
|
14061
|
+
__name(hasPathParams, "hasPathParams");
|
|
14062
|
+
function getEndpointMetadata(endpoint) {
|
|
14063
|
+
const config = endpoints[endpoint];
|
|
14064
|
+
return {
|
|
14065
|
+
name: endpoint,
|
|
14066
|
+
url: config.url,
|
|
14067
|
+
method: config.method ?? "GET",
|
|
14068
|
+
hasParams: hasPathParams(endpoint),
|
|
14069
|
+
params: getEndpointParams(endpoint),
|
|
14070
|
+
config
|
|
14071
|
+
};
|
|
14072
|
+
}
|
|
14073
|
+
__name(getEndpointMetadata, "getEndpointMetadata");
|
|
14074
|
+
function buildUrl(url, params) {
|
|
14075
|
+
if (!params) return url;
|
|
14076
|
+
let result = url;
|
|
14077
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
14078
|
+
result = result.replace(`:${key}`, String(value));
|
|
14079
|
+
});
|
|
14080
|
+
return result;
|
|
14081
|
+
}
|
|
14082
|
+
__name(buildUrl, "buildUrl");
|
|
14083
|
+
function extractUrlParams(url) {
|
|
14084
|
+
const matches = url.match(/:(\w+)/g);
|
|
14085
|
+
return matches ? matches.map((m) => m.substring(1)) : [];
|
|
14086
|
+
}
|
|
14087
|
+
__name(extractUrlParams, "extractUrlParams");
|
|
14720
14088
|
|
|
14721
14089
|
// src/api/endpoints/builders.ts
|
|
14090
|
+
function endpointCacheKey(endpoint, params) {
|
|
14091
|
+
let url = getEndpointUrl(endpoint);
|
|
14092
|
+
if (params?.pathParams) {
|
|
14093
|
+
url = buildUrl(url, params.pathParams);
|
|
14094
|
+
}
|
|
14095
|
+
if (params?.queryParams) {
|
|
14096
|
+
try {
|
|
14097
|
+
const queryStr = JSON.stringify(params.queryParams);
|
|
14098
|
+
return `${url}:${queryStr}`;
|
|
14099
|
+
} catch {
|
|
14100
|
+
return `${url}:[unstringifiable]`;
|
|
14101
|
+
}
|
|
14102
|
+
}
|
|
14103
|
+
return url;
|
|
14104
|
+
}
|
|
14105
|
+
__name(endpointCacheKey, "endpointCacheKey");
|
|
14106
|
+
function endpointCachePattern(endpoint, wildcardParam) {
|
|
14107
|
+
const url = getEndpointUrl(endpoint);
|
|
14108
|
+
if (wildcardParam) {
|
|
14109
|
+
return url.replace(`:${wildcardParam}`, "*");
|
|
14110
|
+
}
|
|
14111
|
+
return url.replace(/:(\w+)/g, "*");
|
|
14112
|
+
}
|
|
14113
|
+
__name(endpointCachePattern, "endpointCachePattern");
|
|
14114
|
+
function findEndpointsByPattern(pattern) {
|
|
14115
|
+
return Object.entries(endpoints).filter(([, config]) => pattern.test(config.url)).map(([name, config]) => ({
|
|
14116
|
+
name,
|
|
14117
|
+
...config
|
|
14118
|
+
}));
|
|
14119
|
+
}
|
|
14120
|
+
__name(findEndpointsByPattern, "findEndpointsByPattern");
|
|
14121
|
+
function getEndpointsByMethod(method) {
|
|
14122
|
+
const upperMethod = method.toUpperCase();
|
|
14123
|
+
return Object.entries(endpoints).filter(([, config]) => (config.method ?? "GET") === upperMethod).map(([name, config]) => ({
|
|
14124
|
+
name,
|
|
14125
|
+
...config
|
|
14126
|
+
}));
|
|
14127
|
+
}
|
|
14128
|
+
__name(getEndpointsByMethod, "getEndpointsByMethod");
|
|
14129
|
+
var endpointCachePatterns = {
|
|
14130
|
+
// Campaign-specific patterns
|
|
14131
|
+
allCampaigns: /* @__PURE__ */ __name(() => endpointCachePattern("listCampaigns"), "allCampaigns"),
|
|
14132
|
+
campaignById: /* @__PURE__ */ __name((id) => endpointCacheKey("getCampaign", {
|
|
14133
|
+
pathParams: { id }
|
|
14134
|
+
}), "campaignById"),
|
|
14135
|
+
campaignsByPattern: /* @__PURE__ */ __name(() => "/campaigns/*", "campaignsByPattern"),
|
|
14136
|
+
campaignStats: /* @__PURE__ */ __name((id) => endpointCacheKey("getCampaignStats", {
|
|
14137
|
+
pathParams: { id }
|
|
14138
|
+
}), "campaignStats"),
|
|
14139
|
+
// Generic patterns
|
|
14140
|
+
all: /* @__PURE__ */ __name(() => "/*", "all"),
|
|
14141
|
+
byEndpoint: /* @__PURE__ */ __name((endpoint) => endpointCachePattern(endpoint), "byEndpoint"),
|
|
14142
|
+
// Helper to create custom patterns
|
|
14143
|
+
custom: /* @__PURE__ */ __name((pattern) => pattern, "custom")
|
|
14144
|
+
};
|
|
14145
|
+
function buildFullUrl(endpoint, baseURL, params) {
|
|
14146
|
+
let url = getEndpointUrl(endpoint);
|
|
14147
|
+
if (params?.pathParams) {
|
|
14148
|
+
url = buildUrl(url, params.pathParams);
|
|
14149
|
+
}
|
|
14150
|
+
const fullUrl = `${baseURL.replace(/\/$/, "")}${url}`;
|
|
14151
|
+
if (params?.queryParams) {
|
|
14152
|
+
let searchParams;
|
|
14153
|
+
if (params.queryParams instanceof URLSearchParams) {
|
|
14154
|
+
searchParams = params.queryParams;
|
|
14155
|
+
} else if (Array.isArray(params.queryParams)) {
|
|
14156
|
+
searchParams = new URLSearchParams(params.queryParams);
|
|
14157
|
+
} else {
|
|
14158
|
+
searchParams = new URLSearchParams();
|
|
14159
|
+
Object.entries(params.queryParams).forEach(([key, value]) => {
|
|
14160
|
+
if (Array.isArray(value)) {
|
|
14161
|
+
value.forEach((v) => searchParams.append(key, String(v)));
|
|
14162
|
+
} else if (value !== void 0 && value !== null) {
|
|
14163
|
+
searchParams.append(key, String(value));
|
|
14164
|
+
}
|
|
14165
|
+
});
|
|
14166
|
+
}
|
|
14167
|
+
const queryString = searchParams.toString();
|
|
14168
|
+
return queryString ? `${fullUrl}?${queryString}` : fullUrl;
|
|
14169
|
+
}
|
|
14170
|
+
return fullUrl;
|
|
14171
|
+
}
|
|
14172
|
+
__name(buildFullUrl, "buildFullUrl");
|
|
14722
14173
|
function validatePathParams(endpoint, pathParams) {
|
|
14723
14174
|
const url = getEndpointUrl(endpoint);
|
|
14724
14175
|
const required = url.match(/:(\w+)/g);
|
|
@@ -14739,7 +14190,9 @@ __name(validatePathParams, "validatePathParams");
|
|
|
14739
14190
|
var endpoints = {
|
|
14740
14191
|
...campaignEndpoints,
|
|
14741
14192
|
// These are only examples for the polling, none of these endpoints doesnt exist yet
|
|
14742
|
-
...pollingEndpoints
|
|
14193
|
+
...pollingEndpoints,
|
|
14194
|
+
// Infobip third-party provider endpoints (Email, SMS, WhatsApp)
|
|
14195
|
+
...infobipEndpoints
|
|
14743
14196
|
};
|
|
14744
14197
|
var isSlowConnection = fetchff.isSlowConnection;
|
|
14745
14198
|
function isNetworkAPISupported() {
|
|
@@ -18120,6 +17573,7 @@ async function prepareRequestConfigWithEnrichedHeaders(requestConfig, clientConf
|
|
|
18120
17573
|
return config;
|
|
18121
17574
|
}
|
|
18122
17575
|
__name(prepareRequestConfigWithEnrichedHeaders, "prepareRequestConfigWithEnrichedHeaders");
|
|
17576
|
+
new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.EXPRESS_FRAMEWORK, transport: "console" });
|
|
18123
17577
|
var networkDetectionMiddleware = /* @__PURE__ */ __name((req, res, next) => {
|
|
18124
17578
|
const headerInfo = getNetworkInfoFromHeaders(req.headers);
|
|
18125
17579
|
const networkInfo = {
|
|
@@ -18280,6 +17734,7 @@ __name(exports.MinimumConnectionGuard, "MinimumConnectionGuard");
|
|
|
18280
17734
|
exports.MinimumConnectionGuard = __decorateClass([
|
|
18281
17735
|
common.Injectable()
|
|
18282
17736
|
], exports.MinimumConnectionGuard);
|
|
17737
|
+
var logger13 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.NESTJS_GUARD, transport: "console" });
|
|
18283
17738
|
var EnrichedHeadersGuard = class {
|
|
18284
17739
|
constructor(options = {}) {
|
|
18285
17740
|
this.options = options;
|
|
@@ -18294,7 +17749,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18294
17749
|
for (const requiredHeader of requiredHeaders) {
|
|
18295
17750
|
if (!enrichedHeaders[requiredHeader]) {
|
|
18296
17751
|
if (debug) {
|
|
18297
|
-
|
|
17752
|
+
logger13.warn("Missing required header", { requiredHeader });
|
|
18298
17753
|
}
|
|
18299
17754
|
return false;
|
|
18300
17755
|
}
|
|
@@ -18311,7 +17766,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18311
17766
|
const complianceHeader = enrichedHeaders["x-compliance-required"];
|
|
18312
17767
|
if (!complianceHeader) {
|
|
18313
17768
|
if (debug) {
|
|
18314
|
-
|
|
17769
|
+
logger13.warn("No compliance information available");
|
|
18315
17770
|
}
|
|
18316
17771
|
return false;
|
|
18317
17772
|
}
|
|
@@ -18321,7 +17776,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18321
17776
|
);
|
|
18322
17777
|
if (!hasRequiredCompliance) {
|
|
18323
17778
|
if (debug) {
|
|
18324
|
-
|
|
17779
|
+
logger13.warn("Required compliance not met", {
|
|
18325
17780
|
required: requiredCompliance,
|
|
18326
17781
|
current: currentCompliance
|
|
18327
17782
|
});
|
|
@@ -18335,7 +17790,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18335
17790
|
*/
|
|
18336
17791
|
async buildHeadersForRequest(request, enrichedOptions, debug) {
|
|
18337
17792
|
if (debug) {
|
|
18338
|
-
|
|
17793
|
+
logger13.debug("Processing request with enriched headers guard", {
|
|
18339
17794
|
method: request.method,
|
|
18340
17795
|
url: request.url,
|
|
18341
17796
|
userAgent: request.headers["user-agent"]
|
|
@@ -18351,7 +17806,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18351
17806
|
};
|
|
18352
17807
|
const enrichedHeaders = await buildEnrichedHeaders(requestContext, enrichedOptions);
|
|
18353
17808
|
if (debug) {
|
|
18354
|
-
|
|
17809
|
+
logger13.debug("Built enriched headers in guard", { enrichedHeaders });
|
|
18355
17810
|
}
|
|
18356
17811
|
return enrichedHeaders;
|
|
18357
17812
|
}
|
|
@@ -18383,7 +17838,9 @@ var EnrichedHeadersGuard = class {
|
|
|
18383
17838
|
*/
|
|
18384
17839
|
async handleBuildError(error, request, debug) {
|
|
18385
17840
|
if (debug) {
|
|
18386
|
-
|
|
17841
|
+
logger13.error("Error building headers in guard", {
|
|
17842
|
+
error: error instanceof Error ? error.message : String(error)
|
|
17843
|
+
});
|
|
18387
17844
|
}
|
|
18388
17845
|
new ApiPackageError(
|
|
18389
17846
|
"nestjs.guard.enriched_headers_failed",
|
|
@@ -18431,6 +17888,7 @@ __name(EnrichedHeadersGuard, "EnrichedHeadersGuard");
|
|
|
18431
17888
|
EnrichedHeadersGuard = __decorateClass([
|
|
18432
17889
|
common.Injectable()
|
|
18433
17890
|
], EnrichedHeadersGuard);
|
|
17891
|
+
var logger14 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.NESTJS_INTERCEPTOR, transport: "console" });
|
|
18434
17892
|
var EnrichedHeadersInterceptor = class {
|
|
18435
17893
|
constructor(options = {}) {
|
|
18436
17894
|
this.options = options;
|
|
@@ -18482,7 +17940,9 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18482
17940
|
*/
|
|
18483
17941
|
handleContextError(error, request, debug) {
|
|
18484
17942
|
if (debug) {
|
|
18485
|
-
|
|
17943
|
+
logger14.error("Error in interceptor context", {
|
|
17944
|
+
error: error.message
|
|
17945
|
+
});
|
|
18486
17946
|
}
|
|
18487
17947
|
new ApiPackageError(
|
|
18488
17948
|
"nestjs.interceptor.context_error",
|
|
@@ -18507,7 +17967,9 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18507
17967
|
*/
|
|
18508
17968
|
handleBuildError(error, request, next, debug) {
|
|
18509
17969
|
if (debug) {
|
|
18510
|
-
|
|
17970
|
+
logger14.error("Error building headers in interceptor", {
|
|
17971
|
+
error: error instanceof Error ? error.message : String(error)
|
|
17972
|
+
});
|
|
18511
17973
|
}
|
|
18512
17974
|
new ApiPackageError(
|
|
18513
17975
|
"nestjs.interceptor.enriched_headers_failed",
|
|
@@ -18551,7 +18013,9 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18551
18013
|
*/
|
|
18552
18014
|
handleFallbackError(error, request, debug) {
|
|
18553
18015
|
if (debug) {
|
|
18554
|
-
|
|
18016
|
+
logger14.error("Error in fallback context", {
|
|
18017
|
+
error: error.message
|
|
18018
|
+
});
|
|
18555
18019
|
}
|
|
18556
18020
|
new ApiPackageError(
|
|
18557
18021
|
"nestjs.interceptor.fallback_error",
|
|
@@ -18578,7 +18042,7 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18578
18042
|
const response = http.getResponse();
|
|
18579
18043
|
try {
|
|
18580
18044
|
if (debug) {
|
|
18581
|
-
|
|
18045
|
+
logger14.debug("Processing request with enriched headers interceptor", {
|
|
18582
18046
|
method: request.method,
|
|
18583
18047
|
url: request.url,
|
|
18584
18048
|
userAgent: request.headers["user-agent"]
|
|
@@ -18586,7 +18050,7 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18586
18050
|
}
|
|
18587
18051
|
const enrichedHeaders = await this.buildHeaders(request, enrichedOptions);
|
|
18588
18052
|
if (debug) {
|
|
18589
|
-
|
|
18053
|
+
logger14.debug("Built enriched headers in interceptor", { enrichedHeaders });
|
|
18590
18054
|
}
|
|
18591
18055
|
if (storeInRequest) {
|
|
18592
18056
|
request.enrichedHeaders = enrichedHeaders;
|
|
@@ -19311,65 +18775,6 @@ var NetworkPresetNames = {
|
|
|
19311
18775
|
BACKGROUND_SYNC: "background-sync"
|
|
19312
18776
|
};
|
|
19313
18777
|
|
|
19314
|
-
// src/api/utils/generation/request-id.ts
|
|
19315
|
-
var REQUEST_ID_CONSTANTS = {
|
|
19316
|
-
PREFIX_LENGTH: 4
|
|
19317
|
-
// Length of 'req_'
|
|
19318
|
-
};
|
|
19319
|
-
var requestIdGenerator = createIdGenerator({
|
|
19320
|
-
prefix: "req",
|
|
19321
|
-
useTimestamp: false
|
|
19322
|
-
// Use UUID for request IDs for guaranteed uniqueness
|
|
19323
|
-
});
|
|
19324
|
-
function generateRequestId(options) {
|
|
19325
|
-
return requestIdGenerator(options);
|
|
19326
|
-
}
|
|
19327
|
-
__name(generateRequestId, "generateRequestId");
|
|
19328
|
-
function generateContextualRequestId(method, url, options) {
|
|
19329
|
-
const context = {};
|
|
19330
|
-
if (method || url) {
|
|
19331
|
-
context.method = method ?? "UNKNOWN";
|
|
19332
|
-
context.url = url ?? "UNKNOWN";
|
|
19333
|
-
}
|
|
19334
|
-
return generateContextualId(context, {
|
|
19335
|
-
prefix: "req",
|
|
19336
|
-
...options
|
|
19337
|
-
});
|
|
19338
|
-
}
|
|
19339
|
-
__name(generateContextualRequestId, "generateContextualRequestId");
|
|
19340
|
-
function extractBaseRequestId(contextualId) {
|
|
19341
|
-
let id = extractBaseId(contextualId, { separator: ":", extractLast: true });
|
|
19342
|
-
if (id.startsWith("req_")) {
|
|
19343
|
-
id = id.substring(REQUEST_ID_CONSTANTS.PREFIX_LENGTH);
|
|
19344
|
-
}
|
|
19345
|
-
return id;
|
|
19346
|
-
}
|
|
19347
|
-
__name(extractBaseRequestId, "extractBaseRequestId");
|
|
19348
|
-
function isValidRequestId(id) {
|
|
19349
|
-
return isValidId(id, {
|
|
19350
|
-
allowUuid: true,
|
|
19351
|
-
allowTimestamp: true,
|
|
19352
|
-
allowPrefix: true,
|
|
19353
|
-
minLength: 5
|
|
19354
|
-
});
|
|
19355
|
-
}
|
|
19356
|
-
__name(isValidRequestId, "isValidRequestId");
|
|
19357
|
-
function generateShortRequestId(options) {
|
|
19358
|
-
return requestIdGenerator({
|
|
19359
|
-
useTimestamp: true,
|
|
19360
|
-
randomLength: 8,
|
|
19361
|
-
...options
|
|
19362
|
-
});
|
|
19363
|
-
}
|
|
19364
|
-
__name(generateShortRequestId, "generateShortRequestId");
|
|
19365
|
-
function createRequestIdGenerator(defaultOptions = {}) {
|
|
19366
|
-
return createIdGenerator({
|
|
19367
|
-
prefix: "req",
|
|
19368
|
-
...defaultOptions
|
|
19369
|
-
});
|
|
19370
|
-
}
|
|
19371
|
-
__name(createRequestIdGenerator, "createRequestIdGenerator");
|
|
19372
|
-
|
|
19373
18778
|
// src/api/utils/async-control.ts
|
|
19374
18779
|
function debounce(func, delay) {
|
|
19375
18780
|
let timeoutId;
|
|
@@ -19651,6 +19056,10 @@ function getAllMediaExtensions() {
|
|
|
19651
19056
|
}
|
|
19652
19057
|
__name(getAllMediaExtensions, "getAllMediaExtensions");
|
|
19653
19058
|
var MEDIA_MIME_PREFIXES = ["image/", "video/", "audio/"];
|
|
19059
|
+
var logger15 = new logger$1.ApiLogger({
|
|
19060
|
+
service: types.LOGGER_SERVICES.CLIENT_EVENT_MANAGER,
|
|
19061
|
+
transport: "console"
|
|
19062
|
+
});
|
|
19654
19063
|
var EVENT_CONSTANTS2 = {
|
|
19655
19064
|
DEBUG_INFO_INTERVAL_MULTIPLIER: 5,
|
|
19656
19065
|
IMPACT_THRESHOLDS: {
|
|
@@ -19863,7 +19272,9 @@ var ClientEventManager = class _ClientEventManager {
|
|
|
19863
19272
|
const registeredHandlers = [];
|
|
19864
19273
|
finalHandlers.forEach((h) => {
|
|
19865
19274
|
if (typeof h !== "function") {
|
|
19866
|
-
|
|
19275
|
+
logger15.warn("Invalid handler provided - not a function", {
|
|
19276
|
+
handlerType: typeof h
|
|
19277
|
+
});
|
|
19867
19278
|
return;
|
|
19868
19279
|
}
|
|
19869
19280
|
const wrappedHandler = /* @__PURE__ */ __name((eventData) => {
|
|
@@ -20380,10 +19791,20 @@ var ClientEventManager = class _ClientEventManager {
|
|
|
20380
19791
|
return this.eventManager.getActiveScopes();
|
|
20381
19792
|
}
|
|
20382
19793
|
/**
|
|
20383
|
-
* Emit error event
|
|
19794
|
+
* Emit error event at CLIENT scope
|
|
19795
|
+
*
|
|
19796
|
+
* Note: ApiPackageError instances automatically emit to ALL scopes when created.
|
|
19797
|
+
* This method emits specifically at CLIENT scope, useful for:
|
|
19798
|
+
* - Re-emitting errors that were caught and handled elsewhere
|
|
19799
|
+
* - Manual emission timing control
|
|
19800
|
+
* - Client-level error broadcasting
|
|
20384
19801
|
*/
|
|
20385
19802
|
emitError(error) {
|
|
20386
|
-
|
|
19803
|
+
errors$1.emitScopedErrorEvent(API_ERROR_NAMESPACE, error, {
|
|
19804
|
+
scopes: ["CLIENT"],
|
|
19805
|
+
eventFactory: apiErrorEventFactory,
|
|
19806
|
+
category: error.category
|
|
19807
|
+
});
|
|
20387
19808
|
}
|
|
20388
19809
|
/**
|
|
20389
19810
|
* Emit request start event
|
|
@@ -21270,8 +20691,6 @@ function mergeHeaders(...headerSets) {
|
|
|
21270
20691
|
return result;
|
|
21271
20692
|
}
|
|
21272
20693
|
__name(mergeHeaders, "mergeHeaders");
|
|
21273
|
-
|
|
21274
|
-
// src/api/headers/headerBuilder.ts
|
|
21275
20694
|
var HeaderBuilder = class {
|
|
21276
20695
|
static {
|
|
21277
20696
|
__name(this, "HeaderBuilder");
|
|
@@ -21506,7 +20925,7 @@ var HeaderBuilder = class {
|
|
|
21506
20925
|
* ```
|
|
21507
20926
|
*/
|
|
21508
20927
|
correlationId(id) {
|
|
21509
|
-
this._headers["x-correlation-id"] = id ?? generateCorrelationId();
|
|
20928
|
+
this._headers["x-correlation-id"] = id ?? errors$1.generateCorrelationId("req_correlation");
|
|
21510
20929
|
return this;
|
|
21511
20930
|
}
|
|
21512
20931
|
/**
|
|
@@ -21522,7 +20941,7 @@ var HeaderBuilder = class {
|
|
|
21522
20941
|
* ```
|
|
21523
20942
|
*/
|
|
21524
20943
|
requestId(id) {
|
|
21525
|
-
this._headers["x-request-id"] = id ?? generateRequestId();
|
|
20944
|
+
this._headers["x-request-id"] = id ?? errors$1.generateRequestId();
|
|
21526
20945
|
return this;
|
|
21527
20946
|
}
|
|
21528
20947
|
/**
|
|
@@ -21538,7 +20957,7 @@ var HeaderBuilder = class {
|
|
|
21538
20957
|
* ```
|
|
21539
20958
|
*/
|
|
21540
20959
|
traceId(traceId) {
|
|
21541
|
-
this._headers["x-trace-id"] = traceId ?? generateTraceCorrelationId();
|
|
20960
|
+
this._headers["x-trace-id"] = traceId ?? errors$1.generateTraceCorrelationId();
|
|
21542
20961
|
return this;
|
|
21543
20962
|
}
|
|
21544
20963
|
/**
|
|
@@ -22845,10 +22264,9 @@ function hasEncryptableFields(requestConfig, config) {
|
|
|
22845
22264
|
return targets.some((target) => hasMatchingFieldsInTarget(target, requestConfig, config));
|
|
22846
22265
|
}
|
|
22847
22266
|
__name(hasEncryptableFields, "hasEncryptableFields");
|
|
22848
|
-
|
|
22849
|
-
// src/api/client/helpers/interceptors.ts
|
|
22850
22267
|
var DEFAULT_MAX_RETRIES = 3;
|
|
22851
22268
|
var DEFAULT_SUCCESS_STATUS = config.HTTP_STATUS.OK;
|
|
22269
|
+
var logger16 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.INTERCEPTORS, transport: "console" });
|
|
22852
22270
|
function trackHeaderChanges(beforeHeaders, afterHeaders, interceptorIndex) {
|
|
22853
22271
|
const changes = [];
|
|
22854
22272
|
Object.entries(afterHeaders).forEach(([key, value]) => {
|
|
@@ -22891,7 +22309,7 @@ function createOnRetryHandler(handlers) {
|
|
|
22891
22309
|
return (response, retryAttempt) => {
|
|
22892
22310
|
const performanceFactory = getPerformanceEventFactory();
|
|
22893
22311
|
performanceFactory.emitRetry({
|
|
22894
|
-
requestId: generateRequestId(),
|
|
22312
|
+
requestId: errors$1.generateRequestId(),
|
|
22895
22313
|
attempt: retryAttempt,
|
|
22896
22314
|
maxAttempts: DEFAULT_MAX_RETRIES,
|
|
22897
22315
|
reason: response.error?.message ?? "Retry attempt",
|
|
@@ -22908,13 +22326,33 @@ function createOnRetryHandler(handlers) {
|
|
|
22908
22326
|
};
|
|
22909
22327
|
}
|
|
22910
22328
|
__name(createOnRetryHandler, "createOnRetryHandler");
|
|
22911
|
-
function
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22329
|
+
function normalizeHeaders4(headers2) {
|
|
22330
|
+
const normalized = {};
|
|
22331
|
+
for (const [key, value] of Object.entries(headers2 || {})) {
|
|
22332
|
+
normalized[key.toLowerCase()] = value;
|
|
22333
|
+
}
|
|
22334
|
+
return normalized;
|
|
22335
|
+
}
|
|
22336
|
+
__name(normalizeHeaders4, "normalizeHeaders");
|
|
22337
|
+
function mergeHeadersCaseInsensitive(...headerSets) {
|
|
22338
|
+
const result = {};
|
|
22339
|
+
for (const headers2 of headerSets) {
|
|
22340
|
+
if (!headers2) continue;
|
|
22341
|
+
for (const [key, value] of Object.entries(headers2)) {
|
|
22342
|
+
const normalizedKey = key.toLowerCase();
|
|
22343
|
+
result[normalizedKey] = value;
|
|
22344
|
+
}
|
|
22345
|
+
}
|
|
22346
|
+
return result;
|
|
22347
|
+
}
|
|
22348
|
+
__name(mergeHeadersCaseInsensitive, "mergeHeadersCaseInsensitive");
|
|
22349
|
+
function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfig, configStrategy) {
|
|
22350
|
+
return async (config) => {
|
|
22351
|
+
const performanceFactory = getPerformanceEventFactory();
|
|
22352
|
+
const requestId = errors$1.generateRequestId();
|
|
22353
|
+
startRequestTracking(requestId);
|
|
22354
|
+
UnifiedDebugger.getInstance().trackConfigChange(
|
|
22355
|
+
{ headers: config.headers },
|
|
22918
22356
|
"interceptor"
|
|
22919
22357
|
);
|
|
22920
22358
|
performanceFactory.emitRequestStart(requestId, config.url ?? "", config.method ?? "GET");
|
|
@@ -22932,12 +22370,28 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfi
|
|
|
22932
22370
|
"enrichedHeaders",
|
|
22933
22371
|
{ requestId }
|
|
22934
22372
|
);
|
|
22935
|
-
|
|
22936
|
-
|
|
22937
|
-
|
|
22938
|
-
|
|
22373
|
+
const strategy = configStrategy;
|
|
22374
|
+
if (strategy === "replace") {
|
|
22375
|
+
processedConfig = {
|
|
22376
|
+
...processedConfig,
|
|
22377
|
+
headers: normalizeHeaders4(enrichedHeaders)
|
|
22378
|
+
};
|
|
22379
|
+
} else {
|
|
22380
|
+
const mergedHeaders = mergeHeadersCaseInsensitive(
|
|
22381
|
+
enrichedHeaders,
|
|
22382
|
+
// Enriched headers (x-correlation-id, x-platform-type, etc.)
|
|
22383
|
+
config.headers
|
|
22384
|
+
// Existing headers (Authorization, Content-Type, etc.) - OVERRIDE enriched
|
|
22385
|
+
);
|
|
22386
|
+
processedConfig = {
|
|
22387
|
+
...processedConfig,
|
|
22388
|
+
headers: mergedHeaders
|
|
22389
|
+
};
|
|
22390
|
+
}
|
|
22939
22391
|
} catch (error) {
|
|
22940
|
-
|
|
22392
|
+
logger16.error("Failed to enrich headers", {
|
|
22393
|
+
error: error instanceof Error ? error.message : String(error)
|
|
22394
|
+
});
|
|
22941
22395
|
}
|
|
22942
22396
|
}
|
|
22943
22397
|
if (encryptionConfig?.enabled) {
|
|
@@ -22947,7 +22401,9 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfi
|
|
|
22947
22401
|
processedConfig = await encryptionInterceptor(processedConfig);
|
|
22948
22402
|
UnifiedDebugger.getInstance().trackConfigChange({ encryption: "applied" }, "encryption");
|
|
22949
22403
|
} catch (error) {
|
|
22950
|
-
|
|
22404
|
+
logger16.error("Failed to encrypt request", {
|
|
22405
|
+
error: error instanceof Error ? error.message : String(error)
|
|
22406
|
+
});
|
|
22951
22407
|
}
|
|
22952
22408
|
}
|
|
22953
22409
|
if (handlers && handlers.length > 0) {
|
|
@@ -22966,7 +22422,7 @@ function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComp
|
|
|
22966
22422
|
return async (response) => {
|
|
22967
22423
|
const performanceFactory = getPerformanceEventFactory();
|
|
22968
22424
|
performanceFactory.emitRequestComplete({
|
|
22969
|
-
requestId: generateRequestId(),
|
|
22425
|
+
requestId: errors$1.generateRequestId(),
|
|
22970
22426
|
url: response.config?.url ?? "",
|
|
22971
22427
|
method: response.config?.method ?? "GET",
|
|
22972
22428
|
status: response.status ?? DEFAULT_SUCCESS_STATUS,
|
|
@@ -22987,7 +22443,9 @@ function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComp
|
|
|
22987
22443
|
processedResponse = await decryptionInterceptor(processedResponse);
|
|
22988
22444
|
UnifiedDebugger.getInstance().trackConfigChange({ decryption: "applied" }, "encryption");
|
|
22989
22445
|
} catch (error) {
|
|
22990
|
-
|
|
22446
|
+
logger16.error("Failed to decrypt response", {
|
|
22447
|
+
error: error instanceof Error ? error.message : String(error)
|
|
22448
|
+
});
|
|
22991
22449
|
}
|
|
22992
22450
|
}
|
|
22993
22451
|
if (clearOnComplete && clearTemporaryOverrides2) {
|
|
@@ -23001,7 +22459,7 @@ function createOnErrorHandler(handlers, clearTemporaryOverrides2, clearOnComplet
|
|
|
23001
22459
|
return async (error) => {
|
|
23002
22460
|
const performanceFactory = getPerformanceEventFactory();
|
|
23003
22461
|
performanceFactory.emitRequestComplete({
|
|
23004
|
-
requestId: generateRequestId(),
|
|
22462
|
+
requestId: errors$1.generateRequestId(),
|
|
23005
22463
|
url: error.config?.url ?? "",
|
|
23006
22464
|
method: error.config?.method ?? "GET",
|
|
23007
22465
|
status: error.status ?? 0,
|
|
@@ -23084,8 +22542,14 @@ function setupUnifiedHandlers(params) {
|
|
|
23084
22542
|
);
|
|
23085
22543
|
const clearOnComplete = mergedConfig.configOverride?.clearOnComplete ?? globalConfig?.configOverride?.clearOnComplete ?? clientOptions?.configOverride?.clearOnComplete;
|
|
23086
22544
|
const encryptionConfig = mergedConfig.encryption ?? globalConfig?.encryption ?? clientOptions?.encryption;
|
|
22545
|
+
const configStrategy = mergedConfig.configOverride?.strategy ?? clientOptions?.configOverride?.strategy ?? globalConfig?.configOverride?.strategy ?? "merge";
|
|
23087
22546
|
return {
|
|
23088
|
-
onRequest: createOnRequestHandler(
|
|
22547
|
+
onRequest: createOnRequestHandler(
|
|
22548
|
+
mergedOnRequest,
|
|
22549
|
+
enrichedHeadersConfig,
|
|
22550
|
+
encryptionConfig,
|
|
22551
|
+
configStrategy
|
|
22552
|
+
),
|
|
23089
22553
|
onResponse: createOnResponseHandler(
|
|
23090
22554
|
mergedOnResponse,
|
|
23091
22555
|
clearTemporaryOverrides2,
|
|
@@ -23097,13 +22561,12 @@ function setupUnifiedHandlers(params) {
|
|
|
23097
22561
|
};
|
|
23098
22562
|
}
|
|
23099
22563
|
__name(setupUnifiedHandlers, "setupUnifiedHandlers");
|
|
23100
|
-
|
|
23101
|
-
// src/api/client/createApiClient.ts
|
|
23102
22564
|
var ID_GENERATION = {
|
|
23103
22565
|
BASE: 36,
|
|
23104
22566
|
SUBSTR_START: 2,
|
|
23105
22567
|
SUBSTR_LENGTH: 9
|
|
23106
22568
|
};
|
|
22569
|
+
var logger17 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.API_CLIENT, transport: "console" });
|
|
23107
22570
|
function applyStrategies(config, options) {
|
|
23108
22571
|
let resolvedConfig = config;
|
|
23109
22572
|
if (options.unifiedStrategy) {
|
|
@@ -23133,12 +22596,11 @@ function applyStrategies(config, options) {
|
|
|
23133
22596
|
);
|
|
23134
22597
|
}
|
|
23135
22598
|
});
|
|
23136
|
-
|
|
23137
|
-
|
|
22599
|
+
logger17.warn("Individual strategies override unified strategy", {
|
|
22600
|
+
unifiedStrategy: options.unifiedStrategy,
|
|
23138
22601
|
individualStrategies,
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
);
|
|
22602
|
+
conflictsCount: debuggerInstance.getConflicts().length
|
|
22603
|
+
});
|
|
23142
22604
|
}
|
|
23143
22605
|
}
|
|
23144
22606
|
resolvedConfig = applyIndividualStrategies(resolvedConfig, options);
|
|
@@ -23169,12 +22631,12 @@ async function finalizeConfig(resolvedConfig, options) {
|
|
|
23169
22631
|
} catch (error) {
|
|
23170
22632
|
new ApiPackageError(
|
|
23171
22633
|
"headers.processing.failed",
|
|
23172
|
-
|
|
23173
|
-
|
|
22634
|
+
errors.INTERNAL_STATUS_CODES.OPERATION_FAILED,
|
|
22635
|
+
errors.API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED,
|
|
23174
22636
|
{
|
|
23175
22637
|
cause: error instanceof Error ? error : void 0,
|
|
23176
22638
|
context: {
|
|
23177
|
-
operation:
|
|
22639
|
+
operation: errors.COMMON_OPERATIONS.ENRICHMENT,
|
|
23178
22640
|
originalError: error instanceof Error ? error.message : String(error),
|
|
23179
22641
|
i18n: {
|
|
23180
22642
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -23215,12 +22677,12 @@ __name(applyDefaultOptions, "applyDefaultOptions");
|
|
|
23215
22677
|
function handleClientInitError(error) {
|
|
23216
22678
|
throw new ApiPackageError(
|
|
23217
22679
|
"client.initialization.failed",
|
|
23218
|
-
|
|
23219
|
-
|
|
22680
|
+
errors.INTERNAL_STATUS_CODES.INITIALIZATION_FAILED,
|
|
22681
|
+
errors.API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED,
|
|
23220
22682
|
{
|
|
23221
22683
|
cause: error instanceof Error ? error : void 0,
|
|
23222
22684
|
context: {
|
|
23223
|
-
operation:
|
|
22685
|
+
operation: errors.COMMON_OPERATIONS.INITIALIZATION,
|
|
23224
22686
|
originalError: error instanceof Error ? error.message : String(error),
|
|
23225
22687
|
i18n: {
|
|
23226
22688
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -23331,7 +22793,9 @@ function analyzeConfigChanges(previousConfig, newConfig, updates) {
|
|
|
23331
22793
|
}
|
|
23332
22794
|
__name(analyzeConfigChanges, "analyzeConfigChanges");
|
|
23333
22795
|
function handleInvalidConfigUpdate(validation, updates, updateOptions) {
|
|
23334
|
-
|
|
22796
|
+
logger17.warn("Invalid configuration update", {
|
|
22797
|
+
errors: validation.errors
|
|
22798
|
+
});
|
|
23335
22799
|
UnifiedDebugger.getInstance().trackEventOperation(
|
|
23336
22800
|
api.EVENT_OPERATIONS.CONFIG_UPDATE_FAILED,
|
|
23337
22801
|
"updateConfig",
|
|
@@ -23406,6 +22870,25 @@ function trackSuccessfulConfigUpdate(params) {
|
|
|
23406
22870
|
);
|
|
23407
22871
|
}
|
|
23408
22872
|
__name(trackSuccessfulConfigUpdate, "trackSuccessfulConfigUpdate");
|
|
22873
|
+
function handleClientErrorSystemConfig(errorConfig) {
|
|
22874
|
+
const alreadyInitialized = errors$1.isErrorSystemInitialized();
|
|
22875
|
+
if (alreadyInitialized) {
|
|
22876
|
+
if (errorConfig.locale) {
|
|
22877
|
+
errors$1.setErrorLocale(errorConfig.locale);
|
|
22878
|
+
}
|
|
22879
|
+
if (errorConfig.additionalCatalogs) {
|
|
22880
|
+
Object.entries(errorConfig.additionalCatalogs).forEach(([locale, catalog]) => {
|
|
22881
|
+
errors$1.addMessageCatalog(locale, catalog, true);
|
|
22882
|
+
});
|
|
22883
|
+
}
|
|
22884
|
+
} else {
|
|
22885
|
+
errors$1.initializeErrorSystem({
|
|
22886
|
+
defaultLocale: errorConfig.locale,
|
|
22887
|
+
additionalCatalogs: errorConfig.additionalCatalogs
|
|
22888
|
+
});
|
|
22889
|
+
}
|
|
22890
|
+
}
|
|
22891
|
+
__name(handleClientErrorSystemConfig, "handleClientErrorSystemConfig");
|
|
23409
22892
|
function createUpdateConfigMethod(initialConfigState, eventManager2, client, setConfigState) {
|
|
23410
22893
|
let configState = initialConfigState;
|
|
23411
22894
|
return (updates, updateOptions) => {
|
|
@@ -23415,6 +22898,9 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
|
|
|
23415
22898
|
if (updates.tracking) {
|
|
23416
22899
|
applyTrackingConfiguration(updates);
|
|
23417
22900
|
}
|
|
22901
|
+
if (updates.errors) {
|
|
22902
|
+
handleClientErrorSystemConfig(updates.errors);
|
|
22903
|
+
}
|
|
23418
22904
|
const validation = validateConfigUpdate(updates, updateOptions);
|
|
23419
22905
|
if (!validation.valid) {
|
|
23420
22906
|
handleInvalidConfigUpdate(validation, updates, updateOptions);
|
|
@@ -23443,9 +22929,62 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
|
|
|
23443
22929
|
};
|
|
23444
22930
|
}
|
|
23445
22931
|
__name(createUpdateConfigMethod, "createUpdateConfigMethod");
|
|
22932
|
+
function createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers) {
|
|
22933
|
+
return fetchff.createApiFetcher({
|
|
22934
|
+
...fetchffConfig,
|
|
22935
|
+
baseURL: effectiveConfig.baseURL ?? options.apiUrl,
|
|
22936
|
+
endpoints,
|
|
22937
|
+
onRequest: unifiedHandlers.onRequest,
|
|
22938
|
+
onResponse: unifiedHandlers.onResponse,
|
|
22939
|
+
onError: unifiedHandlers.onError,
|
|
22940
|
+
onRetry: unifiedHandlers.onRetry
|
|
22941
|
+
});
|
|
22942
|
+
}
|
|
22943
|
+
__name(createFetchffClient, "createFetchffClient");
|
|
22944
|
+
function enhanceClientWithMethods(params) {
|
|
22945
|
+
const {
|
|
22946
|
+
clientWithEvents,
|
|
22947
|
+
stateContainer,
|
|
22948
|
+
eventManager: eventManager2,
|
|
22949
|
+
client,
|
|
22950
|
+
clientId,
|
|
22951
|
+
globalConfig,
|
|
22952
|
+
options
|
|
22953
|
+
} = params;
|
|
22954
|
+
clientWithEvents.updateConfig = createUpdateConfigMethod(
|
|
22955
|
+
stateContainer.current,
|
|
22956
|
+
eventManager2,
|
|
22957
|
+
client,
|
|
22958
|
+
(newState) => {
|
|
22959
|
+
stateContainer.current = newState;
|
|
22960
|
+
}
|
|
22961
|
+
);
|
|
22962
|
+
clientWithEvents.getConfig = createGetConfigMethod(
|
|
22963
|
+
() => stateContainer.current,
|
|
22964
|
+
globalConfig,
|
|
22965
|
+
clientId,
|
|
22966
|
+
options
|
|
22967
|
+
);
|
|
22968
|
+
clientWithEvents.clearTemporaryOverrides = createClearTemporaryOverridesMethod(
|
|
22969
|
+
() => stateContainer.current,
|
|
22970
|
+
(newState) => {
|
|
22971
|
+
stateContainer.current = newState;
|
|
22972
|
+
},
|
|
22973
|
+
client,
|
|
22974
|
+
eventManager2
|
|
22975
|
+
);
|
|
22976
|
+
}
|
|
22977
|
+
__name(enhanceClientWithMethods, "enhanceClientWithMethods");
|
|
22978
|
+
function initializeClientSystems(options) {
|
|
22979
|
+
applyTrackingConfiguration(options);
|
|
22980
|
+
if (options.errors) {
|
|
22981
|
+
handleClientErrorSystemConfig(options.errors);
|
|
22982
|
+
}
|
|
22983
|
+
}
|
|
22984
|
+
__name(initializeClientSystems, "initializeClientSystems");
|
|
23446
22985
|
async function createApiClient(options = {}) {
|
|
23447
22986
|
try {
|
|
23448
|
-
|
|
22987
|
+
initializeClientSystems(options);
|
|
23449
22988
|
UnifiedDebugger.getInstance().clear();
|
|
23450
22989
|
options = applyDefaultOptions(options);
|
|
23451
22990
|
const userConfig = createPreservedConfig(options);
|
|
@@ -23453,58 +22992,43 @@ async function createApiClient(options = {}) {
|
|
|
23453
22992
|
const mergedConfig = await finalizeConfig(resolvedConfig, options);
|
|
23454
22993
|
void UnifiedDebugger.getInstance().logConflicts();
|
|
23455
22994
|
const globalConfig = getGlobalConfig();
|
|
23456
|
-
|
|
22995
|
+
const stateContainer = {
|
|
22996
|
+
current: createConfigState(mergedConfig)
|
|
22997
|
+
};
|
|
23457
22998
|
if (options.configOverride) {
|
|
23458
|
-
const result = applyConfigOverride(
|
|
23459
|
-
|
|
22999
|
+
const result = applyConfigOverride(stateContainer.current, options.configOverride);
|
|
23000
|
+
stateContainer.current = result.state;
|
|
23460
23001
|
}
|
|
23461
|
-
const effectiveConfig = getEffectiveConfig(
|
|
23002
|
+
const effectiveConfig = getEffectiveConfig(stateContainer.current);
|
|
23462
23003
|
const fetchffConfig = toFetchffConfig(effectiveConfig);
|
|
23463
23004
|
let clearTemporaryOverridesFn;
|
|
23464
23005
|
const unifiedHandlers = setupUnifiedHandlers({
|
|
23465
23006
|
mergedConfig: effectiveConfig,
|
|
23466
|
-
// Use effective config here too
|
|
23467
23007
|
enrichedHeadersConfig: options.enrichedHeaders,
|
|
23468
23008
|
globalConfig,
|
|
23469
23009
|
clientOptions: options,
|
|
23470
23010
|
clearTemporaryOverrides: /* @__PURE__ */ __name(() => clearTemporaryOverridesFn?.(), "clearTemporaryOverrides")
|
|
23471
23011
|
});
|
|
23472
|
-
const client =
|
|
23473
|
-
...fetchffConfig,
|
|
23474
|
-
baseURL: effectiveConfig.baseURL ?? options.url,
|
|
23475
|
-
endpoints,
|
|
23476
|
-
// Use unified handlers that handle both ApiConfig callbacks and event emissions
|
|
23477
|
-
onRequest: unifiedHandlers.onRequest,
|
|
23478
|
-
onResponse: unifiedHandlers.onResponse,
|
|
23479
|
-
onError: unifiedHandlers.onError,
|
|
23480
|
-
onRetry: unifiedHandlers.onRetry
|
|
23481
|
-
});
|
|
23012
|
+
const client = createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers);
|
|
23482
23013
|
const clientWithEvents = setupClientEvents(client, globalConfig, options);
|
|
23483
23014
|
const { eventManager: eventManager2 } = clientWithEvents;
|
|
23015
|
+
Object.defineProperty(clientWithEvents, "then", {
|
|
23016
|
+
value: void 0,
|
|
23017
|
+
writable: false,
|
|
23018
|
+
enumerable: false,
|
|
23019
|
+
configurable: true
|
|
23020
|
+
});
|
|
23484
23021
|
clearTemporaryOverridesFn = /* @__PURE__ */ __name(() => eventManager2.clearTemporaryOverrides(), "clearTemporaryOverridesFn");
|
|
23485
23022
|
const clientId = emitClientCreatedEvent(effectiveConfig, options);
|
|
23486
|
-
|
|
23487
|
-
|
|
23488
|
-
|
|
23023
|
+
enhanceClientWithMethods({
|
|
23024
|
+
clientWithEvents,
|
|
23025
|
+
stateContainer,
|
|
23026
|
+
eventManager: eventManager2,
|
|
23489
23027
|
client,
|
|
23490
|
-
(newState) => {
|
|
23491
|
-
configState = newState;
|
|
23492
|
-
}
|
|
23493
|
-
);
|
|
23494
|
-
clientWithEvents.getConfig = createGetConfigMethod(
|
|
23495
|
-
() => configState,
|
|
23496
|
-
globalConfig,
|
|
23497
23028
|
clientId,
|
|
23029
|
+
globalConfig,
|
|
23498
23030
|
options
|
|
23499
|
-
);
|
|
23500
|
-
clientWithEvents.clearTemporaryOverrides = createClearTemporaryOverridesMethod(
|
|
23501
|
-
() => configState,
|
|
23502
|
-
(newState) => {
|
|
23503
|
-
configState = newState;
|
|
23504
|
-
},
|
|
23505
|
-
client,
|
|
23506
|
-
eventManager2
|
|
23507
|
-
);
|
|
23031
|
+
});
|
|
23508
23032
|
if (options.networkAware?.enabled) {
|
|
23509
23033
|
setupNetworkMonitoring(clientWithEvents, options, userConfig);
|
|
23510
23034
|
}
|
|
@@ -23579,18 +23103,13 @@ function createApiQuery(serviceFn, defaultOptions) {
|
|
|
23579
23103
|
__name(createApiQuery, "createApiQuery");
|
|
23580
23104
|
function createApiMutation(serviceFn, defaultOptions) {
|
|
23581
23105
|
return /* @__PURE__ */ __name(function useApiMutation(serviceOptions, mutationOptions) {
|
|
23582
|
-
const mergedMutationOptions = deepMerge(
|
|
23583
|
-
|
|
23584
|
-
|
|
23585
|
-
|
|
23586
|
-
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
-
if (response.error) throw response.error;
|
|
23590
|
-
return response.data;
|
|
23591
|
-
}, "mutationFn")
|
|
23592
|
-
}
|
|
23593
|
-
);
|
|
23106
|
+
const mergedMutationOptions = deepMerge(DEFAULT_MUTATION_OPTIONS, defaultOptions ?? {}, mutationOptions ?? {}, {
|
|
23107
|
+
mutationFn: /* @__PURE__ */ __name(async (variables) => {
|
|
23108
|
+
const response = await serviceFn(variables, serviceOptions);
|
|
23109
|
+
if (response.error) throw response.error;
|
|
23110
|
+
return response.data;
|
|
23111
|
+
}, "mutationFn")
|
|
23112
|
+
});
|
|
23594
23113
|
return reactQuery.useMutation(
|
|
23595
23114
|
mergedMutationOptions
|
|
23596
23115
|
);
|
|
@@ -24036,6 +23555,10 @@ function getEnhancedClientHints(headers2, options) {
|
|
|
24036
23555
|
return response;
|
|
24037
23556
|
}
|
|
24038
23557
|
__name(getEnhancedClientHints, "getEnhancedClientHints");
|
|
23558
|
+
var logger18 = new logger$1.ApiLogger({
|
|
23559
|
+
service: types.LOGGER_SERVICES.NETWORK_CONFIGURATION,
|
|
23560
|
+
transport: "console"
|
|
23561
|
+
});
|
|
24039
23562
|
var NetworkConfigurationManager = class {
|
|
24040
23563
|
static {
|
|
24041
23564
|
__name(this, "NetworkConfigurationManager");
|
|
@@ -24101,9 +23624,11 @@ var NetworkConfigurationManager = class {
|
|
|
24101
23624
|
*/
|
|
24102
23625
|
registerPreset(preset) {
|
|
24103
23626
|
this.availablePresets.set(preset.id, preset);
|
|
24104
|
-
|
|
24105
|
-
|
|
24106
|
-
|
|
23627
|
+
logger18.info("Network preset registered", {
|
|
23628
|
+
presetName: preset.name,
|
|
23629
|
+
presetId: preset.id,
|
|
23630
|
+
targetQuality: preset.targetQuality
|
|
23631
|
+
});
|
|
24107
23632
|
}
|
|
24108
23633
|
/**
|
|
24109
23634
|
* Get all available presets
|
|
@@ -24279,7 +23804,7 @@ var NetworkConfigurationManager = class {
|
|
|
24279
23804
|
}
|
|
24280
23805
|
});
|
|
24281
23806
|
this.cleanupFunctions.push(unsubscribe);
|
|
24282
|
-
|
|
23807
|
+
logger18.info("Auto preset switching enabled");
|
|
24283
23808
|
}
|
|
24284
23809
|
/**
|
|
24285
23810
|
* Disable automatic preset monitoring
|
|
@@ -24288,7 +23813,7 @@ var NetworkConfigurationManager = class {
|
|
|
24288
23813
|
this.monitoringEnabled = false;
|
|
24289
23814
|
this.cleanupFunctions.forEach((cleanup) => cleanup());
|
|
24290
23815
|
this.cleanupFunctions = [];
|
|
24291
|
-
|
|
23816
|
+
logger18.info("Auto preset switching disabled");
|
|
24292
23817
|
}
|
|
24293
23818
|
/**
|
|
24294
23819
|
* Get current active overrides for debugging
|
|
@@ -24302,7 +23827,7 @@ var NetworkConfigurationManager = class {
|
|
|
24302
23827
|
restoreAllOverrides() {
|
|
24303
23828
|
const overrides = Array.from(this.activeOverrides.values());
|
|
24304
23829
|
overrides.forEach((override) => override.restore());
|
|
24305
|
-
|
|
23830
|
+
logger18.info("Restored temporary overrides", { count: overrides.length });
|
|
24306
23831
|
}
|
|
24307
23832
|
/**
|
|
24308
23833
|
* Get configuration manager stats for debugging
|
|
@@ -24554,7 +24079,7 @@ var NetworkConfigurationManager = class {
|
|
|
24554
24079
|
changes.push("caching");
|
|
24555
24080
|
}
|
|
24556
24081
|
if (changes.length > 0) {
|
|
24557
|
-
|
|
24082
|
+
logger18.info("User preferences updated", { changes });
|
|
24558
24083
|
}
|
|
24559
24084
|
}
|
|
24560
24085
|
/**
|
|
@@ -25061,7 +24586,7 @@ function useOptimisticUpdate(key, initialData) {
|
|
|
25061
24586
|
const nextState = {
|
|
25062
24587
|
data: response.data,
|
|
25063
24588
|
isValidating: response.isFetching ?? false,
|
|
25064
|
-
error: response.error
|
|
24589
|
+
error: response.error
|
|
25065
24590
|
};
|
|
25066
24591
|
setState(nextState);
|
|
25067
24592
|
});
|
|
@@ -25538,6 +25063,355 @@ function useDeleteCampaign(serviceOptions, mutationOptions) {
|
|
|
25538
25063
|
})(serviceOptions, mutationOptions);
|
|
25539
25064
|
}
|
|
25540
25065
|
__name(useDeleteCampaign, "useDeleteCampaign");
|
|
25066
|
+
async function sendInfobipEmail(payload, options) {
|
|
25067
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25068
|
+
if (!payload.from) {
|
|
25069
|
+
throw new ApiPackageError(
|
|
25070
|
+
"Missing required field: from",
|
|
25071
|
+
void 0,
|
|
25072
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25073
|
+
);
|
|
25074
|
+
}
|
|
25075
|
+
if (!payload.to) {
|
|
25076
|
+
throw new ApiPackageError(
|
|
25077
|
+
"Missing required field: to",
|
|
25078
|
+
void 0,
|
|
25079
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25080
|
+
);
|
|
25081
|
+
}
|
|
25082
|
+
if (!payload.subject) {
|
|
25083
|
+
throw new ApiPackageError(
|
|
25084
|
+
"Missing required field: subject",
|
|
25085
|
+
void 0,
|
|
25086
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25087
|
+
);
|
|
25088
|
+
}
|
|
25089
|
+
const serviceDefaults = {
|
|
25090
|
+
retry: { attempts: 0 },
|
|
25091
|
+
timeout: 15e3
|
|
25092
|
+
// 15 second timeout for email sends
|
|
25093
|
+
};
|
|
25094
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25095
|
+
const updateOptions = {
|
|
25096
|
+
strategy: "temporary",
|
|
25097
|
+
...options?.updateConfigOptions
|
|
25098
|
+
};
|
|
25099
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25100
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25101
|
+
}
|
|
25102
|
+
return client.sendEmail({
|
|
25103
|
+
body: payload
|
|
25104
|
+
});
|
|
25105
|
+
}
|
|
25106
|
+
__name(sendInfobipEmail, "sendInfobipEmail");
|
|
25107
|
+
async function sendInfobipAdvancedEmail(payload, options) {
|
|
25108
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25109
|
+
if (!payload.messages || payload.messages.length === 0) {
|
|
25110
|
+
throw new ApiPackageError(
|
|
25111
|
+
"Missing required field: messages (must be a non-empty array)",
|
|
25112
|
+
void 0,
|
|
25113
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25114
|
+
);
|
|
25115
|
+
}
|
|
25116
|
+
for (const [index, message] of payload.messages.entries()) {
|
|
25117
|
+
if (!message.sender) {
|
|
25118
|
+
throw new ApiPackageError(
|
|
25119
|
+
`Missing required field: messages[${index}].sender`,
|
|
25120
|
+
void 0,
|
|
25121
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25122
|
+
);
|
|
25123
|
+
}
|
|
25124
|
+
if (!message.destinations || message.destinations.length === 0) {
|
|
25125
|
+
throw new ApiPackageError(
|
|
25126
|
+
`Missing required field: messages[${index}].destinations (must be a non-empty array)`,
|
|
25127
|
+
void 0,
|
|
25128
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25129
|
+
);
|
|
25130
|
+
}
|
|
25131
|
+
if (!message.content?.subject) {
|
|
25132
|
+
throw new ApiPackageError(
|
|
25133
|
+
`Missing required field: messages[${index}].content.subject`,
|
|
25134
|
+
void 0,
|
|
25135
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25136
|
+
);
|
|
25137
|
+
}
|
|
25138
|
+
}
|
|
25139
|
+
const serviceDefaults = {
|
|
25140
|
+
retry: { attempts: 0 },
|
|
25141
|
+
timeout: 15e3
|
|
25142
|
+
// 15 second timeout for email sends
|
|
25143
|
+
};
|
|
25144
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25145
|
+
const updateOptions = {
|
|
25146
|
+
strategy: "temporary",
|
|
25147
|
+
...options?.updateConfigOptions
|
|
25148
|
+
};
|
|
25149
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25150
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25151
|
+
}
|
|
25152
|
+
return client.sendAdvancedEmail({
|
|
25153
|
+
body: payload
|
|
25154
|
+
});
|
|
25155
|
+
}
|
|
25156
|
+
__name(sendInfobipAdvancedEmail, "sendInfobipAdvancedEmail");
|
|
25157
|
+
async function validateInfobipEmail(email, options) {
|
|
25158
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25159
|
+
const payload = typeof email === "string" ? { to: email } : email;
|
|
25160
|
+
if (!payload?.to) {
|
|
25161
|
+
throw new ApiPackageError(
|
|
25162
|
+
"Missing required field: to (email address)",
|
|
25163
|
+
void 0,
|
|
25164
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25165
|
+
);
|
|
25166
|
+
}
|
|
25167
|
+
if (!payload.to.includes("@")) {
|
|
25168
|
+
throw new ApiPackageError(
|
|
25169
|
+
"Invalid email format: must contain @",
|
|
25170
|
+
void 0,
|
|
25171
|
+
api.API_ERROR_CODES.INVALID_FORMAT
|
|
25172
|
+
);
|
|
25173
|
+
}
|
|
25174
|
+
const serviceDefaults = {
|
|
25175
|
+
retry: { attempts: 2, delay: 500 },
|
|
25176
|
+
cacheTime: 300,
|
|
25177
|
+
// Cache validation results for 5 minutes
|
|
25178
|
+
staleTime: 600,
|
|
25179
|
+
// Consider stale after 10 minutes
|
|
25180
|
+
timeout: 5e3
|
|
25181
|
+
// 5 second timeout
|
|
25182
|
+
};
|
|
25183
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25184
|
+
const updateOptions = {
|
|
25185
|
+
strategy: "temporary",
|
|
25186
|
+
...options?.updateConfigOptions
|
|
25187
|
+
};
|
|
25188
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25189
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25190
|
+
}
|
|
25191
|
+
return client.validateEmail({
|
|
25192
|
+
body: payload
|
|
25193
|
+
});
|
|
25194
|
+
}
|
|
25195
|
+
__name(validateInfobipEmail, "validateInfobipEmail");
|
|
25196
|
+
async function bulkValidateInfobipEmails(payload, options) {
|
|
25197
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25198
|
+
const MAX_BULK_EMAIL_VALIDATION_SIZE = 1e4;
|
|
25199
|
+
if (!payload.destinations || payload.destinations.length === 0) {
|
|
25200
|
+
throw new ApiPackageError(
|
|
25201
|
+
"Missing required field: destinations (must be a non-empty array)",
|
|
25202
|
+
void 0,
|
|
25203
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25204
|
+
);
|
|
25205
|
+
}
|
|
25206
|
+
if (payload.destinations.length > MAX_BULK_EMAIL_VALIDATION_SIZE) {
|
|
25207
|
+
throw new ApiPackageError(
|
|
25208
|
+
`Too many email addresses: maximum ${MAX_BULK_EMAIL_VALIDATION_SIZE} per request`,
|
|
25209
|
+
void 0,
|
|
25210
|
+
api.API_ERROR_CODES.INVALID_FORMAT
|
|
25211
|
+
);
|
|
25212
|
+
}
|
|
25213
|
+
const serviceDefaults = {
|
|
25214
|
+
retry: { attempts: 0 },
|
|
25215
|
+
// Don't retry bulk validation requests
|
|
25216
|
+
timeout: 3e4
|
|
25217
|
+
// 30 second timeout for bulk operations
|
|
25218
|
+
};
|
|
25219
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25220
|
+
const updateOptions = {
|
|
25221
|
+
strategy: "temporary",
|
|
25222
|
+
...options?.updateConfigOptions
|
|
25223
|
+
};
|
|
25224
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25225
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25226
|
+
}
|
|
25227
|
+
return client.bulkValidateEmails({
|
|
25228
|
+
body: payload
|
|
25229
|
+
});
|
|
25230
|
+
}
|
|
25231
|
+
__name(bulkValidateInfobipEmails, "bulkValidateInfobipEmails");
|
|
25232
|
+
|
|
25233
|
+
// src/api/services/infobip/email/GET/fetchEmailReports.ts
|
|
25234
|
+
async function fetchInfobipEmailReports(params, options) {
|
|
25235
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25236
|
+
const serviceDefaults = {
|
|
25237
|
+
cacheTime: 30,
|
|
25238
|
+
// Cache for 30 seconds
|
|
25239
|
+
staleTime: 60,
|
|
25240
|
+
// Consider stale after 1 minute
|
|
25241
|
+
timeout: 1e4
|
|
25242
|
+
// 10 second timeout
|
|
25243
|
+
};
|
|
25244
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25245
|
+
const updateOptions = {
|
|
25246
|
+
strategy: "temporary",
|
|
25247
|
+
...options?.updateConfigOptions
|
|
25248
|
+
};
|
|
25249
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25250
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25251
|
+
}
|
|
25252
|
+
return client.getEmailReports({
|
|
25253
|
+
params
|
|
25254
|
+
});
|
|
25255
|
+
}
|
|
25256
|
+
__name(fetchInfobipEmailReports, "fetchInfobipEmailReports");
|
|
25257
|
+
|
|
25258
|
+
// src/api/services/infobip/email/GET/fetchEmailLogs.ts
|
|
25259
|
+
async function fetchInfobipEmailLogs(params, options) {
|
|
25260
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25261
|
+
const serviceDefaults = {
|
|
25262
|
+
cacheTime: 60,
|
|
25263
|
+
// Cache for 1 minute
|
|
25264
|
+
staleTime: 120,
|
|
25265
|
+
// Consider stale after 2 minutes
|
|
25266
|
+
timeout: 1e4
|
|
25267
|
+
// 10 second timeout
|
|
25268
|
+
};
|
|
25269
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25270
|
+
const updateOptions = {
|
|
25271
|
+
strategy: "temporary",
|
|
25272
|
+
...options?.updateConfigOptions
|
|
25273
|
+
};
|
|
25274
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25275
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25276
|
+
}
|
|
25277
|
+
return client.getEmailLogs({
|
|
25278
|
+
params
|
|
25279
|
+
});
|
|
25280
|
+
}
|
|
25281
|
+
__name(fetchInfobipEmailLogs, "fetchInfobipEmailLogs");
|
|
25282
|
+
|
|
25283
|
+
// src/api/services/infobip/email/GET/fetchScheduledEmails.ts
|
|
25284
|
+
async function fetchInfobipScheduledEmails(params, options) {
|
|
25285
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25286
|
+
const serviceDefaults = {
|
|
25287
|
+
retry: { attempts: 2, delay: 500 },
|
|
25288
|
+
cacheTime: 30,
|
|
25289
|
+
staleTime: 60,
|
|
25290
|
+
timeout: 1e4
|
|
25291
|
+
};
|
|
25292
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25293
|
+
const updateOptions = {
|
|
25294
|
+
strategy: "temporary",
|
|
25295
|
+
...options?.updateConfigOptions
|
|
25296
|
+
};
|
|
25297
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25298
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25299
|
+
}
|
|
25300
|
+
return client.getScheduledEmails({
|
|
25301
|
+
params
|
|
25302
|
+
});
|
|
25303
|
+
}
|
|
25304
|
+
__name(fetchInfobipScheduledEmails, "fetchInfobipScheduledEmails");
|
|
25305
|
+
|
|
25306
|
+
// src/api/services/infobip/email/GET/fetchScheduledEmailStatuses.ts
|
|
25307
|
+
async function fetchInfobipScheduledEmailStatuses(params, options) {
|
|
25308
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25309
|
+
const serviceDefaults = {
|
|
25310
|
+
retry: { attempts: 2, delay: 500 },
|
|
25311
|
+
cacheTime: 30,
|
|
25312
|
+
staleTime: 60,
|
|
25313
|
+
timeout: 1e4
|
|
25314
|
+
};
|
|
25315
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25316
|
+
const updateOptions = {
|
|
25317
|
+
strategy: "temporary",
|
|
25318
|
+
...options?.updateConfigOptions
|
|
25319
|
+
};
|
|
25320
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25321
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25322
|
+
}
|
|
25323
|
+
return client.getScheduledEmailStatuses({
|
|
25324
|
+
params
|
|
25325
|
+
});
|
|
25326
|
+
}
|
|
25327
|
+
__name(fetchInfobipScheduledEmailStatuses, "fetchInfobipScheduledEmailStatuses");
|
|
25328
|
+
|
|
25329
|
+
// src/api/services/infobip/email/GET/fetchValidations.ts
|
|
25330
|
+
async function fetchInfobipValidations(params, options) {
|
|
25331
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25332
|
+
const serviceDefaults = {
|
|
25333
|
+
retry: { attempts: 2, delay: 500 },
|
|
25334
|
+
cacheTime: 60,
|
|
25335
|
+
// Cache results for 1 minute
|
|
25336
|
+
staleTime: 120,
|
|
25337
|
+
// Consider stale after 2 minutes
|
|
25338
|
+
timeout: 1e4
|
|
25339
|
+
// 10 second timeout
|
|
25340
|
+
};
|
|
25341
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25342
|
+
const updateOptions = {
|
|
25343
|
+
strategy: "temporary",
|
|
25344
|
+
...options?.updateConfigOptions
|
|
25345
|
+
};
|
|
25346
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25347
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25348
|
+
}
|
|
25349
|
+
return client.getValidations({
|
|
25350
|
+
params
|
|
25351
|
+
});
|
|
25352
|
+
}
|
|
25353
|
+
__name(fetchInfobipValidations, "fetchInfobipValidations");
|
|
25354
|
+
async function rescheduleInfobipEmails(params, payload, options) {
|
|
25355
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25356
|
+
if (!payload.sendAt) {
|
|
25357
|
+
throw new ApiPackageError(
|
|
25358
|
+
"Missing required field: sendAt",
|
|
25359
|
+
void 0,
|
|
25360
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25361
|
+
);
|
|
25362
|
+
}
|
|
25363
|
+
const serviceDefaults = {
|
|
25364
|
+
retry: { attempts: 1 },
|
|
25365
|
+
timeout: 1e4
|
|
25366
|
+
};
|
|
25367
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25368
|
+
const updateOptions = {
|
|
25369
|
+
strategy: "temporary",
|
|
25370
|
+
...options?.updateConfigOptions
|
|
25371
|
+
};
|
|
25372
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25373
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25374
|
+
}
|
|
25375
|
+
return client.rescheduleEmails({
|
|
25376
|
+
params,
|
|
25377
|
+
body: payload
|
|
25378
|
+
});
|
|
25379
|
+
}
|
|
25380
|
+
__name(rescheduleInfobipEmails, "rescheduleInfobipEmails");
|
|
25381
|
+
async function updateInfobipScheduledEmailStatuses(params, payload, options) {
|
|
25382
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25383
|
+
if (!payload.status) {
|
|
25384
|
+
throw new ApiPackageError(
|
|
25385
|
+
"Missing required field: status",
|
|
25386
|
+
void 0,
|
|
25387
|
+
api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25388
|
+
);
|
|
25389
|
+
}
|
|
25390
|
+
if (payload.status !== "PAUSED" && payload.status !== "PROCESSING") {
|
|
25391
|
+
throw new ApiPackageError(
|
|
25392
|
+
"Invalid status: must be PAUSED or PROCESSING",
|
|
25393
|
+
void 0,
|
|
25394
|
+
api.API_ERROR_CODES.INVALID_FORMAT
|
|
25395
|
+
);
|
|
25396
|
+
}
|
|
25397
|
+
const serviceDefaults = {
|
|
25398
|
+
retry: { attempts: 1 },
|
|
25399
|
+
timeout: 1e4
|
|
25400
|
+
};
|
|
25401
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25402
|
+
const updateOptions = {
|
|
25403
|
+
strategy: "temporary",
|
|
25404
|
+
...options?.updateConfigOptions
|
|
25405
|
+
};
|
|
25406
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25407
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25408
|
+
}
|
|
25409
|
+
return client.updateScheduledEmailStatuses({
|
|
25410
|
+
params,
|
|
25411
|
+
body: payload
|
|
25412
|
+
});
|
|
25413
|
+
}
|
|
25414
|
+
__name(updateInfobipScheduledEmailStatuses, "updateInfobipScheduledEmailStatuses");
|
|
25541
25415
|
function getSSRSafeConfig(config) {
|
|
25542
25416
|
if (!isBrowser()) {
|
|
25543
25417
|
return {
|
|
@@ -25755,17 +25629,29 @@ __name(toFetchffRevalidationConfig, "toFetchffRevalidationConfig");
|
|
|
25755
25629
|
resources: revalidationStrategies.static
|
|
25756
25630
|
});
|
|
25757
25631
|
|
|
25758
|
-
Object.defineProperty(exports, "
|
|
25632
|
+
Object.defineProperty(exports, "getErrorCategory", {
|
|
25759
25633
|
enumerable: true,
|
|
25760
|
-
get: function () { return
|
|
25634
|
+
get: function () { return errors$1.getErrorCategory; }
|
|
25761
25635
|
});
|
|
25762
|
-
Object.defineProperty(exports, "
|
|
25636
|
+
Object.defineProperty(exports, "getErrorCodeByStatus", {
|
|
25763
25637
|
enumerable: true,
|
|
25764
|
-
get: function () { return
|
|
25638
|
+
get: function () { return errors$1.getErrorCodeByStatus; }
|
|
25765
25639
|
});
|
|
25766
|
-
Object.defineProperty(exports, "
|
|
25640
|
+
Object.defineProperty(exports, "getErrorDefinition", {
|
|
25641
|
+
enumerable: true,
|
|
25642
|
+
get: function () { return errors$1.getErrorDefinition; }
|
|
25643
|
+
});
|
|
25644
|
+
Object.defineProperty(exports, "removeRevalidators", {
|
|
25645
|
+
enumerable: true,
|
|
25646
|
+
get: function () { return fetchff.removeRevalidators; }
|
|
25647
|
+
});
|
|
25648
|
+
Object.defineProperty(exports, "revalidate", {
|
|
25649
|
+
enumerable: true,
|
|
25650
|
+
get: function () { return fetchff.revalidate; }
|
|
25651
|
+
});
|
|
25652
|
+
Object.defineProperty(exports, "revalidateAll", {
|
|
25767
25653
|
enumerable: true,
|
|
25768
|
-
get: function () { return
|
|
25654
|
+
get: function () { return fetchff.revalidateAll; }
|
|
25769
25655
|
});
|
|
25770
25656
|
Object.defineProperty(exports, "NETWORK_QUALITY", {
|
|
25771
25657
|
enumerable: true,
|
|
@@ -25775,29 +25661,38 @@ Object.defineProperty(exports, "PUB_SUB_EVENT", {
|
|
|
25775
25661
|
enumerable: true,
|
|
25776
25662
|
get: function () { return api.PUB_SUB_EVENT; }
|
|
25777
25663
|
});
|
|
25778
|
-
Object.defineProperty(exports, "
|
|
25664
|
+
Object.defineProperty(exports, "API_ERROR_CODES", {
|
|
25779
25665
|
enumerable: true,
|
|
25780
|
-
get: function () { return
|
|
25666
|
+
get: function () { return errors.API_ERROR_CODES; }
|
|
25781
25667
|
});
|
|
25782
|
-
Object.defineProperty(exports, "
|
|
25668
|
+
Object.defineProperty(exports, "ERROR_DEFINITIONS", {
|
|
25783
25669
|
enumerable: true,
|
|
25784
|
-
get: function () { return
|
|
25670
|
+
get: function () { return errors.ERROR_DEFINITIONS; }
|
|
25785
25671
|
});
|
|
25786
|
-
Object.defineProperty(exports, "
|
|
25672
|
+
Object.defineProperty(exports, "ERROR_FIELDS", {
|
|
25787
25673
|
enumerable: true,
|
|
25788
|
-
get: function () { return
|
|
25674
|
+
get: function () { return errors.COMMON_FIELDS; }
|
|
25675
|
+
});
|
|
25676
|
+
Object.defineProperty(exports, "OPERATIONS", {
|
|
25677
|
+
enumerable: true,
|
|
25678
|
+
get: function () { return errors.COMMON_OPERATIONS; }
|
|
25679
|
+
});
|
|
25680
|
+
Object.defineProperty(exports, "STORAGE_TYPES", {
|
|
25681
|
+
enumerable: true,
|
|
25682
|
+
get: function () { return errors.COMMON_STORAGE_TYPES; }
|
|
25789
25683
|
});
|
|
25790
25684
|
exports.ALL_EVENTS = ALL_EVENTS;
|
|
25791
25685
|
exports.ApiPackageError = ApiPackageError;
|
|
25792
25686
|
exports.CACHE_EVENTS = CACHE_EVENTS2;
|
|
25793
25687
|
exports.CLIENT_EVENTS = CLIENT_EVENTS2;
|
|
25794
25688
|
exports.CONFIG_EVENTS = CONFIG_EVENTS2;
|
|
25689
|
+
exports.ClientEventManager = ClientEventManager;
|
|
25795
25690
|
exports.ConfigBuilder = ConfigBuilder;
|
|
25796
25691
|
exports.DEBUG_EVENTS = DEBUG_EVENTS2;
|
|
25797
25692
|
exports.ERROR_EVENTS = ERROR_EVENTS2;
|
|
25798
25693
|
exports.EVENT_NAMESPACES = EVENT_NAMESPACES2;
|
|
25799
|
-
exports.EVENT_SCOPES =
|
|
25800
|
-
exports.EVENT_SCOPES_WITH_TEMPORARY =
|
|
25694
|
+
exports.EVENT_SCOPES = EVENT_SCOPES;
|
|
25695
|
+
exports.EVENT_SCOPES_WITH_TEMPORARY = EVENT_SCOPES_WITH_TEMPORARY2;
|
|
25801
25696
|
exports.Environment = Environment;
|
|
25802
25697
|
exports.EventHelpers = EventHelpers;
|
|
25803
25698
|
exports.EventManager = EventManager;
|
|
@@ -25829,18 +25724,30 @@ exports.analyzeConflictPatterns = analyzeConflictPatterns;
|
|
|
25829
25724
|
exports.analyzeEventSystemIssues = analyzeEventSystemIssues;
|
|
25830
25725
|
exports.analyzeHistoryPatterns = analyzeHistoryPatterns;
|
|
25831
25726
|
exports.analyzePerformanceIssues = analyzePerformanceIssues;
|
|
25727
|
+
exports.applyCacheStrategyConfig = applyCacheStrategyConfig;
|
|
25832
25728
|
exports.applyConfigOverride = applyConfigOverride;
|
|
25833
25729
|
exports.applyConfigPreset = applyConfigPreset;
|
|
25834
25730
|
exports.applyConfigUpdate = applyConfigUpdate;
|
|
25731
|
+
exports.applyCustomQualityPresetStrategies = applyCustomQualityPresetStrategies;
|
|
25732
|
+
exports.applyHeaderPresets = applyHeaderPresets;
|
|
25733
|
+
exports.applyIndividualStrategies = applyIndividualStrategies;
|
|
25734
|
+
exports.applyPerformancePresetConfig = applyPerformancePresetConfig;
|
|
25835
25735
|
exports.applyPollingStrategy = applyPollingStrategy;
|
|
25736
|
+
exports.applyPollingStrategyConfig = applyPollingStrategyConfig;
|
|
25836
25737
|
exports.applyRetryStrategy = applyRetryStrategy;
|
|
25738
|
+
exports.applyRetryStrategyConfig = applyRetryStrategyConfig;
|
|
25837
25739
|
exports.applyRevalidationStrategy = applyRevalidationStrategy;
|
|
25838
25740
|
exports.applyTemporaryNetworkOverride = applyTemporaryNetworkOverride;
|
|
25839
25741
|
exports.applyUnifiedStrategy = applyUnifiedStrategy;
|
|
25742
|
+
exports.applyUnifiedStrategyToConfig = applyUnifiedStrategyToConfig;
|
|
25840
25743
|
exports.arrayOf = arrayOf;
|
|
25841
25744
|
exports.average = average;
|
|
25842
25745
|
exports.base64ToBytes = base64ToBytes;
|
|
25843
25746
|
exports.buildCacheKey = buildCacheKey;
|
|
25747
|
+
exports.buildEndpointUrl = buildEndpointUrl;
|
|
25748
|
+
exports.buildFullUrl = buildFullUrl;
|
|
25749
|
+
exports.buildUrl = buildUrl;
|
|
25750
|
+
exports.bulkValidateInfobipEmails = bulkValidateInfobipEmails;
|
|
25844
25751
|
exports.bytesToBase64 = bytesToBase64;
|
|
25845
25752
|
exports.cacheKeyPatterns = cacheKeyPatterns;
|
|
25846
25753
|
exports.cacheStrategies = cacheStrategies;
|
|
@@ -25848,7 +25755,9 @@ exports.calculateCacheDuration = calculateCacheDuration;
|
|
|
25848
25755
|
exports.calculatePerformanceImpact = calculatePerformanceImpact;
|
|
25849
25756
|
exports.calculatePollingDuration = calculatePollingDuration;
|
|
25850
25757
|
exports.calculateRequestMetrics = calculateRequestMetrics;
|
|
25758
|
+
exports.campaignEndpoints = campaignEndpoints;
|
|
25851
25759
|
exports.canPerformHeavyOperation = canPerformHeavyOperation;
|
|
25760
|
+
exports.checkOverrideTriggers = checkOverrideTriggers;
|
|
25852
25761
|
exports.clamp = clamp;
|
|
25853
25762
|
exports.clampedPercentage = clampedPercentage;
|
|
25854
25763
|
exports.clearErrorHandlers = clearErrorHandlers;
|
|
@@ -25873,7 +25782,6 @@ exports.createConfigBuilder = createConfigBuilder;
|
|
|
25873
25782
|
exports.createConfigHistoryEntry = createConfigHistoryEntry;
|
|
25874
25783
|
exports.createConfigState = createConfigState;
|
|
25875
25784
|
exports.createConflict = createConflict;
|
|
25876
|
-
exports.createCorrelationIdGenerator = createCorrelationIdGenerator;
|
|
25877
25785
|
exports.createCustomPreset = createCustomPreset;
|
|
25878
25786
|
exports.createCustomUnifiedStrategy = createCustomUnifiedStrategy;
|
|
25879
25787
|
exports.createDate = createDate;
|
|
@@ -25886,15 +25794,14 @@ exports.createEncryptionInterceptors = createEncryptionInterceptors;
|
|
|
25886
25794
|
exports.createEventEmitter = createEventEmitter;
|
|
25887
25795
|
exports.createHistoryEntry = createHistoryEntry;
|
|
25888
25796
|
exports.createHistorySummary = createHistorySummary;
|
|
25889
|
-
exports.createIdGenerator = createIdGenerator;
|
|
25890
25797
|
exports.createLimitedInterval = createLimitedInterval;
|
|
25891
25798
|
exports.createManagedInterval = createManagedInterval;
|
|
25892
25799
|
exports.createNetworkDetectionMiddleware = createNetworkDetectionMiddleware;
|
|
25893
25800
|
exports.createPerformanceAnalysis = createPerformanceAnalysis;
|
|
25894
25801
|
exports.createPerformanceBenchmark = createPerformanceBenchmark;
|
|
25895
25802
|
exports.createPollingStrategy = createPollingStrategy;
|
|
25803
|
+
exports.createPreservedConfig = createPreservedConfig;
|
|
25896
25804
|
exports.createProgressivePolling = createProgressivePolling;
|
|
25897
|
-
exports.createRequestIdGenerator = createRequestIdGenerator;
|
|
25898
25805
|
exports.createRetryConfig = createRetryConfig;
|
|
25899
25806
|
exports.createRetryStrategy = createRetryStrategy;
|
|
25900
25807
|
exports.createRevalidationKey = createRevalidationKey;
|
|
@@ -25920,21 +25827,27 @@ exports.disableNetworkConfigDebug = disableNetworkConfigDebug;
|
|
|
25920
25827
|
exports.enableNetworkConfigDebug = enableNetworkConfigDebug;
|
|
25921
25828
|
exports.encrypt = encrypt;
|
|
25922
25829
|
exports.endOfDay = endOfDay;
|
|
25830
|
+
exports.endpointCacheKey = endpointCacheKey;
|
|
25831
|
+
exports.endpointCachePattern = endpointCachePattern;
|
|
25832
|
+
exports.endpointCachePatterns = endpointCachePatterns;
|
|
25833
|
+
exports.endpoints = endpoints;
|
|
25923
25834
|
exports.eventManager = eventManager;
|
|
25924
25835
|
exports.exportKeyToBase64 = exportKeyToBase64;
|
|
25925
25836
|
exports.extendRevalidationPresets = extendPresets;
|
|
25926
|
-
exports.extractBaseCorrelationId = extractBaseCorrelationId;
|
|
25927
|
-
exports.extractBaseId = extractBaseId;
|
|
25928
|
-
exports.extractBaseRequestId = extractBaseRequestId;
|
|
25929
|
-
exports.extractCorrelationType = extractCorrelationType;
|
|
25930
25837
|
exports.extractFields = extractFields;
|
|
25931
|
-
exports.
|
|
25838
|
+
exports.extractUrlParams = extractUrlParams;
|
|
25932
25839
|
exports.fetchCampaign = fetchCampaign;
|
|
25933
25840
|
exports.fetchCampaignParticipants = fetchCampaignParticipants;
|
|
25934
25841
|
exports.fetchCampaignStats = fetchCampaignStats;
|
|
25935
25842
|
exports.fetchCampaigns = fetchCampaigns;
|
|
25843
|
+
exports.fetchInfobipEmailLogs = fetchInfobipEmailLogs;
|
|
25844
|
+
exports.fetchInfobipEmailReports = fetchInfobipEmailReports;
|
|
25845
|
+
exports.fetchInfobipScheduledEmailStatuses = fetchInfobipScheduledEmailStatuses;
|
|
25846
|
+
exports.fetchInfobipScheduledEmails = fetchInfobipScheduledEmails;
|
|
25847
|
+
exports.fetchInfobipValidations = fetchInfobipValidations;
|
|
25936
25848
|
exports.filterHistory = filterHistory;
|
|
25937
25849
|
exports.filterObject = filterObject;
|
|
25850
|
+
exports.findEndpointsByPattern = findEndpointsByPattern;
|
|
25938
25851
|
exports.findMatchingPaths = findMatchingPaths;
|
|
25939
25852
|
exports.flattenObject = flattenObject;
|
|
25940
25853
|
exports.formatDuration = formatDuration;
|
|
@@ -25943,22 +25856,11 @@ exports.formatTimeForInterval = formatTimeForInterval;
|
|
|
25943
25856
|
exports.fromFetchffConfig = fromFetchffConfig;
|
|
25944
25857
|
exports.fromISOString = fromISOString;
|
|
25945
25858
|
exports.fromUnixTimestamp = fromUnixTimestamp;
|
|
25946
|
-
exports.generateApiCorrelationId = generateApiCorrelationId;
|
|
25947
|
-
exports.generateBaseId = generateBaseId;
|
|
25948
25859
|
exports.generateComprehensiveReport = generateComprehensiveReport;
|
|
25949
|
-
exports.generateContextualCorrelationId = generateContextualCorrelationId;
|
|
25950
|
-
exports.generateContextualId = generateContextualId;
|
|
25951
|
-
exports.generateContextualRequestId = generateContextualRequestId;
|
|
25952
|
-
exports.generateCorrelationId = generateCorrelationId;
|
|
25953
25860
|
exports.generateIV = generateIV;
|
|
25954
25861
|
exports.generateIssueBreakdown = generateIssueBreakdown;
|
|
25955
|
-
exports.generateNetworkCorrelationId = generateNetworkCorrelationId;
|
|
25956
25862
|
exports.generateRandomKey = generateRandomKey;
|
|
25957
25863
|
exports.generateRecommendations = generateRecommendations;
|
|
25958
|
-
exports.generateRequestId = generateRequestId;
|
|
25959
|
-
exports.generateSessionCorrelationId = generateSessionCorrelationId;
|
|
25960
|
-
exports.generateShortRequestId = generateShortRequestId;
|
|
25961
|
-
exports.generateTraceCorrelationId = generateTraceCorrelationId;
|
|
25962
25864
|
exports.generateUUID = generateUUID;
|
|
25963
25865
|
exports.getActiveOverrideKeys = getActiveOverrideKeys;
|
|
25964
25866
|
exports.getAdaptiveApiConfig = getAdaptiveApiConfig;
|
|
@@ -25967,6 +25869,7 @@ exports.getAdaptiveCacheDuration = getAdaptiveCacheDuration;
|
|
|
25967
25869
|
exports.getAdaptiveConfig = getAdaptiveConfig;
|
|
25968
25870
|
exports.getAdaptivePageSize = getAdaptivePageSize;
|
|
25969
25871
|
exports.getAdaptiveTimeout = getAdaptiveTimeout;
|
|
25872
|
+
exports.getAllEndpointUrls = getAllEndpointUrls;
|
|
25970
25873
|
exports.getAllFieldPaths = getAllFieldPaths;
|
|
25971
25874
|
exports.getAllMediaExtensions = getAllMediaExtensions;
|
|
25972
25875
|
exports.getAppVersion = getAppVersion;
|
|
@@ -25987,14 +25890,16 @@ exports.getDeviceInfo = getDeviceInfo;
|
|
|
25987
25890
|
exports.getDocument = getDocument;
|
|
25988
25891
|
exports.getEffectiveConfig = getEffectiveConfig;
|
|
25989
25892
|
exports.getEffectiveConnectionType = getEffectiveConnectionType;
|
|
25893
|
+
exports.getEndpointConfig = getEndpointConfig;
|
|
25894
|
+
exports.getEndpointMetadata = getEndpointMetadata;
|
|
25895
|
+
exports.getEndpointParams = getEndpointParams;
|
|
25896
|
+
exports.getEndpointUrl = getEndpointUrl;
|
|
25897
|
+
exports.getEndpointsByMethod = getEndpointsByMethod;
|
|
25990
25898
|
exports.getEnhancedClientHints = getEnhancedClientHints;
|
|
25991
25899
|
exports.getEntries = getEntries;
|
|
25992
25900
|
exports.getEnv = getEnv;
|
|
25993
25901
|
exports.getEnvironmentInfo = getEnvironmentInfo;
|
|
25994
25902
|
exports.getEnvironmentName = getEnvironmentName;
|
|
25995
|
-
exports.getErrorCategory = getErrorCategory;
|
|
25996
|
-
exports.getErrorCodeByStatus = getErrorCodeByStatus;
|
|
25997
|
-
exports.getErrorDefinition = getErrorDefinition;
|
|
25998
25903
|
exports.getErrorHandlers = getErrorHandlers;
|
|
25999
25904
|
exports.getEventManager = getEventManager;
|
|
26000
25905
|
exports.getExtendedEnvironmentInfo = getExtendedEnvironmentInfo;
|
|
@@ -26028,6 +25933,7 @@ exports.getNetworkPreset = getNetworkPreset;
|
|
|
26028
25933
|
exports.getNetworkQuality = getNetworkQuality;
|
|
26029
25934
|
exports.getNetworkQualityFromHeaders = getNetworkQualityFromHeaders;
|
|
26030
25935
|
exports.getNetworkQualityScore = getNetworkQualityScore;
|
|
25936
|
+
exports.getNetworkQualityWithThresholds = getNetworkQualityWithThresholds;
|
|
26031
25937
|
exports.getNetworkRTT = getNetworkRTT;
|
|
26032
25938
|
exports.getNetworkSpeed = getNetworkSpeed;
|
|
26033
25939
|
exports.getNonCacheAffectingHeaders = getNonCacheAffectingHeaders;
|
|
@@ -26060,6 +25966,7 @@ exports.handleObjectMerge = handleObjectMerge;
|
|
|
26060
25966
|
exports.hasAnyExtension = hasAnyExtension;
|
|
26061
25967
|
exports.hasAuthentication = hasAuthentication;
|
|
26062
25968
|
exports.hasEncryptableFields = hasEncryptableFields;
|
|
25969
|
+
exports.hasEndpoint = hasEndpoint;
|
|
26063
25970
|
exports.hasGlobal = hasGlobal;
|
|
26064
25971
|
exports.hasIndexedDB = hasIndexedDB;
|
|
26065
25972
|
exports.hasLocalStorage = hasLocalStorage;
|
|
@@ -26067,6 +25974,7 @@ exports.hasMatchingFields = hasMatchingFields;
|
|
|
26067
25974
|
exports.hasNavigator = hasNavigator;
|
|
26068
25975
|
exports.hasNetworkInfoExpress = hasNetworkInfo2;
|
|
26069
25976
|
exports.hasNetworkInfoNextjs = hasNetworkInfo;
|
|
25977
|
+
exports.hasPathParams = hasPathParams;
|
|
26070
25978
|
exports.hasPreset = hasPreset;
|
|
26071
25979
|
exports.hasProperty = hasProperty;
|
|
26072
25980
|
exports.hasSessionStorage = hasSessionStorage;
|
|
@@ -26079,6 +25987,8 @@ exports.importKey = importKey;
|
|
|
26079
25987
|
exports.inBrowser = inBrowser;
|
|
26080
25988
|
exports.inRange = inRange;
|
|
26081
25989
|
exports.inServer = inServer;
|
|
25990
|
+
exports.infobipEmailEndpoints = infobipEmailEndpoints;
|
|
25991
|
+
exports.infobipEndpoints = infobipEndpoints;
|
|
26082
25992
|
exports.invalidationScenarios = invalidationScenarios;
|
|
26083
25993
|
exports.inverseLerp = inverseLerp;
|
|
26084
25994
|
exports.isAbortError = isAbortError;
|
|
@@ -26142,15 +26052,12 @@ exports.isTest = isTest;
|
|
|
26142
26052
|
exports.isToday = isToday;
|
|
26143
26053
|
exports.isTouchDevice = isTouchDevice;
|
|
26144
26054
|
exports.isUnifiedStrategyName = isUnifiedStrategyName;
|
|
26145
|
-
exports.isValidCorrelationId = isValidCorrelationId;
|
|
26146
26055
|
exports.isValidDate = isValidDate;
|
|
26147
26056
|
exports.isValidEnumValue = isValidEnumValue;
|
|
26148
26057
|
exports.isValidFieldPath = isValidFieldPath;
|
|
26149
|
-
exports.isValidId = isValidId;
|
|
26150
26058
|
exports.isValidJSON = isValidJSON;
|
|
26151
26059
|
exports.isValidNumber = isValidNumber2;
|
|
26152
26060
|
exports.isValidPollingConfig = isValidPollingConfig;
|
|
26153
|
-
exports.isValidRequestId = isValidRequestId;
|
|
26154
26061
|
exports.isValidRevalidationStrategyName = isValidStrategyName;
|
|
26155
26062
|
exports.isWebWorker = isWebWorker;
|
|
26156
26063
|
exports.isWifiConnection = isWifiConnection;
|
|
@@ -26162,7 +26069,6 @@ exports.jsonEquals = jsonEquals;
|
|
|
26162
26069
|
exports.keyBy = keyBy;
|
|
26163
26070
|
exports.leaveCampaign = leaveCampaign;
|
|
26164
26071
|
exports.lerp = lerp;
|
|
26165
|
-
exports.linkCorrelationIds = linkCorrelationIds;
|
|
26166
26072
|
exports.logNetworkConfigReport = logNetworkConfigReport;
|
|
26167
26073
|
exports.mapKeys = mapKeys;
|
|
26168
26074
|
exports.mapObject = mapObject;
|
|
@@ -26198,13 +26104,14 @@ exports.onceErrorHandler = onceErrorHandler;
|
|
|
26198
26104
|
exports.oneOf = oneOf;
|
|
26199
26105
|
exports.parseAndValidateNumber = parseAndValidateNumber;
|
|
26200
26106
|
exports.parseFieldPath = parseFieldPath;
|
|
26201
|
-
exports.parseId = parseId;
|
|
26202
26107
|
exports.percentage = percentage;
|
|
26203
26108
|
exports.pick = pick;
|
|
26109
|
+
exports.pollingEndpoints = pollingEndpoints;
|
|
26204
26110
|
exports.pollingStrategies = pollingStrategies;
|
|
26205
26111
|
exports.prepareRequestConfig = prepareRequestConfig;
|
|
26206
26112
|
exports.prepareRequestConfigWithEnrichedHeaders = prepareRequestConfigWithEnrichedHeaders;
|
|
26207
26113
|
exports.prettyStringify = prettyStringify;
|
|
26114
|
+
exports.processHeaders = processHeaders2;
|
|
26208
26115
|
exports.raceRequests = raceRequests;
|
|
26209
26116
|
exports.randomBetween = randomBetween;
|
|
26210
26117
|
exports.randomInt = randomInt;
|
|
@@ -26217,6 +26124,7 @@ exports.removeSensitiveHeaders = removeSensitiveHeaders;
|
|
|
26217
26124
|
exports.removeUndefined = removeUndefined;
|
|
26218
26125
|
exports.requestTracker = requestTracker;
|
|
26219
26126
|
exports.requestWithTimeout = requestWithTimeout;
|
|
26127
|
+
exports.rescheduleInfobipEmails = rescheduleInfobipEmails;
|
|
26220
26128
|
exports.resetGlobalConfig = resetGlobalConfig;
|
|
26221
26129
|
exports.resetRevalidationPresets = resetPresets;
|
|
26222
26130
|
exports.resolveConflict = resolveConflict;
|
|
@@ -26231,6 +26139,8 @@ exports.safeParseJSON = safeParseJSON;
|
|
|
26231
26139
|
exports.safeStringify = safeStringify;
|
|
26232
26140
|
exports.sanitizeHeaders = sanitizeHeaders2;
|
|
26233
26141
|
exports.secondsToMs = secondsToMs;
|
|
26142
|
+
exports.sendInfobipAdvancedEmail = sendInfobipAdvancedEmail;
|
|
26143
|
+
exports.sendInfobipEmail = sendInfobipEmail;
|
|
26234
26144
|
exports.sequentialRequests = sequentialRequests;
|
|
26235
26145
|
exports.setCache = setCache;
|
|
26236
26146
|
exports.setConfigWarnings = setConfigWarnings;
|
|
@@ -26239,7 +26149,9 @@ exports.setErrorHandlers = setErrorHandlers;
|
|
|
26239
26149
|
exports.setFieldValue = setFieldValue;
|
|
26240
26150
|
exports.setGlobalConfig = setGlobalConfig;
|
|
26241
26151
|
exports.setupClientEvents = setupClientEvents;
|
|
26152
|
+
exports.setupNetworkMonitoring = setupNetworkMonitoring;
|
|
26242
26153
|
exports.setupRouteChangeCleanup = setupRouteChangeCleanup;
|
|
26154
|
+
exports.setupTemporaryOverride = setupTemporaryOverride;
|
|
26243
26155
|
exports.shouldApplyConfig = shouldApplyConfig;
|
|
26244
26156
|
exports.shouldAutoRefresh = shouldAutoRefresh;
|
|
26245
26157
|
exports.shouldPrefetch = shouldPrefetch;
|
|
@@ -26272,7 +26184,9 @@ exports.toFetchffConfig = toFetchffConfig;
|
|
|
26272
26184
|
exports.toFetchffRevalidationConfig = toFetchffRevalidationConfig;
|
|
26273
26185
|
exports.toISOString = toISOString;
|
|
26274
26186
|
exports.trackConfig = trackConfig;
|
|
26187
|
+
exports.trackDirectCacheConfig = trackDirectCacheConfig;
|
|
26275
26188
|
exports.trackNetworkOverride = trackNetworkOverride;
|
|
26189
|
+
exports.trackSpreadProperties = trackSpreadProperties;
|
|
26276
26190
|
exports.trackableSpread = trackableSpread;
|
|
26277
26191
|
exports.transformFields = transformFields;
|
|
26278
26192
|
exports.truncateJSON = truncateJSON;
|
|
@@ -26280,6 +26194,7 @@ exports.unifiedStrategies = unifiedStrategies;
|
|
|
26280
26194
|
exports.unregisterErrorHandlers = unregisterErrorHandlers;
|
|
26281
26195
|
exports.updateCampaign = updateCampaign;
|
|
26282
26196
|
exports.updateGlobalConfig = updateGlobalConfig;
|
|
26197
|
+
exports.updateInfobipScheduledEmailStatuses = updateInfobipScheduledEmailStatuses;
|
|
26283
26198
|
exports.useAbortableRequest = useAbortableRequest;
|
|
26284
26199
|
exports.useApiConfigConflicts = useApiConfigConflicts;
|
|
26285
26200
|
exports.useApiDebugInfo = useApiDebugInfo;
|
|
@@ -26307,6 +26222,8 @@ exports.useUpdateCampaign = useUpdateCampaign;
|
|
|
26307
26222
|
exports.validateConfigUpdate = validateConfigUpdate;
|
|
26308
26223
|
exports.validateEncryptionConfig = validateEncryptionConfig;
|
|
26309
26224
|
exports.validateHeaders = validateHeaders2;
|
|
26225
|
+
exports.validateInfobipEmail = validateInfobipEmail;
|
|
26226
|
+
exports.validatePathParams = validatePathParams;
|
|
26310
26227
|
exports.validatePreset = validatePreset;
|
|
26311
26228
|
exports.waitForOnline = waitForOnline;
|
|
26312
26229
|
exports.withNetworkDetection = withNetworkDetection;
|