ra-data-simple-rest
Advanced tools
Comparing version 4.16.12 to 5.0.0-alpha.0
@@ -69,4 +69,5 @@ "use strict"; | ||
}), | ||
signal: params === null || params === void 0 ? void 0 : params.signal, | ||
} | ||
: {}; | ||
: { signal: params === null || params === void 0 ? void 0 : params.signal }; | ||
return httpClient(url, options).then(function (_a) { | ||
@@ -86,3 +87,5 @@ var headers = _a.headers, json = _a.json; | ||
getOne: function (resource, params) { | ||
return httpClient("".concat(apiUrl, "/").concat(resource, "/").concat(params.id)).then(function (_a) { | ||
return httpClient("".concat(apiUrl, "/").concat(resource, "/").concat(params.id), { | ||
signal: params === null || params === void 0 ? void 0 : params.signal, | ||
}).then(function (_a) { | ||
var json = _a.json; | ||
@@ -99,5 +102,7 @@ return ({ | ||
var url = "".concat(apiUrl, "/").concat(resource, "?").concat((0, query_string_1.stringify)(query)); | ||
return httpClient(url).then(function (_a) { | ||
return httpClient(url, { signal: params === null || params === void 0 ? void 0 : params.signal }).then(function (_a) { | ||
var json = _a.json; | ||
return ({ data: json }); | ||
return ({ | ||
data: json, | ||
}); | ||
}); | ||
@@ -123,4 +128,5 @@ }, | ||
}), | ||
signal: params === null || params === void 0 ? void 0 : params.signal, | ||
} | ||
: {}; | ||
: { signal: params === null || params === void 0 ? void 0 : params.signal }; | ||
return httpClient(url, options).then(function (_a) { | ||
@@ -127,0 +133,0 @@ var headers = _a.headers, json = _a.json; |
@@ -67,4 +67,5 @@ var __assign = (this && this.__assign) || function () { | ||
}), | ||
signal: params === null || params === void 0 ? void 0 : params.signal, | ||
} | ||
: {}; | ||
: { signal: params === null || params === void 0 ? void 0 : params.signal }; | ||
return httpClient(url, options).then(function (_a) { | ||
@@ -84,3 +85,5 @@ var headers = _a.headers, json = _a.json; | ||
getOne: function (resource, params) { | ||
return httpClient("".concat(apiUrl, "/").concat(resource, "/").concat(params.id)).then(function (_a) { | ||
return httpClient("".concat(apiUrl, "/").concat(resource, "/").concat(params.id), { | ||
signal: params === null || params === void 0 ? void 0 : params.signal, | ||
}).then(function (_a) { | ||
var json = _a.json; | ||
@@ -97,5 +100,7 @@ return ({ | ||
var url = "".concat(apiUrl, "/").concat(resource, "?").concat(stringify(query)); | ||
return httpClient(url).then(function (_a) { | ||
return httpClient(url, { signal: params === null || params === void 0 ? void 0 : params.signal }).then(function (_a) { | ||
var json = _a.json; | ||
return ({ data: json }); | ||
return ({ | ||
data: json, | ||
}); | ||
}); | ||
@@ -121,4 +126,5 @@ }, | ||
}), | ||
signal: params === null || params === void 0 ? void 0 : params.signal, | ||
} | ||
: {}; | ||
: { signal: params === null || params === void 0 ? void 0 : params.signal }; | ||
return httpClient(url, options).then(function (_a) { | ||
@@ -125,0 +131,0 @@ var headers = _a.headers, json = _a.json; |
@@ -1,2 +0,2 @@ | ||
var g=Object.defineProperty,J=Object.defineProperties,P=Object.getOwnPropertyDescriptor,N=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertyNames,E=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var R=(t,e,n)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T=(t,e)=>{for(var n in e||(e={}))O.call(e,n)&&R(t,n,e[n]);if(E)for(var n of E(e))x.call(e,n)&&R(t,n,e[n]);return t},u=(t,e)=>J(t,N(e)),I=t=>g(t,"__esModule",{value:!0}),m=(t,e)=>g(t,"name",{value:e,configurable:!0});var C=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},L=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of b(e))!O.call(t,s)&&(n||s!=="default")&&g(t,s,{get:()=>e[s],enumerable:!(r=P(e,s))||r.enumerable});return t};var v=(t=>(e,n)=>t&&t.get(e)||(n=L(I({}),e,1),t&&t.set(e,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var M={};C(M,{default:()=>D});var h=require("query-string"),w=require("ra-core"),D=m((t,e=w.fetchUtils.fetchJson,n="Content-Range")=>({getList:(r,s)=>{let{page:o,perPage:i}=s.pagination,{field:d,order:y}=s.sort,$=(o-1)*i,f=o*i-1,l={sort:JSON.stringify([d,y]),range:JSON.stringify([$,f]),filter:JSON.stringify(s.filter)},c=`${t}/${r}?${(0,h.stringify)(l)}`,p=n==="Content-Range"?{headers:new Headers({Range:`${r}=${$}-${f}`})}:{};return e(c,p).then(({headers:a,json:S})=>{if(!a.has(n))throw new Error(`The ${n} header is missing in the HTTP Response. The simple REST data provider expects responses for lists of resources to contain this header with the total number of results to build the pagination. If you are using CORS, did you declare ${n} in the Access-Control-Expose-Headers header?`);return{data:S,total:n==="Content-Range"?parseInt(a.get("content-range").split("/").pop(),10):parseInt(a.get(n.toLowerCase()))}})},getOne:(r,s)=>e(`${t}/${r}/${s.id}`).then(({json:o})=>({data:o})),getMany:(r,s)=>{let o={filter:JSON.stringify({id:s.ids})},i=`${t}/${r}?${(0,h.stringify)(o)}`;return e(i).then(({json:d})=>({data:d}))},getManyReference:(r,s)=>{let{page:o,perPage:i}=s.pagination,{field:d,order:y}=s.sort,$=(o-1)*i,f=o*i-1,l={sort:JSON.stringify([d,y]),range:JSON.stringify([(o-1)*i,o*i-1]),filter:JSON.stringify(u(T({},s.filter),{[s.target]:s.id}))},c=`${t}/${r}?${(0,h.stringify)(l)}`,p=n==="Content-Range"?{headers:new Headers({Range:`${r}=${$}-${f}`})}:{};return e(c,p).then(({headers:a,json:S})=>{if(!a.has(n))throw new Error(`The ${n} header is missing in the HTTP Response. The simple REST data provider expects responses for lists of resources to contain this header with the total number of results to build the pagination. If you are using CORS, did you declare ${n} in the Access-Control-Expose-Headers header?`);return{data:S,total:n==="Content-Range"?parseInt(a.get("content-range").split("/").pop(),10):parseInt(a.get(n.toLowerCase()))}})},update:(r,s)=>e(`${t}/${r}/${s.id}`,{method:"PUT",body:JSON.stringify(s.data)}).then(({json:o})=>({data:o})),updateMany:(r,s)=>Promise.all(s.ids.map(o=>e(`${t}/${r}/${o}`,{method:"PUT",body:JSON.stringify(s.data)}))).then(o=>({data:o.map(({json:i})=>i.id)})),create:(r,s)=>e(`${t}/${r}`,{method:"POST",body:JSON.stringify(s.data)}).then(({json:o})=>({data:u(T({},s.data),{id:o.id})})),delete:(r,s)=>e(`${t}/${r}/${s.id}`,{method:"DELETE",headers:new Headers({"Content-Type":"text/plain"})}).then(({json:o})=>({data:o})),deleteMany:(r,s)=>Promise.all(s.ids.map(o=>e(`${t}/${r}/${o}`,{method:"DELETE",headers:new Headers({"Content-Type":"text/plain"})}))).then(o=>({data:o.map(({json:i})=>i.id)}))}),"default");module.exports=v(M);0&&(module.exports={}); | ||
var g=Object.defineProperty,J=Object.defineProperties,P=Object.getOwnPropertyDescriptor,N=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertyNames,E=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var O=(n,e,s)=>e in n?g(n,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[e]=s,T=(n,e)=>{for(var s in e||(e={}))R.call(e,s)&&O(n,s,e[s]);if(E)for(var s of E(e))x.call(e,s)&&O(n,s,e[s]);return n},u=(n,e)=>J(n,N(e)),m=(n,e)=>g(n,"name",{value:e,configurable:!0});var I=(n,e)=>{for(var s in e)g(n,s,{get:e[s],enumerable:!0})},C=(n,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of b(e))!R.call(n,t)&&t!==s&&g(n,t,{get:()=>e[t],enumerable:!(r=P(e,t))||r.enumerable});return n};var L=n=>C(g({},"__esModule",{value:!0}),n);var D={};I(D,{default:()=>v});module.exports=L(D);var h=require("query-string"),w=require("ra-core"),v=m((n,e=w.fetchUtils.fetchJson,s="Content-Range")=>({getList:(r,t)=>{let{page:o,perPage:i}=t.pagination,{field:d,order:y}=t.sort,$=(o-1)*i,f=o*i-1,l={sort:JSON.stringify([d,y]),range:JSON.stringify([$,f]),filter:JSON.stringify(t.filter)},c=`${n}/${r}?${(0,h.stringify)(l)}`,p=s==="Content-Range"?{headers:new Headers({Range:`${r}=${$}-${f}`})}:{};return e(c,p).then(({headers:a,json:S})=>{if(!a.has(s))throw new Error(`The ${s} header is missing in the HTTP Response. The simple REST data provider expects responses for lists of resources to contain this header with the total number of results to build the pagination. If you are using CORS, did you declare ${s} in the Access-Control-Expose-Headers header?`);return{data:S,total:s==="Content-Range"?parseInt(a.get("content-range").split("/").pop(),10):parseInt(a.get(s.toLowerCase()))}})},getOne:(r,t)=>e(`${n}/${r}/${t.id}`).then(({json:o})=>({data:o})),getMany:(r,t)=>{let o={filter:JSON.stringify({id:t.ids})},i=`${n}/${r}?${(0,h.stringify)(o)}`;return e(i).then(({json:d})=>({data:d}))},getManyReference:(r,t)=>{let{page:o,perPage:i}=t.pagination,{field:d,order:y}=t.sort,$=(o-1)*i,f=o*i-1,l={sort:JSON.stringify([d,y]),range:JSON.stringify([(o-1)*i,o*i-1]),filter:JSON.stringify(u(T({},t.filter),{[t.target]:t.id}))},c=`${n}/${r}?${(0,h.stringify)(l)}`,p=s==="Content-Range"?{headers:new Headers({Range:`${r}=${$}-${f}`})}:{};return e(c,p).then(({headers:a,json:S})=>{if(!a.has(s))throw new Error(`The ${s} header is missing in the HTTP Response. The simple REST data provider expects responses for lists of resources to contain this header with the total number of results to build the pagination. If you are using CORS, did you declare ${s} in the Access-Control-Expose-Headers header?`);return{data:S,total:s==="Content-Range"?parseInt(a.get("content-range").split("/").pop(),10):parseInt(a.get(s.toLowerCase()))}})},update:(r,t)=>e(`${n}/${r}/${t.id}`,{method:"PUT",body:JSON.stringify(t.data)}).then(({json:o})=>({data:o})),updateMany:(r,t)=>Promise.all(t.ids.map(o=>e(`${n}/${r}/${o}`,{method:"PUT",body:JSON.stringify(t.data)}))).then(o=>({data:o.map(({json:i})=>i.id)})),create:(r,t)=>e(`${n}/${r}`,{method:"POST",body:JSON.stringify(t.data)}).then(({json:o})=>({data:u(T({},t.data),{id:o.id})})),delete:(r,t)=>e(`${n}/${r}/${t.id}`,{method:"DELETE",headers:new Headers({"Content-Type":"text/plain"})}).then(({json:o})=>({data:o})),deleteMany:(r,t)=>Promise.all(t.ids.map(o=>e(`${n}/${r}/${o}`,{method:"DELETE",headers:new Headers({"Content-Type":"text/plain"})}))).then(o=>({data:o.map(({json:i})=>i.id)}))}),"default");0&&(module.exports={}); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
{"inputs":{"../../node_modules/tsup/assets/cjs_shims.js":{"bytes":498,"imports":[]},"src/index.ts":{"bytes":7070,"imports":[]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":9626},"dist/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":2668}},"bytes":3628}}} | ||
{"inputs":{"src/index.ts":{"bytes":7070,"imports":[]}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":10105},"dist/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":2688}},"bytes":3518}}} |
@@ -1,1 +0,1 @@ | ||
{"inputs":{"../../node_modules/tsup/assets/esm_shims.js":{"bytes":312,"imports":[]},"src/index.ts":{"bytes":7070,"imports":[]}},"outputs":{"dist/esm/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":9610},"dist/esm/index.js":{"imports":[],"exports":["default"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":2616}},"bytes":3118}}} | ||
{"inputs":{"src/index.ts":{"bytes":7070,"imports":[]}},"outputs":{"dist/esm/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":10094},"dist/esm/index.js":{"imports":[],"exports":["default"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":2616}},"bytes":3114}}} |
{ | ||
"name": "ra-data-simple-rest", | ||
"version": "4.16.12", | ||
"version": "5.0.0-alpha.0", | ||
"description": "Simple REST data provider for react-admin", | ||
@@ -32,3 +32,3 @@ "main": "dist/cjs/index.js", | ||
"cross-env": "^5.2.0", | ||
"ra-core": "^4.16.12", | ||
"ra-core": "^5.0.0-alpha.0", | ||
"rimraf": "^3.0.2", | ||
@@ -40,3 +40,3 @@ "typescript": "^5.1.3" | ||
}, | ||
"gitHead": "8680ebbee0b5f9c971f64f4b0587eecda1bad8f2" | ||
"gitHead": "22d692b1c42831dd6d3ef2b8c200c1fb2b6391cf" | ||
} |
@@ -61,4 +61,5 @@ import { stringify } from 'query-string'; | ||
}), | ||
signal: params?.signal, | ||
} | ||
: {}; | ||
: { signal: params?.signal }; | ||
@@ -85,3 +86,5 @@ return httpClient(url, options).then(({ headers, json }) => { | ||
getOne: (resource, params) => | ||
httpClient(`${apiUrl}/${resource}/${params.id}`).then(({ json }) => ({ | ||
httpClient(`${apiUrl}/${resource}/${params.id}`, { | ||
signal: params?.signal, | ||
}).then(({ json }) => ({ | ||
data: json, | ||
@@ -95,3 +98,5 @@ })), | ||
const url = `${apiUrl}/${resource}?${stringify(query)}`; | ||
return httpClient(url).then(({ json }) => ({ data: json })); | ||
return httpClient(url, { signal: params?.signal }).then(({ json }) => ({ | ||
data: json, | ||
})); | ||
}, | ||
@@ -122,4 +127,5 @@ | ||
}), | ||
signal: params?.signal, | ||
} | ||
: {}; | ||
: { signal: params?.signal }; | ||
@@ -126,0 +132,0 @@ return httpClient(url, options).then(({ headers, json }) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
72417
793
2