mirror of
https://github.com/penpot/penpot.git
synced 2025-04-13 07:21:40 -05:00
Merge pull request #3867 from penpot/niwinz-develop-fmt-clj-backend
💄 Reformat backend clj files
This commit is contained in:
commit
a397f25cb2
61 changed files with 304 additions and 424 deletions
|
@ -353,8 +353,7 @@
|
|||
(get-name [props]
|
||||
(let [attr-kw (cf/get :oidc-name-attr "name")
|
||||
attr-ph (parse-attr-path provider attr-kw)]
|
||||
(get-in props attr-ph)))
|
||||
]
|
||||
(get-in props attr-ph)))]
|
||||
|
||||
(let [props (qualify-props provider info)
|
||||
email (get-email props)]
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
:with-credentials (and (contains? cfg ::username)
|
||||
(contains? cfg ::password))
|
||||
:min-size (::min-size cfg)
|
||||
:max-size (::max-size cfg))
|
||||
:max-size (::max-size cfg))
|
||||
(create-pool cfg)))
|
||||
|
||||
(defmethod ig/halt-key! ::pool
|
||||
|
@ -412,7 +412,7 @@
|
|||
(.setSavepoint conn (name label))))
|
||||
|
||||
(defn release!
|
||||
[^Connection conn ^Savepoint sp ]
|
||||
[^Connection conn ^Savepoint sp]
|
||||
(.releaseSavepoint conn sp))
|
||||
|
||||
(defn rollback!
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
(let [{:keys [host port] :as url} (sto/get-object-url storage obj {:max-age signature-max-age})]
|
||||
{::rres/status 307
|
||||
::rres/headers {"location" (str url)
|
||||
"x-host" (cond-> host port (str ":" port))
|
||||
"x-mtype" (-> obj meta :content-type)
|
||||
"cache-control" (str "max-age=" (inst-ms cache-max-age))}}))
|
||||
"x-host" (cond-> host port (str ":" port))
|
||||
"x-mtype" (-> obj meta :content-type)
|
||||
"cache-control" (str "max-age=" (inst-ms cache-max-age))}}))
|
||||
|
||||
(defn- serve-object-from-fs
|
||||
[{:keys [::path]} obj]
|
||||
|
|
|
@ -230,8 +230,7 @@
|
|||
(-> (io/resource "app/templates/error-report.v3.tmpl")
|
||||
(tmpl/render (-> content
|
||||
(assoc :id id)
|
||||
(assoc :created-at (dt/format-instant created-at :rfc1123))))))
|
||||
]
|
||||
(assoc :created-at (dt/format-instant created-at :rfc1123))))))]
|
||||
|
||||
(if-let [report (get-report request)]
|
||||
(let [result (case (:version report)
|
||||
|
|
|
@ -117,21 +117,21 @@
|
|||
:profile-id profile-id
|
||||
:session-id session-id}]
|
||||
|
||||
;; Close profile subscription if exists
|
||||
(when-let [ch (:channel psub)]
|
||||
(sp/close! ch)
|
||||
(mbus/purge! msgbus [ch]))
|
||||
;; Close profile subscription if exists
|
||||
(when-let [ch (:channel psub)]
|
||||
(sp/close! ch)
|
||||
(mbus/purge! msgbus [ch]))
|
||||
|
||||
;; Close team subscription if exists
|
||||
(when-let [ch (:channel tsub)]
|
||||
(sp/close! ch)
|
||||
(mbus/purge! msgbus [ch]))
|
||||
;; Close team subscription if exists
|
||||
(when-let [ch (:channel tsub)]
|
||||
(sp/close! ch)
|
||||
(mbus/purge! msgbus [ch]))
|
||||
|
||||
;; Close file subscription if exists
|
||||
(when-let [{:keys [topic channel]} fsub]
|
||||
(sp/close! channel)
|
||||
(mbus/purge! msgbus [channel])
|
||||
(mbus/pub! msgbus :topic topic :message msg))))
|
||||
;; Close file subscription if exists
|
||||
(when-let [{:keys [topic channel]} fsub]
|
||||
(sp/close! channel)
|
||||
(mbus/purge! msgbus [channel])
|
||||
(mbus/pub! msgbus :topic topic :message msg))))
|
||||
|
||||
(defmethod handle-message :subscribe-team
|
||||
[{:keys [::mbus/msgbus]} {:keys [::ws/id ::ws/state ::ws/output-ch ::session-id]} {:keys [team-id] :as params}]
|
||||
|
@ -179,7 +179,7 @@
|
|||
(let [message {:type :presence
|
||||
:file-id file-id
|
||||
:session-id session-id
|
||||
:profile-id profile-id}]
|
||||
:profile-id profile-id}]
|
||||
(mbus/pub! msgbus
|
||||
:topic file-id
|
||||
:message message)))
|
||||
|
|
|
@ -182,5 +182,4 @@
|
|||
"invalid-uri"
|
||||
|
||||
(instance? java.net.http.HttpConnectTimeoutException cause)
|
||||
"timeout"
|
||||
))
|
||||
"timeout"))
|
||||
|
|
|
@ -160,8 +160,7 @@
|
|||
{::mdef/name "penpot_executors_running_threads"
|
||||
::mdef/help "Current number of threads with state RUNNING."
|
||||
::mdef/labels ["name"]
|
||||
::mdef/type :gauge}
|
||||
})
|
||||
::mdef/type :gauge}})
|
||||
|
||||
(def system-config
|
||||
{::db/pool
|
||||
|
@ -322,8 +321,7 @@
|
|||
::setup/templates (ig/ref ::setup/templates)
|
||||
::props (ig/ref ::setup/props)
|
||||
|
||||
:pool (ig/ref ::db/pool)
|
||||
}
|
||||
:pool (ig/ref ::db/pool)}
|
||||
|
||||
:app.rpc.doc/routes
|
||||
{:methods (ig/ref :app.rpc/methods)}
|
||||
|
@ -443,8 +441,7 @@
|
|||
::sto.s3/io-threads (cf/get :storage-assets-s3-io-threads)}
|
||||
|
||||
[::assets :app.storage.fs/backend]
|
||||
{::sto.fs/directory (cf/get :storage-assets-fs-directory)}
|
||||
})
|
||||
{::sto.fs/directory (cf/get :storage-assets-fs-directory)}})
|
||||
|
||||
|
||||
(def worker-config
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
writer (StringWriter.)]
|
||||
(TextFormat/write004 writer samples)
|
||||
{:headers {"content-type" TextFormat/CONTENT_TYPE_004}
|
||||
:body (.toString writer)}))
|
||||
:body (.toString writer)}))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -337,9 +337,7 @@
|
|||
:fn (mg/resource "app/migrations/sql/0106-mod-team-table.sql")}
|
||||
|
||||
{:name "0107-mod-file-tagged-object-thumbnail-table"
|
||||
:fn (mg/resource "app/migrations/sql/0107-mod-file-tagged-object-thumbnail-table.sql")}
|
||||
|
||||
])
|
||||
:fn (mg/resource "app/migrations/sql/0107-mod-file-tagged-object-thumbnail-table.sql")}])
|
||||
|
||||
(defn apply-migrations!
|
||||
[pool name migrations]
|
||||
|
|
|
@ -181,8 +181,8 @@
|
|||
(let [f (px/wrap-bindings f)]
|
||||
(p/await! (px/submit! executor f))))]
|
||||
(if (and cache id)
|
||||
(invoke! cache metrics id nil f)
|
||||
(f)))))
|
||||
(invoke! cache metrics id nil f)
|
||||
(f)))))
|
||||
|
||||
(def noop-fn (constantly nil))
|
||||
|
||||
|
|
|
@ -636,8 +636,8 @@
|
|||
input (io/data-input-stream input)]
|
||||
(binding [*state* (volatile! {:media [] :index {}})]
|
||||
(let [team (teams/get-team options
|
||||
:profile-id profile-id
|
||||
:project-id project-id)
|
||||
:profile-id profile-id
|
||||
:project-id project-id)
|
||||
|
||||
validate? (contains? cf/flags :file-validation)
|
||||
features (cfeat/get-team-enabled-features cf/flags team)]
|
||||
|
|
|
@ -361,7 +361,7 @@
|
|||
{::doc/added "1.17"
|
||||
::sm/params schema:get-file-fragment
|
||||
::sm/result schema:file-fragment}
|
||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id file-id fragment-id share-id] }]
|
||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id file-id fragment-id share-id]}]
|
||||
(dm/with-open [conn (db/open pool)]
|
||||
(let [perms (get-permissions conn profile-id file-id share-id)]
|
||||
(check-read-permissions! perms)
|
||||
|
@ -491,7 +491,7 @@
|
|||
page (dm/get-in file [:data :pages-index page-id])]
|
||||
(if (pmap/pointer-map? page)
|
||||
(deref page)
|
||||
page)))]
|
||||
page)))]
|
||||
|
||||
(cond-> (prune-thumbnails page)
|
||||
(some? object-id)
|
||||
|
@ -549,10 +549,10 @@
|
|||
(defn get-team-shared-files
|
||||
[conn team-id]
|
||||
(letfn [(assets-sample [assets limit]
|
||||
(let [sorted-assets (->> (vals assets)
|
||||
(sort-by #(str/lower (:name %))))]
|
||||
{:count (count sorted-assets)
|
||||
:sample (into [] (take limit sorted-assets))}))
|
||||
(let [sorted-assets (->> (vals assets)
|
||||
(sort-by #(str/lower (:name %))))]
|
||||
{:count (count sorted-assets)
|
||||
:sample (into [] (take limit sorted-assets))}))
|
||||
|
||||
(library-summary [{:keys [id data] :as file}]
|
||||
(binding [pmap/*load-fn* (partial load-pointer conn id)]
|
||||
|
|
|
@ -78,8 +78,8 @@
|
|||
(create-file-role! conn))
|
||||
|
||||
(db/update! conn :project
|
||||
{:modified-at (dt/now)}
|
||||
{:id project-id})
|
||||
{:modified-at (dt/now)}
|
||||
{:id project-id})
|
||||
|
||||
(files/decode-row file)))
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@
|
|||
:file-id file-id)
|
||||
|
||||
(db/update! conn :file
|
||||
{:data (:data snapshot)}
|
||||
{:id file-id})
|
||||
{:data (:data snapshot)}
|
||||
{:id file-id})
|
||||
|
||||
;; clean object thumbnails
|
||||
(let [sql (str "delete from file_object_thumbnail "
|
||||
|
|
|
@ -361,8 +361,7 @@
|
|||
::sm/params [:map {:title "create-file-thumbnail"}
|
||||
[:file-id ::sm/uuid]
|
||||
[:revn :int]
|
||||
[:media ::media/upload]]
|
||||
}
|
||||
[:media ::media/upload]]}
|
||||
|
||||
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id file-id] :as params}]
|
||||
(db/with-atomic [conn pool]
|
||||
|
|
|
@ -338,7 +338,7 @@
|
|||
|
||||
(cond-> (and (contains? cfeat/*current* "fdata/pointer-map")
|
||||
(not (contains? cfeat/*previous* "fdata/pointer-map")))
|
||||
(enable-pointer-map))
|
||||
(enable-pointer-map))
|
||||
|
||||
(update :data blob/encode))))
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@
|
|||
perms (files/get-permissions conn profile-id file-id share-id)]
|
||||
(files/check-read-permissions! perms)
|
||||
(db/query conn :team-font-variant
|
||||
{:team-id (:team-id project)
|
||||
:deleted-at nil})))))
|
||||
{:team-id (:team-id project)
|
||||
:deleted-at nil})))))
|
||||
|
||||
|
||||
(declare create-font-variant)
|
||||
|
@ -157,8 +157,7 @@
|
|||
:woff1-file-id (:id woff1)
|
||||
:woff2-file-id (:id woff2)
|
||||
:otf-file-id (:id otf)
|
||||
:ttf-file-id (:id ttf)}))
|
||||
]
|
||||
:ttf-file-id (:id ttf)}))]
|
||||
|
||||
(let [data (-> (climit/configure cfg :process-font/global)
|
||||
(climit/run! (partial generate-missing! data)
|
||||
|
|
|
@ -234,9 +234,9 @@
|
|||
(assoc :is-pinned false))
|
||||
|
||||
files (db/query conn :file
|
||||
{:project-id (:id project)
|
||||
:deleted-at nil}
|
||||
{:columns [:id]})
|
||||
{:project-id (:id project)
|
||||
:deleted-at nil}
|
||||
{:columns [:id]})
|
||||
|
||||
project (cond-> project
|
||||
(string? name)
|
||||
|
|
|
@ -106,8 +106,7 @@
|
|||
profile (-> profile
|
||||
(assoc :fullname fullname)
|
||||
(assoc :lang lang)
|
||||
(assoc :theme theme))
|
||||
]
|
||||
(assoc :theme theme))]
|
||||
|
||||
(db/update! conn :profile
|
||||
{:fullname fullname
|
||||
|
|
|
@ -50,11 +50,11 @@
|
|||
is-owner (boolean (some :is-owner rows))
|
||||
is-admin (boolean (some :is-admin rows))
|
||||
can-edit (boolean (some :can-edit rows))]
|
||||
(when (seq rows)
|
||||
{:is-owner is-owner
|
||||
:is-admin (or is-owner is-admin)
|
||||
:can-edit (or is-owner is-admin can-edit)
|
||||
:can-read true})))
|
||||
(when (seq rows)
|
||||
{:is-owner is-owner
|
||||
:is-admin (or is-owner is-admin)
|
||||
:can-edit (or is-owner is-admin can-edit)
|
||||
:can-read true})))
|
||||
|
||||
(def has-edit-permissions?
|
||||
(perms/make-edition-predicate-fn get-permissions))
|
||||
|
|
|
@ -56,11 +56,11 @@
|
|||
is-owner (boolean (some :is-owner rows))
|
||||
is-admin (boolean (some :is-admin rows))
|
||||
can-edit (boolean (some :can-edit rows))]
|
||||
(when (seq rows)
|
||||
{:is-owner is-owner
|
||||
:is-admin (or is-owner is-admin)
|
||||
:can-edit (or is-owner is-admin can-edit)
|
||||
:can-read true})))
|
||||
(when (seq rows)
|
||||
{:is-owner is-owner
|
||||
:is-admin (or is-owner is-admin)
|
||||
:can-edit (or is-owner is-admin can-edit)
|
||||
:can-read true})))
|
||||
|
||||
(def has-admin-permissions?
|
||||
(perms/make-admin-predicate-fn get-permissions))
|
||||
|
@ -368,8 +368,8 @@
|
|||
(let [conn (db/get-connection cfg-or-conn)
|
||||
team (create-team* conn params)
|
||||
params (assoc params
|
||||
:team-id (:id team)
|
||||
:role :owner)
|
||||
:team-id (:id team)
|
||||
:role :owner)
|
||||
project (create-team-default-project conn params)]
|
||||
(create-team-role conn params)
|
||||
(assoc team :default-project-id (:id project))))
|
||||
|
@ -667,8 +667,8 @@
|
|||
|
||||
;; Save new photo
|
||||
(db/update! pool :team
|
||||
{:photo-id (:id photo)}
|
||||
{:id team-id})
|
||||
{:photo-id (:id photo)}
|
||||
{:id team-id})
|
||||
|
||||
(assoc team :photo-id (:id photo)))))
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
context (assoc context :param-style pstyle)]
|
||||
{::rres/status 200
|
||||
::rres/body (-> (io/resource "app/templates/api-doc.tmpl")
|
||||
(tmpl/render context))}))
|
||||
(tmpl/render context))}))
|
||||
(fn [_]
|
||||
{::rres/status 404})))
|
||||
|
||||
|
@ -141,8 +141,7 @@
|
|||
|
||||
{:name (-> mdata ::sv/name d/name)
|
||||
:module (-> (:ns mdata) (str/split ".") last)
|
||||
:repr {:post rpost}}))
|
||||
]
|
||||
:repr {:post rpost}}))]
|
||||
|
||||
(let [definitions (atom {})
|
||||
options {:registry sr/default-registry
|
||||
|
@ -158,16 +157,16 @@
|
|||
(map (fn [doc]
|
||||
[(str/ffmt "/command/%" (:name doc)) (:repr doc)]))
|
||||
(into {})))]
|
||||
{:openapi "3.0.0"
|
||||
:info {:version (:main cf/version)}
|
||||
:servers [{:url (str/ffmt "%/api/rpc" (cf/get :public-uri))
|
||||
{:openapi "3.0.0"
|
||||
:info {:version (:main cf/version)}
|
||||
:servers [{:url (str/ffmt "%/api/rpc" (cf/get :public-uri))
|
||||
;; :description "penpot backend"
|
||||
}]
|
||||
:security
|
||||
{:api_key []}
|
||||
}]
|
||||
:security
|
||||
{:api_key []}
|
||||
|
||||
:paths paths
|
||||
:components {:schemas @definitions}})))
|
||||
:paths paths
|
||||
:components {:schemas @definitions}})))
|
||||
|
||||
(defn openapi-json-handler
|
||||
[context]
|
||||
|
@ -192,7 +191,7 @@
|
|||
{::rres/status 200
|
||||
::rres/headers {"content-type" "text/html"}
|
||||
::rres/body (-> (io/resource "app/templates/openapi.tmpl")
|
||||
(tmpl/render context))}))
|
||||
(tmpl/render context))}))
|
||||
(fn [_]
|
||||
{::rres/status 404})))
|
||||
|
||||
|
|
|
@ -158,15 +158,15 @@
|
|||
|
||||
(p/await! scope))
|
||||
|
||||
(-> (deref feat/*stats*)
|
||||
(assoc :elapsed (dt/format-duration (tpoint))))
|
||||
(-> (deref feat/*stats*)
|
||||
(assoc :elapsed (dt/format-duration (tpoint))))
|
||||
|
||||
(catch Throwable cause
|
||||
(l/dbg :hint "migrate:error" :cause cause))
|
||||
(catch Throwable cause
|
||||
(l/dbg :hint "migrate:error" :cause cause))
|
||||
|
||||
(finally
|
||||
(let [elapsed (dt/format-duration (tpoint))]
|
||||
(l/dbg :hint "migrate:end" :elapsed elapsed))))))))
|
||||
(finally
|
||||
(let [elapsed (dt/format-duration (tpoint))]
|
||||
(l/dbg :hint "migrate:end" :elapsed elapsed))))))))
|
||||
|
||||
(defn migrate-team!
|
||||
[{:keys [::db/pool] :as system} team-id
|
||||
|
|
|
@ -96,9 +96,9 @@
|
|||
:name (:name file)))
|
||||
new-file))))
|
||||
|
||||
([file state]
|
||||
(rename-layout-attrs file)
|
||||
(update state :total (fnil inc 0))))
|
||||
([file state]
|
||||
(rename-layout-attrs file)
|
||||
(update state :total (fnil inc 0))))
|
||||
|
||||
(defn fix-components-shaperefs
|
||||
([file]
|
||||
|
@ -369,11 +369,11 @@
|
|||
(= (:shape-ref child) ref-child-id))
|
||||
false))
|
||||
equal? (every? matches? (d/zip-all (:shapes shape) (:shapes ref-shape)))]
|
||||
(when (and (not equal?) (not (cfh/touched-group? shape :shapes-group)))
|
||||
(println " -> set touched " (:name shape) (:id shape) :shapes :shapes-group))
|
||||
(cond-> shape
|
||||
(and (not equal?) (not (cfh/touched-group? shape :shapes-group)))
|
||||
(update :touched cfh/set-touched-group :shapes-group))))]
|
||||
(when (and (not equal?) (not (cfh/touched-group? shape :shapes-group)))
|
||||
(println " -> set touched " (:name shape) (:id shape) :shapes :shapes-group))
|
||||
(cond-> shape
|
||||
(and (not equal?) (not (cfh/touched-group? shape :shapes-group)))
|
||||
(update :touched cfh/set-touched-group :shapes-group))))]
|
||||
|
||||
(as-> shape $
|
||||
(reduce fix-touched-attr $ ctk/sync-attrs)
|
||||
|
|
|
@ -245,8 +245,7 @@
|
|||
(start-worker [input index]
|
||||
(px/thread
|
||||
{:name (str "penpot/srepl/worker/" index)}
|
||||
(run-worker input index)))
|
||||
]
|
||||
(run-worker input index)))]
|
||||
|
||||
(when (fn? on-init) (on-init))
|
||||
|
||||
|
|
|
@ -313,8 +313,7 @@
|
|||
(= op :profile-id)
|
||||
(if (coll? param)
|
||||
(sequence (keep parse-uuid) param)
|
||||
(resolve-dest param))))))
|
||||
]
|
||||
(resolve-dest param))))))]
|
||||
|
||||
(->> (resolve-dest dest)
|
||||
(filter some?)
|
||||
|
|
|
@ -403,8 +403,7 @@
|
|||
(do
|
||||
(some->> (seq to-freeze) (mark-freeze-in-bulk conn))
|
||||
(some->> (seq to-delete) (mark-delete-in-bulk conn))
|
||||
[(count to-freeze) (count to-delete)]))))
|
||||
]
|
||||
[(count to-freeze) (count to-delete)]))))]
|
||||
|
||||
(fn [_]
|
||||
(db/with-atomic [conn pool]
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
[datoteka.io :as io]
|
||||
[integrant.core :as ig])
|
||||
(:import
|
||||
java.nio.file.Path
|
||||
java.nio.file.Files))
|
||||
java.nio.file.Files
|
||||
java.nio.file.Path))
|
||||
|
||||
;; --- BACKEND INIT
|
||||
|
||||
|
|
|
@ -194,9 +194,7 @@
|
|||
builder (cond-> ^S3AsyncClientBuilder builder
|
||||
(some? endpoint)
|
||||
(.endpointOverride (URI. endpoint)))]
|
||||
(.build ^S3AsyncClientBuilder builder))
|
||||
|
||||
]
|
||||
(.build ^S3AsyncClientBuilder builder))]
|
||||
|
||||
(reify
|
||||
clojure.lang.IDeref
|
||||
|
@ -265,15 +263,15 @@
|
|||
(Optional/of (long (impl/get-size content))))
|
||||
|
||||
(^void subscribe [_ ^Subscriber subscriber]
|
||||
(let [sem (Semaphore. 0)
|
||||
thr (upload-thread id subscriber sem content)]
|
||||
(.onSubscribe subscriber
|
||||
(reify Subscription
|
||||
(cancel [_]
|
||||
(px/interrupt! thr)
|
||||
(.release sem 1))
|
||||
(request [_ n]
|
||||
(.release sem (int n)))))))))
|
||||
(let [sem (Semaphore. 0)
|
||||
thr (upload-thread id subscriber sem content)]
|
||||
(.onSubscribe subscriber
|
||||
(reify Subscription
|
||||
(cancel [_]
|
||||
(px/interrupt! thr)
|
||||
(.release sem 1))
|
||||
(request [_ n]
|
||||
(.release sem (int n)))))))))
|
||||
|
||||
|
||||
(defn- put-object
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
{::db/return-keys? false})
|
||||
count (db/get-update-count result)]
|
||||
(when (pos? count)
|
||||
(l/debug :hint "mark team for deletion" :id (str id) ))
|
||||
(l/debug :hint "mark team for deletion" :id (str id)))
|
||||
|
||||
(+ total count)))]
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@
|
|||
(defn- retrieve-enabled-auth-providers
|
||||
[conn]
|
||||
(let [sql (str "select auth_backend as backend, count(*) as total "
|
||||
" from profile group by 1")
|
||||
" from profile group by 1")
|
||||
rows (db/exec! conn [sql])]
|
||||
(->> rows
|
||||
(map (fn [{:keys [backend total]}]
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
"A syntactic helpers for using locks."
|
||||
(:refer-clojure :exclude [locking])
|
||||
(:import
|
||||
java.util.concurrent.locks.ReentrantLock
|
||||
java.util.concurrent.locks.Lock))
|
||||
java.util.concurrent.locks.Lock
|
||||
java.util.concurrent.locks.ReentrantLock))
|
||||
|
||||
(defn create
|
||||
[]
|
||||
|
|
|
@ -335,8 +335,7 @@
|
|||
Iterable
|
||||
(iterator [this]
|
||||
(when-not loaded? (load! this))
|
||||
(ObjectsMapIterator. (.iterator ^Iterable positions) this))
|
||||
)
|
||||
(ObjectsMapIterator. (.iterator ^Iterable positions) this)))
|
||||
|
||||
(defn create
|
||||
([]
|
||||
|
|
|
@ -371,8 +371,7 @@
|
|||
::sm/decode instant
|
||||
:gen/gen (tgen/fmap (fn [i] (in-past i)) tgen/pos-int)
|
||||
::oapi/type "string"
|
||||
::oapi/format "iso"
|
||||
}})
|
||||
::oapi/format "iso"}})
|
||||
|
||||
(sm/def! ::duration
|
||||
{:type :durations
|
||||
|
@ -383,5 +382,4 @@
|
|||
:title "duration"
|
||||
::sm/decode duration
|
||||
::oapi/type "string"
|
||||
::oapi/format "duration"
|
||||
}})
|
||||
::oapi/format "duration"}})
|
||||
|
|
|
@ -89,17 +89,17 @@
|
|||
state (atom {})
|
||||
beats (atom #{})
|
||||
options (-> options
|
||||
(update ::handler wrap-handler)
|
||||
(assoc ::id id)
|
||||
(assoc ::state state)
|
||||
(assoc ::beats beats)
|
||||
(assoc ::created-at (dt/now))
|
||||
(assoc ::input-ch input-ch)
|
||||
(assoc ::heartbeat-ch hbeat-ch)
|
||||
(assoc ::output-ch output-ch)
|
||||
(assoc ::close-ch close-ch)
|
||||
(assoc ::remote-addr ip-addr)
|
||||
(assoc ::user-agent uagent))]
|
||||
(update ::handler wrap-handler)
|
||||
(assoc ::id id)
|
||||
(assoc ::state state)
|
||||
(assoc ::beats beats)
|
||||
(assoc ::created-at (dt/now))
|
||||
(assoc ::input-ch input-ch)
|
||||
(assoc ::heartbeat-ch hbeat-ch)
|
||||
(assoc ::output-ch output-ch)
|
||||
(assoc ::close-ch close-ch)
|
||||
(assoc ::remote-addr ip-addr)
|
||||
(assoc ::user-agent uagent))]
|
||||
|
||||
{:on-open
|
||||
(fn on-open [channel]
|
||||
|
@ -115,9 +115,9 @@
|
|||
:on-close
|
||||
(fn on-close [_channel code reason]
|
||||
(l/info :fn "on-ws-terminate"
|
||||
:conn-id id
|
||||
:code code
|
||||
:reason reason)
|
||||
:conn-id id
|
||||
:code code
|
||||
:reason reason)
|
||||
(sp/close! close-ch))
|
||||
|
||||
:on-error
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
[promesa.core :as p]
|
||||
[promesa.exec :as px])
|
||||
(:import
|
||||
java.util.concurrent.ThreadPoolExecutor
|
||||
java.util.concurrent.Executor
|
||||
java.util.concurrent.Future))
|
||||
java.util.concurrent.Future
|
||||
java.util.concurrent.ThreadPoolExecutor))
|
||||
|
||||
(set! *warn-on-reflection* true)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
(defn bounce-report
|
||||
[{:keys [token email] :or {email "user@example.com"}}]
|
||||
{"notificationType" "Bounce",
|
||||
"bounce" {"feedbackId""010701776d7dd251-c08d280d-9f47-41aa-b959-0094fec779d9-000000",
|
||||
"bounce" {"feedbackId" "010701776d7dd251-c08d280d-9f47-41aa-b959-0094fec779d9-000000",
|
||||
"bounceType" "Permanent",
|
||||
"bounceSubType" "General",
|
||||
"bouncedRecipients" [{"emailAddress" email,
|
||||
|
@ -113,8 +113,7 @@
|
|||
(t/is (= "permanent" (:kind result)))
|
||||
(t/is (= "general" (:category result)))
|
||||
(t/is (= ["user@example.com"] (mapv :email (:recipients result))))
|
||||
(t/is (= (:id profile) (:profile-id result)))
|
||||
))
|
||||
(t/is (= (:id profile) (:profile-id result)))))
|
||||
|
||||
(t/deftest test-parse-complaint-report
|
||||
(let [profile (th/create-profile* 1)
|
||||
|
@ -129,8 +128,7 @@
|
|||
(t/is (= "abuse" (:kind result)))
|
||||
(t/is (= nil (:category result)))
|
||||
(t/is (= ["user@example.com"] (into [] (:recipients result))))
|
||||
(t/is (= (:id profile) (:profile-id result)))
|
||||
))
|
||||
(t/is (= (:id profile) (:profile-id result)))))
|
||||
|
||||
(t/deftest test-parse-complaint-report-without-token
|
||||
(let [props (:app.setup/props th/*system*)
|
||||
|
@ -141,8 +139,7 @@
|
|||
(t/is (= "abuse" (:kind result)))
|
||||
(t/is (= nil (:category result)))
|
||||
(t/is (= ["user@example.com"] (into [] (:recipients result))))
|
||||
(t/is (= nil (:profile-id result)))
|
||||
))
|
||||
(t/is (= nil (:profile-id result)))))
|
||||
|
||||
(t/deftest test-process-bounce-report
|
||||
(let [profile (th/create-profile* 1)
|
||||
|
@ -169,9 +166,7 @@
|
|||
(t/is (= "user@example.com" (get-in rows [0 :email]))))
|
||||
|
||||
(let [prof (db/get-by-id pool :profile (:id profile))]
|
||||
(t/is (false? (:is-muted prof))))
|
||||
|
||||
))
|
||||
(t/is (false? (:is-muted prof))))))
|
||||
|
||||
(t/deftest test-process-complaint-report
|
||||
(let [profile (th/create-profile* 1)
|
||||
|
@ -201,9 +196,7 @@
|
|||
|
||||
|
||||
(let [prof (db/get-by-id pool :profile (:id profile))]
|
||||
(t/is (false? (:is-muted prof))))
|
||||
|
||||
))
|
||||
(t/is (false? (:is-muted prof))))))
|
||||
|
||||
(t/deftest test-process-bounce-report-to-self
|
||||
(let [profile (th/create-profile* 1)
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
(ns backend-tests.email-sending-test
|
||||
(:require
|
||||
[backend-tests.helpers :as th]
|
||||
[app.db :as db]
|
||||
[app.email :as emails]
|
||||
[backend-tests.helpers :as th]
|
||||
[clojure.test :as t]
|
||||
[promesa.core :as p]))
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
[app.config :as cf]
|
||||
[app.db :as db]
|
||||
[app.main :as main]
|
||||
[app.media :as-alias mtx]
|
||||
[app.media]
|
||||
[app.media :as-alias mtx]
|
||||
[app.migrations]
|
||||
[app.msgbus :as-alias mbus]
|
||||
[app.rpc :as-alias rpc]
|
||||
|
@ -110,8 +110,7 @@
|
|||
"alter table storage_object set unlogged;\n"
|
||||
"alter table server_error_report set unlogged;\n"
|
||||
"alter table server_prop set unlogged;\n"
|
||||
"alter table global_complaint_report set unlogged;\n"
|
||||
])
|
||||
"alter table global_complaint_report set unlogged;\n"])
|
||||
|
||||
(defn state-init
|
||||
[next]
|
||||
|
@ -272,7 +271,7 @@
|
|||
(defn create-file-media-object*
|
||||
([params] (create-file-media-object* *system* params))
|
||||
([system {:keys [name width height mtype file-id is-local media-id]
|
||||
:or {name "sample" width 100 height 100 mtype "image/svg+xml" is-local true}}]
|
||||
:or {name "sample" width 100 height 100 mtype "image/svg+xml" is-local true}}]
|
||||
|
||||
(dm/with-open [conn (db/open system)]
|
||||
(db/insert! conn :file-media-object
|
||||
|
@ -322,8 +321,8 @@
|
|||
([system {:keys [project-id profile-id role] :or {role :owner}}]
|
||||
(dm/with-open [conn (db/open system)]
|
||||
(#'teams/create-project-role conn {:project-id project-id
|
||||
:profile-id profile-id
|
||||
:role role}))))
|
||||
:profile-id profile-id
|
||||
:role role}))))
|
||||
|
||||
(defn create-file-role*
|
||||
([params] (create-file-role* *system* params))
|
||||
|
@ -336,7 +335,7 @@
|
|||
(defn update-file*
|
||||
([params] (update-file* *system* params))
|
||||
([system {:keys [file-id changes session-id profile-id revn]
|
||||
:or {session-id (uuid/next) revn 0}}]
|
||||
:or {session-id (uuid/next) revn 0}}]
|
||||
(db/tx-run! system (fn [{:keys [::db/conn] :as system}]
|
||||
(let [file (files.update/get-file conn file-id)]
|
||||
(files.update/update-file system
|
||||
|
|
|
@ -65,9 +65,7 @@
|
|||
|
||||
;; Refresh webhook
|
||||
(let [whk' (th/db-get :webhook {:id (:id whk)})]
|
||||
(t/is (nil? (:error-code whk'))))
|
||||
|
||||
)))
|
||||
(t/is (nil? (:error-code whk')))))))
|
||||
|
||||
(t/deftest run-webhook-handler-2
|
||||
(with-mocks [http-mock {:target 'app.http.client/req! :return {:status 400}}]
|
||||
|
@ -114,6 +112,4 @@
|
|||
(let [whk' (th/db-get :webhook {:id (:id whk)})]
|
||||
(t/is (= "unexpected-status:400" (:error-code whk')))
|
||||
(t/is (= 3 (:error-count whk')))
|
||||
(t/is (false? (:is-active whk'))))
|
||||
|
||||
)))
|
||||
(t/is (false? (:is-active whk')))))))
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.http :as http]
|
||||
[app.storage :as sto]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.storage :as sto]
|
||||
[backend-tests.helpers :as th]
|
||||
[clojure.test :as t]
|
||||
[mockery.core :refer [with-mocks]]))
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[app.common.pprint :as pp]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.util.time :as dt]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.util.time :as dt]
|
||||
[backend-tests.helpers :as th]
|
||||
[clojure.test :as t]))
|
||||
|
||||
|
@ -91,8 +91,6 @@
|
|||
(t/is (= 1 (count rows)))
|
||||
(t/is (= (:id prof) (:profile-id row)))
|
||||
(t/is (= "navigate" (:name row)))
|
||||
(t/is (= "frontend" (:source row))))
|
||||
|
||||
)))
|
||||
(t/is (= "frontend" (:source row)))))))
|
||||
|
||||
|
||||
|
|
|
@ -285,6 +285,4 @@
|
|||
(t/is (th/success? out))
|
||||
|
||||
(let [threads (th/db-query :comment-thread {:file-id (:id file-1)})]
|
||||
(t/is (= 0 (count threads))))))
|
||||
|
||||
)))
|
||||
(t/is (= 0 (count threads)))))))))
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
params {::th/type :get-file
|
||||
:id (:id file1)
|
||||
::rpc/profile-id (:id profile)
|
||||
:features cfeat/supported-features
|
||||
}]
|
||||
:features cfeat/supported-features}]
|
||||
|
||||
(binding [cond/*enabled* true]
|
||||
(let [{:keys [error result] :as out} (th/command! params)]
|
||||
|
@ -46,6 +45,5 @@
|
|||
{:keys [error result]} (th/command! (assoc params ::cond/key etag))]
|
||||
(t/is (nil? error))
|
||||
(t/is (fn? result))
|
||||
(t/is (= 304 (-> (result nil) :ring.response/status))))
|
||||
))))
|
||||
(t/is (= 304 (-> (result nil) :ring.response/status))))))))
|
||||
|
||||
|
|
|
@ -124,8 +124,7 @@
|
|||
(t/is (nil? (:error out)))
|
||||
|
||||
(let [result (:result out)]
|
||||
(t/is (= 0 (count result))))))
|
||||
))
|
||||
(t/is (= 0 (count result))))))))
|
||||
|
||||
(t/deftest file-gc-with-fragments
|
||||
(letfn [(update-file! [& {:keys [profile-id file-id changes revn] :or {revn 0}}]
|
||||
|
@ -226,9 +225,7 @@
|
|||
|
||||
;; Check the number of fragments;
|
||||
(let [rows (th/db-query :file-data-fragment {:file-id (:id file)})]
|
||||
(t/is (= 2 (count rows))))
|
||||
|
||||
)))
|
||||
(t/is (= 2 (count rows)))))))
|
||||
|
||||
(t/deftest file-gc-task-with-thumbnails
|
||||
(letfn [(add-file-media-object [& {:keys [profile-id file-id]}]
|
||||
|
@ -361,8 +358,7 @@
|
|||
(t/is (nil? (sto/get-object storage (:media-id fmo2))))
|
||||
(t/is (nil? (sto/get-object storage (:thumbnail-id fmo2))))
|
||||
(t/is (nil? (sto/get-object storage (:media-id fmo1))))
|
||||
(t/is (nil? (sto/get-object storage (:thumbnail-id fmo1))))
|
||||
)))
|
||||
(t/is (nil? (sto/get-object storage (:thumbnail-id fmo1)))))))
|
||||
|
||||
(t/deftest file-gc-image-fills-and-strokes
|
||||
(letfn [(add-file-media-object [& {:keys [profile-id file-id]}]
|
||||
|
@ -414,51 +410,51 @@
|
|||
|
||||
;; Update file inserting a new image object
|
||||
(update-file!
|
||||
:file-id (:id file)
|
||||
:profile-id (:id profile)
|
||||
:revn 0
|
||||
:changes
|
||||
[{:type :add-obj
|
||||
:page-id page-id
|
||||
:id s-shid
|
||||
:parent-id uuid/zero
|
||||
:frame-id uuid/zero
|
||||
:components-v2 true
|
||||
:obj (cts/setup-shape
|
||||
{:id s-shid
|
||||
:name "image"
|
||||
:frame-id uuid/zero
|
||||
:parent-id uuid/zero
|
||||
:type :image
|
||||
:metadata {:id (:id fmo1) :width 100 :height 100 :mtype "image/jpeg"}
|
||||
:fills [{:opacity 1 :fill-image {:id (:id fmo2) :width 100 :height 100 :mtype "image/jpeg"}}]
|
||||
:strokes [{:opacity 1 :stroke-image {:id (:id fmo3) :width 100 :height 100 :mtype "image/jpeg"}}]})}
|
||||
{:type :add-obj
|
||||
:page-id page-id
|
||||
:id t-shid
|
||||
:parent-id uuid/zero
|
||||
:frame-id uuid/zero
|
||||
:components-v2 true
|
||||
:obj (cts/setup-shape
|
||||
{:id t-shid
|
||||
:name "text"
|
||||
:frame-id uuid/zero
|
||||
:parent-id uuid/zero
|
||||
:type :text
|
||||
:content {:type "root"
|
||||
:children [{:type "paragraph-set"
|
||||
:children [{:type "paragraph"
|
||||
:children [{:fills [{:fill-opacity 1
|
||||
:fill-image {:id (:id fmo4)
|
||||
:width 417
|
||||
:height 354
|
||||
:mtype "image/png"
|
||||
:name "text fill image"}}]
|
||||
:text "hi"}
|
||||
{:fills [{:fill-opacity 1
|
||||
:fill-color "#000000"}]
|
||||
:text "bye"}]}]}]}
|
||||
:strokes [{:opacity 1 :stroke-image {:id (:id fmo5) :width 100 :height 100 :mtype "image/jpeg"}}]})}])
|
||||
:file-id (:id file)
|
||||
:profile-id (:id profile)
|
||||
:revn 0
|
||||
:changes
|
||||
[{:type :add-obj
|
||||
:page-id page-id
|
||||
:id s-shid
|
||||
:parent-id uuid/zero
|
||||
:frame-id uuid/zero
|
||||
:components-v2 true
|
||||
:obj (cts/setup-shape
|
||||
{:id s-shid
|
||||
:name "image"
|
||||
:frame-id uuid/zero
|
||||
:parent-id uuid/zero
|
||||
:type :image
|
||||
:metadata {:id (:id fmo1) :width 100 :height 100 :mtype "image/jpeg"}
|
||||
:fills [{:opacity 1 :fill-image {:id (:id fmo2) :width 100 :height 100 :mtype "image/jpeg"}}]
|
||||
:strokes [{:opacity 1 :stroke-image {:id (:id fmo3) :width 100 :height 100 :mtype "image/jpeg"}}]})}
|
||||
{:type :add-obj
|
||||
:page-id page-id
|
||||
:id t-shid
|
||||
:parent-id uuid/zero
|
||||
:frame-id uuid/zero
|
||||
:components-v2 true
|
||||
:obj (cts/setup-shape
|
||||
{:id t-shid
|
||||
:name "text"
|
||||
:frame-id uuid/zero
|
||||
:parent-id uuid/zero
|
||||
:type :text
|
||||
:content {:type "root"
|
||||
:children [{:type "paragraph-set"
|
||||
:children [{:type "paragraph"
|
||||
:children [{:fills [{:fill-opacity 1
|
||||
:fill-image {:id (:id fmo4)
|
||||
:width 417
|
||||
:height 354
|
||||
:mtype "image/png"
|
||||
:name "text fill image"}}]
|
||||
:text "hi"}
|
||||
{:fills [{:fill-opacity 1
|
||||
:fill-color "#000000"}]
|
||||
:text "bye"}]}]}]}
|
||||
:strokes [{:opacity 1 :stroke-image {:id (:id fmo5) :width 100 :height 100 :mtype "image/jpeg"}}]})}])
|
||||
|
||||
;; run the file-gc task immediately without forced min-age
|
||||
(let [res (th/run-task! "file-gc")]
|
||||
|
@ -485,15 +481,15 @@
|
|||
|
||||
;; proceed to remove usage of the file
|
||||
(update-file!
|
||||
:file-id (:id file)
|
||||
:profile-id (:id profile)
|
||||
:revn 0
|
||||
:changes [{:type :del-obj
|
||||
:page-id (first (get-in file [:data :pages]))
|
||||
:id s-shid}
|
||||
{:type :del-obj
|
||||
:page-id (first (get-in file [:data :pages]))
|
||||
:id t-shid}])
|
||||
:file-id (:id file)
|
||||
:profile-id (:id profile)
|
||||
:revn 0
|
||||
:changes [{:type :del-obj
|
||||
:page-id (first (get-in file [:data :pages]))
|
||||
:id s-shid}
|
||||
{:type :del-obj
|
||||
:page-id (first (get-in file [:data :pages]))
|
||||
:id t-shid}])
|
||||
|
||||
;; Now, we have deleted the usage of pointers to the
|
||||
;; file-media-objects, if we paste file-gc, they should be marked
|
||||
|
@ -572,8 +568,7 @@
|
|||
fot-2 (insert-file-object-thumbnail! :profile-id (:id profile)
|
||||
:page-id page-id
|
||||
:file-id file-id
|
||||
:frame-id frame-id-2)
|
||||
]
|
||||
:frame-id frame-id-2)]
|
||||
|
||||
;; Add a two frames
|
||||
|
||||
|
@ -700,9 +695,7 @@
|
|||
;; check file media objects
|
||||
(let [rows (th/db-exec! ["select * from storage_object where deleted_at is null"])]
|
||||
;; (pp/pprint rows)
|
||||
(t/is (= 0 (count rows))))
|
||||
|
||||
)))
|
||||
(t/is (= 0 (count rows)))))))
|
||||
|
||||
|
||||
|
||||
|
@ -792,8 +785,8 @@
|
|||
error (:error out)]
|
||||
|
||||
;; (th/print-result! out)
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (th/ex-of-type? error :not-found))))
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (th/ex-of-type? error :not-found))))
|
||||
|
||||
(t/deftest permissions-checks-link-to-library-2
|
||||
(let [profile1 (th/create-profile* 1)
|
||||
|
@ -814,8 +807,8 @@
|
|||
error (:error out)]
|
||||
|
||||
;; (th/print-result! out)
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (th/ex-of-type? error :not-found))))
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (th/ex-of-type? error :not-found))))
|
||||
|
||||
(t/deftest deletion
|
||||
(let [task (:app.tasks.objects-gc/handler th/*system*)
|
||||
|
@ -881,8 +874,7 @@
|
|||
(let [error (:error out)
|
||||
error-data (ex-data error)]
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (= (:type error-data) :not-found))))
|
||||
))
|
||||
(t/is (= (:type error-data) :not-found))))))
|
||||
|
||||
|
||||
(t/deftest object-thumbnails-ops
|
||||
|
@ -906,15 +898,15 @@
|
|||
:use-for-thumbnail? true
|
||||
:name "test-frame1"
|
||||
:type :frame})}
|
||||
{:type :add-obj
|
||||
:page-id page-id
|
||||
:id shape1-id
|
||||
:parent-id frame1-id
|
||||
:frame-id frame1-id
|
||||
:obj (cts/setup-shape
|
||||
{:id shape1-id
|
||||
:name "test-shape1"
|
||||
:type :rect})}
|
||||
{:type :add-obj
|
||||
:page-id page-id
|
||||
:id shape1-id
|
||||
:parent-id frame1-id
|
||||
:frame-id frame1-id
|
||||
:obj (cts/setup-shape
|
||||
{:id shape1-id
|
||||
:name "test-shape1"
|
||||
:type :rect})}
|
||||
{:type :add-obj
|
||||
:page-id page-id
|
||||
:id frame2-id
|
||||
|
@ -957,8 +949,7 @@
|
|||
(t/is (contains? (:objects result) shape1-id))
|
||||
(t/is (contains? (:objects result) frame2-id))
|
||||
(t/is (contains? (:objects result) shape2-id))
|
||||
(t/is (contains? (:objects result) uuid/zero))
|
||||
)
|
||||
(t/is (contains? (:objects result) uuid/zero)))
|
||||
|
||||
;; Query :page RPC method with page-id
|
||||
(let [data {::th/type :get-page
|
||||
|
@ -1006,9 +997,7 @@
|
|||
(t/is (not (th/success? out)))
|
||||
(let [{:keys [type code]} (-> out :error ex-data)]
|
||||
(t/is (= :validation type))
|
||||
(t/is (= :params-validation code))))
|
||||
|
||||
)
|
||||
(t/is (= :params-validation code)))))
|
||||
|
||||
(t/testing "RPC :file-data-for-thumbnail"
|
||||
;; Insert a thumbnail data for the frame-id
|
||||
|
@ -1120,9 +1109,7 @@
|
|||
|
||||
;; check that the unknown frame thumbnail is deleted
|
||||
(let [res (th/db-exec! ["select * from file_tagged_object_thumbnail"])]
|
||||
(t/is (= 1 (count res)))))
|
||||
|
||||
))
|
||||
(t/is (= 1 (count res)))))))
|
||||
|
||||
|
||||
(t/deftest file-thumbnail-ops
|
||||
|
@ -1163,9 +1150,7 @@
|
|||
(t/is (map? result)))
|
||||
|
||||
(let [rows (th/db-query :file-thumbnail {:file-id (:id file)})]
|
||||
(t/is (= 2 (count rows))))
|
||||
|
||||
)
|
||||
(t/is (= 2 (count rows)))))
|
||||
|
||||
(t/testing "gc task"
|
||||
;; make the file eligible for GC waiting 300ms (configured
|
||||
|
@ -1176,7 +1161,6 @@
|
|||
(t/is (= 1 (:processed res))))
|
||||
|
||||
(let [rows (th/db-query :file-thumbnail {:file-id (:id file)})]
|
||||
(t/is (= 1 (count rows)))))
|
||||
))
|
||||
(t/is (= 1 (count rows)))))))
|
||||
|
||||
|
||||
|
|
|
@ -149,9 +149,7 @@
|
|||
|
||||
;; check that storage object is still exists but is marked as deleted
|
||||
(let [row (th/db-get :storage-object {:id (:media-id row1)} {::db/remove-deleted? false})]
|
||||
(t/is (nil? row)))
|
||||
|
||||
)))
|
||||
(t/is (nil? row))))))
|
||||
|
||||
(t/deftest create-file-thumbnail
|
||||
(let [storage (::sto/storage th/*system*)
|
||||
|
@ -241,10 +239,7 @@
|
|||
(let [result (th/run-task! :storage-gc-deleted {:min-age (dt/duration 0)})]
|
||||
(t/is (= 1 (:deleted result))))
|
||||
|
||||
(t/is (some? (sto/get-object storage (:media-id row2)))))
|
||||
|
||||
|
||||
))
|
||||
(t/is (some? (sto/get-object storage (:media-id row2)))))))
|
||||
|
||||
(t/deftest get-file-object-thumbnail
|
||||
(let [storage (::sto/storage th/*system*)
|
||||
|
@ -254,21 +249,21 @@
|
|||
:is-shared false})
|
||||
|
||||
data {::th/type :create-file-object-thumbnail
|
||||
::rpc/profile-id (:id profile)
|
||||
:file-id (:id file)
|
||||
:object-id "test-key-2"
|
||||
:media {:filename "sample.jpg"
|
||||
:size 7923
|
||||
:path (th/tempfile "backend_tests/test_files/sample2.jpg")
|
||||
:mtype "image/jpeg"}}]
|
||||
::rpc/profile-id (:id profile)
|
||||
:file-id (:id file)
|
||||
:object-id "test-key-2"
|
||||
:media {:filename "sample.jpg"
|
||||
:size 7923
|
||||
:path (th/tempfile "backend_tests/test_files/sample2.jpg")
|
||||
:mtype "image/jpeg"}}]
|
||||
|
||||
(let [out (th/command! data)]
|
||||
(t/is (nil? (:error out)))
|
||||
(t/is (map? (:result out))))
|
||||
|
||||
(let [[row :as rows] (th/db-query :file-tagged-object-thumbnail
|
||||
{:file-id (:id file)}
|
||||
{:order-by [[:created-at :asc]]})]
|
||||
{:file-id (:id file)}
|
||||
{:order-by [[:created-at :asc]]})]
|
||||
(t/is (= 1 (count rows)))
|
||||
|
||||
(t/is (= (:file-id data) (:file-id row)))
|
||||
|
|
|
@ -91,9 +91,7 @@
|
|||
|
||||
;; Check the total number of files
|
||||
(let [rows (db/query th/*pool* :file {:project-id (:id project)})]
|
||||
(t/is (= 3 (count rows))))
|
||||
|
||||
))))
|
||||
(t/is (= 3 (count rows))))))))
|
||||
|
||||
(t/deftest duplicate-file-with-deleted-relations
|
||||
(let [storage (-> (:app.storage/storage th/*system*)
|
||||
|
@ -149,9 +147,7 @@
|
|||
|
||||
;; Check the total number of files
|
||||
(let [rows (db/query th/*pool* :file {:project-id (:id project)})]
|
||||
(t/is (= 3 (count rows))))
|
||||
|
||||
))))
|
||||
(t/is (= 3 (count rows))))))))
|
||||
|
||||
(t/deftest duplicate-project
|
||||
(let [storage (-> (:app.storage/storage th/*system*)
|
||||
|
@ -223,9 +219,7 @@
|
|||
|
||||
(when (= (:id fa) (:id file2))
|
||||
(t/is (false? (b/equals? (:data fa)
|
||||
(:data fb))))))
|
||||
|
||||
)))))
|
||||
(:data fb)))))))))))
|
||||
|
||||
(t/deftest duplicate-project-with-deleted-files
|
||||
(let [storage (-> (:app.storage/storage th/*system*)
|
||||
|
@ -289,9 +283,7 @@
|
|||
|
||||
(when (= (:id fa) (:id file2))
|
||||
(t/is (false? (b/equals? (:data fa)
|
||||
(:data fb))))))
|
||||
|
||||
)))))
|
||||
(:data fb)))))))))))
|
||||
|
||||
(t/deftest move-file-on-same-team
|
||||
(let [profile (th/create-profile* 1 {:is-active true})
|
||||
|
@ -359,8 +351,7 @@
|
|||
|
||||
;; should be no libraries on file2
|
||||
(let [rows (db/query th/*pool* :file-library-rel {:file-id (:id file2)})]
|
||||
(t/is (= 0 (count rows))))
|
||||
)))
|
||||
(t/is (= 0 (count rows)))))))
|
||||
|
||||
|
||||
;; TODO: move a library to other team
|
||||
|
@ -445,8 +436,7 @@
|
|||
(let [[item :as rows] (db/query th/*pool* :file-library-rel {:file-id (:id file2)})]
|
||||
(t/is (= 1 (count rows)))
|
||||
(t/is (= (:file-id item) (:id file2)))
|
||||
(t/is (= (:library-file-id item) (:id file3))))
|
||||
)))
|
||||
(t/is (= (:library-file-id item) (:id file3)))))))
|
||||
|
||||
|
||||
(t/deftest move-library-to-other-team
|
||||
|
@ -515,9 +505,7 @@
|
|||
|
||||
;; the file2 should not have any link to libraries
|
||||
(let [rows (db/query th/*pool* :file-library-rel {:file-id (:id file2)})]
|
||||
(t/is (zero? (count rows))))
|
||||
|
||||
)))
|
||||
(t/is (zero? (count rows)))))))
|
||||
|
||||
(t/deftest move-project
|
||||
(let [profile (th/create-profile* 1 {:is-active true})
|
||||
|
@ -602,9 +590,7 @@
|
|||
{:order-by [:created-at]})]
|
||||
(t/is (= 1 (count rows)))
|
||||
(t/is (= (:file-id item1) (:id file1)))
|
||||
(t/is (= (:library-file-id item1) (:id file2))))
|
||||
|
||||
)))
|
||||
(t/is (= (:library-file-id item1) (:id file2)))))))
|
||||
|
||||
(t/deftest clone-template
|
||||
(let [prof (th/create-profile* 1 {:is-active true})
|
||||
|
|
|
@ -88,8 +88,7 @@
|
|||
(t/is (sto/object? mobj1))
|
||||
(t/is (sto/object? mobj2))
|
||||
(t/is (= 312043 (:size mobj1)))
|
||||
(t/is (= 3887 (:size mobj2)))))
|
||||
))
|
||||
(t/is (= 3887 (:size mobj2)))))))
|
||||
|
||||
|
||||
(t/deftest media-object-upload-idempotency
|
||||
|
@ -208,8 +207,7 @@
|
|||
(t/is (sto/object? mobj1))
|
||||
(t/is (sto/object? mobj2))
|
||||
(t/is (= 312043 (:size mobj1)))
|
||||
(t/is (= 3887 (:size mobj2)))))
|
||||
))
|
||||
(t/is (= 3887 (:size mobj2)))))))
|
||||
|
||||
|
||||
(t/deftest media-object-upload-idempotency-command
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
(ns backend-tests.rpc-profile-test
|
||||
(:require
|
||||
[app.auth :as auth]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cf]
|
||||
[app.db :as db]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.auth :as auth]
|
||||
[app.tokens :as tokens]
|
||||
[app.util.time :as dt]
|
||||
[backend-tests.helpers :as th]
|
||||
|
@ -115,8 +115,7 @@
|
|||
out (th/command! data)]
|
||||
|
||||
;; (th/print-result! out)
|
||||
(t/is (nil? (:error out)))))
|
||||
))
|
||||
(t/is (nil? (:error out)))))))
|
||||
|
||||
(t/deftest profile-deletion-simple
|
||||
(let [prof (th/create-profile* 1)
|
||||
|
@ -219,9 +218,7 @@
|
|||
(let [rows (th/db-query :team-profile-rel {:team-id (:id team)})]
|
||||
(t/is (= 1 (count rows)))
|
||||
(t/is (= (:id prof2) (get-in rows [0 :profile-id])))
|
||||
(t/is (= false (get-in rows [0 :is-owner]))))
|
||||
|
||||
))
|
||||
(t/is (= false (get-in rows [0 :is-owner]))))))
|
||||
|
||||
(t/deftest registration-domain-whitelist
|
||||
(let [whitelist #{"gmail.com" "hey.com" "ya.ru"}]
|
||||
|
@ -258,8 +255,7 @@
|
|||
:accept-terms-and-privacy true
|
||||
:accept-newsletter-subscription true}]
|
||||
(let [{:keys [result error]} (th/command! data)]
|
||||
(t/is (nil? error))))
|
||||
))
|
||||
(t/is (nil? error))))))
|
||||
|
||||
(t/deftest prepare-register-and-register-profile-1
|
||||
(let [data {::th/type :prepare-register-profile
|
||||
|
@ -288,8 +284,7 @@
|
|||
:accept-newsletter-subscription true}]
|
||||
(let [{:keys [result error] :as out} (th/command! data)]
|
||||
;; (th/print-result! out)
|
||||
(t/is (nil? error))))
|
||||
))
|
||||
(t/is (nil? error))))))
|
||||
|
||||
(t/deftest prepare-register-and-register-profile-2
|
||||
(with-redefs [app.rpc.commands.auth/register-retry-threshold (dt/duration 500)]
|
||||
|
@ -350,10 +345,7 @@
|
|||
:accept-newsletter-subscription true}
|
||||
out (th/command! data)]
|
||||
(t/is (th/success? out))
|
||||
(t/is (= 1 (:call-count @mock))))
|
||||
|
||||
))
|
||||
))
|
||||
(t/is (= 1 (:call-count @mock))))))))
|
||||
|
||||
|
||||
(t/deftest prepare-and-register-with-invitation-and-disabled-registration-1
|
||||
|
@ -405,8 +397,7 @@
|
|||
(t/is (not (th/success? out)))
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :restriction (:type edata)))
|
||||
(t/is (= :email-does-not-match-invitation (:code edata))))
|
||||
)))
|
||||
(t/is (= :email-does-not-match-invitation (:code edata)))))))
|
||||
|
||||
(t/deftest prepare-register-with-registration-disabled
|
||||
(with-redefs [app.config/flags #{}]
|
||||
|
@ -427,10 +418,10 @@
|
|||
:password "foobar"}
|
||||
out (th/command! data)]
|
||||
|
||||
(t/is (not (th/success? out)))
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :validation (:type edata)))
|
||||
(t/is (= :email-already-exists (:code edata))))))
|
||||
(t/is (not (th/success? out)))
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :validation (:type edata)))
|
||||
(t/is (= :email-already-exists (:code edata))))))
|
||||
|
||||
(t/deftest register-profile-with-bounced-email
|
||||
(let [pool (:app.db/pool th/*system*)
|
||||
|
@ -566,9 +557,7 @@
|
|||
(t/is (= 2 (:call-count @mock)))
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (th/ex-of-type? error :validation))
|
||||
(t/is (th/ex-of-code? error :email-has-permanent-bounces)))
|
||||
|
||||
)))
|
||||
(t/is (th/ex-of-code? error :email-has-permanent-bounces))))))
|
||||
|
||||
|
||||
(t/deftest update-profile-password
|
||||
|
@ -579,8 +568,7 @@
|
|||
:password "foobarfoobar"}
|
||||
out (th/command! data)]
|
||||
(t/is (nil? (:error out)))
|
||||
(t/is (nil? (:result out)))
|
||||
))
|
||||
(t/is (nil? (:result out)))))
|
||||
|
||||
|
||||
(t/deftest update-profile-password-bad-old-password
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
(ns backend-tests.rpc-project-test
|
||||
(:require
|
||||
[backend-tests.helpers :as th]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.http :as http]
|
||||
[app.rpc :as-alias rpc]
|
||||
[app.util.time :as dt]
|
||||
[backend-tests.helpers :as th]
|
||||
[clojure.test :as t]))
|
||||
|
||||
(t/use-fixtures :once th/state-init)
|
||||
|
@ -104,8 +104,7 @@
|
|||
;; (th/print-result! out)
|
||||
(t/is (nil? (:error out)))
|
||||
(let [result (:result out)]
|
||||
(t/is (= 1 (count result)))))
|
||||
))
|
||||
(t/is (= 1 (count result)))))))
|
||||
|
||||
(t/deftest permissions-checks-create-project
|
||||
(let [profile1 (th/create-profile* 1)
|
||||
|
@ -237,5 +236,4 @@
|
|||
(let [error (:error out)
|
||||
error-data (ex-data error)]
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (= (:type error-data) :not-found))))
|
||||
))
|
||||
(t/is (= (:type error-data) :not-found))))))
|
||||
|
|
|
@ -123,9 +123,7 @@
|
|||
:quote 5})
|
||||
|
||||
(check-ok! 4)
|
||||
(check-ko! 5)
|
||||
|
||||
)))
|
||||
(check-ko! 5))))
|
||||
|
||||
(t/deftest invitations-per-team-quote
|
||||
(with-mocks [mock {:target 'app.config/get
|
||||
|
@ -268,7 +266,7 @@
|
|||
:team-id (:default-team-id profile-2)})
|
||||
data {::th/type :create-file
|
||||
::rpc/profile-id (:id profile-1)
|
||||
:project-id (:id project-1)}
|
||||
:project-id (:id project-1)}
|
||||
check-ok! (fn [n]
|
||||
(let [data (assoc data :name (str "file" n))
|
||||
out (th/command! data)]
|
||||
|
@ -339,6 +337,4 @@
|
|||
:quote 4})
|
||||
|
||||
(check-ok! 4)
|
||||
(check-ko! 5)
|
||||
|
||||
)))
|
||||
(check-ko! 5))))
|
||||
|
|
|
@ -100,9 +100,7 @@
|
|||
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :validation (:type edata)))
|
||||
(t/is (= :member-is-muted (:code edata)))))
|
||||
|
||||
)))
|
||||
(t/is (= :member-is-muted (:code edata))))))))
|
||||
|
||||
|
||||
(t/deftest invitation-tokens
|
||||
|
@ -159,9 +157,7 @@
|
|||
(t/is (= :editor (:role claims)))
|
||||
(t/is (= (:id team) (:team-id claims)))
|
||||
(t/is (= (first (:emails data)) (:member-email claims)))
|
||||
(t/is (= (:id profile2) (:member-id claims)))))
|
||||
|
||||
)))
|
||||
(t/is (= (:id profile2) (:member-id claims))))))))
|
||||
|
||||
|
||||
(t/deftest accept-invitation-tokens
|
||||
|
@ -243,9 +239,7 @@
|
|||
(t/is (not (th/success? out)))
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :validation (:type edata)))
|
||||
(t/is (= :invalid-token (:code edata))))))
|
||||
|
||||
)))
|
||||
(t/is (= :invalid-token (:code edata)))))))))
|
||||
|
||||
(t/deftest create-team-invitations-with-email-verification-disabled
|
||||
(with-mocks [mock {:target 'app.email/send! :return nil}]
|
||||
|
@ -343,8 +337,7 @@
|
|||
|
||||
(t/is (not (th/success? out)))
|
||||
(let [edata (-> out :error ex-data)]
|
||||
(t/is (= :not-found (:type edata)))))
|
||||
))
|
||||
(t/is (= :not-found (:type edata)))))))
|
||||
|
||||
(t/deftest query-team-invitations
|
||||
(let [prof (th/create-profile* 1 {:is-active true})
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
(ns backend-tests.rpc-viewer-test
|
||||
(:require
|
||||
[backend-tests.helpers :as th]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.db :as db]
|
||||
[app.rpc :as-alias rpc]
|
||||
[backend-tests.helpers :as th]
|
||||
[clojure.test :as t]
|
||||
[datoteka.core :as fs]))
|
||||
|
||||
|
@ -104,6 +104,4 @@
|
|||
(t/is (nil? (:error out)))
|
||||
(let [result (:result out)]
|
||||
(t/is (contains? result :file))
|
||||
(t/is (contains? result :project)))))
|
||||
|
||||
))
|
||||
(t/is (contains? result :project)))))))
|
||||
|
|
|
@ -140,9 +140,7 @@
|
|||
error-data (ex-data error)]
|
||||
(t/is (th/ex-info? error))
|
||||
(t/is (= (:type error-data) :not-found))
|
||||
(t/is (= (:code error-data) :object-not-found)))))
|
||||
|
||||
)))
|
||||
(t/is (= (:code error-data) :object-not-found))))))))
|
||||
|
||||
(t/deftest webhooks-quotes
|
||||
(with-mocks [http-mock {:target 'app.http.client/req!
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
(t/is (= "data" (:other (meta object))))
|
||||
(t/is (= "text/plain" (:content-type (meta object))))
|
||||
(t/is (= "content" (slurp (sto/get-object-data storage object))))
|
||||
(t/is (= "content" (slurp (sto/get-object-path storage object))))
|
||||
))
|
||||
(t/is (= "content" (slurp (sto/get-object-path storage object))))))
|
||||
|
||||
(t/deftest put-and-retrieve-expired-object
|
||||
(let [storage (-> (:app.storage/storage th/*system*)
|
||||
|
@ -59,8 +58,7 @@
|
|||
content (sto/content "content")
|
||||
object (sto/put-object! storage {::sto/content content
|
||||
::sto/expired-at (dt/in-future {:seconds 1})
|
||||
:content-type "text/plain"
|
||||
})]
|
||||
:content-type "text/plain"})]
|
||||
|
||||
(t/is (sto/object? object))
|
||||
(t/is (dt/instant? (:expired-at object)))
|
||||
|
@ -71,8 +69,7 @@
|
|||
(t/is (nil? (sto/get-object storage (:id object))))
|
||||
(t/is (nil? (sto/get-object-data storage object)))
|
||||
(t/is (nil? (sto/get-object-url storage object)))
|
||||
(t/is (nil? (sto/get-object-path storage object)))
|
||||
))
|
||||
(t/is (nil? (sto/get-object-path storage object)))))
|
||||
|
||||
(t/deftest put-and-delete-object
|
||||
(let [storage (-> (:app.storage/storage th/*system*)
|
||||
|
@ -92,8 +89,7 @@
|
|||
|
||||
;; But you can't retrieve the object again because in database is
|
||||
;; marked as deleted/expired.
|
||||
(t/is (nil? (sto/get-object storage (:id object))))
|
||||
))
|
||||
(t/is (nil? (sto/get-object storage (:id object))))))
|
||||
|
||||
(t/deftest test-deleted-gc-task
|
||||
(let [storage (-> (:app.storage/storage th/*system*)
|
||||
|
@ -103,16 +99,13 @@
|
|||
content3 (sto/content "content3")
|
||||
object1 (sto/put-object! storage {::sto/content content1
|
||||
::sto/expired-at (dt/now)
|
||||
:content-type "text/plain"
|
||||
})
|
||||
:content-type "text/plain"})
|
||||
object2 (sto/put-object! storage {::sto/content content2
|
||||
::sto/expired-at (dt/in-past {:hours 2})
|
||||
:content-type "text/plain"
|
||||
})
|
||||
:content-type "text/plain"})
|
||||
object3 (sto/put-object! storage {::sto/content content3
|
||||
::sto/expired-at (dt/in-past {:hours 1})
|
||||
:content-type "text/plain"
|
||||
})]
|
||||
:content-type "text/plain"})]
|
||||
|
||||
|
||||
(th/sleep 200)
|
||||
|
@ -186,8 +179,7 @@
|
|||
|
||||
;; now check that all objects are marked to be deleted
|
||||
(let [res (db/exec-one! th/*pool* ["select count(*) from storage_object where deleted_at is not null"])]
|
||||
(t/is (= 0 (:count res))))
|
||||
)))
|
||||
(t/is (= 0 (:count res)))))))
|
||||
|
||||
|
||||
(t/deftest test-touched-gc-task-2
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
(ns backend-tests.tasks-telemetry-test
|
||||
(:require
|
||||
[backend-tests.helpers :as th]
|
||||
[app.db :as db]
|
||||
[app.util.time :as dt]
|
||||
[backend-tests.helpers :as th]
|
||||
[clojure.pprint :refer [pprint]]
|
||||
[clojure.test :as t]
|
||||
[mockery.core :refer [with-mocks]]))
|
||||
|
|
|
@ -60,9 +60,7 @@
|
|||
|
||||
(t/testing "error on non-uuid keys"
|
||||
(let [obj (omap/wrap {})]
|
||||
(t/is (thrown? IllegalArgumentException (assoc obj :foo "bar")))))
|
||||
|
||||
)
|
||||
(t/is (thrown? IllegalArgumentException (assoc obj :foo "bar"))))))
|
||||
|
||||
(t/deftest internal-operation
|
||||
(t/testing "modified & compact"
|
||||
|
@ -83,8 +81,7 @@
|
|||
(t/is (= (get obj1 id1) (get obj2 id1)))
|
||||
(t/is (= (get obj1 id2) (get obj2 id2)))
|
||||
(t/is (= (count obj1) (count obj2)))
|
||||
(t/is (= (hash obj1) (hash obj2)))))
|
||||
)
|
||||
(t/is (= (hash obj1) (hash obj2))))))
|
||||
|
||||
(t/deftest internal-encode-decode
|
||||
(sg/check!
|
||||
|
@ -95,11 +92,11 @@
|
|||
obj3 (assoc obj2 uuid/zero 1)
|
||||
obj4 (omap/create (deref obj3))]
|
||||
;; (app.common.pprint/pprint data)
|
||||
(t/is (= (hash obj1) (hash obj2)))
|
||||
(t/is (not= (hash obj2) (hash obj3)))
|
||||
(t/is (bytes? (deref obj3)))
|
||||
(t/is (pos? (alength (deref obj3))))
|
||||
(t/is (= (hash obj3) (hash obj4)))))))
|
||||
(t/is (= (hash obj1) (hash obj2)))
|
||||
(t/is (not= (hash obj2) (hash obj3)))
|
||||
(t/is (bytes? (deref obj3)))
|
||||
(t/is (pos? (alength (deref obj3))))
|
||||
(t/is (= (hash obj3) (hash obj4)))))))
|
||||
|
||||
(t/deftest fressian-encode-decode
|
||||
(sg/check!
|
||||
|
|
|
@ -55,8 +55,7 @@
|
|||
(t/is (pmap/pointer-map? obj2))
|
||||
(t/is (identical? tmp obj2))
|
||||
(t/is (= 0 (count obj1)))
|
||||
(t/is (= 0 (count obj2)))))
|
||||
)
|
||||
(t/is (= 0 (count obj2))))))
|
||||
|
||||
|
||||
(t/deftest internal-tracking
|
||||
|
@ -118,7 +117,5 @@
|
|||
(t/is (not (contains? obj1 :b)))
|
||||
(t/is (= 1 (get obj1 :a)))
|
||||
(t/is (= nil (get obj1 :b)))
|
||||
(t/is (= ::empty (get obj1 :b ::empty))))))
|
||||
|
||||
)
|
||||
(t/is (= ::empty (get obj1 :b ::empty)))))))
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
(defn create-cookies
|
||||
[uri {:keys [name token] :or {name "auth-token"}}]
|
||||
(let [domain (str (:host uri)
|
||||
(when (:port uri)
|
||||
(str ":" (:port uri))))]
|
||||
(when (:port uri)
|
||||
(str ":" (:port uri))))]
|
||||
#js [#js {:domain domain
|
||||
:path "/"
|
||||
:name name
|
||||
|
@ -177,8 +177,7 @@
|
|||
(p/catch (fn [cause]
|
||||
(p/do!
|
||||
(ex-ignore (.destroy ^js pool browser))
|
||||
(p/rejected cause))))))
|
||||
]
|
||||
(p/rejected cause))))))]
|
||||
|
||||
(when-let [pool (deref pool)]
|
||||
(-> (p/do! (.acquire ^js pool))
|
||||
|
|
|
@ -203,10 +203,10 @@
|
|||
:name (:name entry)
|
||||
:suffix (:suffix entry)})]
|
||||
|
||||
(let [xform (comp
|
||||
(map #(assoc % :token token))
|
||||
(assoc-file-name))]
|
||||
(->> (sequence xform exports)
|
||||
(d/group-by (juxt :scale :type))
|
||||
(map second)
|
||||
(into [] (mapcat process-group))))))
|
||||
(let [xform (comp
|
||||
(map #(assoc % :token token))
|
||||
(assoc-file-name))]
|
||||
(->> (sequence xform exports)
|
||||
(d/group-by (juxt :scale :type))
|
||||
(map second)
|
||||
(into [] (mapcat process-group))))))
|
||||
|
|
|
@ -174,8 +174,7 @@
|
|||
{"type" "element"
|
||||
"name" "radialGradient"
|
||||
"attributes" {"id" id "cx" "0.5" "cy" "0.5" "r" "0.5"}
|
||||
"elements" (get-stops data)}
|
||||
)))
|
||||
"elements" (get-stops data)})))
|
||||
|
||||
(get-gradients [id mapping]
|
||||
(->> mapping
|
||||
|
|
Loading…
Add table
Reference in a new issue