@ixo/editor 6.31.1 → 6.31.3

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.
@@ -2105,6 +2105,29 @@ function markXeroWorkCompletedForEditor(editor, itemId, params) {
2105
2105
 
2106
2106
  // src/core/lib/flowCompiler/connections.ts
2107
2107
  import * as Y from "yjs";
2108
+
2109
+ // src/core/lib/yjsTypes.ts
2110
+ function getExistingYMap(yDoc, key) {
2111
+ if (!yDoc.share.has(key)) return void 0;
2112
+ return yDoc.getMap(key);
2113
+ }
2114
+ function isYMapLike(value) {
2115
+ if (!value || typeof value !== "object") return false;
2116
+ const candidate = value;
2117
+ return typeof candidate.get === "function" && typeof candidate.set === "function" && typeof candidate.has === "function" && typeof candidate.forEach === "function";
2118
+ }
2119
+ function isYXmlElementLike(value) {
2120
+ if (!value || typeof value !== "object") return false;
2121
+ const candidate = value;
2122
+ return typeof candidate.nodeName === "string" && typeof candidate.getAttribute === "function" && typeof candidate.getAttributes === "function";
2123
+ }
2124
+ function isYDocLike(value) {
2125
+ if (!value || typeof value !== "object") return false;
2126
+ const candidate = value;
2127
+ return typeof candidate.getMap === "function" && typeof candidate.getXmlFragment === "function" && typeof candidate.transact === "function";
2128
+ }
2129
+
2130
+ // src/core/lib/flowCompiler/connections.ts
2108
2131
  var FLOW_CONNECTIONS_MAP_KEY = "qi.flow.connections";
2109
2132
  var FLOW_CONNECTION_BINDINGS_MAP_KEY = "qi.flow.connectionBindings";
2110
2133
  var REQUIREMENT_KEYS = ["org", "bankAccount"];
@@ -2143,13 +2166,13 @@ function removeFlowConnection(yDoc, toolkit) {
2143
2166
  function setFlowConnectionOptional(yDoc, toolkit, optional) {
2144
2167
  yDoc.transact(() => {
2145
2168
  const entry = getConnectionsMap(yDoc).get(toolkit);
2146
- if (entry instanceof Y.Map) mergeOptionalFlag(entry, "optional", optional);
2169
+ if (isYMapLike(entry)) mergeOptionalFlag(entry, "optional", optional);
2147
2170
  });
2148
2171
  }
2149
2172
  function setFlowConnectionRequires(yDoc, toolkit, requires) {
2150
2173
  yDoc.transact(() => {
2151
2174
  const entry = getConnectionsMap(yDoc).get(toolkit);
2152
- if (entry instanceof Y.Map) entry.set("requires", toRequirementKeys(requires));
2175
+ if (isYMapLike(entry)) entry.set("requires", toRequirementKeys(requires));
2153
2176
  });
2154
2177
  }
2155
2178
  function readFlowConnectionBindings(yDoc) {
@@ -2196,13 +2219,13 @@ function getBindingsMap(yDoc) {
2196
2219
  }
2197
2220
  function ensureEntry(map, toolkit) {
2198
2221
  const existing = map.get(toolkit);
2199
- if (existing instanceof Y.Map) return existing;
2222
+ if (isYMapLike(existing)) return existing;
2200
2223
  const created = new Y.Map();
2201
2224
  map.set(toolkit, created);
2202
2225
  return created;
2203
2226
  }
2204
2227
  function toConnection(value) {
2205
- if (!(value instanceof Y.Map)) return void 0;
2228
+ if (!isYMapLike(value)) return void 0;
2206
2229
  const toolkit = value.get("toolkit");
2207
2230
  if (typeof toolkit !== "string" || toolkit.length === 0) return void 0;
2208
2231
  const connection = { toolkit, requires: toRequirementKeys(value.get("requires")) };
@@ -2214,7 +2237,7 @@ function toConnection(value) {
2214
2237
  return connection;
2215
2238
  }
2216
2239
  function toBinding(value) {
2217
- if (!(value instanceof Y.Map)) return void 0;
2240
+ if (!isYMapLike(value)) return void 0;
2218
2241
  const toolkit = toNonEmptyString(value.get("toolkit"));
2219
2242
  const connectedAccountId = toNonEmptyString(value.get("connectedAccountId"));
2220
2243
  const entityDid = toNonEmptyString(value.get("entityDid"));
@@ -15485,19 +15508,6 @@ function shouldNotifyPending(state, blockId, pendingInvocationId, currentAssigne
15485
15508
 
15486
15509
  // src/core/lib/flowEngine/runs.ts
15487
15510
  import * as Y2 from "yjs";
15488
-
15489
- // src/core/lib/yjsTypes.ts
15490
- function getExistingYMap(yDoc, key) {
15491
- if (!yDoc.share.has(key)) return void 0;
15492
- return yDoc.getMap(key);
15493
- }
15494
- function isYMapLike(value) {
15495
- if (!value || typeof value !== "object") return false;
15496
- const candidate = value;
15497
- return typeof candidate.get === "function" && typeof candidate.set === "function" && typeof candidate.has === "function" && typeof candidate.forEach === "function";
15498
- }
15499
-
15500
- // src/core/lib/flowEngine/runs.ts
15501
15511
  var RUNS_MAP_KEY = "runs";
15502
15512
  var RUNS_TERMINAL_MAP_KEY = "runsTerminal";
15503
15513
  var LEGACY_RUNTIME_MAP_KEY2 = "runtime";
@@ -18459,7 +18469,6 @@ var executeNode = async ({ node, actorDid, actorType, entityRoomId, context, act
18459
18469
  };
18460
18470
 
18461
18471
  // src/core/lib/flowEngine/readBackReconciler.ts
18462
- import * as Y5 from "yjs";
18463
18472
  async function appendReadBackTimeline(eventLog, event, runtime, blockId, now) {
18464
18473
  const result = await appendRunTimelineEvent({
18465
18474
  eventLog,
@@ -18471,7 +18480,7 @@ async function appendReadBackTimeline(eventLog, event, runtime, blockId, now) {
18471
18480
  return result.ok;
18472
18481
  }
18473
18482
  function isYDoc(value) {
18474
- return value instanceof Y5.Doc;
18483
+ return isYDocLike(value);
18475
18484
  }
18476
18485
  function getYDoc(editorOrYDoc) {
18477
18486
  if (!editorOrYDoc) return void 0;
@@ -18945,9 +18954,8 @@ async function reconcileActionReadBack(params) {
18945
18954
  }
18946
18955
 
18947
18956
  // src/core/lib/flowEngine/actionExecutor.ts
18948
- import * as Y6 from "yjs";
18949
18957
  function isYDoc2(value) {
18950
- return value instanceof Y6.Doc;
18958
+ return isYDocLike(value);
18951
18959
  }
18952
18960
  function getYDoc2(editorOrYDoc) {
18953
18961
  if (!editorOrYDoc) return void 0;
@@ -20561,7 +20569,7 @@ function detectTriggerCycles(triggerEdges) {
20561
20569
  }
20562
20570
 
20563
20571
  // src/core/lib/flowCompiler/documentFragment.ts
20564
- import * as Y7 from "yjs";
20572
+ import * as Y5 from "yjs";
20565
20573
  function writeCompiledBlocksToFragment(fragment, blocks) {
20566
20574
  const documentBlockGroup = getOrCreateDocumentBlockGroup(fragment);
20567
20575
  for (const block of blocks) {
@@ -20580,7 +20588,7 @@ function removeBlockFromFragment(fragment, blockId) {
20580
20588
  if (!blockGroup) return false;
20581
20589
  for (let i = 0; i < blockGroup.length; i++) {
20582
20590
  const container = blockGroup.get(i);
20583
- if (container instanceof Y7.XmlElement && container.getAttribute("id") === blockId) {
20591
+ if (isYXmlElementLike(container) && container.getAttribute("id") === blockId) {
20584
20592
  blockGroup.delete(i, 1);
20585
20593
  return true;
20586
20594
  }
@@ -20592,7 +20600,7 @@ function replaceBlockInFragment(fragment, block) {
20592
20600
  if (!blockGroup) return false;
20593
20601
  for (let i = 0; i < blockGroup.length; i++) {
20594
20602
  const container = blockGroup.get(i);
20595
- if (container instanceof Y7.XmlElement && container.getAttribute("id") === block.id) {
20603
+ if (isYXmlElementLike(container) && container.getAttribute("id") === block.id) {
20596
20604
  blockGroup.delete(i, 1);
20597
20605
  const newContainer = createBlockContainer(block);
20598
20606
  blockGroup.insert(i, [newContainer]);
@@ -20608,7 +20616,7 @@ function swapBlocksInFragment(fragment, idA, idB) {
20608
20616
  let ib = -1;
20609
20617
  for (let i = 0; i < blockGroup.length; i++) {
20610
20618
  const container = blockGroup.get(i);
20611
- if (container instanceof Y7.XmlElement) {
20619
+ if (isYXmlElementLike(container)) {
20612
20620
  const id = container.getAttribute("id");
20613
20621
  if (id === idA) ia = i;
20614
20622
  else if (id === idB) ib = i;
@@ -20655,11 +20663,11 @@ function readBlocksFromFragment(fragment) {
20655
20663
  const blocks = [];
20656
20664
  for (let i = 0; i < blockGroup.length; i++) {
20657
20665
  const container = blockGroup.get(i);
20658
- if (!(container instanceof Y7.XmlElement) || container.nodeName !== "blockContainer") continue;
20666
+ if (!isYXmlElementLike(container) || container.nodeName !== "blockContainer") continue;
20659
20667
  const id = container.getAttribute("id");
20660
20668
  if (typeof id !== "string" || id.length === 0) continue;
20661
20669
  const content = container.get(0);
20662
- if (!(content instanceof Y7.XmlElement)) continue;
20670
+ if (!isYXmlElementLike(content)) continue;
20663
20671
  const props = { ...content.getAttributes() };
20664
20672
  const textColor = container.getAttribute("textColor");
20665
20673
  if (typeof textColor === "string" && textColor !== "default") props.textColor = textColor;
@@ -20670,12 +20678,12 @@ function readBlocksFromFragment(fragment) {
20670
20678
  return blocks;
20671
20679
  }
20672
20680
  function createBlockContainer(block) {
20673
- const blockContainer = new Y7.XmlElement("blockContainer");
20681
+ const blockContainer = new Y5.XmlElement("blockContainer");
20674
20682
  const { backgroundColor: rawBackgroundColor, textColor: rawTextColor, ...contentProps } = block.props;
20675
20683
  blockContainer.setAttribute("id", block.id);
20676
20684
  blockContainer.setAttribute("textColor", rawTextColor || "default");
20677
20685
  blockContainer.setAttribute("backgroundColor", rawBackgroundColor || "default");
20678
- const blockContent = new Y7.XmlElement(block.type);
20686
+ const blockContent = new Y5.XmlElement(block.type);
20679
20687
  for (const [key, value] of Object.entries(contentProps)) {
20680
20688
  if (value !== "") {
20681
20689
  blockContent.setAttribute(key, value);
@@ -20690,13 +20698,13 @@ function appendBlockToGroup(blockGroup, block) {
20690
20698
  }
20691
20699
  function getOrCreateDocumentBlockGroup(fragment) {
20692
20700
  if (fragment.length === 0) {
20693
- const blockGroup = new Y7.XmlElement("blockGroup");
20701
+ const blockGroup = new Y5.XmlElement("blockGroup");
20694
20702
  fragment.insert(0, [blockGroup]);
20695
20703
  return blockGroup;
20696
20704
  }
20697
20705
  if (fragment.length === 1) {
20698
20706
  const rootNode = fragment.get(0);
20699
- if (rootNode instanceof Y7.XmlElement && rootNode.nodeName === "blockGroup") {
20707
+ if (isYXmlElementLike(rootNode) && rootNode.nodeName === "blockGroup") {
20700
20708
  return rootNode;
20701
20709
  }
20702
20710
  }
@@ -20706,7 +20714,7 @@ function getExistingBlockGroup(fragment) {
20706
20714
  if (fragment.length === 0) return null;
20707
20715
  if (fragment.length === 1) {
20708
20716
  const rootNode = fragment.get(0);
20709
- if (rootNode instanceof Y7.XmlElement && rootNode.nodeName === "blockGroup") {
20717
+ if (isYXmlElementLike(rootNode) && rootNode.nodeName === "blockGroup") {
20710
20718
  return rootNode;
20711
20719
  }
20712
20720
  }
@@ -20714,13 +20722,12 @@ function getExistingBlockGroup(fragment) {
20714
20722
  }
20715
20723
 
20716
20724
  // src/core/lib/flowCompiler/readFlow.ts
20717
- import * as Y8 from "yjs";
20718
20725
  function readCompiledFlowFromYDoc(yDoc) {
20719
20726
  const flowMeta = yDoc.getMap("qi.flow.meta");
20720
20727
  const flowNodes = yDoc.getMap("qi.flow.nodes");
20721
20728
  const nodes = {};
20722
20729
  flowNodes.forEach((value, nodeId) => {
20723
- if (value instanceof Y8.Map) {
20730
+ if (isYMapLike(value)) {
20724
20731
  nodes[nodeId] = yMapToFlowNode(value);
20725
20732
  }
20726
20733
  });
@@ -20740,7 +20747,7 @@ function readCompiledFlowFromYDoc(yDoc) {
20740
20747
  const flowEdges = yDoc.getMap("qi.flow.edges");
20741
20748
  const edges = [];
20742
20749
  flowEdges.forEach((value) => {
20743
- if (value instanceof Y8.Map) {
20750
+ if (isYMapLike(value)) {
20744
20751
  edges.push(yMapToEdge(value));
20745
20752
  }
20746
20753
  });
@@ -20937,11 +20944,11 @@ function triggerToNodeIds(trigger, nodeIdByBlockId) {
20937
20944
  }
20938
20945
 
20939
20946
  // src/core/lib/flowCompiler/setup.ts
20940
- import * as Y10 from "yjs";
20947
+ import * as Y7 from "yjs";
20941
20948
  import { MatrixProvider } from "@ixo/matrix-crdt";
20942
20949
 
20943
20950
  // src/core/lib/flowCompiler/hydrate.ts
20944
- import * as Y9 from "yjs";
20951
+ import * as Y6 from "yjs";
20945
20952
  function hydrateYDocFromCompiledFlow(yDoc, compiled) {
20946
20953
  yDoc.transact(() => {
20947
20954
  const flowMeta = yDoc.getMap("qi.flow.meta");
@@ -20956,7 +20963,7 @@ function hydrateYDocFromCompiledFlow(yDoc, compiled) {
20956
20963
  }
20957
20964
  const flowEdges = yDoc.getMap("qi.flow.edges");
20958
20965
  for (const edge of compiled.edges) {
20959
- const yEdge = new Y9.Map();
20966
+ const yEdge = new Y6.Map();
20960
20967
  yEdge.set("id", edge.id);
20961
20968
  yEdge.set("source", edge.source);
20962
20969
  yEdge.set("target", edge.target);
@@ -21010,7 +21017,7 @@ function hydrateYDocFromMergeResult(yDoc, mergeResult) {
21010
21017
  const flowEdges = yDoc.getMap("qi.flow.edges");
21011
21018
  flowEdges.forEach((_, key) => flowEdges.delete(key));
21012
21019
  for (const edge of merged.edges) {
21013
- const yEdge = new Y9.Map();
21020
+ const yEdge = new Y6.Map();
21014
21021
  yEdge.set("id", edge.id);
21015
21022
  yEdge.set("source", edge.source);
21016
21023
  yEdge.set("target", edge.target);
@@ -21052,7 +21059,7 @@ function initializeRuntimeForNodes(yDoc, compiled, nodeIds, runId) {
21052
21059
  });
21053
21060
  }
21054
21061
  function createYMapFromNode(node) {
21055
- const yNode = new Y9.Map();
21062
+ const yNode = new Y6.Map();
21056
21063
  yNode.set("id", node.id);
21057
21064
  yNode.set("blockId", node.blockId);
21058
21065
  yNode.set("can", node.can);
@@ -21162,7 +21169,7 @@ function applyFlowPlanToYDoc(yDoc, options) {
21162
21169
  return mergeResult.merged;
21163
21170
  }
21164
21171
  async function connectToRoom(roomId, matrixClient, options) {
21165
- const yDoc = new Y10.Doc();
21172
+ const yDoc = new Y7.Doc();
21166
21173
  const client = matrixClient;
21167
21174
  client.canSupportVoip = false;
21168
21175
  client.clientOpts = { lazyLoadMembers: true };
@@ -21947,7 +21954,7 @@ function isRecord2(value) {
21947
21954
  function isYXmlContainerLike(value) {
21948
21955
  return value != null && typeof value === "object" && typeof value.toArray === "function";
21949
21956
  }
21950
- function isYXmlElementLike(value) {
21957
+ function isYXmlElementLike2(value) {
21951
21958
  return isYXmlContainerLike(value) && typeof value.nodeName === "string" && typeof value.getAttribute === "function" && typeof value.setAttribute === "function";
21952
21959
  }
21953
21960
  function getElementBlockId(element) {
@@ -21976,7 +21983,7 @@ function updateXmlElementProps(element, blockId, propsPatch) {
21976
21983
  }
21977
21984
  function findXmlElementById(container, blockId) {
21978
21985
  for (const node of container.toArray()) {
21979
- if (!isYXmlElementLike(node)) continue;
21986
+ if (!isYXmlElementLike2(node)) continue;
21980
21987
  const id = getElementBlockId(node);
21981
21988
  if (id === blockId) return node;
21982
21989
  const nested = findXmlElementById(node, blockId);
@@ -21988,7 +21995,7 @@ function updateDocumentBlockProps(yDoc, blockId, propsPatch) {
21988
21995
  const target = findXmlElementById(yDoc.getXmlFragment("document"), blockId);
21989
21996
  if (!target) return false;
21990
21997
  updateXmlElementProps(target, blockId, propsPatch);
21991
- const content = target.toArray().find((node) => isYXmlElementLike(node) && node.nodeName !== "blockGroup");
21998
+ const content = target.toArray().find((node) => isYXmlElementLike2(node) && node.nodeName !== "blockGroup");
21992
21999
  if (content) {
21993
22000
  updateXmlElementProps(content, blockId, propsPatch);
21994
22001
  }
@@ -22525,6 +22532,8 @@ export {
22525
22532
  parseCalendarEventCreateInputs,
22526
22533
  serializeCalendarEventCreateInputs,
22527
22534
  parseAttendeesField,
22535
+ isYMapLike,
22536
+ isYXmlElementLike,
22528
22537
  FLOW_CONNECTIONS_MAP_KEY,
22529
22538
  FLOW_CONNECTION_BINDINGS_MAP_KEY,
22530
22539
  readFlowConnections,
@@ -22747,4 +22756,4 @@ export {
22747
22756
  executeQueuedFlowAgentCoreCommands,
22748
22757
  FlowAgentService
22749
22758
  };
22750
- //# sourceMappingURL=chunk-TBCPHCFA.js.map
22759
+ //# sourceMappingURL=chunk-6OMM32CE.js.map