From c2564eaf6505546398240ed0d1115973f64d3703 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 4 Jul 2024 15:16:58 +0200 Subject: [PATCH] :sparkles: Change spec location --- common/src/app/common/schema.cljc | 4 ---- common/src/app/common/types/color.cljc | 3 ++- common/src/app/common/types/container.cljc | 3 ++- common/src/app/common/types/file.cljc | 3 ++- common/src/app/common/types/page.cljc | 3 ++- common/src/app/common/types/plugins.cljc | 16 ++++++++++++++++ common/src/app/common/types/shape.cljc | 3 ++- common/src/app/common/types/typography.cljc | 3 ++- 8 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 common/src/app/common/types/plugins.cljc diff --git a/common/src/app/common/schema.cljc b/common/src/app/common/schema.cljc index 425525ca3..fcb516c3c 100644 --- a/common/src/app/common/schema.cljc +++ b/common/src/app/common/schema.cljc @@ -907,10 +907,6 @@ ::oapi/format "password"}}) -;; FIXME: this should not be here -(define! ::plugin-data - [:map-of {:gen/max 5} :string :string]) - ;; ---- PREDICATES (def valid-safe-number? diff --git a/common/src/app/common/types/color.cljc b/common/src/app/common/types/color.cljc index dea0ee6fc..aabb2b3ae 100644 --- a/common/src/app/common/types/color.cljc +++ b/common/src/app/common/types/color.cljc @@ -14,6 +14,7 @@ [app.common.types.color.generic :as-alias color-generic] [app.common.types.color.gradient :as-alias color-gradient] [app.common.types.color.gradient.stop :as-alias color-gradient-stop] + [app.common.types.plugins :as ctpg] [app.common.uuid :as uuid] [clojure.test.check.generators :as tgen] [cuerdas.core :as str])) @@ -88,7 +89,7 @@ [:gradient {:optional true} [:maybe ::gradient]] [:image {:optional true} [:maybe ::image-color]] [:plugin-data {:optional true} - [:map-of {:gen/max 5} :keyword ::sm/plugin-data]]] + [:map-of {:gen/max 5} :keyword ::ctpg/plugin-data]]] [::sm/contains-any {:strict true} [:color :gradient :image]]]) (sm/define! ::recent-color diff --git a/common/src/app/common/types/container.cljc b/common/src/app/common/types/container.cljc index 0313870b6..8c62801d4 100644 --- a/common/src/app/common/types/container.cljc +++ b/common/src/app/common/types/container.cljc @@ -15,6 +15,7 @@ [app.common.types.component :as ctk] [app.common.types.components-list :as ctkl] [app.common.types.pages-list :as ctpl] + [app.common.types.plugins :as ctpg] [app.common.types.shape-tree :as ctst] [app.common.types.shape.layout :as ctl] [app.common.uuid :as uuid])) @@ -37,7 +38,7 @@ [:objects {:optional true} [:map-of {:gen/max 10} ::sm/uuid :map]] [:plugin-data {:optional true} - [:map-of {:gen/max 5} :keyword ::sm/plugin-data]]]) + [:map-of {:gen/max 5} :keyword ::ctpg/plugin-data]]]) (def check-container! (sm/check-fn ::container)) diff --git a/common/src/app/common/types/file.cljc b/common/src/app/common/types/file.cljc index c8c7fbe43..4dcd6905e 100644 --- a/common/src/app/common/types/file.cljc +++ b/common/src/app/common/types/file.cljc @@ -24,6 +24,7 @@ [app.common.types.container :as ctn] [app.common.types.page :as ctp] [app.common.types.pages-list :as ctpl] + [app.common.types.plugins :as ctpg] [app.common.types.shape-tree :as ctst] [app.common.types.typographies-list :as ctyl] [app.common.types.typography :as cty] @@ -59,7 +60,7 @@ [:media {:optional true} [:map-of {:gen/max 5} ::sm/uuid ::media-object]] [:plugin-data {:optional true} - [:map-of {:gen/max 5} :keyword ::sm/plugin-data]]]) + [:map-of {:gen/max 5} :keyword ::ctpg/plugin-data]]]) (def check-file-data! (sm/check-fn ::data)) diff --git a/common/src/app/common/types/page.cljc b/common/src/app/common/types/page.cljc index 3e31540db..45ab722b1 100644 --- a/common/src/app/common/types/page.cljc +++ b/common/src/app/common/types/page.cljc @@ -10,6 +10,7 @@ [app.common.schema :as sm] [app.common.types.color :as-alias ctc] [app.common.types.grid :as ctg] + [app.common.types.plugins :as ctpg] [app.common.types.shape :as cts] [app.common.uuid :as uuid])) @@ -45,7 +46,7 @@ [:guides {:optional true} [:map-of {:gen/max 2} ::sm/uuid ::guide]] [:plugin-data {:optional true} - [:map-of {:gen/max 5} :keyword ::sm/plugin-data]]]]]) + [:map-of {:gen/max 5} :keyword ::ctpg/plugin-data]]]]]) (def check-page-guide! (sm/check-fn ::guide)) diff --git a/common/src/app/common/types/plugins.cljc b/common/src/app/common/types/plugins.cljc new file mode 100644 index 000000000..82affb339 --- /dev/null +++ b/common/src/app/common/types/plugins.cljc @@ -0,0 +1,16 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + +(ns app.common.types.plugins + (:require + [app.common.schema :as sm])) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; SCHEMAS +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(sm/define! ::plugin-data + [:map-of {:gen/max 5} :string :string]) diff --git a/common/src/app/common/types/shape.cljc b/common/src/app/common/types/shape.cljc index e22353e75..38e172d82 100644 --- a/common/src/app/common/types/shape.cljc +++ b/common/src/app/common/types/shape.cljc @@ -20,6 +20,7 @@ [app.common.transit :as t] [app.common.types.color :as ctc] [app.common.types.grid :as ctg] + [app.common.types.plugins :as ctpg] [app.common.types.shape.attrs :refer [default-color]] [app.common.types.shape.blur :as ctsb] [app.common.types.shape.export :as ctse] @@ -188,7 +189,7 @@ [:grow-type {:optional true} [::sm/one-of #{:auto-width :auto-height :fixed}]] [:plugin-data {:optional true} - [:map-of {:gen/max 5} :keyword ::sm/plugin-data]]]) + [:map-of {:gen/max 5} :keyword ::ctpg/plugin-data]]]) (sm/define! ::group-attrs [:map {:title "GroupAttrs"} diff --git a/common/src/app/common/types/typography.cljc b/common/src/app/common/types/typography.cljc index 2e5a08b93..02e7fc6f6 100644 --- a/common/src/app/common/types/typography.cljc +++ b/common/src/app/common/types/typography.cljc @@ -9,6 +9,7 @@ [app.common.data :as d] [app.common.schema :as sm] [app.common.text :as txt] + [app.common.types.plugins :as ctpg] [app.common.uuid :as uuid])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -31,7 +32,7 @@ [:modified-at {:optional true} ::sm/inst] [:path {:optional true} [:maybe :string]] [:plugin-data {:optional true} - [:map-of {:gen/max 5} :keyword ::sm/plugin-data]]]) + [:map-of {:gen/max 5} :keyword ::ctpg/plugin-data]]]) (def check-typography! (sm/check-fn ::typography))