@instantdb/core 0.22.88 → 0.22.89-experimental.drewh-fix-export.20277749804.1

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 (65) hide show
  1. package/__tests__/src/Reactor.test.js +18 -11
  2. package/__tests__/src/{datalog.test.js → datalog.test.ts} +17 -5
  3. package/__tests__/src/{instaml.test.js → instaml.test.ts} +183 -119
  4. package/__tests__/src/instaql.bench.ts +34 -0
  5. package/__tests__/src/{instaql.test.js → instaql.test.ts} +342 -455
  6. package/__tests__/src/instaqlInference.test.js +13 -9
  7. package/__tests__/src/{store.test.js → store.test.ts} +215 -212
  8. package/dist/commonjs/Reactor.d.ts +23 -6
  9. package/dist/commonjs/Reactor.d.ts.map +1 -1
  10. package/dist/commonjs/Reactor.js +110 -45
  11. package/dist/commonjs/Reactor.js.map +1 -1
  12. package/dist/commonjs/SyncTable.d.ts +4 -1
  13. package/dist/commonjs/SyncTable.d.ts.map +1 -1
  14. package/dist/commonjs/SyncTable.js +35 -37
  15. package/dist/commonjs/SyncTable.js.map +1 -1
  16. package/dist/commonjs/instaml.d.ts +17 -4
  17. package/dist/commonjs/instaml.d.ts.map +1 -1
  18. package/dist/commonjs/instaml.js +115 -82
  19. package/dist/commonjs/instaml.js.map +1 -1
  20. package/dist/commonjs/instaql.d.ts +4 -3
  21. package/dist/commonjs/instaql.d.ts.map +1 -1
  22. package/dist/commonjs/instaql.js +65 -63
  23. package/dist/commonjs/instaql.js.map +1 -1
  24. package/dist/commonjs/reactorTypes.d.ts +29 -0
  25. package/dist/commonjs/reactorTypes.d.ts.map +1 -0
  26. package/dist/commonjs/reactorTypes.js +3 -0
  27. package/dist/commonjs/reactorTypes.js.map +1 -0
  28. package/dist/commonjs/store.d.ts +67 -25
  29. package/dist/commonjs/store.d.ts.map +1 -1
  30. package/dist/commonjs/store.js +177 -81
  31. package/dist/commonjs/store.js.map +1 -1
  32. package/dist/esm/Reactor.d.ts +23 -6
  33. package/dist/esm/Reactor.d.ts.map +1 -1
  34. package/dist/esm/Reactor.js +111 -46
  35. package/dist/esm/Reactor.js.map +1 -1
  36. package/dist/esm/SyncTable.d.ts +4 -1
  37. package/dist/esm/SyncTable.d.ts.map +1 -1
  38. package/dist/esm/SyncTable.js +35 -37
  39. package/dist/esm/SyncTable.js.map +1 -1
  40. package/dist/esm/instaml.d.ts +17 -4
  41. package/dist/esm/instaml.d.ts.map +1 -1
  42. package/dist/esm/instaml.js +112 -77
  43. package/dist/esm/instaml.js.map +1 -1
  44. package/dist/esm/instaql.d.ts +4 -3
  45. package/dist/esm/instaql.d.ts.map +1 -1
  46. package/dist/esm/instaql.js +65 -63
  47. package/dist/esm/instaql.js.map +1 -1
  48. package/dist/esm/reactorTypes.d.ts +29 -0
  49. package/dist/esm/reactorTypes.d.ts.map +1 -0
  50. package/dist/esm/reactorTypes.js +2 -0
  51. package/dist/esm/reactorTypes.js.map +1 -0
  52. package/dist/esm/store.d.ts +67 -25
  53. package/dist/esm/store.d.ts.map +1 -1
  54. package/dist/esm/store.js +174 -81
  55. package/dist/esm/store.js.map +1 -1
  56. package/dist/standalone/index.js +1605 -1415
  57. package/dist/standalone/index.umd.cjs +3 -3
  58. package/package.json +2 -2
  59. package/src/Reactor.js +152 -75
  60. package/src/SyncTable.ts +85 -45
  61. package/src/{instaml.js → instaml.ts} +201 -96
  62. package/src/instaql.ts +88 -62
  63. package/src/reactorTypes.ts +32 -0
  64. package/src/store.ts +257 -101
  65. package/__tests__/src/instaql.bench.js +0 -29
@@ -2,47 +2,89 @@ import { InstantDBAttr } from './attrTypes.ts';
2
2
  import { LinkIndex } from './utils/linkIndex.ts';
3
3
  type Triple = [string, string, any, number];
4
4
  type Attrs = Record<string, InstantDBAttr>;
5
- type AttrIndexes = {
6
- blobAttrs: Map<string, Map<string, InstantDBAttr>>;
7
- primaryKeys: Map<string, InstantDBAttr>;
8
- forwardIdents: Map<string, Map<string, InstantDBAttr>>;
9
- revIdents: Map<string, Map<string, InstantDBAttr>>;
10
- };
11
5
  export type Store = {
12
6
  eav: Map<string, Map<string, Map<any, Triple>>>;
13
7
  aev: Map<string, Map<string, Map<any, Triple>>>;
14
8
  vae: Map<any, Map<string, Map<string, Triple>>>;
15
- useDateObjects: boolean | null;
16
- attrs: Attrs;
17
- attrIndexes: AttrIndexes;
18
- cardinalityInference: boolean | null;
19
- linkIndex: LinkIndex | null;
20
- __type: 'store';
9
+ useDateObjects: boolean | null | undefined;
10
+ cardinalityInference: boolean | null | undefined;
21
11
  };
22
- export type StoreJson = {
12
+ type StoreJsonVersion0 = {
23
13
  __type: 'store';
24
14
  attrs: Attrs;
25
15
  triples: Triple[];
26
- cardinalityInference: boolean | null;
16
+ cardinalityInference: boolean | null | undefined;
17
+ linkIndex: LinkIndex | null;
18
+ useDateObjects: boolean | null | undefined;
19
+ };
20
+ type StoreJsonVersion1 = {
21
+ triples: Triple[];
22
+ cardinalityInference: boolean | null | undefined;
23
+ useDateObjects: boolean | null | undefined;
24
+ version: 1;
25
+ };
26
+ export type StoreJson = StoreJsonVersion0 | StoreJsonVersion1;
27
+ export type AttrsStoreJson = {
28
+ attrs: Attrs;
27
29
  linkIndex: LinkIndex | null;
28
- useDateObjects: boolean | null;
29
30
  };
31
+ export interface AttrsStore {
32
+ attrs: Attrs;
33
+ linkIndex: LinkIndex | null;
34
+ resetAttrIndexes(): void;
35
+ addAttr(attr: InstantDBAttr): void;
36
+ deleteAttr(attrId: string): void;
37
+ updateAttr(partialAttr: Partial<InstantDBAttr> & {
38
+ id: string;
39
+ }): void;
40
+ getAttr(id: string): InstantDBAttr | undefined;
41
+ blobAttrs: Map<string, Map<string, InstantDBAttr>>;
42
+ primaryKeys: Map<string, InstantDBAttr>;
43
+ forwardIdents: Map<string, Map<string, InstantDBAttr>>;
44
+ revIdents: Map<string, Map<string, InstantDBAttr>>;
45
+ toJSON(): AttrsStoreJson;
46
+ }
47
+ export declare class AttrsStoreClass implements AttrsStore {
48
+ attrs: Attrs;
49
+ linkIndex: LinkIndex | null;
50
+ private _blobAttrs;
51
+ private _primaryKeys;
52
+ private _forwardIdents;
53
+ private _revIdents;
54
+ constructor(attrs: Attrs, linkIndex: LinkIndex | null);
55
+ resetAttrIndexes(): void;
56
+ addAttr(attr: InstantDBAttr): void;
57
+ deleteAttr(attrId: string): void;
58
+ updateAttr(partialAttr: Partial<InstantDBAttr> & {
59
+ id: string;
60
+ }): void;
61
+ getAttr(id: string): InstantDBAttr | undefined;
62
+ get blobAttrs(): Map<string, Map<string, InstantDBAttr>>;
63
+ get primaryKeys(): Map<string, InstantDBAttr>;
64
+ get forwardIdents(): Map<string, Map<string, InstantDBAttr>>;
65
+ get revIdents(): Map<string, Map<string, InstantDBAttr>>;
66
+ toJSON(): AttrsStoreJson;
67
+ }
30
68
  export declare function isBlob(attr: InstantDBAttr): boolean;
31
69
  export declare function getInMap(obj: any, path: any): any;
32
- export declare function toJSON(store: Store): StoreJson;
33
- export declare function fromJSON(storeJSON: StoreJson): Store;
70
+ export declare function toJSON(store: Store): StoreJsonVersion1;
71
+ export declare function fromJSON(attrsStore: AttrsStore, storeJSON: StoreJson): Store;
72
+ export declare function attrsStoreFromJSON(attrsStoreJSON: AttrsStoreJson | null, storeJSON: StoreJson | null): AttrsStore | undefined;
34
73
  export declare function hasTriple(store: Store, [e, a, v]: [string, string, any]): boolean;
35
74
  export declare function hasEntity(store: Store, e: string): boolean;
36
- export declare function createStore(attrs: Record<string, InstantDBAttr>, triples: Triple[], enableCardinalityInference: boolean | null, linkIndex: LinkIndex | null, useDateObjects: boolean | null): Store;
37
- export declare function retractTriple(store: Store, rawTriple: Triple): void;
38
- export declare function addTriple(store: Store, rawTriple: Triple): void;
75
+ export declare function createStore(attrsStore: AttrsStore, triples: Triple[], enableCardinalityInference?: boolean | null, useDateObjects?: boolean | null): Store;
76
+ export declare function retractTriple(store: Store, attrsStore: AttrsStore, rawTriple: Triple): void;
77
+ export declare function addTriple(store: Store, attrsStore: AttrsStore, rawTriple: Triple): void;
39
78
  export declare function allMapValues(m: any, level: any, res?: any[]): any[];
40
79
  export declare function getTriples(store: any, [e, a, v]: [any, any, any]): any[];
41
80
  export declare function getAsObject(store: Store, attrs: Map<string, InstantDBAttr> | undefined, e: string): {};
42
- export declare function getAttrByFwdIdentName(store: Store, inputEtype: string, inputLabel: string): InstantDBAttr | undefined;
43
- export declare function getAttrByReverseIdentName(store: Store, inputEtype: string, inputLabel: string): InstantDBAttr | undefined;
44
- export declare function getBlobAttrs(store: Store, etype: string): Map<string, InstantDBAttr> | undefined;
45
- export declare function getPrimaryKeyAttr(store: Store, etype: string): InstantDBAttr | undefined;
46
- export declare function transact(store: Store, txSteps: any): Store;
81
+ export declare function getAttrByFwdIdentName(attrsStore: AttrsStore, inputEtype: string, inputLabel: string): InstantDBAttr | undefined;
82
+ export declare function getAttrByReverseIdentName(attrsStore: AttrsStore, inputEtype: string, inputLabel: string): InstantDBAttr | undefined;
83
+ export declare function getBlobAttrs(attrsStore: AttrsStore, etype: string): Map<string, InstantDBAttr> | undefined;
84
+ export declare function getPrimaryKeyAttr(attrsStore: AttrsStore, etype: string): InstantDBAttr | undefined;
85
+ export declare function transact(store: Store, attrsStore: AttrsStore, txSteps: any): {
86
+ store: Store;
87
+ attrsStore: AttrsStore;
88
+ };
47
89
  export {};
48
90
  //# sourceMappingURL=store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,KAAK,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAC5C,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE3C,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,GAAG,CAAC,MAAM,E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AG,SAAS,EAC7C,CAAC,EAAE,MAAM,MAiBV;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,6BAGnB;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,6BAGnB;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,0CAEjE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,6BAMtE;AAyBD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,OAAO,KAAA,GACN;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAsD1C"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttrsStoreClass = void 0;
3
4
  exports.isBlob = isBlob;
4
5
  exports.getInMap = getInMap;
5
6
  exports.toJSON = toJSON;
6
7
  exports.fromJSON = fromJSON;
8
+ exports.attrsStoreFromJSON = attrsStoreFromJSON;
7
9
  exports.hasTriple = hasTriple;
8
10
  exports.hasEntity = hasEntity;
9
11
  exports.createStore = createStore;
@@ -20,6 +22,96 @@ exports.transact = transact;
20
22
  const mutative_1 = require("mutative");
21
23
  const object_js_1 = require("./utils/object.js");
22
24
  const dates_ts_1 = require("./utils/dates.js");
25
+ class AttrsStoreClass {
26
+ constructor(attrs, linkIndex) {
27
+ this._blobAttrs = null;
28
+ this._primaryKeys = null;
29
+ this._forwardIdents = null;
30
+ this._revIdents = null;
31
+ this.attrs = attrs;
32
+ this.linkIndex = linkIndex;
33
+ }
34
+ resetAttrIndexes() {
35
+ this._blobAttrs = null;
36
+ this._primaryKeys = null;
37
+ this._forwardIdents = null;
38
+ this._revIdents = null;
39
+ }
40
+ addAttr(attr) {
41
+ this.attrs[attr.id] = attr;
42
+ this.resetAttrIndexes();
43
+ }
44
+ deleteAttr(attrId) {
45
+ delete this.attrs[attrId];
46
+ this.resetAttrIndexes();
47
+ }
48
+ updateAttr(partialAttr) {
49
+ const attr = this.attrs[partialAttr.id];
50
+ if (!attr)
51
+ return;
52
+ this.attrs[partialAttr.id] = Object.assign(Object.assign({}, attr), partialAttr);
53
+ this.resetAttrIndexes();
54
+ }
55
+ getAttr(id) {
56
+ return this.attrs[id];
57
+ }
58
+ get blobAttrs() {
59
+ if (this._blobAttrs) {
60
+ return this._blobAttrs;
61
+ }
62
+ this._blobAttrs = new Map();
63
+ for (const attr of Object.values(this.attrs)) {
64
+ if (isBlob(attr)) {
65
+ const [_, fwdEtype, fwdLabel] = attr['forward-identity'];
66
+ setInMap(this.blobAttrs, [fwdEtype, fwdLabel], attr);
67
+ }
68
+ }
69
+ return this._blobAttrs;
70
+ }
71
+ get primaryKeys() {
72
+ if (this._primaryKeys) {
73
+ return this._primaryKeys;
74
+ }
75
+ this._primaryKeys = new Map();
76
+ for (const attr of Object.values(this.attrs)) {
77
+ if (attr['primary?']) {
78
+ const [_, fwdEtype] = attr['forward-identity'];
79
+ setInMap(this._primaryKeys, [fwdEtype], attr);
80
+ }
81
+ }
82
+ return this._primaryKeys;
83
+ }
84
+ get forwardIdents() {
85
+ if (this._forwardIdents) {
86
+ return this._forwardIdents;
87
+ }
88
+ this._forwardIdents = new Map();
89
+ for (const attr of Object.values(this.attrs)) {
90
+ const fwdIdent = attr['forward-identity'];
91
+ const [_, fwdEtype, fwdLabel] = fwdIdent;
92
+ setInMap(this._forwardIdents, [fwdEtype, fwdLabel], attr);
93
+ }
94
+ return this._forwardIdents;
95
+ }
96
+ get revIdents() {
97
+ if (this._revIdents) {
98
+ return this._revIdents;
99
+ }
100
+ this._revIdents = new Map();
101
+ for (const attr of Object.values(this.attrs)) {
102
+ const revIdent = attr['reverse-identity'];
103
+ if (revIdent) {
104
+ const [_, revEtype, revLabel] = revIdent;
105
+ setInMap(this._revIdents, [revEtype, revLabel], attr);
106
+ }
107
+ }
108
+ return this._revIdents;
109
+ }
110
+ toJSON() {
111
+ return { attrs: this.attrs, linkIndex: this.linkIndex };
112
+ }
113
+ }
114
+ exports.AttrsStoreClass = AttrsStoreClass;
23
115
  function hasEA(attr) {
24
116
  return attr['cardinality'] === 'one';
25
117
  }
@@ -48,32 +140,33 @@ function deleteInMap(m, path) {
48
140
  deleteInMap(m.get(head), tail);
49
141
  }
50
142
  function setInMap(m, path, value) {
51
- if (path.length === 0)
52
- throw new Error('path must have at least one element');
53
- if (path.length === 1) {
54
- m.set(path[0], value);
55
- return;
143
+ let current = m;
144
+ const lastI = path.length - 1;
145
+ for (let i = 0; i < lastI; i++) {
146
+ const part = path[i];
147
+ let nextMap = current.get(part);
148
+ if (nextMap === undefined) {
149
+ nextMap = new Map();
150
+ current.set(part, nextMap);
151
+ }
152
+ current = nextMap;
56
153
  }
57
- const [head, ...tail] = path;
58
- let nextM = m.get(head);
59
- if (!nextM) {
60
- nextM = new Map();
61
- m.set(head, nextM);
154
+ if (lastI > -1) {
155
+ current.set(path[lastI], value);
62
156
  }
63
- setInMap(nextM, tail, value);
64
157
  }
65
158
  function isDateAttr(attr) {
66
159
  return attr['checked-data-type'] === 'date';
67
160
  }
68
- function createTripleIndexes(attrs, triples, useDateObjects) {
161
+ function createTripleIndexes(attrsStore, triples, useDateObjects) {
69
162
  const eav = new Map();
70
163
  const aev = new Map();
71
164
  const vae = new Map();
72
165
  for (const triple of triples) {
73
- let [eid, aid, v, t] = triple;
74
- const attr = getAttr(attrs, aid);
166
+ let [eid, aid, v] = triple;
167
+ const attr = attrsStore.getAttr(aid);
75
168
  if (!attr) {
76
- console.warn('no such attr', eid, attrs);
169
+ console.warn('no such attr', aid, eid);
77
170
  continue;
78
171
  }
79
172
  if (attr['checked-data-type'] === 'date' && useDateObjects) {
@@ -113,16 +206,22 @@ function createAttrIndexes(attrs) {
113
206
  }
114
207
  function toJSON(store) {
115
208
  return {
116
- __type: store.__type,
117
- attrs: store.attrs,
118
209
  triples: allMapValues(store.eav, 3),
119
210
  cardinalityInference: store.cardinalityInference,
120
- linkIndex: store.linkIndex,
121
211
  useDateObjects: store.useDateObjects,
212
+ version: 1,
122
213
  };
123
214
  }
124
- function fromJSON(storeJSON) {
125
- return createStore(storeJSON.attrs, storeJSON.triples, storeJSON.cardinalityInference, storeJSON.linkIndex, storeJSON.useDateObjects);
215
+ function fromJSON(attrsStore, storeJSON) {
216
+ return createStore(attrsStore, storeJSON.triples, storeJSON.cardinalityInference, storeJSON.useDateObjects);
217
+ }
218
+ function attrsStoreFromJSON(attrsStoreJSON, storeJSON) {
219
+ if (attrsStoreJSON) {
220
+ return new AttrsStoreClass(attrsStoreJSON.attrs, attrsStoreJSON.linkIndex);
221
+ }
222
+ if (storeJSON && '__type' in storeJSON) {
223
+ return new AttrsStoreClass(storeJSON.attrs, storeJSON.linkIndex);
224
+ }
126
225
  }
127
226
  function hasTriple(store, [e, a, v]) {
128
227
  return getInMap(store.eav, [e, a, v]) !== undefined;
@@ -130,17 +229,10 @@ function hasTriple(store, [e, a, v]) {
130
229
  function hasEntity(store, e) {
131
230
  return getInMap(store.eav, [e]) !== undefined;
132
231
  }
133
- function resetAttrIndexes(store) {
134
- store.attrIndexes = createAttrIndexes(store.attrs);
135
- }
136
- function createStore(attrs, triples, enableCardinalityInference, linkIndex, useDateObjects) {
137
- const store = createTripleIndexes(attrs, triples, useDateObjects);
138
- store.useDateObjects = useDateObjects;
139
- store.attrs = attrs;
140
- store.attrIndexes = createAttrIndexes(attrs);
232
+ function createStore(attrsStore, triples, enableCardinalityInference, useDateObjects) {
233
+ const store = createTripleIndexes(attrsStore, triples, useDateObjects);
141
234
  store.cardinalityInference = enableCardinalityInference;
142
- store.linkIndex = linkIndex;
143
- store.__type = 'store';
235
+ store.useDateObjects = useDateObjects;
144
236
  return store;
145
237
  }
146
238
  // We may have local triples with lookup refs in them,
@@ -197,13 +289,13 @@ function resolveLookupRefs(store, triple) {
197
289
  return [eid, ...rest];
198
290
  }
199
291
  }
200
- function retractTriple(store, rawTriple) {
292
+ function retractTriple(store, attrsStore, rawTriple) {
201
293
  const triple = resolveLookupRefs(store, rawTriple);
202
294
  if (!triple) {
203
295
  return;
204
296
  }
205
297
  const [eid, aid, v] = triple;
206
- const attr = getAttr(store.attrs, aid);
298
+ const attr = attrsStore.getAttr(aid);
207
299
  if (!attr) {
208
300
  return;
209
301
  }
@@ -244,14 +336,14 @@ function getCreatedAt(store, attr, triple) {
244
336
  */
245
337
  return createdAt || Date.now() * 10 + _seed++;
246
338
  }
247
- function addTriple(store, rawTriple) {
339
+ function addTriple(store, attrsStore, rawTriple) {
248
340
  var _a;
249
341
  const triple = resolveLookupRefs(store, rawTriple);
250
342
  if (!triple) {
251
343
  return;
252
344
  }
253
345
  let [eid, aid, v] = triple;
254
- const attr = getAttr(store.attrs, aid);
346
+ const attr = attrsStore.getAttr(aid);
255
347
  if (!attr) {
256
348
  // (XXX): Due to the way we're handling attrs, it's
257
349
  // possible to enter a state where we receive a triple without an attr.
@@ -280,14 +372,14 @@ function addTriple(store, rawTriple) {
280
372
  setInMap(store.vae, [v, aid, eid], enhancedTriple);
281
373
  }
282
374
  }
283
- function mergeTriple(store, rawTriple) {
375
+ function mergeTriple(store, attrsStore, rawTriple) {
284
376
  var _a;
285
377
  const triple = resolveLookupRefs(store, rawTriple);
286
378
  if (!triple) {
287
379
  return;
288
380
  }
289
381
  const [eid, aid, update] = triple;
290
- const attr = getAttr(store.attrs, aid);
382
+ const attr = attrsStore.getAttr(aid);
291
383
  if (!attr)
292
384
  return;
293
385
  if (!isBlob(attr))
@@ -307,8 +399,9 @@ function mergeTriple(store, rawTriple) {
307
399
  getCreatedAt(store, attr, currentTriple),
308
400
  ];
309
401
  setInMap(store.eav, [eid, aid], new Map([[updatedValue, enhancedTriple]]));
402
+ setInMap(store.aev, [aid, eid], new Map([[updatedValue, enhancedTriple]]));
310
403
  }
311
- function deleteEntity(store, args) {
404
+ function deleteEntity(store, attrsStore, args) {
312
405
  var _a, _b;
313
406
  const [lookup, etype] = args;
314
407
  const triple = resolveLookupRefs(store, [lookup]);
@@ -320,10 +413,10 @@ function deleteEntity(store, args) {
320
413
  const eMap = store.eav.get(id);
321
414
  if (eMap) {
322
415
  for (const a of eMap.keys()) {
323
- const attr = store.attrs[a];
416
+ const attr = attrsStore.getAttr(a);
324
417
  // delete cascade refs
325
418
  if (attr && attr['on-delete-reverse'] === 'cascade') {
326
- allMapValues(eMap.get(a), 1).forEach(([e, a, v]) => { var _a; return deleteEntity(store, [v, (_a = attr['reverse-identity']) === null || _a === void 0 ? void 0 : _a[1]]); });
419
+ allMapValues(eMap.get(a), 1).forEach(([e, a, v]) => { var _a; return deleteEntity(store, attrsStore, [v, (_a = attr['reverse-identity']) === null || _a === void 0 ? void 0 : _a[1]]); });
327
420
  }
328
421
  if (
329
422
  // Fall back to deleting everything if we've rehydrated tx-steps from
@@ -348,7 +441,7 @@ function deleteEntity(store, args) {
348
441
  vaeTriples.forEach((triple) => {
349
442
  var _a, _b, _c;
350
443
  const [e, a, v] = triple;
351
- const attr = store.attrs[a];
444
+ const attr = attrsStore.getAttr(a);
352
445
  if (!etype || !attr || ((_a = attr['reverse-identity']) === null || _a === void 0 ? void 0 : _a[1]) === etype) {
353
446
  deleteInMap(store.eav, [e, a, v]);
354
447
  deleteInMap(store.aev, [a, e, v]);
@@ -357,7 +450,7 @@ function deleteEntity(store, args) {
357
450
  if (attr &&
358
451
  attr['on-delete'] === 'cascade' &&
359
452
  ((_b = attr['reverse-identity']) === null || _b === void 0 ? void 0 : _b[1]) === etype) {
360
- deleteEntity(store, [e, (_c = attr['forward-identity']) === null || _c === void 0 ? void 0 : _c[1]]);
453
+ deleteEntity(store, attrsStore, [e, (_c = attr['forward-identity']) === null || _c === void 0 ? void 0 : _c[1]]);
361
454
  }
362
455
  });
363
456
  }
@@ -373,58 +466,55 @@ function deleteEntity(store, args) {
373
466
  // * We could batch this reset at the end
374
467
  // * We could add an ave index for all triples, so removing the
375
468
  // right triples is easy and fast.
376
- function resetIndexMap(store, newTriples) {
377
- const newIndexMap = createTripleIndexes(store.attrs, newTriples, store.useDateObjects);
469
+ function resetIndexMap(store, attrsStore, newTriples) {
470
+ const newIndexMap = createTripleIndexes(attrsStore, newTriples, store.useDateObjects);
378
471
  Object.keys(newIndexMap).forEach((key) => {
379
472
  store[key] = newIndexMap[key];
380
473
  });
381
474
  }
382
- function addAttr(store, [attr]) {
383
- store.attrs[attr.id] = attr;
384
- resetAttrIndexes(store);
475
+ function addAttr(attrsStore, [attr]) {
476
+ attrsStore.addAttr(attr);
385
477
  }
386
478
  function getAllTriples(store) {
387
479
  return allMapValues(store.eav, 3);
388
480
  }
389
- function deleteAttr(store, [id]) {
390
- if (!store.attrs[id])
481
+ function deleteAttr(store, attrsStore, [id]) {
482
+ if (!attrsStore.getAttr(id))
391
483
  return;
392
484
  const newTriples = getAllTriples(store).filter(([_, aid]) => aid !== id);
393
- delete store.attrs[id];
394
- resetAttrIndexes(store);
395
- resetIndexMap(store, newTriples);
485
+ attrsStore.deleteAttr(id);
486
+ resetIndexMap(store, attrsStore, newTriples);
396
487
  }
397
- function updateAttr(store, [partialAttr]) {
398
- const attr = store.attrs[partialAttr.id];
488
+ function updateAttr(store, attrsStore, [partialAttr]) {
489
+ const attr = attrsStore.getAttr(partialAttr.id);
399
490
  if (!attr)
400
491
  return;
401
- store.attrs[partialAttr.id] = Object.assign(Object.assign({}, attr), partialAttr);
402
- resetAttrIndexes(store);
403
- resetIndexMap(store, getAllTriples(store));
492
+ attrsStore.updateAttr(partialAttr);
493
+ resetIndexMap(store, attrsStore, getAllTriples(store));
404
494
  }
405
- function applyTxStep(store, txStep) {
495
+ function applyTxStep(store, attrsStore, txStep) {
406
496
  const [action, ...args] = txStep;
407
497
  switch (action) {
408
498
  case 'add-triple':
409
- addTriple(store, args);
499
+ addTriple(store, attrsStore, args);
410
500
  break;
411
501
  case 'deep-merge-triple':
412
- mergeTriple(store, args);
502
+ mergeTriple(store, attrsStore, args);
413
503
  break;
414
504
  case 'retract-triple':
415
- retractTriple(store, args);
505
+ retractTriple(store, attrsStore, args);
416
506
  break;
417
507
  case 'delete-entity':
418
- deleteEntity(store, args);
508
+ deleteEntity(store, attrsStore, args);
419
509
  break;
420
510
  case 'add-attr':
421
- addAttr(store, args);
511
+ addAttr(attrsStore, args);
422
512
  break;
423
513
  case 'delete-attr':
424
- deleteAttr(store, args);
514
+ deleteAttr(store, attrsStore, args);
425
515
  break;
426
516
  case 'update-attr':
427
- updateAttr(store, args);
517
+ updateAttr(store, attrsStore, args);
428
518
  break;
429
519
  case 'restore-attr':
430
520
  break;
@@ -587,32 +677,32 @@ function getAsObject(store, attrs, e) {
587
677
  }
588
678
  return obj;
589
679
  }
590
- function getAttrByFwdIdentName(store, inputEtype, inputLabel) {
680
+ function getAttrByFwdIdentName(attrsStore, inputEtype, inputLabel) {
591
681
  var _a;
592
- return (_a = store.attrIndexes.forwardIdents.get(inputEtype)) === null || _a === void 0 ? void 0 : _a.get(inputLabel);
682
+ return (_a = attrsStore.forwardIdents.get(inputEtype)) === null || _a === void 0 ? void 0 : _a.get(inputLabel);
593
683
  }
594
- function getAttrByReverseIdentName(store, inputEtype, inputLabel) {
684
+ function getAttrByReverseIdentName(attrsStore, inputEtype, inputLabel) {
595
685
  var _a;
596
- return (_a = store.attrIndexes.revIdents.get(inputEtype)) === null || _a === void 0 ? void 0 : _a.get(inputLabel);
686
+ return (_a = attrsStore.revIdents.get(inputEtype)) === null || _a === void 0 ? void 0 : _a.get(inputLabel);
597
687
  }
598
- function getBlobAttrs(store, etype) {
599
- return store.attrIndexes.blobAttrs.get(etype);
688
+ function getBlobAttrs(attrsStore, etype) {
689
+ return attrsStore.blobAttrs.get(etype);
600
690
  }
601
- function getPrimaryKeyAttr(store, etype) {
691
+ function getPrimaryKeyAttr(attrsStore, etype) {
602
692
  var _a;
603
- const fromPrimary = store.attrIndexes.primaryKeys.get(etype);
693
+ const fromPrimary = attrsStore.primaryKeys.get(etype);
604
694
  if (fromPrimary) {
605
695
  return fromPrimary;
606
696
  }
607
- return (_a = store.attrIndexes.forwardIdents.get(etype)) === null || _a === void 0 ? void 0 : _a.get('id');
697
+ return (_a = attrsStore.forwardIdents.get(etype)) === null || _a === void 0 ? void 0 : _a.get('id');
608
698
  }
609
- function findTriple(store, rawTriple) {
699
+ function findTriple(store, attrsStore, rawTriple) {
610
700
  const triple = resolveLookupRefs(store, rawTriple);
611
701
  if (!triple) {
612
702
  return;
613
703
  }
614
704
  const [eid, aid, v] = triple;
615
- const attr = getAttr(store.attrs, aid);
705
+ const attr = attrsStore.getAttr(aid);
616
706
  if (!attr) {
617
707
  // (XXX): Due to the way we're handling attrs, it's
618
708
  // possible to enter a state where we receive a triple without an attr.
@@ -622,7 +712,7 @@ function findTriple(store, rawTriple) {
622
712
  }
623
713
  return getInMap(store.eav, [eid, aid]);
624
714
  }
625
- function transact(store, txSteps) {
715
+ function transact(store, attrsStore, txSteps) {
626
716
  const txStepsFiltered = txSteps.filter(([action, eid, attrId, value, opts]) => {
627
717
  if (action !== 'add-triple' && action !== 'deep-merge-triple') {
628
718
  return true;
@@ -632,10 +722,10 @@ function transact(store, txSteps) {
632
722
  return true;
633
723
  }
634
724
  let exists = false;
635
- const attr = getAttr(store.attrs, attrId);
725
+ const attr = attrsStore.getAttr(attrId);
636
726
  if (attr) {
637
- const idAttr = getPrimaryKeyAttr(store, attr['forward-identity'][1]);
638
- exists = !!findTriple(store, [
727
+ const idAttr = getPrimaryKeyAttr(attrsStore, attr['forward-identity'][1]);
728
+ exists = !!findTriple(store, attrsStore, [
639
729
  eid,
640
730
  idAttr === null || idAttr === void 0 ? void 0 : idAttr.id,
641
731
  eid,
@@ -649,10 +739,16 @@ function transact(store, txSteps) {
649
739
  }
650
740
  return true;
651
741
  });
652
- return (0, mutative_1.create)(store, (draft) => {
742
+ return (0, mutative_1.create)({ store, attrsStore }, (draft) => {
653
743
  txStepsFiltered.forEach((txStep) => {
654
- applyTxStep(draft, txStep);
744
+ applyTxStep(draft.store, draft.attrsStore, txStep);
655
745
  });
746
+ }, {
747
+ mark: (target) => {
748
+ if (target instanceof AttrsStoreClass) {
749
+ return 'immutable';
750
+ }
751
+ },
656
752
  });
657
753
  }
658
754
  //# sourceMappingURL=store.js.map