♻️ Make the namespacing independent of the branding.

This commit is contained in:
Andrey Antukh 2020-08-18 19:26:37 +02:00
parent aaf8b71837
commit 6c67c3c71b
305 changed files with 2399 additions and 2580 deletions

View file

@ -80,11 +80,11 @@
:args {}} :args {}}
:fn-media-loader :fn-media-loader
{:fn uxbox.cli.media-loader/run {:fn app.cli.media-loader/run
:args {}} :args {}}
:fn-fixtures :fn-fixtures
{:fn uxbox.cli.fixtures/run {:fn app.cli.fixtures/run
:args {}} :args {}}
:lint :lint

View file

@ -30,11 +30,11 @@
<Logger name="io.lettuce" level="error" additivity="false" /> <Logger name="io.lettuce" level="error" additivity="false" />
<Logger name="uxbox.cli" level="debug" additivity="false"> <Logger name="app.cli" level="debug" additivity="false">
<AppenderRef ref="console"/> <AppenderRef ref="console"/>
</Logger> </Logger>
<Logger name="uxbox" level="debug" additivity="false"> <Logger name="app" level="debug" additivity="false">
<AppenderRef ref="file-debug" level="debug" /> <AppenderRef ref="file-debug" level="debug" />
<AppenderRef ref="file" level="info" /> <AppenderRef ref="file" level="info" />
</Logger> </Logger>

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clojure -Adev -m uxbox.cli.collimp $@ clojure -Adev -m app.cli.collimp $@

View file

@ -1,2 +1,2 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PGPASSWORD=$UXBOX_DATABASE_PASSWORD psql $UXBOX_DATABASE_URI -U $UXBOX_DATABASE_USERNAME PGPASSWORD=$app_DATABASE_PASSWORD psql $app_DATABASE_URI -U $app_DATABASE_USERNAME

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -xe set -xe
clojure -Adev -m uxbox.tests.main; clojure -Adev -m app.tests.main;

View file

@ -4,10 +4,10 @@ set -e
if [ ! -e ~/local/.fixtures-loaded ]; then if [ ! -e ~/local/.fixtures-loaded ]; then
echo "Loading fixtures..." echo "Loading fixtures..."
clojure -Adev -m uxbox.fixtures clojure -Adev -m app.fixtures
touch ~/local/.fixtures-loaded touch ~/local/.fixtures-loaded
fi fi
clojure -m uxbox.main clojure -m app.main

View file

@ -2,4 +2,4 @@
set -e set -e
clojure -O:jmx-remote -A:dev -J-Xms100m -J-Xmx100m -J-XX:+AlwaysPreTouch -J-XX:+UseBiasedLocking -J-Duxbox.enable-asserts=false -J-Dclojure.compiler.direct-linking=true -J-Dclojure.server.repl='{:port 5555 :accept clojure.core.server/repl}' -m uxbox.main clojure -O:jmx-remote -A:dev -J-Xms100m -J-Xmx100m -J-XX:+AlwaysPreTouch -J-XX:+UseBiasedLocking -J-Dapp.enable-asserts=false -J-Dclojure.compiler.direct-linking=true -J-Dclojure.server.repl='{:port 5555 :accept clojure.core.server/repl}' -m app.main

View file

@ -7,20 +7,20 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.cli.fixtures (ns app.cli.fixtures
"A initial fixtures." "A initial fixtures."
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[mount.core :as mount] [mount.core :as mount]
[sodi.pwhash :as pwhash] [sodi.pwhash :as pwhash]
[uxbox.common.data :as d] [app.common.data :as d]
[uxbox.common.pages :as cp] [app.common.pages :as cp]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.migrations] [app.migrations]
[uxbox.services.mutations.profile :as profile] [app.services.mutations.profile :as profile]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
(defn- mk-uuid (defn- mk-uuid
[prefix & args] [prefix & args]
@ -86,7 +86,7 @@
:fullname (str "Profile " index) :fullname (str "Profile " index)
:password "123123" :password "123123"
:demo? true :demo? true
:email (str "profile" index ".test@uxbox.io")}))) :email (str "profile" index ".test@app.io")})))
create-profiles create-profiles
(fn [conn] (fn [conn]
@ -264,9 +264,9 @@
[{:keys [preset] [{:keys [preset]
:or {preset :small}}] :or {preset :small}}]
(try (try
(-> (mount/only #{#'uxbox.config/config (-> (mount/only #{#'app.config/config
#'uxbox.db/pool #'app.db/pool
#'uxbox.migrations/migrations}) #'app.migrations/migrations})
(mount/start)) (mount/start))
(run* preset) (run* preset)
(catch Exception e (catch Exception e

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.cli.media-loader (ns app.cli.media-loader
"Media libraries importer (command line helper)." "Media libraries importer (command line helper)."
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
@ -15,17 +15,17 @@
[clojure.java.io :as io] [clojure.java.io :as io]
[mount.core :as mount] [mount.core :as mount]
[datoteka.core :as fs] [datoteka.core :as fs]
[uxbox.config] [app.config]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.media] [app.media]
[uxbox.media-storage] [app.media-storage]
[uxbox.migrations] [app.migrations]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.services.mutations.projects :as projects] [app.services.mutations.projects :as projects]
[uxbox.services.mutations.files :as files] [app.services.mutations.files :as files]
[uxbox.services.mutations.colors :as colors] [app.services.mutations.colors :as colors]
[uxbox.services.mutations.media :as media]) [app.services.mutations.media :as media])
(:import (:import
java.io.PushbackReader)) java.io.PushbackReader))
@ -219,11 +219,11 @@
(let [path (validate-path path)] (let [path (validate-path path)]
(try (try
(-> (mount/only #{#'uxbox.config/config (-> (mount/only #{#'app.config/config
#'uxbox.db/pool #'app.db/pool
#'uxbox.migrations/migrations #'app.migrations/migrations
#'uxbox.media/semaphore #'app.media/semaphore
#'uxbox.media-storage/media-storage}) #'app.media-storage/media-storage})
(mount/start)) (mount/start))
(run* path) (run* path)
(catch Exception e (catch Exception e

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.config (ns app.config
"A configuration management." "A configuration management."
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
@ -15,16 +15,16 @@
[cuerdas.core :as str] [cuerdas.core :as str]
[environ.core :refer [env]] [environ.core :refer [env]]
[mount.core :refer [defstate]] [mount.core :refer [defstate]]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.util.time :as dt])) [app.util.time :as dt]))
(def defaults (def defaults
{:http-server-port 6060 {:http-server-port 6060
:http-server-cors "http://localhost:3449" :http-server-cors "http://localhost:3449"
:database-uri "postgresql://127.0.0.1/uxbox" :database-uri "postgresql://127.0.0.1/app"
:database-username "uxbox" :database-username "app"
:database-password "uxbox" :database-password "app"
:media-directory "resources/public/media" :media-directory "resources/public/media"
:assets-directory "resources/public/static" :assets-directory "resources/public/static"
@ -161,7 +161,10 @@
(fn [acc k v] (fn [acc k v]
(cond-> acc (cond-> acc
(str/starts-with? (name k) "uxbox-") (str/starts-with? (name k) "uxbox-")
(assoc (keyword (subs (name k) 6)) v))) (assoc (keyword (subs (name k) 6)) v)
(str/starts-with? (name k) "app-")
(assoc (keyword (subs (name k) 4)) v)))
{} {}
env)) env))
@ -175,9 +178,9 @@
[env] [env]
(assoc (read-config env) (assoc (read-config env)
:redis-uri "redis://redis/1" :redis-uri "redis://redis/1"
:database-uri "postgresql://postgres/uxbox_test" :database-uri "postgresql://postgres/app_test"
:media-directory "/tmp/uxbox/media" :media-directory "/tmp/app/media"
:assets-directory "/tmp/uxbox/static" :assets-directory "/tmp/app/static"
:migrations-verbose false)) :migrations-verbose false))
(defstate config (defstate config

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.db (ns app.db
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.data.json :as json] [clojure.data.json :as json]
@ -18,12 +18,12 @@
[next.jdbc.result-set :as jdbc-rs] [next.jdbc.result-set :as jdbc-rs]
[next.jdbc.sql :as jdbc-sql] [next.jdbc.sql :as jdbc-sql]
[next.jdbc.sql.builder :as jdbc-bld] [next.jdbc.sql.builder :as jdbc-bld]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.util.time :as dt] [app.util.time :as dt]
[uxbox.util.transit :as t] [app.util.transit :as t]
[uxbox.util.data :as data]) [app.util.data :as data])
(:import (:import
org.postgresql.util.PGobject org.postgresql.util.PGobject
org.postgresql.util.PGInterval org.postgresql.util.PGInterval

View file

@ -7,17 +7,17 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.emails (ns app.emails
"Main api for send emails." "Main api for send emails."
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[promesa.core :as p] [promesa.core :as p]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.util.emails :as emails])) [app.util.emails :as emails]))
;; --- Defaults ;; --- Defaults

View file

@ -7,24 +7,24 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.http (ns app.http
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[mount.core :as mount :refer [defstate]] [mount.core :as mount :refer [defstate]]
[reitit.ring :as rring] [reitit.ring :as rring]
[ring.adapter.jetty9 :as jetty] [ring.adapter.jetty9 :as jetty]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.http.auth :as auth] [app.http.auth :as auth]
[uxbox.http.auth.google :as google] [app.http.auth.google :as google]
[uxbox.http.auth.ldap :as ldap] [app.http.auth.ldap :as ldap]
[uxbox.http.debug :as debug] [app.http.debug :as debug]
[uxbox.http.errors :as errors] [app.http.errors :as errors]
[uxbox.http.handlers :as handlers] [app.http.handlers :as handlers]
[uxbox.http.middleware :as middleware] [app.http.middleware :as middleware]
[uxbox.http.session :as session] [app.http.session :as session]
[uxbox.http.ws :as ws] [app.http.ws :as ws]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.services.notifications :as usn])) [app.services.notifications :as usn]))
(defn- create-router (defn- create-router
[] []

View file

@ -7,12 +7,12 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.http.auth (ns app.http.auth
(:require (:require
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.http.session :as session] [app.http.session :as session]
[uxbox.services.mutations :as sm])) [app.services.mutations :as sm]))
(defn login-handler (defn login-handler
[req] [req]

View file

@ -7,18 +7,18 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.http.auth.google (ns app.http.auth.google
(:require (:require
[clojure.data.json :as json] [clojure.data.json :as json]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[lambdaisland.uri :as uri] [lambdaisland.uri :as uri]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.tokens :as tokens] [app.services.tokens :as tokens]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.http.session :as session] [app.http.session :as session]
[uxbox.util.http :as http])) [app.util.http :as http]))
(def base-goauth-uri "https://accounts.google.com/o/oauth2/v2/auth") (def base-goauth-uri "https://accounts.google.com/o/oauth2/v2/auth")

View file

@ -1,12 +1,12 @@
(ns uxbox.http.auth.ldap (ns app.http.auth.ldap
(:require (:require
[clj-ldap.client :as client] [clj-ldap.client :as client]
[clojure.set :as set] [clojure.set :as set]
[mount.core :refer [defstate]] [mount.core :refer [defstate]]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.http.session :as session] [app.http.session :as session]
[clojure.tools.logging :as log])) [clojure.tools.logging :as log]))

View file

@ -4,14 +4,14 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.http.debug (ns app.http.debug
"Debug related handlers." "Debug related handlers."
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[promesa.core :as p] [promesa.core :as p]
[uxbox.http.errors :as errors] [app.http.errors :as errors]
[uxbox.http.session :as session] [app.http.session :as session]
[uxbox.common.uuid :as uuid])) [app.common.uuid :as uuid]))
(defn emails-list (defn emails-list
[req] [req]

View file

@ -4,12 +4,12 @@
;; ;;
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.http.errors (ns app.http.errors
"A errors handling for the http server." "A errors handling for the http server."
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[cuerdas.core :as str] [cuerdas.core :as str]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[io.aviso.exception :as e])) [io.aviso.exception :as e]))
(defmulti handle-exception (defmulti handle-exception

View file

@ -7,14 +7,14 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.http.handlers (ns app.http.handlers
(:require (:require
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.emails :as emails] [app.emails :as emails]
[uxbox.http.session :as session] [app.http.session :as session]
[uxbox.services.init] [app.services.init]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq])) [app.services.queries :as sq]))
(def unauthorized-services (def unauthorized-services
#{:create-demo-profile #{:create-demo-profile

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.http.middleware (ns app.http.middleware
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[ring.middleware.cookies :refer [wrap-cookies]] [ring.middleware.cookies :refer [wrap-cookies]]
@ -15,10 +15,10 @@
[ring.middleware.multipart-params :refer [wrap-multipart-params]] [ring.middleware.multipart-params :refer [wrap-multipart-params]]
[ring.middleware.params :refer [wrap-params]] [ring.middleware.params :refer [wrap-params]]
[ring.middleware.resource :refer [wrap-resource]] [ring.middleware.resource :refer [wrap-resource]]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.util.transit :as t])) [app.util.transit :as t]))
(defn- wrap-parse-request-body (defn- wrap-parse-request-body
[handler] [handler]

View file

@ -7,10 +7,10 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.http.session (ns app.http.session
(:require (:require
[uxbox.db :as db] [app.db :as db]
[uxbox.services.tokens :as tokens])) [app.services.tokens :as tokens]))
(defn extract-auth-token (defn extract-auth-token
[request] [request]

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.http.ws (ns app.http.ws
"Web Socket handlers" "Web Socket handlers"
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
@ -16,10 +16,10 @@
[ring.middleware.cookies :refer [wrap-cookies]] [ring.middleware.cookies :refer [wrap-cookies]]
[ring.middleware.keyword-params :refer [wrap-keyword-params]] [ring.middleware.keyword-params :refer [wrap-keyword-params]]
[ring.middleware.params :refer [wrap-params]] [ring.middleware.params :refer [wrap-params]]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.http.session :refer [wrap-session]] [app.http.session :refer [wrap-session]]
[uxbox.services.notifications :as nf])) [app.services.notifications :as nf]))
(s/def ::file-id ::us/uuid) (s/def ::file-id ::us/uuid)
(s/def ::session-id ::us/uuid) (s/def ::session-id ::us/uuid)

View file

@ -7,13 +7,13 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.main (ns app.main
(:require (:require
[mount.core :as mount])) [mount.core :as mount]))
(defn- enable-asserts (defn- enable-asserts
[_] [_]
(let [m (System/getProperty "uxbox.enable-asserts")] (let [m (System/getProperty "app.enable-asserts")]
(or (nil? m) (= "true" m)))) (or (nil? m) (= "true" m))))
;; Set value for all new threads bindings. ;; Set value for all new threads bindings.
@ -26,11 +26,11 @@
(defn run (defn run
[params] [params]
(require 'uxbox.config (require 'app.config
'uxbox.migrations 'app.migrations
'uxbox.worker 'app.worker
'uxbox.media 'app.media
'uxbox.http) 'app.http)
(mount/start)) (mount/start))

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.media (ns app.media
"Media postprocessing." "Media postprocessing."
(:require (:require
[clojure.core.async :as a] [clojure.core.async :as a]
@ -15,14 +15,14 @@
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[datoteka.core :as fs] [datoteka.core :as fs]
[mount.core :refer [defstate]] [mount.core :refer [defstate]]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.common.data :as d] [app.common.data :as d]
[uxbox.common.media :as cm] [app.common.media :as cm]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.media-storage :as mst] [app.media-storage :as mst]
[uxbox.util.storage :as ust] [app.util.storage :as ust]
[uxbox.util.http :as http]) [app.util.http :as http])
(:import (:import
java.io.ByteArrayInputStream java.io.ByteArrayInputStream
java.io.InputStream java.io.InputStream

View file

@ -7,15 +7,15 @@
;; ;;
;; Copyright (c) 2017-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2017-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.media-storage (ns app.media-storage
"A media storage impl for uxbox." "A media storage impl for app."
(:require (:require
[mount.core :refer [defstate]] [mount.core :refer [defstate]]
[clojure.java.io :as io] [clojure.java.io :as io]
[cuerdas.core :as str] [cuerdas.core :as str]
[datoteka.core :as fs] [datoteka.core :as fs]
[uxbox.util.storage :as ust] [app.util.storage :as ust]
[uxbox.config :refer [config]])) [app.config :refer [config]]))
;; --- State ;; --- State

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.metrics (ns app.metrics
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[cuerdas.core :as str]) [cuerdas.core :as str])

View file

@ -7,12 +7,12 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.migrations (ns app.migrations
(:require (:require
[mount.core :as mount :refer [defstate]] [mount.core :as mount :refer [defstate]]
[uxbox.db :as db] [app.db :as db]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.util.migrations :as mg])) [app.util.migrations :as mg]))
(def +migrations+ (def +migrations+
{:name "uxbox-main" {:name "uxbox-main"

View file

@ -4,16 +4,16 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.redis (ns app.redis
(:refer-clojure :exclude [run!]) (:refer-clojure :exclude [run!])
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[lambdaisland.uri :refer [uri]] [lambdaisland.uri :refer [uri]]
[mount.core :as mount :refer [defstate]] [mount.core :as mount :refer [defstate]]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.util.data :as data] [app.util.data :as data]
[uxbox.util.redis :as redis]) [app.util.redis :as redis])
(:import (:import
java.lang.AutoCloseable)) java.lang.AutoCloseable))

View file

@ -0,0 +1,40 @@
;; 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/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns app.services.init
"A initialization of services."
(:require
[mount.core :as mount :refer [defstate]]))
(defn- load-query-services
[]
(require 'app.services.queries.media)
(require 'app.services.queries.colors)
(require 'app.services.queries.projects)
(require 'app.services.queries.files)
(require 'app.services.queries.pages)
(require 'app.services.queries.profile)
(require 'app.services.queries.recent-files)
(require 'app.services.queries.viewer))
(defn- load-mutation-services
[]
(require 'app.services.mutations.demo)
(require 'app.services.mutations.media)
(require 'app.services.mutations.colors)
(require 'app.services.mutations.projects)
(require 'app.services.mutations.files)
(require 'app.services.mutations.pages)
(require 'app.services.mutations.profile))
(defstate query-services
:start (load-query-services))
(defstate mutation-services
:start (load-mutation-services))

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.services.middleware (ns app.services.middleware
"Common middleware for services." "Common middleware for services."
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[cuerdas.core :as str] [cuerdas.core :as str]
[expound.alpha :as expound] [expound.alpha :as expound]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.metrics :as mtx])) [app.metrics :as mtx]))
(defn wrap-spec (defn wrap-spec
[handler] [handler]

View file

@ -7,10 +7,10 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.services.mutations (ns app.services.mutations
(:require (:require
[uxbox.services.middleware :as middleware] [app.services.middleware :as middleware]
[uxbox.util.dispatcher :as uds])) [app.util.dispatcher :as uds]))
(uds/defservice handle (uds/defservice handle
:dispatch-by ::type :dispatch-by ::type

View file

@ -7,18 +7,18 @@
;; ;;
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.mutations.colors (ns app.services.mutations.colors
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries.teams :as teams] [app.services.queries.teams :as teams]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.util.time :as dt])) [app.util.time :as dt]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,20 +7,20 @@
;; ;;
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.mutations.demo (ns app.services.mutations.demo
"A demo specific mutations." "A demo specific mutations."
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[sodi.prng] [sodi.prng]
[sodi.util] [sodi.util]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.mutations.profile :as profile] [app.services.mutations.profile :as profile]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.util.time :as tm])) [app.util.time :as tm]))
(sm/defmutation ::create-demo-profile (sm/defmutation ::create-demo-profile
[_] [_]

View file

@ -7,24 +7,24 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.mutations.files (ns app.services.mutations.files
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[datoteka.core :as fs] [datoteka.core :as fs]
[promesa.core :as p] [promesa.core :as p]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.pages :as cp] [app.common.pages :as cp]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.mutations.projects :as proj] [app.services.mutations.projects :as proj]
[uxbox.services.queries.files :as files] [app.services.queries.files :as files]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.storage :as ust] [app.util.storage :as ust]
[uxbox.util.time :as dt])) [app.util.time :as dt]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,23 +7,23 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.services.mutations.media (ns app.services.mutations.media
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[datoteka.core :as fs] [datoteka.core :as fs]
[uxbox.common.media :as cm] [app.common.media :as cm]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.media :as media] [app.media :as media]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries.teams :as teams] [app.services.queries.teams :as teams]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.media-storage :as mst] [app.media-storage :as mst]
[uxbox.util.storage :as ust] [app.util.storage :as ust]
[uxbox.util.time :as dt])) [app.util.time :as dt]))
(def thumbnail-options (def thumbnail-options
{:width 100 {:width 100
@ -46,16 +46,16 @@
(declare persist-media-object-on-fs) (declare persist-media-object-on-fs)
(declare persist-media-thumbnail-on-fs) (declare persist-media-thumbnail-on-fs)
(s/def :uxbox$upload/filename ::us/string) (s/def :app$upload/filename ::us/string)
(s/def :uxbox$upload/size ::us/integer) (s/def :app$upload/size ::us/integer)
(s/def :uxbox$upload/content-type cm/valid-media-types) (s/def :app$upload/content-type cm/valid-media-types)
(s/def :uxbox$upload/tempfile any?) (s/def :app$upload/tempfile any?)
(s/def ::upload (s/def ::upload
(s/keys :req-un [:uxbox$upload/filename (s/keys :req-un [:app$upload/filename
:uxbox$upload/size :app$upload/size
:uxbox$upload/tempfile :app$upload/tempfile
:uxbox$upload/content-type])) :app$upload/content-type]))
(s/def ::content ::upload) (s/def ::content ::upload)

View file

@ -7,25 +7,25 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.mutations.pages (ns app.services.mutations.pages
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.data :as d] [app.common.data :as d]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.pages :as cp] [app.common.pages :as cp]
[uxbox.common.pages-migrations :as pmg] [app.common.pages-migrations :as pmg]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries.files :as files] [app.services.queries.files :as files]
[uxbox.services.queries.pages :refer [decode-row]] [app.services.queries.pages :refer [decode-row]]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.redis :as redis] [app.redis :as redis]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.time :as dt] [app.util.time :as dt]
[uxbox.util.transit :as t])) [app.util.transit :as t]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.mutations.profile (ns app.services.mutations.profile
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[cuerdas.core :as str] [cuerdas.core :as str]
@ -17,25 +17,25 @@
[sodi.prng] [sodi.prng]
[sodi.pwhash] [sodi.pwhash]
[sodi.util] [sodi.util]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.common.media :as cm] [app.common.media :as cm]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.emails :as emails] [app.emails :as emails]
[uxbox.media :as media] [app.media :as media]
[uxbox.media-storage :as mst] [app.media-storage :as mst]
[uxbox.services.tokens :as tokens] [app.services.tokens :as tokens]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.mutations.media :as media-mutations] [app.services.mutations.media :as media-mutations]
[uxbox.services.mutations.projects :as projects] [app.services.mutations.projects :as projects]
[uxbox.services.mutations.teams :as teams] [app.services.mutations.teams :as teams]
[uxbox.services.queries.profile :as profile] [app.services.queries.profile :as profile]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.storage :as ust] [app.util.storage :as ust]
[uxbox.util.time :as dt])) [app.util.time :as dt]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,17 +7,17 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.mutations.projects (ns app.services.mutations.projects
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,15 +7,15 @@
;; ;;
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.mutations.teams (ns app.services.mutations.teams
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,20 +7,20 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.services.notifications (ns app.services.notifications
"A websocket based notifications mechanism." "A websocket based notifications mechanism."
(:require (:require
[clojure.core.async :as a :refer [>! <!]] [clojure.core.async :as a :refer [>! <!]]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[promesa.core :as p] [promesa.core :as p]
[ring.adapter.jetty9 :as jetty] [ring.adapter.jetty9 :as jetty]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.redis :as redis] [app.redis :as redis]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.util.time :as dt] [app.util.time :as dt]
[uxbox.util.transit :as t])) [app.util.transit :as t]))
(defmacro go-try (defmacro go-try
[& body] [& body]

View file

@ -7,10 +7,10 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.services.queries (ns app.services.queries
(:require (:require
[uxbox.services.middleware :as middleware] [app.services.middleware :as middleware]
[uxbox.util.dispatcher :as uds])) [app.util.dispatcher :as uds]))
(uds/defservice handle (uds/defservice handle
:dispatch-by ::type :dispatch-by ::type

View file

@ -7,19 +7,19 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.colors (ns app.services.queries.colors
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[promesa.core :as p] [promesa.core :as p]
[promesa.exec :as px] [promesa.exec :as px]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.services.queries.teams :as teams] [app.services.queries.teams :as teams]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.data :as data])) [app.util.data :as data]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.files (ns app.services.queries.files
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[promesa.core :as p] [promesa.core :as p]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.media :as media] [app.media :as media]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
(declare decode-row) (declare decode-row)

View file

@ -7,15 +7,15 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.media (ns app.services.queries.media
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.media :as media] [app.media :as media]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.services.queries.teams :as teams])) [app.services.queries.teams :as teams]))
(s/def ::id ::us/uuid) (s/def ::id ::us/uuid)
(s/def ::name ::us/string) (s/def ::name ::us/string)

View file

@ -7,17 +7,17 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.pages (ns app.services.queries.pages
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[promesa.core :as p] [promesa.core :as p]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.pages-migrations :as pmg] [app.common.pages-migrations :as pmg]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.services.queries.files :as files] [app.services.queries.files :as files]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -4,16 +4,16 @@
;; ;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.profile (ns app.services.queries.profile
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.media :as media] [app.media :as media]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -4,14 +4,14 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.projects (ns app.services.queries.projects
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[promesa.core :as p] [promesa.core :as p]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
(declare decode-row) (declare decode-row)

View file

@ -7,15 +7,15 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.recent-files (ns app.services.queries.recent-files
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[promesa.core :as p] [promesa.core :as p]
[uxbox.db :as db] [app.db :as db]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.services.queries.projects :refer [retrieve-projects]] [app.services.queries.projects :refer [retrieve-projects]]
[uxbox.services.queries.files :refer [decode-row]])) [app.services.queries.files :refer [decode-row]]))
(def ^:private sql:project-files-recent (def ^:private sql:project-files-recent
"select distinct "select distinct

View file

@ -7,15 +7,15 @@
;; ;;
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.queries.teams (ns app.services.queries.teams
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.util.blob :as blob])) [app.util.blob :as blob]))
;; --- Team Edition Permissions ;; --- Team Edition Permissions

View file

@ -7,21 +7,21 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.services.queries.viewer (ns app.services.queries.viewer
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[promesa.core :as p] [promesa.core :as p]
[promesa.exec :as px] [promesa.exec :as px]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.services.queries.files :as files] [app.services.queries.files :as files]
[uxbox.services.queries.media :as media-queries] [app.services.queries.media :as media-queries]
[uxbox.services.queries.pages :as pages] [app.services.queries.pages :as pages]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.data :as data])) [app.util.data :as data]))
;; --- Helpers & Specs ;; --- Helpers & Specs

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.services.tokens (ns app.services.tokens
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[cuerdas.core :as str] [cuerdas.core :as str]
[sodi.prng] [sodi.prng]
[sodi.util] [sodi.util]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.util.time :as dt] [app.util.time :as dt]
[uxbox.db :as db])) [app.db :as db]))
(defn next-token (defn next-token
([] (next-token 96)) ([] (next-token 96))

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tasks (ns app.tasks
(:require (:require
[cuerdas.core :as str] [cuerdas.core :as str]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.util.time :as dt] [app.util.time :as dt]
[uxbox.metrics :as mtx])) [app.metrics :as mtx]))
(s/def ::name ::us/string) (s/def ::name ::us/string)
(s/def ::delay (s/def ::delay

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tasks.delete-object (ns app.tasks.delete-object
"Generic task for permanent deletion of objects." "Generic task for permanent deletion of objects."
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.util.storage :as ust])) [app.util.storage :as ust]))
(s/def ::type keyword?) (s/def ::type keyword?)
(s/def ::id ::us/uuid) (s/def ::id ::us/uuid)

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tasks.delete-profile (ns app.tasks.delete-profile
"Task for permanent deletion of profiles." "Task for permanent deletion of profiles."
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.db :as db] [app.db :as db]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.util.storage :as ust])) [app.util.storage :as ust]))
(declare delete-profile-data) (declare delete-profile-data)
(declare delete-teams) (declare delete-teams)

View file

@ -7,21 +7,21 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tasks.gc (ns app.tasks.gc
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[cuerdas.core :as str] [cuerdas.core :as str]
[postal.core :as postal] [postal.core :as postal]
[promesa.core :as p] [promesa.core :as p]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.media-storage :as mst] [app.media-storage :as mst]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.storage :as ust])) [app.util.storage :as ust]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Task: Remove deleted media ;; Task: Remove deleted media

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.tasks.impl (ns app.tasks.impl
"Async tasks implementation." "Async tasks implementation."
(:require (:require
[cuerdas.core :as str] [cuerdas.core :as str]
@ -15,13 +15,13 @@
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[promesa.exec :as px] [promesa.exec :as px]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.util.async :as aa] [app.util.async :as aa]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.time :as dt]) [app.util.time :as dt])
(:import (:import
java.util.concurrent.ScheduledExecutorService java.util.concurrent.ScheduledExecutorService
java.util.concurrent.Executors java.util.concurrent.Executors

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tasks.remove-media (ns app.tasks.remove-media
"Demo accounts garbage collector." "Demo accounts garbage collector."
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.media-storage :as mst] [app.media-storage :as mst]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.util.storage :as ust])) [app.util.storage :as ust]))
(s/def ::path ::us/not-empty-string) (s/def ::path ::us/not-empty-string)
(s/def ::props (s/def ::props

View file

@ -7,16 +7,16 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tasks.sendmail (ns app.tasks.sendmail
(:require (:require
[clojure.data.json :as json] [clojure.data.json :as json]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[postal.core :as postal] [postal.core :as postal]
[uxbox.common.data :as d] [app.common.data :as d]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.util.http :as http])) [app.util.http :as http]))
(defmulti sendmail (fn [config email] (:sendmail-backend config))) (defmulti sendmail (fn [config email] (:sendmail-backend config)))
@ -91,7 +91,7 @@
:context result)))) :context result))))
(defn handler (defn handler
{:uxbox.tasks/name "sendmail"} {:app.tasks/name "sendmail"}
[{:keys [props] :as task}] [{:keys [props] :as task}]
(sendmail cfg/config props)) (sendmail cfg/config props))

View file

@ -7,17 +7,17 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.tasks.trim-file (ns app.tasks.trim-file
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.tasks :as tasks] [app.tasks :as tasks]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.time :as dt])) [app.util.time :as dt]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Task: Trim File ;; Task: Trim File

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.async (ns app.util.async
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]

View file

@ -7,10 +7,10 @@
;; ;;
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.blob (ns app.util.blob
"A generic blob storage encoding. Mainly used for "A generic blob storage encoding. Mainly used for
page data, page options and txlog payload storage." page data, page options and txlog payload storage."
(:require [uxbox.util.transit :as t]) (:require [app.util.transit :as t])
(:import (:import
java.io.ByteArrayInputStream java.io.ByteArrayInputStream
java.io.ByteArrayOutputStream java.io.ByteArrayOutputStream

View file

@ -1,4 +1,4 @@
(ns uxbox.util.cli (ns app.util.cli
"Command line interface helpers.") "Command line interface helpers.")
(defn exit! (defn exit!

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.closeable (ns app.util.closeable
"A closeable abstraction. A drop in replacement for "A closeable abstraction. A drop in replacement for
clojure builtin `with-open` syntax abstraction." clojure builtin `with-open` syntax abstraction."
(:refer-clojure :exclude [with-open])) (:refer-clojure :exclude [with-open]))

View file

@ -4,12 +4,12 @@
;; ;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.data (ns app.util.data
"Data transformations utils." "Data transformations utils."
(:require [clojure.walk :as walk] (:require [clojure.walk :as walk]
[cuerdas.core :as str])) [cuerdas.core :as str]))
;; TODO: move to uxbox.common.helpers ;; TODO: move to app.common.helpers
(defn dissoc-in (defn dissoc-in
[m [k & ks :as keys]] [m [k & ks :as keys]]

View file

@ -4,13 +4,13 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.dispatcher (ns app.util.dispatcher
"A generic service dispatcher implementation." "A generic service dispatcher implementation."
(:refer-clojure :exclude [defmethod]) (:refer-clojure :exclude [defmethod])
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[expound.alpha :as expound] [expound.alpha :as expound]
[uxbox.common.exceptions :as ex]) [app.common.exceptions :as ex])
(:import (:import
clojure.lang.IDeref clojure.lang.IDeref
clojure.lang.MapEntry clojure.lang.MapEntry

View file

@ -4,14 +4,14 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.emails (ns app.util.emails
(:require (:require
[clojure.java.io :as io] [clojure.java.io :as io]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[cuerdas.core :as str] [cuerdas.core :as str]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.util.template :as tmpl])) [app.util.template :as tmpl]))
;; --- Impl. ;; --- Impl.

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.http (ns app.util.http
"Http client abstraction layer." "Http client abstraction layer."
(:require (:require
[promesa.core :as p] [promesa.core :as p]

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.migrations (ns app.util.migrations
(:require (:require
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[clojure.java.io :as io] [clojure.java.io :as io]

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.redis (ns app.util.redis
"Asynchronous posgresql client." "Asynchronous posgresql client."
(:refer-clojure :exclude [run!]) (:refer-clojure :exclude [run!])
(:require (:require

View file

@ -22,7 +22,7 @@
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(ns uxbox.util.sql (ns app.util.sql
"A composable sql helpers." "A composable sql helpers."
(:refer-clojure :exclude [test update set format]) (:refer-clojure :exclude [test update set format])
(:require [clojure.core :as c] (:require [clojure.core :as c]

View file

@ -7,7 +7,7 @@
;; ;;
;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.storage (ns app.util.storage
"A local filesystem storage implementation." "A local filesystem storage implementation."
(:require (:require
[clojure.java.io :as io] [clojure.java.io :as io]
@ -17,7 +17,7 @@
[datoteka.proto :as fp] [datoteka.proto :as fp]
[sodi.prng :as sodi.prng] [sodi.prng :as sodi.prng]
[sodi.util :as sodi.util] [sodi.util :as sodi.util]
[uxbox.common.exceptions :as ex]) [app.common.exceptions :as ex])
(:import (:import
java.io.ByteArrayInputStream java.io.ByteArrayInputStream
java.io.InputStream java.io.InputStream

View file

@ -4,13 +4,13 @@
;; ;;
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.svg (ns app.util.svg
"Icons SVG parsing helpers." "Icons SVG parsing helpers."
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[cuerdas.core :as str] [cuerdas.core :as str]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.exceptions :as ex]) [app.common.exceptions :as ex])
(:import (:import
org.jsoup.Jsoup org.jsoup.Jsoup
org.jsoup.nodes.Attribute org.jsoup.nodes.Attribute

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.template (ns app.util.template
"A lightweight abstraction over mustache.java template engine. "A lightweight abstraction over mustache.java template engine.
The documentation can be found: http://mustache.github.io/mustache.5.html" The documentation can be found: http://mustache.github.io/mustache.5.html"
(:require (:require
@ -13,7 +13,7 @@
[clojure.java.io :as io] [clojure.java.io :as io]
[cuerdas.core :as str] [cuerdas.core :as str]
[selmer.parser :as sp] [selmer.parser :as sp]
[uxbox.common.exceptions :as ex])) [app.common.exceptions :as ex]))
;; (sp/cache-off!) ;; (sp/cache-off!)

View file

@ -7,10 +7,10 @@
;; ;;
;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.time (ns app.util.time
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[cognitect.transit :as t]) [cognitect.transit :as t])
(:import (:import
java.time.Instant java.time.Instant
@ -79,7 +79,7 @@
(defmethod print-method Duration (defmethod print-method Duration
[mv ^java.io.Writer writer] [mv ^java.io.Writer writer]
(.write writer (str "#uxbox/duration \"" (.toString ^Duration mv) "\""))) (.write writer (str "#app/duration \"" (.toString ^Duration mv) "\"")))
(defmethod print-dup Duration [o w] (defmethod print-dup Duration [o w]
(print-method o w)) (print-method o w))
@ -212,7 +212,7 @@
(defmethod print-method CronExpression (defmethod print-method CronExpression
[mv ^java.io.Writer writer] [mv ^java.io.Writer writer]
(.write writer (str "#uxbox/cron \"" (.toString ^CronExpression mv) "\""))) (.write writer (str "#app/cron \"" (.toString ^CronExpression mv) "\"")))
(defmethod print-dup CronExpression (defmethod print-dup CronExpression
[o w] [o w]
@ -248,7 +248,7 @@
(defmethod print-method Instant (defmethod print-method Instant
[mv ^java.io.Writer writer] [mv ^java.io.Writer writer]
(.write writer (str "#uxbox/instant \"" (.toString ^Instant mv) "\""))) (.write writer (str "#app/instant \"" (.toString ^Instant mv) "\"")))
(defmethod print-dup Instant [o w] (defmethod print-dup Instant [o w]
(print-method o w)) (print-method o w))

View file

@ -7,22 +7,22 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.util.transit (ns app.util.transit
(:require (:require
[cognitect.transit :as t] [cognitect.transit :as t]
[clojure.java.io :as io] [clojure.java.io :as io]
[linked.core :as lk] [linked.core :as lk]
[uxbox.util.time :as dt] [app.util.time :as dt]
[uxbox.util.data :as data] [app.util.data :as data]
[uxbox.common.geom.point :as gpt] [app.common.geom.point :as gpt]
[uxbox.common.geom.matrix :as gmt]) [app.common.geom.matrix :as gmt])
(:import (:import
linked.set.LinkedSet linked.set.LinkedSet
java.io.ByteArrayInputStream java.io.ByteArrayInputStream
java.io.ByteArrayOutputStream java.io.ByteArrayOutputStream
java.io.File java.io.File
uxbox.common.geom.point.Point app.common.geom.point.Point
uxbox.common.geom.matrix.Matrix)) app.common.geom.matrix.Matrix))
;; --- Handlers ;; --- Handlers

View file

@ -4,12 +4,12 @@
;; ;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.workers (ns app.util.workers
"A distributed asynchronous tasks queue implementation on top "A distributed asynchronous tasks queue implementation on top
of PostgreSQL reliable advirsory locking mechanism." of PostgreSQL reliable advirsory locking mechanism."
#_(:require #_(:require
[suricatta.core :as sc] [suricatta.core :as sc]
[uxbox.db :as db])) [app.db :as db]))
;; (defn- poll-for-task ;; (defn- poll-for-task
;; [conn queue] ;; [conn queue]

View file

@ -7,39 +7,39 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.worker (ns app.worker
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[mount.core :as mount :refer [defstate]] [mount.core :as mount :refer [defstate]]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.tasks.delete-object] [app.tasks.delete-object]
[uxbox.tasks.delete-profile] [app.tasks.delete-profile]
[uxbox.tasks.gc] [app.tasks.gc]
[uxbox.tasks.remove-media] [app.tasks.remove-media]
[uxbox.tasks.sendmail] [app.tasks.sendmail]
[uxbox.tasks.trim-file] [app.tasks.trim-file]
[uxbox.util.time :as dt] [app.util.time :as dt]
[uxbox.worker-impl :as impl])) [app.worker-impl :as impl]))
;; --- State initialization ;; --- State initialization
(def ^:private tasks (def ^:private tasks
{"delete-profile" #'uxbox.tasks.delete-profile/handler {"delete-profile" #'app.tasks.delete-profile/handler
"delete-object" #'uxbox.tasks.delete-object/handler "delete-object" #'app.tasks.delete-object/handler
"remove-media" #'uxbox.tasks.remove-media/handler "remove-media" #'app.tasks.remove-media/handler
"sendmail" #'uxbox.tasks.sendmail/handler}) "sendmail" #'app.tasks.sendmail/handler})
(def ^:private schedule (def ^:private schedule
[{:id "remove-deleted-media" [{:id "remove-deleted-media"
:cron (dt/cron "0 0 0 */1 * ? *") ;; daily :cron (dt/cron "0 0 0 */1 * ? *") ;; daily
:fn #'uxbox.tasks.gc/remove-deleted-media} :fn #'app.tasks.gc/remove-deleted-media}
{:id "trim-file" {:id "trim-file"
:cron (dt/cron "0 0 0 */1 * ? *") ;; daily :cron (dt/cron "0 0 0 */1 * ? *") ;; daily
:fn #'uxbox.tasks.trim-file/handler} :fn #'app.tasks.trim-file/handler}
]) ])

View file

@ -7,21 +7,21 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.worker-impl (ns app.worker-impl
(:require (:require
[cuerdas.core :as str] [cuerdas.core :as str]
[clojure.core.async :as a] [clojure.core.async :as a]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[promesa.exec :as px] [promesa.exec :as px]
[uxbox.common.exceptions :as ex] [app.common.exceptions :as ex]
[uxbox.common.spec :as us] [app.common.spec :as us]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.config :as cfg] [app.config :as cfg]
[uxbox.db :as db] [app.db :as db]
[uxbox.util.async :as aa] [app.util.async :as aa]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.util.time :as dt]) [app.util.time :as dt])
(:import (:import
org.eclipse.jetty.util.thread.QueuedThreadPool org.eclipse.jetty.util.thread.QueuedThreadPool
java.util.concurrent.ExecutorService java.util.concurrent.ExecutorService

View file

@ -1,3 +1,3 @@
{uxbox/instant uxbox.util.time/from-string {app/instant app.util.time/from-string
uxbox/cron uxbox.util.time/cron app/cron app.util.time/cron
uxbox/duration uxbox.util.time/duration} app/duration app.util.time/duration}

View file

@ -1,40 +0,0 @@
;; 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/.
;;
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.init
"A initialization of services."
(:require
[mount.core :as mount :refer [defstate]]))
(defn- load-query-services
[]
(require 'uxbox.services.queries.media)
(require 'uxbox.services.queries.colors)
(require 'uxbox.services.queries.projects)
(require 'uxbox.services.queries.files)
(require 'uxbox.services.queries.pages)
(require 'uxbox.services.queries.profile)
(require 'uxbox.services.queries.recent-files)
(require 'uxbox.services.queries.viewer))
(defn- load-mutation-services
[]
(require 'uxbox.services.mutations.demo)
(require 'uxbox.services.mutations.media)
(require 'uxbox.services.mutations.colors)
(require 'uxbox.services.mutations.projects)
(require 'uxbox.services.mutations.files)
(require 'uxbox.services.mutations.pages)
(require 'uxbox.services.mutations.profile))
(defstate query-services
:start (load-query-services))
(defstate mutation-services
:start (load-mutation-services))

View file

Before

Width:  |  Height:  |  Size: 305 KiB

After

Width:  |  Height:  |  Size: 305 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

View file

@ -1,4 +1,4 @@
(ns uxbox.tests.helpers (ns app.tests.helpers
(:require (:require
[clojure.java.io :as io] [clojure.java.io :as io]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
@ -7,49 +7,49 @@
[cuerdas.core :as str] [cuerdas.core :as str]
[mount.core :as mount] [mount.core :as mount]
[environ.core :refer [env]] [environ.core :refer [env]]
[uxbox.common.pages :as cp] [app.common.pages :as cp]
[uxbox.services.init] [app.services.init]
[uxbox.services.mutations.profile :as profile] [app.services.mutations.profile :as profile]
[uxbox.services.mutations.projects :as projects] [app.services.mutations.projects :as projects]
[uxbox.services.mutations.teams :as teams] [app.services.mutations.teams :as teams]
[uxbox.services.mutations.files :as files] [app.services.mutations.files :as files]
[uxbox.services.mutations.pages :as pages] [app.services.mutations.pages :as pages]
[uxbox.services.mutations.colors :as colors] [app.services.mutations.colors :as colors]
[uxbox.migrations] [app.migrations]
[uxbox.media] [app.media]
[uxbox.media-storage] [app.media-storage]
[uxbox.db :as db] [app.db :as db]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.util.storage :as ust] [app.util.storage :as ust]
[uxbox.config :as cfg]) [app.config :as cfg])
(:import org.postgresql.ds.PGSimpleDataSource)) (:import org.postgresql.ds.PGSimpleDataSource))
(defn testing-datasource (defn testing-datasource
[] []
(doto (PGSimpleDataSource.) (doto (PGSimpleDataSource.)
(.setServerName "postgres") (.setServerName "postgres")
(.setDatabaseName "uxbox_test") (.setDatabaseName "app_test")
(.setUser "uxbox") (.setUser "app")
(.setPassword "uxbox"))) (.setPassword "app")))
(defn state-init (defn state-init
[next] [next]
(let [config (cfg/read-test-config env)] (let [config (cfg/read-test-config env)]
(try (try
(let [pool (testing-datasource)] (let [pool (testing-datasource)]
(-> (mount/only #{#'uxbox.config/config (-> (mount/only #{#'app.config/config
#'uxbox.db/pool #'app.db/pool
#'uxbox.redis/client #'app.redis/client
#'uxbox.redis/conn #'app.redis/conn
#'uxbox.media/semaphore #'app.media/semaphore
#'uxbox.services.init/query-services #'app.services.init/query-services
#'uxbox.services.init/mutation-services #'app.services.init/mutation-services
#'uxbox.migrations/migrations #'app.migrations/migrations
#'uxbox.media-storage/assets-storage #'app.media-storage/assets-storage
#'uxbox.media-storage/media-storage}) #'app.media-storage/media-storage})
(mount/swap {#'uxbox.config/config config (mount/swap {#'app.config/config config
#'uxbox.db/pool pool}) #'app.db/pool pool})
(mount/start))) (mount/start)))
(next) (next)
(finally (finally
@ -70,8 +70,8 @@
(try (try
(next) (next)
(finally (finally
(ust/clear! uxbox.media-storage/media-storage) (ust/clear! app.media-storage/media-storage)
(ust/clear! uxbox.media-storage/assets-storage)))) (ust/clear! app.media-storage/assets-storage))))
(defn mk-uuid (defn mk-uuid
[prefix & args] [prefix & args]

View file

@ -5,17 +5,17 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0. ;; defined by the Mozilla Public License, v. 2.0.
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 app Labs SL
(ns uxbox.tests.test-common-pages (ns app.tests.test-common-pages
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[clojure.pprint :refer [pprint]] [clojure.pprint :refer [pprint]]
[promesa.core :as p] [promesa.core :as p]
[mockery.core :refer [with-mock]] [mockery.core :refer [with-mock]]
[uxbox.common.pages :as cp] [app.common.pages :as cp]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.tests.helpers :as th])) [app.tests.helpers :as th]))
(t/deftest process-change-set-option (t/deftest process-change-set-option
(let [data cp/default-page-data] (let [data cp/default-page-data]

View file

@ -4,20 +4,20 @@
;; ;;
;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.tests.test-emails (ns app.tests.test-emails
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[promesa.core :as p] [promesa.core :as p]
[mockery.core :refer [with-mock]] [mockery.core :refer [with-mock]]
[uxbox.db :as db] [app.db :as db]
[uxbox.emails :as emails] [app.emails :as emails]
[uxbox.tests.helpers :as th])) [app.tests.helpers :as th]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)
(t/deftest register-email-rendering (t/deftest register-email-rendering
(let [result (emails/render emails/register {:to "example@uxbox.io" :name "foo"})] (let [result (emails/render emails/register {:to "example@app.io" :name "foo"})]
(t/is (map? result)) (t/is (map? result))
(t/is (contains? result :subject)) (t/is (contains? result :subject))
(t/is (contains? result :content)) (t/is (contains? result :content))
@ -26,18 +26,18 @@
(t/is (vector? (:content result))))) (t/is (vector? (:content result)))))
;; (t/deftest email-sending-and-sendmail-job ;; (t/deftest email-sending-and-sendmail-job
;; (let [res @(emails/send! emails/register {:to "example@uxbox.io" :name "foo"})] ;; (let [res @(emails/send! emails/register {:to "example@app.io" :name "foo"})]
;; (t/is (nil? res))) ;; (t/is (nil? res)))
;; (with-mock mock ;; (with-mock mock
;; {:target 'uxbox.jobs.sendmail/impl-sendmail ;; {:target 'app.jobs.sendmail/impl-sendmail
;; :return (p/resolved nil)} ;; :return (p/resolved nil)}
;; (let [res @(uxbox.jobs.sendmail/send-emails {})] ;; (let [res @(app.jobs.sendmail/send-emails {})]
;; (t/is (= 1 res)) ;; (t/is (= 1 res))
;; (t/is (:called? @mock)) ;; (t/is (:called? @mock))
;; (t/is (= 1 (:call-count @mock)))) ;; (t/is (= 1 (:call-count @mock))))
;; (let [res @(uxbox.jobs.sendmail/send-emails {})] ;; (let [res @(app.jobs.sendmail/send-emails {})]
;; (t/is (= 0 res)) ;; (t/is (= 0 res))
;; (t/is (:called? @mock)) ;; (t/is (:called? @mock))
;; (t/is (= 1 (:call-count @mock)))))) ;; (t/is (= 1 (:call-count @mock))))))

View file

@ -5,19 +5,19 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0. ;; defined by the Mozilla Public License, v. 2.0.
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 app Labs SL
(ns uxbox.tests.test-services-colors (ns app.tests.test-services-colors
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[datoteka.core :as fs] [datoteka.core :as fs]
[clojure.java.io :as io] [clojure.java.io :as io]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.util.storage :as ust] [app.util.storage :as ust]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.tests.helpers :as th])) [app.tests.helpers :as th]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)

View file

@ -5,19 +5,19 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0. ;; defined by the Mozilla Public License, v. 2.0.
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 app Labs SL
(ns uxbox.tests.test-services-files (ns app.tests.test-services-files
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[datoteka.core :as fs] [datoteka.core :as fs]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.http :as http] [app.http :as http]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.tests.helpers :as th] [app.tests.helpers :as th]
[uxbox.util.storage :as ust])) [app.util.storage :as ust]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)
@ -109,7 +109,7 @@
error-data (ex-data error)] error-data (ex-data error)]
(t/is (th/ex-info? error)) (t/is (th/ex-info? error))
(t/is (= (:type error-data) :service-error)) (t/is (= (:type error-data) :service-error))
(t/is (= (:name error-data) :uxbox.services.queries.files/file))) (t/is (= (:name error-data) :app.services.queries.files/file)))
(let [error (ex-cause (:error out)) (let [error (ex-cause (:error out))
error-data (ex-data error)] error-data (ex-data error)]

View file

@ -5,18 +5,18 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0. ;; defined by the Mozilla Public License, v. 2.0.
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 app Labs SL
(ns uxbox.tests.test-services-media (ns app.tests.test-services-media
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[datoteka.core :as fs] [datoteka.core :as fs]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.tests.helpers :as th] [app.tests.helpers :as th]
[uxbox.util.storage :as ust])) [app.util.storage :as ust]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)
@ -30,7 +30,7 @@
object-id-2 (uuid/next)] object-id-2 (uuid/next)]
(t/testing "create media object from url to file" (t/testing "create media object from url to file"
(let [url "https://raw.githubusercontent.com/uxbox/uxbox/develop/frontend/resources/images/penpot-login.jpg" (let [url "https://raw.githubusercontent.com/app/app/develop/frontend/resources/images/penpot-login.jpg"
data {::sm/type :add-media-object-from-url data {::sm/type :add-media-object-from-url
:id object-id-1 :id object-id-1
:profile-id (:id prof) :profile-id (:id prof)
@ -54,7 +54,7 @@
(t/testing "upload media object to file" (t/testing "upload media object to file"
(let [content {:filename "sample.jpg" (let [content {:filename "sample.jpg"
:tempfile (th/tempfile "uxbox/tests/_files/sample.jpg") :tempfile (th/tempfile "app/tests/_files/sample.jpg")
:content-type "image/jpeg" :content-type "image/jpeg"
:size 312043} :size 312043}
data {::sm/type :upload-media-object data {::sm/type :upload-media-object

View file

@ -5,20 +5,20 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0. ;; defined by the Mozilla Public License, v. 2.0.
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 app Labs SL
(ns uxbox.tests.test-services-pages (ns app.tests.test-services-pages
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.test :as t] [clojure.test :as t]
[promesa.core :as p] [promesa.core :as p]
[uxbox.common.pages :as cp] [app.common.pages :as cp]
[uxbox.db :as db] [app.db :as db]
[uxbox.http :as http] [app.http :as http]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.tests.helpers :as th])) [app.tests.helpers :as th]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)
@ -168,7 +168,7 @@
error-data (ex-data error)] error-data (ex-data error)]
(t/is (th/ex-info? error)) (t/is (th/ex-info? error))
(t/is (= (:type error-data) :service-error)) (t/is (= (:type error-data) :service-error))
(t/is (= (:name error-data) :uxbox.services.mutations.pages/update-page))) (t/is (= (:name error-data) :app.services.mutations.pages/update-page)))
(let [error (ex-cause (:error out)) (let [error (ex-cause (:error out))
error-data (ex-data error)] error-data (ex-data error)]

View file

@ -7,18 +7,18 @@
;; ;;
;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2019-2020 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.tests.test-services-profile (ns app.tests.test-services-profile
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[clojure.java.io :as io] [clojure.java.io :as io]
[mockery.core :refer [with-mocks]] [mockery.core :refer [with-mocks]]
[cuerdas.core :as str] [cuerdas.core :as str]
[datoteka.core :as fs] [datoteka.core :as fs]
[uxbox.db :as db] [app.db :as db]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.services.mutations.profile :as profile] [app.services.mutations.profile :as profile]
[uxbox.tests.helpers :as th])) [app.tests.helpers :as th]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)
@ -40,7 +40,7 @@
(let [error (ex-cause (:error out))] (let [error (ex-cause (:error out))]
(t/is (th/ex-info? error)) (t/is (th/ex-info? error))
(t/is (th/ex-of-type? error :validation)) (t/is (th/ex-of-type? error :validation))
(t/is (th/ex-of-code? error :uxbox.services.mutations.profile/wrong-credentials))))) (t/is (th/ex-of-code? error :app.services.mutations.profile/wrong-credentials)))))
(t/testing "success" (t/testing "success"
(let [event {::sm/type :login (let [event {::sm/type :login
@ -98,7 +98,7 @@
:profile-id (:id profile) :profile-id (:id profile)
:file {:filename "sample.jpg" :file {:filename "sample.jpg"
:size 123123 :size 123123
:tempfile "tests/uxbox/tests/_files/sample.jpg" :tempfile "tests/app/tests/_files/sample.jpg"
:content-type "image/jpeg"}} :content-type "image/jpeg"}}
out (th/try-on! (sm/handle data))] out (th/try-on! (sm/handle data))]
@ -116,7 +116,7 @@
;; (t/testing "try to delete profile not marked for deletion" ;; (t/testing "try to delete profile not marked for deletion"
;; (let [params {:props {:profile-id (:id prof)}} ;; (let [params {:props {:profile-id (:id prof)}}
;; out (th/try-on! (uxbox.tasks.delete-profile/handler params))] ;; out (th/try-on! (app.tasks.delete-profile/handler params))]
;; ;; (th/print-result! out) ;; ;; (th/print-result! out)
;; (t/is (nil? (:error out))) ;; (t/is (nil? (:error out)))
@ -135,7 +135,7 @@
;; (t/testing "mark profile for deletion" ;; (t/testing "mark profile for deletion"
;; (with-mocks ;; (with-mocks
;; [mock {:target 'uxbox.tasks/schedule! :return nil}] ;; [mock {:target 'app.tasks/schedule! :return nil}]
;; (let [data {::sm/type :delete-profile ;; (let [data {::sm/type :delete-profile
;; :profile-id (:id prof)} ;; :profile-id (:id prof)}
@ -163,7 +163,7 @@
;; (t/testing "try to delete profile marked for deletion" ;; (t/testing "try to delete profile marked for deletion"
;; (let [params {:props {:profile-id (:id prof)}} ;; (let [params {:props {:profile-id (:id prof)}}
;; out (th/try-on! (uxbox.tasks.delete-profile/handler params))] ;; out (th/try-on! (app.tasks.delete-profile/handler params))]
;; ;; (th/print-result! out) ;; ;; (th/print-result! out)
;; (t/is (nil? (:error out))) ;; (t/is (nil? (:error out)))
@ -180,7 +180,7 @@
;; error-data (ex-data error)] ;; error-data (ex-data error)]
;; (t/is (th/ex-info? error)) ;; (t/is (th/ex-info? error))
;; (t/is (= (:type error-data) :service-error)) ;; (t/is (= (:type error-data) :service-error))
;; (t/is (= (:name error-data) :uxbox.services.queries.profile/profile))) ;; (t/is (= (:name error-data) :app.services.queries.profile/profile)))
;; (let [error (ex-cause (:error out)) ;; (let [error (ex-cause (:error out))
;; error-data (ex-data error)] ;; error-data (ex-data error)]

View file

@ -1,13 +1,13 @@
(ns uxbox.tests.test-services-projects (ns app.tests.test-services-projects
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[promesa.core :as p] [promesa.core :as p]
[uxbox.db :as db] [app.db :as db]
[uxbox.http :as http] [app.http :as http]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.tests.helpers :as th] [app.tests.helpers :as th]
[uxbox.common.uuid :as uuid])) [app.common.uuid :as uuid]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)

View file

@ -1,13 +1,13 @@
(ns uxbox.tests.test-services-user-attrs (ns app.tests.test-services-user-attrs
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[clojure.test :as t] [clojure.test :as t]
[promesa.core :as p] [promesa.core :as p]
[uxbox.db :as db] [app.db :as db]
[uxbox.http :as http] [app.http :as http]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.tests.helpers :as th])) [app.tests.helpers :as th]))
;; (t/use-fixtures :once th/state-init) ;; (t/use-fixtures :once th/state-init)
;; (t/use-fixtures :each th/database-reset) ;; (t/use-fixtures :each th/database-reset)

View file

@ -5,19 +5,19 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0. ;; defined by the Mozilla Public License, v. 2.0.
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 app Labs SL
(ns uxbox.tests.test-services-viewer (ns app.tests.test-services-viewer
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[datoteka.core :as fs] [datoteka.core :as fs]
[uxbox.common.uuid :as uuid] [app.common.uuid :as uuid]
[uxbox.db :as db] [app.db :as db]
[uxbox.http :as http] [app.http :as http]
[uxbox.services.mutations :as sm] [app.services.mutations :as sm]
[uxbox.services.queries :as sq] [app.services.queries :as sq]
[uxbox.tests.helpers :as th] [app.tests.helpers :as th]
[uxbox.util.storage :as ust])) [app.util.storage :as ust]))
(t/use-fixtures :once th/state-init) (t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset) (t/use-fixtures :each th/database-reset)
@ -71,7 +71,7 @@
error-data (ex-data error)] error-data (ex-data error)]
(t/is (th/ex-info? error)) (t/is (th/ex-info? error))
(t/is (= (:type error-data) :service-error)) (t/is (= (:type error-data) :service-error))
(t/is (= (:name error-data) :uxbox.services.queries.viewer/viewer-bundle))) (t/is (= (:name error-data) :app.services.queries.viewer/viewer-bundle)))
(let [error (ex-cause (:error out)) (let [error (ex-cause (:error out))
error-data (ex-data error)] error-data (ex-data error)]

View file

@ -1,13 +1,13 @@
(ns uxbox.tests.test-util-svg (ns app.tests.test-util-svg
(:require (:require
[clojure.test :as t] [clojure.test :as t]
[clojure.java.io :as io] [clojure.java.io :as io]
[uxbox.http :as http] [app.http :as http]
[uxbox.util.svg :as svg] [app.util.svg :as svg]
[uxbox.tests.helpers :as th])) [app.tests.helpers :as th]))
(t/deftest parse-svg-1 (t/deftest parse-svg-1
(let [result (-> (io/resource "uxbox/tests/_files/sample1.svg") (let [result (-> (io/resource "app/tests/_files/sample1.svg")
(svg/parse))] (svg/parse))]
(t/is (contains? result :width)) (t/is (contains? result :width))
(t/is (contains? result :height)) (t/is (contains? result :height))
@ -20,7 +20,7 @@
(t/is (= "lock.svg" (:name result))))) (t/is (= "lock.svg" (:name result)))))
(t/deftest parse-svg-2 (t/deftest parse-svg-2
(let [result (-> (io/resource "uxbox/tests/_files/sample2.svg") (let [result (-> (io/resource "app/tests/_files/sample2.svg")
(svg/parse))] (svg/parse))]
(t/is (contains? result :width)) (t/is (contains? result :width))
(t/is (contains? result :height)) (t/is (contains? result :height))
@ -33,7 +33,7 @@
(t/is (= "play.svg" (:name result))))) (t/is (= "play.svg" (:name result)))))
(t/deftest parse-invalid-svg-1 (t/deftest parse-invalid-svg-1
(let [image (io/resource "uxbox/tests/_files/sample.jpg") (let [image (io/resource "app/tests/_files/sample.jpg")
out (th/try! (svg/parse image))] out (th/try! (svg/parse image))]
(let [error (:error out)] (let [error (:error out)]

View file

@ -15,16 +15,16 @@
[clojure.pprint :refer [pprint]] [clojure.pprint :refer [pprint]]
[clojure.test :as test] [clojure.test :as test]
[clojure.java.io :as io] [clojure.java.io :as io]
[uxbox.common.pages :as cp] [app.common.pages :as cp]
[clojure.repl :refer :all] [clojure.repl :refer :all]
[criterium.core :refer [quick-bench bench with-progress-reporting]] [criterium.core :refer [quick-bench bench with-progress-reporting]]
[clj-kondo.core :as kondo] [clj-kondo.core :as kondo]
[uxbox.migrations] [app.migrations]
[uxbox.db :as db] [app.db :as db]
[uxbox.metrics :as mtx] [app.metrics :as mtx]
[uxbox.util.storage :as st] [app.util.storage :as st]
[uxbox.util.time :as tm] [app.util.time :as tm]
[uxbox.util.blob :as blob] [app.util.blob :as blob]
[mount.core :as mount])) [mount.core :as mount]))
;; --- Benchmarking Tools ;; --- Benchmarking Tools
@ -49,7 +49,7 @@
(defn- start (defn- start
[] []
(-> #_(mount/except #{#'uxbox.scheduled-jobs/scheduler}) (-> #_(mount/except #{#'app.scheduled-jobs/scheduler})
(mount/start))) (mount/start)))
(defn- stop (defn- stop
@ -62,7 +62,7 @@
(repl/refresh :after 'user/start)) (repl/refresh :after 'user/start))
(defn- run-tests (defn- run-tests
([] (run-tests #"^uxbox.tests.*")) ([] (run-tests #"^app.tests.*"))
([o] ([o]
(repl/refresh) (repl/refresh)
(cond (cond
@ -83,8 +83,8 @@
:cache false :cache false
:config {:linters :config {:linters
{:unresolved-symbol {:unresolved-symbol
{:exclude ['(uxbox.services.mutations/defmutation) {:exclude ['(app.services.mutations/defmutation)
'(uxbox.services.queries/defquery) '(app.services.queries/defquery)
'(uxbox.db/with-atomic) '(app.db/with-atomic)
'(promesa.core/let)]}}}}) '(promesa.core/let)]}}}})
(kondo/print!)))) (kondo/print!))))

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2019 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.common.data (ns app.common.data
"Data manipulation and query helper functions." "Data manipulation and query helper functions."
(:refer-clojure :exclude [concat read-string]) (:refer-clojure :exclude [concat read-string])
(:require [clojure.set :as set] (:require [clojure.set :as set]

View file

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.common.exceptions (ns app.common.exceptions
"A helpers for work with exceptions." "A helpers for work with exceptions."
(:require [clojure.spec.alpha :as s])) (:require [clojure.spec.alpha :as s]))

View file

@ -7,11 +7,11 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.common.geom.matrix (ns app.common.geom.matrix
(:require (:require
[cuerdas.core :as str] [cuerdas.core :as str]
[uxbox.common.math :as mth] [app.common.math :as mth]
[uxbox.common.geom.point :as gpt])) [app.common.geom.point :as gpt]))
;; --- Matrix Impl ;; --- Matrix Impl

View file

@ -7,13 +7,13 @@
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.common.geom.point (ns app.common.geom.point
(:refer-clojure :exclude [divide min max]) (:refer-clojure :exclude [divide min max])
(:require (:require
#?(:cljs [cljs.core :as c] #?(:cljs [cljs.core :as c]
:clj [clojure.core :as c]) :clj [clojure.core :as c])
[cuerdas.core :as str] [cuerdas.core :as str]
[uxbox.common.math :as mth])) [app.common.math :as mth]))
;; --- Point Impl ;; --- Point Impl

Some files were not shown because too many files have changed in this diff Show more