@dxos/app-graph 0.8.3 → 0.8.4-main.1c7ec43d41
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/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WJJ5KEOH.mjs +1477 -0
- package/dist/lib/neutral/chunk-WJJ5KEOH.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +40 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- 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/neutral/testing/index.mjs +40 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/atoms.d.ts +8 -0
- package/dist/types/src/atoms.d.ts.map +1 -0
- package/dist/types/src/graph-builder.d.ts +117 -60
- package/dist/types/src/graph-builder.d.ts.map +1 -1
- package/dist/types/src/graph.d.ts +188 -218
- package/dist/types/src/graph.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +7 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/node-matcher.d.ts +244 -0
- package/dist/types/src/node-matcher.d.ts.map +1 -0
- package/dist/types/src/node-matcher.test.d.ts +2 -0
- package/dist/types/src/node-matcher.test.d.ts.map +1 -0
- package/dist/types/src/node.d.ts +50 -5
- 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 +6 -13
- package/dist/types/src/stories/EchoGraph.stories.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/setup-graph-builder.d.ts +31 -0
- package/dist/types/src/testing/setup-graph-builder.d.ts.map +1 -0
- package/dist/types/src/util.d.ts +40 -0
- package/dist/types/src/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +53 -42
- package/src/atoms.ts +25 -0
- package/src/graph-builder.test.ts +1193 -126
- package/src/graph-builder.ts +753 -264
- package/src/graph.test.ts +451 -123
- package/src/graph.ts +1057 -407
- package/src/index.ts +10 -3
- package/src/node-matcher.test.ts +301 -0
- package/src/node-matcher.ts +314 -0
- package/src/node.ts +83 -7
- package/src/scheduler.browser.ts +5 -0
- package/src/scheduler.ts +17 -0
- package/src/stories/EchoGraph.stories.tsx +178 -255
- package/src/stories/Tree.tsx +1 -1
- package/src/testing/index.ts +5 -0
- package/src/testing/setup-graph-builder.ts +41 -0
- package/src/util.ts +101 -0
- package/dist/lib/browser/index.mjs +0 -778
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node/index.cjs +0 -816
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -780
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/types/src/experimental/graph-projections.test.d.ts +0 -25
- package/dist/types/src/experimental/graph-projections.test.d.ts.map +0 -1
- package/dist/types/src/signals-integration.test.d.ts +0 -2
- package/dist/types/src/signals-integration.test.d.ts.map +0 -1
- package/dist/types/src/testing.d.ts +0 -5
- package/dist/types/src/testing.d.ts.map +0 -1
- package/src/experimental/graph-projections.test.ts +0 -56
- package/src/signals-integration.test.ts +0 -218
- package/src/testing.ts +0 -20
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import * as Option from 'effect/Option';
|
|
2
|
+
import type * as Schema from 'effect/Schema';
|
|
3
|
+
import { type Entity, Obj, type Type } from '@dxos/echo';
|
|
4
|
+
import * as Node from './node';
|
|
5
|
+
/**
|
|
6
|
+
* Type for a node matcher function that returns an Option of the matched data.
|
|
7
|
+
* Matchers are used to filter and transform nodes in the app graph.
|
|
8
|
+
*
|
|
9
|
+
* @template TData - The type of data returned when the matcher succeeds.
|
|
10
|
+
* Defaults to Node.Node, but can be a more specific type (e.g., an ECHO entity).
|
|
11
|
+
*/
|
|
12
|
+
export type NodeMatcher<TData = Node.Node> = (node: Node.Node) => Option.Option<TData>;
|
|
13
|
+
/**
|
|
14
|
+
* Matches the root node of the graph.
|
|
15
|
+
*
|
|
16
|
+
* @returns Option.some(node) if the node is the root, Option.none() otherwise.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* GraphBuilder.createExtension({
|
|
21
|
+
* id: 'my-extension',
|
|
22
|
+
* match: NodeMatcher.whenRoot,
|
|
23
|
+
* connector: (node) => Effect.succeed([...]),
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const whenRoot: (node: Node.Node) => Option.Option<Node.Node>;
|
|
28
|
+
/**
|
|
29
|
+
* Matches a node by its exact ID.
|
|
30
|
+
*
|
|
31
|
+
* @param id - The node ID to match against.
|
|
32
|
+
* @returns A matcher that returns Option.some(node) if IDs match, Option.none() otherwise.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* GraphBuilder.createExtension({
|
|
37
|
+
* id: 'spaces-extension',
|
|
38
|
+
* match: NodeMatcher.whenId('spaces'),
|
|
39
|
+
* connector: (node) => Effect.succeed([...]),
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const whenId: (id: string) => (node: Node.Node) => Option.Option<Node.Node>;
|
|
44
|
+
/**
|
|
45
|
+
* Matches a node by its type string (the `node.type` property).
|
|
46
|
+
*
|
|
47
|
+
* @param type - The node type string to match against.
|
|
48
|
+
* @returns A matcher that returns Option.some(node) if types match, Option.none() otherwise.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* GraphBuilder.createExtension({
|
|
53
|
+
* id: 'space-settings-extension',
|
|
54
|
+
* match: NodeMatcher.whenNodeType('org.dxos.plugin.space.settings'),
|
|
55
|
+
* connector: (node) => Effect.succeed([...]),
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare const whenNodeType: (type: string) => (node: Node.Node) => Option.Option<Node.Node>;
|
|
60
|
+
/**
|
|
61
|
+
* Matches a node whose data is an instance of the given ECHO schema type.
|
|
62
|
+
* Returns the **typed entity data** (not the node) for direct use in callbacks.
|
|
63
|
+
*
|
|
64
|
+
* Use this when you need to work directly with the typed ECHO entity in your
|
|
65
|
+
* connector or actions callback.
|
|
66
|
+
*
|
|
67
|
+
* @template T - The ECHO schema type to match against.
|
|
68
|
+
* @param type - The ECHO schema (e.g., `Collection.Collection`, `Document.Document`).
|
|
69
|
+
* @returns A matcher that returns Option.some(entity) if the data matches, Option.none() otherwise.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* GraphBuilder.createExtension({
|
|
74
|
+
* id: 'collection-extension',
|
|
75
|
+
* match: NodeMatcher.whenEchoType(Collection.Collection),
|
|
76
|
+
* connector: (collection) => {
|
|
77
|
+
* // `collection` is typed as Collection.Collection
|
|
78
|
+
* return Effect.succeed(collection.objects.map(...));
|
|
79
|
+
* },
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* Can be composed directly with {@link whenAll}/{@link whenAny}/{@link whenNot} while
|
|
84
|
+
* preserving the typed entity data in the result.
|
|
85
|
+
*
|
|
86
|
+
* @see {@link whenEchoTypeMatches} - Returns the node instead of data for legacy composition.
|
|
87
|
+
*/
|
|
88
|
+
export declare const whenEchoType: <T extends Type.AnyEntity>(type: T) => NodeMatcher<Entity.Entity<Schema.Schema.Type<T>>>;
|
|
89
|
+
/**
|
|
90
|
+
* Matches a node whose data is any ECHO object.
|
|
91
|
+
* Returns the **object data** (not the node) for direct use in callbacks.
|
|
92
|
+
*
|
|
93
|
+
* Use this when you need to work with any ECHO object regardless of its specific type.
|
|
94
|
+
*
|
|
95
|
+
* @returns Option.some(object) if the node's data is an ECHO object, Option.none() otherwise.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* GraphBuilder.createExtension({
|
|
100
|
+
* id: 'object-properties',
|
|
101
|
+
* match: NodeMatcher.whenEchoObject,
|
|
102
|
+
* connector: (object) => {
|
|
103
|
+
* // `object` is typed as Obj.Unknown
|
|
104
|
+
* const id = Obj.getDXN(object).toString();
|
|
105
|
+
* return Effect.succeed([{ id: `${id}.settings`, ... }]);
|
|
106
|
+
* },
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* Can be composed directly with {@link whenAll}/{@link whenAny}/{@link whenNot} while
|
|
111
|
+
* preserving the `Obj.Unknown` data type in the result.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link whenEchoObjectMatches} - Returns the node instead of data for legacy composition.
|
|
114
|
+
*/
|
|
115
|
+
export declare const whenEchoObject: (node: Node.Node) => Option.Option<Obj.Unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* Composes multiple matchers with AND logic - all matchers must match for success.
|
|
118
|
+
* The result data type is the intersection of all matchers' data types.
|
|
119
|
+
* Filter matchers like {@link whenNot} return `unknown`, making them transparent
|
|
120
|
+
* in the intersection (since `T & unknown = T`).
|
|
121
|
+
*
|
|
122
|
+
* @param matchers - The matchers to combine. All must return Option.some for success.
|
|
123
|
+
* @returns A matcher whose data type is the intersection of all input matchers' data types.
|
|
124
|
+
* Returns the first matcher's value when all match, Option.none() otherwise.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* // Match ECHO objects that are NOT Channels — result is NodeMatcher<Obj.Unknown>.
|
|
129
|
+
* const whenCommentable = NodeMatcher.whenAll(
|
|
130
|
+
* NodeMatcher.whenEchoObject,
|
|
131
|
+
* NodeMatcher.whenNot(NodeMatcher.whenEchoTypeMatches(Channel.Channel)),
|
|
132
|
+
* );
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare const whenAll: {
|
|
136
|
+
<A>(a: NodeMatcher<A>, b: NodeMatcher<unknown>): NodeMatcher<A>;
|
|
137
|
+
<A>(a: NodeMatcher<unknown>, b: NodeMatcher<A>): NodeMatcher<A>;
|
|
138
|
+
<A, B>(a: NodeMatcher<A>, b: NodeMatcher<B>): NodeMatcher<A & B>;
|
|
139
|
+
<A, B, C>(a: NodeMatcher<A>, b: NodeMatcher<B>, c: NodeMatcher<C>): NodeMatcher<A & B & C>;
|
|
140
|
+
<A, B, C, D>(a: NodeMatcher<A>, b: NodeMatcher<B>, c: NodeMatcher<C>, d: NodeMatcher<D>): NodeMatcher<A & B & C & D>;
|
|
141
|
+
(...matchers: NodeMatcher<any>[]): NodeMatcher<any>;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Composes multiple matchers with OR logic - at least one matcher must match.
|
|
145
|
+
* The result data type is the union of all matchers' data types.
|
|
146
|
+
*
|
|
147
|
+
* @param matchers - The matchers to combine. At least one must return Option.some.
|
|
148
|
+
* @returns A matcher whose data type is the union of all input matchers' data types.
|
|
149
|
+
* Returns the first matching matcher's value, or Option.none() if none match.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* // Match nodes that are either Sequences or Routines
|
|
154
|
+
* const whenInvocable = NodeMatcher.whenAny(
|
|
155
|
+
* NodeMatcher.whenEchoTypeMatches(Sequence),
|
|
156
|
+
* NodeMatcher.whenEchoTypeMatches(Routine.Routine),
|
|
157
|
+
* );
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare const whenAny: {
|
|
161
|
+
<A, B>(a: NodeMatcher<A>, b: NodeMatcher<B>): NodeMatcher<A | B>;
|
|
162
|
+
<A, B, C>(a: NodeMatcher<A>, b: NodeMatcher<B>, c: NodeMatcher<C>): NodeMatcher<A | B | C>;
|
|
163
|
+
<A, B, C, D>(a: NodeMatcher<A>, b: NodeMatcher<B>, c: NodeMatcher<C>, d: NodeMatcher<D>): NodeMatcher<A | B | C | D>;
|
|
164
|
+
(...matchers: NodeMatcher<any>[]): NodeMatcher<any>;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Matches a node whose data is an instance of the given ECHO schema type.
|
|
168
|
+
* Returns the **node** (not the data) to enable composition with whenAll/whenAny/whenNot.
|
|
169
|
+
*
|
|
170
|
+
* Use this instead of {@link whenEchoType} when you need to combine matchers.
|
|
171
|
+
* The difference is what's returned:
|
|
172
|
+
* - `whenEchoType` returns the typed entity (for direct use)
|
|
173
|
+
* - `whenEchoTypeMatches` returns the node (for composition)
|
|
174
|
+
*
|
|
175
|
+
* @template T - The ECHO schema type to match against.
|
|
176
|
+
* @param type - The ECHO schema (e.g., `Channel.Channel`, `Document.Document`).
|
|
177
|
+
* @returns A matcher that returns Option.some(node) if the data matches, Option.none() otherwise.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* // Use with whenAny for OR logic
|
|
182
|
+
* const whenPresentable = NodeMatcher.whenAny(
|
|
183
|
+
* NodeMatcher.whenEchoTypeMatches(Collection.Collection),
|
|
184
|
+
* NodeMatcher.whenEchoTypeMatches(Markdown.Document),
|
|
185
|
+
* );
|
|
186
|
+
*
|
|
187
|
+
* // Use with whenNot for exclusion
|
|
188
|
+
* const whenNotChannel = NodeMatcher.whenNot(
|
|
189
|
+
* NodeMatcher.whenEchoTypeMatches(Channel.Channel),
|
|
190
|
+
* );
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @see {@link whenEchoType} - Use instead when you need the typed entity directly.
|
|
194
|
+
*/
|
|
195
|
+
export declare const whenEchoTypeMatches: <T extends Type.AnyEntity>(type: T) => NodeMatcher;
|
|
196
|
+
/**
|
|
197
|
+
* Matches a node whose data is any ECHO object.
|
|
198
|
+
* Returns the **node** (not the data) to enable composition with whenAll/whenAny/whenNot.
|
|
199
|
+
*
|
|
200
|
+
* Use this instead of {@link whenEchoObject} when you need to combine matchers.
|
|
201
|
+
* The difference is what's returned:
|
|
202
|
+
* - `whenEchoObject` returns the object data (for direct use)
|
|
203
|
+
* - `whenEchoObjectMatches` returns the node (for composition)
|
|
204
|
+
*
|
|
205
|
+
* @returns Option.some(node) if the node's data is an ECHO object, Option.none() otherwise.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```ts
|
|
209
|
+
* // Match ECHO objects that are not system types
|
|
210
|
+
* const whenUserObject = NodeMatcher.whenAll(
|
|
211
|
+
* NodeMatcher.whenEchoObjectMatches,
|
|
212
|
+
* NodeMatcher.whenNot(NodeMatcher.whenEchoTypeMatches(SystemType)),
|
|
213
|
+
* );
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* @see {@link whenEchoObject} - Use instead when you need the object data directly.
|
|
217
|
+
*/
|
|
218
|
+
export declare const whenEchoObjectMatches: (node: Node.Node) => Option.Option<Node.Node>;
|
|
219
|
+
/**
|
|
220
|
+
* Negates a matcher - matches when the given matcher does NOT match.
|
|
221
|
+
* Useful for exclusion patterns like "any object EXCEPT type X".
|
|
222
|
+
*
|
|
223
|
+
* Returns `NodeMatcher<unknown>` because negation is a filter — it doesn't provide
|
|
224
|
+
* typed data. This makes it transparent in {@link whenAll} intersections
|
|
225
|
+
* (since `T & unknown = T`).
|
|
226
|
+
*
|
|
227
|
+
* @param matcher - The matcher to negate.
|
|
228
|
+
* @returns A matcher that returns Option.some(node) if the input matcher returns none,
|
|
229
|
+
* and Option.none() if the input matcher returns some.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* // Match any ECHO object that is NOT a Channel — result is NodeMatcher<Obj.Unknown>.
|
|
234
|
+
* const whenCommentable = NodeMatcher.whenAll(
|
|
235
|
+
* NodeMatcher.whenEchoObject,
|
|
236
|
+
* NodeMatcher.whenNot(NodeMatcher.whenEchoTypeMatches(Channel.Channel)),
|
|
237
|
+
* );
|
|
238
|
+
*
|
|
239
|
+
* // Match any node that is NOT the root
|
|
240
|
+
* const whenNotRoot = NodeMatcher.whenNot(NodeMatcher.whenRoot);
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export declare const whenNot: (matcher: NodeMatcher<any>) => NodeMatcher<unknown>;
|
|
244
|
+
//# sourceMappingURL=node-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-matcher.d.ts","sourceRoot":"","sources":["../../../src/node-matcher.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAMvF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,SAAU,IAAI,CAAC,IAAI,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CACL,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,OACZ,MAAM,YACJ,IAAI,CAAC,IAAI,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CACU,CAAC;AAEvD;;;;;;;;;;;;;;GAcG;AACH,eAAO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;CAWnD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,mBAAmB,GAC7B,CAAC,SAAS,IAAI,CAAC,SAAS,QAAQ,CAAC,KAAG,WAEgC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,qBAAqB,SAAU,IAAI,CAAC,IAAI,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAClB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,OAAO,YACR,WAAW,CAAC,GAAG,CAAC,KAAG,WAAW,CAAC,OAAO,CAEkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-matcher.test.d.ts","sourceRoot":"","sources":["../../../src/node-matcher.test.ts"],"names":[],"mappings":""}
|
package/dist/types/src/node.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as Context from 'effect/Context';
|
|
2
|
+
import type * as Effect from 'effect/Effect';
|
|
3
|
+
import { type MakeOptional } from '@dxos/util';
|
|
4
|
+
/**
|
|
5
|
+
* Root node ID.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RootId = "root";
|
|
8
|
+
/**
|
|
9
|
+
* Root node type.
|
|
10
|
+
*/
|
|
11
|
+
export declare const RootType = "org.dxos.type.graphRoot";
|
|
12
|
+
/**
|
|
13
|
+
* Action node type.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ActionType = "org.dxos.type.graphAction";
|
|
16
|
+
/**
|
|
17
|
+
* Action group node type.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ActionGroupType = "org.dxos.type.graphActionGroup";
|
|
2
20
|
/**
|
|
3
21
|
* Represents a node in the graph.
|
|
4
22
|
*/
|
|
@@ -27,22 +45,43 @@ export type Node<TData = any, TProperties extends Record<string, any> = Record<s
|
|
|
27
45
|
data: TData;
|
|
28
46
|
}>;
|
|
29
47
|
export type NodeFilter<TData = any, TProperties extends Record<string, any> = Record<string, any>> = (node: Node<unknown, Record<string, any>>, connectedNode: Node) => node is Node<TData, TProperties>;
|
|
30
|
-
export type
|
|
48
|
+
export type RelationDirection = 'outbound' | 'inbound';
|
|
49
|
+
export type Relation = Readonly<{
|
|
50
|
+
kind: string;
|
|
51
|
+
direction: RelationDirection;
|
|
52
|
+
}>;
|
|
53
|
+
export type RelationInput = Relation | string;
|
|
54
|
+
export declare const relation: (kind: string, direction?: RelationDirection) => Relation;
|
|
55
|
+
export declare const childRelation: (direction?: RelationDirection) => Relation;
|
|
56
|
+
export declare const actionRelation: (direction?: RelationDirection) => Relation;
|
|
31
57
|
export declare const isGraphNode: (data: unknown) => data is Node;
|
|
32
58
|
export type NodeArg<TData, TProperties extends Record<string, any> = Record<string, any>> = MakeOptional<Node<TData, TProperties>, 'data' | 'properties' | 'cacheable'> & {
|
|
33
59
|
/** Will automatically add nodes with an edge from this node to each. */
|
|
34
60
|
nodes?: NodeArg<unknown>[];
|
|
35
61
|
/** Will automatically add specified edges. */
|
|
36
|
-
edges?: [string,
|
|
62
|
+
edges?: [string, RelationInput][];
|
|
37
63
|
};
|
|
38
|
-
export type
|
|
64
|
+
export type InvokeProps = {
|
|
39
65
|
/** Node the invoked action is connected to. */
|
|
40
66
|
parent?: Node;
|
|
67
|
+
/** Path from root to the node in the current tree context. */
|
|
68
|
+
path?: string[];
|
|
41
69
|
caller?: string;
|
|
42
70
|
};
|
|
43
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Action data is an Effect-returning function.
|
|
73
|
+
* The Effect is provided with captured context at execution time.
|
|
74
|
+
*/
|
|
75
|
+
export type ActionData<R = never> = (params?: InvokeProps) => Effect.Effect<any, Error, R>;
|
|
76
|
+
/**
|
|
77
|
+
* Context captured at extension creation time.
|
|
78
|
+
* Automatically provided to action Effects at execution.
|
|
79
|
+
*/
|
|
80
|
+
export type ActionContext = Context.Context<any>;
|
|
44
81
|
export type Action<TProperties extends Record<string, any> = Record<string, any>> = Readonly<Omit<Node<ActionData, TProperties>, 'properties'> & {
|
|
45
82
|
properties: Readonly<TProperties>;
|
|
83
|
+
/** Captured context from extension creation. Provided automatically at action execution. */
|
|
84
|
+
_actionContext?: ActionContext;
|
|
46
85
|
}>;
|
|
47
86
|
export declare const isAction: (data: unknown) => data is Action;
|
|
48
87
|
export declare const actionGroupSymbol: unique symbol;
|
|
@@ -52,4 +91,10 @@ export type ActionGroup<TProperties extends Record<string, any> = Record<string,
|
|
|
52
91
|
export declare const isActionGroup: (data: unknown) => data is ActionGroup;
|
|
53
92
|
export type ActionLike = Action | ActionGroup;
|
|
54
93
|
export declare const isActionLike: (data: unknown) => data is Action | ActionGroup;
|
|
94
|
+
/** Typed factory for constructing a NodeArg. Provides auto-complete and type validation. */
|
|
95
|
+
export declare const make: <TData = any, TProperties extends Record<string, any> = Record<string, any>>(arg: NodeArg<TData, TProperties>) => NodeArg<TData, TProperties>;
|
|
96
|
+
/** Create an action node. Automatically sets `type: ActionType`. */
|
|
97
|
+
export declare const makeAction: <R = never>(arg: Omit<NodeArg<ActionData<R>>, 'type' | 'nodes' | 'edges'>) => NodeArg<ActionData<R>>;
|
|
98
|
+
/** Create an action group node. Automatically sets `type` and `data`. */
|
|
99
|
+
export declare const makeActionGroup: (arg: Omit<NodeArg<typeof actionGroupSymbol>, 'type' | 'data' | 'nodes' | 'edges'>) => NodeArg<typeof actionGroupSymbol>;
|
|
55
100
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/node.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/node.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7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O,GAAG,OAAO,CAAC,KAC5D,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAGtB,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,eAAe,QACrB,IAAI,CAAC,OAAO,CAAC,OAAO,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,KAChF,OAAO,CAAC,OAAO,iBAAiB,CAIjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.browser.d.ts","sourceRoot":"","sources":["../../../src/scheduler.browser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type ScheduleOptions = {
|
|
2
|
+
strategy?: 'smooth' | 'interactive' | 'idle';
|
|
3
|
+
signal?: AbortSignal;
|
|
4
|
+
};
|
|
5
|
+
export declare const scheduleTask: <T>(callback: () => T | Promise<T>, _options?: ScheduleOptions) => Promise<T>;
|
|
6
|
+
export declare const yieldOrContinue: (_priority: 'smooth' | 'interactive' | 'idle') => Promise<void>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../src/scheduler.ts"],"names":[],"mappings":"AAOA,KAAK,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAE9F,eAAO,MAAM,YAAY,GAAU,CAAC,YAAY,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,aAAa,eAAe,KAAG,OAAO,CAAC,CAAC,CAG3G,CAAC;AAEF,eAAO,MAAM,eAAe,cAAqB,QAAQ,GAAG,aAAa,GAAG,MAAM,KAAG,OAAO,CAAC,IAAI,CAEhG,CAAC"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import '@
|
|
2
|
-
|
|
3
|
-
declare const _default: {
|
|
1
|
+
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
4
3
|
title: string;
|
|
5
4
|
decorators: import("@storybook/react").Decorator[];
|
|
6
5
|
};
|
|
7
|
-
export default
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare const TreeView: {
|
|
12
|
-
render: () => React.JSX.Element;
|
|
13
|
-
};
|
|
14
|
-
export declare const TabTreeView: {
|
|
15
|
-
render: () => React.JSX.Element;
|
|
16
|
-
};
|
|
6
|
+
export default meta;
|
|
7
|
+
type Story = StoryObj<typeof meta>;
|
|
8
|
+
export declare const JsonView: Story;
|
|
9
|
+
export declare const TreeView: Story;
|
|
17
10
|
//# sourceMappingURL=EchoGraph.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EchoGraph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/EchoGraph.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EchoGraph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/EchoGraph.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAoPjE,QAAA,MAAM,IAAI;;;CAaM,CAAC;eAEF,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KActB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAmItB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Registry } from '@effect-atom/atom-react';
|
|
2
|
+
import * as Graph from '../graph';
|
|
3
|
+
import * as GraphBuilder from '../graph-builder';
|
|
4
|
+
import * as Node from '../node';
|
|
5
|
+
export type SetupGraphBuilderOptions = {
|
|
6
|
+
registry?: Registry.Registry;
|
|
7
|
+
extensions?: GraphBuilder.BuilderExtensions;
|
|
8
|
+
};
|
|
9
|
+
export declare const setupGraphBuilder: ({ registry, extensions }?: SetupGraphBuilderOptions) => {
|
|
10
|
+
registry: Registry.Registry;
|
|
11
|
+
builder: GraphBuilder.GraphBuilder;
|
|
12
|
+
graph: Graph.ExpandableGraph;
|
|
13
|
+
addExtensions: (nextExtensions: GraphBuilder.BuilderExtensions) => void;
|
|
14
|
+
expand: (id: string, relation?: Node.RelationInput) => Promise<void>;
|
|
15
|
+
flush: () => Promise<void>;
|
|
16
|
+
getConnections: (id: string, relation?: Node.RelationInput) => Readonly<{
|
|
17
|
+
id: string;
|
|
18
|
+
type: string;
|
|
19
|
+
cacheable?: string[];
|
|
20
|
+
properties: Readonly<Record<string, any>>;
|
|
21
|
+
data: any;
|
|
22
|
+
}>[];
|
|
23
|
+
getNode: (id: string) => Readonly<{
|
|
24
|
+
id: string;
|
|
25
|
+
type: string;
|
|
26
|
+
cacheable?: string[];
|
|
27
|
+
properties: Readonly<Record<string, any>>;
|
|
28
|
+
data: any;
|
|
29
|
+
}> | null;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=setup-graph-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-graph-builder.d.ts","sourceRoot":"","sources":["../../../../src/testing/setup-graph-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,UAAU,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,iBAAiB,8BAAgD,wBAAwB;;;;oCAYlE,YAAY,CAAC,iBAAiB;iBAG3C,MAAM,aAAY,IAAI,CAAC,aAAa;;yBAKlC,MAAM,aAAY,IAAI,CAAC,aAAa;;;;;;;kBAE3C,MAAM;;;;;;;CAEvB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as Node from './node';
|
|
2
|
+
/** Join parts with the primary separator. */
|
|
3
|
+
export declare const primaryKey: (...parts: string[]) => string;
|
|
4
|
+
/** Split a key on the primary separator. */
|
|
5
|
+
export declare const primaryParts: (key: string) => string[];
|
|
6
|
+
/** Join parts with the secondary separator. */
|
|
7
|
+
export declare const secondaryKey: (...parts: string[]) => string;
|
|
8
|
+
/** Split a key on the secondary separator. */
|
|
9
|
+
export declare const secondaryParts: (key: string) => string[];
|
|
10
|
+
/**
|
|
11
|
+
* Normalize a relation input to a full Relation object.
|
|
12
|
+
*/
|
|
13
|
+
export declare const normalizeRelation: (relation?: Node.RelationInput) => Node.Relation;
|
|
14
|
+
/**
|
|
15
|
+
* Shallow-compare two values: same reference, or same own-keys with === values.
|
|
16
|
+
*/
|
|
17
|
+
export declare const shallowEqual: (a: unknown, b: unknown) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Returns true if two NodeArg arrays are semantically identical (same id, type, data, properties per index).
|
|
20
|
+
* Inline child nodes (the `nodes` field) are compared recursively.
|
|
21
|
+
*/
|
|
22
|
+
export declare const nodeArgsUnchanged: (prev: Node.NodeArg<any>[], next: Node.NodeArg<any>[]) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Build a qualified node ID by joining path segments.
|
|
25
|
+
*/
|
|
26
|
+
export declare const qualifyId: (parentId: string, ...segmentIds: string[]) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Validate that a segment ID does not contain the path separator.
|
|
29
|
+
*/
|
|
30
|
+
export declare const validateSegmentId: (id: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Extract the parent qualified ID (everything before the last path separator).
|
|
33
|
+
* Returns undefined for IDs with no parent (single segment).
|
|
34
|
+
*/
|
|
35
|
+
export declare const getParentId: (qualifiedId: string) => string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Extract the last segment of a qualified ID.
|
|
38
|
+
*/
|
|
39
|
+
export declare const getSegmentId: (qualifiedId: string) => string;
|
|
40
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAW/B,6CAA6C;AAC7C,eAAO,MAAM,UAAU,aAAc,MAAM,EAAE,KAAG,MAA6B,CAAC;AAE9E,4CAA4C;AAC5C,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,MAAM,EAAwB,CAAC;AAE1E,+CAA+C;AAC/C,eAAO,MAAM,YAAY,aAAc,MAAM,EAAE,KAAG,MAA+B,CAAC;AAElF,8CAA8C;AAC9C,eAAO,MAAM,cAAc,QAAS,MAAM,KAAG,MAAM,EAA0B,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,iBAAiB,cAAe,IAAI,CAAC,aAAa,KAAG,IAAI,CAAC,QACsC,CAAC;AAE9G;;GAEG;AACH,eAAO,MAAM,YAAY,MAAO,OAAO,KAAK,OAAO,KAAG,OAarD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAAU,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAG,OAexF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,aAAc,MAAM,iBAAiB,MAAM,EAAE,KAAG,MAA8C,CAAC;AAErH;;GAEG;AACH,eAAO,MAAM,iBAAiB,OAAQ,MAAM,KAAG,IAE9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,gBAAiB,MAAM,KAAG,MAAM,GAAG,SAG1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,gBAAiB,MAAM,KAAG,MAElD,CAAC"}
|