@ixo/editor 3.1.0 → 3.2.0

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.
@@ -1,4 +1,5 @@
1
1
  import {
2
+ LATEST_VERSION,
2
3
  buildDomainCardLinkedResource,
3
4
  buildFlowNodeFromBlock,
4
5
  buildGovernanceGroupLinkedEntities,
@@ -19,7 +20,7 @@ import {
19
20
  resolveActionType,
20
21
  sendDirectMessage,
21
22
  transformSurveyToCredentialSubject
22
- } from "./chunk-5D26UG3I.mjs";
23
+ } from "./chunk-3EZI42YS.mjs";
23
24
 
24
25
  // src/mantine/hooks/useCreateIxoEditor.ts
25
26
  import { useCreateBlockNote } from "@blocknote/react";
@@ -1498,6 +1499,7 @@ function initializeHookedActions() {
1498
1499
  // src/mantine/context/BlocknoteContext.tsx
1499
1500
  var BlocknoteContext = createContext({
1500
1501
  docType: "flow",
1502
+ flowVersion: "0.3",
1501
1503
  sharedProposals: {},
1502
1504
  fetchSharedProposal: async () => {
1503
1505
  throw new Error("BlocknoteContext not initialized");
@@ -1534,6 +1536,7 @@ var BlocknoteProvider = ({
1534
1536
  const [activeDrawerId, setActiveDrawerId] = useState3(null);
1535
1537
  const [drawerContent, setDrawerContent] = useState3(null);
1536
1538
  const docType = editor?.docType || "flow";
1539
+ const flowVersion = editor?.getFlowMetadata?.()?.schema_version || "0.3";
1537
1540
  useEffect4(() => {
1538
1541
  initializeHookedActions();
1539
1542
  }, []);
@@ -1617,6 +1620,7 @@ var BlocknoteProvider = ({
1617
1620
  blockRequirements,
1618
1621
  editable,
1619
1622
  docType,
1623
+ flowVersion,
1620
1624
  sharedProposals,
1621
1625
  fetchSharedProposal,
1622
1626
  invalidateProposal,
@@ -6741,6 +6745,7 @@ function useBlockAuthorization({ editor, blockId, actorDid, ucanService, flowUri
6741
6745
  const metadata = editor.getFlowMetadata?.();
6742
6746
  return metadata?.doc_id ? `ixo:flow:${metadata.doc_id}` : "";
6743
6747
  }, [flowUri, editor]);
6748
+ const schemaVersion = useMemo25(() => editor.getFlowMetadata?.()?.schema_version || "0.3", [editor]);
6744
6749
  useEffect23(() => {
6745
6750
  const checkAuthorization = async () => {
6746
6751
  setLoading(true);
@@ -6760,7 +6765,7 @@ function useBlockAuthorization({ editor, blockId, actorDid, ucanService, flowUri
6760
6765
  return;
6761
6766
  }
6762
6767
  try {
6763
- const authResult = await isAuthorized(blockId, actorDid, ucanService, resolvedFlowUri);
6768
+ const authResult = await isAuthorized(blockId, actorDid, ucanService, resolvedFlowUri, schemaVersion);
6764
6769
  setResult(authResult);
6765
6770
  } catch (error) {
6766
6771
  setResult({
@@ -6772,7 +6777,7 @@ function useBlockAuthorization({ editor, blockId, actorDid, ucanService, flowUri
6772
6777
  }
6773
6778
  };
6774
6779
  checkAuthorization();
6775
- }, [blockId, actorDid, ucanService, resolvedFlowUri, checkTrigger]);
6780
+ }, [blockId, actorDid, ucanService, resolvedFlowUri, schemaVersion, checkTrigger]);
6776
6781
  const recheck = () => setCheckTrigger((prev) => prev + 1);
6777
6782
  return {
6778
6783
  isAuthorized: result.authorized,
@@ -31560,6 +31565,7 @@ function useCreateCollaborativeIxoEditor(options) {
31560
31565
  const runtimeMap = useMemo118(() => yDoc.getMap("runtime"), [yDoc]);
31561
31566
  const delegationsMap = useMemo118(() => yDoc.getMap("delegations"), [yDoc]);
31562
31567
  const invocationsMap = useMemo118(() => yDoc.getMap("invocations"), [yDoc]);
31568
+ const migrationMap = useMemo118(() => yDoc.getMap("migration"), [yDoc]);
31563
31569
  const ucanDelegationStore = useMemo118(() => {
31564
31570
  const store = createUcanDelegationStore(delegationsMap);
31565
31571
  const originalSet = store.set;
@@ -31676,6 +31682,7 @@ function useCreateCollaborativeIxoEditor(options) {
31676
31682
  ixoEditor._yInvocations = invocationsMap;
31677
31683
  ixoEditor._ucanDelegationStore = ucanDelegationStore;
31678
31684
  ixoEditor._invocationStore = invocationStore;
31685
+ ixoEditor._yMigration = migrationMap;
31679
31686
  ixoEditor.getUcanService = () => {
31680
31687
  return null;
31681
31688
  };
@@ -31816,9 +31823,9 @@ function useCreateCollaborativeIxoEditor(options) {
31816
31823
  if (!permissions.write) {
31817
31824
  return;
31818
31825
  }
31819
- root.set("@context", "https://ixo.world/flow/0.3");
31826
+ root.set("@context", `https://ixo.world/flow/${LATEST_VERSION}`);
31820
31827
  root.set("_type", "ixo.flow.crdt");
31821
- root.set("schema_version", "0.3");
31828
+ root.set("schema_version", LATEST_VERSION);
31822
31829
  root.set("doc_id", options.docId || `flow_${Date.now()}`);
31823
31830
  root.set("createdAt", (/* @__PURE__ */ new Date()).toISOString());
31824
31831
  root.set("createdBy", memoizedUser.id || "anonymous");
@@ -34083,4 +34090,4 @@ export {
34083
34090
  getExtraSlashMenuItems,
34084
34091
  useCreateIxoEditor
34085
34092
  };
34086
- //# sourceMappingURL=chunk-FM2G22RS.mjs.map
34093
+ //# sourceMappingURL=chunk-3MI2QQYH.mjs.map