@wordpress/api-fetch 7.32.0 → 7.32.1-next.b8c8708f3.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/build/index.js +112 -145
- package/build/index.js.map +7 -1
- package/build/middlewares/fetch-all-middleware.js +48 -81
- package/build/middlewares/fetch-all-middleware.js.map +7 -1
- package/build/middlewares/http-v1.js +29 -38
- package/build/middlewares/http-v1.js.map +7 -1
- package/build/middlewares/media-upload.js +43 -49
- package/build/middlewares/media-upload.js.map +7 -1
- package/build/middlewares/namespace-endpoint.js +27 -14
- package/build/middlewares/namespace-endpoint.js.map +7 -1
- package/build/middlewares/nonce.js +26 -23
- package/build/middlewares/nonce.js.map +7 -1
- package/build/middlewares/preloading.js +63 -60
- package/build/middlewares/preloading.js.map +7 -1
- package/build/middlewares/root-url.js +42 -27
- package/build/middlewares/root-url.js.map +7 -1
- package/build/middlewares/theme-preview.js +49 -38
- package/build/middlewares/theme-preview.js.map +7 -1
- package/build/middlewares/user-locale.js +28 -23
- package/build/middlewares/user-locale.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build/utils/response.js +31 -39
- package/build/utils/response.js.map +7 -1
- package/build-module/index.js +76 -121
- package/build-module/index.js.map +7 -1
- package/build-module/middlewares/fetch-all-middleware.js +16 -71
- package/build-module/middlewares/fetch-all-middleware.js.map +7 -1
- package/build-module/middlewares/http-v1.js +11 -34
- package/build-module/middlewares/http-v1.js.map +7 -1
- package/build-module/middlewares/media-upload.js +27 -43
- package/build-module/middlewares/media-upload.js.map +7 -1
- package/build-module/middlewares/namespace-endpoint.js +9 -10
- package/build-module/middlewares/namespace-endpoint.js.map +7 -1
- package/build-module/middlewares/nonce.js +8 -19
- package/build-module/middlewares/nonce.js.map +7 -1
- package/build-module/middlewares/preloading.js +43 -54
- package/build-module/middlewares/preloading.js.map +7 -1
- package/build-module/middlewares/root-url.js +14 -23
- package/build-module/middlewares/root-url.js.map +7 -1
- package/build-module/middlewares/theme-preview.js +29 -31
- package/build-module/middlewares/theme-preview.js.map +7 -1
- package/build-module/middlewares/user-locale.js +10 -19
- package/build-module/middlewares/user-locale.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/build-module/utils/response.js +10 -36
- package/build-module/utils/response.js.map +7 -1
- package/package.json +13 -5
|
@@ -1,42 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import apiFetch from '..';
|
|
10
|
-
/**
|
|
11
|
-
* Apply query arguments to both URL and Path, whichever is present.
|
|
12
|
-
*
|
|
13
|
-
* @param {APIFetchOptions} props The request options
|
|
14
|
-
* @param {Record< string, string | number >} queryArgs
|
|
15
|
-
* @return The request with the modified query args
|
|
16
|
-
*/
|
|
17
|
-
const modifyQuery = ({
|
|
18
|
-
path,
|
|
19
|
-
url,
|
|
20
|
-
...options
|
|
21
|
-
}, queryArgs) => ({
|
|
1
|
+
import { addQueryArgs } from "@wordpress/url";
|
|
2
|
+
import apiFetch from "..";
|
|
3
|
+
const modifyQuery = ({ path, url, ...options }, queryArgs) => ({
|
|
22
4
|
...options,
|
|
23
5
|
url: url && addQueryArgs(url, queryArgs),
|
|
24
6
|
path: path && addQueryArgs(path, queryArgs)
|
|
25
7
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* Duplicates parsing functionality from apiFetch.
|
|
29
|
-
*
|
|
30
|
-
* @param response
|
|
31
|
-
* @return Parsed response json.
|
|
32
|
-
*/
|
|
33
|
-
const parseResponse = response => response.json ? response.json() : Promise.reject(response);
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @param linkHeader
|
|
37
|
-
* @return The parsed link header.
|
|
38
|
-
*/
|
|
39
|
-
const parseLinkHeader = linkHeader => {
|
|
8
|
+
const parseResponse = (response) => response.json ? response.json() : Promise.reject(response);
|
|
9
|
+
const parseLinkHeader = (linkHeader) => {
|
|
40
10
|
if (!linkHeader) {
|
|
41
11
|
return {};
|
|
42
12
|
}
|
|
@@ -45,46 +15,22 @@ const parseLinkHeader = linkHeader => {
|
|
|
45
15
|
next: match[1]
|
|
46
16
|
} : {};
|
|
47
17
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* @param response
|
|
51
|
-
* @return The next page URL.
|
|
52
|
-
*/
|
|
53
|
-
const getNextPageUrl = response => {
|
|
54
|
-
const {
|
|
55
|
-
next
|
|
56
|
-
} = parseLinkHeader(response.headers.get('link'));
|
|
18
|
+
const getNextPageUrl = (response) => {
|
|
19
|
+
const { next } = parseLinkHeader(response.headers.get("link"));
|
|
57
20
|
return next;
|
|
58
21
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* @return True if the request contains an unbounded query.
|
|
63
|
-
*/
|
|
64
|
-
const requestContainsUnboundedQuery = options => {
|
|
65
|
-
const pathIsUnbounded = !!options.path && options.path.indexOf('per_page=-1') !== -1;
|
|
66
|
-
const urlIsUnbounded = !!options.url && options.url.indexOf('per_page=-1') !== -1;
|
|
22
|
+
const requestContainsUnboundedQuery = (options) => {
|
|
23
|
+
const pathIsUnbounded = !!options.path && options.path.indexOf("per_page=-1") !== -1;
|
|
24
|
+
const urlIsUnbounded = !!options.url && options.url.indexOf("per_page=-1") !== -1;
|
|
67
25
|
return pathIsUnbounded || urlIsUnbounded;
|
|
68
26
|
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The REST API enforces an upper limit on the per_page option. To handle large
|
|
72
|
-
* collections, apiFetch consumers can pass `per_page=-1`; this middleware will
|
|
73
|
-
* then recursively assemble a full response array from all available pages.
|
|
74
|
-
* @param options
|
|
75
|
-
* @param next
|
|
76
|
-
*/
|
|
77
27
|
const fetchAllMiddleware = async (options, next) => {
|
|
78
28
|
if (options.parse === false) {
|
|
79
|
-
// If a consumer has opted out of parsing, do not apply middleware.
|
|
80
29
|
return next(options);
|
|
81
30
|
}
|
|
82
31
|
if (!requestContainsUnboundedQuery(options)) {
|
|
83
|
-
// If neither url nor path is requesting all items, do not apply middleware.
|
|
84
32
|
return next(options);
|
|
85
33
|
}
|
|
86
|
-
|
|
87
|
-
// Retrieve requested page of results.
|
|
88
34
|
const response = await apiFetch({
|
|
89
35
|
...modifyQuery(options, {
|
|
90
36
|
per_page: 100
|
|
@@ -94,22 +40,18 @@ const fetchAllMiddleware = async (options, next) => {
|
|
|
94
40
|
});
|
|
95
41
|
const results = await parseResponse(response);
|
|
96
42
|
if (!Array.isArray(results)) {
|
|
97
|
-
// We have no reliable way of merging non-array results.
|
|
98
43
|
return results;
|
|
99
44
|
}
|
|
100
45
|
let nextPage = getNextPageUrl(response);
|
|
101
46
|
if (!nextPage) {
|
|
102
|
-
// There are no further pages to request.
|
|
103
47
|
return results;
|
|
104
48
|
}
|
|
105
|
-
|
|
106
|
-
// Iteratively fetch all remaining pages until no "next" header is found.
|
|
107
49
|
let mergedResults = [].concat(results);
|
|
108
50
|
while (nextPage) {
|
|
109
51
|
const nextResponse = await apiFetch({
|
|
110
52
|
...options,
|
|
111
53
|
// Ensure the URL for the next page is used instead of any provided path.
|
|
112
|
-
path:
|
|
54
|
+
path: void 0,
|
|
113
55
|
url: nextPage,
|
|
114
56
|
// Ensure we still get headers so we can identify the next page.
|
|
115
57
|
parse: false
|
|
@@ -120,5 +62,8 @@ const fetchAllMiddleware = async (options, next) => {
|
|
|
120
62
|
}
|
|
121
63
|
return mergedResults;
|
|
122
64
|
};
|
|
123
|
-
|
|
124
|
-
|
|
65
|
+
var fetch_all_middleware_default = fetchAllMiddleware;
|
|
66
|
+
export {
|
|
67
|
+
fetch_all_middleware_default as default
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=fetch-all-middleware.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/middlewares/fetch-all-middleware.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport apiFetch from '..';\nimport type { APIFetchMiddleware, APIFetchOptions } from '../types';\n\n/**\n * Apply query arguments to both URL and Path, whichever is present.\n *\n * @param {APIFetchOptions} props The request options\n * @param {Record< string, string | number >} queryArgs\n * @return The request with the modified query args\n */\nconst modifyQuery = (\n\t{ path, url, ...options }: APIFetchOptions,\n\tqueryArgs: Record< string, string | number >\n): APIFetchOptions => ( {\n\t...options,\n\turl: url && addQueryArgs( url, queryArgs ),\n\tpath: path && addQueryArgs( path, queryArgs ),\n} );\n\n/**\n * Duplicates parsing functionality from apiFetch.\n *\n * @param response\n * @return Parsed response json.\n */\nconst parseResponse = ( response: Response ) =>\n\tresponse.json ? response.json() : Promise.reject( response );\n\n/**\n * @param linkHeader\n * @return The parsed link header.\n */\nconst parseLinkHeader = ( linkHeader: string | null ) => {\n\tif ( ! linkHeader ) {\n\t\treturn {};\n\t}\n\tconst match = linkHeader.match( /<([^>]+)>; rel=\"next\"/ );\n\treturn match\n\t\t? {\n\t\t\t\tnext: match[ 1 ],\n\t\t }\n\t\t: {};\n};\n\n/**\n * @param response\n * @return The next page URL.\n */\nconst getNextPageUrl = ( response: Response ) => {\n\tconst { next } = parseLinkHeader( response.headers.get( 'link' ) );\n\treturn next;\n};\n\n/**\n * @param options\n * @return True if the request contains an unbounded query.\n */\nconst requestContainsUnboundedQuery = ( options: APIFetchOptions ) => {\n\tconst pathIsUnbounded =\n\t\t!! options.path && options.path.indexOf( 'per_page=-1' ) !== -1;\n\tconst urlIsUnbounded =\n\t\t!! options.url && options.url.indexOf( 'per_page=-1' ) !== -1;\n\treturn pathIsUnbounded || urlIsUnbounded;\n};\n\n/**\n * The REST API enforces an upper limit on the per_page option. To handle large\n * collections, apiFetch consumers can pass `per_page=-1`; this middleware will\n * then recursively assemble a full response array from all available pages.\n * @param options\n * @param next\n */\nconst fetchAllMiddleware: APIFetchMiddleware = async ( options, next ) => {\n\tif ( options.parse === false ) {\n\t\t// If a consumer has opted out of parsing, do not apply middleware.\n\t\treturn next( options );\n\t}\n\tif ( ! requestContainsUnboundedQuery( options ) ) {\n\t\t// If neither url nor path is requesting all items, do not apply middleware.\n\t\treturn next( options );\n\t}\n\n\t// Retrieve requested page of results.\n\tconst response = await apiFetch( {\n\t\t...modifyQuery( options, {\n\t\t\tper_page: 100,\n\t\t} ),\n\t\t// Ensure headers are returned for page 1.\n\t\tparse: false,\n\t} );\n\n\tconst results = await parseResponse( response );\n\n\tif ( ! Array.isArray( results ) ) {\n\t\t// We have no reliable way of merging non-array results.\n\t\treturn results;\n\t}\n\n\tlet nextPage = getNextPageUrl( response );\n\n\tif ( ! nextPage ) {\n\t\t// There are no further pages to request.\n\t\treturn results;\n\t}\n\n\t// Iteratively fetch all remaining pages until no \"next\" header is found.\n\tlet mergedResults = ( [] as Array< any > ).concat( results );\n\twhile ( nextPage ) {\n\t\tconst nextResponse = await apiFetch( {\n\t\t\t...options,\n\t\t\t// Ensure the URL for the next page is used instead of any provided path.\n\t\t\tpath: undefined,\n\t\t\turl: nextPage,\n\t\t\t// Ensure we still get headers so we can identify the next page.\n\t\t\tparse: false,\n\t\t} );\n\t\tconst nextResults = await parseResponse( nextResponse );\n\t\tmergedResults = mergedResults.concat( nextResults );\n\t\tnextPage = getNextPageUrl( nextResponse );\n\t}\n\treturn mergedResults;\n};\n\nexport default fetchAllMiddleware;\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,oBAAoB;AAK7B,OAAO,cAAc;AAUrB,MAAM,cAAc,CACnB,EAAE,MAAM,KAAK,GAAG,QAAQ,GACxB,eACuB;AAAA,EACvB,GAAG;AAAA,EACH,KAAK,OAAO,aAAc,KAAK,SAAU;AAAA,EACzC,MAAM,QAAQ,aAAc,MAAM,SAAU;AAC7C;AAQA,MAAM,gBAAgB,CAAE,aACvB,SAAS,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAQ,QAAS;AAM5D,MAAM,kBAAkB,CAAE,eAA+B;AACxD,MAAK,CAAE,YAAa;AACnB,WAAO,CAAC;AAAA,EACT;AACA,QAAM,QAAQ,WAAW,MAAO,uBAAwB;AACxD,SAAO,QACJ;AAAA,IACA,MAAM,MAAO,CAAE;AAAA,EACf,IACA,CAAC;AACL;AAMA,MAAM,iBAAiB,CAAE,aAAwB;AAChD,QAAM,EAAE,KAAK,IAAI,gBAAiB,SAAS,QAAQ,IAAK,MAAO,CAAE;AACjE,SAAO;AACR;AAMA,MAAM,gCAAgC,CAAE,YAA8B;AACrE,QAAM,kBACL,CAAC,CAAE,QAAQ,QAAQ,QAAQ,KAAK,QAAS,aAAc,MAAM;AAC9D,QAAM,iBACL,CAAC,CAAE,QAAQ,OAAO,QAAQ,IAAI,QAAS,aAAc,MAAM;AAC5D,SAAO,mBAAmB;AAC3B;AASA,MAAM,qBAAyC,OAAQ,SAAS,SAAU;AACzE,MAAK,QAAQ,UAAU,OAAQ;AAE9B,WAAO,KAAM,OAAQ;AAAA,EACtB;AACA,MAAK,CAAE,8BAA+B,OAAQ,GAAI;AAEjD,WAAO,KAAM,OAAQ;AAAA,EACtB;AAGA,QAAM,WAAW,MAAM,SAAU;AAAA,IAChC,GAAG,YAAa,SAAS;AAAA,MACxB,UAAU;AAAA,IACX,CAAE;AAAA;AAAA,IAEF,OAAO;AAAA,EACR,CAAE;AAEF,QAAM,UAAU,MAAM,cAAe,QAAS;AAE9C,MAAK,CAAE,MAAM,QAAS,OAAQ,GAAI;AAEjC,WAAO;AAAA,EACR;AAEA,MAAI,WAAW,eAAgB,QAAS;AAExC,MAAK,CAAE,UAAW;AAEjB,WAAO;AAAA,EACR;AAGA,MAAI,gBAAkB,CAAC,EAAoB,OAAQ,OAAQ;AAC3D,SAAQ,UAAW;AAClB,UAAM,eAAe,MAAM,SAAU;AAAA,MACpC,GAAG;AAAA;AAAA,MAEH,MAAM;AAAA,MACN,KAAK;AAAA;AAAA,MAEL,OAAO;AAAA,IACR,CAAE;AACF,UAAM,cAAc,MAAM,cAAe,YAAa;AACtD,oBAAgB,cAAc,OAAQ,WAAY;AAClD,eAAW,eAAgB,YAAa;AAAA,EACzC;AACA,SAAO;AACR;AAEA,IAAO,+BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,45 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Set of HTTP methods which are eligible to be overridden.
|
|
7
|
-
*/
|
|
8
|
-
const OVERRIDE_METHODS = new Set(['PATCH', 'PUT', 'DELETE']);
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Default request method.
|
|
12
|
-
*
|
|
13
|
-
* "A request has an associated method (a method). Unless stated otherwise it
|
|
14
|
-
* is `GET`."
|
|
15
|
-
*
|
|
16
|
-
* @see https://fetch.spec.whatwg.org/#requests
|
|
17
|
-
*/
|
|
18
|
-
const DEFAULT_METHOD = 'GET';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* API Fetch middleware which overrides the request method for HTTP v1
|
|
22
|
-
* compatibility leveraging the REST API X-HTTP-Method-Override header.
|
|
23
|
-
*
|
|
24
|
-
* @param options
|
|
25
|
-
* @param next
|
|
26
|
-
*/
|
|
1
|
+
const OVERRIDE_METHODS = /* @__PURE__ */ new Set(["PATCH", "PUT", "DELETE"]);
|
|
2
|
+
const DEFAULT_METHOD = "GET";
|
|
27
3
|
const httpV1Middleware = (options, next) => {
|
|
28
|
-
const {
|
|
29
|
-
method = DEFAULT_METHOD
|
|
30
|
-
} = options;
|
|
4
|
+
const { method = DEFAULT_METHOD } = options;
|
|
31
5
|
if (OVERRIDE_METHODS.has(method.toUpperCase())) {
|
|
32
6
|
options = {
|
|
33
7
|
...options,
|
|
34
8
|
headers: {
|
|
35
9
|
...options.headers,
|
|
36
|
-
|
|
37
|
-
|
|
10
|
+
"X-HTTP-Method-Override": method,
|
|
11
|
+
"Content-Type": "application/json"
|
|
38
12
|
},
|
|
39
|
-
method:
|
|
13
|
+
method: "POST"
|
|
40
14
|
};
|
|
41
15
|
}
|
|
42
16
|
return next(options);
|
|
43
17
|
};
|
|
44
|
-
|
|
45
|
-
|
|
18
|
+
var http_v1_default = httpV1Middleware;
|
|
19
|
+
export {
|
|
20
|
+
http_v1_default as default
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=http-v1.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/middlewares/http-v1.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { APIFetchMiddleware } from '../types';\n\n/**\n * Set of HTTP methods which are eligible to be overridden.\n */\nconst OVERRIDE_METHODS = new Set( [ 'PATCH', 'PUT', 'DELETE' ] );\n\n/**\n * Default request method.\n *\n * \"A request has an associated method (a method). Unless stated otherwise it\n * is `GET`.\"\n *\n * @see https://fetch.spec.whatwg.org/#requests\n */\nconst DEFAULT_METHOD = 'GET';\n\n/**\n * API Fetch middleware which overrides the request method for HTTP v1\n * compatibility leveraging the REST API X-HTTP-Method-Override header.\n *\n * @param options\n * @param next\n */\nconst httpV1Middleware: APIFetchMiddleware = ( options, next ) => {\n\tconst { method = DEFAULT_METHOD } = options;\n\tif ( OVERRIDE_METHODS.has( method.toUpperCase() ) ) {\n\t\toptions = {\n\t\t\t...options,\n\t\t\theaders: {\n\t\t\t\t...options.headers,\n\t\t\t\t'X-HTTP-Method-Override': method,\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tmethod: 'POST',\n\t\t};\n\t}\n\n\treturn next( options );\n};\n\nexport default httpV1Middleware;\n"],
|
|
5
|
+
"mappings": "AAQA,MAAM,mBAAmB,oBAAI,IAAK,CAAE,SAAS,OAAO,QAAS,CAAE;AAU/D,MAAM,iBAAiB;AASvB,MAAM,mBAAuC,CAAE,SAAS,SAAU;AACjE,QAAM,EAAE,SAAS,eAAe,IAAI;AACpC,MAAK,iBAAiB,IAAK,OAAO,YAAY,CAAE,GAAI;AACnD,cAAU;AAAA,MACT,GAAG;AAAA,MACH,SAAS;AAAA,QACR,GAAG,QAAQ;AAAA,QACX,0BAA0B;AAAA,QAC1B,gBAAgB;AAAA,MACjB;AAAA,MACA,QAAQ;AAAA,IACT;AAAA,EACD;AAEA,SAAO,KAAM,OAAQ;AACtB;AAEA,IAAO,kBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,46 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { parseAndThrowError, parseResponseAndNormalizeError } from '../utils/response';
|
|
10
|
-
/**
|
|
11
|
-
* @param options
|
|
12
|
-
* @return True if the request is for media upload.
|
|
13
|
-
*/
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
|
2
|
+
import {
|
|
3
|
+
parseAndThrowError,
|
|
4
|
+
parseResponseAndNormalizeError
|
|
5
|
+
} from "../utils/response";
|
|
14
6
|
function isMediaUploadRequest(options) {
|
|
15
|
-
const isCreateMethod = !!options.method && options.method ===
|
|
16
|
-
const isMediaEndpoint = !!options.path && options.path.indexOf(
|
|
7
|
+
const isCreateMethod = !!options.method && options.method === "POST";
|
|
8
|
+
const isMediaEndpoint = !!options.path && options.path.indexOf("/wp/v2/media") !== -1 || !!options.url && options.url.indexOf("/wp/v2/media") !== -1;
|
|
17
9
|
return isMediaEndpoint && isCreateMethod;
|
|
18
10
|
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Middleware handling media upload failures and retries.
|
|
22
|
-
* @param options
|
|
23
|
-
* @param next
|
|
24
|
-
*/
|
|
25
11
|
const mediaUploadMiddleware = (options, next) => {
|
|
26
12
|
if (!isMediaUploadRequest(options)) {
|
|
27
13
|
return next(options);
|
|
28
14
|
}
|
|
29
15
|
let retries = 0;
|
|
30
16
|
const maxRetries = 5;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @param attachmentId
|
|
34
|
-
* @return Processed post response.
|
|
35
|
-
*/
|
|
36
|
-
const postProcess = attachmentId => {
|
|
17
|
+
const postProcess = (attachmentId) => {
|
|
37
18
|
retries++;
|
|
38
19
|
return next({
|
|
39
20
|
path: `/wp/v2/media/${attachmentId}/post-process`,
|
|
40
|
-
method:
|
|
41
|
-
data: {
|
|
42
|
-
action: 'create-image-subsizes'
|
|
43
|
-
},
|
|
21
|
+
method: "POST",
|
|
22
|
+
data: { action: "create-image-subsizes" },
|
|
44
23
|
parse: false
|
|
45
24
|
}).catch(() => {
|
|
46
25
|
if (retries < maxRetries) {
|
|
@@ -48,33 +27,38 @@ const mediaUploadMiddleware = (options, next) => {
|
|
|
48
27
|
}
|
|
49
28
|
next({
|
|
50
29
|
path: `/wp/v2/media/${attachmentId}?force=true`,
|
|
51
|
-
method:
|
|
30
|
+
method: "DELETE"
|
|
52
31
|
});
|
|
53
32
|
return Promise.reject();
|
|
54
33
|
});
|
|
55
34
|
};
|
|
56
|
-
return next({
|
|
57
|
-
...options,
|
|
58
|
-
parse: false
|
|
59
|
-
}).catch(response => {
|
|
60
|
-
// `response` could actually be an error thrown by `defaultFetchHandler`.
|
|
35
|
+
return next({ ...options, parse: false }).catch((response) => {
|
|
61
36
|
if (!(response instanceof globalThis.Response)) {
|
|
62
37
|
return Promise.reject(response);
|
|
63
38
|
}
|
|
64
|
-
const attachmentId = response.headers.get(
|
|
39
|
+
const attachmentId = response.headers.get(
|
|
40
|
+
"x-wp-upload-attachment-id"
|
|
41
|
+
);
|
|
65
42
|
if (response.status >= 500 && response.status < 600 && attachmentId) {
|
|
66
43
|
return postProcess(attachmentId).catch(() => {
|
|
67
44
|
if (options.parse !== false) {
|
|
68
45
|
return Promise.reject({
|
|
69
|
-
code:
|
|
70
|
-
message: __(
|
|
46
|
+
code: "post_process",
|
|
47
|
+
message: __(
|
|
48
|
+
"Media upload failed. If this is a photo or a large image, please scale it down and try again."
|
|
49
|
+
)
|
|
71
50
|
});
|
|
72
51
|
}
|
|
73
52
|
return Promise.reject(response);
|
|
74
53
|
});
|
|
75
54
|
}
|
|
76
55
|
return parseAndThrowError(response, options.parse);
|
|
77
|
-
}).then(
|
|
56
|
+
}).then(
|
|
57
|
+
(response) => parseResponseAndNormalizeError(response, options.parse)
|
|
58
|
+
);
|
|
78
59
|
};
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
var media_upload_default = mediaUploadMiddleware;
|
|
61
|
+
export {
|
|
62
|
+
media_upload_default as default
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=media-upload.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/middlewares/media-upload.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tparseAndThrowError,\n\tparseResponseAndNormalizeError,\n} from '../utils/response';\nimport type { APIFetchOptions, APIFetchMiddleware } from '../types';\n\n/**\n * @param options\n * @return True if the request is for media upload.\n */\nfunction isMediaUploadRequest( options: APIFetchOptions ) {\n\tconst isCreateMethod = !! options.method && options.method === 'POST';\n\tconst isMediaEndpoint =\n\t\t( !! options.path && options.path.indexOf( '/wp/v2/media' ) !== -1 ) ||\n\t\t( !! options.url && options.url.indexOf( '/wp/v2/media' ) !== -1 );\n\n\treturn isMediaEndpoint && isCreateMethod;\n}\n\n/**\n * Middleware handling media upload failures and retries.\n * @param options\n * @param next\n */\nconst mediaUploadMiddleware: APIFetchMiddleware = ( options, next ) => {\n\tif ( ! isMediaUploadRequest( options ) ) {\n\t\treturn next( options );\n\t}\n\n\tlet retries = 0;\n\tconst maxRetries = 5;\n\n\t/**\n\t * @param attachmentId\n\t * @return Processed post response.\n\t */\n\tconst postProcess = ( attachmentId: string ): Promise< any > => {\n\t\tretries++;\n\t\treturn next( {\n\t\t\tpath: `/wp/v2/media/${ attachmentId }/post-process`,\n\t\t\tmethod: 'POST',\n\t\t\tdata: { action: 'create-image-subsizes' },\n\t\t\tparse: false,\n\t\t} ).catch( () => {\n\t\t\tif ( retries < maxRetries ) {\n\t\t\t\treturn postProcess( attachmentId );\n\t\t\t}\n\t\t\tnext( {\n\t\t\t\tpath: `/wp/v2/media/${ attachmentId }?force=true`,\n\t\t\t\tmethod: 'DELETE',\n\t\t\t} );\n\n\t\t\treturn Promise.reject();\n\t\t} );\n\t};\n\n\treturn next( { ...options, parse: false } )\n\t\t.catch( ( response: Response ) => {\n\t\t\t// `response` could actually be an error thrown by `defaultFetchHandler`.\n\t\t\tif ( ! ( response instanceof globalThis.Response ) ) {\n\t\t\t\treturn Promise.reject( response );\n\t\t\t}\n\n\t\t\tconst attachmentId = response.headers.get(\n\t\t\t\t'x-wp-upload-attachment-id'\n\t\t\t);\n\t\t\tif (\n\t\t\t\tresponse.status >= 500 &&\n\t\t\t\tresponse.status < 600 &&\n\t\t\t\tattachmentId\n\t\t\t) {\n\t\t\t\treturn postProcess( attachmentId ).catch( () => {\n\t\t\t\t\tif ( options.parse !== false ) {\n\t\t\t\t\t\treturn Promise.reject( {\n\t\t\t\t\t\t\tcode: 'post_process',\n\t\t\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t\t\t'Media upload failed. If this is a photo or a large image, please scale it down and try again.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Promise.reject( response );\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn parseAndThrowError( response, options.parse );\n\t\t} )\n\t\t.then( ( response: Response ) =>\n\t\t\tparseResponseAndNormalizeError( response, options.parse )\n\t\t);\n};\n\nexport default mediaUploadMiddleware;\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,UAAU;AAKnB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAOP,SAAS,qBAAsB,SAA2B;AACzD,QAAM,iBAAiB,CAAC,CAAE,QAAQ,UAAU,QAAQ,WAAW;AAC/D,QAAM,kBACH,CAAC,CAAE,QAAQ,QAAQ,QAAQ,KAAK,QAAS,cAAe,MAAM,MAC9D,CAAC,CAAE,QAAQ,OAAO,QAAQ,IAAI,QAAS,cAAe,MAAM;AAE/D,SAAO,mBAAmB;AAC3B;AAOA,MAAM,wBAA4C,CAAE,SAAS,SAAU;AACtE,MAAK,CAAE,qBAAsB,OAAQ,GAAI;AACxC,WAAO,KAAM,OAAQ;AAAA,EACtB;AAEA,MAAI,UAAU;AACd,QAAM,aAAa;AAMnB,QAAM,cAAc,CAAE,iBAA0C;AAC/D;AACA,WAAO,KAAM;AAAA,MACZ,MAAM,gBAAiB,YAAa;AAAA,MACpC,QAAQ;AAAA,MACR,MAAM,EAAE,QAAQ,wBAAwB;AAAA,MACxC,OAAO;AAAA,IACR,CAAE,EAAE,MAAO,MAAM;AAChB,UAAK,UAAU,YAAa;AAC3B,eAAO,YAAa,YAAa;AAAA,MAClC;AACA,WAAM;AAAA,QACL,MAAM,gBAAiB,YAAa;AAAA,QACpC,QAAQ;AAAA,MACT,CAAE;AAEF,aAAO,QAAQ,OAAO;AAAA,IACvB,CAAE;AAAA,EACH;AAEA,SAAO,KAAM,EAAE,GAAG,SAAS,OAAO,MAAM,CAAE,EACxC,MAAO,CAAE,aAAwB;AAEjC,QAAK,EAAI,oBAAoB,WAAW,WAAa;AACpD,aAAO,QAAQ,OAAQ,QAAS;AAAA,IACjC;AAEA,UAAM,eAAe,SAAS,QAAQ;AAAA,MACrC;AAAA,IACD;AACA,QACC,SAAS,UAAU,OACnB,SAAS,SAAS,OAClB,cACC;AACD,aAAO,YAAa,YAAa,EAAE,MAAO,MAAM;AAC/C,YAAK,QAAQ,UAAU,OAAQ;AAC9B,iBAAO,QAAQ,OAAQ;AAAA,YACtB,MAAM;AAAA,YACN,SAAS;AAAA,cACR;AAAA,YACD;AAAA,UACD,CAAE;AAAA,QACH;AAEA,eAAO,QAAQ,OAAQ,QAAS;AAAA,MACjC,CAAE;AAAA,IACH;AACA,WAAO,mBAAoB,UAAU,QAAQ,KAAM;AAAA,EACpD,CAAE,EACD;AAAA,IAAM,CAAE,aACR,+BAAgC,UAAU,QAAQ,KAAM;AAAA,EACzD;AACF;AAEA,IAAO,uBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
const namespaceAndEndpointMiddleware = (options, next) => {
|
|
6
2
|
let path = options.path;
|
|
7
3
|
let namespaceTrimmed, endpointTrimmed;
|
|
8
|
-
if (typeof options.namespace ===
|
|
9
|
-
namespaceTrimmed = options.namespace.replace(/^\/|\/$/g,
|
|
10
|
-
endpointTrimmed = options.endpoint.replace(/^\//,
|
|
4
|
+
if (typeof options.namespace === "string" && typeof options.endpoint === "string") {
|
|
5
|
+
namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, "");
|
|
6
|
+
endpointTrimmed = options.endpoint.replace(/^\//, "");
|
|
11
7
|
if (endpointTrimmed) {
|
|
12
|
-
path = namespaceTrimmed +
|
|
8
|
+
path = namespaceTrimmed + "/" + endpointTrimmed;
|
|
13
9
|
} else {
|
|
14
10
|
path = namespaceTrimmed;
|
|
15
11
|
}
|
|
@@ -21,5 +17,8 @@ const namespaceAndEndpointMiddleware = (options, next) => {
|
|
|
21
17
|
path
|
|
22
18
|
});
|
|
23
19
|
};
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
var namespace_endpoint_default = namespaceAndEndpointMiddleware;
|
|
21
|
+
export {
|
|
22
|
+
namespace_endpoint_default as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=namespace-endpoint.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/middlewares/namespace-endpoint.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { APIFetchMiddleware } from '../types';\n\nconst namespaceAndEndpointMiddleware: APIFetchMiddleware = (\n\toptions,\n\tnext\n) => {\n\tlet path = options.path;\n\tlet namespaceTrimmed, endpointTrimmed;\n\n\tif (\n\t\ttypeof options.namespace === 'string' &&\n\t\ttypeof options.endpoint === 'string'\n\t) {\n\t\tnamespaceTrimmed = options.namespace.replace( /^\\/|\\/$/g, '' );\n\t\tendpointTrimmed = options.endpoint.replace( /^\\//, '' );\n\t\tif ( endpointTrimmed ) {\n\t\t\tpath = namespaceTrimmed + '/' + endpointTrimmed;\n\t\t} else {\n\t\t\tpath = namespaceTrimmed;\n\t\t}\n\t}\n\n\tdelete options.namespace;\n\tdelete options.endpoint;\n\n\treturn next( {\n\t\t...options,\n\t\tpath,\n\t} );\n};\n\nexport default namespaceAndEndpointMiddleware;\n"],
|
|
5
|
+
"mappings": "AAKA,MAAM,iCAAqD,CAC1D,SACA,SACI;AACJ,MAAI,OAAO,QAAQ;AACnB,MAAI,kBAAkB;AAEtB,MACC,OAAO,QAAQ,cAAc,YAC7B,OAAO,QAAQ,aAAa,UAC3B;AACD,uBAAmB,QAAQ,UAAU,QAAS,YAAY,EAAG;AAC7D,sBAAkB,QAAQ,SAAS,QAAS,OAAO,EAAG;AACtD,QAAK,iBAAkB;AACtB,aAAO,mBAAmB,MAAM;AAAA,IACjC,OAAO;AACN,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO,QAAQ;AACf,SAAO,QAAQ;AAEf,SAAO,KAAM;AAAA,IACZ,GAAG;AAAA,IACH;AAAA,EACD,CAAE;AACH;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param nonce
|
|
7
|
-
*
|
|
8
|
-
* @return A middleware to enhance a request with a nonce.
|
|
9
|
-
*/
|
|
10
1
|
function createNonceMiddleware(nonce) {
|
|
11
2
|
const middleware = (options, next) => {
|
|
12
|
-
const {
|
|
13
|
-
headers = {}
|
|
14
|
-
} = options;
|
|
15
|
-
|
|
16
|
-
// If an 'X-WP-Nonce' header (or any case-insensitive variation
|
|
17
|
-
// thereof) was specified, no need to add a nonce header.
|
|
3
|
+
const { headers = {} } = options;
|
|
18
4
|
for (const headerName in headers) {
|
|
19
|
-
if (headerName.toLowerCase() ===
|
|
5
|
+
if (headerName.toLowerCase() === "x-wp-nonce" && headers[headerName] === middleware.nonce) {
|
|
20
6
|
return next(options);
|
|
21
7
|
}
|
|
22
8
|
}
|
|
@@ -24,12 +10,15 @@ function createNonceMiddleware(nonce) {
|
|
|
24
10
|
...options,
|
|
25
11
|
headers: {
|
|
26
12
|
...headers,
|
|
27
|
-
|
|
13
|
+
"X-WP-Nonce": middleware.nonce
|
|
28
14
|
}
|
|
29
15
|
});
|
|
30
16
|
};
|
|
31
17
|
middleware.nonce = nonce;
|
|
32
18
|
return middleware;
|
|
33
19
|
}
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
var nonce_default = createNonceMiddleware;
|
|
21
|
+
export {
|
|
22
|
+
nonce_default as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=nonce.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/middlewares/nonce.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { APIFetchMiddleware } from '../types';\n\n/**\n * @param nonce\n *\n * @return A middleware to enhance a request with a nonce.\n */\nfunction createNonceMiddleware(\n\tnonce: string\n): APIFetchMiddleware & { nonce: string } {\n\tconst middleware: APIFetchMiddleware & { nonce: string } = (\n\t\toptions,\n\t\tnext\n\t) => {\n\t\tconst { headers = {} } = options;\n\n\t\t// If an 'X-WP-Nonce' header (or any case-insensitive variation\n\t\t// thereof) was specified, no need to add a nonce header.\n\t\tfor ( const headerName in headers ) {\n\t\t\tif (\n\t\t\t\theaderName.toLowerCase() === 'x-wp-nonce' &&\n\t\t\t\theaders[ headerName ] === middleware.nonce\n\t\t\t) {\n\t\t\t\treturn next( options );\n\t\t\t}\n\t\t}\n\n\t\treturn next( {\n\t\t\t...options,\n\t\t\theaders: {\n\t\t\t\t...headers,\n\t\t\t\t'X-WP-Nonce': middleware.nonce,\n\t\t\t},\n\t\t} );\n\t};\n\n\tmiddleware.nonce = nonce;\n\n\treturn middleware;\n}\n\nexport default createNonceMiddleware;\n"],
|
|
5
|
+
"mappings": "AAUA,SAAS,sBACR,OACyC;AACzC,QAAM,aAAqD,CAC1D,SACA,SACI;AACJ,UAAM,EAAE,UAAU,CAAC,EAAE,IAAI;AAIzB,eAAY,cAAc,SAAU;AACnC,UACC,WAAW,YAAY,MAAM,gBAC7B,QAAS,UAAW,MAAM,WAAW,OACpC;AACD,eAAO,KAAM,OAAQ;AAAA,MACtB;AAAA,IACD;AAEA,WAAO,KAAM;AAAA,MACZ,GAAG;AAAA,MACH,SAAS;AAAA,QACR,GAAG;AAAA,QACH,cAAc,WAAW;AAAA,MAC1B;AAAA,IACD,CAAE;AAAA,EACH;AAEA,aAAW,QAAQ;AAEnB,SAAO;AACR;AAEA,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,84 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { addQueryArgs, getQueryArgs, normalizePath } from '@wordpress/url';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @param preloadedData
|
|
12
|
-
* @return Preloading middleware.
|
|
13
|
-
*/
|
|
1
|
+
import { addQueryArgs, getQueryArgs, normalizePath } from "@wordpress/url";
|
|
14
2
|
function createPreloadingMiddleware(preloadedData) {
|
|
15
|
-
const cache = Object.fromEntries(
|
|
3
|
+
const cache = Object.fromEntries(
|
|
4
|
+
Object.entries(preloadedData).map(([path, data]) => [
|
|
5
|
+
normalizePath(path),
|
|
6
|
+
data
|
|
7
|
+
])
|
|
8
|
+
);
|
|
16
9
|
return (options, next) => {
|
|
17
|
-
const {
|
|
18
|
-
parse = true
|
|
19
|
-
} = options;
|
|
10
|
+
const { parse = true } = options;
|
|
20
11
|
let rawPath = options.path;
|
|
21
12
|
if (!rawPath && options.url) {
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (typeof pathFromQuery === 'string') {
|
|
13
|
+
const { rest_route: pathFromQuery, ...queryArgs } = getQueryArgs(
|
|
14
|
+
options.url
|
|
15
|
+
);
|
|
16
|
+
if (typeof pathFromQuery === "string") {
|
|
27
17
|
rawPath = addQueryArgs(pathFromQuery, queryArgs);
|
|
28
18
|
}
|
|
29
19
|
}
|
|
30
|
-
if (typeof rawPath !==
|
|
20
|
+
if (typeof rawPath !== "string") {
|
|
31
21
|
return next(options);
|
|
32
22
|
}
|
|
33
|
-
const method = options.method ||
|
|
23
|
+
const method = options.method || "GET";
|
|
34
24
|
const path = normalizePath(rawPath);
|
|
35
|
-
if (
|
|
25
|
+
if ("GET" === method && cache[path]) {
|
|
36
26
|
const cacheData = cache[path];
|
|
37
|
-
|
|
38
|
-
// Unsetting the cache key ensures that the data is only used a single time.
|
|
39
27
|
delete cache[path];
|
|
40
28
|
return prepareResponse(cacheData, !!parse);
|
|
41
|
-
} else if (
|
|
29
|
+
} else if ("OPTIONS" === method && cache[method] && cache[method][path]) {
|
|
42
30
|
const cacheData = cache[method][path];
|
|
43
|
-
|
|
44
|
-
// Unsetting the cache key ensures that the data is only used a single time.
|
|
45
31
|
delete cache[method][path];
|
|
46
32
|
return prepareResponse(cacheData, !!parse);
|
|
47
33
|
}
|
|
48
34
|
return next(options);
|
|
49
35
|
};
|
|
50
36
|
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* This is a helper function that sends a success response.
|
|
54
|
-
*
|
|
55
|
-
* @param responseData
|
|
56
|
-
* @param parse
|
|
57
|
-
* @return Promise with the response.
|
|
58
|
-
*/
|
|
59
37
|
function prepareResponse(responseData, parse) {
|
|
60
38
|
if (parse) {
|
|
61
39
|
return Promise.resolve(responseData.body);
|
|
62
40
|
}
|
|
63
41
|
try {
|
|
64
|
-
return Promise.resolve(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
return Promise.resolve(
|
|
43
|
+
new window.Response(JSON.stringify(responseData.body), {
|
|
44
|
+
status: 200,
|
|
45
|
+
statusText: "OK",
|
|
46
|
+
headers: responseData.headers
|
|
47
|
+
})
|
|
48
|
+
);
|
|
69
49
|
} catch {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
50
|
+
Object.entries(
|
|
51
|
+
responseData.headers
|
|
52
|
+
).forEach(([key, value]) => {
|
|
53
|
+
if (key.toLowerCase() === "link") {
|
|
54
|
+
responseData.headers[key] = value.replace(
|
|
55
|
+
/<([^>]+)>/,
|
|
56
|
+
(_, url) => `<${encodeURI(url)}>`
|
|
57
|
+
);
|
|
74
58
|
}
|
|
75
59
|
});
|
|
76
|
-
return Promise.resolve(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
return Promise.resolve(
|
|
61
|
+
parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), {
|
|
62
|
+
status: 200,
|
|
63
|
+
statusText: "OK",
|
|
64
|
+
headers: responseData.headers
|
|
65
|
+
})
|
|
66
|
+
);
|
|
81
67
|
}
|
|
82
68
|
}
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
var preloading_default = createPreloadingMiddleware;
|
|
70
|
+
export {
|
|
71
|
+
preloading_default as default
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=preloading.js.map
|