@ixo/editor 5.20.0-experimental.1 → 5.20.0-experimental.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.
@@ -618,6 +618,32 @@ registerAction({
618
618
  }
619
619
  ],
620
620
  pendingDisplayFields: ["flowTemplateConfig.templateCount", "flowTemplateConfig.protocolCount"]
621
+ },
622
+ {
623
+ name: "selected",
624
+ displayName: "Flow Templates Selected",
625
+ description: "Fires with the flow template selection payload consumed by POD signing.",
626
+ payloadSchema: [
627
+ {
628
+ path: "flowTemplateConfig",
629
+ displayName: "Flow Template Config",
630
+ type: "object",
631
+ description: "Selected templates grouped by their protocol DID for later import"
632
+ },
633
+ {
634
+ path: "selectedProtocolTemplates",
635
+ displayName: "Selected Protocol Templates",
636
+ type: "array",
637
+ description: "Selected protocol templates with protocol DID and source room ID"
638
+ },
639
+ {
640
+ path: "selectedFlowDids",
641
+ displayName: "Selected Flow Room IDs",
642
+ type: "array",
643
+ description: "Source Matrix room IDs for selected templates"
644
+ }
645
+ ],
646
+ pendingDisplayFields: ["flowTemplateConfig.templateCount", "flowTemplateConfig.protocolCount"]
621
647
  }
622
648
  ],
623
649
  run: async (inputs) => {
@@ -631,7 +657,17 @@ registerAction({
631
657
  };
632
658
  return {
633
659
  output: { selectedProtocolTemplates, selectedFlowDids, flowTemplateConfig },
634
- events: [{ name: "configured", payload: { flowTemplateConfig } }]
660
+ events: [
661
+ { name: "configured", payload: { flowTemplateConfig } },
662
+ {
663
+ name: "selected",
664
+ payload: {
665
+ flowTemplateConfig,
666
+ selectedProtocolTemplates,
667
+ selectedFlowDids
668
+ }
669
+ }
670
+ ]
635
671
  };
636
672
  }
637
673
  });
@@ -2778,21 +2814,33 @@ function writeDomainSignCheckpoint(ctx, key, checkpoint) {
2778
2814
  });
2779
2815
  }
2780
2816
  function buildCompletedDomainSignResult(output) {
2817
+ const payload = {
2818
+ entityDid: output.entityDid,
2819
+ governanceGroupCoreAddress: output.governanceGroupCoreAddress || "",
2820
+ transactionHash: output.transactionHash || "",
2821
+ linkedResourceTransactionHash: output.linkedResourceTransactionHash || "",
2822
+ ...output.parentLinkedEntityTransactionHash ? { parentLinkedEntityTransactionHash: output.parentLinkedEntityTransactionHash } : {}
2823
+ };
2781
2824
  return {
2782
2825
  output,
2783
2826
  events: [
2784
2827
  {
2785
2828
  name: "created",
2786
- payload: {
2787
- entityDid: output.entityDid,
2788
- governanceGroupCoreAddress: output.governanceGroupCoreAddress || "",
2789
- transactionHash: output.transactionHash || "",
2790
- linkedResourceTransactionHash: output.linkedResourceTransactionHash || ""
2791
- }
2829
+ payload
2792
2830
  }
2793
2831
  ]
2794
2832
  };
2795
2833
  }
2834
+ function readDidInput(value) {
2835
+ if (typeof value !== "string") return "";
2836
+ const did = value.trim();
2837
+ if (!did || did === "null" || did === "undefined") return "";
2838
+ return did.startsWith("did:") ? did : "";
2839
+ }
2840
+ function getSelectedParentEntityDid(inputs) {
2841
+ if (inputs.skipped === true || inputs.parentSkipped === true) return "";
2842
+ return readDidInput(inputs.selectedEntityDid) || readDidInput(inputs.parentDid) || readDidInput(inputs.parentDID);
2843
+ }
2796
2844
  function parseDuration(raw) {
2797
2845
  const seconds = parseInt(raw, 10) || 0;
2798
2846
  if (seconds % (7 * 86400) === 0) return { amount: seconds / (7 * 86400), unit: "weeks" };
@@ -2880,6 +2928,18 @@ registerAction({
2880
2928
  type: "string",
2881
2929
  description: "The on-chain transaction hash for adding the domain card linked resource"
2882
2930
  },
2931
+ {
2932
+ path: "parentEntityDid",
2933
+ displayName: "Parent Entity DID",
2934
+ type: "string",
2935
+ description: "The selected parent entity DID that was updated with the new POD linked entity"
2936
+ },
2937
+ {
2938
+ path: "parentLinkedEntityTransactionHash",
2939
+ displayName: "Parent Linked Entity Transaction Hash",
2940
+ type: "string",
2941
+ description: "The on-chain transaction hash for linking the new POD to the selected parent entity"
2942
+ },
2883
2943
  {
2884
2944
  path: "flowTemplateConfig",
2885
2945
  displayName: "Flow Template Config",
@@ -2918,6 +2978,12 @@ registerAction({
2918
2978
  displayName: "Linked Resource Transaction Hash",
2919
2979
  type: "string",
2920
2980
  description: "On-chain transaction hash for adding the domain card linked resource"
2981
+ },
2982
+ {
2983
+ path: "parentLinkedEntityTransactionHash",
2984
+ displayName: "Parent Linked Entity Transaction Hash",
2985
+ type: "string",
2986
+ description: "On-chain transaction hash for linking the new POD to the selected parent entity"
2921
2987
  }
2922
2988
  ],
2923
2989
  pendingDisplayFields: ["entityDid", "governanceGroupCoreAddress"]
@@ -2951,6 +3017,7 @@ registerAction({
2951
3017
  const memberConfig = parseJsonInput(inputs.memberConfig);
2952
3018
  const flowTemplateConfig = parseJsonInput(inputs.flowTemplateConfig);
2953
3019
  const context = parseContextInput(inputs.context);
3020
+ const selectedParentEntityDid = getSelectedParentEntityDid(inputs);
2954
3021
  const selectedProtocolTemplates = getSelectedProtocolTemplates(flowTemplateConfig);
2955
3022
  const checkpointKey = getDomainSignCheckpointKey(inputs, ctx);
2956
3023
  let checkpoint = readDomainSignCheckpoint(ctx, checkpointKey) || {
@@ -3065,6 +3132,9 @@ registerAction({
3065
3132
  let newEntityDid = checkpoint.entityDid || "";
3066
3133
  let transactionHash = checkpoint.transactionHash || "";
3067
3134
  let linkedResourceTransactionHash = checkpoint.linkedResourceTransactionHash || "";
3135
+ const parentEntityDid = checkpoint.parentEntityDid || selectedParentEntityDid;
3136
+ let parentLinkedEntity = checkpoint.parentLinkedEntity;
3137
+ let parentLinkedEntityTransactionHash = checkpoint.parentLinkedEntityTransactionHash || "";
3068
3138
  let domainCardLinkedResource = checkpoint.domainCardLinkedResource;
3069
3139
  if (!checkpoint.completedSteps?.createDomain || !newEntityDid || !transactionHash) {
3070
3140
  const createResult = await handlers.createDomain({
@@ -3108,6 +3178,37 @@ registerAction({
3108
3178
  completedSteps: { addLinkedResource: true }
3109
3179
  });
3110
3180
  }
3181
+ if (parentEntityDid && (!checkpoint.completedSteps?.addParentLinkedEntity || !parentLinkedEntityTransactionHash)) {
3182
+ if (typeof handlers.createAddLinkedEntityMessage !== "function") {
3183
+ throw new Error("createAddLinkedEntityMessage handler not implemented");
3184
+ }
3185
+ parentLinkedEntity = parentLinkedEntity || {
3186
+ id: newEntityDid,
3187
+ type: entityType,
3188
+ relationship: "manages",
3189
+ service: ""
3190
+ };
3191
+ const addParentLinkedEntityMessage = await handlers.createAddLinkedEntityMessage({
3192
+ entityDid: parentEntityDid,
3193
+ linkedEntity: parentLinkedEntity
3194
+ });
3195
+ const addParentLinkedEntityResult = await handlers.executeTransaction({
3196
+ messages: [addParentLinkedEntityMessage],
3197
+ memo: ""
3198
+ });
3199
+ parentLinkedEntityTransactionHash = String(addParentLinkedEntityResult?.transactionHash || "");
3200
+ if (!parentLinkedEntityTransactionHash) {
3201
+ throw new Error("Parent linked entity transaction completed but no transaction hash received");
3202
+ }
3203
+ saveCheckpoint({
3204
+ parentEntityDid,
3205
+ parentLinkedEntity,
3206
+ parentLinkedEntityTransactionHash,
3207
+ completedSteps: { addParentLinkedEntity: true }
3208
+ });
3209
+ } else if (!parentEntityDid) {
3210
+ saveCheckpoint({ completedSteps: { addParentLinkedEntity: true } });
3211
+ }
3111
3212
  let domainSpaces = checkpoint.domainSpaces;
3112
3213
  let protocolTemplateImports = checkpoint.protocolTemplateImports || [];
3113
3214
  if (handlers.sourceDomainSpaces && (!checkpoint.completedSteps?.sourceDomainSpaces || !domainSpaces)) {
@@ -3160,11 +3261,14 @@ registerAction({
3160
3261
  governanceGroupCoreAddress,
3161
3262
  linkedEntities: governanceGroupLinkedEntities,
3162
3263
  linkedResources: [domainCardLinkedResource],
3264
+ parentEntityDid,
3265
+ parentLinkedEntity,
3163
3266
  flowTemplateConfig,
3164
3267
  domainSpaces,
3165
3268
  protocolTemplateImports,
3166
3269
  transactionHash,
3167
- linkedResourceTransactionHash
3270
+ linkedResourceTransactionHash,
3271
+ parentLinkedEntityTransactionHash
3168
3272
  };
3169
3273
  saveCheckpoint({
3170
3274
  status: "completed",
@@ -10126,4 +10230,4 @@ export {
10126
10230
  executeQueuedFlowAgentCoreCommands,
10127
10231
  FlowAgentService
10128
10232
  };
10129
- //# sourceMappingURL=chunk-XGQRYGA3.mjs.map
10233
+ //# sourceMappingURL=chunk-6CBTLK7K.mjs.map