@wordpress/api-fetch 5.2.7-next.33ec3857e2.0 → 6.0.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/CHANGELOG.md +6 -0
- package/LICENSE.md +1 -1
- package/build/middlewares/preloading.js +33 -19
- package/build/middlewares/preloading.js.map +1 -1
- package/build-module/middlewares/preloading.js +33 -19
- package/build-module/middlewares/preloading.js.map +1 -1
- package/build-types/middlewares/preloading.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/middlewares/preloading.js +39 -29
- package/src/middlewares/test/preloading.js +14 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 6.0.0 (2022-01-27)
|
|
6
|
+
|
|
7
|
+
### Breaking changes
|
|
8
|
+
|
|
9
|
+
`OPTIONS` requests handled by the preloading middleware are now resolved as `window.Response` objects if you explicitly set `parse: false` (for consistency with how GET requests are resolved). They used to be resolved as `Plain Old JavaScript Objects`.
|
|
10
|
+
|
|
5
11
|
## 5.2.5 (2021-11-07)
|
|
6
12
|
|
|
7
13
|
### Internal
|
package/LICENSE.md
CHANGED
|
@@ -38,30 +38,44 @@ function createPreloadingMiddleware(preloadedData) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (typeof rawPath
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return Promise.resolve(parse ? cacheData.body : cacheData);
|
|
59
|
-
}
|
|
41
|
+
if (typeof rawPath !== 'string') {
|
|
42
|
+
return next(options);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const method = options.method || 'GET';
|
|
46
|
+
const path = (0, _url.normalizePath)(rawPath);
|
|
47
|
+
|
|
48
|
+
if ('GET' === method && cache[path]) {
|
|
49
|
+
const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time
|
|
50
|
+
|
|
51
|
+
delete cache[path];
|
|
52
|
+
return prepareResponse(cacheData, !!parse);
|
|
53
|
+
} else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
|
|
54
|
+
const cacheData = cache[method][path]; // Unsetting the cache key ensures that the data is only used a single time
|
|
55
|
+
|
|
56
|
+
delete cache[method][path];
|
|
57
|
+
return prepareResponse(cacheData, !!parse);
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
return next(options);
|
|
63
61
|
};
|
|
64
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* This is a helper function that sends a success response.
|
|
65
|
+
*
|
|
66
|
+
* @param {Record<string, any>} responseData
|
|
67
|
+
* @param {boolean} parse
|
|
68
|
+
* @return {Promise<any>} Promise with the response.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
function prepareResponse(responseData, parse) {
|
|
73
|
+
return Promise.resolve(parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), {
|
|
74
|
+
status: 200,
|
|
75
|
+
statusText: 'OK',
|
|
76
|
+
headers: responseData.headers
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
65
79
|
|
|
66
80
|
var _default = createPreloadingMiddleware;
|
|
67
81
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/api-fetch/src/middlewares/preloading.js"],"names":["createPreloadingMiddleware","preloadedData","cache","Object","keys","reduce","result","path","options","next","parse","rawPath","url","pathFromQuery","method","cacheData","Promise","resolve","body","window","Response","JSON","stringify","status","statusText","headers"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,SAASA,0BAAT,CAAqCC,aAArC,EAAqD;AACpD,QAAMC,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAaH,aAAb,EAA6BI,MAA7B,CAAqC,CAAEC,MAAF,EAAUC,IAAV,KAAoB;AACtED,IAAAA,MAAM,CAAE,wBAAeC,IAAf,CAAF,CAAN,GAAkCN,aAAa,CAAEM,IAAF,CAA/C;AACA,WAAOD,MAAP;AACA,GAHa;AAGX;AAAqC,IAH1B,CAAd;AAKA,SAAO,CAAEE,OAAF,EAAWC,IAAX,KAAqB;AAC3B,UAAM;AAAEC,MAAAA,KAAK,GAAG;AAAV,QAAmBF,OAAzB;AACA;;AACA,QAAIG,OAAO,GAAGH,OAAO,CAACD,IAAtB;;AACA,QAAK,CAAEI,OAAF,IAAaH,OAAO,CAACI,GAA1B,EAAgC;AAC/B,YAAMC,aAAa,GAAG,sBAAaL,OAAO,CAACI,GAArB,EAA0B,YAA1B,CAAtB;;AACA,UAAK,OAAOC,aAAP,KAAyB,QAA9B,EAAyC;AACxCF,QAAAA,OAAO,GAAGE,aAAV;AACA;AACD;;AACD,QAAK,OAAOF,OAAP,KAAmB,QAAxB,EAAmC;AAClC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/api-fetch/src/middlewares/preloading.js"],"names":["createPreloadingMiddleware","preloadedData","cache","Object","keys","reduce","result","path","options","next","parse","rawPath","url","pathFromQuery","method","cacheData","prepareResponse","responseData","Promise","resolve","body","window","Response","JSON","stringify","status","statusText","headers"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,SAASA,0BAAT,CAAqCC,aAArC,EAAqD;AACpD,QAAMC,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAaH,aAAb,EAA6BI,MAA7B,CAAqC,CAAEC,MAAF,EAAUC,IAAV,KAAoB;AACtED,IAAAA,MAAM,CAAE,wBAAeC,IAAf,CAAF,CAAN,GAAkCN,aAAa,CAAEM,IAAF,CAA/C;AACA,WAAOD,MAAP;AACA,GAHa;AAGX;AAAqC,IAH1B,CAAd;AAKA,SAAO,CAAEE,OAAF,EAAWC,IAAX,KAAqB;AAC3B,UAAM;AAAEC,MAAAA,KAAK,GAAG;AAAV,QAAmBF,OAAzB;AACA;;AACA,QAAIG,OAAO,GAAGH,OAAO,CAACD,IAAtB;;AACA,QAAK,CAAEI,OAAF,IAAaH,OAAO,CAACI,GAA1B,EAAgC;AAC/B,YAAMC,aAAa,GAAG,sBAAaL,OAAO,CAACI,GAArB,EAA0B,YAA1B,CAAtB;;AACA,UAAK,OAAOC,aAAP,KAAyB,QAA9B,EAAyC;AACxCF,QAAAA,OAAO,GAAGE,aAAV;AACA;AACD;;AACD,QAAK,OAAOF,OAAP,KAAmB,QAAxB,EAAmC;AAClC,aAAOF,IAAI,CAAED,OAAF,CAAX;AACA;;AAED,UAAMM,MAAM,GAAGN,OAAO,CAACM,MAAR,IAAkB,KAAjC;AACA,UAAMP,IAAI,GAAG,wBAAeI,OAAf,CAAb;;AAEA,QAAK,UAAUG,MAAV,IAAoBZ,KAAK,CAAEK,IAAF,CAA9B,EAAyC;AACxC,YAAMQ,SAAS,GAAGb,KAAK,CAAEK,IAAF,CAAvB,CADwC,CAGxC;;AACA,aAAOL,KAAK,CAAEK,IAAF,CAAZ;AAEA,aAAOS,eAAe,CAAED,SAAF,EAAa,CAAC,CAAEL,KAAhB,CAAtB;AACA,KAPD,MAOO,IACN,cAAcI,MAAd,IACAZ,KAAK,CAAEY,MAAF,CADL,IAEAZ,KAAK,CAAEY,MAAF,CAAL,CAAiBP,IAAjB,CAHM,EAIL;AACD,YAAMQ,SAAS,GAAGb,KAAK,CAAEY,MAAF,CAAL,CAAiBP,IAAjB,CAAlB,CADC,CAGD;;AACA,aAAOL,KAAK,CAAEY,MAAF,CAAL,CAAiBP,IAAjB,CAAP;AAEA,aAAOS,eAAe,CAAED,SAAF,EAAa,CAAC,CAAEL,KAAhB,CAAtB;AACA;;AAED,WAAOD,IAAI,CAAED,OAAF,CAAX;AACA,GAtCD;AAuCA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASQ,eAAT,CAA0BC,YAA1B,EAAwCP,KAAxC,EAAgD;AAC/C,SAAOQ,OAAO,CAACC,OAAR,CACNT,KAAK,GACFO,YAAY,CAACG,IADX,GAEF,IAAIC,MAAM,CAACC,QAAX,CAAqBC,IAAI,CAACC,SAAL,CAAgBP,YAAY,CAACG,IAA7B,CAArB,EAA0D;AAC1DK,IAAAA,MAAM,EAAE,GADkD;AAE1DC,IAAAA,UAAU,EAAE,IAF8C;AAG1DC,IAAAA,OAAO,EAAEV,YAAY,CAACU;AAHoC,GAA1D,CAHG,CAAP;AASA;;eAEc3B,0B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getQueryArg, normalizePath } from '@wordpress/url';\n\n/**\n * @param {Record<string, any>} preloadedData\n * @return {import('../types').APIFetchMiddleware} Preloading middleware.\n */\nfunction createPreloadingMiddleware( preloadedData ) {\n\tconst cache = Object.keys( preloadedData ).reduce( ( result, path ) => {\n\t\tresult[ normalizePath( path ) ] = preloadedData[ path ];\n\t\treturn result;\n\t}, /** @type {Record<string, any>} */ ( {} ) );\n\n\treturn ( options, next ) => {\n\t\tconst { parse = true } = options;\n\t\t/** @type {string | void} */\n\t\tlet rawPath = options.path;\n\t\tif ( ! rawPath && options.url ) {\n\t\t\tconst pathFromQuery = getQueryArg( options.url, 'rest_route' );\n\t\t\tif ( typeof pathFromQuery === 'string' ) {\n\t\t\t\trawPath = pathFromQuery;\n\t\t\t}\n\t\t}\n\t\tif ( typeof rawPath !== 'string' ) {\n\t\t\treturn next( options );\n\t\t}\n\n\t\tconst method = options.method || 'GET';\n\t\tconst path = normalizePath( rawPath );\n\n\t\tif ( 'GET' === method && cache[ path ] ) {\n\t\t\tconst cacheData = cache[ path ];\n\n\t\t\t// Unsetting the cache key ensures that the data is only used a single time\n\t\t\tdelete cache[ path ];\n\n\t\t\treturn prepareResponse( cacheData, !! parse );\n\t\t} else if (\n\t\t\t'OPTIONS' === method &&\n\t\t\tcache[ method ] &&\n\t\t\tcache[ method ][ path ]\n\t\t) {\n\t\t\tconst cacheData = cache[ method ][ path ];\n\n\t\t\t// Unsetting the cache key ensures that the data is only used a single time\n\t\t\tdelete cache[ method ][ path ];\n\n\t\t\treturn prepareResponse( cacheData, !! parse );\n\t\t}\n\n\t\treturn next( options );\n\t};\n}\n\n/**\n * This is a helper function that sends a success response.\n *\n * @param {Record<string, any>} responseData\n * @param {boolean} parse\n * @return {Promise<any>} Promise with the response.\n */\nfunction prepareResponse( responseData, parse ) {\n\treturn Promise.resolve(\n\t\tparse\n\t\t\t? responseData.body\n\t\t\t: new window.Response( JSON.stringify( responseData.body ), {\n\t\t\t\t\tstatus: 200,\n\t\t\t\t\tstatusText: 'OK',\n\t\t\t\t\theaders: responseData.headers,\n\t\t\t } )\n\t);\n}\n\nexport default createPreloadingMiddleware;\n"]}
|
|
@@ -30,30 +30,44 @@ function createPreloadingMiddleware(preloadedData) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (typeof rawPath
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return Promise.resolve(parse ? cacheData.body : cacheData);
|
|
51
|
-
}
|
|
33
|
+
if (typeof rawPath !== 'string') {
|
|
34
|
+
return next(options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const method = options.method || 'GET';
|
|
38
|
+
const path = normalizePath(rawPath);
|
|
39
|
+
|
|
40
|
+
if ('GET' === method && cache[path]) {
|
|
41
|
+
const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time
|
|
42
|
+
|
|
43
|
+
delete cache[path];
|
|
44
|
+
return prepareResponse(cacheData, !!parse);
|
|
45
|
+
} else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
|
|
46
|
+
const cacheData = cache[method][path]; // Unsetting the cache key ensures that the data is only used a single time
|
|
47
|
+
|
|
48
|
+
delete cache[method][path];
|
|
49
|
+
return prepareResponse(cacheData, !!parse);
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
return next(options);
|
|
55
53
|
};
|
|
56
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* This is a helper function that sends a success response.
|
|
57
|
+
*
|
|
58
|
+
* @param {Record<string, any>} responseData
|
|
59
|
+
* @param {boolean} parse
|
|
60
|
+
* @return {Promise<any>} Promise with the response.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
function prepareResponse(responseData, parse) {
|
|
65
|
+
return Promise.resolve(parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), {
|
|
66
|
+
status: 200,
|
|
67
|
+
statusText: 'OK',
|
|
68
|
+
headers: responseData.headers
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
57
71
|
|
|
58
72
|
export default createPreloadingMiddleware;
|
|
59
73
|
//# sourceMappingURL=preloading.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/api-fetch/src/middlewares/preloading.js"],"names":["getQueryArg","normalizePath","createPreloadingMiddleware","preloadedData","cache","Object","keys","reduce","result","path","options","next","parse","rawPath","url","pathFromQuery","method","cacheData","Promise","resolve","body","window","Response","JSON","stringify","status","statusText","headers"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,aAAtB,QAA2C,gBAA3C;AAEA;AACA;AACA;AACA;;AACA,SAASC,0BAAT,CAAqCC,aAArC,EAAqD;AACpD,QAAMC,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAaH,aAAb,EAA6BI,MAA7B,CAAqC,CAAEC,MAAF,EAAUC,IAAV,KAAoB;AACtED,IAAAA,MAAM,CAAEP,aAAa,CAAEQ,IAAF,CAAf,CAAN,GAAkCN,aAAa,CAAEM,IAAF,CAA/C;AACA,WAAOD,MAAP;AACA,GAHa;AAGX;AAAqC,IAH1B,CAAd;AAKA,SAAO,CAAEE,OAAF,EAAWC,IAAX,KAAqB;AAC3B,UAAM;AAAEC,MAAAA,KAAK,GAAG;AAAV,QAAmBF,OAAzB;AACA;;AACA,QAAIG,OAAO,GAAGH,OAAO,CAACD,IAAtB;;AACA,QAAK,CAAEI,OAAF,IAAaH,OAAO,CAACI,GAA1B,EAAgC;AAC/B,YAAMC,aAAa,GAAGf,WAAW,CAAEU,OAAO,CAACI,GAAV,EAAe,YAAf,CAAjC;;AACA,UAAK,OAAOC,aAAP,KAAyB,QAA9B,EAAyC;AACxCF,QAAAA,OAAO,GAAGE,aAAV;AACA;AACD;;AACD,QAAK,OAAOF,OAAP,KAAmB,QAAxB,EAAmC;AAClC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/api-fetch/src/middlewares/preloading.js"],"names":["getQueryArg","normalizePath","createPreloadingMiddleware","preloadedData","cache","Object","keys","reduce","result","path","options","next","parse","rawPath","url","pathFromQuery","method","cacheData","prepareResponse","responseData","Promise","resolve","body","window","Response","JSON","stringify","status","statusText","headers"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,aAAtB,QAA2C,gBAA3C;AAEA;AACA;AACA;AACA;;AACA,SAASC,0BAAT,CAAqCC,aAArC,EAAqD;AACpD,QAAMC,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAaH,aAAb,EAA6BI,MAA7B,CAAqC,CAAEC,MAAF,EAAUC,IAAV,KAAoB;AACtED,IAAAA,MAAM,CAAEP,aAAa,CAAEQ,IAAF,CAAf,CAAN,GAAkCN,aAAa,CAAEM,IAAF,CAA/C;AACA,WAAOD,MAAP;AACA,GAHa;AAGX;AAAqC,IAH1B,CAAd;AAKA,SAAO,CAAEE,OAAF,EAAWC,IAAX,KAAqB;AAC3B,UAAM;AAAEC,MAAAA,KAAK,GAAG;AAAV,QAAmBF,OAAzB;AACA;;AACA,QAAIG,OAAO,GAAGH,OAAO,CAACD,IAAtB;;AACA,QAAK,CAAEI,OAAF,IAAaH,OAAO,CAACI,GAA1B,EAAgC;AAC/B,YAAMC,aAAa,GAAGf,WAAW,CAAEU,OAAO,CAACI,GAAV,EAAe,YAAf,CAAjC;;AACA,UAAK,OAAOC,aAAP,KAAyB,QAA9B,EAAyC;AACxCF,QAAAA,OAAO,GAAGE,aAAV;AACA;AACD;;AACD,QAAK,OAAOF,OAAP,KAAmB,QAAxB,EAAmC;AAClC,aAAOF,IAAI,CAAED,OAAF,CAAX;AACA;;AAED,UAAMM,MAAM,GAAGN,OAAO,CAACM,MAAR,IAAkB,KAAjC;AACA,UAAMP,IAAI,GAAGR,aAAa,CAAEY,OAAF,CAA1B;;AAEA,QAAK,UAAUG,MAAV,IAAoBZ,KAAK,CAAEK,IAAF,CAA9B,EAAyC;AACxC,YAAMQ,SAAS,GAAGb,KAAK,CAAEK,IAAF,CAAvB,CADwC,CAGxC;;AACA,aAAOL,KAAK,CAAEK,IAAF,CAAZ;AAEA,aAAOS,eAAe,CAAED,SAAF,EAAa,CAAC,CAAEL,KAAhB,CAAtB;AACA,KAPD,MAOO,IACN,cAAcI,MAAd,IACAZ,KAAK,CAAEY,MAAF,CADL,IAEAZ,KAAK,CAAEY,MAAF,CAAL,CAAiBP,IAAjB,CAHM,EAIL;AACD,YAAMQ,SAAS,GAAGb,KAAK,CAAEY,MAAF,CAAL,CAAiBP,IAAjB,CAAlB,CADC,CAGD;;AACA,aAAOL,KAAK,CAAEY,MAAF,CAAL,CAAiBP,IAAjB,CAAP;AAEA,aAAOS,eAAe,CAAED,SAAF,EAAa,CAAC,CAAEL,KAAhB,CAAtB;AACA;;AAED,WAAOD,IAAI,CAAED,OAAF,CAAX;AACA,GAtCD;AAuCA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASQ,eAAT,CAA0BC,YAA1B,EAAwCP,KAAxC,EAAgD;AAC/C,SAAOQ,OAAO,CAACC,OAAR,CACNT,KAAK,GACFO,YAAY,CAACG,IADX,GAEF,IAAIC,MAAM,CAACC,QAAX,CAAqBC,IAAI,CAACC,SAAL,CAAgBP,YAAY,CAACG,IAA7B,CAArB,EAA0D;AAC1DK,IAAAA,MAAM,EAAE,GADkD;AAE1DC,IAAAA,UAAU,EAAE,IAF8C;AAG1DC,IAAAA,OAAO,EAAEV,YAAY,CAACU;AAHoC,GAA1D,CAHG,CAAP;AASA;;AAED,eAAe3B,0BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getQueryArg, normalizePath } from '@wordpress/url';\n\n/**\n * @param {Record<string, any>} preloadedData\n * @return {import('../types').APIFetchMiddleware} Preloading middleware.\n */\nfunction createPreloadingMiddleware( preloadedData ) {\n\tconst cache = Object.keys( preloadedData ).reduce( ( result, path ) => {\n\t\tresult[ normalizePath( path ) ] = preloadedData[ path ];\n\t\treturn result;\n\t}, /** @type {Record<string, any>} */ ( {} ) );\n\n\treturn ( options, next ) => {\n\t\tconst { parse = true } = options;\n\t\t/** @type {string | void} */\n\t\tlet rawPath = options.path;\n\t\tif ( ! rawPath && options.url ) {\n\t\t\tconst pathFromQuery = getQueryArg( options.url, 'rest_route' );\n\t\t\tif ( typeof pathFromQuery === 'string' ) {\n\t\t\t\trawPath = pathFromQuery;\n\t\t\t}\n\t\t}\n\t\tif ( typeof rawPath !== 'string' ) {\n\t\t\treturn next( options );\n\t\t}\n\n\t\tconst method = options.method || 'GET';\n\t\tconst path = normalizePath( rawPath );\n\n\t\tif ( 'GET' === method && cache[ path ] ) {\n\t\t\tconst cacheData = cache[ path ];\n\n\t\t\t// Unsetting the cache key ensures that the data is only used a single time\n\t\t\tdelete cache[ path ];\n\n\t\t\treturn prepareResponse( cacheData, !! parse );\n\t\t} else if (\n\t\t\t'OPTIONS' === method &&\n\t\t\tcache[ method ] &&\n\t\t\tcache[ method ][ path ]\n\t\t) {\n\t\t\tconst cacheData = cache[ method ][ path ];\n\n\t\t\t// Unsetting the cache key ensures that the data is only used a single time\n\t\t\tdelete cache[ method ][ path ];\n\n\t\t\treturn prepareResponse( cacheData, !! parse );\n\t\t}\n\n\t\treturn next( options );\n\t};\n}\n\n/**\n * This is a helper function that sends a success response.\n *\n * @param {Record<string, any>} responseData\n * @param {boolean} parse\n * @return {Promise<any>} Promise with the response.\n */\nfunction prepareResponse( responseData, parse ) {\n\treturn Promise.resolve(\n\t\tparse\n\t\t\t? responseData.body\n\t\t\t: new window.Response( JSON.stringify( responseData.body ), {\n\t\t\t\t\tstatus: 200,\n\t\t\t\t\tstatusText: 'OK',\n\t\t\t\t\theaders: responseData.headers,\n\t\t\t } )\n\t);\n}\n\nexport default createPreloadingMiddleware;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preloading.d.ts","sourceRoot":"","sources":["../../src/middlewares/preloading.js"],"names":[],"mappings":";AAKA;;;GAGG;AACH,2DAHW,OAAO,MAAM,EAAE,GAAG,CAAC,GAClB,OAAO,UAAU,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"preloading.d.ts","sourceRoot":"","sources":["../../src/middlewares/preloading.js"],"names":[],"mappings":";AAKA;;;GAGG;AACH,2DAHW,OAAO,MAAM,EAAE,GAAG,CAAC,GAClB,OAAO,UAAU,EAAE,kBAAkB,CA+ChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/api-fetch",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Utility to make WordPress REST API requests.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"types": "build-types",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.16.0",
|
|
31
|
-
"@wordpress/i18n": "^4.
|
|
32
|
-
"@wordpress/url": "^3.
|
|
31
|
+
"@wordpress/i18n": "^4.3.0",
|
|
32
|
+
"@wordpress/url": "^3.4.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "d95ccb9366e249133cdb1d7b25c382446b9ee502"
|
|
38
38
|
}
|
|
@@ -23,44 +23,54 @@ function createPreloadingMiddleware( preloadedData ) {
|
|
|
23
23
|
rawPath = pathFromQuery;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
if ( typeof rawPath
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
if ( typeof rawPath !== 'string' ) {
|
|
27
|
+
return next( options );
|
|
28
|
+
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const method = options.method || 'GET';
|
|
31
|
+
const path = normalizePath( rawPath );
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if ( 'GET' === method && cache[ path ] ) {
|
|
34
|
+
const cacheData = cache[ path ];
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
? cacheData.body
|
|
39
|
-
: new window.Response(
|
|
40
|
-
JSON.stringify( cacheData.body ),
|
|
41
|
-
{
|
|
42
|
-
status: 200,
|
|
43
|
-
statusText: 'OK',
|
|
44
|
-
headers: cacheData.headers,
|
|
45
|
-
}
|
|
46
|
-
)
|
|
47
|
-
);
|
|
48
|
-
} else if (
|
|
49
|
-
'OPTIONS' === method &&
|
|
50
|
-
cache[ method ] &&
|
|
51
|
-
cache[ method ][ path ]
|
|
52
|
-
) {
|
|
53
|
-
const cacheData = cache[ method ][ path ];
|
|
36
|
+
// Unsetting the cache key ensures that the data is only used a single time
|
|
37
|
+
delete cache[ path ];
|
|
54
38
|
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
return prepareResponse( cacheData, !! parse );
|
|
40
|
+
} else if (
|
|
41
|
+
'OPTIONS' === method &&
|
|
42
|
+
cache[ method ] &&
|
|
43
|
+
cache[ method ][ path ]
|
|
44
|
+
) {
|
|
45
|
+
const cacheData = cache[ method ][ path ];
|
|
57
46
|
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
// Unsetting the cache key ensures that the data is only used a single time
|
|
48
|
+
delete cache[ method ][ path ];
|
|
49
|
+
|
|
50
|
+
return prepareResponse( cacheData, !! parse );
|
|
60
51
|
}
|
|
61
52
|
|
|
62
53
|
return next( options );
|
|
63
54
|
};
|
|
64
55
|
}
|
|
65
56
|
|
|
57
|
+
/**
|
|
58
|
+
* This is a helper function that sends a success response.
|
|
59
|
+
*
|
|
60
|
+
* @param {Record<string, any>} responseData
|
|
61
|
+
* @param {boolean} parse
|
|
62
|
+
* @return {Promise<any>} Promise with the response.
|
|
63
|
+
*/
|
|
64
|
+
function prepareResponse( responseData, parse ) {
|
|
65
|
+
return Promise.resolve(
|
|
66
|
+
parse
|
|
67
|
+
? responseData.body
|
|
68
|
+
: new window.Response( JSON.stringify( responseData.body ), {
|
|
69
|
+
status: 200,
|
|
70
|
+
statusText: 'OK',
|
|
71
|
+
headers: responseData.headers,
|
|
72
|
+
} )
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
export default createPreloadingMiddleware;
|
|
@@ -59,6 +59,17 @@ describe( 'Preloading Middleware', () => {
|
|
|
59
59
|
|
|
60
60
|
describe( 'and the OPTIONS request has a parse flag', () => {
|
|
61
61
|
it( 'should return the full response if parse: false', () => {
|
|
62
|
+
const noResponseMock =
|
|
63
|
+
'undefined' === typeof window.Response;
|
|
64
|
+
if ( noResponseMock ) {
|
|
65
|
+
window.Response = class {
|
|
66
|
+
constructor( body, options ) {
|
|
67
|
+
this.body = JSON.parse( body );
|
|
68
|
+
this.headers = options.headers;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
const data = {
|
|
63
74
|
body: {
|
|
64
75
|
status: 'this is the preloaded response',
|
|
@@ -85,6 +96,9 @@ describe( 'Preloading Middleware', () => {
|
|
|
85
96
|
};
|
|
86
97
|
|
|
87
98
|
const response = preloadingMiddleware( requestOptions );
|
|
99
|
+
if ( noResponseMock ) {
|
|
100
|
+
delete window.Response;
|
|
101
|
+
}
|
|
88
102
|
return response.then( ( value ) => {
|
|
89
103
|
expect( value ).toEqual( data );
|
|
90
104
|
} );
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../i18n/build-types/sprintf.d.ts","../hooks/build-types/createaddhook.d.ts","../hooks/build-types/createremovehook.d.ts","../hooks/build-types/createhashook.d.ts","../hooks/build-types/createdoinghook.d.ts","../hooks/build-types/createdidhook.d.ts","../hooks/build-types/index.d.ts","../hooks/build-types/createhooks.d.ts","../i18n/build-types/create-i18n.d.ts","../i18n/build-types/default-i18n.d.ts","../i18n/build-types/index.d.ts","./src/types.ts","./src/middlewares/nonce.js","./src/middlewares/namespace-endpoint.js","./src/middlewares/root-url.js","../url/build-types/is-url.d.ts","../url/build-types/is-email.d.ts","../url/build-types/get-protocol.d.ts","../url/build-types/is-valid-protocol.d.ts","../url/build-types/get-authority.d.ts","../url/build-types/is-valid-authority.d.ts","../url/build-types/get-path.d.ts","../url/build-types/is-valid-path.d.ts","../url/build-types/get-query-string.d.ts","../url/build-types/build-query-string.d.ts","../url/build-types/is-valid-query-string.d.ts","../url/build-types/get-path-and-query-string.d.ts","../url/build-types/get-fragment.d.ts","../url/build-types/is-valid-fragment.d.ts","../url/build-types/add-query-args.d.ts","../url/build-types/get-query-arg.d.ts","../url/build-types/get-query-args.d.ts","../url/build-types/has-query-arg.d.ts","../url/build-types/remove-query-args.d.ts","../url/build-types/prepend-http.d.ts","../url/build-types/safe-decode-uri.d.ts","../url/build-types/safe-decode-uri-component.d.ts","../url/build-types/filter-url-for-display.d.ts","../url/build-types/clean-for-slug.d.ts","../url/build-types/get-filename.d.ts","../url/build-types/normalize-path.d.ts","../url/build-types/index.d.ts","./src/middlewares/preloading.js","./src/middlewares/fetch-all-middleware.js","./src/middlewares/http-v1.js","./src/middlewares/user-locale.js","./src/utils/response.js","./src/middlewares/media-upload.js","./src/index.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"762bc52248d3fab9873c7af564caf622358312cb35de42a4393b71cc36e14621","d02ec79cefaf292fae64b3be5a4416e64b4e420a6429fd458fac6e1bb4c7950e","27abed653f600ea0d5c86e94181beb42824e0f3f16337e2f9e7e9e9c2c392edf","d7871e0e653aa7197fee88886db5678bee6d42164c1f36e4bce9421ddfa7ca49","11ed10bdb3bcc99893570507eac8fece4840add97ee1d4f5a7fbf41cbfdea0d4","429fb571d3db07d3eaa2e74d43eb4190ece3e0de832ed564aeeaf08873e598eb","406d52bf33d618d846aa0d831ee004290567e328edcd4517bbff2937cc977abf","d3060e0810fc0d0dc009e6f086ef413d3c8aeaaf07da25c8d25fd4e181646acf","9d8f457905054b69915abac57f33e356fdcebce3a10e5be7fcfccad5da5aa934","08f7e6ffa66c66a636aecc5acbeb998215d9d09ccba0c558afb7df7e218edeaf","f829eb39aea4487f0ff94a42c56a1a73bc5202bbdeb03f7a638e4ab3e290d017","d8c4f047684abe4a04c0f6bfc2dfca7b191c4bc7856f2bf63c0b8c04d3c3c59c","cea174bd7165f6473e9251e89b77677cc6fb980a0329964499ff39d7049941a9","3601498a0b299615d2b1871518f4e512837afa1ec33c10e5787c31297dba0e6b","b85af6a2052b84fadbe8e760359bec9d2cb765c404bab048d4bd20477c02bd89","91265e9c2705df9edc7d912afe177cb9dbe4bd4fe254cc43466885544c065013","81e7db9916d6ce0323656530cb9aba444450454e5a8f3d0108f04931abb36258","7858aa21ac91fef2c9cdf96b3ae00e025efed2920ffca40a75df452d4f5a9576","eb80dedcd92c17d93f403e736e1c3e2aef39379841070221a353a7c13b57369f","029f3a1e2534e85a7cd00f3e79781003e0bcf5147d96db93594ace839803c6cf","2eea9984a7ea08e576d2970ba65a65ebba02699bccdbd0d3a08bb141e15972a1","308246446616acc5397747f35fa8788de7e6ba6cd5dc0ec2752bd75eafefcdb9","9677ef56e52539a73f1d9b89c692cf866d05017b05d9d2fe8cd35a30b42c2d47","6048b5c50d6486b1084b036a7f7d6c76c032d90cc2186f79b344a12ceb488511","26885abe66e07fd38da599d5fc9b4fa8b2df803c56e9bba99a2505e0b982c042","507dc7647a71c90e8cce85259c624b355c22e0dee1833aa4ba20c15a4f5bd21a","c30aaf3d189be8c29b2d3a7761e94b5b532fec6ba0caa74d07a4c1056469acf0","454217fe7beba4cb5497d4bc7fd3116437ce85e5217eb66f3b367fbcbfd45861","65e1ffb7b2343a1814c5cb85164f7d26bce1477b2cf04e6736f37732bc4801d6","3f810d7cac3e3729241d52d667538dc4ca27687f5d40d91f4cb5bce955df5f94","a2bedf5636ce572e507823229c9b7d4e87d97830497822d76e95a971fee78c92","17ab13eba7cde42ca7c95110c7eda405ba6aba7471437d912078d67dfada98eb","f7e734ca25cb0e8c52247b9a7d98f81ffd6ac52485bf9d8938fdbd4d828f469c","5261283f0b521fc1f255a060dcd86986985bd516822b69bb5504392462962899","44e20ca481bcc2abec1f4fcf54139caa4389f1bc16e3ee9d19a10e522903e9ab","a31eda6fcbf86596f69f7c18e6d13af58191fdc9c9620bcc67595fd9e49043ab","c93085fa9e5e568c0a45f64caa05e713fd5438e93d32f5970753e44910bdd540","1e442333978b5864818023d54d4f2e2aa0cbdfb2b486a0d43c900a7a87d61d1d","f215ce6766668f37f5e4652d0facdf55816f24aa5fc6f68c5e33754dbe5219fb","e900ec60297a15c4de70ddaade026ea4fe635e27c286fedd82dd5e963daa1930","e4e975c7339a9579209f12246e95f95216aa3558b8e7719fea2fbadaf28c574b","178efee8d4335cb61ec45c10e6de6d7afe48028963c5633f5937f25eaffa2387","3a8529919402692ba4d41e026e99cad2ed9a0141a7c55ab5cb3ab1cf93b7b3cd","73df30672e4cf303ecaa5bd1c0a228aec9bd972305b227ac47e53600b88eeb09","86113173dcf3a28562ae7493a30168e671b54a413095025d40eb462ebc55a4b5","e2ca321ccf84538d48bc2b24db351997d607695d37b6d6d50440385c8bffa7bc","b24db76807128fad060ace7e8dda79b87a1cbc3879e67e15f8255e788a8ebfaa","8947b5182e734afd1d79ac20b1a0856f6ece9924fe1c6a5163d4a117384c7b35","0a4ab7948650cf31fcbc3f2d9e0428f258cdd0b4a8530693b25ca9b15e955b04"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[55,56,57,58,59,87,88,89,90,91,92],[56,86,93],[56],[55,56,91],[56,86],[56,58],[55],[51],[46,47,48,49,50,51],[46,47,48,49,50,52],[51,52],[53],[45,53,54],[75],[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85]],"referencedMap":[[93,1],[88,2],[89,3],[92,4],[58,3],[57,3],[87,5],[59,6],[90,5],[91,7],[46,8],[50,8],[49,8],[48,8],[52,9],[47,8],[51,10],[53,11],[54,12],[55,13],[76,14],[86,15]],"exportedModulesMap":[[93,1],[88,2],[89,3],[92,4],[58,3],[57,3],[87,5],[59,6],[90,5],[91,7],[46,8],[50,8],[49,8],[48,8],[52,9],[47,8],[51,10],[53,11],[54,12],[55,13],[76,14],[86,15]],"semanticDiagnosticsPerFile":[10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,93,88,89,92,58,57,87,59,90,56,91,46,50,49,48,52,47,51,53,54,55,45,74,69,83,82,64,84,72,71,66,62,75,76,68,77,86,61,60,65,73,67,63,70,85,79,78,81,80]},"version":"4.4.2"}
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../i18n/build-types/sprintf.d.ts","../hooks/build-types/createaddhook.d.ts","../hooks/build-types/createremovehook.d.ts","../hooks/build-types/createhashook.d.ts","../hooks/build-types/createdoinghook.d.ts","../hooks/build-types/createdidhook.d.ts","../hooks/build-types/index.d.ts","../hooks/build-types/createhooks.d.ts","../i18n/build-types/create-i18n.d.ts","../i18n/build-types/default-i18n.d.ts","../i18n/build-types/index.d.ts","./src/types.ts","./src/middlewares/nonce.js","./src/middlewares/namespace-endpoint.js","./src/middlewares/root-url.js","../url/build-types/is-url.d.ts","../url/build-types/is-email.d.ts","../url/build-types/get-protocol.d.ts","../url/build-types/is-valid-protocol.d.ts","../url/build-types/get-authority.d.ts","../url/build-types/is-valid-authority.d.ts","../url/build-types/get-path.d.ts","../url/build-types/is-valid-path.d.ts","../url/build-types/get-query-string.d.ts","../url/build-types/build-query-string.d.ts","../url/build-types/is-valid-query-string.d.ts","../url/build-types/get-path-and-query-string.d.ts","../url/build-types/get-fragment.d.ts","../url/build-types/is-valid-fragment.d.ts","../url/build-types/add-query-args.d.ts","../url/build-types/get-query-arg.d.ts","../url/build-types/get-query-args.d.ts","../url/build-types/has-query-arg.d.ts","../url/build-types/remove-query-args.d.ts","../url/build-types/prepend-http.d.ts","../url/build-types/safe-decode-uri.d.ts","../url/build-types/safe-decode-uri-component.d.ts","../url/build-types/filter-url-for-display.d.ts","../url/build-types/clean-for-slug.d.ts","../url/build-types/get-filename.d.ts","../url/build-types/normalize-path.d.ts","../url/build-types/index.d.ts","./src/middlewares/preloading.js","./src/middlewares/fetch-all-middleware.js","./src/middlewares/http-v1.js","./src/middlewares/user-locale.js","./src/utils/response.js","./src/middlewares/media-upload.js","./src/index.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},"762bc52248d3fab9873c7af564caf622358312cb35de42a4393b71cc36e14621","d02ec79cefaf292fae64b3be5a4416e64b4e420a6429fd458fac6e1bb4c7950e","27abed653f600ea0d5c86e94181beb42824e0f3f16337e2f9e7e9e9c2c392edf","d7871e0e653aa7197fee88886db5678bee6d42164c1f36e4bce9421ddfa7ca49","11ed10bdb3bcc99893570507eac8fece4840add97ee1d4f5a7fbf41cbfdea0d4","429fb571d3db07d3eaa2e74d43eb4190ece3e0de832ed564aeeaf08873e598eb","406d52bf33d618d846aa0d831ee004290567e328edcd4517bbff2937cc977abf","d3060e0810fc0d0dc009e6f086ef413d3c8aeaaf07da25c8d25fd4e181646acf","c0306658efb85764bb6d8d55097007c68a70539b24d0e18fb6edd6eb1778f632","08f7e6ffa66c66a636aecc5acbeb998215d9d09ccba0c558afb7df7e218edeaf","f829eb39aea4487f0ff94a42c56a1a73bc5202bbdeb03f7a638e4ab3e290d017","d8c4f047684abe4a04c0f6bfc2dfca7b191c4bc7856f2bf63c0b8c04d3c3c59c","cea174bd7165f6473e9251e89b77677cc6fb980a0329964499ff39d7049941a9","3601498a0b299615d2b1871518f4e512837afa1ec33c10e5787c31297dba0e6b","b85af6a2052b84fadbe8e760359bec9d2cb765c404bab048d4bd20477c02bd89","91265e9c2705df9edc7d912afe177cb9dbe4bd4fe254cc43466885544c065013","81e7db9916d6ce0323656530cb9aba444450454e5a8f3d0108f04931abb36258","7858aa21ac91fef2c9cdf96b3ae00e025efed2920ffca40a75df452d4f5a9576","eb80dedcd92c17d93f403e736e1c3e2aef39379841070221a353a7c13b57369f","029f3a1e2534e85a7cd00f3e79781003e0bcf5147d96db93594ace839803c6cf","2eea9984a7ea08e576d2970ba65a65ebba02699bccdbd0d3a08bb141e15972a1","308246446616acc5397747f35fa8788de7e6ba6cd5dc0ec2752bd75eafefcdb9","9677ef56e52539a73f1d9b89c692cf866d05017b05d9d2fe8cd35a30b42c2d47","6048b5c50d6486b1084b036a7f7d6c76c032d90cc2186f79b344a12ceb488511","26885abe66e07fd38da599d5fc9b4fa8b2df803c56e9bba99a2505e0b982c042","507dc7647a71c90e8cce85259c624b355c22e0dee1833aa4ba20c15a4f5bd21a","c30aaf3d189be8c29b2d3a7761e94b5b532fec6ba0caa74d07a4c1056469acf0","454217fe7beba4cb5497d4bc7fd3116437ce85e5217eb66f3b367fbcbfd45861","65e1ffb7b2343a1814c5cb85164f7d26bce1477b2cf04e6736f37732bc4801d6","3f810d7cac3e3729241d52d667538dc4ca27687f5d40d91f4cb5bce955df5f94","a2bedf5636ce572e507823229c9b7d4e87d97830497822d76e95a971fee78c92","17ab13eba7cde42ca7c95110c7eda405ba6aba7471437d912078d67dfada98eb","f7e734ca25cb0e8c52247b9a7d98f81ffd6ac52485bf9d8938fdbd4d828f469c","5261283f0b521fc1f255a060dcd86986985bd516822b69bb5504392462962899","44e20ca481bcc2abec1f4fcf54139caa4389f1bc16e3ee9d19a10e522903e9ab","a31eda6fcbf86596f69f7c18e6d13af58191fdc9c9620bcc67595fd9e49043ab","c93085fa9e5e568c0a45f64caa05e713fd5438e93d32f5970753e44910bdd540","1e442333978b5864818023d54d4f2e2aa0cbdfb2b486a0d43c900a7a87d61d1d","f215ce6766668f37f5e4652d0facdf55816f24aa5fc6f68c5e33754dbe5219fb","e900ec60297a15c4de70ddaade026ea4fe635e27c286fedd82dd5e963daa1930","e4e975c7339a9579209f12246e95f95216aa3558b8e7719fea2fbadaf28c574b","178efee8d4335cb61ec45c10e6de6d7afe48028963c5633f5937f25eaffa2387","a275e92ef3e4265a6fc84d417cd7121f5f80c021a6e1a26d1776ad1cacf9ac17","73df30672e4cf303ecaa5bd1c0a228aec9bd972305b227ac47e53600b88eeb09","86113173dcf3a28562ae7493a30168e671b54a413095025d40eb462ebc55a4b5","e2ca321ccf84538d48bc2b24db351997d607695d37b6d6d50440385c8bffa7bc","b24db76807128fad060ace7e8dda79b87a1cbc3879e67e15f8255e788a8ebfaa","8947b5182e734afd1d79ac20b1a0856f6ece9924fe1c6a5163d4a117384c7b35","0a4ab7948650cf31fcbc3f2d9e0428f258cdd0b4a8530693b25ca9b15e955b04"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[55,56,57,58,59,87,88,89,90,91,92],[56,86,93],[56],[55,56,91],[56,86],[56,58],[55],[51],[46,47,48,49,50,51],[46,47,48,49,50,52],[51,52],[53],[45,53,54],[75],[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85]],"referencedMap":[[93,1],[88,2],[89,3],[92,4],[58,3],[57,3],[87,5],[59,6],[90,5],[91,7],[46,8],[50,8],[49,8],[48,8],[52,9],[47,8],[51,10],[53,11],[54,12],[55,13],[76,14],[86,15]],"exportedModulesMap":[[93,1],[88,2],[89,3],[92,4],[58,3],[57,3],[87,5],[59,6],[90,5],[91,7],[46,8],[50,8],[49,8],[48,8],[52,9],[47,8],[51,10],[53,11],[54,12],[55,13],[76,14],[86,15]],"semanticDiagnosticsPerFile":[10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,93,88,89,92,58,57,87,59,90,56,91,46,50,49,48,52,47,51,53,54,55,45,74,69,83,82,64,84,72,71,66,62,75,76,68,77,86,61,60,65,73,67,63,70,85,79,78,81,80]},"version":"4.4.2"}
|