@ixo/editor 5.30.0 → 5.31.1

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.
@@ -10281,7 +10281,7 @@ function readFlow() {
10281
10281
  return readFlowFromEditor(activeEditor);
10282
10282
  }
10283
10283
  async function setupFlowFromBaseUcan(options) {
10284
- const { plan: rawPlan, roomId, matrixClient, creatorDid, docId, strategy = "full" } = options;
10284
+ const { plan: rawPlan, roomId, matrixClient, creatorDid, docId, templateId, strategy = "full" } = options;
10285
10285
  const plan = rawPlan.flowId ? rawPlan : { ...rawPlan, flowId: docId || roomId };
10286
10286
  const incomingCompiled = compileBaseUcanFlow(plan, { getActionByCan });
10287
10287
  const { yDoc, provider } = await connectToRoom(roomId, matrixClient);
@@ -10297,7 +10297,7 @@ async function setupFlowFromBaseUcan(options) {
10297
10297
  const runtime = yDoc.getMap("runtime");
10298
10298
  runtime.forEach((_, key) => runtime.delete(key));
10299
10299
  }
10300
- setRootMetadata(yDoc, root, plan, creatorDid, docId);
10300
+ setRootMetadata(yDoc, root, plan, creatorDid, docId, templateId);
10301
10301
  hydrateYDocFromCompiledFlow(yDoc, incomingCompiled);
10302
10302
  const runtimeMap = yDoc.getMap("runtime");
10303
10303
  initializeRuntime(runtimeMap, incomingCompiled);
@@ -10307,7 +10307,7 @@ async function setupFlowFromBaseUcan(options) {
10307
10307
  finalCompiled = incomingCompiled;
10308
10308
  } else {
10309
10309
  if (!existingFlow) {
10310
- setRootMetadata(yDoc, root, plan, creatorDid, docId);
10310
+ setRootMetadata(yDoc, root, plan, creatorDid, docId, templateId);
10311
10311
  hydrateYDocFromCompiledFlow(yDoc, incomingCompiled);
10312
10312
  const runtimeMap = yDoc.getMap("runtime");
10313
10313
  initializeRuntime(runtimeMap, incomingCompiled);
@@ -10377,7 +10377,7 @@ async function connectToRoom(roomId, matrixClient) {
10377
10377
  });
10378
10378
  return { yDoc, provider };
10379
10379
  }
10380
- function setRootMetadata(yDoc, root, plan, creatorDid, docId) {
10380
+ function setRootMetadata(yDoc, root, plan, creatorDid, docId, templateId) {
10381
10381
  yDoc.transact(() => {
10382
10382
  if (!root.get("@context")) root.set("@context", "https://ixo.world/flow/0.3");
10383
10383
  if (!root.get("_type")) root.set("_type", "ixo.flow.crdt");
@@ -10386,6 +10386,9 @@ function setRootMetadata(yDoc, root, plan, creatorDid, docId) {
10386
10386
  if (!root.get("createdAt")) root.set("createdAt", (/* @__PURE__ */ new Date()).toISOString());
10387
10387
  if (!root.get("createdBy")) root.set("createdBy", creatorDid);
10388
10388
  root.set("flowOwnerDid", creatorDid);
10389
+ if (templateId && !root.get("source_template_id")) {
10390
+ root.set("source_template_id", templateId);
10391
+ }
10389
10392
  const titleText = yDoc.getText("title");
10390
10393
  if (titleText.length === 0 && plan.title) {
10391
10394
  titleText.insert(0, plan.title);
@@ -11829,4 +11832,4 @@ export {
11829
11832
  executeQueuedFlowAgentCoreCommands,
11830
11833
  FlowAgentService
11831
11834
  };
11832
- //# sourceMappingURL=chunk-FOYB7GE7.mjs.map
11835
+ //# sourceMappingURL=chunk-OP7EY4CE.mjs.map