@plyaz/api 1.2.2 → 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/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 +1 -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 +1130 -1395
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1079 -1349
- 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.mjs
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { ERROR_CATEGORY as ErrorCategory } from '@plyaz/types';
|
|
4
|
-
import { API_ERROR_CODES, PRIORITY_LEVEL, EVENT_SCOPES, EVENT_NAMESPACES, HEADER_EVENTS, NETWORK_EVENTS, ERROR_EVENTS, DEBUG_EVENTS, CONFIG_EVENTS, PERFORMANCE_EVENTS, CACHE_EVENTS, CLIENT_EVENTS, NETWORK_QUALITY, EVENT_PRIORITY_MAP, PACKAGE_STATUS_CODES, OPERATIONS, HISTORY_TYPES, ERROR_DEFINITIONS as ERROR_DEFINITIONS$1, HANDLER_SCOPES as HANDLER_SCOPES$1, DEFAULT_THRESHOLDS, CORRELATION_TYPE, NETWORK_CONFIDENCE_LEVELS, ERROR_CATEGORY_TO_EMITTER_KEY, UPDATE_STRATEGIES, DEBUGGER_CONFIG_SOURCES, RTT_THRESHOLDS, SPEED_THRESHOLDS, REGIONAL_CONFIDENCE_LEVELS as REGIONAL_CONFIDENCE_LEVELS$1, COORDINATES, STORAGE_TYPES, ERROR_FIELDS, EVENT_OPERATIONS } from '@plyaz/types/api';
|
|
5
|
-
export { API_ERROR_CODES, ERROR_DEFINITIONS, NETWORK_QUALITY, PUB_SUB_EVENT } from '@plyaz/types/api';
|
|
1
|
+
import { ApiPackageError as ApiPackageError$1, emitScopedErrorEvent, generateCorrelationId, generateRequestId, generateTraceCorrelationId, registerEventFactory, registerErrorHandler as registerErrorHandler$1, registerScopedHandlers, setErrorHandlers as setErrorHandlers$1, getErrorHandlers as getErrorHandlers$1, unregisterScopedHandlers, clearErrorHandlers as clearErrorHandlers$1, registerOnceErrorHandler, isErrorSystemInitialized, setErrorLocale, addMessageCatalog, initializeErrorSystem } from '@plyaz/errors';
|
|
2
|
+
export { getErrorCategory, getErrorCodeByStatus, getErrorDefinition } from '@plyaz/errors';
|
|
6
3
|
import { abortRequest as abortRequest$1, isSlowConnection as isSlowConnection$1, deleteCache as deleteCache$1, getCache as getCache$1, mutate, setCache as setCache$1, subscribe as subscribe$1, revalidateAll as revalidateAll$1, revalidate, setDefaultConfig, createApiFetcher } from 'fetchff';
|
|
7
4
|
export { removeRevalidators, revalidate, revalidateAll } from 'fetchff';
|
|
5
|
+
import { PRIORITY_LEVEL, EVENT_SCOPES_WITH_TEMPORARY, EVENT_NAMESPACES, HEADER_EVENTS, NETWORK_EVENTS, ERROR_EVENTS, DEBUG_EVENTS, CONFIG_EVENTS, PERFORMANCE_EVENTS, CACHE_EVENTS, CLIENT_EVENTS, NETWORK_QUALITY, EVENT_PRIORITY_MAP, PACKAGE_STATUS_CODES, API_ERROR_CODES, OPERATIONS, HISTORY_TYPES, EVENT_SCOPES as EVENT_SCOPES$1, HANDLER_SCOPES as HANDLER_SCOPES$1, DEFAULT_THRESHOLDS, NETWORK_CONFIDENCE_LEVELS, UPDATE_STRATEGIES, DEBUGGER_CONFIG_SOURCES, RTT_THRESHOLDS, SPEED_THRESHOLDS, REGIONAL_CONFIDENCE_LEVELS as REGIONAL_CONFIDENCE_LEVELS$1, COORDINATES, STORAGE_TYPES, ERROR_FIELDS, EVENT_OPERATIONS } from '@plyaz/types/api';
|
|
6
|
+
export { NETWORK_QUALITY, PUB_SUB_EVENT } from '@plyaz/types/api';
|
|
7
|
+
import { ApiLogger } from '@plyaz/logger';
|
|
8
|
+
import { LOGGER_SERVICES } from '@plyaz/types';
|
|
9
|
+
import { isDev, HTTP_STATUS, TIME_CONSTANTS, NUMERIC_CONSTANTS, MULTIPLIERS, NETWORK_SCORES, NETWORK_TIMEOUTS, RETRY_BACKOFF, RETRY_DELAYS, RETRY_ATTEMPTS, DEDUPE_TIME, CACHE_STALE, CACHE_TTL, BATCH_SIZES, PAGE_SIZES, TIMEZONE_REGIONS, LOCALE_REGIONS_DETAILED, COUNTRY_REGIONS_DETAILED, DEFAULT_API_CONFIG, DEFAULT_API_CLIENT_OPTIONS } from '@plyaz/config';
|
|
8
10
|
import 'events';
|
|
11
|
+
import { INTERNAL_STATUS_CODES, API_ERROR_CODES as API_ERROR_CODES$1, COMMON_OPERATIONS } from '@plyaz/types/errors';
|
|
12
|
+
export { API_ERROR_CODES, ERROR_DEFINITIONS, COMMON_FIELDS as ERROR_FIELDS, COMMON_OPERATIONS as OPERATIONS, COMMON_STORAGE_TYPES as STORAGE_TYPES } from '@plyaz/types/errors';
|
|
9
13
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
10
14
|
import { Injectable, createParamDecorator } from '@nestjs/common';
|
|
11
15
|
import { Observable } from 'rxjs';
|
|
@@ -1009,302 +1013,6 @@ function applyPollingStrategy(strategy) {
|
|
|
1009
1013
|
return strategy;
|
|
1010
1014
|
}
|
|
1011
1015
|
__name(applyPollingStrategy, "applyPollingStrategy");
|
|
1012
|
-
var ERROR_DEFINITIONS = {
|
|
1013
|
-
// Authentication
|
|
1014
|
-
[API_ERROR_CODES.AUTH_UNAUTHORIZED]: {
|
|
1015
|
-
code: API_ERROR_CODES.AUTH_UNAUTHORIZED,
|
|
1016
|
-
status: HTTP_STATUS.UNAUTHORIZED,
|
|
1017
|
-
category: ERROR_CATEGORY.Authentication
|
|
1018
|
-
},
|
|
1019
|
-
[API_ERROR_CODES.AUTH_FORBIDDEN]: {
|
|
1020
|
-
code: API_ERROR_CODES.AUTH_FORBIDDEN,
|
|
1021
|
-
status: HTTP_STATUS.FORBIDDEN,
|
|
1022
|
-
category: ERROR_CATEGORY.Authorization
|
|
1023
|
-
},
|
|
1024
|
-
[API_ERROR_CODES.AUTH_TOKEN_EXPIRED]: {
|
|
1025
|
-
code: API_ERROR_CODES.AUTH_TOKEN_EXPIRED,
|
|
1026
|
-
status: HTTP_STATUS.UNAUTHORIZED,
|
|
1027
|
-
category: ERROR_CATEGORY.Authentication
|
|
1028
|
-
},
|
|
1029
|
-
[API_ERROR_CODES.AUTH_INVALID_CREDENTIALS]: {
|
|
1030
|
-
code: API_ERROR_CODES.AUTH_INVALID_CREDENTIALS,
|
|
1031
|
-
status: HTTP_STATUS.UNAUTHORIZED,
|
|
1032
|
-
category: ERROR_CATEGORY.Authentication
|
|
1033
|
-
},
|
|
1034
|
-
// Rate Limiting
|
|
1035
|
-
[API_ERROR_CODES.RATE_LIMIT_EXCEEDED]: {
|
|
1036
|
-
code: API_ERROR_CODES.RATE_LIMIT_EXCEEDED,
|
|
1037
|
-
status: HTTP_STATUS.TOO_MANY_REQUESTS,
|
|
1038
|
-
category: ERROR_CATEGORY.RateLimit
|
|
1039
|
-
},
|
|
1040
|
-
// Resource Errors
|
|
1041
|
-
[API_ERROR_CODES.RESOURCE_NOT_FOUND]: {
|
|
1042
|
-
code: API_ERROR_CODES.RESOURCE_NOT_FOUND,
|
|
1043
|
-
status: HTTP_STATUS.NOT_FOUND,
|
|
1044
|
-
category: ERROR_CATEGORY.NotFound
|
|
1045
|
-
},
|
|
1046
|
-
// System Errors
|
|
1047
|
-
[API_ERROR_CODES.INTERNAL_SERVER_ERROR]: {
|
|
1048
|
-
code: API_ERROR_CODES.INTERNAL_SERVER_ERROR,
|
|
1049
|
-
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1050
|
-
category: ERROR_CATEGORY.Server
|
|
1051
|
-
},
|
|
1052
|
-
[API_ERROR_CODES.SERVICE_UNAVAILABLE]: {
|
|
1053
|
-
code: API_ERROR_CODES.SERVICE_UNAVAILABLE,
|
|
1054
|
-
status: HTTP_STATUS.SERVICE_UNAVAILABLE,
|
|
1055
|
-
category: ERROR_CATEGORY.Server
|
|
1056
|
-
},
|
|
1057
|
-
[API_ERROR_CODES.EXTERNAL_SERVICE_ERROR]: {
|
|
1058
|
-
code: API_ERROR_CODES.EXTERNAL_SERVICE_ERROR,
|
|
1059
|
-
status: HTTP_STATUS.BAD_GATEWAY,
|
|
1060
|
-
category: ERROR_CATEGORY.ExternalService
|
|
1061
|
-
},
|
|
1062
|
-
// Validation
|
|
1063
|
-
[API_ERROR_CODES.VALIDATION_ERROR]: {
|
|
1064
|
-
code: API_ERROR_CODES.VALIDATION_ERROR,
|
|
1065
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1066
|
-
category: ERROR_CATEGORY.Validation
|
|
1067
|
-
},
|
|
1068
|
-
[API_ERROR_CODES.VALIDATION_FAILED]: {
|
|
1069
|
-
code: API_ERROR_CODES.VALIDATION_FAILED,
|
|
1070
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1071
|
-
category: ERROR_CATEGORY.Validation
|
|
1072
|
-
},
|
|
1073
|
-
[API_ERROR_CODES.REQUIRED_FIELD_MISSING]: {
|
|
1074
|
-
code: API_ERROR_CODES.REQUIRED_FIELD_MISSING,
|
|
1075
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1076
|
-
category: ERROR_CATEGORY.Validation,
|
|
1077
|
-
fieldsLeft: ["field"]
|
|
1078
|
-
},
|
|
1079
|
-
[API_ERROR_CODES.INVALID_FORMAT]: {
|
|
1080
|
-
code: API_ERROR_CODES.INVALID_FORMAT,
|
|
1081
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1082
|
-
category: ERROR_CATEGORY.Validation
|
|
1083
|
-
},
|
|
1084
|
-
[API_ERROR_CODES.STRING_TOO_SHORT]: {
|
|
1085
|
-
code: API_ERROR_CODES.STRING_TOO_SHORT,
|
|
1086
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1087
|
-
category: ERROR_CATEGORY.Validation,
|
|
1088
|
-
fieldsLeft: ["field", "minLength"]
|
|
1089
|
-
},
|
|
1090
|
-
[API_ERROR_CODES.STRING_TOO_LONG]: {
|
|
1091
|
-
code: API_ERROR_CODES.STRING_TOO_LONG,
|
|
1092
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1093
|
-
category: ERROR_CATEGORY.Validation,
|
|
1094
|
-
fieldsLeft: ["field", "maxLength"]
|
|
1095
|
-
},
|
|
1096
|
-
// Request Errors
|
|
1097
|
-
[API_ERROR_CODES.REQUEST_TIMEOUT]: {
|
|
1098
|
-
code: API_ERROR_CODES.REQUEST_TIMEOUT,
|
|
1099
|
-
status: HTTP_STATUS.REQUEST_TIMEOUT,
|
|
1100
|
-
category: ERROR_CATEGORY.Timeout
|
|
1101
|
-
},
|
|
1102
|
-
[API_ERROR_CODES.REQUEST_ABORTED]: {
|
|
1103
|
-
code: API_ERROR_CODES.REQUEST_ABORTED,
|
|
1104
|
-
status: 0,
|
|
1105
|
-
// No HTTP status for aborted
|
|
1106
|
-
category: ERROR_CATEGORY.Client
|
|
1107
|
-
},
|
|
1108
|
-
[API_ERROR_CODES.REQUEST_INVALID_PARAMS]: {
|
|
1109
|
-
code: API_ERROR_CODES.REQUEST_INVALID_PARAMS,
|
|
1110
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1111
|
-
category: ERROR_CATEGORY.Client
|
|
1112
|
-
},
|
|
1113
|
-
[API_ERROR_CODES.REQUEST_PREPARATION_FAILED]: {
|
|
1114
|
-
code: API_ERROR_CODES.REQUEST_PREPARATION_FAILED,
|
|
1115
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1116
|
-
category: ERROR_CATEGORY.Client
|
|
1117
|
-
},
|
|
1118
|
-
// Response Errors
|
|
1119
|
-
[API_ERROR_CODES.RESPONSE_INVALID_FORMAT]: {
|
|
1120
|
-
code: API_ERROR_CODES.RESPONSE_INVALID_FORMAT,
|
|
1121
|
-
status: HTTP_STATUS.UNPROCESSABLE_ENTITY,
|
|
1122
|
-
category: ERROR_CATEGORY.Client
|
|
1123
|
-
},
|
|
1124
|
-
[API_ERROR_CODES.RESPONSE_PARSING_FAILED]: {
|
|
1125
|
-
code: API_ERROR_CODES.RESPONSE_PARSING_FAILED,
|
|
1126
|
-
status: HTTP_STATUS.UNPROCESSABLE_ENTITY,
|
|
1127
|
-
category: ERROR_CATEGORY.Client
|
|
1128
|
-
},
|
|
1129
|
-
// Network
|
|
1130
|
-
[API_ERROR_CODES.NETWORK_ERROR]: {
|
|
1131
|
-
code: API_ERROR_CODES.NETWORK_ERROR,
|
|
1132
|
-
status: HTTP_STATUS.BAD_GATEWAY,
|
|
1133
|
-
category: ERROR_CATEGORY.Network
|
|
1134
|
-
},
|
|
1135
|
-
[API_ERROR_CODES.NETWORK_TIMEOUT]: {
|
|
1136
|
-
code: API_ERROR_CODES.NETWORK_TIMEOUT,
|
|
1137
|
-
status: HTTP_STATUS.GATEWAY_TIMEOUT,
|
|
1138
|
-
category: ERROR_CATEGORY.Timeout
|
|
1139
|
-
},
|
|
1140
|
-
[API_ERROR_CODES.NETWORK_CONNECTION_FAILED]: {
|
|
1141
|
-
code: API_ERROR_CODES.NETWORK_CONNECTION_FAILED,
|
|
1142
|
-
status: 0,
|
|
1143
|
-
// No HTTP status for connection failure
|
|
1144
|
-
category: ERROR_CATEGORY.Network
|
|
1145
|
-
},
|
|
1146
|
-
[API_ERROR_CODES.NETWORK_OFFLINE]: {
|
|
1147
|
-
code: API_ERROR_CODES.NETWORK_OFFLINE,
|
|
1148
|
-
status: 0,
|
|
1149
|
-
// No HTTP status for offline
|
|
1150
|
-
category: ERROR_CATEGORY.Network
|
|
1151
|
-
},
|
|
1152
|
-
[API_ERROR_CODES.NETWORK_DNS_FAILED]: {
|
|
1153
|
-
code: API_ERROR_CODES.NETWORK_DNS_FAILED,
|
|
1154
|
-
status: 0,
|
|
1155
|
-
// No HTTP status for DNS failure
|
|
1156
|
-
category: ERROR_CATEGORY.Network
|
|
1157
|
-
},
|
|
1158
|
-
// Server
|
|
1159
|
-
[API_ERROR_CODES.SERVER_ERROR]: {
|
|
1160
|
-
code: API_ERROR_CODES.SERVER_ERROR,
|
|
1161
|
-
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1162
|
-
category: ERROR_CATEGORY.Server
|
|
1163
|
-
},
|
|
1164
|
-
// Client
|
|
1165
|
-
[API_ERROR_CODES.CLIENT_ERROR]: {
|
|
1166
|
-
code: API_ERROR_CODES.CLIENT_ERROR,
|
|
1167
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1168
|
-
category: ERROR_CATEGORY.Client
|
|
1169
|
-
},
|
|
1170
|
-
[API_ERROR_CODES.CLIENT_CANCELLED]: {
|
|
1171
|
-
code: API_ERROR_CODES.CLIENT_CANCELLED,
|
|
1172
|
-
status: 0,
|
|
1173
|
-
// No HTTP status for cancelled
|
|
1174
|
-
category: ERROR_CATEGORY.Client
|
|
1175
|
-
},
|
|
1176
|
-
[API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED]: {
|
|
1177
|
-
code: API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED,
|
|
1178
|
-
status: 0,
|
|
1179
|
-
// No HTTP status for initialization failure
|
|
1180
|
-
category: ERROR_CATEGORY.Client
|
|
1181
|
-
},
|
|
1182
|
-
[API_ERROR_CODES.CLIENT_INVALID_CONFIG]: {
|
|
1183
|
-
code: API_ERROR_CODES.CLIENT_INVALID_CONFIG,
|
|
1184
|
-
status: 0,
|
|
1185
|
-
// No HTTP status for configuration errors
|
|
1186
|
-
category: ERROR_CATEGORY.Client
|
|
1187
|
-
},
|
|
1188
|
-
[API_ERROR_CODES.CLIENT_MISSING_BASE_URL]: {
|
|
1189
|
-
code: API_ERROR_CODES.CLIENT_MISSING_BASE_URL,
|
|
1190
|
-
status: 0,
|
|
1191
|
-
// No HTTP status for configuration errors
|
|
1192
|
-
category: ERROR_CATEGORY.Client
|
|
1193
|
-
},
|
|
1194
|
-
[API_ERROR_CODES.CONFIG_VALIDATION_FAILED]: {
|
|
1195
|
-
code: API_ERROR_CODES.CONFIG_VALIDATION_FAILED,
|
|
1196
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1197
|
-
category: ERROR_CATEGORY.Validation
|
|
1198
|
-
},
|
|
1199
|
-
[API_ERROR_CODES.HEADER_PROCESSING_FAILED]: {
|
|
1200
|
-
code: API_ERROR_CODES.HEADER_PROCESSING_FAILED,
|
|
1201
|
-
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1202
|
-
category: ERROR_CATEGORY.Headers
|
|
1203
|
-
},
|
|
1204
|
-
[API_ERROR_CODES.NETWORK_OVERRIDE_FAILED]: {
|
|
1205
|
-
code: API_ERROR_CODES.NETWORK_OVERRIDE_FAILED,
|
|
1206
|
-
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1207
|
-
category: ERROR_CATEGORY.Network
|
|
1208
|
-
},
|
|
1209
|
-
// Headers
|
|
1210
|
-
[API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED]: {
|
|
1211
|
-
code: API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED,
|
|
1212
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1213
|
-
category: ERROR_CATEGORY.Headers
|
|
1214
|
-
},
|
|
1215
|
-
[API_ERROR_CODES.HEADERS_VALIDATION_FAILED]: {
|
|
1216
|
-
code: API_ERROR_CODES.HEADERS_VALIDATION_FAILED,
|
|
1217
|
-
status: HTTP_STATUS.BAD_REQUEST,
|
|
1218
|
-
category: ERROR_CATEGORY.Headers
|
|
1219
|
-
},
|
|
1220
|
-
[API_ERROR_CODES.HEADERS_MERGE_CONFLICT]: {
|
|
1221
|
-
code: API_ERROR_CODES.HEADERS_MERGE_CONFLICT,
|
|
1222
|
-
status: HTTP_STATUS.CONFLICT,
|
|
1223
|
-
category: ERROR_CATEGORY.Headers
|
|
1224
|
-
},
|
|
1225
|
-
// Cache
|
|
1226
|
-
[API_ERROR_CODES.CACHE_STORAGE_FAILED]: {
|
|
1227
|
-
code: API_ERROR_CODES.CACHE_STORAGE_FAILED,
|
|
1228
|
-
status: 0,
|
|
1229
|
-
// No HTTP status for cache failures
|
|
1230
|
-
category: ERROR_CATEGORY.Cache
|
|
1231
|
-
},
|
|
1232
|
-
[API_ERROR_CODES.CACHE_RETRIEVAL_FAILED]: {
|
|
1233
|
-
code: API_ERROR_CODES.CACHE_RETRIEVAL_FAILED,
|
|
1234
|
-
status: 0,
|
|
1235
|
-
// No HTTP status for cache failures
|
|
1236
|
-
category: ERROR_CATEGORY.Cache
|
|
1237
|
-
},
|
|
1238
|
-
[API_ERROR_CODES.CACHE_INVALIDATION_FAILED]: {
|
|
1239
|
-
code: API_ERROR_CODES.CACHE_INVALIDATION_FAILED,
|
|
1240
|
-
status: 0,
|
|
1241
|
-
// No HTTP status for cache failures
|
|
1242
|
-
category: ERROR_CATEGORY.Cache
|
|
1243
|
-
},
|
|
1244
|
-
// Retry
|
|
1245
|
-
[API_ERROR_CODES.RETRY_EXHAUSTED]: {
|
|
1246
|
-
code: API_ERROR_CODES.RETRY_EXHAUSTED,
|
|
1247
|
-
status: HTTP_STATUS.SERVICE_UNAVAILABLE,
|
|
1248
|
-
category: ERROR_CATEGORY.Retry
|
|
1249
|
-
},
|
|
1250
|
-
[API_ERROR_CODES.RETRY_STRATEGY_INVALID]: {
|
|
1251
|
-
code: API_ERROR_CODES.RETRY_STRATEGY_INVALID,
|
|
1252
|
-
status: 0,
|
|
1253
|
-
// No HTTP status for strategy errors
|
|
1254
|
-
category: ERROR_CATEGORY.Retry
|
|
1255
|
-
},
|
|
1256
|
-
// Strategy
|
|
1257
|
-
[API_ERROR_CODES.STRATEGY_INVALID]: {
|
|
1258
|
-
code: API_ERROR_CODES.STRATEGY_INVALID,
|
|
1259
|
-
status: 0,
|
|
1260
|
-
// No HTTP status for strategy errors
|
|
1261
|
-
category: ERROR_CATEGORY.Strategy
|
|
1262
|
-
},
|
|
1263
|
-
[API_ERROR_CODES.STRATEGY_CONFLICT]: {
|
|
1264
|
-
code: API_ERROR_CODES.STRATEGY_CONFLICT,
|
|
1265
|
-
status: HTTP_STATUS.CONFLICT,
|
|
1266
|
-
category: ERROR_CATEGORY.Strategy
|
|
1267
|
-
},
|
|
1268
|
-
// Regional
|
|
1269
|
-
[API_ERROR_CODES.REGIONAL_PRESET_NOT_FOUND]: {
|
|
1270
|
-
code: API_ERROR_CODES.REGIONAL_PRESET_NOT_FOUND,
|
|
1271
|
-
status: 0,
|
|
1272
|
-
// No HTTP status for regional preset errors
|
|
1273
|
-
category: ERROR_CATEGORY.Regional
|
|
1274
|
-
},
|
|
1275
|
-
[API_ERROR_CODES.REGION_DETECTION_FAILED]: {
|
|
1276
|
-
code: API_ERROR_CODES.REGION_DETECTION_FAILED,
|
|
1277
|
-
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1278
|
-
category: ERROR_CATEGORY.Regional
|
|
1279
|
-
},
|
|
1280
|
-
// Timeout
|
|
1281
|
-
[API_ERROR_CODES.TIMEOUT]: {
|
|
1282
|
-
code: API_ERROR_CODES.TIMEOUT,
|
|
1283
|
-
status: HTTP_STATUS.REQUEST_TIMEOUT,
|
|
1284
|
-
category: ERROR_CATEGORY.Timeout
|
|
1285
|
-
},
|
|
1286
|
-
// Unknown
|
|
1287
|
-
[API_ERROR_CODES.UNKNOWN_ERROR]: {
|
|
1288
|
-
code: API_ERROR_CODES.UNKNOWN_ERROR,
|
|
1289
|
-
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
1290
|
-
category: ERROR_CATEGORY.Unknown
|
|
1291
|
-
}
|
|
1292
|
-
};
|
|
1293
|
-
function getErrorDefinition(errorCode) {
|
|
1294
|
-
return ERROR_DEFINITIONS[errorCode];
|
|
1295
|
-
}
|
|
1296
|
-
__name(getErrorDefinition, "getErrorDefinition");
|
|
1297
|
-
function getErrorCodeByStatus(status) {
|
|
1298
|
-
const entry = Object.entries(ERROR_DEFINITIONS).find(
|
|
1299
|
-
([, definition]) => definition.status === status
|
|
1300
|
-
);
|
|
1301
|
-
return entry?.[0];
|
|
1302
|
-
}
|
|
1303
|
-
__name(getErrorCodeByStatus, "getErrorCodeByStatus");
|
|
1304
|
-
function getErrorCategory(errorCode) {
|
|
1305
|
-
return ERROR_DEFINITIONS[errorCode]?.category ?? ERROR_CATEGORY.Unknown;
|
|
1306
|
-
}
|
|
1307
|
-
__name(getErrorCategory, "getErrorCategory");
|
|
1308
1016
|
var BINARY_HEAP = {
|
|
1309
1017
|
/** Number of children per node in binary heap */
|
|
1310
1018
|
CHILDREN_PER_NODE: 2,
|
|
@@ -2031,8 +1739,6 @@ function removeCircularReferences(obj) {
|
|
|
2031
1739
|
}
|
|
2032
1740
|
}
|
|
2033
1741
|
__name(removeCircularReferences, "removeCircularReferences");
|
|
2034
|
-
|
|
2035
|
-
// src/api/utils/time.ts
|
|
2036
1742
|
var MS_IN_SECOND = 1e3;
|
|
2037
1743
|
var SECONDS_PER_MINUTE = 60;
|
|
2038
1744
|
var MINUTES_PER_HOUR = 60;
|
|
@@ -2577,13 +2283,13 @@ var BaseEventFactory = class {
|
|
|
2577
2283
|
constructor(namespace, emitter) {
|
|
2578
2284
|
this.namespace = namespace;
|
|
2579
2285
|
this.emitter = emitter;
|
|
2580
|
-
|
|
2286
|
+
EVENT_SCOPES_WITH_TEMPORARY.forEach((scope) => {
|
|
2581
2287
|
this.scopedHandlers.set(scope, /* @__PURE__ */ new Map());
|
|
2582
2288
|
this.originalHandlers.set(scope, /* @__PURE__ */ new Map());
|
|
2583
2289
|
});
|
|
2584
2290
|
this.trackFactoryOperation("factory_initialized", {
|
|
2585
2291
|
namespace: this.namespace,
|
|
2586
|
-
scopesInitialized:
|
|
2292
|
+
scopesInitialized: EVENT_SCOPES_WITH_TEMPORARY.length,
|
|
2587
2293
|
emitterType: "EventEmitter"
|
|
2588
2294
|
});
|
|
2589
2295
|
}
|
|
@@ -2735,16 +2441,14 @@ var BaseEventFactory = class {
|
|
|
2735
2441
|
* - Non-scoped wildcards for backwards compatibility (e.g., headers:*)
|
|
2736
2442
|
*/
|
|
2737
2443
|
emitAcrossScopes(eventType, eventName, data, scopes) {
|
|
2738
|
-
const targetScopes = scopes ??
|
|
2739
|
-
const
|
|
2740
|
-
(s) => s === "temporary" ? "request" : s
|
|
2741
|
-
);
|
|
2742
|
-
const scopeOrder = [...EVENT_SCOPES];
|
|
2444
|
+
const targetScopes = scopes ?? EVENT_SCOPES_WITH_TEMPORARY;
|
|
2445
|
+
const scopeOrder = [...EVENT_SCOPES_WITH_TEMPORARY];
|
|
2743
2446
|
for (const scope of scopeOrder) {
|
|
2744
|
-
if (
|
|
2745
|
-
const
|
|
2447
|
+
if (targetScopes.includes(scope)) {
|
|
2448
|
+
const emitScope = scope === "temporary" ? "request" : scope;
|
|
2449
|
+
const namespacedEvent = `${emitScope}:${eventType}:${eventName}`;
|
|
2746
2450
|
this.emitter.emit(namespacedEvent, data);
|
|
2747
|
-
const wildcardEvent = `${
|
|
2451
|
+
const wildcardEvent = `${emitScope}:${eventType}:*`;
|
|
2748
2452
|
const wildcardData2 = typeof data === "object" && data !== null ? { ...data, originalEvent: eventName } : { data, originalEvent: eventName };
|
|
2749
2453
|
this.emitter.emit(wildcardEvent, wildcardData2);
|
|
2750
2454
|
}
|
|
@@ -2942,6 +2646,52 @@ var BaseEventFactory = class {
|
|
|
2942
2646
|
});
|
|
2943
2647
|
return this.createHandlerUnsubscribe(scope, eventName, handler, unsubscribes);
|
|
2944
2648
|
}
|
|
2649
|
+
/**
|
|
2650
|
+
* Remove a specific handler from a scoped event
|
|
2651
|
+
*
|
|
2652
|
+
* @param scope - The scope to remove from ('global', 'config', 'client', 'request')
|
|
2653
|
+
* @param eventName - The event name (e.g., 'validation', 'network', '*')
|
|
2654
|
+
* @param handler - The specific handler to remove (should be the original handler, not wrapped)
|
|
2655
|
+
*/
|
|
2656
|
+
removeScopedHandler(scope, eventName, handler) {
|
|
2657
|
+
const startTime = Date.now();
|
|
2658
|
+
const scopeMap = this.scopedHandlers.get(scope);
|
|
2659
|
+
const originalMap = this.originalHandlers.get(scope);
|
|
2660
|
+
if (!scopeMap || !originalMap) {
|
|
2661
|
+
return;
|
|
2662
|
+
}
|
|
2663
|
+
const handlers = scopeMap.get(eventName);
|
|
2664
|
+
const originals = originalMap.get(eventName);
|
|
2665
|
+
if (!handlers || !originals) {
|
|
2666
|
+
return;
|
|
2667
|
+
}
|
|
2668
|
+
const handlerAsUnknown = handler;
|
|
2669
|
+
const originalIndex = originals.indexOf(handlerAsUnknown);
|
|
2670
|
+
if (originalIndex === -1) {
|
|
2671
|
+
return;
|
|
2672
|
+
}
|
|
2673
|
+
const beforeCount = handlers.length;
|
|
2674
|
+
const wrappedHandler = handlers[originalIndex];
|
|
2675
|
+
handlers.splice(originalIndex, 1);
|
|
2676
|
+
originals.splice(originalIndex, 1);
|
|
2677
|
+
const scopedEventKey = `${scope}:${this.namespace}:${eventName}`;
|
|
2678
|
+
this.emitter.off(scopedEventKey, wrappedHandler);
|
|
2679
|
+
if (handlers.length === 0) {
|
|
2680
|
+
scopeMap.delete(eventName);
|
|
2681
|
+
originalMap.delete(eventName);
|
|
2682
|
+
} else {
|
|
2683
|
+
scopeMap.set(eventName, handlers);
|
|
2684
|
+
originalMap.set(eventName, originals);
|
|
2685
|
+
}
|
|
2686
|
+
this.trackFactoryOperation("specific_handler_removed", {
|
|
2687
|
+
scope,
|
|
2688
|
+
eventName,
|
|
2689
|
+
beforeHandlerCount: beforeCount,
|
|
2690
|
+
afterHandlerCount: handlers.length,
|
|
2691
|
+
eventDeleted: handlers.length === 0,
|
|
2692
|
+
removalTime: Date.now() - startTime
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2945
2695
|
/**
|
|
2946
2696
|
* Remove all listeners for a scoped event
|
|
2947
2697
|
*
|
|
@@ -4690,13 +4440,13 @@ var HANDLER_SCOPES = {
|
|
|
4690
4440
|
REQUEST: "request"
|
|
4691
4441
|
// Request-level handlers (highest priority, per-request)
|
|
4692
4442
|
};
|
|
4693
|
-
var
|
|
4443
|
+
var EVENT_SCOPES = [
|
|
4694
4444
|
HANDLER_SCOPES.GLOBAL,
|
|
4695
4445
|
HANDLER_SCOPES.CONFIG,
|
|
4696
4446
|
HANDLER_SCOPES.CLIENT,
|
|
4697
4447
|
HANDLER_SCOPES.REQUEST
|
|
4698
4448
|
];
|
|
4699
|
-
var
|
|
4449
|
+
var EVENT_SCOPES_WITH_TEMPORARY2 = [...EVENT_SCOPES, "temporary"];
|
|
4700
4450
|
function createHandlerNamespace(eventType, scope) {
|
|
4701
4451
|
return `${HANDLER_SCOPES[scope]}:${eventType}`;
|
|
4702
4452
|
}
|
|
@@ -4888,6 +4638,7 @@ __name(getHandlerNamespaceForEvent, "getHandlerNamespaceForEvent");
|
|
|
4888
4638
|
|
|
4889
4639
|
// src/api/events/EventManager.ts
|
|
4890
4640
|
var SLOW_REQUEST_THRESHOLD_MS = 5e3;
|
|
4641
|
+
var logger = new ApiLogger({ service: LOGGER_SERVICES.EVENT_MANAGER, transport: "console" });
|
|
4891
4642
|
var EventManager = class _EventManager extends BaseEventFactory {
|
|
4892
4643
|
static {
|
|
4893
4644
|
__name(this, "EventManager");
|
|
@@ -4905,7 +4656,7 @@ var EventManager = class _EventManager extends BaseEventFactory {
|
|
|
4905
4656
|
// DEFAULT: ALL scopes are active ['global', 'config', 'client', 'request']
|
|
4906
4657
|
// This means events are emitted to handlers at all scope levels by default
|
|
4907
4658
|
// Can be restricted by calling setEventScopes() with specific scopes
|
|
4908
|
-
eventScopes = [...
|
|
4659
|
+
eventScopes = [...EVENT_SCOPES];
|
|
4909
4660
|
currentEventScopes = this.eventScopes;
|
|
4910
4661
|
// Alias for compatibility
|
|
4911
4662
|
constructor() {
|
|
@@ -5081,9 +4832,10 @@ var EventManager = class _EventManager extends BaseEventFactory {
|
|
|
5081
4832
|
*/
|
|
5082
4833
|
setupDebugHandlers() {
|
|
5083
4834
|
this.on(DEBUG_EVENTS2.CONFIG_CONFLICT, (event) => {
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
4835
|
+
logger.debug("Config conflict detected", {
|
|
4836
|
+
conflictType: event.type,
|
|
4837
|
+
source: event.source
|
|
4838
|
+
});
|
|
5087
4839
|
});
|
|
5088
4840
|
}
|
|
5089
4841
|
/**
|
|
@@ -5377,6 +5129,7 @@ var eventManager = {
|
|
|
5377
5129
|
getEventStats: /* @__PURE__ */ __name(() => getEventManager().getEventStats(), "getEventStats"),
|
|
5378
5130
|
getActiveScopes: /* @__PURE__ */ __name(() => getEventManager().getActiveScopes(), "getActiveScopes")
|
|
5379
5131
|
};
|
|
5132
|
+
var logger2 = new ApiLogger({ service: LOGGER_SERVICES.EVENT_QUEUE, transport: "console" });
|
|
5380
5133
|
var EventQueueManager = class _EventQueueManager {
|
|
5381
5134
|
static {
|
|
5382
5135
|
__name(this, "EventQueueManager");
|
|
@@ -5478,7 +5231,11 @@ var EventQueueManager = class _EventQueueManager {
|
|
|
5478
5231
|
}
|
|
5479
5232
|
}
|
|
5480
5233
|
if (isDev) {
|
|
5481
|
-
|
|
5234
|
+
logger2.warn("Event processing failed", {
|
|
5235
|
+
eventType: event.eventType,
|
|
5236
|
+
eventName: event.eventName,
|
|
5237
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5238
|
+
});
|
|
5482
5239
|
}
|
|
5483
5240
|
}
|
|
5484
5241
|
}
|
|
@@ -7517,6 +7274,7 @@ function colorProgressBar(value, max2, width = DEFAULT_PROGRESS_BAR_WIDTH) {
|
|
|
7517
7274
|
return `[${bar}] ${percentText}`;
|
|
7518
7275
|
}
|
|
7519
7276
|
__name(colorProgressBar, "colorProgressBar");
|
|
7277
|
+
var logger3 = new ApiLogger({ service: LOGGER_SERVICES.DEBUG_REPORT, transport: "console" });
|
|
7520
7278
|
var DEBUG_REPORT_CONSTANTS = {
|
|
7521
7279
|
// Byte sizes
|
|
7522
7280
|
BYTES_PER_KB: 1024,
|
|
@@ -9262,24 +9020,26 @@ function logNetworkOverride(params) {
|
|
|
9262
9020
|
networkQuality,
|
|
9263
9021
|
duration
|
|
9264
9022
|
} = params;
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9023
|
+
logger3.group(`🔧 Network Config Override: ${property}`);
|
|
9024
|
+
logger3.info("Value changed", {
|
|
9025
|
+
from: originalValue,
|
|
9026
|
+
to: overrideValue
|
|
9027
|
+
});
|
|
9028
|
+
logger3.info("Source", { source });
|
|
9029
|
+
logger3.info("Reason", { reason });
|
|
9269
9030
|
if (networkQuality) {
|
|
9270
|
-
|
|
9031
|
+
logger3.info("Network Quality", { quality: networkQuality.toLowerCase() });
|
|
9271
9032
|
}
|
|
9272
9033
|
if (networkInfo?.saveData) {
|
|
9273
|
-
|
|
9034
|
+
logger3.info("Save-Data enabled");
|
|
9274
9035
|
}
|
|
9275
9036
|
if (duration) {
|
|
9276
|
-
|
|
9037
|
+
logger3.info("Duration", { ms: duration });
|
|
9277
9038
|
}
|
|
9278
|
-
|
|
9039
|
+
logger3.groupEnd();
|
|
9279
9040
|
}
|
|
9280
9041
|
__name(logNetworkOverride, "logNetworkOverride");
|
|
9281
|
-
|
|
9282
|
-
// src/api/debugger/UnifiedDebugger.ts
|
|
9042
|
+
var logger4 = new ApiLogger({ service: LOGGER_SERVICES.UNIFIED_DEBUGGER, transport: "console" });
|
|
9283
9043
|
var DEBUGGER_CONSTANTS = {
|
|
9284
9044
|
// Array/Division constants
|
|
9285
9045
|
HALF_DIVISOR: 2,
|
|
@@ -9465,7 +9225,10 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
9465
9225
|
}
|
|
9466
9226
|
}
|
|
9467
9227
|
);
|
|
9468
|
-
|
|
9228
|
+
logger4.warn("⚠️ Debugger tracking failed", {
|
|
9229
|
+
error: apiError.message,
|
|
9230
|
+
context: apiError.context
|
|
9231
|
+
});
|
|
9469
9232
|
}
|
|
9470
9233
|
/**
|
|
9471
9234
|
* Safe tracking helper that handles errors properly
|
|
@@ -9800,11 +9563,11 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
9800
9563
|
try {
|
|
9801
9564
|
const presetReport = this.getPresetChangeReport();
|
|
9802
9565
|
if (presetReport) {
|
|
9803
|
-
|
|
9804
|
-
|
|
9566
|
+
logger4.info(presetReport);
|
|
9567
|
+
logger4.info("");
|
|
9805
9568
|
}
|
|
9806
9569
|
const report = await generateComprehensiveReport();
|
|
9807
|
-
|
|
9570
|
+
logger4.info(formatReportForConsole(report));
|
|
9808
9571
|
} catch (err) {
|
|
9809
9572
|
const error = new ApiPackageError(
|
|
9810
9573
|
"Failed to generate debug report",
|
|
@@ -9812,7 +9575,9 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
9812
9575
|
API_ERROR_CODES.DEBUG_TRACKING_FAILED,
|
|
9813
9576
|
{ cause: err }
|
|
9814
9577
|
);
|
|
9815
|
-
|
|
9578
|
+
logger4.error("⚠️ Failed to generate debug report", {
|
|
9579
|
+
error: error.message
|
|
9580
|
+
});
|
|
9816
9581
|
throw error;
|
|
9817
9582
|
}
|
|
9818
9583
|
}
|
|
@@ -10129,11 +9894,11 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10129
9894
|
trigger: options.trigger,
|
|
10130
9895
|
timestamp
|
|
10131
9896
|
};
|
|
10132
|
-
if (this.enabled
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
9897
|
+
if (this.enabled) {
|
|
9898
|
+
logger4.group(`📋 Network preset applied: ${options.preset}`);
|
|
9899
|
+
logger4.info(`Quality: ${options.networkConditions.quality}`);
|
|
9900
|
+
logger4.info(`Trigger: ${options.trigger}`);
|
|
9901
|
+
logger4.groupEnd();
|
|
10137
9902
|
}
|
|
10138
9903
|
}
|
|
10139
9904
|
options.changes.forEach((change) => {
|
|
@@ -10195,8 +9960,8 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10195
9960
|
source: "networkPreset",
|
|
10196
9961
|
reason: options.trigger
|
|
10197
9962
|
});
|
|
10198
|
-
if (this.enabled
|
|
10199
|
-
|
|
9963
|
+
if (this.enabled) {
|
|
9964
|
+
logger4.info("🔄 Network config restored", { property });
|
|
10200
9965
|
}
|
|
10201
9966
|
this.addToHistory({
|
|
10202
9967
|
type: "network",
|
|
@@ -10223,16 +9988,16 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10223
9988
|
trigger: options.trigger,
|
|
10224
9989
|
timestamp: Date.now()
|
|
10225
9990
|
};
|
|
10226
|
-
if (this.enabled
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
9991
|
+
if (this.enabled) {
|
|
9992
|
+
logger4.group(`📋 Network preset applied: ${presetId}`);
|
|
9993
|
+
logger4.info(`Quality: ${options.networkQuality}`);
|
|
9994
|
+
logger4.info(`Trigger: ${options.trigger}`);
|
|
10230
9995
|
changes.forEach((change) => {
|
|
10231
9996
|
const prev = typeof change.previousValue === "string" ? `"${change.previousValue}"` : String(change.previousValue);
|
|
10232
9997
|
const next = typeof change.newValue === "string" ? `"${change.newValue}"` : String(change.newValue);
|
|
10233
|
-
|
|
9998
|
+
logger4.info(` ${change.property}: ${prev} → ${next}`);
|
|
10234
9999
|
});
|
|
10235
|
-
|
|
10000
|
+
logger4.groupEnd();
|
|
10236
10001
|
}
|
|
10237
10002
|
const configChanges = changes.reduce(
|
|
10238
10003
|
(acc, change) => {
|
|
@@ -10655,14 +10420,14 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10655
10420
|
*/
|
|
10656
10421
|
enableNetworkDebug() {
|
|
10657
10422
|
this.setEnabled(true);
|
|
10658
|
-
|
|
10423
|
+
logger4.info("🌐 Network configuration debugging enabled");
|
|
10659
10424
|
}
|
|
10660
10425
|
/**
|
|
10661
10426
|
* Disable network config debugging
|
|
10662
10427
|
*/
|
|
10663
10428
|
disableNetworkDebug() {
|
|
10664
10429
|
this.setEnabled(false);
|
|
10665
|
-
|
|
10430
|
+
logger4.info("🌐 Network configuration debugging disabled");
|
|
10666
10431
|
}
|
|
10667
10432
|
/**
|
|
10668
10433
|
* Clear network debug data
|
|
@@ -10671,8 +10436,8 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10671
10436
|
this.networkOverrides.clear();
|
|
10672
10437
|
this.history = [];
|
|
10673
10438
|
this.lastPresetChange = void 0;
|
|
10674
|
-
if (this.enabled
|
|
10675
|
-
|
|
10439
|
+
if (this.enabled) {
|
|
10440
|
+
logger4.info("🗑️ Network configuration debug data cleared");
|
|
10676
10441
|
}
|
|
10677
10442
|
this.getDebugFactory().emitNetworkDataCleared();
|
|
10678
10443
|
eventManager.debug.emitNetworkDataCleared();
|
|
@@ -10693,7 +10458,7 @@ var UnifiedDebugger = class _UnifiedDebugger {
|
|
|
10693
10458
|
duration: config.duration
|
|
10694
10459
|
});
|
|
10695
10460
|
if (this.enabled && config.trigger) {
|
|
10696
|
-
|
|
10461
|
+
logger4.info(`🌐 Network override triggered by ${config.trigger}`, {
|
|
10697
10462
|
property: config.property,
|
|
10698
10463
|
value: config.overrideValue,
|
|
10699
10464
|
reason: config.reason
|
|
@@ -11074,6 +10839,9 @@ function validateConfigUpdate(updates, options) {
|
|
|
11074
10839
|
};
|
|
11075
10840
|
}
|
|
11076
10841
|
__name(validateConfigUpdate, "validateConfigUpdate");
|
|
10842
|
+
new ApiLogger({ service: LOGGER_SERVICES.CONFIG_QUEUE, transport: "console" });
|
|
10843
|
+
new ApiLogger({ service: LOGGER_SERVICES.QUEUE_ORCHESTRATOR, transport: "console" });
|
|
10844
|
+
var logger7 = new ApiLogger({ service: LOGGER_SERVICES.OPERATION_TRACKER, transport: "console" });
|
|
11077
10845
|
var BaseOperationTracker = class {
|
|
11078
10846
|
constructor(queueName, priorityDetector, sourceDetector) {
|
|
11079
10847
|
this.queueName = queueName;
|
|
@@ -11138,7 +10906,10 @@ var BaseOperationTracker = class {
|
|
|
11138
10906
|
try {
|
|
11139
10907
|
await this.processor(op.data);
|
|
11140
10908
|
} catch (error) {
|
|
11141
|
-
|
|
10909
|
+
logger7.error("Failed to process operation", {
|
|
10910
|
+
queueName: this.queueName,
|
|
10911
|
+
error: error instanceof Error ? error.message : String(error)
|
|
10912
|
+
});
|
|
11142
10913
|
this.handleProcessingError(error, op.data);
|
|
11143
10914
|
}
|
|
11144
10915
|
}
|
|
@@ -11147,8 +10918,9 @@ var BaseOperationTracker = class {
|
|
|
11147
10918
|
*/
|
|
11148
10919
|
handleProcessingError(error, operation) {
|
|
11149
10920
|
if (isDev) {
|
|
11150
|
-
|
|
11151
|
-
|
|
10921
|
+
logger7.debug("Error processing operation", {
|
|
10922
|
+
queueName: this.queueName,
|
|
10923
|
+
error: error instanceof Error ? error.message : String(error),
|
|
11152
10924
|
operation: operation.operation,
|
|
11153
10925
|
event: operation.event
|
|
11154
10926
|
});
|
|
@@ -11227,6 +10999,14 @@ function createDefaultSourceDetector() {
|
|
|
11227
10999
|
};
|
|
11228
11000
|
}
|
|
11229
11001
|
__name(createDefaultSourceDetector, "createDefaultSourceDetector");
|
|
11002
|
+
new ApiLogger({
|
|
11003
|
+
service: LOGGER_SERVICES.EVENT_QUEUE_MANAGER,
|
|
11004
|
+
transport: "console"
|
|
11005
|
+
});
|
|
11006
|
+
var logger9 = new ApiLogger({
|
|
11007
|
+
service: LOGGER_SERVICES.DEBUGGER_QUEUE_MANAGER,
|
|
11008
|
+
transport: "console"
|
|
11009
|
+
});
|
|
11230
11010
|
var DebuggerQueueManager = class _DebuggerQueueManager {
|
|
11231
11011
|
static {
|
|
11232
11012
|
__name(this, "DebuggerQueueManager");
|
|
@@ -11298,7 +11078,9 @@ var DebuggerQueueManager = class _DebuggerQueueManager {
|
|
|
11298
11078
|
}
|
|
11299
11079
|
} catch (error) {
|
|
11300
11080
|
if (isDev) {
|
|
11301
|
-
|
|
11081
|
+
logger9.warn("Operation failed", {
|
|
11082
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11083
|
+
});
|
|
11302
11084
|
}
|
|
11303
11085
|
}
|
|
11304
11086
|
}
|
|
@@ -11391,6 +11173,7 @@ var DebuggerQueueManager = class _DebuggerQueueManager {
|
|
|
11391
11173
|
}
|
|
11392
11174
|
};
|
|
11393
11175
|
var MAX_RETRY_ATTEMPTS = 3;
|
|
11176
|
+
var logger10 = new ApiLogger({ service: LOGGER_SERVICES.OPERATION_TRACKER, transport: "console" });
|
|
11394
11177
|
var OperationTracker = class _OperationTracker extends BaseOperationTracker {
|
|
11395
11178
|
static {
|
|
11396
11179
|
__name(this, "OperationTracker");
|
|
@@ -11454,7 +11237,12 @@ var OperationTracker = class _OperationTracker extends BaseOperationTracker {
|
|
|
11454
11237
|
handleProcessingError(error, operation) {
|
|
11455
11238
|
const retryCount = operation.retryCount ?? 0;
|
|
11456
11239
|
if (operation.category === "debugging" && retryCount < MAX_RETRY_ATTEMPTS) {
|
|
11457
|
-
|
|
11240
|
+
logger10.warn("Retrying critical operation", {
|
|
11241
|
+
attempt: retryCount + 1,
|
|
11242
|
+
maxAttempts: MAX_RETRY_ATTEMPTS,
|
|
11243
|
+
operation: operation.operation,
|
|
11244
|
+
category: operation.category
|
|
11245
|
+
});
|
|
11458
11246
|
this.getQueue().add({
|
|
11459
11247
|
data: {
|
|
11460
11248
|
...operation,
|
|
@@ -11463,7 +11251,12 @@ var OperationTracker = class _OperationTracker extends BaseOperationTracker {
|
|
|
11463
11251
|
priority: PRIORITY_LEVEL.CRITICAL
|
|
11464
11252
|
});
|
|
11465
11253
|
} else {
|
|
11466
|
-
|
|
11254
|
+
logger10.error("Failed to process operation after retries", {
|
|
11255
|
+
operation: operation.operation,
|
|
11256
|
+
category: operation.category,
|
|
11257
|
+
retryCount,
|
|
11258
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11259
|
+
});
|
|
11467
11260
|
}
|
|
11468
11261
|
}
|
|
11469
11262
|
/**
|
|
@@ -11546,6 +11339,7 @@ var trackingQueue = {
|
|
|
11546
11339
|
return [];
|
|
11547
11340
|
}
|
|
11548
11341
|
};
|
|
11342
|
+
var logger11 = new ApiLogger({ service: LOGGER_SERVICES.PUB_SUB, transport: "console" });
|
|
11549
11343
|
var EVENT_CONSTANTS = {
|
|
11550
11344
|
/** Minimum event segments for scoped events (namespace:scope:event) */
|
|
11551
11345
|
MIN_SCOPED_SEGMENTS: 2,
|
|
@@ -11651,7 +11445,10 @@ function createEmitMethod(listeners, trackOperation) {
|
|
|
11651
11445
|
try {
|
|
11652
11446
|
callback(data);
|
|
11653
11447
|
} catch (error) {
|
|
11654
|
-
|
|
11448
|
+
logger11.error("Event listener failed", {
|
|
11449
|
+
event,
|
|
11450
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11451
|
+
});
|
|
11655
11452
|
}
|
|
11656
11453
|
});
|
|
11657
11454
|
listeners.forEach((callbacks, pattern) => {
|
|
@@ -11664,7 +11461,11 @@ function createEmitMethod(listeners, trackOperation) {
|
|
|
11664
11461
|
const wildcardData = typeof data === "object" && data !== null ? { ...data, originalEvent: event.split(":").pop() } : { data, originalEvent: event.split(":").pop() };
|
|
11665
11462
|
callback(wildcardData);
|
|
11666
11463
|
} catch (error) {
|
|
11667
|
-
|
|
11464
|
+
logger11.error("Wildcard listener failed", {
|
|
11465
|
+
event,
|
|
11466
|
+
pattern: prefix,
|
|
11467
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11468
|
+
});
|
|
11668
11469
|
}
|
|
11669
11470
|
});
|
|
11670
11471
|
}
|
|
@@ -11676,7 +11477,10 @@ function createEmitMethod(listeners, trackOperation) {
|
|
|
11676
11477
|
try {
|
|
11677
11478
|
callback(data);
|
|
11678
11479
|
} catch (error) {
|
|
11679
|
-
|
|
11480
|
+
logger11.error("Global wildcard listener failed", {
|
|
11481
|
+
event,
|
|
11482
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11483
|
+
});
|
|
11680
11484
|
}
|
|
11681
11485
|
});
|
|
11682
11486
|
}
|
|
@@ -11841,7 +11645,9 @@ function createEventEmitter() {
|
|
|
11841
11645
|
result = handlerResult;
|
|
11842
11646
|
}
|
|
11843
11647
|
} catch (error) {
|
|
11844
|
-
|
|
11648
|
+
logger11.warn("Handler in chain failed", {
|
|
11649
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11650
|
+
});
|
|
11845
11651
|
}
|
|
11846
11652
|
}
|
|
11847
11653
|
return result;
|
|
@@ -11911,858 +11717,239 @@ var EventHelpers = {
|
|
|
11911
11717
|
return namespace ? [`${namespace}:*`] : [];
|
|
11912
11718
|
}, "getMatchingWildcards")
|
|
11913
11719
|
};
|
|
11720
|
+
var API_ERROR_NAMESPACE = "api";
|
|
11721
|
+
var DEFAULT_TIMEOUT_MS2 = 3e4;
|
|
11914
11722
|
var DEFAULT_SERVER_ERROR_STATUS2 = 500;
|
|
11915
|
-
var
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11723
|
+
var SCOPE_MAP = {
|
|
11724
|
+
GLOBAL: "global",
|
|
11725
|
+
CONFIG: "config",
|
|
11726
|
+
CLIENT: "client",
|
|
11727
|
+
REQUEST: "request",
|
|
11728
|
+
TEMPORARY: "temporary"
|
|
11729
|
+
};
|
|
11730
|
+
function convertToApiEventScope(scope) {
|
|
11731
|
+
const mapped = SCOPE_MAP[scope];
|
|
11732
|
+
if (!mapped) {
|
|
11733
|
+
throw new Error(`Invalid EventScope: ${scope}`);
|
|
11924
11734
|
}
|
|
11925
|
-
return
|
|
11926
|
-
}
|
|
11927
|
-
__name(mapHandlerNameToEventName, "mapHandlerNameToEventName");
|
|
11928
|
-
function registerScopedHandlers(scope, handlers, options = {}) {
|
|
11929
|
-
Object.entries(handlers).forEach(([handlerName, handler]) => {
|
|
11930
|
-
if (handler) {
|
|
11931
|
-
const eventName = mapHandlerNameToEventName(handlerName);
|
|
11932
|
-
const wrappedHandler = /* @__PURE__ */ __name((event) => {
|
|
11933
|
-
const error = event?.data?.error ?? event;
|
|
11934
|
-
try {
|
|
11935
|
-
handler(error);
|
|
11936
|
-
} catch (err) {
|
|
11937
|
-
console.error("Error in error handler:", err);
|
|
11938
|
-
}
|
|
11939
|
-
}, "wrappedHandler");
|
|
11940
|
-
eventManager.errors.addScopedHandler(HANDLER_SCOPES$1[scope], eventName, wrappedHandler, {
|
|
11941
|
-
...options,
|
|
11942
|
-
originalHandler: handler
|
|
11943
|
-
});
|
|
11944
|
-
}
|
|
11945
|
-
});
|
|
11735
|
+
return mapped;
|
|
11946
11736
|
}
|
|
11947
|
-
__name(
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11737
|
+
__name(convertToApiEventScope, "convertToApiEventScope");
|
|
11738
|
+
var ApiPackageError = class extends ApiPackageError$1 {
|
|
11739
|
+
static {
|
|
11740
|
+
__name(this, "ApiPackageError");
|
|
11741
|
+
}
|
|
11742
|
+
};
|
|
11743
|
+
var apiErrorEventFactory = {
|
|
11744
|
+
addScopedHandler(scope, eventName, handler, options) {
|
|
11745
|
+
const eventScope = convertToApiEventScope(scope);
|
|
11746
|
+
eventManager.errors.addScopedHandler(eventScope, eventName, handler, options);
|
|
11747
|
+
},
|
|
11748
|
+
removeScopedHandler(scope, eventName, handler) {
|
|
11749
|
+
const apiScope = convertToApiEventScope(scope);
|
|
11750
|
+
if (!handler) {
|
|
11751
|
+
eventManager.errors.removeAllScopedListeners(apiScope, eventName);
|
|
11956
11752
|
} else {
|
|
11957
|
-
|
|
11958
|
-
handlerName = `on${camelCase.charAt(0).toUpperCase() + camelCase.slice(1)}Error`;
|
|
11753
|
+
eventManager.errors.removeScopedHandler(apiScope, eventName, handler);
|
|
11959
11754
|
}
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11755
|
+
},
|
|
11756
|
+
getOriginalScopedHandlers(scope) {
|
|
11757
|
+
const eventScope = convertToApiEventScope(scope);
|
|
11758
|
+
return eventManager.errors.getOriginalScopedHandlers(eventScope);
|
|
11759
|
+
},
|
|
11760
|
+
emit(eventName, data, options) {
|
|
11761
|
+
if (options?.scopes && options.scopes.length > 0) {
|
|
11762
|
+
options.scopes.forEach((scope) => {
|
|
11763
|
+
const apiScope = convertToApiEventScope(scope);
|
|
11764
|
+
const scopedEventKey = `${apiScope}:errors:${eventName}`;
|
|
11765
|
+
eventManager.errors.emit(scopedEventKey, data);
|
|
11766
|
+
});
|
|
11767
|
+
} else {
|
|
11768
|
+
eventManager.errors.emit(eventName, data);
|
|
11963
11769
|
}
|
|
11770
|
+
}
|
|
11771
|
+
};
|
|
11772
|
+
var isApiNamespaceRegistered = false;
|
|
11773
|
+
function ensureApiNamespaceRegistered() {
|
|
11774
|
+
if (isApiNamespaceRegistered) {
|
|
11775
|
+
return;
|
|
11776
|
+
}
|
|
11777
|
+
registerEventFactory(API_ERROR_NAMESPACE, apiErrorEventFactory);
|
|
11778
|
+
ApiPackageError$1.configure({
|
|
11779
|
+
namespace: API_ERROR_NAMESPACE,
|
|
11780
|
+
eventFactory: apiErrorEventFactory
|
|
11964
11781
|
});
|
|
11965
|
-
|
|
11782
|
+
isApiNamespaceRegistered = true;
|
|
11966
11783
|
}
|
|
11967
|
-
__name(
|
|
11784
|
+
__name(ensureApiNamespaceRegistered, "ensureApiNamespaceRegistered");
|
|
11785
|
+
ensureApiNamespaceRegistered();
|
|
11968
11786
|
function registerErrorHandler(eventType, handler, options = {}) {
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
try {
|
|
11974
|
-
handler(error);
|
|
11975
|
-
} catch (err) {
|
|
11976
|
-
console.error("Error in error handler:", err);
|
|
11977
|
-
}
|
|
11978
|
-
}, "wrappedHandler");
|
|
11979
|
-
return eventManager.errors.addScopedHandler(
|
|
11980
|
-
HANDLER_SCOPES$1[scope],
|
|
11981
|
-
type,
|
|
11982
|
-
wrappedHandler,
|
|
11983
|
-
{ strategy, originalHandler: handler }
|
|
11984
|
-
);
|
|
11787
|
+
return registerErrorHandler$1(API_ERROR_NAMESPACE, eventType, handler, {
|
|
11788
|
+
...options,
|
|
11789
|
+
eventFactory: apiErrorEventFactory
|
|
11790
|
+
});
|
|
11985
11791
|
}
|
|
11986
11792
|
__name(registerErrorHandler, "registerErrorHandler");
|
|
11793
|
+
function registerErrorHandlers(handlers, options = {}) {
|
|
11794
|
+
const { scope = "GLOBAL", ...rest } = options;
|
|
11795
|
+
registerScopedHandlers(API_ERROR_NAMESPACE, scope, handlers, {
|
|
11796
|
+
...rest,
|
|
11797
|
+
eventFactory: apiErrorEventFactory
|
|
11798
|
+
});
|
|
11799
|
+
}
|
|
11800
|
+
__name(registerErrorHandlers, "registerErrorHandlers");
|
|
11987
11801
|
function setErrorHandlers(handlers, scope = "GLOBAL") {
|
|
11988
|
-
|
|
11802
|
+
setErrorHandlers$1(API_ERROR_NAMESPACE, handlers, scope, apiErrorEventFactory);
|
|
11989
11803
|
}
|
|
11990
11804
|
__name(setErrorHandlers, "setErrorHandlers");
|
|
11991
11805
|
function getErrorHandlers(scope = "GLOBAL") {
|
|
11992
|
-
return
|
|
11806
|
+
return getErrorHandlers$1(API_ERROR_NAMESPACE, scope, apiErrorEventFactory);
|
|
11993
11807
|
}
|
|
11994
11808
|
__name(getErrorHandlers, "getErrorHandlers");
|
|
11995
|
-
function registerErrorHandlers(handlers, options = {}) {
|
|
11996
|
-
const { scope = "GLOBAL", strategy = "merge" } = options;
|
|
11997
|
-
registerScopedHandlers(scope, handlers, { strategy });
|
|
11998
|
-
}
|
|
11999
|
-
__name(registerErrorHandlers, "registerErrorHandlers");
|
|
12000
11809
|
function unregisterErrorHandlers(eventTypes, options = {}) {
|
|
12001
11810
|
const { scope = "GLOBAL" } = options;
|
|
12002
|
-
|
|
12003
|
-
if (!eventTypes) {
|
|
12004
|
-
eventManager.errors.clearScopedHandlers(scopeKey);
|
|
12005
|
-
} else {
|
|
12006
|
-
eventTypes.forEach((eventType) => {
|
|
12007
|
-
const type = typeof eventType === "string" && eventType.startsWith("errors:") ? getErrorEventType(eventType) : eventType;
|
|
12008
|
-
eventManager.errors.removeAllScopedListeners(scopeKey, type);
|
|
12009
|
-
});
|
|
12010
|
-
}
|
|
11811
|
+
unregisterScopedHandlers(API_ERROR_NAMESPACE, scope, eventTypes, apiErrorEventFactory);
|
|
12011
11812
|
}
|
|
12012
11813
|
__name(unregisterErrorHandlers, "unregisterErrorHandlers");
|
|
12013
11814
|
function clearErrorHandlers(options = {}) {
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
eventManager.errors.clearScopedHandlers(scopeKey);
|
|
11815
|
+
clearErrorHandlers$1(API_ERROR_NAMESPACE, {
|
|
11816
|
+
...options,
|
|
11817
|
+
eventFactory: apiErrorEventFactory
|
|
12018
11818
|
});
|
|
12019
11819
|
}
|
|
12020
11820
|
__name(clearErrorHandlers, "clearErrorHandlers");
|
|
12021
11821
|
function onceErrorHandler(eventType, handler, options = {}) {
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
const eventData = event;
|
|
12026
|
-
const error = eventData?.data?.error ?? event;
|
|
12027
|
-
handler(error);
|
|
11822
|
+
registerOnceErrorHandler(API_ERROR_NAMESPACE, eventType, handler, {
|
|
11823
|
+
...options,
|
|
11824
|
+
eventFactory: apiErrorEventFactory
|
|
12028
11825
|
});
|
|
12029
11826
|
}
|
|
12030
11827
|
__name(onceErrorHandler, "onceErrorHandler");
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
});
|
|
12040
|
-
}, "network"),
|
|
12041
|
-
validation: /* @__PURE__ */ __name((error) => {
|
|
12042
|
-
eventManager.errors.emitValidationError({
|
|
12043
|
-
error,
|
|
12044
|
-
field: error.context?.field,
|
|
12045
|
-
value: error.context?.value,
|
|
12046
|
-
constraints: error.context?.constraints
|
|
12047
|
-
});
|
|
12048
|
-
}, "validation"),
|
|
12049
|
-
authentication: /* @__PURE__ */ __name((error) => {
|
|
12050
|
-
eventManager.errors.emitAuthenticationError(
|
|
12051
|
-
error,
|
|
12052
|
-
error.context?.realm,
|
|
12053
|
-
error.context?.scheme
|
|
12054
|
-
);
|
|
12055
|
-
}, "authentication"),
|
|
12056
|
-
rateLimit: /* @__PURE__ */ __name((error) => {
|
|
12057
|
-
eventManager.errors.emitRateLimitError({
|
|
12058
|
-
error,
|
|
12059
|
-
limit: error.context?.limit,
|
|
12060
|
-
remaining: error.context?.remaining,
|
|
12061
|
-
resetAt: error.context?.resetAt,
|
|
12062
|
-
retryAfter: error.context?.retryAfter
|
|
12063
|
-
});
|
|
12064
|
-
}, "rateLimit"),
|
|
12065
|
-
server: /* @__PURE__ */ __name((error) => {
|
|
12066
|
-
eventManager.errors.emitServerError({
|
|
12067
|
-
error,
|
|
12068
|
-
statusCode: error.statusCode ?? DEFAULT_SERVER_ERROR_STATUS2,
|
|
12069
|
-
serverMessage: error.context?.serverMessage,
|
|
12070
|
-
traceId: error.context?.traceId
|
|
12071
|
-
});
|
|
12072
|
-
}, "server"),
|
|
12073
|
-
timeout: /* @__PURE__ */ __name((error) => {
|
|
12074
|
-
eventManager.errors.emitTimeoutError({
|
|
12075
|
-
error,
|
|
12076
|
-
timeout: error.context?.timeoutMs || error.context?.timeout || 0,
|
|
12077
|
-
operation: error.context?.operation,
|
|
12078
|
-
url: error.context?.url
|
|
12079
|
-
});
|
|
12080
|
-
}, "timeout"),
|
|
12081
|
-
authorization: /* @__PURE__ */ __name((error) => {
|
|
12082
|
-
eventManager.errors.emitAuthorizationError({
|
|
12083
|
-
error,
|
|
12084
|
-
url: error.context?.url,
|
|
12085
|
-
method: error.context?.method,
|
|
12086
|
-
resource: void 0,
|
|
12087
|
-
permission: void 0
|
|
12088
|
-
});
|
|
12089
|
-
}, "authorization"),
|
|
12090
|
-
notFound: /* @__PURE__ */ __name((error) => {
|
|
12091
|
-
eventManager.errors.emitNotFoundError(error, error.context?.url, void 0);
|
|
12092
|
-
}, "notFound"),
|
|
12093
|
-
conflict: /* @__PURE__ */ __name((error) => {
|
|
12094
|
-
eventManager.errors.emitConflictError({
|
|
12095
|
-
error,
|
|
12096
|
-
conflictingResource: void 0,
|
|
12097
|
-
currentValue: void 0,
|
|
12098
|
-
attemptedValue: void 0
|
|
12099
|
-
});
|
|
12100
|
-
}, "conflict"),
|
|
12101
|
-
client: /* @__PURE__ */ __name((error) => {
|
|
12102
|
-
eventManager.errors.emitClientError({
|
|
12103
|
-
error,
|
|
12104
|
-
status: error.statusCode ?? DEFAULT_CLIENT_ERROR_STATUS,
|
|
12105
|
-
url: error.context?.url,
|
|
12106
|
-
method: error.context?.method
|
|
12107
|
-
});
|
|
12108
|
-
}, "client"),
|
|
12109
|
-
externalService: /* @__PURE__ */ __name((error) => {
|
|
12110
|
-
eventManager.errors.emitExternalServiceError({
|
|
12111
|
-
error,
|
|
12112
|
-
service: void 0,
|
|
12113
|
-
endpoint: error.context?.url,
|
|
12114
|
-
timeout: error.context?.timeout
|
|
12115
|
-
});
|
|
12116
|
-
}, "externalService"),
|
|
12117
|
-
cache: /* @__PURE__ */ __name((error) => {
|
|
12118
|
-
eventManager.errors.emitCacheError(
|
|
12119
|
-
error,
|
|
12120
|
-
error.context?.operation,
|
|
12121
|
-
error.context && "cacheKey" in error.context ? error.context.cacheKey : "unknown"
|
|
12122
|
-
);
|
|
12123
|
-
}, "cache"),
|
|
12124
|
-
headers: /* @__PURE__ */ __name((error) => {
|
|
12125
|
-
eventManager.errors.emitHeadersError(error, void 0, error.context?.operation);
|
|
12126
|
-
}, "headers"),
|
|
12127
|
-
retry: /* @__PURE__ */ __name((error) => {
|
|
12128
|
-
eventManager.errors.emitRetryError({
|
|
12129
|
-
error,
|
|
12130
|
-
attempts: void 0,
|
|
12131
|
-
maxAttempts: void 0,
|
|
12132
|
-
lastError: error.context?.originalError
|
|
12133
|
-
});
|
|
12134
|
-
}, "retry")
|
|
12135
|
-
};
|
|
12136
|
-
function getCategoryKey(category) {
|
|
12137
|
-
if (!category) {
|
|
12138
|
-
return "unknown";
|
|
12139
|
-
}
|
|
12140
|
-
return ERROR_CATEGORY_TO_EMITTER_KEY[category] || category.toLowerCase();
|
|
12141
|
-
}
|
|
12142
|
-
__name(getCategoryKey, "getCategoryKey");
|
|
12143
|
-
async function emitErrorEvent(error) {
|
|
12144
|
-
const categoryKey = getCategoryKey(error.category);
|
|
12145
|
-
const emitter = ERROR_EMITTERS[categoryKey];
|
|
12146
|
-
if (emitter) {
|
|
12147
|
-
emitter(error);
|
|
12148
|
-
} else {
|
|
12149
|
-
eventManager.errors.emitGenericError(error);
|
|
12150
|
-
}
|
|
12151
|
-
}
|
|
12152
|
-
__name(emitErrorEvent, "emitErrorEvent");
|
|
12153
|
-
|
|
12154
|
-
// src/api/utils/generation/id-generator.ts
|
|
12155
|
-
var ID_CONSTANTS = {
|
|
12156
|
-
RANDOM_START_INDEX: 2,
|
|
12157
|
-
DEFAULT_RANDOM_LENGTH: 8,
|
|
12158
|
-
MAX_PREFIX_LENGTH: 10,
|
|
12159
|
-
DEFAULT_RADIX: 36,
|
|
12160
|
-
TWO_PARTS: 2
|
|
12161
|
-
};
|
|
12162
|
-
var DEFAULT_OPTIONS = {
|
|
12163
|
-
prefix: "",
|
|
12164
|
-
suffix: "",
|
|
12165
|
-
useTimestamp: false,
|
|
12166
|
-
separator: "_",
|
|
12167
|
-
includeRandom: true,
|
|
12168
|
-
radix: ID_CONSTANTS.DEFAULT_RADIX,
|
|
12169
|
-
randomLength: ID_CONSTANTS.DEFAULT_RANDOM_LENGTH
|
|
12170
|
-
};
|
|
12171
|
-
function generateBaseId(options = {}) {
|
|
12172
|
-
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
12173
|
-
const components = [];
|
|
12174
|
-
if (opts.prefix) {
|
|
12175
|
-
components.push(opts.prefix);
|
|
12176
|
-
}
|
|
12177
|
-
if (opts.useTimestamp) {
|
|
12178
|
-
const timestamp = Date.now().toString(opts.radix);
|
|
12179
|
-
components.push(timestamp);
|
|
12180
|
-
if (opts.includeRandom) {
|
|
12181
|
-
const random = Math.random().toString(opts.radix).slice(
|
|
12182
|
-
ID_CONSTANTS.RANDOM_START_INDEX,
|
|
12183
|
-
ID_CONSTANTS.RANDOM_START_INDEX + opts.randomLength
|
|
12184
|
-
);
|
|
12185
|
-
components.push(random);
|
|
12186
|
-
}
|
|
12187
|
-
} else {
|
|
12188
|
-
components.push(generateUUID());
|
|
12189
|
-
}
|
|
12190
|
-
if (opts.suffix) {
|
|
12191
|
-
components.push(opts.suffix);
|
|
12192
|
-
}
|
|
12193
|
-
return components.join(opts.separator);
|
|
12194
|
-
}
|
|
12195
|
-
__name(generateBaseId, "generateBaseId");
|
|
12196
|
-
function generateContextualId(context, options = {}) {
|
|
12197
|
-
const baseId = generateBaseId(options);
|
|
12198
|
-
const contextParts = [];
|
|
12199
|
-
for (const [, value] of Object.entries(context)) {
|
|
12200
|
-
if (value !== void 0) {
|
|
12201
|
-
contextParts.push(String(value));
|
|
12202
|
-
}
|
|
12203
|
-
}
|
|
12204
|
-
if (contextParts.length > 0) {
|
|
12205
|
-
return `${contextParts.join(":")}:${baseId}`;
|
|
12206
|
-
}
|
|
12207
|
-
return baseId;
|
|
12208
|
-
}
|
|
12209
|
-
__name(generateContextualId, "generateContextualId");
|
|
12210
|
-
function extractFromLastSeparator(id, separator) {
|
|
12211
|
-
const lastIndex = id.lastIndexOf(separator);
|
|
12212
|
-
return lastIndex !== -1 ? id.substring(lastIndex + 1) : null;
|
|
12213
|
-
}
|
|
12214
|
-
__name(extractFromLastSeparator, "extractFromLastSeparator");
|
|
12215
|
-
function extractFromFirstSeparator(id, separator) {
|
|
12216
|
-
const firstIndex = id.indexOf(separator);
|
|
12217
|
-
return firstIndex !== -1 ? id.substring(0, firstIndex) : null;
|
|
12218
|
-
}
|
|
12219
|
-
__name(extractFromFirstSeparator, "extractFromFirstSeparator");
|
|
12220
|
-
function extractAfterPrefix(id, separator) {
|
|
12221
|
-
const firstIndex = id.indexOf(separator);
|
|
12222
|
-
if (firstIndex === -1 || separator !== "_") {
|
|
12223
|
-
return null;
|
|
12224
|
-
}
|
|
12225
|
-
const prefix = id.substring(0, firstIndex);
|
|
12226
|
-
const isShortAlphabeticPrefix = prefix.length <= ID_CONSTANTS.MAX_PREFIX_LENGTH && /^[a-z]+$/i.test(prefix);
|
|
12227
|
-
return isShortAlphabeticPrefix ? id.substring(firstIndex + 1) : null;
|
|
12228
|
-
}
|
|
12229
|
-
__name(extractAfterPrefix, "extractAfterPrefix");
|
|
12230
|
-
function extractWithUnderscoreSeparator(id, separator) {
|
|
12231
|
-
const afterPrefix = extractAfterPrefix(id, separator);
|
|
12232
|
-
if (afterPrefix) {
|
|
12233
|
-
return afterPrefix;
|
|
12234
|
-
}
|
|
12235
|
-
return extractFromLastSeparator(id, separator);
|
|
11828
|
+
function emitNetworkErrorEvent(error, context) {
|
|
11829
|
+
eventManager.errors.emitNetworkError({
|
|
11830
|
+
error,
|
|
11831
|
+
url: context?.url,
|
|
11832
|
+
method: context?.method,
|
|
11833
|
+
status: error.statusCode,
|
|
11834
|
+
retryable: error.retryable
|
|
11835
|
+
});
|
|
12236
11836
|
}
|
|
12237
|
-
__name(
|
|
12238
|
-
function
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
11837
|
+
__name(emitNetworkErrorEvent, "emitNetworkErrorEvent");
|
|
11838
|
+
function emitTimeoutErrorEvent(error, context) {
|
|
11839
|
+
eventManager.errors.emitTimeoutError({
|
|
11840
|
+
error,
|
|
11841
|
+
timeout: context?.timeout ?? context?.timeoutMs ?? DEFAULT_TIMEOUT_MS2,
|
|
11842
|
+
url: context?.url,
|
|
11843
|
+
operation: context?.operation
|
|
11844
|
+
});
|
|
12243
11845
|
}
|
|
12244
|
-
__name(
|
|
12245
|
-
function
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
11846
|
+
__name(emitTimeoutErrorEvent, "emitTimeoutErrorEvent");
|
|
11847
|
+
function emitServerErrorEvent(error, context) {
|
|
11848
|
+
eventManager.errors.emitServerError({
|
|
11849
|
+
error,
|
|
11850
|
+
statusCode: error.statusCode ?? DEFAULT_SERVER_ERROR_STATUS2,
|
|
11851
|
+
serverMessage: context?.serverMessage,
|
|
11852
|
+
traceId: context?.traceId
|
|
11853
|
+
});
|
|
12251
11854
|
}
|
|
12252
|
-
__name(
|
|
12253
|
-
function
|
|
12254
|
-
|
|
12255
|
-
|
|
11855
|
+
__name(emitServerErrorEvent, "emitServerErrorEvent");
|
|
11856
|
+
function emitAuthorizationErrorEvent(error, context) {
|
|
11857
|
+
eventManager.errors.emitAuthorizationError({
|
|
11858
|
+
error,
|
|
11859
|
+
url: context?.url,
|
|
11860
|
+
method: context?.method,
|
|
11861
|
+
resource: context?.resource,
|
|
11862
|
+
permission: context?.permission
|
|
11863
|
+
});
|
|
12256
11864
|
}
|
|
12257
|
-
__name(
|
|
12258
|
-
function
|
|
12259
|
-
|
|
12260
|
-
|
|
11865
|
+
__name(emitAuthorizationErrorEvent, "emitAuthorizationErrorEvent");
|
|
11866
|
+
function emitRateLimitErrorEvent(error, context) {
|
|
11867
|
+
eventManager.errors.emitRateLimitError({
|
|
11868
|
+
error,
|
|
11869
|
+
limit: context?.limit,
|
|
11870
|
+
remaining: context?.remaining,
|
|
11871
|
+
resetAt: context?.resetAt,
|
|
11872
|
+
retryAfter: context?.retryAfter
|
|
11873
|
+
});
|
|
12261
11874
|
}
|
|
12262
|
-
__name(
|
|
12263
|
-
function
|
|
12264
|
-
|
|
12265
|
-
|
|
11875
|
+
__name(emitRateLimitErrorEvent, "emitRateLimitErrorEvent");
|
|
11876
|
+
function emitValidationErrorEvent(error) {
|
|
11877
|
+
eventManager.errors.emitValidationError({
|
|
11878
|
+
error,
|
|
11879
|
+
field: void 0,
|
|
11880
|
+
value: void 0,
|
|
11881
|
+
constraints: void 0
|
|
11882
|
+
});
|
|
12266
11883
|
}
|
|
12267
|
-
__name(
|
|
12268
|
-
function
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
return !rejectList.includes(id);
|
|
11884
|
+
__name(emitValidationErrorEvent, "emitValidationErrorEvent");
|
|
11885
|
+
function emitAuthenticationErrorEvent(error, context) {
|
|
11886
|
+
eventManager.errors.emitAuthenticationError(
|
|
11887
|
+
error,
|
|
11888
|
+
context?.realm,
|
|
11889
|
+
context?.scheme
|
|
11890
|
+
);
|
|
12275
11891
|
}
|
|
12276
|
-
__name(
|
|
12277
|
-
function
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
11892
|
+
__name(emitAuthenticationErrorEvent, "emitAuthenticationErrorEvent");
|
|
11893
|
+
function emitNotFoundErrorEvent(error, context) {
|
|
11894
|
+
eventManager.errors.emitNotFoundError(error, context?.url);
|
|
11895
|
+
}
|
|
11896
|
+
__name(emitNotFoundErrorEvent, "emitNotFoundErrorEvent");
|
|
11897
|
+
var ERROR_CATEGORY_HANDLERS = {
|
|
11898
|
+
network: emitNetworkErrorEvent,
|
|
11899
|
+
validation: emitValidationErrorEvent,
|
|
11900
|
+
authentication: emitAuthenticationErrorEvent,
|
|
11901
|
+
authorization: emitAuthorizationErrorEvent,
|
|
11902
|
+
"rate.limit": emitRateLimitErrorEvent,
|
|
11903
|
+
timeout: emitTimeoutErrorEvent,
|
|
11904
|
+
"not.found": emitNotFoundErrorEvent,
|
|
11905
|
+
server: emitServerErrorEvent
|
|
11906
|
+
};
|
|
11907
|
+
function emitErrorEvent(error) {
|
|
11908
|
+
const context = error.context;
|
|
11909
|
+
const category = error.category?.toLowerCase();
|
|
11910
|
+
const handler = category ? ERROR_CATEGORY_HANDLERS[category] : void 0;
|
|
11911
|
+
if (handler) {
|
|
11912
|
+
handler(error, context);
|
|
11913
|
+
} else {
|
|
11914
|
+
eventManager.errors.emitGenericError(error);
|
|
12282
11915
|
}
|
|
12283
|
-
return null;
|
|
12284
|
-
}
|
|
12285
|
-
__name(checkPatterns, "checkPatterns");
|
|
12286
|
-
function isAnyPatternAllowed(options) {
|
|
12287
|
-
return !!(options.allowUuid ?? options.allowTimestamp ?? options.allowPrefix);
|
|
12288
11916
|
}
|
|
12289
|
-
__name(
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
{ check: isPrefixedPattern, allowed: options.allowPrefix }
|
|
12295
|
-
];
|
|
12296
|
-
return checkPatterns(id, patterns);
|
|
12297
|
-
}
|
|
12298
|
-
__name(checkIdPatterns, "checkIdPatterns");
|
|
12299
|
-
function validateIdWithPatterns(id, options) {
|
|
12300
|
-
const patternResult = checkIdPatterns(id, options);
|
|
12301
|
-
if (patternResult !== null) {
|
|
12302
|
-
return patternResult;
|
|
12303
|
-
}
|
|
12304
|
-
return isAnyPatternAllowed(options) && isValidFallbackPattern(id);
|
|
11917
|
+
__name(emitErrorEvent, "emitErrorEvent");
|
|
11918
|
+
|
|
11919
|
+
// src/api/polling/utils.ts
|
|
11920
|
+
function isPollingActive(config) {
|
|
11921
|
+
return (config.interval ?? 0) > 0;
|
|
12305
11922
|
}
|
|
12306
|
-
__name(
|
|
12307
|
-
function
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
return false;
|
|
11923
|
+
__name(isPollingActive, "isPollingActive");
|
|
11924
|
+
function calculatePollingDuration(config) {
|
|
11925
|
+
if (!config.interval || !config.maxAttempts || config.maxAttempts <= 0) {
|
|
11926
|
+
return null;
|
|
12311
11927
|
}
|
|
12312
|
-
|
|
11928
|
+
const intervals = config.interval * config.maxAttempts;
|
|
11929
|
+
const delays = (config.delay ?? 0) * config.maxAttempts;
|
|
11930
|
+
return intervals + delays;
|
|
12313
11931
|
}
|
|
12314
|
-
__name(
|
|
12315
|
-
function
|
|
12316
|
-
|
|
12317
|
-
if (id.includes(":")) {
|
|
12318
|
-
const lastColonIndex = id.lastIndexOf(":");
|
|
11932
|
+
__name(calculatePollingDuration, "calculatePollingDuration");
|
|
11933
|
+
function getSSRSafePollingConfig(config) {
|
|
11934
|
+
if (!isBrowser()) {
|
|
12319
11935
|
return {
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
11936
|
+
...config,
|
|
11937
|
+
interval: 0,
|
|
11938
|
+
maxAttempts: 1
|
|
12323
11939
|
};
|
|
12324
11940
|
}
|
|
12325
|
-
|
|
12326
|
-
if (parts.length === 1) {
|
|
12327
|
-
return { core: id, full: id };
|
|
12328
|
-
}
|
|
12329
|
-
if (parts.length === ID_CONSTANTS.TWO_PARTS) {
|
|
12330
|
-
if (parts[0].length <= ID_CONSTANTS.MAX_PREFIX_LENGTH && /^[a-z]+$/i.test(parts[0])) {
|
|
12331
|
-
return { prefix: parts[0], core: parts[1], full: id };
|
|
12332
|
-
}
|
|
12333
|
-
return { core: parts[0], suffix: parts[1], full: id };
|
|
12334
|
-
}
|
|
12335
|
-
return {
|
|
12336
|
-
prefix: parts[0],
|
|
12337
|
-
core: parts.slice(1, -1).join(separator),
|
|
12338
|
-
suffix: parts[parts.length - 1],
|
|
12339
|
-
full: id
|
|
12340
|
-
};
|
|
11941
|
+
return config;
|
|
12341
11942
|
}
|
|
12342
|
-
__name(
|
|
12343
|
-
function
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
correlationGenerators.set(
|
|
12353
|
-
type,
|
|
12354
|
-
createIdGenerator({
|
|
12355
|
-
prefix: type,
|
|
12356
|
-
useTimestamp: true,
|
|
12357
|
-
includeRandom: true,
|
|
12358
|
-
radix: 36,
|
|
12359
|
-
randomLength: 8
|
|
12360
|
-
})
|
|
12361
|
-
);
|
|
12362
|
-
}
|
|
12363
|
-
return correlationGenerators.get(type);
|
|
12364
|
-
}
|
|
12365
|
-
__name(getCorrelationGenerator, "getCorrelationGenerator");
|
|
12366
|
-
function generateCorrelationId(type = CORRELATION_TYPE.GENERIC, options) {
|
|
12367
|
-
const generator = getCorrelationGenerator(type);
|
|
12368
|
-
return generator(options);
|
|
12369
|
-
}
|
|
12370
|
-
__name(generateCorrelationId, "generateCorrelationId");
|
|
12371
|
-
function generateContextualCorrelationId(context, type = CORRELATION_TYPE.GENERIC, options) {
|
|
12372
|
-
return generateContextualId(context, {
|
|
12373
|
-
prefix: type,
|
|
12374
|
-
useTimestamp: true,
|
|
12375
|
-
includeRandom: true,
|
|
12376
|
-
radix: 36,
|
|
12377
|
-
randomLength: 8,
|
|
12378
|
-
...options
|
|
12379
|
-
});
|
|
12380
|
-
}
|
|
12381
|
-
__name(generateContextualCorrelationId, "generateContextualCorrelationId");
|
|
12382
|
-
function generateNetworkCorrelationId(options) {
|
|
12383
|
-
return generateCorrelationId(CORRELATION_TYPE.NETWORK, options);
|
|
12384
|
-
}
|
|
12385
|
-
__name(generateNetworkCorrelationId, "generateNetworkCorrelationId");
|
|
12386
|
-
function generateApiCorrelationId(options) {
|
|
12387
|
-
return generateCorrelationId(CORRELATION_TYPE.API, options);
|
|
12388
|
-
}
|
|
12389
|
-
__name(generateApiCorrelationId, "generateApiCorrelationId");
|
|
12390
|
-
function generateSessionCorrelationId(options) {
|
|
12391
|
-
return generateCorrelationId(CORRELATION_TYPE.SESSION, options);
|
|
12392
|
-
}
|
|
12393
|
-
__name(generateSessionCorrelationId, "generateSessionCorrelationId");
|
|
12394
|
-
function generateTraceCorrelationId(options) {
|
|
12395
|
-
return generateCorrelationId(CORRELATION_TYPE.TRACE, options);
|
|
12396
|
-
}
|
|
12397
|
-
__name(generateTraceCorrelationId, "generateTraceCorrelationId");
|
|
12398
|
-
function extractBaseCorrelationId(contextualId) {
|
|
12399
|
-
let id = extractBaseId(contextualId, { separator: ":", extractLast: true });
|
|
12400
|
-
const prefixes = Object.values(CORRELATION_TYPE);
|
|
12401
|
-
for (const prefix of prefixes) {
|
|
12402
|
-
if (id.startsWith(`${prefix}_`)) {
|
|
12403
|
-
id = id.substring(prefix.length + 1);
|
|
12404
|
-
break;
|
|
12405
|
-
}
|
|
12406
|
-
}
|
|
12407
|
-
return id;
|
|
12408
|
-
}
|
|
12409
|
-
__name(extractBaseCorrelationId, "extractBaseCorrelationId");
|
|
12410
|
-
function extractCorrelationType(id) {
|
|
12411
|
-
let idToCheck = id;
|
|
12412
|
-
if (id.includes(":")) {
|
|
12413
|
-
const parts = id.split(":");
|
|
12414
|
-
idToCheck = parts[parts.length - 1];
|
|
12415
|
-
}
|
|
12416
|
-
const parsed = parseId(idToCheck, { separator: "_" });
|
|
12417
|
-
if (parsed.prefix) {
|
|
12418
|
-
const types = Object.values(CORRELATION_TYPE);
|
|
12419
|
-
if (types.includes(parsed.prefix)) {
|
|
12420
|
-
return parsed.prefix;
|
|
12421
|
-
}
|
|
12422
|
-
}
|
|
12423
|
-
return void 0;
|
|
12424
|
-
}
|
|
12425
|
-
__name(extractCorrelationType, "extractCorrelationType");
|
|
12426
|
-
function isValidCorrelationId(id) {
|
|
12427
|
-
let idToValidate = id;
|
|
12428
|
-
if (id.includes(":")) {
|
|
12429
|
-
const parts = id.split(":");
|
|
12430
|
-
idToValidate = parts[parts.length - 1];
|
|
12431
|
-
}
|
|
12432
|
-
return isValidId(idToValidate, {
|
|
12433
|
-
allowUuid: true,
|
|
12434
|
-
allowTimestamp: true,
|
|
12435
|
-
allowPrefix: true,
|
|
12436
|
-
minLength: 5
|
|
12437
|
-
});
|
|
12438
|
-
}
|
|
12439
|
-
__name(isValidCorrelationId, "isValidCorrelationId");
|
|
12440
|
-
function createCorrelationIdGenerator(type = CORRELATION_TYPE.GENERIC, defaultOptions = {}) {
|
|
12441
|
-
return createIdGenerator({
|
|
12442
|
-
prefix: type,
|
|
12443
|
-
useTimestamp: true,
|
|
12444
|
-
includeRandom: true,
|
|
12445
|
-
radix: 36,
|
|
12446
|
-
randomLength: 8,
|
|
12447
|
-
...defaultOptions
|
|
12448
|
-
});
|
|
12449
|
-
}
|
|
12450
|
-
__name(createCorrelationIdGenerator, "createCorrelationIdGenerator");
|
|
12451
|
-
function linkCorrelationIds(...ids) {
|
|
12452
|
-
return ids.join("->");
|
|
12453
|
-
}
|
|
12454
|
-
__name(linkCorrelationIds, "linkCorrelationIds");
|
|
12455
|
-
function extractLinkedCorrelationIds(linkedId) {
|
|
12456
|
-
return linkedId.split("->");
|
|
12457
|
-
}
|
|
12458
|
-
__name(extractLinkedCorrelationIds, "extractLinkedCorrelationIds");
|
|
12459
|
-
|
|
12460
|
-
// src/api/errors/ApiPackageError.ts
|
|
12461
|
-
var ApiPackageError = class _ApiPackageError extends Error {
|
|
12462
|
-
static {
|
|
12463
|
-
__name(this, "ApiPackageError");
|
|
12464
|
-
}
|
|
12465
|
-
statusCode;
|
|
12466
|
-
errorCode;
|
|
12467
|
-
message;
|
|
12468
|
-
errors;
|
|
12469
|
-
correlationId;
|
|
12470
|
-
timestamp;
|
|
12471
|
-
// Additional properties beyond ErrorResponse
|
|
12472
|
-
responseError;
|
|
12473
|
-
category;
|
|
12474
|
-
cause;
|
|
12475
|
-
context;
|
|
12476
|
-
// Store the original request/response data from fetchff (not Web API types)
|
|
12477
|
-
requestConfig;
|
|
12478
|
-
responseData;
|
|
12479
|
-
details;
|
|
12480
|
-
originalError;
|
|
12481
|
-
metadata;
|
|
12482
|
-
/**
|
|
12483
|
-
* Getter for code property (alias for errorCode)
|
|
12484
|
-
* Provides compatibility with standard error patterns
|
|
12485
|
-
*/
|
|
12486
|
-
get code() {
|
|
12487
|
-
return this.errorCode;
|
|
12488
|
-
}
|
|
12489
|
-
constructor(message, statusCode, errorCode = API_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
12490
|
-
super(message);
|
|
12491
|
-
this.name = "ApiPackageError";
|
|
12492
|
-
this.message = message;
|
|
12493
|
-
this.errorCode = errorCode;
|
|
12494
|
-
this.timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
12495
|
-
this.statusCode = this.resolveStatusCode(statusCode, errorCode);
|
|
12496
|
-
if (options) {
|
|
12497
|
-
this.errors = options.errors;
|
|
12498
|
-
this.correlationId = options.correlationId ?? generateApiCorrelationId();
|
|
12499
|
-
this.responseError = options.responseError;
|
|
12500
|
-
this.cause = options.cause;
|
|
12501
|
-
this.context = options.context;
|
|
12502
|
-
this.details = options.errors;
|
|
12503
|
-
this.originalError = options.cause;
|
|
12504
|
-
if (options.responseError) {
|
|
12505
|
-
this.requestConfig = options.responseError.request;
|
|
12506
|
-
this.responseData = options.responseError.response;
|
|
12507
|
-
}
|
|
12508
|
-
} else {
|
|
12509
|
-
this.correlationId = generateApiCorrelationId();
|
|
12510
|
-
}
|
|
12511
|
-
this.category = this.categorizeError();
|
|
12512
|
-
Object.setPrototypeOf(this, _ApiPackageError.prototype);
|
|
12513
|
-
this.emitEvent();
|
|
12514
|
-
}
|
|
12515
|
-
/**
|
|
12516
|
-
* Resolves the status code from the provided value or error definitions
|
|
12517
|
-
*/
|
|
12518
|
-
resolveStatusCode(statusCode, errorCode) {
|
|
12519
|
-
if (statusCode !== void 0) {
|
|
12520
|
-
return statusCode;
|
|
12521
|
-
}
|
|
12522
|
-
const definition = ERROR_DEFINITIONS$1[errorCode];
|
|
12523
|
-
if (definition?.status !== void 0) {
|
|
12524
|
-
return definition.status;
|
|
12525
|
-
}
|
|
12526
|
-
return HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12527
|
-
}
|
|
12528
|
-
/**
|
|
12529
|
-
* Emit error event for this error
|
|
12530
|
-
* Can be called with a specific client context or uses global handlers
|
|
12531
|
-
*/
|
|
12532
|
-
emitEvent() {
|
|
12533
|
-
void Promise.resolve().then(() => emitErrorEvent(this)).catch(() => {
|
|
12534
|
-
});
|
|
12535
|
-
}
|
|
12536
|
-
/**
|
|
12537
|
-
* Creates an ApiPackageError from a fetchff ResponseError
|
|
12538
|
-
*/
|
|
12539
|
-
static fromResponseError(responseError, config, clientContext) {
|
|
12540
|
-
const statusCode = responseError.status ?? HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12541
|
-
const message = responseError.message ?? "An error occurred";
|
|
12542
|
-
const code = this.determineErrorCode(responseError);
|
|
12543
|
-
return new _ApiPackageError(message, statusCode, code, {
|
|
12544
|
-
responseError,
|
|
12545
|
-
cause: responseError,
|
|
12546
|
-
clientContext,
|
|
12547
|
-
context: {
|
|
12548
|
-
url: config?.url ?? "",
|
|
12549
|
-
method: config?.method ?? "GET"
|
|
12550
|
-
}
|
|
12551
|
-
});
|
|
12552
|
-
}
|
|
12553
|
-
/**
|
|
12554
|
-
* Creates an ApiPackageError from a standard Error
|
|
12555
|
-
*/
|
|
12556
|
-
static fromError(error, statusCode, errorCode = API_ERROR_CODES.UNKNOWN_ERROR, context) {
|
|
12557
|
-
if (error instanceof _ApiPackageError) {
|
|
12558
|
-
return error;
|
|
12559
|
-
}
|
|
12560
|
-
const { code, status } = this.classifyError(error, errorCode, statusCode);
|
|
12561
|
-
return new _ApiPackageError(error.message, status, code, {
|
|
12562
|
-
cause: error,
|
|
12563
|
-
clientContext: context
|
|
12564
|
-
});
|
|
12565
|
-
}
|
|
12566
|
-
/**
|
|
12567
|
-
* Classifies an error and returns appropriate code and status
|
|
12568
|
-
*/
|
|
12569
|
-
static classifyError(error, defaultCode, defaultStatus) {
|
|
12570
|
-
if (error.name === "NetworkError" || error.message.includes("network")) {
|
|
12571
|
-
return { code: API_ERROR_CODES.NETWORK_ERROR, status: 0 };
|
|
12572
|
-
}
|
|
12573
|
-
if (error.name === "TimeoutError" || error.message.includes("timeout")) {
|
|
12574
|
-
return { code: API_ERROR_CODES.REQUEST_TIMEOUT, status: HTTP_STATUS.REQUEST_TIMEOUT };
|
|
12575
|
-
}
|
|
12576
|
-
if (error.name === "AbortError") {
|
|
12577
|
-
return { code: API_ERROR_CODES.REQUEST_ABORTED, status: 0 };
|
|
12578
|
-
}
|
|
12579
|
-
return { code: defaultCode, status: defaultStatus };
|
|
12580
|
-
}
|
|
12581
|
-
/**
|
|
12582
|
-
* Determines appropriate error code from ResponseError by looking up status in ERROR_DEFINITIONS
|
|
12583
|
-
*/
|
|
12584
|
-
static determineErrorCode(error) {
|
|
12585
|
-
if ("isCancelled" in error && error.isCancelled) {
|
|
12586
|
-
return API_ERROR_CODES.CLIENT_CANCELLED;
|
|
12587
|
-
}
|
|
12588
|
-
const status = error.status ?? 0;
|
|
12589
|
-
const errorCode = getErrorCodeByStatus(status);
|
|
12590
|
-
if (errorCode) {
|
|
12591
|
-
return errorCode;
|
|
12592
|
-
}
|
|
12593
|
-
return this.getGenericErrorCode(status);
|
|
12594
|
-
}
|
|
12595
|
-
/**
|
|
12596
|
-
* Gets a generic error code based on HTTP status range
|
|
12597
|
-
*/
|
|
12598
|
-
static getGenericErrorCode(status) {
|
|
12599
|
-
if (status === 0) {
|
|
12600
|
-
return API_ERROR_CODES.NETWORK_ERROR;
|
|
12601
|
-
}
|
|
12602
|
-
if (status >= HTTP_STATUS.BAD_REQUEST && status < HTTP_STATUS.INTERNAL_SERVER_ERROR) {
|
|
12603
|
-
return API_ERROR_CODES.CLIENT_ERROR;
|
|
12604
|
-
}
|
|
12605
|
-
if (status >= HTTP_STATUS.INTERNAL_SERVER_ERROR) {
|
|
12606
|
-
return API_ERROR_CODES.SERVER_ERROR;
|
|
12607
|
-
}
|
|
12608
|
-
return API_ERROR_CODES.UNKNOWN_ERROR;
|
|
12609
|
-
}
|
|
12610
|
-
/**
|
|
12611
|
-
* Gets the error category from ERROR_DEFINITIONS
|
|
12612
|
-
*/
|
|
12613
|
-
categorizeError() {
|
|
12614
|
-
const definition = ERROR_DEFINITIONS$1[this.errorCode];
|
|
12615
|
-
return definition?.category ?? ERROR_CATEGORY.Unknown;
|
|
12616
|
-
}
|
|
12617
|
-
/**
|
|
12618
|
-
* Checks if this is a specific category of error
|
|
12619
|
-
*/
|
|
12620
|
-
isAuthError() {
|
|
12621
|
-
return this.category === ERROR_CATEGORY.Authentication || this.category === ERROR_CATEGORY.Authorization;
|
|
12622
|
-
}
|
|
12623
|
-
isValidationError() {
|
|
12624
|
-
return this.category === ERROR_CATEGORY.Validation;
|
|
12625
|
-
}
|
|
12626
|
-
isNetworkError() {
|
|
12627
|
-
return this.category === ERROR_CATEGORY.Network;
|
|
12628
|
-
}
|
|
12629
|
-
isServerError() {
|
|
12630
|
-
return this.category === ERROR_CATEGORY.Server;
|
|
12631
|
-
}
|
|
12632
|
-
isClientError() {
|
|
12633
|
-
return this.statusCode >= HTTP_STATUS.BAD_REQUEST && this.statusCode < HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12634
|
-
}
|
|
12635
|
-
isRetryable() {
|
|
12636
|
-
return this.category === ERROR_CATEGORY.Network || this.category === ERROR_CATEGORY.Server || this.category === ERROR_CATEGORY.Timeout || this.statusCode === HTTP_STATUS.TOO_MANY_REQUESTS || // Rate limit
|
|
12637
|
-
this.statusCode >= HTTP_STATUS.INTERNAL_SERVER_ERROR;
|
|
12638
|
-
}
|
|
12639
|
-
/**
|
|
12640
|
-
* Converts to ErrorResponse format (as per task-020)
|
|
12641
|
-
*/
|
|
12642
|
-
toJSON() {
|
|
12643
|
-
return {
|
|
12644
|
-
statusCode: this.statusCode,
|
|
12645
|
-
errorCode: this.errorCode,
|
|
12646
|
-
message: this.message,
|
|
12647
|
-
errors: this.errors ?? [],
|
|
12648
|
-
correlationId: this.correlationId,
|
|
12649
|
-
timestamp: this.timestamp
|
|
12650
|
-
};
|
|
12651
|
-
}
|
|
12652
|
-
/**
|
|
12653
|
-
* Creates a string representation
|
|
12654
|
-
*/
|
|
12655
|
-
toString() {
|
|
12656
|
-
return `[${this.errorCode}] ${this.message} (Status: ${this.statusCode}, Category: ${this.category})`;
|
|
12657
|
-
}
|
|
12658
|
-
/**
|
|
12659
|
-
* Check if error is an ApiPackageError
|
|
12660
|
-
*/
|
|
12661
|
-
static isApiPackageError(error) {
|
|
12662
|
-
return error instanceof _ApiPackageError;
|
|
12663
|
-
}
|
|
12664
|
-
/**
|
|
12665
|
-
* Get user-friendly message for display
|
|
12666
|
-
*/
|
|
12667
|
-
getUserMessage() {
|
|
12668
|
-
const customMessage = this.getCustomUserMessage();
|
|
12669
|
-
if (customMessage) {
|
|
12670
|
-
return customMessage;
|
|
12671
|
-
}
|
|
12672
|
-
return this.getDefaultUserMessage();
|
|
12673
|
-
}
|
|
12674
|
-
/**
|
|
12675
|
-
* Gets custom user message from error details if available
|
|
12676
|
-
*/
|
|
12677
|
-
getCustomUserMessage() {
|
|
12678
|
-
if (!this.details?.length) {
|
|
12679
|
-
return null;
|
|
12680
|
-
}
|
|
12681
|
-
const userMessage = this.details.find((d) => d.field === "userMessage");
|
|
12682
|
-
return userMessage ? userMessage.message : null;
|
|
12683
|
-
}
|
|
12684
|
-
/**
|
|
12685
|
-
* Gets default user message based on error category
|
|
12686
|
-
*/
|
|
12687
|
-
getDefaultUserMessage() {
|
|
12688
|
-
const messages = {
|
|
12689
|
-
[ERROR_CATEGORY.Authentication]: "Authentication failed. Please check your credentials.",
|
|
12690
|
-
[ERROR_CATEGORY.Authorization]: "You do not have permission to perform this action.",
|
|
12691
|
-
[ERROR_CATEGORY.Validation]: "Please check your input and try again.",
|
|
12692
|
-
[ERROR_CATEGORY.NotFound]: "The requested resource was not found.",
|
|
12693
|
-
[ERROR_CATEGORY.RateLimit]: "Too many requests. Please try again later.",
|
|
12694
|
-
[ERROR_CATEGORY.Network]: "Network error. Please check your connection.",
|
|
12695
|
-
[ERROR_CATEGORY.Timeout]: "The request timed out. Please try again.",
|
|
12696
|
-
[ERROR_CATEGORY.Server]: "Server error. Please try again later.",
|
|
12697
|
-
[ERROR_CATEGORY.Client]: "Client error. Please check your request.",
|
|
12698
|
-
[ERROR_CATEGORY.Blockchain]: "Blockchain error. Please try again later.",
|
|
12699
|
-
[ERROR_CATEGORY.ExternalService]: "External service error. Please try again later.",
|
|
12700
|
-
[ERROR_CATEGORY.Conflict]: "Conflict detected. Please resolve and try again.",
|
|
12701
|
-
[ERROR_CATEGORY.Cache]: "Cache error. Please try again.",
|
|
12702
|
-
[ERROR_CATEGORY.Headers]: "Headers error. Please check your request headers.",
|
|
12703
|
-
[ERROR_CATEGORY.Retry]: "Retry limit exceeded. Please try again later.",
|
|
12704
|
-
[ERROR_CATEGORY.Strategy]: "Strategy error. Invalid configuration.",
|
|
12705
|
-
[ERROR_CATEGORY.Regional]: "Regional configuration error. Please check your region settings.",
|
|
12706
|
-
[ERROR_CATEGORY.Unknown]: "An unexpected error occurred. Please try again later."
|
|
12707
|
-
};
|
|
12708
|
-
return messages[this.category] ?? "An unexpected error occurred. Please try again later.";
|
|
12709
|
-
}
|
|
12710
|
-
};
|
|
12711
|
-
|
|
12712
|
-
// src/api/errors/error-codes.ts
|
|
12713
|
-
var API_ERROR_CODES6 = {
|
|
12714
|
-
// Client Configuration Errors
|
|
12715
|
-
CLIENT_INITIALIZATION_FAILED: "CLIENT_INITIALIZATION_FAILED",
|
|
12716
|
-
// Header Errors
|
|
12717
|
-
HEADERS_ENRICHMENT_FAILED: "HEADERS_ENRICHMENT_FAILED",
|
|
12718
|
-
// Polling Errors
|
|
12719
|
-
POLLING_TIMEOUT: "POLLING_TIMEOUT",
|
|
12720
|
-
POLLING_CANCELLED: "POLLING_CANCELLED"};
|
|
12721
|
-
var PACKAGE_STATUS_CODES3 = {
|
|
12722
|
-
// Internal system errors
|
|
12723
|
-
INITIALIZATION_FAILED: 1040,
|
|
12724
|
-
OPERATION_FAILED: 1041};
|
|
12725
|
-
|
|
12726
|
-
// src/api/errors/types-constants.ts
|
|
12727
|
-
var OPERATIONS3 = {
|
|
12728
|
-
ENRICHMENT: "enrichment",
|
|
12729
|
-
INITIALIZATION: "initialization",
|
|
12730
|
-
POLLING: "polling"};
|
|
12731
|
-
|
|
12732
|
-
// src/api/polling/utils.ts
|
|
12733
|
-
function isPollingActive(config) {
|
|
12734
|
-
return (config.interval ?? 0) > 0;
|
|
12735
|
-
}
|
|
12736
|
-
__name(isPollingActive, "isPollingActive");
|
|
12737
|
-
function calculatePollingDuration(config) {
|
|
12738
|
-
if (!config.interval || !config.maxAttempts || config.maxAttempts <= 0) {
|
|
12739
|
-
return null;
|
|
12740
|
-
}
|
|
12741
|
-
const intervals = config.interval * config.maxAttempts;
|
|
12742
|
-
const delays = (config.delay ?? 0) * config.maxAttempts;
|
|
12743
|
-
return intervals + delays;
|
|
12744
|
-
}
|
|
12745
|
-
__name(calculatePollingDuration, "calculatePollingDuration");
|
|
12746
|
-
function getSSRSafePollingConfig(config) {
|
|
12747
|
-
if (!isBrowser()) {
|
|
12748
|
-
return {
|
|
12749
|
-
...config,
|
|
12750
|
-
interval: 0,
|
|
12751
|
-
maxAttempts: 1
|
|
12752
|
-
};
|
|
12753
|
-
}
|
|
12754
|
-
return config;
|
|
12755
|
-
}
|
|
12756
|
-
__name(getSSRSafePollingConfig, "getSSRSafePollingConfig");
|
|
12757
|
-
function createProgressivePolling(options = {}) {
|
|
12758
|
-
const { baseInterval = 1e3, maxInterval = 3e4, multiplier = 1.5 } = options;
|
|
12759
|
-
return {
|
|
12760
|
-
interval: baseInterval,
|
|
12761
|
-
delay: 0,
|
|
12762
|
-
maxAttempts: -1,
|
|
12763
|
-
shouldStop: /* @__PURE__ */ __name((_response, attempt) => {
|
|
12764
|
-
return false;
|
|
12765
|
-
}, "shouldStop")
|
|
11943
|
+
__name(getSSRSafePollingConfig, "getSSRSafePollingConfig");
|
|
11944
|
+
function createProgressivePolling(options = {}) {
|
|
11945
|
+
const { baseInterval = 1e3, maxInterval = 3e4, multiplier = 1.5 } = options;
|
|
11946
|
+
return {
|
|
11947
|
+
interval: baseInterval,
|
|
11948
|
+
delay: 0,
|
|
11949
|
+
maxAttempts: -1,
|
|
11950
|
+
shouldStop: /* @__PURE__ */ __name((_response, attempt) => {
|
|
11951
|
+
return false;
|
|
11952
|
+
}, "shouldStop")
|
|
12766
11953
|
};
|
|
12767
11954
|
}
|
|
12768
11955
|
__name(createProgressivePolling, "createProgressivePolling");
|
|
@@ -12779,11 +11966,11 @@ function createConditionalPolling(options) {
|
|
|
12779
11966
|
if (options.errorCondition?.(response)) {
|
|
12780
11967
|
new ApiPackageError(
|
|
12781
11968
|
"polling.error_condition",
|
|
12782
|
-
|
|
12783
|
-
|
|
11969
|
+
INTERNAL_STATUS_CODES.OPERATION_FAILED,
|
|
11970
|
+
API_ERROR_CODES$1.POLLING_CANCELLED,
|
|
12784
11971
|
{
|
|
12785
11972
|
context: {
|
|
12786
|
-
operation:
|
|
11973
|
+
operation: COMMON_OPERATIONS.POLLING,
|
|
12787
11974
|
reason: "Error condition met",
|
|
12788
11975
|
i18n: {
|
|
12789
11976
|
reason: "error_condition"
|
|
@@ -12798,11 +11985,11 @@ function createConditionalPolling(options) {
|
|
|
12798
11985
|
if (elapsed >= options.timeoutMs) {
|
|
12799
11986
|
new ApiPackageError(
|
|
12800
11987
|
"polling.timeout",
|
|
12801
|
-
|
|
12802
|
-
|
|
11988
|
+
INTERNAL_STATUS_CODES.OPERATION_FAILED,
|
|
11989
|
+
API_ERROR_CODES$1.POLLING_TIMEOUT,
|
|
12803
11990
|
{
|
|
12804
11991
|
context: {
|
|
12805
|
-
operation:
|
|
11992
|
+
operation: COMMON_OPERATIONS.POLLING,
|
|
12806
11993
|
timeoutMs: options.timeoutMs,
|
|
12807
11994
|
elapsed,
|
|
12808
11995
|
i18n: {
|
|
@@ -13969,7 +13156,7 @@ function filterToFetchffProperties(config) {
|
|
|
13969
13156
|
maxPollingAttempts,
|
|
13970
13157
|
shouldStopPolling,
|
|
13971
13158
|
fetcher,
|
|
13972
|
-
logger,
|
|
13159
|
+
logger: logger19,
|
|
13973
13160
|
// Cache properties
|
|
13974
13161
|
cacheTime,
|
|
13975
13162
|
staleTime,
|
|
@@ -14062,7 +13249,7 @@ function filterToFetchffProperties(config) {
|
|
|
14062
13249
|
if (shouldStopPolling !== void 0 && shouldStopPolling !== null)
|
|
14063
13250
|
fetchffConfig.shouldStopPolling = shouldStopPolling;
|
|
14064
13251
|
if (fetcher !== void 0 && fetcher !== null) fetchffConfig.fetcher = fetcher;
|
|
14065
|
-
if (
|
|
13252
|
+
if (logger19 !== void 0 && logger19 !== null) fetchffConfig.logger = logger19;
|
|
14066
13253
|
if (cacheTime !== void 0) fetchffConfig.cacheTime = cacheTime;
|
|
14067
13254
|
if (staleTime !== void 0) fetchffConfig.staleTime = staleTime;
|
|
14068
13255
|
if (skipCache !== void 0) fetchffConfig.skipCache = skipCache;
|
|
@@ -14439,11 +13626,33 @@ function trackGlobalConfigUpdate(params) {
|
|
|
14439
13626
|
});
|
|
14440
13627
|
}
|
|
14441
13628
|
__name(trackGlobalConfigUpdate, "trackGlobalConfigUpdate");
|
|
13629
|
+
function handleGlobalErrorSystemConfig(errorConfig) {
|
|
13630
|
+
const alreadyInitialized = isErrorSystemInitialized();
|
|
13631
|
+
if (alreadyInitialized) {
|
|
13632
|
+
if (errorConfig.locale) {
|
|
13633
|
+
setErrorLocale(errorConfig.locale);
|
|
13634
|
+
}
|
|
13635
|
+
if (errorConfig.additionalCatalogs) {
|
|
13636
|
+
Object.entries(errorConfig.additionalCatalogs).forEach(([locale, catalog]) => {
|
|
13637
|
+
addMessageCatalog(locale, catalog, true);
|
|
13638
|
+
});
|
|
13639
|
+
}
|
|
13640
|
+
} else {
|
|
13641
|
+
initializeErrorSystem({
|
|
13642
|
+
defaultLocale: errorConfig.locale,
|
|
13643
|
+
additionalCatalogs: errorConfig.additionalCatalogs
|
|
13644
|
+
});
|
|
13645
|
+
}
|
|
13646
|
+
}
|
|
13647
|
+
__name(handleGlobalErrorSystemConfig, "handleGlobalErrorSystemConfig");
|
|
14442
13648
|
function setGlobalConfig(config) {
|
|
14443
13649
|
try {
|
|
14444
13650
|
const startTime = Date.now();
|
|
14445
13651
|
const currentConfig = globalApiConfig;
|
|
14446
13652
|
validateConfigObject(config);
|
|
13653
|
+
if (config.errors) {
|
|
13654
|
+
handleGlobalErrorSystemConfig(config.errors);
|
|
13655
|
+
}
|
|
14447
13656
|
const { merged: mergedConfig, entries: configEntries } = mergeGlobalConfig(
|
|
14448
13657
|
currentConfig,
|
|
14449
13658
|
config
|
|
@@ -14504,7 +13713,7 @@ function resetGlobalConfig() {
|
|
|
14504
13713
|
activeScopes: eventManager.getActiveScopes?.() ?? []
|
|
14505
13714
|
};
|
|
14506
13715
|
globalApiConfig = {};
|
|
14507
|
-
eventManager.setEventScopes([...EVENT_SCOPES]);
|
|
13716
|
+
eventManager.setEventScopes([...EVENT_SCOPES$1]);
|
|
14508
13717
|
const afterEventState = {
|
|
14509
13718
|
totalEvents: eventManager.getEventStats?.()?.totalEvents ?? 0,
|
|
14510
13719
|
totalListeners: eventManager.getEventStats?.()?.totalListeners ?? 0,
|
|
@@ -14618,10 +13827,6 @@ var campaignEndpoints = {
|
|
|
14618
13827
|
createCampaign: {
|
|
14619
13828
|
url: "/campaigns",
|
|
14620
13829
|
method: "POST"
|
|
14621
|
-
// Example: Override global settings for this endpoint
|
|
14622
|
-
// cancellable: true, // Cancel previous create requests
|
|
14623
|
-
// timeout: 60000, // Longer timeout for creation
|
|
14624
|
-
// retry: { attempts: 1 } // Don't retry POST requests
|
|
14625
13830
|
},
|
|
14626
13831
|
updateCampaign: {
|
|
14627
13832
|
url: "/campaigns/:id",
|
|
@@ -14634,9 +13839,6 @@ var campaignEndpoints = {
|
|
|
14634
13839
|
getCampaignStats: {
|
|
14635
13840
|
url: "/campaigns/:id/stats",
|
|
14636
13841
|
method: "GET"
|
|
14637
|
-
// Example: Cache stats for longer
|
|
14638
|
-
// cacheTime: 600, // Cache for 10 minutes
|
|
14639
|
-
// staleTime: 1200 // Consider stale after 20 minutes
|
|
14640
13842
|
},
|
|
14641
13843
|
getCampaignParticipants: {
|
|
14642
13844
|
url: "/campaigns/:id/participants",
|
|
@@ -14714,6 +13916,111 @@ var pollingEndpoints = {
|
|
|
14714
13916
|
}
|
|
14715
13917
|
};
|
|
14716
13918
|
|
|
13919
|
+
// src/api/endpoints/infobip.ts
|
|
13920
|
+
var infobipEmailEndpoints = {
|
|
13921
|
+
// ========== Outbound Email ==========
|
|
13922
|
+
/**
|
|
13923
|
+
* POST /email/3/send - Send email (simple, with attachment support)
|
|
13924
|
+
* Multipart/form-data for attachments
|
|
13925
|
+
*/
|
|
13926
|
+
sendEmail: {
|
|
13927
|
+
url: "/email/3/send",
|
|
13928
|
+
method: "POST"
|
|
13929
|
+
},
|
|
13930
|
+
/**
|
|
13931
|
+
* POST /email/4/send - Send advanced email
|
|
13932
|
+
* JSON payload with full customization
|
|
13933
|
+
*/
|
|
13934
|
+
sendAdvancedEmail: {
|
|
13935
|
+
url: "/email/4/messages",
|
|
13936
|
+
method: "POST"
|
|
13937
|
+
},
|
|
13938
|
+
/**
|
|
13939
|
+
* POST /email/3/mime - Send email via MIME format
|
|
13940
|
+
*/
|
|
13941
|
+
sendEmailMime: {
|
|
13942
|
+
url: "/email/3/mime",
|
|
13943
|
+
method: "POST"
|
|
13944
|
+
},
|
|
13945
|
+
// ========== Email Validation ==========
|
|
13946
|
+
/**
|
|
13947
|
+
* POST /email/2/validation - Validate single email address
|
|
13948
|
+
*/
|
|
13949
|
+
validateEmail: {
|
|
13950
|
+
url: "/email/2/validation",
|
|
13951
|
+
method: "POST"
|
|
13952
|
+
},
|
|
13953
|
+
/**
|
|
13954
|
+
* POST /email/2/validations - Bulk validate email addresses
|
|
13955
|
+
* Returns 202 with validation request ID
|
|
13956
|
+
*/
|
|
13957
|
+
bulkValidateEmails: {
|
|
13958
|
+
url: "/email/2/validations",
|
|
13959
|
+
method: "POST"
|
|
13960
|
+
},
|
|
13961
|
+
/**
|
|
13962
|
+
* GET /email/2/validations - Get validation results
|
|
13963
|
+
* Retrieve bulk validation results with filtering
|
|
13964
|
+
*/
|
|
13965
|
+
getValidations: {
|
|
13966
|
+
url: "/email/2/validations",
|
|
13967
|
+
method: "GET",
|
|
13968
|
+
cacheTime: 30,
|
|
13969
|
+
staleTime: 60
|
|
13970
|
+
},
|
|
13971
|
+
// ========== Logs & Reports ==========
|
|
13972
|
+
/**
|
|
13973
|
+
* GET /email/1/reports - Get email delivery reports
|
|
13974
|
+
*/
|
|
13975
|
+
getEmailReports: {
|
|
13976
|
+
url: "/email/1/reports",
|
|
13977
|
+
method: "GET",
|
|
13978
|
+
cacheTime: 30,
|
|
13979
|
+
staleTime: 60
|
|
13980
|
+
},
|
|
13981
|
+
/**
|
|
13982
|
+
* GET /email/1/logs - Get email logs
|
|
13983
|
+
*/
|
|
13984
|
+
getEmailLogs: {
|
|
13985
|
+
url: "/email/1/logs",
|
|
13986
|
+
method: "GET",
|
|
13987
|
+
cacheTime: 60,
|
|
13988
|
+
staleTime: 120
|
|
13989
|
+
},
|
|
13990
|
+
// ========== Scheduled Messages (Bulk Operations) ==========
|
|
13991
|
+
/**
|
|
13992
|
+
* GET /email/1/bulks - Get scheduled email bulks
|
|
13993
|
+
*/
|
|
13994
|
+
getScheduledEmails: {
|
|
13995
|
+
url: "/email/1/bulks",
|
|
13996
|
+
method: "GET"
|
|
13997
|
+
},
|
|
13998
|
+
/**
|
|
13999
|
+
* GET /email/1/bulks/status - Get scheduled email statuses
|
|
14000
|
+
*/
|
|
14001
|
+
getScheduledEmailStatuses: {
|
|
14002
|
+
url: "/email/1/bulks/status",
|
|
14003
|
+
method: "GET"
|
|
14004
|
+
},
|
|
14005
|
+
/**
|
|
14006
|
+
* PUT /email/1/bulks - Reschedule emails
|
|
14007
|
+
*/
|
|
14008
|
+
rescheduleEmails: {
|
|
14009
|
+
url: "/email/1/bulks",
|
|
14010
|
+
method: "PUT"
|
|
14011
|
+
},
|
|
14012
|
+
/**
|
|
14013
|
+
* PUT /email/1/bulks/status - Update scheduled email statuses
|
|
14014
|
+
*/
|
|
14015
|
+
updateScheduledEmailStatuses: {
|
|
14016
|
+
url: "/email/1/bulks/status",
|
|
14017
|
+
method: "PUT"
|
|
14018
|
+
}
|
|
14019
|
+
};
|
|
14020
|
+
var infobipEndpoints = {
|
|
14021
|
+
...infobipEmailEndpoints
|
|
14022
|
+
};
|
|
14023
|
+
|
|
14717
14024
|
// src/api/endpoints/utils.ts
|
|
14718
14025
|
function getEndpointUrl(name) {
|
|
14719
14026
|
return endpoints[name].url;
|
|
@@ -14886,7 +14193,9 @@ __name(validatePathParams, "validatePathParams");
|
|
|
14886
14193
|
var endpoints = {
|
|
14887
14194
|
...campaignEndpoints,
|
|
14888
14195
|
// These are only examples for the polling, none of these endpoints doesnt exist yet
|
|
14889
|
-
...pollingEndpoints
|
|
14196
|
+
...pollingEndpoints,
|
|
14197
|
+
// Infobip third-party provider endpoints (Email, SMS, WhatsApp)
|
|
14198
|
+
...infobipEndpoints
|
|
14890
14199
|
};
|
|
14891
14200
|
var isSlowConnection = isSlowConnection$1;
|
|
14892
14201
|
function isNetworkAPISupported() {
|
|
@@ -18267,6 +17576,7 @@ async function prepareRequestConfigWithEnrichedHeaders(requestConfig, clientConf
|
|
|
18267
17576
|
return config;
|
|
18268
17577
|
}
|
|
18269
17578
|
__name(prepareRequestConfigWithEnrichedHeaders, "prepareRequestConfigWithEnrichedHeaders");
|
|
17579
|
+
new ApiLogger({ service: LOGGER_SERVICES.EXPRESS_FRAMEWORK, transport: "console" });
|
|
18270
17580
|
var networkDetectionMiddleware = /* @__PURE__ */ __name((req, res, next) => {
|
|
18271
17581
|
const headerInfo = getNetworkInfoFromHeaders(req.headers);
|
|
18272
17582
|
const networkInfo = {
|
|
@@ -18427,6 +17737,7 @@ __name(MinimumConnectionGuard, "MinimumConnectionGuard");
|
|
|
18427
17737
|
MinimumConnectionGuard = __decorateClass([
|
|
18428
17738
|
Injectable()
|
|
18429
17739
|
], MinimumConnectionGuard);
|
|
17740
|
+
var logger13 = new ApiLogger({ service: LOGGER_SERVICES.NESTJS_GUARD, transport: "console" });
|
|
18430
17741
|
var EnrichedHeadersGuard = class {
|
|
18431
17742
|
constructor(options = {}) {
|
|
18432
17743
|
this.options = options;
|
|
@@ -18441,7 +17752,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18441
17752
|
for (const requiredHeader of requiredHeaders) {
|
|
18442
17753
|
if (!enrichedHeaders[requiredHeader]) {
|
|
18443
17754
|
if (debug) {
|
|
18444
|
-
|
|
17755
|
+
logger13.warn("Missing required header", { requiredHeader });
|
|
18445
17756
|
}
|
|
18446
17757
|
return false;
|
|
18447
17758
|
}
|
|
@@ -18458,7 +17769,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18458
17769
|
const complianceHeader = enrichedHeaders["x-compliance-required"];
|
|
18459
17770
|
if (!complianceHeader) {
|
|
18460
17771
|
if (debug) {
|
|
18461
|
-
|
|
17772
|
+
logger13.warn("No compliance information available");
|
|
18462
17773
|
}
|
|
18463
17774
|
return false;
|
|
18464
17775
|
}
|
|
@@ -18468,7 +17779,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18468
17779
|
);
|
|
18469
17780
|
if (!hasRequiredCompliance) {
|
|
18470
17781
|
if (debug) {
|
|
18471
|
-
|
|
17782
|
+
logger13.warn("Required compliance not met", {
|
|
18472
17783
|
required: requiredCompliance,
|
|
18473
17784
|
current: currentCompliance
|
|
18474
17785
|
});
|
|
@@ -18482,7 +17793,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18482
17793
|
*/
|
|
18483
17794
|
async buildHeadersForRequest(request, enrichedOptions, debug) {
|
|
18484
17795
|
if (debug) {
|
|
18485
|
-
|
|
17796
|
+
logger13.debug("Processing request with enriched headers guard", {
|
|
18486
17797
|
method: request.method,
|
|
18487
17798
|
url: request.url,
|
|
18488
17799
|
userAgent: request.headers["user-agent"]
|
|
@@ -18498,7 +17809,7 @@ var EnrichedHeadersGuard = class {
|
|
|
18498
17809
|
};
|
|
18499
17810
|
const enrichedHeaders = await buildEnrichedHeaders(requestContext, enrichedOptions);
|
|
18500
17811
|
if (debug) {
|
|
18501
|
-
|
|
17812
|
+
logger13.debug("Built enriched headers in guard", { enrichedHeaders });
|
|
18502
17813
|
}
|
|
18503
17814
|
return enrichedHeaders;
|
|
18504
17815
|
}
|
|
@@ -18530,7 +17841,9 @@ var EnrichedHeadersGuard = class {
|
|
|
18530
17841
|
*/
|
|
18531
17842
|
async handleBuildError(error, request, debug) {
|
|
18532
17843
|
if (debug) {
|
|
18533
|
-
|
|
17844
|
+
logger13.error("Error building headers in guard", {
|
|
17845
|
+
error: error instanceof Error ? error.message : String(error)
|
|
17846
|
+
});
|
|
18534
17847
|
}
|
|
18535
17848
|
new ApiPackageError(
|
|
18536
17849
|
"nestjs.guard.enriched_headers_failed",
|
|
@@ -18578,6 +17891,7 @@ __name(EnrichedHeadersGuard, "EnrichedHeadersGuard");
|
|
|
18578
17891
|
EnrichedHeadersGuard = __decorateClass([
|
|
18579
17892
|
Injectable()
|
|
18580
17893
|
], EnrichedHeadersGuard);
|
|
17894
|
+
var logger14 = new ApiLogger({ service: LOGGER_SERVICES.NESTJS_INTERCEPTOR, transport: "console" });
|
|
18581
17895
|
var EnrichedHeadersInterceptor = class {
|
|
18582
17896
|
constructor(options = {}) {
|
|
18583
17897
|
this.options = options;
|
|
@@ -18629,7 +17943,9 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18629
17943
|
*/
|
|
18630
17944
|
handleContextError(error, request, debug) {
|
|
18631
17945
|
if (debug) {
|
|
18632
|
-
|
|
17946
|
+
logger14.error("Error in interceptor context", {
|
|
17947
|
+
error: error.message
|
|
17948
|
+
});
|
|
18633
17949
|
}
|
|
18634
17950
|
new ApiPackageError(
|
|
18635
17951
|
"nestjs.interceptor.context_error",
|
|
@@ -18654,7 +17970,9 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18654
17970
|
*/
|
|
18655
17971
|
handleBuildError(error, request, next, debug) {
|
|
18656
17972
|
if (debug) {
|
|
18657
|
-
|
|
17973
|
+
logger14.error("Error building headers in interceptor", {
|
|
17974
|
+
error: error instanceof Error ? error.message : String(error)
|
|
17975
|
+
});
|
|
18658
17976
|
}
|
|
18659
17977
|
new ApiPackageError(
|
|
18660
17978
|
"nestjs.interceptor.enriched_headers_failed",
|
|
@@ -18698,7 +18016,9 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18698
18016
|
*/
|
|
18699
18017
|
handleFallbackError(error, request, debug) {
|
|
18700
18018
|
if (debug) {
|
|
18701
|
-
|
|
18019
|
+
logger14.error("Error in fallback context", {
|
|
18020
|
+
error: error.message
|
|
18021
|
+
});
|
|
18702
18022
|
}
|
|
18703
18023
|
new ApiPackageError(
|
|
18704
18024
|
"nestjs.interceptor.fallback_error",
|
|
@@ -18725,7 +18045,7 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18725
18045
|
const response = http.getResponse();
|
|
18726
18046
|
try {
|
|
18727
18047
|
if (debug) {
|
|
18728
|
-
|
|
18048
|
+
logger14.debug("Processing request with enriched headers interceptor", {
|
|
18729
18049
|
method: request.method,
|
|
18730
18050
|
url: request.url,
|
|
18731
18051
|
userAgent: request.headers["user-agent"]
|
|
@@ -18733,7 +18053,7 @@ var EnrichedHeadersInterceptor = class {
|
|
|
18733
18053
|
}
|
|
18734
18054
|
const enrichedHeaders = await this.buildHeaders(request, enrichedOptions);
|
|
18735
18055
|
if (debug) {
|
|
18736
|
-
|
|
18056
|
+
logger14.debug("Built enriched headers in interceptor", { enrichedHeaders });
|
|
18737
18057
|
}
|
|
18738
18058
|
if (storeInRequest) {
|
|
18739
18059
|
request.enrichedHeaders = enrichedHeaders;
|
|
@@ -19458,65 +18778,6 @@ var NetworkPresetNames = {
|
|
|
19458
18778
|
BACKGROUND_SYNC: "background-sync"
|
|
19459
18779
|
};
|
|
19460
18780
|
|
|
19461
|
-
// src/api/utils/generation/request-id.ts
|
|
19462
|
-
var REQUEST_ID_CONSTANTS = {
|
|
19463
|
-
PREFIX_LENGTH: 4
|
|
19464
|
-
// Length of 'req_'
|
|
19465
|
-
};
|
|
19466
|
-
var requestIdGenerator = createIdGenerator({
|
|
19467
|
-
prefix: "req",
|
|
19468
|
-
useTimestamp: false
|
|
19469
|
-
// Use UUID for request IDs for guaranteed uniqueness
|
|
19470
|
-
});
|
|
19471
|
-
function generateRequestId(options) {
|
|
19472
|
-
return requestIdGenerator(options);
|
|
19473
|
-
}
|
|
19474
|
-
__name(generateRequestId, "generateRequestId");
|
|
19475
|
-
function generateContextualRequestId(method, url, options) {
|
|
19476
|
-
const context = {};
|
|
19477
|
-
if (method || url) {
|
|
19478
|
-
context.method = method ?? "UNKNOWN";
|
|
19479
|
-
context.url = url ?? "UNKNOWN";
|
|
19480
|
-
}
|
|
19481
|
-
return generateContextualId(context, {
|
|
19482
|
-
prefix: "req",
|
|
19483
|
-
...options
|
|
19484
|
-
});
|
|
19485
|
-
}
|
|
19486
|
-
__name(generateContextualRequestId, "generateContextualRequestId");
|
|
19487
|
-
function extractBaseRequestId(contextualId) {
|
|
19488
|
-
let id = extractBaseId(contextualId, { separator: ":", extractLast: true });
|
|
19489
|
-
if (id.startsWith("req_")) {
|
|
19490
|
-
id = id.substring(REQUEST_ID_CONSTANTS.PREFIX_LENGTH);
|
|
19491
|
-
}
|
|
19492
|
-
return id;
|
|
19493
|
-
}
|
|
19494
|
-
__name(extractBaseRequestId, "extractBaseRequestId");
|
|
19495
|
-
function isValidRequestId(id) {
|
|
19496
|
-
return isValidId(id, {
|
|
19497
|
-
allowUuid: true,
|
|
19498
|
-
allowTimestamp: true,
|
|
19499
|
-
allowPrefix: true,
|
|
19500
|
-
minLength: 5
|
|
19501
|
-
});
|
|
19502
|
-
}
|
|
19503
|
-
__name(isValidRequestId, "isValidRequestId");
|
|
19504
|
-
function generateShortRequestId(options) {
|
|
19505
|
-
return requestIdGenerator({
|
|
19506
|
-
useTimestamp: true,
|
|
19507
|
-
randomLength: 8,
|
|
19508
|
-
...options
|
|
19509
|
-
});
|
|
19510
|
-
}
|
|
19511
|
-
__name(generateShortRequestId, "generateShortRequestId");
|
|
19512
|
-
function createRequestIdGenerator(defaultOptions = {}) {
|
|
19513
|
-
return createIdGenerator({
|
|
19514
|
-
prefix: "req",
|
|
19515
|
-
...defaultOptions
|
|
19516
|
-
});
|
|
19517
|
-
}
|
|
19518
|
-
__name(createRequestIdGenerator, "createRequestIdGenerator");
|
|
19519
|
-
|
|
19520
18781
|
// src/api/utils/async-control.ts
|
|
19521
18782
|
function debounce(func, delay) {
|
|
19522
18783
|
let timeoutId;
|
|
@@ -19798,6 +19059,10 @@ function getAllMediaExtensions() {
|
|
|
19798
19059
|
}
|
|
19799
19060
|
__name(getAllMediaExtensions, "getAllMediaExtensions");
|
|
19800
19061
|
var MEDIA_MIME_PREFIXES = ["image/", "video/", "audio/"];
|
|
19062
|
+
var logger15 = new ApiLogger({
|
|
19063
|
+
service: LOGGER_SERVICES.CLIENT_EVENT_MANAGER,
|
|
19064
|
+
transport: "console"
|
|
19065
|
+
});
|
|
19801
19066
|
var EVENT_CONSTANTS2 = {
|
|
19802
19067
|
DEBUG_INFO_INTERVAL_MULTIPLIER: 5,
|
|
19803
19068
|
IMPACT_THRESHOLDS: {
|
|
@@ -19814,10 +19079,10 @@ var ClientEventManager = class _ClientEventManager {
|
|
|
19814
19079
|
if (!this.config.configOverride) {
|
|
19815
19080
|
this.config.configOverride = {
|
|
19816
19081
|
// By default, client emits to all scopes (merged behavior)
|
|
19817
|
-
eventScopes: [...EVENT_SCOPES]
|
|
19082
|
+
eventScopes: [...EVENT_SCOPES$1]
|
|
19818
19083
|
};
|
|
19819
19084
|
} else {
|
|
19820
|
-
this.config.configOverride.eventScopes ??= [...EVENT_SCOPES];
|
|
19085
|
+
this.config.configOverride.eventScopes ??= [...EVENT_SCOPES$1];
|
|
19821
19086
|
}
|
|
19822
19087
|
eventManager.setEventScopes(this.config.configOverride.eventScopes);
|
|
19823
19088
|
this.setupEventHandlers();
|
|
@@ -20010,7 +19275,9 @@ var ClientEventManager = class _ClientEventManager {
|
|
|
20010
19275
|
const registeredHandlers = [];
|
|
20011
19276
|
finalHandlers.forEach((h) => {
|
|
20012
19277
|
if (typeof h !== "function") {
|
|
20013
|
-
|
|
19278
|
+
logger15.warn("Invalid handler provided - not a function", {
|
|
19279
|
+
handlerType: typeof h
|
|
19280
|
+
});
|
|
20014
19281
|
return;
|
|
20015
19282
|
}
|
|
20016
19283
|
const wrappedHandler = /* @__PURE__ */ __name((eventData) => {
|
|
@@ -20240,7 +19507,7 @@ var ClientEventManager = class _ClientEventManager {
|
|
|
20240
19507
|
*/
|
|
20241
19508
|
setupEventScopes(updates, strategy) {
|
|
20242
19509
|
updates.configOverride ??= {};
|
|
20243
|
-
updates.configOverride.eventScopes ??= strategy === "temporary" ? ["request"] : [...EVENT_SCOPES];
|
|
19510
|
+
updates.configOverride.eventScopes ??= strategy === "temporary" ? ["request"] : [...EVENT_SCOPES$1];
|
|
20244
19511
|
if (updates.configOverride?.eventScopes) {
|
|
20245
19512
|
eventManager.setEventScopes(updates.configOverride.eventScopes);
|
|
20246
19513
|
} else if (this.config.configOverride?.eventScopes) {
|
|
@@ -20527,10 +19794,20 @@ var ClientEventManager = class _ClientEventManager {
|
|
|
20527
19794
|
return this.eventManager.getActiveScopes();
|
|
20528
19795
|
}
|
|
20529
19796
|
/**
|
|
20530
|
-
* Emit error event
|
|
19797
|
+
* Emit error event at CLIENT scope
|
|
19798
|
+
*
|
|
19799
|
+
* Note: ApiPackageError instances automatically emit to ALL scopes when created.
|
|
19800
|
+
* This method emits specifically at CLIENT scope, useful for:
|
|
19801
|
+
* - Re-emitting errors that were caught and handled elsewhere
|
|
19802
|
+
* - Manual emission timing control
|
|
19803
|
+
* - Client-level error broadcasting
|
|
20531
19804
|
*/
|
|
20532
19805
|
emitError(error) {
|
|
20533
|
-
|
|
19806
|
+
emitScopedErrorEvent(API_ERROR_NAMESPACE, error, {
|
|
19807
|
+
scopes: ["CLIENT"],
|
|
19808
|
+
eventFactory: apiErrorEventFactory,
|
|
19809
|
+
category: error.category
|
|
19810
|
+
});
|
|
20534
19811
|
}
|
|
20535
19812
|
/**
|
|
20536
19813
|
* Emit request start event
|
|
@@ -20586,11 +19863,11 @@ function setupClientEvents(client, globalConfig, clientConfig) {
|
|
|
20586
19863
|
if (!eventConfig.configOverride?.eventScopes) {
|
|
20587
19864
|
if (!eventConfig.configOverride) {
|
|
20588
19865
|
eventConfig.configOverride = {
|
|
20589
|
-
eventScopes: [...EVENT_SCOPES]
|
|
19866
|
+
eventScopes: [...EVENT_SCOPES$1]
|
|
20590
19867
|
// All scopes (merged)
|
|
20591
19868
|
};
|
|
20592
19869
|
} else {
|
|
20593
|
-
eventConfig.configOverride.eventScopes = [...EVENT_SCOPES];
|
|
19870
|
+
eventConfig.configOverride.eventScopes = [...EVENT_SCOPES$1];
|
|
20594
19871
|
}
|
|
20595
19872
|
}
|
|
20596
19873
|
const eventManager2 = new ClientEventManager(client, eventConfig);
|
|
@@ -21417,8 +20694,6 @@ function mergeHeaders(...headerSets) {
|
|
|
21417
20694
|
return result;
|
|
21418
20695
|
}
|
|
21419
20696
|
__name(mergeHeaders, "mergeHeaders");
|
|
21420
|
-
|
|
21421
|
-
// src/api/headers/headerBuilder.ts
|
|
21422
20697
|
var HeaderBuilder = class {
|
|
21423
20698
|
static {
|
|
21424
20699
|
__name(this, "HeaderBuilder");
|
|
@@ -21653,7 +20928,7 @@ var HeaderBuilder = class {
|
|
|
21653
20928
|
* ```
|
|
21654
20929
|
*/
|
|
21655
20930
|
correlationId(id) {
|
|
21656
|
-
this._headers["x-correlation-id"] = id ?? generateCorrelationId();
|
|
20931
|
+
this._headers["x-correlation-id"] = id ?? generateCorrelationId("req_correlation");
|
|
21657
20932
|
return this;
|
|
21658
20933
|
}
|
|
21659
20934
|
/**
|
|
@@ -22992,10 +22267,9 @@ function hasEncryptableFields(requestConfig, config) {
|
|
|
22992
22267
|
return targets.some((target) => hasMatchingFieldsInTarget(target, requestConfig, config));
|
|
22993
22268
|
}
|
|
22994
22269
|
__name(hasEncryptableFields, "hasEncryptableFields");
|
|
22995
|
-
|
|
22996
|
-
// src/api/client/helpers/interceptors.ts
|
|
22997
22270
|
var DEFAULT_MAX_RETRIES = 3;
|
|
22998
22271
|
var DEFAULT_SUCCESS_STATUS = HTTP_STATUS.OK;
|
|
22272
|
+
var logger16 = new ApiLogger({ service: LOGGER_SERVICES.INTERCEPTORS, transport: "console" });
|
|
22999
22273
|
function trackHeaderChanges(beforeHeaders, afterHeaders, interceptorIndex) {
|
|
23000
22274
|
const changes = [];
|
|
23001
22275
|
Object.entries(afterHeaders).forEach(([key, value]) => {
|
|
@@ -23055,7 +22329,27 @@ function createOnRetryHandler(handlers) {
|
|
|
23055
22329
|
};
|
|
23056
22330
|
}
|
|
23057
22331
|
__name(createOnRetryHandler, "createOnRetryHandler");
|
|
23058
|
-
function
|
|
22332
|
+
function normalizeHeaders4(headers2) {
|
|
22333
|
+
const normalized = {};
|
|
22334
|
+
for (const [key, value] of Object.entries(headers2 || {})) {
|
|
22335
|
+
normalized[key.toLowerCase()] = value;
|
|
22336
|
+
}
|
|
22337
|
+
return normalized;
|
|
22338
|
+
}
|
|
22339
|
+
__name(normalizeHeaders4, "normalizeHeaders");
|
|
22340
|
+
function mergeHeadersCaseInsensitive(...headerSets) {
|
|
22341
|
+
const result = {};
|
|
22342
|
+
for (const headers2 of headerSets) {
|
|
22343
|
+
if (!headers2) continue;
|
|
22344
|
+
for (const [key, value] of Object.entries(headers2)) {
|
|
22345
|
+
const normalizedKey = key.toLowerCase();
|
|
22346
|
+
result[normalizedKey] = value;
|
|
22347
|
+
}
|
|
22348
|
+
}
|
|
22349
|
+
return result;
|
|
22350
|
+
}
|
|
22351
|
+
__name(mergeHeadersCaseInsensitive, "mergeHeadersCaseInsensitive");
|
|
22352
|
+
function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfig, configStrategy) {
|
|
23059
22353
|
return async (config) => {
|
|
23060
22354
|
const performanceFactory = getPerformanceEventFactory();
|
|
23061
22355
|
const requestId = generateRequestId();
|
|
@@ -23079,12 +22373,28 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfi
|
|
|
23079
22373
|
"enrichedHeaders",
|
|
23080
22374
|
{ requestId }
|
|
23081
22375
|
);
|
|
23082
|
-
|
|
23083
|
-
|
|
23084
|
-
|
|
23085
|
-
|
|
22376
|
+
const strategy = configStrategy;
|
|
22377
|
+
if (strategy === "replace") {
|
|
22378
|
+
processedConfig = {
|
|
22379
|
+
...processedConfig,
|
|
22380
|
+
headers: normalizeHeaders4(enrichedHeaders)
|
|
22381
|
+
};
|
|
22382
|
+
} else {
|
|
22383
|
+
const mergedHeaders = mergeHeadersCaseInsensitive(
|
|
22384
|
+
enrichedHeaders,
|
|
22385
|
+
// Enriched headers (x-correlation-id, x-platform-type, etc.)
|
|
22386
|
+
config.headers
|
|
22387
|
+
// Existing headers (Authorization, Content-Type, etc.) - OVERRIDE enriched
|
|
22388
|
+
);
|
|
22389
|
+
processedConfig = {
|
|
22390
|
+
...processedConfig,
|
|
22391
|
+
headers: mergedHeaders
|
|
22392
|
+
};
|
|
22393
|
+
}
|
|
23086
22394
|
} catch (error) {
|
|
23087
|
-
|
|
22395
|
+
logger16.error("Failed to enrich headers", {
|
|
22396
|
+
error: error instanceof Error ? error.message : String(error)
|
|
22397
|
+
});
|
|
23088
22398
|
}
|
|
23089
22399
|
}
|
|
23090
22400
|
if (encryptionConfig?.enabled) {
|
|
@@ -23094,7 +22404,9 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfi
|
|
|
23094
22404
|
processedConfig = await encryptionInterceptor(processedConfig);
|
|
23095
22405
|
UnifiedDebugger.getInstance().trackConfigChange({ encryption: "applied" }, "encryption");
|
|
23096
22406
|
} catch (error) {
|
|
23097
|
-
|
|
22407
|
+
logger16.error("Failed to encrypt request", {
|
|
22408
|
+
error: error instanceof Error ? error.message : String(error)
|
|
22409
|
+
});
|
|
23098
22410
|
}
|
|
23099
22411
|
}
|
|
23100
22412
|
if (handlers && handlers.length > 0) {
|
|
@@ -23134,7 +22446,9 @@ function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComp
|
|
|
23134
22446
|
processedResponse = await decryptionInterceptor(processedResponse);
|
|
23135
22447
|
UnifiedDebugger.getInstance().trackConfigChange({ decryption: "applied" }, "encryption");
|
|
23136
22448
|
} catch (error) {
|
|
23137
|
-
|
|
22449
|
+
logger16.error("Failed to decrypt response", {
|
|
22450
|
+
error: error instanceof Error ? error.message : String(error)
|
|
22451
|
+
});
|
|
23138
22452
|
}
|
|
23139
22453
|
}
|
|
23140
22454
|
if (clearOnComplete && clearTemporaryOverrides2) {
|
|
@@ -23231,8 +22545,14 @@ function setupUnifiedHandlers(params) {
|
|
|
23231
22545
|
);
|
|
23232
22546
|
const clearOnComplete = mergedConfig.configOverride?.clearOnComplete ?? globalConfig?.configOverride?.clearOnComplete ?? clientOptions?.configOverride?.clearOnComplete;
|
|
23233
22547
|
const encryptionConfig = mergedConfig.encryption ?? globalConfig?.encryption ?? clientOptions?.encryption;
|
|
22548
|
+
const configStrategy = mergedConfig.configOverride?.strategy ?? clientOptions?.configOverride?.strategy ?? globalConfig?.configOverride?.strategy ?? "merge";
|
|
23234
22549
|
return {
|
|
23235
|
-
onRequest: createOnRequestHandler(
|
|
22550
|
+
onRequest: createOnRequestHandler(
|
|
22551
|
+
mergedOnRequest,
|
|
22552
|
+
enrichedHeadersConfig,
|
|
22553
|
+
encryptionConfig,
|
|
22554
|
+
configStrategy
|
|
22555
|
+
),
|
|
23236
22556
|
onResponse: createOnResponseHandler(
|
|
23237
22557
|
mergedOnResponse,
|
|
23238
22558
|
clearTemporaryOverrides2,
|
|
@@ -23244,13 +22564,12 @@ function setupUnifiedHandlers(params) {
|
|
|
23244
22564
|
};
|
|
23245
22565
|
}
|
|
23246
22566
|
__name(setupUnifiedHandlers, "setupUnifiedHandlers");
|
|
23247
|
-
|
|
23248
|
-
// src/api/client/createApiClient.ts
|
|
23249
22567
|
var ID_GENERATION = {
|
|
23250
22568
|
BASE: 36,
|
|
23251
22569
|
SUBSTR_START: 2,
|
|
23252
22570
|
SUBSTR_LENGTH: 9
|
|
23253
22571
|
};
|
|
22572
|
+
var logger17 = new ApiLogger({ service: LOGGER_SERVICES.API_CLIENT, transport: "console" });
|
|
23254
22573
|
function applyStrategies(config, options) {
|
|
23255
22574
|
let resolvedConfig = config;
|
|
23256
22575
|
if (options.unifiedStrategy) {
|
|
@@ -23280,12 +22599,11 @@ function applyStrategies(config, options) {
|
|
|
23280
22599
|
);
|
|
23281
22600
|
}
|
|
23282
22601
|
});
|
|
23283
|
-
|
|
23284
|
-
|
|
22602
|
+
logger17.warn("Individual strategies override unified strategy", {
|
|
22603
|
+
unifiedStrategy: options.unifiedStrategy,
|
|
23285
22604
|
individualStrategies,
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
);
|
|
22605
|
+
conflictsCount: debuggerInstance.getConflicts().length
|
|
22606
|
+
});
|
|
23289
22607
|
}
|
|
23290
22608
|
}
|
|
23291
22609
|
resolvedConfig = applyIndividualStrategies(resolvedConfig, options);
|
|
@@ -23316,12 +22634,12 @@ async function finalizeConfig(resolvedConfig, options) {
|
|
|
23316
22634
|
} catch (error) {
|
|
23317
22635
|
new ApiPackageError(
|
|
23318
22636
|
"headers.processing.failed",
|
|
23319
|
-
|
|
23320
|
-
|
|
22637
|
+
INTERNAL_STATUS_CODES.OPERATION_FAILED,
|
|
22638
|
+
API_ERROR_CODES$1.HEADERS_ENRICHMENT_FAILED,
|
|
23321
22639
|
{
|
|
23322
22640
|
cause: error instanceof Error ? error : void 0,
|
|
23323
22641
|
context: {
|
|
23324
|
-
operation:
|
|
22642
|
+
operation: COMMON_OPERATIONS.ENRICHMENT,
|
|
23325
22643
|
originalError: error instanceof Error ? error.message : String(error),
|
|
23326
22644
|
i18n: {
|
|
23327
22645
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -23362,12 +22680,12 @@ __name(applyDefaultOptions, "applyDefaultOptions");
|
|
|
23362
22680
|
function handleClientInitError(error) {
|
|
23363
22681
|
throw new ApiPackageError(
|
|
23364
22682
|
"client.initialization.failed",
|
|
23365
|
-
|
|
23366
|
-
|
|
22683
|
+
INTERNAL_STATUS_CODES.INITIALIZATION_FAILED,
|
|
22684
|
+
API_ERROR_CODES$1.CLIENT_INITIALIZATION_FAILED,
|
|
23367
22685
|
{
|
|
23368
22686
|
cause: error instanceof Error ? error : void 0,
|
|
23369
22687
|
context: {
|
|
23370
|
-
operation:
|
|
22688
|
+
operation: COMMON_OPERATIONS.INITIALIZATION,
|
|
23371
22689
|
originalError: error instanceof Error ? error.message : String(error),
|
|
23372
22690
|
i18n: {
|
|
23373
22691
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -23478,7 +22796,9 @@ function analyzeConfigChanges(previousConfig, newConfig, updates) {
|
|
|
23478
22796
|
}
|
|
23479
22797
|
__name(analyzeConfigChanges, "analyzeConfigChanges");
|
|
23480
22798
|
function handleInvalidConfigUpdate(validation, updates, updateOptions) {
|
|
23481
|
-
|
|
22799
|
+
logger17.warn("Invalid configuration update", {
|
|
22800
|
+
errors: validation.errors
|
|
22801
|
+
});
|
|
23482
22802
|
UnifiedDebugger.getInstance().trackEventOperation(
|
|
23483
22803
|
EVENT_OPERATIONS.CONFIG_UPDATE_FAILED,
|
|
23484
22804
|
"updateConfig",
|
|
@@ -23553,6 +22873,25 @@ function trackSuccessfulConfigUpdate(params) {
|
|
|
23553
22873
|
);
|
|
23554
22874
|
}
|
|
23555
22875
|
__name(trackSuccessfulConfigUpdate, "trackSuccessfulConfigUpdate");
|
|
22876
|
+
function handleClientErrorSystemConfig(errorConfig) {
|
|
22877
|
+
const alreadyInitialized = isErrorSystemInitialized();
|
|
22878
|
+
if (alreadyInitialized) {
|
|
22879
|
+
if (errorConfig.locale) {
|
|
22880
|
+
setErrorLocale(errorConfig.locale);
|
|
22881
|
+
}
|
|
22882
|
+
if (errorConfig.additionalCatalogs) {
|
|
22883
|
+
Object.entries(errorConfig.additionalCatalogs).forEach(([locale, catalog]) => {
|
|
22884
|
+
addMessageCatalog(locale, catalog, true);
|
|
22885
|
+
});
|
|
22886
|
+
}
|
|
22887
|
+
} else {
|
|
22888
|
+
initializeErrorSystem({
|
|
22889
|
+
defaultLocale: errorConfig.locale,
|
|
22890
|
+
additionalCatalogs: errorConfig.additionalCatalogs
|
|
22891
|
+
});
|
|
22892
|
+
}
|
|
22893
|
+
}
|
|
22894
|
+
__name(handleClientErrorSystemConfig, "handleClientErrorSystemConfig");
|
|
23556
22895
|
function createUpdateConfigMethod(initialConfigState, eventManager2, client, setConfigState) {
|
|
23557
22896
|
let configState = initialConfigState;
|
|
23558
22897
|
return (updates, updateOptions) => {
|
|
@@ -23562,6 +22901,9 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
|
|
|
23562
22901
|
if (updates.tracking) {
|
|
23563
22902
|
applyTrackingConfiguration(updates);
|
|
23564
22903
|
}
|
|
22904
|
+
if (updates.errors) {
|
|
22905
|
+
handleClientErrorSystemConfig(updates.errors);
|
|
22906
|
+
}
|
|
23565
22907
|
const validation = validateConfigUpdate(updates, updateOptions);
|
|
23566
22908
|
if (!validation.valid) {
|
|
23567
22909
|
handleInvalidConfigUpdate(validation, updates, updateOptions);
|
|
@@ -23590,9 +22932,62 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
|
|
|
23590
22932
|
};
|
|
23591
22933
|
}
|
|
23592
22934
|
__name(createUpdateConfigMethod, "createUpdateConfigMethod");
|
|
22935
|
+
function createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers) {
|
|
22936
|
+
return createApiFetcher({
|
|
22937
|
+
...fetchffConfig,
|
|
22938
|
+
baseURL: effectiveConfig.baseURL ?? options.apiUrl,
|
|
22939
|
+
endpoints,
|
|
22940
|
+
onRequest: unifiedHandlers.onRequest,
|
|
22941
|
+
onResponse: unifiedHandlers.onResponse,
|
|
22942
|
+
onError: unifiedHandlers.onError,
|
|
22943
|
+
onRetry: unifiedHandlers.onRetry
|
|
22944
|
+
});
|
|
22945
|
+
}
|
|
22946
|
+
__name(createFetchffClient, "createFetchffClient");
|
|
22947
|
+
function enhanceClientWithMethods(params) {
|
|
22948
|
+
const {
|
|
22949
|
+
clientWithEvents,
|
|
22950
|
+
stateContainer,
|
|
22951
|
+
eventManager: eventManager2,
|
|
22952
|
+
client,
|
|
22953
|
+
clientId,
|
|
22954
|
+
globalConfig,
|
|
22955
|
+
options
|
|
22956
|
+
} = params;
|
|
22957
|
+
clientWithEvents.updateConfig = createUpdateConfigMethod(
|
|
22958
|
+
stateContainer.current,
|
|
22959
|
+
eventManager2,
|
|
22960
|
+
client,
|
|
22961
|
+
(newState) => {
|
|
22962
|
+
stateContainer.current = newState;
|
|
22963
|
+
}
|
|
22964
|
+
);
|
|
22965
|
+
clientWithEvents.getConfig = createGetConfigMethod(
|
|
22966
|
+
() => stateContainer.current,
|
|
22967
|
+
globalConfig,
|
|
22968
|
+
clientId,
|
|
22969
|
+
options
|
|
22970
|
+
);
|
|
22971
|
+
clientWithEvents.clearTemporaryOverrides = createClearTemporaryOverridesMethod(
|
|
22972
|
+
() => stateContainer.current,
|
|
22973
|
+
(newState) => {
|
|
22974
|
+
stateContainer.current = newState;
|
|
22975
|
+
},
|
|
22976
|
+
client,
|
|
22977
|
+
eventManager2
|
|
22978
|
+
);
|
|
22979
|
+
}
|
|
22980
|
+
__name(enhanceClientWithMethods, "enhanceClientWithMethods");
|
|
22981
|
+
function initializeClientSystems(options) {
|
|
22982
|
+
applyTrackingConfiguration(options);
|
|
22983
|
+
if (options.errors) {
|
|
22984
|
+
handleClientErrorSystemConfig(options.errors);
|
|
22985
|
+
}
|
|
22986
|
+
}
|
|
22987
|
+
__name(initializeClientSystems, "initializeClientSystems");
|
|
23593
22988
|
async function createApiClient(options = {}) {
|
|
23594
22989
|
try {
|
|
23595
|
-
|
|
22990
|
+
initializeClientSystems(options);
|
|
23596
22991
|
UnifiedDebugger.getInstance().clear();
|
|
23597
22992
|
options = applyDefaultOptions(options);
|
|
23598
22993
|
const userConfig = createPreservedConfig(options);
|
|
@@ -23600,58 +22995,43 @@ async function createApiClient(options = {}) {
|
|
|
23600
22995
|
const mergedConfig = await finalizeConfig(resolvedConfig, options);
|
|
23601
22996
|
void UnifiedDebugger.getInstance().logConflicts();
|
|
23602
22997
|
const globalConfig = getGlobalConfig();
|
|
23603
|
-
|
|
22998
|
+
const stateContainer = {
|
|
22999
|
+
current: createConfigState(mergedConfig)
|
|
23000
|
+
};
|
|
23604
23001
|
if (options.configOverride) {
|
|
23605
|
-
const result = applyConfigOverride(
|
|
23606
|
-
|
|
23002
|
+
const result = applyConfigOverride(stateContainer.current, options.configOverride);
|
|
23003
|
+
stateContainer.current = result.state;
|
|
23607
23004
|
}
|
|
23608
|
-
const effectiveConfig = getEffectiveConfig(
|
|
23005
|
+
const effectiveConfig = getEffectiveConfig(stateContainer.current);
|
|
23609
23006
|
const fetchffConfig = toFetchffConfig(effectiveConfig);
|
|
23610
23007
|
let clearTemporaryOverridesFn;
|
|
23611
23008
|
const unifiedHandlers = setupUnifiedHandlers({
|
|
23612
23009
|
mergedConfig: effectiveConfig,
|
|
23613
|
-
// Use effective config here too
|
|
23614
23010
|
enrichedHeadersConfig: options.enrichedHeaders,
|
|
23615
23011
|
globalConfig,
|
|
23616
23012
|
clientOptions: options,
|
|
23617
23013
|
clearTemporaryOverrides: /* @__PURE__ */ __name(() => clearTemporaryOverridesFn?.(), "clearTemporaryOverrides")
|
|
23618
23014
|
});
|
|
23619
|
-
const client =
|
|
23620
|
-
...fetchffConfig,
|
|
23621
|
-
baseURL: effectiveConfig.baseURL ?? options.url,
|
|
23622
|
-
endpoints,
|
|
23623
|
-
// Use unified handlers that handle both ApiConfig callbacks and event emissions
|
|
23624
|
-
onRequest: unifiedHandlers.onRequest,
|
|
23625
|
-
onResponse: unifiedHandlers.onResponse,
|
|
23626
|
-
onError: unifiedHandlers.onError,
|
|
23627
|
-
onRetry: unifiedHandlers.onRetry
|
|
23628
|
-
});
|
|
23015
|
+
const client = createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers);
|
|
23629
23016
|
const clientWithEvents = setupClientEvents(client, globalConfig, options);
|
|
23630
23017
|
const { eventManager: eventManager2 } = clientWithEvents;
|
|
23018
|
+
Object.defineProperty(clientWithEvents, "then", {
|
|
23019
|
+
value: void 0,
|
|
23020
|
+
writable: false,
|
|
23021
|
+
enumerable: false,
|
|
23022
|
+
configurable: true
|
|
23023
|
+
});
|
|
23631
23024
|
clearTemporaryOverridesFn = /* @__PURE__ */ __name(() => eventManager2.clearTemporaryOverrides(), "clearTemporaryOverridesFn");
|
|
23632
23025
|
const clientId = emitClientCreatedEvent(effectiveConfig, options);
|
|
23633
|
-
|
|
23634
|
-
|
|
23635
|
-
|
|
23026
|
+
enhanceClientWithMethods({
|
|
23027
|
+
clientWithEvents,
|
|
23028
|
+
stateContainer,
|
|
23029
|
+
eventManager: eventManager2,
|
|
23636
23030
|
client,
|
|
23637
|
-
(newState) => {
|
|
23638
|
-
configState = newState;
|
|
23639
|
-
}
|
|
23640
|
-
);
|
|
23641
|
-
clientWithEvents.getConfig = createGetConfigMethod(
|
|
23642
|
-
() => configState,
|
|
23643
|
-
globalConfig,
|
|
23644
23031
|
clientId,
|
|
23032
|
+
globalConfig,
|
|
23645
23033
|
options
|
|
23646
|
-
);
|
|
23647
|
-
clientWithEvents.clearTemporaryOverrides = createClearTemporaryOverridesMethod(
|
|
23648
|
-
() => configState,
|
|
23649
|
-
(newState) => {
|
|
23650
|
-
configState = newState;
|
|
23651
|
-
},
|
|
23652
|
-
client,
|
|
23653
|
-
eventManager2
|
|
23654
|
-
);
|
|
23034
|
+
});
|
|
23655
23035
|
if (options.networkAware?.enabled) {
|
|
23656
23036
|
setupNetworkMonitoring(clientWithEvents, options, userConfig);
|
|
23657
23037
|
}
|
|
@@ -23726,18 +23106,13 @@ function createApiQuery(serviceFn, defaultOptions) {
|
|
|
23726
23106
|
__name(createApiQuery, "createApiQuery");
|
|
23727
23107
|
function createApiMutation(serviceFn, defaultOptions) {
|
|
23728
23108
|
return /* @__PURE__ */ __name(function useApiMutation(serviceOptions, mutationOptions) {
|
|
23729
|
-
const mergedMutationOptions = deepMerge(
|
|
23730
|
-
|
|
23731
|
-
|
|
23732
|
-
|
|
23733
|
-
|
|
23734
|
-
|
|
23735
|
-
|
|
23736
|
-
if (response.error) throw response.error;
|
|
23737
|
-
return response.data;
|
|
23738
|
-
}, "mutationFn")
|
|
23739
|
-
}
|
|
23740
|
-
);
|
|
23109
|
+
const mergedMutationOptions = deepMerge(DEFAULT_MUTATION_OPTIONS, defaultOptions ?? {}, mutationOptions ?? {}, {
|
|
23110
|
+
mutationFn: /* @__PURE__ */ __name(async (variables) => {
|
|
23111
|
+
const response = await serviceFn(variables, serviceOptions);
|
|
23112
|
+
if (response.error) throw response.error;
|
|
23113
|
+
return response.data;
|
|
23114
|
+
}, "mutationFn")
|
|
23115
|
+
});
|
|
23741
23116
|
return useMutation(
|
|
23742
23117
|
mergedMutationOptions
|
|
23743
23118
|
);
|
|
@@ -24183,6 +23558,10 @@ function getEnhancedClientHints(headers2, options) {
|
|
|
24183
23558
|
return response;
|
|
24184
23559
|
}
|
|
24185
23560
|
__name(getEnhancedClientHints, "getEnhancedClientHints");
|
|
23561
|
+
var logger18 = new ApiLogger({
|
|
23562
|
+
service: LOGGER_SERVICES.NETWORK_CONFIGURATION,
|
|
23563
|
+
transport: "console"
|
|
23564
|
+
});
|
|
24186
23565
|
var NetworkConfigurationManager = class {
|
|
24187
23566
|
static {
|
|
24188
23567
|
__name(this, "NetworkConfigurationManager");
|
|
@@ -24248,9 +23627,11 @@ var NetworkConfigurationManager = class {
|
|
|
24248
23627
|
*/
|
|
24249
23628
|
registerPreset(preset) {
|
|
24250
23629
|
this.availablePresets.set(preset.id, preset);
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
|
|
23630
|
+
logger18.info("Network preset registered", {
|
|
23631
|
+
presetName: preset.name,
|
|
23632
|
+
presetId: preset.id,
|
|
23633
|
+
targetQuality: preset.targetQuality
|
|
23634
|
+
});
|
|
24254
23635
|
}
|
|
24255
23636
|
/**
|
|
24256
23637
|
* Get all available presets
|
|
@@ -24426,7 +23807,7 @@ var NetworkConfigurationManager = class {
|
|
|
24426
23807
|
}
|
|
24427
23808
|
});
|
|
24428
23809
|
this.cleanupFunctions.push(unsubscribe);
|
|
24429
|
-
|
|
23810
|
+
logger18.info("Auto preset switching enabled");
|
|
24430
23811
|
}
|
|
24431
23812
|
/**
|
|
24432
23813
|
* Disable automatic preset monitoring
|
|
@@ -24435,7 +23816,7 @@ var NetworkConfigurationManager = class {
|
|
|
24435
23816
|
this.monitoringEnabled = false;
|
|
24436
23817
|
this.cleanupFunctions.forEach((cleanup) => cleanup());
|
|
24437
23818
|
this.cleanupFunctions = [];
|
|
24438
|
-
|
|
23819
|
+
logger18.info("Auto preset switching disabled");
|
|
24439
23820
|
}
|
|
24440
23821
|
/**
|
|
24441
23822
|
* Get current active overrides for debugging
|
|
@@ -24449,7 +23830,7 @@ var NetworkConfigurationManager = class {
|
|
|
24449
23830
|
restoreAllOverrides() {
|
|
24450
23831
|
const overrides = Array.from(this.activeOverrides.values());
|
|
24451
23832
|
overrides.forEach((override) => override.restore());
|
|
24452
|
-
|
|
23833
|
+
logger18.info("Restored temporary overrides", { count: overrides.length });
|
|
24453
23834
|
}
|
|
24454
23835
|
/**
|
|
24455
23836
|
* Get configuration manager stats for debugging
|
|
@@ -24701,7 +24082,7 @@ var NetworkConfigurationManager = class {
|
|
|
24701
24082
|
changes.push("caching");
|
|
24702
24083
|
}
|
|
24703
24084
|
if (changes.length > 0) {
|
|
24704
|
-
|
|
24085
|
+
logger18.info("User preferences updated", { changes });
|
|
24705
24086
|
}
|
|
24706
24087
|
}
|
|
24707
24088
|
/**
|
|
@@ -25208,7 +24589,7 @@ function useOptimisticUpdate(key, initialData) {
|
|
|
25208
24589
|
const nextState = {
|
|
25209
24590
|
data: response.data,
|
|
25210
24591
|
isValidating: response.isFetching ?? false,
|
|
25211
|
-
error: response.error
|
|
24592
|
+
error: response.error
|
|
25212
24593
|
};
|
|
25213
24594
|
setState(nextState);
|
|
25214
24595
|
});
|
|
@@ -25685,6 +25066,355 @@ function useDeleteCampaign(serviceOptions, mutationOptions) {
|
|
|
25685
25066
|
})(serviceOptions, mutationOptions);
|
|
25686
25067
|
}
|
|
25687
25068
|
__name(useDeleteCampaign, "useDeleteCampaign");
|
|
25069
|
+
async function sendInfobipEmail(payload, options) {
|
|
25070
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25071
|
+
if (!payload.from) {
|
|
25072
|
+
throw new ApiPackageError(
|
|
25073
|
+
"Missing required field: from",
|
|
25074
|
+
void 0,
|
|
25075
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25076
|
+
);
|
|
25077
|
+
}
|
|
25078
|
+
if (!payload.to) {
|
|
25079
|
+
throw new ApiPackageError(
|
|
25080
|
+
"Missing required field: to",
|
|
25081
|
+
void 0,
|
|
25082
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25083
|
+
);
|
|
25084
|
+
}
|
|
25085
|
+
if (!payload.subject) {
|
|
25086
|
+
throw new ApiPackageError(
|
|
25087
|
+
"Missing required field: subject",
|
|
25088
|
+
void 0,
|
|
25089
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25090
|
+
);
|
|
25091
|
+
}
|
|
25092
|
+
const serviceDefaults = {
|
|
25093
|
+
retry: { attempts: 0 },
|
|
25094
|
+
timeout: 15e3
|
|
25095
|
+
// 15 second timeout for email sends
|
|
25096
|
+
};
|
|
25097
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25098
|
+
const updateOptions = {
|
|
25099
|
+
strategy: "temporary",
|
|
25100
|
+
...options?.updateConfigOptions
|
|
25101
|
+
};
|
|
25102
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25103
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25104
|
+
}
|
|
25105
|
+
return client.sendEmail({
|
|
25106
|
+
body: payload
|
|
25107
|
+
});
|
|
25108
|
+
}
|
|
25109
|
+
__name(sendInfobipEmail, "sendInfobipEmail");
|
|
25110
|
+
async function sendInfobipAdvancedEmail(payload, options) {
|
|
25111
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25112
|
+
if (!payload.messages || payload.messages.length === 0) {
|
|
25113
|
+
throw new ApiPackageError(
|
|
25114
|
+
"Missing required field: messages (must be a non-empty array)",
|
|
25115
|
+
void 0,
|
|
25116
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25117
|
+
);
|
|
25118
|
+
}
|
|
25119
|
+
for (const [index, message] of payload.messages.entries()) {
|
|
25120
|
+
if (!message.sender) {
|
|
25121
|
+
throw new ApiPackageError(
|
|
25122
|
+
`Missing required field: messages[${index}].sender`,
|
|
25123
|
+
void 0,
|
|
25124
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25125
|
+
);
|
|
25126
|
+
}
|
|
25127
|
+
if (!message.destinations || message.destinations.length === 0) {
|
|
25128
|
+
throw new ApiPackageError(
|
|
25129
|
+
`Missing required field: messages[${index}].destinations (must be a non-empty array)`,
|
|
25130
|
+
void 0,
|
|
25131
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25132
|
+
);
|
|
25133
|
+
}
|
|
25134
|
+
if (!message.content?.subject) {
|
|
25135
|
+
throw new ApiPackageError(
|
|
25136
|
+
`Missing required field: messages[${index}].content.subject`,
|
|
25137
|
+
void 0,
|
|
25138
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25139
|
+
);
|
|
25140
|
+
}
|
|
25141
|
+
}
|
|
25142
|
+
const serviceDefaults = {
|
|
25143
|
+
retry: { attempts: 0 },
|
|
25144
|
+
timeout: 15e3
|
|
25145
|
+
// 15 second timeout for email sends
|
|
25146
|
+
};
|
|
25147
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25148
|
+
const updateOptions = {
|
|
25149
|
+
strategy: "temporary",
|
|
25150
|
+
...options?.updateConfigOptions
|
|
25151
|
+
};
|
|
25152
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25153
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25154
|
+
}
|
|
25155
|
+
return client.sendAdvancedEmail({
|
|
25156
|
+
body: payload
|
|
25157
|
+
});
|
|
25158
|
+
}
|
|
25159
|
+
__name(sendInfobipAdvancedEmail, "sendInfobipAdvancedEmail");
|
|
25160
|
+
async function validateInfobipEmail(email, options) {
|
|
25161
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25162
|
+
const payload = typeof email === "string" ? { to: email } : email;
|
|
25163
|
+
if (!payload?.to) {
|
|
25164
|
+
throw new ApiPackageError(
|
|
25165
|
+
"Missing required field: to (email address)",
|
|
25166
|
+
void 0,
|
|
25167
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25168
|
+
);
|
|
25169
|
+
}
|
|
25170
|
+
if (!payload.to.includes("@")) {
|
|
25171
|
+
throw new ApiPackageError(
|
|
25172
|
+
"Invalid email format: must contain @",
|
|
25173
|
+
void 0,
|
|
25174
|
+
API_ERROR_CODES.INVALID_FORMAT
|
|
25175
|
+
);
|
|
25176
|
+
}
|
|
25177
|
+
const serviceDefaults = {
|
|
25178
|
+
retry: { attempts: 2, delay: 500 },
|
|
25179
|
+
cacheTime: 300,
|
|
25180
|
+
// Cache validation results for 5 minutes
|
|
25181
|
+
staleTime: 600,
|
|
25182
|
+
// Consider stale after 10 minutes
|
|
25183
|
+
timeout: 5e3
|
|
25184
|
+
// 5 second timeout
|
|
25185
|
+
};
|
|
25186
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25187
|
+
const updateOptions = {
|
|
25188
|
+
strategy: "temporary",
|
|
25189
|
+
...options?.updateConfigOptions
|
|
25190
|
+
};
|
|
25191
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25192
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25193
|
+
}
|
|
25194
|
+
return client.validateEmail({
|
|
25195
|
+
body: payload
|
|
25196
|
+
});
|
|
25197
|
+
}
|
|
25198
|
+
__name(validateInfobipEmail, "validateInfobipEmail");
|
|
25199
|
+
async function bulkValidateInfobipEmails(payload, options) {
|
|
25200
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25201
|
+
const MAX_BULK_EMAIL_VALIDATION_SIZE = 1e4;
|
|
25202
|
+
if (!payload.destinations || payload.destinations.length === 0) {
|
|
25203
|
+
throw new ApiPackageError(
|
|
25204
|
+
"Missing required field: destinations (must be a non-empty array)",
|
|
25205
|
+
void 0,
|
|
25206
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25207
|
+
);
|
|
25208
|
+
}
|
|
25209
|
+
if (payload.destinations.length > MAX_BULK_EMAIL_VALIDATION_SIZE) {
|
|
25210
|
+
throw new ApiPackageError(
|
|
25211
|
+
`Too many email addresses: maximum ${MAX_BULK_EMAIL_VALIDATION_SIZE} per request`,
|
|
25212
|
+
void 0,
|
|
25213
|
+
API_ERROR_CODES.INVALID_FORMAT
|
|
25214
|
+
);
|
|
25215
|
+
}
|
|
25216
|
+
const serviceDefaults = {
|
|
25217
|
+
retry: { attempts: 0 },
|
|
25218
|
+
// Don't retry bulk validation requests
|
|
25219
|
+
timeout: 3e4
|
|
25220
|
+
// 30 second timeout for bulk operations
|
|
25221
|
+
};
|
|
25222
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25223
|
+
const updateOptions = {
|
|
25224
|
+
strategy: "temporary",
|
|
25225
|
+
...options?.updateConfigOptions
|
|
25226
|
+
};
|
|
25227
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25228
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25229
|
+
}
|
|
25230
|
+
return client.bulkValidateEmails({
|
|
25231
|
+
body: payload
|
|
25232
|
+
});
|
|
25233
|
+
}
|
|
25234
|
+
__name(bulkValidateInfobipEmails, "bulkValidateInfobipEmails");
|
|
25235
|
+
|
|
25236
|
+
// src/api/services/infobip/email/GET/fetchEmailReports.ts
|
|
25237
|
+
async function fetchInfobipEmailReports(params, options) {
|
|
25238
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25239
|
+
const serviceDefaults = {
|
|
25240
|
+
cacheTime: 30,
|
|
25241
|
+
// Cache for 30 seconds
|
|
25242
|
+
staleTime: 60,
|
|
25243
|
+
// Consider stale after 1 minute
|
|
25244
|
+
timeout: 1e4
|
|
25245
|
+
// 10 second timeout
|
|
25246
|
+
};
|
|
25247
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25248
|
+
const updateOptions = {
|
|
25249
|
+
strategy: "temporary",
|
|
25250
|
+
...options?.updateConfigOptions
|
|
25251
|
+
};
|
|
25252
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25253
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25254
|
+
}
|
|
25255
|
+
return client.getEmailReports({
|
|
25256
|
+
params
|
|
25257
|
+
});
|
|
25258
|
+
}
|
|
25259
|
+
__name(fetchInfobipEmailReports, "fetchInfobipEmailReports");
|
|
25260
|
+
|
|
25261
|
+
// src/api/services/infobip/email/GET/fetchEmailLogs.ts
|
|
25262
|
+
async function fetchInfobipEmailLogs(params, options) {
|
|
25263
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25264
|
+
const serviceDefaults = {
|
|
25265
|
+
cacheTime: 60,
|
|
25266
|
+
// Cache for 1 minute
|
|
25267
|
+
staleTime: 120,
|
|
25268
|
+
// Consider stale after 2 minutes
|
|
25269
|
+
timeout: 1e4
|
|
25270
|
+
// 10 second timeout
|
|
25271
|
+
};
|
|
25272
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25273
|
+
const updateOptions = {
|
|
25274
|
+
strategy: "temporary",
|
|
25275
|
+
...options?.updateConfigOptions
|
|
25276
|
+
};
|
|
25277
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25278
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25279
|
+
}
|
|
25280
|
+
return client.getEmailLogs({
|
|
25281
|
+
params
|
|
25282
|
+
});
|
|
25283
|
+
}
|
|
25284
|
+
__name(fetchInfobipEmailLogs, "fetchInfobipEmailLogs");
|
|
25285
|
+
|
|
25286
|
+
// src/api/services/infobip/email/GET/fetchScheduledEmails.ts
|
|
25287
|
+
async function fetchInfobipScheduledEmails(params, options) {
|
|
25288
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25289
|
+
const serviceDefaults = {
|
|
25290
|
+
retry: { attempts: 2, delay: 500 },
|
|
25291
|
+
cacheTime: 30,
|
|
25292
|
+
staleTime: 60,
|
|
25293
|
+
timeout: 1e4
|
|
25294
|
+
};
|
|
25295
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25296
|
+
const updateOptions = {
|
|
25297
|
+
strategy: "temporary",
|
|
25298
|
+
...options?.updateConfigOptions
|
|
25299
|
+
};
|
|
25300
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25301
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25302
|
+
}
|
|
25303
|
+
return client.getScheduledEmails({
|
|
25304
|
+
params
|
|
25305
|
+
});
|
|
25306
|
+
}
|
|
25307
|
+
__name(fetchInfobipScheduledEmails, "fetchInfobipScheduledEmails");
|
|
25308
|
+
|
|
25309
|
+
// src/api/services/infobip/email/GET/fetchScheduledEmailStatuses.ts
|
|
25310
|
+
async function fetchInfobipScheduledEmailStatuses(params, options) {
|
|
25311
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25312
|
+
const serviceDefaults = {
|
|
25313
|
+
retry: { attempts: 2, delay: 500 },
|
|
25314
|
+
cacheTime: 30,
|
|
25315
|
+
staleTime: 60,
|
|
25316
|
+
timeout: 1e4
|
|
25317
|
+
};
|
|
25318
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25319
|
+
const updateOptions = {
|
|
25320
|
+
strategy: "temporary",
|
|
25321
|
+
...options?.updateConfigOptions
|
|
25322
|
+
};
|
|
25323
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25324
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25325
|
+
}
|
|
25326
|
+
return client.getScheduledEmailStatuses({
|
|
25327
|
+
params
|
|
25328
|
+
});
|
|
25329
|
+
}
|
|
25330
|
+
__name(fetchInfobipScheduledEmailStatuses, "fetchInfobipScheduledEmailStatuses");
|
|
25331
|
+
|
|
25332
|
+
// src/api/services/infobip/email/GET/fetchValidations.ts
|
|
25333
|
+
async function fetchInfobipValidations(params, options) {
|
|
25334
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25335
|
+
const serviceDefaults = {
|
|
25336
|
+
retry: { attempts: 2, delay: 500 },
|
|
25337
|
+
cacheTime: 60,
|
|
25338
|
+
// Cache results for 1 minute
|
|
25339
|
+
staleTime: 120,
|
|
25340
|
+
// Consider stale after 2 minutes
|
|
25341
|
+
timeout: 1e4
|
|
25342
|
+
// 10 second timeout
|
|
25343
|
+
};
|
|
25344
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25345
|
+
const updateOptions = {
|
|
25346
|
+
strategy: "temporary",
|
|
25347
|
+
...options?.updateConfigOptions
|
|
25348
|
+
};
|
|
25349
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25350
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25351
|
+
}
|
|
25352
|
+
return client.getValidations({
|
|
25353
|
+
params
|
|
25354
|
+
});
|
|
25355
|
+
}
|
|
25356
|
+
__name(fetchInfobipValidations, "fetchInfobipValidations");
|
|
25357
|
+
async function rescheduleInfobipEmails(params, payload, options) {
|
|
25358
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25359
|
+
if (!payload.sendAt) {
|
|
25360
|
+
throw new ApiPackageError(
|
|
25361
|
+
"Missing required field: sendAt",
|
|
25362
|
+
void 0,
|
|
25363
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25364
|
+
);
|
|
25365
|
+
}
|
|
25366
|
+
const serviceDefaults = {
|
|
25367
|
+
retry: { attempts: 1 },
|
|
25368
|
+
timeout: 1e4
|
|
25369
|
+
};
|
|
25370
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25371
|
+
const updateOptions = {
|
|
25372
|
+
strategy: "temporary",
|
|
25373
|
+
...options?.updateConfigOptions
|
|
25374
|
+
};
|
|
25375
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25376
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25377
|
+
}
|
|
25378
|
+
return client.rescheduleEmails({
|
|
25379
|
+
params,
|
|
25380
|
+
body: payload
|
|
25381
|
+
});
|
|
25382
|
+
}
|
|
25383
|
+
__name(rescheduleInfobipEmails, "rescheduleInfobipEmails");
|
|
25384
|
+
async function updateInfobipScheduledEmailStatuses(params, payload, options) {
|
|
25385
|
+
const client = options?.apiClient ?? getDefaultApiClient();
|
|
25386
|
+
if (!payload.status) {
|
|
25387
|
+
throw new ApiPackageError(
|
|
25388
|
+
"Missing required field: status",
|
|
25389
|
+
void 0,
|
|
25390
|
+
API_ERROR_CODES.REQUIRED_FIELD_MISSING
|
|
25391
|
+
);
|
|
25392
|
+
}
|
|
25393
|
+
if (payload.status !== "PAUSED" && payload.status !== "PROCESSING") {
|
|
25394
|
+
throw new ApiPackageError(
|
|
25395
|
+
"Invalid status: must be PAUSED or PROCESSING",
|
|
25396
|
+
void 0,
|
|
25397
|
+
API_ERROR_CODES.INVALID_FORMAT
|
|
25398
|
+
);
|
|
25399
|
+
}
|
|
25400
|
+
const serviceDefaults = {
|
|
25401
|
+
retry: { attempts: 1 },
|
|
25402
|
+
timeout: 1e4
|
|
25403
|
+
};
|
|
25404
|
+
const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
|
|
25405
|
+
const updateOptions = {
|
|
25406
|
+
strategy: "temporary",
|
|
25407
|
+
...options?.updateConfigOptions
|
|
25408
|
+
};
|
|
25409
|
+
if (shouldApplyConfig(mergedConfig, updateOptions)) {
|
|
25410
|
+
client.updateConfig(mergedConfig, updateOptions);
|
|
25411
|
+
}
|
|
25412
|
+
return client.updateScheduledEmailStatuses({
|
|
25413
|
+
params,
|
|
25414
|
+
body: payload
|
|
25415
|
+
});
|
|
25416
|
+
}
|
|
25417
|
+
__name(updateInfobipScheduledEmailStatuses, "updateInfobipScheduledEmailStatuses");
|
|
25688
25418
|
function getSSRSafeConfig(config) {
|
|
25689
25419
|
if (!isBrowser()) {
|
|
25690
25420
|
return {
|
|
@@ -25902,6 +25632,6 @@ __name(toFetchffRevalidationConfig, "toFetchffRevalidationConfig");
|
|
|
25902
25632
|
resources: revalidationStrategies.static
|
|
25903
25633
|
});
|
|
25904
25634
|
|
|
25905
|
-
export { ALL_EVENTS, ApiPackageError, CACHE_EVENTS2 as CACHE_EVENTS, CLIENT_EVENTS2 as CLIENT_EVENTS, CONFIG_EVENTS2 as CONFIG_EVENTS, ClientEventManager, ClientHintsInterceptor, ConfigBuilder, DEBUG_EVENTS2 as DEBUG_EVENTS, ERROR_EVENTS2 as ERROR_EVENTS, EVENT_NAMESPACES2 as EVENT_NAMESPACES, EVENT_SCOPES2 as EVENT_SCOPES, EVENT_SCOPES_WITH_TEMPORARY, Environment, EventHelpers, EventManager, HANDLER_SCOPES, HEADER_EVENTS2 as HEADER_EVENTS, HeaderBuilder, IntervalManager, MEDIA_EXTENSIONS, MEDIA_MIME_PREFIXES, MinimumConnectionGuard, NETWORK_EVENTS2 as NETWORK_EVENTS, NetworkConfigurationManager, NetworkDetectionMiddleware, NetworkGuard, NetworkInfoParam, NetworkPresetNames, NetworkProperty, NoDataSaverGuard, PERFORMANCE_EVENTS2 as PERFORMANCE_EVENTS, RequestTracker, UnifiedDebugger, abortAllRequests, abortByPattern, abortRequest, abortSearchRequests, abortUploadRequests, addClientHintsToResponse, addInterval, addTime, analyzeComplianceIssues, analyzeConfigImpact, analyzeConflictPatterns, analyzeEventSystemIssues, analyzeHistoryPatterns, analyzePerformanceIssues, applyCacheStrategyConfig, applyConfigOverride, applyConfigPreset, applyConfigUpdate, applyCustomQualityPresetStrategies, applyHeaderPresets, applyIndividualStrategies, applyPerformancePresetConfig, applyPollingStrategy, applyPollingStrategyConfig, applyRetryStrategy, applyRetryStrategyConfig, applyRevalidationStrategy, applyTemporaryNetworkOverride, applyUnifiedStrategy, applyUnifiedStrategyToConfig, arrayOf, average, base64ToBytes, buildCacheKey, buildEndpointUrl, buildFullUrl, buildUrl, bytesToBase64, cacheKeyPatterns, cacheStrategies, calculateCacheDuration, calculatePerformanceImpact, calculatePollingDuration, calculateRequestMetrics, campaignEndpoints, canPerformHeavyOperation, checkOverrideTriggers, clamp, clampedPercentage, clearErrorHandlers, clearNetworkDebugData, clearTemporaryOverrides, cloneConfig, compactHistory, configConflictDetector, configureForEnvironment, containsAny, convertEndpointsToFetchff, createAbortError, createAdaptiveResponse, createApiClient, createCachePattern, createCacheStrategy, createCampaign, createComplianceReport, createConditionalInterval, createConditionalPolling, createConfigBuilder, createConfigHistoryEntry, createConfigState, createConflict, createCorrelationIdGenerator, createCustomPreset, createCustomUnifiedStrategy, createDate, createDebouncedAbort, createDebugReport, createDecryptionInterceptor, createDelay, createEncryptionInterceptor, createEncryptionInterceptors, createEventEmitter, createHistoryEntry, createHistorySummary, createIdGenerator, createLimitedInterval, createManagedInterval, createNetworkDetectionMiddleware, createPerformanceAnalysis, createPerformanceBenchmark, createPollingStrategy, createPreservedConfig, createProgressivePolling, createRequestIdGenerator, createRetryConfig, createRetryStrategy, createRevalidationKey, createRevalidationStrategy, createRouteGuard, createRouteScope, createScopedAbort, createStatusCodeLimits, createThrottledAbort, createTypedSubscription, createVisibilityAwarePolling, dateDiff, debounce, decrypt, deepMerge, deleteCache, deleteCampaign, detectConfigConflicts, detectConflicts, detectPlatform, determinePrecedenceReason, disableNetworkConfigDebug, enableNetworkConfigDebug, encrypt, endOfDay, endpointCacheKey, endpointCachePattern, endpointCachePatterns, endpoints, eventManager, exportKeyToBase64, extendPresets as extendRevalidationPresets, extractBaseCorrelationId, extractBaseId, extractBaseRequestId, extractCorrelationType, extractFields, extractLinkedCorrelationIds, extractUrlParams, fetchCampaign, fetchCampaignParticipants, fetchCampaignStats, fetchCampaigns, filterHistory, filterObject, findEndpointsByPattern, findMatchingPaths, flattenObject, formatDuration, formatReportForConsole, formatTimeForInterval, fromFetchffConfig, fromISOString, fromUnixTimestamp, generateApiCorrelationId, generateBaseId, generateComprehensiveReport, generateContextualCorrelationId, generateContextualId, generateContextualRequestId, generateCorrelationId, generateIV, generateIssueBreakdown, generateNetworkCorrelationId, generateRandomKey, generateRecommendations, generateRequestId, generateSessionCorrelationId, generateShortRequestId, generateTraceCorrelationId, generateUUID, getActiveOverrideKeys, getAdaptiveApiConfig, getAdaptiveBatchSize, getAdaptiveCacheDuration, getAdaptiveConfig, getAdaptivePageSize, getAdaptiveTimeout, getAllEndpointUrls, getAllFieldPaths, getAllMediaExtensions, getAppVersion, getAuthenticationType, getCache, getCacheAffectingHeaders, getCacheStrategy, getClientHintHeaders, getConfigHierarchy, getConnection, getConnectionType, getConsole, getContextHeaders, getCrypto, getDefaultApiClient, getDeviceId, getDeviceInfo, getDocument, getEffectiveConfig, getEffectiveConnectionType, getEndpointConfig, getEndpointMetadata, getEndpointParams, getEndpointUrl, getEndpointsByMethod, getEnhancedClientHints, getEntries, getEnv, getEnvironmentInfo, getEnvironmentName, getErrorCategory, getErrorCodeByStatus, getErrorDefinition, getErrorHandlers, getEventManager, getExtendedEnvironmentInfo, getFieldValue, getFileExtension, getFrameworkAdaptiveBatchSize, getFrameworkAdaptiveTimeout, getGlobal, getGlobalConfig, getHeaderFingerprint, getHeaderSummary, getISOWeek, getIntervalBoundaries, getIntervalDifference, getIntervalEnd, getIntervalStart, getJSONSize, getKeys, getLocalStorage, getLocation, getMatchingPresets, getNavigator, getNetworkConfigFromHeaders, getNetworkDebugStats, getNetworkEventStats, getNetworkInfo, getNetworkInfoFromHeaders, getNetworkInfoFromRequest, getNetworkOptimizedConfig, getNetworkPreset, getNetworkQuality, getNetworkQualityFromHeaders, getNetworkQualityScore, getNetworkQualityWithThresholds, getNetworkRTT, getNetworkSpeed, getNonCacheAffectingHeaders, getOptimizedNetworkConfig, getPresetForNetworkInfo, getPresetForQuality, getPresetNames, getProcess, getQuarter, getRelativeTime, getRetryStrategy, getPreset as getRevalidationPreset, getPresets as getRevalidationPresets, getRevalidationStrategy, getRuntimeEnvironment, getSSRSafeConfig, getSSRSafePollingConfig, getSessionStorage, getTimeComponents, getUnifiedDebugger, getUnifiedStrategy, getUnifiedStrategyNames, getUnixTimestamp, getUserAgent, getValues, getWindow, groupBy, handleArrayMerge, handleObjectMerge, hasAnyExtension, hasAuthentication, hasEncryptableFields, hasEndpoint, hasGlobal, hasIndexedDB, hasLocalStorage, hasMatchingFields, hasNavigator, hasNetworkInfo2 as hasNetworkInfoExpress, hasNetworkInfo as hasNetworkInfoNextjs, hasPathParams, hasPreset, hasProperty, hasSessionStorage, hasWebGL, hasWebPSupport, headerPresets, headers, headersContext, importKey, inBrowser, inRange, inServer, invalidationScenarios, inverseLerp, isAbortError, isArray, isBoolean, isBrowser, isBun, isCI, isCacheValid, isCellularConnection, isCryptoAvailable, isDataFresh, isDataSaverEnabled, isDataSaverEnabledFromHeaders, isDebug, isDeno, isDevelopment, isDocumentVisible, isElectron, isEmpty, isEmptyObject, isEncryptedMetadata, isError, isFunction, isFuture, isInIframe, isInRange, isInteger, isMergeableObject, isMobile, isNetworkAPISupported, isNode, isNonEmptyArray, isNonEmptyObject, isNonEmptyString2 as isNonEmptyString, isNonNegativeNumber, isNotNullish, isNullish, isNumber, isObject, isOffline, isOneOfIgnoreCase, isOnline, isPageFocused, isPast, isPlainObject, isPollingActive, isPositiveNumber, isProduction, isPromise, isReactNative, isRevalidationSupported, isSSR, isSameDay, isSameInterval, isServer, isSlowConnection, isStaging, isString, isTest, isToday, isTouchDevice, isUnifiedStrategyName, isValidCorrelationId, isValidDate, isValidEnumValue, isValidFieldPath, isValidId, isValidJSON, isValidNumber2 as isValidNumber, isValidPollingConfig, isValidRequestId, isValidStrategyName as isValidRevalidationStrategyName, isWebWorker, isWifiConnection, isWildcard, isWithinDedupeWindow, joinCampaign, jsonClone, jsonEquals, keyBy, leaveCampaign, lerp, linkCorrelationIds, logNetworkConfigReport, mapKeys, mapObject, mapRange, matchFieldPath, matchesAny, max, median, mergeCacheStrategies, mergeConfigs, mergeConflicts, mergeHeaders, mergePollingConfigs, mergePresets, mergeRetryStrategies, mergeRevalidationStrategies, mergeUnifiedStrategy, min, msToSeconds, mutate2 as mutate, networkConfigDebugger, networkConfigManager, networkDetectionMiddleware, networkPresets, networkStatus, normalizeHeaders3 as normalizeHeaders, now, nowInSeconds, omit, onOffline, onOnline, onceErrorHandler, oneOf, parseAndValidateNumber, parseFieldPath, parseId, percentage, pick, pollingEndpoints, pollingStrategies, prepareRequestConfig, prepareRequestConfigWithEnrichedHeaders, prettyStringify, processHeaders2 as processHeaders, raceRequests, randomBetween, randomInt, registerErrorHandler, registerErrorHandlers, removeCircularReferences, removeEmpty, removeNullish, removeSensitiveHeaders, removeUndefined, requestTracker, requestWithTimeout, resetGlobalConfig, resetPresets as resetRevalidationPresets, resolveConflict, retryConditions, retryStrategies, genericPresets as revalidationPresets, revalidationStrategies, round, runWithHeaders, runWithHeadersAsync, safeParseJSON, safeStringify, sanitizeHeaders2 as sanitizeHeaders, secondsToMs, sequentialRequests, setCache, setConfigWarnings, setDefaultApiClient, setErrorHandlers, setFieldValue, setGlobalConfig, setupClientEvents, setupNetworkMonitoring, setupRouteChangeCleanup, setupTemporaryOverride, shouldApplyConfig, shouldAutoRefresh, shouldPrefetch, shouldServeHighQuality, shouldUseAggressiveCaching, sleep, sortIssuesByPriority, startNetworkEventMonitoring, startOfDay, startRequestTracking, subscribe, subscribeMultiple, subscribeOnce, subscribeWithTimeout, sum, supportsBroadcastChannel, supportsFetch, supportsGeolocation, supportsIntersectionObserver, supportsLocalStorage, supportsNotifications, supportsPushNotifications, supportsRequestIdleCallback, supportsServiceWorker, supportsSessionStorage, supportsWebSocket, throttle, timeAgo, toFetchffConfig, toFetchffRevalidationConfig, toISOString, trackConfig, trackDirectCacheConfig, trackNetworkOverride, trackSpreadProperties, trackableSpread, transformFields, truncateJSON, unifiedStrategies, unregisterErrorHandlers, updateCampaign, updateGlobalConfig, useAbortableRequest, useApiConfigConflicts, useApiDebugInfo, useApiMonitor, useApiNetworkQuality, useCampaign, useCampaignParticipants, useCampaignStats, useCampaigns, useConditionalSubscription, useCreateCampaign, useDebouncedSubscription, useDeleteCampaign, useJoinCampaign, useLeaveCampaign, useMultipleSubscriptions, useOptimisticUpdate, useRealTimeData, useRequestCleanup, useRequestGroup, useRouteAwareRequest, useSubscription, useSubscriptionState, useUpdateCampaign, validateConfigUpdate, validateEncryptionConfig, validateHeaders2 as validateHeaders, validatePathParams, validatePreset, waitForOnline, withNetworkDetection, withNetworkInfo, withTimeout };
|
|
25635
|
+
export { ALL_EVENTS, ApiPackageError, CACHE_EVENTS2 as CACHE_EVENTS, CLIENT_EVENTS2 as CLIENT_EVENTS, CONFIG_EVENTS2 as CONFIG_EVENTS, ClientEventManager, ClientHintsInterceptor, ConfigBuilder, DEBUG_EVENTS2 as DEBUG_EVENTS, ERROR_EVENTS2 as ERROR_EVENTS, EVENT_NAMESPACES2 as EVENT_NAMESPACES, EVENT_SCOPES, EVENT_SCOPES_WITH_TEMPORARY2 as EVENT_SCOPES_WITH_TEMPORARY, Environment, EventHelpers, EventManager, HANDLER_SCOPES, HEADER_EVENTS2 as HEADER_EVENTS, HeaderBuilder, IntervalManager, MEDIA_EXTENSIONS, MEDIA_MIME_PREFIXES, MinimumConnectionGuard, NETWORK_EVENTS2 as NETWORK_EVENTS, NetworkConfigurationManager, NetworkDetectionMiddleware, NetworkGuard, NetworkInfoParam, NetworkPresetNames, NetworkProperty, NoDataSaverGuard, PERFORMANCE_EVENTS2 as PERFORMANCE_EVENTS, RequestTracker, UnifiedDebugger, abortAllRequests, abortByPattern, abortRequest, abortSearchRequests, abortUploadRequests, addClientHintsToResponse, addInterval, addTime, analyzeComplianceIssues, analyzeConfigImpact, analyzeConflictPatterns, analyzeEventSystemIssues, analyzeHistoryPatterns, analyzePerformanceIssues, applyCacheStrategyConfig, applyConfigOverride, applyConfigPreset, applyConfigUpdate, applyCustomQualityPresetStrategies, applyHeaderPresets, applyIndividualStrategies, applyPerformancePresetConfig, applyPollingStrategy, applyPollingStrategyConfig, applyRetryStrategy, applyRetryStrategyConfig, applyRevalidationStrategy, applyTemporaryNetworkOverride, applyUnifiedStrategy, applyUnifiedStrategyToConfig, arrayOf, average, base64ToBytes, buildCacheKey, buildEndpointUrl, buildFullUrl, buildUrl, bulkValidateInfobipEmails, bytesToBase64, cacheKeyPatterns, cacheStrategies, calculateCacheDuration, calculatePerformanceImpact, calculatePollingDuration, calculateRequestMetrics, campaignEndpoints, canPerformHeavyOperation, checkOverrideTriggers, clamp, clampedPercentage, clearErrorHandlers, clearNetworkDebugData, clearTemporaryOverrides, cloneConfig, compactHistory, configConflictDetector, configureForEnvironment, containsAny, convertEndpointsToFetchff, createAbortError, createAdaptiveResponse, createApiClient, createCachePattern, createCacheStrategy, createCampaign, createComplianceReport, createConditionalInterval, createConditionalPolling, createConfigBuilder, createConfigHistoryEntry, createConfigState, createConflict, createCustomPreset, createCustomUnifiedStrategy, createDate, createDebouncedAbort, createDebugReport, createDecryptionInterceptor, createDelay, createEncryptionInterceptor, createEncryptionInterceptors, createEventEmitter, createHistoryEntry, createHistorySummary, createLimitedInterval, createManagedInterval, createNetworkDetectionMiddleware, createPerformanceAnalysis, createPerformanceBenchmark, createPollingStrategy, createPreservedConfig, createProgressivePolling, createRetryConfig, createRetryStrategy, createRevalidationKey, createRevalidationStrategy, createRouteGuard, createRouteScope, createScopedAbort, createStatusCodeLimits, createThrottledAbort, createTypedSubscription, createVisibilityAwarePolling, dateDiff, debounce, decrypt, deepMerge, deleteCache, deleteCampaign, detectConfigConflicts, detectConflicts, detectPlatform, determinePrecedenceReason, disableNetworkConfigDebug, enableNetworkConfigDebug, encrypt, endOfDay, endpointCacheKey, endpointCachePattern, endpointCachePatterns, endpoints, eventManager, exportKeyToBase64, extendPresets as extendRevalidationPresets, extractFields, extractUrlParams, fetchCampaign, fetchCampaignParticipants, fetchCampaignStats, fetchCampaigns, fetchInfobipEmailLogs, fetchInfobipEmailReports, fetchInfobipScheduledEmailStatuses, fetchInfobipScheduledEmails, fetchInfobipValidations, filterHistory, filterObject, findEndpointsByPattern, findMatchingPaths, flattenObject, formatDuration, formatReportForConsole, formatTimeForInterval, fromFetchffConfig, fromISOString, fromUnixTimestamp, generateComprehensiveReport, generateIV, generateIssueBreakdown, generateRandomKey, generateRecommendations, generateUUID, getActiveOverrideKeys, getAdaptiveApiConfig, getAdaptiveBatchSize, getAdaptiveCacheDuration, getAdaptiveConfig, getAdaptivePageSize, getAdaptiveTimeout, getAllEndpointUrls, getAllFieldPaths, getAllMediaExtensions, getAppVersion, getAuthenticationType, getCache, getCacheAffectingHeaders, getCacheStrategy, getClientHintHeaders, getConfigHierarchy, getConnection, getConnectionType, getConsole, getContextHeaders, getCrypto, getDefaultApiClient, getDeviceId, getDeviceInfo, getDocument, getEffectiveConfig, getEffectiveConnectionType, getEndpointConfig, getEndpointMetadata, getEndpointParams, getEndpointUrl, getEndpointsByMethod, getEnhancedClientHints, getEntries, getEnv, getEnvironmentInfo, getEnvironmentName, getErrorHandlers, getEventManager, getExtendedEnvironmentInfo, getFieldValue, getFileExtension, getFrameworkAdaptiveBatchSize, getFrameworkAdaptiveTimeout, getGlobal, getGlobalConfig, getHeaderFingerprint, getHeaderSummary, getISOWeek, getIntervalBoundaries, getIntervalDifference, getIntervalEnd, getIntervalStart, getJSONSize, getKeys, getLocalStorage, getLocation, getMatchingPresets, getNavigator, getNetworkConfigFromHeaders, getNetworkDebugStats, getNetworkEventStats, getNetworkInfo, getNetworkInfoFromHeaders, getNetworkInfoFromRequest, getNetworkOptimizedConfig, getNetworkPreset, getNetworkQuality, getNetworkQualityFromHeaders, getNetworkQualityScore, getNetworkQualityWithThresholds, getNetworkRTT, getNetworkSpeed, getNonCacheAffectingHeaders, getOptimizedNetworkConfig, getPresetForNetworkInfo, getPresetForQuality, getPresetNames, getProcess, getQuarter, getRelativeTime, getRetryStrategy, getPreset as getRevalidationPreset, getPresets as getRevalidationPresets, getRevalidationStrategy, getRuntimeEnvironment, getSSRSafeConfig, getSSRSafePollingConfig, getSessionStorage, getTimeComponents, getUnifiedDebugger, getUnifiedStrategy, getUnifiedStrategyNames, getUnixTimestamp, getUserAgent, getValues, getWindow, groupBy, handleArrayMerge, handleObjectMerge, hasAnyExtension, hasAuthentication, hasEncryptableFields, hasEndpoint, hasGlobal, hasIndexedDB, hasLocalStorage, hasMatchingFields, hasNavigator, hasNetworkInfo2 as hasNetworkInfoExpress, hasNetworkInfo as hasNetworkInfoNextjs, hasPathParams, hasPreset, hasProperty, hasSessionStorage, hasWebGL, hasWebPSupport, headerPresets, headers, headersContext, importKey, inBrowser, inRange, inServer, infobipEmailEndpoints, infobipEndpoints, invalidationScenarios, inverseLerp, isAbortError, isArray, isBoolean, isBrowser, isBun, isCI, isCacheValid, isCellularConnection, isCryptoAvailable, isDataFresh, isDataSaverEnabled, isDataSaverEnabledFromHeaders, isDebug, isDeno, isDevelopment, isDocumentVisible, isElectron, isEmpty, isEmptyObject, isEncryptedMetadata, isError, isFunction, isFuture, isInIframe, isInRange, isInteger, isMergeableObject, isMobile, isNetworkAPISupported, isNode, isNonEmptyArray, isNonEmptyObject, isNonEmptyString2 as isNonEmptyString, isNonNegativeNumber, isNotNullish, isNullish, isNumber, isObject, isOffline, isOneOfIgnoreCase, isOnline, isPageFocused, isPast, isPlainObject, isPollingActive, isPositiveNumber, isProduction, isPromise, isReactNative, isRevalidationSupported, isSSR, isSameDay, isSameInterval, isServer, isSlowConnection, isStaging, isString, isTest, isToday, isTouchDevice, isUnifiedStrategyName, isValidDate, isValidEnumValue, isValidFieldPath, isValidJSON, isValidNumber2 as isValidNumber, isValidPollingConfig, isValidStrategyName as isValidRevalidationStrategyName, isWebWorker, isWifiConnection, isWildcard, isWithinDedupeWindow, joinCampaign, jsonClone, jsonEquals, keyBy, leaveCampaign, lerp, logNetworkConfigReport, mapKeys, mapObject, mapRange, matchFieldPath, matchesAny, max, median, mergeCacheStrategies, mergeConfigs, mergeConflicts, mergeHeaders, mergePollingConfigs, mergePresets, mergeRetryStrategies, mergeRevalidationStrategies, mergeUnifiedStrategy, min, msToSeconds, mutate2 as mutate, networkConfigDebugger, networkConfigManager, networkDetectionMiddleware, networkPresets, networkStatus, normalizeHeaders3 as normalizeHeaders, now, nowInSeconds, omit, onOffline, onOnline, onceErrorHandler, oneOf, parseAndValidateNumber, parseFieldPath, percentage, pick, pollingEndpoints, pollingStrategies, prepareRequestConfig, prepareRequestConfigWithEnrichedHeaders, prettyStringify, processHeaders2 as processHeaders, raceRequests, randomBetween, randomInt, registerErrorHandler, registerErrorHandlers, removeCircularReferences, removeEmpty, removeNullish, removeSensitiveHeaders, removeUndefined, requestTracker, requestWithTimeout, rescheduleInfobipEmails, resetGlobalConfig, resetPresets as resetRevalidationPresets, resolveConflict, retryConditions, retryStrategies, genericPresets as revalidationPresets, revalidationStrategies, round, runWithHeaders, runWithHeadersAsync, safeParseJSON, safeStringify, sanitizeHeaders2 as sanitizeHeaders, secondsToMs, sendInfobipAdvancedEmail, sendInfobipEmail, sequentialRequests, setCache, setConfigWarnings, setDefaultApiClient, setErrorHandlers, setFieldValue, setGlobalConfig, setupClientEvents, setupNetworkMonitoring, setupRouteChangeCleanup, setupTemporaryOverride, shouldApplyConfig, shouldAutoRefresh, shouldPrefetch, shouldServeHighQuality, shouldUseAggressiveCaching, sleep, sortIssuesByPriority, startNetworkEventMonitoring, startOfDay, startRequestTracking, subscribe, subscribeMultiple, subscribeOnce, subscribeWithTimeout, sum, supportsBroadcastChannel, supportsFetch, supportsGeolocation, supportsIntersectionObserver, supportsLocalStorage, supportsNotifications, supportsPushNotifications, supportsRequestIdleCallback, supportsServiceWorker, supportsSessionStorage, supportsWebSocket, throttle, timeAgo, toFetchffConfig, toFetchffRevalidationConfig, toISOString, trackConfig, trackDirectCacheConfig, trackNetworkOverride, trackSpreadProperties, trackableSpread, transformFields, truncateJSON, unifiedStrategies, unregisterErrorHandlers, updateCampaign, updateGlobalConfig, updateInfobipScheduledEmailStatuses, useAbortableRequest, useApiConfigConflicts, useApiDebugInfo, useApiMonitor, useApiNetworkQuality, useCampaign, useCampaignParticipants, useCampaignStats, useCampaigns, useConditionalSubscription, useCreateCampaign, useDebouncedSubscription, useDeleteCampaign, useJoinCampaign, useLeaveCampaign, useMultipleSubscriptions, useOptimisticUpdate, useRealTimeData, useRequestCleanup, useRequestGroup, useRouteAwareRequest, useSubscription, useSubscriptionState, useUpdateCampaign, validateConfigUpdate, validateEncryptionConfig, validateHeaders2 as validateHeaders, validateInfobipEmail, validatePathParams, validatePreset, waitForOnline, withNetworkDetection, withNetworkInfo, withTimeout };
|
|
25906
25636
|
//# sourceMappingURL=index.mjs.map
|
|
25907
25637
|
//# sourceMappingURL=index.mjs.map
|