Makes cloud functions installable remotely

This commit is contained in:
2023-05-02 20:50:27 -07:00
parent 23a9a8039e
commit 2845f21227
7 changed files with 26 additions and 14 deletions

View File

@@ -34,3 +34,19 @@
(defn regenerate-literals []
(require 'com.github.ivarref.gen-fn)
(spit
"resources/functions.edn"
(let [datomic-fn @(resolve 'com.github.ivarref.gen-fn/datomic-fn)]
[(datomic-fn :pay #'iol-ion.tx.pay/pay)
(datomic-fn :plus #'iol-ion.tx.plus/plus)
(datomic-fn :propose-invoice #'iol-ion.tx.propose-invoice/propose-invoice)
(datomic-fn :reset-rels #'iol-ion.tx.reset-rels/reset-rels)
(datomic-fn :reset-scalars #'iol-ion.tx.reset-scalars/reset-scalars)
(datomic-fn :upsert-entity #'iol-ion.tx.upsert-entity/upsert-entity)
(datomic-fn :upsert-invoice #'iol-ion.tx.upsert-invoice/upsert-invoice)
(datomic-fn :upsert-ledger #'iol-ion.tx.upsert-ledger/upsert-ledger)
(datomic-fn :upsert-transaction #'iol-ion.tx.upsert-transaction/upsert-transaction)])))

View File

@@ -28,7 +28,6 @@
(datomic.api/cancel {:cognitect.anomalies/category :cognitect.anomalies/incorrect
:cognitect.anomalies/message
(str "Cannot upsert without :db/id or :db/ident, " entity)}))
[]
(let [e (or (:db/id entity) (:db/ident entity))
is-new? (string? e)
extant-entity (when-not is-new?

View File

@@ -68,7 +68,6 @@
)
(defn upsert-invoice [db invoice]
(println invoice)
(let [upserted-entity [[:upsert-entity invoice]]
with-invoice (dc/with db upserted-entity)
invoice-id (or (-> with-invoice :tempids (get (:db/id invoice)))

View File

@@ -13,7 +13,7 @@
(:journal-entry-line/client+account+location+date jel)
(:db/id jel)]
})
(filter (fn line-must-match-client-account-location [result]
(take-while (fn line-must-match-client-account-location [result]
(and
(= (take 3 (:journal-entry-line/client+account+location+date result))
(take 3 (:journal-entry-line/client+account+location+date jel)))