@codecks/fetch 0.0.1 → 0.0.2
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/README.md +1 -0
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -3066,7 +3066,7 @@ const serializeRelations = (q, modelDesc) => {
|
|
|
3066
3066
|
return Object.fromEntries(Object.entries(q).map(([k, v]) => [k, serializeModel(v, modelDesc.relations[k])]));
|
|
3067
3067
|
};
|
|
3068
3068
|
const serializeRootQuery = (q) => {
|
|
3069
|
-
return { _root: serializeRelations(q, _rootDesc) };
|
|
3069
|
+
return { _root: [serializeRelations(q, _rootDesc)] };
|
|
3070
3070
|
};
|
|
3071
3071
|
const serializeInstanceQuery = (q, instances, modelMap$1) => {
|
|
3072
3072
|
return Object.fromEntries(instances.map((instance) => {
|
|
@@ -3167,7 +3167,8 @@ const buildFetchers = (opts = {}) => {
|
|
|
3167
3167
|
const fetchWithQuery = async (query) => {
|
|
3168
3168
|
const response = await configuredFetch("", {
|
|
3169
3169
|
method: "POST",
|
|
3170
|
-
|
|
3170
|
+
headers: { "Content-Type": "application/json" },
|
|
3171
|
+
body: JSON.stringify({ query })
|
|
3171
3172
|
}).then(async (r) => {
|
|
3172
3173
|
const content = await r.json();
|
|
3173
3174
|
if (r.status !== 200) throw new Error(`[${r.status}] ${JSON.stringify(content)}`);
|