@experteam-mx/ngx-services 20.8.6-dev3.0 → 20.9.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.
- package/README.md +8 -2
- package/fesm2022/experteam-mx-ngx-services.mjs +58 -27
- package/fesm2022/experteam-mx-ngx-services.mjs.map +1 -1
- package/index.d.ts +410 -186
- package/package.json +1 -1
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
|
-
|
|
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`.
|
|
@@ -2561,16 +2561,6 @@ class ApiCompositionService {
|
|
|
2561
2561
|
return this.http.get(`${this.url}/shipments/${id}`)
|
|
2562
2562
|
.pipe(map(({ data }) => data));
|
|
2563
2563
|
}
|
|
2564
|
-
/**
|
|
2565
|
-
* Retrieves shipments based on the provided query parameters.
|
|
2566
|
-
*
|
|
2567
|
-
* @param {QueryParams} params - The query parameters for the API request.
|
|
2568
|
-
* @returns {Observable<ShipmentsOut>} An observable that emits the shipments data.
|
|
2569
|
-
*/
|
|
2570
|
-
getShipments(params) {
|
|
2571
|
-
return this.http.get(`${this.url}/shipments`, { params })
|
|
2572
|
-
.pipe(map(({ data }) => data));
|
|
2573
|
-
}
|
|
2574
2564
|
/**
|
|
2575
2565
|
* Fetches the country references data based on the provided query parameters.
|
|
2576
2566
|
*
|
|
@@ -3159,7 +3149,7 @@ class ApiExternalOperationsService {
|
|
|
3159
3149
|
* Retrieves delivery confirmation details based on the provided OTP code.
|
|
3160
3150
|
*
|
|
3161
3151
|
* @param {string} otpCode - The OTP code used to search for delivery confirmation.
|
|
3162
|
-
* @return {Observable<
|
|
3152
|
+
* @return {Observable<DeliveryConfirmationSearchOut>} An observable containing the delivery confirmation data.
|
|
3163
3153
|
*/
|
|
3164
3154
|
getDeliveryConfirmation(otpCode) {
|
|
3165
3155
|
return this.http.get(`${this.url}/delivery-confirmation/search/${otpCode}`)
|
|
@@ -3200,6 +3190,38 @@ class ApiExternalOperationsService {
|
|
|
3200
3190
|
return this.http.put(`${this.url}/delivery-confirmation/confirmation/${otp}`, body)
|
|
3201
3191
|
.pipe(map$1(({ data }) => data));
|
|
3202
3192
|
}
|
|
3193
|
+
/**
|
|
3194
|
+
* Retrieves signature page confirmation information associated with an OTP code.
|
|
3195
|
+
*
|
|
3196
|
+
* @param {string} otpCode - OTP code used to search for the signature page confirmation.
|
|
3197
|
+
* @returns {Observable<SignaturePageConfirmationOut>} An observable containing the signature page confirmation details.
|
|
3198
|
+
*/
|
|
3199
|
+
getSignaturePageConfirmationSearch(otpCode) {
|
|
3200
|
+
return this.http.get(`${this.url}/signature-page-confirmation/search/${otpCode}`)
|
|
3201
|
+
.pipe(map$1(({ data }) => data));
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* Generates a signature page confirmation request for a shipment.
|
|
3205
|
+
*
|
|
3206
|
+
* @param {ShipmentSignaturePageIn} payload - Shipment data required to generate the signature page confirmation.
|
|
3207
|
+
* @returns {Observable<SignaturePageConfirmationGenerateOut>} An observable containing the generated confirmation information.
|
|
3208
|
+
*/
|
|
3209
|
+
postSignaturePageConfirmationGenerate(payload) {
|
|
3210
|
+
return this.http.post(`${this.url}/signature-page-confirmation/generate`, payload)
|
|
3211
|
+
.pipe(map$1(({ data }) => data));
|
|
3212
|
+
}
|
|
3213
|
+
/**
|
|
3214
|
+
* Confirms a shipment signature page using an OTP code.
|
|
3215
|
+
*
|
|
3216
|
+
* @param {ShipmentSignaturePageConfirmationIn} input - Signature page confirmation data.
|
|
3217
|
+
* @param {string} input.otp - OTP code used to validate the confirmation.
|
|
3218
|
+
* @param {...Object} input.body - Additional confirmation information sent in the request body.
|
|
3219
|
+
* @returns {Observable<{}>} An observable that emits the API response data.
|
|
3220
|
+
*/
|
|
3221
|
+
putSignaturePageConfirmation({ otp, ...body }) {
|
|
3222
|
+
return this.http.put(`${this.url}/signature-page-confirmation/${otp}`, body)
|
|
3223
|
+
.pipe(map$1(({ data }) => data));
|
|
3224
|
+
}
|
|
3203
3225
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiExternalOperationsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3204
3226
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiExternalOperationsService, providedIn: 'root' });
|
|
3205
3227
|
}
|
|
@@ -5560,14 +5582,6 @@ var DocumentStatusCode;
|
|
|
5560
5582
|
DocumentStatusCode[DocumentStatusCode["WITH_ERRORS"] = 3] = "WITH_ERRORS";
|
|
5561
5583
|
})(DocumentStatusCode || (DocumentStatusCode = {}));
|
|
5562
5584
|
|
|
5563
|
-
var CustomerRoleType;
|
|
5564
|
-
(function (CustomerRoleType) {
|
|
5565
|
-
CustomerRoleType["SHIPPER"] = "SP";
|
|
5566
|
-
CustomerRoleType["CONSIGNEE"] = "RV";
|
|
5567
|
-
CustomerRoleType["IMPORTER"] = "IP";
|
|
5568
|
-
CustomerRoleType["EXPORTER"] = "EP";
|
|
5569
|
-
})(CustomerRoleType || (CustomerRoleType = {}));
|
|
5570
|
-
|
|
5571
5585
|
class WebSocketsService {
|
|
5572
5586
|
pusher;
|
|
5573
5587
|
environments = inject(ENVIRONMENT_TOKEN);
|
|
@@ -5819,23 +5833,40 @@ function apiTokenInterceptor(req, next) {
|
|
|
5819
5833
|
return next(req);
|
|
5820
5834
|
}
|
|
5821
5835
|
|
|
5822
|
-
const DEFAULT_TTL = 10000; // ttl in ms
|
|
5823
5836
|
const cache = new Map();
|
|
5824
5837
|
const inFlightRequests = new Map();
|
|
5825
5838
|
/**
|
|
5826
|
-
*
|
|
5827
|
-
*
|
|
5839
|
+
* Resolves the TTL for a URL from the first matching `cacheRoutes` entry.
|
|
5840
|
+
* Returns `null` when there is no match or no routes configured.
|
|
5841
|
+
*/
|
|
5842
|
+
function resolveCacheTtl(url, cacheRoutes) {
|
|
5843
|
+
if (!cacheRoutes?.length)
|
|
5844
|
+
return null;
|
|
5845
|
+
for (const route of cacheRoutes) {
|
|
5846
|
+
if (new RegExp(route.pattern).test(url)) {
|
|
5847
|
+
return route.ttl;
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
return null;
|
|
5851
|
+
}
|
|
5852
|
+
/**
|
|
5853
|
+
* Interceptor function to handle opt-in HTTP caching for GET requests that match
|
|
5854
|
+
* a configured `cacheRoutes` pattern. Non-matching GETs pass through uncached.
|
|
5855
|
+
* Concurrent in-flight requests for the same key are deduplicated via `shareReplay`.
|
|
5828
5856
|
*
|
|
5829
|
-
* @param {HttpRequest<
|
|
5857
|
+
* @param {HttpRequest<unknown>} req - The HTTP request object being intercepted.
|
|
5830
5858
|
* @param {HttpHandlerFn} next - The next HTTP handler function in the chain to process the request.
|
|
5831
|
-
* @return {Observable<HttpEvent<
|
|
5859
|
+
* @return {Observable<HttpEvent<unknown>>} An observable that emits the HTTP event, either from cache
|
|
5832
5860
|
* or by invoking the next handler.
|
|
5833
5861
|
*/
|
|
5834
5862
|
function httpCachingInterceptor(req, next) {
|
|
5835
|
-
const {
|
|
5863
|
+
const { cacheRoutes } = inject(ENVIRONMENT_TOKEN);
|
|
5836
5864
|
if (req.method !== 'GET')
|
|
5837
5865
|
return next(req);
|
|
5838
5866
|
const key = req.urlWithParams;
|
|
5867
|
+
const routeTtl = resolveCacheTtl(key, cacheRoutes);
|
|
5868
|
+
if (routeTtl === null)
|
|
5869
|
+
return next(req);
|
|
5839
5870
|
const cached = cache.get(key);
|
|
5840
5871
|
if (cached) {
|
|
5841
5872
|
const isExpired = Date.now() > cached.ttl;
|
|
@@ -5852,7 +5883,7 @@ function httpCachingInterceptor(req, next) {
|
|
|
5852
5883
|
if (!(res instanceof HttpResponse)) {
|
|
5853
5884
|
return;
|
|
5854
5885
|
}
|
|
5855
|
-
const ttl = Date.now() +
|
|
5886
|
+
const ttl = Date.now() + routeTtl;
|
|
5856
5887
|
cache.set(key, { res, ttl });
|
|
5857
5888
|
}), finalize(() => {
|
|
5858
5889
|
inFlightRequests.delete(key);
|
|
@@ -5934,5 +5965,5 @@ const xmlHeaders = (format = 'object') => {
|
|
|
5934
5965
|
* Generated bundle index. Do not edit.
|
|
5935
5966
|
*/
|
|
5936
5967
|
|
|
5937
|
-
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,
|
|
5968
|
+
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 };
|
|
5938
5969
|
//# sourceMappingURL=experteam-mx-ngx-services.mjs.map
|