@blue-repository/types 0.22.0 → 0.23.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.
Files changed (29) hide show
  1. package/README.md +1 -1
  2. package/dist/meta.d.ts +2 -2
  3. package/dist/meta.d.ts.map +1 -1
  4. package/dist/meta.js +1 -0
  5. package/dist/meta.js.map +1 -1
  6. package/dist/packages/conversation/blue-ids.d.ts +3 -3
  7. package/dist/packages/conversation/blue-ids.js +3 -3
  8. package/dist/packages/conversation/contents/AcceptChangeWorkflow.d.ts +1 -1
  9. package/dist/packages/conversation/contents/AcceptChangeWorkflow.js +1 -1
  10. package/dist/packages/conversation/contents/AcceptChangeWorkflow.js.map +1 -1
  11. package/dist/packages/conversation/contents/ProposeChangeWorkflow.d.ts +1 -1
  12. package/dist/packages/conversation/contents/ProposeChangeWorkflow.js +1 -1
  13. package/dist/packages/conversation/contents/ProposeChangeWorkflow.js.map +1 -1
  14. package/dist/packages/conversation/contents/RejectChangeWorkflow.d.ts +1 -1
  15. package/dist/packages/conversation/contents/RejectChangeWorkflow.js +1 -1
  16. package/dist/packages/conversation/contents/RejectChangeWorkflow.js.map +1 -1
  17. package/dist/packages/conversation/contents/index.d.ts +80 -80
  18. package/dist/packages/conversation/contents/index.d.ts.map +1 -1
  19. package/dist/packages/conversation/contents/index.js +7 -7
  20. package/dist/packages/conversation/contents/index.js.map +1 -1
  21. package/dist/packages/conversation/index.d.ts +93 -93
  22. package/dist/packages/conversation/meta.d.ts +12 -12
  23. package/dist/packages/conversation/meta.js +9 -9
  24. package/dist/packages/conversation/meta.js.map +1 -1
  25. package/dist/packages/conversation/schemas/index.d.ts +3 -3
  26. package/dist/packages/conversation/schemas/index.js +3 -3
  27. package/dist/packages/conversation/schemas/index.js.map +1 -1
  28. package/dist/repository.d.ts +94 -94
  29. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  export declare const repository: {
2
2
  readonly name: "Blue Repository";
3
- readonly repositoryVersions: readonly ["CQn9FCus2xkhgCdSZQqKQmKGRLKnqTboSyiJXn3pya68", "22xxEjtpjUSpttaRiHX5XbmGNcFhpgLipai685YMdMWv", "58apGqo2EExaKTQQJmjASbj8p7tHvrWkoQVjWeWzaox5", "C6oygUcsKjgqmSej2DMZkuDMqT7frfFL3t11gHGMFebY", "5FLaqPWQ7FJF5DFyCy1H4Ry9SHvX2ByfLbgJ2U3QTqUx", "EpNsiwie3wUf5Hqeo9fdiycvemBQm681hXEaWPEKNAuF", "EpCTtQtiyxppoVxqFbVZLiV7684165ENL3M2qwJigMFP", "9HWPEq8AoXuWtmsqgbxYqFqpuizJg1RdXmfEQA1qhsbi", "2X96EiMnmws7kmgtS3bgGm38NHGBwXeViAxmGqkxyiDT", "Aig1A2dxJCJkXPYQLyPSXhXJUdBDULKq2cFVv1mv2Uvg", "FLEAJh7wxmniwWikxfZmDDZvHKjBKuNQeBbQUbBqdJ7E", "8woWtWYyJxmzPJhAv5SptmZJsyXAq2Q2ckF4jtwDQJPE"];
3
+ readonly repositoryVersions: readonly ["CQn9FCus2xkhgCdSZQqKQmKGRLKnqTboSyiJXn3pya68", "22xxEjtpjUSpttaRiHX5XbmGNcFhpgLipai685YMdMWv", "58apGqo2EExaKTQQJmjASbj8p7tHvrWkoQVjWeWzaox5", "C6oygUcsKjgqmSej2DMZkuDMqT7frfFL3t11gHGMFebY", "5FLaqPWQ7FJF5DFyCy1H4Ry9SHvX2ByfLbgJ2U3QTqUx", "EpNsiwie3wUf5Hqeo9fdiycvemBQm681hXEaWPEKNAuF", "EpCTtQtiyxppoVxqFbVZLiV7684165ENL3M2qwJigMFP", "9HWPEq8AoXuWtmsqgbxYqFqpuizJg1RdXmfEQA1qhsbi", "2X96EiMnmws7kmgtS3bgGm38NHGBwXeViAxmGqkxyiDT", "Aig1A2dxJCJkXPYQLyPSXhXJUdBDULKq2cFVv1mv2Uvg", "FLEAJh7wxmniwWikxfZmDDZvHKjBKuNQeBbQUbBqdJ7E", "8woWtWYyJxmzPJhAv5SptmZJsyXAq2Q2ckF4jtwDQJPE", "EQTRE5bBZZb7P6GB6r3p9scPTTgwbR1SHFhYePo3ji4x"];
4
4
  readonly packages: {
5
5
  readonly common: {
6
6
  readonly contents: {
@@ -108,44 +108,6 @@ export declare const repository: {
108
108
  readonly blueId: "36epvrpVHZLjapbeZsNodz2NDnm7XZeNZcnkWHgkP1pp";
109
109
  };
110
110
  };
111
- readonly '29xcoYKf9p47xagTDwGLuQyFrT9WBN3Sd7FaPtqLvydy': {
112
- readonly description: "Applies a previously proposed change and removes its proposal state.";
113
- readonly name: "Accept Change Workflow";
114
- readonly postfix: {
115
- readonly description: "Optional postfix used while building proposed change state key.";
116
- readonly type: {
117
- readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
118
- };
119
- };
120
- readonly steps: {
121
- readonly items: readonly [{
122
- readonly code: {
123
- readonly type: {
124
- readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
125
- };
126
- readonly value: "const invalid = (reason) => ({\n changeset: [],\n events: [{ type: 'Conversation/Proposed Change Invalid', reason }]\n});\n\nconst isArray = Array.isArray;\n\nconst postfixValue = currentContract?.postfix || '';\nconst proposedPath = '/proposedChange' + postfixValue;\n\nconst change = document(proposedPath);\nif (!change) {\n return invalid('no proposed change at ' + proposedPath);\n}\n\nconst requestChangeset = isArray(change?.changeset) ? change.changeset : [];\nconst sectionChanges = change.sectionChanges;\n\nconst entryPath = (entry) => `${entry?.path || ''}`;\nconst isContractsPath = (p) => p === '/contracts' || p.startsWith('/contracts/');\nconst isProposedChangePath = (p) => p.startsWith('/proposedChange');\n\nconst contracts = document('/contracts') || {};\nconst policy = Object.values(contracts).find((c) => c?.requireSectionChanges !== undefined);\nconst policyEnabled = !!policy && policy.requireSectionChanges !== false;\n\nif (\n policyEnabled &&\n requestChangeset.some((e) => isContractsPath(entryPath(e)))\n) {\n return invalid('changeset cannot modify /contracts when Contracts Change Policy is enabled');\n}\n\nif (requestChangeset.some((e) => isProposedChangePath(entryPath(e)))) {\n return invalid('changeset cannot modify /proposedChange');\n}\n\nconst escapePointer = (value) =>\n `${value}`.split('~').join('~0').split('/').join('~1');\n\nconst contractPtr = (key) => '/contracts/' + escapePointer(key);\n\nconst isMetaKey = (key) =>\n key === 'type' || key === 'keyType' || key === 'valueType' || key === 'description';\n\nconst contractKeysFromMap = (contractsMap) =>\n Object.keys(contractsMap || {}).filter((k) => !isMetaKey(k));\n\nconst normalizeSection = (section, contractKeys) => ({\n ...(section || {}),\n type: 'Conversation/Document Section',\n relatedContracts: (section?.relatedContracts?.length ? section.relatedContracts : contractKeys)\n});\n\nconst hasMatchingRelatedContracts = (section, contractKeys) => {\n const related = isArray(section?.relatedContracts)\n ? section.relatedContracts.map((value) => `${value}`)\n : [];\n if (!related.length) {\n return true;\n }\n if (related.length !== contractKeys.length) {\n return false;\n }\n const relatedMap = {};\n for (const value of related) {\n const key = `${value}`;\n relatedMap[key] = (relatedMap[key] || 0) + 1;\n }\n if (Object.keys(relatedMap).length !== contractKeys.length) {\n return false;\n }\n for (const key of contractKeys) {\n if (!relatedMap[key]) {\n return false;\n }\n }\n return true;\n};\n\nconst sectionChangeset = [];\nconst seenSectionKeys = {};\nconst seenContractKeys = {};\nconst existingContractKeys = {};\nfor (const key of Object.keys(contracts || {}).filter((k) => !isMetaKey(k))) {\n existingContractKeys[key] = true;\n}\n\nconst trackSectionKey = (sectionKey) => {\n if (seenSectionKeys[sectionKey]) {\n return invalid(`section key duplicated in sectionChanges: ${sectionKey}`);\n }\n seenSectionKeys[sectionKey] = true;\n return null;\n};\n\nconst trackContractKey = (sectionKey, contractKey) => {\n const existingSection = seenContractKeys[contractKey];\n if (existingSection && existingSection !== sectionKey) {\n return invalid(`contract key used by multiple sections in request: ${contractKey}`);\n }\n seenContractKeys[contractKey] = sectionKey;\n return null;\n};\n\nconst addList = isArray(sectionChanges?.add) ? sectionChanges.add : [];\nfor (const entry of addList) {\n const sectionKey = `${entry?.sectionKey || ''}`;\n if (!sectionKey) return invalid('sectionChanges.add is missing sectionKey');\n\n const sectionKeyDup = trackSectionKey(sectionKey);\n if (sectionKeyDup) return sectionKeyDup;\n\n if (existingContractKeys[sectionKey]) {\n return invalid(`contract key already exists at ${contractPtr(sectionKey)}`);\n }\n\n const contractsMap = entry?.contracts || {};\n const contractKeys = contractKeysFromMap(contractsMap).map((key) => `${key}`);\n\n if (!hasMatchingRelatedContracts(entry?.section, contractKeys)) {\n return invalid('relatedContracts must match contracts');\n }\n\n for (const key of contractKeys) {\n if (existingContractKeys[key]) {\n return invalid(`contract key already exists at ${contractPtr(key)}`);\n }\n const dup = trackContractKey(sectionKey, key);\n if (dup) return dup;\n }\n\n for (const key of contractKeys) {\n sectionChangeset.push({ op: 'add', path: contractPtr(key), val: contractsMap[key] });\n }\n\n sectionChangeset.push({\n op: 'add',\n path: contractPtr(sectionKey),\n val: normalizeSection(entry?.section, contractKeys)\n });\n}\n\nconst modifyList = isArray(sectionChanges?.modify) ? sectionChanges.modify : [];\nfor (const entry of modifyList) {\n const sectionKey = `${entry?.sectionKey || ''}`;\n if (!sectionKey) return invalid('sectionChanges.modify is missing sectionKey');\n\n const sectionKeyDup = trackSectionKey(sectionKey);\n if (sectionKeyDup) return sectionKeyDup;\n\n const existingRelated = isArray(contracts?.[sectionKey]?.relatedContracts)\n ? contracts[sectionKey].relatedContracts.map((value) => `${value}`)\n : [];\n const existingRelatedMap = {};\n for (const value of existingRelated) {\n existingRelatedMap[`${value}`] = true;\n }\n\n const contractsMap = entry?.contracts || {};\n const contractKeys = contractKeysFromMap(contractsMap).map((key) => `${key}`);\n\n if (!hasMatchingRelatedContracts(entry?.section, contractKeys)) {\n return invalid('relatedContracts must match contracts');\n }\n\n for (const key of contractKeys) {\n const dup = trackContractKey(sectionKey, key);\n if (dup) return dup;\n if (existingContractKeys[key] && !existingRelatedMap[key]) {\n return invalid(`contract key already exists at ${contractPtr(key)}`);\n }\n }\n\n for (const key of contractKeys) {\n sectionChangeset.push({ op: 'add', path: contractPtr(key), val: contractsMap[key] });\n }\n\n for (const oldKey of existingRelated) {\n if (contractKeys.indexOf(oldKey) === -1) {\n sectionChangeset.push({ op: 'remove', path: contractPtr(oldKey) });\n }\n }\n\n sectionChangeset.push({\n op: 'add',\n path: contractPtr(sectionKey),\n val: normalizeSection(entry?.section, contractKeys)\n });\n}\n\nconst removeList = isArray(sectionChanges?.remove) ? sectionChanges.remove : [];\nfor (const entry of removeList) {\n const sectionKey = `${entry?.sectionKey || entry || ''}`;\n if (!sectionKey) return invalid('sectionChanges.remove is missing sectionKey');\n\n const related = isArray(contracts?.[sectionKey]?.relatedContracts)\n ? contracts[sectionKey].relatedContracts\n : [];\n\n for (const key of related) {\n sectionChangeset.push({ op: 'remove', path: contractPtr(key) });\n }\n sectionChangeset.push({ op: 'remove', path: contractPtr(sectionKey) });\n}\n\nconst combined = sectionChangeset.concat(requestChangeset);\n\nif (combined.length === 0) {\n return invalid('no changes provided');\n}\n\nreturn {\n changeset: combined.concat({ op: 'remove', path: proposedPath })\n};\n";
127
- };
128
- readonly name: "Prepare";
129
- readonly type: {
130
- readonly blueId: "ExZxT61PSpWHpEAtP2WKMXXqxEYN7Z13j7Zv36Dp99kS";
131
- };
132
- }, {
133
- readonly changeset: {
134
- readonly type: {
135
- readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
136
- };
137
- readonly value: "${steps.Prepare.changeset}";
138
- };
139
- readonly name: "Apply";
140
- readonly type: {
141
- readonly blueId: "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa";
142
- };
143
- }];
144
- };
145
- readonly type: {
146
- readonly blueId: "CGdxkNjPcsdescqLPz6SNLsMyak6demQQr7RoKNHbCyv";
147
- };
148
- };
149
111
  readonly '2bSWEoMSZwzf32Hnr4BDVsuq8NRjrWEpnhZvMZAJGhh2': {
150
112
  readonly description: "Conversation workflow step that enqueues an event as part of the workflow.\n- Gas accounting (when and what is charged):\n - Base step charge (once per run of this step): 30.\n - Expression/template resolution under \"/event\" (if present):\n - Expressions run in the deterministic QuickJS VM (same sandbox and\n bindings as the JavaScript Code step).\n - VM gas is converted to host gas as:\n hostGas = ceil(wasmFuel / 1700)\n (calibration factor currently 1700 fuel per host gas unit).\n - Any document(<pointer>) used inside expressions/templates charges\n per call: 8 + depth(pointer) + ceil(snapshotBytes/100).\n - Event emission (enqueue): 20 + ceil(eventBytes/100) for the final event\n payload after expression resolution.\n";
151
113
  readonly event: {
@@ -626,7 +588,7 @@ export declare const repository: {
626
588
  readonly blueId: "8f9UhHMbRe62sFgzQVheToaJPYi7t7HPNVvpQTbqfL5n";
627
589
  };
628
590
  };
629
- readonly '7dUt8jiX5vGeZL7wVzWFA8uEw37T6oPgC8KyDZmqxeSj': {
591
+ readonly '7icTT1chbH3UA2ybXgpfSSyNEAR4Wmm3EkbdGFaZSydo': {
630
592
  readonly description: "Stores a proposed change under /proposedChange{postfix}.";
631
593
  readonly name: "Propose Change Workflow";
632
594
  readonly postfix: {
@@ -647,7 +609,7 @@ export declare const repository: {
647
609
  readonly type: {
648
610
  readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
649
611
  };
650
- readonly value: "const invalid = (reason) => ({\n changeset: [],\n events: [{ type: 'Conversation/Proposed Change Invalid', reason }]\n});\n\nconst request = event.message.request;\n\nconst summary = request?.summary;\nif (!summary || typeof summary !== 'string') {\n return invalid('summary is missing');\n}\n\nconst postfixValue = currentContract?.postfix || '';\nconst path = '/proposedChange' + postfixValue;\n\nif (document(path)) {\n return invalid('proposed change already exists at ' + path);\n}\n\nreturn {\n changeset: [{ op: 'add', path, val: request }]\n};\n";
612
+ readonly value: "const invalid = (reason) => ({\n changeset: [],\n events: [{ type: 'Conversation/Proposed Change Invalid', reason }]\n});\n\nconst request = event.message.request;\n\nconst summary = request?.summary;\nif (!summary || typeof summary !== 'string') {\n return invalid('summary is missing');\n}\n\nconst postfixNode = canon.at(currentContractCanonical, '/postfix');\nconst postfixValue =\n typeof postfixNode?.value === 'string' ? postfixNode.value : '';\nconst path = '/proposedChange' + postfixValue;\n\nif (document(path)) {\n return invalid('proposed change already exists at ' + path);\n}\n\nreturn {\n changeset: [{ op: 'add', path, val: request }]\n};\n";
651
613
  };
652
614
  readonly name: "Prepare";
653
615
  readonly type: {
@@ -733,44 +695,6 @@ export declare const repository: {
733
695
  readonly blueId: "5Wz4G9qcnBJnntYRkz4dgLK5bSuoMpYJZj4j5M59z4we";
734
696
  };
735
697
  };
736
- readonly '9fnXwi4Za8hjEj6zDSEjhbA5dLrDzs7sxoDMGLmRT2Gz': {
737
- readonly description: "Discards a previously proposed change by removing its proposal state.";
738
- readonly name: "Reject Change Workflow";
739
- readonly postfix: {
740
- readonly description: "Optional postfix used while building proposed change state key.";
741
- readonly type: {
742
- readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
743
- };
744
- };
745
- readonly steps: {
746
- readonly items: readonly [{
747
- readonly code: {
748
- readonly type: {
749
- readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
750
- };
751
- readonly value: "const invalid = (reason) => ({\n changeset: [],\n events: [{ type: 'Conversation/Proposed Change Invalid', reason }]\n});\n\nconst postfixValue = currentContract?.postfix || '';\nconst path = '/proposedChange' + postfixValue;\n\nif (!document(path)) {\n return invalid('no proposed change at ' + path);\n}\n\nreturn {\n changeset: [{ op: 'remove', path }]\n};\n";
752
- };
753
- readonly name: "Prepare";
754
- readonly type: {
755
- readonly blueId: "ExZxT61PSpWHpEAtP2WKMXXqxEYN7Z13j7Zv36Dp99kS";
756
- };
757
- }, {
758
- readonly changeset: {
759
- readonly type: {
760
- readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
761
- };
762
- readonly value: "${steps.Prepare.changeset}";
763
- };
764
- readonly name: "Apply";
765
- readonly type: {
766
- readonly blueId: "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa";
767
- };
768
- }];
769
- };
770
- readonly type: {
771
- readonly blueId: "CGdxkNjPcsdescqLPz6SNLsMyak6demQQr7RoKNHbCyv";
772
- };
773
- };
774
698
  readonly '9h1AhEexkxxKLYv1NHbEESYCPtvW7Nt51msGtuQC5jWK': {
775
699
  readonly name: "Customer Consent Revoked";
776
700
  readonly reason: {
@@ -937,6 +861,44 @@ export declare const repository: {
937
861
  };
938
862
  };
939
863
  };
864
+ readonly DUjCaEniHH5oDXU3Ss5jWWft3pT9TUcNhv7HoCDU1NTB: {
865
+ readonly description: "Discards a previously proposed change by removing its proposal state.";
866
+ readonly name: "Reject Change Workflow";
867
+ readonly postfix: {
868
+ readonly description: "Optional postfix used while building proposed change state key.";
869
+ readonly type: {
870
+ readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
871
+ };
872
+ };
873
+ readonly steps: {
874
+ readonly items: readonly [{
875
+ readonly code: {
876
+ readonly type: {
877
+ readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
878
+ };
879
+ readonly value: "const invalid = (reason) => ({\n changeset: [],\n events: [{ type: 'Conversation/Proposed Change Invalid', reason }]\n});\n\nconst postfixNode = canon.at(currentContractCanonical, '/postfix');\nconst postfixValue =\n typeof postfixNode?.value === 'string' ? postfixNode.value : '';\nconst path = '/proposedChange' + postfixValue;\n\nif (!document(path)) {\n return invalid('no proposed change at ' + path);\n}\n\nreturn {\n changeset: [{ op: 'remove', path }]\n};\n";
880
+ };
881
+ readonly name: "Prepare";
882
+ readonly type: {
883
+ readonly blueId: "ExZxT61PSpWHpEAtP2WKMXXqxEYN7Z13j7Zv36Dp99kS";
884
+ };
885
+ }, {
886
+ readonly changeset: {
887
+ readonly type: {
888
+ readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
889
+ };
890
+ readonly value: "${steps.Prepare.changeset}";
891
+ };
892
+ readonly name: "Apply";
893
+ readonly type: {
894
+ readonly blueId: "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa";
895
+ };
896
+ }];
897
+ };
898
+ readonly type: {
899
+ readonly blueId: "CGdxkNjPcsdescqLPz6SNLsMyak6demQQr7RoKNHbCyv";
900
+ };
901
+ };
940
902
  readonly EbGQYtYR9UNAxcn7auCCujXmnz6DWxMpqVcgYSsKE85M: {
941
903
  readonly description: "Emitted when a proposed change operation cannot be applied.";
942
904
  readonly name: "Proposed Change Invalid";
@@ -950,6 +912,44 @@ export declare const repository: {
950
912
  readonly blueId: "5Wz4G9qcnBJnntYRkz4dgLK5bSuoMpYJZj4j5M59z4we";
951
913
  };
952
914
  };
915
+ readonly Eh2y8JypsGTdFMpEGEK64vBdGtaJ9Q7Q5t7ChqHafwCV: {
916
+ readonly description: "Applies a previously proposed change and removes its proposal state.";
917
+ readonly name: "Accept Change Workflow";
918
+ readonly postfix: {
919
+ readonly description: "Optional postfix used while building proposed change state key.";
920
+ readonly type: {
921
+ readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
922
+ };
923
+ };
924
+ readonly steps: {
925
+ readonly items: readonly [{
926
+ readonly code: {
927
+ readonly type: {
928
+ readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
929
+ };
930
+ readonly value: "const invalid = (reason) => ({\n changeset: [],\n events: [{ type: 'Conversation/Proposed Change Invalid', reason }]\n});\n\nconst isArray = Array.isArray;\n\nconst postfixNode = canon.at(currentContractCanonical, '/postfix');\nconst postfixValue =\n typeof postfixNode?.value === 'string' ? postfixNode.value : '';\nconst proposedPath = '/proposedChange' + postfixValue;\n\nconst change = document(proposedPath);\nif (!change) {\n return invalid('no proposed change at ' + proposedPath);\n}\n\nconst requestChangeset = isArray(change?.changeset) ? change.changeset : [];\nconst sectionChanges = change.sectionChanges;\n\nconst entryPath = (entry) => `${entry?.path || ''}`;\nconst isContractsPath = (p) => p === '/contracts' || p.startsWith('/contracts/');\nconst isProposedChangePath = (p) => p.startsWith('/proposedChange');\n\nconst contracts = document('/contracts') || {};\nconst policy = Object.values(contracts).find((c) => c?.requireSectionChanges !== undefined);\nconst policyEnabled = !!policy && policy.requireSectionChanges !== false;\n\nif (\n policyEnabled &&\n requestChangeset.some((e) => isContractsPath(entryPath(e)))\n) {\n return invalid('changeset cannot modify /contracts when Contracts Change Policy is enabled');\n}\n\nif (requestChangeset.some((e) => isProposedChangePath(entryPath(e)))) {\n return invalid('changeset cannot modify /proposedChange');\n}\n\nconst escapePointer = (value) =>\n `${value}`.split('~').join('~0').split('/').join('~1');\n\nconst contractPtr = (key) => '/contracts/' + escapePointer(key);\n\nconst isMetaKey = (key) =>\n key === 'type' || key === 'keyType' || key === 'valueType' || key === 'description';\n\nconst contractKeysFromMap = (contractsMap) =>\n Object.keys(contractsMap || {}).filter((k) => !isMetaKey(k));\n\nconst normalizeSection = (section, contractKeys) => ({\n ...(section || {}),\n type: 'Conversation/Document Section',\n relatedContracts: (section?.relatedContracts?.length ? section.relatedContracts : contractKeys)\n});\n\nconst hasMatchingRelatedContracts = (section, contractKeys) => {\n const related = isArray(section?.relatedContracts)\n ? section.relatedContracts.map((value) => `${value}`)\n : [];\n if (!related.length) {\n return true;\n }\n if (related.length !== contractKeys.length) {\n return false;\n }\n const relatedMap = {};\n for (const value of related) {\n const key = `${value}`;\n relatedMap[key] = (relatedMap[key] || 0) + 1;\n }\n if (Object.keys(relatedMap).length !== contractKeys.length) {\n return false;\n }\n for (const key of contractKeys) {\n if (!relatedMap[key]) {\n return false;\n }\n }\n return true;\n};\n\nconst sectionChangeset = [];\nconst seenSectionKeys = {};\nconst seenContractKeys = {};\nconst existingContractKeys = {};\nfor (const key of Object.keys(contracts || {}).filter((k) => !isMetaKey(k))) {\n existingContractKeys[key] = true;\n}\n\nconst trackSectionKey = (sectionKey) => {\n if (seenSectionKeys[sectionKey]) {\n return invalid(`section key duplicated in sectionChanges: ${sectionKey}`);\n }\n seenSectionKeys[sectionKey] = true;\n return null;\n};\n\nconst trackContractKey = (sectionKey, contractKey) => {\n const existingSection = seenContractKeys[contractKey];\n if (existingSection && existingSection !== sectionKey) {\n return invalid(`contract key used by multiple sections in request: ${contractKey}`);\n }\n seenContractKeys[contractKey] = sectionKey;\n return null;\n};\n\nconst addList = isArray(sectionChanges?.add) ? sectionChanges.add : [];\nfor (const entry of addList) {\n const sectionKey = `${entry?.sectionKey || ''}`;\n if (!sectionKey) return invalid('sectionChanges.add is missing sectionKey');\n\n const sectionKeyDup = trackSectionKey(sectionKey);\n if (sectionKeyDup) return sectionKeyDup;\n\n if (existingContractKeys[sectionKey]) {\n return invalid(`contract key already exists at ${contractPtr(sectionKey)}`);\n }\n\n const contractsMap = entry?.contracts || {};\n const contractKeys = contractKeysFromMap(contractsMap).map((key) => `${key}`);\n\n if (!hasMatchingRelatedContracts(entry?.section, contractKeys)) {\n return invalid('relatedContracts must match contracts');\n }\n\n for (const key of contractKeys) {\n if (existingContractKeys[key]) {\n return invalid(`contract key already exists at ${contractPtr(key)}`);\n }\n const dup = trackContractKey(sectionKey, key);\n if (dup) return dup;\n }\n\n for (const key of contractKeys) {\n sectionChangeset.push({ op: 'add', path: contractPtr(key), val: contractsMap[key] });\n }\n\n sectionChangeset.push({\n op: 'add',\n path: contractPtr(sectionKey),\n val: normalizeSection(entry?.section, contractKeys)\n });\n}\n\nconst modifyList = isArray(sectionChanges?.modify) ? sectionChanges.modify : [];\nfor (const entry of modifyList) {\n const sectionKey = `${entry?.sectionKey || ''}`;\n if (!sectionKey) return invalid('sectionChanges.modify is missing sectionKey');\n\n const sectionKeyDup = trackSectionKey(sectionKey);\n if (sectionKeyDup) return sectionKeyDup;\n\n const existingRelated = isArray(contracts?.[sectionKey]?.relatedContracts)\n ? contracts[sectionKey].relatedContracts.map((value) => `${value}`)\n : [];\n const existingRelatedMap = {};\n for (const value of existingRelated) {\n existingRelatedMap[`${value}`] = true;\n }\n\n const contractsMap = entry?.contracts || {};\n const contractKeys = contractKeysFromMap(contractsMap).map((key) => `${key}`);\n\n if (!hasMatchingRelatedContracts(entry?.section, contractKeys)) {\n return invalid('relatedContracts must match contracts');\n }\n\n for (const key of contractKeys) {\n const dup = trackContractKey(sectionKey, key);\n if (dup) return dup;\n if (existingContractKeys[key] && !existingRelatedMap[key]) {\n return invalid(`contract key already exists at ${contractPtr(key)}`);\n }\n }\n\n for (const key of contractKeys) {\n sectionChangeset.push({ op: 'add', path: contractPtr(key), val: contractsMap[key] });\n }\n\n for (const oldKey of existingRelated) {\n if (contractKeys.indexOf(oldKey) === -1) {\n sectionChangeset.push({ op: 'remove', path: contractPtr(oldKey) });\n }\n }\n\n sectionChangeset.push({\n op: 'add',\n path: contractPtr(sectionKey),\n val: normalizeSection(entry?.section, contractKeys)\n });\n}\n\nconst removeList = isArray(sectionChanges?.remove) ? sectionChanges.remove : [];\nfor (const entry of removeList) {\n const sectionKey = `${entry?.sectionKey || entry || ''}`;\n if (!sectionKey) return invalid('sectionChanges.remove is missing sectionKey');\n\n const related = isArray(contracts?.[sectionKey]?.relatedContracts)\n ? contracts[sectionKey].relatedContracts\n : [];\n\n for (const key of related) {\n sectionChangeset.push({ op: 'remove', path: contractPtr(key) });\n }\n sectionChangeset.push({ op: 'remove', path: contractPtr(sectionKey) });\n}\n\nconst combined = sectionChangeset.concat(requestChangeset);\n\nif (combined.length === 0) {\n return invalid('no changes provided');\n}\n\nreturn {\n changeset: combined.concat({ op: 'remove', path: proposedPath })\n};\n";
931
+ };
932
+ readonly name: "Prepare";
933
+ readonly type: {
934
+ readonly blueId: "ExZxT61PSpWHpEAtP2WKMXXqxEYN7Z13j7Zv36Dp99kS";
935
+ };
936
+ }, {
937
+ readonly changeset: {
938
+ readonly type: {
939
+ readonly blueId: "DLRQwz7MQeCrzjy9bohPNwtCxKEBbKaMK65KBrwjfG6K";
940
+ };
941
+ readonly value: "${steps.Prepare.changeset}";
942
+ };
943
+ readonly name: "Apply";
944
+ readonly type: {
945
+ readonly blueId: "FtHZJzH4hqAoGxFBjsmy1svfT4BwEBB4aHpFSZycZLLa";
946
+ };
947
+ }];
948
+ };
949
+ readonly type: {
950
+ readonly blueId: "CGdxkNjPcsdescqLPz6SNLsMyak6demQQr7RoKNHbCyv";
951
+ };
952
+ };
953
953
  readonly EhPFqrRCreg7StsZEcW8fRQ1FQVdqYSsMSis2CHHJZ1G: {
954
954
  readonly description: "A successful final state. The document has achieved its goal and its\nprocess has finished as expected.\n";
955
955
  readonly mode: {
@@ -1239,7 +1239,7 @@ export declare const repository: {
1239
1239
  channel?: string | undefined;
1240
1240
  request?: import("@blue-labs/language").BlueNode | undefined;
1241
1241
  }>;
1242
- readonly '29xcoYKf9p47xagTDwGLuQyFrT9WBN3Sd7FaPtqLvydy': import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
1242
+ readonly Eh2y8JypsGTdFMpEGEK64vBdGtaJ9Q7Q5t7ChqHafwCV: import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
1243
1243
  description: import("zod").ZodOptional<import("zod").ZodString>;
1244
1244
  name: import("zod").ZodOptional<import("zod").ZodString>;
1245
1245
  order: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -4678,7 +4678,7 @@ export declare const repository: {
4678
4678
  } | undefined;
4679
4679
  } | undefined;
4680
4680
  }>;
4681
- readonly '7dUt8jiX5vGeZL7wVzWFA8uEw37T6oPgC8KyDZmqxeSj': import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
4681
+ readonly '7icTT1chbH3UA2ybXgpfSSyNEAR4Wmm3EkbdGFaZSydo': import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
4682
4682
  description: import("zod").ZodOptional<import("zod").ZodString>;
4683
4683
  name: import("zod").ZodOptional<import("zod").ZodString>;
4684
4684
  order: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -5273,7 +5273,7 @@ export declare const repository: {
5273
5273
  channel?: string | undefined;
5274
5274
  request?: import("@blue-labs/language").BlueNode | undefined;
5275
5275
  }>;
5276
- readonly '9fnXwi4Za8hjEj6zDSEjhbA5dLrDzs7sxoDMGLmRT2Gz': import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
5276
+ readonly DUjCaEniHH5oDXU3Ss5jWWft3pT9TUcNhv7HoCDU1NTB: import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
5277
5277
  description: import("zod").ZodOptional<import("zod").ZodString>;
5278
5278
  name: import("zod").ZodOptional<import("zod").ZodString>;
5279
5279
  order: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -5724,7 +5724,7 @@ export declare const repository: {
5724
5724
  };
5725
5725
  readonly aliases: {
5726
5726
  readonly 'Conversation/Accept Change Operation': "APk3siB8g9pvWLG3qyqtGjRNNGB7RDpFWQtG4epj5Avv";
5727
- readonly 'Conversation/Accept Change Workflow': "29xcoYKf9p47xagTDwGLuQyFrT9WBN3Sd7FaPtqLvydy";
5727
+ readonly 'Conversation/Accept Change Workflow': "Eh2y8JypsGTdFMpEGEK64vBdGtaJ9Q7Q5t7ChqHafwCV";
5728
5728
  readonly 'Conversation/Actor': "CN5efWVizJbRsMCw8YWRfT2q9vM9XfeGDN9wFvYcvMnQ";
5729
5729
  readonly 'Conversation/Change Operation': "Hd5uuFjqxyw5mrFPgJf2mcatij8ddtmGAMJu9ij5K1tc";
5730
5730
  readonly 'Conversation/Change Request': "FW7iYkzig4fepCdwfCdgNJw4DQ1fKwnAUf3YpjgfTPmG";
@@ -5751,10 +5751,10 @@ export declare const repository: {
5751
5751
  readonly 'Conversation/Operation': "BoAiqVUZv9Fum3wFqaX2JnQMBHJLxJSo2V9U2UBmCfsC";
5752
5752
  readonly 'Conversation/Operation Request': "HM4Ku4LFcjC5MxnhPMRwQ8w3BbHmJKKZfHTTzsd4jbJq";
5753
5753
  readonly 'Conversation/Propose Change Operation': "BeiedmmcKDhStxDnnQqUaXDJLofWSnqX6CazKTvVpfbW";
5754
- readonly 'Conversation/Propose Change Workflow': "7dUt8jiX5vGeZL7wVzWFA8uEw37T6oPgC8KyDZmqxeSj";
5754
+ readonly 'Conversation/Propose Change Workflow': "7icTT1chbH3UA2ybXgpfSSyNEAR4Wmm3EkbdGFaZSydo";
5755
5755
  readonly 'Conversation/Proposed Change Invalid': "EbGQYtYR9UNAxcn7auCCujXmnz6DWxMpqVcgYSsKE85M";
5756
5756
  readonly 'Conversation/Reject Change Operation': "4T5AmhKAXSJAAHDEjtVJ2FQgCyz2qyd9qG5uoh627Ux6";
5757
- readonly 'Conversation/Reject Change Workflow': "9fnXwi4Za8hjEj6zDSEjhbA5dLrDzs7sxoDMGLmRT2Gz";
5757
+ readonly 'Conversation/Reject Change Workflow': "DUjCaEniHH5oDXU3Ss5jWWft3pT9TUcNhv7HoCDU1NTB";
5758
5758
  readonly 'Conversation/Request': "8f9UhHMbRe62sFgzQVheToaJPYi7t7HPNVvpQTbqfL5n";
5759
5759
  readonly 'Conversation/Response': "36epvrpVHZLjapbeZsNodz2NDnm7XZeNZcnkWHgkP1pp";
5760
5760
  readonly 'Conversation/Sequential Workflow': "7X3LkN54Yp88JgZbppPhP6hM3Jqiqv8Z2i4kS7phXtQe";
@@ -5782,12 +5782,12 @@ export declare const repository: {
5782
5782
  readonly attributesAdded: readonly [];
5783
5783
  }];
5784
5784
  };
5785
- readonly '29xcoYKf9p47xagTDwGLuQyFrT9WBN3Sd7FaPtqLvydy': {
5785
+ readonly Eh2y8JypsGTdFMpEGEK64vBdGtaJ9Q7Q5t7ChqHafwCV: {
5786
5786
  readonly status: "dev";
5787
5787
  readonly name: "Accept Change Workflow";
5788
5788
  readonly versions: readonly [{
5789
- readonly repositoryVersionIndex: 1;
5790
- readonly typeBlueId: "29xcoYKf9p47xagTDwGLuQyFrT9WBN3Sd7FaPtqLvydy";
5789
+ readonly repositoryVersionIndex: 12;
5790
+ readonly typeBlueId: "Eh2y8JypsGTdFMpEGEK64vBdGtaJ9Q7Q5t7ChqHafwCV";
5791
5791
  readonly attributesAdded: readonly [];
5792
5792
  }];
5793
5793
  };
@@ -6025,12 +6025,12 @@ export declare const repository: {
6025
6025
  readonly attributesAdded: readonly [];
6026
6026
  }];
6027
6027
  };
6028
- readonly '7dUt8jiX5vGeZL7wVzWFA8uEw37T6oPgC8KyDZmqxeSj': {
6028
+ readonly '7icTT1chbH3UA2ybXgpfSSyNEAR4Wmm3EkbdGFaZSydo': {
6029
6029
  readonly status: "dev";
6030
6030
  readonly name: "Propose Change Workflow";
6031
6031
  readonly versions: readonly [{
6032
- readonly repositoryVersionIndex: 2;
6033
- readonly typeBlueId: "7dUt8jiX5vGeZL7wVzWFA8uEw37T6oPgC8KyDZmqxeSj";
6032
+ readonly repositoryVersionIndex: 12;
6033
+ readonly typeBlueId: "7icTT1chbH3UA2ybXgpfSSyNEAR4Wmm3EkbdGFaZSydo";
6034
6034
  readonly attributesAdded: readonly [];
6035
6035
  }];
6036
6036
  };
@@ -6052,12 +6052,12 @@ export declare const repository: {
6052
6052
  readonly attributesAdded: readonly [];
6053
6053
  }];
6054
6054
  };
6055
- readonly '9fnXwi4Za8hjEj6zDSEjhbA5dLrDzs7sxoDMGLmRT2Gz': {
6055
+ readonly DUjCaEniHH5oDXU3Ss5jWWft3pT9TUcNhv7HoCDU1NTB: {
6056
6056
  readonly status: "dev";
6057
6057
  readonly name: "Reject Change Workflow";
6058
6058
  readonly versions: readonly [{
6059
- readonly repositoryVersionIndex: 1;
6060
- readonly typeBlueId: "9fnXwi4Za8hjEj6zDSEjhbA5dLrDzs7sxoDMGLmRT2Gz";
6059
+ readonly repositoryVersionIndex: 12;
6060
+ readonly typeBlueId: "DUjCaEniHH5oDXU3Ss5jWWft3pT9TUcNhv7HoCDU1NTB";
6061
6061
  readonly attributesAdded: readonly [];
6062
6062
  }];
6063
6063
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blue-repository/types",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "repository": {
@@ -100,6 +100,6 @@
100
100
  },
101
101
  "blueType": {
102
102
  "moduleName": "Blue Repository",
103
- "moduleBlueId": "8woWtWYyJxmzPJhAv5SptmZJsyXAq2Q2ckF4jtwDQJPE"
103
+ "moduleBlueId": "EQTRE5bBZZb7P6GB6r3p9scPTTgwbR1SHFhYePo3ji4x"
104
104
  }
105
105
  }