uneventful 0.0.6 → 0.0.8
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 +2 -2
- package/dist/{call-or-wait-DHkBd_bM.mjs → call-or-wait-COAmx32w.mjs} +24 -92
- package/dist/call-or-wait-COAmx32w.mjs.map +1 -0
- package/dist/mod.d.ts +1 -1
- package/dist/mod.mjs +7 -4
- package/dist/mod.mjs.map +1 -1
- package/dist/signals.d.ts +47 -22
- package/dist/signals.mjs +143 -58
- package/dist/signals.mjs.map +1 -1
- package/dist/{sinks-kEzJo6Hc.d.ts → sinks-5TuxCRtX.d.ts} +26 -1
- package/dist/utils-P0JEpWXG.mjs +87 -0
- package/dist/utils-P0JEpWXG.mjs.map +1 -0
- package/dist/utils.d.ts +94 -2
- package/dist/utils.mjs +1 -17
- package/dist/utils.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/call-or-wait-DHkBd_bM.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -146,7 +146,7 @@ Second, you can also *turn streams into signals*, by passing them to `cached()`.
|
|
|
146
146
|
But wait, there's more: Unlike most libraries' "effects", Uneventful's rules *start asynchronously* and can be *independently scheduled*. This means, for example, that it's easy to make rules that run only in, say, animation frames:
|
|
147
147
|
|
|
148
148
|
```ts
|
|
149
|
-
import { rule } from "uneventful";
|
|
149
|
+
import { rule } from "uneventful/signals";
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
152
|
* An alternate version of rule() that runs in animation frames
|
|
@@ -185,7 +185,7 @@ So far, we've highlighted just a handful of Uneventful's coolest and most impact
|
|
|
185
185
|
- Play well with state charts, or ignore the charts and just express interactivity directly in code!
|
|
186
186
|
- Easily control the *timing* of operations, building advanced debouncing and sampling with basic async operators like `sleep()` or by defining rules tied to a scheduler
|
|
187
187
|
|
|
188
|
-
And at the same time, this has actually been a pretty superficial tour: we haven't gotten into a lot of things like how to actually *use* signals or abort jobs or any other details, really. For those, you'll currently have to dig through the [API Reference](https://uneventful.js.org/modules.html), but there should be more tutorials and guides as time goes on.
|
|
188
|
+
And at the same time, this has actually been a pretty superficial tour: we haven't gotten into a lot of things like how to actually *use* signals or abort jobs or any other details, really. For those, you'll currently have to dig through the [API Reference](https://uneventful.js.org/modules/uneventful.html), but there should be more tutorials and guides as time goes on.
|
|
189
189
|
|
|
190
190
|
(Also, at some point you'll be able to use the "Calibre Connect" Obsidian plugin I'm working on as an example of how to use these things to create responsive search and tame Electron WebFrames while keeping track of whether a connection to a remote server is available, handling logins and background processes and integrating a plugin to a larger application, not to mention controlling lots of features via settings.)
|
|
191
191
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { isFunction, apply } from './utils.mjs';
|
|
2
|
-
|
|
3
|
-
let defer = typeof queueMicrotask === "function" ? queueMicrotask : /* @__PURE__ */ ((p) => (cb) => p.then(cb))(Promise.resolve());
|
|
1
|
+
import { b as batch, d as defer, i as isFunction, G as GeneratorBase, c as apply } from './utils-P0JEpWXG.mjs';
|
|
4
2
|
|
|
5
3
|
function resolve(request, val) {
|
|
6
4
|
request("next", val);
|
|
@@ -94,6 +92,12 @@ const catchers = /* @__PURE__ */ new WeakMap(), defaultCatch = (e) => {
|
|
|
94
92
|
};
|
|
95
93
|
const nullCtx = makeCtx();
|
|
96
94
|
const owners = /* @__PURE__ */ new WeakMap();
|
|
95
|
+
const pulls = /* @__PURE__ */ batch((pulls2) => {
|
|
96
|
+
for (const conn of pulls2) {
|
|
97
|
+
pulls2.delete(conn);
|
|
98
|
+
conn.doPull();
|
|
99
|
+
}
|
|
100
|
+
}, defer);
|
|
97
101
|
|
|
98
102
|
function chain() {
|
|
99
103
|
return link(0, void 0, void 0);
|
|
@@ -181,7 +185,7 @@ function unlinker(chain2, node) {
|
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
function getJob() {
|
|
184
|
-
const
|
|
188
|
+
const job = current.job || current.cell?.getJob();
|
|
185
189
|
if (job)
|
|
186
190
|
return job;
|
|
187
191
|
throw new Error("No job is currently active");
|
|
@@ -335,9 +339,22 @@ class _Job {
|
|
|
335
339
|
if (init)
|
|
336
340
|
result = job.run(init, job);
|
|
337
341
|
if (result != null) {
|
|
338
|
-
if (result
|
|
342
|
+
if (isFunction(result)) {
|
|
343
|
+
job.must(result);
|
|
344
|
+
} else if (result instanceof GeneratorBase) {
|
|
345
|
+
job.run(runGen, result, job);
|
|
346
|
+
} else if (result instanceof _Job) {
|
|
339
347
|
if (result !== job)
|
|
340
348
|
result.do((res) => propagateResult(job, res));
|
|
349
|
+
} else if (result instanceof Promise) {
|
|
350
|
+
result.then(
|
|
351
|
+
(v) => {
|
|
352
|
+
job.result() || job.return(v);
|
|
353
|
+
},
|
|
354
|
+
(e) => {
|
|
355
|
+
job.result() || job.throw(e);
|
|
356
|
+
}
|
|
357
|
+
);
|
|
341
358
|
} else if (isFunction(result.then)) {
|
|
342
359
|
result.then(
|
|
343
360
|
(v) => {
|
|
@@ -347,11 +364,8 @@ class _Job {
|
|
|
347
364
|
job.result() || job.throw(e);
|
|
348
365
|
}
|
|
349
366
|
);
|
|
350
|
-
return job;
|
|
351
367
|
} else if (isFunction(result[Symbol.iterator]) && typeof result !== "string") {
|
|
352
368
|
job.run(runGen, result, job);
|
|
353
|
-
} else if (isFunction(result)) {
|
|
354
|
-
job.must(result);
|
|
355
369
|
} else {
|
|
356
370
|
throw new TypeError("Invalid value/return for start()");
|
|
357
371
|
}
|
|
@@ -508,88 +522,6 @@ function runGen(g, job) {
|
|
|
508
522
|
}
|
|
509
523
|
}
|
|
510
524
|
|
|
511
|
-
class RunQueue {
|
|
512
|
-
constructor(sched, reap) {
|
|
513
|
-
this.sched = sched;
|
|
514
|
-
this.reap = reap;
|
|
515
|
-
this._flags = 0 /* Unset */;
|
|
516
|
-
this.q = /* @__PURE__ */ new Set();
|
|
517
|
-
this._run = () => {
|
|
518
|
-
this._flags &= ~2 /* Scheduled */;
|
|
519
|
-
this.flush();
|
|
520
|
-
};
|
|
521
|
-
/** Run all pending items */
|
|
522
|
-
this.flush = () => {
|
|
523
|
-
if (this._flags & 1 /* Running */)
|
|
524
|
-
return;
|
|
525
|
-
const { q: queue } = this;
|
|
526
|
-
if (!queue.size)
|
|
527
|
-
return;
|
|
528
|
-
this._flags |= 1 /* Running */;
|
|
529
|
-
try {
|
|
530
|
-
this.reap(queue);
|
|
531
|
-
} finally {
|
|
532
|
-
this._flags &= ~1 /* Running */;
|
|
533
|
-
!queue.size || this._flags & 2 /* Scheduled */ || this._sched();
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
/** Is this queue currently running? */
|
|
538
|
-
isRunning() {
|
|
539
|
-
return !!(this._flags & 1 /* Running */);
|
|
540
|
-
}
|
|
541
|
-
/** Is this queue currently empty? */
|
|
542
|
-
isEmpty() {
|
|
543
|
-
return !this.q.size;
|
|
544
|
-
}
|
|
545
|
-
add(subject) {
|
|
546
|
-
this.q.size || this._flags & (1 /* Running */ | 2 /* Scheduled */) || this._sched();
|
|
547
|
-
this.q.add(subject);
|
|
548
|
-
}
|
|
549
|
-
delete(subject) {
|
|
550
|
-
this.q.delete(subject);
|
|
551
|
-
}
|
|
552
|
-
has(subject) {
|
|
553
|
-
return this.q.has(subject);
|
|
554
|
-
}
|
|
555
|
-
_sched() {
|
|
556
|
-
this._flags |= 2 /* Scheduled */;
|
|
557
|
-
this.sched(this._run);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
var currentRule;
|
|
561
|
-
var currentQueue;
|
|
562
|
-
const ruleQueues = /* @__PURE__ */ new WeakMap();
|
|
563
|
-
const ruleStops = /* @__PURE__ */ new WeakMap();
|
|
564
|
-
class RuleQueue extends RunQueue {
|
|
565
|
-
constructor(sched) {
|
|
566
|
-
super(sched, function(q) {
|
|
567
|
-
if (currentQueue)
|
|
568
|
-
return;
|
|
569
|
-
currentQueue = this;
|
|
570
|
-
try {
|
|
571
|
-
for (currentRule of q) {
|
|
572
|
-
currentRule.catchUp();
|
|
573
|
-
q.delete(currentRule);
|
|
574
|
-
}
|
|
575
|
-
} finally {
|
|
576
|
-
currentQueue = currentRule = void 0;
|
|
577
|
-
}
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
function ruleQueue(scheduleFn = defer) {
|
|
582
|
-
ruleQueues.has(scheduleFn) || ruleQueues.set(scheduleFn, new RuleQueue(scheduleFn));
|
|
583
|
-
return ruleQueues.get(scheduleFn);
|
|
584
|
-
}
|
|
585
|
-
const defaultQ = /* @__PURE__ */ ruleQueue(defer);
|
|
586
|
-
const pulls = /* @__PURE__ */ new RunQueue(defer, (pulls2) => {
|
|
587
|
-
for (const conn of pulls2) {
|
|
588
|
-
pulls2.delete(conn);
|
|
589
|
-
conn.doPull();
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
|
|
593
525
|
function backpressure(inlet = defaultInlet) {
|
|
594
526
|
const job = getJob();
|
|
595
527
|
return (cb) => {
|
|
@@ -769,5 +701,5 @@ function mustBeSourceOrSignal() {
|
|
|
769
701
|
throw new TypeError("not a source or signal");
|
|
770
702
|
}
|
|
771
703
|
|
|
772
|
-
export {
|
|
773
|
-
//# sourceMappingURL=call-or-wait-
|
|
704
|
+
export { nativePromise as A, makeJob as B, CancelResult as C, pipe as D, ErrorResult as E, compose as F, into as G, isJobActive as H, IsStream as I, timeout as J, abortSignal as K, task as L, swapCtx as M, nullCtx as N, makeCtx as O, freeCtx as P, ValueResult as V, rejecter as a, resolve as b, backpressure as c, detached as d, isUnhandled as e, markHandled as f, getJob as g, isError as h, isCancel as i, connect as j, fulfillPromise as k, callOrWait as l, must as m, noop as n, restarting as o, current as p, mustBeSourceOrSignal as q, resolver as r, start as s, throttle as t, isValue as u, reject as v, isHandled as w, getResult as x, propagateResult as y, CancelError as z };
|
|
705
|
+
//# sourceMappingURL=call-or-wait-COAmx32w.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-or-wait-COAmx32w.mjs","sources":["../src/results.ts","../src/ambient.ts","../src/internals.ts","../src/chains.ts","../src/tracking.ts","../src/streams.ts","../src/jobutils.ts","../src/call-or-wait.ts"],"sourcesContent":["import { Job, Request } from \"./types.ts\";\n\n/**\n * Resolve a {@link Request} with a value.\n *\n * (For a curried version, see {@link resolver}.)\n *\n * @category Requests and Results\n */\nexport function resolve<T>(request: Request<T>, val: T) { request(\"next\", val); }\n\n/**\n * Reject a {@link Request} with a reason.\n *\n * (For a curried version, see {@link rejecter}.)\n *\n * @category Requests and Results\n */\nexport function reject(request: Request<any>, reason: any) { request(\"throw\", undefined, reason); }\n\n/**\n * Create a callback that will resolve the given {@link Request} with a value.\n *\n * @category Requests and Results\n */\nexport function resolver<T>(request: Request<T>): (val: T) => void { return request.bind(null, \"next\"); }\n\n/**\n * Create a callback that will reject the given {@link Request} with a reason.\n *\n * @category Requests and Results\n */\nexport function rejecter(request: Request<any>): (err: any) => void { return request.bind(null, \"throw\", undefined); }\n\n\n/**\n * A function that does nothing and returns void.\n *\n * @category Stream Consumers\n */\nexport function noop() {}\n\n/**\n * A {@link JobResult} that indicates the job was ended via a return() value.\n *\n * @category Types and Interfaces\n */\nexport type ValueResult<T> = {op: \"next\", val: T, err: undefined};\n\n/**\n * A {@link JobResult} that indicates the job was ended via a throw() or other\n * error.\n *\n * @category Types and Interfaces\n */\nexport type ErrorResult = UnhandledError | HandledError;\n\n/**\n * An {@link ErrorResult} that hasn't yet been \"handled\" (by being passed to an\n * error-specific handler, converted to a promise, given to {@link markHandled},\n * etc.)\n *\n * @category Types and Interfaces\n */\nexport type UnhandledError = {op: \"throw\", val: undefined, err: any};\n\n/**\n * An {@link ErrorResult} that has been marked \"handled\" (by being passed to an\n * error-specific handler, converted to a promise, given to {@link markHandled},\n * etc.)\n *\n * @category Types and Interfaces\n */\nexport type HandledError = {op: \"throw\", val: null, err: any};\n\n/**\n * A {@link JobResult} that indicates the job was canceled by its creator (via\n * end() or restart()).\n *\n * @category Types and Interfaces\n */\nexport type CancelResult = {op: \"cancel\", val: undefined, err: undefined};\n\n/**\n * A result passed to a job's cleanup callbacks, or supplied by its\n * .{@link Job.result result}() method.\n *\n * You can inspect a JobResult using functions like {@link isCancel}(),\n * {@link isError}(), and {@link isValue}(). {@link getResult}() can be used to\n * unwrap the value or throw the error.\n *\n * @category Types and Interfaces\n */\nexport type JobResult<T> = ValueResult<T> | ErrorResult | CancelResult ;\n\nfunction mkResult<T>(op: \"next\", val?: T): ValueResult<T>;\nfunction mkResult(op: \"throw\", val: undefined|null, err: any): ErrorResult;\nfunction mkResult(op: \"cancel\"): CancelResult;\nfunction mkResult<T>(op: string, val?: T, err?: any): JobResult<T> {\n return {op, val, err} as JobResult<T>\n}\n\n/**\n * The {@link JobResult} used to indicate a canceled job.\n *\n * @category Requests and Results\n */\nexport const CancelResult = Object.freeze(mkResult(\"cancel\"));\n\n/**\n * Create a {@link ValueResult} from a value\n *\n * @category Requests and Results\n */\nexport function ValueResult<T>(val: T): ValueResult<T> { return mkResult(\"next\", val); }\n\n/**\n * Create an {@link ErrorResult} from an error\n *\n * @category Requests and Results\n */\nexport function ErrorResult(err: any): UnhandledError { return mkResult(\"throw\", undefined, err); }\n\n/**\n * Returns true if the given result is a {@link CancelResult}.\n *\n * @category Requests and Results\n */\nexport function isCancel(res: JobResult<any> | undefined): res is CancelResult {\n return res === CancelResult;\n}\n\n/**\n * Returns true if the given result is a {@link ValueResult}.\n *\n * @category Requests and Results\n */\nexport function isValue<T>(res: JobResult<T> | undefined): res is ValueResult<T> {\n return res ? res.op === \"next\" : false;\n}\n\n/**\n * Returns true if the given result is a {@link ErrorResult}.\n *\n * @category Requests and Results\n */\nexport function isError(res: JobResult<any> | undefined): res is ErrorResult {\n return res ? res.op === \"throw\" : false;\n}\n\n/**\n * Returns true if the given result is an {@link UnhandledError}.\n *\n * @category Requests and Results\n */\nexport function isUnhandled(res: JobResult<any> | undefined): res is UnhandledError {\n return isError(res) && res.val === undefined;\n}\n\n/**\n * Returns true if the given result is a {@link HandledError} (an\n * {@link ErrorResult} that has been touched by {@link markHandled}).\n *\n * @category Requests and Results\n */\nexport function isHandled(res: JobResult<any> | undefined): res is HandledError {\n return isError(res) && res.val === null;\n}\n\n/**\n * Return the error of an {@link ErrorResult} and mark it as handled. The\n * {@link ErrorResult} is mutated in-place to become a {@link HandledError}.\n *\n * @category Requests and Results\n */\nexport function markHandled(res: ErrorResult): any {\n res.val = null;\n return res.err;\n}\n\n/**\n * Get the return value from a {@link JobResult}, throwing an appropriate error\n * if the result isn't a {@link ValueResult}.\n *\n * @param res The job result you want to unwrap. Must not be undefined!\n *\n * @returns The value if the result is a {@link ValueResult}, or a thrown error\n * if it's an {@link ErrorResult}. A {@link CancelError} is thrown if the job\n * was canceled, or the error in the result is thrown.\n *\n * If the result is an error, it is marked as handled.\n *\n * @category Jobs\n */\nexport function getResult<T>(res: JobResult<T>): T {\n if (isValue(res)) return res.val;\n res.op; // throw if not defined\n fulfillPromise(noop, e => { throw e; }, res);\n}\n\n/**\n * Fulfill a Promise from a {@link JobResult}\n *\n * If the result is a {@link CancelResult}, the promise is rejected with a\n * {@link CancelError}. Otherwise it is resolved or rejected according to the\n * state of the result.\n *\n * @param resolve A value-taking function (first arg to `new Promise` callback)\n *\n * @param reject An error-taking function (second arg to `new Promise` callback)\n *\n * @param res The job result you want to settle the promise with. An error will\n * be thrown if it's undefined.\n *\n * If the result is an error, it is marked as handled.\n *\n * @category Requests and Results\n */\nexport function fulfillPromise<T>(resolve: (v: T) => void, reject: (e: any) => void, res: JobResult<T>) {\n if (isError(res)) reject(markHandled(res));\n else if (isCancel(res)) reject(new CancelError(\"Job canceled\"));\n else resolve(res.val);\n}\n\n/**\n * Propagate a {@link JobResult} to another job\n *\n * If the result is a {@link CancelResult}, the job will throw with a\n * {@link CancelError}. Otherwise it is resolved or rejected according to the\n * state of the result.\n *\n * @param job The job to terminate. If it's already ended, nothing changes: the\n * result is not propagated and the error (if any) is not marked as handled.\n *\n * @param res The job result you want to settle the job with. An error will be\n * thrown if it's undefined. If the result is an error, it is marked as\n * handled.\n *\n * @category Requests and Results\n */\nexport function propagateResult<T>(job: Job<T>, res: JobResult<T>) {\n if (!job.result()) fulfillPromise(job.return.bind(job), job.throw.bind(job), res);\n}\n\n/**\n * Error thrown when waiting for a result from a job that is canceled.\n *\n * If you `await`, `yield *`, `.then()`, `.catch()`, {@link getResult}() or\n * otherwise wait on the result of a job that is canceled, this is the type\n * of error you'll get.\n *\n * @category Errors\n */\nexport class CancelError extends Error {}\n","/**\n * Ambient execution context (for job, resource, and dependency tracking)\n *\n * @internal\n * @module\n */\n\nimport type { Job } from \"./types.ts\";\nimport type { Cell } from \"./cells.ts\";\n\ntype Opt<X> = X | undefined | null;\n\nexport type Context = {\n job: Opt<Job<unknown>>\n cell: Opt<Cell>\n}\n\n/** The current context */\nexport var current: Context = makeCtx();\n\n\n/** Set a new current context, returning the old one */\nexport function swapCtx(future: Context): Context {\n const now = current;\n current = future;\n return now\n}\n\nvar freelist = [] as Context[];\n\n/** Get a fresh context object (either by creation or recycling) */\nexport function makeCtx(\n job?: Context[\"job\"],\n cell?: Context[\"cell\"],\n): Context {\n if (freelist && freelist.length) {\n const s = freelist.pop()!;\n s.job = job;\n s.cell = cell;\n return s;\n }\n return {job, cell};\n}\n\n/** Put a no-longer-needed context object on the recycling heap */\nexport function freeCtx(s: Context) {\n s.job = s.cell = null;\n freelist.push(s);\n}\n\n","/**\n * Provide access to certain internals (for testing use only)\n *\n * @module\n */\n\nimport { makeCtx } from \"./ambient.ts\";\nimport { batch } from \"./scheduling.ts\";\nimport { defer } from \"./defer.ts\";\nimport { Job } from \"./types.ts\";\n\nexport const\n /** Jobs' asyncCatch handlers: in a map because few jobs will have them */\n catchers = new WeakMap<Job, (this: Job, err: any) => unknown>(),\n\n /** Default error handler for the `detached` job */\n defaultCatch = (e: any) => { Promise.reject(e); }\n;\n\n/** A null context (no job/observer) for cleanups to run in */\nexport const nullCtx = makeCtx();\n\n/** Jobs' owners (parents) - uses a map so child jobs can't directly access them */\nexport const owners = new WeakMap<Job, Job>();\n\n/** Streams that need resuming */\nexport const pulls = /* @__PURE__ */ batch<{ doPull(): void; }>(pulls => {\n for (const conn of pulls) { pulls.delete(conn); conn.doPull(); }\n}, defer);\n","import { DisposeFn } from \"./types.ts\";\n\n/**\n * A counted, double-ended queue with the ability to undo insertions (even out\n * of order).\n *\n * @category Chains\n */\nexport type Chain<T, U=any> = Node<T, number, U>;\n\n/**\n * Create a new Chain\n *\n * @category Chains\n */\nexport function chain<T, U=DisposeFn>(): Chain<T, U> { return link<number, U>(0, undefined, undefined); }\n\n/**\n * Recycle a chain entirely - only safe if no references to it remain anywhere!\n */\nexport function recycle(c: Chain<any>) {\n while (c.v) unlink(c, c.n);\n c.u = undefined;\n unlink(c, c);\n}\n\n/**\n * Unshift a value onto the front of the chain\n *\n * @category Chains\n */\nexport function unshift<T>(c: Chain<T>, v: T) { ++c.v; link(v, c.n, c); }\n\n/**\n * Unshift a value onto the front of the chain, returning an undo callback. The\n * callback can be invoked to remove the value from the chain at any time, even\n * after other values have been added or removed. There is no effect if the\n * callback is run more than once, or if the value has already been removed.\n *\n * @category Chains\n */\nexport function unshiftCB<T>(c: Chain<T>, v: T) { ++c.v; return unlinker(c, link(v, c.n, c)); }\n\n/**\n * Push a value onto the end of the chain\n *\n * @category Chains\n */\nexport function push<T>(c: Chain<T>, v: T) { ++c.v; link(v, c, c.p); }\n\n/**\n * Push a value onto the end of the chain, returning an undo callback. The\n * callback can be invoked to remove the value from the chain at any time, even\n * after other values have been added or removed. There is no effect if the\n * callback is run more than once, or if the value has already been removed.\n *\n * @category Chains\n */\nexport function pushCB<T>(c: Chain<T>, v: T) { ++c.v; return unlinker(c, link(v, c, c.p)); }\n\n/**\n * Return true if the chain is empty, or is null/undefined\n *\n * @category Chains\n */\nexport function isEmpty(c: Chain<any> | null | undefined) { return !c || c.v === 0; }\n\n/**\n * Return the number of items in the chain, or 0 if it's null/undefined\n *\n * @category Chains\n */\nexport function qlen(c: Chain<any> | null | undefined) { return c ? c.v : 0; }\n\n/**\n * Remove a value from the end of the chain, returning it\n *\n * @category Chains\n */\nexport function pop<T>(c: Chain<T>) { if (qlen(c)) return unlink(c, c.p); }\n\n/**\n * Remove a value from the front of the chain, returning it\n *\n * @category Chains\n */\nexport function shift<T>(c: Chain<T>) { if (qlen(c)) return unlink(c, c.n); }\n\n/** A node in a chain */\nclass Node<T, V=T, U=DisposeFn> {\n /** The next node (or the start node if this is a chain head) */\n n: Node<T> = this as Node<T, any>;\n /** The previous node (or the end node if this is a chain head) */\n p: Node<T> = this as Node<T, any>;\n /** The value held by the node (or the chain length if this is a chain head) */\n v: V = undefined;\n /** The most recently created undo callback for this node */\n u: U = undefined;\n}\n\n/** Recycling list for chain nodes, to reduce constructor/alloc overhead */\nvar free: Node<any,any,any>;\n\n/** Create (or reuse) a node with a given value, inserting it between two nodes in a chain */\nfunction link<T,U=DisposeFn>(v: T, n: Node<T, any, any>, p: Node<T, any, any>): Node<T,T,U> {\n let node: Node<T, T, any> = free;\n if (node) {\n free = node.n;\n node.n = n || node;\n node.p = p || node;\n } else {\n node = new Node<T, T, U>;\n if (n) node.n = n;\n if (p) node.p = p;\n }\n node.v = v;\n node.n.p = node;\n node.p.n = node;\n return node;\n}\n\n/** Unlink a node from a chain and recycle it, returning the value it held */\nfunction unlink<T>(c: Chain<any>, node: Node<T>) {\n --c.v;\n var v = node.v, u = node.u;\n node.n && (node.n.p = node.p);\n node.p && (node.p.n = node.n);\n node.u = node.v = node.p = undefined;\n node.n = free; free = node;\n if (u) u(); // drop refs to node+chain\n return v;\n}\n\n/**\n * Return an undo/remove callback that will run at most once and is a no-op if the\n * node was already removed. If called more than once on the same node while\n * it's in the same chain, it returns the same callback. ()\n */\nfunction unlinker(chain: Chain<any>, node: Node<any>) {\n let u = (node.u ||= () => {\n if (u) {\n // If the node's undo callback is this callback, then it's safe to remove;\n // otherwise, the node has already been removed and/or recycled for use in\n // a different chain (or a different value in this one!)\n if (u === node.u) unlink(chain, node);\n u = chain = node = undefined;\n }\n })\n return u;\n}\n","import { makeCtx, current, freeCtx, swapCtx } from \"./ambient.ts\";\nimport { catchers, defaultCatch, nullCtx, owners } from \"./internals.ts\";\nimport { CleanupFn, Job, Request, Yielding, Suspend, PlainFunction, StartFn, OptionalCleanup, JobIterator, RecalcSource, StartObj } from \"./types.ts\";\nimport { defer } from \"./defer.ts\";\nimport { JobResult, ErrorResult, CancelResult, isCancel, ValueResult, isError, isValue, noop, markHandled, isUnhandled, propagateResult } from \"./results.ts\";\nimport { rejecter, resolver, getResult, fulfillPromise } from \"./results.ts\";\nimport { Chain, chain, isEmpty, pop, push, pushCB, qlen, recycle, unshift } from \"./chains.ts\";\nimport { Stream, Sink, Inlet, Connection } from \"./streams.ts\";\nimport { GeneratorBase, apply } from \"./utils.ts\";\nimport { isFunction } from \"./utils.ts\";\n\n/**\n * Return the currently-active Job, or throw an error if none is active.\n *\n * (You can check if a job is active first using {@link isJobActive}().)\n *\n * @category Jobs\n */\nexport function getJob<T=unknown>() {\n const job = current.job || current.cell?.getJob();\n if (job) return job as Job<T>;\n throw new Error(\"No job is currently active\");\n}\n\n/** RecalcSource factory for jobs (so you can wait on a job result in a signal or rule) */\nfunction recalcJob(job: Job<any>): RecalcSource { return (cb => { current.job.must(job.release(cb)); }); }\n\nfunction runChain<T>(res: JobResult<T>, cbs: Chain<CleanupFn<T>>): undefined {\n while (qlen(cbs)) try { pop(cbs)(res); } catch (e) { detached.asyncThrow(e); }\n cbs && recycle(cbs);\n return undefined;\n}\n\n// The set of jobs whose callbacks need running during an end() sweep\nvar inProcess = new Set<_Job<any>>;\n\nclass _Job<T> implements Job<T> {\n /** @internal */\n static create<T>(parent?: Job, stop?: CleanupFn): Job<T> {\n const job = new _Job<T>;\n if (parent || stop) {\n job.must((parent ||= getJob()).release(stop || job.end));\n owners.set(job, parent);\n }\n return job;\n }\n\n do(cleanup: CleanupFn<T>): this {\n unshift(this._chain(), cleanup);\n return this;\n }\n\n onError(cb: (err: any) => unknown): this {\n return this.do(r => { if (isError(r)) cb(markHandled(r)); });\n }\n\n onValue(cb: (val: T) => unknown): this {\n return this.do(r => { if (isValue(r)) cb(r.val); });\n }\n\n onCancel(cb: () => unknown): this {\n return this.do(r => { if (isCancel(r)) cb(); });\n }\n\n result(): JobResult<T> | undefined {\n // If we're done, we're done; otherwise make signals/rules reading this\n // recalc when we're done (handy for rendering \"loading\" states).\n return this._done || current.cell?.recalcWhen(this, recalcJob) || undefined;\n }\n\n get [Symbol.toStringTag]() { return \"Job\"; }\n\n end = () => {\n const res = (this._done ||= CancelResult), cbs = this._cbs;\n // if we have an unhandled error, fall through to queued mode for later\n // re-throw; otherwise, if there aren't any callbacks we're done here\n if (!cbs && !isUnhandled(res)) return;\n\n const ct = inProcess.size, old = swapCtx(nullCtx);;\n // Put a placeholder on the queue if it's empty\n if (!ct) inProcess.add(null);\n\n // Give priority to the release() chain so we get breadth-first flagging\n // of all child jobs as canceled immediately\n if (cbs && cbs.u) cbs.u = runChain(res, cbs.u);\n\n // Put ourselves on the queue *after* our children, so their cleanups run first\n inProcess.add(this);\n\n // if the queue wasn't empty, there's a loop above us that will run our must/do()s\n if (ct) { swapCtx(old); return; }\n\n // don't need the placeholder any more\n inProcess.delete(null);\n\n // Queue was empty, so it's up to us to run everybody's must/do()s\n for (const item of inProcess) {\n if (item._cbs) item._cbs = runChain(item._done, item._cbs);\n inProcess.delete(item);\n if (isUnhandled(item._done)) item.throw(markHandled(item._done));\n }\n swapCtx(old);\n }\n\n restart() {\n if (!this._done && inProcess.size) {\n // if a tree of jobs is ending right now, we need to start\n // a new stack so that when we return, all our children's\n // callbacks will have finished running first.\n const old = inProcess;\n inProcess = new Set;\n this.end();\n inProcess = old;\n } else {\n this._end(CancelResult);\n }\n this._done = undefined;\n promises.delete(this); // don't reuse any now-cancelled promise!\n return this;\n }\n\n _end(res: JobResult<T>) {\n if (this._done) throw new Error(\"Job already ended\");\n if (this !== detached) this._done = res;\n this.end();\n return this;\n }\n\n throw(err: any) {\n if (this._done) {\n (owners.get(this) || detached).asyncThrow(err);\n return this;\n }\n return this._end(ErrorResult(err));\n }\n\n return(val: T) { return this._end(ValueResult(val)); }\n\n then<T1=T, T2=never>(\n onfulfilled?: (value: T) => T1 | PromiseLike<T1>,\n onrejected?: (reason: any) => T2 | PromiseLike<T2>\n ): Promise<T1 | T2> {\n return nativePromise(this).then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {\n return nativePromise(this).catch(onrejected);\n }\n\n finally(onfinally?: () => void): Promise<T> {\n return nativePromise(this).finally(onfinally);\n }\n\n *[Symbol.iterator](): JobIterator<T> {\n if (this._done) {\n return getResult(this._done);\n } else return yield (req: Request<T>) => {\n // XXX should this be a release(), so if the waiter dies we\n // don't bother? The downside is that it'd have to be mutual and\n // the resume is a no-op anyway in that case.\n this.do(res => fulfillPromise(resolver(req), rejecter(req), res));\n }\n }\n\n start<T>(fn?: StartFn<T> | StartObj<T>): Job<T>;\n start<T, This>(ctx: This, fn: StartFn<T, This>): Job<T>;\n start<T, This>(fnOrCtx: StartFn<T> | StartObj<T>|This, fn?: StartFn<T, This>) {\n if (!fnOrCtx) return makeJob(this);\n let init: StartFn<T, This>, result: StartObj<T> | OptionalCleanup;\n if (isFunction(fn)) {\n init = fn.bind(fnOrCtx as This);\n } else if (isFunction(fnOrCtx)) {\n init = fnOrCtx as StartFn<T, This>;\n } else if (fnOrCtx instanceof _Job) {\n return fnOrCtx;\n } else {\n result = fnOrCtx as StartObj<T>;\n }\n const job = makeJob<T>(this);\n try {\n if (init) result = job.run(init as StartFn<T>, job);\n if (result != null) {\n if (isFunction(result)) {\n job.must(result);\n } else if (result instanceof GeneratorBase) {\n job.run(runGen<T>, result as Yielding<T>, job);\n } else if (result instanceof _Job) {\n if (result !== job) result.do(res => propagateResult(job, res));\n } else if (result instanceof Promise) {\n // Duplicated because this will be monomorphic or low-poly,\n // but next branch will always be megamorphic\n (result as Promise<T>).then(\n v => { job.result() || job.return(v); },\n e => { job.result() || job.throw(e); }\n );\n } else if (isFunction((result as Promise<T>).then)) {\n (result as Promise<T>).then(\n v => { job.result() || job.return(v); },\n e => { job.result() || job.throw(e); }\n );\n } else if (\n isFunction((result as Yielding<T>)[Symbol.iterator]) &&\n typeof result !== \"string\"\n ) {\n job.run(runGen<T>, result as Yielding<T>, job);\n } else {\n throw new TypeError(\"Invalid value/return for start()\");\n }\n }\n return job;\n } catch(e) {\n job.end();\n throw e;\n }\n }\n\n connect<T>(src: Stream<T>, sink: Sink<T>, inlet?: Inlet): Connection {\n return this.start(job => void src(sink, job, inlet));\n }\n\n protected constructor() {};\n\n run<F extends PlainFunction>(fn: F, ...args: Parameters<F>): ReturnType<F> {\n const old = swapCtx(makeCtx(this));\n try { return fn(...args); } finally { freeCtx(swapCtx(old)); }\n }\n\n bind<F extends (...args: any[]) => any>(fn: F): F {\n const job = this;\n return <F> function (this: any) {\n const old = swapCtx(makeCtx(job));\n try { return apply(fn, this, arguments); } finally { freeCtx(swapCtx(old)); }\n }\n }\n\n must(cleanup?: OptionalCleanup) {\n if (isFunction(cleanup)) push(this._chain(), cleanup);\n return this;\n }\n\n release(cleanup: CleanupFn): () => void {\n if (this === detached) return noop;\n let cbs = this._chain();\n if (!this._done || cbs.u) cbs = cbs.u ||= chain();\n return pushCB(cbs, cleanup);\n }\n\n asyncThrow(err: any) {\n try {\n (catchers.get(this) || this.throw).call(this, err);\n } catch (e) {\n // Don't allow a broken handler to stay on the job\n if (this === detached) catchers.set(this, defaultCatch); else catchers.delete(this);\n const catcher = catchers.get(this) || this.throw;\n catcher.call(this, err);\n catcher.call(this, e); // also report the broken handler\n }\n return this;\n }\n\n asyncCatch(handler: ((this: Job, err: any) => unknown) | null): this {\n if (isFunction(handler)) catchers.set(this, handler);\n else if (handler === null) catchers.delete(this);\n return this;\n }\n\n protected _done: JobResult<T> = undefined;\n\n // Chain whose .u stores a second chain for `release()` callbacks\n protected _cbs: Chain<CleanupFn<T>, Chain<CleanupFn<T>>> = undefined;\n protected _chain() {\n if (this === detached) this.end()\n if (this._done && isEmpty(this._cbs)) defer(this.end);\n return this._cbs ||= chain();\n }\n}\n\nconst promises = new WeakMap<Job<any>, Promise<any>>();\n\n/**\n * Obtain a native promise for a job\n *\n * While jobs have the same interface as native promises, there are occasionally\n * reasons to just use one directly. (Like when Uneventful uses this function\n * to implement jobs' promise methods!)\n *\n * @param job The job to get a native promise for.\n *\n * @returns A {@link Promise} that resolves or rejects according to whether the\n * job returns or throws. If the job is canceled, the promise is rejected with\n * a {@link CancelError}.\n *\n * @category Jobs\n */\nexport function nativePromise<T>(job: Job<T>): Promise<T> {\n if (!promises.has(job)) {\n promises.set(job, new Promise((res, rej) => {\n const toPromise = (fulfillPromise<T>).bind(null, res, rej);\n if (job.result()) toPromise(job.result()); else job.do(toPromise);\n }));\n }\n return promises.get(job);\n}\n\n/**\n * Return a new {@link Job}. If *either* a parent parameter or stop function\n * are given, the new job is linked to the parent.\n *\n * @param parent The parent job to which the new job should be attached.\n * Defaults to the currently-active job if none given (assuming a stop\n * parameter is provided).\n *\n * @param stop The function to call to destroy the nested job. Defaults to the\n * {@link Job.end} method of the new job if none is given (assuming a parent\n * parameter is provided).\n *\n * @returns A new job. The job is linked/nested if any arguments are given,\n * or a detached (parentless) job otherwise.\n *\n * @category Jobs\n */\nexport const makeJob: <T>(parent?: Job, stop?: CleanupFn) => Job<T> = _Job.create;\n\n/**\n * A special {@link Job} with no parents, that can be used to create standalone\n * jobs. detached.start() returns a new detached job, detached.run() can be\n * used to run code that expects to create a child job, and detached.bind() can\n * wrap a function to work without a parent job.\n *\n * (Note that such `detached` child jobs *must* exit themselves or be stopped\n * explicitly from outside, or else they may \"run\" forever, never running their\n * cleanup callbacks. Unlike other jobs, they don't end when their parent does\n * because the `detached` job never \"ends\".)\n *\n * The detached job has a few special features and limitations:\n *\n * - It can't be ended, thrown, return()ed, etc. -- you'll get an error\n *\n * - It can't have any cleanup functions added: no do, must, onError, etc., and\n * thus also can't have any native promise, abort signal, etc. used. You can\n * call its release() method, but nothing will actually be registered and the\n * returned callback is a no-op.\n *\n * - Unhandled errors from jobs without parents (and errors from *any* job's\n * cleanup functions) are sent to the detached job for handling. This means\n * whatever you set as the detached job's .{@link Job.asyncCatch asyncCatch}()\n * handler will receive them. (Its default is Promise.reject, causing an\n * unhandled promise rejection.)\n *\n * @category Jobs\n */\nexport const detached = makeJob();\n(detached as any).end = () => { throw new Error(\"Can't do that with the detached job\"); }\ndetached.asyncCatch(defaultCatch);\n\nfunction runGen<R>(g: Yielding<R>, job: Job<R>) {\n let it = g[Symbol.iterator](), running = true, ctx = makeCtx(job), ct = 0;\n let done = ctx.job.release(() => {\n job = undefined;\n ++ct; // disable any outstanding request(s)\n // XXX this should be deferred to cleanup phase, or must() instead of release\n // (release only makes sense here if you can run more than one generator in a job)\n step(\"return\", undefined);\n });\n // Start asynchronously\n defer(() => { running = false; step(\"next\", undefined); });\n\n function step(method: \"next\" | \"throw\" | \"return\", arg: any): void {\n if (!it) return;\n // Don't resume a job while it's running\n if (running) {\n return defer(step.bind(null, method, arg));\n }\n const old = swapCtx(ctx);\n try {\n running = true;\n try {\n for(;;) {\n ++ct;\n const {done, value} = it[method](arg);\n if (done) {\n job && job.return(value);\n job = undefined;\n break;\n } else if (!isFunction(value)) {\n method = \"throw\";\n arg = new TypeError(\"Jobs must yield functions (or yield* Yielding<T>s)\");\n continue;\n } else {\n let called = false, returned = false, count = ct;\n (value as Suspend<any>)((op, val, err) => {\n if (called) return; else called = true;\n method = op; arg = op === \"next\" ? val : err;\n if (returned && count === ct) step(op, arg);\n });\n returned = true;\n if (!called) return;\n }\n }\n } catch(e) {\n it = job = undefined;\n ctx.job.throw(e);\n }\n // Iteration is finished; disconnect from job\n it = undefined;\n done?.();\n done = undefined;\n } finally {\n swapCtx(old);\n running = false;\n }\n }\n}\n","import { pulls } from \"./internals.ts\";\nimport { DisposeFn, Job } from \"./types.ts\";\nimport { getJob } from \"./tracking.ts\";\nimport { current } from \"./ambient.ts\";\n\n/**\n * A backpressure controller: returns true if downstream is ready to accept\n * data.\n *\n * @param cb (optional) - a callback to run when the downstream consumer wishes\n * to resume event production (i.e., when a sink calls\n * {@link Throttle.resume}()). The callback is automatically unregistered when\n * invoked, so the producer must re-register it after each call if it wishes to\n * keep being called.\n *\n * @category Types and Interfaces\n */\nexport type Backpressure = (cb?: () => any) => boolean\n\n\n/**\n * Create a backpressure control function for the given connection\n *\n * @category Stream Producers\n */\nexport function backpressure(inlet: Inlet = defaultInlet): Backpressure {\n const job = getJob();\n return (cb?: Flush) => {\n if (!job.result() && inlet.isOpen()) {\n if (cb) inlet.onReady(cb, job);\n return inlet.isReady();\n }\n return false;\n }\n}\n\n/**\n * Control backpressure for listening streams. This interface is the API\n * internal to the implementation of {@link backpressure}(). Unless you're\n * implementing a backpressurable stream yourself, see the {@link Throttle}\n * interface instead.\n *\n * @category Types and Interfaces\n */\nexport interface Inlet {\n /** Is the main connection open? (i.e. is the creating job not closed yet?) */\n isOpen(): boolean\n\n /** Is the connection ready to receive data? */\n isReady(): boolean\n\n /**\n * Register a callback to produce more data when the inlet is resumed\n * (The callback is unregistered if the supplied job ends.)\n */\n onReady(cb: () => any, job: Job): this;\n}\n\n/**\n * Control backpressure for listening streams\n *\n * Obtain instances via {@link throttle}(), then pass them into the appropriate\n * stream-consuming API. (e.g. {@link connect}).\n *\n * @category Types and Interfaces\n */\nexport interface Throttle extends Inlet {\n /** Set inlet status to \"paused\". */\n pause(): void;\n\n /**\n * Un-pause, and iterate backpressure-able sources' onReady callbacks to\n * resume sending immediately. (i.e., synchronously!)\n */\n resume(): void;\n}\n\n/**\n * A Connection is a job that returns void when the connected stream ends\n * itself. If the stream doesn't end itself (e.g. it's an event listener), the\n * job will never return, and only end with a cancel or throw.\n *\n * @category Types and Interfaces\n */\nexport type Connection = Job<void>;\n\n/**\n * A Source is a function that can be called to arrange for data to be\n * produced and sent to a {@link Sink} function for consumption, until the\n * associated {@link Connection} is closed (either by the source or the sink,\n * e.g. if the sink doesn't want more data or the source has no more to send).\n *\n * If the source is a backpressurable stream, it can use the (optional) supplied\n * inlet (usually a {@link throttle}()) to rate-limit its output.\n *\n * A producer function *must* return the special {@link IsStream} value, so\n * TypeScript can tell what functions are usable as sources. (Otherwise any\n * void function with no arguments would appear to be usable as a source!)\n *\n * @category Types and Interfaces\n */\nexport interface Source<T> {\n /** Subscribe sink to receive values */\n (sink: Sink<T>, conn?: Connection, inlet?: Throttle | Inlet): typeof IsStream;\n}\n\n/**\n * An uneventful stream is either a {@link Source} or a {@link SignalSource}.\n * (Signals actually implement the {@link Source} interface as an overload, but\n * TypeScript gets confused about that sometimes, so we generally declare our\n * stream *inputs* as `Stream<T>` and our stream *outputs* as {@link Source}, so\n * that TypeScript knows what's what.\n *\n * @category Types and Interfaces\n */\nexport type Stream<T> = Source<T> | SignalSource<T>;\n\n/**\n * The call signatures implemented by signals. (They can be used as sources, or\n * called with no arguments to return a value.)\n *\n * This type is needed because TypeScript won't infer the overloads of\n * {@link Signal} correctly otherwise. (Specifically, it won't allow it to be\n * used as a zero-agument function.)\n *\n * @category Types and Interfaces\n*/\nexport type SignalSource<T> = Source<T> & {\n /** A signal object can be called to get its current value */\n (): T\n}\n\n/**\n * A specially-typed string used to verify that a function supports uneventful's\n * streaming protocol. Return it from a function to implement the\n * {@link Source} type.\n *\n * @category Types and Interfaces\n */\nexport const IsStream = \"uneventful/is-stream\" as const;\n\n/**\n * A `Sink` is a function that receives data from a {@link Stream}.\n *\n * @category Types and Interfaces\n */\nexport type Sink<T> = (val: T) => void;\n\n/**\n * A `Transformer` is a function that takes one stream and returns another,\n * possibly one that produces data of a different type. Most operator functions\n * return a transformer, allowing them to be combined via {@link pipe}().\n *\n * @category Types and Interfaces\n */\nexport type Transformer<T, V=T> = (input: Stream<T>) => Source<V>;\n\ntype Flush = () => any\n\n\n/**\n * Subscribe a sink to a stream, returning a nested job. (Shorthand for\n * .{@link Job.connect connect}(...) on the active job.)\n *\n * @param src An event source or signal\n * @param sink A callback that will receive the events\n * @param inlet Optional - a {@link throttle}() to control backpressure\n *\n * @returns A job that can be aborted to end the subscription, and which will\n * end naturally (with a void return or error) if the stream ends itself.\n *\n * @category Stream Consumers\n */\nexport function connect<T>(src: Stream<T>, sink: Sink<T>, inlet?: Throttle | Inlet): Connection {\n return getJob().connect(src, sink, inlet);\n}\n\n/**\n * Create a backpressure controller for a stream. Pass it to one or more\n * sources you're connecting to, and if they support backpressure they'll\n * respond when you call its .pause() and .resume() methods.\n *\n * @param job - Optional: a job that controls readiness. (The throttle will\n * pause indefinitely when the job ends.) Defaults to the currently-active job,\n * but unlike most such defaults, it won't throw if no job is active.\n *\n * @category Stream Consumers\n */\nexport function throttle(job: Job = current.job): Throttle {\n return new _Throttle(job);\n}\n\nclass _Throttle implements Throttle {\n /** @internal */\n protected _callbacks: Map<Flush, DisposeFn> = undefined;\n\n /** @internal */\n constructor(protected _job?: Job) {}\n\n isOpen(): boolean { return !this._job?.result(); }\n\n /** Is the connection ready to receive data? */\n isReady(): boolean { return this.isOpen() && this._isReady; }\n\n _isReady = true;\n _isPulling = false;\n\n onReady(cb: Flush, job: Job) {\n if (!this.isOpen()) return this;\n const _callbacks = (this._callbacks ||= new Map);\n const unlink = job.release(() => _callbacks.delete(cb));\n if (this.isReady() && this && !_callbacks.size) {\n pulls.add(this);\n }\n _callbacks.set(cb, unlink);\n return this;\n }\n\n pause() { this._isReady = false; return this; }\n\n doPull() {\n if (this._isPulling) return;\n const {_callbacks} = this;\n if (!_callbacks?.size) return;\n this._isPulling = true;\n try {\n for(let [cb, unlink] of _callbacks) {\n if (!this.isReady()) break; // we're done\n unlink()\n _callbacks.delete(cb);\n cb() // XXX error handling?\n }\n } finally {\n this._isPulling = false;\n }\n }\n\n resume() {\n if (this.isOpen()) {\n this._isReady = true;\n this.doPull();\n }\n }\n}\n\nconst defaultInlet: Inlet = throttle();\n\n/**\n * Pipe a stream (or anything else) through a series of single-argument\n * functions/operators\n *\n * e.g. the following creates a stream that outputs 4 and then 6:\n *\n * ```ts\n * pipe(fromIterable([1,2,3,4]), skip(1), take(2), map(x => x*2))\n * ```\n *\n * The first argument to pipe() can be any value, but all other arguments must\n * be functions. The value is passed to the first function, and then the result\n * is passed to the next function in turn, until all provided functions have\n * been called with the result of the previous function. The return value is\n * the last result, or the original value if no functions were given.\n *\n * The underlying implementation of pipe() works with any number of arguments,\n * but due to TypeScript limitations we only have typing defined for a max of 9\n * functions (10 arguments total). If you need more than 9 functions, you can\n * stack some of them with {@link compose}(), e.g.:\n *\n * ```typescript\n * pipe(\n * aStream,\n * compose(op1, op2, ...),\n * compose(op10, op11, ...),\n * compose(op19, ...),\n * ...\n * )\n * ```\n *\n * @category Stream Operators\n */\nexport function pipe<A,B,C,D,E,F,G,H,I,J>(input: A, ...fns: Chain9<A,J,B,C,D,E,F,G,H,I>): J\nexport function pipe<A,B,C,D,E,F,G,H,I> (input: A, ...fns: Chain8<A,I,B,C,D,E,F,G,H>): I\nexport function pipe<A,B,C,D,E,F,G,H> (input: A, ...fns: Chain7<A,H,B,C,D,E,F,G>): H\nexport function pipe<A,B,C,D,E,F,G> (input: A, ...fns: Chain6<A,G,B,C,D,E,F>): G\nexport function pipe<A,B,C,D,E,F> (input: A, ...fns: Chain5<A,F,B,C,D,E>): F\nexport function pipe<A,B,C,D,E> (input: A, ...fns: Chain4<A,E,B,C,D>): E\nexport function pipe<A,B,C,D> (input: A, ...fns: Chain3<A,D,B,C>): D\nexport function pipe<A,B,C> (input: A, ...fns: Chain2<A,C,B>): C\nexport function pipe<A,B> (input: A, ...fns: Chain1<A,B>): B\nexport function pipe<A> (input: A): A\nexport function pipe(input: any, ...fns: Array<(v: any) => any>): any;\nexport function pipe<A,X>(): X {\n var v = arguments[0];\n for (var i=1; i<arguments.length; i++) v = arguments[i](v);\n return v;\n}\n\n/**\n * Compose a series of single-argument functions/operators in application order.\n * (This is basically a deferred version of {@link pipe}().) For example:\n *\n * ```ts\n * const func = compose(skip(1), take(2), map(x => x*2));\n * const stream_4_6 = func(fromIterable([1,2,3,4])); // stream that outputs 4, 6\n * ```\n *\n * As with `pipe()`, the declared typings only support composing up to 9\n * functions at once; if you need more you'll need to nest calls to `compose()`\n * (i.e. passing the result of a `compose()` as an argument to another\n * `compose()` call.)\n *\n * @returns A function taking the same type as the first input function,\n * returning the same type as the last input function.\n *\n * @category Stream Operators\n */\nexport function compose<A,B,C,D,E,F,G,H,I,J>(...fns: Chain9<A,J,B,C,D,E,F,G,H,I>): (a: A) => J\nexport function compose<A,B,C,D,E,F,G,H,I> (...fns: Chain8<A,I,B,C,D,E,F,G,H>): (a: A) => I\nexport function compose<A,B,C,D,E,F,G,H> (...fns: Chain7<A,H,B,C,D,E,F,G>): (a: A) => H\nexport function compose<A,B,C,D,E,F,G> (...fns: Chain6<A,G,B,C,D,E,F>): (a: A) => G\nexport function compose<A,B,C,D,E,F> (...fns: Chain5<A,F,B,C,D,E>): (a: A) => F\nexport function compose<A,B,C,D,E> (...fns: Chain4<A,E,B,C,D>): (a: A) => E\nexport function compose<A,B,C,D> (...fns: Chain3<A,D,B,C>): (a: A) => D\nexport function compose<A,B,C> (...fns: Chain2<A,C,B>): (a: A) => C\nexport function compose<A,B> (...fns: Chain1<A,B>): (a: A) => B\nexport function compose<A> (): (a: A) => A\nexport function compose(...fns: ((v:any)=>any)[]) {\n return (val:any) => (pipe as any)(val, ...fns);\n}\n\ntype Chain1<A,R> = [(v: A) => R];\ntype Chain2<A,R,B> = [...Chain1<A,B>, ...Chain1<B,R>];\ntype Chain3<A,R,B,C> = [...Chain1<A,B>, ...Chain2<B,R,C>];\ntype Chain4<A,R,B,C,D> = [...Chain1<A,B>, ...Chain3<B,R,C,D>];\ntype Chain5<A,R,B,C,D,E> = [...Chain1<A,B>, ...Chain4<B,R,C,D,E>];\ntype Chain6<A,R,B,C,D,E,F> = [...Chain1<A,B>, ...Chain5<B,R,C,D,E,F>];\ntype Chain7<A,R,B,C,D,E,F,G> = [...Chain1<A,B>, ...Chain6<B,R,C,D,E,F,G>];\ntype Chain8<A,R,B,C,D,E,F,G,H> = [...Chain1<A,B>, ...Chain7<B,R,C,D,E,F,G,H>];\ntype Chain9<A,R,B,C,D,E,F,G,H,I> = [...Chain1<A,B>, ...Chain8<B,R,C,D,E,F,G,H,I>];\n\n/**\n * Pass subscriber into a stream (or any arguments into any other function).\n *\n * This utility is mainly here for uses like:\n *\n * - `pipe(src, into(sink))`,\n * - `pipe(src, into(sink, conn))`,\n * - `pipe(src, into(restarting(sink)))`, etc.\n *\n * but can also be used for argument currying generally.\n *\n * @param args The arguments to pass to the stream (or other function)\n *\n * @returns a function that takes another function and calls it with the given args.\n *\n * @category Stream Consumers\n */\nexport function into<In extends any[], Out>(...args: In): (src: (...args: In) => Out) => Out {\n return src => src(...args);\n}\n","import { current, freeCtx, makeCtx, swapCtx } from \"./ambient.ts\";\nimport { getJob, makeJob } from \"./tracking.ts\";\nimport { AnyFunction, CleanupFn, Job, OptionalCleanup, StartFn, StartObj, Yielding } from \"./types.ts\";\nimport { apply } from \"./utils.ts\";\n\n/**\n * Add a cleanup function to the active job. Non-function values are ignored.\n * Equivalent to calling .{@link Job.must must}() on the current job. (See\n * {@link Job.must}() for more details.)\n *\n * @category Jobs\n */\nexport function must(cleanup?: OptionalCleanup): void {\n getJob().must(cleanup);\n}\n\n/**\n * Start a nested job within the currently-active job. (Shorthand for\n * calling .{@link Job.start start}(...) on the active job.)\n *\n * This function can be called with zero, one, or two arguments:\n *\n * - When called with zero arguments, the new job is returned without any other\n * initialization.\n *\n * - When called with one argument that's a function (either a {@link SyncStart}\n * or {@link AsyncStart}): the function is run inside the new job and receives\n * it as an argument. It can return a {@link Yielding} iterator (such as a\n * generator or job), a promise, or void. A returned iterator or promise will\n * be treated as if the method was called with that to begin with; a returned\n * job will be awaited and its result transferred to the new job\n * asynchronously. A returned function will be added to the job via `must()`.\n *\n * - When called with one argument that's a {@link Yielding} iterator (such as a\n * generator or an existing job): it's attached to the new job and executed\n * asynchronously. (Starting in the next available microtask.)\n *\n * - When called with one argument that's a Promise, it's converted to a job\n * that will end when the promise settles. The resulting job is returned.\n *\n * - When called with two arguments -- a \"this\" object and a function -- it\n * works the same as one argument that's a function, except the function is\n * bound to the supplied \"this\" before being called.\n *\n * This last signature is needed because you can't make generator arrows in JS\n * yet: if you want to start() a generator function bound to the current\n * `this`, you'll want to use `.start(this, function*() { ...whatever })`.\n *\n * (Note, however, that TypeScript and/or VSCode may require that you give\n * such a function an explicit `this` parameter (e.g. `.start(this, function\n * *(this) {...}));`) in order to correctly infer types inside a generator\n * function.)\n *\n * In any of the above cases, if a supplied function throws an error while\n * starting, the new job will be ended, and the error synchronously re-thrown.\n *\n * @returns the created {@link Job}\n *\n * @category Jobs\n */\nexport function start<T>(init?: StartFn<T> | StartObj<T>): Job<T>;\n\n/**\n * The two-argument variant of start() allows you to pass a \"this\" object that\n * will be bound to the initialization function. (It's mostly useful for\n * generator functions, since generator arrows aren't a thing yet.)\n */\nexport function start<T, This>(thisArg: This, fn: StartFn<T, This>): Job<T>;\nexport function start<T, This>(init: StartFn<T>|StartObj<T>|This, fn?: StartFn<T, This>) {\n return getJob().start(init as This, fn);\n}\n\n/**\n * Is there a currently active job? (i.e., can you safely use {@link must}(),\n * or {@link getJob}() right now?)\n *\n * @category Jobs\n */\nexport function isJobActive() { return !!current.job; }\n\n\nconst timers = new WeakMap<Job,\n ReturnType<typeof setTimeout> | // current timeout\n undefined | // no timeout set since job was last restarted (if ever)\n null // current timeout is 0, aka explicit no-timeout\n>();\n\n/**\n * Set the cancellation timeout for a job.\n *\n * When the timeout is reached, the job is canceled (throwing\n * {@link CancelError} to any waiting promises or jobs), unless a new timeout\n * is set before then. You may set a new timeout value for a job as many times\n * as desired. A timeout value of zero disables the timeout. Timers are\n * disposed of if the job is canceled or restarted.\n *\n * @param ms Optional: Number of milliseconds after which the job will be\n * canceled. Defaults to zero if not given.\n *\n * @param job Optional: the job to apply the timeout to. If none is given, the\n * active job is used.\n *\n * @returns the job to which the timeout was added or removed.\n *\n * @category Scheduling\n */\nexport function timeout<T>(ms: number, job?: Job<T>): Job<T>;\nexport function timeout(ms = 0, job: Job = getJob()) {\n let timer = timers.get(job);\n if (timer) {\n clearTimeout(timer);\n } else if (timer === undefined && !job.result()) {\n // no timeout has been set since job was last restarted,\n // so we need to arrange to clear it\n job.must(timeout.bind(null, 0, job));\n }\n if (job.result()) {\n // allow restarted timer to set a new must()\n timers.delete(job);\n } else if (ms) {\n timers.set(job, setTimeout(() => { timers.set(job, null); job.end(); }, ms));\n } else {\n timers.set(job, null); // Zero = cancel timeout, but don't duplicate must() if called again\n }\n return job;\n}\n\nconst abortSignals = new WeakMap<Job, AbortSignal>();\n\n/**\n * Get an AbortSignal that aborts when the job ends or is restarted.\n *\n * @param job Optional: the job to get an AbortSignal for. If none is given,\n * the active job is used.\n *\n * @returns the AbortSignal\n *\n * @category Jobs\n */\nexport function abortSignal(job: Job = getJob()) {\n let signal = abortSignals.get(job);\n if (!signal) {\n const ctrl = new AbortController;\n signal = ctrl.signal;\n job.must(() => { abortSignals.set(job, null); ctrl.abort(); });\n abortSignals.set(job, signal);\n if (job.result()) ctrl.abort();\n }\n return signal;\n}\n\n/**\n * Wrap a function in a {@link Job} that restarts each time the resulting\n * function is called, thereby canceling any nested jobs and cleaning up any\n * resources used by previous calls. (This can be useful for such things as\n * canceling an in-progress search when the user types more text in a field.)\n *\n * The restarting job will be ended when the job that invoked `restarting()`\n * is finished, canceled, or restarted. Calling the wrapped function after its\n * job has ended will result in an error. You can wrap any function any number\n * of times: each call to `restarting()` creates a new, distinct \"restarting\n * job\" and function wrapper to go with it.\n *\n * @param task (Optional) The function to be wrapped. This can be any function:\n * the returned wrapper function will match its call signature exactly, including\n * overloads. (So for example you could wrap the {@link start} API via\n * `restarting(start)`, to create a function you can pass job-start functions to.\n * When called, the function would cancel any outstanding job from a previous\n * call, and start the new one in its place.)\n *\n * @returns A function of identical type to the input function. If no input\n * function was given, the returned function will just take one argument (a\n * zero-argument function optionally returning a {@link CleanupFn}).\n *\n * @category Jobs\n */\nexport function restarting<F extends AnyFunction>(task: F): F\nexport function restarting(): (task: () => OptionalCleanup) => void\nexport function restarting<F extends AnyFunction>(task?: F): F {\n const outer = getJob(), inner = makeJob<never>(outer), {end} = inner;\n task ||= <F>((f: () => OptionalCleanup) => { inner.must(f()); });\n inner.asyncCatch(e => outer.asyncThrow(e));\n return <F>function(this: ThisParameterType<F>) {\n inner.restart().must(outer.release(end));\n const old = swapCtx(makeCtx(inner));\n try { return apply(task, this, arguments); }\n catch(e) { inner.restart(); throw e; }\n finally { freeCtx(swapCtx(old)); }\n };\n}\n\n/**\n * Wrap an argument-taking function so it will run in (and returns) a new Job\n * when called.\n *\n * This lets you avoid the common pattern of needing to write your functions or\n * methods like this:\n *\n * ```ts\n * function outer(arg1, arg2) {\n * return start(function*() {\n * // ...\n * })\n * }\n * ```\n * and instead write them like this:\n * ```ts\n * const outer = task(function *(arg1, arg2) {\n * // ...\n * });\n * ```\n * or this:\n * ```ts\n * class Something {\n * @task // auto-detects TC39 or legacy decorators\n * *someMethod(arg1): Yielding<SomeResultType> {\n * // ...\n * }\n * }\n * ```\n *\n * Important: if the wrapped function or method has overloads, the resulting\n * function type will be based on the **last** overload, because TypeScript (at\n * least as of 5.x) is still not very good at dealing with higher order\n * generics, especially if overloads are involved.\n *\n * Also note that TypeScript doesn't allow decorators to change the calling\n * signature or return type of a method, so even though the above method will\n * return a {@link Job}, TypeScript will only see it as a {@link Yielding}.\n *\n * This is fine if all you're going to do is `yield *` it to wait for the\n * result, but if you need to use any job-specific methods on it, you'll have to\n * pass it through {@link start} to have TypeScript treat it as an actual job.\n * (Luckily, start() has a fast path to return the original job if it's passed a\n * job, so you won't actually create a new job by doing this.)\n *\n * @param fn The function to wrap. A function returning a generator or\n * promise-like object (i.e., a {@link StartObj}).\n *\n * @returns A wrapped version of the function that passes through its arguments\n * to the original function, while running it in a new job. (The wrapper also\n * returns the job.)\n *\n * @category Jobs\n */\nexport function task<T, A extends any[], C>(fn: (this: C, ...args: A) => StartObj<T>): (this: C, ...args: A) => Job<T>;\n\n/** @hidden TC39 Decorator protocol */\nexport function task<T, A extends any[], C>(\n fn: (this: C, ...args: A) => StartObj<T>, ctx: {kind: \"method\"}\n): (this: C, ...args: A) => Job<T>;\n\n/** @hidden Legacy Decorator protocol */\nexport function task<T, A extends any[], C, D extends {value?: (this:C, ...args: A) => StartObj<T>}>(\n clsOrProto: any, name: string|symbol, desc: D\n): D\n\nexport function task<T, A extends any[], C, D extends {value?: (this:C, ...args: A) => StartObj<T>}>(\n fn: (this: C, ...args: A) => StartObj<T>, _ctx?: any, desc?: D\n): D | ((this: C, ...args: A) => Job<T>) {\n if (desc) return {...desc, value: task(desc.value)};\n return function (this: C, ...args: A) {\n return start<T>(fn.bind(this, ...args as any[]));\n }\n}\n","import { Job, Yielding } from \"./types.ts\";\nimport { start } from \"./jobutils.ts\";\nimport { isValue, isError, markHandled } from \"./results.ts\";\nimport { isFunction } from \"./utils.ts\";\nimport { connect, Source } from \"./streams.ts\";\n\nexport function callOrWait<T>(\n source: any, method: string, handler: (job: Job<T>, val: T) => void, noArgs: (f?: any) => Yielding<T> | void\n) {\n if (source && isFunction(source[method])) return source[method]() as Yielding<T>;\n if (isFunction(source)) return (\n source.length === 0 ? noArgs(source) : false\n ) || start<T>(job => {\n connect(source as Source<T>, v => handler(job, v)).do(r => {\n if (isValue(r)) job.throw(new Error(\"Stream ended\"));\n else if (isError(r)) job.throw(markHandled(r));\n });\n });\n mustBeSourceOrSignal();\n}\n\nexport function mustBeSourceOrSignal() { throw new TypeError(\"not a source or signal\"); }\n"],"names":[],"mappings":";;AAAO,SAAS,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE;AACtC,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC;AACM,SAAS,MAAM,CAAC,OAAO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AAG,KAAK,KAAK,KAAK,CAAC,CAAC,GAAG,KAAK;AAC5E,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;AACxD,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC;AACtB,UAAU,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAC/C,aAAa,IAAI,OAAO,CAAC,CAAC,CAAC;AAC3B,UAAU,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,OAAO,CAAC,CAAC;AACT,KAAK,CAAC,CAAC;AACP,EAAE,oBAAoB,EAAE,CAAC;AACzB,CAAC;AACM,SAAS,oBAAoB,GAAG;AACvC,EAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAChD;;;;"}
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { J as Job, C as CleanupFn, Y as Yielding, S as Source, D as DisposeFn, a as Stream, B as Backpressure, T as Transformer, b as Sink, O as OptionalCleanup, c as StartFn, d as StartObj, A as AnyFunction } from './types-N2ua11te.js';
|
|
2
2
|
export { e as AsyncStart, z as CancelError, m as CancelResult, K as Connection, E as ErrorResult, H as HandledError, I as Inlet, M as IsStream, g as JobIterator, o as JobResult, N as Nothing, P as PlainFunction, i as RecalcSource, R as Request, L as SignalSource, h as Suspend, f as SyncStart, G as Throttle, U as UnhandledError, V as ValueResult, F as backpressure, Z as compose, Q as connect, x as fulfillPromise, w as getResult, _ as into, p as isCancel, s as isError, u as isHandled, t as isUnhandled, q as isValue, v as markHandled, n as noop, X as pipe, y as propagateResult, j as reject, l as rejecter, r as resolve, k as resolver, W as throttle } from './types-N2ua11te.js';
|
|
3
|
-
export { a as Each, E as EachResult, N as NextMethod, U as UntilMethod, e as each, f as forEach, n as next, r as recalcWhen } from './sinks-
|
|
3
|
+
export { a as Each, E as EachResult, N as NextMethod, U as UntilMethod, e as each, f as forEach, i as isObserved, n as next, r as recalcWhen } from './sinks-5TuxCRtX.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Invoke a no-argument function as a microtask, using queueMicrotask or Promise.resolve().then()
|
package/dist/mod.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { d as defer, i as isFunction } from './utils-P0JEpWXG.mjs';
|
|
2
|
+
import { r as resolver, a as rejecter, b as resolve, I as IsStream, c as backpressure, m as must, s as start, g as getJob, n as noop, t as throttle, d as detached, i as isCancel, e as isUnhandled, f as markHandled, h as isError, j as connect, k as fulfillPromise, l as callOrWait, o as restarting, p as current, q as mustBeSourceOrSignal, u as isValue } from './call-or-wait-COAmx32w.mjs';
|
|
3
|
+
export { z as CancelError, C as CancelResult, E as ErrorResult, V as ValueResult, K as abortSignal, F as compose, x as getResult, G as into, w as isHandled, H as isJobActive, B as makeJob, A as nativePromise, D as pipe, y as propagateResult, v as reject, L as task, J as timeout } from './call-or-wait-COAmx32w.mjs';
|
|
4
4
|
|
|
5
5
|
function* to(p) {
|
|
6
6
|
return yield (res) => Promise.resolve(p).then(resolver(res), rejecter(res));
|
|
@@ -276,6 +276,9 @@ function forEach(src, sink, inlet) {
|
|
|
276
276
|
function recalcWhen(fnOrKey, fn) {
|
|
277
277
|
current.cell?.recalcWhen(fnOrKey, fn);
|
|
278
278
|
}
|
|
279
|
+
function isObserved() {
|
|
280
|
+
return current.cell?.isObserved();
|
|
281
|
+
}
|
|
279
282
|
|
|
280
283
|
function concat(sources) {
|
|
281
284
|
return concatAll(fromIterable(sources));
|
|
@@ -435,5 +438,5 @@ function takeWhile(condition) {
|
|
|
435
438
|
};
|
|
436
439
|
}
|
|
437
440
|
|
|
438
|
-
export { IsStream, backpressure, concat, concatAll, concatMap, connect, defer, detached, each, emitter, empty, filter, forEach, fromAsyncIterable, fromDomEvent, fromIterable, fromPromise, fromSubscribe, fromValue, fulfillPromise, getJob, interval, isCancel, isError, isUnhandled, isValue, lazy, map, markHandled, merge, mergeAll, mergeMap, mockSource, must, never, next, noop, recalcWhen, rejecter, resolve, resolver, restarting, share, skip, skipUntil, skipWhile, slack, sleep, start, switchAll, switchMap, take, takeUntil, takeWhile, throttle, to };
|
|
441
|
+
export { IsStream, backpressure, concat, concatAll, concatMap, connect, defer, detached, each, emitter, empty, filter, forEach, fromAsyncIterable, fromDomEvent, fromIterable, fromPromise, fromSubscribe, fromValue, fulfillPromise, getJob, interval, isCancel, isError, isObserved, isUnhandled, isValue, lazy, map, markHandled, merge, mergeAll, mergeMap, mockSource, must, never, next, noop, recalcWhen, rejecter, resolve, resolver, restarting, share, skip, skipUntil, skipWhile, slack, sleep, start, switchAll, switchMap, take, takeUntil, takeWhile, throttle, to };
|
|
439
442
|
//# sourceMappingURL=mod.mjs.map
|