@powerhousedao/shared 6.1.0-dev.2 → 6.1.0-dev.21

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 (105) hide show
  1. package/dist/analytics/index.d.ts +1 -1
  2. package/dist/clis/args/access-token.mjs +1 -1
  3. package/dist/clis/args/common-BQ2pvhCr.d.mts.map +1 -1
  4. package/dist/clis/args/{common-DPYlcz-d.mjs → common-fPNESurz.mjs} +4 -9
  5. package/dist/clis/args/common-fPNESurz.mjs.map +1 -0
  6. package/dist/clis/args/common.mjs +1 -1
  7. package/dist/clis/args/connect.d.mts +219 -13
  8. package/dist/clis/args/connect.d.mts.map +1 -1
  9. package/dist/clis/args/connect.mjs +138 -4
  10. package/dist/clis/args/connect.mjs.map +1 -1
  11. package/dist/clis/args/{generate-BJPBa0mK.mjs → generate-CTTdiwMD.mjs} +2 -2
  12. package/dist/clis/args/{generate-BJPBa0mK.mjs.map → generate-CTTdiwMD.mjs.map} +1 -1
  13. package/dist/clis/args/generate.mjs +1 -1
  14. package/dist/clis/args/{help-rztSuf9S.mjs → help-CfBzQJpL.mjs} +3 -3
  15. package/dist/clis/args/{help-rztSuf9S.mjs.map → help-CfBzQJpL.mjs.map} +1 -1
  16. package/dist/clis/args/help.mjs +1 -1
  17. package/dist/clis/args/index.d.mts +3 -3
  18. package/dist/clis/args/index.mjs +5 -5
  19. package/dist/clis/args/init.d.mts +3 -0
  20. package/dist/clis/args/init.d.mts.map +1 -1
  21. package/dist/clis/args/init.mjs +6 -1
  22. package/dist/clis/args/init.mjs.map +1 -1
  23. package/dist/clis/args/inspect.mjs +1 -1
  24. package/dist/clis/args/install.mjs +1 -1
  25. package/dist/clis/args/list.mjs +1 -1
  26. package/dist/clis/args/login.mjs +1 -1
  27. package/dist/clis/args/migrate.mjs +1 -1
  28. package/dist/clis/args/publish.mjs +1 -1
  29. package/dist/clis/args/registry.mjs +1 -1
  30. package/dist/clis/args/{service-LXIFUZ_8.d.mts → service-DbbCQSks.d.mts} +2 -2
  31. package/dist/clis/args/service-DbbCQSks.d.mts.map +1 -0
  32. package/dist/clis/args/service.d.mts +1 -1
  33. package/dist/clis/args/service.mjs +1 -1
  34. package/dist/clis/args/switchboard.mjs +1 -1
  35. package/dist/clis/args/uninstall.mjs +1 -1
  36. package/dist/clis/args/unpublish.mjs +1 -1
  37. package/dist/clis/args/vetra.mjs +1 -1
  38. package/dist/clis/build-config.d.mts.map +1 -1
  39. package/dist/clis/build-config.mjs +2 -1
  40. package/dist/clis/build-config.mjs.map +1 -1
  41. package/dist/clis/constants.d.mts +62 -4
  42. package/dist/clis/constants.d.mts.map +1 -1
  43. package/dist/clis/constants.mjs +8 -3
  44. package/dist/clis/constants.mjs.map +1 -1
  45. package/dist/clis/index.d.mts +696 -22
  46. package/dist/clis/index.d.mts.map +1 -1
  47. package/dist/clis/index.mjs +546 -12
  48. package/dist/clis/index.mjs.map +1 -1
  49. package/dist/config-loader-DORViRnN.js +144 -0
  50. package/dist/config-loader-DORViRnN.js.map +1 -0
  51. package/dist/connect/config-loader.d.ts +78 -0
  52. package/dist/connect/config-loader.d.ts.map +1 -0
  53. package/dist/connect/config-loader.js +2 -0
  54. package/dist/connect/index.d.ts +295 -245
  55. package/dist/connect/index.d.ts.map +1 -1
  56. package/dist/connect/index.js +264 -103
  57. package/dist/connect/index.js.map +1 -1
  58. package/dist/connect/json-adapter.d.ts +24 -0
  59. package/dist/connect/json-adapter.d.ts.map +1 -0
  60. package/dist/connect/json-adapter.js +28 -0
  61. package/dist/connect/json-adapter.js.map +1 -0
  62. package/dist/{constants-xNwF0jSl.d.ts → constants-C_EQX4DY.d.ts} +1 -1
  63. package/dist/constants-C_EQX4DY.d.ts.map +1 -0
  64. package/dist/constants.d.ts +1 -1
  65. package/dist/document-drive/index.d.ts +2 -2
  66. package/dist/document-drive/index.d.ts.map +1 -1
  67. package/dist/document-drive/index.js +6 -10
  68. package/dist/document-drive/index.js.map +1 -1
  69. package/dist/document-model/index.d.ts +5 -5
  70. package/dist/document-model/index.js +212 -64
  71. package/dist/document-model/index.js.map +1 -1
  72. package/dist/document-model/mock.d.ts +1 -1
  73. package/dist/document-model/utils.d.ts +2 -2
  74. package/dist/document-model/utils.js +1 -1
  75. package/dist/{index-C_iVZe7f.d.ts → index-CQDIrK1k.d.ts} +1 -1
  76. package/dist/index-CQDIrK1k.d.ts.map +1 -0
  77. package/dist/{index-DkRWfM_V.d.ts → index-DalC_-i7.d.ts} +46 -3
  78. package/dist/{index-DkRWfM_V.d.ts.map → index-DalC_-i7.d.ts.map} +1 -1
  79. package/dist/index.d.ts +7 -6
  80. package/dist/{mock-Cgn-VBF_.d.ts → mock-CbrXTFOF.d.ts} +1 -1
  81. package/dist/{mock-Cgn-VBF_.d.ts.map → mock-CbrXTFOF.d.ts.map} +1 -1
  82. package/dist/processors/index.d.ts +1 -1
  83. package/dist/registry/index.d.ts +2 -1
  84. package/dist/registry/index.d.ts.map +1 -1
  85. package/dist/registry/index.js.map +1 -1
  86. package/dist/{types-BFDlQkXZ.d.ts → types-C1in4fl3.d.ts} +1 -1
  87. package/dist/{types-BFDlQkXZ.d.ts.map → types-C1in4fl3.d.ts.map} +1 -1
  88. package/dist/{actions-UH5nIJcP.d.ts → types-CC6ib3_2.d.ts} +1330 -1330
  89. package/dist/types-CC6ib3_2.d.ts.map +1 -0
  90. package/dist/{types-WzwAClp2.d.ts → types-CVqmv94G.d.ts} +3 -109
  91. package/dist/types-CVqmv94G.d.ts.map +1 -0
  92. package/dist/types-Daq_zHP_.d.ts +160 -0
  93. package/dist/types-Daq_zHP_.d.ts.map +1 -0
  94. package/dist/{utils-CJF4w5Bp.d.ts → utils-BEByNOHo.d.ts} +1 -1
  95. package/dist/utils-BEByNOHo.d.ts.map +1 -0
  96. package/dist/{utils-bCWnsmtD.js → utils-DKOFCM0Q.js} +1 -1
  97. package/dist/{utils-bCWnsmtD.js.map → utils-DKOFCM0Q.js.map} +1 -1
  98. package/package.json +6 -3
  99. package/dist/actions-UH5nIJcP.d.ts.map +0 -1
  100. package/dist/clis/args/common-DPYlcz-d.mjs.map +0 -1
  101. package/dist/clis/args/service-LXIFUZ_8.d.mts.map +0 -1
  102. package/dist/constants-xNwF0jSl.d.ts.map +0 -1
  103. package/dist/index-C_iVZe7f.d.ts.map +0 -1
  104. package/dist/types-WzwAClp2.d.ts.map +0 -1
  105. package/dist/utils-CJF4w5Bp.d.ts.map +0 -1
@@ -1,10 +1,10 @@
1
- import { a as buildOperationSignatureParams, c as hex2ab, i as buildOperationSignatureMessage, n as generateId, o as getUnixTimestamp, r as ab2hex, s as hashBrowser, t as deriveOperationId } from "../utils-bCWnsmtD.js";
1
+ import { a as buildOperationSignatureParams, c as hex2ab, i as buildOperationSignatureMessage, n as generateId, o as getUnixTimestamp, r as ab2hex, s as hashBrowser, t as deriveOperationId } from "../utils-DKOFCM0Q.js";
2
2
  import { generateMock } from "./mock.js";
3
3
  import { ZodError, z } from "zod";
4
4
  import { stringify } from "safe-stable-stringify";
5
5
  import { strFromU8, strToU8, unzip, zip } from "fflate";
6
6
  import { castDraft, create, unsafe } from "mutative";
7
- import { pascalCase } from "change-case";
7
+ import { constantCase, pascalCase } from "change-case";
8
8
  //#region document-model/errors.ts
9
9
  const FileSystemError = /* @__PURE__ */ new Error("File system not available.");
10
10
  var InvalidActionInputError = class extends Error {
@@ -1648,16 +1648,72 @@ function isDocumentAction(action) {
1648
1648
  ].includes(action.type);
1649
1649
  }
1650
1650
  /**
1651
- * Important note: it is the responsibility of the caller to set the document type
1652
- * on the header.
1651
+ * The document-scope operations a reactor mints on `create`, so a standalone
1652
+ * document carries its initial state when exported outside a reactor.
1653
1653
  */
1654
- function baseCreateDocument(createState, initialState) {
1654
+ function createDocumentScopeOperations(header, state) {
1655
+ const createInput = {
1656
+ model: header.documentType,
1657
+ version: 0,
1658
+ documentId: header.id,
1659
+ signing: {
1660
+ signature: header.id,
1661
+ publicKey: header.sig.publicKey,
1662
+ nonce: header.sig.nonce,
1663
+ createdAtUtcIso: header.createdAtUtcIso,
1664
+ documentType: header.documentType
1665
+ },
1666
+ slug: header.slug,
1667
+ name: header.name,
1668
+ branch: header.branch,
1669
+ meta: header.meta,
1670
+ protocolVersions: header.protocolVersions ?? { "base-reducer": 2 }
1671
+ };
1672
+ const upgradeInput = {
1673
+ model: header.documentType,
1674
+ fromVersion: 0,
1675
+ toVersion: state.document.version,
1676
+ documentId: header.id,
1677
+ initialState: state
1678
+ };
1679
+ return [{
1680
+ id: generateId(),
1681
+ type: "CREATE_DOCUMENT",
1682
+ scope: "document",
1683
+ timestampUtcMs: header.createdAtUtcIso,
1684
+ input: createInput
1685
+ }, {
1686
+ id: generateId(),
1687
+ type: "UPGRADE_DOCUMENT",
1688
+ scope: "document",
1689
+ timestampUtcMs: header.createdAtUtcIso,
1690
+ input: upgradeInput
1691
+ }].map((action, index) => ({
1692
+ ...action,
1693
+ action,
1694
+ id: deriveOperationId(header.id, "document", header.branch, action.id),
1695
+ hash: "",
1696
+ error: void 0,
1697
+ index,
1698
+ skip: 0
1699
+ }));
1700
+ }
1701
+ /**
1702
+ * Creates a new document. When `documentType` is given the header is stamped
1703
+ * with it and the document-scope operations are seeded.
1704
+ */
1705
+ function baseCreateDocument(createState, initialState, documentType = "") {
1655
1706
  const state = createState(initialState);
1707
+ const header = createPresignedHeader(generateId(), documentType);
1656
1708
  return {
1657
- header: createPresignedHeader(),
1709
+ header,
1658
1710
  state,
1659
1711
  initialState: state,
1660
- operations: {
1712
+ operations: documentType ? {
1713
+ global: [],
1714
+ local: [],
1715
+ document: createDocumentScopeOperations(header, state)
1716
+ } : {
1661
1717
  global: [],
1662
1718
  local: []
1663
1719
  },
@@ -2676,6 +2732,15 @@ const RESERVED_OPERATION_NAMES = [
2676
2732
  "NOOP"
2677
2733
  ];
2678
2734
  /**
2735
+ * Operation names become the literal action `type` string at runtime and the
2736
+ * key for codegen's action union. They must be SCREAMING_SNAKE_CASE so the
2737
+ * generated TypeScript is valid.
2738
+ */
2739
+ const OPERATION_NAME_PATTERN = /^[A-Z][A-Z0-9_]*$/;
2740
+ function isValidOperationNameFormat(name) {
2741
+ return OPERATION_NAME_PATTERN.test(name);
2742
+ }
2743
+ /**
2679
2744
  * Check if name conflicts with base reducer actions (case-insensitive).
2680
2745
  */
2681
2746
  function isReservedOperationName(name) {
@@ -2705,6 +2770,11 @@ function getAllOperationNames(state, excludeOperationId) {
2705
2770
  */
2706
2771
  function validateOperationName(name, state, excludeOperationId) {
2707
2772
  if (!name) return;
2773
+ if (!isValidOperationNameFormat(name)) {
2774
+ const suggestion = constantCase(name);
2775
+ const hint = suggestion && suggestion !== name && isValidOperationNameFormat(suggestion) ? ` Did you mean "${suggestion}"?` : "";
2776
+ throw new Error(`Operation name "${name}" is invalid. Names must be SCREAMING_SNAKE_CASE (matching ${OPERATION_NAME_PATTERN.source}).${hint}`);
2777
+ }
2708
2778
  const upperName = name.toUpperCase();
2709
2779
  if (isReservedOperationName(name)) throw new Error(`Operation name "${name}" is reserved. Please use a different name.`);
2710
2780
  if (getAllOperationNames(state, excludeOperationId).includes(upperName)) throw new Error(`Operation name "${name}" is already used by another operation. Operation names must be unique across all modules.`);
@@ -2800,6 +2870,60 @@ function findOperationOrThrow(state, operationId) {
2800
2870
  }
2801
2871
  throw new Error(`Operation "${operationId}" not found in the latest specification`);
2802
2872
  }
2873
+ /**
2874
+ * Find an operation error by id across all operations in the latest
2875
+ * specification, or throw. Throws on a duplicate id too: setters act on a
2876
+ * single error, so an ambiguous id must fail loudly rather than mutate an
2877
+ * arbitrary match.
2878
+ */
2879
+ function findOperationErrorOrThrow(state, errorId) {
2880
+ const matches = state.specifications[state.specifications.length - 1]?.modules.flatMap((mod) => mod.operations.flatMap((op) => op.errors.filter((e) => e.id === errorId))) ?? [];
2881
+ if (matches.length === 0) throw new Error(`Operation error "${errorId}" not found in the latest specification`);
2882
+ if (matches.length > 1) throw new Error(`Operation error "${errorId}" is duplicated in the latest specification`);
2883
+ return matches[0];
2884
+ }
2885
+ /**
2886
+ * Find an operation example (code example) by id across all operations in the
2887
+ * latest specification, or throw. Throws on a duplicate id for the same reason
2888
+ * as findOperationErrorOrThrow.
2889
+ */
2890
+ function findOperationExampleOrThrow(state, exampleId) {
2891
+ const matches = state.specifications[state.specifications.length - 1]?.modules.flatMap((mod) => mod.operations.flatMap((op) => op.examples.filter((e) => e.id === exampleId))) ?? [];
2892
+ if (matches.length === 0) throw new Error(`Operation example "${exampleId}" not found in the latest specification`);
2893
+ if (matches.length > 1) throw new Error(`Operation example "${exampleId}" is duplicated in the latest specification`);
2894
+ return matches[0];
2895
+ }
2896
+ /**
2897
+ * Assert no module in the latest specification already uses `id`. Modules are
2898
+ * targeted by id by the setter/delete/reorder reducers, so a duplicate id makes
2899
+ * those operations ambiguous.
2900
+ */
2901
+ function assertModuleIdUnique(state, id) {
2902
+ if (state.specifications[state.specifications.length - 1]?.modules.some((m) => m.id === id)) throw new Error(`Module "${id}" already exists in the latest specification`);
2903
+ }
2904
+ /**
2905
+ * Assert no operation in the latest specification already uses `id`. Operations
2906
+ * are targeted by id across all modules, so the id must be unique document-wide.
2907
+ */
2908
+ function assertOperationIdUnique(state, id) {
2909
+ if (state.specifications[state.specifications.length - 1]?.modules.some((m) => m.operations.some((o) => o.id === id))) throw new Error(`Operation "${id}" already exists in the latest specification`);
2910
+ }
2911
+ /**
2912
+ * Assert no operation error in the latest specification already uses `id`.
2913
+ * Error ids are targeted document-wide by the setter/delete reducers, so the id
2914
+ * must be unique to keep those operations unambiguous.
2915
+ */
2916
+ function assertOperationErrorIdUnique(state, id) {
2917
+ if (state.specifications[state.specifications.length - 1]?.modules.some((m) => m.operations.some((o) => o.errors.some((e) => e.id === id)))) throw new Error(`Operation error "${id}" already exists in the latest specification`);
2918
+ }
2919
+ /**
2920
+ * Assert no operation example in the latest specification already uses `id`.
2921
+ * Example ids are targeted document-wide by the update/delete reducers, so the
2922
+ * id must be unique to keep those operations unambiguous.
2923
+ */
2924
+ function assertOperationExampleIdUnique(state, id) {
2925
+ if (state.specifications[state.specifications.length - 1]?.modules.some((m) => m.operations.some((o) => o.examples.some((e) => e.id === id)))) throw new Error(`Operation example "${id}" already exists in the latest specification`);
2926
+ }
2803
2927
  function validateOperations(operations) {
2804
2928
  const errors = [];
2805
2929
  const scopes = Object.keys(operations);
@@ -2824,10 +2948,22 @@ function validateOperations(operations) {
2824
2948
  }
2825
2949
  //#endregion
2826
2950
  //#region document-model/reducers.ts
2827
- function sorter(order) {
2828
- const mapping = {};
2829
- order.forEach((key, index) => mapping[key] = index);
2830
- return (a, b) => (mapping[b.id] || 999999) - (mapping[a.id] || 999999);
2951
+ /**
2952
+ * Reorder `items` by the position of their id in `order`. Ids not listed in
2953
+ * `order` keep their relative position after the listed ones. Throws if `order`
2954
+ * references an id that isn't present, so a stale or mistyped id fails loudly
2955
+ * instead of silently producing an arbitrary order.
2956
+ */
2957
+ function orderBy(items, order) {
2958
+ const ids = new Set(items.map((item) => item.id));
2959
+ for (const id of order) if (!ids.has(id)) throw new Error(`Cannot reorder: unknown id "${id}"`);
2960
+ const rank = new Map(order.map((id, index) => [id, index]));
2961
+ return items.map((item, index) => ({
2962
+ item,
2963
+ index
2964
+ })).sort((a, b) => {
2965
+ return (rank.get(a.item.id) ?? Number.MAX_SAFE_INTEGER) - (rank.get(b.item.id) ?? Number.MAX_SAFE_INTEGER) || a.index - b.index;
2966
+ }).map(({ item }) => item);
2831
2967
  }
2832
2968
  const documentModelHeaderReducer = {
2833
2969
  setModelNameOperation(state, action) {
@@ -2859,6 +2995,7 @@ const documentModelHeaderReducer = {
2859
2995
  };
2860
2996
  const documentModelModuleReducer = {
2861
2997
  addModuleOperation(state, action) {
2998
+ assertModuleIdUnique(state, action.input.id);
2862
2999
  state.specifications[state.specifications.length - 1].modules.push({
2863
3000
  id: action.input.id,
2864
3001
  name: action.input.name,
@@ -2867,24 +3004,28 @@ const documentModelModuleReducer = {
2867
3004
  });
2868
3005
  },
2869
3006
  setModuleNameOperation(state, action) {
2870
- const latestSpec = state.specifications[state.specifications.length - 1];
2871
- for (let i = 0; i < latestSpec.modules.length; i++) if (latestSpec.modules[i].id === action.input.id) latestSpec.modules[i].name = action.input.name || "";
3007
+ const targetModule = findModuleOrThrow(state, action.input.id);
3008
+ targetModule.name = action.input.name || "";
2872
3009
  },
2873
3010
  setModuleDescriptionOperation(state, action) {
2874
- const latestSpec = state.specifications[state.specifications.length - 1];
2875
- for (let i = 0; i < latestSpec.modules.length; i++) if (latestSpec.modules[i].id === action.input.id) latestSpec.modules[i].description = action.input.description || "";
3011
+ const targetModule = findModuleOrThrow(state, action.input.id);
3012
+ targetModule.description = action.input.description || "";
2876
3013
  },
2877
3014
  deleteModuleOperation(state, action) {
3015
+ findModuleOrThrow(state, action.input.id);
2878
3016
  const latestSpec = state.specifications[state.specifications.length - 1];
2879
3017
  latestSpec.modules = latestSpec.modules.filter((m) => m.id != action.input.id);
2880
3018
  },
2881
3019
  reorderModulesOperation(state, action) {
2882
- state.specifications[state.specifications.length - 1].modules.sort(sorter(action.input.order));
3020
+ const latestSpec = state.specifications[state.specifications.length - 1];
3021
+ latestSpec.modules = orderBy(latestSpec.modules, action.input.order);
2883
3022
  }
2884
3023
  };
2885
3024
  const documentModelOperationErrorReducer = {
2886
3025
  addOperationErrorOperation(state, action) {
2887
- findOperationOrThrow(state, action.input.operationId).errors.push({
3026
+ const targetOp = findOperationOrThrow(state, action.input.operationId);
3027
+ assertOperationErrorIdUnique(state, action.input.id);
3028
+ targetOp.errors.push({
2888
3029
  id: action.input.id,
2889
3030
  name: action.input.errorName || "",
2890
3031
  code: action.input.errorCode || "",
@@ -2893,54 +3034,58 @@ const documentModelOperationErrorReducer = {
2893
3034
  });
2894
3035
  },
2895
3036
  setOperationErrorCodeOperation(state, action) {
2896
- const latestSpec = state.specifications[state.specifications.length - 1];
2897
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) latestSpec.modules[i].operations[j].errors[k].code = action.input.errorCode || "";
3037
+ const error = findOperationErrorOrThrow(state, action.input.id);
3038
+ error.code = action.input.errorCode || "";
2898
3039
  },
2899
3040
  setOperationErrorNameOperation(state, action) {
2900
- const latestSpec = state.specifications[state.specifications.length - 1];
2901
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) latestSpec.modules[i].operations[j].errors[k].name = action.input.errorName || "";
3041
+ const error = findOperationErrorOrThrow(state, action.input.id);
3042
+ error.name = action.input.errorName || "";
2902
3043
  },
2903
3044
  setOperationErrorDescriptionOperation(state, action) {
2904
- const latestSpec = state.specifications[state.specifications.length - 1];
2905
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) latestSpec.modules[i].operations[j].errors[k].description = action.input.errorDescription || "";
3045
+ const error = findOperationErrorOrThrow(state, action.input.id);
3046
+ error.description = action.input.errorDescription || "";
2906
3047
  },
2907
3048
  setOperationErrorTemplateOperation(state, action) {
2908
- const latestSpec = state.specifications[state.specifications.length - 1];
2909
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) if (latestSpec.modules[i].operations[j].errors[k].id == action.input.id) latestSpec.modules[i].operations[j].errors[k].template = action.input.errorTemplate || "";
3049
+ const error = findOperationErrorOrThrow(state, action.input.id);
3050
+ error.template = action.input.errorTemplate || "";
2910
3051
  },
2911
3052
  deleteOperationErrorOperation(state, action) {
2912
3053
  const latestSpec = state.specifications[state.specifications.length - 1];
2913
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) latestSpec.modules[i].operations[j].errors = latestSpec.modules[i].operations[j].errors.filter((e) => e.id != action.input.id);
3054
+ if (!latestSpec.modules.some((mod) => mod.operations.some((op) => op.errors.some((e) => e.id === action.input.id)))) throw new Error(`Operation error "${action.input.id}" not found in the latest specification`);
3055
+ for (const mod of latestSpec.modules) for (const op of mod.operations) op.errors = op.errors.filter((e) => e.id != action.input.id);
2914
3056
  },
2915
3057
  reorderOperationErrorsOperation(state, action) {
2916
- const latestSpec = state.specifications[state.specifications.length - 1];
2917
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.operationId) latestSpec.modules[i].operations[j].errors.sort(sorter(action.input.order));
3058
+ const targetOp = findOperationOrThrow(state, action.input.operationId);
3059
+ targetOp.errors = orderBy(targetOp.errors, action.input.order);
2918
3060
  }
2919
3061
  };
2920
3062
  const documentModelOperationExampleReducer = {
2921
3063
  addOperationExampleOperation(state, action) {
2922
- const latestSpec = state.specifications[state.specifications.length - 1];
2923
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.operationId) latestSpec.modules[i].operations[j].examples.push({
3064
+ const targetOp = findOperationOrThrow(state, action.input.operationId);
3065
+ assertOperationExampleIdUnique(state, action.input.id);
3066
+ targetOp.examples.push({
2924
3067
  id: action.input.id,
2925
3068
  value: action.input.example
2926
3069
  });
2927
3070
  },
2928
3071
  updateOperationExampleOperation(state, action) {
2929
- const latestSpec = state.specifications[state.specifications.length - 1];
2930
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) for (let k = 0; k < latestSpec.modules[i].operations[j].examples.length; k++) if (latestSpec.modules[i].operations[j].examples[k].id == action.input.id) latestSpec.modules[i].operations[j].examples[k].value = action.input.example;
3072
+ const example = findOperationExampleOrThrow(state, action.input.id);
3073
+ example.value = action.input.example;
2931
3074
  },
2932
3075
  deleteOperationExampleOperation(state, action) {
2933
3076
  const latestSpec = state.specifications[state.specifications.length - 1];
2934
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) latestSpec.modules[i].operations[j].examples = latestSpec.modules[i].operations[j].examples.filter((e) => e.id != action.input.id);
3077
+ if (!latestSpec.modules.some((mod) => mod.operations.some((op) => op.examples.some((e) => e.id === action.input.id)))) throw new Error(`Operation example "${action.input.id}" not found in the latest specification`);
3078
+ for (const mod of latestSpec.modules) for (const op of mod.operations) op.examples = op.examples.filter((e) => e.id != action.input.id);
2935
3079
  },
2936
3080
  reorderOperationExamplesOperation(state, action) {
2937
- const latestSpec = state.specifications[state.specifications.length - 1];
2938
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.operationId) latestSpec.modules[i].operations[j].examples.sort(sorter(action.input.order));
3081
+ const targetOp = findOperationOrThrow(state, action.input.operationId);
3082
+ targetOp.examples = orderBy(targetOp.examples, action.input.order);
2939
3083
  }
2940
3084
  };
2941
3085
  const documentModelOperationReducer = {
2942
3086
  addOperationOperation(state, action) {
2943
3087
  validateOperationName(action.input.name, state);
3088
+ assertOperationIdUnique(state, action.input.id);
2944
3089
  findModuleOrThrow(state, action.input.moduleId).operations.push({
2945
3090
  id: action.input.id,
2946
3091
  name: action.input.name,
@@ -2955,8 +3100,8 @@ const documentModelOperationReducer = {
2955
3100
  },
2956
3101
  setOperationNameOperation(state, action) {
2957
3102
  if (action.input.name) validateOperationName(action.input.name, state, action.input.id);
2958
- const latestSpec = state.specifications[state.specifications.length - 1];
2959
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.id) latestSpec.modules[i].operations[j].name = action.input.name || "";
3103
+ const targetOp = findOperationOrThrow(state, action.input.id);
3104
+ targetOp.name = action.input.name || "";
2960
3105
  },
2961
3106
  setOperationScopeOperation(state, action) {
2962
3107
  const targetOp = findOperationOrThrow(state, action.input.id);
@@ -2966,40 +3111,39 @@ const documentModelOperationReducer = {
2966
3111
  targetOp.scope = action.input.scope || "global";
2967
3112
  },
2968
3113
  setOperationSchemaOperation(state, action) {
2969
- const latestSpec = state.specifications[state.specifications.length - 1];
2970
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.id) latestSpec.modules[i].operations[j].schema = action.input.schema || "";
3114
+ const targetOp = findOperationOrThrow(state, action.input.id);
3115
+ targetOp.schema = action.input.schema || "";
2971
3116
  },
2972
3117
  setOperationDescriptionOperation(state, action) {
2973
- const latestSpec = state.specifications[state.specifications.length - 1];
2974
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.id) latestSpec.modules[i].operations[j].description = action.input.description || "";
3118
+ const targetOp = findOperationOrThrow(state, action.input.id);
3119
+ targetOp.description = action.input.description || "";
2975
3120
  },
2976
3121
  setOperationTemplateOperation(state, action) {
2977
- const latestSpec = state.specifications[state.specifications.length - 1];
2978
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.id) latestSpec.modules[i].operations[j].template = action.input.template || "";
3122
+ const targetOp = findOperationOrThrow(state, action.input.id);
3123
+ targetOp.template = action.input.template || "";
2979
3124
  },
2980
3125
  setOperationReducerOperation(state, action) {
2981
- const latestSpec = state.specifications[state.specifications.length - 1];
2982
- for (let i = 0; i < latestSpec.modules.length; i++) for (let j = 0; j < latestSpec.modules[i].operations.length; j++) if (latestSpec.modules[i].operations[j].id == action.input.id) latestSpec.modules[i].operations[j].reducer = action.input.reducer || "";
3126
+ const targetOp = findOperationOrThrow(state, action.input.id);
3127
+ targetOp.reducer = action.input.reducer || "";
2983
3128
  },
2984
3129
  moveOperationOperation(state, action) {
2985
- const moveOperations = [];
3130
+ const targetModule = findModuleOrThrow(state, action.input.newModuleId);
2986
3131
  const latestSpec = state.specifications[state.specifications.length - 1];
2987
- for (let i = 0; i < latestSpec.modules.length; i++) latestSpec.modules[i].operations = latestSpec.modules[i].operations.filter((operation) => {
2988
- if (operation.id == action.input.operationId) {
2989
- moveOperations.push(operation);
2990
- return false;
2991
- }
2992
- return true;
2993
- });
2994
- for (let i = 0; i < latestSpec.modules.length; i++) if (latestSpec.modules[i].id == action.input.newModuleId) latestSpec.modules[i].operations.push(...moveOperations);
3132
+ const matches = latestSpec.modules.flatMap((mod) => mod.operations.filter((op) => op.id === action.input.operationId));
3133
+ if (matches.length === 0) throw new Error(`Operation "${action.input.operationId}" not found in the latest specification`);
3134
+ if (matches.length > 1) throw new Error(`Operation "${action.input.operationId}" is duplicated in the latest specification`);
3135
+ const moved = matches[0];
3136
+ for (const mod of latestSpec.modules) mod.operations = mod.operations.filter((op) => op.id !== action.input.operationId);
3137
+ targetModule.operations.push(moved);
2995
3138
  },
2996
3139
  deleteOperationOperation(state, action) {
3140
+ findOperationOrThrow(state, action.input.id);
2997
3141
  const latestSpec = state.specifications[state.specifications.length - 1];
2998
- for (let i = 0; i < latestSpec.modules.length; i++) latestSpec.modules[i].operations = latestSpec.modules[i].operations.filter((operation) => operation.id != action.input.id);
3142
+ for (const mod of latestSpec.modules) mod.operations = mod.operations.filter((operation) => operation.id != action.input.id);
2999
3143
  },
3000
3144
  reorderModuleOperationsOperation(state, action) {
3001
- const latestSpec = state.specifications[state.specifications.length - 1];
3002
- for (let i = 0; i < latestSpec.modules.length; i++) if (latestSpec.modules[i].id == action.input.moduleId) latestSpec.modules[i].operations.sort(sorter(action.input.order));
3145
+ const targetModule = findModuleOrThrow(state, action.input.moduleId);
3146
+ targetModule.operations = orderBy(targetModule.operations, action.input.order);
3003
3147
  }
3004
3148
  };
3005
3149
  const documentModelStateSchemaReducer = {
@@ -3024,18 +3168,22 @@ const documentModelStateSchemaReducer = {
3024
3168
  updateStateExampleOperation(state, action) {
3025
3169
  const latestSpec = state.specifications[state.specifications.length - 1];
3026
3170
  if (!Object.keys(latestSpec.state).includes(action.input.scope)) throw new Error(`Invalid scope: ${action.input.scope}`);
3027
- const examples = latestSpec.state[action.input.scope].examples;
3028
- for (let i = 0; i < examples.length; i++) if (examples[i].id == action.input.id) examples[i].value = action.input.newExample;
3171
+ const example = latestSpec.state[action.input.scope].examples.find((e) => e.id == action.input.id);
3172
+ if (!example) throw new Error(`State example "${action.input.id}" not found in scope "${action.input.scope}"`);
3173
+ example.value = action.input.newExample;
3029
3174
  },
3030
3175
  deleteStateExampleOperation(state, action) {
3031
3176
  const latestSpec = state.specifications[state.specifications.length - 1];
3032
- if (Object.keys(latestSpec.state).includes(action.input.scope)) latestSpec.state[action.input.scope].examples = latestSpec.state[action.input.scope].examples.filter((e) => e.id != action.input.id);
3033
- else throw new Error(`Invalid scope: ${action.input.scope}`);
3177
+ if (!Object.keys(latestSpec.state).includes(action.input.scope)) throw new Error(`Invalid scope: ${action.input.scope}`);
3178
+ const scopeState = latestSpec.state[action.input.scope];
3179
+ if (!scopeState.examples.some((e) => e.id == action.input.id)) throw new Error(`State example "${action.input.id}" not found in scope "${action.input.scope}"`);
3180
+ scopeState.examples = scopeState.examples.filter((e) => e.id != action.input.id);
3034
3181
  },
3035
3182
  reorderStateExamplesOperation(state, action) {
3036
3183
  const latestSpec = state.specifications[state.specifications.length - 1];
3037
- if (Object.keys(latestSpec.state).includes(action.input.scope)) latestSpec.state[action.input.scope].examples.sort(sorter(action.input.order));
3038
- else throw new Error(`Invalid scope: ${action.input.scope}`);
3184
+ if (!Object.keys(latestSpec.state).includes(action.input.scope)) throw new Error(`Invalid scope: ${action.input.scope}`);
3185
+ const scopeState = latestSpec.state[action.input.scope];
3186
+ scopeState.examples = orderBy(scopeState.examples, action.input.order);
3039
3187
  }
3040
3188
  };
3041
3189
  const documentModelVersioningReducer = {
@@ -3485,6 +3633,6 @@ function createState(baseState, globalState, localState) {
3485
3633
  };
3486
3634
  }
3487
3635
  //#endregion
3488
- export { AddChangeLogItemInputSchema, AddModuleInputSchema, AddOperationErrorInputSchema, AddOperationExampleInputSchema, AddOperationInputSchema, AddStateExampleInputSchema, AuthorSchema, BaseDocumentHeaderSchema, BaseDocumentStateSchema, CodeExampleSchema, ConfigEntrySchema, ConfigEntryTypeSchema, DeleteChangeLogItemInputSchema, DeleteModuleInputSchema, DeleteOperationErrorInputSchema, DeleteOperationExampleInputSchema, DeleteOperationInputSchema, DeleteStateExampleInputSchema, DocumentActionSchema, DocumentFileSchema, DocumentModelGlobalStateSchema, DocumentModelHeaderSchema, DocumentModelInputSchema, DocumentModelPHStateSchema, DocumentModelSchema, DocumentSpecificationSchema, FileSystemError, HASH_ALGORITHM_SHA1, HASH_ALGORITHM_SHA256, HASH_ALGORITHM_SHA512, HASH_ENCODING_BASE64, HASH_ENCODING_HEX, HashMismatchError, IntegrityIssueSubType, IntegrityIssueType, InvalidActionInputError, InvalidActionInputZodError, LoadStateActionInputSchema, LoadStateActionSchema, LoadStateActionStateInputSchema, Load_StateSchema, ManifestSchema, ModuleSchema, MoveOperationInputSchema, OperationErrorSchema, OperationScopeSchema, OperationSpecificationSchema, PowerhouseModuleSchema, PowerhouseModulesSchema, PruneActionInputSchema, PruneActionSchema, PruneSchema, PublisherSchema, RESERVED_OPERATION_NAMES, RedoActionInputSchema, RedoActionSchema, RedoSchema, ReorderChangeLogItemsInputSchema, ReorderModuleOperationsInputSchema, ReorderModulesInputSchema, ReorderOperationErrorsInputSchema, ReorderOperationExamplesInputSchema, ReorderStateExamplesInputSchema, ScopeStateSchema, SetAuthorNameInputSchema, SetAuthorWebsiteInputSchema, SetInitialStateInputSchema, SetModelDescriptionInputSchema, SetModelExtensionInputSchema, SetModelIdInputSchema, SetModelNameInputSchema, SetModuleDescriptionInputSchema, SetModuleNameInputSchema, SetNameActionInputSchema, SetNameActionSchema, SetOperationDescriptionInputSchema, SetOperationErrorCodeInputSchema, SetOperationErrorDescriptionInputSchema, SetOperationErrorNameInputSchema, SetOperationErrorTemplateInputSchema, SetOperationNameInputSchema, SetOperationReducerInputSchema, SetOperationSchemaInputSchema, SetOperationScopeInputSchema, SetOperationTemplateInputSchema, SetPreferredEditorActionInputSchema, SetPreferredEditorActionSchema, SetStateSchemaInputSchema, Set_NameSchema, Set_PreferredEditorSchema, StateSchema, UndoActionInputSchema, UndoActionSchema, UndoSchema, UpdateChangeLogItemInputSchema, UpdateOperationExampleInputSchema, UpdateStateExampleInputSchema, ab2hex, actionContext, actionFromAction, actionSigner, actions, addChangeLogItem, addModule, addOperation, addOperationError, addOperationExample, addStateExample, addUndo, assertIsDocumentModelDocument, assertIsDocumentModelState, attachBranch, baseActions, baseCreateDocument, baseLoadFromInput, baseReducer, baseSaveToFileHandle, buildOperationSignature, buildOperationSignatureMessage, buildOperationSignatureParams, buildSignedAction, checkCleanedOperationsIntegrity, checkOperationsIntegrity, createAction, createAuthState, createBaseState, createDocumentState, createGlobalState, createLocalState, createMinimalZip, createPresignedHeader, createReducer, createSignedHeader, createSignedHeaderForSigner, createState, createVerificationSigner, createZip, defaultAuthState, defaultBaseState, defaultDocumentState, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, deleteChangeLogItem, deleteModule, deleteOperation, deleteOperationError, deleteOperationExample, deleteStateExample, deriveOperationId, diffOperations, documentModelActions, documentModelDocumentType, documentModelFileExtension, documentModelGlobalState, documentModelHeaderReducer, documentModelInitialGlobalState, documentModelInitialLocalState, documentModelLoadFromInput, documentModelModuleReducer, documentModelOperationErrorReducer, documentModelOperationExampleReducer, documentModelOperationReducer, documentModelReducer, documentModelSaveToFileHandle, documentModelStateReducer, documentModelStateSchemaReducer, documentModelVersioningReducer, fetchFileBrowser, filterDocumentOperationsResultingState, filterDuplicatedOperations, findModuleOrThrow, findOperationOrThrow, garbageCollect, garbageCollectDocumentOperations, garbageCollectV2, generateId, generateMock, getAllOperationNames, getDocumentLastModified, getFileBrowser, getUnixTimestamp, groupOperationsByScope, hashBrowser, hashDocumentStateForScope, hex2ab, isDefinedNonNullAny, isDocumentAction, isDocumentModelDocument, isDocumentModelState, isNoopOperation, isReservedOperationName, isUndo, isUndoRedo, loadState, loadStateOperation, mapSkippedOperations, mapSkippedOperationsV2, merge, moveOperation, nextSkipNumber, noop, operationExampleCreators, operationFromAction, operationFromOperation, operationWithContext, operationsAreEqual, parseResultingState, precedes, prepareOperations, processUndoRedo, prune, pruneOperation, readFileBrowser, readOnly, redo, redoOperation, releaseNewVersion, removeExistingOperations, reorderChangeLogItems, reorderModuleOperations, reorderModules, reorderOperationErrors, reorderOperationExamples, reorderStateExamples, replayDocument, replayOperations, reshuffleByTimestamp, reshuffleByTimestampAndIndex, setAuthorName, setAuthorWebsite, setInitialState, setModelDescription, setModelExtension, setModelId, setModelName, setModuleDescription, setModuleName, setName, setNameOperation, setOperationDescription, setOperationErrorCode, setOperationErrorDescription, setOperationErrorName, setOperationErrorTemplate, setOperationName, setOperationReducer, setOperationSchema, setOperationScope, setOperationTemplate, setPreferredEditor, setPreferredEditorOperation, setStateSchema, sign, skipHeaderOperations, sortMappedOperations, sortOperations, split, undo, undoOperation, undoOperationV2, updateChangeLogItem, updateDocument, updateHeaderRevision, updateOperationExample, updateStateExample, validateHeader, validateInitialState, validateModule, validateModuleOperation, validateModules, validateOperationName, validateOperations, validateStateSchemaName, verify, verifyOperationSignature, writeFileBrowser };
3636
+ export { AddChangeLogItemInputSchema, AddModuleInputSchema, AddOperationErrorInputSchema, AddOperationExampleInputSchema, AddOperationInputSchema, AddStateExampleInputSchema, AuthorSchema, BaseDocumentHeaderSchema, BaseDocumentStateSchema, CodeExampleSchema, ConfigEntrySchema, ConfigEntryTypeSchema, DeleteChangeLogItemInputSchema, DeleteModuleInputSchema, DeleteOperationErrorInputSchema, DeleteOperationExampleInputSchema, DeleteOperationInputSchema, DeleteStateExampleInputSchema, DocumentActionSchema, DocumentFileSchema, DocumentModelGlobalStateSchema, DocumentModelHeaderSchema, DocumentModelInputSchema, DocumentModelPHStateSchema, DocumentModelSchema, DocumentSpecificationSchema, FileSystemError, HASH_ALGORITHM_SHA1, HASH_ALGORITHM_SHA256, HASH_ALGORITHM_SHA512, HASH_ENCODING_BASE64, HASH_ENCODING_HEX, HashMismatchError, IntegrityIssueSubType, IntegrityIssueType, InvalidActionInputError, InvalidActionInputZodError, LoadStateActionInputSchema, LoadStateActionSchema, LoadStateActionStateInputSchema, Load_StateSchema, ManifestSchema, ModuleSchema, MoveOperationInputSchema, OPERATION_NAME_PATTERN, OperationErrorSchema, OperationScopeSchema, OperationSpecificationSchema, PowerhouseModuleSchema, PowerhouseModulesSchema, PruneActionInputSchema, PruneActionSchema, PruneSchema, PublisherSchema, RESERVED_OPERATION_NAMES, RedoActionInputSchema, RedoActionSchema, RedoSchema, ReorderChangeLogItemsInputSchema, ReorderModuleOperationsInputSchema, ReorderModulesInputSchema, ReorderOperationErrorsInputSchema, ReorderOperationExamplesInputSchema, ReorderStateExamplesInputSchema, ScopeStateSchema, SetAuthorNameInputSchema, SetAuthorWebsiteInputSchema, SetInitialStateInputSchema, SetModelDescriptionInputSchema, SetModelExtensionInputSchema, SetModelIdInputSchema, SetModelNameInputSchema, SetModuleDescriptionInputSchema, SetModuleNameInputSchema, SetNameActionInputSchema, SetNameActionSchema, SetOperationDescriptionInputSchema, SetOperationErrorCodeInputSchema, SetOperationErrorDescriptionInputSchema, SetOperationErrorNameInputSchema, SetOperationErrorTemplateInputSchema, SetOperationNameInputSchema, SetOperationReducerInputSchema, SetOperationSchemaInputSchema, SetOperationScopeInputSchema, SetOperationTemplateInputSchema, SetPreferredEditorActionInputSchema, SetPreferredEditorActionSchema, SetStateSchemaInputSchema, Set_NameSchema, Set_PreferredEditorSchema, StateSchema, UndoActionInputSchema, UndoActionSchema, UndoSchema, UpdateChangeLogItemInputSchema, UpdateOperationExampleInputSchema, UpdateStateExampleInputSchema, ab2hex, actionContext, actionFromAction, actionSigner, actions, addChangeLogItem, addModule, addOperation, addOperationError, addOperationExample, addStateExample, addUndo, assertIsDocumentModelDocument, assertIsDocumentModelState, assertModuleIdUnique, assertOperationErrorIdUnique, assertOperationExampleIdUnique, assertOperationIdUnique, attachBranch, baseActions, baseCreateDocument, baseLoadFromInput, baseReducer, baseSaveToFileHandle, buildOperationSignature, buildOperationSignatureMessage, buildOperationSignatureParams, buildSignedAction, checkCleanedOperationsIntegrity, checkOperationsIntegrity, createAction, createAuthState, createBaseState, createDocumentState, createGlobalState, createLocalState, createMinimalZip, createPresignedHeader, createReducer, createSignedHeader, createSignedHeaderForSigner, createState, createVerificationSigner, createZip, defaultAuthState, defaultBaseState, defaultDocumentState, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, deleteChangeLogItem, deleteModule, deleteOperation, deleteOperationError, deleteOperationExample, deleteStateExample, deriveOperationId, diffOperations, documentModelActions, documentModelDocumentType, documentModelFileExtension, documentModelGlobalState, documentModelHeaderReducer, documentModelInitialGlobalState, documentModelInitialLocalState, documentModelLoadFromInput, documentModelModuleReducer, documentModelOperationErrorReducer, documentModelOperationExampleReducer, documentModelOperationReducer, documentModelReducer, documentModelSaveToFileHandle, documentModelStateReducer, documentModelStateSchemaReducer, documentModelVersioningReducer, fetchFileBrowser, filterDocumentOperationsResultingState, filterDuplicatedOperations, findModuleOrThrow, findOperationErrorOrThrow, findOperationExampleOrThrow, findOperationOrThrow, garbageCollect, garbageCollectDocumentOperations, garbageCollectV2, generateId, generateMock, getAllOperationNames, getDocumentLastModified, getFileBrowser, getUnixTimestamp, groupOperationsByScope, hashBrowser, hashDocumentStateForScope, hex2ab, isDefinedNonNullAny, isDocumentAction, isDocumentModelDocument, isDocumentModelState, isNoopOperation, isReservedOperationName, isUndo, isUndoRedo, isValidOperationNameFormat, loadState, loadStateOperation, mapSkippedOperations, mapSkippedOperationsV2, merge, moveOperation, nextSkipNumber, noop, operationExampleCreators, operationFromAction, operationFromOperation, operationWithContext, operationsAreEqual, parseResultingState, precedes, prepareOperations, processUndoRedo, prune, pruneOperation, readFileBrowser, readOnly, redo, redoOperation, releaseNewVersion, removeExistingOperations, reorderChangeLogItems, reorderModuleOperations, reorderModules, reorderOperationErrors, reorderOperationExamples, reorderStateExamples, replayDocument, replayOperations, reshuffleByTimestamp, reshuffleByTimestampAndIndex, setAuthorName, setAuthorWebsite, setInitialState, setModelDescription, setModelExtension, setModelId, setModelName, setModuleDescription, setModuleName, setName, setNameOperation, setOperationDescription, setOperationErrorCode, setOperationErrorDescription, setOperationErrorName, setOperationErrorTemplate, setOperationName, setOperationReducer, setOperationSchema, setOperationScope, setOperationTemplate, setPreferredEditor, setPreferredEditorOperation, setStateSchema, sign, skipHeaderOperations, sortMappedOperations, sortOperations, split, undo, undoOperation, undoOperationV2, updateChangeLogItem, updateDocument, updateHeaderRevision, updateOperationExample, updateStateExample, validateHeader, validateInitialState, validateModule, validateModuleOperation, validateModules, validateOperationName, validateOperations, validateStateSchemaName, verify, verifyOperationSignature, writeFileBrowser };
3489
3637
 
3490
3638
  //# sourceMappingURL=index.js.map