@graphrefly/graphrefly 0.21.0 → 0.23.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 +7 -5
- package/dist/chunk-263BEJJO.js +115 -0
- package/dist/chunk-263BEJJO.js.map +1 -0
- package/dist/chunk-2GQLMQVJ.js +47 -0
- package/dist/chunk-2GQLMQVJ.js.map +1 -0
- package/dist/chunk-32N5A454.js +36 -0
- package/dist/chunk-32N5A454.js.map +1 -0
- package/dist/chunk-7TAQJHQV.js +103 -0
- package/dist/chunk-7TAQJHQV.js.map +1 -0
- package/dist/{chunk-VOQFK7YN.js → chunk-CWYPA63G.js} +109 -259
- package/dist/chunk-CWYPA63G.js.map +1 -0
- package/dist/{chunk-7IGHIFTT.js → chunk-HVBX5KIW.js} +15 -26
- package/dist/chunk-HVBX5KIW.js.map +1 -0
- package/dist/chunk-JFONSPNF.js +391 -0
- package/dist/chunk-JFONSPNF.js.map +1 -0
- package/dist/chunk-NZMBRXQV.js +2330 -0
- package/dist/chunk-NZMBRXQV.js.map +1 -0
- package/dist/{chunk-XWBVAO2R.js → chunk-PNUZM7PC.js} +20 -30
- package/dist/chunk-PNUZM7PC.js.map +1 -0
- package/dist/{chunk-ZTCDY5NQ.js → chunk-PX6PDUJ5.js} +34 -50
- package/dist/chunk-PX6PDUJ5.js.map +1 -0
- package/dist/chunk-XRFJJ2IU.js +2417 -0
- package/dist/chunk-XRFJJ2IU.js.map +1 -0
- package/dist/chunk-XTLYW4FR.js +6829 -0
- package/dist/chunk-XTLYW4FR.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +3489 -2286
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +6 -4
- package/dist/compat/nestjs/index.d.ts +6 -4
- package/dist/compat/nestjs/index.js +10 -8
- package/dist/core/index.cjs +1706 -1217
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +3 -2
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.js +37 -34
- package/dist/extra/index.cjs +7519 -6125
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +4 -4
- package/dist/extra/index.d.ts +4 -4
- package/dist/extra/index.js +63 -34
- package/dist/graph/index.cjs +3199 -2212
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +5 -3
- package/dist/graph/index.d.ts +5 -3
- package/dist/graph/index.js +24 -11
- package/dist/graph-BtdSRHUc.d.cts +1128 -0
- package/dist/graph-CEO2FkLY.d.ts +1128 -0
- package/dist/{index-DuN3bhtm.d.ts → index-B0tfuXwV.d.cts} +1697 -586
- package/dist/index-BFGjXbiP.d.cts +315 -0
- package/dist/{index-CgSiUouz.d.ts → index-BPlWVAKY.d.cts} +4 -4
- package/dist/index-BUj3ASVe.d.cts +406 -0
- package/dist/{index-VHA43cGP.d.cts → index-C59uSJAH.d.cts} +2 -2
- package/dist/index-CkElcUY6.d.ts +315 -0
- package/dist/index-DSPc5rkv.d.ts +406 -0
- package/dist/{index-BjtlNirP.d.cts → index-DgscL7v0.d.ts} +4 -4
- package/dist/{index-SFzE_KTa.d.cts → index-RXN94sHK.d.ts} +1697 -586
- package/dist/{index-8a605sg9.d.ts → index-jEtF4N7L.d.ts} +2 -2
- package/dist/index.cjs +9947 -7949
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +214 -37
- package/dist/index.d.ts +214 -37
- package/dist/index.js +919 -648
- package/dist/index.js.map +1 -1
- package/dist/meta-3QjzotRv.d.ts +41 -0
- package/dist/meta-B-Lbs4-O.d.cts +41 -0
- package/dist/node-C7PD3sn9.d.cts +1188 -0
- package/dist/node-C7PD3sn9.d.ts +1188 -0
- package/dist/{observable-DcBwQY7t.d.ts → observable-EyO-moQY.d.ts} +1 -1
- package/dist/{observable-C8Kx_O6k.d.cts → observable-axpzv1K2.d.cts} +1 -1
- package/dist/patterns/reactive-layout/index.cjs +3205 -2138
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +5 -3
- package/dist/patterns/reactive-layout/index.d.ts +5 -3
- package/dist/patterns/reactive-layout/index.js +7 -4
- package/dist/storage-CHT5WE9m.d.ts +182 -0
- package/dist/storage-DIgAr7M_.d.cts +182 -0
- package/package.json +2 -1
- package/dist/chunk-2UDLYZHT.js +0 -2117
- package/dist/chunk-2UDLYZHT.js.map +0 -1
- package/dist/chunk-4MQ2J6IG.js +0 -1631
- package/dist/chunk-4MQ2J6IG.js.map +0 -1
- package/dist/chunk-7IGHIFTT.js.map +0 -1
- package/dist/chunk-DOSLSFKL.js +0 -162
- package/dist/chunk-DOSLSFKL.js.map +0 -1
- package/dist/chunk-ECN37NVS.js +0 -6227
- package/dist/chunk-ECN37NVS.js.map +0 -1
- package/dist/chunk-G66H6ZRK.js +0 -111
- package/dist/chunk-G66H6ZRK.js.map +0 -1
- package/dist/chunk-VOQFK7YN.js.map +0 -1
- package/dist/chunk-WZ2Z2CRV.js +0 -32
- package/dist/chunk-WZ2Z2CRV.js.map +0 -1
- package/dist/chunk-XWBVAO2R.js.map +0 -1
- package/dist/chunk-ZTCDY5NQ.js.map +0 -1
- package/dist/graph-KsTe57nI.d.cts +0 -750
- package/dist/graph-mILUUqW8.d.ts +0 -750
- package/dist/index-B2SvPEbc.d.ts +0 -257
- package/dist/index-BHfg_Ez3.d.ts +0 -629
- package/dist/index-Bc_diYYJ.d.cts +0 -629
- package/dist/index-UudxGnzc.d.cts +0 -257
- package/dist/meta-BnG7XAaE.d.cts +0 -778
- package/dist/meta-BnG7XAaE.d.ts +0 -778
|
@@ -3,56 +3,12 @@ import {
|
|
|
3
3
|
DATA,
|
|
4
4
|
DIRTY,
|
|
5
5
|
ERROR,
|
|
6
|
-
|
|
7
|
-
RESUME,
|
|
8
|
-
batch,
|
|
9
|
-
derived,
|
|
6
|
+
RESOLVED,
|
|
10
7
|
node,
|
|
11
8
|
producer,
|
|
12
9
|
state,
|
|
13
10
|
wallClockNs
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
|
|
16
|
-
// src/extra/observable.ts
|
|
17
|
-
import { Observable } from "rxjs";
|
|
18
|
-
function toObservable(node2, options) {
|
|
19
|
-
if (options?.raw) {
|
|
20
|
-
return new Observable((subscriber) => {
|
|
21
|
-
const unsub = node2.subscribe((msgs) => {
|
|
22
|
-
if (subscriber.closed) return;
|
|
23
|
-
subscriber.next(msgs);
|
|
24
|
-
for (const m of msgs) {
|
|
25
|
-
if (m[0] === ERROR) {
|
|
26
|
-
subscriber.error(m[1]);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (m[0] === COMPLETE) {
|
|
30
|
-
subscriber.complete();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return unsub;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return new Observable((subscriber) => {
|
|
39
|
-
const unsub = node2.subscribe((msgs) => {
|
|
40
|
-
for (const m of msgs) {
|
|
41
|
-
if (subscriber.closed) return;
|
|
42
|
-
if (m[0] === DATA) {
|
|
43
|
-
subscriber.next(m[1]);
|
|
44
|
-
} else if (m[0] === ERROR) {
|
|
45
|
-
subscriber.error(m[1]);
|
|
46
|
-
return;
|
|
47
|
-
} else if (m[0] === COMPLETE) {
|
|
48
|
-
subscriber.complete();
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return unsub;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
11
|
+
} from "./chunk-NZMBRXQV.js";
|
|
56
12
|
|
|
57
13
|
// src/extra/cron.ts
|
|
58
14
|
function parseField(field, min, max) {
|
|
@@ -103,9 +59,6 @@ import { resolve as resolvePath } from "path";
|
|
|
103
59
|
function sourceOpts(opts) {
|
|
104
60
|
return { describeKind: "producer", ...opts };
|
|
105
61
|
}
|
|
106
|
-
function operatorOpts(opts) {
|
|
107
|
-
return { describeKind: "operator", ...opts };
|
|
108
|
-
}
|
|
109
62
|
function escapeRegexChar(ch) {
|
|
110
63
|
return /[\\^$+?.()|[\]{}]/.test(ch) ? `\\${ch}` : ch;
|
|
111
64
|
}
|
|
@@ -135,20 +88,28 @@ function matchesAnyPattern(path, patterns) {
|
|
|
135
88
|
return false;
|
|
136
89
|
}
|
|
137
90
|
function wrapSubscribeHook(inner, before) {
|
|
138
|
-
const wrapper = node(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
91
|
+
const wrapper = node(
|
|
92
|
+
[inner],
|
|
93
|
+
(data, a) => {
|
|
94
|
+
const batch0 = data[0];
|
|
95
|
+
if (batch0 == null || batch0.length === 0) {
|
|
96
|
+
a.down([[RESOLVED]]);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
for (const v of batch0) a.emit(v);
|
|
100
|
+
},
|
|
101
|
+
{ describeKind: "derived", initial: inner.cache }
|
|
102
|
+
);
|
|
142
103
|
const origSubscribe = wrapper.subscribe.bind(wrapper);
|
|
143
|
-
wrapper.subscribe = (sink,
|
|
104
|
+
wrapper.subscribe = (sink, actor) => {
|
|
144
105
|
before(sink);
|
|
145
|
-
return origSubscribe(sink,
|
|
106
|
+
return origSubscribe(sink, actor);
|
|
146
107
|
};
|
|
147
108
|
return wrapper;
|
|
148
109
|
}
|
|
149
110
|
function fromTimer(ms, opts) {
|
|
150
111
|
const { signal, period, ...rest } = opts ?? {};
|
|
151
|
-
return producer((
|
|
112
|
+
return producer((a) => {
|
|
152
113
|
let done = false;
|
|
153
114
|
let count = 0;
|
|
154
115
|
let t;
|
|
@@ -161,8 +122,8 @@ function fromTimer(ms, opts) {
|
|
|
161
122
|
};
|
|
162
123
|
const finish = () => {
|
|
163
124
|
if (done) return;
|
|
164
|
-
a.emit(count++);
|
|
165
125
|
if (period != null) {
|
|
126
|
+
a.emit(count++);
|
|
166
127
|
iv = setInterval(() => {
|
|
167
128
|
if (done) return;
|
|
168
129
|
a.emit(count++);
|
|
@@ -170,7 +131,8 @@ function fromTimer(ms, opts) {
|
|
|
170
131
|
} else {
|
|
171
132
|
done = true;
|
|
172
133
|
signal?.removeEventListener("abort", onAbort);
|
|
173
|
-
|
|
134
|
+
a.emit(count++);
|
|
135
|
+
a.down([[COMPLETE]]);
|
|
174
136
|
}
|
|
175
137
|
};
|
|
176
138
|
const onAbort = () => {
|
|
@@ -193,7 +155,7 @@ function fromCron(expr, opts) {
|
|
|
193
155
|
const tickMs = tickOpt ?? 6e4;
|
|
194
156
|
const emitDate = output === "date";
|
|
195
157
|
return producer(
|
|
196
|
-
(
|
|
158
|
+
(a) => {
|
|
197
159
|
let lastFiredKey = -1;
|
|
198
160
|
const check = () => {
|
|
199
161
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -212,7 +174,7 @@ function fromCron(expr, opts) {
|
|
|
212
174
|
}
|
|
213
175
|
function fromEvent(target, type, opts) {
|
|
214
176
|
const { capture, passive, once, ...rest } = opts ?? {};
|
|
215
|
-
return producer((
|
|
177
|
+
return producer((a) => {
|
|
216
178
|
const handler = (e) => {
|
|
217
179
|
a.emit(e);
|
|
218
180
|
};
|
|
@@ -231,7 +193,7 @@ function fromFSWatch(paths, opts) {
|
|
|
231
193
|
const excludePatterns = (exclude ?? ["**/node_modules/**", "**/.git/**", "**/dist/**"]).map(
|
|
232
194
|
globToRegExp
|
|
233
195
|
);
|
|
234
|
-
return producer((
|
|
196
|
+
return producer((a) => {
|
|
235
197
|
const pending = /* @__PURE__ */ new Map();
|
|
236
198
|
const watchers = [];
|
|
237
199
|
let stopped = false;
|
|
@@ -315,7 +277,7 @@ function fromFSWatch(paths, opts) {
|
|
|
315
277
|
}, sourceOpts(rest));
|
|
316
278
|
}
|
|
317
279
|
function fromIter(iterable, opts) {
|
|
318
|
-
return producer((
|
|
280
|
+
return producer((a) => {
|
|
319
281
|
let cancelled = false;
|
|
320
282
|
try {
|
|
321
283
|
for (const x of iterable) {
|
|
@@ -336,7 +298,7 @@ function isThenable(x) {
|
|
|
336
298
|
}
|
|
337
299
|
function fromPromise(p, opts) {
|
|
338
300
|
const { signal, ...rest } = opts ?? {};
|
|
339
|
-
return producer((
|
|
301
|
+
return producer((a) => {
|
|
340
302
|
let settled = false;
|
|
341
303
|
const onAbort = () => {
|
|
342
304
|
if (settled) return;
|
|
@@ -371,7 +333,7 @@ function fromPromise(p, opts) {
|
|
|
371
333
|
}
|
|
372
334
|
function fromAsyncIter(iterable, opts) {
|
|
373
335
|
const { signal: outerSignal, ...rest } = opts ?? {};
|
|
374
|
-
return producer((
|
|
336
|
+
return producer((a) => {
|
|
375
337
|
const ac = new AbortController();
|
|
376
338
|
const onOuterAbort = () => ac.abort(outerSignal?.reason);
|
|
377
339
|
if (outerSignal?.aborted) {
|
|
@@ -388,18 +350,18 @@ function fromAsyncIter(iterable, opts) {
|
|
|
388
350
|
(step) => {
|
|
389
351
|
if (cancelled || signal.aborted) return;
|
|
390
352
|
if (step.done) {
|
|
391
|
-
|
|
353
|
+
a.down([[COMPLETE]]);
|
|
392
354
|
return;
|
|
393
355
|
}
|
|
394
356
|
a.emit(step.value);
|
|
395
|
-
|
|
357
|
+
pump();
|
|
396
358
|
},
|
|
397
359
|
(e) => {
|
|
398
360
|
if (!cancelled && !signal.aborted) a.down([[ERROR, e]]);
|
|
399
361
|
}
|
|
400
362
|
);
|
|
401
363
|
};
|
|
402
|
-
|
|
364
|
+
pump();
|
|
403
365
|
return () => {
|
|
404
366
|
cancelled = true;
|
|
405
367
|
outerSignal?.removeEventListener("abort", onOuterAbort);
|
|
@@ -409,7 +371,7 @@ function fromAsyncIter(iterable, opts) {
|
|
|
409
371
|
}, sourceOpts(rest));
|
|
410
372
|
}
|
|
411
373
|
function isNode(x) {
|
|
412
|
-
return x != null && typeof x
|
|
374
|
+
return x != null && typeof x === "object" && "cache" in x && typeof x.subscribe === "function";
|
|
413
375
|
}
|
|
414
376
|
function fromAny(input, opts) {
|
|
415
377
|
if (isNode(input)) {
|
|
@@ -433,7 +395,7 @@ function of(...values) {
|
|
|
433
395
|
return fromIter(values, void 0);
|
|
434
396
|
}
|
|
435
397
|
function empty(opts) {
|
|
436
|
-
return producer((
|
|
398
|
+
return producer((a) => {
|
|
437
399
|
a.down([[COMPLETE]]);
|
|
438
400
|
return void 0;
|
|
439
401
|
}, sourceOpts(opts));
|
|
@@ -442,58 +404,64 @@ function never(opts) {
|
|
|
442
404
|
return producer(() => void 0, sourceOpts(opts));
|
|
443
405
|
}
|
|
444
406
|
function throwError(err, opts) {
|
|
445
|
-
return producer((
|
|
407
|
+
return producer((a) => {
|
|
446
408
|
a.down([[ERROR, err]]);
|
|
447
409
|
return void 0;
|
|
448
410
|
}, sourceOpts(opts));
|
|
449
411
|
}
|
|
450
412
|
function forEach(source, fn, opts) {
|
|
451
|
-
const inner = node(
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
if (
|
|
456
|
-
fn(
|
|
457
|
-
return true;
|
|
413
|
+
const inner = node(
|
|
414
|
+
[source],
|
|
415
|
+
(data, _actions) => {
|
|
416
|
+
const batch0 = data[0];
|
|
417
|
+
if (batch0 != null && batch0.length > 0) {
|
|
418
|
+
for (const v of batch0) fn(v);
|
|
458
419
|
}
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
420
|
+
},
|
|
421
|
+
{ describeKind: "effect", ...opts }
|
|
422
|
+
);
|
|
462
423
|
return inner.subscribe(() => {
|
|
463
424
|
});
|
|
464
425
|
}
|
|
465
426
|
function toArray(source, opts) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
427
|
+
return node(
|
|
428
|
+
[source],
|
|
429
|
+
(data, actions, ctx) => {
|
|
430
|
+
if (!ctx.store.buf) ctx.store.buf = [];
|
|
431
|
+
const buf = ctx.store.buf;
|
|
432
|
+
const batch0 = data[0];
|
|
433
|
+
if (batch0 != null && batch0.length > 0) {
|
|
434
|
+
for (const v of batch0) buf.push(v);
|
|
474
435
|
}
|
|
475
|
-
if (
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
return
|
|
436
|
+
if (ctx.terminalDeps[0] === true) {
|
|
437
|
+
actions.emit([...buf]);
|
|
438
|
+
actions.down([[COMPLETE]]);
|
|
439
|
+
return;
|
|
479
440
|
}
|
|
480
|
-
|
|
441
|
+
if (batch0 == null || batch0.length === 0) {
|
|
442
|
+
actions.down([[RESOLVED]]);
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
describeKind: "derived",
|
|
447
|
+
completeWhenDepsComplete: false,
|
|
448
|
+
...opts
|
|
481
449
|
}
|
|
482
|
-
|
|
450
|
+
);
|
|
483
451
|
}
|
|
484
452
|
function share(source, opts) {
|
|
485
453
|
return producer(
|
|
486
|
-
(
|
|
454
|
+
(a) => source.subscribe((msgs) => {
|
|
487
455
|
a.down(msgs);
|
|
488
456
|
}),
|
|
489
|
-
{ ...sourceOpts(opts), initial: source.
|
|
457
|
+
{ ...sourceOpts(opts), initial: source.cache }
|
|
490
458
|
);
|
|
491
459
|
}
|
|
492
460
|
function replay(source, bufferSize, opts) {
|
|
493
461
|
if (bufferSize < 1) throw new RangeError("replay expects bufferSize >= 1");
|
|
494
462
|
const buf = [];
|
|
495
463
|
const inner = producer(
|
|
496
|
-
(
|
|
464
|
+
(a) => source.subscribe((msgs) => {
|
|
497
465
|
for (const m of msgs) {
|
|
498
466
|
if (m[0] === DATA) {
|
|
499
467
|
buf.push(m[1]);
|
|
@@ -502,7 +470,7 @@ function replay(source, bufferSize, opts) {
|
|
|
502
470
|
}
|
|
503
471
|
a.down(msgs);
|
|
504
472
|
}),
|
|
505
|
-
{ ...sourceOpts(opts), initial: source.
|
|
473
|
+
{ ...sourceOpts(opts), initial: source.cache }
|
|
506
474
|
);
|
|
507
475
|
return wrapSubscribeHook(inner, (sink) => {
|
|
508
476
|
for (const v of buf) {
|
|
@@ -516,35 +484,52 @@ function cached(source, opts) {
|
|
|
516
484
|
function firstValueFrom(source) {
|
|
517
485
|
return new Promise((resolve, reject) => {
|
|
518
486
|
let settled = false;
|
|
519
|
-
|
|
487
|
+
let shouldUnsub = false;
|
|
488
|
+
let unsub;
|
|
489
|
+
unsub = source.subscribe((msgs) => {
|
|
520
490
|
for (const m of msgs) {
|
|
521
491
|
if (settled) return;
|
|
522
492
|
if (m[0] === DATA) {
|
|
523
493
|
settled = true;
|
|
524
494
|
resolve(m[1]);
|
|
525
|
-
|
|
495
|
+
if (unsub) {
|
|
496
|
+
unsub();
|
|
497
|
+
unsub = void 0;
|
|
498
|
+
} else shouldUnsub = true;
|
|
526
499
|
return;
|
|
527
500
|
}
|
|
528
501
|
if (m[0] === ERROR) {
|
|
529
502
|
settled = true;
|
|
530
503
|
reject(m[1]);
|
|
531
|
-
|
|
504
|
+
if (unsub) {
|
|
505
|
+
unsub();
|
|
506
|
+
unsub = void 0;
|
|
507
|
+
} else shouldUnsub = true;
|
|
532
508
|
return;
|
|
533
509
|
}
|
|
534
510
|
if (m[0] === COMPLETE) {
|
|
535
511
|
settled = true;
|
|
536
512
|
reject(new Error("completed without DATA"));
|
|
537
|
-
|
|
513
|
+
if (unsub) {
|
|
514
|
+
unsub();
|
|
515
|
+
unsub = void 0;
|
|
516
|
+
} else shouldUnsub = true;
|
|
538
517
|
return;
|
|
539
518
|
}
|
|
540
519
|
}
|
|
541
520
|
});
|
|
521
|
+
if (shouldUnsub) {
|
|
522
|
+
unsub?.();
|
|
523
|
+
unsub = void 0;
|
|
524
|
+
}
|
|
542
525
|
});
|
|
543
526
|
}
|
|
544
527
|
function firstWhere(source, predicate) {
|
|
545
528
|
return new Promise((resolve, reject) => {
|
|
546
529
|
let settled = false;
|
|
547
|
-
|
|
530
|
+
let shouldUnsub = false;
|
|
531
|
+
let unsub;
|
|
532
|
+
unsub = source.subscribe((msgs) => {
|
|
548
533
|
for (const m of msgs) {
|
|
549
534
|
if (settled) return;
|
|
550
535
|
if (m[0] === DATA) {
|
|
@@ -552,24 +537,37 @@ function firstWhere(source, predicate) {
|
|
|
552
537
|
if (predicate(v)) {
|
|
553
538
|
settled = true;
|
|
554
539
|
resolve(v);
|
|
555
|
-
|
|
540
|
+
if (unsub) {
|
|
541
|
+
unsub();
|
|
542
|
+
unsub = void 0;
|
|
543
|
+
} else shouldUnsub = true;
|
|
556
544
|
return;
|
|
557
545
|
}
|
|
558
546
|
}
|
|
559
547
|
if (m[0] === ERROR) {
|
|
560
548
|
settled = true;
|
|
561
549
|
reject(m[1]);
|
|
562
|
-
|
|
550
|
+
if (unsub) {
|
|
551
|
+
unsub();
|
|
552
|
+
unsub = void 0;
|
|
553
|
+
} else shouldUnsub = true;
|
|
563
554
|
return;
|
|
564
555
|
}
|
|
565
556
|
if (m[0] === COMPLETE) {
|
|
566
557
|
settled = true;
|
|
567
558
|
reject(new Error("completed without matching value"));
|
|
568
|
-
|
|
559
|
+
if (unsub) {
|
|
560
|
+
unsub();
|
|
561
|
+
unsub = void 0;
|
|
562
|
+
} else shouldUnsub = true;
|
|
569
563
|
return;
|
|
570
564
|
}
|
|
571
565
|
}
|
|
572
566
|
});
|
|
567
|
+
if (shouldUnsub) {
|
|
568
|
+
unsub?.();
|
|
569
|
+
unsub = void 0;
|
|
570
|
+
}
|
|
573
571
|
});
|
|
574
572
|
}
|
|
575
573
|
var shareReplay = replay;
|
|
@@ -582,166 +580,21 @@ function reactiveCounter(cap) {
|
|
|
582
580
|
return {
|
|
583
581
|
node: counter,
|
|
584
582
|
increment() {
|
|
585
|
-
const current = counter.
|
|
583
|
+
const current = counter.cache ?? 0;
|
|
586
584
|
if (current >= cap) return false;
|
|
587
585
|
counter.down([[DIRTY], [DATA, current + 1]]);
|
|
588
586
|
return true;
|
|
589
587
|
},
|
|
590
588
|
get() {
|
|
591
|
-
return counter.
|
|
589
|
+
return counter.cache ?? 0;
|
|
592
590
|
},
|
|
593
591
|
atCap() {
|
|
594
|
-
return (counter.
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// src/extra/backpressure.ts
|
|
600
|
-
var nextLockId = 0;
|
|
601
|
-
function createWatermarkController(sendUp, opts) {
|
|
602
|
-
if (opts.highWaterMark < 1) throw new RangeError("highWaterMark must be >= 1");
|
|
603
|
-
if (opts.lowWaterMark < 0) throw new RangeError("lowWaterMark must be >= 0");
|
|
604
|
-
if (opts.lowWaterMark >= opts.highWaterMark)
|
|
605
|
-
throw new RangeError("lowWaterMark must be < highWaterMark");
|
|
606
|
-
const lockId = /* @__PURE__ */ Symbol(`bp-${++nextLockId}`);
|
|
607
|
-
let pending = 0;
|
|
608
|
-
let paused = false;
|
|
609
|
-
return {
|
|
610
|
-
onEnqueue() {
|
|
611
|
-
pending += 1;
|
|
612
|
-
if (!paused && pending >= opts.highWaterMark) {
|
|
613
|
-
paused = true;
|
|
614
|
-
sendUp([[PAUSE, lockId]]);
|
|
615
|
-
return true;
|
|
616
|
-
}
|
|
617
|
-
return false;
|
|
618
|
-
},
|
|
619
|
-
onDequeue() {
|
|
620
|
-
if (pending > 0) pending -= 1;
|
|
621
|
-
if (paused && pending <= opts.lowWaterMark) {
|
|
622
|
-
paused = false;
|
|
623
|
-
sendUp([[RESUME, lockId]]);
|
|
624
|
-
return true;
|
|
625
|
-
}
|
|
626
|
-
return false;
|
|
627
|
-
},
|
|
628
|
-
get pending() {
|
|
629
|
-
return pending;
|
|
630
|
-
},
|
|
631
|
-
get paused() {
|
|
632
|
-
return paused;
|
|
633
|
-
},
|
|
634
|
-
dispose() {
|
|
635
|
-
if (paused) {
|
|
636
|
-
paused = false;
|
|
637
|
-
sendUp([[RESUME, lockId]]);
|
|
638
|
-
}
|
|
592
|
+
return (counter.cache ?? 0) >= cap;
|
|
639
593
|
}
|
|
640
594
|
};
|
|
641
595
|
}
|
|
642
596
|
|
|
643
|
-
// src/extra/reactive-log.ts
|
|
644
|
-
function keepaliveDerived(n) {
|
|
645
|
-
return n.subscribe(() => {
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
function reactiveLog(initial, options = {}) {
|
|
649
|
-
const { name, maxSize } = options;
|
|
650
|
-
if (maxSize !== void 0 && maxSize < 1) {
|
|
651
|
-
throw new RangeError("maxSize must be >= 1");
|
|
652
|
-
}
|
|
653
|
-
const buf = initial ? [...initial] : [];
|
|
654
|
-
if (maxSize !== void 0 && buf.length > maxSize) {
|
|
655
|
-
buf.splice(0, buf.length - maxSize);
|
|
656
|
-
}
|
|
657
|
-
const entries = state(buf.length > 0 ? [...buf] : [], {
|
|
658
|
-
name,
|
|
659
|
-
describeKind: "state",
|
|
660
|
-
equals: (a, b) => a === b
|
|
661
|
-
});
|
|
662
|
-
function pushSnapshot() {
|
|
663
|
-
const snapshot = [...buf];
|
|
664
|
-
batch(() => {
|
|
665
|
-
entries.down([[DIRTY]]);
|
|
666
|
-
entries.down([[DATA, snapshot]]);
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
function trimBuf() {
|
|
670
|
-
if (maxSize !== void 0 && buf.length > maxSize) {
|
|
671
|
-
buf.splice(0, buf.length - maxSize);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
const bundle = {
|
|
675
|
-
entries,
|
|
676
|
-
append(value) {
|
|
677
|
-
buf.push(value);
|
|
678
|
-
trimBuf();
|
|
679
|
-
pushSnapshot();
|
|
680
|
-
},
|
|
681
|
-
appendMany(values) {
|
|
682
|
-
if (values.length === 0) return;
|
|
683
|
-
buf.push(...values);
|
|
684
|
-
trimBuf();
|
|
685
|
-
pushSnapshot();
|
|
686
|
-
},
|
|
687
|
-
clear() {
|
|
688
|
-
if (buf.length === 0) return;
|
|
689
|
-
buf.length = 0;
|
|
690
|
-
pushSnapshot();
|
|
691
|
-
},
|
|
692
|
-
trimHead(n) {
|
|
693
|
-
if (n < 0) {
|
|
694
|
-
throw new RangeError("n must be >= 0");
|
|
695
|
-
}
|
|
696
|
-
if (n === 0) return;
|
|
697
|
-
if (n >= buf.length) {
|
|
698
|
-
if (buf.length === 0) return;
|
|
699
|
-
buf.length = 0;
|
|
700
|
-
} else {
|
|
701
|
-
buf.splice(0, n);
|
|
702
|
-
}
|
|
703
|
-
pushSnapshot();
|
|
704
|
-
},
|
|
705
|
-
tail(n) {
|
|
706
|
-
if (n < 0) {
|
|
707
|
-
throw new RangeError("n must be >= 0");
|
|
708
|
-
}
|
|
709
|
-
const e = entries.get();
|
|
710
|
-
const init = n === 0 ? [] : e.slice(Math.max(0, e.length - n));
|
|
711
|
-
const out = derived(
|
|
712
|
-
[entries],
|
|
713
|
-
([s]) => {
|
|
714
|
-
const list = s;
|
|
715
|
-
return n === 0 ? [] : list.slice(Math.max(0, list.length - n));
|
|
716
|
-
},
|
|
717
|
-
{ initial: init, describeKind: "derived" }
|
|
718
|
-
);
|
|
719
|
-
keepaliveDerived(out);
|
|
720
|
-
return out;
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
return bundle;
|
|
724
|
-
}
|
|
725
|
-
function logSlice(log, start, stop) {
|
|
726
|
-
if (start < 0) {
|
|
727
|
-
throw new RangeError("start must be >= 0");
|
|
728
|
-
}
|
|
729
|
-
const e = log.entries.get();
|
|
730
|
-
const init = stop === void 0 ? e.slice(start) : e.slice(start, stop);
|
|
731
|
-
const out = derived(
|
|
732
|
-
[log.entries],
|
|
733
|
-
([s]) => {
|
|
734
|
-
const list = s;
|
|
735
|
-
return stop === void 0 ? list.slice(start) : list.slice(start, stop);
|
|
736
|
-
},
|
|
737
|
-
{ initial: init, describeKind: "derived" }
|
|
738
|
-
);
|
|
739
|
-
keepaliveDerived(out);
|
|
740
|
-
return out;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
597
|
export {
|
|
744
|
-
toObservable,
|
|
745
598
|
parseCron,
|
|
746
599
|
matchesCron,
|
|
747
600
|
escapeRegexChar,
|
|
@@ -768,9 +621,6 @@ export {
|
|
|
768
621
|
firstWhere,
|
|
769
622
|
shareReplay,
|
|
770
623
|
keepalive,
|
|
771
|
-
reactiveCounter
|
|
772
|
-
createWatermarkController,
|
|
773
|
-
reactiveLog,
|
|
774
|
-
logSlice
|
|
624
|
+
reactiveCounter
|
|
775
625
|
};
|
|
776
|
-
//# sourceMappingURL=chunk-
|
|
626
|
+
//# sourceMappingURL=chunk-CWYPA63G.js.map
|