From 4c1fe432dd05c43933a0563337243235c2074af4 Mon Sep 17 00:00:00 2001 From: Benjamin Lamothe Date: Wed, 13 Aug 2025 16:58:54 +0200 Subject: [PATCH 1/7] update db and jsonld deps --- deps.edn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index 0eb7d6a8..dcce2b9d 100644 --- a/deps.edn +++ b/deps.edn @@ -1,8 +1,9 @@ {:deps {org.clojure/clojure {:mvn/version "1.11.3"} org.clojure/core.async {:mvn/version "1.6.681"} com.fluree/db {:git/url "https://github.com/fluree/db.git" - :git/sha "db9960c95a91d539596df54c134e6f99aed7294d"} - com.fluree/json-ld {:mvn/version "1.0.1"} + :git/sha "df2df64e9e981f008e4a4d50b7341ecb827016c3"} + com.fluree/json-ld {:git/url "https://github.com/fluree/json-ld.git" + :git/sha "bca4c3aab601bdcc801323d90c6e5cc24c304914"} integrant/integrant {:mvn/version "0.10.0"} com.fluree/crypto {:git/url "https://github.com/fluree/fluree.crypto.git" From 3f66e63ea1dbb2b872784ad1f950cb7665d2d1b1 Mon Sep 17 00:00:00 2001 From: Benjamin Lamothe Date: Wed, 13 Aug 2025 16:59:06 +0200 Subject: [PATCH 2/7] use util/of-type? instead of the removed conn-config/type? --- src/fluree/server/config.clj | 6 ++-- src/fluree/server/system.clj | 60 ++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/fluree/server/config.clj b/src/fluree/server/config.clj index 5ee7aa28..0aaee0fc 100644 --- a/src/fluree/server/config.clj +++ b/src/fluree/server/config.clj @@ -1,7 +1,7 @@ (ns fluree.server.config (:require [clojure.java.io :as io] [fluree.db.connection.config :as conn-config] - [fluree.db.util :as util :refer [get-id get-first-value]] + [fluree.db.util :as util :refer [get-id get-first-value of-type?]] [fluree.db.util.log :as log] [fluree.server.config.vocab :as vocab] [fluree.server.consensus :as-alias consensus] @@ -62,7 +62,7 @@ (defn consensus? [node] - (conn-config/type? node vocab/consensus-type)) + (of-type? node vocab/consensus-type)) (defn raft-consensus? [node] @@ -76,7 +76,7 @@ (defn http-api? [node] - (and (conn-config/type? node vocab/api-type) + (and (of-type? node vocab/api-type) (contains? node vocab/http-port))) (defn jetty-api? diff --git a/src/fluree/server/system.clj b/src/fluree/server/system.clj index fe467bf7..8505e672 100644 --- a/src/fluree/server/system.clj +++ b/src/fluree/server/system.clj @@ -4,7 +4,7 @@ [fluree.db.connection.config :as conn-config] [fluree.db.connection.system :as conn-system] [fluree.db.connection.vocab :as conn-vocab] - [fluree.db.util :as util :refer [get-first]] + [fluree.db.util :as util :refer [get-first of-type?]] [fluree.db.util.json :as json] [fluree.db.util.log :as log] [fluree.server :as-alias server] @@ -153,38 +153,38 @@ (defn log-config-summary [parsed-config] - (let [connection-config (some #(when (conn-config/type? % conn-vocab/connection-type) %) + (let [connection-config (some #(when (of-type? % conn-vocab/connection-type) %) (vals parsed-config)) - storage-config (some #(when (conn-config/type? % conn-vocab/storage-type) %) - (vals parsed-config)) - consensus-config (some #(when (config/consensus? %) %) - (vals parsed-config)) - http-config (some #(when (config/http-api? %) %) - (vals parsed-config)) - cache-mb (when connection-config - (conn-config/get-first-integer connection-config conn-vocab/cache-max-mb)) - storage-type (when storage-config - (let [storage-id (:id storage-config)] - (cond - (conn-config/get-first-string storage-config conn-vocab/file-path) - (str "File storage at " (conn-config/get-first-string storage-config conn-vocab/file-path)) - - (conn-config/get-first-string storage-config conn-vocab/s3-bucket) - (str "S3 storage (bucket: " (conn-config/get-first-string storage-config conn-vocab/s3-bucket) ")") - - (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) - (str "IPFS storage (endpoint: " (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) ")") - - :else - (str "Storage type: " (name (or storage-id "unknown")))))) - consensus-type (when consensus-config - (util/get-first-value consensus-config server-vocab/consensus-protocol)) + storage-config (some #(when (of-type? % conn-vocab/storage-type) %) + (vals parsed-config)) + consensus-config (some #(when (config/consensus? %) %) + (vals parsed-config)) + http-config (some #(when (config/http-api? %) %) + (vals parsed-config)) + cache-mb (when connection-config + (conn-config/get-first-integer connection-config conn-vocab/cache-max-mb)) + storage-type (when storage-config + (let [storage-id (:id storage-config)] + (cond + (conn-config/get-first-string storage-config conn-vocab/file-path) + (str "File storage at " (conn-config/get-first-string storage-config conn-vocab/file-path)) + + (conn-config/get-first-string storage-config conn-vocab/s3-bucket) + (str "S3 storage (bucket: " (conn-config/get-first-string storage-config conn-vocab/s3-bucket) ")") + + (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) + (str "IPFS storage (endpoint: " (conn-config/get-first-string storage-config conn-vocab/ipfs-endpoint) ")") + + :else + (str "Storage type: " (name (or storage-id "unknown")))))) + consensus-type (when consensus-config + (util/get-first-value consensus-config server-vocab/consensus-protocol)) max-pending-txns (when (and consensus-config (= "standalone" consensus-type)) (conn-config/get-first-integer consensus-config server-vocab/max-pending-txns)) - http-port (when http-config - (conn-config/get-first-integer http-config server-vocab/http-port)) - closed-mode (when http-config - (conn-config/get-first-boolean http-config server-vocab/closed-mode))] + http-port (when http-config + (conn-config/get-first-integer http-config server-vocab/http-port)) + closed-mode (when http-config + (conn-config/get-first-boolean http-config server-vocab/closed-mode))] (log/info "Server configuration summary:") (log/info " HTTP port:" (or http-port "Not configured")) (log/info " Consensus mode:" (or consensus-type "Not configured")) From 27e6a939de263990600868a377e24b680b149928 Mon Sep 17 00:00:00 2001 From: Benjamin Lamothe Date: Thu, 14 Aug 2025 16:27:46 +0200 Subject: [PATCH 3/7] update profile test for new json-ld library version --- test/fluree/server/profile_test.clj | 42 +++++++++++++---------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/test/fluree/server/profile_test.clj b/test/fluree/server/profile_test.clj index a7c88485..4be1d8aa 100644 --- a/test/fluree/server/profile_test.clj +++ b/test/fluree/server/profile_test.clj @@ -1,6 +1,7 @@ (ns fluree.server.profile-test (:require [clojure.test :refer [deftest is testing]] [fluree.db.util.json :as json] + [fluree.db.util :as util] [fluree.server :as server] [fluree.server.command :as command] [fluree.server.config :as config] @@ -81,27 +82,23 @@ (testing "Without profile, default values are used" (let [parsed-no-profile (config/parse json-config)] ;; Find the localStorage node - (is (some #(and (= :httpsnsflureeconfigtest/localStorage (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/localStorage (util/get-id %)) (= "/opt/fluree-server/data" - (-> (get % "https://ns.flur.ee/system#filePath") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#filePath"))) (vals parsed-no-profile))) ;; Find the connection node - (is (some #(and (= :httpsnsflureeconfigtest/connection (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/connection + (util/get-id %)) (= 1000 - (-> (get % "https://ns.flur.ee/system#cacheMaxMb") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#cacheMaxMb"))) (vals parsed-no-profile))) ;; Find the consensus node - (is (some #(and (= :httpsnsflureeconfigtest/consensus (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/consensus + (util/get-id %)) (= 512 - (-> (get % "https://ns.flur.ee/system#maxPendingTxns") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#maxPendingTxns"))) (vals parsed-no-profile))))) ;; Test with dev profile @@ -110,27 +107,24 @@ parsed-with-profile (config/parse config-with-profile)] ;; Find the localStorage node - should have dev/data - (is (some #(and (= :httpsnsflureeconfigtest/localStorage (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/localStorage + (util/get-id %)) (= "dev/data" - (-> (get % "https://ns.flur.ee/system#filePath") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#filePath"))) (vals parsed-with-profile))) ;; Find the connection node - cacheMaxMb should be 200 - (is (some #(and (= :httpsnsflureeconfigtest/connection (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/connection + (util/get-id %)) (= 200 - (-> (get % "https://ns.flur.ee/system#cacheMaxMb") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#cacheMaxMb"))) (vals parsed-with-profile))) ;; Find the consensus node - maxPendingTxns should be 16 - (is (some #(and (= :httpsnsflureeconfigtest/consensus (:id %)) + (is (some #(and (= :httpsnsflureeconfigtest/consensus + (util/get-id %)) (= 16 - (-> (get % "https://ns.flur.ee/system#maxPendingTxns") - first - :value))) + (util/get-first-value % "https://ns.flur.ee/system#maxPendingTxns"))) (vals parsed-with-profile))))))) (deftest error-handling-test From 1906f5d387d8d18fd87cf0ba80be934c2640074e Mon Sep 17 00:00:00 2001 From: Benjamin Lamothe Date: Thu, 14 Aug 2025 16:33:15 +0200 Subject: [PATCH 4/7] update db and json-ld deps --- deps.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index dcce2b9d..3f5008af 100644 --- a/deps.edn +++ b/deps.edn @@ -1,9 +1,9 @@ {:deps {org.clojure/clojure {:mvn/version "1.11.3"} org.clojure/core.async {:mvn/version "1.6.681"} com.fluree/db {:git/url "https://github.com/fluree/db.git" - :git/sha "df2df64e9e981f008e4a4d50b7341ecb827016c3"} + :git/sha "28e3b94e3f00d5ceecc7d9a7fcd49951286e67c4"} com.fluree/json-ld {:git/url "https://github.com/fluree/json-ld.git" - :git/sha "bca4c3aab601bdcc801323d90c6e5cc24c304914"} + :git/sha "1db2f86ebe25787bdf4ab8a730a1a4c68e60ac3c"} integrant/integrant {:mvn/version "0.10.0"} com.fluree/crypto {:git/url "https://github.com/fluree/fluree.crypto.git" From 67ec3bcba91b66d8213b1bf02693b3000badb4c1 Mon Sep 17 00:00:00 2001 From: Benjamin Lamothe Date: Thu, 14 Aug 2025 16:33:58 +0200 Subject: [PATCH 5/7] fix formatting --- test/fluree/server/profile_test.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fluree/server/profile_test.clj b/test/fluree/server/profile_test.clj index 4be1d8aa..2537fd6a 100644 --- a/test/fluree/server/profile_test.clj +++ b/test/fluree/server/profile_test.clj @@ -1,7 +1,7 @@ (ns fluree.server.profile-test (:require [clojure.test :refer [deftest is testing]] - [fluree.db.util.json :as json] [fluree.db.util :as util] + [fluree.db.util.json :as json] [fluree.server :as server] [fluree.server.command :as command] [fluree.server.config :as config] From 8a130ac6b4b672adb5302d0aa6cda88557095ef1 Mon Sep 17 00:00:00 2001 From: Benjamin Lamothe Date: Thu, 14 Aug 2025 21:11:02 +0200 Subject: [PATCH 6/7] update db and json-ld deps --- deps.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index 3f5008af..3e24bdd4 100644 --- a/deps.edn +++ b/deps.edn @@ -1,9 +1,9 @@ {:deps {org.clojure/clojure {:mvn/version "1.11.3"} org.clojure/core.async {:mvn/version "1.6.681"} com.fluree/db {:git/url "https://github.com/fluree/db.git" - :git/sha "28e3b94e3f00d5ceecc7d9a7fcd49951286e67c4"} + :git/sha "e6df029c3bf4f3117c3b0402aeea401fbed2d871"} com.fluree/json-ld {:git/url "https://github.com/fluree/json-ld.git" - :git/sha "1db2f86ebe25787bdf4ab8a730a1a4c68e60ac3c"} + :git/sha "74083536c84d77f8cdd4b686b5661714010baad3"} integrant/integrant {:mvn/version "0.10.0"} com.fluree/crypto {:git/url "https://github.com/fluree/fluree.crypto.git" From df90146b1716e6e5ecaf038e19360916a7cb86e8 Mon Sep 17 00:00:00 2001 From: Benjamin Lamothe Date: Thu, 14 Aug 2025 22:20:11 +0200 Subject: [PATCH 7/7] fix policy tests --- test/fluree/server/integration/policy_test.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/fluree/server/integration/policy_test.clj b/test/fluree/server/integration/policy_test.clj index 30b68530..45e7cd53 100644 --- a/test/fluree/server/integration/policy_test.clj +++ b/test/fluree/server/integration/policy_test.clj @@ -296,7 +296,7 @@ (json/stringify (assoc secret-query "opts" {"policyClass" "ex:EmployeePolicy" - "policyValues" ["?$identity" [alice-did]]})) + "policyValues" ["?$identity" [{"@type" "@id" "@value" alice-did}]]})) :headers json-headers} query-res (api-post :query query-req)] @@ -316,7 +316,7 @@ schema:ssn ?ssn.}") :headers (assoc sparql-headers "Fluree-Policy-Class" "ex:EmployeePolicy" - "Fluree-Policy-Values" (json/stringify ["?$identity" [alice-did]]))} + "Fluree-Policy-Values" (json/stringify ["?$identity" [{"@type" "@id" "@value" alice-did}]]))} query-res (api-post :query query-req)] (is (= [["ex:alice" "111-11-1111"]] @@ -380,7 +380,7 @@ "f:action" {"@id" "f:view"} "f:query" {"@type" "@json" "@value" {}}}]} - policy-values ["?$identity" [alice-did]] + policy-values ["?$identity" [{"@type" "@id" "@value" alice-did}]] query-req {:body (json/stringify (assoc secret-query