@anysoftinc/anydb-sdk 0.3.0 → 0.5.0
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.
- package/README.md +43 -0
- package/dist/anydb.datascript.core.js +336 -0
- package/dist/anydb.datascript.rules.js +29 -0
- package/dist/anydb.datascript.schema.js +35 -0
- package/dist/auth.d.ts +28 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +52 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +59 -0
- package/dist/cljs.core.js +38752 -0
- package/dist/cljs.reader.js +450 -0
- package/dist/cljs.tools.reader.edn.js +945 -0
- package/dist/cljs.tools.reader.impl.commons.js +205 -0
- package/dist/cljs.tools.reader.impl.errors.js +429 -0
- package/dist/cljs.tools.reader.impl.inspect.js +170 -0
- package/dist/cljs.tools.reader.impl.utils.js +413 -0
- package/dist/cljs.tools.reader.js +1815 -0
- package/dist/cljs.tools.reader.reader_types.js +826 -0
- package/dist/cljs_env.js +7672 -0
- package/dist/clojure.data.js +307 -0
- package/dist/clojure.edn.js +107 -0
- package/dist/clojure.set.js +394 -0
- package/dist/clojure.string.js +490 -0
- package/dist/clojure.walk.js +144 -0
- package/dist/datascript-backend.js +2 -2
- package/dist/datascript.built_ins.js +680 -0
- package/dist/datascript.conn.js +814 -0
- package/dist/datascript.core.js +1285 -0
- package/dist/datascript.db.js +4058 -0
- package/dist/datascript.impl.entity.js +588 -0
- package/dist/datascript.lru.js +213 -0
- package/dist/datascript.parser.js +8598 -0
- package/dist/datascript.pull_api.js +2287 -0
- package/dist/datascript.pull_parser.js +865 -0
- package/dist/datascript.query.js +2785 -0
- package/dist/datascript.serialize.js +352 -0
- package/dist/datascript.storage.js +50 -0
- package/dist/datascript.util.js +82 -0
- package/dist/extend_clj.core.js +134 -0
- package/dist/me.tonsky.persistent_sorted_set.arrays.js +54 -0
- package/dist/me.tonsky.persistent_sorted_set.js +2485 -0
- package/dist/nextauth-adapter.d.ts.map +1 -1
- package/dist/nextauth-adapter.js +8 -11
- package/package.json +10 -4
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
var $CLJS = require("./cljs_env");
|
|
2
|
+
var $jscomp = $CLJS.$jscomp;
|
|
3
|
+
var COMPILED = false;
|
|
4
|
+
require("./cljs.core.js");
|
|
5
|
+
require("./datascript.db.js");
|
|
6
|
+
var anydb=$CLJS.anydb || ($CLJS.anydb = {});
|
|
7
|
+
var clojure=$CLJS.clojure || ($CLJS.clojure = {});
|
|
8
|
+
var cljs=$CLJS.cljs || ($CLJS.cljs = {});
|
|
9
|
+
var goog=$CLJS.goog || ($CLJS.goog = {});
|
|
10
|
+
var datascript=$CLJS.datascript || ($CLJS.datascript = {});
|
|
11
|
+
var me=$CLJS.me || ($CLJS.me = {});
|
|
12
|
+
var extend_clj=$CLJS.extend_clj || ($CLJS.extend_clj = {});
|
|
13
|
+
|
|
14
|
+
$CLJS.SHADOW_ENV.setLoaded("datascript.impl.entity.js");
|
|
15
|
+
|
|
16
|
+
goog.provide('datascript.impl.entity');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
datascript.impl.entity.entid = (function datascript$impl$entity$entid(db,eid){
|
|
23
|
+
if(((typeof eid === 'number') || (((cljs.core.sequential_QMARK_(eid)) || ((eid instanceof cljs.core.Keyword)))))){
|
|
24
|
+
return datascript.db.entid(db,eid);
|
|
25
|
+
} else {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
datascript.impl.entity.entity = (function datascript$impl$entity$entity(db,eid){
|
|
30
|
+
if(datascript.db.db_QMARK_(db)){
|
|
31
|
+
} else {
|
|
32
|
+
throw (new Error("Assert failed: (db/db? db)"));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var temp__5804__auto__ = datascript.impl.entity.entid(db,eid);
|
|
36
|
+
if(cljs.core.truth_(temp__5804__auto__)){
|
|
37
|
+
var e = temp__5804__auto__;
|
|
38
|
+
if(datascript.db.numeric_eid_exists_QMARK_(db,e)){
|
|
39
|
+
var G__11514 = db;
|
|
40
|
+
var G__11515 = e;
|
|
41
|
+
var G__11516 = cljs.core.volatile_BANG_(false);
|
|
42
|
+
var G__11517 = cljs.core.volatile_BANG_(cljs.core.PersistentArrayMap.EMPTY);
|
|
43
|
+
return (datascript.impl.entity.__GT_Entity.cljs$core$IFn$_invoke$arity$4 ? datascript.impl.entity.__GT_Entity.cljs$core$IFn$_invoke$arity$4(G__11514,G__11515,G__11516,G__11517) : datascript.impl.entity.__GT_Entity.call(null,G__11514,G__11515,G__11516,G__11517));
|
|
44
|
+
} else {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
datascript.impl.entity.entity_attr = (function datascript$impl$entity$entity_attr(db,a,datoms){
|
|
52
|
+
if(datascript.db.multival_QMARK_(db,a)){
|
|
53
|
+
if(datascript.db.ref_QMARK_(db,a)){
|
|
54
|
+
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__11520_SHARP_,p2__11521_SHARP_){
|
|
55
|
+
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__11520_SHARP_,datascript.impl.entity.entity(db,new cljs.core.Keyword(null,"v","v",21465059).cljs$core$IFn$_invoke$arity$1(p2__11521_SHARP_)));
|
|
56
|
+
}),cljs.core.PersistentHashSet.EMPTY,datoms);
|
|
57
|
+
} else {
|
|
58
|
+
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__11523_SHARP_,p2__11524_SHARP_){
|
|
59
|
+
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__11523_SHARP_,new cljs.core.Keyword(null,"v","v",21465059).cljs$core$IFn$_invoke$arity$1(p2__11524_SHARP_));
|
|
60
|
+
}),cljs.core.PersistentHashSet.EMPTY,datoms);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
if(datascript.db.ref_QMARK_(db,a)){
|
|
64
|
+
return datascript.impl.entity.entity(db,new cljs.core.Keyword(null,"v","v",21465059).cljs$core$IFn$_invoke$arity$1(cljs.core.first(datoms)));
|
|
65
|
+
} else {
|
|
66
|
+
return new cljs.core.Keyword(null,"v","v",21465059).cljs$core$IFn$_invoke$arity$1(cljs.core.first(datoms));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
datascript.impl.entity._lookup_backwards = (function datascript$impl$entity$_lookup_backwards(db,eid,attr,not_found){
|
|
71
|
+
var temp__5802__auto__ = cljs.core.not_empty(datascript.db._search(db,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,attr,eid], null)));
|
|
72
|
+
if(cljs.core.truth_(temp__5802__auto__)){
|
|
73
|
+
var datoms = temp__5802__auto__;
|
|
74
|
+
if(datascript.db.component_QMARK_(db,attr)){
|
|
75
|
+
return datascript.impl.entity.entity(db,new cljs.core.Keyword(null,"e","e",1381269198).cljs$core$IFn$_invoke$arity$1(cljs.core.first(datoms)));
|
|
76
|
+
} else {
|
|
77
|
+
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (p1__11526_SHARP_,p2__11527_SHARP_){
|
|
78
|
+
return cljs.core.conj.cljs$core$IFn$_invoke$arity$2(p1__11526_SHARP_,datascript.impl.entity.entity(db,new cljs.core.Keyword(null,"e","e",1381269198).cljs$core$IFn$_invoke$arity$1(p2__11527_SHARP_)));
|
|
79
|
+
}),cljs.core.PersistentHashSet.EMPTY,datoms);
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
return not_found;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
datascript.impl.entity.multival__GT_js = (function datascript$impl$entity$multival__GT_js(val){
|
|
86
|
+
if(cljs.core.truth_(val)){
|
|
87
|
+
return cljs.core.to_array(val);
|
|
88
|
+
} else {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
datascript.impl.entity.js_seq = (function datascript$impl$entity$js_seq(e){
|
|
93
|
+
(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(e) : datascript.impl.entity.touch.call(null,e));
|
|
94
|
+
|
|
95
|
+
var iter__5480__auto__ = (function datascript$impl$entity$js_seq_$_iter__11549(s__11550){
|
|
96
|
+
return (new cljs.core.LazySeq(null,(function (){
|
|
97
|
+
var s__11550__$1 = s__11550;
|
|
98
|
+
while(true){
|
|
99
|
+
var temp__5804__auto__ = cljs.core.seq(s__11550__$1);
|
|
100
|
+
if(temp__5804__auto__){
|
|
101
|
+
var s__11550__$2 = temp__5804__auto__;
|
|
102
|
+
if(cljs.core.chunked_seq_QMARK_(s__11550__$2)){
|
|
103
|
+
var c__5478__auto__ = cljs.core.chunk_first(s__11550__$2);
|
|
104
|
+
var size__5479__auto__ = cljs.core.count(c__5478__auto__);
|
|
105
|
+
var b__11552 = cljs.core.chunk_buffer(size__5479__auto__);
|
|
106
|
+
if((function (){var i__11551 = (0);
|
|
107
|
+
while(true){
|
|
108
|
+
if((i__11551 < size__5479__auto__)){
|
|
109
|
+
var vec__11553 = cljs.core._nth(c__5478__auto__,i__11551);
|
|
110
|
+
var a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11553,(0),null);
|
|
111
|
+
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11553,(1),null);
|
|
112
|
+
cljs.core.chunk_append(b__11552,((datascript.db.multival_QMARK_(e.db,a))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,datascript.impl.entity.multival__GT_js(v)], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,v], null)));
|
|
113
|
+
|
|
114
|
+
var G__11738 = (i__11551 + (1));
|
|
115
|
+
i__11551 = G__11738;
|
|
116
|
+
continue;
|
|
117
|
+
} else {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
})()){
|
|
123
|
+
return cljs.core.chunk_cons(cljs.core.chunk(b__11552),datascript$impl$entity$js_seq_$_iter__11549(cljs.core.chunk_rest(s__11550__$2)));
|
|
124
|
+
} else {
|
|
125
|
+
return cljs.core.chunk_cons(cljs.core.chunk(b__11552),null);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
var vec__11557 = cljs.core.first(s__11550__$2);
|
|
129
|
+
var a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11557,(0),null);
|
|
130
|
+
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11557,(1),null);
|
|
131
|
+
return cljs.core.cons(((datascript.db.multival_QMARK_(e.db,a))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,datascript.impl.entity.multival__GT_js(v)], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,v], null)),datascript$impl$entity$js_seq_$_iter__11549(cljs.core.rest(s__11550__$2)));
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}),null,null));
|
|
139
|
+
});
|
|
140
|
+
return iter__5480__auto__(cljs.core.deref(e.cache));
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @constructor
|
|
145
|
+
* @implements {cljs.core.IEquiv}
|
|
146
|
+
* @implements {cljs.core.IHash}
|
|
147
|
+
* @implements {cljs.core.IFn}
|
|
148
|
+
* @implements {cljs.core.ICounted}
|
|
149
|
+
* @implements {cljs.core.ISeqable}
|
|
150
|
+
* @implements {cljs.core.IPrintWithWriter}
|
|
151
|
+
* @implements {cljs.core.IAssociative}
|
|
152
|
+
* @implements {cljs.core.ILookup}
|
|
153
|
+
*/
|
|
154
|
+
datascript.impl.entity.Entity = (function (db,eid,touched,cache){
|
|
155
|
+
this.db = db;
|
|
156
|
+
this.eid = eid;
|
|
157
|
+
this.touched = touched;
|
|
158
|
+
this.cache = cache;
|
|
159
|
+
this.cljs$lang$protocol_mask$partition0$ = 2162164483;
|
|
160
|
+
this.cljs$lang$protocol_mask$partition1$ = 0;
|
|
161
|
+
});
|
|
162
|
+
(datascript.impl.entity.Entity.prototype.entry_set = (function (){
|
|
163
|
+
var self__ = this;
|
|
164
|
+
var this$ = this;
|
|
165
|
+
return cljs.core.to_array(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.to_array,datascript.impl.entity.js_seq(this$)));
|
|
166
|
+
}));
|
|
167
|
+
|
|
168
|
+
(datascript.impl.entity.Entity.prototype.forEach = (function() {
|
|
169
|
+
var G__11742 = null;
|
|
170
|
+
var G__11742__1 = (function (f){
|
|
171
|
+
var self__ = this;
|
|
172
|
+
var this$ = this;
|
|
173
|
+
var seq__11572 = cljs.core.seq(datascript.impl.entity.js_seq(this$));
|
|
174
|
+
var chunk__11573 = null;
|
|
175
|
+
var count__11574 = (0);
|
|
176
|
+
var i__11575 = (0);
|
|
177
|
+
while(true){
|
|
178
|
+
if((i__11575 < count__11574)){
|
|
179
|
+
var vec__11590 = chunk__11573.cljs$core$IIndexed$_nth$arity$2(null,i__11575);
|
|
180
|
+
var a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11590,(0),null);
|
|
181
|
+
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11590,(1),null);
|
|
182
|
+
(f.cljs$core$IFn$_invoke$arity$3 ? f.cljs$core$IFn$_invoke$arity$3(v,a,this$) : f.call(null,v,a,this$));
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
var G__11750 = seq__11572;
|
|
186
|
+
var G__11751 = chunk__11573;
|
|
187
|
+
var G__11752 = count__11574;
|
|
188
|
+
var G__11753 = (i__11575 + (1));
|
|
189
|
+
seq__11572 = G__11750;
|
|
190
|
+
chunk__11573 = G__11751;
|
|
191
|
+
count__11574 = G__11752;
|
|
192
|
+
i__11575 = G__11753;
|
|
193
|
+
continue;
|
|
194
|
+
} else {
|
|
195
|
+
var temp__5804__auto__ = cljs.core.seq(seq__11572);
|
|
196
|
+
if(temp__5804__auto__){
|
|
197
|
+
var seq__11572__$1 = temp__5804__auto__;
|
|
198
|
+
if(cljs.core.chunked_seq_QMARK_(seq__11572__$1)){
|
|
199
|
+
var c__5525__auto__ = cljs.core.chunk_first(seq__11572__$1);
|
|
200
|
+
var G__11754 = cljs.core.chunk_rest(seq__11572__$1);
|
|
201
|
+
var G__11755 = c__5525__auto__;
|
|
202
|
+
var G__11756 = cljs.core.count(c__5525__auto__);
|
|
203
|
+
var G__11757 = (0);
|
|
204
|
+
seq__11572 = G__11754;
|
|
205
|
+
chunk__11573 = G__11755;
|
|
206
|
+
count__11574 = G__11756;
|
|
207
|
+
i__11575 = G__11757;
|
|
208
|
+
continue;
|
|
209
|
+
} else {
|
|
210
|
+
var vec__11593 = cljs.core.first(seq__11572__$1);
|
|
211
|
+
var a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11593,(0),null);
|
|
212
|
+
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11593,(1),null);
|
|
213
|
+
(f.cljs$core$IFn$_invoke$arity$3 ? f.cljs$core$IFn$_invoke$arity$3(v,a,this$) : f.call(null,v,a,this$));
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
var G__11766 = cljs.core.next(seq__11572__$1);
|
|
217
|
+
var G__11767 = null;
|
|
218
|
+
var G__11768 = (0);
|
|
219
|
+
var G__11769 = (0);
|
|
220
|
+
seq__11572 = G__11766;
|
|
221
|
+
chunk__11573 = G__11767;
|
|
222
|
+
count__11574 = G__11768;
|
|
223
|
+
i__11575 = G__11769;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
var G__11742__2 = (function (f,use_as_this){
|
|
234
|
+
var self__ = this;
|
|
235
|
+
var this$ = this;
|
|
236
|
+
var seq__11596 = cljs.core.seq(datascript.impl.entity.js_seq(this$));
|
|
237
|
+
var chunk__11597 = null;
|
|
238
|
+
var count__11598 = (0);
|
|
239
|
+
var i__11599 = (0);
|
|
240
|
+
while(true){
|
|
241
|
+
if((i__11599 < count__11598)){
|
|
242
|
+
var vec__11610 = chunk__11597.cljs$core$IIndexed$_nth$arity$2(null,i__11599);
|
|
243
|
+
var a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11610,(0),null);
|
|
244
|
+
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11610,(1),null);
|
|
245
|
+
f.call(use_as_this,v,a,this$);
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
var G__11776 = seq__11596;
|
|
249
|
+
var G__11777 = chunk__11597;
|
|
250
|
+
var G__11778 = count__11598;
|
|
251
|
+
var G__11779 = (i__11599 + (1));
|
|
252
|
+
seq__11596 = G__11776;
|
|
253
|
+
chunk__11597 = G__11777;
|
|
254
|
+
count__11598 = G__11778;
|
|
255
|
+
i__11599 = G__11779;
|
|
256
|
+
continue;
|
|
257
|
+
} else {
|
|
258
|
+
var temp__5804__auto__ = cljs.core.seq(seq__11596);
|
|
259
|
+
if(temp__5804__auto__){
|
|
260
|
+
var seq__11596__$1 = temp__5804__auto__;
|
|
261
|
+
if(cljs.core.chunked_seq_QMARK_(seq__11596__$1)){
|
|
262
|
+
var c__5525__auto__ = cljs.core.chunk_first(seq__11596__$1);
|
|
263
|
+
var G__11784 = cljs.core.chunk_rest(seq__11596__$1);
|
|
264
|
+
var G__11785 = c__5525__auto__;
|
|
265
|
+
var G__11786 = cljs.core.count(c__5525__auto__);
|
|
266
|
+
var G__11787 = (0);
|
|
267
|
+
seq__11596 = G__11784;
|
|
268
|
+
chunk__11597 = G__11785;
|
|
269
|
+
count__11598 = G__11786;
|
|
270
|
+
i__11599 = G__11787;
|
|
271
|
+
continue;
|
|
272
|
+
} else {
|
|
273
|
+
var vec__11614 = cljs.core.first(seq__11596__$1);
|
|
274
|
+
var a = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11614,(0),null);
|
|
275
|
+
var v = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__11614,(1),null);
|
|
276
|
+
f.call(use_as_this,v,a,this$);
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
var G__11792 = cljs.core.next(seq__11596__$1);
|
|
280
|
+
var G__11793 = null;
|
|
281
|
+
var G__11794 = (0);
|
|
282
|
+
var G__11795 = (0);
|
|
283
|
+
seq__11596 = G__11792;
|
|
284
|
+
chunk__11597 = G__11793;
|
|
285
|
+
count__11598 = G__11794;
|
|
286
|
+
i__11599 = G__11795;
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
G__11742 = function(f,use_as_this){
|
|
297
|
+
switch(arguments.length){
|
|
298
|
+
case 1:
|
|
299
|
+
return G__11742__1.call(this,f);
|
|
300
|
+
case 2:
|
|
301
|
+
return G__11742__2.call(this,f,use_as_this);
|
|
302
|
+
}
|
|
303
|
+
throw(new Error('Invalid arity: ' + arguments.length));
|
|
304
|
+
};
|
|
305
|
+
G__11742.cljs$core$IFn$_invoke$arity$1 = G__11742__1;
|
|
306
|
+
G__11742.cljs$core$IFn$_invoke$arity$2 = G__11742__2;
|
|
307
|
+
return G__11742;
|
|
308
|
+
})()
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
(datascript.impl.entity.Entity.prototype.get = (function (attr){
|
|
312
|
+
var self__ = this;
|
|
313
|
+
var this$ = this;
|
|
314
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(attr,":db/id")){
|
|
315
|
+
return self__.eid;
|
|
316
|
+
} else {
|
|
317
|
+
if(datascript.db.reverse_ref_QMARK_(attr)){
|
|
318
|
+
return datascript.impl.entity.multival__GT_js(datascript.impl.entity._lookup_backwards(self__.db,self__.eid,datascript.db.reverse_ref(attr),null));
|
|
319
|
+
} else {
|
|
320
|
+
var G__11620 = (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2(this$,attr) : datascript.impl.entity.lookup_entity.call(null,this$,attr));
|
|
321
|
+
if(datascript.db.multival_QMARK_(self__.db,attr)){
|
|
322
|
+
return datascript.impl.entity.multival__GT_js(G__11620);
|
|
323
|
+
} else {
|
|
324
|
+
return G__11620;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}));
|
|
329
|
+
|
|
330
|
+
(datascript.impl.entity.Entity.prototype.key_set = (function (){
|
|
331
|
+
var self__ = this;
|
|
332
|
+
var this$ = this;
|
|
333
|
+
return cljs.core.to_array(cljs.core.keys(this$));
|
|
334
|
+
}));
|
|
335
|
+
|
|
336
|
+
(datascript.impl.entity.Entity.prototype.entries = (function (){
|
|
337
|
+
var self__ = this;
|
|
338
|
+
var this$ = this;
|
|
339
|
+
return cljs.core.es6_entries_iterator(datascript.impl.entity.js_seq(this$));
|
|
340
|
+
}));
|
|
341
|
+
|
|
342
|
+
(datascript.impl.entity.Entity.prototype.value_set = (function (){
|
|
343
|
+
var self__ = this;
|
|
344
|
+
var this$ = this;
|
|
345
|
+
return cljs.core.to_array(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.second,datascript.impl.entity.js_seq(this$)));
|
|
346
|
+
}));
|
|
347
|
+
|
|
348
|
+
(datascript.impl.entity.Entity.prototype.toString = (function (){
|
|
349
|
+
var self__ = this;
|
|
350
|
+
var this$ = this;
|
|
351
|
+
return cljs.core.pr_str_STAR_(this$);
|
|
352
|
+
}));
|
|
353
|
+
|
|
354
|
+
(datascript.impl.entity.Entity.prototype.keys = (function (){
|
|
355
|
+
var self__ = this;
|
|
356
|
+
var this$ = this;
|
|
357
|
+
return cljs.core.es6_iterator(cljs.core.keys(this$));
|
|
358
|
+
}));
|
|
359
|
+
|
|
360
|
+
(datascript.impl.entity.Entity.prototype.values = (function (){
|
|
361
|
+
var self__ = this;
|
|
362
|
+
var this$ = this;
|
|
363
|
+
return cljs.core.es6_iterator(cljs.core.map.cljs$core$IFn$_invoke$arity$2(cljs.core.second,datascript.impl.entity.js_seq(this$)));
|
|
364
|
+
}));
|
|
365
|
+
|
|
366
|
+
(datascript.impl.entity.Entity.prototype.equiv = (function (other){
|
|
367
|
+
var self__ = this;
|
|
368
|
+
var this$ = this;
|
|
369
|
+
return (datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2(this$,other) : datascript.impl.entity.equiv_entity.call(null,this$,other));
|
|
370
|
+
}));
|
|
371
|
+
|
|
372
|
+
(datascript.impl.entity.Entity.prototype.has = (function (attr){
|
|
373
|
+
var self__ = this;
|
|
374
|
+
var this$ = this;
|
|
375
|
+
return (!((this$.get(attr) == null)));
|
|
376
|
+
}));
|
|
377
|
+
|
|
378
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$ILookup$_lookup$arity$2 = (function (this$,attr){
|
|
379
|
+
var self__ = this;
|
|
380
|
+
var this$__$1 = this;
|
|
381
|
+
return (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$__$1,attr,null) : datascript.impl.entity.lookup_entity.call(null,this$__$1,attr,null));
|
|
382
|
+
}));
|
|
383
|
+
|
|
384
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$ILookup$_lookup$arity$3 = (function (this$,attr,not_found){
|
|
385
|
+
var self__ = this;
|
|
386
|
+
var this$__$1 = this;
|
|
387
|
+
return (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$__$1,attr,not_found) : datascript.impl.entity.lookup_entity.call(null,this$__$1,attr,not_found));
|
|
388
|
+
}));
|
|
389
|
+
|
|
390
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (_,writer,opts){
|
|
391
|
+
var self__ = this;
|
|
392
|
+
var ___$1 = this;
|
|
393
|
+
return cljs.core._pr_writer(cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(cljs.core.deref(self__.cache),new cljs.core.Keyword("db","id","db/id",-1388397098),self__.eid),writer,opts);
|
|
394
|
+
}));
|
|
395
|
+
|
|
396
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
|
|
397
|
+
var self__ = this;
|
|
398
|
+
var this$__$1 = this;
|
|
399
|
+
(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(this$__$1) : datascript.impl.entity.touch.call(null,this$__$1));
|
|
400
|
+
|
|
401
|
+
return cljs.core.count(cljs.core.deref(self__.cache));
|
|
402
|
+
}));
|
|
403
|
+
|
|
404
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$IHash$_hash$arity$1 = (function (this$){
|
|
405
|
+
var self__ = this;
|
|
406
|
+
var this$__$1 = this;
|
|
407
|
+
return (datascript.impl.entity.hash_entity.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.hash_entity.cljs$core$IFn$_invoke$arity$1(this$__$1) : datascript.impl.entity.hash_entity.call(null,this$__$1));
|
|
408
|
+
}));
|
|
409
|
+
|
|
410
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (this$,o){
|
|
411
|
+
var self__ = this;
|
|
412
|
+
var this$__$1 = this;
|
|
413
|
+
return (datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.equiv_entity.cljs$core$IFn$_invoke$arity$2(this$__$1,o) : datascript.impl.entity.equiv_entity.call(null,this$__$1,o));
|
|
414
|
+
}));
|
|
415
|
+
|
|
416
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$IAssociative$_contains_key_QMARK_$arity$2 = (function (this$,k){
|
|
417
|
+
var self__ = this;
|
|
418
|
+
var this$__$1 = this;
|
|
419
|
+
return cljs.core.not_EQ_.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword("datascript.impl.entity","nf","datascript.impl.entity/nf",-953741353),(datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$__$1,k,new cljs.core.Keyword("datascript.impl.entity","nf","datascript.impl.entity/nf",-953741353)) : datascript.impl.entity.lookup_entity.call(null,this$__$1,k,new cljs.core.Keyword("datascript.impl.entity","nf","datascript.impl.entity/nf",-953741353))));
|
|
420
|
+
}));
|
|
421
|
+
|
|
422
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this$){
|
|
423
|
+
var self__ = this;
|
|
424
|
+
var this$__$1 = this;
|
|
425
|
+
(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(this$__$1) : datascript.impl.entity.touch.call(null,this$__$1));
|
|
426
|
+
|
|
427
|
+
return cljs.core.seq(cljs.core.deref(self__.cache));
|
|
428
|
+
}));
|
|
429
|
+
|
|
430
|
+
(datascript.impl.entity.Entity.prototype.call = (function (unused__10318__auto__){
|
|
431
|
+
var self__ = this;
|
|
432
|
+
var self__ = this;
|
|
433
|
+
var G__11626 = (arguments.length - (1));
|
|
434
|
+
switch (G__11626) {
|
|
435
|
+
case (1):
|
|
436
|
+
return self__.cljs$core$IFn$_invoke$arity$1((arguments[(1)]));
|
|
437
|
+
|
|
438
|
+
break;
|
|
439
|
+
case (2):
|
|
440
|
+
return self__.cljs$core$IFn$_invoke$arity$2((arguments[(1)]),(arguments[(2)]));
|
|
441
|
+
|
|
442
|
+
break;
|
|
443
|
+
default:
|
|
444
|
+
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((arguments.length - (1)))].join('')));
|
|
445
|
+
|
|
446
|
+
}
|
|
447
|
+
}));
|
|
448
|
+
|
|
449
|
+
(datascript.impl.entity.Entity.prototype.apply = (function (self__,args11570){
|
|
450
|
+
var self__ = this;
|
|
451
|
+
var self____$1 = this;
|
|
452
|
+
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone(args11570)));
|
|
453
|
+
}));
|
|
454
|
+
|
|
455
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$IFn$_invoke$arity$1 = (function (k){
|
|
456
|
+
var self__ = this;
|
|
457
|
+
var this$ = this;
|
|
458
|
+
return (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2(this$,k) : datascript.impl.entity.lookup_entity.call(null,this$,k));
|
|
459
|
+
}));
|
|
460
|
+
|
|
461
|
+
(datascript.impl.entity.Entity.prototype.cljs$core$IFn$_invoke$arity$2 = (function (k,not_found){
|
|
462
|
+
var self__ = this;
|
|
463
|
+
var this$ = this;
|
|
464
|
+
return (datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 ? datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$,k,not_found) : datascript.impl.entity.lookup_entity.call(null,this$,k,not_found));
|
|
465
|
+
}));
|
|
466
|
+
|
|
467
|
+
(datascript.impl.entity.Entity.getBasis = (function (){
|
|
468
|
+
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"db","db",-1661185010,null),new cljs.core.Symbol(null,"eid","eid",-2094915839,null),new cljs.core.Symbol(null,"touched","touched",1031397108,null),new cljs.core.Symbol(null,"cache","cache",403508473,null)], null);
|
|
469
|
+
}));
|
|
470
|
+
|
|
471
|
+
(datascript.impl.entity.Entity.cljs$lang$type = true);
|
|
472
|
+
|
|
473
|
+
(datascript.impl.entity.Entity.cljs$lang$ctorStr = "datascript.impl.entity/Entity");
|
|
474
|
+
|
|
475
|
+
(datascript.impl.entity.Entity.cljs$lang$ctorPrWriter = (function (this__5287__auto__,writer__5288__auto__,opt__5289__auto__){
|
|
476
|
+
return cljs.core._write(writer__5288__auto__,"datascript.impl.entity/Entity");
|
|
477
|
+
}));
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Positional factory function for datascript.impl.entity/Entity.
|
|
481
|
+
*/
|
|
482
|
+
datascript.impl.entity.__GT_Entity = (function datascript$impl$entity$__GT_Entity(db,eid,touched,cache){
|
|
483
|
+
return (new datascript.impl.entity.Entity(db,eid,touched,cache));
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
datascript.impl.entity.entity_QMARK_ = (function datascript$impl$entity$entity_QMARK_(x){
|
|
487
|
+
return (x instanceof datascript.impl.entity.Entity);
|
|
488
|
+
});
|
|
489
|
+
datascript.impl.entity.equiv_entity = (function datascript$impl$entity$equiv_entity(this$,that){
|
|
490
|
+
return (((that instanceof datascript.impl.entity.Entity)) && ((((this$.db === that.db)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this$.eid,that.eid)))));
|
|
491
|
+
});
|
|
492
|
+
datascript.impl.entity.hash_entity = (function datascript$impl$entity$hash_entity(e){
|
|
493
|
+
return datascript.db.combine_hashes(cljs.core.hash(e.eid),goog.getUid(e.db));
|
|
494
|
+
});
|
|
495
|
+
datascript.impl.entity.lookup_entity = (function datascript$impl$entity$lookup_entity(var_args){
|
|
496
|
+
var G__11673 = arguments.length;
|
|
497
|
+
switch (G__11673) {
|
|
498
|
+
case 2:
|
|
499
|
+
return datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
|
|
500
|
+
|
|
501
|
+
break;
|
|
502
|
+
case 3:
|
|
503
|
+
return datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
|
|
504
|
+
|
|
505
|
+
break;
|
|
506
|
+
default:
|
|
507
|
+
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
|
|
508
|
+
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
(datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$2 = (function (this$,attr){
|
|
513
|
+
return datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3(this$,attr,null);
|
|
514
|
+
}));
|
|
515
|
+
|
|
516
|
+
(datascript.impl.entity.lookup_entity.cljs$core$IFn$_invoke$arity$3 = (function (this$,attr,not_found){
|
|
517
|
+
if(cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(attr,new cljs.core.Keyword("db","id","db/id",-1388397098))){
|
|
518
|
+
return this$.eid;
|
|
519
|
+
} else {
|
|
520
|
+
if(datascript.db.reverse_ref_QMARK_(attr)){
|
|
521
|
+
return datascript.impl.entity._lookup_backwards(this$.db,this$.eid,datascript.db.reverse_ref(attr),not_found);
|
|
522
|
+
} else {
|
|
523
|
+
var temp__5806__auto__ = (function (){var fexpr__11689 = cljs.core.deref(this$.cache);
|
|
524
|
+
return (fexpr__11689.cljs$core$IFn$_invoke$arity$1 ? fexpr__11689.cljs$core$IFn$_invoke$arity$1(attr) : fexpr__11689.call(null,attr));
|
|
525
|
+
})();
|
|
526
|
+
if((temp__5806__auto__ == null)){
|
|
527
|
+
if(cljs.core.truth_(cljs.core.deref(this$.touched))){
|
|
528
|
+
return not_found;
|
|
529
|
+
} else {
|
|
530
|
+
var temp__5806__auto____$1 = cljs.core.not_empty(datascript.db._search(this$.db,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [this$.eid,attr], null)));
|
|
531
|
+
if((temp__5806__auto____$1 == null)){
|
|
532
|
+
return not_found;
|
|
533
|
+
} else {
|
|
534
|
+
var datoms = temp__5806__auto____$1;
|
|
535
|
+
var value = datascript.impl.entity.entity_attr(this$.db,attr,datoms);
|
|
536
|
+
cljs.core.vreset_BANG_(this$.cache,cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(cljs.core.deref(this$.cache),attr,value));
|
|
537
|
+
|
|
538
|
+
return value;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
} else {
|
|
542
|
+
var v = temp__5806__auto__;
|
|
543
|
+
return v;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}));
|
|
548
|
+
|
|
549
|
+
(datascript.impl.entity.lookup_entity.cljs$lang$maxFixedArity = 3);
|
|
550
|
+
|
|
551
|
+
datascript.impl.entity.touch_components = (function datascript$impl$entity$touch_components(db,a__GT_v){
|
|
552
|
+
return cljs.core.reduce_kv((function (acc,a,v){
|
|
553
|
+
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(acc,a,((datascript.db.component_QMARK_(db,a))?((datascript.db.multival_QMARK_(db,a))?cljs.core.set(cljs.core.map.cljs$core$IFn$_invoke$arity$2(datascript.impl.entity.touch,v)):(datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1 ? datascript.impl.entity.touch.cljs$core$IFn$_invoke$arity$1(v) : datascript.impl.entity.touch.call(null,v))):v));
|
|
554
|
+
}),cljs.core.PersistentArrayMap.EMPTY,a__GT_v);
|
|
555
|
+
});
|
|
556
|
+
datascript.impl.entity.datoms__GT_cache = (function datascript$impl$entity$datoms__GT_cache(db,datoms){
|
|
557
|
+
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (acc,part){
|
|
558
|
+
var a = new cljs.core.Keyword(null,"a","a",-2123407586).cljs$core$IFn$_invoke$arity$1(cljs.core.first(part));
|
|
559
|
+
return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(acc,a,datascript.impl.entity.entity_attr(db,a,part));
|
|
560
|
+
}),cljs.core.PersistentArrayMap.EMPTY,cljs.core.partition_by.cljs$core$IFn$_invoke$arity$2(new cljs.core.Keyword(null,"a","a",-2123407586),datoms));
|
|
561
|
+
});
|
|
562
|
+
datascript.impl.entity.touch = (function datascript$impl$entity$touch(e){
|
|
563
|
+
if((((e == null)) || (datascript.impl.entity.entity_QMARK_(e)))){
|
|
564
|
+
} else {
|
|
565
|
+
throw (new Error("Assert failed: (or (nil? e) (entity? e))"));
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if((!((e == null)))){
|
|
569
|
+
if(cljs.core.truth_(cljs.core.deref(e.touched))){
|
|
570
|
+
} else {
|
|
571
|
+
var temp__5804__auto___11846 = cljs.core.not_empty(datascript.db._search(e.db,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [e.eid], null)));
|
|
572
|
+
if(cljs.core.truth_(temp__5804__auto___11846)){
|
|
573
|
+
var datoms_11850 = temp__5804__auto___11846;
|
|
574
|
+
cljs.core.vreset_BANG_(e.cache,datascript.impl.entity.touch_components(e.db,datascript.impl.entity.datoms__GT_cache(e.db,datoms_11850)));
|
|
575
|
+
|
|
576
|
+
cljs.core.vreset_BANG_(e.touched,true);
|
|
577
|
+
} else {
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
return e;
|
|
582
|
+
} else {
|
|
583
|
+
return null;
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
goog.exportSymbol("datascript.impl.entity.Entity",datascript.impl.entity.Entity);
|
|
587
|
+
|
|
588
|
+
//# sourceMappingURL=datascript.impl.entity.js.map
|