@plyaz/api 1.2.2 → 1.4.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.
Files changed (170) hide show
  1. package/dist/api/client/clientEventManager.d.ts +8 -2
  2. package/dist/api/client/clientEventManager.d.ts.map +1 -1
  3. package/dist/api/client/createApiClient.d.ts.map +1 -1
  4. package/dist/api/client/helpers/interceptors.d.ts +2 -2
  5. package/dist/api/client/helpers/interceptors.d.ts.map +1 -1
  6. package/dist/api/config/global.d.ts.map +1 -1
  7. package/dist/api/debugger/DebugReport.d.ts.map +1 -1
  8. package/dist/api/debugger/UnifiedDebugger.d.ts.map +1 -1
  9. package/dist/api/debugger/queue/DebuggerQueueManager.d.ts.map +1 -1
  10. package/dist/api/debugger/queue/OperationTracker.d.ts.map +1 -1
  11. package/dist/api/endpoints/campaigns.d.ts.map +1 -1
  12. package/dist/api/endpoints/cdn.d.ts +122 -0
  13. package/dist/api/endpoints/cdn.d.ts.map +1 -0
  14. package/dist/api/endpoints/index.d.ts +89 -4
  15. package/dist/api/endpoints/index.d.ts.map +1 -1
  16. package/dist/api/endpoints/infobip.d.ts +209 -0
  17. package/dist/api/endpoints/infobip.d.ts.map +1 -0
  18. package/dist/api/endpoints/virustotal.d.ts +91 -0
  19. package/dist/api/endpoints/virustotal.d.ts.map +1 -0
  20. package/dist/api/errors/adapter.d.ts +71 -0
  21. package/dist/api/errors/adapter.d.ts.map +1 -0
  22. package/dist/api/errors/index.d.ts +3 -15
  23. package/dist/api/errors/index.d.ts.map +1 -1
  24. package/dist/api/events/EventManager.d.ts.map +1 -1
  25. package/dist/api/events/factories/base.d.ts +11 -3
  26. package/dist/api/events/factories/base.d.ts.map +1 -1
  27. package/dist/api/events/factories/errors.d.ts +10 -10
  28. package/dist/api/events/factories/errors.d.ts.map +1 -1
  29. package/dist/api/events/queue/ConfigUpdateQueueManager.d.ts.map +1 -1
  30. package/dist/api/events/queue/EventQueueManager.d.ts.map +1 -1
  31. package/dist/api/headers/headerBuilder.d.ts.map +1 -1
  32. package/dist/api/hooks/factories/createApiMutation.d.ts +3 -3
  33. package/dist/api/hooks/factories/createApiMutation.d.ts.map +1 -1
  34. package/dist/api/hooks/factories/createApiQuery.d.ts +3 -3
  35. package/dist/api/hooks/factories/createApiQuery.d.ts.map +1 -1
  36. package/dist/api/hooks/index.d.ts +0 -1
  37. package/dist/api/hooks/index.d.ts.map +1 -1
  38. package/dist/api/index.d.ts +1 -1
  39. package/dist/api/index.d.ts.map +1 -1
  40. package/dist/api/network/frameworks/express.d.ts.map +1 -1
  41. package/dist/api/network/frameworks/nestjs/decorators.d.ts +9 -1
  42. package/dist/api/network/frameworks/nestjs/decorators.d.ts.map +1 -1
  43. package/dist/api/network/frameworks/nestjs/enrichedHeadersGuard.d.ts.map +1 -1
  44. package/dist/api/network/frameworks/nestjs/enrichedHeadersInterceptor.d.ts.map +1 -1
  45. package/dist/api/network/networkConfigurationManager.d.ts.map +1 -1
  46. package/dist/api/network/status.d.ts +1 -4
  47. package/dist/api/network/status.d.ts.map +1 -1
  48. package/dist/api/performance/performanceMonitor.d.ts.map +1 -1
  49. package/dist/api/polling/index.d.ts +1 -1
  50. package/dist/api/polling/index.d.ts.map +1 -1
  51. package/dist/api/polling/strategies.d.ts +1 -5
  52. package/dist/api/polling/strategies.d.ts.map +1 -1
  53. package/dist/api/polling/utils.d.ts.map +1 -1
  54. package/dist/api/pubsub/index.d.ts.map +1 -1
  55. package/dist/api/pubsub/react.d.ts +6 -10
  56. package/dist/api/pubsub/react.d.ts.map +1 -1
  57. package/dist/api/queue/BaseOperationTracker.d.ts.map +1 -1
  58. package/dist/api/queue/EventQueueManager.d.ts.map +1 -1
  59. package/dist/api/queue/QueueOrchestrator.d.ts.map +1 -1
  60. package/dist/api/services/campaigns/GET/useCampaign.d.ts +1 -1
  61. package/dist/api/services/campaigns/GET/useCampaign.d.ts.map +1 -1
  62. package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts +1 -11
  63. package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts.map +1 -1
  64. package/dist/api/services/campaigns/GET/useCampaignStats.d.ts +1 -1
  65. package/dist/api/services/campaigns/GET/useCampaignStats.d.ts.map +1 -1
  66. package/dist/api/services/campaigns/GET/useCampaigns.d.ts +1 -1
  67. package/dist/api/services/campaigns/GET/useCampaigns.d.ts.map +1 -1
  68. package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts +1 -9
  69. package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts.map +1 -1
  70. package/dist/api/services/cdn/cloudflare/POST/cloudflarePurgeCache.d.ts +35 -0
  71. package/dist/api/services/cdn/cloudflare/POST/cloudflarePurgeCache.d.ts.map +1 -0
  72. package/dist/api/services/cdn/cloudflare/POST/index.d.ts +5 -0
  73. package/dist/api/services/cdn/cloudflare/POST/index.d.ts.map +1 -0
  74. package/dist/api/services/cdn/cloudflare/index.d.ts +5 -0
  75. package/dist/api/services/cdn/cloudflare/index.d.ts.map +1 -0
  76. package/dist/api/services/cdn/cloudfront/POST/cloudFrontCreateInvalidation.d.ts +38 -0
  77. package/dist/api/services/cdn/cloudfront/POST/cloudFrontCreateInvalidation.d.ts.map +1 -0
  78. package/dist/api/services/cdn/cloudfront/POST/index.d.ts +5 -0
  79. package/dist/api/services/cdn/cloudfront/POST/index.d.ts.map +1 -0
  80. package/dist/api/services/cdn/cloudfront/index.d.ts +5 -0
  81. package/dist/api/services/cdn/cloudfront/index.d.ts.map +1 -0
  82. package/dist/api/services/cdn/fastly/POST/fastlyPurgeUrl.d.ts +35 -0
  83. package/dist/api/services/cdn/fastly/POST/fastlyPurgeUrl.d.ts.map +1 -0
  84. package/dist/api/services/cdn/fastly/POST/index.d.ts +5 -0
  85. package/dist/api/services/cdn/fastly/POST/index.d.ts.map +1 -0
  86. package/dist/api/services/cdn/fastly/index.d.ts +5 -0
  87. package/dist/api/services/cdn/fastly/index.d.ts.map +1 -0
  88. package/dist/api/services/cdn/index.d.ts +8 -0
  89. package/dist/api/services/cdn/index.d.ts.map +1 -0
  90. package/dist/api/services/index.d.ts +3 -0
  91. package/dist/api/services/index.d.ts.map +1 -1
  92. package/dist/api/services/infobip/email/GET/fetchEmailLogs.d.ts +50 -0
  93. package/dist/api/services/infobip/email/GET/fetchEmailLogs.d.ts.map +1 -0
  94. package/dist/api/services/infobip/email/GET/fetchEmailReports.d.ts +44 -0
  95. package/dist/api/services/infobip/email/GET/fetchEmailReports.d.ts.map +1 -0
  96. package/dist/api/services/infobip/email/GET/fetchScheduledEmailStatuses.d.ts +28 -0
  97. package/dist/api/services/infobip/email/GET/fetchScheduledEmailStatuses.d.ts.map +1 -0
  98. package/dist/api/services/infobip/email/GET/fetchScheduledEmails.d.ts +27 -0
  99. package/dist/api/services/infobip/email/GET/fetchScheduledEmails.d.ts.map +1 -0
  100. package/dist/api/services/infobip/email/GET/fetchValidations.d.ts +60 -0
  101. package/dist/api/services/infobip/email/GET/fetchValidations.d.ts.map +1 -0
  102. package/dist/api/services/infobip/email/GET/index.d.ts +10 -0
  103. package/dist/api/services/infobip/email/GET/index.d.ts.map +1 -0
  104. package/dist/api/services/infobip/email/POST/bulkValidateEmails.d.ts +50 -0
  105. package/dist/api/services/infobip/email/POST/bulkValidateEmails.d.ts.map +1 -0
  106. package/dist/api/services/infobip/email/POST/index.d.ts +9 -0
  107. package/dist/api/services/infobip/email/POST/index.d.ts.map +1 -0
  108. package/dist/api/services/infobip/email/POST/sendAdvancedEmail.d.ts +67 -0
  109. package/dist/api/services/infobip/email/POST/sendAdvancedEmail.d.ts.map +1 -0
  110. package/dist/api/services/infobip/email/POST/sendEmail.d.ts +60 -0
  111. package/dist/api/services/infobip/email/POST/sendEmail.d.ts.map +1 -0
  112. package/dist/api/services/infobip/email/POST/validateEmail.d.ts +40 -0
  113. package/dist/api/services/infobip/email/POST/validateEmail.d.ts.map +1 -0
  114. package/dist/api/services/infobip/email/PUT/index.d.ts +7 -0
  115. package/dist/api/services/infobip/email/PUT/index.d.ts.map +1 -0
  116. package/dist/api/services/infobip/email/PUT/rescheduleEmails.d.ts +29 -0
  117. package/dist/api/services/infobip/email/PUT/rescheduleEmails.d.ts.map +1 -0
  118. package/dist/api/services/infobip/email/PUT/updateScheduledEmailStatuses.d.ts +36 -0
  119. package/dist/api/services/infobip/email/PUT/updateScheduledEmailStatuses.d.ts.map +1 -0
  120. package/dist/api/services/infobip/email/index.d.ts +8 -0
  121. package/dist/api/services/infobip/email/index.d.ts.map +1 -0
  122. package/dist/api/services/infobip/index.d.ts +6 -0
  123. package/dist/api/services/infobip/index.d.ts.map +1 -0
  124. package/dist/api/services/virustotal/analyses/GET/getAnalysisResult.d.ts +35 -0
  125. package/dist/api/services/virustotal/analyses/GET/getAnalysisResult.d.ts.map +1 -0
  126. package/dist/api/services/virustotal/analyses/GET/index.d.ts +6 -0
  127. package/dist/api/services/virustotal/analyses/GET/index.d.ts.map +1 -0
  128. package/dist/api/services/virustotal/analyses/index.d.ts +6 -0
  129. package/dist/api/services/virustotal/analyses/index.d.ts.map +1 -0
  130. package/dist/api/services/virustotal/files/POST/index.d.ts +6 -0
  131. package/dist/api/services/virustotal/files/POST/index.d.ts.map +1 -0
  132. package/dist/api/services/virustotal/files/POST/uploadFileForScanning.d.ts +36 -0
  133. package/dist/api/services/virustotal/files/POST/uploadFileForScanning.d.ts.map +1 -0
  134. package/dist/api/services/virustotal/files/index.d.ts +6 -0
  135. package/dist/api/services/virustotal/files/index.d.ts.map +1 -0
  136. package/dist/api/services/virustotal/index.d.ts +8 -0
  137. package/dist/api/services/virustotal/index.d.ts.map +1 -0
  138. package/dist/api/utils/aws/index.d.ts +7 -0
  139. package/dist/api/utils/aws/index.d.ts.map +1 -0
  140. package/dist/api/utils/aws/signature-v4.d.ts +41 -0
  141. package/dist/api/utils/aws/signature-v4.d.ts.map +1 -0
  142. package/dist/api/utils/aws/xml/cloudfront.d.ts +37 -0
  143. package/dist/api/utils/aws/xml/cloudfront.d.ts.map +1 -0
  144. package/dist/api/utils/aws/xml/index.d.ts +6 -0
  145. package/dist/api/utils/aws/xml/index.d.ts.map +1 -0
  146. package/dist/api/utils/index.d.ts +0 -3
  147. package/dist/api/utils/index.d.ts.map +1 -1
  148. package/dist/index.cjs +1586 -1384
  149. package/dist/index.cjs.map +1 -1
  150. package/dist/index.mjs +1522 -1354
  151. package/dist/index.mjs.map +1 -1
  152. package/package.json +7 -5
  153. package/dist/api/errors/ApiPackageError.d.ts +0 -101
  154. package/dist/api/errors/ApiPackageError.d.ts.map +0 -1
  155. package/dist/api/errors/definitions.d.ts +0 -24
  156. package/dist/api/errors/definitions.d.ts.map +0 -1
  157. package/dist/api/errors/error-codes.d.ts +0 -116
  158. package/dist/api/errors/error-codes.d.ts.map +0 -1
  159. package/dist/api/errors/error-events.d.ts +0 -63
  160. package/dist/api/errors/error-events.d.ts.map +0 -1
  161. package/dist/api/errors/types-constants.d.ts +0 -64
  162. package/dist/api/errors/types-constants.d.ts.map +0 -1
  163. package/dist/api/hooks/types.d.ts +0 -82
  164. package/dist/api/hooks/types.d.ts.map +0 -1
  165. package/dist/api/utils/generation/correlation-id.d.ts +0 -206
  166. package/dist/api/utils/generation/correlation-id.d.ts.map +0 -1
  167. package/dist/api/utils/generation/id-generator.d.ts +0 -133
  168. package/dist/api/utils/generation/id-generator.d.ts.map +0 -1
  169. package/dist/api/utils/generation/request-id.d.ts +0 -106
  170. package/dist/api/utils/generation/request-id.d.ts.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,16 +1,39 @@
1
1
  'use strict';
2
2
 
3
- var config = require('@plyaz/config');
4
- var types = require('@plyaz/types');
5
- var api = require('@plyaz/types/api');
3
+ var errors$1 = require('@plyaz/errors');
6
4
  var fetchff = require('fetchff');
5
+ var api = require('@plyaz/types/api');
6
+ var logger$1 = require('@plyaz/logger');
7
+ var types = require('@plyaz/types');
8
+ var config = require('@plyaz/config');
9
+ var errors = require('@plyaz/types/errors');
7
10
  var async_hooks = require('async_hooks');
8
11
  var common = require('@nestjs/common');
9
12
  var rxjs = require('rxjs');
10
- var crypto$1 = require('crypto');
13
+ var crypto2 = require('crypto');
11
14
  var reactQuery = require('@tanstack/react-query');
12
15
  var react = require('react');
13
16
 
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n.default = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var crypto2__namespace = /*#__PURE__*/_interopNamespace(crypto2);
36
+
14
37
  // @plyaz package - Built with tsup
15
38
  var __defProp = Object.defineProperty;
16
39
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -610,7 +633,7 @@ function getCrypto() {
610
633
  }
611
634
  __name(getCrypto, "getCrypto");
612
635
  function generateUUID() {
613
- const crypto2 = getCrypto();
636
+ const crypto3 = getCrypto();
614
637
  const UUID_CONSTANTS = {
615
638
  BYTES: 16,
616
639
  VERSION_POSITION: 6,
@@ -627,12 +650,12 @@ function generateUUID() {
627
650
  // eslint-disable-next-line no-magic-numbers
628
651
  POSITIONS: [8, 12, 16, 20, 32]
629
652
  };
630
- if (crypto2 && typeof crypto2.randomUUID === "function") {
631
- return crypto2.randomUUID();
653
+ if (crypto3 && typeof crypto3.randomUUID === "function") {
654
+ return crypto3.randomUUID();
632
655
  }
633
- if (crypto2?.getRandomValues) {
656
+ if (crypto3?.getRandomValues) {
634
657
  const bytes = new Uint8Array(UUID_CONSTANTS.BYTES);
635
- crypto2.getRandomValues(bytes);
658
+ crypto3.getRandomValues(bytes);
636
659
  bytes[UUID_CONSTANTS.VERSION_POSITION] = bytes[UUID_CONSTANTS.VERSION_POSITION] & UUID_CONSTANTS.VERSION_MASK | UUID_CONSTANTS.VERSION_VALUE;
637
660
  bytes[UUID_CONSTANTS.VARIANT_POSITION] = bytes[UUID_CONSTANTS.VARIANT_POSITION] & UUID_CONSTANTS.VARIANT_MASK | UUID_CONSTANTS.VARIANT_VALUE;
638
661
  const hex = Array.from(
@@ -1007,302 +1030,6 @@ function applyPollingStrategy(strategy) {
1007
1030
  return strategy;
1008
1031
  }
1009
1032
  __name(applyPollingStrategy, "applyPollingStrategy");
1010
- var ERROR_DEFINITIONS = {
1011
- // Authentication
1012
- [api.API_ERROR_CODES.AUTH_UNAUTHORIZED]: {
1013
- code: api.API_ERROR_CODES.AUTH_UNAUTHORIZED,
1014
- status: config.HTTP_STATUS.UNAUTHORIZED,
1015
- category: types.ERROR_CATEGORY.Authentication
1016
- },
1017
- [api.API_ERROR_CODES.AUTH_FORBIDDEN]: {
1018
- code: api.API_ERROR_CODES.AUTH_FORBIDDEN,
1019
- status: config.HTTP_STATUS.FORBIDDEN,
1020
- category: types.ERROR_CATEGORY.Authorization
1021
- },
1022
- [api.API_ERROR_CODES.AUTH_TOKEN_EXPIRED]: {
1023
- code: api.API_ERROR_CODES.AUTH_TOKEN_EXPIRED,
1024
- status: config.HTTP_STATUS.UNAUTHORIZED,
1025
- category: types.ERROR_CATEGORY.Authentication
1026
- },
1027
- [api.API_ERROR_CODES.AUTH_INVALID_CREDENTIALS]: {
1028
- code: api.API_ERROR_CODES.AUTH_INVALID_CREDENTIALS,
1029
- status: config.HTTP_STATUS.UNAUTHORIZED,
1030
- category: types.ERROR_CATEGORY.Authentication
1031
- },
1032
- // Rate Limiting
1033
- [api.API_ERROR_CODES.RATE_LIMIT_EXCEEDED]: {
1034
- code: api.API_ERROR_CODES.RATE_LIMIT_EXCEEDED,
1035
- status: config.HTTP_STATUS.TOO_MANY_REQUESTS,
1036
- category: types.ERROR_CATEGORY.RateLimit
1037
- },
1038
- // Resource Errors
1039
- [api.API_ERROR_CODES.RESOURCE_NOT_FOUND]: {
1040
- code: api.API_ERROR_CODES.RESOURCE_NOT_FOUND,
1041
- status: config.HTTP_STATUS.NOT_FOUND,
1042
- category: types.ERROR_CATEGORY.NotFound
1043
- },
1044
- // System Errors
1045
- [api.API_ERROR_CODES.INTERNAL_SERVER_ERROR]: {
1046
- code: api.API_ERROR_CODES.INTERNAL_SERVER_ERROR,
1047
- status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
1048
- category: types.ERROR_CATEGORY.Server
1049
- },
1050
- [api.API_ERROR_CODES.SERVICE_UNAVAILABLE]: {
1051
- code: api.API_ERROR_CODES.SERVICE_UNAVAILABLE,
1052
- status: config.HTTP_STATUS.SERVICE_UNAVAILABLE,
1053
- category: types.ERROR_CATEGORY.Server
1054
- },
1055
- [api.API_ERROR_CODES.EXTERNAL_SERVICE_ERROR]: {
1056
- code: api.API_ERROR_CODES.EXTERNAL_SERVICE_ERROR,
1057
- status: config.HTTP_STATUS.BAD_GATEWAY,
1058
- category: types.ERROR_CATEGORY.ExternalService
1059
- },
1060
- // Validation
1061
- [api.API_ERROR_CODES.VALIDATION_ERROR]: {
1062
- code: api.API_ERROR_CODES.VALIDATION_ERROR,
1063
- status: config.HTTP_STATUS.BAD_REQUEST,
1064
- category: types.ERROR_CATEGORY.Validation
1065
- },
1066
- [api.API_ERROR_CODES.VALIDATION_FAILED]: {
1067
- code: api.API_ERROR_CODES.VALIDATION_FAILED,
1068
- status: config.HTTP_STATUS.BAD_REQUEST,
1069
- category: types.ERROR_CATEGORY.Validation
1070
- },
1071
- [api.API_ERROR_CODES.REQUIRED_FIELD_MISSING]: {
1072
- code: api.API_ERROR_CODES.REQUIRED_FIELD_MISSING,
1073
- status: config.HTTP_STATUS.BAD_REQUEST,
1074
- category: types.ERROR_CATEGORY.Validation,
1075
- fieldsLeft: ["field"]
1076
- },
1077
- [api.API_ERROR_CODES.INVALID_FORMAT]: {
1078
- code: api.API_ERROR_CODES.INVALID_FORMAT,
1079
- status: config.HTTP_STATUS.BAD_REQUEST,
1080
- category: types.ERROR_CATEGORY.Validation
1081
- },
1082
- [api.API_ERROR_CODES.STRING_TOO_SHORT]: {
1083
- code: api.API_ERROR_CODES.STRING_TOO_SHORT,
1084
- status: config.HTTP_STATUS.BAD_REQUEST,
1085
- category: types.ERROR_CATEGORY.Validation,
1086
- fieldsLeft: ["field", "minLength"]
1087
- },
1088
- [api.API_ERROR_CODES.STRING_TOO_LONG]: {
1089
- code: api.API_ERROR_CODES.STRING_TOO_LONG,
1090
- status: config.HTTP_STATUS.BAD_REQUEST,
1091
- category: types.ERROR_CATEGORY.Validation,
1092
- fieldsLeft: ["field", "maxLength"]
1093
- },
1094
- // Request Errors
1095
- [api.API_ERROR_CODES.REQUEST_TIMEOUT]: {
1096
- code: api.API_ERROR_CODES.REQUEST_TIMEOUT,
1097
- status: config.HTTP_STATUS.REQUEST_TIMEOUT,
1098
- category: types.ERROR_CATEGORY.Timeout
1099
- },
1100
- [api.API_ERROR_CODES.REQUEST_ABORTED]: {
1101
- code: api.API_ERROR_CODES.REQUEST_ABORTED,
1102
- status: 0,
1103
- // No HTTP status for aborted
1104
- category: types.ERROR_CATEGORY.Client
1105
- },
1106
- [api.API_ERROR_CODES.REQUEST_INVALID_PARAMS]: {
1107
- code: api.API_ERROR_CODES.REQUEST_INVALID_PARAMS,
1108
- status: config.HTTP_STATUS.BAD_REQUEST,
1109
- category: types.ERROR_CATEGORY.Client
1110
- },
1111
- [api.API_ERROR_CODES.REQUEST_PREPARATION_FAILED]: {
1112
- code: api.API_ERROR_CODES.REQUEST_PREPARATION_FAILED,
1113
- status: config.HTTP_STATUS.BAD_REQUEST,
1114
- category: types.ERROR_CATEGORY.Client
1115
- },
1116
- // Response Errors
1117
- [api.API_ERROR_CODES.RESPONSE_INVALID_FORMAT]: {
1118
- code: api.API_ERROR_CODES.RESPONSE_INVALID_FORMAT,
1119
- status: config.HTTP_STATUS.UNPROCESSABLE_ENTITY,
1120
- category: types.ERROR_CATEGORY.Client
1121
- },
1122
- [api.API_ERROR_CODES.RESPONSE_PARSING_FAILED]: {
1123
- code: api.API_ERROR_CODES.RESPONSE_PARSING_FAILED,
1124
- status: config.HTTP_STATUS.UNPROCESSABLE_ENTITY,
1125
- category: types.ERROR_CATEGORY.Client
1126
- },
1127
- // Network
1128
- [api.API_ERROR_CODES.NETWORK_ERROR]: {
1129
- code: api.API_ERROR_CODES.NETWORK_ERROR,
1130
- status: config.HTTP_STATUS.BAD_GATEWAY,
1131
- category: types.ERROR_CATEGORY.Network
1132
- },
1133
- [api.API_ERROR_CODES.NETWORK_TIMEOUT]: {
1134
- code: api.API_ERROR_CODES.NETWORK_TIMEOUT,
1135
- status: config.HTTP_STATUS.GATEWAY_TIMEOUT,
1136
- category: types.ERROR_CATEGORY.Timeout
1137
- },
1138
- [api.API_ERROR_CODES.NETWORK_CONNECTION_FAILED]: {
1139
- code: api.API_ERROR_CODES.NETWORK_CONNECTION_FAILED,
1140
- status: 0,
1141
- // No HTTP status for connection failure
1142
- category: types.ERROR_CATEGORY.Network
1143
- },
1144
- [api.API_ERROR_CODES.NETWORK_OFFLINE]: {
1145
- code: api.API_ERROR_CODES.NETWORK_OFFLINE,
1146
- status: 0,
1147
- // No HTTP status for offline
1148
- category: types.ERROR_CATEGORY.Network
1149
- },
1150
- [api.API_ERROR_CODES.NETWORK_DNS_FAILED]: {
1151
- code: api.API_ERROR_CODES.NETWORK_DNS_FAILED,
1152
- status: 0,
1153
- // No HTTP status for DNS failure
1154
- category: types.ERROR_CATEGORY.Network
1155
- },
1156
- // Server
1157
- [api.API_ERROR_CODES.SERVER_ERROR]: {
1158
- code: api.API_ERROR_CODES.SERVER_ERROR,
1159
- status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
1160
- category: types.ERROR_CATEGORY.Server
1161
- },
1162
- // Client
1163
- [api.API_ERROR_CODES.CLIENT_ERROR]: {
1164
- code: api.API_ERROR_CODES.CLIENT_ERROR,
1165
- status: config.HTTP_STATUS.BAD_REQUEST,
1166
- category: types.ERROR_CATEGORY.Client
1167
- },
1168
- [api.API_ERROR_CODES.CLIENT_CANCELLED]: {
1169
- code: api.API_ERROR_CODES.CLIENT_CANCELLED,
1170
- status: 0,
1171
- // No HTTP status for cancelled
1172
- category: types.ERROR_CATEGORY.Client
1173
- },
1174
- [api.API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED]: {
1175
- code: api.API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED,
1176
- status: 0,
1177
- // No HTTP status for initialization failure
1178
- category: types.ERROR_CATEGORY.Client
1179
- },
1180
- [api.API_ERROR_CODES.CLIENT_INVALID_CONFIG]: {
1181
- code: api.API_ERROR_CODES.CLIENT_INVALID_CONFIG,
1182
- status: 0,
1183
- // No HTTP status for configuration errors
1184
- category: types.ERROR_CATEGORY.Client
1185
- },
1186
- [api.API_ERROR_CODES.CLIENT_MISSING_BASE_URL]: {
1187
- code: api.API_ERROR_CODES.CLIENT_MISSING_BASE_URL,
1188
- status: 0,
1189
- // No HTTP status for configuration errors
1190
- category: types.ERROR_CATEGORY.Client
1191
- },
1192
- [api.API_ERROR_CODES.CONFIG_VALIDATION_FAILED]: {
1193
- code: api.API_ERROR_CODES.CONFIG_VALIDATION_FAILED,
1194
- status: config.HTTP_STATUS.BAD_REQUEST,
1195
- category: types.ERROR_CATEGORY.Validation
1196
- },
1197
- [api.API_ERROR_CODES.HEADER_PROCESSING_FAILED]: {
1198
- code: api.API_ERROR_CODES.HEADER_PROCESSING_FAILED,
1199
- status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
1200
- category: types.ERROR_CATEGORY.Headers
1201
- },
1202
- [api.API_ERROR_CODES.NETWORK_OVERRIDE_FAILED]: {
1203
- code: api.API_ERROR_CODES.NETWORK_OVERRIDE_FAILED,
1204
- status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
1205
- category: types.ERROR_CATEGORY.Network
1206
- },
1207
- // Headers
1208
- [api.API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED]: {
1209
- code: api.API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED,
1210
- status: config.HTTP_STATUS.BAD_REQUEST,
1211
- category: types.ERROR_CATEGORY.Headers
1212
- },
1213
- [api.API_ERROR_CODES.HEADERS_VALIDATION_FAILED]: {
1214
- code: api.API_ERROR_CODES.HEADERS_VALIDATION_FAILED,
1215
- status: config.HTTP_STATUS.BAD_REQUEST,
1216
- category: types.ERROR_CATEGORY.Headers
1217
- },
1218
- [api.API_ERROR_CODES.HEADERS_MERGE_CONFLICT]: {
1219
- code: api.API_ERROR_CODES.HEADERS_MERGE_CONFLICT,
1220
- status: config.HTTP_STATUS.CONFLICT,
1221
- category: types.ERROR_CATEGORY.Headers
1222
- },
1223
- // Cache
1224
- [api.API_ERROR_CODES.CACHE_STORAGE_FAILED]: {
1225
- code: api.API_ERROR_CODES.CACHE_STORAGE_FAILED,
1226
- status: 0,
1227
- // No HTTP status for cache failures
1228
- category: types.ERROR_CATEGORY.Cache
1229
- },
1230
- [api.API_ERROR_CODES.CACHE_RETRIEVAL_FAILED]: {
1231
- code: api.API_ERROR_CODES.CACHE_RETRIEVAL_FAILED,
1232
- status: 0,
1233
- // No HTTP status for cache failures
1234
- category: types.ERROR_CATEGORY.Cache
1235
- },
1236
- [api.API_ERROR_CODES.CACHE_INVALIDATION_FAILED]: {
1237
- code: api.API_ERROR_CODES.CACHE_INVALIDATION_FAILED,
1238
- status: 0,
1239
- // No HTTP status for cache failures
1240
- category: types.ERROR_CATEGORY.Cache
1241
- },
1242
- // Retry
1243
- [api.API_ERROR_CODES.RETRY_EXHAUSTED]: {
1244
- code: api.API_ERROR_CODES.RETRY_EXHAUSTED,
1245
- status: config.HTTP_STATUS.SERVICE_UNAVAILABLE,
1246
- category: types.ERROR_CATEGORY.Retry
1247
- },
1248
- [api.API_ERROR_CODES.RETRY_STRATEGY_INVALID]: {
1249
- code: api.API_ERROR_CODES.RETRY_STRATEGY_INVALID,
1250
- status: 0,
1251
- // No HTTP status for strategy errors
1252
- category: types.ERROR_CATEGORY.Retry
1253
- },
1254
- // Strategy
1255
- [api.API_ERROR_CODES.STRATEGY_INVALID]: {
1256
- code: api.API_ERROR_CODES.STRATEGY_INVALID,
1257
- status: 0,
1258
- // No HTTP status for strategy errors
1259
- category: types.ERROR_CATEGORY.Strategy
1260
- },
1261
- [api.API_ERROR_CODES.STRATEGY_CONFLICT]: {
1262
- code: api.API_ERROR_CODES.STRATEGY_CONFLICT,
1263
- status: config.HTTP_STATUS.CONFLICT,
1264
- category: types.ERROR_CATEGORY.Strategy
1265
- },
1266
- // Regional
1267
- [api.API_ERROR_CODES.REGIONAL_PRESET_NOT_FOUND]: {
1268
- code: api.API_ERROR_CODES.REGIONAL_PRESET_NOT_FOUND,
1269
- status: 0,
1270
- // No HTTP status for regional preset errors
1271
- category: types.ERROR_CATEGORY.Regional
1272
- },
1273
- [api.API_ERROR_CODES.REGION_DETECTION_FAILED]: {
1274
- code: api.API_ERROR_CODES.REGION_DETECTION_FAILED,
1275
- status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
1276
- category: types.ERROR_CATEGORY.Regional
1277
- },
1278
- // Timeout
1279
- [api.API_ERROR_CODES.TIMEOUT]: {
1280
- code: api.API_ERROR_CODES.TIMEOUT,
1281
- status: config.HTTP_STATUS.REQUEST_TIMEOUT,
1282
- category: types.ERROR_CATEGORY.Timeout
1283
- },
1284
- // Unknown
1285
- [api.API_ERROR_CODES.UNKNOWN_ERROR]: {
1286
- code: api.API_ERROR_CODES.UNKNOWN_ERROR,
1287
- status: config.HTTP_STATUS.INTERNAL_SERVER_ERROR,
1288
- category: types.ERROR_CATEGORY.Unknown
1289
- }
1290
- };
1291
- function getErrorDefinition(errorCode) {
1292
- return ERROR_DEFINITIONS[errorCode];
1293
- }
1294
- __name(getErrorDefinition, "getErrorDefinition");
1295
- function getErrorCodeByStatus(status) {
1296
- const entry = Object.entries(ERROR_DEFINITIONS).find(
1297
- ([, definition]) => definition.status === status
1298
- );
1299
- return entry?.[0];
1300
- }
1301
- __name(getErrorCodeByStatus, "getErrorCodeByStatus");
1302
- function getErrorCategory(errorCode) {
1303
- return ERROR_DEFINITIONS[errorCode]?.category ?? types.ERROR_CATEGORY.Unknown;
1304
- }
1305
- __name(getErrorCategory, "getErrorCategory");
1306
1033
  var BINARY_HEAP = {
1307
1034
  /** Number of children per node in binary heap */
1308
1035
  CHILDREN_PER_NODE: 2,
@@ -2029,8 +1756,6 @@ function removeCircularReferences(obj) {
2029
1756
  }
2030
1757
  }
2031
1758
  __name(removeCircularReferences, "removeCircularReferences");
2032
-
2033
- // src/api/utils/time.ts
2034
1759
  var MS_IN_SECOND = 1e3;
2035
1760
  var SECONDS_PER_MINUTE = 60;
2036
1761
  var MINUTES_PER_HOUR = 60;
@@ -2575,13 +2300,13 @@ var BaseEventFactory = class {
2575
2300
  constructor(namespace, emitter) {
2576
2301
  this.namespace = namespace;
2577
2302
  this.emitter = emitter;
2578
- api.EVENT_SCOPES.forEach((scope) => {
2303
+ api.EVENT_SCOPES_WITH_TEMPORARY.forEach((scope) => {
2579
2304
  this.scopedHandlers.set(scope, /* @__PURE__ */ new Map());
2580
2305
  this.originalHandlers.set(scope, /* @__PURE__ */ new Map());
2581
2306
  });
2582
2307
  this.trackFactoryOperation("factory_initialized", {
2583
2308
  namespace: this.namespace,
2584
- scopesInitialized: api.EVENT_SCOPES.length,
2309
+ scopesInitialized: api.EVENT_SCOPES_WITH_TEMPORARY.length,
2585
2310
  emitterType: "EventEmitter"
2586
2311
  });
2587
2312
  }
@@ -2733,16 +2458,14 @@ var BaseEventFactory = class {
2733
2458
  * - Non-scoped wildcards for backwards compatibility (e.g., headers:*)
2734
2459
  */
2735
2460
  emitAcrossScopes(eventType, eventName, data, scopes) {
2736
- const targetScopes = scopes ?? api.EVENT_SCOPES;
2737
- const normalizedScopes = targetScopes.map(
2738
- (s) => s === "temporary" ? "request" : s
2739
- );
2740
- const scopeOrder = [...api.EVENT_SCOPES];
2461
+ const targetScopes = scopes ?? api.EVENT_SCOPES_WITH_TEMPORARY;
2462
+ const scopeOrder = [...api.EVENT_SCOPES_WITH_TEMPORARY];
2741
2463
  for (const scope of scopeOrder) {
2742
- if (normalizedScopes.includes(scope)) {
2743
- const namespacedEvent = `${scope}:${eventType}:${eventName}`;
2464
+ if (targetScopes.includes(scope)) {
2465
+ const emitScope = scope === "temporary" ? "request" : scope;
2466
+ const namespacedEvent = `${emitScope}:${eventType}:${eventName}`;
2744
2467
  this.emitter.emit(namespacedEvent, data);
2745
- const wildcardEvent = `${scope}:${eventType}:*`;
2468
+ const wildcardEvent = `${emitScope}:${eventType}:*`;
2746
2469
  const wildcardData2 = typeof data === "object" && data !== null ? { ...data, originalEvent: eventName } : { data, originalEvent: eventName };
2747
2470
  this.emitter.emit(wildcardEvent, wildcardData2);
2748
2471
  }
@@ -2940,6 +2663,52 @@ var BaseEventFactory = class {
2940
2663
  });
2941
2664
  return this.createHandlerUnsubscribe(scope, eventName, handler, unsubscribes);
2942
2665
  }
2666
+ /**
2667
+ * Remove a specific handler from a scoped event
2668
+ *
2669
+ * @param scope - The scope to remove from ('global', 'config', 'client', 'request')
2670
+ * @param eventName - The event name (e.g., 'validation', 'network', '*')
2671
+ * @param handler - The specific handler to remove (should be the original handler, not wrapped)
2672
+ */
2673
+ removeScopedHandler(scope, eventName, handler) {
2674
+ const startTime = Date.now();
2675
+ const scopeMap = this.scopedHandlers.get(scope);
2676
+ const originalMap = this.originalHandlers.get(scope);
2677
+ if (!scopeMap || !originalMap) {
2678
+ return;
2679
+ }
2680
+ const handlers = scopeMap.get(eventName);
2681
+ const originals = originalMap.get(eventName);
2682
+ if (!handlers || !originals) {
2683
+ return;
2684
+ }
2685
+ const handlerAsUnknown = handler;
2686
+ const originalIndex = originals.indexOf(handlerAsUnknown);
2687
+ if (originalIndex === -1) {
2688
+ return;
2689
+ }
2690
+ const beforeCount = handlers.length;
2691
+ const wrappedHandler = handlers[originalIndex];
2692
+ handlers.splice(originalIndex, 1);
2693
+ originals.splice(originalIndex, 1);
2694
+ const scopedEventKey = `${scope}:${this.namespace}:${eventName}`;
2695
+ this.emitter.off(scopedEventKey, wrappedHandler);
2696
+ if (handlers.length === 0) {
2697
+ scopeMap.delete(eventName);
2698
+ originalMap.delete(eventName);
2699
+ } else {
2700
+ scopeMap.set(eventName, handlers);
2701
+ originalMap.set(eventName, originals);
2702
+ }
2703
+ this.trackFactoryOperation("specific_handler_removed", {
2704
+ scope,
2705
+ eventName,
2706
+ beforeHandlerCount: beforeCount,
2707
+ afterHandlerCount: handlers.length,
2708
+ eventDeleted: handlers.length === 0,
2709
+ removalTime: Date.now() - startTime
2710
+ });
2711
+ }
2943
2712
  /**
2944
2713
  * Remove all listeners for a scoped event
2945
2714
  *
@@ -4688,13 +4457,13 @@ var HANDLER_SCOPES = {
4688
4457
  REQUEST: "request"
4689
4458
  // Request-level handlers (highest priority, per-request)
4690
4459
  };
4691
- var EVENT_SCOPES2 = [
4460
+ var EVENT_SCOPES = [
4692
4461
  HANDLER_SCOPES.GLOBAL,
4693
4462
  HANDLER_SCOPES.CONFIG,
4694
4463
  HANDLER_SCOPES.CLIENT,
4695
4464
  HANDLER_SCOPES.REQUEST
4696
4465
  ];
4697
- var EVENT_SCOPES_WITH_TEMPORARY = [...EVENT_SCOPES2, "temporary"];
4466
+ var EVENT_SCOPES_WITH_TEMPORARY2 = [...EVENT_SCOPES, "temporary"];
4698
4467
  function createHandlerNamespace(eventType, scope) {
4699
4468
  return `${HANDLER_SCOPES[scope]}:${eventType}`;
4700
4469
  }
@@ -4886,6 +4655,7 @@ __name(getHandlerNamespaceForEvent, "getHandlerNamespaceForEvent");
4886
4655
 
4887
4656
  // src/api/events/EventManager.ts
4888
4657
  var SLOW_REQUEST_THRESHOLD_MS = 5e3;
4658
+ var logger = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.EVENT_MANAGER, transport: "console" });
4889
4659
  var EventManager = class _EventManager extends BaseEventFactory {
4890
4660
  static {
4891
4661
  __name(this, "EventManager");
@@ -4903,7 +4673,7 @@ var EventManager = class _EventManager extends BaseEventFactory {
4903
4673
  // DEFAULT: ALL scopes are active ['global', 'config', 'client', 'request']
4904
4674
  // This means events are emitted to handlers at all scope levels by default
4905
4675
  // Can be restricted by calling setEventScopes() with specific scopes
4906
- eventScopes = [...EVENT_SCOPES2];
4676
+ eventScopes = [...EVENT_SCOPES];
4907
4677
  currentEventScopes = this.eventScopes;
4908
4678
  // Alias for compatibility
4909
4679
  constructor() {
@@ -5079,9 +4849,10 @@ var EventManager = class _EventManager extends BaseEventFactory {
5079
4849
  */
5080
4850
  setupDebugHandlers() {
5081
4851
  this.on(DEBUG_EVENTS2.CONFIG_CONFLICT, (event) => {
5082
- if (typeof console !== "undefined" && typeof console.debug === "function") {
5083
- console.debug("[EventManager] Config conflict detected:", event);
5084
- }
4852
+ logger.debug("Config conflict detected", {
4853
+ conflictType: event.type,
4854
+ source: event.source
4855
+ });
5085
4856
  });
5086
4857
  }
5087
4858
  /**
@@ -5375,6 +5146,7 @@ var eventManager = {
5375
5146
  getEventStats: /* @__PURE__ */ __name(() => getEventManager().getEventStats(), "getEventStats"),
5376
5147
  getActiveScopes: /* @__PURE__ */ __name(() => getEventManager().getActiveScopes(), "getActiveScopes")
5377
5148
  };
5149
+ var logger2 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.EVENT_QUEUE, transport: "console" });
5378
5150
  var EventQueueManager = class _EventQueueManager {
5379
5151
  static {
5380
5152
  __name(this, "EventQueueManager");
@@ -5476,7 +5248,11 @@ var EventQueueManager = class _EventQueueManager {
5476
5248
  }
5477
5249
  }
5478
5250
  if (config.isDev) {
5479
- console.warn("[EventQueue] Event processing failed:", error);
5251
+ logger2.warn("Event processing failed", {
5252
+ eventType: event.eventType,
5253
+ eventName: event.eventName,
5254
+ error: error instanceof Error ? error.message : String(error)
5255
+ });
5480
5256
  }
5481
5257
  }
5482
5258
  }
@@ -7515,6 +7291,7 @@ function colorProgressBar(value, max2, width = DEFAULT_PROGRESS_BAR_WIDTH) {
7515
7291
  return `[${bar}] ${percentText}`;
7516
7292
  }
7517
7293
  __name(colorProgressBar, "colorProgressBar");
7294
+ var logger3 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.DEBUG_REPORT, transport: "console" });
7518
7295
  var DEBUG_REPORT_CONSTANTS = {
7519
7296
  // Byte sizes
7520
7297
  BYTES_PER_KB: 1024,
@@ -9260,24 +9037,26 @@ function logNetworkOverride(params) {
9260
9037
  networkQuality,
9261
9038
  duration
9262
9039
  } = params;
9263
- console.group(`🔧 Network Config Override: ${property}`);
9264
- console.log(`Value: ${originalValue} → ${overrideValue}`);
9265
- console.log(`Source: ${source}`);
9266
- console.log(`Reason: ${reason}`);
9040
+ logger3.group(`🔧 Network Config Override: ${property}`);
9041
+ logger3.info("Value changed", {
9042
+ from: originalValue,
9043
+ to: overrideValue
9044
+ });
9045
+ logger3.info("Source", { source });
9046
+ logger3.info("Reason", { reason });
9267
9047
  if (networkQuality) {
9268
- console.log(`Network Quality: ${networkQuality.toLowerCase()}`);
9048
+ logger3.info("Network Quality", { quality: networkQuality.toLowerCase() });
9269
9049
  }
9270
9050
  if (networkInfo?.saveData) {
9271
- console.log("Save-Data: enabled");
9051
+ logger3.info("Save-Data enabled");
9272
9052
  }
9273
9053
  if (duration) {
9274
- console.log(`Duration: ${duration}ms`);
9054
+ logger3.info("Duration", { ms: duration });
9275
9055
  }
9276
- console.groupEnd();
9056
+ logger3.groupEnd();
9277
9057
  }
9278
9058
  __name(logNetworkOverride, "logNetworkOverride");
9279
-
9280
- // src/api/debugger/UnifiedDebugger.ts
9059
+ var logger4 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.UNIFIED_DEBUGGER, transport: "console" });
9281
9060
  var DEBUGGER_CONSTANTS = {
9282
9061
  // Array/Division constants
9283
9062
  HALF_DIVISOR: 2,
@@ -9463,7 +9242,10 @@ var UnifiedDebugger = class _UnifiedDebugger {
9463
9242
  }
9464
9243
  }
9465
9244
  );
9466
- console.warn("⚠️ Debugger tracking failed:", apiError.message, apiError.context);
9245
+ logger4.warn("⚠️ Debugger tracking failed", {
9246
+ error: apiError.message,
9247
+ context: apiError.context
9248
+ });
9467
9249
  }
9468
9250
  /**
9469
9251
  * Safe tracking helper that handles errors properly
@@ -9798,11 +9580,11 @@ var UnifiedDebugger = class _UnifiedDebugger {
9798
9580
  try {
9799
9581
  const presetReport = this.getPresetChangeReport();
9800
9582
  if (presetReport) {
9801
- console.log(presetReport);
9802
- console.log("");
9583
+ logger4.info(presetReport);
9584
+ logger4.info("");
9803
9585
  }
9804
9586
  const report = await generateComprehensiveReport();
9805
- console.log(formatReportForConsole(report));
9587
+ logger4.info(formatReportForConsole(report));
9806
9588
  } catch (err) {
9807
9589
  const error = new ApiPackageError(
9808
9590
  "Failed to generate debug report",
@@ -9810,7 +9592,9 @@ var UnifiedDebugger = class _UnifiedDebugger {
9810
9592
  api.API_ERROR_CODES.DEBUG_TRACKING_FAILED,
9811
9593
  { cause: err }
9812
9594
  );
9813
- console.error("⚠️ Failed to generate debug report:", error.message);
9595
+ logger4.error("⚠️ Failed to generate debug report", {
9596
+ error: error.message
9597
+ });
9814
9598
  throw error;
9815
9599
  }
9816
9600
  }
@@ -10127,11 +9911,11 @@ var UnifiedDebugger = class _UnifiedDebugger {
10127
9911
  trigger: options.trigger,
10128
9912
  timestamp
10129
9913
  };
10130
- if (this.enabled && typeof console !== "undefined") {
10131
- console.group(`📋 Network preset applied: ${options.preset}`);
10132
- console.log(`Quality: ${options.networkConditions.quality}`);
10133
- console.log(`Trigger: ${options.trigger}`);
10134
- console.groupEnd();
9914
+ if (this.enabled) {
9915
+ logger4.group(`📋 Network preset applied: ${options.preset}`);
9916
+ logger4.info(`Quality: ${options.networkConditions.quality}`);
9917
+ logger4.info(`Trigger: ${options.trigger}`);
9918
+ logger4.groupEnd();
10135
9919
  }
10136
9920
  }
10137
9921
  options.changes.forEach((change) => {
@@ -10193,8 +9977,8 @@ var UnifiedDebugger = class _UnifiedDebugger {
10193
9977
  source: "networkPreset",
10194
9978
  reason: options.trigger
10195
9979
  });
10196
- if (this.enabled && typeof console !== "undefined") {
10197
- console.log(`🔄 Network config restored: ${property}`);
9980
+ if (this.enabled) {
9981
+ logger4.info("🔄 Network config restored", { property });
10198
9982
  }
10199
9983
  this.addToHistory({
10200
9984
  type: "network",
@@ -10221,16 +10005,16 @@ var UnifiedDebugger = class _UnifiedDebugger {
10221
10005
  trigger: options.trigger,
10222
10006
  timestamp: Date.now()
10223
10007
  };
10224
- if (this.enabled && typeof console !== "undefined") {
10225
- console.group(`📋 Network preset applied: ${presetId}`);
10226
- console.log(`Quality: ${options.networkQuality}`);
10227
- console.log(`Trigger: ${options.trigger}`);
10008
+ if (this.enabled) {
10009
+ logger4.group(`📋 Network preset applied: ${presetId}`);
10010
+ logger4.info(`Quality: ${options.networkQuality}`);
10011
+ logger4.info(`Trigger: ${options.trigger}`);
10228
10012
  changes.forEach((change) => {
10229
10013
  const prev = typeof change.previousValue === "string" ? `"${change.previousValue}"` : String(change.previousValue);
10230
10014
  const next = typeof change.newValue === "string" ? `"${change.newValue}"` : String(change.newValue);
10231
- console.log(` ${change.property}: ${prev} → ${next}`);
10015
+ logger4.info(` ${change.property}: ${prev} → ${next}`);
10232
10016
  });
10233
- console.groupEnd();
10017
+ logger4.groupEnd();
10234
10018
  }
10235
10019
  const configChanges = changes.reduce(
10236
10020
  (acc, change) => {
@@ -10653,14 +10437,14 @@ var UnifiedDebugger = class _UnifiedDebugger {
10653
10437
  */
10654
10438
  enableNetworkDebug() {
10655
10439
  this.setEnabled(true);
10656
- console.log("🌐 Network configuration debugging enabled");
10440
+ logger4.info("🌐 Network configuration debugging enabled");
10657
10441
  }
10658
10442
  /**
10659
10443
  * Disable network config debugging
10660
10444
  */
10661
10445
  disableNetworkDebug() {
10662
10446
  this.setEnabled(false);
10663
- console.log("🌐 Network configuration debugging disabled");
10447
+ logger4.info("🌐 Network configuration debugging disabled");
10664
10448
  }
10665
10449
  /**
10666
10450
  * Clear network debug data
@@ -10669,8 +10453,8 @@ var UnifiedDebugger = class _UnifiedDebugger {
10669
10453
  this.networkOverrides.clear();
10670
10454
  this.history = [];
10671
10455
  this.lastPresetChange = void 0;
10672
- if (this.enabled && typeof console !== "undefined") {
10673
- console.log("🗑️ Network configuration debug data cleared");
10456
+ if (this.enabled) {
10457
+ logger4.info("🗑️ Network configuration debug data cleared");
10674
10458
  }
10675
10459
  this.getDebugFactory().emitNetworkDataCleared();
10676
10460
  eventManager.debug.emitNetworkDataCleared();
@@ -10691,7 +10475,7 @@ var UnifiedDebugger = class _UnifiedDebugger {
10691
10475
  duration: config.duration
10692
10476
  });
10693
10477
  if (this.enabled && config.trigger) {
10694
- console.log(`🌐 Network override triggered by ${config.trigger}:`, {
10478
+ logger4.info(`🌐 Network override triggered by ${config.trigger}`, {
10695
10479
  property: config.property,
10696
10480
  value: config.overrideValue,
10697
10481
  reason: config.reason
@@ -11072,6 +10856,9 @@ function validateConfigUpdate(updates, options) {
11072
10856
  };
11073
10857
  }
11074
10858
  __name(validateConfigUpdate, "validateConfigUpdate");
10859
+ new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.CONFIG_QUEUE, transport: "console" });
10860
+ new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.QUEUE_ORCHESTRATOR, transport: "console" });
10861
+ var logger7 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.OPERATION_TRACKER, transport: "console" });
11075
10862
  var BaseOperationTracker = class {
11076
10863
  constructor(queueName, priorityDetector, sourceDetector) {
11077
10864
  this.queueName = queueName;
@@ -11136,7 +10923,10 @@ var BaseOperationTracker = class {
11136
10923
  try {
11137
10924
  await this.processor(op.data);
11138
10925
  } catch (error) {
11139
- console.error(`[${this.queueName}] Failed to process operation:`, error);
10926
+ logger7.error("Failed to process operation", {
10927
+ queueName: this.queueName,
10928
+ error: error instanceof Error ? error.message : String(error)
10929
+ });
11140
10930
  this.handleProcessingError(error, op.data);
11141
10931
  }
11142
10932
  }
@@ -11145,8 +10935,9 @@ var BaseOperationTracker = class {
11145
10935
  */
11146
10936
  handleProcessingError(error, operation) {
11147
10937
  if (config.isDev) {
11148
- console.debug(`[${this.queueName}] Error processing operation:`, {
11149
- error,
10938
+ logger7.debug("Error processing operation", {
10939
+ queueName: this.queueName,
10940
+ error: error instanceof Error ? error.message : String(error),
11150
10941
  operation: operation.operation,
11151
10942
  event: operation.event
11152
10943
  });
@@ -11225,6 +11016,14 @@ function createDefaultSourceDetector() {
11225
11016
  };
11226
11017
  }
11227
11018
  __name(createDefaultSourceDetector, "createDefaultSourceDetector");
11019
+ new logger$1.ApiLogger({
11020
+ service: types.LOGGER_SERVICES.EVENT_QUEUE_MANAGER,
11021
+ transport: "console"
11022
+ });
11023
+ var logger9 = new logger$1.ApiLogger({
11024
+ service: types.LOGGER_SERVICES.DEBUGGER_QUEUE_MANAGER,
11025
+ transport: "console"
11026
+ });
11228
11027
  var DebuggerQueueManager = class _DebuggerQueueManager {
11229
11028
  static {
11230
11029
  __name(this, "DebuggerQueueManager");
@@ -11296,7 +11095,9 @@ var DebuggerQueueManager = class _DebuggerQueueManager {
11296
11095
  }
11297
11096
  } catch (error) {
11298
11097
  if (config.isDev) {
11299
- console.warn("[DebuggerQueue] Operation failed:", error);
11098
+ logger9.warn("Operation failed", {
11099
+ error: error instanceof Error ? error.message : String(error)
11100
+ });
11300
11101
  }
11301
11102
  }
11302
11103
  }
@@ -11389,6 +11190,7 @@ var DebuggerQueueManager = class _DebuggerQueueManager {
11389
11190
  }
11390
11191
  };
11391
11192
  var MAX_RETRY_ATTEMPTS = 3;
11193
+ var logger10 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.OPERATION_TRACKER, transport: "console" });
11392
11194
  var OperationTracker = class _OperationTracker extends BaseOperationTracker {
11393
11195
  static {
11394
11196
  __name(this, "OperationTracker");
@@ -11452,7 +11254,12 @@ var OperationTracker = class _OperationTracker extends BaseOperationTracker {
11452
11254
  handleProcessingError(error, operation) {
11453
11255
  const retryCount = operation.retryCount ?? 0;
11454
11256
  if (operation.category === "debugging" && retryCount < MAX_RETRY_ATTEMPTS) {
11455
- console.warn(`[OperationTracker] Retrying critical operation (attempt ${retryCount + 1})`);
11257
+ logger10.warn("Retrying critical operation", {
11258
+ attempt: retryCount + 1,
11259
+ maxAttempts: MAX_RETRY_ATTEMPTS,
11260
+ operation: operation.operation,
11261
+ category: operation.category
11262
+ });
11456
11263
  this.getQueue().add({
11457
11264
  data: {
11458
11265
  ...operation,
@@ -11461,7 +11268,12 @@ var OperationTracker = class _OperationTracker extends BaseOperationTracker {
11461
11268
  priority: api.PRIORITY_LEVEL.CRITICAL
11462
11269
  });
11463
11270
  } else {
11464
- console.error(`[OperationTracker] Failed to process operation after retries:`, error);
11271
+ logger10.error("Failed to process operation after retries", {
11272
+ operation: operation.operation,
11273
+ category: operation.category,
11274
+ retryCount,
11275
+ error: error instanceof Error ? error.message : String(error)
11276
+ });
11465
11277
  }
11466
11278
  }
11467
11279
  /**
@@ -11544,6 +11356,7 @@ var trackingQueue = {
11544
11356
  return [];
11545
11357
  }
11546
11358
  };
11359
+ var logger11 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.PUB_SUB, transport: "console" });
11547
11360
  var EVENT_CONSTANTS = {
11548
11361
  /** Minimum event segments for scoped events (namespace:scope:event) */
11549
11362
  MIN_SCOPED_SEGMENTS: 2,
@@ -11649,7 +11462,10 @@ function createEmitMethod(listeners, trackOperation) {
11649
11462
  try {
11650
11463
  callback(data);
11651
11464
  } catch (error) {
11652
- console.error(`Error in event listener for ${event}:`, error);
11465
+ logger11.error("Event listener failed", {
11466
+ event,
11467
+ error: error instanceof Error ? error.message : String(error)
11468
+ });
11653
11469
  }
11654
11470
  });
11655
11471
  listeners.forEach((callbacks, pattern) => {
@@ -11662,7 +11478,11 @@ function createEmitMethod(listeners, trackOperation) {
11662
11478
  const wildcardData = typeof data === "object" && data !== null ? { ...data, originalEvent: event.split(":").pop() } : { data, originalEvent: event.split(":").pop() };
11663
11479
  callback(wildcardData);
11664
11480
  } catch (error) {
11665
- console.error(`Error in wildcard listener for ${event}:`, error);
11481
+ logger11.error("Wildcard listener failed", {
11482
+ event,
11483
+ pattern: prefix,
11484
+ error: error instanceof Error ? error.message : String(error)
11485
+ });
11666
11486
  }
11667
11487
  });
11668
11488
  }
@@ -11674,7 +11494,10 @@ function createEmitMethod(listeners, trackOperation) {
11674
11494
  try {
11675
11495
  callback(data);
11676
11496
  } catch (error) {
11677
- console.error(`Error in global wildcard listener for ${event}:`, error);
11497
+ logger11.error("Global wildcard listener failed", {
11498
+ event,
11499
+ error: error instanceof Error ? error.message : String(error)
11500
+ });
11678
11501
  }
11679
11502
  });
11680
11503
  }
@@ -11839,7 +11662,9 @@ function createEventEmitter() {
11839
11662
  result = handlerResult;
11840
11663
  }
11841
11664
  } catch (error) {
11842
- console.warn("Handler in chain failed:", error);
11665
+ logger11.warn("Handler in chain failed", {
11666
+ error: error instanceof Error ? error.message : String(error)
11667
+ });
11843
11668
  }
11844
11669
  }
11845
11670
  return result;
@@ -11909,847 +11734,228 @@ var EventHelpers = {
11909
11734
  return namespace ? [`${namespace}:*`] : [];
11910
11735
  }, "getMatchingWildcards")
11911
11736
  };
11737
+ var API_ERROR_NAMESPACE = "api";
11738
+ var DEFAULT_TIMEOUT_MS2 = 3e4;
11912
11739
  var DEFAULT_SERVER_ERROR_STATUS2 = 500;
11913
- var DEFAULT_CLIENT_ERROR_STATUS = 400;
11914
- function getErrorEventType(errorEvent) {
11915
- return errorEvent.replace(/^errors:/, "");
11916
- }
11917
- __name(getErrorEventType, "getErrorEventType");
11918
- var ANY_ERROR_HANDLER = "onAnyError";
11919
- function mapHandlerNameToEventName(handlerName) {
11920
- if (handlerName === ANY_ERROR_HANDLER) {
11921
- return "*";
11740
+ var SCOPE_MAP = {
11741
+ GLOBAL: "global",
11742
+ CONFIG: "config",
11743
+ CLIENT: "client",
11744
+ REQUEST: "request",
11745
+ TEMPORARY: "temporary"
11746
+ };
11747
+ function convertToApiEventScope(scope) {
11748
+ const mapped = SCOPE_MAP[scope];
11749
+ if (!mapped) {
11750
+ throw new Error(`Invalid EventScope: ${scope}`);
11922
11751
  }
11923
- return handlerName.replace(/^on/, "").replace(/Error$/, "").replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
11924
- }
11925
- __name(mapHandlerNameToEventName, "mapHandlerNameToEventName");
11926
- function registerScopedHandlers(scope, handlers, options = {}) {
11927
- Object.entries(handlers).forEach(([handlerName, handler]) => {
11928
- if (handler) {
11929
- const eventName = mapHandlerNameToEventName(handlerName);
11930
- const wrappedHandler = /* @__PURE__ */ __name((event) => {
11931
- const error = event?.data?.error ?? event;
11932
- try {
11933
- handler(error);
11934
- } catch (err) {
11935
- console.error("Error in error handler:", err);
11936
- }
11937
- }, "wrappedHandler");
11938
- eventManager.errors.addScopedHandler(api.HANDLER_SCOPES[scope], eventName, wrappedHandler, {
11939
- ...options,
11940
- originalHandler: handler
11941
- });
11942
- }
11943
- });
11752
+ return mapped;
11944
11753
  }
11945
- __name(registerScopedHandlers, "registerScopedHandlers");
11946
- function retrieveScopedHandlers(scope) {
11947
- const scopeKey = api.HANDLER_SCOPES[scope];
11948
- const originalHandlersMap = eventManager.errors.getOriginalScopedHandlers(scopeKey);
11949
- const result = {};
11950
- originalHandlersMap.forEach((handlers, eventName) => {
11951
- let handlerName;
11952
- if (eventName === "*") {
11953
- handlerName = "onAnyError";
11754
+ __name(convertToApiEventScope, "convertToApiEventScope");
11755
+ var ApiPackageError = class extends errors$1.ApiPackageError {
11756
+ static {
11757
+ __name(this, "ApiPackageError");
11758
+ }
11759
+ };
11760
+ var apiErrorEventFactory = {
11761
+ addScopedHandler(scope, eventName, handler, options) {
11762
+ const eventScope = convertToApiEventScope(scope);
11763
+ eventManager.errors.addScopedHandler(eventScope, eventName, handler, options);
11764
+ },
11765
+ removeScopedHandler(scope, eventName, handler) {
11766
+ const apiScope = convertToApiEventScope(scope);
11767
+ if (!handler) {
11768
+ eventManager.errors.removeAllScopedListeners(apiScope, eventName);
11954
11769
  } else {
11955
- const camelCase = eventName.replace(/-(.)/g, (_, c) => c.toUpperCase());
11956
- handlerName = `on${camelCase.charAt(0).toUpperCase() + camelCase.slice(1)}Error`;
11770
+ eventManager.errors.removeScopedHandler(apiScope, eventName, handler);
11957
11771
  }
11958
- if (handlers.length > 0) {
11959
- const key = handlerName;
11960
- result[key] = handlers[0];
11772
+ },
11773
+ getOriginalScopedHandlers(scope) {
11774
+ const eventScope = convertToApiEventScope(scope);
11775
+ return eventManager.errors.getOriginalScopedHandlers(eventScope);
11776
+ },
11777
+ emit(eventName, data, options) {
11778
+ if (options?.scopes && options.scopes.length > 0) {
11779
+ options.scopes.forEach((scope) => {
11780
+ const apiScope = convertToApiEventScope(scope);
11781
+ const scopedEventKey = `${apiScope}:errors:${eventName}`;
11782
+ eventManager.errors.emit(scopedEventKey, data);
11783
+ });
11784
+ } else {
11785
+ eventManager.errors.emit(eventName, data);
11961
11786
  }
11787
+ }
11788
+ };
11789
+ var isApiNamespaceRegistered = false;
11790
+ function ensureApiNamespaceRegistered() {
11791
+ if (isApiNamespaceRegistered) {
11792
+ return;
11793
+ }
11794
+ errors$1.registerEventFactory(API_ERROR_NAMESPACE, apiErrorEventFactory);
11795
+ errors$1.ApiPackageError.configure({
11796
+ namespace: API_ERROR_NAMESPACE,
11797
+ eventFactory: apiErrorEventFactory
11962
11798
  });
11963
- return result;
11799
+ isApiNamespaceRegistered = true;
11964
11800
  }
11965
- __name(retrieveScopedHandlers, "retrieveScopedHandlers");
11801
+ __name(ensureApiNamespaceRegistered, "ensureApiNamespaceRegistered");
11802
+ ensureApiNamespaceRegistered();
11966
11803
  function registerErrorHandler(eventType, handler, options = {}) {
11967
- const { scope = "GLOBAL", strategy = "merge" } = options;
11968
- const type = typeof eventType === "string" && eventType.startsWith("errors:") ? getErrorEventType(eventType) : eventType;
11969
- const wrappedHandler = /* @__PURE__ */ __name((event) => {
11970
- const error = event?.data?.error ?? event;
11971
- try {
11972
- handler(error);
11973
- } catch (err) {
11974
- console.error("Error in error handler:", err);
11975
- }
11976
- }, "wrappedHandler");
11977
- return eventManager.errors.addScopedHandler(
11978
- api.HANDLER_SCOPES[scope],
11979
- type,
11980
- wrappedHandler,
11981
- { strategy, originalHandler: handler }
11982
- );
11804
+ return errors$1.registerErrorHandler(API_ERROR_NAMESPACE, eventType, handler, {
11805
+ ...options,
11806
+ eventFactory: apiErrorEventFactory
11807
+ });
11983
11808
  }
11984
11809
  __name(registerErrorHandler, "registerErrorHandler");
11810
+ function registerErrorHandlers(handlers, options = {}) {
11811
+ const { scope = "GLOBAL", ...rest } = options;
11812
+ errors$1.registerScopedHandlers(API_ERROR_NAMESPACE, scope, handlers, {
11813
+ ...rest,
11814
+ eventFactory: apiErrorEventFactory
11815
+ });
11816
+ }
11817
+ __name(registerErrorHandlers, "registerErrorHandlers");
11985
11818
  function setErrorHandlers(handlers, scope = "GLOBAL") {
11986
- registerScopedHandlers(scope, handlers);
11819
+ errors$1.setErrorHandlers(API_ERROR_NAMESPACE, handlers, scope, apiErrorEventFactory);
11987
11820
  }
11988
11821
  __name(setErrorHandlers, "setErrorHandlers");
11989
11822
  function getErrorHandlers(scope = "GLOBAL") {
11990
- return retrieveScopedHandlers(scope);
11823
+ return errors$1.getErrorHandlers(API_ERROR_NAMESPACE, scope, apiErrorEventFactory);
11991
11824
  }
11992
11825
  __name(getErrorHandlers, "getErrorHandlers");
11993
- function registerErrorHandlers(handlers, options = {}) {
11994
- const { scope = "GLOBAL", strategy = "merge" } = options;
11995
- registerScopedHandlers(scope, handlers, { strategy });
11996
- }
11997
- __name(registerErrorHandlers, "registerErrorHandlers");
11998
11826
  function unregisterErrorHandlers(eventTypes, options = {}) {
11999
11827
  const { scope = "GLOBAL" } = options;
12000
- const scopeKey = api.HANDLER_SCOPES[scope];
12001
- if (!eventTypes) {
12002
- eventManager.errors.clearScopedHandlers(scopeKey);
12003
- } else {
12004
- eventTypes.forEach((eventType) => {
12005
- const type = typeof eventType === "string" && eventType.startsWith("errors:") ? getErrorEventType(eventType) : eventType;
12006
- eventManager.errors.removeAllScopedListeners(scopeKey, type);
12007
- });
12008
- }
11828
+ errors$1.unregisterScopedHandlers(API_ERROR_NAMESPACE, scope, eventTypes, apiErrorEventFactory);
12009
11829
  }
12010
11830
  __name(unregisterErrorHandlers, "unregisterErrorHandlers");
12011
11831
  function clearErrorHandlers(options = {}) {
12012
- const { scopes = ["GLOBAL"] } = options;
12013
- scopes.forEach((scope) => {
12014
- const scopeKey = api.HANDLER_SCOPES[scope];
12015
- eventManager.errors.clearScopedHandlers(scopeKey);
11832
+ errors$1.clearErrorHandlers(API_ERROR_NAMESPACE, {
11833
+ ...options,
11834
+ eventFactory: apiErrorEventFactory
12016
11835
  });
12017
11836
  }
12018
11837
  __name(clearErrorHandlers, "clearErrorHandlers");
12019
11838
  function onceErrorHandler(eventType, handler, options = {}) {
12020
- const { scope = "GLOBAL" } = options;
12021
- const type = typeof eventType === "string" && eventType.startsWith("errors:") ? getErrorEventType(eventType) : eventType;
12022
- eventManager.errors.onceScoped(api.HANDLER_SCOPES[scope], type, (event) => {
12023
- const eventData = event;
12024
- const error = eventData?.data?.error ?? event;
12025
- handler(error);
11839
+ errors$1.registerOnceErrorHandler(API_ERROR_NAMESPACE, eventType, handler, {
11840
+ ...options,
11841
+ eventFactory: apiErrorEventFactory
12026
11842
  });
12027
11843
  }
12028
11844
  __name(onceErrorHandler, "onceErrorHandler");
12029
- var ERROR_EMITTERS = {
12030
- network: /* @__PURE__ */ __name((error) => {
12031
- eventManager.errors.emitNetworkError({
12032
- error,
12033
- url: error.context?.url,
12034
- method: error.context?.method,
12035
- status: error.statusCode,
12036
- retryable: error.context?.retryable
12037
- });
12038
- }, "network"),
12039
- validation: /* @__PURE__ */ __name((error) => {
12040
- eventManager.errors.emitValidationError({
12041
- error,
12042
- field: error.context?.field,
12043
- value: error.context?.value,
12044
- constraints: error.context?.constraints
12045
- });
12046
- }, "validation"),
12047
- authentication: /* @__PURE__ */ __name((error) => {
12048
- eventManager.errors.emitAuthenticationError(
12049
- error,
12050
- error.context?.realm,
12051
- error.context?.scheme
12052
- );
12053
- }, "authentication"),
12054
- rateLimit: /* @__PURE__ */ __name((error) => {
12055
- eventManager.errors.emitRateLimitError({
12056
- error,
12057
- limit: error.context?.limit,
12058
- remaining: error.context?.remaining,
12059
- resetAt: error.context?.resetAt,
12060
- retryAfter: error.context?.retryAfter
12061
- });
12062
- }, "rateLimit"),
12063
- server: /* @__PURE__ */ __name((error) => {
12064
- eventManager.errors.emitServerError({
12065
- error,
12066
- statusCode: error.statusCode ?? DEFAULT_SERVER_ERROR_STATUS2,
12067
- serverMessage: error.context?.serverMessage,
12068
- traceId: error.context?.traceId
12069
- });
12070
- }, "server"),
12071
- timeout: /* @__PURE__ */ __name((error) => {
12072
- eventManager.errors.emitTimeoutError({
12073
- error,
12074
- timeout: error.context?.timeoutMs || error.context?.timeout || 0,
12075
- operation: error.context?.operation,
12076
- url: error.context?.url
12077
- });
12078
- }, "timeout"),
12079
- authorization: /* @__PURE__ */ __name((error) => {
12080
- eventManager.errors.emitAuthorizationError({
12081
- error,
12082
- url: error.context?.url,
12083
- method: error.context?.method,
12084
- resource: void 0,
12085
- permission: void 0
12086
- });
12087
- }, "authorization"),
12088
- notFound: /* @__PURE__ */ __name((error) => {
12089
- eventManager.errors.emitNotFoundError(error, error.context?.url, void 0);
12090
- }, "notFound"),
12091
- conflict: /* @__PURE__ */ __name((error) => {
12092
- eventManager.errors.emitConflictError({
12093
- error,
12094
- conflictingResource: void 0,
12095
- currentValue: void 0,
12096
- attemptedValue: void 0
12097
- });
12098
- }, "conflict"),
12099
- client: /* @__PURE__ */ __name((error) => {
12100
- eventManager.errors.emitClientError({
12101
- error,
12102
- status: error.statusCode ?? DEFAULT_CLIENT_ERROR_STATUS,
12103
- url: error.context?.url,
12104
- method: error.context?.method
12105
- });
12106
- }, "client"),
12107
- externalService: /* @__PURE__ */ __name((error) => {
12108
- eventManager.errors.emitExternalServiceError({
12109
- error,
12110
- service: void 0,
12111
- endpoint: error.context?.url,
12112
- timeout: error.context?.timeout
12113
- });
12114
- }, "externalService"),
12115
- cache: /* @__PURE__ */ __name((error) => {
12116
- eventManager.errors.emitCacheError(
12117
- error,
12118
- error.context?.operation,
12119
- error.context && "cacheKey" in error.context ? error.context.cacheKey : "unknown"
12120
- );
12121
- }, "cache"),
12122
- headers: /* @__PURE__ */ __name((error) => {
12123
- eventManager.errors.emitHeadersError(error, void 0, error.context?.operation);
12124
- }, "headers"),
12125
- retry: /* @__PURE__ */ __name((error) => {
12126
- eventManager.errors.emitRetryError({
12127
- error,
12128
- attempts: void 0,
12129
- maxAttempts: void 0,
12130
- lastError: error.context?.originalError
12131
- });
12132
- }, "retry")
12133
- };
12134
- function getCategoryKey(category) {
12135
- if (!category) {
12136
- return "unknown";
12137
- }
12138
- return api.ERROR_CATEGORY_TO_EMITTER_KEY[category] || category.toLowerCase();
12139
- }
12140
- __name(getCategoryKey, "getCategoryKey");
12141
- async function emitErrorEvent(error) {
12142
- const categoryKey = getCategoryKey(error.category);
12143
- const emitter = ERROR_EMITTERS[categoryKey];
12144
- if (emitter) {
12145
- emitter(error);
12146
- } else {
12147
- eventManager.errors.emitGenericError(error);
12148
- }
12149
- }
12150
- __name(emitErrorEvent, "emitErrorEvent");
12151
-
12152
- // src/api/utils/generation/id-generator.ts
12153
- var ID_CONSTANTS = {
12154
- RANDOM_START_INDEX: 2,
12155
- DEFAULT_RANDOM_LENGTH: 8,
12156
- MAX_PREFIX_LENGTH: 10,
12157
- DEFAULT_RADIX: 36,
12158
- TWO_PARTS: 2
12159
- };
12160
- var DEFAULT_OPTIONS = {
12161
- prefix: "",
12162
- suffix: "",
12163
- useTimestamp: false,
12164
- separator: "_",
12165
- includeRandom: true,
12166
- radix: ID_CONSTANTS.DEFAULT_RADIX,
12167
- randomLength: ID_CONSTANTS.DEFAULT_RANDOM_LENGTH
12168
- };
12169
- function generateBaseId(options = {}) {
12170
- const opts = { ...DEFAULT_OPTIONS, ...options };
12171
- const components = [];
12172
- if (opts.prefix) {
12173
- components.push(opts.prefix);
12174
- }
12175
- if (opts.useTimestamp) {
12176
- const timestamp = Date.now().toString(opts.radix);
12177
- components.push(timestamp);
12178
- if (opts.includeRandom) {
12179
- const random = Math.random().toString(opts.radix).slice(
12180
- ID_CONSTANTS.RANDOM_START_INDEX,
12181
- ID_CONSTANTS.RANDOM_START_INDEX + opts.randomLength
12182
- );
12183
- components.push(random);
12184
- }
12185
- } else {
12186
- components.push(generateUUID());
12187
- }
12188
- if (opts.suffix) {
12189
- components.push(opts.suffix);
12190
- }
12191
- return components.join(opts.separator);
12192
- }
12193
- __name(generateBaseId, "generateBaseId");
12194
- function generateContextualId(context, options = {}) {
12195
- const baseId = generateBaseId(options);
12196
- const contextParts = [];
12197
- for (const [, value] of Object.entries(context)) {
12198
- if (value !== void 0) {
12199
- contextParts.push(String(value));
12200
- }
12201
- }
12202
- if (contextParts.length > 0) {
12203
- return `${contextParts.join(":")}:${baseId}`;
12204
- }
12205
- return baseId;
12206
- }
12207
- __name(generateContextualId, "generateContextualId");
12208
- function extractFromLastSeparator(id, separator) {
12209
- const lastIndex = id.lastIndexOf(separator);
12210
- return lastIndex !== -1 ? id.substring(lastIndex + 1) : null;
12211
- }
12212
- __name(extractFromLastSeparator, "extractFromLastSeparator");
12213
- function extractFromFirstSeparator(id, separator) {
12214
- const firstIndex = id.indexOf(separator);
12215
- return firstIndex !== -1 ? id.substring(0, firstIndex) : null;
12216
- }
12217
- __name(extractFromFirstSeparator, "extractFromFirstSeparator");
12218
- function extractAfterPrefix(id, separator) {
12219
- const firstIndex = id.indexOf(separator);
12220
- if (firstIndex === -1 || separator !== "_") {
12221
- return null;
12222
- }
12223
- const prefix = id.substring(0, firstIndex);
12224
- const isShortAlphabeticPrefix = prefix.length <= ID_CONSTANTS.MAX_PREFIX_LENGTH && /^[a-z]+$/i.test(prefix);
12225
- return isShortAlphabeticPrefix ? id.substring(firstIndex + 1) : null;
12226
- }
12227
- __name(extractAfterPrefix, "extractAfterPrefix");
12228
- function extractWithUnderscoreSeparator(id, separator) {
12229
- const afterPrefix = extractAfterPrefix(id, separator);
12230
- if (afterPrefix) {
12231
- return afterPrefix;
12232
- }
12233
- return extractFromLastSeparator(id, separator);
11845
+ function emitNetworkErrorEvent(error, context) {
11846
+ eventManager.errors.emitNetworkError({
11847
+ error,
11848
+ url: context?.url,
11849
+ method: context?.method,
11850
+ status: error.statusCode,
11851
+ retryable: error.retryable
11852
+ });
12234
11853
  }
12235
- __name(extractWithUnderscoreSeparator, "extractWithUnderscoreSeparator");
12236
- function extractBySeparatorType(id, separator) {
12237
- if (separator === ":") {
12238
- return extractFromLastSeparator(id, separator);
12239
- }
12240
- return extractWithUnderscoreSeparator(id, separator);
11854
+ __name(emitNetworkErrorEvent, "emitNetworkErrorEvent");
11855
+ function emitTimeoutErrorEvent(error, context) {
11856
+ eventManager.errors.emitTimeoutError({
11857
+ error,
11858
+ timeout: context?.timeout ?? context?.timeoutMs ?? DEFAULT_TIMEOUT_MS2,
11859
+ url: context?.url,
11860
+ operation: context?.operation
11861
+ });
12241
11862
  }
12242
- __name(extractBySeparatorType, "extractBySeparatorType");
12243
- function extractBaseId(id, options = {}) {
12244
- const { separator = ":", extractLast = true } = options;
12245
- if (!extractLast) {
12246
- return extractFromFirstSeparator(id, separator) ?? id;
12247
- }
12248
- return extractBySeparatorType(id, separator) ?? id;
11863
+ __name(emitTimeoutErrorEvent, "emitTimeoutErrorEvent");
11864
+ function emitServerErrorEvent(error, context) {
11865
+ eventManager.errors.emitServerError({
11866
+ error,
11867
+ statusCode: error.statusCode ?? DEFAULT_SERVER_ERROR_STATUS2,
11868
+ serverMessage: context?.serverMessage,
11869
+ traceId: context?.traceId
11870
+ });
12249
11871
  }
12250
- __name(extractBaseId, "extractBaseId");
12251
- function isUuidPattern(id) {
12252
- const uuidRegex = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
12253
- return uuidRegex.test(id);
11872
+ __name(emitServerErrorEvent, "emitServerErrorEvent");
11873
+ function emitAuthorizationErrorEvent(error, context) {
11874
+ eventManager.errors.emitAuthorizationError({
11875
+ error,
11876
+ url: context?.url,
11877
+ method: context?.method,
11878
+ resource: context?.resource,
11879
+ permission: context?.permission
11880
+ });
12254
11881
  }
12255
- __name(isUuidPattern, "isUuidPattern");
12256
- function isTimestampPattern(id) {
12257
- const timestampRegex = /^[a-z]+_[0-9a-z]+_[0-9a-z]+$/i;
12258
- return timestampRegex.test(id);
11882
+ __name(emitAuthorizationErrorEvent, "emitAuthorizationErrorEvent");
11883
+ function emitRateLimitErrorEvent(error, context) {
11884
+ eventManager.errors.emitRateLimitError({
11885
+ error,
11886
+ limit: context?.limit,
11887
+ remaining: context?.remaining,
11888
+ resetAt: context?.resetAt,
11889
+ retryAfter: context?.retryAfter
11890
+ });
12259
11891
  }
12260
- __name(isTimestampPattern, "isTimestampPattern");
12261
- function isPrefixedPattern(id) {
12262
- const prefixedRegex = /^[a-z]+_[0-9a-z-]+$/i;
12263
- return prefixedRegex.test(id);
11892
+ __name(emitRateLimitErrorEvent, "emitRateLimitErrorEvent");
11893
+ function emitValidationErrorEvent(error) {
11894
+ eventManager.errors.emitValidationError({
11895
+ error,
11896
+ field: void 0,
11897
+ value: void 0,
11898
+ constraints: void 0
11899
+ });
12264
11900
  }
12265
- __name(isPrefixedPattern, "isPrefixedPattern");
12266
- function isValidFallbackPattern(id) {
12267
- const fallbackRegex = /^[0-9a-z][\w-]*$/i;
12268
- if (!fallbackRegex.test(id)) {
12269
- return false;
12270
- }
12271
- const rejectList = ["invalid", "invalid-uuid"];
12272
- return !rejectList.includes(id);
11901
+ __name(emitValidationErrorEvent, "emitValidationErrorEvent");
11902
+ function emitAuthenticationErrorEvent(error, context) {
11903
+ eventManager.errors.emitAuthenticationError(
11904
+ error,
11905
+ context?.realm,
11906
+ context?.scheme
11907
+ );
12273
11908
  }
12274
- __name(isValidFallbackPattern, "isValidFallbackPattern");
12275
- function checkPatterns(id, patterns) {
12276
- for (const { check, allowed } of patterns) {
12277
- if (check(id)) {
12278
- return allowed;
12279
- }
11909
+ __name(emitAuthenticationErrorEvent, "emitAuthenticationErrorEvent");
11910
+ function emitNotFoundErrorEvent(error, context) {
11911
+ eventManager.errors.emitNotFoundError(error, context?.url);
11912
+ }
11913
+ __name(emitNotFoundErrorEvent, "emitNotFoundErrorEvent");
11914
+ var ERROR_CATEGORY_HANDLERS = {
11915
+ network: emitNetworkErrorEvent,
11916
+ validation: emitValidationErrorEvent,
11917
+ authentication: emitAuthenticationErrorEvent,
11918
+ authorization: emitAuthorizationErrorEvent,
11919
+ "rate.limit": emitRateLimitErrorEvent,
11920
+ timeout: emitTimeoutErrorEvent,
11921
+ "not.found": emitNotFoundErrorEvent,
11922
+ server: emitServerErrorEvent
11923
+ };
11924
+ function emitErrorEvent(error) {
11925
+ const context = error.context;
11926
+ const category = error.category?.toLowerCase();
11927
+ const handler = category ? ERROR_CATEGORY_HANDLERS[category] : void 0;
11928
+ if (handler) {
11929
+ handler(error, context);
11930
+ } else {
11931
+ eventManager.errors.emitGenericError(error);
12280
11932
  }
12281
- return null;
12282
11933
  }
12283
- __name(checkPatterns, "checkPatterns");
12284
- function isAnyPatternAllowed(options) {
12285
- return !!(options.allowUuid ?? options.allowTimestamp ?? options.allowPrefix);
12286
- }
12287
- __name(isAnyPatternAllowed, "isAnyPatternAllowed");
12288
- function checkIdPatterns(id, options) {
12289
- const patterns = [
12290
- { check: isUuidPattern, allowed: options.allowUuid },
12291
- { check: isTimestampPattern, allowed: options.allowTimestamp },
12292
- { check: isPrefixedPattern, allowed: options.allowPrefix }
12293
- ];
12294
- return checkPatterns(id, patterns);
12295
- }
12296
- __name(checkIdPatterns, "checkIdPatterns");
12297
- function validateIdWithPatterns(id, options) {
12298
- const patternResult = checkIdPatterns(id, options);
12299
- if (patternResult !== null) {
12300
- return patternResult;
12301
- }
12302
- return isAnyPatternAllowed(options) && isValidFallbackPattern(id);
11934
+ __name(emitErrorEvent, "emitErrorEvent");
11935
+
11936
+ // src/api/polling/utils.ts
11937
+ function isPollingActive(config) {
11938
+ return (config.interval ?? 0) > 0;
12303
11939
  }
12304
- __name(validateIdWithPatterns, "validateIdWithPatterns");
12305
- function isValidId(id, options = {}) {
12306
- const { allowUuid = true, allowTimestamp = true, allowPrefix = true, minLength = 5 } = options;
12307
- if (id.length < minLength) {
12308
- return false;
11940
+ __name(isPollingActive, "isPollingActive");
11941
+ function calculatePollingDuration(config) {
11942
+ if (!config.interval || !config.maxAttempts || config.maxAttempts <= 0) {
11943
+ return null;
12309
11944
  }
12310
- return validateIdWithPatterns(id, { allowUuid, allowTimestamp, allowPrefix });
11945
+ const intervals = config.interval * config.maxAttempts;
11946
+ const delays = (config.delay ?? 0) * config.maxAttempts;
11947
+ return intervals + delays;
12311
11948
  }
12312
- __name(isValidId, "isValidId");
12313
- function parseId(id, options = {}) {
12314
- const { separator = "_" } = options;
12315
- if (id.includes(":")) {
12316
- const lastColonIndex = id.lastIndexOf(":");
11949
+ __name(calculatePollingDuration, "calculatePollingDuration");
11950
+ function getSSRSafePollingConfig(config) {
11951
+ if (!isBrowser()) {
12317
11952
  return {
12318
- context: id.substring(0, lastColonIndex),
12319
- core: id.substring(lastColonIndex + 1),
12320
- full: id
11953
+ ...config,
11954
+ interval: 0,
11955
+ maxAttempts: 1
12321
11956
  };
12322
11957
  }
12323
- const parts = id.split(separator);
12324
- if (parts.length === 1) {
12325
- return { core: id, full: id };
12326
- }
12327
- if (parts.length === ID_CONSTANTS.TWO_PARTS) {
12328
- if (parts[0].length <= ID_CONSTANTS.MAX_PREFIX_LENGTH && /^[a-z]+$/i.test(parts[0])) {
12329
- return { prefix: parts[0], core: parts[1], full: id };
12330
- }
12331
- return { core: parts[0], suffix: parts[1], full: id };
12332
- }
12333
- return {
12334
- prefix: parts[0],
12335
- core: parts.slice(1, -1).join(separator),
12336
- suffix: parts[parts.length - 1],
12337
- full: id
12338
- };
12339
- }
12340
- __name(parseId, "parseId");
12341
- function createIdGenerator(defaultOptions = {}) {
12342
- return (options) => {
12343
- return generateBaseId({ ...defaultOptions, ...options });
12344
- };
12345
- }
12346
- __name(createIdGenerator, "createIdGenerator");
12347
- var correlationGenerators = /* @__PURE__ */ new Map();
12348
- function getCorrelationGenerator(type) {
12349
- if (!correlationGenerators.has(type)) {
12350
- correlationGenerators.set(
12351
- type,
12352
- createIdGenerator({
12353
- prefix: type,
12354
- useTimestamp: true,
12355
- includeRandom: true,
12356
- radix: 36,
12357
- randomLength: 8
12358
- })
12359
- );
12360
- }
12361
- return correlationGenerators.get(type);
12362
- }
12363
- __name(getCorrelationGenerator, "getCorrelationGenerator");
12364
- function generateCorrelationId(type = api.CORRELATION_TYPE.GENERIC, options) {
12365
- const generator = getCorrelationGenerator(type);
12366
- return generator(options);
12367
- }
12368
- __name(generateCorrelationId, "generateCorrelationId");
12369
- function generateContextualCorrelationId(context, type = api.CORRELATION_TYPE.GENERIC, options) {
12370
- return generateContextualId(context, {
12371
- prefix: type,
12372
- useTimestamp: true,
12373
- includeRandom: true,
12374
- radix: 36,
12375
- randomLength: 8,
12376
- ...options
12377
- });
12378
- }
12379
- __name(generateContextualCorrelationId, "generateContextualCorrelationId");
12380
- function generateNetworkCorrelationId(options) {
12381
- return generateCorrelationId(api.CORRELATION_TYPE.NETWORK, options);
12382
- }
12383
- __name(generateNetworkCorrelationId, "generateNetworkCorrelationId");
12384
- function generateApiCorrelationId(options) {
12385
- return generateCorrelationId(api.CORRELATION_TYPE.API, options);
12386
- }
12387
- __name(generateApiCorrelationId, "generateApiCorrelationId");
12388
- function generateSessionCorrelationId(options) {
12389
- return generateCorrelationId(api.CORRELATION_TYPE.SESSION, options);
12390
- }
12391
- __name(generateSessionCorrelationId, "generateSessionCorrelationId");
12392
- function generateTraceCorrelationId(options) {
12393
- return generateCorrelationId(api.CORRELATION_TYPE.TRACE, options);
12394
- }
12395
- __name(generateTraceCorrelationId, "generateTraceCorrelationId");
12396
- function extractBaseCorrelationId(contextualId) {
12397
- let id = extractBaseId(contextualId, { separator: ":", extractLast: true });
12398
- const prefixes = Object.values(api.CORRELATION_TYPE);
12399
- for (const prefix of prefixes) {
12400
- if (id.startsWith(`${prefix}_`)) {
12401
- id = id.substring(prefix.length + 1);
12402
- break;
12403
- }
12404
- }
12405
- return id;
12406
- }
12407
- __name(extractBaseCorrelationId, "extractBaseCorrelationId");
12408
- function extractCorrelationType(id) {
12409
- let idToCheck = id;
12410
- if (id.includes(":")) {
12411
- const parts = id.split(":");
12412
- idToCheck = parts[parts.length - 1];
12413
- }
12414
- const parsed = parseId(idToCheck, { separator: "_" });
12415
- if (parsed.prefix) {
12416
- const types = Object.values(api.CORRELATION_TYPE);
12417
- if (types.includes(parsed.prefix)) {
12418
- return parsed.prefix;
12419
- }
12420
- }
12421
- return void 0;
12422
- }
12423
- __name(extractCorrelationType, "extractCorrelationType");
12424
- function isValidCorrelationId(id) {
12425
- let idToValidate = id;
12426
- if (id.includes(":")) {
12427
- const parts = id.split(":");
12428
- idToValidate = parts[parts.length - 1];
12429
- }
12430
- return isValidId(idToValidate, {
12431
- allowUuid: true,
12432
- allowTimestamp: true,
12433
- allowPrefix: true,
12434
- minLength: 5
12435
- });
12436
- }
12437
- __name(isValidCorrelationId, "isValidCorrelationId");
12438
- function createCorrelationIdGenerator(type = api.CORRELATION_TYPE.GENERIC, defaultOptions = {}) {
12439
- return createIdGenerator({
12440
- prefix: type,
12441
- useTimestamp: true,
12442
- includeRandom: true,
12443
- radix: 36,
12444
- randomLength: 8,
12445
- ...defaultOptions
12446
- });
12447
- }
12448
- __name(createCorrelationIdGenerator, "createCorrelationIdGenerator");
12449
- function linkCorrelationIds(...ids) {
12450
- return ids.join("->");
12451
- }
12452
- __name(linkCorrelationIds, "linkCorrelationIds");
12453
- function extractLinkedCorrelationIds(linkedId) {
12454
- return linkedId.split("->");
12455
- }
12456
- __name(extractLinkedCorrelationIds, "extractLinkedCorrelationIds");
12457
-
12458
- // src/api/errors/ApiPackageError.ts
12459
- var ApiPackageError = class _ApiPackageError extends Error {
12460
- static {
12461
- __name(this, "ApiPackageError");
12462
- }
12463
- statusCode;
12464
- errorCode;
12465
- message;
12466
- errors;
12467
- correlationId;
12468
- timestamp;
12469
- // Additional properties beyond ErrorResponse
12470
- responseError;
12471
- category;
12472
- cause;
12473
- context;
12474
- // Store the original request/response data from fetchff (not Web API types)
12475
- requestConfig;
12476
- responseData;
12477
- details;
12478
- originalError;
12479
- metadata;
12480
- /**
12481
- * Getter for code property (alias for errorCode)
12482
- * Provides compatibility with standard error patterns
12483
- */
12484
- get code() {
12485
- return this.errorCode;
12486
- }
12487
- constructor(message, statusCode, errorCode = api.API_ERROR_CODES.UNKNOWN_ERROR, options) {
12488
- super(message);
12489
- this.name = "ApiPackageError";
12490
- this.message = message;
12491
- this.errorCode = errorCode;
12492
- this.timestamp = (/* @__PURE__ */ new Date()).toISOString();
12493
- this.statusCode = this.resolveStatusCode(statusCode, errorCode);
12494
- if (options) {
12495
- this.errors = options.errors;
12496
- this.correlationId = options.correlationId ?? generateApiCorrelationId();
12497
- this.responseError = options.responseError;
12498
- this.cause = options.cause;
12499
- this.context = options.context;
12500
- this.details = options.errors;
12501
- this.originalError = options.cause;
12502
- if (options.responseError) {
12503
- this.requestConfig = options.responseError.request;
12504
- this.responseData = options.responseError.response;
12505
- }
12506
- } else {
12507
- this.correlationId = generateApiCorrelationId();
12508
- }
12509
- this.category = this.categorizeError();
12510
- Object.setPrototypeOf(this, _ApiPackageError.prototype);
12511
- this.emitEvent();
12512
- }
12513
- /**
12514
- * Resolves the status code from the provided value or error definitions
12515
- */
12516
- resolveStatusCode(statusCode, errorCode) {
12517
- if (statusCode !== void 0) {
12518
- return statusCode;
12519
- }
12520
- const definition = api.ERROR_DEFINITIONS[errorCode];
12521
- if (definition?.status !== void 0) {
12522
- return definition.status;
12523
- }
12524
- return config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
12525
- }
12526
- /**
12527
- * Emit error event for this error
12528
- * Can be called with a specific client context or uses global handlers
12529
- */
12530
- emitEvent() {
12531
- void Promise.resolve().then(() => emitErrorEvent(this)).catch(() => {
12532
- });
12533
- }
12534
- /**
12535
- * Creates an ApiPackageError from a fetchff ResponseError
12536
- */
12537
- static fromResponseError(responseError, config$1, clientContext) {
12538
- const statusCode = responseError.status ?? config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
12539
- const message = responseError.message ?? "An error occurred";
12540
- const code = this.determineErrorCode(responseError);
12541
- return new _ApiPackageError(message, statusCode, code, {
12542
- responseError,
12543
- cause: responseError,
12544
- clientContext,
12545
- context: {
12546
- url: config$1?.url ?? "",
12547
- method: config$1?.method ?? "GET"
12548
- }
12549
- });
12550
- }
12551
- /**
12552
- * Creates an ApiPackageError from a standard Error
12553
- */
12554
- static fromError(error, statusCode, errorCode = api.API_ERROR_CODES.UNKNOWN_ERROR, context) {
12555
- if (error instanceof _ApiPackageError) {
12556
- return error;
12557
- }
12558
- const { code, status } = this.classifyError(error, errorCode, statusCode);
12559
- return new _ApiPackageError(error.message, status, code, {
12560
- cause: error,
12561
- clientContext: context
12562
- });
12563
- }
12564
- /**
12565
- * Classifies an error and returns appropriate code and status
12566
- */
12567
- static classifyError(error, defaultCode, defaultStatus) {
12568
- if (error.name === "NetworkError" || error.message.includes("network")) {
12569
- return { code: api.API_ERROR_CODES.NETWORK_ERROR, status: 0 };
12570
- }
12571
- if (error.name === "TimeoutError" || error.message.includes("timeout")) {
12572
- return { code: api.API_ERROR_CODES.REQUEST_TIMEOUT, status: config.HTTP_STATUS.REQUEST_TIMEOUT };
12573
- }
12574
- if (error.name === "AbortError") {
12575
- return { code: api.API_ERROR_CODES.REQUEST_ABORTED, status: 0 };
12576
- }
12577
- return { code: defaultCode, status: defaultStatus };
12578
- }
12579
- /**
12580
- * Determines appropriate error code from ResponseError by looking up status in ERROR_DEFINITIONS
12581
- */
12582
- static determineErrorCode(error) {
12583
- if ("isCancelled" in error && error.isCancelled) {
12584
- return api.API_ERROR_CODES.CLIENT_CANCELLED;
12585
- }
12586
- const status = error.status ?? 0;
12587
- const errorCode = getErrorCodeByStatus(status);
12588
- if (errorCode) {
12589
- return errorCode;
12590
- }
12591
- return this.getGenericErrorCode(status);
12592
- }
12593
- /**
12594
- * Gets a generic error code based on HTTP status range
12595
- */
12596
- static getGenericErrorCode(status) {
12597
- if (status === 0) {
12598
- return api.API_ERROR_CODES.NETWORK_ERROR;
12599
- }
12600
- if (status >= config.HTTP_STATUS.BAD_REQUEST && status < config.HTTP_STATUS.INTERNAL_SERVER_ERROR) {
12601
- return api.API_ERROR_CODES.CLIENT_ERROR;
12602
- }
12603
- if (status >= config.HTTP_STATUS.INTERNAL_SERVER_ERROR) {
12604
- return api.API_ERROR_CODES.SERVER_ERROR;
12605
- }
12606
- return api.API_ERROR_CODES.UNKNOWN_ERROR;
12607
- }
12608
- /**
12609
- * Gets the error category from ERROR_DEFINITIONS
12610
- */
12611
- categorizeError() {
12612
- const definition = api.ERROR_DEFINITIONS[this.errorCode];
12613
- return definition?.category ?? types.ERROR_CATEGORY.Unknown;
12614
- }
12615
- /**
12616
- * Checks if this is a specific category of error
12617
- */
12618
- isAuthError() {
12619
- return this.category === types.ERROR_CATEGORY.Authentication || this.category === types.ERROR_CATEGORY.Authorization;
12620
- }
12621
- isValidationError() {
12622
- return this.category === types.ERROR_CATEGORY.Validation;
12623
- }
12624
- isNetworkError() {
12625
- return this.category === types.ERROR_CATEGORY.Network;
12626
- }
12627
- isServerError() {
12628
- return this.category === types.ERROR_CATEGORY.Server;
12629
- }
12630
- isClientError() {
12631
- return this.statusCode >= config.HTTP_STATUS.BAD_REQUEST && this.statusCode < config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
12632
- }
12633
- isRetryable() {
12634
- return this.category === types.ERROR_CATEGORY.Network || this.category === types.ERROR_CATEGORY.Server || this.category === types.ERROR_CATEGORY.Timeout || this.statusCode === config.HTTP_STATUS.TOO_MANY_REQUESTS || // Rate limit
12635
- this.statusCode >= config.HTTP_STATUS.INTERNAL_SERVER_ERROR;
12636
- }
12637
- /**
12638
- * Converts to ErrorResponse format (as per task-020)
12639
- */
12640
- toJSON() {
12641
- return {
12642
- statusCode: this.statusCode,
12643
- errorCode: this.errorCode,
12644
- message: this.message,
12645
- errors: this.errors ?? [],
12646
- correlationId: this.correlationId,
12647
- timestamp: this.timestamp
12648
- };
12649
- }
12650
- /**
12651
- * Creates a string representation
12652
- */
12653
- toString() {
12654
- return `[${this.errorCode}] ${this.message} (Status: ${this.statusCode}, Category: ${this.category})`;
12655
- }
12656
- /**
12657
- * Check if error is an ApiPackageError
12658
- */
12659
- static isApiPackageError(error) {
12660
- return error instanceof _ApiPackageError;
12661
- }
12662
- /**
12663
- * Get user-friendly message for display
12664
- */
12665
- getUserMessage() {
12666
- const customMessage = this.getCustomUserMessage();
12667
- if (customMessage) {
12668
- return customMessage;
12669
- }
12670
- return this.getDefaultUserMessage();
12671
- }
12672
- /**
12673
- * Gets custom user message from error details if available
12674
- */
12675
- getCustomUserMessage() {
12676
- if (!this.details?.length) {
12677
- return null;
12678
- }
12679
- const userMessage = this.details.find((d) => d.field === "userMessage");
12680
- return userMessage ? userMessage.message : null;
12681
- }
12682
- /**
12683
- * Gets default user message based on error category
12684
- */
12685
- getDefaultUserMessage() {
12686
- const messages = {
12687
- [types.ERROR_CATEGORY.Authentication]: "Authentication failed. Please check your credentials.",
12688
- [types.ERROR_CATEGORY.Authorization]: "You do not have permission to perform this action.",
12689
- [types.ERROR_CATEGORY.Validation]: "Please check your input and try again.",
12690
- [types.ERROR_CATEGORY.NotFound]: "The requested resource was not found.",
12691
- [types.ERROR_CATEGORY.RateLimit]: "Too many requests. Please try again later.",
12692
- [types.ERROR_CATEGORY.Network]: "Network error. Please check your connection.",
12693
- [types.ERROR_CATEGORY.Timeout]: "The request timed out. Please try again.",
12694
- [types.ERROR_CATEGORY.Server]: "Server error. Please try again later.",
12695
- [types.ERROR_CATEGORY.Client]: "Client error. Please check your request.",
12696
- [types.ERROR_CATEGORY.Blockchain]: "Blockchain error. Please try again later.",
12697
- [types.ERROR_CATEGORY.ExternalService]: "External service error. Please try again later.",
12698
- [types.ERROR_CATEGORY.Conflict]: "Conflict detected. Please resolve and try again.",
12699
- [types.ERROR_CATEGORY.Cache]: "Cache error. Please try again.",
12700
- [types.ERROR_CATEGORY.Headers]: "Headers error. Please check your request headers.",
12701
- [types.ERROR_CATEGORY.Retry]: "Retry limit exceeded. Please try again later.",
12702
- [types.ERROR_CATEGORY.Strategy]: "Strategy error. Invalid configuration.",
12703
- [types.ERROR_CATEGORY.Regional]: "Regional configuration error. Please check your region settings.",
12704
- [types.ERROR_CATEGORY.Unknown]: "An unexpected error occurred. Please try again later."
12705
- };
12706
- return messages[this.category] ?? "An unexpected error occurred. Please try again later.";
12707
- }
12708
- };
12709
-
12710
- // src/api/errors/error-codes.ts
12711
- var API_ERROR_CODES6 = {
12712
- // Client Configuration Errors
12713
- CLIENT_INITIALIZATION_FAILED: "CLIENT_INITIALIZATION_FAILED",
12714
- // Header Errors
12715
- HEADERS_ENRICHMENT_FAILED: "HEADERS_ENRICHMENT_FAILED",
12716
- // Polling Errors
12717
- POLLING_TIMEOUT: "POLLING_TIMEOUT",
12718
- POLLING_CANCELLED: "POLLING_CANCELLED"};
12719
- var PACKAGE_STATUS_CODES3 = {
12720
- // Internal system errors
12721
- INITIALIZATION_FAILED: 1040,
12722
- OPERATION_FAILED: 1041};
12723
-
12724
- // src/api/errors/types-constants.ts
12725
- var OPERATIONS3 = {
12726
- ENRICHMENT: "enrichment",
12727
- INITIALIZATION: "initialization",
12728
- POLLING: "polling"};
12729
-
12730
- // src/api/polling/utils.ts
12731
- function isPollingActive(config) {
12732
- return (config.interval ?? 0) > 0;
12733
- }
12734
- __name(isPollingActive, "isPollingActive");
12735
- function calculatePollingDuration(config) {
12736
- if (!config.interval || !config.maxAttempts || config.maxAttempts <= 0) {
12737
- return null;
12738
- }
12739
- const intervals = config.interval * config.maxAttempts;
12740
- const delays = (config.delay ?? 0) * config.maxAttempts;
12741
- return intervals + delays;
12742
- }
12743
- __name(calculatePollingDuration, "calculatePollingDuration");
12744
- function getSSRSafePollingConfig(config) {
12745
- if (!isBrowser()) {
12746
- return {
12747
- ...config,
12748
- interval: 0,
12749
- maxAttempts: 1
12750
- };
12751
- }
12752
- return config;
11958
+ return config;
12753
11959
  }
12754
11960
  __name(getSSRSafePollingConfig, "getSSRSafePollingConfig");
12755
11961
  function createProgressivePolling(options = {}) {
@@ -12777,11 +11983,11 @@ function createConditionalPolling(options) {
12777
11983
  if (options.errorCondition?.(response)) {
12778
11984
  new ApiPackageError(
12779
11985
  "polling.error_condition",
12780
- PACKAGE_STATUS_CODES3.OPERATION_FAILED,
12781
- API_ERROR_CODES6.POLLING_CANCELLED,
11986
+ errors.INTERNAL_STATUS_CODES.OPERATION_FAILED,
11987
+ errors.API_ERROR_CODES.POLLING_CANCELLED,
12782
11988
  {
12783
11989
  context: {
12784
- operation: OPERATIONS3.POLLING,
11990
+ operation: errors.COMMON_OPERATIONS.POLLING,
12785
11991
  reason: "Error condition met",
12786
11992
  i18n: {
12787
11993
  reason: "error_condition"
@@ -12796,11 +12002,11 @@ function createConditionalPolling(options) {
12796
12002
  if (elapsed >= options.timeoutMs) {
12797
12003
  new ApiPackageError(
12798
12004
  "polling.timeout",
12799
- PACKAGE_STATUS_CODES3.OPERATION_FAILED,
12800
- API_ERROR_CODES6.POLLING_TIMEOUT,
12005
+ errors.INTERNAL_STATUS_CODES.OPERATION_FAILED,
12006
+ errors.API_ERROR_CODES.POLLING_TIMEOUT,
12801
12007
  {
12802
12008
  context: {
12803
- operation: OPERATIONS3.POLLING,
12009
+ operation: errors.COMMON_OPERATIONS.POLLING,
12804
12010
  timeoutMs: options.timeoutMs,
12805
12011
  elapsed,
12806
12012
  i18n: {
@@ -13967,7 +13173,7 @@ function filterToFetchffProperties(config) {
13967
13173
  maxPollingAttempts,
13968
13174
  shouldStopPolling,
13969
13175
  fetcher,
13970
- logger,
13176
+ logger: logger19,
13971
13177
  // Cache properties
13972
13178
  cacheTime,
13973
13179
  staleTime,
@@ -14060,7 +13266,7 @@ function filterToFetchffProperties(config) {
14060
13266
  if (shouldStopPolling !== void 0 && shouldStopPolling !== null)
14061
13267
  fetchffConfig.shouldStopPolling = shouldStopPolling;
14062
13268
  if (fetcher !== void 0 && fetcher !== null) fetchffConfig.fetcher = fetcher;
14063
- if (logger !== void 0 && logger !== null) fetchffConfig.logger = logger;
13269
+ if (logger19 !== void 0 && logger19 !== null) fetchffConfig.logger = logger19;
14064
13270
  if (cacheTime !== void 0) fetchffConfig.cacheTime = cacheTime;
14065
13271
  if (staleTime !== void 0) fetchffConfig.staleTime = staleTime;
14066
13272
  if (skipCache !== void 0) fetchffConfig.skipCache = skipCache;
@@ -14437,11 +13643,33 @@ function trackGlobalConfigUpdate(params) {
14437
13643
  });
14438
13644
  }
14439
13645
  __name(trackGlobalConfigUpdate, "trackGlobalConfigUpdate");
13646
+ function handleGlobalErrorSystemConfig(errorConfig) {
13647
+ const alreadyInitialized = errors$1.isErrorSystemInitialized();
13648
+ if (alreadyInitialized) {
13649
+ if (errorConfig.locale) {
13650
+ errors$1.setErrorLocale(errorConfig.locale);
13651
+ }
13652
+ if (errorConfig.additionalCatalogs) {
13653
+ Object.entries(errorConfig.additionalCatalogs).forEach(([locale, catalog]) => {
13654
+ errors$1.addMessageCatalog(locale, catalog, true);
13655
+ });
13656
+ }
13657
+ } else {
13658
+ errors$1.initializeErrorSystem({
13659
+ defaultLocale: errorConfig.locale,
13660
+ additionalCatalogs: errorConfig.additionalCatalogs
13661
+ });
13662
+ }
13663
+ }
13664
+ __name(handleGlobalErrorSystemConfig, "handleGlobalErrorSystemConfig");
14440
13665
  function setGlobalConfig(config) {
14441
13666
  try {
14442
13667
  const startTime = Date.now();
14443
13668
  const currentConfig = globalApiConfig;
14444
13669
  validateConfigObject(config);
13670
+ if (config.errors) {
13671
+ handleGlobalErrorSystemConfig(config.errors);
13672
+ }
14445
13673
  const { merged: mergedConfig, entries: configEntries } = mergeGlobalConfig(
14446
13674
  currentConfig,
14447
13675
  config
@@ -14616,10 +13844,6 @@ var campaignEndpoints = {
14616
13844
  createCampaign: {
14617
13845
  url: "/campaigns",
14618
13846
  method: "POST"
14619
- // Example: Override global settings for this endpoint
14620
- // cancellable: true, // Cancel previous create requests
14621
- // timeout: 60000, // Longer timeout for creation
14622
- // retry: { attempts: 1 } // Don't retry POST requests
14623
13847
  },
14624
13848
  updateCampaign: {
14625
13849
  url: "/campaigns/:id",
@@ -14632,9 +13856,6 @@ var campaignEndpoints = {
14632
13856
  getCampaignStats: {
14633
13857
  url: "/campaigns/:id/stats",
14634
13858
  method: "GET"
14635
- // Example: Cache stats for longer
14636
- // cacheTime: 600, // Cache for 10 minutes
14637
- // staleTime: 1200 // Consider stale after 20 minutes
14638
13859
  },
14639
13860
  getCampaignParticipants: {
14640
13861
  url: "/campaigns/:id/participants",
@@ -14712,6 +13933,213 @@ var pollingEndpoints = {
14712
13933
  }
14713
13934
  };
14714
13935
 
13936
+ // src/api/endpoints/infobip.ts
13937
+ var infobipEmailEndpoints = {
13938
+ // ========== Outbound Email ==========
13939
+ /**
13940
+ * POST /email/3/send - Send email (simple, with attachment support)
13941
+ * Multipart/form-data for attachments
13942
+ */
13943
+ sendEmail: {
13944
+ url: "/email/3/send",
13945
+ method: "POST"
13946
+ },
13947
+ /**
13948
+ * POST /email/4/send - Send advanced email
13949
+ * JSON payload with full customization
13950
+ */
13951
+ sendAdvancedEmail: {
13952
+ url: "/email/4/messages",
13953
+ method: "POST"
13954
+ },
13955
+ /**
13956
+ * POST /email/3/mime - Send email via MIME format
13957
+ */
13958
+ sendEmailMime: {
13959
+ url: "/email/3/mime",
13960
+ method: "POST"
13961
+ },
13962
+ // ========== Email Validation ==========
13963
+ /**
13964
+ * POST /email/2/validation - Validate single email address
13965
+ */
13966
+ validateEmail: {
13967
+ url: "/email/2/validation",
13968
+ method: "POST"
13969
+ },
13970
+ /**
13971
+ * POST /email/2/validations - Bulk validate email addresses
13972
+ * Returns 202 with validation request ID
13973
+ */
13974
+ bulkValidateEmails: {
13975
+ url: "/email/2/validations",
13976
+ method: "POST"
13977
+ },
13978
+ /**
13979
+ * GET /email/2/validations - Get validation results
13980
+ * Retrieve bulk validation results with filtering
13981
+ */
13982
+ getValidations: {
13983
+ url: "/email/2/validations",
13984
+ method: "GET",
13985
+ cacheTime: 30,
13986
+ staleTime: 60
13987
+ },
13988
+ // ========== Logs & Reports ==========
13989
+ /**
13990
+ * GET /email/1/reports - Get email delivery reports
13991
+ */
13992
+ getEmailReports: {
13993
+ url: "/email/1/reports",
13994
+ method: "GET",
13995
+ cacheTime: 30,
13996
+ staleTime: 60
13997
+ },
13998
+ /**
13999
+ * GET /email/1/logs - Get email logs
14000
+ */
14001
+ getEmailLogs: {
14002
+ url: "/email/1/logs",
14003
+ method: "GET",
14004
+ cacheTime: 60,
14005
+ staleTime: 120
14006
+ },
14007
+ // ========== Scheduled Messages (Bulk Operations) ==========
14008
+ /**
14009
+ * GET /email/1/bulks - Get scheduled email bulks
14010
+ */
14011
+ getScheduledEmails: {
14012
+ url: "/email/1/bulks",
14013
+ method: "GET"
14014
+ },
14015
+ /**
14016
+ * GET /email/1/bulks/status - Get scheduled email statuses
14017
+ */
14018
+ getScheduledEmailStatuses: {
14019
+ url: "/email/1/bulks/status",
14020
+ method: "GET"
14021
+ },
14022
+ /**
14023
+ * PUT /email/1/bulks - Reschedule emails
14024
+ */
14025
+ rescheduleEmails: {
14026
+ url: "/email/1/bulks",
14027
+ method: "PUT"
14028
+ },
14029
+ /**
14030
+ * PUT /email/1/bulks/status - Update scheduled email statuses
14031
+ */
14032
+ updateScheduledEmailStatuses: {
14033
+ url: "/email/1/bulks/status",
14034
+ method: "PUT"
14035
+ }
14036
+ };
14037
+ var infobipEndpoints = {
14038
+ ...infobipEmailEndpoints
14039
+ };
14040
+
14041
+ // src/api/endpoints/virustotal.ts
14042
+ var virusTotalEndpoints = {
14043
+ // ========== File Scanning ==========
14044
+ /**
14045
+ * POST /files - Upload file for scanning
14046
+ * Multipart/form-data with file attachment
14047
+ * See official documentation for current free tier limits:
14048
+ * https://developers.virustotal.com/reference/overview#public-vs-premium-api
14049
+ *
14050
+ * @returns {object} response - Upload response with analysis ID
14051
+ * @returns {string} response.data.id - Analysis ID for polling results
14052
+ */
14053
+ uploadFileForScanning: {
14054
+ url: "/files",
14055
+ method: "POST"
14056
+ },
14057
+ /**
14058
+ * GET /analyses/{id} - Get analysis result
14059
+ * Retrieve scan results for previously uploaded file
14060
+ *
14061
+ * @param {string} id - Analysis ID from upload response
14062
+ * @returns {object} response - Analysis result with threat details
14063
+ */
14064
+ getAnalysisResult: {
14065
+ url: "/analyses/:id",
14066
+ method: "GET",
14067
+ cacheTime: 0
14068
+ // Don't cache scan results (they update)
14069
+ },
14070
+ // ========== Health & Info ==========
14071
+ /**
14072
+ * GET /version - Get API version info (health check)
14073
+ * Simple endpoint to verify API availability
14074
+ */
14075
+ getApiVersion: {
14076
+ url: "/version",
14077
+ method: "GET",
14078
+ cacheTime: 300,
14079
+ // Cache for 5 minutes
14080
+ staleTime: 600
14081
+ }
14082
+ };
14083
+ ({
14084
+ ...virusTotalEndpoints
14085
+ });
14086
+ var cloudflareEndpoints = {
14087
+ /**
14088
+ * POST /zones/{zoneId}/purge_cache - Purge files from cache
14089
+ * Purge specific files or all files in a zone
14090
+ * Rate limits may change; see official documentation for current limits:
14091
+ * https://developers.cloudflare.com/api/operations/zone-purge#rate-limits
14092
+ *
14093
+ * @param {string} zoneId - Cloudflare Zone ID
14094
+ * @returns {object} response - Purge result with success status
14095
+ */
14096
+ cloudflarePurgeCache: {
14097
+ url: "/zones/:zoneId/purge_cache",
14098
+ method: "POST",
14099
+ cacheTime: 0
14100
+ // Don't cache purge operations
14101
+ }
14102
+ };
14103
+ var cloudFrontEndpoints = {
14104
+ /**
14105
+ * POST /{apiVersion}/distribution/{distributionId}/invalidation - Create invalidation
14106
+ * Creates an invalidation batch for specified paths
14107
+ * Rate limits may change; see the official AWS documentation for current limits:
14108
+ * https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html
14109
+ * Requires AWS Signature Version 4 authentication
14110
+ *
14111
+ * @param {string} distributionId - CloudFront Distribution ID
14112
+ * @returns {object} response - Invalidation result with ID and status
14113
+ */
14114
+ cloudFrontCreateInvalidation: {
14115
+ url: `/${config.AWS_CLOUDFRONT_CONFIG.API_VERSION}/distribution/:distributionId/invalidation`,
14116
+ method: "POST",
14117
+ cacheTime: 0
14118
+ }
14119
+ };
14120
+ var fastlyEndpoints = {
14121
+ /**
14122
+ * POST /service/{serviceId}/purge/{url} - Purge single URL
14123
+ * Instant soft-purge of specific URL
14124
+ * Rate limit: Unlimited soft-purges. Hard-purges are limited to 1000 requests per hour per service (as of 2024-06). See Fastly documentation for updates:
14125
+ * @see https://developer.fastly.com/reference/api/purging/#rate-limits
14126
+ *
14127
+ * @param {string} serviceId - Fastly Service ID
14128
+ * @param {string} url - URL to purge (URL-encoded)
14129
+ * @returns {object} response - Purge result with status
14130
+ */
14131
+ fastlyPurgeUrl: {
14132
+ url: "/service/:serviceId/purge/:url",
14133
+ method: "POST",
14134
+ cacheTime: 0
14135
+ }
14136
+ };
14137
+ var cdnEndpoints = {
14138
+ ...cloudflareEndpoints,
14139
+ ...cloudFrontEndpoints,
14140
+ ...fastlyEndpoints
14141
+ };
14142
+
14715
14143
  // src/api/endpoints/utils.ts
14716
14144
  function getEndpointUrl(name) {
14717
14145
  return endpoints[name].url;
@@ -14884,7 +14312,15 @@ __name(validatePathParams, "validatePathParams");
14884
14312
  var endpoints = {
14885
14313
  ...campaignEndpoints,
14886
14314
  // These are only examples for the polling, none of these endpoints doesnt exist yet
14887
- ...pollingEndpoints
14315
+ ...pollingEndpoints,
14316
+ // Infobip third-party provider endpoints (Email, SMS, WhatsApp)
14317
+ ...infobipEndpoints,
14318
+ // VirusTotal third-party provider endpoints (Virus/Malware scanning)
14319
+ ...virusTotalEndpoints,
14320
+ // CDN provider endpoints (Cloudflare, CloudFront, Fastly)
14321
+ ...cloudflareEndpoints,
14322
+ ...cloudFrontEndpoints,
14323
+ ...fastlyEndpoints
14888
14324
  };
14889
14325
  var isSlowConnection = fetchff.isSlowConnection;
14890
14326
  function isNetworkAPISupported() {
@@ -18265,6 +17701,7 @@ async function prepareRequestConfigWithEnrichedHeaders(requestConfig, clientConf
18265
17701
  return config;
18266
17702
  }
18267
17703
  __name(prepareRequestConfigWithEnrichedHeaders, "prepareRequestConfigWithEnrichedHeaders");
17704
+ new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.EXPRESS_FRAMEWORK, transport: "console" });
18268
17705
  var networkDetectionMiddleware = /* @__PURE__ */ __name((req, res, next) => {
18269
17706
  const headerInfo = getNetworkInfoFromHeaders(req.headers);
18270
17707
  const networkInfo = {
@@ -18425,6 +17862,7 @@ __name(exports.MinimumConnectionGuard, "MinimumConnectionGuard");
18425
17862
  exports.MinimumConnectionGuard = __decorateClass([
18426
17863
  common.Injectable()
18427
17864
  ], exports.MinimumConnectionGuard);
17865
+ var logger13 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.NESTJS_GUARD, transport: "console" });
18428
17866
  var EnrichedHeadersGuard = class {
18429
17867
  constructor(options = {}) {
18430
17868
  this.options = options;
@@ -18439,7 +17877,7 @@ var EnrichedHeadersGuard = class {
18439
17877
  for (const requiredHeader of requiredHeaders) {
18440
17878
  if (!enrichedHeaders[requiredHeader]) {
18441
17879
  if (debug) {
18442
- console.warn(`[EnrichedHeadersGuard] Missing required header: ${requiredHeader}`);
17880
+ logger13.warn("Missing required header", { requiredHeader });
18443
17881
  }
18444
17882
  return false;
18445
17883
  }
@@ -18456,7 +17894,7 @@ var EnrichedHeadersGuard = class {
18456
17894
  const complianceHeader = enrichedHeaders["x-compliance-required"];
18457
17895
  if (!complianceHeader) {
18458
17896
  if (debug) {
18459
- console.warn("[EnrichedHeadersGuard] No compliance information available");
17897
+ logger13.warn("No compliance information available");
18460
17898
  }
18461
17899
  return false;
18462
17900
  }
@@ -18466,7 +17904,7 @@ var EnrichedHeadersGuard = class {
18466
17904
  );
18467
17905
  if (!hasRequiredCompliance) {
18468
17906
  if (debug) {
18469
- console.warn("[EnrichedHeadersGuard] Required compliance not met:", {
17907
+ logger13.warn("Required compliance not met", {
18470
17908
  required: requiredCompliance,
18471
17909
  current: currentCompliance
18472
17910
  });
@@ -18480,7 +17918,7 @@ var EnrichedHeadersGuard = class {
18480
17918
  */
18481
17919
  async buildHeadersForRequest(request, enrichedOptions, debug) {
18482
17920
  if (debug) {
18483
- console.log("[EnrichedHeadersGuard] Processing request:", {
17921
+ logger13.debug("Processing request with enriched headers guard", {
18484
17922
  method: request.method,
18485
17923
  url: request.url,
18486
17924
  userAgent: request.headers["user-agent"]
@@ -18496,7 +17934,7 @@ var EnrichedHeadersGuard = class {
18496
17934
  };
18497
17935
  const enrichedHeaders = await buildEnrichedHeaders(requestContext, enrichedOptions);
18498
17936
  if (debug) {
18499
- console.log("[EnrichedHeadersGuard] Built headers:", enrichedHeaders);
17937
+ logger13.debug("Built enriched headers in guard", { enrichedHeaders });
18500
17938
  }
18501
17939
  return enrichedHeaders;
18502
17940
  }
@@ -18528,7 +17966,9 @@ var EnrichedHeadersGuard = class {
18528
17966
  */
18529
17967
  async handleBuildError(error, request, debug) {
18530
17968
  if (debug) {
18531
- console.error("[EnrichedHeadersGuard] Error building headers:", error);
17969
+ logger13.error("Error building headers in guard", {
17970
+ error: error instanceof Error ? error.message : String(error)
17971
+ });
18532
17972
  }
18533
17973
  new ApiPackageError(
18534
17974
  "nestjs.guard.enriched_headers_failed",
@@ -18576,6 +18016,7 @@ __name(EnrichedHeadersGuard, "EnrichedHeadersGuard");
18576
18016
  EnrichedHeadersGuard = __decorateClass([
18577
18017
  common.Injectable()
18578
18018
  ], EnrichedHeadersGuard);
18019
+ var logger14 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.NESTJS_INTERCEPTOR, transport: "console" });
18579
18020
  var EnrichedHeadersInterceptor = class {
18580
18021
  constructor(options = {}) {
18581
18022
  this.options = options;
@@ -18627,7 +18068,9 @@ var EnrichedHeadersInterceptor = class {
18627
18068
  */
18628
18069
  handleContextError(error, request, debug) {
18629
18070
  if (debug) {
18630
- console.error("[EnrichedHeadersInterceptor] Error in context:", error);
18071
+ logger14.error("Error in interceptor context", {
18072
+ error: error.message
18073
+ });
18631
18074
  }
18632
18075
  new ApiPackageError(
18633
18076
  "nestjs.interceptor.context_error",
@@ -18652,7 +18095,9 @@ var EnrichedHeadersInterceptor = class {
18652
18095
  */
18653
18096
  handleBuildError(error, request, next, debug) {
18654
18097
  if (debug) {
18655
- console.error("[EnrichedHeadersInterceptor] Error building headers:", error);
18098
+ logger14.error("Error building headers in interceptor", {
18099
+ error: error instanceof Error ? error.message : String(error)
18100
+ });
18656
18101
  }
18657
18102
  new ApiPackageError(
18658
18103
  "nestjs.interceptor.enriched_headers_failed",
@@ -18696,7 +18141,9 @@ var EnrichedHeadersInterceptor = class {
18696
18141
  */
18697
18142
  handleFallbackError(error, request, debug) {
18698
18143
  if (debug) {
18699
- console.error("[EnrichedHeadersInterceptor] Error in fallback context:", error);
18144
+ logger14.error("Error in fallback context", {
18145
+ error: error.message
18146
+ });
18700
18147
  }
18701
18148
  new ApiPackageError(
18702
18149
  "nestjs.interceptor.fallback_error",
@@ -18723,7 +18170,7 @@ var EnrichedHeadersInterceptor = class {
18723
18170
  const response = http.getResponse();
18724
18171
  try {
18725
18172
  if (debug) {
18726
- console.log("[EnrichedHeadersInterceptor] Processing request:", {
18173
+ logger14.debug("Processing request with enriched headers interceptor", {
18727
18174
  method: request.method,
18728
18175
  url: request.url,
18729
18176
  userAgent: request.headers["user-agent"]
@@ -18731,7 +18178,7 @@ var EnrichedHeadersInterceptor = class {
18731
18178
  }
18732
18179
  const enrichedHeaders = await this.buildHeaders(request, enrichedOptions);
18733
18180
  if (debug) {
18734
- console.log("[EnrichedHeadersInterceptor] Built headers:", enrichedHeaders);
18181
+ logger14.debug("Built enriched headers in interceptor", { enrichedHeaders });
18735
18182
  }
18736
18183
  if (storeInRequest) {
18737
18184
  request.enrichedHeaders = enrichedHeaders;
@@ -19456,65 +18903,6 @@ var NetworkPresetNames = {
19456
18903
  BACKGROUND_SYNC: "background-sync"
19457
18904
  };
19458
18905
 
19459
- // src/api/utils/generation/request-id.ts
19460
- var REQUEST_ID_CONSTANTS = {
19461
- PREFIX_LENGTH: 4
19462
- // Length of 'req_'
19463
- };
19464
- var requestIdGenerator = createIdGenerator({
19465
- prefix: "req",
19466
- useTimestamp: false
19467
- // Use UUID for request IDs for guaranteed uniqueness
19468
- });
19469
- function generateRequestId(options) {
19470
- return requestIdGenerator(options);
19471
- }
19472
- __name(generateRequestId, "generateRequestId");
19473
- function generateContextualRequestId(method, url, options) {
19474
- const context = {};
19475
- if (method || url) {
19476
- context.method = method ?? "UNKNOWN";
19477
- context.url = url ?? "UNKNOWN";
19478
- }
19479
- return generateContextualId(context, {
19480
- prefix: "req",
19481
- ...options
19482
- });
19483
- }
19484
- __name(generateContextualRequestId, "generateContextualRequestId");
19485
- function extractBaseRequestId(contextualId) {
19486
- let id = extractBaseId(contextualId, { separator: ":", extractLast: true });
19487
- if (id.startsWith("req_")) {
19488
- id = id.substring(REQUEST_ID_CONSTANTS.PREFIX_LENGTH);
19489
- }
19490
- return id;
19491
- }
19492
- __name(extractBaseRequestId, "extractBaseRequestId");
19493
- function isValidRequestId(id) {
19494
- return isValidId(id, {
19495
- allowUuid: true,
19496
- allowTimestamp: true,
19497
- allowPrefix: true,
19498
- minLength: 5
19499
- });
19500
- }
19501
- __name(isValidRequestId, "isValidRequestId");
19502
- function generateShortRequestId(options) {
19503
- return requestIdGenerator({
19504
- useTimestamp: true,
19505
- randomLength: 8,
19506
- ...options
19507
- });
19508
- }
19509
- __name(generateShortRequestId, "generateShortRequestId");
19510
- function createRequestIdGenerator(defaultOptions = {}) {
19511
- return createIdGenerator({
19512
- prefix: "req",
19513
- ...defaultOptions
19514
- });
19515
- }
19516
- __name(createRequestIdGenerator, "createRequestIdGenerator");
19517
-
19518
18906
  // src/api/utils/async-control.ts
19519
18907
  function debounce(func, delay) {
19520
18908
  let timeoutId;
@@ -19796,6 +19184,10 @@ function getAllMediaExtensions() {
19796
19184
  }
19797
19185
  __name(getAllMediaExtensions, "getAllMediaExtensions");
19798
19186
  var MEDIA_MIME_PREFIXES = ["image/", "video/", "audio/"];
19187
+ var logger15 = new logger$1.ApiLogger({
19188
+ service: types.LOGGER_SERVICES.CLIENT_EVENT_MANAGER,
19189
+ transport: "console"
19190
+ });
19799
19191
  var EVENT_CONSTANTS2 = {
19800
19192
  DEBUG_INFO_INTERVAL_MULTIPLIER: 5,
19801
19193
  IMPACT_THRESHOLDS: {
@@ -20008,7 +19400,9 @@ var ClientEventManager = class _ClientEventManager {
20008
19400
  const registeredHandlers = [];
20009
19401
  finalHandlers.forEach((h) => {
20010
19402
  if (typeof h !== "function") {
20011
- console.warn("Invalid handler provided - not a function:", h);
19403
+ logger15.warn("Invalid handler provided - not a function", {
19404
+ handlerType: typeof h
19405
+ });
20012
19406
  return;
20013
19407
  }
20014
19408
  const wrappedHandler = /* @__PURE__ */ __name((eventData) => {
@@ -20525,10 +19919,20 @@ var ClientEventManager = class _ClientEventManager {
20525
19919
  return this.eventManager.getActiveScopes();
20526
19920
  }
20527
19921
  /**
20528
- * Emit error event (delegates to emitErrorEvent for consistency)
19922
+ * Emit error event at CLIENT scope
19923
+ *
19924
+ * Note: ApiPackageError instances automatically emit to ALL scopes when created.
19925
+ * This method emits specifically at CLIENT scope, useful for:
19926
+ * - Re-emitting errors that were caught and handled elsewhere
19927
+ * - Manual emission timing control
19928
+ * - Client-level error broadcasting
20529
19929
  */
20530
19930
  emitError(error) {
20531
- void emitErrorEvent(error);
19931
+ errors$1.emitScopedErrorEvent(API_ERROR_NAMESPACE, error, {
19932
+ scopes: ["CLIENT"],
19933
+ eventFactory: apiErrorEventFactory,
19934
+ category: error.category
19935
+ });
20532
19936
  }
20533
19937
  /**
20534
19938
  * Emit request start event
@@ -21415,8 +20819,6 @@ function mergeHeaders(...headerSets) {
21415
20819
  return result;
21416
20820
  }
21417
20821
  __name(mergeHeaders, "mergeHeaders");
21418
-
21419
- // src/api/headers/headerBuilder.ts
21420
20822
  var HeaderBuilder = class {
21421
20823
  static {
21422
20824
  __name(this, "HeaderBuilder");
@@ -21651,7 +21053,7 @@ var HeaderBuilder = class {
21651
21053
  * ```
21652
21054
  */
21653
21055
  correlationId(id) {
21654
- this._headers["x-correlation-id"] = id ?? generateCorrelationId();
21056
+ this._headers["x-correlation-id"] = id ?? errors$1.generateCorrelationId("req_correlation");
21655
21057
  return this;
21656
21058
  }
21657
21059
  /**
@@ -21667,7 +21069,7 @@ var HeaderBuilder = class {
21667
21069
  * ```
21668
21070
  */
21669
21071
  requestId(id) {
21670
- this._headers["x-request-id"] = id ?? generateRequestId();
21072
+ this._headers["x-request-id"] = id ?? errors$1.generateRequestId();
21671
21073
  return this;
21672
21074
  }
21673
21075
  /**
@@ -21683,7 +21085,7 @@ var HeaderBuilder = class {
21683
21085
  * ```
21684
21086
  */
21685
21087
  traceId(traceId) {
21686
- this._headers["x-trace-id"] = traceId ?? generateTraceCorrelationId();
21088
+ this._headers["x-trace-id"] = traceId ?? errors$1.generateTraceCorrelationId();
21687
21089
  return this;
21688
21090
  }
21689
21091
  /**
@@ -21993,7 +21395,7 @@ function getHeaderFingerprint(headers2) {
21993
21395
  return "no-cache-affecting-headers";
21994
21396
  }
21995
21397
  const content = parts.join("|");
21996
- return crypto$1.createHash("sha256").update(content).digest("hex").substring(0, FINGERPRINT_LENGTH);
21398
+ return crypto2.createHash("sha256").update(content).digest("hex").substring(0, FINGERPRINT_LENGTH);
21997
21399
  }
21998
21400
  __name(getHeaderFingerprint, "getHeaderFingerprint");
21999
21401
 
@@ -22990,10 +22392,9 @@ function hasEncryptableFields(requestConfig, config) {
22990
22392
  return targets.some((target) => hasMatchingFieldsInTarget(target, requestConfig, config));
22991
22393
  }
22992
22394
  __name(hasEncryptableFields, "hasEncryptableFields");
22993
-
22994
- // src/api/client/helpers/interceptors.ts
22995
22395
  var DEFAULT_MAX_RETRIES = 3;
22996
22396
  var DEFAULT_SUCCESS_STATUS = config.HTTP_STATUS.OK;
22397
+ var logger16 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.INTERCEPTORS, transport: "console" });
22997
22398
  function trackHeaderChanges(beforeHeaders, afterHeaders, interceptorIndex) {
22998
22399
  const changes = [];
22999
22400
  Object.entries(afterHeaders).forEach(([key, value]) => {
@@ -23036,7 +22437,7 @@ function createOnRetryHandler(handlers) {
23036
22437
  return (response, retryAttempt) => {
23037
22438
  const performanceFactory = getPerformanceEventFactory();
23038
22439
  performanceFactory.emitRetry({
23039
- requestId: generateRequestId(),
22440
+ requestId: errors$1.generateRequestId(),
23040
22441
  attempt: retryAttempt,
23041
22442
  maxAttempts: DEFAULT_MAX_RETRIES,
23042
22443
  reason: response.error?.message ?? "Retry attempt",
@@ -23053,10 +22454,30 @@ function createOnRetryHandler(handlers) {
23053
22454
  };
23054
22455
  }
23055
22456
  __name(createOnRetryHandler, "createOnRetryHandler");
23056
- function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfig) {
22457
+ function normalizeHeaders4(headers2) {
22458
+ const normalized = {};
22459
+ for (const [key, value] of Object.entries(headers2 || {})) {
22460
+ normalized[key.toLowerCase()] = value;
22461
+ }
22462
+ return normalized;
22463
+ }
22464
+ __name(normalizeHeaders4, "normalizeHeaders");
22465
+ function mergeHeadersCaseInsensitive(...headerSets) {
22466
+ const result = {};
22467
+ for (const headers2 of headerSets) {
22468
+ if (!headers2) continue;
22469
+ for (const [key, value] of Object.entries(headers2)) {
22470
+ const normalizedKey = key.toLowerCase();
22471
+ result[normalizedKey] = value;
22472
+ }
22473
+ }
22474
+ return result;
22475
+ }
22476
+ __name(mergeHeadersCaseInsensitive, "mergeHeadersCaseInsensitive");
22477
+ function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfig, configStrategy) {
23057
22478
  return async (config) => {
23058
22479
  const performanceFactory = getPerformanceEventFactory();
23059
- const requestId = generateRequestId();
22480
+ const requestId = errors$1.generateRequestId();
23060
22481
  startRequestTracking(requestId);
23061
22482
  UnifiedDebugger.getInstance().trackConfigChange(
23062
22483
  { headers: config.headers },
@@ -23077,12 +22498,28 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfi
23077
22498
  "enrichedHeaders",
23078
22499
  { requestId }
23079
22500
  );
23080
- processedConfig = {
23081
- ...processedConfig,
23082
- headers: enrichedHeaders
23083
- };
22501
+ const strategy = configStrategy;
22502
+ if (strategy === "replace") {
22503
+ processedConfig = {
22504
+ ...processedConfig,
22505
+ headers: normalizeHeaders4(enrichedHeaders)
22506
+ };
22507
+ } else {
22508
+ const mergedHeaders = mergeHeadersCaseInsensitive(
22509
+ enrichedHeaders,
22510
+ // Enriched headers (x-correlation-id, x-platform-type, etc.)
22511
+ config.headers
22512
+ // Existing headers (Authorization, Content-Type, etc.) - OVERRIDE enriched
22513
+ );
22514
+ processedConfig = {
22515
+ ...processedConfig,
22516
+ headers: mergedHeaders
22517
+ };
22518
+ }
23084
22519
  } catch (error) {
23085
- console.error("Failed to enrich headers:", error);
22520
+ logger16.error("Failed to enrich headers", {
22521
+ error: error instanceof Error ? error.message : String(error)
22522
+ });
23086
22523
  }
23087
22524
  }
23088
22525
  if (encryptionConfig?.enabled) {
@@ -23092,7 +22529,9 @@ function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfi
23092
22529
  processedConfig = await encryptionInterceptor(processedConfig);
23093
22530
  UnifiedDebugger.getInstance().trackConfigChange({ encryption: "applied" }, "encryption");
23094
22531
  } catch (error) {
23095
- console.error("Failed to encrypt request:", error);
22532
+ logger16.error("Failed to encrypt request", {
22533
+ error: error instanceof Error ? error.message : String(error)
22534
+ });
23096
22535
  }
23097
22536
  }
23098
22537
  if (handlers && handlers.length > 0) {
@@ -23111,7 +22550,7 @@ function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComp
23111
22550
  return async (response) => {
23112
22551
  const performanceFactory = getPerformanceEventFactory();
23113
22552
  performanceFactory.emitRequestComplete({
23114
- requestId: generateRequestId(),
22553
+ requestId: errors$1.generateRequestId(),
23115
22554
  url: response.config?.url ?? "",
23116
22555
  method: response.config?.method ?? "GET",
23117
22556
  status: response.status ?? DEFAULT_SUCCESS_STATUS,
@@ -23132,7 +22571,9 @@ function createOnResponseHandler(handlers, clearTemporaryOverrides2, clearOnComp
23132
22571
  processedResponse = await decryptionInterceptor(processedResponse);
23133
22572
  UnifiedDebugger.getInstance().trackConfigChange({ decryption: "applied" }, "encryption");
23134
22573
  } catch (error) {
23135
- console.error("Failed to decrypt response:", error);
22574
+ logger16.error("Failed to decrypt response", {
22575
+ error: error instanceof Error ? error.message : String(error)
22576
+ });
23136
22577
  }
23137
22578
  }
23138
22579
  if (clearOnComplete && clearTemporaryOverrides2) {
@@ -23146,7 +22587,7 @@ function createOnErrorHandler(handlers, clearTemporaryOverrides2, clearOnComplet
23146
22587
  return async (error) => {
23147
22588
  const performanceFactory = getPerformanceEventFactory();
23148
22589
  performanceFactory.emitRequestComplete({
23149
- requestId: generateRequestId(),
22590
+ requestId: errors$1.generateRequestId(),
23150
22591
  url: error.config?.url ?? "",
23151
22592
  method: error.config?.method ?? "GET",
23152
22593
  status: error.status ?? 0,
@@ -23229,8 +22670,14 @@ function setupUnifiedHandlers(params) {
23229
22670
  );
23230
22671
  const clearOnComplete = mergedConfig.configOverride?.clearOnComplete ?? globalConfig?.configOverride?.clearOnComplete ?? clientOptions?.configOverride?.clearOnComplete;
23231
22672
  const encryptionConfig = mergedConfig.encryption ?? globalConfig?.encryption ?? clientOptions?.encryption;
22673
+ const configStrategy = mergedConfig.configOverride?.strategy ?? clientOptions?.configOverride?.strategy ?? globalConfig?.configOverride?.strategy ?? "merge";
23232
22674
  return {
23233
- onRequest: createOnRequestHandler(mergedOnRequest, enrichedHeadersConfig, encryptionConfig),
22675
+ onRequest: createOnRequestHandler(
22676
+ mergedOnRequest,
22677
+ enrichedHeadersConfig,
22678
+ encryptionConfig,
22679
+ configStrategy
22680
+ ),
23234
22681
  onResponse: createOnResponseHandler(
23235
22682
  mergedOnResponse,
23236
22683
  clearTemporaryOverrides2,
@@ -23242,13 +22689,12 @@ function setupUnifiedHandlers(params) {
23242
22689
  };
23243
22690
  }
23244
22691
  __name(setupUnifiedHandlers, "setupUnifiedHandlers");
23245
-
23246
- // src/api/client/createApiClient.ts
23247
22692
  var ID_GENERATION = {
23248
22693
  BASE: 36,
23249
22694
  SUBSTR_START: 2,
23250
22695
  SUBSTR_LENGTH: 9
23251
22696
  };
22697
+ var logger17 = new logger$1.ApiLogger({ service: types.LOGGER_SERVICES.API_CLIENT, transport: "console" });
23252
22698
  function applyStrategies(config, options) {
23253
22699
  let resolvedConfig = config;
23254
22700
  if (options.unifiedStrategy) {
@@ -23278,12 +22724,11 @@ function applyStrategies(config, options) {
23278
22724
  );
23279
22725
  }
23280
22726
  });
23281
- console.warn(
23282
- `Individual strategies will override unified strategy settings. Unified strategy: ${options.unifiedStrategy}`,
22727
+ logger17.warn("Individual strategies override unified strategy", {
22728
+ unifiedStrategy: options.unifiedStrategy,
23283
22729
  individualStrategies,
23284
- "Conflicts detected and tracked in debug report",
23285
- debuggerInstance.getConflicts()
23286
- );
22730
+ conflictsCount: debuggerInstance.getConflicts().length
22731
+ });
23287
22732
  }
23288
22733
  }
23289
22734
  resolvedConfig = applyIndividualStrategies(resolvedConfig, options);
@@ -23314,12 +22759,12 @@ async function finalizeConfig(resolvedConfig, options) {
23314
22759
  } catch (error) {
23315
22760
  new ApiPackageError(
23316
22761
  "headers.processing.failed",
23317
- PACKAGE_STATUS_CODES3.OPERATION_FAILED,
23318
- API_ERROR_CODES6.HEADERS_ENRICHMENT_FAILED,
22762
+ errors.INTERNAL_STATUS_CODES.OPERATION_FAILED,
22763
+ errors.API_ERROR_CODES.HEADERS_ENRICHMENT_FAILED,
23319
22764
  {
23320
22765
  cause: error instanceof Error ? error : void 0,
23321
22766
  context: {
23322
- operation: OPERATIONS3.ENRICHMENT,
22767
+ operation: errors.COMMON_OPERATIONS.ENRICHMENT,
23323
22768
  originalError: error instanceof Error ? error.message : String(error),
23324
22769
  i18n: {
23325
22770
  error: error instanceof Error ? error.message : String(error)
@@ -23360,12 +22805,12 @@ __name(applyDefaultOptions, "applyDefaultOptions");
23360
22805
  function handleClientInitError(error) {
23361
22806
  throw new ApiPackageError(
23362
22807
  "client.initialization.failed",
23363
- PACKAGE_STATUS_CODES3.INITIALIZATION_FAILED,
23364
- API_ERROR_CODES6.CLIENT_INITIALIZATION_FAILED,
22808
+ errors.INTERNAL_STATUS_CODES.INITIALIZATION_FAILED,
22809
+ errors.API_ERROR_CODES.CLIENT_INITIALIZATION_FAILED,
23365
22810
  {
23366
22811
  cause: error instanceof Error ? error : void 0,
23367
22812
  context: {
23368
- operation: OPERATIONS3.INITIALIZATION,
22813
+ operation: errors.COMMON_OPERATIONS.INITIALIZATION,
23369
22814
  originalError: error instanceof Error ? error.message : String(error),
23370
22815
  i18n: {
23371
22816
  error: error instanceof Error ? error.message : String(error)
@@ -23476,7 +22921,9 @@ function analyzeConfigChanges(previousConfig, newConfig, updates) {
23476
22921
  }
23477
22922
  __name(analyzeConfigChanges, "analyzeConfigChanges");
23478
22923
  function handleInvalidConfigUpdate(validation, updates, updateOptions) {
23479
- console.warn("Invalid configuration update:", validation.errors);
22924
+ logger17.warn("Invalid configuration update", {
22925
+ errors: validation.errors
22926
+ });
23480
22927
  UnifiedDebugger.getInstance().trackEventOperation(
23481
22928
  api.EVENT_OPERATIONS.CONFIG_UPDATE_FAILED,
23482
22929
  "updateConfig",
@@ -23551,6 +22998,25 @@ function trackSuccessfulConfigUpdate(params) {
23551
22998
  );
23552
22999
  }
23553
23000
  __name(trackSuccessfulConfigUpdate, "trackSuccessfulConfigUpdate");
23001
+ function handleClientErrorSystemConfig(errorConfig) {
23002
+ const alreadyInitialized = errors$1.isErrorSystemInitialized();
23003
+ if (alreadyInitialized) {
23004
+ if (errorConfig.locale) {
23005
+ errors$1.setErrorLocale(errorConfig.locale);
23006
+ }
23007
+ if (errorConfig.additionalCatalogs) {
23008
+ Object.entries(errorConfig.additionalCatalogs).forEach(([locale, catalog]) => {
23009
+ errors$1.addMessageCatalog(locale, catalog, true);
23010
+ });
23011
+ }
23012
+ } else {
23013
+ errors$1.initializeErrorSystem({
23014
+ defaultLocale: errorConfig.locale,
23015
+ additionalCatalogs: errorConfig.additionalCatalogs
23016
+ });
23017
+ }
23018
+ }
23019
+ __name(handleClientErrorSystemConfig, "handleClientErrorSystemConfig");
23554
23020
  function createUpdateConfigMethod(initialConfigState, eventManager2, client, setConfigState) {
23555
23021
  let configState = initialConfigState;
23556
23022
  return (updates, updateOptions) => {
@@ -23560,6 +23026,9 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
23560
23026
  if (updates.tracking) {
23561
23027
  applyTrackingConfiguration(updates);
23562
23028
  }
23029
+ if (updates.errors) {
23030
+ handleClientErrorSystemConfig(updates.errors);
23031
+ }
23563
23032
  const validation = validateConfigUpdate(updates, updateOptions);
23564
23033
  if (!validation.valid) {
23565
23034
  handleInvalidConfigUpdate(validation, updates, updateOptions);
@@ -23588,9 +23057,62 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
23588
23057
  };
23589
23058
  }
23590
23059
  __name(createUpdateConfigMethod, "createUpdateConfigMethod");
23060
+ function createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers) {
23061
+ return fetchff.createApiFetcher({
23062
+ ...fetchffConfig,
23063
+ baseURL: effectiveConfig.baseURL ?? options.apiUrl,
23064
+ endpoints,
23065
+ onRequest: unifiedHandlers.onRequest,
23066
+ onResponse: unifiedHandlers.onResponse,
23067
+ onError: unifiedHandlers.onError,
23068
+ onRetry: unifiedHandlers.onRetry
23069
+ });
23070
+ }
23071
+ __name(createFetchffClient, "createFetchffClient");
23072
+ function enhanceClientWithMethods(params) {
23073
+ const {
23074
+ clientWithEvents,
23075
+ stateContainer,
23076
+ eventManager: eventManager2,
23077
+ client,
23078
+ clientId,
23079
+ globalConfig,
23080
+ options
23081
+ } = params;
23082
+ clientWithEvents.updateConfig = createUpdateConfigMethod(
23083
+ stateContainer.current,
23084
+ eventManager2,
23085
+ client,
23086
+ (newState) => {
23087
+ stateContainer.current = newState;
23088
+ }
23089
+ );
23090
+ clientWithEvents.getConfig = createGetConfigMethod(
23091
+ () => stateContainer.current,
23092
+ globalConfig,
23093
+ clientId,
23094
+ options
23095
+ );
23096
+ clientWithEvents.clearTemporaryOverrides = createClearTemporaryOverridesMethod(
23097
+ () => stateContainer.current,
23098
+ (newState) => {
23099
+ stateContainer.current = newState;
23100
+ },
23101
+ client,
23102
+ eventManager2
23103
+ );
23104
+ }
23105
+ __name(enhanceClientWithMethods, "enhanceClientWithMethods");
23106
+ function initializeClientSystems(options) {
23107
+ applyTrackingConfiguration(options);
23108
+ if (options.errors) {
23109
+ handleClientErrorSystemConfig(options.errors);
23110
+ }
23111
+ }
23112
+ __name(initializeClientSystems, "initializeClientSystems");
23591
23113
  async function createApiClient(options = {}) {
23592
23114
  try {
23593
- applyTrackingConfiguration(options);
23115
+ initializeClientSystems(options);
23594
23116
  UnifiedDebugger.getInstance().clear();
23595
23117
  options = applyDefaultOptions(options);
23596
23118
  const userConfig = createPreservedConfig(options);
@@ -23598,58 +23120,43 @@ async function createApiClient(options = {}) {
23598
23120
  const mergedConfig = await finalizeConfig(resolvedConfig, options);
23599
23121
  void UnifiedDebugger.getInstance().logConflicts();
23600
23122
  const globalConfig = getGlobalConfig();
23601
- let configState = createConfigState(mergedConfig);
23123
+ const stateContainer = {
23124
+ current: createConfigState(mergedConfig)
23125
+ };
23602
23126
  if (options.configOverride) {
23603
- const result = applyConfigOverride(configState, options.configOverride);
23604
- configState = result.state;
23127
+ const result = applyConfigOverride(stateContainer.current, options.configOverride);
23128
+ stateContainer.current = result.state;
23605
23129
  }
23606
- const effectiveConfig = getEffectiveConfig(configState);
23130
+ const effectiveConfig = getEffectiveConfig(stateContainer.current);
23607
23131
  const fetchffConfig = toFetchffConfig(effectiveConfig);
23608
23132
  let clearTemporaryOverridesFn;
23609
23133
  const unifiedHandlers = setupUnifiedHandlers({
23610
23134
  mergedConfig: effectiveConfig,
23611
- // Use effective config here too
23612
23135
  enrichedHeadersConfig: options.enrichedHeaders,
23613
23136
  globalConfig,
23614
23137
  clientOptions: options,
23615
23138
  clearTemporaryOverrides: /* @__PURE__ */ __name(() => clearTemporaryOverridesFn?.(), "clearTemporaryOverrides")
23616
23139
  });
23617
- const client = fetchff.createApiFetcher({
23618
- ...fetchffConfig,
23619
- baseURL: effectiveConfig.baseURL ?? options.url,
23620
- endpoints,
23621
- // Use unified handlers that handle both ApiConfig callbacks and event emissions
23622
- onRequest: unifiedHandlers.onRequest,
23623
- onResponse: unifiedHandlers.onResponse,
23624
- onError: unifiedHandlers.onError,
23625
- onRetry: unifiedHandlers.onRetry
23626
- });
23140
+ const client = createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers);
23627
23141
  const clientWithEvents = setupClientEvents(client, globalConfig, options);
23628
23142
  const { eventManager: eventManager2 } = clientWithEvents;
23143
+ Object.defineProperty(clientWithEvents, "then", {
23144
+ value: void 0,
23145
+ writable: false,
23146
+ enumerable: false,
23147
+ configurable: true
23148
+ });
23629
23149
  clearTemporaryOverridesFn = /* @__PURE__ */ __name(() => eventManager2.clearTemporaryOverrides(), "clearTemporaryOverridesFn");
23630
23150
  const clientId = emitClientCreatedEvent(effectiveConfig, options);
23631
- clientWithEvents.updateConfig = createUpdateConfigMethod(
23632
- configState,
23633
- eventManager2,
23151
+ enhanceClientWithMethods({
23152
+ clientWithEvents,
23153
+ stateContainer,
23154
+ eventManager: eventManager2,
23634
23155
  client,
23635
- (newState) => {
23636
- configState = newState;
23637
- }
23638
- );
23639
- clientWithEvents.getConfig = createGetConfigMethod(
23640
- () => configState,
23641
- globalConfig,
23642
23156
  clientId,
23157
+ globalConfig,
23643
23158
  options
23644
- );
23645
- clientWithEvents.clearTemporaryOverrides = createClearTemporaryOverridesMethod(
23646
- () => configState,
23647
- (newState) => {
23648
- configState = newState;
23649
- },
23650
- client,
23651
- eventManager2
23652
- );
23159
+ });
23653
23160
  if (options.networkAware?.enabled) {
23654
23161
  setupNetworkMonitoring(clientWithEvents, options, userConfig);
23655
23162
  }
@@ -23724,18 +23231,13 @@ function createApiQuery(serviceFn, defaultOptions) {
23724
23231
  __name(createApiQuery, "createApiQuery");
23725
23232
  function createApiMutation(serviceFn, defaultOptions) {
23726
23233
  return /* @__PURE__ */ __name(function useApiMutation(serviceOptions, mutationOptions) {
23727
- const mergedMutationOptions = deepMerge(
23728
- DEFAULT_MUTATION_OPTIONS,
23729
- defaultOptions ?? {},
23730
- mutationOptions ?? {},
23731
- {
23732
- mutationFn: /* @__PURE__ */ __name(async (variables) => {
23733
- const response = await serviceFn(variables, serviceOptions);
23734
- if (response.error) throw response.error;
23735
- return response.data;
23736
- }, "mutationFn")
23737
- }
23738
- );
23234
+ const mergedMutationOptions = deepMerge(DEFAULT_MUTATION_OPTIONS, defaultOptions ?? {}, mutationOptions ?? {}, {
23235
+ mutationFn: /* @__PURE__ */ __name(async (variables) => {
23236
+ const response = await serviceFn(variables, serviceOptions);
23237
+ if (response.error) throw response.error;
23238
+ return response.data;
23239
+ }, "mutationFn")
23240
+ });
23739
23241
  return reactQuery.useMutation(
23740
23242
  mergedMutationOptions
23741
23243
  );
@@ -24181,6 +23683,10 @@ function getEnhancedClientHints(headers2, options) {
24181
23683
  return response;
24182
23684
  }
24183
23685
  __name(getEnhancedClientHints, "getEnhancedClientHints");
23686
+ var logger18 = new logger$1.ApiLogger({
23687
+ service: types.LOGGER_SERVICES.NETWORK_CONFIGURATION,
23688
+ transport: "console"
23689
+ });
24184
23690
  var NetworkConfigurationManager = class {
24185
23691
  static {
24186
23692
  __name(this, "NetworkConfigurationManager");
@@ -24246,9 +23752,11 @@ var NetworkConfigurationManager = class {
24246
23752
  */
24247
23753
  registerPreset(preset) {
24248
23754
  this.availablePresets.set(preset.id, preset);
24249
- console.log(
24250
- `📋 Registered network preset: ${preset.name} (${preset.id}) for ${preset.targetQuality} quality`
24251
- );
23755
+ logger18.info("Network preset registered", {
23756
+ presetName: preset.name,
23757
+ presetId: preset.id,
23758
+ targetQuality: preset.targetQuality
23759
+ });
24252
23760
  }
24253
23761
  /**
24254
23762
  * Get all available presets
@@ -24424,7 +23932,7 @@ var NetworkConfigurationManager = class {
24424
23932
  }
24425
23933
  });
24426
23934
  this.cleanupFunctions.push(unsubscribe);
24427
- console.log("🔄 Auto preset switching enabled");
23935
+ logger18.info("Auto preset switching enabled");
24428
23936
  }
24429
23937
  /**
24430
23938
  * Disable automatic preset monitoring
@@ -24433,7 +23941,7 @@ var NetworkConfigurationManager = class {
24433
23941
  this.monitoringEnabled = false;
24434
23942
  this.cleanupFunctions.forEach((cleanup) => cleanup());
24435
23943
  this.cleanupFunctions = [];
24436
- console.log("🔄 Auto preset switching disabled");
23944
+ logger18.info("Auto preset switching disabled");
24437
23945
  }
24438
23946
  /**
24439
23947
  * Get current active overrides for debugging
@@ -24447,7 +23955,7 @@ var NetworkConfigurationManager = class {
24447
23955
  restoreAllOverrides() {
24448
23956
  const overrides = Array.from(this.activeOverrides.values());
24449
23957
  overrides.forEach((override) => override.restore());
24450
- console.log(`🔄 Restored ${overrides.length} temporary overrides`);
23958
+ logger18.info("Restored temporary overrides", { count: overrides.length });
24451
23959
  }
24452
23960
  /**
24453
23961
  * Get configuration manager stats for debugging
@@ -24699,7 +24207,7 @@ var NetworkConfigurationManager = class {
24699
24207
  changes.push("caching");
24700
24208
  }
24701
24209
  if (changes.length > 0) {
24702
- console.log(`👤 User preferences updated: ${changes.join(", ")}`);
24210
+ logger18.info("User preferences updated", { changes });
24703
24211
  }
24704
24212
  }
24705
24213
  /**
@@ -25206,7 +24714,7 @@ function useOptimisticUpdate(key, initialData) {
25206
24714
  const nextState = {
25207
24715
  data: response.data,
25208
24716
  isValidating: response.isFetching ?? false,
25209
- error: response.error ?? void 0
24717
+ error: response.error
25210
24718
  };
25211
24719
  setState(nextState);
25212
24720
  });
@@ -25683,6 +25191,684 @@ function useDeleteCampaign(serviceOptions, mutationOptions) {
25683
25191
  })(serviceOptions, mutationOptions);
25684
25192
  }
25685
25193
  __name(useDeleteCampaign, "useDeleteCampaign");
25194
+ async function sendInfobipEmail(payload, options) {
25195
+ const client = options?.apiClient ?? getDefaultApiClient();
25196
+ if (!payload.from) {
25197
+ throw new ApiPackageError(
25198
+ "Missing required field: from",
25199
+ void 0,
25200
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25201
+ );
25202
+ }
25203
+ if (!payload.to) {
25204
+ throw new ApiPackageError(
25205
+ "Missing required field: to",
25206
+ void 0,
25207
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25208
+ );
25209
+ }
25210
+ if (!payload.subject) {
25211
+ throw new ApiPackageError(
25212
+ "Missing required field: subject",
25213
+ void 0,
25214
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25215
+ );
25216
+ }
25217
+ const serviceDefaults = {
25218
+ retry: { attempts: 0 },
25219
+ timeout: 15e3
25220
+ // 15 second timeout for email sends
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.sendEmail({
25231
+ body: payload
25232
+ });
25233
+ }
25234
+ __name(sendInfobipEmail, "sendInfobipEmail");
25235
+ async function sendInfobipAdvancedEmail(payload, options) {
25236
+ const client = options?.apiClient ?? getDefaultApiClient();
25237
+ if (!payload.messages || payload.messages.length === 0) {
25238
+ throw new ApiPackageError(
25239
+ "Missing required field: messages (must be a non-empty array)",
25240
+ void 0,
25241
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25242
+ );
25243
+ }
25244
+ for (const [index, message] of payload.messages.entries()) {
25245
+ if (!message.sender) {
25246
+ throw new ApiPackageError(
25247
+ `Missing required field: messages[${index}].sender`,
25248
+ void 0,
25249
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25250
+ );
25251
+ }
25252
+ if (!message.destinations || message.destinations.length === 0) {
25253
+ throw new ApiPackageError(
25254
+ `Missing required field: messages[${index}].destinations (must be a non-empty array)`,
25255
+ void 0,
25256
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25257
+ );
25258
+ }
25259
+ if (!message.content?.subject) {
25260
+ throw new ApiPackageError(
25261
+ `Missing required field: messages[${index}].content.subject`,
25262
+ void 0,
25263
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25264
+ );
25265
+ }
25266
+ }
25267
+ const serviceDefaults = {
25268
+ retry: { attempts: 0 },
25269
+ timeout: 15e3
25270
+ // 15 second timeout for email sends
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.sendAdvancedEmail({
25281
+ body: payload
25282
+ });
25283
+ }
25284
+ __name(sendInfobipAdvancedEmail, "sendInfobipAdvancedEmail");
25285
+ async function validateInfobipEmail(email, options) {
25286
+ const client = options?.apiClient ?? getDefaultApiClient();
25287
+ const payload = typeof email === "string" ? { to: email } : email;
25288
+ if (!payload?.to) {
25289
+ throw new ApiPackageError(
25290
+ "Missing required field: to (email address)",
25291
+ void 0,
25292
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25293
+ );
25294
+ }
25295
+ if (!payload.to.includes("@")) {
25296
+ throw new ApiPackageError(
25297
+ "Invalid email format: must contain @",
25298
+ void 0,
25299
+ api.API_ERROR_CODES.INVALID_FORMAT
25300
+ );
25301
+ }
25302
+ const serviceDefaults = {
25303
+ retry: { attempts: 2, delay: 500 },
25304
+ cacheTime: 300,
25305
+ // Cache validation results for 5 minutes
25306
+ staleTime: 600,
25307
+ // Consider stale after 10 minutes
25308
+ timeout: 5e3
25309
+ // 5 second timeout
25310
+ };
25311
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25312
+ const updateOptions = {
25313
+ strategy: "temporary",
25314
+ ...options?.updateConfigOptions
25315
+ };
25316
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25317
+ client.updateConfig(mergedConfig, updateOptions);
25318
+ }
25319
+ return client.validateEmail({
25320
+ body: payload
25321
+ });
25322
+ }
25323
+ __name(validateInfobipEmail, "validateInfobipEmail");
25324
+ async function bulkValidateInfobipEmails(payload, options) {
25325
+ const client = options?.apiClient ?? getDefaultApiClient();
25326
+ const MAX_BULK_EMAIL_VALIDATION_SIZE = 1e4;
25327
+ if (!payload.destinations || payload.destinations.length === 0) {
25328
+ throw new ApiPackageError(
25329
+ "Missing required field: destinations (must be a non-empty array)",
25330
+ void 0,
25331
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25332
+ );
25333
+ }
25334
+ if (payload.destinations.length > MAX_BULK_EMAIL_VALIDATION_SIZE) {
25335
+ throw new ApiPackageError(
25336
+ `Too many email addresses: maximum ${MAX_BULK_EMAIL_VALIDATION_SIZE} per request`,
25337
+ void 0,
25338
+ api.API_ERROR_CODES.INVALID_FORMAT
25339
+ );
25340
+ }
25341
+ const serviceDefaults = {
25342
+ retry: { attempts: 0 },
25343
+ // Don't retry bulk validation requests
25344
+ timeout: 3e4
25345
+ // 30 second timeout for bulk operations
25346
+ };
25347
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25348
+ const updateOptions = {
25349
+ strategy: "temporary",
25350
+ ...options?.updateConfigOptions
25351
+ };
25352
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25353
+ client.updateConfig(mergedConfig, updateOptions);
25354
+ }
25355
+ return client.bulkValidateEmails({
25356
+ body: payload
25357
+ });
25358
+ }
25359
+ __name(bulkValidateInfobipEmails, "bulkValidateInfobipEmails");
25360
+
25361
+ // src/api/services/infobip/email/GET/fetchEmailReports.ts
25362
+ async function fetchInfobipEmailReports(params, options) {
25363
+ const client = options?.apiClient ?? getDefaultApiClient();
25364
+ const serviceDefaults = {
25365
+ cacheTime: 30,
25366
+ // Cache for 30 seconds
25367
+ staleTime: 60,
25368
+ // Consider stale after 1 minute
25369
+ timeout: 1e4
25370
+ // 10 second timeout
25371
+ };
25372
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25373
+ const updateOptions = {
25374
+ strategy: "temporary",
25375
+ ...options?.updateConfigOptions
25376
+ };
25377
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25378
+ client.updateConfig(mergedConfig, updateOptions);
25379
+ }
25380
+ return client.getEmailReports({
25381
+ params
25382
+ });
25383
+ }
25384
+ __name(fetchInfobipEmailReports, "fetchInfobipEmailReports");
25385
+
25386
+ // src/api/services/infobip/email/GET/fetchEmailLogs.ts
25387
+ async function fetchInfobipEmailLogs(params, options) {
25388
+ const client = options?.apiClient ?? getDefaultApiClient();
25389
+ const serviceDefaults = {
25390
+ cacheTime: 60,
25391
+ // Cache for 1 minute
25392
+ staleTime: 120,
25393
+ // Consider stale after 2 minutes
25394
+ timeout: 1e4
25395
+ // 10 second timeout
25396
+ };
25397
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25398
+ const updateOptions = {
25399
+ strategy: "temporary",
25400
+ ...options?.updateConfigOptions
25401
+ };
25402
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25403
+ client.updateConfig(mergedConfig, updateOptions);
25404
+ }
25405
+ return client.getEmailLogs({
25406
+ params
25407
+ });
25408
+ }
25409
+ __name(fetchInfobipEmailLogs, "fetchInfobipEmailLogs");
25410
+
25411
+ // src/api/services/infobip/email/GET/fetchScheduledEmails.ts
25412
+ async function fetchInfobipScheduledEmails(params, options) {
25413
+ const client = options?.apiClient ?? getDefaultApiClient();
25414
+ const serviceDefaults = {
25415
+ retry: { attempts: 2, delay: 500 },
25416
+ cacheTime: 30,
25417
+ staleTime: 60,
25418
+ timeout: 1e4
25419
+ };
25420
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25421
+ const updateOptions = {
25422
+ strategy: "temporary",
25423
+ ...options?.updateConfigOptions
25424
+ };
25425
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25426
+ client.updateConfig(mergedConfig, updateOptions);
25427
+ }
25428
+ return client.getScheduledEmails({
25429
+ params
25430
+ });
25431
+ }
25432
+ __name(fetchInfobipScheduledEmails, "fetchInfobipScheduledEmails");
25433
+
25434
+ // src/api/services/infobip/email/GET/fetchScheduledEmailStatuses.ts
25435
+ async function fetchInfobipScheduledEmailStatuses(params, options) {
25436
+ const client = options?.apiClient ?? getDefaultApiClient();
25437
+ const serviceDefaults = {
25438
+ retry: { attempts: 2, delay: 500 },
25439
+ cacheTime: 30,
25440
+ staleTime: 60,
25441
+ timeout: 1e4
25442
+ };
25443
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25444
+ const updateOptions = {
25445
+ strategy: "temporary",
25446
+ ...options?.updateConfigOptions
25447
+ };
25448
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25449
+ client.updateConfig(mergedConfig, updateOptions);
25450
+ }
25451
+ return client.getScheduledEmailStatuses({
25452
+ params
25453
+ });
25454
+ }
25455
+ __name(fetchInfobipScheduledEmailStatuses, "fetchInfobipScheduledEmailStatuses");
25456
+
25457
+ // src/api/services/infobip/email/GET/fetchValidations.ts
25458
+ async function fetchInfobipValidations(params, options) {
25459
+ const client = options?.apiClient ?? getDefaultApiClient();
25460
+ const serviceDefaults = {
25461
+ retry: { attempts: 2, delay: 500 },
25462
+ cacheTime: 60,
25463
+ // Cache results for 1 minute
25464
+ staleTime: 120,
25465
+ // Consider stale after 2 minutes
25466
+ timeout: 1e4
25467
+ // 10 second timeout
25468
+ };
25469
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25470
+ const updateOptions = {
25471
+ strategy: "temporary",
25472
+ ...options?.updateConfigOptions
25473
+ };
25474
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25475
+ client.updateConfig(mergedConfig, updateOptions);
25476
+ }
25477
+ return client.getValidations({
25478
+ params
25479
+ });
25480
+ }
25481
+ __name(fetchInfobipValidations, "fetchInfobipValidations");
25482
+ async function rescheduleInfobipEmails(params, payload, options) {
25483
+ const client = options?.apiClient ?? getDefaultApiClient();
25484
+ if (!payload.sendAt) {
25485
+ throw new ApiPackageError(
25486
+ "Missing required field: sendAt",
25487
+ void 0,
25488
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25489
+ );
25490
+ }
25491
+ const serviceDefaults = {
25492
+ retry: { attempts: 1 },
25493
+ timeout: 1e4
25494
+ };
25495
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25496
+ const updateOptions = {
25497
+ strategy: "temporary",
25498
+ ...options?.updateConfigOptions
25499
+ };
25500
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25501
+ client.updateConfig(mergedConfig, updateOptions);
25502
+ }
25503
+ return client.rescheduleEmails({
25504
+ params,
25505
+ body: payload
25506
+ });
25507
+ }
25508
+ __name(rescheduleInfobipEmails, "rescheduleInfobipEmails");
25509
+ async function updateInfobipScheduledEmailStatuses(params, payload, options) {
25510
+ const client = options?.apiClient ?? getDefaultApiClient();
25511
+ if (!payload.status) {
25512
+ throw new ApiPackageError(
25513
+ "Missing required field: status",
25514
+ void 0,
25515
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25516
+ );
25517
+ }
25518
+ if (payload.status !== "PAUSED" && payload.status !== "PROCESSING") {
25519
+ throw new ApiPackageError(
25520
+ "Invalid status: must be PAUSED or PROCESSING",
25521
+ void 0,
25522
+ api.API_ERROR_CODES.INVALID_FORMAT
25523
+ );
25524
+ }
25525
+ const serviceDefaults = {
25526
+ retry: { attempts: 1 },
25527
+ timeout: 1e4
25528
+ };
25529
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25530
+ const updateOptions = {
25531
+ strategy: "temporary",
25532
+ ...options?.updateConfigOptions
25533
+ };
25534
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25535
+ client.updateConfig(mergedConfig, updateOptions);
25536
+ }
25537
+ return client.updateScheduledEmailStatuses({
25538
+ params,
25539
+ body: payload
25540
+ });
25541
+ }
25542
+ __name(updateInfobipScheduledEmailStatuses, "updateInfobipScheduledEmailStatuses");
25543
+ async function uploadFileForScanning(payload, options) {
25544
+ const client = options?.apiClient ?? getDefaultApiClient();
25545
+ if (!payload.file) {
25546
+ throw new ApiPackageError(
25547
+ "Missing required field: file",
25548
+ void 0,
25549
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25550
+ );
25551
+ }
25552
+ if (!payload.filename) {
25553
+ throw new ApiPackageError(
25554
+ "Missing required field: filename",
25555
+ void 0,
25556
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25557
+ );
25558
+ }
25559
+ if (payload.file.length === 0) {
25560
+ throw new ApiPackageError(
25561
+ "File buffer cannot be empty",
25562
+ void 0,
25563
+ api.API_ERROR_CODES.INVALID_INPUT
25564
+ );
25565
+ }
25566
+ const serviceDefaults = {
25567
+ retry: { attempts: 2 },
25568
+ // Allow retries for network issues
25569
+ timeout: 6e4
25570
+ // 60 second timeout for file uploads
25571
+ };
25572
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25573
+ const updateOptions = {
25574
+ strategy: "temporary",
25575
+ ...options?.updateConfigOptions
25576
+ };
25577
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25578
+ client.updateConfig(mergedConfig, updateOptions);
25579
+ }
25580
+ const formData = new FormData();
25581
+ const blob = new Blob([new Uint8Array(payload.file)]);
25582
+ formData.append("file", blob, payload.filename);
25583
+ return client.uploadFileForScanning({
25584
+ body: formData
25585
+ });
25586
+ }
25587
+ __name(uploadFileForScanning, "uploadFileForScanning");
25588
+ async function getAnalysisResult(payload, options) {
25589
+ const client = options?.apiClient ?? getDefaultApiClient();
25590
+ if (!payload.analysisId) {
25591
+ throw new ApiPackageError(
25592
+ "Missing required field: analysisId",
25593
+ void 0,
25594
+ api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25595
+ );
25596
+ }
25597
+ const serviceDefaults = {
25598
+ retry: { attempts: 3 },
25599
+ // Allow retries for polling
25600
+ timeout: 3e4,
25601
+ // 30 second timeout
25602
+ cacheTime: 0
25603
+ // Don't cache (results change as scan progresses)
25604
+ };
25605
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25606
+ const updateOptions = {
25607
+ strategy: "temporary",
25608
+ ...options?.updateConfigOptions
25609
+ };
25610
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25611
+ client.updateConfig(mergedConfig, updateOptions);
25612
+ }
25613
+ return client.getAnalysisResult({
25614
+ params: { id: payload.analysisId }
25615
+ });
25616
+ }
25617
+ __name(getAnalysisResult, "getAnalysisResult");
25618
+ async function cloudflarePurgeCache(payload, options) {
25619
+ const client = options?.apiClient ?? getDefaultApiClient();
25620
+ if (!payload.zoneId) {
25621
+ throw new ApiPackageError(
25622
+ "Missing required field: zoneId",
25623
+ config.HTTP_STATUS.BAD_REQUEST,
25624
+ api.API_ERROR_CODES.CLOUDFLARE_ZONE_NOT_FOUND
25625
+ );
25626
+ }
25627
+ if (!payload.apiToken) {
25628
+ throw new ApiPackageError(
25629
+ "Missing required field: apiToken",
25630
+ config.HTTP_STATUS.UNAUTHORIZED,
25631
+ api.API_ERROR_CODES.CLOUDFLARE_AUTHENTICATION_FAILED
25632
+ );
25633
+ }
25634
+ if (!payload.files || payload.files.length === 0) {
25635
+ throw new ApiPackageError(
25636
+ "Missing required field: files (must be non-empty array)",
25637
+ config.HTTP_STATUS.BAD_REQUEST,
25638
+ api.API_ERROR_CODES.CLOUDFLARE_INVALID_URL
25639
+ );
25640
+ }
25641
+ const serviceDefaults = {
25642
+ retry: { attempts: 2 },
25643
+ timeout: 3e4
25644
+ // 30 seconds
25645
+ };
25646
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25647
+ const updateOptions = {
25648
+ strategy: "temporary",
25649
+ ...options?.updateConfigOptions
25650
+ };
25651
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25652
+ client.updateConfig(mergedConfig, updateOptions);
25653
+ }
25654
+ return client.cloudflarePurgeCache({
25655
+ params: { zoneId: payload.zoneId },
25656
+ headers: {
25657
+ Authorization: `Bearer ${payload.apiToken}`
25658
+ },
25659
+ body: {
25660
+ files: payload.files,
25661
+ zoneId: payload.zoneId,
25662
+ apiToken: payload.apiToken
25663
+ }
25664
+ });
25665
+ }
25666
+ __name(cloudflarePurgeCache, "cloudflarePurgeCache");
25667
+ function generateAWSSignatureV4(options) {
25668
+ const {
25669
+ accessKeyId,
25670
+ secretAccessKey,
25671
+ sessionToken,
25672
+ region,
25673
+ service,
25674
+ method,
25675
+ path,
25676
+ queryString = "",
25677
+ headers: headers2,
25678
+ payload,
25679
+ host
25680
+ } = options;
25681
+ const timestamp = options.timestamp ?? (/* @__PURE__ */ new Date()).toISOString().replace(/[:-]|\.\d{3}/g, "");
25682
+ const dateStamp = timestamp.split("T")[0];
25683
+ const baseHeaders = { ...headers2 };
25684
+ if (!Object.keys(baseHeaders).some((h) => h.toLowerCase() === "host")) {
25685
+ baseHeaders["Host"] = host;
25686
+ }
25687
+ if (sessionToken) {
25688
+ baseHeaders["X-Amz-Security-Token"] = sessionToken;
25689
+ }
25690
+ baseHeaders["X-Amz-Date"] = timestamp;
25691
+ const canonicalHeaders = Object.keys(baseHeaders).sort().map((key) => `${key.toLowerCase()}:${baseHeaders[key].trim()}`).join("\n");
25692
+ const signedHeaders = Object.keys(baseHeaders).sort().map((key) => key.toLowerCase()).join(";");
25693
+ const payloadHash = crypto2__namespace.createHash("sha256").update(payload).digest("hex");
25694
+ const canonicalRequest = [
25695
+ method,
25696
+ path,
25697
+ queryString,
25698
+ canonicalHeaders + "\n",
25699
+ signedHeaders,
25700
+ payloadHash
25701
+ ].join("\n");
25702
+ const algorithm = "AWS4-HMAC-SHA256";
25703
+ const credentialScope = `${dateStamp}/${region}/${service}/aws4_request`;
25704
+ const canonicalRequestHash = crypto2__namespace.createHash("sha256").update(canonicalRequest).digest("hex");
25705
+ const stringToSign = [algorithm, timestamp, credentialScope, canonicalRequestHash].join("\n");
25706
+ const kDate = crypto2__namespace.createHmac("sha256", `AWS4${secretAccessKey}`).update(dateStamp).digest();
25707
+ const kRegion = crypto2__namespace.createHmac("sha256", kDate).update(region).digest();
25708
+ const kService = crypto2__namespace.createHmac("sha256", kRegion).update(service).digest();
25709
+ const kSigning = crypto2__namespace.createHmac("sha256", kService).update("aws4_request").digest();
25710
+ const signature = crypto2__namespace.createHmac("sha256", kSigning).update(stringToSign).digest("hex");
25711
+ const authorization = `${algorithm} Credential=${accessKeyId}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signature}`;
25712
+ return {
25713
+ headers: baseHeaders,
25714
+ authorization
25715
+ };
25716
+ }
25717
+ __name(generateAWSSignatureV4, "generateAWSSignatureV4");
25718
+
25719
+ // src/api/utils/aws/xml/cloudfront.ts
25720
+ function generateCloudFrontInvalidationXML(paths, callerReference) {
25721
+ const items = paths.map((path) => `<Path>${escapeXml(path)}</Path>`).join("\n ");
25722
+ return `<?xml version="1.0" encoding="UTF-8"?>
25723
+ <InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/2020-05-31/">
25724
+ <Paths>
25725
+ <Quantity>${paths.length}</Quantity>
25726
+ <Items>
25727
+ ${items}
25728
+ </Items>
25729
+ </Paths>
25730
+ <CallerReference>${escapeXml(callerReference)}</CallerReference>
25731
+ </InvalidationBatch>`;
25732
+ }
25733
+ __name(generateCloudFrontInvalidationXML, "generateCloudFrontInvalidationXML");
25734
+ function escapeXml(str) {
25735
+ const xmlEscapes = {
25736
+ "&": "&amp;",
25737
+ "<": "&lt;",
25738
+ ">": "&gt;",
25739
+ '"': "&quot;",
25740
+ "'": "&apos;"
25741
+ };
25742
+ return str.replace(/[&<>"']/g, (ch) => xmlEscapes[ch]);
25743
+ }
25744
+ __name(escapeXml, "escapeXml");
25745
+ function generateCloudFrontCallerReference(prefix = "api") {
25746
+ return `${prefix}-${Date.now()}`;
25747
+ }
25748
+ __name(generateCloudFrontCallerReference, "generateCloudFrontCallerReference");
25749
+
25750
+ // src/api/services/cdn/cloudfront/POST/cloudFrontCreateInvalidation.ts
25751
+ async function cloudFrontCreateInvalidation(payload, options) {
25752
+ const client = options?.apiClient ?? getDefaultApiClient();
25753
+ if (!payload.distributionId) {
25754
+ throw new ApiPackageError(
25755
+ "Missing required field: distributionId",
25756
+ config.HTTP_STATUS.BAD_REQUEST,
25757
+ api.API_ERROR_CODES.CLOUDFRONT_DISTRIBUTION_NOT_FOUND
25758
+ );
25759
+ }
25760
+ if (!payload.accessKeyId) {
25761
+ throw new ApiPackageError(
25762
+ "Missing required field: accessKeyId",
25763
+ config.HTTP_STATUS.UNAUTHORIZED,
25764
+ api.API_ERROR_CODES.CLOUDFRONT_AUTHENTICATION_FAILED
25765
+ );
25766
+ }
25767
+ if (!payload.secretAccessKey) {
25768
+ throw new ApiPackageError(
25769
+ "Missing required field: secretAccessKey",
25770
+ config.HTTP_STATUS.UNAUTHORIZED,
25771
+ api.API_ERROR_CODES.CLOUDFRONT_AUTHENTICATION_FAILED
25772
+ );
25773
+ }
25774
+ if (!payload.paths || payload.paths.length === 0) {
25775
+ throw new ApiPackageError(
25776
+ "Missing required field: paths (must be non-empty array)",
25777
+ config.HTTP_STATUS.BAD_REQUEST,
25778
+ api.API_ERROR_CODES.CLOUDFRONT_INVALID_PATH
25779
+ );
25780
+ }
25781
+ const region = payload.region ?? config.AWS_CLOUDFRONT_CONFIG.DEFAULT_REGION;
25782
+ const service = config.AWS_CLOUDFRONT_CONFIG.SERVICE_NAME;
25783
+ const host = config.AWS_CLOUDFRONT_CONFIG.HOST;
25784
+ const method = "POST";
25785
+ const path = `/${config.AWS_CLOUDFRONT_CONFIG.API_VERSION}/distribution/${payload.distributionId}/invalidation`;
25786
+ const callerReference = generateCloudFrontCallerReference("api");
25787
+ const body = generateCloudFrontInvalidationXML(payload.paths, callerReference);
25788
+ const { headers: signedHeaders, authorization } = generateAWSSignatureV4({
25789
+ accessKeyId: payload.accessKeyId,
25790
+ secretAccessKey: payload.secretAccessKey,
25791
+ sessionToken: payload.sessionToken,
25792
+ region,
25793
+ service,
25794
+ method,
25795
+ path,
25796
+ host,
25797
+ headers: {
25798
+ "Content-Type": "application/xml"
25799
+ },
25800
+ payload: body
25801
+ });
25802
+ const serviceDefaults = {
25803
+ retry: { attempts: 2 },
25804
+ timeout: 3e4
25805
+ // 30 seconds
25806
+ };
25807
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25808
+ const updateOptions = {
25809
+ strategy: "temporary",
25810
+ ...options?.updateConfigOptions
25811
+ };
25812
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25813
+ client.updateConfig(mergedConfig, updateOptions);
25814
+ }
25815
+ return client.cloudFrontCreateInvalidation({
25816
+ params: { distributionId: payload.distributionId },
25817
+ headers: {
25818
+ ...signedHeaders,
25819
+ Authorization: authorization
25820
+ },
25821
+ body
25822
+ });
25823
+ }
25824
+ __name(cloudFrontCreateInvalidation, "cloudFrontCreateInvalidation");
25825
+ async function fastlyPurgeUrl(payload, options) {
25826
+ const client = options?.apiClient ?? getDefaultApiClient();
25827
+ if (!payload.serviceId) {
25828
+ throw new ApiPackageError(
25829
+ "Missing required field: serviceId",
25830
+ config.HTTP_STATUS.BAD_REQUEST,
25831
+ api.API_ERROR_CODES.FASTLY_SERVICE_NOT_FOUND
25832
+ );
25833
+ }
25834
+ if (!payload.apiToken) {
25835
+ throw new ApiPackageError(
25836
+ "Missing required field: apiToken",
25837
+ config.HTTP_STATUS.UNAUTHORIZED,
25838
+ api.API_ERROR_CODES.FASTLY_AUTHENTICATION_FAILED
25839
+ );
25840
+ }
25841
+ if (!payload.url) {
25842
+ throw new ApiPackageError(
25843
+ "Missing required field: url",
25844
+ config.HTTP_STATUS.BAD_REQUEST,
25845
+ api.API_ERROR_CODES.FASTLY_INVALID_URL
25846
+ );
25847
+ }
25848
+ const serviceDefaults = {
25849
+ retry: { attempts: 2 },
25850
+ timeout: 15e3
25851
+ // 15 seconds
25852
+ };
25853
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25854
+ const updateOptions = {
25855
+ strategy: "temporary",
25856
+ ...options?.updateConfigOptions
25857
+ };
25858
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
25859
+ client.updateConfig(mergedConfig, updateOptions);
25860
+ }
25861
+ return client.fastlyPurgeUrl({
25862
+ params: {
25863
+ serviceId: payload.serviceId,
25864
+ url: encodeURIComponent(payload.url)
25865
+ },
25866
+ headers: {
25867
+ "Fastly-Key": payload.apiToken
25868
+ }
25869
+ });
25870
+ }
25871
+ __name(fastlyPurgeUrl, "fastlyPurgeUrl");
25686
25872
  function getSSRSafeConfig(config) {
25687
25873
  if (!isBrowser()) {
25688
25874
  return {
@@ -25900,17 +26086,29 @@ __name(toFetchffRevalidationConfig, "toFetchffRevalidationConfig");
25900
26086
  resources: revalidationStrategies.static
25901
26087
  });
25902
26088
 
25903
- Object.defineProperty(exports, "ErrorCategory", {
26089
+ Object.defineProperty(exports, "getErrorCategory", {
25904
26090
  enumerable: true,
25905
- get: function () { return types.ERROR_CATEGORY; }
26091
+ get: function () { return errors$1.getErrorCategory; }
25906
26092
  });
25907
- Object.defineProperty(exports, "API_ERROR_CODES", {
26093
+ Object.defineProperty(exports, "getErrorCodeByStatus", {
25908
26094
  enumerable: true,
25909
- get: function () { return api.API_ERROR_CODES; }
26095
+ get: function () { return errors$1.getErrorCodeByStatus; }
25910
26096
  });
25911
- Object.defineProperty(exports, "ERROR_DEFINITIONS", {
26097
+ Object.defineProperty(exports, "getErrorDefinition", {
26098
+ enumerable: true,
26099
+ get: function () { return errors$1.getErrorDefinition; }
26100
+ });
26101
+ Object.defineProperty(exports, "removeRevalidators", {
25912
26102
  enumerable: true,
25913
- get: function () { return api.ERROR_DEFINITIONS; }
26103
+ get: function () { return fetchff.removeRevalidators; }
26104
+ });
26105
+ Object.defineProperty(exports, "revalidate", {
26106
+ enumerable: true,
26107
+ get: function () { return fetchff.revalidate; }
26108
+ });
26109
+ Object.defineProperty(exports, "revalidateAll", {
26110
+ enumerable: true,
26111
+ get: function () { return fetchff.revalidateAll; }
25914
26112
  });
25915
26113
  Object.defineProperty(exports, "NETWORK_QUALITY", {
25916
26114
  enumerable: true,
@@ -25920,17 +26118,25 @@ Object.defineProperty(exports, "PUB_SUB_EVENT", {
25920
26118
  enumerable: true,
25921
26119
  get: function () { return api.PUB_SUB_EVENT; }
25922
26120
  });
25923
- Object.defineProperty(exports, "removeRevalidators", {
26121
+ Object.defineProperty(exports, "API_ERROR_CODES", {
25924
26122
  enumerable: true,
25925
- get: function () { return fetchff.removeRevalidators; }
26123
+ get: function () { return errors.API_ERROR_CODES; }
25926
26124
  });
25927
- Object.defineProperty(exports, "revalidate", {
26125
+ Object.defineProperty(exports, "ERROR_DEFINITIONS", {
25928
26126
  enumerable: true,
25929
- get: function () { return fetchff.revalidate; }
26127
+ get: function () { return errors.ERROR_DEFINITIONS; }
25930
26128
  });
25931
- Object.defineProperty(exports, "revalidateAll", {
26129
+ Object.defineProperty(exports, "ERROR_FIELDS", {
25932
26130
  enumerable: true,
25933
- get: function () { return fetchff.revalidateAll; }
26131
+ get: function () { return errors.COMMON_FIELDS; }
26132
+ });
26133
+ Object.defineProperty(exports, "OPERATIONS", {
26134
+ enumerable: true,
26135
+ get: function () { return errors.COMMON_OPERATIONS; }
26136
+ });
26137
+ Object.defineProperty(exports, "STORAGE_TYPES", {
26138
+ enumerable: true,
26139
+ get: function () { return errors.COMMON_STORAGE_TYPES; }
25934
26140
  });
25935
26141
  exports.ALL_EVENTS = ALL_EVENTS;
25936
26142
  exports.ApiPackageError = ApiPackageError;
@@ -25942,8 +26148,8 @@ exports.ConfigBuilder = ConfigBuilder;
25942
26148
  exports.DEBUG_EVENTS = DEBUG_EVENTS2;
25943
26149
  exports.ERROR_EVENTS = ERROR_EVENTS2;
25944
26150
  exports.EVENT_NAMESPACES = EVENT_NAMESPACES2;
25945
- exports.EVENT_SCOPES = EVENT_SCOPES2;
25946
- exports.EVENT_SCOPES_WITH_TEMPORARY = EVENT_SCOPES_WITH_TEMPORARY;
26151
+ exports.EVENT_SCOPES = EVENT_SCOPES;
26152
+ exports.EVENT_SCOPES_WITH_TEMPORARY = EVENT_SCOPES_WITH_TEMPORARY2;
25947
26153
  exports.Environment = Environment;
25948
26154
  exports.EventHelpers = EventHelpers;
25949
26155
  exports.EventManager = EventManager;
@@ -25998,6 +26204,7 @@ exports.buildCacheKey = buildCacheKey;
25998
26204
  exports.buildEndpointUrl = buildEndpointUrl;
25999
26205
  exports.buildFullUrl = buildFullUrl;
26000
26206
  exports.buildUrl = buildUrl;
26207
+ exports.bulkValidateInfobipEmails = bulkValidateInfobipEmails;
26001
26208
  exports.bytesToBase64 = bytesToBase64;
26002
26209
  exports.cacheKeyPatterns = cacheKeyPatterns;
26003
26210
  exports.cacheStrategies = cacheStrategies;
@@ -26007,6 +26214,7 @@ exports.calculatePollingDuration = calculatePollingDuration;
26007
26214
  exports.calculateRequestMetrics = calculateRequestMetrics;
26008
26215
  exports.campaignEndpoints = campaignEndpoints;
26009
26216
  exports.canPerformHeavyOperation = canPerformHeavyOperation;
26217
+ exports.cdnEndpoints = cdnEndpoints;
26010
26218
  exports.checkOverrideTriggers = checkOverrideTriggers;
26011
26219
  exports.clamp = clamp;
26012
26220
  exports.clampedPercentage = clampedPercentage;
@@ -26014,6 +26222,10 @@ exports.clearErrorHandlers = clearErrorHandlers;
26014
26222
  exports.clearNetworkDebugData = clearNetworkDebugData;
26015
26223
  exports.clearTemporaryOverrides = clearTemporaryOverrides;
26016
26224
  exports.cloneConfig = cloneConfig;
26225
+ exports.cloudFrontCreateInvalidation = cloudFrontCreateInvalidation;
26226
+ exports.cloudFrontEndpoints = cloudFrontEndpoints;
26227
+ exports.cloudflareEndpoints = cloudflareEndpoints;
26228
+ exports.cloudflarePurgeCache = cloudflarePurgeCache;
26017
26229
  exports.compactHistory = compactHistory;
26018
26230
  exports.configConflictDetector = configConflictDetector;
26019
26231
  exports.configureForEnvironment = configureForEnvironment;
@@ -26032,7 +26244,6 @@ exports.createConfigBuilder = createConfigBuilder;
26032
26244
  exports.createConfigHistoryEntry = createConfigHistoryEntry;
26033
26245
  exports.createConfigState = createConfigState;
26034
26246
  exports.createConflict = createConflict;
26035
- exports.createCorrelationIdGenerator = createCorrelationIdGenerator;
26036
26247
  exports.createCustomPreset = createCustomPreset;
26037
26248
  exports.createCustomUnifiedStrategy = createCustomUnifiedStrategy;
26038
26249
  exports.createDate = createDate;
@@ -26045,7 +26256,6 @@ exports.createEncryptionInterceptors = createEncryptionInterceptors;
26045
26256
  exports.createEventEmitter = createEventEmitter;
26046
26257
  exports.createHistoryEntry = createHistoryEntry;
26047
26258
  exports.createHistorySummary = createHistorySummary;
26048
- exports.createIdGenerator = createIdGenerator;
26049
26259
  exports.createLimitedInterval = createLimitedInterval;
26050
26260
  exports.createManagedInterval = createManagedInterval;
26051
26261
  exports.createNetworkDetectionMiddleware = createNetworkDetectionMiddleware;
@@ -26054,7 +26264,6 @@ exports.createPerformanceBenchmark = createPerformanceBenchmark;
26054
26264
  exports.createPollingStrategy = createPollingStrategy;
26055
26265
  exports.createPreservedConfig = createPreservedConfig;
26056
26266
  exports.createProgressivePolling = createProgressivePolling;
26057
- exports.createRequestIdGenerator = createRequestIdGenerator;
26058
26267
  exports.createRetryConfig = createRetryConfig;
26059
26268
  exports.createRetryStrategy = createRetryStrategy;
26060
26269
  exports.createRevalidationKey = createRevalidationKey;
@@ -26087,17 +26296,19 @@ exports.endpoints = endpoints;
26087
26296
  exports.eventManager = eventManager;
26088
26297
  exports.exportKeyToBase64 = exportKeyToBase64;
26089
26298
  exports.extendRevalidationPresets = extendPresets;
26090
- exports.extractBaseCorrelationId = extractBaseCorrelationId;
26091
- exports.extractBaseId = extractBaseId;
26092
- exports.extractBaseRequestId = extractBaseRequestId;
26093
- exports.extractCorrelationType = extractCorrelationType;
26094
26299
  exports.extractFields = extractFields;
26095
- exports.extractLinkedCorrelationIds = extractLinkedCorrelationIds;
26096
26300
  exports.extractUrlParams = extractUrlParams;
26301
+ exports.fastlyEndpoints = fastlyEndpoints;
26302
+ exports.fastlyPurgeUrl = fastlyPurgeUrl;
26097
26303
  exports.fetchCampaign = fetchCampaign;
26098
26304
  exports.fetchCampaignParticipants = fetchCampaignParticipants;
26099
26305
  exports.fetchCampaignStats = fetchCampaignStats;
26100
26306
  exports.fetchCampaigns = fetchCampaigns;
26307
+ exports.fetchInfobipEmailLogs = fetchInfobipEmailLogs;
26308
+ exports.fetchInfobipEmailReports = fetchInfobipEmailReports;
26309
+ exports.fetchInfobipScheduledEmailStatuses = fetchInfobipScheduledEmailStatuses;
26310
+ exports.fetchInfobipScheduledEmails = fetchInfobipScheduledEmails;
26311
+ exports.fetchInfobipValidations = fetchInfobipValidations;
26101
26312
  exports.filterHistory = filterHistory;
26102
26313
  exports.filterObject = filterObject;
26103
26314
  exports.findEndpointsByPattern = findEndpointsByPattern;
@@ -26109,22 +26320,11 @@ exports.formatTimeForInterval = formatTimeForInterval;
26109
26320
  exports.fromFetchffConfig = fromFetchffConfig;
26110
26321
  exports.fromISOString = fromISOString;
26111
26322
  exports.fromUnixTimestamp = fromUnixTimestamp;
26112
- exports.generateApiCorrelationId = generateApiCorrelationId;
26113
- exports.generateBaseId = generateBaseId;
26114
26323
  exports.generateComprehensiveReport = generateComprehensiveReport;
26115
- exports.generateContextualCorrelationId = generateContextualCorrelationId;
26116
- exports.generateContextualId = generateContextualId;
26117
- exports.generateContextualRequestId = generateContextualRequestId;
26118
- exports.generateCorrelationId = generateCorrelationId;
26119
26324
  exports.generateIV = generateIV;
26120
26325
  exports.generateIssueBreakdown = generateIssueBreakdown;
26121
- exports.generateNetworkCorrelationId = generateNetworkCorrelationId;
26122
26326
  exports.generateRandomKey = generateRandomKey;
26123
26327
  exports.generateRecommendations = generateRecommendations;
26124
- exports.generateRequestId = generateRequestId;
26125
- exports.generateSessionCorrelationId = generateSessionCorrelationId;
26126
- exports.generateShortRequestId = generateShortRequestId;
26127
- exports.generateTraceCorrelationId = generateTraceCorrelationId;
26128
26328
  exports.generateUUID = generateUUID;
26129
26329
  exports.getActiveOverrideKeys = getActiveOverrideKeys;
26130
26330
  exports.getAdaptiveApiConfig = getAdaptiveApiConfig;
@@ -26136,6 +26336,7 @@ exports.getAdaptiveTimeout = getAdaptiveTimeout;
26136
26336
  exports.getAllEndpointUrls = getAllEndpointUrls;
26137
26337
  exports.getAllFieldPaths = getAllFieldPaths;
26138
26338
  exports.getAllMediaExtensions = getAllMediaExtensions;
26339
+ exports.getAnalysisResult = getAnalysisResult;
26139
26340
  exports.getAppVersion = getAppVersion;
26140
26341
  exports.getAuthenticationType = getAuthenticationType;
26141
26342
  exports.getCache = getCache;
@@ -26164,9 +26365,6 @@ exports.getEntries = getEntries;
26164
26365
  exports.getEnv = getEnv;
26165
26366
  exports.getEnvironmentInfo = getEnvironmentInfo;
26166
26367
  exports.getEnvironmentName = getEnvironmentName;
26167
- exports.getErrorCategory = getErrorCategory;
26168
- exports.getErrorCodeByStatus = getErrorCodeByStatus;
26169
- exports.getErrorDefinition = getErrorDefinition;
26170
26368
  exports.getErrorHandlers = getErrorHandlers;
26171
26369
  exports.getEventManager = getEventManager;
26172
26370
  exports.getExtendedEnvironmentInfo = getExtendedEnvironmentInfo;
@@ -26254,6 +26452,8 @@ exports.importKey = importKey;
26254
26452
  exports.inBrowser = inBrowser;
26255
26453
  exports.inRange = inRange;
26256
26454
  exports.inServer = inServer;
26455
+ exports.infobipEmailEndpoints = infobipEmailEndpoints;
26456
+ exports.infobipEndpoints = infobipEndpoints;
26257
26457
  exports.invalidationScenarios = invalidationScenarios;
26258
26458
  exports.inverseLerp = inverseLerp;
26259
26459
  exports.isAbortError = isAbortError;
@@ -26317,15 +26517,12 @@ exports.isTest = isTest;
26317
26517
  exports.isToday = isToday;
26318
26518
  exports.isTouchDevice = isTouchDevice;
26319
26519
  exports.isUnifiedStrategyName = isUnifiedStrategyName;
26320
- exports.isValidCorrelationId = isValidCorrelationId;
26321
26520
  exports.isValidDate = isValidDate;
26322
26521
  exports.isValidEnumValue = isValidEnumValue;
26323
26522
  exports.isValidFieldPath = isValidFieldPath;
26324
- exports.isValidId = isValidId;
26325
26523
  exports.isValidJSON = isValidJSON;
26326
26524
  exports.isValidNumber = isValidNumber2;
26327
26525
  exports.isValidPollingConfig = isValidPollingConfig;
26328
- exports.isValidRequestId = isValidRequestId;
26329
26526
  exports.isValidRevalidationStrategyName = isValidStrategyName;
26330
26527
  exports.isWebWorker = isWebWorker;
26331
26528
  exports.isWifiConnection = isWifiConnection;
@@ -26337,7 +26534,6 @@ exports.jsonEquals = jsonEquals;
26337
26534
  exports.keyBy = keyBy;
26338
26535
  exports.leaveCampaign = leaveCampaign;
26339
26536
  exports.lerp = lerp;
26340
- exports.linkCorrelationIds = linkCorrelationIds;
26341
26537
  exports.logNetworkConfigReport = logNetworkConfigReport;
26342
26538
  exports.mapKeys = mapKeys;
26343
26539
  exports.mapObject = mapObject;
@@ -26373,7 +26569,6 @@ exports.onceErrorHandler = onceErrorHandler;
26373
26569
  exports.oneOf = oneOf;
26374
26570
  exports.parseAndValidateNumber = parseAndValidateNumber;
26375
26571
  exports.parseFieldPath = parseFieldPath;
26376
- exports.parseId = parseId;
26377
26572
  exports.percentage = percentage;
26378
26573
  exports.pick = pick;
26379
26574
  exports.pollingEndpoints = pollingEndpoints;
@@ -26394,6 +26589,7 @@ exports.removeSensitiveHeaders = removeSensitiveHeaders;
26394
26589
  exports.removeUndefined = removeUndefined;
26395
26590
  exports.requestTracker = requestTracker;
26396
26591
  exports.requestWithTimeout = requestWithTimeout;
26592
+ exports.rescheduleInfobipEmails = rescheduleInfobipEmails;
26397
26593
  exports.resetGlobalConfig = resetGlobalConfig;
26398
26594
  exports.resetRevalidationPresets = resetPresets;
26399
26595
  exports.resolveConflict = resolveConflict;
@@ -26408,6 +26604,8 @@ exports.safeParseJSON = safeParseJSON;
26408
26604
  exports.safeStringify = safeStringify;
26409
26605
  exports.sanitizeHeaders = sanitizeHeaders2;
26410
26606
  exports.secondsToMs = secondsToMs;
26607
+ exports.sendInfobipAdvancedEmail = sendInfobipAdvancedEmail;
26608
+ exports.sendInfobipEmail = sendInfobipEmail;
26411
26609
  exports.sequentialRequests = sequentialRequests;
26412
26610
  exports.setCache = setCache;
26413
26611
  exports.setConfigWarnings = setConfigWarnings;
@@ -26461,6 +26659,8 @@ exports.unifiedStrategies = unifiedStrategies;
26461
26659
  exports.unregisterErrorHandlers = unregisterErrorHandlers;
26462
26660
  exports.updateCampaign = updateCampaign;
26463
26661
  exports.updateGlobalConfig = updateGlobalConfig;
26662
+ exports.updateInfobipScheduledEmailStatuses = updateInfobipScheduledEmailStatuses;
26663
+ exports.uploadFileForScanning = uploadFileForScanning;
26464
26664
  exports.useAbortableRequest = useAbortableRequest;
26465
26665
  exports.useApiConfigConflicts = useApiConfigConflicts;
26466
26666
  exports.useApiDebugInfo = useApiDebugInfo;
@@ -26488,8 +26688,10 @@ exports.useUpdateCampaign = useUpdateCampaign;
26488
26688
  exports.validateConfigUpdate = validateConfigUpdate;
26489
26689
  exports.validateEncryptionConfig = validateEncryptionConfig;
26490
26690
  exports.validateHeaders = validateHeaders2;
26691
+ exports.validateInfobipEmail = validateInfobipEmail;
26491
26692
  exports.validatePathParams = validatePathParams;
26492
26693
  exports.validatePreset = validatePreset;
26694
+ exports.virusTotalEndpoints = virusTotalEndpoints;
26493
26695
  exports.waitForOnline = waitForOnline;
26494
26696
  exports.withNetworkDetection = withNetworkDetection;
26495
26697
  exports.withNetworkInfo = withNetworkInfo;