@ixo/editor 5.20.0-experimental.1 → 5.20.0-experimental.2

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.
@@ -2778,21 +2778,33 @@ function writeDomainSignCheckpoint(ctx, key, checkpoint) {
2778
2778
  });
2779
2779
  }
2780
2780
  function buildCompletedDomainSignResult(output) {
2781
+ const payload = {
2782
+ entityDid: output.entityDid,
2783
+ governanceGroupCoreAddress: output.governanceGroupCoreAddress || "",
2784
+ transactionHash: output.transactionHash || "",
2785
+ linkedResourceTransactionHash: output.linkedResourceTransactionHash || "",
2786
+ ...output.parentLinkedEntityTransactionHash ? { parentLinkedEntityTransactionHash: output.parentLinkedEntityTransactionHash } : {}
2787
+ };
2781
2788
  return {
2782
2789
  output,
2783
2790
  events: [
2784
2791
  {
2785
2792
  name: "created",
2786
- payload: {
2787
- entityDid: output.entityDid,
2788
- governanceGroupCoreAddress: output.governanceGroupCoreAddress || "",
2789
- transactionHash: output.transactionHash || "",
2790
- linkedResourceTransactionHash: output.linkedResourceTransactionHash || ""
2791
- }
2793
+ payload
2792
2794
  }
2793
2795
  ]
2794
2796
  };
2795
2797
  }
2798
+ function readDidInput(value) {
2799
+ if (typeof value !== "string") return "";
2800
+ const did = value.trim();
2801
+ if (!did || did === "null" || did === "undefined") return "";
2802
+ return did.startsWith("did:") ? did : "";
2803
+ }
2804
+ function getSelectedParentEntityDid(inputs) {
2805
+ if (inputs.skipped === true || inputs.parentSkipped === true) return "";
2806
+ return readDidInput(inputs.selectedEntityDid) || readDidInput(inputs.parentDid) || readDidInput(inputs.parentDID);
2807
+ }
2796
2808
  function parseDuration(raw) {
2797
2809
  const seconds = parseInt(raw, 10) || 0;
2798
2810
  if (seconds % (7 * 86400) === 0) return { amount: seconds / (7 * 86400), unit: "weeks" };
@@ -2880,6 +2892,18 @@ registerAction({
2880
2892
  type: "string",
2881
2893
  description: "The on-chain transaction hash for adding the domain card linked resource"
2882
2894
  },
2895
+ {
2896
+ path: "parentEntityDid",
2897
+ displayName: "Parent Entity DID",
2898
+ type: "string",
2899
+ description: "The selected parent entity DID that was updated with the new POD linked entity"
2900
+ },
2901
+ {
2902
+ path: "parentLinkedEntityTransactionHash",
2903
+ displayName: "Parent Linked Entity Transaction Hash",
2904
+ type: "string",
2905
+ description: "The on-chain transaction hash for linking the new POD to the selected parent entity"
2906
+ },
2883
2907
  {
2884
2908
  path: "flowTemplateConfig",
2885
2909
  displayName: "Flow Template Config",
@@ -2918,6 +2942,12 @@ registerAction({
2918
2942
  displayName: "Linked Resource Transaction Hash",
2919
2943
  type: "string",
2920
2944
  description: "On-chain transaction hash for adding the domain card linked resource"
2945
+ },
2946
+ {
2947
+ path: "parentLinkedEntityTransactionHash",
2948
+ displayName: "Parent Linked Entity Transaction Hash",
2949
+ type: "string",
2950
+ description: "On-chain transaction hash for linking the new POD to the selected parent entity"
2921
2951
  }
2922
2952
  ],
2923
2953
  pendingDisplayFields: ["entityDid", "governanceGroupCoreAddress"]
@@ -2951,6 +2981,7 @@ registerAction({
2951
2981
  const memberConfig = parseJsonInput(inputs.memberConfig);
2952
2982
  const flowTemplateConfig = parseJsonInput(inputs.flowTemplateConfig);
2953
2983
  const context = parseContextInput(inputs.context);
2984
+ const selectedParentEntityDid = getSelectedParentEntityDid(inputs);
2954
2985
  const selectedProtocolTemplates = getSelectedProtocolTemplates(flowTemplateConfig);
2955
2986
  const checkpointKey = getDomainSignCheckpointKey(inputs, ctx);
2956
2987
  let checkpoint = readDomainSignCheckpoint(ctx, checkpointKey) || {
@@ -3065,6 +3096,9 @@ registerAction({
3065
3096
  let newEntityDid = checkpoint.entityDid || "";
3066
3097
  let transactionHash = checkpoint.transactionHash || "";
3067
3098
  let linkedResourceTransactionHash = checkpoint.linkedResourceTransactionHash || "";
3099
+ const parentEntityDid = checkpoint.parentEntityDid || selectedParentEntityDid;
3100
+ let parentLinkedEntity = checkpoint.parentLinkedEntity;
3101
+ let parentLinkedEntityTransactionHash = checkpoint.parentLinkedEntityTransactionHash || "";
3068
3102
  let domainCardLinkedResource = checkpoint.domainCardLinkedResource;
3069
3103
  if (!checkpoint.completedSteps?.createDomain || !newEntityDid || !transactionHash) {
3070
3104
  const createResult = await handlers.createDomain({
@@ -3108,6 +3142,37 @@ registerAction({
3108
3142
  completedSteps: { addLinkedResource: true }
3109
3143
  });
3110
3144
  }
3145
+ if (parentEntityDid && (!checkpoint.completedSteps?.addParentLinkedEntity || !parentLinkedEntityTransactionHash)) {
3146
+ if (typeof handlers.createAddLinkedEntityMessage !== "function") {
3147
+ throw new Error("createAddLinkedEntityMessage handler not implemented");
3148
+ }
3149
+ parentLinkedEntity = parentLinkedEntity || {
3150
+ id: newEntityDid,
3151
+ type: entityType,
3152
+ relationship: "manages",
3153
+ service: ""
3154
+ };
3155
+ const addParentLinkedEntityMessage = await handlers.createAddLinkedEntityMessage({
3156
+ entityDid: parentEntityDid,
3157
+ linkedEntity: parentLinkedEntity
3158
+ });
3159
+ const addParentLinkedEntityResult = await handlers.executeTransaction({
3160
+ messages: [addParentLinkedEntityMessage],
3161
+ memo: ""
3162
+ });
3163
+ parentLinkedEntityTransactionHash = String(addParentLinkedEntityResult?.transactionHash || "");
3164
+ if (!parentLinkedEntityTransactionHash) {
3165
+ throw new Error("Parent linked entity transaction completed but no transaction hash received");
3166
+ }
3167
+ saveCheckpoint({
3168
+ parentEntityDid,
3169
+ parentLinkedEntity,
3170
+ parentLinkedEntityTransactionHash,
3171
+ completedSteps: { addParentLinkedEntity: true }
3172
+ });
3173
+ } else if (!parentEntityDid) {
3174
+ saveCheckpoint({ completedSteps: { addParentLinkedEntity: true } });
3175
+ }
3111
3176
  let domainSpaces = checkpoint.domainSpaces;
3112
3177
  let protocolTemplateImports = checkpoint.protocolTemplateImports || [];
3113
3178
  if (handlers.sourceDomainSpaces && (!checkpoint.completedSteps?.sourceDomainSpaces || !domainSpaces)) {
@@ -3160,11 +3225,14 @@ registerAction({
3160
3225
  governanceGroupCoreAddress,
3161
3226
  linkedEntities: governanceGroupLinkedEntities,
3162
3227
  linkedResources: [domainCardLinkedResource],
3228
+ parentEntityDid,
3229
+ parentLinkedEntity,
3163
3230
  flowTemplateConfig,
3164
3231
  domainSpaces,
3165
3232
  protocolTemplateImports,
3166
3233
  transactionHash,
3167
- linkedResourceTransactionHash
3234
+ linkedResourceTransactionHash,
3235
+ parentLinkedEntityTransactionHash
3168
3236
  };
3169
3237
  saveCheckpoint({
3170
3238
  status: "completed",
@@ -10126,4 +10194,4 @@ export {
10126
10194
  executeQueuedFlowAgentCoreCommands,
10127
10195
  FlowAgentService
10128
10196
  };
10129
- //# sourceMappingURL=chunk-XGQRYGA3.mjs.map
10197
+ //# sourceMappingURL=chunk-OK3ILV2C.mjs.map