@plyaz/api 1.6.8 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -9132,6 +9132,9 @@ var UnifiedDebugger = class _UnifiedDebugger {
9132
9132
  performanceMode = "minimal";
9133
9133
  trackAllProperties = true;
9134
9134
  // If false, uses TRACKED_PROPERTIES filter
9135
+ // Debug report control - disabled by default, enable via config:
9136
+ // createApiClient({ debugEvents: { comprehensiveReport: true } })
9137
+ comprehensiveReportEnabled = false;
9135
9138
  // Tracking configuration from API config
9136
9139
  trackingConfig = {};
9137
9140
  // Configurable limits
@@ -9560,8 +9563,14 @@ var UnifiedDebugger = class _UnifiedDebugger {
9560
9563
  }
9561
9564
  /**
9562
9565
  * Log comprehensive report to console
9566
+ *
9567
+ * Controlled via API config: debugEvents.comprehensiveReport = true
9568
+ * Or programmatically via setComprehensiveReportEnabled(true)
9563
9569
  */
9564
9570
  async logComprehensiveReport() {
9571
+ if (!this.comprehensiveReportEnabled) {
9572
+ return;
9573
+ }
9565
9574
  try {
9566
9575
  const presetReport = this.getPresetChangeReport();
9567
9576
  if (presetReport) {
@@ -9583,6 +9592,20 @@ var UnifiedDebugger = class _UnifiedDebugger {
9583
9592
  throw error;
9584
9593
  }
9585
9594
  }
9595
+ /**
9596
+ * Enable or disable comprehensive debug report logging
9597
+ *
9598
+ * Typically configured via API config: debugEvents.comprehensiveReport
9599
+ */
9600
+ setComprehensiveReportEnabled(enabled) {
9601
+ this.comprehensiveReportEnabled = enabled;
9602
+ }
9603
+ /**
9604
+ * Get current comprehensive report enabled state
9605
+ */
9606
+ getComprehensiveReportEnabled() {
9607
+ return this.comprehensiveReportEnabled;
9608
+ }
9586
9609
  /**
9587
9610
  * Get debug report (alias for generateDebugReport for API consistency)
9588
9611
  */
@@ -16158,6 +16181,11 @@ var ClientEventManager = class _ClientEventManager {
16158
16181
  this.config.configOverride.eventScopes ??= [...EVENT_SCOPES$1];
16159
16182
  }
16160
16183
  eventManager.setEventScopes(this.config.configOverride.eventScopes);
16184
+ if (this.config.debugEvents?.comprehensiveReport !== void 0) {
16185
+ getUnifiedDebugger().setComprehensiveReportEnabled(
16186
+ this.config.debugEvents.comprehensiveReport
16187
+ );
16188
+ }
16161
16189
  this.setupEventHandlers();
16162
16190
  }
16163
16191
  static {
@@ -16801,6 +16829,7 @@ var ClientEventManager = class _ClientEventManager {
16801
16829
  /**
16802
16830
  * Start monitoring
16803
16831
  */
16832
+ // eslint-disable-next-line complexity
16804
16833
  startMonitoring() {
16805
16834
  if (this.monitoringState.monitoring) return;
16806
16835
  this.monitoringState.monitoring = true;
@@ -16815,6 +16844,9 @@ var ClientEventManager = class _ClientEventManager {
16815
16844
  const id = setInterval(() => this.getDebugInfo(), interval);
16816
16845
  this.monitoringState.intervals.push(id);
16817
16846
  }
16847
+ if (debugConfig?.comprehensiveReport !== void 0) {
16848
+ getUnifiedDebugger().setComprehensiveReportEnabled(debugConfig.comprehensiveReport);
16849
+ }
16818
16850
  }
16819
16851
  /**
16820
16852
  * Stop monitoring
@@ -17204,6 +17236,24 @@ var unifiedStrategies = {
17204
17236
  // Wait for network/resources
17205
17237
  performance: "offline"
17206
17238
  // Offline-first, maximum caching
17239
+ },
17240
+ /**
17241
+ * Mutation: POST/PUT/DELETE operations (uploads, creates, updates, deletes)
17242
+ * - NO caching (mutations should never be cached)
17243
+ * - Standard retry for actual failures
17244
+ * - NO polling (critical! - polling causes duplicate mutations)
17245
+ * - Realtime performance (immediate response)
17246
+ *
17247
+ * Use this for any data-modifying operation to prevent duplicate requests.
17248
+ */
17249
+ mutation: {
17250
+ cache: "none",
17251
+ // Never cache mutations
17252
+ retry: "standard",
17253
+ // Standard retry for actual failures (not successes)
17254
+ // NO polling - this is critical! Polling would re-execute the mutation
17255
+ performance: "realtime"
17256
+ // Immediate response, no batching
17207
17257
  }
17208
17258
  };
17209
17259
  function applyUnifiedStrategy(strategyName) {
@@ -25617,7 +25667,7 @@ __name(useCampaignParticipants, "useCampaignParticipants");
25617
25667
  // src/api/services/campaigns/POST/createCampaign.ts
25618
25668
  async function createCampaign(data, options) {
25619
25669
  const client = options?.apiClient ?? getDefaultApiClient();
25620
- const serviceDefaults = { unifiedStrategy: "realtime" };
25670
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25621
25671
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25622
25672
  const updateOptions = {
25623
25673
  strategy: "temporary",
@@ -25641,7 +25691,7 @@ async function joinCampaign(campaignId, options) {
25641
25691
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
25642
25692
  );
25643
25693
  }
25644
- const serviceDefaults = { unifiedStrategy: "realtime" };
25694
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25645
25695
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25646
25696
  const updateOptions = {
25647
25697
  strategy: "temporary",
@@ -25665,7 +25715,7 @@ async function leaveCampaign(campaignId, options) {
25665
25715
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
25666
25716
  );
25667
25717
  }
25668
- const serviceDefaults = { unifiedStrategy: "realtime" };
25718
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25669
25719
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25670
25720
  const updateOptions = {
25671
25721
  strategy: "temporary",
@@ -25747,7 +25797,7 @@ async function updateCampaign(campaignId, data, options) {
25747
25797
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
25748
25798
  );
25749
25799
  }
25750
- const serviceDefaults = { unifiedStrategy: "realtime" };
25800
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25751
25801
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25752
25802
  const updateOptions = {
25753
25803
  strategy: "temporary",
@@ -25792,7 +25842,7 @@ async function deleteCampaign(campaignId, options) {
25792
25842
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
25793
25843
  );
25794
25844
  }
25795
- const serviceDefaults = { unifiedStrategy: "realtime" };
25845
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25796
25846
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25797
25847
  const updateOptions = {
25798
25848
  strategy: "temporary",
@@ -25878,7 +25928,7 @@ async function checkFeatureFlagEnabled(payload, options) {
25878
25928
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
25879
25929
  );
25880
25930
  }
25881
- const serviceDefaults = { unifiedStrategy: "realtime" };
25931
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25882
25932
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25883
25933
  const updateOptions = {
25884
25934
  strategy: "temporary",
@@ -25903,7 +25953,7 @@ async function evaluateFeatureFlag(payload, options) {
25903
25953
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
25904
25954
  );
25905
25955
  }
25906
- const serviceDefaults = { unifiedStrategy: "realtime" };
25956
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25907
25957
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25908
25958
  const updateOptions = {
25909
25959
  strategy: "temporary",
@@ -25940,7 +25990,7 @@ __name(evaluateAllFeatureFlags, "evaluateAllFeatureFlags");
25940
25990
  // src/api/services/featureFlags/POST/createFeatureFlag.ts
25941
25991
  async function createFeatureFlag(data, options) {
25942
25992
  const client = options?.apiClient ?? getDefaultApiClient();
25943
- const serviceDefaults = { unifiedStrategy: "realtime" };
25993
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25944
25994
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25945
25995
  const updateOptions = {
25946
25996
  strategy: "temporary",
@@ -25964,7 +26014,7 @@ async function setFeatureFlagOverride(payload, options) {
25964
26014
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
25965
26015
  );
25966
26016
  }
25967
- const serviceDefaults = { unifiedStrategy: "realtime" };
26017
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25968
26018
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25969
26019
  const updateOptions = {
25970
26020
  strategy: "temporary",
@@ -25983,7 +26033,7 @@ __name(setFeatureFlagOverride, "setFeatureFlagOverride");
25983
26033
  // src/api/services/featureFlags/POST/refreshFeatureFlagCache.ts
25984
26034
  async function refreshFeatureFlagCache(options) {
25985
26035
  const client = options?.apiClient ?? getDefaultApiClient();
25986
- const serviceDefaults = { unifiedStrategy: "realtime" };
26036
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25987
26037
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25988
26038
  const updateOptions = {
25989
26039
  strategy: "temporary",
@@ -26027,7 +26077,7 @@ async function updateFeatureFlag(payload, options) {
26027
26077
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
26028
26078
  );
26029
26079
  }
26030
- const serviceDefaults = { unifiedStrategy: "realtime" };
26080
+ const serviceDefaults = { unifiedStrategy: "mutation" };
26031
26081
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
26032
26082
  const updateOptions = {
26033
26083
  strategy: "temporary",
@@ -26063,7 +26113,7 @@ async function deleteFeatureFlag(key, options) {
26063
26113
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
26064
26114
  );
26065
26115
  }
26066
- const serviceDefaults = { unifiedStrategy: "realtime" };
26116
+ const serviceDefaults = { unifiedStrategy: "mutation" };
26067
26117
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
26068
26118
  const updateOptions = {
26069
26119
  strategy: "temporary",
@@ -26087,7 +26137,7 @@ async function removeFeatureFlagOverride(key, options) {
26087
26137
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
26088
26138
  );
26089
26139
  }
26090
- const serviceDefaults = { unifiedStrategy: "realtime" };
26140
+ const serviceDefaults = { unifiedStrategy: "mutation" };
26091
26141
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
26092
26142
  const updateOptions = {
26093
26143
  strategy: "temporary",
@@ -26911,7 +26961,7 @@ __name(useGetSignedUrl, "useGetSignedUrl");
26911
26961
  async function uploadFile(data, options) {
26912
26962
  const client = options?.apiClient ?? getDefaultApiClient();
26913
26963
  const serviceDefaults = {
26914
- unifiedStrategy: "realtime",
26964
+ unifiedStrategy: "mutation",
26915
26965
  timeout: 6e4
26916
26966
  // 60 seconds for uploads
26917
26967
  };
@@ -26933,7 +26983,7 @@ __name(uploadFile, "uploadFile");
26933
26983
  async function uploadFiles(data, options) {
26934
26984
  const client = options?.apiClient ?? getDefaultApiClient();
26935
26985
  const serviceDefaults = {
26936
- unifiedStrategy: "realtime",
26986
+ unifiedStrategy: "mutation",
26937
26987
  timeout: 12e4
26938
26988
  // 2 minutes for bulk uploads
26939
26989
  };
@@ -26955,7 +27005,7 @@ __name(uploadFiles, "uploadFiles");
26955
27005
  async function generateDocument(data, options) {
26956
27006
  const client = options?.apiClient ?? getDefaultApiClient();
26957
27007
  const serviceDefaults = {
26958
- unifiedStrategy: "realtime",
27008
+ unifiedStrategy: "mutation",
26959
27009
  timeout: 3e4
26960
27010
  // 30 seconds for document generation
26961
27011
  };
@@ -27015,7 +27065,7 @@ async function deleteFile(request, options) {
27015
27065
  API_ERROR_CODES.REQUIRED_FIELD_MISSING
27016
27066
  );
27017
27067
  }
27018
- const serviceDefaults = { unifiedStrategy: "realtime" };
27068
+ const serviceDefaults = { unifiedStrategy: "mutation" };
27019
27069
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
27020
27070
  const updateOptions = {
27021
27071
  strategy: "temporary",