@thi.ng/rstream 6.0.21 → 7.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +49 -620
  2. package/README.md +70 -52
  3. package/api.d.ts +2 -4
  4. package/api.js +0 -3
  5. package/{subs/asidechain.d.ts → asidechain.d.ts} +2 -2
  6. package/{subs/asidechain.js → asidechain.js} +1 -1
  7. package/{from/atom.d.ts → atom.d.ts} +2 -3
  8. package/{from/atom.js → atom.js} +8 -4
  9. package/{subs/bisect.d.ts → bisect.d.ts} +2 -2
  10. package/{subs/bisect.js → bisect.js} +3 -3
  11. package/{utils/checks.d.ts → checks.d.ts} +2 -1
  12. package/{utils/checks.js → checks.js} +3 -1
  13. package/{subs/debounce.d.ts → debounce.d.ts} +2 -2
  14. package/{subs/debounce.js → debounce.js} +7 -4
  15. package/defworker.d.ts +3 -0
  16. package/defworker.js +4 -0
  17. package/{from/event.d.ts → event.d.ts} +2 -2
  18. package/{from/event.js → event.js} +4 -4
  19. package/forkjoin.d.ts +2 -2
  20. package/forkjoin.js +8 -3
  21. package/idgen.d.ts +10 -0
  22. package/idgen.js +9 -0
  23. package/index.d.ts +35 -33
  24. package/index.js +35 -33
  25. package/internal/remove.d.ts +4 -0
  26. package/internal/remove.js +7 -0
  27. package/{from/interval.d.ts → interval.d.ts} +2 -3
  28. package/{from/interval.js → interval.js} +8 -5
  29. package/{from/iterable.d.ts → iterable.d.ts} +3 -4
  30. package/{from/iterable.js → iterable.js} +7 -7
  31. package/logger.d.ts +4 -0
  32. package/logger.js +3 -0
  33. package/{stream-merge.d.ts → merge.d.ts} +3 -3
  34. package/{stream-merge.js → merge.js} +7 -10
  35. package/metastream.d.ts +3 -3
  36. package/metastream.js +5 -5
  37. package/{from/object.d.ts → object.d.ts} +2 -2
  38. package/{from/object.js → object.js} +13 -6
  39. package/package.json +140 -31
  40. package/{subs/post-worker.d.ts → post-worker.d.ts} +1 -1
  41. package/{subs/post-worker.js → post-worker.js} +5 -4
  42. package/{from/promise.d.ts → promise.d.ts} +2 -3
  43. package/{from/promise.js → promise.js} +5 -5
  44. package/{from/promises.d.ts → promises.d.ts} +1 -1
  45. package/{from/promises.js → promises.js} +4 -4
  46. package/pubsub.d.ts +3 -3
  47. package/pubsub.js +12 -8
  48. package/{from/raf.d.ts → raf.d.ts} +2 -3
  49. package/{from/raf.js → raf.js} +6 -6
  50. package/{subs/resolve.d.ts → resolve.d.ts} +1 -1
  51. package/{subs/resolve.js → resolve.js} +5 -4
  52. package/{subs/sidechain-partition.d.ts → sidechain-partition.d.ts} +4 -4
  53. package/{subs/sidechain-partition.js → sidechain-partition.js} +7 -7
  54. package/{subs/sidechain-toggle.d.ts → sidechain-toggle.d.ts} +3 -3
  55. package/{subs/sidechain-toggle.js → sidechain-toggle.js} +4 -4
  56. package/stream.d.ts +2 -2
  57. package/stream.js +6 -5
  58. package/subscription.d.ts +4 -3
  59. package/subscription.js +26 -12
  60. package/{stream-sync.d.ts → sync.d.ts} +4 -4
  61. package/{stream-sync.js → sync.js} +15 -12
  62. package/{subs/timeout.d.ts → timeout.d.ts} +2 -2
  63. package/{subs/timeout.js → timeout.js} +4 -4
  64. package/{subs/trace.d.ts → trace.d.ts} +1 -1
  65. package/{subs/trace.js → trace.js} +0 -0
  66. package/{subs/transduce.d.ts → transduce.d.ts} +1 -1
  67. package/{subs/transduce.js → transduce.js} +1 -1
  68. package/trigger.d.ts +2 -2
  69. package/trigger.js +3 -3
  70. package/{subs/tunnel.d.ts → tunnel.d.ts} +1 -1
  71. package/{subs/tunnel.js → tunnel.js} +7 -6
  72. package/tween.d.ts +5 -5
  73. package/tween.js +8 -6
  74. package/{from/view.d.ts → view.d.ts} +3 -3
  75. package/{from/view.js → view.js} +4 -4
  76. package/{from/worker.d.ts → worker.d.ts} +2 -3
  77. package/{from/worker.js → worker.js} +7 -7
  78. package/lib/index.js +0 -1148
  79. package/lib/index.js.map +0 -1
  80. package/lib/index.umd.js +0 -1
  81. package/lib/index.umd.js.map +0 -1
  82. package/utils/idgen.d.ts +0 -4
  83. package/utils/idgen.js +0 -3
  84. package/utils/worker.d.ts +0 -3
  85. package/utils/worker.js +0 -4
package/index.js CHANGED
@@ -1,33 +1,35 @@
1
- export * from "./api";
2
- export * from "./forkjoin";
3
- export * from "./metastream";
4
- export * from "./pubsub";
5
- export * from "./stream";
6
- export * from "./stream-merge";
7
- export * from "./stream-sync";
8
- export * from "./subscription";
9
- export * from "./trigger";
10
- export * from "./tween";
11
- export * from "./from/atom";
12
- export * from "./from/event";
13
- export * from "./from/interval";
14
- export * from "./from/iterable";
15
- export * from "./from/object";
16
- export * from "./from/promise";
17
- export * from "./from/promises";
18
- export * from "./from/raf";
19
- export * from "./from/view";
20
- export * from "./from/worker";
21
- export * from "./subs/asidechain";
22
- export * from "./subs/bisect";
23
- export * from "./subs/debounce";
24
- export * from "./subs/post-worker";
25
- export * from "./subs/resolve";
26
- export * from "./subs/sidechain-partition";
27
- export * from "./subs/sidechain-toggle";
28
- export * from "./subs/timeout";
29
- export * from "./subs/trace";
30
- export * from "./subs/transduce";
31
- export * from "./subs/tunnel";
32
- export * from "./utils/idgen";
33
- export * from "./utils/worker";
1
+ export * from "./api.js";
2
+ export * from "./asidechain.js";
3
+ export * from "./atom.js";
4
+ export * from "./bisect.js";
5
+ export * from "./checks.js";
6
+ export * from "./debounce.js";
7
+ export * from "./defworker.js";
8
+ export * from "./event.js";
9
+ export * from "./forkjoin.js";
10
+ export * from "./idgen.js";
11
+ export * from "./interval.js";
12
+ export * from "./iterable.js";
13
+ export * from "./logger.js";
14
+ export * from "./merge.js";
15
+ export * from "./metastream.js";
16
+ export * from "./object.js";
17
+ export * from "./post-worker.js";
18
+ export * from "./promise.js";
19
+ export * from "./promises.js";
20
+ export * from "./pubsub.js";
21
+ export * from "./raf.js";
22
+ export * from "./resolve.js";
23
+ export * from "./sidechain-partition.js";
24
+ export * from "./sidechain-toggle.js";
25
+ export * from "./stream.js";
26
+ export * from "./subscription.js";
27
+ export * from "./sync.js";
28
+ export * from "./timeout.js";
29
+ export * from "./trace.js";
30
+ export * from "./transduce.js";
31
+ export * from "./trigger.js";
32
+ export * from "./tunnel.js";
33
+ export * from "./tween.js";
34
+ export * from "./view.js";
35
+ export * from "./worker.js";
@@ -0,0 +1,4 @@
1
+ export declare const __removeAllIDs: (impl: {
2
+ removeID(id: string): boolean;
3
+ }, ids: Iterable<string>) => boolean;
4
+ //# sourceMappingURL=remove.d.ts.map
@@ -0,0 +1,7 @@
1
+ export const __removeAllIDs = (impl, ids) => {
2
+ let ok = true;
3
+ for (let id of ids) {
4
+ ok = impl.removeID(id) && ok;
5
+ }
6
+ return ok;
7
+ };
@@ -1,5 +1,4 @@
1
- import { CommonOpts } from "../api";
2
- import { Stream } from "../stream";
1
+ import { CommonOpts } from "./api.js";
3
2
  export interface FromIntervalOpts extends CommonOpts {
4
3
  /**
5
4
  * If given, only the stated number of values will be emitted (in
@@ -21,5 +20,5 @@ export interface FromIntervalOpts extends CommonOpts {
21
20
  * @param delay -
22
21
  * @param opts -
23
22
  */
24
- export declare const fromInterval: (delay: number, opts?: Partial<FromIntervalOpts> | undefined) => Stream<number>;
23
+ export declare const fromInterval: (delay: number, opts?: Partial<FromIntervalOpts> | undefined) => import("./stream.js").Stream<number>;
25
24
  //# sourceMappingURL=interval.d.ts.map
@@ -1,6 +1,6 @@
1
- import { CloseMode } from "../api";
2
- import { Stream } from "../stream";
3
- import { optsWithID } from "../utils/idgen";
1
+ import { CloseMode } from "./api.js";
2
+ import { __optsWithID } from "./idgen.js";
3
+ import { stream } from "./stream.js";
4
4
  /**
5
5
  * Returns a {@link Stream} of monotonically increasing counter values,
6
6
  * emitted at given `delay` interval and up to the optionally defined
@@ -13,8 +13,11 @@ import { optsWithID } from "../utils/idgen";
13
13
  * @param opts -
14
14
  */
15
15
  export const fromInterval = (delay, opts) => {
16
- opts = optsWithID("interval", Object.assign({ num: Infinity }, opts));
17
- return new Stream((stream) => {
16
+ opts = __optsWithID("interval", {
17
+ num: Infinity,
18
+ ...opts,
19
+ });
20
+ return stream((stream) => {
18
21
  let i = 0;
19
22
  let count = opts.num;
20
23
  stream.next(i++);
@@ -1,5 +1,4 @@
1
- import { CommonOpts } from "../api";
2
- import { Stream } from "../stream";
1
+ import { CommonOpts } from "./api.js";
3
2
  export interface FromIterableOpts extends CommonOpts {
4
3
  /**
5
4
  * Time delay (in ms) between emitted values. The default value of
@@ -24,7 +23,7 @@ export interface FromIterableOpts extends CommonOpts {
24
23
  * @param src -
25
24
  * @param opts -
26
25
  */
27
- export declare const fromIterable: <T>(src: Iterable<T>, opts?: Partial<FromIterableOpts>) => Stream<T>;
26
+ export declare const fromIterable: <T>(src: Iterable<T>, opts?: Partial<FromIterableOpts>) => import("./stream.js").Stream<T>;
28
27
  /**
29
28
  * Creates a new {@link Stream} of given iterable which synchronously calls
30
29
  * `.next()` for each item of the iterable when the first (and in this
@@ -35,5 +34,5 @@ export declare const fromIterable: <T>(src: Iterable<T>, opts?: Partial<FromIter
35
34
  * @param src -
36
35
  * @param opts -
37
36
  */
38
- export declare const fromIterableSync: <T>(src: Iterable<T>, opts?: Partial<CommonOpts> | undefined) => Stream<T>;
37
+ export declare const fromIterableSync: <T>(src: Iterable<T>, opts?: Partial<CommonOpts> | undefined) => import("./stream.js").Stream<T>;
39
38
  //# sourceMappingURL=iterable.d.ts.map
@@ -1,6 +1,6 @@
1
- import { CloseMode } from "../api";
2
- import { Stream } from "../stream";
3
- import { optsWithID } from "../utils/idgen";
1
+ import { CloseMode } from "./api.js";
2
+ import { __optsWithID } from "./idgen.js";
3
+ import { stream } from "./stream.js";
4
4
  /**
5
5
  * Returns a {@link Stream} of values from provided iterable, emitted at
6
6
  * the given `delay` interval.
@@ -16,7 +16,7 @@ import { optsWithID } from "../utils/idgen";
16
16
  * @param src -
17
17
  * @param opts -
18
18
  */
19
- export const fromIterable = (src, opts = {}) => new Stream((stream) => {
19
+ export const fromIterable = (src, opts = {}) => stream((stream) => {
20
20
  const iter = src[Symbol.iterator]();
21
21
  const id = setInterval(() => {
22
22
  let val;
@@ -29,7 +29,7 @@ export const fromIterable = (src, opts = {}) => new Stream((stream) => {
29
29
  }
30
30
  }, opts.delay || 0);
31
31
  return () => clearInterval(id);
32
- }, optsWithID("iterable", opts));
32
+ }, __optsWithID("iterable", opts));
33
33
  /**
34
34
  * Creates a new {@link Stream} of given iterable which synchronously calls
35
35
  * `.next()` for each item of the iterable when the first (and in this
@@ -40,9 +40,9 @@ export const fromIterable = (src, opts = {}) => new Stream((stream) => {
40
40
  * @param src -
41
41
  * @param opts -
42
42
  */
43
- export const fromIterableSync = (src, opts) => new Stream((stream) => {
43
+ export const fromIterableSync = (src, opts) => stream((stream) => {
44
44
  for (let s of src) {
45
45
  stream.next(s);
46
46
  }
47
47
  stream.closeIn !== CloseMode.NEVER && stream.done();
48
- }, optsWithID("iterable-sync", opts));
48
+ }, __optsWithID("iterable-sync", opts));
package/logger.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { ILogger } from "@thi.ng/logger";
2
+ export declare let LOGGER: ILogger;
3
+ export declare const setLogger: (logger: ILogger) => ILogger;
4
+ //# sourceMappingURL=logger.d.ts.map
package/logger.js ADDED
@@ -0,0 +1,3 @@
1
+ import { NULL_LOGGER } from "@thi.ng/logger/null";
2
+ export let LOGGER = NULL_LOGGER;
3
+ export const setLogger = (logger) => (LOGGER = logger);
@@ -1,5 +1,5 @@
1
- import { ISubscribable, ISubscription, TransformableOpts } from "./api";
2
- import { Subscription } from "./subscription";
1
+ import { ISubscribable, ISubscription, TransformableOpts } from "./api.js";
2
+ import { Subscription } from "./subscription.js";
3
3
  export interface StreamMergeOpts<A, B> extends TransformableOpts<A, B> {
4
4
  /**
5
5
  * Input sources.
@@ -75,4 +75,4 @@ export declare class StreamMerge<A, B> extends Subscription<A, B> {
75
75
  unsubscribe(sub?: ISubscription<B, any>): boolean;
76
76
  protected markDone(src: ISubscribable<A>): void;
77
77
  }
78
- //# sourceMappingURL=stream-merge.d.ts.map
78
+ //# sourceMappingURL=merge.d.ts.map
@@ -1,7 +1,8 @@
1
- import { State } from "./api";
2
- import { Subscription } from "./subscription";
3
- import { isFirstOrLastInput } from "./utils/checks";
4
- import { optsWithID } from "./utils/idgen";
1
+ import { State, } from "./api.js";
2
+ import { isFirstOrLastInput } from "./checks.js";
3
+ import { __optsWithID } from "./idgen.js";
4
+ import { __removeAllIDs } from "./internal/remove.js";
5
+ import { Subscription } from "./subscription.js";
5
6
  /**
6
7
  * Returns a new {@link StreamMerge} subscription, consuming values from
7
8
  * multiple inputs and passing received values on to any subscribers.
@@ -62,7 +63,7 @@ export const merge = (opts) => new StreamMerge(opts);
62
63
  export class StreamMerge extends Subscription {
63
64
  constructor(opts) {
64
65
  opts = opts || {};
65
- super(undefined, optsWithID("streammerge", opts));
66
+ super(undefined, __optsWithID("streammerge", opts));
66
67
  this.sources = new Map();
67
68
  opts.src && this.addAll(opts.src);
68
69
  }
@@ -104,11 +105,7 @@ export class StreamMerge extends Subscription {
104
105
  return ok;
105
106
  }
106
107
  removeAllIDs(ids) {
107
- let ok = true;
108
- for (let id of ids) {
109
- ok = this.removeID(id) && ok;
110
- }
111
- return ok;
108
+ return __removeAllIDs(this, ids);
112
109
  }
113
110
  unsubscribe(sub) {
114
111
  if (!sub) {
package/metastream.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Fn, Nullable } from "@thi.ng/api";
2
- import { CommonOpts, ISubscription } from "./api";
3
- import { Subscription } from "./subscription";
1
+ import type { Fn, Nullable } from "@thi.ng/api";
2
+ import { CommonOpts, ISubscription } from "./api.js";
3
+ import { Subscription } from "./subscription.js";
4
4
  export interface MetaStreamOpts extends CommonOpts {
5
5
  /**
6
6
  * If true, emits the last received value from the metastream's
package/metastream.js CHANGED
@@ -1,7 +1,7 @@
1
- import { assert } from "@thi.ng/api";
2
- import { CloseMode, State } from "./api";
3
- import { Subscription } from "./subscription";
4
- import { optsWithID } from "./utils/idgen";
1
+ import { assert } from "@thi.ng/errors/assert";
2
+ import { CloseMode, State } from "./api.js";
3
+ import { __optsWithID } from "./idgen.js";
4
+ import { Subscription } from "./subscription.js";
5
5
  /**
6
6
  * Returns a {@link Subscription} which transforms each incoming value into a
7
7
  * new {@link ISubscription}, subscribes to it (via an hidden / internal
@@ -87,7 +87,7 @@ export const metaStream = (factory, opts) => new MetaStream(factory, opts);
87
87
  */
88
88
  export class MetaStream extends Subscription {
89
89
  constructor(factory, opts = {}) {
90
- super(undefined, optsWithID("metastram", opts));
90
+ super(undefined, __optsWithID("metastram", opts));
91
91
  this.factory = factory;
92
92
  this.emitLast = opts.emitLast === true;
93
93
  this.doneRequested = false;
@@ -1,6 +1,6 @@
1
1
  import type { Keys, Predicate2 } from "@thi.ng/api";
2
- import type { CommonOpts } from "../api";
3
- import { Subscription } from "../subscription";
2
+ import type { CommonOpts } from "./api.js";
3
+ import { Subscription } from "./subscription.js";
4
4
  export declare type KeyStreams<T, K extends Keys<T>> = {
5
5
  [id in K]-?: Subscription<T[id], T[id]>;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { dedupe } from "@thi.ng/transducers";
2
- import { subscription } from "../subscription";
3
- import { nextID } from "../utils/idgen";
1
+ import { dedupe } from "@thi.ng/transducers/dedupe";
2
+ import { __nextID } from "./idgen.js";
3
+ import { subscription } from "./subscription.js";
4
4
  /**
5
5
  * Takes an arbitrary object `src` and object of options (see
6
6
  * {@link StreamObjOpts}). Creates a new object and for each selected
@@ -69,13 +69,20 @@ import { nextID } from "../utils/idgen";
69
69
  * @param opts
70
70
  */
71
71
  export const fromObject = (src, opts = {}) => {
72
- const id = opts.id || `obj${nextID()}`;
72
+ const id = opts.id || `obj${__nextID()}`;
73
73
  const keys = opts.keys || Object.keys(src);
74
74
  const _opts = opts.dedupe !== false
75
- ? Object.assign({ xform: dedupe(opts.equiv || ((a, b) => a === b)) }, opts) : opts;
75
+ ? {
76
+ xform: dedupe(opts.equiv || ((a, b) => a === b)),
77
+ ...opts,
78
+ }
79
+ : opts;
76
80
  const streams = {};
77
81
  for (let k of keys) {
78
- streams[k] = subscription(undefined, Object.assign(Object.assign({}, _opts), { id: `${id}-${k}` }));
82
+ streams[k] = subscription(undefined, {
83
+ ..._opts,
84
+ id: `${id}-${k}`,
85
+ });
79
86
  }
80
87
  const res = {
81
88
  streams,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thi.ng/rstream",
3
- "version": "6.0.21",
3
+ "version": "7.0.4",
4
4
  "description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
5
+ "type": "module",
5
6
  "module": "./index.js",
6
- "main": "./lib/index.js",
7
- "umd:main": "./lib/index.umd.js",
8
7
  "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
@@ -24,36 +24,28 @@
24
24
  "author": "Karsten Schmidt <k+npm@thi.ng>",
25
25
  "license": "Apache-2.0",
26
26
  "scripts": {
27
- "build": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module",
28
- "build:release": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module all",
29
- "build:es6": "tsc --declaration",
30
- "build:test": "rimraf build && tsc -p test/tsconfig.json",
31
- "build:check": "tsc --isolatedModules --noEmit",
32
- "test": "mocha test",
33
- "cover": "nyc mocha test && nyc report --reporter=lcov",
34
- "clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib from subs utils",
35
- "doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
36
- "doc": "typedoc --excludePrivate --out doc --theme ../../tools/doc/typedoc-theme src/index.ts",
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf *.js *.d.ts *.map doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
37
30
  "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
38
- "pub": "yarn build:release && yarn publish --access public"
31
+ "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
+ "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
+ "pub": "yarn build && yarn publish --access public",
34
+ "test": "testament test"
39
35
  },
40
36
  "dependencies": {
41
- "@thi.ng/api": "^7.2.0",
42
- "@thi.ng/arrays": "^1.0.3",
43
- "@thi.ng/associative": "^5.2.16",
44
- "@thi.ng/atom": "^4.1.42",
45
- "@thi.ng/checks": "^2.9.11",
46
- "@thi.ng/errors": "^1.3.4",
47
- "@thi.ng/transducers": "^7.9.2"
37
+ "@thi.ng/api": "^8.0.4",
38
+ "@thi.ng/arrays": "^2.0.4",
39
+ "@thi.ng/associative": "^6.0.4",
40
+ "@thi.ng/atom": "^5.0.4",
41
+ "@thi.ng/checks": "^3.0.4",
42
+ "@thi.ng/errors": "^2.0.4",
43
+ "@thi.ng/logger": "^1.0.4",
44
+ "@thi.ng/transducers": "^8.0.4"
45
+ },
46
+ "devDependencies": {
47
+ "@thi.ng/testament": "^0.1.4"
48
48
  },
49
- "files": [
50
- "*.js",
51
- "*.d.ts",
52
- "lib",
53
- "from",
54
- "subs",
55
- "utils"
56
- ],
57
49
  "keywords": [
58
50
  "async",
59
51
  "datastructure",
@@ -74,7 +66,124 @@
74
66
  "publishConfig": {
75
67
  "access": "public"
76
68
  },
77
- "sideEffects": false,
69
+ "engines": {
70
+ "node": ">=12.7"
71
+ },
72
+ "files": [
73
+ "*.js",
74
+ "*.d.ts",
75
+ "internal"
76
+ ],
77
+ "exports": {
78
+ ".": {
79
+ "import": "./index.js"
80
+ },
81
+ "./api": {
82
+ "import": "./api.js"
83
+ },
84
+ "./asidechain": {
85
+ "import": "./asidechain.js"
86
+ },
87
+ "./atom": {
88
+ "import": "./atom.js"
89
+ },
90
+ "./bisect": {
91
+ "import": "./bisect.js"
92
+ },
93
+ "./checks": {
94
+ "import": "./checks.js"
95
+ },
96
+ "./debounce": {
97
+ "import": "./debounce.js"
98
+ },
99
+ "./defworker": {
100
+ "import": "./defworker.js"
101
+ },
102
+ "./event": {
103
+ "import": "./event.js"
104
+ },
105
+ "./forkjoin": {
106
+ "import": "./forkjoin.js"
107
+ },
108
+ "./idgen": {
109
+ "import": "./idgen.js"
110
+ },
111
+ "./interval": {
112
+ "import": "./interval.js"
113
+ },
114
+ "./iterable": {
115
+ "import": "./iterable.js"
116
+ },
117
+ "./logger": {
118
+ "import": "./logger.js"
119
+ },
120
+ "./merge": {
121
+ "import": "./merge.js"
122
+ },
123
+ "./metastream": {
124
+ "import": "./metastream.js"
125
+ },
126
+ "./object": {
127
+ "import": "./object.js"
128
+ },
129
+ "./post-worker": {
130
+ "import": "./post-worker.js"
131
+ },
132
+ "./promise": {
133
+ "import": "./promise.js"
134
+ },
135
+ "./promises": {
136
+ "import": "./promises.js"
137
+ },
138
+ "./pubsub": {
139
+ "import": "./pubsub.js"
140
+ },
141
+ "./raf": {
142
+ "import": "./raf.js"
143
+ },
144
+ "./resolve": {
145
+ "import": "./resolve.js"
146
+ },
147
+ "./sidechain-partition": {
148
+ "import": "./sidechain-partition.js"
149
+ },
150
+ "./sidechain-toggle": {
151
+ "import": "./sidechain-toggle.js"
152
+ },
153
+ "./stream": {
154
+ "import": "./stream.js"
155
+ },
156
+ "./subscription": {
157
+ "import": "./subscription.js"
158
+ },
159
+ "./sync": {
160
+ "import": "./sync.js"
161
+ },
162
+ "./timeout": {
163
+ "import": "./timeout.js"
164
+ },
165
+ "./trace": {
166
+ "import": "./trace.js"
167
+ },
168
+ "./transduce": {
169
+ "import": "./transduce.js"
170
+ },
171
+ "./trigger": {
172
+ "import": "./trigger.js"
173
+ },
174
+ "./tunnel": {
175
+ "import": "./tunnel.js"
176
+ },
177
+ "./tween": {
178
+ "import": "./tween.js"
179
+ },
180
+ "./view": {
181
+ "import": "./view.js"
182
+ },
183
+ "./worker": {
184
+ "import": "./worker.js"
185
+ }
186
+ },
78
187
  "thi.ng": {
79
188
  "related": [
80
189
  "atom",
@@ -84,5 +193,5 @@
84
193
  ],
85
194
  "year": 2017
86
195
  },
87
- "gitHead": "d971cb3f9b215a95483f78f1a8614015e331146f"
196
+ "gitHead": "9ff00a103f76cc4917ef3f244132e218f2300a05"
88
197
  }
@@ -1,4 +1,4 @@
1
- import { ISubscriber } from "../api";
1
+ import type { ISubscriber } from "./api.js";
2
2
  /**
3
3
  * Creates a {@link ISubscriber | subscriber} which forwards received
4
4
  * values to given worker.
@@ -1,6 +1,7 @@
1
- import { isTransferable, isTypedArray } from "@thi.ng/checks";
2
- import { LOGGER } from "../api";
3
- import { makeWorker } from "../utils/worker";
1
+ import { isTransferable } from "@thi.ng/checks/is-transferable";
2
+ import { isTypedArray } from "@thi.ng/checks/is-typedarray";
3
+ import { LOGGER } from "./logger.js";
4
+ import { defWorker } from "./defworker.js";
4
5
  /**
5
6
  * Creates a {@link ISubscriber | subscriber} which forwards received
6
7
  * values to given worker.
@@ -36,7 +37,7 @@ import { makeWorker } from "../utils/worker";
36
37
  * @param terminate - worker termination delay (ms)
37
38
  */
38
39
  export const postWorker = (worker, transfer = false, terminate = 0) => {
39
- const _worker = makeWorker(worker);
40
+ const _worker = defWorker(worker);
40
41
  return {
41
42
  next(x) {
42
43
  if (x instanceof Promise) {
@@ -1,5 +1,4 @@
1
- import { WithErrorHandlerOpts } from "../api";
2
- import { Stream } from "../stream";
1
+ import { WithErrorHandlerOpts } from "./api.js";
3
2
  /**
4
3
  * Yields a single-value {@link Stream} of the resolved promise and then
5
4
  * automatically marks itself done.
@@ -11,5 +10,5 @@ import { Stream } from "../stream";
11
10
  * @param src -
12
11
  * @param opts -
13
12
  */
14
- export declare const fromPromise: <T>(src: Promise<T>, opts?: Partial<WithErrorHandlerOpts> | undefined) => Stream<T>;
13
+ export declare const fromPromise: <T>(src: Promise<T>, opts?: Partial<WithErrorHandlerOpts> | undefined) => import("./stream.js").Stream<T>;
15
14
  //# sourceMappingURL=promise.d.ts.map
@@ -1,6 +1,6 @@
1
- import { CloseMode, State } from "../api";
2
- import { Stream } from "../stream";
3
- import { optsWithID } from "../utils/idgen";
1
+ import { CloseMode, State } from "./api.js";
2
+ import { __optsWithID } from "./idgen.js";
3
+ import { stream } from "./stream.js";
4
4
  /**
5
5
  * Yields a single-value {@link Stream} of the resolved promise and then
6
6
  * automatically marks itself done.
@@ -20,7 +20,7 @@ export const fromPromise = (src, opts) => {
20
20
  err = e;
21
21
  isError = true;
22
22
  });
23
- return new Stream((stream) => {
23
+ return stream((stream) => {
24
24
  src.then((x) => {
25
25
  if (!canceled && stream.getState() < State.DONE) {
26
26
  if (isError) {
@@ -36,5 +36,5 @@ export const fromPromise = (src, opts) => {
36
36
  return () => {
37
37
  canceled = true;
38
38
  };
39
- }, optsWithID("promise", opts));
39
+ }, __optsWithID("promise", opts));
40
40
  };
@@ -1,4 +1,4 @@
1
- import type { ISubscription, WithErrorHandlerOpts } from "../api";
1
+ import type { ISubscription, WithErrorHandlerOpts } from "./api.js";
2
2
  /**
3
3
  * Wraps given iterable in `Promise.all()` to yield {@link Stream} of
4
4
  * results in same order as arguments, then closes.
@@ -1,6 +1,6 @@
1
- import { mapcat } from "@thi.ng/transducers";
2
- import { optsWithID } from "../utils/idgen";
3
- import { fromPromise } from "./promise";
1
+ import { mapcat } from "@thi.ng/transducers/mapcat";
2
+ import { __optsWithID } from "./idgen.js";
3
+ import { fromPromise } from "./promise.js";
4
4
  /**
5
5
  * Wraps given iterable in `Promise.all()` to yield {@link Stream} of
6
6
  * results in same order as arguments, then closes.
@@ -38,4 +38,4 @@ import { fromPromise } from "./promise";
38
38
  * @param promises -
39
39
  * @param opts -
40
40
  */
41
- export const fromPromises = (promises, opts) => fromPromise(Promise.all(promises), optsWithID("promises", opts)).transform(mapcat((x) => x));
41
+ export const fromPromises = (promises, opts) => fromPromise(Promise.all(promises), __optsWithID("promises", opts)).transform(mapcat((x) => x));
package/pubsub.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { Fn, Predicate2 } from "@thi.ng/api";
2
- import { EquivMap } from "@thi.ng/associative";
2
+ import { EquivMap } from "@thi.ng/associative/equiv-map";
3
3
  import type { Transducer } from "@thi.ng/transducers";
4
- import { ISubscriber, ISubscription, TransformableOpts, WithErrorHandlerOpts } from "./api";
5
- import { Subscription } from "./subscription";
4
+ import { ISubscriber, ISubscription, TransformableOpts, WithErrorHandlerOpts } from "./api.js";
5
+ import { Subscription } from "./subscription.js";
6
6
  export interface PubSubOpts<A, B, T> {
7
7
  /**
8
8
  * Topic function. Incoming values will be routed to topic