@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 CHANGED
@@ -7,6 +7,7 @@ import {buildFetchers} from "@codecks/fetch";
7
7
 
8
8
  const {fetchFromRoot, fetchInstance} = buildFetchers({
9
9
  baseUrl: "https://api.codecks.io/",
10
+ subdomain: "my-org",
10
11
  });
11
12
 
12
13
  const rootResponse = await fetchFromRoot({
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
- body: JSON.stringify({ query: JSON.stringify(query) })
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)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codecks/fetch",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Quickly create deeply nested queries for the Codecks API with advanced TypeScript support",
5
5
  "type": "module",
6
6
  "license": "MIT",