datahike 0.8.1877 → 0.8.1879

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/boring.core.js +2 -2
  2. package/boring.data.js +7 -7
  3. package/boring.options.js +16 -16
  4. package/boring.reader.js +4 -4
  5. package/boring.writer.js +2 -2
  6. package/browser/datahike.js +3757 -3750
  7. package/cljs.cache.js +10 -10
  8. package/cljs.cache.wrapped.js +7 -7
  9. package/cljs.core.async.impl.channels.js +8 -8
  10. package/cljs.core.async.impl.dispatch.js +3 -3
  11. package/cljs.core.async.impl.ioc_helpers.js +2 -2
  12. package/cljs.core.async.impl.timers.js +5 -5
  13. package/cljs.core.async.js +16 -16
  14. package/cljs.core.js +473 -474
  15. package/cljs.nodejs.js +1 -1
  16. package/cljs.reader.js +11 -11
  17. package/cljs.spec.alpha.js +74 -74
  18. package/cljs.tools.reader.edn.js +26 -26
  19. package/cljs.tools.reader.impl.commons.js +7 -7
  20. package/cljs.tools.reader.impl.errors.js +10 -10
  21. package/cljs.tools.reader.impl.inspect.js +4 -4
  22. package/cljs.tools.reader.impl.utils.js +3 -3
  23. package/cljs.tools.reader.js +2 -2
  24. package/cljs.tools.reader.reader_types.js +1 -1
  25. package/cljs_env.js +17 -17
  26. package/cljs_node_io.core.js +11 -11
  27. package/cljs_node_io.file.js +26 -26
  28. package/cljs_node_io.fs.js +1 -1
  29. package/clojure.data.js +14 -14
  30. package/clojure.set.js +2 -2
  31. package/clojure.string.js +13 -13
  32. package/clojure.walk.js +3 -3
  33. package/datahike.api.impl.js +34 -34
  34. package/datahike.api.js +5 -5
  35. package/datahike.array.js +8 -8
  36. package/datahike.attr_preds.js +1 -1
  37. package/datahike.bitemporal.predicate.js +1 -1
  38. package/datahike.config.js +49 -49
  39. package/datahike.connections.js +4 -4
  40. package/datahike.connector.js +77 -77
  41. package/datahike.constants.js +21 -20
  42. package/datahike.core.js +1 -1
  43. package/datahike.datom.js +17 -17
  44. package/datahike.db.interface.js +11 -11
  45. package/datahike.db.js +93 -93
  46. package/datahike.db.search.js +49 -49
  47. package/datahike.db.transaction.js +11 -11
  48. package/datahike.db.utils.js +48 -48
  49. package/datahike.env.js +4 -4
  50. package/datahike.gc.js +12 -12
  51. package/datahike.gc_roots.js +2 -2
  52. package/datahike.impl.entity.js +16 -16
  53. package/datahike.index.interface.js +12 -12
  54. package/datahike.index.js +1 -1
  55. package/datahike.index.persistent_set.js +170 -170
  56. package/datahike.index.persistent_set.warm.js +1 -1
  57. package/datahike.index.secondary.js +5 -5
  58. package/datahike.js.api.js +258 -258
  59. package/datahike.js.convert.js +1 -1
  60. package/datahike.lru.js +7 -7
  61. package/datahike.metrics.js +10 -10
  62. package/datahike.migrate.ids.js +1 -1
  63. package/datahike.online_gc.js +2 -2
  64. package/datahike.optimistic.js +12 -12
  65. package/datahike.pull_api.js +7 -7
  66. package/datahike.query.analyze.js +4 -4
  67. package/datahike.query.estimate.js +2 -2
  68. package/datahike.query.execute.js +7 -7
  69. package/datahike.query.ir.js +6 -6
  70. package/datahike.query.js +1319 -1309
  71. package/datahike.query.logical.js +2 -2
  72. package/datahike.query.lower.js +2 -2
  73. package/datahike.query.plan.js +12 -12
  74. package/datahike.query.relation.js +1 -1
  75. package/datahike.query.resolve.js +1 -1
  76. package/datahike.query_stats.js +1 -1
  77. package/datahike.readers.js +10 -10
  78. package/datahike.remote.js +1 -1
  79. package/datahike.schema.js +48 -48
  80. package/datahike.schema_cache.js +3 -3
  81. package/datahike.store.js +62 -62
  82. package/datahike.tools.js +5 -5
  83. package/datahike.tx_preds.js +1 -1
  84. package/datahike.versioning.js +4 -4
  85. package/datahike.writer.js +805 -804
  86. package/datahike.writing.js +52 -52
  87. package/datalog.parser.impl.js +4 -4
  88. package/datalog.parser.impl.proto.js +1 -1
  89. package/datalog.parser.impl.util.js +1 -1
  90. package/datalog.parser.js +1 -1
  91. package/datalog.parser.pull.js +3 -3
  92. package/datalog.parser.type.js +28 -28
  93. package/fress.api.js +1 -1
  94. package/fress.impl.adler32.js +4 -4
  95. package/fress.impl.bigdec.js +2 -2
  96. package/fress.impl.buffer.js +4 -4
  97. package/fress.impl.raw_input.js +1 -1
  98. package/fress.impl.raw_output.js +4 -4
  99. package/fress.impl.table.js +1 -1
  100. package/fress.reader.js +15 -15
  101. package/fress.util.js +11 -11
  102. package/fress.writer.js +24 -24
  103. package/geheimnis.aes.js +1 -1
  104. package/hasch.benc.js +3 -3
  105. package/hasch.core.js +11 -11
  106. package/hasch.platform.js +16 -16
  107. package/is.simm.partial_cps.sequence.js +5 -5
  108. package/kabel/datahike.js +5114 -5108
  109. package/konserve.compressor.js +16 -16
  110. package/konserve.core.js +52 -52
  111. package/konserve.encryptor.js +11 -11
  112. package/konserve.gc.js +1 -1
  113. package/konserve.gc_guard.js +1 -1
  114. package/konserve.impl.defaults.js +14 -14
  115. package/konserve.impl.storage_layout.js +3 -3
  116. package/konserve.memory.js +1 -1
  117. package/konserve.metrics.js +6 -6
  118. package/konserve.node_filestore.js +603 -603
  119. package/konserve.protocols.js +7 -7
  120. package/konserve.serializers.js +16 -16
  121. package/konserve.store.js +95 -95
  122. package/konserve.tiered.js +10 -10
  123. package/konserve.utils.js +6 -6
  124. package/org.replikativ.persistent_sorted_set.branch.js +3 -3
  125. package/org.replikativ.persistent_sorted_set.btset.js +366 -366
  126. package/org.replikativ.persistent_sorted_set.fressian.js +5 -5
  127. package/org.replikativ.persistent_sorted_set.impl.boundary.js +1 -1
  128. package/org.replikativ.persistent_sorted_set.impl.nodes.js +2 -2
  129. package/org.replikativ.persistent_sorted_set.js +1 -1
  130. package/org.replikativ.persistent_sorted_set.leaf.js +1 -1
  131. package/org.replikativ.persistent_sorted_set.util.js +1 -1
  132. package/org.replikativ.persistent_sorted_set.warm.js +1 -1
  133. package/package.json +4 -5
  134. package/remote/api.generated.d.ts +178 -0
  135. package/remote/core.d.ts +133 -0
  136. package/remote/index.d.ts +66 -0
  137. package/remote/index.js +523 -3
  138. package/remote/index.mjs +478 -48
  139. package/replikativ.logging.js +1 -1
  140. package/replikativ.metrics.js +1 -1
  141. package/s3/datahike.js +4506 -4499
  142. package/superv.async.js +26 -26
  143. package/tailrecursion.priority_map.js +16 -16
  144. package/taoensso.trove.console.js +4 -4
  145. package/taoensso.trove.js +1 -1
  146. package/remote/datahike.js +0 -679
  147. package/remote.d.ts +0 -709
@@ -1,6 +1,6 @@
1
1
  var window=global;var $CLJS=require("./cljs_env.js");require("./cljs.core.js");require("./org.replikativ.persistent_sorted_set.impl.nodes.js");require("./fress.api.js");require("./org.replikativ.persistent_sorted_set.leaf.js");require("./org.replikativ.persistent_sorted_set.branch.js");require("./org.replikativ.persistent_sorted_set.btset.js");
2
- 'use strict';var RF,Jla,Kla,Mla;$CLJS.QF=function(a,b){return $CLJS.fy(a,b)};RF=function(a){if(a!=null&&a.Eo!=null)a=a.Eo(a);else{var b=RF[$CLJS.ab(a==null?null:a)];if(b!=null)a=b.g?b.g(a):b.call(null,a);else if(b=RF._,b!=null)a=b.g?b.g(a):b.call(null,a);else throw $CLJS.Vb("PBoundary.-descriptor",a);}return a};
3
- Jla=function(a){if(a.address==null)throw $CLJS.ul("PSS root must be flushed before serialization",new $CLJS.S(null,1,[$CLJS.Tm,$CLJS.Ila],null));var b=a.K,c=function(){var d=$CLJS.iB.g(b);return $CLJS.u(d)?RF(d):null}();a=new $CLJS.S(null,5,[$CLJS.Hk,$CLJS.vf(a),$CLJS.NF,a.address,$CLJS.Wm,a.U,$CLJS.jB,$CLJS.jB.g(b),$CLJS.AB,function(){var d=$CLJS.AB.g(b);return $CLJS.u(d)?d:0}()],null);a=$CLJS.u($CLJS.PF.g(b))?$CLJS.ak.i(a,$CLJS.PF,$CLJS.PF.g(b)):a;return $CLJS.u(c)?$CLJS.ak.i(a,$CLJS.iB,c):a};
4
- Kla=function(a){var b=a.K;a=function(){var d=$CLJS.iB.g(b);return $CLJS.u(d)?RF(d):null}();var c=new $CLJS.S(null,2,[$CLJS.jB,$CLJS.jB.g(b),$CLJS.AB,function(){var d=$CLJS.AB.g(b);return $CLJS.u(d)?d:0}()],null);c=$CLJS.u($CLJS.PF.g(b))?$CLJS.ak.i(c,$CLJS.PF,$CLJS.PF.g(b)):c;return $CLJS.u(a)?$CLJS.ak.i(c,$CLJS.iB,a):c};
5
- $CLJS.Lla=function(a){var b=a.ya;if(b==null)return null;for(var c=a.keys.length,d=a.level===1,e=0,f=$CLJS.dh;;){if(e>=c)return $CLJS.Ye(f)>0?f:null;var g=b[e];if(g==null){var h=f;e+=1;f=h}else h=e+1,f=$CLJS.ak.i(f,e,new $CLJS.S(null,4,[$CLJS.Wm,$CLJS.Wm.g(g),$CLJS.lB,$CLJS.lB.g(g),$CLJS.qB,d?$CLJS.LC($CLJS.qB.g(g)):$CLJS.qB.g(g),$CLJS.xB,a.keys[e]],null)),e=h}};
6
- Mla=function(a){var b=$CLJS.Eo.l;if(a instanceof $CLJS.NC){var c=$CLJS.Lla(a);var d=new $CLJS.S(null,4,[$CLJS.vp,a.Yi(null),$CLJS.op,$CLJS.Fi(a.keys),$CLJS.uB,$CLJS.Fi(a.ua),$CLJS.rB,a.tc],null);d=a.pa!=null?$CLJS.ak.i(d,$CLJS.lB,a.pa):d;c=$CLJS.u(c)?$CLJS.ak.i(d,$CLJS.mm,c):d}else c=new $CLJS.S(null,1,[$CLJS.op,$CLJS.Fi(a.keys)],null),c=a.pa!=null?$CLJS.ak.i(c,$CLJS.lB,a.pa):c;return b.call($CLJS.Eo,$CLJS.gf([c,Kla(a)]))};$CLJS.Nla=$CLJS.ch([$CLJS.KC,function(a,b){$CLJS.cy(a,"pss/leaf",1);return $CLJS.QF(a,Mla(b))},$CLJS.NC,function(a,b){$CLJS.cy(a,"pss/branch",1);return $CLJS.QF(a,Mla(b))}]);$CLJS.Ola=$CLJS.ch([$CLJS.hD,function(a,b){$CLJS.cy(a,"pss/set",1);return $CLJS.QF(a,Jla(b))}]);
2
+ 'use strict';var TF,Qla,Rla,Tla;$CLJS.SF=function(a,b){return $CLJS.dy(a,b)};TF=function(a){if(a!=null&&a.Ho!=null)a=a.Ho(a);else{var b=TF[$CLJS.ab(a==null?null:a)];if(b!=null)a=b.g?b.g(a):b.call(null,a);else if(b=TF._,b!=null)a=b.g?b.g(a):b.call(null,a);else throw $CLJS.Wb("PBoundary.-descriptor",a);}return a};
3
+ Qla=function(a){if(a.address==null)throw $CLJS.ul("PSS root must be flushed before serialization",new $CLJS.S(null,1,[$CLJS.Tm,$CLJS.Pla],null));var b=a.K,c=function(){var d=$CLJS.gB.g(b);return $CLJS.u(d)?TF(d):null}();a=new $CLJS.S(null,5,[$CLJS.Hk,$CLJS.uf(a),$CLJS.PF,a.address,$CLJS.Wm,a.U,$CLJS.hB,$CLJS.hB.g(b),$CLJS.yB,function(){var d=$CLJS.yB.g(b);return $CLJS.u(d)?d:0}()],null);a=$CLJS.u($CLJS.RF.g(b))?$CLJS.ak.i(a,$CLJS.RF,$CLJS.RF.g(b)):a;return $CLJS.u(c)?$CLJS.ak.i(a,$CLJS.gB,c):a};
4
+ Rla=function(a){var b=a.K;a=function(){var d=$CLJS.gB.g(b);return $CLJS.u(d)?TF(d):null}();var c=new $CLJS.S(null,2,[$CLJS.hB,$CLJS.hB.g(b),$CLJS.yB,function(){var d=$CLJS.yB.g(b);return $CLJS.u(d)?d:0}()],null);c=$CLJS.u($CLJS.RF.g(b))?$CLJS.ak.i(c,$CLJS.RF,$CLJS.RF.g(b)):c;return $CLJS.u(a)?$CLJS.ak.i(c,$CLJS.gB,a):c};
5
+ $CLJS.Sla=function(a){var b=a.ya;if(b==null)return null;for(var c=a.keys.length,d=a.level===1,e=0,f=$CLJS.dh;;){if(e>=c)return $CLJS.Ye(f)>0?f:null;var g=b[e];if(g==null){var h=f;e+=1;f=h}else h=e+1,f=$CLJS.ak.i(f,e,new $CLJS.S(null,4,[$CLJS.Wm,$CLJS.Wm.g(g),$CLJS.jB,$CLJS.jB.g(g),$CLJS.oB,d?$CLJS.JC($CLJS.oB.g(g)):$CLJS.oB.g(g),$CLJS.vB,a.keys[e]],null)),e=h}};
6
+ Tla=function(a){var b=$CLJS.Co.l;if(a instanceof $CLJS.LC){var c=$CLJS.Sla(a);var d=new $CLJS.S(null,4,[$CLJS.tp,a.Yi(null),$CLJS.mp,$CLJS.Fi(a.keys),$CLJS.sB,$CLJS.Fi(a.ua),$CLJS.pB,a.tc],null);d=a.pa!=null?$CLJS.ak.i(d,$CLJS.jB,a.pa):d;c=$CLJS.u(c)?$CLJS.ak.i(d,$CLJS.lm,c):d}else c=new $CLJS.S(null,1,[$CLJS.mp,$CLJS.Fi(a.keys)],null),c=a.pa!=null?$CLJS.ak.i(c,$CLJS.jB,a.pa):c;return b.call($CLJS.Co,$CLJS.gf([c,Rla(a)]))};$CLJS.Ula=$CLJS.ch([$CLJS.IC,function(a,b){$CLJS.ay(a,"pss/leaf",1);return $CLJS.SF(a,Tla(b))},$CLJS.LC,function(a,b){$CLJS.ay(a,"pss/branch",1);return $CLJS.SF(a,Tla(b))}]);$CLJS.Vla=$CLJS.ch([$CLJS.fD,function(a,b){$CLJS.ay(a,"pss/set",1);return $CLJS.SF(a,Qla(b))}]);
@@ -1,2 +1,2 @@
1
1
  var window=global;var $CLJS=require("./cljs_env.js");require("./cljs.core.js");
2
- 'use strict';$CLJS.iB=new $CLJS.H(null,"boundary","boundary",-2000996754);$CLJS.Fka=$CLJS.xh(null);
2
+ 'use strict';$CLJS.gB=new $CLJS.H(null,"boundary","boundary",-2000996754);$CLJS.Mka=$CLJS.xh(null);
@@ -1,3 +1,3 @@
1
1
  var window=global;var $CLJS=require("./cljs_env.js");require("./cljs.core.js");require("./org.replikativ.persistent_sorted_set.impl.boundary.js");require("./org.replikativ.persistent_sorted_set.leaf.js");require("./org.replikativ.persistent_sorted_set.branch.js");require("./org.replikativ.persistent_sorted_set.btset.js");
2
- 'use strict';$CLJS.KF=new $CLJS.H(null,"default-bf","default-bf",-1431077803);$CLJS.LF=new $CLJS.H(null,"resolve-measure","resolve-measure",1235395818);$CLJS.MF=new $CLJS.H(null,"resolve-cmp","resolve-cmp",125224489);$CLJS.Fla=new $CLJS.H(null,"mk-settings","mk-settings",-829192421);$CLJS.Gla=new $CLJS.H("pss","storage-id","pss/storage-id",1127028971);$CLJS.Hla=new $CLJS.H(null,"measure-ops","measure-ops",188679997);$CLJS.NF=new $CLJS.H(null,"address","address",559499426);
3
- $CLJS.Ila=new $CLJS.H(null,"must-be-flushed","must-be-flushed",468354549);$CLJS.OF=new $CLJS.H(null,"resolve-storage","resolve-storage",1895103074);$CLJS.PF=new $CLJS.H(null,"ref-type","ref-type",-1367328851);
2
+ 'use strict';$CLJS.MF=new $CLJS.H(null,"default-bf","default-bf",-1431077803);$CLJS.NF=new $CLJS.H(null,"resolve-measure","resolve-measure",1235395818);$CLJS.OF=new $CLJS.H(null,"resolve-cmp","resolve-cmp",125224489);$CLJS.Mla=new $CLJS.H(null,"mk-settings","mk-settings",-829192421);$CLJS.Nla=new $CLJS.H("pss","storage-id","pss/storage-id",1127028971);$CLJS.Ola=new $CLJS.H(null,"measure-ops","measure-ops",188679997);$CLJS.PF=new $CLJS.H(null,"address","address",559499426);
3
+ $CLJS.Pla=new $CLJS.H(null,"must-be-flushed","must-be-flushed",468354549);$CLJS.QF=new $CLJS.H(null,"resolve-storage","resolve-storage",1895103074);$CLJS.RF=new $CLJS.H(null,"ref-type","ref-type",-1367328851);
@@ -1,2 +1,2 @@
1
1
  var window=global;var $CLJS=require("./cljs_env.js");require("./cljs.core.js");require("./clojure.string.js");require("./org.replikativ.persistent_sorted_set.btset.js");
2
- 'use strict';$CLJS.MD=function(a,b,c){return $CLJS.gD(a,b,c)};$CLJS.gla=new $CLJS.S(null,2,[$CLJS.jB,512,$CLJS.AB,0],null);
2
+ 'use strict';$CLJS.KD=function(a,b,c){return $CLJS.eD(a,b,c)};$CLJS.nla=new $CLJS.S(null,2,[$CLJS.hB,512,$CLJS.yB,0],null);
@@ -1,2 +1,2 @@
1
1
  var window=global;var $CLJS=require("./cljs_env.js");require("./cljs.core.js");require("./clojure.string.js");require("./org.replikativ.persistent_sorted_set.impl.boundary.js");require("./org.replikativ.persistent_sorted_set.util.js");
2
- 'use strict';$CLJS.kB=new $CLJS.H(null,"removed-out","removed-out",780264512);$CLJS.lB=new $CLJS.H(null,"measure","measure",-1857519826);
2
+ 'use strict';$CLJS.iB=new $CLJS.H(null,"removed-out","removed-out",780264512);$CLJS.jB=new $CLJS.H(null,"measure","measure",-1857519826);
@@ -1,2 +1,2 @@
1
1
  var window=global;var $CLJS=require("./cljs_env.js");require("./cljs.core.js");require("./clojure.string.js");
2
- 'use strict';$CLJS.jB=new $CLJS.H(null,"branching-factor","branching-factor",1903198601);
2
+ 'use strict';$CLJS.hB=new $CLJS.H(null,"branching-factor","branching-factor",1903198601);
@@ -1,2 +1,2 @@
1
1
  var window=global;var $CLJS=require("./cljs_env.js");require("./cljs.core.js");require("./org.replikativ.persistent_sorted_set.btset.js");require("./org.replikativ.persistent_sorted_set.branch.js");require("./org.replikativ.persistent_sorted_set.util.js");require("./clojure.string.js");
2
- 'use strict';$CLJS.Pla=new $CLJS.H(null,"done","done",-889844188);$CLJS.SF=new $CLJS.H(null,"depth","depth",1768663640);
2
+ 'use strict';$CLJS.Wla=new $CLJS.H(null,"done","done",-889844188);$CLJS.UF=new $CLJS.H(null,"depth","depth",1768663640);
package/package.json CHANGED
@@ -16,8 +16,8 @@
16
16
  "keywords" : [ "database", "datalog", "datomic", "clojurescript", "immutable", "functional" ],
17
17
  "types" : "index.d.ts",
18
18
  "author" : "Christian Weilbach",
19
- "files" : [ "*.js", "!test*.js", "*.js.map", "browser/datahike.js", "browser/index.mjs", "browser/index.js", "s3/datahike.js", "s3/index.mjs", "s3/index.js", "kabel/datahike.js", "kabel/index.mjs", "kabel/index.js", "remote/datahike.js", "remote/index.mjs", "remote/index.js", "index.d.ts", "kabel.d.ts", "remote.d.ts", "README.md", "LICENSE", "THIRD_PARTY_LICENSES.md" ],
20
- "version" : "0.8.1877",
19
+ "files" : [ "*.js", "!test*.js", "*.js.map", "browser/datahike.js", "browser/index.mjs", "browser/index.js", "s3/datahike.js", "s3/index.mjs", "s3/index.js", "kabel/datahike.js", "kabel/index.mjs", "kabel/index.js", "remote/index.mjs", "remote/index.js", "remote/*.d.ts", "index.d.ts", "kabel.d.ts", "README.md", "LICENSE", "THIRD_PARTY_LICENSES.md" ],
20
+ "version" : "0.8.1879",
21
21
  "publishConfig" : {
22
22
  "access" : "public",
23
23
  "registry" : "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "default": "./kabel/index.mjs"
54
54
  },
55
55
  "./remote": {
56
- "types": "./remote.d.ts",
56
+ "types": "./remote/index.d.ts",
57
57
  "browser": {
58
58
  "import": "./remote/index.mjs",
59
59
  "require": "./remote/index.js",
@@ -64,8 +64,7 @@
64
64
  "./package.json": "./package.json",
65
65
  "./browser/datahike.js": "./browser/datahike.js",
66
66
  "./s3/datahike.js": "./s3/datahike.js",
67
- "./kabel/datahike.js": "./kabel/datahike.js",
68
- "./remote/datahike.js": "./remote/datahike.js"
67
+ "./kabel/datahike.js": "./kabel/datahike.js"
69
68
  },
70
69
  "browser" : "./browser/datahike.js"
71
70
  }
@@ -0,0 +1,178 @@
1
+ import type { Connection, ConnectOptions, Database, DatabaseConfig, DatahikeUuid, Datom, GcOptions, IndexLookupArgs, IndexRangeArgs, Keyword, Metrics, PullOptions, QueryArgs, Schema, Transaction, TransactionReport, UuidValue, VersionRef, WithArgs } from "./core.js";
2
+ /**
3
+ * Returns database state at given time point (Date or transaction ID).
4
+ */
5
+ export declare function asOf(arg0: Database, arg1: number | Date): Promise<Database>;
6
+ /**
7
+ * Create a new branch from an existing branch or commit. Secondary indices are CoW-branched automatically.
8
+ */
9
+ export declare function branch(conn: Connection, from: VersionRef, newBranch: Keyword): Promise<unknown>;
10
+ /**
11
+ * Load the database at a branch head. First argument can be a connection, db value, or raw store.
12
+ */
13
+ export declare function branchAsDb(source: Connection | Database, branch: Keyword): Promise<Database | null>;
14
+ /**
15
+ * List all known branch names. Returns set of keywords.
16
+ */
17
+ export declare function branches(conn: Connection): Promise<Array<Keyword>>;
18
+ /**
19
+ * Load the database at a specific commit. First argument can be a connection, db value, or raw store.
20
+ */
21
+ export declare function commitAsDb(source: Connection | Database, commit: DatahikeUuid): Promise<Database | null>;
22
+ /**
23
+ * Retrieve the commit-id for this database value.
24
+ */
25
+ export declare function commitId(db: Database): Promise<UuidValue | null>;
26
+ /**
27
+ * Connects to a Datahike database via configuration map.
28
+ */
29
+ export declare function connect(config: DatabaseConfig): Promise<Connection>;
30
+ export declare function connect(config: DatabaseConfig, opts: ConnectOptions): Promise<Connection>;
31
+ export declare function connect(): Promise<Connection>;
32
+ /**
33
+ * Creates a database via configuration map.
34
+ */
35
+ export declare function createDatabase(arg0: DatabaseConfig): Promise<DatabaseConfig>;
36
+ export declare function createDatabase(): Promise<DatabaseConfig>;
37
+ /**
38
+ * Checks if a database exists via configuration map.
39
+ */
40
+ export declare function databaseExists(arg0: DatabaseConfig): Promise<boolean>;
41
+ export declare function databaseExists(): Promise<boolean>;
42
+ /**
43
+ * Index lookup. Returns sequence of datoms matching index components.
44
+ */
45
+ export declare function datoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | IndexLookupArgs): Promise<Datom[] | null>;
46
+ export declare function datoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array<any>): Promise<Datom[] | null>;
47
+ /**
48
+ * Returns the underlying immutable database value from a connection. Prefer using @conn directly.
49
+ */
50
+ export declare function db(conn: Connection): Promise<Database>;
51
+ /**
52
+ * Remove a branch. The branch data remains accessible until the next GC.
53
+ */
54
+ export declare function deleteBranch(conn: Connection, branch: Keyword): Promise<unknown>;
55
+ /**
56
+ * Deletes a database given via configuration map.
57
+ */
58
+ export declare function deleteDatabase(arg0: DatabaseConfig): Promise<any>;
59
+ export declare function deleteDatabase(): Promise<any>;
60
+ /**
61
+ * Retrieves an entity by its id. Returns lazy map-like structure.
62
+ */
63
+ export declare function entity(db: Database, eid: number | [string, any] | string | any): Promise<any>;
64
+ /**
65
+ * Returns database that entity was created from.
66
+ */
67
+ export declare function entityDb(arg0: any): Promise<Database>;
68
+ /**
69
+ * Invokes garbage collection on connection's store. Removes old snapshots before given time point. `:min-age-ms` spares anything written more recently than that, which is what makes collecting from outside the writer process possible — it must exceed the longest values-then-pointer window any writer can have. When omitted it defaults to 0 under an exclusive local writer (`:writer {:backend :self :writer-ownership :exclusive}`) and to 15 minutes under a shared or remote writer, where another process's commit in flight is invisible to this collector. The default is a bound on one awaited request, not a guarantee: size an explicit value above your longest in-flight window plus the largest clock difference between your processes (the stamps it compares against are each writer's own). Pass `{:min-age-ms 0}` explicitly to sweep without a floor.
70
+ */
71
+ export declare function gcStorage(conn: Connection, removeBefore: number | Date, options: GcOptions): Promise<unknown[]>;
72
+ export declare function gcStorage(conn: Connection, removeBefore: number | Date): Promise<unknown[]>;
73
+ export declare function gcStorage(conn: Connection): Promise<unknown[]>;
74
+ /**
75
+ * Returns full historical state of database including all assertions and retractions.
76
+ */
77
+ export declare function history(arg0: Database): Promise<Database>;
78
+ /**
79
+ * Returns part of :avet index between start and end values.
80
+ */
81
+ export declare function indexRange(db: Database, options: IndexRangeArgs): Promise<Datom[]>;
82
+ /**
83
+ * Load entities directly (bulk load).
84
+ */
85
+ export declare function loadEntities(arg0: Connection, arg1: Transaction[]): Promise<any>;
86
+ /**
87
+ * Create a merge commit combining the current branch with parent branches/commits. The caller provides the merged tx-data. Routed through the writer for serialization. Blocks until committed. WARNING: Do not call from listener callbacks — use merge-db! instead to avoid deadlocks.
88
+ */
89
+ export declare function mergeDb(arg0: Connection, arg1: Array<any>, arg2: Transaction[]): Promise<TransactionReport>;
90
+ export declare function mergeDb(arg0: Connection, arg1: Array<any>, arg2: Transaction[], arg3: any): Promise<TransactionReport>;
91
+ /**
92
+ * Returns database metrics: datom counts overall, per attribute and for the indexed (AVET) attributes, plus the same for history when kept. Computed from the indices' subtree counts — O(#attributes · log n) — so it is cheap on a large database. `{:per-entity-counts? true}` adds `:per-entity-counts`, a walk over every datom with one map entry per entity.
93
+ */
94
+ export declare function metrics(arg0: Database): Promise<Metrics>;
95
+ export declare function metrics(arg0: Database, arg1: Record<string, any>): Promise<Metrics>;
96
+ /**
97
+ * Retrieve parent commit ids from this database value.
98
+ */
99
+ export declare function parentCommitIds(db: Database): Promise<UuidValue[] | null>;
100
+ /**
101
+ * Fetches data using recursive declarative pull pattern.
102
+ */
103
+ export declare function pull<T extends Record<string, any> = Record<string, any>>(db: Database, patternOrOptions: PullOptions): Promise<T | null>;
104
+ export declare function pull<T extends Record<string, any> = Record<string, any>>(db: Database, patternOrOptions: Array<any>, eid: number | [string, any] | string): Promise<T | null>;
105
+ /**
106
+ * Same as pull, but accepts sequence of ids and returns sequence of maps.
107
+ */
108
+ export declare function pullMany<T extends Record<string, any> = Record<string, any>>(db: Database, patternOrOptions: PullOptions): Promise<T[]>;
109
+ export declare function pullMany<T extends Record<string, any> = Record<string, any>>(db: Database, patternOrOptions: Array<any>, eids: Array<number | [string, any] | string>): Promise<T[]>;
110
+ /**
111
+ * Executes a datalog query.
112
+ */
113
+ export declare function q<T = unknown>(query: QueryArgs): Promise<T>;
114
+ export declare function q<T = unknown>(query: Array<any> | Record<string, any> | string, ...inputs: Array<any>): Promise<T>;
115
+ /**
116
+ * Executes query and returns execution statistics.
117
+ */
118
+ export declare function queryStats(query: QueryArgs): Promise<Record<string, any>>;
119
+ export declare function queryStats(query: Array<any> | Record<string, any>, ...inputs: Array<any>): Promise<Record<string, any>>;
120
+ /**
121
+ * Releases a database connection.
122
+ */
123
+ export declare function release(conn: Connection): Promise<null>;
124
+ export declare function release(conn: Connection, releaseAll: any): Promise<null>;
125
+ /**
126
+ * Returns reverse schema definition (attribute id to ident mapping).
127
+ */
128
+ export declare function reverseSchema(arg0: Database): Promise<Record<string, any>>;
129
+ /**
130
+ * Like seek-datoms, but iterates BACKWARDS: datoms <= the given components, descending to the beginning of the index. Lazy on the persistent-sorted-set index — the primitive for windowed backwards pagination (latest-N, N-before-cursor).
131
+ */
132
+ export declare function rseekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | IndexLookupArgs): Promise<Datom[] | null>;
133
+ export declare function rseekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array<any>): Promise<Datom[] | null>;
134
+ /**
135
+ * Returns current schema definition.
136
+ */
137
+ export declare function schema(arg0: Database): Promise<Schema>;
138
+ /**
139
+ * Like datoms, but returns datoms starting from specified components through end of index.
140
+ */
141
+ export declare function seekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | IndexLookupArgs): Promise<Datom[] | null>;
142
+ export declare function seekDatoms(db: Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array<any>): Promise<Datom[] | null>;
143
+ /**
144
+ * Returns database state since given time point (Date or transaction ID). Contains only datoms added since that point.
145
+ */
146
+ export declare function since(arg0: Database, arg1: number | Date): Promise<Database>;
147
+ /**
148
+ * Applies transaction to the database and updates connection. Blocks until committed. WARNING: Do not call from listener callbacks or transaction functions — use transact! instead to avoid deadlocks.
149
+ */
150
+ export declare function transact(arg0: Connection, arg1: Transaction[] | WithArgs): Promise<TransactionReport>;
151
+ /**
152
+ * Strip any valid-time markers from `db` so the full vt-history is
153
+ * visible. Idempotent. Does not unwrap an existing FilteredDB; to
154
+ * drop an active filter, start from the unwrapped db.
155
+ */
156
+ export declare function validAll(arg0: Database): Promise<Database>;
157
+ /**
158
+ * Tag `db` with a `:datahike/valid-at` marker so vt-aware secondary
159
+ * indices push the filter through `-search-at-vt`. Valid-time is a
160
+ * secondary-index axis; regular datalog patterns still require the
161
+ * built-in `(valid-at ?tx ?at)` rule to filter by vt explicitly.
162
+ */
163
+ export declare function validAt(arg0: Database, arg1: any): Promise<Database>;
164
+ /**
165
+ * Filter `db` to datoms whose asserting tx's vt-window overlaps the
166
+ * half-open interval `[from, to)`. SQL:2011 `FOR VALID_TIME BETWEEN
167
+ * from AND to` maps to this. Carries
168
+ * `:datahike/valid-between [from to]` on the result for vt-aware
169
+ * secondary-index pushdown.
170
+ */
171
+ export declare function validBetween(arg0: Database, arg1: any, arg2: any): Promise<Database>;
172
+ /**
173
+ * Filter `db` to datoms whose tx's vt-window is *fully contained*
174
+ * in `[from, to)`. Stricter than `valid-between` — overlapping
175
+ * windows that extend past either endpoint are excluded. Useful
176
+ * for 'corrections wholly within Q2' style queries.
177
+ */
178
+ export declare function validDuring(arg0: Database, arg1: any, arg2: any): Promise<Database>;
@@ -0,0 +1,133 @@
1
+ declare const uuidSymbol: unique symbol;
2
+ export type Keyword = `:${string}`;
3
+ export type Attribute = Keyword;
4
+ export type UuidValue = string;
5
+ export interface DatahikeUuid {
6
+ readonly [uuidSymbol]: true;
7
+ }
8
+ export type BranchName = Keyword;
9
+ export type VersionRef = BranchName | DatahikeUuid;
10
+ export interface StoreConfig {
11
+ backend: Keyword;
12
+ id?: DatahikeUuid;
13
+ path?: string;
14
+ [key: string]: any;
15
+ }
16
+ export interface WriterConfig {
17
+ backend: Keyword;
18
+ [key: string]: any;
19
+ }
20
+ export interface ConnectOptions {
21
+ "sync?"?: boolean;
22
+ [key: string]: any;
23
+ }
24
+ export interface DatabaseConfig {
25
+ store: StoreConfig;
26
+ writer?: WriterConfig;
27
+ branch?: Keyword;
28
+ "keep-history?"?: boolean;
29
+ "schema-flexibility"?: ":read" | ":write";
30
+ "initial-tx"?: Transaction[];
31
+ name?: string;
32
+ "remote-peer"?: RemotePeer;
33
+ [key: string]: any;
34
+ }
35
+ export interface RemotePeer {
36
+ backend: ":datahike-server";
37
+ url: string;
38
+ token?: string;
39
+ [key: string]: any;
40
+ }
41
+ declare const connectionBrand: unique symbol;
42
+ export interface Connection {
43
+ readonly [connectionBrand]: true;
44
+ }
45
+ declare const databaseBrand: unique symbol;
46
+ export interface Database {
47
+ readonly [databaseBrand]: true;
48
+ }
49
+ export type EntityId = number | string | [Attribute, any];
50
+ export type EntityMap = Record<string, any>;
51
+ export type Transaction = [":db/add", EntityId, Attribute, any] | [":db/retract", EntityId, Attribute, any] | [Keyword, ...any[]] | EntityMap;
52
+ export interface WithArgs {
53
+ "tx-data": Transaction[];
54
+ "tx-meta"?: any;
55
+ }
56
+ export interface QueryArgs {
57
+ query: string | any[] | Record<string, any>;
58
+ args?: any[];
59
+ limit?: number;
60
+ offset?: number;
61
+ }
62
+ export interface PullOptions {
63
+ selector: any[];
64
+ eid: EntityId | EntityId[];
65
+ }
66
+ export type Index = ":eavt" | ":aevt" | ":avet";
67
+ export interface IndexLookupArgs {
68
+ index: Index;
69
+ components?: any[] | null;
70
+ }
71
+ export interface IndexRangeArgs {
72
+ attrid: Attribute;
73
+ start: any;
74
+ end: any;
75
+ }
76
+ export interface Datom {
77
+ e: number;
78
+ a: Attribute;
79
+ v: any;
80
+ tx: number;
81
+ added: boolean;
82
+ }
83
+ export interface TransactionReport {
84
+ "db-before": Database | null;
85
+ "db-after": Database;
86
+ "tx-data": Datom[];
87
+ tempids: {
88
+ [key: string]: number;
89
+ };
90
+ "tx-meta"?: any;
91
+ "commit-id"?: UuidValue;
92
+ }
93
+ export interface Schema {
94
+ [key: string]: {
95
+ "db/valueType": Keyword;
96
+ "db/cardinality": Keyword;
97
+ "db/unique"?: Keyword;
98
+ "db/index"?: boolean;
99
+ [key: string]: any;
100
+ };
101
+ }
102
+ export interface Metrics {
103
+ count: number;
104
+ "avet-count": number;
105
+ "per-attr-counts": Record<string, number>;
106
+ "per-entity-counts"?: Record<string, number>;
107
+ "temporal-count"?: number;
108
+ "temporal-avet-count"?: number;
109
+ }
110
+ export interface GcOptions {
111
+ "min-age-ms"?: number;
112
+ }
113
+ export interface RemoteReport {
114
+ "db-after"?: Database;
115
+ "db-before"?: null;
116
+ "tx-data"?: Datom[];
117
+ tempids?: {
118
+ [key: string]: number;
119
+ };
120
+ "commit-id"?: UuidValue;
121
+ resync?: boolean;
122
+ deleted?: boolean;
123
+ truncated?: boolean;
124
+ error?: Error;
125
+ status?: number;
126
+ }
127
+ export declare function request(route: string, readable: boolean, args: unknown[], create?: boolean): Promise<any>;
128
+ export declare function uuid(value: string): DatahikeUuid;
129
+ export declare function randomUuid(): DatahikeUuid;
130
+ export declare function isPromise(value: any): value is Promise<unknown>;
131
+ export declare function listen(conn: Connection, callback: (report: RemoteReport) => void): string;
132
+ export declare function unlisten(conn: Connection, key: string): void;
133
+ export {};
@@ -0,0 +1,66 @@
1
+ import { isPromise, listen, randomUuid, unlisten, uuid } from "./core.js";
2
+ export * from "./api.generated.js";
3
+ export type * from "./core.js";
4
+ export { isPromise, listen, randomUuid, unlisten, uuid };
5
+ declare const _default: {
6
+ isPromise: typeof isPromise;
7
+ listen: typeof listen;
8
+ randomUuid: typeof randomUuid;
9
+ unlisten: typeof unlisten;
10
+ uuid: typeof uuid;
11
+ asOf(arg0: import("./core.js").Database, arg1: number | Date): Promise<import("./core.js").Database>;
12
+ branch(conn: import("./core.js").Connection, from: import("./core.js").VersionRef, newBranch: import("./core.js").Keyword): Promise<unknown>;
13
+ branchAsDb(source: import("./core.js").Connection | import("./core.js").Database, branch: import("./core.js").Keyword): Promise<import("./core.js").Database | null>;
14
+ branches(conn: import("./core.js").Connection): Promise<Array<import("./core.js").Keyword>>;
15
+ commitAsDb(source: import("./core.js").Connection | import("./core.js").Database, commit: import("./core.js").DatahikeUuid): Promise<import("./core.js").Database | null>;
16
+ commitId(db: import("./core.js").Database): Promise<import("./core.js").UuidValue | null>;
17
+ connect(config: import("./core.js").DatabaseConfig): Promise<import("./core.js").Connection>;
18
+ connect(config: import("./core.js").DatabaseConfig, opts: import("./core.js").ConnectOptions): Promise<import("./core.js").Connection>;
19
+ connect(): Promise<import("./core.js").Connection>;
20
+ createDatabase(arg0: import("./core.js").DatabaseConfig): Promise<import("./core.js").DatabaseConfig>;
21
+ createDatabase(): Promise<import("./core.js").DatabaseConfig>;
22
+ databaseExists(arg0: import("./core.js").DatabaseConfig): Promise<boolean>;
23
+ databaseExists(): Promise<boolean>;
24
+ datoms(db: import("./core.js").Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | import("./core.js").IndexLookupArgs): Promise<import("./core.js").Datom[] | null>;
25
+ datoms(db: import("./core.js").Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array<any>): Promise<import("./core.js").Datom[] | null>;
26
+ db(conn: import("./core.js").Connection): Promise<import("./core.js").Database>;
27
+ deleteBranch(conn: import("./core.js").Connection, branch: import("./core.js").Keyword): Promise<unknown>;
28
+ deleteDatabase(arg0: import("./core.js").DatabaseConfig): Promise<any>;
29
+ deleteDatabase(): Promise<any>;
30
+ entity(db: import("./core.js").Database, eid: number | [string, any] | string | any): Promise<any>;
31
+ entityDb(arg0: any): Promise<import("./core.js").Database>;
32
+ gcStorage(conn: import("./core.js").Connection, removeBefore: number | Date, options: import("./core.js").GcOptions): Promise<unknown[]>;
33
+ gcStorage(conn: import("./core.js").Connection, removeBefore: number | Date): Promise<unknown[]>;
34
+ gcStorage(conn: import("./core.js").Connection): Promise<unknown[]>;
35
+ history(arg0: import("./core.js").Database): Promise<import("./core.js").Database>;
36
+ indexRange(db: import("./core.js").Database, options: import("./core.js").IndexRangeArgs): Promise<import("./core.js").Datom[]>;
37
+ loadEntities(arg0: import("./core.js").Connection, arg1: import("./core.js").Transaction[]): Promise<any>;
38
+ mergeDb(arg0: import("./core.js").Connection, arg1: Array<any>, arg2: import("./core.js").Transaction[]): Promise<import("./core.js").TransactionReport>;
39
+ mergeDb(arg0: import("./core.js").Connection, arg1: Array<any>, arg2: import("./core.js").Transaction[], arg3: any): Promise<import("./core.js").TransactionReport>;
40
+ metrics(arg0: import("./core.js").Database): Promise<import("./core.js").Metrics>;
41
+ metrics(arg0: import("./core.js").Database, arg1: Record<string, any>): Promise<import("./core.js").Metrics>;
42
+ parentCommitIds(db: import("./core.js").Database): Promise<import("./core.js").UuidValue[] | null>;
43
+ pull<T extends Record<string, any> = Record<string, any>>(db: import("./core.js").Database, patternOrOptions: import("./core.js").PullOptions): Promise<T | null>;
44
+ pull<T extends Record<string, any> = Record<string, any>>(db: import("./core.js").Database, patternOrOptions: Array<any>, eid: number | [string, any] | string): Promise<T | null>;
45
+ pullMany<T extends Record<string, any> = Record<string, any>>(db: import("./core.js").Database, patternOrOptions: import("./core.js").PullOptions): Promise<T[]>;
46
+ pullMany<T extends Record<string, any> = Record<string, any>>(db: import("./core.js").Database, patternOrOptions: Array<any>, eids: Array<number | [string, any] | string>): Promise<T[]>;
47
+ q<T = unknown>(query: import("./core.js").QueryArgs): Promise<T>;
48
+ q<T = unknown>(query: Array<any> | Record<string, any> | string, ...inputs: Array<any>): Promise<T>;
49
+ queryStats(query: import("./core.js").QueryArgs): Promise<Record<string, any>>;
50
+ queryStats(query: Array<any> | Record<string, any>, ...inputs: Array<any>): Promise<Record<string, any>>;
51
+ release(conn: import("./core.js").Connection): Promise<null>;
52
+ release(conn: import("./core.js").Connection, releaseAll: any): Promise<null>;
53
+ reverseSchema(arg0: import("./core.js").Database): Promise<Record<string, any>>;
54
+ rseekDatoms(db: import("./core.js").Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | import("./core.js").IndexLookupArgs): Promise<import("./core.js").Datom[] | null>;
55
+ rseekDatoms(db: import("./core.js").Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array<any>): Promise<import("./core.js").Datom[] | null>;
56
+ schema(arg0: import("./core.js").Database): Promise<import("./core.js").Schema>;
57
+ seekDatoms(db: import("./core.js").Database, indexOrOptions: ":eavt" | ":aevt" | ":avet" | import("./core.js").IndexLookupArgs): Promise<import("./core.js").Datom[] | null>;
58
+ seekDatoms(db: import("./core.js").Database, indexOrOptions: ":eavt" | ":aevt" | ":avet", ...components: Array<any>): Promise<import("./core.js").Datom[] | null>;
59
+ since(arg0: import("./core.js").Database, arg1: number | Date): Promise<import("./core.js").Database>;
60
+ transact(arg0: import("./core.js").Connection, arg1: import("./core.js").Transaction[] | import("./core.js").WithArgs): Promise<import("./core.js").TransactionReport>;
61
+ validAll(arg0: import("./core.js").Database): Promise<import("./core.js").Database>;
62
+ validAt(arg0: import("./core.js").Database, arg1: any): Promise<import("./core.js").Database>;
63
+ validBetween(arg0: import("./core.js").Database, arg1: any, arg2: any): Promise<import("./core.js").Database>;
64
+ validDuring(arg0: import("./core.js").Database, arg1: any, arg2: any): Promise<import("./core.js").Database>;
65
+ };
66
+ export default _default;