@dxos/app-graph 0.8.4-main.74a063c4e0 → 0.8.4-main.765dc60934
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{browser/chunk-AKBGYELG.mjs → neutral/chunk-WJJ5KEOH.mjs} +48 -174
- package/dist/lib/neutral/chunk-WJJ5KEOH.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/index.mjs +4 -2
- package/dist/lib/{browser → neutral}/index.mjs.map +2 -2
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/scheduler.mjs +15 -0
- package/dist/lib/neutral/scheduler.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/testing/index.mjs +2 -1
- package/dist/types/src/atoms.d.ts.map +1 -1
- package/dist/types/src/graph-builder.d.ts +1 -1
- package/dist/types/src/graph-builder.d.ts.map +1 -1
- package/dist/types/src/graph.d.ts.map +1 -1
- package/dist/types/src/node-matcher.d.ts +3 -3
- package/dist/types/src/node-matcher.d.ts.map +1 -1
- package/dist/types/src/node.d.ts +2 -2
- package/dist/types/src/node.d.ts.map +1 -1
- package/dist/types/src/scheduler.browser.d.ts +2 -0
- package/dist/types/src/scheduler.browser.d.ts.map +1 -0
- package/dist/types/src/scheduler.d.ts +8 -0
- package/dist/types/src/scheduler.d.ts.map +1 -0
- package/dist/types/src/stories/EchoGraph.stories.d.ts.map +1 -1
- package/dist/types/src/testing/setup-graph-builder.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -0
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -31
- package/src/graph-builder.test.ts +126 -0
- package/src/graph-builder.ts +20 -1
- package/src/graph.ts +4 -1
- package/src/node-matcher.ts +3 -3
- package/src/scheduler.browser.ts +5 -0
- package/src/scheduler.ts +17 -0
- package/src/stories/EchoGraph.stories.tsx +5 -5
- package/src/util.ts +9 -3
- package/dist/lib/browser/chunk-AKBGYELG.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HR5S4XYH.mjs +0 -1604
- package/dist/lib/node-esm/chunk-HR5S4XYH.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -39
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -40
- /package/dist/lib/{node-esm → neutral}/testing/index.mjs.map +0 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
12
12
|
|
|
13
|
-
License: [
|
|
13
|
+
License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2023 © DXOS
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
6
4
|
|
|
7
5
|
// src/node.ts
|
|
8
6
|
var node_exports = {};
|
|
@@ -61,8 +59,12 @@ var secondaryKey = (...parts) => parts.join(SECONDARY);
|
|
|
61
59
|
var secondaryParts = (key) => key.split(SECONDARY);
|
|
62
60
|
var normalizeRelation = (relation2) => relation2 == null ? childRelation() : typeof relation2 === "string" ? relation(relation2) : relation2;
|
|
63
61
|
var shallowEqual = (a, b) => {
|
|
64
|
-
if (a === b)
|
|
65
|
-
|
|
62
|
+
if (a === b) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
if (a == null || b == null || typeof a !== "object" || typeof b !== "object") {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
66
68
|
const keysA = Object.keys(a);
|
|
67
69
|
const keysB = Object.keys(b);
|
|
68
70
|
if (keysA.length !== keysB.length) {
|
|
@@ -76,7 +78,7 @@ var nodeArgsUnchanged = (prev, next) => {
|
|
|
76
78
|
}
|
|
77
79
|
return prev.every((prevNode, idx) => {
|
|
78
80
|
const nextNode = next[idx];
|
|
79
|
-
return prevNode.id === nextNode.id && prevNode.type === nextNode.type && shallowEqual(prevNode.data, nextNode.data) && shallowEqual(prevNode.properties, nextNode.properties);
|
|
81
|
+
return prevNode.id === nextNode.id && prevNode.type === nextNode.type && shallowEqual(prevNode.data, nextNode.data) && shallowEqual(prevNode.properties, nextNode.properties) && nodeArgsUnchanged(prevNode.nodes ?? [], nextNode.nodes ?? []);
|
|
80
82
|
});
|
|
81
83
|
};
|
|
82
84
|
var qualifyId = (parentId, ...segmentIds) => [
|
|
@@ -84,15 +86,7 @@ var qualifyId = (parentId, ...segmentIds) => [
|
|
|
84
86
|
...segmentIds
|
|
85
87
|
].join(PATH);
|
|
86
88
|
var validateSegmentId = (id) => {
|
|
87
|
-
invariant(!id.includes(PATH), `Node segment ID must not contain '${PATH}': ${id}`, {
|
|
88
|
-
F: __dxlog_file,
|
|
89
|
-
L: 78,
|
|
90
|
-
S: void 0,
|
|
91
|
-
A: [
|
|
92
|
-
"!id.includes(PATH)",
|
|
93
|
-
"`Node segment ID must not contain '${PATH}': ${id}`"
|
|
94
|
-
]
|
|
95
|
-
});
|
|
89
|
+
invariant(!id.includes(PATH), `Node segment ID must not contain '${PATH}': ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 56, S: void 0, A: ["!id.includes(PATH)", "`Node segment ID must not contain '${PATH}': ${id}`"] });
|
|
96
90
|
};
|
|
97
91
|
var getParentId = (qualifiedId) => {
|
|
98
92
|
const lastSlash = qualifiedId.lastIndexOf(PATH);
|
|
@@ -147,15 +141,7 @@ var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-graph/src/graph.ts";
|
|
|
147
141
|
var graphSymbol = /* @__PURE__ */ Symbol("graph");
|
|
148
142
|
var getGraph = (node) => {
|
|
149
143
|
const graph = node[graphSymbol];
|
|
150
|
-
invariant2(graph, "Node is not associated with a graph.", {
|
|
151
|
-
F: __dxlog_file2,
|
|
152
|
-
L: 33,
|
|
153
|
-
S: void 0,
|
|
154
|
-
A: [
|
|
155
|
-
"graph",
|
|
156
|
-
"'Node is not associated with a graph.'"
|
|
157
|
-
]
|
|
158
|
-
});
|
|
144
|
+
invariant2(graph, "Node is not associated with a graph.", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 21, S: void 0, A: ["graph", "'Node is not associated with a graph.'"] });
|
|
159
145
|
return graph;
|
|
160
146
|
};
|
|
161
147
|
var GraphTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-graph/Graph");
|
|
@@ -194,15 +180,7 @@ var GraphImpl = class {
|
|
|
194
180
|
_nodeOrThrow = Atom.family((id) => {
|
|
195
181
|
return Atom.make((get2) => {
|
|
196
182
|
const node = get2(this._node(id));
|
|
197
|
-
invariant2(Option.isSome(node), `Node not available: ${id}`, {
|
|
198
|
-
F: __dxlog_file2,
|
|
199
|
-
L: 172,
|
|
200
|
-
S: this,
|
|
201
|
-
A: [
|
|
202
|
-
"Option.isSome(node)",
|
|
203
|
-
"`Node not available: ${id}`"
|
|
204
|
-
]
|
|
205
|
-
});
|
|
183
|
+
invariant2(Option.isSome(node), `Node not available: ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 67, S: this, A: ["Option.isSome(node)", "`Node not available: ${id}`"] });
|
|
206
184
|
return node.value;
|
|
207
185
|
});
|
|
208
186
|
});
|
|
@@ -214,7 +192,8 @@ var GraphImpl = class {
|
|
|
214
192
|
// TODO(wittjosiah): Atom feature request, support for something akin to `ComplexMap` to allow for complex arguments.
|
|
215
193
|
_connections = Atom.family((key) => {
|
|
216
194
|
return Atom.make((get2) => {
|
|
217
|
-
|
|
195
|
+
const parts = key ? primaryParts(key) : [];
|
|
196
|
+
if (parts.length < 2 || !parts[0]) {
|
|
218
197
|
return [];
|
|
219
198
|
}
|
|
220
199
|
const { id, relation: relation2 } = relationFromConnectionKey(key);
|
|
@@ -372,15 +351,7 @@ function getConnections(graphOrId, idOrRelation, relation2) {
|
|
|
372
351
|
} else {
|
|
373
352
|
const graph = graphOrId;
|
|
374
353
|
const id = idOrRelation;
|
|
375
|
-
invariant2(relation2 !== void 0, "Relation is required.", {
|
|
376
|
-
F: __dxlog_file2,
|
|
377
|
-
L: 446,
|
|
378
|
-
S: this,
|
|
379
|
-
A: [
|
|
380
|
-
"relation !== undefined",
|
|
381
|
-
"'Relation is required.'"
|
|
382
|
-
]
|
|
383
|
-
});
|
|
354
|
+
invariant2(relation2 !== void 0, "Relation is required.", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 272, S: this, A: ["relation !== undefined", "'Relation is required.'"] });
|
|
384
355
|
const rel = relation2;
|
|
385
356
|
return getConnectionsImpl(graph, id, rel);
|
|
386
357
|
}
|
|
@@ -517,12 +488,7 @@ var initializeImpl = async (graph, id) => {
|
|
|
517
488
|
log("initialize", {
|
|
518
489
|
id,
|
|
519
490
|
initialized
|
|
520
|
-
}, {
|
|
521
|
-
F: __dxlog_file2,
|
|
522
|
-
L: 668,
|
|
523
|
-
S: void 0,
|
|
524
|
-
C: (f, a) => f(...a)
|
|
525
|
-
});
|
|
491
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 431, S: void 0 });
|
|
526
492
|
if (!initialized) {
|
|
527
493
|
Record.set(internal._initialized, id, true);
|
|
528
494
|
await internal._onInitialize?.(id);
|
|
@@ -548,24 +514,14 @@ var expandImpl = (graph, id, relation2) => {
|
|
|
548
514
|
log("expand", {
|
|
549
515
|
key,
|
|
550
516
|
deferred: true
|
|
551
|
-
}, {
|
|
552
|
-
F: __dxlog_file2,
|
|
553
|
-
L: 714,
|
|
554
|
-
S: void 0,
|
|
555
|
-
C: (f, a) => f(...a)
|
|
556
|
-
});
|
|
517
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 463, S: void 0 });
|
|
557
518
|
return graph;
|
|
558
519
|
}
|
|
559
520
|
const expanded = Record.get(internal._expanded, key).pipe(Option.getOrElse(() => false));
|
|
560
521
|
log("expand", {
|
|
561
522
|
key,
|
|
562
523
|
expanded
|
|
563
|
-
}, {
|
|
564
|
-
F: __dxlog_file2,
|
|
565
|
-
L: 719,
|
|
566
|
-
S: void 0,
|
|
567
|
-
C: (f, a) => f(...a)
|
|
568
|
-
});
|
|
524
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 470, S: void 0 });
|
|
569
525
|
if (!expanded) {
|
|
570
526
|
Record.set(internal._expanded, key, true);
|
|
571
527
|
internal._onExpand?.(id, normalizedRelation);
|
|
@@ -580,15 +536,7 @@ function expand(graphOrId, idOrRelation, relation2) {
|
|
|
580
536
|
} else {
|
|
581
537
|
const graph = graphOrId;
|
|
582
538
|
const id = idOrRelation;
|
|
583
|
-
invariant2(relation2 !== void 0, "Relation is required.", {
|
|
584
|
-
F: __dxlog_file2,
|
|
585
|
-
L: 755,
|
|
586
|
-
S: this,
|
|
587
|
-
A: [
|
|
588
|
-
"relation !== undefined",
|
|
589
|
-
"'Relation is required.'"
|
|
590
|
-
]
|
|
591
|
-
});
|
|
539
|
+
invariant2(relation2 !== void 0, "Relation is required.", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 490, S: this, A: ["relation !== undefined", "'Relation is required.'"] });
|
|
592
540
|
const rel = relation2;
|
|
593
541
|
return expandImpl(graph, id, rel);
|
|
594
542
|
}
|
|
@@ -657,24 +605,14 @@ var addNodeImpl = (graph, nodeArg) => {
|
|
|
657
605
|
typeChanged,
|
|
658
606
|
dataChanged,
|
|
659
607
|
propertiesChanged
|
|
660
|
-
}, {
|
|
661
|
-
F: __dxlog_file2,
|
|
662
|
-
L: 877,
|
|
663
|
-
S: void 0,
|
|
664
|
-
C: (f, a) => f(...a)
|
|
665
|
-
});
|
|
608
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 565, S: void 0 });
|
|
666
609
|
if (typeChanged || dataChanged || propertiesChanged) {
|
|
667
610
|
log("updating node", {
|
|
668
611
|
id,
|
|
669
612
|
type,
|
|
670
613
|
data,
|
|
671
614
|
properties
|
|
672
|
-
}, {
|
|
673
|
-
F: __dxlog_file2,
|
|
674
|
-
L: 884,
|
|
675
|
-
S: void 0,
|
|
676
|
-
C: (f, a) => f(...a)
|
|
677
|
-
});
|
|
615
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 572, S: void 0 });
|
|
678
616
|
const newNode = Option.some({
|
|
679
617
|
...existing,
|
|
680
618
|
...rest,
|
|
@@ -698,12 +636,7 @@ var addNodeImpl = (graph, nodeArg) => {
|
|
|
698
636
|
type,
|
|
699
637
|
data,
|
|
700
638
|
properties
|
|
701
|
-
}, {
|
|
702
|
-
F: __dxlog_file2,
|
|
703
|
-
L: 897,
|
|
704
|
-
S: void 0,
|
|
705
|
-
C: (f, a) => f(...a)
|
|
706
|
-
});
|
|
639
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 596, S: void 0 });
|
|
707
640
|
const newNode = internal._constructNode({
|
|
708
641
|
id,
|
|
709
642
|
type,
|
|
@@ -844,12 +777,7 @@ var addEdgeImpl = (graph, edgeArg) => {
|
|
|
844
777
|
source: edgeArg.source,
|
|
845
778
|
target: edgeArg.target,
|
|
846
779
|
relation: relationId
|
|
847
|
-
}, {
|
|
848
|
-
F: __dxlog_file2,
|
|
849
|
-
L: 1080,
|
|
850
|
-
S: void 0,
|
|
851
|
-
C: (f, a) => f(...a)
|
|
852
|
-
});
|
|
780
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 758, S: void 0 });
|
|
853
781
|
internal._registry.set(sourceAtom, {
|
|
854
782
|
...source,
|
|
855
783
|
[relationId]: [
|
|
@@ -866,12 +794,7 @@ var addEdgeImpl = (graph, edgeArg) => {
|
|
|
866
794
|
source: edgeArg.source,
|
|
867
795
|
target: edgeArg.target,
|
|
868
796
|
relation: inverseId
|
|
869
|
-
}, {
|
|
870
|
-
F: __dxlog_file2,
|
|
871
|
-
L: 1088,
|
|
872
|
-
S: void 0,
|
|
873
|
-
C: (f, a) => f(...a)
|
|
874
|
-
});
|
|
797
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 775, S: void 0 });
|
|
875
798
|
internal._registry.set(targetAtom, {
|
|
876
799
|
...target,
|
|
877
800
|
[inverseId]: [
|
|
@@ -971,39 +894,15 @@ var relationKey = (relation2) => {
|
|
|
971
894
|
};
|
|
972
895
|
var relationFromKey = (encoded) => {
|
|
973
896
|
const parts = secondaryParts(encoded);
|
|
974
|
-
invariant2(parts.length === 2 && parts[0].length > 0 && parts[1].length > 0, `Invalid relation key: ${encoded}`, {
|
|
975
|
-
F: __dxlog_file2,
|
|
976
|
-
L: 1233,
|
|
977
|
-
S: void 0,
|
|
978
|
-
A: [
|
|
979
|
-
"parts.length === 2 && parts[0].length > 0 && parts[1].length > 0",
|
|
980
|
-
"`Invalid relation key: ${encoded}`"
|
|
981
|
-
]
|
|
982
|
-
});
|
|
897
|
+
invariant2(parts.length === 2 && parts[0].length > 0 && parts[1].length > 0, `Invalid relation key: ${encoded}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 894, S: void 0, A: ["parts.length === 2 && parts[0].length > 0 && parts[1].length > 0", "`Invalid relation key: ${encoded}`"] });
|
|
983
898
|
const [kind, directionRaw] = parts;
|
|
984
|
-
invariant2(directionRaw === "outbound" || directionRaw === "inbound", `Invalid relation direction: ${directionRaw}`, {
|
|
985
|
-
F: __dxlog_file2,
|
|
986
|
-
L: 1235,
|
|
987
|
-
S: void 0,
|
|
988
|
-
A: [
|
|
989
|
-
"directionRaw === 'outbound' || directionRaw === 'inbound'",
|
|
990
|
-
"`Invalid relation direction: ${directionRaw}`"
|
|
991
|
-
]
|
|
992
|
-
});
|
|
899
|
+
invariant2(directionRaw === "outbound" || directionRaw === "inbound", `Invalid relation direction: ${directionRaw}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 896, S: void 0, A: ["directionRaw === 'outbound' || directionRaw === 'inbound'", "`Invalid relation direction: ${directionRaw}`"] });
|
|
993
900
|
return relation(kind, directionRaw);
|
|
994
901
|
};
|
|
995
902
|
var connectionKey = (id, relation2) => primaryKey(id, relationKey(relation2));
|
|
996
903
|
var relationFromConnectionKey = (key) => {
|
|
997
904
|
const [id, encodedRelation] = primaryParts(key);
|
|
998
|
-
invariant2(id && encodedRelation, `Invalid connection key: ${key}`, {
|
|
999
|
-
F: __dxlog_file2,
|
|
1000
|
-
L: 1243,
|
|
1001
|
-
S: void 0,
|
|
1002
|
-
A: [
|
|
1003
|
-
"id && encodedRelation",
|
|
1004
|
-
"`Invalid connection key: ${key}`"
|
|
1005
|
-
]
|
|
1006
|
-
});
|
|
905
|
+
invariant2(id && encodedRelation, `Invalid connection key: ${key}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 902, S: void 0, A: ["id && encodedRelation", "`Invalid connection key: ${key}`"] });
|
|
1007
906
|
return {
|
|
1008
907
|
id,
|
|
1009
908
|
relation: relationFromKey(encodedRelation)
|
|
@@ -1085,9 +984,9 @@ import * as Function2 from "effect/Function";
|
|
|
1085
984
|
import * as Option3 from "effect/Option";
|
|
1086
985
|
import * as Pipeable2 from "effect/Pipeable";
|
|
1087
986
|
import * as Record2 from "effect/Record";
|
|
1088
|
-
import { scheduleTask, yieldOrContinue } from "main-thread-scheduling";
|
|
1089
987
|
import { log as log2 } from "@dxos/log";
|
|
1090
988
|
import { byPosition, getDebugName, isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
989
|
+
import { scheduleTask, yieldOrContinue } from "#scheduler";
|
|
1091
990
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/sdk/app-graph/src/graph-builder.ts";
|
|
1092
991
|
var GraphBuilderTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-graph/GraphBuilder");
|
|
1093
992
|
var GraphBuilderImpl = class {
|
|
@@ -1102,6 +1001,8 @@ var GraphBuilderImpl = class {
|
|
|
1102
1001
|
_dirtyConnectors = /* @__PURE__ */ new Map();
|
|
1103
1002
|
/** Last-flushed node IDs per connector key, used for edge removal on update. */
|
|
1104
1003
|
_connectorPrevious = /* @__PURE__ */ new Map();
|
|
1004
|
+
/** All inline-descendant IDs per connector key, used to remove stale inline nodes on update. */
|
|
1005
|
+
_connectorPreviousInlineIds = /* @__PURE__ */ new Map();
|
|
1105
1006
|
/** Last-flushed node args per connector key, used for change detection. */
|
|
1106
1007
|
_connectorPreviousArgs = /* @__PURE__ */ new Map();
|
|
1107
1008
|
/** Whether a dirty-flush task is already scheduled. */
|
|
@@ -1140,6 +1041,11 @@ var GraphBuilderImpl = class {
|
|
|
1140
1041
|
const removed = previous.filter((pid) => !ids.includes(pid));
|
|
1141
1042
|
this._connectorPrevious.set(key, ids);
|
|
1142
1043
|
this._connectorPreviousArgs.set(key, nodes);
|
|
1044
|
+
const currentInlineIds = collectAllInlineIds(nodes);
|
|
1045
|
+
const previousInlineIds = this._connectorPreviousInlineIds.get(key) ?? [];
|
|
1046
|
+
const staleInlineIds = previousInlineIds.filter((pid) => !currentInlineIds.includes(pid));
|
|
1047
|
+
this._connectorPreviousInlineIds.set(key, currentInlineIds);
|
|
1048
|
+
removeNodes(this._graph, staleInlineIds, true);
|
|
1143
1049
|
removeEdges(this._graph, removed.map((target) => ({
|
|
1144
1050
|
source: id,
|
|
1145
1051
|
target,
|
|
@@ -1206,12 +1112,7 @@ var GraphBuilderImpl = class {
|
|
|
1206
1112
|
id,
|
|
1207
1113
|
relation: relation2,
|
|
1208
1114
|
registry: getDebugName(this._registry)
|
|
1209
|
-
}, {
|
|
1210
|
-
F: __dxlog_file3,
|
|
1211
|
-
L: 269,
|
|
1212
|
-
S: this,
|
|
1213
|
-
C: (f, a) => f(...a)
|
|
1214
|
-
});
|
|
1115
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 136, S: this });
|
|
1215
1116
|
this._expandRelation(id, relation2);
|
|
1216
1117
|
if (relation2.kind === "child" && relation2.direction === "outbound") {
|
|
1217
1118
|
expand(this._graph, id, "action");
|
|
@@ -1234,12 +1135,7 @@ var GraphBuilderImpl = class {
|
|
|
1234
1135
|
id,
|
|
1235
1136
|
relation: relation2,
|
|
1236
1137
|
ids
|
|
1237
|
-
}, {
|
|
1238
|
-
F: __dxlog_file3,
|
|
1239
|
-
L: 296,
|
|
1240
|
-
S: this,
|
|
1241
|
-
C: (f, a) => f(...a)
|
|
1242
|
-
});
|
|
1138
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 160, S: this });
|
|
1243
1139
|
this._dirtyConnectors.set(key, {
|
|
1244
1140
|
nodes,
|
|
1245
1141
|
previous
|
|
@@ -1253,12 +1149,7 @@ var GraphBuilderImpl = class {
|
|
|
1253
1149
|
async _onInitialize(id) {
|
|
1254
1150
|
log2("onInitialize", {
|
|
1255
1151
|
id
|
|
1256
|
-
}, {
|
|
1257
|
-
F: __dxlog_file3,
|
|
1258
|
-
L: 307,
|
|
1259
|
-
S: this,
|
|
1260
|
-
C: (f, a) => f(...a)
|
|
1261
|
-
});
|
|
1152
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 176, S: this });
|
|
1262
1153
|
const resolver = this._resolvers(id);
|
|
1263
1154
|
const cancel = this._registry.subscribe(resolver, (node) => {
|
|
1264
1155
|
const trigger = this._initialized[id];
|
|
@@ -1441,12 +1332,7 @@ var createExtensionRaw = (extension) => {
|
|
|
1441
1332
|
id: getId("connector"),
|
|
1442
1333
|
node,
|
|
1443
1334
|
error
|
|
1444
|
-
}, {
|
|
1445
|
-
F: __dxlog_file3,
|
|
1446
|
-
L: 609,
|
|
1447
|
-
S: void 0,
|
|
1448
|
-
C: (f, a) => f(...a)
|
|
1449
|
-
});
|
|
1335
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 383, S: void 0 });
|
|
1450
1336
|
return [];
|
|
1451
1337
|
}
|
|
1452
1338
|
}).pipe(Atom2.withLabel(`graph-builder:connector:${id}`)))
|
|
@@ -1467,12 +1353,7 @@ var createExtensionRaw = (extension) => {
|
|
|
1467
1353
|
id: getId("actionGroups"),
|
|
1468
1354
|
node,
|
|
1469
1355
|
error
|
|
1470
|
-
}, {
|
|
1471
|
-
F: __dxlog_file3,
|
|
1472
|
-
L: 630,
|
|
1473
|
-
S: void 0,
|
|
1474
|
-
C: (f, a) => f(...a)
|
|
1475
|
-
});
|
|
1356
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 404, S: void 0 });
|
|
1476
1357
|
return [];
|
|
1477
1358
|
}
|
|
1478
1359
|
}).pipe(Atom2.withLabel(`graph-builder:connector:actionGroups:${id}`)))
|
|
@@ -1492,12 +1373,7 @@ var createExtensionRaw = (extension) => {
|
|
|
1492
1373
|
id: getId("actions"),
|
|
1493
1374
|
node,
|
|
1494
1375
|
error
|
|
1495
|
-
}, {
|
|
1496
|
-
F: __dxlog_file3,
|
|
1497
|
-
L: 647,
|
|
1498
|
-
S: void 0,
|
|
1499
|
-
C: (f, a) => f(...a)
|
|
1500
|
-
});
|
|
1376
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 424, S: void 0 });
|
|
1501
1377
|
return [];
|
|
1502
1378
|
}
|
|
1503
1379
|
}).pipe(Atom2.withLabel(`graph-builder:connector:actions:${id}`)))
|
|
@@ -1509,12 +1385,7 @@ var runEffectSyncWithFallback = (effect, context2, extensionId, fallback) => {
|
|
|
1509
1385
|
log2.warn("Extension failed", {
|
|
1510
1386
|
extension: extensionId,
|
|
1511
1387
|
error
|
|
1512
|
-
}, {
|
|
1513
|
-
F: __dxlog_file3,
|
|
1514
|
-
L: 690,
|
|
1515
|
-
S: void 0,
|
|
1516
|
-
C: (f, a) => f(...a)
|
|
1517
|
-
});
|
|
1388
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 441, S: void 0 });
|
|
1518
1389
|
return Effect.succeed(fallback);
|
|
1519
1390
|
})));
|
|
1520
1391
|
};
|
|
@@ -1562,6 +1433,10 @@ var qualifyNodeArgs = (parentId) => (nodes) => nodes.map((node) => {
|
|
|
1562
1433
|
nodes: node.nodes ? qualifyNodeArgs(qualified)(node.nodes) : void 0
|
|
1563
1434
|
};
|
|
1564
1435
|
});
|
|
1436
|
+
var collectAllInlineIds = (nodes) => nodes.flatMap((node) => node.nodes ? [
|
|
1437
|
+
...node.nodes.map((child) => child.id),
|
|
1438
|
+
...collectAllInlineIds(node.nodes)
|
|
1439
|
+
] : []);
|
|
1565
1440
|
var connectorKey = (id, relation2) => primaryKey(id, relationKey(relation2));
|
|
1566
1441
|
var relationFromConnectorKey = (key) => {
|
|
1567
1442
|
const [id, encodedRelation] = primaryParts(key);
|
|
@@ -1586,7 +1461,6 @@ var flattenExtensions = (extension, acc = []) => {
|
|
|
1586
1461
|
};
|
|
1587
1462
|
|
|
1588
1463
|
export {
|
|
1589
|
-
__export,
|
|
1590
1464
|
node_exports,
|
|
1591
1465
|
qualifyId,
|
|
1592
1466
|
getParentId,
|
|
@@ -1600,4 +1474,4 @@ export {
|
|
|
1600
1474
|
flush,
|
|
1601
1475
|
graph_builder_exports
|
|
1602
1476
|
};
|
|
1603
|
-
//# sourceMappingURL=chunk-
|
|
1477
|
+
//# sourceMappingURL=chunk-WJJ5KEOH.mjs.map
|