mol_db 0.0.1730 → 0.0.1732
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.d.ts +219 -1
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +228 -9
- package/node.js.map +1 -1
- package/node.mjs +228 -9
- package/node.test.js +289 -9
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +43 -0
- package/web.d.ts.map +1 -1
- package/web.js +43 -0
- package/web.js.map +1 -1
- package/web.mjs +43 -0
- package/web.test.js +67 -1
- package/web.test.js.map +1 -1
package/node.d.ts
CHANGED
|
@@ -73,11 +73,17 @@ declare namespace $ {
|
|
|
73
73
|
|
|
74
74
|
declare namespace $ {
|
|
75
75
|
const $mol_ambient_ref: unique symbol;
|
|
76
|
+
/** @deprecated use $ instead */
|
|
76
77
|
type $mol_ambient_context = $;
|
|
77
78
|
function $mol_ambient(this: $ | void, overrides: Partial<$>): $;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
declare namespace $ {
|
|
82
|
+
/**
|
|
83
|
+
* Proxy that delegates all to lazy returned target.
|
|
84
|
+
*
|
|
85
|
+
* $mol_delegate( Array.prototype , ()=> fetch_array() )
|
|
86
|
+
*/
|
|
81
87
|
function $mol_delegate<Value extends object>(proto: Value, target: () => Value): Value;
|
|
82
88
|
}
|
|
83
89
|
|
|
@@ -141,57 +147,130 @@ declare namespace $ {
|
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
declare namespace $ {
|
|
150
|
+
/** Generates unique identifier. */
|
|
144
151
|
function $mol_guid(length?: number, exists?: (id: string) => boolean): string;
|
|
145
152
|
}
|
|
146
153
|
|
|
147
154
|
declare namespace $ {
|
|
155
|
+
/** Special status statuses. */
|
|
148
156
|
enum $mol_wire_cursor {
|
|
157
|
+
/** Update required. */
|
|
149
158
|
stale = -1,
|
|
159
|
+
/** Some of (transitive) pub update required. */
|
|
150
160
|
doubt = -2,
|
|
161
|
+
/** Actual state but may be dropped. */
|
|
151
162
|
fresh = -3,
|
|
163
|
+
/** State will never be changed. */
|
|
152
164
|
final = -4
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
167
|
|
|
156
168
|
declare namespace $ {
|
|
169
|
+
/**
|
|
170
|
+
* Collects subscribers in compact array. 28B
|
|
171
|
+
*/
|
|
157
172
|
class $mol_wire_pub extends Object {
|
|
158
173
|
constructor(id?: string);
|
|
159
174
|
[Symbol.toStringTag]: string;
|
|
160
175
|
data: unknown[];
|
|
161
176
|
static get [Symbol.species](): ArrayConstructor;
|
|
177
|
+
/**
|
|
178
|
+
* Index of first subscriber.
|
|
179
|
+
*/
|
|
162
180
|
protected sub_from: number;
|
|
181
|
+
/**
|
|
182
|
+
* All current subscribers.
|
|
183
|
+
*/
|
|
163
184
|
get sub_list(): readonly $mol_wire_sub[];
|
|
185
|
+
/**
|
|
186
|
+
* Has any subscribers or not.
|
|
187
|
+
*/
|
|
164
188
|
get sub_empty(): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Subscribe subscriber to this publisher events and return position of subscriber that required to unsubscribe.
|
|
191
|
+
*/
|
|
165
192
|
sub_on(sub: $mol_wire_pub, pub_pos: number): number;
|
|
193
|
+
/**
|
|
194
|
+
* Unsubscribe subscriber from this publisher events by subscriber position provided by `on(pub)`.
|
|
195
|
+
*/
|
|
166
196
|
sub_off(sub_pos: number): void;
|
|
197
|
+
/**
|
|
198
|
+
* Called when last sub was unsubscribed.
|
|
199
|
+
**/
|
|
167
200
|
reap(): void;
|
|
201
|
+
/**
|
|
202
|
+
* Autowire this publisher with current subscriber.
|
|
203
|
+
**/
|
|
168
204
|
promote(): void;
|
|
205
|
+
/**
|
|
206
|
+
* Enforce actualization. Should not throw errors.
|
|
207
|
+
*/
|
|
169
208
|
fresh(): void;
|
|
209
|
+
/**
|
|
210
|
+
* Allow to put data to caches in the subtree.
|
|
211
|
+
*/
|
|
170
212
|
complete(): void;
|
|
171
213
|
get incompleted(): boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Notify subscribers about self changes.
|
|
216
|
+
*/
|
|
172
217
|
emit(quant?: $mol_wire_cursor): void;
|
|
218
|
+
/**
|
|
219
|
+
* Moves peer from one position to another. Doesn't clear data at old position!
|
|
220
|
+
*/
|
|
173
221
|
peer_move(from_pos: number, to_pos: number): void;
|
|
222
|
+
/**
|
|
223
|
+
* Updates self position in the peer.
|
|
224
|
+
*/
|
|
174
225
|
peer_repos(peer_pos: number, self_pos: number): void;
|
|
175
226
|
}
|
|
176
227
|
}
|
|
177
228
|
|
|
178
229
|
declare namespace $ {
|
|
230
|
+
/** Generic subscriber interface */
|
|
179
231
|
interface $mol_wire_sub extends $mol_wire_pub {
|
|
180
232
|
temp: boolean;
|
|
181
233
|
pub_list: $mol_wire_pub[];
|
|
234
|
+
/**
|
|
235
|
+
* Begin auto wire to publishers.
|
|
236
|
+
* Returns previous auto subscriber that must me transfer to the `end`.
|
|
237
|
+
*/
|
|
182
238
|
track_on(): $mol_wire_sub | null;
|
|
239
|
+
/**
|
|
240
|
+
* Returns next auto wired publisher. It can be easely repormoted.
|
|
241
|
+
* Or promotes next publisher to auto wire its togeter.
|
|
242
|
+
* Must be used only between `track_on` and `track_off`.
|
|
243
|
+
*/
|
|
183
244
|
track_next(pub?: $mol_wire_pub): $mol_wire_pub | null;
|
|
184
245
|
pub_off(pub_pos: number): void;
|
|
246
|
+
/**
|
|
247
|
+
* Unsubscribes from unpromoted publishers.
|
|
248
|
+
*/
|
|
185
249
|
track_cut(sub: $mol_wire_pub | null): void;
|
|
250
|
+
/**
|
|
251
|
+
* Ends auto wire to publishers.
|
|
252
|
+
*/
|
|
186
253
|
track_off(sub: $mol_wire_pub | null): void;
|
|
254
|
+
/**
|
|
255
|
+
* Receive notification about publisher changes.
|
|
256
|
+
*/
|
|
187
257
|
absorb(quant: $mol_wire_cursor, pos: number): void;
|
|
258
|
+
/**
|
|
259
|
+
* Unsubscribes from all publishers.
|
|
260
|
+
*/
|
|
188
261
|
destructor(): void;
|
|
189
262
|
}
|
|
190
263
|
}
|
|
191
264
|
|
|
192
265
|
declare namespace $ {
|
|
193
266
|
let $mol_wire_auto_sub: $mol_wire_sub | null;
|
|
267
|
+
/**
|
|
268
|
+
* When fulfilled, all publishers are promoted to this subscriber on access to its.
|
|
269
|
+
*/
|
|
194
270
|
function $mol_wire_auto(next?: $mol_wire_sub | null): $mol_wire_sub | null;
|
|
271
|
+
/**
|
|
272
|
+
* Affection queue. Used to prevent accidental stack overflow on emit.
|
|
273
|
+
*/
|
|
195
274
|
const $mol_wire_affected: ($mol_wire_sub | number)[];
|
|
196
275
|
}
|
|
197
276
|
|
|
@@ -224,6 +303,13 @@ declare namespace $ {
|
|
|
224
303
|
}
|
|
225
304
|
|
|
226
305
|
declare namespace $ {
|
|
306
|
+
/**
|
|
307
|
+
* Publisher that can auto collect other publishers. 32B
|
|
308
|
+
*
|
|
309
|
+
* P1 P2 P3 P4 S1 S2 S3
|
|
310
|
+
* ^ ^
|
|
311
|
+
* pubs_from subs_from
|
|
312
|
+
*/
|
|
227
313
|
class $mol_wire_pub_sub extends $mol_wire_pub implements $mol_wire_sub {
|
|
228
314
|
protected pub_from: number;
|
|
229
315
|
protected cursor: $mol_wire_cursor;
|
|
@@ -240,6 +326,9 @@ declare namespace $ {
|
|
|
240
326
|
complete_pubs(): void;
|
|
241
327
|
absorb(quant?: $mol_wire_cursor, pos?: number): void;
|
|
242
328
|
[$mol_dev_format_head](): any[];
|
|
329
|
+
/**
|
|
330
|
+
* Is subscribed to any publisher or not.
|
|
331
|
+
*/
|
|
243
332
|
get pub_empty(): boolean;
|
|
244
333
|
}
|
|
245
334
|
}
|
|
@@ -255,6 +344,13 @@ declare namespace $ {
|
|
|
255
344
|
}
|
|
256
345
|
|
|
257
346
|
declare namespace $ {
|
|
347
|
+
/**
|
|
348
|
+
* Suspendable task with support both sync/async api.
|
|
349
|
+
*
|
|
350
|
+
* A1 A2 A3 A4 P1 P2 P3 P4 S1 S2 S3
|
|
351
|
+
* ^ ^ ^
|
|
352
|
+
* args_from pubs_from subs_from
|
|
353
|
+
**/
|
|
258
354
|
abstract class $mol_wire_fiber<Host, Args extends readonly unknown[], Result> extends $mol_wire_pub_sub {
|
|
259
355
|
readonly task: (this: Host, ...args: Args) => Result;
|
|
260
356
|
readonly host?: Host | undefined;
|
|
@@ -281,7 +377,15 @@ declare namespace $ {
|
|
|
281
377
|
fresh(): this | undefined;
|
|
282
378
|
refresh(): void;
|
|
283
379
|
abstract put(next: Result | Error | Promise<Result | Error>): Result | Error | Promise<Result | Error>;
|
|
380
|
+
/**
|
|
381
|
+
* Synchronous execution. Throws Promise when waits async task (SuspenseAPI provider).
|
|
382
|
+
* Should be called inside SuspenseAPI consumer (ie fiber).
|
|
383
|
+
*/
|
|
284
384
|
sync(): Awaited<Result>;
|
|
385
|
+
/**
|
|
386
|
+
* Asynchronous execution.
|
|
387
|
+
* It's SuspenseAPI consumer. So SuspenseAPI providers can be called inside.
|
|
388
|
+
*/
|
|
285
389
|
async_raw(): Promise<Result>;
|
|
286
390
|
async(): Promise<Result> & {
|
|
287
391
|
destructor(): void;
|
|
@@ -293,31 +397,48 @@ declare namespace $ {
|
|
|
293
397
|
|
|
294
398
|
declare namespace $ {
|
|
295
399
|
let $mol_compare_deep_cache: WeakMap<any, WeakMap<any, boolean>>;
|
|
400
|
+
/**
|
|
401
|
+
* Deeply compares two values. Returns true if equal.
|
|
402
|
+
* Define `Symbol.toPrimitive` to customize.
|
|
403
|
+
*/
|
|
296
404
|
function $mol_compare_deep<Value>(left: Value, right: Value): boolean;
|
|
297
405
|
}
|
|
298
406
|
|
|
299
407
|
declare namespace $ {
|
|
408
|
+
/** Logger event data */
|
|
300
409
|
type $mol_log3_event<Fields> = {
|
|
301
410
|
[key in string]: unknown;
|
|
302
411
|
} & {
|
|
412
|
+
/** Time of event creation */
|
|
303
413
|
time?: string;
|
|
414
|
+
/** Place of event creation */
|
|
304
415
|
place: unknown;
|
|
416
|
+
/** Short description of event */
|
|
305
417
|
message: string;
|
|
306
418
|
} & Fields;
|
|
419
|
+
/** Logger function */
|
|
307
420
|
type $mol_log3_logger<Fields, Res = void> = (this: $, event: $mol_log3_event<Fields>) => Res;
|
|
421
|
+
/** Log begin of some task */
|
|
308
422
|
let $mol_log3_come: $mol_log3_logger<{}>;
|
|
423
|
+
/** Log end of some task */
|
|
309
424
|
let $mol_log3_done: $mol_log3_logger<{}>;
|
|
425
|
+
/** Log error */
|
|
310
426
|
let $mol_log3_fail: $mol_log3_logger<{}>;
|
|
427
|
+
/** Log warning message */
|
|
311
428
|
let $mol_log3_warn: $mol_log3_logger<{
|
|
312
429
|
hint: string;
|
|
313
430
|
}>;
|
|
431
|
+
/** Log some generic event */
|
|
314
432
|
let $mol_log3_rise: $mol_log3_logger<{}>;
|
|
433
|
+
/** Log begin of log group, returns func to close group */
|
|
315
434
|
let $mol_log3_area: $mol_log3_logger<{}, () => void>;
|
|
435
|
+
/** Log begin of collapsed group only when some logged inside, returns func to close group */
|
|
316
436
|
function $mol_log3_area_lazy(this: $, event: $mol_log3_event<{}>): () => void;
|
|
317
437
|
let $mol_log3_stack: (() => void)[];
|
|
318
438
|
}
|
|
319
439
|
|
|
320
440
|
declare namespace $ {
|
|
441
|
+
/** Position in any resource. */
|
|
321
442
|
class $mol_span extends $mol_object2 {
|
|
322
443
|
readonly uri: string;
|
|
323
444
|
readonly source: string;
|
|
@@ -325,9 +446,13 @@ declare namespace $ {
|
|
|
325
446
|
readonly col: number;
|
|
326
447
|
readonly length: number;
|
|
327
448
|
constructor(uri: string, source: string, row: number, col: number, length: number);
|
|
449
|
+
/** Span for begin of unknown resource */
|
|
328
450
|
static unknown: $mol_span;
|
|
451
|
+
/** Makes new span for begin of resource. */
|
|
329
452
|
static begin(uri: string, source?: string): $mol_span;
|
|
453
|
+
/** Makes new span for end of resource. */
|
|
330
454
|
static end(uri: string, source: string): $mol_span;
|
|
455
|
+
/** Makes new span for entire resource. */
|
|
331
456
|
static entire(uri: string, source: string): $mol_span;
|
|
332
457
|
toString(): string;
|
|
333
458
|
toJSON(): {
|
|
@@ -336,14 +461,19 @@ declare namespace $ {
|
|
|
336
461
|
col: number;
|
|
337
462
|
length: number;
|
|
338
463
|
};
|
|
464
|
+
/** Makes new error for this span. */
|
|
339
465
|
error(message: string, Class?: ErrorConstructor): Error;
|
|
466
|
+
/** Makes new span for same uri. */
|
|
340
467
|
span(row: number, col: number, length: number): $mol_span;
|
|
468
|
+
/** Makes new span after end of this. */
|
|
341
469
|
after(length?: number): $mol_span;
|
|
470
|
+
/** Makes new span between begin and end. */
|
|
342
471
|
slice(begin: number, end?: number): $mol_span;
|
|
343
472
|
}
|
|
344
473
|
}
|
|
345
474
|
|
|
346
475
|
declare namespace $ {
|
|
476
|
+
/** Serializes tree to string in tree format. */
|
|
347
477
|
function $mol_tree2_to_string(this: $, tree: $mol_tree2): string;
|
|
348
478
|
}
|
|
349
479
|
|
|
@@ -352,37 +482,74 @@ declare namespace $ {
|
|
|
352
482
|
}
|
|
353
483
|
|
|
354
484
|
declare namespace $ {
|
|
485
|
+
/** Path by types in tree. */
|
|
355
486
|
type $mol_tree2_path = Array<string | number | null>;
|
|
487
|
+
/** Hask tool for processing node. */
|
|
356
488
|
type $mol_tree2_hack<Context> = (input: $mol_tree2, belt: $mol_tree2_belt<Context>, context: Context) => readonly $mol_tree2[];
|
|
489
|
+
/** Collection of hask tools for processing tree. */
|
|
357
490
|
type $mol_tree2_belt<Context> = Record<string, $mol_tree2_hack<Context>>;
|
|
491
|
+
/**
|
|
492
|
+
* Abstract Syntax Tree with human readable serialization.
|
|
493
|
+
* Avoid direct instantiation. Use static factories instead.
|
|
494
|
+
* @see https://github.com/nin-jin/tree.d
|
|
495
|
+
*/
|
|
358
496
|
class $mol_tree2 extends Object {
|
|
497
|
+
/** Type of structural node, `value` should be empty */
|
|
359
498
|
readonly type: string;
|
|
499
|
+
/** Content of data node, `type` should be empty */
|
|
360
500
|
readonly value: string;
|
|
501
|
+
/** Child nodes */
|
|
361
502
|
readonly kids: readonly $mol_tree2[];
|
|
503
|
+
/** Position in most far source resource */
|
|
362
504
|
readonly span: $mol_span;
|
|
363
|
-
constructor(
|
|
505
|
+
constructor(
|
|
506
|
+
/** Type of structural node, `value` should be empty */
|
|
507
|
+
type: string,
|
|
508
|
+
/** Content of data node, `type` should be empty */
|
|
509
|
+
value: string,
|
|
510
|
+
/** Child nodes */
|
|
511
|
+
kids: readonly $mol_tree2[],
|
|
512
|
+
/** Position in most far source resource */
|
|
513
|
+
span: $mol_span);
|
|
514
|
+
/** Makes collection node. */
|
|
364
515
|
static list(kids: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
|
|
516
|
+
/** Makes new derived collection node. */
|
|
365
517
|
list(kids: readonly $mol_tree2[]): $mol_tree2;
|
|
518
|
+
/** Makes data node for any string. */
|
|
366
519
|
static data(value: string, kids?: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
|
|
520
|
+
/** Makes new derived data node. */
|
|
367
521
|
data(value: string, kids?: readonly $mol_tree2[]): $mol_tree2;
|
|
522
|
+
/** Makes struct node. */
|
|
368
523
|
static struct(type: string, kids?: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
|
|
524
|
+
/** Makes new derived structural node. */
|
|
369
525
|
struct(type: string, kids?: readonly $mol_tree2[]): $mol_tree2;
|
|
526
|
+
/** Makes new derived node with different kids id defined. */
|
|
370
527
|
clone(kids: readonly $mol_tree2[], span?: $mol_span): $mol_tree2;
|
|
528
|
+
/** Returns multiline text content. */
|
|
371
529
|
text(): string;
|
|
530
|
+
/** Parses tree format. */
|
|
531
|
+
/** @deprecated Use $mol_tree2_from_string */
|
|
372
532
|
static fromString(str: string, uri?: string): $mol_tree2;
|
|
533
|
+
/** Serializes to tree format. */
|
|
373
534
|
toString(): string;
|
|
535
|
+
/** Makes new tree with node overrided by path. */
|
|
374
536
|
insert(value: $mol_tree2 | null, ...path: $mol_tree2_path): $mol_tree2;
|
|
537
|
+
/** Makes new tree with node overrided by path. */
|
|
375
538
|
update(value: readonly $mol_tree2[], ...path: $mol_tree2_path): readonly $mol_tree2[];
|
|
539
|
+
/** Query nodes by path. */
|
|
376
540
|
select(...path: $mol_tree2_path): $mol_tree2;
|
|
541
|
+
/** Filter kids by path or value. */
|
|
377
542
|
filter(path: string[], value?: string): $mol_tree2;
|
|
378
543
|
hack_self<Context extends {
|
|
379
544
|
span?: $mol_span;
|
|
380
545
|
[key: string]: unknown;
|
|
381
546
|
} = {}>(belt: $mol_tree2_belt<Context>, context?: Context): readonly $mol_tree2[];
|
|
547
|
+
/** Transform tree through context with transformers */
|
|
382
548
|
hack<Context extends {
|
|
383
549
|
span?: $mol_span;
|
|
384
550
|
[key: string]: unknown;
|
|
385
551
|
} = {}>(belt: $mol_tree2_belt<Context>, context?: Context): $mol_tree2[];
|
|
552
|
+
/** Makes Error with node coordinates. */
|
|
386
553
|
error(message: string, Class?: ErrorConstructor): Error;
|
|
387
554
|
}
|
|
388
555
|
class $mol_tree2_empty extends $mol_tree2 {
|
|
@@ -391,6 +558,7 @@ declare namespace $ {
|
|
|
391
558
|
}
|
|
392
559
|
|
|
393
560
|
declare namespace $ {
|
|
561
|
+
/** Syntax error with cordinates and source line snippet. */
|
|
394
562
|
class $mol_error_syntax extends SyntaxError {
|
|
395
563
|
reason: string;
|
|
396
564
|
line: string;
|
|
@@ -400,6 +568,7 @@ declare namespace $ {
|
|
|
400
568
|
}
|
|
401
569
|
|
|
402
570
|
declare namespace $ {
|
|
571
|
+
/** Parses tree format from string. */
|
|
403
572
|
function $mol_tree2_from_string(this: $, str: string, uri?: string): $mol_tree2;
|
|
404
573
|
}
|
|
405
574
|
|
|
@@ -412,6 +581,7 @@ declare namespace $ {
|
|
|
412
581
|
}
|
|
413
582
|
|
|
414
583
|
declare namespace $ {
|
|
584
|
+
/** Module for working with terminal. Text coloring when output in terminal */
|
|
415
585
|
class $mol_term_color {
|
|
416
586
|
static reset: (str: string) => string;
|
|
417
587
|
static bold: (str: string) => string;
|
|
@@ -443,6 +613,7 @@ declare namespace $ {
|
|
|
443
613
|
}
|
|
444
614
|
|
|
445
615
|
declare namespace $ {
|
|
616
|
+
/** One-shot fiber */
|
|
446
617
|
class $mol_wire_task<Host, Args extends readonly unknown[], Result> extends $mol_wire_fiber<Host, Args, Result> {
|
|
447
618
|
static getter<Host, Args extends readonly unknown[], Result>(task: (this: Host, ...args: Args) => Result): (host: Host, args: Args) => $mol_wire_task<Host, Args, Result>;
|
|
448
619
|
get temp(): boolean;
|
|
@@ -453,6 +624,10 @@ declare namespace $ {
|
|
|
453
624
|
}
|
|
454
625
|
|
|
455
626
|
declare namespace $ {
|
|
627
|
+
/**
|
|
628
|
+
* Convert asynchronous (promise-based) API to synchronous by wrapping function and method calls in a fiber.
|
|
629
|
+
* @see https://mol.hyoo.ru/#!section=docs/=1fcpsq_1wh0h2
|
|
630
|
+
*/
|
|
456
631
|
export function $mol_wire_sync<Host extends object>(obj: Host): ObjectOrFunctionResultAwaited<Host>;
|
|
457
632
|
type FunctionResultAwaited<Some> = Some extends (...args: infer Args) => infer Res ? (...args: Args) => Awaited<Res> : Some;
|
|
458
633
|
type ConstructorResultAwaited<Some> = Some extends new (...args: infer Args) => infer Res ? new (...args: Args) => Res : {};
|
|
@@ -502,33 +677,52 @@ declare namespace $ {
|
|
|
502
677
|
}
|
|
503
678
|
|
|
504
679
|
declare namespace $ {
|
|
680
|
+
/** Converts IDBResult to Promise */
|
|
505
681
|
function $mol_db_response<Result>(request: IDBRequest<Result>): Promise<Result>;
|
|
506
682
|
}
|
|
507
683
|
|
|
508
684
|
declare namespace $ {
|
|
685
|
+
/**
|
|
686
|
+
* Creates new or returns existen database with automatic schema migration.
|
|
687
|
+
* Schema version is based on migrations count.
|
|
688
|
+
* Migrations code mustn't be changed after deploy.
|
|
689
|
+
* Only adding migrations at the end is allowed.
|
|
690
|
+
* Only new migrations will be applyed to existen DB.
|
|
691
|
+
* Schema changes allowed only through migratios.
|
|
692
|
+
*/
|
|
509
693
|
function $mol_db<Schema extends $mol_db_schema>(this: $, name: string, ...migrations: ((transaction: $mol_db_transaction<$mol_db_schema>) => void)[]): Promise<$mol_db_database<Schema>>;
|
|
510
694
|
}
|
|
511
695
|
|
|
512
696
|
declare namespace $ {
|
|
697
|
+
/** IndexedDB ObjectStore wrapper. */
|
|
513
698
|
class $mol_db_store<Schema extends $mol_db_store_schema> {
|
|
514
699
|
readonly native: IDBObjectStore;
|
|
515
700
|
constructor(native: IDBObjectStore);
|
|
516
701
|
get name(): string;
|
|
517
702
|
get path(): string | string[] | null;
|
|
518
703
|
get incremental(): boolean;
|
|
704
|
+
/** Returns dictionary of all existen Indexes. */
|
|
519
705
|
get indexes(): { [Name in keyof Schema["Indexes"]]: $mol_db_index<{
|
|
520
706
|
Key: Schema["Indexes"][Name];
|
|
521
707
|
Doc: Schema["Doc"];
|
|
522
708
|
}>; };
|
|
709
|
+
/** Creates new Index */
|
|
523
710
|
index_make(name: string, path?: string[], unique?: boolean, multiEntry?: boolean): IDBIndex;
|
|
711
|
+
/** Drops existen Index */
|
|
524
712
|
index_drop(name: string): this;
|
|
525
713
|
get transaction(): $mol_db_transaction<$mol_db_schema>;
|
|
526
714
|
get db(): $mol_db_database<$mol_db_schema>;
|
|
715
|
+
/** Deletes all stored Documents */
|
|
527
716
|
clear(): Promise<undefined>;
|
|
717
|
+
/** Counts Documents by primary key(s) */
|
|
528
718
|
count(keys?: Schema['Key'] | IDBKeyRange): Promise<number>;
|
|
719
|
+
/** Stores single Document by primary key. */
|
|
529
720
|
put(doc: Schema['Doc'], key?: Schema['Key']): Promise<IDBValidKey>;
|
|
721
|
+
/** Returns Document by primary key. */
|
|
530
722
|
get(key: Schema['Key']): Promise<Schema["Doc"] | undefined>;
|
|
723
|
+
/** Selects Documents by primary keys. */
|
|
531
724
|
select(key?: Schema['Key'] | IDBKeyRange | null, count?: number): Promise<Schema["Doc"][]>;
|
|
725
|
+
/** Deletes Documents by primary key(s). */
|
|
532
726
|
drop(keys: Schema['Key'] | IDBKeyRange): Promise<undefined>;
|
|
533
727
|
}
|
|
534
728
|
}
|
|
@@ -546,6 +740,7 @@ declare namespace $ {
|
|
|
546
740
|
}
|
|
547
741
|
|
|
548
742
|
declare namespace $ {
|
|
743
|
+
/** IndexedDB Index wrapper. */
|
|
549
744
|
class $mol_db_index<Schema extends $mol_db_index_schema> {
|
|
550
745
|
readonly native: IDBIndex;
|
|
551
746
|
constructor(native: IDBIndex);
|
|
@@ -556,8 +751,11 @@ declare namespace $ {
|
|
|
556
751
|
get store(): $mol_db_store<$mol_db_store_schema>;
|
|
557
752
|
get transaction(): $mol_db_transaction<$mol_db_schema>;
|
|
558
753
|
get db(): $mol_db_database<$mol_db_schema>;
|
|
754
|
+
/** Counts Documents by key(s) */
|
|
559
755
|
count(keys?: Schema['Key'] | IDBKeyRange): Promise<number>;
|
|
756
|
+
/** Returns Document by primary key. */
|
|
560
757
|
get(key: Schema['Key']): Promise<Schema["Doc"] | undefined>;
|
|
758
|
+
/** Selects Documents by primary keys. */
|
|
561
759
|
select(key?: Schema['Key'] | IDBKeyRange | null, count?: number): Promise<Schema["Doc"][]>;
|
|
562
760
|
}
|
|
563
761
|
}
|
|
@@ -577,15 +775,29 @@ declare namespace $ {
|
|
|
577
775
|
}
|
|
578
776
|
|
|
579
777
|
declare namespace $ {
|
|
778
|
+
/** IndexedDB instance wrapper. */
|
|
580
779
|
class $mol_db_database<Schema extends $mol_db_schema> {
|
|
581
780
|
readonly native: IDBDatabase;
|
|
582
781
|
constructor(native: IDBDatabase);
|
|
782
|
+
/** Returns database name. */
|
|
583
783
|
get name(): string;
|
|
784
|
+
/** Returns database schema version. */
|
|
584
785
|
get version(): number;
|
|
786
|
+
/** Returns all stores names. */
|
|
585
787
|
get stores(): (keyof Schema)[];
|
|
788
|
+
/** Create read-only transaction. */
|
|
586
789
|
read<Names extends Exclude<keyof Schema, symbol | number>>(...names: Names[]): Pick<Schema, Names> extends infer T extends $mol_db_schema ? { [Name in keyof T]: $mol_db_store<T[Name]>; } : never;
|
|
790
|
+
/** Create read/write transaction. */
|
|
587
791
|
change<Names extends Exclude<keyof Schema, symbol | number>>(...names: Names[]): $mol_db_transaction<Pick<Schema, Names>>;
|
|
792
|
+
/**
|
|
793
|
+
* Deletes database.
|
|
794
|
+
* DB can be deleted only after end of all transactions.
|
|
795
|
+
*/
|
|
588
796
|
kill(): Promise<IDBDatabase>;
|
|
797
|
+
/**
|
|
798
|
+
* Closes DB connection.
|
|
799
|
+
* Connection really be closed only after end of all transactions.
|
|
800
|
+
*/
|
|
589
801
|
destructor(): void;
|
|
590
802
|
}
|
|
591
803
|
}
|
|
@@ -594,13 +806,19 @@ interface IDBTransaction {
|
|
|
594
806
|
commit(): void;
|
|
595
807
|
}
|
|
596
808
|
declare namespace $ {
|
|
809
|
+
/** IndexedDB Transaction wrapper. */
|
|
597
810
|
class $mol_db_transaction<Schema extends $mol_db_schema> {
|
|
598
811
|
readonly native: IDBTransaction;
|
|
599
812
|
constructor(native: IDBTransaction);
|
|
813
|
+
/** Returns dictionary of all existen Stores. */
|
|
600
814
|
get stores(): { [Name in keyof Schema]: $mol_db_store<Schema[Name]>; };
|
|
815
|
+
/** Creates new Store */
|
|
601
816
|
store_make(name: string): IDBObjectStore;
|
|
817
|
+
/** Drops existen Store */
|
|
602
818
|
store_drop(name: string): this;
|
|
819
|
+
/** Instant abort transaction. Any errors aborts transactions automatically. */
|
|
603
820
|
abort(): void;
|
|
821
|
+
/** Instant commits transaction. Without errors commit proceed automatically later. */
|
|
604
822
|
commit(): Promise<void>;
|
|
605
823
|
get db(): $mol_db_database<$mol_db_schema>;
|
|
606
824
|
}
|
package/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../mam.d.ts","../../dom/context/context.d.ts","../../../node/internal/check/check.node.d.ts","../../promise/like/like.d.ts","../../fail/fail.d.ts","../../fail/hidden/hidden.d.ts","../../fail/catch/catch.d.ts","../../try/try.d.ts","../../fail/log/log.d.ts","../../../node/autoinstall/autoinstall.node.d.ts","../../../node/node.node.d.ts","../../func/name/name.d.ts","../../error/mix/mix.d.ts","../../ambient/ambient.d.ts","../../delegate/delegate.d.ts","../../owning/owning.d.ts","../../type/writable/writable.d.ts","../../key/key.d.ts","../../object2/object2.d.ts","../../object/object.d.ts","../../env/env.d.ts","../../env/env.node.d.ts","../../guid/guid.d.ts","../../wire/cursor/cursor.d.ts","../../wire/pub/pub.d.ts","../../wire/sub/sub.d.ts","../../wire/wire.d.ts","../../dev/format/format.d.ts","../../wire/pub/sub/sub.d.ts","../../after/tick/tick.d.ts","../../wire/fiber/fiber.d.ts","../../compare/deep/deep.d.ts","../../log3/log3.d.ts","../../span/span.d.ts","../../tree2/to/string/string.d.ts","../../maybe/maybe.d.ts","../../tree2/tree2.d.ts","../../error/syntax/syntax.d.ts","../../tree2/from/string/string.d.ts","../../array/chunks/chunks.d.ts","../../tree2/from/json/json.d.ts","../../term/color/color.d.ts","../../log3/log3.node.d.ts","../../wire/task/task.d.ts","../../wire/sync/sync.d.ts","../../run/run.node.d.ts","../../dom/context/context.node.d.ts","../response/response.d.ts","../db.d.ts","../store/store.d.ts","../store/store_schema.d.ts","../../dom/dom.d.ts","../index/index.d.ts","../index/index_schema.d.ts","../db.node.d.ts","../db_schema.d.ts","../database/database.d.ts","../transaction/transaction.d.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACfA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["../../../mam.d.ts","../../dom/context/context.d.ts","../../../node/internal/check/check.node.d.ts","../../promise/like/like.d.ts","../../fail/fail.d.ts","../../fail/hidden/hidden.d.ts","../../fail/catch/catch.d.ts","../../try/try.d.ts","../../fail/log/log.d.ts","../../../node/autoinstall/autoinstall.node.d.ts","../../../node/node.node.d.ts","../../func/name/name.d.ts","../../error/mix/mix.d.ts","../../ambient/ambient.d.ts","../../delegate/delegate.d.ts","../../owning/owning.d.ts","../../type/writable/writable.d.ts","../../key/key.d.ts","../../object2/object2.d.ts","../../object/object.d.ts","../../env/env.d.ts","../../env/env.node.d.ts","../../guid/guid.d.ts","../../wire/cursor/cursor.d.ts","../../wire/pub/pub.d.ts","../../wire/sub/sub.d.ts","../../wire/wire.d.ts","../../dev/format/format.d.ts","../../wire/pub/sub/sub.d.ts","../../after/tick/tick.d.ts","../../wire/fiber/fiber.d.ts","../../compare/deep/deep.d.ts","../../log3/log3.d.ts","../../span/span.d.ts","../../tree2/to/string/string.d.ts","../../maybe/maybe.d.ts","../../tree2/tree2.d.ts","../../error/syntax/syntax.d.ts","../../tree2/from/string/string.d.ts","../../array/chunks/chunks.d.ts","../../tree2/from/json/json.d.ts","../../term/color/color.d.ts","../../log3/log3.node.d.ts","../../wire/task/task.d.ts","../../wire/sync/sync.d.ts","../../run/run.node.d.ts","../../dom/context/context.node.d.ts","../response/response.d.ts","../db.d.ts","../store/store.d.ts","../store/store_schema.d.ts","../../dom/dom.d.ts","../index/index.d.ts","../index/index_schema.d.ts","../db.node.d.ts","../db_schema.d.ts","../database/database.d.ts","../transaction/transaction.d.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACfA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;ACHA;AACA;AACA;ACFA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClCA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACTA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3BA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClCA;AACA;AACA;ACFA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;ACFA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]}
|