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
make prisma its own package
Sara Vieirae78fe35ea711
diff --git a/apps/designer/app/dashboard/components/header.tsx b/apps/designer/app/dashboard/components/header.tsxindex fda056ba67..07130768f1 100644--- a/apps/designer/app/dashboard/components/header.tsx+++ b/apps/designer/app/dashboard/components/header.tsx@@ -9,7 +9,7 @@ import {Text,Flex,} from "~/shared/design-system";-import { User } from "@prisma/client";+import { User } from "@webstudio-is/prisma-client";import { useNavigate } from "react-router-dom";export const DashboardHeader = ({ user }: { user: User }) => {diff --git a/apps/designer/app/dashboard/dashboard.tsx b/apps/designer/app/dashboard/dashboard.tsxindex 2f4ac3b95b..72881fc561 100644--- a/apps/designer/app/dashboard/dashboard.tsx+++ b/apps/designer/app/dashboard/dashboard.tsx@@ -3,7 +3,7 @@ import { useActionData } from "@remix-run/react";import { Flex } from "~/shared/design-system";import interStyles from "~/shared/font-faces/inter.css";import dashboardStyles from "./dashboard.css";-import { User } from "@prisma/client";+import { User } from "@webstudio-is/prisma-client";import { DashboardHeader } from "./components/header";import { SelectProjectCard } from "./components/card";diff --git a/apps/designer/app/designer/designer.tsx b/apps/designer/app/designer/designer.tsxindex 253dcfac76..43b14a34b8 100644--- a/apps/designer/app/designer/designer.tsx+++ b/apps/designer/app/designer/designer.tsx@@ -1,12 +1,8 @@import { useCallback, useState } from "react";import { DndProvider } from "react-dnd";import { TouchBackend } from "react-dnd-touch-backend";-import {- type Project,- type Asset,- useSubscribe,- usePublish,-} from "@webstudio-is/react-sdk";+import { useSubscribe, usePublish } from "@webstudio-is/react-sdk";+import { type Project, type Asset } from "@webstudio-is/prisma-client";import type { Config } from "~/config";import type {HoveredInstanceData,diff --git a/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsx b/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsxindex 6557d41d93..9f6aa33fd3 100644--- a/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsx+++ b/apps/designer/app/designer/features/sidebar-left/panels/asset-manager.tsx@@ -2,7 +2,7 @@ import { ImageIcon } from "~/shared/icons";import { Button, Flex, Grid, Heading } from "~/shared/design-system";import { useRef } from "react";import { Form, useSubmit } from "@remix-run/react";-import { type Asset } from "@webstudio-is/react-sdk";+import { type Asset } from "@webstudio-is/prisma-client";import { Image } from "~/shared/design-system/components/image";export const TabContent = ({ assets }: { assets: Array<Asset> }) => {diff --git a/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx b/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsxindex 0fb79debfa..65b9cd96b8 100644--- a/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx+++ b/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx@@ -1,9 +1,6 @@import { useState, useCallback } from "react";-import {- useSubscribe,- type Publish,- type Asset,-} from "@webstudio-is/react-sdk";+import { useSubscribe, type Publish } from "@webstudio-is/react-sdk";+import type { Asset } from "@webstudio-is/prisma-client";import {Box,SidebarTabs,diff --git a/apps/designer/app/designer/features/topbar/publish.tsx b/apps/designer/app/designer/features/topbar/publish.tsxindex 4eacdbbd74..4c429e1558 100644--- a/apps/designer/app/designer/features/topbar/publish.tsx+++ b/apps/designer/app/designer/features/topbar/publish.tsx@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";import { useFetcher } from "@remix-run/react";import { useId } from "@radix-ui/react-id";import { RocketIcon, ExternalLinkIcon } from "~/shared/icons";-import { type Project } from "@webstudio-is/react-sdk";+import { type Project } from "@webstudio-is/prisma-client";import {Button,Flex,diff --git a/apps/designer/app/designer/features/topbar/share.tsx b/apps/designer/app/designer/features/topbar/share.tsxindex f701ec51b1..ffd631d508 100644--- a/apps/designer/app/designer/features/topbar/share.tsx+++ b/apps/designer/app/designer/features/topbar/share.tsx@@ -8,7 +8,7 @@ import {TextField,} from "~/shared/design-system";import { Share1Icon } from "~/shared/icons";-import { type Project } from "@webstudio-is/react-sdk";+import { type Project } from "@webstudio-is/prisma-client";import { useIsShareDialogOpen } from "../../shared/nano-states";type ShareButtonProps = { path: string; project: Project };diff --git a/apps/designer/app/designer/features/topbar/topbar.tsx b/apps/designer/app/designer/features/topbar/topbar.tsxindex 463682d88a..9ec3d4b8ca 100644--- a/apps/designer/app/designer/features/topbar/topbar.tsx+++ b/apps/designer/app/designer/features/topbar/topbar.tsx@@ -1,4 +1,5 @@-import type { Project, Publish } from "@webstudio-is/react-sdk";+import type { Publish } from "@webstudio-is/react-sdk";+import type { Project } from "@webstudio-is/prisma-client";import { darkTheme, Flex, type CSS } from "~/shared/design-system";import type { Config } from "~/config";import { PreviewButton } from "./preview";diff --git a/apps/designer/app/entry.server.tsx b/apps/designer/app/entry.server.tsxindex 05a2120187..0d2bdf0cc2 100644--- a/apps/designer/app/entry.server.tsx+++ b/apps/designer/app/entry.server.tsx@@ -4,7 +4,7 @@ import { insertCriticalCss } from "./critical-css";import type { EntryContext } from "@remix-run/node";import * as Sentry from "@sentry/remix";import { initSentry } from "./shared/sentry";-import { prisma } from "./shared/db/prisma.server";+import { prisma } from "@webstudio-is/prisma-client";initSentry({integrations: [new Sentry.Integrations.Prisma({ client: prisma })],diff --git a/apps/designer/app/routes/designer/$id.tsx b/apps/designer/app/routes/designer/$id.tsxindex 028f5ba9f0..4e1cb8748f 100644--- a/apps/designer/app/routes/designer/$id.tsx+++ b/apps/designer/app/routes/designer/$id.tsx@@ -1,6 +1,6 @@import { useActionData, useLoaderData } from "@remix-run/react";import { ActionFunction, LoaderFunction } from "@remix-run/node";-import type { Project, Asset } from "@webstudio-is/react-sdk";+import type { Project, Asset } from "@webstudio-is/prisma-client";import { Designer, links } from "~/designer";import * as db from "~/shared/db";import config from "~/config";diff --git a/apps/designer/app/routes/rest/patch.ts b/apps/designer/app/routes/rest/patch.tsindex d8195be96a..02ed991ef0 100644--- a/apps/designer/app/routes/rest/patch.ts+++ b/apps/designer/app/routes/rest/patch.ts@@ -1,7 +1,8 @@import { type ActionFunction } from "@remix-run/node";import * as db from "~/shared/db";import { type SyncItem } from "immerhin";-import { type Project, type Tree } from "@webstudio-is/react-sdk";+import { type Tree } from "@webstudio-is/react-sdk";+import { type Project } from "@webstudio-is/prisma-client";const updaters = {root: db.tree.patchRoot,diff --git a/apps/designer/app/routes/rest/project/clone.$domain.ts b/apps/designer/app/routes/rest/project/clone.$domain.tsindex ba7156d9f2..788e1bbaf9 100644--- a/apps/designer/app/routes/rest/project/clone.$domain.ts+++ b/apps/designer/app/routes/rest/project/clone.$domain.ts@@ -1,5 +1,5 @@import { type LoaderFunction, redirect } from "@remix-run/node";-import type { User } from "@webstudio-is/react-sdk";+import type { User } from "@webstudio-is/prisma-client";import * as db from "~/shared/db";import { ensureUserCookie } from "~/shared/session";import config from "~/config";diff --git a/apps/designer/app/services/auth.server.ts b/apps/designer/app/services/auth.server.tsindex 6a71e1ef46..05c08e740d 100644--- a/apps/designer/app/services/auth.server.ts+++ b/apps/designer/app/services/auth.server.ts@@ -1,4 +1,4 @@-import { User } from "@prisma/client";+import { User } from "@webstudio-is/prisma-client";import { Authenticator } from "remix-auth";import { FormStrategy } from "remix-auth-form";import { GitHubStrategy } from "remix-auth-github";diff --git a/apps/designer/app/shared/db/assets.server.ts b/apps/designer/app/shared/db/assets.server.tsindex 6f84ea18c3..0b7a8c4fd8 100644--- a/apps/designer/app/shared/db/assets.server.ts+++ b/apps/designer/app/shared/db/assets.server.ts@@ -1,5 +1,4 @@-import { type Project } from "@webstudio-is/react-sdk";-import { prisma } from "./prisma.server";+import { prisma, Project } from "@webstudio-is/prisma-client";import sharp from "sharp";export const loadByProject = async (projectId?: Project["id"]) => {diff --git a/apps/designer/app/shared/db/breakpoints.server.ts b/apps/designer/app/shared/db/breakpoints.server.tsindex 02bf1990ac..b8b7d2781a 100644--- a/apps/designer/app/shared/db/breakpoints.server.ts+++ b/apps/designer/app/shared/db/breakpoints.server.ts@@ -1,13 +1,12 @@import {initialBreakpoints,- type Project,type Tree,type Breakpoint,BreakpointsSchema,} from "@webstudio-is/react-sdk";import ObjectId from "bson-objectid";import { applyPatches, type Patch } from "immer";-import { prisma } from "./prisma.server";+import { prisma, Project } from "@webstudio-is/prisma-client";export const load = async (treeId?: Tree["id"]) => {if (typeof treeId !== "string") {diff --git a/apps/designer/app/shared/db/project.server.ts b/apps/designer/app/shared/db/project.server.tsindex b858586b47..aeaedecc68 100644--- a/apps/designer/app/shared/db/project.server.ts+++ b/apps/designer/app/shared/db/project.server.ts@@ -1,8 +1,12 @@import slugify from "slugify";import { nanoid } from "nanoid";-import type { Project as BaseProject, User } from "@webstudio-is/react-sdk";import { z } from "zod";-import { prisma, Prisma } from "./prisma.server";+import {+ User,+ prisma,+ Prisma,+ Project as BaseProject,+} from "@webstudio-is/prisma-client";import * as db from ".";const TreeHistorySchema = z.array(z.string());diff --git a/apps/designer/app/shared/db/props.server.ts b/apps/designer/app/shared/db/props.server.tsindex deb3c0e0bf..0ee3c47271 100644--- a/apps/designer/app/shared/db/props.server.ts+++ b/apps/designer/app/shared/db/props.server.ts@@ -4,7 +4,7 @@ import {UserPropsSchema,} from "@webstudio-is/react-sdk";import { applyPatches, type Patch } from "immer";-import { prisma } from "./prisma.server";+import { prisma } from "@webstudio-is/prisma-client";import { Project } from "./project.server";export const loadByProject = async (diff --git a/apps/designer/app/shared/db/tree.server.ts b/apps/designer/app/shared/db/tree.server.tsindex 2143eb34cb..3755c3c6a2 100644--- a/apps/designer/app/shared/db/tree.server.ts+++ b/apps/designer/app/shared/db/tree.server.ts@@ -5,7 +5,7 @@ import {InstanceSchema,} from "@webstudio-is/react-sdk";import { applyPatches, type Patch } from "immer";-import { prisma } from "./prisma.server";+import { prisma } from "@webstudio-is/prisma-client";import { createInstance } from "~/shared/tree-utils";import { sort } from "~/shared/breakpoints";import { Tree as DbTree } from "@prisma/client";diff --git a/apps/designer/app/shared/db/user.server.ts b/apps/designer/app/shared/db/user.server.tsindex 24735e8be5..e12dbb1e5e 100644--- a/apps/designer/app/shared/db/user.server.ts+++ b/apps/designer/app/shared/db/user.server.ts@@ -1,7 +1,6 @@-import { User } from "@prisma/client";import { GitHubProfile } from "remix-auth-github";import { GoogleProfile } from "remix-auth-google";-import { prisma } from "./prisma.server";+import { prisma, User } from "@webstudio-is/prisma-client";export const createDemoUser = async (userId: string) => {await prisma.team.create({diff --git a/apps/designer/package.json b/apps/designer/package.jsonindex d2d0240c6f..e563672f8c 100644--- a/apps/designer/package.json+++ b/apps/designer/package.json@@ -9,10 +9,7 @@"typecheck": "tsc -b","lint": "eslint . --ext .ts,.tsx --max-warnings 0","test": "jest",- "setup": "cp ../../node_modules/@webstudio-is/react-sdk/prisma/schema.prisma prisma/ && yarn migrate && yarn generate","checks": "yarn lint && yarn typecheck && yarn prettier --check && yarn test",- "migrate": "prisma migrate dev",- "generate": "prisma generate","watch:sdk": "relative-deps && relative-deps watch","prettier": "prettier \"*.{js,md,json,ts}\" \"{docs,app}/**/*.{js,md,json,ts}\"","storybook:run": "start-storybook -p 6006",@@ -20,7 +17,6 @@},"dependencies": {"@lexical/react": "^0.3.5",- "@prisma/client": "^3.14.0","@radix-ui/colors": "^0.1.8","@radix-ui/react-accessible-icon": "^0.1.4","@radix-ui/react-accordion": "^0.1.6",@@ -57,6 +53,7 @@"@vercel/node": "^2.4.1","@webstudio-is/asset-uploader": "*","@webstudio-is/react-sdk": "*",+ "@webstudio-is/prisma-client": "*","bson-objectid": "^2.0.2","camelcase": "^6.3.0","debug": "^4.3.4",@@ -129,7 +126,6 @@"eslint-config-custom": "*","jest": "^27.5.1","prettier": "^2.6.2",- "prisma": "^3.14.0","react-test-renderer": "^17.0.2","relative-deps": "^1.0.7","tsconfig": "*",diff --git a/packages/prisma-client/.gitignore b/packages/prisma-client/.gitignorenew file mode 100644index 0000000000..4c81583b6c--- /dev/null+++ b/packages/prisma-client/.gitignore@@ -0,0 +1,2 @@+lib+generated\ No newline at end of filediff --git a/packages/prisma-client/LICENSE b/packages/prisma-client/LICENSEnew file mode 100644index 0000000000..1f6edad9a7--- /dev/null+++ b/packages/prisma-client/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2022 Webstudio++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/packages/prisma-client/README.md b/packages/prisma-client/README.mdnew file mode 100644index 0000000000..4714eb2683--- /dev/null+++ b/packages/prisma-client/README.md@@ -0,0 +1,3 @@+# Webstudio Asset Uploader++The asset uploader is the packages that handles all the logic for our assets uploaddiff --git a/packages/prisma-client/jest.config.js b/packages/prisma-client/jest.config.jsnew file mode 100644index 0000000000..03c0db11ea--- /dev/null+++ b/packages/prisma-client/jest.config.js@@ -0,0 +1,6 @@+// eslint-disable-next-line+const base = require("jest-config/jest.config.js");++module.exports = {+ ...base,+};diff --git a/packages/prisma-client/package.json b/packages/prisma-client/package.jsonnew file mode 100644index 0000000000..30ba43c568--- /dev/null+++ b/packages/prisma-client/package.json@@ -0,0 +1,27 @@+{+ "name": "@webstudio-is/prisma-client",+ "version": "0.0.1",+ "description": "Webstudio Prisma layer",+ "author": "Webstudio <[email protected]>",+ "homepage": "https://webstudio.is",+ "scripts": {+ "checks": "tsc --noEmit",+ "build:prisma": "prisma format && prisma generate",+ "migrate": "dotenv -e ../../apps/designer/.env -- prisma migrate"+ },+ "devDependencies": {+ "dotenv-cli": "^6.0.0",+ "prisma": "^4.1.0"+ },+ "main": "src/index.ts",+ "types": "src/index.ts",+ "files": [+ "README.md",+ "!*.test.*"+ ],+ "license": "MIT",+ "private": false,+ "dependencies": {+ "@prisma/client": "^4.1.0"+ }+}diff --git a/apps/designer/prisma/migrations/20220601192603_start/migration.sql b/packages/prisma-client/prisma/migrations/20220601192603_start/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220601192603_start/migration.sqlrename to packages/prisma-client/prisma/migrations/20220601192603_start/migration.sqldiff --git a/apps/designer/prisma/migrations/20220608130924_/migration.sql b/packages/prisma-client/prisma/migrations/20220608130924_/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220608130924_/migration.sqlrename to packages/prisma-client/prisma/migrations/20220608130924_/migration.sqldiff --git a/apps/designer/prisma/migrations/20220608130959_adduser/migration.sql b/packages/prisma-client/prisma/migrations/20220608130959_adduser/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220608130959_adduser/migration.sqlrename to packages/prisma-client/prisma/migrations/20220608130959_adduser/migration.sqldiff --git a/apps/designer/prisma/migrations/20220608131719_add_user/migration.sql b/packages/prisma-client/prisma/migrations/20220608131719_add_user/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220608131719_add_user/migration.sqlrename to packages/prisma-client/prisma/migrations/20220608131719_add_user/migration.sqldiff --git a/apps/designer/prisma/migrations/20220611090740_/migration.sql b/packages/prisma-client/prisma/migrations/20220611090740_/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220611090740_/migration.sqlrename to packages/prisma-client/prisma/migrations/20220611090740_/migration.sqldiff --git a/apps/designer/prisma/migrations/20220611091346_add_email/migration.sql b/packages/prisma-client/prisma/migrations/20220611091346_add_email/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220611091346_add_email/migration.sqlrename to packages/prisma-client/prisma/migrations/20220611091346_add_email/migration.sqldiff --git a/apps/designer/prisma/migrations/20220616143541_add_projects/migration.sql b/packages/prisma-client/prisma/migrations/20220616143541_add_projects/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220616143541_add_projects/migration.sqlrename to packages/prisma-client/prisma/migrations/20220616143541_add_projects/migration.sqldiff --git a/apps/designer/prisma/migrations/20220616143902_userid_not_mandatory/migration.sql b/packages/prisma-client/prisma/migrations/20220616143902_userid_not_mandatory/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220616143902_userid_not_mandatory/migration.sqlrename to packages/prisma-client/prisma/migrations/20220616143902_userid_not_mandatory/migration.sqldiff --git a/apps/designer/prisma/migrations/20220619163536_userid_mandatory/migration.sql b/packages/prisma-client/prisma/migrations/20220619163536_userid_mandatory/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220619163536_userid_mandatory/migration.sqlrename to packages/prisma-client/prisma/migrations/20220619163536_userid_mandatory/migration.sqldiff --git a/apps/designer/prisma/migrations/20220624214305_teams/migration.sql b/packages/prisma-client/prisma/migrations/20220624214305_teams/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220624214305_teams/migration.sqlrename to packages/prisma-client/prisma/migrations/20220624214305_teams/migration.sqldiff --git a/apps/designer/prisma/migrations/20220624215036_remove_userid/migration.sql b/packages/prisma-client/prisma/migrations/20220624215036_remove_userid/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220624215036_remove_userid/migration.sqlrename to packages/prisma-client/prisma/migrations/20220624215036_remove_userid/migration.sqldiff --git a/apps/designer/prisma/migrations/20220624235138_users_have_projects/migration.sql b/packages/prisma-client/prisma/migrations/20220624235138_users_have_projects/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220624235138_users_have_projects/migration.sqlrename to packages/prisma-client/prisma/migrations/20220624235138_users_have_projects/migration.sqldiff --git a/apps/designer/prisma/migrations/20220714112221_add_assets/migration.sql b/packages/prisma-client/prisma/migrations/20220714112221_add_assets/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220714112221_add_assets/migration.sqlrename to packages/prisma-client/prisma/migrations/20220714112221_add_assets/migration.sqldiff --git a/apps/designer/prisma/migrations/20220714114102_remove_size/migration.sql b/packages/prisma-client/prisma/migrations/20220714114102_remove_size/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220714114102_remove_size/migration.sqlrename to packages/prisma-client/prisma/migrations/20220714114102_remove_size/migration.sqldiff --git a/apps/designer/prisma/migrations/20220715192633_add_alt/migration.sql b/packages/prisma-client/prisma/migrations/20220715192633_add_alt/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220715192633_add_alt/migration.sqlrename to packages/prisma-client/prisma/migrations/20220715192633_add_alt/migration.sqldiff --git a/apps/designer/prisma/migrations/20220716191150_add_more_info_to_asset/migration.sql b/packages/prisma-client/prisma/migrations/20220716191150_add_more_info_to_asset/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220716191150_add_more_info_to_asset/migration.sqlrename to packages/prisma-client/prisma/migrations/20220716191150_add_more_info_to_asset/migration.sqldiff --git a/apps/designer/prisma/migrations/20220716192051_make_metadata_not_mandatory/migration.sql b/packages/prisma-client/prisma/migrations/20220716192051_make_metadata_not_mandatory/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220716192051_make_metadata_not_mandatory/migration.sqlrename to packages/prisma-client/prisma/migrations/20220716192051_make_metadata_not_mandatory/migration.sqldiff --git a/apps/designer/prisma/migrations/20220717152939_make_width_and_height_float/migration.sql b/packages/prisma-client/prisma/migrations/20220717152939_make_width_and_height_float/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220717152939_make_width_and_height_float/migration.sqlrename to packages/prisma-client/prisma/migrations/20220717152939_make_width_and_height_float/migration.sqldiff --git a/apps/designer/prisma/migrations/20220717193140_make_width_and_height_decimal/migration.sql b/packages/prisma-client/prisma/migrations/20220717193140_make_width_and_height_decimal/migration.sqlsimilarity index 100%rename from apps/designer/prisma/migrations/20220717193140_make_width_and_height_decimal/migration.sqlrename to packages/prisma-client/prisma/migrations/20220717193140_make_width_and_height_decimal/migration.sqldiff --git a/apps/designer/prisma/migrations/migration_lock.toml b/packages/prisma-client/prisma/migrations/migration_lock.tomlsimilarity index 100%rename from apps/designer/prisma/migrations/migration_lock.tomlrename to packages/prisma-client/prisma/migrations/migration_lock.tomldiff --git a/apps/designer/prisma/schema.prisma b/packages/prisma-client/prisma/schema.prismasimilarity index 100%rename from apps/designer/prisma/schema.prismarename to packages/prisma-client/prisma/schema.prismadiff --git a/apps/designer/app/shared/db/prisma.server.ts b/packages/prisma-client/src/index.tssimilarity index 80%rename from apps/designer/app/shared/db/prisma.server.tsrename to packages/prisma-client/src/index.tsindex e56bcdb8cf..c199f058f4 100644--- a/apps/designer/app/shared/db/prisma.server.ts+++ b/packages/prisma-client/src/index.ts@@ -1,5 +1,12 @@import { PrismaClient, Prisma } from "@prisma/client";import { PrismaClientKnownRequestError } from "@prisma/client/runtime";+import type {+ InstanceProps,+ Project,+ User,+ Breakpoints,+ Asset,+} from "@prisma/client";declare global {// allow global `var` declarations@@ -15,3 +22,4 @@ export const prisma = global.prisma || new PrismaClient();if (process.env.NODE_ENV !== "production") global.prisma = prisma;export { Prisma, PrismaClientKnownRequestError };+export type { InstanceProps, Project, User, Breakpoints, Asset };diff --git a/packages/prisma-client/tsconfig.json b/packages/prisma-client/tsconfig.jsonnew file mode 100644index 0000000000..fe21c2ae7b--- /dev/null+++ b/packages/prisma-client/tsconfig.json@@ -0,0 +1,12 @@+// Extends can't use node's resolution rn https://github.com/dividab/tsconfig-paths/issues/209#issuecomment-1177261091+{+ "extends": "../../node_modules/tsconfig/base.json",+ "include": ["./src/**/*.ts"],+ "compilerOptions": {+ "module": "commonjs",+ "target": "ES2019",+ "strict": true,+ "baseUrl": ".",+ "outDir": "./lib"+ }+}diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.jsonindex 896c790399..df0a5ccf81 100644--- a/packages/react-sdk/package.json+++ b/packages/react-sdk/package.json@@ -8,10 +8,8 @@"build": "yarn build:mdn-data && yarn build:args","build:mdn-data": "./bin/mdn-data.ts ./src/css","build:args": "./bin/generate-arg-types.ts './src/components/*.tsx !./src/**/*.stories.tsx'",- "build:prisma": "prisma format && prisma generate","typecheck": "tsc --noEmit","build:lib": "rm -fr lib && tsc",- "postinstall": "prisma generate","test": "jest","checks": "yarn typecheck && yarn test","prepublishOnly": "yarn checks && yarn build:lib",@@ -44,6 +42,7 @@"react-docgen-typescript": "^2.2.2","react-dom": "^17.0.2","jest-config": "*",+ "@webstudio-is/prisma-client": "*","typescript": "^4.6.2"},"peerDependencies": {@@ -54,11 +53,9 @@"react-dom": "^17.0.2"},"dependencies": {- "@prisma/client": "^3.10.0","@stitches/core": "^1.2.7","immer": "^9.0.12","mitt": "^3.0.0",- "prisma": "^3.10.0","react-nano-state": "^0.4.0","zod": "^3.17.3"},@@ -66,8 +63,7 @@"types": "src/index.ts","files": ["README.md",- "!*.test.*",- "prisma/*"+ "!*.test.*"],"license": "MIT","private": falsediff --git a/packages/react-sdk/prisma/schema.prisma b/packages/react-sdk/prisma/schema.prismadeleted file mode 100644index 9946c6fe12..0000000000--- a/packages/react-sdk/prisma/schema.prisma+++ /dev/null@@ -1,71 +0,0 @@-// This is your Prisma schema file,-// learn more about it in the docs: https://pris.ly/d/prisma-schema--generator client {- provider = "prisma-client-js"-}--datasource db {- provider = "postgres"- url = env("DATABASE_URL")-}--model Team {- id String @id @default(uuid())- users User[]-}--model Asset {- id String @id @default(uuid())- project Project @relation(fields: [projectId], references: [id])- projectId String- format String?- size Int- width Decimal?- height Decimal?- name String- path String- alt String?- createdAt DateTime @default(now())-}--model User {- id String @id @default(uuid())- email String? @unique- provider String?- image String?- username String?- createdAt DateTime @default(now())- Team Team? @relation(fields: [teamId], references: [id])- teamId String?- projects Project[]-}--model Project {- id String @id @default(uuid())- title String- domain String @unique- prodTreeId String? // exists when published- devTreeId String- prodTreeIdHistory String @default("[]")- User User? @relation(fields: [userId], references: [id])- userId String?- Asset Asset[]-}--model Tree {- id String @id @default(uuid())- root String-}--model InstanceProps {- id String @id @default(uuid())- instanceId String- treeId String- props String @default("[]")-}--model Breakpoints {- treeId String @id @default(uuid())- values String @default("[]")-}diff --git a/packages/react-sdk/src/db/types.ts b/packages/react-sdk/src/db/types.tsindex ec8ea7db91..eb9a90138f 100644--- a/packages/react-sdk/src/db/types.ts+++ b/packages/react-sdk/src/db/types.ts@@ -1,10 +1,4 @@-import type {- InstanceProps as DbInstanceProps,- Project,- User,- Breakpoints,- Asset,-} from "@prisma/client";+import type { InstanceProps as DbInstanceProps } from "@webstudio-is/prisma-client";import type { UserProp } from "../user-props";import type { Instance } from "./instance";@@ -17,4 +11,4 @@ export type InstanceProps = Omit<DbInstanceProps, "props"> & {props: Array<UserProp>;};-export type { DbInstanceProps, Project, User, Breakpoints, Asset };+export type { DbInstanceProps };diff --git a/packages/react-sdk/src/prisma.server.ts b/packages/react-sdk/src/prisma.server.tsdeleted file mode 100644index 930d8011e5..0000000000--- a/packages/react-sdk/src/prisma.server.ts+++ /dev/null@@ -1,2 +0,0 @@-export { PrismaClient, Prisma } from "@prisma/client";-export { PrismaClientKnownRequestError } from "@prisma/client/runtime";diff --git a/yarn.lock b/yarn.lockindex 62cd43092e..4f7b570612 100644--- a/yarn.lock+++ b/yarn.lock@@ -2681,22 +2681,22 @@schema-utils "^3.0.0"source-map "^0.7.3"-"@prisma/client@^3.10.0", "@prisma/client@^3.14.0":- version "3.15.2"- resolved "https://registry.yarnpkg.com/@prisma/client/-/client-3.15.2.tgz#2181398147afc79bfe0d83c03a88dc45b49bd365"- integrity sha512-ErqtwhX12ubPhU4d++30uFY/rPcyvjk+mdifaZO5SeM21zS3t4jQrscy8+6IyB0GIYshl5ldTq6JSBo1d63i8w==+"@prisma/client@^4.1.0":+ version "4.1.0"+ resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.1.0.tgz#7c5341b2276c083821e432536ff97d8cc8f8b936"+ integrity sha512-MvfPGAd42vHTiCYxwS6N+2U3F+ukoJ48D2QRnX1zSPJHBkh1CBtshl75daKzvVfgQwSouzSQeugKDej5di+E/g==dependencies:- "@prisma/engines-version" "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"+ "@prisma/engines-version" "4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8"-"@prisma/engines-version@3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e":- version "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"- resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e.tgz#bf5e2373ca68ce7556b967cb4965a7095e93fe53"- integrity sha512-e3k2Vd606efd1ZYy2NQKkT4C/pn31nehyLhVug6To/q8JT8FpiMrDy7zmm3KLF0L98NOQQcutaVtAPhzKhzn9w==+"@prisma/engines-version@4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8":+ version "4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8"+ resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8.tgz#ce00e6377126e491a8b1e0e2039c97e2924bd6d9"+ integrity sha512-cRRJwpHFGFJZvtHbY3GZjMffNBEjjZk68ztn+S2hDgPCGB4H66IK26roK94GJxBodSehwRJ0wGyebC2GoIH1JQ==-"@prisma/[email protected]":- version "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"- resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e.tgz#f691893df506b93e3cb1ccc15ec6e5ac64e8e570"- integrity sha512-NHlojO1DFTsSi3FtEleL9QWXeSF/UjhCW0fgpi7bumnNZ4wj/eQ+BJJ5n2pgoOliTOGv9nX2qXvmHap7rJMNmg==+"@prisma/[email protected]":+ version "4.1.0"+ resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-4.1.0.tgz#da8002d4b75c92e3fd564ba5b0bd04847ffb3c4c"+ integrity sha512-quqHXD3P83NBLVtRlts4SgKHmqgA8GMiyDTJ7af03Wg0gl6F5t65mBYvIuwmD+52vHm42JtIsp/fAO9YIV0JBA=="@radix-ui/colors@^0.1.8":version "0.1.8"@@ -7905,11 +7905,26 @@ dot-case@^3.0.4:no-case "^3.0.4"tslib "^2.0.3"+dotenv-cli@^6.0.0:+ version "6.0.0"+ resolved "https://registry.yarnpkg.com/dotenv-cli/-/dotenv-cli-6.0.0.tgz#8a30cbc59d0a8aaa166b2fee0a9a55e23a1223ab"+ integrity sha512-qXlCOi3UMDhCWFKe0yq5sg3X+pJAz+RQDiFN38AMSbUrnY3uZshSfDJUAge951OS7J9gwLZGfsBlWRSOYz/TRg==+ dependencies:+ cross-spawn "^7.0.3"+ dotenv "^16.0.0"+ dotenv-expand "^8.0.1"+ minimist "^1.2.5"+dotenv-expand@^5.1.0:version "5.1.0"resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0"integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==+dotenv-expand@^8.0.1:+ version "8.0.3"+ resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-8.0.3.tgz#29016757455bcc748469c83a19b36aaf2b83dd6e"+ integrity sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg==+dotenv@^16.0.0:version "16.0.1"resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.1.tgz#8f8f9d94876c35dac989876a5d3a82a267fdce1d"@@ -14031,12 +14046,12 @@ [email protected], pretty-ms@^7.0.1:dependencies:parse-ms "^2.1.0"-prisma@^3.10.0, prisma@^3.14.0:- version "3.15.2"- resolved "https://registry.yarnpkg.com/prisma/-/prisma-3.15.2.tgz#4ebe32fb284da3ac60c49fbc16c75e56ecf32067"- integrity sha512-nMNSMZvtwrvoEQ/mui8L/aiCLZRCj5t6L3yujKpcDhIPk7garp8tL4nMx2+oYsN0FWBacevJhazfXAbV1kfBzA==+prisma@^4.1.0:+ version "4.1.0"+ resolved "https://registry.yarnpkg.com/prisma/-/prisma-4.1.0.tgz#5d43597f0f2603a4a75d9586346c74110d8e221f"+ integrity sha512-iwqpAT6In1uvMSwQAM3PqmaBdhh2OaQ/2t+n3RjpW4vAKP3R7E1T34FZUU4zGOWtMWm5dt0sPThQkT/h87r6gw==dependencies:- "@prisma/engines" "3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e"+ "@prisma/engines" "4.1.0"prismjs@^1.27.0:version "1.28.0"