@ahoo-wang/fetcher 1.5.3 → 1.5.6
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/fetcher.d.ts +1 -36
- package/dist/fetcher.d.ts.map +1 -1
- package/dist/index.es.js +49 -89
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/fetcher.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UrlBuilder, UrlBuilderCapable } from './urlBuilder';
|
|
2
2
|
import { TimeoutCapable } from './timeout';
|
|
3
|
-
import { FetchExchange
|
|
3
|
+
import { FetchExchange } from './fetchExchange';
|
|
4
4
|
import { BaseURLCapable, FetchRequest, FetchRequestInit, RequestHeaders, RequestHeadersCapable } from './fetchRequest';
|
|
5
5
|
import { InterceptorManager } from './interceptorManager';
|
|
6
6
|
import { UrlTemplateStyle } from './urlTemplateResolver';
|
|
@@ -92,41 +92,6 @@ export declare class Fetcher implements UrlBuilderCapable, RequestHeadersCapable
|
|
|
92
92
|
* @throws Error if an unhandled error occurs during request processing
|
|
93
93
|
*/
|
|
94
94
|
request<R = FetchExchange>(request: FetchRequest, resultExtractor?: ResultExtractor<R>, attributes?: Record<string, any>): Promise<R>;
|
|
95
|
-
/**
|
|
96
|
-
* Executes an HTTP request exchange and processes the result using a result extractor.
|
|
97
|
-
*
|
|
98
|
-
* This method creates a FetchExchange object, runs it through the interceptor chain,
|
|
99
|
-
* and then applies a result extractor function to transform the exchange into the desired result type.
|
|
100
|
-
* It's the core method that powers all HTTP request functionality in the Fetcher.
|
|
101
|
-
*
|
|
102
|
-
* @template R - The type of result to return after processing the exchange
|
|
103
|
-
* @param exchangeInit - The initial configuration for the exchange, excluding fetcher, response, and error properties
|
|
104
|
-
* @param resultExtractor - A function that transforms the completed exchange into the desired result type.
|
|
105
|
-
* Defaults to returning the exchange object itself.
|
|
106
|
-
* @returns A Promise that resolves to the result of applying the resultExtractor to the completed exchange
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* // Basic usage with default result extractor (returns the exchange)
|
|
111
|
-
* const exchange = await fetcher.exchange({
|
|
112
|
-
* request: { url: '/api/users', method: 'GET' }
|
|
113
|
-
* });
|
|
114
|
-
* console.log(exchange.response.status);
|
|
115
|
-
*
|
|
116
|
-
* // Using a custom result extractor to get the response object
|
|
117
|
-
* const response = await fetcher.exchange(
|
|
118
|
-
* { request: { url: '/api/users', method: 'GET' } },
|
|
119
|
-
* (exchange) => exchange.requiredResponse
|
|
120
|
-
* );
|
|
121
|
-
*
|
|
122
|
-
* // Using a built-in result extractor to get JSON data
|
|
123
|
-
* const users = await fetcher.exchange(
|
|
124
|
-
* { request: { url: '/api/users', method: 'GET' } },
|
|
125
|
-
* ResultExtractors.Json
|
|
126
|
-
* );
|
|
127
|
-
* ```
|
|
128
|
-
*/
|
|
129
|
-
exchange<R>(exchangeInit: Omit<FetchExchangeInit, 'fetcher'>, resultExtractor?: ResultExtractor<R>): Promise<R>;
|
|
130
95
|
/**
|
|
131
96
|
* Internal helper method for making HTTP requests with a specific method.
|
|
132
97
|
*
|
package/dist/fetcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAkB,KAAK,cAAc,EAAE,MA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AAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,MAAM,CAAM,EACvD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,OAAO,CAAC,QAAQ,CAAC;IAIpB;;;;;;;;;;;;OAYG;IACG,OAAO,CACX,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,MAAM,CAAM,EACvD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,OAAO,CAAC,QAAQ,CAAC;CAGrB"}
|
package/dist/index.es.js
CHANGED
|
@@ -98,8 +98,8 @@ const c = class c {
|
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
c.PATH_PARAM_REGEX = /{([^}]+)}/g;
|
|
101
|
-
let
|
|
102
|
-
const L = new
|
|
101
|
+
let f = c;
|
|
102
|
+
const L = new f(), h = class h {
|
|
103
103
|
/**
|
|
104
104
|
* Extracts path parameters from an Express-style URL string.
|
|
105
105
|
*
|
|
@@ -166,8 +166,8 @@ const L = new P(), h = class h {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
h.PATH_PARAM_REGEX = /:([^/]+)/g;
|
|
169
|
-
let
|
|
170
|
-
const v = new
|
|
169
|
+
let P = h;
|
|
170
|
+
const v = new P();
|
|
171
171
|
class G {
|
|
172
172
|
/**
|
|
173
173
|
* Initializes a new UrlBuilder instance.
|
|
@@ -209,12 +209,12 @@ class G {
|
|
|
209
209
|
*/
|
|
210
210
|
build(e, t) {
|
|
211
211
|
const s = t?.path, o = t?.query, n = C(this.baseURL, e);
|
|
212
|
-
let
|
|
212
|
+
let i = this.urlTemplateResolver.resolve(n, s);
|
|
213
213
|
if (o) {
|
|
214
214
|
const a = new URLSearchParams(o).toString();
|
|
215
|
-
a && (
|
|
215
|
+
a && (i += "?" + a);
|
|
216
216
|
}
|
|
217
|
-
return
|
|
217
|
+
return i;
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* Resolves a complete URL from a FetchRequest.
|
|
@@ -255,7 +255,7 @@ class I extends l {
|
|
|
255
255
|
function M(r, e) {
|
|
256
256
|
return typeof r < "u" ? r : e;
|
|
257
257
|
}
|
|
258
|
-
async function
|
|
258
|
+
async function H(r) {
|
|
259
259
|
const e = r.url, t = r.timeout, s = r;
|
|
260
260
|
if (r.signal)
|
|
261
261
|
return fetch(e, s);
|
|
@@ -264,7 +264,7 @@ async function x(r) {
|
|
|
264
264
|
const o = r.abortController ?? new AbortController();
|
|
265
265
|
s.signal = o.signal;
|
|
266
266
|
let n = null;
|
|
267
|
-
const
|
|
267
|
+
const i = new Promise((a, p) => {
|
|
268
268
|
n = setTimeout(() => {
|
|
269
269
|
n && clearTimeout(n);
|
|
270
270
|
const O = new I(r);
|
|
@@ -272,15 +272,15 @@ async function x(r) {
|
|
|
272
272
|
}, t);
|
|
273
273
|
});
|
|
274
274
|
try {
|
|
275
|
-
return await Promise.race([fetch(e, s),
|
|
275
|
+
return await Promise.race([fetch(e, s), i]);
|
|
276
276
|
} finally {
|
|
277
277
|
n && clearTimeout(n);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
const
|
|
280
|
+
const x = "UrlResolveInterceptor", N = Number.MIN_SAFE_INTEGER + 1e3;
|
|
281
281
|
class j {
|
|
282
282
|
constructor() {
|
|
283
|
-
this.name =
|
|
283
|
+
this.name = x, this.order = N;
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
286
286
|
* Resolves the final URL by combining the base URL, path parameters, and query parameters.
|
|
@@ -292,7 +292,7 @@ class j {
|
|
|
292
292
|
t.url = e.fetcher.urlBuilder.resolveRequestUrl(t);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
var
|
|
295
|
+
var u = /* @__PURE__ */ ((r) => (r.GET = "GET", r.POST = "POST", r.PUT = "PUT", r.DELETE = "DELETE", r.PATCH = "PATCH", r.HEAD = "HEAD", r.OPTIONS = "OPTIONS", r))(u || {});
|
|
296
296
|
const ae = "Content-Type", d = class d {
|
|
297
297
|
};
|
|
298
298
|
d.APPLICATION_JSON = "application/json", d.TEXT_EVENT_STREAM = "text/event-stream";
|
|
@@ -380,7 +380,7 @@ class k {
|
|
|
380
380
|
* console.log(exchange.response); // HTTP response object
|
|
381
381
|
*/
|
|
382
382
|
async intercept(e) {
|
|
383
|
-
e.response = await
|
|
383
|
+
e.response = await H(e.request);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
function m(r, e) {
|
|
@@ -719,16 +719,16 @@ class Z {
|
|
|
719
719
|
return this.response;
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
const ee = (r) => r, te = (r) => r.requiredResponse, re = (r) => r.requiredResponse.json(), se = (r) => r.requiredResponse.text(),
|
|
722
|
+
const ee = (r) => r, te = (r) => r.requiredResponse, re = (r) => r.requiredResponse.json(), se = (r) => r.requiredResponse.text(), _ = {
|
|
723
723
|
Exchange: ee,
|
|
724
724
|
Response: te,
|
|
725
725
|
Json: re,
|
|
726
726
|
Text: se
|
|
727
|
-
},
|
|
727
|
+
}, A = {
|
|
728
728
|
"Content-Type": E.APPLICATION_JSON
|
|
729
729
|
}, S = {
|
|
730
730
|
baseURL: "",
|
|
731
|
-
headers:
|
|
731
|
+
headers: A
|
|
732
732
|
};
|
|
733
733
|
class oe {
|
|
734
734
|
/**
|
|
@@ -740,7 +740,7 @@ class oe {
|
|
|
740
740
|
* @param options - Configuration options for the Fetcher instance
|
|
741
741
|
*/
|
|
742
742
|
constructor(e = S) {
|
|
743
|
-
this.headers =
|
|
743
|
+
this.headers = A, this.urlBuilder = new G(e.baseURL, e.urlTemplateStyle), this.headers = e.headers ?? A, this.timeout = e.timeout, this.interceptors = e.interceptors ?? new W();
|
|
744
744
|
}
|
|
745
745
|
/**
|
|
746
746
|
* Executes an HTTP request with the specified URL and options.
|
|
@@ -758,7 +758,7 @@ class oe {
|
|
|
758
758
|
*/
|
|
759
759
|
async fetch(e, t = {}, s) {
|
|
760
760
|
const o = t;
|
|
761
|
-
return o.url = e, this.request(o,
|
|
761
|
+
return o.url = e, this.request(o, _.Response, s);
|
|
762
762
|
}
|
|
763
763
|
/**
|
|
764
764
|
* Processes an HTTP request through the Fetcher's internal workflow.
|
|
@@ -776,7 +776,7 @@ class oe {
|
|
|
776
776
|
* @returns Promise that resolves to the extracted result based on resultExtractor
|
|
777
777
|
* @throws Error if an unhandled error occurs during request processing
|
|
778
778
|
*/
|
|
779
|
-
async request(e, t =
|
|
779
|
+
async request(e, t = _.Exchange, s) {
|
|
780
780
|
const o = {
|
|
781
781
|
...this.headers,
|
|
782
782
|
...e.headers
|
|
@@ -784,52 +784,12 @@ class oe {
|
|
|
784
784
|
...e,
|
|
785
785
|
headers: o,
|
|
786
786
|
timeout: M(e.timeout, this.timeout)
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
);
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* Executes an HTTP request exchange and processes the result using a result extractor.
|
|
795
|
-
*
|
|
796
|
-
* This method creates a FetchExchange object, runs it through the interceptor chain,
|
|
797
|
-
* and then applies a result extractor function to transform the exchange into the desired result type.
|
|
798
|
-
* It's the core method that powers all HTTP request functionality in the Fetcher.
|
|
799
|
-
*
|
|
800
|
-
* @template R - The type of result to return after processing the exchange
|
|
801
|
-
* @param exchangeInit - The initial configuration for the exchange, excluding fetcher, response, and error properties
|
|
802
|
-
* @param resultExtractor - A function that transforms the completed exchange into the desired result type.
|
|
803
|
-
* Defaults to returning the exchange object itself.
|
|
804
|
-
* @returns A Promise that resolves to the result of applying the resultExtractor to the completed exchange
|
|
805
|
-
*
|
|
806
|
-
* @example
|
|
807
|
-
* ```typescript
|
|
808
|
-
* // Basic usage with default result extractor (returns the exchange)
|
|
809
|
-
* const exchange = await fetcher.exchange({
|
|
810
|
-
* request: { url: '/api/users', method: 'GET' }
|
|
811
|
-
* });
|
|
812
|
-
* console.log(exchange.response.status);
|
|
813
|
-
*
|
|
814
|
-
* // Using a custom result extractor to get the response object
|
|
815
|
-
* const response = await fetcher.exchange(
|
|
816
|
-
* { request: { url: '/api/users', method: 'GET' } },
|
|
817
|
-
* (exchange) => exchange.requiredResponse
|
|
818
|
-
* );
|
|
819
|
-
*
|
|
820
|
-
* // Using a built-in result extractor to get JSON data
|
|
821
|
-
* const users = await fetcher.exchange(
|
|
822
|
-
* { request: { url: '/api/users', method: 'GET' } },
|
|
823
|
-
* ResultExtractors.Json
|
|
824
|
-
* );
|
|
825
|
-
* ```
|
|
826
|
-
*/
|
|
827
|
-
async exchange(e, t = f.Exchange) {
|
|
828
|
-
const s = new Z({
|
|
829
|
-
...e,
|
|
830
|
-
fetcher: this
|
|
787
|
+
}, i = new Z({
|
|
788
|
+
fetcher: this,
|
|
789
|
+
request: n,
|
|
790
|
+
attributes: s
|
|
831
791
|
});
|
|
832
|
-
return await this.interceptors.exchange(
|
|
792
|
+
return await this.interceptors.exchange(i), t(i);
|
|
833
793
|
}
|
|
834
794
|
/**
|
|
835
795
|
* Internal helper method for making HTTP requests with a specific method.
|
|
@@ -869,7 +829,7 @@ class oe {
|
|
|
869
829
|
* @returns Promise that resolves to the HTTP response
|
|
870
830
|
*/
|
|
871
831
|
async get(e, t = {}, s) {
|
|
872
|
-
return this.methodFetch(
|
|
832
|
+
return this.methodFetch(u.GET, e, t, s);
|
|
873
833
|
}
|
|
874
834
|
/**
|
|
875
835
|
* Makes a POST HTTP request.
|
|
@@ -884,7 +844,7 @@ class oe {
|
|
|
884
844
|
* @returns Promise that resolves to the HTTP response
|
|
885
845
|
*/
|
|
886
846
|
async post(e, t = {}, s) {
|
|
887
|
-
return this.methodFetch(
|
|
847
|
+
return this.methodFetch(u.POST, e, t, s);
|
|
888
848
|
}
|
|
889
849
|
/**
|
|
890
850
|
* Makes a PUT HTTP request.
|
|
@@ -899,7 +859,7 @@ class oe {
|
|
|
899
859
|
* @returns Promise that resolves to the HTTP response
|
|
900
860
|
*/
|
|
901
861
|
async put(e, t = {}, s) {
|
|
902
|
-
return this.methodFetch(
|
|
862
|
+
return this.methodFetch(u.PUT, e, t, s);
|
|
903
863
|
}
|
|
904
864
|
/**
|
|
905
865
|
* Makes a DELETE HTTP request.
|
|
@@ -914,7 +874,7 @@ class oe {
|
|
|
914
874
|
* @returns Promise that resolves to the HTTP response
|
|
915
875
|
*/
|
|
916
876
|
async delete(e, t = {}, s) {
|
|
917
|
-
return this.methodFetch(
|
|
877
|
+
return this.methodFetch(u.DELETE, e, t, s);
|
|
918
878
|
}
|
|
919
879
|
/**
|
|
920
880
|
* Makes a PATCH HTTP request.
|
|
@@ -929,7 +889,7 @@ class oe {
|
|
|
929
889
|
* @returns Promise that resolves to the HTTP response
|
|
930
890
|
*/
|
|
931
891
|
async patch(e, t = {}, s) {
|
|
932
|
-
return this.methodFetch(
|
|
892
|
+
return this.methodFetch(u.PATCH, e, t, s);
|
|
933
893
|
}
|
|
934
894
|
/**
|
|
935
895
|
* Makes a HEAD HTTP request.
|
|
@@ -945,7 +905,7 @@ class oe {
|
|
|
945
905
|
* @returns Promise that resolves to the HTTP response
|
|
946
906
|
*/
|
|
947
907
|
async head(e, t = {}, s) {
|
|
948
|
-
return this.methodFetch(
|
|
908
|
+
return this.methodFetch(u.HEAD, e, t, s);
|
|
949
909
|
}
|
|
950
910
|
/**
|
|
951
911
|
* Makes an OPTIONS HTTP request.
|
|
@@ -961,10 +921,10 @@ class oe {
|
|
|
961
921
|
* @returns Promise that resolves to the HTTP response
|
|
962
922
|
*/
|
|
963
923
|
async options(e, t = {}, s) {
|
|
964
|
-
return this.methodFetch(
|
|
924
|
+
return this.methodFetch(u.OPTIONS, e, t, s);
|
|
965
925
|
}
|
|
966
926
|
}
|
|
967
|
-
const
|
|
927
|
+
const y = "default";
|
|
968
928
|
class ne {
|
|
969
929
|
constructor() {
|
|
970
930
|
this.registrar = /* @__PURE__ */ new Map();
|
|
@@ -1038,7 +998,7 @@ class ne {
|
|
|
1038
998
|
* const defaultFetcher = fetcherRegistrar.default;
|
|
1039
999
|
*/
|
|
1040
1000
|
get default() {
|
|
1041
|
-
return this.requiredGet(
|
|
1001
|
+
return this.requiredGet(y);
|
|
1042
1002
|
}
|
|
1043
1003
|
/**
|
|
1044
1004
|
* Set the default Fetcher instance
|
|
@@ -1049,7 +1009,7 @@ class ne {
|
|
|
1049
1009
|
* fetcherRegistrar.default = fetcher;
|
|
1050
1010
|
*/
|
|
1051
1011
|
set default(e) {
|
|
1052
|
-
this.register(
|
|
1012
|
+
this.register(y, e);
|
|
1053
1013
|
}
|
|
1054
1014
|
/**
|
|
1055
1015
|
* Get a copy of all registered fetchers
|
|
@@ -1066,7 +1026,7 @@ class ne {
|
|
|
1066
1026
|
}
|
|
1067
1027
|
}
|
|
1068
1028
|
const ie = new ne();
|
|
1069
|
-
function
|
|
1029
|
+
function g(r, e) {
|
|
1070
1030
|
if (!(r === void 0 && e === void 0))
|
|
1071
1031
|
return e === void 0 ? r : r === void 0 ? e : { ...r, ...e };
|
|
1072
1032
|
}
|
|
@@ -1076,12 +1036,12 @@ function ce(r, e) {
|
|
|
1076
1036
|
if (Object.keys(e).length === 0)
|
|
1077
1037
|
return r;
|
|
1078
1038
|
const t = {
|
|
1079
|
-
path:
|
|
1080
|
-
query:
|
|
1039
|
+
path: g(r.urlParams?.path, e.urlParams?.path),
|
|
1040
|
+
query: g(r.urlParams?.query, e.urlParams?.query)
|
|
1081
1041
|
}, s = {
|
|
1082
1042
|
...r.headers,
|
|
1083
1043
|
...e.headers
|
|
1084
|
-
}, o = e.method ?? r.method, n = e.body ?? r.body,
|
|
1044
|
+
}, o = e.method ?? r.method, n = e.body ?? r.body, i = e.timeout ?? r.timeout, a = e.signal ?? r.signal, p = e.abortController ?? r.abortController;
|
|
1085
1045
|
return {
|
|
1086
1046
|
...r,
|
|
1087
1047
|
...e,
|
|
@@ -1089,7 +1049,7 @@ function ce(r, e) {
|
|
|
1089
1049
|
urlParams: t,
|
|
1090
1050
|
headers: s,
|
|
1091
1051
|
body: n,
|
|
1092
|
-
timeout:
|
|
1052
|
+
timeout: i,
|
|
1093
1053
|
signal: a,
|
|
1094
1054
|
abortController: p
|
|
1095
1055
|
};
|
|
@@ -1116,15 +1076,15 @@ class ue extends oe {
|
|
|
1116
1076
|
super(t), this.name = e, ie.register(e, this);
|
|
1117
1077
|
}
|
|
1118
1078
|
}
|
|
1119
|
-
const he = new ue(
|
|
1079
|
+
const he = new ue(y);
|
|
1120
1080
|
export {
|
|
1121
1081
|
ae as CONTENT_TYPE_HEADER,
|
|
1122
1082
|
E as ContentTypeValues,
|
|
1123
|
-
|
|
1083
|
+
y as DEFAULT_FETCHER_NAME,
|
|
1124
1084
|
S as DEFAULT_OPTIONS,
|
|
1125
1085
|
R as ExchangeError,
|
|
1126
1086
|
ee as ExchangeResultExtractor,
|
|
1127
|
-
|
|
1087
|
+
P as ExpressUrlTemplateResolver,
|
|
1128
1088
|
V as FETCH_INTERCEPTOR_NAME,
|
|
1129
1089
|
J as FETCH_INTERCEPTOR_ORDER,
|
|
1130
1090
|
Z as FetchExchange,
|
|
@@ -1133,7 +1093,7 @@ export {
|
|
|
1133
1093
|
oe as Fetcher,
|
|
1134
1094
|
l as FetcherError,
|
|
1135
1095
|
ne as FetcherRegistrar,
|
|
1136
|
-
|
|
1096
|
+
u as HttpMethod,
|
|
1137
1097
|
b as HttpStatusValidationError,
|
|
1138
1098
|
W as InterceptorManager,
|
|
1139
1099
|
T as InterceptorRegistry,
|
|
@@ -1143,11 +1103,11 @@ export {
|
|
|
1143
1103
|
$ as REQUEST_BODY_INTERCEPTOR_ORDER,
|
|
1144
1104
|
X as RequestBodyInterceptor,
|
|
1145
1105
|
te as ResponseResultExtractor,
|
|
1146
|
-
|
|
1106
|
+
_ as ResultExtractors,
|
|
1147
1107
|
se as TextResultExtractor,
|
|
1148
|
-
|
|
1108
|
+
x as URL_RESOLVE_INTERCEPTOR_NAME,
|
|
1149
1109
|
N as URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
1150
|
-
|
|
1110
|
+
f as UriTemplateResolver,
|
|
1151
1111
|
G as UrlBuilder,
|
|
1152
1112
|
j as UrlResolveInterceptor,
|
|
1153
1113
|
U as UrlTemplateStyle,
|
|
@@ -1160,10 +1120,10 @@ export {
|
|
|
1160
1120
|
ie as fetcherRegistrar,
|
|
1161
1121
|
D as getUrlTemplateResolver,
|
|
1162
1122
|
F as isAbsoluteURL,
|
|
1163
|
-
|
|
1123
|
+
g as mergeRecords,
|
|
1164
1124
|
ce as mergeRequest,
|
|
1165
1125
|
M as resolveTimeout,
|
|
1166
|
-
|
|
1126
|
+
H as timeoutFetch,
|
|
1167
1127
|
m as toSorted,
|
|
1168
1128
|
L as uriTemplateResolver,
|
|
1169
1129
|
w as urlTemplateRegexExtract,
|