@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.cjs CHANGED
@@ -9148,6 +9148,9 @@ var UnifiedDebugger = class _UnifiedDebugger {
9148
9148
  performanceMode = "minimal";
9149
9149
  trackAllProperties = true;
9150
9150
  // If false, uses TRACKED_PROPERTIES filter
9151
+ // Debug report control - disabled by default, enable via config:
9152
+ // createApiClient({ debugEvents: { comprehensiveReport: true } })
9153
+ comprehensiveReportEnabled = false;
9151
9154
  // Tracking configuration from API config
9152
9155
  trackingConfig = {};
9153
9156
  // Configurable limits
@@ -9576,8 +9579,14 @@ var UnifiedDebugger = class _UnifiedDebugger {
9576
9579
  }
9577
9580
  /**
9578
9581
  * Log comprehensive report to console
9582
+ *
9583
+ * Controlled via API config: debugEvents.comprehensiveReport = true
9584
+ * Or programmatically via setComprehensiveReportEnabled(true)
9579
9585
  */
9580
9586
  async logComprehensiveReport() {
9587
+ if (!this.comprehensiveReportEnabled) {
9588
+ return;
9589
+ }
9581
9590
  try {
9582
9591
  const presetReport = this.getPresetChangeReport();
9583
9592
  if (presetReport) {
@@ -9599,6 +9608,20 @@ var UnifiedDebugger = class _UnifiedDebugger {
9599
9608
  throw error;
9600
9609
  }
9601
9610
  }
9611
+ /**
9612
+ * Enable or disable comprehensive debug report logging
9613
+ *
9614
+ * Typically configured via API config: debugEvents.comprehensiveReport
9615
+ */
9616
+ setComprehensiveReportEnabled(enabled) {
9617
+ this.comprehensiveReportEnabled = enabled;
9618
+ }
9619
+ /**
9620
+ * Get current comprehensive report enabled state
9621
+ */
9622
+ getComprehensiveReportEnabled() {
9623
+ return this.comprehensiveReportEnabled;
9624
+ }
9602
9625
  /**
9603
9626
  * Get debug report (alias for generateDebugReport for API consistency)
9604
9627
  */
@@ -16174,6 +16197,11 @@ var ClientEventManager = class _ClientEventManager {
16174
16197
  this.config.configOverride.eventScopes ??= [...api.EVENT_SCOPES];
16175
16198
  }
16176
16199
  eventManager.setEventScopes(this.config.configOverride.eventScopes);
16200
+ if (this.config.debugEvents?.comprehensiveReport !== void 0) {
16201
+ getUnifiedDebugger().setComprehensiveReportEnabled(
16202
+ this.config.debugEvents.comprehensiveReport
16203
+ );
16204
+ }
16177
16205
  this.setupEventHandlers();
16178
16206
  }
16179
16207
  static {
@@ -16817,6 +16845,7 @@ var ClientEventManager = class _ClientEventManager {
16817
16845
  /**
16818
16846
  * Start monitoring
16819
16847
  */
16848
+ // eslint-disable-next-line complexity
16820
16849
  startMonitoring() {
16821
16850
  if (this.monitoringState.monitoring) return;
16822
16851
  this.monitoringState.monitoring = true;
@@ -16831,6 +16860,9 @@ var ClientEventManager = class _ClientEventManager {
16831
16860
  const id = setInterval(() => this.getDebugInfo(), interval);
16832
16861
  this.monitoringState.intervals.push(id);
16833
16862
  }
16863
+ if (debugConfig?.comprehensiveReport !== void 0) {
16864
+ getUnifiedDebugger().setComprehensiveReportEnabled(debugConfig.comprehensiveReport);
16865
+ }
16834
16866
  }
16835
16867
  /**
16836
16868
  * Stop monitoring
@@ -17220,6 +17252,24 @@ var unifiedStrategies = {
17220
17252
  // Wait for network/resources
17221
17253
  performance: "offline"
17222
17254
  // Offline-first, maximum caching
17255
+ },
17256
+ /**
17257
+ * Mutation: POST/PUT/DELETE operations (uploads, creates, updates, deletes)
17258
+ * - NO caching (mutations should never be cached)
17259
+ * - Standard retry for actual failures
17260
+ * - NO polling (critical! - polling causes duplicate mutations)
17261
+ * - Realtime performance (immediate response)
17262
+ *
17263
+ * Use this for any data-modifying operation to prevent duplicate requests.
17264
+ */
17265
+ mutation: {
17266
+ cache: "none",
17267
+ // Never cache mutations
17268
+ retry: "standard",
17269
+ // Standard retry for actual failures (not successes)
17270
+ // NO polling - this is critical! Polling would re-execute the mutation
17271
+ performance: "realtime"
17272
+ // Immediate response, no batching
17223
17273
  }
17224
17274
  };
17225
17275
  function applyUnifiedStrategy(strategyName) {
@@ -25633,7 +25683,7 @@ __name(useCampaignParticipants, "useCampaignParticipants");
25633
25683
  // src/api/services/campaigns/POST/createCampaign.ts
25634
25684
  async function createCampaign(data, options) {
25635
25685
  const client = options?.apiClient ?? getDefaultApiClient();
25636
- const serviceDefaults = { unifiedStrategy: "realtime" };
25686
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25637
25687
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25638
25688
  const updateOptions = {
25639
25689
  strategy: "temporary",
@@ -25657,7 +25707,7 @@ async function joinCampaign(campaignId, options) {
25657
25707
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25658
25708
  );
25659
25709
  }
25660
- const serviceDefaults = { unifiedStrategy: "realtime" };
25710
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25661
25711
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25662
25712
  const updateOptions = {
25663
25713
  strategy: "temporary",
@@ -25681,7 +25731,7 @@ async function leaveCampaign(campaignId, options) {
25681
25731
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25682
25732
  );
25683
25733
  }
25684
- const serviceDefaults = { unifiedStrategy: "realtime" };
25734
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25685
25735
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25686
25736
  const updateOptions = {
25687
25737
  strategy: "temporary",
@@ -25763,7 +25813,7 @@ async function updateCampaign(campaignId, data, options) {
25763
25813
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25764
25814
  );
25765
25815
  }
25766
- const serviceDefaults = { unifiedStrategy: "realtime" };
25816
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25767
25817
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25768
25818
  const updateOptions = {
25769
25819
  strategy: "temporary",
@@ -25808,7 +25858,7 @@ async function deleteCampaign(campaignId, options) {
25808
25858
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25809
25859
  );
25810
25860
  }
25811
- const serviceDefaults = { unifiedStrategy: "realtime" };
25861
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25812
25862
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25813
25863
  const updateOptions = {
25814
25864
  strategy: "temporary",
@@ -25894,7 +25944,7 @@ async function checkFeatureFlagEnabled(payload, options) {
25894
25944
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25895
25945
  );
25896
25946
  }
25897
- const serviceDefaults = { unifiedStrategy: "realtime" };
25947
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25898
25948
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25899
25949
  const updateOptions = {
25900
25950
  strategy: "temporary",
@@ -25919,7 +25969,7 @@ async function evaluateFeatureFlag(payload, options) {
25919
25969
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25920
25970
  );
25921
25971
  }
25922
- const serviceDefaults = { unifiedStrategy: "realtime" };
25972
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25923
25973
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25924
25974
  const updateOptions = {
25925
25975
  strategy: "temporary",
@@ -25956,7 +26006,7 @@ __name(evaluateAllFeatureFlags, "evaluateAllFeatureFlags");
25956
26006
  // src/api/services/featureFlags/POST/createFeatureFlag.ts
25957
26007
  async function createFeatureFlag(data, options) {
25958
26008
  const client = options?.apiClient ?? getDefaultApiClient();
25959
- const serviceDefaults = { unifiedStrategy: "realtime" };
26009
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25960
26010
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25961
26011
  const updateOptions = {
25962
26012
  strategy: "temporary",
@@ -25980,7 +26030,7 @@ async function setFeatureFlagOverride(payload, options) {
25980
26030
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
25981
26031
  );
25982
26032
  }
25983
- const serviceDefaults = { unifiedStrategy: "realtime" };
26033
+ const serviceDefaults = { unifiedStrategy: "mutation" };
25984
26034
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
25985
26035
  const updateOptions = {
25986
26036
  strategy: "temporary",
@@ -25999,7 +26049,7 @@ __name(setFeatureFlagOverride, "setFeatureFlagOverride");
25999
26049
  // src/api/services/featureFlags/POST/refreshFeatureFlagCache.ts
26000
26050
  async function refreshFeatureFlagCache(options) {
26001
26051
  const client = options?.apiClient ?? getDefaultApiClient();
26002
- const serviceDefaults = { unifiedStrategy: "realtime" };
26052
+ const serviceDefaults = { unifiedStrategy: "mutation" };
26003
26053
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
26004
26054
  const updateOptions = {
26005
26055
  strategy: "temporary",
@@ -26043,7 +26093,7 @@ async function updateFeatureFlag(payload, options) {
26043
26093
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
26044
26094
  );
26045
26095
  }
26046
- const serviceDefaults = { unifiedStrategy: "realtime" };
26096
+ const serviceDefaults = { unifiedStrategy: "mutation" };
26047
26097
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
26048
26098
  const updateOptions = {
26049
26099
  strategy: "temporary",
@@ -26079,7 +26129,7 @@ async function deleteFeatureFlag(key, options) {
26079
26129
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
26080
26130
  );
26081
26131
  }
26082
- const serviceDefaults = { unifiedStrategy: "realtime" };
26132
+ const serviceDefaults = { unifiedStrategy: "mutation" };
26083
26133
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
26084
26134
  const updateOptions = {
26085
26135
  strategy: "temporary",
@@ -26103,7 +26153,7 @@ async function removeFeatureFlagOverride(key, options) {
26103
26153
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
26104
26154
  );
26105
26155
  }
26106
- const serviceDefaults = { unifiedStrategy: "realtime" };
26156
+ const serviceDefaults = { unifiedStrategy: "mutation" };
26107
26157
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
26108
26158
  const updateOptions = {
26109
26159
  strategy: "temporary",
@@ -26927,7 +26977,7 @@ __name(useGetSignedUrl, "useGetSignedUrl");
26927
26977
  async function uploadFile(data, options) {
26928
26978
  const client = options?.apiClient ?? getDefaultApiClient();
26929
26979
  const serviceDefaults = {
26930
- unifiedStrategy: "realtime",
26980
+ unifiedStrategy: "mutation",
26931
26981
  timeout: 6e4
26932
26982
  // 60 seconds for uploads
26933
26983
  };
@@ -26949,7 +26999,7 @@ __name(uploadFile, "uploadFile");
26949
26999
  async function uploadFiles(data, options) {
26950
27000
  const client = options?.apiClient ?? getDefaultApiClient();
26951
27001
  const serviceDefaults = {
26952
- unifiedStrategy: "realtime",
27002
+ unifiedStrategy: "mutation",
26953
27003
  timeout: 12e4
26954
27004
  // 2 minutes for bulk uploads
26955
27005
  };
@@ -26971,7 +27021,7 @@ __name(uploadFiles, "uploadFiles");
26971
27021
  async function generateDocument(data, options) {
26972
27022
  const client = options?.apiClient ?? getDefaultApiClient();
26973
27023
  const serviceDefaults = {
26974
- unifiedStrategy: "realtime",
27024
+ unifiedStrategy: "mutation",
26975
27025
  timeout: 3e4
26976
27026
  // 30 seconds for document generation
26977
27027
  };
@@ -27031,7 +27081,7 @@ async function deleteFile(request, options) {
27031
27081
  api.API_ERROR_CODES.REQUIRED_FIELD_MISSING
27032
27082
  );
27033
27083
  }
27034
- const serviceDefaults = { unifiedStrategy: "realtime" };
27084
+ const serviceDefaults = { unifiedStrategy: "mutation" };
27035
27085
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
27036
27086
  const updateOptions = {
27037
27087
  strategy: "temporary",