@hyper-fetch/core 8.1.1 → 8.2.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 (51) hide show
  1. package/README.md +137 -52
  2. package/__tests__/features/sdk/sdk.base.spec.ts +7 -11
  3. package/__tests__/features/sdk/sdk.configuration.spec.ts +5 -7
  4. package/__tests__/features/sdk/sdk.types.spec.ts +284 -0
  5. package/dist/adapter/adapter.d.ts +18 -1
  6. package/dist/adapter/adapter.d.ts.map +1 -1
  7. package/dist/adapter/adapter.types.d.ts +8 -0
  8. package/dist/adapter/adapter.types.d.ts.map +1 -1
  9. package/dist/cache/cache.d.ts +3 -6
  10. package/dist/cache/cache.d.ts.map +1 -1
  11. package/dist/cache/cache.events.d.ts +5 -2
  12. package/dist/cache/cache.events.d.ts.map +1 -1
  13. package/dist/cache/cache.types.d.ts +1 -0
  14. package/dist/cache/cache.types.d.ts.map +1 -1
  15. package/dist/client/client.d.ts +5 -1
  16. package/dist/client/client.d.ts.map +1 -1
  17. package/dist/dispatcher/dispatcher.d.ts +1 -1
  18. package/dist/index.mjs +74 -9
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/managers/app/app.manager.events.d.ts +9 -0
  21. package/dist/managers/app/app.manager.events.d.ts.map +1 -1
  22. package/dist/managers/request/request.manager.events.d.ts +12 -1
  23. package/dist/managers/request/request.manager.events.d.ts.map +1 -1
  24. package/dist/mocker/mocker.types.d.ts +1 -0
  25. package/dist/mocker/mocker.types.d.ts.map +1 -1
  26. package/dist/plugin/plugin.d.ts +16 -0
  27. package/dist/plugin/plugin.d.ts.map +1 -1
  28. package/dist/plugin/plugin.types.d.ts +1 -0
  29. package/dist/plugin/plugin.types.d.ts.map +1 -1
  30. package/dist/request/request.d.ts +28 -0
  31. package/dist/request/request.d.ts.map +1 -1
  32. package/dist/request/request.types.d.ts +89 -2
  33. package/dist/request/request.types.d.ts.map +1 -1
  34. package/dist/sdk/sdk.d.ts +25 -5
  35. package/dist/sdk/sdk.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/adapter/adapter.ts +18 -1
  38. package/src/adapter/adapter.types.ts +8 -0
  39. package/src/cache/cache.events.ts +5 -2
  40. package/src/cache/cache.ts +3 -6
  41. package/src/cache/cache.types.ts +1 -0
  42. package/src/client/client.ts +5 -1
  43. package/src/dispatcher/dispatcher.ts +1 -1
  44. package/src/managers/app/app.manager.events.ts +9 -0
  45. package/src/managers/request/request.manager.events.ts +12 -9
  46. package/src/mocker/mocker.types.ts +1 -0
  47. package/src/plugin/plugin.ts +16 -0
  48. package/src/plugin/plugin.types.ts +1 -0
  49. package/src/request/request.ts +28 -0
  50. package/src/request/request.types.ts +103 -2
  51. package/src/sdk/sdk.ts +55 -6
package/dist/index.mjs CHANGED
@@ -22,6 +22,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  }) : target, mod));
23
23
  //#endregion
24
24
  //#region src/plugin/plugin.ts
25
+ /**
26
+ * Base class for plugins that hook into the request, cache, dispatcher, and adapter lifecycle.
27
+ * Extend this to build devtools, logging, analytics, or custom side-effect plugins.
28
+ */
25
29
  var Plugin = class {
26
30
  name;
27
31
  data;
@@ -32,10 +36,12 @@ var Plugin = class {
32
36
  this.name = config.name;
33
37
  if (config.data) this.data = config.data;
34
38
  }
39
+ /** Bind the plugin to a client instance. Called automatically when the plugin is added via `client.addPlugin()`. */
35
40
  initialize = (client) => {
36
41
  this.client = client;
37
42
  return this;
38
43
  };
44
+ /** Invoke a registered plugin method by name. Used internally by the client to dispatch lifecycle events. */
39
45
  trigger = (method, data) => {
40
46
  const callback = this.pluginMethods[method];
41
47
  if (callback) callback(data);
@@ -96,42 +102,52 @@ var Plugin = class {
96
102
  this.pluginMethods.onRequestFinished = callback;
97
103
  return this;
98
104
  };
105
+ /** Called when the dispatcher storage is fully cleared */
99
106
  onDispatcherCleared = (callback) => {
100
107
  this.pluginMethods.onDispatcherCleared = callback;
101
108
  return this;
102
109
  };
110
+ /** Called when a dispatcher queue has no more pending requests */
103
111
  onDispatcherQueueDrained = (callback) => {
104
112
  this.pluginMethods.onDispatcherQueueDrained = callback;
105
113
  return this;
106
114
  };
115
+ /** Called when a dispatcher queue transitions to running, paused, or stopped */
107
116
  onDispatcherQueueRunning = (callback) => {
108
117
  this.pluginMethods.onDispatcherQueueRunning = callback;
109
118
  return this;
110
119
  };
120
+ /** Called when a new item is added to a dispatcher queue */
111
121
  onDispatcherItemAdded = (callback) => {
112
122
  this.pluginMethods.onDispatcherItemAdded = callback;
113
123
  return this;
114
124
  };
125
+ /** Called when an item is removed from a dispatcher queue */
115
126
  onDispatcherItemDeleted = (callback) => {
116
127
  this.pluginMethods.onDispatcherItemDeleted = callback;
117
128
  return this;
118
129
  };
130
+ /** Called when a new dispatcher queue is created */
119
131
  onDispatcherQueueCreated = (callback) => {
120
132
  this.pluginMethods.onDispatcherQueueCreated = callback;
121
133
  return this;
122
134
  };
135
+ /** Called when an entire dispatcher queue is cleared */
123
136
  onDispatcherQueueCleared = (callback) => {
124
137
  this.pluginMethods.onDispatcherQueueCleared = callback;
125
138
  return this;
126
139
  };
140
+ /** Called when a cache entry is created or updated */
127
141
  onCacheItemChange = (callback) => {
128
142
  this.pluginMethods.onCacheItemChange = callback;
129
143
  return this;
130
144
  };
145
+ /** Called when a cache entry is deleted */
131
146
  onCacheItemDelete = (callback) => {
132
147
  this.pluginMethods.onCacheItemDelete = callback;
133
148
  return this;
134
149
  };
150
+ /** Called when the adapter fetcher is about to execute a request */
135
151
  onAdapterFetch = (callback) => {
136
152
  this.pluginMethods.onAdapterFetch = callback;
137
153
  return this;
@@ -561,6 +577,7 @@ var onDocumentEvent = (key, listener, options) => {
561
577
  };
562
578
  //#endregion
563
579
  //#region src/managers/app/app.manager.events.ts
580
+ /** Create event emitters and listeners for application-level focus, blur, online, and offline state changes. */
564
581
  var getAppManagerEvents = (emitter) => ({
565
582
  emitFocus: () => {
566
583
  emitter.emit(AppEvents.FOCUS);
@@ -695,6 +712,7 @@ var getRequestDeduplicatedByCacheKey = (cacheKey) => `${cacheKey}-cache-request-
695
712
  var getRequestDeduplicatedByIdKey = (id) => `${id}-request-deduplicated-by-id`;
696
713
  //#endregion
697
714
  //#region src/managers/request/request.manager.events.ts
715
+ /** Create event emitters and listeners for the request lifecycle: loading, progress, response, abort, deduplication, and removal. */
698
716
  var getRequestManagerEvents = (emitter) => ({
699
717
  emitDeduplicated: (data, isTriggeredExternally = false) => {
700
718
  emitter.emit(getRequestDeduplicatedKey(), data, isTriggeredExternally);
@@ -1406,21 +1424,27 @@ var Request = class Request {
1406
1424
  this.updatedCacheKey = initialRequestConfiguration?.updatedCacheKey ?? false;
1407
1425
  this.updatedQueryKey = initialRequestConfiguration?.updatedQueryKey ?? false;
1408
1426
  }
1427
+ /** Set the request headers. Returns a cloned request with the new headers applied. */
1409
1428
  setHeaders = (headers) => {
1410
1429
  return this.clone({ headers });
1411
1430
  };
1431
+ /** Set whether authentication interceptors should run for this request. */
1412
1432
  setAuth = (auth) => {
1413
1433
  return this.clone({ auth });
1414
1434
  };
1435
+ /** Set the URL path parameters (e.g., `:userId`). */
1415
1436
  setParams = (params) => {
1416
1437
  return this.clone({ params });
1417
1438
  };
1439
+ /** Set the request body payload. */
1418
1440
  setPayload = (payload) => {
1419
1441
  return this.clone({ payload });
1420
1442
  };
1443
+ /** Set the query parameters appended to the URL. */
1421
1444
  setQueryParams = (queryParams) => {
1422
1445
  return this.clone({ queryParams });
1423
1446
  };
1447
+ /** Set adapter-specific options (e.g., axios config, fetch init). */
1424
1448
  setOptions = (options) => {
1425
1449
  return this.clone({ options });
1426
1450
  };
@@ -1435,12 +1459,15 @@ var Request = class Request {
1435
1459
  cloned.scope = scopeId;
1436
1460
  return cloned;
1437
1461
  };
1462
+ /** Set whether in-flight requests with the same abort key are cancelled when a new one is dispatched. */
1438
1463
  setCancelable = (cancelable) => {
1439
1464
  return this.clone({ cancelable });
1440
1465
  };
1466
+ /** Set the number of retry attempts on failure. */
1441
1467
  setRetry = (retry) => {
1442
1468
  return this.clone({ retry });
1443
1469
  };
1470
+ /** Set the delay in milliseconds between retry attempts. */
1444
1471
  setRetryTime = (retryTime) => {
1445
1472
  return this.clone({ retryTime });
1446
1473
  };
@@ -1466,42 +1493,54 @@ var Request = class Request {
1466
1493
  cloned.optimistic = callback;
1467
1494
  return cloned;
1468
1495
  };
1496
+ /** Set how long (in ms) the response remains in cache before being garbage collected. */
1469
1497
  setCacheTime = (cacheTime) => {
1470
1498
  return this.clone({ cacheTime });
1471
1499
  };
1500
+ /** Set whether this request should use the cache. */
1472
1501
  setCache = (cache) => {
1473
1502
  return this.clone({ cache });
1474
1503
  };
1504
+ /** Set how long (in ms) cached data is considered fresh before triggering a revalidation. */
1475
1505
  setStaleTime = (staleTime) => {
1476
1506
  return this.clone({ staleTime });
1477
1507
  };
1508
+ /** Set whether the request should be queued and executed sequentially rather than immediately. */
1478
1509
  setQueued = (queued) => {
1479
1510
  return this.clone({ queued });
1480
1511
  };
1512
+ /** Override the abort key used to cancel this request. */
1481
1513
  setAbortKey = (abortKey) => {
1482
1514
  this.updatedAbortKey = true;
1483
1515
  return this.clone({ abortKey });
1484
1516
  };
1517
+ /** Override the cache key used to store/retrieve the response. */
1485
1518
  setCacheKey = (cacheKey) => {
1486
1519
  this.updatedCacheKey = true;
1487
1520
  return this.clone({ cacheKey });
1488
1521
  };
1522
+ /** Override the query key that identifies this request in the dispatcher queue. */
1489
1523
  setQueryKey = (queryKey) => {
1490
1524
  this.updatedQueryKey = true;
1491
1525
  return this.clone({ queryKey });
1492
1526
  };
1527
+ /** Enable or disable request deduplication. When enabled, concurrent identical requests share a single response. */
1493
1528
  setDeduplicate = (deduplicate) => {
1494
1529
  return this.clone({ deduplicate });
1495
1530
  };
1531
+ /** Set the time window (in ms) during which identical requests are deduplicated. */
1496
1532
  setDeduplicateTime = (deduplicateTime) => {
1497
1533
  return this.clone({ deduplicateTime });
1498
1534
  };
1535
+ /** Mark the request as used (prevents automatic refetching in hooks). */
1499
1536
  setUsed = (used) => {
1500
1537
  return this.clone({ used });
1501
1538
  };
1539
+ /** Set whether the request should be stored in the offline queue when there is no network connection. */
1502
1540
  setOffline = (offline) => {
1503
1541
  return this.clone({ offline });
1504
1542
  };
1543
+ /** Attach a mock handler to this request. When mocking is enabled, the handler is called instead of the real adapter. */
1505
1544
  setMock = (fn, config = {}) => {
1506
1545
  this.unstable_mock = {
1507
1546
  fn,
@@ -1510,11 +1549,13 @@ var Request = class Request {
1510
1549
  this.isMockerEnabled = true;
1511
1550
  return this;
1512
1551
  };
1552
+ /** Remove any attached mock handler and disable mocking for this request. */
1513
1553
  clearMock = () => {
1514
1554
  this.unstable_mock = void 0;
1515
1555
  this.isMockerEnabled = false;
1516
1556
  return this;
1517
1557
  };
1558
+ /** Enable or disable the mocker for this request without removing the mock handler. */
1518
1559
  setMockingEnabled = (isMockerEnabled) => {
1519
1560
  this.isMockerEnabled = isMockerEnabled;
1520
1561
  return this;
@@ -1557,6 +1598,7 @@ var Request = class Request {
1557
1598
  });
1558
1599
  return stringEndpoint;
1559
1600
  };
1601
+ /** Serialize the request configuration into a plain JSON object for persistence or transfer. */
1560
1602
  toJSON() {
1561
1603
  return {
1562
1604
  requestOptions: this.requestOptions,
@@ -1592,6 +1634,7 @@ var Request = class Request {
1592
1634
  hasMock: !!this.unstable_mock
1593
1635
  };
1594
1636
  }
1637
+ /** Create a new request instance with optional configuration overrides. Used internally by all setter methods. */
1595
1638
  clone(configuration) {
1596
1639
  const initialRequestConfiguration = {
1597
1640
  ...this.toJSON(),
@@ -1616,11 +1659,13 @@ var Request = class Request {
1616
1659
  cloned.$hooks = createRequestHooks(this.$hooks.__snapshot());
1617
1660
  return cloned;
1618
1661
  }
1662
+ /** Abort all in-flight requests sharing this request's abort key. */
1619
1663
  abort = () => {
1620
1664
  const { requestManager } = this.client;
1621
1665
  requestManager.abortByKey(scopeKey(this.abortKey, this.scope));
1622
1666
  return this.clone();
1623
1667
  };
1668
+ /** Extract the current cache data for this request into a portable hydration payload (useful for SSR). */
1624
1669
  dehydrate = (config) => {
1625
1670
  const { response, override = true } = config || {};
1626
1671
  if (response) return {
@@ -1724,6 +1769,7 @@ var Request = class Request {
1724
1769
  }
1725
1770
  return sendRequest(request, sendRequestOptions);
1726
1771
  };
1772
+ /** Reconstruct a Request instance from a previously serialized JSON representation. */
1727
1773
  static fromJSON = (client, json) => {
1728
1774
  return new Request(client, json.requestOptions, json);
1729
1775
  };
@@ -2141,6 +2187,11 @@ var mocker = async ({ request, requestId, onError, onResponseEnd, onTimeoutError
2141
2187
  //#endregion
2142
2188
  //#region src/adapter/adapter.ts
2143
2189
  var defaultMapper = (value) => value;
2190
+ /**
2191
+ * Base adapter class responsible for executing HTTP requests. Adapters handle endpoint resolution,
2192
+ * header/payload/query-params mapping, and the actual fetch call. Extend or configure this class
2193
+ * to integrate custom transport layers (e.g., axios, graphql, firebase).
2194
+ */
2144
2195
  var Adapter = class {
2145
2196
  /** Fetching function */
2146
2197
  unstable_fetcher;
@@ -2172,6 +2223,7 @@ var Adapter = class {
2172
2223
  this.systemErrorExtra = options.systemErrorExtra;
2173
2224
  this.defaultRequestOptions = options.defaultRequestOptions;
2174
2225
  }
2226
+ /** Initialize the adapter with a client reference and set up logging. Called automatically when the client is created. */
2175
2227
  initialize = (client) => {
2176
2228
  this.logger = client.loggerManager.initialize(client, "Adapter");
2177
2229
  this.initialized = true;
@@ -2179,6 +2231,7 @@ var Adapter = class {
2179
2231
  this.unstable_onInitializeCallback?.({ client });
2180
2232
  return this;
2181
2233
  };
2234
+ /** Register a callback invoked once the adapter is initialized with a client. */
2182
2235
  onInitialize = (callback) => {
2183
2236
  this.unstable_onInitializeCallback = callback;
2184
2237
  return this;
@@ -2211,14 +2264,17 @@ var Adapter = class {
2211
2264
  * Methods
2212
2265
  * ********************
2213
2266
  */
2267
+ /** Set the default HTTP method used when a request does not specify one. */
2214
2268
  setDefaultMethod = (method) => {
2215
2269
  this.defaultMethod = method;
2216
2270
  return this;
2217
2271
  };
2272
+ /** Set the default extra metadata attached to every request response (e.g., headers, status). */
2218
2273
  setDefaultExtra = (extra) => {
2219
2274
  this.defaultExtra = extra;
2220
2275
  return this;
2221
2276
  };
2277
+ /** Set a function that formats the endpoint string for display in devtools. */
2222
2278
  setDevtoolsEndpointGetter = (callback) => {
2223
2279
  this.unstable_devtoolsEndpointGetter = callback;
2224
2280
  return this;
@@ -2237,6 +2293,7 @@ var Adapter = class {
2237
2293
  this.unstable_getAdapterDefaults = callback;
2238
2294
  return this;
2239
2295
  };
2296
+ /** Set a custom mapping for internal adapter errors before they are returned in the response. */
2240
2297
  setInternalErrorMapping = (callback) => {
2241
2298
  this.unstable_internalErrorMapping = callback;
2242
2299
  return this;
@@ -2256,7 +2313,7 @@ var Adapter = class {
2256
2313
  return this;
2257
2314
  };
2258
2315
  /**
2259
- * Set the request payload mapping function which get triggered before request get sent
2316
+ * Set the endpoint mapping function which transforms the endpoint string before the request is sent
2260
2317
  */
2261
2318
  setEndpointMapper = (endpointMapper) => {
2262
2319
  this.unstable_endpointMapper = ((endpoint) => endpointMapper(endpoint, this.unstable_endpointMapperConfig));
@@ -2269,18 +2326,22 @@ var Adapter = class {
2269
2326
  this.unstable_queryParamsMapper = ((queryParams) => queryParamsMapper(queryParams, this.unstable_queryParamsMapperConfig));
2270
2327
  return this;
2271
2328
  };
2329
+ /** Set the configuration object passed as the second argument to the query params mapper. */
2272
2330
  setQueryParamsMapperConfig = (config) => {
2273
2331
  this.unstable_queryParamsMapperConfig = config;
2274
2332
  return this;
2275
2333
  };
2334
+ /** Set the configuration object passed as the second argument to the header mapper. */
2276
2335
  setHeaderMapperConfig = (config) => {
2277
2336
  this.unstable_headerMapperConfig = config;
2278
2337
  return this;
2279
2338
  };
2339
+ /** Set the configuration object passed as the second argument to the endpoint mapper. */
2280
2340
  setEndpointMapperConfig = (config) => {
2281
2341
  this.unstable_endpointMapperConfig = config;
2282
2342
  return this;
2283
2343
  };
2344
+ /** Set the configuration object passed as the second argument to the payload mapper. */
2284
2345
  setPayloadMapperConfig = (config) => {
2285
2346
  this.unstable_payloadMapperConfig = config;
2286
2347
  return this;
@@ -2290,10 +2351,12 @@ var Adapter = class {
2290
2351
  * Fetching
2291
2352
  * ********************
2292
2353
  */
2354
+ /** Set the fetcher function that performs the actual network request. Must be called before any request can be executed. */
2293
2355
  setFetcher(fetcher) {
2294
2356
  this.unstable_fetcher = fetcher.bind(this);
2295
2357
  return this;
2296
2358
  }
2359
+ /** Execute a request through the adapter pipeline: maps endpoint/headers/payload, runs plugins, then calls the fetcher. */
2297
2360
  async fetch(request, requestId) {
2298
2361
  let startTime;
2299
2362
  const execute = async (resolve) => {
@@ -2593,6 +2656,7 @@ var Cache = class {
2593
2656
  this.version = version;
2594
2657
  this.lazyStorage = lazyStorage;
2595
2658
  }
2659
+ /** Initialize the cache with a client reference, set up logging, and start garbage collection. */
2596
2660
  initialize = (client) => {
2597
2661
  this.client = client;
2598
2662
  this.logger = client.loggerManager.initialize(client, "Cache");
@@ -2673,8 +2737,6 @@ var Cache = class {
2673
2737
  * Update the cache data with partial response data
2674
2738
  * @param request
2675
2739
  * @param partialResponse
2676
- * @param isTriggeredExtrenally - informs whether an update was triggered due to internal logic or externally, e.g.
2677
- * via plugin.
2678
2740
  * @returns
2679
2741
  */
2680
2742
  update = (request, partialResponse) => {
@@ -2792,16 +2854,14 @@ var Cache = class {
2792
2854
  return syncData;
2793
2855
  };
2794
2856
  /**
2795
- * Used to receive keys from sync storage and lazy storage
2796
- * @param cacheKey
2857
+ * Used to receive keys from lazy storage only
2797
2858
  */
2798
2859
  getLazyKeys = async () => {
2799
2860
  const keys = await this.lazyStorage?.keys() || [];
2800
2861
  return [...new Set(keys)];
2801
2862
  };
2802
2863
  /**
2803
- * Used to receive keys from sync storage and lazy storage
2804
- * @param cacheKey
2864
+ * Used to receive deduplicated keys from both sync storage and lazy storage
2805
2865
  */
2806
2866
  getAllKeys = async () => {
2807
2867
  const keys = await this.lazyStorage?.keys();
@@ -2888,6 +2948,7 @@ var getCacheKey = () => {
2888
2948
  };
2889
2949
  //#endregion
2890
2950
  //#region src/cache/cache.events.ts
2951
+ /** Create the cache event emitters and listeners for data changes, invalidation, and deletion. */
2891
2952
  var getCacheEvents = (emitter) => ({
2892
2953
  emitCacheData: (data, isTriggeredExternally = false) => {
2893
2954
  emitter.emit(getCacheKey(), data, isTriggeredExternally);
@@ -3051,7 +3112,7 @@ var Dispatcher = class {
3051
3112
  this.events.emitQueueStatusChanged(queue);
3052
3113
  };
3053
3114
  /**
3054
- * Return all
3115
+ * Return all queue keys currently tracked by the dispatcher storage
3055
3116
  */
3056
3117
  getQueuesKeys = () => {
3057
3118
  return Array.from(this.storage.keys());
@@ -3812,7 +3873,7 @@ var Client = class {
3812
3873
  return this;
3813
3874
  };
3814
3875
  /**
3815
- * Method for removing listeners on request.
3876
+ * Method for removing response interceptors.
3816
3877
  * */
3817
3878
  removeOnResponseInterceptors = (callbacks) => {
3818
3879
  this.unstable_onResponseCallbacks = this.unstable_onResponseCallbacks.filter((callback) => !callbacks.includes(callback));
@@ -3846,18 +3907,22 @@ var Client = class {
3846
3907
  /**
3847
3908
  * Key setters
3848
3909
  */
3910
+ /** Set a custom mapper that generates the abort key used to cancel in-flight requests. */
3849
3911
  setAbortKeyMapper = (callback) => {
3850
3912
  this.unstable_abortKeyMapper = callback;
3851
3913
  return this;
3852
3914
  };
3915
+ /** Set a custom mapper that generates the cache key used to store and retrieve cached responses. */
3853
3916
  setCacheKeyMapper = (callback) => {
3854
3917
  this.unstable_cacheKeyMapper = callback;
3855
3918
  return this;
3856
3919
  };
3920
+ /** Set a custom mapper that generates the query key used to identify requests in the dispatcher queue. */
3857
3921
  setQueryKeyMapper = (callback) => {
3858
3922
  this.unstable_queryKeyMapper = callback;
3859
3923
  return this;
3860
3924
  };
3925
+ /** Set a custom mapper that generates the unique request ID for deduplication and tracking. */
3861
3926
  setRequestIdMapper = (callback) => {
3862
3927
  this.unstable_requestIdMapper = callback;
3863
3928
  return this;