mol_db 0.0.228 → 0.0.231

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/node.test.js CHANGED
@@ -71,240 +71,6 @@ require = (req => Object.assign(function require(name) {
71
71
  ;
72
72
  "use strict";
73
73
  var $;
74
- (function ($) {
75
- $.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
76
- })($ || ($ = {}));
77
- //mol/dom/context/context.node.ts
78
- ;
79
- "use strict";
80
- var $;
81
- (function ($) {
82
- function $mol_db_response(request) {
83
- return new Promise((done, fail) => {
84
- request.onerror = () => fail(new Error(request.error.message));
85
- request.onsuccess = () => done(request.result);
86
- });
87
- }
88
- $.$mol_db_response = $mol_db_response;
89
- })($ || ($ = {}));
90
- //mol/db/response/response.ts
91
- ;
92
- "use strict";
93
- var $;
94
- (function ($) {
95
- async function $mol_db(name, ...migrations) {
96
- const request = this.$mol_dom_context.indexedDB.open(name, migrations.length ? migrations.length + 1 : undefined);
97
- request.onupgradeneeded = event => {
98
- migrations.splice(0, event.oldVersion - 1);
99
- const transaction = new $mol_db_transaction(request.transaction);
100
- for (const migrate of migrations)
101
- migrate(transaction);
102
- };
103
- const db = await $mol_db_response(request);
104
- return new $mol_db_database(db);
105
- }
106
- $.$mol_db = $mol_db;
107
- })($ || ($ = {}));
108
- //mol/db/db.ts
109
- ;
110
- "use strict";
111
- var $;
112
- (function ($) {
113
- class $mol_db_store {
114
- native;
115
- constructor(native) {
116
- this.native = native;
117
- }
118
- get name() {
119
- return this.native.name;
120
- }
121
- get path() {
122
- return this.native.keyPath;
123
- }
124
- get incremental() {
125
- return this.native.autoIncrement;
126
- }
127
- get indexes() {
128
- return new Proxy({}, {
129
- ownKeys: () => [...this.native.indexNames],
130
- has: (_, name) => this.native.indexNames.contains(name),
131
- get: (_, name) => new $mol_db_index(this.native.index(name))
132
- });
133
- }
134
- index_make(name, path = [], unique = false, multiEntry = false) {
135
- return this.native.createIndex(name, path, { multiEntry, unique });
136
- }
137
- index_drop(name) {
138
- this.native.deleteIndex(name);
139
- return this;
140
- }
141
- get transaction() {
142
- return new $mol_db_transaction(this.native.transaction);
143
- }
144
- get db() {
145
- return this.transaction.db;
146
- }
147
- clear() {
148
- return $mol_db_response(this.native.clear());
149
- }
150
- count(keys) {
151
- return $mol_db_response(this.native.count(keys));
152
- }
153
- put(doc, key) {
154
- return $mol_db_response(this.native.put(doc, key));
155
- }
156
- get(key) {
157
- return $mol_db_response(this.native.get(key));
158
- }
159
- select(key, count) {
160
- return $mol_db_response(this.native.getAll(key, count));
161
- }
162
- drop(keys) {
163
- return $mol_db_response(this.native.delete(keys));
164
- }
165
- }
166
- $.$mol_db_store = $mol_db_store;
167
- })($ || ($ = {}));
168
- //mol/db/store/store.ts
169
- ;
170
- "use strict";
171
- //mol/db/store/store_schema.ts
172
- ;
173
- "use strict";
174
- var $;
175
- (function ($) {
176
- $mol_dom_context.indexedDB = $node['fake-indexeddb'];
177
- })($ || ($ = {}));
178
- //mol/db/db.node.ts
179
- ;
180
- "use strict";
181
- //mol/db/db_schema.ts
182
- ;
183
- "use strict";
184
- var $;
185
- (function ($) {
186
- class $mol_db_database {
187
- native;
188
- constructor(native) {
189
- this.native = native;
190
- }
191
- get name() {
192
- return this.native.name;
193
- }
194
- get version() {
195
- return this.native.version;
196
- }
197
- get stores() {
198
- return [...this.native.objectStoreNames];
199
- }
200
- read(...names) {
201
- return new $mol_db_transaction(this.native.transaction(names, 'readonly')).stores;
202
- }
203
- change(...names) {
204
- return new $mol_db_transaction(this.native.transaction(names, 'readwrite'));
205
- }
206
- kill() {
207
- this.native.close();
208
- const request = $mol_dom_context.indexedDB.deleteDatabase(this.name);
209
- request.onblocked = console.error;
210
- return $mol_db_response(request).then(() => { });
211
- }
212
- destructor() {
213
- this.native.close();
214
- }
215
- }
216
- $.$mol_db_database = $mol_db_database;
217
- })($ || ($ = {}));
218
- //mol/db/database/database.ts
219
- ;
220
- "use strict";
221
- var $;
222
- (function ($) {
223
- class $mol_db_transaction {
224
- native;
225
- constructor(native) {
226
- this.native = native;
227
- }
228
- get stores() {
229
- return new Proxy({}, {
230
- ownKeys: () => [...this.native.objectStoreNames],
231
- has: (_, name) => this.native.objectStoreNames.contains(name),
232
- get: (_, name) => new $mol_db_store(this.native.objectStore(name)),
233
- });
234
- }
235
- store_make(name) {
236
- return this.native.db.createObjectStore(name, { autoIncrement: true });
237
- }
238
- store_drop(name) {
239
- this.native.db.deleteObjectStore(name);
240
- return this;
241
- }
242
- abort() {
243
- this.native.abort();
244
- }
245
- commit() {
246
- this.native.commit();
247
- return new Promise((done, fail) => {
248
- this.native.onerror = () => fail(new Error(this.native.error.message));
249
- this.native.oncomplete = () => done();
250
- });
251
- }
252
- get db() {
253
- return new $mol_db_database(this.native.db);
254
- }
255
- }
256
- $.$mol_db_transaction = $mol_db_transaction;
257
- })($ || ($ = {}));
258
- //mol/db/transaction/transaction.ts
259
- ;
260
- "use strict";
261
- var $;
262
- (function ($) {
263
- class $mol_db_index {
264
- native;
265
- constructor(native) {
266
- this.native = native;
267
- }
268
- get name() {
269
- return this.native.name;
270
- }
271
- get paths() {
272
- return this.native.keyPath;
273
- }
274
- get unique() {
275
- return this.native.unique;
276
- }
277
- get multiple() {
278
- return this.native.multiEntry;
279
- }
280
- get store() {
281
- return new $mol_db_store(this.native.objectStore);
282
- }
283
- get transaction() {
284
- return this.store.transaction;
285
- }
286
- get db() {
287
- return this.store.db;
288
- }
289
- count(keys) {
290
- return $mol_db_response(this.native.count(keys));
291
- }
292
- get(key) {
293
- return $mol_db_response(this.native.get(key));
294
- }
295
- select(key, count) {
296
- return $mol_db_response(this.native.getAll(key, count));
297
- }
298
- }
299
- $.$mol_db_index = $mol_db_index;
300
- })($ || ($ = {}));
301
- //mol/db/index/index.ts
302
- ;
303
- "use strict";
304
- //mol/db/index/index_schema.ts
305
- ;
306
- "use strict";
307
- var $;
308
74
  (function ($) {
309
75
  function $mol_log3_area_lazy(event) {
310
76
  const self = this;
@@ -899,34 +665,268 @@ var $;
899
665
  return this.process.env;
900
666
  };
901
667
  })($ || ($ = {}));
902
- //mol/env/env.node.ts
668
+ //mol/env/env.node.ts
669
+ ;
670
+ "use strict";
671
+ var $;
672
+ (function ($) {
673
+ function $mol_exec(dir, command, ...args) {
674
+ let [app, ...args0] = command.split(' ');
675
+ args = [...args0, ...args];
676
+ this.$mol_log3_come({
677
+ place: '$mol_exec',
678
+ dir: $node.path.relative('', dir),
679
+ message: 'Run',
680
+ command: `${app} ${args.join(' ')}`,
681
+ });
682
+ var res = $node['child_process'].spawnSync(app, args, {
683
+ cwd: $node.path.resolve(dir),
684
+ shell: true,
685
+ env: this.$mol_env(),
686
+ });
687
+ if (res.status || res.error)
688
+ return $mol_fail(res.error || new Error(res.stderr.toString()));
689
+ if (!res.stdout)
690
+ res.stdout = Buffer.from([]);
691
+ return res;
692
+ }
693
+ $.$mol_exec = $mol_exec;
694
+ })($ || ($ = {}));
695
+ //mol/exec/exec.node.ts
696
+ ;
697
+ "use strict";
698
+ var $;
699
+ (function ($) {
700
+ $.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
701
+ })($ || ($ = {}));
702
+ //mol/dom/context/context.node.ts
703
+ ;
704
+ "use strict";
705
+ var $;
706
+ (function ($) {
707
+ function $mol_db_response(request) {
708
+ return new Promise((done, fail) => {
709
+ request.onerror = () => fail(new Error(request.error.message));
710
+ request.onsuccess = () => done(request.result);
711
+ });
712
+ }
713
+ $.$mol_db_response = $mol_db_response;
714
+ })($ || ($ = {}));
715
+ //mol/db/response/response.ts
716
+ ;
717
+ "use strict";
718
+ var $;
719
+ (function ($) {
720
+ async function $mol_db(name, ...migrations) {
721
+ const request = this.$mol_dom_context.indexedDB.open(name, migrations.length ? migrations.length + 1 : undefined);
722
+ request.onupgradeneeded = event => {
723
+ migrations.splice(0, event.oldVersion - 1);
724
+ const transaction = new $mol_db_transaction(request.transaction);
725
+ for (const migrate of migrations)
726
+ migrate(transaction);
727
+ };
728
+ const db = await $mol_db_response(request);
729
+ return new $mol_db_database(db);
730
+ }
731
+ $.$mol_db = $mol_db;
732
+ })($ || ($ = {}));
733
+ //mol/db/db.ts
734
+ ;
735
+ "use strict";
736
+ var $;
737
+ (function ($) {
738
+ class $mol_db_store {
739
+ native;
740
+ constructor(native) {
741
+ this.native = native;
742
+ }
743
+ get name() {
744
+ return this.native.name;
745
+ }
746
+ get path() {
747
+ return this.native.keyPath;
748
+ }
749
+ get incremental() {
750
+ return this.native.autoIncrement;
751
+ }
752
+ get indexes() {
753
+ return new Proxy({}, {
754
+ ownKeys: () => [...this.native.indexNames],
755
+ has: (_, name) => this.native.indexNames.contains(name),
756
+ get: (_, name) => new $mol_db_index(this.native.index(name))
757
+ });
758
+ }
759
+ index_make(name, path = [], unique = false, multiEntry = false) {
760
+ return this.native.createIndex(name, path, { multiEntry, unique });
761
+ }
762
+ index_drop(name) {
763
+ this.native.deleteIndex(name);
764
+ return this;
765
+ }
766
+ get transaction() {
767
+ return new $mol_db_transaction(this.native.transaction);
768
+ }
769
+ get db() {
770
+ return this.transaction.db;
771
+ }
772
+ clear() {
773
+ return $mol_db_response(this.native.clear());
774
+ }
775
+ count(keys) {
776
+ return $mol_db_response(this.native.count(keys));
777
+ }
778
+ put(doc, key) {
779
+ return $mol_db_response(this.native.put(doc, key));
780
+ }
781
+ get(key) {
782
+ return $mol_db_response(this.native.get(key));
783
+ }
784
+ select(key, count) {
785
+ return $mol_db_response(this.native.getAll(key, count));
786
+ }
787
+ drop(keys) {
788
+ return $mol_db_response(this.native.delete(keys));
789
+ }
790
+ }
791
+ $.$mol_db_store = $mol_db_store;
792
+ })($ || ($ = {}));
793
+ //mol/db/store/store.ts
794
+ ;
795
+ "use strict";
796
+ //mol/db/store/store_schema.ts
797
+ ;
798
+ "use strict";
799
+ var $;
800
+ (function ($) {
801
+ class $mol_db_index {
802
+ native;
803
+ constructor(native) {
804
+ this.native = native;
805
+ }
806
+ get name() {
807
+ return this.native.name;
808
+ }
809
+ get paths() {
810
+ return this.native.keyPath;
811
+ }
812
+ get unique() {
813
+ return this.native.unique;
814
+ }
815
+ get multiple() {
816
+ return this.native.multiEntry;
817
+ }
818
+ get store() {
819
+ return new $mol_db_store(this.native.objectStore);
820
+ }
821
+ get transaction() {
822
+ return this.store.transaction;
823
+ }
824
+ get db() {
825
+ return this.store.db;
826
+ }
827
+ count(keys) {
828
+ return $mol_db_response(this.native.count(keys));
829
+ }
830
+ get(key) {
831
+ return $mol_db_response(this.native.get(key));
832
+ }
833
+ select(key, count) {
834
+ return $mol_db_response(this.native.getAll(key, count));
835
+ }
836
+ }
837
+ $.$mol_db_index = $mol_db_index;
838
+ })($ || ($ = {}));
839
+ //mol/db/index/index.ts
840
+ ;
841
+ "use strict";
842
+ //mol/db/index/index_schema.ts
843
+ ;
844
+ "use strict";
845
+ var $;
846
+ (function ($) {
847
+ $mol_dom_context.indexedDB = $node['fake-indexeddb'];
848
+ })($ || ($ = {}));
849
+ //mol/db/db.node.ts
850
+ ;
851
+ "use strict";
852
+ //mol/db/db_schema.ts
853
+ ;
854
+ "use strict";
855
+ var $;
856
+ (function ($) {
857
+ class $mol_db_database {
858
+ native;
859
+ constructor(native) {
860
+ this.native = native;
861
+ }
862
+ get name() {
863
+ return this.native.name;
864
+ }
865
+ get version() {
866
+ return this.native.version;
867
+ }
868
+ get stores() {
869
+ return [...this.native.objectStoreNames];
870
+ }
871
+ read(...names) {
872
+ return new $mol_db_transaction(this.native.transaction(names, 'readonly')).stores;
873
+ }
874
+ change(...names) {
875
+ return new $mol_db_transaction(this.native.transaction(names, 'readwrite'));
876
+ }
877
+ kill() {
878
+ this.native.close();
879
+ const request = $mol_dom_context.indexedDB.deleteDatabase(this.name);
880
+ request.onblocked = console.error;
881
+ return $mol_db_response(request).then(() => { });
882
+ }
883
+ destructor() {
884
+ this.native.close();
885
+ }
886
+ }
887
+ $.$mol_db_database = $mol_db_database;
888
+ })($ || ($ = {}));
889
+ //mol/db/database/database.ts
903
890
  ;
904
891
  "use strict";
905
892
  var $;
906
893
  (function ($) {
907
- function $mol_exec(dir, command, ...args) {
908
- let [app, ...args0] = command.split(' ');
909
- args = [...args0, ...args];
910
- this.$mol_log3_come({
911
- place: '$mol_exec',
912
- dir: $node.path.relative('', dir),
913
- message: 'Run',
914
- command: `${app} ${args.join(' ')}`,
915
- });
916
- var res = $node['child_process'].spawnSync(app, args, {
917
- cwd: $node.path.resolve(dir),
918
- shell: true,
919
- env: this.$mol_env(),
920
- });
921
- if (res.status || res.error)
922
- return $mol_fail(res.error || new Error(res.stderr.toString()));
923
- if (!res.stdout)
924
- res.stdout = Buffer.from([]);
925
- return res;
894
+ class $mol_db_transaction {
895
+ native;
896
+ constructor(native) {
897
+ this.native = native;
898
+ }
899
+ get stores() {
900
+ return new Proxy({}, {
901
+ ownKeys: () => [...this.native.objectStoreNames],
902
+ has: (_, name) => this.native.objectStoreNames.contains(name),
903
+ get: (_, name) => new $mol_db_store(this.native.objectStore(name)),
904
+ });
905
+ }
906
+ store_make(name) {
907
+ return this.native.db.createObjectStore(name, { autoIncrement: true });
908
+ }
909
+ store_drop(name) {
910
+ this.native.db.deleteObjectStore(name);
911
+ return this;
912
+ }
913
+ abort() {
914
+ this.native.abort();
915
+ }
916
+ commit() {
917
+ this.native.commit();
918
+ return new Promise((done, fail) => {
919
+ this.native.onerror = () => fail(new Error(this.native.error.message));
920
+ this.native.oncomplete = () => done();
921
+ });
922
+ }
923
+ get db() {
924
+ return new $mol_db_database(this.native.db);
925
+ }
926
926
  }
927
- $.$mol_exec = $mol_exec;
927
+ $.$mol_db_transaction = $mol_db_transaction;
928
928
  })($ || ($ = {}));
929
- //mol/exec/exec.node.ts
929
+ //mol/db/transaction/transaction.ts
930
930
  ;
931
931
  "use strict";
932
932
  var $;
@@ -1031,6 +1031,20 @@ var $;
1031
1031
  ;
1032
1032
  "use strict";
1033
1033
  var $;
1034
+ (function ($_1) {
1035
+ $mol_test_mocks.push($ => {
1036
+ $.$mol_log3_come = () => { };
1037
+ $.$mol_log3_done = () => { };
1038
+ $.$mol_log3_fail = () => { };
1039
+ $.$mol_log3_warn = () => { };
1040
+ $.$mol_log3_rise = () => { };
1041
+ $.$mol_log3_area = () => () => { };
1042
+ });
1043
+ })($ || ($ = {}));
1044
+ //mol/log3/log3.test.ts
1045
+ ;
1046
+ "use strict";
1047
+ var $;
1034
1048
  (function ($) {
1035
1049
  function $mol_dom_render_children(el, childNodes) {
1036
1050
  const node_set = new Set(childNodes);
@@ -1094,6 +1108,12 @@ var $;
1094
1108
  //mol/type/assert/assert.ts
1095
1109
  ;
1096
1110
  "use strict";
1111
+ //mol/type/equals/equals.test.ts
1112
+ ;
1113
+ "use strict";
1114
+ //mol/type/equals/equals.ts
1115
+ ;
1116
+ "use strict";
1097
1117
  //mol/type/partial/deep/deep.test.ts
1098
1118
  ;
1099
1119
  "use strict";
@@ -1606,99 +1626,6 @@ var $;
1606
1626
  ;
1607
1627
  "use strict";
1608
1628
  var $;
1609
- (function ($) {
1610
- $mol_test({
1611
- async 'put, get, drop, count records and clear store'() {
1612
- const db = await $$.$mol_db('$mol_db_test', mig => mig.store_make('letters'));
1613
- const trans = db.change('letters');
1614
- try {
1615
- const { letters } = trans.stores;
1616
- $mol_assert_like(await letters.get(1), undefined);
1617
- $mol_assert_like(await letters.get(2), undefined);
1618
- $mol_assert_like(await letters.count(), 0);
1619
- await letters.put('a');
1620
- await letters.put('b', 1);
1621
- await letters.put('c', 2);
1622
- $mol_assert_like(await letters.get(1), 'b');
1623
- $mol_assert_like(await letters.get(2), 'c');
1624
- $mol_assert_like(await letters.count(), 2);
1625
- await letters.drop(1);
1626
- $mol_assert_like(await letters.get(1), undefined);
1627
- $mol_assert_like(await letters.count(), 1);
1628
- await letters.clear();
1629
- $mol_assert_like(await letters.count(), 0);
1630
- }
1631
- finally {
1632
- trans.abort();
1633
- db.kill();
1634
- }
1635
- },
1636
- async 'select by query'() {
1637
- const db = await $$.$mol_db('$mol_db_test', mig => mig.store_make('letters'));
1638
- const trans = db.change('letters');
1639
- try {
1640
- const { letters } = trans.stores;
1641
- await letters.put('a');
1642
- await letters.put('b');
1643
- await letters.put('c');
1644
- await letters.put('d');
1645
- $mol_assert_like(await letters.select(), ['a', 'b', 'c', 'd']);
1646
- $mol_assert_like(await letters.select(null, 2), ['a', 'b']);
1647
- $mol_assert_like(await letters.select(IDBKeyRange.bound(2, 3)), ['b', 'c']);
1648
- }
1649
- finally {
1650
- trans.abort();
1651
- db.kill();
1652
- }
1653
- },
1654
- });
1655
- })($ || ($ = {}));
1656
- //mol/db/store/store.test.ts
1657
- ;
1658
- "use strict";
1659
- var $;
1660
- (function ($) {
1661
- $mol_test({
1662
- async 'take and drop db'() {
1663
- const db = await $$.$mol_db('$mol_db_test');
1664
- await db.kill();
1665
- },
1666
- async 'make and drop store in separate migrations'() {
1667
- try {
1668
- const db1 = await $$.$mol_db('$mol_db_test', mig => mig.store_make('temp'));
1669
- db1.destructor();
1670
- $mol_assert_like(db1.stores, ['temp']);
1671
- $mol_assert_like(db1.version, 2);
1672
- const db2 = await $$.$mol_db('$mol_db_test', mig => mig.store_make('temp'), mig => mig.store_drop('temp'));
1673
- db2.destructor();
1674
- $mol_assert_like(db2.stores, []);
1675
- $mol_assert_like(db2.version, 3);
1676
- }
1677
- finally {
1678
- const db0 = await $$.$mol_db('$mol_db_test');
1679
- await db0.kill();
1680
- }
1681
- },
1682
- });
1683
- })($ || ($ = {}));
1684
- //mol/db/db.test.ts
1685
- ;
1686
- "use strict";
1687
- var $;
1688
- (function ($_1) {
1689
- $mol_test_mocks.push($ => {
1690
- $.$mol_log3_come = () => { };
1691
- $.$mol_log3_done = () => { };
1692
- $.$mol_log3_fail = () => { };
1693
- $.$mol_log3_warn = () => { };
1694
- $.$mol_log3_rise = () => { };
1695
- $.$mol_log3_area = () => () => { };
1696
- });
1697
- })($ || ($ = {}));
1698
- //mol/log3/log3.test.ts
1699
- ;
1700
- "use strict";
1701
- var $;
1702
1629
  (function ($) {
1703
1630
  $mol_test({
1704
1631
  'get'() {
@@ -1824,10 +1751,83 @@ var $;
1824
1751
  //mol/tree/tree.test.ts
1825
1752
  ;
1826
1753
  "use strict";
1827
- //mol/type/equals/equals.test.ts
1754
+ var $;
1755
+ (function ($) {
1756
+ $mol_test({
1757
+ async 'put, get, drop, count records and clear store'() {
1758
+ const db = await $$.$mol_db('$mol_db_test', mig => mig.store_make('letters'));
1759
+ const trans = db.change('letters');
1760
+ try {
1761
+ const { letters } = trans.stores;
1762
+ $mol_assert_like(await letters.get(1), undefined);
1763
+ $mol_assert_like(await letters.get(2), undefined);
1764
+ $mol_assert_like(await letters.count(), 0);
1765
+ await letters.put('a');
1766
+ await letters.put('b', 1);
1767
+ await letters.put('c', 2);
1768
+ $mol_assert_like(await letters.get(1), 'b');
1769
+ $mol_assert_like(await letters.get(2), 'c');
1770
+ $mol_assert_like(await letters.count(), 2);
1771
+ await letters.drop(1);
1772
+ $mol_assert_like(await letters.get(1), undefined);
1773
+ $mol_assert_like(await letters.count(), 1);
1774
+ await letters.clear();
1775
+ $mol_assert_like(await letters.count(), 0);
1776
+ }
1777
+ finally {
1778
+ trans.abort();
1779
+ db.kill();
1780
+ }
1781
+ },
1782
+ async 'select by query'() {
1783
+ const db = await $$.$mol_db('$mol_db_test', mig => mig.store_make('letters'));
1784
+ const trans = db.change('letters');
1785
+ try {
1786
+ const { letters } = trans.stores;
1787
+ await letters.put('a');
1788
+ await letters.put('b');
1789
+ await letters.put('c');
1790
+ await letters.put('d');
1791
+ $mol_assert_like(await letters.select(), ['a', 'b', 'c', 'd']);
1792
+ $mol_assert_like(await letters.select(null, 2), ['a', 'b']);
1793
+ $mol_assert_like(await letters.select(IDBKeyRange.bound(2, 3)), ['b', 'c']);
1794
+ }
1795
+ finally {
1796
+ trans.abort();
1797
+ db.kill();
1798
+ }
1799
+ },
1800
+ });
1801
+ })($ || ($ = {}));
1802
+ //mol/db/store/store.test.ts
1828
1803
  ;
1829
1804
  "use strict";
1830
- //mol/type/equals/equals.ts
1805
+ var $;
1806
+ (function ($) {
1807
+ $mol_test({
1808
+ async 'take and drop db'() {
1809
+ const db = await $$.$mol_db('$mol_db_test');
1810
+ await db.kill();
1811
+ },
1812
+ async 'make and drop store in separate migrations'() {
1813
+ try {
1814
+ const db1 = await $$.$mol_db('$mol_db_test', mig => mig.store_make('temp'));
1815
+ db1.destructor();
1816
+ $mol_assert_like(db1.stores, ['temp']);
1817
+ $mol_assert_like(db1.version, 2);
1818
+ const db2 = await $$.$mol_db('$mol_db_test', mig => mig.store_make('temp'), mig => mig.store_drop('temp'));
1819
+ db2.destructor();
1820
+ $mol_assert_like(db2.stores, []);
1821
+ $mol_assert_like(db2.version, 3);
1822
+ }
1823
+ finally {
1824
+ const db0 = await $$.$mol_db('$mol_db_test');
1825
+ await db0.kill();
1826
+ }
1827
+ },
1828
+ });
1829
+ })($ || ($ = {}));
1830
+ //mol/db/db.test.ts
1831
1831
  ;
1832
1832
  "use strict";
1833
1833
  var $;