Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active August 1, 2018 10:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfikes/abd3389e5cefb06ff15124c243cd0060 to your computer and use it in GitHub Desktop.
Save mfikes/abd3389e5cefb06ff15124c243cd0060 to your computer and use it in GitHub Desktop.
Using mongo db ClojureScript NPM dips

Even though there is a problem with mongodb-stitch-browser-sdk, if you dig through the Closure output for this module, you can see that it exports core as well as mongodb-stitch-browser-services-mongodb-remote which you seem to be able to access:

$ clj -m cljs.main -co co.edn -d out -r
ClojureScript 1.10.339
cljs.user=> (require '[mongodb-stitch-browser-core :as core])

cljs.user=> core/StitchClientErrorCode
#js {"0" "LoggedOutDuringRequest", "1" "MustAuthenticateFirst", "2" "UserNoLongerValid", "3" "CouldNotLoadPersistedAuthInfo", "4" "CouldNotPersistAuthInfo", :LoggedOutDuringRequest 0, :MustAuthenticateFirst 1, :UserNoLongerValid 2, :CouldNotLoadPersistedAuthInfo 3, :CouldNotPersistAuthInfo 4}
cljs.user=> (require '[mongodb-stitch-browser-sdk :as stitch])

cljs.user=> stitch
ReferenceError: Can't find variable: module$private$tmp$npm_deps$node_modules$mongodb_stitch_browser_sdk$dist$esm$index
cljs.user=> (require '[mongodb-stitch-browser-services-mongodb-remote :as remote])

cljs.user=> remote
#js {:RemoteInsertManyResult #object[RemoteInsertManyResult], :RemoteMongoReadOperation #object[RemoteMongoReadOperation], :RemoteMongoClient #js {:factory #object[class_1 [object Object]]}}
{:npm-deps {:mongodb-stitch-browser-sdk "4.0.12"
:mongodb-stitch-browser-core "4.0.12"}
:install-deps true}
{:deps {org.clojure/clojurescript {:mvn/version "1.10.339"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment