Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: types & export fn name
Andras Bacsai12ae85b5c1c3
diff --git a/packages/http-client/package.json b/packages/http-client/package.jsonindex 154c15b97c..42d6e31228 100644--- a/packages/http-client/package.json+++ b/packages/http-client/package.json@@ -14,6 +14,7 @@},"devDependencies": {"@webstudio-is/jest-config": "*",+ "@webstudio-is/react-sdk": "*","@webstudio-is/prisma-client": "*","tsup": "^6.1.3","typescript": "^4.6.2"diff --git a/packages/http-client/src/index.d.ts b/packages/http-client/src/index.d.tsindex f5d8eb37b7..178b0828c3 100644--- a/packages/http-client/src/index.d.ts+++ b/packages/http-client/src/index.d.ts@@ -1,17 +1,16 @@+import type {+ BaseInstance,+ Breakpoint,+ UserProp,+} from "@webstudio-is/react-sdk";+export type IncludeTypes = "tree" | "props" | "breakpoints";export type Includes<T> = { [include in IncludeTypes]: T };+export type Project = {- tree: {- id: string;- root: {- comopnent: string;- id: string;- cssRules: Array<string>;- children: Array<string>;- };- } & { errors: string };- props: Array<string> & { errors: string };- breakpoints: Array<{ label: string; minWidtrh: number; id: string }> & {+ tree: BaseInstance & { errors: string };+ props: Array<UserProp> & { errors: string };+ breakpoints: Array<Breakpoint> & {errors: string;};};diff --git a/packages/http-client/src/index.test.ts b/packages/http-client/src/index.test.tsindex cdca00f77e..0381dd59ea 100644--- a/packages/http-client/src/index.test.ts+++ b/packages/http-client/src/index.test.ts@@ -1,4 +1,4 @@-import { loadProjectFromRest } from "./index";+import { loadProject } from "./index";const existingProject = "ab3619d3-831f-46f8-abb6-609558cffd99";const notPublishedProject = "7ec397c6-b3d0-4967-9073-9d83623fcf8e";@@ -6,17 +6,17 @@ const nonExistingProject = "1";describe("getProjectDetails", () => {test("loads existing project", async () => {- const response = await loadProjectFromRest({ projectId: existingProject });+ const response = await loadProject({ projectId: existingProject });expect(response.tree.id).toBeTruthy();});test("loads non-existing project", async () => {- const response = await loadProjectFromRest({+ const response = await loadProject({projectId: nonExistingProject,});expect(response.tree.errors).toBe("Project required");});test("loads not published project", async () => {- const response = await loadProjectFromRest({+ const response = await loadProject({projectId: notPublishedProject,});expect(response.tree.errors).toBe(diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.tsindex c01032d33b..27b85cdd65 100644--- a/packages/http-client/src/index.ts+++ b/packages/http-client/src/index.ts@@ -17,7 +17,7 @@ const fetch = async (url: string, options?: RequestInit) => {}};-const loadProjectFromRest = async ({+const loadProject = async ({projectId,host = process.env.DESIGNER_HOST || "localhost:3000",include = { tree: true, props: true, breakpoints: true },@@ -39,4 +39,4 @@ const loadProjectFromRest = async ({};};-export { loadProjectFromRest };+export { loadProject };diff --git a/yarn.lock b/yarn.lockindex 618e51585d..ed5b477038 100644--- a/yarn.lock+++ b/yarn.lock@@ -17021,6 +17021,11 @@ [email protected]:resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==+typescript@^4.6.2:+ version "4.8.3"+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz#d59344522c4bc464a65a730ac695007fdb66dd88"+ integrity sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==+uglify-js@^3.1.4:version "3.16.2"resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.2.tgz#0481e1dbeed343ad1c2ddf3c6d42e89b7a6d4def"