@plyaz/api 1.7.3 → 1.8.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 (34) hide show
  1. package/dist/api/cache/strategies.d.ts.map +1 -1
  2. package/dist/api/client/createApiClient.d.ts.map +1 -1
  3. package/dist/api/client/helpers/interceptors.d.ts +2 -2
  4. package/dist/api/client/helpers/interceptors.d.ts.map +1 -1
  5. package/dist/api/endpoints/index.d.ts +9 -0
  6. package/dist/api/endpoints/index.d.ts.map +1 -1
  7. package/dist/api/endpoints/notification.d.ts +72 -0
  8. package/dist/api/endpoints/notification.d.ts.map +1 -0
  9. package/dist/api/services/index.d.ts +1 -0
  10. package/dist/api/services/index.d.ts.map +1 -1
  11. package/dist/api/services/notification/DELETE/deleteNotification.d.ts +25 -0
  12. package/dist/api/services/notification/DELETE/deleteNotification.d.ts.map +1 -0
  13. package/dist/api/services/notification/DELETE/index.d.ts +12 -0
  14. package/dist/api/services/notification/DELETE/index.d.ts.map +1 -0
  15. package/dist/api/services/notification/DELETE/useDeleteNotification.d.ts +34 -0
  16. package/dist/api/services/notification/DELETE/useDeleteNotification.d.ts.map +1 -0
  17. package/dist/api/services/notification/GET/fetchNotifications.d.ts +26 -0
  18. package/dist/api/services/notification/GET/fetchNotifications.d.ts.map +1 -0
  19. package/dist/api/services/notification/GET/index.d.ts +12 -0
  20. package/dist/api/services/notification/GET/index.d.ts.map +1 -0
  21. package/dist/api/services/notification/GET/useNotifications.d.ts +32 -0
  22. package/dist/api/services/notification/GET/useNotifications.d.ts.map +1 -0
  23. package/dist/api/services/notification/index.d.ts +14 -0
  24. package/dist/api/services/notification/index.d.ts.map +1 -0
  25. package/dist/api/strategies/unified.d.ts.map +1 -1
  26. package/dist/entry-frontend.cjs +196 -23
  27. package/dist/entry-frontend.cjs.map +1 -1
  28. package/dist/entry-frontend.mjs +192 -24
  29. package/dist/entry-frontend.mjs.map +1 -1
  30. package/dist/index.cjs +196 -23
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.mjs +192 -24
  33. package/dist/index.mjs.map +1 -1
  34. package/package.json +2 -2
@@ -12856,10 +12856,17 @@ __name(createStatusCodeLimits, "createStatusCodeLimits");
12856
12856
  var cacheStrategies = {
12857
12857
  /**
12858
12858
  * No caching - always fetch fresh data
12859
- * Use for: Real-time data, sensitive information
12859
+ * Use for: Real-time data, sensitive information, mutations
12860
+ *
12861
+ * IMPORTANT: Explicit ttl/stale of 0 prevents staleTime refetch issues.
12862
+ * The skip:true alone doesn't prevent default staleTime from being applied.
12860
12863
  */
12861
12864
  none: {
12862
- skip: true
12865
+ skip: true,
12866
+ ttl: 0,
12867
+ // No caching
12868
+ stale: 0
12869
+ // No stale refetch (prevents 60s re-trigger issue)
12863
12870
  },
12864
12871
  /**
12865
12872
  * Short-lived cache for frequently changing data
@@ -14240,6 +14247,32 @@ var cdnEndpoints = {
14240
14247
  ...fastlyEndpoints
14241
14248
  };
14242
14249
 
14250
+ // src/api/endpoints/notification.ts
14251
+ var notificationEndpoints = {
14252
+ // ==========================================================================
14253
+ // GET ENDPOINTS
14254
+ // ==========================================================================
14255
+ /**
14256
+ * GET /notifications
14257
+ * List all notifications with optional filters
14258
+ */
14259
+ listNotifications: {
14260
+ url: "/notifications",
14261
+ method: "GET"
14262
+ },
14263
+ // ==========================================================================
14264
+ // DELETE ENDPOINTS
14265
+ // ==========================================================================
14266
+ /**
14267
+ * DELETE /notifications/:id
14268
+ * Delete a notification
14269
+ */
14270
+ deleteNotification: {
14271
+ url: "/notifications/:id",
14272
+ method: "DELETE"
14273
+ }
14274
+ };
14275
+
14243
14276
  // src/api/endpoints/utils.ts
14244
14277
  function getEndpointUrl(name) {
14245
14278
  return endpoints[name].url;
@@ -14424,7 +14457,8 @@ var endpoints = {
14424
14457
  // CDN provider endpoints (Cloudflare, CloudFront, Fastly)
14425
14458
  ...cloudflareEndpoints,
14426
14459
  ...cloudFrontEndpoints,
14427
- ...fastlyEndpoints
14460
+ ...fastlyEndpoints,
14461
+ ...notificationEndpoints
14428
14462
  };
14429
14463
  var isSlowConnection = fetchff.isSlowConnection;
14430
14464
  function isNetworkAPISupported() {
@@ -17244,18 +17278,19 @@ var unifiedStrategies = {
17244
17278
  },
17245
17279
  /**
17246
17280
  * Mutation: POST/PUT/DELETE operations (uploads, creates, updates, deletes)
17247
- * - NO caching (mutations should never be cached)
17248
- * - Standard retry for actual failures
17281
+ * - NO caching (cache: 'none' sets skip:true, ttl:0, stale:0 - prevents staleTime refetch!)
17282
+ * - Conservative retry (allows retry on server errors 500/502/503/504)
17249
17283
  * - NO polling (critical! - polling causes duplicate mutations)
17250
17284
  * - Realtime performance (immediate response)
17251
17285
  *
17252
- * Use this for any data-modifying operation to prevent duplicate requests.
17286
+ * Note: The retry is safe because it only triggers on actual errors (5xx).
17287
+ * The staleTime refetch issue was fixed by setting stale:0 in cache:'none'.
17253
17288
  */
17254
17289
  mutation: {
17255
17290
  cache: "none",
17256
- // Never cache mutations
17257
- retry: "none",
17258
- // No retry - mutations should not auto-retry to prevent duplicates
17291
+ // Never cache mutations (ttl:0, stale:0 prevents refetch)
17292
+ retry: "conservative",
17293
+ // Retry on server errors (500/502/503/504) only
17259
17294
  // NO polling - this is critical! Polling would re-execute the mutation
17260
17295
  performance: "realtime"
17261
17296
  // Immediate response, no batching
@@ -21539,10 +21574,28 @@ function mergeHeadersCaseInsensitive(...headerSets) {
21539
21574
  return result;
21540
21575
  }
21541
21576
  __name(mergeHeadersCaseInsensitive, "mergeHeadersCaseInsensitive");
21542
- function createOnRequestHandler(handlers, enrichedHeadersConfig, encryptionConfig, configStrategy) {
21577
+ function createOnRequestHandler(options) {
21578
+ const {
21579
+ handlers,
21580
+ enrichedHeadersConfig,
21581
+ encryptionConfig,
21582
+ configStrategy,
21583
+ getResolvedFetchffConfig
21584
+ } = options;
21543
21585
  return async (config) => {
21544
21586
  const performanceFactory = getPerformanceEventFactory();
21545
21587
  const requestId = errors$1.generateRequestId();
21588
+ if (getResolvedFetchffConfig) {
21589
+ const resolvedConfig = getResolvedFetchffConfig();
21590
+ config = {
21591
+ ...config,
21592
+ ...resolvedConfig,
21593
+ headers: {
21594
+ ...resolvedConfig.headers,
21595
+ ...config.headers
21596
+ }
21597
+ };
21598
+ }
21546
21599
  startRequestTracking(requestId);
21547
21600
  UnifiedDebugger.getInstance().trackConfigChange(
21548
21601
  { headers: config.headers },
@@ -21711,7 +21764,8 @@ function setupUnifiedHandlers(params) {
21711
21764
  enrichedHeadersConfig,
21712
21765
  globalConfig,
21713
21766
  clientOptions,
21714
- clearTemporaryOverrides: clearTemporaryOverrides2
21767
+ clearTemporaryOverrides: clearTemporaryOverrides2,
21768
+ getResolvedFetchffConfig
21715
21769
  } = params;
21716
21770
  const mergedOnRequest = mergeHandlers(
21717
21771
  globalConfig?.onRequest,
@@ -21737,12 +21791,13 @@ function setupUnifiedHandlers(params) {
21737
21791
  const encryptionConfig = mergedConfig.encryption ?? globalConfig?.encryption ?? clientOptions?.encryption;
21738
21792
  const configStrategy = mergedConfig.configOverride?.strategy ?? clientOptions?.configOverride?.strategy ?? globalConfig?.configOverride?.strategy ?? "merge";
21739
21793
  return {
21740
- onRequest: createOnRequestHandler(
21741
- mergedOnRequest,
21794
+ onRequest: createOnRequestHandler({
21795
+ handlers: mergedOnRequest,
21742
21796
  enrichedHeadersConfig,
21743
21797
  encryptionConfig,
21744
- configStrategy
21745
- ),
21798
+ configStrategy,
21799
+ getResolvedFetchffConfig
21800
+ }),
21746
21801
  onResponse: createOnResponseHandler(
21747
21802
  mergedOnResponse,
21748
21803
  clearTemporaryOverrides2,
@@ -22097,15 +22152,21 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
22097
22152
  const validation = validateConfigUpdate(updates, updateOptions);
22098
22153
  if (!validation.valid) {
22099
22154
  handleInvalidConfigUpdate(validation, updates, updateOptions);
22100
- return;
22155
+ return { fetchffConfig: {}, applied: false };
22101
22156
  }
22102
22157
  const result = applyConfigUpdate(configState, updates, updateOptions);
22103
22158
  configState = result.state;
22104
22159
  setConfigState(configState);
22105
22160
  const newConfig = getEffectiveConfig(configState);
22161
+ let resolvedUpdates = { ...updates };
22162
+ if (updates.unifiedStrategy) {
22163
+ resolvedUpdates = applyUnifiedStrategyToConfig(resolvedUpdates, updates.unifiedStrategy);
22164
+ }
22165
+ resolvedUpdates = applyIndividualStrategies(resolvedUpdates, updates);
22166
+ const fetchffConfig = toFetchffConfig(resolvedUpdates);
22106
22167
  if (client && "__config" in client) {
22107
22168
  const fetchffClient = client;
22108
- Object.assign(fetchffClient["__config"], updates);
22169
+ Object.assign(fetchffClient["__config"], fetchffConfig);
22109
22170
  }
22110
22171
  eventManager2.updateConfig(updates, updateOptions ?? {});
22111
22172
  const afterEventState = captureEventState(eventManager2);
@@ -22119,11 +22180,13 @@ function createUpdateConfigMethod(initialConfigState, eventManager2, client, set
22119
22180
  validation,
22120
22181
  startTime
22121
22182
  });
22183
+ return { fetchffConfig, applied: true };
22122
22184
  };
22123
22185
  }
22124
22186
  __name(createUpdateConfigMethod, "createUpdateConfigMethod");
22125
- function createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers) {
22126
- return fetchff.createApiFetcher({
22187
+ function createFetchffClient(params) {
22188
+ const { fetchffConfig, effectiveConfig, options, unifiedHandlers, getResolvedFetchffConfig } = params;
22189
+ const rawClient = fetchff.createApiFetcher({
22127
22190
  ...fetchffConfig,
22128
22191
  baseURL: effectiveConfig.baseURL ?? options.apiUrl,
22129
22192
  endpoints,
@@ -22132,6 +22195,26 @@ function createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHan
22132
22195
  onError: unifiedHandlers.onError,
22133
22196
  onRetry: unifiedHandlers.onRetry
22134
22197
  });
22198
+ const endpointMethodNames = new Set(Object.keys(endpoints));
22199
+ return new Proxy(rawClient, {
22200
+ get(target, prop, receiver) {
22201
+ const value = Reflect.get(target, prop, receiver);
22202
+ if (typeof value !== "function" || typeof prop !== "string") {
22203
+ return value;
22204
+ }
22205
+ if (!endpointMethodNames.has(prop)) {
22206
+ return value;
22207
+ }
22208
+ return /* @__PURE__ */ __name(function wrappedEndpointMethod(config) {
22209
+ const resolvedConfig = getResolvedFetchffConfig();
22210
+ const mergedConfig = {
22211
+ ...resolvedConfig,
22212
+ ...config
22213
+ };
22214
+ return value.call(this, mergedConfig);
22215
+ }, "wrappedEndpointMethod");
22216
+ }
22217
+ });
22135
22218
  }
22136
22219
  __name(createFetchffClient, "createFetchffClient");
22137
22220
  function enhanceClientWithMethods(params) {
@@ -22216,14 +22299,33 @@ async function createApiClient(options = {}) {
22216
22299
  const effectiveConfig = getEffectiveConfig(stateContainer.current);
22217
22300
  const fetchffConfig = toFetchffConfig(effectiveConfig);
22218
22301
  let clearTemporaryOverridesFn;
22302
+ const getResolvedFetchffConfig = /* @__PURE__ */ __name(() => {
22303
+ const currentConfig = getEffectiveConfig(stateContainer.current);
22304
+ let resolvedConfig2 = { ...currentConfig };
22305
+ if (currentConfig.unifiedStrategy) {
22306
+ resolvedConfig2 = applyUnifiedStrategyToConfig(
22307
+ resolvedConfig2,
22308
+ currentConfig.unifiedStrategy
22309
+ );
22310
+ }
22311
+ resolvedConfig2 = applyIndividualStrategies(resolvedConfig2, currentConfig);
22312
+ return toFetchffConfig(resolvedConfig2);
22313
+ }, "getResolvedFetchffConfig");
22219
22314
  const unifiedHandlers = setupUnifiedHandlers({
22220
22315
  mergedConfig: effectiveConfig,
22221
22316
  enrichedHeadersConfig: options.enrichedHeaders,
22222
22317
  globalConfig,
22223
22318
  clientOptions: options,
22224
- clearTemporaryOverrides: /* @__PURE__ */ __name(() => clearTemporaryOverridesFn?.(), "clearTemporaryOverrides")
22319
+ clearTemporaryOverrides: /* @__PURE__ */ __name(() => clearTemporaryOverridesFn?.(), "clearTemporaryOverrides"),
22320
+ getResolvedFetchffConfig
22321
+ });
22322
+ const client = createFetchffClient({
22323
+ fetchffConfig,
22324
+ effectiveConfig,
22325
+ options,
22326
+ unifiedHandlers,
22327
+ getResolvedFetchffConfig
22225
22328
  });
22226
- const client = createFetchffClient(fetchffConfig, effectiveConfig, options, unifiedHandlers);
22227
22329
  const clientWithEvents = setupClientEvents(client, globalConfig, options);
22228
22330
  const { eventManager: eventManager2 } = clientWithEvents;
22229
22331
  Object.defineProperty(clientWithEvents, "then", {
@@ -23776,8 +23878,8 @@ async function uploadFile(data, options) {
23776
23878
  const client = options?.apiClient ?? getDefaultApiClient();
23777
23879
  const serviceDefaults = {
23778
23880
  unifiedStrategy: "mutation",
23779
- timeout: 6e4
23780
- // 60 seconds for uploads
23881
+ timeout: 12e4
23882
+ // 2 minutes for large uploads
23781
23883
  };
23782
23884
  const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
23783
23885
  const updateOptions = {
@@ -23911,6 +24013,72 @@ function useDeleteFile(serviceOptions, mutationOptions) {
23911
24013
  })(serviceOptions, mutationOptions);
23912
24014
  }
23913
24015
  __name(useDeleteFile, "useDeleteFile");
24016
+
24017
+ // src/api/services/notification/GET/fetchNotifications.ts
24018
+ async function fetchNotifications(filters, options) {
24019
+ const client = options?.apiClient ?? getDefaultApiClient();
24020
+ const serviceDefaults = { unifiedStrategy: "interactive" };
24021
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
24022
+ const updateOptions = {
24023
+ strategy: "temporary",
24024
+ ...options?.updateConfigOptions
24025
+ };
24026
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
24027
+ client.updateConfig(mergedConfig, updateOptions);
24028
+ }
24029
+ return client.listNotifications({
24030
+ params: filters
24031
+ });
24032
+ }
24033
+ __name(fetchNotifications, "fetchNotifications");
24034
+ function useNotifications(queryKey, filters, serviceOptions, queryOptions) {
24035
+ return createApiQuery(fetchNotifications, {
24036
+ apiConfig: {
24037
+ unifiedStrategy: "interactive"
24038
+ },
24039
+ staleTime: config.TIME_CONSTANTS.TEN_MINUTES
24040
+ })(queryKey, filters, serviceOptions, queryOptions);
24041
+ }
24042
+ __name(useNotifications, "useNotifications");
24043
+
24044
+ // src/api/services/notification/DELETE/deleteNotification.ts
24045
+ async function deleteNotification(id, options) {
24046
+ const client = options?.apiClient ?? getDefaultApiClient();
24047
+ const serviceDefaults = {
24048
+ unifiedStrategy: "mutation"
24049
+ };
24050
+ const mergedConfig = mergeConfigs(serviceDefaults, options?.apiConfig ?? {});
24051
+ const updateOptions = {
24052
+ strategy: "temporary",
24053
+ ...options?.updateConfigOptions
24054
+ };
24055
+ if (shouldApplyConfig(mergedConfig, updateOptions)) {
24056
+ client.updateConfig(mergedConfig, updateOptions);
24057
+ }
24058
+ const pathParams = { id };
24059
+ return client.deleteNotification({
24060
+ urlPathParams: pathParams
24061
+ });
24062
+ }
24063
+ __name(deleteNotification, "deleteNotification");
24064
+ function useDeleteNotification(serviceOptions, mutationOptions) {
24065
+ const queryClient = reactQuery.useQueryClient();
24066
+ return createApiMutation(
24067
+ deleteNotification,
24068
+ {
24069
+ onSuccess: /* @__PURE__ */ __name((_data, id) => {
24070
+ void queryClient.invalidateQueries({
24071
+ queryKey: ["notifications"]
24072
+ });
24073
+ queryClient.removeQueries({
24074
+ queryKey: ["notification", id]
24075
+ });
24076
+ }, "onSuccess"),
24077
+ ...mutationOptions
24078
+ }
24079
+ )(serviceOptions, mutationOptions);
24080
+ }
24081
+ __name(useDeleteNotification, "useDeleteNotification");
23914
24082
  function useApiConfigConflicts(client, options = {}) {
23915
24083
  const [conflicts, setConflicts] = react.useState([]);
23916
24084
  const [isChecking, setIsChecking] = react.useState(false);
@@ -26531,6 +26699,7 @@ exports.deleteCache = deleteCache;
26531
26699
  exports.deleteCampaign = deleteCampaign;
26532
26700
  exports.deleteFeatureFlag = deleteFeatureFlag;
26533
26701
  exports.deleteFile = deleteFile;
26702
+ exports.deleteNotification = deleteNotification;
26534
26703
  exports.detectConfigConflicts = detectConfigConflicts;
26535
26704
  exports.detectConflicts = detectConflicts;
26536
26705
  exports.detectPlatform = detectPlatform;
@@ -26565,6 +26734,7 @@ exports.fetchInfobipEmailReports = fetchInfobipEmailReports;
26565
26734
  exports.fetchInfobipScheduledEmailStatuses = fetchInfobipScheduledEmailStatuses;
26566
26735
  exports.fetchInfobipScheduledEmails = fetchInfobipScheduledEmails;
26567
26736
  exports.fetchInfobipValidations = fetchInfobipValidations;
26737
+ exports.fetchNotifications = fetchNotifications;
26568
26738
  exports.filesEndpoints = filesEndpoints;
26569
26739
  exports.filterHistory = filterHistory;
26570
26740
  exports.filterObject = filterObject;
@@ -26821,6 +26991,7 @@ exports.networkConfigManager = networkConfigManager;
26821
26991
  exports.networkPresets = networkPresets;
26822
26992
  exports.networkStatus = networkStatus;
26823
26993
  exports.normalizeHeaders = normalizeHeaders2;
26994
+ exports.notificationEndpoints = notificationEndpoints;
26824
26995
  exports.now = now;
26825
26996
  exports.nowInSeconds = nowInSeconds;
26826
26997
  exports.omit = omit;
@@ -26942,6 +27113,7 @@ exports.useDebouncedSubscription = useDebouncedSubscription;
26942
27113
  exports.useDeleteCampaign = useDeleteCampaign;
26943
27114
  exports.useDeleteFeatureFlag = useDeleteFeatureFlag;
26944
27115
  exports.useDeleteFile = useDeleteFile;
27116
+ exports.useDeleteNotification = useDeleteNotification;
26945
27117
  exports.useDownloadFile = useDownloadFile;
26946
27118
  exports.useEvaluateAllFeatureFlags = useEvaluateAllFeatureFlags;
26947
27119
  exports.useGenerateDocument = useGenerateDocument;
@@ -26950,6 +27122,7 @@ exports.useGetSignedUrl = useGetSignedUrl;
26950
27122
  exports.useJoinCampaign = useJoinCampaign;
26951
27123
  exports.useLeaveCampaign = useLeaveCampaign;
26952
27124
  exports.useMultipleSubscriptions = useMultipleSubscriptions;
27125
+ exports.useNotifications = useNotifications;
26953
27126
  exports.useOptimisticUpdate = useOptimisticUpdate;
26954
27127
  exports.useRealTimeData = useRealTimeData;
26955
27128
  exports.useRemoveFeatureFlagOverride = useRemoveFeatureFlagOverride;