@ahoo-wang/fetcher 2.6.8 → 2.6.10
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/fetchExchange.d.ts +1 -1
- package/dist/fetchExchange.d.ts.map +1 -1
- package/dist/index.es.js +60 -60
- 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 +4 -4
package/dist/fetchExchange.d.ts
CHANGED
|
@@ -188,6 +188,6 @@ export declare class FetchExchange implements RequiredBy<FetchExchangeInit, 'att
|
|
|
188
188
|
*
|
|
189
189
|
* @returns The extracted result
|
|
190
190
|
*/
|
|
191
|
-
extractResult<R>():
|
|
191
|
+
extractResult<R>(): Promise<R>;
|
|
192
192
|
}
|
|
193
193
|
//# sourceMappingURL=fetchExchange.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchExchange.d.ts","sourceRoot":"","sources":["../src/fetchExchange.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AAGtE,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,CAA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AC,CAAC;gBAEjB,YAAY,EAAE,iBAAiB;IAU3C;;;;;;;;OAQG;IACH,oBAAoB,IAAI,cAAc;IAOtC;;;;;;;;;;OAUG;IACH,sBAAsB,IAAI,QAAQ,CAAC,SAAS,CAAC;IAgB7C;;;;OAIG;IACH,QAAQ,IAAI,OAAO;IAInB;;;;;;OAMG;IACH,IAAI,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAG1C;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,QAAQ,GAAG,SAAS,CAEnC;IAED;;;;OAIG;IACH,WAAW,IAAI,OAAO;IAItB;;;;;;;;;OASG;IACH,IAAI,gBAAgB,IAAI,QAAQ,CAQ/B;IAED;;;;;OAKG;IACG,aAAa,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;CAOrC"}
|
package/dist/index.es.js
CHANGED
|
@@ -209,12 +209,12 @@ class $ {
|
|
|
209
209
|
*/
|
|
210
210
|
build(t, r) {
|
|
211
211
|
const s = r?.path, o = r?.query, n = B(this.baseURL, t);
|
|
212
|
-
let
|
|
212
|
+
let a = this.urlTemplateResolver.resolve(n, s);
|
|
213
213
|
if (o) {
|
|
214
|
-
const
|
|
215
|
-
|
|
214
|
+
const u = new URLSearchParams(o).toString();
|
|
215
|
+
u && (a += "?" + u);
|
|
216
216
|
}
|
|
217
|
-
return
|
|
217
|
+
return a;
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* Resolves a complete URL from a FetchRequest.
|
|
@@ -241,7 +241,7 @@ class E extends Error {
|
|
|
241
241
|
super(s), this.cause = r, this.name = "FetcherError", r?.stack && (this.stack = r.stack), Object.setPrototypeOf(this, E.prototype);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
class
|
|
244
|
+
class O extends E {
|
|
245
245
|
/**
|
|
246
246
|
* Creates a new FetchTimeoutError instance.
|
|
247
247
|
*
|
|
@@ -249,7 +249,7 @@ class q extends E {
|
|
|
249
249
|
*/
|
|
250
250
|
constructor(t) {
|
|
251
251
|
const r = t.method || "GET", s = `Request timeout of ${t.timeout}ms exceeded for ${r} ${t.url}`;
|
|
252
|
-
super(s), this.name = "FetchTimeoutError", this.request = t, Object.setPrototypeOf(this,
|
|
252
|
+
super(s), this.name = "FetchTimeoutError", this.request = t, Object.setPrototypeOf(this, O.prototype);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
function X(e, t) {
|
|
@@ -264,15 +264,15 @@ async function V(e) {
|
|
|
264
264
|
const o = e.abortController ?? new AbortController();
|
|
265
265
|
e.abortController = o, s.signal = o.signal;
|
|
266
266
|
let n = null;
|
|
267
|
-
const
|
|
267
|
+
const a = new Promise((u, T) => {
|
|
268
268
|
n = setTimeout(() => {
|
|
269
269
|
n && clearTimeout(n);
|
|
270
|
-
const
|
|
271
|
-
o.abort(
|
|
270
|
+
const I = new O(e);
|
|
271
|
+
o.abort(I), T(I);
|
|
272
272
|
}, r);
|
|
273
273
|
});
|
|
274
274
|
try {
|
|
275
|
-
return await Promise.race([fetch(t, s),
|
|
275
|
+
return await Promise.race([fetch(t, s), a]);
|
|
276
276
|
} finally {
|
|
277
277
|
n && clearTimeout(n);
|
|
278
278
|
}
|
|
@@ -292,7 +292,7 @@ class J {
|
|
|
292
292
|
r.url = t.fetcher.urlBuilder.resolveRequestUrl(r);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
var
|
|
295
|
+
var i = /* @__PURE__ */ ((e) => (e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.DELETE = "DELETE", e.PATCH = "PATCH", e.HEAD = "HEAD", e.OPTIONS = "OPTIONS", e.TRACE = "TRACE", e))(i || {});
|
|
296
296
|
const c = "Content-Type", d = class d {
|
|
297
297
|
};
|
|
298
298
|
d.APPLICATION_JSON = "application/json", d.TEXT_EVENT_STREAM = "text/event-stream";
|
|
@@ -503,11 +503,11 @@ class m {
|
|
|
503
503
|
await r.intercept(t);
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
class
|
|
506
|
+
class q extends E {
|
|
507
507
|
constructor(t) {
|
|
508
508
|
super(
|
|
509
509
|
`Request failed with status code ${t.response?.status} for ${t.request.url}`
|
|
510
|
-
), this.exchange = t, this.name = "HttpStatusValidationError", Object.setPrototypeOf(this,
|
|
510
|
+
), this.exchange = t, this.name = "HttpStatusValidationError", Object.setPrototypeOf(this, q.prototype);
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
const tt = (e) => e >= 200 && e < 300, et = "ValidateStatusInterceptor", rt = Number.MAX_SAFE_INTEGER - 1e3;
|
|
@@ -554,7 +554,7 @@ class st {
|
|
|
554
554
|
return;
|
|
555
555
|
const r = t.response.status;
|
|
556
556
|
if (!this.validateStatus(r))
|
|
557
|
-
throw new
|
|
557
|
+
throw new q(t);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
class p extends E {
|
|
@@ -675,7 +675,7 @@ class ot {
|
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
const nt = (e) => e,
|
|
678
|
+
const nt = (e) => e, it = (e) => e.requiredResponse, at = (e) => e.requiredResponse.json(), ut = (e) => e.requiredResponse.text(), ct = (e) => e.requiredResponse.blob(), ht = (e) => e.requiredResponse.arrayBuffer(), lt = (e) => e.requiredResponse.bytes(), b = {
|
|
679
679
|
/**
|
|
680
680
|
* Returns the original FetchExchange object
|
|
681
681
|
*/
|
|
@@ -683,15 +683,15 @@ const nt = (e) => e, ut = (e) => e.requiredResponse, it = (e) => e.requiredRespo
|
|
|
683
683
|
/**
|
|
684
684
|
* Extracts the raw Response object
|
|
685
685
|
*/
|
|
686
|
-
Response:
|
|
686
|
+
Response: it,
|
|
687
687
|
/**
|
|
688
688
|
* Parses and returns response body as JSON
|
|
689
689
|
*/
|
|
690
|
-
Json:
|
|
690
|
+
Json: at,
|
|
691
691
|
/**
|
|
692
692
|
* Returns response body as text
|
|
693
693
|
*/
|
|
694
|
-
Text:
|
|
694
|
+
Text: ut,
|
|
695
695
|
/**
|
|
696
696
|
* Returns response body as a Blob
|
|
697
697
|
*/
|
|
@@ -723,7 +723,7 @@ function Et(e, t) {
|
|
|
723
723
|
}
|
|
724
724
|
class Rt {
|
|
725
725
|
constructor(t) {
|
|
726
|
-
this.fetcher = t.fetcher, this.request = t.request, this.resultExtractor = t.resultExtractor ??
|
|
726
|
+
this.fetcher = t.fetcher, this.request = t.request, this.resultExtractor = t.resultExtractor ?? b.Exchange, this.attributes = Et(t.attributes), this._response = t.response, this.error = t.error;
|
|
727
727
|
}
|
|
728
728
|
/**
|
|
729
729
|
* Ensures that request headers object exists, creating it if necessary.
|
|
@@ -812,8 +812,8 @@ class Rt {
|
|
|
812
812
|
*
|
|
813
813
|
* @returns The extracted result
|
|
814
814
|
*/
|
|
815
|
-
extractResult() {
|
|
816
|
-
return this.cachedExtractedResult !== void 0 ? this.cachedExtractedResult : (this.cachedExtractedResult = this.resultExtractor(this), this.cachedExtractedResult);
|
|
815
|
+
async extractResult() {
|
|
816
|
+
return this.cachedExtractedResult !== void 0 ? await this.cachedExtractedResult : (this.cachedExtractedResult = this.resultExtractor(this), await this.cachedExtractedResult);
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
function Tt(e, t) {
|
|
@@ -827,7 +827,7 @@ function Tt(e, t) {
|
|
|
827
827
|
}, s = {
|
|
828
828
|
...e.headers,
|
|
829
829
|
...t.headers
|
|
830
|
-
}, o = t.method ?? e.method, n = t.body ?? e.body,
|
|
830
|
+
}, o = t.method ?? e.method, n = t.body ?? e.body, a = t.timeout ?? e.timeout, u = t.signal ?? e.signal, T = t.abortController ?? e.abortController;
|
|
831
831
|
return {
|
|
832
832
|
...e,
|
|
833
833
|
...t,
|
|
@@ -835,8 +835,8 @@ function Tt(e, t) {
|
|
|
835
835
|
urlParams: r,
|
|
836
836
|
headers: s,
|
|
837
837
|
body: n,
|
|
838
|
-
timeout:
|
|
839
|
-
signal:
|
|
838
|
+
timeout: a,
|
|
839
|
+
signal: u,
|
|
840
840
|
abortController: T
|
|
841
841
|
};
|
|
842
842
|
}
|
|
@@ -846,15 +846,15 @@ function A(e, t) {
|
|
|
846
846
|
attributes: t?.attributes ?? e?.attributes
|
|
847
847
|
};
|
|
848
848
|
}
|
|
849
|
-
const
|
|
849
|
+
const w = {
|
|
850
850
|
[c]: R.APPLICATION_JSON
|
|
851
851
|
}, U = {
|
|
852
852
|
baseURL: "",
|
|
853
|
-
headers:
|
|
853
|
+
headers: w
|
|
854
854
|
}, v = {
|
|
855
|
-
resultExtractor:
|
|
855
|
+
resultExtractor: b.Exchange
|
|
856
856
|
}, N = {
|
|
857
|
-
resultExtractor:
|
|
857
|
+
resultExtractor: b.Response
|
|
858
858
|
};
|
|
859
859
|
class D {
|
|
860
860
|
/**
|
|
@@ -871,7 +871,7 @@ class D {
|
|
|
871
871
|
* @param options.interceptors - Interceptor manager for processing requests and responses.
|
|
872
872
|
*/
|
|
873
873
|
constructor(t = U) {
|
|
874
|
-
this.headers =
|
|
874
|
+
this.headers = w, this.urlBuilder = new $(t.baseURL, t.urlTemplateStyle), this.headers = t.headers ?? w, this.timeout = t.timeout, this.interceptors = t.interceptors ?? new ot();
|
|
875
875
|
}
|
|
876
876
|
/**
|
|
877
877
|
* Processes an HTTP request through the Fetcher's internal workflow.
|
|
@@ -891,16 +891,16 @@ class D {
|
|
|
891
891
|
...t,
|
|
892
892
|
headers: s,
|
|
893
893
|
timeout: X(t.timeout, this.timeout)
|
|
894
|
-
}, { resultExtractor: n, attributes:
|
|
894
|
+
}, { resultExtractor: n, attributes: a } = A(
|
|
895
895
|
v,
|
|
896
896
|
r
|
|
897
|
-
),
|
|
897
|
+
), u = new Rt({
|
|
898
898
|
fetcher: this,
|
|
899
899
|
request: o,
|
|
900
900
|
resultExtractor: n,
|
|
901
|
-
attributes:
|
|
901
|
+
attributes: a
|
|
902
902
|
});
|
|
903
|
-
return this.interceptors.exchange(
|
|
903
|
+
return await this.interceptors.exchange(u);
|
|
904
904
|
}
|
|
905
905
|
/**
|
|
906
906
|
* Processes an HTTP request through the Fetcher's internal workflow.
|
|
@@ -921,7 +921,7 @@ class D {
|
|
|
921
921
|
* @throws Error if an unhandled error occurs during request processing
|
|
922
922
|
*/
|
|
923
923
|
async request(t, r) {
|
|
924
|
-
return (await this.exchange(t, r)).extractResult();
|
|
924
|
+
return await (await this.exchange(t, r)).extractResult();
|
|
925
925
|
}
|
|
926
926
|
/**
|
|
927
927
|
* Executes an HTTP request with the specified URL and options.
|
|
@@ -946,7 +946,7 @@ class D {
|
|
|
946
946
|
...r,
|
|
947
947
|
url: t
|
|
948
948
|
};
|
|
949
|
-
return this.request(
|
|
949
|
+
return await this.request(
|
|
950
950
|
o,
|
|
951
951
|
A(N, s)
|
|
952
952
|
);
|
|
@@ -975,7 +975,7 @@ class D {
|
|
|
975
975
|
url: r,
|
|
976
976
|
method: t
|
|
977
977
|
};
|
|
978
|
-
return this.request(
|
|
978
|
+
return await this.request(
|
|
979
979
|
n,
|
|
980
980
|
A(N, o)
|
|
981
981
|
);
|
|
@@ -998,7 +998,7 @@ class D {
|
|
|
998
998
|
* @returns Promise that resolves to the HTTP response
|
|
999
999
|
*/
|
|
1000
1000
|
async get(t, r = {}, s) {
|
|
1001
|
-
return this.methodFetch(
|
|
1001
|
+
return await this.methodFetch(i.GET, t, r, s);
|
|
1002
1002
|
}
|
|
1003
1003
|
/**
|
|
1004
1004
|
* Makes a PUT HTTP request.
|
|
@@ -1017,7 +1017,7 @@ class D {
|
|
|
1017
1017
|
* @returns Promise that resolves to the HTTP response
|
|
1018
1018
|
*/
|
|
1019
1019
|
async put(t, r = {}, s) {
|
|
1020
|
-
return this.methodFetch(
|
|
1020
|
+
return await this.methodFetch(i.PUT, t, r, s);
|
|
1021
1021
|
}
|
|
1022
1022
|
/**
|
|
1023
1023
|
* Makes a POST HTTP request.
|
|
@@ -1036,7 +1036,7 @@ class D {
|
|
|
1036
1036
|
* @returns Promise that resolves to the HTTP response
|
|
1037
1037
|
*/
|
|
1038
1038
|
async post(t, r = {}, s) {
|
|
1039
|
-
return this.methodFetch(
|
|
1039
|
+
return await this.methodFetch(i.POST, t, r, s);
|
|
1040
1040
|
}
|
|
1041
1041
|
/**
|
|
1042
1042
|
* Makes a PATCH HTTP request.
|
|
@@ -1055,7 +1055,7 @@ class D {
|
|
|
1055
1055
|
* @returns Promise that resolves to the HTTP response
|
|
1056
1056
|
*/
|
|
1057
1057
|
async patch(t, r = {}, s) {
|
|
1058
|
-
return this.methodFetch(
|
|
1058
|
+
return await this.methodFetch(i.PATCH, t, r, s);
|
|
1059
1059
|
}
|
|
1060
1060
|
/**
|
|
1061
1061
|
* Makes a DELETE HTTP request.
|
|
@@ -1074,7 +1074,7 @@ class D {
|
|
|
1074
1074
|
* @returns Promise that resolves to the HTTP response
|
|
1075
1075
|
*/
|
|
1076
1076
|
async delete(t, r = {}, s) {
|
|
1077
|
-
return this.methodFetch(
|
|
1077
|
+
return await this.methodFetch(i.DELETE, t, r, s);
|
|
1078
1078
|
}
|
|
1079
1079
|
/**
|
|
1080
1080
|
* Makes a HEAD HTTP request.
|
|
@@ -1094,7 +1094,7 @@ class D {
|
|
|
1094
1094
|
* @returns Promise that resolves to the HTTP response
|
|
1095
1095
|
*/
|
|
1096
1096
|
async head(t, r = {}, s) {
|
|
1097
|
-
return this.methodFetch(
|
|
1097
|
+
return await this.methodFetch(i.HEAD, t, r, s);
|
|
1098
1098
|
}
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Makes an OPTIONS HTTP request.
|
|
@@ -1114,7 +1114,7 @@ class D {
|
|
|
1114
1114
|
* @returns Promise that resolves to the HTTP response
|
|
1115
1115
|
*/
|
|
1116
1116
|
async options(t, r = {}, s) {
|
|
1117
|
-
return this.methodFetch(
|
|
1117
|
+
return await this.methodFetch(i.OPTIONS, t, r, s);
|
|
1118
1118
|
}
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Sends an HTTP TRACE request to the specified URL and returns the response.
|
|
@@ -1132,10 +1132,10 @@ class D {
|
|
|
1132
1132
|
* The response contains status, headers, and body data from the TRACE request.
|
|
1133
1133
|
*/
|
|
1134
1134
|
async trace(t, r = {}, s) {
|
|
1135
|
-
return this.methodFetch(
|
|
1135
|
+
return await this.methodFetch(i.TRACE, t, r, s);
|
|
1136
1136
|
}
|
|
1137
1137
|
}
|
|
1138
|
-
const
|
|
1138
|
+
const g = "default";
|
|
1139
1139
|
class dt {
|
|
1140
1140
|
constructor() {
|
|
1141
1141
|
this.registrar = /* @__PURE__ */ new Map();
|
|
@@ -1209,7 +1209,7 @@ class dt {
|
|
|
1209
1209
|
* const defaultFetcher = fetcherRegistrar.default;
|
|
1210
1210
|
*/
|
|
1211
1211
|
get default() {
|
|
1212
|
-
return this.requiredGet(
|
|
1212
|
+
return this.requiredGet(g);
|
|
1213
1213
|
}
|
|
1214
1214
|
/**
|
|
1215
1215
|
* Set the default Fetcher instance
|
|
@@ -1220,7 +1220,7 @@ class dt {
|
|
|
1220
1220
|
* fetcherRegistrar.default = fetcher;
|
|
1221
1221
|
*/
|
|
1222
1222
|
set default(t) {
|
|
1223
|
-
this.register(
|
|
1223
|
+
this.register(g, t);
|
|
1224
1224
|
}
|
|
1225
1225
|
/**
|
|
1226
1226
|
* Get a copy of all registered fetchers
|
|
@@ -1236,9 +1236,9 @@ class dt {
|
|
|
1236
1236
|
return new Map(this.registrar);
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
const
|
|
1239
|
+
const _ = new dt();
|
|
1240
1240
|
function ft(e, t) {
|
|
1241
|
-
return e ? e instanceof D ? e :
|
|
1241
|
+
return e ? e instanceof D ? e : _.requiredGet(e) : t ?? _.default;
|
|
1242
1242
|
}
|
|
1243
1243
|
class pt extends D {
|
|
1244
1244
|
/**
|
|
@@ -1259,17 +1259,17 @@ class pt extends D {
|
|
|
1259
1259
|
* });
|
|
1260
1260
|
*/
|
|
1261
1261
|
constructor(t, r = U) {
|
|
1262
|
-
super(r), this.name = t,
|
|
1262
|
+
super(r), this.name = t, _.register(t, this);
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
const mt = new pt(
|
|
1265
|
+
const mt = new pt(g);
|
|
1266
1266
|
export {
|
|
1267
1267
|
ht as ArrayBufferResultExtractor,
|
|
1268
1268
|
ct as BlobResultExtractor,
|
|
1269
1269
|
lt as BytesResultExtractor,
|
|
1270
1270
|
c as CONTENT_TYPE_HEADER,
|
|
1271
1271
|
R as ContentTypeValues,
|
|
1272
|
-
|
|
1272
|
+
g as DEFAULT_FETCHER_NAME,
|
|
1273
1273
|
N as DEFAULT_FETCH_OPTIONS,
|
|
1274
1274
|
U as DEFAULT_OPTIONS,
|
|
1275
1275
|
v as DEFAULT_REQUEST_OPTIONS,
|
|
@@ -1280,22 +1280,22 @@ export {
|
|
|
1280
1280
|
W as FETCH_INTERCEPTOR_ORDER,
|
|
1281
1281
|
Rt as FetchExchange,
|
|
1282
1282
|
Z as FetchInterceptor,
|
|
1283
|
-
|
|
1283
|
+
O as FetchTimeoutError,
|
|
1284
1284
|
D as Fetcher,
|
|
1285
1285
|
E as FetcherError,
|
|
1286
1286
|
dt as FetcherRegistrar,
|
|
1287
|
-
|
|
1288
|
-
|
|
1287
|
+
i as HttpMethod,
|
|
1288
|
+
q as HttpStatusValidationError,
|
|
1289
1289
|
ot as InterceptorManager,
|
|
1290
1290
|
m as InterceptorRegistry,
|
|
1291
|
-
|
|
1291
|
+
at as JsonResultExtractor,
|
|
1292
1292
|
pt as NamedFetcher,
|
|
1293
1293
|
Q as REQUEST_BODY_INTERCEPTOR_NAME,
|
|
1294
1294
|
Y as REQUEST_BODY_INTERCEPTOR_ORDER,
|
|
1295
1295
|
z as RequestBodyInterceptor,
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1296
|
+
it as ResponseResultExtractor,
|
|
1297
|
+
b as ResultExtractors,
|
|
1298
|
+
ut as TextResultExtractor,
|
|
1299
1299
|
k as URL_RESOLVE_INTERCEPTOR_NAME,
|
|
1300
1300
|
C as URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
1301
1301
|
P as UriTemplateResolver,
|
|
@@ -1308,7 +1308,7 @@ export {
|
|
|
1308
1308
|
B as combineURLs,
|
|
1309
1309
|
j as expressUrlTemplateResolver,
|
|
1310
1310
|
mt as fetcher,
|
|
1311
|
-
|
|
1311
|
+
_ as fetcherRegistrar,
|
|
1312
1312
|
ft as getFetcher,
|
|
1313
1313
|
G as getUrlTemplateResolver,
|
|
1314
1314
|
L as isAbsoluteURL,
|