@dxos/app-graph 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731
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-32XXJE6M.mjs → chunk-7BYCDV55.mjs} +15 -8
- package/dist/lib/neutral/{chunk-32XXJE6M.mjs.map → chunk-7BYCDV55.mjs.map} +3 -3
- package/dist/lib/neutral/index.mjs +1 -1
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/testing/index.mjs +1 -1
- package/dist/types/src/graph-builder.d.ts +3 -4
- package/dist/types/src/graph-builder.d.ts.map +1 -1
- package/dist/types/src/node-matcher.d.ts +9 -10
- package/dist/types/src/node-matcher.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -23
- package/src/graph-builder.test.ts +22 -22
- package/src/graph-builder.ts +23 -8
- package/src/node-matcher.ts +12 -13
- package/src/stories/EchoGraph.stories.tsx +1 -1
|
@@ -928,11 +928,11 @@ __export(node_matcher_exports, {
|
|
|
928
928
|
whenRoot: () => whenRoot
|
|
929
929
|
});
|
|
930
930
|
import * as Option2 from "effect/Option";
|
|
931
|
-
import { Obj } from "@dxos/echo";
|
|
931
|
+
import { Entity, Obj } from "@dxos/echo";
|
|
932
932
|
var whenRoot = (node) => node.id === RootId ? Option2.some(node) : Option2.none();
|
|
933
933
|
var whenId = (id) => (node) => node.id === id ? Option2.some(node) : Option2.none();
|
|
934
934
|
var whenNodeType = (type) => (node) => node.type === type ? Option2.some(node) : Option2.none();
|
|
935
|
-
var whenEchoType = (type) => (node) =>
|
|
935
|
+
var whenEchoType = (type) => (node) => Entity.instanceOf(type, node.data) ? Option2.some(node.data) : Option2.none();
|
|
936
936
|
var whenEchoObject = (node) => Obj.isObject(node.data) ? Option2.some(node.data) : Option2.none();
|
|
937
937
|
var whenAll = (...matchers) => (node) => {
|
|
938
938
|
let first = Option2.none();
|
|
@@ -956,7 +956,7 @@ var whenAny = (...matchers) => (node) => {
|
|
|
956
956
|
}
|
|
957
957
|
return Option2.none();
|
|
958
958
|
};
|
|
959
|
-
var whenEchoTypeMatches = (type) => (node) =>
|
|
959
|
+
var whenEchoTypeMatches = (type) => (node) => Entity.instanceOf(type, node.data) ? Option2.some(node) : Option2.none();
|
|
960
960
|
var whenEchoObjectMatches = (node) => Obj.isObject(node.data) ? Option2.some(node) : Option2.none();
|
|
961
961
|
var whenNot = (matcher) => (node) => Option2.isNone(matcher(node)) ? Option2.some(node) : Option2.none();
|
|
962
962
|
|
|
@@ -1306,8 +1306,15 @@ function destroy(builder) {
|
|
|
1306
1306
|
var flush = (builder) => {
|
|
1307
1307
|
return builder._flushPromise;
|
|
1308
1308
|
};
|
|
1309
|
+
var validateLocalId = (id) => {
|
|
1310
|
+
const finalSegment = id.split(".").pop();
|
|
1311
|
+
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(finalSegment)) {
|
|
1312
|
+
throw new Error(`Invalid extension id: "${id}". The final segment "${finalSegment}" must be camelCase (letters and digits only, starting with a letter \u2014 no hyphens or underscores).`);
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1309
1315
|
var createExtensionRaw = (extension) => {
|
|
1310
1316
|
const { id, position, relation: relation2 = "child", resolver: _resolver, connector: _connector, actions: _actions, actionGroups: _actionGroups } = extension;
|
|
1317
|
+
validateLocalId(id);
|
|
1311
1318
|
const normalizedRelation = normalizeRelation(relation2);
|
|
1312
1319
|
const getId = (key) => `${id}/${key}`;
|
|
1313
1320
|
const resolver = _resolver && Atom2.family((id2) => _resolver(id2).pipe(Atom2.withLabel(`graph-builder:_resolver:${id2}`)));
|
|
@@ -1332,7 +1339,7 @@ var createExtensionRaw = (extension) => {
|
|
|
1332
1339
|
id: getId("connector"),
|
|
1333
1340
|
node,
|
|
1334
1341
|
error
|
|
1335
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L:
|
|
1342
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 398, S: void 0 });
|
|
1336
1343
|
return [];
|
|
1337
1344
|
}
|
|
1338
1345
|
}).pipe(Atom2.withLabel(`graph-builder:connector:${id}`)))
|
|
@@ -1353,7 +1360,7 @@ var createExtensionRaw = (extension) => {
|
|
|
1353
1360
|
id: getId("actionGroups"),
|
|
1354
1361
|
node,
|
|
1355
1362
|
error
|
|
1356
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L:
|
|
1363
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 419, S: void 0 });
|
|
1357
1364
|
return [];
|
|
1358
1365
|
}
|
|
1359
1366
|
}).pipe(Atom2.withLabel(`graph-builder:connector:actionGroups:${id}`)))
|
|
@@ -1373,7 +1380,7 @@ var createExtensionRaw = (extension) => {
|
|
|
1373
1380
|
id: getId("actions"),
|
|
1374
1381
|
node,
|
|
1375
1382
|
error
|
|
1376
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L:
|
|
1383
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 439, S: void 0 });
|
|
1377
1384
|
return [];
|
|
1378
1385
|
}
|
|
1379
1386
|
}).pipe(Atom2.withLabel(`graph-builder:connector:actions:${id}`)))
|
|
@@ -1385,7 +1392,7 @@ var runEffectSyncWithFallback = (effect, context2, extensionId, fallback) => {
|
|
|
1385
1392
|
log2.warn("Extension failed", {
|
|
1386
1393
|
extension: extensionId,
|
|
1387
1394
|
error
|
|
1388
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L:
|
|
1395
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 456, S: void 0 });
|
|
1389
1396
|
return Effect.succeed(fallback);
|
|
1390
1397
|
})));
|
|
1391
1398
|
};
|
|
@@ -1474,4 +1481,4 @@ export {
|
|
|
1474
1481
|
flush,
|
|
1475
1482
|
graph_builder_exports
|
|
1476
1483
|
};
|
|
1477
|
-
//# sourceMappingURL=chunk-
|
|
1484
|
+
//# sourceMappingURL=chunk-7BYCDV55.mjs.map
|