@experteam-mx/ngx-services 20.7.0-dev1.10 → 20.7.0-dev1.11

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/README.md CHANGED
@@ -22,8 +22,12 @@ import { routes } from './app.routes'
22
22
 
23
23
  const envs = {
24
24
  ...environment,
25
- authCookie: 'token',
26
- cacheTtl: 3000
25
+ authCookie: 'token'
26
+ // cacheRoutes is opt-in; omit or leave empty until routes are registered:
27
+ // cacheRoutes: [
28
+ // { pattern: '/api/catalogs', ttl: 60_000 },
29
+ // { pattern: '/api/companies/.+/branches', ttl: 30_000 }
30
+ // ]
27
31
  } as Environment
28
32
 
29
33
  export const appConfig: ApplicationConfig = {
@@ -41,6 +45,8 @@ export const appConfig: ApplicationConfig = {
41
45
 
42
46
  `provideNgxServices` registers `ENVIRONMENT_TOKEN`, which is required by the API services and some interceptors in this package.
43
47
 
48
+ `httpCachingInterceptor` caches only GET requests whose URL matches an entry in `cacheRoutes` (first matching RegExp pattern wins). With no routes configured, nothing is cached.
49
+
44
50
  ## NgModule compatibility
45
51
 
46
52
  `NgxServicesModule.forRoot(environment)` is still available for compatibility, but it is deprecated for new standalone applications and will be removed in `20.2.0`.
@@ -1430,6 +1430,53 @@ class ApiCatalogsService {
1430
1430
  return this.http.get(`${this.url}/export-reason-types`, { params })
1431
1431
  .pipe(map(({ data }) => data));
1432
1432
  }
1433
+ /**
1434
+ * Retrieves the list of upselling indicators.
1435
+ * @param params - Query parameters used to filter or paginate the results
1436
+ * @returns An Observable that emits the upselling indicators and total count
1437
+ */
1438
+ getUpsellingIndicators(params) {
1439
+ return this.http.get(`${this.url}/upselling-indicators`, { params })
1440
+ .pipe(map(({ data }) => data));
1441
+ }
1442
+ /**
1443
+ * Creates a new upselling indicator.
1444
+ * @param body - Upselling indicator data
1445
+ * @returns An Observable that emits the created upselling indicator
1446
+ */
1447
+ postUpsellingIndicator(body) {
1448
+ return this.http.post(`${this.url}/upselling-indicators`, body)
1449
+ .pipe(map(({ data }) => data));
1450
+ }
1451
+ /**
1452
+ * Updates an existing upselling indicator.
1453
+ * @param id - Identifier of the upselling indicator to update
1454
+ * @param body - Updated upselling indicator data
1455
+ * @returns An Observable that emits the updated upselling indicator
1456
+ */
1457
+ putUpsellingIndicator(id, body) {
1458
+ return this.http.put(`${this.url}/upselling-indicators/${id}`, body)
1459
+ .pipe(map(({ data }) => data));
1460
+ }
1461
+ /**
1462
+ * Deletes an upselling indicator by its identifier.
1463
+ * @param id - Identifier of the upselling indicator to delete
1464
+ * @returns An Observable that emits the operation result
1465
+ */
1466
+ deleteUpsellingIndicator(id) {
1467
+ return this.http.delete(`${this.url}/upselling-indicators/${id}`)
1468
+ .pipe(map(({ data }) => data));
1469
+ }
1470
+ /**
1471
+ * Updates the active status of an upselling indicator.
1472
+ * @param id - Identifier of the upselling indicator
1473
+ * @param isActive - Indicates whether the upselling indicator should be active or inactive
1474
+ * @returns An Observable that emits the operation result
1475
+ */
1476
+ patchUpsellingIndicator(id, isActive) {
1477
+ return this.http.patch(`${this.url}/upselling-indicators/${id}`, { isActive })
1478
+ .pipe(map(({ data }) => data));
1479
+ }
1433
1480
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCatalogsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1434
1481
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCatalogsService, providedIn: 'root' });
1435
1482
  }
@@ -1440,6 +1487,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
1440
1487
  }]
1441
1488
  }] });
1442
1489
 
1490
+ class ApiCheckpointsService {
1491
+ environments = inject(ENVIRONMENT_TOKEN);
1492
+ http = inject(HttpClient);
1493
+ /**
1494
+ * Retrieves the API checkpoints URL from the environment configuration.
1495
+ *
1496
+ * @returns {string} The API checkpoints URL.
1497
+ */
1498
+ get url() {
1499
+ return this.environments.apiCheckpointsUrl ?? '';
1500
+ }
1501
+ /**
1502
+ * Retrieves event registers from the checkpoints API.
1503
+ *
1504
+ * @param {QueryParams} params - Query parameters for filtering and pagination.
1505
+ * @returns {Observable<EventRegistersOut>} An observable containing the event registers data.
1506
+ */
1507
+ getEventRegisters(params) {
1508
+ return this.http.get(`${this.url}/event-registers`, { params })
1509
+ .pipe(map(({ data }) => data));
1510
+ }
1511
+ /**
1512
+ * Retrieves checkpoints from the checkpoints API.
1513
+ *
1514
+ * @param {QueryParams} params - Query parameters for filtering and pagination.
1515
+ * @returns {Observable<CheckpointsInventoryOut>} An observable containing the checkpoints data.
1516
+ */
1517
+ getCheckpoints(params) {
1518
+ return this.http.get(`${this.url}/checkpoints`, { params })
1519
+ .pipe(map(({ data }) => data));
1520
+ }
1521
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCheckpointsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1522
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCheckpointsService, providedIn: 'root' });
1523
+ }
1524
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCheckpointsService, decorators: [{
1525
+ type: Injectable,
1526
+ args: [{
1527
+ providedIn: 'root'
1528
+ }]
1529
+ }] });
1530
+
1443
1531
  class ApiCompaniesService {
1444
1532
  environments = inject(ENVIRONMENT_TOKEN);
1445
1533
  http = inject(HttpClient);
@@ -2047,19 +2135,18 @@ class ApiCompaniesService {
2047
2135
  /**
2048
2136
  * Retrieves the parameter values based on the provided parameter names.
2049
2137
  *
2050
- * @param {Object} params - An object containing the required parameters.
2051
- * @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched.
2138
+ * @param {string[]} names - An array of parameter names for which the values need to be fetched.
2052
2139
  * @return {Observable<ParametersValuesOut>} An observable that emits the fetched parameter values.
2053
2140
  */
2054
- postParametersValues({ paramNames }) {
2055
- const parameters = paramNames.map((p) => ({ name: p }));
2141
+ postParametersValues(names) {
2142
+ const parameters = names.map((name) => ({ name }));
2056
2143
  return this.http.post(`${this.url}/parameters-values`, { parameters })
2057
2144
  .pipe(map(({ data }) => data));
2058
2145
  }
2059
2146
  /**
2060
- * Retrieves parameter values based on the provided level configuration.
2147
+ * Retrieves parameter values based on the provided model configuration.
2061
2148
  *
2062
- * @param {ParametersByLevelIn} parameters - The input object containing the criteria or level details to retrieve the parameters.
2149
+ * @param {ParametersByModelIn} parameters - The input object containing the criteria or model details to retrieve the parameters.
2063
2150
  * @return {Observable<ParametersValuesOut>} An observable that emits the parameter values fetched from the server.
2064
2151
  */
2065
2152
  postParameterValueByModel(parameters) {
@@ -2069,12 +2156,11 @@ class ApiCompaniesService {
2069
2156
  /**
2070
2157
  * Retrieves the value of a specified parameter.
2071
2158
  *
2072
- * @param {Object} input - The input object containing the parameter details.
2073
- * @param {string} input.paramName - The name of the parameter whose value is to be retrieved.
2159
+ * @param {string} name - The name of the parameter whose value is to be retrieved.
2074
2160
  * @return {Observable<ParameterValueOut>} An observable emitting the value of the specified parameter.
2075
2161
  */
2076
- getParameterValue({ paramName, }) {
2077
- return this.http.get(`${this.url}/parameters-values/${paramName}`)
2162
+ getParameterValue(name) {
2163
+ return this.http.get(`${this.url}/parameters-values/${name}`)
2078
2164
  .pipe(map(({ data }) => data));
2079
2165
  }
2080
2166
  /**
@@ -2491,22 +2577,6 @@ class ApiCompaniesService {
2491
2577
  return this.http.put(`${this.url}/tdx-account-settings/${id}`, body)
2492
2578
  .pipe(map(({ data }) => data));
2493
2579
  }
2494
- /**
2495
- * Retrieves the employees of a specific location using a provided token.
2496
- *
2497
- * @param params - Input parameters for the request, defined by the `LocationEmployeesIn` interface.
2498
- * @returns An `Observable<LocationEmployeesOut>` that emits the employees
2499
- * associated with the given location.
2500
- * @returns The response type is `ApiSuccess<LocationEmployeesOut>`, from which the `data` field is extracted.
2501
- */
2502
- getLocationEmployeesByToken(params) {
2503
- return this.http.get(`${this.url}/location-employees`, {
2504
- params: params.queryParams,
2505
- headers: {
2506
- Authorization: `Bearer ${params.token}`
2507
- }
2508
- }).pipe(map(({ data }) => data));
2509
- }
2510
2580
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCompaniesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2511
2581
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCompaniesService, providedIn: 'root' });
2512
2582
  }
@@ -2935,6 +3005,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2935
3005
  }]
2936
3006
  }] });
2937
3007
 
3008
+ class ApiDropoffsService {
3009
+ environments = inject(ENVIRONMENT_TOKEN);
3010
+ http = inject(HttpClient);
3011
+ /**
3012
+ * Retrieves the URL for the Inventories API from the environment configurations.
3013
+ *
3014
+ * @return {string} The URL of the Inventories API.
3015
+ */
3016
+ get url() {
3017
+ return this.environments.apiDropoffUrl ?? '';
3018
+ }
3019
+ /**
3020
+ * Send a Courier Request for Shipment.
3021
+ *
3022
+ * @param {ShipmentsBookingIn} body - The courier for shipment data.
3023
+ */
3024
+ postShipmentsBooking(body) {
3025
+ return this.http.post(`${this.url}/shipments/booking`, body).pipe(map(({ data }) => data));
3026
+ }
3027
+ /**
3028
+ * Send a EReceipt for Shipment.
3029
+ *
3030
+ * @param {ShipmentsEReceiptIn} body - The EReceipt for Shipment data.
3031
+ */
3032
+ postShipmentsEReceipt(body) {
3033
+ return this.http.post(`${this.url}/shipments/ereceipt`, body).pipe(map(({ data }) => data));
3034
+ }
3035
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiDropoffsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3036
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiDropoffsService, providedIn: 'root' });
3037
+ }
3038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiDropoffsService, decorators: [{
3039
+ type: Injectable,
3040
+ args: [{
3041
+ providedIn: 'root'
3042
+ }]
3043
+ }] });
3044
+
2938
3045
  class ApiEToolsAutoBillingService {
2939
3046
  environments = inject(ENVIRONMENT_TOKEN);
2940
3047
  http = inject(HttpClient);
@@ -3187,7 +3294,7 @@ class ApiInventoriesService {
3187
3294
  * Retrieves a list of checkpoints based on query parameters.
3188
3295
  *
3189
3296
  * @param {QueryParams} params - Query parameters for filtering the checkpoints.
3190
- * @returns {Observable<CheckpointsOut>} The list of checkpoints.
3297
+ * @returns {Observable<CheckpointsInventoryOut>} The list of checkpoints.
3191
3298
  */
3192
3299
  getCheckpoints(params) {
3193
3300
  return this.http.get(`${this.url}/checkpoints`, {
@@ -3432,6 +3539,101 @@ class ApiInventoriesService {
3432
3539
  return this.http.get(`${this.url}/stock-update/packages/${id}`)
3433
3540
  .pipe(map(({ data }) => data));
3434
3541
  }
3542
+ /**
3543
+ * Retrieves a list of courier routes based on query parameters.
3544
+ *
3545
+ * @param {QueryParams} params - Query parameters for filtering the courier routes.
3546
+ * @returns {Observable<CourierRoutesOut>} An observable that emits the list of courier routes.
3547
+ */
3548
+ getCourierRoutes(params) {
3549
+ return this.http.get(`${this.url}/courier-routes`, {
3550
+ params
3551
+ }).pipe(map(({ data }) => data));
3552
+ }
3553
+ /**
3554
+ * Fetches the courier route details based on the provided courier route ID.
3555
+ *
3556
+ * @param {number} id - The courier route id
3557
+ * @return {Observable<CourierRouteOut>} An observable that emits the courier route data.
3558
+ */
3559
+ getCourierRoute(id) {
3560
+ return this.http.get(`${this.url}/courier-routes/${id}`)
3561
+ .pipe(map(({ data }) => data));
3562
+ }
3563
+ /**
3564
+ * Creates a new courier route.
3565
+ *
3566
+ * @param {CourierRouteIn} body - The data for the new courier route.
3567
+ * @returns {Observable<CourierRouteOut>} An observable the created courier route detail.
3568
+ */
3569
+ postCourierRoute(body) {
3570
+ return this.http.post(`${this.url}/courier-routes`, body).pipe(map(({ data }) => data));
3571
+ }
3572
+ /**
3573
+ * Update an existing courier route.
3574
+ *
3575
+ * @param {number} id - The identifier of the courier route record to update.
3576
+ * @param {CourierRouteIn} body - The courier route data to be updated.
3577
+ * @returns {Observable<CourierRouteOut>} An observable detail of the updated courier route.
3578
+ */
3579
+ putCourierRoute(id, body) {
3580
+ return this.http.put(`${this.url}/courier-routes/${id}`, body).pipe(map(({ data }) => data));
3581
+ }
3582
+ /**
3583
+ * Delete an existing courier route.
3584
+ *
3585
+ * @param {number} id - The unique identifier of the courier route to be deleted.
3586
+ * @returns {Observable<CourierRouteOut>} An observable that emits the result of the delete courier route.
3587
+ */
3588
+ deleteCourierRoute(id) {
3589
+ return this.http.delete(`${this.url}/courier-routes/${id}`)
3590
+ .pipe(map(({ data }) => data));
3591
+ }
3592
+ /**
3593
+ * Get a package/shipment enabled to perform an action.
3594
+ *
3595
+ * @param {PackageValidationActionIn} body - package/shipment number to validate.
3596
+ * @returns {Observable<PackageValidationActionOut>} An observable with the package/shipment validated.
3597
+ */
3598
+ postPackageValidationActions(body) {
3599
+ return this.http.post(`${this.url}/package-validation/actions`, body).pipe(map(({ data }) => data));
3600
+ }
3601
+ /**
3602
+ * Edit return first mile resource.
3603
+ *
3604
+ * @param {ReturnFirstMileIn} body - The first mile data to be updated.
3605
+ * @returns {Observable<ReturnFirstMileOut>} An observable with the first mile updated.
3606
+ */
3607
+ putReturnFirstMile(body) {
3608
+ return this.http.put(`${this.url}/return-first-mile`, body).pipe(map(({ data }) => data));
3609
+ }
3610
+ /**
3611
+ * Replaces a Package Reassign Position resource.
3612
+ *
3613
+ * @param {PackageReassignPositionIn} body - The Package Reassign Position resource data to be updated.
3614
+ * @returns {Observable<PackageReassignPositionOut>} An observable with the Package Reassign Position resource updated.
3615
+ */
3616
+ putPackageReassignPositions(body) {
3617
+ return this.http.put(`${this.url}/package-reassign-positions`, body).pipe(map(({ data }) => data));
3618
+ }
3619
+ /**
3620
+ * Edit missing package resource.
3621
+ *
3622
+ * @param {MissingPackagesIn} body - The missing package resource data to be updated.
3623
+ * @returns {Observable<MissingPackagesOut>} An observable with the missing package resource updated.
3624
+ */
3625
+ putMissingPackages(body) {
3626
+ return this.http.put(`${this.url}/missing-packages`, body).pipe(map(({ data }) => data));
3627
+ }
3628
+ /**
3629
+ * Edit package on hold resource..
3630
+ *
3631
+ * @param {PackageOnHoldIn} body - The package on hold resource data to be updated.
3632
+ * @returns {Observable<PackageOnHoldOut>} An observable with the package on hold resource updated.
3633
+ */
3634
+ putPackageOnHold(body) {
3635
+ return this.http.put(`${this.url}/package-on-hold`, body).pipe(map(({ data }) => data));
3636
+ }
3435
3637
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiInventoriesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3436
3638
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiInventoriesService, providedIn: 'root' });
3437
3639
  }
@@ -4438,19 +4640,6 @@ class ApiSecurityService {
4438
4640
  return this.http.get(`${this.url}/auth/me`)
4439
4641
  .pipe(map(({ data }) => data));
4440
4642
  }
4441
- /**
4442
- * Fetches the authenticated user's details from the server.
4443
- *
4444
- * @param token The JWT token used for authorization.
4445
- * @return An Observable that emits the user's details encapsulated in a MeOut object.
4446
- */
4447
- getOtherMe(token) {
4448
- return this.http.get(`${this.url}/auth/me`, {
4449
- headers: {
4450
- Authorization: `Bearer ${token}`
4451
- }
4452
- }).pipe(map(({ data }) => data));
4453
- }
4454
4643
  /**
4455
4644
  * Fetches a user by their unique ID.
4456
4645
  *
@@ -5337,6 +5526,24 @@ var ShipmentIncomeTypeCode;
5337
5526
  ShipmentIncomeTypeCode["EMBASSY"] = "EMB";
5338
5527
  })(ShipmentIncomeTypeCode || (ShipmentIncomeTypeCode = {}));
5339
5528
 
5529
+ var AccountTypeId;
5530
+ (function (AccountTypeId) {
5531
+ AccountTypeId[AccountTypeId["CASH"] = 1] = "CASH";
5532
+ AccountTypeId[AccountTypeId["COMAT"] = 2] = "COMAT";
5533
+ AccountTypeId[AccountTypeId["FOC"] = 3] = "FOC";
5534
+ AccountTypeId[AccountTypeId["EMPLOYEE"] = 4] = "EMPLOYEE";
5535
+ AccountTypeId[AccountTypeId["RPA"] = 5] = "RPA";
5536
+ AccountTypeId[AccountTypeId["GL"] = 6] = "GL";
5537
+ AccountTypeId[AccountTypeId["CUS"] = 7] = "CUS";
5538
+ AccountTypeId[AccountTypeId["VENDOR"] = 8] = "VENDOR";
5539
+ AccountTypeId[AccountTypeId["WPX"] = 9] = "WPX";
5540
+ AccountTypeId[AccountTypeId["DHL"] = 12] = "DHL";
5541
+ })(AccountTypeId || (AccountTypeId = {}));
5542
+ var AccountTypeName;
5543
+ (function (AccountTypeName) {
5544
+ AccountTypeName["EMBASSY"] = "EMBASSY";
5545
+ })(AccountTypeName || (AccountTypeName = {}));
5546
+
5340
5547
  var OperationModuleStatus;
5341
5548
  (function (OperationModuleStatus) {
5342
5549
  OperationModuleStatus["CANCELED"] = "canceled";
@@ -5374,6 +5581,35 @@ var Group;
5374
5581
  Group["expiration"] = "expiration";
5375
5582
  Group["verification"] = "verification";
5376
5583
  })(Group || (Group = {}));
5584
+ var InventoryActions;
5585
+ (function (InventoryActions) {
5586
+ InventoryActions["INVENTORY_CHECK_OUT"] = "inventoryCheckOut";
5587
+ InventoryActions["INVENTORY_COURIER_PICK_UP"] = "inventoryCourierPickUp";
5588
+ InventoryActions["INVENTORY_LOCATION_BACKROOM"] = "inventoryLocationBackroom";
5589
+ InventoryActions["INVENTORY_MISSING_PIECES"] = "inventoryMissingPieces";
5590
+ InventoryActions["INVENTORY_RE_ENTRY_MISSING_PIECES"] = "inventoryReEntryMissingPieces";
5591
+ InventoryActions["INVENTORY_ODD_NOTIFICATION"] = "inventoryOddNotifications";
5592
+ InventoryActions["INVENTORY_ON_HOLD_MISSED_CONNECTION"] = "inventoryOnHoldMissed";
5593
+ })(InventoryActions || (InventoryActions = {}));
5594
+ var InventoryErrorCodes;
5595
+ (function (InventoryErrorCodes) {
5596
+ InventoryErrorCodes["CODE_SHP_FORMAT"] = "INV-E001";
5597
+ InventoryErrorCodes["CODE_PCKG_FORMAT"] = "INV-E002";
5598
+ InventoryErrorCodes["CODE_PACKAGE_NOT_FOUND"] = "INV-E101";
5599
+ InventoryErrorCodes["CODE_EXISTS_INVENTORY_DIFFERENT_LOCATION"] = "INV-E007";
5600
+ InventoryErrorCodes["CODE_PACKAGE_NOT_IN_STOCK"] = "INV-E105";
5601
+ InventoryErrorCodes["CODE_PACKAGE_NOT_MISSING"] = "INV-E107";
5602
+ InventoryErrorCodes["CODE_ACTION_NOT_VALID"] = "INV-E108";
5603
+ InventoryErrorCodes["CODE_MULTIPLE_PACKAGES"] = "INV-E109";
5604
+ InventoryErrorCodes["CODE_PACKAGE_NOT_CHECK_IN"] = "INV-E110";
5605
+ InventoryErrorCodes["CODE_PACKAGE_NOT_DROP_OFF"] = "INV-E111";
5606
+ })(InventoryErrorCodes || (InventoryErrorCodes = {}));
5607
+ var RouteModelType;
5608
+ (function (RouteModelType) {
5609
+ RouteModelType["ROUTE_ID"] = "RouteId";
5610
+ RouteModelType["COURIER"] = "Courier";
5611
+ RouteModelType["COURIER_ROUTE"] = "CourierRoute";
5612
+ })(RouteModelType || (RouteModelType = {}));
5377
5613
 
5378
5614
  var PaymentTypeCode;
5379
5615
  (function (PaymentTypeCode) {
@@ -5644,23 +5880,40 @@ function apiTokenInterceptor(req, next) {
5644
5880
  return next(req);
5645
5881
  }
5646
5882
 
5647
- const DEFAULT_TTL = 10000; // ttl in ms
5648
5883
  const cache = new Map();
5649
5884
  const inFlightRequests = new Map();
5650
5885
  /**
5651
- * Interceptor function to handle HTTP caching for GET requests. It retrieves cached responses
5652
- * if available and valid; otherwise, it processes the request and caches the response for future use.
5886
+ * Resolves the TTL for a URL from the first matching `cacheRoutes` entry.
5887
+ * Returns `null` when there is no match or no routes configured.
5888
+ */
5889
+ function resolveCacheTtl(url, cacheRoutes) {
5890
+ if (!cacheRoutes?.length)
5891
+ return null;
5892
+ for (const route of cacheRoutes) {
5893
+ if (new RegExp(route.pattern).test(url)) {
5894
+ return route.ttl;
5895
+ }
5896
+ }
5897
+ return null;
5898
+ }
5899
+ /**
5900
+ * Interceptor function to handle opt-in HTTP caching for GET requests that match
5901
+ * a configured `cacheRoutes` pattern. Non-matching GETs pass through uncached.
5902
+ * Concurrent in-flight requests for the same key are deduplicated via `shareReplay`.
5653
5903
  *
5654
- * @param {HttpRequest<any>} req - The HTTP request object being intercepted.
5904
+ * @param {HttpRequest<unknown>} req - The HTTP request object being intercepted.
5655
5905
  * @param {HttpHandlerFn} next - The next HTTP handler function in the chain to process the request.
5656
- * @return {Observable<HttpEvent<any>>} An observable that emits the HTTP event, either from cache
5906
+ * @return {Observable<HttpEvent<unknown>>} An observable that emits the HTTP event, either from cache
5657
5907
  * or by invoking the next handler.
5658
5908
  */
5659
5909
  function httpCachingInterceptor(req, next) {
5660
- const { cacheTtl } = inject(ENVIRONMENT_TOKEN);
5910
+ const { cacheRoutes } = inject(ENVIRONMENT_TOKEN);
5661
5911
  if (req.method !== 'GET')
5662
5912
  return next(req);
5663
5913
  const key = req.urlWithParams;
5914
+ const routeTtl = resolveCacheTtl(key, cacheRoutes);
5915
+ if (routeTtl === null)
5916
+ return next(req);
5664
5917
  const cached = cache.get(key);
5665
5918
  if (cached) {
5666
5919
  const isExpired = Date.now() > cached.ttl;
@@ -5677,7 +5930,7 @@ function httpCachingInterceptor(req, next) {
5677
5930
  if (!(res instanceof HttpResponse)) {
5678
5931
  return;
5679
5932
  }
5680
- const ttl = Date.now() + (cacheTtl ?? DEFAULT_TTL);
5933
+ const ttl = Date.now() + routeTtl;
5681
5934
  cache.set(key, { res, ttl });
5682
5935
  }), finalize(() => {
5683
5936
  inFlightRequests.delete(key);
@@ -5759,5 +6012,5 @@ const xmlHeaders = (format = 'object') => {
5759
6012
  * Generated bundle index. Do not edit.
5760
6013
  */
5761
6014
 
5762
- export { AlphaNumeric, ApiBillingCOService, ApiBillingDOService, ApiBillingGtService, ApiBillingMxService, ApiBillingPaService, ApiBillingSvService, ApiCashOperationsService, ApiCatalogsService, ApiCompaniesService, ApiCompositionService, ApiCustomsService, ApiDiscountsService, ApiEToolsAutoBillingService, ApiEventsService, ApiExternalOperationsService, ApiInventoriesService, ApiInvoicesService, ApiNotificationsService, ApiOpenItemsService, ApiQuoteService, ApiReportsService, ApiSecurityService, ApiServicesService, ApiShipmentsService, ApiSuppliesService, ApiSurveysService, CryptoService, DefaultValueType, DepositTypeCode, DocumentStatusCode, ENVIRONMENT_TOKEN, Event, Group, NgxServicesModule, OpeningStatusCode, OperationModuleStatus, PaymentTypeCode, PrintMode, PrintableFormat, PrintersService, PrintersType, ShipmentIncomeTypeCode, TransferenceTypeCode, ViewSectionOption, WebSocketsService, apiHeadersInterceptor, apiTokenInterceptor, base64PdfToUrl, downloadBase64Pdf, httpCachingInterceptor, httpParams, pdfHeaders, provideNgxServices, queryString, xmlHeaders };
6015
+ export { AccountTypeId, AccountTypeName, AlphaNumeric, ApiBillingCOService, ApiBillingDOService, ApiBillingGtService, ApiBillingMxService, ApiBillingPaService, ApiBillingSvService, ApiCashOperationsService, ApiCatalogsService, ApiCheckpointsService, ApiCompaniesService, ApiCompositionService, ApiCustomsService, ApiDiscountsService, ApiDropoffsService, ApiEToolsAutoBillingService, ApiEventsService, ApiExternalOperationsService, ApiInventoriesService, ApiInvoicesService, ApiNotificationsService, ApiOpenItemsService, ApiQuoteService, ApiReportsService, ApiSecurityService, ApiServicesService, ApiShipmentsService, ApiSuppliesService, ApiSurveysService, CryptoService, DefaultValueType, DepositTypeCode, DocumentStatusCode, ENVIRONMENT_TOKEN, Event, Group, InventoryActions, InventoryErrorCodes, NgxServicesModule, OpeningStatusCode, OperationModuleStatus, PaymentTypeCode, PrintMode, PrintableFormat, PrintersService, PrintersType, RouteModelType, ShipmentIncomeTypeCode, TransferenceTypeCode, ViewSectionOption, WebSocketsService, apiHeadersInterceptor, apiTokenInterceptor, base64PdfToUrl, downloadBase64Pdf, httpCachingInterceptor, httpParams, pdfHeaders, provideNgxServices, queryString, xmlHeaders };
5763
6016
  //# sourceMappingURL=experteam-mx-ngx-services.mjs.map