@dxos/app-graph 0.8.4-main.fd6878d → 0.8.4-main.fffef41

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.
@@ -1,6 +1,8 @@
1
1
  // src/graph.ts
2
- import { Registry, Rx } from "@effect-rx/rx-react";
3
- import { Option, Record, pipe } from "effect";
2
+ import { Atom, Registry } from "@effect-atom/atom-react";
3
+ import * as Function from "effect/Function";
4
+ import * as Option from "effect/Option";
5
+ import * as Record from "effect/Record";
4
6
  import { Event, Trigger } from "@dxos/async";
5
7
  import { todo } from "@dxos/debug";
6
8
  import { invariant } from "@dxos/invariant";
@@ -12,7 +14,7 @@ var getGraph = (node) => {
12
14
  const graph = node[graphSymbol];
13
15
  invariant(graph, "Node is not associated with a graph.", {
14
16
  F: __dxlog_file,
15
- L: 25,
17
+ L: 29,
16
18
  S: void 0,
17
19
  A: [
18
20
  "graph",
@@ -46,16 +48,16 @@ var Graph = class {
46
48
  ]
47
49
  ]);
48
50
  /** @internal */
49
- _node = Rx.family((id) => {
51
+ _node = Atom.family((id) => {
50
52
  const initial = Option.flatten(Record.get(this._initialNodes, id));
51
- return Rx.make(initial).pipe(Rx.keepAlive, Rx.withLabel(`graph:node:${id}`));
53
+ return Atom.make(initial).pipe(Atom.keepAlive, Atom.withLabel(`graph:node:${id}`));
52
54
  });
53
- _nodeOrThrow = Rx.family((id) => {
54
- return Rx.make((get) => {
55
- const node = get(this._node(id));
55
+ _nodeOrThrow = Atom.family((id) => {
56
+ return Atom.make((get2) => {
57
+ const node = get2(this._node(id));
56
58
  invariant(Option.isSome(node), `Node not available: ${id}`, {
57
59
  F: __dxlog_file,
58
- L: 252,
60
+ L: 267,
59
61
  S: this,
60
62
  A: [
61
63
  "Option.isSome(node)",
@@ -65,33 +67,33 @@ var Graph = class {
65
67
  return node.value;
66
68
  });
67
69
  });
68
- _edges = Rx.family((id) => {
70
+ _edges = Atom.family((id) => {
69
71
  const initial = Record.get(this._initialEdges, id).pipe(Option.getOrElse(() => ({
70
72
  inbound: [],
71
73
  outbound: []
72
74
  })));
73
- return Rx.make(initial).pipe(Rx.keepAlive, Rx.withLabel(`graph:edges:${id}`));
75
+ return Atom.make(initial).pipe(Atom.keepAlive, Atom.withLabel(`graph:edges:${id}`));
74
76
  });
75
- // NOTE: Currently the argument to the family needs to be referentially stable for the rx to be referentially stable.
76
- // TODO(wittjosiah): Rx feature request, support for something akin to `ComplexMap` to allow for complex arguments.
77
- _connections = Rx.family((key) => {
78
- return Rx.make((get) => {
77
+ // NOTE: Currently the argument to the family needs to be referentially stable for the atom to be referentially stable.
78
+ // TODO(wittjosiah): Atom feature request, support for something akin to `ComplexMap` to allow for complex arguments.
79
+ _connections = Atom.family((key) => {
80
+ return Atom.make((get2) => {
79
81
  const [id, relation] = key.split("$");
80
- const edges = get(this._edges(id));
81
- return edges[relation].map((id2) => get(this._node(id2))).filter(Option.isSome).map((o) => o.value);
82
- }).pipe(Rx.withLabel(`graph:connections:${key}`));
82
+ const edges = get2(this._edges(id));
83
+ return edges[relation].map((id2) => get2(this._node(id2))).filter(Option.isSome).map((o) => o.value);
84
+ }).pipe(Atom.withLabel(`graph:connections:${key}`));
83
85
  });
84
- _actions = Rx.family((id) => {
85
- return Rx.make((get) => {
86
- return get(this._connections(`${id}$outbound`)).filter((node) => node.type === ACTION_TYPE || node.type === ACTION_GROUP_TYPE);
87
- }).pipe(Rx.withLabel(`graph:actions:${id}`));
86
+ _actions = Atom.family((id) => {
87
+ return Atom.make((get2) => {
88
+ return get2(this._connections(`${id}$outbound`)).filter((node) => node.type === ACTION_TYPE || node.type === ACTION_GROUP_TYPE);
89
+ }).pipe(Atom.withLabel(`graph:actions:${id}`));
88
90
  });
89
- _json = Rx.family((id) => {
90
- return Rx.make((get) => {
91
+ _json = Atom.family((id) => {
92
+ return Atom.make((get2) => {
91
93
  const toJSON = (node, seen = []) => {
92
- const nodes = get(this.connections(node.id));
94
+ const nodes = get2(this.connections(node.id));
93
95
  const obj = {
94
- id: node.id.length > 32 ? `${node.id.slice(0, 32)}...` : node.id,
96
+ id: node.id,
95
97
  type: node.type
96
98
  };
97
99
  if (node.properties.label) {
@@ -108,9 +110,9 @@ var Graph = class {
108
110
  }
109
111
  return obj;
110
112
  };
111
- const root = get(this.nodeOrThrow(id));
113
+ const root = get2(this.nodeOrThrow(id));
112
114
  return toJSON(root);
113
- }).pipe(Rx.withLabel(`graph:json:${id}`));
115
+ }).pipe(Atom.withLabel(`graph:json:${id}`));
114
116
  });
115
117
  constructor({ registry, nodes, edges, onInitialize, onExpand, onRemoveNode } = {}) {
116
118
  this._registry = registry ?? Registry.make();
@@ -174,7 +176,7 @@ var Graph = class {
174
176
  initialized
175
177
  }, {
176
178
  F: __dxlog_file,
177
- L: 384,
179
+ L: 399,
178
180
  S: this,
179
181
  C: (f, a) => f(...a)
180
182
  });
@@ -191,7 +193,7 @@ var Graph = class {
191
193
  expanded
192
194
  }, {
193
195
  F: __dxlog_file,
194
- L: 394,
196
+ L: 409,
195
197
  S: this,
196
198
  C: (f, a) => f(...a)
197
199
  });
@@ -201,14 +203,14 @@ var Graph = class {
201
203
  }
202
204
  }
203
205
  addNodes(nodes) {
204
- Rx.batch(() => {
206
+ Atom.batch(() => {
205
207
  nodes.map((node) => this.addNode(node));
206
208
  });
207
209
  }
208
210
  addNode({ nodes, edges, ...nodeArg }) {
209
211
  const { id, type, data = null, properties = {} } = nodeArg;
210
- const nodeRx = this._node(id);
211
- const node = this._registry.get(nodeRx);
212
+ const nodeAtom = this._node(id);
213
+ const node = this._registry.get(nodeAtom);
212
214
  Option.match(node, {
213
215
  onSome: (node2) => {
214
216
  const typeChanged = node2.type !== type;
@@ -221,7 +223,7 @@ var Graph = class {
221
223
  propertiesChanged
222
224
  }, {
223
225
  F: __dxlog_file,
224
- L: 416,
226
+ L: 431,
225
227
  S: this,
226
228
  C: (f, a) => f(...a)
227
229
  });
@@ -233,7 +235,7 @@ var Graph = class {
233
235
  properties
234
236
  }, {
235
237
  F: __dxlog_file,
236
- L: 418,
238
+ L: 438,
237
239
  S: this,
238
240
  C: (f, a) => f(...a)
239
241
  });
@@ -246,7 +248,7 @@ var Graph = class {
246
248
  ...properties
247
249
  }
248
250
  });
249
- this._registry.set(nodeRx, newNode);
251
+ this._registry.set(nodeAtom, newNode);
250
252
  this.onNodeChanged.emit({
251
253
  id,
252
254
  node: newNode
@@ -261,7 +263,7 @@ var Graph = class {
261
263
  properties
262
264
  }, {
263
265
  F: __dxlog_file,
264
- L: 425,
266
+ L: 450,
265
267
  S: this,
266
268
  C: (f, a) => f(...a)
267
269
  });
@@ -271,7 +273,7 @@ var Graph = class {
271
273
  data,
272
274
  properties
273
275
  });
274
- this._registry.set(nodeRx, newNode);
276
+ this._registry.set(nodeAtom, newNode);
275
277
  this.onNodeChanged.emit({
276
278
  id,
277
279
  node: newNode
@@ -291,13 +293,13 @@ var Graph = class {
291
293
  }
292
294
  }
293
295
  removeNodes(ids, edges = false) {
294
- Rx.batch(() => {
296
+ Atom.batch(() => {
295
297
  ids.map((id) => this.removeNode(id, edges));
296
298
  });
297
299
  }
298
300
  removeNode(id, edges = false) {
299
- const nodeRx = this._node(id);
300
- this._registry.set(nodeRx, Option.none());
301
+ const nodeAtom = this._node(id);
302
+ this._registry.set(nodeAtom, Option.none());
301
303
  this.onNodeChanged.emit({
302
304
  id,
303
305
  node: Option.none()
@@ -319,24 +321,24 @@ var Graph = class {
319
321
  this._onRemoveNode?.(id);
320
322
  }
321
323
  addEdges(edges) {
322
- Rx.batch(() => {
324
+ Atom.batch(() => {
323
325
  edges.map((edge) => this.addEdge(edge));
324
326
  });
325
327
  }
326
328
  addEdge(edgeArg) {
327
- const sourceRx = this._edges(edgeArg.source);
328
- const source = this._registry.get(sourceRx);
329
+ const sourceAtom = this._edges(edgeArg.source);
330
+ const source = this._registry.get(sourceAtom);
329
331
  if (!source.outbound.includes(edgeArg.target)) {
330
332
  log("add outbound edge", {
331
333
  source: edgeArg.source,
332
334
  target: edgeArg.target
333
335
  }, {
334
336
  F: __dxlog_file,
335
- L: 480,
337
+ L: 505,
336
338
  S: this,
337
339
  C: (f, a) => f(...a)
338
340
  });
339
- this._registry.set(sourceRx, {
341
+ this._registry.set(sourceAtom, {
340
342
  inbound: source.inbound,
341
343
  outbound: [
342
344
  ...source.outbound,
@@ -344,19 +346,19 @@ var Graph = class {
344
346
  ]
345
347
  });
346
348
  }
347
- const targetRx = this._edges(edgeArg.target);
348
- const target = this._registry.get(targetRx);
349
+ const targetAtom = this._edges(edgeArg.target);
350
+ const target = this._registry.get(targetAtom);
349
351
  if (!target.inbound.includes(edgeArg.source)) {
350
352
  log("add inbound edge", {
351
353
  source: edgeArg.source,
352
354
  target: edgeArg.target
353
355
  }, {
354
356
  F: __dxlog_file,
355
- L: 487,
357
+ L: 518,
356
358
  S: this,
357
359
  C: (f, a) => f(...a)
358
360
  });
359
- this._registry.set(targetRx, {
361
+ this._registry.set(targetAtom, {
360
362
  inbound: [
361
363
  ...target.inbound,
362
364
  edgeArg.source
@@ -366,30 +368,30 @@ var Graph = class {
366
368
  }
367
369
  }
368
370
  removeEdges(edges, removeOrphans = false) {
369
- Rx.batch(() => {
371
+ Atom.batch(() => {
370
372
  edges.map((edge) => this.removeEdge(edge, removeOrphans));
371
373
  });
372
374
  }
373
375
  removeEdge(edgeArg, removeOrphans = false) {
374
- const sourceRx = this._edges(edgeArg.source);
375
- const source = this._registry.get(sourceRx);
376
+ const sourceAtom = this._edges(edgeArg.source);
377
+ const source = this._registry.get(sourceAtom);
376
378
  if (source.outbound.includes(edgeArg.target)) {
377
- this._registry.set(sourceRx, {
379
+ this._registry.set(sourceAtom, {
378
380
  inbound: source.inbound,
379
381
  outbound: source.outbound.filter((id) => id !== edgeArg.target)
380
382
  });
381
383
  }
382
- const targetRx = this._edges(edgeArg.target);
383
- const target = this._registry.get(targetRx);
384
+ const targetAtom = this._edges(edgeArg.target);
385
+ const target = this._registry.get(targetAtom);
384
386
  if (target.inbound.includes(edgeArg.source)) {
385
- this._registry.set(targetRx, {
387
+ this._registry.set(targetAtom, {
386
388
  inbound: target.inbound.filter((id) => id !== edgeArg.source),
387
389
  outbound: target.outbound
388
390
  });
389
391
  }
390
392
  if (removeOrphans) {
391
- const source2 = this._registry.get(sourceRx);
392
- const target2 = this._registry.get(targetRx);
393
+ const source2 = this._registry.get(sourceAtom);
394
+ const target2 = this._registry.get(targetAtom);
393
395
  if (source2.outbound.length === 0 && source2.inbound.length === 0 && edgeArg.source !== ROOT_ID) {
394
396
  this.removeNodes([
395
397
  edgeArg.source
@@ -403,15 +405,15 @@ var Graph = class {
403
405
  }
404
406
  }
405
407
  sortEdges(id, relation, order) {
406
- const edgesRx = this._edges(id);
407
- const edges = this._registry.get(edgesRx);
408
+ const edgesAtom = this._edges(id);
409
+ const edges = this._registry.get(edgesAtom);
408
410
  const unsorted = edges[relation].filter((id2) => !order.includes(id2)) ?? [];
409
411
  const sorted = order.filter((id2) => edges[relation].includes(id2)) ?? [];
410
412
  edges[relation].splice(0, edges[relation].length, ...[
411
413
  ...sorted,
412
414
  ...unsorted
413
415
  ]);
414
- this._registry.set(edgesRx, edges);
416
+ this._registry.set(edgesAtom, edges);
415
417
  }
416
418
  traverse({ visitor, source = ROOT_ID, relation = "outbound" }, path = []) {
417
419
  if (path.includes(source)) {
@@ -435,7 +437,7 @@ var Graph = class {
435
437
  ]));
436
438
  }
437
439
  getPath({ source = "root", target }) {
438
- return pipe(this.getNode(source), Option.flatMap((node) => {
440
+ return Function.pipe(this.getNode(source), Option.flatMap((node) => {
439
441
  let found = Option.none();
440
442
  this.traverse({
441
443
  source: node.id,
@@ -479,9 +481,12 @@ var Graph = class {
479
481
  };
480
482
 
481
483
  // src/graph-builder.ts
482
- import { Registry as Registry2, Rx as Rx2 } from "@effect-rx/rx-react";
484
+ import { Atom as Atom2, Registry as Registry2 } from "@effect-atom/atom-react";
483
485
  import { effect } from "@preact/signals-core";
484
- import { Array, Option as Option2, Record as Record2, pipe as pipe2 } from "effect";
486
+ import * as Array from "effect/Array";
487
+ import * as Function2 from "effect/Function";
488
+ import * as Option2 from "effect/Option";
489
+ import * as Record2 from "effect/Record";
485
490
  import { log as log2 } from "@dxos/log";
486
491
  import { byPosition, getDebugName, isNode, isNonNullable as isNonNullable2 } from "@dxos/util";
487
492
 
@@ -497,10 +502,10 @@ var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-graph/src/graph-builder.ts"
497
502
  var createExtension = (extension) => {
498
503
  const { id, position = "static", relation = "outbound", resolver: _resolver, connector: _connector, actions: _actions, actionGroups: _actionGroups } = extension;
499
504
  const getId = (key) => `${id}/${key}`;
500
- const resolver = _resolver && Rx2.family((id2) => _resolver(id2).pipe(Rx2.withLabel(`graph-builder:_resolver:${id2}`)));
501
- const connector = _connector && Rx2.family((node) => _connector(node).pipe(Rx2.withLabel(`graph-builder:_connector:${id}`)));
502
- const actionGroups = _actionGroups && Rx2.family((node) => _actionGroups(node).pipe(Rx2.withLabel(`graph-builder:_actionGroups:${id}`)));
503
- const actions = _actions && Rx2.family((node) => _actions(node).pipe(Rx2.withLabel(`graph-builder:_actions:${id}`)));
505
+ const resolver = _resolver && Atom2.family((id2) => _resolver(id2).pipe(Atom2.withLabel(`graph-builder:_resolver:${id2}`)));
506
+ const connector = _connector && Atom2.family((node) => _connector(node).pipe(Atom2.withLabel(`graph-builder:_connector:${id}`)));
507
+ const actionGroups = _actionGroups && Atom2.family((node) => _actionGroups(node).pipe(Atom2.withLabel(`graph-builder:_actionGroups:${id}`)));
508
+ const actions = _actions && Atom2.family((node) => _actions(node).pipe(Atom2.withLabel(`graph-builder:_actions:${id}`)));
504
509
  return [
505
510
  resolver ? {
506
511
  id: getId("resolver"),
@@ -511,30 +516,30 @@ var createExtension = (extension) => {
511
516
  id: getId("connector"),
512
517
  position,
513
518
  relation,
514
- connector: Rx2.family((node) => Rx2.make((get) => {
519
+ connector: Atom2.family((node) => Atom2.make((get2) => {
515
520
  try {
516
- return get(connector(node));
521
+ return get2(connector(node));
517
522
  } catch {
518
523
  log2.warn("Error in connector", {
519
524
  id: getId("connector"),
520
525
  node
521
526
  }, {
522
527
  F: __dxlog_file2,
523
- L: 109,
528
+ L: 114,
524
529
  S: void 0,
525
530
  C: (f, a) => f(...a)
526
531
  });
527
532
  return [];
528
533
  }
529
- }).pipe(Rx2.withLabel(`graph-builder:connector:${id}`)))
534
+ }).pipe(Atom2.withLabel(`graph-builder:connector:${id}`)))
530
535
  } : void 0,
531
536
  actionGroups ? {
532
537
  id: getId("actionGroups"),
533
538
  position,
534
539
  relation: "outbound",
535
- connector: Rx2.family((node) => Rx2.make((get) => {
540
+ connector: Atom2.family((node) => Atom2.make((get2) => {
536
541
  try {
537
- return get(actionGroups(node)).map((arg) => ({
542
+ return get2(actionGroups(node)).map((arg) => ({
538
543
  ...arg,
539
544
  data: actionGroupSymbol,
540
545
  type: ACTION_GROUP_TYPE
@@ -545,21 +550,21 @@ var createExtension = (extension) => {
545
550
  node
546
551
  }, {
547
552
  F: __dxlog_file2,
548
- L: 130,
553
+ L: 135,
549
554
  S: void 0,
550
555
  C: (f, a) => f(...a)
551
556
  });
552
557
  return [];
553
558
  }
554
- }).pipe(Rx2.withLabel(`graph-builder:connector:actionGroups:${id}`)))
559
+ }).pipe(Atom2.withLabel(`graph-builder:connector:actionGroups:${id}`)))
555
560
  } : void 0,
556
561
  actions ? {
557
562
  id: getId("actions"),
558
563
  position,
559
564
  relation: "outbound",
560
- connector: Rx2.family((node) => Rx2.make((get) => {
565
+ connector: Atom2.family((node) => Atom2.make((get2) => {
561
566
  try {
562
- return get(actions(node)).map((arg) => ({
567
+ return get2(actions(node)).map((arg) => ({
563
568
  ...arg,
564
569
  type: ACTION_TYPE
565
570
  }));
@@ -569,13 +574,13 @@ var createExtension = (extension) => {
569
574
  node
570
575
  }, {
571
576
  F: __dxlog_file2,
572
- L: 147,
577
+ L: 152,
573
578
  S: void 0,
574
579
  C: (f, a) => f(...a)
575
580
  });
576
581
  return [];
577
582
  }
578
- }).pipe(Rx2.withLabel(`graph-builder:connector:actions:${id}`)))
583
+ }).pipe(Atom2.withLabel(`graph-builder:connector:actions:${id}`)))
579
584
  } : void 0
580
585
  ].filter(isNonNullable2);
581
586
  };
@@ -595,7 +600,7 @@ var flattenExtensions = (extension, acc = []) => {
595
600
  var GraphBuilder = class _GraphBuilder {
596
601
  // TODO(wittjosiah): Use Context.
597
602
  _subscriptions = /* @__PURE__ */ new Map();
598
- _extensions = Rx2.make(Record2.empty()).pipe(Rx2.keepAlive, Rx2.withLabel("graph-builder:extensions"));
603
+ _extensions = Atom2.make(Record2.empty()).pipe(Atom2.keepAlive, Atom2.withLabel("graph-builder:extensions"));
599
604
  _initialized = {};
600
605
  _registry;
601
606
  _graph;
@@ -678,26 +683,26 @@ var GraphBuilder = class _GraphBuilder {
678
683
  this._subscriptions.forEach((unsubscribe) => unsubscribe());
679
684
  this._subscriptions.clear();
680
685
  }
681
- _resolvers = Rx2.family((id) => {
682
- return Rx2.make((get) => {
683
- return pipe2(get(this._extensions), Record2.values, Array.sortBy(byPosition), Array.map(({ resolver }) => resolver), Array.filter(isNonNullable2), Array.map((resolver) => get(resolver(id))), Array.filter(isNonNullable2), Array.head);
686
+ _resolvers = Atom2.family((id) => {
687
+ return Atom2.make((get2) => {
688
+ return Function2.pipe(get2(this._extensions), Record2.values, Array.sortBy(byPosition), Array.map(({ resolver }) => resolver), Array.filter(isNonNullable2), Array.map((resolver) => get2(resolver(id))), Array.filter(isNonNullable2), Array.head);
684
689
  });
685
690
  });
686
- _connectors = Rx2.family((key) => {
687
- return Rx2.make((get) => {
691
+ _connectors = Atom2.family((key) => {
692
+ return Atom2.make((get2) => {
688
693
  const [id, relation] = key.split("+");
689
694
  const node = this._graph.node(id);
690
- return pipe2(
691
- get(this._extensions),
695
+ return Function2.pipe(
696
+ get2(this._extensions),
692
697
  Record2.values,
693
698
  // TODO(wittjosiah): Sort on write rather than read.
694
699
  Array.sortBy(byPosition),
695
700
  Array.filter(({ relation: _relation = "outbound" }) => _relation === relation),
696
701
  Array.map(({ connector }) => connector?.(node)),
697
702
  Array.filter(isNonNullable2),
698
- Array.flatMap((result) => get(result))
703
+ Array.flatMap((result) => get2(result))
699
704
  );
700
- }).pipe(Rx2.withLabel(`graph-builder:connectors:${key}`));
705
+ }).pipe(Atom2.withLabel(`graph-builder:connectors:${key}`));
701
706
  });
702
707
  _onExpand(id, relation) {
703
708
  log2("onExpand", {
@@ -706,7 +711,7 @@ var GraphBuilder = class _GraphBuilder {
706
711
  registry: getDebugName(this._registry)
707
712
  }, {
708
713
  F: __dxlog_file2,
709
- L: 324,
714
+ L: 329,
710
715
  S: this,
711
716
  C: (f, a) => f(...a)
712
717
  });
@@ -723,12 +728,12 @@ var GraphBuilder = class _GraphBuilder {
723
728
  removed
724
729
  }, {
725
730
  F: __dxlog_file2,
726
- L: 335,
731
+ L: 340,
727
732
  S: this,
728
733
  C: (f, a) => f(...a)
729
734
  });
730
735
  const update = () => {
731
- Rx2.batch(() => {
736
+ Atom2.batch(() => {
732
737
  this._graph.removeEdges(removed.map((target) => ({
733
738
  source: id,
734
739
  target
@@ -760,7 +765,7 @@ var GraphBuilder = class _GraphBuilder {
760
765
  id
761
766
  }, {
762
767
  F: __dxlog_file2,
763
- L: 372,
768
+ L: 377,
764
769
  S: this,
765
770
  C: (f, a) => f(...a)
766
771
  });
@@ -791,23 +796,23 @@ var GraphBuilder = class _GraphBuilder {
791
796
  this._subscriptions.delete(id);
792
797
  }
793
798
  };
794
- var rxFromSignal = (cb) => {
795
- return Rx2.make((get) => {
799
+ var atomFromSignal = (cb) => {
800
+ return Atom2.make((get2) => {
796
801
  const dispose = effect(() => {
797
- get.setSelf(cb());
802
+ get2.setSelf(cb());
798
803
  });
799
- get.addFinalizer(() => dispose());
804
+ get2.addFinalizer(() => dispose());
800
805
  return cb();
801
806
  });
802
807
  };
803
- var observableFamily = Rx2.family((observable) => {
804
- return Rx2.make((get) => {
805
- const subscription = observable.subscribe((value) => get.setSelf(value));
806
- get.addFinalizer(() => subscription.unsubscribe());
808
+ var observableFamily = Atom2.family((observable) => {
809
+ return Atom2.make((get2) => {
810
+ const subscription = observable.subscribe((value) => get2.setSelf(value));
811
+ get2.addFinalizer(() => subscription.unsubscribe());
807
812
  return observable.get();
808
813
  });
809
814
  });
810
- var rxFromObservable = (observable) => {
815
+ var atomFromObservable = (observable) => {
811
816
  return observableFamily(observable);
812
817
  };
813
818
  export {
@@ -818,14 +823,14 @@ export {
818
823
  ROOT_ID,
819
824
  ROOT_TYPE,
820
825
  actionGroupSymbol,
826
+ atomFromObservable,
827
+ atomFromSignal,
821
828
  createExtension,
822
829
  flattenExtensions,
823
830
  getGraph,
824
831
  isAction,
825
832
  isActionGroup,
826
833
  isActionLike,
827
- isGraphNode,
828
- rxFromObservable,
829
- rxFromSignal
834
+ isGraphNode
830
835
  };
831
836
  //# sourceMappingURL=index.mjs.map