@dxos/app-graph 0.8.4-main.422d1c7879 → 0.8.4-main.51f1e5ca51

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.
@@ -61,8 +61,12 @@ var secondaryKey = (...parts) => parts.join(SECONDARY);
61
61
  var secondaryParts = (key) => key.split(SECONDARY);
62
62
  var normalizeRelation = (relation2) => relation2 == null ? childRelation() : typeof relation2 === "string" ? relation(relation2) : relation2;
63
63
  var shallowEqual = (a, b) => {
64
- if (a === b) return true;
65
- if (a == null || b == null || typeof a !== "object" || typeof b !== "object") return false;
64
+ if (a === b) {
65
+ return true;
66
+ }
67
+ if (a == null || b == null || typeof a !== "object" || typeof b !== "object") {
68
+ return false;
69
+ }
66
70
  const keysA = Object.keys(a);
67
71
  const keysB = Object.keys(b);
68
72
  if (keysA.length !== keysB.length) {
@@ -84,15 +88,7 @@ var qualifyId = (parentId, ...segmentIds) => [
84
88
  ...segmentIds
85
89
  ].join(PATH);
86
90
  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
- });
91
+ invariant(!id.includes(PATH), `Node segment ID must not contain '${PATH}': ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 55, S: void 0, A: ["!id.includes(PATH)", "`Node segment ID must not contain '${PATH}': ${id}`"] });
96
92
  };
97
93
  var getParentId = (qualifiedId) => {
98
94
  const lastSlash = qualifiedId.lastIndexOf(PATH);
@@ -147,15 +143,7 @@ var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-graph/src/graph.ts";
147
143
  var graphSymbol = /* @__PURE__ */ Symbol("graph");
148
144
  var getGraph = (node) => {
149
145
  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
- });
146
+ 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
147
  return graph;
160
148
  };
161
149
  var GraphTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-graph/Graph");
@@ -194,15 +182,7 @@ var GraphImpl = class {
194
182
  _nodeOrThrow = Atom.family((id) => {
195
183
  return Atom.make((get2) => {
196
184
  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
- });
185
+ 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
186
  return node.value;
207
187
  });
208
188
  });
@@ -373,15 +353,7 @@ function getConnections(graphOrId, idOrRelation, relation2) {
373
353
  } else {
374
354
  const graph = graphOrId;
375
355
  const id = idOrRelation;
376
- invariant2(relation2 !== void 0, "Relation is required.", {
377
- F: __dxlog_file2,
378
- L: 449,
379
- S: this,
380
- A: [
381
- "relation !== undefined",
382
- "'Relation is required.'"
383
- ]
384
- });
356
+ invariant2(relation2 !== void 0, "Relation is required.", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 272, S: this, A: ["relation !== undefined", "'Relation is required.'"] });
385
357
  const rel = relation2;
386
358
  return getConnectionsImpl(graph, id, rel);
387
359
  }
@@ -518,12 +490,7 @@ var initializeImpl = async (graph, id) => {
518
490
  log("initialize", {
519
491
  id,
520
492
  initialized
521
- }, {
522
- F: __dxlog_file2,
523
- L: 671,
524
- S: void 0,
525
- C: (f, a) => f(...a)
526
- });
493
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 431, S: void 0 });
527
494
  if (!initialized) {
528
495
  Record.set(internal._initialized, id, true);
529
496
  await internal._onInitialize?.(id);
@@ -549,24 +516,14 @@ var expandImpl = (graph, id, relation2) => {
549
516
  log("expand", {
550
517
  key,
551
518
  deferred: true
552
- }, {
553
- F: __dxlog_file2,
554
- L: 717,
555
- S: void 0,
556
- C: (f, a) => f(...a)
557
- });
519
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 463, S: void 0 });
558
520
  return graph;
559
521
  }
560
522
  const expanded = Record.get(internal._expanded, key).pipe(Option.getOrElse(() => false));
561
523
  log("expand", {
562
524
  key,
563
525
  expanded
564
- }, {
565
- F: __dxlog_file2,
566
- L: 722,
567
- S: void 0,
568
- C: (f, a) => f(...a)
569
- });
526
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 470, S: void 0 });
570
527
  if (!expanded) {
571
528
  Record.set(internal._expanded, key, true);
572
529
  internal._onExpand?.(id, normalizedRelation);
@@ -581,15 +538,7 @@ function expand(graphOrId, idOrRelation, relation2) {
581
538
  } else {
582
539
  const graph = graphOrId;
583
540
  const id = idOrRelation;
584
- invariant2(relation2 !== void 0, "Relation is required.", {
585
- F: __dxlog_file2,
586
- L: 758,
587
- S: this,
588
- A: [
589
- "relation !== undefined",
590
- "'Relation is required.'"
591
- ]
592
- });
541
+ invariant2(relation2 !== void 0, "Relation is required.", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 490, S: this, A: ["relation !== undefined", "'Relation is required.'"] });
593
542
  const rel = relation2;
594
543
  return expandImpl(graph, id, rel);
595
544
  }
@@ -658,24 +607,14 @@ var addNodeImpl = (graph, nodeArg) => {
658
607
  typeChanged,
659
608
  dataChanged,
660
609
  propertiesChanged
661
- }, {
662
- F: __dxlog_file2,
663
- L: 880,
664
- S: void 0,
665
- C: (f, a) => f(...a)
666
- });
610
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 565, S: void 0 });
667
611
  if (typeChanged || dataChanged || propertiesChanged) {
668
612
  log("updating node", {
669
613
  id,
670
614
  type,
671
615
  data,
672
616
  properties
673
- }, {
674
- F: __dxlog_file2,
675
- L: 887,
676
- S: void 0,
677
- C: (f, a) => f(...a)
678
- });
617
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 572, S: void 0 });
679
618
  const newNode = Option.some({
680
619
  ...existing,
681
620
  ...rest,
@@ -699,12 +638,7 @@ var addNodeImpl = (graph, nodeArg) => {
699
638
  type,
700
639
  data,
701
640
  properties
702
- }, {
703
- F: __dxlog_file2,
704
- L: 900,
705
- S: void 0,
706
- C: (f, a) => f(...a)
707
- });
641
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 596, S: void 0 });
708
642
  const newNode = internal._constructNode({
709
643
  id,
710
644
  type,
@@ -845,12 +779,7 @@ var addEdgeImpl = (graph, edgeArg) => {
845
779
  source: edgeArg.source,
846
780
  target: edgeArg.target,
847
781
  relation: relationId
848
- }, {
849
- F: __dxlog_file2,
850
- L: 1083,
851
- S: void 0,
852
- C: (f, a) => f(...a)
853
- });
782
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 758, S: void 0 });
854
783
  internal._registry.set(sourceAtom, {
855
784
  ...source,
856
785
  [relationId]: [
@@ -867,12 +796,7 @@ var addEdgeImpl = (graph, edgeArg) => {
867
796
  source: edgeArg.source,
868
797
  target: edgeArg.target,
869
798
  relation: inverseId
870
- }, {
871
- F: __dxlog_file2,
872
- L: 1091,
873
- S: void 0,
874
- C: (f, a) => f(...a)
875
- });
799
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 775, S: void 0 });
876
800
  internal._registry.set(targetAtom, {
877
801
  ...target,
878
802
  [inverseId]: [
@@ -972,39 +896,15 @@ var relationKey = (relation2) => {
972
896
  };
973
897
  var relationFromKey = (encoded) => {
974
898
  const parts = secondaryParts(encoded);
975
- invariant2(parts.length === 2 && parts[0].length > 0 && parts[1].length > 0, `Invalid relation key: ${encoded}`, {
976
- F: __dxlog_file2,
977
- L: 1236,
978
- S: void 0,
979
- A: [
980
- "parts.length === 2 && parts[0].length > 0 && parts[1].length > 0",
981
- "`Invalid relation key: ${encoded}`"
982
- ]
983
- });
899
+ 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}`"] });
984
900
  const [kind, directionRaw] = parts;
985
- invariant2(directionRaw === "outbound" || directionRaw === "inbound", `Invalid relation direction: ${directionRaw}`, {
986
- F: __dxlog_file2,
987
- L: 1238,
988
- S: void 0,
989
- A: [
990
- "directionRaw === 'outbound' || directionRaw === 'inbound'",
991
- "`Invalid relation direction: ${directionRaw}`"
992
- ]
993
- });
901
+ 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}`"] });
994
902
  return relation(kind, directionRaw);
995
903
  };
996
904
  var connectionKey = (id, relation2) => primaryKey(id, relationKey(relation2));
997
905
  var relationFromConnectionKey = (key) => {
998
906
  const [id, encodedRelation] = primaryParts(key);
999
- invariant2(id && encodedRelation, `Invalid connection key: ${key}`, {
1000
- F: __dxlog_file2,
1001
- L: 1246,
1002
- S: void 0,
1003
- A: [
1004
- "id && encodedRelation",
1005
- "`Invalid connection key: ${key}`"
1006
- ]
1007
- });
907
+ invariant2(id && encodedRelation, `Invalid connection key: ${key}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 902, S: void 0, A: ["id && encodedRelation", "`Invalid connection key: ${key}`"] });
1008
908
  return {
1009
909
  id,
1010
910
  relation: relationFromKey(encodedRelation)
@@ -1207,12 +1107,7 @@ var GraphBuilderImpl = class {
1207
1107
  id,
1208
1108
  relation: relation2,
1209
1109
  registry: getDebugName(this._registry)
1210
- }, {
1211
- F: __dxlog_file3,
1212
- L: 269,
1213
- S: this,
1214
- C: (f, a) => f(...a)
1215
- });
1110
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 130, S: this });
1216
1111
  this._expandRelation(id, relation2);
1217
1112
  if (relation2.kind === "child" && relation2.direction === "outbound") {
1218
1113
  expand(this._graph, id, "action");
@@ -1235,12 +1130,7 @@ var GraphBuilderImpl = class {
1235
1130
  id,
1236
1131
  relation: relation2,
1237
1132
  ids
1238
- }, {
1239
- F: __dxlog_file3,
1240
- L: 296,
1241
- S: this,
1242
- C: (f, a) => f(...a)
1243
- });
1133
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 154, S: this });
1244
1134
  this._dirtyConnectors.set(key, {
1245
1135
  nodes,
1246
1136
  previous
@@ -1254,12 +1144,7 @@ var GraphBuilderImpl = class {
1254
1144
  async _onInitialize(id) {
1255
1145
  log2("onInitialize", {
1256
1146
  id
1257
- }, {
1258
- F: __dxlog_file3,
1259
- L: 307,
1260
- S: this,
1261
- C: (f, a) => f(...a)
1262
- });
1147
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 170, S: this });
1263
1148
  const resolver = this._resolvers(id);
1264
1149
  const cancel = this._registry.subscribe(resolver, (node) => {
1265
1150
  const trigger = this._initialized[id];
@@ -1442,12 +1327,7 @@ var createExtensionRaw = (extension) => {
1442
1327
  id: getId("connector"),
1443
1328
  node,
1444
1329
  error
1445
- }, {
1446
- F: __dxlog_file3,
1447
- L: 609,
1448
- S: void 0,
1449
- C: (f, a) => f(...a)
1450
- });
1330
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 377, S: void 0 });
1451
1331
  return [];
1452
1332
  }
1453
1333
  }).pipe(Atom2.withLabel(`graph-builder:connector:${id}`)))
@@ -1468,12 +1348,7 @@ var createExtensionRaw = (extension) => {
1468
1348
  id: getId("actionGroups"),
1469
1349
  node,
1470
1350
  error
1471
- }, {
1472
- F: __dxlog_file3,
1473
- L: 630,
1474
- S: void 0,
1475
- C: (f, a) => f(...a)
1476
- });
1351
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 398, S: void 0 });
1477
1352
  return [];
1478
1353
  }
1479
1354
  }).pipe(Atom2.withLabel(`graph-builder:connector:actionGroups:${id}`)))
@@ -1493,12 +1368,7 @@ var createExtensionRaw = (extension) => {
1493
1368
  id: getId("actions"),
1494
1369
  node,
1495
1370
  error
1496
- }, {
1497
- F: __dxlog_file3,
1498
- L: 647,
1499
- S: void 0,
1500
- C: (f, a) => f(...a)
1501
- });
1371
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 418, S: void 0 });
1502
1372
  return [];
1503
1373
  }
1504
1374
  }).pipe(Atom2.withLabel(`graph-builder:connector:actions:${id}`)))
@@ -1510,12 +1380,7 @@ var runEffectSyncWithFallback = (effect, context2, extensionId, fallback) => {
1510
1380
  log2.warn("Extension failed", {
1511
1381
  extension: extensionId,
1512
1382
  error
1513
- }, {
1514
- F: __dxlog_file3,
1515
- L: 690,
1516
- S: void 0,
1517
- C: (f, a) => f(...a)
1518
- });
1383
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 435, S: void 0 });
1519
1384
  return Effect.succeed(fallback);
1520
1385
  })));
1521
1386
  };
@@ -1601,4 +1466,4 @@ export {
1601
1466
  flush,
1602
1467
  graph_builder_exports
1603
1468
  };
1604
- //# sourceMappingURL=chunk-W47H2NND.mjs.map
1469
+ //# sourceMappingURL=chunk-ZPU7IO6U.mjs.map