@webstudio-is/http-client 0.0.1 → 0.1.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/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import "./fetch-polyfill";
2
1
  import type { Includes, Project } from "./index.d";
3
2
  export declare const loadProject: ({ projectId, host, include, }: {
4
3
  projectId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAInD,eAAO,MAAM,WAAW;eAKX,MAAM;;;MAGf,QAAQ,OAAO,CAgBlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAInD,eAAO,MAAM,WAAW;eAKX,MAAM;;;MAGf,QAAQ,OAAO,CAgBlB,CAAC"}
package/lib/index.js CHANGED
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.loadProject = void 0;
4
- require("./fetch-polyfill");
7
+ const isomorphic_fetch_1 = __importDefault(require("isomorphic-fetch"));
5
8
  const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
6
9
  const loadProject = async ({ projectId, host = process.env.DESIGNER_HOST || "localhost:3000", include = { tree: true, props: true, breakpoints: true }, }) => {
7
10
  const baseUrl = new URL("/", `${protocol}://${host}`);
@@ -9,9 +12,9 @@ const loadProject = async ({ projectId, host = process.env.DESIGNER_HOST || "loc
9
12
  const propsUrl = new URL(`/rest/props/${projectId}`, baseUrl);
10
13
  const breakpointsUrl = new URL(`/rest/breakpoints/${projectId}`, baseUrl);
11
14
  const [tree, props, breakpoints] = await Promise.all([
12
- include.tree && (await fetch(treeUrl)).json(),
13
- include.props && (await fetch(propsUrl)).json(),
14
- include.breakpoints && (await fetch(breakpointsUrl)).json(),
15
+ include.tree && (await (0, isomorphic_fetch_1.default)(treeUrl)).json(),
16
+ include.props && (await (0, isomorphic_fetch_1.default)(propsUrl)).json(),
17
+ include.breakpoints && (await (0, isomorphic_fetch_1.default)(breakpointsUrl)).json(),
15
18
  ]);
16
19
  return {
17
20
  tree,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/http-client",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Webstudio HTTP Client",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -13,15 +13,16 @@
13
13
  "checks": "yarn typecheck && yarn lint"
14
14
  },
15
15
  "devDependencies": {
16
+ "@types/isomorphic-fetch": "^0.0.36",
16
17
  "@webstudio-is/jest-config": "*",
17
- "@webstudio-is/react-sdk": "*",
18
18
  "@webstudio-is/prisma-client": "*",
19
+ "@webstudio-is/react-sdk": "*",
19
20
  "tsup": "^6.1.3",
20
- "typescript": "^4.6.2"
21
+ "typescript": "4.7.4"
21
22
  },
22
23
  "peerDependencies": {},
23
24
  "dependencies": {
24
- "node-fetch": "^3.2.10"
25
+ "isomorphic-fetch": "^3.0.0"
25
26
  },
26
27
  "main": "lib/index.js",
27
28
  "types": "lib/index.d.ts",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=fetch-polyfill.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-polyfill.d.ts","sourceRoot":"","sources":["../src/fetch-polyfill.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const node_fetch_1 = __importDefault(require("node-fetch"));
7
- if (globalThis.fetch === undefined) {
8
- // @ts-expect-error node-fetch doesn't implement a complete spec
9
- globalThis.fetch = node_fetch_1.default;
10
- }